Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

plug_notes.c File Reference

#include "afni.h"

Go to the source code of this file.


Data Structures

struct  NOTE_wind

Defines

#define TWIDTH   75
#define newstring(str)   strcpy(malloc(strlen(str)+1),str)
#define THEIGHT   9
#define NUM_DH   10
#define NACT   6

Functions

char * NOTES_main (PLUGIN_interface *)
void NOTES_make_widgets (void)
void NOTES_done_CB (Widget, XtPointer, XtPointer)
void NOTES_help_CB (Widget, XtPointer, XtPointer)
void NOTES_quit_CB (Widget, XtPointer, XtPointer)
void NOTES_save_CB (Widget, XtPointer, XtPointer)
void NOTES_choose_CB (Widget, XtPointer, XtPointer)
void NOTES_add_CB (Widget, XtPointer, XtPointer)
void NOTES_delete_CB (Widget, XtPointer, XtPointer)
void NOTES_restore_CB (Widget, XtPointer, XtPointer)
void NOTES_refit_CB (Widget, XtPointer, XtPointer)
void NOTES_finalize_dset_CB (Widget, XtPointer, MCW_choose_cbs *)
int line_count (char *)
DEFINE_PLUGIN_PROTOTYPE PLUGIN_interface * PLUGIN_init (int ncall)
NOTE_windNOTES_make_note (void)
void scroll_topbot (Widget, int)

Variables

PLUGIN_interface * plint = NULL
int max_tlines = 0
Widget shell = NULL
Widget topman
Widget info_lab
Widget choose_pb
Widget done_pb
Widget help_pb
Widget quit_pb
Widget save_pb
Widget add_pb
Widget notesw
Widget noterc
Widget refit_pb
int text_width = 0
int text_height = 0
NOTE_wind ** notar = NULL
int notar_num = 0
int num_notes = 0
MCW_DCdc
Three_D_Viewim3d
THD_3dim_datasetdset
MCW_idcode dset_idc
int editor_open = 0
char * default_history [NUM_DH]
char * empty_note = "-- Empty Note Text --"
char * no_date = "no date"
MCW_action_item NOTES_actor [NACT]
int ndsl = 0
PLUGIN_dataset_link * dsl = NULL

Define Documentation

#define NACT   6
 

Definition at line 224 of file plug_notes.c.

Referenced by NOTES_make_widgets().

#define newstring str       strcpy(malloc(strlen(str)+1),str)
 

Definition at line 40 of file plug_notes.c.

Referenced by NOTES_add_CB(), NOTES_finalize_dset_CB(), NOTES_save_CB(), SUMA_StringAppend(), and SUMA_StringAppend_va().

#define NUM_DH   10
 

Definition at line 104 of file plug_notes.c.

Referenced by NOTES_finalize_dset_CB().

#define THEIGHT   9
 

Definition at line 43 of file plug_notes.c.

Referenced by NOTES_make_widgets().

#define TWIDTH   75
 

Definition at line 39 of file plug_notes.c.

Referenced by NOTES_finalize_dset_CB(), NOTES_make_note(), and NOTES_make_widgets().


Function Documentation

int line_count char *    [static]
 

Definition at line 560 of file plug_notes.c.

Referenced by NOTES_add_CB(), NOTES_delete_CB(), NOTES_finalize_dset_CB(), and NOTES_refit_CB().

00561 {
00562    char * cpt ; int nlin ;
00563    if( msg == NULL ) return 0 ;
00564    for( nlin=1,cpt=msg ; *cpt != '\0' ; cpt++ ) if( *cpt == '\n' ) nlin++ ;
00565    return nlin ;
00566 }

void NOTES_add_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 953 of file plug_notes.c.

References add_pb, client_data, MCW_DC::display, empty_note, MCW_DC::height, line_count(), MAX_DSET_NOTES, max_tlines, MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, MCW_widget_geom(), newstring, no_date, notar_num, noterc, NOTES_make_note(), notesw, num_notes, qh, realloc, scroll_topbot(), tross_Add_Note(), tross_Get_Note(), and tross_Get_Notedate().

00954 {
00955    int nl , hh , ii , qh ;
00956    char str[256] ;
00957    XmString xstr ;
00958 
00959    if( dset == NULL ){ XBell(dc->display,100) ; return ; }
00960 
00961    if( num_notes >= MAX_DSET_NOTES ){
00962       (void) MCW_popup_message( add_pb ,
00963                                 " \n"
00964                                 " Max number of notes\n"
00965                                 " would be exceeded!\n " ,
00966                                 MCW_USER_KILL | MCW_TIMER_KILL ) ;
00967       XBell(dc->display,100) ; return ;
00968    }
00969 
00970    tross_Add_Note( dset , empty_note ) ;
00971 
00972    num_notes ++ ;
00973 
00974    if( notar_num < num_notes + 1 ){
00975       notar = (NOTE_wind **) realloc( notar, sizeof(NOTE_wind *)*(num_notes+1) ) ;
00976       for( ii=notar_num ; ii <= num_notes ; ii++ )
00977          notar[ii]  = NOTES_make_note() ;
00978       notar_num = num_notes + 1 ;
00979    }
00980 
00981    notar[num_notes]->note_orig = tross_Get_Note    ( dset , num_notes ) ;
00982    notar[num_notes]->date_orig = tross_Get_Notedate( dset , num_notes ) ;
00983 
00984    if( notar[num_notes]->note_orig == NULL )
00985       notar[num_notes]->note_orig = newstring( empty_note ) ;
00986 
00987    if( notar[num_notes]->date_orig == NULL )
00988       notar[num_notes]->date_orig = newstring( no_date ) ;
00989 
00990    sprintf(str,"----- NOTE %d [%s] -----",num_notes,notar[num_notes]->date_orig) ;
00991    xstr = XmStringCreateLtoR( str , XmFONTLIST_DEFAULT_TAG ) ;
00992    XtVaSetValues( notar[num_notes]->note_label , XmNlabelString , xstr , NULL ) ;
00993    XmStringFree(xstr) ;
00994    XmTextSetString( notar[num_notes]->textw , notar[num_notes]->note_orig ) ;
00995 
00996    nl = line_count( notar[num_notes]->note_orig ) ;
00997    if( nl > max_tlines ) nl = max_tlines ;
00998    XtVaSetValues( notar[num_notes]->textw , XmNrows , nl , NULL ) ;
00999 
01000    XtManageChild( notar[num_notes]->frame ) ;
01001 
01002    /* set size of scrolling area for notes */
01003 
01004    MCW_widget_geom( noterc , NULL,&hh , NULL,NULL ) ; hh +=4 ; qh = hh ;
01005    if( hh > dc->height- 128 ) hh = dc->height- 128 ;
01006 
01007    XtVaSetValues( notesw , XmNheight,hh , NULL ) ;
01008 
01009    if( qh > hh ) scroll_topbot( notesw , 1 ) ;
01010    return ;
01011 }

void NOTES_choose_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 723 of file plug_notes.c.

