/[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 1714 by persson, Thu Mar 6 20:50:04 2008 UTC revision 2398 by persson, Sun Jan 13 09:14:29 2013 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006 - 2008 Andreas Persson   * Copyright (C) 2006-2013 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 20  Line 20 
20  #include <iostream>  #include <iostream>
21  #include <cstring>  #include <cstring>
22    
23    #include <glibmm/convert.h>
24    #include <glibmm/dispatcher.h>
25    #include <glibmm/miscutils.h>
26    #include <glibmm/stringutils.h>
27    #include <gtkmm/aboutdialog.h>
28  #include <gtkmm/filechooserdialog.h>  #include <gtkmm/filechooserdialog.h>
29  #include <gtkmm/messagedialog.h>  #include <gtkmm/messagedialog.h>
30  #include <gtkmm/stock.h>  #include <gtkmm/stock.h>
31  #include <gtkmm/targetentry.h>  #include <gtkmm/targetentry.h>
32  #include <gtkmm/main.h>  #include <gtkmm/main.h>
33    #include <gtkmm/radiomenuitem.h>
34  #include <gtkmm/toggleaction.h>  #include <gtkmm/toggleaction.h>
35    #if GTKMM_MAJOR_VERSION < 3
36  #include "global.h"  #include "wrapLabel.hh"
   
 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2  
 #define ABOUT_DIALOG  
 #include <gtkmm/aboutdialog.h>  
37  #endif  #endif
38    
39  #if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION < 6) || GLIBMM_MAJOR_VERSION < 2  #include "global.h"
40  namespace Glib {  #include "compat.h"
 Glib::ustring filename_display_basename(const std::string& filename)  
 {  
     gchar* gstr = g_path_get_basename(filename.c_str());  
     Glib::ustring str(gstr);  
     g_free(gstr);  
     return Glib::filename_to_utf8(str);  
 }  
 }  
 #endif  
41    
42  #include <stdio.h>  #include <stdio.h>
43  #include <sndfile.h>  #include <sndfile.h>
# Line 129  MainWindow::MainWindow() : Line 122  MainWindow::MainWindow() :
122      m_HPaned.add2(dimreg_vbox);      m_HPaned.add2(dimreg_vbox);
123    
124    
125      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, "Samples");      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples"));
126      m_TreeViewNotebook.append_page(m_ScrolledWindow, "Instruments");      m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments"));
127    
128    
129      actionGroup = Gtk::ActionGroup::create();      actionGroup = Gtk::ActionGroup::create();
# Line 178  MainWindow::MainWindow() : Line 171  MainWindow::MainWindow() :
171      action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP);      action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP);
172      actionGroup->add(Gtk::Action::create("MenuHelp",      actionGroup->add(Gtk::Action::create("MenuHelp",
173                                           action->property_label()));                                           action->property_label()));
 #ifdef ABOUT_DIALOG  
174      actionGroup->add(Gtk::Action::create("About", Gtk::Stock::ABOUT),      actionGroup->add(Gtk::Action::create("About", Gtk::Stock::ABOUT),
175                       sigc::mem_fun(                       sigc::mem_fun(
176                           *this, &MainWindow::on_action_help_about));                           *this, &MainWindow::on_action_help_about));
 #endif  
177      actionGroup->add(      actionGroup->add(
178          Gtk::Action::create("AddInstrument", _("Add _Instrument")),          Gtk::Action::create("AddInstrument", _("Add _Instrument")),
179          sigc::mem_fun(*this, &MainWindow::on_action_add_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_add_instrument)
180      );      );
181      actionGroup->add(      actionGroup->add(
182            Gtk::Action::create("DupInstrument", _("_Duplicate Instrument")),
183            sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument)
184        );
185        actionGroup->add(
186          Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE),          Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE),
187          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)
188      );      );
# Line 202  MainWindow::MainWindow() : Line 197  MainWindow::MainWindow() :
197          sigc::mem_fun(*this, &MainWindow::on_action_add_group)          sigc::mem_fun(*this, &MainWindow::on_action_add_group)
198      );      );
199      actionGroup->add(      actionGroup->add(
200          Gtk::Action::create("AddSample", _("Add _Sample(s)")),          Gtk::Action::create("AddSample", _("Add _Sample(s)...")),
201          sigc::mem_fun(*this, &MainWindow::on_action_add_sample)          sigc::mem_fun(*this, &MainWindow::on_action_add_sample)
202      );      );
203      actionGroup->add(      actionGroup->add(
# Line 210  MainWindow::MainWindow() : Line 205  MainWindow::MainWindow() :
205          sigc::mem_fun(*this, &MainWindow::on_action_remove_sample)          sigc::mem_fun(*this, &MainWindow::on_action_remove_sample)
206      );      );
207      actionGroup->add(      actionGroup->add(
208          Gtk::Action::create("ReplaceAllSamplesInAllGroups", _("Replace All Samples In All Groups")),          Gtk::Action::create("ReplaceAllSamplesInAllGroups",
209                                _("Replace All Samples in All Groups...")),
210          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)
211      );      );
212    
# Line 237  MainWindow::MainWindow() : Line 233  MainWindow::MainWindow() :
233          "    <menu action='MenuView'>"          "    <menu action='MenuView'>"
234          "      <menuitem action='Statusbar'/>"          "      <menuitem action='Statusbar'/>"
235          "    </menu>"          "    </menu>"
 #ifdef ABOUT_DIALOG  
236          "    <menu action='MenuHelp'>"          "    <menu action='MenuHelp'>"
237          "      <menuitem action='About'/>"          "      <menuitem action='About'/>"
238          "    </menu>"          "    </menu>"
 #endif  
