void AudacityProject::RebuildMenuBar() { // BG: Generate an array of keys combos that cannot be used #include "commandkeys.h" mFileMenu = new wxMenu(); mEditMenu = new wxMenu(); mViewMenu = new wxMenu(); mProjectMenu = new wxMenu(); mEffectMenu = new wxMenu(); mPluginMenu = new wxMenu(); mHelpMenu = new wxMenu(); delete mMenuBar->Replace(fileMenu, mFileMenu, _("&File")); delete mMenuBar->Replace(editMenu, mEditMenu, _("&Edit")); delete mMenuBar->Replace(viewMenu, mViewMenu, _("&View")); delete mMenuBar->Replace(projectMenu, mProjectMenu, _("&Project")); delete mMenuBar->Replace(effectMenu, mEffectMenu, _("Effec&t")); wxMenu * tmp = mMenuBar->Replace(pluginMenu, mPluginMenu, _("Plugin&s")); size_t eMax = tmp->GetMenuItemCount(); for(size_t e = 0; e < eMax; e++){ tmp->Destroy(FirstPluginSubMenuID + e); } delete tmp; delete mMenuBar->Replace(helpMenu, mHelpMenu, _("&Help")); BuildMenuBar(); }
void AudacityProject::CreateMenuBar() { mMenusDirtyCheck = gMenusDirty; mFirstTimeUpdateMenus = true; #define AUDACITY_MENUS_COMMANDS_EVENT_TABLE // BG: Generate an array of command names, and their corresponding functions #include "commands.h" #undef AUDACITY_MENUS_COMMANDS_EVENT_TABLE mMenuBar = new wxMenuBar(); mFileMenu = new wxMenu(); mEditMenu = new wxMenu(); mViewMenu = new wxMenu(); mProjectMenu = new wxMenu(); mEffectMenu = new wxMenu(); mPluginMenu = new wxMenu(); mHelpMenu = new wxMenu(); mMenuBar->Append(mFileMenu, _("&File")); mMenuBar->Append(mEditMenu, _("&Edit")); mMenuBar->Append(mViewMenu, _("&View")); mMenuBar->Append(mProjectMenu, _("&Project")); mMenuBar->Append(mEffectMenu, _("Effec&t")); mMenuBar->Append(mPluginMenu, _("Plugin&s")); mMenuBar->Append(mHelpMenu, _("&Help")); SetMenuBar(mMenuBar); BuildMenuBar(); }
// Builds a new window, initializes the variables and event handler and builds // the menu. SVPaint::SVPaint(const char *server_name) { window_ = new ScrollView("ScrollView Paint Example", // window caption 0, 0, // x,y window position 500, 500, // window size 500, 500, // canvas size false, // whether the Y axis is inversed. // this is included due to legacy // reasons for tesseract and enables // us to have (0,0) as the LOWER left // of the coordinate system. server_name); // the server address. // Set the start modes to point-to-point and line drawing. click_mode_ = 1; drag_mode_ = 4; has_start_point_ = false; // Bild our menus and add them to the window. The flag illustrates whether // this is a menu bar. SVMenuNode* popup_menu = BuildPopupMenu(); popup_menu->BuildMenu(window_,false); SVMenuNode* bar_menu = BuildMenuBar(); bar_menu->BuildMenu(window_,true); // Set the initial color values to White (could also be done by // passing (rgb[0], rgb[1], rgb[2]). window_->Pen(ScrollView::WHITE); window_->Brush(ScrollView::WHITE); // Adds the event handler to the window. This actually ensures that Notify // gets called when events occur. window_->AddEventHandler(this); // Set the window visible (calling this is important to actually render // everything. Without this call, the window would also be drawn, but the // menu bars would be missing. window_->SetVisible(true); // Rest this thread until its window is destroyed. // Note that a special eventhandling thread was created when constructing // the window. Due to this, the application will not deadlock here. window_->AwaitEvent(SVET_DESTROY); // We now have 3 Threads running: // (1) The MessageReceiver thread which fetches messages and distributes them // (2) The EventHandler thread which handles all events for window_ // (3) The main thread which waits on window_ for a DESTROY event (blocked) }