summaryrefslogtreecommitdiffstats
path: root/Project/MainFrameBase.cpp
blob: 5cf6efe5edcc859f3bb036b12e8a372ef72cb609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: MainFrame.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#include "MainFrameBase.h"


// Declare the bitmap loading function
extern void wxC9ED9InitBitmapResources();

static bool bBitmapLoaded = false;


MainFrameBase::MainFrameBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
    : wxFrame(parent, id, title, pos, size, style)
{
    if ( !bBitmapLoaded ) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxC9ED9InitBitmapResources();
        bBitmapLoaded = true;
    }
    // Set icon(s) to the application/dialog
    wxIconBundle app_icons;
    {
        wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("logo16"));
        wxIcon icn;
        icn.CopyFromBitmap(iconBmp);
        app_icons.AddIcon( icn );
    }
    {
        wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("logo32"));
        wxIcon icn;
        icn.CopyFromBitmap(iconBmp);
        app_icons.AddIcon( icn );
    }
    {
        wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("logo64"));
        wxIcon icn;
        icn.CopyFromBitmap(iconBmp);
        app_icons.AddIcon( icn );
    }
    {
        wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("logo128"));
        wxIcon icn;
        icn.CopyFromBitmap(iconBmp);
        app_icons.AddIcon( icn );
    }
    {
        wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("logo256"));
        wxIcon icn;
        icn.CopyFromBitmap(iconBmp);
        app_icons.AddIcon( icn );
    }
    SetIcons( app_icons );

    
    wxBoxSizer* boxSizer_lvl_1_1 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(boxSizer_lvl_1_1);
    
    wxBoxSizer* boxSizer_lvl_2_1 = new wxBoxSizer(wxVERTICAL);
    
    boxSizer_lvl_1_1->Add(boxSizer_lvl_2_1, 0, wxEXPAND, WXC_FROM_DIP(5));
    
    m_ribbonBar = new wxRibbonBar(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxRIBBON_BAR_DEFAULT_STYLE);
    m_ribbonBar->SetArtProvider(new wxRibbonDefaultArtProvider);
    
    boxSizer_lvl_2_1->Add(m_ribbonBar, 0, wxEXPAND, WXC_FROM_DIP(5));
    
    m_ribbonPageFile = new wxRibbonPage(m_ribbonBar, wxID_ANY, _("File"), wxNullBitmap, 0);
    m_ribbonPageFile->SetToolTip(_("File"));
    m_ribbonBar->SetActivePage( m_ribbonPageFile );
    
    m_ribbonPanelProjects = new wxRibbonPanel(m_ribbonPageFile, wxID_ANY, _("Projects"), wxNullBitmap, wxDefaultPosition, wxDLG_UNIT(m_ribbonPageFile, wxSize(-1,-1)), wxRIBBON_PANEL_NO_AUTO_MINIMISE|wxRIBBON_PANEL_DEFAULT_STYLE);
    m_ribbonPanelProjects->SetToolTip(_("Projects"));
    
    m_ribbonButtonBarProjects = new wxRibbonButtonBar(m_ribbonPanelProjects, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_ribbonPanelProjects, wxSize(-1,-1)), 0);
    m_ribbonButtonBarProjects->SetToolTip(_("Projects"));
    
    m_ribbonButtonBarProjects->AddButton(ID_RIBBON_NEW, _("New"), wxXmlResource::Get()->LoadBitmap(wxT("new32")), _("Create new project"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarProjects->AddButton(ID_RIBBON_OPEN, _("Open"), wxXmlResource::Get()->LoadBitmap(wxT("open32")), _("Open saved project"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarProjects->AddButton(ID_RIBBON_IMPORT, _("Import"), wxXmlResource::Get()->LoadBitmap(wxT("imp32")), _("Open saved project"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarProjects->AddButton(ID_RIBBON_GENSETTINGS, _("General Settings"), wxXmlResource::Get()->LoadBitmap(wxT("settings32")), _("Opens a dialog to set the main settings of the program"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarProjects->AddButton(ID_RIBBON_EXIT, _("Exit"), wxXmlResource::Get()->LoadBitmap(wxT("exit32")), _("Closes the application"), wxRIBBON_BUTTON_NORMAL);
    m_ribbonButtonBarProjects->Realize();
    
    m_ribbonPanelCProject = new wxRibbonPanel(m_ribbonPageFile, wxID_ANY, _("Current project"), wxNullBitmap, wxDefaultPosition, wxDLG_UNIT(m_ribbonPageFile, wxSize(-1,-1)), wxRIBBON_PANEL_NO_AUTO_MINIMISE|wxRIBBON_PANEL_DEFAULT_STYLE);
    m_ribbonPanelCProject->SetToolTip(_("Current project"));
    
    m_ribbonButtonBarCProject = new wxRibbonButtonBar(m_ribbonPanelCProject, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_ribbonPanelCProject, wxSize(-1,-1)), 0);
    
    m_ribbonButtonBarCProject->AddButton(ID_RIBBON_SAVE, _("Save"), wxXmlResource::Get()->LoadBitmap(wxT("save32")), _("Save the current project"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarCProject->AddButton(ID_RIBBON_SAVEAS, _("Save As..."), wxXmlResource::Get()->LoadBitmap(wxT("saveAs32")), _("Save as the current project"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarCProject->AddButton(ID_RIBBON_CLOSE, _("Close"), wxXmlResource::Get()->LoadBitmap(wxT("close32")), _("Close the current project"), wxRIBBON_BUTTON_NORMAL);
    m_ribbonButtonBarCProject->Realize();
    
    m_ribbonPanelHelp = new wxRibbonPanel(m_ribbonPageFile, wxID_ANY, _("Help"), wxNullBitmap, wxDefaultPosition, wxDLG_UNIT(m_ribbonPageFile, wxSize(-1,-1)), wxRIBBON_PANEL_NO_AUTO_MINIMISE|wxRIBBON_PANEL_DEFAULT_STYLE);
    m_ribbonPanelHelp->SetToolTip(_("Help"));
    
    m_ribbonButtonBarHelp = new wxRibbonButtonBar(m_ribbonPanelHelp, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_ribbonPanelHelp, wxSize(-1,-1)), 0);
    m_ribbonButtonBarHelp->SetToolTip(_("Help"));
    
    m_ribbonButtonBarHelp->AddButton(ID_RIBBON_GUIDE, _("PSP-UFU Guide"), wxXmlResource::Get()->LoadBitmap(wxT("guide32")), _("Open PSP-UFU Guide"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarHelp->AddButton(ID_RIBBON_ABOUT, _("About..."), wxXmlResource::Get()->LoadBitmap(wxT("about32")), _("About PSP-UFU"), wxRIBBON_BUTTON_NORMAL);
    m_ribbonButtonBarHelp->Realize();
    
    m_ribbonPageTools = new wxRibbonPage(m_ribbonBar, wxID_ANY, _("Tools"), wxNullBitmap, 0);
    m_ribbonPageTools->SetToolTip(_("Tools"));
    
    m_ribbonPanelClipboard = new wxRibbonPanel(m_ribbonPageTools, wxID_ANY, _("Clipboard"), wxNullBitmap, wxDefaultPosition, wxDLG_UNIT(m_ribbonPageTools, wxSize(-1,-1)), wxRIBBON_PANEL_NO_AUTO_MINIMISE|wxRIBBON_PANEL_DEFAULT_STYLE);
    m_ribbonPanelClipboard->SetToolTip(_("Clipboard"));
    
    m_ribbonButtonBarClipboard = new wxRibbonButtonBar(m_ribbonPanelClipboard, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_ribbonPanelClipboard, wxSize(-1,-1)), 0);
    m_ribbonButtonBarClipboard->SetToolTip(_("Clipboard"));
    
    m_ribbonButtonBarClipboard->AddButton(ID_RIBBON_COPY, _("Copy"), wxXmlResource::Get()->LoadBitmap(wxT("copy32")), _("Copies the selected elements"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarClipboard->AddButton(ID_RIBBON_PASTE, _("Paste"), wxXmlResource::Get()->LoadBitmap(wxT("paste32")), _("Pastes the elements from clipboard"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarClipboard->AddButton(ID_RIBBON_UNDO, _("Undo"), wxXmlResource::Get()->LoadBitmap(wxT("undo32")), _("Undoes the last action"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarClipboard->AddButton(ID_RIBBON_REDO, _("Redo"), wxXmlResource::Get()->LoadBitmap(wxT("redo32")), _("Redoes the last undo action"), wxRIBBON_BUTTON_NORMAL);
    m_ribbonButtonBarClipboard->Realize();
    
    m_ribbonPanelCircuit = new wxRibbonPanel(m_ribbonPageTools, wxID_ANY, _("Circuit"), wxNullBitmap, wxDefaultPosition, wxDLG_UNIT(m_ribbonPageTools, wxSize(-1,-1)), wxRIBBON_PANEL_NO_AUTO_MINIMISE|wxRIBBON_PANEL_DEFAULT_STYLE);
    m_ribbonPanelCircuit->SetToolTip(_("Circuit"));
    
    m_ribbonButtonBarCircuit = new wxRibbonButtonBar(m_ribbonPanelCircuit, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_ribbonPanelCircuit, wxSize(-1,-1)), 0);
    m_ribbonButtonBarCircuit->SetToolTip(_("Circuit"));
    
    m_ribbonButtonBarCircuit->AddButton(ID_RIBBON_ADDELEMENT, _("Add Element"), wxXmlResource::Get()->LoadBitmap(wxT("add32")), _("Add a new element in the project"), wxRIBBON_BUTTON_DROPDOWN);
    
    m_ribbonButtonBarCircuit->AddButton(ID_RIBBON_DRAG, _("Drag"), wxXmlResource::Get()->LoadBitmap(wxT("drag32")), _("Drag all the elements"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarCircuit->AddButton(ID_RIBBON_MOVE, _("Move"), wxXmlResource::Get()->LoadBitmap(wxT("move32")), _("Move the selected elements"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarCircuit->AddButton(ID_RIBBON_DELETE, _("Delete"), wxXmlResource::Get()->LoadBitmap(wxT("delete32")), _("Removes all selected elements"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarCircuit->AddButton(ID_RIBBON_FIT, _("Fit"), wxXmlResource::Get()->LoadBitmap(wxT("fit32")), _("Applies the drag and zoom tools to show all elements in workspace"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarCircuit->AddButton(ID_RIBBON_ROTATEC, _("Rotate Clockwise"), wxXmlResource::Get()->LoadBitmap(wxT("rotateClock32")), _("Rotate clockwise"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarCircuit->AddButton(ID_RIBBON_ROTATECC, _("Rotate Counter-clockwise"), wxXmlResource::Get()->LoadBitmap(wxT("rotateCounterClock32")), _("Rotate the selected elements counter-clockwise"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarCircuit->AddButton(ID_RIBBON_PROJSETTINGS, _("Project Settings"), wxXmlResource::Get()->LoadBitmap(wxT("settings32")), _("Opens a dialog to set the main settings of the current project"), wxRIBBON_BUTTON_NORMAL);
    m_ribbonButtonBarCircuit->Realize();
    
    m_ribbonPanelReports = new wxRibbonPanel(m_ribbonPageTools, wxID_ANY, _("Data Visualization"), wxNullBitmap, wxDefaultPosition, wxDLG_UNIT(m_ribbonPageTools, wxSize(-1,-1)), wxRIBBON_PANEL_NO_AUTO_MINIMISE|wxRIBBON_PANEL_DEFAULT_STYLE);
    m_ribbonPanelReports->SetToolTip(_("Reports"));
    
    m_ribbonButtonBarReports = new wxRibbonButtonBar(m_ribbonPanelReports, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_ribbonPanelReports, wxSize(-1,-1)), 0);
    
    m_ribbonButtonBarReports->AddButton(ID_RIBBON_DATAREPORT, _("Data Report"), wxXmlResource::Get()->LoadBitmap(wxT("dataReport32")), _("Opens a data report"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarReports->AddButton(ID_RIBBON_CHARTS, _("Charts"), wxXmlResource::Get()->LoadBitmap(wxT("chart32")), _("Open the charts"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarReports->AddButton(ID_RIBBON_HEATMAP, _("Voltage Heatmap"), wxXmlResource::Get()->LoadBitmap(wxT("heatmap32")), _("Enable/disable the voltage heatmap visualization"), wxRIBBON_BUTTON_TOGGLE);
    
    m_ribbonButtonBarReports->AddButton(ID_RIBBON_SNAPSHOT, _("Snapshot"), wxXmlResource::Get()->LoadBitmap(wxT("snap32")), _("Capture a snapshot of the circuit"), wxRIBBON_BUTTON_NORMAL);
    m_ribbonButtonBarReports->Realize();
    
    m_ribbonPageSimulation = new wxRibbonPage(m_ribbonBar, wxID_ANY, _("Simulation"), wxNullBitmap, 0);
    m_ribbonPageSimulation->SetToolTip(_("Simulation"));
    
    m_ribbonPanelContinuous = new wxRibbonPanel(m_ribbonPageSimulation, wxID_ANY, _("Continuous"), wxNullBitmap, wxDefaultPosition, wxDLG_UNIT(m_ribbonPageSimulation, wxSize(-1,-1)), wxRIBBON_PANEL_DEFAULT_STYLE);
    m_ribbonPanelContinuous->SetToolTip(_("Continuous"));
    
    m_ribbonButtonBarContinuous = new wxRibbonButtonBar(m_ribbonPanelContinuous, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_ribbonPanelContinuous, wxSize(-1,-1)), 0);
    
    m_ribbonButtonBarContinuous->AddButton(ID_RIBBON_ENABLESOL, _("Enable Solution"), wxXmlResource::Get()->LoadBitmap(wxT("playStopped32")), _("Enables the power flow and fault (if exists) calculations after any circuit change"), wxRIBBON_BUTTON_TOGGLE);
    
    m_ribbonButtonBarContinuous->AddButton(ID_RIBBON_DISABLESOL, _("Disable Solution"), wxXmlResource::Get()->LoadBitmap(wxT("pauseStopped32")), _("Disables the power flow and fault calculations after any circuit changes"), wxRIBBON_BUTTON_TOGGLE);
    
    m_ribbonButtonBarContinuous->AddButton(ID_RIBBON_RESETVOLT, _("Reset Voltages"), wxXmlResource::Get()->LoadBitmap(wxT("reset32")), _("Reset all voltages to initial state"), wxRIBBON_BUTTON_NORMAL);
    m_ribbonButtonBarContinuous->Realize();
    
    m_ribbonPanelSimulations = new wxRibbonPanel(m_ribbonPageSimulation, wxID_ANY, _("Simulations"), wxNullBitmap, wxDefaultPosition, wxDLG_UNIT(m_ribbonPageSimulation, wxSize(-1,-1)), wxRIBBON_PANEL_NO_AUTO_MINIMISE|wxRIBBON_PANEL_DEFAULT_STYLE);
    m_ribbonPanelSimulations->SetToolTip(_("Simulations"));
    
    m_ribbonButtonBarSimulations = new wxRibbonButtonBar(m_ribbonPanelSimulations, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_ribbonPanelSimulations, wxSize(-1,-1)), 0);
    m_ribbonButtonBarSimulations->SetToolTip(_("Simulations"));
    
    m_ribbonButtonBarSimulations->AddButton(ID_RIBBON_POWERFLOW, _("Power Flow"), wxXmlResource::Get()->LoadBitmap(wxT("powerFLow32")), _("Calculate the circuit power flow"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarSimulations->AddButton(ID_RIBBON_RUNSTAB, _("Run Stability"), wxXmlResource::Get()->LoadBitmap(wxT("playStopped32")), _("Run the stability calculations"), wxRIBBON_BUTTON_HYBRID);
    
    m_ribbonButtonBarSimulations->AddButton(ID_RIBBON_FAULT, _("Fault"), wxXmlResource::Get()->LoadBitmap(wxT("fault32")), _("Calculate the circuit fault (if exists)"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarSimulations->AddButton(ID_RIBBON_SCPOWER, _("Short-Circuit Power"), wxXmlResource::Get()->LoadBitmap(wxT("faultPower32")), _("Calculate the short-circuit power in all buses"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarSimulations->AddButton(ID_RIBBON_HARMDIST, _("Harmonic Distortions"), wxXmlResource::Get()->LoadBitmap(wxT("harmDist32")), _("Calculate the voltage distortions on all buses due to harmonic current sources"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarSimulations->AddButton(ID_RIBBON_FREQRESP, _("Frequency response"), wxXmlResource::Get()->LoadBitmap(wxT("freqResp32")), _("Calculate the impedance seen in a bus for varies frequencies"), wxRIBBON_BUTTON_NORMAL);
    
    m_ribbonButtonBarSimulations->AddButton(ID_RIBBON_SIMULSETTINGS, _("Simulation Settings"), wxXmlResource::Get()->LoadBitmap(wxT("settings32")), _("Opens a dialog to set the settings of the simulations"), wxRIBBON_BUTTON_NORMAL);
    m_ribbonButtonBarSimulations->Realize();
    m_ribbonBar->Realize();
    wxBoxSizer* boxSizer_lvl_2_2 = new wxBoxSizer(wxVERTICAL);
    
    boxSizer_lvl_1_1->Add(boxSizer_lvl_2_2, 1, wxEXPAND, WXC_FROM_DIP(5));
    
    m_auiNotebook = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxAUI_NB_DEFAULT_STYLE|wxBK_DEFAULT);
    m_auiNotebook->SetName(wxT("m_auiNotebook"));
    
    boxSizer_lvl_2_2->Add(m_auiNotebook, 1, wxEXPAND, WXC_FROM_DIP(5));
    
    m_statusBar = new wxStatusBar(this, wxID_ANY, wxSTB_DEFAULT_STYLE);
    m_statusBar->SetFieldsCount(4);
    this->SetStatusBar(m_statusBar);
    
    
    #if wxVERSION_NUMBER >= 2900
    if(!wxPersistenceManager::Get().Find(m_auiNotebook)){
        wxPersistenceManager::Get().RegisterAndRestore(m_auiNotebook);
    } else {
        wxPersistenceManager::Get().Restore(m_auiNotebook);
    }
    #endif
    
    SetName(wxT("MainFrameBase"));
    SetSize(wxDLG_UNIT(this, wxSize(800,600)));
    if (GetSizer()) {
         GetSizer()->Fit(this);
    }
    if(GetParent()) {
        CentreOnParent(wxBOTH);
    } else {
        CentreOnScreen(wxBOTH);
    }
#if wxVERSION_NUMBER >= 2900
    if(!wxPersistenceManager::Get().Find(this)) {
        wxPersistenceManager::Get().RegisterAndRestore(this);
    } else {
        wxPersistenceManager::Get().Restore(this);
    }
#endif
    // Connect events
    this->Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(MainFrameBase::OnClose), NULL, this);
    m_ribbonButtonBarProjects->Connect(ID_RIBBON_NEW, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnNewClick), NULL, this);
    m_ribbonButtonBarProjects->Connect(ID_RIBBON_OPEN, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnOpenClick), NULL, this);
    m_ribbonButtonBarProjects->Connect(ID_RIBBON_IMPORT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnImportClick), NULL, this);
    m_ribbonButtonBarProjects->Connect(ID_RIBBON_GENSETTINGS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnGeneralSettingsClick), NULL, this);
    m_ribbonButtonBarProjects->Connect(ID_RIBBON_EXIT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnExitClick), NULL, this);
    m_ribbonButtonBarCProject->Connect(ID_RIBBON_SAVE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSaveClick), NULL, this);
    m_ribbonButtonBarCProject->Connect(ID_RIBBON_SAVEAS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSaveAsClick), NULL, this);
    m_ribbonButtonBarCProject->Connect(ID_RIBBON_CLOSE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnCloseClick), NULL, this);
    m_ribbonButtonBarHelp->Connect(ID_RIBBON_GUIDE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnPSPGuideClick), NULL, this);
    m_ribbonButtonBarHelp->Connect(ID_RIBBON_ABOUT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnAboutClick), NULL, this);
    m_ribbonButtonBarClipboard->Connect(ID_RIBBON_COPY, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnCopyClick), NULL, this);
    m_ribbonButtonBarClipboard->Connect(ID_RIBBON_PASTE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnPasteClick), NULL, this);
    m_ribbonButtonBarClipboard->Connect(ID_RIBBON_UNDO, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnUndoClick), NULL, this);
    m_ribbonButtonBarClipboard->Connect(ID_RIBBON_REDO, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnRedoClick), NULL, this);
    m_ribbonButtonBarCircuit->Connect(ID_RIBBON_ADDELEMENT, wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnAddElementDropdown), NULL, this);
    m_ribbonButtonBarCircuit->Connect(ID_RIBBON_DRAG, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnDragClick), NULL, this);
    m_ribbonButtonBarCircuit->Connect(ID_RIBBON_MOVE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnMoveClick), NULL, this);
    m_ribbonButtonBarCircuit->Connect(ID_RIBBON_DELETE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnDeleteClick), NULL, this);
    m_ribbonButtonBarCircuit->Connect(ID_RIBBON_FIT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnFitClick), NULL, this);
    m_ribbonButtonBarCircuit->Connect(ID_RIBBON_ROTATEC, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnRotClockClick), NULL, this);
    m_ribbonButtonBarCircuit->Connect(ID_RIBBON_ROTATECC, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnRotCounterClockClick), NULL, this);
    m_ribbonButtonBarCircuit->Connect(ID_RIBBON_PROJSETTINGS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnProjectSettingsClick), NULL, this);
    m_ribbonButtonBarReports->Connect(ID_RIBBON_DATAREPORT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnDataReportClick), NULL, this);
    m_ribbonButtonBarReports->Connect(ID_RIBBON_CHARTS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnChartsClick), NULL, this);
    m_ribbonButtonBarReports->Connect(ID_RIBBON_HEATMAP, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnHeatmapClick), NULL, this);
    m_ribbonButtonBarReports->Connect(ID_RIBBON_SNAPSHOT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSnapshotClick), NULL, this);
    m_ribbonButtonBarContinuous->Connect(ID_RIBBON_ENABLESOL, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnEnableSolutionClick), NULL, this);
    m_ribbonButtonBarContinuous->Connect(ID_RIBBON_DISABLESOL, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnDisableSolutionClick), NULL, this);
    m_ribbonButtonBarContinuous->Connect(ID_RIBBON_RESETVOLT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnResetVoltagesClick), NULL, this);
    m_ribbonButtonBarSimulations->Connect(ID_RIBBON_POWERFLOW, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnPowerFlowClick), NULL, this);
    m_ribbonButtonBarSimulations->Connect(ID_RIBBON_RUNSTAB, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnRunStabilityClick), NULL, this);
    m_ribbonButtonBarSimulations->Connect(ID_RIBBON_RUNSTAB, wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnStabilityDropdown), NULL, this);
    m_ribbonButtonBarSimulations->Connect(ID_RIBBON_FAULT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnFaultClick), NULL, this);
    m_ribbonButtonBarSimulations->Connect(ID_RIBBON_SCPOWER, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSCPowerClick), NULL, this);
    m_ribbonButtonBarSimulations->Connect(ID_RIBBON_HARMDIST, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnHarmDistortionsClick), NULL, this);
    m_ribbonButtonBarSimulations->Connect(ID_RIBBON_FREQRESP, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnFreqResponseClick), NULL, this);
    m_ribbonButtonBarSimulations->Connect(ID_RIBBON_SIMULSETTINGS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSimulationSettingsClick), NULL, this);
    m_auiNotebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler(MainFrameBase::NotebookPageClosing), NULL, this);
    m_auiNotebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler(MainFrameBase::NotebookPageClosed), NULL, this);
    m_auiNotebook->Connect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler(MainFrameBase::OnNotebookPageChanged), NULL, this);
    
}

