/[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 1265 by persson, Sun Jul 29 13:44:59 2007 UTC revision 1533 by persson, Sat Dec 1 10:21:07 2007 UTC
# Line 17  Line 17 
17   * 02110-1301 USA.   * 02110-1301 USA.
18   */   */
19    
 #include <libintl.h>  
20  #include <iostream>  #include <iostream>
21    
22  #include <gtkmm/filechooserdialog.h>  #include <gtkmm/filechooserdialog.h>
# Line 25  Line 24 
24  #include <gtkmm/stock.h>  #include <gtkmm/stock.h>
25  #include <gtkmm/targetentry.h>  #include <gtkmm/targetentry.h>
26  #include <gtkmm/main.h>  #include <gtkmm/main.h>
27    #include <gtkmm/toggleaction.h>
28    
29    #include "global.h"
30    
31  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2
32  #define ABOUT_DIALOG  #define ABOUT_DIALOG
33  #include <gtkmm/aboutdialog.h>  #include <gtkmm/aboutdialog.h>
34  #endif  #endif
35    
36    #if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION < 6) || GLIBMM_MAJOR_VERSION < 2
37    namespace Glib {
38    Glib::ustring filename_display_basename(const std::string& filename)
39    {
40        gchar* gstr = g_path_get_basename(filename.c_str());
41        Glib::ustring str(gstr);
42        g_free(gstr);
43        return Glib::filename_to_utf8(str);
44    }
45    }
46    #endif
47    
48  #include <stdio.h>  #include <stdio.h>
49  #include <sndfile.h>  #include <sndfile.h>
50    
51  #include "mainwindow.h"  #include "mainwindow.h"
52    
53  #define _(String) gettext(String)  #include "../../gfx/status_attached.xpm"
54    #include "../../gfx/status_detached.xpm"
55    
56  template<class T> inline std::string ToString(T o) {  template<class T> inline std::string ToString(T o) {
57      std::stringstream ss;      std::stringstream ss;
# Line 44  template<class T> inline std::string ToS Line 59  template<class T> inline std::string ToS
59      return ss.str();      return ss.str();
60  }  }
61    
62  MainWindow::MainWindow()  MainWindow::MainWindow() :
63        dimreg_label(_("Changes apply to:")),
64        dimreg_all_regions(_("all regions")),
65        dimreg_all_dimregs(_("all dimension splits")),
66        dimreg_stereo(_("both channels"))
67  {  {
68  //    set_border_width(5);  //    set_border_width(5);
69  //    set_default_size(400, 200);  //    set_default_size(400, 200);
# Line 74  MainWindow::MainWindow() Line 93  MainWindow::MainWindow()
93      m_TreeViewNotebook.set_size_request(300);      m_TreeViewNotebook.set_size_request(300);
94    
95      m_HPaned.add1(m_TreeViewNotebook);      m_HPaned.add1(m_TreeViewNotebook);
96      m_HPaned.add2(dimreg_edit);      dimreg_hbox.add(dimreg_label);
97        dimreg_hbox.add(dimreg_all_regions);
98        dimreg_hbox.add(dimreg_all_dimregs);
99        dimreg_stereo.set_active();
100        dimreg_hbox.add(dimreg_stereo);
101        dimreg_vbox.add(dimreg_edit);
102        dimreg_vbox.add(dimreg_hbox);
103        m_HPaned.add2(dimreg_vbox);
104    
105    
106      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, "Samples");      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, "Samples");
# Line 115  MainWindow::MainWindow() Line 141  MainWindow::MainWindow()
141                           *this, &MainWindow::on_action_quit));                           *this, &MainWindow::on_action_quit));
142      actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument")));      actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument")));
143    
144        actionGroup->add(Gtk::Action::create("MenuView", _("_View")));
145        Glib::RefPtr<Gtk::ToggleAction> toggle_action =
146            Gtk::ToggleAction::create("Statusbar", _("_Statusbar"));
147        toggle_action->set_active(true);
148        actionGroup->add(toggle_action,
149                         sigc::mem_fun(
150                             *this, &MainWindow::on_action_view_status_bar));
151    
152      action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP);      action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP);
153      actionGroup->add(Gtk::Action::create("MenuHelp",      actionGroup->add(Gtk::Action::create("MenuHelp",
154                                           action->property_label()));                                           action->property_label()));
# Line 170  MainWindow::MainWindow() Line 204  MainWindow::MainWindow()
204          "    </menu>"          "    </menu>"
205          "    <menu action='MenuInstrument'>"          "    <menu action='MenuInstrument'>"
206          "    </menu>"          "    </menu>"
207            "    <menu action='MenuView'>"
208            "      <menuitem action='Statusbar'/>"
209            "    </menu>"
210  #ifdef ABOUT_DIALOG  #ifdef ABOUT_DIALOG
211          "    <menu action='MenuHelp'>"          "    <menu action='MenuHelp'>"
212          "      <menuitem action='About'/>"          "      <menuitem action='About'/>"
# Line 199  MainWindow::MainWindow() Line 236  MainWindow::MainWindow()
236      m_VBox.pack_start(m_HPaned);      m_VBox.pack_start(m_HPaned);
237      m_VBox.pack_start(m_RegionChooser, Gtk::PACK_SHRINK);      m_VBox.pack_start(m_RegionChooser, Gtk::PACK_SHRINK);
238      m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK);      m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK);
239        m_VBox.pack_start(m_StatusBar, Gtk::PACK_SHRINK);
240    
241        // Status Bar:
242        m_StatusBar.pack_start(m_AttachedStateLabel, Gtk::PACK_SHRINK);
243        m_StatusBar.pack_start(m_AttachedStateImage, Gtk::PACK_SHRINK);
244        m_StatusBar.show();
245    
246      m_RegionChooser.signal_region_selected().connect(      m_RegionChooser.signal_region_selected().connect(
247          sigc::mem_fun(*this, &MainWindow::region_changed) );          sigc::mem_fun(*this, &MainWindow::region_changed) );
# Line 234  MainWindow::MainWindow() Line 277  MainWindow::MainWindow()
277      std::list<Gtk::TargetEntry> drag_target_gig_sample;      std::list<Gtk::TargetEntry> drag_target_gig_sample;
278      drag_target_gig_sample.push_back( Gtk::TargetEntry("gig::Sample") );      drag_target_gig_sample.push_back( Gtk::TargetEntry("gig::Sample") );
279      m_TreeViewSamples.drag_source_set(drag_target_gig_sample);      m_TreeViewSamples.drag_source_set(drag_target_gig_sample);
280        m_TreeViewSamples.signal_drag_begin().connect(
281            sigc::mem_fun(*this, &MainWindow::on_sample_treeview_drag_begin)
282        );
283      m_TreeViewSamples.signal_drag_data_get().connect(      m_TreeViewSamples.signal_drag_data_get().connect(
284          sigc::mem_fun(*this, &MainWindow::on_sample_treeview_drag_data_get)          sigc::mem_fun(*this, &MainWindow::on_sample_treeview_drag_data_get)
285      );      );
# Line 242  MainWindow::MainWindow() Line 288  MainWindow::MainWindow()
288          sigc::mem_fun(*this, &MainWindow::on_sample_label_drop_drag_data_received)          sigc::mem_fun(*this, &MainWindow::on_sample_label_drop_drag_data_received)
289      );      );
290      dimreg_edit.signal_dimreg_changed().connect(      dimreg_edit.signal_dimreg_changed().connect(
291          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::hide(sigc::mem_fun(*this, &MainWindow::file_changed)));
292      m_RegionChooser.signal_instrument_changed().connect(      m_RegionChooser.signal_instrument_changed().connect(
293          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
294      m_DimRegionChooser.signal_region_changed().connect(      m_DimRegionChooser.signal_region_changed().connect(
295          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
296      instrumentProps.signal_instrument_changed().connect(      instrumentProps.signal_instrument_changed().connect(
297          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
298    
299        dimreg_edit.signal_dimreg_to_be_changed().connect(
300            dimreg_to_be_changed_signal.make_slot());
301        dimreg_edit.signal_dimreg_changed().connect(
302            dimreg_changed_signal.make_slot());
303        dimreg_edit.signal_sample_ref_changed().connect(
304            sample_ref_changed_signal.make_slot());
305    
306        m_RegionChooser.signal_instrument_struct_to_be_changed().connect(
307            sigc::hide(
308                sigc::bind(
309                    file_structure_to_be_changed_signal.make_slot(),
310                    sigc::ref(this->file)
311                )
312            )
313        );
314        m_RegionChooser.signal_instrument_struct_changed().connect(
315            sigc::hide(
316                sigc::bind(
317                    file_structure_changed_signal.make_slot(),
318                    sigc::ref(this->file)
319                )
320            )
321        );
322        m_RegionChooser.signal_region_to_be_changed().connect(
323            region_to_be_changed_signal.make_slot());
324        m_RegionChooser.signal_region_changed_signal().connect(
325            region_changed_signal.make_slot());
326    
327        dimreg_all_regions.signal_toggled().connect(
328            sigc::mem_fun(*this, &MainWindow::update_dimregs));
329        dimreg_all_dimregs.signal_toggled().connect(
330            sigc::mem_fun(*this, &MainWindow::dimreg_all_dimregs_toggled));
331        dimreg_stereo.signal_toggled().connect(
332            sigc::mem_fun(*this, &MainWindow::update_dimregs));
333    
334      file = 0;      file = 0;
335      file_is_changed = false;      file_is_changed = false;
336        set_file_is_shared(false);
337    
338      show_all_children();      show_all_children();
339    
340        // start with a new gig file by default
341        on_action_file_new();
342  }  }
343    
344  MainWindow::~MainWindow()  MainWindow::~MainWindow()
# Line 261  MainWindow::~MainWindow() Line 347  MainWindow::~MainWindow()
347    
348  bool MainWindow::on_delete_event(GdkEventAny* event)  bool MainWindow::on_delete_event(GdkEventAny* event)
349  {  {
350      return file_is_changed && !close_confirmation_dialog();      return !file_is_shared && file_is_changed && !close_confirmation_dialog();
351  }  }
352    
353  void MainWindow::on_action_quit()  void MainWindow::on_action_quit()
354  {  {
355      if (file_is_changed && !close_confirmation_dialog()) return;      if (!file_is_shared && file_is_changed && !close_confirmation_dialog()) return;
356      hide();      hide();
357  }  }
358    
# Line 275  void MainWindow::region_changed() Line 361  void MainWindow::region_changed()
361      m_DimRegionChooser.set_region(m_RegionChooser.get_region());      m_DimRegionChooser.set_region(m_RegionChooser.get_region());
362  }  }
363    
364  void MainWindow::dimreg_changed()  gig::Instrument* MainWindow::get_instrument()
 {  
     dimreg_edit.set_dim_region(m_DimRegionChooser.get_dimregion());  
 }  
   
 void MainWindow::on_sel_change()  
365  {  {
366        gig::Instrument* instrument = 0;
367      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();
368    
369      Gtk::TreeModel::iterator it = tree_sel_ref->get_selected();      Gtk::TreeModel::iterator it = tree_sel_ref->get_selected();
370      if (it) {      if (it) {
371          Gtk::TreeModel::Row row = *it;          Gtk::TreeModel::Row row = *it;
372          std::cout << row[m_Columns.m_col_name] << std::endl;          instrument = row[m_Columns.m_col_instr];
373        }
374        return instrument;
375    }
376    
377          m_RegionChooser.set_instrument(row[m_Columns.m_col_instr]);  void MainWindow::add_region_to_dimregs(gig::Region* region, bool stereo, bool all_dimregs)
378    {
379        if (all_dimregs) {
380            for (int i = 0 ; i < region->DimensionRegions ; i++) {
381                if (region->pDimensionRegions[i]) {
382                    dimreg_edit.dimregs.insert(region->pDimensionRegions[i]);
383                }
384            }
385      } else {      } else {
386          m_RegionChooser.set_instrument(0);          m_DimRegionChooser.get_dimregions(region, stereo, dimreg_edit.dimregs);
387      }      }
388  }  }
389    
390    void MainWindow::update_dimregs()
391    {
392        dimreg_edit.dimregs.clear();
393        bool all_regions = dimreg_all_regions.get_active();
394        bool stereo = dimreg_stereo.get_active();
395        bool all_dimregs = dimreg_all_dimregs.get_active();
396    
397        if (all_regions) {
398            gig::Instrument* instrument = get_instrument();
399            if (instrument) {
400                for (gig::Region* region = instrument->GetFirstRegion() ;
401                     region ;
402                     region = instrument->GetNextRegion()) {
403                    add_region_to_dimregs(region, stereo, all_dimregs);
404                }
405            }
406        } else {
407            gig::Region* region = m_RegionChooser.get_region();
408            if (region) {
409                add_region_to_dimregs(region, stereo, all_dimregs);
410            }
411        }
412    }
413    
414    void MainWindow::dimreg_all_dimregs_toggled()
415    {
416        dimreg_stereo.set_sensitive(!dimreg_all_dimregs.get_active());
417        update_dimregs();
418    }
419    
420    void MainWindow::dimreg_changed()
421    {
422        update_dimregs();
423        dimreg_edit.set_dim_region(m_DimRegionChooser.get_dimregion());
424    }
425    
426    void MainWindow::on_sel_change()
427    {
428        m_RegionChooser.set_instrument(get_instrument());
429    }
430    
431  void loader_progress_callback(gig::progress_t* progress)  void loader_progress_callback(gig::progress_t* progress)
432  {  {
433      Loader* loader = static_cast<Loader*>(progress->custom);      Loader* loader = static_cast<Loader*>(progress->custom);
# Line 380  void MainWindow::__clear() { Line 513  void MainWindow::__clear() {
513      m_refTreeModel->clear();      m_refTreeModel->clear();
514      m_refSamplesTreeModel->clear();      m_refSamplesTreeModel->clear();
515      // free libgig's gig::File instance      // free libgig's gig::File instance
516      if (file) {      if (file && !file_is_shared) delete file;
517          delete file;      file = NULL;
518          file = NULL;      set_file_is_shared(false);
     }  
519  }  }
520    
521  void MainWindow::on_action_file_new()  void MainWindow::on_action_file_new()
522  {  {
523      if (file_is_changed && !close_confirmation_dialog()) return;      if (!file_is_shared && file_is_changed && !close_confirmation_dialog()) return;
524    
525        if (file_is_shared && !leaving_shared_mode_dialog()) return;
526    
527      // clear all GUI elements      // clear all GUI elements
528      __clear();      __clear();
# Line 407  bool MainWindow::close_confirmation_dial Line 541  bool MainWindow::close_confirmation_dial
541                                   Glib::filename_display_basename(filename).c_str());                                   Glib::filename_display_basename(filename).c_str());
542      Gtk::MessageDialog dialog(*this, msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);      Gtk::MessageDialog dialog(*this, msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
543      g_free(msg);      g_free(msg);
544    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2
545      dialog.set_secondary_text(_("If you close without saving, your changes will be lost."));      dialog.set_secondary_text(_("If you close without saving, your changes will be lost."));
546    #endif
547      dialog.add_button(_("Close _Without Saving"), Gtk::RESPONSE_NO);      dialog.add_button(_("Close _Without Saving"), Gtk::RESPONSE_NO);
548      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
549      dialog.add_button(file_has_name ? Gtk::Stock::SAVE : Gtk::Stock::SAVE_AS, Gtk::RESPONSE_YES);      dialog.add_button(file_has_name ? Gtk::Stock::SAVE : Gtk::Stock::SAVE_AS, Gtk::RESPONSE_YES);
550      dialog.set_default_response(Gtk::RESPONSE_YES);      dialog.set_default_response(Gtk::RESPONSE_YES);
551      int response = dialog.run();      int response = dialog.run();
552        dialog.hide();
553      if (response == Gtk::RESPONSE_YES) return file_save();      if (response == Gtk::RESPONSE_YES) return file_save();
554      return response != Gtk::RESPONSE_CANCEL;      return response != Gtk::RESPONSE_CANCEL;
555  }  }
556    
557    bool MainWindow::leaving_shared_mode_dialog() {
558        Glib::ustring msg = _("Detach from sampler and proceed working stand-alone?");
559        Gtk::MessageDialog dialog(*this, msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
560    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2
561        dialog.set_secondary_text(
562            _("If you proceed to work on another instrument file, it won't be "
563              "used by the sampler until you tell the sampler explicitly to "
564              "load it.")
565       );
566    #endif
567        dialog.add_button(_("_Yes, Detach"), Gtk::RESPONSE_YES);
568        dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
569        dialog.set_default_response(Gtk::RESPONSE_CANCEL);
570        int response = dialog.run();
571        dialog.hide();
572        return response == Gtk::RESPONSE_YES;
573    }
574    
575  void MainWindow::on_action_file_open()  void MainWindow::on_action_file_open()
576  {  {
577      if (file_is_changed && !close_confirmation_dialog()) return;      if (!file_is_shared && file_is_changed && !close_confirmation_dialog()) return;
578    
579        if (file_is_shared && !leaving_shared_mode_dialog()) return;
580    
581      Gtk::FileChooserDialog dialog(*this, _("Open file"));      Gtk::FileChooserDialog dialog(*this, _("Open file"));
582      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
# Line 434  void MainWindow::on_action_file_open() Line 591  void MainWindow::on_action_file_open()
591      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
592          std::string filename = dialog.get_filename();          std::string filename = dialog.get_filename();
593          printf("filename=%s\n", filename.c_str());          printf("filename=%s\n", filename.c_str());
         __clear();  
594          printf("on_action_file_open self=%x\n", Glib::Thread::self());          printf("on_action_file_open self=%x\n", Glib::Thread::self());
595          load_file(filename.c_str());          load_file(filename.c_str());
596          current_dir = Glib::path_get_dirname(filename);          current_dir = Glib::path_get_dirname(filename);
# Line 443  void MainWindow::on_action_file_open() Line 599  void MainWindow::on_action_file_open()
599    
600  void MainWindow::load_file(const char* name)  void MainWindow::load_file(const char* name)
601  {  {
602        __clear();
603      load_dialog = new LoadDialog("Loading...", *this);      load_dialog = new LoadDialog("Loading...", *this);
604      load_dialog->show_all();      load_dialog->show_all();
605      loader = new Loader(strdup(name));      loader = new Loader(strdup(name));
# Line 460  void MainWindow::load_instrument(gig::In Line 617  void MainWindow::load_instrument(gig::In
617          msg.run();          msg.run();
618          Gtk::Main::quit();          Gtk::Main::quit();
619      }      }
620        // clear all GUI elements
621        __clear();
622        // load the instrument
623      gig::File* pFile = (gig::File*) instr->GetParent();      gig::File* pFile = (gig::File*) instr->GetParent();
624      load_gig(pFile, 0 /*file name*/);      load_gig(pFile, 0 /*file name*/, true /*shared instrument*/);
625      //TODO: automatically select the given instrument      //TODO: automatically select the given instrument
626  }  }
627    
# Line 483  void MainWindow::on_action_file_save() Line 643  void MainWindow::on_action_file_save()
643      file_save();      file_save();
644  }  }
645    
646  bool MainWindow::file_save()  bool MainWindow::check_if_savable()
647  {  {
648      if (!file) return false;      if (!file) return false;
649      if (!file_has_name) return file_save_as();  
650        if (!file->GetFirstSample()) {
651            Gtk::MessageDialog(*this, _("The file could not be saved "
652                                        "because it contains no samples"),
653                               false, Gtk::MESSAGE_ERROR).run();
654            return false;
655        }
656    
657        for (gig::Instrument* instrument = file->GetFirstInstrument() ; instrument ;
658             instrument = file->GetNextInstrument()) {
659            if (!instrument->GetFirstRegion()) {
660                Gtk::MessageDialog(*this, _("The file could not be saved "
661                                            "because there are instruments "
662                                            "that have no regions"),
663                                   false, Gtk::MESSAGE_ERROR).run();
664                return false;
665            }
666        }
667        return true;
668    }
669    
670    bool MainWindow::file_save()
671    {
672        if (!check_if_savable()) return false;
673        if (!file_is_shared && !file_has_name) return file_save_as();
674    
675      std::cout << "Saving file\n" << std::flush;      std::cout << "Saving file\n" << std::flush;
676        file_structure_to_be_changed_signal.emit(this->file);
677      try {      try {
678          file->Save();          file->Save();
679          if (file_is_changed) {          if (file_is_changed) {
# Line 496  bool MainWindow::file_save() Line 681  bool MainWindow::file_save()
681              file_is_changed = false;              file_is_changed = false;
682          }          }
683      } catch (RIFF::Exception e) {      } catch (RIFF::Exception e) {
684          Glib::ustring txt = "Could not save file: " + e.Message;          file_structure_changed_signal.emit(this->file);
685            Glib::ustring txt = _("Could not save file: ") + e.Message;
686          Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);          Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
687          msg.run();          msg.run();
688          return false;          return false;
689      }      }
690      std::cout << "Saving file done\n" << std::flush;      std::cout << "Saving file done\n" << std::flush;
691      __import_queued_samples();      __import_queued_samples();
692        file_structure_changed_signal.emit(this->file);
693      return true;      return true;
694  }  }
695    
696  void MainWindow::on_action_file_save_as()  void MainWindow::on_action_file_save_as()
697  {  {
698        if (!check_if_savable()) return;
699      file_save_as();      file_save_as();
700  }  }
701    
702  bool MainWindow::file_save_as()  bool MainWindow::file_save_as()
703  {  {
     if (!file) return false;  
704      Gtk::FileChooserDialog dialog(*this, _("Save as"), Gtk::FILE_CHOOSER_ACTION_SAVE);      Gtk::FileChooserDialog dialog(*this, _("Save as"), Gtk::FILE_CHOOSER_ACTION_SAVE);
705      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
706      dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);      dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
# Line 535  bool MainWindow::file_save_as() Line 722  bool MainWindow::file_save_as()
722      dialog.set_current_name(Glib::filename_display_basename(filename));      dialog.set_current_name(Glib::filename_display_basename(filename));
723    
724      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
725            file_structure_to_be_changed_signal.emit(this->file);
726          try {          try {
727              std::string filename = dialog.get_filename();              std::string filename = dialog.get_filename();
728              if (!Glib::str_has_suffix(filename, ".gig")) {              if (!Glib::str_has_suffix(filename, ".gig")) {
# Line 548  bool MainWindow::file_save_as() Line 736  bool MainWindow::file_save_as()
736              file_has_name = true;              file_has_name = true;
737              file_is_changed = false;              file_is_changed = false;
738          } catch (RIFF::Exception e) {          } catch (RIFF::Exception e) {
739              Glib::ustring txt = "Could not save file: " + e.Message;              file_structure_changed_signal.emit(this->file);
740                Glib::ustring txt = _("Could not save file: ") + e.Message;
741              Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
742              msg.run();              msg.run();
743              return false;              return false;
744          }          }
745          __import_queued_samples();          __import_queued_samples();
746            file_structure_changed_signal.emit(this->file);
747          return true;          return true;
748      }      }
749      return false;      return false;
# Line 644  void MainWindow::__import_queued_samples Line 834  void MainWindow::__import_queued_samples
834      }      }
835      // show error message box when some sample(s) could not be imported      // show error message box when some sample(s) could not be imported
836      if (error_files.size()) {      if (error_files.size()) {
837          Glib::ustring txt = "Could not import the following sample(s):\n" + error_files;          Glib::ustring txt = _("Could not import the following sample(s):\n") + error_files;
838          Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);          Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
839          msg.run();          msg.run();
840      }      }
# Line 661  void MainWindow::on_action_help_about() Line 851  void MainWindow::on_action_help_about()
851  #ifdef ABOUT_DIALOG  #ifdef ABOUT_DIALOG
852      Gtk::AboutDialog dialog;      Gtk::AboutDialog dialog;
853      dialog.set_version(VERSION);      dialog.set_version(VERSION);
854        dialog.set_copyright("Copyright (C) 2006,2007 Andreas Persson");
855        dialog.set_comments(
856            "Released under the GNU General Public License.\n"
857            "\n"
858            "Please notice that this is still a very young instrument editor. "
859            "So better backup your Gigasampler files before editing them with "
860            "this application.\n"
861            "\n"
862            "Please report bugs to: http://bugs.linuxsampler.org"
863        );
864        dialog.set_website("http://www.linuxsampler.org");
865        dialog.set_website_label("http://www.linuxsampler.org");
866      dialog.run();      dialog.run();
867  #endif  #endif
868  }  }
# Line 721  void PropDialog::set_info(DLS::Info* inf Line 923  void PropDialog::set_info(DLS::Info* inf
923      entry[15].set_text(info->Subject);      entry[15].set_text(info->Subject);
924  }  }
925    
926    void InstrumentProps::set_IsDrum(bool value)
927    {
928        instrument->IsDrum = value;
929    }
930    
931    void InstrumentProps::set_MIDIBank(uint16_t value)
932    {
933        instrument->MIDIBank = value;
934    }
935    
936    void InstrumentProps::set_MIDIProgram(uint32_t value)
937    {
938        instrument->MIDIProgram = value;
939    }
940    
941    void InstrumentProps::set_DimensionKeyRange_low(uint8_t value)
942    {
943        instrument->DimensionKeyRange.low = value;
944        if (value > instrument->DimensionKeyRange.high) {
945            eDimensionKeyRangeHigh.set_value(value);
946        }
947    }
948    
949    void InstrumentProps::set_DimensionKeyRange_high(uint8_t value)
950    {
951        instrument->DimensionKeyRange.high = value;
952        if (value < instrument->DimensionKeyRange.low) {
953            eDimensionKeyRangeLow.set_value(value);
954        }
955    }
956    
957  void InstrumentProps::add_prop(BoolEntry& boolentry)  void InstrumentProps::add_prop(BoolEntry& boolentry)
958  {  {
959      table.attach(boolentry.widget, 0, 2, rowno, rowno + 1,      table.attach(boolentry.widget, 0, 2, rowno, rowno + 1,
960                   Gtk::FILL, Gtk::SHRINK);                   Gtk::FILL, Gtk::SHRINK);
961      rowno++;      rowno++;
     boolentry.signal_changed_by_user().connect(instrument_changed.make_slot());  
962  }  }
963    
964  void InstrumentProps::add_prop(BoolEntryPlus6& boolentry)  void InstrumentProps::add_prop(BoolEntryPlus6& boolentry)
# Line 734  void InstrumentProps::add_prop(BoolEntry Line 966  void InstrumentProps::add_prop(BoolEntry
966      table.attach(boolentry.widget, 0, 2, rowno, rowno + 1,      table.attach(boolentry.widget, 0, 2, rowno, rowno + 1,
967                   Gtk::FILL, Gtk::SHRINK);                   Gtk::FILL, Gtk::SHRINK);
968      rowno++;      rowno++;
     boolentry.signal_changed_by_user().connect(instrument_changed.make_slot());  
