sil2Frame::sil2Frame(wxWindow* parent,wxWindowID id) { Parameters *p = new Parameters(); Parameters *ps = new Parameters(); Mediator<int, 10> *m = new Mediator<int, 10>(); hw = new SilMotorControlHW(this); mc = new SineMotorController(hw, p); sc = new SlipController(hw, ps, mc, m); this->controller = mc; PLFLT xmin =-1, ymin=-10, xmax=600, ymax=3000; PLINT just=0, axis=0; //(*Initialize(sil2Frame) wxBoxSizer* box; wxMenuItem* MenuItem2; wxMenuItem* MenuItem1; wxMenu* Menu1; wxMenuBar* MenuBar1; wxMenu* Menu2; Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id")); SetClientSize(wxSize(800,600)); box = new wxBoxSizer(wxHORIZONTAL); SetSizer(box); MenuBar1 = new wxMenuBar(); Menu1 = new wxMenu(); MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL); Menu1->Append(MenuItem1); MenuBar1->Append(Menu1, _("&File")); Menu2 = new wxMenu(); MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL); Menu2->Append(MenuItem2); MenuBar1->Append(Menu2, _("Help")); SetMenuBar(MenuBar1); StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1")); int __wxStatusBarWidths_1[1] = { -1 }; int __wxStatusBarStyles_1[1] = { wxSB_NORMAL }; StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1); StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1); SetStatusBar(StatusBar1); box->SetSizeHints(this); Center(); Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&sil2Frame::OnQuit); Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&sil2Frame::OnAbout); Connect(wxID_ANY,wxEVT_LEFT_DOWN,(wxObjectEventFunction)&sil2Frame::OnLeftDClick); Connect(wxID_ANY,wxEVT_LEFT_DCLICK,(wxObjectEventFunction)&sil2Frame::OnLeftDClick); Connect(wxID_ANY,wxEVT_MOUSEWHEEL,(wxObjectEventFunction)&sil2Frame::OnMouseWheel); //*) Connect(wxID_ANY,wxEVT_IDLE,(wxObjectEventFunction)&sil2Frame::OnIdle); wxPLplotwindow* plotwindow; //wxPanel* panel = new wxPanel( this ); //wxBoxSizer* box = new wxBoxSizer( wxVERTICAL ); plotwindow = new wxPLplotwindow( this ); box->Add( plotwindow, 2, wxLEFT | wxEXPAND, 0 ); //box->Add( settingsDlg, 2, wxALL, 0); //panel->SetSizer( box ); //SetSize( 640, 500 ); pls = plotwindow->GetStream(); pls->env(xmin, xmax, ymin, ymax, just, axis ); //Setup window size // - just=0 sets axis so they scale indepedently // - axis=0 draw axis box, ticks, and numeric labels // see "man plenv" for details pls->lab( "(x)", "(y)", "PlPlot example title"); settingsDlg = new Settings(this, 0); box->Add( settingsDlg, 1, wxRIGHT | wxEXPAND, 0 ); silTimer *timer = new silTimer(); timer->Start(50); }
/** * @brief (Re)Create the menubar for the schematic frame */ void SCH_EDIT_FRAME::ReCreateMenuBar() { // Create and try to get the current menubar wxString text; wxMenuBar* menuBar = GetMenuBar(); if( !menuBar ) menuBar = new wxMenuBar(); // Delete all existing menus so they can be rebuilt. // This allows language changes of the menu text on the fly. menuBar->Freeze(); while( menuBar->GetMenuCount() ) delete menuBar->Remove( 0 ); // Recreate all menus: // Menu File: wxMenu* fileMenu = new wxMenu; // New AddMenuItem( fileMenu, ID_NEW_PROJECT, _( "&New" ), _( "New schematic project" ), KiBitmap( new_xpm ) ); // Open text = AddHotkeyName( _( "&Open" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH ); AddMenuItem( fileMenu, ID_LOAD_PROJECT, text, _( "Open an existing schematic project" ), KiBitmap( open_document_xpm ) ); // Open Recent submenu static wxMenu* openRecentMenu; // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history if( openRecentMenu ) wxGetApp().GetFileHistory().RemoveMenu( openRecentMenu ); openRecentMenu = new wxMenu(); wxGetApp().GetFileHistory().UseMenu( openRecentMenu ); wxGetApp().GetFileHistory().AddFilesToMenu( openRecentMenu ); AddMenuItem( fileMenu, openRecentMenu, wxID_ANY, _( "Open &Recent" ), _( "Open a recent opened schematic project" ), KiBitmap( open_project_xpm ) ); // Import AddMenuItem( fileMenu, ID_APPEND_PROJECT, _( "&Append Schematic" ), _( "Append another schematic project to the current loaded schematic" ), KiBitmap( open_document_xpm ) ); // Separator fileMenu->AppendSeparator(); // Save schematic project text = AddHotkeyName( _( "&Save Whole Schematic Project" ), s_Schematic_Hokeys_Descr, HK_SAVE_SCH ); AddMenuItem( fileMenu, ID_SAVE_PROJECT, text, _( "Save all sheets in the schematic project" ), KiBitmap( save_project_xpm ) ); // Save current sheet AddMenuItem( fileMenu, ID_UPDATE_ONE_SHEET, _( "Save &Current Sheet Only" ), _( "Save only current schematic sheet" ), KiBitmap( save_xpm ) ); // Save current sheet as AddMenuItem( fileMenu, ID_SAVE_ONE_SHEET_UNDER_NEW_NAME, _( "Save Current Sheet &As" ), _( "Save current schematic sheet as..." ), KiBitmap( save_as_xpm ) ); // Separator fileMenu->AppendSeparator(); // Page settings AddMenuItem( fileMenu, ID_SHEET_SET, _( "Pa&ge Settings" ), _( "Settigns for page size and information" ), KiBitmap( sheetset_xpm ) ); // Print AddMenuItem( fileMenu, wxID_PRINT, _( "Pri&nt" ), _( "Print schematic" ), KiBitmap( print_button_xpm ) ); #ifdef __WINDOWS__ // __WINDOWS__ // Plot submenu wxMenu* choice_plot_fmt = new wxMenu; AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_SCHEMATIC, _( "&Plot" ), _( "Plot schematic sheet in PostScript, PDF, SVG, DXF or HPGL format" ), KiBitmap( plot_xpm ) ); // Plot to Clipboard (Windows only) AddMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, _( "Plot to &Clipboard" ), _( "Export drawings to clipboard" ), KiBitmap( copy_button_xpm ) ); // Plot AddMenuItem( fileMenu, choice_plot_fmt, ID_GEN_PLOT, _( "&Plot" ), _( "Plot schematic sheet in HPGL, PostScript or SVG format" ), KiBitmap( plot_xpm ) ); #else // Other // Plot AddMenuItem( fileMenu, ID_GEN_PLOT_SCHEMATIC, _( "&Plot" ), _( "Plot schematic sheet in HPGL, PostScript or SVG format" ), KiBitmap( plot_xpm ) ); #endif // Separator fileMenu->AppendSeparator(); // Quit AddMenuItem( fileMenu, wxID_EXIT, _( "&Quit" ), _( "Quit Eeschema" ), KiBitmap( exit_xpm ) ); // Menu Edit: wxMenu* editMenu = new wxMenu; // Undo text = AddHotkeyName( _( "&Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO ); AddMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) ); // Redo text = AddHotkeyName( _( "&Redo" ), s_Schematic_Hokeys_Descr, HK_REDO ); AddMenuItem( editMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) ); // Delete editMenu->AppendSeparator(); AddMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, _( "&Delete" ), HELP_DELETE_ITEMS, KiBitmap( delete_xpm ) ); // Find editMenu->AppendSeparator(); text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM ); AddMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, KiBitmap( find_xpm ) ); // Find/Replace AddMenuItem( editMenu, wxID_REPLACE, _( "Find and Re&place\tCtrl+Shift+F" ), HELP_REPLACE, KiBitmap( find_replace_xpm ) ); // Import footprint association from the CvPcb cmp file: editMenu->AppendSeparator(); AddMenuItem( editMenu, ID_BACKANNO_ITEMS, _( "Import Footprint Selection" ), HELP_IMPORT_FOOTPRINTS, KiBitmap( import_footprint_names_xpm ) ); // Menu View: wxMenu* viewMenu = new wxMenu; /** * Important Note for ZOOM IN and ZOOM OUT commands from menubar: * we cannot add hotkey shortcut here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command: * zoom in and out from hotkeys are equivalent to the pop up menu zoom * From here, zooming is made around the screen center * From hotkeys, zooming is made around the mouse cursor position * (obviously not possible from the toolbar or menubar command) * * in others words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators * for Zoom in and Zoom out sub menus * SO WE ADD THE NAME OF THE CORRESPONDING HOTKEY AS A COMMENT, NOT AS A SHORTCUT * using in AddHotkeyName call the option "false" (not a shortcut) */ // Zoom in text = AddHotkeyName( _( "Zoom &In" ), s_Schematic_Hokeys_Descr, HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); // Zoom out text = AddHotkeyName( _( "Zoom &Out" ), s_Schematic_Hokeys_Descr, HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); // Fit on screen text = AddHotkeyName( _( "&Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) ); // Separator viewMenu->AppendSeparator(); // Hierarchy AddMenuItem( viewMenu, ID_HIERARCHY, _( "&Hierarchy" ), _( "Navigate schematic hierarchy" ), KiBitmap( hierarchy_nav_xpm ) ); // Redraw text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); // Menu place: // @todo unify IDs wxMenu* placeMenu = new wxMenu; // Component text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr, HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text, HELP_PLACE_COMPONENTS, KiBitmap( add_component_xpm ) ); // Power port text = AddHotkeyName( _( "&Power Port" ), s_Schematic_Hokeys_Descr, HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text, HELP_PLACE_POWERPORT, KiBitmap( add_power_xpm ) ); // Wire text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr, HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_WIRE_BUTT, text, HELP_PLACE_WIRE, KiBitmap( add_line_xpm ) ); // Bus text = AddHotkeyName( _( "&Bus" ), s_Schematic_Hokeys_Descr, HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_BUS_BUTT, text, HELP_PLACE_BUS, KiBitmap( add_bus_xpm ) ); // Wire to Bus entry text = AddHotkeyName( _( "Wire to Bus &Entry" ), s_Schematic_Hokeys_Descr, HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, HELP_PLACE_WIRE2BUS_ENTRY, KiBitmap( add_line2bus_xpm ) ); // Bus to Bus entry text = AddHotkeyName( _( "Bus &to Bus Entry" ), s_Schematic_Hokeys_Descr, HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, HELP_PLACE_BUS2BUS_ENTRY, KiBitmap( add_bus2bus_xpm ) ); // No Connect Flag text = AddHotkeyName( _( "&No Connect Flag" ), s_Schematic_Hokeys_Descr, HK_ADD_NOCONN_FLAG, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, KiBitmap( noconn_xpm ) ); // Net name text = AddHotkeyName( _( "&Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_LABEL_BUTT, text, HELP_PLACE_NETLABEL, KiBitmap( add_line_label_xpm ) ); // Global label text = AddHotkeyName( _( "Gl&obal Label" ), s_Schematic_Hokeys_Descr, HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_GLABEL_BUTT, text, HELP_PLACE_GLOBALLABEL, KiBitmap( add_glabel_xpm ) ); // Junction text = AddHotkeyName( _( "&Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_JUNCTION_BUTT, text, HELP_PLACE_JUNCTION, KiBitmap( add_junction_xpm ) ); // Separator placeMenu->AppendSeparator(); // Hierarchical label text = AddHotkeyName( _( "&Hierarchical Label" ), s_Schematic_Hokeys_Descr, HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_HIERLABEL_BUTT, text, HELP_PLACE_HIER_LABEL, KiBitmap( add_hierarchical_label_xpm ) ); // Hierarchical sheet text = AddHotkeyName( _( "H&ierarchical &Sheet" ), s_Schematic_Hokeys_Descr, HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text, HELP_PLACE_SHEET, KiBitmap( add_hierarchical_subsheet_xpm ) ); // Import hierarchical sheet AddMenuItem( placeMenu, ID_IMPORT_HLABEL_BUTT, _( "I&mport Hierarchical Label" ), HELP_IMPORT_SHEETPIN, KiBitmap( import_hierarchical_label_xpm ) ); // Add hierarchical Pin to Sheet AddMenuItem( placeMenu, ID_SHEET_PIN_BUTT, _( "Hierarchical Pi&n to Sheet" ), HELP_PLACE_SHEETPIN, KiBitmap( add_hierar_pin_xpm ) ); // Separator placeMenu->AppendSeparator(); // Graphic line or polygon text = AddHotkeyName( _( "Graphic Polyline" ), s_Schematic_Hokeys_Descr, HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text, HELP_PLACE_GRAPHICLINES, KiBitmap( add_dashed_line_xpm ) ); // Graphic text text = AddHotkeyName( _( "Graphic Text" ), s_Schematic_Hokeys_Descr, HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut AddMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text, HELP_PLACE_GRAPHICTEXTS, KiBitmap( add_text_xpm ) ); // Graphic image AddMenuItem( placeMenu, ID_ADD_IMAGE_BUTT, _( "Image" ), HELP_PLACE_GRAPHICIMAGES, KiBitmap( image_xpm ) ); // Menu Preferences: wxMenu* preferencesMenu = new wxMenu; // Library AddMenuItem( preferencesMenu, ID_CONFIG_REQ, _( "&Library" ), _( "Library preferences" ), KiBitmap( library_xpm ) ); // Colors AddMenuItem( preferencesMenu, ID_COLORS_SETUP, _( "&Colors" ), _( "Color preferences" ), KiBitmap( palette_xpm ) ); // Options (Preferences on WXMAC) #ifdef __WXMAC__ preferencesMenu->Append( wxID_PREFERENCES ); #else AddMenuItem( preferencesMenu, wxID_PREFERENCES, _( "&Options" ), _( "Eeschema preferences" ), KiBitmap( preference_xpm ) ); #endif // __WXMAC__ // Language submenu wxGetApp().AddMenuLanguageList( preferencesMenu ); // Hotkey submenu AddHotkeyConfigMenu( preferencesMenu ); // Separator preferencesMenu->AppendSeparator(); // Save preferences AddMenuItem( preferencesMenu, ID_CONFIG_SAVE, _( "&Save Preferences" ), _( "Save application preferences" ), KiBitmap( save_setup_xpm ) ); // Read preferences AddMenuItem( preferencesMenu, ID_CONFIG_READ, _( "&Read Preferences" ), _( "Read application preferences" ), KiBitmap( read_setup_xpm ) ); // Menu Tools: wxMenu* toolsMenu = new wxMenu; // Library editor AddMenuItem( toolsMenu, ID_TO_LIBRARY, _( "Library &Editor" ), HELP_RUN_LIB_EDITOR, KiBitmap( libedit_xpm ) ); // Library viewer AddMenuItem( toolsMenu, ID_TO_LIBVIEW, _( "Library &Browser" ), HELP_RUN_LIB_VIEWER, KiBitmap( library_browse_xpm ) ); // Separator toolsMenu->AppendSeparator(); // Annotate AddMenuItem( toolsMenu, ID_GET_ANNOTATE, _( "&Annotate" ), HELP_ANNOTATE, KiBitmap( annotate_xpm ) ); // ERC AddMenuItem( toolsMenu, ID_GET_ERC, _( "ER&C" ), _( "Perform electrical rule check" ), KiBitmap( erc_xpm ) ); // Generate netlist AddMenuItem( toolsMenu, ID_GET_NETLIST, _( "Generate &Netlist" ), _( "Generate the component netlist" ), KiBitmap( netlist_xpm ) ); // Generate bill of materials AddMenuItem( toolsMenu, ID_GET_TOOLS, _( "Generate Bill of &Materials" ), HELP_GENERATE_BOM, KiBitmap( bom_xpm ) ); // Separator toolsMenu->AppendSeparator(); //Run CvPcb AddMenuItem( toolsMenu, ID_TO_CVPCB, _( "A&ssign Component Footprints" ), _( "Run CvPcb" ), KiBitmap( cvpcb_xpm ) ); // Run Pcbnew AddMenuItem( toolsMenu, ID_TO_PCB, _( "&Layout Printed Circuit Board" ), _( "Run Pcbnew" ), KiBitmap( pcbnew_xpm ) ); // Help Menu: wxMenu* helpMenu = new wxMenu; // Version info AddHelpVersionInfoMenuEntry( helpMenu ); // Contents AddMenuItem( helpMenu, wxID_HELP, _( "&Contents" ), _( "Open the Eeschema handbook" ), KiBitmap( online_help_xpm ) ); AddMenuItem( helpMenu, wxID_INDEX, _( "&Getting Started in KiCad" ), _( "Open the \"Getting Started in KiCad\" guide for beginners" ), KiBitmap( help_xpm ) ); // About Eeschema helpMenu->AppendSeparator(); AddMenuItem( helpMenu, wxID_ABOUT, _( "&About Eeschema" ), _( "About Eeschema schematic designer" ), KiBitmap( info_xpm ) ); // Create the menubar and append all submenus menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( preferencesMenu, _( "P&references" ) ); menuBar->Append( toolsMenu, _( "&Tools" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); // Associate the menu bar with the frame, if no previous menubar if( GetMenuBar() == NULL ) SetMenuBar( menuBar ); else menuBar->Refresh(); }
header_editor_frame_c::header_editor_frame_c(wxWindow *parent) : wxFrame(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL) , m_file_menu(nullptr) , m_file_menu_sep(false) , m_page_panel(nullptr) , m_bs_main(nullptr) , m_bs_page(nullptr) , m_ignore_tree_selection_changes(false) { wxPanel *frame_panel = new wxPanel(this); m_tc_tree = new wxTreeCtrl(frame_panel, ID_HE_TC_TREE, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN | wxTR_DEFAULT_STYLE | wxTR_HIDE_ROOT | wxTR_SINGLE); //| wxTAB_TRAVERSAL); m_root_id = m_tc_tree->AddRoot(wxEmptyString); m_tc_tree->SetMinSize(wxSize(250, -1)); m_page_panel = new wxPanel(frame_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE); m_bs_page = new wxBoxSizer(wxHORIZONTAL); m_page_panel->SetSizer(m_bs_page); m_bs_main = new wxBoxSizer(wxHORIZONTAL); m_bs_main->Add(m_tc_tree, 2, wxGROW | wxALL, 5); m_bs_main->Add(m_page_panel,3, wxGROW | wxALL, 5); frame_panel->SetSizer(m_bs_main); SetMinSize(wxSize(800, 600)); clear_pages(); const wxString dummy(wxU("dummy")); m_file_menu = new wxMenu(); m_file_menu->Append(ID_M_HE_FILE_OPEN, dummy); m_file_menu->Append(ID_M_HE_FILE_SAVE, dummy); m_file_menu->Append(ID_M_HE_FILE_RELOAD, dummy); m_file_menu->Append(ID_M_HE_FILE_CLOSE, dummy); m_file_menu->AppendSeparator(); m_file_menu->Append(ID_M_HE_FILE_QUIT, dummy); m_headers_menu = new wxMenu(); m_headers_menu->Append(ID_M_HE_HEADERS_EXPAND_ALL, dummy); m_headers_menu->Append(ID_M_HE_HEADERS_COLLAPSE_ALL, dummy); m_headers_menu->AppendSeparator(); m_headers_menu->Append(ID_M_HE_HEADERS_VALIDATE, dummy); wxMenu *help_menu = new wxMenu(); help_menu->Append(ID_M_HE_HELP_HELP, dummy); wxMenuBar *menu_bar = new wxMenuBar(); menu_bar->Append(m_file_menu, dummy); menu_bar->Append(m_headers_menu, dummy); menu_bar->Append(help_menu, dummy); SetMenuBar(menu_bar); translate_ui(); enable_menu_entries(); m_status_bar = new wxStatusBar(this, wxID_ANY); SetStatusBar(m_status_bar); m_status_bar_timer.SetOwner(this, ID_T_HE_STATUS_BAR); SetIcon(wx_get_png_or_icon(mkvmergeGUI)); SetDropTarget(new header_editor_drop_target_c(this)); set_status_bar(Z("Header editor ready.")); }
Frame::Frame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame(NULL, wxID_ANY, title, pos, size) { //Read the url for the api from the API_URL file char url[256]; bool fileread = false; FILE * file = fopen("API_URL", "r"); if (file != NULL){ if (fgets(url, 256, file) != NULL){ int i = 0; while (i < 256 && url[i] != '\0'){ if (url[i] == '\n' || url[i] == '\r' || url[i] == ' '){ url[i] = '\0'; break; } else i++; } fileread = true; } else { fileread = false; } fclose(file); } if (fileread) server_com = new ServerCommunication(url); else server_com = new ServerCommunication("http://se.putman.pw/api.php"); //Create the menu bar for the login screen wxMenu *menuFile_login = new wxMenu; //The login File menu menuFile_login->Append(wxID_EXIT); menubar_login = new wxMenuBar(); menubar_login->Append(menuFile_login, "&File"); SetMenuBar(menubar_login); //Create the menu bar for the overview screen wxMenu *menuFile_overview = new wxMenu; //The overview File menu menuFile_overview->Append(ID_EXPORT, wxT("&Export")); menuFile_overview->Append(ID_LOGOUT, wxT("&Logout")); menuFile_overview->Append(wxID_EXIT); wxMenu *menuNew = new wxMenu; menuNew->Append(ID_NEW_COURSE, wxT("New course")); menuNew->Append(ID_NEW_CURRICULUM, wxT("New study program")); menuNew->Append(ID_NEW_YEAR, wxT("New year")); wxMenu *menuDelete = new wxMenu; menuDelete->Append(ID_DELETE_YEAR, wxT("Delete year")); menuDelete->Append(ID_DELETE_CURRICULUM, wxT("Delete study program")); menuDelete->Append(ID_RESET, wxT("Delete all")); menubar_overview = new wxMenuBar(); menubar_overview->Append(menuFile_overview, "&File"); menubar_overview->Append(menuNew, "&New"); menubar_overview->Append(menuDelete, "&Delete"); CreateStatusBar(1); SetStatusText(""); //Create the error message that is displayed on a failed login attempt GetStatusBar()->SetForegroundColour(wxColour(wxT("RED"))); failed_login_txt = new wxStaticText(GetStatusBar(), wxID_ANY,wxT("Login failed: incorrect username and/or password"), wxPoint(3, 5), wxDefaultSize, 0 ); failed_login_txt->Show(false); GetStatusBar()->SetForegroundColour(wxColour(wxT("BLACK"))); if (!fileread){ failed_login_txt->SetLabel("Error reading API_URL, using the default url instead"); failed_login_txt->Show(true); } //Create the program title bar at the top of the screen wxPanel *title_panel = new wxPanel(this); title_panel->SetBackgroundColour(wxColour(0xFF,0x55,0x33)); wxStaticText *program_title_text = new wxStaticText(title_panel, wxID_ANY, "Curriculum Builder", wxPoint(10,10), wxSize(100,60) ); wxFont font = program_title_text->GetFont(); font.Scale(4); program_title_text->SetFont(font); program_title_text->SetForegroundColour(wxColour(wxT("WHITE"))); wxStaticBoxSizer *program_title = new wxStaticBoxSizer(wxHORIZONTAL,this,""); program_title->Add(title_panel, 1, wxEXPAND); //Create the bar at the bottom of the screen wxPanel *info_panel = new wxPanel(this); info_panel->SetBackgroundColour(wxColour(0xB6,0xB6,0xB6)); wxStaticText *group_info_text = new wxStaticText(info_panel, wxID_ANY, L"\u00a9 2014 Genius@Work\nPowered by Group8", wxPoint(1,1), wxSize(100, 20)); font = group_info_text->GetFont(); font.SetWeight(wxFONTWEIGHT_BOLD); group_info_text->SetFont(font); group_info_text->SetForegroundColour(wxColour(wxT("WHITE"))); wxStaticBoxSizer *group_info = new wxStaticBoxSizer(wxHORIZONTAL,this,""); group_info->Add(info_panel, 1, wxEXPAND); //Initiate the login and overview panels panel_login = new Login(this, 300, 400, 200, 300); panel_overview = new Overview(this, 50, 50, 1000, 800); panel_overview->Hide(); //Arrangement of panels and bars onscreen. wxBoxSizer *panels = new wxBoxSizer(wxVERTICAL); panels->Add(program_title, 0, wxEXPAND | wxALIGN_LEFT); panels->Add(panel_login, 1, wxEXPAND); panels->Add(panel_overview, 1, wxEXPAND); panels->Add(group_info, 0, wxEXPAND); SetSizer(panels); }//Frame
// My frame constructor MyFrame::MyFrame(const wxChar *title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)) { m_listCtrl = NULL; m_logWindow = NULL; m_smallVirtual = false; m_numListItems = 10; // Give it an icon SetIcon(wxICON(sample)); // Make an image list containing large icons m_imageListNormal = new wxImageList(32, 32, true); m_imageListSmall = new wxImageList(16, 16, true); #ifdef wxHAS_IMAGES_IN_RESOURCES m_imageListNormal->Add( wxIcon(wxT("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon2"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon3"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon4"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon5"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon6"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon7"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon8"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon9"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListSmall->Add( wxIcon(wxT("iconsmall"), wxBITMAP_TYPE_ICO_RESOURCE) ); #else m_imageListNormal->Add( wxIcon( toolbrai_xpm ) ); m_imageListNormal->Add( wxIcon( toolchar_xpm ) ); m_imageListNormal->Add( wxIcon( tooldata_xpm ) ); m_imageListNormal->Add( wxIcon( toolnote_xpm ) ); m_imageListNormal->Add( wxIcon( tooltodo_xpm ) ); m_imageListNormal->Add( wxIcon( toolchec_xpm ) ); m_imageListNormal->Add( wxIcon( toolgame_xpm ) ); m_imageListNormal->Add( wxIcon( tooltime_xpm ) ); m_imageListNormal->Add( wxIcon( toolword_xpm ) ); m_imageListSmall->Add( wxIcon( small1_xpm) ); #endif // Make a menubar wxMenu *menuFile = new wxMenu; menuFile->Append(LIST_ABOUT, wxT("&About")); menuFile->AppendSeparator(); menuFile->Append(LIST_QUIT, wxT("E&xit\tAlt-X")); wxMenu *menuView = new wxMenu; menuView->Append(LIST_LIST_VIEW, wxT("&List view\tF1")); menuView->Append(LIST_REPORT_VIEW, wxT("&Report view\tF2")); menuView->Append(LIST_ICON_VIEW, wxT("&Icon view\tF3")); menuView->Append(LIST_ICON_TEXT_VIEW, wxT("Icon view with &text\tF4")); menuView->Append(LIST_SMALL_ICON_VIEW, wxT("&Small icon view\tF5")); menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, wxT("Small icon &view with text\tF6")); menuView->Append(LIST_VIRTUAL_VIEW, wxT("&Virtual view\tF7")); menuView->Append(LIST_SMALL_VIRTUAL_VIEW, wxT("Small virtual vie&w\tF8")); menuView->AppendSeparator(); menuView->Append(LIST_SET_ITEMS_COUNT, "Set &number of items"); #ifdef __WXOSX__ menuView->AppendSeparator(); menuView->AppendCheckItem(LIST_MAC_USE_GENERIC, wxT("Mac: Use Generic Control")); #endif wxMenu *menuList = new wxMenu; menuList->Append(LIST_GOTO, wxT("&Go to item #3\tCtrl-3")); menuList->Append(LIST_FOCUS_LAST, wxT("&Make last item current\tCtrl-L")); menuList->Append(LIST_TOGGLE_FIRST, wxT("To&ggle first item\tCtrl-G")); menuList->Append(LIST_DESELECT_ALL, wxT("&Deselect All\tCtrl-D")); menuList->Append(LIST_SELECT_ALL, wxT("S&elect All\tCtrl-A")); menuList->AppendSeparator(); menuList->Append(LIST_SHOW_COL_INFO, wxT("Show &column info\tCtrl-C")); menuList->Append(LIST_SHOW_SEL_INFO, wxT("Show &selected items\tCtrl-S")); menuList->Append(LIST_SHOW_VIEW_RECT, wxT("Show &view rect")); #ifdef wxHAS_LISTCTRL_COLUMN_ORDER menuList->Append(LIST_SET_COL_ORDER, wxT("Se&t columns order\tShift-Ctrl-O")); menuList->Append(LIST_GET_COL_ORDER, wxT("Sho&w columns order\tCtrl-O")); #endif // wxHAS_LISTCTRL_COLUMN_ORDER menuList->AppendSeparator(); menuList->Append(LIST_SORT, wxT("Sor&t\tCtrl-T")); menuList->Append(LIST_FIND, "Test Find() performance"); menuList->AppendSeparator(); menuList->Append(LIST_ADD, wxT("&Append an item\tCtrl-P")); menuList->Append(LIST_EDIT, wxT("&Edit the item\tCtrl-E")); menuList->Append(LIST_DELETE, wxT("&Delete first item\tCtrl-X")); menuList->Append(LIST_DELETE_ALL, wxT("Delete &all items")); menuList->AppendSeparator(); menuList->Append(LIST_FREEZE, wxT("Free&ze\tCtrl-Z")); menuList->Append(LIST_THAW, wxT("Tha&w\tCtrl-W")); menuList->AppendSeparator(); menuList->AppendCheckItem(LIST_TOGGLE_LINES, wxT("Toggle &lines\tCtrl-I")); menuList->AppendCheckItem(LIST_TOGGLE_MULTI_SEL, wxT("&Multiple selection\tCtrl-M")); menuList->Check(LIST_TOGGLE_MULTI_SEL, true); menuList->AppendCheckItem(LIST_TOGGLE_HEADER, "Toggle &header\tCtrl-H"); menuList->Check(LIST_TOGGLE_HEADER, true); menuList->AppendCheckItem(LIST_TOGGLE_BELL, "Toggle &bell on no match"); menuList->AppendSeparator(); menuList->AppendCheckItem(LIST_TOGGLE_CHECKBOXES, wxT("&Enable Checkboxes")); menuList->Check(LIST_TOGGLE_CHECKBOXES, true); menuList->Append(LIST_TOGGLE_CHECKBOX, wxT("Toggle the item checkbox state")); menuList->Append(LIST_GET_CHECKBOX, wxT("Get the item checkbox state")); wxMenu *menuCol = new wxMenu; menuCol->Append(LIST_SET_FG_COL, wxT("&Foreground colour...")); menuCol->Append(LIST_SET_BG_COL, wxT("&Background colour...")); menuCol->AppendCheckItem(LIST_ROW_LINES, wxT("Alternating colours")); wxMenuBar *menubar = new wxMenuBar; menubar->Append(menuFile, wxT("&File")); menubar->Append(menuView, wxT("&View")); menubar->Append(menuList, wxT("&List")); menubar->Append(menuCol, wxT("&Colour")); SetMenuBar(menubar); m_panel = new wxPanel(this, wxID_ANY); m_logWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE | wxSUNKEN_BORDER); m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_logWindow)); RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL); #ifdef __WXMSW__ // this is useful to know specially when debugging :) wxLogMessage("Your version of comctl32.dll is: %d", wxApp::GetComCtl32Version()); #endif #if wxUSE_STATUSBAR CreateStatusBar(); #endif // wxUSE_STATUSBAR }
sfxFrame::sfxFrame(wxWindow* parent,wxWindowID id) { //(*Initialize(sfxFrame) wxMenuItem* MenuItem2; wxMenuItem* MenuItem1; wxBoxSizer* BoxSizer2; wxMenu* Menu1; wxBoxSizer* BoxSizer1; wxMenuBar* MenuBar1; wxBoxSizer* BoxSizer3; wxMenu* Menu2; Create(parent, wxID_ANY, _("SFX 1.32"), wxDefaultPosition, wxDefaultSize, wxSTAY_ON_TOP|wxDEFAULT_FRAME_STYLE, _T("wxID_ANY")); SetClientSize(wxSize(979,363)); SetBackgroundColour(wxColour(137,234,72)); BoxSizer1 = new wxBoxSizer(wxVERTICAL); BoxSizer2 = new wxBoxSizer(wxHORIZONTAL); SearchTextCtrl = new wxTextCtrl(this, ID_SEARCHTEXT, wxEmptyString, wxDefaultPosition, wxSize(303,21), wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_SEARCHTEXT")); SearchTextCtrl->SetMinSize(wxDLG_UNIT(this,wxSize(200,12))); SearchTextCtrl->SetMaxSize(wxDLG_UNIT(this,wxSize(1000,12))); BoxSizer2->Add(SearchTextCtrl, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); SearchButton = new wxButton(this, ID_SEARCH, _("Search"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(35,12)), 0, wxDefaultValidator, _T("ID_SEARCH")); SearchButton->SetMinSize(wxDLG_UNIT(this,wxSize(35,12))); SearchButton->SetMaxSize(wxDLG_UNIT(this,wxSize(35,12))); BoxSizer2->Add(SearchButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); AndRadioButton = new wxRadioButton(this, ID_ANDRADIOBUTTON, _("AND"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(30,12)), wxRB_GROUP, wxDefaultValidator, _T("ID_ANDRADIOBUTTON")); AndRadioButton->SetValue(true); AndRadioButton->SetMinSize(wxDLG_UNIT(this,wxSize(30,12))); AndRadioButton->SetMaxSize(wxDLG_UNIT(this,wxSize(30,12))); BoxSizer2->Add(AndRadioButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); OrRadioButton = new wxRadioButton(this, ID_ORRADIOBUTTON, _("OR"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(30,12)), 0, wxDefaultValidator, _T("ID_ORRADIOBUTTON")); OrRadioButton->SetMinSize(wxDLG_UNIT(this,wxSize(30,12))); OrRadioButton->SetMaxSize(wxDLG_UNIT(this,wxSize(30,12))); BoxSizer2->Add(OrRadioButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); PlayButton = new wxButton(this, ID_PLAYBUTTON, _("Play"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(35,12)), 0, wxDefaultValidator, _T("ID_PLAYBUTTON")); PlayButton->SetMinSize(wxDLG_UNIT(this,wxSize(35,12))); PlayButton->SetMaxSize(wxDLG_UNIT(this,wxSize(35,12))); BoxSizer2->Add(PlayButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); StopButton = new wxButton(this, ID_STOPBUTTON, _("Stop"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(35,12)), 0, wxDefaultValidator, _T("ID_STOPBUTTON")); StopButton->SetMinSize(wxDLG_UNIT(this,wxSize(35,12))); StopButton->SetMaxSize(wxDLG_UNIT(this,wxSize(35,12))); BoxSizer2->Add(StopButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); DetailButton = new wxButton(this, ID_DETAILBUTTON, _("Detail"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(35,12)), 0, wxDefaultValidator, _T("ID_DETAILBUTTON")); DetailButton->SetMinSize(wxDLG_UNIT(this,wxSize(35,12))); DetailButton->SetMaxSize(wxDLG_UNIT(this,wxSize(35,12))); BoxSizer2->Add(DetailButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); TopmostCheckBox = new wxCheckBox(this, ID_TOPMOSTCHECKBOX, _("Topmost"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(45,12)), 0, wxDefaultValidator, _T("ID_TOPMOSTCHECKBOX")); TopmostCheckBox->SetValue(true); TopmostCheckBox->SetMinSize(wxDLG_UNIT(this,wxSize(45,12))); TopmostCheckBox->SetMaxSize(wxDLG_UNIT(this,wxSize(45,12))); BoxSizer2->Add(TopmostCheckBox, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); SaveFolderButton = new wxButton(this, ID_SAVEFOLDERBUTTON, _("..."), wxDefaultPosition, wxDLG_UNIT(this,wxSize(20,12)), 0, wxDefaultValidator, _T("ID_SAVEFOLDERBUTTON")); SaveFolderButton->SetMinSize(wxDLG_UNIT(this,wxSize(20,12))); SaveFolderButton->SetMaxSize(wxDLG_UNIT(this,wxSize(20,12))); BoxSizer2->Add(SaveFolderButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); SaveToFolderButton = new wxButton(this, ID_SAVETOFOLDERBUTTON, _("Save to folder"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(60,12)), 0, wxDefaultValidator, _T("ID_SAVETOFOLDERBUTTON")); SaveToFolderButton->SetMinSize(wxDLG_UNIT(this,wxSize(60,12))); SaveToFolderButton->SetMaxSize(wxDLG_UNIT(this,wxSize(60,12))); SaveToFolderButton->Disable(); BoxSizer2->Add(SaveToFolderButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2); BoxSizer1->Add(BoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 0); BoxSizer3 = new wxBoxSizer(wxHORIZONTAL); ResultsListCtrl = new wxListCtrl(this, ID_RESULTSLISTCTRL, wxDefaultPosition, wxSize(1183,319), wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL|wxVSCROLL|wxHSCROLL, wxDefaultValidator, _T("ID_RESULTSLISTCTRL")); wxFont ResultsListCtrlFont(14,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Arial"),wxFONTENCODING_DEFAULT); ResultsListCtrl->SetFont(ResultsListCtrlFont); BoxSizer3->Add(ResultsListCtrl, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1); BoxSizer1->Add(BoxSizer3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); SetSizer(BoxSizer1); MenuBar1 = new wxMenuBar(); Menu1 = new wxMenu(); MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL); Menu1->Append(MenuItem1); MenuBar1->Append(Menu1, _("&File")); Menu2 = new wxMenu(); MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL); Menu2->Append(MenuItem2); MenuBar1->Append(Menu2, _("Help")); SetMenuBar(MenuBar1); StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1")); int __wxStatusBarWidths_1[1] = { -1 }; int __wxStatusBarStyles_1[1] = { wxSB_NORMAL }; StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1); StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1); SetStatusBar(StatusBar1); DirDialog1 = new wxDirDialog(this, _("Select directory"), wxEmptyString, wxDD_DEFAULT_STYLE, wxDefaultPosition, wxDefaultSize, _T("wxDirDialog")); SetSizer(BoxSizer1); Layout(); Connect(ID_SEARCHTEXT,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&sfxFrame::OnSearchTextCtrlTextEnter); Connect(ID_SEARCH,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnSearchButtonClick); Connect(ID_ANDRADIOBUTTON,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&sfxFrame::OnAndRadioButtonSelect); Connect(ID_ORRADIOBUTTON,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&sfxFrame::OnOrRadioButtonSelect); Connect(ID_PLAYBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnPlayButtonClick); Connect(ID_STOPBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnStopButtonClick); Connect(ID_DETAILBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnDetailButtonClick); Connect(ID_TOPMOSTCHECKBOX,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&sfxFrame::OnTopmostCheckBoxClick); Connect(ID_SAVEFOLDERBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnSaveFolderButtonClick); Connect(ID_SAVETOFOLDERBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnSaveToFolderButtonClick); Connect(ID_RESULTSLISTCTRL,wxEVT_COMMAND_LIST_BEGIN_DRAG,(wxObjectEventFunction)&sfxFrame::OnResultsListCtrlBeginDrag); Connect(ID_RESULTSLISTCTRL,wxEVT_COMMAND_LIST_ITEM_SELECTED,(wxObjectEventFunction)&sfxFrame::OnResultsListCtrlItemSelect); Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&sfxFrame::OnQuit); Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&sfxFrame::OnAbout); //*) // Report how many sounds were loaded. wxString s; s.Printf(_("%d sound effects found"), m_model.totalCount()); StatusBar1->SetLabel(s); // Set the icon for this application (see .rc file). SetIcon(wxICON(aaaa)); // Tooltips are annoying and slow us down for this application. wxToolTip::Enable(false); // That's not enough for the list control, so we disable tooltips the win32 lowlevel way too. const int LVM_SETEXTENDEDLISTVIEWSTYLE = 4150; const int LVM_GETEXTENDEDLISTVIEWSTYLE = 4151; const int LVS_EX_LABELTIP = 16384; long style = ::SendMessage((HWND)ResultsListCtrl->GetHandle(), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); style = style & (~LVS_EX_LABELTIP); ::SendMessage((HWND)ResultsListCtrl->GetHandle(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, style); // Check if model has correctly loaded everything. wxString description; if(m_model.hasDataError(description)) { wxMessageBox(description, _("Error...")); } }
MainFrame::MainFrame() : FrameBase(nullptr, wxID_ANY, "", "MainFrame", wxSize(900, 600)) , m_aui_mgr(this) , m_sys_menu_opened(false) { SetLabel(wxString::Format(_PRGNAME_ " " RPCS3_GIT_VERSION)); wxMenuBar* menubar = new wxMenuBar(); wxMenu* menu_boot = new wxMenu(); menubar->Append(menu_boot, "&Boot"); menu_boot->Append(id_boot_elf, "Boot &ELF / SELF file"); menu_boot->Append(id_boot_game, "Boot &game"); menu_boot->AppendSeparator(); menu_boot->Append(id_boot_install_pkg, "&Install PKG"); menu_boot->AppendSeparator(); menu_boot->Append(id_boot_exit, "&Exit"); wxMenu* menu_sys = new wxMenu(); menubar->Append(menu_sys, "&System"); menu_sys->Append(id_sys_pause, "&Pause")->Enable(false); menu_sys->Append(id_sys_stop, "&Stop\tCtrl + S")->Enable(false); menu_sys->AppendSeparator(); menu_sys->Append(id_sys_send_open_menu, "Send &open system menu cmd")->Enable(false); menu_sys->Append(id_sys_send_exit, "Send &exit cmd")->Enable(false); wxMenu* menu_conf = new wxMenu(); menubar->Append(menu_conf, "&Config"); menu_conf->Append(id_config_emu, "&Settings"); menu_conf->Append(id_config_pad, "&PAD Settings"); menu_conf->AppendSeparator(); menu_conf->Append(id_config_autopause_manager, "&Auto Pause Settings"); menu_conf->AppendSeparator(); menu_conf->Append(id_config_vfs_manager, "Virtual &File System Manager"); menu_conf->Append(id_config_vhdd_manager, "Virtual &HDD Manager"); menu_conf->Append(id_config_savedata_manager, "Save &Data Utility"); menu_conf->Append(id_config_lle_modules_manager, "&LLE Modules Manager"); wxMenu* menu_tools = new wxMenu(); menubar->Append(menu_tools, "&Tools"); menu_tools->Append(id_tools_compiler, "&ELF Compiler"); menu_tools->Append(id_tools_kernel_explorer, "&Kernel Explorer")->Enable(false); menu_tools->Append(id_tools_memory_viewer, "&Memory Viewer")->Enable(false); menu_tools->Append(id_tools_rsx_debugger, "&RSX Debugger")->Enable(false); menu_tools->Append(id_tools_string_search, "&String Search")->Enable(false); menu_tools->Append(id_tools_cg_disasm, "&Cg Disasm")->Enable(); wxMenu* menu_help = new wxMenu(); menubar->Append(menu_help, "&Help"); menu_help->Append(id_help_about, "&About..."); SetMenuBar(menubar); #ifdef _WIN32 SetIcon(wxICON(frame_icon)); #endif // Panels m_log_frame = new LogFrame(this); m_game_viewer = new GameViewer(this); m_debugger_frame = new DebuggerPanel(this); AddPane(m_game_viewer, "Game List", wxAUI_DOCK_CENTRE); AddPane(m_log_frame, "Log", wxAUI_DOCK_BOTTOM); AddPane(m_debugger_frame, "Debugger", wxAUI_DOCK_RIGHT); // Events Bind(wxEVT_MENU, &MainFrame::BootElf, this, id_boot_elf); Bind(wxEVT_MENU, &MainFrame::BootGame, this, id_boot_game); Bind(wxEVT_MENU, &MainFrame::InstallPkg, this, id_boot_install_pkg); Bind(wxEVT_MENU, [](wxCommandEvent&){ wxGetApp().Exit(); }, id_boot_exit); Bind(wxEVT_MENU, &MainFrame::Pause, this, id_sys_pause); Bind(wxEVT_MENU, &MainFrame::Stop, this, id_sys_stop); Bind(wxEVT_MENU, &MainFrame::SendOpenCloseSysMenu, this, id_sys_send_open_menu); Bind(wxEVT_MENU, &MainFrame::SendExit, this, id_sys_send_exit); Bind(wxEVT_MENU, &MainFrame::Config, this, id_config_emu); Bind(wxEVT_MENU, &MainFrame::ConfigPad, this, id_config_pad); Bind(wxEVT_MENU, &MainFrame::ConfigVFS, this, id_config_vfs_manager); Bind(wxEVT_MENU, &MainFrame::ConfigVHDD, this, id_config_vhdd_manager); Bind(wxEVT_MENU, &MainFrame::ConfigAutoPause, this, id_config_autopause_manager); Bind(wxEVT_MENU, &MainFrame::ConfigSaveData, this, id_config_savedata_manager); Bind(wxEVT_MENU, &MainFrame::ConfigLLEModules, this, id_config_lle_modules_manager); Bind(wxEVT_MENU, &MainFrame::OpenELFCompiler, this, id_tools_compiler); Bind(wxEVT_MENU, &MainFrame::OpenKernelExplorer, this, id_tools_kernel_explorer); Bind(wxEVT_MENU, &MainFrame::OpenMemoryViewer, this, id_tools_memory_viewer); Bind(wxEVT_MENU, &MainFrame::OpenRSXDebugger, this, id_tools_rsx_debugger); Bind(wxEVT_MENU, &MainFrame::OpenStringSearch, this, id_tools_string_search); Bind(wxEVT_MENU, &MainFrame::OpenCgDisasm, this, id_tools_cg_disasm); Bind(wxEVT_MENU, &MainFrame::AboutDialogHandler, this, id_help_about); Bind(wxEVT_MENU, &MainFrame::UpdateUI, this, id_update_dbg); wxGetApp().Bind(wxEVT_KEY_DOWN, &MainFrame::OnKeyDown, this); wxGetApp().Bind(wxEVT_DBG_COMMAND, &MainFrame::UpdateUI, this); }
wxSFSample2Frame::wxSFSample2Frame(wxFrame *frame, const wxString& title) : wxFrame(frame, -1, title) { SetSize(800, 600); #if wxUSE_MENUS // create a menu bar wxMenuBar* mbar = new wxMenuBar(); wxMenu* fileMenu = new wxMenu(wxT("")); fileMenu->Append(idMenuQuit, wxT("&Quit\tAlt-F4"), wxT("Quit the application")); mbar->Append(fileMenu, wxT("&File")); m_menuLog = new wxMenu(); m_menuLog->AppendCheckItem(idMenuLogMouseEvent, wxT("Log &mouse handlers")); m_menuLog->AppendCheckItem(idMenuLogHandleEvent, wxT("Log &handle handlers")); m_menuLog->AppendCheckItem(idMenuLogKeyEvent, wxT("Log &keyboard handler")); m_menuLog->AppendCheckItem(idMenuLogChildDropEvent, wxT("Log &child drop handler")); mbar->Append(m_menuLog, wxT("&Log")); wxMenu* helpMenu = new wxMenu(wxT("")); helpMenu->Append(idMenuAbout, wxT("&About\tF1"), wxT("Show info about this application")); mbar->Append(helpMenu, wxT("&Help")); SetMenuBar(mbar); #endif // wxUSE_MENUS wxFlexGridSizer* mainSizer = new wxFlexGridSizer( 2, 0, 0, 0 ); mainSizer->AddGrowableCol( 0 ); mainSizer->AddGrowableRow( 0 ); mainSizer->SetFlexibleDirection( wxBOTH ); mainSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); // set some diagram manager properties if necessary... // set accepted shapes (accept only 'SampleShape') m_Manager.AcceptShape(wxT("SampleShape")); // create shape canvas and associate it with shape manager m_pCanvas = new SampleCanvas(&m_Manager, this); mainSizer->Add( m_pCanvas, 1, wxEXPAND, 0 ); m_textLog = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,150 ), wxTE_MULTILINE ); m_textLog->SetFont( wxFont( 8, 74, 90, 90, false, wxT("Sans") ) ); m_textLog->SetMinSize( wxSize( -1,150 ) ); mainSizer->Add( m_textLog, 0, wxEXPAND, 0 ); SetSizer( mainSizer ); Layout(); #if wxUSE_STATUSBAR // create a status bar with some information about the used wxWidgets version CreateStatusBar(2); SetStatusText(wxT("Hello wxShapeFramework user!"),0); SetStatusText(wxbuildinfo(short_f), 1); #endif // wxUSE_STATUSBAR SetSizer( mainSizer ); Layout(); Center(); }
/** * @function GRIPFrame * @brief Constructor * @date 2011-10-13 */ GRIPFrame::GRIPFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) { tPrecision = 1000; tMax = 5; tMax = 0; InitTimer("",0); std::cout << "GRIPFrame 1" << std::endl; continueSimulation = false; timeLastRedraw = -1; renderDuringSimulation = true; filteredRelSimSpeed = 8; // ======================================================== // A. Create the menu bar wxMenu *fileMenu = new wxMenu; wxMenu *viewMenu = new wxMenu; wxMenu *simMenu = new wxMenu; wxMenu *settingsMenu = new wxMenu; wxMenu *renderMenu = new wxMenu; wxMenu *bgMenu = new wxMenu; wxMenu *helpMenu = new wxMenu; // Create the file menu fileMenu->Append(MenuLoad, wxT("L&oad\tAlt-O")); fileMenu->Append(MenuQuickLoad, wxT("Q&uickLoad\tAlt-Shift-Q")); fileMenu->Append(MenuSaveScene, wxT("Save Scene")); //saveMenu->Append(MenuSaveRobot, wxT("Save Robot")); //fileMenu->AppendSubMenu(saveMenu, wxT("S&ave\tAlt-S")); fileMenu->Append(MenuClose, wxT("C&lose\tAlt-C")); fileMenu->AppendSeparator(); fileMenu->Append(MenuQuit, wxT("E&xit\tAlt-Q")); // Create the view menu - constrain the camera position/orientation viewMenu->Append(MenuFrontView, wxT("&Front")); viewMenu->Append(MenuTopView, wxT("&Top")); viewMenu->Append(MenuRightSideView, wxT("&Side")); // Create the simulation menu simMenu->Append(MenuSimulateStart, wxT("Start simulation")); simMenu->Append(MenuSimulateStop, wxT("Stop Simulation")); simMenu->Append(MenuSimulateSingle, wxT("Simulate Single Step")); // Create the background menu bgMenu->Append(MenuBgWhite, wxT("White")); bgMenu->Append(MenuBgBlack, wxT("Black")); // Create the render menu renderMenu->Append(MenuRenderXGA, wxT("XGA 1024x768")); renderMenu->Append(MenuRenderVGA, wxT("VGA 640x480")); renderMenu->Append(MenuRenderHD, wxT("HD 1280x720")); // Create the settings menu settingsMenu->AppendCheckItem(MenuRenderDuringSim, wxT("Render During Simulation")); settingsMenu->AppendSubMenu(bgMenu, wxT("Background")); settingsMenu->Append(MenuCameraReset, wxT("Reset Camera")); settingsMenu->Check(MenuRenderDuringSim, true); // Create the help menu helpMenu->Append(MenuAbout, wxT("&About...\tF1"), wxT("Show about dialog")); // Add all the menus to the menu bar wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(viewMenu, wxT("&View")); menuBar->Append(simMenu, wxT("S&imulation")); menuBar->Append(settingsMenu, wxT("&Settings")); menuBar->Append(renderMenu, wxT("&Render")); menuBar->Append(helpMenu, wxT("&Help")); // ======================================================== // B. Create the toolbar icons for shortcuts // Get the bitmaps toolBarBitmaps[0] = wxIcon(open_xpm); toolBarBitmaps[1] = wxIcon(save_xpm); toolBarBitmaps[2] = wxIcon(redo_xpm); toolBarBitmaps[3] = wxIcon(anchor_xpm); toolBarBitmaps[4] = wxIcon(asterisk_xpm); toolBarBitmaps[5] = wxIcon(camera_xpm); toolBarBitmaps[6] = wxIcon(film_xpm); toolBarBitmaps[7] = wxIcon(simulate_xpm); toolBarBitmaps[8] = wxIcon(play_xpm); toolBarBitmaps[9] = wxIcon(stop_xpm); toolBarBitmaps[10] = wxIcon(topView_xpm); toolBarBitmaps[11] = wxIcon(rightSideView_xpm); toolBarBitmaps[12] = wxIcon(frontView_xpm); wxBitmap clockBmp = wxBitmap(clock_xpm); // Create the toolbar and assign the callback functions filebar = new wxToolBar(this,ID_TOOLBAR,wxPoint(0, 0), wxSize(prefViewerWidth+prefTreeViewWidth+50, toolBarHeight), wxTB_HORIZONTAL); filebar->SetToolBitmapSize(wxSize(16, 16)); filebar->AddTool(wxID_OPEN, _T("Open"),toolBarBitmaps[0], toolBarBitmaps[0], wxITEM_NORMAL, _T("Open .rscene file (Alt-O)")); // filebar->AddTool(wxID_SAVE, _T("Save"),toolBarBitmaps[1], toolBarBitmaps[1], wxITEM_NORMAL, _T("Save world to .rscene file (Alt-S)")); // filebar->AddSeparator(); filebar->AddTool(Tool_quickload, _T("Quick Load"),toolBarBitmaps[2], toolBarBitmaps[2], wxITEM_NORMAL, _T("Load last viewed scene (Alt-Shift-Q)")); filebar->AddSeparator(); filebar->AddTool(MenuSimulateStart, _T("Start Simulation"),toolBarBitmaps[7], toolBarBitmaps[7], wxITEM_NORMAL, _T("Start Simulation")); // filebar->AddTool(MenuPlay, _T("Play"),toolBarBitmaps[8], toolBarBitmaps[8], wxITEM_NORMAL, _T("Play")); filebar->AddTool(MenuSimulateStop, _T("Stop Simulation"),toolBarBitmaps[9], toolBarBitmaps[9], wxITEM_NORMAL, _T("Stop Simulation")); filebar->AddSeparator(); filebar->AddTool(Tool_screenshot, _T("Screenshot"),toolBarBitmaps[5], toolBarBitmaps[5], wxITEM_NORMAL, _T("Export screenshot")); filebar->AddTool(Tool_movie, _T("Movie"),toolBarBitmaps[6], toolBarBitmaps[6], wxITEM_NORMAL, _T("Export film sequence")); // Add the optional views such as top, front and side filebar->AddSeparator(); filebar->AddTool(Tool_frontView, _T("frontView"),toolBarBitmaps[12], toolBarBitmaps[12], wxITEM_NORMAL, _T("View scene from front")); filebar->AddTool(Tool_topView, _T("topView"),toolBarBitmaps[10], toolBarBitmaps[10], wxITEM_NORMAL, _T("View scene from top")); filebar->AddTool(Tool_rightSideView, _T("rightSideView"),toolBarBitmaps[11], toolBarBitmaps[11], wxITEM_NORMAL, _T("View scene from right")); // ======================================================== // C. Create the time slider //timeSlider = new GRIPSlider(clockBmp,0,1000,100,0,100,500,this,ID_TIMESLIDER,true); wxPanel* timePanel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, 0); #ifdef WIN32 /// For windows use a thicker slider - it looks nice timeTrack = new wxSlider(timePanel,1009,0,0,1000,wxDefaultPosition, wxSize(30,100), wxSL_BOTH | wxSL_VERTICAL | wxALIGN_CENTRE); #else timeTrack = new wxSlider(timePanel,1009,0,0,1000,wxDefaultPosition, wxSize(16,100), wxSL_BOTH | wxSL_VERTICAL | wxALIGN_CENTRE); #endif wxStaticBitmap *timeButton = new wxStaticBitmap(timePanel, -1, clockBmp, wxDefaultPosition, wxSize(16,16), wxALIGN_CENTRE); wxSizer *sizerTime = new wxBoxSizer(wxVERTICAL); sizerTime->Add(timeButton,0 , wxALIGN_CENTRE | wxEXPAND | wxALL, 2); sizerTime->Add(timeTrack,1 , wxALIGN_CENTRE | wxEXPAND | wxALL, 2); // ======================================================== // D. Create the option bar optionbar = new wxToolBar(this,ID_TOOLBAR,wxPoint(0, 0), wxSize(prefTreeViewWidth+50, toolBarHeight), wxTB_HORIZONTAL); // wxBitmap optionBarBitmaps[2]; optionbar->SetToolBitmapSize(wxSize(16, 16)); optionbar->AddTool(Tool_linkorder, _T("Link Order"),toolBarBitmaps[3], toolBarBitmaps[3], wxITEM_CHECK, _T("Fix link position")); optionbar->AddTool(Tool_checkcollisions, _T("Check Collisions"),toolBarBitmaps[4], toolBarBitmaps[4], wxITEM_CHECK, _T("Click to toggle collision detection")); timeText = new wxTextCtrl(optionbar,1008,wxT(" 0.00"),wxDefaultPosition,wxSize(50,20),wxTE_PROCESS_ENTER | wxTE_RIGHT); optionbar->AddSeparator(); optionbar->AddControl(timeText); timeRelText = new wxTextCtrl(optionbar,1008,wxT("1.00"),wxDefaultPosition,wxSize(50,20),wxTE_PROCESS_ENTER | wxTE_RIGHT); optionbar->AddControl(timeRelText); // ======================================================== // E. Create the status bar CreateStatusBar(2); SetStatusText(wxT("GRIP Loading...")); // ======================================================== // F. Create the layout: treeView, tabView and 3D viewer. // Create sizers - these will manage the layout/resizing of the frame elements wxSizer *sizerFull = new wxBoxSizer(wxVERTICAL); wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL); wxSizer *sizerRightH = new wxBoxSizer(wxHORIZONTAL); wxSizer *sizerBottom = new wxBoxSizer(wxHORIZONTAL); // ******************************************** // F1. Add the filebar sizerFull->Add(filebar,0, wxALIGN_TOP | wxALL, 0); // ******************************************** // F2a. Create the LHS of the top sizer: 3D // Create the 3D viewer #ifndef WIN32 // Weird hack to make wxWidgets work in Linux Show(); #endif { int attrib[] = { WX_GL_DOUBLEBUFFER, WX_GL_RGBA, WX_GL_DEPTH_SIZE, 16, 0 }; viewer = new Viewer(this, NULL, -1, wxPoint(0, 0), wxSize(prefViewerWidth, prefViewerHeight), wxFULL_REPAINT_ON_RESIZE | wxSUNKEN_BORDER, _T("GLCanvas"), attrib); } #ifdef WIN32 // Weird hack to make wxWidgets work with VC++ debug viewer->MSWSetOldWndProc((WXFARPROC)DefWindowProc); #endif // Add the viewer to the sizer sizerTop->Add(viewer, 1, wxALIGN_LEFT | wxEXPAND | wxALL, 0); // ******************************************** // F2b. Create the RHS of the top sizer // Create the treeview that will go to the right handside of the top sizer. kHackOffset is referenced below. static const size_t kHackOffset = 30; treeView = new TreeView(this, TreeViewHandle, wxPoint(0, 0), wxSize(prefTreeViewWidth, prefViewerHeight-2*toolBarHeight - kHackOffset), wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT | wxSUNKEN_BORDER); sizerRightH->Add((wxTreeCtrl*)treeView, 1, wxALIGN_CENTRE | wxALL | wxEXPAND, 0); // Also add the time panel created above. Note that RightH is horizontal // so we need to add treeView and timePanel next to each other. timePanel->SetSizer(sizerTime); sizerRightH->Add(timePanel,0, wxALIGN_LEFT | wxEXPAND | wxALL, 0); // Add the three parts of the right handside vertically. sizerRight is vertical. // sizerRight->Add(filebar,0, wxALIGN_TOP | wxALL, 0); sizerRight->Add(sizerRightH, 1 , wxALIGN_TOP | wxEXPAND | wxALL, 0); sizerRight->Add(optionbar,0, wxALIGN_TOP | wxALL, 0); // HACK: To make sure that the optionbar is not blocked by the sizerRHS wxSize rs = sizerRight->GetMinSize(); sizerRight->SetMinSize(rs.x, rs.y + kHackOffset); // Finally, add the RHS to the top sizer: /// Set the proportion flag to 0 (for wxHORIZONTAL sizer) to fix the width to its minimal size sizerTop->Add(sizerRight, 0, wxALIGN_RIGHT | wxEXPAND | wxALL, 0); // End of F1: Add the top to the full sizer: // Add elements to the sizers, setting the proportion flag to 1 and using the // wxEXPAND flag to ensure that the Viewer fills the entire sizer (subject to constraints) sizerFull->Add(sizerTop, 1, wxEXPAND | wxALL, 0 ); // ******************************************** // F3. Create the bottom sizer /// Adding a backPanel to the lower half of the window covers the generic "inner grey" /// with a forms-like control color. The tabView is added to the backPanel backPanel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, 0); tabView = new wxNotebook(backPanel, wxID_ANY, wxPoint(0, 0), wxSize(prefTreeViewWidth+prefViewerWidth, prefTabsHeight), wxNB_NOPAGETHEME | wxNB_TOP); addAllTabs(); /// Add another sizer to stretch the tabs over the back panel while keeping a 3 pixel border sizerBottom->Add(tabView, 1, wxALIGN_LEFT | wxEXPAND | wxALL, 3); backPanel->SetSizer(sizerBottom); /// Place the back panel on the lower part of the window (0 fixes the height for wxVERTICAL sizer) sizerFull->Add(backPanel, 0, wxEXPAND | wxALL, 0); // ======================================================== // G. Set the fullSizer as the frame's sizer and wrap up // Set the sizer SetSizer(sizerFull); sizerFull->SetSizeHints( this ); filebar->Realize(); optionbar->Realize(); // Start the OpenGL visualization Show(); viewer->Freeze(); viewer->InitGL(); viewer->DrawGLScene(); viewer->Thaw(); SetMenuBar(menuBar); }
/** * @brief (Re)Create the menubar for the component editor frame */ void LIB_EDIT_FRAME::ReCreateMenuBar() { // Create and try to get the current menubar wxString text; wxMenuBar* menuBar = GetMenuBar(); if( !menuBar ) menuBar = new wxMenuBar(); // Delete all existing menus so they can be rebuilt. // This allows language changes of the menu text on the fly. menuBar->Freeze(); while( menuBar->GetMenuCount() ) delete menuBar->Remove( 0 ); // Recreate all menus: // Menu File: wxMenu* fileMenu = new wxMenu; // Select current library AddMenuItem( fileMenu, ID_LIBEDIT_SELECT_CURRENT_LIB, _( "&Current Library" ), _( "Select working library" ), KiBitmap( library_xpm ) ); fileMenu->AppendSeparator(); // Save current library AddMenuItem( fileMenu, ID_LIBEDIT_SAVE_CURRENT_LIB, _( "&Save Current Library\tCtrl+S" ), _( "Save the current active library" ), KiBitmap( save_xpm ) ); // Save current library as... AddMenuItem( fileMenu, ID_LIBEDIT_SAVE_CURRENT_LIB_AS, _( "Save Current Library &As" ), _( "Save current active library as..." ), KiBitmap( save_as_xpm ) ); // Separator fileMenu->AppendSeparator(); // Export as png file AddMenuItem( fileMenu, ID_LIBEDIT_GEN_PNG_FILE, _( "Create &PNG File from Screen" ), _( "Create a PNG file from the component displayed on screen" ), KiBitmap( plot_xpm ) ); // Export as SVG file AddMenuItem( fileMenu, ID_LIBEDIT_GEN_SVG_FILE, _( "Create S&VG File" ), _( "Create a SVG file from the current loaded component" ), KiBitmap( plot_svg_xpm ) ); // Separator fileMenu->AppendSeparator(); // Quit AddMenuItem( fileMenu, wxID_EXIT, _( "&Quit" ), _( "Quit Library Editor" ), KiBitmap( exit_xpm ) ); // Edit menu wxMenu* editMenu = new wxMenu; // Undo text = AddHotkeyName( _( "&Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO ); AddMenuItem( editMenu, wxID_UNDO, text, _( "Undo last edit" ), KiBitmap( undo_xpm ) ); // Redo text = AddHotkeyName( _( "&Redo" ), s_Libedit_Hokeys_Descr, HK_REDO ); AddMenuItem( editMenu, wxID_REDO, text, _( "Redo the last undo command" ), KiBitmap( redo_xpm ) ); // Separator editMenu->AppendSeparator(); // Delete AddMenuItem( editMenu, ID_LIBEDIT_DELETE_ITEM_BUTT, _( "&Delete" ), HELP_DELETE_ITEMS, KiBitmap( delete_xpm ) ); // Menu View: wxMenu* viewMenu = new wxMenu; /** * Important Note for ZOOM IN and ZOOM OUT commands from menubar: * we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command: * zoom in and out from hotkeys are equivalent to the pop up menu zoom * From here, zooming is made around the screen center * From hotkeys, zooming is made around the mouse cursor position * (obviously not possible from the toolbar or menubar command) * * in others words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators * for Zoom in and Zoom out sub menus */ // Zoom in text = _( "Zoom &In" ); AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); // Zoom out text = _( "Zoom &Out" ); AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); // Fit on screen text = AddHotkeyName( _( "&Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) ); // Separator viewMenu->AppendSeparator(); // Redraw text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); // Menu Place: wxMenu* placeMenu = new wxMenu; // Pin AddMenuItem( placeMenu, ID_LIBEDIT_PIN_BUTT, _( "&Pin" ), HELP_ADD_PIN, KiBitmap( pin_xpm ) ); // Graphic text AddMenuItem( placeMenu, ID_LIBEDIT_BODY_TEXT_BUTT, _( "Graphic &Text" ), HELP_ADD_BODYTEXT, KiBitmap( add_text_xpm ) ); // Graphic rectangle AddMenuItem( placeMenu, ID_LIBEDIT_BODY_RECT_BUTT, _( "&Rectangle" ), HELP_ADD_BODYRECT, KiBitmap( add_rectangle_xpm ) ); // Graphic Circle AddMenuItem( placeMenu, ID_LIBEDIT_BODY_CIRCLE_BUTT, _( "&Circle" ), HELP_ADD_BODYCIRCLE, KiBitmap( add_circle_xpm ) ); // Graphic Arc AddMenuItem( placeMenu, ID_LIBEDIT_BODY_ARC_BUTT, _( "&Arc" ), HELP_ADD_BODYARC, KiBitmap( add_arc_xpm ) ); // Graphic Line or Polygon AddMenuItem( placeMenu, ID_LIBEDIT_BODY_LINE_BUTT, _( "&Line or Polygon" ), HELP_ADD_BODYPOLYGON, KiBitmap( add_polygon_xpm ) ); // Menu Preferences: wxMenu* preferencesMenu = new wxMenu; // Library AddMenuItem( preferencesMenu, ID_CONFIG_REQ, _( "&Library" ), _( "Library preferences" ), KiBitmap( library_xpm ) ); // Colors AddMenuItem( preferencesMenu, ID_COLORS_SETUP, _( "&Colors" ), _( "Color preferences" ), KiBitmap( palette_xpm ) ); // Language submenu Pgm().AddMenuLanguageList( preferencesMenu ); // Hotkey submenu AddHotkeyConfigMenu( preferencesMenu ); // Separator preferencesMenu->AppendSeparator(); // Save preferences AddMenuItem( preferencesMenu, ID_CONFIG_SAVE, _( "&Save preferences" ), _( "Save application preferences" ), KiBitmap( save_setup_xpm ) ); // Read preferences AddMenuItem( preferencesMenu, ID_CONFIG_READ, _( "&Read preferences" ), _( "Read application preferences" ), KiBitmap( read_setup_xpm ) ); // Menu Help: wxMenu* helpMenu = new wxMenu; // Version info AddHelpVersionInfoMenuEntry( helpMenu ); // Contents AddMenuItem( helpMenu, wxID_HELP, _( "&Contents" ), _( "Open the Eeschema manual" ), KiBitmap( online_help_xpm ) ); AddMenuItem( helpMenu, wxID_INDEX, _( "&Getting Started in KiCad" ), _( "Open the \"Getting Started in KiCad\" guide for beginners" ), KiBitmap( help_xpm ) ); // About Eeschema helpMenu->AppendSeparator(); AddMenuItem( helpMenu, wxID_ABOUT, _( "&About Eeschema" ), _( "About Eeschema schematic designer" ), KiBitmap( info_xpm ) ); // Create the menubar and append all submenus menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( preferencesMenu, _( "P&references" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); // Associate the menu bar with the frame, if no previous menubar if( GetMenuBar() == NULL ) SetMenuBar( menuBar ); else menuBar->Refresh(); }
void frmMain::CreateMenus() { // to add a new menu or context menu to the main window, i.e. define a possible // action on a pgObject, everything has to go into this method. Doing menu related // stuff elsewhere is plain wrong! // Create a proper actionFactory (or contextActionFactory) for each of your new actions // in the new frmXXX.cpp and register it here. fileMenu = new wxMenu(); pluginsMenu = new wxMenu(); viewMenu = new wxMenu(); editMenu = new wxMenu(); newMenu = new wxMenu(); toolsMenu = new wxMenu(); slonyMenu = new wxMenu(); scriptingMenu = new wxMenu(); viewDataMenu = new wxMenu(); debuggingMenu = new wxMenu(); reportMenu = new wxMenu(); wxMenu *cfgMenu = new wxMenu(); helpMenu = new wxMenu(); newContextMenu = new wxMenu(); toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER ); toolBar->SetToolBitmapSize(wxSize(32, 32)); menuFactories = new menuFactoryList(); // Load plugins - must do this after creating the menus and the factories LoadPluginUtilities(); //-------------------------- fileMenu->Append(MNU_SAVEDEFINITION, _("&Save Definition..."), _("Save the SQL definition of the selected object.")); fileMenu->AppendSeparator(); new addServerFactory(menuFactories, fileMenu, toolBar); viewMenu->Append(MNU_OBJECTBROWSER, _("&Object browser\tCtrl-Alt-O"), _("Show or hide the object browser."), wxITEM_CHECK); viewMenu->Append(MNU_SQLPANE, _("&SQL pane\tCtrl-Alt-S"), _("Show or hide the SQL pane."), wxITEM_CHECK); viewMenu->Append(MNU_TOOLBAR, _("&Tool bar\tCtrl-Alt-T"), _("Show or hide the tool bar."), wxITEM_CHECK); viewMenu->AppendSeparator(); viewMenu->Append(MNU_DEFAULTVIEW, _("&Default view\tCtrl-Alt-V"), _("Restore the default view.")); viewMenu->AppendSeparator(); actionFactory *refFact = new refreshFactory(menuFactories, viewMenu, toolBar); new countRowsFactory(menuFactories, viewMenu, 0); new executePgstattupleFactory(menuFactories, viewMenu, 0); new executePgstatindexFactory(menuFactories, viewMenu, 0); new enabledisableRuleFactory(menuFactories, toolsMenu, 0); new enabledisableTriggerFactory(menuFactories, toolsMenu, 0); new enabledisableEventTriggerFactory(menuFactories, toolsMenu, 0); new disableAllTriggersFactory(menuFactories, toolsMenu, 0); new enableAllTriggersFactory(menuFactories, toolsMenu, 0); new validateForeignKeyFactory(menuFactories, toolsMenu, 0); new validateCheckFactory(menuFactories, toolsMenu, 0); new validateDomainCheckFactory(menuFactories, toolsMenu, 0); toolsMenu->AppendSeparator(); //-------------------------- new separatorFactory(menuFactories); toolBar->AddSeparator(); new passwordFactory(menuFactories, fileMenu, 0); fileMenu->AppendSeparator(); optionsFactory *optFact = new optionsFactory(menuFactories, fileMenu, 0); fileMenu->AppendSeparator(); new mainConfigFileFactory(menuFactories, fileMenu, 0); new hbaConfigFileFactory(menuFactories, fileMenu, 0); new pgpassConfigFileFactory(menuFactories, fileMenu, 0); fileMenu->AppendSeparator(); fileMenu->Append(MNU_EXIT, _("E&xit\tCtrl-Q"), _("Quit this program.")); new slonyRestartFactory(menuFactories, slonyMenu, 0); new slonyUpgradeFactory(menuFactories, slonyMenu, 0); new slonyFailoverFactory(menuFactories, slonyMenu, 0); new slonyLockSetFactory(menuFactories, slonyMenu, 0); new slonyUnlockSetFactory(menuFactories, slonyMenu, 0); new slonyMergeSetFactory(menuFactories, slonyMenu, 0); new slonyMoveSetFactory(menuFactories, slonyMenu, 0); toolsMenu->Append(MNU_SLONY_SUBMENU, _("Slony Replication"), slonyMenu); propFactory = new propertyFactory(menuFactories, 0, toolBar); new separatorFactory(menuFactories); // ------------------------- editMenu->Append(MNU_COPY, _("&Copy\tCtrl-C"), _("Copy selected text to clipboard")); editMenu->AppendSeparator(); // ------------------------- //-------------------------- newMenuFactory = new submenuFactory(menuFactories); // placeholder where "New objects" submenu will be inserted editMenu->Append(newMenuFactory->GetId(), _("New &Object"), newMenu, _("Create a new object.")); editMenu->AppendSeparator(); //-------------------------- new connectServerFactory(menuFactories, toolsMenu, 0); new disconnectServerFactory(menuFactories, toolsMenu, 0); new disconnectDatabaseFactory(menuFactories, toolsMenu, 0); new startServiceFactory(menuFactories, toolsMenu, 0); new stopServiceFactory(menuFactories, toolsMenu, 0); new reloadconfServiceFactory(menuFactories, toolsMenu, 0); new pausereplayServiceFactory(menuFactories, toolsMenu, 0); new resumereplayServiceFactory(menuFactories, toolsMenu, 0); new addnamedrestorepointServiceFactory(menuFactories, toolsMenu, 0); new createFactory(menuFactories, editMenu, toolBar); new dropFactory(menuFactories, editMenu, toolBar); new dropCascadedFactory(menuFactories, editMenu, 0); new truncateFactory(menuFactories, editMenu, 0); new truncateCascadedFactory(menuFactories, editMenu, 0); new resetTableStatsFactory(menuFactories, editMenu, 0); new resetFunctionStatsFactory(menuFactories, editMenu, 0); new reassignDropOwnedFactory(menuFactories, editMenu, 0); new searchObjectFactory(menuFactories, editMenu, 0); editMenu->AppendSeparator(); new separatorFactory(menuFactories); toolBar->AddSeparator(); toolsMenu->AppendSeparator(); debuggingMenuFactory = new submenuFactory(menuFactories); // placeholder where "Debugging" submenu will be inserted toolsMenu->Append(debuggingMenuFactory->GetId(), _("&Debugging"), debuggingMenu, _("Debugging options for the selected item.")); new debuggerFactory(menuFactories, debuggingMenu, 0); new breakpointFactory(menuFactories, debuggingMenu, 0); new queryToolFactory(menuFactories, toolsMenu, toolBar); scriptingMenuFactory = new submenuFactory(menuFactories); // placeholder where "Query Template" submenu will be inserted toolsMenu->Append(scriptingMenuFactory->GetId(), _("Scripts"), scriptingMenu, _("Start Query Tool with scripted query.")); new queryToolSqlFactory(menuFactories, scriptingMenu, 0); new queryToolSelectFactory(menuFactories, scriptingMenu, 0); new queryToolExecFactory(menuFactories, scriptingMenu, 0); new queryToolInsertFactory(menuFactories, scriptingMenu, 0); new queryToolUpdateFactory(menuFactories, scriptingMenu, 0); new queryToolDeleteFactory(menuFactories, scriptingMenu, 0); #ifdef DATABASEDESIGNER new databaseDesignerFactory(menuFactories, toolsMenu, toolBar); #endif viewdataMenuFactory = new submenuFactory(menuFactories); // placeholder where "View data" submenu will be inserted toolsMenu->Append(viewdataMenuFactory->GetId(), _("View &Data"), viewDataMenu, _("View data.")); reportMenuFactory = new submenuFactory(menuFactories); // placeholder where "Reports" submenu will be inserted toolsMenu->Append(reportMenuFactory->GetId(), _("&Reports"), reportMenu, _("Create reports about the selected item.")); new reportObjectPropertiesFactory(menuFactories, reportMenu, 0); new reportObjectDdlFactory(menuFactories, reportMenu, 0); new reportObjectDataDictionaryFactory(menuFactories, reportMenu, 0); new reportObjectStatisticsFactory(menuFactories, reportMenu, 0); new reportObjectDependenciesFactory(menuFactories, reportMenu, 0); new reportObjectDependentsFactory(menuFactories, reportMenu, 0); new reportObjectListFactory(menuFactories, reportMenu, 0); toolsMenu->AppendSeparator(); new editGridLimitedFactory(menuFactories, viewDataMenu, toolBar, 100, true); new editGridLimitedFactory(menuFactories, viewDataMenu, toolBar, 100, false); new editGridFactory(menuFactories, viewDataMenu, toolBar); new editGridFilteredFactory(menuFactories, viewDataMenu, toolBar); new maintenanceFactory(menuFactories, toolsMenu, toolBar); new backupFactory(menuFactories, toolsMenu, 0); new backupGlobalsFactory(menuFactories, toolsMenu, 0); new backupServerFactory(menuFactories, toolsMenu, 0); new restoreFactory(menuFactories, toolsMenu, 0); new importFactory(menuFactories, toolsMenu, 0); new grantWizardFactory(menuFactories, toolsMenu, 0); new mainConfigFactory(menuFactories, cfgMenu, 0); new hbaConfigFactory(menuFactories, cfgMenu, 0); toolsMenu->Append(MNU_CONFIGSUBMENU, _("Server Configuration"), cfgMenu); toolsMenu->AppendSeparator(); new runNowFactory(menuFactories, toolsMenu, 0); toolsMenu->AppendSeparator(); new separatorFactory(menuFactories); new propertyFactory(menuFactories, editMenu, 0); new serverStatusFactory(menuFactories, toolsMenu, 0); // Add the plugin toolbar button/menu new pluginButtonMenuFactory(menuFactories, pluginsMenu, toolBar, pluginUtilityCount); //-------------------------- toolBar->AddSeparator(); actionFactory *helpFact = new contentsFactory(menuFactories, helpMenu, 0); new hintFactory(menuFactories, helpMenu, toolBar, true); new faqFactory(menuFactories, helpMenu, 0); new bugReportFactory(menuFactories, helpMenu, 0); helpMenu->AppendSeparator(); new pgsqlHelpFactory(menuFactories, helpMenu, toolBar, true); if (!appearanceFactory->GetHideEnterprisedbHelp()) new edbHelpFactory(menuFactories, helpMenu, toolBar, true); if (!appearanceFactory->GetHideGreenplumHelp()) new greenplumHelpFactory(menuFactories, helpMenu, toolBar, true); new slonyHelpFactory(menuFactories, helpMenu, toolBar, true); // Don't include this seperator on Mac, because the only option // under it will be moved to the application menu. #ifndef __WXMAC__ helpMenu->AppendSeparator(); #endif actionFactory *abFact = new aboutFactory(menuFactories, helpMenu, 0); #ifdef __WXMAC__ wxApp::s_macPreferencesMenuItemId = optFact->GetId(); wxApp::s_macExitMenuItemId = MNU_EXIT; wxApp::s_macAboutMenuItemId = abFact->GetId(); #else (void)optFact; (void)abFact; #endif menuBar = new wxMenuBar(); menuBar->Append(fileMenu, _("&File")); menuBar->Append(editMenu, _("&Edit")); // Changing the caption of the plugins menu also needs a similar change below menuBar->Append(pluginsMenu, _("&Plugins")); menuBar->Append(viewMenu, _("&View")); menuBar->Append(toolsMenu, _("&Tools")); menuBar->Append(helpMenu, _("&Help")); SetMenuBar(menuBar); // Disable the plugins menu if there aren't any. if (!pluginUtilityCount) { pluginsMenu->Append(MNU_DUMMY, _("No plugins installed")); pluginsMenu->Enable(MNU_DUMMY, false); } treeContextMenu = 0; // Status bar statusBar = CreateStatusBar(3); int iWidths[3] = {0, -1, 100}; SetStatusWidths(3, iWidths); SetStatusBarPane(-1); statusBar->SetStatusText(wxT(""), 0); statusBar->SetStatusText(_("Ready."), 1); statusBar->SetStatusText(_("0 Secs"), 2); wxAcceleratorEntry entries[4]; entries[0].Set(wxACCEL_NORMAL, WXK_F5, refFact->GetId()); entries[1].Set(wxACCEL_NORMAL, WXK_DELETE, MNU_DELETE); entries[2].Set(wxACCEL_NORMAL, WXK_F1, helpFact->GetId()); entries[3].Set(wxACCEL_SHIFT, WXK_F10, MNU_CONTEXTMENU); wxAcceleratorTable accel(4, entries); SetAcceleratorTable(accel); // Display the bar and configure buttons. toolBar->Realize(); }
/* * Private constructor */ wxbMainFrame::wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(NULL, -1, title, pos, size, style) { lockedbyconsole = false; ct = NULL; promptparser = NULL; // set the frame icon SetIcon(wxIcon(wxwin16x16_xpm)); #if wxUSE_MENUS // create a menu bar menuFile = new wxMenu; // the "About" item should be in the help menu wxMenu *helpMenu = new wxMenu; helpMenu->Append(Minimal_About, _("&About...\tF1"), _("Show about dialog")); menuFile->Append(MenuConnect, _("Connect"), _("Connect to the director")); menuFile->Append(MenuDisconnect, _("Disconnect"), _("Disconnect of the director")); menuFile->AppendSeparator(); menuFile->Append(ChangeConfigFile, _("Change of configuration file"), _("Change your default configuration file")); menuFile->Append(EditConfigFile, _("Edit your configuration file"), _("Edit your configuration file")); menuFile->AppendSeparator(); menuFile->Append(Minimal_Quit, _("E&xit\tAlt-X"), _("Quit this program")); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(menuFile, _("&File")); menuBar->Append(helpMenu, _("&Help")); // ... and attach this menu bar to the frame SetMenuBar(menuBar); #endif // wxUSE_MENUS CreateStatusBar(1); SetStatusText(wxString::Format(_("Welcome to bacula bwx-console %s (%s)!\n"), wxT(VERSION), wxT(BDATE))); wxPanel* global = new wxPanel(this, -1); notebook = new wxNotebook(global, -1); /* Console */ wxPanel* consolePanel = new wxPanel(notebook, -1); notebook->AddPage(consolePanel, _("Console")); consoleCtrl = new wxTextCtrl(consolePanel,-1,wxT(""),wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH); wxFont font(10, wxMODERN, wxNORMAL, wxNORMAL); #if defined __WXGTK12__ && !defined __WXGTK20__ // Fix for "chinese" fonts under gtk+ 1.2 font.SetDefaultEncoding(wxFONTENCODING_ISO8859_1); consoleCtrl->SetDefaultStyle(wxTextAttr(*wxBLACK, wxNullColour, font)); Print(_("Warning : Unicode is disabled because you are using wxWidgets for GTK+ 1.2.\n"), CS_DEBUG); #else consoleCtrl->SetDefaultStyle(wxTextAttr(*wxBLACK, wxNullColour, font)); #if (wxUSE_UNICODE == 0) && __WXGTK20__ Print(_("Warning : There is a problem with wxWidgets for GTK+ 2.0 without Unicode support when handling non-ASCII filenames: Every non-ASCII character in such filenames will be replaced by an interrogation mark.\nIf this behaviour disturbs you, please build bwx-console against a Unicode version of wxWidgets for GTK+ 2.0.\n---\n"), CS_DEBUG); #endif #endif helpCtrl = new wxStaticText(consolePanel, -1, _("Type your command below:")); wxFlexGridSizer *consoleSizer = new wxFlexGridSizer(4, 1, 0, 0); consoleSizer->AddGrowableCol(0); consoleSizer->AddGrowableRow(0); typeCtrl = new wxbHistoryTextCtrl(helpCtrl, consolePanel,TypeText,wxT(""),wxDefaultPosition,wxSize(200,20)); sendButton = new wxButton(consolePanel, SendButton, _("Send")); wxFlexGridSizer *typeSizer = new wxFlexGridSizer(1, 2, 0, 0); typeSizer->AddGrowableCol(0); typeSizer->AddGrowableRow(0); //typeSizer->Add(new wxStaticText(consolePanel, -1, _("Command: ")), 0, wxALIGN_CENTER | wxALL, 0); typeSizer->Add(typeCtrl, 1, wxEXPAND | wxALL, 0); typeSizer->Add(sendButton, 1, wxEXPAND | wxLEFT, 5); consoleSizer->Add(consoleCtrl, 1, wxEXPAND | wxALL, 0); consoleSizer->Add(new wxStaticLine(consolePanel, -1), 0, wxEXPAND | wxALL, 0); consoleSizer->Add(helpCtrl, 1, wxEXPAND | wxALL, 2); consoleSizer->Add(typeSizer, 0, wxEXPAND | wxALL, 2); consolePanel->SetAutoLayout( TRUE ); consolePanel->SetSizer( consoleSizer ); consoleSizer->SetSizeHints( consolePanel ); // Creates the list of panels which are included in notebook, and that need to receive director information panels = new wxbPanel* [2]; panels[0] = new wxbRestorePanel(notebook); panels[1] = NULL; for (int i = 0; panels[i] != NULL; i++) { notebook->AddPage(panels[i], panels[i]->GetTitle()); } wxBoxSizer* globalSizer = new wxBoxSizer(wxHORIZONTAL); #if wxCHECK_VERSION(2, 6, 0) globalSizer->Add(notebook, 1, wxEXPAND, 0); #else globalSizer->Add(new wxNotebookSizer(notebook), 1, wxEXPAND, 0); #endif global->SetSizer( globalSizer ); globalSizer->SetSizeHints( global ); wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(global, 1, wxEXPAND | wxALL, 0); SetAutoLayout(true); SetSizer( sizer ); sizer->SetSizeHints( this ); this->SetSize(size); EnableConsole(false); consoleBuffer = wxT(""); configfile = wxT(""); }
// frame constructor VizFrame::VizFrame(const wxString& title, wxPoint pnt, wxSize size, MyApp *parent) : wxFrame(NULL, wxID_ANY, title, pnt, size) { page1 = NULL; traceWiz = NULL; parentApp = parent; tbThread = NULL; #ifdef _WIN32 idaServer = NULL; #endif textSearchIsCleared = false; animationTimer = NULL; // This is for the "tabbed" view at the top of the application noteBook = new wxNotebook(this, wxID_ANY, pnt, size, wxNB_TOP); if (noteBook == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } // Start with the veraPane null and just display a text label veraPane = NULL; wxRichTextCtrl *introMessage = new wxRichTextCtrl( noteBook, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, 200), wxNO_BORDER|wxWANTS_CHARS|wxRE_READONLY|wxRE_CENTER_CARET); introMessage->BeginAlignment(wxTEXT_ALIGNMENT_CENTER); introMessage->BeginBold(); introMessage->BeginFontSize(50); introMessage->Newline(); introMessage->Newline(); introMessage->WriteText(wxT("Welcome to VERA v" __VERA_VERSION__)); introMessage->EndFontSize(); introMessage->EndBold(); introMessage->Newline(); introMessage->EndAlignment(); // First page to be displayed. noteBook->AddPage(introMessage, wxT("Visualization")); // Create the File Menu wxMenu *fileMenu = new wxMenu; if (fileMenu == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } // File Menu Items fileMenu->Append(Vera_Open, wxT("&Open\tCtrl-O"), wxT("Open a GML file")); fileMenu->Append(Vera_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); // Create the tools menu wxMenu *toolsMenu = new wxMenu; if (toolsMenu == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } #ifdef _WIN32 toolsMenu->Append(Vera_ConnectToIDA, wxT("Start &IDA Server\tCtrl-I"), wxT("Start IDA Pro connection")); #endif toolsMenu->Append(wxID_PROPERTIES, wxT("O&ptions"), wxT("Open Options and Configuration")); // Create the Help Menu wxMenu *helpMenu = new wxMenu; if (helpMenu == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } // Help Menu Items helpMenu->Append(Vera_Help, wxT("&Help\tF1"), wxT("Show help document")); helpMenu->Append(Vera_About, wxT("&About..."), wxT("Show about dialog")); helpMenu->Append(Vera_Check_Updates, wxT("&Updates"), wxT("Check for updates")); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); if (menuBar == NULL) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(toolsMenu, wxT("&Tools")); menuBar->Append(helpMenu, wxT("&Help")); // ... and attach this menu bar to the frame SetMenuBar(menuBar); // Create the Tool Bar // Open, IDA, Configuration, Search for Address toolBar = new wxToolBar(this, wxID_ANY); if (NULL == toolBar) { wxLogDebug(wxString::Format(wxT("Could not allocate memory: %s:%u"), __FILE__, __LINE__)); return; } // Icons for the toolBar bmpOpen = new wxBitmap(folder_32_xpm); bmpConfig = new wxBitmap(gear_32_xpm); bmpHelp = new wxBitmap(help_32_xpm); bmpFind = new wxBitmap(find_xpm); bmpHome = new wxBitmap(home_xpm); bmpRewind = new wxBitmap(rewind_xpm); bmpPlay = new wxBitmap(play_xpm); bmpFastForward = new wxBitmap(fastforward_xpm); bmpStop = new wxBitmap(stop_xpm); #ifdef _WIN32 // IDA integration is only working in Windows at the moment bmpIda = new wxBitmap(ida_32_xpm); #endif //bmpEther = new wxBitmap(ether_32_xpm); textSearch = NULL; // This is initialized in SetVeraToolbar to give the search box the right toolbar base // Call the code to add the toolbar SetVeraToolbar(toolBar); CreateStatusBar(2); SetStatusText(wxT("Ready")); }
// My frame constructor MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) : wxFrame((wxFrame *)NULL, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)), m_treeCtrl(NULL) #if wxUSE_LOG , m_textCtrl(NULL) #endif // wxUSE_LOG { // This reduces flicker effects - even better would be to define // OnEraseBackground to do nothing. When the tree control's scrollbars are // show or hidden, the frame is sent a background erase event. SetBackgroundColour(wxColour(255, 255, 255)); // Give it an icon SetIcon(wxICON(mondrian)); #if wxUSE_MENUS // Make a menubar wxMenu *file_menu = new wxMenu, *style_menu = new wxMenu, *tree_menu = new wxMenu, *item_menu = new wxMenu; file_menu->Append(TreeTest_About, wxT("&About...")); file_menu->AppendSeparator(); file_menu->Append(TreeTest_Quit, wxT("E&xit\tAlt-X")); style_menu->AppendCheckItem(TreeTest_TogButtons, wxT("Toggle &normal buttons")); style_menu->AppendCheckItem(TreeTest_TogTwist, wxT("Toggle &twister buttons")); style_menu->AppendCheckItem(TreeTest_ToggleButtons, wxT("Toggle image &buttons")); style_menu->AppendSeparator(); style_menu->AppendCheckItem(TreeTest_TogLines, wxT("Toggle &connecting lines")); style_menu->AppendCheckItem(TreeTest_TogRootLines, wxT("Toggle &lines at root")); style_menu->AppendCheckItem(TreeTest_TogHideRoot, wxT("Toggle &hidden root")); style_menu->AppendCheckItem(TreeTest_TogBorder, wxT("Toggle &item border")); style_menu->AppendCheckItem(TreeTest_TogFullHighlight, wxT("Toggle &full row highlight")); style_menu->AppendCheckItem(TreeTest_TogEdit, wxT("Toggle &edit mode")); #ifndef NO_MULTIPLE_SELECTION style_menu->AppendCheckItem(TreeTest_ToggleSel, wxT("Toggle &selection mode")); #endif // NO_MULTIPLE_SELECTION style_menu->AppendCheckItem(TreeTest_ToggleImages, wxT("Toggle show ima&ges")); style_menu->Append(TreeTest_SetImageSize, wxT("Set image si&ze...")); style_menu->AppendSeparator(); style_menu->Append(TreeTest_SetFgColour, wxT("Set &foreground colour...")); style_menu->Append(TreeTest_SetBgColour, wxT("Set &background colour...")); style_menu->AppendSeparator(); style_menu->Append(TreeTest_ResetStyle, wxT("&Reset to default\tF10")); tree_menu->Append(TreeTest_Recreate, wxT("&Recreate the tree")); tree_menu->Append(TreeTest_CollapseAndReset, wxT("C&ollapse and reset")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_AddItem, wxT("Append a &new item")); tree_menu->Append(TreeTest_InsertItem, wxT("&Insert a new item")); tree_menu->Append(TreeTest_Delete, wxT("&Delete this item")); tree_menu->Append(TreeTest_DeleteChildren, wxT("Delete &children")); tree_menu->Append(TreeTest_DeleteAll, wxT("Delete &all items")); tree_menu->Append(TreeTest_SelectRoot, wxT("Select root item")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_Count, wxT("Count children of current item")); tree_menu->Append(TreeTest_CountRec, wxT("Recursively count children of current item")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_Sort, wxT("Sort children of current item")); tree_menu->Append(TreeTest_SortRev, wxT("Sort in reversed order")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_EnsureVisible, wxT("Make the last item &visible")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_IncIndent, wxT("Add 5 points to indentation\tAlt-I")); tree_menu->Append(TreeTest_DecIndent, wxT("Reduce indentation by 5 points\tAlt-R")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_IncSpacing, wxT("Add 5 points to spacing\tCtrl-I")); tree_menu->Append(TreeTest_DecSpacing, wxT("Reduce spacing by 5 points\tCtrl-R")); item_menu->Append(TreeTest_Dump, wxT("&Dump item children")); item_menu->Append(TreeTest_Rename, wxT("&Rename item...")); item_menu->AppendSeparator(); item_menu->Append(TreeTest_SetBold, wxT("Make item &bold")); item_menu->Append(TreeTest_ClearBold, wxT("Make item ¬ bold")); item_menu->AppendSeparator(); item_menu->Append(TreeTest_ToggleIcon, wxT("Toggle the item's &icon")); #ifndef NO_MULTIPLE_SELECTION item_menu->AppendSeparator(); item_menu->Append(TreeTest_DumpSelected, wxT("Dump selected items\tAlt-D")); item_menu->Append(TreeTest_Select, wxT("Select current item\tAlt-S")); item_menu->Append(TreeTest_Unselect, wxT("Unselect everything\tAlt-U")); #endif // NO_MULTIPLE_SELECTION wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(style_menu, wxT("&Style")); menu_bar->Append(tree_menu, wxT("&Tree")); menu_bar->Append(item_menu, wxT("&Item")); SetMenuBar(menu_bar); #endif // wxUSE_MENUS #if wxUSE_LOG // create the controls m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSUNKEN_BORDER); #endif // wxUSE_LOG CreateTreeWithDefStyle(); menu_bar->Check(TreeTest_ToggleImages, true); #if wxUSE_STATUSBAR // create a status bar CreateStatusBar(2); #endif // wxUSE_STATUSBAR #if wxUSE_LOG #ifdef __WXMOTIF__ // For some reason, we get a memcpy crash in wxLogStream::DoLogStream // on gcc/wxMotif, if we use wxLogTextCtl. Maybe it's just gcc? delete wxLog::SetActiveTarget(new wxLogStderr); #else // set our text control as the log target wxLogTextCtrl *logWindow = new wxLogTextCtrl(m_textCtrl); delete wxLog::SetActiveTarget(logWindow); #endif #endif // wxUSE_LOG }
static void mac_startup(void) { Handle menuBar; TECInfoHandle ti; #if !TARGET_API_MAC_CARBON /* Init Memory Manager */ MaxApplZone(); /* Init QuickDraw */ InitGraf(&qd.thePort); /* Init Font Manager */ InitFonts(); /* Init Window Manager */ InitWindows(); /* Init Menu Manager */ InitMenus(); /* Init TextEdit */ TEInit(); /* Init Dialog Manager */ InitDialogs(NULL); #endif /* Get base system version (only used if there's no better selector) */ if (Gestalt(gestaltSystemVersion, &mac_gestalts.sysvers) != noErr || (mac_gestalts.sysvers &= 0xffff) < 0x700) fatalbox("PuTTYgen requires System 7 or newer"); /* Find out if we've got Color Quickdraw */ if (Gestalt(gestaltQuickdrawVersion, &mac_gestalts.qdvers) != noErr) mac_gestalts.qdvers = gestaltOriginalQD; /* ... and the Appearance Manager? */ if (Gestalt(gestaltAppearanceVersion, &mac_gestalts.apprvers) != noErr) if (Gestalt(gestaltAppearanceAttr, NULL) == noErr) mac_gestalts.apprvers = 0x0100; else mac_gestalts.apprvers = 0; #if TARGET_RT_MAC_CFM /* Paranoia: Did we manage to pull in AppearanceLib? */ if (&RegisterAppearanceClient == kUnresolvedCFragSymbolAddress) mac_gestalts.apprvers = 0; #endif #if TARGET_CPU_68K mac_gestalts.cntlattr = 0; mac_gestalts.windattr = 0; #else /* Mac OS 8.5 Control Manager (proportional scrollbars)? */ if (Gestalt(gestaltControlMgrAttr, &mac_gestalts.cntlattr) != noErr || &SetControlViewSize == kUnresolvedCFragSymbolAddress) mac_gestalts.cntlattr = 0; /* Mac OS 8.5 Window Manager? */ if (Gestalt(gestaltWindowMgrAttr, &mac_gestalts.windattr) != noErr || &SetWindowContentColor == kUnresolvedCFragSymbolAddress) mac_gestalts.windattr = 0; #endif /* Text Encoding Conversion Manager? */ if ( #if TARGET_RT_MAC_CFM &TECGetInfo == kUnresolvedCFragSymbolAddress || #else InitializeUnicodeConverter(NULL) != noErr || #endif TECGetInfo(&ti) != noErr) mac_gestalts.encvvers = 0; else { mac_gestalts.encvvers = (*ti)->tecVersion; mac_gestalts.uncvattr = (*ti)->tecUnicodeConverterFeatures; DisposeHandle((Handle)ti); } /* Navigation Services? */ if (NavServicesAvailable()) mac_gestalts.navsvers = NavLibraryVersion(); else mac_gestalts.navsvers = 0; /* We've been tested with the Appearance Manager */ if (mac_gestalts.apprvers != 0) RegisterAppearanceClient(); menuBar = GetNewMBar(128); if (menuBar == NULL) fatalbox("Unable to create menu bar."); SetMenuBar(menuBar); AppendResMenu(GetMenuHandle(mApple), 'DRVR'); mac_adjustmenus(); DrawMenuBar(); InitCursor(); windows.about = NULL; windows.licence = NULL; flags = FLAG_INTERACTIVE; /* Install Apple Event handlers. */ #if 0 AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, NewAEEventHandlerUPP(&mac_aevt_oapp), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(&mac_aevt_odoc), 0, FALSE); AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, NewAEEventHandlerUPP(&mac_aevt_pdoc), 0, FALSE); #endif AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP(&mac_aevt_quit), 0, FALSE); }
MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const wxSize&size) : wxFrame(frame, wxID_ANY, title, pos, size) { m_canvas = NULL; m_previewModality = wxPreviewFrame_AppModal; #if wxUSE_STATUSBAR // Give us a status line CreateStatusBar(2); SetStatusText(wxT("Printing demo")); #endif // wxUSE_STATUSBAR // Load icon and bitmap SetIcon( wxICON( sample) ); // Make a menubar wxMenu *file_menu = new wxMenu; file_menu->Append(wxID_PRINT, wxT("&Print..."), wxT("Print")); file_menu->Append(WXPRINT_PAGE_SETUP, wxT("Page Set&up..."), wxT("Page setup")); #ifdef __WXMAC__ file_menu->Append(WXPRINT_PAGE_MARGINS, wxT("Page Margins..."), wxT("Page margins")); #endif file_menu->Append(wxID_PREVIEW, wxT("Print Pre&view"), wxT("Preview")); wxMenu * const menuModalKind = new wxMenu; menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_APP, "&App modal"); menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_WIN, "&Window modal"); menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_NON, "&Not modal"); file_menu->AppendSubMenu(menuModalKind, "Preview frame &modal kind"); #if wxUSE_ACCEL // Accelerators wxAcceleratorEntry entries[1]; entries[0].Set(wxACCEL_CTRL, (int) 'V', wxID_PREVIEW); wxAcceleratorTable accel(1, entries); SetAcceleratorTable(accel); #endif #if defined(__WXMSW__) &&wxTEST_POSTSCRIPT_IN_MSW file_menu->AppendSeparator(); file_menu->Append(WXPRINT_PRINT_PS, wxT("Print PostScript..."), wxT("Print (PostScript)")); file_menu->Append(WXPRINT_PAGE_SETUP_PS, wxT("Page Setup PostScript..."), wxT("Page setup (PostScript)")); file_menu->Append(WXPRINT_PREVIEW_PS, wxT("Print Preview PostScript"), wxT("Preview (PostScript)")); #endif file_menu->AppendSeparator(); file_menu->Append(WXPRINT_ANGLEUP, wxT("Angle up\tAlt-U"), wxT("Raise rotated text angle")); file_menu->Append(WXPRINT_ANGLEDOWN, wxT("Angle down\tAlt-D"), wxT("Lower rotated text angle")); file_menu->AppendSeparator(); file_menu->Append(wxID_EXIT, wxT("E&xit"), wxT("Exit program")); wxMenu *help_menu = new wxMenu; help_menu->Append(wxID_ABOUT, wxT("&About"), wxT("About this demo")); wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(help_menu, wxT("&Help")); // Associate the menu bar with the frame SetMenuBar(menu_bar); // create the canvas // ----------------- m_canvas = new MyCanvas(this, wxPoint(0, 0), wxSize(100, 100), wxRETAINED|wxHSCROLL|wxVSCROLL); // Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction m_canvas->SetScrollbars(20, 20, 50, 50); }
// ------------------------------------------------------------------------ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER) ) , m_statusbar( *CreateStatusBar(2, 0) ) , m_background( this, wxID_ANY, wxGetApp().GetLogoBitmap() ) // All menu components must be created on the heap! , m_menubar( *new wxMenuBar() ) , m_menuCDVD ( *new wxMenu() ) , m_menuSys ( *new wxMenu() ) , m_menuConfig ( *new wxMenu() ) , m_menuMisc ( *new wxMenu() ) , m_menuDebug ( *new wxMenu() ) , m_LoadStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Load01, MenuId_State_LoadBackup ) ) , m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) ) , m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, _("&Show Console"), wxEmptyString, wxITEM_CHECK ) ) , m_MenuItem_Console_Stdio( *new wxMenuItem( &m_menuMisc, MenuId_Console_Stdio, _("&Console to Stdio"), wxEmptyString, wxITEM_CHECK ) ) { m_RestartEmuOnDelete = false; for( int i=0; i<PluginId_Count; ++i ) m_PluginMenuPacks[i].Populate( (PluginsEnum_t)i ); // ------------------------------------------------------------------------ // Initial menubar setup. This needs to be done first so that the menu bar's visible size // can be factored into the window size (which ends up being background+status+menus) //m_menubar.Append( &m_menuBoot, _("&Boot") ); m_menubar.Append( &m_menuSys, _("&System") ); m_menubar.Append( &m_menuCDVD, _("CD&VD") ); m_menubar.Append( &m_menuConfig, _("&Config") ); m_menubar.Append( &m_menuMisc, _("&Misc") ); m_menubar.Append( &m_menuDebug, _("&Debug") ); SetMenuBar( &m_menubar ); // ------------------------------------------------------------------------ // The background logo and its window size are different on Windows. Use the // background logo size, which is what it'll eventually be resized to. wxSize backsize(m_background.GetBitmap().GetWidth(), m_background.GetBitmap().GetHeight()); wxString wintitle; if( PCSX2_isReleaseVersion ) { // stable releases, with a simple title. wintitle.Printf( L"%s %d.%d.%d", pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo ); } else { // beta / development editions, which feature revision number and compile date. #ifndef DISABLE_BUILD_DATE wintitle.Printf( L"%s %d.%d.%d-%lld%s (git) %s", pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_REV, SVN_MODS ? L"m" : wxEmptyString, fromUTF8(__DATE__).c_str() ); #else wintitle.Printf( L"%s %d.%d.%d-%lld%s (git)", pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_REV, SVN_MODS ? L"m" : wxEmptyString ); #endif } SetTitle( wintitle ); // Ideally the __WXMSW__ port should use the embedded IDI_ICON2 icon, because wxWidgets sucks and // loses the transparency information when loading bitmaps into icons. But for some reason // I cannot get it to work despite following various examples to the letter. SetIcons( wxGetApp().GetIconBundle() ); int m_statusbar_widths[] = { (int)(backsize.GetWidth()*0.73), (int)(backsize.GetWidth()*0.25) }; m_statusbar.SetStatusWidths(2, m_statusbar_widths); //m_statusbar.SetStatusText( L"The Status is Good!", 0); m_statusbar.SetStatusText( wxEmptyString, 0); wxBoxSizer& joe( *new wxBoxSizer( wxVERTICAL ) ); joe.Add( &m_background ); SetSizerAndFit( &joe ); // Makes no sense, but this is needed for the window size to be correct for // 200% DPI on Windows. The SetSizerAndFit is supposed to be doing the exact // same thing. GetSizer()->SetSizeHints(this); // Use default window position if the configured windowpos is invalid (partially offscreen) if( g_Conf->MainGuiPosition == wxDefaultPosition || !pxIsValidWindowPosition( *this, g_Conf->MainGuiPosition) ) g_Conf->MainGuiPosition = GetScreenPosition(); else SetPosition( g_Conf->MainGuiPosition ); // Updating console log positions after the main window has been fitted to its sizer ensures // proper docked positioning, since the main window's size is invalid until after the sizer // has been set/fit. InitLogBoxPosition( g_Conf->ProgLogBox ); // ------------------------------------------------------------------------ // Some of the items in the System menu are configured by the UpdateCoreStatus() method. m_menuSys.Append(MenuId_Boot_CDVD, _("Initializing...")); m_menuSys.Append(MenuId_Boot_CDVD2, _("Initializing...")); m_menuSys.Append(MenuId_Boot_ELF, _("&Run ELF..."), _("For running raw PS2 binaries directly")); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_Sys_SuspendResume, _("Initializing...")); m_menuSys.AppendSeparator(); //m_menuSys.Append(MenuId_Sys_Close, _("Close"), // _("Stops emulation and closes the GS window.")); m_menuSys.Append(MenuId_Sys_LoadStates, _("&Load state"), &m_LoadStatesSubmenu); m_menuSys.Append(MenuId_Sys_SaveStates, _("&Save state"), &m_SaveStatesSubmenu); m_menuSys.Append(MenuId_EnableBackupStates, _("&Backup before save"), wxEmptyString, wxITEM_CHECK); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_EnablePatches, _("Automatic &Gamefixes"), _("Automatically applies needed Gamefixes to known problematic games"), wxITEM_CHECK); m_menuSys.Append(MenuId_EnableCheats, _("Enable &Cheats"), wxEmptyString, wxITEM_CHECK); m_menuSys.Append(MenuId_EnableWideScreenPatches, _("Enable &Widescreen Patches"), wxEmptyString, wxITEM_CHECK); m_menuSys.Append(MenuId_EnableHostFs, _("Enable &Host Filesystem"), wxEmptyString, wxITEM_CHECK); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_Sys_Shutdown, _("Shut&down"), _("Wipes all internal VM states and shuts down plugins.")); m_menuSys.Append(MenuId_Exit, _("E&xit"), AddAppName(_("Closing %s may be hazardous to your health"))); // ------------------------------------------------------------------------ wxMenu& isoRecents( wxGetApp().GetRecentIsoMenu() ); //m_menuCDVD.AppendSeparator(); m_menuCDVD.Append( MenuId_IsoSelector, _("Iso &Selector"), &isoRecents ); m_menuCDVD.Append( GetPluginMenuId_Settings(PluginId_CDVD), _("Plugin &Menu"), m_PluginMenuPacks[PluginId_CDVD] ); m_menuCDVD.AppendSeparator(); m_menuCDVD.Append( MenuId_Src_Iso, _("&Iso"), _("Makes the specified ISO image the CDVD source."), wxITEM_RADIO ); m_menuCDVD.Append( MenuId_Src_Plugin, _("&Plugin"), _("Uses an external plugin as the CDVD source."), wxITEM_RADIO ); m_menuCDVD.Append( MenuId_Src_NoDisc, _("&No disc"), _("Use this to boot into your virtual PS2's BIOS configuration."), wxITEM_RADIO ); //m_menuCDVD.AppendSeparator(); //m_menuCDVD.Append( MenuId_SkipBiosToggle,_("Enable BOOT2 injection"), // _("Skips PS2 splash screens when booting from Iso or DVD media"), wxITEM_CHECK ); // ------------------------------------------------------------------------ m_menuConfig.Append(MenuId_Config_SysSettings, _("Emulation &Settings") ); m_menuConfig.Append(MenuId_Config_McdSettings, _("&Memory cards") ); m_menuConfig.Append(MenuId_Config_BIOS, _("&Plugin/BIOS Selector") ); if (IsDebugBuild) m_menuConfig.Append(MenuId_Config_GameDatabase, _("&Game Database Editor") ); // Empty menu // m_menuConfig.Append(MenuId_Config_Language, _("Appearance...") ); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_GS, _("&Video (GS)"), m_PluginMenuPacks[PluginId_GS]); m_menuConfig.Append(MenuId_Config_SPU2, _("&Audio (SPU2)"), m_PluginMenuPacks[PluginId_SPU2]); m_menuConfig.Append(MenuId_Config_PAD, _("&Controllers (PAD)"),m_PluginMenuPacks[PluginId_PAD]); m_menuConfig.Append(MenuId_Config_DEV9, _("&Dev9"), m_PluginMenuPacks[PluginId_DEV9]); m_menuConfig.Append(MenuId_Config_USB, _("&USB"), m_PluginMenuPacks[PluginId_USB]); m_menuConfig.Append(MenuId_Config_FireWire, _("&Firewire"), m_PluginMenuPacks[PluginId_FW]); //m_menuConfig.AppendSeparator(); //m_menuConfig.Append(MenuId_Config_Patches, _("Patches (unimplemented)"), wxEmptyString); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_Multitap0Toggle, _("Multitap &1"), wxEmptyString, wxITEM_CHECK ); m_menuConfig.Append(MenuId_Config_Multitap1Toggle, _("Multitap &2"), wxEmptyString, wxITEM_CHECK ); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_ResetAll, _("C&lear all settings..."), AddAppName(_("Clears all %s settings and re-runs the startup wizard."))); // ------------------------------------------------------------------------ m_menuMisc.Append( &m_MenuItem_Console ); #if defined(__unix__) m_menuMisc.Append( &m_MenuItem_Console_Stdio ); #endif //Todo: Though not many people need this one :p //m_menuMisc.Append(MenuId_Profiler, _("Show Profiler"), wxEmptyString, wxITEM_CHECK); //m_menuMisc.AppendSeparator(); // No dialogs implemented for these yet... //m_menuMisc.Append(41, "Patch Browser...", wxEmptyString, wxITEM_NORMAL); //m_menuMisc.Append(42, "Patch Finder...", wxEmptyString, wxITEM_NORMAL); m_menuMisc.AppendSeparator(); //Todo: //There's a great working "open website" in the about panel. Less clutter by just using that. //m_menuMisc.Append(MenuId_Website, _("Visit Website..."), // _("Opens your web-browser to our favorite website.")); m_menuMisc.Append(MenuId_About, _("&About...") ); m_menuMisc.AppendSeparator(); m_menuMisc.Append( MenuId_ChangeLang, L"Change &Language" ); // Always in English m_menuDebug.Append(MenuId_Debug_Open, _("&Open Debug Window..."), wxEmptyString); #ifdef PCSX2_DEVBUILD m_menuDebug.Append(MenuId_Debug_Logging, _("&Logging..."), wxEmptyString); #endif m_MenuItem_Console.Check( g_Conf->ProgLogBox.Visible ); ConnectMenus(); Connect( wxEVT_MOVE, wxMoveEventHandler (MainEmuFrame::OnMoveAround) ); Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler (MainEmuFrame::OnCloseWindow) ); Connect( wxEVT_SET_FOCUS, wxFocusEventHandler (MainEmuFrame::OnFocus) ); Connect( wxEVT_ACTIVATE, wxActivateEventHandler (MainEmuFrame::OnActivate) ); PushEventHandler( &wxGetApp().GetRecentIsoManager() ); SetDropTarget( new IsoDropTarget( this ) ); ApplyCoreStatus(); ApplySettings(); AppendKeycodeNamesToMenuOptions(); }
void WXGL_IO_Frame::CreateMenus() { // Make the FILE MENU wxMenu* fileMenu = new wxMenu; fileMenu->Append(MENU_ID_FILE_OPEN, _T("&Open"), _T("Open a configuration file for this utility") ); fileMenu->Append(MENU_ID_FILE_SAVE, _T("&Save"), _T("Save current configuration for this utility") ); fileMenu->Append(MENU_ID_FILE_SAVEAS, _T("Save &As"), _T("Save current configuration for this utility") ); fileMenu->AppendSeparator(); fileMenu->Append(MENU_ID_FILE_READ, _T("&Read"), _T("Read current values from the controller") ); fileMenu->Append(MENU_ID_FILE_WRITE, _T("&Write"), _T("Write current values to the controller") ); fileMenu->AppendSeparator(); fileMenu->Append(MENU_ID_FILE_EXIT, MENU_TXT_FILE_EXIT, _T("Exits the utility") ); // make the PARAMETER MENU wxMenu* paramMenu = new wxMenu; paramMenu->Append(MENU_ID_PARAM_ROWS, _T("&Rows"), _T("Sets the number of rows the test image") ); paramMenu->Append(MENU_ID_PARAM_COLS, _T("&Cols"), _T("Sets the number of columns the test image") ); // make the TYPE MENU wxMenu* typeMenu = new wxMenu; typeMenu->Append(MENU_ID_EXT_BMP, _T("&BMP"), _T("Sets the test image type to .BMP") ); typeMenu->Append(MENU_ID_EXT_JPG, _T("&JPG"), _T("Sets the test image type to .JPG") ); typeMenu->Append(MENU_ID_EXT_PNG, _T("&PNG"), _T("Sets the test image type to .PNG") ); typeMenu->Append(MENU_ID_EXT_TIF, _T("&TIF"), _T("Sets the test image type to .TIF") ); // make the IMAGE MENU wxMenu* imageMenu = new wxMenu; imageMenu->Append(MENU_ID_IMAGE_BINARY, _T("&Binary"), _T("Sets the test image raster to Binary") ); imageMenu->Append(MENU_ID_IMAGE_GRAY_F, _T("&FloatGray"), _T("Sets the test image raster to Floating Grayscale") ); imageMenu->Append(MENU_ID_IMAGE_GRAY, _T("&Gray"), _T("Sets the test image raster to Grayscale") ); imageMenu->Append(MENU_ID_IMAGE_RGBA, _T("&RGBa"), _T("Sets the test image raster to RGBa") ); // make the HELP MENU wxMenu* helpMenu = new wxMenu; helpMenu->Append(MENU_ID_HELP_HELP, _T("&Help Contents"), _T("Displays information about running this utility") ); helpMenu->Append(MENU_ID_HELP_ABOUT, _T("&About..."), _T("Displays information about the Alignment and Linearization utility") ); // make the menu bar mp_menuBar = new wxMenuBar; mp_menuBar->Append(fileMenu, _T("&File")); mp_menuBar->Append(paramMenu, _T("&Params")); mp_menuBar->Append(typeMenu, _T("&Type")); mp_menuBar->Append(imageMenu, _T("&Image")); mp_menuBar->Append(helpMenu, _T("&Help")); SetMenuBar(mp_menuBar); }
frmDatabaseDesigner::frmDatabaseDesigner(frmMain *form, const wxString &_title, pgConn *conn) : pgFrame(NULL, _title) { mainForm = form; SetTitle(wxT("Database Designer")); SetIcon(wxIcon(*ddmodel_32_png_ico)); loading = true; closing = false; RestorePosition(100, 100, 600, 500, 450, 300); SetMinSize(wxSize(450, 300)); // connection connection = conn; // notify wxAUI which frame to use manager.SetManagedWindow(this); manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_TRANSPARENT_DRAG); wxWindowBase::SetFont(settings->GetSystemFont()); // Set File menu fileMenu = new wxMenu(); fileMenu->Append(MNU_NEW, _("&New database design\tCtrl-N"), _("Create a new database design")); fileMenu->AppendSeparator(); fileMenu->Append(MNU_LOADMODEL, _("&Open Model..."), _("Open an existing database design from a file")); fileMenu->Append(MNU_SAVEMODEL, _("&Save Model"), _("Save changes at database design")); fileMenu->Append(MNU_SAVEMODELAS, _("&Save Model As..."), _("Save database design at new file")); fileMenu->AppendSeparator(); fileMenu->Append(CTL_IMPSCHEMA, _("&Import Tables..."), _("Import tables from database schema to database designer model")); fileMenu->AppendSeparator(); fileMenu->Append(MNU_EXIT, _("E&xit\tCtrl-W"), _("Exit database designer window")); // Set Diagram menu diagramMenu = new wxMenu(); diagramMenu->Append(MNU_NEWDIAGRAM, _("&New model diagram"), _("Create a new diagram")); diagramMenu->Append(MNU_DELDIAGRAM, _("&Delete selected model diagram..."), _("Delete selected diagram")); diagramMenu->Append(MNU_RENDIAGRAM, _("&Rename selected model diagram..."), _("Rename selected diagram")); // Set View menu viewMenu = new wxMenu(); viewMenu->AppendCheckItem(MNU_TOGGLEMBROWSER, _("&Model Browser"), _("Show / Hide Model Browser Window")); viewMenu->AppendCheckItem(MNU_TOGGLEDDSQL, _("&SQL Window"), _("Show / Hide SQL Window")); viewMenu->Check(MNU_TOGGLEDDSQL, true); viewMenu->Check(MNU_TOGGLEMBROWSER, true); // Set Help menu helpMenu = new wxMenu(); helpMenu->Append(MNU_CONTENTS, _("&Help"), _("Open the helpfile.")); helpMenu->Append(MNU_HELP, _("&SQL Help\tF1"), _("Display help on SQL commands.")); // Set menu bar menuBar = new wxMenuBar(); menuBar->Append(fileMenu, _("&File")); menuBar->Append(diagramMenu, _("&Diagram")); menuBar->Append(viewMenu, _("&View")); menuBar->Append(helpMenu, _("&Help")); SetMenuBar(menuBar); // Set status bar int iWidths[6] = {0, -1, 40, 150, 80, 80}; CreateStatusBar(6); SetStatusBarPane(-1); SetStatusWidths(6, iWidths); // Set toolbar toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER); toolBar->SetToolBitmapSize(wxSize(16, 16)); toolBar->AddTool(MNU_NEW, _("New Model"), *file_new_png_bmp, _("Create new model"), wxITEM_NORMAL); toolBar->AddTool(MNU_NEWDIAGRAM, _("New Diagram"), *ddnewdiagram_png_bmp, _("Add new diagram"), wxITEM_NORMAL); toolBar->AddSeparator(); toolBar->AddTool(MNU_LOADMODEL, _("Open Model"), *file_open_png_bmp, _("Open existing model"), wxITEM_NORMAL); toolBar->AddTool(MNU_SAVEMODEL, _("Save Model"), *file_save_png_bmp, _("Save current model"), wxITEM_NORMAL); toolBar->AddSeparator(); toolBar->AddTool(MNU_ADDTABLE, _("Add Table"), *table_png_bmp, _("Add empty table to the current model"), wxITEM_NORMAL); toolBar->AddTool(MNU_DELETETABLE, _("Delete Table"), wxBitmap(*ddRemoveTable2_png_img), _("Delete selected table"), wxITEM_NORMAL); toolBar->AddTool(MNU_ADDCOLUMN, _("Add Column"), *table_png_bmp, _("Add new column to the selected table"), wxITEM_NORMAL); toolBar->AddSeparator(); toolBar->AddTool(MNU_GENERATEMODEL, _("Generate Model"), *continue_png_bmp, _("Generate SQL for the current model"), wxITEM_NORMAL); toolBar->AddTool(MNU_GENERATEDIAGRAM, _("Generate Diagram"), *ddgendiagram_png_bmp, _("Generate SQL for the current diagram"), wxITEM_NORMAL); toolBar->AddSeparator(); toolBar->AddTool(CTL_IMPSCHEMA, _("Import Tables from database..."), *conversion_png_ico, _("Import tables from database schema to database designer model"), wxITEM_NORMAL); toolBar->AddSeparator(); toolBar->AddTool(MNU_HELP, _("Help"), *help_png_bmp, _("Display help"), wxITEM_NORMAL); toolBar->Realize(); // Create notebook for diagrams diagrams = new ctlAuiNotebook(this, CTL_DDNOTEBOOK, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_CLOSE_ON_ALL_TABS); // Now, the scratchpad sqltext = new ctlSQLBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSIMPLE_BORDER | wxTE_RICH2); //Now, the Objects Browser wxSizer *browserSizer = new wxBoxSizer(wxHORIZONTAL); browserPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); // Add the database designer design = new ddDatabaseDesign(diagrams, this); // Create database model browser modelBrowser = new ddModelBrowser(browserPanel, DD_BROWSER, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxSIMPLE_BORDER, design); design->registerBrowser(modelBrowser); // Set browser Sizers browserSizer->Add(modelBrowser, 1, wxEXPAND); browserPanel->SetSizer(browserSizer); browserSizer->SetSizeHints(browserPanel); // Add view to notebook diagrams->AddPage(design->createDiagram(diagrams, _("unnamed"), false)->getView(), _("unnamed")); // Add the database selection bar and schema selector wxSizer *connectionSizer = new wxBoxSizer(wxHORIZONTAL); connectionPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, -1)); cbConnection = new wxBitmapComboBox(connectionPanel, CTL_DDCONNECTION, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), wxArrayString(), wxCB_READONLY | wxCB_DROPDOWN); if(conn) cbConnection->Append(conn->GetName(), CreateBitmap(GetServerColour(conn)), (void *)conn); cbConnection->Append(_("<new connection>"), wxNullBitmap, (void *) NULL); connectionSizer->Add(cbConnection, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1); connectionSizer->AddSpacer(5); connectionPanel->SetSizer(connectionSizer); connectionSizer->SetSizeHints(connectionPanel); // Add the panes manager.AddPane(diagrams, wxAuiPaneInfo().Center(). Name(wxT("sqlQuery")).Caption(_("Database Designer")). CaptionVisible(true).CloseButton(false).MaximizeButton(true). Dockable(true).Movable(true)); manager.AddPane(browserPanel, wxAuiPaneInfo().Left(). Name(wxT("ModelBrowser")).Caption(_("Model Browser")). CaptionVisible(true).CloseButton(true).MinimizeButton(true). MinSize(wxSize(140, 100)).BestSize(wxSize(200, 200))); manager.AddPane(sqltext, wxAuiPaneInfo().Bottom(). Name(wxT("sqlText")).Caption(_("SQL query")). CaptionVisible(true).CloseButton(true).MaximizeButton(true).MinimizeButton(true). MinSize(wxSize(200, 100)).BestSize(wxSize(350, 150))); manager.AddPane(toolBar, wxAuiPaneInfo().Top(). Name(wxT("toolBar")).Caption(_("Tool bar")). ToolbarPane(). LeftDockable(false).RightDockable(false)); manager.AddPane(connectionPanel, wxAuiPaneInfo().Name(wxT("databaseBar")) .Caption(_("Connection bar")).ToolbarPane().Top(). LeftDockable(false).RightDockable(false)); // Update the AUI manager manager.Update(); //Update browser info modelBrowser->SetSize(browserPanel->GetSize()); previousChanged = true; setModelChanged(false); SetStatusText(wxString(wxT("Ready")), 1); }
void SCH_EDIT_FRAME::ReCreateMenuBar() { EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>(); // wxWidgets handles the Mac Application menu behind the scenes, but that means // we always have to start from scratch with a new wxMenuBar. wxMenuBar* oldMenuBar = GetMenuBar(); wxMenuBar* menuBar = new wxMenuBar(); auto modifiedDocumentCondition = [] ( const SELECTION& sel ) { SCH_SHEET_LIST sheetList( g_RootSheet ); return sheetList.IsModified(); }; //-- File menu ----------------------------------------------------------- // CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool ); static ACTION_MENU* openRecentMenu; if( Kiface().IsSingle() ) // not when under a project mgr { // Add this menu to list menu managed by m_fileHistory // (the file history will be updated when adding/removing files in history) if( openRecentMenu ) Kiface().GetFileHistory().RemoveMenu( openRecentMenu ); openRecentMenu = new ACTION_MENU(); openRecentMenu->SetTool( selTool ); openRecentMenu->SetTitle( _( "Open Recent" ) ); openRecentMenu->SetIcon( recent_xpm ); Kiface().GetFileHistory().UseMenu( openRecentMenu ); Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu ); fileMenu->AddItem( ACTIONS::doNew, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::open, EE_CONDITIONS::ShowAlways ); fileMenu->AddMenu( openRecentMenu, EE_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); } fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition ); fileMenu->AddItem( ACTIONS::saveAs, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::saveAll, modifiedDocumentCondition ); fileMenu->AddSeparator(); fileMenu->AddItem( ID_APPEND_PROJECT, _( "Append Schematic Sheet Content..." ), _( "Append schematic sheet content from another project to the current sheet" ), add_document_xpm, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ID_IMPORT_NON_KICAD_SCH, _( "Import Non KiCad Schematic..." ), _( "Replace current schematic sheet with one imported from another application" ), import_document_xpm, EE_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); // Import submenu ACTION_MENU* submenuImport = new ACTION_MENU(); submenuImport->SetTool( selTool ); submenuImport->SetTitle( _( "Import" ) ); submenuImport->SetIcon( import_xpm ); submenuImport->Add( _( "Footprint Association File..." ), HELP_IMPORT_FOOTPRINTS, ID_BACKANNO_ITEMS, import_footprint_names_xpm ); fileMenu->AddMenu( submenuImport, EE_CONDITIONS::ShowAlways ); // Export submenu ACTION_MENU* submenuExport = new ACTION_MENU(); submenuExport->SetTool( selTool ); submenuExport->SetTitle( _( "Export" ) ); submenuExport->SetIcon( export_xpm ); submenuExport->Add( _( "Drawing to Clipboard" ), _( "Export drawings to clipboard" ), ID_GEN_COPY_SHEET_TO_CLIPBOARD, copy_xpm ); submenuExport->Add( _( "Netlist..." ), _( "Export netlist file" ), ID_GET_NETLIST, netlist_xpm ); fileMenu->AddMenu( submenuExport, EE_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); fileMenu->AddItem( ACTIONS::pageSettings, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::print, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::plot, EE_CONDITIONS::ShowAlways ); fileMenu->AddSeparator(); // Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways ); //-- Edit menu ----------------------------------------------------------- // CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool ); auto enableUndoCondition = [ this ] ( const SELECTION& sel ) { return GetScreen() && GetScreen()->GetUndoCommandCount() > 0; }; auto enableRedoCondition = [ this ] ( const SELECTION& sel ) { return GetScreen() && GetScreen()->GetRedoCommandCount() > 0; }; editMenu->AddItem( ACTIONS::undo, enableUndoCondition ); editMenu->AddItem( ACTIONS::redo, enableRedoCondition ); editMenu->AddSeparator(); editMenu->AddItem( ACTIONS::cut, EE_CONDITIONS::NotEmpty ); editMenu->AddItem( ACTIONS::copy, EE_CONDITIONS::NotEmpty ); editMenu->AddItem( ACTIONS::paste, EE_CONDITIONS::Idle ); editMenu->AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty ); editMenu->AddSeparator(); editMenu->AddItem( EE_ACTIONS::deleteItemCursor, EE_CONDITIONS::ShowAlways ); // Find editMenu->AddSeparator(); editMenu->AddItem( ACTIONS::find, EE_CONDITIONS::ShowAlways ); editMenu->AddItem( ACTIONS::findAndReplace, EE_CONDITIONS::ShowAlways ); editMenu->AddSeparator(); // Update field values editMenu->AddItem( ID_UPDATE_FIELDS, _( "Update Fields from Library..." ), _( "Sets symbol fields to original library values" ), update_fields_xpm, EE_CONDITIONS::ShowAlways ); //-- View menu ----------------------------------------------------------- // CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool ); auto belowRootSheetCondition = [] ( const SELECTION& aSel ) { return g_CurrentSheet->Last() != g_RootSheet; }; auto gridShownCondition = [ this ] ( const SELECTION& aSel ) { return IsGridVisible(); }; auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) { return GetUserUnits() == INCHES; }; auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) { return GetUserUnits() == MILLIMETRES; }; auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) { return GetGalDisplayOptions().m_fullscreenCursor; }; auto hiddenPinsCondition = [ this ] ( const SELECTION& aSel ) { return GetShowAllPins(); }; viewMenu->AddItem( EE_ACTIONS::showLibraryBrowser, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( EE_ACTIONS::navigateHierarchy, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition ); viewMenu->AddSeparator(); viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::zoomOutCenter, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::zoomFitScreen, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::zoomTool, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::zoomRedraw, EE_CONDITIONS::ShowAlways ); viewMenu->AddSeparator(); viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition ); viewMenu->AddItem( ACTIONS::gridProperties, EE_CONDITIONS::ShowAlways ); // Units submenu CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool ); unitsSubMenu->SetTitle( _( "&Units" ) ); unitsSubMenu->SetIcon( unit_mm_xpm ); unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition ); unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition ); viewMenu->AddMenu( unitsSubMenu ); viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition ); viewMenu->AddSeparator(); viewMenu->AddCheckItem( EE_ACTIONS::toggleHiddenPins, hiddenPinsCondition ); #ifdef __APPLE__ viewMenu->AppendSeparator(); #endif //-- Place menu ----------------------------------------------------------- // CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool ); placeMenu->AddItem( EE_ACTIONS::placeSymbol, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placePower, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::drawWire, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::drawBus, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeBusWireEntry, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeBusBusEntry, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeNoConnect, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeJunction, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeLabel, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeGlobalLabel, EE_CONDITIONS::ShowAlways ); placeMenu->AddSeparator(); placeMenu->AddItem( EE_ACTIONS::placeHierarchicalLabel, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::drawSheet, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::importSheetPin, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeSheetPin, EE_CONDITIONS::ShowAlways ); placeMenu->AddSeparator(); placeMenu->AddItem( EE_ACTIONS::drawLines, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeSchematicText, EE_CONDITIONS::ShowAlways ); placeMenu->AddItem( EE_ACTIONS::placeImage, EE_CONDITIONS::ShowAlways ); //-- Inspect menu ----------------------------------------------- // wxMenu* inspectMenu = new wxMenu; AddMenuItem( inspectMenu, ID_GET_ERC, _( "Electrical Rules &Checker" ), _( "Perform electrical rules check" ), KiBitmap( erc_xpm ) ); //-- Tools menu ----------------------------------------------- // wxMenu* toolsMenu = new wxMenu; prepareToolsMenu( toolsMenu ); //-- Preferences menu ----------------------------------------------- // CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool ); auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) { return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL; }; auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) { return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO; }; prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "Configure Pa&ths..." ), _( "Edit path configuration environment variables" ), path_xpm, EE_CONDITIONS::ShowAlways ); prefsMenu->AddItem( ID_EDIT_SYM_LIB_TABLE, _( "Manage Symbol Libraries..." ), _( "Edit the global and project symbol library lists" ), library_table_xpm, EE_CONDITIONS::ShowAlways ); prefsMenu->AddItem( wxID_PREFERENCES, AddHotkeyName( _( "&Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES ), _( "Show preferences for all open tools" ), preference_xpm, EE_CONDITIONS::ShowAlways ); prefsMenu->AddSeparator(); Pgm().AddMenuLanguageList( prefsMenu ); prefsMenu->AddSeparator(); prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition ); prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition ); //-- Menubar ----------------------------------------------- // menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( inspectMenu, _( "&Inspect" ) ); menuBar->Append( toolsMenu, _( "&Tools" ) ); menuBar->Append( prefsMenu, _( "P&references" ) ); AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; }
void ChaosConnectFrm::CreateGUIControls() { /** * Creates all of the GUI controls on the main form. * * GUI layout consists of a menu bar and status bar on the main form * A wxFlexGrid sizer with one column is created to hold the controls * Four plots are then layed out in another wxFlexGridSizer so that * in the first row of the overall sizer. A horizontal wxBoxSizer is * then created for the bottom row so that we can add a stretchable * panel down there for additional controls. */ // Create sizer overallSizer = new wxFlexGridSizer(1); flexSizer = new wxFlexGridSizer(2, 2, 0, 0); bottomRowSizer = new wxBoxSizer(wxHORIZONTAL); panel5Sizer = new wxBoxSizer(wxHORIZONTAL); // Overall Sizer overallSizer->Add(flexSizer, 0, wxEXPAND | wxALL); overallSizer->AddGrowableRow(0); overallSizer->AddGrowableCol(0); // Make the Flex Sizer grow flexSizer->AddGrowableRow(0); flexSizer->AddGrowableRow(1); flexSizer->AddGrowableCol(0); flexSizer->AddGrowableCol(1); // Create 4 ChaosPanel displays display1 = new ChaosPanel(this, ID_DISPLAY1, wxPoint(0, 0), wxSize(200, 100), wxTAB_TRAVERSAL, wxT("display1"), ChaosPanel::CHAOS_XT); flexSizer->Add(display1,0,wxEXPAND | wxALL,0); display2 = new ChaosPanel(this, ID_DISPLAY2, wxPoint(200, 0), wxSize(200, 100), wxTAB_TRAVERSAL, wxT("display2"), ChaosPanel::CHAOS_XY); flexSizer->Add(display2,0,wxEXPAND | wxALL,0); display3 = new ChaosPanel(this, ID_DISPLAY3, wxPoint(0, 100), wxSize(200, 100), wxTAB_TRAVERSAL, wxT("display3"), ChaosPanel::CHAOS_BIFURCATION); flexSizer->Add(display3,0,wxEXPAND | wxALL,0); display4 = new ChaosPanel(this, ID_DISPLAY4, wxPoint(200, 100), wxSize(200, 100), wxTAB_TRAVERSAL, wxT("display4"), ChaosPanel::CHAOS_RETURN1); flexSizer->Add(display4,0,wxEXPAND | wxALL,0); // Sizer for the controls along the bottom display5 = new wxPanel(this, ID_DISPLAY5, wxPoint(200, 100), wxSize(200, 100), wxTAB_TRAVERSAL, wxT("display5")); overallSizer->Add(panel5Sizer, 0, wxEXPAND | wxALL); panel5Sizer->Add(display5, 1, wxEXPAND | wxALL); display5->SetSizer(bottomRowSizer); // Create pause button startStopButton = new wxButton(display5, ID_START_STOP_BTN, wxT("Pause")); // Settings to adjust how many bifurcation steps are taken stepsLabel = new wxStaticText(display5, wxID_ANY, wxT("Bifurcation Steps: ")); stepsSpinner = new wxSpinCtrl(display5, ID_STEPS_SPINNER, wxT("100"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 0, 4095, 100); // Settings to adjust how many peaks are taken at each step peaksLabel = new wxStaticText(display5, wxID_ANY, wxT("Bifurcation Peaks: ")); peaksSpinner = new wxSpinCtrl(display5, ID_PEAKS_SPINNER, wxT("10"), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 0, 100, 10); // Buttons settingsApplyButton = new wxButton(display5, ID_SETTINGS_APPLY_BTN, wxT("Apply")); bifEraseButton = new wxButton(display5, ID_BIF_ERASE_BTN, wxT("Redraw Bifurcation")); bottomRowSizer->Add(stepsLabel, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); bottomRowSizer->Add(stepsSpinner, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); bottomRowSizer->Add(peaksLabel, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); bottomRowSizer->Add(peaksSpinner, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); bottomRowSizer->Add(settingsApplyButton, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); bottomRowSizer->Add(bifEraseButton, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 2); bottomRowSizer->AddStretchSpacer(1); bottomRowSizer->Add(startStopButton, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 2); // Create status bar // Create fields statusBar = new wxStatusBar(this, ID_STATUSBAR); statusBar->SetFieldsCount(5); statusBar->SetStatusText(wxT("Connected: ?"),0); statusBar->SetStatusText(wxT("MDAC Value: ????"),1); statusBar->SetStatusText(wxT("Resistance: ????"),2); statusBar->SetStatusText(wxT("(X,Y)"),3); statusBar->SetStatusText(wxT("Updating"),4); // Set field sizes int statusBar_Widths[5]; statusBar_Widths[0] = 100; statusBar_Widths[1] = 100; statusBar_Widths[2] = 100; statusBar_Widths[3] = 150; statusBar_Widths[4] = -1; // Auto scale to the rest of the size statusBar->SetStatusWidths(5,statusBar_Widths); // Set status bar SetStatusBar(statusBar); // Create menu bar menuBar = new wxMenuBar(); // File menu wxMenu *fileMenu = new wxMenu(0); fileMenu->Append(ID_MNU_SAMPLE_TO_FILE, wxT("Sample To File..."), wxT(""), wxITEM_NORMAL); fileMenu->Append(ID_MNU_SETTINGS, wxT("Settings..."), wxT(""), wxITEM_NORMAL); fileMenu->Append(ID_MNU_SHOW_LOG, wxT("Show Log"), wxT(""), wxITEM_NORMAL); fileMenu->Append(ID_MNU_FILE_EXIT, wxT("Exit"), wxT(""), wxITEM_NORMAL); menuBar->Append(fileMenu, wxT("File")); // View menu wxMenu *viewMenu = new wxMenu(0); viewMenu->Append(ID_MNU_VIEW_FULLSCREEN, wxT("Fullscreen"), wxT(""), wxITEM_CHECK); viewMenu->Append(ID_MNU_VIEW_SPLITSCREEN, wxT("Split Screen"), wxT(""), wxITEM_CHECK); viewMenu->Append(ID_MNU_VIEW_QUADVIEW, wxT("Quad View"), wxT(""), wxITEM_CHECK); menuBar->Append(viewMenu, wxT("View")); menuBar->Check(ID_MNU_VIEW_FULLSCREEN, true); // Help menu wxMenu *helpMenu = new wxMenu(0); helpMenu->Append(ID_MNU_ABOUT, wxT("About"), wxT("")); menuBar->Append(helpMenu, wxT("Help")); SetMenuBar(menuBar); // Create timer timer1 = new wxTimer(); timer1->SetOwner(this, ID_TIMER1); timer1->Start(ChaosSettings::UpdatePeriod); // Set window properties and title bar SetTitle(wxT("ChaosConnect 1.0")); SetIcon(wxNullIcon); SetMinSize(wxSize(600,400)); // Set up the sizer this->SetSizer(overallSizer); this->SetAutoLayout(true); // Set fullscreen mode flexSizer->Show(display2, false, true); flexSizer->Show(display3, false, true); flexSizer->Show(display4, false, true); display1->Show(); flexSizer->Fit(this); // Adjust window size to min flexSizer->Layout(); // Layout items in the sizer Center(); // Give plots access to the status bar display1->setStatusBar(statusBar); display2->setStatusBar(statusBar); display3->setStatusBar(statusBar); display4->setStatusBar(statusBar); }
RawDataVisualizeFrame::RawDataVisualizeFrame(const wxString& title,PMProbeBatch *RawData, wxWindow *parent):wxFrame(parent,wxID_ANY,title,wxDefaultPosition, wxDefaultSize,wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS) { wxMenu *fileMenu = new wxMenu; wxMenu *drawMenu = new wxMenu; wxMenuBar *menuBar = new wxMenuBar(); wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); // fileMenu->Append(ID_PRINT_PREVIEW_CURRENTPLOT,wxT("Print Preview"),wxT("Print Preview Current Plot")); fileMenu->Append(ID_SAVE_CURRENT,wxT("Save"),wxT("Save Current Plot")); fileMenu->Append(ID_POSTSCRIPT_CURRENTPLOT,wxT("Print"),wxT("Print Current plot")); fileMenu->AppendSeparator(); fileMenu->Append(wxID_EXIT,wxT("E&xit\tAlt-X"),wxT("Quit the program")); drawMenu->Append(ID_VISUALIZE_BOXPLOT,wxT("&Boxplots"),wxT("Boxplots of Raw PM data")); drawMenu->Append(ID_VISUALIZE_DENSITY,wxT("&Density Plots"),wxT("Density plots of Raw PM data")); drawMenu->Append(ID_VISUALIZE_DENSITY_INDIVIDUAL,wxT("&Individual Density Plots"),wxT("Density plots of Raw PM data for each array separately")); menuBar->Append(fileMenu,wxT("&File")); menuBar->Append(drawMenu,wxT("&Draw")); SetMenuBar(menuBar); CreateStatusBar(2); MyWindow = new RawDataVisualizeDrawingWindow(this); //wxWindow(this,-1); item0->Add( MyWindow, 1, wxEXPAND | wxGROW | wxALL , 5 ); this->SetAutoLayout( TRUE ); this->SetSizer( item0 ); MyWindow->SetBackgroundColour(*wxWHITE ); MyWindow->Refresh(); MyRawData = RawData; BoxplotStatistics = NULL; DensityPlotStatistics_y = NULL; currentplot = 0; whichdensity=0; g_printData = new wxPrintData; g_pageSetupData = new wxPageSetupDialogData; frame = this; #if _WIN32 SetIcon(wxICON(expressicon)); #else SetIcon(wxICON(RMAExpress)); #endif }
// frame constructor MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(NULL, wxID_ANY, title, pos, size, style) { m_textCtrl = NULL; SetAccessible(new FrameAccessible(this)); // set the frame icon SetIcon(wxICON(sample)); #if wxUSE_MENUS // create a menu bar wxMenu *menuFile = new wxMenu; // the "About" item should be in the help menu wxMenu *helpMenu = new wxMenu; helpMenu->Append(AccessTest_About, wxT("&About"), wxT("Show about dialog")); menuFile->Append(AccessTest_Query, wxT("Query"), wxT("Query the window hierarchy")); menuFile->AppendSeparator(); menuFile->Append(AccessTest_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program")); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(menuFile, wxT("&File")); menuBar->Append(helpMenu, wxT("&Help")); // ... and attach this menu bar to the frame SetMenuBar(menuBar); #endif // wxUSE_MENUS #if 0 // wxUSE_STATUSBAR // create a status bar just for fun (by default with 1 pane only) CreateStatusBar(2); SetStatusText(wxT("Welcome to wxWidgets!")); #endif // wxUSE_STATUSBAR wxSplitterWindow* splitter = new wxSplitterWindow(this, wxID_ANY); splitter->SetAccessible(new SplitterWindowAccessible(splitter)); wxListBox* listBox = new wxListBox(splitter, wxID_ANY); listBox->Append(wxT("Cabbages")); listBox->Append(wxT("Kings")); listBox->Append(wxT("Sealing wax")); listBox->Append(wxT("Strings")); listBox->CreateAccessible(); listBox->SetHelpText(wxT("This is a sample wxWidgets listbox, with a number of items in it.")); m_textCtrl = new wxTextCtrl(splitter, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); m_textCtrl->CreateAccessible(); m_textCtrl->SetHelpText(wxT("This is a sample wxWidgets multiline text control.")); splitter->SplitHorizontally(listBox, m_textCtrl, 150); #if 0 wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this, wxID_ANY); scrolledWindow->SetAccessible(new ScrolledWindowAccessible(scrolledWindow)); #endif }
void HtMainFrame::CreateMenu (HtArtProvider &art) { // -- File -- wxMenu *file_menu = new wxMenu; wxMenuItem *file_new = new wxMenuItem(file_menu, HT_FileNew, _("&New\tCtrl+N")); wxMenuItem *file_open = new wxMenuItem(file_menu, HT_FileOpen, _("&Open...\tCtrl+O")); wxMenuItem *file_close = new wxMenuItem(file_menu, HT_FileClose, _("&Close\tCtrl+W")); wxMenuItem *file_closeall = new wxMenuItem(file_menu, HT_FileCloseAll, _("Close All")); wxMenuItem *file_save = new wxMenuItem(file_menu, HT_FileSave, _("&Save\tCtrl+S")); wxMenuItem *file_saveas = new wxMenuItem(file_menu, HT_FileSaveAs, _("Save &As...")); wxMenuItem *file_saveall = new wxMenuItem(file_menu, HT_FileSaveAll, _("Save All\tCtrl+Shift+S")); wxMenuItem *file_exit = new wxMenuItem(file_menu, HT_FileExit, _("E&xit\tCtrl+Q")); file_new->SetBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_New)); file_open->SetBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_Open)); file_close->SetBitmap(art.GetBitmap(HTArtId_Common, HTArt_Close)); file_save->SetBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_Save)); file_exit->SetBitmap(art.GetBitmap(HTArtId_Common, HTArt_Exit)); file_menu->Append(file_new); file_menu->Append(file_open); file_menu->AppendSeparator(); file_menu->Append(file_close); file_menu->Append(file_closeall); file_menu->AppendSeparator(); file_menu->Append(file_save); file_menu->Append(file_saveas); file_menu->Append(file_saveall); file_menu->AppendSeparator(); file_menu->Append(file_exit); // -- Edit -> Copy As -- wxMenu *edit_copyas = new wxMenu; wxMenuItem *edit_copyas_hextxt = new wxMenuItem(edit_copyas, HT_EditCopyAsHexText, _("&Hex Text")); wxMenuItem *edit_copyas_csrc = new wxMenuItem(edit_copyas, HT_EditCopyAsCSource, _("&C Source...")); edit_copyas_hextxt->SetBitmap(art.GetBitmap(HTArtId_Common, HTArt_CopyAsHex)); edit_copyas_csrc->SetBitmap(art.GetBitmap(HTArtId_Common, HTArt_CopyAsCSrc)); edit_copyas->Append(edit_copyas_hextxt); edit_copyas->Append(edit_copyas_csrc); // -- Edit -- wxMenu *edit_menu = new wxMenu; wxMenuItem *edit_undo = new wxMenuItem(edit_menu, HT_EditUndo, _("&Undo\tCtrl+Z")); wxMenuItem *edit_redo = new wxMenuItem(edit_menu, HT_EditRedo, _("&Redo\tCtrl+Y")); wxMenuItem *edit_cut = new wxMenuItem(edit_menu, HT_EditCut, _("Cu&t\tCtrl+X")); wxMenuItem *edit_copy = new wxMenuItem(edit_menu, HT_EditCopy, _("Copy\tCtrl+C")); wxMenuItem *edit_paste = new wxMenuItem(edit_menu, HT_EditPaste, _("Paste\tCtrl+V")); wxMenuItem *edit_selectall = new wxMenuItem(edit_menu, HT_EditSelectAll, _("Select All\tCtrl+A")); edit_undo->SetBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_Undo)); edit_redo->SetBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_Redo)); edit_cut->SetBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_Cut)); edit_copy->SetBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_Copy)); edit_paste->SetBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_Paste)); edit_menu->Append(edit_undo); edit_menu->Append(edit_redo); edit_menu->AppendSeparator(); edit_menu->Append(edit_cut); edit_menu->Append(edit_copy); edit_menu->Append(edit_paste); edit_menu->AppendSeparator(); edit_menu->AppendSubMenu(edit_copyas, _("&Copy As")); edit_menu->Append(edit_selectall); // -- View -- wxMenu *view_menu = new wxMenu; view_menu->AppendCheckItem(HT_ViewStatusBar, _("&Status Bar"), _("Show/hide status bar")); view_menu->Check(HT_ViewStatusBar, true); #ifdef WXDEBUG view_menu->AppendCheckItem(HT_ViewDebugPanel, "&Debug Panel", "Show/hide the debug panel"); view_menu->Check(HT_ViewDebugPanel, true); #endif // -- Tools -- wxMenu *tools_menu = new wxMenu; wxMenuItem *tools_tblmanager = new wxMenuItem(tools_menu, HT_ToolsTblManager, _("&Table Editor\tCtrl+Shift+T")); wxMenuItem *tools_logger = new wxMenuItem(tools_menu, HT_ToolsLogger, _("&Logger\tCtrl+Shift+E")); tools_menu->Append(tools_tblmanager); tools_menu->Append(tools_logger); // -- Help -- wxMenu *help_menu = new wxMenu; help_menu->Append(wxID_ABOUT, _("&About")); // ------------------------------------------- wxMenuBar *mb = new wxMenuBar; mb->Append(file_menu, _("&File")); mb->Append(edit_menu, _("&Edit")); mb->Append(view_menu, _("&View")); mb->Append(tools_menu, _("&Tools")); mb->Append(help_menu, _("&Help")); SetMenuBar(mb); }
// Define my frame constructor MyFrame::MyFrame(wxFrame *frame, const wxString& title) : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300)) { // Give it an icon SetIcon(wxICON(sample)); // Make a menubar wxMenu *file_menu = new wxMenu; file_menu->Append(wxID_EXIT, wxT("&Quit\tCtrl-Q")); wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, wxT("&File")); // Associate the menu bar with the frame SetMenuBar(menu_bar); // set a dialog background SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); // add the controls to the frame wxString strs4[] = { IPC_SERVICE, wxT("...") }; wxString strs5[] = { IPC_HOST, wxT("...") }; wxString strs6[] = { IPC_TOPIC, wxT("...") }; wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL ); wxGridSizer *item2 = new wxGridSizer( 4, 0, 0 ); wxButton *item3 = new wxButton( this, ID_START, wxT("Connect to server"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxChoice *item5 = new wxChoice( this, ID_HOSTNAME, wxDefaultPosition, wxSize(100,-1), 2, strs5, 0 ); item2->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 ); wxChoice *item4 = new wxChoice( this, ID_SERVERNAME, wxDefaultPosition, wxSize(100,-1), 2, strs4, 0 ); item2->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxChoice *item6 = new wxChoice( this, ID_TOPIC, wxDefaultPosition, wxSize(100,-1), 2, strs6, 0 ); item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item7 = new wxButton( this, ID_DISCONNECT, wxT("Disconnect "), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item8 = new wxButton( this, ID_STARTADVISE, wxT("StartAdvise"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item9 = new wxButton( this, ID_STOPADVISE, wxT("StopAdvise"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item10 = new wxButton( this, ID_EXECUTE, wxT("Execute"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item11 = new wxButton( this, ID_POKE, wxT("Poke"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item12 = new wxButton( this, ID_REQUEST, wxT("Request"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item1->Add( item2, 1, wxALIGN_CENTER|wxALL, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticBox *item14 = new wxStaticBox( this, -1, wxT("Client log") ); wxStaticBoxSizer *item13 = new wxStaticBoxSizer( item14, wxVERTICAL ); wxTextCtrl *item15 = new wxTextCtrl( this, ID_LOG, wxEmptyString, wxDefaultPosition, wxSize(500,140), wxTE_MULTILINE ); item13->Add( item15, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); this->SetSizer( item0 ); item0->SetSizeHints( this ); // status m_client = NULL; GetServername()->SetSelection(0); GetHostname()->SetSelection(0); GetTopic()->SetSelection(0); wxLogTextCtrl *logWindow = new wxLogTextCtrl(GetLog()); delete wxLog::SetActiveTarget(logWindow); wxLogMessage(wxT("Click on Connect to connect to the server")); EnableControls(); }
MyFrame::MyFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(parent, id, title, pos, size, style) { // set frame icon #ifdef __WXMSW__ SetIcon(wxIcon(wxT("mondrian"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16)); #endif // use wxAuiManager to manage this frame m_mgr.SetManagedWindow(this); // create the menu wxMenuBar* mb = new wxMenuBar; wxMenu* file_menu = new wxMenu; file_menu->Append(ID_OpenLocation, _("&Open Location...\tCtrl+L")); file_menu->Append(ID_Close, _("&Close\tCtrl+W")); file_menu->AppendSeparator(); file_menu->Append(ID_SaveAs, _("&Save As...\tCtrl+S")); file_menu->AppendSeparator(); file_menu->Append(ID_PageSetup, _("Page Set&up...")); file_menu->Append(ID_Print, _("&Print...\tCtrl+P")); file_menu->AppendSeparator(); file_menu->Append(ID_Exit, _("E&xit")); wxMenu* edit_menu = new wxMenu; edit_menu->Append(ID_Undo, _("&Undo\tCtrl+Z")); edit_menu->Append(ID_Redo, _("&Redo\tCtrl+Y")); edit_menu->AppendSeparator(); edit_menu->Append(ID_Cut, _("Cu&t\tCtrl+X")); edit_menu->Append(ID_Copy, _("&Copy\tCtrl+C")); edit_menu->Append(ID_Paste, _("&Paste\tCtrl+V")); edit_menu->Append(ID_SelectAll, _("Select &All\tCtrl+Z")); edit_menu->AppendSeparator(); edit_menu->Append(ID_Find, _("&Find...\tCtrl+F")); edit_menu->Append(ID_FindAgain, _("Find A&gain\tCtrl+G")); wxMenu* view_menu = new wxMenu; view_menu->Append(ID_GoBack, _("Go &Back")); view_menu->Append(ID_GoForward, _("Go &Forward")); view_menu->Append(ID_GoHome, _("&Home")); view_menu->AppendSeparator(); view_menu->Append(ID_Stop, _("&Stop\tEsc")); view_menu->Append(ID_Reload, _("&Reload\tCtrl+R")); view_menu->AppendSeparator(); view_menu->Append(ID_ZoomIn, _("Zoom &In")); view_menu->Append(ID_ZoomOut, _("Zoom &Out")); view_menu->Append(ID_ZoomReset, _("Reset &Zoom")); view_menu->AppendSeparator(); view_menu->Append(ID_ShowSource, _("Sho&w Source")); view_menu->Append(ID_ShowLinks, _("Show &Links")); wxMenu* help_menu = new wxMenu; help_menu->Append(ID_GoHelp, _("Help\tF1")); help_menu->Append(ID_GoForums, _("Forums")); help_menu->Append(ID_GoAbout, _("About")); mb->Append(file_menu, _("&File")); mb->Append(edit_menu, _("&Edit")); mb->Append(view_menu, _("&View")); mb->Append(help_menu, _("&Help")); SetMenuBar(mb); CreateStatusBar(); GetStatusBar()->SetStatusText(_("Ready")); // create the main toolbar wxAuiToolBar* toolbar = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE); toolbar->SetToolBitmapSize(wxSize(24,24)); toolbar->AddTool(ID_GoBack, wxT("Go Back"), wxArtProvider::GetBitmap(wxART_GO_BACK)); toolbar->AddTool(ID_GoForward, wxT("Go Forward"), wxArtProvider::GetBitmap(wxART_GO_FORWARD)); toolbar->AddTool(ID_GoHome, wxT("Go Home"), wxArtProvider::GetBitmap(wxART_GO_HOME)); m_urlbar = new wxComboBox(toolbar, wxID_URL, wxT(""), wxPoint(0,0), wxSize(850,18)); toolbar->AddControl(m_urlbar, wxT("Location")); toolbar->Realize(); // create the main browser control m_browser = new wxWebControl(this, wxID_WEB, wxPoint(0,0), wxSize(800,600)); // add the toolbar to the manager m_mgr.AddPane(toolbar, wxAuiPaneInfo(). Name(wxT("Toolbar")).Caption(wxT("Toolbar")). ToolbarPane().Top(). LeftDockable(false).RightDockable(false)); // add the browser to the manager m_mgr.AddPane(m_browser, wxAuiPaneInfo(). Name(wxT("Browser")). CenterPane().Show()); // update the wxAUI manager m_mgr.Update(); // set the default browser preferences; to learn // more about the Mozilla preference values, see // http://kb.mozillazine.org/About:config_entries // for the example, disable cookies and popups wxWebPreferences webprefs = wxWebControl::GetPreferences(); webprefs.SetIntPref(wxT("network.cookie.cookieBehavior"), 2 /* disable all cookies */); webprefs.SetIntPref(wxT("privacy.popups.policy"), 2 /* reject popups */); // example proxy settings // webprefs.SetIntPref(wxT("network.proxy.type"), 0 /* no proxy */); // webprefs.SetIntPref(wxT("network.proxy.type"), 1 /* manual proxy */); // webprefs.SetIntPref(wxT("network.proxy.type"), 4 /* auto-detect proxy */); // webprefs.SetStringPref( wxT("network.proxy.http"), wxT("")); // webprefs.SetIntPref( wxT("network.proxy.http_port"), 0); // webprefs.SetStringPref( wxT("network.proxy.ftp"), wxT("")); // webprefs.SetIntPref( wxT("network.proxy.ftp_port"), 0); // webprefs.SetStringPref( wxT("network.proxy.ssl"), wxT("")); // webprefs.SetIntPref( wxT("network.proxy.ssl_port"), 0); // webprefs.SetStringPref( wxT("network.proxy.socks"), wxT("")); // webprefs.SetIntPref( wxT("network.proxy.socks_port"), 0); // example cookie preferences // webprefs.SetIntPref(wxT("network.cookie.cookieBehavior"), 0 /* enable all cookies */); // webprefs.SetIntPref(wxT("network.cookie.cookieBehavior"), 2 /* disable all cookies */); // webprefs.SetIntPref(wxT("network.cookie.lifetime.days"), 0); // webprefs.SetIntPref(wxT("network.cookie.lifetimePolicy"), 2 /* accept for session only */); // webprefs.SetIntPref(wxT("network.cookie.lifetimePolicy"), 3 /* keep for number of days specified in "privacy.cookie.lifetime_days" */); // example popup preferences // webprefs.SetIntPref(wxT("privacy.popups.policy"), 1 /* accept popups */); // webprefs.SetIntPref(wxT("privacy.popups.policy"), 2 /* reject popups */); // set the default home and help URIs m_uri_home = wxT("http://www.kirix.com/labs"); m_uri_help = wxT("http://www.kirix.com/labs/wxwebconnect/documentation/quick-facts.html"); m_uri_forums = wxT("http://www.kirix.com/forums/"); m_uri_about = wxT("http://www.kirix.com/labs/wxwebconnect.html"); // set the DOM content loaded flag m_dom_contentloaded = false; // open the home location m_browser->OpenURI(m_uri_home); }
GridFrame::GridFrame() : wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxWidgets grid class demo"), wxDefaultPosition, wxDefaultSize ) { wxMenu *fileMenu = new wxMenu; fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V")); fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B")); fileMenu->Append( ID_SMALL_GRID, _T("&Small Grid test\tCtrl-S")); fileMenu->AppendSeparator(); fileMenu->Append( wxID_EXIT, _T("E&xit\tAlt-X") ); wxMenu *viewMenu = new wxMenu; viewMenu->Append( ID_TOGGLEROWLABELS, _T("&Row labels"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_TOGGLECOLLABELS, _T("&Col labels"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_TOGGLEEDIT, _T("&Editable"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_TOGGLEROWSIZING, _T("Ro&w drag-resize"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_TOGGLECOLSIZING, _T("C&ol drag-resize"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_TOGGLEGRIDSIZING, _T("&Grid drag-resize"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_TOGGLEGRIDDRAGCELL, _T("&Grid drag-cell"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_TOGGLEGRIDLINES, _T("&Grid Lines"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_SET_HIGHLIGHT_WIDTH, _T("&Set Cell Highlight Width...") ); viewMenu->Append( ID_SET_RO_HIGHLIGHT_WIDTH, _T("&Set Cell RO Highlight Width...") ); viewMenu->Append( ID_AUTOSIZECOLS, _T("&Auto-size cols") ); viewMenu->Append( ID_CELLOVERFLOW, _T("&Overflow cells"), wxEmptyString, wxITEM_CHECK ); viewMenu->Append( ID_RESIZECELL, _T("&Resize cell (7,1)"), wxEmptyString, wxITEM_CHECK ); wxMenu *rowLabelMenu = new wxMenu; viewMenu->Append( ID_ROWLABELALIGN, _T("R&ow label alignment"), rowLabelMenu, _T("Change alignment of row labels") ); rowLabelMenu->Append( ID_ROWLABELHORIZALIGN, _T("&Horizontal") ); rowLabelMenu->Append( ID_ROWLABELVERTALIGN, _T("&Vertical") ); wxMenu *colLabelMenu = new wxMenu; viewMenu->Append( ID_COLLABELALIGN, _T("Col l&abel alignment"), colLabelMenu, _T("Change alignment of col labels") ); colLabelMenu->Append( ID_COLLABELHORIZALIGN, _T("&Horizontal") ); colLabelMenu->Append( ID_COLLABELVERTALIGN, _T("&Vertical") ); wxMenu *colMenu = new wxMenu; colMenu->Append( ID_SETLABELCOLOUR, _T("Set &label colour...") ); colMenu->Append( ID_SETLABELTEXTCOLOUR, _T("Set label &text colour...") ); colMenu->Append( ID_SETLABEL_FONT, _T("Set label fo&nt...") ); colMenu->Append( ID_GRIDLINECOLOUR, _T("&Grid line colour...") ); colMenu->Append( ID_SET_CELL_FG_COLOUR, _T("Set cell &foreground colour...") ); colMenu->Append( ID_SET_CELL_BG_COLOUR, _T("Set cell &background colour...") ); wxMenu *editMenu = new wxMenu; editMenu->Append( ID_INSERTROW, _T("Insert &row") ); editMenu->Append( ID_INSERTCOL, _T("Insert &column") ); editMenu->Append( ID_DELETEROW, _T("Delete selected ro&ws") ); editMenu->Append( ID_DELETECOL, _T("Delete selected co&ls") ); editMenu->Append( ID_CLEARGRID, _T("Cl&ear grid cell contents") ); wxMenu *selectMenu = new wxMenu; selectMenu->Append( ID_SELECT_UNSELECT, _T("Add new cells to the selection"), _T("When off, old selection is deselected before ") _T("selecting the new cells"), wxITEM_CHECK ); selectMenu->Append( ID_SELECT_ALL, _T("Select all")); selectMenu->Append( ID_SELECT_ROW, _T("Select row 2")); selectMenu->Append( ID_SELECT_COL, _T("Select col 2")); selectMenu->Append( ID_SELECT_CELL, _T("Select cell (3, 1)")); selectMenu->Append( ID_DESELECT_ALL, _T("Deselect all")); selectMenu->Append( ID_DESELECT_ROW, _T("Deselect row 2")); selectMenu->Append( ID_DESELECT_COL, _T("Deselect col 2")); selectMenu->Append( ID_DESELECT_CELL, _T("Deselect cell (3, 1)")); wxMenu *selectionMenu = new wxMenu; selectMenu->Append( ID_CHANGESEL, _T("Change &selection mode"), selectionMenu, _T("Change selection mode") ); selectionMenu->Append( ID_SELCELLS, _T("Select &Cells") ); selectionMenu->Append( ID_SELROWS, _T("Select &Rows") ); selectionMenu->Append( ID_SELCOLS, _T("Select C&ols") ); wxMenu *helpMenu = new wxMenu; helpMenu->Append( wxID_ABOUT, _T("&About wxGrid demo") ); wxMenuBar *menuBar = new wxMenuBar; menuBar->Append( fileMenu, _T("&File") ); menuBar->Append( viewMenu, _T("&View") ); menuBar->Append( colMenu, _T("&Colours") ); menuBar->Append( editMenu, _T("&Edit") ); menuBar->Append( selectMenu, _T("&Select") ); menuBar->Append( helpMenu, _T("&Help") ); SetMenuBar( menuBar ); m_addToSel = false; grid = new wxGrid( this, wxID_ANY, wxPoint( 0, 0 ), wxSize( 400, 300 ) ); #if wxUSE_LOG int gridW = 600, gridH = 300; int logW = gridW, logH = 100; logWin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxPoint( 0, gridH + 20 ), wxSize( logW, logH ), wxTE_MULTILINE ); logger = new wxLogTextCtrl( logWin ); m_logOld = wxLog::SetActiveTarget( logger ); wxLog::SetTimestamp( NULL ); #endif // wxUSE_LOG // this will create a grid and, by default, an associated grid // table for strings grid->CreateGrid( 0, 0 ); grid->AppendRows(100); grid->AppendCols(100); int ir = grid->GetNumberRows(); grid->DeleteRows(0, ir); grid->AppendRows(ir); grid->SetRowSize( 0, 60 ); grid->SetCellValue( 0, 0, _T("Ctrl+Home\nwill go to\nthis cell") ); grid->SetCellValue( 0, 1, _T("A long piece of text to demonstrate wrapping.") ); grid->SetCellRenderer(0 , 1, new wxGridCellAutoWrapStringRenderer); grid->SetCellEditor( 0, 1 , new wxGridCellAutoWrapStringEditor); grid->SetCellValue( 0, 2, _T("Blah") ); grid->SetCellValue( 0, 3, _T("Read only") ); grid->SetReadOnly( 0, 3 ); grid->SetCellValue( 0, 4, _T("Can veto edit this cell") ); grid->SetCellValue( 0, 5, _T("Press\nCtrl+arrow\nto skip over\ncells") ); grid->SetRowSize( 99, 60 ); grid->SetCellValue( 99, 99, _T("Ctrl+End\nwill go to\nthis cell") ); grid->SetCellValue( 1, 0, _T("This default cell will overflow into neighboring cells, but not if you turn overflow off.")); grid->SetCellTextColour(1, 2, *wxRED); grid->SetCellBackgroundColour(1, 2, *wxGREEN); grid->SetCellValue( 1, 4, _T("I'm in the middle")); grid->SetCellValue(2, 2, _T("red")); grid->SetCellTextColour(2, 2, *wxRED); grid->SetCellValue(3, 3, _T("green on grey")); grid->SetCellTextColour(3, 3, *wxGREEN); grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY); grid->SetCellValue(4, 4, _T("a weird looking cell")); grid->SetCellAlignment(4, 4, wxALIGN_CENTRE, wxALIGN_CENTRE); grid->SetCellRenderer(4, 4, new MyGridCellRenderer); grid->SetCellValue(3, 0, _T("0")); grid->SetCellRenderer(3, 0, new wxGridCellBoolRenderer); grid->SetCellEditor(3, 0, new wxGridCellBoolEditor); wxGridCellAttr *attr; attr = new wxGridCellAttr; attr->SetTextColour(*wxBLUE); grid->SetColAttr(5, attr); attr = new wxGridCellAttr; attr->SetBackgroundColour(*wxRED); grid->SetRowAttr(5, attr); grid->SetCellValue(2, 4, _T("a wider column")); grid->SetColSize(4, 120); grid->SetColMinimalWidth(4, 120); grid->SetCellTextColour(5, 8, *wxGREEN); grid->SetCellValue(5, 8, _T("Bg from row attr\nText col from cell attr")); grid->SetCellValue(5, 5, _T("Bg from row attr Text col from col attr and this text is so long that it covers over many many empty cells but is broken by one that isn't")); grid->SetColFormatFloat(6); grid->SetCellValue(0, 6, _T("3.1415")); grid->SetCellValue(1, 6, _T("1415")); grid->SetCellValue(2, 6, _T("12345.67890")); grid->SetColFormatFloat(7, 6, 2); grid->SetCellValue(0, 7, _T("3.1415")); grid->SetCellValue(1, 7, _T("1415")); grid->SetCellValue(2, 7, _T("12345.67890")); const wxString choices[] = { _T("Please select a choice"), _T("This takes two cells"), _T("Another choice"), }; grid->SetCellEditor(4, 0, new wxGridCellChoiceEditor(WXSIZEOF(choices), choices)); grid->SetCellSize(4, 0, 1, 2); grid->SetCellValue(4, 0, choices[0]); grid->SetCellOverflow(4, 0, false); grid->SetCellSize(7, 1, 3, 4); grid->SetCellAlignment(7, 1, wxALIGN_CENTRE, wxALIGN_CENTRE); grid->SetCellValue(7, 1, _T("Big box!")); wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); topSizer->Add( grid, 1, wxEXPAND ); #if wxUSE_LOG topSizer->Add( logWin, 0, wxEXPAND ); #endif // wxUSE_LOG SetAutoLayout(true); SetSizer( topSizer ); topSizer->Fit( this ); Centre(); SetDefaults(); }
NyqBench::NyqBench(wxWindow * parent) : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER) { mFindDlg = NULL; mRunning = false; mScriptBox = NULL; mOutputBox = NULL; mScript = NULL; mOutput = NULL; // No need to delete...EffectManager will do it mEffect = new EffectNyquist(wxT("///nyquist worker///")); EffectManager::Get().RegisterEffect(mEffect, HIDDEN_EFFECT); mPath = gPrefs->Read(wxT("NyqBench/Path"), wxEmptyString); mAutoLoad = (gPrefs->Read(wxT("NyqBench/AutoLoad"), 0L) != 0); mAutoWrap = (gPrefs->Read(wxT("NyqBench/AutoWrap"), true) != 0); mLargeIcons = (gPrefs->Read(wxT("NyqBench/LargeIcons"), 0L) != 0); mSplitMode = gPrefs->Read(wxT("NyqBench/SplitMode"), wxSPLIT_VERTICAL); mShowCode = (gPrefs->Read(wxT("NyqBench/ShowScript"), true) != 0); mShowOutput = (gPrefs->Read(wxT("NyqBench/ShowOutput"), true) != 0); SetIcon(wxICON(AudacityLogo)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); ShuttleGui S(this, eIsCreating); PopulateOrExchange(S); wxMenuBar *bar = new wxMenuBar(); wxMenu *menu = new wxMenu(); menu->Append(wxID_NEW, wxT("&New\tCtrl+N")); menu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O")); menu->Append(wxID_SAVE, wxT("&Save...\tCtrl+S")); menu->Append(wxID_SAVEAS, wxT("Save &As...\tCtrl+Shift+S")); menu->AppendSeparator(); menu->Append(wxID_REVERT_TO_SAVED, _T("&Revert to Saved")); menu->AppendSeparator(); menu->AppendCheckItem(ID_AUTOLOAD, _T("Auto &Load Last File"))->Check(mAutoLoad); menu->AppendSeparator(); menu->Append(wxID_CLOSE, wxT("&Close Window\tCtrl+W")); bar->Append(menu, wxT("&File")); menu = new wxMenu(); menu->Append(wxID_UNDO, _("&Undo\tCtrl+Z")); menu->Append(wxID_REDO, _("&Redo\tCtrl+Y")); menu->AppendSeparator(); menu->Append(wxID_CUT, _("Cu&t\tCtrl+X")); menu->Append(wxID_COPY, _("&Copy\tCtrl+C")); menu->Append(wxID_PASTE, _("&Paste\tCtrl+V")); menu->Append(wxID_CLEAR, _("Cle&ar\tCtrl+L")); menu->AppendSeparator(); menu->Append(wxID_SELECTALL, _("Select A&ll\tCtrl+A")); menu->AppendSeparator(); menu->Append(wxID_FIND, _("&Find...\tCtrl+F")); menu->AppendSeparator(); wxMenu *sub = new wxMenu(); sub->Append(ID_MATCH, _("&Matching Paren\tF8")); sub->Append(ID_TOP, _("&Top S-expr\tF9")); sub->Append(ID_UP, _("&Higher S-expr\tF10")); sub->Append(ID_PREVIOUS, _("&Previous S-expr\tF11")); sub->Append(ID_NEXT, _("&Next S-expr\tF12")); menu->AppendSubMenu(sub, _("&Go to")); menu->AppendSeparator(); menu->AppendCheckItem(ID_AUTOWRAP, _T("Auto &Wrap"))->Check(mAutoWrap); bar->Append(menu, wxT("&Edit")); menu = new wxMenu(); menu->Append(ID_FONT, _("Select &Font...")); menu->AppendSeparator(); menu->Append(ID_SPLITV, _("Split &Vertically")); menu->Append(ID_SPLITH, _("Split &Horizontally")); menu->AppendSeparator(); menu->AppendCheckItem(ID_TOGGLECODE, _("Show S&cript")); menu->AppendCheckItem(ID_TOGGLEOUTPUT, _("Show &Output")); menu->AppendSeparator(); sub = new wxMenu(); sub->AppendRadioItem(ID_LARGEICONS, _("&Large Icons")); sub->AppendRadioItem(ID_SMALLICONS, _("&Small Icons")); menu->AppendSubMenu(sub, _("Toolbar")); bar->Append(menu, wxT("&View")); menu = new wxMenu(); menu->Append(ID_GO, _("&Go\tF5")); menu->Append(ID_STOP, _("&Stop\tF6")); bar->Append(menu, wxT("&Run")); #if defined(__WXMAC__) menu->Append(wxID_ABOUT, _("&About")); #else menu = new wxMenu(); menu->Append(wxID_ABOUT, _("&About")); bar->Append(menu, wxT("Help")); #endif SetMenuBar(bar); RecreateToolbar(mLargeIcons); wxRect r; r.SetX(gPrefs->Read(wxT("NyqBench/Window/X"), -1)); r.SetY(gPrefs->Read(wxT("NyqBench/Window/Y"), -1)); r.SetWidth(gPrefs->Read(wxT("NyqBench/Window/Width"), -1)); r.SetHeight(gPrefs->Read(wxT("NyqBench/Window/Height"), -1)); if (r == wxRect(-1, -1, -1, -1)) { Center(); } else { SetSize(r); } bool maximized = false; gPrefs->Read(wxT("NyqBench/Window/Maximized"), maximized); if (maximized) { Maximize(); } long sashpos; sashpos = gPrefs->Read(wxT("NyqBench/SplitX"), 0l); if (sashpos > 0) { mSplitter->SetSashPosition(sashpos); } wxString dflt = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT).GetNativeFontInfoDesc(); wxString desc; wxTextAttr attr; desc = gPrefs->Read(wxT("NyqBench/ScriptFont"), dflt); mScriptFont.SetNativeFontInfo(desc); #if defined(__WXMSW__) // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText(). // I don't know if this is something I'm doing wrong, but I'll have to look at this // later if I get bored. mScriptFont.SetEncoding(wxFONTENCODING_SYSTEM); #endif attr.SetFont(mScriptFont); mScript->SetDefaultStyle(attr); desc = gPrefs->Read(wxT("NyqBench/OutputFont"), dflt); mOutputFont.SetNativeFontInfo(desc); #if defined(__WXMSW__) // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText(). // I don't know if this is something I'm doing wrong, but I'll have to look at this // later if I get bored. mOutputFont.SetEncoding(wxFONTENCODING_SYSTEM); #endif attr.SetFont(mOutputFont); mOutput->SetDefaultStyle(attr); if (mAutoLoad && !mPath.GetFullPath().IsEmpty()) { LoadFile(); } SetWindowTitle(); }
MyFrame::MyFrame( const wxString& title, const wxPoint& pos, const wxSize& size ) : wxFrame( (wxFrame *)NULL, -1, title, pos, size ){ #ifdef __WXMAC__ wxApp::s_macAboutMenuItemId = Menu_About; #endif wxMenu *menuFile = new wxMenu(_T(""), wxMENU_TEAROFF); wxMenu *helpMenu = new wxMenu; helpMenu->Append( Menu_About, _T("&About...\tCtrl-A"), _T("Show about dialog") ); menuFile->Append( Menu_Quit, _T("E&xit\tAlt-X"), _T("Quit this program") ); wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(menuFile, _T("&File")); menuBar->Append(helpMenu, _T("&Help")); SetMenuBar(menuBar); CreateStatusBar(2); SetStatusText(_T("Drag the mouse in the frame above")); SetStatusText(_T("VTK/wx example"),1); // Widgets --- wxFlexGridSizer *m_sizer = new wxFlexGridSizer(1); SetSizer(m_sizer); m_pVTKWindow = new wxVTKRenderWindowInteractor(this, MY_VTK_WINDOW); m_pVTKWindow->UseCaptureMouseOn(); //m_pVTKWindow->DebugOn(); m_sizer->Add( m_pVTKWindow, 0, wxEXPAND ); wxSlider *m_slider1 = new wxSlider( this,Ctrl_Slider1, 50, 0, 100 ); m_sizer->Add( m_slider1, 0, wxEXPAND ); wxSlider *m_slider2 = new wxSlider( this,Ctrl_Slider2, 100, 0, 100 ); m_sizer->Add( m_slider2, 0, wxEXPAND ); wxSlider *m_slider3 = new wxSlider( this,Ctrl_Slider3, 8, 0, 64 ); m_sizer->Add( m_slider3, 0, wxEXPAND ); wxSlider *m_slider4 = new wxSlider( this,Ctrl_Slider4, 255, 0, 255 ); m_sizer->Add( m_slider4, 0, wxEXPAND ); wxSlider *m_slider5 = new wxSlider( this,Ctrl_Slider5, 255, 0, 255 ); m_sizer->Add( m_slider5, 0, wxEXPAND ); wxSlider *m_slider6 = new wxSlider( this,Ctrl_Slider6, 255, 0, 255 ); m_sizer->Add( m_slider6, 0, wxEXPAND ); // Add or remove widgets here // Connect their events to the event table above m_sizer->AddGrowableCol( 0, 1 ); m_sizer->AddGrowableRow( 0, 1 ); // Construct VTK --- ConstructVTK(); }
ThreadPicker::ThreadPicker() : wxModalFrame(NULL, -1, wxString(_T("Sleepy")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE) { SetIcon(sleepy_icon); wxMenu *menuFile = new wxMenu; menuFile->Append(wxID_OPEN, _T("&Open..."), _T("Opens an existing profile")); menuFile->Append(ProcWin_Launch, _T("&Launch..."), _T("Launches a new executable to profile")); menuFile->AppendSeparator(); menuFile->Append(ProcWin_Exit, _T("E&xit\tAlt-X"), _T("Quit this program")); wxMenu *menuTools = new wxMenu; menuTools->Append(ProcWin_Refresh, _T("&Refresh\tF5"), _T("Refreshes the process list")); menuTools->Append(ProcWin_Download, _T("&Download Symbols"), _T("Downloads symbols from a symbol server")); menuTools->AppendSeparator(); menuTools->Append(ProcWin_Options, _T("&Options..."), _T("Opens the options dialog")); // the "About" item should be in the help menu wxMenu *menuHelp = new wxMenu; menuHelp->Append(ProcWin_About, _T("&About...\tF1"), _T("Show about dialog")); // now append the freshly created menu to the menu bar... wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(menuFile, _T("&File")); menuBar->Append(menuTools, _T("&Tools")); menuBar->Append(menuHelp, _T("&Help")); // ... and attach this menu bar to the frame SetMenuBar(menuBar); wxBoxSizer *rootsizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *dlgsizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *topsizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *bottomsizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *leftsizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *rightsizer = new wxBoxSizer(wxVERTICAL); wxPanel *panel = new wxPanel(this); rootsizer->Add(panel, 1, wxEXPAND | wxALL); wxButton *ok_button = new wxButton(panel, wxID_OK, "Profile &Selected", wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_EXACTFIT); ok_button->SetBitmap(LoadPngResource(L"button_profilesel")); ok_button->SetBitmapPosition(wxRIGHT); ok_button->SetBitmapMargins(-1,-1); wxButton *all_button = new wxButton(panel, wxID_SELECTALL,"Profile &All", wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_EXACTFIT); all_button->SetBitmap(LoadPngResource(L"button_profileall")); all_button->SetBitmapPosition(wxRIGHT); all_button->SetBitmapMargins(-1,-1); all_button->Disable(); all_button->SetDefault(); // DE: 20090325 one list for processes and one list for selected process threads threadlist = new ThreadList(panel, wxDefaultPosition, wxDefaultSize, ok_button, all_button); processlist = new ProcessList(panel, wxDefaultPosition, wxDefaultSize, threadlist); leftsizer->Add(new wxStaticText(panel, -1, "Select a process to profile:"), 0, wxTOP, 5); leftsizer->Add(processlist, 1, wxEXPAND | wxTOP, 3); // DE: 20090325 title for thread list rightsizer->Add(new wxStaticText(panel, -1, "Select thread(s) to profile: (CTRL-click for multiple)"), 0, wxTOP, 5); rightsizer->Add(threadlist, 1, wxEXPAND | wxTOP, 3); wxButton *refreshButton = new wxButton(panel, ProcWin_Refresh, "Refresh", wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_EXACTFIT); refreshButton->SetBitmap(LoadPngResource(L"button_refresh")); refreshButton->SetBitmapPosition(wxRIGHT); refreshButton->SetBitmapMargins(-1,-1); refreshButton->SetToolTip("Refreshes the list of processes and threads."); wxButton *downloadButton = new wxButton(panel, ProcWin_Download, "Download", wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_EXACTFIT); downloadButton->SetBitmap(LoadPngResource(L"button_download")); downloadButton->SetBitmapPosition(wxRIGHT); downloadButton->SetBitmapMargins(-1,-1); downloadButton->SetToolTip("Downloads symbols from a remote symbol server."); wxSizer *buttons = new wxBoxSizer(wxHORIZONTAL); buttons->Add(refreshButton, 0, wxALIGN_LEFT | wxRIGHT, 5); buttons->Add(downloadButton, 0, wxALIGN_LEFT, 0); buttons->AddStretchSpacer(); buttons->Add(all_button, 0, wxALIGN_RIGHT, 0); buttons->Add(ok_button, 0, wxALIGN_RIGHT | wxLEFT, 5); bottomsizer->Add(buttons, 0, wxLEFT|wxRIGHT|wxEXPAND, 10); bottomsizer->AddSpacer(8); log = new wxTextCtrl(panel, ProcWin_Log, "", wxDefaultPosition, wxSize(100,100), wxTE_MULTILINE|wxTE_READONLY); bottomsizer->Add(log, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, 10); topsizer->Add(leftsizer, 1, wxEXPAND | wxLEFT, 10); topsizer->AddSpacer(10); topsizer->Add(rightsizer, 1, wxEXPAND | wxRIGHT, 10); dlgsizer->Add(topsizer, 1, wxEXPAND); dlgsizer->AddSpacer(8); dlgsizer->Add(bottomsizer, 0, wxEXPAND); panel->SetSizer(dlgsizer); panel->SetAutoLayout(TRUE); SetSizer(rootsizer); rootsizer->SetSizeHints(this); SetAutoLayout(TRUE); SetSize(wxSize(800, 500)); Centre(); g_symLog = symLogCallback; cur_picker = this; }