if (! ttitlefont0->fid) { ttitlefont0 = XLoadQueryFont(disp, ml[0]); if (! ttitlefont0) { fprintf(stderr, "can't load fonts %s\n", ml[0]); exit(1); } } 
void a_start_interface(int pipe_in) {  static XtActionsRec actions[] ={    {"do-quit",(XtActionProc)quitCB},    {"fix-menu", (XtActionProc)filemenuCB},    {"do-menu", (XtActionProc)filemenuAction},    {"do-complete", (XtActionProc)completeDir},    {"do-chgdir", (XtActionProc)setDirAction},    {"draw-trace",(XtActionProc)redrawAction},    {"do-exchange",(XtActionProc)exchgWidth},    {"do-toggletrace",(XtActionProc)toggletrace},    {"do-revcaption",(XtActionProc)redrawCaption},    {"do-dialog-button",(XtActionProc)popdownLoad},    {"do-load",(XtActionProc)popupLoad},    {"do-play",(XtActionProc)playCB},    {"do-sndspec",(XtActionProc)sndspecCB},    {"do-pause",(XtActionProc)pauseAction},    {"do-stop",(XtActionProc)stopCB},    {"do-next",(XtActionProc)nextCB},    {"do-prev",(XtActionProc)prevCB},    {"do-forward",(XtActionProc)forwardCB},    {"do-back",(XtActionProc)backCB},    {"do-key",(XtActionProc)soundkeyAction},    {"do-speed",(XtActionProc)speedAction},    {"do-voice",(XtActionProc)voiceAction},    {"do-volset",(XtActionProc)volsetCB},    {"do-volupdown",(XtActionProc)volupdownAction},    {"do-tuneset",(XtActionProc)tunesetAction},    {"do-tuneslide",(XtActionProc)tuneslideAction},    {"do-resize",(XtActionProc)resizeAction},    {"checkRightAndPopupSubmenu",checkRightAndPopupSubmenu},    {"leaveSubmenu",leaveSubmenu},    {"popdownSubmenu",popdownSubmenu},    {"do-options",(XtActionProc)optionspopupCB},    {"do-filelist",(XtActionProc)flistpopupCB},    {"do-about",(XtActionProc)aboutCB},    {"do-closeparent",closeParent},    {"do-flistmove",flistMove},    {"do-fselect",(XtActionProc)fselectCB},    {"do-fdelete",(XtActionProc)fdeleteCB},    {"do-backspace",(XtActionProc)backspaceCB},#ifndef WIDGET_IS_LABEL_WIDGET    {"do-deltext",(XtActionProc)deleteTextCB},#endif  };  static String fallback_resources[]={#ifdef I18N    "*Command*international: True",    "*file_simplemenu*international: True",    "*Label*fontSet: -adobe-helvetica-bold-o-*-*-14-*-*-*-*-*-*-*",    "*MenuButton*fontSet: -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*",    "*Command*fontSet: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*",    "*List*fontSet: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*",    "*Text*fontSet: -misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*",    "*Form*fontSet: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*",#else    "*Label.font: -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*",    "*Text*font: -misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*",#endif    "*Text*background: " TEXTBG_COLOR "",    "*Text*scrollbar*background: " TEXTBG_COLOR "",    "*Scrollbar*background: " TEXTBG_COLOR "",    "*Label.foreground: black",    "*Label.background: #CCFF33",    "*Command.background: " COMMANDBUTTON_COLOR "",    "*Dialog.Command.background: " COMMANDBUTTON_COLOR "",    "*Dialog.Text.background: " TEXTBG_COLOR "",    "*fontSet: -*--14-*",    "*load_dialog.label.background: " COMMON_BGCOLOR "",#ifdef I18N    "*international: True",#else    "*international: False",#endif    "*Command.font: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*",    "*Toggle.font: -adobe-helvetica-medium-o-*-*-12-*-*-*-*-*-*-*",    "*MenuButton.translations:<EnterWindow>:    highlight()\\n\        <LeaveWindow>:  reset()\\n\        Any<BtnDown>:   reset() fix-menu() PopupMenu()",    "*menu_box.borderWidth: 0",    "*button_box.borderWidth: 0",    "*button_box.horizDistance: 4",    "*file_menubutton.menuName: file_simplemenu",    "*file_menubutton.width: 60",    "*file_menubutton.height: 28",    "*file_menubutton.horizDistance: 6",    "*file_menubutton.vertDistance: 4",#ifdef I18N    "*file_menubutton.file_simplemenu*fontSet: -*--14-*",    "*title_menubutton.title_simplemenu*fontSet: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*",#else    "*file_menubutton.file_simplemenu*font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*",    "*title_menubutton.title_simplemenu*font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*",#endif    "*title_menubutton*SmeBSB.font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*",    "*title_menubutton.menuName: title_simplemenu",    "*popup_abox.OK.label: OK",    "*title_menubutton.width: 210",    "*title_menubutton.height: 28",    "*title_menubutton.resize: false",    "*title_menubutton.horizDistance: 6",    "*title_menubutton.vertDistance: 4",    "*title_menubutton.fromHoriz: file_menubutton",    "*time_label.width: 92",    "*time_label.height: 26",    "*time_label.resize: false",    "*time_label.fromHoriz: title_menubutton",    "*time_label.horizDistance: 1",    "*time_label.vertDistance: 4",    "*time_label.label: time / mode",    "*button_box.height: 40",    "*play_button.width: 32",    "*play_button.height: 32",    "*play_button.horizDistance: 1",    "*play_button.vertDistance: 9",    "*pause_button.width: 32",    "*pause_button.height: 32",    "*pause_button.horizDistance: 1",    "*pause_button.vertDistance: 1",    "*stop_button.width: 32",    "*stop_button.height: 32",    "*stop_button.horizDistance: 1",    "*stop_button.vertDistance: 1",    "*prev_button.width: 32",    "*prev_button.height: 32",    "*prev_button.horizDistance: 1",    "*prev_button.vertDistance: 1",    "*back_button.width: 32",    "*back_button.height: 32",    "*back_button.horizDistance: 1",    "*back_button.vertDistance: 1",    "*fwd_button.width: 32",    "*fwd_button.height: 32",    "*fwd_button.horizDistance: 1",    "*fwd_button.vertDistance: 1",    "*next_button.width: 32",    "*next_button.height: 32",    "*next_button.horizDistance: 1",    "*next_button.vertDistance: 1",    "*quit_button.width: 32",    "*quit_button.height: 32",    "*quit_button.horizDistance: 1",    "*quit_button.vertDistance: 1",    "*random_button.width: 32",    "*random_button.height: 32",    "*random_button.horizDistance: 4",    "*random_button.vertDistance: 1",    "*repeat_button.width: 32",    "*repeat_button.height: 32",    "*repeat_button.horizDistance: 1",    "*repeat_button.vertDistance: 1",    "*lyric_text.fromVert: tune_box",    "*lyric_text.borderWidth: 1" ,    "*lyric_text.vertDistance: 4",    "*lyric_text.horizDistance: 6",#ifndef WIDGET_IS_LABEL_WIDGET    "*lyric_text.height: 120",    "*lyric_text.scrollVertical: WhenNeeded",    "*lyric_text.translations: #override\\n\        <Btn2Down>:     do-deltext()",#else    "*lyric_text.height: 30",    "*lyric_text.label: MessageWindow",    "*lyric_text.resize: true",#endif#ifdef I18N    "*popup_optbox*international: True",    "*lyric_text.international: True",    "*volume_box*fontSet: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*",    "*tune_box*fontSet: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*",#else    "*popup_optbox*international: False",    "*lyric_text.international: False",    "*volume_box*font: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*",    "*tune_box*font: -adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*",#endif    "*volume_label.vertDistance: 0",    "*volume_box.vertDistance: 2",    "*volume_box.borderWidth: 0",    "*volume_label.borderWidth: 0",    "*volume_bar.length: 330",    "*tune_box.borderWidth: 0",    "*tune_label.label: ----",    "*tune_label.vertDistance: 0",    "*tune_label.horizDistance: 0",    "*tune_label0.horizDistance: 0",    "*tune_box.vertDistance: 2",    "*tune_bar.length: 330",    "*popup_load.title: TiMidity <Load File>",    "*popup_loadform.height: 400",    "*popup_option.title: TiMidity <Extend Modes>",    "*popup_file.title: TiMidity <File List>",    "*popup_about.title: Information",    "*load_dialog.label: File Name",    "*load_dialog.borderWidth: 0",    "*load_dialog.height: 132",    "*trace.vertDistance: 2",    "*trace.borderWidth: 1",    "*trace_vport.borderWidth: 1",#ifdef I18N    "*popup_loadform.load_dialog.label.fontSet: -*--14-*",    "*popup_abox*fontSet: -adobe-helvetica-bold-o-*-*-14-*-*-*-*-*-*-*",#else    "*popup_loadform.load_dialog.label.font: -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*",    "*popup_abox*font: -adobe-helvetica-bold-o-*-*-14-*-*-*-*-*-*-*",#endif    "*cwd_label.font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*",    "*time_label*cwd_info.font: -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*",    "*time_label.font: -adobe-helvetica-bold-r-*-*-14-*-*-*-*-*-*-*",    "*BitmapDir: " XAW_BITMAP_DIR "/",#ifdef XAW3D    "*volume_bar.translations: #override\\n\        ~Ctrl Shift<Btn1Down>: do-volupdown(-50)\\n\        ~Ctrl Shift<Btn3Down>: do-volupdown(50)\\n\        Ctrl ~Shift<Btn1Down>: do-volupdown(-5)\\n\        Ctrl ~Shift<Btn3Down>: do-volupdown(5)\\n\        <Btn1Down>: MoveThumb()\\n\        <BtnUp>: NotifyScroll(FullLength) EndScroll()",    "*tune_bar.translations: #override\\n\        <Btn1Up>: do-tuneset()\\n\        <Btn3Up>: do-tuneslide()\\n\        <Btn1Down>: MoveThumb()\\n\        <BtnUp>: NotifyScroll(FullLength) EndScroll()",#else    "*volume_bar.translations: #override\\n\        ~Ctrl Shift<Btn1Down>: do-volupdown(-50)\\n\        ~Ctrl Shift<Btn3Down>: do-volupdown(50)\\n\        Ctrl ~Shift<Btn1Down>: do-volupdown(-5)\\n\        Ctrl ~Shift<Btn3Down>: do-volupdown(5)\\n\        <Btn1Down>: StartScroll(Forward) MoveThumb()\\n\        <Btn3Down>: StartScroll(Backward) MoveThumb()\\n\        <BtnUp>: NotifyScroll(FullLength) EndScroll()",    "*tune_bar.translations: #override\\n\        <Btn1Up>: do-tuneset()\\n\        <Btn3Up>: do-tuneslide()\\n\        <Btn1Down>: StartScroll(Forward) MoveThumb()\\n\        <Btn3Down>: StartScroll(Backward) MoveThumb()\\n\        <BtnUp>: NotifyScroll(FullLength) EndScroll()",#endif    "*file_simplemenu.load.label: Load (Meta-N)",    "*file_simplemenu.saveconfig.label: Save Config (Meta-S)",    "*file_simplemenu.hidetext.label: (Un)Hide Messages (Ctrl-M)",    "*file_simplemenu.hidetrace.label: (Un)Hide Trace (Ctrl-T)",    "*file_simplemenu.shuffle.label: Shuffle (Ctrl-S)",    "*file_simplemenu.repeat.label: Repeat (Ctrl-R)",    "*file_simplemenu.autostart.label: Auto Start",    "*file_simplemenu.autoquit.label: Auto Exit",    "*file_simplemenu.filelist.label: File List (Ctrl-F)",    "*file_simplemenu.modes.label: Extend Modes (Ctrl-O)",    "*file_simplemenu.about.label: About",    "*file_simplemenu.quit.label: Quit (Meta-Q, Q)",    "*load_dialog.OK.label: OK",    "*load_dialog.add.label: Add ALL",    "*load_dialog.cancel.label: Cancel",    "*flist_cmdbox.fplaybutton.label: Play",    "*flist_cmdbox.fdeletebutton.label: Delete",    "*flist_cmdbox.fdelallbutton.label: Delete ALL",    "*closebutton.label: Close",    "*modul_box.modul_lbl.label: Modulation control",    "*porta_box.porta_lbl.label: Portamento control",    "*nrpnv_box.nrpnv_lbl.label: NRPN Vibration",    "*reverb_box.reverb_lbl.label: Reverb control",    "*chorus_box.chorus_lbl.label: Chorus control",    "*chpressure_box.chpressure_lbl.label: Channel Pressure control",    "*overlapvoice_box.overlapv_lbl.label: Allow Multiple Same Notes",    "*txtmeta_box.txtmeta_lbl.label: Tracing All Text Meta Events",    "*base_form.translations: #override\\n\        ~Ctrl Meta<Key>n:   do-load()\\n\        ~Ctrl Meta<Key>s:   do-menu(" IDS_SAVECONFIG ")\\n\        Ctrl <Key>r:        do-menu(" IDS_REPEAT ")\\n\        Ctrl <Key>s:        do-menu(" IDS_SHUFFLE ")\\n\        Ctrl<Key>t:     do-menu(" IDS_HIDETRACE ")\\n\        Ctrl<Key>m:     do-menu(" IDS_HIDETXT ")\\n\        ~Ctrl<Key>q:        do-quit()\\n\        ~Ctrl<Key>r:        do-play()\\n\        <Key>Return:        do-play()\\n\        <Key>KP_Enter:      do-play()\\n\        ~Ctrl<Key>g:        do-sndspec()\\n\        ~Ctrl<Key>space:    do-pause()\\n\        ~Ctrl<Key>s:        do-stop()\\n\        <Key>p:         do-prev()\\n\        <Key>Left:      do-prev()\\n\        ~Meta<Key>n:        do-next()\\n\        <Key>Right:     do-next()\\n\        ~Ctrl<Key>f:        do-forward()\\n\        ~Ctrl<Key>b:        do-back()\\n\        ~Ctrl<Key>plus:     do-key()\\n\        ~Shift<Key>-:       do-key(1)\\n\        <Key>KP_Add:        do-key()\\n\        <Key>KP_Subtract:   do-key(1)\\n\        ~Ctrl<Key>greater:  do-speed()\\n\        ~Ctrl<Key>less:     do-speed(1)\\n\        ~Ctrl ~Shift<Key>o: do-voice()\\n\        ~Ctrl Shift<Key>o:  do-voice(1)\\n\        Ctrl<Key>o:     do-options()\\n\        Ctrl<Key>f:     do-filelist()\\n\        <Key>l:         do-filelist()\\n\        <Key>a:         do-about()\\n\        ~Ctrl ~Shift<Key>v: do-volupdown(-10)\\n\        ~Ctrl Shift<Key>v:  do-volupdown(10)\\n\        <Key>Down:  do-volupdown(-10)\\n\        <Key>Up:    do-volupdown(10)\\n\        ~Ctrl<Key>x:        do-exchange()\\n\        ~Ctrl<Key>t:        do-toggletrace()\\n\        <ConfigureNotify>:  do-resize()",    "*load_dialog.value.translations: #override\\n\        ~Ctrl<Key>Return:   do-chgdir() end-of-line()\\n\        ~Ctrl<Key>KP_Enter: do-chgdir() end-of-line()\\n\        ~Ctrl ~Meta<Key>Tab:    do-complete() end-of-line()\\n\        Ctrl ~Shift<Key>g:  do-dialog-button(1)\\n\        <Key>BackSpace:     do-backspace() delete-previous-character()\\n\        <Key>Delete:        do-backspace() delete-previous-character()\\n\        Ctrl<Key>H:         do-backspace() delete-previous-character()\\n\        <Key>Escape:        do-dialog-button(1)",    "*trace.translations: #override\\n\        <Btn1Down>:     do-toggletrace()\\n\        <EnterNotify>:      do-revcaption()\\n\        <LeaveNotify>:      do-revcaption()\\n\        <Expose>:       draw-trace()",    "*time_label.translations: #override\\n\        <Btn2Down>:     do-menu(" IDS_HIDETRACE ")\\n\        <Btn3Down>:     do-exchange()",    "*popup_optbox.translations: #override\\n\        ~Ctrl<Key>c:        do-closeparent()\\n\        ~Ctrl<Key>q:        do-quit()",    "*popup_fbox.translations: #override\\n\        ~Ctrl<Key>c:        do-closeparent()\\n\        <Key>Up:        do-flistmove(-1)\\n\        <Key>p:         do-flistmove(-1)\\n\        <Key>Prior:     do-flistmove(-5)\\n\        <Key>Right:     do-flistmove(-5)\\n\        ~Ctrl<Key>r:        do-fselect()\\n\        <Key>Return:        do-fselect()\\n\        <Key>KP_Enter:      do-fselect()\\n\        Ctrl<Key>m:     do-fselect()\\n\        <Key>space:     do-pause()\\n\        <Key>s:         do-stop()\\n\        <Key>Down:      do-flistmove(1)\\n\        <Key>n:         do-flistmove(1)\\n\        <Key>Next:      do-flistmove(5)\\n\        <Key>Left:      do-flistmove(5)\\n\        <Key>d:         do-fdelete()\\n\        ~Shift<Key>v:       do-volupdown(-10)\\n\        Shift<Key>v:        do-volupdown(10)\\n\        ~Ctrl<Key>f:        do-forward()\\n\        ~Ctrl<Key>b:        do-back()\\n\        ~Ctrl<Key>q:        do-quit()",    "*popup_abox.translations: #override\\n\        ~Ctrl<Key>c:        do-closeparent()\\n\        <Key>KP_Enter:      do-closeparent()\\n\        <Key>Return:        do-closeparent()",    NULL,  };  XtAppContext app_con;  char cbuf[PATH_MAX];  Pixmap bmPixmap;  int bmwidth, bmheight;  int i, j, k, tmpi;  int argc=1;  float thumb, l_thumb, l_thumbj;  char *argv=APP_NAME, *filetext;#ifdef I18N  #define XtNfontDEF XtNfontSet  XFontSet textfont;#else  #define XtNfontDEF XtNfont  XFontStruct *textfont;#endif  XawListReturnStruct lrs;  unsigned long gcmask;  XGCValues gcval;#ifdef DEBUG_PRINT_RESOURCE  char str[BUFSIZ], *p,*new;  for(i=0; fallback_resources[i] != NULL; i++) {    p = fallback_resources[i]; new= str;    while(*p != NULL) {      if(*p == 'n' && *(p-1) == '\\') {        *new++ = 'n'; *new++ = '\\'; *new++ = '\n';      } else {        *new++ = *p;      }      p++;    }    *new = '\0'; puts(str);  }  exit(0);#endif  xaw_vendor_setup();#ifdef I18N  XtSetLanguageProc(NULL,NULL,NULL);#endif  toplevel=XtVaAppInitialize(&app_con,APP_CLASS,NULL,ZERO,&argc,&argv,                         fallback_resources,NULL);  XtGetApplicationResources(toplevel,(caddr_t)&app_resources,xaw_resources,                          XtNumber(xaw_resources),NULL,0);  bitmapdir = app_resources.bitmap_dir;  arrangetitle = app_resources.arrange_title;  savelist = app_resources.save_list;  text_height = (Dimension)app_resources.text_height;  trace_width = (Dimension)app_resources.trace_width;  trace_height = (Dimension)app_resources.trace_height;  menu_width = (Dimension)app_resources.menu_width;  labelfont = app_resources.label_font;  volumefont = app_resources.volume_font;  textfont = app_resources.text_font;  tracefont = app_resources.trace_font;  ttitlefont = app_resources.ttitle_font;  a_readconfig(&Cfg);  amplitude=    (amplification == DEFAULT_AMPLIFICATION)? Cfg.amplitude:amplification;  disp = XtDisplay(toplevel);  screen = DefaultScreen(disp);  root_height = DisplayHeight(disp, screen);  root_width = DisplayWidth(disp, screen);  check_mark = XCreateBitmapFromData(XtDisplay(toplevel),                                     RootWindowOfScreen(XtScreen(toplevel)),                                     (char *)check_bits,                                     check_width, check_height);  arrow_mark = XCreateBitmapFromData(XtDisplay(toplevel),                                      RootWindowOfScreen(XtScreen(toplevel)),                                      (char *)arrow_bits,                                      (unsigned int)arrow_width,arrow_height);  on_mark = XCreateBitmapFromData(XtDisplay(toplevel),                                      RootWindowOfScreen(XtScreen(toplevel)),                                      (char *)on_bits,                                      (unsigned int)on_width,on_height);  off_mark = XCreateBitmapFromData(XtDisplay(toplevel),                                      RootWindowOfScreen(XtScreen(toplevel)),                                      (char *)off_bits,                                      (unsigned int)off_width,off_height);  for(i= 0; i < MAXBITMAP; i++) {    snprintf(cbuf,sizeof(cbuf),"%s/%s",bitmapdir,bmfname[i]);    XReadBitmapFile(disp,RootWindow(disp,screen),cbuf,&bm_width[i],&bm_height[i],                    &bm_Pixmap[i],&x_hot,&y_hot);  }  safe_getcwd(basepath, sizeof(basepath));#ifdef OFFIX  DndInitialize(toplevel);  DndRegisterOtherDrop(FileDropedHandler);  DndRegisterIconDrop(FileDropedHandler);#endif  XtAppAddActions(app_con, actions, XtNumber(actions));  bgcolor = app_resources.common_bgcolor;  menubcolor = app_resources.menub_bgcolor;  textcolor = app_resources.common_fgcolor;  textbgcolor = app_resources.text_bgcolor;  text2bgcolor = app_resources.text2_bgcolor;  buttonbgcolor = app_resources.button_bgcolor;  buttoncolor = app_resources.button_fgcolor;  togglecolor = app_resources.toggle_fgcolor;  if(ctl->trace_playing) {    volcolor = app_resources.volume_color;    expcolor = app_resources.expr_color;    pancolor = app_resources.pan_color;    tracecolor = app_resources.trace_bgcolor;  }  if(ctl->trace_playing) {    gcmask = GCForeground | GCBackground | GCFont;    gcval.foreground = 1;    gcval.background = 1;    gcval.plane_mask = 1;#ifdef I18N    XFontsOfFontSet(ttitlefont,&fs_list,&ml);    ttitlefont0 = fs_list[0];    gcval.font = ttitlefont0->fid;#else    gcval.font = ttitlefont->fid;#endif    gcs = XCreateGC(disp, RootWindow(disp, screen), gcmask, &gcval);  }  base_f=XtVaCreateManagedWidget("base_form",boxWidgetClass,toplevel,            XtNbackground,bgcolor,            XtNwidth,rotatewidth[currwidth], NULL);  m_box=XtVaCreateManagedWidget("menu_box",boxWidgetClass,base_f,            XtNorientation,XtorientHorizontal,            XtNbackground,bgcolor, NULL);  filetext = app_resources.file_text;  file_mb=XtVaCreateManagedWidget("file_menubutton",menuButtonWidgetClass,m_box,            XtNbackground,menubcolor,            XtNfont,labelfont, XtNlabel,filetext, NULL);  file_sm=XtVaCreatePopupShell("file_simplemenu",simpleMenuWidgetClass,file_mb,            XtNforeground,textcolor, XtNbackground,textbgcolor,XtNresize,False,            XtNbackingStore,NotUseful, XtNsaveUnder,False, XtNwidth,menu_width+100,            NULL);  snprintf(cbuf,sizeof(cbuf),"TiMidity++ %s",timidity_version);  title_mb=XtVaCreateManagedWidget("title_menubutton",menuButtonWidgetClass,m_box,            XtNbackground,menubcolor,XtNlabel,cbuf,            XtNfont,labelfont, NULL);  title_sm=XtVaCreatePopupShell("title_simplemenu",simpleMenuWidgetClass,title_mb,            XtNforeground,textcolor, XtNbackground,textbgcolor,            XtNbackingStore,NotUseful, XtNsaveUnder,False, NULL);  time_l=XtVaCreateManagedWidget("time_label",commandWidgetClass,m_box,            XtNfont,labelfont,            XtNbackground,menubcolor,NULL);  b_box=XtVaCreateManagedWidget("button_box",boxWidgetClass,base_f,            XtNorientation,XtorientHorizontal,            XtNwidth,rotatewidth[currwidth]-10,            XtNbackground,bgcolor,XtNfromVert,m_box, NULL);  v_box=XtVaCreateManagedWidget("volume_box",boxWidgetClass,base_f,            XtNorientation,XtorientHorizontal,            XtNwidth,TRACE_WIDTH_SHORT, XtNheight,36,            XtNfromVert,b_box,XtNbackground,bgcolor, NULL);  t_box=XtVaCreateManagedWidget("tune_box",boxWidgetClass,base_f,            XtNorientation,XtorientHorizontal,            XtNwidth,TRACE_WIDTH_SHORT, XtNheight,36,            XtNfromVert,v_box,XtNbackground,bgcolor, NULL);  i = XTextWidth(volumefont,"Volume ",7)+8;  vol_l0=XtVaCreateManagedWidget("volume_label0",labelWidgetClass,v_box,            XtNwidth,i, XtNresize,False,            XtNfont,volumefont, XtNlabel, "Volume", XtNborderWidth,0,            XtNforeground,textcolor, XtNbackground,bgcolor, NULL);  VOLUME_LABEL_WIDTH = i+30;  j =   XTextWidth(volumefont,"000",3)+8;  VOLUME_LABEL_WIDTH += j;  vol_l=XtVaCreateManagedWidget("volume_label",labelWidgetClass,v_box,            XtNwidth,j, XtNresize,False,XtNborderWidth,0,            XtNfont,volumefont, XtNorientation, XtorientHorizontal,            XtNforeground,textcolor, XtNbackground,bgcolor, NULL);  vol_bar=XtVaCreateManagedWidget("volume_bar",scrollbarWidgetClass,v_box,            XtNorientation, XtorientHorizontal,            XtNwidth, TRACE_WIDTH_SHORT -VOLUME_LABEL_WIDTH,            XtNbackground,textbgcolor,            XtNfromVert,vol_l, XtNtopOfThumb,&l_thumb, NULL);  i = XTextWidth(volumefont," 00:00",6);  tune_l0=XtVaCreateManagedWidget("tune_label0",labelWidgetClass,t_box,            XtNwidth,i, XtNresize,False, XtNlabel, " 0:00",            XtNfont,volumefont, XtNfromVert,vol_l0,XtNborderWidth,0,            XtNforeground,textcolor, XtNbackground,bgcolor, NULL);  j = XTextWidth(volumefont,"/ 00:00",7);  tune_l=XtVaCreateManagedWidget("tune_label",labelWidgetClass,t_box,            XtNwidth,j, XtNresize,False,            XtNfont,volumefont, XtNfromVert,vol_l,XtNborderWidth,0,            XtNforeground,textcolor, XtNbackground,bgcolor, NULL);  tune_bar=XtVaCreateManagedWidget("tune_bar",scrollbarWidgetClass,t_box,            XtNwidth, TRACE_WIDTH_SHORT -i -j -30,            XtNbackground,textbgcolor,XtNorientation, XtorientHorizontal,            XtNfromVert,tune_l, XtNtopOfThumb,&l_thumbj, NULL);  l_thumb = thumb = (float)amplitude / (float)MAXVOLUME;  if (sizeof(thumb) > sizeof(XtArgVal)) {    XtVaSetValues(vol_bar,XtNtopOfThumb,&thumb,NULL);  } else {    XtArgVal * l_thumb = (XtArgVal *) &thumb;    XtVaSetValues(vol_bar,XtNtopOfThumb,*l_thumb,NULL);  }  play_b=XtVaCreateManagedWidget("play_button",toggleWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_PLAY],            XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,            NULL);  pause_b=XtVaCreateManagedWidget("pause_button",toggleWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_PAUSE],            XtNfromHoriz, play_b,            XtNforeground,togglecolor, XtNbackground,buttonbgcolor,            NULL);  stop_b=XtVaCreateManagedWidget("stop_button",commandWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_STOP],            XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,            XtNfromHoriz,pause_b,NULL);  prev_b=XtVaCreateManagedWidget("prev_button",commandWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_PREV],            XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,            XtNfromHoriz,stop_b,NULL);  back_b=XtVaCreateManagedWidget("back_button",commandWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_BACK],            XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,            XtNfromHoriz,prev_b,NULL);  fwd_b=XtVaCreateManagedWidget("fwd_button",commandWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_FWRD],            XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,            XtNfromHoriz,back_b,NULL);  next_b=XtVaCreateManagedWidget("next_button",commandWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_NEXT],            XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,            XtNfromHoriz,fwd_b,NULL);  quit_b=XtVaCreateManagedWidget("quit_button",commandWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_QUIT],            XtNforeground,buttoncolor, XtNbackground,buttonbgcolor,            XtNfromHoriz,next_b,NULL);  random_b=XtVaCreateManagedWidget("random_button",toggleWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_RANDOM],            XtNfromHoriz,quit_b,            XtNforeground,togglecolor, XtNbackground,buttonbgcolor,            NULL);  repeat_b=XtVaCreateManagedWidget("repeat_button",toggleWidgetClass,b_box,            XtNbitmap,bm_Pixmap[BM_REPEAT],            XtNfromHoriz,random_b,            XtNforeground,togglecolor, XtNbackground,buttonbgcolor,            NULL);  popup_load=XtVaCreatePopupShell("popup_load",transientShellWidgetClass,toplevel,            NULL);    popup_load_f= XtVaCreateManagedWidget("popup_loadform",formWidgetClass,popup_load,            XtNbackground,bgcolor, NULL);  load_d=XtVaCreateManagedWidget("load_dialog",dialogWidgetClass,popup_load_f,            XtNbackground,bgcolor, XtNresizable,True, NULL);  cwd_l = XtVaCreateManagedWidget("cwd_label",labelWidgetClass,popup_load_f,            XtNlabel,basepath, XtNborderWidth,0, XtNfromVert,load_d,            XtNwidth,250, XtNheight,20,            XtNbackground,text2bgcolor, XtNresizable,False, NULL);  load_vport = XtVaCreateManagedWidget("vport",viewportWidgetClass, popup_load_f,            XtNfromVert,cwd_l, XtNallowHoriz,True, XtNallowVert,True,            XtNbackground,textbgcolor, XtNuseBottom,True,             XtNwidth,250, XtNheight,200, NULL);  load_flist = XtVaCreateManagedWidget("files",listWidgetClass,load_vport,            XtNverticalList,True, XtNforceColumns,False,            XtNbackground,tracecolor, XtNdefaultColumns,3, NULL);  load_info = XtVaCreateManagedWidget("cwd_info",labelWidgetClass,popup_load_f,            XtNborderWidth,0, XtNwidth,250, XtNheight,20, XtNresizable,False,            XtNbackground,text2bgcolor, XtNfromVert,load_vport, NULL);  XawDialogAddButton(load_d, "OK", popdownLoad,"Y");  XawDialogAddButton(load_d, "add", popdownLoad,"A");  XawDialogAddButton(load_d, "cancel", popdownLoad,NULL);#ifndef WIDGET_IS_LABEL_WIDGET  lyric_t=XtVaCreateManagedWidget("lyric_text",asciiTextWidgetClass,base_f,            XtNwrap,XawtextWrapWord, XtNeditType,XawtextAppend,            XtNwidth, rotatewidth[currwidth]-10,#else  lyric_t=XtVaCreateManagedWidget("lyric_text",labelWidgetClass,base_f,            XtNresize,False,            XtNforeground,textcolor, XtNbackground,menubcolor,            XtNwidth,rotatewidth[currwidth]-10,#endif            XtNfontDEF,textfont, XtNheight,text_height,            XtNfromVert,t_box, NULL);  if(ctl->trace_playing) {    trace_vport = XtVaCreateManagedWidget("trace_vport",viewportWidgetClass, base_f,            XtNallowHoriz,True, XtNallowVert,True,            XtNuseBottom,True, XtNfromVert,lyric_t, XtNbackground,tracecolor,#ifdef WIDGET_IS_LABEL_WIDGET            XtNuseRight,True,#endif            XtNwidth,trace_width, XtNheight,trace_height+12, NULL);    trace = XtVaCreateManagedWidget("trace",widgetClass,trace_vport,            XtNwidth,trace_width, XtNbackground,tracecolor,            XtNheight,BAR_SPACE*MAX_XAW_MIDI_CHANNELS+TRACEV_OFS, NULL);  }  XtAddCallback(quit_b,XtNcallback,quitCB,NULL);  XtAddCallback(play_b,XtNcallback,playCB,NULL);  XtAddCallback(pause_b,XtNcallback,pauseCB,NULL);  XtAddCallback(stop_b,XtNcallback,stopCB,NULL);  XtAddCallback(prev_b,XtNcallback,prevCB,NULL);  XtAddCallback(next_b,XtNcallback,nextCB,NULL);  XtAddCallback(fwd_b,XtNcallback,forwardCB,NULL);  XtAddCallback(back_b,XtNcallback,backCB,NULL);  XtAddCallback(random_b,XtNcallback,randomCB,NULL);  XtAddCallback(repeat_b,XtNcallback,repeatCB,NULL);  XtAddCallback(vol_bar,XtNjumpProc,volsetCB,NULL);  XtAddCallback(vol_bar,XtNscrollProc,volupdownCB,NULL);  XtAppAddInput(app_con,pipe_in,(XtPointer)XtInputReadMask,handle_input,NULL);  XtAddCallback(load_flist,XtNcallback,(XtCallbackProc)setDirList,cwd_l);  XtAddCallback(time_l,XtNcallback,(XtCallbackProc)filemenuAction,NULL);  XtRealizeWidget(toplevel);  dirlist = NULL;  lrs.string = "";  setDirList(load_flist, cwd_l, &lrs);  XtSetKeyboardFocus(base_f, base_f);  XtSetKeyboardFocus(lyric_t, base_f);  if(ctl->trace_playing)     XtSetKeyboardFocus(trace, base_f);  XtSetKeyboardFocus(popup_load_f, load_d);  load_t = XtNameToWidget(load_d,"value");  XtOverrideTranslations(toplevel,            XtParseTranslationTable("<Message>WM_PROTOCOLS: do-quit()"));  snprintf(cbuf,sizeof(cbuf),"%s/%s",bitmapdir,iconname);  XReadBitmapFile(disp,RootWindow(disp,screen),cbuf,                  &bmwidth,&bmheight,&bmPixmap,&x_hot,&y_hot);  XtVaSetValues(toplevel,XtNiconPixmap,bmPixmap,NULL);  strcpy(window_title,APP_CLASS);  w_title = strncat(window_title," : ",3);  w_title += sizeof(APP_CLASS)+ 2;  XtVaGetValues(toplevel,XtNheight,&base_height,NULL);  XtVaGetValues(lyric_t,XtNheight,&lyric_height,NULL);  a_print_text(lyric_t,strcpy(local_buf,"<< TiMidity Messages >>"));  a_pipe_write("READY");  if(ctl->trace_playing) {    XGCValues gv;    gv.fill_style = FillTiled;    gv.fill_rule = WindingRule;    Panel = (PanelInfo *)safe_malloc(sizeof(PanelInfo));    gc_xcopy = XCreateGC(disp,RootWindow(disp, screen),GCFillStyle|GCFillRule,&gv);    gct = XCreateGC(disp, RootWindow(disp, screen), 0, NULL);    gc = XCreateGC(disp, RootWindow(disp, screen), 0, NULL);    for(i=0; i<MAX_XAW_MIDI_CHANNELS; i++) {      if(ISDRUMCHANNEL(i)) {        Panel->is_drum[i]=1;        barcol[i]=app_resources.drumvelocity_color;      }      else {        barcol[i]=app_resources.velocity_color;      }      inst_name[i] = (char *)safe_malloc(sizeof(char) * INST_NAME_SIZE);    }    rimcolor = app_resources.rim_color;    boxcolor = app_resources.box_color;    capcolor = app_resources.caption_color;    black = app_resources.black_key_color;    white = app_resources.white_key_color;    suscolor = app_resources.sus_color;    playcolor = app_resources.play_color;    revcolor = app_resources.rev_color;    chocolor = app_resources.cho_color;    XSetFont(disp, gct, tracefont->fid);    keyG = (ThreeL *)safe_malloc(sizeof(ThreeL) * KEY_NUM);    for(i=0, j= BARH_OFS8+1; i<KEY_NUM; i++) {      tmpi = i%12;      switch(tmpi) {      case 0:      case 5:      case 10:        keyG[i].k[0].y = 11; keyG[i].k[0].l = 7;        keyG[i].k[1].y = 2; keyG[i].k[1].l = 16;        keyG[i].k[2].y = 11; keyG[i].k[2].l = 7;        keyG[i].col = white;        break;      case 2:      case 7:        keyG[i].k[0].y = 11; keyG[i].k[0].l = 7;        keyG[i].k[1].y = 2; keyG[i].k[1].l = 16;        keyG[i].k[2].y = 2; keyG[i].k[2].l = 16;                keyG[i].col = white; break;      case 3:      case 8:        j += 2;        keyG[i].k[0].y = 2; keyG[i].k[0].l = 16;        keyG[i].k[1].y = 2; keyG[i].k[1].l = 16;        keyG[i].k[2].y = 11; keyG[i].k[2].l = 7;        keyG[i].col = white; break;      default:  /* black key */        keyG[i].k[0].y = 2; keyG[i].k[0].l = 8;        keyG[i].k[1].y = 2; keyG[i].k[1].l = 8;        keyG[i].k[2].y = 2; keyG[i].k[2].l = 8;        keyG[i].col = black; break;      }      keyG[i].xofs = j; j += 2;    }    /* draw on template pixmaps that includes one channel row */    for(i=0; i<2; i++) {      layer[i] = XCreatePixmap(disp,XtWindow(trace),TRACE_WIDTH,BAR_SPACE,                               DefaultDepth(disp,screen));      drawKeyboardAll(disp, layer[i]);      XSetForeground(disp, gc, capcolor);      XDrawLine(disp,layer[i],gc,0,0,TRACE_WIDTH,0);      XDrawLine(disp,layer[i],gc,0,0,0,BAR_SPACE);      XDrawLine(disp,layer[i],gc,TRACE_WIDTH-1,0,TRACE_WIDTH-1,BAR_SPACE);      for(j=0; j<pl[i].col -1; j++) {        int w;        tmpi= TRACEH_OFS; w= pl[i].w[j];        for(k= 0; k<j; k++) tmpi += pl[i].w[k];        tmpi = pl[i].ofs[j];        XSetForeground(disp,gc, capcolor);        XDrawLine(disp,layer[i],gc, tmpi+w,0,tmpi+w,BAR_SPACE);        XSetForeground(disp,gc, rimcolor);        XDrawLine(disp,layer[i],gc,tmpi+w-2,2,tmpi+w-2,BAR_HEIGHT+1);        XDrawLine(disp,layer[i],gc,tmpi+2,BAR_HEIGHT+2,tmpi+w-2,BAR_HEIGHT+2);        XSetForeground(disp,gc, ((j)? boxcolor:textbgcolor));        XFillRectangle(disp,layer[i],gc,tmpi+2,2,w-4,BAR_HEIGHT);      }    }    initStatus();    XFreeGC(disp,gc);    voices_num_width = XTextWidth(tracefont,"Voices",6) +VOICES_NUM_OFS;  }  while (1) {    a_pipe_read(local_buf,sizeof(local_buf));    if (local_buf[0] < 'A') break;    a_print_text(lyric_t,local_buf+2);  }  bsb=XtVaCreateManagedWidget("dummyfile",smeLineObjectClass,title_sm,XtNforeground,textbgcolor,NULL);  init_options=atoi(local_buf);  a_pipe_read(local_buf,sizeof(local_buf));  init_chorus=atoi(local_buf);  a_pipe_read(local_buf,sizeof(local_buf));  max_files=atoi(local_buf);  flist=(String *)safe_malloc((INIT_FLISTNUM+1)*sizeof(char *));  for (i=0;i<max_files;i++) {    a_pipe_read(local_buf,sizeof(local_buf));    addOneFile(max_files,i,local_buf,True);  }  for(i=0;i<dot_nfile;i++) {    snprintf(local_buf,sizeof(local_buf),"X %s\n",dotfile_flist[i]);    free(dotfile_flist[i]);    a_pipe_write(local_buf);  }  free(dotfile_flist);  for (i = 0; i < XtNumber(file_menu); i++) {    bsb=XtVaCreateManagedWidget(file_menu[i].name,            (file_menu[i].trap ? smeBSBObjectClass:smeLineObjectClass),            file_sm,XtNleftBitmap,None,XtNleftMargin,24,NULL);    XtAddCallback(bsb,XtNcallback,filemenuCB,(XtPointer)&file_menu[i].id);    file_menu[i].widget = bsb;  }  if(!ctl->trace_playing || !Cfg.disptrace) {    Dimension w2,h2,h;    XtVaSetValues(lyric_t,XtNwidth,rotatewidth[0] -12,NULL);    XtVaGetValues(toplevel,XtNheight,&h,NULL);    XtMakeResizeRequest(toplevel,rotatewidth[0],h,&w2,&h2);  }  if (!ctl->trace_playing)      XtVaSetValues(file_menu[ID_HIDETRACE-100].widget,XtNsensitive,False,NULL);  /* Please sleep here to make widgets arrange by Form Widget,   * otherwise the widget geometry is broken.   * Strange!!   */  if(Cfg.hidetext || !Cfg.disptrace) {    XSync(disp, False);    usleep(10000);  }  sprintf(cbuf,"%d",amplitude);  XtVaSetValues(vol_l,XtNlabel,cbuf,NULL);  sprintf(local_buf,"V %d\n",amplitude);  a_pipe_write(local_buf);  if (init_options == DEFAULT_OPTIONS) init_options=Cfg.extendopt;  if (init_chorus == DEFAULT_CHORUS) init_chorus=Cfg.chorusopt;  sprintf(local_buf,"E %03d",init_options);  a_pipe_write(local_buf);  sprintf(local_buf,"C %03d",init_chorus);  a_pipe_write(local_buf);  if(Cfg.autostart)    filemenuCB(file_menu[ID_AUTOSTART-100].widget,               &file_menu[ID_AUTOSTART-100].id,NULL);  if(Cfg.autoexit) {    filemenuCB(file_menu[ID_AUTOQUIT-100].widget,               &file_menu[ID_AUTOQUIT-100].id,NULL);  }  if(Cfg.hidetext)    filemenuCB(file_menu[ID_HIDETXT-100].widget,        &file_menu[ID_HIDETXT-100].id,NULL);  if(!Cfg.disptrace)    filemenuCB(file_menu[ID_HIDETRACE-100].widget,               &file_menu[ID_HIDETRACE-100].id,NULL);  if(Cfg.repeat) repeatCB(NULL,&Cfg.repeat,NULL);  if(Cfg.shuffle) randomCB(NULL,&Cfg.shuffle,NULL);  if(Cfg.autostart) {    if(max_files==0)      prevCB(NULL,NULL,NULL);    else      playCB(NULL,NULL,NULL);  } else    stopCB(NULL,NULL,NULL);  if(ctl->trace_playing) initStatus();  XtAppMainLoop(app_con);}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/d250d6d1953e203dea0d755cc8258e080c0ffa3f/xaw_i.c/clean/interface/xaw_i.c