gui/graph-displayer.cc
author alpar
Tue, 09 May 2006 09:23:39 +0000
changeset 2073 d886e4b131e6
parent 2012 224cd6aacfc1
permissions -rw-r--r--
- fix bug #43: static and const in Tolerance class
- fix return value of nonZero()
     1 #ifdef HAVE_CONFIG_H
     2 #include <config.h>
     3 #endif
     4 
     5 #include "all_include.h"
     6 #include "mapstorage.h"
     7 #include "main_win.h"
     8 #include <libgnomecanvasmm.h>
     9 #include <libgnomecanvasmm/polygon.h>
    10 
    11 #include <locale.h>
    12 
    13 #define MAIN_PART
    14 
    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;
    19 int longest_property_string_length;
    20 
    21 int main(int argc, char *argv[])
    22 {
    23   setlocale(LC_ALL, "");
    24   bindtextdomain(PACKAGE, LOCALEDIR);
    25   bind_textdomain_codeset(PACKAGE, "UTF-8");
    26   textdomain(PACKAGE);
    27 
    28   //initializing
    29 
    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";
    34 
    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;
    49 
    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 
    69   //initializing GUI
    70 
    71   Gnome::Canvas::init();
    72   Gtk::Main app(argc, argv);
    73 
    74   MainWin mytab;
    75 
    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)
    81     {
    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();
    93     }
    94   
    95   app.run(mytab);
    96 
    97   return 0;
    98 }