References choose_pb, client_data, MCW_DC::display, DSET_COMPRESSED, DSET_NUM_TIMES, DSET_NVALS, dsl, THD_session::dsset, THD_3dim_dataset::func_type, ISANAT, ISANATBUCKET, ISFUNCBUCKET, ISVALID_DSET, make_PLUGIN_dataset_link(), MAX, MCW_choose_strlist(), MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, ndsl, NOTES_finalize_dset_CB(), THD_session::num_dsset, PLUTO_find_dset(), POPDOWN_strlist_chooser, Three_D_View::ss_now, THD_MAX_NAME, AFNI_view_info::view_type, Three_D_View::vinfo, and XtRealloc.

Referenced by NOTES_make_widgets().

00724 {
00725    THD_session * ss  = im3d->ss_now ;           /* current session */
00726    int           vv  = im3d->vinfo->view_type ; /* view type */
00727    THD_3dim_dataset * qset ;
00728    int id , ltop , llen ;
00729    char qnam[THD_MAX_NAME] , label[THD_MAX_NAME] ;
00730    static char ** strlist = NULL ;
00731 
00732    /* initialize */
00733 
00734    ndsl = 0 ;
00735 
00736    /* scan datasets */
00737 
00738    for( id=0 ; id < ss->num_dsset ; id++ ){
00739       qset = ss->dsset[id][vv] ;
00740 
00741       if( ! ISVALID_DSET (qset) ) continue ;  /* skip */
00742 
00743       ndsl++ ;
00744       dsl = (PLUGIN_dataset_link *)
00745               XtRealloc( (char *) dsl , sizeof(PLUGIN_dataset_link)*ndsl ) ;
00746 
00747       make_PLUGIN_dataset_link( qset , dsl + (ndsl-1) ) ;
00748    }
00749 
00750    /* found nothing?  exit */
00751 
00752    if( ndsl < 1 ){
00753       (void) MCW_popup_message( choose_pb ,
00754                                    "Didn't find any\ndatasets to edit!" ,
00755                                 MCW_USER_KILL | MCW_TIMER_KILL ) ;
00756       XBell( dc->display , 100 ) ;
00757       return ;
00758    }
00759 
00760    /*--- 23 Nov 1996: loop over dataset links and patch their titles
00761                       to include an indicator of the dataset type    ---*/
00762 
00763    ltop = 4 ;
00764    for( id=0 ; id < ndsl ; id++ ){
00765       llen = strlen(dsl[id].title) ;
00766       ltop = MAX(ltop,llen) ;
00767    }
00768 
00769    for( id=0 ; id < ndsl ; id++ ){
00770       qset = PLUTO_find_dset( &(dsl[id].idcode) ) ;
00771       if( ! ISVALID_DSET(qset) ) continue ;
00772       if( ISANAT(qset) ){
00773          if( ISANATBUCKET(qset) )         /* 30 Nov 1997 */
00774             sprintf(qnam,"%-*s [%s:%d]" ,
00775                     ltop,dsl[id].title ,
00776                     ANAT_prefixstr[qset->func_type] , DSET_NVALS(qset) ) ;
00777 
00778          else if( DSET_NUM_TIMES(qset) == 1 )
00779             sprintf(qnam,"%-*s [%s]" ,
00780                     ltop,dsl[id].title ,
00781                     ANAT_prefixstr[qset->func_type] ) ;
00782 
00783          else
00784             sprintf(qnam,"%-*s [%s:3D+t:%d]" ,
00785                     ltop,dsl[id].title ,
00786                     ANAT_prefixstr[qset->func_type] , DSET_NUM_TIMES(qset) ) ;
00787 
00788       } else {
00789          if( ISFUNCBUCKET(qset) )         /* 30 Nov 1997 */
00790             sprintf(qnam,"%-*s [%s:%d]" ,
00791                     ltop,dsl[id].title ,
00792                     FUNC_prefixstr[qset->func_type] , DSET_NVALS(qset) ) ;
00793 
00794          else if( DSET_NUM_TIMES(qset) == 1 )
00795             sprintf(qnam,"%-*s [%s]" ,
00796                     ltop,dsl[id].title ,
00797                     FUNC_prefixstr[qset->func_type] ) ;
00798 
00799          else
00800             sprintf(qnam,"%-*s [%s:3D+t:%d]" ,
00801                     ltop,dsl[id].title ,
00802                     FUNC_prefixstr[qset->func_type] , DSET_NVALS(qset) ) ;
00803       }
00804 
00805       if( DSET_COMPRESSED(qset) ) strcat(qnam,"z") ;
00806 
00807       strcpy( dsl[id].title , qnam ) ;
00808    }
00809 
00810    /*--- make a popup chooser for the user to browse ---*/
00811 
00812    POPDOWN_strlist_chooser ;
00813 
00814    strlist = (char **) XtRealloc( (char *)strlist , sizeof(char *)*ndsl ) ;
00815    for( id=0 ; id < ndsl ; id++ ) strlist[id] = dsl[id].title ;
00816 
00817    sprintf( label , "AFNI Dataset from\nthe %s" , VIEW_typestr[vv] ) ;
00818 
00819    MCW_choose_strlist( w , label , ndsl , -1 , strlist ,
00820                        NOTES_finalize_dset_CB , NULL     ) ;
00821 
00822    return ;
00823 }

void NOTES_delete_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 1040 of file plug_notes.c.

References client_data, NOTE_wind::date_orig, NOTE_wind::delete_pb, free, MCW_DC::height, line_count(), max_tlines, MCW_widget_geom(), NOTE_wind::note_orig, noterc, notesw, num_notes, tross_Delete_Note(), and XtFree.

Referenced by NOTES_make_note().

01041 {
01042    int ii , kk , hh , nl ;
01043    char str[256] , * ts ;
01044    XmString xstr ;
01045 
01046    if( dset == NULL ) return ;    /* should never happen */
01047 
01048    for( kk=1 ; kk <= num_notes ; kk++ )
01049       if( w == notar[kk]->delete_pb ) break ;
01050 
01051    if( kk > num_notes ) return ;  /* should never happen */
01052 
01053    tross_Delete_Note( dset , kk ) ;  /* delete it in the dataset */
01054 
01055    /* erase the info in the kk-th Note window */
01056 
01057    free( notar[kk]->note_orig ) ;  /* this is history */
01058    free( notar[kk]->date_orig ) ;
01059 
01060    /* move the info in the Note windows above kk down to the previous window */
01061 
01062    for( ii=kk+1 ; ii <= num_notes ; ii++ ){
01063       notar[ii-1]->note_orig = notar[ii]->note_orig ;  /* move the orig */
01064       notar[ii-1]->date_orig = notar[ii]->date_orig ;  /* stuff down    */
01065 
01066       ts = XmTextGetString( notar[ii]->textw ) ;       /* move the text */
01067       XmTextSetString( notar[ii-1]->textw , ts ) ;     /* in the window */
01068       nl = line_count( ts ) ;
01069       if( nl > max_tlines ) nl = max_tlines ;
01070       XtVaSetValues( notar[ii-1]->textw , XmNrows , nl , NULL ) ;
01071       XtFree(ts) ;
01072 
01073       sprintf(str,"----- NOTE %d [%s] -----",ii-1,notar[ii-1]->date_orig) ;
01074       xstr = XmStringCreateLtoR( str , XmFONTLIST_DEFAULT_TAG ) ;
01075       XtVaSetValues( notar[ii-1]->note_label , XmNlabelString , xstr , NULL ) ;
01076       XmStringFree(xstr) ;
01077    }
01078 
01079    notar[num_notes]->note_orig = NULL ;
01080    notar[num_notes]->date_orig = NULL ;
01081    XmTextSetString( notar[num_notes]->textw , "\0" ) ;
01082    XtUnmanageChild( notar[num_notes]->frame ) ;
01083    num_notes-- ;
01084 
01085    MCW_widget_geom( noterc , NULL,&hh , NULL,NULL ) ;
01086    if( hh > dc->height- 128 ) hh = dc->height- 128 ;
01087    XtVaSetValues( notesw , XmNheight,hh , NULL ) ;
01088 
01089    return ;
01090 }

