COIN-OR::LEMON - Graph Library

Changeset 1869:52f5a7f9fb48 in lemon-0.x for gui/main_win.cc


Ignore:
Timestamp:
01/03/06 15:56:45 (14 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2444
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gui/main_win.cc

    r1862 r1869  
    7373
    7474  ag->add( Gtk::Action::create("FileMenu", "_File") );
    75   ag->add( Gtk::Action::create("FileNewTab", "New _Tab"),
     75  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
    7676      sigc::mem_fun(*this, &MainWin::newTab));
    77   ag->add( Gtk::Action::create("FileCloseTab", "_Close Tab"),
    78       sigc::mem_fun(*this, &MainWin::closeTab));
    79   ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
    80       sigc::mem_fun(*this, &MainWin::newFile));
    8177  ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
    8278      sigc::mem_fun(*this, &MainWin::openFile));
     79  ag->add( Gtk::Action::create("FileClearTab", "Clear Tab"),
     80      sigc::mem_fun(*this, &MainWin::newFile));
    8381  ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
    8482      sigc::mem_fun(*this, &MainWin::saveFile));
     
    8684      sigc::mem_fun(*this, &MainWin::saveFileAs));
    8785  ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE),
    88       sigc::mem_fun(*this, &MainWin::close));
     86      sigc::mem_fun(*this, &MainWin::closeTab));
    8987  ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT),
    9088      sigc::mem_fun(*this, &MainWin::hide));
     
    133131      "  <menubar name='MenuBar'>"
    134132      "    <menu action='FileMenu'>"
    135       "      <menuitem action='FileNewTab'/>"
    136       "      <menuitem action='FileCloseTab'/>"
    137133      "      <menuitem action='FileNew'/>"
    138134      "      <menuitem action='FileOpen'/>"
     135      "      <menuitem action='FileClearTab'/>"
    139136      "      <menuitem action='FileSave'/>"
    140137      "      <menuitem action='FileSaveAs'/>"
     
    238235  if(active_tab!=-1)
    239236    {
     237      if (tabs[active_tab]->mapstorage.modified)
     238        {
     239          Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
     240                                     Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
     241          mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
     242          mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
     243          mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
     244          switch (mdialog.run())
     245            {
     246            case Gtk::RESPONSE_CANCEL:
     247              return;
     248            case Gtk::RESPONSE_REJECT:
     249              break;
     250            case Gtk::RESPONSE_ACCEPT:
     251              tabs[active_tab]->saveFile();
     252              break;
     253            }
     254        }
    240255      //tabs vector will be decreased with the deleted value
    241256      int size=tabs.size();
Note: See TracChangeset for help on using the changeset viewer.