Skip to content

Commit

Permalink
Minor GUI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Sep 18, 2023
1 parent 6368834 commit 9e2816e
Show file tree
Hide file tree
Showing 19 changed files with 2,171 additions and 2,093 deletions.
Binary file removed Images/Target_01_16.png
Binary file not shown.
Binary file removed Images/Target_01_24.png
Binary file not shown.
Binary file removed Images/Target_01_32.png
Binary file not shown.
Binary file removed Images/cog.png
Binary file not shown.
Binary file removed Images/cog_150.png
Binary file not shown.
Binary file removed Images/cog_200.png
Binary file not shown.
Binary file modified Images/compile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Images/compile_150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Images/compile_200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/setup_150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/setup_200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/target.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/target_150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/target_200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Source/Simba.res
Binary file not shown.
4 changes: 2 additions & 2 deletions Source/components/simba.component_menubar.pas
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TSimbaMainMenuBar = class(TCustomControl)
implementation

uses
LMessages, LCLIntf,
LMessages, LCLIntf, ATCanvasPrimitives,
simba.theme, simba.fonthelpers;

function TSimbaMainMenuBar.GetMenus: TPopupMenuArray;
Expand Down Expand Up @@ -200,7 +200,7 @@ procedure TSimbaMainMenuBar.Paint;
Canvas.TextRect(R, R.Left, R.Top, FItems[I].Text, Style);
end;

Canvas.Pen.Color := SimbaTheme.ColorLine;
Canvas.Pen.Color := ColorBlendHalf(SimbaTheme.ColorFrame, SimbaTheme.ColorLine);
Canvas.Line(0, Height - 1, Width, Height - 1);
end;

Expand Down
4,167 changes: 2,132 additions & 2,035 deletions Source/forms/simba.main.lfm

Large diffs are not rendered by default.

93 changes: 37 additions & 56 deletions Source/forms/simba.main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ TSimbaForm = class(TForm)
ToolbarButtonSave: TToolButton;
ToolbarButtonSaveAll: TToolButton;
ToolbarButtonTargetSelector: TToolButton;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButtonNew: TToolButton;
ToolButtonAreaSelector: TToolButton;
TrayIcon: TTrayIcon;
Expand Down Expand Up @@ -256,8 +261,6 @@ TSimbaForm = class(TForm)
procedure DoScriptTabChange(Sender: TObject);
procedure DoScriptStateChange(Sender: TObject);

procedure SetToolbarSize(Value: Integer);
procedure SetToolbarPosition(Value: String);
procedure SetCustomFontSize(Value: Integer);
procedure SetConsoleVisible(Value: Boolean);
procedure SetLayoutLocked(Value: Boolean);
Expand Down Expand Up @@ -356,32 +359,6 @@ procedure TSimbaForm.HandleException(Sender: TObject; E: Exception);
end;
end;

procedure TSimbaForm.SetToolbarSize(Value: Integer);
begin
ToolBar.ImagesWidth := Value;

ToolBar.ButtonWidth := Value + Scale96ToScreen(10);
ToolBar.ButtonHeight := Value + Scale96ToScreen(16);
end;

procedure TSimbaForm.SetToolbarPosition(Value: String);
begin
MainMenuPanel.Align := alNone;

case Value of
'Top': ToolBar.Align := alTop;
'Left': ToolBar.Align := alLeft;
'Right': ToolBar.Align := alRight;
end;

if (Value = 'Top') then
ToolBar.EdgeBorders := [ebTop, ebBottom]
else
ToolBar.EdgeBorders := [];

MainMenuPanel.Align := alTop;
end;

procedure TSimbaForm.SetCustomFontSize(Value: Integer);
var
I: Integer;
Expand Down Expand Up @@ -808,40 +785,40 @@ procedure TSimbaForm.DoColorPicked(Data: PtrInt);
end;

procedure TSimbaForm.DoSettingChanged_Toolbar(Setting: TSimbaSetting);
var
I: Integer;
begin
if Setting.Equals(SimbaSettings.General.ToolbarSize) then
begin
ToolBar.ImagesWidth := Setting.Value;

ToolBar.ButtonWidth := Setting.Value + Scale96ToScreen(8);
ToolBar.ButtonHeight := Setting.Value + Scale96ToScreen(16);
end;

