[Lemon-commits] [lemon_svn] ladanyi: r2163 - hugo/trunk/gui

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:50:38 CET 2006


Author: ladanyi
Date: Fri Aug 26 13:03:59 2005
New Revision: 2163

Modified:
   hugo/trunk/gui/all_include.h
   hugo/trunk/gui/graph-displayer.cc
   hugo/trunk/gui/main_win.cc
   hugo/trunk/gui/main_win.h

Log:
display file name in window title

Modified: hugo/trunk/gui/all_include.h
==============================================================================
--- hugo/trunk/gui/all_include.h	(original)
+++ hugo/trunk/gui/all_include.h	Fri Aug 26 13:03:59 2005
@@ -44,4 +44,6 @@
 typedef Graph::EdgeIt EdgeIt;
 typedef Graph::NodeIt NodeIt;
 
+const std::string prog_name = "LEMON Graph Editor";
+
 #endif // ALL_INCLUDE_H

Modified: hugo/trunk/gui/graph-displayer.cc
==============================================================================
--- hugo/trunk/gui/graph-displayer.cc	(original)
+++ hugo/trunk/gui/graph-displayer.cc	Fri Aug 26 13:03:59 2005
@@ -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)))
   {

Modified: hugo/trunk/gui/main_win.cc
==============================================================================
--- hugo/trunk/gui/main_win.cc	(original)
+++ hugo/trunk/gui/main_win.cc	Fri Aug 26 13:03:59 2005
@@ -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);
 }

Modified: hugo/trunk/gui/main_win.h
==============================================================================
--- hugo/trunk/gui/main_win.h	(original)
+++ hugo/trunk/gui/main_win.h	Fri Aug 26 13:03:59 2005
@@ -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;
 



More information about the Lemon-commits mailing list