Best feature ever\! Name of tabs are different from now on\!
authorhegyi
Wed, 04 Jan 2006 11:41:58 +0000
changeset 18723b7694cf0a08
parent 1871 3905d347112c
child 1873 d73c7f115f53
Best feature ever\! Name of tabs are different from now on\!
gui/main_win.cc
gui/main_win.h
     1.1 --- a/gui/main_win.cc	Tue Jan 03 17:30:22 2006 +0000
     1.2 +++ b/gui/main_win.cc	Wed Jan 04 11:41:58 2006 +0000
     1.3 @@ -210,7 +210,18 @@
     1.4  
     1.5  void MainWin::set_tabtitle(std::string name)
     1.6  {
     1.7 -  tabnames[active_tab]=name;
     1.8 +  if(strinst.find(name)==strinst.end())
     1.9 +    {
    1.10 +      tabnames[active_tab]=name;
    1.11 +      strinst[name]=1;
    1.12 +    }
    1.13 +  else
    1.14 +    {
    1.15 +      strinst[name]++;
    1.16 +      std::ostringstream o;
    1.17 +      o << strinst[name];
    1.18 +      tabnames[active_tab]=name+" - "+o.str();
    1.19 +    }
    1.20    set_title(tabnames[active_tab] + " - " + prog_name);
    1.21    notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
    1.22    updateAlgoWins();
    1.23 @@ -229,13 +240,12 @@
    1.24    tabnames.resize(size+1);
    1.25    active_tab=size;
    1.26    tabs[active_tab]=new NoteBookTab();
    1.27 -  tabnames[active_tab]="unsaved file";
    1.28    tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
    1.29    tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
    1.30    tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
    1.31    notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
    1.32    notebook.set_current_page(size);
    1.33 -  set_tabtitle(tabnames[active_tab]);
    1.34 +  set_tabtitle("unsaved file");
    1.35    updateAlgoWins();
    1.36  }
    1.37  
    1.38 @@ -289,8 +299,6 @@
    1.39  	  onChangeTab(NULL,0);
    1.40  	}
    1.41  
    1.42 -      std::cout << "NAAAA" << std::endl;
    1.43 -
    1.44        //if this was the last page in notebook, there is
    1.45        //no active_tab now
    1.46        if(size==1)
     2.1 --- a/gui/main_win.h	Tue Jan 03 17:30:22 2006 +0000
     2.2 +++ b/gui/main_win.h	Wed Jan 04 11:41:58 2006 +0000
     2.3 @@ -27,6 +27,8 @@
     2.4    std::vector<NoteBookTab *> tabs;
     2.5    std::vector<std::string> tabnames;
     2.6  
     2.7 +  std::map<std::string, int> strinst;
     2.8 +
     2.9    std::set< AlgoWin* > aws;
    2.10  
    2.11  public: