// Licence:
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#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/dataobj.h"
#include "wx/clipbrd.h"
-#include "wx/cshelp.h"
-
#include "wxconfigtool.h"
#include "mainframe.h"
#include "appsettings.h"
#include "propeditor.h"
#include "configtooldoc.h"
#include "configtoolview.h"
+#include "configbrowser.h"
#include "bitmaps/wxconfigtool.xpm"
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_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);
+ 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, wxID_ANY, wxDefaultPosition, wxDefaultSize,
+ wxTR_HAS_BUTTONS|wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
- m_configTreeCtrl = new ctConfigTreeCtrl(m_treeSplitterWindow, -1, wxDefaultPosition, wxDefaultSize,
- wxTR_HAS_BUTTONS|wxNO_BORDER);
+ m_mainNotebook = new wxNotebook(m_treeSplitterWindow, wxID_ANY, wxDefaultPosition, wxSize(300, 300),
+ wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
- m_mainNotebook = new wxNotebook(m_treeSplitterWindow, -1, wxDefaultPosition, wxSize(300, 300));
+ 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, wxID_ANY, wxDefaultPosition, wxSize(300, 200),
+ wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
+ 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, wxID_ANY, wxDefaultPosition, wxSize(300, 200),
+ wxNO_BORDER|wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
+#endif
- m_propertyEditor = new ctPropertyEditor(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
- wxNO_BORDER);
- m_setupPage = new ctOutputWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
- wxNO_BORDER);
- m_configurePage = new ctOutputWindow(m_mainNotebook, -1, wxDefaultPosition, wxSize(300, 200),
- wxNO_BORDER);
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"));
SetIcon(wxIcon(wxconfigtool_xpm));
+#if wxUSE_STATUSBAR
CreateStatusBar(2);
+#endif // wxUSE_STATUSBAR
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)
{
- 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();
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();
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();
}
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, wxT("Cut"));
+ toolBar->AddTool(wxID_COPY, toolBarBitmaps[3], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxT("Copy"));
+ toolBar->AddTool(wxID_PASTE, toolBarBitmaps[5], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (wxObject *) NULL, wxT("Paste"));
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, wxT("Undo"));
+ toolBar->AddTool(wxID_REDO, toolBarBitmaps[11], wxNullBitmap, false, wxDefaultCoord, wxDefaultCoord, (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->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_EXIT, wxT("E&xit\tAlt+F4"), wxT("Exit the application"));
wxGetApp().GetDocManager()->FileHistoryUseMenu(fileMenu);
-
+
wxMenu *editMenu = new wxMenu;
editMenu->Append(wxID_UNDO, _("&Undo\tCtrl+Z"));
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(wxID_HELP, wxT("&Help Contents"), wxT("Show Configuration Tool help"));
- helpMenu->Append(ctID_REFERENCE_CONTENTS, wxT("&wxWindows Help Contents"), wxT("Show wxWindows reference"));
+ helpMenu->Append(ctID_REFERENCE_CONTENTS, wxT("&wxWidgets Help Contents"), wxT("Show wxWidgets reference"));
helpMenu->AppendSeparator();
helpMenu->Append(ctID_ITEM_HELP, wxT("&Configuration Option Help\tF1"), wxT("Show help for the selected option"));
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"));
menuBar->Append(helpMenu, wxT("&Help"));
{
- wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("wxWindows"));
+ wxConfig config(wxGetApp().GetSettings().GetAppName(), wxT("wxWidgets"));
config.SetPath(wxT("FileHistory/"));
wxGetApp().GetDocManager()->FileHistoryLoad(config);
- }
+ }
return menuBar;
}
/// 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);
}
/// 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();
}
// 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 );
}
/// 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;
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();
}
/// Saves the file.
-void ctOutputWindow::OnSaveText(wxCommandEvent& event)
+void ctOutputWindow::OnSaveText(wxCommandEvent& WXUNUSED(event))
{
if (m_codeCtrl->IsModified())
{
event.Enable(m_doc && m_codeCtrl && m_codeCtrl->IsModified());
}
-void ctOutputWindow::OnRegenerate(wxCommandEvent& event)
+void ctOutputWindow::OnRegenerate(wxCommandEvent& WXUNUSED(event))
{
if (m_doc)
{