IDE: Draw "state_warning" image in DiskDiffsDialog on a paintbox, instead of using a speedbutton.

git-svn-id: trunk@64058 -
This commit is contained in:
wp 2020-10-22 23:25:42 +00:00
parent cc16851bba
commit d2539a84b0
2 changed files with 39 additions and 28 deletions

View File

@ -23,14 +23,13 @@ object DiskDiffsDlg: TDiskDiffsDlg
ItemHeight = 0 ItemHeight = 0
OnClick = FilesListBoxClick OnClick = FilesListBoxClick
TabOrder = 0 TabOrder = 0
TopIndex = -1
end end
inline DiffSynEdit: TSynEdit inline DiffSynEdit: TSynEdit
AnchorSideTop.Control = Splitter AnchorSideTop.Control = Splitter
AnchorSideBottom.Control = WarnSpeedButton AnchorSideBottom.Control = WarnImage
Left = 6 Left = 6
Height = 145 Height = 170
Top = 97 Top = 98
Width = 588 Width = 588
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -43,7 +42,7 @@ object DiskDiffsDlg: TDiskDiffsDlg
TabOrder = 2 TabOrder = 2
BookMarkOptions.Xoffset = -18 BookMarkOptions.Xoffset = -18
Gutter.Visible = False Gutter.Visible = False
Gutter.Width = 55 Gutter.Width = 59
Gutter.MouseActions = < Gutter.MouseActions = <
item item
ClickCount = ccAny ClickCount = ccAny
@ -490,7 +489,7 @@ object DiskDiffsDlg: TDiskDiffsDlg
MouseActions = <> MouseActions = <>
end end
object SynGutterLineNumber1: TSynGutterLineNumber object SynGutterLineNumber1: TSynGutterLineNumber
Width = 15 Width = 19
MouseActions = <> MouseActions = <>
MarkupInfo.Background = clBtnFace MarkupInfo.Background = clBtnFace
MarkupInfo.Foreground = clNone MarkupInfo.Foreground = clNone
@ -577,9 +576,9 @@ object DiskDiffsDlg: TDiskDiffsDlg
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = BtnPanel AnchorSideBottom.Control = BtnPanel
Left = 6 Left = 6
Height = 21 Height = 19
Top = 286 Top = 296
Width = 278 Width = 242
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'CheckDiskChangesWithLoadingCheckBox' Caption = 'CheckDiskChangesWithLoadingCheckBox'
@ -587,8 +586,8 @@ object DiskDiffsDlg: TDiskDiffsDlg
end end
object BtnPanel: TButtonPanel object BtnPanel: TButtonPanel
Left = 6 Left = 6
Height = 42 Height = 34
Top = 313 Top = 321
Width = 588 Width = 588
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
@ -602,30 +601,30 @@ object DiskDiffsDlg: TDiskDiffsDlg
ShowButtons = [pbOK, pbCancel, pbHelp] ShowButtons = [pbOK, pbCancel, pbHelp]
end end
object WarnLabel: TLabel object WarnLabel: TLabel
AnchorSideLeft.Control = WarnSpeedButton AnchorSideLeft.Control = WarnImage
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = WarnSpeedButton AnchorSideTop.Control = WarnImage
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 45 Left = 28
Height = 19 Height = 15
Top = 255 Top = 275
Width = 66 Width = 56
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'WarnLabel' Caption = 'WarnLabel'
Font.Color = clMaroon Font.Color = clMaroon
ParentColor = False ParentColor = False
ParentFont = False ParentFont = False
end end
object WarnSpeedButton: TSpeedButton object WarnImage: TPaintBox
AnchorSideLeft.Control = CheckDiskChangesWithLoadingCheckBox AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = CheckDiskChangesWithLoadingCheckBox AnchorSideBottom.Control = CheckDiskChangesWithLoadingCheckBox
Left = 6 Left = 6
Height = 32 Height = 16
Top = 248 Top = 274
Width = 33 Width = 16
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Flat = True BorderSpacing.Left = 6
Transparent = False OnPaint = WarnImagePaint
end end
object SynDiffSyn1: TSynDiffSyn object SynDiffSyn1: TSynDiffSyn
Enabled = False Enabled = False