void NOTES_done_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 572 of file plug_notes.c.

References client_data, NOTES_quit_CB(), NOTES_save_CB(), and num_notes.

00573 {
00574    if( dset != NULL && num_notes > 0 ) NOTES_save_CB(NULL,NULL,NULL) ;
00575    NOTES_quit_CB(NULL,NULL,NULL) ;
00576    return ;
00577 }

void NOTES_finalize_dset_CB Widget   ,
XtPointer   ,
MCW_choose_cbs  
[static]
 

Definition at line 827 of file plug_notes.c.

References NOTE_wind::date_orig, default_history, MCW_DC::display, dsl, editor_open, empty_note, fd, free, MCW_DC::height, THD_3dim_dataset::idcode, info_lab, MCW_choose_cbs::ival, line_count(), max_tlines, MCW_widget_geom(), ndsl, newstring, no_date, notar_num, NOTE_wind::note_orig, noterc, NOTES_make_note(), notesw, NUM_DH, num_notes, PLUTO_find_dset(), POPDOWN_strlist_chooser, qh, realloc, scroll_topbot(), text_width, tross_breakup_string(), tross_Get_History(), tross_Get_Note(), tross_Get_Notecount(), tross_Get_Notedate(), TWIDTH, and MCW_DC::width.

Referenced by NOTES_choose_CB().

00828 {
00829    int id = cbs->ival ;
00830    THD_3dim_dataset * qset ;
00831    XmString xstr ;
00832    char str[256] , * his ;
00833    int ii , nl , nltot , ww,hh,qh ;
00834 
00835    /* check for errors */
00836 
00837    if( ! editor_open ){ POPDOWN_strlist_chooser; XBell(dc->display,100); return; }
00838 
00839    if( id < 0 || id >= ndsl ){ XBell(dc->display,100) ; return ; }
00840 
00841    qset = PLUTO_find_dset( &(dsl[id].idcode) ) ;  /* the new dataset? */
00842 
00843    if( qset == NULL ){ XBell(dc->display,100) ; return ; }
00844 
00845    /* accept this dataset */
00846 
00847    dset     = qset ;
00848    dset_idc = qset->idcode ;   /* 31 Mar 1999 */
00849 
00850    /* write the informational label */
00851 
00852    strcpy(str,dsl[id].title) ;
00853    xstr = XmStringCreateLtoR( str , XmFONTLIST_DEFAULT_TAG ) ;
00854    XtVaSetValues( info_lab , XmNlabelString , xstr , NULL ) ;
00855    XmStringFree(xstr) ;
00856 
00857    /* clear any existing notes windows */
00858 
00859    XtUnmanageChild( notesw ) ;
00860    XtUnmanageChild( noterc ) ;
00861    for( ii=0 ; ii < notar_num ; ii++ ){
00862       XtUnmanageChild( notar[ii]->frame ) ;
00863 
00864       if( notar[ii]->note_orig != NULL ){
00865           free(notar[ii]->note_orig) ; notar[ii]->note_orig = NULL ;
00866       }
00867 
00868       if( notar[ii]->date_orig != NULL ){
00869           free(notar[ii]->date_orig) ; notar[ii]->date_orig = NULL ;
00870       }
00871    }
00872 
00873    /* make new Notes windows, if necessary */
00874 
00875    num_notes = tross_Get_Notecount( dset ) ;
00876 
00877    if( notar_num < num_notes + 1 ){
00878       notar = (NOTE_wind **) realloc( notar, sizeof(NOTE_wind *)*(num_notes+1) ) ;
00879       for( ii=notar_num ; ii <= num_notes ; ii++ )
00880          notar[ii]  = NOTES_make_note() ;
00881       notar_num = num_notes + 1 ;
00882    }
00883 
00884    /* get and set Notes text for each window */
00885 
00886    his = tross_Get_History( dset ) ;
00887    if( his == NULL ){
00888       ii = ( lrand48() >> 8) % NUM_DH ;
00889       notar[0]->note_orig = newstring(default_history[ii]) ;
00890       xstr = XmStringCreateLtoR( "----- EDIFYING TEXT -----" , XmFONTLIST_DEFAULT_TAG ) ;
00891    } else {
00892       notar[0]->note_orig = tross_breakup_string( his , 2*TWIDTH/3 , TWIDTH-1 ) ;
00893       free(his) ;
00894       xstr = XmStringCreateLtoR( "----- HISTORY -----" , XmFONTLIST_DEFAULT_TAG ) ;
00895    }
00896    notar[0]->date_orig = NULL ;
00897 
00898    XtVaSetValues( notar[0]->note_label , XmNlabelString , xstr , NULL ) ;
00899    XmStringFree(xstr) ;
00900    XmTextSetString( notar[0]->textw , notar[0]->note_orig ) ;
00901 
00902    nl = line_count( notar[0]->note_orig ) ;
00903    if( nl > max_tlines ) nl = max_tlines ;
00904    XtVaSetValues( notar[0]->textw , XmNrows , nl , NULL ) ;
00905    nltot = nl ;
00906 
00907    XtManageChild( notar[0]->frame ) ;
00908 
00909    for( ii=1 ; ii <= num_notes ; ii++ ){
00910       notar[ii]->note_orig = tross_Get_Note    ( dset , ii ) ;
00911       notar[ii]->date_orig = tross_Get_Notedate( dset , ii ) ;
00912 
00913       if( notar[ii]->note_orig == NULL )
00914          notar[ii]->note_orig = newstring( empty_note ) ;
00915 
00916       if( notar[ii]->date_orig == NULL )
00917          notar[ii]->date_orig = newstring( no_date ) ;
00918 
00919       sprintf(str,"----- NOTE %d [%s] -----",ii,notar[ii]->date_orig) ;
00920       xstr = XmStringCreateLtoR( str , XmFONTLIST_DEFAULT_TAG ) ;
00921       XtVaSetValues( notar[ii]->note_label , XmNlabelString , xstr , NULL ) ;
00922       XmStringFree(xstr) ;
00923       XmTextSetString( notar[ii]->textw , notar[ii]->note_orig ) ;
00924 
00925       nl = line_count( notar[ii]->note_orig ) ;
00926       if( nl > max_tlines ) nl = max_tlines ;
00927       XtVaSetValues( notar[ii]->textw , XmNrows , nl , NULL ) ;
00928       nltot += nl ;
00929 
00930       XtManageChild( notar[ii]->frame ) ;
00931    }
00932 
00933    XtVaSetValues( notar[0]->scrollw , XmNwidth , text_width , NULL ) ;
00934 
00935    XtManageChild( noterc ) ;
00936    XtManageChild( notesw ) ;
00937 
00938    /* set size of scrolling area for notes */
00939 
00940    MCW_widget_geom( noterc , &ww,&hh , NULL,NULL ) ;
00941    ww += 4 ; hh += 4 ; qh = hh ;
00942    if( ww > dc->width - 128 ) ww = dc->width - 128 ;
00943    if( hh > dc->height- 128 ) hh = dc->height- 128 ;
00944 
00945    XtVaSetValues( notesw , XmNwidth,ww , XmNheight,hh , NULL ) ;
00946 
00947    if( qh > hh ) scroll_topbot( notesw , 0 ) ;
00948    return ;
00949 }

void NOTES_help_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 659 of file plug_notes.c.

References choose_pb, client_data, new_MCW_textwin(), and TEXT_READONLY.

00660 {
00661    (void ) new_MCW_textwin( choose_pb ,
00662 
00663    " \n"
00664    "This plugin is used to view and edit the Notes attached to a dataset.\n"
00665    "---------------------------------------------------------------------\n"
00666    "The buttons at the top perform the following functions:\n"
00667    "\n"
00668    "  Choose Dataset: Use this to select a dataset to deal with.\n"
00669    "\n"
00670    "  Quit:           Exit the plugin without saving any edits to Notes\n"
00671    "                  made since the last 'Save' button press.\n"
00672    "\n"
00673    "  Help:           I hope you already got the idea for this widget.\n"
00674    "\n"
00675    "  Add:            Add a new Note at the end of the existing notes.\n"
00676    "\n"
00677    "  Refit:          Resize all Notes' sub-windows to fit the number of\n"
00678    "                  lines of text in each Note.  The maximum line count\n"
00679    "                  for each sub-window is set by the Unix environment\n"
00680    "                  variable AFNI_NOTES_DLINES; if this is not defined,\n"
00681    "                  the default maximum is 9.\n"
00682    "\n"
00683    "  Save:           Save the current Notes to the dataset .HEAD file.\n"
00684    "\n"
00685    "  Done:           Save then Quit.\n"
00686    "-------------------------------------------------------------------------- \n"
00687    "Below these buttons are the Notes sub-windows.\n"
00688    "\n"
00689    "The first Note sub-window shows the dataset History Note.  This Note can't\n"
00690    "be edited by the user - it is created by each AFNI program as a record of\n"
00691    "the actions that led to this dataset. If no History Note is present in the\n"
00692    "dataset .HEAD file, some edifying text will be shown here instead.\n"
00693    "\n"
00694    "Each other Note sub-window shows the Note number, the date of the Note's\n"
00695    "creation (or last change), and the Note itself.  These windows are\n"
00696    "editable.  If you want to remove a Note from the dataset, use the\n"
00697    "Delete button for that Note.  (This operation is NOT reversible - using\n"
00698    "the Quit button will not get a deleted Note back!)  If you edit a note\n"
00699    "badly and want to restore it to the value saved in the dataset header,\n"
00700    "use the Restore button.\n"
00701    "\n"
00702    "Notes can also be viewed with the program 3dinfo, and with the Info\n"
00703    "buttons from the Datamode/Misc menu.  The command line program 3dNotes\n"
00704    "lets you create dataset Notes in a batch script file.\n"
00705    "\n"
00706    "--- Bob Cox - September 1999\n"
00707    "    (Based on ideas and some code from Tom Ross of MCW)\n"
00708 
00709     , TEXT_READONLY ) ;
00710 
00711    return ;
00712 }

char * NOTES_main PLUGIN_interface *   
 

Definition at line 157 of file plug_notes.c.

References AFNI_controller_label(), Three_D_View::dc, editor_open, IM3D_OPEN, info_lab, notar_num, noterc, NOTES_make_widgets(), notesw, num_notes, plint, PLUTO_cursorize, PLUTO_set_topshell(), RWC_visibilize_widget(), and shell.

Referenced by PLUGIN_init().

00158 {
00159    XmString xstr ;
00160    int ii ;
00161 
00162    /*-- sanity checks --*/
00163 
00164    if( ! IM3D_OPEN(plint->im3d) ) return "AFNI Controller\nnot opened?!" ;
00165 
00166    if( editor_open ){
00167       XtMapWidget(shell) ;
00168       XRaiseWindow( XtDisplay(shell) , XtWindow(shell) ) ;
00169       return NULL ;
00170    }
00171 
00172    im3d = plint->im3d ;  /* save for local use */
00173 
00174    /*-- create widgets, first time through --*/
00175 
00176    if( shell == NULL ){
00177       dc = im3d->dc ;        /* save this too */
00178       NOTES_make_widgets() ;
00179       PLUTO_set_topshell( plint , shell ) ;  /* 22 Sep 2000 */
00180       RWC_visibilize_widget( shell ) ;       /* 27 Sep 2000 */
00181    }
00182 
00183    /*-- unmanage all notes sub-windows --*/
00184 
00185    XtUnmanageChild( notesw ) ;
00186    XtUnmanageChild( noterc ) ;
00187    for( ii=0 ; ii < notar_num ; ii++ )
00188       XtUnmanageChild( notar[ii]->frame ) ;
00189 
00190    /*-- set titlebar --*/
00191 
00192    { char ttl[32] ;
00193      sprintf( ttl , "AFNI Notes %s" , AFNI_controller_label(im3d) ) ;
00194      XtVaSetValues( shell , XmNtitle , ttl , NULL ) ;
00195    }
00196 
00197    /*-- set the info label --*/
00198 
00199    xstr = XmStringCreateLtoR( "[No dataset]" ,
00200                               XmFONTLIST_DEFAULT_TAG ) ;
00201    XtVaSetValues( info_lab , XmNlabelString , xstr , NULL ) ;
00202    XmStringFree(xstr) ;
00203 
00204    /*-- pop the widget up --*/
00205 
00206    XtMapWidget(shell) ;
00207    PLUTO_cursorize(shell) ;
00208 
00209    /*-- misc initialization --*/
00210 
00211    dset         = NULL ;   /* not editing anything   */
00212    editor_open  = 1 ;      /* editor is now open for business */
00213    num_notes    = 0 ;      /* don't have any notes now */
00214 
00215    return NULL ;
00216 }

NOTE_wind * NOTES_make_note void    [static]
 

Definition at line 455 of file plug_notes.c.

References calloc, NOTE_wind::date_orig, NOTE_wind::delete_pb, NOTE_wind::frame, NOTE_wind::horz_rc, MCW_register_help(), MCW_register_hint(), NOTE_wind::note_label, NOTE_wind::note_orig, noterc, NOTES_delete_CB(), NOTES_restore_CB(), NOTE_wind::restore_pb, NOTE_wind::scrollw, NOTE_wind::textw, TWIDTH, and NOTE_wind::vert_rc.

Referenced by NOTES_add_CB(), NOTES_finalize_dset_CB(), and NOTES_make_widgets().