969  }  }
970    
971  void InstrumentProps::add_prop(LabelWidget& prop)  void InstrumentProps::add_prop(LabelWidget& prop)
# Line 744  void InstrumentProps::add_prop(LabelWidg Line 975  void InstrumentProps::add_prop(LabelWidg
975      table.attach(prop.widget, 1, 2, rowno, rowno + 1,      table.attach(prop.widget, 1, 2, rowno, rowno + 1,
976                   Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);                   Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
977      rowno++;      rowno++;
     prop.signal_changed_by_user().connect(instrument_changed.make_slot());  
978  }  }
979    
980  InstrumentProps::InstrumentProps()  InstrumentProps::InstrumentProps()
# Line 761  InstrumentProps::InstrumentProps() Line 991  InstrumentProps::InstrumentProps()
991        ePitchbendRange("Pitchbend range", 0, 12),        ePitchbendRange("Pitchbend range", 0, 12),
992        ePianoReleaseMode("Piano release mode"),        ePianoReleaseMode("Piano release mode"),
993        eDimensionKeyRangeLow("Dimension key range low"),        eDimensionKeyRangeLow("Dimension key range low"),
994        eDimensionKeyRangeHigh("Dimension key range high")        eDimensionKeyRangeHigh("Dimension key range high"),
995          update_model(0)
996  {  {
997      set_title("Instrument properties");      set_title("Instrument properties");
998    
999        connect(eIsDrum, &InstrumentProps::set_IsDrum);
1000        connect(eMIDIBank, &InstrumentProps::set_MIDIBank);
1001        connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram);
1002        connect(eAttenuation, &gig::Instrument::Attenuation);
1003        connect(eGainPlus6, &gig::Instrument::Attenuation);
1004        connect(eEffectSend, &gig::Instrument::EffectSend);
1005        connect(eFineTune, &gig::Instrument::FineTune);
1006        connect(ePitchbendRange, &gig::Instrument::PitchbendRange);
1007        connect(ePianoReleaseMode, &gig::Instrument::PianoReleaseMode);
1008        connect(eDimensionKeyRangeLow,
1009                &InstrumentProps::set_DimensionKeyRange_low);
1010        connect(eDimensionKeyRangeHigh,
1011                &InstrumentProps::set_DimensionKeyRange_high);
1012    
1013      rowno = 0;      rowno = 0;
1014      table.set_col_spacings(5);      table.set_col_spacings(5);
1015    
# Line 781  InstrumentProps::InstrumentProps() Line 1026  InstrumentProps::InstrumentProps()
1026      add_prop(eDimensionKeyRangeLow);      add_prop(eDimensionKeyRangeLow);
1027      add_prop(eDimensionKeyRangeHigh);      add_prop(eDimensionKeyRangeHigh);
1028    
     eDimensionKeyRangeLow.signal_changed_by_user().connect(  
         sigc::mem_fun(*this, &InstrumentProps::key_range_low_changed));  
     eDimensionKeyRangeHigh.signal_changed_by_user().connect(  
         sigc::mem_fun(*this, &InstrumentProps::key_range_high_changed));  
   
1029      add(vbox);      add(vbox);
1030      table.set_border_width(5);      table.set_border_width(5);
1031      vbox.pack_start(table);      vbox.pack_start(table);
# Line 808  InstrumentProps::InstrumentProps() Line 1048  InstrumentProps::InstrumentProps()
1048    
1049  void InstrumentProps::set_instrument(gig::Instrument* instrument)  void InstrumentProps::set_instrument(gig::Instrument* instrument)
1050  {  {
1051      eName.set_ptr(&instrument->pInfo->Name);      this->instrument = instrument;
     eIsDrum.set_ptr(&instrument->IsDrum);  
     eMIDIBank.set_ptr(&instrument->MIDIBank);  
     eMIDIProgram.set_ptr(&instrument->MIDIProgram);  
     eAttenuation.set_ptr(&instrument->Attenuation);  
     eGainPlus6.set_ptr(&instrument->Attenuation);  
     eEffectSend.set_ptr(&instrument->EffectSend);  
     eFineTune.set_ptr(&instrument->FineTune);  
     ePitchbendRange.set_ptr(&instrument->PitchbendRange);  
     ePianoReleaseMode.set_ptr(&instrument->PianoReleaseMode);  
     eDimensionKeyRangeLow.set_ptr(0);  
     eDimensionKeyRangeHigh.set_ptr(0);  
     eDimensionKeyRangeLow.set_ptr(&instrument->DimensionKeyRange.low);  
     eDimensionKeyRangeHigh.set_ptr(&instrument->DimensionKeyRange.high);  
 }  
   
 void InstrumentProps::key_range_low_changed()  
 {  
     double l = eDimensionKeyRangeLow.get_value();  
     double h = eDimensionKeyRangeHigh.get_value();  
     if (h < l) eDimensionKeyRangeHigh.set_value(l);  
 }  
1052    
1053  void InstrumentProps::key_range_high_changed()      update_model++;
1054  {      eName.set_ptr(&instrument->pInfo->Name);
1055      double l = eDimensionKeyRangeLow.get_value();      eIsDrum.set_value(instrument->IsDrum);
1056      double h = eDimensionKeyRangeHigh.get_value();      eMIDIBank.set_value(instrument->MIDIBank);
1057      if (h < l) eDimensionKeyRangeLow.set_value(h);      eMIDIProgram.set_value(instrument->MIDIProgram);
1058        eAttenuation.set_value(instrument->Attenuation);
1059        eGainPlus6.set_value(instrument->Attenuation);
1060        eEffectSend.set_value(instrument->EffectSend);
1061        eFineTune.set_value(instrument->FineTune);
1062        ePitchbendRange.set_value(instrument->PitchbendRange);
1063        ePianoReleaseMode.set_value(instrument->PianoReleaseMode);
1064        eDimensionKeyRangeLow.set_value(instrument->DimensionKeyRange.low);
1065        eDimensionKeyRangeHigh.set_value(instrument->DimensionKeyRange.high);
1066        update_model--;
1067  }  }
1068    
1069  sigc::signal<void> InstrumentProps::signal_instrument_changed()  sigc::signal<void>& InstrumentProps::signal_instrument_changed()
1070  {  {
1071      return instrument_changed;      return instrument_changed;
1072  }  }
# Line 851  void MainWindow::file_changed() Line 1079  void MainWindow::file_changed()
1079      }      }
1080  }  }
1081    
1082  void MainWindow::load_gig(gig::File* gig, const char* filename)  void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument)
1083  {  {
1084      file = 0;      file = 0;
1085        set_file_is_shared(isSharedInstrument);
1086    
1087      this->filename = filename ? filename : _("Unsaved Gig File");      this->filename = filename ? filename : _("Unsaved Gig File");
1088      set_title(Glib::filename_display_basename(this->filename));      set_title(Glib::filename_display_basename(this->filename));
# Line 916  void MainWindow::load_gig(gig::File* gig Line 1145  void MainWindow::load_gig(gig::File* gig
1145    
1146  void MainWindow::show_instr_props()  void MainWindow::show_instr_props()
1147  {  {
1148      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();      gig::Instrument* instrument = get_instrument();
1149      Gtk::TreeModel::iterator it = tree_sel_ref->get_selected();      if (instrument)
     if (it)  
1150      {      {
1151          Gtk::TreeModel::Row row = *it;          instrumentProps.set_instrument(instrument);
1152          if (row[m_Columns.m_col_instr])          instrumentProps.show();
1153          {          instrumentProps.deiconify();
1154              instrumentProps.set_instrument(row[m_Columns.m_col_instr]);      }
1155              instrumentProps.show();  }
1156              instrumentProps.deiconify();  
1157          }  void MainWindow::on_action_view_status_bar() {
1158        Gtk::CheckMenuItem* item =
1159            dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar"));
1160        if (!item) {
1161            std::cerr << "/MenuBar/MenuView/Statusbar == NULL\n";
1162            return;
1163      }      }
1164        if (item->get_active()) m_StatusBar.show();
1165        else                    m_StatusBar.hide();
1166  }  }
1167    
1168  void MainWindow::on_button_release(GdkEventButton* button)  void MainWindow::on_button_release(GdkEventButton* button)
# Line 987  void MainWindow::on_action_add_instrumen Line 1222  void MainWindow::on_action_add_instrumen
1222    
1223  void MainWindow::on_action_remove_instrument() {  void MainWindow::on_action_remove_instrument() {
1224      if (!file) return;      if (!file) return;
1225        if (file_is_shared) {
1226            Gtk::MessageDialog msg(
1227                *this,
1228                 _("You cannot delete an instrument from this file, since it's "
1229                   "currently used by the sampler."),
1230                 false, Gtk::MESSAGE_INFO
1231            );
1232            msg.run();
1233            return;
1234        }
1235    
1236      Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection();      Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection();
1237      Gtk::TreeModel::iterator it = sel->get_selected();      Gtk::TreeModel::iterator it = sel->get_selected();
1238      if (it) {      if (it) {
# Line 1122  void MainWindow::on_action_add_sample() Line 1368  void MainWindow::on_action_add_sample()
1368                  {                  {
1369                      sample->MIDIUnityNote = instrument.basenote;                      sample->MIDIUnityNote = instrument.basenote;
1370    
1371    #if HAVE_SF_INSTRUMENT_LOOPS
1372                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {
1373                          sample->Loops = 1;                          sample->Loops = 1;
1374    
# Line 1141  void MainWindow::on_action_add_sample() Line 1388  void MainWindow::on_action_add_sample()
1388                          sample->LoopPlayCount = instrument.loops[0].count;                          sample->LoopPlayCount = instrument.loops[0].count;
1389                          sample->LoopSize = sample->LoopEnd - sample->LoopStart + 1;                          sample->LoopSize = sample->LoopEnd - sample->LoopStart + 1;
1390                      }                      }
1391    #endif
1392                  }                  }
1393    
1394                  // schedule resizing the sample (which will be done                  // schedule resizing the sample (which will be done
# Line 1171  void MainWindow::on_action_add_sample() Line 1419  void MainWindow::on_action_add_sample()
1419          }          }
1420          // show error message box when some file(s) could not be opened / added          // show error message box when some file(s) could not be opened / added
1421          if (error_files.size()) {          if (error_files.size()) {
1422              Glib::ustring txt = "Could not add the following sample(s):\n" + error_files;              Glib::ustring txt = _("Could not add the following sample(s):\n") + error_files;
1423              Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
1424              msg.run();              msg.run();
1425          }          }
# Line 1197  void MainWindow::on_action_remove_sample Line 1445  void MainWindow::on_action_remove_sample
1445                       pSample; pSample = group->GetNextSample()) {                       pSample; pSample = group->GetNextSample()) {
1446                      members.push_back(pSample);                      members.push_back(pSample);
1447                  }                  }
1448                    // notify everybody that we're going to remove these samples
1449                    samples_to_be_removed_signal.emit(members);
1450                  // delete the group in the .gig file including the                  // delete the group in the .gig file including the
1451                  // samples that belong to the group                  // samples that belong to the group
1452                  file->DeleteGroup(group);                  file->DeleteGroup(group);
1453                    // notify that we're done with removal
1454                    samples_removed_signal.emit();
1455                  // if sample(s) were just previously added, remove                  // if sample(s) were just previously added, remove
1456                  // them from the import queue                  // them from the import queue
1457                  for (std::list<gig::Sample*>::iterator member = members.begin();                  for (std::list<gig::Sample*>::iterator member = members.begin();
# Line 1216  void MainWindow::on_action_remove_sample Line 1468  void MainWindow::on_action_remove_sample
1468                  }                  }
1469                  file_changed();                  file_changed();
1470              } else if (sample) {              } else if (sample) {
1471                    // notify everybody that we're going to remove this sample
1472                    std::list<gig::Sample*> lsamples;
1473                    lsamples.push_back(sample);
1474                    samples_to_be_removed_signal.emit(lsamples);
1475                  // remove sample from the .gig file                  // remove sample from the .gig file
1476                  file->DeleteSample(sample);                  file->DeleteSample(sample);
1477                    // notify that we're done with removal
1478                    samples_removed_signal.emit();
1479                  // if sample was just previously added, remove it from                  // if sample was just previously added, remove it from
1480                  // the import queue                  // the import queue
1481                  for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin();                  for (std::list<SampleImportItem>::iterator iter = m_SampleImportQueue.begin();
# Line 1229  void MainWindow::on_action_remove_sample Line 1487  void MainWindow::on_action_remove_sample
1487                          break;                          break;
1488                      }                      }
1489                  }                  }
1490                    dimreg_changed();
1491                  file_changed();                  file_changed();
1492              }              }
1493              // remove respective row(s) from samples tree view              // remove respective row(s) from samples tree view
1494              m_refSamplesTreeModel->erase(it);              m_refSamplesTreeModel->erase(it);
1495          } catch (RIFF::Exception e) {          } catch (RIFF::Exception e) {
1496                // pretend we're done with removal (i.e. to avoid dead locks)
1497                samples_removed_signal.emit();
1498                // show error message
1499              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1500              msg.run();              msg.run();
1501          }          }
1502      }      }
1503  }  }
1504    
1505    // For some reason drag_data_get gets called two times for each
1506    // drag'n'drop (at least when target is an Entry). This work-around
1507    // makes sure the code in drag_data_get and drop_drag_data_received is
1508    // only executed once, as drag_begin only gets called once.
1509    void MainWindow::on_sample_treeview_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context)
1510    {
1511        first_call_to_drag_data_get = true;
1512    }
1513    
1514  void MainWindow::on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,  void MainWindow::on_sample_treeview_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&,
1515                                                    Gtk::SelectionData& selection_data, guint, guint)                                                    Gtk::SelectionData& selection_data, guint, guint)
1516  {  {
1517        if (!first_call_to_drag_data_get) return;
1518        first_call_to_drag_data_get = false;
1519    
1520      // get selected sample      // get selected sample
1521      gig::Sample* sample = NULL;      gig::Sample* sample = NULL;
1522      Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection();      Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeViewSamples.get_selection();
# Line 1263  void MainWindow::on_sample_label_drop_dr Line 1537  void MainWindow::on_sample_label_drop_dr
1537      gig::Sample* sample = *((gig::Sample**) selection_data.get_data());      gig::Sample* sample = *((gig::Sample**) selection_data.get_data());
1538    
1539      if (sample && selection_data.get_length() == sizeof(gig::Sample*)) {      if (sample && selection_data.get_length() == sizeof(gig::Sample*)) {
1540          if (dimreg_edit.set_sample(sample)) {          std::cout << "Drop received sample \"" <<
1541              std::cout << "Drop received sample \"" <<              sample->pInfo->Name << "\"" << std::endl;
1542                  sample->pInfo->Name << "\"" << std::endl;          // drop success
1543              // drop success          context->drop_reply(true, time);
1544              context->drop_reply(true, time);  
1545              return;          //TODO: we should better move most of the following code to DimRegionEdit::set_sample()
1546    
1547            // notify everybody that we're going to alter the region
1548            gig::Region* region = m_RegionChooser.get_region();
1549            region_to_be_changed_signal.emit(region);
1550    
1551            // find the samplechannel dimension
1552            gig::dimension_def_t* stereo_dimension = 0;
1553            for (int i = 0 ; i < region->Dimensions ; i++) {
1554                if (region->pDimensionDefinitions[i].dimension ==
1555                    gig::dimension_samplechannel) {
1556                    stereo_dimension = &region->pDimensionDefinitions[i];
1557                    break;
1558                }
1559            }
1560            bool channels_changed = false;
1561            if (sample->Channels == 1 && stereo_dimension) {
1562                // remove the samplechannel dimension
1563                region->DeleteDimension(stereo_dimension);
1564                channels_changed = true;
1565                region_changed();
1566            }
1567            dimreg_edit.set_sample(sample);
1568    
1569            if (sample->Channels == 2 && !stereo_dimension) {
1570                // add samplechannel dimension
1571                gig::dimension_def_t dim;
1572                dim.dimension = gig::dimension_samplechannel;
1573                dim.bits = 1;
1574                dim.zones = 2;
1575                region->AddDimension(&dim);
1576                channels_changed = true;
1577                region_changed();
1578            }
1579            if (channels_changed) {
1580                // unmap all samples with wrong number of channels
1581                // TODO: maybe there should be a warning dialog for this
1582                for (int i = 0 ; i < region->DimensionRegions ; i++) {
1583                    gig::DimensionRegion* d = region->pDimensionRegions[i];
1584                    if (d->pSample && d->pSample->Channels != sample->Channels) {
1585                        gig::Sample* oldref = d->pSample;
1586                        d->pSample = NULL;
1587                        sample_ref_changed_signal.emit(oldref, NULL);
1588                    }
1589                }
1590          }          }
1591    
1592            // notify we're done with altering
1593            region_changed_signal.emit(region);
1594    
1595            file_changed();
1596    
1597            return;
1598      }      }
1599      // drop failed      // drop failed
1600      context->drop_reply(false, time);      context->drop_reply(false, time);
# Line 1308  void MainWindow::instrument_name_changed Line 1633  void MainWindow::instrument_name_changed
1633          file_changed();          file_changed();
1634      }      }
1635  }  }
1636    
1637    void MainWindow::set_file_is_shared(bool b) {
1638        this->file_is_shared = b;
1639    
1640        if (file_is_shared) {
1641            m_AttachedStateLabel.set_label(_("live-mode"));
1642            m_AttachedStateImage.set(
1643                Gdk::Pixbuf::create_from_xpm_data(status_attached_xpm)
1644            );
1645        } else {
1646            m_AttachedStateLabel.set_label(_("stand-alone"));
1647            m_AttachedStateImage.set(
1648                Gdk::Pixbuf::create_from_xpm_data(status_detached_xpm)
1649            );
1650        }
1651    }
1652    
1653    sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_to_be_changed() {
1654        return file_structure_to_be_changed_signal;
1655    }
1656    
1657    sigc::signal<void, gig::File*>& MainWindow::signal_file_structure_changed() {
1658        return file_structure_changed_signal;
1659    }
1660    
1661    sigc::signal<void, std::list<gig::Sample*> >& MainWindow::signal_samples_to_be_removed() {
1662        return samples_to_be_removed_signal;
1663    }
1664    
1665    sigc::signal<void>& MainWindow::signal_samples_removed() {
1666        return samples_removed_signal;
1667    }
1668    
1669    sigc::signal<void, gig::Region*>& MainWindow::signal_region_to_be_changed() {
1670        return region_to_be_changed_signal;
1671    }
1672    
1673    sigc::signal<void, gig::Region*>& MainWindow::signal_region_changed() {
1674        return region_changed_signal;
1675    }
1676    
1677    sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& MainWindow::signal_sample_ref_changed() {
1678        return sample_ref_changed_signal;
1679    }
1680    
1681    sigc::signal<void, gig::DimensionRegion*>& MainWindow::signal_dimreg_to_be_changed() {
1682        return dimreg_to_be_changed_signal;
1683    }
1684    
1685    sigc::signal<void, gig::DimensionRegion*>& MainWindow::signal_dimreg_changed() {
1686        return dimreg_changed_signal;
1687    }

Legend:
Removed from v.1265  
changed lines
  Added in v.1533

  ViewVC Help
Powered by ViewVC