Skip to content

Commit 5833720

Browse files
Matthias Kastnert-b
authored andcommitted
panel state
also top row visible is beeing saved for readability reasons
1 parent 6a3c55d commit 5833720

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

procedures/CodeBrowser_gui.ipf

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Function createPanel()
7575
ListBox $listCtrl, win=$panel,proc=$(module + "#ListBoxProc")
7676
ListBox $listCtrl, win=$panel,mode=5,selCol=1, widths={4,40}, keySelectCol=1
7777
ListBox $listCtrl, win=$panel,listWave=getDeclWave()
78-
ListBox $listCtrl, win=$panel, selRow=prefs.panelElement, row=prefs.panelElement
78+
ListBox $listCtrl, win=$panel, selRow=prefs.panelElement, row=prefs.panelTopElement
7979

8080
ListBox $listCtrl, userdata(ResizeControlsInfo)= A"!!,?X!!#@\"!!#BNJ,hopz!!#](Aon\"Qzzzzzzzzzzzzzz!!#o2B4uAezz"
8181
ListBox $listCtrl, userdata(ResizeControlsInfo) += A"zzzzzzzzzzzz!!#N3Bk1ct<C]S6zzzzzzzzzz"
@@ -270,29 +270,33 @@ End
270270
// module: return selected NameSpace
271271
// procedure: return selected procedure
272272
// index: return selected index in listbox
273-
Function getCurrentItemAsNumeric([module, procedure, index])
274-
variable module, procedure, index
273+
Function getCurrentItemAsNumeric([module, procedure, index, indexTop])
274+
variable module, procedure, index, indexTop
275275

276276
string procName
277277

278278
module = ParamIsDefault(module) ? 0 : 1
279279
procedure = ParamIsDefault(procedure) ? 0 : 1
280280
index = ParamIsDefault(index) ? 0 : 1
281+
indexTop = ParamIsDefault(indexTop) ? 0 : 1
281282

282283
// only one optional argument allowed
283-
if(module + procedure + index != 1)
284+
if(module + procedure + index + indexTop != 1)
284285
return -1 // error
285286
endif
286287

287288
if(module)
288289
ControlInfo/W=$panel $moduleCtrl
289290
elseif(procedure)
290291
ControlInfo/W=$panel $procCtrl
291-
elseif(index)
292+
elseif(index || indexTop)
292293
ControlInfo/W=$panel $listCtrl
293294
endif
294295

295296
if(V_Value >= 0)
297+
if (indexTop)
298+
return V_startRow
299+
endif
296300
return V_Value
297301
endif
298302

procedures/CodeBrowser_preferences.ipf

Lines changed: 8 additions & 3 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 = 104
9+
static Constant kPrefsVersion = 105
1010
static StrConstant kPackageName = "CodeBrowser"
1111
static StrConstant kPrefsFileName = "CodeBrowser.bin"
1212
static Constant kPrefsRecordID = 0
@@ -18,7 +18,8 @@ Structure CodeBrowserPrefs
1818
uint32 panelNameSpace // last marked namespace in panel
1919
uint32 panelProcedure // last marked procedure in panel
2020
uint32 panelElement // last marked element in panel
21-
uint32 reserved[96] // Reserved for future use
21+
uint32 panelTopElement // top element in listbox (scrolling)
22+
uint32 reserved[95] // Reserved for future use
2223
EndStructure
2324

2425
// DefaultPackagePrefsStruct(prefs)
@@ -44,9 +45,10 @@ static Function DefaultPackagePrefsStruct(prefs)
4445
prefs.panelNameSpace = 1
4546
prefs.panelProcedure = 1
4647
prefs.panelElement = 0
48+
prefs.panelTopElement= 0
4749

4850
Variable i
49-
for(i=0; i<96; i+=1)
51+
for(i=0; i<95; i+=1)
5052
prefs.reserved[i] = 0
5153
endfor
5254
End
@@ -80,6 +82,9 @@ static Function SyncPackagePrefsStruct(prefs)
8082

8183
selectedItem = getCurrentItemAsNumeric(index = 1)
8284
prefs.panelElement = selectedItem < 0 ? 0 : selectedItem
85+
86+
selectedItem = getCurrentItemAsNumeric(indexTop = 1)
87+
prefs.panelTopElement = selectedItem < 0 ? 0 : selectedItem
8388
End
8489

8590
// InitPackagePrefsStruct(prefs)

0 commit comments

Comments
 (0)