gui/main_win.cc
changeset 1873 d73c7f115f53
parent 1871 3905d347112c
child 1876 5ad84ad1b68f
equal deleted inserted replaced
30:33f69051ef30 31:51f4f184ec33
   208   show_all_children();
   208   show_all_children();
   209 }
   209 }
   210 
   210 
   211 void MainWin::set_tabtitle(std::string name)
   211 void MainWin::set_tabtitle(std::string name)
   212 {
   212 {
   213   tabnames[active_tab]=name;
   213   if(strinst.find(name)==strinst.end())
       
   214     {
       
   215       tabnames[active_tab]=name;
       
   216       strinst[name]=1;
       
   217     }
       
   218   else
       
   219     {
       
   220       strinst[name]++;
       
   221       std::ostringstream o;
       
   222       o << strinst[name];
       
   223       tabnames[active_tab]=name+" - "+o.str();
       
   224     }
   214   set_title(tabnames[active_tab] + " - " + prog_name);
   225   set_title(tabnames[active_tab] + " - " + prog_name);
   215   notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
   226   notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
   216   updateAlgoWins();
   227   updateAlgoWins();
   217 }
   228 }
   218 
   229 
   227   int size=tabs.size();
   238   int size=tabs.size();
   228   tabs.resize(size+1);
   239   tabs.resize(size+1);
   229   tabnames.resize(size+1);
   240   tabnames.resize(size+1);
   230   active_tab=size;
   241   active_tab=size;
   231   tabs[active_tab]=new NoteBookTab();
   242   tabs[active_tab]=new NoteBookTab();
   232   tabnames[active_tab]="unsaved file";
       
   233   tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
   243   tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
   234   tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
   244   tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
   235   tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
   245   tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
   236   notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
   246   notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
   237   notebook.set_current_page(size);
   247   notebook.set_current_page(size);
   238   set_tabtitle(tabnames[active_tab]);
   248   set_tabtitle("unsaved file");
   239   updateAlgoWins();
   249   updateAlgoWins();
   240 }
   250 }
   241 
   251 
   242 void MainWin::closeTab()
   252 void MainWin::closeTab()
   243 {
   253 {
   287       if((old_active_tab==0)&&(size!=1))
   297       if((old_active_tab==0)&&(size!=1))
   288 	{
   298 	{
   289 	  onChangeTab(NULL,0);
   299 	  onChangeTab(NULL,0);
   290 	}
   300 	}
   291 
   301 
   292       std::cout << "NAAAA" << std::endl;
       
   293 
       
   294       //if this was the last page in notebook, there is
   302       //if this was the last page in notebook, there is
   295       //no active_tab now
   303       //no active_tab now
   296       if(size==1)
   304       if(size==1)
   297 	{
   305 	{
   298 	  active_tab=-1;
   306 	  active_tab=-1;