-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI_Graph_Panel_Color.ipf
5648 lines (5374 loc) · 256 KB
/
GUI_Graph_Panel_Color.ipf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma TextEncoding = "UTF-8"
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
menu "Graph"
"GraphControl",/q, GraphControlInit()
end
menu "Layout"
"LayoutControl",/q, LayoutControlInit()
end
menu "AllTracesPopup"
"GraphControl",/q,GraphControlInit()
end
menu "TracePopup"
"GraphControl",/q,GraphControlInit()
end
macro GraphControlMacro()
GraphControlInit()
end
macro LayoutControlMacro()
LayoutControlInit()
end
//---------------Layout control----------------
//---------------Layout control----------------
//---------------Layout control----------------
function LayoutControlInit()
execute "LayoutControl() "
end
Window LayoutControl() : Panel
NewPanel /W=(36,60,365,400)/k=1
SetVariable Left_LC,pos={10.00,22.00},size={80.00,18.00},proc=Left_Right_LC,title="Left"
SetVariable Left_LC,value= _NUM:125
SetVariable Top_LC,pos={10.00,42.00},size={80.00,18.00},proc=Left_Right_LC,title="Top"
SetVariable Top_LC,value= _NUM:10
Button SetFrame_LC,pos={275.00,63.00},size={40.00,24.00},proc=SetFrame_LC,title="frame"
Button SetFrame_LC,labelBack=(65535,65535,65535),fColor=(65535,65535,65535)
Button SetFrame_LC,valueColor=(34952,34952,34952)
Button MoveLeft_LC,pos={190.00,96.00},size={30.00,30.00},proc=MoveGraphs,title="\\W546"
Button MoveLeft_LC,fSize=9
Button MoveRight_LC,pos={270.00,96.00},size={30.00,30.00},proc=MoveGraphs,title="\\W549"
Button MoveRight_LC,fSize=9
Button MoveTop_LC,pos={230.00,66.00},size={30.00,30.00},proc=MoveGraphs,title="\\W517"
Button MoveTop_LC,fSize=9
Button MoveBottom_LC,pos={230.00,126.00},size={30.00,30.00},proc=MoveGraphs,title="\\W523"
Button MoveBottom_LC,fSize=9
GroupBox LayoutGB_LC,pos={100.00,6.00},size={65.00,60.00},title="position "
SetVariable PLOT_TOP,pos={38.00,89.00},size={70.00,18.00},proc=LC_PLOTSIZE,title="Top"
SetVariable PLOT_TOP,valueBackColor=(56576,56576,56576)
SetVariable PLOT_TOP,limits={-1,1000,10},value= _NUM:0
SetVariable PLOT_BOTTOM,pos={18.00,131.00},size={90.00,18.00},proc=LC_PLOTSIZE,title="Bottom"
SetVariable PLOT_BOTTOM,valueBackColor=(56576,56576,56576)
SetVariable PLOT_BOTTOM,limits={-1,1000,10},value= _NUM:0
SetVariable PLOT_LEFT,pos={9.00,110.00},size={45.00,18.00},proc=LC_PLOTSIZE
SetVariable PLOT_LEFT,valueBackColor=(56576,56576,56576)
SetVariable PLOT_LEFT,limits={-1,1000,10},value= _NUM:0
SetVariable PLOT_Right,pos={106.00,110.00},size={45.00,18.00},proc=LC_PLOTSIZE
SetVariable PLOT_Right,valueBackColor=(56576,56576,56576)
SetVariable PLOT_Right,limits={-1,1000,10},value= _NUM:0
TitleBox PLOT_LEFTtitle,pos={9.00,96.00},size={20.00,15.00},title="Left",frame=0
TitleBox PLOT_RIGHTtitle,pos={120.00,96.00},size={28.00,15.00},title="Right"
TitleBox PLOT_RIGHTtitle,frame=0
SetVariable PLOT_SIZEW,pos={170.00,22.00},size={95.00,18.00},proc=LC_PLOTSIZE,title="Width"
SetVariable PLOT_SIZEW,limits={-1,1000,10},value= _NUM:0
SetVariable PLOT_SIZEH,pos={170.00,42.00},size={95.00,18.00},proc=LC_PLOTSIZE,title="Height"
SetVariable PLOT_SIZEH,limits={-1,1000,10},value= _NUM:0
GroupBox PLOT_GBmargins,pos={2.00,70.00},size={163.00,88.00},title="Plot Area"
GroupBox PLOT_GBmargins,fSize=12
TitleBox LT_LC,pos={104.00,24.00},size={47.00,15.00},title="(100,100)"
TitleBox LT_LC,labelBack=(65535,65535,65535),fSize=12,frame=0
TitleBox RB_LC,pos={166.00,64.00},size={47.00,15.00},title="(100,100)"
TitleBox RB_LC,labelBack=(65535,65535,65535),fSize=12,frame=0
SetVariable MOVE_NUM,pos={223.00,102.00},size={45.00,18.00},title=" "
SetVariable MOVE_NUM,valueBackColor=(56576,56576,56576)
SetVariable MOVE_NUM,limits={1,1000,1},value= _NUM:5
Button AlignLeft_LC,pos={190.00,162.00},size={60.00,24.00},proc=AlignGraphs,title="\\Z12align\\Z09\\W546"
Button AlignLeft_LC,fSize=9
Button AlignTop_LC1,pos={255.00,162.00},size={60.00,24.00},proc=AlignGraphs,title="\\Z12align\\Z09\\W517"
Button AlignTop_LC1,fSize=9
Button BringFront_LC,pos={275.00,17.00},size={40.00,24.00},proc=BringFront,title="front"
Button BringFront_LC,labelBack=(65535,65535,65535),fColor=(65535,65535,65535)
Button PLOT_Layout,pos={275.00,40.00},size={40.00,24.00},proc=GraphControlLayout,title="Layout"
Button PLOT_Layout,fSize=10,fColor=(61166,61166,61166)
Button SetGrid_LC,pos={105.00,162.00},size={60.00,24.00},proc=SetGrid,title="set grid"
Button SetGrid_LC,labelBack=(65535,65535,65535),fColor=(65535,65535,65535)
SetVariable Grid_LC,pos={3.00,164.00},size={100.00,18.00},proc=LC_PLOTSIZE,title="grid size"
SetVariable Grid_LC,limits={0,100,1},value= _NUM:5
Button LCcopy,pos={102.00,41.00},size={40.00,22.00},proc=copy_LC,title="copy"
Button LCcopy,labelBack=(65535,65535,65535),fColor=(65535,65535,65535)
Button LC_showG_on_L,pos={28.00,228.00},size={40.00,22.00},proc=LC_G_on_L,title="show"
Button LC_showG_on_L,labelBack=(65535,65535,65535),fColor=(65535,65535,65535)
TitleBox LC_G_on_L,pos={10.00,210.00},size={101.00,15.00},title="Graphs: on Layouts"
TitleBox LC_G_on_L,fSize=12,frame=0
Button LC_hideG_on_L1,pos={68.00,228.00},size={40.00,22.00},proc=LC_G_on_L,title="hide"
Button LC_hideG_on_L1,labelBack=(65535,65535,65535),fColor=(65535,65535,65535)
TitleBox LC_G_noton_L,pos={130.00,210.00},size={79.00,15.00},title="not on Layouts"
TitleBox LC_G_noton_L,fSize=12,frame=0
Button LC_shG_not_on_L,pos={128.00,228.00},size={40.00,22.00},proc=LC_G_on_L,title="show"
Button LC_shG_not_on_L,labelBack=(65535,65535,65535)
Button LC_shG_not_on_L,fColor=(65535,65535,65535)
Button LC_hiG_not_on_L2,pos={168.00,228.00},size={40.00,22.00},proc=LC_G_on_L,title="hide"
Button LC_hiG_not_on_L2,labelBack=(65535,65535,65535)
Button LC_hiG_not_on_L2,fColor=(65535,65535,65535)
Button LC_killG_not_on_L2,pos={208.00,228.00},size={40.00,22.00},proc=LC_G_on_L,title="kill"
Button LC_killG_not_on_L2,labelBack=(65535,65535,65535)
Button LC_killG_not_on_L2,fColor=(65535,65535,65535)
Button LC_showEditFromDF,pos={28.00,258.00},size={72.00,22.00},proc=LC_EditfromDF,title="Edit waves"
Button LC_showEditFromDF,labelBack=(65535,65535,65535)
Button LC_showEditFromDF,fColor=(65535,65535,65535)
GroupBox Manage_Windows,pos={2.00,190.00},size={320.00,147.00},title="Manage Windows"
GroupBox Manage_Windows,fSize=12
TitleBox LC_DF,pos={100.00,253.00},size={85.00,15.00},title="datafolder: root:"
TitleBox LC_DF,fSize=12,frame=0
TitleBox LC_DF_MEM,pos={100.00,267.00},size={84.00,15.00},title="memory: 17 Mb"
TitleBox LC_DF_MEM,fSize=12,frame=0
Button LC_showPlotsFromDF,pos={28.00,285.00},size={180.00,22.00},proc=LC_plotsfromDF,title="Graphs from selected datafolder"
Button LC_showPlotsFromDF,labelBack=(65535,65535,65535)
Button LC_showPlotsFromDF,fColor=(65535,65535,65535)
CheckBox LC_subDF,pos={212.00,289.00},size={104.00,15.00},title="check subfolders"
CheckBox LC_subDF,value= 1
CheckBox LC_delete_graphs,pos={212.00,312.00},size={86.00,15.00},title="delete graphs"
CheckBox LC_delete_graphs,value= 1
Button LC_Kill_DF,pos={28.00,308.00},size={180.00,22.00},proc=LC_deleteDF_plots,title="Delete datafolder"
Button LC_Kill_DF,labelBack=(65535,65535,65535),fColor=(65535,65535,65535)
SetWindow kwTopWin,hook(newLayoutControl)=LayoutControlPanelHook
EndMacro
//---events that happen when layout control panel is activated or resized
function LayoutControlPanelHook(s)
STRUCT WMWinHookStruct &s
if ((s.eventcode==0)) //---activate
if(strlen(winname(0,4))>0)
SetWindow $winname(0,4) hook(newLayoutControl)=LayoutControlHook
endif
//---current datafolder
TitleBox LC_DF title="datafolder: "+getdatafolder(1),win=LayoutControl
variable memory=round(FindSubFolderSize_LC(getdatafolder(1)))
if(memory<1000)
TitleBox LC_DF_MEM title="memory: "+num2str(memory)+" Kb",win=LayoutControl
else
TitleBox LC_DF_MEM title="memory: "+num2str(round(memory/(2^10)))+" Mb",win=LayoutControl
endif
endif
end
//---the layout is now linked to layoutcontrol panel
function LayoutControlHook(s)
STRUCT WMWinHookStruct &s
dowindow LayoutControl
if (v_flag)
if ((s.eventcode==5)||(s.eventcode==11))
execute /p /q "Measure_LC(\"\")"
endif
endif
End
//---set the position of active graphs
Function Left_Right_LC(ctrlName,varNum,varStr,varName) : SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
if(strlen(winname(0,4))>0)
string info=layoutinfo("","layout")
string selected=stringbykey("SELECTED",info,":")
variable i
for(i=0;i<itemsinlist(selected,",");i+=1)
if(stringmatch("left_LC",ctrlName))
ModifyLayout left($stringfromlist(i,selected,","))=varNum
else
ModifyLayout top($stringfromlist(i,selected,","))=varNum
endif
endfor
dowindow /F $winname(0,4)
dowindow /F LayoutControl
endif
End
//---copy pos info to LC
Function copy_LC(ctrlName) : ButtonControl
String ctrlName
controlinfo/w=layoutcontrol LT_LC
variable startpos=strsearch(S_recreation,"(",0),endpos=strsearch(S_recreation,")",0)
if(endpos-startpos>3)
SetVariable Left_LC win=layoutcontrol,value= _NUM:str2num(S_recreation[startpos+1,strsearch(S_recreation,",",startpos)-1])
SetVariable Top_LC win=layoutcontrol,value= _NUM:str2num(S_recreation[strsearch(S_recreation,",",startpos)+1,endpos-1])
endif
End
//---alight text to grid
Function SetGrid(ctrlName) : ButtonControl
String ctrlName
string S_recreation=""
drawaction /w=$winname(0,4) commands
if(strlen(S_recreation)>0)
string items=S_recreation,item,text,command
drawaction /w=$winname(0,4) delete
variable line,locx,locy,locR,locB
controlinfo/w=layoutcontrol Grid_LC
variable gridsize=v_value
dowindow/f $winname(0,4)
for(line=0;line<itemsinlist(items);line+=1)
item=stringfromlist(line,items)
if (stringmatch(item,"*item*")==0)
command=""
if (stringmatch(item,"*DrawRect*"))
command="DrawRect"
endif
if (stringmatch(item,"*DrawLine*"))
command="DrawLine"
endif
if (stringmatch(item,"*DrawRRect*"))
command="DrawRRect"
endif
if (stringmatch(item,"*DrawOval*"))
command="DrawOval"
endif
if (stringmatch(item,"*DrawText*"))
sscanf item, " DrawText %f,%f,%s ", locx,locy,text
text=item[strsearch(item,",",strlen(item),1)+1,strlen(item)-1]
locx=round(locx/gridsize)*gridsize
locy=round(locy/gridsize)*gridsize
sprintf item, "DrawText/w=%s %g,%g,%s",winname(0,4), locx,locy,text
endif
if (strlen(command)>0)
sscanf item, " "+command+" %f,%f,%f,%f", locx,locy,locR,locB
locx=round(locx/gridsize)*gridsize
locy=round(locy/gridsize)*gridsize
locR=round(locR/gridsize)*gridsize
locB=round(locB/gridsize)*gridsize
sprintf item, command+"/w=%s %g,%g,%g,%g",winname(0,4), locx,locy,locR,locB
endif
if (stringmatch(item,"*SetDrawEnv*"))
item=replacestring("SetDrawEnv",item,"SetDrawEnv/w="+winname(0,4))//+",save, ")
endif
item=replacestring("//",item,"")
item=replacestring("\r",item,"")
execute/p/q item
endif
endfor
endif
End
//---measure the location of active graphs
Function Measure_LC(ctrlName) : ButtonControl
String ctrlName
if(strlen(winname(0,4))>0)
string info=layoutinfo("","layout")
string selected=stringbykey("SELECTED",info,":")
if(itemsinlist(selected,",")>0)
variable posLeft=str2num(stringbykey("left",layoutinfo("",stringfromlist(0,selected,","))))
variable posTop=str2num(stringbykey("top",layoutinfo("",stringfromlist(0,selected,","))))
if (strlen(winlist(stringfromlist(0,selected,","),";","win:1"))>0)//graph exists
getwindow $stringfromlist(0,selected,",") gsize
variable left=v_left,right=v_right,top=v_top,bottom=v_bottom
getwindow $stringfromlist(0,selected,",") psize
left+=v_left;right-=v_right;top+=v_top;bottom-=v_bottom
SetVariable PLOT_TOP, win=LayoutControl,value= _NUM:round(top)
SetVariable PLOT_LEFT, win=LayoutControl,value= _NUM:round(left)
TitleBox LT_LC , win=LayoutControl,title="("+num2str((posLeft))+","+num2str((postop))+")"
TitleBox RB_LC , win=LayoutControl,title="("+num2str(round(posLeft+v_right-v_left))+","+num2str(round(postop+v_bottom-v_top))+")"
SetVariable PLOT_RIGHT, win=LayoutControl,value= _NUM:round(right)
SetVariable PLOT_BOTTOM, win=LayoutControl,value= _NUM:round(bottom)
SetVariable PLOT_SIZEW, win=LayoutControl,value= _NUM:round(v_right-v_left)
SetVariable PLOT_SIZEH, win=LayoutControl,value= _NUM:round(v_bottom-v_top)
endif
else
TitleBox LT_LC , win=LayoutControl,title="(,)"
TitleBox RB_LC , win=LayoutControl,title="(,)"
endif
endif
End
//---moves selected graphs by a number
Function MoveGraphs(ctrlName) : ButtonControl
String ctrlName
variable moveleft=0,movetop=0
controlinfo/w=LayoutControl Move_num
if(stringmatch(ctrlName,"*left*"))
moveleft=-v_value
endif
if(stringmatch(ctrlName,"*right*"))
moveleft=v_value
endif
if(stringmatch(ctrlName,"*top*"))
movetop=-v_value
endif
if(stringmatch(ctrlName,"*bottom*"))
movetop=v_value
endif
if(stringmatch(ctrlName,"*100*"))
moveleft*=10
movetop*=10
endif
if(strlen(winname(0,4))>0)
string info=layoutinfo("","layout")
string selected=stringbykey("SELECTED",info,":")
variable i
for(i=0;i<itemsinlist(selected,",");i+=1)
ModifyLayout left($stringfromlist(i,selected,","))=str2num(stringbykey("left",layoutinfo("",stringfromlist(i,selected,","))))+moveleft
ModifyLayout top($stringfromlist(i,selected,","))=str2num(stringbykey("top",layoutinfo("",stringfromlist(i,selected,","))))+movetop
endfor
dowindow /F $winname(0,4)
dowindow /F LayoutControl
endif
execute /p /q "Measure_LC(\"\")"
End
//---aligns selected graphs left/top
Function AlignGraphs(ctrlName) : ButtonControl
String ctrlName
controlinfo/w=LayoutControl Move_num
variable moveleft=(stringmatch(ctrlName,"*left*"))
variable movetop=(stringmatch(ctrlName,"*top*"))
if(strlen(winname(0,4))>0)
string info=layoutinfo("","layout")
string selected=stringbykey("SELECTED",info,":")
if(strlen(selected)>0)
variable i,mostleftpos=inf,mosttoppos=inf
for(i=0;i<itemsinlist(selected,",");i+=1)
mostleftpos=min(mostleftpos,str2num(stringbykey("left",layoutinfo("",stringfromlist(i,selected,",")))))
mosttoppos=min(mosttoppos,str2num(stringbykey("top",layoutinfo("",stringfromlist(i,selected,",")))))
endfor
for(i=0;i<itemsinlist(selected,",");i+=1)
if(moveleft)
ModifyLayout left($stringfromlist(i,selected,","))=mostleftpos
else
ModifyLayout top($stringfromlist(i,selected,","))=mosttoppos
endif
endfor
endif
dowindow /F $winname(0,4)
dowindow /F LayoutControl
endif
execute /p /q "Measure_LC(\"\")"
End
//---update of the plot params for graphs selected on alyout
Function LC_PLOTSIZE(ctrlName,varNum,varStr,varName) : SetVariableControl
String ctrlName
Variable varNum
String varStr
String varName
variable minval,maxval
if(strlen(winname(0,4))>0)
string info=layoutinfo("","layout")
string selected=stringbykey("SELECTED",info,":")
variable i
for(i=0;i<itemsinlist(selected,",");i+=1)
if(stringmatch(ctrlName,"*left*"))
ModifyGraph/w=$stringfromlist(i,selected,",") margin(left)=varNum
endif
if(stringmatch(ctrlName,"*right*"))
ModifyGraph/w=$stringfromlist(i,selected,",") margin(right)=varNum
endif
if(stringmatch(ctrlName,"*top*"))
ModifyGraph/w=$stringfromlist(i,selected,",") margin(top)=varNum
endif
if(stringmatch(ctrlName,"*bottom*"))
ModifyGraph/w=$stringfromlist(i,selected,",") margin(bottom)=varNum
endif
if(stringmatch(ctrlName,"*sizeh*"))
ModifyGraph/w=$stringfromlist(i,selected,",") height=varNum
endif
if(stringmatch(ctrlName,"*sizew*"))
ModifyGraph/w=$stringfromlist(i,selected,",") width=varNum
endif
endfor
execute /p /q "dowindow /F "+winname(0,4)
execute /p /q "dowindow /F LayoutControl"
execute /p /q "Measure_LC(\"\")"
endif
end
//---changes to transparent and no frame
Function SetFrame_LC(ctrlName) : ButtonControl
String ctrlName
if(strlen(winname(0,4))>0)
ModifyLayout trans=1,frame=0
dowindow /F $winname(0,4)
dowindow /F LayoutControl
endif
End
//---brings the graph to front
Function BringFront(ctrlName) : ButtonControl
String ctrlName
if(strlen(winname(0,4))>0)
string info=layoutinfo("","layout")
string selected=stringbykey("SELECTED",info,":")
variable i
for(i=0;i<itemsinlist(selected,",");i+=1)
dowindow /f $stringfromlist(i,selected,",")
endfor
endif
End
//---memory management
Function FindWavesMb_LC()
string waves=DataFolderDir(2 )
waves= ReplaceString("WAVES:", waves, "")
waves=RemoveEnding(waves)
waves=RemoveEnding(waves)
variable wcount,memsize=0,wmem
string wavesize
for(wcount=0;wcount<itemsinlist(waves,",");wcount+=1)
wavesize=waveinfo($stringfromlist(wcount,waves,","),0)
wmem=numberbykey("SIZEINBYTES",wavesize)
memsize+=wmem
endfor
return memsize/(2^10)
end
Function FindSubFolderSize_LC(DF)
string DF
variable mem=0
string DFolder=getdatafolder(1)
if(stringmatch(DF,"root"))
setdatafolder root:
elseif(datafolderexists(DF))
setdatafolder $DF
else
return 0
endif
if (CountObjects("",4)==0)//no subfolders
return FindWavesMb_LC()
else
variable i
for(i=0;i<CountObjects("",4);i+=1)
mem+=FindSubFolderSize_LC(DF+""+GetIndexedObjName("", 4, i )+":")
setdatafolder $DF
endfor
mem+=FindWavesMb_LC()
endif
setdatafolder $DFolder
return mem
end
//--------------------------manage windows procedures-----------------
//--------------------------manage windows procedures-----------------
//--------------------------manage windows procedures-----------------
//----manages graphs on layouts
Function LC_G_on_L(ctrlName) : ButtonControl
String ctrlName
string graphs
string graphlist_onlayouts=""
variable laynum,graphnum,pagenum
for (laynum=0;laynum<itemsinlist(winlist("*",";","WIN:4"));laynum+=1)//finds all layouts
string currentlayout=stringfromlist(laynum,winlist("*",";","WIN:4"))
string info=layoutinfo(currentlayout,"layout")
variable currentpage=numberbykey("CURRENTPAGENUM",info,":")
for(pagenum=0;pagenum<numberbykey("NUMPAGES",info,":");pagenum+=1)//finds all pages
LayoutPageAction/w=$currentlayout page=pagenum+1
for(graphnum=0;graphnum<numberbykey("NUMOBJECTS",layoutinfo(currentlayout,"layout"),":");graphnum+=1)//finds all graphs
if(stringmatch(ctrlName,"*show*"))
dowindow/F $stringbykey("NAME",layoutinfo(currentlayout,num2str(graphnum)),":")
elseif(stringmatch(ctrlName,"*hide*"))
dowindow/HIDE=1 $stringbykey("NAME",layoutinfo(currentlayout,num2str(graphnum)),":")
endif
graphlist_onlayouts+=stringbykey("NAME",layoutinfo(currentlayout,num2str(graphnum)),":")+";"
endfor
endfor
LayoutPageAction/w=$currentlayout page=currentpage
endfor
if(stringmatch(ctrlName,"*not*"))//work on graphs not on layouts
for (graphnum=0;graphnum<itemsinlist(winlist("*",";","WIN:1"));graphnum+=1)//finds all graphs
graphs=stringfromlist(graphnum,winlist("*",";","WIN:1"))
if(FindListItem(graphs,graphlist_onlayouts,";")==-1)//not on layout
if(stringmatch(ctrlName,"*sh*"))
dowindow/F $graphs
elseif(stringmatch(ctrlName,"*hi*"))
dowindow/HIDE=1 $graphs
elseif(stringmatch(ctrlName,"*kill*"))
dowindow/k $graphs
endif
endif
endfor
endif
End
//-----show plots that reference DF
function DF_plot(DF,deep,delete)
string DF
variable deep,delete
variable graphnum,tracenum,foundplot,subDF
string graphname,tracename
setdatafolder DF
for (graphnum=0;graphnum<itemsinlist(winlist("*",";","WIN:1"));graphnum+=1)//finds all graphs
graphname=stringfromlist(graphnum,winlist("*",";","WIN:1"),";")
if(strlen(WaveList("*", ";", "win:"+graphname ))>0)
if(delete)
killwindow /z $graphname
else
dowindow/f $graphname
endif
endif
endfor
if(deep)
string Folders=stringbykey("FOLDERS",DataFolderDir(1),":")
for (subDF=0;subDF<itemsinlist(Folders,",");subDF+=1)
if(DataFolderExists(getdatafolder(1)+""+stringfromlist(subDF,Folders,",")))
DF_plot(getdatafolder(1)+""+stringfromlist(subDF,Folders,","),deep,delete)
else
DF_plot(getdatafolder(1)+"'"+stringfromlist(subDF,Folders,",")+"'",deep,delete)
endif
setdatafolder DF
endfor
endif
int err = GetRTError(0)
if (err != 0)
Printf "Stopping background task because of error %d\r", err
return 1
endif
return 1
end
//---edit all waves in selected datafolder
Function LC_EditfromDF(ctrlName) : ButtonControl
String ctrlName
execute/p/q replacestring("waves:",datafolderdir(2),"edit/k=1 ",0,1)
End
//---shows all plots that reference waves in selected datafolder
Function LC_plotsfromDF(ctrlName) : ButtonControl
String ctrlName
string DF=getdatafolder(1),checkDF=DF+";"
controlinfo/w=LayoutControl LC_subDF
DF_plot(DF,v_value,0)
setdatafolder DF
End
//---deletes plots in DF
Function LC_deleteDF_plots(ctrlName) : ButtonControl
String ctrlName
string DF=getdatafolder(1),checkDF=DF+";"
controlinfo/w=LayoutControl LC_delete_graphs
variable delete_graphs=v_value
controlinfo/w=LayoutControl LC_subDF
DF_plot(DF,v_value,delete_graphs)
setdatafolder DF
killdatafolder/z DF
End
//-----------------------------------GC---------------------------------------
//-----------------------------------GC---------------------------------------
//-----------------------------------GC---------------------------------------
//-----------------------------------GC---------------------------------------
//---creates the graphcontrol panel and initializes the graphcontrol directory
function GraphControlInit()
string DF=getdatafolder(1)
newdatafolder/o/s root:GraphControl
string/g ColorTableList
newdatafolder/o/s ColorTables
//ColorTableList=
GCpopulateColorTables()
//GCcreateTransColorTables()
setdatafolder root:GraphControl
make/o/n=(0,9)/t listtext
make/o/n=0 listselect
make/o/n=9/t listtitle={"Pos","Color","Y wave","X Wave","Y DF","X DF","Y Axis","X Axis","Size"}
make/t/o/n=(0,0) LeftFolderListText,RightFolderListText
make/o/n=(1,2,3) LeftFolderListSelect,RightFolderListSelect,DFSelectSave
make/t/o/n=0 ImageListText
make/t/o/n=5 ImageListTitle={"Name","Size","DF","Y axis","X axis"}
make/o/n=(dimsize(LeftFolderListText,0)*2,4) LeftFolderListColor
make/o/n=(dimsize(RightFolderListText,0)*2,4) RightFolderListColor
make/t/n=2/o CurrentDF=DF
//---color tabel waves
make/o/n=(256,2) ColorTableShowWave=p
make/o/n=(9,4) GCCol
GCCol[][0]=60000 //---plot area
GCCol[][1]={65535,60000,60000,16000} //---traces
GCCol[][2]={65535,60000,55000,12000} //---advanced
GCCol[][3]={65535,65535,50000,12000} //---error bars
GCCol[][4]={56000,65535,50000,12000} //---offset
GCCol[][5]={60000,65535,62000,32000} //---axes
GCCol[][6]={60000,65535,65535,32000} //---folders
GCCol[][7]={60000,62000,65535,32000} //---images
GCCol[][8]={62000,60000,65535,32000} //---trace
//---3d waves
// make/o/n=(256,3) Color3d
// make/o/n=(256,4) Color3dCol
variable/g MustUpdate=1
string/g axisleft,axisbottom,PlotName="",SubPlotWindows=""
make/o/n=(1,2,3) DFselect=0
make/o/t/n=(1,2) DFname=""
dowindow /k GraphControl //---erase prev. version
NewPanel /k=1/W=(200,50,600,600)/n=GraphControl/flt=0 as "Graph Contol"
newimage/host=GraphControl /n=ColorTableDisplay root:GraphControl:ColorTableShowWave
newimage/host=GraphControl /n=ColorTableDisplayImage root:GraphControl:ColorTableShowWave
setwindow GraphControl hook(click)=ColorTableClickHook
setwindow GraphControl activeChildFrame=0
//---main buttons
Button PLOT_NEW,pos={2,12},size={40,32},proc=GraphControlNewPlot,title="New",win=GraphControl
Button PLOT_NEW,fColor=(48896,49152,65280),win=GraphControl
Button PLOT_FRONT,pos={42,12},size={40,32},proc=GraphControlShowPlot,title="Show",win=GraphControl
Button PLOT_FRONT,fColor=(48896,49152,65280),win=GraphControl
Button PLOT_Layout,pos={82,12},size={60,32},proc=GraphControlLayout,title="To Layout",win=GraphControl
Button PLOT_Layout,fColor=(48896,49152,65280),win=GraphControl
Button PLOT_DUPLICATE,pos={142,12},size={90,32},proc=GraphControlDuplicateDF,title="Duplicate @DF",win=GraphControl
Button PLOT_DUPLICATE,fColor=(48896,49152,65280),win=GraphControl
Button PLOT_CHANGEDF,pos={232,12},size={70,32},proc=GraphControlDuplicateDF,title="Replace DF",win=GraphControl
Button PLOT_CHANGEDF,fColor=(48896,49152,65280),win=GraphControl
CheckBox PLOT_PRINT pos={307,22},size={57,15},value= 0,title="Print commands",win=GraphControl,win=GraphControl
//---menu buttons
Button GC_PLOT_AREA,proc=GraphControlControlsButtonProc,userdata= "active",win=GraphControl
Button GC_TRACES,proc=GraphControlControlsButtonProc,userdata= "active",win=GraphControl
Button GC_MARKERS,proc=GraphControlControlsButtonProc,userdata= "active",win=GraphControl
Button GC_ERRORS,proc=GraphControlControlsButtonProc,userdata= "active",win=GraphControl
Button GC_OFFSET,proc=GraphControlControlsButtonProc,userdata= "active",win=GraphControl
Button GC_AXES,proc=GraphControlControlsButtonProc,userdata= "active",win=GraphControl
Button GC_FOLDERS,proc=GraphControlControlsButtonProc,userdata= "active",userdata(position)="00",userdata(height)="150",userdata(mousemoving)="",win=GraphControl
Button GC_IMAGE,proc=GraphControlControlsButtonProc,userdata= "active",userdata(position)="00",userdata(height)="170",userdata(mousemoving)="",win=GraphControl
//getwindow GraphControl wsize
Button GC_LISTS,proc=GraphControlControlsButtonProc,userdata= "inactive",pos={0,0},userdata(height)="150",win=GraphControl
//---hook functions -link to plots
SetWindow GraphControl,hook(newgraphcontrol)=GraphControlPanelHook
SetWindow GraphControl,userdata(showTraces)="1"
PopupMenu PLOT_SUBWINDOW value=#"root:graphcontrol:subplotwindows",win=GraphControl
ListBox PLOT_TRACE_LIST,listWave=root:graphcontrol:listtext,win=GraphControl
ListBox PLOT_TRACE_LIST,selWave=root:graphcontrol:listselect,win=GraphControl
ListBox PLOT_TRACE_LIST,titleWave=root:graphcontrol:listtitle,mode= 9,win=GraphControl
ListBox PLOT_TRACE_LIST,widths={35,35,100,100,150,150,80,80},userColumnResize= 1,win=GraphControl
setdatafolder DF
UpdateDirFolder(getdatafolder(1),"LEFT")
UpdateDirFolder(getdatafolder(1),"RIGHT")
FindTopPLot()
UpdateFolderColors()
GraphControlPanelUpdate()
setdatafolder DF
end
//---converts all Igor color tables to waves
Function/s GCpopulateColorTables()
string DF=getdatafolder(1)
setdatafolder root:GraphControl:ColorTables:
variable colT,dd,ff,i
//---native color tables
for(colT=0;colT<itemsinlist(CTabList());colT++)
colorTab2Wave $stringfromlist(colT,CTabList())
wave M_colors
setscale/I x,0,255,"",M_colors
insertpoints/m=1 3,1,M_colors
M_colors[][3]=65535
make/o/n=(256,4)/free TempCol256=M_colors(x)[q]
if(dimsize(M_colors,0)<256)
for(i=0;i<3;i++)
make/o/n=(dimsize(M_colors,0))/free Temp_colors=m_colors[p][i]
interpolate2/n=256/t=1 /y=TempCol_ Temp_colors
TempCol256[][i]=TempCol_[p]
endfor
endif
duplicate/o TempCol256,$stringfromlist(colT,CTabList())
endfor
killwaves/z M_colors
//---expanded color tables
pathinfo igor
newpath/o/q igorCol,( S_path+"Color Tables")
for(dd=0;dd<itemsinlist(IndexedDir(igorCol, -1, 0));dd++) //---all color directories
pathinfo igorCol
newpath/o/q igorColDeep,( S_path+IndexedDir(igorCol, dd, 0))
string list= Indexedfile(igorColDeep, -1, "????")
for(ff=0;ff<itemsinlist(list);ff++) //---all color directories
LoadWave/P=igorColDeep /o/q Indexedfile(igorColDeep, ff, "????")
wave newcol=$removeending(S_waveNames)
insertpoints/m=1 3,1,newcol
newcol[][3]=65535
setscale/I x,0,255,"",newcol
make/o/n=(256,4)/free TempCol256=newcol(x)[q]
if(dimsize(newcol,0)<256)
for(i=0;i<3;i++)
make/o/n=(dimsize(newcol,0))/free Temp_colors=newcol[p][i]
interpolate2/n=256/t=1 /y=TempCol_ Temp_colors
TempCol256[][i]=TempCol_[p]
endfor
endif
killwaves/z newcol
duplicate/o TempCol256,$replacestring("-",removeending(S_waveNames),"_")
endfor
endfor
killwaves/z TempCol_,Temp_colors,newcol
GCcreateTransColorTables()
setdatafolder DF
end
//---create transparent versions of the color tables
function GCcreateTransColorTables()
//---create transparent versions
string DF=getdatafolder(1)
setdatafolder root:GraphControl:
svar ColorTableList
ColorTableList= removeending(replacestring(",",replacestring("WAVES:",DataFolderDir(2,root:GraphControl:ColorTables),""),";"))
variable trans,waves
for(trans=1;trans<=4;trans++)
newdataFolder/s/o root:GraphControl:ColorTables:$"TRANS"+num2str(trans)
for(waves=0;waves<itemsinlist(ColorTableList);waves++)
duplicate/o root:GraphControl:ColorTables:$stringfromlist(waves,ColorTableList),$stringfromlist(waves,ColorTableList)
wave newColwave=$stringfromlist(waves,ColorTableList)
newColwave[][3]=65535*((5-trans)/4)
endfor
endfor
setdatafolder DF
end
//---create a master wave to show all color tables
Function MasterColorTable(variable PeakRow, string parentwindow,[string transinfo,string maincontrol])
string DF=getdatafolder(1)
variable i,row,col,prevCol=-1,prevrow=-1
variable margin_left=32,disp_width=255
variable margin_top=4,disp_height=16
setdatafolder root:GraphControl
svar ColorTableList
make/o/n=( (PeakRow+0)*(margin_left+disp_width), (ceil(itemsinlist(ColorTableList)/PeakRow)+0)*(margin_top+disp_height),4) ColorTableShowWaveAll,ColorTableShowWaveCol=nan
redimension/W/n=(-1,-1,0) ColorTableShowWaveAll
setdatafolder root:GraphControl:ColorTables:
for(i=0;i<itemsinlist(ColorTableList);i++) //---all color waves
wave colTable=$stringfromlist(i,ColorTableList)
row=mod(i,PeakRow)
col=floor(i/PeakRow)
variable start_left=row*(margin_left+disp_width)+margin_left
variable start_top=col*(margin_top+disp_height)+margin_top
ColorTableShowWaveAll[start_left-margin_left,start_left+disp_width-1][start_top-margin_top,start_top+disp_height-1]=i
ColorTableShowWaveCol[start_left,start_left+disp_width-1][start_top,start_top+disp_height-1][]=colTable[p-start_left][r]
endfor
//---display the colortables
dowindow $parentwindow
if(v_flag)
if(stringmatch(parentwindow,"GraphControl"))
controlinfo/w=GraphControl $transinfo
variable trans=v_value
ColorTableShowWaveCol[][][3]=65535*(5-trans)/4
else
ColorTableShowWaveCol[][][3]=65535
endif
dowindow/k GraphControlCT
getwindow $parentwindow wsize
newpanel/K=1/n=GraphControlCT/w=(v_left+100,v_top,v_left+500,v_top+400) as "Color Tables"
NewImage/n=ColorTableImage/host=GraphControlCT root:GraphControl:ColorTableShowWaveCol
movesubwindow/w=GraphControlCT#ColorTableImage fnum=(0,0,1,1)
ModifyGraph/w=GraphControlCT#ColorTableImage margin=5, nticks=0,axThick=0
setwindow GraphControlCT hook(mouseclick)=ColotTableMouseClick,userdata(parent)=parentwindow
setwindow GraphControlCT userdata(control)=maincontrol
endif
setdatafolder DF
end
//---returns the table number
Function ColotTableMouseClick(s)
STRUCT WMWinHookStruct &s
variable setCT=-1
if(s.eventCode==3)//---mouse down
string DF=getdatafolder(1)
setdatafolder root:GraphControl
wave ColorTableShowWaveAll
svar ColorTableList
setCT= ColorTableShowWaveAll[ (s.mouseloc.h-5)*dimsize(ColorTableShowWaveAll,0)/(s.winRect.right-10)][(s.mouseloc.v-5)*dimsize(ColorTableShowWaveAll,1)/(s.winRect.bottom-10)]
setdatafolder DF
endif
if(setCT>=0)
string parent=getuserdata("GraphControlCT","","parent")
dowindow $parent
if(v_flag)
if(stringmatch(parent,"GraphControl"))
string control=getuserdata("GraphControlCT","","control")
popupmenu $control,mode=setCT+1,win=$parent
if(stringmatch(control,"TRACE_ADVANCE_COLORTABLE_NAME"))
changetraceparams(control,setCT+1,stringfromlist(setCT,ColorTableList))
else
IMAGECOLORTABLE(control,setCT+1,stringfromlist(setCT,ColorTableList))
endif
doupdate
updatetracecontrols()
else //---color wheel
popupmenu ColorTableMenu,mode=setCT+1,win=$parent
drawCWshape()
endif
endif
execute /p/q "dowindow/k GraphControlCT"
endif
return 1
end
//---computes and activates the color table window
Function ColorTableClickHook(s)
STRUCT WMWinHookStruct &s
if(s.eventCode==3)//---mouse down
string name=s.winName
getwindow $name wsize
if(stringmatch(name,"*colortabledisplay*"))
string transinfo="TRACE_ADVANCE_COLORTABLE_TRANS"
string maincontrol = "TRACE_ADVANCE_COLORTABLE_NAME"
if(stringmatch(name,"*colortabledisplayImage"))
transinfo="PLOT_IMAGE_COLORTABLE_TRANS"
maincontrol = "PLOT_IMAGE_COLORTABLE_NAME"
endif
MasterColorTable(5,name[0,strsearch(s.winName,"#",0)-1],transinfo=transinfo,maincontrol=maincontrol)
endif
endif
end
//---gets the name of the most top plot, or a subwindow
Function FindTopPLot()
string DF=getdatafolder(1)
setdatafolder root:GraphControl
svar PlotName,SubPlotWindows
PlotName=""
SubPlotWindows=""
String WindowList= winlist("!GraphControl*",";","WIN:65") //---shows all panels and graphs
variable win=0,found=-1,subwin=0
for(win=itemsinlist(WindowList)-1;win>=0;win--) //---find the most top graph/panel with a subwindow
string CurrentWindow=stringfromlist(win,WindowList)
string ChildWindows=ChildWindowList(CurrentWindow)
if(wintype(CurrentWindow)==1) //---graph
//print WinRecreation(CurrentWindow, 0 )
found=win
PlotName=CurrentWindow
SubPlotWindows="_none_;"+ChildWindows
elseif(wintype(CurrentWindow)==7) //---panel
for(subwin=itemsinlist(ChildWindows)-1;subwin>=0;subwin--) //---all subwindows
if(wintype(CurrentWindow+"#"+stringfromlist(subwin,ChildWindows))==1) //---graph
found=win
PlotName=CurrentWindow
SubPlotWindows=ChildWindows
endif
endfor
endif
endfor
setdatafolder DF
end
//---the plot we are working on
Function/s WorkingPlotName()
string DF=getdatafolder(1)
setdatafolder root:GraphControl
svar PlotName,SubPlotWindows
setdatafolder DF
if(strlen(PlotName)>0)
dowindow GraphControl
if(v_flag)
controlinfo/w=GraphControl PLOT_SUBWINDOW
if( (stringmatch(s_value,"_none_"))||(stringmatch(s_value,"")))
return PlotName
else
return PlotName+"#"+s_value
endif
else
return ""
endif
else
return ""
endif
end
//---change subwindow
Function Subwindow_PopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl
String ctrlName
Variable popNum
String popStr
GraphControlPanelUpdate(update=1)
End
//---update of graph controls--------------------------------------------------
function GraphControlPanelUpdate([update])
variable update
string DF=getdatafolder(1)
dowindow GraphControl
setdatafolder root:graphcontrol
nvar MustUpdate
svar PlotName,SubPlotWindows
if( (( MustUpdate)||(update))&&(v_flag))
doupdate
wave/t listtext,listtitle
wave listselect
wave/t ImageListText,ImageListTitle
wave/t LeftFolderListText,RightFolderListText
wave LeftFolderListSelect,RightFolderListSelect,LeftFolderListColor,RightFolderListColor,GCCol
SetDimLabel 2,1,foreColors,LeftFolderListSelect,RightFolderListSelect
SetDimLabel 2,2,backColors,LeftFolderListSelect,RightFolderListSelect
redimension /n=(dimsize(LeftFolderListText,0)*2,4) LeftFolderListColor
redimension /n=(dimsize(RightFolderListText,0)*2,4) RightFolderListColor
make/t/n=2/o CurrentDF=DF
variable CurrGCCol=0
setdatafolder $DF
//----draw envoronment
setdrawlayer /w=GraphControl userback
drawaction/w=GraphControl delete
//---plot margins
getwindow GraphControl wsizeDC
variable plotWidth=v_right-v_left,plotHeight=v_bottom-v_top
Button GC_PLOT_AREA,pos={-4,50},size={plotWidth+8,25},fColor=(GCCol[0][CurrGCCol],GCCol[1][CurrGCCol],GCCol[2][CurrGCCol]),fSize=14,proc=GraphControlControlsButtonProc,title="Plot area",win=GraphControl
controlinfo/w=GraphControl GC_PLOT_AREA
variable showPlotArea=stringmatch(S_UserData,"active")
//---plot name
SetVariable PLOT_NAME,pos={2,77},size={plotWidth-210,18.00},proc=PLOTSIZE,title="Name: ",win=GraphControl,disable=showPlotArea
FindTopPLot() //---the plot to work on
PopupMenu PLOT_SUBWINDOW pos={plotWidth-200,77},value=#"root:graphcontrol:subplotwindows",proc=Subwindow_PopMenuProc,win=GraphControl,disable=showPlotArea
//---plot size
SetVariable PLOT_SIZEW,pos={9,100},size={90.00,18.00},proc=PLOTSIZE,title="Width",win=GraphControl,disable=showPlotArea
SetVariable PLOT_SIZEW,valueBackColor=(56576,56576,56576),win=GraphControl,disable=showPlotArea
SetVariable PLOT_SIZEW,limits={-1,inf,10},value= _NUM:120,win=GraphControl,disable=showPlotArea
SetVariable PLOT_SIZEH,pos={4,120},size={95.00,18.00},proc=PLOTSIZE,title="Height",win=GraphControl,disable=showPlotArea
SetVariable PLOT_SIZEH,valueBackColor=(56576,56576,56576),win=GraphControl,disable=showPlotArea
SetVariable PLOT_SIZEH,limits={-1,inf,10},value= _NUM:100,win=GraphControl,disable=showPlotArea
SetVariable PLOT_PERUNIT_SIZEH,pos={110.00,120},size={120,18.00},proc=PLOTSIZE,title="perUnit",win=GraphControl,disable=showPlotArea
SetVariable PLOT_PERUNIT_SIZEH,valueBackColor=(56576,56576,56576),win=GraphControl,disable=showPlotArea
SetVariable PLOT_PERUNIT_SIZEH,limits={0,inf,1},value= _NUM:1,format="%.5g",win=GraphControl,disable=showPlotArea
PopupMenu PLOT_PERUNIT_AXIS_BOTTOM,pos={230,100-1},size={91.00,19.00},proc=PLOTAXISSIZEPopMenuProc,title="* Axis",win=GraphControl,disable=showPlotArea
PopupMenu PLOT_PERUNIT_AXIS_BOTTOM,mode=1,popvalue=stringfromlist(0,getaxistype(1)),value= #"getaxistype(1)",win=GraphControl,disable=showPlotArea
SetVariable PLOT_PERUNIT_SIZEW,pos={110.00,100},size={120,18.00},proc=PLOTSIZE,title="perUnit",win=GraphControl,disable=showPlotArea
SetVariable PLOT_PERUNIT_SIZEW,valueBackColor=(56576,56576,56576),win=GraphControl,disable=showPlotArea
SetVariable PLOT_PERUNIT_SIZEW,limits={0,inf,1},value= _NUM:1,format="%.5g",win=GraphControl,disable=showPlotArea
PopupMenu PLOT_PERUNIT_AXIS_LEFT,pos={230,120-1},size={91.00,19.00},proc=PLOTAXISSIZEPopMenuProc,title="* Axis",win=GraphControl,disable=showPlotArea
PopupMenu PLOT_PERUNIT_AXIS_LEFT,mode=1,popvalue=stringfromlist(0,getaxistype(0)),value= #"getaxistype(0)",win=GraphControl,disable=showPlotArea
variable marginY=65,marginX=160
//---recreation
TitleBox PLOT_INFO,pos={4,marginY+77},size={56.00,15.00},frame=0,title="Recreation",win=GraphControl,disable=showPlotArea
Button PLOTINFO_COPY,pos={5,marginY+90},size={50.00,28.00},proc=PLOTINFOCOPY,title="Copy",win=GraphControl,disable=showPlotArea
Button PLOTINFO_PASTE,pos={55,marginY+90},size={50.00,28.00},proc=PLOTINFOPASTE,title="Paste",win=GraphControl,disable=showPlotArea
//--axis utilities
Button PLOT_ENHANCE,pos={4,marginY+120},size={60,20},proc=GraphControlEnhance,title="Enhance",win=GraphControl,disable=showPlotArea
CheckBox PLOT_SWAPXY,pos={70,marginY+122},size={57.00,15.00},proc=PLOTAXISMODE,title="Swap XY",win=GraphControl,disable=showPlotArea
SetVariable PLOT_EXPAND pos={135,marginY+120},size={80,18.00},limits={0,10,0.5},proc=PLOTSIZE,title="Expand",win=GraphControl,disable=showPlotArea
//---margins
TitleBox PLOT_MARGIN_INFO,pos={plotWidth-marginX-42,marginY+77},size={56.00,15.00},frame=0,title="Margins",win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_ALL,pos={plotWidth-marginX+54.00,98+marginY},size={55.00,18.00},proc=PLOTSIZE,title="all",win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_ALL,valueBackColor=(65535,65535,65535),win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_ALL,limits={-1,1000,10},value= _NUM:0,win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_TOP,pos={plotWidth-marginX+39.00,77+marginY},size={70.00,18.00},proc=PLOTSIZE,title="Top",win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_TOP,valueBackColor=(56576,56576,56576),win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_TOP,limits={-1,1000,10},value= _NUM:20,win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_BOTTOM,pos={plotWidth-marginX+19.00,119+marginY},size={90.00,18.00},proc=PLOTSIZE,title="Bottom",win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_BOTTOM,valueBackColor=(56576,56576,56576),win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_BOTTOM,limits={-1,1000,10},value= _NUM:30,win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_LEFT,pos={plotWidth-marginX+3.00,98+marginY},size={45.00,18.00},proc=PLOTSIZE,win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_LEFT,valueBackColor=(56576,56576,56576),win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_LEFT,limits={-1,1000,10},value= _NUM:35,win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_Right,pos={plotWidth-marginX+110.00,98+marginY},size={45.00,18.00},proc=PLOTSIZE,win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_Right,valueBackColor=(56576,56576,56576),win=GraphControl,disable=showPlotArea
SetVariable PLOT_MARGIN_Right,limits={-1,1000,10},value= _NUM:35,win=GraphControl,disable=showPlotArea
TitleBox PLOT_TITLE_LEFT,pos={plotWidth-marginX+3.00,84+marginY},frame=0,size={20.00,15.00},title="Left",win=GraphControl,disable=showPlotArea
TitleBox PLOT_TITLE_RIGHT,pos={plotWidth-marginX+125.00,84+marginY},frame=0,size={28.00,15.00},title="Right",win=GraphControl,disable=showPlotArea
//---traces--------------------------------------------------------------------
variable plotControlsY=72+(showPlotArea==0)*138
CurrGCCol++
Button GC_TRACES,pos={-4,plotControlsY},size={plotWidth+8,25},fColor=(GCCol[0][CurrGCCol],GCCol[1][CurrGCCol],GCCol[2][CurrGCCol]),fSize=14,proc=GraphControlControlsButtonProc,title="Trace info",win=GraphControl
controlinfo/w=GraphControl GC_TRACES
variable showTracesArea=stringmatch(S_UserData,"active")
SetDrawEnv/w=GraphControl fillfgc= (GCCol[0][CurrGCCol],GCCol[1][CurrGCCol],GCCol[2][CurrGCCol],GCCol[3][CurrGCCol]),linethick= 0
drawrect/w=GraphControl 0,plotControlsY+22,plotWidth,plotControlsY+22+(showTracesArea==0)*95
//---trace main
PopupMenu TRACEMAIN_MODE,pos={5,plotControlsY+66-40},size={117.00,19.00},proc=TRACE_PARAMS,win=GraphControl,disable=showTracesArea
PopupMenu TRACEMAIN_MODE,mode=5,popvalue="Lines and markers",value= #"\"Lines;Sticks to zero;Dots;Markers;Lines and markers;Bars;Cityscape;Fill to zero;Sticks and markers\"",win=GraphControl,disable=showTracesArea
SetVariable TRACEMAIN_LINESIZE,pos={5,plotControlsY+87-40},size={90,18.00},proc=TRACE_VAR,title="Line size:",win=GraphControl,disable=showTracesArea
SetVariable TRACEMAIN_LINESIZE,limits={0,10,1},value= _NUM:1,win=GraphControl,disable=showTracesArea
PopupMenu TRACEMAIN_LINE,pos={100,plotControlsY+87-40},size={50,19},bodyWidth=50,disable=1,proc=TRACE_PARAMS,win=GraphControl,disable=showTracesArea
PopupMenu TRACEMAIN_LINE,mode=1,value= #"\"*LINESTYLEPOP*\"",win=GraphControl,disable=showTracesArea
PopupMenu TRACEMAIN_COL,pos={155,plotControlsY+87-40},size={50,18},proc=TRACE_PARAMS,win=GraphControl,disable=showTracesArea
PopupMenu TRACEMAIN_COL,mode=1,popColor= (0,0,0),value= #"\"*COLORPOP*\"",win=GraphControl,disable=showTracesArea
SetVariable TRACEMAIN_COLTRANS,pos={210,plotControlsY+87-40},size={85,18},proc=TRACE_VAR,title="Alpha:",win=GraphControl,disable=showTracesArea
SetVariable TRACEMAIN_COLTRANS,limits={0,256,1},value= _NUM:256,win=GraphControl,disable=showTracesArea
Button TRACEMAININFO_COPY,pos={270,plotControlsY+65-40},size={40.00,20},proc=INFOCOPY,title="Copy",win=GraphControl,disable=showTracesArea
Button TRACEMAININFO_PASTE,pos={310,plotControlsY+65-40},size={40.00,20},proc=INFOPASTE,title="Paste",win=GraphControl,disable=showTracesArea
TitleBox TRACEMAIN_INFO,pos={210,plotControlsY+67-40},size={56.00,15.00},title="Recreation",frame=0,win=GraphControl,disable=showTracesArea
Button buttonTRACEMAIN_PASTE,pos={300,plotControlsY+67-20},size={80,18},proc=TRACE_PASTE,title="Paste trace",win=GraphControl,disable=max(showTracesArea,(strlen(WorkingPlotName())==0))
//---marker/fill----------------------------------------------------------------------------
plotControlsY+=22+(showTracesArea==0)*45
CurrGCCol++
Button GC_MARKERS,pos={-4,plotControlsY},size={plotWidth+8,25},fColor=(GCCol[0][CurrGCCol],GCCol[1][CurrGCCol],GCCol[2][CurrGCCol]),fSize=14,proc=GraphControlControlsButtonProc,title="Markers/Fill/Advanced",win=GraphControl
controlinfo/w=GraphControl GC_MARKERS
variable showMarkerArea=stringmatch(S_UserData,"active")
SetDrawEnv/w=GraphControl fillfgc= (GCCol[0][CurrGCCol],GCCol[1][CurrGCCol],GCCol[2][CurrGCCol],GCCol[3][CurrGCCol]),linethick= 0
drawrect/w=GraphControl 0,plotControlsY+22,plotWidth,plotControlsY+22+(showMarkerArea==0)*55
SetVariable TRACE_MARKERSIZE,pos={7.00,plotControlsY+30},size={105,18.00},proc=TRACE_VAR,title="Marker size:",win=GraphControl,disable=showMarkerArea
SetVariable TRACE_MARKERSIZE,limits={0,10,1},value= _NUM:0,win=GraphControl,disable=showMarkerArea
PopupMenu TRACE_MARKER,pos={115.00,plotControlsY+30},size={50.00,19.00},proc=TRACE_PARAMS,win=GraphControl,disable=showMarkerArea
PopupMenu TRACE_MARKER,mode=9,value= #"\"*MARKERPOP*\"",win=GraphControl,disable=showMarkerArea
SetVariable TRACE_MARKERSKIP,pos={230.00,plotControlsY+30},size={60.00,19.00},proc=TRACE_VAR,title="Skip:",win=GraphControl,disable=showMarkerArea
SetVariable TRACE_MARKERSKIP,limits={0,inf,1},value= _NUM:0,win=GraphControl,disable=showMarkerArea
CheckBox TRACE_MARKEROPAQUE,pos={169.00,plotControlsY+30+2},size={57.00,15.00},value= 0,proc=TRACE_CHECK,title="Opaque",win=GraphControl,disable=showMarkerArea
CheckBox TRACE_MARKERSTROKE,pos={7,plotControlsY+55+2},size={48.00,15.00},value= 0,proc=TRACE_CHECK,title="Stroke",win=GraphControl,disable=showMarkerArea
SetVariable TRACE_MARKERTHICK,pos={60,plotControlsY+55},size={85.00,18.00},disable=1,proc=TRACE_VAR,title="Thick:",win=GraphControl,disable=showMarkerArea
SetVariable TRACE_MARKERTHICK,limits={0,10,1},value= _NUM:0.5,win=GraphControl,disable=showMarkerArea
PopupMenu TRACE_MARKERCOLSTROKE,pos={148,plotControlsY+55},size={50.00,19.00},disable=1,proc=TRACE_PARAMS,win=GraphControl,disable=showMarkerArea
PopupMenu TRACE_MARKERCOLSTROKE,mode=1,popColor= (0,0,0),value= #"\"*COLORPOP*\"",win=GraphControl,disable=showMarkerArea
SetVariable TRACE_MARKERCOLSTROKETRANS,pos={200,plotControlsY+55},size={90,18},proc=TRACE_VAR,title="Alpha:",win=GraphControl,disable=showTracesArea
SetVariable TRACE_MARKERCOLSTROKETRANS,limits={0,256,1},value= _NUM:256,win=GraphControl,disable=showMarkerArea
//---fill