COIN-OR::LEMON - Graph Library

source: glemon-0.x/graph-displayer.cc @ 174:95872af46fc4

Last change on this file since 174:95872af46fc4 was 174:95872af46fc4, checked in by Alpar Juttner, 13 years ago

Add copyright headers

File size: 2.8 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 "mapstorage.h"
25#include "main_win.h"
26#include <libgnomecanvasmm.h>
27#include <libgnomecanvasmm/polygon.h>
28
29#include <locale.h>
30
31#define MAIN_PART
32
33std::vector <std::string> edge_property_strings;
34std::vector <double> edge_property_defaults;
35std::vector <std::string> node_property_strings;
36std::vector <double> node_property_defaults;
37int longest_property_string_length;
38
39int main(int argc, char *argv[])
40{
41  setlocale(LC_ALL, "");
42  bindtextdomain(PACKAGE, LOCALEDIR);
43  bind_textdomain_codeset(PACKAGE, "UTF-8");
44  textdomain(PACKAGE);
45
46  //initializing
47
48  edge_property_strings.resize(EDGE_PROPERTY_NUM);
49  edge_property_strings[E_WIDTH]="Edge Width";
50  edge_property_strings[E_COLOR]="Edge Color";
51  edge_property_strings[E_TEXT]="Edge Text";
52
53  edge_property_defaults.resize(EDGE_PROPERTY_NUM);
54  edge_property_defaults[E_WIDTH]=10.0;
55  edge_property_defaults[E_COLOR]=100;
56  edge_property_defaults[E_TEXT]=0;
57
58  node_property_strings.resize(NODE_PROPERTY_NUM);
59  node_property_strings[N_RADIUS]="Node Radius";
60  node_property_strings[N_COLOR]="Node Color";
61  node_property_strings[N_TEXT]="Node Text";
62
63  node_property_defaults.resize(NODE_PROPERTY_NUM);
64  node_property_defaults[N_RADIUS]=20.0;
65  node_property_defaults[N_COLOR]=100;
66  node_property_defaults[N_TEXT]=0;
67
68  longest_property_string_length=0;
69  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
70    {
71      int j=edge_property_strings[i].size();
72      if(j>longest_property_string_length)
73        {
74          longest_property_string_length=j;
75        }
76    }
77  for(int i=0;i<NODE_PROPERTY_NUM;i++)
78    {
79      int j=node_property_strings[i].size();
80      if(j>longest_property_string_length)
81        {
82          longest_property_string_length=j;
83        }
84    }
85
86
87  //initializing GUI
88
89  Gnome::Canvas::init();
90  Gtk::Main app(argc, argv);
91
92  MainWin mytab;
93
94//   if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
95//     {
96//       mytab.readFile(argv[1]);
97//     }
98  if(argc>=2)
99    {
100      for(int i=1;i<argc;i++)
101        {
102          if(Glib::file_test(argv[i], Glib::FILE_TEST_IS_REGULAR))
103            {
104              mytab.readFile(argv[i]);
105            }
106        }
107    }
108  else
109    {
110      mytab.newTab();
111    }
112 
113  app.run(mytab);
114
115  return 0;
116}
Note: See TracBrowser for help on using the repository browser.