Skip to content

Commit 68d5b18

Browse files
author
Matthias Kastner
committed
config: Optional clean on exit
saving the parsing result for Procedures inside an igor pxp file is not recommended but feasable from time.
1 parent bc93136 commit 68d5b18

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

procedures/CodeBrowser.ipf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,6 @@ End
890890

891891
Function searchReset()
892892
setGlobalStr("search","")
893-
killGlobalStr("search")
894893
End
895894

896895
Function DeletePKGfolder()

procedures/CodeBrowser_hooks.ipf

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ Function preparePanelClose()
7070
SetIgorHook/K AfterCompiledHook=updatePanel
7171
debugPrint("AfterCompiledHook: " + S_info)
7272

73-
// storage data should not be saved in experiment
74-
saveResetStorage()
75-
7673
DoWindow $GetPanel()
7774
if(V_flag == 0)
7875
return 0
@@ -82,12 +79,19 @@ Function preparePanelClose()
8279
STRUCT CodeBrowserPrefs prefs
8380
FillPackagePrefsStruct(prefs)
8481
SavePackagePrefsToDisk(prefs)
85-
82+
8683
// reset global gui variables
8784
searchReset()
8885

89-
// clean Package DataFolder
90-
DeletePKGfolder()
86+
// delete CodeBrowser related data
87+
if(prefs.configCleanOnExit)
88+
// storage data will not be saved in experiment
89+
saveResetStorage()
90+
killGlobalStr("search")
91+
killGlobalVar("cleanOnExit")
92+
// clean Package DataFolder
93+
DeletePKGfolder()
94+
endif
9195
End
9296

9397
Function panelHook(s)

procedures/CodeBrowser_preferences.ipf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// This file was created by () byte physics Thomas Braun, [email protected]
77
// (c) 2013
88

9-
static Constant kPrefsVersion = 105
9+
static Constant kPrefsVersion = 106
1010
static StrConstant kPackageName = "CodeBrowser"
1111
static StrConstant kPrefsFileName = "CodeBrowser.bin"
1212
static Constant kPrefsRecordID = 0
@@ -19,7 +19,8 @@ Structure CodeBrowserPrefs
1919
uint32 panelProcedure // last marked procedure in panel
2020
uint32 panelElement // last marked element in panel
2121
uint32 panelTopElement // top element in listbox (scrolling)
22-
uint32 reserved[95] // Reserved for future use
22+
uint32 configCleanOnExit // delete CodeBrowser related data when CodeBrowser exits
23+
uint32 reserved[94] // Reserved for future use
2324
EndStructure
2425

2526
// DefaultPackagePrefsStruct(prefs)
@@ -47,16 +48,18 @@ static Function DefaultPackagePrefsStruct(prefs)
4748
prefs.panelElement = 0
4849
prefs.panelTopElement= 0
4950

51+
prefs.configCleanOnExit = 1
52+
5053
Variable i
51-
for(i=0; i<95; i+=1)
54+
for(i=0; i<94; i+=1)
5255
prefs.reserved[i] = 0
5356
endfor
5457
End
5558

5659
// Fill package prefs structures to match state of panel.
5760
static Function SyncPackagePrefsStruct(prefs)
5861
STRUCT CodeBrowserPrefs &prefs
59-
Variable scale, selectedItem
62+
Variable scale, selectedItem, configItem
6063
// Panel does exists. Set prefs to match panel settings.
6164
prefs.version = kPrefsVersion
6265

@@ -85,6 +88,9 @@ static Function SyncPackagePrefsStruct(prefs)
8588

8689
selectedItem = getCurrentItemAsNumeric(indexTop = 1)
8790
prefs.panelTopElement = selectedItem < 0 ? 0 : selectedItem
91+
92+
configItem = getGlobalVar("cleanOnExit")
93+
prefs.configCleanOnExit = configItem < 0 ? 1 : configItem
8894
End
8995

9096
// InitPackagePrefsStruct(prefs)
@@ -125,6 +131,7 @@ Function LoadPackagePrefsFromDisk(prefs)
125131
prefs.panelCoords[2] /= scale
126132
prefs.panelCoords[3] /= scale
127133

134+
setGlobalVar("cleanOnExit", prefs.configCleanOnExit)
128135
End
129136

130137
Function SavePackagePrefsToDisk(prefs)

0 commit comments

Comments
 (0)