/[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 2442 by persson, Sun Apr 14 07:29:59 2013 UTC revision 2476 by schoenebeck, Mon Sep 16 13:20:46 2013 UTC
# Line 128  MainWindow::MainWindow() : Line 128  MainWindow::MainWindow() :
128                           *this, &MainWindow::on_action_quit));                           *this, &MainWindow::on_action_quit));
129      actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument")));      actionGroup->add(Gtk::Action::create("MenuInstrument", _("_Instrument")));
130    
131      actionGroup->add(Gtk::Action::create("MenuView", _("_View")));  
132        actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));
133    
134      Glib::RefPtr<Gtk::ToggleAction> toggle_action =      Glib::RefPtr<Gtk::ToggleAction> toggle_action =
135            Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note"), "ffaga");
136        toggle_action->set_active(true);
137        //FIXME: doesn't work, why?
138        toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));
139        actionGroup->add(toggle_action);
140    
141        toggle_action =
142            Gtk::ToggleAction::create("CopySampleTune", _("Copy Sample's _Fine Tune"));
143        toggle_action->set_active(true);
144        //FIXME: doesn't work, why?
145        toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));
146        actionGroup->add(toggle_action);
147    
148        toggle_action =
149            Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points"));
150        toggle_action->set_active(true);
151        //FIXME: doesn't work, why?
152        toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));
153        actionGroup->add(toggle_action);
154    
155    
156        actionGroup->add(Gtk::Action::create("MenuView", _("_View")));
157        toggle_action =
158          Gtk::ToggleAction::create("Statusbar", _("_Statusbar"));          Gtk::ToggleAction::create("Statusbar", _("_Statusbar"));
159      toggle_action->set_active(true);      toggle_action->set_active(true);
160      actionGroup->add(toggle_action,      actionGroup->add(toggle_action,
# Line 196  MainWindow::MainWindow() : Line 221  MainWindow::MainWindow() :
221          "      <separator/>"          "      <separator/>"
222          "      <menuitem action='Quit'/>"          "      <menuitem action='Quit'/>"
223          "    </menu>"          "    </menu>"
224            "    <menu action='MenuEdit'>"
225            "      <menuitem action='CopySampleUnity'/>"
226            "      <menuitem action='CopySampleTune'/>"
227            "      <menuitem action='CopySampleLoop'/>"
228            "    </menu>"
229          "    <menu action='MenuInstrument'>"          "    <menu action='MenuInstrument'>"
230          "    </menu>"          "    </menu>"
231          "    <menu action='MenuView'>"          "    <menu action='MenuView'>"
# Line 545  void MainWindow::on_action_file_new() Line 575  void MainWindow::on_action_file_new()
575      gig::File* pFile = new gig::File;      gig::File* pFile = new gig::File;
576      // already add one new instrument by default      // already add one new instrument by default
577      gig::Instrument* pInstrument = pFile->AddInstrument();      gig::Instrument* pInstrument = pFile->AddInstrument();
578      pInstrument->pInfo->Name = _("Unnamed Instrument");      pInstrument->pInfo->Name = gig_from_utf8(_("Unnamed Instrument"));
579      // update GUI with that new gig::File      // update GUI with that new gig::File
580      load_gig(pFile, 0 /*no file name yet*/);      load_gig(pFile, 0 /*no file name yet*/);
581  }  }
# Line 907  void MainWindow::on_action_help_about() Line 937  void MainWindow::on_action_help_about()
937  #endif  #endif
938      dialog.set_version(VERSION);      dialog.set_version(VERSION);
939      dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson");
940      dialog.set_comments(_(      const std::string sComment =
941          "Released under the GNU General Public License.\n"          _("Built " __DATE__ "\nUsing ") +
942          "\n"          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +
943          "Please notice that this is still a very young instrument editor. "          _(
944          "So better backup your Gigasampler files before editing them with "              "Gigedit is released under the GNU General Public License.\n"
945          "this application.\n"              "\n"
946          "\n"              "Please notice that this is still a very young instrument editor. "
947          "Please report bugs to: http://bugs.linuxsampler.org")              "So better backup your Gigasampler files before editing them with "
948      );              "this application.\n"
949                "\n"
950                "Please report bugs to: http://bugs.linuxsampler.org"
951            );
952        dialog.set_comments(sComment.c_str());
953      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
954      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
955      dialog.run();      dialog.run();
# Line 1003  void PropDialog::set_info(DLS::Info* inf Line 1037  void PropDialog::set_info(DLS::Info* inf
1037  }  }
1038    
1039    
1040    void InstrumentProps::set_Name(const gig::String& name)
1041    {
1042        m->pInfo->Name = name;
1043    }
1044    
1045    void InstrumentProps::update_name()
1046    {
1047        update_model++;
1048        eName.set_value(m->pInfo->Name);
1049        update_model--;
1050    }
1051    
1052  void InstrumentProps::set_IsDrum(bool value)  void InstrumentProps::set_IsDrum(bool value)
1053  {  {
1054      m->IsDrum = value;      m->IsDrum = value;
# Line 1045  InstrumentProps::InstrumentProps() : Line 1091  InstrumentProps::InstrumentProps() :
1091            "\"keyswitching\" dimension")            "\"keyswitching\" dimension")
1092      );      );
1093    
1094        connect(eName, &InstrumentProps::set_Name);
1095      connect(eIsDrum, &InstrumentProps::set_IsDrum);      connect(eIsDrum, &InstrumentProps::set_IsDrum);
1096      connect(eMIDIBank, &InstrumentProps::set_MIDIBank);      connect(eMIDIBank, &InstrumentProps::set_MIDIBank);
1097      connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram);      connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram);
# Line 1057  InstrumentProps::InstrumentProps() : Line 1104  InstrumentProps::InstrumentProps() :
1104      connect(eDimensionKeyRangeLow, eDimensionKeyRangeHigh,      connect(eDimensionKeyRangeLow, eDimensionKeyRangeHigh,
1105              &gig::Instrument::DimensionKeyRange);              &gig::Instrument::DimensionKeyRange);
1106    
1107        eName.signal_value_changed().connect(sig_name_changed.make_slot());
1108    
1109      table.set_col_spacings(5);      table.set_col_spacings(5);
1110    
1111      table.add(eName);      table.add(eName);
# Line 1097  void InstrumentProps::set_instrument(gig Line 1146  void InstrumentProps::set_instrument(gig
1146      update(instrument);      update(instrument);
1147    
1148      update_model++;      update_model++;
1149        eName.set_value(instrument->pInfo->Name);
1150      eIsDrum.set_value(instrument->IsDrum);      eIsDrum.set_value(instrument->IsDrum);
1151      eMIDIBank.set_value(instrument->MIDIBank);      eMIDIBank.set_value(instrument->MIDIBank);
1152      eMIDIProgram.set_value(instrument->MIDIProgram);      eMIDIProgram.set_value(instrument->MIDIProgram);
# Line 1127  void MainWindow::load_gig(gig::File* gig Line 1177  void MainWindow::load_gig(gig::File* gig
1177      instrument_name_connection.block();      instrument_name_connection.block();
1178      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;      for (gig::Instrument* instrument = gig->GetFirstInstrument() ; instrument ;
1179           instrument = gig->GetNextInstrument()) {           instrument = gig->GetNextInstrument()) {
1180          Glib::ustring name(instrument->pInfo->Name);          Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
1181    
1182          Gtk::TreeModel::iterator iter = m_refTreeModel->append();          Gtk::TreeModel::iterator iter = m_refTreeModel->append();
1183          Gtk::TreeModel::Row row = *iter;          Gtk::TreeModel::Row row = *iter;
# Line 1143  void MainWindow::load_gig(gig::File* gig Line 1193  void MainWindow::load_gig(gig::File* gig
1193          if (group->Name != "") {          if (group->Name != "") {
1194              Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append();              Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append();
1195              Gtk::TreeModel::Row rowGroup = *iterGroup;              Gtk::TreeModel::Row rowGroup = *iterGroup;
1196              rowGroup[m_SamplesModel.m_col_name]   = group->Name.c_str();              rowGroup[m_SamplesModel.m_col_name]   = gig_to_utf8(group->Name);
1197              rowGroup[m_SamplesModel.m_col_group]  = group;              rowGroup[m_SamplesModel.m_col_group]  = group;
1198              rowGroup[m_SamplesModel.m_col_sample] = NULL;              rowGroup[m_SamplesModel.m_col_sample] = NULL;
1199              for (gig::Sample* sample = group->GetFirstSample();              for (gig::Sample* sample = group->GetFirstSample();
# Line 1151  void MainWindow::load_gig(gig::File* gig Line 1201  void MainWindow::load_gig(gig::File* gig
1201                  Gtk::TreeModel::iterator iterSample =                  Gtk::TreeModel::iterator iterSample =
1202                      m_refSamplesTreeModel->append(rowGroup.children());                      m_refSamplesTreeModel->append(rowGroup.children());
1203                  Gtk::TreeModel::Row rowSample = *iterSample;                  Gtk::TreeModel::Row rowSample = *iterSample;
1204                  rowSample[m_SamplesModel.m_col_name]   = sample->pInfo->Name.c_str();                  rowSample[m_SamplesModel.m_col_name] =
1205                        gig_to_utf8(sample->pInfo->Name);
1206                  rowSample[m_SamplesModel.m_col_sample] = sample;                  rowSample[m_SamplesModel.m_col_sample] = sample;
1207                  rowSample[m_SamplesModel.m_col_group]  = NULL;                  rowSample[m_SamplesModel.m_col_group]  = NULL;
1208              }              }
# Line 1163  void MainWindow::load_gig(gig::File* gig Line 1214  void MainWindow::load_gig(gig::File* gig
1214      // select the first instrument      // select the first instrument
1215      m_TreeView.get_selection()->select(Gtk::TreePath("0"));      m_TreeView.get_selection()->select(Gtk::TreePath("0"));
1216    
1217      gig::Instrument* instrument = get_instrument();      instr_props_set_instrument();
1218      if (instrument) {  }
1219    
1220    bool MainWindow::instr_props_set_instrument()
1221    {
1222        instrumentProps.signal_name_changed().clear();
1223    
1224        Gtk::TreeModel::const_iterator it =
1225            m_TreeView.get_selection()->get_selected();
1226        if (it) {
1227            Gtk::TreeModel::Row row = *it;
1228            gig::Instrument* instrument = row[m_Columns.m_col_instr];
1229    
1230          instrumentProps.set_instrument(instrument);          instrumentProps.set_instrument(instrument);
1231    
1232            // make sure instrument tree is updated when user changes the
1233            // instrument name in instrument properties window
1234            instrumentProps.signal_name_changed().connect(
1235                sigc::bind(
1236                    sigc::mem_fun(*this,
1237                                  &MainWindow::instr_name_changed_by_instr_props),
1238                    it));
1239        } else {
1240            instrumentProps.hide();
1241      }      }
1242        return it;
1243  }  }
1244    
1245  void MainWindow::show_instr_props()  void MainWindow::show_instr_props()
1246  {  {
1247      gig::Instrument* instrument = get_instrument();      if (instr_props_set_instrument()) {
     if (instrument)  
     {  
         instrumentProps.set_instrument(instrument);  
1248          instrumentProps.show();          instrumentProps.show();
1249          instrumentProps.deiconify();          instrumentProps.deiconify();
1250      }      }
1251  }  }
1252    
1253    void MainWindow::instr_name_changed_by_instr_props(Gtk::TreeModel::iterator& it)
1254    {
1255        Gtk::TreeModel::Row row = *it;
1256        Glib::ustring name = row[m_Columns.m_col_name];
1257    
1258        gig::Instrument* instrument = row[m_Columns.m_col_instr];
1259        Glib::ustring gigname(gig_to_utf8(instrument->pInfo->Name));
1260        if (gigname != name) {
1261            row[m_Columns.m_col_name] = gigname;
1262        }
1263    }
1264    
1265  void MainWindow::on_action_view_status_bar() {  void MainWindow::on_action_view_status_bar() {
1266      Gtk::CheckMenuItem* item =      Gtk::CheckMenuItem* item =
1267          dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar"));          dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar"));
# Line 1191  void MainWindow::on_action_view_status_b Line 1273  void MainWindow::on_action_view_status_b
1273      else                    m_StatusBar.hide();      else                    m_StatusBar.hide();
1274  }  }
1275    
1276    bool MainWindow::is_copy_samples_unity_note_enabled() const {
1277        Gtk::CheckMenuItem* item =
1278            dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleUnity"));
1279        if (!item) {
1280            std::cerr << "/MenuBar/MenuEdit/CopySampleUnity == NULL\n";
1281            return true;
1282        }
1283        return item->get_active();
1284    }
1285    
1286    bool MainWindow::is_copy_samples_fine_tune_enabled() const {
1287        Gtk::CheckMenuItem* item =
1288            dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleTune"));
1289        if (!item) {
1290            std::cerr << "/MenuBar/MenuEdit/CopySampleTune == NULL\n";
1291            return true;
1292        }
1293        return item->get_active();
1294    }
1295    
1296    bool MainWindow::is_copy_samples_loop_enabled() const {
1297        Gtk::CheckMenuItem* item =
1298            dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop"));
1299        if (!item) {
1300            std::cerr << "/MenuBar/MenuEdit/CopySampleLoop == NULL\n";
1301            return true;
1302        }
1303        return item->get_active();
1304    }
1305    
1306  void MainWindow::on_button_release(GdkEventButton* button)  void MainWindow::on_button_release(GdkEventButton* button)
1307  {  {
1308      if (button->type == GDK_2BUTTON_PRESS) {      if (button->type == GDK_2BUTTON_PRESS) {
# Line 1276  void MainWindow::remove_instrument_from_ Line 1388  void MainWindow::remove_instrument_from_
1388  }  }
1389    
1390  void MainWindow::add_instrument(gig::Instrument* instrument) {  void MainWindow::add_instrument(gig::Instrument* instrument) {
1391      const char* name = instrument->pInfo->Name.c_str();      const Glib::ustring name(gig_to_utf8(instrument->pInfo->Name));
1392    
1393      // update instrument tree view      // update instrument tree view
1394      instrument_name_connection.block();      instrument_name_connection.block();
# Line 1298  void MainWindow::on_action_add_instrumen Line 1410  void MainWindow::on_action_add_instrumen
1410      if (!file) return;      if (!file) return;
1411      gig::Instrument* instrument = file->AddInstrument();      gig::Instrument* instrument = file->AddInstrument();
1412      __instrument_indexer++;      __instrument_indexer++;
1413      instrument->pInfo->Name =      instrument->pInfo->Name = gig_from_utf8(_("Unnamed Instrument ") +
1414          _("Unnamed Instrument ") + ToString(__instrument_indexer);                                              ToString(__instrument_indexer));
1415    
1416      add_instrument(instrument);      add_instrument(instrument);
1417  }  }
# Line 1319  void MainWindow::on_action_duplicate_ins Line 1431  void MainWindow::on_action_duplicate_ins
1431      // duplicate the orginal instrument      // duplicate the orginal instrument
1432      gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig);      gig::Instrument* instrNew = file->AddDuplicateInstrument(instrOrig);
1433      instrNew->pInfo->Name =      instrNew->pInfo->Name =
1434          instrOrig->pInfo->Name + " (" + _("Copy") + ")";          instrOrig->pInfo->Name +
1435            gig_from_utf8(Glib::ustring(" (") + _("Copy") + ")");
1436    
1437      add_instrument(instrNew);      add_instrument(instrNew);
1438  }  }
# Line 1366  void MainWindow::on_action_remove_instru Line 1479  void MainWindow::on_action_remove_instru
1479                      Gtk::TreePath(ToString(index)));                      Gtk::TreePath(ToString(index)));
1480              }              }
1481  #endif  #endif
1482              instr = get_instrument();              instr_props_set_instrument();
             if (instr) {  
                 instrumentProps.set_instrument(instr);  
             } else {  
                 instrumentProps.hide();  
             }  
