1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "mainframe.h"
22 #include "wx/html/htmlwin.h"
23 #include "wx/notebook.h"
24 #include "wx/splitter.h"
25 #include "wx/clipbrd.h"
26 #include "wx/cshelp.h"
28 #include "wxconfigtool.h"
29 #include "mainframe.h"
30 #include "appsettings.h"
32 #include "configtree.h"
33 #include "propeditor.h"
34 #include "configtooldoc.h"
35 #include "configtoolview.h"
37 #include "bitmaps/wxconfigtool.xpm"
39 #include "bitmaps/copy.xpm"
40 #include "bitmaps/cut.xpm"
41 #include "bitmaps/paste.xpm"
42 #include "bitmaps/open.xpm"
43 #include "bitmaps/save.xpm"
44 #include "bitmaps/new.xpm"
45 #include "bitmaps/help.xpm"
46 #include "bitmaps/undo.xpm"
47 #include "bitmaps/redo.xpm"
48 #include "bitmaps/helpcs.xpm"
50 IMPLEMENT_CLASS(ctMainFrame
, wxDocParentFrame
)
52 BEGIN_EVENT_TABLE(ctMainFrame
, wxDocParentFrame
)
53 EVT_CLOSE(ctMainFrame::OnCloseWindow
)
54 EVT_MENU(wxID_ABOUT
, ctMainFrame::OnAbout
)
55 EVT_MENU(wxID_OPEN
, ctMainFrame::OnOpen
)
56 EVT_MENU(wxID_NEW
, ctMainFrame::OnNew
)
57 EVT_MENU(wxID_EXIT
, ctMainFrame::OnExit
)
58 EVT_MENU(ctID_SETTINGS
, ctMainFrame::OnSettings
)
59 EVT_MENU(ctID_SHOW_TOOLBAR
, ctMainFrame::OnShowToolbar
)
60 EVT_MENU(wxID_HELP
, ctMainFrame::OnHelp
)
61 EVT_MENU(ctID_REFERENCE_CONTENTS
, ctMainFrame::OnReferenceHelp
)
62 EVT_MENU(wxID_HELP_CONTEXT
, ctMainFrame::OnContextHelp
)
64 EVT_UPDATE_UI(ctID_ADD_ITEM_CHECKBOX
, ctMainFrame::OnUpdateDisable
)
65 EVT_UPDATE_UI(ctID_ADD_ITEM_RADIOBUTTON
, ctMainFrame::OnUpdateDisable
)
66 EVT_UPDATE_UI(ctID_ADD_ITEM_GROUP
, ctMainFrame::OnUpdateDisable
)
67 EVT_UPDATE_UI(ctID_ADD_ITEM_CHECK_GROUP
, ctMainFrame::OnUpdateDisable
)
68 EVT_UPDATE_UI(ctID_ADD_ITEM_RADIO_GROUP
, ctMainFrame::OnUpdateDisable
)
69 EVT_UPDATE_UI(ctID_ADD_ITEM_STRING
, ctMainFrame::OnUpdateDisable
)
70 EVT_UPDATE_UI(ctID_DELETE_ITEM
, ctMainFrame::OnUpdateDisable
)
71 EVT_UPDATE_UI(ctID_RENAME_ITEM
, ctMainFrame::OnUpdateDisable
)
72 EVT_UPDATE_UI(wxID_COPY
, ctMainFrame::OnUpdateDisable
)
73 EVT_UPDATE_UI(wxID_CUT
, ctMainFrame::OnUpdateDisable
)
74 EVT_UPDATE_UI(wxID_PASTE
, ctMainFrame::OnUpdateDisable
)
75 EVT_UPDATE_UI(ctID_ITEM_HELP
, ctMainFrame::OnUpdateDisable
)
77 EVT_UPDATE_UI(ctID_ADD_CUSTOM_PROPERTY
, ctMainFrame::OnUpdateDisable
)
78 EVT_UPDATE_UI(ctID_EDIT_CUSTOM_PROPERTY
, ctMainFrame::OnUpdateDisable
)
79 EVT_UPDATE_UI(ctID_DELETE_CUSTOM_PROPERTY
, ctMainFrame::OnUpdateDisable
)
81 EVT_UPDATE_UI(ctID_SAVE_SETUP_FILE
, ctMainFrame::OnUpdateDisable
)
82 EVT_UPDATE_UI(ctID_SAVE_CONFIGURE_COMMAND
, ctMainFrame::OnUpdateDisable
)
84 EVT_UPDATE_UI(wxID_FIND
, ctMainFrame::OnUpdateDisable
)
87 // Define my frame constructor
88 ctMainFrame::ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
,
90 wxDocParentFrame(manager
, parent
, id
, title
, pos
, size
, style
)
94 m_configurePage
= NULL
;
96 m_mainNotebook
= NULL
;
99 m_treeSplitterWindow
= new wxSplitterWindow(this, -1, wxDefaultPosition
, wxSize(400, 300),
100 wxSP_3DSASH
|wxSP_3DBORDER
);
102 m_configTreeCtrl
= new ctConfigTreeCtrl(m_treeSplitterWindow
, -1, wxDefaultPosition
, wxDefaultSize
,
103 wxTR_HAS_BUTTONS
|wxNO_BORDER
);
105 m_mainNotebook
= new wxNotebook(m_treeSplitterWindow
, -1, wxDefaultPosition
, wxSize(300, 300));
107 m_propertyEditor
= new ctPropertyEditor(m_mainNotebook
, -1, wxDefaultPosition
, wxSize(300, 200),
109 m_setupPage
= new ctOutputWindow(m_mainNotebook
, -1, wxDefaultPosition
, wxSize(300, 200),
111 m_configurePage
= new ctOutputWindow(m_mainNotebook
, -1, wxDefaultPosition
, wxSize(300, 200),
113 m_mainNotebook
->AddPage(m_propertyEditor
, _T("Properties"));
114 m_mainNotebook
->AddPage(m_setupPage
, _T("setup.h"));
115 m_mainNotebook
->AddPage(m_configurePage
, _T("configure"));
117 // Need to do this afterwards since wxWin sets the XP background
119 m_propertyEditor
->GetDescriptionWindow()->SetBackgroundColour(ctDESCRIPTION_BACKGROUND_COLOUR
);
121 int sashPos
= wxGetApp().GetSettings().m_mainSashSize
;
122 m_treeSplitterWindow
->SplitVertically(m_configTreeCtrl
, m_mainNotebook
, sashPos
);
124 SetIcon(wxIcon(wxconfigtool_xpm
));
128 wxMenuBar
* menuBar
= CreateMenuBar();
131 CreateToolBar(wxNO_BORDER
|wxTB_FLAT
|wxTB_HORIZONTAL
);
132 InitToolBar(GetToolBar());
134 if (wxGetApp().GetSettings().m_showToolBar
)
136 menuBar
->Check(ctID_SHOW_TOOLBAR
, TRUE
);
140 menuBar
->Check(ctID_SHOW_TOOLBAR
, FALSE
);
141 GetToolBar()->Show(FALSE
);
146 void ctMainFrame::OnCloseWindow(wxCloseEvent
& event
)
150 if (!GetDocument()->DeleteAllViews() && event
.CanVeto())
159 m_findDialog
->Destroy();
166 wxGetApp().GetSettings().m_frameStatus
= ctSHOW_STATUS_MAXIMIZED
;
167 else if (IsIconized())
168 wxGetApp().GetSettings().m_frameStatus
= ctSHOW_STATUS_MINIMIZED
;
170 wxGetApp().GetSettings().m_frameStatus
= ctSHOW_STATUS_NORMAL
;
172 // Must delete this now since the DLL loading library will be
173 // uninitialised by the time the app object is deleted
174 wxGetApp().ClearHelpControllers();
176 if (!IsMaximized() && !IsIconized())
178 wxGetApp().GetSettings().m_frameSize
= GetRect();
179 wxGetApp().GetSettings().m_mainSashSize
= m_treeSplitterWindow
->GetSashPosition();
185 void ctMainFrame::OnAbout(wxCommandEvent
& event
)
187 wxString msg
= wxGetApp().GetSettings().GetAppName() + wxT(" (c) Julian Smart");
188 wxString caption
= wxT("About ") + wxGetApp().GetSettings().GetAppName();
189 wxMessageBox(msg
, caption
, wxID_OK
|wxICON_INFORMATION
);
192 void ctMainFrame::OnOpen(wxCommandEvent
& event
)
194 wxGetApp().GetDocManager()->OnFileOpen(event
);
197 void ctMainFrame::OnNew(wxCommandEvent
& event
)
199 wxGetApp().GetDocManager()->OnFileNew(event
);
202 void ctMainFrame::OnExit(wxCommandEvent
& event
)
207 void ctMainFrame::OnSettings(wxCommandEvent
& event
)
209 wxGetApp().GetSettings().ShowSettingsDialog();
212 void ctMainFrame::InitToolBar(wxToolBar
* toolBar
)
214 toolBar
->SetHelpText(wxT("The toolbar gives you easy access to commonly used commands."));
217 wxBitmap toolBarBitmaps
[20];
219 toolBarBitmaps
[0] = wxBitmap(new_xpm
);
220 toolBarBitmaps
[1] = wxBitmap(open_xpm
);
221 toolBarBitmaps
[2] = wxBitmap(save_xpm
);
222 toolBarBitmaps
[3] = wxBitmap(copy_xpm
);
223 toolBarBitmaps
[4] = wxBitmap(cut_xpm
);
224 toolBarBitmaps
[5] = wxBitmap(paste_xpm
);
225 // toolBarBitmaps[6] = wxBitmap(print_xpm);
226 toolBarBitmaps
[7] = wxBitmap(help_xpm
);
227 toolBarBitmaps
[10] = wxBitmap(undo_xpm
);
228 toolBarBitmaps
[11] = wxBitmap(redo_xpm
);
229 toolBarBitmaps
[12] = wxBitmap(help_xpm
);
230 toolBarBitmaps
[13] = wxBitmap(helpcs_xpm
);
232 toolBar
->AddTool(wxID_NEW
, toolBarBitmaps
[0], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("New project"));
233 toolBar
->AddTool(wxID_OPEN
, toolBarBitmaps
[1], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Open project"));
234 toolBar
->AddTool(wxID_SAVE
, toolBarBitmaps
[2], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Save project"));
236 toolBar
->AddSeparator();
237 toolBar
->AddTool(wxID_CUT
, toolBarBitmaps
[4], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Cut"));
238 toolBar
->AddTool(wxID_COPY
, toolBarBitmaps
[3], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Copy"));
239 toolBar
->AddTool(wxID_PASTE
, toolBarBitmaps
[5], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Paste"));
240 toolBar
->AddSeparator();
241 toolBar
->AddTool(wxID_UNDO
, toolBarBitmaps
[10], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Undo"));
242 toolBar
->AddTool(wxID_REDO
, toolBarBitmaps
[11], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Redo"));
243 toolBar
->AddSeparator();
244 toolBar
->AddTool(ctID_ITEM_HELP
, toolBarBitmaps
[12], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Show help for this option"));
245 toolBar
->AddTool(wxID_HELP_CONTEXT
, toolBarBitmaps
[13], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Show help on the clicked item"));
247 // after adding the buttons to the toolbar, must call Realize() to reflect
252 wxMenuBar
* ctMainFrame::CreateMenuBar()
255 wxMenu
*fileMenu
= new wxMenu
;
257 wxGetApp().GetFileHistory().UseMenu(fileMenu
);
259 fileMenu
->Append(wxID_NEW
, wxT("&New...\tCtrl+N"), wxT("Create a new settings document"));
260 fileMenu
->Append(wxID_OPEN
, wxT("&Open...\tCtrl+O"), wxT("Open a settings document"));
261 fileMenu
->Append(wxID_CLOSE
, wxT("&Close\tCtrl+W"), wxT("Close the current settings document"));
262 fileMenu
->AppendSeparator();
263 fileMenu
->Append(wxID_SAVE
, wxT("&Save\tCtrl+S"), wxT("Save the settings document"));
264 fileMenu
->Append(wxID_SAVEAS
, wxT("&Save As..."), wxT("Save the settings document under a new filename"));
265 fileMenu
->AppendSeparator();
266 fileMenu
->Append(ctID_SAVE_SETUP_FILE
, wxT("Save Setup.&h...\tCtrl+H"), wxT("Save the setup.h file"));
267 fileMenu
->Append(ctID_SAVE_CONFIGURE_COMMAND
, wxT("Save Configure Script...\tCtrl+G"), wxT("Save the configure script file"));
268 fileMenu
->AppendSeparator();
269 fileMenu
->Append(wxID_EXIT
, wxT("E&xit\tAlt+F4"), wxT("Exit the application"));
271 wxGetApp().GetDocManager()->FileHistoryUseMenu(fileMenu
);
273 wxMenu
*editMenu
= new wxMenu
;
275 editMenu
->Append(wxID_UNDO
, _("&Undo\tCtrl+Z"));
276 editMenu
->Append(wxID_REDO
, _("&Redo\tCtrl+Y"));
277 editMenu
->AppendSeparator();
278 editMenu
->Append(wxID_COPY
, _("&Copy\tCtrl+C"));
279 editMenu
->Append(wxID_CUT
, _("Cu&t\tCtrl+X"));
280 editMenu
->Append(wxID_PASTE
, _("&Paste\tCtrl+V"));
281 editMenu
->AppendSeparator();
283 wxMenu
* itemMenu
= new wxMenu
;
284 itemMenu
->Append(ctID_ADD_ITEM_CHECKBOX
, _("Add &Checkbox Option"), _("Add a checkbox configuration option"));
285 itemMenu
->Append(ctID_ADD_ITEM_RADIOBUTTON
, _("Add &Radio Button Option"), _("Add a radio button configuration option"));
286 // TODO. However we can also simply use custom properties;
287 // but then the C++ code has to be special-cased.
288 // itemMenu->Append(ctID_ADD_ITEM_STRING, _("Add &String Option"), _("Add a string configuration option"));
289 itemMenu
->Append(ctID_ADD_ITEM_GROUP
, _("Add &Group Option"), _("Add a group configuration option"));
290 itemMenu
->Append(ctID_ADD_ITEM_CHECK_GROUP
, _("Add Chec&k Group Option"), _("Add a check group configuration option"));
291 itemMenu
->Append(ctID_ADD_ITEM_RADIO_GROUP
, _("Add Rad&io Group Option"), _("Add a radio group configuration option"));
293 editMenu
->Append(ctID_ADD_ITEM
, wxT("Add &Option"), itemMenu
, _("Add a configuration option"));
294 editMenu
->AppendSeparator();
296 wxMenu
* propertyMenu
= new wxMenu
;
297 propertyMenu
->Append(ctID_ADD_CUSTOM_PROPERTY
, _("&Add Custom Property"), _("Adds a custom property to the current option"));
298 propertyMenu
->Append(ctID_EDIT_CUSTOM_PROPERTY
, _("&Edit Custom Property"), _("Edits the currently selected custom property"));
299 propertyMenu
->Append(ctID_DELETE_CUSTOM_PROPERTY
, _("&Delete Custom Property"), _("Deletes the currently selected custom property"));
300 editMenu
->Append(ctID_CUSTOM_PROPERTY
, _("Custom P&roperty"), propertyMenu
, _("Custom property commands"));
302 editMenu
->AppendSeparator();
303 editMenu
->Append(ctID_DELETE_ITEM
, _("&Delete Option"), _("Delete a configuration option"));
304 editMenu
->Append(ctID_RENAME_ITEM
, _("&Rename Option"), _("Rename a configuration option"));
305 editMenu
->AppendSeparator();
306 editMenu
->Append(wxID_FIND
, _("&Find...\tCtrl+F"), _("Search for a string in the settings document"));
308 // Save for the command processor.
309 m_editMenu
= editMenu
;
311 wxMenu
*viewMenu
= new wxMenu
;
312 viewMenu
->Append(ctID_SHOW_TOOLBAR
, wxT("Show &Toolbar"), wxT("Toggle the toolbar on and off"),
314 viewMenu
->Append(ctID_SETTINGS
, wxT("&Settings...\tCtrl+T"), wxT("Show application settings"));
316 wxMenu
*helpMenu
= new wxMenu
;
317 helpMenu
->Append(wxID_HELP
, wxT("&Help Contents"), wxT("Show Configuration Tool help"));
318 helpMenu
->Append(ctID_REFERENCE_CONTENTS
, wxT("&wxWindows Help Contents"), wxT("Show wxWindows reference"));
319 helpMenu
->AppendSeparator();
320 helpMenu
->Append(ctID_ITEM_HELP
, wxT("&Configuration Option Help\tF1"), wxT("Show help for the selected option"));
321 helpMenu
->Append(wxID_HELP_CONTEXT
, wxT("&What's this?"), wxT("Show help on the clicked item"));
322 helpMenu
->AppendSeparator();
323 helpMenu
->Append(wxID_ABOUT
, wxT("&About..."), wxT("Show details about this application"));
325 wxMenuBar
*menuBar
= new wxMenuBar
;
327 menuBar
->Append(fileMenu
, wxT("&File"));
328 menuBar
->Append(editMenu
, wxT("&Edit"));
329 menuBar
->Append(viewMenu
, wxT("&View"));
330 menuBar
->Append(helpMenu
, wxT("&Help"));
333 wxConfig
config(wxGetApp().GetSettings().GetAppName(), wxT("wxWindows"));
334 config
.SetPath(wxT("FileHistory/"));
335 wxGetApp().GetDocManager()->FileHistoryLoad(config
);
341 /// Handles the Show Toolbar menu event.
342 void ctMainFrame::OnShowToolbar(wxCommandEvent
& event
)
344 wxGetApp().GetSettings().m_showToolBar
= !wxGetApp().GetSettings().m_showToolBar
;
345 GetToolBar()->Show(wxGetApp().GetSettings().m_showToolBar
);
349 /// Handles the Help Contents menu event.
350 void ctMainFrame::OnHelp(wxCommandEvent
& event
)
352 wxGetApp().GetHelpController().DisplayContents();
355 /// Handles context help
356 void ctMainFrame::OnContextHelp(wxCommandEvent
& event
)
358 wxContextHelp contextHelp
;
361 /// Handles the Help Contents menu event for the reference manual.
362 void ctMainFrame::OnReferenceHelp(wxCommandEvent
& event
)
364 wxGetApp().GetReferenceHelpController().DisplayContents();
367 /// Resizes the main frame according to the
368 /// state of the toolbar
369 void ctMainFrame::ResizeFrame()
372 wxSizeEvent
event(GetSize(), GetId());
373 this->ProcessEvent(event
);
376 /// Update the frame title.
377 void ctMainFrame::UpdateFrameTitle()
383 void ctMainFrame::OnUpdateDisable(wxUpdateUIEvent
& event
)
385 event
.Enable( FALSE
);
389 * ctOutputWindow represents a page showing a setup.h file or config command.
392 IMPLEMENT_CLASS(ctOutputWindow
, wxPanel
)
394 BEGIN_EVENT_TABLE(ctOutputWindow
, wxPanel
)
395 EVT_BUTTON(wxID_COPY
, ctOutputWindow::OnCopyToClipboard
)
396 EVT_BUTTON(wxID_SAVE
, ctOutputWindow::OnSaveText
)
397 EVT_BUTTON(ctID_REGENERATE
, ctOutputWindow::OnRegenerate
)
398 EVT_UPDATE_UI(wxID_SAVE
, ctOutputWindow::OnUpdateSaveText
)
399 EVT_UPDATE_UI(ctID_REGENERATE
, ctOutputWindow::OnUpdateRegenerate
)
400 EVT_UPDATE_UI(wxID_COPY
, ctOutputWindow::OnUpdateCopy
)
403 ctOutputWindow::ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
404 const wxPoint
& pos
, const wxSize
& size
, long style
):
405 wxPanel(parent
, id
, pos
, size
, style
)
408 m_filenameCtrl
= NULL
;
413 ctOutputWindow::~ctOutputWindow()
417 /// Initialise the windows.
418 void ctOutputWindow::CreateWindows()
420 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
422 wxBoxSizer
*item2
= new wxBoxSizer( wxHORIZONTAL
);
423 item0
->Add( item2
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 );
425 wxButton
*item4
= new wxButton( this, wxID_COPY
, _("&Copy"), wxDefaultPosition
, wxDefaultSize
, 0 );
426 item2
->Add( item4
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
|wxRIGHT
, 5 );
427 item4
->SetHelpText(_("Copies the selection or whole file to the clipboard."));
429 wxButton
*item5
= new wxButton( this, ctID_REGENERATE
, _("Re&generate"), wxDefaultPosition
, wxDefaultSize
, 0 );
430 item2
->Add( item5
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
|wxRIGHT
, 5 );
431 item5
->SetHelpText(_("Regenerates the code."));
434 m_filenameCtrl
= new wxTextCtrl(this, -1, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, wxSUNKEN_BORDER
|wxTE_READONLY
);
435 item2
->Add( m_filenameCtrl
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
|wxRIGHT
, 5 );
436 m_filenameCtrl
->SetHelpText(_("Shows the filename where the code is being saved."));
438 m_filenameCtrl
= NULL
;
442 m_codeCtrl
= new wxTextCtrl(this, -1, wxEmptyString
, wxDefaultPosition
, wxSize(100, 100), wxTE_RICH
|wxTE_MULTILINE
|wxSUNKEN_BORDER
);
443 item0
->Add( m_codeCtrl
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxRIGHT
|wxBOTTOM
, 5 );
445 SetAutoLayout( TRUE
);
449 /// Copies the text to the clipboard.
450 void ctOutputWindow::OnCopyToClipboard(wxCommandEvent
& event
)
452 // Try to copy the selection first
453 long int selFrom
, selTo
;
454 m_codeCtrl
->GetSelection(& selFrom
, & selTo
);
455 if (selFrom
!= selTo
)
461 // Copy the whole amount
462 if (!wxTheClipboard
->Open())
464 wxMessageBox(_("Sorry, could not open the clipboard."), _("Clipboard problem"), wxICON_EXCLAMATION
|wxOK
);
468 wxString
value(m_codeCtrl
->GetValue());
470 value
.Replace(_T("\n"), _T("\r\n"));
472 wxTextDataObject
*data
= new wxTextDataObject( value
);
474 if (!wxTheClipboard
->SetData( data
))
476 wxTheClipboard
->Close();
477 wxMessageBox(_("Sorry, could not copy to the clipboard."), _("Clipboard problem"), wxICON_EXCLAMATION
|wxOK
);
481 wxTheClipboard
->Close();
485 /// Sets the code in the text control.
486 void ctOutputWindow::SetText(const wxString
& text
)
489 m_codeCtrl
->SetValue(text
);
492 /// Sets the filename.
493 void ctOutputWindow::SetFilename(const wxString
& filename
)
496 m_filenameCtrl
->SetValue(filename
);
500 void ctOutputWindow::OnSaveText(wxCommandEvent
& event
)
502 if (m_codeCtrl
->IsModified())
504 wxString
filename(m_filenameCtrl
->GetValue());
505 if (!filename
.IsEmpty())
507 m_codeCtrl
->SaveFile(filename
);
508 m_codeCtrl
->DiscardEdits();
513 void ctOutputWindow::OnUpdateSaveText(wxUpdateUIEvent
& event
)
515 event
.Enable(m_doc
&& m_codeCtrl
&& m_codeCtrl
->IsModified());
518 void ctOutputWindow::OnRegenerate(wxCommandEvent
& event
)
522 ctConfigToolView
* view
= (ctConfigToolView
*) m_doc
->GetFirstView();
523 view
->RegenerateSetup();
527 void ctOutputWindow::OnUpdateRegenerate(wxUpdateUIEvent
& event
)
529 event
.Enable( m_doc
!= NULL
);
532 void ctOutputWindow::OnUpdateCopy(wxUpdateUIEvent
& event
)
534 event
.Enable( m_doc
!= NULL
);