#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"
END_EVENT_TABLE()
// Define my frame constructor
-ctMainFrame::ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size,
- long style):
+ctMainFrame::ctMainFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
wxDocParentFrame(manager, parent, id, title, pos, size, style)
{
m_document = NULL;
m_mainNotebook = NULL;
m_findDialog = NULL;
- m_treeSplitterWindow = new wxSplitterWindow(this, -1, wxDefaultPosition, wxSize(400, 300),
+ m_treeSplitterWindow = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxSize(400, 300),
wxSP_3DSASH|wxSP_3DBORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
- m_configTreeCtrl = new ctConfigTreeCtrl(m_treeSplitterWindow, -1, wxDefaultPosition, wxDefaultSize,
+ m_configTreeCtrl = new ctConfigTreeCtrl(m_treeSplitterWindow, wxID_ANY, wxDefaultPosition, wxDefaultSize,
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, wxID_ANY, wxDefaultPosition, wxSize(300, 300),
wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
- m_propertyEditor = new ctPropertyEditor(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
+ m_propertyEditor = new ctPropertyEditor(m_mainNotebook, wxID_ANY, wxDefaultPosition, wxSize(300, 200),
wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
- m_setupPage = new ctOutputWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
+ m_setupPage = new ctOutputWindow(m_mainNotebook, wxID_ANY, wxDefaultPosition, wxSize(300, 200),
wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
- m_configurePage = new ctOutputWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
+ m_configurePage = new ctOutputWindow(m_mainNotebook, wxID_ANY, wxDefaultPosition, wxSize(300, 200),
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),
+ m_configBrowserPage = new ctConfigurationBrowserWindow(m_mainNotebook, wxID_ANY, wxDefaultPosition, wxSize(300, 200),
wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
#endif
SetIcon(wxIcon(wxconfigtool_xpm));
+#if wxUSE_STATUSBAR
CreateStatusBar(2);
+#endif // wxUSE_STATUSBAR
wxMenuBar* menuBar = CreateMenuBar();
SetMenuBar(menuBar);
if (wxGetApp().GetSettings().m_showToolBar)
{
- menuBar->Check(ctID_SHOW_TOOLBAR, TRUE);
+ menuBar->Check(ctID_SHOW_TOOLBAR, true);
}
else
{
- menuBar->Check(ctID_SHOW_TOOLBAR, FALSE);
- GetToolBar()->Show(FALSE);
+ menuBar->Check(ctID_SHOW_TOOLBAR, false);
+ GetToolBar()->Show(false);
ResizeFrame();
}
}
m_findDialog = NULL;
}
- Show(FALSE);
+ Show(false);
if (IsMaximized())
wxGetApp().GetSettings().m_frameStatus = ctSHOW_STATUS_MAXIMIZED ;
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();
toolBarBitmaps[12] = wxBitmap(help_xpm);
toolBarBitmaps[13] = wxBitmap(helpcs_xpm);
- toolBar->AddTool(wxID_NEW, toolBarBitmaps[0], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("New project"));
- toolBar->AddTool(wxID_OPEN, toolBarBitmaps[1], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Open project"));
- toolBar->AddTool(wxID_SAVE, toolBarBitmaps[2], wxNullBitmap, FALSE, -1, -1, (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, -1, -1, (wxObject *) NULL, wxT("Cut"));
- toolBar->AddTool(wxID_COPY, toolBarBitmaps[3], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Copy"));
- toolBar->AddTool(wxID_PASTE, toolBarBitmaps[5], wxNullBitmap, FALSE, -1, -1, (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, -1, -1, (wxObject *) NULL, wxT("Undo"));
- toolBar->AddTool(wxID_REDO, toolBarBitmaps[11], wxNullBitmap, FALSE, -1, -1, (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, -1, -1, (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, -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"));
+ 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
{
// 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;
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;
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"));
wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("wxWidgets"));
config.SetPath(wxT("FileHistory/"));
wxGetApp().GetDocManager()->FileHistoryLoad(config);
- }
+ }
return menuBar;
}
// General disabler
void ctMainFrame::OnUpdateDisable(wxUpdateUIEvent& event)
{
- event.Enable( FALSE );
+ event.Enable( false );
}
/*!
CreateWindows();
}
-ctOutputWindow::~ctOutputWindow()
-{
-}
-
/// Initialise the windows.
void ctOutputWindow::CreateWindows()
{
item5->SetHelpText(_("Regenerates the code."));
#if 0
- m_filenameCtrl = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTE_READONLY);
+ m_filenameCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTE_READONLY);
item2->Add( m_filenameCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_filenameCtrl->SetHelpText(_("Shows the filename where the code is being saved."));
#else
#endif
// The code editor
- m_codeCtrl = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxSize(100, 100), wxTE_RICH|wxTE_MULTILINE|wxSUNKEN_BORDER);
+ m_codeCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100, 100), wxTE_RICH|wxTE_MULTILINE|wxSUNKEN_BORDER);
item0->Add( m_codeCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( item0 );
}
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();
if (m_codeCtrl->IsModified())
{
wxString filename(m_filenameCtrl->GetValue());
- if (!filename.IsEmpty())
+ if (!filename.empty())
{
m_codeCtrl->SaveFile(filename);
m_codeCtrl->DiscardEdits();