void MyFrame::OnPageChanged(wxNotebookEvent& event) {//================================================= int pagenum; wxString title; SpectDisplay *page; pagenum = event.GetSelection(); if(event.GetId() == ID_SCREENPAGES) { title = screenpages->GetPageText(pagenum); if((title != _T("Prosody")) && (adding_page != 2)) { page = (SpectDisplay *)screenpages->GetPage(pagenum); if(page != currentcanvas) { if(currentcanvas != NULL) { currentcanvas->OnActivate(0); } page->OnActivate(1); } MakeMenu(2, NULL); } else { MakeMenu(3, NULL); } } adding_page = 0; // work around for wxNotebook bug (version 2.8.7) }
/* * Add the default or a custom menu depending on the class match */ void SetupSysMenu (unsigned long hwndIn) { HWND hwnd; HMENU sys; int i; WindowPtr pWin; char *res_name, *res_class; hwnd = (HWND)hwndIn; if (!hwnd) return; pWin = GetProp (hwnd, WIN_WINDOW_PROP); sys = GetSystemMenu (hwnd, FALSE); if (!sys) return; if (pWin) { /* First see if there's a class match... */ if (winMultiWindowGetClassHint (pWin, &res_name, &res_class)) { for (i=0; i<pref.sysMenuItems; i++) { if (!strcmp(pref.sysMenu[i].match, res_name) || !strcmp(pref.sysMenu[i].match, res_class) ) { free(res_name); free(res_class); MakeMenu (pref.sysMenu[i].menuName, sys, pref.sysMenu[i].menuPos==AT_START?0:-1); return; } } /* No match, just free alloc'd strings */ free(res_name); free(res_class); } /* Found wm_class */ } /* if pwin */ /* Fallback to system default */ if (pref.defaultSysMenuName[0]) { if (pref.defaultSysMenuPos==AT_START) MakeMenu (pref.defaultSysMenuName, sys, 0); else MakeMenu (pref.defaultSysMenuName, sys, -1); } }
Menu MakeMenu(const std::string& name, AspectFormat af) { Menu mn = MakeMenu(name); // отношение сторон mn->Params().GetAF() = af; return mn; }
int main(int argc, char** argv) { //initialisation du contexte glut initGlut(argc, argv); Menu* menu = (Menu *) malloc(sizeof(Menu)); Game* game = (Game *) malloc(sizeof(Game)); //si probleme lors de la création du menu -> exit if (!MakeMenu(WINDOW_WIDTH, WINDOW_HEIGHT, menu, debut)) return EXIT_FAILURE; //si porblème lors de la création du game -> exit if (!MakeGame(game)) { printf("Erreur MakeGame !!"); return EXIT_FAILURE; } CallMenuDemarrage(menu, game); //liberation du *game FreeGame(game); free(game); game = NULL; //libéraiton du *menu free(menu); menu = NULL; return EXIT_SUCCESS; }
/* * Possibly add a menu to the toolbar icon */ void SetupRootMenu(HMENU root) { if (!root) return; if (pref.rootMenuName[0]) { MakeMenu(pref.rootMenuName, root, 0); } }
Menu *make_menu(const char *title, module* m) { #ifndef COMMON_MENU if (BBVERSION_LEAN != BBVersion) return MakeMenu(title); #endif char menu_id[300]; get_menu_id(menu_id, NULL, m, title); return MakeNamedMenu(title, menu_id, menu_pop_global); }
MenuItem* FrameKit::MakeStructureMenu() { LayoutKit& lk = *LayoutKit::instance(); WidgetKit& kit = *WidgetKit::instance(); MenuItem *mbi = kit.menubar_item(kit.label("Structure")); mbi->menu(kit.pulldown()); MakeMenu(mbi, new FrameGroupCmd(new ControlInfo("Group", KLBL_GROUP, CODE_GROUP)), "Group "); MakeMenu(mbi, new FrameUngroupCmd(new ControlInfo("Ungroup", KLBL_UNGROUP, CODE_UNGROUP)), "Ungroup "); MakeMenu(mbi, new FrameFrontCmd(new ControlInfo("Bring to Front", KLBL_FRONT, CODE_FRONT)), "Bring to Front "); MakeMenu(mbi, new FrameBackCmd(new ControlInfo("Send to Back", KLBL_BACK, CODE_BACK)), "Send to Back "); return mbi; }
int main(int argc, char *argv[]) { Initialize(); MakeWindow(); MakeMenu(); InstallTimer(); EventLoop(); return 0; }
/* * Possibly add a menu to the toolbar icon */ void SetupRootMenu(unsigned long hmenuRoot) { HMENU root; root = (HMENU) hmenuRoot; if (!root) return; if (pref.rootMenuName[0]) { MakeMenu(pref.rootMenuName, root, 0); } }
LRESULT CALLBACK MainProc(HWND hWin, UINT message, WPARAM wParam, LPARAM lParam) { DWORD dwSelect; switch(message) { case WM_INITDIALOG: SendMessage(hWin, WM_SETTEXT, 0, (LPARAM)lpszDialogCaption); SetDlgItemText(hWin, IDC_STATIC, "No File Loaded"); //HICON hIcon = LoadIcon (hInst, (LPCSTR)IDI_ICON1); //SendMessage (hWin, WM_SETICON, ICON_BIG, (LPARAM)hIcon); MakeMenu(hWin); break; case WM_COMMAND: dwSelect = LOWORD(wParam); switch(dwSelect) { case ID_OPEN: OpenSndFile(hWin); break; case ID_EXTRACT: ExtractAction(); break; case ID_QUIT: case IDC_QUIT: SendMessage(hWin, WM_CLOSE, 0, 0); break; default: break; } break; case WM_NOTIFY : PopMenuList(hWin, lParam); break; case WM_CLOSE: case WM_DESTROY: ShowWindow(hWin, SW_MINIMIZE); EndDialog(hWin,0); break; default: return FALSE; } return TRUE; }
int main(int argc, char* argv[]) { gtk_init(&argc,&argv); MakeMainWindow(); MakeContainers(); MakeMenu(); MakeToolbar(); MakeTextView(); MakeStatusBar(); PackAll(); gtk_widget_show_all(GTK_WIDGET(Mwin)); if(argc > 1) LoadFile(g_strdup(argv[1])); gtk_main(); gtk_main_quit(); return 0; }
int main(int argc, char *argv[]) { CGTableCount sampleCount; CGDisplayErr cgErr; Initialize(); MakeWindow(); MakeMenu(); // Grab original gamma settings cgErr = CGGetDisplayTransferByTable( 0, 256, gOriginalRedTable, gOriginalGreenTable, gOriginalBlueTable, &sampleCount); InstallTimer(); EventLoop(); // Restore original gamma settings cgErr = CGSetDisplayTransferByTable( 0, 256, gOriginalRedTable, gOriginalGreenTable, gOriginalBlueTable); return 0; }
MenuItem* FrameKit::MakeViewMenu() { LayoutKit& lk = *LayoutKit::instance(); WidgetKit& kit = *WidgetKit::instance(); MenuItem* mbi = kit.menubar_item(kit.label("View")); mbi->menu(kit.pulldown()); #if 0 OvNewViewCmd::default_instance (new OvNewViewCmd (new ControlInfo("New View", KLBL_NEWVIEW, CODE_NEWVIEW), "localhost:0.0")); MakeMenu(mbi, OvNewViewCmd::default_instance(), "New View "); MakeMenu(mbi, new OvCloseEditorCmd(new ControlInfo("Close View", KLBL_CLOSEEDITOR, CODE_CLOSEEDITOR)), "Close View "); #endif #if 0 MenuItem* menu_item; menu_item = kit.menu_item(kit.label("New Display")); menu_item->action (new ActionCallback(OvNewViewCmd) (OvNewViewCmd::default_instance(), &OvNewViewCmd::set_display)); mbi->menu()->append_item(menu_item); mbi->menu()->append_item(kit.menu_item_separator()); #endif MakeMenu(mbi, new PageCmd(new ControlInfo("Page on/off", "p", "p")), "Page on/off "); MakeMenu(mbi, new OvPrecisePageCmd(new ControlInfo("Precise Page", "^P", "\020")), "Precise Page "); MakeMenu(mbi, new NormSizeCmd(new ControlInfo("Normal Size", KLBL_NORMSIZE, CODE_NORMSIZE)), "Normal Size "); MakeMenu(mbi, new RedToFitCmd(new ControlInfo("Reduce to Fit", KLBL_REDTOFIT, CODE_REDTOFIT)), "Reduce to Fit "); MakeMenu(mbi, new CenterCmd(new ControlInfo("Center Page", KLBL_CENTER, CODE_CENTER)), "Center Page "); MakeMenu(mbi, new OrientationCmd(new ControlInfo("Orientation", KLBL_ORIENTATION, CODE_ORIENTATION)), "Orientation "); mbi->menu()->append_item(kit.menu_item_separator()); MakeMenu(mbi, new GridCmd(new ControlInfo("Grid on/off", KLBL_GRID, CODE_GRID)), "Grid on/off "); MakeMenu(mbi, new GridSpacingCmd(new ControlInfo("Grid Spacing...", KLBL_GRIDSPC, CODE_GRIDSPC)), "Grid Spacing... "); MakeMenu(mbi, new GravityCmd(new ControlInfo("Gravity on/off", KLBL_GRAVITY, CODE_GRAVITY)), "Gravity on/off "); MakeMenu(mbi, new ScribblePointerCmd(new ControlInfo("Scribble pointer on/off", "", "")), "Scribble pointer on/off "); mbi->menu()->append_item(kit.menu_item_separator()); MenuItem* zoomi = kit.menu_item(kit.label("Zoom ")); Menu* zoom = kit.pullright(); zoomi->menu(zoom); MakeMenu(zoomi, new ZoomCmd(new ControlInfo("Zoom In", "Z", "Z"), 2.0), "Zoom In "); MakeMenu(zoomi, new ZoomCmd(new ControlInfo("Zoom Out", "^Z", ""), 0.5), "Zoom Out "); MakeMenu(zoomi, new PreciseZoomCmd(new ControlInfo("Precise Zoom")), "Precise Zoom "); mbi->menu()->append_item(zoomi); MenuItem* spani = kit.menu_item(kit.label("Small Pan ")); Menu* span = kit.pullright(); spani->menu(span); MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Up"), NO_PAN, PLUS_SMALL_PAN), "Small Pan Up "); MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Down"), NO_PAN, MINUS_SMALL_PAN), "Small Pan Down "); MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Left"), MINUS_SMALL_PAN, NO_PAN), "Small Pan Left "); MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Right"), PLUS_SMALL_PAN, NO_PAN), "Small Pan Right "); mbi->menu()->append_item(spani); MenuItem* lpani = kit.menu_item(kit.label("Large Pan ")); Menu* lpan = kit.pullright(); lpani->menu(lpan); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Up"), NO_PAN, PLUS_LARGE_PAN), "Large Pan Up "); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Down"), NO_PAN, MINUS_LARGE_PAN), "Large Pan Down "); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Left"), MINUS_LARGE_PAN, NO_PAN), "Large Pan Left "); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Right"), PLUS_LARGE_PAN, NO_PAN), "Large Pan Right "); mbi->menu()->append_item(lpani); MakeMenu(mbi, new PrecisePanCmd(new ControlInfo("Precise Pan")), "Precise Pan "); mbi->menu()->append_item(kit.menu_item_separator()); #if 0 MenuItem* grmenu = kit.menu_item(kit.label("Hide/Show Graphics ")); grmenu->menu(kit.pullright()); mbi->menu()->append_item(grmenu); MakeMenu(grmenu, new HideViewCmd(_ed->GetViewer(), new ControlInfo("Hide Graphic Here", "H", "H")), "Hide Graphic Here"); MakeMenu(grmenu, new UnhideViewsCmd(new ControlInfo("Unhide Graphics There", "^H", "\010")), "Unhide Graphics There"); MakeMenu(grmenu, new DesensitizeViewCmd(_ed->GetViewer(), new ControlInfo("Desensitize Graphic Here", "", "")), "Desensitize Graphic Here"); MakeMenu(grmenu, new SensitizeViewsCmd(new ControlInfo("Sensitize Graphics There", "", "")), "Sensitize Graphics There"); #endif MenuItem* fixmenu = kit.menu_item(kit.label("Fix/Unfix Graphics ")); fixmenu->menu(kit.pullright()); mbi->menu()->append_item(fixmenu); MakeMenu(fixmenu, new FixViewCmd(new ControlInfo("Fix Size", " ", " "), true, false), "Fix Size"); MakeMenu(fixmenu, new UnfixViewCmd(new ControlInfo("Unfix Size", " ", " "), true, false), "Unfix Size"); MakeMenu(fixmenu, new FixViewCmd(new ControlInfo("Fix Location", " ", " "), false, true), "Fix Location"); MakeMenu(fixmenu, new UnfixViewCmd(new ControlInfo("Unfix Location", " ", " "), false, true), "Unfix Location"); #if 0 MenuItem* chainmenu = kit.menu_item(kit.label("Chain/Unchain Viewers ")); chainmenu->menu(kit.pullright()); mbi->menu()->append_item(chainmenu); MakeMenu(chainmenu, new ChainViewersCmd(_ed->GetViewer(), new ControlInfo("Chain Panning", " ", " "), true, false), "Chain Panning"); MakeMenu(chainmenu, new UnchainViewersCmd(_ed->GetViewer(), new ControlInfo("Unchain Panning", " ", " "), true, false), "Unchain Panning"); MakeMenu(chainmenu, new ChainViewersCmd(_ed->GetViewer(), new ControlInfo("Chain Zooming", " ", " "), false, true), "Chain Zooming"); MakeMenu(chainmenu, new UnchainViewersCmd(_ed->GetViewer(), new ControlInfo("Unchain Zooming", " ", " "), false, true), "Unchain Zooming"); #endif return mbi; }
MenuItem* FrameKit::MakeViewMenu() { LayoutKit& lk = *LayoutKit::instance(); WidgetKit& kit = *WidgetKit::instance(); MenuItem* mbi = kit.menubar_item(kit.label("View")); mbi->menu(kit.pulldown()); #if 0 MakeMenu(mbi, new FrameNewViewCmd(new ControlInfo("New View", KLBL_NEWVIEW, CODE_NEWVIEW)), "New View "); MakeMenu(mbi, new OvCloseEditorCmd(new ControlInfo("Close View", KLBL_CLOSEEDITOR, CODE_CLOSEEDITOR)), "Close View "); mbi->menu()->append_item(kit.menu_item_separator()); #endif MakeMenu(mbi, new PageCmd(new ControlInfo("Page on/off", "p", "p")), "Page on/off "); MakeMenu(mbi, new NormSizeCmd(new ControlInfo("Normal Size", KLBL_NORMSIZE, CODE_NORMSIZE)), "Normal Size "); MakeMenu(mbi, new RedToFitCmd(new ControlInfo("Reduce to Fit", KLBL_REDTOFIT, CODE_REDTOFIT)), "Reduce to Fit "); MakeMenu(mbi, new CenterCmd(new ControlInfo("Center Page", KLBL_CENTER, CODE_CENTER)), "Center Page "); MakeMenu(mbi, new OrientationCmd(new ControlInfo("Orientation", KLBL_ORIENTATION, CODE_ORIENTATION)), "Orientation "); mbi->menu()->append_item(kit.menu_item_separator()); MakeMenu(mbi, new GridCmd(new ControlInfo("Grid on/off", KLBL_GRID, CODE_GRID)), "Grid on/off "); MakeMenu(mbi, new GridSpacingCmd(new ControlInfo("Grid Spacing...", KLBL_GRIDSPC, CODE_GRIDSPC)), "Grid Spacing... "); MakeMenu(mbi, new GravityCmd(new ControlInfo("Gravity on/off", KLBL_GRAVITY, CODE_GRAVITY)), "Gravity on/off "); mbi->menu()->append_item(kit.menu_item_separator()); MenuItem* zoomi = kit.menu_item(kit.label("Zoom ")); Menu* zoom = kit.pullright(); zoomi->menu(zoom); MakeMenu(zoomi, new ZoomCmd(new ControlInfo("Zoom In", "Z", "Z"), 2.0), "Zoom In "); MakeMenu(zoomi, new ZoomCmd(new ControlInfo("Zoom Out", "^Z", "\032"), 0.5), "Zoom Out "); MakeMenu(zoomi, new PreciseZoomCmd(new ControlInfo("Precise Zoom")), "Precise Zoom "); mbi->menu()->append_item(zoomi); MenuItem* spani = kit.menu_item(kit.label("Small Pan ")); Menu* span = kit.pullright(); spani->menu(span); MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Up"), NO_PAN, PLUS_SMALL_PAN), "Small Pan Up "); MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Down"), NO_PAN, MINUS_SMALL_PAN), "Small Pan Down "); MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Left"), MINUS_SMALL_PAN, NO_PAN), "Small Pan Left "); MakeMenu(spani, new FixedPanCmd(new ControlInfo("Small Pan Right"), PLUS_SMALL_PAN, NO_PAN), "Small Pan Right "); mbi->menu()->append_item(spani); MenuItem* lpani = kit.menu_item(kit.label("Large Pan ")); Menu* lpan = kit.pullright(); lpani->menu(lpan); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Up"), NO_PAN, PLUS_LARGE_PAN), "Large Pan Up "); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Down"), NO_PAN, MINUS_LARGE_PAN), "Large Pan Down "); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Left"), MINUS_LARGE_PAN, NO_PAN), "Large Pan Left "); MakeMenu(lpani, new FixedPanCmd(new ControlInfo("Large Pan Right"), PLUS_LARGE_PAN, NO_PAN), "Large Pan Right "); mbi->menu()->append_item(lpani); MakeMenu(mbi, new PrecisePanCmd(new ControlInfo("Precise Pan")), "Precise Pan "); return mbi; }
MenuItem* FrameKit::MakeEditMenu() { LayoutKit& lk = *LayoutKit::instance(); WidgetKit& kit = *WidgetKit::instance(); MenuItem *mbi = kit.menubar_item(kit.label("Edit")); mbi->menu(kit.pulldown()); MakeMenu(mbi, new UndoCmd(new ControlInfo("Undo", KLBL_UNDO, CODE_UNDO)), "Undo "); MakeMenu(mbi, new RedoCmd(new ControlInfo("Redo", KLBL_REDO, CODE_REDO)), "Redo "); MakeMenu(mbi, new CutCmd(new ControlInfo("Cut", KLBL_CUT, CODE_CUT)), "Cut "); MakeMenu(mbi, new FrameCopyCmd(new ControlInfo("Copy", KLBL_COPY, CODE_COPY)), "Copy "); MakeMenu(mbi, new PasteCmd(new ControlInfo("Paste", KLBL_PASTE, CODE_PASTE)), "Paste "); MakeMenu(mbi, new DupCmd(new ControlInfo("Duplicate", KLBL_DUP, CODE_DUP)), "Duplicate "); MakeMenu(mbi, new OvDeleteCmd(new ControlInfo("Delete", KLBL_DEL, CODE_DEL)), "Delete "); MakeMenu(mbi, new OvSlctAllCmd(new ControlInfo("Select All", KLBL_SLCTALL, CODE_SLCTALL)), "Select All "); MakeMenu(mbi, new SlctByAttrCmd(new ControlInfo("Select by Attribute", "$", "$")), "Select by Attribute "); MakeMenu(mbi, new SetAttrByExprCmd(new ControlInfo("Compute Attributes ", "#", "#")), "Compute Attributes "); mbi->menu()->append_item(kit.menu_item_separator()); MakeMenu(mbi, new ScaleCmd(new ControlInfo("Flip Horizontal", KLBL_HFLIP, CODE_HFLIP), -1.0, 1.0), "Flip Horizontal "); MakeMenu(mbi, new ScaleCmd(new ControlInfo("Flip Vertical", KLBL_VFLIP, CODE_VFLIP), 1.0, -1.0), "Flip Vertical "); MakeMenu(mbi, new RotateCmd(new ControlInfo("90 Clockwise", KLBL_CW90, CODE_CW90), -90.0), "90 Clockwise "); MakeMenu(mbi, new RotateCmd(new ControlInfo("90 CounterCW", KLBL_CCW90, CODE_CCW90), 90.0), "90 CounterCW "); mbi->menu()->append_item(kit.menu_item_separator()); MakeMenu(mbi, new OvPreciseMoveCmd(new ControlInfo("Precise Move", KLBL_PMOVE, CODE_PMOVE)), "Precise Move "); MakeMenu(mbi, new OvPreciseScaleCmd(new ControlInfo("Precise Scale", KLBL_PSCALE, CODE_PSCALE)), "Precise Scale "); MakeMenu(mbi, new OvPreciseRotateCmd(new ControlInfo("Precise Rotate", KLBL_PROTATE, CODE_PROTATE)), "Precise Rotate "); return mbi; }
void createMenu() { bool tempBool = false; if(myMenu){ DelMenu(myMenu); myMenu = NULL;} //Now we define all menus and submenus otherSubmenu = MakeMenu("Other"); MakeMenuItem(otherSubmenu, "Draw Border", "@BBNoterDrawBorder", drawBorder); MakeMenuItemInt(otherSubmenu, "Width", "@BBNoterWidth", width, 20, 400); MakeMenuItemInt(otherSubmenu, "Height", "@BBNoterHeight", height, 20, 400); // MakeMenuItemInt(otherSubmenu, "Font Size", "@BBNoterFontSize", fontSize, 6, width/3); windowStyleSubmenu = MakeMenu("Style"); //MakeMenuNOP(windowStyleSubmenu, "___________________"); if(StrStrI(windowStyle, "toolbar") != NULL) tempBool = true; MakeMenuItem(windowStyleSubmenu, "toolbar:", "@BBNoterStyleToolbar", tempBool); tempBool = false; if(StrStrI(windowStyle, "buttonnp") != NULL) tempBool = true; MakeMenuItem(windowStyleSubmenu, "toolbar.button:", "@BBNoterStyleButton", tempBool); tempBool = false; if(StrStrI(windowStyle, "buttonpr") != NULL) tempBool = true; MakeMenuItem(windowStyleSubmenu, "toolbar.button.pressed:", "@BBNoterStyleButtonPr", tempBool); tempBool = false; if(StrStrI(windowStyle, "label") != NULL && strlen(windowStyle) < 6) tempBool = true; MakeMenuItem(windowStyleSubmenu, "toolbar.label:", "@BBNoterStyleLabel", tempBool); tempBool = false; if(StrStrI(windowStyle, "windowlabel") != NULL) tempBool = true; MakeMenuItem(windowStyleSubmenu, "toolbar.windowLabel:", "@BBNoterStyleWindowLabel", tempBool); tempBool = false; if(StrStrI(windowStyle, "clock") != NULL) tempBool = true; MakeMenuItem(windowStyleSubmenu, "toolbar.clock:", "@BBNoterStyleClock", tempBool); configSubmenu = MakeMenu("Configuration"); generalConfigSubmenu = MakeMenu("General"); if(hSlit) MakeMenuItem(generalConfigSubmenu, "In Slit", "@BBNoterSlit", wantInSlit); MakeMenuItem(generalConfigSubmenu, "Toggle with Plugins", "@BBNoterPluginToggle", pluginToggle); MakeMenuItem(generalConfigSubmenu, "Always on top", "@BBNoterOnTop", alwaysOnTop); if ((dwId == VER_PLATFORM_WIN32_NT)&&(dwMajorVer > 4)) MakeMenuItem(generalConfigSubmenu, "Transparency", "@BBNoterTransparent", transparency); if ((dwId == VER_PLATFORM_WIN32_NT)&&(dwMajorVer > 4)) MakeMenuItemInt(generalConfigSubmenu, "Set Transparency", "@BBNoterSetTransparent",alpha,0,255); if ((dwId == VER_PLATFORM_WIN32_NT)&&(dwMajorVer > 4)) MakeMenuItem(generalConfigSubmenu, "Transparent Background", "@BBNoterFullTrans", fullTrans); MakeMenuItem(generalConfigSubmenu, "Snap Window To Edge", "@BBNoterSnapToEdge", snapWindow); browseSubmenu = MakeMenu("Browse"); MakeMenuItem(browseSubmenu, "Browse...", "@BBNoterLoadBitmap", false); bitmapSubmenu = MakeMenu("Bitmap"); MakeSubmenu(bitmapSubmenu, browseSubmenu, "Bitmap"); MakeMenuItem(bitmapSubmenu, "Nothing", "@BBNoterNoBitmap", noBitmap); settingsSubmenu = MakeMenu("Settings"); MakeMenuItem(settingsSubmenu, "Edit Settings", "@BBNoterEditRC", false); MakeMenuItem(settingsSubmenu, "Reload Settings", "@BBNoterReloadSettings", false); MakeMenuItem(settingsSubmenu, "Save Settings", "@BBNoterSaveSettings", false); /* ratioSubmenu = MakeMenu("Ratio"); tempBool = false; if (ratio == 1) tempBool = true; MakeMenuItem(ratioSubmenu, "1x", "@BBNoterRatio 1", tempBool); tempBool = false; if (ratio == 2) tempBool = true; MakeMenuItem(ratioSubmenu, "2x", "@BBNoterRatio 2", tempBool); tempBool = false; if (ratio == 4) tempBool = true; MakeMenuItem(ratioSubmenu, "4x", "@BBNoterRatio 4", tempBool); tempBool = false; if (ratio == 8) tempBool = true; MakeMenuItem(ratioSubmenu, "8x", "@BBNoterRatio 8", tempBool); tempBool = false; if (ratio == 16) tempBool = true; MakeMenuItem(ratioSubmenu, "16x", "@BBNoterRatio 16", tempBool); tempBool = false; if (ratio == 32) tempBool = true; MakeMenuItem(ratioSubmenu, "32x", "@BBNoterRatio 32", tempBool); */ //attach defined menus together myMenu = MakeMenu("BBNoter 1.0"); // MakeSubmenu(configSubmenu, ratioSubmenu, "Ratio"); MakeSubmenu(configSubmenu, windowStyleSubmenu, "Style"); MakeSubmenu(configSubmenu, generalConfigSubmenu, "General"); MakeSubmenu(configSubmenu, otherSubmenu, "Other"); MakeSubmenu(configSubmenu, bitmapSubmenu, "Image"); MakeSubmenu(myMenu, configSubmenu, "Configuration"); MakeSubmenu(myMenu, settingsSubmenu, "Settings"); MakeMenuItem(myMenu, "About", "@BBNoterAbout", false); ShowMenu(myMenu); }
MenuItem* FrameKit::MakeFrameMenu() { LayoutKit& lk = *LayoutKit::instance(); WidgetKit& kit = *WidgetKit::instance(); MenuItem *mbi = kit.menubar_item(kit.label("Frame")); mbi->menu(kit.pulldown()); MoveFrameCmd::default_instance (new MoveFrameCmd(new ControlInfo("Move Forward","^F",""), +1)); MakeMenu(mbi, MoveFrameCmd::default_instance(), "Move Forward "); MakeMenu(mbi, new MoveFrameCmd(new ControlInfo("Move Backward","^B",""), -1), "Move Backward "); MakeMenu(mbi, new FrameBeginCmd(new ControlInfo("Goto First Frame")), "Goto First Frame"); MakeMenu(mbi, new FrameEndCmd(new ControlInfo("Goto Last Frame")), "Goto Last Frame "); mbi->menu()->append_item(kit.menu_item_separator()); MakeMenu(mbi, new CreateMoveFrameCmd(new ControlInfo("New Forward","F","F")), "New Forward "); MakeMenu(mbi, new CreateMoveFrameCmd(new ControlInfo("New Backward","B","B"), false), "New Backward "); MakeMenu(mbi, new CopyMoveFrameCmd(new ControlInfo("Copy Forward","X","X")), "Copy Forward "); MakeMenu(mbi, new CopyMoveFrameCmd(new ControlInfo("Copy Backward","Y","Y"), false), "Copy Backward "); MakeMenu(mbi, new DeleteFrameCmd(new ControlInfo("Delete","D","D")), "Delete "); mbi->menu()->append_item(kit.menu_item_separator()); MakeMenu(mbi, new ShowOtherFrameCmd(new ControlInfo("Show Prev Frame","",""), -1), "Show Prev Frame"); MakeMenu(mbi, new ShowOtherFrameCmd(new ControlInfo("Hide Prev Frame","",""), 0), "Hide Prev Frame"); MenuItem* menu_item; menu_item = kit.menu_item(kit.label("Enable Looping")); menu_item->action (new ActionCallback(MoveFrameCmd) (MoveFrameCmd::default_instance(), &MoveFrameCmd::set_wraparound)); mbi->menu()->append_item(menu_item); menu_item = kit.menu_item(kit.label("Disable Looping")); menu_item->action (new ActionCallback(MoveFrameCmd) (MoveFrameCmd::default_instance(), &MoveFrameCmd::clr_wraparound)); mbi->menu()->append_item(menu_item); #if 0 MakeMenu(mbi, new AutoNewFrameCmd(new ControlInfo("Toggle Auto New Frame", "","")), "Toggle Auto New Frame"); #else menu_item = kit.check_menu_item(kit.label("Auto New Frame")); menu_item->state()->set(TelltaleState::is_chosen, ((FrameEditor*)GetEditor())->AutoNewFrame()); ((FrameEditor*)GetEditor())->_autonewframe_tts = menu_item->state(); AutoNewFrameCmd::default_instance(new AutoNewFrameCmd(GetEditor())); menu_item->action (new ActionCallback(AutoNewFrameCmd) (AutoNewFrameCmd::default_instance(), &AutoNewFrameCmd::Execute)); mbi->menu()->append_item(menu_item); #endif return mbi; }
/* * Change by PRB ([email protected]), 31/10/93. Prepend a hot key * specifier to each item in the list. This means allocating the * memory for each item (& freeing it) rather than just using the window * title directly. */ void do_windowList (XEvent *eventp, Window w, FVWMWIN *tmp_win, ulong context, char *action, int *Module) { MenuRoot *mr; FVWMWIN *t; char *tname; char loc[40], *name = NULL; int dwidth, dheight; char tlabel[50]; int last_desk_done = MY_INT_MIN; int next_desk; int val1, val2, val1_unit, val2_unit, n; char *t_hot; /* Menu label with hotkey added */ char scut = '0'; /* Current short cut key */ n = GetTwoArguments (action, &val1, &val2, &val1_unit, &val2_unit); sprintf (tlabel, "Desk corrente: %d\tGeometria", Scr.CurrentDesk); mr = NewMenuRoot (tlabel, 0); AddToMenu (mr, tlabel, "TITLE"); next_desk = 0; while (next_desk != MY_INT_MAX) { /* Sort window list by desktop number */ if (val1 < 2 && val1 > -2) { next_desk = MY_INT_MAX; for (t = Scr.FvwmRoot.next; t != NULL; t = t->next) { if ( (t->Desk > last_desk_done) && (t->Desk < next_desk) ) next_desk = t->Desk; } } else if (val1 < 4 && val1 > -4) { if (last_desk_done == MY_INT_MIN) next_desk = Scr.CurrentDesk; else next_desk = MY_INT_MAX; } else { if (last_desk_done == MY_INT_MIN) next_desk = val2; else next_desk = MY_INT_MAX; } last_desk_done = next_desk; for (t = Scr.FvwmRoot.next; t != NULL; t = t->next) { if ( t->Desk == next_desk && (t->flags & WINDOWLISTSKIP) == 0 ) { if (++scut == ('9' + 1)) scut = 'A'; /* Next shortcut key */ if (val1 % 2 != 0) name = t->icon_name; else name = t->name; t_hot = safemalloc (strlen (name) + 48); sprintf (t_hot, "&%c. %s", scut, name); /* Generate label */ tname = safemalloc(40); tname[0] = 0; if(t->flags & ICONIFIED) strcpy (tname, "("); sprintf (loc, "%d:", t->Desk); strcat (tname, loc); if (t->frame_x >= 0) sprintf (loc, "+%d", t->frame_x); else sprintf (loc, "%d", t->frame_x); strcat (tname, loc); if (t->frame_y >=0) sprintf (loc, "+%d", t->frame_y); else sprintf (loc, "%d", t->frame_y); strcat (tname, loc); dheight = t->frame_height - t->title_height - 2*t->boundary_width; dwidth = t->frame_width - 2*t->boundary_width; dwidth -= t->hints.base_width; dheight -= t->hints.base_height; dwidth /= t->hints.width_inc; dheight /= t->hints.height_inc; sprintf (loc, "x%d", dwidth); strcat (tname, loc); sprintf (loc, "x%d", dheight); strcat (tname, loc); if (t->flags & ICONIFIED) strcat (tname, ")"); sprintf (tlabel, "RAISE_IT %ld %ld", t, t->w); strcat (t_hot, "\t"); strcat (t_hot, tname); AddToMenu (mr, t_hot, tlabel); free (t_hot); free (tname); } } } MakeMenu (mr); /* If the menu is a result of a ButtonPress, then tell do_menu() to expect (and ignore) a button release event. Otherwise, it was as a result of a keypress or something, so we shouldn't expect a button release event. Fixes problem with keyboard short cuts not working if window list is popped up by keyboard. [email protected], 27/6/96 */ if (eventp->type == ButtonPress) do_menu (mr,1); else do_menu (mr,0); DestroyMenu (mr); } /* end do_windowList */
void MyFrame::PageCmd(wxCommandEvent& event) {//========================================= int pagenum; int ix; int n_pages; SpectDisplay *page; // if(currentcanvas != NULL) { pagenum = screenpages->GetSelection(); switch(event.GetId()) { case SPECTSEQ_SAVE: currentcanvas->Save(currentcanvas->savepath); break; case SPECTSEQ_SAVEAS: currentcanvas->Save(); break; case SPECTSEQ_SAVESELECT: currentcanvas->Save(_T(""), 1); break; case SPECTSEQ_CLOSE: if(screenpages->GetPageText(pagenum) != _T("Prosody")) { currentcanvas->OnActivate(0); } screenpages->DeletePage(pagenum); if((n_pages = screenpages->GetPageCount()) > 0) { if(pagenum >= n_pages) pagenum--; page = (SpectDisplay *)screenpages->GetPage(pagenum); if(screenpages->GetPageText(pagenum) == _T("Prosody")) { MakeMenu(3, NULL); } else { page->OnActivate(1); MakeMenu(2, NULL); } } else { MakeMenu(1, NULL); } break; case MENU_CLOSE_ALL: n_pages = screenpages->GetPageCount(); for(ix=n_pages-1; ix>=0; ix--) { screenpages->DeletePage(ix); } currentcanvas = NULL; MakeMenu(1, NULL); break; case SPECTSEQ_SAVEPITCH: currentcanvas->SavePitchenv(currentcanvas->spectseq->pitchenv); break; } } }
// Initialise this in OnInit, not statically bool MyApp::OnInit(void) {//===================== int j; wxChar *p; char param[80]; if(argc > 1) { p = argv[1]; j = 0; while((param[j] = p[j]) != 0) j++; if((strcmp(param,"--help")==0) || (strcmp(param,"-h")==0)) { printf(about_string2,espeak_Info(NULL)); printf("%s", help_text); exit(0); } ConfigInit(); if(strcmp(param,"--compile")==0) { LoadPhData(NULL); samplerate_native = samplerate = 22050; CompilePhonemeData(); CompileIntonation(); } exit(0); } ConfigInit(); gui_flag = 1; // It seems that the wctype functions don't work until the locale has been set // to something other than the default "C". Then, not only Latin1 but also the // other characters give the correct results with iswalpha() etc. if(setlocale(LC_CTYPE,"en_US.UTF-8") == NULL) { if(setlocale(LC_CTYPE,"UTF-8") == NULL) setlocale(LC_CTYPE,""); } if((frame_w == 0) || (frame_h == 0)) { frame_w = 800; frame_h = 768; } // Create the main frame window myframe = new MyFrame(NULL, -1, AppName, wxPoint(frame_x, frame_y), wxSize(frame_w, frame_h), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE | wxHSCROLL | wxVSCROLL); // Make a menubar myframe->SetMenuBar(MakeMenu(0, voice_name2)); myframe->CreateStatusBar(); myframe->SetVoiceTitle(voice_name2); // myframe->Maximize(); myframe->Show(TRUE); SetTopWindow(myframe); wxInitAllImageHandlers(); // wxImage::AddHandler(wxPNGHandler); return TRUE; }
/* * Change by PRB ([email protected]), 31/10/93. Prepend a hot key * specifier to each item in the list. This means allocating the * memory for each item (& freeing it) rather than just using the window * title directly. */ void do_windowList(XEvent *eventp,Window w,FvwmWindow *tmp_win, unsigned long context, char *action,int *Module) { MenuRoot *mr; MenuItem *miExecuteAction; FvwmWindow *t; FvwmWindow **windowList; int numWindows; int ii; char tname[80] = ""; char loc[40],*name=NULL; int dwidth,dheight; char tlabel[50]=""; int last_desk_done = INT_MIN; int last_desk_displayed = INT_MIN; int next_desk = 0; char *t_hot=NULL; /* Menu label with hotkey added */ char scut = '0'; /* Current short cut key */ char *line=NULL,*tok=NULL; int desk = Scr.CurrentDesk; int flags = SHOW_EVERYTHING; char *func=NULL; char *tfunc=NULL; char *default_action = NULL; MenuStatus menu_retval; XEvent *teventp; MenuOptions mops; size_t hotlen; mops.flags.allflags = 0; if (action && *action) { /* parse postitioning args */ action = GetMenuOptions(action,w,tmp_win,NULL,&mops); line = action; /* parse options */ while (line && *line) { line = GetNextOption(line, &tok); if (!tok) break; if (StrEquals(tok,"Function")) { line = GetNextOption(line, &func); } else if (StrEquals(tok,"Desk")) { free(tok); line = GetNextOption(line, &tok); if (tok) { desk = atoi(tok); flags &= ~SHOW_ALLDESKS; } } else if (StrEquals(tok,"CurrentDesk")) { desk = Scr.CurrentDesk; flags &= ~SHOW_ALLDESKS; } else if (StrEquals(tok,"NotAlphabetic")) flags &= ~SHOW_ALPHABETIC; else if (StrEquals(tok,"Alphabetic")) flags |= SHOW_ALPHABETIC; else if (StrEquals(tok,"NoDeskSort")) flags |= NO_DESK_SORT; else if (StrEquals(tok,"UseIconName")) flags |= SHOW_ICONNAME; else if (StrEquals(tok,"NoGeometry")) flags &= ~SHOW_GEOMETRY; else if (StrEquals(tok,"Geometry")) flags |= SHOW_GEOMETRY; else if (StrEquals(tok,"NoIcons")) flags &= ~SHOW_ICONIC; else if (StrEquals(tok,"Icons")) flags |= SHOW_ICONIC; else if (StrEquals(tok,"OnlyIcons")) flags = SHOW_ICONIC; else if (StrEquals(tok,"NoNormal")) flags &= ~SHOW_NORMAL; else if (StrEquals(tok,"Normal")) flags |= SHOW_NORMAL; else if (StrEquals(tok,"OnlyNormal")) flags = SHOW_NORMAL; else if (StrEquals(tok,"NoSticky")) flags &= ~SHOW_STICKY; else if (StrEquals(tok,"Sticky")) flags |= SHOW_STICKY; else if (StrEquals(tok,"OnlySticky")) flags = SHOW_STICKY; else if (StrEquals(tok,"NoOnTop")) flags &= ~SHOW_ONTOP; else if (StrEquals(tok,"OnTop")) flags |= SHOW_ONTOP; else if (StrEquals(tok,"OnlyOnTop")) flags = SHOW_ONTOP; else if (!line || !*line) default_action = strdup(tok); else { fvwm_msg(ERR,"WindowList","Unknown option '%s'",tok); } if (tok) free(tok); } } globalFlags = flags; if (flags & SHOW_GEOMETRY) { snprintf(tlabel,sizeof(tlabel),"Desk: %d\tGeometry",desk); } else { snprintf(tlabel,sizeof(tlabel),"Desk: %d",desk); } mr=NewMenuRoot(tlabel, False); AddToMenu(mr, tlabel, "TITLE", FALSE, FALSE); numWindows = 0; for (t = Scr.FvwmRoot.next; t != NULL; t = t->next) { numWindows++; } windowList = malloc(numWindows*sizeof(t)); if (windowList == NULL) { return; } /* get the windowlist starting from the current window (if any)*/ if ((t = Scr.Focus) == NULL) t = Scr.FvwmRoot.next; for (ii = 0; ii < numWindows; ii++) { windowList[ii] = t; if (t->next) t = t->next; else t = Scr.FvwmRoot.next; } /* Do alphabetic sort */ if (flags & SHOW_ALPHABETIC) qsort(windowList,numWindows,sizeof(t), (int(*)(const void*,const void*))winCompare); while(next_desk != INT_MAX) { /* Sort window list by desktop number */ if((flags & SHOW_ALLDESKS) && !(flags & NO_DESK_SORT)) { /* run through the windowlist finding the first desk not already processed */ next_desk = INT_MAX; for (ii = 0; ii < numWindows; ii++) { t = windowList[ii]; if((t->Desk >last_desk_done)&&(t->Desk < next_desk)) next_desk = t->Desk; } } if(!(flags & SHOW_ALLDESKS)) { /* if only doing one desk and it hasn't been done */ if(last_desk_done == INT_MIN) next_desk = desk; /* select the desk */ else next_desk = INT_MAX; /* flag completion */ } if(flags & NO_DESK_SORT) next_desk = INT_MAX; /* only go through loop once */ last_desk_done = next_desk; for (ii = 0; ii < numWindows; ii++) { t = windowList[ii]; if(((t->Desk == next_desk) || (flags & NO_DESK_SORT)) && (!(t->flags & WINDOWLISTSKIP))) { if (!(flags & SHOW_ICONIC) && (t->flags & ICONIFIED)) continue; /* don't want icons - skip */ if (!(flags & SHOW_STICKY) && (t->flags & STICKY)) continue; /* don't want sticky ones - skip */ if (!(flags & SHOW_ONTOP) && (t->flags & ONTOP)) continue; /* don't want ontop ones - skip */ if (!(flags & SHOW_NORMAL) && !((t->flags & ICONIFIED) || (t->flags & STICKY) || (t->flags & ONTOP))) continue; /* don't want "normal" ones - skip */ /* put a seperator between desks, but not at the top */ if (t->Desk != last_desk_displayed) { if (last_desk_displayed != INT_MIN) AddToMenu(mr, NULL, NULL, FALSE, FALSE); last_desk_displayed = t->Desk; } if(flags & SHOW_ICONNAME) name = t->icon_name; else name = t->name; hotlen = strlen(name) + strlen(tname) + 48; t_hot = safemalloc(hotlen); snprintf(t_hot, hotlen, "&%c. %s", scut, name); /* Generate label */ if (scut++ == '9') scut = 'A'; /* Next shortcut key */ if (flags & SHOW_GEOMETRY) { tname[0]=0; if(t->flags & ICONIFIED) strlcpy(tname, "(", sizeof(tname)); snprintf(loc, sizeof(loc), "%d:",t->Desk); strlcat(tname, loc, sizeof(tname)); dheight = t->frame_height - t->title_height - 2*t->boundary_width; dwidth = t->frame_width - 2*t->boundary_width; dwidth -= t->hints.base_width; dheight -= t->hints.base_height; dwidth /= t->hints.width_inc; dheight /= t->hints.height_inc; snprintf(loc, sizeof(loc), "%d", dwidth); strlcat(tname, loc,sizeof(tname)); snprintf(loc, sizeof(loc), "x%d", dheight); strlcat(tname, loc,sizeof(tname)); if(t->frame_x >=0) snprintf(loc, sizeof(loc), "+%d", t->frame_x); else snprintf(loc, sizeof(loc), "%d", t->frame_x); strlcat(tname, loc, sizeof(tname)); if(t->frame_y >=0) snprintf(loc, sizeof(loc), "+%d", t->frame_y); else snprintf(loc, sizeof(loc), "%d", t->frame_y); strlcat(tname, loc, sizeof(tname)); if (t->flags & STICKY) strlcat(tname, " S", sizeof(tname)); if (t->flags & ONTOP) strlcat(tname, " T", sizeof(tname)); if (t->flags & ICONIFIED) strlcat(tname, ")", sizeof(tname)); strlcat(t_hot,"\t",hotlen); strlcat(t_hot,tname,hotlen); } if (!func) { tfunc = safemalloc(40); snprintf(tfunc,40,"WindowListFunc %ld",t->w); } else { size_t funclen = strlen(func) + 32; tfunc = safemalloc(funclen); snprintf(tfunc,funclen,"%s %ld",func,t->w); free(func); func = NULL; } AddToMenu(mr, t_hot, tfunc, FALSE, FALSE); free(tfunc); #ifdef MINI_ICONS /* Add the title pixmap */ if (t->mini_icon) { mr->last->lpicture = t->mini_icon; t->mini_icon->count++; /* increase the cache count!! otherwise the pixmap will be eventually removed from the cache by DestroyMenu */ } #endif if (t_hot) free(t_hot); } } } if (func) free(func); free(windowList); MakeMenu(mr); if (!default_action && eventp && eventp->type == KeyPress) teventp = (XEvent *)1; else teventp = eventp; menu_retval = do_menu(mr, NULL, &miExecuteAction, 0, TRUE, teventp, &mops); DestroyMenu(mr); if (menu_retval == MENU_DOUBLE_CLICKED && default_action && *default_action) ExecuteFunction(default_action,tmp_win,eventp,context,*Module); if (default_action != NULL) free(default_action); }
int init_display(int argc, char **argv, MyProgram *me) { Widget w[25]; argc = OpenDisplay(argc, argv); if (argc == FALSE) return argc; w[0] = MakeMenu("File"); w[1] = MakeMenuItem(w[0], "Load...", load, me); w[2] = MakeMenuItem(w[0], "Save...", save, me); w[3] = MakeMenuItem(w[0], "Quit", quit, me); w[4] = MakeMenu("Edit"); w[5] = MakeMenuItem(w[4], "Check me", check_me, me); w[6] = MakeMenuItem(w[4], "Copy", NULL, NULL); w[7] = MakeMenuItem(w[4], "Paste", NULL, NULL); w[8] = MakeButton("Color Stuff", do_stuff, me); w[9] = MakeButton("More Stuff", more_stuff, me); w[10] = MakeButton("Quit!", quit, me); w[11] = MakeDrawArea(X_SIZE, Y_SIZE, redisplay, me); w[12] = MakeScrollList(string_table, 125, 275, list_callback, NULL); w[13] = MakeHorizScrollbar(X_SIZE, scroll_func, me); w[14] = MakeHorizScrollbar(X_SIZE, scroll_func, me); w[15] = MakeVertScrollbar(Y_SIZE, scroll_func, me); w[16] = MakeToggle("Slow", TRUE, NULL, toggle1, me); w[17] = MakeToggle("Fast", FALSE, w[16], toggle2, me); w[18] = MakeToggle("Faster", FALSE, w[16], toggle3, me); w[19] = MakeToggle("Fastest", FALSE, w[16], toggle4, me); w[20] = MakeToggle("Toggle me", FALSE, NULL, other_toggle, me); w[21] = MakeStringEntry("button.c", 435, string_func, me); w[22] = MakeTextWidget("button.c", TRUE, TRUE, 435, 200); w[23] = MakeLabel(" A Sample Libsx Demo Program (cool huh?)"); SetWidgetPos(w[4], PLACE_RIGHT, w[0], NO_CARE, NULL); SetWidgetPos(w[8], PLACE_UNDER, w[0], NO_CARE, NULL); SetWidgetPos(w[9], PLACE_UNDER, w[0], PLACE_RIGHT, w[8]); SetWidgetPos(w[10], PLACE_UNDER, w[0], PLACE_RIGHT, w[9]); SetWidgetPos(w[11], PLACE_UNDER, w[8], NO_CARE, NULL); SetWidgetPos(w[13], PLACE_UNDER, w[11], NO_CARE, NULL); SetWidgetPos(w[14], PLACE_UNDER, w[13], NO_CARE, NULL); SetWidgetPos(w[15], PLACE_RIGHT, w[11], PLACE_UNDER, w[8]); SetWidgetPos(w[12], PLACE_RIGHT, w[15], PLACE_UNDER, w[8]); SetWidgetPos(w[16], PLACE_RIGHT, w[13], PLACE_UNDER, w[15]); SetWidgetPos(w[17], PLACE_RIGHT, w[16], PLACE_UNDER, w[15]); SetWidgetPos(w[18], PLACE_RIGHT, w[13], PLACE_UNDER, w[16]); SetWidgetPos(w[19], PLACE_RIGHT, w[18], PLACE_UNDER, w[16]); SetWidgetPos(w[20], PLACE_RIGHT, w[10], PLACE_UNDER, w[0]); SetWidgetPos(w[21], PLACE_UNDER, w[18], NO_CARE, NULL); SetWidgetPos(w[22], PLACE_UNDER, w[21], NO_CARE, NULL); SetWidgetPos(w[23], PLACE_RIGHT, w[4], NO_CARE, NULL); /* * initialize the state of the toggle variables. */ me->toggle1 = TRUE; me->toggle2 = me->toggle3 = me->toggle4 = me->other_toggle = FALSE; me->list = w[12]; /* save these widget values for later */ me->str_entry = w[21]; me->text_widget = w[22]; me->draw_widget = w[11]; me->quit = w[10]; me->color_widget = w[8]; me->draw_font = GetFont("10x20"); if (me->draw_font == NULL) me->draw_font = GetFont("fixed"); SetWidgetFont(me->draw_widget, me->draw_font); SetButtonDownCB(w[11], button_down); SetButtonUpCB(w[11], button_up); SetKeypressCB(w[11], keypress); SetScrollbar(w[13], 3.0, 14.0, 14.0); SetScrollbar(w[14], 250.0, 255.0, 1.0); SetScrollbar(w[15], 30.0, 100.0, 25.0); /* * Now actually put the display on the screen. */ ShowDisplay(); /* * Get some colors for drawing with. */ GetStandardColors(); me->col1 = GetNamedColor("peachpuff2"); if (me->col1 == -1) fprintf(stderr, "Error getting color peachpuff\n"); me->col2 = GetRGBColor(255, 0, 255); if (me->col2 == -1) fprintf(stderr, "Error getting RGB color 0 255 255\n"); return argc; }
void main(void){ //verifica mouse //status = initmouse(); initmouse(); /* VAMOS VER TESTE DE ARQUIVO AQUI */ /*printf("%d", defHour(atoi("11"), atoi("30"))); getchar();*/ //mostra mouse para inicializar e esconder showmouseptr(); hidemouseptr(); //desenha logo unifenas DrawLogoChar(1, 1); showmouseptr(); //janela de login � uma particularidade tem que ser construida aqui //janela principal de senha MakeWindow(55, 10, 23, 8, "Login", WHITE, BLACK, WINLOGIN); MakeField(4, 3, 15, "Usuario", BLACK, WHITE, CHARS, WINLOGIN); MakeField(4, 5, 15, "Senha", BLACK, WHITE, PASS, WINLOGIN); MakeButton(12, 7, 10, "Entra", MAGENTA, WHITE, WINLOGIN); OpenDB(WINROOM); //primeira vez que entra cria arquivo OpenDB(AGEND); //primeira vez que entra vais WinListener(WINLOGIN); //depois da tela de login � preciso limpar a tela hidemouseptr(); WinDefault(); clrscr(); showmouseptr(); //nessa parcularidade � preciso esconder o mouse tbm if(pexit != true){ /* FAZ MENU */ MakeMenu(2, 3, 12, 2, "Salas", MAGENTA, WHITE, LIGHTGREEN, WHITE, 1); MakeSubMenu(1, "Nova"); MakeSubMenu(1, "Editar"); MakeSubMenu(1, "Apagar"); MakeSubMenu(1, "Sair"); MakeMenu(2, 7, 12, 2, "Agendamento", MAGENTA, WHITE, LIGHTGREEN, WHITE, 2); MakeSubMenu(2, "Novo"); MakeSubMenu(2, "Mostrar"); MakeSubMenu(2, "Apagar"); MakeSubMenu(2, "Sair"); MakeMenu(2, 11, 12, 2, "Relatorios", MAGENTA, WHITE, LIGHTGREEN, WHITE, 3); MakeSubMenu(3, "Salas"); MakeSubMenu(3, "Agenda"); MakeSubMenu(3, "Sair"); MakeMenu(2, 15, 12, 2, "Sair", MAGENTA, WHITE, LIGHTGREEN, WHITE, 4); MakeSubMenu(4, "Sim"); MakeSubMenu(4, "Nao"); /* FAZ MENU */ do{ //e que comece a comer recursos mexit = false; //mostra o mouse showmouseptr(); MenuListener(); }while(pexit != true); }//se o programa pedir pra ser fechado feche //limpa a tela WinDefault(); textcolor(WHITE); textbackground(BLACK); clrscr(); }
/* * Creates or appends a menu from a MENUPARSED structure */ static HMENU MakeMenu(char *name, HMENU editMenu, int editItem) { int i; int item; MENUPARSED *m; HMENU hmenu, hsub; for (i = 0; i < pref.menuItems; i++) { if (!strcmp(name, pref.menu[i].menuName)) break; } /* Didn't find a match, bummer */ if (i == pref.menuItems) { ErrorF("MakeMenu: Can't find menu %s\n", name); return NULL; } m = &(pref.menu[i]); if (editMenu) { hmenu = editMenu; item = editItem; } else { hmenu = CreatePopupMenu(); if (!hmenu) { ErrorF("MakeMenu: Unable to CreatePopupMenu() %s\n", name); return NULL; } item = 0; } /* Add the menu items */ for (i = 0; i < m->menuItems; i++) { /* Only assign IDs one time... */ if (m->menuItem[i].commandID == 0) m->menuItem[i].commandID = g_cmdid++; switch (m->menuItem[i].cmd) { case CMD_EXEC: case CMD_ALWAYSONTOP: case CMD_RELOAD: InsertMenu(hmenu, item, MF_BYPOSITION | MF_ENABLED | MF_STRING, m->menuItem[i].commandID, m->menuItem[i].text); break; case CMD_SEPARATOR: InsertMenu(hmenu, item, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); break; case CMD_MENU: /* Recursive! */ hsub = MakeMenu(m->menuItem[i].param, 0, 0); if (hsub) InsertMenu(hmenu, item, MF_BYPOSITION | MF_POPUP | MF_ENABLED | MF_STRING, (UINT_PTR) hsub, m->menuItem[i].text); break; } /* If item==-1 (means to add at end of menu) don't increment) */ if (item >= 0) item++; } return hmenu; }
MenuItem * FrameKit::MakeFileMenu() { LayoutKit& lk = *LayoutKit::instance(); WidgetKit& kit = *WidgetKit::instance(); MenuItem *mbi = kit.menubar_item(kit.label("File")); mbi->menu(kit.pulldown()); MakeMenu(mbi, new OvAboutCmd(new ControlInfo("About flipbook", "", "")), "About flipbook "); MakeMenu(mbi, new OvNewCompCmd(new ControlInfo("New", KLBL_NEWCOMP, CODE_NEWCOMP), new FrameIdrawComp), "New "); MakeMenu(mbi, new OvRevertCmd(new ControlInfo("Revert", KLBL_REVERT, CODE_REVERT)), "Revert "); MakeMenu(mbi, new OvOpenCmd(new ControlInfo("Open...", KLBL_VIEWCOMP, CODE_VIEWCOMP)), "Open... "); MakeMenu(mbi, new OvSaveCompCmd(new ControlInfo("Save", KLBL_SAVECOMP, CODE_SAVECOMP), new SaveAsChooser(".", &kit, kit.style())), "Save "); MakeMenu(mbi, new OvSaveCompAsCmd(new ControlInfo("Save As...", KLBL_SAVECOMPAS, CODE_SAVECOMPAS), new SaveAsChooser(".", &kit, kit.style())), "Save As... "); MakeMenu(mbi, new OvPrintCmd(new ControlInfo("Print...", KLBL_PRINT, CODE_PRINT)), "Print... "); MakeMenu(mbi, new FrameImportCmd(new ControlInfo("Import Graphic...", KLBL_IMPORT, CODE_IMPORT)), "Import Graphic... "); MakeMenu(mbi, new OvExportCmd(new ControlInfo("Export Graphic...", "^X", "\030")), "Export Graphic... "); MakeMenu(mbi, new OvWindowDumpAsCmd(new ControlInfo("Dump Window As..." )), "Dump Window As... "); mbi->menu()->append_item(kit.menu_item_separator()); MakeMenu(mbi, new OvQuitCmd(new ControlInfo("Quit", KLBL_QUIT, CODE_QUIT)), "Quit "); return mbi; }
void MyFrame::OnNewWindow(wxCommandEvent& event) {//============================================= SpectSeq *spectseq; wxString leaf; wxString pathload; int width, height; if(event.GetId() == MENU_SPECTRUM) pathload = path_spectload; else pathload = path_spectload2; wxString filename = wxFileSelector(_T("Read spectrum or praat data"),pathload, _T(""),_T(""),_T("*"),wxOPEN); if(filename.IsEmpty()) { return; } // create SpectSeq and import data spectseq = new SpectSeq; if(spectseq == NULL) { wxLogError(_T("Failed to create SpectSeq")); return; } wxFileInputStream stream(filename); if(stream.Ok() == FALSE) { wxLogError(_T("Failed to open '%s'"),filename.c_str()); return; } wxFileName path = wxFileName(filename); leaf = path.GetName(); setlocale(LC_NUMERIC,"C"); // read numbers in the form 1.23456 spectseq->Load(stream); spectseq->name = leaf; spectseq->MakePitchenv(spectseq->pitchenv,0,spectseq->numframes-1); if(event.GetId() == MENU_SPECTRUM) path_spectload = path.GetPath(); else path_spectload2 = path.GetPath(); // Make another frame, containing a canvas GetClientSize(&width, &height); MyChild *subframe = new MyChild(myframe, _T("Spectrum"), wxPoint(10, 0), wxSize(500, height), wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE); subframe->SetTitle(leaf); // Give it a status line subframe->CreateStatusBar(); subframe->GetClientSize(&width, &height); SpectDisplay *canvas = new SpectDisplay(subframe, wxPoint(0, 0), wxSize(width, height), spectseq); canvas->savepath = filename; currentcanvas = canvas; // Associate the menu bar with the frame subframe->SetMenuBar(MakeMenu(1,translator->dictionary_name)); subframe->canvas = canvas; subframe->Show(TRUE); }
void init_display(int argc, char **argv, MyProgram *me) { Widget w[MAX_WIDGETS]; if (OpenDisplay(argc, argv) == FALSE) return; /* declare all the widgets */ w[FILE_MENU_IDX] = MakeMenu(" File "); w[OPTIONS_MENU_IDX] = MakeMenu(" Options "); w[DISPLAY_MENU_IDX] = MakeMenu(" Display "); w[CONTROL_MENU_IDX] = MakeMenu(" Control "); w[HELP_MENU_IDX] = MakeMenu(" Help "); w[LABEL_IDX] = MakeLabel(" "); w[DRAW_AREA_IDX] = MakeDrawArea(SCREEN_X_SIZE, SCREEN_Y_SIZE, redisplay, me); w[STATUS_AREA_IDX] = MakeDrawArea(STATUS_X_SIZE, STATUS_Y_SIZE, redisplay_status, me); /* add menu items to 'file' menu */ w[FILE_LOAD_IDX] = MakeMenuItem(w[FILE_MENU_IDX], "Load Image ...", file_load, me); w[FILE_SAVE_IDX] = MakeMenuItem(w[FILE_MENU_IDX], "Save Image ...", file_save, me); w[FILE_QUIT_IDX] = MakeMenuItem(w[FILE_MENU_IDX], "Quit", file_quit, me); /* add menu items to 'options' menu */ w[OPT_ROM_IDX] = MakeMenuItem(w[OPTIONS_MENU_IDX], "ROM Setup ...", options_rom_setup, me); w[OPT_RAM_IDX] = MakeMenuItem(w[OPTIONS_MENU_IDX], "RAM Setup ...", options_ram_setup, me); w[OPT_CLOCK_IDX] = MakeMenuItem(w[OPTIONS_MENU_IDX], "Clock Setup ...", options_clock_setup, me); w[OPT_STAT_IDX] = MakeMenuItem(w[OPTIONS_MENU_IDX], "Status ...", options_status, me); /* add menu items to 'display' menu */ w[DIS_MPU_IDX] = MakeMenuItem(w[DISPLAY_MENU_IDX], "MPU", display_mpu, me); w[DIS_SYS_IDX] = MakeMenuItem(w[DISPLAY_MENU_IDX], "System", display_system, me); w[DIS_BOTH_IDX] = MakeMenuItem(w[DISPLAY_MENU_IDX], "MPU & System", display_both, me); w[DIS_IMAGE_IDX] = MakeMenuItem(w[DISPLAY_MENU_IDX], "Code Image", display_image, me); /* add menu items to 'control' menu */ w[CON_RESET_IDX] = MakeMenuItem(w[CONTROL_MENU_IDX], "Reset", control_reset, me); w[CON_STEP_IDX] = MakeMenuItem(w[CONTROL_MENU_IDX], "Step", control_step, me); w[CON_GO_IDX] = MakeMenuItem(w[CONTROL_MENU_IDX], "Go", control_go, me); w[CON_HALT_IDX] = MakeMenuItem(w[CONTROL_MENU_IDX], "Halt", control_halt, me); /* add menu items to 'help' menu */ w[HELP_ABOUT_IDX] = MakeMenuItem(w[HELP_MENU_IDX], "About ...", help_about, me); w[HELP_MENUS_IDX] = MakeMenuItem(w[HELP_MENU_IDX], "Menu Help ...", help_menu, me); w[HELP_KEYS_IDX] = MakeMenuItem(w[HELP_MENU_IDX], "Keys Help ...", help_keys, me); /* callbacks for draw area */ SetButtonDownCB(w[DRAW_AREA_IDX], button_down); SetButtonUpCB(w[DRAW_AREA_IDX], button_up); SetMouseMotionCB(w[DRAW_AREA_IDX], motion); SetKeypressCB(w[DRAW_AREA_IDX], keypress); /* set all the widgets' positions */ SetWidgetPos(w[OPTIONS_MENU_IDX], PLACE_RIGHT, w[FILE_MENU_IDX], NO_CARE, NULL); SetWidgetPos(w[DISPLAY_MENU_IDX], PLACE_RIGHT, w[OPTIONS_MENU_IDX], NO_CARE, NULL); SetWidgetPos(w[CONTROL_MENU_IDX], PLACE_RIGHT, w[DISPLAY_MENU_IDX], NO_CARE, NULL); SetWidgetPos(w[HELP_MENU_IDX], PLACE_RIGHT, w[CONTROL_MENU_IDX], NO_CARE, NULL); SetWidgetPos(w[LABEL_IDX], PLACE_RIGHT, w[HELP_MENU_IDX], NO_CARE, NULL); SetWidgetPos(w[DRAW_AREA_IDX], PLACE_UNDER, w[FILE_MENU_IDX], NO_CARE, NULL); SetWidgetPos(w[STATUS_AREA_IDX], PLACE_UNDER, w[DRAW_AREA_IDX], NO_CARE, NULL); /* This call actually causes the whole thing to be displayed on the * screen. You have to call this function before doing any drawing * into the window. */ ShowDisplay(); /* Get standard (red, blue, green, yellow, black, white) colors for * drawing stuff. Check libsx.h for more info. */ GetStandardColors(); SetFgColor(w[FILE_MENU_IDX], WHITE); SetBgColor(w[FILE_MENU_IDX], BLUE); SetFgColor(w[OPTIONS_MENU_IDX], WHITE); SetBgColor(w[OPTIONS_MENU_IDX], BLUE); SetFgColor(w[DISPLAY_MENU_IDX], WHITE); SetBgColor(w[DISPLAY_MENU_IDX], BLUE); SetFgColor(w[CONTROL_MENU_IDX], WHITE); SetBgColor(w[CONTROL_MENU_IDX], BLUE); SetFgColor(w[HELP_MENU_IDX], WHITE); SetBgColor(w[HELP_MENU_IDX], BLUE); SetFgColor(w[LABEL_IDX], BLACK); SetFgColor(w[DRAW_AREA_IDX], WHITE); SetBgColor(w[DRAW_AREA_IDX], BLACK); SetFgColor(w[STATUS_AREA_IDX], WHITE); SetBgColor(w[STATUS_AREA_IDX], BLACK); SetFgColor(w[FILE_LOAD_IDX], WHITE); SetFgColor(w[FILE_SAVE_IDX], WHITE); SetFgColor(w[FILE_QUIT_IDX], WHITE); SetBgColor(w[FILE_LOAD_IDX], BLUE); SetFgColor(w[OPT_ROM_IDX], WHITE); SetFgColor(w[OPT_RAM_IDX], WHITE); SetFgColor(w[OPT_CLOCK_IDX], WHITE); SetFgColor(w[OPT_STAT_IDX], WHITE); SetBgColor(w[OPT_RAM_IDX], BLUE); SetFgColor(w[DIS_MPU_IDX], WHITE); SetFgColor(w[DIS_SYS_IDX], WHITE); SetFgColor(w[DIS_BOTH_IDX], WHITE); SetFgColor(w[DIS_IMAGE_IDX], WHITE); SetBgColor(w[DIS_MPU_IDX], BLUE); SetFgColor(w[CON_RESET_IDX], WHITE); SetFgColor(w[CON_STEP_IDX], WHITE); SetFgColor(w[CON_GO_IDX], WHITE); SetFgColor(w[CON_HALT_IDX], WHITE); SetBgColor(w[CON_RESET_IDX], BLUE); SetFgColor(w[HELP_ABOUT_IDX], WHITE); SetFgColor(w[HELP_MENUS_IDX], WHITE); SetFgColor(w[HELP_KEYS_IDX], WHITE); SetBgColor(w[HELP_ABOUT_IDX], BLUE); /* save drawing area widget */ me->draw_area_widget = w[DRAW_AREA_IDX]; me->status_area_widget = w[STATUS_AREA_IDX]; /* If you wanted to get all the colors in the colormap, you'd do the * following : * * GetAllColors(); * SetColorMap(GREY_SCALE_1); * * You can wait to do it till later if you want. There's no need * to do it here if you don't need to (because it wacks out the * colormap). */ }