# HG changeset patch # User ladanyi # Date 1123438001 0 # Node ID 1f158566c3bfa4a546b044e991cf820ab8880070 # Parent 7a9a55a2f45d0ad1963ee2d951698b214d35f012 open file from command line diff -r 7a9a55a2f45d -r 1f158566c3bf graph-displayer.cc --- a/graph-displayer.cc Sun Aug 07 16:35:15 2005 +0000 +++ b/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 7a9a55a2f45d -r 1f158566c3bf main_win.cc --- a/main_win.cc Sun Aug 07 16:35:15 2005 +0000 +++ b/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 7a9a55a2f45d -r 1f158566c3bf main_win.h --- a/main_win.h Sun Aug 07 16:35:15 2005 +0000 +++ b/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;