COIN-OR::LEMON - Graph Library

source: glemon-0.x/main_win.cc @ 184:4e8704aae278

Last change on this file since 184:4e8704aae278 was 184:4e8704aae278, checked in by Akos Ladanyi, 17 years ago

Added support for setting the background form an image file.

File size: 17.4 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 "main_win.h"
[100]24#include "guipixbufs.h"
[184]25#include "background_chooser_dialog.h"
[6]26
[133]27#include "i18n.h"
[130]28
[96]29MainWin::MainWin()
[6]30{
[96]31  set_title ("no file");
[6]32  set_default_size(WIN_WIDTH,WIN_HEIGHT);
[154]33  //add(vbox);
34  add(table);
[6]35
[60]36  // custom icons for the toolbar
37  Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
38 
[61]39  Glib::RefPtr<Gdk::Pixbuf> p_move_pixbuf = Gdk::Pixbuf::create_from_inline(
40      2328, gui_icons_move);
41  Glib::RefPtr<Gdk::Pixbuf> p_addnode_pixbuf = Gdk::Pixbuf::create_from_inline(
42      2328, gui_icons_addnode);
43  Glib::RefPtr<Gdk::Pixbuf> p_addlink_pixbuf = Gdk::Pixbuf::create_from_inline(
44      2328, gui_icons_addlink);
45  Glib::RefPtr<Gdk::Pixbuf> p_delete_pixbuf = Gdk::Pixbuf::create_from_inline(
46      2328, gui_icons_delete);
47  Glib::RefPtr<Gdk::Pixbuf> p_editlink_pixbuf = Gdk::Pixbuf::create_from_inline(
48      2328, gui_icons_editlink);
49  Glib::RefPtr<Gdk::Pixbuf> p_newmap_pixbuf = Gdk::Pixbuf::create_from_inline(
50      2328, gui_icons_newmap);
[60]51
52  Gtk::IconSource move_icon_source;
[61]53  move_icon_source.set_pixbuf(p_move_pixbuf);
[60]54  Gtk::IconSet move_icon_set;
55  move_icon_set.add_source(move_icon_source);
56  p_icon_factory->add(Gtk::StockID("gd-move"), move_icon_set);
57
58  Gtk::IconSource addnode_icon_source;
[61]59  addnode_icon_source.set_pixbuf(p_addnode_pixbuf);
[60]60  Gtk::IconSet addnode_icon_set;
61  addnode_icon_set.add_source(addnode_icon_source);
62  p_icon_factory->add(Gtk::StockID("gd-addnode"), addnode_icon_set);
63
64  Gtk::IconSource addlink_icon_source;
[61]65  addlink_icon_source.set_pixbuf(p_addlink_pixbuf);
[60]66  Gtk::IconSet addlink_icon_set;
67  addlink_icon_set.add_source(addlink_icon_source);
68  p_icon_factory->add(Gtk::StockID("gd-addlink"), addlink_icon_set);
69
70  Gtk::IconSource delete_icon_source;
[61]71  delete_icon_source.set_pixbuf(p_delete_pixbuf);
[60]72  Gtk::IconSet delete_icon_set;
73  delete_icon_set.add_source(delete_icon_source);
74  p_icon_factory->add(Gtk::StockID("gd-delete"), delete_icon_set);
75
76  Gtk::IconSource editlink_icon_source;
[61]77  editlink_icon_source.set_pixbuf(p_editlink_pixbuf);
[60]78  Gtk::IconSet editlink_icon_set;
79  editlink_icon_set.add_source(editlink_icon_source);
80  p_icon_factory->add(Gtk::StockID("gd-editlink"), editlink_icon_set);
81
82  Gtk::IconSource newmap_icon_source;
[61]83  newmap_icon_source.set_pixbuf(p_newmap_pixbuf);
[60]84  Gtk::IconSet newmap_icon_set;
85  newmap_icon_set.add_source(newmap_icon_source);
86  p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set);
87
88  p_icon_factory->add_default();
89 
[6]90  ag=Gtk::ActionGroup::create();
91
[130]92  ag->add( Gtk::Action::create("FileMenu", _("_File")) );
[102]93  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
[96]94      sigc::mem_fun(*this, &MainWin::newTab));
[6]95  ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
96      sigc::mem_fun(*this, &MainWin::openFile));
[130]97  ag->add( Gtk::Action::create("FileClearTab", _("Clear Tab")),
[102]98      sigc::mem_fun(*this, &MainWin::newFile));
[6]99  ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
100      sigc::mem_fun(*this, &MainWin::saveFile));
101  ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
102      sigc::mem_fun(*this, &MainWin::saveFileAs));
[53]103  ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE),
[102]104      sigc::mem_fun(*this, &MainWin::closeTab));
[53]105  ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT),
[47]106      sigc::mem_fun(*this, &MainWin::hide));
[6]107
[130]108  ag->add( Gtk::Action::create("ViewMenu", _("_View")) );
[6]109  ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
[96]110      sigc::mem_fun(*this, &MainWin::zoomIn));
[6]111  ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
[96]112      sigc::mem_fun(*this, &MainWin::zoomOut));
[6]113  ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
[96]114      sigc::mem_fun(*this, &MainWin::zoomFit));
[6]115  ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
[96]116      sigc::mem_fun(*this, &MainWin::zoom100));
[184]117  ag->add( Gtk::Action::create("SetBackground", _("Set Background...")),
118            sigc::mem_fun(*this, &MainWin::createBackgroundChooser));
[6]119 
[130]120  ag->add( Gtk::Action::create("ShowMenu", _("_Show")) );
121  ag->add( Gtk::Action::create("ShowMaps", _("_Maps")),
[95]122           sigc::mem_fun(*this, &MainWin::createMapWin));
[160]123  ag->add( Gtk::Action::create("ShowDesign", _("_Design")),
124           sigc::mem_fun(*this, &MainWin::createDesignWin));
[6]125
[130]126  ag->add( Gtk::Action::create("AlgoMenu", _("_Algorithms")) );
127  ag->add( Gtk::Action::create("AlgoGeneral", _("_General")),
[103]128           sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 0) );
[130]129  ag->add( Gtk::Action::create("AlgoKruskal", _("_Kruskal")),
[106]130           sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 1) );
[162]131  ag->add( Gtk::Action::create("AlgoDijkstra", _("_Dijkstra")),
132           sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 2) );
[165]133  ag->add( Gtk::Action::create("AlgoSuurballe", _("_Suurballe")),
134           sigc::bind( sigc::mem_fun ( *this, &MainWin::createAlgoWin ), 3) );
[103]135
[53]136  Gtk::RadioAction::Group tool_group;
[130]137  ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), _("Move")),
[96]138      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 0) );
[130]139  ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), _("Create node")),
[96]140      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 1) );
[130]141  ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), _("Create edge")),
[96]142      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 2) );
[130]143  ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), _("Delete")),
[96]144      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 3) );
[60]145
[130]146  ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), _("Edit edge map")),
[96]147      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 4) );
[60]148
149  ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")),
[96]150      sigc::mem_fun ( *this , &MainWin::createNewMapWin ) );
[22]151
[160]152  ag->add( Gtk::Action::create("DesignGraph", Gtk::Stock::REFRESH),
153      sigc::mem_fun ( *this , &MainWin::reDesignGraph ) );
154
[6]155  uim=Gtk::UIManager::create();
156  uim->insert_action_group(ag);
157  add_accel_group(uim->get_accel_group());
158
159  try
160  {
161
162    Glib::ustring ui_info =
163      "<ui>"
164      "  <menubar name='MenuBar'>"
165      "    <menu action='FileMenu'>"
166      "      <menuitem action='FileNew'/>"
167      "      <menuitem action='FileOpen'/>"
[102]168      "      <menuitem action='FileClearTab'/>"
[6]169      "      <menuitem action='FileSave'/>"
170      "      <menuitem action='FileSaveAs'/>"
[53]171      "      <menuitem action='Close'/>"
172      "      <menuitem action='Quit'/>"
[6]173      "    </menu>"
174      "    <menu action='ViewMenu'>"
175      "      <menuitem action='ViewZoomIn' />"
176      "      <menuitem action='ViewZoomOut' />"
177      "      <menuitem action='ViewZoom100' />"
[87]178      "      <menuitem action='ViewZoomFit' />"
[184]179      "      <menuitem action='SetBackground' />"
[6]180      "    </menu>"
181      "    <menu action='ShowMenu'>"
182      "      <menuitem action='ShowMaps'/>"
[160]183      "      <menuitem action='ShowDesign'/>"
[6]184      "    </menu>"
[103]185      "    <menu action='AlgoMenu'>"
186      "      <menuitem action='AlgoGeneral'/>"
[106]187      "      <menuitem action='AlgoKruskal'/>"
[162]188      "      <menuitem action='AlgoDijkstra'/>"
[165]189      "      <menuitem action='AlgoSuurballe'/>"
[103]190      "    </menu>"
[6]191      "  </menubar>"
192      "  <toolbar name='ToolBar'>"
193      "    <toolitem action='FileNew' />"
194      "    <toolitem action='FileOpen' />"
195      "    <toolitem action='FileSave' />"
[53]196      "    <toolitem action='Close' />"
[6]197      "    <separator />"
198      "    <toolitem action='ViewZoomIn' />"
199      "    <toolitem action='ViewZoomOut' />"
200      "    <toolitem action='ViewZoom100' />"
[87]201      "    <toolitem action='ViewZoomFit' />"
[22]202      "    <separator />"
[53]203      "    <toolitem action='MoveItem' />"
[22]204      "    <toolitem action='CreateNode' />"
205      "    <toolitem action='CreateEdge' />"
206      "    <toolitem action='EraseItem' />"
[32]207      "    <toolitem action='EditEdgeMap' />"
[60]208      "    <separator />"
[41]209      "    <toolitem action='AddMap' />"
[160]210      "    <toolitem action='DesignGraph' />"
[6]211      "  </toolbar>"
212      "</ui>";
213
214    uim->add_ui_from_string(ui_info);
215
216  }
217  catch(const Glib::Error& ex)
218  {
219    std::cerr << "building menus failed: " <<  ex.what();
220  }
221
222  Gtk::Widget* menubar = uim->get_widget("/MenuBar");
223  if (menubar){
[154]224    //vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
225    table.attach(*menubar, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
[6]226  }
227
228  Gtk::Widget* toolbar = uim->get_widget("/ToolBar");
229  if (toolbar)
230  {
231    static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS);
[154]232    //hbox.pack_start(*toolbar, Gtk::PACK_EXPAND_WIDGET);
233
234    table.attach(*toolbar, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
235
[6]236  }
[156]237 
[154]238  table2.set_row_spacings(10);
239  table2.set_col_spacings(5);
240
[156]241  auto_scale = new Gtk::CheckButton("Autoscale");
242  auto_scale->set_active(false);
243  auto_scale->signal_toggled().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));
[154]244  table2.attach(*auto_scale, 0,2,0,1);
[156]245
[157]246  Gtk::Label * width_label= new Gtk::Label("Edge Width:");
247  table2.attach(*width_label, 0,1,1,2);
[154]248 
[157]249  Gtk::Adjustment * adjustment_width=new Gtk::Adjustment(20, 1, 200, 5, 10);
250 
251  edge_width = new Gtk::SpinButton(*adjustment_width, 5,0);
252  edge_width->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));
253  table2.attach(*edge_width, 1,2,1,2);
[154]254
[157]255  Gtk::Label * radius_label= new Gtk::Label("Node Radius:");
256  table2.attach(*radius_label, 2,3,1,2);
257 
258  Gtk::Adjustment * adjustment_radius=new Gtk::Adjustment(20, 0, 500, 5, 10);
[154]259
[157]260  radius_size = new Gtk::SpinButton(*adjustment_radius, 5,0);
261  radius_size->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));
262  table2.attach(*radius_size, 3,4,1,2);
[154]263
[156]264  zoom_track = new Gtk::CheckButton("Zoom tracking");
265  zoom_track->set_active(false);
266  zoom_track->signal_toggled().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));
267  table2.attach(*zoom_track, 2,4,0,1);
268
269
[154]270  table.attach(table2, 1, 2, 0, 2, Gtk::SHRINK, Gtk::SHRINK);
271
[50]272  tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node");
273  tooltips.enable();
[6]274
[96]275  active_tab=-1;
276  notebook.signal_switch_page().connect(sigc::mem_fun(*this, &MainWin::onChangeTab));
277
[107]278  active_tool = MOVE;
279
[154]280  table.attach(notebook,0,2,2,3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL);
[96]281 
[6]282  show_all_children();
283}
284
[96]285void MainWin::set_tabtitle(std::string name)
[57]286{
[104]287  if(strinst.find(name)==strinst.end())
288    {
289      tabnames[active_tab]=name;
290      strinst[name]=1;
291    }
292  else
293    {
294      strinst[name]++;
295      std::ostringstream o;
296      o << strinst[name];
297      tabnames[active_tab]=name+" - "+o.str();
298    }
[96]299  set_title(tabnames[active_tab] + " - " + prog_name);
300  notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
[106]301  updateAlgoWinTabs();
[96]302}
303
304void MainWin::readFile(const std::string & filename)
305{
306  newTab();
307  tabs[active_tab]->readFile(filename);
308}
309
310void MainWin::newTab()
311{
312  int size=tabs.size();
313  tabs.resize(size+1);
314  tabnames.resize(size+1);
315  active_tab=size;
316  tabs[active_tab]=new NoteBookTab();
317  tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
318  tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
319  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
320  notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
321  notebook.set_current_page(size);
[130]322  set_tabtitle(_("unsaved file"));
[106]323  updateAlgoWinTabs();
[96]324}
325
[97]326void MainWin::closeTab()
327{
328  if(active_tab!=-1)
329    {
[102]330      if (tabs[active_tab]->mapstorage.modified)
331        {
[130]332          Gtk::MessageDialog mdialog(_("<b>Save changes before closing?</b>"), true,
[102]333                                     Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
[130]334          mdialog.add_button(_("Close file _without Saving"), Gtk::RESPONSE_REJECT);
[102]335          mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
336          mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
337          switch (mdialog.run())
338            {
339            case Gtk::RESPONSE_CANCEL:
340              return;
341            case Gtk::RESPONSE_REJECT:
342              break;
343            case Gtk::RESPONSE_ACCEPT:
344              tabs[active_tab]->saveFile();
345              break;
346            }
347        }
[97]348      //tabs vector will be decreased with the deleted value
349      int size=tabs.size();
350      if(size>1)
351        {
352          for(int i=active_tab+1;i<size;i++)
353            {
[103]354              tabnames[i-1]=tabnames[i];
[97]355              tabs[i-1]=tabs[i];
356            }
357        }
358      //if size==1 resize will delete the only element
359      tabs.resize(size-1);
[103]360      tabnames.resize(size-1);
[97]361
362      int old_active_tab=active_tab;
363      notebook.remove_page(active_tab);
364
365      //If the first tab was active, upon delete notebook
366      //will first switch one tab upper and not lower like
367      //in the case, when not the first tab was active.
368      //But after deletion it will become the first tab,
369      //and this should be registrated in tabs vector,
370      //as well.
[103]371      if((old_active_tab==0)&&(size!=1))
[97]372        {
373          onChangeTab(NULL,0);
374        }
375
376      //if this was the last page in notebook, there is
377      //no active_tab now
378      if(size==1)
379        {
380          active_tab=-1;
381        }
[103]382
[106]383      updateAlgoWinTabs();
[97]384    }
385}
386
[96]387void MainWin::onChangeTab(GtkNotebookPage* page, guint page_num)
388{
389  page=page;
390  active_tab=page_num;
391  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
392  set_title(tabnames[active_tab]);
[154]393  bool autoscale;
[156]394  bool zoomtrack;
[157]395  double width;
396  double radius;
397  tabs[active_tab]->getView(autoscale, zoomtrack, width, radius);
398  edge_width->set_value(width);
399  radius_size->set_value(radius);
[156]400  zoom_track->set_active(zoomtrack);
[154]401  auto_scale->set_active(autoscale);
402
[96]403}
404
[6]405void MainWin::newFile()
406{
[96]407  if(active_tab!=-1)
[53]408    {
[96]409      tabs[active_tab]->newFile();
[53]410    }
[6]411}
[96]412 
[6]413void MainWin::openFile()
414{
[140]415  if(active_tab==-1)
[53]416    {
[140]417      newTab();
[53]418    }
[140]419  tabs[active_tab]->openFile();
[6]420}
[96]421 
[6]422void MainWin::saveFile()
423{
[96]424  if(active_tab!=-1)
425    {
426      tabs[active_tab]->saveFile();
427    }
[6]428}
[96]429 
[6]430void MainWin::saveFileAs()
431{
[96]432  if(active_tab!=-1)
433    {
434      tabs[active_tab]->saveFileAs();
435    }
[6]436}
[96]437 
[53]438void MainWin::close()
439{
[96]440  if(active_tab!=-1)
[53]441    {
[96]442      tabs[active_tab]->close();
[95]443    }
[94]444}
445
[96]446void MainWin::zoomIn()
[94]447{
[96]448  if(active_tab!=-1)
[95]449    {
[96]450      tabs[active_tab]->gd_canvas->zoomIn();
451    }
452}
453
454void MainWin::zoomOut()
455{
456  if(active_tab!=-1)
457    {
458      tabs[active_tab]->gd_canvas->zoomOut();
459    }
460}
461
462void MainWin::zoomFit()
463{
464  if(active_tab!=-1)
465    {
466      tabs[active_tab]->gd_canvas->zoomFit();
467    }
468}
469
470void MainWin::zoom100()
471{
472  if(active_tab!=-1)
473    {
474      tabs[active_tab]->gd_canvas->zoom100();
[95]475    }
[94]476}
[95]477
478void MainWin::createMapWin()
479{
[96]480  if(active_tab!=-1)
[95]481    {
[96]482      tabs[active_tab]->createMapWin(tabnames[active_tab]);
[95]483    }
484}
485
[160]486void MainWin::createDesignWin()
487{
488  if(active_tab!=-1)
489    {
490      tabs[active_tab]->createDesignWin(tabnames[active_tab]);
491    }
492}
493
[103]494void MainWin::createAlgoWin(int algoid)
495{
[108]496  AlgoWin * aw=new AlgoWin(algoid, tabnames);
[103]497  aw->signal_closing().connect(sigc::mem_fun(*this, &MainWin::deRegisterAlgoWin));
[106]498  aw->signal_maplist_needed().connect(sigc::mem_fun(*this, &MainWin::updateAlgoWinMaps));
[114]499  aw->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinTabString));
[103]500  aws.insert(aw);
501  aw->show();
502}
503
[106]504void MainWin::updateAlgoWinTabs()
[103]505{
506  std::set< AlgoWin* >::iterator awsi=aws.begin();
507  for(;awsi!=aws.end();awsi++)
508    {
509      (*awsi)->update_tablist(tabnames);
510    }
511}
512
[108]513void MainWin::updateAlgoWinMaps(AlgoWin * awp, std::string tabname)
514{
515  int i=0;
516  for(;(i<(int)tabnames.size())&&(tabnames[i]!=tabname);i++)
517    {
518    }
519  awp->update_maplist(&(tabs[i]->mapstorage));
520}
521
522void MainWin::deRegisterAlgoWin(AlgoWin * awp)
523{
524  aws.erase(awp);
525}
526
[96]527void MainWin::changeEditorialTool(int tool)
[95]528{
[96]529  active_tool=tool;
530  if(active_tab!=-1)
531    {
532      tabs[active_tab]->gd_canvas->changeEditorialTool(tool);
533    }
[95]534}
[96]535
536void MainWin::createNewMapWin()
537{
538  if(active_tab!=-1)
539    {
[130]540      NewMapWin * nmw=new NewMapWin(_("Create New Map - ")+tabnames[active_tab], *(tabs[active_tab]));
[96]541      nmw->show();
542    }
543}
544
[114]545void MainWin::createNewMapWinTabString(std::string tabname, bool itisedge)
546{
547  int i=0;
[120]548  for(;((i<(int)tabnames.size())&&(tabnames[i]!=tabname));i++)
[114]549    {
550    }
551  createNewMapWinAfterSignal(tabs[i], itisedge);
552}
553
[96]554void MainWin::createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge)
555{
556  std::vector<NoteBookTab*>::iterator nbti=tabs.begin();
557  int i=0;
558  for(;nbti!=tabs.end();nbti++)
559    {
560      if(*nbti!=nbt)
561        {
562          i++;
563        }
564      else
565        {
566          continue;
567        }
568    }
[130]569  NewMapWin * nmw=new NewMapWin(_("Create New Map - ")+tabnames[i], *nbt, itisedge, false);
[96]570  nmw->run();
571}
[154]572
573
574void MainWin::nodeViewChanged()
575{
[157]576  double width=edge_width->get_value();
577  double radius=radius_size->get_value();
[156]578  bool zoomtrack=zoom_track->get_active();
[154]579  bool autoscale=auto_scale->get_active();
[157]580  tabs[active_tab]->setView(autoscale, zoomtrack, width, radius);
[154]581}
[160]582
583void MainWin::reDesignGraph()
584{
585  tabs[active_tab]->reDesignGraph();
586}
[184]587
588void MainWin::createBackgroundChooser()
589{
590  BackgroundChooserDialog dialog(&(tabs[active_tab]->mapstorage));
591  dialog.run();
592}
Note: See TracBrowser for help on using the repository browser.