graph-displayer.cc
author hegyi
Thu, 05 Jan 2006 12:30:09 +0000
branchgui
changeset 108 bf355fd6563e
parent 96 e664d8aa3f72
child 130 3533c2d9a865
permissions -rw-r--r--
Several changes. \n If new map is added to mapstorage it emits signal with the name of the new map. This was important, because from now on not only tha mapwin should be updated. \n Furthermore algobox gets a pointer to mapstorage instead of only the mapnames from it. This is important because without it it would be complicated to pass all of the required maps to algobox.
ladanyi@53
     1
#include "all_include.h"
ladanyi@53
     2
#include "mapstorage.h"
ladanyi@53
     3
#include "main_win.h"
ladanyi@1
     4
#include <libgnomecanvasmm.h>
ladanyi@1
     5
#include <libgnomecanvasmm/polygon.h>
ladanyi@1
     6
ladanyi@1
     7
#define MAIN_PART
ladanyi@1
     8
hegyi@28
     9
std::vector <std::string> edge_property_strings;
hegyi@28
    10
std::vector <double> edge_property_defaults;
hegyi@28
    11
std::vector <std::string> node_property_strings;
hegyi@28
    12
std::vector <double> node_property_defaults;
hegyi@81
    13
int longest_property_string_length;
ladanyi@1
    14
ladanyi@1
    15
int main(int argc, char *argv[])
ladanyi@1
    16
{
hegyi@4
    17
hegyi@4
    18
  //initializing
hegyi@4
    19
hegyi@28
    20
  edge_property_strings.resize(EDGE_PROPERTY_NUM);
hegyi@28
    21
  edge_property_strings[E_WIDTH]="Edge Width";
hegyi@28
    22
  edge_property_strings[E_COLOR]="Edge Color";
hegyi@28
    23
  edge_property_strings[E_TEXT]="Edge Text";
ladanyi@1
    24
hegyi@28
    25
  edge_property_defaults.resize(EDGE_PROPERTY_NUM);
hegyi@28
    26
  edge_property_defaults[E_WIDTH]=10.0;
hegyi@28
    27
  edge_property_defaults[E_COLOR]=100;
hegyi@28
    28
  edge_property_defaults[E_TEXT]=0;
hegyi@28
    29
hegyi@28
    30
  node_property_strings.resize(NODE_PROPERTY_NUM);
hegyi@28
    31
  node_property_strings[N_RADIUS]="Node Radius";
hegyi@28
    32
  node_property_strings[N_COLOR]="Node Color";
hegyi@28
    33
  node_property_strings[N_TEXT]="Node Text";
hegyi@28
    34
hegyi@28
    35
  node_property_defaults.resize(NODE_PROPERTY_NUM);
hegyi@28
    36
  node_property_defaults[N_RADIUS]=20.0;
hegyi@28
    37
  node_property_defaults[N_COLOR]=100;
hegyi@28
    38
  node_property_defaults[N_TEXT]=0;
ladanyi@1
    39
hegyi@81
    40
  longest_property_string_length=0;
hegyi@81
    41
  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
hegyi@81
    42
    {
hegyi@81
    43
      int j=edge_property_strings[i].size();
hegyi@81
    44
      if(j>longest_property_string_length)
hegyi@81
    45
	{
hegyi@81
    46
	  longest_property_string_length=j;
hegyi@81
    47
	}
hegyi@81
    48
    }
hegyi@81
    49
  for(int i=0;i<NODE_PROPERTY_NUM;i++)
hegyi@81
    50
    {
hegyi@81
    51
      int j=node_property_strings[i].size();
hegyi@81
    52
      if(j>longest_property_string_length)
hegyi@81
    53
	{
hegyi@81
    54
	  longest_property_string_length=j;
hegyi@81
    55
	}
hegyi@81
    56
    }
hegyi@81
    57
hegyi@81
    58
hegyi@4
    59
  //initializing GUI
hegyi@4
    60
ladanyi@1
    61
  Gnome::Canvas::init();
ladanyi@1
    62
  Gtk::Main app(argc, argv);
ladanyi@1
    63
hegyi@96
    64
  MainWin mytab;
ladanyi@57
    65
hegyi@102
    66
//   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
hegyi@102
    67
//     {
hegyi@102
    68
//       mytab.readFile(argv[1]);
hegyi@102
    69
//     }
hegyi@102
    70
  if(argc>=2)
hegyi@96
    71
    {
hegyi@102
    72
      for(int i=1;i<argc;i++)
hegyi@102
    73
	{
hegyi@102
    74
	  if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
hegyi@102
    75
	    {
hegyi@102
    76
	      mytab.readFile(argv[i]);
hegyi@102
    77
	    }
hegyi@102
    78
	}
hegyi@102
    79
    }
hegyi@102
    80
  else
hegyi@102
    81
    {
hegyi@102
    82
      mytab.newTab();
hegyi@96
    83
    }
ladanyi@57
    84
  
hegyi@96
    85
  app.run(mytab);
ladanyi@1
    86
ladanyi@1
    87
  return 0;
ladanyi@1
    88
}