1 /* smdlg3.c
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information (NCBI)
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government do not place any restriction on its use or reproduction.
13 * We would, however, appreciate having the NCBI and the author cited in
14 * any work or product based on this material
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannot warrant the performance or results that
19 * may be obtained by using this software or data. The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * ===========================================================================
25 *
26 * File Name: smdlg3.c
27 *
28 * Author: Alex Smirnov
29 *
30 * Version Creation Date: 8/10/95
31 *
32 * $Revision: 6.2 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date Name Description of modification
39 * ------- ---------- -----------------------------------------------------
40 *
41 *
42 * ==========================================================================
43 */
44
45 /**************************************************************************/
46 /* INCLUDE */
47 /**************************************************************************/
48 #include <vibrant.h>
49 #include <picture.h>
50 #include <fstyle.h>
51 #include <fstylep.h>
52
53 /**************************************************************************/
54 /* DEFINES */
55 /**************************************************************************/
56 #define SM_DLG_FEAT 0
57 #define SM_DLG_EXTRA 1
58 #define SM_DLG_SEQ 2
59
60 #define SM_ARROW_SIZE 10
61
62 #define APPLAY_DLG_UP 1
63
64 /**************************************************************************/
65 /* TYPEDEFS */
66 /**************************************************************************/
67 typedef struct {
68 Int2 subClass;
69 Int2 pType;
70 } Nlm_ClipField, PNTR Nlm_ClipFieldPtr;
71
72 typedef struct {
73 Int2 checkNum[3];
74 Int4 musk[3];
75 } Nlm_ParamToCheck;
76
77 static void FeatureExtraDraw ( PaneL p );
78 static void SeqDraw ( PaneL p );
79
80 /**************************************************************************/
81 /* EXTERN VARIABLE */
82 /**************************************************************************/
83 extern CharPtr mSM_allfeatureNames[];
84
85 /**************************************************************************/
86 /* STATIC VARIABLE */
87 /**************************************************************************/
88 static Int2 curDlg;
89 static Int2 curSubDlg[3];
90 static Nlm_ClipField inClipSchema[] = {
91 /*0*/{MSM_SEGMENT,MSM_COLOR}, /*1*/{MSM_SEGMENT,MSM_SHADING},
92 /*2*/{MSM_SEGMENT,MSM_STYLE}, /*3*/{MSM_SEGMENT,MSM_HEIGHT},
93 /*4*/{MSM_SEG_BORD,MSM_COLOR}, /*5*/{MSM_SEG_BORD,MSM_TRUEFALSE},
94 /*6*/{MSM_SEG_BORD,MSM_LTYPE}, /*7*/{MSM_SEG_BORD,MSM_PENWIDTH},
95 /*8*/{MSM_FGAP,MSM_COLOR}, /*9*/{MSM_FGAP,MSM_STYLE},
96 /*10*/{MSM_FGAP,MSM_LTYPE}, /*11*/{MSM_FGAP,MSM_PENWIDTH},
97 /*12*/{MSM_FLABEL,MSM_COLOR}, /*13*/{MSM_FLABEL,MSM_STYLE},
98 /*14*/{MSM_FLABEL,MSM_FONT}, /*15*/{MSM_FLABEL,MSM_HEIGHT},
99 /*16*/{MSM_NOSUBCLASS,0}
100 };
101
102 #define MSM_SEG_SHOWORIENT 0x10 /* show orientation */
103 #define MSM_SEG_SHOWTRUNC 0x20 /* show trancation */
104 static Nlm_ParamToCheck paramToCheck[] = {
105 /*0*/{{3,-1,-1},{0,0,0}}, /*1*/{{4,-1,-1},{0,0,0}},
106 /*2*/{{0,2,5},{MSM_SEG_FORM,MSM_SEG_SHOWORIENT,MSM_SEG_SHOWTRUNC}},
107 /*3*/{{1,-1,-1},{0,0,0}},
108 /*4*/{{7,0,0},{0,0,0}}, /*5*/{{6,0,0},{0,0,0}},
109 /*6*/{{8,0,0},{0,0,0}}, /*7*/{{8,0,0},{0,0,0}},
110 /*8*/{{10,0,0},{0,0,0}}, /*9*/{{9,0,0},{0,0,0}},
111 /*10*/{{11,0,0},{0,0,0}}, /*11*/{{11,0,0},{0,0,0}},
112 /*12*/{{13,0,0},{0,0,0}}, /*13*/{{12,0,0},{0,0,0}},
113 /*14*/{{14,0,0},{0,0,0}}, /*15*/{{14,0,0},{0,0,0}}
114 };
115
116 static BigScalar inClipBoard[17];
117
118 static CharPtr folderFeatNamesF[] = {
119 "Segment","Border","Gap","Label", NULL
120 };
121 static CharPtr folderSeqNamesF[] = {
122 "Segment","Border","Sequence label", NULL
123 };
124 static CharPtr PNTR folderNamesF[3] = {
125 folderFeatNamesF, folderFeatNamesF, folderSeqNamesF
126 };
127 static GrouP hGroupsFeat[4];
128 static GrouP hGroupsExtra[4];
129 static GrouP hGroupsSeq[3];
130 static GrouP PNTR hGroups[3] = {
131 hGroupsFeat, hGroupsExtra, hGroupsSeq
132 };
133 static Nlm_PnlActnProc drawProc[3] = {
134 FeatureExtraDraw, FeatureExtraDraw, SeqDraw
135 };
136
137 static PaneL exPanel[3];
138
139 static PopuP featPopuP;
140 static LisT featList;
141 static Int2 featAr[100];
142 static Int2 curFeatInd;
143 static Int2 lastFeatInd;
144 static ButtoN applayButton;
145 static ButtoN applayChecks[15];
146
147 static Int2 curExtraInd;
148
149 static ButtoN pasteButton[3];
150
151 static ButtoN borderCheckBox[3] = {NULL,NULL,NULL};
152 static GrouP gapStlyleGroup[3] = {NULL,NULL,NULL};
153 static GrouP labelStyleGroup[3] = {NULL,NULL,NULL};
154 static GrouP segStyleGroup[3] = {NULL,NULL,NULL};
155 static PopuP segHeightPopup[3] = {NULL,NULL,NULL};
156 static ButtoN trancCheckBox[3] = {NULL,NULL,NULL};
157 static ButtoN orientCheckBox[3] = {NULL,NULL,NULL};
158
159 static FontSpec inFsp;
160
161 static CharPtr featLabelNames[] = {
162 "Type", "Content", "Type:Content", "Summary"
163 };
164 static CharPtr seqLabelNames[] = {
165 "FASTA short", "FASTA long", "TEXTID locus", "TEXTID accession",
166 "TEXTID report"
167 };
168 static Int2 groupAr[10];
169
170 static Nlm_Uint1 rectFillSym [] = {
171 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0x10,
172 0x10, 0x10, 0x10, 0xFE
173 };
174 static Nlm_Uint1 diamondFillSym [] = {
175 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x10,
176 0x10, 0x10, 0x10, 0xFE
177 };
178 static Nlm_Uint1 ovalFillSym [] = {
179 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10,
180 0x10, 0x10, 0x10, 0xFE
181 };
182 static Nlm_Uint1 downTriFillSym [] = {
183 0xFE, 0xFE, 0x7C, 0x7C, 0x38, 0x38, 0x10, 0x10,
184 0x10, 0x10, 0x10, 0xFE
185 };
186
187 static Int2 applayStatus = 0;
188
189 /**************************************************************************/
190 /* STATIC FUNCTION */
191 /**************************************************************************/
192 static void
SetMyColor(BigScalar color)193 /*FCN*/SetMyColor (
194 BigScalar color
195 ){
196 Uint1 r,g,b;
197
198 r = (Uint1)(color >> 16 ) & 0xFF;
199 g = (Uint1)(color >> 8 ) & 0xFF;;
200 b = (Uint1)color & 0xFF;
201 SelectColor (r,g,b);
202 }
203
204 static void
SetMyShadding(BigScalar shadding)205 /*FCN*/SetMyShadding (
206 BigScalar shadding
207 ){
208 switch (shadding){
209 case DARK_SHADING:
210 Dark();
211 break;
212 case MEDIUM_SHADING:
213 Medium();
214 break;
215 case LIGHT_SHADING:
216 Light();
217 break;
218 default:
219 Solid();
220 }
221 }
222
223 static void
SetMyLType(BigScalar ltype)224 /*FCN*/SetMyLType (
225 BigScalar ltype
226 ){
227 switch (ltype){
228 case DOTTED_LINE:
229 Dotted(); break;
230 case DASHED_LINE:
231 Dashed(); break;
232 default:
233 Solid();
234 }
235 }
236
237 static void
UpdateTools(void)238 /*FCN*/UpdateTools (
239 void
240 ){
241 BigScalar val, val1;
242 Int2 curClass;
243
244 switch ( curDlg ){
245 case SM_DLG_FEAT:
246 if ( curFeatInd == -1 ) {
247 Nlm_ShowToolsSM ( 0 );
248 return;
249 }
250 curClass = featAr[curFeatInd];
251 break;
252 case SM_DLG_EXTRA:
253 if ( curExtraInd == -1 ) {
254 Nlm_ShowToolsSM ( 0 );
255 return;
256 }
257 curClass = MSM_EXTRA_GENBANK - curExtraInd;
258 break;
259 default:
260 curClass = MSM_SEQUENCE;
261 }
262 /*Segment*/
263 if ( curSubDlg[curDlg] == 0 ){
264 val = Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_COLOR);
265 Nlm_SetToolDefaultSM ( SM_TOOLS_COLOR, val );
266 val = Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_SHADING);
267 Nlm_SetToolDefaultSM ( SM_TOOLS_SHADDING, val );
268 val = Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_LTYPE);
269 val1 = Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_PENWIDTH);
270 Nlm_SetToolDefaultSM ( SM_TOOLS_LTYPE, ((val1<<8)|val) );
271 val = Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_STYLE);
272 switch ( (Int2)val & MSM_SEG_FORM ){
273 case MSM_SEG_BOX:
274 Nlm_ShowToolsSM ( SM_SHTOOLS_COLOR|SM_SHTOOLS_SHADDING );
275 break;
276 case MSM_SEG_LINE:
277 Nlm_ShowToolsSM ( SM_SHTOOLS_COLOR|SM_SHTOOLS_LTYPE );
278 break;
279 default:
280 Nlm_ShowToolsSM ( SM_SHTOOLS_COLOR );
281 }
282 }
283 /* Border */
284 if ( curSubDlg[curDlg] == 1 ){
285 val = Nlm_GetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_COLOR);
286 Nlm_SetToolDefaultSM ( SM_TOOLS_COLOR, val );
287 val = Nlm_GetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_LTYPE);
288 val1 = Nlm_GetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_PENWIDTH);
289 Nlm_SetToolDefaultSM ( SM_TOOLS_LTYPE, ((val1<<8)|val) );
290 Nlm_ShowToolsSM ( SM_SHTOOLS_COLOR|SM_SHTOOLS_LTYPE );
291 }
292 /* Gap */
293 if ( (curSubDlg[curDlg] == 2)&&(curDlg != SM_DLG_SEQ) ){
294 val = Nlm_GetMuskCParamEd(curClass,MSM_FGAP,MSM_COLOR);
295 Nlm_SetToolDefaultSM ( SM_TOOLS_COLOR, val );
296 val = Nlm_GetMuskCParamEd(curClass,MSM_FGAP,MSM_LTYPE);
297 val1 = Nlm_GetMuskCParamEd(curClass,MSM_FGAP,MSM_PENWIDTH);
298 Nlm_SetToolDefaultSM ( SM_TOOLS_LTYPE, ((val1<<8)|val) );
299 Nlm_ShowToolsSM ( SM_SHTOOLS_COLOR|SM_SHTOOLS_LTYPE );
300 }
301 /*Label */
302 if ( ((curSubDlg[curDlg] == 2)&&(curDlg == SM_DLG_SEQ)) ||
303 ((curSubDlg[curDlg] == 3)&&(curDlg != SM_DLG_SEQ)) ){
304 if ( curDlg == SM_DLG_SEQ ){
305 val = Nlm_GetMuskCParamEd(curClass,MSM_SLABEL,MSM_COLOR);
306 } else {
307 val = Nlm_GetMuskCParamEd(curClass,MSM_FLABEL,MSM_COLOR);
308 }
309 Nlm_SetToolDefaultSM ( SM_TOOLS_COLOR, val );
310 val = Nlm_GetMuskCParamEd(curClass,MSM_FLABEL,MSM_FONT);
311 if ( val == 0 ){
312 Nlm_GetFontSpec ( (Nlm_FonT)Nlm_programFont, &inFsp);
313 } else {
314 Nlm_GetFontSpec ( (Nlm_FonT)val, &inFsp);
315 }
316 Nlm_SetToolDefaultSM ( SM_TOOLS_FONT, (BigScalar)&inFsp );
317 Nlm_ShowToolsSM ( SM_SHTOOLS_COLOR|SM_SHTOOLS_FONT );
318 }
319 }
320
321 static void
UpdateDlgControls(Boolean panel,Boolean other)322 /*FCN*/UpdateDlgControls (
323 Boolean panel,
324 Boolean other
325 ){
326 BigScalar val;
327 WindoW tmpPort;
328 Int2 curClass;
329 Int2 i;
330 RecT rp;
331
332 switch ( curDlg ){
333 case SM_DLG_FEAT:
334 if ( curFeatInd == -1 ) return;
335 curClass = featAr[curFeatInd];
336 break;
337 case SM_DLG_EXTRA:
338 if ( curExtraInd == -1 ) return;
339 curClass = MSM_EXTRA_GENBANK - curExtraInd;
340 break;
341 default:
342 curClass = MSM_SEQUENCE;
343 }
344 if ( other ){
345 val = Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_STYLE);
346 if ( curDlg == SM_DLG_SEQ ){
347 if ( val == MSM_SEG_BOX ) SetValue ( segStyleGroup[curDlg], 1 );
348 else SetValue ( segStyleGroup[curDlg], 2 );
349 } else {
350 switch ( val & MSM_SEG_FORM ){
351 case MSM_SEG_LINE: i=4; break;
352 case MSM_SEG_SYM_RECT: i=2; break;
353 case MSM_SEG_SYM_DIAMOND: i=5; break;
354 case MSM_SEG_SYM_OVAL: i=3; break;
355 case MSM_SEG_SYM_TRIANGLE: i=6; break;
356 default: i=1 ;
357 }
358 SetValue ( segStyleGroup[curDlg], i );
359 if ( val & MSM_SEG_SHOWORIENT ) SetStatus ( orientCheckBox[curDlg], TRUE );
360 else SetStatus ( orientCheckBox[curDlg], FALSE );
361 if ( val & MSM_SEG_SHOWTRUNC ) SetStatus ( trancCheckBox[curDlg], TRUE );
362 else SetStatus ( trancCheckBox[curDlg], FALSE );
363 }
364 val = Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_HEIGHT);
365 i = (Int2)((val - 4)/2 + 1);
366 if ( i <= 0 ) i = 1;
367 if ( i > 9 ) i = 9;
368 SetValue ( segHeightPopup[curDlg], i );
369 val = Nlm_GetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_TRUEFALSE);
370 SetValue ( borderCheckBox[curDlg], (Boolean)val );
371 val = Nlm_GetMuskCParamEd(curClass,MSM_FGAP,MSM_STYLE);
372 if ( curDlg != SM_DLG_SEQ ){
373 SetValue ( gapStlyleGroup[curDlg], (Int2)val + 1 );
374 }
375 val = Nlm_GetMuskCParamEd(curClass,MSM_FLABEL,MSM_STYLE);
376 if ( curDlg != SM_DLG_SEQ ){
377 switch ( val ){
378 case MSM_LABEL_TYPE: i=2; break;
379 case MSM_LABEL_CONTENT: i=3; break;
380 case MSM_LABEL_BOTH: i=4; break;
381 case MSM_LABEL_SUMMARY: i=5; break;
382 default: i=1;
383 }
384 } else {
385 switch ( val ){
386 case PRINTID_FASTA_LONG: i=2; break;
387 case PRINTID_TEXTID_LOCUS: i=3; break;
388 case PRINTID_TEXTID_ACCESSION: i=4; break;
389 case PRINTID_REPORT: i=5; break;
390 default: i=1;
391 }
392 }
393 SetValue(labelStyleGroup[curDlg],i);
394 }
395 if ( panel ){
396 ObjectRect ( exPanel[curDlg], &rp );
397 tmpPort = SavePort ( exPanel[curDlg] );
398 Select ( exPanel[curDlg] );
399 InvalRect ( &rp );
400 RestorePort ( tmpPort );
401 }
402 }
403
404 static void
FeatureExtraDraw(PaneL p)405 /*FCN*/FeatureExtraDraw(
406 PaneL p
407 ){
408 BigScalar val;
409 RecT rp;
410 RecT rdraw1;
411 RecT rdraw2;
412 Int2 curClass;
413 Int2 y0, y1, x0, x1, x2, x3;
414 Nlm_PoinT p1, p2;
415 Nlm_PoinT pPoly[3];
416 Boolean mayBeGap = FALSE;
417
418 ObjectRect ( p, &rp );
419 if ( curDlg == SM_DLG_FEAT ) {
420 if ( curFeatInd == -1 ) return;
421 curClass = featAr[curFeatInd];
422 } else {
423 if ( curExtraInd == -1 ) return;
424 curClass = MSM_EXTRA_GENBANK - curExtraInd;
425 }
426 val = Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_STYLE);
427 y0 = (rp.top + rp.bottom)/2;
428 x0 = rp.left+10; x1 = x2 = (rp.left + rp.right)/2; x3 = rp.right-10;
429 x1 -= 20; x2 += 20;
430 SetMyColor ( Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_COLOR));
431 switch ( val & MSM_SEG_FORM ){
432 case MSM_SEG_BOX:
433 y1 = y0 + (Int2)Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_HEIGHT);
434 if ( val & MSM_SEG_SHOWORIENT ){
435 x3 -= SM_ARROW_SIZE;
436 pPoly[0].x = pPoly[2].x = x3;
437 pPoly[1].x = x3+SM_ARROW_SIZE;
438 pPoly[0].y = y0-2;
439 pPoly[1].y = (y0+y1)/2-1;
440 pPoly[2].y = y1+1;
441 }
442 LoadRect ( &rdraw1, x0, y0, x1, y1 );
443 LoadRect ( &rdraw2, x2, y0, x3, y1 );
444 SetMyShadding ( Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_SHADING));
445 PaintRect ( &rdraw1 );
446 PaintRect ( &rdraw2 );
447 if ( val & MSM_SEG_SHOWORIENT ){
448 PaintPoly ( 3, &(pPoly[0]) );
449 }
450 if ( (Boolean)Nlm_GetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_TRUEFALSE) ){
451 WidePen ( (Int1)Nlm_GetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_PENWIDTH));
452 SetMyLType ( Nlm_GetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_LTYPE));
453 SetMyColor ( Nlm_GetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_COLOR));
454 FrameRect( &rdraw1 );
455 FrameRect( &rdraw2 );
456 if ( val & MSM_SEG_SHOWORIENT ){
457 FramePoly ( 3, &(pPoly[0]) );
458 }
459 }
460 mayBeGap = TRUE;
461 break;
462 case MSM_SEG_LINE:
463 y1 = y0+10;
464 if ( val & MSM_SEG_SHOWORIENT ){
465 x3 -= SM_ARROW_SIZE;
466 pPoly[0].x = pPoly[2].x = x3;
467 pPoly[1].x = x3+SM_ARROW_SIZE;
468 pPoly[0].y = y0;
469 pPoly[1].y = (y0+y1)/2;
470 pPoly[2].y = y1;
471 }
472 WidePen ( (Int1)Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_PENWIDTH));
473 SetMyLType ( Nlm_GetMuskCParamEd(curClass,MSM_SEGMENT,MSM_LTYPE));
474 p1.y = p2.y = (y0+y1)/2;
475 p1.x = x0; p2.x = x1;
476 DrawLine(p1,p2);
477 p1.x = x2; p2.x = x3;
478 DrawLine(p1,p2);
479 if ( val & MSM_SEG_SHOWORIENT ){
480 Solid();
481 PaintPoly ( 3, &(pPoly[0]) );
482 }
483 mayBeGap = TRUE;
484 break;
485 case MSM_SEG_SYM_RECT:
486 Nlm_LoadRect ( &rdraw1, x0, y0, x0 + 8, y0 + 12 );
487 Nlm_CopyBits (&rdraw1, &(rectFillSym[0]) );
488 break;
489 case MSM_SEG_SYM_DIAMOND:
490 Nlm_LoadRect ( &rdraw1, x0, y0, x0 + 8, y0 + 12 );
491 Nlm_CopyBits (&rdraw1, &(diamondFillSym[0]) );
492 break;
493 case MSM_SEG_SYM_OVAL:
494 Nlm_LoadRect ( &rdraw1, x0, y0, x0 + 8, y0 + 12 );
495 Nlm_CopyBits (&rdraw1, &(ovalFillSym[0]) );
496 break;
497 case MSM_SEG_SYM_TRIANGLE:
498 Nlm_LoadRect ( &rdraw1, x0, y0, x0 + 8, y0 + 12 );
499 Nlm_CopyBits (&rdraw1, &(downTriFillSym[0]) );
500 }
501 val = Nlm_GetMuskCParamEd(curClass,MSM_FGAP,MSM_STYLE);
502 if ( (val != MSM_GAP_NONE) && mayBeGap ){
503 SetMyColor ( Nlm_GetMuskCParamEd(curClass,MSM_FGAP,MSM_COLOR));
504 WidePen ( (Int1)Nlm_GetMuskCParamEd(curClass,MSM_FGAP,MSM_PENWIDTH));
505 SetMyLType ( Nlm_GetMuskCParamEd(curClass,MSM_FGAP,MSM_LTYPE));
506 if ( val == MSM_GAP_ANGLE ){
507 p1.x = x1; p2.x = (x1+x2)/2;
508 p1.y = (y0+y1)/2; p2.y = y0;
509 DrawLine(p1,p2);
510 p1.x = x2;
511 DrawLine(p1,p2);
512 } else {
513 p1.x = x1; p2.x = x2;
514 p1.y = p2.y = (y0+y1)/2;
515 DrawLine(p1,p2);
516 }
517 }
518 val = Nlm_GetMuskCParamEd(curClass,MSM_FLABEL,MSM_STYLE);
519 if ( val != MSM_LABEL_NONE ){
520 SetMyColor ( Nlm_GetMuskCParamEd(curClass,MSM_FLABEL,MSM_COLOR));
521 Nlm_SelectFont ((FonT)Nlm_GetMuskCParamEd(curClass,MSM_FLABEL,MSM_FONT));
522 y0 -= 5;
523 y1 = y0;
524 y0 -= (Int2)Nlm_GetMuskCParamEd(curClass,MSM_FLABEL,MSM_HEIGHT);
525 LoadRect ( &rdraw1, x0, y0, x3, y1 );
526 Nlm_DrawString ( &rdraw1, featLabelNames[(Int2)val], 'l', FALSE );
527 }
528 }
529
530 static void
SeqDraw(PaneL p)531 /*FCN*/SeqDraw(
532 PaneL p
533 ){
534 BigScalar val;
535 RecT rp;
536 RecT rdraw;
537 Int2 y0, y1, x0, x1;
538 Nlm_PoinT p1, p2;
539
540 ObjectRect ( p, &rp );
541 val = Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEGMENT,MSM_STYLE);
542 y0 = (rp.top + rp.bottom)/2;
543 x0 = rp.left+10; x1 = rp.right-10;
544 if ( val == MSM_SEG_BOX ){
545 y1 = y0 + (Int2)Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEGMENT,MSM_HEIGHT);
546 LoadRect ( &rdraw, x0, y0, x1, y1 );
547 SetMyColor ( Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEGMENT,MSM_COLOR));
548 SetMyShadding ( Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEGMENT,MSM_SHADING));
549 PaintRect ( &rdraw );
550 if ( (Boolean)Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEG_BORD,MSM_TRUEFALSE)){
551 WidePen ( (Int1)Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEG_BORD,MSM_PENWIDTH));
552 SetMyLType ( Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEG_BORD,MSM_LTYPE));
553 SetMyColor ( Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEG_BORD,MSM_COLOR));
554 FrameRect( &rdraw );
555 }
556 } else {
557 p1.x = x0; p2.x = x1;
558 p1.y = p2.y = (rp.top + rp.bottom)/2 + 1;
559 SetMyColor ( Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEGMENT,MSM_COLOR));
560 WidePen ( (Int1)Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEGMENT,MSM_PENWIDTH));
561 SetMyLType ( Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SEGMENT,MSM_LTYPE));
562 DrawLine(p1,p2);
563 }
564 val = Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_FLABEL,MSM_STYLE)-1;
565 SetMyColor ( Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_FLABEL,MSM_COLOR));
566 Nlm_SelectFont ((FonT)Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SLABEL,MSM_FONT));
567 y0 -= 5;
568 y1 = y0;
569 y0 -= (Int2)Nlm_GetMuskCParamEd(MSM_SEQUENCE,MSM_SLABEL,MSM_HEIGHT);
570 LoadRect ( &rdraw, x0, y0, x1, y1 );
571 Nlm_DrawString ( &rdraw, seqLabelNames[(Int2)val], 'l', FALSE );
572 }
573
574 static void
OnClipCopy(ButtoN b)575 /*FCN*/OnClipCopy (
576 ButtoN b
577 ){
578 Int2 curClass;
579 Int2 i;
580
581 switch ( curDlg ){
582 case SM_DLG_FEAT:
583 curClass = featAr[curFeatInd];
584 break;
585 case SM_DLG_EXTRA:
586 curClass = MSM_EXTRA_GENBANK - curExtraInd;
587 break;
588 default:
589 return;
590 }
591 for ( i=0; inClipSchema[i].subClass != MSM_NOSUBCLASS ;i++ ){
592 inClipBoard[i] = Nlm_GetMuskCParamEd( curClass, inClipSchema[i].subClass,
593 inClipSchema[i].pType );
594 }
595 Enable ( pasteButton[SM_DLG_FEAT] );
596 Enable ( pasteButton[SM_DLG_EXTRA] );
597 }
598
599 static void
OnClipPaste(ButtoN b)600 /*FCN*/OnClipPaste (
601 ButtoN b
602 ){
603 Int2 curClass;
604 Int2 i;
605
606 switch ( curDlg ){
607 case SM_DLG_FEAT:
608 curClass = featAr[curFeatInd];
609 break;
610 case SM_DLG_EXTRA:
611 curClass = MSM_EXTRA_GENBANK - curExtraInd;
612 break;
613 default:
614 return;
615 }
616 for ( i=0; inClipSchema[i].subClass != MSM_NOSUBCLASS ;i++ ){
617 Nlm_SetMuskCParamEd( curClass, inClipSchema[i].subClass,
618 inClipSchema[i].pType, inClipBoard[i] );
619 }
620 UpdateDlgControls(TRUE,TRUE);
621 }
622
623 static void
LoadFeatPopup(void)624 /*FCN*/LoadFeatPopup (
625 void
626 ){
627 Int2 tgroup;
628 Int2 i,j;
629 Int2 curInd = 0;
630
631 tgroup = (Int2)Nlm_GetMuskCParamEd(MSM_GROUPS,MSM_NOSUBCLASS,MSM_NUM);
632 for ( i=1; i<=tgroup; i++ ){
633 for ( j=1; j<=MSM_TOTAL_POSITIVE; j++ ){
634 if ( (Int2)Nlm_GetMuskCParamEd(j,MSM_FGROUP,MSM_NUM ) == i ) break;
635 }
636 if ( j > MSM_TOTAL_POSITIVE ) continue;
637 groupAr[curInd++] = i;
638 PopupItem ( featPopuP,
639 (CharPtr)Nlm_GetMuskCParamEd(MSM_GROUPS,i,MSM_STRING) );
640 }
641 }
642
643 static void
LoadFeatAr(void)644 /*FCN*/LoadFeatAr (
645 void
646 ){
647 Int2 i,j,k;
648 Int2 curGroup;
649 Int2 nHideFeatures;
650
651 curGroup = groupAr[GetValue ( featPopuP )-1];
652 nHideFeatures = 0;
653 for ( i=1; i<=MSM_TOTAL_POSITIVE; i++ ){
654 j = (Int2)Nlm_GetMuskCParamEd(i,MSM_FGROUP,MSM_NUM );
655 if ( j==curGroup ) {
656 j = (Int2)Nlm_GetMuskCParamEd(i,MSM_FORDER,MSM_NUM );
657 if ( j != 0 ){
658 featAr[j-1] = i;
659 nHideFeatures++;
660 }
661 }
662 }
663 k = nHideFeatures;
664 for ( i=1; i<=MSM_TOTAL_POSITIVE; i++ ){
665 j = (Int2)Nlm_GetMuskCParamEd(i,MSM_FGROUP,MSM_NUM );
666 if ( j==curGroup ) {
667 j = (Int2)Nlm_GetMuskCParamEd(i,MSM_FORDER,MSM_NUM );
668 if ( j == 0 ) featAr[k++] = i;
669 }
670 }
671 featAr[k] = 0;
672 featAr[MSM_TOTAL_POSITIVE_R] = MSM_TOTAL_POSITIVE_R;
673 }
674
675 static void
FillFetureList(Boolean needHide)676 /*FCN*/FillFetureList (
677 Boolean needHide
678 ){
679 Int2 i;
680
681 if ( needHide ){
682 Hide( featList );
683 Reset (featList);
684 }
685 i = 0;
686 while ( featAr[i] != 0 ){
687 ListItem ( featList, mSM_allfeatureNames[featAr[i]] );
688 i++;
689 }
690 if ( i == 0 ) curFeatInd = -1;
691 else {
692 SetItemStatus ( featList, 1, TRUE );
693 curFeatInd = 0;
694 lastFeatInd = -1;
695 }
696 if ( needHide ) Show( featList );
697 }
698
699 static void
OnFeaturePopUp(PopuP p)700 /*FCN*/OnFeaturePopUp(
701 PopuP p
702 ){
703 LoadFeatAr ();
704 FillFetureList(TRUE);
705 UpdateDlgControls(TRUE,TRUE);
706 UpdateTools();
707 }
708
709 static void
OnExtraList(LisT l)710 /*FCN*/OnExtraList (
711 LisT l
712 ){
713 curExtraInd = GetValue (l) - 1;
714 UpdateDlgControls(TRUE,TRUE);
715 UpdateTools();
716 }
717
718 static void
OnFeatList(LisT l)719 /*FCN*/OnFeatList (
720 LisT l
721 ){
722 Int2 i, ic, ilast;
723 Int2 curClass;
724
725 if ( curFeatInd == -1 ) return;
726 ic = 0;
727 for ( i=0; featAr[i] != 0; i++ ){
728 if ( GetItemStatus(l, i+1) ) {
729 ilast = i; ic++;
730 }
731 }
732 if ( ic == 0 ) {
733 if ( lastFeatInd == -1 ){
734 SetItemStatus(l, curFeatInd+1, TRUE );
735 } else {
736 curFeatInd = lastFeatInd;
737 lastFeatInd = -1;
738 SetItemStatus(l, curFeatInd+1, TRUE );
739 }
740 Disable ( applayButton );
741 } else if ( ic == 1 ) {
742 if ( lastFeatInd != -1 ){
743 lastFeatInd = -1;
744 Disable ( applayButton );
745 }
746 curFeatInd = ilast;
747 } else {
748 if ( lastFeatInd == -1 ){
749 lastFeatInd = curFeatInd;
750 curClass = featAr[curFeatInd];
751 for ( ic=0; inClipSchema[ic].subClass != MSM_NOSUBCLASS ;ic++ ){
752 Nlm_SetMuskCParamEd( MSM_TOTAL_POSITIVE_R, inClipSchema[ic].subClass,
753 inClipSchema[ic].pType,
754 Nlm_GetMuskCParamEd ( curClass,
755 inClipSchema[ic].subClass,inClipSchema[ic].pType));
756 }
757 curFeatInd = MSM_TOTAL_POSITIVE_R;
758 Enable ( applayButton );
759 }
760 }
761 UpdateDlgControls(TRUE,TRUE);
762 UpdateTools();
763 }
764
765 static void
OnBorderCheck(ButtoN b)766 /*FCN*/OnBorderCheck (
767 ButtoN b
768 ){
769 Int2 curClass;
770 BigScalar val;
771
772 switch ( curDlg ){
773 case SM_DLG_FEAT:
774 curClass = featAr[curFeatInd];
775 break;
776 case SM_DLG_EXTRA:
777 curClass = MSM_EXTRA_GENBANK - curExtraInd;
778 break;
779 default:
780 curClass = MSM_SEQUENCE;
781 }
782 if ( GetStatus(b) ) val = (BigScalar)TRUE;
783 else val = (BigScalar)FALSE;
784 Nlm_SetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_TRUEFALSE,val);
785 UpdateDlgControls(TRUE,FALSE);
786 }
787
788 static void
OnGapStyle(GrouP g)789 /*FCN*/OnGapStyle (
790 GrouP g
791 ){
792 Int2 curClass;
793 BigScalar val;
794
795 switch ( curDlg ){
796 case SM_DLG_FEAT:
797 curClass = featAr[curFeatInd];
798 break;
799 case SM_DLG_EXTRA:
800 curClass = MSM_EXTRA_GENBANK - curExtraInd;
801 break;
802 default:
803 return;
804 }
805 val = (BigScalar)(GetValue(g)-1);
806 Nlm_SetMuskCParamEd(curClass,MSM_FGAP,MSM_STYLE,val);
807 UpdateDlgControls(TRUE,FALSE);
808 }
809
810 static void
OnLabelStyle(GrouP g)811 /*FCN*/OnLabelStyle (
812 GrouP g
813 ){
814 Int2 curClass, curSubClass;
815 BigScalar val;
816
817 val = GetValue(g);
818 switch ( curDlg ){
819 case SM_DLG_FEAT:
820 curClass = featAr[curFeatInd];
821 curSubClass = MSM_FLABEL;
822 break;
823 case SM_DLG_EXTRA:
824 curClass = MSM_EXTRA_GENBANK - curExtraInd;
825 curSubClass = MSM_FLABEL;
826 break;
827 default:
828 curClass = MSM_SEQUENCE;
829 curSubClass = MSM_SLABEL;
830 }
831 if ( curDlg != SM_DLG_SEQ ){
832 switch ( val ){
833 case 2: val=MSM_LABEL_TYPE; break;
834 case 3: val=MSM_LABEL_CONTENT; break;
835 case 4: val=MSM_LABEL_BOTH; break;
836 case 5: val=MSM_LABEL_SUMMARY; break;
837 default: val=MSM_LABEL_NONE;
838 }
839 } else {
840 switch ( val ){
841 case 2: val=PRINTID_FASTA_LONG; break;
842 case 3: val=PRINTID_TEXTID_LOCUS; break;
843 case 4: val=PRINTID_TEXTID_ACCESSION; break;
844 case 5: val=PRINTID_REPORT; break;
845 default: val=PRINTID_FASTA_SHORT;
846 }
847 }
848 Nlm_SetMuskCParamEd(curClass,curSubClass,MSM_STYLE,val);
849 UpdateDlgControls(TRUE,FALSE);
850 }
851
852 static void
OnSegmentStyle(GrouP g)853 /*FCN*/OnSegmentStyle (
854 GrouP g
855 ){
856
857 Int2 curClass;
858 BigScalar val;
859
860 switch ( curDlg ){
861 case SM_DLG_FEAT:
862 curClass = featAr[curFeatInd];
863 break;
864 case SM_DLG_EXTRA:
865 curClass = MSM_EXTRA_GENBANK - curExtraInd;
866 break;
867 default:
868 curClass = MSM_SEQUENCE;
869 }
870 switch ( GetValue(segStyleGroup[curDlg]) ){
871 case 4: val = MSM_SEG_LINE; break;
872 case 2: val = MSM_SEG_SYM_RECT; break;
873 case 5: val = MSM_SEG_SYM_DIAMOND; break;
874 case 3: val = MSM_SEG_SYM_OVAL; break;
875 case 6: val = MSM_SEG_SYM_TRIANGLE; break;
876 default: val = MSM_SEG_BOX;
877 }
878 if ( curDlg == SM_DLG_SEQ ){
879 if ( val != MSM_SEG_BOX ) val = MSM_SEG_LINE;
880 } else {
881 if ( GetStatus (trancCheckBox[curDlg]) ) val |= MSM_SEG_SHOWTRUNC;
882 if ( GetStatus (orientCheckBox[curDlg]) ) val |= MSM_SEG_SHOWORIENT;
883 }
884 Nlm_SetMuskCParamEd(curClass,MSM_SEGMENT, MSM_STYLE, val);
885 UpdateDlgControls(TRUE,FALSE);
886 UpdateTools ();
887 }
888
889 static void
OnHeight(PopuP p)890 /*FCN*/OnHeight (
891 PopuP p
892 ){
893 Int2 curClass;
894 BigScalar val;
895
896 switch ( curDlg ){
897 case SM_DLG_FEAT:
898 curClass = featAr[curFeatInd];
899 break;
900 case SM_DLG_EXTRA:
901 curClass = MSM_EXTRA_GENBANK - curExtraInd;
902 break;
903 default:
904 curClass = MSM_SEQUENCE;
905 }
906 val = (BigScalar)GetValue(p) * 2 + 2;
907 Nlm_SetMuskCParamEd(curClass,MSM_SEGMENT, MSM_HEIGHT, val);
908 UpdateDlgControls(TRUE,FALSE);
909 }
910
911 static void
OnOrientation(ButtoN b)912 /*FCN*/OnOrientation (
913 ButtoN b
914 ){
915 OnSegmentStyle ( NULL );
916 }
917
918 static void
OnTrancation(ButtoN b)919 /*FCN*/OnTrancation (
920 ButtoN b
921 ){
922 OnSegmentStyle ( NULL );
923 }
924
925 static void
OnChangePage(VoidPtr data,Int2 newVal,Int2 oldVal)926 /*FCN*/OnChangePage (
927 VoidPtr data,
928 Int2 newVal,
929 Int2 oldVal
930 ){
931 SafeHide(hGroups[curDlg][oldVal]);
932 curSubDlg[curDlg] = newVal;
933 SafeShow(hGroups[curDlg][newVal]);
934 UpdateTools();
935 } /* End of OnChangePage () */
936
937 static void
OnWhole(ButtoN b,Int2 numF,Int2 numL)938 /*FCN*/OnWhole (
939 ButtoN b,
940 Int2 numF,
941 Int2 numL
942 ){
943 Int2 i;
944
945 if ( GetStatus (b) ){
946 for ( i=numF; i<=numL; i++ ) SetStatus ( applayChecks[i], TRUE );
947 } else {
948 for ( i=numF; i<=numL; i++ ) SetStatus ( applayChecks[i], FALSE );
949 }
950 }
951
952 static void
OnWholeSeg(ButtoN b)953 /*FCN*/OnWholeSeg (
954 ButtoN b
955 ){
956 OnWhole ( b, 0, 5 );
957 }
958
959 static void
OnWholeBorder(ButtoN b)960 /*FCN*/OnWholeBorder (
961 ButtoN b
962 ){
963 OnWhole ( b, 6, 8 );
964 }
965
966 static void
OnWholeGap(ButtoN b)967 /*FCN*/OnWholeGap (
968 ButtoN b
969 ){
970 OnWhole ( b, 9, 11 );
971 }
972
973 static void
OnWholeLabel(ButtoN b)974 /*FCN*/OnWholeLabel (
975 ButtoN b
976 ){
977 OnWhole ( b, 12, 14 );
978 }
979
980 static void
OnApplayApplay(ButtoN b)981 /*FCN*/OnApplayApplay (
982 ButtoN b
983 ){
984 Int4 curValue;
985 Int4 curMusk;
986 Int2 i, feat, j, chknum;
987 Int2 curClass;
988
989 applayStatus = 0;
990 for ( feat = 0; featAr[feat] != 0; feat++ ){
991 if ( GetItemStatus(featList, feat+1) ) {
992 curClass = featAr[feat];
993 for ( i=0; inClipSchema[i].subClass != MSM_NOSUBCLASS ;i++ ){
994 for ( j=0; j<3; j++ ){
995 chknum = paramToCheck[i].checkNum[j];
996 if ( chknum == -1 ) break;
997 curMusk = paramToCheck[i].musk[j];
998 if ( curMusk == 0 ){
999 if ( GetStatus ( applayChecks[chknum] ) ){
1000 Nlm_SetMuskCParamEd( curClass, inClipSchema[i].subClass,
1001 inClipSchema[i].pType,
1002 Nlm_GetMuskCParamEd ( MSM_TOTAL_POSITIVE_R,
1003 inClipSchema[i].subClass,inClipSchema[i].pType));
1004 }
1005 } else {
1006 if ( GetStatus ( applayChecks[chknum] ) ){
1007 curValue = (Int4)Nlm_GetMuskCParamEd( curClass,
1008 inClipSchema[i].subClass, inClipSchema[i].pType );
1009 curValue &= ~curMusk;
1010 curValue |= (Int4)Nlm_GetMuskCParamEd ( MSM_TOTAL_POSITIVE_R,
1011 inClipSchema[i].subClass,inClipSchema[i].pType );
1012 Nlm_SetMuskCParamEd( curClass, inClipSchema[i].subClass,
1013 inClipSchema[i].pType, (BigScalar)curValue );
1014 }
1015 }
1016 }
1017 }
1018 }
1019 }
1020 }
1021
1022 static void
OnApplayCancel(ButtoN b)1023 /*FCN*/OnApplayCancel (
1024 ButtoN b
1025 ){
1026 applayStatus = 0;
1027 }
1028
1029 static void
OnApplay(ButtoN b)1030 /*FCN*/OnApplay (
1031 ButtoN b
1032 ){
1033 WindoW w;
1034 GrouP gTop, gBottom, gTmp;
1035
1036 Nlm_DisableSM();
1037 w = MovableModalWindow (-40, -40, -10, -10, "Parameters to set", NULL );
1038 gTop = HiddenGroup ( w, 2, 4, NULL );
1039 SetGroupSpacing ( gTop, 15, 10 );
1040 SetGroupMargins ( gTop, 15, 10 );
1041 CheckBox ( gTop, "", OnWholeSeg );
1042 gTmp = NormalGroup ( gTop, 3, 2, "Segment", systemFont, NULL );
1043 SetGroupMargins ( gTmp, 15, 10 );
1044 applayChecks[0] = CheckBox ( gTmp, "Style", NULL );
1045 applayChecks[1] = CheckBox ( gTmp, "Height", NULL );
1046 applayChecks[2] = CheckBox ( gTmp, "Orientation", NULL );
1047 applayChecks[3] = CheckBox ( gTmp, "Color", NULL );
1048 applayChecks[4] = CheckBox ( gTmp, "Shading", NULL );
1049 applayChecks[5] = CheckBox ( gTmp, "Trancation", NULL );
1050 CheckBox ( gTop, "", OnWholeBorder );
1051 gTmp = NormalGroup ( gTop, 3, 2, "Border", systemFont, NULL );
1052 SetGroupMargins ( gTmp, 15, 10 );
1053 applayChecks[6] = CheckBox ( gTmp, "Style", NULL );
1054 applayChecks[7] = CheckBox ( gTmp, "Color", NULL );
1055 applayChecks[8] = CheckBox ( gTmp, "Line type", NULL );
1056 CheckBox ( gTop, "", OnWholeGap );
1057 gTmp = NormalGroup ( gTop, 3, 2, "Gap", systemFont, NULL );
1058 SetGroupMargins ( gTmp, 15, 10 );
1059 applayChecks[9] = CheckBox ( gTmp, "Style", NULL );
1060 applayChecks[10] = CheckBox ( gTmp, "Color", NULL );
1061 applayChecks[11] = CheckBox ( gTmp, "Line type", NULL );
1062 CheckBox ( gTop, "", OnWholeLabel );
1063 gTmp = NormalGroup ( gTop, 3, 2, "Label", systemFont, NULL );
1064 SetGroupMargins ( gTmp, 15, 10 );
1065 applayChecks[12] = CheckBox ( gTmp, "Style", NULL );
1066 applayChecks[13] = CheckBox ( gTmp, "Color", NULL );
1067 applayChecks[14] = CheckBox ( gTmp, "Font", NULL );
1068 gBottom = HiddenGroup ( w, 2, 1, NULL );
1069 PushButton ( gBottom, " Set ", OnApplayApplay );
1070 PushButton ( gBottom, "Cancel", OnApplayCancel );
1071 AlignObjects ( ALIGN_CENTER, (HANDLE)gTop, (HANDLE)gBottom, (HANDLE)NULL );
1072 applayStatus = APPLAY_DLG_UP;
1073 Show (w);
1074 Select (w);
1075 Nlm_WaitForCondition ( applayStatus & APPLAY_DLG_UP);
1076 Nlm_ProcessAnEvent ();
1077 Hide (w);
1078 Remove (w);
1079 Nlm_EnableSM();
1080 }
1081
1082 static GrouP
Nlm_CreateDlg(GrouP gTop)1083 /*FCN*/Nlm_CreateDlg (
1084 GrouP gTop
1085 ){
1086 GrouP gRet;
1087 GrouP gl, gr, gr1, gr2, gr3;
1088 GrouP gtmp, gtmp1;
1089 LisT l;
1090
1091 if ( curDlg != SM_DLG_SEQ ){
1092 gRet = HiddenGroup ( gTop, -2, 1, NULL );
1093 SetGroupSpacing ( gRet, 15, 1 );
1094 } else {
1095 gRet = HiddenGroup ( gTop, -1, 1, NULL );
1096 }
1097 if ( curDlg == SM_DLG_FEAT ){
1098 gl = gtmp = HiddenGroup ( gRet, 1, 5, NULL );
1099 #ifdef WIN_MOTIF
1100 SetGroupSpacing(gl,5,10 );
1101 #endif
1102 StaticPrompt ( gtmp, "Groups:", 0, 0, systemFont, 'l');
1103 featPopuP = PopupList ( gtmp, FALSE, OnFeaturePopUp );
1104 LoadFeatPopup();
1105 SetValue(featPopuP,1);
1106 StaticPrompt ( gtmp, "Features:", 0, 0, systemFont, 'l');
1107 featList = MultiList (gtmp, 10, 6, OnFeatList );
1108 LoadFeatAr();
1109 FillFetureList (FALSE);
1110 applayButton = PushButton ( gtmp, "Set for selection ...", OnApplay );
1111 Disable ( applayButton );
1112 } else if ( curDlg == SM_DLG_EXTRA ){
1113 gl = gtmp = HiddenGroup ( gRet, 1, 2, NULL );
1114 #ifdef WIN_MOTIF
1115 SetGroupSpacing(gl,5,10 );
1116 #endif
1117 StaticPrompt ( gtmp, "Extra:", 0, 0, systemFont, 'l');
1118 l = SingleList (gtmp, 10, 5, OnExtraList );
1119 ListItem ( l, "GENBANK" );
1120 ListItem ( l, "MEDLINE" );
1121 ListItem ( l, "BOTH" );
1122 SetValue ( l, 1 );
1123 }
1124 gr = HiddenGroup ( gRet, -1, 3, NULL );
1125 if ( curDlg != SM_DLG_SEQ ) {
1126 gr1 = HiddenGroup ( gr, 2,1, NULL );
1127 SetGroupSpacing( gr1, 10, 6 );
1128 exPanel[curDlg] = SimplePanel ( gr1, 250, 75, drawProc[curDlg] );
1129 gtmp = HiddenGroup ( gr1, 1,2, NULL );
1130 PushButton (gtmp,"Copy",OnClipCopy);
1131 pasteButton[curDlg] = PushButton (gtmp,"Paste",OnClipPaste);
1132 Disable ( pasteButton[curDlg] );
1133 } else {
1134 exPanel[curDlg] = SimplePanel ( gr, 400, 75, drawProc[curDlg] );
1135 gr1 = (GrouP)exPanel[curDlg];
1136 }
1137 gr2 = (GrouP)CreateFolderTabs ( gr, folderNamesF[curDlg], 0, 0, 0,
1138 SYSTEM_FOLDER_TAB, OnChangePage, NULL );
1139 gr3 = HiddenGroup ( gr, 0, 0, NULL );
1140 /* Border */
1141 hGroups[curDlg][1] = HiddenGroup ( gr3, -1, 1, NULL );
1142 borderCheckBox[curDlg] = CheckBox ( hGroups[curDlg][1],
1143 "Segment has the border", OnBorderCheck );
1144 Hide ( hGroups[curDlg][1] );
1145 if ( curDlg != SM_DLG_SEQ ) {
1146 /* Gap */
1147 hGroups[curDlg][2] = HiddenGroup ( gr3, -1, 1, NULL );
1148 gtmp = NormalGroup ( hGroups[curDlg][2], 3, 1, "Gap style",
1149 systemFont, OnGapStyle);
1150 gapStlyleGroup[curDlg] = gtmp;
1151 RadioButton ( gtmp, "None" );
1152 RadioButton ( gtmp, "Line" );
1153 RadioButton ( gtmp, "Angle" );
1154 Hide ( hGroups[curDlg][2] );
1155 }
1156 /* Label */
1157 if ( curDlg != SM_DLG_SEQ ) {
1158 hGroups[curDlg][3] = HiddenGroup ( gr3, -1, 1, NULL );
1159 gtmp = NormalGroup ( hGroups[curDlg][3], 3, 2, "Label style",
1160 systemFont, OnLabelStyle);
1161 RadioButton ( gtmp, "None" );
1162 RadioButton ( gtmp, "Type" );
1163 RadioButton ( gtmp, "Content" );
1164 RadioButton ( gtmp, "Both" );
1165 RadioButton ( gtmp, "Summary" );
1166 Hide ( hGroups[curDlg][3] );
1167 } else {
1168 hGroups[curDlg][2] = HiddenGroup ( gr3, -1, 1, NULL );
1169 gtmp = NormalGroup ( hGroups[curDlg][2], 3, 2, "Label style", systemFont,
1170 OnLabelStyle);
1171 RadioButton ( gtmp, "FASTA_Short" );
1172 RadioButton ( gtmp, "FASTA_Long" );
1173 RadioButton ( gtmp, "TEXTID_Locus" );
1174 RadioButton ( gtmp, "TEXTID_Accession" );
1175 RadioButton ( gtmp, "TEXTID_Report" );
1176 Hide ( hGroups[curDlg][2] );
1177 }
1178 labelStyleGroup[curDlg] = gtmp;
1179 /*Segment */
1180 hGroups[curDlg][0] = HiddenGroup ( gr3, 2, 1, NULL );
1181 SetGroupSpacing ( hGroups[curDlg][0], 10, 5 );
1182 if ( curDlg != SM_DLG_SEQ ) {
1183 gtmp = NormalGroup (hGroups[curDlg][0], 3,2, "Segment type",systemFont,
1184 OnSegmentStyle );
1185 } else {
1186 gtmp = NormalGroup (hGroups[curDlg][0], 1,2, "Segment type",systemFont,
1187 OnSegmentStyle );
1188 }
1189 segStyleGroup[curDlg] = gtmp;
1190 RadioButton ( gtmp, "Box" );
1191 if ( curDlg != SM_DLG_SEQ ) {
1192 RadioButton ( gtmp, "Rect" );
1193 RadioButton ( gtmp, "Diamond" );
1194 }
1195 RadioButton ( gtmp, "Line" );
1196 if ( curDlg != SM_DLG_SEQ ) {
1197 RadioButton ( gtmp, "Oval" );
1198 RadioButton ( gtmp, "Triangle" );
1199 }
1200 gtmp = HiddenGroup (hGroups[curDlg][0], 1,3, NULL);
1201 gtmp1 = HiddenGroup (gtmp, 2,1, NULL);
1202 StaticPrompt ( gtmp1, "Height:", 0, 0, systemFont, 'l');
1203 segHeightPopup[curDlg] = PopupList ( gtmp1, FALSE, OnHeight );
1204 PopupItem ( segHeightPopup[curDlg], "4" );
1205 PopupItem ( segHeightPopup[curDlg], "6" );
1206 PopupItem ( segHeightPopup[curDlg], "8" );
1207 PopupItem ( segHeightPopup[curDlg], "10" );
1208 PopupItem ( segHeightPopup[curDlg], "12" );
1209 PopupItem ( segHeightPopup[curDlg], "14" );
1210 PopupItem ( segHeightPopup[curDlg], "16" );
1211 PopupItem ( segHeightPopup[curDlg], "18" );
1212 PopupItem ( segHeightPopup[curDlg], "20" );
1213 if ( curDlg != SM_DLG_SEQ ) {
1214 orientCheckBox[curDlg] = CheckBox ( gtmp, "Orientation",
1215 OnOrientation );
1216 trancCheckBox[curDlg] = CheckBox ( gtmp, "Truncation",
1217 OnTrancation );
1218 }
1219 AlignObjects ( ALIGN_CENTER, (HANDLE)gr1, (HANDLE)gr2, (HANDLE)gr3, NULL );
1220 if ( curDlg != SM_DLG_SEQ ) {
1221 #ifndef WIN_MOTIF
1222 AlignObjects ( ALIGN_MIDDLE, (HANDLE)gr, (HANDLE)gl, NULL );
1223 #endif
1224 AlignObjects ( ALIGN_MIDDLE, (HANDLE)hGroups[curDlg][0],
1225 (HANDLE)hGroups[curDlg][1],(HANDLE)hGroups[curDlg][2],
1226 (HANDLE)hGroups[curDlg][3], NULL );
1227 AlignObjects ( ALIGN_CENTER, (HANDLE)hGroups[curDlg][0],
1228 (HANDLE)hGroups[curDlg][1],(HANDLE)hGroups[curDlg][2],
1229 (HANDLE)hGroups[curDlg][3], NULL );
1230 } else {
1231 AlignObjects ( ALIGN_MIDDLE, (HANDLE)hGroups[curDlg][0],
1232 (HANDLE)hGroups[curDlg][1],(HANDLE)hGroups[curDlg][2],
1233 NULL );
1234 AlignObjects ( ALIGN_CENTER, (HANDLE)hGroups[curDlg][0],
1235 (HANDLE)hGroups[curDlg][1],(HANDLE)hGroups[curDlg][2],
1236 NULL );
1237 }
1238 curSubDlg[curDlg] = 0;
1239 UpdateDlgControls (FALSE,TRUE);
1240 return gRet;
1241 } /* End of CreateDlgFeatures () */
1242
1243
1244 static void
Nlm_ToolDlg(Int2 tools)1245 /*FCN*/Nlm_ToolDlg (
1246 Int2 tools
1247 ){
1248 Int2 curClass, curSubClass;
1249 BigScalar val;
1250 FonT fnt;
1251 Int2 fsize;
1252
1253 switch ( curDlg ){
1254 case SM_DLG_FEAT:
1255 if ( curFeatInd == -1 ) return;
1256 curClass = featAr[curFeatInd];
1257 break;
1258 case SM_DLG_EXTRA:
1259 if ( curExtraInd == -1 ) return;
1260 curClass = MSM_EXTRA_GENBANK - curExtraInd;
1261 break;
1262 default:
1263 curClass = MSM_SEQUENCE;
1264 }
1265 if ( curSubDlg[curDlg] == 0 ){
1266 if ( tools == SM_TOOLS_COLOR ){
1267 val = Nlm_GetToolValueSM ( SM_TOOLS_COLOR );
1268 Nlm_SetMuskCParamEd(curClass,MSM_SEGMENT,MSM_COLOR,val);
1269 } else if ( tools == SM_TOOLS_SHADDING ){
1270 val = Nlm_GetToolValueSM ( SM_TOOLS_SHADDING );
1271 Nlm_SetMuskCParamEd(curClass,MSM_SEGMENT,MSM_SHADING,val);
1272 } else if ( tools == SM_TOOLS_LTYPE ){
1273 val = Nlm_GetToolValueSM (SM_TOOLS_LTYPE);
1274 Nlm_SetMuskCParamEd(curClass,MSM_SEGMENT,MSM_LTYPE, val&0xFF );
1275 Nlm_SetMuskCParamEd(curClass,MSM_SEGMENT,MSM_PENWIDTH, (val>>8)&0xFF );
1276 }
1277 } else if ( curSubDlg[curDlg] == 1 ){
1278 if ( tools == SM_TOOLS_COLOR ){
1279 val = Nlm_GetToolValueSM ( SM_TOOLS_COLOR );
1280 Nlm_SetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_COLOR,val);
1281 } else if ( tools == SM_TOOLS_LTYPE ){
1282 val = Nlm_GetToolValueSM (SM_TOOLS_LTYPE);
1283 Nlm_SetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_LTYPE, val&0xFF );
1284 Nlm_SetMuskCParamEd(curClass,MSM_SEG_BORD,MSM_PENWIDTH, (val>>8)&0xFF );
1285 }
1286 } else if ( (curSubDlg[curDlg] == 2)&&(curDlg != SM_DLG_SEQ) ){
1287 if ( tools == SM_TOOLS_COLOR ){
1288 val = Nlm_GetToolValueSM ( SM_TOOLS_COLOR );
1289 Nlm_SetMuskCParamEd(curClass,MSM_FGAP,MSM_COLOR,val);
1290 } else if ( tools == SM_TOOLS_LTYPE ){
1291 val = Nlm_GetToolValueSM (SM_TOOLS_LTYPE);
1292 Nlm_SetMuskCParamEd(curClass,MSM_FGAP,MSM_LTYPE, val&0xFF );
1293 Nlm_SetMuskCParamEd(curClass,MSM_FGAP,MSM_PENWIDTH, (val>>8)&0xFF );
1294 }
1295 } else {
1296 if ( curDlg == SM_DLG_SEQ ){
1297 curSubClass = MSM_SLABEL;
1298 } else {
1299 curSubClass = MSM_FLABEL;
1300 }
1301 if ( tools == SM_TOOLS_COLOR ){
1302 val = Nlm_GetToolValueSM ( SM_TOOLS_COLOR );
1303 Nlm_SetMuskCParamEd(curClass,curSubClass,MSM_COLOR,val);
1304 } else if ( tools == SM_TOOLS_FONT ){
1305 val = Nlm_GetToolValueSM ( SM_TOOLS_FONT );
1306 fnt = Nlm_LoadMuskFont ( (Nlm_FontSpecPtr)val, 0, &fsize );
1307 Nlm_SetMuskCParamEd(curClass,curSubClass,MSM_FONT,(BigScalar)fnt);
1308 Nlm_SetMuskCParamEd(curClass,curSubClass,MSM_HEIGHT,fsize);
1309 }
1310 }
1311 UpdateDlgControls ( TRUE, TRUE );
1312 }
1313
Nlm_SetTDef(void)1314 static void Nlm_SetTDef (
1315 void
1316 ){
1317 if ( (curDlg == SM_DLG_FEAT) && Msk_OrderWasModified() ){
1318 Hide ( featPopuP );
1319 Reset (featPopuP );
1320 LoadFeatPopup();
1321 SetValue(featPopuP,1);
1322 Show ( featPopuP );
1323 LoadFeatAr();
1324 FillFetureList (TRUE);
1325 UpdateDlgControls (TRUE,TRUE);
1326 }
1327 UpdateTools();
1328 }
1329
1330 /**************************************************************************/
1331 /* GLOBAL FUNCTIONS */
1332 /**************************************************************************/
1333
1334 GrouP
Nlm_CreateDlgFeatures(GrouP gTop)1335 /*FCN*/Nlm_CreateDlgFeatures (
1336 GrouP gTop
1337 ){
1338 curDlg = SM_DLG_FEAT;
1339 return Nlm_CreateDlg ( gTop );
1340 } /* End of CreateDlgFeatures () */
1341
1342 void
Nlm_ToolDlgFeatures(Int2 tools)1343 /*FCN*/Nlm_ToolDlgFeatures (
1344 Int2 tools
1345 ){
1346 curDlg = SM_DLG_FEAT;
1347 Nlm_ToolDlg ( tools );
1348 }
1349
Nlm_SetTDefFeatures(void)1350 void Nlm_SetTDefFeatures (
1351 void
1352 ){
1353 curDlg = SM_DLG_FEAT;
1354 Nlm_SetTDef ();
1355 }
1356
1357 GrouP
Nlm_CreateDlgSeq(GrouP gTop)1358 /*FCN*/Nlm_CreateDlgSeq (
1359 GrouP gTop
1360 ){
1361 curDlg = SM_DLG_SEQ;
1362 return Nlm_CreateDlg ( gTop );
1363 } /* End of CreateDlgFeatures () */
1364
1365 void
Nlm_ToolDlgSeq(Int2 tools)1366 /*FCN*/Nlm_ToolDlgSeq (
1367 Int2 tools
1368 ){
1369 curDlg = SM_DLG_SEQ;
1370 Nlm_ToolDlg ( tools );
1371 }
1372
Nlm_SetTDefSeq(void)1373 void Nlm_SetTDefSeq (
1374 void
1375 ){
1376 curDlg = SM_DLG_SEQ;
1377 Nlm_SetTDef ();
1378 }
1379
1380 GrouP
Nlm_CreateDlgExtra(GrouP gTop)1381 /*FCN*/Nlm_CreateDlgExtra (
1382 GrouP gTop
1383 ){
1384 curDlg = SM_DLG_EXTRA;
1385 return Nlm_CreateDlg ( gTop );
1386 } /* End of CreateDlgFeatures () */
1387
1388 void
Nlm_ToolDlgExtra(Int2 tools)1389 /*FCN*/Nlm_ToolDlgExtra (
1390 Int2 tools
1391 ){
1392 curDlg = SM_DLG_EXTRA;
1393 Nlm_ToolDlg ( tools );
1394 }
1395
Nlm_SetTDefExtra(void)1396 void Nlm_SetTDefExtra (
1397 void
1398 ){
1399 curDlg = SM_DLG_EXTRA;
1400 Nlm_SetTDef ();
1401 }
1402
1403 /* END */
1404