From e7d20cf352688bf717a01f4e6d9e6f497c2bea4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 20 Sep 2025 19:19:34 +0200 Subject: New upstream version 5.3.1Beta2 --- app/bin/filenoteui.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'app/bin/filenoteui.c') diff --git a/app/bin/filenoteui.c b/app/bin/filenoteui.c index 9b1c2d5..3cef58f 100644 --- a/app/bin/filenoteui.c +++ b/app/bin/filenoteui.c @@ -29,6 +29,7 @@ #include "paths.h" #include "include/stringxtc.h" #include "track.h" +#include "cundo.h" #define MYMIN(x, y) (((x) < (y)) ? (x) : (y)) @@ -197,16 +198,6 @@ FileDlgUpdate( } -/** - * Handle Cancel button: restore old values for layer and position - */ - -static void -FileEditCancel( wWin_p junk) -{ - ResetIfNotSticky(); - wHide(fileNoteW); -} /** * Handle OK button: make sure the entered filename is syntactically valid, update * the layout and close the dialog @@ -221,13 +212,19 @@ FileEditOK(void *junk) if ( trk == NULL ) { // new file note trk = NewNote( -1, fileNoteData.pos, OP_NOTEFILE ); + } else { + if ( ! descUndoStarted ) { + UndoStart( _("Update File Note"), "Update File Note" ); + descUndoStarted = TRUE; + } + UndoModify( trk ); } struct extraDataNote_t * xx = GET_EXTRA_DATA( trk, T_NOTE, extraDataNote_t ); xx->pos = fileNoteData.pos; SetTrkLayer( trk, fileNoteData.layer ); - MyFree( xx->noteData.fileData.title ); + UndoDeferFree( xx->noteData.fileData.title ); + UndoDeferFree( xx->noteData.fileData.path ); xx->noteData.fileData.title = MyStrdup( fileNoteData.title ); - MyFree( xx->noteData.fileData.path ); xx->noteData.fileData.path = MyStrdup( fileNoteData.path ); SetBoundingBox( trk, xx->pos, xx->pos ); DrawNewTrack( trk ); @@ -251,7 +248,7 @@ static void CreateEditFileDialog(char * windowTitle) fileNoteW = ParamCreateDialog(&fileNotePG, "", _("Done"), FileEditOK, - FileEditCancel, TRUE, NULL, + ParamCancel_Current, TRUE, NULL, F_BLOCK, FileDlgUpdate); } @@ -262,6 +259,7 @@ static void CreateEditFileDialog(char * windowTitle) ParamLoadControls(&fileNotePG); wControlActive(fileNotePLs[I_OPEN].control, (IsFileValid(fileNoteData.path)?TRUE:FALSE)); + descTitle = windowTitle; wShow(fileNoteW); } -- cgit v1.2.3