239          "  </menubar>"          "  </menubar>"
240          "  <popup name='PopupMenu'>"          "  <popup name='PopupMenu'>"
241          "    <menuitem action='InstrProperties'/>"          "    <menuitem action='InstrProperties'/>"
242          "    <menuitem action='AddInstrument'/>"          "    <menuitem action='AddInstrument'/>"
243            "    <menuitem action='DupInstrument'/>"
244          "    <separator/>"          "    <separator/>"
245          "    <menuitem action='RemoveInstrument'/>"          "    <menuitem action='RemoveInstrument'/>"
246          "  </popup>"          "  </popup>"
# Line 270  MainWindow::MainWindow() : Line 265  MainWindow::MainWindow() :
265      m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK);      m_VBox.pack_start(m_DimRegionChooser, Gtk::PACK_SHRINK);
266      m_VBox.pack_start(m_StatusBar, Gtk::PACK_SHRINK);      m_VBox.pack_start(m_StatusBar, Gtk::PACK_SHRINK);
267    
268        set_file_is_shared(false);
269    
270      // Status Bar:      // Status Bar:
271      m_StatusBar.pack_start(m_AttachedStateLabel, Gtk::PACK_SHRINK);      m_StatusBar.pack_start(m_AttachedStateLabel, Gtk::PACK_SHRINK);
272      m_StatusBar.pack_start(m_AttachedStateImage, Gtk::PACK_SHRINK);      m_StatusBar.pack_start(m_AttachedStateImage, Gtk::PACK_SHRINK);
# Line 306  MainWindow::MainWindow() : Line 303  MainWindow::MainWindow() :
303      );      );
304    
305      // 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
306      std::list<Gtk::TargetEntry> drag_target_gig_sample;      std::vector<Gtk::TargetEntry> drag_target_gig_sample;
307      drag_target_gig_sample.push_back( Gtk::TargetEntry("gig::Sample") );      drag_target_gig_sample.push_back(Gtk::TargetEntry("gig::Sample"));
308      m_TreeViewSamples.drag_source_set(drag_target_gig_sample);      m_TreeViewSamples.drag_source_set(drag_target_gig_sample);
309      m_TreeViewSamples.signal_drag_begin().connect(      m_TreeViewSamples.signal_drag_begin().connect(
310          sigc::mem_fun(*this, &MainWindow::on_sample_treeview_drag_begin)          sigc::mem_fun(*this, &MainWindow::on_sample_treeview_drag_begin)
# Line 372  MainWindow::MainWindow() : Line 369  MainWindow::MainWindow() :
369    
370      file = 0;      file = 0;
371      file_is_changed = false;      file_is_changed = false;
     set_file_is_shared(false);  
372    
373      show_all_children();      show_all_children();
374    
# Line 476  void loader_progress_callback(gig::progr Line 472  void loader_progress_callback(gig::progr
472  void Loader::progress_callback(float fraction)  void Loader::progress_callback(float fraction)
473  {  {
474      {      {
475          Glib::Mutex::Lock lock(progressMutex);          Glib::Threads::Mutex::Lock lock(progressMutex);
476          progress = fraction;          progress = fraction;
477      }      }
478      progress_dispatcher();      progress_dispatcher();
# Line 484  void Loader::progress_callback(float fra Line 480  void Loader::progress_callback(float fra
480    
481  void Loader::thread_function()  void Loader::thread_function()
482  {  {
483      printf("thread_function self=%x\n", Glib::Thread::self());      printf("thread_function self=%x\n", Glib::Threads::Thread::self());
484      printf("Start %s\n", filename);      printf("Start %s\n", filename);
485      RIFF::File* riff = new RIFF::File(filename);      RIFF::File* riff = new RIFF::File(filename);
486      gig = new gig::File(riff);      gig = new gig::File(riff);
# Line 498  void Loader::thread_function() Line 494  void Loader::thread_function()
494  }  }
495    
496  Loader::Loader(const char* filename)  Loader::Loader(const char* filename)
497      : thread(0), filename(filename)      : filename(filename), thread(0)
498  {  {
499  }  }
500    
501  void Loader::launch()  void Loader::launch()
502  {  {
503    #ifdef OLD_THREADS
504      thread = Glib::Thread::create(sigc::mem_fun(*this, &Loader::thread_function), true);      thread = Glib::Thread::create(sigc::mem_fun(*this, &Loader::thread_function), true);
505    #else
506        thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Loader::thread_function));
507    #endif
508      printf("launch thread=%x\n", thread);      printf("launch thread=%x\n", thread);
509  }  }
510    
# Line 512  float Loader::get_progress() Line 512  float Loader::get_progress()
512  {  {
513      float res;      float res;
514      {      {
515          Glib::Mutex::Lock lock(progressMutex);          Glib::Threads::Mutex::Lock lock(progressMutex);
516          res = progress;          res = progress;
517      }      }
518      return res;      return res;
# Line 542  void MainWindow::__clear() { Line 542  void MainWindow::__clear() {
542      Gtk::MenuItem* instrument_menu =      Gtk::MenuItem* instrument_menu =
543          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuInstrument"));          dynamic_cast<Gtk::MenuItem*>(uiManager->get_widget("/MenuBar/MenuInstrument"));
544      instrument_menu->hide();      instrument_menu->hide();
545      for (int i = 0; i < instrument_menu->get_submenu()->items().size(); i++) {      Gtk::Menu* menu = instrument_menu->get_submenu();
546          delete &instrument_menu->get_submenu()->items()[i];      while (menu->get_children().size()) {
547            Gtk::Widget* child = *menu->get_children().begin();
548            menu->remove(*child);
549            delete child;
550      }      }
     instrument_menu->get_submenu()->items().clear();  
551      // forget all samples that ought to be imported      // forget all samples that ought to be imported
552      m_SampleImportQueue.clear();      m_SampleImportQueue.clear();
553      // clear the samples and instruments tree views      // clear the samples and instruments tree views
# Line 569  void MainWindow::on_action_file_new() Line 571  void MainWindow::on_action_file_new()
571      gig::File* pFile = new gig::File;      gig::File* pFile = new gig::File;
572      // already add one new instrument by default      // already add one new instrument by default
573      gig::Instrument* pInstrument = pFile->AddInstrument();      gig::Instrument* pInstrument = pFile->AddInstrument();
574      pInstrument->pInfo->Name = "Unnamed Instrument";      pInstrument->pInfo->Name = _("Unnamed Instrument");
575      // update GUI with that new gig::File      // update GUI with that new gig::File
576      load_gig(pFile, 0 /*no file name yet*/);      load_gig(pFile, 0 /*no file name yet*/);
577  }  }
# Line 580  bool MainWindow::close_confirmation_dial Line 582  bool MainWindow::close_confirmation_dial
582                                   Glib::filename_display_basename(filename).c_str());                                   Glib::filename_display_basename(filename).c_str());
583      Gtk::MessageDialog dialog(*this, msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);      Gtk::MessageDialog dialog(*this, msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
584      g_free(msg);      g_free(msg);
 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2  
585      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."));
 #endif  
586      dialog.add_button(_("Close _Without Saving"), Gtk::RESPONSE_NO);      dialog.add_button(_("Close _Without Saving"), Gtk::RESPONSE_NO);
587      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
588      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);
# Line 596  bool MainWindow::close_confirmation_dial Line 596  bool MainWindow::close_confirmation_dial
596  bool MainWindow::leaving_shared_mode_dialog() {  bool MainWindow::leaving_shared_mode_dialog() {
597      Glib::ustring msg = _("Detach from sampler and proceed working stand-alone?");      Glib::ustring msg = _("Detach from sampler and proceed working stand-alone?");
598      Gtk::MessageDialog dialog(*this, msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);      Gtk::MessageDialog dialog(*this, msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 6) || GTKMM_MAJOR_VERSION > 2  
599      dialog.set_secondary_text(      dialog.set_secondary_text(
600          _("If you proceed to work on another instrument file, it won't be "          _("If you proceed to work on another instrument file, it won't be "
601            "used by the sampler until you tell the sampler explicitly to "            "used by the sampler until you tell the sampler explicitly to "
602            "load it.")            "load it."));
    );  
 #endif  
603      dialog.add_button(_("_Yes, Detach"), Gtk::RESPONSE_YES);      dialog.add_button(_("_Yes, Detach"), Gtk::RESPONSE_YES);
604      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
605      dialog.set_default_response(Gtk::RESPONSE_CANCEL);      dialog.set_default_response(Gtk::RESPONSE_CANCEL);
# Line 621  void MainWindow::on_action_file_open() Line 618  void MainWindow::on_action_file_open()
618      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
619      dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);      dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
620      dialog.set_default_response(Gtk::RESPONSE_OK);      dialog.set_default_response(Gtk::RESPONSE_OK);
621    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
622      Gtk::FileFilter filter;      Gtk::FileFilter filter;
623      filter.add_pattern("*.gig");      filter.add_pattern("*.gig");
624    #else
625        Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
626        filter->add_pattern("*.gig");
627    #endif
628      dialog.set_filter(filter);      dialog.set_filter(filter);
629      if (current_dir != "") {      if (current_gig_dir != "") {
630          dialog.set_current_folder(current_dir);          dialog.set_current_folder(current_gig_dir);
631      }      }
632      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
633          std::string filename = dialog.get_filename();          std::string filename = dialog.get_filename();
634          printf("filename=%s\n", filename.c_str());          printf("filename=%s\n", filename.c_str());
635          printf("on_action_file_open self=%x\n", Glib::Thread::self());          printf("on_action_file_open self=%x\n", Glib::Threads::Thread::self());
636          load_file(filename.c_str());          load_file(filename.c_str());
637          current_dir = Glib::path_get_dirname(filename);          current_gig_dir = Glib::path_get_dirname(filename);
638      }      }
639  }  }
640    
641  void MainWindow::load_file(const char* name)  void MainWindow::load_file(const char* name)
642  {  {
643      __clear();      __clear();
644      load_dialog = new LoadDialog("Loading...", *this);      load_dialog = new LoadDialog(_("Loading..."), *this);
645      load_dialog->show_all();      load_dialog->show_all();
646      loader = new Loader(strdup(name));      loader = new Loader(strdup(name));
647      loader->signal_progress().connect(      loader->signal_progress().connect(
# Line 672  void MainWindow::on_loader_progress() Line 674  void MainWindow::on_loader_progress()
674  void MainWindow::on_loader_finished()  void MainWindow::on_loader_finished()
675  {  {
676      printf("Loader finished!\n");      printf("Loader finished!\n");
677      printf("on_loader_finished self=%x\n", Glib::Thread::self());      printf("on_loader_finished self=%x\n", Glib::Threads::Thread::self());
678      load_gig(loader->gig, loader->filename);      load_gig(loader->gig, loader->filename);
679      load_dialog->hide();      load_dialog->hide();
680  }  }
# Line 744  bool MainWindow::file_save_as() Line 746  bool MainWindow::file_save_as()
746      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
747      dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);      dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
748      dialog.set_default_response(Gtk::RESPONSE_OK);      dialog.set_default_response(Gtk::RESPONSE_OK);
   
 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 8) || GTKMM_MAJOR_VERSION > 2  
749      dialog.set_do_overwrite_confirmation();      dialog.set_do_overwrite_confirmation();
750      // TODO: an overwrite dialog for gtkmm < 2.8  
751  #endif  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
752      Gtk::FileFilter filter;      Gtk::FileFilter filter;
753      filter.add_pattern("*.gig");      filter.add_pattern("*.gig");
754    #else
755        Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
756        filter->add_pattern("*.gig");
757    #endif
758      dialog.set_filter(filter);      dialog.set_filter(filter);
759    
760      // set initial dir and filename of the Save As dialog      // set initial dir and filename of the Save As dialog
# Line 758  bool MainWindow::file_save_as() Line 762  bool MainWindow::file_save_as()
762      {      {
763          std::string basename = Glib::path_get_basename(filename);          std::string basename = Glib::path_get_basename(filename);
764          std::string dir = Glib::path_get_dirname(filename);          std::string dir = Glib::path_get_dirname(filename);
765          basename = std::string("copy_of_") + basename;          basename = std::string(_("copy_of_")) + basename;
766          Glib::ustring copyFileName = Glib::build_filename(dir, basename);          Glib::ustring copyFileName = Glib::build_filename(dir, basename);
767          if (Glib::path_is_absolute(filename)) {          if (Glib::path_is_absolute(filename)) {
768              dialog.set_filename(copyFileName);              dialog.set_filename(copyFileName);
769          } else {          } else {
770              if (current_dir != "") dialog.set_current_folder(current_dir);              if (current_gig_dir != "") dialog.set_current_folder(current_gig_dir);
771          }          }
772          dialog.set_current_name(Glib::filename_display_basename(copyFileName));          dialog.set_current_name(Glib::filename_display_basename(copyFileName));
773      }      }
# Line 773  bool MainWindow::file_save_as() Line 777  bool MainWindow::file_save_as()
777      descriptionArea.set_spacing(15);      descriptionArea.set_spacing(15);
778      Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG));      Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG));
779      descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK);      descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK);
780      warningIcon.show();  #if GTKMM_MAJOR_VERSION < 3
781        view::WrapLabel description;
782    #else
783      Gtk::Label description;      Gtk::Label description;
784        description.set_line_wrap();
785    #endif
786      description.set_markup(      description.set_markup(
787          _("\n<b>CAUTION:</b> You <b>MUST</b> use the "          _("\n<b>CAUTION:</b> You <b>MUST</b> use the "
788            "<span style=\"italic\">\"Save\"</span> dialog instead of "            "<span style=\"italic\">\"Save\"</span> dialog instead of "
# Line 783  bool MainWindow::file_save_as() Line 791  bool MainWindow::file_save_as()
791            "<span style=\"italic\">\"Save As...\"</span> for writing to the "            "<span style=\"italic\">\"Save As...\"</span> for writing to the "
792            "same .gig file will end up in corrupted sample wave data!\n")            "same .gig file will end up in corrupted sample wave data!\n")
793      );      );
794      description.set_line_wrap(true);      descriptionArea.pack_start(description);
     descriptionArea.pack_start(description, Gtk::PACK_SHRINK);  
     description.show();  