MainFrameBase::~MainFrameBase()
{
    this->Disconnect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(MainFrameBase::OnClose), NULL, this);
    m_ribbonButtonBarProjects->Disconnect(ID_RIBBON_NEW, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnNewClick), NULL, this);
    m_ribbonButtonBarProjects->Disconnect(ID_RIBBON_OPEN, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnOpenClick), NULL, this);
    m_ribbonButtonBarProjects->Disconnect(ID_RIBBON_IMPORT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnImportClick), NULL, this);
    m_ribbonButtonBarProjects->Disconnect(ID_RIBBON_GENSETTINGS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnGeneralSettingsClick), NULL, this);
    m_ribbonButtonBarProjects->Disconnect(ID_RIBBON_EXIT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnExitClick), NULL, this);
    m_ribbonButtonBarCProject->Disconnect(ID_RIBBON_SAVE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSaveClick), NULL, this);
    m_ribbonButtonBarCProject->Disconnect(ID_RIBBON_SAVEAS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSaveAsClick), NULL, this);
    m_ribbonButtonBarCProject->Disconnect(ID_RIBBON_CLOSE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnCloseClick), NULL, this);
    m_ribbonButtonBarHelp->Disconnect(ID_RIBBON_GUIDE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnPSPGuideClick), NULL, this);
    m_ribbonButtonBarHelp->Disconnect(ID_RIBBON_ABOUT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnAboutClick), NULL, this);
    m_ribbonButtonBarClipboard->Disconnect(ID_RIBBON_COPY, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnCopyClick), NULL, this);
    m_ribbonButtonBarClipboard->Disconnect(ID_RIBBON_PASTE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnPasteClick), NULL, this);
    m_ribbonButtonBarClipboard->Disconnect(ID_RIBBON_UNDO, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnUndoClick), NULL, this);
    m_ribbonButtonBarClipboard->Disconnect(ID_RIBBON_REDO, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnRedoClick), NULL, this);
    m_ribbonButtonBarCircuit->Disconnect(ID_RIBBON_ADDELEMENT, wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnAddElementDropdown), NULL, this);
    m_ribbonButtonBarCircuit->Disconnect(ID_RIBBON_DRAG, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnDragClick), NULL, this);
    m_ribbonButtonBarCircuit->Disconnect(ID_RIBBON_MOVE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnMoveClick), NULL, this);
    m_ribbonButtonBarCircuit->Disconnect(ID_RIBBON_DELETE, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnDeleteClick), NULL, this);
    m_ribbonButtonBarCircuit->Disconnect(ID_RIBBON_FIT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnFitClick), NULL, this);
    m_ribbonButtonBarCircuit->Disconnect(ID_RIBBON_ROTATEC, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnRotClockClick), NULL, this);
    m_ribbonButtonBarCircuit->Disconnect(ID_RIBBON_ROTATECC, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnRotCounterClockClick), NULL, this);
    m_ribbonButtonBarCircuit->Disconnect(ID_RIBBON_PROJSETTINGS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnProjectSettingsClick), NULL, this);
    m_ribbonButtonBarReports->Disconnect(ID_RIBBON_DATAREPORT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnDataReportClick), NULL, this);
    m_ribbonButtonBarReports->Disconnect(ID_RIBBON_CHARTS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnChartsClick), NULL, this);
    m_ribbonButtonBarReports->Disconnect(ID_RIBBON_HEATMAP, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnHeatmapClick), NULL, this);
    m_ribbonButtonBarReports->Disconnect(ID_RIBBON_SNAPSHOT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSnapshotClick), NULL, this);
    m_ribbonButtonBarContinuous->Disconnect(ID_RIBBON_ENABLESOL, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnEnableSolutionClick), NULL, this);
    m_ribbonButtonBarContinuous->Disconnect(ID_RIBBON_DISABLESOL, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnDisableSolutionClick), NULL, this);
    m_ribbonButtonBarContinuous->Disconnect(ID_RIBBON_RESETVOLT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnResetVoltagesClick), NULL, this);
    m_ribbonButtonBarSimulations->Disconnect(ID_RIBBON_POWERFLOW, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnPowerFlowClick), NULL, this);
    m_ribbonButtonBarSimulations->Disconnect(ID_RIBBON_RUNSTAB, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnRunStabilityClick), NULL, this);
    m_ribbonButtonBarSimulations->Disconnect(ID_RIBBON_RUNSTAB, wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnStabilityDropdown), NULL, this);
    m_ribbonButtonBarSimulations->Disconnect(ID_RIBBON_FAULT, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnFaultClick), NULL, this);
    m_ribbonButtonBarSimulations->Disconnect(ID_RIBBON_SCPOWER, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSCPowerClick), NULL, this);
    m_ribbonButtonBarSimulations->Disconnect(ID_RIBBON_HARMDIST, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnHarmDistortionsClick), NULL, this);
    m_ribbonButtonBarSimulations->Disconnect(ID_RIBBON_FREQRESP, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnFreqResponseClick), NULL, this);
    m_ribbonButtonBarSimulations->Disconnect(ID_RIBBON_SIMULSETTINGS, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(MainFrameBase::OnSimulationSettingsClick), NULL, this);
    m_auiNotebook->Disconnect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler(MainFrameBase::NotebookPageClosing), NULL, this);
    m_auiNotebook->Disconnect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler(MainFrameBase::NotebookPageClosed), NULL, this);
    m_auiNotebook->Disconnect(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler(MainFrameBase::OnNotebookPageChanged), NULL, this);
    
}