00456 {
00457    NOTE_wind * nw ;
00458    XmString xstr ;
00459 
00460    nw = (NOTE_wind *) calloc( 1 , sizeof(NOTE_wind) ) ;
00461 
00462    nw->frame = XtVaCreateWidget(
00463                   "AFNI" , xmFrameWidgetClass , noterc ,
00464                   XmNshadowType , XmSHADOW_IN ,
00465                   XmNshadowThickness , 1 ,
00466                   XmNtraversalOn , False ,
00467                NULL ) ;
00468 
00469    nw->vert_rc = XtVaCreateWidget(
00470                     "AFNI" , xmRowColumnWidgetClass , nw->frame ,
00471                        XmNpacking     , XmPACK_TIGHT ,
00472                        XmNorientation , XmVERTICAL ,
00473                        XmNtraversalOn , False ,
00474                        XmNmarginHeight, 0 ,
00475                        XmNmarginWidth , 0 ,
00476                     NULL ) ;
00477 
00478    nw->horz_rc = XtVaCreateWidget(
00479                     "AFNI" , xmRowColumnWidgetClass , nw->vert_rc ,
00480                        XmNpacking     , XmPACK_TIGHT ,
00481                        XmNorientation , XmHORIZONTAL ,
00482                        XmNtraversalOn , False ,
00483                        XmNmarginHeight, 0 ,
00484                        XmNmarginWidth , 0 ,
00485                     NULL ) ;
00486 
00487    nw->note_label = XtVaCreateManagedWidget(
00488                        "AFNI" , xmLabelWidgetClass , nw->horz_rc ,
00489                        XmNmarginHeight, 0 ,
00490                        XmNmarginWidth , 0 ,
00491                        NULL ) ;
00492 
00493    xstr = XmStringCreateLtoR( "Delete" , XmFONTLIST_DEFAULT_TAG ) ;
00494    nw->delete_pb = XtVaCreateManagedWidget(
00495                       "AFNI" , xmPushButtonWidgetClass , nw->horz_rc ,
00496                          XmNlabelString , xstr ,
00497                          XmNtraversalOn , False ,
00498                          XmNmarginHeight, 0 ,
00499                          XmNmarginWidth , 0 ,
00500                       NULL ) ;
00501    XmStringFree(xstr) ;
00502    XtAddCallback( nw->delete_pb, XmNactivateCallback, NOTES_delete_CB, NULL ) ;
00503    MCW_register_help( nw->delete_pb ,
00504                       "Use this button to delete\n"
00505                       "this Note from the dataset."
00506                     ) ;
00507    MCW_register_hint( nw->delete_pb , "Delete this Note" ) ;
00508 
00509    xstr = XmStringCreateLtoR( "Restore" , XmFONTLIST_DEFAULT_TAG ) ;
00510    nw->restore_pb = XtVaCreateManagedWidget(
00511                       "AFNI" , xmPushButtonWidgetClass , nw->horz_rc ,
00512                          XmNlabelString , xstr ,
00513                          XmNtraversalOn , False ,
00514                          XmNmarginHeight, 0 ,
00515                          XmNmarginWidth , 0 ,
00516                       NULL ) ;
00517    XmStringFree(xstr) ;
00518    XtAddCallback( nw->restore_pb, XmNactivateCallback, NOTES_restore_CB, NULL ) ;
00519    MCW_register_help( nw->restore_pb ,
00520                       "Use this button to restore\n"
00521                       "this Note to its original\n"
00522                       "value (i.e., as it currently\n"
00523                       "stored on in the HEAD file)."
00524                     ) ;
00525    MCW_register_hint( nw->restore_pb , "Restore Note from disk" ) ;
00526 
00527    XtManageChild(nw->horz_rc) ;
00528 
00529    (void) XtVaCreateManagedWidget(
00530              "AFNI" , xmSeparatorWidgetClass , nw->vert_rc ,
00531                 XmNseparatorType , XmSINGLE_LINE ,
00532              NULL ) ;
00533 
00534    nw->scrollw = XtVaCreateManagedWidget(
00535                     "AFNI" , xmScrolledWindowWidgetClass , nw->vert_rc ,
00536                        XmNscrollingPolicy        , XmAPPLICATION_DEFINED ,
00537                        XmNvisualPolicy           , XmVARIABLE ,
00538                        XmNshadowThickness        , 0 ,
00539                     NULL ) ;
00540 
00541    nw->textw = XtVaCreateManagedWidget(
00542                     "AFNI" , xmTextWidgetClass , nw->scrollw ,
00543                        XmNeditMode               , XmMULTI_LINE_EDIT ,
00544                        XmNautoShowCursorPosition , True ,
00545                        XmNeditable               , True ,
00546                        XmNcursorPositionVisible  , True ,
00547                        XmNcolumns                , TWIDTH ,
00548                        XmNrows                   , 1    ,
00549                        XmNwordWrap               , True ,
00550                     NULL ) ;
00551 
00552    XtManageChild(nw->vert_rc) ;  /* we DON'T manage the frame */
00553 
00554    nw->note_orig = nw->date_orig = NULL ;
00555    return nw ;
00556 }

void NOTES_make_widgets void    [static]
 

Definition at line 248 of file plug_notes.c.

References add_pb, cbuf, choose_pb, MCW_action_item::data, DC_yokify(), MCW_DC::display, done_pb, help_pb, info_lab, malloc, max_tlines, MCW_action_area(), MCW_register_help(), MCW_register_hint(), my_getenv(), NACT, notar_num, noterc, NOTES_choose_CB(), NOTES_make_note(), NOTES_quit_CB(), notesw, plint, quit_pb, refit_pb, save_pb, shell, text_height, text_width, THEIGHT, topman, and TWIDTH.

Referenced by NOTES_main().

