aboutsummaryrefslogtreecommitdiff
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index deb2b8b..53403ba 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -73,8 +73,19 @@ void MainWindow::OnCloseTabEvent(wxCommandEvent &event) {
}
void MainWindow::OnCloseTabLinkedTo(wxCommandEvent &event){
- TabInfos *infos=(TabInfos*)event.GetClientData();
- CloseTabLinkedTo(infos->id);
+ TabInfos *infosEvent=(TabInfos*)event.GetClientData();
+ // Now close all tabs in the notebook related to the one in the event
+ int i=0;
+ while(i<notebook->GetPageCount()){
+ wxWindow *page=notebook->GetPage(i);
+ TabInfos* infos=(TabInfos*)page->GetClientData();
+ if(infos->is_linked && infos->linked_id==infosEvent->id){
+ notebook->DeletePage(i); // Remove page
+ i=0; // Restart to page 0 since notebook updated (we just remove one page)
+ }
+ else
+ i++;
+ }
}
void MainWindow::OnMenuItemClick(wxCommandEvent &event) {
@@ -104,7 +115,6 @@ void MainWindow::OnMenuItemClick(wxCommandEvent &event) {
} else if (id == 5) {
OpenFile();
} else if (id == 6) {
- CloseTabLinkedTo(1);
NewEngine();
}
}
@@ -179,20 +189,6 @@ void MainWindow::OnClose(wxCloseEvent &e) {
e.Skip();
}
-void MainWindow::CloseTabLinkedTo(long id){
- int i=0;
- while(i<notebook->GetPageCount()){
- wxWindow *page=notebook->GetPage(i);
- TabInfos* infos=(TabInfos*)page->GetClientData();
- if(infos->is_linked && infos->linked_id==id){
- notebook->DeletePage(i);
- i=0; // Restart to page 0 since notebook updated
- }
- else {
- i++;
- }
- }
-}
void MainWindow::OpenFile() {
wxFileDialog openFileDialog(this, _("Open file"), "", "",