X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f8105809ef8f7cb0d1a9933f3f790b7b446c7cfa..ace1785b153d4873a7c7684047c144facd11a26d:/utils/configtool/src/mainframe.cpp diff --git a/utils/configtool/src/mainframe.cpp b/utils/configtool/src/mainframe.cpp index e0d9d79788..ff22400c82 100644 --- a/utils/configtool/src/mainframe.cpp +++ b/utils/configtool/src/mainframe.cpp @@ -9,7 +9,7 @@ // Licence: ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "mainframe.h" #endif @@ -23,6 +23,7 @@ #include "wx/notebook.h" #include "wx/splitter.h" #include "wx/clipbrd.h" +#include "wx/dataobj.h" #include "wx/cshelp.h" #include "wxconfigtool.h" @@ -33,6 +34,7 @@ #include "propeditor.h" #include "configtooldoc.h" #include "configtoolview.h" +#include "configbrowser.h" #include "bitmaps/wxconfigtool.xpm" @@ -46,6 +48,7 @@ #include "bitmaps/undo.xpm" #include "bitmaps/redo.xpm" #include "bitmaps/helpcs.xpm" +#include "bitmaps/go.xpm" IMPLEMENT_CLASS(ctMainFrame, wxDocParentFrame) @@ -80,6 +83,10 @@ BEGIN_EVENT_TABLE(ctMainFrame, wxDocParentFrame) EVT_UPDATE_UI(ctID_SAVE_SETUP_FILE, ctMainFrame::OnUpdateDisable) EVT_UPDATE_UI(ctID_SAVE_CONFIGURE_COMMAND, ctMainFrame::OnUpdateDisable) + + EVT_UPDATE_UI(wxID_FIND, ctMainFrame::OnUpdateDisable) + + EVT_UPDATE_UI(ctID_GO, ctMainFrame::OnUpdateDisable) END_EVENT_TABLE() // Define my frame constructor @@ -91,23 +98,37 @@ ctMainFrame::ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, m_editMenu = NULL; m_configurePage = NULL; m_setupPage = NULL; +#ifdef USE_CONFIG_BROWSER_PAGE + m_configBrowserPage = NULL; +#endif m_mainNotebook = NULL; + m_findDialog = NULL; m_treeSplitterWindow = new wxSplitterWindow(this, -1, wxDefaultPosition, wxSize(400, 300), - wxSP_3DSASH|wxSP_3DBORDER); + wxSP_3DSASH|wxSP_3DBORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); m_configTreeCtrl = new ctConfigTreeCtrl(m_treeSplitterWindow, -1, wxDefaultPosition, wxDefaultSize, - wxTR_HAS_BUTTONS|wxNO_BORDER); + wxTR_HAS_BUTTONS|wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); - m_mainNotebook = new wxNotebook(m_treeSplitterWindow, -1, wxDefaultPosition, wxSize(300, 300)); + m_mainNotebook = new wxNotebook(m_treeSplitterWindow, -1, wxDefaultPosition, wxSize(300, 300), + wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); m_propertyEditor = new ctPropertyEditor(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200), - wxNO_BORDER); + wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); m_setupPage = new ctOutputWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200), - wxNO_BORDER); + wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); m_configurePage = new ctOutputWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200), - wxNO_BORDER); + wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); + +#ifdef USE_CONFIG_BROWSER_PAGE + m_configBrowserPage = new ctConfigurationBrowserWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200), + wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); +#endif + m_mainNotebook->AddPage(m_propertyEditor, _T("Properties")); +#ifdef USE_CONFIG_BROWSER_PAGE + m_mainNotebook->AddPage(m_configBrowserPage, _T("Configuration Browser")); +#endif m_mainNotebook->AddPage(m_setupPage, _T("setup.h")); m_mainNotebook->AddPage(m_configurePage, _T("configure")); @@ -125,7 +146,7 @@ ctMainFrame::ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, wxMenuBar* menuBar = CreateMenuBar(); SetMenuBar(menuBar); - CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL); + CreateToolBar(wxNO_BORDER|wxTB_FLAT|wxTB_HORIZONTAL|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); InitToolBar(GetToolBar()); if (wxGetApp().GetSettings().m_showToolBar) @@ -151,6 +172,12 @@ void ctMainFrame::OnCloseWindow(wxCloseEvent& event) } } + if (m_findDialog) + { + m_findDialog->Destroy(); + m_findDialog = NULL; + } + Show(FALSE); if (IsMaximized()) @@ -173,11 +200,11 @@ void ctMainFrame::OnCloseWindow(wxCloseEvent& event) Destroy(); } -void ctMainFrame::OnAbout(wxCommandEvent& event) +void ctMainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxString msg = wxGetApp().GetSettings().GetAppName() + wxT(" (c) Julian Smart"); wxString caption = wxT("About ") + wxGetApp().GetSettings().GetAppName(); - wxMessageBox(msg, caption, wxID_OK|wxICON_INFORMATION); + wxMessageBox(msg, caption, wxOK|wxICON_INFORMATION); } void ctMainFrame::OnOpen(wxCommandEvent& event) @@ -190,12 +217,12 @@ void ctMainFrame::OnNew(wxCommandEvent& event) wxGetApp().GetDocManager()->OnFileNew(event); } -void ctMainFrame::OnExit(wxCommandEvent& event) +void ctMainFrame::OnExit(wxCommandEvent& WXUNUSED(event)) { Close(); } -void ctMainFrame::OnSettings(wxCommandEvent& event) +void ctMainFrame::OnSettings(wxCommandEvent& WXUNUSED(event)) { wxGetApp().GetSettings().ShowSettingsDialog(); } @@ -213,7 +240,7 @@ void ctMainFrame::InitToolBar(wxToolBar* toolBar) toolBarBitmaps[3] = wxBitmap(copy_xpm); toolBarBitmaps[4] = wxBitmap(cut_xpm); toolBarBitmaps[5] = wxBitmap(paste_xpm); -// toolBarBitmaps[6] = wxBitmap(print_xpm); + toolBarBitmaps[6] = wxBitmap(go_xpm); toolBarBitmaps[7] = wxBitmap(help_xpm); toolBarBitmaps[10] = wxBitmap(undo_xpm); toolBarBitmaps[11] = wxBitmap(redo_xpm); @@ -232,6 +259,8 @@ void ctMainFrame::InitToolBar(wxToolBar* toolBar) toolBar->AddTool(wxID_UNDO, toolBarBitmaps[10], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Undo")); toolBar->AddTool(wxID_REDO, toolBarBitmaps[11], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Redo")); toolBar->AddSeparator(); + toolBar->AddTool(ctID_GO, toolBarBitmaps[6], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Save setup.h or configurewx.sh")); + toolBar->AddSeparator(); toolBar->AddTool(ctID_ITEM_HELP, toolBarBitmaps[12], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Show help for this option")); toolBar->AddTool(wxID_HELP_CONTEXT, toolBarBitmaps[13], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Show help on the clicked item")); @@ -257,6 +286,8 @@ wxMenuBar* ctMainFrame::CreateMenuBar() fileMenu->Append(ctID_SAVE_SETUP_FILE, wxT("Save Setup.&h...\tCtrl+H"), wxT("Save the setup.h file")); fileMenu->Append(ctID_SAVE_CONFIGURE_COMMAND, wxT("Save Configure Script...\tCtrl+G"), wxT("Save the configure script file")); fileMenu->AppendSeparator(); + fileMenu->Append(ctID_GO, wxT("&Go\tF5"), wxT("Quick-save the setup.h or configure.sh file")); + fileMenu->AppendSeparator(); fileMenu->Append(wxID_EXIT, wxT("E&xit\tAlt+F4"), wxT("Exit the application")); wxGetApp().GetDocManager()->FileHistoryUseMenu(fileMenu); @@ -293,6 +324,8 @@ wxMenuBar* ctMainFrame::CreateMenuBar() editMenu->AppendSeparator(); editMenu->Append(ctID_DELETE_ITEM, _("&Delete Option"), _("Delete a configuration option")); editMenu->Append(ctID_RENAME_ITEM, _("&Rename Option"), _("Rename a configuration option")); + editMenu->AppendSeparator(); + editMenu->Append(wxID_FIND, _("&Find...\tCtrl+F"), _("Search for a string in the settings document")); // Save for the command processor. m_editMenu = editMenu; @@ -328,7 +361,7 @@ wxMenuBar* ctMainFrame::CreateMenuBar() } /// Handles the Show Toolbar menu event. -void ctMainFrame::OnShowToolbar(wxCommandEvent& event) +void ctMainFrame::OnShowToolbar(wxCommandEvent& WXUNUSED(event)) { wxGetApp().GetSettings().m_showToolBar = !wxGetApp().GetSettings().m_showToolBar; GetToolBar()->Show(wxGetApp().GetSettings().m_showToolBar); @@ -336,19 +369,19 @@ void ctMainFrame::OnShowToolbar(wxCommandEvent& event) } /// Handles the Help Contents menu event. -void ctMainFrame::OnHelp(wxCommandEvent& event) +void ctMainFrame::OnHelp(wxCommandEvent& WXUNUSED(event)) { wxGetApp().GetHelpController().DisplayContents(); } /// Handles context help -void ctMainFrame::OnContextHelp(wxCommandEvent& event) +void ctMainFrame::OnContextHelp(wxCommandEvent& WXUNUSED(event)) { wxContextHelp contextHelp; } /// Handles the Help Contents menu event for the reference manual. -void ctMainFrame::OnReferenceHelp(wxCommandEvent& event) +void ctMainFrame::OnReferenceHelp(wxCommandEvent& WXUNUSED(event)) { wxGetApp().GetReferenceHelpController().DisplayContents(); } @@ -436,7 +469,7 @@ void ctOutputWindow::CreateWindows() } /// Copies the text to the clipboard. -void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& event) +void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event)) { // Try to copy the selection first long int selFrom, selTo; @@ -486,7 +519,7 @@ void ctOutputWindow::SetFilename(const wxString& filename) } /// Saves the file. -void ctOutputWindow::OnSaveText(wxCommandEvent& event) +void ctOutputWindow::OnSaveText(wxCommandEvent& WXUNUSED(event)) { if (m_codeCtrl->IsModified()) { @@ -504,7 +537,7 @@ void ctOutputWindow::OnUpdateSaveText(wxUpdateUIEvent& event) event.Enable(m_doc && m_codeCtrl && m_codeCtrl->IsModified()); } -void ctOutputWindow::OnRegenerate(wxCommandEvent& event) +void ctOutputWindow::OnRegenerate(wxCommandEvent& WXUNUSED(event)) { if (m_doc) {