void frmMain::CreateControls() { frmMain* itemFrame1 = this; wxMenuBar* menuBar = new wxMenuBar; wxMenu* itemMenu3 = new wxMenu; itemMenu3->Append( ID_MENUITEM_OPEN_VSCP_SESSION, _("VSCP client window..."), wxEmptyString, wxITEM_NORMAL); itemMenu3->Append( ID_MENUITEM_DEVICE_CONFIGURATION, _("VSCP device configuration window..."), wxEmptyString, wxITEM_NORMAL); itemMenu3->Append( ID_MENUITEM_MDF_EDITOR, _("VSCP MDF Editor..."), wxEmptyString, wxITEM_NORMAL); itemMenu3->Append( ID_MENUITEM_DM_EDITOR, _("VSCP Daemon Decision Matrix Editor..."), wxEmptyString, wxITEM_NORMAL); itemMenu3->Append( ID_MENUITEM_VARIABLE_EDITOR, _("VSCP Daemon Variable Editor..."), wxEmptyString, wxITEM_NORMAL); itemMenu3->AppendSeparator(); itemMenu3->Append( ID_MENUITEM_SCAN, _("Scan for devices..."), wxEmptyString, wxITEM_NORMAL); itemMenu3->Append( ID_MENUITEM_BOOTLOADER_WIZARD, _("VSCP bootloader wizard..."), wxEmptyString, wxITEM_NORMAL); itemMenu3->AppendSeparator(); itemMenu3->Append( ID_MENUITEM_SIMPLE_UI_DESIGNER, _("VSCP Simple UI designer..."), wxEmptyString, wxITEM_NORMAL); itemMenu3->AppendSeparator(); itemMenu3->Append( ID_MENU_VSCPWORKS_EXIT, _("Exit"), wxEmptyString, wxITEM_NORMAL); // VSCP Menu menuBar->Append(itemMenu3, _("VSCP")); wxMenu* itemMenu17 = new wxMenu; itemMenu17->Append( ID_MENUITEM_CONFIGURATION, _("Settings..."), wxEmptyString, wxITEM_NORMAL); // Tools menu menuBar->Append(itemMenu17, _("Tools")); wxMenu* itemMenu21 = new wxMenu; itemMenu21->Append( ID_MENUITEM33, _("VSCP-Works Help"), wxEmptyString, wxITEM_NORMAL); itemMenu21->Append( ID_MENUITEM34, _("Frequently Asked Questions"), wxEmptyString, wxITEM_NORMAL); itemMenu21->Append( ID_MENUITEM35, _("Keyboard shortcuts"), wxEmptyString, wxITEM_NORMAL); itemMenu21->AppendSeparator(); itemMenu21->Append( ID_MENUITEM_THANKS, _("Thanks..."), wxEmptyString, wxITEM_NORMAL); itemMenu21->Append( ID_MENUITEM_CREDITS, _("Credits..."), wxEmptyString, wxITEM_NORMAL); itemMenu21->AppendSeparator(); itemMenu21->Append( ID_MENUITEM_VSCP_SITE, _("Go to VSCP site"), wxEmptyString, wxITEM_NORMAL); itemMenu21->AppendSeparator(); itemMenu21->Append( ID_MENUITEM_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); menuBar->Append (itemMenu21, _("Help") ); itemFrame1->SetMenuBar( menuBar ); // Statusbar m_pitemStatusBar = new wxStatusBar; m_pitemStatusBar->Create( itemFrame1, ID_STATUSBAR, wxST_SIZEGRIP|wxNO_BORDER ); //m_pitemStatusBar->SetFieldsCount( 2 ); itemFrame1->SetStatusBar( m_pitemStatusBar ); // Toolbar wxToolBar* itemToolBar = CreateToolBar( wxTB_FLAT | wxTB_HORIZONTAL | wxTB_NODIVIDER, ID_TOOLBAR ); wxBitmap itemtool34Bitmap( itemFrame1->GetBitmapResource( wxT("open.xpm") ) ); wxBitmap itemtool34BitmapDisabled; itemToolBar->AddTool( ID_TOOL, wxEmptyString, itemtool34Bitmap, itemtool34BitmapDisabled, wxITEM_NORMAL, wxEmptyString, wxEmptyString ); itemToolBar->Realize(); itemFrame1->SetToolBar( itemToolBar ); wxPanel* itemPanel = new wxPanel; itemPanel->Create( itemFrame1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); itemPanel->SetBackgroundColour( wxColour( 255, 255, 255 ) ); wxBoxSizer* itemBoxSizerPanel = new wxBoxSizer( wxVERTICAL ); itemPanel->SetSizer( itemBoxSizerPanel ); m_pStaticBitmapLogo = new wxStaticBitmap; m_pStaticBitmapLogo->Create( itemPanel, wxID_STATIC, itemFrame1->GetBitmapResource( wxT("../../../docs/vscp/logo/vscp_logo.jpg") ), wxDefaultPosition, wxSize(151, 212), 0 ); m_pStaticBitmapLogo->SetBackgroundColour( wxColour( 255, 255, 255 ) ); itemBoxSizerPanel->Add( m_pStaticBitmapLogo, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 0 ); wxString strVersion = _( VSCPD_COPYRIGHT ); strVersion += _( " - " ); strVersion += _( VSCPD_DISPLAY_VERSION ); m_pitemStatusBar->SetStatusText( strVersion ); }
void GamessQFrame::CreateControls() { ////@begin GamessQFrame content construction GamessQFrame* itemFrame1 = this; wxMenuBar* menuBar = new wxMenuBar; AppMenu = new wxMenu; AppMenu->Append(wxID_PREFERENCES, _("&Preferences"), _("Change the way GamessQ behaves"), wxITEM_NORMAL); AppMenu->Append(ID_PAUSEALL, _("&Pause All"), _("Pause Everything"), wxITEM_CHECK); AppMenu->AppendSeparator(); AppMenu->Append(wxID_EXIT, _("E&xit"), _("Exit GamessQ"), wxITEM_NORMAL); menuBar->Append(AppMenu, _("&Queue")); jobsMenu = new wxMenu; { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_ADD, _("&Add Jobs\tCtrl+A"), _("Add new GAMESS jobs to the end of the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_REMOVE, _("Remove Jobs"), _("Remove the selected GAMESS jobs from the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CANCEL, _("&Cancel Jobs"), _("Cancel the selected GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_PAUSE, _("&Pause Jobs\tCtrl+P"), _("Pause the selected GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_RESUME, _("&Resume Jobs\tCtrl+R"), _("Resume the selected paused GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEFOLDER, _("Save Output to Folder\tCtrl+S"), _("Save GAMESS output for selected jobs to a folder"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSave"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEAS, _("Save Output As..."), _("Save GAMESS output for this job"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSaveAs"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->Append(ID_MACMOLPLT, _("Open in wxMacMolPlt\tCtrl+O"), _T(""), wxITEM_NORMAL); jobsMenu->Append(ID_VIEWLOGS, _("View &Logs"), _("View the GAMESS log files for the selected jobs"), wxITEM_NORMAL); jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_REFRESH, _("Refresh\tAlt-R"), _("Refresh the display of the queue status"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CLEAR, _("Clean Up"), _("Clear all finished GAMESS jobs from the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } menuBar->Append(jobsMenu, _("&Jobs")); //Yes this is a complete copy of the menu that was just added to the Menubar. At least in //wx 3.0 wx throws an assertion saying that a popupmenu is not supposed to be attached to //another menu or menubar. So after attaching the previous copy recreate it. The copy //attached to the menu is now "owned" by the Menu/window. jobsMenu = new wxMenu; { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_ADD, _("&Add Jobs\tCtrl+A"), _("Add new GAMESS jobs to the end of the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_REMOVE, _("Remove Jobs"), _("Remove the selected GAMESS jobs from the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CANCEL, _("&Cancel Jobs"), _("Cancel the selected GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_PAUSE, _("&Pause Jobs\tCtrl+P"), _("Pause the selected GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_RESUME, _("&Resume Jobs\tCtrl+R"), _("Resume the selected paused GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEFOLDER, _("Save Output to Folder\tCtrl+S"), _("Save GAMESS output for selected jobs to a folder"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSave"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEAS, _("Save Output As..."), _("Save GAMESS output for this job"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSaveAs"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->Append(ID_MACMOLPLT, _("Open in wxMacMolPlt\tCtrl+O"), _T(""), wxITEM_NORMAL); jobsMenu->Append(ID_VIEWLOGS, _("View &Logs"), _("View the GAMESS log files for the selected jobs"), wxITEM_NORMAL); jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_REFRESH, _("Refresh\tAlt-R"), _("Refresh the display of the queue status"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CLEAR, _("Clean Up"), _("Clear all finished GAMESS jobs from the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } wxMenu* itemMenu24 = new wxMenu; itemMenu24->Append(wxID_ABOUT, _("&About"), _T(""), wxITEM_NORMAL); menuBar->Append(itemMenu24, _("&Help")); itemFrame1->SetMenuBar(menuBar); jobsToolbar = CreateToolBar( wxTB_FLAT|wxTB_HORIZONTAL|wxTB_TEXT|wxTB_NODIVIDER, ID_TOOLBAR1 ); jobsToolbar->SetToolBitmapSize(wxSize(24, 24)); wxBitmap itemtool27Bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-24.png"))); wxBitmap itemtool27BitmapDisabled; jobsToolbar->AddTool(wxID_ADD, _("Add"), itemtool27Bitmap, itemtool27BitmapDisabled, wxITEM_NORMAL, _T(""), _("Add a new GAMESS jobs to the end of the queue")); wxBitmap itemtool28Bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-24.png"))); wxBitmap itemtool28BitmapDisabled; jobsToolbar->AddTool(wxID_REMOVE, _("Remove"), itemtool28Bitmap, itemtool28BitmapDisabled, wxITEM_NORMAL, _T(""), _("Remove the selected GAMESS jobs from the queue")); jobsToolbar->AddSeparator(); wxBitmap itemtool30Bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-24.png"))); wxBitmap itemtool30BitmapDisabled; jobsToolbar->AddTool(wxID_CANCEL, _("Cancel"), itemtool30Bitmap, itemtool30BitmapDisabled, wxITEM_NORMAL, _T(""), _("Cancel the selected GAMESS jobs")); wxBitmap itemtool31Bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-24.png"))); wxBitmap itemtool31BitmapDisabled; jobsToolbar->AddTool(ID_PAUSE, _("Pause"), itemtool31Bitmap, itemtool31BitmapDisabled, wxITEM_NORMAL, _T(""), _("Pause the selected GAMESS jobs")); wxBitmap itemtool32Bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-24.png"))); wxBitmap itemtool32BitmapDisabled; jobsToolbar->AddTool(ID_RESUME, _("Resume"), itemtool32Bitmap, itemtool32BitmapDisabled, wxITEM_NORMAL, _T(""), _("Resume the selected paused GAMESS jobs")); jobsToolbar->AddSeparator(); wxBitmap itemtool34Bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-24.png"))); wxBitmap itemtool34BitmapDisabled; jobsToolbar->AddTool(ID_REFRESH, _("Refresh"), itemtool34Bitmap, itemtool34BitmapDisabled, wxITEM_NORMAL, _T(""), _("Refresh the display of the queue status")); jobsToolbar->AddSeparator(); wxBitmap itemtool36Bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-24.png"))); wxBitmap itemtool36BitmapDisabled; jobsToolbar->AddTool(wxID_CLEAR, _("Clean Up"), itemtool36Bitmap, itemtool36BitmapDisabled, wxITEM_NORMAL, _T(""), _("Clear all finished GAMESS jobs from the queue")); jobsToolbar->Realize(); itemFrame1->SetToolBar(jobsToolbar); wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxVERTICAL); itemFrame1->SetSizer(itemBoxSizer37); jobListCtrl = new wxListCtrl( itemFrame1, ID_JOBLISTCTRL, wxDefaultPosition, wxSize(590, 300), wxLC_REPORT|wxLC_EDIT_LABELS|wxLC_HRULES|wxLC_VRULES|wxSUNKEN_BORDER ); itemBoxSizer37->Add(jobListCtrl, 1, wxGROW|wxALL, 0); wxStatusBar* itemStatusBar39 = new wxStatusBar( itemFrame1, ID_STATUSBAR1, wxNO_BORDER ); itemStatusBar39->SetFieldsCount(1); itemFrame1->SetStatusBar(itemStatusBar39); ////@end GamessQFrame content construction // create the dialog objects mConfigDialog = new ConfigurationDialog(this); mJobOptionsDialog = new JobOptionsDialog(this); // initiate the queue manager, if this fails, we're toast if (! mQueueManager.Init()) { wxLogFatalError(wxT("Failed to start the backend!")); } mActive = mQueueManager.IsActive(); AppMenu->Check(ID_PAUSEALL, ! mActive); // load settings mConfig = new wxConfig(WX_CONFIG_APPNAME); wxString stringFreq; long freq; if (mConfig->Read(wxT("Refresh Frequency"), &freq)) { mRefreshFrequency = freq; } else { mConfigDialog->SetRefreshFrequency(mRefreshFrequency / 1000); mConfigDialog->SetGamessPath(mQueueManager.GetGamessDir()); mConfigDialog->SetSpoolDir(mQueueManager.GetSpoolDir()); mConfigDialog->Show(); } // start the timer mRefreshTimer = new wxTimer(this, ID_TIMER); mRefreshTimer->Start(mRefreshFrequency, wxTIMER_ONE_SHOT); // set up the queue list jobListCtrl->InsertColumn(0, wxT("Name")); jobListCtrl->InsertColumn(1, wxT("Processors")); jobListCtrl->InsertColumn(2, wxT("Status")); jobListCtrl->SetColumnWidth(0, 400); jobListCtrl->SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER); jobListCtrl->SetColumnWidth(2, 80); RefreshList(); RefreshButtons(); SetDropTarget(new DropTarget(this)); }