|
3 | 3 | #pragma IgorVersion = 6.3.0
|
4 | 4 | #pragma IndependentModule=CodeBrowserModule
|
5 | 5 |
|
| 6 | +#include <Resize Controls> |
6 | 7 | // This file was created by () byte physics Thomas Braun, [email protected]
|
7 | 8 | // (c) 2013
|
8 | 9 |
|
9 |
| -static Constant popupLength = 240 |
| 10 | +Constant panelWidth = 278 |
| 11 | +Constant panelHeight = 170 |
| 12 | +Constant panelLeft = 50 |
| 13 | +Constant panelTop = 50 |
| 14 | +static Constant panelTopHeight= 90 |
| 15 | +static Constant panelBorder = 5 |
10 | 16 | static Constant moduleCtrlTop = 10
|
11 | 17 | static Constant procCtrlTop = 40
|
12 | 18 | static Constant SortCtrlTop = 70
|
13 |
| -static Constant border = 5 |
14 |
| -static Constant topSpaceList = 90 |
15 | 19 |
|
16 | 20 | static StrConstant panel = "CodeBrowser"
|
17 | 21 | static StrConstant moduleCtrl = "popupNamespace"
|
|
29 | 33 |
|
30 | 34 | // Creates the main panel
|
31 | 35 | Function createPanel()
|
| 36 | + STRUCT CodeBrowserPrefs prefs |
| 37 | + LoadPackagePrefsFromDisk(prefs) |
32 | 38 |
|
33 | 39 | DoWindow $panel
|
34 | 40 | if(V_flag != 0)
|
| 41 | + DebugPrint("Panel Exists") |
35 | 42 | DoWindow/F $panel
|
36 | 43 | return NaN
|
37 | 44 | endif
|
38 | 45 |
|
39 |
| - STRUCT CodeBrowserPrefs prefs |
40 |
| - LoadPackagePrefsFromDisk(prefs) |
| 46 | + // define position |
| 47 | + Variable panelLeft = 0, panelTop = 0 |
| 48 | + NewPanel/N=$panel /K=1/W=(panelLeft,panelTop,panelLeft+panelWidth,panelTop+panelHeight) // left,top,right,bottom |
| 49 | + String module = GetIndependentModuleName() |
41 | 50 |
|
42 |
| - variable left = prefs.panelCoords[0] |
43 |
| - variable top = prefs.panelCoords[1] |
44 |
| - variable right = prefs.panelCoords[2] |
45 |
| - variable bottom = prefs.panelCoords[3] |
| 51 | + PopupMenu $moduleCtrl, win=$panel,pos={panelBorder,moduleCtrlTop}, size={panelWidth-2*panelBorder,20}, bodywidth=200 |
| 52 | + PopupMenu $moduleCtrl, win=$panel,title="Namespace" |
| 53 | + PopupMenu $moduleCtrl, win=$panel,proc=$(module + "#popupModules"),value=#module + "#generateModuleList()" |
46 | 54 |
|
47 |
| - NewPanel/N=$panel /K=1/W=(left,top,right,bottom) |
| 55 | + PopupMenu $moduleCtrl, userdata(ResizeControlsInfo)= A"!!,@c!!#;-!!#B>J,hm&z!!#](Aon#azzzzzzzzzzzzzz!!#`-A7TLfzz" |
| 56 | + PopupMenu $moduleCtrl, userdata(ResizeControlsInfo) += A"zzzzzzzzzzzz!!#u:Du]k<zzzzzzzzzzz" |
| 57 | + PopupMenu $moduleCtrl, userdata(ResizeControlsInfo) += A"zzz!!#N3Bk1ct<C]S6zzzzzzzzzzzzz!!!" |
48 | 58 |
|
49 |
| - string module = GetIndependentModuleName() |
| 59 | + PopupMenu $procCtrl, win=$panel,pos={panelBorder,procCtrlTop}, size={panelWidth-2*panelBorder,20}, bodywidth=200 |
| 60 | + PopupMenu $procCtrl, win=$panel,title="Procedure" |
| 61 | + PopupMenu $procCtrl, win=$panel,proc=$(module + "#popupProcedures"),value=#module + "#generateProcedureList()" |
50 | 62 |
|
51 |
| - PopupMenu $moduleCtrl, win=$panel,pos={30,moduleCtrlTop}, size={popupLength,20}, bodywidth=200 |
52 |
| - PopupMenu $moduleCtrl, win=$panel,title="Namespace" |
53 |
| - PopupMenu $moduleCtrl, win=$panel,proc=$(module + "#popupModules"),value=#module + "#generateModuleList()" |
| 63 | + PopupMenu $procCtrl, userdata(ResizeControlsInfo)= A"!!,B9!!#>.!!#B:J,hm&z!!#](Aon#azzzzzzzzzzzzzz!!#`-A7TLfzz" |
| 64 | + PopupMenu $procCtrl, userdata(ResizeControlsInfo) += A"zzzzzzzzzzzz!!#u:Du]k<zzzzzzzzzzz" |
| 65 | + PopupMenu $procCtrl, userdata(ResizeControlsInfo) += A"zzz!!#N3Bk1ct<C]S6zzzzzzzzzzzzz!!!" |
| 66 | + |
| 67 | + DefineGuide/W=$panel UGH0={FT,panelTopHeight} |
| 68 | + DefineGuide/W=$panel UGH1={FB,panelBorder} |
54 | 69 |
|
55 |
| - PopupMenu $procCtrl, win=$panel,pos={30,procCtrlTop}, size={popupLength,20}, bodywidth=200 |
56 |
| - PopupMenu $procCtrl, win=$panel,title="Procedure" |
57 |
| - PopupMenu $procCtrl, win=$panel,proc=$(module + "#popupProcedures"),value=#module + "#generateProcedureList()" |
| 70 | + ListBox $listCtrl, win=$panel,pos={panelBorder,panelTopHeight + panelBorder}, size={panelWidth-2*panelBorder,panelHeight-panelTopHeight-2*panelBorder} |
| 71 | + ListBox $listCtrl, win=$panel,proc=$(module + "#ListBoxProc") |
| 72 | + ListBox $listCtrl, win=$panel,mode=5,selCol=1, widths={4,40}, keySelectCol=1 |
| 73 | + ListBox $listCtrl, win=$panel,listWave=getDeclWave() |
58 | 74 |
|
59 |
| - ListBox $listCtrl, win=$panel,pos={border,topSpaceList}, size={300,800} |
60 |
| - ListBox $listCtrl, win=$panel,proc=$(module + "#ListBoxProc") |
61 |
| - ListBox $listCtrl, win=$panel,mode=5,selCol=1, widths={4,40}, keySelectCol=1 |
62 |
| - ListBox $listCtrl, win=$panel,listWave=getDeclWave() |
| 75 | + ListBox $listCtrl, userdata(ResizeControlsInfo)= A"!!,?X!!#@\"!!#B@!!#?Ez!!#](Aon\"Qzzzzzzzzzzzzzz!!#o2B4uAezz" |
| 76 | + ListBox $listCtrl, userdata(ResizeControlsInfo) += A"zzzzzzzzzzzz!!#N3Bk1ct<C]S6zzzzzzzzzz" |
| 77 | + ListBox $listCtrl, userdata(ResizeControlsInfo) += A"zzz!!#N3Bk1ct<C]S7zzzzzzzzzzzzz!!!" |
63 | 78 |
|
64 |
| - CheckBox $sortCtrl, win=$panel, pos={30,SortCtrlTop},size={40,20},value=prefs.panelCheckboxSort |
| 79 | + CheckBox $sortCtrl, win=$panel, pos={panelBorder+70,SortCtrlTop},size={40,20},value=prefs.panelCheckboxSort |
65 | 80 | CheckBox $sortCtrl, win=$panel, title="sort"
|
66 | 81 | CheckBox $sortCtrl, win=$panel, proc=$(module + "#checkboxSort")
|
| 82 | + |
| 83 | + CheckBox $sortCtrl, userdata(ResizeControlsInfo)= A"!!,EP!!#?E!!#=o!!#<(z!!#`-A7TLfzzzzzzzzzzzzzz!!#o2B4uAezz" |
| 84 | + CheckBox $sortCtrl, userdata(ResizeControlsInfo) += A"zzzzzzzzzzzz!!#u:DuaGl<C]S6zzzzzzzzzz" |
| 85 | + CheckBox $sortCtrl, userdata(ResizeControlsInfo) += A"zzz!!#N3Bk1ct<C]S6zzzzzzzzzzzzz!!!" |
| 86 | + |
67 | 87 | SetWindow $panel, hook(mainHook)=$(module + "#panelHook")
|
68 |
| - DoUpdate/W=$panel |
69 | 88 |
|
| 89 | + SetWindow $panel, userdata(ResizeControlsInfo)= A"!!*'\"z!!#BE!!#A9zzzzzzzzzzzzzzzzzzzzz" |
| 90 | + SetWindow $panel, userdata(ResizeControlsInfo) += A"zzzzzzzzzzzzzzzzzzzzzzzzz" |
| 91 | + SetWindow $panel, userdata(ResizeControlsInfo) += A"zzzzzzzzzzzzzzzzzzz!!!" |
| 92 | + SetWindow $panel, userdata(ResizeControlsGuides)= "UGH0;UGH1;" |
| 93 | + SetWindow $panel, userdata(ResizeControlsInfoUGH0)= A":-hTC3`S[@0KW?-:-)m'A7]4jDg-86E][6':dmEFF(KAR85E,T>#.mm5tj<o4&A^O8Q88W:-(Bh/het@7o`,K756hm<'*TM8OQ!&3]g5.9MeM`8Q88W:-(Bh3r" |
| 94 | + SetWindow $panel, userdata(ResizeControlsInfoUGH1)= A":-hTC3`S[@0frH.:-)m'A7]4jDg-86E][6':dmEFF(KAR85E,T>#.mm5tj<o4&A^O8Q88W:-(*g0J5%54%E:B6q&gk7RB1,<CoSI1-.Kp78-NR;b9q[:JNr.3r" |
| 95 | + |
| 96 | + SetWindow $panel, userdata(oneTimeInit)= "1" |
| 97 | + |
| 98 | + resizeToPackagePrefs() |
| 99 | + DoUpdate/W=$panel |
70 | 100 | initializePanel()
|
71 |
| - resizePanel() |
| 101 | +End |
| 102 | + |
| 103 | +Function resizeToPackagePrefs() |
| 104 | + STRUCT CodeBrowserPrefs prefs |
| 105 | + LoadPackagePrefsFromDisk(prefs) |
| 106 | + |
| 107 | + Variable prefsLeft = prefs.panelCoords[0] |
| 108 | + Variable prefsTop = prefs.panelCoords[1] |
| 109 | + Variable prefsRight = prefs.panelCoords[2] |
| 110 | + Variable prefsBottom = prefs.panelCoords[3] |
| 111 | + |
| 112 | + DoWindow $panel |
| 113 | + if(V_flag == 0) |
| 114 | + createPanel() |
| 115 | + endif |
| 116 | + MoveWindow/W=$panel prefsLeft, prefsTop, prefsRight, prefsBottom |
72 | 117 | End
|
73 | 118 |
|
74 | 119 | // Callback for the modules popup
|
@@ -97,35 +142,6 @@ Function/S generateProcedureList()
|
97 | 142 | return niceList
|
98 | 143 | End
|
99 | 144 |
|
100 |
| -// Resize the panel controls |
101 |
| -Function resizePanel() |
102 |
| - |
103 |
| - DoWindow $panel |
104 |
| - if(V_flag == 0) |
105 |
| - return NaN |
106 |
| - endif |
107 |
| - |
108 |
| - variable width, height, left, listBoxWidth, listBoxHeight |
109 |
| - GetWindow $panel, wsizeDC |
110 |
| - width = V_right - V_left |
111 |
| - height = V_bottom - V_top |
112 |
| - |
113 |
| - listBoxWidth = width - 2*border |
114 |
| - listBoxHeight = height - border - topSpaceList |
115 |
| - |
116 |
| - if(listBoxHeight < 40) |
117 |
| - return NaN |
118 |
| - endif |
119 |
| - |
120 |
| - ListBox $listCtrl, win=$panel,size={listBoxWidth,listBoxHeight} |
121 |
| - |
122 |
| - ControlInfo/W=$panel $moduleCtrl |
123 |
| - left = (width - V_Width) / 2.0 |
124 |
| - PopupMenu $moduleCtrl, win=$panel,pos={left,moduleCtrlTop} |
125 |
| - PopupMenu $procCtrl, win=$panel,pos={left+8,procCtrlTop} |
126 |
| - CheckBox $sortCtrl, win=$panel,pos={left+66,SortCtrlTop} |
127 |
| -End |
128 |
| - |
129 | 145 | // Must be called after every change which might affect the panel contents
|
130 | 146 | // Installed as AfterCompiledHook
|
131 | 147 | Function updatePanel()
|
|
0 commit comments