/[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 3157 by schoenebeck, Mon May 8 17:30:10 2017 UTC revision 3258 by schoenebeck, Tue May 30 20:17:12 2017 UTC
# Line 35  Line 35 
35  #include <gtkmm/aboutdialog.h>  #include <gtkmm/aboutdialog.h>
36  #include <gtkmm/filechooserdialog.h>  #include <gtkmm/filechooserdialog.h>
37  #include <gtkmm/messagedialog.h>  #include <gtkmm/messagedialog.h>
38    #include <gtkmm/stock.h>
39  #include <gtkmm/targetentry.h>  #include <gtkmm/targetentry.h>
40  #include <gtkmm/main.h>  #include <gtkmm/main.h>
41  #include <gtkmm/toggleaction.h>  #include <gtkmm/toggleaction.h>
# Line 61  Line 62 
62  #include "gfx/builtinpix.h"  #include "gfx/builtinpix.h"
63  #include "MacroEditor.h"  #include "MacroEditor.h"
64  #include "MacrosSetup.h"  #include "MacrosSetup.h"
65    #if defined(__APPLE__)
66    # include "MacHelper.h"
67    #endif
68    
69  MainWindow::MainWindow() :  MainWindow::MainWindow() :
70      m_DimRegionChooser(*this),      m_DimRegionChooser(*this),
# Line 77  MainWindow::MainWindow() : Line 81  MainWindow::MainWindow() :
81      loadBuiltInPix();      loadBuiltInPix();
82    
83  //    set_border_width(5);  //    set_border_width(5);
84  //    set_default_size(400, 200);  
85        if (!Settings::singleton()->autoRestoreWindowDimension) {
86            set_default_size(800, 600);
87            set_position(Gtk::WIN_POS_CENTER);
88        }
89    
90      add(m_VBox);      add(m_VBox);
91    
# Line 156  MainWindow::MainWindow() : Line 164  MainWindow::MainWindow() :
164      actionGroup = Gtk::ActionGroup::create();      actionGroup = Gtk::ActionGroup::create();
165    
166      actionGroup->add(Gtk::Action::create("MenuFile", _("_File")));      actionGroup->add(Gtk::Action::create("MenuFile", _("_File")));
167      actionGroup->add(Gtk::Action::create("New", _("_New")),      actionGroup->add(Gtk::Action::create("New", Gtk::Stock::NEW),
                      Gtk::AccelKey("<control>n"),  
168                       sigc::mem_fun(                       sigc::mem_fun(
169                           *this, &MainWindow::on_action_file_new));                           *this, &MainWindow::on_action_file_new));
170      actionGroup->add(Gtk::Action::create("Open", _("_Open...")),      Glib::RefPtr<Gtk::Action> action =
171                       Gtk::AccelKey("<control>o"),          Gtk::Action::create("Open", Gtk::Stock::OPEN);
172        action->property_label() = action->property_label() + "...";
173        actionGroup->add(action,
174                       sigc::mem_fun(                       sigc::mem_fun(
175                           *this, &MainWindow::on_action_file_open));                           *this, &MainWindow::on_action_file_open));
176      actionGroup->add(Gtk::Action::create("Save", _("_Save")),      actionGroup->add(Gtk::Action::create("Save", Gtk::Stock::SAVE),
                      Gtk::AccelKey("<control>s"),  
177                       sigc::mem_fun(                       sigc::mem_fun(
178                           *this, &MainWindow::on_action_file_save));                           *this, &MainWindow::on_action_file_save));
179      actionGroup->add(Gtk::Action::create("SaveAs", _("Save _As...")),      action = Gtk::Action::create("SaveAs", Gtk::Stock::SAVE_AS);
180        action->property_label() = action->property_label() + "...";
181        actionGroup->add(action,
182                       Gtk::AccelKey("<shift><control>s"),                       Gtk::AccelKey("<shift><control>s"),
183                       sigc::mem_fun(                       sigc::mem_fun(
184                           *this, &MainWindow::on_action_file_save_as));                           *this, &MainWindow::on_action_file_save_as));
185      actionGroup->add(Gtk::Action::create("Properties",      actionGroup->add(Gtk::Action::create("Properties",
186                                           _("_Properties")),                                           Gtk::Stock::PROPERTIES),
187                       sigc::mem_fun(                       sigc::mem_fun(
188                           *this, &MainWindow::on_action_file_properties));                           *this, &MainWindow::on_action_file_properties));
189      actionGroup->add(Gtk::Action::create("InstrProperties",      actionGroup->add(Gtk::Action::create("InstrProperties",
190                                           _("_Properties")),                                           Gtk::Stock::PROPERTIES),
191                       sigc::mem_fun(                       sigc::mem_fun(
192                           *this, &MainWindow::show_instr_props));                           *this, &MainWindow::show_instr_props));
193      actionGroup->add(Gtk::Action::create("MidiRules",      actionGroup->add(Gtk::Action::create("MidiRules",
# Line 188  MainWindow::MainWindow() : Line 198  MainWindow::MainWindow() :
198                                           _("_Script Slots...")),                                           _("_Script Slots...")),
199                       sigc::mem_fun(                       sigc::mem_fun(
200                           *this, &MainWindow::show_script_slots));                           *this, &MainWindow::show_script_slots));
201      actionGroup->add(Gtk::Action::create("Quit", _("_Quit")),      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),
                      Gtk::AccelKey("<control>q"),  
202                       sigc::mem_fun(                       sigc::mem_fun(
203                           *this, &MainWindow::on_action_quit));                           *this, &MainWindow::on_action_quit));
204      actionGroup->add(      actionGroup->add(
# Line 316  MainWindow::MainWindow() : Line 325  MainWindow::MainWindow() :
325          sigc::mem_fun(*this, &MainWindow::on_action_refresh_all)          sigc::mem_fun(*this, &MainWindow::on_action_refresh_all)
326      );                      );                
327    
328      actionGroup->add(Gtk::Action::create("MenuHelp", _("_Help")));      action = Gtk::Action::create("MenuHelp", Gtk::Stock::HELP);
329      actionGroup->add(Gtk::Action::create("About", _("_About")),      actionGroup->add(Gtk::Action::create("MenuHelp",
330                                             action->property_label()));
331        actionGroup->add(Gtk::Action::create("About", Gtk::Stock::ABOUT),
332                       sigc::mem_fun(                       sigc::mem_fun(
333                           *this, &MainWindow::on_action_help_about));                           *this, &MainWindow::on_action_help_about));
334      actionGroup->add(      actionGroup->add(
# Line 329  MainWindow::MainWindow() : Line 340  MainWindow::MainWindow() :
340          sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_duplicate_instrument)
341      );      );
342      actionGroup->add(      actionGroup->add(
343          Gtk::Action::create("RemoveInstrument", _("_Remove")),          Gtk::Action::create("RemoveInstrument", Gtk::Stock::REMOVE),
344          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)          sigc::mem_fun(*this, &MainWindow::on_action_remove_instrument)
345      );      );
346    
# Line 376  MainWindow::MainWindow() : Line 387  MainWindow::MainWindow() :
387    
388      // sample right-click popup actions      // sample right-click popup actions
389      actionGroup->add(      actionGroup->add(
390          Gtk::Action::create("SampleProperties", _("_Properties")),          Gtk::Action::create("SampleProperties", Gtk::Stock::PROPERTIES),
391          sigc::mem_fun(*this, &MainWindow::on_action_sample_properties)          sigc::mem_fun(*this, &MainWindow::on_action_sample_properties)
392      );      );
393      actionGroup->add(      actionGroup->add(
# Line 388  MainWindow::MainWindow() : Line 399  MainWindow::MainWindow() :
399          sigc::mem_fun(*this, &MainWindow::on_action_add_sample)          sigc::mem_fun(*this, &MainWindow::on_action_add_sample)
400      );      );
401      actionGroup->add(      actionGroup->add(
402          Gtk::Action::create("RemoveSample", _("_Remove")),          Gtk::Action::create("RemoveSample", Gtk::Stock::REMOVE),
403          sigc::mem_fun(*this, &MainWindow::on_action_remove_sample)          sigc::mem_fun(*this, &MainWindow::on_action_remove_sample)
404      );      );
405      actionGroup->add(      actionGroup->add(
# Line 424  MainWindow::MainWindow() : Line 435  MainWindow::MainWindow() :
435          sigc::mem_fun(*this, &MainWindow::on_action_edit_script)          sigc::mem_fun(*this, &MainWindow::on_action_edit_script)
436      );      );
437      actionGroup->add(      actionGroup->add(
438          Gtk::Action::create("RemoveScript", _("_Remove")),          Gtk::Action::create("RemoveScript", Gtk::Stock::REMOVE),
439          sigc::mem_fun(*this, &MainWindow::on_action_remove_script)          sigc::mem_fun(*this, &MainWindow::on_action_remove_script)
440      );      );
441    
# Line 650  MainWindow::MainWindow() : Line 661  MainWindow::MainWindow() :
661      // Add the TreeView's view columns:      // Add the TreeView's view columns:
662      m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr);      m_TreeView.append_column(_("Nr"), m_Columns.m_col_nr);
663      m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name);      m_TreeView.append_column_editable(_("Instrument"), m_Columns.m_col_name);
664        m_TreeView.append_column(_("Scripts"), m_Columns.m_col_scripts);
665      m_TreeView.set_headers_visible(true);      m_TreeView.set_headers_visible(true);
666            
667      // establish drag&drop within the instrument tree view, allowing to reorder      // establish drag&drop within the instrument tree view, allowing to reorder
# Line 866  MainWindow::MainWindow() : Line 878  MainWindow::MainWindow() :
878    
879          updateMacroMenu();          updateMacroMenu();
880      }      }
881    
882        Glib::signal_idle().connect_once(
883            sigc::mem_fun(*this, &MainWindow::bringToFront),
884            200
885        );
886  }  }
887    
888  MainWindow::~MainWindow()  MainWindow::~MainWindow()
889  {  {
890  }  }
891    
892    void MainWindow::bringToFront() {
893        #if defined(__APPLE__)
894        macRaiseAppWindow();
895        #endif
896        raise();
897        present();
898    }
899    
900  void MainWindow::updateMacroMenu() {  void MainWindow::updateMacroMenu() {
901      Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>(      Gtk::Menu* menuMacro = dynamic_cast<Gtk::MenuItem*>(
902          uiManager->get_widget("/MenuBar/MenuMacro")          uiManager->get_widget("/MenuBar/MenuMacro")
# Line 910  void MainWindow::updateMacroMenu() { Line 935  void MainWindow::updateMacroMenu() {
935          );          );
936          menuMacro->append(*item);          menuMacro->append(*item);
937          item->set_accel_path("<Macros>/macro_" + ToString(iMacro));          item->set_accel_path("<Macros>/macro_" + ToString(iMacro));
938            Glib::ustring comment = macro.comment();
939            if (!comment.empty())
940                item->set_tooltip_text(comment);
941      }      }
942      // if there are no macros configured at all, then show a dummy entry instead      // if there are no macros configured at all, then show a dummy entry instead
943      if (m_macros.empty()) {      if (m_macros.empty()) {
# Line 953  void MainWindow::onMacroSelected(int iMa Line 981  void MainWindow::onMacroSelected(int iMa
981    
982  void MainWindow::setupMacros() {  void MainWindow::setupMacros() {
983      MacrosSetup* setup = new MacrosSetup();      MacrosSetup* setup = new MacrosSetup();
984      setup->setMacros(m_macros);      gig::DimensionRegion* pDimRgn = m_DimRegionChooser.get_main_dimregion();
985        setup->setMacros(m_macros, &m_serializationArchive, pDimRgn);
986      setup->signal_macros_changed().connect(      setup->signal_macros_changed().connect(
987          sigc::mem_fun(*this, &MainWindow::onMacrosSetupChanged)          sigc::mem_fun(*this, &MainWindow::onMacrosSetupChanged)
988      );      );
# Line 1196  void Saver::thread_function() Line 1225  void Saver::thread_function()
1225                  // save the file as separate temporary file first,                  // save the file as separate temporary file first,
1226                  // then move the saved file over the old file                  // then move the saved file over the old file
1227                  // (may result in performance speedup during save)                  // (may result in performance speedup during save)
1228                  String tmpname = filename + ".TMP";                  gig::String tmpname = filename + ".TMP";
1229                  gig->Save(tmpname, &progress);                  gig->Save(tmpname, &progress);
1230                  #if defined(WIN32)                  #if defined(WIN32)
1231                  if (!DeleteFile(filename.c_str())) {                  if (!DeleteFile(filename.c_str())) {
# Line 1204  void Saver::thread_function() Line 1233  void Saver::thread_function()
1233                  }                  }
1234                  #else // POSIX ...                  #else // POSIX ...
1235                  if (unlink(filename.c_str())) {                  if (unlink(filename.c_str())) {
1236                      throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file): " + String(strerror(errno)));                      throw RIFF::Exception("Could not replace original file with temporary file (unable to remove original file): " + gig::String(strerror(errno)));
1237                  }                  }
1238                  #endif                  #endif
1239                  if (rename(tmpname.c_str(), filename.c_str())) {                  if (rename(tmpname.c_str(), filename.c_str())) {
1240                      #if defined(WIN32)                      #if defined(WIN32)
1241                      throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file).");                      throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file).");
1242                      #else                      #else
1243                      throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file): " + String(strerror(errno)));                      throw RIFF::Exception("Could not replace original file with temporary file (unable to rename temp file): " + gig::String(strerror(errno)));
1244                      #endif                      #endif
1245                  }                  }
1246              }              }
# Line 1339  bool MainWindow::close_confirmation_dial Line 1368  bool MainWindow::close_confirmation_dial
1368      g_free(msg);      g_free(msg);
1369      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."));
1370      dialog.add_button(_("Close _Without Saving"), Gtk::RESPONSE_NO);      dialog.add_button(_("Close _Without Saving"), Gtk::RESPONSE_NO);
1371      dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1372      dialog.add_button(file_has_name ? _("_Save") : _("Save _As"), Gtk::RESPONSE_YES);      dialog.add_button(file_has_name ? Gtk::Stock::SAVE : Gtk::Stock::SAVE_AS, Gtk::RESPONSE_YES);
1373      dialog.set_default_response(Gtk::RESPONSE_YES);      dialog.set_default_response(Gtk::RESPONSE_YES);
1374      int response = dialog.run();      int response = dialog.run();
1375      dialog.hide();      dialog.hide();
# Line 1371  bool MainWindow::leaving_shared_mode_dia Line 1400  bool MainWindow::leaving_shared_mode_dia
1400            "used by the sampler until you tell the sampler explicitly to "            "used by the sampler until you tell the sampler explicitly to "
1401            "load it."));            "load it."));
1402      dialog.add_button(_("_Yes, Detach"), Gtk::RESPONSE_YES);      dialog.add_button(_("_Yes, Detach"), Gtk::RESPONSE_YES);
1403      dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1404      dialog.set_default_response(Gtk::RESPONSE_CANCEL);      dialog.set_default_response(Gtk::RESPONSE_CANCEL);
1405      int response = dialog.run();      int response = dialog.run();
1406      dialog.hide();      dialog.hide();
# Line 1385  void MainWindow::on_action_file_open() Line 1414  void MainWindow::on_action_file_open()
1414      if (file_is_shared && !leaving_shared_mode_dialog()) return;      if (file_is_shared && !leaving_shared_mode_dialog()) return;
1415    
1416      Gtk::FileChooserDialog dialog(*this, _("Open file"));      Gtk::FileChooserDialog dialog(*this, _("Open file"));
1417      dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1418      dialog.add_button(_("_Open"), Gtk::RESPONSE_OK);      dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
1419      dialog.set_default_response(Gtk::RESPONSE_OK);      dialog.set_default_response(Gtk::RESPONSE_OK);
1420  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
1421      Gtk::FileFilter filter;      Gtk::FileFilter filter;
# Line 1581  void MainWindow::on_action_file_save_as( Line 1610  void MainWindow::on_action_file_save_as(
1610    
1611  bool MainWindow::file_save_as()  bool MainWindow::file_save_as()
1612  {  {
1613      Gtk::FileChooserDialog dialog(*this, _("Save As"), Gtk::FILE_CHOOSER_ACTION_SAVE);      Gtk::FileChooserDialog dialog(*this, _("Save as"), Gtk::FILE_CHOOSER_ACTION_SAVE);
1614      dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1615      dialog.add_button(_("_Save"), Gtk::RESPONSE_OK);      dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
1616      dialog.set_default_response(Gtk::RESPONSE_OK);      dialog.set_default_response(Gtk::RESPONSE_OK);
1617      dialog.set_do_overwrite_confirmation();      dialog.set_do_overwrite_confirmation();
1618    
# Line 1807  void MainWindow::on_action_help_about() Line 1836  void MainWindow::on_action_help_about()
1836      dialog.set_comments(sComment.c_str());      dialog.set_comments(sComment.c_str());
1837      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
1838      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
1839        dialog.set_position(Gtk::WIN_POS_CENTER);
1840      dialog.run();      dialog.run();
1841  }  }
1842    
# Line 1828  PropDialog::PropDialog() Line 1858  PropDialog::PropDialog()
1858        eSourceForm(_("Source form")),        eSourceForm(_("Source form")),
1859        eCommissioned(_("Commissioned")),        eCommissioned(_("Commissioned")),
1860        eSubject(_("Subject")),        eSubject(_("Subject")),
1861        quitButton(_("_Close"), true),        quitButton(Gtk::Stock::CLOSE),
1862        table(2, 1),        table(2, 1),
1863        m_file(NULL)        m_file(NULL)
1864  {  {
1865        if (!Settings::singleton()->autoRestoreWindowDimension) {
1866            set_default_size(470, 390);
1867            set_position(Gtk::WIN_POS_MOUSE);
1868        }
1869    
1870      set_title(_("File Properties"));      set_title(_("File Properties"));
1871      eName.set_width_chars(50);      eName.set_width_chars(50);
1872    
# Line 1951  void InstrumentProps::set_MIDIProgram(ui Line 1986  void InstrumentProps::set_MIDIProgram(ui
1986  }  }
1987    
1988  InstrumentProps::InstrumentProps() :  InstrumentProps::InstrumentProps() :
1989      quitButton(_("_Close"), true),      quitButton(Gtk::Stock::CLOSE),
1990      table(2,1),      table(2,1),
1991      eName(_("Name")),      eName(_("Name")),
1992      eIsDrum(_("Is drum")),      eIsDrum(_("Is drum")),
# Line 1966  InstrumentProps::InstrumentProps() : Line 2001  InstrumentProps::InstrumentProps() :
2001      eDimensionKeyRangeLow(_("Keyswitching range low")),      eDimensionKeyRangeLow(_("Keyswitching range low")),
2002      eDimensionKeyRangeHigh(_("Keyswitching range high"))      eDimensionKeyRangeHigh(_("Keyswitching range high"))
2003  {  {
2004        if (!Settings::singleton()->autoRestoreWindowDimension) {
2005            //set_default_size(470, 390);
2006            set_position(Gtk::WIN_POS_MOUSE);
2007        }
2008    
2009      set_title(_("Instrument Properties"));      set_title(_("Instrument Properties"));
2010    
2011      eDimensionKeyRangeLow.set_tip(      eDimensionKeyRangeLow.set_tip(
# Line 2090  void MainWindow::load_gig(gig::File* gig Line 2130  void MainWindow::load_gig(gig::File* gig
2130      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;
2131           instrument = gig->GetNextInstrument(), ++index) {           instrument = gig->GetNextInstrument(), ++index) {
2132          Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));          Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
2133            const int iScriptSlots = instrument->ScriptSlotCount();
2134    
2135          Gtk::TreeModel::iterator iter = m_refTreeModel->append();          Gtk::TreeModel::iterator iter = m_refTreeModel->append();
2136          Gtk::TreeModel::Row row = *iter;          Gtk::TreeModel::Row row = *iter;
2137          row[m_Columns.m_col_nr] = index;          row[m_Columns.m_col_nr] = index;
2138          row[m_Columns.m_col_name] = name;          row[m_Columns.m_col_name] = name;
2139          row[m_Columns.m_col_instr] = instrument;          row[m_Columns.m_col_instr] = instrument;
2140            row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
2141    
2142          add_instrument_to_menu(name);          add_instrument_to_menu(name);
2143      }      }
# Line 2234  void MainWindow::show_script_slots() { Line 2276  void MainWindow::show_script_slots() {
2276    
2277      ScriptSlots* window = new ScriptSlots;      ScriptSlots* window = new ScriptSlots;
2278      window->setInstrument(instrument);      window->setInstrument(instrument);
2279        window->signal_script_slots_changed().connect(
2280            sigc::mem_fun(*this, &MainWindow::onScriptSlotsModified)
2281        );
2282      //window->reparent(*this);      //window->reparent(*this);
2283      window->show();      window->show();
2284  }  }
2285    
2286    void MainWindow::onScriptSlotsModified(gig::Instrument* pInstrument) {
2287        if (!pInstrument) return;
2288        const int iScriptSlots = pInstrument->ScriptSlotCount();
2289    
2290        Glib::RefPtr<Gtk::TreeModel> model = m_TreeView.get_model();
2291        for (int i = 0; i < model->children().size(); ++i) {
2292            Gtk::TreeModel::Row row = model->children()[i];
2293            if (row[m_Columns.m_col_instr] != pInstrument) continue;
2294            row[m_Columns.m_col_scripts] = iScriptSlots ? ToString(iScriptSlots) : "";
2295            break;
2296        }
2297    }
2298    
2299  void MainWindow::on_action_refresh_all() {  void MainWindow::on_action_refresh_all() {
2300      __refreshEntireGUI();      __refreshEntireGUI();
2301  }  }
# Line 2552  void MainWindow::add_instrument(gig::Ins Line 2610  void MainWindow::add_instrument(gig::Ins
2610      rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1;      rowInstr[m_Columns.m_col_nr] = m_refTreeModel->children().size() - 1;
2611      rowInstr[m_Columns.m_col_name] = name;      rowInstr[m_Columns.m_col_name] = name;
2612      rowInstr[m_Columns.m_col_instr] = instrument;      rowInstr[m_Columns.m_col_instr] = instrument;
2613        rowInstr[m_Columns.m_col_scripts] = "";
2614      instrument_name_connection.unblock();      instrument_name_connection.unblock();
2615    
2616      add_instrument_to_menu(name);      add_instrument_to_menu(name);
# Line 2840  void MainWindow::add_or_replace_sample(b Line 2899  void MainWindow::add_or_replace_sample(b
2899    
2900      // show 'browse for file' dialog      // show 'browse for file' dialog
2901      Gtk::FileChooserDialog dialog(*this, replace ? _("Replace Sample with") : _("Add Sample(s)"));      Gtk::FileChooserDialog dialog(*this, replace ? _("Replace Sample with") : _("Add Sample(s)"));
2902      dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
2903      dialog.add_button(_("_Open"), Gtk::RESPONSE_OK);      dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
2904      dialog.set_select_multiple(!replace); // allow multi audio file selection only when adding new samples, does not make sense when replacing a specific sample      dialog.set_select_multiple(!replace); // allow multi audio file selection only when adding new samples, does not make sense when replacing a specific sample
2905    
2906      // matches all file types supported by libsndfile      // matches all file types supported by libsndfile
# Line 3041  void MainWindow::on_action_replace_all_s Line 3100  void MainWindow::on_action_replace_all_s
3100      dialog.get_vbox()->pack_start(entryArea, Gtk::PACK_SHRINK);      dialog.get_vbox()->pack_start(entryArea, Gtk::PACK_SHRINK);
3101      description.show();      description.show();
3102      entryArea.show_all();      entryArea.show_all();
3103      dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
3104      dialog.add_button(_("Select"), Gtk::RESPONSE_OK);      dialog.add_button(_("Select"), Gtk::RESPONSE_OK);
3105      dialog.set_select_multiple(false);      dialog.set_select_multiple(false);
3106      if (current_sample_dir != "") {      if (current_sample_dir != "") {
# Line 3530  void MainWindow::instrument_name_changed Line 3589  void MainWindow::instrument_name_changed
3589  void MainWindow::on_action_combine_instruments() {  void MainWindow::on_action_combine_instruments() {
3590      CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);      CombineInstrumentsDialog* d = new CombineInstrumentsDialog(*this, file);
3591      d->show_all();      d->show_all();
     d->resize(500, 400);  
3592      d->run();      d->run();
3593      if (d->fileWasChanged()) {      if (d->fileWasChanged()) {
3594          // update GUI with new instrument just created          // update GUI with new instrument just created
# Line 3665  void MainWindow::on_action_merge_files() Line 3723  void MainWindow::on_action_merge_files()
3723      }      }
3724    
3725      Gtk::FileChooserDialog dialog(*this, _("Merge .gig files"));      Gtk::FileChooserDialog dialog(*this, _("Merge .gig files"));
3726      dialog.add_button(_("_Cancel"), Gtk::RESPONSE_CANCEL);      dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
3727      dialog.add_button(_("Merge"), Gtk::RESPONSE_OK);      dialog.add_button(_("Merge"), Gtk::RESPONSE_OK);
3728      dialog.set_default_response(Gtk::RESPONSE_CANCEL);      dialog.set_default_response(Gtk::RESPONSE_CANCEL);
3729  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
# Line 3865  void MainWindow::paste_copied_dimrgn() { Line 3923  void MainWindow::paste_copied_dimrgn() {
3923    
3924  void MainWindow::adjust_clipboard_content() {  void MainWindow::adjust_clipboard_content() {
3925      MacroEditor* editor = new MacroEditor();      MacroEditor* editor = new MacroEditor();
3926      editor->setMacro(&m_serializationArchive);      editor->setMacro(&m_serializationArchive, true);
3927      editor->show();      editor->show();
3928  }  }
3929    
# Line 3915  void MainWindow::applyMacro(Serializatio Line 3973  void MainWindow::applyMacro(Serializatio
3973           itDimReg != dimreg_edit.dimregs.end(); ++itDimReg)           itDimReg != dimreg_edit.dimregs.end(); ++itDimReg)
3974      {      {
3975          gig::DimensionRegion* pDimRgn = *itDimReg;          gig::DimensionRegion* pDimRgn = *itDimReg;
3976          dimreg_to_be_changed_signal.emit(pDimRgn);          DimRegionChangeGuard(this, pDimRgn);
3977          m_serializationArchive.deserialize(pDimRgn);          macro.deserialize(pDimRgn);
         dimreg_changed_signal.emit(pDimRgn);  
3978      }      }
3979      //region_changed()      //region_changed()
3980      file_changed();      file_changed();

Legend:
Removed from v.3157  
changed lines
  Added in v.3258

  ViewVC Help
Powered by ViewVC