/[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 3409 by schoenebeck, Tue Jan 23 16:30:56 2018 UTC revision 3643 by schoenebeck, Sat Dec 7 15:04:51 2019 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2017 Andreas Persson   * Copyright (C) 2006-2019 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 21  Line 21 
21  #include <cstring>  #include <cstring>
22    
23  #include "compat.h"  #include "compat.h"
 // threads.h must be included first to be able to build with  
 // G_DISABLE_DEPRECATED  
 #if (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION == 31 && GLIBMM_MICRO_VERSION >= 2) || \  
     (GLIBMM_MAJOR_VERSION == 2 && GLIBMM_MINOR_VERSION > 31) || GLIBMM_MAJOR_VERSION > 2  
 #include <glibmm/threads.h>  
 #endif  
24    
25  #include <glibmm/convert.h>  #include <glibmm/convert.h>
26  #include <glibmm/dispatcher.h>  #include <glibmm/dispatcher.h>
# Line 102  MainWindow::MainWindow() : Line 96  MainWindow::MainWindow() :
96    
97      if (!Settings::singleton()->autoRestoreWindowDimension) {      if (!Settings::singleton()->autoRestoreWindowDimension) {
98  #if GTKMM_MAJOR_VERSION >= 3  #if GTKMM_MAJOR_VERSION >= 3
99          set_default_size(895, 600);          set_default_size(960, 600);
100  #else  #else
101          set_default_size(800, 600);          set_default_size(865, 600);
102  #endif  #endif
103          set_position(Gtk::WIN_POS_CENTER);          set_position(Gtk::WIN_POS_CENTER);
104      }      }
# Line 1356  MainWindow::MainWindow() : Line 1350  MainWindow::MainWindow() :
1350      m_TreeView.set_model(m_refTreeModelFilter);      m_TreeView.set_model(m_refTreeModelFilter);
1351    
1352      m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);      m_TreeView.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
1353      m_TreeView.set_tooltip_text(_("Right click here for actions on instruments & MIDI Rules. Drag & drop to change the order of instruments."));      m_TreeView.set_has_tooltip(true);
1354        m_TreeView.signal_query_tooltip().connect(
1355            sigc::mem_fun(*this, &MainWindow::onQueryTreeViewTooltip)
1356        );
1357      instrument_name_connection = m_refTreeModel->signal_row_changed().connect(      instrument_name_connection = m_refTreeModel->signal_row_changed().connect(
1358          sigc::mem_fun(*this, &MainWindow::instrument_name_changed)          sigc::mem_fun(*this, &MainWindow::instrument_name_changed)
1359      );      );
# Line 1487  MainWindow::MainWindow() : Line 1484  MainWindow::MainWindow() :
1484          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
1485      instrumentProps.signal_changed().connect(      instrumentProps.signal_changed().connect(
1486          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
1487      propDialog.signal_changed().connect(      sampleProps.signal_changed().connect(
1488            sigc::mem_fun(*this, &MainWindow::file_changed));
1489        fileProps.signal_changed().connect(
1490          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
1491      midiRules.signal_changed().connect(      midiRules.signal_changed().connect(
1492          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
# Line 1513  MainWindow::MainWindow() : Line 1512  MainWindow::MainWindow() :
1512          sigc::hide(          sigc::hide(
1513              sigc::bind(              sigc::bind(
1514                  file_structure_to_be_changed_signal.make_slot(),                  file_structure_to_be_changed_signal.make_slot(),
1515    #if SIGCXX_MAJOR_VERSION > 2 || (SIGCXX_MAJOR_VERSION == 2 && SIGCXX_MINOR_VERSION >= 8)
1516                    std::ref(this->file)
1517    #else
1518                  sigc::ref(this->file)                  sigc::ref(this->file)
1519    #endif
1520              )              )
1521          )          )
1522      );      );
# Line 1521  MainWindow::MainWindow() : Line 1524  MainWindow::MainWindow() :
1524          sigc::hide(          sigc::hide(
1525              sigc::bind(              sigc::bind(
1526                  file_structure_changed_signal.make_slot(),                  file_structure_changed_signal.make_slot(),
1527    #if SIGCXX_MAJOR_VERSION > 2 || (SIGCXX_MAJOR_VERSION == 2 && SIGCXX_MINOR_VERSION >= 8)
1528                    std::ref(this->file)
1529    #else
1530                  sigc::ref(this->file)                  sigc::ref(this->file)
1531    #endif
1532              )              )
1533          )          )
1534      );      );
# Line 1543  MainWindow::MainWindow() : Line 1550  MainWindow::MainWindow() :
1550          sigc::mem_fun(*this, &MainWindow::update_dimregs));          sigc::mem_fun(*this, &MainWindow::update_dimregs));
1551    
1552      m_searchText.signal_changed().connect(      m_searchText.signal_changed().connect(
1553          sigc::mem_fun(m_refTreeModelFilter.operator->(), &Gtk::TreeModelFilter::refilter)          sigc::mem_fun(*m_refTreeModelFilter.operator->(), &Gtk::TreeModelFilter::refilter)
1554      );      );
1555    
1556      file = 0;      file = 0;
# Line 1597  MainWindow::MainWindow() : Line 1604  MainWindow::MainWindow() :
1604          Gtk::AccelMap::add_entry("<Macros>/macro_9", GDK_KEY_F10, noModifier);          Gtk::AccelMap::add_entry("<Macros>/macro_9", GDK_KEY_F10, noModifier);
1605          Gtk::AccelMap::add_entry("<Macros>/macro_10", GDK_KEY_F11, noModifier);          Gtk::AccelMap::add_entry("<Macros>/macro_10", GDK_KEY_F11, noModifier);
1606          Gtk::AccelMap::add_entry("<Macros>/macro_11", GDK_KEY_F12, noModifier);          Gtk::AccelMap::add_entry("<Macros>/macro_11", GDK_KEY_F12, noModifier);
1607            Gtk::AccelMap::add_entry("<Macros>/macro_12", GDK_KEY_F13, noModifier);
1608            Gtk::AccelMap::add_entry("<Macros>/macro_13", GDK_KEY_F14, noModifier);
1609            Gtk::AccelMap::add_entry("<Macros>/macro_14", GDK_KEY_F15, noModifier);
1610            Gtk::AccelMap::add_entry("<Macros>/macro_15", GDK_KEY_F16, noModifier);
1611            Gtk::AccelMap::add_entry("<Macros>/macro_16", GDK_KEY_F17, noModifier);
1612            Gtk::AccelMap::add_entry("<Macros>/macro_17", GDK_KEY_F18, noModifier);
1613            Gtk::AccelMap::add_entry("<Macros>/macro_18", GDK_KEY_F19, noModifier);
1614          Gtk::AccelMap::add_entry("<Macros>/SetupMacros", 'm', primaryModifierKey);          Gtk::AccelMap::add_entry("<Macros>/SetupMacros", 'm', primaryModifierKey);
1615    
1616          Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group();          Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group();
# Line 1619  MainWindow::MainWindow() : Line 1633  MainWindow::MainWindow() :
1633          Gtk::AccelMap::add_entry("<Scripts>/script_9", GDK_KEY_F10, Gdk::SHIFT_MASK);          Gtk::AccelMap::add_entry("<Scripts>/script_9", GDK_KEY_F10, Gdk::SHIFT_MASK);
1634          Gtk::AccelMap::add_entry("<Scripts>/script_10", GDK_KEY_F11, Gdk::SHIFT_MASK);          Gtk::AccelMap::add_entry("<Scripts>/script_10", GDK_KEY_F11, Gdk::SHIFT_MASK);
1635          Gtk::AccelMap::add_entry("<Scripts>/script_11", GDK_KEY_F12, Gdk::SHIFT_MASK);          Gtk::AccelMap::add_entry("<Scripts>/script_11", GDK_KEY_F12, Gdk::SHIFT_MASK);
1636            Gtk::AccelMap::add_entry("<Scripts>/script_12", GDK_KEY_F13, Gdk::SHIFT_MASK);
1637            Gtk::AccelMap::add_entry("<Scripts>/script_13", GDK_KEY_F14, Gdk::SHIFT_MASK);
1638            Gtk::AccelMap::add_entry("<Scripts>/script_14", GDK_KEY_F15, Gdk::SHIFT_MASK);
1639            Gtk::AccelMap::add_entry("<Scripts>/script_15", GDK_KEY_F16, Gdk::SHIFT_MASK);
1640            Gtk::AccelMap::add_entry("<Scripts>/script_16", GDK_KEY_F17, Gdk::SHIFT_MASK);
1641            Gtk::AccelMap::add_entry("<Scripts>/script_17", GDK_KEY_F18, Gdk::SHIFT_MASK);
1642            Gtk::AccelMap::add_entry("<Scripts>/script_18", GDK_KEY_F19, Gdk::SHIFT_MASK);
1643            Gtk::AccelMap::add_entry("<Scripts>/DropAllScriptSlots", GDK_KEY_BackSpace, Gdk::SHIFT_MASK);
1644    
1645          Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group();          Glib::RefPtr<Gtk::AccelGroup> accelGroup = this->get_accel_group();
1646          assign_scripts_menu->set_accel_group(accelGroup);          assign_scripts_menu->set_accel_group(accelGroup);
# Line 1866  void MainWindow::on_sel_change() Line 1888  void MainWindow::on_sel_change()
1888      }      }
1889  }  }
1890    
1891    
1892    LoaderSaverBase::LoaderSaverBase(const Glib::ustring filename, gig::File* gig) :
1893        filename(filename), gig(gig),
1894    #ifdef GLIB_THREADS
1895        thread(0),
1896    #endif
1897        progress(0.f)
1898    {
1899    }
1900    
1901  void loader_progress_callback(gig::progress_t* progress)  void loader_progress_callback(gig::progress_t* progress)
1902  {  {
1903      Loader* loader = static_cast<Loader*>(progress->custom);      LoaderSaverBase* loader = static_cast<LoaderSaverBase*>(progress->custom);
1904      loader->progress_callback(progress->factor);      loader->progress_callback(progress->factor);
1905  }  }
1906    
1907  void Loader::progress_callback(float fraction)  void LoaderSaverBase::progress_callback(float fraction)
1908  {  {
1909      {      {
1910    #ifdef GLIB_THREADS
1911          Glib::Threads::Mutex::Lock lock(progressMutex);          Glib::Threads::Mutex::Lock lock(progressMutex);
1912    #else
1913            std::lock_guard<std::mutex> lock(progressMutex);
1914    #endif
1915          progress = fraction;          progress = fraction;
1916      }      }
1917      progress_dispatcher();      progress_dispatcher();
# Line 1885  void Loader::progress_callback(float fra Line 1921  void Loader::progress_callback(float fra
1921  // make sure stack is 16-byte aligned for SSE instructions  // make sure stack is 16-byte aligned for SSE instructions
1922  __attribute__((force_align_arg_pointer))  __attribute__((force_align_arg_pointer))
1923  #endif  #endif
1924  void Loader::thread_function()  void LoaderSaverBase::thread_function()
1925  {  {
1926    #ifdef GLIB_THREADS
1927      printf("thread_function self=%p\n",      printf("thread_function self=%p\n",
1928             static_cast<void*>(Glib::Threads::Thread::self()));             static_cast<void*>(Glib::Threads::Thread::self()));
1929    #else
1930        std::cout << "thread_function self=" << std::this_thread::get_id() << "\n";
1931    #endif
1932      printf("Start %s\n", filename.c_str());      printf("Start %s\n", filename.c_str());
1933      try {      try {
         RIFF::File* riff = new RIFF::File(filename);  
         gig = new gig::File(riff);  
1934          gig::progress_t progress;          gig::progress_t progress;
1935          progress.callback = loader_progress_callback;          progress.callback = loader_progress_callback;
1936          progress.custom = this;          progress.custom = this;
1937    
1938          gig->GetInstrument(0, &progress);          thread_function_sub(progress);
1939          printf("End\n");          printf("End\n");
1940          finished_dispatcher();          finished_dispatcher();
1941      } catch (RIFF::Exception e) {      } catch (RIFF::Exception e) {
# Line 1909  void Loader::thread_function() Line 1947  void Loader::thread_function()
1947      }      }
1948  }  }
1949    
1950  Loader::Loader(const char* filename)  void LoaderSaverBase::launch()
     : filename(filename), gig(0), thread(0), progress(0.f)  
 {  
 }  
   
 void Loader::launch()  
1951  {  {
1952    #ifdef GLIB_THREADS
1953  #ifdef OLD_THREADS  #ifdef OLD_THREADS
1954      thread = Glib::Thread::create(sigc::mem_fun(*this, &Loader::thread_function), true);      thread = Glib::Thread::create(sigc::mem_fun(*this, &LoaderSaverBase::thread_function), true);
1955  #else  #else
1956      thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Loader::thread_function));      thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &LoaderSaverBase::thread_function));
1957  #endif  #endif
1958      printf("launch thread=%p\n", static_cast<void*>(thread));      printf("launch thread=%p\n", static_cast<void*>(thread));
1959    #else
1960        thread = std::thread([this](){ thread_function(); });
1961        std::cout << "launch thread=" << thread.get_id() << "\n";
1962    #endif
1963  }  }
1964    
1965  float Loader::get_progress()  float LoaderSaverBase::get_progress()
1966  {  {
1967      float res;  #ifdef GLIB_THREADS
1968      {      Glib::Threads::Mutex::Lock lock(progressMutex);
1969          Glib::Threads::Mutex::Lock lock(progressMutex);  #else
1970          res = progress;      std::lock_guard<std::mutex> lock(progressMutex);
1971      }  #endif
1972      return res;      return progress;
1973  }  }
1974    
1975  Glib::Dispatcher& Loader::signal_progress()  Glib::Dispatcher& LoaderSaverBase::signal_progress()
1976  {  {
1977      return progress_dispatcher;      return progress_dispatcher;
1978  }  }
1979    
1980  Glib::Dispatcher& Loader::signal_finished()  Glib::Dispatcher& LoaderSaverBase::signal_finished()
1981  {  {
1982      return finished_dispatcher;      return finished_dispatcher;
1983  }  }
1984    
1985  Glib::Dispatcher& Loader::signal_error()  Glib::Dispatcher& LoaderSaverBase::signal_error()
1986  {  {
1987      return error_dispatcher;      return error_dispatcher;
1988  }  }
1989    
1990  void saver_progress_callback(gig::progress_t* progress)  void LoaderSaverBase::join() {
1991  {  #ifdef GLIB_THREADS
1992      Saver* saver = static_cast<Saver*>(progress->custom);      thread->join();
1993      saver->progress_callback(progress->factor);  #else
1994        thread.join();
1995    #endif
1996  }  }
1997    
1998  void Saver::progress_callback(float fraction)  
1999    Loader::Loader(const char* filename) :
2000        LoaderSaverBase(filename, 0)
2001  {  {
     {  
         Glib::Threads::Mutex::Lock lock(progressMutex);  
         progress = fraction;  
     }  
     progress_dispatcher.emit();  
2002  }  }
2003    
2004  #if defined(WIN32) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))  void Loader::thread_function_sub(gig::progress_t& progress)
 // make sure stack is 16-byte aligned for SSE instructions  
 __attribute__((force_align_arg_pointer))  
 #endif  
 void Saver::thread_function()  
