forked from rlabduke/mage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAGEDLOG.c
5618 lines (5194 loc) · 197 KB
/
MAGEDLOG.c
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
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/* MAGEDLOG.c */
/*121107 deleted \0, unneeded at end of sprintf()*/
#include "MAGE.h"
#include "MAGELIST.h"
#include "MAGEANGL.h"
#include "MAGEFLAG.h" /*971025 perpendicular*/
#include "MAGEBBOX.h"
#define EXTERNDLOG
#include "MAGEDLOG.h"
#include "MAGEMENU.h"
#include "MAGETABL.h"
#include "MAGESYNC.h"
#include "MAGEFOO.h"
#include "MAGESCRT.h" /*070901*/
#include "MAGEOUTR.h" /*070901*/
int tokenize(char thestr[256], int*, char**);
/****cleargenericflags()*****************************************************/
void cleargenericflags()
{
Ldlog_cancel = 1; /*presume Dialogs have cancel button as well as OK button*/
Ldlog_option = 0;
Ldlog_extra = 0;
Ldlog_extra2 = 0;
Ldlog_subject = 0;
Ldlog_paramA = 0;
Ldlog_textA = 0;
Ldlog_paramB = 0;
Ldlog_textB = 0;
Ldlog_paramC = 0;
Ldlog_textC = 0;
Ldlog_paramD = 0;
Ldlog_textD = 0;
Ldlog_paramE = 0;
Ldlog_textE = 0;
Ldlog_paramF = 0; /*041031*/
Ldlog_textF = 0;
Ldlog_info = 0;
Ldlog_checkA = 0;
Ldlog_checkB = 0;
Ldlog_checkC = 0;
Ldlog_checkD = 0;
Ldlog_checkE = 0;
Ldlog_checkF = 0;
Ldlog_radioA = 0;
Ldlog_radioB = 0;
Ldlog_radioC = 0;
Ldlog_radioD = 0;
Ldlog_radioE = 0;
Ldlog_radioF = 0;
Ldlog_radioG = 0;
Ldlog_radioH = 0;
Ldlog_radioI = 0;
Ldlog_radioJ = 0;
Ldlog_radioK = 0;
Ldlog_radioL = 0;
Ldlog_radioM = 0;
Ldlog_radioN = 0;
Ldlog_radioO = 0;
Ldlog_radioP = 0;
Ldlog_radioQ = 0;
Ldlog_radioR = 0;
Ldlog_radioS = 0;
Ldlog_radioT = 0;
Ldlog_radioU = 0;
Ldlog_radioV = 0;
Ldlog_radioW = 0;
Ldlog_radioX = 0;
Ldlog_radioY = 0;
Ldlog_radioZ = 0;
sprintf(dlog_OKstr, "______OK______");/*spaces are half width, vs _ */
sprintf(dlog_cancelstr,"____CANCEL____");/*pad to help dialog box min width*/
sprintf(dlog_optionstr," "); /*970408*/
sprintf(dlog_extrastr," "); /*030312*/
sprintf(dlog_extra2str," "); /*030930*/
sprintf(dlog_textAstr," "); /*can use for additional message*/
sprintf(dlog_textBstr," "); /*can use for additional message*/
sprintf(dlog_textCstr," "); /*can use for additional message*/
sprintf(dlog_textDstr," "); /*can use for additional message*/
sprintf(dlog_textEstr," "); /*can use for additional message*/
Ldlog_listboxA = 0; /*060619*/
Ldlog_listboxB = 0;
Ldlog_listboxC = 0;
ACTIVE_DLOG = 0;
Ldlog_OKHIT = 0;
Ldlog_cancelHIT = 0;
Ldlog_optionHIT = 0;
Ldlog_extraHIT = 0;
Ldlog_extra2HIT = 0;
}
/*___cleargenericflags()____________________________________________________*/
/****colorshow_update()******************************************************/
void colorshow_update(int listcolor, int pointcolor)
{
if(pickedlistptr->colorset != 0)
{/*this list is part of a named colorset, change color of all members*/
adjustcolorset(pickedlistptr->colorset, listcolor);
}
pickedlistptr->color = listcolor;
pickedpointptr->colorwidth
=pointcolor|((pickedpointptr->colorwidth)&~31);
/* ~31:one's compliment of 31, i.e. bits 1->0,0->1*/
redrawvec(); /* redraw to show changes */
}
/*___colorshow_update()_____________________________________________________*/
/****dosinglealert()*********************************************************/
void dosinglealert(int mode) /*only alertstr has current information*/
{
if(Ltest||Lformattest)
{
alertstr2[0]='\0';
alertstr3[0]='\0';
#ifdef UNIX_X11
printf("%s\n",alertstr); /*UNIX has functional console window*/
/*which doesn't overlap graphics*/
/*and allows program to be ^c killed*/
#else
DoMageDLOGreport(mode); /*mode 2 for abort, 3 for toggle debug*/
#endif
}
}
/*___dosinglealert()________________________________________________________*/
/****DokineDialog()**********************************************************/
void DokineDialog(void)
{
if(!ACTIVE_DLOG)
{
cleargenericflags(); /*MAGEDLOG.c*/
kineDialog(); /*MAGEDLOG.c*/
DogenericDialog(); /*____DLOG.c*/
#ifndef UNIX_X11 /*called after DLOG_OKHIT_CB */
EndkineDialog(); /*MAGEDLOG*/
#endif
}
}
/*___DokineDialog()_________________________________________________________*/
/****kineDialog()************************************************************/
void kineDialog() /*KINE_DLOG*/
{
sprintf(dlog_subjectstr,"Kinemage choose");
Ldlog_subject = 1;
sprintf(dlog_paramAstr,"0");
/*set 0 so simple return will return to first kinemage*/
Ldlog_paramA = 1;
sprintf(dlog_textAstr,"choose kinemage number");
Ldlog_textA = 1;
sprintf(dlog_optionstr,"NEXT");
Ldlog_option = 1;
Lnextkine = 0;
Lcancel = 0;
if(atEOF) sprintf(dlog_infostr,"this kinemage = %d, next = %d, at EOF",
thiskinenum,kinemagenum);
else sprintf(dlog_infostr,"this kinemage = %d, next = %d " ,
thiskinenum,kinemagenum);
Ldlog_info = 1;
ACTIVE_DLOG = KINE_DLOG;
}
/*___kineDialog()___________________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****EndkineDialog()*********************************************************/
void EndkineDialog()
{
if(Ldlog_OKHIT)
{
/* interpret dlog_paramstr as kinemage number */
nextkinenum = intfromstr(dlog_paramAstr);
/*if(nextkinenum < 0) nextkinenum = 0;*/ /*971129 become permissive*/
findkinemage(); /*MAGEFILE.C*/ /*971129*/
}
else if(Ldlog_optionHIT)
{
/* just take the next kinemage */
nextkinenum = kinemagenum; /* There is a next number known*/
Lnextkine = 1; /* take whatever is next */
findkinemage(); /*MAGEFILE.C*/ /*971129*/
}
else if(Ldlog_cancelHIT)
{
/* don't change anything, just stay with current kinemage */
Lcancel = 1;
}
ACTIVE_DLOG = 0;
}
/*___EndkineDialog()________________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****DostereoDialog()********************************************************/
void DostereoDialog()
{
if(!ACTIVE_DLOG)
{
cleargenericflags(); /*MAGEDLOG.c*/
stereoDialog(); /*MAGEDLOG.c*/
DogenericDialog(); /*____DLOG.c*/
#ifndef UNIX_X11 /*called after DLOG_OKHIT_CB */
EndstereoDialog(); /*MAGEDLOG.c*/
/*970408*/ /*build redrawvec() etc. into EndstereoDialog*/
#endif
}
}
/*___DostereoDialog()_______________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****stereoDialog()**********************************************************/
void stereoDialog() /*STEREO_DLOG*/
{
sprintf(dlog_subjectstr,"Stereo and Display size parameters"); /*041031*/
Ldlog_subject = 1;
sprintf(dlog_paramAstr,"%.2f",stereoangle);
Ldlog_paramA = 1;
sprintf(dlog_textAstr,"set full stereo angle (degrees)");
Ldlog_textA = 1;
sprintf(dlog_paramBstr,"%d",ieyewide);
Ldlog_paramB = 1;
sprintf(dlog_textBstr,"set full separation (pixels)");
Ldlog_textB = 1;
sprintf(dlog_paramCstr,"%d",TBYoffset); /*970603*/
Ldlog_paramC = 1;
sprintf(dlog_textCstr,"TB Y offset (pixels)");
Ldlog_textC = 1;
sprintf(dlog_paramDstr,"%d",ieyeposition);
Ldlog_paramD = 1;
sprintf(dlog_textDstr,"set perspective eye position (pixels)");
Ldlog_textD = 1;
#ifdef UNIX_X11
sprintf(dlog_paramEstr,"%d",GWIDTH);
Ldlog_paramE = 1;
sprintf(dlog_textEstr,"graphics width (pixels)"); /*041031*/
Ldlog_textE = 1;
sprintf(dlog_paramFstr,"%d",GHEIGHT);
Ldlog_paramF = 1;
sprintf(dlog_textFstr,"graphics height (pixels)");
Ldlog_textF = 1;
#endif
dlog_checkAint = LTBstereo;
sprintf(dlog_checkAstr,"Top/Bottom for StereoGraphics CrystalEyes");
Ldlog_checkA = 1;
/*rotation around eye position adds considerable load to inner loop*/
/*requires back calc of eyeposition as a center in object space*/
/*which then has to be subtracted before, added after, each points rotation*/
/*
dlog_checkBint = Lrotateye;
sprintf(dlog_checkBstr,"rotate around eye position");
Ldlog_checkB = 1;
*/
dlog_checkBint = Lcenterinfo;
sprintf(dlog_checkBstr,"ptID and dist near center line");
Ldlog_checkB = 1;
sprintf(dlog_optionstr,"use defaults");
Ldlog_option = 1;
sprintf(dlog_infostr," default current"
CRLF" full angle: %.2f %.2f"
CRLF" full separation: %d %d"
CRLF CRLF"graphics Height== %d, Width== %d"
,defaultangle,stereoangle,ieyedefault,ieyewide
,GHEIGHT,GWIDTH);
Ldlog_info = 1;
ACTIVE_DLOG = STEREO_DLOG;
}
/*___stereoDialog()_________________________________________________________*/
/****EndstereoDialog()*******************************************************/
void EndstereoDialog()
{
int newwidth=0,newheight=0; /*041031*/
ACTIVE_DLOG = 0;
if(Ldlog_OKHIT)
{
stereoangle = floatfromstr(dlog_paramAstr);
ieyewide = intfromstr(dlog_paramBstr);
LTBstereo = dlog_checkAint;
TBYoffset = intfromstr(dlog_paramCstr);
ieyeposition = intfromstr(dlog_paramDstr);
#ifdef UNIX_X11
newwidth = intfromstr(dlog_paramEstr);
newheight = intfromstr(dlog_paramFstr);
if(newwidth != GWIDTH || newheight != GHEIGHT)
{
resizegrafwindow(newwidth,newheight); /*041031*/
}
#endif
/*Lrotateye = dlog_checkBint;*/
Lcenterinfo = dlog_checkBint;
/*ON: write ptID and dist near center line*/
adjuststereo(); /*MAGEMENU*/
}
else if(Ldlog_optionHIT)
{
stereoangle = defaultangle;
ieyewide = ieyedefault;
/*does NOT change stereo state, so windows, etc. stays the same*/
ieyeposition = ieyeposdefault;
/*Lrotateye = 0;*/ /*default: rotate around image object's center*/
Lcenterinfo = 0; /*ON: write ptID and dist near center line*/
redrawvec(); /*on spec.*/
}
else if(Ldlog_cancelHIT)
{
Lcancel = 1; /* don't change anything, just stay with current values */
}
}
/*___EndstereoDialog()______________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/*****DodrawlineDialog*******************************************************/
void DodrawlineDialog()
{
if(!ACTIVE_DLOG)
{
cleargenericflags(); /*MAGEDLOG.c*/
drawlineDialog(); /*MAGEDLOG.c*/
DogenericDialog(); /*MACDLOG.c*/
#ifndef UNIX_X11 /*called after DLOG_OKHIT_CB */
EnddrawlineDialog(); /*MAGEDLOG.c*/
#endif
LneedSetsinGrafWindow = 1; /*DrawControls(grafWindow); called in MAC*/
redrawvec(); /*____DRAW*/
}
}
/*___DodrawlineDialog_______________________________________________________*/
/****drawlineDialog()********************************************************/
void drawlineDialog() /*971129*/ /*DRAWNEW_DLOG*/
{
/*initial preferences if draw new not previously invoked */
if(!Ldrawstuff)
{
if(shortenline >.00001 || shortenline < -.00001) Ldrawunpickable = 1;
else Ldrawunpickable = 0;
}
sprintf(dlog_subjectstr
,"draw new: New Group of user-drawn lines and/or labels");
Ldlog_subject = 1;
sprintf(dlog_paramAstr,"%.2f",shortenline);
Ldlog_paramA = 1;
sprintf(dlog_textAstr,"shorten lines by this amount");
Ldlog_textA = 1;
dlog_checkAint = Ldrawunpickable;
sprintf(dlog_checkAstr,"line ends unpickable");
Ldlog_checkA = 1;
dlog_checkBint = Lmonitor; /*last line length*/
sprintf(dlog_checkBstr,"Monitor last line length");
Ldlog_checkB = 1;
dlog_checkCint = LSplitLine;/*971124SplitLine*/
sprintf(dlog_checkCstr,"DrawLine in 2 parts");
Ldlog_checkC = 1;
dlog_checkDint = Ldottedline;
sprintf(dlog_checkDstr,"dotted line");
Ldlog_checkD = 1;
dlog_checkEint = Larrowline;
sprintf(dlog_checkEstr,"arrow");
Ldlog_checkE = 1;
dlog_checkFint = Lmeasureddihedral;
sprintf(dlog_checkFstr,"measured dihedral labeled");
Ldlog_checkF = 1;
sprintf(dlog_OKstr,"OK"); /*971129*/
sprintf(dlog_infostr," ");/*filler so row of button boxes above have size*/
Ldlog_info = 2; /*filler==2 060619*/
ACTIVE_DLOG = DRAWNEW_DLOG;
}
/*___drawlineDialog()_______________________________________________________*/
/****EnddrawlineDialog()*****************************************************/
void EnddrawlineDialog() /*971129*/
{
if(Ldlog_cancelHIT) ; /*do nothing, ignore any changes*/
else if(Ldlog_OKHIT)
{
/*maybe wanted to change shortenline value*/
/*maybe unpickable is set/unset*/
/*maybe monitor last line is set/unset*/
shortenline = floatfromstr(dlog_paramAstr); /*MAGEUTIL.C*/
Ldrawunpickable = dlog_checkAint;
Lmonitor = dlog_checkBint; /*last line length*/
if(Lmonitor) Lmonitoron = 1; /*last line length*/
else Lmonitoron = 0; /*last line length*/
LSplitLine = dlog_checkCint; /*971124SplitLine*/
Ldottedline = dlog_checkDint; /*990710*/
Larrowline = dlog_checkEint;
Lmeasureddihedral = dlog_checkFint;
}
resetmenuchecks(); /*MAGEMENU*/ /*971010*/
ACTIVE_DLOG = 0;
}
/*___EnddrawlineDialog()____________________________________________________*/
/****DoConstructFifthDialog()************************************************/
void DoConstructFifthDialog() /*971122*/
{
if(!ACTIVE_DLOG)
{
cleargenericflags(); /*MAGEDLOG.c*/
ConstructFifthDialog(); /*MAGEDLOG.c*/
DogenericDialog(); /*____DLOG.c*/
#ifndef UNIX_X11 /*called after DLOG_OKHIT_CB */
EndConstructFifthDialog(); /*MAGEDLOG.c*/
#endif
}
}
/*___DoConstructFifthDialog()_______________________________________________*/
/****ConstructFifthDialog()**************************************************/
void ConstructFifthDialog() /*971122 construct5*/ /*CONSTRUCTFIFTH_DLOG*/
{
sprintf(dlog_subjectstr
,"Construct line to 5th pt, or line 5--6 based on previous 4 points");
Ldlog_subject = 1;
/*121110 MAGEDLOG.h: box strings are 64 char*/
/*1234567890123456789012345678901234567890123456789012345678901234*/
dlog_radioAint = LPerpendicularToPlane;
sprintf(dlog_radioAstr
,"Perpendicular from 4th pt to plane 1--2--3 ___________________");
Ldlog_radioA = 1;
dlog_radioBint = LPerpendicularBetweenLines;
sprintf(dlog_radioBstr,"Perpendicular between lines 1--2 & 3--4");
Ldlog_radioB = 1;
dlog_radioCint = LShortestBetweenLinesegments;
sprintf(dlog_radioCstr,"Shortest distance between segments 1--2 & 3--4");
Ldlog_radioC = 1;
dlog_radioDint = LAngleBetweenLines; /*140518*/
sprintf(dlog_radioDstr,"Angle between vectors 1--2 & 3--4"); /*140518*/
Ldlog_radioD = 1; /*140518*/
sprintf(dlog_infostr," ");/*filler so row of button boxes above have size*/
Ldlog_info = 2; /*filler==2 060619*/
ACTIVE_DLOG = CONSTRUCTFIFTH_DLOG;
}
/*___ConstructFifthDialog()_________________________________________________*/
/****EndConstructFifthDialog()***********************************************/
void EndConstructFifthDialog() /*971122*/
{
if(Ldlog_OKHIT)
{
LPerpendicularToPlane = dlog_radioAint;
LPerpendicularBetweenLines = dlog_radioBint;
LShortestBetweenLinesegments = dlog_radioCint;
LAngleBetweenLines = dlog_radioDint; /*140518*/
Lconstructperpendicular = 1;
doconstructline(); /*MAGEANGL.C*/
}
else if(Ldlog_cancelHIT)
{
LPerpendicularToPlane = 0;
LPerpendicularBetweenLines = 0;
LShortestBetweenLinesegments = 0;
LAngleBetweenLines = 0; /*140518*/
}
Lconstructperpendicular = 0;
LPerpendicularToPlane = 0;
LPerpendicularBetweenLines = 0;
LShortestBetweenLinesegments = 0;
LAngleBetweenLines = 0; /*140518*/
drawmarker1listptr->on = 0; /*turn off point indicaters*/
drawmarker2listptr->on = 0;
drawmarker3listptr->on = 0;
drawmarker4listptr->on = 0;
Lpoint = 0;
ACTIVE_DLOG = 0;
redrawvec(); /*141126*/
}
/*___EndConstructFifthDialog()______________________________________________*/
/****DoConstructSixthDialog()************************************************/
void DoConstructSixthDialog() /*140912*/
{
if(!ACTIVE_DLOG)
{
LNucleicAcidParameters = 1; /*140915 this default choice in dialog*/
LParameterlinekinemage = 0; /*140915 default choice in dialog*/
cleargenericflags(); /*MAGEDLOG.c*/
ConstructSixthDialog(); /*MAGEDLOG.c*/
DogenericDialog(); /*____DLOG.c*/
#ifndef UNIX_X11 /*called after DLOG_OKHIT_CB */
EndConstructSixthDialog(); /*MAGEDLOG.c*/
#endif
}
}
/*___DoConstructSixthDialog()_______________________________________________*/
/****ConstructSixthDialog()**************************************************/
void ConstructSixthDialog() /*140912 construct6*/ /*CONSTRUCTSIXTH_DLOG*/
{
sprintf(dlog_subjectstr
,"140912, Nucleic acid backbone pick: -1 n1, -1 c1', 1 c1', 1 n1, -1 P, 1 P"
CRLF"base n, ribose c1' of -1 residue, ribose c1', base n of next,"
CRLF"then P of intervening PO4, and P of next (#1) residue"
CRLF"IF NEXT P MISSING, CLICK ON EARLIER P AGAIN!"
// CRLF"6 atoms from which to compute (new) parameter set"
// CRLF"returns backbone params defined 140912 vintage..."
// CRLF"Construct6 name from historic drawline code model"
// CRLF"monitorparam lines constructed from 6 points"
); /*limited to 256 characters*/
Ldlog_subject = 1;
/*121110 MAGEDLOG.h: box strings are 64 char*/
/*1234567890123456789012345678901234567890123456789012345678901234*/
dlog_radioAint = LNucleicAcidParameters;
sprintf(dlog_radioAstr
,"NucleicAcidParameters to screen and param as text to stdout");
Ldlog_radioA = 1;
dlog_radioBint = LParameterlinekinemage;
sprintf(dlog_radioBstr
,"LParameterlinekinemage: param to screen, kinemage code: stdout");
Ldlog_radioB = 1;
sprintf(dlog_infostr," ");/*filler so row of button boxes above have size*/
Ldlog_info = 2; /*filler==2 060619*/
ACTIVE_DLOG = CONSTRUCTSIXTH_DLOG;
}
/*___ConstructSixthDialog()_________________________________________________*/
/****EndConstructSixthDialog()***********************************************/
void EndConstructSixthDialog() /*971122*/
{
if(Ldlog_OKHIT)
{
LNucleicAcidParameters = dlog_radioAint;
LParameterlinekinemage = dlog_radioBint;
/*Lpoint++;*/ /*so now will be routed rather than have picked point stored*/
/*not the place for this... */
doconstructline(); /*MAGEANGL.c uses LNucleicAcidParameters*/
}
else if(Ldlog_cancelHIT)
{
LNucleicAcidParameters = 0;
LParameterlinekinemage = 0;
}
/*reset Logical Flags: */
LNucleicAcidParameters = 0;
LParameterlinekinemage = 0;
drawmarker1listptr->on = 0; /*turn off point indicaters*/
drawmarker2listptr->on = 0;
drawmarker3listptr->on = 0;
drawmarker4listptr->on = 0;
drawmarker5listptr->on = 0;
drawmarker6listptr->on = 0; /*as of 140912 only 6 defined, 6 used here*/
Lpoint = 0;
ACTIVE_DLOG = 0;
redrawvec(); /*141126*/
}
/*___EndConstructSixthDialog()______________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/*****DoSearchDialog*********************************************************/
/* is done in a platform specific way because it is reentrant */
/*___DoSearchDialog_________________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****SearchDialog()**********************************************************/
void SearchDialog() /*FIND_DLOG*/ /*whole word option 051004*/
{
sprintf(dlog_subjectstr
// ,"Search pointID fields for words, numbers, or sets of characters"
//CRLF"Default mode matches single word or number, ignores spaces at ends,"
//CRLF"uncheck to match exact string, including spaces."
//CRLF"Each box can take one word or number,"
//CRLF"if both given, both matched."
,"Search pointID fields for words, numbers, or sets of characters"
CRLF"Default match exact string fragment, including spaces."
CRLF"check for isolated single word or number, ignores spaces at ends,"
CRLF"One fragment, word, number per box:"
CRLF"if both given, both matched."
); /*121109 NOTE: limited to 256 characters*/
Ldlog_subject = 1;
sprintf(dlog_paramAstr,"%s",user1str);
Ldlog_paramA = 1;
sprintf(dlog_textAstr,"Primary word, number, or set of characters");
Ldlog_textA = 1;
sprintf(dlog_paramBstr,"%s",user2str);
Ldlog_paramB = 1;
sprintf(dlog_textBstr,"Optional additional entry");
Ldlog_textB = 1;
sprintf(dlog_textCstr,"%s",searchstatusstr);
Ldlog_paramC = 0; /*do not show this box at first! */
Ldlog_textC = 1; /*use dlog_textCstr for, e.g., NOT FOUND message*/
if( Lmarkers) /*markers are in maxgrp+1 if there was room */
{
/*if there are markers available and nothing is on that*/
/*will flag that a search was successful, turn markers on*/
if( !Lnewlabelson
&& !Lnewballson
&& !Lpickcenteron
&& !markergrupptr->on)
{
dlog_checkAint = 1;
/*markergrupptr->on = 1;*/ /*force markers group on*/ /*not yet, 990119*/
}
else dlog_checkAint = markergrupptr->on; /*as it was*/
sprintf(dlog_checkAstr,"markers on");
Ldlog_checkA = 1;
}
else
{
dlog_checkAint = 0; /*no markers possible*/
sprintf(dlog_checkAstr," ");
Ldlog_checkA = 0;
}
Lpickcenteron = 1; /*020608 default*/
dlog_checkBint = Lpickcenteron;
sprintf(dlog_checkBstr,"pickcenter on");
Ldlog_checkB = 1;
if(Ltablepresent)
{
dlog_checkCint = Ltablesearchcells; /*000324*/
sprintf(dlog_checkCstr,"search table cells");
Ldlog_checkC = 1;
}
/*checkA ---- checkE all in one horizontal row */
/*checkF is in its own separate row below the A----E row */
dlog_checkFint = Lfindwholeword; /*051004, 121109 MAGEINIT/initialvalues */
/*sprintf(dlog_checkFstr,"search will match entire word or number");*/
sprintf(dlog_checkFstr,"search for isolated entire word or number");
Ldlog_checkF = 1;
dlog_radioAint = Lsearchbegin=1;
sprintf(dlog_radioAstr,"Search from beginning");
Ldlog_radioA = 1;
dlog_radioBint = !Lsearchbegin;
sprintf(dlog_radioBstr,"Find Next occurrence");
Ldlog_radioB = 1;
sprintf(dlog_OKstr,"Find");
sprintf(dlog_cancelstr,"CANCEL");
if(Lsearchstatus)
{
sprintf(dlog_optionstr,"re-hit last picked point");
Ldlog_option = 1;
}
sprintf(dlog_infostr,"marker, pickcenter, or label can be placed"
CRLF" use draw-new to set up for label"
CRLF" shortcut keys: F find, G find next"
);
Ldlog_info = 1;
ACTIVE_DLOG = FIND_DLOG;
}
/*___SearchDialog()_________________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****EndSearchDialog()*******************************************************/
void EndSearchDialog() /*FIND incl whole word*/
{
int Lfound = 0; /*000324*/
int Nblank = 0; /*000410*/
int j=0,k=0,n=0; /*051004*/
char whatstr[256],lookstr[256]; /*121109 for NOT FOUND info*/
if(Ldlog_OKHIT)
{
markergrupptr->on = dlog_checkAint;
Lpickcenteron = dlog_checkBint;
if(Ltablepresent) {Ltablesearchcells = dlog_checkCint;}
Lfindwholeword = dlog_checkFint; /*051004*/
/*search will match entire word or number*/
strcpy(user1str,dlog_paramAstr); /*save users original strings 051005*/
strcpy(user2str,dlog_paramBstr); /*051005*/
Lsearchbegin = dlog_radioAint; /* 1 search from beginning*/
/* 0 find next occurrence*/
if(Lsearchbegin || !Lsearchatend)
{/*can do a search*/
/*MAGEUTIL/matchstrings() has to honor Lfindwholeword 051004*/
if(Lfindwholeword) /*pad and/or strip space characters from ends*/
{
k = 0; /*index into search string*/
search1str[k++] = ' '; /*force leading blank on search string*/
n = 0; /*counter of non-space characters*/
for(j=0; j<32; j++)
{
if(dlog_paramAstr[j] == '\0') /*end of this string*/
{
break;
}
else if(dlog_paramAstr[j] == ' ') /*blank space encountered*/
{
if(n==0) /*no non-space character yet encountered */
{
continue; /*ignore leading spaces in typed input string*/
}
else /*space after non-space character */
{
break; /*end of non-space set of characters*/
}
}
else /*non-space character*/
{
search1str[k++] = dlog_paramAstr[j];
n++;
}
}
search1str[k++] = ' '; /*force trailing space*/
search1str[k] = '\0'; /*terminate string*/
}
else
{
sprintf(search1str,"%s",dlog_paramAstr); /*take exactly as inputed*/
}
for(isearch1=0; search1str[isearch1]!='\0';isearch1++) /*count char*/
{
if(search1str[isearch1]==' ') Nblank++; /*000410*/
}
if(Nblank == isearch1) isearch1=0;/*Do NOT search for field of blank(s)*/
if(Lfindwholeword) /*pad and/or strip space characters from ends*/
{
k = 0; /*index into search string*/
search2str[k++] = ' '; /*force leading blank on search string*/
n = 0; /*counter of non-space characters*/
for(j=0; j<32; j++)
{
if(dlog_paramBstr[j] == '\0') /*end of this string*/
{
break;
}
else if(dlog_paramBstr[j] == ' ') /*blank space encountered*/
{
if(n==0) /*no non-space character yet encountered */
{
continue; /*ignore leading spaces in typed input string*/
}
else /*space after non-space character */
{
break; /*end of non-space set of characters*/
}
}
else /*non-space character*/
{
search2str[k++] = dlog_paramBstr[j];
n++;
}
}
search2str[k++] = ' '; /*force trailing space*/
search2str[k] = '\0'; /*terminate string*/
}
else
{
sprintf(search2str,"%s",dlog_paramBstr); /*take exactly as inputed*/
}
for(isearch2=0; search2str[isearch2]!='\0';isearch2++){ ; } /*count char*/
if(isearch1 > 0) /*at least one char in essential string */
{
if(Ltablepresent && Ltablesearchcells) /*DO SEARCH IN TABLE*/
{/*search table cell contents: <comment> flag==1*/
Lfound = searchtablecells(1); /*MAGETABL.c*/ /*000324*/
if(Lfound) /*000411*/
{/*back pick this table cell to its corresponding points in graphics*/
removetablemarkpoints();
markfromtablecellsID(1);/*MAGETABL.c flag==1 for ptID matching*/
}
}
else
{/*DO SEARCH ON POINT IDs of GRAPHICS ITEMS*/
Lfound = mysearchpointID(1);/*MAGEUTIL.c for justone hit*/
}
if(Lfound) /*000324*/
{
sprintf(searchstatusstr," ");
Lsearched = 0; /*successful, so let dialog end*/
Lsearchstatus = 1;
}
else
{
/*121109 need more info back to user about a failed search*/
if(Lfindwholeword) {sprintf(whatstr,"Isolated TEXT ");}
else {sprintf(whatstr,"fragment TEXT ");}
if((isearch1 > 0) && (isearch2 > 0))
{sprintf(lookstr," %s %s ",search1str,search2str);}
else if(isearch1 > 0) {sprintf(lookstr," %s ",search1str);}
else if(isearch2 > 0) {sprintf(lookstr," %s ",search2str);}
sprintf(searchstatusstr,"%s %s NOT FOUND",whatstr,lookstr);
/*sprintf(searchstatusstr,"NOT FOUND"); 121109 replaced*/
Lsearchatend = 1;
Lsearched = 1; /*still searching, do dialog again*/
Lsearchstatus = 0;
}
}
else
{
sprintf(searchstatusstr,"NO SEARCH STRING");
Lsearched = 1; /*still searching, do dialog again*/
Lsearchstatus = 0;
}
}/*can do a search*/
else
{
sprintf(searchstatusstr,"AT END OF FILE");
Lsearched = 1; /*still searching, do dialog again*/
Lsearchstatus = 0;
}
}
else if(Ldlog_optionHIT && Lsearchstatus)
{
Lpick = 1; /* flag for successful pick */
ipick = 0; /*so will not try to find a pickpoint by cursor x,y*/
Lprepick = 1; /*so will know to apply pick process to pickvec */
pickedpointptr = searchpointptr;
pickedgrupptr = searchgrupptr;
pickedsgrpptr = searchsgrpptr;
pickedlistptr = searchlistptr;
sprintf(searchstatusstr," ");
Lsearched = 0; /*supposedly this point does exist, so let dialog end*/
Lsearchstatus = 1;
}
else if(Ldlog_cancelHIT)
{
Lcancel = 1; /* don't change anything, just quit */
Lsearched = 0; /* let dialog end */
}
else
{
sprintf(searchstatusstr,"TRY AGAIN");
Lsearched = 1; /*still searching, do dialog again*/
Lsearchstatus = 0;
}
if(Lpickcenteron && !Lcancel)
{
if(Lmeasureson) Lmeasureson=0;
if(Lnewlineson) Lnewlineson=0;
if(Lnewlabelson) Lnewlabelson=0;
if(Lnewballson) Lnewballson=0;
if(Ldraglineon) Ldraglineon=0;
if(Lconstruct4on) Lconstruct4on=0; /*971122*/
if(Lconstruct5on) Lconstruct5on=0; /*971122*/
if(Lconstruct6on) Lconstruct6on=0; /*140912*/
if(Lpickshowon) Lpickshowon=0; /*990408*/
if(Lmovepointson) Lmovepointson=0; /*061126*/
if(Lmeansigmason) Lmeansigmason=0; /*061126*/
if(Lpickcoloron) Lpickcoloron=0;
if(Lpruneon) Lpruneon = 0;
if(Lpunchon) Lpunchon = 0;
if(Lsuperpunchon) Lsuperpunchon = 0;
}
ACTIVE_DLOG = 0;
if(Lsearched)
{
/*do some minimal house cleaning for another cycle*/
Ldlog_OKHIT = 0;
Ldlog_optionHIT = 0;
Ldlog_cancelHIT = 0;
/*SearchDialog();*/ /*put up dialog box again*/ /*971001*/
/*DogenericDialog();*/ /*____DLOG.c*/ /*971001*/
}
}
/*___EndSearchDialog()______________________________________________________*/
/****DoViewsDialog()*********************************************************/
void DoViewsDialog(int j)
{
if(!ACTIVE_DLOG)
{
cleargenericflags(); /*MAGEDLOG.c*/
ViewsDialog(j);/*NOTE the int j */ /*MAGEDLOG.c*/
DogenericDialog(); /*MPCDLOG.c*/
#ifndef UNIX_X11 /*called after DLOG_OKHIT_CB*/
EndViewsDialog(); /*MAGEDLOG.c*/
#endif
}
}
/*___DoViewsDialog()________________________________________________________*/
/*3456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678*/
/****ViewsDialog()***********************************************************/
void ViewsDialog(int j) /*VIEW_DLOG*/ /*adjust view is MAGEANGL/resetrot()*/
{
if(j==0)
{/*work out best choice for this next view number*/
for(j=1;j<=MAXRESETS;j++)
if(Lview[j]==0) break;
if(j>MAXRESETS) j=MAXRESETS;
sprintf(dlog_subjectstr
,"Make current screen image a numbered view, or delete old view");
Ldlog_subject = 1;
}/*work out best choice for this next view number*/
else
{/*use the given number which was probably out of range*/
/*so the user can see why the earlier view update request failed*/
sprintf(dlog_subjectstr
,"%d Out-Of-Range: Erase then type a number between 1 and %d",j,MAXRESETS);
Ldlog_subject = 1;
}/*use the given number which was probably out of range*/
sprintf(dlog_paramAstr,"%d",j); /*old Mac 6 */
Ldlog_paramA = 1;
sprintf(dlog_textAstr,"Make view as currently seen be this number");
Ldlog_textA = 1;
sprintf(dlog_paramBstr,"%s",viewcom[iviewset]); /*old Mac 7 */
Ldlog_paramB = 1;
sprintf(dlog_textBstr,"View ID");
Ldlog_textB = 1;
sprintf(dlog_paramCstr,"last selected: %d",iviewset);
Ldlog_paramC = 1;
if(iviewset == 1)
sprintf(dlog_textCstr,"can't delete view1"); /*old Mac 4 */
else if(iviewset == MAXRESETS)
sprintf(dlog_textCstr,"view%-d (reader's view)",MAXRESETS);
else sprintf(dlog_textCstr,"View%1d %s",iviewset,viewcom[iviewset]);
Ldlog_textC = 1;
#ifdef UNIX_X11
sprintf(dlog_textDstr,"last selected-view size %d, %d (0,0 normal, other valuesstandardly ignored)"
,gwidthview[iviewset],gheightview[iviewset]);
Ldlog_textD = 1;
dlog_checkAint = 0;
sprintf(dlog_checkAstr,"save an expert-use view with current size %d, %d",GWIDTH,GHEIGHT);
Ldlog_checkA = 1;
sprintf(dlog_extrastr,"APPLY last view size"); /*041031*/
Ldlog_extra = 1;
#endif
if(LNdimensions) /*was L7dimensions 060622*/
{
dlog_checkFint = 1; /*A,B,C,D,E one row, F starts a new row of check boxes*/
sprintf(dlog_checkFstr,"make view include axischoice %d %d %d"
,NX+1,NY+1,NZ+1); /*061112 axes count from 1, internally stored from 0*/
Ldlog_checkF = 1;
}
sprintf(dlog_optionstr,"Delete last selected view");
Ldlog_option = 1;
sprintf(dlog_radioAstr,"store zoom value directly as a scaling value");
Ldlog_radioA = 1;
sprintf(dlog_radioBstr,"calculate span of image area from zoom value");
Ldlog_radioB = 1;
if(Lzoomer[j] >= 0)
{
dlog_radioAint = 1;