COIN-OR::LEMON - Graph Library

source: glemon-0.x/graph-displayer.cc @ 194:6b2b718420eb

Last change on this file since 194:6b2b718420eb was 194:6b2b718420eb, checked in by Hegyi Péter, 17 years ago

Header reorganising

File size: 2.7 KB
RevLine 
[174]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
[130]19#ifdef HAVE_CONFIG_H
20#include <config.h>
21#endif
22
[53]23#include "all_include.h"
24#include "main_win.h"
[1]25#include <libgnomecanvasmm.h>
26#include <libgnomecanvasmm/polygon.h>
27
[130]28#include <locale.h>
29
[1]30#define MAIN_PART
31
[28]32std::vector <std::string> edge_property_strings;
33std::vector <double> edge_property_defaults;
34std::vector <std::string> node_property_strings;
35std::vector <double> node_property_defaults;
[81]36int longest_property_string_length;
[1]37
38int main(int argc, char *argv[])
39{
[133]40  setlocale(LC_ALL, "");
[130]41  bindtextdomain(PACKAGE, LOCALEDIR);
42  bind_textdomain_codeset(PACKAGE, "UTF-8");
43  textdomain(PACKAGE);
[4]44
45  //initializing
46
[28]47  edge_property_strings.resize(EDGE_PROPERTY_NUM);
48  edge_property_strings[E_WIDTH]="Edge Width";
49  edge_property_strings[E_COLOR]="Edge Color";
50  edge_property_strings[E_TEXT]="Edge Text";
[1]51
[28]52  edge_property_defaults.resize(EDGE_PROPERTY_NUM);
53  edge_property_defaults[E_WIDTH]=10.0;
54  edge_property_defaults[E_COLOR]=100;
55  edge_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;
[1]66
[81]67  longest_property_string_length=0;
68  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
69    {
70      int j=edge_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
[4]86  //initializing GUI
87
[1]88  Gnome::Canvas::init();
89  Gtk::Main app(argc, argv);
90
[96]91  MainWin mytab;
[57]92
[102]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)
[96]98    {
[102]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();
[96]110    }
[57]111 
[96]112  app.run(mytab);
[1]113
114  return 0;
115}
Note: See TracBrowser for help on using the repository browser.