# HG changeset patch # User ladanyi # Date 1125054239 0 # Node ID 1a27576aa19917a79584f178da6a57a259d79d1a # Parent 052cfd7832b13bc2935f8bc3608868bcba5c7d37 display file name in window title diff -r 052cfd7832b1 -r 1a27576aa199 all_include.h --- a/all_include.h Fri Aug 26 10:46:51 2005 +0000 +++ b/all_include.h Fri Aug 26 11:03:59 2005 +0000 @@ -44,4 +44,6 @@ typedef Graph::EdgeIt EdgeIt; typedef Graph::NodeIt NodeIt; +const std::string prog_name = "LEMON Graph Editor"; + #endif // ALL_INCLUDE_H diff -r 052cfd7832b1 -r 1a27576aa199 graph-displayer.cc --- a/graph-displayer.cc Fri Aug 26 10:46:51 2005 +0000 +++ b/graph-displayer.cc Fri Aug 26 11:03:59 2005 +0000 @@ -42,7 +42,7 @@ Gnome::Canvas::init(); Gtk::Main app(argc, argv); - MainWin mainwin("Displayed Graph"); + MainWin mainwin; if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR))) { diff -r 052cfd7832b1 -r 1a27576aa199 main_win.cc --- a/main_win.cc Fri Aug 26 10:46:51 2005 +0000 +++ b/main_win.cc Fri Aug 26 11:03:59 2005 +0000 @@ -1,11 +1,11 @@ #include "main_win.h" #include "guipixbufs.h" -MainWin::MainWin(const std::string& title) : +MainWin::MainWin() : mapwin("Map Setup", mapstorage, gd_canvas), newmapwin("Creating new map", gd_canvas), gd_canvas(mapstorage, mapwin, (Gtk::Window *)this) { - set_title (title); + set_title ("unsaved file - " + prog_name); set_default_size(WIN_WIDTH,WIN_HEIGHT); add(vbox); @@ -209,6 +209,7 @@ mapstorage.modified = false; gd_canvas.drawGraph(); mapwin.update(); + set_title(Glib::filename_display_basename(file) + " - " + prog_name); } void MainWin::newFile() @@ -234,6 +235,7 @@ gd_canvas.clear(); mapstorage.clear(); mapwin.update(); + set_title("unsaved file - " + prog_name); } void MainWin::openFile() @@ -256,13 +258,13 @@ break; } } - gd_canvas.clear(); - mapstorage.clear(); Gtk::FileChooserDialog fcdialog("Open File"); fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT); if (fcdialog.run() == Gtk::RESPONSE_ACCEPT) { + gd_canvas.clear(); + mapstorage.clear(); Glib::ustring filename = fcdialog.get_filename(); if (!mapstorage.readFromFile(filename)) { @@ -270,6 +272,7 @@ mapstorage.modified = false; gd_canvas.drawGraph(); mapwin.update(); + set_title(Glib::filename_display_basename(filename) + " - " + prog_name); } } } @@ -283,6 +286,8 @@ { mapstorage.writeToFile(mapstorage.file_name); mapstorage.modified = false; + set_title(Glib::filename_display_basename(mapstorage.file_name) + " - " + + prog_name); } } @@ -297,6 +302,7 @@ mapstorage.file_name = filename; mapstorage.writeToFile(filename); mapstorage.modified = false; + set_title(Glib::filename_display_basename(filename) + " - " + prog_name); } } @@ -323,4 +329,5 @@ gd_canvas.clear(); mapstorage.clear(); mapwin.update(); + set_title("unsaved file - " + prog_name); } diff -r 052cfd7832b1 -r 1a27576aa199 main_win.h --- a/main_win.h Fri Aug 26 10:46:51 2005 +0000 +++ b/main_win.h Fri Aug 26 11:03:59 2005 +0000 @@ -18,7 +18,7 @@ public: ///Constructor of the \ref MainWin. It creates the menu and the \ref GraphDisplayerCanvas on which the graph will be drawn. ///\param title is the title of the window - MainWin(const std::string& title); + MainWin(); MapStorage mapstorage;