Handling of tabs is rationalized a bit. More than one file can be given at startup in command prompt. If there is no file given in command prompt, an empty tab will be present at startup.
authorhegyi
Tue, 03 Jan 2006 14:56:45 +0000
changeset 186952f5a7f9fb48
parent 1868 24bf4b8299e7
child 1870 b9c9b52f839e
Handling of tabs is rationalized a bit. More than one file can be given at startup in command prompt. If there is no file given in command prompt, an empty tab will be present at startup.
gui/graph-displayer.cc
gui/main_win.cc
gui/nbtab.cc
     1.1 --- a/gui/graph-displayer.cc	Wed Dec 21 08:47:38 2005 +0000
     1.2 +++ b/gui/graph-displayer.cc	Tue Jan 03 14:56:45 2006 +0000
     1.3 @@ -63,9 +63,23 @@
     1.4  
     1.5    MainWin mytab;
     1.6  
     1.7 -  if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
     1.8 +//   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
     1.9 +//     {
    1.10 +//       mytab.readFile(argv[1]);
    1.11 +//     }
    1.12 +  if(argc>=2)
    1.13      {
    1.14 -      mytab.readFile(argv[1]);
    1.15 +      for(int i=1;i<argc;i++)
    1.16 +	{
    1.17 +	  if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
    1.18 +	    {
    1.19 +	      mytab.readFile(argv[i]);
    1.20 +	    }
    1.21 +	}
    1.22 +    }
    1.23 +  else
    1.24 +    {
    1.25 +      mytab.newTab();
    1.26      }
    1.27    
    1.28    app.run(mytab);
     2.1 --- a/gui/main_win.cc	Wed Dec 21 08:47:38 2005 +0000
     2.2 +++ b/gui/main_win.cc	Tue Jan 03 14:56:45 2006 +0000
     2.3 @@ -72,20 +72,18 @@
     2.4    ag=Gtk::ActionGroup::create();
     2.5  
     2.6    ag->add( Gtk::Action::create("FileMenu", "_File") );
     2.7 -  ag->add( Gtk::Action::create("FileNewTab", "New _Tab"),
     2.8 +  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
     2.9        sigc::mem_fun(*this, &MainWin::newTab));
    2.10 -  ag->add( Gtk::Action::create("FileCloseTab", "_Close Tab"),
    2.11 -      sigc::mem_fun(*this, &MainWin::closeTab));
    2.12 -  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
    2.13 -      sigc::mem_fun(*this, &MainWin::newFile));
    2.14    ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
    2.15        sigc::mem_fun(*this, &MainWin::openFile));
    2.16 +  ag->add( Gtk::Action::create("FileClearTab", "Clear Tab"),
    2.17 +      sigc::mem_fun(*this, &MainWin::newFile));
    2.18    ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
    2.19        sigc::mem_fun(*this, &MainWin::saveFile));
    2.20    ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
    2.21        sigc::mem_fun(*this, &MainWin::saveFileAs));
    2.22    ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE),
    2.23 -      sigc::mem_fun(*this, &MainWin::close));
    2.24 +      sigc::mem_fun(*this, &MainWin::closeTab));
    2.25    ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT),
    2.26        sigc::mem_fun(*this, &MainWin::hide));
    2.27  
    2.28 @@ -132,10 +130,9 @@
    2.29        "<ui>"
    2.30        "  <menubar name='MenuBar'>"
    2.31        "    <menu action='FileMenu'>"
    2.32 -      "      <menuitem action='FileNewTab'/>"
    2.33 -      "      <menuitem action='FileCloseTab'/>"
    2.34        "      <menuitem action='FileNew'/>"
    2.35        "      <menuitem action='FileOpen'/>"
    2.36 +      "      <menuitem action='FileClearTab'/>"
    2.37        "      <menuitem action='FileSave'/>"
    2.38        "      <menuitem action='FileSaveAs'/>"
    2.39        "      <menuitem action='Close'/>"
    2.40 @@ -237,6 +234,24 @@
    2.41  {
    2.42    if(active_tab!=-1)
    2.43      {
    2.44 +      if (tabs[active_tab]->mapstorage.modified)
    2.45 +	{
    2.46 +	  Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, 
    2.47 +				     Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
    2.48 +	  mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
    2.49 +	  mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    2.50 +	  mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
    2.51 +	  switch (mdialog.run())
    2.52 +	    {
    2.53 +	    case Gtk::RESPONSE_CANCEL:
    2.54 +	      return;
    2.55 +	    case Gtk::RESPONSE_REJECT:
    2.56 +	      break;
    2.57 +	    case Gtk::RESPONSE_ACCEPT:
    2.58 +	      tabs[active_tab]->saveFile();
    2.59 +	      break;
    2.60 +	    }
    2.61 +	}
    2.62        //tabs vector will be decreased with the deleted value
    2.63        int size=tabs.size();
    2.64        if(size>1)
     3.1 --- a/gui/nbtab.cc	Wed Dec 21 08:47:38 2005 +0000
     3.2 +++ b/gui/nbtab.cc	Tue Jan 03 14:56:45 2006 +0000
     3.3 @@ -30,7 +30,7 @@
     3.4    {
     3.5      Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
     3.6          Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
     3.7 -    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
     3.8 +    mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
     3.9      mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    3.10      mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
    3.11      switch (mdialog.run())
    3.12 @@ -59,7 +59,7 @@
    3.13    {
    3.14      Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, 
    3.15          Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
    3.16 -    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
    3.17 +    mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
    3.18      mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    3.19      mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
    3.20      switch (mdialog.run())