gui/graph-displayer.cc
author deba
Wed, 01 Mar 2006 10:17:25 +0000
changeset 1990 15fb7a4ea6be
parent 1849 a4d1362397fe
child 2012 224cd6aacfc1
permissions -rw-r--r--
Some classes assumed that the GraphMaps should be inherited
from an ObserverBase. These classes parents replaced with
DefaultMap which cause that the graph maps should not be
inherited from the ObserverBase.
     1 #include "all_include.h"
     2 #include "mapstorage.h"
     3 #include "main_win.h"
     4 #include <libgnomecanvasmm.h>
     5 #include <libgnomecanvasmm/polygon.h>
     6 
     7 #define MAIN_PART
     8 
     9 std::vector <std::string> edge_property_strings;
    10 std::vector <double> edge_property_defaults;
    11 std::vector <std::string> node_property_strings;
    12 std::vector <double> node_property_defaults;
    13 int longest_property_string_length;
    14 
    15 int main(int argc, char *argv[])
    16 {
    17 
    18   //initializing
    19 
    20   edge_property_strings.resize(EDGE_PROPERTY_NUM);
    21   edge_property_strings[E_WIDTH]="Edge Width";
    22   edge_property_strings[E_COLOR]="Edge Color";
    23   edge_property_strings[E_TEXT]="Edge Text";
    24 
    25   edge_property_defaults.resize(EDGE_PROPERTY_NUM);
    26   edge_property_defaults[E_WIDTH]=10.0;
    27   edge_property_defaults[E_COLOR]=100;
    28   edge_property_defaults[E_TEXT]=0;
    29 
    30   node_property_strings.resize(NODE_PROPERTY_NUM);
    31   node_property_strings[N_RADIUS]="Node Radius";
    32   node_property_strings[N_COLOR]="Node Color";
    33   node_property_strings[N_TEXT]="Node Text";
    34 
    35   node_property_defaults.resize(NODE_PROPERTY_NUM);
    36   node_property_defaults[N_RADIUS]=20.0;
    37   node_property_defaults[N_COLOR]=100;
    38   node_property_defaults[N_TEXT]=0;
    39 
    40   longest_property_string_length=0;
    41   for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    42     {
    43       int j=edge_property_strings[i].size();
    44       if(j>longest_property_string_length)
    45 	{
    46 	  longest_property_string_length=j;
    47 	}
    48     }
    49   for(int i=0;i<NODE_PROPERTY_NUM;i++)
    50     {
    51       int j=node_property_strings[i].size();
    52       if(j>longest_property_string_length)
    53 	{
    54 	  longest_property_string_length=j;
    55 	}
    56     }
    57 
    58 
    59   //initializing GUI
    60 
    61   Gnome::Canvas::init();
    62   Gtk::Main app(argc, argv);
    63 
    64   MainWin mytab;
    65 
    66 //   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
    67 //     {
    68 //       mytab.readFile(argv[1]);
    69 //     }
    70   if(argc>=2)
    71     {
    72       for(int i=1;i<argc;i++)
    73 	{
    74 	  if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
    75 	    {
    76 	      mytab.readFile(argv[i]);
    77 	    }
    78 	}
    79     }
    80   else
    81     {
    82       mytab.newTab();
    83     }
    84   
    85   app.run(mytab);
    86 
    87   return 0;
    88 }