/[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 2445 by persson, Sun Apr 28 06:07:22 2013 UTC revision 2507 by persson, Sun Jan 12 19:37:55 2014 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2013 Andreas Persson   * Copyright (C) 2006-2014 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 123  MainWindow::MainWindow() : Line 123  MainWindow::MainWindow() :
123                                           Gtk::Stock::PROPERTIES),                                           Gtk::Stock::PROPERTIES),
124                       sigc::mem_fun(                       sigc::mem_fun(
125                           *this, &MainWindow::show_instr_props));                           *this, &MainWindow::show_instr_props));
126        actionGroup->add(Gtk::Action::create("MidiRules",
127                                             _("_Midi Rules")),
128                         sigc::mem_fun(
129                             *this, &MainWindow::show_midi_rules));
130      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),
131                       sigc::mem_fun(                       sigc::mem_fun(
132                           *this, &MainWindow::on_action_quit));                           *this, &MainWindow::on_action_quit));
133      actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument")));      actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument")));
134    
135      actionGroup->add(Gtk::Action::create("MenuView", _("_View")));  
136        actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));
137    
138      Glib::RefPtr<Gtk::ToggleAction> toggle_action =      Glib::RefPtr<Gtk::ToggleAction> toggle_action =
139            Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note"), "ffaga");
140        toggle_action->set_active(true);
141        //FIXME: doesn't work, why?
142        toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));
143        actionGroup->add(toggle_action);
144    
145        toggle_action =
146            Gtk::ToggleAction::create("CopySampleTune", _("Copy Sample's _Fine Tune"));
147        toggle_action->set_active(true);
148        //FIXME: doesn't work, why?
149        toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));
150        actionGroup->add(toggle_action);
151    
152        toggle_action =
153            Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points"));
154        toggle_action->set_active(true);
155        //FIXME: doesn't work, why?
156        toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));
157        actionGroup->add(toggle_action);
158    
159    
160        actionGroup->add(Gtk::Action::create("MenuView", _("_View")));
161        toggle_action =
162          Gtk::ToggleAction::create("Statusbar", _("_Statusbar"));          Gtk::ToggleAction::create("Statusbar", _("_Statusbar"));
163      toggle_action->set_active(true);      toggle_action->set_active(true);
164      actionGroup->add(toggle_action,      actionGroup->add(toggle_action,
# Line 196  MainWindow::MainWindow() : Line 225  MainWindow::MainWindow() :
225          "      <separator/>"          "      <separator/>"
226          "      <menuitem action='Quit'/>"          "      <menuitem action='Quit'/>"
227          "    </menu>"          "    </menu>"
228            "    <menu action='MenuEdit'>"
229            "      <menuitem action='CopySampleUnity'/>"
230            "      <menuitem action='CopySampleTune'/>"
231            "      <menuitem action='CopySampleLoop'/>"
232            "    </menu>"
233          "    <menu action='MenuInstrument'>"          "    <menu action='MenuInstrument'>"
234          "    </menu>"          "    </menu>"
235          "    <menu action='MenuView'>"          "    <menu action='MenuView'>"
# Line 207  MainWindow::MainWindow() : Line 241  MainWindow::MainWindow() :
241          "  </menubar>"          "  </menubar>"
242          "  <popup name='PopupMenu'>"          "  <popup name='PopupMenu'>"
243          "    <menuitem action='InstrProperties'/>"          "    <menuitem action='InstrProperties'/>"
244            "    <menuitem action='MidiRules'/>"
245          "    <menuitem action='AddInstrument'/>"          "    <menuitem action='AddInstrument'/>"
246          "    <menuitem action='DupInstrument'/>"          "    <menuitem action='DupInstrument'/>"
247          "    <separator/>"          "    <separator/>"
# Line 297  MainWindow::MainWindow() : Line 332  MainWindow::MainWindow() :
332          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
333      propDialog.signal_changed().connect(      propDialog.signal_changed().connect(
334          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
335        midiRules.signal_changed().connect(
336            sigc::mem_fun(*this, &MainWindow::file_changed));
337    
338      dimreg_edit.signal_dimreg_to_be_changed().connect(      dimreg_edit.signal_dimreg_to_be_changed().connect(
339          dimreg_to_be_changed_signal.make_slot());          dimreg_to_be_changed_signal.make_slot());
# Line 545  void MainWindow::on_action_file_new() Line 582  void MainWindow::on_action_file_new()
582      gig::File* pFile = new gig::File;      gig::File* pFile = new gig::File;
583      // already add one new instrument by default      // already add one new instrument by default
584      gig::Instrument* pInstrument = pFile->AddInstrument();      gig::Instrument* pInstrument = pFile->AddInstrument();
585      pInstrument->pInfo->Name = _("Unnamed Instrument");      pInstrument->pInfo->Name = gig_from_utf8(_("Unnamed Instrument"));
586      // update GUI with that new gig::File      // update GUI with that new gig::File
587      load_gig(pFile, 0 /*no file name yet*/);      load_gig(pFile, 0 /*no file name yet*/);
588  }  }
# Line 906  void MainWindow::on_action_help_about() Line 943  void MainWindow::on_action_help_about()
943      dialog.set_name("Gigedit");      dialog.set_name("Gigedit");
944  #endif  #endif
945      dialog.set_version(VERSION);      dialog.set_version(VERSION);
946      dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2014 Andreas Persson");
947      dialog.set_comments(_(      const std::string sComment =
948          "Released under the GNU General Public License.\n"          _("Built " __DATE__ "\nUsing ") +
949          "\n"          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +
950          "Please notice that this is still a very young instrument editor. "          _(
951          "So better backup your Gigasampler files before editing them with "              "Gigedit is released under the GNU General Public License.\n"
952          "this application.\n"              "\n"
953          "\n"              "Please notice that this is still a very young instrument editor. "
954          "Please report bugs to: http://bugs.linuxsampler.org")              "So better backup your Gigasampler files before editing them with "
955      );              "this application.\n"
956                "\n"
957                "Please report bugs to: http://bugs.linuxsampler.org"
958            );
959        dialog.set_comments(sComment.c_str());
960      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
961      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
962      dialog.run();      dialog.run();
# Line 1143  void MainWindow::load_gig(gig::File* gig Line 1184  void MainWindow::load_gig(gig::File* gig
1184      instrument_name_connection.block();      instrument_name_connection.block();
1185      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;
1186           instrument = gig->GetNextInstrument()) {           instrument = gig->GetNextInstrument()) {
1187          Glib::ustring name(instrument->pInfo->Name);          Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
1188    
1189          Gtk::TreeModel::iterator iter = m_refTreeModel->append();          Gtk::TreeModel::iterator iter = m_refTreeModel->append();
1190          Gtk::TreeModel::Row row = *iter;          Gtk::TreeModel::Row row = *iter;
# Line 1159  void MainWindow::load_gig(gig::File* gig Line 1200  void MainWindow::load_gig(gig::File* gig
1200          if (group->Name != "") {          if (group->Name != "") {
1201              Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append();              Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append();
1202              Gtk::TreeModel::Row rowGroup = *iterGroup;              Gtk::TreeModel::Row rowGroup = *iterGroup;
1203              rowGroup[m_SamplesModel.m_col_name]   = group->Name.c_str();              rowGroup[m_SamplesModel.m_col_name]   = gig_to_utf8(group->Name);
1204              rowGroup[m_SamplesModel.m_col_group]  = group;              rowGroup[m_SamplesModel.m_col_group]  = group;
1205              rowGroup[m_SamplesModel.m_col_sample] = NULL;              rowGroup[m_SamplesModel.m_col_sample] = NULL;
1206              for (gig::Sample* sample = group->GetFirstSample();              for (gig::Sample* sample = group->GetFirstSample();
# Line 1167  void MainWindow::load_gig(gig::File* gig Line 1208  void MainWindow::load_gig(gig::File* gig
1208                  Gtk::TreeModel::iterator iterSample =                  Gtk::TreeModel::iterator iterSample =
1209                      m_refSamplesTreeModel->append(rowGroup.children());                      m_refSamplesTreeModel->append(rowGroup.children());
1210                  Gtk::TreeModel::Row rowSample = *iterSample;                  Gtk::TreeModel::Row rowSample = *iterSample;
1211                  rowSample[m_SamplesModel.m_col_name]   = sample->pInfo->Name.c_str();                  rowSample[m_SamplesModel.m_col_name] =
1212                        gig_to_utf8(sample->pInfo->Name);
1213                  rowSample[m_SamplesModel.m_col_sample] = sample;                  rowSample[m_SamplesModel.m_col_sample] = sample;
1214                  rowSample[m_SamplesModel.m_col_group]  = NULL;                  rowSample[m_SamplesModel.m_col_group]  = NULL;
1215              }              }
# Line 1180  void MainWindow::load_gig(gig::File* gig Line 1222  void MainWindow::load_gig(gig::File* gig
1222      m_TreeView.get_selection()->select(Gtk::TreePath("0"));      m_TreeView.get_selection()->select(Gtk::TreePath("0"));
1223    
1224      instr_props_set_instrument();      instr_props_set_instrument();
1225        gig::Instrument* instrument = get_instrument();
1226        if (instrument) {
1227            midiRules.set_instrument(instrument);
1228        }
1229  }  }
1230    
1231  bool MainWindow::instr_props_set_instrument()  bool MainWindow::instr_props_set_instrument()
# Line 1221  void MainWindow::instr_name_changed_by_i Line 1267  void MainWindow::instr_name_changed_by_i
1267      Glib::ustring name = row[m_Columns.m_col_name];      Glib::ustring name = row[m_Columns.m_col_name];
1268    
1269      gig::Instrument* instrument = row[m_Columns.m_col_instr];      gig::Instrument* instrument = row[m_Columns.m_col_instr];
1270      if (instrument->pInfo->Name != name) {      Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name));
1271          row[m_Columns.m_col_name] = instrument->pInfo->Name;      if (gigname != name) {
1272            row[m_Columns.m_col_name] = gigname;
1273        }
1274    }
1275    
1276    void MainWindow::show_midi_rules()
1277    {
1278        if (gig::Instrument* instrument = get_instrument())
1279        {
1280            midiRules.set_instrument(instrument);
1281            midiRules.show();
1282            midiRules.deiconify();
1283      }      }
1284  }  }
1285    
# Line 1237  void MainWindow::on_action_view_status_b Line 1294  void MainWindow::on_action_view_status_b
1294      else                    m_StatusBar.hide();      else                    m_StatusBar.hide();
1295  }  }
1296    
1297    bool MainWindow::is_copy_samples_unity_note_enabled() const {
1298        Gtk::CheckMenuItem* item =
1299            dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleUnity"));
1300        if (!item) {
1301            std::cerr << "/MenuBar/MenuEdit/CopySampleUnity == NULL\n";
1302            return true;
1303        }
1304        return item->get_active();
1305    }
1306    
1307    bool MainWindow::is_copy_samples_fine_tune_enabled() const {
1308        Gtk::CheckMenuItem* item =
1309            dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleTune"));
1310        if (!item) {
1311            std::cerr << "/MenuBar/MenuEdit/CopySampleTune == NULL\n";
1312            return true;
1313        }
1314        return item->get_active();
1315    }
1316    
1317    bool MainWindow::is_copy_samples_loop_enabled() const {
1318        Gtk::CheckMenuItem* item =
1319            dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop"));
1320        if (!item) {
1321            std::cerr << "/MenuBar/MenuEdit/CopySampleLoop == NULL\n";
1322            return true;
1323        }
1324        return item->get_active();
1325    }
1326    
1327  void MainWindow::on_button_release(GdkEventButton* button)  void MainWindow::on_button_release(GdkEventButton* button)
1328  {  {
1329      if (button->type == GDK_2BUTTON_PRESS) {      if (button->type == GDK_2BUTTON_PRESS) {
1330          show_instr_props();          show_instr_props();
1331      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {
1332            // gig v2 files have no midi rules
1333            static_cast<Gtk::MenuItem*>(
1334                uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive(
1335                    !(file->pVersion && file->pVersion->major == 2));
1336          popup_menu->popup(button->button, button->time);          popup_menu->popup(button->button, button->time);
1337      }      }
1338  }  }
# Line 1322  void MainWindow::remove_instrument_from_ Line 1413  void MainWindow::remove_instrument_from_
1413  }  }
1414    
1415  void MainWindow::add_instrument(gig::Instrument* instrument) {  void MainWindow::add_instrument(gig::Instrument* instrument) {
1416      const char* name = instrument->pInfo->Name.c_str();      const Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
1417    
1418      // update instrument tree view      // update instrument tree view
1419      instrument_name_connection.block();      instrument_name_connection.block();
# Line 1344  void MainWindow::on_action_add_instrumen Line 1435  void MainWindow::on_action_add_instrumen
1435      if (!file) return;      if (!file) return;
1436      gig::Instrument* instrument = file->AddInstrument();      gig::Instrument* instrument = file->AddInstrument();
1437      __instrument_indexer++;      __instrument_indexer++;
1438      instrument->pInfo->Name =      instrument->pInfo->Name = gig_from_utf8(_("Unnamed Instrument ") +
1439          _("Unnamed Instrument ") + ToString(__instrument_indexer);                                              ToString(__instrument_indexer));
1440    
1441      add_instrument(instrument);      add_instrument(instrument);
1442  }  }
# Line 1365  void MainWindow::on_action_duplicate_ins Line 1456  void MainWindow::on_action_duplicate_ins
1456      // duplicate the orginal instrument      // duplicate the orginal instrument
1457      gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig);      gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig);
1458      instrNew->pInfo->Name =      instrNew->pInfo->Name =
1459          instrOrig->pInfo->Name + " (" + _("Copy") + ")";          instrOrig->pInfo->Name +
1460            gig_from_utf8(Glib::ustring(" (") + _("Copy") + ")");
1461    
1462      add_instrument(instrNew);      add_instrument(instrNew);
1463  }  }
# Line 1413  void MainWindow::on_action_remove_instru Line 1505  void MainWindow::on_action_remove_instru
1505              }              }
1506  #endif  #endif
1507              instr_props_set_instrument();              instr_props_set_instrument();
1508                instr = get_instrument();
1509                if (instr) {
1510                    midiRules.set_instrument(instr);
1511                } else {
1512                    midiRules.hide();
1513                }
1514          } catch (RIFF::Exception e) {          } catch (RIFF::Exception e) {
1515              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1516              msg.run();              msg.run();
# Line 1432  void MainWindow::on_action_add_group() { Line 1530  void MainWindow::on_action_add_group() {
1530      static int __sample_indexer = 0;      static int __sample_indexer = 0;
1531      if (!file) return;      if (!file) return;
1532      gig::Group* group = file->AddGroup();      gig::Group* group = file->AddGroup();
1533      group->Name = _("Unnamed Group");      group->Name = gig_from_utf8(_("Unnamed Group"));
1534      if (__sample_indexer) group->Name += " " + ToString(__sample_indexer);      if (__sample_indexer) group->Name += " " + ToString(__sample_indexer);
1535      __sample_indexer++;      __sample_indexer++;
1536      // update sample tree view      // update sample tree view
1537      Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append();      Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append();
1538      Gtk::TreeModel::Row rowGroup = *iterGroup;      Gtk::TreeModel::Row rowGroup = *iterGroup;
1539      rowGroup[m_SamplesModel.m_col_name] = group->Name.c_str();      rowGroup[m_SamplesModel.m_col_name] = gig_to_utf8(group->Name);
1540      rowGroup[m_SamplesModel.m_col_sample] = NULL;      rowGroup[m_SamplesModel.m_col_sample] = NULL;
1541      rowGroup[m_SamplesModel.m_col_group] = group;      rowGroup[m_SamplesModel.m_col_group] = group;
1542      file_changed();      file_changed();
# Line 1547  void MainWindow::on_action_add_sample() Line 1645  void MainWindow::on_action_add_sample()
1645                          break;                          break;
1646                      }                      }
1647                  }                  }
1648                  sample->pInfo->Name = filename;                  sample->pInfo->Name = gig_from_utf8(filename);
1649                  sample->Channels = info.channels;                  sample->Channels = info.channels;
1650                  sample->BitDepth = bitdepth;                  sample->BitDepth = bitdepth;
1651                  sample->FrameSize = bitdepth / 8/*1 byte are 8 bits*/ * info.channels;                  sample->FrameSize = bitdepth / 8/*1 byte are 8 bits*/ * info.channels;
# Line 1561  void MainWindow::on_action_add_sample() Line 1659  void MainWindow::on_action_add_sample()
1659                                 &instrument, sizeof(instrument)) != SF_FALSE)                                 &instrument, sizeof(instrument)) != SF_FALSE)
1660                  {                  {
1661                      sample->MIDIUnityNote = instrument.basenote;                      sample->MIDIUnityNote = instrument.basenote;
1662                        sample->FineTune      = instrument.detune;
1663    
1664                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {
1665                          sample->Loops = 1;                          sample->Loops = 1;
# Line 1598  void MainWindow::on_action_add_sample() Line 1697  void MainWindow::on_action_add_sample()
1697                  Gtk::TreeModel::iterator iterSample =                  Gtk::TreeModel::iterator iterSample =
1698                      m_refSamplesTreeModel->append(row.children());                      m_refSamplesTreeModel->append(row.children());
1699                  Gtk::TreeModel::Row rowSample = *iterSample;                  Gtk::TreeModel::Row rowSample = *iterSample;
1700                  rowSample[m_SamplesModel.m_col_name]   = filename;                  rowSample[m_SamplesModel.m_col_name] =
1701                        gig_to_utf8(sample->pInfo->Name);
1702                  rowSample[m_SamplesModel.m_col_sample] = sample;                  rowSample[m_SamplesModel.m_col_sample] = sample;
1703                  rowSample[m_SamplesModel.m_col_group]  = NULL;                  rowSample[m_SamplesModel.m_col_group]  = NULL;
1704                  // close sound file                  // close sound file
# Line 1669  void MainWindow::on_action_replace_all_s Line 1769  void MainWindow::on_action_replace_all_s
1769               sample; sample = file->GetNextSample())               sample; sample = file->GetNextSample())
1770          {          {
1771              std::string filename =              std::string filename =
1772                  folder + G_DIR_SEPARATOR_S + sample->pInfo->Name +                  folder + G_DIR_SEPARATOR_S +
1773                  postfixEntryBox.get_text().raw();                  Glib::filename_from_utf8(gig_to_utf8(sample->pInfo->Name) +
1774                                             postfixEntryBox.get_text());
1775              SF_INFO info;              SF_INFO info;
1776              info.format = 0;              info.format = 0;
1777              SNDFILE* hFile = sf_open(filename.c_str(), SFM_READ, &info);              SNDFILE* hFile = sf_open(filename.c_str(), SFM_READ, &info);
# Line 1704  void MainWindow::on_action_replace_all_s Line 1805  void MainWindow::on_action_replace_all_s
1805              catch (std::string what)              catch (std::string what)
1806              {              {
1807                  if (!error_files.empty()) error_files += "\n";                  if (!error_files.empty()) error_files += "\n";
1808                      error_files += filename += " (" + what + ")";                  error_files += Glib::filename_to_utf8(filename) +
1809                        " (" + what + ")";
1810              }              }
1811          }          }
1812          // show error message box when some file(s) could not be opened / added          // show error message box when some file(s) could not be opened / added
# Line 1729  void MainWindow::on_action_remove_sample Line 1831  void MainWindow::on_action_remove_sample
1831          try {          try {
1832              // remove group or sample from the gig file              // remove group or sample from the gig file
1833              if (group) {              if (group) {
1834                  // temporarily remember the samples that bolong to                  // temporarily remember the samples that belong to
1835                  // that group (we need that to clean the queue)                  // that group (we need that to clean the queue)
1836                  std::list<gig::Sample*> members;                  std::list<gig::Sample*> members;
1837                  for (gig::Sample* pSample = group->GetFirstSample();                  for (gig::Sample* pSample = group->GetFirstSample();
# Line 1855  void MainWindow::on_sample_label_drop_dr Line 1957  void MainWindow::on_sample_label_drop_dr
1957              channels_changed = true;              channels_changed = true;
1958              region_changed();              region_changed();
1959          }          }
1960          dimreg_edit.set_sample(sample);          dimreg_edit.set_sample(
1961                sample,
1962                is_copy_samples_unity_note_enabled(),
1963                is_copy_samples_fine_tune_enabled(),
1964                is_copy_samples_loop_enabled()
1965            );
1966    
1967          if (sample->Channels == 2 && !stereo_dimension) {          if (sample->Channels == 2 && !stereo_dimension) {
1968              // add samplechannel dimension              // add samplechannel dimension
# Line 1898  void MainWindow::sample_name_changed(con Line 2005  void MainWindow::sample_name_changed(con
2005      Glib::ustring name  = row[m_SamplesModel.m_col_name];      Glib::ustring name  = row[m_SamplesModel.m_col_name];
2006      gig::Group* group   = row[m_SamplesModel.m_col_group];      gig::Group* group   = row[m_SamplesModel.m_col_group];
2007      gig::Sample* sample = row[m_SamplesModel.m_col_sample];      gig::Sample* sample = row[m_SamplesModel.m_col_sample];
2008        gig::String gigname(gig_from_utf8(name));
2009      if (group) {      if (group) {
2010          if (group->Name != name) {          if (group->Name != gigname) {
2011              group->Name = name;              group->Name = gigname;
2012              printf("group name changed\n");              printf("group name changed\n");
2013              file_changed();              file_changed();
2014          }          }
2015      } else if (sample) {      } else if (sample) {
2016          if (sample->pInfo->Name != name.raw()) {          if (sample->pInfo->Name != gigname) {
2017              sample->pInfo->Name = name.raw();              sample->pInfo->Name = gigname;
2018              printf("sample name changed\n");              printf("sample name changed\n");
2019              file_changed();              file_changed();
2020          }          }
# Line 1934  void MainWindow::instrument_name_changed Line 2042  void MainWindow::instrument_name_changed
2042    
2043      // change name in gig      // change name in gig
2044      gig::Instrument* instrument = row[m_Columns.m_col_instr];      gig::Instrument* instrument = row[m_Columns.m_col_instr];
2045      if (instrument && instrument->pInfo->Name != name.raw()) {      gig::String gigname(gig_from_utf8(name));
2046          instrument->pInfo->Name = name.raw();      if (instrument && instrument->pInfo->Name != gigname) {
2047            instrument->pInfo->Name = gigname;
2048    
2049          // change name in the instrument properties window          // change name in the instrument properties window
2050          if (instrumentProps.get_instrument() == instrument) {          if (instrumentProps.get_instrument() == instrument) {

Legend:
Removed from v.2445  
changed lines
  Added in v.2507

  ViewVC Help
Powered by ViewVC