From 7743616b8964a56284516debd84dab40bdad9a54 Mon Sep 17 00:00:00 2001 From: Olly Date: Tue, 9 May 2023 03:24:23 +0100 Subject: [PATCH] Finish main form theming (SynEdit & MenuBar) --- Source/Simba.lpi | 18 +- Source/Simba.lpr | 2 +- Source/components/simba.component_menubar.pas | 178 ++++ .../components/simba.component_statusbar.pas | 13 +- Source/components/simba.component_synedit.pas | 118 +++ .../components/simba.component_tabcontrol.pas | 35 +- .../components/simba.component_treeview.pas | 44 +- .../simba.component_treeviewhint.pas | 14 +- Source/editor/simba.editor.pas | 42 +- Source/editor/simba.editor_attributes.pas | 36 +- .../simba.editor_modifiedlinegutter.pas | 3 + Source/editor/simba.editor_popupmenu.pas | 14 +- Source/forms/simba.main.lfm | 767 +++++++++--------- Source/forms/simba.main.pas | 84 +- Source/forms/simba.outputform.pas | 18 +- Source/forms/simba.scripttabsform.lfm | 4 +- Source/forms/simba.scripttabsform.pas | 1 + Source/package/simba.package_autoupdater.pas | 2 +- Source/simba.dockinghelpers.pas | 49 +- Source/simba.inc | 2 - Source/simba.theme.pas | 72 ++ Source/simba.windowsdarktheme.pas | 58 -- Third-Party/atscrollbar.pas | 1 - Third-Party/attabs.pas | 3 - 24 files changed, 1029 insertions(+), 549 deletions(-) create mode 100644 Source/components/simba.component_menubar.pas create mode 100644 Source/components/simba.component_synedit.pas create mode 100644 Source/simba.theme.pas delete mode 100644 Source/simba.windowsdarktheme.pas diff --git a/Source/Simba.lpi b/Source/Simba.lpi index e707c2b0d..1586036ba 100644 --- a/Source/Simba.lpi +++ b/Source/Simba.lpi @@ -308,7 +308,7 @@ - + @@ -1061,6 +1061,22 @@ + + + + + + + + + + + + + + + + diff --git a/Source/Simba.lpr b/Source/Simba.lpr index 21a61dee7..66bef4201 100644 --- a/Source/Simba.lpr +++ b/Source/Simba.lpr @@ -16,7 +16,7 @@ simba.outputform, simba.colorpickerhistoryform, simba.filebrowserform, simba.notesform, simba.settingsform, simba.associate, simba.openexampleform, simba.scriptthread, simba.package_form, simba.mufasatypes, simba.shapeboxform, - simba.windowsdarktheme, simba.compiler_dump, simba.plugin_dump, + simba.compiler_dump, simba.plugin_dump, simba.ide_analytics, simba.ide_codetools_setup, simba.ide_codetools_insight; type diff --git a/Source/components/simba.component_menubar.pas b/Source/components/simba.component_menubar.pas new file mode 100644 index 000000000..1a98faef6 --- /dev/null +++ b/Source/components/simba.component_menubar.pas @@ -0,0 +1,178 @@ +unit simba.component_menubar; + +{$i simba.inc} + +interface + +uses + Classes, SysUtils, Controls, Menus, Graphics; + +type + TSimbaMainMenuBar = class(TCustomControl) + protected + FItems: array of record + Text: String; + Rect: TRect; + Menu: TPopupMenu; + ClosedAt: UInt64; + end; + FHotIndex: Integer; + + function IndexAtXY(X, Y: Integer): Integer; + + procedure CalculateSizes; + procedure Paint; override; + + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + procedure MouseLeave; override; + + procedure DoMenuClose(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + + procedure AddMenu(Title: String; APopupMenu: TPopupMenu); + end; + +implementation + +uses + simba.theme; + +function TSimbaMainMenuBar.IndexAtXY(X, Y: Integer): Integer; +var + I: Integer; +begin + Result := -1; + for I := 0 to High(FItems) do + if (X >= FItems[I].Rect.Left) and (X <= FItems[I].Rect.Right) then + Exit(I); +end; + +procedure TSimbaMainMenuBar.CalculateSizes; +var + I: Integer; +begin + with TBitmap.Create() do + try + // Measure on larger font size + // Font size can be 0 so use GetFontData + Canvas.Font := Self.Font; + Canvas.Font.Size := Round(-GetFontData(Canvas.Font.Reference.Handle).Height * 72 / Canvas.Font.PixelsPerInch) + 3; + + if (Length(FItems) > 0) then + begin + FItems[0].Rect.Left := 5; + FItems[0].Rect.Right := FItems[0].Rect.Left + Canvas.TextWidth(FItems[0].Text); + for I := 1 to High(FItems) do + begin + FItems[I].Rect.Left := FItems[I-1].Rect.Right + 5; + FItems[I].Rect.Right := FItems[I].Rect.Left + Canvas.TextWidth(FItems[I].Text); + end; + end; + + Self.Height := Canvas.TextHeight('TaylorSwift'); + finally + Free(); + end; +end; + +procedure TSimbaMainMenuBar.Paint; +var + I: Integer; + R: TRect; + Style: TTextStyle; +begin + Style := Canvas.TextStyle; + Style.Alignment := taCenter; + Style.Layout := tlCenter; + + Canvas.Brush.Color := SimbaTheme.ColorFrame; + Canvas.FillRect(ClientRect); + + for I := 0 to High(FItems) do + begin + R := FItems[I].Rect; + R.Top := 0; + R.Height := Height; + + if (I = FHotIndex) then + begin + Canvas.Brush.Color := SimbaTheme.ColorActive; + Canvas.FillRect(R.Left, R.Top + 2, R.Right, R.Height - 2); + end; + + Canvas.TextRect(R, R.Left, R.Top, FItems[I].Text, Style); + end; + Canvas.Pen.Color := SimbaTheme.ColorLine; + Canvas.Line(0, Height - 1, Width, Height - 1); +end; + +procedure TSimbaMainMenuBar.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var + I: Integer; +begin + inherited MouseDown(Button, Shift, X, Y); + + I := IndexAtXY(X, Y); + if (I > -1) and (GetTickCount64() - FItems[I].ClosedAt > 100) then + with ClientToScreen(TPoint.Create(FItems[I].Rect.Left, Height)) do + FItems[I].Menu.PopUp(X, Y); +end; + +procedure TSimbaMainMenuBar.MouseMove(Shift: TShiftState; X, Y: Integer); +var + n: Integer; +begin + inherited MouseMove(Shift, X, Y); + + n := IndexAtXY(X,Y); + if (n <> FHotIndex) then + begin + FHotIndex := n; + Invalidate(); + end; +end; + +procedure TSimbaMainMenuBar.MouseLeave; +begin + inherited MouseLeave(); + + if (FHotIndex > -1) then + begin + FHotIndex := -1; + Invalidate(); + end; +end; + +procedure TSimbaMainMenuBar.DoMenuClose(Sender: TObject); +var + I: Integer; +begin + for I := 0 to High(FItems) do + if (FItems[I].Menu = Sender) then + FItems[I].ClosedAt := GetTickCount64(); +end; + +constructor TSimbaMainMenuBar.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + ControlStyle := ControlStyle + [csOpaque]; + Font.Color := SimbaTheme.ColorFont; + + CalculateSizes(); +end; + +procedure TSimbaMainMenuBar.AddMenu(Title: String; APopupMenu: TPopupMenu); +begin + SetLength(FItems, Length(FItems) + 1); + FItems[High(FItems)].Text := Title; + FItems[High(FItems)].Menu := APopupMenu; + APopupMenu.OnClose := @DoMenuClose; + + CalculateSizes(); +end; + +end. + diff --git a/Source/components/simba.component_statusbar.pas b/Source/components/simba.component_statusbar.pas index 341d1262f..48df89ef6 100644 --- a/Source/components/simba.component_statusbar.pas +++ b/Source/components/simba.component_statusbar.pas @@ -54,7 +54,8 @@ TSimbaStatusBar = class(TCustomControl) implementation uses - LCLIntf; + LCLIntf, + simba.theme; procedure TSimbaStatusBar.CheckIndex(Index: Integer); begin @@ -148,8 +149,8 @@ procedure TSimbaStatusBar.Paint; begin if (FPanelCount = 0) then begin - Canvas.Pen.Color := clWhite; - Canvas.Brush.Color := $4A4136; + Canvas.Pen.Color := SimbaTheme.ColorLine; + Canvas.Brush.Color := SimbaTheme.ColorFrame; Canvas.Line(0, 0, Width, 0); Canvas.FillRect(0, 1, Width, Height); end else @@ -175,9 +176,9 @@ procedure TSimbaStatusBar.PaintPanel(Index: Integer); Style := Canvas.TextStyle; Style.Layout := tlCenter; - Canvas.Font.Color := clWhite; - Canvas.Pen.Color := clWhite; - Canvas.Brush.Color := $322F2D; + Canvas.Font.Color := SimbaTheme.ColorFont; + Canvas.Pen.Color := SimbaTheme.ColorLine; + Canvas.Brush.Color := SimbaTheme.ColorFrame; R := PanelRect(Index); diff --git a/Source/components/simba.component_synedit.pas b/Source/components/simba.component_synedit.pas new file mode 100644 index 000000000..33572f1b3 --- /dev/null +++ b/Source/components/simba.component_synedit.pas @@ -0,0 +1,118 @@ +unit simba.component_synedit; + +{$i simba.inc} + +interface + +uses + Classes, SysUtils, Controls, Forms, StdCtrls, + SynEdit, SynEditTypes, SynEditFoldedView, SynEditTextBuffer, SynEditMarkupSelection, + LazSynEditText, + ATScrollBar; + +type + TSimbaSynEdit = class(TSynEdit) + protected + FScrollbarVert: TATScrollbar; + FScrollbarHorz: TATScrollbar; + + procedure DoVertScrollBarChange(Sender: TObject); + procedure DoHorzScrollBarChange(Sender: TObject); + + procedure UpdateBars; + procedure StatusChanged(AChanges: TSynStatusChanges); override; + procedure DoLineChanges(Sender: TSynEditStrings; aIndex, aCount: Integer); + procedure SetParent(NewParent: TWinControl); override; + public + constructor Create(AOwner: TComponent); override; + end; + +implementation + +uses + simba.mufasatypes, simba.theme; + +procedure TSimbaSynEdit.DoVertScrollBarChange(Sender: TObject); +begin + TopLine := FScrollbarVert.Position; +end; + +procedure TSimbaSynEdit.DoHorzScrollBarChange(Sender: TObject); +begin + LeftChar := FScrollbarHorz.Position; +end; + +procedure TSimbaSynEdit.UpdateBars; +begin + if FScrollbarVert=nil then Exit; + if FScrollbarHorz=nil then Exit; + + FScrollbarVert.Min := 1; + FScrollbarVert.Max := TextView.ViewedCount + 1; + if (eoScrollPastEof in Options) then + FScrollbarVert.Max := FScrollbarVert.Max + (LinesInWindow - 1); + FScrollbarVert.PageSize := LinesInWindow; + FScrollbarVert.Position := TopView; + + FScrollbarHorz.Min := 1; + FScrollbarHorz.Max := TextView.LengthOfLongestLine + 1; + if (eoScrollPastEol in Options) and (FScrollbarHorz.Max < MaxLeftChar + 1) then + FScrollbarHorz.Max := MaxLeftChar + 1; + FScrollbarHorz.PageSize := CharsInWindow; + FScrollbarHorz.Position := LeftChar; + + FScrollbarVert.Update(); + FScrollbarHorz.Update(); +end; + +procedure TSimbaSynEdit.StatusChanged(AChanges: TSynStatusChanges); +begin + inherited StatusChanged(AChanges); + + if (AChanges * [scLeftChar, scTopLine, scLinesInWindow, scCharsInWindow] <> []) then + UpdateBars(); +end; + +procedure TSimbaSynEdit.DoLineChanges(Sender: TSynEditStrings; aIndex, aCount: Integer); +begin + UpdateBars(); +end; + +procedure TSimbaSynEdit.SetParent(NewParent: TWinControl); +begin + inherited SetParent(NewParent); + + FScrollbarHorz.Parent := NewParent; + FScrollbarHorz.Align := alBottom; + FScrollbarHorz.IndentCorner := 100; + FScrollbarVert.Parent := NewParent; + FScrollbarVert.Align := alRight; +end; + +constructor TSimbaSynEdit.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FScrollbarVert := TATScrollbar.Create(Self); + FScrollbarVert.Kind := sbVertical; + FScrollbarVert.OnChange := @DoVertScrollBarChange; + + FScrollbarHorz := TATScrollbar.Create(Self); + FScrollbarHorz.Kind := sbHorizontal; + FScrollbarHorz.OnChange := @DoHorzScrollBarChange; + + with FoldedTextBuffer as TSynEditFoldedView do + AddChangeHandler(senrLineMappingChanged, @DoLineChanges); + TextView.AddChangeHandler(senrLineCount, @DoLineChanges); + + ScrollBars := ssNone; + + TSynEditMarkupSelection(MarkupByClass[TSynEditMarkupSelection]).MarkupInfoSeletion.Background := SimbaTheme.ColorActive; + + + Color := SimbaTheme.ColorBackground; + Font.Color := SimbaTheme.ColorFont; +end; + +end. + diff --git a/Source/components/simba.component_tabcontrol.pas b/Source/components/simba.component_tabcontrol.pas index dbf2e9702..0d239c35a 100644 --- a/Source/components/simba.component_tabcontrol.pas +++ b/Source/components/simba.component_tabcontrol.pas @@ -53,7 +53,7 @@ TSimbaTabControl = class(TCustomControl) procedure FontChanged(Sender: TObject); override; procedure Paint; override; - procedure CallTabChanged; + procedure CallTabChanged(Data: PtrInt); procedure DoTabMoved(Sender: TObject; AIndexFrom, AIndexTo: Integer); procedure DoTabChanged(Sender: TObject); @@ -82,6 +82,7 @@ TSimbaTabControl = class(TCustomControl) procedure SetOnMouseMove(Value: TMouseMoveEvent); public constructor Create(AOwner: TComponent; TabClass: TSimbaTabClass; ADefaultTitle: String = ''); reintroduce; + destructor Destroy; override; function AddTab(Title: String = ''): TSimbaTab; function DeleteTab(Tab: TSimbaTab): Boolean; @@ -113,7 +114,7 @@ TSimbaTabControl = class(TCustomControl) implementation uses - simba.main, simba.mufasatypes, simba.threading; + simba.main, simba.mufasatypes, simba.theme; function TSimbaTab.GetImageIndex: TImageIndex; begin @@ -327,11 +328,11 @@ procedure TSimbaTabControl.FontChanged(Sender: TObject); procedure TSimbaTabControl.Paint; begin - Canvas.Brush.Color := clHighlight; + Canvas.Brush.Color := SimbaTheme.ColorActive; Canvas.FillRect(0, FTabs.Height, Width, FTabs.Height + FTabs.BorderSpacing.Bottom); end; -procedure TSimbaTabControl.CallTabChanged; +procedure TSimbaTabControl.CallTabChanged(Data: PtrInt); begin if Assigned(FTabs) then DoTabChanged(FTabs); @@ -385,7 +386,8 @@ procedure TSimbaTabControl.DoTabClose(Sender: TObject; ATabIndex: Integer; var A if ACanClose then begin Tab.Free(); - QueueOnMainThread(@CallTabChanged); + + Application.QueueAsyncCall(@CallTabChanged, 0); end; end; end; @@ -431,7 +433,7 @@ constructor TSimbaTabControl.Create(AOwner: TComponent; TabClass: TSimbaTabClass FTabs.OnTabClose := @DoTabClose; FTabs.OnTabChangeQuery := @DoTabChangeQuery; FTabs.OnContextPopup := @DoTabRightClick; - FTabs.ColorFont := clWhite; + FTabs.ColorFont := SimbaTheme.ColorFont; FTabs.Images := SimbaForm.Images; FTabs.BorderSpacing.Bottom := 5; @@ -447,15 +449,24 @@ constructor TSimbaTabControl.Create(AOwner: TComponent; TabClass: TSimbaTabClass FTabs.OptTabHeight := FTabs.Height; FTabs.OptShowFlat := True; - FTabs.ColorBg := $4A4136; - FTabs.ColorTabPassive := $4A4136; - FTabs.ColorTabOver := clHighlight; - FTabs.ColorSeparator := clWhite; - FTabs.ColorTabActive := clHighlight; - FTabs.ColorActiveMark := clHighlight; + FTabs.ColorArrow := SimbaTheme.ColorLine; + FTabs.ColorCloseX := SimbaTheme.ColorLine; + FTabs.ColorBg := SimbaTheme.ColorFrame; + FTabs.ColorTabPassive := SimbaTheme.ColorActive; + FTabs.ColorTabOver := SimbaTheme.ColorActive; + FTabs.ColorSeparator := SimbaTheme.ColorFont; + FTabs.ColorTabActive := SimbaTheme.ColorActive; + FTabs.ColorActiveMark := SimbaTheme.ColorActive; FTabs.ColorCloseBgOver := clNone; end; +destructor TSimbaTabControl.Destroy; +begin + Application.RemoveAsyncCalls(Self); + + inherited Destroy(); +end; + function TSimbaTabControl.AddTab(Title: String): TSimbaTab; var NeedChangeEvent: Boolean; diff --git a/Source/components/simba.component_treeview.pas b/Source/components/simba.component_treeview.pas index c983d2eb0..4fa650c0a 100644 --- a/Source/components/simba.component_treeview.pas +++ b/Source/components/simba.component_treeview.pas @@ -99,7 +99,7 @@ TSimbaTreeView = class(TCustomControl) implementation uses - Math; + Math, simba.theme; constructor TSimbaTreeView.Create(AOwner: TComponent; NodeClass: TTreeNodeClass); begin @@ -135,8 +135,9 @@ constructor TSimbaTreeView.Create(AOwner: TComponent; NodeClass: TTreeNodeClass) FTree.ExpandSignType := tvestArrow; FTree.ExpandSignColor := clWhite; FTree.TreeLinePenStyle := psClear; - FTree.Font.Color := clWhite; - FTree.BackgroundColor := $322F2D; + FTree.Font.Color := SimbaTheme.ColorFont; + FTree.BackgroundColor := SimbaTheme.ColorBackground; + FTree.SelectionColor := SimbaTheme.ColorActive; FTree.OnCreateNodeClass := @DoCreateNodeClass; FTree.OnMouseMove := @DoMouseMove; FTree.DragMode := dmAutomatic; @@ -153,31 +154,30 @@ constructor TSimbaTreeView.Create(AOwner: TComponent; NodeClass: TTreeNodeClass) FFilterEdit.Align := alBottom; FFilterEdit.OnChange := @DoFilterChange; - FFilterEdit.Color := $322F2D; - FFilterEdit.ColorBorder := $4A4136; - FFilterEdit.ColorBorderActive := $D77800; - FFilterEdit.ColorSelection := $D77800; - FFilterEdit.Font.Color := clWhite; + FFilterEdit.Color := SimbaTheme.ColorBackground; + FFilterEdit.ColorBorder := SimbaTheme.ColorFrame; + FFilterEdit.ColorBorderActive := SimbaTheme.ColorActive; + FFilterEdit.ColorSelection := SimbaTheme.ColorActive; + FFilterEdit.Font.Color := SimbaTheme.ColorFont; FFilterEdit.HintTextColor := clLtGray; FFilterEdit.HintText := '(search)'; with ATScrollbarTheme do begin - InitialSize := 30; - - ColorBG := $322F2D; - ColorThumbBorder := $4A4136; - ColorThumbFill := $4A4136; - ColorThumbFillOver := $4A4136; - ColorThumbFillPressed := $4A4136; - ColorThumbDecor := $4A4136; - - ThumbMinSize := Scale96ToScreen(15); + InitialSize := Scale96ToScreen(16); + ThumbMinSize := Scale96ToScreen(36); + ThumbRoundedRect := False; DirectJumpOnClickPageUpDown := True; - ColorArrowFill := $4A4136; - ColorArrowBorder := $4A4136; - ColorArrowSign := $87827A; + ColorBG := SimbaTheme.ColorScrollBarInActive; + ColorThumbBorder := SimbaTheme.ColorScrollBarActive; + ColorThumbFill := SimbaTheme.ColorScrollBarActive; + ColorThumbFillOver := SimbaTheme.ColorScrollBarActive; + ColorThumbFillPressed := SimbaTheme.ColorScrollBarActive; + ColorThumbDecor := SimbaTheme.ColorScrollBarActive; + ColorArrowFill := SimbaTheme.ColorScrollBarActive; + ColorArrowBorder := SimbaTheme.ColorScrollBarActive; + ColorArrowSign := SimbaTheme.ColorLine; end; end; @@ -404,7 +404,7 @@ procedure TSimbaInternalTreeView.DoDrawArrow(Sender: TCustomTreeView; const ARec end; Sender.Canvas.Pen.Width := 2; - Sender.Canvas.Pen.Color := $989796; + Sender.Canvas.Pen.Color := SimbaTheme.ColorLine; Sender.Canvas.Polyline(Points); end; diff --git a/Source/components/simba.component_treeviewhint.pas b/Source/components/simba.component_treeviewhint.pas index afc86ecca..4533b26e6 100644 --- a/Source/components/simba.component_treeviewhint.pas +++ b/Source/components/simba.component_treeviewhint.pas @@ -36,7 +36,8 @@ TSimbaTreeViewHint = class(TComponent) implementation uses - LCLType; + LCLType, + simba.theme; type TCustomHintWindow = class(THintWindow) @@ -60,10 +61,10 @@ procedure TCustomHintWindow.Paint; Canvas.Font := TSimbaTreeViewHint(Owner).FTreeView.Font; Canvas.Font.Color := clWhite; - Canvas.Pen.Color := $D77800; - Canvas.Brush.Color := $322F2D; + Canvas.Pen.Color := SimbaTheme.ColorActive; + Canvas.Brush.Color := SimbaTheme.ColorBackground; Canvas.Rectangle(ClientRect); - Canvas.TextRect(ClientRect, 3, 0, Caption, TextStyle); + Canvas.TextRect(ClientRect, 4, 0, Caption, TextStyle); end; procedure TSimbaTreeViewHint.DoTimerExecute(Sender: TObject); @@ -97,7 +98,7 @@ constructor TSimbaTreeViewHint.Create(AOwner: TTreeView); FHintWindow := TCustomHintWindow.Create(Self); FHintWindow.OnHide := @DoHintWindowHide; FHintWindow.OnShow := @DoHintWindowShow; - FHintWindow.Color := clRed; // disable "UseBGThemes" to stop flickering. We custom draw so this color doesn't matter. + FHintWindow.Color := clRed; // disable "UseBGThemes" to stop flickering. We custom draw so this color doesn't matter. FTreeView := AOwner; end; @@ -121,7 +122,8 @@ procedure TSimbaTreeViewHint.Show(Node: TTreeNode; Caption: String); FNodeRect := Node.DisplayRect(True); FNodeRect.Offset(FTreeView.ClientOrigin); - FNodeRect.Right := FNodeRect.Left + FHintWindow.Canvas.TextWidth(Caption) + 6; + FNodeRect.Left := FNodeRect.Left - 1; + FNodeRect.Right := FNodeRect.Left + FHintWindow.Canvas.TextWidth(Caption) + 8; FHintWindow.ActivateHint(FNodeRect, Caption); end; diff --git a/Source/editor/simba.editor.pas b/Source/editor/simba.editor.pas index 03fab017c..1fb2c5278 100644 --- a/Source/editor/simba.editor.pas +++ b/Source/editor/simba.editor.pas @@ -15,10 +15,10 @@ interface SynEditKeyCmds, SynEditHighlighter, SynHighlighterPas_Simba, SynEditMarkupHighAll, LazSynEditMouseCmdsTypes, LazMethodList, simba.mufasatypes, simba.settings, simba.editor_autocomplete, simba.editor_paramhint, - simba.editor_attributes, simba.editor_modifiedlinegutter; + simba.editor_attributes, simba.editor_modifiedlinegutter, simba.component_synedit; type - TSimbaEditor = class(TSynEdit) + TSimbaEditor = class(TSimbaSynEdit) protected FAutoComplete: TSimbaAutoComplete; FParamHint: TSimbaParamHint; @@ -37,7 +37,7 @@ TSimbaEditor = class(TSynEdit) procedure FontChanged(Sender: TObject); override; procedure SimbaSettingChanged(Setting: TSimbaSetting); - procedure DoDragDrop(Sender, Source: TObject; X,Y: Integer); + procedure DoDragDrop(Sender, Source: TObject; X, Y: Integer); procedure DoDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); // Temp line coloring @@ -86,11 +86,11 @@ TSimbaEditor = class(TSynEdit) implementation uses - SynEditPointClasses, + SynEditPointClasses, SynGutterBase, simba.fonthelpers, simba.editor_blockcompletion, simba.editor_docgenerator, simba.editor_commentblock, simba.editor_mousewheelzoom, simba.editor_multicaret, - simba.editor_popupmenu; + simba.editor_popupmenu, simba.theme; function TSimbaEditor.IsHighlighterAttribute(Values: TStringArray): Boolean; var @@ -406,6 +406,8 @@ function TSimbaEditor.GetExpressionEx(X, Y: Integer): String; end; constructor TSimbaEditor.Create(AOwner: TComponent; LoadColors: Boolean); +var + I: Integer; begin inherited Create(AOwner); @@ -473,12 +475,9 @@ constructor TSimbaEditor.Create(AOwner: TComponent; LoadColors: Boolean); MarkupInfo.BackAlpha := 115; end; - FAttributes := TSimbaEditor_Attributes.Create(Self); - Gutter.MarksPart.Visible := False; Gutter.SeparatorPart.Visible := False; Gutter.LeftOffset := 10; - Gutter.ChangesPart.ModifiedColor := RGBToColor(255, 192, 0); with TSynGutterLineOverview.Create(RightGutter.Parts) do begin @@ -487,7 +486,9 @@ constructor TSimbaEditor.Create(AOwner: TComponent; LoadColors: Boolean); FModifiedLinesGutter.Color := Gutter.ChangesPart.ModifiedColor; FModifiedLinesGutter.ColorSaved := Gutter.ChangesPart.SavedColor; - TSynGutterLOvProviderCurrentPage.Create(Providers); + AutoSize := False; + Width := Scale96ToScreen(2); + //TSynGutterLOvProviderCurrentPage.Create(Providers); end; TSimbaEditorPlugin_MultiCaret.Create(Self); @@ -500,9 +501,28 @@ constructor TSimbaEditor.Create(AOwner: TComponent; LoadColors: Boolean); Keystrokes.Delete(KeyStrokes.FindCommand(ecNormalSelect)); Keystrokes.Delete(KeyStrokes.FindCommand(ecColumnSelect)); - if LoadColors then - SimbaSettingChanged(SimbaSettings.Editor.CustomColors); + FAttributes := TSimbaEditor_Attributes.Create(Self); + + Gutter.Color := SimbaTheme.ColorBackground; + + for I := 0 to Gutter.Parts.Count - 1 do + Gutter.Parts[i].Visible := False; + + Gutter.ChangesPart().Visible := True; + Gutter.LineNumberPart().Visible := True; + Gutter.CodeFoldPart().Visible := True; + + for I := 0 to Gutter.Parts.Count - 1 do + if (Gutter.Parts[I] is TSynGutterPartBase) then + TSynGutterPartBase(Gutter.Parts[I]).MarkupInfo.Background := Gutter.Color; + + RightGutter.Color := SimbaTheme.ColorBackground; + for I := 0 to RightGutter.Parts.Count - 1 do + if (RightGutter.Parts[I] is TSynGutterPartBase) then + TSynGutterPartBase(RightGutter.Parts[I]).MarkupInfo.Background := RightGutter.Color; + //if LoadColors then + // SimbaSettingChanged(SimbaSettings.Editor.CustomColors); SimbaSettingChanged(SimbaSettings.Editor.AllowCaretPastEOL); SimbaSettingChanged(SimbaSettings.Editor.RightMarginVisible); SimbaSettingChanged(SimbaSettings.Editor.AntiAliased); diff --git a/Source/editor/simba.editor_attributes.pas b/Source/editor/simba.editor_attributes.pas index cee730852..c9064614c 100644 --- a/Source/editor/simba.editor_attributes.pas +++ b/Source/editor/simba.editor_attributes.pas @@ -13,8 +13,8 @@ interface uses - classes, sysutils, - synedit, synedithighlighter; + Classes, SysUtils, + SynEdit, SynEditHighlighter, SynGutterLineOverview; type TSimbaEditor_Attribute = class(TSynHighlighterAttributes) @@ -76,6 +76,12 @@ TSimbaEditor_DividerAttribute = class(TSimbaEditor_Attribute) procedure Init; override; end; + TSimbaEditor_RightGutterAttribute = class(TSimbaEditor_Attribute) + protected + procedure DoChange; override; + procedure Init; override; + end; + TSimbaEditor_AttributeArray = array of TSynHighlighterAttributes; TSimbaEditor_Attributes = class protected @@ -276,6 +282,19 @@ procedure TSimbaEditor_DividerAttribute.Init; Foreground := clNone; end; +procedure TSimbaEditor_RightGutterAttribute.DoChange; +begin + if (Editor <> nil) then + Editor.RightGutter.LineOverviewPart.MarkupInfo.Background := Foreground; +end; + +procedure TSimbaEditor_RightGutterAttribute.Init; +begin + inherited Init; + + Foreground := cl3DDkShadow; +end; + constructor TSimbaEditor_Attributes.Create(Editor: TSynEdit); procedure Add(AName: String; Attribute: TSynHighlighterAttributes); @@ -313,7 +332,7 @@ constructor TSimbaEditor_Attributes.Create(Editor: TSynEdit); Add('Editor.Selected', Editor.SelectedColor); Add('Editor.Highlight All', Editor.HighlightAllColor); Add('Editor.Mouse Link', Editor.MouseLinkColor); - Add('Editor.Background', TSimbaEditor_BackgroundColorAttribute.Create()); + //Add('Editor.Background', TSimbaEditor_BackgroundColorAttribute.Create()); Add('Editor.Indent Line', TSimbaEditor_IndentColorAttribute.Create()); Add('Editor.Caret', TSimbaEditor_CaretColorAttribute.Create()); Add('Editor.Right Edge', TSimbaEditor_RightEdgeColorAttribute.Create()); @@ -329,6 +348,17 @@ constructor TSimbaEditor_Attributes.Create(Editor: TSynEdit); Add('Gutter.Marks', Editor.Gutter.MarksPart().MarkupInfo); Add('Gutter.Code Fold', Editor.Gutter.CodeFoldPart().MarkupInfo); Add('Gutter.Line Number', Editor.Gutter.LineNumberPart().MarkupInfo); + + Add('RightGutter.Background', TSimbaEditor_RightGutterAttribute.Create()); + + //Editor.Gutter.Color:=255; + //Editor.RightGutter.Color:=$00FF00; + //Editor.RightGutter.LineOverviewPart.MarkupInfo.Foreground:=255; + //Editor.RightGutter.LineOverviewPart.MarkupInfo.Background:=255; + //Editor.RightGutter.LineOverviewPart.MarkupInfo.FrameColor:=255; + //TSimbaEditor(Editor).ModifiedLinesGutter.Color:=255; + //TSimbaEditor(Editor).ModifiedLinesGutter.ColorSaved:=$FFFFFF; + //Add('RightGutter.Changes', TSimbaEditor(Editor).ModifiedLinesGutter.Color); end; destructor TSimbaEditor_Attributes.Destroy; diff --git a/Source/editor/simba.editor_modifiedlinegutter.pas b/Source/editor/simba.editor_modifiedlinegutter.pas index a5e296696..f7e9ecebb 100644 --- a/Source/editor/simba.editor_modifiedlinegutter.pas +++ b/Source/editor/simba.editor_modifiedlinegutter.pas @@ -43,6 +43,9 @@ procedure TSimbaEditorModifiedLinesGutter.Paint(Canvas: TCanvas; AClip: TRect; T var I, Y1, Y2: Integer; begin + if (SynEdit is TSimbaEditor) then + AClip.Right := TSimbaEditor(SynEdit).RightGutter.Width*3; + inherited Paint(Canvas, AClip, TopOffset); if FPaintMarks then diff --git a/Source/editor/simba.editor_popupmenu.pas b/Source/editor/simba.editor_popupmenu.pas index 06284415b..75ea5f0b4 100644 --- a/Source/editor/simba.editor_popupmenu.pas +++ b/Source/editor/simba.editor_popupmenu.pas @@ -12,6 +12,7 @@ TSimbaEditorPopupMenu = class(TPopupMenu) protected procedure DoPopup(Sender: TObject); procedure DoClick(Sender: TObject); + procedure DoScriptTabChange(Sender: TObject); public FindDeclaration: TMenuItem; Undo: TMenuItem; @@ -35,7 +36,9 @@ function GetSimbaEditorPopupMenu: TPopupMenu; implementation uses - simba.main, simba.editor, simba.editor_docgenerator, simba.nativeinterface, simba.scripttabsform; + simba.main, simba.editor, simba.editor_docgenerator, simba.nativeinterface, + simba.scripttab, simba.scripttabsform, + simba.ide_events; var SimbaEditorPopupMenu: TSimbaEditorPopupMenu; @@ -43,7 +46,10 @@ implementation function GetSimbaEditorPopupMenu: TPopupMenu; begin if (SimbaEditorPopupMenu = nil) then + begin SimbaEditorPopupMenu := TSimbaEditorPopupMenu.Create(Application.MainForm); + SimbaIDEEvents.RegisterMethodOnScriptTabChange(@SimbaEditorPopupMenu.DoScriptTabChange); + end; Result := SimbaEditorPopupMenu; end; @@ -100,6 +106,12 @@ procedure TSimbaEditorPopupMenu.DoClick(Sender: TObject); end; end; +procedure TSimbaEditorPopupMenu.DoScriptTabChange(Sender: TObject); +begin + if (Sender is TSimbaScriptTab) then + PopupComponent := TSimbaScriptTab(Sender).Editor; +end; + constructor TSimbaEditorPopupMenu.Create(AOwner: TComponent); function Add(ACaption: String; AImageIndex: Integer; Shortcut: TShortCut; AppendLine: Boolean): TMenuItem; diff --git a/Source/forms/simba.main.lfm b/Source/forms/simba.main.lfm index 0d7720fe0..20e38fcb3 100644 --- a/Source/forms/simba.main.lfm +++ b/Source/forms/simba.main.lfm @@ -1,14 +1,13 @@ object SimbaForm: TSimbaForm - Left = 1231 - Height = 565 - Top = 567 + Left = 3237 + Height = 578 + Top = 716 Width = 910 Caption = 'Simba' - ClientHeight = 565 + ClientHeight = 578 ClientWidth = 910 DesignTimePPI = 120 KeyPreview = True - Menu = MainMenu OnClose = FormClose OnCreate = FormCreate OnDestroy = FormDestroy @@ -16,98 +15,102 @@ object SimbaForm: TSimbaForm LCLVersion = '2.2.4.0' object ToolBar: TToolBar Left = 0 + Height = 28 Top = 0 Width = 910 AutoSize = True ButtonHeight = 28 ButtonWidth = 0 Caption = 'ToolBar' - EdgeBorders = [ebTop, ebBottom] + EdgeBorders = [] + EdgeInner = esNone + EdgeOuter = esNone Images = Images + Indent = 0 ParentFont = False ParentShowHint = False ShowHint = True TabOrder = 0 object ToolbarButtonRun: TToolButton - Left = 111 + Left = 110 Hint = 'Run Script (Alt + R)' - Top = 2 + Top = 0 Caption = '&Run' ImageIndex = 14 OnClick = MenuItemScriptStateClick end object ToolbarButtonPause: TToolButton - Left = 131 + Left = 130 Hint = 'Pause Script' - Top = 2 + Top = 0 Caption = '&Pause' Enabled = False ImageIndex = 12 OnClick = MenuItemScriptStateClick end object StopButtonStop: TToolButton - Left = 151 + Left = 150 Hint = 'Stop Script (Alt + S)' - Top = 2 + Top = 0 Caption = '&Stop' Enabled = False ImageIndex = 16 OnClick = MenuItemScriptStateClick end object ToolbarDivider1: TToolButton - Left = 261 - Height = 5 - Top = 2 + Left = 260 + Height = 28 + Top = 0 Style = tbsDivider end object ToolbarButtonClearOutput: TToolButton - Left = 241 + Left = 240 Hint = 'Clear Script Output' - Top = 2 + Top = 0 Caption = 'Clear' ImageIndex = 7 OnClick = MenuClearOutputClick end object ToolbarButtonColorPicker: TToolButton - Left = 176 + Left = 175 Hint = 'Color Picker' - Top = 2 + Top = 0 Caption = 'ToolbarButtonColorPicker' ImageIndex = 19 OnClick = ToolbarButtonColorPickerClick end object ToolbarButtonTargetSelector: TToolButton - Left = 216 + Left = 215 Hint = 'Target Selector' - Top = 2 + Top = 0 Caption = 'ToolbarButtonTargetSelector' ImageIndex = 20 OnMouseDown = ToolbarButtonSelectTargetClick end object ToolbarDivider2: TToolButton - Left = 171 - Height = 5 - Top = 2 + Left = 170 + Height = 28 + Top = 0 Style = tbsDivider end object ToolbarButtonNew: TToolButton - Left = 1 + Left = 0 Hint = 'New' - Top = 2 + Top = 0 Caption = '&New' ImageIndex = 11 OnClick = MenuNewClick end object ToolbarDivider3: TToolButton - Left = 81 - Height = 5 - Top = 2 + Left = 80 + Height = 28 + Top = 0 Style = tbsDivider end object ToolbarButtonOpen: TToolButton - Left = 21 + Left = 20 Hint = 'Open Script (Ctrl + O)' - Top = 2 + Top = 0 Caption = '&Open' ImageIndex = 4 OnClick = MenuOpenClick @@ -115,52 +118,52 @@ object SimbaForm: TSimbaForm ShowHint = True end object ToolbarButtonSave: TToolButton - Left = 41 + Left = 40 Hint = 'Save Script (Ctrl + S)' - Top = 2 + Top = 0 Caption = '&Save' ImageIndex = 6 OnClick = MenuSaveClick end object ToolbarButtonSaveAll: TToolButton - Left = 61 + Left = 60 Hint = 'Save All' - Top = 2 + Top = 0 Caption = 'Save All' ImageIndex = 15 OnClick = ToolbarButtonSaveAllClick end object ToolbarDivider4: TToolButton - Left = 106 - Height = 5 - Top = 2 + Left = 105 + Height = 28 + Top = 0 Style = tbsDivider end object ToolbarButtonCompile: TToolButton - Left = 86 + Left = 85 Hint = 'Compile Script (Alt + C)' - Top = 2 + Top = 0 ImageIndex = 0 OnClick = MenuItemScriptStateClick end object ToolbarDivider5: TToolButton - Left = 236 - Height = 5 - Top = 2 + Left = 235 + Height = 28 + Top = 0 Style = tbsDivider end object ToolbarButtonPackages: TToolButton - Left = 266 + Left = 265 Hint = 'Open Packages' - Top = 2 + Top = 0 Caption = 'ToolbarButtonPackages' ImageIndex = 1 OnClick = ToolbarButtonPackagesClick end object ToolButtonAreaSelector: TToolButton - Left = 196 + Left = 195 Hint = 'Area Selector' - Top = 2 + Top = 0 ImageIndex = 38 OnClick = ToolButtonAreaSelectorClick ShowCaption = False @@ -168,340 +171,25 @@ object SimbaForm: TSimbaForm end object DockPanel: TAnchorDockPanel Left = 0 - Height = 508 - Top = 32 + Height = 550 + Top = 28 Width = 910 Align = alClient BevelOuter = bvNone + ClientHeight = 550 + ClientWidth = 910 ParentFont = False TabOrder = 1 - end - object MainMenu: TMainMenu - Left = 224 - Top = 64 - object MenuFile: TMenuItem - Caption = '&File' - SubMenuImages = Images - OnClick = MenuFileClick - object MenuItemNew: TMenuItem - Caption = '&New' - ImageIndex = 11 - ShortCut = 16462 - OnClick = MenuNewClick - end - object MenuItemDivider11: TMenuItem - Caption = '-' - end - object MenuItemOpen: TMenuItem - Caption = '&Open' - ImageIndex = 4 - ShortCut = 16463 - OnClick = MenuOpenClick - end - object MenuItemOpenRecent: TMenuItem - Caption = 'Open &Recent' - ImageIndex = 22 - end - object MenuItem7: TMenuItem - Caption = '-' - end - object MenuItemExample: TMenuItem - Caption = 'Open Example ...' - OnClick = MenuNewTemplateClick - end - object MenuItem8: TMenuItem - Caption = '-' - end - object MenuItemSave: TMenuItem - Caption = '&Save' - ImageIndex = 6 - ShortCut = 16467 - OnClick = MenuSaveClick - end - object MenuItemSaveAs: TMenuItem - Caption = 'Save As ...' - OnClick = MenuSaveAsClick - end - object MenuItemSaveDefault: TMenuItem - Caption = 'Save As Default' - OnClick = MenuSaveAsDefaultClick - end - object MenuItemSaveAll: TMenuItem - Caption = 'Save All' - ImageIndex = 15 - OnClick = MenuSaveClick - end - object MenuItemDivider2: TMenuItem - Caption = '-' - end - object MenuItemCloseTab: TMenuItem - Caption = '&Close Tab' - ImageIndex = 8 - ShortCut = 16471 - OnClick = MenuCloseTabClick - end - object MenuItemCloseTabs: TMenuItem - Caption = 'Close All Tabs' - ImageIndex = 9 - OnClick = MenuCloseAllTabsClick - end - object MenuItemDivider6: TMenuItem - Caption = '-' - end - object MenuItemMainExit: TMenuItem - Caption = '&Exit' - ImageIndex = 10 - ShortCut = 16465 - OnClick = MenuExitClick - end - end - object MenuEdit: TMenuItem - Caption = '&Edit' - SubMenuImages = Images - OnClick = MenuEditClick - object MenuItemUndo: TMenuItem - Caption = 'Undo' - ImageIndex = 17 - ShortCut = 16474 - OnClick = MenuUndoClick - end - object MenuItemRedo: TMenuItem - Caption = 'Redo' - ImageIndex = 13 - ShortCut = 24666 - OnClick = MenuRedoClick - end - object MenuItemDivider3: TMenuItem - Caption = '-' - end - object MenuItemCut: TMenuItem - Caption = 'Cu&t' - ImageIndex = 3 - OnClick = MenuCutClick - end - object MenuItemCopy: TMenuItem - Caption = '&Copy' - ImageIndex = 2 - OnClick = MenuCopyClick - end - object MenuItemPaste: TMenuItem - Caption = '&Paste' - ImageIndex = 4 - OnClick = MenuPasteClick - end - object MenuItemDivider4: TMenuItem - Caption = '-' - end - object MenuItemSelectAll: TMenuItem - Caption = '&Select All' - ShortCut = 16449 - OnClick = MenuSelectAllClick - end - object MenuItemDivider5: TMenuItem - Caption = '-' - end - object MenuItemFind: TMenuItem - Caption = 'Find ...' - ImageIndex = 18 - ShortCut = 16454 - OnClick = MenuFindClick - end - object MenuItemFindNext: TMenuItem - Caption = 'Find Next' - ShortCut = 114 - OnClick = MenuItemFindNextClick - end - object MenuItemFindPrev: TMenuItem - Caption = 'Find Previous' - ShortCut = 8306 - OnClick = MenuItemFindPrevClick - end - object MenuItem2: TMenuItem - Caption = '-' - end - object MenuItemReplace: TMenuItem - Caption = 'Replace ...' - ShortCut = 16466 - OnClick = MenuReplaceClick - end - object MenuItemDivider14: TMenuItem - Caption = '-' - end - object MenuItemGoto: TMenuItem - Caption = 'Goto Line ...' - ShortCut = 16455 - OnClick = MenuGotoClick - end - end - object MenuItemScript: TMenuItem - Caption = '&Script' - SubMenuImages = Images - object MenuItemCompile: TMenuItem - Caption = 'Compile' - Hint = 'Compile Script' - ImageIndex = 0 - ShortCut = 32835 - OnClick = MenuItemScriptStateClick - end - object MenuItemRun: TMenuItem - Caption = '&Run' - ImageIndex = 14 - ShortCut = 32850 - OnClick = MenuItemScriptStateClick - end - object MenuItemPause: TMenuItem - Caption = '&Pause' - ImageIndex = 12 - OnClick = MenuItemScriptStateClick - end - object MenuItemStop: TMenuItem - Caption = '&Stop' - ImageIndex = 16 - ShortCut = 32851 - OnClick = MenuItemScriptStateClick - end - object MenuItem5: TMenuItem - Caption = '-' - end - object MenuItemRunWithDebugging: TMenuItem - Caption = 'Run with Debugging' - ImageIndex = 37 - OnClick = MenuItemScriptStateClick - end - end - object MenuTools: TMenuItem - Caption = '&Tools' - SubMenuImages = Images - object MenuItemSettings: TMenuItem - Caption = 'Settings' - ImageIndex = 21 - OnClick = MenuItemSettingsClick - end - object MenuItemPackages: TMenuItem - Caption = 'Packages' - ImageIndex = 1 - OnClick = ToolbarButtonPackagesClick - end - object MenuItem6: TMenuItem - Caption = '-' - end - object MenuItemAssociateScripts: TMenuItem - Caption = 'Associate Scripts' - ImageIndex = 28 - OnClick = MenuItemAssociateScriptsClick - end - object MenuItem1: TMenuItem - Caption = '-' - end - object MenuItemBitmapConv: TMenuItem - Caption = '&Bitmap Conversion' - OnClick = MenuItemBitmapConvClick - end - object MenuItemACA: TMenuItem - Caption = 'ACA' - OnClick = MenuItemACAClick - end - object MenuItemDTMEditor: TMenuItem - Caption = 'DTM Editor' - OnClick = MenuItemDTMEditorClick - end - object MenuItemShapeBox: TMenuItem - Caption = 'Shape Box' - ImageIndex = 41 - OnClick = MenuItemShapeBoxClick - end - object MenuItemDivider10: TMenuItem - Caption = '-' - end - object MenuItemFormatScript: TMenuItem - Caption = 'Format Script' - OnClick = MenuItemFormatScriptClick - end - end - object MenuView: TMenuItem - Caption = '&View' - SubMenuImages = Images - OnClick = MenuViewClick - object MenuItemTrayIcon: TMenuItem - AutoCheck = True - Caption = 'Tray Icon' - ShowAlwaysCheckable = True - OnClick = MenuItemTrayIconClick - end - object MenuItemConsole: TMenuItem - AutoCheck = True - Caption = 'Console' - OnClick = MenuItemConsoleClick - end - object MenuItem4: TMenuItem - Caption = '-' - end - object MenuItemColourHistory: TMenuItem - AutoCheck = True - Caption = '&Colour Picker History' - end - object MenuItemDebugImage: TMenuItem - AutoCheck = True - Caption = '&Debug Image' - end - object MenuItemEditor: TMenuItem - AutoCheck = True - Caption = 'Editor' - end - object MenuItemFunctionList: TMenuItem - AutoCheck = True - Caption = '&Function List' - end - object MenuItemNotes: TMenuItem - AutoCheck = True - Caption = '&Notes' - end - object MenuItemFileBrowser: TMenuItem - AutoCheck = True - Caption = 'File Browser' - end - object MenuItemOutput: TMenuItem - AutoCheck = True - Caption = 'Output' - end - object MenuItemDebugger: TMenuItem - Caption = 'Debugger' - OnClick = MenuItemDebuggerClick - end - object MenuItem3: TMenuItem - Caption = '-' - end - object MenuItemResetLayout: TMenuItem - Caption = 'Reset Layout' - OnClick = MenuItemResetLayoutClick - end - object MenuItemLockLayout: TMenuItem - AutoCheck = True - Caption = 'Lock Layout' - OnClick = MenuItemLockLayoutClick - end - end - object MenuHelp: TMenuItem - Caption = '&Help' - SubMenuImages = Images - object MenuItemAbout: TMenuItem - Caption = 'About' - OnClick = MenuItemAboutClick - end - object MenuItemReportBug: TMenuItem - Caption = '&Report a Bug' - ImageIndex = 24 - OnClick = MenuItemReportBugClick - end - object MenuItemGithub: TMenuItem - Caption = 'Simba Github' - ImageIndex = 34 - OnClick = MenuItemGithubClick - end - object MenuItemDocumentation: TMenuItem - Caption = 'Online Documentation' - OnClick = MenuItemDocumentationClick - end + object Panel1: TPanel + Left = 0 + Height = 1 + Top = 0 + Width = 910 + Align = alTop + BevelOuter = bvNone + TabOrder = 0 + Visible = False + OnPaint = Panel1Paint end end object TrayIcon: TTrayIcon @@ -2968,4 +2656,331 @@ object SimbaForm: TSimbaForm Left = 64 Top = 256 end + object MainMenuFile: TPopupMenu + Images = Images + Left = 345 + Top = 234 + object MenuItemNew: TMenuItem + Caption = '&New' + ImageIndex = 11 + ShortCut = 16462 + OnClick = MenuNewClick + end + object MenuItemDivider11: TMenuItem + Caption = '-' + end + object MenuItemOpen: TMenuItem + Caption = '&Open' + ImageIndex = 4 + ShortCut = 16463 + OnClick = MenuOpenClick + end + object MenuItemOpenRecent: TMenuItem + Caption = 'Open &Recent' + ImageIndex = 22 + end + object MenuItem7: TMenuItem + Caption = '-' + end + object MenuItemExample: TMenuItem + Caption = 'Open Example ...' + OnClick = MenuNewTemplateClick + end + object MenuItem8: TMenuItem + Caption = '-' + end + object MenuItemSave: TMenuItem + Caption = '&Save' + ImageIndex = 6 + ShortCut = 16467 + OnClick = MenuSaveClick + end + object MenuItemSaveAs: TMenuItem + Caption = 'Save As ...' + OnClick = MenuSaveAsClick + end + object MenuItemSaveDefault: TMenuItem + Caption = 'Save As Default' + OnClick = MenuSaveAsDefaultClick + end + object MenuItemSaveAll: TMenuItem + Caption = 'Save All' + ImageIndex = 15 + OnClick = MenuSaveClick + end + object MenuItemDivider2: TMenuItem + Caption = '-' + end + object MenuItemCloseTab: TMenuItem + Caption = '&Close Tab' + ImageIndex = 8 + ShortCut = 16471 + OnClick = MenuCloseTabClick + end + object MenuItemCloseTabs: TMenuItem + Caption = 'Close All Tabs' + ImageIndex = 9 + OnClick = MenuCloseAllTabsClick + end + object MenuItemDivider6: TMenuItem + Caption = '-' + end + object MenuItemMainExit: TMenuItem + Caption = '&Exit' + ImageIndex = 10 + ShortCut = 16465 + OnClick = MenuExitClick + end + end + object MainMenuEdit: TPopupMenu + Images = Images + Left = 500 + Top = 190 + object MenuItemUndo: TMenuItem + Caption = 'Undo' + ImageIndex = 17 + ShortCut = 16474 + OnClick = MenuUndoClick + end + object MenuItemRedo: TMenuItem + Caption = 'Redo' + ImageIndex = 13 + ShortCut = 24666 + OnClick = MenuRedoClick + end + object MenuItemDivider3: TMenuItem + Caption = '-' + end + object MenuItemCut: TMenuItem + Caption = 'Cu&t' + ImageIndex = 3 + OnClick = MenuCutClick + end + object MenuItemCopy: TMenuItem + Caption = '&Copy' + ImageIndex = 2 + OnClick = MenuCopyClick + end + object MenuItemPaste: TMenuItem + Caption = '&Paste' + ImageIndex = 4 + OnClick = MenuPasteClick + end + object MenuItemDivider4: TMenuItem + Caption = '-' + end + object MenuItemSelectAll: TMenuItem + Caption = '&Select All' + ShortCut = 16449 + OnClick = MenuSelectAllClick + end + object MenuItemDivider5: TMenuItem + Caption = '-' + end + object MenuItemFind: TMenuItem + Caption = 'Find ...' + ImageIndex = 18 + ShortCut = 16454 + OnClick = MenuFindClick + end + object MenuItemFindNext: TMenuItem + Caption = 'Find Next' + ShortCut = 114 + OnClick = MenuItemFindNextClick + end + object MenuItemFindPrev: TMenuItem + Caption = 'Find Previous' + ShortCut = 8306 + OnClick = MenuItemFindPrevClick + end + object MenuItem2: TMenuItem + Caption = '-' + end + object MenuItemReplace: TMenuItem + Caption = 'Replace ...' + ShortCut = 16466 + OnClick = MenuReplaceClick + end + object MenuItemDivider14: TMenuItem + Caption = '-' + end + object MenuItemGoto: TMenuItem + Caption = 'Goto Line ...' + ShortCut = 16455 + OnClick = MenuGotoClick + end + end + object MainMenuScript: TPopupMenu + Images = Images + Left = 570 + Top = 290 + object MenuItemCompile: TMenuItem + Caption = 'Compile' + Hint = 'Compile Script' + ImageIndex = 0 + ShortCut = 32835 + OnClick = MenuItemScriptStateClick + end + object MenuItemRun: TMenuItem + Caption = '&Run' + ImageIndex = 14 + ShortCut = 32850 + OnClick = MenuItemScriptStateClick + end + object MenuItemPause: TMenuItem + Caption = '&Pause' + ImageIndex = 12 + OnClick = MenuItemScriptStateClick + end + object MenuItemStop: TMenuItem + Caption = '&Stop' + ImageIndex = 16 + ShortCut = 32851 + OnClick = MenuItemScriptStateClick + end + object MenuItem5: TMenuItem + Caption = '-' + end + object MenuItemRunWithDebugging: TMenuItem + Caption = 'Run with Debugging' + ImageIndex = 37 + OnClick = MenuItemScriptStateClick + end + end + object MainMenuTools: TPopupMenu + Images = Images + Left = 620 + Top = 130 + object MenuItemSettings: TMenuItem + Caption = 'Settings' + ImageIndex = 21 + OnClick = MenuItemSettingsClick + end + object MenuItemPackages: TMenuItem + Caption = 'Packages' + ImageIndex = 1 + OnClick = ToolbarButtonPackagesClick + end + object MenuItem6: TMenuItem + Caption = '-' + end + object MenuItemAssociateScripts: TMenuItem + Caption = 'Associate Scripts' + ImageIndex = 28 + OnClick = MenuItemAssociateScriptsClick + end + object MenuItem1: TMenuItem + Caption = '-' + end + object MenuItemBitmapConv: TMenuItem + Caption = '&Bitmap Conversion' + OnClick = MenuItemBitmapConvClick + end + object MenuItemACA: TMenuItem + Caption = 'ACA' + OnClick = MenuItemACAClick + end + object MenuItemDTMEditor: TMenuItem + Caption = 'DTM Editor' + OnClick = MenuItemDTMEditorClick + end + object MenuItemShapeBox: TMenuItem + Caption = 'Shape Box' + ImageIndex = 41 + OnClick = MenuItemShapeBoxClick + end + object MenuItemDivider10: TMenuItem + Caption = '-' + end + object MenuItemFormatScript: TMenuItem + Caption = 'Format Script' + OnClick = MenuItemFormatScriptClick + end + end + object MainMenuView: TPopupMenu + Images = Images + Left = 450 + Top = 90 + object MenuItemTrayIcon: TMenuItem + AutoCheck = True + Caption = 'Tray Icon' + ShowAlwaysCheckable = True + OnClick = MenuItemTrayIconClick + end + object MenuItemConsole: TMenuItem + AutoCheck = True + Caption = 'Console' + OnClick = MenuItemConsoleClick + end + object MenuItem4: TMenuItem + Caption = '-' + end + object MenuItemColourHistory: TMenuItem + AutoCheck = True + Caption = '&Colour Picker History' + end + object MenuItemDebugImage: TMenuItem + AutoCheck = True + Caption = '&Debug Image' + end + object MenuItemEditor: TMenuItem + AutoCheck = True + Caption = 'Editor' + end + object MenuItemFunctionList: TMenuItem + AutoCheck = True + Caption = '&Function List' + end + object MenuItemNotes: TMenuItem + AutoCheck = True + Caption = '&Notes' + end + object MenuItemFileBrowser: TMenuItem + AutoCheck = True + Caption = 'File Browser' + end + object MenuItemOutput: TMenuItem + AutoCheck = True + Caption = 'Output' + end + object MenuItemDebugger: TMenuItem + Caption = 'Debugger' + OnClick = MenuItemDebuggerClick + end + object MenuItem3: TMenuItem + Caption = '-' + end + object MenuItemResetLayout: TMenuItem + Caption = 'Reset Layout' + OnClick = MenuItemResetLayoutClick + end + object MenuItemLockLayout: TMenuItem + AutoCheck = True + Caption = 'Lock Layout' + OnClick = MenuItemLockLayoutClick + end + end + object MainMenuHelp: TPopupMenu + Images = Images + Left = 560 + Top = 70 + object MenuItemAbout: TMenuItem + Caption = 'About' + OnClick = MenuItemAboutClick + end + object MenuItemReportBug: TMenuItem + Caption = '&Report a Bug' + ImageIndex = 24 + OnClick = MenuItemReportBugClick + end + object MenuItemGithub: TMenuItem + Caption = 'Simba Github' + ImageIndex = 34 + OnClick = MenuItemGithubClick + end + object MenuItemDocumentation: TMenuItem + Caption = 'Online Documentation' + OnClick = MenuItemDocumentationClick + end + end end diff --git a/Source/forms/simba.main.pas b/Source/forms/simba.main.pas index cfc4c44f0..3d71127aa 100644 --- a/Source/forms/simba.main.pas +++ b/Source/forms/simba.main.pas @@ -13,7 +13,7 @@ interface classes, sysutils, fileutil, anchordockpanel, forms, controls, graphics, dialogs, stdctrls, menus, comctrls, extctrls, buttons, imglist, simba.settings, simba.mufasatypes, simba.mouselogger, simba.areaselector, simba.scriptbackup, - simba.scriptinstance; + simba.scriptinstance, simba.component_menubar, LMessages; const IMAGE_NONE = -1; @@ -61,11 +61,13 @@ interface type TSimbaForm = class(TForm) DockPanel: TAnchorDockPanel; + MainMenuTools: TPopupMenu; + MainMenuView: TPopupMenu; + MainMenuHelp: TPopupMenu; MenuItemShapeBox: TMenuItem; MenuItemDocumentation: TMenuItem; MenuItemGithub: TMenuItem; Images: TImageList; - MainMenu: TMainMenu; MenuEdit: TMenuItem; MenuFile: TMenuItem; MenuHelp: TMenuItem; @@ -136,6 +138,10 @@ TSimbaForm = class(TForm) MenuItemUndo: TMenuItem; MenuTools: TMenuItem; MenuView: TMenuItem; + MainMenuFile: TPopupMenu; + MainMenuEdit: TPopupMenu; + MainMenuScript: TPopupMenu; + Panel1: TPanel; StopButtonStop: TToolButton; PackageMenuTimer: TTimer; ToolBar: TToolBar; @@ -163,6 +169,7 @@ TSimbaForm = class(TForm) procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); + procedure FormShortCut(var Msg: TLMKey; var Handled: Boolean); procedure MenuClearOutputClick(Sender: TObject); procedure MenuCloseAllTabsClick(Sender: TObject); procedure MenuCloseTabClick(Sender: TObject); @@ -206,13 +213,16 @@ TSimbaForm = class(TForm) procedure MenuUndoClick(Sender: TObject); procedure MenuViewClick(Sender: TObject); procedure DoPackageMenuTimer(Sender: TObject); + procedure Panel1Paint(Sender: TObject); procedure ToolbarButtonColorPickerClick(Sender: TObject); procedure ToolbarButtonPackagesClick(Sender: TObject); procedure ToolbarButtonSaveAllClick(Sender: TObject); procedure ToolbarButtonSelectTargetClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure ToolBarPaint(Sender: TObject); procedure ToolButtonAreaSelectorClick(Sender: TObject); procedure TrayIconClick(Sender: TObject); procedure TrayPopupExitClick(Sender: TObject); + protected FWindowSelection: TWindowHandle; FProcessSelection: Integer; @@ -223,6 +233,8 @@ TSimbaForm = class(TForm) FAreaSelector: TSimbaAreaSelector; FAreaSelection: TBox; + procedure DoPaintSeperatorButton(Sender: TObject); + procedure AddRecentFile(FileName: String); procedure SetButtonStates(Instance: TSimbaScriptInstance); @@ -283,7 +295,7 @@ implementation simba.openssl, simba.files, simba.process, simba.dockinghelpers, simba.nativeinterface, - simba.scriptformatter, simba.windowhandle, simba.scripttab; + simba.scriptformatter, simba.windowhandle, simba.scripttab, simba.theme; procedure TSimbaForm.HandleException(Sender: TObject; E: Exception); @@ -353,7 +365,7 @@ procedure TSimbaForm.SetToolbarSize(Value: Integer); ToolBar.ImagesWidth := Value; ToolBar.ButtonWidth := Value + Scale96ToScreen(8); - ToolBar.ButtonHeight := Value + Scale96ToScreen(8); + ToolBar.ButtonHeight := Value + Scale96ToScreen(16); end; procedure TSimbaForm.SetToolbarPosition(Value: String); @@ -436,7 +448,7 @@ procedure TSimbaForm.SetMacOSKeystokes(Value: Boolean); if Value then Find := ssCtrl else Find := ssMeta; if Value then Replace := ssMeta else Replace := ssCtrl; - SetMacOSKeystroke(MainMenu.Items); + //SetMacOSKeystroke(MainMenu.Items); end; procedure TSimbaForm.HandleFormCreated(Sender: TObject; Form: TCustomForm); @@ -476,6 +488,15 @@ procedure TSimbaForm.DoPackageMenuTimer(Sender: TObject); UpdatePackages(); end; +procedure TSimbaForm.Panel1Paint(Sender: TObject); +begin + with TPanel(Sender) do + begin + Canvas.Pen.Color := $817670; + Canvas.Line(0,0,Width,0); + end; +end; + procedure TSimbaForm.MenuItemFormatScriptClick(Sender: TObject); var Script: String; @@ -627,8 +648,30 @@ procedure TSimbaForm.SetDefaultDocking(IsResetting: Boolean); EnsureVisible(); end; +procedure TSimbaForm.DoPaintSeperatorButton(Sender: TObject); +begin + with TToolButton(Sender) do + begin + Canvas.Brush.Color:=SimbaTheme.ColorFrame; + Canvas.FillRect(ClientRect); + Canvas.Pen.Color:=SimbaTheme.ColorLine; + Canvas.Line(Width div 2, 4, (Width div 2), Height-4); + end; +end; + +type + __TToolButton = class(TToolButton); + procedure TSimbaForm.Setup(Data: PtrInt); +var + I: Integer; begin + Panel1.Color := SimbaTheme.ColorFrame; + + for i:=0 to ToolBar.ButtonCount-1 do + if (ToolBar.Buttons[i].Style=tbsDivider) then + __TToolButton(ToolBar.Buttons[i]).onPaint := @DoPaintSeperatorButton; + SimbaIDEInitialization.CallOnCreatedMethods(); SimbaIDEEvents.RegisterMethodOnEditorLoaded(@DoTabLoaded); @@ -658,6 +701,19 @@ procedure TSimbaForm.Setup(Data: PtrInt); FMouseLogger.Hotkey := VK_F1; SimbaIDEInitialization.CallOnAfterCreateMethods(); + + with TSimbaMainMenuBar.Create(Self) do + begin + Parent := Self; + Align := alTop; + + AddMenu('File', MainMenuFile); + AddMenu('Edit', MainMenuEdit); + AddMenu('Script', MainMenuScript); + AddMenu('Tools', MainMenuTools); + AddMenu('View', MainMenuView); + AddMenu('Help', MainMenuHelp); + end; end; procedure TSimbaForm.FormCreate(Sender: TObject); @@ -666,11 +722,14 @@ procedure TSimbaForm.FormCreate(Sender: TObject); Application.CaptureExceptions := True; Application.OnException := @SimbaForm.HandleException; + Application.OnShortcut := @Self.FormShortCut; Screen.AddHandlerFormAdded(@SimbaForm.HandleFormCreated, True); FRecentFiles := TStringList.Create(); FRecentFiles.Text := SimbaSettings.General.RecentFiles.Value; + + ToolBar.Color := SimbaTheme.ColorFrame; end; procedure TSimbaForm.FormDestroy(Sender: TObject); @@ -699,6 +758,13 @@ procedure TSimbaForm.FormDestroy(Sender: TObject); SimbaSettings.Save(); end; +procedure TSimbaForm.FormShortCut(var Msg: TLMKey; var Handled: Boolean); +begin + Handled := MainMenuFile.IsShortcut(Msg) or MainMenuView.IsShortcut(Msg) or + MainMenuEdit.IsShortcut(Msg) or MainMenuScript.IsShortcut(Msg) or + MainMenuTools.IsShortcut(Msg) or MainMenuHelp.IsShortcut(Msg); +end; + procedure TSimbaForm.MenuItemDebuggerClick(Sender: TObject); begin if (SimbaScriptTabsForm.CurrentTab.DebuggingForm <> nil) then @@ -1129,6 +1195,11 @@ procedure TSimbaForm.ToolbarButtonSelectTargetClick(Sender: TObject; Button: TMo end; end; +procedure TSimbaForm.ToolBarPaint(Sender: TObject); +begin + Writeln('yo'); +end; + procedure TSimbaForm.ToolButtonAreaSelectorClick(Sender: TObject); begin try @@ -1150,7 +1221,7 @@ procedure TSimbaForm.SetupDocking; try DockMaster.BeginUpdate(); - DockMaster.SplitterWidth := 5; + DockMaster.SplitterWidth := 10; DockMaster.HeaderClass := TSimbaAnchorDockHeader; DockMaster.SplitterClass := TSimbaAnchorDockSplitter; DockMaster.SiteClass := TSimbaAnchorDockHostSite; @@ -1190,7 +1261,6 @@ procedure TSimbaForm.SetupDocking; procedure TSimbaForm.SetupCompleted; begin - //ScriptStateTimer.Enabled := True; PackageMenuTimer.Enabled := True; if SimbaSettings.FirstLaunch then diff --git a/Source/forms/simba.outputform.pas b/Source/forms/simba.outputform.pas index 4b42d94cb..6c3ab6f01 100644 --- a/Source/forms/simba.outputform.pas +++ b/Source/forms/simba.outputform.pas @@ -12,10 +12,10 @@ interface uses classes, sysutils, forms, controls, comctrls, graphics, menus, extctrls, syncobjs, synedit, synedittypes, syneditmiscclasses, syneditmousecmds, - simba.settings, simba.mufasatypes, simba.component_tabcontrol; + simba.settings, simba.mufasatypes, simba.component_tabcontrol, simba.component_synedit; type - TSimbaOutputBox = class(TSynEdit) + TSimbaOutputBox = class(TSimbaSynEdit) protected FLock: TCriticalSection; FBuffer: TStringList; @@ -176,12 +176,12 @@ procedure TSimbaOutputBox.SimbaSettingChanged(Setting: TSimbaSetting); if Setting.Equals(SimbaSettings.OutputBox.FontAntiAliased) then Antialiasing := Setting.Value else - if Setting.Equals(SimbaSettings.OutputBox.Color) then - Color := Setting.Value - else - if Setting.Equals(SimbaSettings.OutputBox.FontColor) then - Font.Color := Setting.Value - else + //if Setting.Equals(SimbaSettings.OutputBox.Color) then + // Color := Setting.Value + //else + //if Setting.Equals(SimbaSettings.OutputBox.FontColor) then + // Font.Color := Setting.Value + //else if Setting.Equals(SimbaSettings.OutputBox.FontSize) then Font.Size := Setting.Value else @@ -290,7 +290,7 @@ constructor TSimbaOutputBox.Create(AOwner: TComponent); Command := emcMouseLink; SimbaSettings.RegisterChangeHandler(@SimbaSettingChanged); - for Setting in [SimbaSettings.OutputBox.Color, SimbaSettings.OutputBox.FontColor, SimbaSettings.OutputBox.FontSize, SimbaSettings.OutputBox.FontName, SimbaSettings.OutputBox.FontAntiAliased] do + for Setting in [{SimbaSettings.OutputBox.Color, SimbaSettings.OutputBox.FontColor, }SimbaSettings.OutputBox.FontSize, SimbaSettings.OutputBox.FontName, SimbaSettings.OutputBox.FontAntiAliased] do SimbaSettingChanged(Setting); end; diff --git a/Source/forms/simba.scripttabsform.lfm b/Source/forms/simba.scripttabsform.lfm index 4fb726996..3769f3873 100644 --- a/Source/forms/simba.scripttabsform.lfm +++ b/Source/forms/simba.scripttabsform.lfm @@ -1,7 +1,7 @@ object SimbaScriptTabsForm: TSimbaScriptTabsForm - Left = 2895 + Left = 3905 Height = 192 - Top = 716 + Top = 1096 Width = 816 AllowDropFiles = True Caption = 'Editor' diff --git a/Source/forms/simba.scripttabsform.pas b/Source/forms/simba.scripttabsform.pas index 6cbe49695..c0c082385 100644 --- a/Source/forms/simba.scripttabsform.pas +++ b/Source/forms/simba.scripttabsform.pas @@ -287,6 +287,7 @@ procedure TSimbaScriptTabsForm.Replace; procedure TSimbaScriptTabsForm.Find; begin + Writeln('FIND'); FindPanel.Show(); if FindEdit.CanSetFocus() then FindEdit.SetFocus(); diff --git a/Source/package/simba.package_autoupdater.pas b/Source/package/simba.package_autoupdater.pas index d70ffa1c2..10881a64d 100644 --- a/Source/package/simba.package_autoupdater.pas +++ b/Source/package/simba.package_autoupdater.pas @@ -123,7 +123,7 @@ procedure TPackageUpdater.DoTerminateOnMainThread(Sender: TObject); begin AssertMainThread('TPackageUpdater.DoTerminateOnMainThread'); - BuildMenus(SimbaForm.MainMenu); + //BuildMenus(SimbaForm.MainMenu); UpdateIcon(SimbaForm.ToolbarButtonPackages); end; diff --git a/Source/simba.dockinghelpers.pas b/Source/simba.dockinghelpers.pas index b6c3890f8..2e002f863 100644 --- a/Source/simba.dockinghelpers.pas +++ b/Source/simba.dockinghelpers.pas @@ -18,6 +18,7 @@ TSimbaAnchorDockHeader = class(TAnchorDockHeader) protected procedure Paint; override; + procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override; procedure SetAlign(Value: TAlign); override; public procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; @@ -72,7 +73,8 @@ TAnchorDockMasterHelper = class helper for TAnchorDockMaster implementation uses - anchordockstorage, xmlpropstorage, lazloggerbase, lazconfigstorage; + anchordockstorage, xmlpropstorage, lazloggerbase, lazconfigstorage, + simba.theme; procedure TSimbaAnchorDockHeader.Paint; var @@ -82,7 +84,20 @@ procedure TSimbaAnchorDockHeader.Paint; Style.Layout := tlCenter; Style.Alignment := taCenter; - Canvas.TextRect(ClientRect, 0, 0, Self.Caption, Style); + Canvas.TextRect(ClientRect, 10, 0, Self.Caption, Style); +end; + +procedure TSimbaAnchorDockHeader.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); +begin + with TBitmap.Create() do + try + Canvas.Font := Self.Font; + Canvas.Font.Size := Round(-GetFontData(Canvas.Font.Reference.Handle).Height * 72 / Canvas.Font.PixelsPerInch) + 3; + + PreferredHeight := Canvas.TextHeight('Hello'); + finally + Free(); + end; end; procedure TSimbaAnchorDockHeader.SetAlign(Value: TAlign); @@ -114,8 +129,10 @@ constructor TSimbaAnchorDockHeader.Create(AOwner: TComponent); CloseButton.Parent := nil; //MinimizeButton.Parent := nil; - BorderSpacing.Top := 2; - BorderSpacing.Bottom := 2; + Font.Color := $FFFFFF; + Font.Size := Round(-GetFontData(Canvas.Font.Reference.Handle).Height * 72 / Canvas.Font.PixelsPerInch) + 2; + + Color := SimbaTheme.ColorFrame; end; function TSimbaAnchorDockHostSite.GetHeader: TSimbaAnchorDockHeader; @@ -190,31 +207,9 @@ function TSimbaAnchorDockHostSite.ExecuteDock(NewControl, DropOnControl: TContro end; procedure TSimbaAnchorDockSplitter.Paint; -var - CenterW, CenterH: Integer; begin - Canvas.Brush.Color := Color; + Canvas.Brush.Color := SimbaTheme.ColorFrame; Canvas.FillRect(ClientRect); - Canvas.Brush.Color := cl3DShadow; - - CenterW := Width div 2; - CenterH := Height div 2; - - case ResizeAnchor of - // vertical - akLeft, akRight: - Canvas.FillRect( - CenterW - 1, CenterH - GRIPPER_SIZE, - CenterW + 2, CenterH + GRIPPER_SIZE - ); - - // horz - akTop, akBottom: - Canvas.FillRect( - CenterW - GRIPPER_SIZE, CenterH - 1, - CenterW + GRIPPER_SIZE, CenterH + 2 - ); - end; end; procedure TAnchorDockMasterHelper.MakeDockable(Form: TCustomForm; MenuItem: TMenuItem); diff --git a/Source/simba.inc b/Source/simba.inc index f271ef8e2..f66a43242 100644 --- a/Source/simba.inc +++ b/Source/simba.inc @@ -44,5 +44,3 @@ {.$DEFINE PARSER_CACHE_DEBUG} {.$DEFINE PARSER_LEAK_CHECKS} -{.$DEFINE SIMBA_WINDOWS_DARKTHEME} // incomplete - diff --git a/Source/simba.theme.pas b/Source/simba.theme.pas new file mode 100644 index 000000000..c4c04846c --- /dev/null +++ b/Source/simba.theme.pas @@ -0,0 +1,72 @@ +unit simba.theme; + +{$i simba.inc} + +interface + +uses + Classes, SysUtils, Graphics, Forms; + +type + TSimbaTheme = class + protected + {$IFDEF WINDOWS} + procedure DoFormAdded(Sender: TObject; Form: TCustomForm); + procedure DoColorTitle(Data: PtrInt); + {$ENDIF} + public + ColorBackground: TColor; + ColorFrame: TColor; + ColorActive: TColor; + ColorScrollBarActive: TColor; + ColorScrollBarInActive: TColor; + + ColorFont: TColor; + ColorLine: TColor; + + constructor Create; + end; + +var + SimbaTheme: TSimbaTheme; + +implementation + +{$IFDEF WINDOWS} +uses + DwmApi; + +procedure TSimbaTheme.DoFormAdded(Sender: TObject; Form: TCustomForm); +begin + Application.QueueAsyncCall(@DoColorTitle, PtrUInt(Form)); +end; + +procedure TSimbaTheme.DoColorTitle(Data: PtrInt); +const + DWMWA_CAPTION_COLOR = 35; +begin + DwmSetWindowAttribute(TCustomForm(Data).Handle, DWMWA_CAPTION_COLOR, @Self.ColorFrame, SizeOf(TColor)); +end; +{$ENDIF} + +constructor TSimbaTheme.Create; +begin + ColorFrame := $262628; + ColorBackground := $1C1E1E; + ColorActive := $854F31; + ColorScrollBarActive := $414346; + ColorScrollBarInActive := $2D2E2F; + ColorLine := $657076; + ColorFont := $f2f2f2; + + {$IFDEF WINDOWS} + if (Win32BuildNumber >= 22000) then // DWMWA_CAPTION_COLOR + Screen.AddHandlerFormAdded(@Self.DoFormAdded); + {$ENDIF} +end; + +initialization + SimbaTheme := TSimbaTheme.Create(); + +end. + diff --git a/Source/simba.windowsdarktheme.pas b/Source/simba.windowsdarktheme.pas deleted file mode 100644 index 6fc6a6721..000000000 --- a/Source/simba.windowsdarktheme.pas +++ /dev/null @@ -1,58 +0,0 @@ -{ - Author: Raymond van Venetiƫ and Merlijn Wajer - Project: Simba (https://github.com/MerlijnWajer/Simba) - License: GNU General Public License (https://www.gnu.org/licenses/gpl-3.0) -} -unit simba.windowsdarktheme; - -{$I simba.inc} - -interface - -const - BackColor: Integer = $1E1E1E; - TextColor: Integer = $F0F0F0; - InputBackColor: Integer = $303030; - -implementation - -{$IF DEFINED(SIMBA_WINDOWS_DARKTHEME) and DEFINED(WINDOWS)} -uses - Controls, Forms, UxTheme, Windows; - -type - TApplicationHelper = class helper for TApplication - procedure SetDarkTheme(Data: PtrInt); - end; - -procedure TApplicationHelper.SetDarkTheme(Data: PtrInt); -var - Control: TWinControl; -begin - Control := FindControl(Data); - - if Assigned(Control) then - begin - Control := FindControl(Data); - if (not Control.IsParentColor) then - Control.Color := InputBackColor; - Control.Font.Color := TextColor; - - SetWindowTheme(Data, 'DarkMode_Explorer', nil); - end; -end; - -function HookProc(Code: LongInt; Win: WPARAM; Data: LPARAM): LRESULT; stdcall; -begin - if (Code = HCBT_CREATEWND) then - Application.QueueAsyncCall(@Application.SetDarkTheme, PtrInt(Win)); - - Result := CallNextHookEx(0, Code, Win, Data); -end; - -initialization - SetWindowsHookEx(WH_CBT, @HookProc, GetModuleHandle(nil), GetCurrentThreadID()); -{$ENDIF} - -end. - diff --git a/Third-Party/atscrollbar.pas b/Third-Party/atscrollbar.pas index cb488e39f..ab0ed86ac 100644 --- a/Third-Party/atscrollbar.pas +++ b/Third-Party/atscrollbar.pas @@ -951,7 +951,6 @@ procedure TATScrollbar.DoPaintStd_Thumb(C: TCanvas; const R: TRect); end; end; - procedure TATScrollbar.SetMax(Value: Int64); begin if FMax<>Value then diff --git a/Third-Party/attabs.pas b/Third-Party/attabs.pas index 3c36b1ac4..b0b32c15b 100644 --- a/Third-Party/attabs.pas +++ b/Third-Party/attabs.pas @@ -3672,9 +3672,6 @@ procedure TATTabs.DoPaintArrowTo(C: TCanvas; ATyp: TATTabTriangle; ARect: TRect; var NColor: TColor; begin - if not AEnabled then - NColor:= ColorBlendHalf(FColorArrow, FColorBg) - else if AActive and not _IsDrag then NColor:= FColorArrowOver else