2005  {  {
2006      printf("thread_function self=%p\n",      RIFF::File* riff = new RIFF::File(filename);
2007             static_cast<void*>(Glib::Threads::Thread::self()));      gig = new gig::File(riff);
     printf("Start %s\n", filename.c_str());  
     try {  
         gig::progress_t progress;  
         progress.callback = saver_progress_callback;  
         progress.custom = this;  
2008    
2009          // if no filename was provided, that means "save", if filename was provided means "save as"      gig->GetInstrument(0, &progress);
         if (filename.empty()) {  
             if (!Settings::singleton()->saveWithTemporaryFile) {  
                 // save directly over the existing .gig file  
                 // (requires less disk space than solution below  
                 // but may be slower)  
                 gig->Save(&progress);  
             } else {  
                 // save the file as separate temporary file first,  
                 // then move the saved file over the old file  
                 // (may result in performance speedup during save)  
                 gig::String tmpname = filename + ".TMP";  
                 gig->Save(tmpname, &progress);  
                 #if defined(WIN32)  
                 if (!DeleteFile(filename.c_str())) {  
                     throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file).");  
                 }  
                 #else // POSIX ...  
                 if (unlink(filename.c_str())) {  
                     throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file): " + gig::String(strerror(errno)));  
                 }  
                 #endif  
                 if (rename(tmpname.c_str(), filename.c_str())) {  
                     #if defined(WIN32)  
                     throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file).");  
                     #else  
                     throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file): " + gig::String(strerror(errno)));  
                     #endif  
                 }  
             }  
         } else {  
             gig->Save(filename, &progress);  
         }  
   
         printf("End\n");  
         finished_dispatcher.emit();  
     } catch (RIFF::Exception e) {  
         error_message = e.Message;  
         error_dispatcher.emit();  
     } catch (...) {  
         error_message = _("Unknown exception occurred");  
         error_dispatcher.emit();  
     }  
