From 61fdd5e01c706e39b3bd55b043a18f1812bbcc36 Mon Sep 17 00:00:00 2001 From: Martin Schlegel Date: Wed, 22 Mar 2023 10:54:07 +0100 Subject: [PATCH] Persist "simple" setting --- dtmain.pas | 7 +- uiAdapters.inc | 11 +- workspaceStateTransitions.graphml | 228 ++++++++++++++++++++++++++++++ workspaces.pas | 3 + 4 files changed, 236 insertions(+), 13 deletions(-) create mode 100644 workspaceStateTransitions.graphml diff --git a/dtmain.pas b/dtmain.pas index 11053d8..e14f18e 100644 --- a/dtmain.pas +++ b/dtmain.pas @@ -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; @@ -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; diff --git a/uiAdapters.inc b/uiAdapters.inc index 4268b1b..7ca658a 100644 --- a/uiAdapters.inc +++ b/uiAdapters.inc @@ -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; @@ -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); @@ -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; @@ -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; diff --git a/workspaceStateTransitions.graphml b/workspaceStateTransitions.graphml new file mode 100644 index 0000000..55aaf68 --- /dev/null +++ b/workspaceStateTransitions.graphml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + solving challenge + + + + + + + + + + + editing palette entry + + + + + + + + + + + editing challenge + + + + + + + + + + + editing new board + + + + + + + + + + + + + ignore +(is this even possible?) + + + + + + + + + + + + + ignore + + + + + + + + + + + + + push + + + + + + + + + + + + + push + + + + + + + + + + + push + + + + + + + + + + + push + + + + + + + + + + + clear + + + + + + + + + + + clear + + + + + + + + + + + push + + + + + + + + + + + clear + + + + + + + + + + + push + + + + + + + + + + + push + + + + + + + + + + + clear + + + + + + + + + + + push + + + + + + + + + diff --git a/workspaces.pas b/workspaces.pas index 67e7202..3036829 100644 --- a/workspaces.pas +++ b/workspaces.pas @@ -18,6 +18,7 @@ activeChallenge :P_challenge; public + simplisticUi:boolean; CONSTRUCTOR create; DESTRUCTOR destroy; FUNCTION getSerialVersion:dword; virtual; @@ -118,6 +119,7 @@ if tutorial.equals(activeChallenge) then restartChallenge; end else result:=false; + simplisticUi:=not(stream.allOkay) or stream.readBoolean; end; PROCEDURE T_workspace.saveToStream(VAR stream: T_bufferedOutputStreamWrapper); @@ -127,6 +129,7 @@ stream.writeLongint(activeChallengeIndex); workspacePalette^.saveToStream(stream); workspaceBoard^.saveToStream(stream,false); + stream.writeBoolean(simplisticUi); end; PROCEDURE T_workspace.restartChallenge;