if Setting.Equals(SimbaSettings.General.ToolbarPosition) then
begin
MainMenuPanel.Align := alNone;

case String(Setting.Value) of
'Top':
begin
ToolBar.Align := alTop;
ToolBar.EdgeBorders := [ebTop, ebBottom];
end;
'Left':
begin
ToolBar.Align := alLeft;
ToolBar.EdgeBorders := [];
end;
'Right':
begin
ToolBar.Align := alRight;
ToolBar.EdgeBorders := [];
end;
'Top': ToolBar.Align := alTop;
'Left': ToolBar.Align := alLeft;
'Right': ToolBar.Align := alRight;
end;

MainMenuPanel.Align := alTop;
end;

ToolBar.ImagesWidth := SimbaSettings.General.ToolbarSize.Value;

if (ToolBar.Align = alTop) then
begin
ToolBar.ButtonWidth := Round(ToolBar.ImagesWidth * 1.50);
ToolBar.ButtonHeight := Round(ToolBar.ImagesWidth * 1.75);
for I := 0 to Toolbar.ButtonCount - 1 do
if (ToolBar.Buttons[I].Style = tbsSeparator) then
ToolBar.Buttons[I].Visible := True;
end else
begin
ToolBar.ButtonWidth := Round(ToolBar.ImagesWidth * 2.50);
ToolBar.ButtonHeight := Round(ToolBar.ImagesWidth * 1.75);
for I := 0 to Toolbar.ButtonCount - 1 do
if (ToolBar.Buttons[I].Style = tbsSeparator) then
ToolBar.Buttons[I].Visible := False;
end;

if Setting.Equals(SimbaSettings.General.ToolBarSpacing) then
ToolBar.BorderSpacing.Around := Setting.Value;
end;
Expand Down Expand Up @@ -1207,7 +1184,7 @@ procedure TSimbaForm.ToolBarPaintButton(Sender: TToolButton; State: integer);
begin
if (Style = tbsDivider) then
begin
Canvas.Pen.Color := SimbaTheme.ColorLine;
Canvas.Pen.Color := ColorBlendHalf(SimbaTheme.ColorFrame, SimbaTheme.ColorLine);
with ClientRect.CenterPoint do
Canvas.Line(X,3,X,Height-3);

Expand All @@ -1222,16 +1199,17 @@ procedure TSimbaForm.ToolBarPaintButton(Sender: TToolButton; State: integer);
if (Style = tbsButtonDrop) then
begin
DropDownRect := MainBtnRect;
DropDownRect.Left := DropDownRect.Right - ToolBar.DropDownWidth;
DropDownRect.Left := MainBtnRect.CenterPoint.X + 8;
DropDownRect.Right := MainBtnRect.Right - 3;

MainBtnRect.Right := DropDownRect.Left;
MainBtnRect.Right := MainBtnRect.Right - 10;
end;

IconPos.X := (MainBtnRect.Left + MainBtnRect.Right - IconSize.cx) div 2;
IconPos.Y := (MainBtnRect.Top + MainBtnRect.Bottom - IconSize.cy) div 2;

Canvas.Brush.Color := SimbaTheme.ColorFrame;
Canvas.FillRect(ClientRect);
Canvas.FillRect(Rect(ClientRect.Left, ClientRect.Top, ClientRect.Right, ClientRect.Bottom - 1));

if State in [2, 3] then // down/hover
begin
Expand All @@ -1249,7 +1227,10 @@ procedure TSimbaForm.ToolBarPaintButton(Sender: TToolButton; State: integer);
ToolBar.Images.ResolutionForPPI[ToolBar.ImagesWidth, Font.PixelsPerInch, GetCanvasScaleFactor].Draw(Canvas, IconPos.X, IconPos.Y, ImageIndex, gdeDisabled);

if (Style = tbsButtonDrop) then
CanvasPaintTriangleDown(Canvas, SimbaTheme.ColorFont, DropDownRect.CenterPoint, 2);
if (IconSize.cx <= 20) then
CanvasPaintTriangleDown(Canvas, SimbaTheme.ColorFont, DropDownRect.CenterPoint, 1)
else
CanvasPaintTriangleDown(Canvas, SimbaTheme.ColorFont, DropDownRect.CenterPoint, 2);
end;
end;

Expand Down

0 comments on commit 9e2816e

Please sign in to comment.