⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xaw_i.c

📁 MIDI解码程序(用VC编写)
💻 C
📖 第 1 页 / 共 5 页
字号:
  {"background", XtCBackground, XtRPixel, sizeof(Pixel),   offset(common_bgcolor), XtRString, COMMON_BGCOLOR},  {"menubutton", "MenuButtonBackground", XtRPixel, sizeof(Pixel),   offset(menub_bgcolor), XtRString, "#CCFF33"},  {"textbackground", "TextBackground", XtRPixel, sizeof(Pixel),   offset(text_bgcolor), XtRString, TEXTBG_COLOR},  {"text2background", "Text2Background", XtRPixel, sizeof(Pixel),   offset(text2_bgcolor), XtRString, "gray80"},  {"toggleforeground", "ToggleForeground", XtRPixel, sizeof(Pixel),   offset(toggle_fgcolor), XtRString, "MediumBlue"},  {"buttonforeground", "ButtonForeground", XtRPixel, sizeof(Pixel),   offset(button_fgcolor), XtRString, "blue"},  {"buttonbackground", "ButtonBackground", XtRPixel, sizeof(Pixel),   offset(button_bgcolor), XtRString, COMMANDBUTTON_COLOR},  {"velforeground", "VelForeground", XtRPixel, sizeof(Pixel),   offset(velocity_color), XtRString, "orange"},  {"veldrumforeground", "VelDrumForeground", XtRPixel, sizeof(Pixel),   offset(drumvelocity_color), XtRString, "red"},  {"volforeground", "VolForeground", XtRPixel, sizeof(Pixel),   offset(volume_color), XtRString, "LightPink"},  {"expforeground", "ExpForeground", XtRPixel, sizeof(Pixel),   offset(expr_color), XtRString, "aquamarine"},  {"panforeground", "PanForeground", XtRPixel, sizeof(Pixel),   offset(pan_color), XtRString, "blue"},  {"tracebackground", "TraceBackground", XtRPixel, sizeof(Pixel),   offset(trace_bgcolor), XtRString, "gray90"},  {"rimcolor", "RimColor", XtRPixel, sizeof(Pixel),   offset(rim_color), XtRString, "gray20"},  {"boxcolor", "BoxColor", XtRPixel, sizeof(Pixel),   offset(box_color), XtRString, "gray76"},  {"captioncolor", "CaptionColor", XtRPixel, sizeof(Pixel),   offset(caption_color), XtRString, "DarkSlateGrey"},  {"sustainedkeycolor", "SustainedKeyColor", XtRPixel, sizeof(Pixel),   offset(sus_color), XtRString, "red4"},  {"whitekeycolor", "WhiteKeyColor", XtRPixel, sizeof(Pixel),   offset(white_key_color), XtRString, "white"},  {"blackkeycolor", "BlackKeyColor", XtRPixel, sizeof(Pixel),   offset(black_key_color), XtRString, "black"},  {"playingkeycolor", "PlayingKeyColor", XtRPixel, sizeof(Pixel),   offset(play_color), XtRString, "maroon1"},  {"reverbcolor", "ReverbColor", XtRPixel, sizeof(Pixel),   offset(rev_color), XtRString, "PaleGoldenrod"},  {"choruscolor", "ChorusColor", XtRPixel, sizeof(Pixel),   offset(cho_color), XtRString, "yellow"},  {"labelfont", "LabelFont", XtRFontStruct, sizeof(XFontStruct *),   offset(label_font), XtRString, "-adobe-helvetica-bold-r-*-*-14-*-75-75-*-*-*-*"},  {"volumefont", "VolumeFont", XtRFontStruct, sizeof(XFontStruct *),   offset(volume_font), XtRString, "-adobe-helvetica-bold-r-*-*-12-*-75-75-*-*-*-*"},#ifdef I18N  {"textfontset", "TextFontSet", XtRFontSet, sizeof(XFontSet),   offset(text_font), XtRString, "-*-*-medium-r-normal--14-*-*-*-*-*-*-*"},  {"ttitlefont", "TtitleFont", XtRFontSet, sizeof(XFontSet),   offset(ttitle_font), XtRString, "-*-fixed-medium-r-normal--14-*-*-*-*-*-*-*"},#else  {"textfont", XtCFont, XtRFontStruct, sizeof(XFontStruct *),   offset(text_font), XtRString, "-*-fixed-medium-r-normal--14-*-*-*-*-*-*-*"},  {"ttitlefont", "Ttitlefont", XtRFontStruct, sizeof(XFontStruct *),   offset(ttitle_font), XtRString, "-adobe-helvetica-bold-o-*-*-14-*-75-75-*-*-*-*"},#endif  {"tracefont", "TraceFont", XtRFontStruct, sizeof(XFontStruct *),   offset(trace_font), XtRString, "7x14"},  {"labelfile", "LabelFile", XtRString, sizeof(String),   offset(file_text), XtRString, "file..."},#undef offset};enum {    ID_LOAD = 100,    ID_SAVECONFIG,    ID_HIDETXT,    ID_HIDETRACE,    ID_SHUFFLE,    ID_REPEAT,    ID_AUTOSTART,    ID_AUTOQUIT,    ID_LINE,    ID_FILELIST,    ID_OPTIONS,    ID_LINE2,    ID_ABOUT,    ID_QUIT,};#define IDS_SAVECONFIG  "101"#define IDS_HIDETXT     "102"#define IDS_HIDETRACE   "103"#define IDS_SHUFFLE     "104"#define IDS_REPEAT      "105"#define IDS_AUTOSTART   "106"#define IDS_AUTOQUIT    "107"#define IDS_FILELIST    "109"#define IDS_OPTIONS     "110"#define IDS_ABOUT       "112"static ButtonRec file_menu[] = {  {ID_LOAD, "load", True, False},  {ID_SAVECONFIG, "saveconfig", True, False},  {ID_HIDETXT, "hidetext", True, False},  {ID_HIDETRACE, "hidetrace", True, False},  {ID_SHUFFLE, "shuffle", True, False},  {ID_REPEAT, "repeat", True, False},  {ID_AUTOSTART, "autostart", True, False},  {ID_AUTOQUIT, "autoquit", True, False},  {ID_LINE, "line", False, False},  {ID_FILELIST, "filelist", True, False},  {ID_OPTIONS, "modes", True, False},  {ID_LINE2, "line2", False, False},  {ID_ABOUT, "about", True, False},  {ID_QUIT, "quit", True, False},};static OptionRec option_num[] = {  {MODUL_N, MODUL_BIT},  {PORTA_N, PORTA_BIT},  {NRPNV_N, NRPNV_BIT},  {REVERB_N, REVERB_BIT},  {CHPRESSURE_N, CHPRESSURE_BIT},  {OVERLAPV_N, OVERLAPV_BIT},  {TXTMETA_N, TXTMETA_BIT},};static void offPauseButton(void) {  Boolean s;  XtVaGetValues(pause_b,XtNstate,&s,NULL);  if (s == True) {    s=False;    XtVaSetValues(pause_b,XtNstate,&s,NULL);    a_pipe_write("U");  }}static void offPlayButton(void) {  Boolean s;  XtVaGetValues(play_b,XtNstate,&s,NULL);  if (s == True) {    s=False;    XtVaSetValues(play_b,XtNstate,&s,NULL);    a_pipe_write("T 0\n");  }}static Boolean IsTracePlaying(void) {  Boolean s;  if (!ctl->trace_playing) return False;  XtVaGetValues(play_b,XtNstate,&s,NULL);  return(s);}static Boolean IsEffectiveFile(char *file) {  char *p2;  struct stat st;  if((p2 = strrchr(file,'#')) != NULL)    *p2 = '\0';  if(stat(file, &st) != -1)    if (st.st_mode & S_IFMT & (S_IFDIR|S_IFREG|S_IFLNK)) {      if(p2) *p2 = '#';      return(True);    }  return(False);}static Boolean onPlayOffPause(void) {  Boolean s;  Boolean play_on;  play_on = False;  XtVaGetValues(play_b,XtNstate,&s,NULL);  if (s == False) {    s=True;    XtVaSetValues(play_b,XtNstate,&s,NULL);    play_on = True;  }  offPauseButton();  return(play_on);}/*ARGSUSED*/static void chorusCB(Widget w,XtPointer id_data, XtPointer data) {  Boolean s;  char str[16];  stopCB(NULL,NULL,NULL);  XtVaGetValues(w,XtNstate,&s,NULL);  XtVaSetValues(w,XtNbitmap,(s)? on_mark:off_mark,NULL);  if(!s)    sprintf(str, "C 0");  else    sprintf(str, "C %03d", (init_chorus)? init_chorus:1);  a_pipe_write(str);}/*ARGSUSED*/static void optionsCB(Widget w,XtPointer id_data, XtPointer data) {  Boolean s;  int i,flags;  char str[16];  stopCB(NULL,NULL,NULL);  XtVaGetValues(w,XtNstate,&s,NULL);  XtVaSetValues(w,XtNbitmap,(s)? on_mark:off_mark,NULL);  flags = 0;  for(i=0; i<MAX_OPTION_N; i++) {    XtVaGetValues(option_num[i].widget,XtNstate,&s,NULL);    flags |= ((s)? option_num[i].bit:0);  }  sprintf(str, "E %03d", flags);  init_options = flags;  a_pipe_write(str);}/*ARGSUSED*/static void optionspopupCB(Widget w,XtPointer data,XtPointer dummy) {  Dimension x,y;  createOptions();  XtVaGetValues(toplevel,XtNx,&x,XtNy,&y,NULL);  XtVaSetValues(popup_opt,XtNx,x+TRACE_WIDTH_SHORT,XtNy,y,NULL);  XtPopup(popup_opt,(XtGrabKind)XtGrabNone);}static void flistpopupCB(Widget w,XtPointer data,XtPointer dummy) {  Dimension x,y,w1,h1;  createFlist();  XtVaGetValues(toplevel,XtNx,&x,XtNy,&y,NULL);  XtVaSetValues(popup_file,XtNx,x+TRACE_WIDTH_SHORT,XtNy,y,NULL);  XtPopup(popup_file,(XtGrabKind)XtGrabNone);  XtVaGetValues(file_vport,XtNwidth,&w1,XtNheight,&h1,NULL);  XtVaSetValues(file_vport,XtNheight,((h1>FILEVPORT_HEIGHT)? h1:FILEVPORT_HEIGHT),NULL);}static void aboutCB(Widget w,XtPointer data,XtPointer dummy) {  char s[12],*p;  int i;  static char *info[]= {"TiMidity++ %s%s - Xaw interface",                      "- MIDI to WAVE converter and player -",                      "by Masanao Izumo and Tomokazu Harada",                      "modified by Yoshishige Arai"," ",NULL};  if(!(popup_shell_exist & ABOUT_WINDOW)) {    popup_about= XtVaCreatePopupShell("popup_about",transientShellWidgetClass,                                  toplevel,NULL);    popup_abox= XtVaCreateManagedWidget("popup_abox",boxWidgetClass,popup_about,                                  XtNwidth,320,XtNheight,120,                                  XtNorientation,XtorientVertical,                                  XtNbackground,bgcolor,NULL);    for(i=0,p=info[0]; p!=NULL; p=info[++i]) {      snprintf(s,sizeof(s),"about_lbl%d",i);      snprintf(local_buf, sizeof(local_buf), p,      		(strcmp(timidity_version, "current")) ? "version " : "",      		timidity_version);      about_lbl[i]= XtVaCreateManagedWidget(s,labelWidgetClass,popup_abox,                                  XtNlabel,local_buf,XtNfont,((i)? labelfont:labelfont),                                  XtNforeground,textcolor, XtNbackground,bgcolor,                                  XtNwidth,320,XtNresize,False,                                  XtNborderWidth,0,NULL);    }    popup_aok= XtVaCreateManagedWidget("OK",                    commandWidgetClass,popup_abox,                    XtNwidth,320,XtNresize,False,NULL);    XtAddCallback(popup_aok,XtNcallback,aboutcloseCB,NULL);    XtSetKeyboardFocus(popup_about, popup_abox);    popup_shell_exist |= ABOUT_WINDOW;  }  XtVaSetValues(popup_about,XtNx,root_width/2 -160,XtNy,root_height/2 -60,NULL);  XtPopup(popup_about,(XtGrabKind)XtGrabNonexclusive);}static void aboutcloseCB(Widget w,XtPointer data,XtPointer dummy) {  XtPopdown(popup_about);}static void flistcloseCB(Widget w,XtPointer data,XtPointer dummy) {  XtPopdown(popup_file);}/*ARGSUSED*/static void optionscloseCB(Widget w,XtPointer data,XtPointer dummy) {  XtPopdown(popup_opt);}/*ARGSUSED*/static void optionsdestroyCB(Widget w,XtPointer data,XtPointer dummy) {  popup_shell_exist &= (! OPTIONS_WINDOW);}/*ARGSUSED*/static void quitCB(Widget w,XtPointer data,XtPointer dummy) {  a_pipe_write("Q");}/*ARGSUSED*/static void sndspecCB(Widget w,XtPointer data,XtPointer dummy) {#ifdef SUPPORT_SOUNDSPEC  a_pipe_write("g");#endif}/*ARGSUSED*/static void playCB(Widget w,XtPointer data,XtPointer dummy) {  if(!max_files) return;  onPlayOffPause();  XtVaGetValues(title_mb,XtNlabel,&local_buf+2,NULL);  a_pipe_write("P");}/*ARGSUSED*/static void pauseAction(Widget w,XEvent *e,String *v,Cardinal *n) {  Boolean s;  XtVaGetValues(play_b,XtNstate,&s,NULL);  if (e->type == KeyPress && s == True) {    XtVaGetValues(pause_b,XtNstate,&s,NULL);    s ^= True;    XtVaSetValues(pause_b,XtNstate,&s,NULL);    a_pipe_write("U");  }}static void soundkeyAction(Widget w,XEvent *e,String *v,Cardinal *n) {  a_pipe_write(*(int *)n == 0 ? "+\n":"-\n");}static void speedAction(Widget w,XEvent *e,String *v,Cardinal *n) {  a_pipe_write(*(int *)n == 0 ? ">\n":"<\n");}static void voiceAction(Widget w,XEvent *e,String *v,Cardinal *n) {  a_pipe_write(*(int *)n == 0 ? "O\n":"o\n");}static void randomAction(Widget w,XEvent *e,String *v,Cardinal *n) {  Boolean s;  XtVaGetValues(random_b,XtNstate,&s,NULL);  s ^= True;  if(!s) XtVaSetValues(random_b,XtNstate,s,NULL);    randomCB(NULL,&s,NULL);}static void repeatAction(Widget w,XEvent *e,String *v,Cardinal *n) {  Boolean s;  XtVaGetValues(repeat_b,XtNstate,&s,NULL);  s ^= True;  if(!s) XtVaSetValues(repeat_b,XtNstate,s,NULL);  repeatCB(NULL,&s,NULL);}/*ARGSUSED*/static void pauseCB() {  Boolean s;  XtVaGetValues(play_b,XtNstate,&s,NULL);  if (s == True) {    a_pipe_write("U");  } else {    s = True;    XtVaSetValues(pause_b,XtNstate,&s,NULL);  }}/*ARGSUSED*/static void stopCB(Widget w,XtPointer data,XtPointer dummy) {  offPlayButton();  offPauseButton();  a_pipe_write("S");  initStatus();  window_title[0]='\0';  redrawTrace(False);}/*ARGSUSED*/static void nextCB(Widget w,XtPointer data,XtPointer dummy) {  onPlayOffPause();  a_pipe_write("N");  initStatus();  redrawTrace(True);}/*ARGSUSED*/static void prevCB(Widget w,XtPointer data,XtPointer dummy) {  onPlayOffPause();  a_pipe_write("B");  initStatus();  redrawTrace(True);}/*ARGSUSED*/static void forwardCB(Widget w,XtPointer data,XtPointer dummy) {  if (onPlayOffPause()) a_pipe_write("P");  a_pipe_write("f");  initStatus();}/*ARGSUSED*/static void backCB(Widget w,XtPointer data,XtPointer dummy) {  if (onPlayOffPause()) a_pipe_write("P");  a_pipe_write("b");  initStatus();}/*ARGSUSED*/static void repeatCB(Widget w,XtPointer data,XtPointer dummy) {  Boolean s;  Boolean *set= (Boolean *)data;  if (set != NULL && *set) {    s = *set;    XtVaSetValues(repeat_b,XtNstate,set,NULL);  } else {    XtVaGetValues(repeat_b,XtNstate,&s,NULL);  }  if (s == True) {    a_pipe_write("R 1");  } else a_pipe_write("R 0");  toggleMark(file_menu[ID_REPEAT-100].widget, file_menu[ID_REPEAT-100].id);}/*ARGSUSED*/static void randomCB(Widget w,XtPointer data,XtPointer dummy) {  Boolean s;  Boolean *set= (Boolean *)data;  onPlayOffPause();  if (set != NULL && *set) {    s = *set;    XtVaSetValues(random_b,XtNstate,set,NULL);  } else {    XtVaGetValues(random_b,XtNstate,&s,NULL);  }  if (s == True) {    onPlayOffPause();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -