diff options
-rw-r--r-- | Project/DataReport.cpp | 60 | ||||
-rw-r--r-- | Project/DataReport.h | 8 | ||||
-rw-r--r-- | Project/DataReport.wxcp | 49 | ||||
-rw-r--r-- | Project/ImportForm.cpp | 90 | ||||
-rw-r--r-- | Project/ImportForm.h | 2 | ||||
-rw-r--r-- | Project/Project.mk | 2 | ||||
-rw-r--r-- | Project/base/DataReportBase.cpp | 14 | ||||
-rw-r--r-- | Project/base/DataReportBase.h | 7 |
8 files changed, 206 insertions, 26 deletions
diff --git a/Project/DataReport.cpp b/Project/DataReport.cpp index 1db2e2a..2742471 100644 --- a/Project/DataReport.cpp +++ b/Project/DataReport.cpp @@ -16,8 +16,8 @@ */ #include "DataReport.h" -#include "Workspace.h" #include "ElectricCalculation.h" +#include "Workspace.h" DataReport::DataReport(wxWindow* parent, Workspace* workspace) : DataReportBase(parent) { @@ -386,9 +386,7 @@ void DataReport::FillValues(GridSelection gridToFill) textColour = m_offlineColour; } for(int i = 0; i < 2; ++i) { - for(int j = 0; j < 7; ++j) { - m_gridPowerFlow->SetCellTextColour(rowNumber + i, j, textColour); - } + for(int j = 0; j < 7; ++j) { m_gridPowerFlow->SetCellTextColour(rowNumber + i, j, textColour); } } m_gridPowerFlow->SetCellValue(rowNumber, 9, isOnline); @@ -435,9 +433,7 @@ void DataReport::FillValues(GridSelection gridToFill) textColour = m_offlineColour; } for(int i = 0; i < 2; ++i) { - for(int j = 0; j < 7; ++j) { - m_gridPowerFlow->SetCellTextColour(rowNumber + i, j, textColour); - } + for(int j = 0; j < 7; ++j) { m_gridPowerFlow->SetCellTextColour(rowNumber + i, j, textColour); } } m_gridPowerFlow->SetCellValue(rowNumber, 0, _("Transformer")); @@ -542,9 +538,7 @@ void DataReport::FillValues(GridSelection gridToFill) isOnline = _("No"); textColour = m_offlineColour; } - for(int j = 0; j < 10; ++j) { - m_gridPFBranches->SetCellTextColour(rowNumber, j, textColour); - } + for(int j = 0; j < 10; ++j) { m_gridPFBranches->SetCellTextColour(rowNumber, j, textColour); } m_gridPFBranches->SetCellValue(rowNumber, 0, _("Line")); m_gridPFBranches->SetCellValue(rowNumber, 1, data.name); @@ -593,9 +587,7 @@ void DataReport::FillValues(GridSelection gridToFill) isOnline = _("No"); textColour = m_offlineColour; } - for(int j = 0; j < 10; ++j) { - m_gridPFBranches->SetCellTextColour(rowNumber, j, textColour); - } + for(int j = 0; j < 10; ++j) { m_gridPFBranches->SetCellTextColour(rowNumber, j, textColour); } m_gridPFBranches->SetCellValue(rowNumber, 0, _("Transformer")); m_gridPFBranches->SetCellValue(rowNumber, 1, data.name); @@ -742,9 +734,7 @@ void DataReport::FillValues(GridSelection gridToFill) textColour = m_offlineColour; } for(int i = 0; i < 2; ++i) { - for(int j = 0; j < 11; ++j) { - m_gridFaultBranches->SetCellTextColour(rowNumber + i, j, textColour); - } + for(int j = 0; j < 11; ++j) { m_gridFaultBranches->SetCellTextColour(rowNumber + i, j, textColour); } } m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Line")); @@ -846,9 +836,7 @@ void DataReport::FillValues(GridSelection gridToFill) textColour = m_offlineColour; } for(int i = 0; i < 2; ++i) { - for(int j = 0; j < 11; ++j) { - m_gridFaultBranches->SetCellTextColour(rowNumber + i, j, textColour); - } + for(int j = 0; j < 11; ++j) { m_gridFaultBranches->SetCellTextColour(rowNumber + i, j, textColour); } } m_gridFaultBranches->SetCellValue(rowNumber, 0, _("Transformer")); @@ -1018,3 +1006,37 @@ void DataReport::OnPowerFlowGridChanged(wxGridEvent& event) { if(!m_changingValues) FillValues(GRID_PF); } + +void DataReport::GridKeyHandler(wxGrid* grid, wxKeyEvent& event) +{ + if(event.GetKeyCode() == 'C' && event.GetModifiers() == wxMOD_CONTROL) { // Copy selection + // [Ref.] https://forums.wxwidgets.org/viewtopic.php?t=2200 + wxString copyData = ""; + bool lineNotEmpty; + + for(int i = 0; i < grid->GetNumberRows(); i++) { + lineNotEmpty = false; + for(int j = 0; j < grid->GetNumberCols(); j++) { + if(grid->IsInSelection(i, j)) { + if(lineNotEmpty == false) { + if(copyData.IsEmpty() == false) { + copyData.Append(wxT("\r\n")); // In Windows if copy to notepad need \r\n to new line. + } + lineNotEmpty = true; + } else { + copyData.Append(wxT("\t")); + } + copyData = copyData + grid->GetCellValue(i, j); + } + } + } + + wxOpenClipboard(); + wxEmptyClipboard(); + wxSetClipboardData(wxDF_TEXT, copyData.mb_str(), 0, 0); // In Windows need this for UNICODE + wxCloseClipboard(); + } else if(event.GetKeyCode() == 'A' && event.GetModifiers() == wxMOD_CONTROL) { // Select all + grid->SelectAll(); + } + event.Skip(); +} diff --git a/Project/DataReport.h b/Project/DataReport.h index 8f35a1b..854bb06 100644 --- a/Project/DataReport.h +++ b/Project/DataReport.h @@ -51,6 +51,7 @@ class DataReport : public DataReportBase virtual void CreateGrids(); virtual void FillValues(GridSelection gridToFill = GRID_ALL); virtual void SetRowsColours(wxGrid* grid, int rowStart = 1); + virtual void GridKeyHandler(wxGrid* grid, wxKeyEvent& event); protected: virtual void OnFaulrGridChanged(wxGridEvent& event); @@ -60,6 +61,13 @@ class DataReport : public DataReportBase virtual void OnPFBranchesGridChanged(wxGridEvent& event); virtual void OnPowerFlowGridChanged(wxGridEvent& event); virtual void OnPFBusGridChanged(wxGridEvent& event); + virtual void OnGridFaultBranchesKeyDown(wxKeyEvent& event) { GridKeyHandler(m_gridFaultBranches, event); } + virtual void OnGridFaultBusesKeyDown(wxKeyEvent& event) { GridKeyHandler(m_gridFaultBuses, event); } + virtual void OnGridFaultGeneratorsKeyDown(wxKeyEvent& event) { GridKeyHandler(m_gridFaultGenerators, event); } + virtual void OnGridFaultKeyDown(wxKeyEvent& event) { GridKeyHandler(m_gridFault, event); } + virtual void OnGridPFBranchesKeyDown(wxKeyEvent& event) { GridKeyHandler(m_gridPFBranches, event); } + virtual void OnGridPFBusesKeyDown(wxKeyEvent& event) { GridKeyHandler(m_gridPFBuses, event); } + virtual void OnGridPFKeyDown(wxKeyEvent& event) { GridKeyHandler(m_gridPowerFlow, event); } Workspace* m_workspace = NULL; bool m_changingValues = false; diff --git a/Project/DataReport.wxcp b/Project/DataReport.wxcp index 3dc0a87..65bd23e 100644 --- a/Project/DataReport.wxcp +++ b/Project/DataReport.wxcp @@ -645,6 +645,13 @@ "m_functionNameAndSignature": "OnPowerFlowGridChanged(wxGridEvent& event)", "m_description": "The user changed the data in a cell. The old cell value as string is available from GetString() event object method. Notice that vetoing this event still works for backwards compatibility reasons but any new code should only veto EVT_GRID_CELL_CHANGING event and not this one. Processes a wxEVT_GRID_CELL_CHANGED event type.", "m_noBody": false + }, { + "m_eventName": "wxEVT_KEY_DOWN", + "m_eventClass": "wxKeyEvent", + "m_eventHandler": "wxKeyEventHandler", + "m_functionNameAndSignature": "OnGridPFKeyDown(wxKeyEvent& event)", + "m_description": "Process a wxEVT_KEY_DOWN event (any key has been pressed)", + "m_noBody": false }], "m_children": [] }] @@ -870,6 +877,13 @@ "m_functionNameAndSignature": "OnPFBusGridChanged(wxGridEvent& event)", "m_description": "The user changed the data in a cell. The old cell value as string is available from GetString() event object method. Notice that vetoing this event still works for backwards compatibility reasons but any new code should only veto EVT_GRID_CELL_CHANGING event and not this one. Processes a wxEVT_GRID_CELL_CHANGED event type.", "m_noBody": false + }, { + "m_eventName": "wxEVT_KEY_DOWN", + "m_eventClass": "wxKeyEvent", + "m_eventHandler": "wxKeyEventHandler", + "m_functionNameAndSignature": "OnGridPFBusesKeyDown(wxKeyEvent& event)", + "m_description": "Process a wxEVT_KEY_DOWN event (any key has been pressed)", + "m_noBody": false }], "m_children": [] }] @@ -1095,6 +1109,13 @@ "m_functionNameAndSignature": "OnPFBranchesGridChanged(wxGridEvent& event)", "m_description": "The user changed the data in a cell. The old cell value as string is available from GetString() event object method. Notice that vetoing this event still works for backwards compatibility reasons but any new code should only veto EVT_GRID_CELL_CHANGING event and not this one. Processes a wxEVT_GRID_CELL_CHANGED event type.", "m_noBody": false + }, { + "m_eventName": "wxEVT_KEY_DOWN", + "m_eventClass": "wxKeyEvent", + "m_eventHandler": "wxKeyEventHandler", + "m_functionNameAndSignature": "OnGridPFBranchesKeyDown(wxKeyEvent& event)", + "m_description": "Process a wxEVT_KEY_DOWN event (any key has been pressed)", + "m_noBody": false }], "m_children": [] }] @@ -1498,6 +1519,13 @@ "m_functionNameAndSignature": "OnFaulrGridChanged(wxGridEvent& event)", "m_description": "The user changed the data in a cell. The old cell value as string is available from GetString() event object method. Notice that vetoing this event still works for backwards compatibility reasons but any new code should only veto EVT_GRID_CELL_CHANGING event and not this one. Processes a wxEVT_GRID_CELL_CHANGED event type.", "m_noBody": false + }, { + "m_eventName": "wxEVT_KEY_DOWN", + "m_eventClass": "wxKeyEvent", + "m_eventHandler": "wxKeyEventHandler", + "m_functionNameAndSignature": "OnGridFaultKeyDown(wxKeyEvent& event)", + "m_description": "Process a wxEVT_KEY_DOWN event (any key has been pressed)", + "m_noBody": false }], "m_children": [] }] @@ -1723,6 +1751,13 @@ "m_functionNameAndSignature": "OnFaultBusesGridChanged(wxGridEvent& event)", "m_description": "The user changed the data in a cell. The old cell value as string is available from GetString() event object method. Notice that vetoing this event still works for backwards compatibility reasons but any new code should only veto EVT_GRID_CELL_CHANGING event and not this one. Processes a wxEVT_GRID_CELL_CHANGED event type.", "m_noBody": false + }, { + "m_eventName": "wxEVT_KEY_DOWN", + "m_eventClass": "wxKeyEvent", + "m_eventHandler": "wxKeyEventHandler", + "m_functionNameAndSignature": "OnGridFaultBusesKeyDown(wxKeyEvent& event)", + "m_description": "Process a wxEVT_KEY_DOWN event (any key has been pressed)", + "m_noBody": false }], "m_children": [] }] @@ -1948,6 +1983,13 @@ "m_functionNameAndSignature": "OnFaultBranchesGridChanged(wxGridEvent& event)", "m_description": "The user changed the data in a cell. The old cell value as string is available from GetString() event object method. Notice that vetoing this event still works for backwards compatibility reasons but any new code should only veto EVT_GRID_CELL_CHANGING event and not this one. Processes a wxEVT_GRID_CELL_CHANGED event type.", "m_noBody": false + }, { + "m_eventName": "wxEVT_KEY_DOWN", + "m_eventClass": "wxKeyEvent", + "m_eventHandler": "wxKeyEventHandler", + "m_functionNameAndSignature": "OnGridFaultBranchesKeyDown(wxKeyEvent& event)", + "m_description": "Process a wxEVT_KEY_DOWN event (any key has been pressed)", + "m_noBody": false }], "m_children": [] }] @@ -2173,6 +2215,13 @@ "m_functionNameAndSignature": "OnFaultGeneratorsGridChanged(wxGridEvent& event)", "m_description": "The user changed the data in a cell. The old cell value as string is available from GetString() event object method. Notice that vetoing this event still works for backwards compatibility reasons but any new code should only veto EVT_GRID_CELL_CHANGING event and not this one. Processes a wxEVT_GRID_CELL_CHANGED event type.", "m_noBody": false + }, { + "m_eventName": "wxEVT_KEY_DOWN", + "m_eventClass": "wxKeyEvent", + "m_eventHandler": "wxKeyEventHandler", + "m_functionNameAndSignature": "OnGridFaultGeneratorsKeyDown(wxKeyEvent& event)", + "m_description": "Process a wxEVT_KEY_DOWN event (any key has been pressed)", + "m_noBody": false }], "m_children": [] }] diff --git a/Project/ImportForm.cpp b/Project/ImportForm.cpp index 53afe23..0916353 100644 --- a/Project/ImportForm.cpp +++ b/Project/ImportForm.cpp @@ -148,7 +148,8 @@ bool ImportForm::ImportSelectedFiles() SyncGenerator* syncGenerator = new SyncGenerator(); auto data = syncGenerator->GetElectricalData(); - data.name = wxString::Format("%s %u (%s)", _("Generator"), indList.size() + 1, busData->busName); + data.name = + wxString::Format("%s %u (%s)", _("Generator"), syncGeneratorList.size() + 1, busData->busName); data.activePower = busData->genPower.real(); data.reactivePower = busData->genPower.imag(); data.minReactive = busData->minReactivePower; @@ -162,7 +163,7 @@ bool ImportForm::ImportSelectedFiles() SyncMotor* syncMotor = new SyncMotor(); auto data = syncMotor->GetElectricalData(); - data.name = wxString::Format("%s %u (%s)", _("Synchronous compensator"), indList.size() + 1, + data.name = wxString::Format("%s %u (%s)", _("Synchronous compensator"), syncMotorList.size() + 1, busData->busName); data.activePower = busData->genPower.real() == 0.0 ? 0.0 : -busData->genPower.real(); data.reactivePower = busData->genPower.imag(); @@ -197,6 +198,10 @@ bool ImportForm::ImportSelectedFiles() wxPoint2DDouble nodePos = parseAnarede.GetNodePositionFromID(parentBus, scale, (*it)->busConnectionNode[0].second); + ParseAnarede::IndGenData* genData = static_cast<ParseAnarede::IndGenData*>( + parseAnarede.GetIndElementDataFromID((*it)->electricalID, (*it)->busConnectionID[0].second)); + double numUnits = static_cast<double>(genData->numUnits); + wxPoint2DDouble genPosition((*it)->position.m_x * scale, (*it)->position.m_y * scale); // Element position. // Calculate the new generator position: @@ -223,6 +228,10 @@ bool ImportForm::ImportSelectedFiles() // Auxiliary bus Bus* auxBus = new Bus(genPosition); for(int i = 0; i < bRot; ++i) auxBus->Rotate(); + auto auxBusData = auxBus->GetElectricalData(); + auxBusData.name = parentBus->GetElectricalData().name + wxString::Format(" -- %s", _("Auxiliary")); + auxBus->SetElectricalData(auxBusData); + // Transformer Transformer* transformer = new Transformer(); transformer->AddParent(auxBus, auxBus->GetPosition()); @@ -231,6 +240,14 @@ bool ImportForm::ImportSelectedFiles() transformer->StartMove(transformer->GetPosition()); transformer->Move(genPosition - offset); + auto transfData = transformer->GetElectricalData(); + transfData.name = + wxString::Format("%s %u (%s - %s)", _("Transformer"), transformerList.size() + 1, + auxBus->GetElectricalData().name, parentBus->GetElectricalData().name); + transfData.indReactance = genData->xt / (100.0 * numUnits); + transformer->SetElectricaData(transfData); + + // Generator SyncGenerator* syncGenerator = new SyncGenerator(); syncGenerator->SetID((*it)->id); syncGenerator->AddParent(auxBus, auxBus->GetPosition()); @@ -241,6 +258,19 @@ bool ImportForm::ImportSelectedFiles() for(int i = 0; i < 2; ++i) syncGenerator->Rotate(false); // Set to ANAREDE default rotation for(int i = 0; i < (*it)->rotationID * 2; ++i) syncGenerator->Rotate(); + auto data = syncGenerator->GetElectricalData(); + data.name = wxString::Format("%s %u (%s)", _("Generator"), syncGeneratorList.size() + 1, + parentBus->GetElectricalData().name); + data.activePower = genData->power.real() * numUnits; + data.reactivePower = genData->power.imag() * numUnits; + data.maxReactive = genData->maxReactivePower * numUnits; + data.minReactive = genData->minReactivePower * numUnits; + data.nominalPower = genData->ratedPower * numUnits; + data.syncXd = genData->xd / (100.0 * numUnits); + data.syncXq = genData->xq / (100.0 * numUnits); + data.potierReactance = genData->xl / (100.0 * numUnits); + syncGenerator->SetElectricalData(data); + busList.push_back(auxBus); transformerList.push_back(transformer); syncGeneratorList.push_back(syncGenerator); @@ -261,7 +291,7 @@ bool ImportForm::ImportSelectedFiles() load->Move(wxPoint2DDouble((*it)->position.m_x * scale, (*it)->position.m_y * scale)); auto data = load->GetElectricalData(); - data.name = wxString::Format("%s %u (%s)", _("Load"), indList.size() + 1, busData->busName); + data.name = wxString::Format("%s %u (%s)", _("Load"), loadList.size() + 1, busData->busName); data.activePower = busData->loadPower.real(); data.reactivePower = busData->loadPower.imag(); load->SetElectricalData(data); @@ -364,7 +394,7 @@ bool ImportForm::ImportSelectedFiles() auto data = transformer->GetElectricalData(); data.name = - wxString::Format("%s %u (%s - %s)", _("Transformer"), lineList.size() + 1, + wxString::Format("%s %u (%s - %s)", _("Transformer"), transformerList.size() + 1, parentBus1->GetElectricalData().name, parentBus2->GetElectricalData().name); data.resistance = branchData->resistance / 100.0; data.indReactance = branchData->indReactance / 100.0; @@ -412,6 +442,50 @@ bool ImportForm::ImportSelectedFiles() } } + // Search for bus data without component + std::vector<ParseAnarede::BusData*> busDataVector = parseAnarede.GetBusData(); + for(auto it = busDataVector.begin(), itEnd = busDataVector.end(); it != itEnd; ++it) { + ParseAnarede::BusData* busData = *it; + + // Search for bus + Bus* bus = NULL; + for(auto itB = busList.begin(), itBEnd = busList.end(); itB != itBEnd; ++itB) { + if((*itB)->GetElectricalData().number == busData->id) { + bus = *itB; + break; + } + } + if(bus) { + // Check loads + if(std::abs(busData->loadPower.real()) > 1e-5 || + std::abs(busData->loadPower.imag()) > 1e-5) { // Have loads + // Find load associated with the bus + Load* load = NULL; + for(auto itL = loadList.begin(), itLEnd = loadList.end(); itL != itLEnd; ++itL) { + if((*itL)->GetParentList().size() > 0) { // Don't search in empty vectors + if((*itL)->GetParentList()[0] == bus) { // Found load + load = *itL; + break; + } + } + } + if(!load) { // The load don't exists, create a new one. + Load* newLoad = + new Load(wxString::Format("%s %u (%s)", _("Load"), loadList.size() + 1, busData->busName)); + newLoad->AddParent(bus, bus->GetPosition()); + auto data = newLoad->GetElectricalData(); + data.activePower = busData->loadPower.real(); + data.reactivePower = busData->loadPower.imag(); + newLoad->SetElectricalData(data); + + loadList.push_back(newLoad); + } + } + // Check generation + + } + } + for(auto it = busList.begin(), itEnd = busList.end(); it != itEnd; ++it) elementList.push_back(*it); for(auto it = transformerList.begin(), itEnd = transformerList.end(); it != itEnd; ++it) elementList.push_back(*it); for(auto it = lineList.begin(), itEnd = lineList.end(); it != itEnd; ++it) elementList.push_back(*it); @@ -889,7 +963,13 @@ ParseAnarede::BranchData* ParseAnarede::GetBranchDataFromID(int id, int fromBus, return NULL; } -ParseAnarede::IndElementData* ParseAnarede::GetIndElementDataFromID(int id, int bus) { return NULL; } +ParseAnarede::IndElementData* ParseAnarede::GetIndElementDataFromID(int id, int busID) +{ + for(auto it = m_indElementData.begin(), itEnd = m_indElementData.end(); it != itEnd; ++it) { + if((*it)->id == id && (*it)->busConnection == busID) return *it; + } + return NULL; +} void ParseAnarede::ClearData() { diff --git a/Project/ImportForm.h b/Project/ImportForm.h index 021ba66..57341e0 100644 --- a/Project/ImportForm.h +++ b/Project/ImportForm.h @@ -173,7 +173,7 @@ class ParseAnarede wxPoint2DDouble GetNodePositionFromID(Bus* bus, double scale, int nodeID); BusData* GetBusDataFromID(int id); BranchData* GetBranchDataFromID(int id, int fromBus, int toBus); - IndElementData* GetIndElementDataFromID(int id, int bus); + IndElementData* GetIndElementDataFromID(int id, int busID); void ClearData(); diff --git a/Project/Project.mk b/Project/Project.mk index 375fd2e..3dcd197 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=NDSE-69 -Date :=04/04/2018 +Date :=05/04/2018 CodeLitePath :="C:/Program Files/CodeLite" LinkerName :=C:/TDM-GCC-64/bin/g++.exe SharedObjectLinkerName :=C:/TDM-GCC-64/bin/g++.exe -shared -fPIC diff --git a/Project/base/DataReportBase.cpp b/Project/base/DataReportBase.cpp index 0e14d38..33bea44 100644 --- a/Project/base/DataReportBase.cpp +++ b/Project/base/DataReportBase.cpp @@ -255,23 +255,37 @@ 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_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_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_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); } DataReportBase::~DataReportBase() { 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_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_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); } diff --git a/Project/base/DataReportBase.h b/Project/base/DataReportBase.h index 3e6784c..a9fba20 100644 --- a/Project/base/DataReportBase.h +++ b/Project/base/DataReportBase.h @@ -60,12 +60,19 @@ protected: protected: virtual void OnPowerFlowGridChanged(wxGridEvent& event) { event.Skip(); } + virtual void OnGridPFKeyDown(wxKeyEvent& event) { event.Skip(); } virtual void OnPFBusGridChanged(wxGridEvent& event) { event.Skip(); } + virtual void OnGridPFBusesKeyDown(wxKeyEvent& event) { event.Skip(); } virtual void OnPFBranchesGridChanged(wxGridEvent& event) { event.Skip(); } + virtual void OnGridPFBranchesKeyDown(wxKeyEvent& event) { event.Skip(); } virtual void OnFaulrGridChanged(wxGridEvent& event) { event.Skip(); } + virtual void OnGridFaultKeyDown(wxKeyEvent& event) { event.Skip(); } virtual void OnFaultBusesGridChanged(wxGridEvent& event) { event.Skip(); } + virtual void OnGridFaultBusesKeyDown(wxKeyEvent& event) { event.Skip(); } virtual void OnFaultBranchesGridChanged(wxGridEvent& event) { event.Skip(); } + virtual void OnGridFaultBranchesKeyDown(wxKeyEvent& event) { event.Skip(); } virtual void OnFaultGeneratorsGridChanged(wxGridEvent& event) { event.Skip(); } + virtual void OnGridFaultGeneratorsKeyDown(wxKeyEvent& event) { event.Skip(); } public: wxGrid* GetGridPowerFlow() { return m_gridPowerFlow; } |