Doxygen Source Code Documentation
afni_ttren.c File Reference
#include "afni.h"#include <Xm/XmAll.h>Go to the source code of this file.
Data Structures | |
| struct | TTRR_controls |
Defines | |
| #define | NUM_AV_FIRST 20 |
| #define | TTRR_clear_label "Clear" |
| #define | TTRR_load_label "Load" |
| #define | TTRR_save_label "Save" |
| #define | TTRR_redraw_label "Redraw" |
| #define | TTRR_done_label "Done" |
| #define | TTRR_help_label "Help" |
| #define | TTRR_clear_hint "Set all colors to 'none'" |
| #define | TTRR_load_hint "Load colors from a file" |
| #define | TTRR_save_hint "Save colors to a file" |
| #define | TTRR_redraw_hint "Redraw using current colors" |
| #define | TTRR_done_hint "Close this window" |
| #define | NUM_TTRR_ACT 6 |
| #define | NMETHOD 5 |
| #define | METHOD_OFF "Off" |
| #define | METHOD_GAF "Gyral/Area/Func" |
| #define | METHOD_AGF "Area/Gyral/Func" |
| #define | METHOD_FGA "Func/Gyral/Area" |
| #define | METHOD_FAG "Func/Area/Gyral" |
| #define | NHEMI 3 |
| #define | HEMI_LEFT "Left only" |
| #define | HEMI_RIGHT "Right only" |
| #define | HEMI_BOTH "Both" |
| #define | LUCK 5 |
| #define | CMMAX 17 |
| #define | NLBUF 1024 |
Functions | |
| void | TTRR_action_CB (Widget, XtPointer, XtPointer) |
| void | TTRR_delete_window_CB (Widget, XtPointer, XtPointer) |
| void | TTRR_av_CB (MCW_arrowval *, XtPointer) |
| void | TTRR_load_file (char *) |
| void | TTRR_save_CB (Widget, XtPointer, MCW_choose_cbs *) |
| void | TTRR_load_CB (Widget, XtPointer, MCW_choose_cbs *) |
| void | TTRR_setup_widgets (MCW_DC *dc) |
| void | TTRR_popup (Three_D_View *im3d) |
| TTRR_params * | TTRR_get_params (void) |
Variables | |
| TTRR_controls * | ttc = NULL |
| MCW_action_item | TTRR_act [] |
| char * | METHOD_strings [NMETHOD] |
| char * | HEMI_strings [NHEMI] = { HEMI_LEFT , HEMI_RIGHT , HEMI_BOTH } |
| char | helpstring [] |
| TTRR_params * | ttp = NULL |
Define Documentation
|
|
|
|
|
Definition at line 81 of file afni_ttren.c. |
|
|
Definition at line 79 of file afni_ttren.c. |
|
|
Definition at line 80 of file afni_ttren.c. |
|
|
|
|
|
Definition at line 70 of file afni_ttren.c. |
|
|
Definition at line 72 of file afni_ttren.c. |
|
|
Definition at line 71 of file afni_ttren.c. |
|
|
Definition at line 69 of file afni_ttren.c. |
|
|
Definition at line 68 of file afni_ttren.c. |
|
|
Definition at line 78 of file afni_ttren.c. Referenced by TTRR_setup_widgets(). |
|
|
|
|
|
Definition at line 67 of file afni_ttren.c. Referenced by TTRR_setup_widgets(). |
|
|
Definition at line 5 of file afni_ttren.c. Referenced by TTRR_setup_widgets(). |
|
|
Definition at line 56 of file afni_ttren.c. Referenced by TTRR_setup_widgets(). |
|
|
Definition at line 50 of file afni_ttren.c. |
|
|
Definition at line 43 of file afni_ttren.c. Referenced by TTRR_action_CB(). |
|
|
Definition at line 54 of file afni_ttren.c. |
|
|
Definition at line 47 of file afni_ttren.c. Referenced by TTRR_action_CB(). |
|
|
Definition at line 48 of file afni_ttren.c. Referenced by TTRR_action_CB(). |
|
|
Definition at line 51 of file afni_ttren.c. |
|
|
Definition at line 44 of file afni_ttren.c. Referenced by TTRR_action_CB(). |
|
|
Definition at line 53 of file afni_ttren.c. |
|
|
Definition at line 46 of file afni_ttren.c. Referenced by TTRR_action_CB(). |
|
|
Definition at line 52 of file afni_ttren.c. |
|
|
Definition at line 45 of file afni_ttren.c. Referenced by TTRR_action_CB(). |
Function Documentation
|
||||||||||||||||
|
Definition at line 508 of file afni_ttren.c. References AV_assign_ival(), TTRR_controls::av_invert, BEEPIT, ENTRY, helpstring, MCW_arrowval::ival, MCW_choose_string(), MCW_invert_widget(), new_MCW_textwin(), MCW_arrowval::old_ival, TTRR_controls::reg_av, TTRR_controls::reg_num, TEXT_READONLY, TTRR_clear_label, TTRR_delete_window_CB(), TTRR_done_label, TTRR_help_label, TTRR_load_CB(), TTRR_load_label, TTRR_redraw_label, TTRR_save_CB(), TTRR_save_label, and MCW_arrowval::wrowcol.
00509 {
00510 char * wname = XtName(w) ;
00511 int ii ;
00512
00513 ENTRY("TTRR_action_CB") ;
00514
00515 if( strcmp(wname,TTRR_help_label) == 0 ){
00516
00517 new_MCW_textwin( w , helpstring , TEXT_READONLY ) ;
00518
00519 } else if( strcmp(wname,TTRR_done_label) == 0 ){
00520
00521 TTRR_delete_window_CB(NULL,NULL,NULL) ;
00522
00523 } else if( strcmp(wname,TTRR_clear_label) == 0 ){
00524
00525 /* restore colormenus to 'none' status */
00526
00527 for( ii=0 ; ii < ttc->reg_num ; ii++ ){
00528 if( ttc->reg_av[ii]->ival != 0 ){
00529 AV_assign_ival( ttc->reg_av[ii] , 0 ) ;
00530
00531 if( ttc->av_invert && ttc->reg_av[ii]->old_ival != 0 )
00532 MCW_invert_widget(ttc->reg_av[ii]->wrowcol);
00533 }
00534 }
00535
00536 } else if( strcmp(wname,TTRR_redraw_label) == 0 ){
00537
00538 BEEPIT ;
00539
00540 } else if( strcmp(wname,TTRR_load_label) == 0 ){
00541
00542 MCW_choose_string( w , "Filename to load" , NULL ,
00543 TTRR_load_CB , NULL ) ;
00544
00545 } else if( strcmp(wname,TTRR_save_label) == 0 ){
00546
00547 MCW_choose_string( w , "Filename to save" , NULL ,
00548 TTRR_save_CB , NULL ) ;
00549 }
00550
00551 EXRETURN ;
00552 }
|
|
||||||||||||
|
Definition at line 494 of file afni_ttren.c. References TTRR_controls::av_invert, MCW_arrowval::ival, MCW_invert_widget(), MCW_arrowval::old_ival, and MCW_arrowval::wrowcol. Referenced by TTRR_setup_widgets().
|
|
||||||||||||||||
|
Definition at line 559 of file afni_ttren.c. References ENTRY, and TTRR_controls::shell. Referenced by TTRR_action_CB(), and TTRR_setup_widgets().
|
|
|
Definition at line 577 of file afni_ttren.c. References ENTRY, TTRR_params::hemi, TTRR_controls::hemi_av, MCW_arrowval::ival, malloc, TTRR_params::meth, TTRR_controls::meth_av, myXtNew, TTRR_params::num, TTRR_controls::reg_av, TTRR_controls::reg_num, TTRR_controls::reg_ttbrik, TTRR_controls::reg_ttovc, TTRR_controls::reg_ttval, RETURN, TTRR_params::ttbrik, TTRR_params::ttovc, TTRR_METH_OFF, and TTRR_params::ttval. Referenced by AFNI_ttatlas_overlay(), RCREND_overlay_ttatlas(), and REND_overlay_ttatlas().
00578 {
00579 int ii,jj ;
00580
00581 ENTRY("TTRR_get_params") ;
00582
00583 if( ttc == NULL ) RETURN(NULL) ; /* report nothing */
00584
00585 if( ttc->meth_av->ival == TTRR_METH_OFF ) RETURN(NULL) ;
00586
00587 /* 1st time in: make reporting struct */
00588
00589 if( ttp == NULL ){
00590 ttp = myXtNew(TTRR_params) ;
00591 ttp->ttbrik = (byte *) malloc(sizeof(byte)*ttc->reg_num) ;
00592 ttp->ttval = (byte *) malloc(sizeof(byte)*ttc->reg_num) ;
00593 ttp->ttovc = (byte *) malloc(sizeof(byte)*ttc->reg_num) ;
00594 }
00595
00596 /* set method codes */
00597
00598 ttp->meth = ttc->meth_av->ival ;
00599 ttp->hemi = ttc->hemi_av->ival ; /* hemisphere */
00600
00601 /* make list of all 'on' regions */
00602
00603 for( ii=jj=0 ; ii < ttc->reg_num ; ii++ ){
00604 ttc->reg_ttovc[ii] = ttc->reg_av[ii]->ival ;
00605 if( ttc->reg_ttovc[ii] > 0 ){
00606 ttp->ttbrik[jj] = (byte) ttc->reg_ttbrik[ii] ;
00607 ttp->ttval [jj] = (byte) ttc->reg_ttval [ii] ;
00608 ttp->ttovc [jj] = (byte) ttc->reg_ttovc [ii] ;
00609 jj++ ;
00610 }
00611 }
00612
00613 ttp->num = jj ; /* number of 'on' regions */
00614 RETURN(ttp) ;
00615 }
|
|
||||||||||||||||
|
Definition at line 664 of file afni_ttren.c. References MCW_choose_cbs::cval, mcwCR_string, PLUTO_beep(), MCW_choose_cbs::reason, THD_is_file(), and TTRR_load_file(). Referenced by TTRR_action_CB().
00665 {
00666 if( cbs->reason != mcwCR_string ||
00667 cbs->cval == NULL || strlen(cbs->cval) == 0 ){
00668
00669 PLUTO_beep() ; return ;
00670 }
00671
00672 if( !THD_is_file(cbs->cval) ){ PLUTO_beep(); return; }
00673
00674 TTRR_load_file( cbs->cval ) ; return ;
00675 }
|
|
|
Definition at line 619 of file afni_ttren.c. References AV_assign_ival(), breakup_string(), color, TTRR_controls::dc, DC_find_overlay_color(), freeup_strings(), ig_strstr(), name, TTRR_controls::reg_av, TTRR_controls::reg_label, and TTRR_controls::reg_num. Referenced by TTRR_load_CB(), and TTRR_setup_widgets().
00620 {
00621 FILE *fp = fopen(fname,"r") ;
00622
00623 #define NLBUF 1024
00624 if( fp != NULL ){
00625 char lbuf[NLBUF], **stok , *name, *color, *ept ;
00626 int ns , ic , ii ;
00627
00628 while(1){
00629 ept = fgets( lbuf , NLBUF , fp ) ; /* get line */
00630 if( ept == NULL ) break ; /* end of file */
00631 stok = NULL ;
00632 ns = breakup_string( lbuf , &stok ) ; /* break it up */
00633 if( ns <= 0 || stok == NULL ) continue ; /* skip */
00634 if( ns == 1 ){ freeup_strings(ns,stok); continue; } /* skip */
00635 if( stok[0][0] == '#' ||
00636 (stok[0][0] == '/' && stok[0][1] == '/') )
00637 { freeup_strings(ns,stok); continue; } /* skip */
00638 name = stok[0] ; /* region name */
00639 if( ns == 2 ) color = stok[1] ; /* overlay color name */
00640 else color = stok[2] ;
00641 ic = DC_find_overlay_color( ttc->dc , color ) ;
00642 if( ic < 0 ){ freeup_strings(ns,stok); continue; } /* skip */
00643
00644 /* find region name in list; assign color to menu */
00645
00646 for( ii=0 ; ii < ttc->reg_num ; ii++ ){
00647 if( ig_strstr( ttc->reg_label[ii], name, "._ " ) != NULL ){
00648 AV_assign_ival( ttc->reg_av[ii] , ic ) ;
00649 }
00650 }
00651
00652 freeup_strings(ns,stok) ;
00653 }
00654
00655 fclose(fp) ; /* done with file */
00656 }
00657
00658 return ;
00659 }
|
|
|
compute information about regions * Definition at line 478 of file afni_ttren.c. References Three_D_View::dc, ENTRY, TTRR_controls::im3d, TTRR_controls::shell, and TTRR_setup_widgets(). Referenced by AFNI_imag_pop_CB().
|
|
||||||||||||||||
|
Definition at line 679 of file afni_ttren.c. References color, MCW_choose_cbs::cval, TTRR_controls::dc, MCW_arrowval::ival, MCW_DCOV::label_ov, mcwCR_string, name, MCW_DC::ovc, PLUTO_beep(), MCW_choose_cbs::reason, TTRR_controls::reg_av, TTRR_controls::reg_label, and TTRR_controls::reg_num. Referenced by TTRR_action_CB().
00680 {
00681 int ii , qq , jj ;
00682 FILE *fp ;
00683 char name[128] , *color ;
00684
00685 if( cbs->reason != mcwCR_string ||
00686 cbs->cval == NULL || strlen(cbs->cval) == 0 ){
00687
00688 PLUTO_beep() ; return ;
00689 }
00690
00691 fp = fopen( cbs->cval , "w" ) ;
00692 if( fp == NULL ){ PLUTO_beep(); return; }
00693
00694 for( ii=0 ; ii < ttc->reg_num ; ii++ ){
00695 color = ttc->dc->ovc->label_ov[ttc->reg_av[ii]->ival] ;
00696 qq = (ttc->reg_label[ii][0] == '[') ? 4 : 0 ;
00697 strcpy(name,ttc->reg_label[ii]+qq) ;
00698 qq = strlen(name) ;
00699 for( jj=0 ; jj < qq ; jj++ ){
00700 if( name[jj] == '.' ) name[jj] = ' ' ;
00701 else if( name[jj] == ' ' ) name[jj] = '_' ;
00702 }
00703 fprintf(fp, "%s = %s\n",name,color) ;
00704 }
00705 fclose(fp) ; return ;
00706 }
|
|
|
Definition at line 152 of file afni_ttren.c. References AFNI_yesenv(), TTRR_controls::av_invert, MCW_action_item::data, TTRR_controls::dc, DC_yokify(), MCW_DC::display, ENTRY, getenv(), TTRR_controls::hemi_av, HEMI_strings, MCW_action_area(), MCW_widget_geom(), TTRR_controls::meth_av, METHOD_strings, myXtNew, name, MCW_DCOV::ncol_ov, new_MCW_colormenu(), new_MCW_optmenu(), NHEMI, NMETHOD, NUM_AV_FIRST, NUM_TTRR_ACT, MCW_DC::ovc, PLUTO_cursorize, TTRR_controls::reg_av, TTRR_controls::reg_label, TTRR_controls::reg_num, TTRR_controls::reg_ttbrik, TTRR_controls::reg_tto, TTRR_controls::reg_ttovc, TTRR_controls::reg_ttval, TTRR_controls::scrollw, TTRR_controls::shell, SHOW_AFNI_PAUSE, SHOW_AFNI_READY, TTO_point::tdlev, TTO_point::tdval, TTO_COUNT, TTO_list, TTRR_av_CB(), TTRR_delete_window_CB(), TTRR_load_file(), WATCH_cursorize, TTRR_controls::workwin, and MCW_arrowval::wrowcol. Referenced by TTRR_popup().
00153 {
00154 XmString xstr ;
00155 char lbuf[256] , *ept ;
00156 Widget toprc , bar , actar , frame , separator , label ;
00157 int ww,hh,bww , ii ;
00158
00159 ENTRY("TTRR_setup_widgets") ;
00160
00161 /**** sanity checks ****/
00162
00163 if( dc == NULL || ttc != NULL ) EXRETURN ;
00164
00165 SHOW_AFNI_PAUSE ;
00166
00167 /**** create output structure ****/
00168
00169 ttc = myXtNew(TTRR_controls) ; /* will live forever */
00170
00171 ttc->dc = dc ;
00172
00173 ttc->av_invert = AFNI_yesenv( "AFNI_TTRR_INVERT" ) ;
00174
00175 /**** create Shell that can be opened up later ****/
00176
00177 ttc->shell =
00178 XtVaAppCreateShell(
00179 "AFNI" , "AFNI" , topLevelShellWidgetClass , dc->display ,
00180
00181 XmNtitle , "TT Atlas Rendering" , /* top of window */
00182 XmNiconName , "TT Atlas" , /* label on icon */
00183 #if 0
00184 XmNmappedWhenManaged , False , /* must map it manually */
00185 #endif
00186 XmNdeleteResponse , XmDO_NOTHING , /* deletion handled below */
00187 XmNallowShellResize , False , /* let code resize shell? */
00188 XmNinitialResourcesPersistent , False ,
00189 NULL ) ;
00190
00191 DC_yokify( ttc->shell , dc ) ;
00192
00193 if( afni48_good )
00194 XtVaSetValues( ttc->shell ,
00195 XmNiconPixmap , afni48_pixmap ,
00196 NULL ) ;
00197
00198 XmAddWMProtocolCallback( /* make "Close" window menu work */
00199 ttc->shell ,
00200 XmInternAtom( dc->display , "WM_DELETE_WINDOW" , False ) ,
00201 TTRR_delete_window_CB , (XtPointer) ttc ) ;
00202
00203 /**** create Form to hold all widgets ****/
00204
00205 toprc = XtVaCreateWidget(
00206 "AFNI" , xmFormWidgetClass , ttc->shell ,
00207 XmNborderWidth , 0 ,
00208 XmNborderColor , 0 ,
00209 XmNtraversalOn , False ,
00210 XmNinitialResourcesPersistent , False ,
00211 NULL ) ;
00212
00213 /**** Label to inform the cretinous user what he's looking at ****/
00214
00215 xstr = XmStringCreateLtoR("-- Control Talairach Daemon display colors --" ,
00216 XmFONTLIST_DEFAULT_TAG ) ;
00217 label = XtVaCreateManagedWidget(
00218 "AFNI" , xmLabelWidgetClass , toprc ,
00219 XmNlabelString , xstr ,
00220 XmNalignment , XmALIGNMENT_CENTER ,
00221
00222 XmNleftAttachment , XmATTACH_FORM ,
00223 XmNrightAttachment, XmATTACH_FORM ,
00224 XmNtopAttachment , XmATTACH_FORM ,
00225 XmNtopOffset , 3 ,
00226 XmNinitialResourcesPersistent , False ,
00227 NULL ) ;
00228 XmStringFree( xstr ) ;
00229
00230 MCW_widget_geom( label , &ww , &hh , NULL , NULL ) ; /* temporary */
00231 XtVaSetValues( ttc->shell ,
00232 XmNminWidth , ww+3 ,
00233 XmNminHeight , 11*hh ,
00234 NULL ) ;
00235
00236 separator = XtVaCreateManagedWidget(
00237 "AFNI" , xmSeparatorWidgetClass , toprc ,
00238 XmNseparatorType , XmSHADOW_ETCHED_IN ,
00239 XmNshadowThickness, 2 ,
00240 XmNleftAttachment , XmATTACH_FORM ,
00241 XmNrightAttachment, XmATTACH_FORM ,
00242 XmNtopAttachment , XmATTACH_WIDGET ,
00243 XmNtopWidget , label ,
00244 XmNtopOffset , 1 ,
00245 NULL ) ;
00246
00247 /**** create an action area to hold user control buttons ****/
00248
00249 for( ii=0 ; ii < NUM_TTRR_ACT ; ii++ )
00250 TTRR_act[ii].data = (XtPointer) ttc ;
00251
00252 actar = MCW_action_area( toprc , TTRR_act , NUM_TTRR_ACT ) ;
00253
00254 XtVaSetValues( actar ,
00255 XmNleftAttachment , XmATTACH_FORM ,
00256 XmNrightAttachment, XmATTACH_FORM ,
00257 XmNtopAttachment , XmATTACH_WIDGET ,
00258 XmNtopWidget , separator ,
00259 XmNtopOffset , 3 ,
00260 NULL ) ;
00261
00262 separator = XtVaCreateManagedWidget(
00263 "AFNI" , xmSeparatorWidgetClass , toprc ,
00264 XmNseparatorType , XmSHADOW_ETCHED_IN ,
00265 XmNshadowThickness, 2 ,
00266 XmNleftAttachment , XmATTACH_FORM ,
00267 XmNrightAttachment, XmATTACH_FORM ,
00268 XmNtopAttachment , XmATTACH_WIDGET ,
00269 XmNtopWidget , actar ,
00270 XmNtopOffset , 1 ,
00271 NULL ) ;
00272
00273 /**** a couple of buttons to control operational settings ****/
00274
00275 ttc->meth_av = new_MCW_optmenu( toprc , "Method" ,
00276 0 , NMETHOD-1 , NMETHOD-1 , 0 ,
00277 NULL,NULL ,
00278 MCW_av_substring_CB, METHOD_strings ) ;
00279
00280 XtVaSetValues( ttc->meth_av->wrowcol ,
00281 XmNleftAttachment , XmATTACH_FORM ,
00282 XmNtopAttachment , XmATTACH_WIDGET ,
00283 XmNtopWidget , separator ,
00284 XmNtopOffset , 3 ,
00285 XmNleftOffset , 3 ,
00286 NULL ) ;
00287
00288 ttc->hemi_av = new_MCW_optmenu( toprc , "Hemisphere(s)" ,
00289 0 , NHEMI-1 , NHEMI-1 , 0 ,
00290 NULL,NULL ,
00291 MCW_av_substring_CB, HEMI_strings ) ;
00292
00293 XtVaSetValues( ttc->hemi_av->wrowcol ,
00294 XmNrightAttachment, XmATTACH_FORM ,
00295 XmNtopAttachment , XmATTACH_WIDGET ,
00296 XmNtopWidget , separator ,
00297 XmNtopOffset , 3 ,
00298 XmNrightOffset , 3 ,
00299 NULL ) ;
00300
00301 separator = XtVaCreateManagedWidget(
00302 "AFNI" , xmSeparatorWidgetClass , toprc ,
00303 XmNseparatorType , XmSHADOW_ETCHED_IN ,
00304 XmNshadowThickness, 2 ,
00305 XmNleftAttachment , XmATTACH_FORM ,
00306 XmNrightAttachment, XmATTACH_FORM ,
00307 XmNtopAttachment , XmATTACH_WIDGET ,
00308 XmNtopWidget , ttc->meth_av->wrowcol ,
00309 XmNtopOffset , 1 ,
00310 NULL ) ;
00311
00312 /**** create a Scrolled Window and Form to hold colormenus ****/
00313
00314 ttc->scrollw =
00315 XtVaCreateWidget(
00316 "AFNI" , xmScrolledWindowWidgetClass , toprc ,
00317 XmNscrollingPolicy , XmAUTOMATIC ,
00318 XmNwidth , ww+2*hh , /* temporary */
00319 XmNheight , 3*hh , /* ditto */
00320 XmNleftAttachment , XmATTACH_FORM ,
00321 XmNrightAttachment , XmATTACH_FORM ,
00322 XmNtopAttachment , XmATTACH_WIDGET ,
00323 XmNbottomAttachment, XmATTACH_FORM ,
00324 XmNtopWidget , separator ,
00325 XmNtopOffset , 3 ,
00326 XmNtraversalOn , False ,
00327 XmNinitialResourcesPersistent , False ,
00328 NULL ) ;
00329
00330 frame =
00331 XtVaCreateWidget(
00332 "AFNI" , xmFrameWidgetClass , ttc->scrollw ,
00333 XmNshadowType , XmSHADOW_ETCHED_IN ,
00334 XmNshadowThickness , 5 ,
00335 XmNtraversalOn , False ,
00336 XmNinitialResourcesPersistent , False ,
00337 NULL ) ;
00338
00339 ttc->workwin =
00340 XtVaCreateWidget(
00341 "AFNI" , xmFormWidgetClass , frame ,
00342 XmNborderWidth , 0 ,
00343 XmNborderColor , 0 ,
00344 XmNtraversalOn , False ,
00345 XmNinitialResourcesPersistent , False ,
00346 NULL ) ;
00347
00348 /** compute information about regions **/
00349
00350 ttc->reg_num = 0 ;
00351 for( ii=0 ; ii < TTO_COUNT ; ii++ ){
00352
00353 if( strncmp(TTO_list[ii].name,"Left ",6) != 0 ) continue ; /* skip */
00354 if( TTO_list[ii].tdval == 0 ) continue ; /* skip */
00355
00356 if( TTO_list[ii].tdlev == 2 ) strcpy(lbuf,"[G] ") ;
00357 else if( TTO_list[ii].tdlev == 4 ) strcpy(lbuf,"[A] ") ;
00358 else continue ; /* skip */
00359
00360 strcat(lbuf,TTO_list[ii].name+6) ;
00361
00362 ttc->reg_label [ttc->reg_num] = strdup(lbuf) ;
00363 ttc->reg_tto [ttc->reg_num] = ii ;
00364 ttc->reg_ttbrik[ttc->reg_num] = (TTO_list[ii].tdlev==2) ? 0 : 1 ;
00365 ttc->reg_ttval [ttc->reg_num] = TTO_list[ii].tdval ;
00366 ttc->reg_ttovc [ttc->reg_num] = 0 ;
00367
00368 /* only create a few colormenu widgets first,
00369 because XtRealizeWidget() is so slow with many widgets,
00370 and the impatient user is likely to be unhappy with us */
00371
00372 if( ttc->reg_num < NUM_AV_FIRST ){
00373 ttc->reg_av[ttc->reg_num] =
00374 new_MCW_colormenu(
00375 ttc->workwin , /* parent */
00376 ttc->reg_label[ttc->reg_num] , /* label */
00377 dc , /* display context */
00378 0 , /* first color */
00379 dc->ovc->ncol_ov - 1 , /* last color */
00380 0 , /* initial color */
00381 TTRR_av_CB,NULL /* callback func,data */
00382 ) ;
00383
00384 XtVaSetValues( ttc->reg_av[ttc->reg_num]->wrowcol ,
00385 XmNleftAttachment , XmATTACH_FORM ,
00386 XmNtopAttachment , (ttc->reg_num==0)
00387 ? XmATTACH_FORM /* 1st row */
00388 : XmATTACH_WIDGET , /* 2nd+ row */
00389 XmNtopWidget , (ttc->reg_num==0)
00390 ? NULL
00391 : ttc->reg_av[ttc->reg_num-1]->wrowcol ,
00392 XmNrightAttachment , XmATTACH_FORM ,
00393 NULL ) ;
00394 }
00395
00396 ttc->reg_num++ ;
00397 }
00398
00399 /* manage the managers */
00400
00401 XtManageChild( ttc->workwin ) ;
00402 XtManageChild( frame ) ;
00403 XtManageChild( ttc->scrollw ) ;
00404 XtManageChild( toprc ) ;
00405 XtRealizeWidget( ttc->shell ) ;
00406
00407 WATCH_cursorize( ttc->shell ) ;
00408 XmUpdateDisplay( ttc->shell ) ;
00409
00410 /*** set size ***/
00411
00412 #define LUCK 5 /* we all need some */
00413 #define CMMAX 17 /* vertical size = CMMAX colormenus high */
00414
00415 MCW_widget_geom( ttc->reg_av[0]->wrowcol , &ww , &hh , NULL,NULL ) ;
00416
00417 XtVaGetValues( ttc->scrollw , XmNverticalScrollBar , &bar , NULL ) ;
00418 MCW_widget_geom( bar , &bww , NULL,NULL,NULL ) ;
00419
00420 hh = CMMAX*hh + LUCK ;
00421 ww += bww + 5*LUCK ;
00422
00423 /* but make sure window is at least wide
00424 enough for the Method and Hemisphere(s) widgets */
00425
00426 MCW_widget_geom( ttc->meth_av->wrowcol , &ii , NULL,NULL,NULL ) ;
00427 MCW_widget_geom( ttc->hemi_av->wrowcol , &bww , NULL,NULL,NULL ) ;
00428 bww += ii + LUCK ;
00429 if( ww < bww ) ww = bww ;
00430
00431 XtVaSetValues( ttc->shell , XmNwidth , ww , XmNheight , hh , NULL ) ;
00432 XmUpdateDisplay( ttc->shell ) ;
00433
00434 /*** create rest of colormenu widgets now
00435 -- this provides some visual feedback, and keeps the user happy ***/
00436
00437 for( ii=NUM_AV_FIRST ; ii < ttc->reg_num ; ii++ ){
00438 ttc->reg_av[ii] =
00439 new_MCW_colormenu(
00440 ttc->workwin , /* parent */
00441 ttc->reg_label[ii] , /* label */
00442 dc , /* display context */
00443 0 , /* first color */
00444 dc->ovc->ncol_ov - 1 , /* last color */
00445 0 , /* initial color */
00446 NULL,NULL /* callback func,data */
00447 ) ;
00448
00449 XtVaSetValues( ttc->reg_av[ii]->wrowcol ,
00450 XmNleftAttachment , XmATTACH_FORM ,
00451 XmNtopAttachment , XmATTACH_WIDGET ,
00452 XmNtopWidget , ttc->reg_av[ii-1]->wrowcol ,
00453 XmNrightAttachment , XmATTACH_FORM ,
00454 NULL ) ;
00455
00456 XtRealizeWidget( ttc->reg_av[ii]->wrowcol ) ;
00457
00458 if( ii%NUM_AV_FIRST == 0 ) /* show something occasionally */
00459 XmUpdateDisplay( ttc->shell ) ;
00460 }
00461
00462 PLUTO_cursorize( ttc->shell ) ;
00463
00464 /* 08 Aug 2002: read initial colors */
00465
00466 ept = getenv( "AFNI_TTRR_SETUP" ) ;
00467 if( ept != NULL ) TTRR_load_file( ept ) ;
00468
00469 /*** done!!! ***/
00470
00471 SHOW_AFNI_READY ; EXRETURN ;
00472 }
|
Variable Documentation
|
|
Definition at line 85 of file afni_ttren.c. Referenced by TTRR_action_CB(). |
|
|
Definition at line 83 of file afni_ttren.c. Referenced by TTRR_setup_widgets(). |
|
|
Initial value: {
METHOD_OFF , METHOD_GAF , METHOD_AGF , METHOD_FGA , METHOD_FAG
}Definition at line 74 of file afni_ttren.c. Referenced by TTRR_setup_widgets(). |
|
|
Definition at line 25 of file afni_ttren.c. |
|
|
Definition at line 575 of file afni_ttren.c. |
|
|
Initial value: {
{ TTRR_clear_label , TTRR_action_CB, NULL,NULL, TTRR_clear_hint , 0 } ,
{ TTRR_load_label , TTRR_action_CB, NULL,NULL, TTRR_load_hint , 0 } ,
{ TTRR_save_label , TTRR_action_CB, NULL,NULL, TTRR_save_hint , 0 } ,
{ TTRR_redraw_label, TTRR_action_CB, NULL,NULL, TTRR_redraw_hint,-1 } ,
{ TTRR_done_label , TTRR_action_CB, NULL,NULL, TTRR_done_hint , 1 } ,
{ TTRR_help_label , TTRR_action_CB, NULL,NULL, NULL , 0 }
}Definition at line 58 of file afni_ttren.c. |