gui/main_win.cc
author deba
Tue, 03 Jan 2006 16:05:27 +0000
changeset 1870 b9c9b52f839e
parent 1862 d47ebd34e581
child 1871 3905d347112c
permissions -rw-r--r--
Delete misnamed file
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@1869
    75
  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
hegyi@1849
    76
      sigc::mem_fun(*this, &MainWin::newTab));
ladanyi@1442
    77
  ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
ladanyi@1442
    78
      sigc::mem_fun(*this, &MainWin::openFile));
hegyi@1869
    79
  ag->add( Gtk::Action::create("FileClearTab", "Clear Tab"),
hegyi@1869
    80
      sigc::mem_fun(*this, &MainWin::newFile));
ladanyi@1442
    81
  ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
ladanyi@1442
    82
      sigc::mem_fun(*this, &MainWin::saveFile));
ladanyi@1442
    83
  ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
ladanyi@1442
    84
      sigc::mem_fun(*this, &MainWin::saveFileAs));
ladanyi@1606
    85
  ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE),
hegyi@1869
    86
      sigc::mem_fun(*this, &MainWin::closeTab));
ladanyi@1606
    87
  ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT),
hegyi@1598
    88
      sigc::mem_fun(*this, &MainWin::hide));
ladanyi@1442
    89
ladanyi@1442
    90
  ag->add( Gtk::Action::create("ViewMenu", "_View") );
ladanyi@1442
    91
  ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
hegyi@1849
    92
      sigc::mem_fun(*this, &MainWin::zoomIn));
ladanyi@1442
    93
  ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
hegyi@1849
    94
      sigc::mem_fun(*this, &MainWin::zoomOut));
ladanyi@1442
    95
  ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
hegyi@1849
    96
      sigc::mem_fun(*this, &MainWin::zoomFit));
ladanyi@1442
    97
  ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
hegyi@1849
    98
      sigc::mem_fun(*this, &MainWin::zoom100));
ladanyi@1442
    99
  
ladanyi@1442
   100
  ag->add( Gtk::Action::create("ShowMenu", "_Show") );
ladanyi@1442
   101
  ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
hegyi@1838
   102
	   sigc::mem_fun(*this, &MainWin::createMapWin));
ladanyi@1442
   103
ladanyi@1606
   104
  Gtk::RadioAction::Group tool_group;
ladanyi@1634
   105
  ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), "Move"),
hegyi@1849
   106
      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 0) );
ladanyi@1634
   107
  ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), "Create node"),
hegyi@1849
   108
      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 1) );
ladanyi@1634
   109
  ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), "Create edge"),
hegyi@1849
   110
      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 2) );
ladanyi@1634
   111
  ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), "Delete"),
hegyi@1849
   112
      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 3) );
ladanyi@1634
   113
ladanyi@1634
   114
  ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), "Edit edge map"),
hegyi@1849
   115
      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 4) );
ladanyi@1634
   116
  ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), "Edit node map"),
hegyi@1849
   117
      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 5) );
ladanyi@1634
   118
ladanyi@1634
   119
  ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")),
hegyi@1849
   120
      sigc::mem_fun ( *this , &MainWin::createNewMapWin ) );
hegyi@1502
   121
ladanyi@1442
   122
  uim=Gtk::UIManager::create();
ladanyi@1442
   123
  uim->insert_action_group(ag);
ladanyi@1442
   124
  add_accel_group(uim->get_accel_group());
ladanyi@1442
   125
ladanyi@1442
   126
  try
