From e9926ad0a438077e9d581466e2ce3e6bce639acf Mon Sep 17 00:00:00 2001 From: Olly Date: Sat, 23 Sep 2023 21:11:32 +0100 Subject: [PATCH] Tweaks --- Source/Simba.lpi | 6 +- Source/editor/simba.editor_attributes.pas | 3 + Source/forms/simba.main.lfm | 110 +++++++++--------- Source/forms/simba.main.pas | 11 ++ .../simba.settingsform_editor_colors.lfm | 64 +++++----- .../simba.settingsform_editor_colors.pas | 12 +- .../forms/simba.settingsform_editor_font.lfm | 67 +++++------ Source/simba.dockinghelpers.pas | 38 +++++- 8 files changed, 183 insertions(+), 128 deletions(-) diff --git a/Source/Simba.lpi b/Source/Simba.lpi index cf61ae250..468c2db48 100644 --- a/Source/Simba.lpi +++ b/Source/Simba.lpi @@ -340,7 +340,7 @@ - + @@ -1010,6 +1010,10 @@ + + + + diff --git a/Source/editor/simba.editor_attributes.pas b/Source/editor/simba.editor_attributes.pas index f04b39e17..10caeb31f 100644 --- a/Source/editor/simba.editor_attributes.pas +++ b/Source/editor/simba.editor_attributes.pas @@ -327,6 +327,9 @@ constructor TSimbaEditor_Attributes.Create(Editor: TSynEdit); Editor.LineHighlightColor.Background := $FFFFFF; Editor.LineHighlightColor.BackAlpha := 15; + Editor.MouseLinkColor.Foreground := clNone; + Editor.MouseLinkColor.Style := [fsUnderline]; + for I := 0 to Editor.Highlighter.AttrCount - 1 do Add('Highlighter.' + Editor.Highlighter.Attribute[I].StoredName, Editor.Highlighter.Attribute[I]); diff --git a/Source/forms/simba.main.lfm b/Source/forms/simba.main.lfm index ad577b486..15ebdc839 100644 --- a/Source/forms/simba.main.lfm +++ b/Source/forms/simba.main.lfm @@ -1,22 +1,22 @@ object SimbaForm: TSimbaForm Left = 2867 - Height = 539 + Height = 431 Top = 614 - Width = 798 + Width = 638 Caption = 'Simba' - ClientHeight = 539 - ClientWidth = 798 - DesignTimePPI = 120 + ClientHeight = 431 + ClientWidth = 638 KeyPreview = True OnClose = FormClose OnDestroy = FormDestroy + OnWindowStateChange = FormWindowStateChange Position = poScreenCenter LCLVersion = '3.0.0.1' object DockPanel: TAnchorDockPanel Left = 0 - Height = 511 - Top = 28 - Width = 798 + Height = 409 + Top = 22 + Width = 638 Align = alClient BevelOuter = bvNone ParentFont = False @@ -24,11 +24,11 @@ object SimbaForm: TSimbaForm end object ToolBar: TToolBar Left = 0 - Height = 28 + Height = 22 Top = 0 - Width = 798 + Width = 638 AutoSize = True - ButtonHeight = 28 + ButtonHeight = 22 ButtonWidth = 0 EdgeBorders = [] EdgeInner = esNone @@ -40,7 +40,7 @@ object SimbaForm: TSimbaForm TabOrder = 1 OnPaintButton = ToolBarPaintButton object ToolbarButtonRun: TToolButton - Left = 123 + Left = 118 Hint = 'Run Script (Alt + R)' Top = 0 Caption = '&Run' @@ -48,7 +48,7 @@ object SimbaForm: TSimbaForm OnClick = MenuItemScriptStateClick end object ToolbarButtonPause: TToolButton - Left = 143 + Left = 138 Hint = 'Pause Script' Top = 0 Caption = '&Pause' @@ -57,7 +57,7 @@ object SimbaForm: TSimbaForm OnClick = MenuItemScriptStateClick end object ToolbarButtonStop: TToolButton - Left = 163 + Left = 158 Hint = 'Stop Script (Alt + S)' Top = 0 Caption = '&Stop' @@ -66,7 +66,7 @@ object SimbaForm: TSimbaForm OnClick = MenuItemScriptStateClick end object ToolbarButtonClearOutput: TToolButton - Left = 253 + Left = 246 Hint = 'Clear Output Box' Top = 0 Caption = 'Clear' @@ -74,7 +74,7 @@ object SimbaForm: TSimbaForm OnClick = MenuClearOutputClick end object ToolbarButtonColorPicker: TToolButton - Left = 188 + Left = 182 Hint = 'Color Picker' Top = 0 Caption = 'ToolbarButtonColorPicker' @@ -82,7 +82,7 @@ object SimbaForm: TSimbaForm OnClick = ToolbarButtonColorPickerClick end object ToolbarButtonTargetSelector: TToolButton - Left = 208 + Left = 202 Hint = 'Target Selector' Top = 0 Caption = 'ToolbarButtonTargetSelector' @@ -102,7 +102,7 @@ object SimbaForm: TSimbaForm Style = tbsButtonDrop end object ToolbarButtonSave: TToolButton - Left = 53 + Left = 50 Hint = 'Save Script (Ctrl + S)' Top = 0 Caption = '&Save' @@ -110,7 +110,7 @@ object SimbaForm: TSimbaForm OnClick = MenuSaveClick end object ToolbarButtonSaveAll: TToolButton - Left = 73 + Left = 70 Hint = 'Save All' Top = 0 Caption = 'Save All' @@ -118,14 +118,14 @@ object SimbaForm: TSimbaForm OnClick = ToolbarButtonSaveAllClick end object ToolbarButtonCompile: TToolButton - Left = 98 + Left = 94 Hint = 'Compile Script (Alt + C)' Top = 0 ImageIndex = 0 OnClick = MenuItemScriptStateClick end object ToolbarButtonPackages: TToolButton - Left = 278 + Left = 270 Hint = 'Open Packages' Top = 0 Caption = 'ToolbarButtonPackages' @@ -133,7 +133,7 @@ object SimbaForm: TSimbaForm OnClick = ToolbarButtonPackagesClick end object ToolButtonAreaSelector: TToolButton - Left = 228 + Left = 222 Hint = 'Area Selector' Top = 0 ImageIndex = 12 @@ -148,36 +148,36 @@ object SimbaForm: TSimbaForm OnClick = MenuNewClick end object ToolButton1: TToolButton - Left = 93 - Height = 28 + Left = 90 + Height = 22 Top = 0 Caption = 'ToolButton1' Style = tbsDivider end object ToolButton2: TToolButton - Left = 118 - Height = 28 + Left = 114 + Height = 22 Top = 0 Caption = 'ToolButton2' Style = tbsDivider end object ToolButton3: TToolButton - Left = 183 - Height = 28 + Left = 178 + Height = 22 Top = 0 Caption = 'ToolButton3' Style = tbsDivider end object ToolButton4: TToolButton - Left = 248 - Height = 28 + Left = 242 + Height = 22 Top = 0 Caption = 'ToolButton4' Style = tbsDivider end object ToolButton5: TToolButton - Left = 273 - Height = 28 + Left = 266 + Height = 22 Top = 0 Caption = 'ToolButton5' Style = tbsDivider @@ -187,7 +187,7 @@ object SimbaForm: TSimbaForm Left = 0 Height = 0 Top = 0 - Width = 798 + Width = 638 Align = alTop AutoSize = True BevelOuter = bvNone @@ -236,13 +236,13 @@ object SimbaForm: TSimbaForm } Visible = True OnClick = TrayIconClick - Left = 190 - Top = 50 + Left = 152 + Top = 40 end object TrayPopup: TPopupMenu Images = Images - Left = 190 - Top = 130 + Left = 152 + Top = 104 object TrayPopupExit: TMenuItem Caption = 'Close Simba' ImageIndex = 4 @@ -254,15 +254,15 @@ object SimbaForm: TSimbaForm Interval = 300000 OnTimer = DoPackageMenuTimer OnStartTimer = DoPackageMenuTimer - Left = 60 - Top = 130 + Left = 48 + Top = 104 end object MainMenuFile: TPopupMenu Images = Images OnMeasureItem = MainMenuMeasureItem OnPopup = MenuFileClick - Left = 380 - Top = 130 + Left = 304 + Top = 104 object MenuItemNew: TMenuItem Caption = '&New' ImageIndex = 5 @@ -343,8 +343,8 @@ object SimbaForm: TSimbaForm Images = Images OnMeasureItem = MainMenuMeasureItem OnPopup = MenuEditClick - Left = 640 - Top = 130 + Left = 512 + Top = 104 object MenuItemUndo: TMenuItem Caption = 'Undo' ImageIndex = 32 @@ -426,8 +426,8 @@ object SimbaForm: TSimbaForm object MainMenuScript: TPopupMenu Images = Images OnMeasureItem = MainMenuMeasureItem - Left = 510 - Top = 130 + Left = 408 + Top = 104 object MenuItemCompile: TMenuItem Caption = 'Compile' Hint = 'Compile Script' @@ -456,8 +456,8 @@ object SimbaForm: TSimbaForm object MainMenuTools: TPopupMenu Images = Images OnMeasureItem = MainMenuMeasureItem - Left = 640 - Top = 50 + Left = 512 + Top = 40 object MenuItemSettings: TMenuItem Caption = 'Settings' ImageIndex = 34 @@ -508,8 +508,8 @@ object SimbaForm: TSimbaForm object MainMenuView: TPopupMenu Images = Images OnMeasureItem = MainMenuMeasureItem - Left = 380 - Top = 50 + Left = 304 + Top = 40 object MenuItemTrayIcon: TMenuItem AutoCheck = True Caption = 'Tray Icon' @@ -568,8 +568,8 @@ object SimbaForm: TSimbaForm object MainMenuHelp: TPopupMenu Images = Images OnMeasureItem = MainMenuMeasureItem - Left = 510 - Top = 50 + Left = 408 + Top = 40 object MenuItemAbout: TMenuItem Caption = 'About' OnClick = MenuItemAboutClick @@ -592,13 +592,13 @@ object SimbaForm: TSimbaForm object RecentFilesPopup: TPopupMenu OnMeasureItem = MainMenuMeasureItem OnPopup = RecentFilesPopupPopup - Left = 190 - Top = 220 + Left = 152 + Top = 176 end object Images: TImageList OnGetWidthForPPI = ImagesGetWidthForPPI - Left = 60 - Top = 50 + Left = 48 + Top = 40 Bitmap = { 4C7A3700000010000000100000004D3200000000000078DAED9D075C1457D7C6 07B197A858137B37A618A3B144135B6289264691C468628FE5D5A88926468D06 diff --git a/Source/forms/simba.main.pas b/Source/forms/simba.main.pas index 9f1737a27..5fee4ec33 100644 --- a/Source/forms/simba.main.pas +++ b/Source/forms/simba.main.pas @@ -173,6 +173,7 @@ TSimbaForm = class(TForm) procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormDestroy(Sender: TObject); procedure FormShortCut(var Msg: TLMKey; var Handled: Boolean); + procedure FormWindowStateChange(Sender: TObject); procedure ImagesGetWidthForPPI(Sender: TCustomImageList; AImageWidth, APPI: Integer; var AResultWidth: Integer); procedure MainMenuMeasureItem(Sender: TObject; ACanvas: TCanvas; var AWidth, AHeight: Integer); procedure MenuClearOutputClick(Sender: TObject); @@ -715,6 +716,14 @@ procedure TSimbaForm.FormShortCut(var Msg: TLMKey; var Handled: Boolean); (KeyDataToShiftState(Msg.KeyData) = [ssAlt]); // Suppress windows freaking out end; +procedure TSimbaForm.FormWindowStateChange(Sender: TObject); +begin + case WindowState of + wsMinimized: DockMaster.Minimized(); + wsNormal: DockMaster.Restored(); + end; +end; + procedure TSimbaForm.ImagesGetWidthForPPI(Sender: TCustomImageList; AImageWidth, APPI: Integer; var AResultWidth: Integer); begin AResultWidth := ImageWidthForDPI(APPI); @@ -746,6 +755,8 @@ procedure TSimbaForm.MenuItemScriptStateClick(Sender: TObject); if (Sender = MenuItemPause) or (Sender = ToolbarButtonPause) then Exit(Pause); if (Sender = MenuItemStop) or (Sender = ToolbarButtonStop) then Exit(Stop); + Result := Unknown; + DebugLn('[TSimbaForm.MenuItemScriptStateClick]: Unknown component "' + Sender.ClassName + '"'); end; diff --git a/Source/forms/simba.settingsform_editor_colors.lfm b/Source/forms/simba.settingsform_editor_colors.lfm index f96e6a1cd..542984476 100644 --- a/Source/forms/simba.settingsform_editor_colors.lfm +++ b/Source/forms/simba.settingsform_editor_colors.lfm @@ -31,13 +31,13 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Control = Panel1 AnchorSideBottom.Side = asrBottom Left = 0 - Height = 627 - Top = 267 + Height = 672 + Top = 222 Width = 1362 Anchors = [akTop, akLeft, akRight, akBottom] AutoSize = True Caption = 'Customize' - ClientHeight = 602 + ClientHeight = 647 ClientWidth = 1358 TabOrder = 0 object TreeView: TTreeView @@ -45,9 +45,9 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideTop.Control = GroupBox3 AnchorSideBottom.Control = ButtonResetAttribute Left = 5 - Height = 557 + Height = 602 Top = 5 - Width = 205 + Width = 250 Align = alCustom Anchors = [akTop, akLeft, akRight, akBottom] AutoExpand = True @@ -72,18 +72,19 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = GroupBox3 AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = TreeView + AnchorSideBottom.Control = GroupBox3 AnchorSideBottom.Side = asrBottom - Left = 215 - Height = 407 - Top = 155 - Width = 1133 + Left = 260 + Height = 492 + Top = 150 + Width = 1088 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Left = 5 BorderSpacing.Right = 10 + BorderSpacing.Bottom = 5 BevelOuter = bvNone - ClientHeight = 407 - ClientWidth = 1133 + ClientHeight = 492 + ClientWidth = 1088 TabOrder = 1 OnResize = Panel2Resize object ForegoundColorBox: TColorListBox @@ -94,7 +95,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Control = Panel2 AnchorSideBottom.Side = asrBottom Left = 5 - Height = 385 + Height = 470 Top = 22 Width = 202 ColorRectWidth = 31 @@ -136,9 +137,9 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Control = Panel2 AnchorSideBottom.Side = asrBottom Left = 217 - Height = 385 + Height = 470 Top = 22 - Width = 177 + Width = 178 ColorRectWidth = 31 Style = [cbStandardColors, cbCustomColor, cbPrettyNames] Anchors = [akTop, akLeft, akBottom] @@ -156,8 +157,8 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = Panel2 AnchorSideBottom.Side = asrBottom - Left = 404 - Height = 385 + Left = 405 + Height = 470 Top = 22 Width = 200 ColorRectWidth = 31 @@ -172,7 +173,7 @@ object EditorColorsFrame: TEditorColorsFrame object LabelFrame: TLabel AnchorSideLeft.Control = FrameColorBox AnchorSideTop.Control = Panel2 - Left = 404 + Left = 405 Height = 20 Top = 0 Width = 41 @@ -189,8 +190,8 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Side = asrBottom Left = 5 Height = 30 - Top = 567 - Width = 205 + Top = 612 + Width = 250 Align = alCustom Anchors = [akLeft, akRight, akBottom] AutoSize = True @@ -206,19 +207,18 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = GroupBox3 AnchorSideRight.Side = asrBottom - Left = 220 + Left = 265 Height = 20 - Top = 135 - Width = 1138 + Top = 130 + Width = 1093 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 10 - BorderSpacing.Top = 5 Style = gsHorLines end object Label1: TLabel AnchorSideLeft.Control = Panel2 AnchorSideTop.Control = TreeView - Left = 220 + Left = 265 Height = 20 Top = 5 Width = 71 @@ -230,7 +230,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideLeft.Control = Panel2 AnchorSideTop.Control = Label1 AnchorSideTop.Side = asrBottom - Left = 220 + Left = 265 Height = 100 Top = 30 Width = 160 @@ -252,7 +252,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideLeft.Control = CheckListBox1 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = TreeView - Left = 390 + Left = 435 Height = 20 Top = 5 Width = 39 @@ -265,7 +265,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideTop.Control = CheckListBox1 AnchorSideBottom.Control = CheckListBox1 AnchorSideBottom.Side = asrBottom - Left = 390 + Left = 435 Height = 100 Top = 30 Width = 195 @@ -282,7 +282,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideBottom.Side = asrBottom Left = 0 Height = 28 - Top = 31 + Top = 30 Width = 77 Anchors = [akTop, akLeft, akBottom] Caption = 'Foreground' @@ -310,10 +310,10 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideTop.Side = asrBottom Left = 84 Height = 28 - Top = 31 + Top = 30 Width = 106 BorderSpacing.Left = 5 - BorderSpacing.Top = 3 + BorderSpacing.Top = 2 BorderSpacing.Right = 5 MaxValue = 255 OnChange = ForegroundAlphaEditChange @@ -414,7 +414,7 @@ object EditorColorsFrame: TEditorColorsFrame AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom Left = 355 - Height = 265 + Height = 220 Top = 0 Width = 1002 Anchors = [akTop, akRight] diff --git a/Source/forms/simba.settingsform_editor_colors.pas b/Source/forms/simba.settingsform_editor_colors.pas index e5dfefecb..24edce8d2 100644 --- a/Source/forms/simba.settingsform_editor_colors.pas +++ b/Source/forms/simba.settingsform_editor_colors.pas @@ -78,7 +78,7 @@ implementation {$R *.lfm} uses - SynEditMiscClasses, + SynEditTypes, SynEditMiscClasses, simba.settings, simba.editor_attributes, simba.env, simba.mufasatypes, simba.httpclient; @@ -375,6 +375,8 @@ constructor TEditorColorsFrame.Create(AOwner: TComponent); begin inherited Create(AOwner); + Panel3.Height := Scale96ToScreen(250); + BackgroundColorBox.Items.AddObject('Transparent', TObject(PtrUInt(clNone))); ForegoundColorBox.Items.AddObject('Transparent', TObject(PtrUInt(clNone))); FrameColorBox.Items.AddObject('Transparent', TObject(PtrUInt(clNone))); @@ -389,13 +391,12 @@ constructor TEditorColorsFrame.Create(AOwner: TComponent); begin Parent := Panel3; Align := alClient; + Options := Options - [eoScrollPastEof]; ReadOnly := True; Text := 'program Highlight; ' + LineEnding + - '{ brace } ' + LineEnding + - '(* round *) ' + LineEnding + - '// slash ' + LineEnding + + '{ comment } ' + LineEnding + ' ' + LineEnding + - '{$I SRL/osr.simba} ' + LineEnding + + '{$I directive.simba} ' + LineEnding + ' ' + LineEnding + 'procedure Test(var i: Integer); ' + LineEnding + 'var ' + LineEnding + @@ -411,7 +412,6 @@ constructor TEditorColorsFrame.Create(AOwner: TComponent); ' ' + LineEnding + 'function TPoint.Test: Boolean; overload; ' + LineEnding + 'begin ' + LineEnding + - ' Result := True; ' + LineEnding + 'end; '; UseSimbaColors := True; diff --git a/Source/forms/simba.settingsform_editor_font.lfm b/Source/forms/simba.settingsform_editor_font.lfm index ab2068d84..62640eedd 100644 --- a/Source/forms/simba.settingsform_editor_font.lfm +++ b/Source/forms/simba.settingsform_editor_font.lfm @@ -1,25 +1,24 @@ object EditorFontFrame: TEditorFontFrame Left = 0 - Height = 300 + Height = 240 Top = 0 - Width = 400 - ClientHeight = 300 - ClientWidth = 400 - DesignTimePPI = 120 + Width = 320 + ClientHeight = 240 + ClientWidth = 320 ParentFont = False TabOrder = 0 DesignLeft = 3800 DesignTop = 858 object Panel1: TPanel Left = 0 - Height = 95 + Height = 77 Top = 0 - Width = 400 + Width = 320 Align = alTop AutoSize = True BevelOuter = bvNone - ClientHeight = 95 - ClientWidth = 400 + ClientHeight = 77 + ClientWidth = 320 TabOrder = 0 object Label1: TLabel AnchorSideLeft.Control = Panel1 @@ -27,9 +26,9 @@ object EditorFontFrame: TEditorFontFrame AnchorSideBottom.Control = FontsNameComboBox AnchorSideBottom.Side = asrBottom Left = 0 - Height = 28 + Height = 23 Top = 0 - Width = 73 + Width = 59 Anchors = [akTop, akLeft, akBottom] Caption = 'Font Name' Layout = tlCenter @@ -41,23 +40,25 @@ object EditorFontFrame: TEditorFontFrame AnchorSideTop.Control = Panel1 AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom - Left = 78 - Height = 28 + Left = 63 + Height = 23 Top = 0 - Width = 322 + Width = 257 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 5 - ItemHeight = 20 + BorderSpacing.Left = 4 + ItemHeight = 15 OnChange = FontsNameComboBoxChange TabOrder = 0 end object Label2: TLabel AnchorSideLeft.Control = Panel1 + AnchorSideTop.Control = FontSizeSpinEdit + AnchorSideBottom.Control = FontSizeSpinEdit AnchorSideBottom.Side = asrBottom Left = 0 - Height = 14 - Top = 40 - Width = 60 + Height = 23 + Top = 31 + Width = 47 Anchors = [akTop, akLeft, akBottom] Caption = 'Font Size' Layout = tlCenter @@ -68,10 +69,10 @@ object EditorFontFrame: TEditorFontFrame AnchorSideTop.Control = FontSizeSpinEdit AnchorSideTop.Side = asrBottom Left = 0 - Height = 24 - Top = 71 - Width = 103 - BorderSpacing.Top = 5 + Height = 19 + Top = 58 + Width = 83 + BorderSpacing.Top = 4 Caption = 'Anti-Aliased' OnChange = FontAntiAliasedCheckboxChange TabOrder = 1 @@ -83,24 +84,24 @@ object EditorFontFrame: TEditorFontFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom - Left = 78 - Height = 28 - Top = 38 - Width = 322 + Left = 63 + Height = 23 + Top = 31 + Width = 257 Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 5 - BorderSpacing.Top = 10 + BorderSpacing.Left = 4 + BorderSpacing.Top = 8 OnChange = FontSizeSpinEditChange TabOrder = 2 end end object EditorPanel: TPanel Left = 0 - Height = 195 - Top = 105 - Width = 400 + Height = 155 + Top = 85 + Width = 320 Align = alClient - BorderSpacing.Top = 10 + BorderSpacing.Top = 8 BevelOuter = bvNone TabOrder = 1 end diff --git a/Source/simba.dockinghelpers.pas b/Source/simba.dockinghelpers.pas index f0c00a611..244f194fe 100644 --- a/Source/simba.dockinghelpers.pas +++ b/Source/simba.dockinghelpers.pas @@ -33,6 +33,7 @@ TSimbaAnchorDockHostSite = class(TAnchorDockHostSite) protected FMenuItem: TMenuItem; FNeedDefaultPosition: Boolean; + FNeedRestore: Boolean; procedure DoMenuItemDestroyed(Sender: TObject); procedure DoMenuItemClicked(Sender: TObject); @@ -63,6 +64,9 @@ TAnchorDockMasterHelper = class helper for TAnchorDockMaster public procedure MakeDockable(Form: TCustomForm; MenuItem: TMenuItem); + procedure Minimized; + procedure Restored; + function SaveLayout: String; function LoadLayout(Layout: String): Boolean; end; @@ -162,7 +166,6 @@ procedure TSimbaAnchorDockHostSite.DoMenuItemClicked(Sender: TObject); if Visible then begin - Writeln(FNeedDefaultPosition); if FNeedDefaultPosition then begin with Application.MainForm.Monitor.WorkareaRect.CenterPoint do @@ -242,6 +245,39 @@ procedure TAnchorDockMasterHelper.MakeDockable(Form: TCustomForm; MenuItem: TMen end; end; +procedure TAnchorDockMasterHelper.Minimized; +var + I: Integer; + Site: TSimbaAnchorDockHostSite; +begin + for I := 0 to Screen.CustomFormCount - 1 do + begin + Site := TSimbaAnchorDockHostSite(Screen.CustomForms[I].HostDockSite); + if Screen.CustomForms[I].Showing and (Site is TSimbaAnchorDockHostSite) and Site.Floating and Site.FMenuItem.Checked then + begin + Site.FNeedRestore := True; + Site.CloseSite(); + end; + end; +end; + +procedure TAnchorDockMasterHelper.Restored; +var + I: Integer; + Site: TSimbaAnchorDockHostSite; +begin + for I := 0 to Screen.CustomFormCount - 1 do + begin + Site := TSimbaAnchorDockHostSite(Screen.CustomForms[I].HostDockSite); + if (Site is TSimbaAnchorDockHostSite) and Site.FNeedRestore then + begin + MakeVisible(Screen.CustomForms[I], False); + Site.FNeedRestore := False; + end; + end; +end; + + function TAnchorDockMasterHelper.SaveLayout: String; var Config: TXMLConfigStorage;