00249 {
00250    XmString xstr ;
00251    Widget twid , tsep ;
00252 
00253    /*** get max # of text lines ***/
00254 
00255    if( max_tlines < 1 ){
00256       char * cc = my_getenv("AFNI_NOTES_DLINES") ;
00257       if( cc != NULL ) max_tlines = strtol( cc , NULL , 10 ) ;
00258 
00259            if( max_tlines <  1 ) max_tlines = THEIGHT ;
00260       else if( max_tlines > 99 ) max_tlines = 99 ;     /* 15 Sep 1999 */
00261    }
00262 
00263    /*** top level shell for window manager ***/
00264 
00265    shell =
00266       XtVaAppCreateShell(
00267            "AFNI" , "AFNI" , topLevelShellWidgetClass , dc->display ,
00268 
00269            XmNtitle             , "Notes Editor" , /* top of window */
00270            XmNiconName          , "Notes"        , /* label on icon */
00271            XmNdeleteResponse    , XmDO_NOTHING   , /* deletion handled below */
00272            XmNallowShellResize  , True ,           /* let code resize shell? */
00273            XmNmappedWhenManaged , False ,          /* must map it manually */
00274       NULL ) ;
00275 
00276    DC_yokify( shell , dc ) ;
00277 
00278    if( afni48_good )             /* set icon pixmap */
00279       XtVaSetValues( shell ,
00280                         XmNiconPixmap , afni48_pixmap ,
00281                      NULL ) ;
00282 
00283    XmAddWMProtocolCallback(      /* make "Close" window menu work */
00284            shell ,
00285            XmInternAtom( dc->display , "WM_DELETE_WINDOW" , False ) ,
00286            NOTES_quit_CB , (XtPointer) plint ) ;
00287 
00288    /*** Form widget to hold all user interface stuff ***/
00289 
00290    topman = XtVaCreateWidget(
00291                 "AFNI" , xmFormWidgetClass , shell ,
00292                   XmNborderWidth , 0 ,
00293                   XmNborderColor , 0 ,
00294                   XmNtraversalOn , False ,
00295                 NULL ) ;
00296 
00297    /*** horizontal rowcol to hold top row of controls ***/
00298 
00299    twid = XtVaCreateWidget(
00300              "AFNI" , xmRowColumnWidgetClass , topman ,
00301                 XmNpacking     , XmPACK_TIGHT ,
00302                 XmNorientation , XmHORIZONTAL ,
00303                 XmNtraversalOn , False ,
00304                 XmNleftAttachment , XmATTACH_FORM ,
00305                 XmNrightAttachment, XmATTACH_FORM ,
00306                 XmNtopAttachment  , XmATTACH_FORM ,
00307                 XmNtopOffset      , 1 ,
00308              NULL ) ;
00309 
00310    /*** button to let user choose dataset to edit ***/
00311 
00312    xstr = XmStringCreateLtoR( "Choose Dataset" , XmFONTLIST_DEFAULT_TAG ) ;
00313    choose_pb = XtVaCreateManagedWidget(
00314                   "AFNI" , xmPushButtonWidgetClass , twid ,
00315                      XmNlabelString , xstr ,
00316                      XmNtraversalOn , False ,
00317                   NULL ) ;
00318    XmStringFree(xstr) ;
00319    XtAddCallback( choose_pb, XmNactivateCallback, NOTES_choose_CB, NULL ) ;
00320    MCW_register_help( choose_pb ,
00321                       "Use this to popup a\n"
00322                       "'chooser' that lets\n"
00323                       "you select which\n"
00324                       "dataset to edit."
00325                     ) ;
00326    MCW_register_hint( choose_pb , "Popup a dataset chooser" ) ;
00327 
00328    /*** label at top to let user know who we are ***/
00329 
00330    xstr = XmStringCreateLtoR( "[No dataset]" , XmFONTLIST_DEFAULT_TAG ) ;
00331    info_lab = XtVaCreateManagedWidget(
00332                  "AFNI" , xmLabelWidgetClass , twid ,
00333                     XmNlabelString , xstr ,
00334                  NULL ) ;
00335    XmStringFree(xstr) ;
00336    MCW_register_help( info_lab , "Shows dataset being edited" ) ;
00337    MCW_register_hint( info_lab , "Dataset being edited" ) ;
00338 
00339    XtManageChild(twid) ;  /*** end of top row ***/
00340 
00341    /*** separator for visual neatness ***/
00342 
00343    tsep   = XtVaCreateManagedWidget(
00344              "AFNI" , xmSeparatorWidgetClass , topman ,
00345                 XmNseparatorType , XmSINGLE_LINE ,
00346                 XmNleftAttachment  , XmATTACH_FORM ,
00347                 XmNrightAttachment , XmATTACH_FORM ,
00348                 XmNtopAttachment   , XmATTACH_WIDGET ,
00349                 XmNtopWidget       , info_lab ,
00350                 XmNtopOffset       , 1 ,
00351              NULL ) ;
00352 
00353    /*** a set of action buttons below the line ***/
00354 
00355    twid = MCW_action_area( topman , NOTES_actor , NACT ) ;
00356 
00357    XtVaSetValues( twid ,
00358                      XmNleftAttachment , XmATTACH_FORM ,
00359                      XmNrightAttachment, XmATTACH_FORM ,
00360                      XmNtopAttachment  , XmATTACH_WIDGET ,
00361                      XmNtopWidget      , tsep   ,
00362                      XmNtopOffset      , 1 ,
00363                   NULL ) ;
00364 
00365    quit_pb  = (Widget) NOTES_actor[0].data ;
00366    help_pb  = (Widget) NOTES_actor[1].data ;
00367    add_pb   = (Widget) NOTES_actor[2].data ;
00368    refit_pb = (Widget) NOTES_actor[3].data ;
00369    save_pb  = (Widget) NOTES_actor[4].data ;
00370    done_pb  = (Widget) NOTES_actor[5].data ;
00371 
00372    /*** separator for visual neatness ***/
00373 
00374    tsep   = XtVaCreateManagedWidget(
00375               "AFNI" , xmSeparatorWidgetClass , topman ,
00376                  XmNseparatorType , XmSINGLE_LINE ,
00377                  XmNleftAttachment  , XmATTACH_FORM ,
00378                  XmNrightAttachment , XmATTACH_FORM ,
00379                  XmNtopAttachment   , XmATTACH_WIDGET ,
00380                  XmNtopWidget       , twid ,
00381                  XmNtopOffset       , 1 ,
00382               NULL ) ;
00383 
00384    /*** a scrolled window + rowcol to hold all the Notes windows ***/
00385 
00386    notesw = XtVaCreateWidget(
00387                     "AFNI" , xmScrolledWindowWidgetClass , topman ,
00388                        XmNscrollingPolicy        , XmAUTOMATIC ,
00389                        XmNvisualPolicy           , XmCONSTANT ,
00390                        XmNshadowThickness        , 0 ,
00391                        XmNscrollBarDisplayPolicy , XmAS_NEEDED ,
00392                        XmNscrollBarPlacement     , XmTOP_LEFT ,
00393                        XmNleftAttachment  , XmATTACH_FORM ,
00394                        XmNrightAttachment , XmATTACH_FORM ,
00395                        XmNbottomAttachment, XmATTACH_FORM ,
00396                        XmNtopAttachment   , XmATTACH_WIDGET ,
00397                        XmNtopWidget       , tsep   ,
00398                        XmNtopOffset       , 1 ,
00399                     NULL ) ;
00400 
00401    noterc = XtVaCreateWidget(
00402              "AFNI" , xmRowColumnWidgetClass , notesw ,
00403                 XmNpacking     , XmPACK_TIGHT ,
00404                 XmNorientation , XmVERTICAL ,
00405                 XmNmarginHeight, 0 ,
00406                 XmNmarginWidth , 0 ,
00407                 XmNtraversalOn , False ,
00408              NULL ) ;
00409 
00410    /**** make an initial Note window
00411          and modify it to be readonly - for the History ****/
00412 
00413    notar     = (NOTE_wind **) malloc( sizeof(NOTE_wind *) ) ;
00414    notar[0]  = NOTES_make_note() ;
00415    notar_num = 1 ;
00416 
00417    XtUnmanageChild( notar[0]->delete_pb  ) ;  /* these actions not   */
00418    XtUnmanageChild( notar[0]->restore_pb ) ;  /* allowed for History */
00419    XtVaSetValues( notar[0]->textw ,
00420                     XmNautoShowCursorPosition , False ,
00421                     XmNeditable               , False ,
00422                     XmNcursorPositionVisible  , False ,
00423                   NULL ) ;
00424    xstr = XmStringCreateLtoR( "----- History -----" , XmFONTLIST_DEFAULT_TAG ) ;
00425    XtVaSetValues( notar[0]->note_label , XmNlabelString , xstr , NULL ) ;
00426    MCW_register_hint( notar[0]->textw , "Dataset History; or Edifying Text" ) ;
00427 
00428    /*** compute width of popup window ***/
00429 
00430    { char cbuf[TWIDTH+8] ; int ii ;
00431      XmFontList xflist ;
00432 
00433      for( ii=0; ii < TWIDTH+3; ii++ ) cbuf[ii] = 'x' ; cbuf[ii] = '\0' ;
00434      xstr = XmStringCreateLtoR( cbuf , XmFONTLIST_DEFAULT_TAG ) ;
00435      XtVaGetValues( notar[0]->textw , XmNfontList , &xflist , NULL ) ;
00436      text_width  = XmStringWidth ( xflist , xstr ) + 14 ;
00437      text_height = XmStringHeight( xflist , xstr ) ;
00438      XmStringFree( xstr ) ;
00439      ii = WidthOfScreen(XtScreen(shell)) - 128 ;
00440      if( text_width > ii ) text_width = ii ;
00441    }
00442 
00443    /*** done ***/
00444 
00445    XtManageChild(topman) ;
00446    XtRealizeWidget(shell) ;  /* will not be mapped */
00447 
00448    return ;
00449 }

