//--------------------------------------------------------- CVIEW_Base::CVIEW_Base(class CWKSP_Base_Item *pOwner, int View_ID, wxString Caption, int Icon_ID, bool bShow) : wxMDIChildFrame(g_pSAGA_Frame, -1, Caption, MDI_Get_Def_Position(), MDI_Get_Def_Size(), wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE) { m_pOwner = pOwner; m_View_ID = View_ID; m_Size_Min.x = 0; m_Size_Min.y = 0; SetStatusBarPane(-1); SetIcon(IMG_Get_Icon(Icon_ID)); if( bShow ) { Do_Show(); } }
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 disableAllTriggersFactory(menuFactories, toolsMenu, 0); new enableAllTriggersFactory(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, _("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 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); 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); 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 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(); }
ASSDrawFrame::ASSDrawFrame( wxApp *app, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(NULL, wxID_ANY, title, pos, size, style) { m_app = app; m_mgr.SetManagedWindow(this); #ifndef __UNIX__ m_mgr.SetFlags(m_mgr.GetFlags() | wxAUI_MGR_ALLOW_ACTIVE_PANE); #else m_mgr.SetFlags(wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_ALLOW_ACTIVE_PANE | wxAUI_MGR_RECTANGLE_HINT); #endif // set the frame icon SetIcon(wxICON(appico)); // Create status bar for the frame CreateStatusBar(3); int statwidths[] = { 64, -1, 64 }; GetStatusBar()->SetStatusWidths(3, statwidths); SetStatusBarPane(1); InitializeDefaultSettings(); // load config configfile = wxFileName(wxStandardPaths::Get().GetUserDataDir(), _T("ASSDraw3.cfg")).GetFullPath(); bool firsttime = !::wxFileExists(configfile); if (firsttime) { wxFileName::Mkdir(wxStandardPaths::Get().GetUserDataDir(), wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL); wxFileOutputStream(configfile).Close(); } wxFileInputStream cfgf(configfile); config = new wxFileConfig(cfgf); // nullify transformdlg transformdlg = NULL; Maximize(true); Show(true); // to get the right client size, must call Show() first // config LoadSettings(); // THE CANVAS m_canvas = new ASSDrawCanvas( this , this ); // shapes library shapelib = new ASSDrawShapeLibrary(this, this); // source text ctrl srctxtctrl = new ASSDrawSrcTxtCtrl(this, this); // settings settingsdlg = new ASSDrawSettingsDialog(this, this); settingsdlg->Init(); SetMenus(); SetToolBars(); SetPanes(); // config config->SetPath(_T("info")); wxString version; config->Read(_T("version"), &version); config->SetPath(_T("..")); default_perspective = m_mgr.SavePerspective(); // back up default perspective config->SetPath(_T("perspective")); wxString perspective; if (config->Read(_T("perspective"), &perspective) && version == VERSION) m_mgr.LoadPerspective(perspective, false); config->SetPath(_T("..")); config->SetPath(_T("library")); int n = 0; config->Read(_T("n"), &n); for (int i = 0; i < n; i++) { wxString libcmds; config->Read(wxString::Format(_T("%d"),i), &libcmds); shapelib->AddShapePreview(libcmds); } config->SetPath(_T("..")); m_mgr.Update(); m_canvas->SetFocus(); m_canvas->Show(); wxSize clientsize = m_canvas->GetClientSize(); m_canvas->ChangeZoomLevelTo(DEFAULT_SCALE, wxPoint(clientsize.x / 2, clientsize.y / 2)); m_canvas->MoveCanvasOriginTo(clientsize.x / 2, clientsize.y / 2); UpdateASSCommandStringToSrcTxtCtrl(m_canvas->GenerateASS()); UpdateFrameUI(); ApplySettings(); if (firsttime) _About(); else if (!behaviors.nosplashscreen) _About(3); helpcontroller.SetParentWindow(this); helpcontroller.Initialize(wxFileName(::wxGetCwd(), _T("ASSDraw3.chm")).GetFullPath()); }
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); }
MainWindow::MainWindow(void): wxFrame(NULL, wxID_ANY, wxString(wxT("CNC – øídicí systém")), wxDefaultPosition, wxSize(1000, 600), wxDEFAULT_FRAME_STYLE | wxMAXIMIZE) { //Naètení ikony hlavního okna wxIcon icon(wxT("IDI_ICON1"), wxBITMAP_TYPE_ICO_RESOURCE); if(!icon.IsOk()) { PostErrorMessage(wxT("Nepodaøilo ase naèíst ikonu hlavního okna")); } SetIcon(icon); //StatusBar statusBar = CreateStatusBar(4); statusBar->SetStatusText(wxT("Nepøipojeno k intepolátoru"), 0); statusBar->SetStatusText(wxT("Žádný program"), 1); statusBar->SetStatusText(wxT("Neznámá pozice"), 2); statusBar->SetStatusText(wxT("Stav neurèen"), 3); //Menu menu = new wxMenuBar; file = new wxMenu; file->Append(wxID_OPEN, wxT("Otevøít soubor s intrukcemi"), wxT("Otevøít soubor s programem"), false); file->Append(ID_OPEN_GCODE, wxT("Otevøít G-kód"), wxT("Otevøít soubor s programem"), false); file->Append(wxID_EXIT, wxT("&Konec")); menu->Append(file, wxT("&Soubor")); view = new wxMenu; view->Append(ID_RESETVIEW, wxT("Resetovat zobrazení drah"), wxT("Obnoví zobrazení"), false); view->Append(ID_RESETTRAJECTORY, wxT("Smazat stopu"), wxT("Smaže stopu nástroje"), false); view->Append(ID_TOGGLETRAJECTORY, wxT("Vypnout/zapnout stopu"), wxT(""), false); menu->Append(view, wxT("&Náhled")); SetMenuBar(menu); //Connect menus and buttons to the functions Connect(wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainWindow::OnOpen)); Connect(ID_OPEN_GCODE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainWindow::OnOpenGcode)); Connect(ID_RESETVIEW, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainWindow::OnViewReset)); Connect(ID_RESETTRAJECTORY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainWindow::OnTrajectoryReset)); Connect(ID_TOGGLETRAJECTORY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainWindow::OnTrajectoryToggle)); //Toolbar toolbar = CreateToolBar(); toolbar->SetToolBitmapSize(wxSize(48, 48)); toolbar->AddSeparator(); toolbar->AddTool(2, wxBitmap(wxT("IDB_STARTPROGRAM"), wxBITMAP_TYPE_BMP_RESOURCE), wxT("Spustit program")); toolbar->AddTool(3, wxBitmap(wxT("IDB_PAUSEPROGRAM"), wxBITMAP_TYPE_BMP_RESOURCE), wxT("Pozastavit program")); toolbar->AddTool(4, wxBitmap(wxT("IDB_STOPPROGRAM"), wxBITMAP_TYPE_BMP_RESOURCE), wxT("Zastavit program")); toolbar->Realize(); toolbar->EnableTool(1, false); toolbar->EnableTool(3, false); toolbar->EnableTool(4, false); SetStatusBarPane(-1); //Connect icons to the function Connect(2, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(MainWindow::OnRunProgram)); Connect(3, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(MainWindow::OnPauseProgram)); Connect(4, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(MainWindow::OnStopProgram)); //Splitter window topSplit = new wxSplitterWindow(this); //Content of the left leftPanel = new wxPanel(topSplit, 0, 0, 150, 150); //Content of the right downSplit = new wxSplitterWindow(topSplit); //Content of the downSplit middlePanel = new PreviewWindow(downSplit, 0, 0, 150, 150); rightPanel = new wxPanel(downSplit, 0, 0, 150, 150); //Split the windows topSplit->SplitVertically(leftPanel, downSplit, 250); downSplit->SplitVertically(middlePanel, rightPanel, -300); middlePanel->Reset(); topSplit->SetSashGravity(0); downSplit->SetSashGravity(1); topSplit->SetMinimumPaneSize(150); downSplit->SetMinimumPaneSize(200); //Content of the right panel codeView = new wxTextCtrl(rightPanel, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_AUTO_SCROLL | wxTE_READONLY | wxTE_RICH2 | wxHSCROLL | wxTE_NOHIDESEL); wxBoxSizer *sizeRight = new wxBoxSizer(wxVERTICAL); sizeRight->Add(codeView, 1, wxEXPAND | wxALL, 0); rightPanel->SetSizer(sizeRight); //Set the font wxFont codeFont(15, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL, false); codeView->SetDefaultStyle(wxTextAttr(wxColour((unsigned long)(0)), wxNullColour, codeFont)); //Initialization of USB - receivng messages obaout device state HWND hwnd = HWND(GetHWND()); DEV_BROADCAST_DEVICEINTERFACE NotificationFilter; ZeroMemory( &NotificationFilter, sizeof(NotificationFilter) ); NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE); NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; NotificationFilter.dbcc_classguid = DEVICE_INTERFACE; if(!RegisterDeviceNotification(hwnd, (void*)(&NotificationFilter), DEVICE_NOTIFY_WINDOW_HANDLE)) { wxString err; err << wxT("Chyba pøi incializaci notifikace pro zaøízení - chyba ") << GetLastError(); PostErrorMessage(err); } //Centre window Center(); Maximize(); middlePanel->Reset(); }
//--------------------------------------------------------- CSAGA_Frame::CSAGA_Frame(void) : wxMDIParentFrame(NULL, ID_WND_MAIN, SAGA_CAPTION, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxHSCROLL|wxVSCROLL|wxFRAME_NO_WINDOW_MENU) { //----------------------------------------------------- g_pSAGA_Frame = this; m_nTopWindows = 0; m_pTopWindows = NULL; m_pINFO = NULL; m_pData_Source = NULL; m_pActive = NULL; m_pWKSP = NULL; SG_Set_UI_Callback (Get_Callback()); SetIcon (IMG_Get_Icon(ID_IMG_SAGA_ICON_32)); SetDropTarget (new CSAGA_Frame_DropTarget); //----------------------------------------------------- int STATUSBAR_Sizes[STATUSBAR_COUNT] = { -1, -1, 90, 90, 90, -1 }; CreateStatusBar (STATUSBAR_COUNT); SetStatusWidths (STATUSBAR_COUNT, STATUSBAR_Sizes); SetStatusBarPane (STATUSBAR_DEFAULT); StatusBar_Set_Text (_TL("ready")); m_pProgressBar = ((CSAGA_Frame_StatusBar *)GetStatusBar())->m_pProgressBar; //----------------------------------------------------- m_pLayout = new wxAuiManager(this); m_pLayout->GetArtProvider()->SetColor (wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR, wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION) ); m_pLayout->GetArtProvider()->SetColor (wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE) ); m_pLayout->GetArtProvider()->SetMetric (wxAUI_DOCKART_GRADIENT_TYPE , wxAUI_GRADIENT_NONE); m_pLayout->GetArtProvider()->SetMetric (wxAUI_DOCKART_CAPTION_SIZE , 14); m_pLayout->SetFlags(m_pLayout->GetFlags() ^ wxAUI_MGR_TRANSPARENT_DRAG); // m_pLayout->SetFlags(m_pLayout->GetFlags() ^ wxAUI_MGR_ALLOW_ACTIVE_PANE); //----------------------------------------------------- _Bar_Add(m_pINFO = new CINFO (this), 0, 0); m_pINFO ->Add_Pages(); _Bar_Add(m_pWKSP = new CWKSP (this), 2, 1); m_pWKSP ->Add_Pages(); _Bar_Add(m_pData_Source = new CData_Source(this), 2, 1); m_pData_Source ->Add_Pages(); _Bar_Add(m_pActive = new CACTIVE (this), 2, 0); m_pActive ->Add_Pages(); //----------------------------------------------------- _Create_MenuBar(); //----------------------------------------------------- m_pTB_Main = _Create_ToolBar(); m_pTB_Map = CVIEW_Map ::_Create_ToolBar(); m_pTB_Map_3D = CVIEW_Map_3D ::_Create_ToolBar(); m_pTB_Layout = CVIEW_Layout ::_Create_ToolBar(); m_pTB_Table = CVIEW_Table ::_Create_ToolBar(); m_pTB_Diagram = CVIEW_Table_Diagram ::_Create_ToolBar(); m_pTB_Histogram = CVIEW_Histogram ::_Create_ToolBar(); m_pTB_ScatterPlot = CVIEW_ScatterPlot ::_Create_ToolBar(); //----------------------------------------------------- m_pLayout->GetPane(GetClientWindow()).Show().Center(); wxString s; if( CONFIG_Read(wxT("/FL"), wxT("MANAGER"), s) ) { m_pLayout->LoadPerspective(s); } _Bar_Show(m_pTB_Main, true); //----------------------------------------------------- m_pLayout->Update(); #if !defined(_SAGA_LINUX) Show(true); #endif int x, y, dx, dy; long l; x = CONFIG_Read(wxT("/FL"), wxT("X" ), l) ? l : -1; y = CONFIG_Read(wxT("/FL"), wxT("Y" ), l) ? l : -1; dx = CONFIG_Read(wxT("/FL"), wxT("DX"), l) ? l : 800; dy = CONFIG_Read(wxT("/FL"), wxT("DY"), l) ? l : 600; SetSize(x, y, dx, dy); if( !(CONFIG_Read(wxT("/FL"), wxT("STATE"), l) && l == 0) ) { Maximize(); } #if defined(_SAGA_LINUX) Show(true); #endif Update(); //----------------------------------------------------- if( g_pSAGA->argc <= 1 && g_pData->Initialise() ) { Refresh(false); } ProgressBar_Set_Position(0); }
frmDatabaseDesigner::frmDatabaseDesigner(frmMain *form, const wxString& _title) //DD-TODO: pgConn *_conn, const wxString& query, const wxString& file) :pgFrame(NULL, _title) { //DD-todo: this is just a development window and SHOULD BE FINISHED IN A FUTURE BUT THIS IS NOT PRIORITY RIGHT NOW mainForm=form; //RestorePosition(100, 100, 600, 500, 450, 300); // notify wxAUI which frame to use manager.SetManagedWindow(this); manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_TRANSPARENT_DRAG); SetMinSize(wxSize(450,300)); SetSize(wxSize(1024,768)); wxWindowBase::SetFont(settings->GetSystemFont()); menuBar = new wxMenuBar(); wxMenu *helpMenu=new wxMenu(); helpMenu->Append(MNU_CONTENTS, _("&Help"), _("Open the helpfile.")); helpMenu->Append(MNU_HELP, _("&SQL Help\tF1"), _("Display help on SQL commands.")); menuBar->Append(helpMenu, _("&Help")); SetMenuBar(menuBar); int iWidths[6] = {0, -1, 40, 150, 80, 80}; wxStatusBar *statusBar =CreateStatusBar(6); SetStatusBarPane(-1); SetStatusWidths(6, iWidths); SetStatusText(_("ready"), STATUSPOS_MSGS); toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER); toolBar->SetToolBitmapSize(wxSize(16, 16)); toolBar->AddTool(MNU_NEW, _("New"), wxBitmap(file_new_xpm), _("New window"), wxITEM_NORMAL); toolBar->AddSeparator(); toolBar->AddTool(MNU_HELP, _("Help"), wxBitmap(help_xpm), _("Display help on SQL commands."), wxITEM_NORMAL); toolBar->Realize(); wxNotebook *notebook = new wxNotebook(this, CTL_NTBKCENTER, wxDefaultPosition, wxDefaultSize); wxSplitterWindow *ddMainContainer = new wxSplitterWindow(notebook,GQB_HORZ_SASH,wxDefaultPosition,wxDefaultSize,wxSP_3D); wxPanel *pnlQuery = new wxPanel(ddMainContainer); wxPanel *pnlQuery2 = new wxPanel(notebook); design = NULL; design = new ddDatabaseDesign(ddMainContainer); // tool = new ddSelectionTool(editor); // editor->setTool(tool); ddMainContainer->SplitVertically(pnlQuery,design->getView()); ddMainContainer->UpdateSize(); ddMainContainer->SetSashPosition(50,true); ddMainContainer->SetMinimumPaneSize(10); ddMainContainer->UpdateSize(); notebook->AddPage(ddMainContainer, _("Database Designer")); notebook->AddPage(pnlQuery2, _("Empty")); notebook->SetSelection(0); manager.AddPane(notebook, wxAuiPaneInfo().Name(wxT("sqlQuery")).Caption(_("Database Designer")).Center().CaptionVisible(false).CloseButton(false).MinSize(wxSize(200,100)).BestSize(wxSize(350,200))); manager.AddPane(toolBar, wxAuiPaneInfo().Name(wxT("toolBar")).Caption(_("Tool bar")).ToolbarPane().Top().LeftDockable(false).RightDockable(false)); manager.Update(); //***************************************************************************************************** // TEST DATA //***************************************************************************************************** /* f=new ddRectangleFigure(); f->displayBox().SetPosition(wxPoint(5,5)); f->displayBox().width=100; f->displayBox().height=100; //f->setSelected(false); design->addTable(f); f2=new ddRectangleFigure(); f2->displayBox().SetPosition(wxPoint(150,150)); f2->displayBox().width=130; f2->displayBox().height=130; //f2->setSelected(true); design->addTable(f2); f3=new ddRectangleFigure(); f3->displayBox().SetPosition(wxPoint(290,290)); f3->displayBox().width=130; f3->displayBox().height=130; design->addTable(f3); //ddPolyLineFigure *f3 = new ddPolyLineFigure(); //Rectangle // f3->addPoint (10, 10); // f3->addPoint (60, 10); // f3->addPoint (60, 60); // f3->addPoint (10, 60); // f3->addPoint (10, 10); //OR // //Trianglw // f3->addPoint (15, 15); // f3->addPoint (55, 55); // f3->addPoint (15, 55); // f3->addPoint (45, 75); // //editor->view()->add(f3); //antes editor->setTool(new ddDragCreationTool(editor,f3)); /*ddLineConnection *f4 = new ddLineConnection(); f4->setStartTerminal(new ddLineTerminal()); f4->setEndTerminal(new ddLineTerminal()); //design->setTool(new ddConnectionCreationTool(design->getEditor(),f4)); //SetIcon(wxIcon(sql_32_xpm)); */ /* ddSimpleTextFigure *f5 = new ddSimpleTextFigure(wxString(wxT("Texto Solito"))); f5->displayBox().SetPosition(wxPoint(60,60)); f5->setEditable(true); design->addTable(f5); */ ddTableFigure *f6 = new ddTableFigure(225,225); ddColumnFigure *f61 = new ddColumnFigure(wxString(wxT("Id")),f6); f61->displayBox().SetPosition(wxPoint(260,270)); //f61->setEditable(true); ddColumnFigure *f62 = new ddColumnFigure(wxString(wxT("SomeValue2")),f6); f62->displayBox().SetPosition(wxPoint(260,290)); ddColumnFigure *f63 = new ddColumnFigure(wxString(wxT("SomeValue3")),f6); f63->displayBox().SetPosition(wxPoint(260,310)); ddColumnFigure *f64 = new ddColumnFigure(wxString(wxT("SomeValue4")),f6); f64->displayBox().SetPosition(wxPoint(260,330)); ddColumnFigure *f65 = new ddColumnFigure(wxString(wxT("SomeValue5")),f6); f65->displayBox().SetPosition(wxPoint(260,330)); ddColumnFigure *f66 = new ddColumnFigure(wxString(wxT("SomeValue6")),f6); f66->displayBox().SetPosition(wxPoint(260,330)); ddColumnFigure *f67 = new ddColumnFigure(wxString(wxT("SomeValue7")),f6); f67->displayBox().SetPosition(wxPoint(260,330)); ddColumnFigure *f68 = new ddColumnFigure(wxString(wxT("SomeValue8")),f6); f68->displayBox().SetPosition(wxPoint(260,330)); f6->addColumn(f68); f6->addColumn(f67); f6->addColumn(f66); f6->addColumn(f65); f6->addColumn(f64); f6->addColumn(f63); f6->addColumn(f62); f6->addColumn(f61); design->addTable(f6); ddTableFigure *f7 = new ddTableFigure(100,100); ddColumnFigure *f71 = new ddColumnFigure(wxString(wxT("Id")),f7); f71->displayBox().SetPosition(wxPoint(260,270)); //f71->setEditable(true); ddColumnFigure *f72 = new ddColumnFigure(wxString(wxT("Amount")),f7); f72->displayBox().SetPosition(wxPoint(260,290)); //f72->setEditable(true); f7->addColumn(f72); f7->addColumn(f71); design->addTable(f7); ddTableFigure *f8 = new ddTableFigure(350,100); design->addTable(f8); }