@@ -13,15 +13,15 @@ static Function IgorBeforeQuitHook(unsavedExp, unsavedNotebooks, unsavedProcedur
13
13
14
14
debugprint ( "called" )
15
15
16
- preparePanelClose ()
17
- markAsUnInitialized ()
16
+ BeforePanelClose ()
17
+ DoWindow / K CodeBrowser
18
+ AfterPanelClose ()
18
19
19
20
if ( unsavedExp || unsavedNotebooks || unsavedProcedures)
20
21
return 0
21
22
endif
22
23
23
24
expName = IgorInfo ( 1 )
24
-
25
25
if ( ! cmpstr ( expName, "Untitled" ))
26
26
return 0
27
27
endif
40
40
static Function IgorBeforeNewHook ( igorApplicationNameStr)
41
41
string igorApplicationNameStr
42
42
43
- preparePanelClose ()
43
+ debugPrint ( "called" )
44
+ BeforePanelClose ()
45
+
44
46
return 0
45
47
End
46
48
@@ -66,38 +68,52 @@ Function initializePanel()
66
68
setGlobalStr ( "search" , "" )
67
69
End
68
70
69
- // Prepare for panel closing, must be called before the panel is killed or the experiment closed
70
- Function preparePanelClose ()
71
-
71
+ // Prepare for panel closing.
72
+ //
73
+ // note: Must be called before the panel is killed or the experiment is closed.
74
+ Function BeforePanelClose ()
72
75
SetIgorHook / K AfterCompiledHook= updatePanel
73
- debugPrint ( "AfterCompiledHook: " + S_info)
76
+ if ( strlen ( S_info) > 0 )
77
+ debugPrint ( "registered hooks with hookType=AfterCompiledHook: " + S_info)
78
+ else
79
+ debugPrint ( "all hookType=AfterCompiledHook deleted" )
80
+ endif
81
+ End
82
+
83
+ // Clean up after closing panel
84
+ //
85
+ // note: Must be called after the panel was closed
86
+ Function AfterPanelClose ()
87
+ variable cleanOnExit
74
88
75
89
if ( ! existsPanel ())
76
90
return 0
77
91
endif
78
92
79
- // save panel coordinates to disk
80
- STRUCT CodeBrowserPrefs prefs
81
- FillPackagePrefsStruct ( prefs)
82
- SavePackagePrefsToDisk ( prefs)
83
-
84
- // reset global gui variables
85
- searchReset ()
86
-
87
- // delete CodeBrowser related data
88
- if ( prefs. configCleanOnExit)
89
- // storage data will not be saved in experiment
90
- saveResetStorage ()
91
- killGlobalVar ( "cleanOnExit" )
92
- killGlobalVar ( "debuggingEnabled" )
93
+ cleanOnExit = !! getGlobalVar ( "cleanOnExit" )
94
+ QuitPackagePrefs ()
95
+ if ( cleanOnExit)
96
+ KillStorage ()
97
+ KillPanelObjects ()
98
+ DeletePKGfolder ()
93
99
endif
94
100
End
95
101
96
- // if panel does not exist, delete panel-bound var/wave/dfr
97
- Function killPanelRelatedObjects ()
102
+ // Kill panel-bound variables and waves
103
+ //
104
+ // @see KillStorage
105
+ //
106
+ // note: if the waves and variables are still bound to a panel, this function
107
+ // will only reset them.
108
+ Function KillPanelObjects ()
98
109
Wave /T decl = getDeclWave ()
99
110
Wave /I line = getLineWave ()
100
111
112
+ // reset
113
+ setGlobalStr ( "search" , "" )
114
+ setGlobalVar ( "initialized" , 0 )
115
+
116
+ // kill
101
117
KillWaves / Z decl, line
102
118
killGlobalStr ( "search" )
103
119
killGlobalVar ( "initialized" )
@@ -117,9 +133,8 @@ Function panelHook(s)
117
133
markAsInitialized ()
118
134
break
119
135
case 2: // kill
120
- preparePanelClose ()
121
- killPanelRelatedObjects ()
122
- DeletePKGfolder ()
136
+ BeforePanelClose ()
137
+ AfterPanelClose ()
123
138
hookResult = 1
124
139
break
125
140
case 6: // resize
0 commit comments