# HG changeset patch # User ladanyi # Date 1123438001 0 # Node ID 78704393218db460b99cb06e56c7bfefc1e95bfa # Parent b42385baaf3aaaae740df8b9b94818397f78abba open file from command line diff -r b42385baaf3a -r 78704393218d gui/graph-displayer.cc --- a/gui/graph-displayer.cc Sun Aug 07 16:35:15 2005 +0000 +++ b/gui/graph-displayer.cc Sun Aug 07 18:06:41 2005 +0000 @@ -43,6 +43,12 @@ Gtk::Main app(argc, argv); MainWin mainwin("Displayed Graph"); + + if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR))) + { + mainwin.readFile(argv[1]); + } + app.run(mainwin); return 0; diff -r b42385baaf3a -r 78704393218d gui/main_win.cc --- a/gui/main_win.cc Sun Aug 07 16:35:15 2005 +0000 +++ b/gui/main_win.cc Sun Aug 07 18:06:41 2005 +0000 @@ -133,6 +133,15 @@ show_all_children(); } +void MainWin::readFile(const std::string &file) +{ + mapstorage.readFromFile(file); + mapstorage.file_name = file; + mapstorage.modified = false; + gd_canvas.drawGraph(); + mapwin.update(); +} + void MainWin::newFile() { if (mapstorage.modified) diff -r b42385baaf3a -r 78704393218d gui/main_win.h --- a/gui/main_win.h Sun Aug 07 16:35:15 2005 +0000 +++ b/gui/main_win.h Sun Aug 07 18:06:41 2005 +0000 @@ -22,6 +22,8 @@ MapStorage mapstorage; + void readFile(const std::string &); + protected: ///Window of map-showing setup. Its type is \ref MapWin MapWin mapwin;