ladanyi@1442
   127
  {
ladanyi@1442
   128
ladanyi@1442
   129
    Glib::ustring ui_info =
ladanyi@1442
   130
      "<ui>"
ladanyi@1442
   131
      "  <menubar name='MenuBar'>"
ladanyi@1442
   132
      "    <menu action='FileMenu'>"
ladanyi@1442
   133
      "      <menuitem action='FileNew'/>"
ladanyi@1442
   134
      "      <menuitem action='FileOpen'/>"
hegyi@1869
   135
      "      <menuitem action='FileClearTab'/>"
ladanyi@1442
   136
      "      <menuitem action='FileSave'/>"
ladanyi@1442
   137
      "      <menuitem action='FileSaveAs'/>"
ladanyi@1606
   138
      "      <menuitem action='Close'/>"
ladanyi@1606
   139
      "      <menuitem action='Quit'/>"
ladanyi@1442
   140
      "    </menu>"
ladanyi@1442
   141
      "    <menu action='ViewMenu'>"
ladanyi@1442
   142
      "      <menuitem action='ViewZoomIn' />"
ladanyi@1442
   143
      "      <menuitem action='ViewZoomOut' />"
ladanyi@1442
   144
      "      <menuitem action='ViewZoom100' />"
ladanyi@1777
   145
      "      <menuitem action='ViewZoomFit' />"
ladanyi@1442
   146
      "    </menu>"
ladanyi@1442
   147
      "    <menu action='ShowMenu'>"
ladanyi@1442
   148
      "      <menuitem action='ShowMaps'/>"
ladanyi@1442
   149
      "    </menu>"
ladanyi@1442
   150
      "  </menubar>"
ladanyi@1442
   151
      "  <toolbar name='ToolBar'>"
ladanyi@1442
   152
      "    <toolitem action='FileNew' />"
ladanyi@1442
   153
      "    <toolitem action='FileOpen' />"
ladanyi@1442
   154
      "    <toolitem action='FileSave' />"
ladanyi@1606
   155
      "    <toolitem action='Close' />"
ladanyi@1442
   156
      "    <separator />"
ladanyi@1442
   157
      "    <toolitem action='ViewZoomIn' />"
ladanyi@1442
   158
      "    <toolitem action='ViewZoomOut' />"
ladanyi@1442
   159
      "    <toolitem action='ViewZoom100' />"
ladanyi@1777
   160
      "    <toolitem action='ViewZoomFit' />"
hegyi@1502
   161
      "    <separator />"
ladanyi@1606
   162
      "    <toolitem action='MoveItem' />"
hegyi@1502
   163
      "    <toolitem action='CreateNode' />"
hegyi@1502
   164
      "    <toolitem action='CreateEdge' />"
hegyi@1502
   165
      "    <toolitem action='EraseItem' />"
hegyi@1550
   166
      "    <toolitem action='EditEdgeMap' />"
hegyi@1550
   167
      "    <toolitem action='EditNodeMap' />"
ladanyi@1634
   168
      "    <separator />"
hegyi@1592
   169
      "    <toolitem action='AddMap' />"
ladanyi@1442
   170
      "  </toolbar>"
ladanyi@1442
   171
      "</ui>";
ladanyi@1442
   172
ladanyi@1442
   173
    uim->add_ui_from_string(ui_info);
ladanyi@1442
   174
ladanyi@1442
   175
  }
ladanyi@1442
   176
  catch(const Glib::Error& ex)
ladanyi@1442
   177
  {
ladanyi@1442
   178
    std::cerr << "building menus failed: " <<  ex.what();
ladanyi@1442
   179
  }
ladanyi@1442
   180
ladanyi@1442
   181
  Gtk::Widget* menubar = uim->get_widget("/MenuBar");
ladanyi@1442
   182
  if (menubar){
ladanyi@1442
   183
    vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
ladanyi@1442
   184
  }
ladanyi@1442
   185
ladanyi@1442
   186
  Gtk::Widget* toolbar = uim->get_widget("/ToolBar");
ladanyi@1442
   187
  if (toolbar)
ladanyi@1442
   188
  {
ladanyi@1442
   189
    static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS);
ladanyi@1442
   190
    vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
ladanyi@1442
   191
  }
ladanyi@1442
   192
hegyi@1601
   193
  tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node");
hegyi@1601
   194
  tooltips.enable();
ladanyi@1442
   195
hegyi@1849
   196
  active_tab=-1;
hegyi@1849
   197
  notebook.signal_switch_page().connect(sigc::mem_fun(*this, &MainWin::onChangeTab));
hegyi@1849
   198
hegyi@1849
   199
  vbox.pack_start(notebook);
hegyi@1849
   200
  
ladanyi@1442
   201
  show_all_children();
ladanyi@1442
   202
}
ladanyi@1442
   203
hegyi@1849
   204
void MainWin::set_tabtitle(std::string name)
ladanyi@1616
   205
{
hegyi@1849
   206
  tabnames[active_tab]=name;
hegyi@1849
   207
  set_title(tabnames[active_tab] + " - " + prog_name);
hegyi@1849
   208
  notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
hegyi@1849
   209
}
hegyi@1849
   210
hegyi@1849
   211
void MainWin::readFile(const std::string & filename)
hegyi@1849
   212
{
hegyi@1849
   213
  newTab();
hegyi@1849
   214
  tabs[active_tab]->readFile(filename);
hegyi@1849
   215
}
hegyi@1849
   216
hegyi@1849
   217
void MainWin::newTab()
hegyi@1849
   218
{
hegyi@1849
   219
  int size=tabs.size();
hegyi@1849
   220
  tabs.resize(size+1);
hegyi@1849
   221
  tabnames.resize(size+1);
hegyi@1849
   222
  active_tab=size;
hegyi@1849
   223
  tabs[active_tab]=new NoteBookTab();
hegyi@1849
   224
  tabnames[active_tab]="unsaved file";
hegyi@1849
   225
  tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
hegyi@1849
   226
  tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
hegyi@1849
   227
  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
hegyi@1849
   228
  notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
hegyi@1849
   229
  notebook.set_current_page(size);
hegyi@1849
   230
  set_tabtitle(tabnames[active_tab]);
hegyi@1849
   231
}
hegyi@1849
   232
