ladanyi@1606
|
1 |
#include "main_win.h"
|
ladanyi@1862
|
2 |
#include "guipixbufs.h"
|
ladanyi@1442
|
3 |
|
hegyi@1849
|
4 |
MainWin::MainWin()
|
ladanyi@1442
|
5 |
{
|
hegyi@1849
|
6 |
set_title ("no file");
|
ladanyi@1442
|
7 |
set_default_size(WIN_WIDTH,WIN_HEIGHT);
|
ladanyi@1442
|
8 |
add(vbox);
|
ladanyi@1442
|
9 |
|
ladanyi@1634
|
10 |
// custom icons for the toolbar
|
ladanyi@1634
|
11 |
Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
|
ladanyi@1634
|
12 |
|
ladanyi@1635
|
13 |
Glib::RefPtr<Gdk::Pixbuf> p_move_pixbuf = Gdk::Pixbuf::create_from_inline(
|
ladanyi@1635
|
14 |
2328, gui_icons_move);
|
ladanyi@1635
|
15 |
Glib::RefPtr<Gdk::Pixbuf> p_addnode_pixbuf = Gdk::Pixbuf::create_from_inline(
|
ladanyi@1635
|
16 |
2328, gui_icons_addnode);
|
ladanyi@1635
|
17 |
Glib::RefPtr<Gdk::Pixbuf> p_addlink_pixbuf = Gdk::Pixbuf::create_from_inline(
|
ladanyi@1635
|
18 |
2328, gui_icons_addlink);
|
ladanyi@1635
|
19 |
Glib::RefPtr<Gdk::Pixbuf> p_delete_pixbuf = Gdk::Pixbuf::create_from_inline(
|
ladanyi@1635
|
20 |
2328, gui_icons_delete);
|
ladanyi@1635
|
21 |
Glib::RefPtr<Gdk::Pixbuf> p_editlink_pixbuf = Gdk::Pixbuf::create_from_inline(
|
ladanyi@1635
|
22 |
2328, gui_icons_editlink);
|
ladanyi@1635
|
23 |
Glib::RefPtr<Gdk::Pixbuf> p_editnode_pixbuf = Gdk::Pixbuf::create_from_inline(
|
ladanyi@1635
|
24 |
2328, gui_icons_editnode);
|
ladanyi@1635
|
25 |
Glib::RefPtr<Gdk::Pixbuf> p_newmap_pixbuf = Gdk::Pixbuf::create_from_inline(
|
ladanyi@1635
|
26 |
2328, gui_icons_newmap);
|
ladanyi@1634
|
27 |
|
ladanyi@1634
|
28 |
Gtk::IconSource move_icon_source;
|
ladanyi@1635
|
29 |
move_icon_source.set_pixbuf(p_move_pixbuf);
|
ladanyi@1634
|
30 |
Gtk::IconSet move_icon_set;
|
ladanyi@1634
|
31 |
move_icon_set.add_source(move_icon_source);
|
ladanyi@1634
|
32 |
p_icon_factory->add(Gtk::StockID("gd-move"), move_icon_set);
|
ladanyi@1634
|
33 |
|
ladanyi@1634
|
34 |
Gtk::IconSource addnode_icon_source;
|
ladanyi@1635
|
35 |
addnode_icon_source.set_pixbuf(p_addnode_pixbuf);
|
ladanyi@1634
|
36 |
Gtk::IconSet addnode_icon_set;
|
ladanyi@1634
|
37 |
addnode_icon_set.add_source(addnode_icon_source);
|
ladanyi@1634
|
38 |
p_icon_factory->add(Gtk::StockID("gd-addnode"), addnode_icon_set);
|
ladanyi@1634
|
39 |
|
ladanyi@1634
|
40 |
Gtk::IconSource addlink_icon_source;
|
ladanyi@1635
|
41 |
addlink_icon_source.set_pixbuf(p_addlink_pixbuf);
|
ladanyi@1634
|
42 |
Gtk::IconSet addlink_icon_set;
|
ladanyi@1634
|
43 |
addlink_icon_set.add_source(addlink_icon_source);
|
ladanyi@1634
|
44 |
p_icon_factory->add(Gtk::StockID("gd-addlink"), addlink_icon_set);
|
ladanyi@1634
|
45 |
|
ladanyi@1634
|
46 |
Gtk::IconSource delete_icon_source;
|
ladanyi@1635
|
47 |
delete_icon_source.set_pixbuf(p_delete_pixbuf);
|
ladanyi@1634
|
48 |
Gtk::IconSet delete_icon_set;
|
ladanyi@1634
|
49 |
delete_icon_set.add_source(delete_icon_source);
|
ladanyi@1634
|
50 |
p_icon_factory->add(Gtk::StockID("gd-delete"), delete_icon_set);
|
ladanyi@1634
|
51 |
|
ladanyi@1634
|
52 |
Gtk::IconSource editlink_icon_source;
|
ladanyi@1635
|
53 |
editlink_icon_source.set_pixbuf(p_editlink_pixbuf);
|
ladanyi@1634
|
54 |
Gtk::IconSet editlink_icon_set;
|
ladanyi@1634
|
55 |
editlink_icon_set.add_source(editlink_icon_source);
|
ladanyi@1634
|
56 |
p_icon_factory->add(Gtk::StockID("gd-editlink"), editlink_icon_set);
|
ladanyi@1634
|
57 |
|
ladanyi@1634
|
58 |
Gtk::IconSource editnode_icon_source;
|
ladanyi@1635
|
59 |
editnode_icon_source.set_pixbuf(p_editnode_pixbuf);
|
ladanyi@1634
|
60 |
Gtk::IconSet editnode_icon_set;
|
ladanyi@1634
|
61 |
editnode_icon_set.add_source(editnode_icon_source);
|
ladanyi@1634
|
62 |
p_icon_factory->add(Gtk::StockID("gd-editnode"), editnode_icon_set);
|
ladanyi@1634
|
63 |
|
ladanyi@1634
|
64 |
Gtk::IconSource newmap_icon_source;
|
ladanyi@1635
|
65 |
newmap_icon_source.set_pixbuf(p_newmap_pixbuf);
|
ladanyi@1634
|
66 |
Gtk::IconSet newmap_icon_set;
|
ladanyi@1634
|
67 |
newmap_icon_set.add_source(newmap_icon_source);
|
ladanyi@1634
|
68 |
p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set);
|
ladanyi@1634
|
69 |
|
ladanyi@1634
|
70 |
p_icon_factory->add_default();
|
ladanyi@1634
|
71 |
|
ladanyi@1442
|
72 |
ag=Gtk::ActionGroup::create();
|
ladanyi@1442
|
73 |
|
ladanyi@1442
|
74 |
ag->add( Gtk::Action::create("FileMenu", "_File") );
|
hegyi@1849
|
75 |
ag->add( Gtk::Action::create("FileNewTab", "New _Tab"),
|
hegyi@1849
|
76 |
sigc::mem_fun(*this, &MainWin::newTab));
|
hegyi@1856
|
77 |
ag->add( Gtk::Action::create("FileCloseTab", "_Close Tab"),
|
hegyi@1856
|
78 |
sigc::mem_fun(*this, &MainWin::closeTab));
|
ladanyi@1442
|
79 |
ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
|
ladanyi@1442
|
80 |
sigc::mem_fun(*this, &MainWin::newFile));
|
ladanyi@1442
|
81 |
ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
|
ladanyi@1442
|
82 |
sigc::mem_fun(*this, &MainWin::openFile));
|
ladanyi@1442
|
83 |
ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
|
ladanyi@1442
|
84 |
sigc::mem_fun(*this, &MainWin::saveFile));
|
ladanyi@1442
|
85 |
ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
|
ladanyi@1442
|
86 |
sigc::mem_fun(*this, &MainWin::saveFileAs));
|
ladanyi@1606
|
87 |
ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE),
|
ladanyi@1606
|
88 |
sigc::mem_fun(*this, &MainWin::close));
|
ladanyi@1606
|
89 |
ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT),
|
hegyi@1598
|
90 |
sigc::mem_fun(*this, &MainWin::hide));
|
ladanyi@1442
|
91 |
|
ladanyi@1442
|
92 |
ag->add( Gtk::Action::create("ViewMenu", "_View") );
|
ladanyi@1442
|
93 |
ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
|
hegyi@1849
|
94 |
sigc::mem_fun(*this, &MainWin::zoomIn));
|
ladanyi@1442
|
95 |
ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
|
hegyi@1849
|
96 |
sigc::mem_fun(*this, &MainWin::zoomOut));
|
ladanyi@1442
|
97 |
ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
|
hegyi@1849
|
98 |
sigc::mem_fun(*this, &MainWin::zoomFit));
|
ladanyi@1442
|
99 |
ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
|
hegyi@1849
|
100 |
sigc::mem_fun(*this, &MainWin::zoom100));
|
ladanyi@1442
|
101 |
|
ladanyi@1442
|
102 |
ag->add( Gtk::Action::create("ShowMenu", "_Show") );
|
ladanyi@1442
|
103 |
ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
|
hegyi@1838
|
104 |
sigc::mem_fun(*this, &MainWin::createMapWin));
|
ladanyi@1442
|
105 |
|
ladanyi@1606
|
106 |
Gtk::RadioAction::Group tool_group;
|
ladanyi@1634
|
107 |
ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), "Move"),
|
hegyi@1849
|
108 |
sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 0) );
|
ladanyi@1634
|
109 |
ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), "Create node"),
|
hegyi@1849
|
110 |
sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 1) );
|
ladanyi@1634
|
111 |
ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), "Create edge"),
|
hegyi@1849
|
112 |
sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 2) );
|
ladanyi@1634
|
113 |
ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), "Delete"),
|
hegyi@1849
|
114 |
sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 3) );
|
ladanyi@1634
|
115 |
|
ladanyi@1634
|
116 |
ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), "Edit edge map"),
|
hegyi@1849
|
117 |
sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 4) );
|
ladanyi@1634
|
118 |
ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), "Edit node map"),
|
hegyi@1849
|
119 |
sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 5) );
|
ladanyi@1634
|
120 |
|
ladanyi@1634
|
121 |
ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")),
|
hegyi@1849
|
122 |
sigc::mem_fun ( *this , &MainWin::createNewMapWin ) );
|
hegyi@1502
|
123 |
|
ladanyi@1442
|
124 |
uim=Gtk::UIManager::create();
|
ladanyi@1442
|
125 |
uim->insert_action_group(ag);
|
ladanyi@1442
|
126 |
add_accel_group(uim->get_accel_group());
|
ladanyi@1442
|
127 |
|
ladanyi@1442
|
128 |
try
|
ladanyi@1442
|
129 |
{
|
ladanyi@1442
|
130 |
|
ladanyi@1442
|
131 |
Glib::ustring ui_info =
|
ladanyi@1442
|
132 |
"<ui>"
|
ladanyi@1442
|
133 |
" <menubar name='MenuBar'>"
|
ladanyi@1442
|
134 |
" <menu action='FileMenu'>"
|
hegyi@1849
|
135 |
" <menuitem action='FileNewTab'/>"
|
hegyi@1856
|
136 |
" <menuitem action='FileCloseTab'/>"
|
ladanyi@1442
|
137 |
" <menuitem action='FileNew'/>"
|
ladanyi@1442
|
138 |
" <menuitem action='FileOpen'/>"
|
ladanyi@1442
|
139 |
" <menuitem action='FileSave'/>"
|
ladanyi@1442
|
140 |
" <menuitem action='FileSaveAs'/>"
|
ladanyi@1606
|
141 |
" <menuitem action='Close'/>"
|
ladanyi@1606
|
142 |
" <menuitem action='Quit'/>"
|
ladanyi@1442
|
143 |
" </menu>"
|
ladanyi@1442
|
144 |
" <menu action='ViewMenu'>"
|
ladanyi@1442
|
145 |
" <menuitem action='ViewZoomIn' />"
|
ladanyi@1442
|
146 |
" <menuitem action='ViewZoomOut' />"
|
ladanyi@1442
|
147 |
" <menuitem action='ViewZoom100' />"
|
ladanyi@1777
|
148 |
" <menuitem action='ViewZoomFit' />"
|
ladanyi@1442
|
149 |
" </menu>"
|
ladanyi@1442
|
150 |
" <menu action='ShowMenu'>"
|
ladanyi@1442
|
151 |
" <menuitem action='ShowMaps'/>"
|
ladanyi@1442
|
152 |
" </menu>"
|
ladanyi@1442
|
153 |
" </menubar>"
|
ladanyi@1442
|
154 |
" <toolbar name='ToolBar'>"
|
ladanyi@1442
|
155 |
" <toolitem action='FileNew' />"
|
ladanyi@1442
|
156 |
" <toolitem action='FileOpen' />"
|
ladanyi@1442
|
157 |
" <toolitem action='FileSave' />"
|
ladanyi@1606
|
158 |
" <toolitem action='Close' />"
|
ladanyi@1442
|
159 |
" <separator />"
|
ladanyi@1442
|
160 |
" <toolitem action='ViewZoomIn' />"
|
ladanyi@1442
|
161 |
" <toolitem action='ViewZoomOut' />"
|
ladanyi@1442
|
162 |
" <toolitem action='ViewZoom100' />"
|
ladanyi@1777
|
163 |
" <toolitem action='ViewZoomFit' />"
|
hegyi@1502
|
164 |
" <separator />"
|
ladanyi@1606
|
165 |
" <toolitem action='MoveItem' />"
|
hegyi@1502
|
166 |
" <toolitem action='CreateNode' />"
|
hegyi@1502
|
167 |
" <toolitem action='CreateEdge' />"
|
hegyi@1502
|
168 |
" <toolitem action='EraseItem' />"
|
hegyi@1550
|
169 |
" <toolitem action='EditEdgeMap' />"
|
hegyi@1550
|
170 |
" <toolitem action='EditNodeMap' />"
|
ladanyi@1634
|
171 |
" <separator />"
|
hegyi@1592
|
172 |
" <toolitem action='AddMap' />"
|
ladanyi@1442
|
173 |
" </toolbar>"
|
ladanyi@1442
|
174 |
"</ui>";
|
ladanyi@1442
|
175 |
|
ladanyi@1442
|
176 |
uim->add_ui_from_string(ui_info);
|
ladanyi@1442
|
177 |
|
ladanyi@1442
|
178 |
}
|
ladanyi@1442
|
179 |
catch(const Glib::Error& ex)
|
ladanyi@1442
|
180 |
{
|
ladanyi@1442
|
181 |
std::cerr << "building menus failed: " << ex.what();
|
ladanyi@1442
|
182 |
}
|
ladanyi@1442
|
183 |
|
ladanyi@1442
|
184 |
Gtk::Widget* menubar = uim->get_widget("/MenuBar");
|
ladanyi@1442
|
185 |
if (menubar){
|
ladanyi@1442
|
186 |
vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
|
ladanyi@1442
|
187 |
}
|
ladanyi@1442
|
188 |
|
ladanyi@1442
|
189 |
Gtk::Widget* toolbar = uim->get_widget("/ToolBar");
|
ladanyi@1442
|
190 |
if (toolbar)
|
ladanyi@1442
|
191 |
{
|
ladanyi@1442
|
192 |
static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS);
|
ladanyi@1442
|
193 |
vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
|
ladanyi@1442
|
194 |
}
|
ladanyi@1442
|
195 |
|
hegyi@1601
|
196 |
tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node");
|
hegyi@1601
|
197 |
tooltips.enable();
|
ladanyi@1442
|
198 |
|
hegyi@1849
|
199 |
active_tab=-1;
|
hegyi@1849
|
200 |
notebook.signal_switch_page().connect(sigc::mem_fun(*this, &MainWin::onChangeTab));
|
hegyi@1849
|
201 |
|
hegyi@1849
|
202 |
vbox.pack_start(notebook);
|
hegyi@1849
|
203 |
|
ladanyi@1442
|
204 |
show_all_children();
|
ladanyi@1442
|
205 |
}
|
ladanyi@1442
|
206 |
|
hegyi@1849
|
207 |
void MainWin::set_tabtitle(std::string name)
|
ladanyi@1616
|
208 |
{
|
hegyi@1849
|
209 |
tabnames[active_tab]=name;
|
hegyi@1849
|
210 |
set_title(tabnames[active_tab] + " - " + prog_name);
|
hegyi@1849
|
211 |
notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
|
hegyi@1849
|
212 |
}
|
hegyi@1849
|
213 |
|
hegyi@1849
|
214 |
void MainWin::readFile(const std::string & filename)
|
hegyi@1849
|
215 |
{
|
hegyi@1849
|
216 |
newTab();
|
hegyi@1849
|
217 |
tabs[active_tab]->readFile(filename);
|
hegyi@1849
|
218 |
}
|
hegyi@1849
|
219 |
|
hegyi@1849
|
220 |
void MainWin::newTab()
|
hegyi@1849
|
221 |
{
|
hegyi@1849
|
222 |
int size=tabs.size();
|
hegyi@1849
|
223 |
tabs.resize(size+1);
|
hegyi@1849
|
224 |
tabnames.resize(size+1);
|
hegyi@1849
|
225 |
active_tab=size;
|
hegyi@1849
|
226 |
tabs[active_tab]=new NoteBookTab();
|
hegyi@1849
|
227 |
tabnames[active_tab]="unsaved file";
|
hegyi@1849
|
228 |
tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
|
hegyi@1849
|
229 |
tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
|
hegyi@1849
|
230 |
tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
|
hegyi@1849
|
231 |
notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
|
hegyi@1849
|
232 |
notebook.set_current_page(size);
|
hegyi@1849
|
233 |
set_tabtitle(tabnames[active_tab]);
|
hegyi@1849
|
234 |
}
|
hegyi@1849
|
235 |
|
hegyi@1856
|
236 |
void MainWin::closeTab()
|
hegyi@1856
|
237 |
{
|
hegyi@1856
|
238 |
if(active_tab!=-1)
|
hegyi@1856
|
239 |
{
|
hegyi@1856
|
240 |
//tabs vector will be decreased with the deleted value
|
hegyi@1856
|
241 |
int size=tabs.size();
|
hegyi@1856
|
242 |
if(size>1)
|
hegyi@1856
|
243 |
{
|
hegyi@1856
|
244 |
for(int i=active_tab+1;i<size;i++)
|
hegyi@1856
|
245 |
{
|
hegyi@1856
|
246 |
tabs[i-1]=tabs[i];
|
hegyi@1856
|
247 |
}
|
hegyi@1856
|
248 |
}
|
hegyi@1856
|
249 |
|
hegyi@1856
|
250 |
//if size==1 resize will delete the only element
|
hegyi@1856
|
251 |
tabs.resize(size-1);
|
hegyi@1856
|
252 |
|
hegyi@1856
|
253 |
int old_active_tab=active_tab;
|
hegyi@1856
|
254 |
notebook.remove_page(active_tab);
|
hegyi@1856
|
255 |
|
hegyi@1856
|
256 |
//If the first tab was active, upon delete notebook
|
hegyi@1856
|
257 |
//will first switch one tab upper and not lower like
|
hegyi@1856
|
258 |
//in the case, when not the first tab was active.
|
hegyi@1856
|
259 |
//But after deletion it will become the first tab,
|
hegyi@1856
|
260 |
//and this should be registrated in tabs vector,
|
hegyi@1856
|
261 |
//as well.
|
hegyi@1856
|
262 |
if(old_active_tab==0)
|
hegyi@1856
|
263 |
{
|
hegyi@1856
|
264 |
onChangeTab(NULL,0);
|
hegyi@1856
|
265 |
}
|
hegyi@1856
|
266 |
|
hegyi@1856
|
267 |
//if this was the last page in notebook, there is
|
hegyi@1856
|
268 |
//no active_tab now
|
hegyi@1856
|
269 |
if(size==1)
|
hegyi@1856
|
270 |
{
|
hegyi@1856
|
271 |
active_tab=-1;
|
hegyi@1856
|
272 |
}
|
hegyi@1856
|
273 |
}
|
hegyi@1856
|
274 |
}
|
hegyi@1856
|
275 |
|
hegyi@1849
|
276 |
void MainWin::onChangeTab(GtkNotebookPage* page, guint page_num)
|
hegyi@1849
|
277 |
{
|
hegyi@1849
|
278 |
page=page;
|
hegyi@1849
|
279 |
active_tab=page_num;
|
hegyi@1849
|
280 |
tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
|
hegyi@1849
|
281 |
set_title(tabnames[active_tab]);
|
hegyi@1849
|
282 |
}
|
hegyi@1849
|
283 |
|
hegyi@1849
|
284 |
void MainWin::onCloseTab()
|
hegyi@1849
|
285 |
{
|
ladanyi@1616
|
286 |
}
|
ladanyi@1616
|
287 |
|
ladanyi@1442
|
288 |
void MainWin::newFile()
|
ladanyi@1442
|
289 |
{
|
hegyi@1849
|
290 |
if(active_tab!=-1)
|
ladanyi@1606
|
291 |
{
|
hegyi@1849
|
292 |
tabs[active_tab]->newFile();
|
ladanyi@1606
|
293 |
}
|
ladanyi@1442
|
294 |
}
|
hegyi@1849
|
295 |
|
ladanyi@1442
|
296 |
void MainWin::openFile()
|
ladanyi@1442
|
297 |
{
|
hegyi@1849
|
298 |
if(active_tab!=-1)
|
ladanyi@1606
|
299 |
{
|
hegyi@1849
|
300 |
tabs[active_tab]->openFile();
|
ladanyi@1606
|
301 |
}
|
ladanyi@1442
|
302 |
}
|
hegyi@1849
|
303 |
|
ladanyi@1442
|
304 |
void MainWin::saveFile()
|
ladanyi@1442
|
305 |
{
|
hegyi@1849
|
306 |
if(active_tab!=-1)
|
hegyi@1849
|
307 |
{
|
hegyi@1849
|
308 |
tabs[active_tab]->saveFile();
|
hegyi@1849
|
309 |
}
|
ladanyi@1442
|
310 |
}
|
hegyi@1849
|
311 |
|
ladanyi@1442
|
312 |
void MainWin::saveFileAs()
|
ladanyi@1442
|
313 |
{
|
hegyi@1849
|
314 |
if(active_tab!=-1)
|
hegyi@1849
|
315 |
{
|
hegyi@1849
|
316 |
tabs[active_tab]->saveFileAs();
|
hegyi@1849
|
317 |
}
|
ladanyi@1442
|
318 |
}
|
hegyi@1849
|
319 |
|
ladanyi@1606
|
320 |
void MainWin::close()
|
ladanyi@1606
|
321 |
{
|
hegyi@1849
|
322 |
if(active_tab!=-1)
|
ladanyi@1606
|
323 |
{
|
hegyi@1849
|
324 |
tabs[active_tab]->close();
|
hegyi@1838
|
325 |
}
|
hegyi@1837
|
326 |
}
|
hegyi@1837
|
327 |
|
hegyi@1849
|
328 |
void MainWin::zoomIn()
|
hegyi@1837
|
329 |
{
|
hegyi@1849
|
330 |
if(active_tab!=-1)
|
hegyi@1838
|
331 |
{
|
hegyi@1849
|
332 |
tabs[active_tab]->gd_canvas->zoomIn();
|
hegyi@1849
|
333 |
}
|
hegyi@1849
|
334 |
}
|
hegyi@1849
|
335 |
|
hegyi@1849
|
336 |
void MainWin::zoomOut()
|
hegyi@1849
|
337 |
{
|
hegyi@1849
|
338 |
if(active_tab!=-1)
|
hegyi@1849
|
339 |
{
|
hegyi@1849
|
340 |
tabs[active_tab]->gd_canvas->zoomOut();
|
hegyi@1849
|
341 |
}
|
hegyi@1849
|
342 |
}
|
hegyi@1849
|
343 |
|
hegyi@1849
|
344 |
void MainWin::zoomFit()
|
hegyi@1849
|
345 |
{
|
hegyi@1849
|
346 |
if(active_tab!=-1)
|
hegyi@1849
|
347 |
{
|
hegyi@1849
|
348 |
tabs[active_tab]->gd_canvas->zoomFit();
|
hegyi@1849
|
349 |
}
|
hegyi@1849
|
350 |
}
|
hegyi@1849
|
351 |
|
hegyi@1849
|
352 |
void MainWin::zoom100()
|
hegyi@1849
|
353 |
{
|
hegyi@1849
|
354 |
if(active_tab!=-1)
|
hegyi@1849
|
355 |
{
|
hegyi@1849
|
356 |
tabs[active_tab]->gd_canvas->zoom100();
|
hegyi@1838
|
357 |
}
|
hegyi@1837
|
358 |
}
|
hegyi@1838
|
359 |
|
hegyi@1838
|
360 |
void MainWin::createMapWin()
|
hegyi@1838
|
361 |
{
|
hegyi@1849
|
362 |
if(active_tab!=-1)
|
hegyi@1838
|
363 |
{
|
hegyi@1849
|
364 |
tabs[active_tab]->createMapWin(tabnames[active_tab]);
|
hegyi@1838
|
365 |
}
|
hegyi@1838
|
366 |
}
|
hegyi@1838
|
367 |
|
hegyi@1849
|
368 |
void MainWin::changeEditorialTool(int tool)
|
hegyi@1838
|
369 |
{
|
hegyi@1849
|
370 |
active_tool=tool;
|
hegyi@1849
|
371 |
if(active_tab!=-1)
|
hegyi@1849
|
372 |
{
|
hegyi@1849
|
373 |
tabs[active_tab]->gd_canvas->changeEditorialTool(tool);
|
hegyi@1849
|
374 |
}
|
hegyi@1838
|
375 |
}
|
hegyi@1849
|
376 |
|
hegyi@1849
|
377 |
void MainWin::createNewMapWin()
|
hegyi@1849
|
378 |
{
|
hegyi@1849
|
379 |
if(active_tab!=-1)
|
hegyi@1849
|
380 |
{
|
hegyi@1849
|
381 |
NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[active_tab], *(tabs[active_tab]));
|
hegyi@1849
|
382 |
nmw->show();
|
hegyi@1849
|
383 |
}
|
hegyi@1849
|
384 |
}
|
hegyi@1849
|
385 |
|
hegyi@1849
|
386 |
void MainWin::createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge)
|
hegyi@1849
|
387 |
{
|
hegyi@1849
|
388 |
std::vector<NoteBookTab*>::iterator nbti=tabs.begin();
|
hegyi@1849
|
389 |
int i=0;
|
hegyi@1849
|
390 |
for(;nbti!=tabs.end();nbti++)
|
hegyi@1849
|
391 |
{
|
hegyi@1849
|
392 |
if(*nbti!=nbt)
|
hegyi@1849
|
393 |
{
|
hegyi@1849
|
394 |
i++;
|
hegyi@1849
|
395 |
}
|
hegyi@1849
|
396 |
else
|
hegyi@1849
|
397 |
{
|
hegyi@1849
|
398 |
continue;
|
hegyi@1849
|
399 |
}
|
hegyi@1849
|
400 |
}
|
hegyi@1849
|
401 |
NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[i], *nbt, itisedge, false);
|
hegyi@1849
|
402 |
nmw->run();
|
hegyi@1849
|
403 |
}
|