void NOTES_quit_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 583 of file plug_notes.c.

References client_data, NOTE_wind::date_orig, editor_open, free, notar_num, NOTE_wind::note_orig, noterc, notesw, and shell.

Referenced by NOTES_done_CB(), and NOTES_make_widgets().

00584 {
00585    int ii ;
00586 
00587    XtUnmapWidget( shell ) ; editor_open = 0 ; dset = NULL ;
00588 
00589    XtUnmanageChild( notesw ) ;
00590    XtUnmanageChild( noterc ) ;
00591    for( ii=0 ; ii < notar_num ; ii++ ){
00592       XtUnmanageChild( notar[ii]->frame ) ;
00593 
00594       if( notar[ii]->note_orig != NULL ){
00595           free(notar[ii]->note_orig) ; notar[ii]->note_orig = NULL ;
00596       }
00597 
00598       if( notar[ii]->date_orig != NULL ){
00599           free(notar[ii]->date_orig) ; notar[ii]->date_orig = NULL ;
00600       }
00601 
00602       XmTextSetString( notar[ii]->textw , "\0" ) ;  /* to save some space */
00603    }
00604 
00605    return ;
00606 }

void NOTES_refit_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 1015 of file plug_notes.c.

References client_data, MCW_DC::display, MCW_DC::height, line_count(), max_tlines, MCW_widget_geom(), noterc, notesw, num_notes, qh, and XtFree.

01016 {
01017    int ii , hh , nl , qh ;
01018    char * ts ;
01019 
01020    if( dset == NULL ){ XBell(dc->display,100) ; return ; }
01021 
01022    for( ii=0 ; ii <= num_notes ; ii++ ){
01023       ts =  XmTextGetString( notar[ii]->textw ) ;  /* get text in window */
01024       nl = line_count( ts ) ; XtFree( ts ) ;       /* count lines */
01025       if( nl > max_tlines ) nl = max_tlines ;
01026       XtVaSetValues( notar[ii]->textw , XmNrows , nl , NULL ) ;
01027    }
01028 
01029    /* set size of scrolling area for notes */
01030 
01031    MCW_widget_geom( noterc , NULL,&hh , NULL,NULL ) ; hh += 4 ; qh = hh ;
01032    if( hh > dc->height- 128 ) hh = dc->height- 128 ;
01033 
01034    XtVaSetValues( notesw , XmNheight,hh , NULL ) ;
01035    return ;
01036 }

void NOTES_restore_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 1094 of file plug_notes.c.

References client_data, num_notes, and NOTE_wind::restore_pb.

Referenced by NOTES_make_note().

01095 {
01096    int kk ;
01097 
01098    if( dset == NULL ) return ;    /* should never happen */
01099 
01100    for( kk=1 ; kk <= num_notes ; kk++ )
01101       if( w == notar[kk]->restore_pb ) break ;
01102 
01103    if( kk > num_notes ) return ;  /* should never happen */
01104 
01105    XmTextSetString( notar[kk]->textw , notar[kk]->note_orig ) ;
01106    return ;
01107 }

void NOTES_save_CB Widget   ,
XtPointer   ,
XtPointer   
[static]
 

Definition at line 612 of file plug_notes.c.

References client_data, NOTE_wind::date_orig, MCW_DC::display, DSET_write_header, free, MCW_invert_widget(), MCW_popup_message(), MCW_TIMER_KILL, MCW_USER_KILL, newstring, NOTE_wind::note_orig, num_notes, save_pb, tross_Get_Notedate(), tross_Store_Note(), and XtFree.

Referenced by NOTES_done_CB().

00613 {
00614    int ii , nnew ;
00615    char * nstr , str[256] ;
00616    XmString xstr ;
00617 
00618    if( dset == NULL || num_notes == 0 ){ XBell(dc->display,100); return; }
00619 
00620    MCW_invert_widget(save_pb) ;
00621 
00622    /* copy notes in windows into dataset, if they are changed */
00623 
00624    for( nnew=0,ii=1 ; ii <= num_notes ; ii++ ){
00625       nstr = XmTextGetString( notar[ii]->textw ) ;  /* get text in window */
00626       if( strcmp(nstr,notar[ii]->note_orig) != 0 ){ /* compare to original */
00627 
00628          tross_Store_Note( dset , ii , nstr ) ; nnew++ ;  /* save it */
00629          free( notar[ii]->note_orig ) ;                   /* make new copy */
00630          notar[ii]->note_orig = newstring(nstr) ;
00631          free( notar[ii]->date_orig ) ;                   /* re-fetch date */
00632          notar[ii]->date_orig = tross_Get_Notedate( dset , ii ) ;
00633 
00634          sprintf(str,"----- NOTE %d [%s] -----",ii,notar[ii]->date_orig) ;
00635          xstr = XmStringCreateLtoR( str , XmFONTLIST_DEFAULT_TAG ) ;
00636          XtVaSetValues( notar[ii]->note_label , XmNlabelString , xstr , NULL ) ;
00637          XmStringFree(xstr) ;
00638       }
00639       XtFree(nstr) ;
00640    }
00641 
00642    /* now save notes */
00643 
00644    if( nnew > 0 )
00645       DSET_write_header(dset) ;
00646    else if( w != NULL )
00647       (void) MCW_popup_message( save_pb ,
00648                                 " \n Nothing has changed! \n " ,
00649                                 MCW_USER_KILL | MCW_TIMER_KILL ) ;
00650 
00651    MCW_invert_widget(save_pb) ;
00652    return ;
00653 }

DEFINE_PLUGIN_PROTOTYPE PLUGIN_interface* PLUGIN_init int    ncall
 

Definition at line 56 of file plug_notes.c.

References NOTES_main(), plint, PLUTO_add_hint(), and PLUTO_set_sequence().

00057 {
00058 
00059    if( ncall > 0 ) return NULL ;  /* only one interface */
00060 
00061    plint = PLUTO_new_interface( "Dataset NOTES" , NULL , NULL ,
00062                                 PLUGIN_CALL_IMMEDIATELY , NOTES_main ) ;
00063 
00064    PLUTO_add_hint( plint , "Edit/View Notes attached to dataset" ) ;
00065 
00066    PLUTO_set_sequence( plint , "A:olddset:notes" ) ;
00067 
00068    return plint ;
00069 }

