display file name in window title gui
authorladanyi
Fri, 26 Aug 2005 11:03:59 +0000
branchgui
changeset 681a27576aa199
parent 67 052cfd7832b1
child 69 6bb290b67e19
display file name in window title
all_include.h
graph-displayer.cc
main_win.cc
main_win.h
     1.1 --- a/all_include.h	Fri Aug 26 10:46:51 2005 +0000
     1.2 +++ b/all_include.h	Fri Aug 26 11:03:59 2005 +0000
     1.3 @@ -44,4 +44,6 @@
     1.4  typedef Graph::EdgeIt EdgeIt;
     1.5  typedef Graph::NodeIt NodeIt;
     1.6  
     1.7 +const std::string prog_name = "LEMON Graph Editor";
     1.8 +
     1.9  #endif // ALL_INCLUDE_H
     2.1 --- a/graph-displayer.cc	Fri Aug 26 10:46:51 2005 +0000
     2.2 +++ b/graph-displayer.cc	Fri Aug 26 11:03:59 2005 +0000
     2.3 @@ -42,7 +42,7 @@
     2.4    Gnome::Canvas::init();
     2.5    Gtk::Main app(argc, argv);
     2.6  
     2.7 -  MainWin mainwin("Displayed Graph");
     2.8 +  MainWin mainwin;
     2.9  
    2.10    if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
    2.11    {
     3.1 --- a/main_win.cc	Fri Aug 26 10:46:51 2005 +0000
     3.2 +++ b/main_win.cc	Fri Aug 26 11:03:59 2005 +0000
     3.3 @@ -1,11 +1,11 @@
     3.4  #include "main_win.h"
     3.5  #include "guipixbufs.h"
     3.6  
     3.7 -MainWin::MainWin(const std::string& title) :
     3.8 +MainWin::MainWin() :
     3.9    mapwin("Map Setup", mapstorage, gd_canvas),
    3.10    newmapwin("Creating new map", gd_canvas), gd_canvas(mapstorage, mapwin, (Gtk::Window *)this)
    3.11  {
    3.12 -  set_title (title);
    3.13 +  set_title ("unsaved file - " + prog_name);
    3.14    set_default_size(WIN_WIDTH,WIN_HEIGHT);
    3.15    add(vbox);
    3.16  
    3.17 @@ -209,6 +209,7 @@
    3.18    mapstorage.modified = false;
    3.19    gd_canvas.drawGraph();
    3.20    mapwin.update();
    3.21 +  set_title(Glib::filename_display_basename(file) + " - " + prog_name);
    3.22  }
    3.23  
    3.24  void MainWin::newFile()
    3.25 @@ -234,6 +235,7 @@
    3.26    gd_canvas.clear();
    3.27    mapstorage.clear();
    3.28    mapwin.update();
    3.29 +  set_title("unsaved file - " + prog_name);
    3.30  }
    3.31  
    3.32  void MainWin::openFile()
    3.33 @@ -256,13 +258,13 @@
    3.34          break;
    3.35      }
    3.36    }
    3.37 -  gd_canvas.clear();
    3.38 -  mapstorage.clear();
    3.39    Gtk::FileChooserDialog fcdialog("Open File");
    3.40    fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    3.41    fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
    3.42    if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
    3.43    {
    3.44 +    gd_canvas.clear();
    3.45 +    mapstorage.clear();
    3.46      Glib::ustring filename = fcdialog.get_filename();
    3.47      if (!mapstorage.readFromFile(filename))
    3.48      {
    3.49 @@ -270,6 +272,7 @@
    3.50        mapstorage.modified = false;
    3.51        gd_canvas.drawGraph();
    3.52        mapwin.update();
    3.53 +      set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
    3.54      }
    3.55    }
    3.56  }
    3.57 @@ -283,6 +286,8 @@
    3.58    {
    3.59      mapstorage.writeToFile(mapstorage.file_name);
    3.60      mapstorage.modified = false;
    3.61 +    set_title(Glib::filename_display_basename(mapstorage.file_name) + " - " +
    3.62 +        prog_name);
    3.63    }
    3.64  }
    3.65  
    3.66 @@ -297,6 +302,7 @@
    3.67      mapstorage.file_name = filename;
    3.68      mapstorage.writeToFile(filename);
    3.69      mapstorage.modified = false;
    3.70 +    set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
    3.71    }
    3.72  }
    3.73  
    3.74 @@ -323,4 +329,5 @@
    3.75    gd_canvas.clear();
    3.76    mapstorage.clear();
    3.77    mapwin.update();
    3.78 +  set_title("unsaved file - " + prog_name);
    3.79  }
     4.1 --- a/main_win.h	Fri Aug 26 10:46:51 2005 +0000
     4.2 +++ b/main_win.h	Fri Aug 26 11:03:59 2005 +0000
     4.3 @@ -18,7 +18,7 @@
     4.4  public:
     4.5    ///Constructor of the \ref MainWin. It creates the menu and the \ref GraphDisplayerCanvas on which the graph will be drawn.
     4.6    ///\param title is the title of the window
     4.7 -  MainWin(const std::string& title);
     4.8 +  MainWin();
     4.9  
    4.10    MapStorage mapstorage;
    4.11