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

View File

@ -60,12 +60,13 @@ type
CheckDiskChangesWithLoadingCheckBox: TCheckBox;
DiffSynEdit: TSynEdit;
FilesListBox: TCheckListBox;
WarnImage: TPaintBox;
WarnLabel: TLabel;
WarnSpeedButton: TSpeedButton;
Splitter: TSplitter;
SynDiffSyn1: TSynDiffSyn;
procedure FilesListBoxClick(Sender: TObject);
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure WarnImagePaint(Sender: TObject);
private
FIgnoreList: TFPList;
FPackageList: TStringList;
@ -232,6 +233,18 @@ begin
EnvironmentOptions.CheckDiskChangesWithLoading:=CheckDiskChangesWithLoadingCheckBox.Checked;
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);
var
i: Integer;
@ -269,7 +282,7 @@ begin
end;
end;
FilesListBox.Items.EndUpdate;
WarnSpeedButton.Visible:=FHasLocalModifications;
WarnImage.Visible:=FHasLocalModifications;
WarnLabel.Visible:=FHasLocalModifications;
end;
@ -389,10 +402,9 @@ begin
// Cancel button now means Ignore All Disk Changes
BtnPanel.CancelButton.Caption:=lisDiskDiffIgnoreAllDiskChanges;
IDEImages.AssignImage(WarnSpeedButton, 'state_warning');
WarnLabel.Caption:=lisDiskDiffSomeFilesHaveLocalChanges;
WarnLabel.Visible:=False;
WarnSpeedButton.Visible:=False;
WarnImage.Visible:=False;
CheckDiskChangesWithLoadingCheckBox.Caption:=lisCheckForDiskFileChangesViaContent;
CheckDiskChangesWithLoadingCheckBox.Checked:=EnvironmentOptions.CheckDiskChangesWithLoading;