795      dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK);      dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK);
796      descriptionArea.show();      descriptionArea.show_all();
797    
798      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
799          file_structure_to_be_changed_signal.emit(this->file);          file_structure_to_be_changed_signal.emit(this->file);
# Line 799  bool MainWindow::file_save_as() Line 805  bool MainWindow::file_save_as()
805              printf("filename=%s\n", filename.c_str());              printf("filename=%s\n", filename.c_str());
806              file->Save(filename);              file->Save(filename);
807              this->filename = filename;              this->filename = filename;
808              current_dir = Glib::path_get_dirname(filename);              current_gig_dir = Glib::path_get_dirname(filename);
809              set_title(Glib::filename_display_basename(filename));              set_title(Glib::filename_display_basename(filename));
810              file_has_name = true;              file_has_name = true;
811              file_is_changed = false;              file_is_changed = false;
# Line 828  void MainWindow::__import_queued_samples Line 834  void MainWindow::__import_queued_samples
834          SF_INFO info;          SF_INFO info;
835          info.format = 0;          info.format = 0;
836          SNDFILE* hFile = sf_open((*iter).sample_path.c_str(), SFM_READ, &info);          SNDFILE* hFile = sf_open((*iter).sample_path.c_str(), SFM_READ, &info);
837            sf_command(hFile, SFC_SET_SCALE_FLOAT_INT_READ, 0, SF_TRUE);
838          try {          try {
839              if (!hFile) throw std::string("could not open file");              if (!hFile) throw std::string(_("could not open file"));
840              // determine sample's bit depth              // determine sample's bit depth
841              int bitdepth;              int bitdepth;
842              switch (info.format & 0xff) {              switch (info.format & 0xff) {
# Line 846  void MainWindow::__import_queued_samples Line 853  void MainWindow::__import_queued_samples
853                      break;                      break;
854                  default:                  default:
855                      sf_close(hFile); // close sound file                      sf_close(hFile); // close sound file
856                      throw std::string("format not supported"); // unsupported subformat (yet?)                      throw std::string(_("format not supported")); // unsupported subformat (yet?)
857              }              }
858    
859              const int bufsize = 10000;              const int bufsize = 10000;
# Line 888  void MainWindow::__import_queued_samples Line 895  void MainWindow::__import_queued_samples
895              }              }
896              // cleanup              // cleanup
897              sf_close(hFile);              sf_close(hFile);
898                // let the sampler re-cache the sample if needed
899                sample_changed_signal.emit(iter->gig_sample);
900              // on success we remove the sample from the import queue,              // on success we remove the sample from the import queue,
901              // otherwise keep it, maybe it works the next time ?              // otherwise keep it, maybe it works the next time ?
902              std::list<SampleImportItem>::iterator cur = iter;              std::list<SampleImportItem>::iterator cur = iter;
# Line 916  void MainWindow::on_action_file_properti Line 925  void MainWindow::on_action_file_properti
925    
926  void MainWindow::on_action_help_about()  void MainWindow::on_action_help_about()
927  {  {
 #ifdef ABOUT_DIALOG  
928      Gtk::AboutDialog dialog;      Gtk::AboutDialog dialog;
929    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 12) || GTKMM_MAJOR_VERSION > 2
930        dialog.set_program_name("Gigedit");
931    #else
932        dialog.set_name("Gigedit");
933    #endif
934      dialog.set_version(VERSION);      dialog.set_version(VERSION);
935      dialog.set_copyright("Copyright (C) 2006,2007 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson");
936      dialog.set_comments(      dialog.set_comments(_(
937          "Released under the GNU General Public License.\n"          "Released under the GNU General Public License.\n"
938          "\n"          "\n"
939          "Please notice that this is still a very young instrument editor. "          "Please notice that this is still a very young instrument editor. "
940          "So better backup your Gigasampler files before editing them with "          "So better backup your Gigasampler files before editing them with "
941          "this application.\n"          "this application.\n"
942          "\n"          "\n"
943          "Please report bugs to: http://bugs.linuxsampler.org"          "Please report bugs to: http://bugs.linuxsampler.org")
944      );      );
945      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
946      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
947      dialog.run();      dialog.run();
 #endif  
948  }  }
949    
950  PropDialog::PropDialog()  PropDialog::PropDialog()
951      : table(2,1),      : eName(_("Name")),
952        eName("Name"),        eCreationDate(_("Creation date")),
953        eCreationDate("Creation date"),        eComments(_("Comments")),
954        eComments("Comments"),        eProduct(_("Product")),
955        eProduct("Product"),        eCopyright(_("Copyright")),
956        eCopyright("Copyright"),        eArtists(_("Artists")),
957        eArtists("Artists"),        eGenre(_("Genre")),
958        eGenre("Genre"),        eKeywords(_("Keywords")),
959        eKeywords("Keywords"),        eEngineer(_("Engineer")),
960        eEngineer("Engineer"),        eTechnician(_("Technician")),
961        eTechnician("Technician"),        eSoftware(_("Software")),
962        eSoftware("Software"),        eMedium(_("Medium")),
963        eMedium("Medium"),        eSource(_("Source")),
964        eSource("Source"),        eSourceForm(_("Source form")),
965        eSourceForm("Source form"),        eCommissioned(_("Commissioned")),
966        eCommissioned("Commissioned"),        eSubject(_("Subject")),
       eSubject("Subject"),  
