COIN-OR::LEMON - Graph Library

source: glemon/graph-displayer.cc @ 3:2cc5ed6e6255

Last change on this file since 3:2cc5ed6e6255 was 2:fdb8a163000f, checked in by Akos Ladanyi <ladanyi@…>, 16 years ago

Use libintl.h instead of locale.h.

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