/[svn]/gigedit/trunk/src/gigedit/mainwindow.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/mainwindow.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2466 by schoenebeck, Thu Sep 5 03:02:48 2013 UTC revision 2610 by schoenebeck, Sun Jun 8 19:09:26 2014 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2013 Andreas Persson   * Copyright (C) 2006-2014 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 40  Line 40 
40    
41  #include <stdio.h>  #include <stdio.h>
42  #include <sndfile.h>  #include <sndfile.h>
43    #include <assert.h>
44    
45  #include "mainwindow.h"  #include "mainwindow.h"
46    #include "Settings.h"
47    #include "CombineInstrumentsDialog.h"
48    #include "scripteditor.h"
49    #include "scriptslots.h"
50  #include "../../gfx/status_attached.xpm"  #include "../../gfx/status_attached.xpm"
51  #include "../../gfx/status_detached.xpm"  #include "../../gfx/status_detached.xpm"
52    
# Line 76  MainWindow::MainWindow() : Line 80  MainWindow::MainWindow() :
80      m_ScrolledWindowSamples.add(m_TreeViewSamples);      m_ScrolledWindowSamples.add(m_TreeViewSamples);
81      m_ScrolledWindowSamples.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);      m_ScrolledWindowSamples.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
82    
83        m_ScrolledWindowScripts.add(m_TreeViewScripts);
84        m_ScrolledWindowScripts.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
85    
86    
87      m_TreeViewNotebook.set_size_request(300);      m_TreeViewNotebook.set_size_request(300);
88    
# Line 89  MainWindow::MainWindow() : Line 96  MainWindow::MainWindow() :
96      dimreg_vbox.pack_start(dimreg_hbox, Gtk::PACK_SHRINK);      dimreg_vbox.pack_start(dimreg_hbox, Gtk::PACK_SHRINK);
97      m_HPaned.add2(dimreg_vbox);      m_HPaned.add2(dimreg_vbox);
98    
99        dimreg_label.set_tooltip_text(_("To automatically apply your changes above globally to the entire instrument, check all 3 check boxes on the right."));
100        dimreg_all_regions.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied to all regions of this instrument as well."));
101        dimreg_all_dimregs.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied as well to all dimension splits of the region selected below."));
102        dimreg_stereo.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied to both audio channel splits (only if a \"stereo\" dimension is defined below)."));
103    
104      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples"));      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples"));
105      m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments"));      m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments"));
106        m_TreeViewNotebook.append_page(m_ScrolledWindowScripts, _("Scripts"));
107    
108      actionGroup = Gtk::ActionGroup::create();      actionGroup = Gtk::ActionGroup::create();
109    
# Line 123  MainWindow::MainWindow() : Line 134  MainWindow::MainWindow() :
134                                           Gtk::Stock::PROPERTIES),                                           Gtk::Stock::PROPERTIES),
135                       sigc::mem_fun(                       sigc::mem_fun(
136                           *this, &MainWindow::show_instr_props));                           *this, &MainWindow::show_instr_props));
137        actionGroup->add(Gtk::Action::create("MidiRules",
138                                             _("_Midi Rules...")),
139                         sigc::mem_fun(
140                             *this, &MainWindow::show_midi_rules));
141        actionGroup->add(Gtk::Action::create("ScriptSlots",
142                                             _("_Script Slots...")),
143                         sigc::mem_fun(
144                             *this, &MainWindow::show_script_slots));
145      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),
146                       sigc::mem_fun(                       sigc::mem_fun(
147                           *this, &MainWindow::on_action_quit));                           *this, &MainWindow::on_action_quit));
# Line 132  MainWindow::MainWindow() : Line 151  MainWindow::MainWindow() :
151      actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));      actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));
152    
153      Glib::RefPtr<Gtk::ToggleAction> toggle_action =      Glib::RefPtr<Gtk::ToggleAction> toggle_action =
154          Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note"), "ffaga");          Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note"));
155      toggle_action->set_active(true);      toggle_action->set_active(true);
     //FIXME: doesn't work, why?  
     toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));  
156      actionGroup->add(toggle_action);      actionGroup->add(toggle_action);
157    
158      toggle_action =      toggle_action =
159          Gtk::ToggleAction::create("CopySampleTune", _("Copy Sample's _Fine Tune"));          Gtk::ToggleAction::create("CopySampleTune", _("Copy Sample's _Fine Tune"));
160      toggle_action->set_active(true);      toggle_action->set_active(true);
     //FIXME: doesn't work, why?  
     toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));  
161      actionGroup->add(toggle_action);      actionGroup->add(toggle_action);
162    
163      toggle_action =      toggle_action =
164          Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points"));          Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points"));
165      toggle_action->set_active(true);      toggle_action->set_active(true);
     //FIXME: doesn't work, why?  
     toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));  
