mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 06:38:06 +02:00
Opkman: ShowHintfrm: Make colors user configurable.
git-svn-id: trunk@56815 -
This commit is contained in:
parent
ee02d44114
commit
fa1db9d1b6
@ -20,7 +20,7 @@
|
||||
<Description Value="Online package manger"/>
|
||||
<License Value="GPL"/>
|
||||
<Version Major="1" Release="1" Build="2"/>
|
||||
<Files Count="28">
|
||||
<Files Count="29">
|
||||
<Item1>
|
||||
<Filename Value="onlinepackagemanagerintf.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
@ -139,6 +139,10 @@
|
||||
<Filename Value="opkman_showhintbase.pas"/>
|
||||
<UnitName Value="opkman_showhintbase"/>
|
||||
</Item28>
|
||||
<Item29>
|
||||
<Filename Value="opkman_colorsfrm.pas"/>
|
||||
<UnitName Value="opkman_colorsfrm"/>
|
||||
</Item29>
|
||||
</Files>
|
||||
<i18n>
|
||||
<EnableI18N Value="True"/>
|
||||
|
@ -17,7 +17,7 @@ uses
|
||||
opkman_uploader, opkman_repositories, opkman_createrepositoryfrm,
|
||||
opkman_repositorydetailsfrm, opkman_addrepositorypackagefrm, opkman_intf,
|
||||
opkman_intf_packagelistfrm, opkman_showhint, opkman_showhintbase,
|
||||
LazarusPackageIntf;
|
||||
opkman_colorsfrm, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -298,6 +298,7 @@ resourcestring
|
||||
rsOptions_rbHintFormOptions_Item2 = 'Off';
|
||||
rsOptions_lbFilterFiles_Caption = 'Excluded files (packages)';
|
||||
rsOptions_lbFilterDirs_Caption = 'Excluded folders (packages)';
|
||||
rsOptions_bColors_Caption = 'Colors';
|
||||
rsOptions_bpOptions_bHelp = 'Restore defaults';
|
||||
rsOptions_bAdd_Caption = 'Add';
|
||||
rsOptions_bEdit_Caption = 'Edit';
|
||||
@ -486,6 +487,9 @@ resourcestring
|
||||
rsOPMIntfPackageListFrm_VSTHeaderColumn_LazarusPackage = 'Lazarus Package';
|
||||
rsOPMIntfPackageListFrm_VSTHeaderColumn_Data = 'Data';
|
||||
|
||||
//colors form
|
||||
rsColors_Caption = 'Colors';
|
||||
rsColors_CD_Title = 'Select color';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -27,7 +27,7 @@ unit opkman_options;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
Classes, SysUtils, Graphics,
|
||||
// LazUtils
|
||||
Laz2_XMLCfg, LazFileUtils,
|
||||
// IdeIntf
|
||||
@ -37,6 +37,7 @@ uses
|
||||
|
||||
const
|
||||
OpkVersion = 1;
|
||||
HintColCnt = 3;
|
||||
|
||||
type
|
||||
{ TOptions }
|
||||
@ -65,6 +66,7 @@ type
|
||||
FShowRegularIcons: Boolean;
|
||||
FUseDefaultTheme: Boolean;
|
||||
FHintFormOption: Integer;
|
||||
FHintFormOptionColors: TStringList;
|
||||
FChanged: Boolean;
|
||||
FLastDownloadDir: String;
|
||||
FLastPackageDirSrc: String;
|
||||
@ -81,6 +83,7 @@ type
|
||||
FUserProfile: Integer;
|
||||
FExcludedFiles: String;
|
||||
FExcludedFolders: String;
|
||||
procedure CheckColors;
|
||||
public
|
||||
constructor Create(const AFileName: String);
|
||||
destructor Destroy; override;
|
||||
@ -102,6 +105,7 @@ type
|
||||
property ShowRegularIcons: Boolean read FShowRegularIcons write FShowRegularIcons;
|
||||
property UseDefaultTheme: Boolean read FUseDefaultTheme write FUseDefaultTheme;
|
||||
property HintFormOption: Integer read FHintFormOption write FHintFormOption;
|
||||
property HintFormOptionColors: TStringList read FHintFormOptionColors write FHintFormOptionColors;
|
||||
property UserProfile: Integer read FUserProfile write FUserProfile;
|
||||
property LastDownloadDir: String read FLastDownloadDir write FLastDownloadDir;
|
||||
property LastPackagedirSrc: String read FLastPackageDirSrc write FLastPackageDirSrc;
|
||||
@ -132,6 +136,7 @@ var
|
||||
begin
|
||||
FRemoteRepository := TStringList.Create;
|
||||
FRemoteRepositoryTmp := TStringList.Create;
|
||||
FHintFormOptionColors := TStringList.Create;
|
||||
LocalRepo := AppendPathDelim(AppendPathDelim(LazarusIDE.GetPrimaryConfigPath) + cLocalRepository);
|
||||
FLocalPackagesDefault := LocalRepo + AppendPathDelim(cLocalRepositoryPackages);
|
||||
FLocalArchiveDefault := LocalRepo + AppendPathDelim(cLocalRepositoryArchive);
|
||||
@ -141,6 +146,7 @@ begin
|
||||
if FileExists(AFileName) then
|
||||
begin
|
||||
Load;
|
||||
CheckColors;
|
||||
if FLocalRepositoryPackages = '' then
|
||||
FLocalRepositoryPackages := FLocalPackagesDefault;
|
||||
if FLocalRepositoryArchive = '' then
|
||||
@ -163,6 +169,7 @@ begin
|
||||
Save;
|
||||
FRemoteRepository.Free;
|
||||
FRemoteRepositoryTmp.Free;
|
||||
FHintFormOptionColors.Free;
|
||||
FXML.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
@ -190,6 +197,7 @@ begin
|
||||
FShowRegularIcons := FXML.GetValue('General/ShowRegularIcons/Value', True);
|
||||
FUseDefaultTheme := FXML.GetValue('General/UseDefaultTheme/Value', True);
|
||||
FHintFormOption := FXML.GetValue('General/HintFormOption/Value', 0);
|
||||
FHintFormOptionColors.Text := FXML.GetValue('General/HintFormOptionColors/Value', '');
|
||||
|
||||
FProxySettings.FEnabled := FXML.GetValue('Proxy/Enabled/Value', False);
|
||||
FProxySettings.FServer := FXML.GetValue('Proxy/Server/Value', '');
|
||||
@ -224,6 +232,7 @@ begin
|
||||
FXML.SetDeleteValue('General/ShowRegularIcons/Value', FShowRegularIcons, True);
|
||||
FXML.SetDeleteValue('General/UseDefaultTheme/Value', FUseDefaultTheme, True);
|
||||
FXML.SetDeleteValue('General/HintFormOption/Value', FHintFormOption, 0);
|
||||
FXML.SetDeleteValue('General/HintFormOptionColors/Value', FHintFormOptionColors.Text, '');
|
||||
|
||||
FXML.SetDeleteValue('Proxy/Enabled/Value', FProxySettings.FEnabled, false);
|
||||
FXML.SetDeleteValue('Proxy/Server/Value', FProxySettings.FServer, '');
|
||||
@ -248,6 +257,8 @@ begin
|
||||
FRemoteRepository.Clear;
|
||||
FRemoteRepositoryTmp.Clear;
|
||||
FRemoteRepository.Add(cRemoteRepository);
|
||||
FHintFormOptionColors.Clear;
|
||||
CheckColors;
|
||||
FActiveRepositoryIndex := 0;
|
||||
FForceDownloadAndExtract := True;
|
||||
FDeleteZipAfterInstall := True;
|
||||
@ -285,5 +296,17 @@ begin
|
||||
CreateDir(FLocalRepositoryUpdate);
|
||||
end;
|
||||
|
||||
procedure TOptions.CheckColors;
|
||||
begin
|
||||
if FHintFormOptionColors.Count <> HintColCnt then
|
||||
begin
|
||||
FHintFormOptionColors.Clear;
|
||||
FHintFormOptionColors.Add(ColorToString($00D9FFFF));
|
||||
FHintFormOptionColors.Add(ColorToString($00E6FFE6));
|
||||
FHintFormOptionColors.Add(ColorToString($00FEEBD3));
|
||||
end
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
@ -10,6 +10,8 @@ object OptionsFrm: TOptionsFrm
|
||||
Constraints.MinHeight = 300
|
||||
Constraints.MinWidth = 475
|
||||
KeyPreview = True
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnKeyPress = FormKeyPress
|
||||
PopupMode = pmExplicit
|
||||
Position = poOwnerFormCenter
|
||||
@ -139,7 +141,7 @@ object OptionsFrm: TOptionsFrm
|
||||
'Never'
|
||||
)
|
||||
Style = csDropDownList
|
||||
TabOrder = 3
|
||||
TabOrder = 4
|
||||
Text = 'Every few minutes'
|
||||
end
|
||||
object lbLastUpdate: TLabel
|
||||
@ -228,7 +230,7 @@ object OptionsFrm: TOptionsFrm
|
||||
Width = 76
|
||||
BorderSpacing.Left = 6
|
||||
MaxValue = 365
|
||||
TabOrder = 4
|
||||
TabOrder = 5
|
||||
Value = 31
|
||||
end
|
||||
object cbRegularIcons: TCheckBox
|
||||
@ -241,7 +243,7 @@ object OptionsFrm: TOptionsFrm
|
||||
Width = 232
|
||||
BorderSpacing.Top = 10
|
||||
Caption = 'Show regular icon for installed packages'
|
||||
TabOrder = 5
|
||||
TabOrder = 6
|
||||
end
|
||||
object cbUseDefaultTheme: TCheckBox
|
||||
AnchorSideLeft.Control = lbDaysToShowNewPackages
|
||||
@ -253,7 +255,7 @@ object OptionsFrm: TOptionsFrm
|
||||
Width = 116
|
||||
BorderSpacing.Top = 7
|
||||
Caption = 'Use default theme'
|
||||
TabOrder = 6
|
||||
TabOrder = 8
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideTop.Control = lbConTimeOut
|
||||
@ -300,7 +302,7 @@ object OptionsFrm: TOptionsFrm
|
||||
Width = 55
|
||||
BorderSpacing.Left = 6
|
||||
MinValue = 1
|
||||
TabOrder = 7
|
||||
TabOrder = 3
|
||||
Value = 10
|
||||
end
|
||||
object Bevel3: TBevel
|
||||
@ -342,7 +344,25 @@ object OptionsFrm: TOptionsFrm
|
||||
'It''s triggered by SHIFT, moves with the mouse'
|
||||
'Off'
|
||||
)
|
||||
TabOrder = 8
|
||||
TabOrder = 7
|
||||
object bColors: TButton
|
||||
AnchorSideTop.Control = rbHintFormOptions
|
||||
AnchorSideRight.Control = rbHintFormOptions
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = rbHintFormOptions
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 480
|
||||
Height = 26
|
||||
Top = 21
|
||||
Width = 105
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
BorderSpacing.Top = 21
|
||||
BorderSpacing.Right = 10
|
||||
BorderSpacing.Bottom = 21
|
||||
Caption = 'Colors'
|
||||
OnClick = bColorsClick
|
||||
TabOrder = 3
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ uses
|
||||
// LazUtils
|
||||
LazFileUtils,
|
||||
// OpkMan
|
||||
opkman_options, opkman_common, opkman_const, opkman_repositories;
|
||||
opkman_options, opkman_common, opkman_const, opkman_repositories, opkman_colorsfrm;
|
||||
|
||||
type
|
||||
|
||||
@ -55,6 +55,7 @@ type
|
||||
bFoldersEdit: TButton;
|
||||
bOpen: TButton;
|
||||
bpOptions: TButtonPanel;
|
||||
bColors: TButton;
|
||||
cbProxy: TCheckBox;
|
||||
cbForceDownloadExtract: TCheckBox;
|
||||
cbDeleteZipAfterInstall: TCheckBox;
|
||||
@ -107,6 +108,7 @@ type
|
||||
tsProfiles: TTabSheet;
|
||||
tsGeneral: TTabSheet;
|
||||
tsProxy: TTabSheet;
|
||||
procedure bColorsClick(Sender: TObject);
|
||||
procedure bFilesAddClick(Sender: TObject);
|
||||
procedure bFilesDeleteClick(Sender: TObject);
|
||||
procedure bFilesEditClick(Sender: TObject);
|
||||
@ -114,12 +116,15 @@ type
|
||||
procedure cbProxyChange(Sender: TObject);
|
||||
procedure cbSelectProfileChange(Sender: TObject);
|
||||
procedure edRemoteRepositoryKeyPress(Sender: TObject; var Key: char);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormKeyPress(Sender: TObject; var Key: char);
|
||||
procedure HelpButtonClick(Sender: TObject);
|
||||
procedure OKButtonClick(Sender: TObject);
|
||||
procedure pnProfilesMainResize(Sender: TObject);
|
||||
procedure pnProfilesTopResize(Sender: TObject);
|
||||
private
|
||||
FHintFormOptionColors: TStringList;
|
||||
function GetSelectedText(AListBox: TListBox; var AIndex: Integer): String;
|
||||
procedure SetupColors;
|
||||
public
|
||||
@ -216,6 +221,26 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOptionsFrm.bColorsClick(Sender: TObject);
|
||||
begin
|
||||
ColorsFrm := TColorsFrm.Create(Self);
|
||||
try
|
||||
if FHintFormOptionColors.Count > 0 then
|
||||
ColorsFrm.LoadColors(FHintFormOptionColors)
|
||||
else
|
||||
ColorsFrm.LoadColors(Options.HintFormOptionColors);
|
||||
if ColorsFrm.ShowModal = mrOK then
|
||||
begin
|
||||
FHintFormOptionColors.Clear;
|
||||
FHintFormOptionColors.Add(ColorToString(ColorsFrm.shName.Brush.Color));
|
||||
FHintFormOptionColors.Add(ColorToString(ColorsFrm.shDescription.Brush.Color));
|
||||
FHintFormOptionColors.Add(ColorToString(ColorsFrm.shLicense.Brush.Color));
|
||||
end;
|
||||
finally
|
||||
ColorsFrm.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOptionsFrm.bFilesEditClick(Sender: TObject);
|
||||
var
|
||||
Value: String;
|
||||
@ -303,6 +328,16 @@ begin
|
||||
OKButtonClick(bpOptions.OKButton);
|
||||
end;
|
||||
|
||||
procedure TOptionsFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FHintFormOptionColors := TStringList.Create;
|
||||
end;
|
||||
|
||||
procedure TOptionsFrm.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
FHintFormOptionColors.Free;
|
||||
end;
|
||||
|
||||
procedure TOptionsFrm.FormKeyPress(Sender: TObject; var Key: char);
|
||||
begin
|
||||
if Key = #27 then
|
||||
@ -408,6 +443,11 @@ begin
|
||||
else
|
||||
Options.ExcludedFolders := Options.ExcludedFolders + ',' + lbExcludeFolders.Items[I];
|
||||
end;
|
||||
if FHintFormOptionColors.Count > 0 then
|
||||
begin
|
||||
Options.HintFormOptionColors.Clear;
|
||||
Options.HintFormOptionColors.Text := FHintFormOptionColors.Text;
|
||||
end;
|
||||
|
||||
Options.Save;
|
||||
ModalResult := mrOk;
|
||||
@ -514,6 +554,7 @@ begin
|
||||
lbExcludeFolders.Items.StrictDelimiter := True;
|
||||
lbExcludeFolders.Items.DelimitedText := Options.ExcludedFolders;
|
||||
pnProfilesMain.Visible := Options.UserProfile = 1;
|
||||
bColors.Caption := rsOptions_bColors_Caption;
|
||||
bpOptions.HelpButton.Caption := rsOptions_bpOptions_bHelp;
|
||||
SetupColors;
|
||||
end;
|
||||
|
@ -28,7 +28,7 @@ unit opkman_showhintbase;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, ExtCtrls, StdCtrls;
|
||||
Classes, SysUtils, Forms, Controls, ExtCtrls, StdCtrls, Graphics;
|
||||
|
||||
type
|
||||
|
||||
@ -50,7 +50,7 @@ type
|
||||
end;
|
||||
|
||||
implementation
|
||||
uses opkman_const;
|
||||
uses opkman_const, opkman_options;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
@ -61,13 +61,16 @@ begin
|
||||
lbDescription.Caption := rsMainFrm_VSTText_Description;
|
||||
lbLicense.Caption := rsMainFrm_VSTText_License;
|
||||
Self.DoubleBuffered := True;
|
||||
pnPackageName.Color := $00D9FFFF;
|
||||
pnDescription.Color := $00E6FFE6;
|
||||
mDescription.Color := $00E6FFE6;
|
||||
mDescription.DoubleBuffered := True;
|
||||
pnLicense.Color := $00FEEBD3;
|
||||
mLicense.Color := $00FEEBD3;
|
||||
mLicense.DoubleBuffered := True;
|
||||
if Options.HintFormOptionColors.Count = 3 then
|
||||
begin
|
||||
pnPackageName.Color := StringToColor(Options.HintFormOptionColors[0]);
|
||||
pnDescription.Color := StringToColor(Options.HintFormOptionColors[1]);
|
||||
mDescription.Color := StringToColor(Options.HintFormOptionColors[1]);
|
||||
pnLicense.Color := StringToColor(Options.HintFormOptionColors[2]);
|
||||
mLicense.Color := StringToColor(Options.HintFormOptionColors[2]);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user