gui/graph-displayer.cc
author hegyi
Mon, 21 Nov 2005 18:03:20 +0000
changeset 1823 cb082cdf3667
parent 1650 422906271d22
child 1849 a4d1362397fe
permissions -rw-r--r--
NewMapWin has become Dialog instead of Window. Therefore it is created dynamically, when there is need for it, instead of keeping one instance in memory. This solution is slower, but more correct than before.
ladanyi@1606
     1
#include "all_include.h"
ladanyi@1606
     2
#include "mapstorage.h"
ladanyi@1606
     3
#include "main_win.h"
ladanyi@1412
     4
#include <libgnomecanvasmm.h>
ladanyi@1412
     5
#include <libgnomecanvasmm/polygon.h>
ladanyi@1412
     6
ladanyi@1412
     7
#define MAIN_PART
ladanyi@1412
     8
hegyi@1512
     9
std::vector <std::string> edge_property_strings;
hegyi@1512
    10
std::vector <double> edge_property_defaults;
hegyi@1512
    11
std::vector <std::string> node_property_strings;
hegyi@1512
    12
std::vector <double> node_property_defaults;
hegyi@1731
    13
int longest_property_string_length;
ladanyi@1412
    14
ladanyi@1412
    15
int main(int argc, char *argv[])
ladanyi@1412
    16
{
hegyi@1440
    17
hegyi@1440
    18
  //initializing
hegyi@1440
    19
hegyi@1512
    20
  edge_property_strings.resize(EDGE_PROPERTY_NUM);
hegyi@1512
    21
  edge_property_strings[E_WIDTH]="Edge Width";
hegyi@1512
    22
  edge_property_strings[E_COLOR]="Edge Color";
hegyi@1512
    23
  edge_property_strings[E_TEXT]="Edge Text";
ladanyi@1412
    24
hegyi@1512
    25
  edge_property_defaults.resize(EDGE_PROPERTY_NUM);
hegyi@1512
    26
  edge_property_defaults[E_WIDTH]=10.0;
hegyi@1512
    27
  edge_property_defaults[E_COLOR]=100;
hegyi@1512
    28
  edge_property_defaults[E_TEXT]=0;
hegyi@1512
    29
hegyi@1512
    30
  node_property_strings.resize(NODE_PROPERTY_NUM);
hegyi@1512
    31
  node_property_strings[N_RADIUS]="Node Radius";
hegyi@1512
    32
  node_property_strings[N_COLOR]="Node Color";
hegyi@1512
    33
  node_property_strings[N_TEXT]="Node Text";
hegyi@1512
    34
hegyi@1512
    35
  node_property_defaults.resize(NODE_PROPERTY_NUM);
hegyi@1512
    36
  node_property_defaults[N_RADIUS]=20.0;
hegyi@1512
    37
  node_property_defaults[N_COLOR]=100;
hegyi@1512
    38
  node_property_defaults[N_TEXT]=0;
ladanyi@1412
    39
hegyi@1731
    40
  longest_property_string_length=0;
hegyi@1731
    41
  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
hegyi@1731
    42
    {
hegyi@1731
    43
      int j=edge_property_strings[i].size();
hegyi@1731
    44
      if(j>longest_property_string_length)
hegyi@1731
    45
	{
hegyi@1731
    46
	  longest_property_string_length=j;
hegyi@1731
    47
	}
hegyi@1731
    48
    }
hegyi@1731
    49
  for(int i=0;i<NODE_PROPERTY_NUM;i++)
hegyi@1731
    50
    {
hegyi@1731
    51
      int j=node_property_strings[i].size();
hegyi@1731
    52
      if(j>longest_property_string_length)
hegyi@1731
    53
	{
hegyi@1731
    54
	  longest_property_string_length=j;
hegyi@1731
    55
	}
hegyi@1731
    56
    }
hegyi@1731
    57
hegyi@1731
    58
hegyi@1440
    59
  //initializing GUI
hegyi@1440
    60
ladanyi@1412
    61
  Gnome::Canvas::init();
ladanyi@1412
    62
  Gtk::Main app(argc, argv);
ladanyi@1412
    63
ladanyi@1650
    64
  MainWin mainwin;
ladanyi@1616
    65
ladanyi@1616
    66
  if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
ladanyi@1616
    67
  {
ladanyi@1616
    68
    mainwin.readFile(argv[1]);
ladanyi@1616
    69
  }
ladanyi@1616
    70
  
ladanyi@1412
    71
  app.run(mainwin);
ladanyi@1412
    72
ladanyi@1412
    73
  return 0;
ladanyi@1412
    74
}