graph-displayer.cc
author alpar
Mon, 30 Oct 2006 12:20:54 +0000
changeset 175 1e0a66d6b45a
parent 133 b289ba51506f
child 194 6b2b718420eb
permissions -rw-r--r--
Add autopackage specfile (not yet working).
alpar@174
     1
/* -*- C++ -*-
alpar@174
     2
 *
alpar@174
     3
 * This file is a part of LEMON, a generic C++ optimization library
alpar@174
     4
 *
alpar@174
     5
 * Copyright (C) 2003-2006
alpar@174
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@174
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@174
     8
 *
alpar@174
     9
 * Permission to use, modify and distribute this software is granted
alpar@174
    10
 * provided that this copyright notice appears in all copies. For
alpar@174
    11
 * precise terms see the accompanying LICENSE file.
alpar@174
    12
 *
alpar@174
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@174
    14
 * express or implied, and with no claim as to its suitability for any
alpar@174
    15
 * purpose.
alpar@174
    16
 *
alpar@174
    17
 */
alpar@174
    18
ladanyi@130
    19
#ifdef HAVE_CONFIG_H
ladanyi@130
    20
#include <config.h>
ladanyi@130
    21
#endif
ladanyi@130
    22
ladanyi@53
    23
#include "all_include.h"
ladanyi@53
    24
#include "mapstorage.h"
ladanyi@53
    25
#include "main_win.h"
ladanyi@1
    26
#include <libgnomecanvasmm.h>
ladanyi@1
    27
#include <libgnomecanvasmm/polygon.h>
ladanyi@1
    28
ladanyi@130
    29
#include <locale.h>
ladanyi@130
    30
ladanyi@1
    31
#define MAIN_PART
ladanyi@1
    32
hegyi@28
    33
std::vector <std::string> edge_property_strings;
hegyi@28
    34
std::vector <double> edge_property_defaults;
hegyi@28
    35
std::vector <std::string> node_property_strings;
hegyi@28
    36
std::vector <double> node_property_defaults;
hegyi@81
    37
int longest_property_string_length;
ladanyi@1
    38
ladanyi@1
    39
int main(int argc, char *argv[])
ladanyi@1
    40
{
ladanyi@133
    41
  setlocale(LC_ALL, "");
ladanyi@130
    42
  bindtextdomain(PACKAGE, LOCALEDIR);
ladanyi@130
    43
  bind_textdomain_codeset(PACKAGE, "UTF-8");
ladanyi@130
    44
  textdomain(PACKAGE);
hegyi@4
    45
hegyi@4
    46
  //initializing
hegyi@4
    47
hegyi@28
    48
  edge_property_strings.resize(EDGE_PROPERTY_NUM);
hegyi@28
    49
  edge_property_strings[E_WIDTH]="Edge Width";
hegyi@28
    50
  edge_property_strings[E_COLOR]="Edge Color";
hegyi@28
    51
  edge_property_strings[E_TEXT]="Edge Text";
ladanyi@1
    52
hegyi@28
    53
  edge_property_defaults.resize(EDGE_PROPERTY_NUM);
hegyi@28
    54
  edge_property_defaults[E_WIDTH]=10.0;
hegyi@28
    55
  edge_property_defaults[E_COLOR]=100;
hegyi@28
    56
  edge_property_defaults[E_TEXT]=0;
hegyi@28
    57
hegyi@28
    58
  node_property_strings.resize(NODE_PROPERTY_NUM);
hegyi@28
    59
  node_property_strings[N_RADIUS]="Node Radius";
hegyi@28
    60
  node_property_strings[N_COLOR]="Node Color";
hegyi@28
    61
  node_property_strings[N_TEXT]="Node Text";
hegyi@28
    62
hegyi@28
    63
  node_property_defaults.resize(NODE_PROPERTY_NUM);
hegyi@28
    64
  node_property_defaults[N_RADIUS]=20.0;
hegyi@28
    65
  node_property_defaults[N_COLOR]=100;
hegyi@28
    66
  node_property_defaults[N_TEXT]=0;
ladanyi@1
    67
hegyi@81
    68
  longest_property_string_length=0;
hegyi@81
    69
  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
hegyi@81
    70
    {
hegyi@81
    71
      int j=edge_property_strings[i].size();
hegyi@81
    72
      if(j>longest_property_string_length)
hegyi@81
    73
	{
hegyi@81
    74
	  longest_property_string_length=j;
hegyi@81
    75
	}
hegyi@81
    76
    }
hegyi@81
    77
  for(int i=0;i<NODE_PROPERTY_NUM;i++)
hegyi@81
    78
    {
hegyi@81
    79
      int j=node_property_strings[i].size();
hegyi@81
    80
      if(j>longest_property_string_length)
hegyi@81
    81
	{
hegyi@81
    82
	  longest_property_string_length=j;
hegyi@81
    83
	}
hegyi@81
    84
    }
hegyi@81
    85
hegyi@81
    86
hegyi@4
    87
  //initializing GUI
hegyi@4
    88
ladanyi@1
    89
  Gnome::Canvas::init();
ladanyi@1
    90
  Gtk::Main app(argc, argv);
ladanyi@1
    91
hegyi@96
    92
  MainWin mytab;
ladanyi@57
    93
hegyi@102
    94
//   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
hegyi@102
    95
//     {
hegyi@102
    96
//       mytab.readFile(argv[1]);
hegyi@102
    97
//     }
hegyi@102
    98
  if(argc>=2)
hegyi@96
    99
    {
hegyi@102
   100
      for(int i=1;i<argc;i++)
hegyi@102
   101
	{
hegyi@102
   102
	  if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
hegyi@102
   103
	    {
hegyi@102
   104
	      mytab.readFile(argv[i]);
hegyi@102
   105
	    }
hegyi@102
   106
	}
hegyi@102
   107
    }
hegyi@102
   108
  else
hegyi@102
   109
    {
hegyi@102
   110
      mytab.newTab();
hegyi@96
   111
    }
ladanyi@57
   112
  
hegyi@96
   113
  app.run(mytab);
ladanyi@1
   114
ladanyi@1
   115
  return 0;
ladanyi@1
   116
}