Skip to content

Commit

Permalink
New setting to clear output on compile/run
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed May 9, 2022
1 parent dbb7d71 commit 5641618
Show file tree
Hide file tree
Showing 13 changed files with 227 additions and 205 deletions.
9 changes: 4 additions & 5 deletions Source/Simba.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<DebugInfoType Value="dsDwarf2Set"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
Expand Down Expand Up @@ -138,6 +139,7 @@
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<DebugInfoType Value="dsDwarf2Set"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
Expand Down Expand Up @@ -181,6 +183,7 @@
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<DebugInfoType Value="dsDwarf2Set"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
Expand Down Expand Up @@ -226,6 +229,7 @@
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<DebugInfoType Value="dsDwarf2Set"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
Expand Down Expand Up @@ -481,11 +485,6 @@
<RangeChecks Value="True"/>
</Checks>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True"/>
Expand Down
4 changes: 2 additions & 2 deletions Source/editor/simba.editor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ procedure TSimbaEditor.SimbaSettingChanged(Setting: TSimbaSetting);
Options := Options - [eoTrimTrailingSpaces, eoScrollPastEol];
end;

'GUI.MacOSKeystrokes':
'General.MacOSKeystrokes':
begin
if Setting.Value then
begin
Expand Down Expand Up @@ -315,7 +315,7 @@ constructor TSimbaEditor.Create(AOwner: TComponent; LoadColors: Boolean);
SimbaSettingChanged(SimbaSettings.Editor.AntiAliased);
SimbaSettingChanged(SimbaSettings.Editor.FontSize);
SimbaSettingChanged(SimbaSettings.Editor.FontName);
SimbaSettingChanged(SimbaSettings.GUI.MacOSKeystrokes);
SimbaSettingChanged(SimbaSettings.General.MacOSKeystrokes);

SimbaSettings.RegisterChangeHandler(@SimbaSettingChanged);
end;
Expand Down
4 changes: 2 additions & 2 deletions Source/forms/simba.colorpickerhistoryform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ procedure TSimbaColorPickerHistoryForm.FormCreate(Sender: TObject);

ColorListBox.Options := ColorListBox.Options - [lboDrawFocusRect];

Stream := TStringStream.Create(AnsiString(SimbaSettings.GUI.ColorPickerHistory.Value));
Stream := TStringStream.Create(AnsiString(SimbaSettings.General.ColorPickerHistory.Value));
while Stream.Read(Value, SizeOf(TColorHistoryValue)) = SizeOf(TColorHistoryValue) do
Add(Value.Point, Value.Color);
Stream.Free();
Expand All @@ -143,7 +143,7 @@ procedure TSimbaColorPickerHistoryForm.FormDestroy(Sender: TObject);
Stream.Write(Value, SizeOf(TColorHistoryValue));
end;

SimbaSettings.GUI.ColorPickerHistory.Value := Stream.DataString;
SimbaSettings.General.ColorPickerHistory.Value := Stream.DataString;

Stream.Free();
end;
Expand Down
93 changes: 50 additions & 43 deletions Source/forms/simba.main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ function TSimbaForm.CodeTools_OnFindLibrary(Sender: TObject; var FileName: Strin

procedure TSimbaForm.HandleFormCreated(Sender: TObject; Form: TCustomForm);
begin
if (SimbaSettings.GUI.CustomFontSize.Value > 0) then
Form.Font.Size := SimbaSettings.GUI.CustomFontSize.Value;
if (SimbaSettings.General.CustomFontSize.Value > 0) then
Form.Font.Size := SimbaSettings.General.CustomFontSize.Value;
end;

procedure TSimbaForm.CodeTools_OnLoadLibrary(Sender: TObject; FileName: String; var Contents: String);
Expand Down Expand Up @@ -598,12 +598,12 @@ procedure TSimbaForm.FormCreate(Sender: TObject);
Screen.AddHandlerFormAdded(@SimbaForm.HandleFormCreated, True);

FRecentFiles := TStringList.Create();
FRecentFiles.Text := SimbaSettings.GUI.RecentFiles.Value;
FRecentFiles.Text := SimbaSettings.General.RecentFiles.Value;

CreateBaseDirectories();

{$IFDEF WINDOWS}
if SimbaSettings.Environment.OpenSSLOnLaunch.Value then
if SimbaSettings.General.OpenSSLExtractOnLaunch.Value then
ExtractOpenSSL();
{$ENDIF}

Expand All @@ -616,14 +616,14 @@ procedure TSimbaForm.FormCreate(Sender: TObject);

SimbaSettings.RegisterChangeHandler(@SimbaSettingChanged);

SimbaSettingChanged(SimbaSettings.GUI.ToolbarSize);
SimbaSettingChanged(SimbaSettings.GUI.CustomFontSize);
SimbaSettingChanged(SimbaSettings.GUI.LockLayout);
SimbaSettingChanged(SimbaSettings.GUI.TrayIconVisible);
SimbaSettingChanged(SimbaSettings.GUI.ConsoleVisible);
SimbaSettingChanged(SimbaSettings.General.ToolbarSize);
SimbaSettingChanged(SimbaSettings.General.CustomFontSize);
SimbaSettingChanged(SimbaSettings.General.LockLayout);
SimbaSettingChanged(SimbaSettings.General.TrayIconVisible);
SimbaSettingChanged(SimbaSettings.General.ConsoleVisible);

if SimbaSettings.GUI.MacOSKeystrokes.Value then
SimbaSettingChanged(SimbaSettings.GUI.MacOSKeystrokes);
if SimbaSettings.General.MacOSKeystrokes.Value then
SimbaSettingChanged(SimbaSettings.General.MacOSKeystrokes);
end;

procedure TSimbaForm.FormDestroy(Sender: TObject);
Expand All @@ -633,7 +633,7 @@ procedure TSimbaForm.FormDestroy(Sender: TObject);

if (FRecentFiles <> nil) then
begin
SimbaSettings.GUI.RecentFiles.Value := FRecentFiles.Text;
SimbaSettings.General.RecentFiles.Value := FRecentFiles.Text;

FreeAndNil(FRecentFiles);
end;
Expand All @@ -651,29 +651,36 @@ procedure TSimbaForm.MenuItemACAClick(Sender: TObject);
end;

procedure TSimbaForm.MenuItemScriptStateClick(Sender: TObject);
type
EAction = (Unknown, Compile, Run, Debug, Pause, Stop);

function GetAction: EAction;
begin
if (Sender = MenuItemCompile) or (Sender = ToolbarButtonCompile) then Exit(Compile);
if (Sender = MenuItemRun) or (Sender = ToolbarButtonRun) then Exit(Run);
if (Sender = MenuItemPause) or (Sender = ToolbarButtonPause) then Exit(Pause);
if (Sender = MenuItemStop) or (Sender = StopButtonStop) then Exit(Stop);
if (Sender = MenuItemRunWithDebugging) then Exit(Debug);

DebugLn('[TSimbaForm.MenuItemScriptStateClick]: Unknown component "' + Sender.ClassName + '"');
end;

var
CurrentTab: TSimbaScriptTab;
begin
CurrentTab := SimbaScriptTabsForm.CurrentTab;

if (CurrentTab <> nil) then
try
with CurrentTab do
begin
if (Sender = MenuItemCompile) or (Sender = ToolbarButtonCompile) then
Compile()
else
if (Sender = MenuItemRun) or (Sender = ToolbarButtonRun) then
Run(FWindowSelection)
else
if (Sender = MenuItemRunWithDebugging) then
RunWithDebugging(FWindowSelection)
else
if (Sender = MenuItemPause) or (Sender = ToolbarButtonPause) then
Pause()
else
if (Sender = MenuItemStop) or (Sender = StopButtonStop) then
Stop()
if (GetAction() in [Compile, Run, Debug]) and SimbaSettings.General.OutputClearOnCompile.Value then
SimbaOutputForm.Clear();

case GetAction() of
Compile: CurrentTab.Compile();
Run: CurrentTab.Run(FWindowSelection);
Debug: CurrentTab.RunWithDebugging(FWindowSelection);
Pause: CurrentTab.Pause();
Stop: CurrentTab.Stop();
end;
except
on E: Exception do
Expand Down Expand Up @@ -721,17 +728,17 @@ procedure TSimbaForm.SizeComponents;

procedure TSimbaForm.SimbaSettingChanged(Setting: TSimbaSetting);
begin
if (Setting = SimbaSettings.GUI.ToolbarSize) then
if (Setting = SimbaSettings.General.ToolbarSize) then
SetToolbarSize(Setting.Value);
if (Setting = SimbaSettings.GUI.CustomFontSize) then
if (Setting = SimbaSettings.General.CustomFontSize) then
SetCustomFontSize(Setting.Value);
if (Setting = SimbaSettings.GUI.ConsoleVisible) then
if (Setting = SimbaSettings.General.ConsoleVisible) then
SetConsoleVisible(Setting.Value);
if (Setting = SimbaSettings.GUI.LockLayout) then
if (Setting = SimbaSettings.General.LockLayout) then
SetLayoutLocked(Setting.Value);
if (Setting = SimbaSettings.GUI.TrayIconVisible) then
if (Setting = SimbaSettings.General.TrayIconVisible) then
SetTrayIconVisible(Setting.Value);
if (Setting = SimbaSettings.GUI.MacOSKeystrokes) then
if (Setting = SimbaSettings.General.MacOSKeystrokes) then
SetMacOSKeystokes(Setting.Value);
end;

Expand Down Expand Up @@ -898,17 +905,17 @@ procedure TSimbaForm.MenuItemResetLayoutClick(Sender: TObject);

procedure TSimbaForm.MenuItemConsoleClick(Sender: TObject);
begin
SimbaSettings.GUI.ConsoleVisible.Value := TMenuItem(Sender).Checked;
SimbaSettings.General.ConsoleVisible.Value := TMenuItem(Sender).Checked;
end;

procedure TSimbaForm.MenuItemLockLayoutClick(Sender: TObject);
begin
SimbaSettings.GUI.LockLayout.Value := TMenuItem(Sender).Checked;
SimbaSettings.General.LockLayout.Value := TMenuItem(Sender).Checked;
end;

procedure TSimbaForm.MenuItemTrayIconClick(Sender: TObject);
begin
SimbaSettings.GUI.TrayIconVisible.Value := TMenuItem(Sender).Checked;
SimbaSettings.General.TrayIconVisible.Value := TMenuItem(Sender).Checked;
end;

procedure TSimbaForm.TimerTimer(Sender: TObject);
Expand Down Expand Up @@ -1021,11 +1028,11 @@ procedure TSimbaForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);

if FDockingReset then
begin
SimbaSettings.GUI.Layout.Value := '';
SimbaSettings.GUI.LockLayout.Value := False;
SimbaSettings.General.Layout.Value := '';
SimbaSettings.General.LockLayout.Value := False;
end else
if (WindowState <> wsMinimized) then
SimbaSettings.GUI.Layout.Value := DockMaster.SaveLayout();
SimbaSettings.General.Layout.Value := DockMaster.SaveLayout();


Visible := False;
Expand Down Expand Up @@ -1187,7 +1194,7 @@ procedure TSimbaForm.SetupDocking(Sender: TObject);
DockMaster.MakeDockable(SimbaDebugImageForm, MenuItemDebugImage);
DockMaster.MakeDockable(SimbaColorPickerHistoryForm, MenuItemColourHistory);

if (SimbaSettings.GUI.Layout.Value = '') then
if (SimbaSettings.General.Layout.Value = '') then
begin
DockMaster.GetAnchorSite(SimbaFileBrowserForm).Width := 175;
DockMaster.GetAnchorSite(SimbaFunctionListForm).Width := 175;
Expand All @@ -1206,14 +1213,14 @@ procedure TSimbaForm.SetupDocking(Sender: TObject);
Width := 1250;
Height := 850;
end else
DockMaster.LoadLayout(SimbaSettings.GUI.Layout.Value);
DockMaster.LoadLayout(SimbaSettings.General.Layout.Value);
finally
DockMaster.EndUpdate();

EndFormUpdate();
end;

if (SimbaSettings.GUI.Layout.Value = '') then
if (SimbaSettings.General.Layout.Value = '') then
begin
Position := poScreenCenter;

Expand Down
4 changes: 2 additions & 2 deletions Source/forms/simba.notesform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ implementation

procedure TSimbaNotesForm.FormDestroy(Sender: TObject);
begin
SimbaSettings.GUI.Notes.Value := Memo.Lines.Text;
SimbaSettings.General.Notes.Value := Memo.Lines.Text;
end;

procedure TSimbaNotesForm.FormCreate(Sender: TObject);
begin
Memo.Lines.Text := SimbaSettings.GUI.Notes.Value;
Memo.Lines.Text := SimbaSettings.General.Notes.Value;
end;

end.
Expand Down
13 changes: 12 additions & 1 deletion Source/forms/simba.outputform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ TSimbaOutputForm = class(TForm)

procedure SimbaSettingChanged(Setting: TSimbaSetting);
public
procedure Clear;

procedure Add(const S: String); overload;
procedure Add(const Strings: TStrings); overload;

function AddRaw(const Data: String): String;

constructor Create(AOwner: TComponent); override;
Expand Down Expand Up @@ -317,6 +318,16 @@ procedure TSimbaOutputForm.SimbaSettingChanged(Setting: TSimbaSetting);
end;
end;

procedure TSimbaOutputForm.Clear;
begin
FLock.Enter();
try
FStrings.Add(OUTPUT_CLEAR);
finally
FLock.Leave();
end;
end;

procedure TSimbaOutputForm.MenuItemCopyClick(Sender: TObject);
begin
Editor.CopyToClipboard();
Expand Down
41 changes: 19 additions & 22 deletions Source/forms/simba.settingsform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,25 @@ procedure TSimbaSettingsForm.FormShow(Sender: TObject);
EditorGeneralFrame.CompleteParenthesesCheckbox.Checked := SimbaSettings.Editor.AutomaticallyCompleteParentheses.Value;
EditorGeneralFrame.CompleteIndexCheckbox.Checked := SimbaSettings.Editor.AutomaticallyCompleteIndex.Value;

SimbaGeneralFrame.ToolbarSizeTrackBar.Position := SimbaSettings.GUI.ToolbarSize.Value;
SimbaGeneralFrame.ToolbarSizeTrackBar.Position := SimbaSettings.General.ToolbarSize.Value;
SimbaGeneralFrame.ToolbarSizeTrackBar.OnChange(nil);
SimbaGeneralFrame.FontSizeTrackBar.Position := SimbaSettings.GUI.CustomFontSize.Value;
SimbaGeneralFrame.FontSizeTrackBar.Position := SimbaSettings.General.CustomFontSize.Value;
SimbaGeneralFrame.FontSizeTrackBar.OnChange(nil);
SimbaGeneralFrame.ExtractOpenSSLCheckbox.Checked := SimbaSettings.Environment.OpenSSLOnLaunch.Value;
SimbaGeneralFrame.MacOSCommandKey.Checked := SimbaSettings.GUI.MacOSKeystrokes.Value;

SimbaGeneralFrame.CheckGroup1.Checked[0] := SimbaSettings.General.OutputClearOnCompile.Value;
SimbaGeneralFrame.CheckGroup1.Checked[1] := SimbaSettings.General.OpenSSLExtractOnLaunch.Value;
SimbaGeneralFrame.CheckGroup1.Checked[2] := SimbaSettings.General.MacOSKeystrokes.Value;

if (SimbaGeneralFrame.OutputFontName.Items.Count = 0) then
begin
SimbaGeneralFrame.OutputFontName.Items.AddStrings(EditorFontFrame.FontsNameComboBox.Items);
SimbaGeneralFrame.OutputFontName.ItemIndex := SimbaGeneralFrame.OutputFontName.Items.IndexOf(SimbaSettings.GUI.OutputFontName.Value);
SimbaGeneralFrame.OutputFontName.ItemIndex := SimbaGeneralFrame.OutputFontName.Items.IndexOf(SimbaSettings.General.OutputFontName.Value);
if (SimbaGeneralFrame.OutputFontName.ItemIndex < 0) then
SimbaGeneralFrame.OutputFontName.ItemIndex := 0;
end;

