Skip to content

Commit

Permalink
Persist "simple" setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mschlegel81 committed Mar 22, 2023
1 parent d9a0019 commit 61fdd5e
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 13 deletions.
7 changes: 3 additions & 4 deletions dtmain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,13 @@ TDigitaltrainerMainForm = class(TForm)
ioEdit,
@showPropertyEditor,
@repositionPropertyEditor,
@boardChanged,
@BeginFormUpdate,
@EndFormUpdate,
@Application.ProcessMessages);
@boardChanged);

workspace.create;
workspace.activePalette^.attachUI(@uiAdapter);
workspace.activeBoard ^.attachUI(@uiAdapter);
workspace.activeBoard ^.reset(true);
miSimpleUI.checked:=workspace.simplisticUi;
updateUiElements;

pauseByUser:=false;
Expand Down Expand Up @@ -384,6 +382,7 @@ TDigitaltrainerMainForm = class(TForm)
PROCEDURE TDigitaltrainerMainForm.miSimpleUIClick(Sender: TObject);
begin
miSimpleUI.checked:=not(miSimpleUI).checked;
workspace.simplisticUi:=miSimpleUI.checked;
if miSimpleUI.checked then begin
pauseByUser:=false;
speedTrackBar.position:=6;
Expand Down
11 changes: 2 additions & 9 deletions uiAdapters.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ T_uiAdapter=object
showPropertyEditorCallback:F_showPropertyEditorCallback;
repositionPropertyEditorCallback:F_repositionPropertyEditorCallback;
boardModifiedCallback:F_procedure;
BeginFormUpdate,EndFormUpdate:F_procedure;
paletteItemAt:F_gateHitInfo;
paintPalette:F_procedure;
ProcessMessages:F_procedure;
end;

zoom:longint;
Expand Down Expand Up @@ -75,8 +73,7 @@ T_uiAdapter=object
CONST ioEdit:TEdit;
CONST showPropertyEditorCallback:F_showPropertyEditorCallback;
CONST repositionPropertyEditorCallback:F_repositionPropertyEditorCallback;
CONST boardModifiedCallback:F_procedure;
CONST BeginFormUpdate,EndFormUpdate,ProcessMessages:F_procedure);
CONST boardModifiedCallback:F_procedure);
DESTRUCTOR destroy;

PROCEDURE propertyEditorShown(CONST gate:P_visualGate; CONST fromBoard:boolean);
Expand Down Expand Up @@ -131,8 +128,7 @@ CONSTRUCTOR T_uiAdapter.create(CONST selectionShape: TShape;
CONST ioEdit: TEdit;
CONST showPropertyEditorCallback: F_showPropertyEditorCallback;
CONST repositionPropertyEditorCallback:F_repositionPropertyEditorCallback;
CONST boardModifiedCallback: F_procedure;
CONST BeginFormUpdate, EndFormUpdate, ProcessMessages: F_procedure);
CONST boardModifiedCallback: F_procedure);
begin
uiElement.selectionShape :=selectionShape;
uiElement.boardImage :=boardImage;
Expand All @@ -146,9 +142,6 @@ CONSTRUCTOR T_uiAdapter.create(CONST selectionShape: TShape;
callback.showPropertyEditorCallback:=showPropertyEditorCallback;
callback.repositionPropertyEditorCallback:=repositionPropertyEditorCallback;
callback.boardModifiedCallback:=boardModifiedCallback;
callback.BeginFormUpdate:=BeginFormUpdate;
callback.EndFormUpdate:=EndFormUpdate;
callback.ProcessMessages:=ProcessMessages;
uiElement.boardImage.OnMouseWheel:=@boardImageMouseWheel;
zoom:=30;
state:=uas_initial;
Expand Down
Loading

0 comments on commit 61fdd5e

Please sign in to comment.