void scroll_topbot Widget   ,
int   
[static]
 

Definition at line 1111 of file plug_notes.c.

References sb.

Referenced by NOTES_add_CB(), and NOTES_finalize_dset_CB().

01112 {
01113    Widget sb=NULL ;
01114    int val,siz,inc,pag , smin,smax ;
01115 
01116    if( sw == NULL ) return ;
01117 
01118    XtVaGetValues( sw ,
01119                      XmNverticalScrollBar , &sb ,
01120                      XmNmaximum           , &smax ,
01121                      XmNminimum           , &smin ,
01122                   NULL ) ;
01123    if( sb == NULL ) return ;
01124 
01125    XmScrollBarGetValues( sb , &val,&siz,&inc,&pag ) ;
01126 
01127    if( where == 0 ) val = smin ;  /* to top */
01128    else             val = smax ;  /* to bot */
01129 
01130    XmScrollBarSetValues( sb , val,siz,inc,pag , True ) ;
01131    return ;
01132 }

Variable Documentation

Widget add_pb [static]
 

Definition at line 87 of file plug_notes.c.

Referenced by NOTES_add_CB(), and NOTES_make_widgets().

Widget choose_pb [static]
 

Definition at line 86 of file plug_notes.c.

Referenced by NOTES_choose_CB(), NOTES_help_CB(), and NOTES_make_widgets().

MCW_DC* dc [static]
 

Definition at line 97 of file plug_notes.c.

char* default_history[NUM_DH] [static]
 

Definition at line 105 of file plug_notes.c.

Referenced by NOTES_finalize_dset_CB().

Widget done_pb [static]
 

Definition at line 87 of file plug_notes.c.

Referenced by NOTES_make_widgets().

THD_3dim_dataset* dset [static]
 

Definition at line 99 of file plug_notes.c.

MCW_idcode dset_idc [static]
 

Definition at line 100 of file plug_notes.c.

PLUGIN_dataset_link* dsl = NULL [static]
 

Definition at line 721 of file plug_notes.c.

Referenced by NOTES_choose_CB(), and NOTES_finalize_dset_CB().

int editor_open = 0 [static]
 

Definition at line 102 of file plug_notes.c.

Referenced by NOTES_finalize_dset_CB(), NOTES_main(), and NOTES_quit_CB().

char* empty_note = "-- Empty Note Text --" [static]
 

Definition at line 152 of file plug_notes.c.

Referenced by NOTES_add_CB(), and NOTES_finalize_dset_CB().

Widget help_pb [static]
 

Definition at line 87 of file plug_notes.c.

Referenced by NOTES_make_widgets().

Three_D_View* im3d [static]
 

Definition at line 98 of file plug_notes.c.

Widget info_lab [static]
 

Definition at line 86 of file plug_notes.c.

Referenced by NOTES_finalize_dset_CB(), NOTES_main(), and NOTES_make_widgets().

int max_tlines = 0 [static]
 

Definition at line 44 of file plug_notes.c.

Referenced by NOTES_add_CB(), NOTES_delete_CB(), NOTES_finalize_dset_CB(), NOTES_make_widgets(), and NOTES_refit_CB().

int ndsl = 0 [static]
 

Definition at line 720 of file plug_notes.c.

Referenced by NOTES_choose_CB(), and NOTES_finalize_dset_CB().

char* no_date = "no date" [static]
 

Definition at line 153 of file plug_notes.c.

Referenced by NOTES_add_CB(), and NOTES_finalize_dset_CB().

NOTE_wind** notar = NULL [static]
 

Definition at line 93 of file plug_notes.c.

int notar_num = 0 [static]
 

Definition at line 94 of file plug_notes.c.

Referenced by NOTES_add_CB(), NOTES_finalize_dset_CB(), NOTES_main(), NOTES_make_widgets(), and NOTES_quit_CB().

Widget noterc [static]
 

Definition at line 88 of file plug_notes.c.

Referenced by NOTES_add_CB(), NOTES_delete_CB(), NOTES_finalize_dset_CB(), NOTES_main(), NOTES_make_note(), NOTES_make_widgets(), NOTES_quit_CB(), and NOTES_refit_CB().

MCW_action_item NOTES_actor[NACT] [static]
 

Initial value:

 {
 {"Quit",NOTES_quit_CB,NULL,
  "Discard edits since last\nSave and close Editor" ,
   "Discard edits and close",0} ,

 {"Help",NOTES_help_CB,NULL,
  "Displays more help" , "Displays more help",0} ,

 {"Add",NOTES_add_CB,NULL,
  "Add a new Note to the\nlist (at the end)", "Add a new Note" , 0 } ,

 {"Refit",NOTES_refit_CB,NULL,
  "Resize the Notes' sub-windows\nto fit the Notes' texts." ,
  "Resize Notes sub-windows" , 0 } ,

 {"Save",NOTES_save_CB,NULL,
  "Save edits to disk\nand continue" , "Save to disk; continue",0} ,

 {"Done",NOTES_done_CB,NULL,
  "Save edits to disk\nand close Editor" , "Save and Quit",1}
}

Definition at line 226 of file plug_notes.c.

Widget notesw [static]
 

Definition at line 88 of file plug_notes.c.

Referenced by NOTES_add_CB(), NOTES_delete_CB(), NOTES_finalize_dset_CB(), NOTES_main(), NOTES_make_widgets(), NOTES_quit_CB(), and NOTES_refit_CB().

int num_notes = 0 [static]
 

Definition at line 95 of file plug_notes.c.

Referenced by NOTES_add_CB(), NOTES_delete_CB(), NOTES_done_CB(), NOTES_finalize_dset_CB(), NOTES_main(), NOTES_refit_CB(), NOTES_restore_CB(), and NOTES_save_CB().

PLUGIN_interface* plint = NULL [static]
 

Definition at line 37 of file plug_notes.c.

Referenced by NOTES_main(), NOTES_make_widgets(), and PLUGIN_init().

Widget quit_pb [static]
 

Definition at line 87 of file plug_notes.c.

Referenced by NOTES_make_widgets().

Widget refit_pb [static]
 

Definition at line 88 of file plug_notes.c.

Referenced by NOTES_make_widgets().

Widget save_pb [static]
 

Definition at line 87 of file plug_notes.c.

Referenced by NOTES_make_widgets(), and NOTES_save_CB().

Widget shell = NULL [static]
 

Definition at line 86 of file plug_notes.c.

Referenced by NOTES_main(), NOTES_make_widgets(), and NOTES_quit_CB().

int text_height = 0 [static]
 

Definition at line 91 of file plug_notes.c.

Referenced by NOTES_make_widgets().

int text_width = 0 [static]
 

Definition at line 90 of file plug_notes.c.

Referenced by NOTES_finalize_dset_CB(), and NOTES_make_widgets().

Widget topman [static]
 

Definition at line 86 of file plug_notes.c.

Referenced by NOTES_make_widgets().

 

Powered by Plone

This site conforms to the following standards: