/* This routine draws the menuline at the top of the screen. Returns 1 if successful, 0 otherwise. mfile is a file with the list of menupoints, action is a functionarray with max_anr+1 entries. The format of the file is the following: :MENU <number of entries in menuline> <no> {<Name>} where no: if >0 then number of actionfunction if <0 then number of submenupoints is read with %i, therefore normal C-integer-constant. name: name of menupoint. > marks the Hotkey of this menupoint */ int w_initmenu(FILE *mfile, void(**action) (int), int max_anr) { struct node *n; int no; my_assert(mfile != NULL); no = w_findmarker(mfile, "MENU"); if (no < 0) { return 0; } if ( !wi_readmenu(mfile, no, action, max_anr, shapes.width_menuframe * 2, shapes.width_menuframe, 1, ¬es.menu, 0) ) { return 0; } for (n = notes.menu.head; n->next != NULL; n = n->next) { wi_adjustmenus(&n->d.w_m->submenus, n->d.w_m->x1); } drawmenubar(); notes.winspace.yp += shapes.titlebar_height + shapes.width_menuframe * 2; notes.winspace.ys -= shapes.titlebar_height + shapes.width_menuframe * 2; return 1; }
static boolean menuremoveverb (hdltreenode hparam1, tyvaluerecord *v) { hdlmenurecord hmenurecord; hdlmenu hmainmenu; short idmainmenu; if (getmainmenuvalue (hparam1, &hmainmenu, &idmainmenu)) { removemenu (idmainmenu); drawmenubar (); (*v).data.flvalue = true; return (true); } flnextparamislast = true; if (!getmenuparaminmemory (hparam1, &hmenurecord)) return (false); (*v).data.flvalue = meremovemenubar (hmenurecord); return (true); } /*menuremoveverb*/
void set_titlebar_text(char const *txt) { if (notes.titlebar_text) { FREE(notes.titlebar_text); } checkmem( notes.titlebar_text = MALLOC(strlen(txt) + 1) ); strcpy(notes.titlebar_text, txt); drawmenubar(); }
void w_newpalette(unsigned char *palette) { int i; struct node *n, *nb; if (!notes.initialized) { return; } for (i = 0; i < 256; i++) { ws_setcolor(i, palette[i * 3], palette[i * 3 + 1], palette[i * 3 + 2]); } ws_resetmousecolors(); notes.colindex[cv_bg] = w_makecolor(0, 0, 0); notes.colindex[cv_winfill] = w_makecolor(0, 0, 0); notes.colindex[cv_textbg] = w_makecolor(0, 0, 0); notes.colindex[cv_winedge] = w_makecolor(150, 150, 150); notes.colindex[cv_buttonin] = w_makecolor(150, 150, 150); notes.colindex[cv_windrag] = w_makecolor(255, 255, 255); notes.colindex[cv_buttonlt] = w_makecolor(200, 200, 200); notes.colindex[cv_buttonrb] = w_makecolor(100, 100, 100); notes.colindex[cv_buttonpressed] = w_makecolor(120, 120, 120); notes.colindex[cv_switchon] = w_makecolor(130, 130, 130); notes.colindex[cv_textfg] = w_makecolor(255, 255, 255); notes.colindex[cv_buttonmarker] = w_makecolor(255, 0, 0); notes.colindex[cv_curwin] = w_makecolor(200, 150, 50); notes.colindex[cv_curwinlt] = w_makecolor(250, 190, 65); notes.colindex[cv_curwinrb] = w_makecolor(160, 120, 40); for (n = notes.windows.head; n->next != NULL; n = n->next) { wi_undrawwin(n->d.w_w); } ws_drawfilledbox(0, 0, notes.xres, notes.yres, 0, 0); drawmenubar(); for (n = notes.windows.tail; n->prev != NULL; n = n->prev) { wi_drawwin(n->d.w_w); for (nb = n->d.w_w->buttonlist.head; nb->next != NULL; nb = nb->next) { if (!nb->d.w_b->sys_button) { if (!n->d.w_w->w.shrunk && nb->d.w_b->drawn) { wi_drawbutton(nb->d.w_b, 0); } } } } }
/* Make window w the current window. NULL is allowed */ void w_curwin(struct w_window *w) { struct w_window *ow; ow = notes.cur_win != NULL ? ¬es.cur_win->w : NULL; notes.cur_win = (struct wi_window *)w; drawmenubar(); if (ow) { w_refreshwin(ow); } if (w) { w_refreshwin(w); } }
void meupdatemenubar (void) { drawmenubar (); fldirtymenubar = false; } /*meupdatemenubar*/
void drawmenubarnow(MenuBar *mb) { uifrontbuffer(1); drawmenubar(mb); uifrontbuffer(0); }
boolean shellupdatewindowmenu (void) { /* call this when a window is opened or closed, we traverse the window list, building the window menu, sorted by window type. 8/30/90 dmb: check for nil windowsmenu 2/21/91 dmb: window menu is now a main menu; need to disable when empty 9/11/91 dmb: added idlangdialogconfig minor type 5.0d16 dmb: push all odb windows as minor types; kill extra dotted lines 5.0d17 dmb: push idcancoonconfig in export mode _or_ if the root is visible 5.0a2 dmb: new hidewindow item 7.0B44 PBS: new Minimize Window menu item. */ boolean flwasempty; hdlwindowinfo hinfo; hwindowsmenu = shellmenuhandle (windowsmenu); if (hwindowsmenu == nil) return (true); setmenuitemenable (hwindowsmenu, hidewindowitem, isshellwindow (getfrontwindow ())); #if TARGET_API_MAC_CARBON == 1 setmenuitemenable (hwindowsmenu, minimizewindowitem, isshellwindow (getfrontwindow ())); setmenuitemenable (hwindowsmenu, bringalltofrontwindowitem, true); #endif if (!flwindowmenudirty) return (true); flwindowmenudirty = false; /*consume it*/ flwasempty = countmenuitems (hwindowsmenu) == 0; fllastwasdottedline = true; /*default*/ #if TARGET_API_MAC_CARBON == 1 deleteallmenuitems (hwindowsmenu, hidewindowitem + 4); #else deleteallmenuitems (hwindowsmenu, hidewindowitem + 1); #endif #ifndef PIKE if (ccinexpertmode () || (ccfindrootwindow (&hinfo) && !(**hinfo).flhidden)) shellpushmajortype (idcancoonconfig); #endif shellpushminortype (idaboutconfig); #ifdef MACVERSION shellpushminortype (idplayerconfig); /*7.0b4 PBS: QuickTime Player window*/ #endif shellpushminortype (idcommandconfig); shellpushminortype (idlangerrorconfig); /* shellpushminortype (idmessageconfig); shellpushminortype (idprogressconfig); */ shellpushminortype (idstatsconfig); shellpushminortype (idlangdialogconfig); if (countmenuitems (hwindowsmenu) > 2 && !fllastwasdottedline) { pushdottedlinemenuitem (hwindowsmenu); fllastwasdottedline = true; } shellpushminortype (idtableconfig); shellpushminortype (idmenueditorconfig); shellpushminortype (idscriptconfig); shellpushminortype (idoutlineconfig); shellpushminortype (idwpconfig); shellpushminortype (idpictconfig); shellpushminortype (idiowaconfig); #ifdef PIKE if (countmenuitems (hwindowsmenu) > 2 && !fllastwasdottedline) { pushdottedlinemenuitem (hwindowsmenu); fllastwasdottedline = true; } if (ccinexpertmode () || (ccfindrootwindow (&hinfo) && !(**hinfo).flhidden)) shellpushmajortype (idcancoonconfig); #endif if (countmenuitems (hwindowsmenu) > 2 && fllastwasdottedline) /*eliminate extraneous dotted line*/ deletelastmenuitem (hwindowsmenu); if (flwasempty != (countmenuitems (hwindowsmenu) == 0)) { setmenuitemenable (hwindowsmenu, 0, flwasempty); drawmenubar (); } return (true); } /*shellupdatewindowmenu*/