2010  }  }
2011    
2012  Saver::Saver(gig::File* file, Glib::ustring filename)  
2013      : gig(file), filename(filename), thread(0), progress(0.f)  Saver::Saver(gig::File* file, Glib::ustring filename) :
2014        LoaderSaverBase(filename, file)
2015  {  {
2016  }  }
2017    
2018  void Saver::launch()  void Saver::thread_function_sub(gig::progress_t& progress)
2019  {  {
2020  #ifdef OLD_THREADS      // if no filename was provided, that means "save", if filename was provided means "save as"
2021      thread = Glib::Thread::create(sigc::mem_fun(*this, &Saver::thread_function), true);      if (filename.empty()) {
2022            if (!Settings::singleton()->saveWithTemporaryFile) {
2023                // save directly over the existing .gig file
2024                // (requires less disk space than solution below
2025                // but may be slower)
2026                gig->Save(&progress);
2027            } else {
2028                // save the file as separate temporary file first,
2029                // then move the saved file over the old file
2030                // (may result in performance speedup during save)
2031                gig::String tmpname = filename + ".TMP";
2032                gig->Save(tmpname, &progress);
2033    #if defined(WIN32)
2034                if (!DeleteFile(filename.c_str())) {
2035                    throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file).");
2036                }
2037    #else // POSIX ...
2038                if (unlink(filename.c_str())) {
2039                    throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file): " + gig::String(strerror(errno)));
2040                }
2041    #endif
2042                if (rename(tmpname.c_str(), filename.c_str())) {
2043    #if defined(WIN32)
2044                    throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file).");
2045  #else  #else
2046      thread = Glib::Threads::Thread::create(sigc::mem_fun(*this, &Saver::thread_function));                  throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file): " + gig::String(strerror(errno)));
2047  #endif  #endif
2048      printf("launch thread=%p\n", static_cast<void*>(thread));              }
2049  }          }
2050        } else {
2051  float Saver::get_progress()          gig->Save(filename, &progress);
 {  
     float res;  
     {  
         Glib::Threads::Mutex::Lock lock(progressMutex);  
         res = progress;  
2052      }      }
     return res;  
2053  }  }
2054    
 Glib::Dispatcher& Saver::signal_progress()  
 {  
     return progress_dispatcher;  
 }  
   
 Glib::Dispatcher& Saver::signal_finished()  
 {  
     return finished_dispatcher;  
 }  
   
 Glib::Dispatcher& Saver::signal_error()  
 {  
     return error_dispatcher;  
 }  