hegyi@1856
   233
void MainWin::closeTab()
hegyi@1856
   234
{
hegyi@1856
   235
  if(active_tab!=-1)
hegyi@1856
   236
    {
hegyi@1869
   237
      if (tabs[active_tab]->mapstorage.modified)
hegyi@1869
   238
	{
hegyi@1869
   239
	  Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, 
hegyi@1869
   240
				     Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
hegyi@1869
   241
	  mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
hegyi@1869
   242
	  mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
hegyi@1869
   243
	  mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
hegyi@1869
   244
	  switch (mdialog.run())
hegyi@1869
   245
	    {
hegyi@1869
   246
	    case Gtk::RESPONSE_CANCEL:
hegyi@1869
   247
	      return;
hegyi@1869
   248
	    case Gtk::RESPONSE_REJECT:
hegyi@1869
   249
	      break;
hegyi@1869
   250
	    case Gtk::RESPONSE_ACCEPT:
hegyi@1869
   251
	      tabs[active_tab]->saveFile();
hegyi@1869
   252
	      break;
hegyi@1869
   253
	    }
hegyi@1869
   254
	}
hegyi@1856
   255
      //tabs vector will be decreased with the deleted value
hegyi@1856
   256
      int size=tabs.size();
hegyi@1856
   257
      if(size>1)
hegyi@1856
   258
	{
hegyi@1856
   259
	  for(int i=active_tab+1;i<size;i++)
hegyi@1856
   260
	    {
hegyi@1856
   261
	      tabs[i-1]=tabs[i];
hegyi@1856
   262
	    }
hegyi@1856
   263
	}
hegyi@1856
   264
hegyi@1856
   265
      //if size==1 resize will delete the only element
hegyi@1856
   266
      tabs.resize(size-1);
hegyi@1856
   267
hegyi@1856
   268
      int old_active_tab=active_tab;
hegyi@1856
   269
      notebook.remove_page(active_tab);
hegyi@1856
   270
hegyi@1856
   271
      //If the first tab was active, upon delete notebook
hegyi@1856
   272
      //will first switch one tab upper and not lower like
hegyi@1856
   273
      //in the case, when not the first tab was active.
hegyi@1856
   274
      //But after deletion it will become the first tab,
hegyi@1856
   275
      //and this should be registrated in tabs vector,
hegyi@1856
   276
      //as well.
hegyi@1856
   277
      if(old_active_tab==0)
hegyi@1856
   278
	{
hegyi@1856
   279
	  onChangeTab(NULL,0);
hegyi@1856
   280
	}
hegyi@1856
   281
hegyi@1856
   282
      //if this was the last page in notebook, there is
hegyi@1856
   283
      //no active_tab now
hegyi@1856
   284
      if(size==1)
hegyi@1856
   285
	{
hegyi@1856
   286
	  active_tab=-1;
hegyi@1856
   287
	}
hegyi@1856
   288
    }
hegyi@1856
   289
}
hegyi@1856
   290
hegyi@1849
   291
void MainWin::onChangeTab(GtkNotebookPage* page, guint page_num)
hegyi@1849
   292
{
hegyi@1849
   293
  page=page;
hegyi@1849
   294
  active_tab=page_num;
hegyi@1849
   295
  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
hegyi@1849
   296
  set_title(tabnames[active_tab]);
hegyi@1849
   297
}
hegyi@1849
   298
hegyi@1849
   299
void MainWin::onCloseTab()
hegyi@1849
   300
{
ladanyi@1616
   301
}
ladanyi@1616
   302
ladanyi@1442
   303
void MainWin::newFile()
ladanyi@1442
   304
{
hegyi@1849
   305
  if(active_tab!=-1)
ladanyi@1606
   306
    {
hegyi@1849
   307
      tabs[active_tab]->newFile();
ladanyi@1606
   308
    }
ladanyi@1442
   309
}
hegyi@1849
   310
 
ladanyi@1442
   311
void MainWin::openFile()
ladanyi@1442
   312
{
hegyi@1849
   313
  if(active_tab!=-1)
ladanyi@1606
   314
    {
hegyi@1849
   315
      tabs[active_tab]->openFile();
ladanyi@1606
   316
    }
ladanyi@1442
   317
}
hegyi@1849
   318
 
ladanyi@1442
   319
