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