SimbaGeneralFrame.OutputFontSize.Value := SimbaSettings.GUI.OutputFontSize.Value;
SimbaGeneralFrame.OutputFontAntiAliased.Checked := SimbaSettings.GUI.OutputFontAntiAliased.Value;
SimbaGeneralFrame.OutputFontSize.Value := SimbaSettings.General.OutputFontSize.Value;
SimbaGeneralFrame.OutputFontAntiAliased.Checked := SimbaSettings.General.OutputFontAntiAliased.Value;
end;

procedure TSimbaSettingsForm.OKButtonClick(Sender: TObject);
Expand All @@ -112,21 +114,22 @@ procedure TSimbaSettingsForm.OKButtonClick(Sender: TObject);
SimbaSettings.Editor.AutomaticallyCompleteParentheses.Value := EditorGeneralFrame.CompleteParenthesesCheckbox.Checked;

if (SimbaGeneralFrame.ToolbarSizeTrackBar.Position = SimbaGeneralFrame.ToolbarSizeTrackBar.Min) then
SimbaSettings.GUI.ToolbarSize.Value := SimbaSettings.GUI.ToolbarSize.DefaultValue
SimbaSettings.General.ToolbarSize.Value := SimbaSettings.General.ToolbarSize.DefaultValue
else
SimbaSettings.GUI.ToolbarSize.Value := SimbaGeneralFrame.ToolbarSizeTrackBar.Position;
SimbaSettings.General.ToolbarSize.Value := SimbaGeneralFrame.ToolbarSizeTrackBar.Position;

if (SimbaGeneralFrame.FontSizeTrackBar.Position = SimbaGeneralFrame.FontSizeTrackBar.Min) then
SimbaSettings.GUI.CustomFontSize.Value := SimbaSettings.GUI.CustomFontSize.DefaultValue
SimbaSettings.General.CustomFontSize.Value := SimbaSettings.General.CustomFontSize.DefaultValue
else
SimbaSettings.GUI.CustomFontSize.Value := SimbaGeneralFrame.FontSizeTrackBar.Position;
SimbaSettings.General.CustomFontSize.Value := SimbaGeneralFrame.FontSizeTrackBar.Position;

SimbaSettings.Environment.OpenSSLOnLaunch.Value := SimbaGeneralFrame.ExtractOpenSSLCheckbox.Checked;
SimbaSettings.GUI.MacOSKeystrokes.Value := SimbaGeneralFrame.MacOSCommandKey.Checked;
SimbaSettings.General.OutputClearOnCompile.Value := SimbaGeneralFrame.CheckGroup1.Checked[0];
SimbaSettings.General.OpenSSLExtractOnLaunch.Value := SimbaGeneralFrame.CheckGroup1.Checked[1];
SimbaSettings.General.MacOSKeystrokes.Value := SimbaGeneralFrame.CheckGroup1.Checked[2];

SimbaSettings.GUI.OutputFontName.Value := SimbaGeneralFrame.OutputFontName.Text;
SimbaSettings.GUI.OutputFontSize.Value := SimbaGeneralFrame.OutputFontSize.Value;
SimbaSettings.GUI.OutputFontAntiAliased.Value := SimbaGeneralFrame.OutputFontAntiAliased.Checked;
SimbaSettings.General.OutputFontName.Value := SimbaGeneralFrame.OutputFontName.Text;
SimbaSettings.General.OutputFontSize.Value := SimbaGeneralFrame.OutputFontSize.Value;
SimbaSettings.General.OutputFontAntiAliased.Value := SimbaGeneralFrame.OutputFontAntiAliased.Checked;
end;

constructor TSimbaSettingsForm.Create(AOwner: TComponent);
Expand Down Expand Up @@ -158,12 +161,6 @@ constructor TSimbaSettingsForm.Create(AOwner: TComponent);
SimbaGeneralFrame := TSimbaGeneralFrame.Create(Self);
SimbaGeneralFrame.Parent := AddPage('General', Node);
SimbaGeneralFrame.Align := alClient;
{$IFNDEF DARWIN}
SimbaGeneralFrame.MacOSCommandKey.Visible := False;
{$ENDIF}
{$IFNDEF WINDOWS}
SimbaGeneralFrame.ExtractOpenSSLCheckbox.Visible := False;
{$ENDIF}

Node := TreeView.Items.Add(nil, 'Editor');

Expand Down
Loading

0 comments on commit 5641618

Please sign in to comment.