# HG changeset patch # User hegyi # Date 1136300205 0 # Node ID 52f5a7f9fb489fbcf69b9ce4b50458227e0d08ec # Parent 24bf4b8299e7fa9cc8361e18642903b76887134f 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. diff -r 24bf4b8299e7 -r 52f5a7f9fb48 gui/graph-displayer.cc --- a/gui/graph-displayer.cc Wed Dec 21 08:47:38 2005 +0000 +++ b/gui/graph-displayer.cc Tue Jan 03 14:56:45 2006 +0000 @@ -63,9 +63,23 @@ MainWin mytab; - if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR))) +// if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR))) +// { +// mytab.readFile(argv[1]); +// } + if(argc>=2) { - mytab.readFile(argv[1]); + for(int i=1;iadd( Gtk::Action::create("FileMenu", "_File") ); - ag->add( Gtk::Action::create("FileNewTab", "New _Tab"), + ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW), sigc::mem_fun(*this, &MainWin::newTab)); - ag->add( Gtk::Action::create("FileCloseTab", "_Close Tab"), - sigc::mem_fun(*this, &MainWin::closeTab)); - ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW), - sigc::mem_fun(*this, &MainWin::newFile)); ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN), sigc::mem_fun(*this, &MainWin::openFile)); + ag->add( Gtk::Action::create("FileClearTab", "Clear Tab"), + sigc::mem_fun(*this, &MainWin::newFile)); ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE), sigc::mem_fun(*this, &MainWin::saveFile)); ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS), sigc::mem_fun(*this, &MainWin::saveFileAs)); ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE), - sigc::mem_fun(*this, &MainWin::close)); + sigc::mem_fun(*this, &MainWin::closeTab)); ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT), sigc::mem_fun(*this, &MainWin::hide)); @@ -132,10 +130,9 @@ "" " " " " - " " - " " " " " " + " " " " " " " " @@ -237,6 +234,24 @@ { if(active_tab!=-1) { + if (tabs[active_tab]->mapstorage.modified) + { + Gtk::MessageDialog mdialog("Save changes before closing?", true, + Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); + mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT); + mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); + switch (mdialog.run()) + { + case Gtk::RESPONSE_CANCEL: + return; + case Gtk::RESPONSE_REJECT: + break; + case Gtk::RESPONSE_ACCEPT: + tabs[active_tab]->saveFile(); + break; + } + } //tabs vector will be decreased with the deleted value int size=tabs.size(); if(size>1) diff -r 24bf4b8299e7 -r 52f5a7f9fb48 gui/nbtab.cc --- a/gui/nbtab.cc Wed Dec 21 08:47:38 2005 +0000 +++ b/gui/nbtab.cc Tue Jan 03 14:56:45 2006 +0000 @@ -30,7 +30,7 @@ { Gtk::MessageDialog mdialog("Save changes before closing?", true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); - mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT); + mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT); mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); switch (mdialog.run()) @@ -59,7 +59,7 @@ { Gtk::MessageDialog mdialog("Save changes before closing?", true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); - mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT); + mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT); mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); switch (mdialog.run())