X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d96cdd4a885886d1c76c6f4cb1a7eefba34b3d10..b271d60d6a009930d80092a8cb534a5df19fc99b:/utils/configtool/src/mainframe.cpp diff --git a/utils/configtool/src/mainframe.cpp b/utils/configtool/src/mainframe.cpp index d214233eb0..31965e2164 100644 --- a/utils/configtool/src/mainframe.cpp +++ b/utils/configtool/src/mainframe.cpp @@ -9,23 +9,25 @@ // Licence: ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "mainframe.h" -#endif - -#include "wx/wx.h" +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif +#ifndef WX_PRECOMP + +#include "wx/splitter.h" + +#endif + +#include "wx/cshelp.h" #include "wx/html/htmlwin.h" #include "wx/notebook.h" -#include "wx/splitter.h" -#include "wx/clipbrd.h" #include "wx/dataobj.h" -#include "wx/cshelp.h" - +#include "wx/clipbrd.h" +#include "wx/stockitem.h" #include "wxconfigtool.h" #include "mainframe.h" #include "appsettings.h" @@ -104,7 +106,7 @@ ctMainFrame::ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, m_findDialog = NULL; m_treeSplitterWindow = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxSize(400, 300), - wxSP_3DSASH|wxSP_3DBORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); + wxSP_3DSASH|wxSP_3DBORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|wxSP_NO_XP_THEME); m_configTreeCtrl = new ctConfigTreeCtrl(m_treeSplitterWindow, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN); @@ -187,11 +189,11 @@ void ctMainFrame::OnCloseWindow(wxCloseEvent& event) wxGetApp().GetSettings().m_frameStatus = ctSHOW_STATUS_MINIMIZED ; else wxGetApp().GetSettings().m_frameStatus = ctSHOW_STATUS_NORMAL ; - + // Must delete this now since the DLL loading library will be // uninitialised by the time the app object is deleted wxGetApp().ClearHelpControllers(); - + if (!IsMaximized() && !IsIconized()) { wxGetApp().GetSettings().m_frameSize = GetRect(); @@ -248,22 +250,22 @@ void ctMainFrame::InitToolBar(wxToolBar* toolBar) toolBarBitmaps[12] = wxBitmap(help_xpm); toolBarBitmaps[13] = wxBitmap(helpcs_xpm); - toolBar->AddTool(wxID_NEW, toolBarBitmaps[0], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("New project")); - toolBar->AddTool(wxID_OPEN, toolBarBitmaps[1], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Open project")); - toolBar->AddTool(wxID_SAVE, toolBarBitmaps[2], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Save project")); + toolBar->AddTool(wxID_NEW, toolBarBitmaps[0], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxT("New project")); + toolBar->AddTool(wxID_OPEN, toolBarBitmaps[1], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxT("Open project")); + toolBar->AddTool(wxID_SAVE, toolBarBitmaps[2], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxT("Save project")); toolBar->AddSeparator(); - toolBar->AddTool(wxID_CUT, toolBarBitmaps[4], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Cut")); - toolBar->AddTool(wxID_COPY, toolBarBitmaps[3], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Copy")); - toolBar->AddTool(wxID_PASTE, toolBarBitmaps[5], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Paste")); + toolBar->AddTool(wxID_CUT, toolBarBitmaps[4], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxGetStockLabel(wxID_CUT, false)); + toolBar->AddTool(wxID_COPY, toolBarBitmaps[3], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxGetStockLabel(wxID_COPY, false)); + toolBar->AddTool(wxID_PASTE, toolBarBitmaps[5], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxGetStockLabel(wxID_PASTE, false)); toolBar->AddSeparator(); - toolBar->AddTool(wxID_UNDO, toolBarBitmaps[10], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Undo")); - toolBar->AddTool(wxID_REDO, toolBarBitmaps[11], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Redo")); + toolBar->AddTool(wxID_UNDO, toolBarBitmaps[10], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxGetStockLabel(wxID_UNDO, false)); + toolBar->AddTool(wxID_REDO, toolBarBitmaps[11], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxGetStockLabel(wxID_REDO, false)); toolBar->AddSeparator(); - toolBar->AddTool(ctID_GO, toolBarBitmaps[6], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Save setup.h or configurewx.sh")); + toolBar->AddTool(ctID_GO, toolBarBitmaps[6], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxT("Save setup.h or configurewx.sh")); toolBar->AddSeparator(); - toolBar->AddTool(ctID_ITEM_HELP, toolBarBitmaps[12], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Show help for this option")); - toolBar->AddTool(wxID_HELP_CONTEXT, toolBarBitmaps[13], wxNullBitmap, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL, wxT("Show help on the clicked item")); + toolBar->AddTool(ctID_ITEM_HELP, toolBarBitmaps[12], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxT("Show help for this option")); + toolBar->AddTool(wxID_HELP_CONTEXT, toolBarBitmaps[13], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxT("Show help on the clicked item")); // after adding the buttons to the toolbar, must call Realize() to reflect // the changes @@ -274,33 +276,33 @@ wxMenuBar* ctMainFrame::CreateMenuBar() { // Make a menubar wxMenu *fileMenu = new wxMenu; - + wxGetApp().GetFileHistory().UseMenu(fileMenu); - - fileMenu->Append(wxID_NEW, wxT("&New...\tCtrl+N"), wxT("Create a new settings document")); - fileMenu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O"), wxT("Open a settings document")); - fileMenu->Append(wxID_CLOSE, wxT("&Close\tCtrl+W"), wxT("Close the current settings document")); + + fileMenu->Append(wxID_NEW, wxGetStockLabel(wxID_NEW, true, wxT("Ctrl+N")), wxT("Create a new settings document")); + fileMenu->Append(wxID_OPEN, wxGetStockLabel(wxID_OPEN, true, wxT("Ctrl+O")), wxT("Open a settings document")); + fileMenu->Append(wxID_CLOSE, wxGetStockLabel(wxID_CLOSE, true, wxT("Ctrl+W")), wxT("Close the current settings document")); fileMenu->AppendSeparator(); - fileMenu->Append(wxID_SAVE, wxT("&Save\tCtrl+S"), wxT("Save the settings document")); - fileMenu->Append(wxID_SAVEAS, wxT("&Save As..."), wxT("Save the settings document under a new filename")); + fileMenu->Append(wxID_SAVE, wxGetStockLabel(wxID_SAVE, true, wxT("Ctrl+S")), wxT("Save the settings document")); + fileMenu->Append(wxID_SAVEAS, wxGetStockLabel(wxID_SAVEAS), wxT("Save the settings document under a new filename")); fileMenu->AppendSeparator(); 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")); + fileMenu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT, true, wxT("Alt+F4")), wxT("Exit the application")); wxGetApp().GetDocManager()->FileHistoryUseMenu(fileMenu); - + wxMenu *editMenu = new wxMenu; - editMenu->Append(wxID_UNDO, _("&Undo\tCtrl+Z")); - editMenu->Append(wxID_REDO, _("&Redo\tCtrl+Y")); + editMenu->Append(wxID_UNDO, wxGetStockLabel(wxID_UNDO, true, wxT("Ctrl+Z"))); + editMenu->Append(wxID_REDO, wxGetStockLabel(wxID_REDO, true, wxT("Ctrl+Y"))); editMenu->AppendSeparator(); - editMenu->Append(wxID_COPY, _("&Copy\tCtrl+C")); - editMenu->Append(wxID_CUT, _("Cu&t\tCtrl+X")); - editMenu->Append(wxID_PASTE, _("&Paste\tCtrl+V")); + editMenu->Append(wxID_COPY, wxGetStockLabel(wxID_CLOSE, true, wxT("Ctrl+C"))); + editMenu->Append(wxID_CUT, wxGetStockLabel(wxID_CUT, true, wxT("Ctrl+X"))); + editMenu->Append(wxID_PASTE, wxGetStockLabel(wxID_PASTE, true, wxT("Ctrl+V"))); editMenu->AppendSeparator(); wxMenu* itemMenu = new wxMenu; @@ -326,7 +328,7 @@ wxMenuBar* ctMainFrame::CreateMenuBar() 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")); + editMenu->Append(wxID_FIND, wxGetStockLabel(wxID_FIND, true, wxT("Ctrl+F")), _("Search for a string in the settings document")); // Save for the command processor. m_editMenu = editMenu; @@ -344,9 +346,9 @@ wxMenuBar* ctMainFrame::CreateMenuBar() helpMenu->Append(wxID_HELP_CONTEXT, wxT("&What's this?"), wxT("Show help on the clicked item")); helpMenu->AppendSeparator(); helpMenu->Append(wxID_ABOUT, wxT("&About..."), wxT("Show details about this application")); - + wxMenuBar *menuBar = new wxMenuBar; - + menuBar->Append(fileMenu, wxT("&File")); menuBar->Append(editMenu, wxT("&Edit")); menuBar->Append(viewMenu, wxT("&View")); @@ -356,7 +358,7 @@ wxMenuBar* ctMainFrame::CreateMenuBar() wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("wxWidgets")); config.SetPath(wxT("FileHistory/")); wxGetApp().GetDocManager()->FileHistoryLoad(config); - } + } return menuBar; } @@ -415,7 +417,9 @@ void ctMainFrame::OnUpdateDisable(wxUpdateUIEvent& event) IMPLEMENT_CLASS(ctOutputWindow, wxPanel) BEGIN_EVENT_TABLE(ctOutputWindow, wxPanel) +#if wxUSE_CLIPBOARD EVT_BUTTON(wxID_COPY, ctOutputWindow::OnCopyToClipboard) +#endif // wxUSE_CLIPBOARD EVT_BUTTON(wxID_SAVE, ctOutputWindow::OnSaveText) EVT_BUTTON(ctID_REGENERATE, ctOutputWindow::OnRegenerate) EVT_UPDATE_UI(wxID_SAVE, ctOutputWindow::OnUpdateSaveText) @@ -433,10 +437,6 @@ ctOutputWindow::ctOutputWindow(wxWindow* parent, wxWindowID id, CreateWindows(); } -ctOutputWindow::~ctOutputWindow() -{ -} - /// Initialise the windows. void ctOutputWindow::CreateWindows() { @@ -469,6 +469,7 @@ void ctOutputWindow::CreateWindows() SetSizer( item0 ); } +#if wxUSE_CLIPBOARD /// Copies the text to the clipboard. void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event)) { @@ -487,13 +488,13 @@ void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event)) wxMessageBox(_("Sorry, could not open the clipboard."), _("Clipboard problem"), wxICON_EXCLAMATION|wxOK); return; } - + wxString value(m_codeCtrl->GetValue()); #ifdef __WXMSW__ value.Replace(_T("\n"), _T("\r\n")); #endif wxTextDataObject *data = new wxTextDataObject( value ); - + if (!wxTheClipboard->SetData( data )) { wxTheClipboard->Close(); @@ -504,6 +505,7 @@ void ctOutputWindow::OnCopyToClipboard(wxCommandEvent& WXUNUSED(event)) wxTheClipboard->Close(); } } +#endif // wxUSE_CLIPBOARD /// Sets the code in the text control. void ctOutputWindow::SetText(const wxString& text) @@ -525,7 +527,7 @@ void ctOutputWindow::OnSaveText(wxCommandEvent& WXUNUSED(event)) if (m_codeCtrl->IsModified()) { wxString filename(m_filenameCtrl->GetValue()); - if (!filename.IsEmpty()) + if (!filename.empty()) { m_codeCtrl->SaveFile(filename); m_codeCtrl->DiscardEdits();