1483          } catch (RIFF::Exception e) {          } catch (RIFF::Exception e) {
1484              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1485              msg.run();              msg.run();
# Line 1391  void MainWindow::on_action_add_group() { Line 1499  void MainWindow::on_action_add_group() {
1499      static int __sample_indexer = 0;      static int __sample_indexer = 0;
1500      if (!file) return;      if (!file) return;
1501      gig::Group* group = file->AddGroup();      gig::Group* group = file->AddGroup();
1502      group->Name = _("Unnamed Group");      group->Name = gig_from_utf8(_("Unnamed Group"));
1503      if (__sample_indexer) group->Name += " " + ToString(__sample_indexer);      if (__sample_indexer) group->Name += " " + ToString(__sample_indexer);
1504      __sample_indexer++;      __sample_indexer++;
1505      // update sample tree view      // update sample tree view
1506      Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append();      Gtk::TreeModel::iterator iterGroup = m_refSamplesTreeModel->append();
1507      Gtk::TreeModel::Row rowGroup = *iterGroup;      Gtk::TreeModel::Row rowGroup = *iterGroup;
1508      rowGroup[m_SamplesModel.m_col_name] = group->Name.c_str();      rowGroup[m_SamplesModel.m_col_name] = gig_to_utf8(group->Name);
1509      rowGroup[m_SamplesModel.m_col_sample] = NULL;      rowGroup[m_SamplesModel.m_col_sample] = NULL;
1510      rowGroup[m_SamplesModel.m_col_group] = group;      rowGroup[m_SamplesModel.m_col_group] = group;
1511      file_changed();      file_changed();
# Line 1506  void MainWindow::on_action_add_sample() Line 1614  void MainWindow::on_action_add_sample()
1614                          break;                          break;
1615                      }                      }
1616                  }                  }
1617                  sample->pInfo->Name = filename;                  sample->pInfo->Name = gig_from_utf8(filename);
1618                  sample->Channels = info.channels;                  sample->Channels = info.channels;
1619                  sample->BitDepth = bitdepth;                  sample->BitDepth = bitdepth;
1620                  sample->FrameSize = bitdepth / 8/*1 byte are 8 bits*/ * info.channels;                  sample->FrameSize = bitdepth / 8/*1 byte are 8 bits*/ * info.channels;
# Line 1520  void MainWindow::on_action_add_sample() Line 1628  void MainWindow::on_action_add_sample()
1628                                 &instrument, sizeof(instrument)) != SF_FALSE)                                 &instrument, sizeof(instrument)) != SF_FALSE)
1629                  {                  {
1630                      sample->MIDIUnityNote = instrument.basenote;                      sample->MIDIUnityNote = instrument.basenote;
1631                        sample->FineTune      = instrument.detune;
1632    
1633                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {
1634                          sample->Loops = 1;                          sample->Loops = 1;
# Line 1557  void MainWindow::on_action_add_sample() Line 1666  void MainWindow::on_action_add_sample()
1666                  Gtk::TreeModel::iterator iterSample =                  Gtk::TreeModel::iterator iterSample =
1667                      m_refSamplesTreeModel->append(row.children());                      m_refSamplesTreeModel->append(row.children());
1668                  Gtk::TreeModel::Row rowSample = *iterSample;                  Gtk::TreeModel::Row rowSample = *iterSample;
1669                  rowSample[m_SamplesModel.m_col_name]   = filename;                  rowSample[m_SamplesModel.m_col_name] =
1670                        gig_to_utf8(sample->pInfo->Name);
1671                  rowSample[m_SamplesModel.m_col_sample] = sample;                  rowSample[m_SamplesModel.m_col_sample] = sample;
1672                  rowSample[m_SamplesModel.m_col_group]  = NULL;                  rowSample[m_SamplesModel.m_col_group]  = NULL;
1673                  // close sound file                  // close sound file
# Line 1628  void MainWindow::on_action_replace_all_s Line 1738  void MainWindow::on_action_replace_all_s
1738               sample; sample = file->GetNextSample())               sample; sample = file->GetNextSample())
1739          {          {
1740              std::string filename =              std::string filename =
1741                  folder + G_DIR_SEPARATOR_S + sample->pInfo->Name +                  folder + G_DIR_SEPARATOR_S +
1742                  postfixEntryBox.get_text().raw();                  Glib::filename_from_utf8(gig_to_utf8(sample->pInfo->Name) +
1743                                             postfixEntryBox.get_text());
1744              SF_INFO info;              SF_INFO info;
1745              info.format = 0;              info.format = 0;
1746              SNDFILE* hFile = sf_open(filename.c_str(), SFM_READ, &info);              SNDFILE* hFile = sf_open(filename.c_str(), SFM_READ, &info);
# Line 1663  void MainWindow::on_action_replace_all_s Line 1774  void MainWindow::on_action_replace_all_s
1774              catch (std::string what)              catch (std::string what)
1775              {              {
1776                  if (!error_files.empty()) error_files += "\n";                  if (!error_files.empty()) error_files += "\n";
1777                      error_files += filename += " (" + what + ")";                  error_files += Glib::filename_to_utf8(filename) +
1778                        " (" + what + ")";
1779              }              }
1780          }          }
1781          // 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 1688  void MainWindow::on_action_remove_sample Line 1800  void MainWindow::on_action_remove_sample
1800          try {          try {
1801              // remove group or sample from the gig file              // remove group or sample from the gig file
1802              if (group) {              if (group) {
1803                  // temporarily remember the samples that bolong to                  // temporarily remember the samples that belong to
1804                  // that group (we need that to clean the queue)                  // that group (we need that to clean the queue)
1805                  std::list<gig::Sample*> members;                  std::list<gig::Sample*> members;
1806                  for (gig::Sample* pSample = group->GetFirstSample();                  for (gig::Sample* pSample = group->GetFirstSample();
# Line 1814  void MainWindow::on_sample_label_drop_dr Line 1926  void MainWindow::on_sample_label_drop_dr
1926              channels_changed = true;              channels_changed = true;
1927              region_changed();              region_changed();
1928          }          }
1929          dimreg_edit.set_sample(sample);          dimreg_edit.set_sample(
1930                sample,
1931                is_copy_samples_unity_note_enabled(),
1932                is_copy_samples_fine_tune_enabled(),
1933                is_copy_samples_loop_enabled()
1934            );
1935    
1936          if (sample->Channels == 2 && !stereo_dimension) {          if (sample->Channels == 2 && !stereo_dimension) {
1937              // add samplechannel dimension              // add samplechannel dimension
# Line 1857  void MainWindow::sample_name_changed(con Line 1974  void MainWindow::sample_name_changed(con
1974      Glib::ustring name  = row[m_SamplesModel.m_col_name];      Glib::ustring name  = row[m_SamplesModel.m_col_name];
1975      gig::Group* group   = row[m_SamplesModel.m_col_group];      gig::Group* group   = row[m_SamplesModel.m_col_group];
1976      gig::Sample* sample = row[m_SamplesModel.m_col_sample];      gig::Sample* sample = row[m_SamplesModel.m_col_sample];
1977        gig::String gigname(gig_from_utf8(name));
1978      if (group) {      if (group) {
1979          if (group->Name != name) {          if (group->Name != gigname) {
1980              group->Name = name;              group->Name = gigname;
1981              printf("group name changed\n");              printf("group name changed\n");
1982              file_changed();              file_changed();
1983          }          }
1984      } else if (sample) {      } else if (sample) {
1985          if (sample->pInfo->Name != name.raw()) {          if (sample->pInfo->Name != gigname) {
1986              sample->pInfo->Name = name.raw();              sample->pInfo->Name = gigname;
1987              printf("sample name changed\n");              printf("sample name changed\n");
1988              file_changed();              file_changed();
1989          }          }
# Line 1893  void MainWindow::instrument_name_changed Line 2011  void MainWindow::instrument_name_changed
2011    
2012      // change name in gig      // change name in gig
2013      gig::Instrument* instrument = row[m_Columns.m_col_instr];      gig::Instrument* instrument = row[m_Columns.m_col_instr];
2014      if (instrument && instrument->pInfo->Name != name.raw()) {      gig::String gigname(gig_from_utf8(name));
2015          instrument->pInfo->Name = name.raw();      if (instrument && instrument->pInfo->Name != gigname) {
2016            instrument->pInfo->Name = gigname;
2017    
2018            // change name in the instrument properties window
2019            if (instrumentProps.get_instrument() == instrument) {
2020                instrumentProps.update_name();
2021            }
2022    
2023          file_changed();          file_changed();
2024      }      }
2025  }  }

Legend:
Removed from v.2442  
changed lines
  Added in v.2476

  ViewVC Help
Powered by ViewVC