2055    
2056  ProgressDialog::ProgressDialog(const Glib::ustring& title, Gtk::Window& parent)  ProgressDialog::ProgressDialog(const Glib::ustring& title, Gtk::Window& parent)
2057      : Gtk::Dialog(title, parent, true)      : Gtk::Dialog(title, parent, true)
# Line 2217  void MainWindow::on_action_file_open() Line 2207  void MainWindow::on_action_file_open()
2207          dialog.set_current_folder(current_gig_dir);          dialog.set_current_folder(current_gig_dir);
2208      }      }
2209      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
2210            dialog.hide();
2211          std::string filename = dialog.get_filename();          std::string filename = dialog.get_filename();
2212          printf("filename=%s\n", filename.c_str());          printf("filename=%s\n", filename.c_str());
2213    #ifdef GLIB_THREADS
2214          printf("on_action_file_open self=%p\n",          printf("on_action_file_open self=%p\n",
2215                 static_cast<void*>(Glib::Threads::Thread::self()));                 static_cast<void*>(Glib::Threads::Thread::self()));
2216    #else
2217            std::cout << "on_action_file_open self=" <<
2218                std::this_thread::get_id() << "\n";
2219    #endif
2220          load_file(filename.c_str());          load_file(filename.c_str());
2221          current_gig_dir = Glib::path_get_dirname(filename);          current_gig_dir = Glib::path_get_dirname(filename);
2222      }      }
# Line 2293  void MainWindow::on_loader_progress() Line 2289  void MainWindow::on_loader_progress()
2289    
2290  void MainWindow::on_loader_finished()  void MainWindow::on_loader_finished()
2291  {  {
2292        loader->join();
2293      printf("Loader finished!\n");      printf("Loader finished!\n");
2294    #ifdef GLIB_THREADS
2295      printf("on_loader_finished self=%p\n",      printf("on_loader_finished self=%p\n",
2296             static_cast<void*>(Glib::Threads::Thread::self()));             static_cast<void*>(Glib::Threads::Thread::self()));
2297    #else
2298        std::cout << "on_loader_finished self=" <<
2299            std::this_thread::get_id() << "\n";
2300    #endif
2301      load_gig(loader->gig, loader->filename.c_str());      load_gig(loader->gig, loader->filename.c_str());
2302      progress_dialog->hide();      progress_dialog->hide();
2303  }  }
2304    
2305  void MainWindow::on_loader_error()  void MainWindow::on_loader_error()
2306  {  {
2307        loader->join();
2308      Glib::ustring txt = _("Could not load file: ") + loader->error_message;      Glib::ustring txt = _("Could not load file: ") + loader->error_message;
2309      Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);      Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
2310      msg.run();      msg.run();
# Line 2372  void MainWindow::on_saver_progress() Line 2375  void MainWindow::on_saver_progress()
2375    
2376  void MainWindow::on_saver_error()  void MainWindow::on_saver_error()
2377  {  {
2378        saver->join();
2379      file_structure_changed_signal.emit(this->file);      file_structure_changed_signal.emit(this->file);
2380      Glib::ustring txt = _("Could not save file: ") + saver->error_message;      Glib::ustring txt = _("Could not save file: ") + saver->error_message;
2381      Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);      Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
# Line 2380  void MainWindow::on_saver_error() Line 2384  void MainWindow::on_saver_error()
2384    
2385  void MainWindow::on_saver_finished()  void MainWindow::on_saver_finished()
2386  {  {
2387        saver->join();
2388      this->file = saver->gig;      this->file = saver->gig;
2389      this->filename = saver->filename;      this->filename = saver->filename;
2390      current_gig_dir = Glib::path_get_dirname(filename);      current_gig_dir = Glib::path_get_dirname(filename);
# Line 2471  bool MainWindow::file_save_as() Line 2476  bool MainWindow::file_save_as()
2476  #endif  #endif
2477    
2478      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
2479            dialog.hide();
2480          std::string filename = dialog.get_filename();          std::string filename = dialog.get_filename();
2481          if (!Glib::str_has_suffix(filename, ".gig")) {          if (!Glib::str_has_suffix(filename, ".gig")) {
2482              filename += ".gig";              filename += ".gig";
# Line 2599  void MainWindow::__import_queued_samples Line 2605  void MainWindow::__import_queued_samples
2605    
2606  void MainWindow::on_action_file_properties()  void MainWindow::on_action_file_properties()
2607  {  {
2608      propDialog.show();      fileProps.show();
2609      propDialog.deiconify();      fileProps.deiconify();
2610  }  }
2611    
2612  void MainWindow::on_action_warn_user_on_extensions() {  void MainWindow::on_action_warn_user_on_extensions() {
# Line 2622  void MainWindow::on_show_tooltips_change Line 2628  void MainWindow::on_show_tooltips_change
2628      dimreg_all_regions.set_has_tooltip(b);      dimreg_all_regions.set_has_tooltip(b);
2629      dimreg_all_dimregs.set_has_tooltip(b);      dimreg_all_dimregs.set_has_tooltip(b);
2630      dimreg_stereo.set_has_tooltip(b);      dimreg_stereo.set_has_tooltip(b);
2631      m_TreeView.set_has_tooltip(b);  
2632        // Not doing this here, we let onQueryTreeViewTooltip() handle this per cell
2633        //m_TreeView.set_has_tooltip(b);
2634    
2635      m_TreeViewSamples.set_has_tooltip(b);      m_TreeViewSamples.set_has_tooltip(b);
2636      m_TreeViewScripts.set_has_tooltip(b);      m_TreeViewScripts.set_has_tooltip(b);
2637    
# Line 2648  void MainWindow::on_action_help_about() Line 2657  void MainWindow::on_action_help_about()
2657      dialog.set_name("Gigedit");      dialog.set_name("Gigedit");
2658  #endif  #endif
2659      dialog.set_version(VERSION);      dialog.set_version(VERSION);
2660      dialog.set_copyright("Copyright (C) 2006-2017 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2019 Andreas Persson");
2661      const std::string sComment =      const std::string sComment =
2662          _("Built " __DATE__ "\nUsing ") +          _("Built " __DATE__ "\nUsing ") +
2663          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +
# Line 2659  void MainWindow::on_action_help_about() Line 2668  void MainWindow::on_action_help_about()
2668              "backup your Gigasampler/GigaStudio files before editing them with "              "backup your Gigasampler/GigaStudio files before editing them with "
2669              "this application.\n"              "this application.\n"
2670              "\n"              "\n"
2671              "Please report bugs to: http://bugs.linuxsampler.org"              "Please report bugs to: https://bugs.linuxsampler.org"
2672          );          );
2673      dialog.set_comments(sComment.c_str());      dialog.set_comments(sComment.c_str());
2674      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("https://www.linuxsampler.org");
2675      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("https://www.linuxsampler.org");
2676      dialog.set_position(Gtk::WIN_POS_CENTER);      dialog.set_position(Gtk::WIN_POS_CENTER);
2677      dialog.run();      dialog.run();
2678  }  }
2679    
2680  PropDialog::PropDialog()  FilePropDialog::FilePropDialog()
2681      : eFileFormat(_("File Format")),      : eFileFormat(_("File Format")),
2682        eName(_("Name")),        eName(_("Name")),
2683        eCreationDate(_("Creation date")),        eCreationDate(_("Creation date")),
# Line 2702  PropDialog::PropDialog() Line 2711  PropDialog::PropDialog()
2711      set_title(_("File Properties"));      set_title(_("File Properties"));
2712      eName.set_width_chars(50);      eName.set_width_chars(50);
2713    
2714        connect(eFileFormat, &FilePropDialog::set_FileFormat);
2715      connect(eName, &DLS::Info::Name);      connect(eName, &DLS::Info::Name);
2716      connect(eCreationDate, &DLS::Info::CreationDate);      connect(eCreationDate, &DLS::Info::CreationDate);
2717      connect(eComments, &DLS::Info::Comments);      connect(eComments, &DLS::Info::Comments);
# Line 2744  PropDialog::PropDialog() Line 2754  PropDialog::PropDialog()
2754  #endif  #endif
2755    
2756      add(vbox);      add(vbox);
2757  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
2758      table.set_margin(5);      table.set_margin(5);
2759  #else  #else
2760      table.set_border_width(5);      table.set_border_width(5);
# Line 2752  PropDialog::PropDialog() Line 2762  PropDialog::PropDialog()
2762      vbox.add(table);      vbox.add(table);
2763      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);
2764      buttonBox.set_layout(Gtk::BUTTONBOX_END);      buttonBox.set_layout(Gtk::BUTTONBOX_END);
2765  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
2766      buttonBox.set_margin(5);      buttonBox.set_margin(5);
2767  #else  #else
2768      buttonBox.set_border_width(5);      buttonBox.set_border_width(5);
# Line 2762  PropDialog::PropDialog() Line 2772  PropDialog::PropDialog()
2772      quitButton.set_can_default();      quitButton.set_can_default();
2773      quitButton.grab_focus();      quitButton.grab_focus();
2774      quitButton.signal_clicked().connect(      quitButton.signal_clicked().connect(
2775          sigc::mem_fun(*this, &PropDialog::hide));          sigc::mem_fun(*this, &FilePropDialog::hide));
     eFileFormat.signal_value_changed().connect(  
         sigc::mem_fun(*this, &PropDialog::onFileFormatChanged));  
2776    
2777      quitButton.show();      quitButton.show();
2778      vbox.show();      vbox.show();
# Line 2773  PropDialog::PropDialog() Line 2781  PropDialog::PropDialog()
2781  #endif  #endif
2782  }  }
2783    
2784  void PropDialog::set_file(gig::File* file)  void FilePropDialog::set_file(gig::File* file)
2785  {  {
2786      m_file = file;      m_file = file;
2787        update(file->pInfo);
2788    
2789      // update file format version combo box      // update file format version combo box
2790      const std::string sGiga = "Gigasampler/GigaStudio v";      const std::string sGiga = "Gigasampler/GigaStudio v";
# Line 2783  void PropDialog::set_file(gig::File* fil Line 2792  void PropDialog::set_file(gig::File* fil
2792      std::vector<std::string> txts;      std::vector<std::string> txts;
2793      std::vector<int> values;      std::vector<int> values;
2794      txts.push_back(sGiga + "2"); values.push_back(2);      txts.push_back(sGiga + "2"); values.push_back(2);
2795      txts.push_back(sGiga + "3/v4"); values.push_back(3);      txts.push_back(sGiga + "3"); values.push_back(3);
2796      if (major != 2 && major != 3) {      txts.push_back(sGiga + "4"); values.push_back(4);
2797        if (major < 2 || major > 4) {
2798          txts.push_back(sGiga + ToString(major)); values.push_back(major);          txts.push_back(sGiga + ToString(major)); values.push_back(major);
2799      }      }
2800      std::vector<const char*> texts;      std::vector<const char*> texts;
2801      for (int i = 0; i < txts.size(); ++i) texts.push_back(txts[i].c_str());      for (int i = 0; i < txts.size(); ++i) texts.push_back(txts[i].c_str());
2802      texts.push_back(NULL); values.push_back(0);      texts.push_back(NULL); values.push_back(0);
2803    
2804        update_model++;
2805      eFileFormat.set_choices(&texts[0], &values[0]);      eFileFormat.set_choices(&texts[0], &values[0]);
2806      eFileFormat.set_value(major);      eFileFormat.set_value(major);
2807        update_model--;
2808  }  }
2809    
2810  void PropDialog::onFileFormatChanged() {  void FilePropDialog::set_FileFormat(int value)
     const int major = eFileFormat.get_value();  
     if (m_file) m_file->pVersion->major = major;  
 }  
   
 void PropDialog::set_info(DLS::Info* info)  
2811  {  {
2812      update(info);      m_file->pVersion->major = value;
2813  }  }
2814    
2815    
# Line 2843  InstrumentProps::InstrumentProps() : Line 2851  InstrumentProps::InstrumentProps() :
2851      eIsDrum(_("Is drum")),      eIsDrum(_("Is drum")),
2852      eMIDIBank(_("MIDI bank"), 0, 16383),      eMIDIBank(_("MIDI bank"), 0, 16383),
2853      eMIDIProgram(_("MIDI program")),      eMIDIProgram(_("MIDI program")),
2854      eAttenuation(_("Attenuation"), 0, 96, 0, 1),      eAttenuation(_("Attenuation (dB)"), -96, +96, 0, 1),
     eGainPlus6(_("Gain +6dB"), eAttenuation, -6),  
2855      eEffectSend(_("Effect send"), 0, 65535),      eEffectSend(_("Effect send"), 0, 65535),
2856      eFineTune(_("Fine tune"), -8400, 8400),      eFineTune(_("Fine tune"), -8400, 8400),
2857      ePitchbendRange(_("Pitchbend range"), 0, 48),      ePitchbendRange(_("Pitchbend range (halftones)"), 0, 48),
2858      ePianoReleaseMode(_("Piano release mode")),      ePianoReleaseMode(_("Piano release mode")),
2859      eDimensionKeyRangeLow(_("Keyswitching range low")),      eDimensionKeyRangeLow(_("Keyswitching range low")),
2860      eDimensionKeyRangeHigh(_("Keyswitching range high"))      eDimensionKeyRangeHigh(_("Keyswitching range high")),
2861        table2(2,1),
2862        eName2(_("Name")),
2863        eCreationDate(_("Creation date")),
2864        eComments(_("Comments")),
2865        eProduct(_("Product")),
2866        eCopyright(_("Copyright")),
2867        eArtists(_("Artists")),
2868        eGenre(_("Genre")),
2869        eKeywords(_("Keywords")),
2870        eEngineer(_("Engineer")),
2871        eTechnician(_("Technician")),
2872        eSoftware(_("Software")),
2873        eMedium(_("Medium")),
2874        eSource(_("Source")),
2875        eSourceForm(_("Source form")),
2876        eCommissioned(_("Commissioned")),
2877        eSubject(_("Subject"))
2878  {  {
2879      if (!Settings::singleton()->autoRestoreWindowDimension) {      if (!Settings::singleton()->autoRestoreWindowDimension) {
2880          //set_default_size(470, 390);          //set_default_size(470, 390);
# Line 2859  InstrumentProps::InstrumentProps() : Line 2883  InstrumentProps::InstrumentProps() :
2883    
2884      set_title(_("Instrument Properties"));      set_title(_("Instrument Properties"));
2885    
2886        tabs.append_page(vbox[1], _("Settings"));
2887        tabs.append_page(vbox[2], _("Info"));
2888    
2889      eDimensionKeyRangeLow.set_tip(      eDimensionKeyRangeLow.set_tip(
2890          _("start of the keyboard area which should switch the "          _("start of the keyboard area which should switch the "
2891            "\"keyswitching\" dimension")            "\"keyswitching\" dimension")
# Line 2873  InstrumentProps::InstrumentProps() : Line 2900  InstrumentProps::InstrumentProps() :
2900      connect(eMIDIBank, &InstrumentProps::set_MIDIBank);      connect(eMIDIBank, &InstrumentProps::set_MIDIBank);
2901      connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram);      connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram);
2902      connect(eAttenuation, &gig::Instrument::Attenuation);      connect(eAttenuation, &gig::Instrument::Attenuation);
     connect(eGainPlus6, &gig::Instrument::Attenuation);  
2903      connect(eEffectSend, &gig::Instrument::EffectSend);      connect(eEffectSend, &gig::Instrument::EffectSend);
2904      connect(eFineTune, &gig::Instrument::FineTune);      connect(eFineTune, &gig::Instrument::FineTune);
2905      connect(ePitchbendRange, &gig::Instrument::PitchbendRange);      connect(ePitchbendRange, &gig::Instrument::PitchbendRange);
# Line 2883  InstrumentProps::InstrumentProps() : Line 2909  InstrumentProps::InstrumentProps() :
2909    
2910      eName.signal_value_changed().connect(sig_name_changed.make_slot());      eName.signal_value_changed().connect(sig_name_changed.make_slot());
2911    
2912        connect(eName2, &InstrumentProps::set_Name);
2913        connectLambda(eCreationDate, [this](gig::String s) {
2914            m->pInfo->CreationDate = s;
2915        });
2916        connectLambda(eComments, [this](gig::String s) {
2917            m->pInfo->Comments = s;
2918        });
2919        connectLambda(eProduct, [this](gig::String s) {
2920            m->pInfo->Product = s;
2921        });
2922        connectLambda(eCopyright, [this](gig::String s) {
2923            m->pInfo->Copyright = s;
2924        });
2925        connectLambda(eArtists, [this](gig::String s) {
2926            m->pInfo->Artists = s;
2927        });
2928        connectLambda(eGenre, [this](gig::String s) {
2929            m->pInfo->Genre = s;
2930        });
2931        connectLambda(eKeywords, [this](gig::String s) {
2932            m->pInfo->Keywords = s;
2933        });
2934        connectLambda(eEngineer, [this](gig::String s) {
2935            m->pInfo->Engineer = s;
2936        });
2937        connectLambda(eTechnician, [this](gig::String s) {
2938            m->pInfo->Technician = s;
2939        });
2940        connectLambda(eSoftware, [this](gig::String s) {
2941            m->pInfo->Software = s;
2942        });
2943        connectLambda(eMedium, [this](gig::String s) {
2944            m->pInfo->Medium = s;
2945        });
2946        connectLambda(eSource, [this](gig::String s) {
2947            m->pInfo->Source = s;
2948        });
2949        connectLambda(eSourceForm, [this](gig::String s) {
2950            m->pInfo->SourceForm = s;
2951        });
2952        connectLambda(eCommissioned, [this](gig::String s) {
2953            m->pInfo->Commissioned = s;
2954        });
2955        connectLambda(eSubject, [this](gig::String s) {
2956            m->pInfo->Subject = s;
2957        });
2958    
2959        // tab 1
2960  #if USE_GTKMM_GRID  #if USE_GTKMM_GRID
2961      table.set_column_spacing(5);      table.set_column_spacing(5);
2962  #else  #else
2963      table.set_col_spacings(5);      table.set_col_spacings(5);
2964  #endif  #endif
   
2965      table.add(eName);      table.add(eName);
2966      table.add(eIsDrum);      table.add(eIsDrum);
2967      table.add(eMIDIBank);      table.add(eMIDIBank);
2968      table.add(eMIDIProgram);      table.add(eMIDIProgram);
2969      table.add(eAttenuation);      table.add(eAttenuation);
     table.add(eGainPlus6);  
2970      table.add(eEffectSend);      table.add(eEffectSend);
2971      table.add(eFineTune);      table.add(eFineTune);
2972      table.add(ePitchbendRange);      table.add(ePitchbendRange);
# Line 2902  InstrumentProps::InstrumentProps() : Line 2974  InstrumentProps::InstrumentProps() :
2974      table.add(eDimensionKeyRangeLow);      table.add(eDimensionKeyRangeLow);
2975      table.add(eDimensionKeyRangeHigh);      table.add(eDimensionKeyRangeHigh);
2976    
2977      add(vbox);      // tab 2
2978  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if USE_GTKMM_GRID
2979        table2.set_column_spacing(5);
2980    #else
2981        table2.set_col_spacings(5);
2982    #endif
2983        table2.add(eName2);
2984        table2.add(eCreationDate);
2985        table2.add(eComments);
2986        table2.add(eProduct);
2987        table2.add(eCopyright);
2988        table2.add(eArtists);
2989        table2.add(eGenre);
2990        table2.add(eKeywords);
2991        table2.add(eEngineer);
2992        table2.add(eTechnician);
2993        table2.add(eSoftware);
2994        table2.add(eMedium);
2995        table2.add(eSource);
2996        table2.add(eSourceForm);
2997        table2.add(eCommissioned);
2998        table2.add(eSubject);
2999    
3000        add(vbox[0]);
3001    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3002      table.set_margin(5);      table.set_margin(5);
3003  #else  #else
3004      table.set_border_width(5);      table.set_border_width(5);
3005  #endif  #endif
3006      vbox.pack_start(table);      vbox[1].pack_start(table);
3007        vbox[2].pack_start(table2);
3008      table.show();      table.show();
3009      vbox.pack_start(buttonBox, Gtk::PACK_SHRINK);      table2.show();
3010        vbox[0].pack_start(tabs);
3011        vbox[0].pack_start(buttonBox, Gtk::PACK_SHRINK);
3012      buttonBox.set_layout(Gtk::BUTTONBOX_END);      buttonBox.set_layout(Gtk::BUTTONBOX_END);
3013  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3014      buttonBox.set_margin(5);      buttonBox.set_margin(5);
3015  #else  #else
3016      buttonBox.set_border_width(5);      buttonBox.set_border_width(5);
# Line 2926  InstrumentProps::InstrumentProps() : Line 3024  InstrumentProps::InstrumentProps() :
3024          sigc::mem_fun(*this, &InstrumentProps::hide));          sigc::mem_fun(*this, &InstrumentProps::hide));
3025    
3026      quitButton.show();      quitButton.show();
3027      vbox.show();      vbox[0].show();
3028  #if HAS_GTKMM_SHOW_ALL_CHILDREN  #if HAS_GTKMM_SHOW_ALL_CHILDREN
3029      show_all_children();      show_all_children();
3030  #endif  #endif
# Line 2937  void InstrumentProps::set_instrument(gig Line 3035  void InstrumentProps::set_instrument(gig
3035      update(instrument);      update(instrument);
3036    
3037      update_model++;      update_model++;
3038    
3039        // tab 1
3040      eName.set_value(instrument->pInfo->Name);      eName.set_value(instrument->pInfo->Name);
3041      eIsDrum.set_value(instrument->IsDrum);      eIsDrum.set_value(instrument->IsDrum);
3042      eMIDIBank.set_value(instrument->MIDIBank);      eMIDIBank.set_value(instrument->MIDIBank);
3043      eMIDIProgram.set_value(instrument->MIDIProgram);      eMIDIProgram.set_value(instrument->MIDIProgram);
3044        // tab 2
3045        eName2.set_value(instrument->pInfo->Name);
3046        eCreationDate.set_value(instrument->pInfo->CreationDate);
3047        eComments.set_value(instrument->pInfo->Comments);
3048        eProduct.set_value(instrument->pInfo->Product);
3049        eCopyright.set_value(instrument->pInfo->Copyright);
3050        eArtists.set_value(instrument->pInfo->Artists);
3051        eGenre.set_value(instrument->pInfo->Genre);
3052        eKeywords.set_value(instrument->pInfo->Keywords);
3053        eEngineer.set_value(instrument->pInfo->Engineer);
3054        eTechnician.set_value(instrument->pInfo->Technician);
3055        eSoftware.set_value(instrument->pInfo->Software);
3056        eMedium.set_value(instrument->pInfo->Medium);
3057        eSource.set_value(instrument->pInfo->Source);
3058        eSourceForm.set_value(instrument->pInfo->SourceForm);
3059        eCommissioned.set_value(instrument->pInfo->Commissioned);
3060        eSubject.set_value(instrument->pInfo->Subject);
3061    
3062        update_model--;
3063    }
3064    
3065    
3066    SampleProps::SampleProps() :
3067    #if HAS_GTKMM_STOCK
3068        quitButton(Gtk::Stock::CLOSE),
3069    #else
3070        quitButton(_("_Close")),
3071    #endif
3072        table(2,1),
3073        eName(_("Name")),
3074        eUnityNote(_("Unity Note")),
3075        eSampleGroup(_("Sample Group")),
3076        eSampleFormatInfo(_("Sample Format")),
3077        eSampleID("Sample ID"),
3078        eChecksum("Wave Data CRC-32"),
3079        eLoopsCount(_("Loops"), 0, 1), // we might support more than 1 loop in future
3080        eLoopStart(_("Loop start position"), 0, 9999999),
3081        eLoopLength(_("Loop size"), 0, 9999999),
3082        eLoopType(_("Loop type")),
3083        eLoopPlayCount(_("Playback count")),
3084        table2(2,1),
3085        eName2(_("Name")),
3086        eCreationDate(_("Creation date")),
3087        eComments(_("Comments")),
3088        eProduct(_("Product")),
3089        eCopyright(_("Copyright")),
3090        eArtists(_("Artists")),
3091        eGenre(_("Genre")),
3092        eKeywords(_("Keywords")),
3093        eEngineer(_("Engineer")),
3094        eTechnician(_("Technician")),
3095        eSoftware(_("Software")),
3096        eMedium(_("Medium")),
3097        eSource(_("Source")),
3098        eSourceForm(_("Source form")),
3099        eCommissioned(_("Commissioned")),
3100        eSubject(_("Subject"))
3101    {
3102        if (!Settings::singleton()->autoRestoreWindowDimension) {
3103            //set_default_size(470, 390);
3104            set_position(Gtk::WIN_POS_MOUSE);
3105        }
3106    
3107        set_title(_("Sample Properties"));
3108    
3109        tabs.append_page(vbox[1], _("Settings"));
3110        tabs.append_page(vbox[2], _("Info"));
3111    
3112        connect(eName, &SampleProps::set_Name);
3113        connect(eUnityNote, &gig::Sample::MIDIUnityNote);
3114        connect(eLoopsCount, &gig::Sample::Loops);
3115        connectLambda(eLoopStart, [this](uint32_t start){
3116            m->LoopStart = start;
3117            m->LoopEnd = start + m->LoopSize;
3118        });
3119        connectLambda(eLoopLength, [this](uint32_t length){
3120            m->LoopSize = length;
3121            m->LoopEnd = m->LoopStart + length;
3122        });
3123        {
3124            const char* choices[] = { _("normal"), _("bidirectional"), _("backward"), 0 };
3125            static const gig::loop_type_t values[] = {
3126                gig::loop_type_normal,
3127                gig::loop_type_bidirectional,
3128                gig::loop_type_backward
3129            };
3130            eLoopType.set_choices(choices, values);
3131        }
3132        connect(eLoopType, &gig::Sample::LoopType);
3133        connect(eLoopPlayCount, &gig::Sample::LoopPlayCount);
3134    
3135        eName.signal_value_changed().connect(sig_name_changed.make_slot());
3136    
3137        connect(eName2, &SampleProps::set_Name);
3138        connectLambda(eCreationDate, [this](gig::String s) {
3139            m->pInfo->CreationDate = s;
3140        });
3141        connectLambda(eComments, [this](gig::String s) {
3142            m->pInfo->Comments = s;
3143        });
3144        connectLambda(eProduct, [this](gig::String s) {
3145            m->pInfo->Product = s;
3146        });
3147        connectLambda(eCopyright, [this](gig::String s) {
3148            m->pInfo->Copyright = s;
3149        });
3150        connectLambda(eArtists, [this](gig::String s) {
3151            m->pInfo->Artists = s;
3152        });
3153        connectLambda(eGenre, [this](gig::String s) {
3154            m->pInfo->Genre = s;
3155        });
3156        connectLambda(eKeywords, [this](gig::String s) {
3157            m->pInfo->Keywords = s;
3158        });
3159        connectLambda(eEngineer, [this](gig::String s) {
3160            m->pInfo->Engineer = s;
3161        });
3162        connectLambda(eTechnician, [this](gig::String s) {
3163            m->pInfo->Technician = s;
3164        });
3165        connectLambda(eSoftware, [this](gig::String s) {
3166            m->pInfo->Software = s;
3167        });
3168        connectLambda(eMedium, [this](gig::String s) {
3169            m->pInfo->Medium = s;
3170        });
3171        connectLambda(eSource, [this](gig::String s) {
3172            m->pInfo->Source = s;
3173        });
3174        connectLambda(eSourceForm, [this](gig::String s) {
3175            m->pInfo->SourceForm = s;
3176        });
3177        connectLambda(eCommissioned, [this](gig::String s) {
3178            m->pInfo->Commissioned = s;
3179        });
3180        connectLambda(eSubject, [this](gig::String s) {
3181            m->pInfo->Subject = s;
3182        });
3183    
3184        // tab 1
3185    #if USE_GTKMM_GRID
3186        table.set_column_spacing(5);
3187    #else
3188        table.set_col_spacings(5);
3189    #endif
3190        table.add(eName);
3191        table.add(eUnityNote);
3192        table.add(eSampleGroup);
3193        table.add(eSampleFormatInfo);
3194        table.add(eSampleID);
3195        table.add(eChecksum);
3196        table.add(eLoopsCount);
3197        table.add(eLoopStart);
3198        table.add(eLoopLength);
3199        table.add(eLoopType);
3200        table.add(eLoopPlayCount);
3201    
3202        // tab 2
3203    #if USE_GTKMM_GRID
3204        table2.set_column_spacing(5);
3205    #else
3206        table2.set_col_spacings(5);
3207    #endif
3208        table2.add(eName2);
3209        table2.add(eCreationDate);
3210        table2.add(eComments);
3211        table2.add(eProduct);
3212        table2.add(eCopyright);
3213        table2.add(eArtists);
3214        table2.add(eGenre);
3215        table2.add(eKeywords);
3216        table2.add(eEngineer);
3217        table2.add(eTechnician);
3218        table2.add(eSoftware);
3219        table2.add(eMedium);
3220        table2.add(eSource);
3221        table2.add(eSourceForm);
3222        table2.add(eCommissioned);
3223        table2.add(eSubject);
3224    
3225        add(vbox[0]);
3226    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3227        table.set_margin(5);
3228    #else
3229        table.set_border_width(5);
3230    #endif
3231        vbox[1].pack_start(table);
3232        vbox[2].pack_start(table2);
3233        table.show();
3234        table2.show();
3235        vbox[0].pack_start(tabs);
3236        vbox[0].pack_start(buttonBox, Gtk::PACK_SHRINK);
3237        buttonBox.set_layout(Gtk::BUTTONBOX_END);
3238    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3239        buttonBox.set_margin(5);
3240    #else
3241        buttonBox.set_border_width(5);
3242    #endif
3243        buttonBox.show();
3244        buttonBox.pack_start(quitButton);
3245        quitButton.set_can_default();
3246        quitButton.grab_focus();
3247    
3248        quitButton.signal_clicked().connect(
3249            sigc::mem_fun(*this, &SampleProps::hide));
3250    
3251        quitButton.show();
3252        vbox[0].show();
3253    #if HAS_GTKMM_SHOW_ALL_CHILDREN
3254        show_all_children();
3255    #endif
3256    }
3257    
3258    void SampleProps::set_sample(gig::Sample* sample)
3259    {
3260        update(sample);
3261    
3262        update_model++;
3263    
3264        // tab 1
3265        eName.set_value(sample->pInfo->Name);
3266        eUnityNote.set_value(sample->MIDIUnityNote);
3267        // show sample group name
3268        {
3269            Glib::ustring s = "---";
3270            if (sample && sample->GetGroup())
3271                s = sample->GetGroup()->Name;
3272            eSampleGroup.text.set_text(s);
3273        }
3274        // assemble sample format info string
3275        {
3276            Glib::ustring s;
3277            if (sample) {
3278                switch (sample->Channels) {
3279                    case 1: s = _("Mono"); break;
3280                    case 2: s = _("Stereo"); break;
3281                    default:
3282                        s = ToString(sample->Channels) + _(" audio channels");
3283                        break;
3284                }
3285                s += " " + ToString(sample->BitDepth) + " Bits";
3286                s += " " + ToString(sample->SamplesPerSecond/1000) + "."
3287                         + ToString((sample->SamplesPerSecond%1000)/100) + " kHz";
3288            } else {
3289                s = _("No sample assigned to this dimension region.");
3290            }
3291            eSampleFormatInfo.text.set_text(s);
3292        }
3293        // generate sample's memory address pointer string
3294        {
3295            Glib::ustring s;
3296            if (sample) {
3297                char buf[64] = {};
3298                snprintf(buf, sizeof(buf), "%p", sample);
3299                s = buf;
3300            } else {
3301                s = "---";
3302            }
3303            eSampleID.text.set_text(s);
3304        }
3305        // generate raw wave form data CRC-32 checksum string
3306        {
3307            Glib::ustring s = "---";
3308            if (sample) {
3309                char buf[64] = {};
3310                snprintf(buf, sizeof(buf), "%x", sample->GetWaveDataCRC32Checksum());
3311                s = buf;
3312            }
3313            eChecksum.text.set_text(s);
3314        }
3315        eLoopsCount.set_value(sample->Loops);
3316        eLoopStart.set_value(sample->LoopStart);
3317        eLoopLength.set_value(sample->LoopSize);
3318        eLoopType.set_value(sample->LoopType);
3319        eLoopPlayCount.set_value(sample->LoopPlayCount);
3320        // tab 2
3321        eName2.set_value(sample->pInfo->Name);
3322        eCreationDate.set_value(sample->pInfo->CreationDate);
3323        eComments.set_value(sample->pInfo->Comments);
3324        eProduct.set_value(sample->pInfo->Product);
3325        eCopyright.set_value(sample->pInfo->Copyright);
3326        eArtists.set_value(sample->pInfo->Artists);
3327        eGenre.set_value(sample->pInfo->Genre);
3328        eKeywords.set_value(sample->pInfo->Keywords);
3329        eEngineer.set_value(sample->pInfo->Engineer);
3330        eTechnician.set_value(sample->pInfo->Technician);
3331        eSoftware.set_value(sample->pInfo->Software);
3332        eMedium.set_value(sample->pInfo->Medium);
3333        eSource.set_value(sample->pInfo->Source);
3334        eSourceForm.set_value(sample->pInfo->SourceForm);
3335        eCommissioned.set_value(sample->pInfo->Commissioned);
3336        eSubject.set_value(sample->pInfo->Subject);
3337    
3338        update_model--;
3339    }
3340    
3341    void SampleProps::set_Name(const gig::String& name)
3342    {
3343        m->pInfo->Name = name;
3344    }
3345    
3346    void SampleProps::update_name()
3347    {
3348        update_model++;
3349        eName.set_value(m->pInfo->Name);
3350      update_model--;      update_model--;
3351  }  }
3352    
# Line 2974  void MainWindow::updateSampleRefCountMap Line 3380  void MainWindow::updateSampleRefCountMap
3380      }      }
3381  }  }
3382    
3383    bool MainWindow::onQueryTreeViewTooltip(int x, int y, bool keyboardTip, const Glib::RefPtr<Gtk::Tooltip>& tooltip) {
3384        Gtk::TreeModel::iterator iter;
3385        if (!m_TreeView.get_tooltip_context_iter(x, y, keyboardTip, iter)) {
3386            return false;
3387        }
3388        Gtk::TreeModel::Path path(iter);
3389        Gtk::TreeModel::Row row = *iter;
3390        Gtk::TreeViewColumn* pointedColumn = NULL;
3391        // resolve the precise table column the mouse points to
3392        {
3393            Gtk::TreeModel::Path path; // unused
3394            int cellX, cellY; // unused
3395            m_TreeView.get_path_at_pos(x, y, path, pointedColumn, cellX, cellY);
3396        }
3397        Gtk::TreeViewColumn* scriptsColumn = m_TreeView.get_column(2);
3398        if (pointedColumn == scriptsColumn) { // mouse hovers scripts column ...
3399            // show the script(s) assigned to the hovered instrument as tooltip
3400            tooltip->set_markup( row[m_Columns.m_col_tooltip] );
3401            m_TreeView.set_tooltip_cell(tooltip, &path, scriptsColumn, NULL);
3402        } else {
3403            // if beginners' tooltips is disabled then don't show the following one
3404            if (!Settings::singleton()->showTooltips)
3405                return false;
3406            // yeah, a beginners tooltip
3407            tooltip->set_text(_(
3408                "Right click here for actions on instruments & MIDI Rules. "
3409                "Drag & drop to change the order of instruments."
3410            ));
3411            m_TreeView.set_tooltip_cell(tooltip, &path, pointedColumn, NULL);
3412        }
3413        return true;
3414    }
3415    
3416    static Glib::ustring scriptTooltipFor(gig::Instrument* instrument, int index) {
3417        Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
3418        const int iScriptSlots = instrument->ScriptSlotCount();
3419        Glib::ustring tooltip = "<u>(" + ToString(index) + ") “"  + name + "”</u>\n\n";
3420        if (!iScriptSlots)
3421            tooltip += "<span foreground='red'><i>No script assigned</i></span>";
3422        else {
3423            for (int i = 0; i < iScriptSlots; ++i) {
3424                tooltip += "• " + ToString(i+1) + ". Script: “<span foreground='#46DEFF'><b>" +
3425                           instrument->GetScriptOfSlot(i)->Name + "</b></span>”";
3426                if (i + 1 < iScriptSlots) tooltip += "\n\n";
3427            }
3428        }
3429        return tooltip;
3430    }
3431    
3432  void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument)  void MainWindow::load_gig(gig::File* gig, const char* filename, bool isSharedInstrument)
3433  {  {
3434      file = 0;      file = 0;
# Line 2987  void MainWindow::load_gig(gig::File* gig Line 3442  void MainWindow::load_gig(gig::File* gig
3442      file_has_name = filename;      file_has_name = filename;
3443      file_is_changed = false;      file_is_changed = false;
3444    
3445      propDialog.set_file(gig);      fileProps.set_file(gig);
     propDialog.set_info(gig->pInfo);  
3446    
3447      instrument_name_connection.block();      instrument_name_connection.block();
3448      int index = 0;      int index = 0;
# Line 3003  void MainWindow::load_gig(gig::File* gig Line 3457  void MainWindow::load_gig(gig::File* gig
3457          row[m_Columns.m_col_name] = name;          row[m_Columns.m_col_name] = name;
3458          row[m_Columns.m_col_instr] = instrument;          row[m_Columns.m_col_instr] = instrument;
3459          row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";          row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
3460            row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
3461    
3462  #if !USE_GTKMM_BUILDER  #if !USE_GTKMM_BUILDER
3463          add_instrument_to_menu(name);          add_instrument_to_menu(name);
# Line 3120  void MainWindow::instr_name_changed_by_i Line 3575  void MainWindow::instr_name_changed_by_i
3575      gig::Instrument* instrument = row[m_Columns.m_col_instr];      gig::Instrument* instrument = row[m_Columns.m_col_instr];
3576      Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name));      Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name));
3577      if (gigname != name) {      if (gigname != name) {
3578            Gtk::TreeModel::Path path(*it);
3579            const int index = path[0];
3580          row[m_Columns.m_col_name] = gigname;          row[m_Columns.m_col_name] = gigname;
3581            row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
3582        }
3583    }
3584    
3585    bool MainWindow::sample_props_set_sample()
3586    {
3587        sampleProps.signal_name_changed().clear();
3588    
3589        std::vector<Gtk::TreeModel::Path> rows = m_TreeViewSamples.get_selection()->get_selected_rows();
3590        if (rows.empty()) {
3591            sampleProps.hide();
3592            return false;
3593        }
3594        //NOTE: was const_iterator before, which did not compile with GTKMM4 development branch, probably going to be fixed before final GTKMM4 release though.
3595        Gtk::TreeModel::iterator it = m_refSamplesTreeModel->get_iter(rows[0]);
3596        if (it) {
3597            Gtk::TreeModel::Row row = *it;
3598            gig::Sample* sample = row[m_SamplesModel.m_col_sample];
3599    
3600            sampleProps.set_sample(sample);
3601    
3602            // make sure sample tree is updated when user changes the
3603            // sample name in sample properties window
3604            sampleProps.signal_name_changed().connect(
3605                sigc::bind(
3606                    sigc::mem_fun(*this,
3607                        &MainWindow::sample_name_changed_by_sample_props
3608                    ), it
3609                )
3610            );
3611        } else {
3612            sampleProps.hide();
3613        }
3614        //NOTE: explicit boolean cast required for GTKMM4 development branch here
3615        return it ? true : false;
3616    }
3617    
3618    void MainWindow::show_sample_props()
3619    {
3620        if (sample_props_set_sample()) {
3621            sampleProps.show();
3622            sampleProps.deiconify();
3623        }
3624    }
3625    
3626    void MainWindow::sample_name_changed_by_sample_props(Gtk::TreeModel::iterator& it)
3627    {
3628        Gtk::TreeModel::Row row = *it;
3629        Glib::ustring name = row[m_SamplesModel.m_col_name];
3630    
3631        gig::Sample* sample = row[m_SamplesModel.m_col_sample];
3632        Glib::ustring gigname(gig_to_utf8(sample->pInfo->Name));
3633        if (gigname != name) {
3634            Gtk::TreeModel::Path path(*it);
3635            row[m_SamplesModel.m_col_name] = gigname;
3636      }      }
3637  }  }
3638    
# Line 3166  void MainWindow::onScriptSlotsModified(g Line 3678  void MainWindow::onScriptSlotsModified(g
3678          Gtk::TreeModel::Row row = model->children()[i];          Gtk::TreeModel::Row row = model->children()[i];
3679          if (row[m_Columns.m_col_instr] != pInstrument) continue;          if (row[m_Columns.m_col_instr] != pInstrument) continue;
3680          row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";          row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
3681            row[m_Columns.m_col_tooltip] = scriptTooltipFor(pInstrument, i);
3682          break;          break;
3683      }      }
3684    
# Line 3191  void MainWindow::assignScript(gig::Scrip Line 3704  void MainWindow::assignScript(gig::Scrip
3704      onScriptSlotsModified(pInstrument);      onScriptSlotsModified(pInstrument);
3705  }  }
3706    
3707    void MainWindow::dropAllScriptSlots() {
3708        gig::Instrument* pInstrument = get_instrument();
3709        if (!pInstrument) {
3710            printf("!instrument\n");
3711            return;
3712        }
3713    
3714        const int iScriptSlots = pInstrument->ScriptSlotCount();
3715        for (int i = iScriptSlots - 1; i >= 0; --i)
3716            pInstrument->RemoveScriptSlot(i);
3717    
3718        onScriptSlotsModified(pInstrument);
3719    }
3720    
3721  void MainWindow::on_action_refresh_all() {  void MainWindow::on_action_refresh_all() {
3722      __refreshEntireGUI();      __refreshEntireGUI();
3723  }  }
# Line 3365  void MainWindow::select_instrument(gig:: Line 3892  void MainWindow::select_instrument(gig::
3892              show_intruments_tab();              show_intruments_tab();
3893              m_TreeView.get_selection()->unselect_all();              m_TreeView.get_selection()->unselect_all();
3894                            
3895  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3896              auto iterSel = model->children()[i].get_iter();              auto iterSel = model->children()[i].get_iter();
3897              m_TreeView.get_selection()->select(iterSel);              m_TreeView.get_selection()->select(iterSel);
3898  #else  #else
# Line 3395  bool MainWindow::select_dimension_region Line 3922  bool MainWindow::select_dimension_region
3922              // select and show the respective instrument in the list view              // select and show the respective instrument in the list view
3923              show_intruments_tab();              show_intruments_tab();
3924              m_TreeView.get_selection()->unselect_all();              m_TreeView.get_selection()->unselect_all();
3925  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3926              auto iterSel = model->children()[i].get_iter();              auto iterSel = model->children()[i].get_iter();
3927              m_TreeView.get_selection()->select(iterSel);              m_TreeView.get_selection()->select(iterSel);
3928  #else  #else
# Line 3431  void MainWindow::select_sample(gig::Samp Line 3958  void MainWindow::select_sample(gig::Samp
3958              if (rowSample[m_SamplesModel.m_col_sample] == sample) {              if (rowSample[m_SamplesModel.m_col_sample] == sample) {
3959                  show_samples_tab();                  show_samples_tab();
3960                  m_TreeViewSamples.get_selection()->unselect_all();                  m_TreeViewSamples.get_selection()->unselect_all();
3961  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
3962                  auto iterSel = rowGroup.children()[s].get_iter();                  auto iterSel = rowGroup.children()[s].get_iter();
3963                  m_TreeViewSamples.get_selection()->select(iterSel);                  m_TreeViewSamples.get_selection()->select(iterSel);
3964  #else  #else
# Line 3631  void MainWindow::updateScriptListOfMenu( Line 4158  void MainWindow::updateScriptListOfMenu(
4158          assign_scripts_menu->append(*item);          assign_scripts_menu->append(*item);
4159      }      }
4160    
4161        // add separator line to menu
4162        assign_scripts_menu->append(*new Gtk::SeparatorMenuItem);
4163    
4164        {
4165            Gtk::MenuItem* item = new Gtk::MenuItem(_("Unassign All Scripts"));
4166            item->signal_activate().connect(
4167                sigc::mem_fun(*this, &MainWindow::dropAllScriptSlots)
4168            );
4169            assign_scripts_menu->append(*item);
4170            item->set_accel_path("<Scripts>/DropAllScriptSlots");
4171        }
4172    
4173  #if HAS_GTKMM_SHOW_ALL_CHILDREN  #if HAS_GTKMM_SHOW_ALL_CHILDREN
4174      assign_scripts_menu->show_all_children();      assign_scripts_menu->show_all_children();
4175  #endif  #endif
# Line 3679  void MainWindow::add_instrument(gig::Ins Line 4218  void MainWindow::add_instrument(gig::Ins
4218      instrument_name_connection.block();      instrument_name_connection.block();
4219      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();
4220      Gtk::TreeModel::Row rowInstr = *iterInstr;      Gtk::TreeModel::Row rowInstr = *iterInstr;
4221      rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1;      const int index = m_refTreeModel->children().size() - 1;
4222        rowInstr[m_Columns.m_col_nr] = index;
4223      rowInstr[m_Columns.m_col_name] = name;      rowInstr[m_Columns.m_col_name] = name;
4224      rowInstr[m_Columns.m_col_instr] = instrument;      rowInstr[m_Columns.m_col_instr] = instrument;
4225      rowInstr[m_Columns.m_col_scripts] = "";      rowInstr[m_Columns.m_col_scripts] = "";
4226        rowInstr[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
4227      instrument_name_connection.unblock();      instrument_name_connection.unblock();
4228    
4229  #if !USE_GTKMM_BUILDER  #if !USE_GTKMM_BUILDER
# Line 3769  void MainWindow::on_action_remove_instru Line 4310  void MainWindow::on_action_remove_instru
4310                       it != m_refTreeModel->children().end(); ++it, ++index)                       it != m_refTreeModel->children().end(); ++it, ++index)
4311                  {                  {
4312                      Gtk::TreeModel::Row row = *it;                      Gtk::TreeModel::Row row = *it;
4313                        gig::Instrument* instrument = row[m_Columns.m_col_instr];
4314                      row[m_Columns.m_col_nr] = index;                      row[m_Columns.m_col_nr] = index;
4315                        row[m_Columns.m_col_tooltip] = scriptTooltipFor(instrument, index);
4316                  }                  }
4317              }              }
4318    
# Line 3799  void MainWindow::on_action_remove_instru Line 4342  void MainWindow::on_action_remove_instru
4342  }  }
4343    
4344  void MainWindow::on_action_sample_properties() {  void MainWindow::on_action_sample_properties() {
4345      //TODO: show a dialog where the selected sample's properties can be edited      show_sample_props();
     Gtk::MessageDialog msg(  
         *this, _("Sorry, yet to be implemented!"), false, Gtk::MESSAGE_INFO  
     );  
     msg.run();  
4346  }  }
4347    
4348  void MainWindow::on_action_add_script_group() {  void MainWindow::on_action_add_script_group() {
# Line 4022  void MainWindow::add_or_replace_sample(b Line 4561  void MainWindow::add_or_replace_sample(b
4561          dialog.set_current_folder(current_sample_dir);          dialog.set_current_folder(current_sample_dir);
4562      }      }
4563      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
4564            dialog.hide();
4565          current_sample_dir = dialog.get_current_folder();          current_sample_dir = dialog.get_current_folder();
4566          Glib::ustring error_files;          Glib::ustring error_files;
4567          std::vector<std::string> filenames = dialog.get_filenames();          std::vector<std::string> filenames = dialog.get_filenames();
# Line 4202  void MainWindow::on_action_replace_all_s Line 4742  void MainWindow::on_action_replace_all_s
4742      }      }
4743      if (dialog.run() == Gtk::RESPONSE_OK)      if (dialog.run() == Gtk::RESPONSE_OK)
4744      {      {
4745            dialog.hide();
4746          current_sample_dir = dialog.get_current_folder();          current_sample_dir = dialog.get_current_folder();
4747          Glib::ustring error_files;          Glib::ustring error_files;
4748          std::string folder = dialog.get_filename();          std::string folder = dialog.get_filename();
# Line 4600  void MainWindow::sample_name_changed(con Line 5141  void MainWindow::sample_name_changed(con
5141              file_changed();              file_changed();
5142          }          }
5143      }      }
5144        // change name in the sample properties window
5145        if (sampleProps.get_sample() == sample && sample) {
5146            sampleProps.set_sample(sample);
5147        }
5148  }  }
5149    
5150  void MainWindow::script_name_changed(const Gtk::TreeModel::Path& path,  void MainWindow::script_name_changed(const Gtk::TreeModel::Path& path,
# Line 4690  bool MainWindow::instrument_row_visible( Line 5235  bool MainWindow::instrument_row_visible(
5235      trim(pattern);      trim(pattern);
5236      if (pattern.empty()) return true;      if (pattern.empty()) return true;
5237    
5238  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 22)  #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
5239      //HACK: on GTKMM4 development branch const_iterator cannot be easily converted to iterator, probably going to be fixed before final GTKMM4 release though.      //HACK: on GTKMM4 development branch const_iterator cannot be easily converted to iterator, probably going to be fixed before final GTKMM4 release though.
5240      Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter);      Gtk::TreeModel::Row row = **(Gtk::TreeModel::iterator*)(&iter);
5241  #else  #else
# Line 4930  void MainWindow::on_action_merge_files() Line 5475  void MainWindow::on_action_merge_files()
5475  #endif  #endif
5476    
5477      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
5478            dialog.hide();
5479    #ifdef GLIB_THREADS
5480          printf("on_action_merge_files self=%p\n",          printf("on_action_merge_files self=%p\n",
5481                 static_cast<void*>(Glib::Threads::Thread::self()));                 static_cast<void*>(Glib::Threads::Thread::self()));
5482    #else
5483            std::cout << "on_action_merge_files self=" <<
5484                std::this_thread::get_id() << "\n";
5485    #endif
5486          std::vector<std::string> filenames = dialog.get_filenames();          std::vector<std::string> filenames = dialog.get_filenames();
5487    
5488          // merge the selected files to the currently open .gig file          // merge the selected files to the currently open .gig file

Legend:
Removed from v.3409  
changed lines
  Added in v.3643

  ViewVC Help
Powered by ViewVC