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"
49 #include "bitmaps/go.xpm"
51 IMPLEMENT_CLASS(ctMainFrame
, wxDocParentFrame
)
53 BEGIN_EVENT_TABLE(ctMainFrame
, wxDocParentFrame
)
54 EVT_CLOSE(ctMainFrame::OnCloseWindow
)
55 EVT_MENU(wxID_ABOUT
, ctMainFrame::OnAbout
)
56 EVT_MENU(wxID_OPEN
, ctMainFrame::OnOpen
)
57 EVT_MENU(wxID_NEW
, ctMainFrame::OnNew
)
58 EVT_MENU(wxID_EXIT
, ctMainFrame::OnExit
)
59 EVT_MENU(ctID_SETTINGS
, ctMainFrame::OnSettings
)
60 EVT_MENU(ctID_SHOW_TOOLBAR
, ctMainFrame::OnShowToolbar
)
61 EVT_MENU(wxID_HELP
, ctMainFrame::OnHelp
)
62 EVT_MENU(ctID_REFERENCE_CONTENTS
, ctMainFrame::OnReferenceHelp
)
63 EVT_MENU(wxID_HELP_CONTEXT
, ctMainFrame::OnContextHelp
)
65 EVT_UPDATE_UI(ctID_ADD_ITEM_CHECKBOX
, ctMainFrame::OnUpdateDisable
)
66 EVT_UPDATE_UI(ctID_ADD_ITEM_RADIOBUTTON
, ctMainFrame::OnUpdateDisable
)
67 EVT_UPDATE_UI(ctID_ADD_ITEM_GROUP
, ctMainFrame::OnUpdateDisable
)
68 EVT_UPDATE_UI(ctID_ADD_ITEM_CHECK_GROUP
, ctMainFrame::OnUpdateDisable
)
69 EVT_UPDATE_UI(ctID_ADD_ITEM_RADIO_GROUP
, ctMainFrame::OnUpdateDisable
)
70 EVT_UPDATE_UI(ctID_ADD_ITEM_STRING
, ctMainFrame::OnUpdateDisable
)
71 EVT_UPDATE_UI(ctID_DELETE_ITEM
, ctMainFrame::OnUpdateDisable
)
72 EVT_UPDATE_UI(ctID_RENAME_ITEM
, ctMainFrame::OnUpdateDisable
)
73 EVT_UPDATE_UI(wxID_COPY
, ctMainFrame::OnUpdateDisable
)
74 EVT_UPDATE_UI(wxID_CUT
, ctMainFrame::OnUpdateDisable
)
75 EVT_UPDATE_UI(wxID_PASTE
, ctMainFrame::OnUpdateDisable
)
76 EVT_UPDATE_UI(ctID_ITEM_HELP
, ctMainFrame::OnUpdateDisable
)
78 EVT_UPDATE_UI(ctID_ADD_CUSTOM_PROPERTY
, ctMainFrame::OnUpdateDisable
)
79 EVT_UPDATE_UI(ctID_EDIT_CUSTOM_PROPERTY
, ctMainFrame::OnUpdateDisable
)
80 EVT_UPDATE_UI(ctID_DELETE_CUSTOM_PROPERTY
, ctMainFrame::OnUpdateDisable
)
82 EVT_UPDATE_UI(ctID_SAVE_SETUP_FILE
, ctMainFrame::OnUpdateDisable
)
83 EVT_UPDATE_UI(ctID_SAVE_CONFIGURE_COMMAND
, ctMainFrame::OnUpdateDisable
)
85 EVT_UPDATE_UI(wxID_FIND
, ctMainFrame::OnUpdateDisable
)
87 EVT_UPDATE_UI(ctID_GO
, ctMainFrame::OnUpdateDisable
)
90 // Define my frame constructor
91 ctMainFrame::ctMainFrame(wxDocManager
*manager
, wxFrame
*parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
,
93 wxDocParentFrame(manager
, parent
, id
, title
, pos
, size
, style
)
97 m_configurePage
= NULL
;
99 m_mainNotebook
= NULL
;
102 m_treeSplitterWindow
= new wxSplitterWindow(this, -1, wxDefaultPosition
, wxSize(400, 300),
103 wxSP_3DSASH
|wxSP_3DBORDER
);
105 m_configTreeCtrl
= new ctConfigTreeCtrl(m_treeSplitterWindow
, -1, wxDefaultPosition
, wxDefaultSize
,
106 wxTR_HAS_BUTTONS
|wxNO_BORDER
);
108 m_mainNotebook
= new wxNotebook(m_treeSplitterWindow
, -1, wxDefaultPosition
, wxSize(300, 300));
110 m_propertyEditor
= new ctPropertyEditor(m_mainNotebook
, -1, wxDefaultPosition
, wxSize(300, 200),
112 m_setupPage
= new ctOutputWindow(m_mainNotebook
, -1, wxDefaultPosition
, wxSize(300, 200),
114 m_configurePage
= new ctOutputWindow(m_mainNotebook
, -1, wxDefaultPosition
, wxSize(300, 200),
116 m_mainNotebook
->AddPage(m_propertyEditor
, _T("Properties"));
117 m_mainNotebook
->AddPage(m_setupPage
, _T("setup.h"));
118 m_mainNotebook
->AddPage(m_configurePage
, _T("configure"));
120 // Need to do this afterwards since wxWin sets the XP background
122 m_propertyEditor
->GetDescriptionWindow()->SetBackgroundColour(ctDESCRIPTION_BACKGROUND_COLOUR
);
124 int sashPos
= wxGetApp().GetSettings().m_mainSashSize
;
125 m_treeSplitterWindow
->SplitVertically(m_configTreeCtrl
, m_mainNotebook
, sashPos
);
127 SetIcon(wxIcon(wxconfigtool_xpm
));
131 wxMenuBar
* menuBar
= CreateMenuBar();
134 CreateToolBar(wxNO_BORDER
|wxTB_FLAT
|wxTB_HORIZONTAL
);
135 InitToolBar(GetToolBar());
137 if (wxGetApp().GetSettings().m_showToolBar
)
139 menuBar
->Check(ctID_SHOW_TOOLBAR
, TRUE
);
143 menuBar
->Check(ctID_SHOW_TOOLBAR
, FALSE
);
144 GetToolBar()->Show(FALSE
);
149 void ctMainFrame::OnCloseWindow(wxCloseEvent
& event
)
153 if (!GetDocument()->DeleteAllViews() && event
.CanVeto())
162 m_findDialog
->Destroy();
169 wxGetApp().GetSettings().m_frameStatus
= ctSHOW_STATUS_MAXIMIZED
;
170 else if (IsIconized())
171 wxGetApp().GetSettings().m_frameStatus
= ctSHOW_STATUS_MINIMIZED
;
173 wxGetApp().GetSettings().m_frameStatus
= ctSHOW_STATUS_NORMAL
;
175 // Must delete this now since the DLL loading library will be
176 // uninitialised by the time the app object is deleted
177 wxGetApp().ClearHelpControllers();
179 if (!IsMaximized() && !IsIconized())
181 wxGetApp().GetSettings().m_frameSize
= GetRect();
182 wxGetApp().GetSettings().m_mainSashSize
= m_treeSplitterWindow
->GetSashPosition();
188 void ctMainFrame::OnAbout(wxCommandEvent
& event
)
190 wxString msg
= wxGetApp().GetSettings().GetAppName() + wxT(" (c) Julian Smart");
191 wxString caption
= wxT("About ") + wxGetApp().GetSettings().GetAppName();
192 wxMessageBox(msg
, caption
, wxOK
|wxICON_INFORMATION
);
195 void ctMainFrame::OnOpen(wxCommandEvent
& event
)
197 wxGetApp().GetDocManager()->OnFileOpen(event
);
200 void ctMainFrame::OnNew(wxCommandEvent
& event
)
202 wxGetApp().GetDocManager()->OnFileNew(event
);
205 void ctMainFrame::OnExit(wxCommandEvent
& event
)
210 void ctMainFrame::OnSettings(wxCommandEvent
& event
)
212 wxGetApp().GetSettings().ShowSettingsDialog();
215 void ctMainFrame::InitToolBar(wxToolBar
* toolBar
)
217 toolBar
->SetHelpText(wxT("The toolbar gives you easy access to commonly used commands."));
220 wxBitmap toolBarBitmaps
[20];
222 toolBarBitmaps
[0] = wxBitmap(new_xpm
);
223 toolBarBitmaps
[1] = wxBitmap(open_xpm
);
224 toolBarBitmaps
[2] = wxBitmap(save_xpm
);
225 toolBarBitmaps
[3] = wxBitmap(copy_xpm
);
226 toolBarBitmaps
[4] = wxBitmap(cut_xpm
);
227 toolBarBitmaps
[5] = wxBitmap(paste_xpm
);
228 toolBarBitmaps
[6] = wxBitmap(go_xpm
);
229 toolBarBitmaps
[7] = wxBitmap(help_xpm
);
230 toolBarBitmaps
[10] = wxBitmap(undo_xpm
);
231 toolBarBitmaps
[11] = wxBitmap(redo_xpm
);
232 toolBarBitmaps
[12] = wxBitmap(help_xpm
);
233 toolBarBitmaps
[13] = wxBitmap(helpcs_xpm
);
235 toolBar
->AddTool(wxID_NEW
, toolBarBitmaps
[0], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("New project"));
236 toolBar
->AddTool(wxID_OPEN
, toolBarBitmaps
[1], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Open project"));
237 toolBar
->AddTool(wxID_SAVE
, toolBarBitmaps
[2], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Save project"));
239 toolBar
->AddSeparator();
240 toolBar
->AddTool(wxID_CUT
, toolBarBitmaps
[4], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Cut"));
241 toolBar
->AddTool(wxID_COPY
, toolBarBitmaps
[3], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Copy"));
242 toolBar
->AddTool(wxID_PASTE
, toolBarBitmaps
[5], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Paste"));
243 toolBar
->AddSeparator();
244 toolBar
->AddTool(wxID_UNDO
, toolBarBitmaps
[10], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Undo"));
245 toolBar
->AddTool(wxID_REDO
, toolBarBitmaps
[11], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Redo"));
246 toolBar
->AddSeparator();
247 toolBar
->AddTool(ctID_GO
, toolBarBitmaps
[6], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Save setup.h or configurewx.sh"));
248 toolBar
->AddSeparator();
249 toolBar
->AddTool(ctID_ITEM_HELP
, toolBarBitmaps
[12], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Show help for this option"));
250 toolBar
->AddTool(wxID_HELP_CONTEXT
, toolBarBitmaps
[13], wxNullBitmap
, FALSE
, -1, -1, (wxObject
*) NULL
, wxT("Show help on the clicked item"));
252 // after adding the buttons to the toolbar, must call Realize() to reflect
257 wxMenuBar
* ctMainFrame::CreateMenuBar()
260 wxMenu
*fileMenu
= new wxMenu
;
262 wxGetApp().GetFileHistory().UseMenu(fileMenu
);
264 fileMenu
->Append(wxID_NEW
, wxT("&New...\tCtrl+N"), wxT("Create a new settings document"));
265 fileMenu
->Append(wxID_OPEN
, wxT("&Open...\tCtrl+O"), wxT("Open a settings document"));
266 fileMenu
->Append(wxID_CLOSE
, wxT("&Close\tCtrl+W"), wxT("Close the current settings document"));
267 fileMenu
->AppendSeparator();
268 fileMenu
->Append(wxID_SAVE
, wxT("&Save\tCtrl+S"), wxT("Save the settings document"));
269 fileMenu
->Append(wxID_SAVEAS
, wxT("&Save As..."), wxT("Save the settings document under a new filename"));
270 fileMenu
->AppendSeparator();
271 fileMenu
->Append(ctID_SAVE_SETUP_FILE
, wxT("Save Setup.&h...\tCtrl+H"), wxT("Save the setup.h file"));
272 fileMenu
->Append(ctID_SAVE_CONFIGURE_COMMAND
, wxT("Save Configure Script...\tCtrl+G"), wxT("Save the configure script file"));
273 fileMenu
->AppendSeparator();
274 fileMenu
->Append(ctID_GO
, wxT("&Go\tF5"), wxT("Quick-save the setup.h or configure.sh file"));
275 fileMenu
->AppendSeparator();
276 fileMenu
->Append(wxID_EXIT
, wxT("E&xit\tAlt+F4"), wxT("Exit the application"));
278 wxGetApp().GetDocManager()->FileHistoryUseMenu(fileMenu
);
280 wxMenu
*editMenu
= new wxMenu
;
282 editMenu
->Append(wxID_UNDO
, _("&Undo\tCtrl+Z"));
283 editMenu
->Append(wxID_REDO
, _("&Redo\tCtrl+Y"));
284 editMenu
->AppendSeparator();
285 editMenu
->Append(wxID_COPY
, _("&Copy\tCtrl+C"));
286 editMenu
->Append(wxID_CUT
, _("Cu&t\tCtrl+X"));
287 editMenu
->Append(wxID_PASTE
, _("&Paste\tCtrl+V"));
288 editMenu
->AppendSeparator();
290 wxMenu
* itemMenu
= new wxMenu
;
291 itemMenu
->Append(ctID_ADD_ITEM_CHECKBOX
, _("Add &Checkbox Option"), _("Add a checkbox configuration option"));
292 itemMenu
->Append(ctID_ADD_ITEM_RADIOBUTTON
, _("Add &Radio Button Option"), _("Add a radio button configuration option"));
293 // TODO. However we can also simply use custom properties;
294 // but then the C++ code has to be special-cased.
295 // itemMenu->Append(ctID_ADD_ITEM_STRING, _("Add &String Option"), _("Add a string configuration option"));
296 itemMenu
->Append(ctID_ADD_ITEM_GROUP
, _("Add &Group Option"), _("Add a group configuration option"));
297 itemMenu
->Append(ctID_ADD_ITEM_CHECK_GROUP
, _("Add Chec&k Group Option"), _("Add a check group configuration option"));
298 itemMenu
->Append(ctID_ADD_ITEM_RADIO_GROUP
, _("Add Rad&io Group Option"), _("Add a radio group configuration option"));
300 editMenu
->Append(ctID_ADD_ITEM
, wxT("Add &Option"), itemMenu
, _("Add a configuration option"));
301 editMenu
->AppendSeparator();
303 wxMenu
* propertyMenu
= new wxMenu
;
304 propertyMenu
->Append(ctID_ADD_CUSTOM_PROPERTY
, _("&Add Custom Property"), _("Adds a custom property to the current option"));
305 propertyMenu
->Append(ctID_EDIT_CUSTOM_PROPERTY
, _("&Edit Custom Property"), _("Edits the currently selected custom property"));
306 propertyMenu
->Append(ctID_DELETE_CUSTOM_PROPERTY
, _("&Delete Custom Property"), _("Deletes the currently selected custom property"));
307 editMenu
->Append(ctID_CUSTOM_PROPERTY
, _("Custom P&roperty"), propertyMenu
, _("Custom property commands"));
309 editMenu
->AppendSeparator();
310 editMenu
->Append(ctID_DELETE_ITEM
, _("&Delete Option"), _("Delete a configuration option"));
311 editMenu
->Append(ctID_RENAME_ITEM
, _("&Rename Option"), _("Rename a configuration option"));
312 editMenu
->AppendSeparator();
313 editMenu
->Append(wxID_FIND
, _("&Find...\tCtrl+F"), _("Search for a string in the settings document"));
315 // Save for the command processor.
316 m_editMenu
= editMenu
;
318 wxMenu
*viewMenu
= new wxMenu
;
319 viewMenu
->Append(ctID_SHOW_TOOLBAR
, wxT("Show &Toolbar"), wxT("Toggle the toolbar on and off"),
321 viewMenu
->Append(ctID_SETTINGS
, wxT("&Settings...\tCtrl+T"), wxT("Show application settings"));
323 wxMenu
*helpMenu
= new wxMenu
;
324 helpMenu
->Append(wxID_HELP
, wxT("&Help Contents"), wxT("Show Configuration Tool help"));
325 helpMenu
->Append(ctID_REFERENCE_CONTENTS
, wxT("&wxWindows Help Contents"), wxT("Show wxWindows reference"));
326 helpMenu
->AppendSeparator();
327 helpMenu
->Append(ctID_ITEM_HELP
, wxT("&Configuration Option Help\tF1"), wxT("Show help for the selected option"));
328 helpMenu
->Append(wxID_HELP_CONTEXT
, wxT("&What's this?"), wxT("Show help on the clicked item"));
329 helpMenu
->AppendSeparator();
330 helpMenu
->Append(wxID_ABOUT
, wxT("&About..."), wxT("Show details about this application"));
332 wxMenuBar
*menuBar
= new wxMenuBar
;
334 menuBar
->Append(fileMenu
, wxT("&File"));
335 menuBar
->Append(editMenu
, wxT("&Edit"));
336 menuBar
->Append(viewMenu
, wxT("&View"));
337 menuBar
->Append(helpMenu
, wxT("&Help"));
340 wxConfig
config(wxGetApp().GetSettings().GetAppName(), wxT("wxWindows"));
341 config
.SetPath(wxT("FileHistory/"));
342 wxGetApp().GetDocManager()->FileHistoryLoad(config
);
348 /// Handles the Show Toolbar menu event.
349 void ctMainFrame::OnShowToolbar(wxCommandEvent
& event
)
351 wxGetApp().GetSettings().m_showToolBar
= !wxGetApp().GetSettings().m_showToolBar
;
352 GetToolBar()->Show(wxGetApp().GetSettings().m_showToolBar
);
356 /// Handles the Help Contents menu event.
357 void ctMainFrame::OnHelp(wxCommandEvent
& event
)
359 wxGetApp().GetHelpController().DisplayContents();
362 /// Handles context help
363 void ctMainFrame::OnContextHelp(wxCommandEvent
& event
)
365 wxContextHelp contextHelp
;
368 /// Handles the Help Contents menu event for the reference manual.
369 void ctMainFrame::OnReferenceHelp(wxCommandEvent
& event
)
371 wxGetApp().GetReferenceHelpController().DisplayContents();
374 /// Resizes the main frame according to the
375 /// state of the toolbar
376 void ctMainFrame::ResizeFrame()
379 wxSizeEvent
event(GetSize(), GetId());
380 this->ProcessEvent(event
);
383 /// Update the frame title.
384 void ctMainFrame::UpdateFrameTitle()
390 void ctMainFrame::OnUpdateDisable(wxUpdateUIEvent
& event
)
392 event
.Enable( FALSE
);
396 * ctOutputWindow represents a page showing a setup.h file or config command.
399 IMPLEMENT_CLASS(ctOutputWindow
, wxPanel
)
401 BEGIN_EVENT_TABLE(ctOutputWindow
, wxPanel
)
402 EVT_BUTTON(wxID_COPY
, ctOutputWindow::OnCopyToClipboard
)
403 EVT_BUTTON(wxID_SAVE
, ctOutputWindow::OnSaveText
)
404 EVT_BUTTON(ctID_REGENERATE
, ctOutputWindow::OnRegenerate
)
405 EVT_UPDATE_UI(wxID_SAVE
, ctOutputWindow::OnUpdateSaveText
)
406 EVT_UPDATE_UI(ctID_REGENERATE
, ctOutputWindow::OnUpdateRegenerate
)
407 EVT_UPDATE_UI(wxID_COPY
, ctOutputWindow::OnUpdateCopy
)
410 ctOutputWindow::ctOutputWindow(wxWindow
* parent
, wxWindowID id
,
411 const wxPoint
& pos
, const wxSize
& size
, long style
):
412 wxPanel(parent
, id
, pos
, size
, style
)
415 m_filenameCtrl
= NULL
;
420 ctOutputWindow::~ctOutputWindow()
424 /// Initialise the windows.
425 void ctOutputWindow::CreateWindows()
427 wxBoxSizer
*item0
= new wxBoxSizer( wxVERTICAL
);
429 wxBoxSizer
*item2
= new wxBoxSizer( wxHORIZONTAL
);
430 item0
->Add( item2
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
, 5 );
432 wxButton
*item4
= new wxButton( this, wxID_COPY
, _("&Copy"), wxDefaultPosition
, wxDefaultSize
, 0 );
433 item2
->Add( item4
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxTOP
|wxBOTTOM
|wxRIGHT
, 5 );
434 item4
->SetHelpText(_("Copies the selection or whole file to the clipboard."));
436 wxButton
*item5
= new wxButton( this, ctID_REGENERATE
, _("Re&generate"), wxDefaultPosition
, wxDefaultSize
, 0 );
437 item2
->Add( item5
, 0, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
|wxRIGHT
, 5 );
438 item5
->SetHelpText(_("Regenerates the code."));
441 m_filenameCtrl
= new wxTextCtrl(this, -1, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, wxSUNKEN_BORDER
|wxTE_READONLY
);
442 item2
->Add( m_filenameCtrl
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxTOP
|wxBOTTOM
|wxRIGHT
, 5 );
443 m_filenameCtrl
->SetHelpText(_("Shows the filename where the code is being saved."));
445 m_filenameCtrl
= NULL
;
449 m_codeCtrl
= new wxTextCtrl(this, -1, wxEmptyString
, wxDefaultPosition
, wxSize(100, 100), wxTE_RICH
|wxTE_MULTILINE
|wxSUNKEN_BORDER
);
450 item0
->Add( m_codeCtrl
, 1, wxGROW
|wxALIGN_CENTER_VERTICAL
|wxLEFT
|wxRIGHT
|wxBOTTOM
, 5 );
452 SetAutoLayout( TRUE
);
456 /// Copies the text to the clipboard.
457 void ctOutputWindow::OnCopyToClipboard(wxCommandEvent
& event
)
459 // Try to copy the selection first
460 long int selFrom
, selTo
;
461 m_codeCtrl
->GetSelection(& selFrom
, & selTo
);
462 if (selFrom
!= selTo
)
468 // Copy the whole amount
469 if (!wxTheClipboard
->Open())
471 wxMessageBox(_("Sorry, could not open the clipboard."), _("Clipboard problem"), wxICON_EXCLAMATION
|wxOK
);
475 wxString
value(m_codeCtrl
->GetValue());
477 value
.Replace(_T("\n"), _T("\r\n"));
479 wxTextDataObject
*data
= new wxTextDataObject( value
);
481 if (!wxTheClipboard
->SetData( data
))
483 wxTheClipboard
->Close();
484 wxMessageBox(_("Sorry, could not copy to the clipboard."), _("Clipboard problem"), wxICON_EXCLAMATION
|wxOK
);
488 wxTheClipboard
->Close();
492 /// Sets the code in the text control.
493 void ctOutputWindow::SetText(const wxString
& text
)
496 m_codeCtrl
->SetValue(text
);
499 /// Sets the filename.
500 void ctOutputWindow::SetFilename(const wxString
& filename
)
503 m_filenameCtrl
->SetValue(filename
);
507 void ctOutputWindow::OnSaveText(wxCommandEvent
& event
)
509 if (m_codeCtrl
->IsModified())
511 wxString
filename(m_filenameCtrl
->GetValue());
512 if (!filename
.IsEmpty())
514 m_codeCtrl
->SaveFile(filename
);
515 m_codeCtrl
->DiscardEdits();
520 void ctOutputWindow::OnUpdateSaveText(wxUpdateUIEvent
& event
)
522 event
.Enable(m_doc
&& m_codeCtrl
&& m_codeCtrl
->IsModified());
525 void ctOutputWindow::OnRegenerate(wxCommandEvent
& event
)
529 ctConfigToolView
* view
= (ctConfigToolView
*) m_doc
->GetFirstView();
530 view
->RegenerateSetup();
534 void ctOutputWindow::OnUpdateRegenerate(wxUpdateUIEvent
& event
)
536 event
.Enable( m_doc
!= NULL
);
539 void ctOutputWindow::OnUpdateCopy(wxUpdateUIEvent
& event
)
541 event
.Enable( m_doc
!= NULL
);