166      actionGroup->add(toggle_action);      actionGroup->add(toggle_action);
167    
168    
# Line 180  MainWindow::MainWindow() : Line 193  MainWindow::MainWindow() :
193          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)
194      );      );
195    
196    
197        actionGroup->add(Gtk::Action::create("MenuSettings", _("_Settings")));
198        
199        toggle_action =
200            Gtk::ToggleAction::create("WarnUserOnExtensions", _("Show warning on format _extensions"));
201        toggle_action->set_active(Settings::singleton()->warnUserOnExtensions);
202        actionGroup->add(
203            toggle_action,
204            sigc::mem_fun(*this, &MainWindow::on_action_warn_user_on_extensions)
205        );
206    
207    
208        actionGroup->add(Gtk::Action::create("MenuTools", _("_Tools")));
209    
210        actionGroup->add(
211            Gtk::Action::create("CombineInstruments", _("_Combine Instruments...")),
212            sigc::mem_fun(*this, &MainWindow::on_action_combine_instruments)
213        );
214    
215        actionGroup->add(
216            Gtk::Action::create("MergeFiles", _("_Merge Files...")),
217            sigc::mem_fun(*this, &MainWindow::on_action_merge_files)
218        );
219    
220    
221      // sample right-click popup actions      // sample right-click popup actions
222      actionGroup->add(      actionGroup->add(
223          Gtk::Action::create("SampleProperties", Gtk::Stock::PROPERTIES),          Gtk::Action::create("SampleProperties", Gtk::Stock::PROPERTIES),
# Line 202  MainWindow::MainWindow() : Line 240  MainWindow::MainWindow() :
240                              _("Replace All Samples in All Groups...")),                              _("Replace All Samples in All Groups...")),
241          sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups)          sigc::mem_fun(*this, &MainWindow::on_action_replace_all_samples_in_all_groups)
242      );      );
243        
244        // script right-click popup actions
245        actionGroup->add(
246            Gtk::Action::create("AddScriptGroup", _("Add _Group")),
247            sigc::mem_fun(*this, &MainWindow::on_action_add_script_group)
248        );
249        actionGroup->add(
250            Gtk::Action::create("AddScript", _("Add _Script")),
251            sigc::mem_fun(*this, &MainWindow::on_action_add_script)
252        );
253        actionGroup->add(
254            Gtk::Action::create("EditScript", _("_Edit Script...")),
255            sigc::mem_fun(*this, &MainWindow::on_action_edit_script)
256        );
257        actionGroup->add(
258            Gtk::Action::create("RemoveScript", Gtk::Stock::REMOVE),
259            sigc::mem_fun(*this, &MainWindow::on_action_remove_script)
260        );
261    
262      uiManager = Gtk::UIManager::create();      uiManager = Gtk::UIManager::create();
263      uiManager->insert_action_group(actionGroup);      uiManager->insert_action_group(actionGroup);
# Line 231  MainWindow::MainWindow() : Line 287  MainWindow::MainWindow() :
287          "    <menu action='MenuView'>"          "    <menu action='MenuView'>"
288          "      <menuitem action='Statusbar'/>"          "      <menuitem action='Statusbar'/>"
289          "    </menu>"          "    </menu>"
290            "    <menu action='MenuTools'>"
291            "      <menuitem action='CombineInstruments'/>"
292            "      <menuitem action='MergeFiles'/>"
293            "    </menu>"
294            "    <menu action='MenuSettings'>"
295            "      <menuitem action='WarnUserOnExtensions'/>"
296            "    </menu>"
297          "    <menu action='MenuHelp'>"          "    <menu action='MenuHelp'>"
298          "      <menuitem action='About'/>"          "      <menuitem action='About'/>"
299          "    </menu>"          "    </menu>"
300          "  </menubar>"          "  </menubar>"
301          "  <popup name='PopupMenu'>"          "  <popup name='PopupMenu'>"
302          "    <menuitem action='InstrProperties'/>"          "    <menuitem action='InstrProperties'/>"
303            "    <menuitem action='MidiRules'/>"
304            "    <menuitem action='ScriptSlots'/>"
305          "    <menuitem action='AddInstrument'/>"          "    <menuitem action='AddInstrument'/>"
306          "    <menuitem action='DupInstrument'/>"          "    <menuitem action='DupInstrument'/>"
307          "    <separator/>"          "    <separator/>"
# Line 250  MainWindow::MainWindow() : Line 315  MainWindow::MainWindow() :
315          "    <separator/>"          "    <separator/>"
316          "    <menuitem action='RemoveSample'/>"          "    <menuitem action='RemoveSample'/>"
317          "  </popup>"          "  </popup>"
318            "  <popup name='ScriptPopupMenu'>"
319            "    <menuitem action='AddScriptGroup'/>"
320            "    <menuitem action='AddScript'/>"
321            "    <menuitem action='EditScript'/>"
322            "    <separator/>"
323            "    <menuitem action='RemoveScript'/>"
324            "  </popup>"
325          "</ui>";          "</ui>";
326      uiManager->add_ui_from_string(ui_info);      uiManager->add_ui_from_string(ui_info);
327    
328      popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu"));      popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu"));
329        
330        // Set tooltips for menu items (for some reason, setting a tooltip on the
331        // respective Gtk::Action objects above will simply be ignored, no matter
332        // if using Gtk::Action::set_tooltip() or passing the tooltip string on
333        // Gtk::Action::create()).
334        {
335            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
336                uiManager->get_widget("/MenuBar/MenuEdit/CopySampleUnity"));
337            item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current unity note setting will be altered by this action."));
338        }
339        {
340            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
341                uiManager->get_widget("/MenuBar/MenuEdit/CopySampleTune"));
342            item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current sample playback tuning will be altered by this action."));
343        }
344        {
345            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
346                uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop"));
347            item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current loop informations to be altered by this action."));
348        }
349        {
350            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
351                uiManager->get_widget("/MenuBar/MenuSettings/WarnUserOnExtensions"));
352            item->set_tooltip_text(_("If checked, a warning will be shown whenever you try to use a feature which is based on a LinuxSampler extension ontop of the original gig format, which would not work with the Gigasampler/GigaStudio application."));
353        }
354        {
355            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
356                uiManager->get_widget("/MenuBar/MenuTools/CombineInstruments"));
357            item->set_tooltip_text(_("Create combi sounds out of individual sounds of this .gig file."));
358        }
359        {
360            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
361                uiManager->get_widget("/MenuBar/MenuTools/MergeFiles"));
362            item->set_tooltip_text(_("Add instruments and samples of other .gig files to this .gig file."));
363        }
364    
365    
366      instrument_menu = static_cast<Gtk::MenuItem*>(      instrument_menu = static_cast<Gtk::MenuItem*>(
367          uiManager->get_widget("/MenuBar/MenuInstrument"))->get_submenu();          uiManager->get_widget("/MenuBar/MenuInstrument"))->get_submenu();
# Line 282  MainWindow::MainWindow() : Line 390  MainWindow::MainWindow() :
390      // Create the Tree model:      // Create the Tree model:
391      m_refTreeModel = Gtk::ListStore::create(m_Columns);      m_refTreeModel = Gtk::ListStore::create(m_Columns);
392      m_TreeView.set_model(m_refTreeModel);      m_TreeView.set_model(m_refTreeModel);
393        m_TreeView.set_tooltip_text(_("Right click here for actions on instruments & MIDI Rules."));
394      instrument_name_connection = m_refTreeModel->signal_row_changed().connect(      instrument_name_connection = m_refTreeModel->signal_row_changed().connect(
395          sigc::mem_fun(*this, &MainWindow::instrument_name_changed)          sigc::mem_fun(*this, &MainWindow::instrument_name_changed)
396      );      );
# Line 293  MainWindow::MainWindow() : Line 402  MainWindow::MainWindow() :
402      // create samples treeview (including its data model)      // create samples treeview (including its data model)
403      m_refSamplesTreeModel = SamplesTreeStore::create(m_SamplesModel);      m_refSamplesTreeModel = SamplesTreeStore::create(m_SamplesModel);
404      m_TreeViewSamples.set_model(m_refSamplesTreeModel);      m_TreeViewSamples.set_model(m_refSamplesTreeModel);
405        m_TreeViewSamples.set_tooltip_text(_("To actually use a sample, drag it from this list view to \"Sample\" -> \"Sample:\" on the region's settings pane on the right.\n\nRight click here for more actions on samples."));
406      // m_TreeViewSamples.set_reorderable();      // m_TreeViewSamples.set_reorderable();
407      m_TreeViewSamples.append_column_editable("Samples", m_SamplesModel.m_col_name);      m_TreeViewSamples.append_column_editable("Samples", m_SamplesModel.m_col_name);
408      m_TreeViewSamples.set_headers_visible(false);      m_TreeViewSamples.set_headers_visible(false);
# Line 303  MainWindow::MainWindow() : Line 413  MainWindow::MainWindow() :
413          sigc::mem_fun(*this, &MainWindow::sample_name_changed)          sigc::mem_fun(*this, &MainWindow::sample_name_changed)
414      );      );
415    
416        // create scripts treeview (including its data model)
417        m_refScriptsTreeModel = ScriptsTreeStore::create(m_ScriptsModel);
418        m_TreeViewScripts.set_model(m_refScriptsTreeModel);
419        m_TreeViewScripts.set_tooltip_text(_(
420            "Note: instrument scripts are a LinuxSampler extension of the gig "
421            "format. This feature will not work with the GigaStudio software!"
422        ));
423        // m_TreeViewScripts.set_reorderable();
424        m_TreeViewScripts.append_column_editable("Samples", m_ScriptsModel.m_col_name);
425        m_TreeViewScripts.set_headers_visible(false);
426        m_TreeViewScripts.signal_button_press_event().connect_notify(
427            sigc::mem_fun(*this, &MainWindow::on_script_treeview_button_release)
428        );
429        m_refScriptsTreeModel->signal_row_changed().connect(
430            sigc::mem_fun(*this, &MainWindow::script_name_changed)
431        );
432    
433        // establish drag&drop between scripts tree view and ScriptSlots window
434        std::vector<Gtk::TargetEntry> drag_target_gig_script;
435        drag_target_gig_script.push_back(Gtk::TargetEntry("gig::Script"));
436        m_TreeViewScripts.drag_source_set(drag_target_gig_script);
437        m_TreeViewScripts.signal_drag_begin().connect(
438            sigc::mem_fun(*this, &MainWindow::on_scripts_treeview_drag_begin)
439        );
440        m_TreeViewScripts.signal_drag_data_get().connect(
441            sigc::mem_fun(*this, &MainWindow::on_scripts_treeview_drag_data_get)
442        );
443    
444      // establish drag&drop between samples tree view and dimension region 'Sample' text entry      // establish drag&drop between samples tree view and dimension region 'Sample' text entry
445      std::vector<Gtk::TargetEntry> drag_target_gig_sample;      std::vector<Gtk::TargetEntry> drag_target_gig_sample;
446      drag_target_gig_sample.push_back(Gtk::TargetEntry("gig::Sample"));      drag_target_gig_sample.push_back(Gtk::TargetEntry("gig::Sample"));
# Line 327  MainWindow::MainWindow() : Line 465  MainWindow::MainWindow() :
465          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
466      propDialog.signal_changed().connect(      propDialog.signal_changed().connect(
467          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
468        midiRules.signal_changed().connect(
469            sigc::mem_fun(*this, &MainWindow::file_changed));
470    
471      dimreg_edit.signal_dimreg_to_be_changed().connect(      dimreg_edit.signal_dimreg_to_be_changed().connect(
472          dimreg_to_be_changed_signal.make_slot());          dimreg_to_be_changed_signal.make_slot());
# Line 375  MainWindow::MainWindow() : Line 515  MainWindow::MainWindow() :
515    
516      // start with a new gig file by default      // start with a new gig file by default
517      on_action_file_new();      on_action_file_new();
518    
519        // select 'Instruments' tab by default
520        // (gtk allows this only if the tab childs are visible, thats why it's here)
521        m_TreeViewNotebook.set_current_page(1);
522  }  }
523    
524  MainWindow::~MainWindow()  MainWindow::~MainWindow()
# Line 563  void MainWindow::__clear() { Line 707  void MainWindow::__clear() {
707      set_file_is_shared(false);      set_file_is_shared(false);
708  }  }
709    
710    void MainWindow::__refreshEntireGUI() {
711        // clear the samples and instruments tree views
712        m_refTreeModel->clear();
713        m_refSamplesTreeModel->clear();
714        // remove all entries from "Instrument" menu
715        while (!instrument_menu->get_children().empty()) {
716            remove_instrument_from_menu(0);
717        }
718    
719        if (!this->file) return;
720    
721        load_gig(
722            this->file, this->file->pInfo->Name.c_str(), this->file_is_shared
723        );
724    }
725    
726  void MainWindow::on_action_file_new()  void MainWindow::on_action_file_new()
727  {  {
728      if (!file_is_shared && file_is_changed && !close_confirmation_dialog()) return;      if (!file_is_shared && file_is_changed && !close_confirmation_dialog()) return;
# Line 927  void MainWindow::on_action_file_properti Line 1087  void MainWindow::on_action_file_properti
1087      propDialog.deiconify();      propDialog.deiconify();
1088  }  }
1089    
1090    void MainWindow::on_action_warn_user_on_extensions() {
1091        Settings::singleton()->warnUserOnExtensions =
1092            !Settings::singleton()->warnUserOnExtensions;
1093    }
1094    
1095  void MainWindow::on_action_help_about()  void MainWindow::on_action_help_about()
1096  {  {
1097      Gtk::AboutDialog dialog;      Gtk::AboutDialog dialog;
# Line 936  void MainWindow::on_action_help_about() Line 1101  void MainWindow::on_action_help_about()
1101      dialog.set_name("Gigedit");      dialog.set_name("Gigedit");
1102  #endif  #endif
1103      dialog.set_version(VERSION);      dialog.set_version(VERSION);
1104      dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2014 Andreas Persson");
1105      dialog.set_comments(_(      const std::string sComment =
1106          "Released under the GNU General Public License.\n"          _("Built " __DATE__ "\nUsing ") +
1107          "\n"          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +
1108          "Please notice that this is still a very young instrument editor. "          _(
1109          "So better backup your Gigasampler files before editing them with "              "Gigedit is released under the GNU General Public License.\n"
1110          "this application.\n"              "\n"
1111          "\n"              "Please notice that this is still a very young instrument editor. "
1112          "Please report bugs to: http://bugs.linuxsampler.org")              "So better backup your Gigasampler files before editing them with "
1113      );              "this application.\n"
1114                "\n"
1115                "Please report bugs to: http://bugs.linuxsampler.org"
1116            );
1117        dialog.set_comments(sComment.c_str());
1118      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
1119      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
1120      dialog.run();      dialog.run();
1121  }  }
1122    
1123  PropDialog::PropDialog()  PropDialog::PropDialog()
1124      : eName(_("Name")),      : eFileFormat(_("File Format")),
1125          eName(_("Name")),
1126        eCreationDate(_("Creation date")),        eCreationDate(_("Creation date")),
1127        eComments(_("Comments")),        eComments(_("Comments")),
1128        eProduct(_("Product")),        eProduct(_("Product")),
# Line 969  PropDialog::PropDialog() Line 1139  PropDialog::PropDialog()
1139        eCommissioned(_("Commissioned")),        eCommissioned(_("Commissioned")),
1140        eSubject(_("Subject")),        eSubject(_("Subject")),
1141        quitButton(Gtk::Stock::CLOSE),        quitButton(Gtk::Stock::CLOSE),
1142        table(2, 1)        table(2, 1),
1143          m_file(NULL)
1144  {  {
1145      set_title(_("File Properties"));      set_title(_("File Properties"));
1146      eName.set_width_chars(50);      eName.set_width_chars(50);
# Line 991  PropDialog::PropDialog() Line 1162  PropDialog::PropDialog()
1162      connect(eCommissioned, &DLS::Info::Commissioned);      connect(eCommissioned, &DLS::Info::Commissioned);
1163      connect(eSubject, &DLS::Info::Subject);      connect(eSubject, &DLS::Info::Subject);
1164    
1165        table.add(eFileFormat);
1166      table.add(eName);      table.add(eName);
1167      table.add(eCreationDate);      table.add(eCreationDate);
1168      table.add(eComments);      table.add(eComments);
# Line 1021  PropDialog::PropDialog() Line 1193  PropDialog::PropDialog()
1193      quitButton.grab_focus();      quitButton.grab_focus();
1194      quitButton.signal_clicked().connect(      quitButton.signal_clicked().connect(
1195          sigc::mem_fun(*this, &PropDialog::hide));          sigc::mem_fun(*this, &PropDialog::hide));
1196        eFileFormat.signal_value_changed().connect(
1197            sigc::mem_fun(*this, &PropDialog::onFileFormatChanged));
1198    
1199      quitButton.show();      quitButton.show();
1200      vbox.show();      vbox.show();
1201      show_all_children();      show_all_children();
1202  }  }
1203    
1204    void PropDialog::set_file(gig::File* file)
1205    {
1206        m_file = file;
1207    
1208        // update file format version combo box
1209        const std::string sGiga = "Gigasampler/GigaStudio v";
1210        const int major = file->pVersion->major;
1211        std::vector<std::string> txts;
1212        std::vector<int> values;
1213        txts.push_back(sGiga + "2"); values.push_back(2);
1214        txts.push_back(sGiga + "3/v4"); values.push_back(3);
1215        if (major != 2 && major != 3) {
1216            txts.push_back(sGiga + ToString(major)); values.push_back(major);
1217        }
1218        std::vector<const char*> texts;
1219        for (int i = 0; i < txts.size(); ++i) texts.push_back(txts[i].c_str());
1220        texts.push_back(NULL); values.push_back(0);
1221        eFileFormat.set_choices(&texts[0], &values[0]);
1222        eFileFormat.set_value(major);
1223    }
1224    
1225    void PropDialog::onFileFormatChanged() {
1226        const int major = eFileFormat.get_value();
1227        if (m_file) m_file->pVersion->major = major;
1228    }
1229    
1230  void PropDialog::set_info(DLS::Info* info)  void PropDialog::set_info(DLS::Info* info)
1231  {  {
1232      update(info);      update(info);
# Line 1168  void MainWindow::load_gig(gig::File* gig Line 1368  void MainWindow::load_gig(gig::File* gig
1368      file_has_name = filename;      file_has_name = filename;
1369      file_is_changed = false;      file_is_changed = false;
1370    
1371        propDialog.set_file(gig);
1372      propDialog.set_info(gig->pInfo);      propDialog.set_info(gig->pInfo);
1373    
1374      instrument_name_connection.block();      instrument_name_connection.block();
# Line 1204  void MainWindow::load_gig(gig::File* gig Line 1405  void MainWindow::load_gig(gig::File* gig
1405              }              }
1406          }          }
1407      }      }
1408        
1409        for (int i = 0; gig->GetScriptGroup(i); ++i) {
1410            gig::ScriptGroup* group = gig->GetScriptGroup(i);
1411    
1412            Gtk::TreeModel::iterator iterGroup = m_refScriptsTreeModel->append();
1413            Gtk::TreeModel::Row rowGroup = *iterGroup;
1414            rowGroup[m_ScriptsModel.m_col_name]   = gig_to_utf8(group->Name);
1415            rowGroup[m_ScriptsModel.m_col_group]  = group;
1416            rowGroup[m_ScriptsModel.m_col_script] = NULL;
1417            for (int s = 0; group->GetScript(s); ++s) {
1418                gig::Script* script = group->GetScript(s);
1419    
1420                Gtk::TreeModel::iterator iterScript =
1421                    m_refScriptsTreeModel->append(rowGroup.children());
1422                Gtk::TreeModel::Row rowScript = *iterScript;
1423                rowScript[m_ScriptsModel.m_col_name] = gig_to_utf8(script->Name);
1424                rowScript[m_ScriptsModel.m_col_script] = script;
1425                rowScript[m_ScriptsModel.m_col_group]  = NULL;
1426            }
1427        }
1428        // unfold all script groups by default
1429        m_TreeViewScripts.expand_all();
1430    
1431      file = gig;      file = gig;
1432    
# Line 1211  void MainWindow::load_gig(gig::File* gig Line 1434  void MainWindow::load_gig(gig::File* gig
1434      m_TreeView.get_selection()->select(Gtk::TreePath("0"));      m_TreeView.get_selection()->select(Gtk::TreePath("0"));
1435    
1436      instr_props_set_instrument();      instr_props_set_instrument();
1437        gig::Instrument* instrument = get_instrument();
1438        if (instrument) {
1439            midiRules.set_instrument(instrument);
1440        }
1441  }  }
1442    
1443  bool MainWindow::instr_props_set_instrument()  bool MainWindow::instr_props_set_instrument()
# Line 1258  void MainWindow::instr_name_changed_by_i Line 1485  void MainWindow::instr_name_changed_by_i
1485      }      }
1486  }  }
1487    
1488    void MainWindow::show_midi_rules()
1489    {
1490        if (gig::Instrument* instrument = get_instrument())
1491        {
1492            midiRules.set_instrument(instrument);
1493            midiRules.show();
1494            midiRules.deiconify();
1495        }
1496    }
1497    
1498    void MainWindow::show_script_slots() {
1499        if (!file) return;
1500        // get selected instrument
1501        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection();
1502        Gtk::TreeModel::iterator it = sel->get_selected();
1503        if (!it) return;
1504        Gtk::TreeModel::Row row = *it;
1505        gig::Instrument* instrument = row[m_Columns.m_col_instr];
1506        if (!instrument) return;
1507    
1508        ScriptSlots* window = new ScriptSlots;
1509        window->setInstrument(instrument);
1510        //window->reparent(*this);
1511        window->show();
1512    }
1513    
1514  void MainWindow::on_action_view_status_bar() {  void MainWindow::on_action_view_status_bar() {
1515      Gtk::CheckMenuItem* item =      Gtk::CheckMenuItem* item =
1516          dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar"));          dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar"));
# Line 1304  void MainWindow::on_button_release(GdkEv Line 1557  void MainWindow::on_button_release(GdkEv
1557      if (button->type == GDK_2BUTTON_PRESS) {      if (button->type == GDK_2BUTTON_PRESS) {
1558          show_instr_props();          show_instr_props();
1559      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {
1560            // gig v2 files have no midi rules
1561            static_cast<Gtk::MenuItem*>(
1562                uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive(
1563                    !(file->pVersion && file->pVersion->major == 2));
1564          popup_menu->popup(button->button, button->time);          popup_menu->popup(button->button, button->time);
1565      }      }
1566  }  }
# Line 1350  void MainWindow::on_sample_treeview_butt Line 1607  void MainWindow::on_sample_treeview_butt
1607      }      }
1608  }  }
1609    
1610    void MainWindow::on_script_treeview_button_release(GdkEventButton* button) {
1611        if (button->type == GDK_BUTTON_PRESS && button->button == 3) {
1612            Gtk::Menu* script_popup =
1613                dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/ScriptPopupMenu"));
1614            // update enabled/disabled state of sample popup items
1615            Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
1616            Gtk::TreeModel::iterator it = sel->get_selected();
1617            bool group_selected  = false;
1618            bool script_selected = false;
1619            if (it) {
1620                Gtk::TreeModel::Row row = *it;
1621                group_selected  = row[m_ScriptsModel.m_col_group];
1622                script_selected = row[m_ScriptsModel.m_col_script];
1623            }
1624            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScript"))->
1625                set_sensitive(group_selected || script_selected);
1626            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScriptGroup"))->
1627                set_sensitive(file);
1628            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/EditScript"))->
1629                set_sensitive(script_selected);    
1630            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/RemoveScript"))->
1631                set_sensitive(group_selected || script_selected);
1632            // show sample popup
1633            script_popup->popup(button->button, button->time);
1634        }
1635    }
1636    
1637  Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu(  Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu(
1638      const Glib::ustring& name, int position) {      const Glib::ustring& name, int position) {
# Line 1476  void MainWindow::on_action_remove_instru Line 1759  void MainWindow::on_action_remove_instru
1759              }              }
1760  #endif  #endif
1761              instr_props_set_instrument();              instr_props_set_instrument();
1762                instr = get_instrument();
1763                if (instr) {
1764                    midiRules.set_instrument(instr);
1765                } else {
1766                    midiRules.hide();
1767                }
1768          } catch (RIFF::Exception e) {          } catch (RIFF::Exception e) {
1769              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1770              msg.run();              msg.run();
# Line 1491  void MainWindow::on_action_sample_proper Line 1780  void MainWindow::on_action_sample_proper
1780      msg.run();      msg.run();
1781  }  }
1782    
1783    void MainWindow::on_action_add_script_group() {
1784        static int __script_indexer = 0;
1785        if (!file) return;
1786        gig::ScriptGroup* group = file->AddScriptGroup();
1787        group->Name = gig_from_utf8(_("Unnamed Group"));
1788        if (__script_indexer) group->Name += " " + ToString(__script_indexer);
1789        __script_indexer++;
1790        // update sample tree view
1791        Gtk::TreeModel::iterator iterGroup = m_refScriptsTreeModel->append();
1792        Gtk::TreeModel::Row rowGroup = *iterGroup;
1793        rowGroup[m_ScriptsModel.m_col_name] = gig_to_utf8(group->Name);
1794        rowGroup[m_ScriptsModel.m_col_script] = NULL;
1795        rowGroup[m_ScriptsModel.m_col_group] = group;
1796        file_changed();
1797    }
1798    
1799    void MainWindow::on_action_add_script() {
1800        if (!file) return;
1801        // get selected group
1802        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
1803        Gtk::TreeModel::iterator it = sel->get_selected();
1804        if (!it) return;
1805        Gtk::TreeModel::Row row = *it;
1806        gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group];
1807        if (!group) { // not a group, but a script is selected (probably)
1808            gig::Script* script = row[m_ScriptsModel.m_col_script];
1809            if (!script) return;
1810            it = row.parent(); // resolve parent (that is the script's group)
1811            if (!it) return;
1812            row = *it;
1813            group = row[m_ScriptsModel.m_col_group];
1814            if (!group) return;
1815        }
1816    
1817        // add a new script to the .gig file
1818        gig::Script* script = group->AddScript();    
1819        Glib::ustring name = _("Unnamed Script");
1820        script->Name = gig_from_utf8(name);
1821    
1822        // add script to the tree view
1823        Gtk::TreeModel::iterator iterScript =
1824            m_refScriptsTreeModel->append(row.children());
1825        Gtk::TreeModel::Row rowScript = *iterScript;
1826        rowScript[m_ScriptsModel.m_col_name] = name;
1827        rowScript[m_ScriptsModel.m_col_script] = script;
1828        rowScript[m_ScriptsModel.m_col_group]  = NULL;
1829    
1830        // unfold group of new script item in treeview
1831        Gtk::TreeModel::Path path(iterScript);
1832        m_TreeViewScripts.expand_to_path(path);
1833    }
1834    
1835    void MainWindow::on_action_edit_script() {
1836        if (!file) return;
1837        // get selected script
1838        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
1839        Gtk::TreeModel::iterator it = sel->get_selected();
1840        if (!it) return;
1841        Gtk::TreeModel::Row row = *it;
1842        gig::Script* script = row[m_ScriptsModel.m_col_script];
1843        if (!script) return;
1844    
1845        ScriptEditor* editor = new ScriptEditor;
1846        editor->setScript(script);
1847        //editor->reparent(*this);
1848        editor->show();
1849    }
1850    
1851    void MainWindow::on_action_remove_script() {
1852        if (!file) return;
1853        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
1854        Gtk::TreeModel::iterator it = sel->get_selected();
1855        if (it) {
1856            Gtk::TreeModel::Row row = *it;
1857            gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group];
1858            gig::Script* script     = row[m_ScriptsModel.m_col_script];
1859            Glib::ustring name      = row[m_ScriptsModel.m_col_name];
1860            try {
1861                // remove script group or script from the gig file
1862                if (group) {
1863                    // notify everybody that we're going to remove these samples
1864    //TODO:         scripts_to_be_removed_signal.emit(members);
1865                    // delete the group in the .gig file including the
1866                    // samples that belong to the group
1867                    file->DeleteScriptGroup(group);
1868                    // notify that we're done with removal
1869    //TODO:         scripts_removed_signal.emit();
1870                    file_changed();
1871                } else if (script) {
1872                    // notify everybody that we're going to remove this sample
1873    //TODO:         std::list<gig::Script*> lscripts;
1874    //TODO:         lscripts.push_back(script);
1875    //TODO:         scripts_to_be_removed_signal.emit(lscripts);
1876                    // remove sample from the .gig file
1877                    script->GetGroup()->DeleteScript(script);
1878                    // notify that we're done with removal
1879    //TODO:         scripts_removed_signal.emit();
1880                    dimreg_changed();
1881                    file_changed();
1882                }
1883                // remove respective row(s) from samples tree view
1884                m_refScriptsTreeModel->erase(it);
1885            } catch (RIFF::Exception e) {
1886                // pretend we're done with removal (i.e. to avoid dead locks)
1887    //TODO:     scripts_removed_signal.emit();
1888                // show error message
1889                Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1890                msg.run();
1891            }
1892        }
1893    }
1894    
1895  void MainWindow::on_action_add_group() {  void MainWindow::on_action_add_group() {
1896      static int __sample_indexer = 0;      static int __sample_indexer = 0;
1897      if (!file) return;      if (!file) return;
# Line 1860  void MainWindow::on_action_remove_sample Line 2261  void MainWindow::on_action_remove_sample
2261      }      }
2262  }  }
2263    
2264    // see comment on on_sample_treeview_drag_begin()
2265    void MainWindow::on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context)
2266    {
2267        first_call_to_drag_data_get = true;
2268    }
2269    
2270    void MainWindow::on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
2271                                                       Gtk::SelectionData& selection_data, guint, guint)
2272    {
2273        if (!first_call_to_drag_data_get) return;
2274        first_call_to_drag_data_get = false;
2275    
2276        // get selected script
2277        gig::Script* script = NULL;
2278        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
2279        Gtk::TreeModel::iterator it = sel->get_selected();
2280        if (it) {
2281            Gtk::TreeModel::Row row = *it;
2282            script = row[m_ScriptsModel.m_col_script];
2283        }
2284        // pass the gig::Script as pointer
2285        selection_data.set(selection_data.get_target(), 0/*unused*/,
2286                           (const guchar*)&script,
2287                           sizeof(script)/*length of data in bytes*/);
2288    }
2289    
2290  // For some reason drag_data_get gets called two times for each  // For some reason drag_data_get gets called two times for each
2291  // drag'n'drop (at least when target is an Entry). This work-around  // drag'n'drop (at least when target is an Entry). This work-around
2292  // makes sure the code in drag_data_get and drop_drag_data_received is  // makes sure the code in drag_data_get and drop_drag_data_received is
# Line 1918  void MainWindow::on_sample_label_drop_dr Line 2345  void MainWindow::on_sample_label_drop_dr
2345          bool channels_changed = false;          bool channels_changed = false;
2346          if (sample->Channels == 1 && stereo_dimension) {          if (sample->Channels == 1 && stereo_dimension) {
2347              // remove the samplechannel dimension              // remove the samplechannel dimension
2348    /* commented out, because it makes it impossible building up an instrument from scratch using two separate L/R samples
2349              region->DeleteDimension(stereo_dimension);              region->DeleteDimension(stereo_dimension);
2350              channels_changed = true;              channels_changed = true;
2351              region_changed();              region_changed();
2352    */
2353          }          }
2354          dimreg_edit.set_sample(          dimreg_edit.set_sample(
2355              sample,              sample,
# Line 1986  void MainWindow::sample_name_changed(con Line 2415  void MainWindow::sample_name_changed(con
2415      }      }
2416  }  }
2417    
2418    void MainWindow::script_name_changed(const Gtk::TreeModel::Path& path,
2419                                         const Gtk::TreeModel::iterator& iter) {
2420        if (!iter) return;
2421        Gtk::TreeModel::Row row = *iter;
2422        Glib::ustring name      = row[m_ScriptsModel.m_col_name];
2423        gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group];
2424        gig::Script* script     = row[m_ScriptsModel.m_col_script];
2425        gig::String gigname(gig_from_utf8(name));
2426        if (group) {
2427            if (group->Name != gigname) {
2428                group->Name = gigname;
2429                printf("script group name changed\n");
2430                file_changed();
2431            }
2432        } else if (script) {
2433            if (script->Name != gigname) {
2434                script->Name = gigname;
2435                printf("script name changed\n");
2436                file_changed();
2437            }
2438        }
2439    }
2440    
2441  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,
2442                                           const Gtk::TreeModel::iterator& iter) {                                           const Gtk::TreeModel::iterator& iter) {
2443      if (!iter) return;      if (!iter) return;
# Line 2020  void MainWindow::instrument_name_changed Line 2472  void MainWindow::instrument_name_changed
2472      }      }
2473  }  }
2474    
2475    void MainWindow::on_action_combine_instruments() {
2476        CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);
2477        d->show_all();
2478        d->resize(500, 400);
2479        d->run();
2480        if (d->fileWasChanged()) {
2481            // update GUI with new instrument just created
2482            add_instrument(d->newCombinedInstrument());
2483        }
2484        delete d;
2485    }
2486    
2487    void MainWindow::mergeFiles(const std::vector<std::string>& filenames) {
2488        struct _Source {
2489            std::vector<RIFF::File*> riffs;
2490            std::vector<gig::File*> gigs;
2491            
2492            ~_Source() {
2493                for (int k = 0; k < gigs.size(); ++k) delete gigs[k];
2494                for (int k = 0; k < riffs.size(); ++k) delete riffs[k];
2495                riffs.clear();
2496                gigs.clear();
2497            }
2498        } sources;
2499    
2500        if (filenames.empty())
2501            throw RIFF::Exception(_("No files selected, so nothing done."));
2502    
2503        // first open all input files (to avoid output file corruption)
2504        int i;
2505        try {
2506            for (i = 0; i < filenames.size(); ++i) {
2507                const std::string& filename = filenames[i];
2508                printf("opening file=%s\n", filename.c_str());
2509    
2510                RIFF::File* riff = new RIFF::File(filename);
2511                sources.riffs.push_back(riff);
2512    
2513                gig::File* gig = new gig::File(riff);
2514                sources.gigs.push_back(gig);
2515            }
2516        } catch (RIFF::Exception e) {
2517            throw RIFF::Exception(
2518                _("Error occurred while opening '") +
2519                filenames[i] +
2520                "': " +
2521                e.Message
2522            );
2523        } catch (...) {
2524            throw RIFF::Exception(
2525                _("Unknown exception occurred while opening '") +
2526                filenames[i] + "'"
2527            );
2528        }
2529    
2530        // now merge the opened .gig files to the main .gig file currently being
2531        // open in gigedit
2532        try {
2533            for (i = 0; i < filenames.size(); ++i) {
2534                const std::string& filename = filenames[i];
2535                printf("merging file=%s\n", filename.c_str());
2536                assert(i < sources.gigs.size());
2537    
2538                this->file->AddContentOf(sources.gigs[i]);
2539            }
2540        } catch (RIFF::Exception e) {
2541            throw RIFF::Exception(
2542                _("Error occurred while merging '") +
2543                filenames[i] +
2544                "': " +
2545                e.Message
2546            );
2547        } catch (...) {
2548            throw RIFF::Exception(
2549                _("Unknown exception occurred while merging '") +
2550                filenames[i] + "'"
2551            );
2552        }
2553    
2554        // Note: requires that this file already has a filename !
2555        this->file->Save();
2556    }
2557    
2558    void MainWindow::on_action_merge_files() {
2559        if (this->file->GetFileName().empty()) {
2560            Glib::ustring txt = _(
2561                "You seem to have a new .gig file open that has not been saved "
2562                "yet. You must save it somewhere before starting to merge it with "
2563                "other .gig files though, because during the merge operation the "
2564                "other files' sample data must be written on file level to the "
2565                "target .gig file."
2566            );
2567            Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
2568            msg.run();
2569            return;
2570        }
2571    
2572        Gtk::FileChooserDialog dialog(*this, _("Merge .gig files"));
2573        dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
2574        dialog.add_button(_("Merge"), Gtk::RESPONSE_OK);
2575        dialog.set_default_response(Gtk::RESPONSE_CANCEL);
2576    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
2577        Gtk::FileFilter filter;
2578        filter.add_pattern("*.gig");
2579    #else
2580        Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
2581        filter->add_pattern("*.gig");
2582    #endif
2583        dialog.set_filter(filter);
2584        if (current_gig_dir != "") {
2585            dialog.set_current_folder(current_gig_dir);
2586        }
2587        dialog.set_select_multiple(true);
2588    
2589        // show warning in the file picker dialog
2590        Gtk::HBox descriptionArea;
2591        descriptionArea.set_spacing(15);
2592        Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG));
2593        descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK);
2594    #if GTKMM_MAJOR_VERSION < 3
2595        view::WrapLabel description;
2596    #else
2597        Gtk::Label description;
2598        description.set_line_wrap();
2599    #endif
2600        description.set_markup(_(
2601            "\nSelect at least one .gig file that shall be merged to the .gig file "
2602            "currently being open in gigedit.\n\n"
2603            "<b>Please Note:</b> Merging with other files will modify your "
2604            "currently open .gig file on file level! And be aware that the current "
2605            "merge algorithm does not detect duplicate samples yet. So if you are "
2606            "merging files which are using equivalent sample data, those "
2607            "equivalent samples will currently be treated as separate samples and "
2608            "will accordingly be stored separately in the target .gig file!"
2609        ));
2610        descriptionArea.pack_start(description);
2611        dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK);
2612        descriptionArea.show_all();
2613    
2614        if (dialog.run() == Gtk::RESPONSE_OK) {
2615            printf("on_action_merge_files self=%x\n", Glib::Threads::Thread::self());
2616            std::vector<std::string> filenames = dialog.get_filenames();
2617    
2618            // merge the selected files to the currently open .gig file
2619            try {
2620                mergeFiles(filenames);
2621            } catch (RIFF::Exception e) {
2622                Gtk::MessageDialog msg(*this, e.Message, false, Gtk::MESSAGE_ERROR);
2623                msg.run();
2624            }
2625    
2626            // update GUI
2627            __refreshEntireGUI();        
2628        }
2629    }
2630    
2631  void MainWindow::set_file_is_shared(bool b) {  void MainWindow::set_file_is_shared(bool b) {
2632      this->file_is_shared = b;      this->file_is_shared = b;
2633    

Legend:
Removed from v.2466  
changed lines
  Added in v.2610

  ViewVC Help
Powered by ViewVC