View File

@ -60,12 +60,13 @@ type
CheckDiskChangesWithLoadingCheckBox: TCheckBox; CheckDiskChangesWithLoadingCheckBox: TCheckBox;
DiffSynEdit: TSynEdit; DiffSynEdit: TSynEdit;
FilesListBox: TCheckListBox; FilesListBox: TCheckListBox;
WarnImage: TPaintBox;
WarnLabel: TLabel; WarnLabel: TLabel;
WarnSpeedButton: TSpeedButton;
Splitter: TSplitter; Splitter: TSplitter;
SynDiffSyn1: TSynDiffSyn; SynDiffSyn1: TSynDiffSyn;
procedure FilesListBoxClick(Sender: TObject); procedure FilesListBoxClick(Sender: TObject);
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction); procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure WarnImagePaint(Sender: TObject);
private private
FIgnoreList: TFPList; FIgnoreList: TFPList;
FPackageList: TStringList; FPackageList: TStringList;
@ -232,6 +233,18 @@ begin
EnvironmentOptions.CheckDiskChangesWithLoading:=CheckDiskChangesWithLoadingCheckBox.Checked; EnvironmentOptions.CheckDiskChangesWithLoading:=CheckDiskChangesWithLoadingCheckBox.Checked;
end; end;
procedure TDiskDiffsDlg.WarnImagePaint(Sender: TObject);
var
ppi: Integer;
imgIndex: Integer;
paintbx: TPaintBox;
begin
paintbx := Sender as TPaintbox;
ppi := Font.PixelsPerInch;
imgIndex := IDEImages.GetImageIndex('state_warning');
IDEImages.Images_16.DrawForPPI(paintbx.Canvas, 0, 0, imgIndex, 16, ppi, GetCanvasScaleFactor);
end;
procedure TDiskDiffsDlg.AddFile2Box(AInfo: TObject; AFileName: string; AModified: Boolean); procedure TDiskDiffsDlg.AddFile2Box(AInfo: TObject; AFileName: string; AModified: Boolean);
var var
i: Integer; i: Integer;
@ -269,7 +282,7 @@ begin
end; end;
end; end;
FilesListBox.Items.EndUpdate; FilesListBox.Items.EndUpdate;
WarnSpeedButton.Visible:=FHasLocalModifications; WarnImage.Visible:=FHasLocalModifications;
WarnLabel.Visible:=FHasLocalModifications; WarnLabel.Visible:=FHasLocalModifications;
end; end;
@ -389,10 +402,9 @@ begin
// Cancel button now means Ignore All Disk Changes // Cancel button now means Ignore All Disk Changes
BtnPanel.CancelButton.Caption:=lisDiskDiffIgnoreAllDiskChanges; BtnPanel.CancelButton.Caption:=lisDiskDiffIgnoreAllDiskChanges;
IDEImages.AssignImage(WarnSpeedButton, 'state_warning');
WarnLabel.Caption:=lisDiskDiffSomeFilesHaveLocalChanges; WarnLabel.Caption:=lisDiskDiffSomeFilesHaveLocalChanges;
WarnLabel.Visible:=False; WarnLabel.Visible:=False;
WarnSpeedButton.Visible:=False; WarnImage.Visible:=False;
CheckDiskChangesWithLoadingCheckBox.Caption:=lisCheckForDiskFileChangesViaContent; CheckDiskChangesWithLoadingCheckBox.Caption:=lisCheckForDiskFileChangesViaContent;
CheckDiskChangesWithLoadingCheckBox.Checked:=EnvironmentOptions.CheckDiskChangesWithLoading; CheckDiskChangesWithLoadingCheckBox.Checked:=EnvironmentOptions.CheckDiskChangesWithLoading;