summaryrefslogtreecommitdiffstats
path: root/Project/MainFrame.cpp
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2017-01-06 20:49:28 -0200
committerThales1330 <thaleslima.ufu@gmail.com>2017-01-06 20:49:28 -0200
commit2cd589742c6a4fd289d2f0696d844ccf18b917cb (patch)
tree42a64542d07a4997be5e216ffd54a27e39f76b56 /Project/MainFrame.cpp
parent6a268dba6da88e0a371ce6358e4f43b0c3d08d7d (diff)
downloadPSP.git-2cd589742c6a4fd289d2f0696d844ccf18b917cb.tar.gz
PSP.git-2cd589742c6a4fd289d2f0696d844ccf18b917cb.tar.xz
PSP.git-2cd589742c6a4fd289d2f0696d844ccf18b917cb.zip
Several bugfixes on power elements
Diffstat (limited to 'Project/MainFrame.cpp')
-rw-r--r--Project/MainFrame.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/Project/MainFrame.cpp b/Project/MainFrame.cpp
index 76c7b6f..ef9f327 100644
--- a/Project/MainFrame.cpp
+++ b/Project/MainFrame.cpp
@@ -170,11 +170,11 @@ void MainFrame::OnMoveClick(wxRibbonButtonBarEvent& event)
{
Workspace* workspace = static_cast<Workspace*>(m_auiNotebook->GetCurrentPage());
if(workspace) {
- auto elementList = workspace->GetElementList();
+ auto elementList = workspace->GetAllElements();
// Calculate the average position of selected elements.
wxPoint2DDouble averagePos(0, 0);
int numSelElements = 0;
- for(auto it = elementList.begin(); it != elementList.end(); it++) {
+ for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
Element* element = *it;
if(element->IsSelected()) {
averagePos += element->GetPosition();
@@ -183,7 +183,7 @@ void MainFrame::OnMoveClick(wxRibbonButtonBarEvent& event)
}
averagePos = wxPoint2DDouble(averagePos.m_x / double(numSelElements), averagePos.m_y / double(numSelElements));
// Set the move position to the average of selected elements.
- for(auto it = elementList.begin(); it != elementList.end(); it++) {
+ for(auto it = elementList.begin(), itEnd = elementList.end(); it != itEnd; ++it) {
Element* element = *it;
if(element->IsSelected()) {
element->StartMove(averagePos);
@@ -218,7 +218,9 @@ void MainFrame::OnOpenClick(wxRibbonButtonBarEvent& event)
newWorkspace->SetJustOpened(true);
m_projectNumber++;
} else {
- // TODO: fail message.
+ wxMessageDialog msgDialog(
+ this, _("It was not possible to open the selected file."), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
+ msgDialog.ShowModal();
delete newWorkspace;
}
}