[130] | 1 | #ifdef HAVE_CONFIG_H |
---|
| 2 | #include <config.h> |
---|
| 3 | #endif |
---|
| 4 | |
---|
[53] | 5 | #include "all_include.h" |
---|
| 6 | #include "mapstorage.h" |
---|
| 7 | #include "main_win.h" |
---|
[1] | 8 | #include <libgnomecanvasmm.h> |
---|
| 9 | #include <libgnomecanvasmm/polygon.h> |
---|
| 10 | |
---|
[130] | 11 | #include <locale.h> |
---|
| 12 | |
---|
[1] | 13 | #define MAIN_PART |
---|
| 14 | |
---|
[28] | 15 | std::vector <std::string> edge_property_strings; |
---|
| 16 | std::vector <double> edge_property_defaults; |
---|
| 17 | std::vector <std::string> node_property_strings; |
---|
| 18 | std::vector <double> node_property_defaults; |
---|
[81] | 19 | int longest_property_string_length; |
---|
[1] | 20 | |
---|
| 21 | int main(int argc, char *argv[]) |
---|
| 22 | { |
---|
[133] | 23 | setlocale(LC_ALL, ""); |
---|
[130] | 24 | bindtextdomain(PACKAGE, LOCALEDIR); |
---|
| 25 | bind_textdomain_codeset(PACKAGE, "UTF-8"); |
---|
| 26 | textdomain(PACKAGE); |
---|
[4] | 27 | |
---|
| 28 | //initializing |
---|
| 29 | |
---|
[28] | 30 | edge_property_strings.resize(EDGE_PROPERTY_NUM); |
---|
| 31 | edge_property_strings[E_WIDTH]="Edge Width"; |
---|
| 32 | edge_property_strings[E_COLOR]="Edge Color"; |
---|
| 33 | edge_property_strings[E_TEXT]="Edge Text"; |
---|
[1] | 34 | |
---|
[28] | 35 | edge_property_defaults.resize(EDGE_PROPERTY_NUM); |
---|
| 36 | edge_property_defaults[E_WIDTH]=10.0; |
---|
| 37 | edge_property_defaults[E_COLOR]=100; |
---|
| 38 | edge_property_defaults[E_TEXT]=0; |
---|
| 39 | |
---|
| 40 | node_property_strings.resize(NODE_PROPERTY_NUM); |
---|
| 41 | node_property_strings[N_RADIUS]="Node Radius"; |
---|
| 42 | node_property_strings[N_COLOR]="Node Color"; |
---|
| 43 | node_property_strings[N_TEXT]="Node Text"; |
---|
| 44 | |
---|
| 45 | node_property_defaults.resize(NODE_PROPERTY_NUM); |
---|
| 46 | node_property_defaults[N_RADIUS]=20.0; |
---|
| 47 | node_property_defaults[N_COLOR]=100; |
---|
| 48 | node_property_defaults[N_TEXT]=0; |
---|
[1] | 49 | |
---|
[81] | 50 | longest_property_string_length=0; |
---|
| 51 | for(int i=0;i<EDGE_PROPERTY_NUM;i++) |
---|
| 52 | { |
---|
| 53 | int j=edge_property_strings[i].size(); |
---|
| 54 | if(j>longest_property_string_length) |
---|
| 55 | { |
---|
| 56 | longest_property_string_length=j; |
---|
| 57 | } |
---|
| 58 | } |
---|
| 59 | for(int i=0;i<NODE_PROPERTY_NUM;i++) |
---|
| 60 | { |
---|
| 61 | int j=node_property_strings[i].size(); |
---|
| 62 | if(j>longest_property_string_length) |
---|
| 63 | { |
---|
| 64 | longest_property_string_length=j; |
---|
| 65 | } |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | |
---|
[4] | 69 | //initializing GUI |
---|
| 70 | |
---|
[1] | 71 | Gnome::Canvas::init(); |
---|
| 72 | Gtk::Main app(argc, argv); |
---|
| 73 | |
---|
[96] | 74 | MainWin mytab; |
---|
[57] | 75 | |
---|
[102] | 76 | // if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR))) |
---|
| 77 | // { |
---|
| 78 | // mytab.readFile(argv[1]); |
---|
| 79 | // } |
---|
| 80 | if(argc>=2) |
---|
[96] | 81 | { |
---|
[102] | 82 | for(int i=1;i<argc;i++) |
---|
| 83 | { |
---|
| 84 | if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR)) |
---|
| 85 | { |
---|
| 86 | mytab.readFile(argv[i]); |
---|
| 87 | } |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | else |
---|
| 91 | { |
---|
| 92 | mytab.newTab(); |
---|
[96] | 93 | } |
---|
[57] | 94 | |
---|
[96] | 95 | app.run(mytab); |
---|
[1] | 96 | |
---|
| 97 | return 0; |
---|
| 98 | } |
---|