/[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 2615 by schoenebeck, Tue Jun 10 19:14:01 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 553  void MainWindow::__clear() { Line 697  void MainWindow::__clear() {
697      // clear the samples and instruments tree views      // clear the samples and instruments tree views
698      m_refTreeModel->clear();      m_refTreeModel->clear();
699      m_refSamplesTreeModel->clear();      m_refSamplesTreeModel->clear();
700        m_refScriptsTreeModel->clear();
701      // remove all entries from "Instrument" menu      // remove all entries from "Instrument" menu
702      while (!instrument_menu->get_children().empty()) {      while (!instrument_menu->get_children().empty()) {
703          remove_instrument_from_menu(0);          remove_instrument_from_menu(0);
# Line 563  void MainWindow::__clear() { Line 708  void MainWindow::__clear() {
708      set_file_is_shared(false);      set_file_is_shared(false);
709  }  }
710    
711    void MainWindow::__refreshEntireGUI() {
712        // clear the samples and instruments tree views
713        m_refTreeModel->clear();
714        m_refSamplesTreeModel->clear();
715        m_refScriptsTreeModel->clear();
716        // remove all entries from "Instrument" menu
717        while (!instrument_menu->get_children().empty()) {
718            remove_instrument_from_menu(0);
719        }
720    
721        if (!this->file) return;
722    
723        load_gig(
724            this->file, this->file->pInfo->Name.c_str(), this->file_is_shared
725        );
726    }
727    
728  void MainWindow::on_action_file_new()  void MainWindow::on_action_file_new()
729  {  {
730      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 1089  void MainWindow::on_action_file_properti
1089      propDialog.deiconify();      propDialog.deiconify();
1090  }  }
1091    
1092    void MainWindow::on_action_warn_user_on_extensions() {
1093        Settings::singleton()->warnUserOnExtensions =
1094            !Settings::singleton()->warnUserOnExtensions;
1095    }
1096    
1097  void MainWindow::on_action_help_about()  void MainWindow::on_action_help_about()
1098  {  {
1099      Gtk::AboutDialog dialog;      Gtk::AboutDialog dialog;
# Line 936  void MainWindow::on_action_help_about() Line 1103  void MainWindow::on_action_help_about()
1103      dialog.set_name("Gigedit");      dialog.set_name("Gigedit");
1104  #endif  #endif
1105      dialog.set_version(VERSION);      dialog.set_version(VERSION);
1106      dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2014 Andreas Persson");
1107      dialog.set_comments(_(      const std::string sComment =
1108          "Released under the GNU General Public License.\n"          _("Built " __DATE__ "\nUsing ") +
1109          "\n"          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +
1110          "Please notice that this is still a very young instrument editor. "          _(
1111          "So better backup your Gigasampler files before editing them with "              "Gigedit is released under the GNU General Public License.\n"
1112          "this application.\n"              "\n"
1113          "\n"              "Please notice that this is still a very young instrument editor. "
1114          "Please report bugs to: http://bugs.linuxsampler.org")              "So better backup your Gigasampler files before editing them with "
1115      );              "this application.\n"
1116                "\n"
1117                "Please report bugs to: http://bugs.linuxsampler.org"
1118            );
1119        dialog.set_comments(sComment.c_str());
1120      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
1121      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
1122      dialog.run();      dialog.run();
1123  }  }
1124    
1125  PropDialog::PropDialog()  PropDialog::PropDialog()
1126      : eName(_("Name")),      : eFileFormat(_("File Format")),
1127          eName(_("Name")),
1128        eCreationDate(_("Creation date")),        eCreationDate(_("Creation date")),
1129        eComments(_("Comments")),        eComments(_("Comments")),
1130        eProduct(_("Product")),        eProduct(_("Product")),
# Line 969  PropDialog::PropDialog() Line 1141  PropDialog::PropDialog()
1141        eCommissioned(_("Commissioned")),        eCommissioned(_("Commissioned")),
1142        eSubject(_("Subject")),        eSubject(_("Subject")),
1143        quitButton(Gtk::Stock::CLOSE),        quitButton(Gtk::Stock::CLOSE),
1144        table(2, 1)        table(2, 1),
1145          m_file(NULL)
1146  {  {
1147      set_title(_("File Properties"));      set_title(_("File Properties"));
1148      eName.set_width_chars(50);      eName.set_width_chars(50);
# Line 991  PropDialog::PropDialog() Line 1164  PropDialog::PropDialog()
1164      connect(eCommissioned, &DLS::Info::Commissioned);      connect(eCommissioned, &DLS::Info::Commissioned);
1165      connect(eSubject, &DLS::Info::Subject);      connect(eSubject, &DLS::Info::Subject);
1166    
1167        table.add(eFileFormat);
1168      table.add(eName);      table.add(eName);
1169      table.add(eCreationDate);      table.add(eCreationDate);
1170      table.add(eComments);      table.add(eComments);
# Line 1021  PropDialog::PropDialog() Line 1195  PropDialog::PropDialog()
1195      quitButton.grab_focus();      quitButton.grab_focus();
1196      quitButton.signal_clicked().connect(      quitButton.signal_clicked().connect(
1197          sigc::mem_fun(*this, &PropDialog::hide));          sigc::mem_fun(*this, &PropDialog::hide));
1198        eFileFormat.signal_value_changed().connect(
1199            sigc::mem_fun(*this, &PropDialog::onFileFormatChanged));
1200    
1201      quitButton.show();      quitButton.show();
1202      vbox.show();      vbox.show();
1203      show_all_children();      show_all_children();
1204  }  }
1205    
1206    void PropDialog::set_file(gig::File* file)
1207    {
1208        m_file = file;
1209    
1210        // update file format version combo box
1211        const std::string sGiga = "Gigasampler/GigaStudio v";
1212        const int major = file->pVersion->major;
1213        std::vector<std::string> txts;
1214        std::vector<int> values;
1215        txts.push_back(sGiga + "2"); values.push_back(2);
1216        txts.push_back(sGiga + "3/v4"); values.push_back(3);
1217        if (major != 2 && major != 3) {
1218            txts.push_back(sGiga + ToString(major)); values.push_back(major);
1219        }
1220        std::vector<const char*> texts;
1221        for (int i = 0; i < txts.size(); ++i) texts.push_back(txts[i].c_str());
1222        texts.push_back(NULL); values.push_back(0);
1223        eFileFormat.set_choices(&texts[0], &values[0]);
1224        eFileFormat.set_value(major);
1225    }
1226    
1227    void PropDialog::onFileFormatChanged() {
1228        const int major = eFileFormat.get_value();
1229        if (m_file) m_file->pVersion->major = major;
1230    }
1231    
1232  void PropDialog::set_info(DLS::Info* info)  void PropDialog::set_info(DLS::Info* info)
1233  {  {
1234      update(info);      update(info);
# Line 1168  void MainWindow::load_gig(gig::File* gig Line 1370  void MainWindow::load_gig(gig::File* gig
1370      file_has_name = filename;      file_has_name = filename;
1371      file_is_changed = false;      file_is_changed = false;
1372    
1373        propDialog.set_file(gig);
1374      propDialog.set_info(gig->pInfo);      propDialog.set_info(gig->pInfo);
1375    
1376      instrument_name_connection.block();      instrument_name_connection.block();
# Line 1204  void MainWindow::load_gig(gig::File* gig Line 1407  void MainWindow::load_gig(gig::File* gig
1407              }              }
1408          }          }
1409      }      }
1410        
1411        for (int i = 0; gig->GetScriptGroup(i); ++i) {
1412            gig::ScriptGroup* group = gig->GetScriptGroup(i);
1413    
1414            Gtk::TreeModel::iterator iterGroup = m_refScriptsTreeModel->append();
1415            Gtk::TreeModel::Row rowGroup = *iterGroup;
1416            rowGroup[m_ScriptsModel.m_col_name]   = gig_to_utf8(group->Name);
1417            rowGroup[m_ScriptsModel.m_col_group]  = group;
1418            rowGroup[m_ScriptsModel.m_col_script] = NULL;
1419            for (int s = 0; group->GetScript(s); ++s) {
1420                gig::Script* script = group->GetScript(s);
1421    
1422                Gtk::TreeModel::iterator iterScript =
1423                    m_refScriptsTreeModel->append(rowGroup.children());
1424                Gtk::TreeModel::Row rowScript = *iterScript;
1425                rowScript[m_ScriptsModel.m_col_name] = gig_to_utf8(script->Name);
1426                rowScript[m_ScriptsModel.m_col_script] = script;
1427                rowScript[m_ScriptsModel.m_col_group]  = NULL;
1428            }
1429        }
1430        // unfold all script groups by default
1431        m_TreeViewScripts.expand_all();
1432    
1433      file = gig;      file = gig;
1434    
# Line 1211  void MainWindow::load_gig(gig::File* gig Line 1436  void MainWindow::load_gig(gig::File* gig
1436      m_TreeView.get_selection()->select(Gtk::TreePath("0"));      m_TreeView.get_selection()->select(Gtk::TreePath("0"));
1437    
1438      instr_props_set_instrument();      instr_props_set_instrument();
1439        gig::Instrument* instrument = get_instrument();
1440        if (instrument) {
1441            midiRules.set_instrument(instrument);
1442        }
1443  }  }
1444    
1445  bool MainWindow::instr_props_set_instrument()  bool MainWindow::instr_props_set_instrument()
# Line 1258  void MainWindow::instr_name_changed_by_i Line 1487  void MainWindow::instr_name_changed_by_i
1487      }      }
1488  }  }
1489    
1490    void MainWindow::show_midi_rules()
1491    {
1492        if (gig::Instrument* instrument = get_instrument())
1493        {
1494            midiRules.set_instrument(instrument);
1495            midiRules.show();
1496            midiRules.deiconify();
1497        }
1498    }
1499    
1500    void MainWindow::show_script_slots() {
1501        if (!file) return;
1502        // get selected instrument
1503        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection();
1504        Gtk::TreeModel::iterator it = sel->get_selected();
1505        if (!it) return;
1506        Gtk::TreeModel::Row row = *it;
1507        gig::Instrument* instrument = row[m_Columns.m_col_instr];
1508        if (!instrument) return;
1509    
1510        ScriptSlots* window = new ScriptSlots;
1511        window->setInstrument(instrument);
1512        //window->reparent(*this);
1513        window->show();
1514    }
1515    
1516  void MainWindow::on_action_view_status_bar() {  void MainWindow::on_action_view_status_bar() {
1517      Gtk::CheckMenuItem* item =      Gtk::CheckMenuItem* item =
1518          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 1559  void MainWindow::on_button_release(GdkEv
1559      if (button->type == GDK_2BUTTON_PRESS) {      if (button->type == GDK_2BUTTON_PRESS) {
1560          show_instr_props();          show_instr_props();
1561      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {
1562            // gig v2 files have no midi rules
1563            static_cast<Gtk::MenuItem*>(
1564                uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive(
1565                    !(file->pVersion && file->pVersion->major == 2));
1566          popup_menu->popup(button->button, button->time);          popup_menu->popup(button->button, button->time);
1567      }      }
1568  }  }
# Line 1350  void MainWindow::on_sample_treeview_butt Line 1609  void MainWindow::on_sample_treeview_butt
1609      }      }
1610  }  }
1611    
1612    void MainWindow::on_script_treeview_button_release(GdkEventButton* button) {
1613        if (button->type == GDK_BUTTON_PRESS && button->button == 3) {
1614            Gtk::Menu* script_popup =
1615                dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/ScriptPopupMenu"));
1616            // update enabled/disabled state of sample popup items
1617            Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
1618            Gtk::TreeModel::iterator it = sel->get_selected();
1619            bool group_selected  = false;
1620            bool script_selected = false;
1621            if (it) {
1622                Gtk::TreeModel::Row row = *it;
1623                group_selected  = row[m_ScriptsModel.m_col_group];
1624                script_selected = row[m_ScriptsModel.m_col_script];
1625            }
1626            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScript"))->
1627                set_sensitive(group_selected || script_selected);
1628            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/AddScriptGroup"))->
1629                set_sensitive(file);
1630            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/EditScript"))->
1631                set_sensitive(script_selected);    
1632            dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/ScriptPopupMenu/RemoveScript"))->
1633                set_sensitive(group_selected || script_selected);
1634            // show sample popup
1635            script_popup->popup(button->button, button->time);
1636        }
1637    }
1638    
1639  Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu(  Gtk::RadioMenuItem* MainWindow::add_instrument_to_menu(
1640      const Glib::ustring& name, int position) {      const Glib::ustring& name, int position) {
# Line 1476  void MainWindow::on_action_remove_instru Line 1761  void MainWindow::on_action_remove_instru
1761              }              }
1762  #endif  #endif
1763              instr_props_set_instrument();              instr_props_set_instrument();
1764                instr = get_instrument();
1765                if (instr) {
1766                    midiRules.set_instrument(instr);
1767                } else {
1768                    midiRules.hide();
1769                }
1770          } catch (RIFF::Exception e) {          } catch (RIFF::Exception e) {
1771              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1772              msg.run();              msg.run();
# Line 1491  void MainWindow::on_action_sample_proper Line 1782  void MainWindow::on_action_sample_proper
1782      msg.run();      msg.run();
1783  }  }
1784    
1785    void MainWindow::on_action_add_script_group() {
1786        static int __script_indexer = 0;
1787        if (!file) return;
1788        gig::ScriptGroup* group = file->AddScriptGroup();
1789        group->Name = gig_from_utf8(_("Unnamed Group"));
1790        if (__script_indexer) group->Name += " " + ToString(__script_indexer);
1791        __script_indexer++;
1792        // update sample tree view
1793        Gtk::TreeModel::iterator iterGroup = m_refScriptsTreeModel->append();
1794        Gtk::TreeModel::Row rowGroup = *iterGroup;
1795        rowGroup[m_ScriptsModel.m_col_name] = gig_to_utf8(group->Name);
1796        rowGroup[m_ScriptsModel.m_col_script] = NULL;
1797        rowGroup[m_ScriptsModel.m_col_group] = group;
1798        file_changed();
1799    }
1800    
1801    void MainWindow::on_action_add_script() {
1802        if (!file) return;
1803        // get selected group
1804        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
1805        Gtk::TreeModel::iterator it = sel->get_selected();
1806        if (!it) return;
1807        Gtk::TreeModel::Row row = *it;
1808        gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group];
1809        if (!group) { // not a group, but a script is selected (probably)
1810            gig::Script* script = row[m_ScriptsModel.m_col_script];
1811            if (!script) return;
1812            it = row.parent(); // resolve parent (that is the script's group)
1813            if (!it) return;
1814            row = *it;
1815            group = row[m_ScriptsModel.m_col_group];
1816            if (!group) return;
1817        }
1818    
1819        // add a new script to the .gig file
1820        gig::Script* script = group->AddScript();    
1821        Glib::ustring name = _("Unnamed Script");
1822        script->Name = gig_from_utf8(name);
1823    
1824        // add script to the tree view
1825        Gtk::TreeModel::iterator iterScript =
1826            m_refScriptsTreeModel->append(row.children());
1827        Gtk::TreeModel::Row rowScript = *iterScript;
1828        rowScript[m_ScriptsModel.m_col_name] = name;
1829        rowScript[m_ScriptsModel.m_col_script] = script;
1830        rowScript[m_ScriptsModel.m_col_group]  = NULL;
1831    
1832        // unfold group of new script item in treeview
1833        Gtk::TreeModel::Path path(iterScript);
1834        m_TreeViewScripts.expand_to_path(path);
1835    }
1836    
1837    void MainWindow::on_action_edit_script() {
1838        if (!file) return;
1839        // get selected script
1840        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
1841        Gtk::TreeModel::iterator it = sel->get_selected();
1842        if (!it) return;
1843        Gtk::TreeModel::Row row = *it;
1844        gig::Script* script = row[m_ScriptsModel.m_col_script];
1845        if (!script) return;
1846    
1847        ScriptEditor* editor = new ScriptEditor;
1848        editor->setScript(script);
1849        //editor->reparent(*this);
1850        editor->show();
1851    }
1852    
1853    void MainWindow::on_action_remove_script() {
1854        if (!file) return;
1855        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
1856        Gtk::TreeModel::iterator it = sel->get_selected();
1857        if (it) {
1858            Gtk::TreeModel::Row row = *it;
1859            gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group];
1860            gig::Script* script     = row[m_ScriptsModel.m_col_script];
1861            Glib::ustring name      = row[m_ScriptsModel.m_col_name];
1862            try {
1863                // remove script group or script from the gig file
1864                if (group) {
1865                    // notify everybody that we're going to remove these samples
1866    //TODO:         scripts_to_be_removed_signal.emit(members);
1867                    // delete the group in the .gig file including the
1868                    // samples that belong to the group
1869                    file->DeleteScriptGroup(group);
1870                    // notify that we're done with removal
1871    //TODO:         scripts_removed_signal.emit();
1872                    file_changed();
1873                } else if (script) {
1874                    // notify everybody that we're going to remove this sample
1875    //TODO:         std::list<gig::Script*> lscripts;
1876    //TODO:         lscripts.push_back(script);
1877    //TODO:         scripts_to_be_removed_signal.emit(lscripts);
1878                    // remove sample from the .gig file
1879                    script->GetGroup()->DeleteScript(script);
1880                    // notify that we're done with removal
1881    //TODO:         scripts_removed_signal.emit();
1882                    dimreg_changed();
1883                    file_changed();
1884                }
1885                // remove respective row(s) from samples tree view
1886                m_refScriptsTreeModel->erase(it);
1887            } catch (RIFF::Exception e) {
1888                // pretend we're done with removal (i.e. to avoid dead locks)
1889    //TODO:     scripts_removed_signal.emit();
1890                // show error message
1891                Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1892                msg.run();
1893            }
1894        }
1895    }
1896    
1897  void MainWindow::on_action_add_group() {  void MainWindow::on_action_add_group() {
1898      static int __sample_indexer = 0;      static int __sample_indexer = 0;
1899      if (!file) return;      if (!file) return;
# Line 1860  void MainWindow::on_action_remove_sample Line 2263  void MainWindow::on_action_remove_sample
2263      }      }
2264  }  }
2265    
2266    // see comment on on_sample_treeview_drag_begin()
2267    void MainWindow::on_scripts_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context)
2268    {
2269        first_call_to_drag_data_get = true;
2270    }
2271    
2272    void MainWindow::on_scripts_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
2273                                                       Gtk::SelectionData& selection_data, guint, guint)
2274    {
2275        if (!first_call_to_drag_data_get) return;
2276        first_call_to_drag_data_get = false;
2277    
2278        // get selected script
2279        gig::Script* script = NULL;
2280        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewScripts.get_selection();
2281        Gtk::TreeModel::iterator it = sel->get_selected();
2282        if (it) {
2283            Gtk::TreeModel::Row row = *it;
2284            script = row[m_ScriptsModel.m_col_script];
2285        }
2286        // pass the gig::Script as pointer
2287        selection_data.set(selection_data.get_target(), 0/*unused*/,
2288                           (const guchar*)&script,
2289                           sizeof(script)/*length of data in bytes*/);
2290    }
2291    
2292  // For some reason drag_data_get gets called two times for each  // For some reason drag_data_get gets called two times for each
2293  // 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
2294  // 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 2347  void MainWindow::on_sample_label_drop_dr
2347          bool channels_changed = false;          bool channels_changed = false;
2348          if (sample->Channels == 1 && stereo_dimension) {          if (sample->Channels == 1 && stereo_dimension) {
2349              // remove the samplechannel dimension              // remove the samplechannel dimension
2350    /* commented out, because it makes it impossible building up an instrument from scratch using two separate L/R samples
2351              region->DeleteDimension(stereo_dimension);              region->DeleteDimension(stereo_dimension);
2352              channels_changed = true;              channels_changed = true;
2353              region_changed();              region_changed();
2354    */
2355          }          }
2356          dimreg_edit.set_sample(          dimreg_edit.set_sample(
2357              sample,              sample,
# Line 1986  void MainWindow::sample_name_changed(con Line 2417  void MainWindow::sample_name_changed(con
2417      }      }
2418  }  }
2419    
2420    void MainWindow::script_name_changed(const Gtk::TreeModel::Path& path,
2421                                         const Gtk::TreeModel::iterator& iter) {
2422        if (!iter) return;
2423        Gtk::TreeModel::Row row = *iter;
2424        Glib::ustring name      = row[m_ScriptsModel.m_col_name];
2425        gig::ScriptGroup* group = row[m_ScriptsModel.m_col_group];
2426        gig::Script* script     = row[m_ScriptsModel.m_col_script];
2427        gig::String gigname(gig_from_utf8(name));
2428        if (group) {
2429            if (group->Name != gigname) {
2430                group->Name = gigname;
2431                printf("script group name changed\n");
2432                file_changed();
2433            }
2434        } else if (script) {
2435            if (script->Name != gigname) {
2436                script->Name = gigname;
2437                printf("script name changed\n");
2438                file_changed();
2439            }
2440        }
2441    }
2442    
2443  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,  void MainWindow::instrument_name_changed(const Gtk::TreeModel::Path& path,
2444                                           const Gtk::TreeModel::iterator& iter) {                                           const Gtk::TreeModel::iterator& iter) {
2445      if (!iter) return;      if (!iter) return;
# Line 2020  void MainWindow::instrument_name_changed Line 2474  void MainWindow::instrument_name_changed
2474      }      }
2475  }  }
2476    
2477    void MainWindow::on_action_combine_instruments() {
2478        CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);
2479        d->show_all();
2480        d->resize(500, 400);
2481        d->run();
2482        if (d->fileWasChanged()) {
2483            // update GUI with new instrument just created
2484            add_instrument(d->newCombinedInstrument());
2485        }
2486        delete d;
2487    }
2488    
2489    void MainWindow::mergeFiles(const std::vector<std::string>& filenames) {
2490        struct _Source {
2491            std::vector<RIFF::File*> riffs;
2492            std::vector<gig::File*> gigs;
2493            
2494            ~_Source() {
2495                for (int k = 0; k < gigs.size(); ++k) delete gigs[k];
2496                for (int k = 0; k < riffs.size(); ++k) delete riffs[k];
2497                riffs.clear();
2498                gigs.clear();
2499            }
2500        } sources;
2501    
2502        if (filenames.empty())
2503            throw RIFF::Exception(_("No files selected, so nothing done."));
2504    
2505        // first open all input files (to avoid output file corruption)
2506        int i;
2507        try {
2508            for (i = 0; i < filenames.size(); ++i) {
2509                const std::string& filename = filenames[i];
2510                printf("opening file=%s\n", filename.c_str());
2511    
2512                RIFF::File* riff = new RIFF::File(filename);
2513                sources.riffs.push_back(riff);
2514    
2515                gig::File* gig = new gig::File(riff);
2516                sources.gigs.push_back(gig);
2517            }
2518        } catch (RIFF::Exception e) {
2519            throw RIFF::Exception(
2520                _("Error occurred while opening '") +
2521                filenames[i] +
2522                "': " +
2523                e.Message
2524            );
2525        } catch (...) {
2526            throw RIFF::Exception(
2527                _("Unknown exception occurred while opening '") +
2528                filenames[i] + "'"
2529            );
2530        }
2531    
2532        // now merge the opened .gig files to the main .gig file currently being
2533        // open in gigedit
2534        try {
2535            for (i = 0; i < filenames.size(); ++i) {
2536                const std::string& filename = filenames[i];
2537                printf("merging file=%s\n", filename.c_str());
2538                assert(i < sources.gigs.size());
2539    
2540                this->file->AddContentOf(sources.gigs[i]);
2541            }
2542        } catch (RIFF::Exception e) {
2543            throw RIFF::Exception(
2544                _("Error occurred while merging '") +
2545                filenames[i] +
2546                "': " +
2547                e.Message
2548            );
2549        } catch (...) {
2550            throw RIFF::Exception(
2551                _("Unknown exception occurred while merging '") +
2552                filenames[i] + "'"
2553            );
2554        }
2555    
2556        // Note: requires that this file already has a filename !
2557        this->file->Save();
2558    }
2559    
2560    void MainWindow::on_action_merge_files() {
2561        if (this->file->GetFileName().empty()) {
2562            Glib::ustring txt = _(
2563                "You seem to have a new .gig file open that has not been saved "
2564                "yet. You must save it somewhere before starting to merge it with "
2565                "other .gig files though, because during the merge operation the "
2566                "other files' sample data must be written on file level to the "
2567                "target .gig file."
2568            );
2569            Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
2570            msg.run();
2571            return;
2572        }
2573    
2574        Gtk::FileChooserDialog dialog(*this, _("Merge .gig files"));
2575        dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
2576        dialog.add_button(_("Merge"), Gtk::RESPONSE_OK);
2577        dialog.set_default_response(Gtk::RESPONSE_CANCEL);
2578    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
2579        Gtk::FileFilter filter;
2580        filter.add_pattern("*.gig");
2581    #else
2582        Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
2583        filter->add_pattern("*.gig");
2584    #endif
2585        dialog.set_filter(filter);
2586        if (current_gig_dir != "") {
2587            dialog.set_current_folder(current_gig_dir);
2588        }
2589        dialog.set_select_multiple(true);
2590    
2591        // show warning in the file picker dialog
2592        Gtk::HBox descriptionArea;
2593        descriptionArea.set_spacing(15);
2594        Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG));
2595        descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK);
2596    #if GTKMM_MAJOR_VERSION < 3
2597        view::WrapLabel description;
2598    #else
2599        Gtk::Label description;
2600        description.set_line_wrap();
2601    #endif
2602        description.set_markup(_(
2603            "\nSelect at least one .gig file that shall be merged to the .gig file "
2604            "currently being open in gigedit.\n\n"
2605            "<b>Please Note:</b> Merging with other files will modify your "
2606            "currently open .gig file on file level! And be aware that the current "
2607            "merge algorithm does not detect duplicate samples yet. So if you are "
2608            "merging files which are using equivalent sample data, those "
2609            "equivalent samples will currently be treated as separate samples and "
2610            "will accordingly be stored separately in the target .gig file!"
2611        ));
2612        descriptionArea.pack_start(description);
2613        dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK);
2614        descriptionArea.show_all();
2615    
2616        if (dialog.run() == Gtk::RESPONSE_OK) {
2617            printf("on_action_merge_files self=%x\n", Glib::Threads::Thread::self());
2618            std::vector<std::string> filenames = dialog.get_filenames();
2619    
2620            // merge the selected files to the currently open .gig file
2621            try {
2622                mergeFiles(filenames);
2623            } catch (RIFF::Exception e) {
2624                Gtk::MessageDialog msg(*this, e.Message, false, Gtk::MESSAGE_ERROR);
2625                msg.run();
2626            }
2627    
2628            // update GUI
2629            __refreshEntireGUI();        
2630        }
2631    }
2632    
2633  void MainWindow::set_file_is_shared(bool b) {  void MainWindow::set_file_is_shared(bool b) {
2634      this->file_is_shared = b;      this->file_is_shared = b;
2635    

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

  ViewVC Help
Powered by ViewVC