COIN-OR::LEMON - Graph Library

source: glemon/file_import_dialog.h @ 2:fdb8a163000f

Last change on this file since 2:fdb8a163000f was 1:67188bd752db, checked in by Peter Hegyi <hegyi@…>, 16 years ago

SVN revision 3500 made compilable with Lemon 1.0.

File size: 3.9 KB
RevLine 
[1]1#ifndef FILE_IMPORT_DIALOG
2#define FILE_IMPORT_DIALOG
3
4#include <gtkmm/dialog.h>
5#include <gtkmm/radiobutton.h>
6#include <gtkmm/comboboxtext.h>
7#include <gtkmm/sizegroup.h>
8#include <gtkmm/treemodel.h>
9#include <gtkmm/liststore.h>
10#include <gtkmm/treeview.h>
11#include <gtkmm/scrolledwindow.h>
12
13class FileImportDialog : public Gtk::Dialog
14{
15  public:
16    struct ImportData
17    {
18        ImportData(
19            const std::vector<std::string>& _node_map_names,
20            const std::vector<std::string>& _arc_map_names);
21
22        ~ImportData();
23
24        std::vector<std::string> node_map_names;
25        std::vector<std::string> arc_map_names;
26
27        std::vector<std::string> xy_node_map_names;
28        std::vector<std::string> xy_arc_map_names;
29
30        bool contains(
31            const std::vector<std::string>& vec,
32            const std::string& str);
33
34        std::string node_coord_one_map_name;
35        std::string node_coord_two_maps_1_name;
36        std::string node_coord_two_maps_2_name;
37        std::string arrow_coord_one_map_name;
38        std::string arrow_coord_two_maps_1_name;
39        std::string arrow_coord_two_maps_2_name;
40
41        enum ReadOpts { ONE_MAP, TWO_MAPS, DONT_READ };
42        ReadOpts node_coord_load_from;
43        ReadOpts arrow_coord_load_from;
44
45        bool isXYNodeMap(const std::string& name);
46        bool isXYArcMap(const std::string& name);
47        bool isNodeMap(const std::string& name);
48        bool isArcMap(const std::string& name);
49
50        std::vector<std::string> numeric_node_map_names;
51        std::vector<std::string> string_node_map_names;
52        std::vector<std::string> numeric_arc_map_names;
53        std::vector<std::string> string_arc_map_names;
54    };
55
56    ImportData* p_data;
57
58    Gtk::RadioButton rblueCoordNone;
59    Gtk::RadioButton rblueCoordOneMap;
60    Gtk::RadioButton rblueCoordTwoMaps;
61
62    Gtk::RadioButton rbArrowCoordNone;
63    Gtk::RadioButton rbArrowCoordOneMap;
64    Gtk::RadioButton rbArrowCoordTwoMaps;
65
66    Gtk::ComboBoxText cblueCoordOneMap;
67    Gtk::ComboBoxText cblueCoordTwoMaps1;
68    Gtk::ComboBoxText cblueCoordTwoMaps2;
69
70    Gtk::ComboBoxText cbArrowCoordOneMap;
71    Gtk::ComboBoxText cbArrowCoordTwoMaps1;
72    Gtk::ComboBoxText cbArrowCoordTwoMaps2;
73
74    void onNodeCoordMapNumToggled();
75    void onArrowCoordMapNumToggled();
76
77    void onResponse(int id);
78
79    void onNodeCoordOneMapChanged();
80    void onNodeCoordTwoMaps1Changed();
81    void onNodeCoordTwoMaps2Changed();
82
83    void onArrowCoordOneMapChanged();
84    void onArrowCoordTwoMaps1Changed();
85    void onArrowCoordTwoMaps2Changed();
86
87    struct MapModelColumns : public Gtk::TreeModel::ColumnRecord
88    {
89      MapModelColumns()
90      {
91        add(colName);
92        add(colReadAsNumeric);
93        add(colReadAsString);
94      }
95      Gtk::TreeModelColumn<Glib::ustring> colName;
96      Gtk::TreeModelColumn<bool> colReadAsNumeric;
97      Gtk::TreeModelColumn<bool> colReadAsString;
98    };
99
100    Gtk::TreeView twNodeMaps;
101    MapModelColumns NodeMapColumns;
102    Glib::RefPtr<Gtk::ListStore> refNodeMapStore;
103    void onNodeMapNumericToggled(const Glib::ustring& path);
104    void onNodeMapStringToggled(const Glib::ustring& path);
105
106    Gtk::TreeView twArcMaps;
107    MapModelColumns ArcMapColumns;
108    Glib::RefPtr<Gtk::ListStore> refArcMapStore;
109    void onArcMapNumericToggled(const Glib::ustring& path);
110    void onArcMapStringToggled(const Glib::ustring& path);
111
112    struct tree_view_record
113    {
114      tree_view_record(const std::string& _name, bool _numeric, bool _string,
115          bool _visible) :
116        name(_name),
117        numeric(_numeric),
118        string(_string),
119        visible(_visible) {}
120      std::string name;
121      bool numeric;
122      bool string;
123      bool visible;
124    };
125
126    std::vector<tree_view_record> node_tree_view_records;
127    void update_node_tree_view();
128
129    std::vector<tree_view_record> arc_tree_view_records;
130    void update_arc_tree_view();
131
132  public:
133    FileImportDialog(ImportData* d);
134    ~FileImportDialog();
135};
136
137#endif
Note: See TracBrowser for help on using the repository browser.