diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2019-07-24 00:02:17 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2019-07-24 00:02:17 -0300 |
commit | 0ca6710a7e003952e1212c8e32ebb2e7c008d508 (patch) | |
tree | 54886abf6d62d9341377d535e52b36016b602107 /Project/DataReportBase.cpp | |
parent | 7f46d390b8cc1d5f37560f52b222198dbc5e1225 (diff) | |
download | PSP.git-0ca6710a7e003952e1212c8e32ebb2e7c008d508.tar.gz PSP.git-0ca6710a7e003952e1212c8e32ebb2e7c008d508.tar.xz PSP.git-0ca6710a7e003952e1212c8e32ebb2e7c008d508.zip |
Newton bug fixed
Diffstat (limited to 'Project/DataReportBase.cpp')
-rw-r--r-- | Project/DataReportBase.cpp | 340 |
1 files changed, 217 insertions, 123 deletions
diff --git a/Project/DataReportBase.cpp b/Project/DataReportBase.cpp index 33bea44..5b3737a 100644 --- a/Project/DataReportBase.cpp +++ b/Project/DataReportBase.cpp @@ -6,17 +6,20 @@ #include "DataReportBase.h" - // Declare the bitmap loading function extern void wxC6A63InitBitmapResources(); static bool bBitmapLoaded = false; - -DataReportBase::DataReportBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) +DataReportBase::DataReportBase(wxWindow* parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style) : wxFrame(parent, id, title, pos, size, style) { - if ( !bBitmapLoaded ) { + if(!bBitmapLoaded) { // We need to initialise the default bitmap handler wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler); wxC6A63InitBitmapResources(); @@ -28,219 +31,234 @@ DataReportBase::DataReportBase(wxWindow* parent, wxWindowID id, const wxString& wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("chart16")); wxIcon icn; icn.CopyFromBitmap(iconBmp); - app_icons.AddIcon( icn ); + app_icons.AddIcon(icn); } { wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("chart32")); wxIcon icn; icn.CopyFromBitmap(iconBmp); - app_icons.AddIcon( icn ); + app_icons.AddIcon(icn); } { wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("chart64")); wxIcon icn; icn.CopyFromBitmap(iconBmp); - app_icons.AddIcon( icn ); + app_icons.AddIcon(icn); } { wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("chart128")); wxIcon icn; icn.CopyFromBitmap(iconBmp); - app_icons.AddIcon( icn ); + app_icons.AddIcon(icn); } { wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("chart256")); wxIcon icn; icn.CopyFromBitmap(iconBmp); - app_icons.AddIcon( icn ); + app_icons.AddIcon(icn); } - SetIcons( app_icons ); + SetIcons(app_icons); - wxBoxSizer* boxSizerLvl1_1 = new wxBoxSizer(wxVERTICAL); this->SetSizer(boxSizerLvl1_1); - + wxBoxSizer* boxSizerLvl2_1 = new wxBoxSizer(wxHORIZONTAL); - + boxSizerLvl1_1->Add(boxSizerLvl2_1, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_notebookDataReport = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBK_DEFAULT); + + m_notebookDataReport = + new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxBK_DEFAULT); m_notebookDataReport->SetName(wxT("m_notebookDataReport")); - + boxSizerLvl2_1->Add(m_notebookDataReport, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelPowerFlowData = new wxPanel(m_notebookDataReport, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookDataReport, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelPowerFlowData = new wxPanel(m_notebookDataReport, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookDataReport, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookDataReport->AddPage(m_panelPowerFlowData, _("Power flow data"), false); - + wxBoxSizer* boxSizerLvl3_1 = new wxBoxSizer(wxVERTICAL); m_panelPowerFlowData->SetSizer(boxSizerLvl3_1); - - m_notebookPowerFlow = new wxNotebook(m_panelPowerFlowData, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelPowerFlowData, wxSize(-1,-1)), wxBK_LEFT|wxBK_DEFAULT); + + m_notebookPowerFlow = new wxNotebook(m_panelPowerFlowData, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_panelPowerFlowData, wxSize(-1, -1)), wxBK_LEFT | wxBK_DEFAULT); m_notebookPowerFlow->SetName(wxT("m_notebookPowerFlow")); - + boxSizerLvl3_1->Add(m_notebookPowerFlow, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelPowerFlow = new wxPanel(m_notebookPowerFlow, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookPowerFlow, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelPowerFlow = new wxPanel(m_notebookPowerFlow, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookPowerFlow, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookPowerFlow->AddPage(m_panelPowerFlow, _("Power flow"), false); - + wxBoxSizer* boxSizerLvl4_1 = new wxBoxSizer(wxVERTICAL); m_panelPowerFlow->SetSizer(boxSizerLvl4_1); - - m_gridPowerFlow = new wxGrid(m_panelPowerFlow, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelPowerFlow, wxSize(-1,-1)), wxWANTS_CHARS); + + m_gridPowerFlow = new wxGrid(m_panelPowerFlow, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_panelPowerFlow, wxSize(-1, -1)), wxWANTS_CHARS); m_gridPowerFlow->CreateGrid(0, 0); m_gridPowerFlow->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); m_gridPowerFlow->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); - #if wxVERSION_NUMBER >= 2904 +#if wxVERSION_NUMBER >= 2904 m_gridPowerFlow->UseNativeColHeader(true); - #endif +#endif m_gridPowerFlow->EnableEditing(true); - + boxSizerLvl4_1->Add(m_gridPowerFlow, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelPFBuses = new wxPanel(m_notebookPowerFlow, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookPowerFlow, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelPFBuses = new wxPanel(m_notebookPowerFlow, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookPowerFlow, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookPowerFlow->AddPage(m_panelPFBuses, _("Buses"), false); - + wxBoxSizer* boxSizerLvl4_2 = new wxBoxSizer(wxVERTICAL); m_panelPFBuses->SetSizer(boxSizerLvl4_2); - - m_gridPFBuses = new wxGrid(m_panelPFBuses, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelPFBuses, wxSize(-1,-1)), wxWANTS_CHARS); + + m_gridPFBuses = new wxGrid(m_panelPFBuses, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelPFBuses, wxSize(-1, -1)), + wxWANTS_CHARS); m_gridPFBuses->CreateGrid(0, 0); m_gridPFBuses->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); m_gridPFBuses->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); - #if wxVERSION_NUMBER >= 2904 +#if wxVERSION_NUMBER >= 2904 m_gridPFBuses->UseNativeColHeader(true); - #endif +#endif m_gridPFBuses->EnableEditing(true); - + boxSizerLvl4_2->Add(m_gridPFBuses, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelPFBranches = new wxPanel(m_notebookPowerFlow, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookPowerFlow, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelPFBranches = new wxPanel(m_notebookPowerFlow, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookPowerFlow, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookPowerFlow->AddPage(m_panelPFBranches, _("Branches"), false); - + wxBoxSizer* boxSizerLvl4_3 = new wxBoxSizer(wxVERTICAL); m_panelPFBranches->SetSizer(boxSizerLvl4_3); - - m_gridPFBranches = new wxGrid(m_panelPFBranches, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelPFBranches, wxSize(-1,-1)), wxWANTS_CHARS); + + m_gridPFBranches = new wxGrid(m_panelPFBranches, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_panelPFBranches, wxSize(-1, -1)), wxWANTS_CHARS); m_gridPFBranches->CreateGrid(0, 0); m_gridPFBranches->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); m_gridPFBranches->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); - #if wxVERSION_NUMBER >= 2904 +#if wxVERSION_NUMBER >= 2904 m_gridPFBranches->UseNativeColHeader(true); - #endif +#endif m_gridPFBranches->EnableEditing(true); - + boxSizerLvl4_3->Add(m_gridPFBranches, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelFaultData = new wxPanel(m_notebookDataReport, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookDataReport, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelFaultData = new wxPanel(m_notebookDataReport, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookDataReport, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookDataReport->AddPage(m_panelFaultData, _("Fault data"), false); - + wxBoxSizer* boxSizerLvl3_2 = new wxBoxSizer(wxVERTICAL); m_panelFaultData->SetSizer(boxSizerLvl3_2); - - m_notebookFault = new wxNotebook(m_panelFaultData, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelFaultData, wxSize(-1,-1)), wxBK_LEFT|wxBK_DEFAULT); + + m_notebookFault = new wxNotebook(m_panelFaultData, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_panelFaultData, wxSize(-1, -1)), wxBK_LEFT | wxBK_DEFAULT); m_notebookFault->SetName(wxT("m_notebookFault")); - + boxSizerLvl3_2->Add(m_notebookFault, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelFault = new wxPanel(m_notebookFault, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookFault, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelFault = new wxPanel(m_notebookFault, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookFault, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookFault->AddPage(m_panelFault, _("Fault"), false); - + wxBoxSizer* boxSizerLvl4_4 = new wxBoxSizer(wxVERTICAL); m_panelFault->SetSizer(boxSizerLvl4_4); - - m_gridFault = new wxGrid(m_panelFault, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelFault, wxSize(-1,-1)), wxWANTS_CHARS); + + m_gridFault = + new wxGrid(m_panelFault, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelFault, wxSize(-1, -1)), wxWANTS_CHARS); m_gridFault->CreateGrid(0, 0); m_gridFault->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); m_gridFault->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); - #if wxVERSION_NUMBER >= 2904 +#if wxVERSION_NUMBER >= 2904 m_gridFault->UseNativeColHeader(true); - #endif +#endif m_gridFault->EnableEditing(true); - + boxSizerLvl4_4->Add(m_gridFault, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelFaultBuses = new wxPanel(m_notebookFault, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookFault, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelFaultBuses = new wxPanel(m_notebookFault, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookFault, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookFault->AddPage(m_panelFaultBuses, _("Buses"), false); - + wxBoxSizer* boxSizerLvl4_5 = new wxBoxSizer(wxVERTICAL); m_panelFaultBuses->SetSizer(boxSizerLvl4_5); - - m_gridFaultBuses = new wxGrid(m_panelFaultBuses, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelFaultBuses, wxSize(-1,-1)), wxWANTS_CHARS); + + m_gridFaultBuses = new wxGrid(m_panelFaultBuses, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_panelFaultBuses, wxSize(-1, -1)), wxWANTS_CHARS); m_gridFaultBuses->CreateGrid(0, 0); m_gridFaultBuses->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); m_gridFaultBuses->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); - #if wxVERSION_NUMBER >= 2904 +#if wxVERSION_NUMBER >= 2904 m_gridFaultBuses->UseNativeColHeader(true); - #endif +#endif m_gridFaultBuses->EnableEditing(true); - + boxSizerLvl4_5->Add(m_gridFaultBuses, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelFaultBranches = new wxPanel(m_notebookFault, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookFault, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelFaultBranches = new wxPanel(m_notebookFault, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookFault, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookFault->AddPage(m_panelFaultBranches, _("Branches"), false); - + wxBoxSizer* boxSizerLvl4_6 = new wxBoxSizer(wxVERTICAL); m_panelFaultBranches->SetSizer(boxSizerLvl4_6); - - m_gridFaultBranches = new wxGrid(m_panelFaultBranches, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelFaultBranches, wxSize(-1,-1)), wxWANTS_CHARS); + + m_gridFaultBranches = new wxGrid(m_panelFaultBranches, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_panelFaultBranches, wxSize(-1, -1)), wxWANTS_CHARS); m_gridFaultBranches->CreateGrid(0, 0); m_gridFaultBranches->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); m_gridFaultBranches->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); - #if wxVERSION_NUMBER >= 2904 +#if wxVERSION_NUMBER >= 2904 m_gridFaultBranches->UseNativeColHeader(true); - #endif +#endif m_gridFaultBranches->EnableEditing(true); - + boxSizerLvl4_6->Add(m_gridFaultBranches, 1, wxEXPAND, WXC_FROM_DIP(5)); - - m_panelFaultGenerators = new wxPanel(m_notebookFault, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_notebookFault, wxSize(-1,-1)), wxTAB_TRAVERSAL); + + m_panelFaultGenerators = new wxPanel(m_notebookFault, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_notebookFault, wxSize(-1, -1)), wxTAB_TRAVERSAL); m_notebookFault->AddPage(m_panelFaultGenerators, _("Generators"), false); - + wxBoxSizer* boxSizerLvl4_118 = new wxBoxSizer(wxVERTICAL); m_panelFaultGenerators->SetSizer(boxSizerLvl4_118); - - m_gridFaultGenerators = new wxGrid(m_panelFaultGenerators, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_panelFaultGenerators, wxSize(-1,-1)), wxWANTS_CHARS); + + m_gridFaultGenerators = new wxGrid(m_panelFaultGenerators, wxID_ANY, wxDefaultPosition, + wxDLG_UNIT(m_panelFaultGenerators, wxSize(-1, -1)), wxWANTS_CHARS); m_gridFaultGenerators->CreateGrid(0, 0); m_gridFaultGenerators->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); m_gridFaultGenerators->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); - #if wxVERSION_NUMBER >= 2904 +#if wxVERSION_NUMBER >= 2904 m_gridFaultGenerators->UseNativeColHeader(true); - #endif +#endif m_gridFaultGenerators->EnableEditing(true); - + boxSizerLvl4_118->Add(m_gridFaultGenerators, 1, wxEXPAND, WXC_FROM_DIP(5)); - - - #if wxVERSION_NUMBER >= 2900 - if(!wxPersistenceManager::Get().Find(m_notebookDataReport)){ + +#if wxVERSION_NUMBER >= 2900 + if(!wxPersistenceManager::Get().Find(m_notebookDataReport)) { wxPersistenceManager::Get().RegisterAndRestore(m_notebookDataReport); } else { wxPersistenceManager::Get().Restore(m_notebookDataReport); } - #endif - - #if wxVERSION_NUMBER >= 2900 - if(!wxPersistenceManager::Get().Find(m_notebookPowerFlow)){ +#endif + +#if wxVERSION_NUMBER >= 2900 + if(!wxPersistenceManager::Get().Find(m_notebookPowerFlow)) { wxPersistenceManager::Get().RegisterAndRestore(m_notebookPowerFlow); } else { wxPersistenceManager::Get().Restore(m_notebookPowerFlow); } - #endif - - #if wxVERSION_NUMBER >= 2900 - if(!wxPersistenceManager::Get().Find(m_notebookFault)){ +#endif + +#if wxVERSION_NUMBER >= 2900 + if(!wxPersistenceManager::Get().Find(m_notebookFault)) { wxPersistenceManager::Get().RegisterAndRestore(m_notebookFault); } else { wxPersistenceManager::Get().Restore(m_notebookFault); } - #endif - +#endif + SetName(wxT("DataReportBase")); - SetMinClientSize(wxSize(500,300)); - SetSize(-1,-1); - if (GetSizer()) { - GetSizer()->Fit(this); - } + SetMinClientSize(wxSize(500, 300)); + SetSize(wxDLG_UNIT(this, wxSize(-1, -1))); + if(GetSizer()) { GetSizer()->Fit(this); } if(GetParent()) { CentreOnParent(wxBOTH); } else { @@ -254,38 +272,114 @@ DataReportBase::DataReportBase(wxWindow* parent, wxWindowID id, const wxString& } #endif // Connect events - m_gridPowerFlow->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPowerFlowGridChanged), NULL, this); + m_gridPowerFlow->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPowerFlowGridChanged), NULL, + this); m_gridPowerFlow->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridPFKeyDown), NULL, this); m_gridPFBuses->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPFBusGridChanged), NULL, this); m_gridPFBuses->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridPFBusesKeyDown), NULL, this); - m_gridPFBranches->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPFBranchesGridChanged), NULL, this); + m_gridPFBranches->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPFBranchesGridChanged), + NULL, this); m_gridPFBranches->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridPFBranchesKeyDown), NULL, this); m_gridFault->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaulrGridChanged), NULL, this); m_gridFault->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultKeyDown), NULL, this); - m_gridFaultBuses->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaultBusesGridChanged), NULL, this); + m_gridFaultBuses->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaultBusesGridChanged), + NULL, this); m_gridFaultBuses->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultBusesKeyDown), NULL, this); - m_gridFaultBranches->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaultBranchesGridChanged), NULL, this); - m_gridFaultBranches->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultBranchesKeyDown), NULL, this); - m_gridFaultGenerators->Connect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaultGeneratorsGridChanged), NULL, this); - m_gridFaultGenerators->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultGeneratorsKeyDown), NULL, this); - + m_gridFaultBranches->Connect(wxEVT_GRID_CELL_CHANGED, + wxGridEventHandler(DataReportBase::OnFaultBranchesGridChanged), NULL, this); + m_gridFaultBranches->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultBranchesKeyDown), NULL, + this); + m_gridFaultGenerators->Connect(wxEVT_GRID_CELL_CHANGED, + wxGridEventHandler(DataReportBase::OnFaultGeneratorsGridChanged), NULL, this); + m_gridFaultGenerators->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultGeneratorsKeyDown), + NULL, this); } DataReportBase::~DataReportBase() { - m_gridPowerFlow->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPowerFlowGridChanged), NULL, this); + m_gridPowerFlow->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPowerFlowGridChanged), + NULL, this); m_gridPowerFlow->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridPFKeyDown), NULL, this); - m_gridPFBuses->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPFBusGridChanged), NULL, this); + m_gridPFBuses->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPFBusGridChanged), NULL, + this); m_gridPFBuses->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridPFBusesKeyDown), NULL, this); - m_gridPFBranches->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPFBranchesGridChanged), NULL, this); - m_gridPFBranches->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridPFBranchesKeyDown), NULL, this); - m_gridFault->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaulrGridChanged), NULL, this); + m_gridPFBranches->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnPFBranchesGridChanged), + NULL, this); + m_gridPFBranches->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridPFBranchesKeyDown), NULL, + this); + m_gridFault->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaulrGridChanged), NULL, + this); m_gridFault->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultKeyDown), NULL, this); - m_gridFaultBuses->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaultBusesGridChanged), NULL, this); - m_gridFaultBuses->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultBusesKeyDown), NULL, this); - m_gridFaultBranches->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaultBranchesGridChanged), NULL, this); - m_gridFaultBranches->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultBranchesKeyDown), NULL, this); - m_gridFaultGenerators->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaultGeneratorsGridChanged), NULL, this); - m_gridFaultGenerators->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultGeneratorsKeyDown), NULL, this); - + m_gridFaultBuses->Disconnect(wxEVT_GRID_CELL_CHANGED, wxGridEventHandler(DataReportBase::OnFaultBusesGridChanged), + NULL, this); + m_gridFaultBuses->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultBusesKeyDown), NULL, + this); + m_gridFaultBranches->Disconnect(wxEVT_GRID_CELL_CHANGED, + wxGridEventHandler(DataReportBase::OnFaultBranchesGridChanged), NULL, this); + m_gridFaultBranches->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultBranchesKeyDown), NULL, + this); + m_gridFaultGenerators->Disconnect(wxEVT_GRID_CELL_CHANGED, + wxGridEventHandler(DataReportBase::OnFaultGeneratorsGridChanged), NULL, this); + m_gridFaultGenerators->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(DataReportBase::OnGridFaultGeneratorsKeyDown), + NULL, this); +} + +StabilityEventListBase::StabilityEventListBase(wxWindow* parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style) + : wxDialog(parent, id, title, pos, size, style) +{ + if(!bBitmapLoaded) { + // We need to initialise the default bitmap handler + wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler); + wxC6A63InitBitmapResources(); + bBitmapLoaded = true; + } + + wxBoxSizer* boxSizerLvl1_1 = new wxBoxSizer(wxVERTICAL); + this->SetSizer(boxSizerLvl1_1); + + m_gridStabEventList = + new wxGrid(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxWANTS_CHARS); + m_gridStabEventList->CreateGrid(0, 0); + m_gridStabEventList->SetRowLabelAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); + m_gridStabEventList->SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); +#if wxVERSION_NUMBER >= 2904 + m_gridStabEventList->UseNativeColHeader(true); +#endif + m_gridStabEventList->EnableEditing(true); + + boxSizerLvl1_1->Add(m_gridStabEventList, 1, wxEXPAND, WXC_FROM_DIP(5)); + + m_buttonOK = new wxButton(this, wxID_ANY, _("OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0); + + boxSizerLvl1_1->Add(m_buttonOK, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5)); + + SetName(wxT("StabilityEventListBase")); + SetSize(wxDLG_UNIT(this, wxSize(500, 300))); + 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 + m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StabilityEventListBase::OnOKButtonClick), + NULL, this); +} + +StabilityEventListBase::~StabilityEventListBase() +{ + m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StabilityEventListBase::OnOKButtonClick), + NULL, this); } |