967        quitButton(Gtk::Stock::CLOSE),        quitButton(Gtk::Stock::CLOSE),
968          table(2, 1),
969        update_model(0)        update_model(0)
970  {  {
971      set_title("File Properties");      set_title(_("File Properties"));
972      eName.set_width_chars(50);      eName.set_width_chars(50);
973    
974      connect(eName, &DLS::Info::Name);      connect(eName, &DLS::Info::Name);
# Line 1002  PropDialog::PropDialog() Line 1014  PropDialog::PropDialog()
1014      buttonBox.set_border_width(5);      buttonBox.set_border_width(5);
1015      buttonBox.show();      buttonBox.show();
1016      buttonBox.pack_start(quitButton);      buttonBox.pack_start(quitButton);
1017      quitButton.set_flags(Gtk::CAN_DEFAULT);      quitButton.set_can_default();
1018      quitButton.grab_focus();      quitButton.grab_focus();
1019      quitButton.signal_clicked().connect(      quitButton.signal_clicked().connect(
1020          sigc::mem_fun(*this, &PropDialog::hide));          sigc::mem_fun(*this, &PropDialog::hide));
# Line 1072  void InstrumentProps::set_DimensionKeyRa Line 1084  void InstrumentProps::set_DimensionKeyRa
1084  }  }
1085    
1086  InstrumentProps::InstrumentProps()  InstrumentProps::InstrumentProps()
1087      : table(2,1),      : update_model(0),
1088        quitButton(Gtk::Stock::CLOSE),        quitButton(Gtk::Stock::CLOSE),
1089        eName("Name"),        table(2,1),
1090        eIsDrum("Is drum"),        eName(_("Name")),
1091        eMIDIBank("MIDI bank", 0, 16383),        eIsDrum(_("Is drum")),
1092        eMIDIProgram("MIDI program"),        eMIDIBank(_("MIDI bank"), 0, 16383),
1093        eAttenuation("Attenuation", 0, 96, 0, 1),        eMIDIProgram(_("MIDI program")),
1094        eGainPlus6("Gain +6dB", eAttenuation, -6),        eAttenuation(_("Attenuation"), 0, 96, 0, 1),
1095        eEffectSend("Effect send", 0, 65535),        eGainPlus6(_("Gain +6dB"), eAttenuation, -6),
1096        eFineTune("Fine tune", -8400, 8400),        eEffectSend(_("Effect send"), 0, 65535),
1097        ePitchbendRange("Pitchbend range", 0, 12),        eFineTune(_("Fine tune"), -8400, 8400),
1098        ePianoReleaseMode("Piano release mode"),        ePitchbendRange(_("Pitchbend range"), 0, 12),
1099        eDimensionKeyRangeLow("Keyswitching range low"),        ePianoReleaseMode(_("Piano release mode")),
1100        eDimensionKeyRangeHigh("Keyswitching range high"),        eDimensionKeyRangeLow(_("Keyswitching range low")),
1101        update_model(0)        eDimensionKeyRangeHigh(_("Keyswitching range high"))
1102  {  {
1103      set_title("Instrument Properties");      set_title(_("Instrument Properties"));
1104    
1105      eDimensionKeyRangeLow.set_tip(      eDimensionKeyRangeLow.set_tip(
1106          _("start of the keyboard area which should switch the "          _("start of the keyboard area which should switch the "
# Line 1137  InstrumentProps::InstrumentProps() Line 1149  InstrumentProps::InstrumentProps()
1149      buttonBox.set_border_width(5);      buttonBox.set_border_width(5);
1150      buttonBox.show();      buttonBox.show();
1151      buttonBox.pack_start(quitButton);      buttonBox.pack_start(quitButton);
1152      quitButton.set_flags(Gtk::CAN_DEFAULT);      quitButton.set_can_default();
1153      quitButton.grab_focus();      quitButton.grab_focus();
1154    
1155      quitButton.signal_clicked().connect(      quitButton.signal_clicked().connect(
# Line 1313  void MainWindow::on_action_add_instrumen Line 1325  void MainWindow::on_action_add_instrumen
1325      gig::Instrument* instrument = file->AddInstrument();      gig::Instrument* instrument = file->AddInstrument();
1326      __instrument_indexer++;      __instrument_indexer++;
1327      instrument->pInfo->Name =      instrument->pInfo->Name =
1328          "Unnamed Instrument " + ToString(__instrument_indexer);          _("Unnamed Instrument ") + ToString(__instrument_indexer);
1329      // update instrument tree view      // update instrument tree view
1330      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();
1331      Gtk::TreeModel::Row rowInstr = *iterInstr;      Gtk::TreeModel::Row rowInstr = *iterInstr;
# Line 1322  void MainWindow::on_action_add_instrumen Line 1334  void MainWindow::on_action_add_instrumen
1334      file_changed();      file_changed();
1335  }  }
1336    
1337    void MainWindow::on_action_duplicate_instrument() {
1338        if (!file) return;
1339        
1340        // retrieve the currently selected instrument
1341        // (being the original instrument to be duplicated)
1342        Glib::RefPtr<Gtk::TreeSelection> sel = m_TreeView.get_selection();
1343        Gtk::TreeModel::iterator itSelection = sel->get_selected();
1344        if (!itSelection) return;
1345        Gtk::TreeModel::Row row = *itSelection;
1346        gig::Instrument* instrOrig = row[m_Columns.m_col_instr];
1347        if (!instrOrig) return;
1348        
1349        // duplicate the orginal instrument
1350        gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig);
1351        instrNew->pInfo->Name =
1352            instrOrig->pInfo->Name + " (" + _("Copy") + ")";
1353            
1354        // update instrument tree view
1355        Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();
1356        Gtk::TreeModel::Row rowInstr = *iterInstr;
1357        rowInstr[m_Columns.m_col_name] = instrNew->pInfo->Name.c_str();
1358        rowInstr[m_Columns.m_col_instr] = instrNew;
1359        file_changed();
1360    }
1361    
1362  void MainWindow::on_action_remove_instrument() {  void MainWindow::on_action_remove_instrument() {
1363      if (!file) return;      if (!file) return;
1364      if (file_is_shared) {      if (file_is_shared) {
# Line 1356  void MainWindow::on_action_remove_instru Line 1393  void MainWindow::on_action_remove_instru
1393  void MainWindow::on_action_sample_properties() {  void MainWindow::on_action_sample_properties() {
1394      //TODO: show a dialog where the selected sample's properties can be edited      //TODO: show a dialog where the selected sample's properties can be edited
1395      Gtk::MessageDialog msg(      Gtk::MessageDialog msg(
1396          *this, "Sorry, yet to be implemented!", false, Gtk::MESSAGE_INFO          *this, _("Sorry, yet to be implemented!"), false, Gtk::MESSAGE_INFO
1397      );      );
1398      msg.run();      msg.run();
1399  }  }
# Line 1365  void MainWindow::on_action_add_group() { Line 1402  void MainWindow::on_action_add_group() {
1402      static int __sample_indexer = 0;      static int __sample_indexer = 0;
1403      if (!file) return;      if (!file) return;
1404      gig::Group* group = file->AddGroup();      gig::Group* group = file->AddGroup();
1405      group->Name = "Unnamed Group";      group->Name = _("Unnamed Group");
1406      if (__sample_indexer) group->Name += " " + ToString(__sample_indexer);      if (__sample_indexer) group->Name += " " + ToString(__sample_indexer);
1407      __sample_indexer++;      __sample_indexer++;
1408      // update sample tree view      // update sample tree view
# Line 1399  void MainWindow::on_action_add_sample() Line 1436  void MainWindow::on_action_add_sample()
1436      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1437      dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);      dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
1438      dialog.set_select_multiple(true);      dialog.set_select_multiple(true);
1439      Gtk::FileFilter soundfilter; // matches all file types supported by libsndfile  
1440        // matches all file types supported by libsndfile
1441    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
1442        Gtk::FileFilter soundfilter;
1443    #else
1444        Glib::RefPtr<Gtk::FileFilter> soundfilter = Gtk::FileFilter::create();
1445    #endif
1446      const char* const supportedFileTypes[] = {      const char* const supportedFileTypes[] = {
1447          "*.wav", "*.WAV", "*.aiff", "*.AIFF", "*.aifc", "*.AIFC", "*.snd",          "*.wav", "*.WAV", "*.aiff", "*.AIFF", "*.aifc", "*.AIFC", "*.snd",
1448          "*.SND", "*.au", "*.AU", "*.paf", "*.PAF", "*.iff", "*.IFF",          "*.SND", "*.au", "*.AU", "*.paf", "*.PAF", "*.iff", "*.IFF",
# Line 1407  void MainWindow::on_action_add_sample() Line 1450  void MainWindow::on_action_add_sample()
1450          "*.W64", "*.pvf", "*.PVF", "*.xi", "*.XI", "*.htk", "*.HTK",          "*.W64", "*.pvf", "*.PVF", "*.xi", "*.XI", "*.htk", "*.HTK",
1451          "*.caf", "*.CAF", NULL          "*.caf", "*.CAF", NULL
1452      };      };
1453        const char* soundfiles = _("Sound Files");
1454        const char* allfiles = _("All Files");
1455    #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
1456      for (int i = 0; supportedFileTypes[i]; i++)      for (int i = 0; supportedFileTypes[i]; i++)
1457          soundfilter.add_pattern(supportedFileTypes[i]);          soundfilter.add_pattern(supportedFileTypes[i]);
1458      soundfilter.set_name("Sound Files");      soundfilter.set_name(soundfiles);
1459      Gtk::FileFilter allpassfilter; // matches every file  
1460        // matches every file
1461        Gtk::FileFilter allpassfilter;
1462      allpassfilter.add_pattern("*.*");      allpassfilter.add_pattern("*.*");
1463      allpassfilter.set_name("All Files");      allpassfilter.set_name(allfiles);
1464    #else
1465        for (int i = 0; supportedFileTypes[i]; i++)
1466            soundfilter->add_pattern(supportedFileTypes[i]);
1467        soundfilter->set_name(soundfiles);
1468    
1469        // matches every file
1470        Glib::RefPtr<Gtk::FileFilter> allpassfilter = Gtk::FileFilter::create();
1471        allpassfilter->add_pattern("*.*");
1472        allpassfilter->set_name(allfiles);
1473    #endif
1474      dialog.add_filter(soundfilter);      dialog.add_filter(soundfilter);
1475      dialog.add_filter(allpassfilter);      dialog.add_filter(allpassfilter);
1476        if (current_sample_dir != "") {
1477            dialog.set_current_folder(current_sample_dir);
1478        }
1479      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
1480            current_sample_dir = dialog.get_current_folder();
1481          Glib::ustring error_files;          Glib::ustring error_files;
1482          Glib::SListHandle<Glib::ustring> filenames = dialog.get_filenames();          std::vector<std::string> filenames = dialog.get_filenames();
1483          for (Glib::SListHandle<Glib::ustring>::iterator iter = filenames.begin();          for (std::vector<std::string>::iterator iter = filenames.begin();
1484               iter != filenames.end(); ++iter) {               iter != filenames.end(); ++iter) {
1485              printf("Adding sample %s\n",(*iter).c_str());              printf("Adding sample %s\n",(*iter).c_str());
1486              // use libsndfile to retrieve file informations              // use libsndfile to retrieve file informations
# Line 1426  void MainWindow::on_action_add_sample() Line 1488  void MainWindow::on_action_add_sample()
1488              info.format = 0;              info.format = 0;
1489              SNDFILE* hFile = sf_open((*iter).c_str(), SFM_READ, &info);              SNDFILE* hFile = sf_open((*iter).c_str(), SFM_READ, &info);
1490              try {              try {
1491                  if (!hFile) throw std::string("could not open file");                  if (!hFile) throw std::string(_("could not open file"));
1492                  int bitdepth;                  int bitdepth;
1493                  switch (info.format & 0xff) {                  switch (info.format & 0xff) {
1494                      case SF_FORMAT_PCM_S8:                      case SF_FORMAT_PCM_S8:
# Line 1442  void MainWindow::on_action_add_sample() Line 1504  void MainWindow::on_action_add_sample()
1504                          break;                          break;
1505                      default:                      default:
1506                          sf_close(hFile); // close sound file                          sf_close(hFile); // close sound file
1507                          throw std::string("format not supported"); // unsupported subformat (yet?)                          throw std::string(_("format not supported")); // unsupported subformat (yet?)
1508                  }                  }
1509                  // add a new sample to the .gig file                  // add a new sample to the .gig file
1510                  gig::Sample* sample = file->AddSample();                  gig::Sample* sample = file->AddSample();
# Line 1470  void MainWindow::on_action_add_sample() Line 1532  void MainWindow::on_action_add_sample()
1532                  {                  {
1533                      sample->MIDIUnityNote = instrument.basenote;                      sample->MIDIUnityNote = instrument.basenote;
1534    
 #if HAVE_SF_INSTRUMENT_LOOPS  
1535                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {
1536                          sample->Loops = 1;                          sample->Loops = 1;
1537    
# Line 1490  void MainWindow::on_action_add_sample() Line 1551  void MainWindow::on_action_add_sample()
1551                          sample->LoopPlayCount = instrument.loops[0].count;                          sample->LoopPlayCount = instrument.loops[0].count;
1552                          sample->LoopSize = sample->LoopEnd - sample->LoopStart + 1;                          sample->LoopSize = sample->LoopEnd - sample->LoopStart + 1;
1553                      }                      }
 #endif  
1554                  }                  }
1555    
1556                  // schedule resizing the sample (which will be done                  // schedule resizing the sample (which will be done
# Line 1533  void MainWindow::on_action_replace_all_s Line 1593  void MainWindow::on_action_replace_all_s
1593      if (!file) return;      if (!file) return;
1594      Gtk::FileChooserDialog dialog(*this, _("Select Folder"),      Gtk::FileChooserDialog dialog(*this, _("Select Folder"),
1595                                    Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);                                    Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
1596      Gtk::Label description(      const char* str =
1597          _("This is a very specific function. It tries to replace all samples "          _("This is a very specific function. It tries to replace all samples "
1598            "in the current gig file by samples located in the directory chosen "            "in the current gig file by samples located in the chosen "
1599            "by you above.\n\n"            "directory.\n\n"
1600            "It works like this: For each sample in the gig file it tries to "            "It works like this: For each sample in the gig file, it tries to "
1601            "find a sample file in the selected directory with the same name as "            "find a sample file in the selected directory with the same name as "
1602            "the sample in the gig file. Optionally you can add a filename "            "the sample in the gig file. Optionally, you can add a filename "
1603            "postfix below, which will be added to the filename expected to be "            "extension below, which will be added to the filename expected to be "
1604            "found. That is, assume you have a gig file with a sample called "            "found. That is, assume you have a gig file with a sample called "
1605            "'Snare', if you enter '.wav' below (like it's done by default), it "            "'Snare', if you enter '.wav' below (like it's done by default), it "
1606            "assumes to find a sample file called 'Snare.wav' and will replace "            "expects to find a sample file called 'Snare.wav' and will replace "
1607            "the sample in the gig file accordingly. If you don't need such a "            "the sample in the gig file accordingly. If you don't need an "
1608            "postfix, blank the field below. Any gig sample where no "            "extension, blank the field below. Any gig sample where no "
1609            "appropriate sample file could be found, will be reported and left "            "appropriate sample file could be found will be reported and left "
1610            "untouched.\n\n")            "untouched.\n");
1611      );  #if GTKMM_MAJOR_VERSION < 3
1612      description.set_line_wrap(true);      view::WrapLabel description(str);
1613    #else
1614        Gtk::Label description(str);
1615        description.set_line_wrap();
1616    #endif
1617      Gtk::HBox entryArea;      Gtk::HBox entryArea;
1618      Gtk::Label entryLabel( _("Add Filename Extension: "), Gtk::ALIGN_RIGHT);      Gtk::Label entryLabel( _("Add filename extension: "), Gtk::ALIGN_START);
1619      Gtk::Entry postfixEntryBox;      Gtk::Entry postfixEntryBox;
1620      postfixEntryBox.set_text(".wav");      postfixEntryBox.set_text(".wav");
1621      entryArea.pack_start(entryLabel);      entryArea.pack_start(entryLabel);
# Line 1559  void MainWindow::on_action_replace_all_s Line 1623  void MainWindow::on_action_replace_all_s
1623      dialog.get_vbox()->pack_start(description, Gtk::PACK_SHRINK);      dialog.get_vbox()->pack_start(description, Gtk::PACK_SHRINK);
1624      dialog.get_vbox()->pack_start(entryArea, Gtk::PACK_SHRINK);      dialog.get_vbox()->pack_start(entryArea, Gtk::PACK_SHRINK);
1625      description.show();      description.show();
1626      entryLabel.show();      entryArea.show_all();
     postfixEntryBox.show();  
     entryArea.show();  
1627      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1628      dialog.add_button(_("Select"), Gtk::RESPONSE_OK);      dialog.add_button(_("Select"), Gtk::RESPONSE_OK);
1629      dialog.set_select_multiple(false);      dialog.set_select_multiple(false);
1630      // fix label width (because Gtk by design doesn't      if (current_sample_dir != "") {
1631      // know anything about the parent's size)          dialog.set_current_folder(current_sample_dir);
1632  #if 0 //FIXME: doesn't work      }
     int dialogW, dialogH, labelW, labelH;  
     dialog.get_size_request(dialogW, dialogH);  
     description.get_size_request(labelW, labelH);  
     std::cout << "dialog(" << dialogW << "," << dialogH << ")\nlabel(" << labelW << "," << labelH << ")\n" << std::flush;  
     description.set_size_request(dialogW, labelH);  
 #endif  
1633      if (dialog.run() == Gtk::RESPONSE_OK)      if (dialog.run() == Gtk::RESPONSE_OK)
1634      {      {
1635            current_sample_dir = dialog.get_current_folder();
1636          Glib::ustring error_files;          Glib::ustring error_files;
1637          Glib::ustring folder = dialog.get_filename();          std::string folder = dialog.get_filename();
1638          for (gig::Sample* sample = file->GetFirstSample();          for (gig::Sample* sample = file->GetFirstSample();
1639               sample; sample = file->GetNextSample())               sample; sample = file->GetNextSample())
1640          {          {
# Line 1589  void MainWindow::on_action_replace_all_s Line 1646  void MainWindow::on_action_replace_all_s
1646              SNDFILE* hFile = sf_open(filename.c_str(), SFM_READ, &info);              SNDFILE* hFile = sf_open(filename.c_str(), SFM_READ, &info);
1647              try              try
1648              {              {
1649                  if (!hFile) throw std::string("could not open file");                  if (!hFile) throw std::string(_("could not open file"));
1650                  int bitdepth;                  int bitdepth;
1651                  switch (info.format & 0xff) {                  switch (info.format & 0xff) {
1652                      case SF_FORMAT_PCM_S8:                      case SF_FORMAT_PCM_S8:
# Line 1605  void MainWindow::on_action_replace_all_s Line 1662  void MainWindow::on_action_replace_all_s
1662                          break;                          break;
1663                      default:                      default:
1664                          sf_close(hFile);                          sf_close(hFile);
1665                          throw std::string("format not supported");                          throw std::string(_("format not supported"));
1666                  }                  }
1667                  SampleImportItem sched_item;                  SampleImportItem sched_item;
1668                  sched_item.gig_sample  = sample;                  sched_item.gig_sample  = sample;
# Line 1878  sigc::signal<void, gig::Region*>& MainWi Line 1935  sigc::signal<void, gig::Region*>& MainWi
1935      return region_changed_signal;      return region_changed_signal;
1936  }  }
1937    
1938    sigc::signal<void, gig::Sample*>& MainWindow::signal_sample_changed() {
1939        return sample_changed_signal;
1940    }
1941    
1942  sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& MainWindow::signal_sample_ref_changed() {  sigc::signal<void, gig::Sample*/*old*/, gig::Sample*/*new*/>& MainWindow::signal_sample_ref_changed() {
1943      return sample_ref_changed_signal;      return sample_ref_changed_signal;
1944  }  }

Legend:
Removed from v.1714  
changed lines
  Added in v.2398

  ViewVC Help
Powered by ViewVC