Skip to content

Commit 6ee4532

Browse files
author
Matthias Kastner
committed
add all Modules
add an entry to the list of modules to load all procedure files, regardless of module.
1 parent 1fefaa6 commit 6ee4532

File tree

2 files changed

+71
-16
lines changed

2 files changed

+71
-16
lines changed

procedures/CodeBrowser.ipf

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -892,11 +892,10 @@ Function KillStorage()
892892
killGlobalvar("parsingTime")
893893
End
894894

895-
// Returns a list with the following optional suffixes removed:
896-
// -Module " [.*]"
897-
// -Ending ".ipf"
898-
// -Both ".ipf [.*]"
899-
Function/S nicifyProcedureList(list)
895+
/// @brief Return a list of procedures with the module suffix " [.*]" removed
896+
//
897+
/// @see ProcedureListRemoveEnding
898+
Function/S ProcedureListRemoveModule(list)
900899
string list
901900

902901
variable i, idx
@@ -905,6 +904,23 @@ Function/S nicifyProcedureList(list)
905904
for(i = 0; i < ItemsInList(list); i += 1)
906905
item = StringFromList(i, list)
907906
item = RemoveEverythingAfter(item, " [")
907+
niceList = AddListItem(item, niceList, ";", inf)
908+
endfor
909+
910+
return niceList
911+
End
912+
913+
/// @brief Return a list of procedures with the ending ".ipf" removed
914+
//
915+
/// @see ProcedureListRemoveModule
916+
Function/S ProcedureListRemoveEnding(list)
917+
string list
918+
919+
variable i, idx
920+
string item, niceList=""
921+
922+
for(i = 0; i < ItemsInList(list); i += 1)
923+
item = StringFromList(i, list)
908924
item = RemoveEverythingAfter(item, ".ipf")
909925
niceList = AddListItem(item, niceList, ";", inf)
910926
endfor
@@ -1189,15 +1205,32 @@ static Function/Wave getSaveVariables()
11891205
return wv
11901206
End
11911207

1192-
// Returns a list of all procedure files of the given independent module/ProcGlobal
1193-
Function/S getProcList(module)
1194-
String module
1208+
// Get a list of all procedure files of the given independent module/ProcGlobal
1209+
//
1210+
// @param module Independent Module or ProcGlobal Namespace
1211+
// @param addModule [optional, default 0] add the module to the list
1212+
// Module is added as Module#Procedure in a way similar to Module#Function()
1213+
Function/S getProcList(module, [addModule])
1214+
string module
1215+
variable addModule
1216+
1217+
string procedures
1218+
1219+
addModule = ParamIsDefault(addModule) ? 0 : !!addModule
11951220

1196-
if( isProcGlobal(module) )
1197-
return getGlobalProcWindows()
1221+
if(isProcGlobal(module))
1222+
module = "ProcGlobal"
1223+
procedures = getGlobalProcWindows()
11981224
else
1199-
return getIMProcWindows(module)
1225+
procedures = getIMProcWindows(module)
1226+
endif
1227+
1228+
if(addModule)
1229+
procedures = ProcedureListRemoveEnding(procedures)
1230+
module = module + "#"
1231+
procedures = AddToItemsInList(procedures, prefix=module)
12001232
endif
1233+
return procedures
12011234
End
12021235

12031236
static Function getParsingTime()

procedures/CodeBrowser_gui.ipf

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ static StrConstant userDataNiceList = "niceList"
2828

2929
static StrConstant oneTimeInitUserData = "oneTimeInit"
3030

31+
static StrConstant selectAll = "<ALL>"
32+
3133
Function/S GetPanel()
3234
return panel
3335
End
@@ -135,6 +137,7 @@ Function/S generateModuleList()
135137
debugPrint("called")
136138

137139
string niceList = getModuleList()
140+
niceList = AddListItem(selectAll, niceList)
138141

139142
PopupMenu $moduleCtrl, win=$panel, userData($userDataNiceList)=niceList
140143

@@ -144,11 +147,30 @@ End
144147
// Callback for the procedure popup, returns a nicified list
145148
// Stores both the nicified list and the raw list as user data
146149
Function/S generateProcedureList()
147-
debugPrint("called")
148-
149-
string module = getCurrentItem(module=1)
150-
string procList = getProcList(module)
151-
string niceList = nicifyProcedureList(procList)
150+
string module, modules, procList, niceList
151+
variable numModules, i
152+
153+
module = getCurrentItem(module = 1)
154+
if(!cmpstr(module, selectAll))
155+
procList = ""
156+
niceList = ""
157+
modules = getModuleList()
158+
numModules = ItemsInList(modules)
159+
for(i = 0; i < numModules; i += 1)
160+
module = StringFromList(i, modules)
161+
procList += getProcList(module)
162+
if(isProcGlobal(module))
163+
niceList += getProcList(module)
164+
else
165+
niceList += getProcList(module, addModule = 1)
166+
endif
167+
endfor
168+
else
169+
procList = getProcList(module)
170+
niceList = procList
171+
endif
172+
niceList = ProcedureListRemoveModule(niceList)
173+
niceList = ProcedureListRemoveEnding(niceList)
152174

153175
PopupMenu $procCtrl, win=$panel, userData($userDataRawList)=procList, userData($userDataNiceList)=niceList
154176

0 commit comments

Comments
 (0)