void MainWin::saveFile()
ladanyi@1442
   320
{
hegyi@1849
   321
  if(active_tab!=-1)
hegyi@1849
   322
    {
hegyi@1849
   323
      tabs[active_tab]->saveFile();
hegyi@1849
   324
    }
ladanyi@1442
   325
}
hegyi@1849
   326
 
ladanyi@1442
   327
void MainWin::saveFileAs()
ladanyi@1442
   328
{
hegyi@1849
   329
  if(active_tab!=-1)
hegyi@1849
   330
    {
hegyi@1849
   331
      tabs[active_tab]->saveFileAs();
hegyi@1849
   332
    }
ladanyi@1442
   333
}
hegyi@1849
   334
 
ladanyi@1606
   335
void MainWin::close()
ladanyi@1606
   336
{
hegyi@1849
   337
  if(active_tab!=-1)
ladanyi@1606
   338
    {
hegyi@1849
   339
      tabs[active_tab]->close();
hegyi@1838
   340
    }
hegyi@1837
   341
}
hegyi@1837
   342
hegyi@1849
   343
void MainWin::zoomIn()
hegyi@1837
   344
{
hegyi@1849
   345
  if(active_tab!=-1)
hegyi@1838
   346
    {
hegyi@1849
   347
      tabs[active_tab]->gd_canvas->zoomIn();
hegyi@1849
   348
    }
hegyi@1849
   349
}
hegyi@1849
   350
hegyi@1849
   351
void MainWin::zoomOut()
hegyi@1849
   352
{
hegyi@1849
   353
  if(active_tab!=-1)
hegyi@1849
   354
    {
hegyi@1849
   355
      tabs[active_tab]->gd_canvas->zoomOut();
hegyi@1849
   356
    }
hegyi@1849
   357
}
hegyi@1849
   358
hegyi@1849
   359
void MainWin::zoomFit()
hegyi@1849
   360
{
hegyi@1849
   361
  if(active_tab!=-1)
hegyi@1849
   362
    {
hegyi@1849
   363
      tabs[active_tab]->gd_canvas->zoomFit();
hegyi@1849
   364
    }
hegyi@1849
   365
}
hegyi@1849
   366
hegyi@1849
   367
void MainWin::zoom100()
hegyi@1849
   368
{
hegyi@1849
   369
  if(active_tab!=-1)
hegyi@1849
   370
    {
hegyi@1849
   371
      tabs[active_tab]->gd_canvas->zoom100();
hegyi@1838
   372
    }
hegyi@1837
   373
}
hegyi@1838
   374
hegyi@1838
   375
void MainWin::createMapWin()
hegyi@1838
   376
{
hegyi@1849
   377
  if(active_tab!=-1)
hegyi@1838
   378
    {
hegyi@1849
   379
      tabs[active_tab]->createMapWin(tabnames[active_tab]);
hegyi@1838
   380
    }
hegyi@1838
   381
}
hegyi@1838
   382
hegyi@1849
   383
void MainWin::changeEditorialTool(int tool)
hegyi@1838
   384
{
hegyi@1849
   385
  active_tool=tool;
hegyi@1849
   386
  if(active_tab!=-1)
hegyi@1849
   387
    {
hegyi@1849
   388
      tabs[active_tab]->gd_canvas->changeEditorialTool(tool);
hegyi@1849
   389
    }
hegyi@1838
   390
}
hegyi@1849
   391
hegyi@1849
   392
void MainWin::createNewMapWin()
hegyi@1849
   393
{
hegyi@1849
   394
  if(active_tab!=-1)
hegyi@1849
   395
    {
hegyi@1849
   396
      NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[active_tab], *(tabs[active_tab]));
hegyi@1849
   397
      nmw->show();
hegyi@1849
   398
    }
hegyi@1849
   399
}
hegyi@1849
   400
hegyi@1849
   401
void MainWin::createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge)
hegyi@1849
   402
{
hegyi@1849
   403
  std::vector<NoteBookTab*>::iterator nbti=tabs.begin();
hegyi@1849
   404
  int i=0;
hegyi@1849
   405
  for(;nbti!=tabs.end();nbti++)
hegyi@1849
   406
    {
hegyi@1849
   407
      if(*nbti!=nbt)
hegyi@1849
   408
	{
hegyi@1849
   409
	  i++;
hegyi@1849
   410
	}
hegyi@1849
   411
      else
hegyi@1849
   412
	{
hegyi@1849
   413
	  continue;
hegyi@1849
   414
	}
hegyi@1849
   415
    }
hegyi@1849
   416
  NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[i], *nbt, itisedge, false);
hegyi@1849
   417
  nmw->run();
hegyi@1849
   418
}