/[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 2398 by persson, Sun Jan 13 09:14:29 2013 UTC revision 2423 by persson, Sun Feb 24 15:19:39 2013 UTC
# Line 53  template<class T> inline std::string ToS Line 53  template<class T> inline std::string ToS
53      return ss.str();      return ss.str();
54  }  }
55    
 Table::Table(int x, int y) : Gtk::Table(x, y), rowno(0) {  }  
   
 void Table::add(BoolEntry& boolentry)  
 {  
     attach(boolentry.widget, 0, 2, rowno, rowno + 1,  
            Gtk::FILL, Gtk::SHRINK);  
     rowno++;  
 }  
   
 void Table::add(BoolEntryPlus6& boolentry)  
 {  
     attach(boolentry.widget, 0, 2, rowno, rowno + 1,  
            Gtk::FILL, Gtk::SHRINK);  
     rowno++;  
 }  
   
 void Table::add(LabelWidget& prop)  
 {  
     attach(prop.label, 1, 2, rowno, rowno + 1,  
            Gtk::FILL, Gtk::SHRINK);  
     attach(prop.widget, 2, 3, rowno, rowno + 1,  
            Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);  
     rowno++;  
 }  
56    
57  MainWindow::MainWindow() :  MainWindow::MainWindow() :
58      dimreg_label(_("Changes apply to:")),      dimreg_label(_("Changes apply to:")),
# Line 322  MainWindow::MainWindow() : Line 298  MainWindow::MainWindow() :
298          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
299      m_DimRegionChooser.signal_region_changed().connect(      m_DimRegionChooser.signal_region_changed().connect(
300          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
301      instrumentProps.signal_instrument_changed().connect(      instrumentProps.signal_changed().connect(
302          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
303      propDialog.signal_info_changed().connect(      propDialog.signal_changed().connect(
304          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
305    
306      dimreg_edit.signal_dimreg_to_be_changed().connect(      dimreg_edit.signal_dimreg_to_be_changed().connect(
# Line 965  PropDialog::PropDialog() Line 941  PropDialog::PropDialog()
941        eCommissioned(_("Commissioned")),        eCommissioned(_("Commissioned")),
942        eSubject(_("Subject")),        eSubject(_("Subject")),
943        quitButton(Gtk::Stock::CLOSE),        quitButton(Gtk::Stock::CLOSE),
944        table(2, 1),        table(2, 1)
       update_model(0)  
945  {  {
946      set_title(_("File Properties"));      set_title(_("File Properties"));
947      eName.set_width_chars(50);      eName.set_width_chars(50);
# Line 1026  PropDialog::PropDialog() Line 1001  PropDialog::PropDialog()
1001    
1002  void PropDialog::set_info(DLS::Info* info)  void PropDialog::set_info(DLS::Info* info)
1003  {  {
1004      this->info = info;      update(info);
     update_model++;  
     eName.set_value(info->Name);  
     eCreationDate.set_value(info->CreationDate);  
     eComments.set_value(info->Comments);  
     eProduct.set_value(info->Product);  
     eCopyright.set_value(info->Copyright);  
     eArtists.set_value(info->Artists);  
     eGenre.set_value(info->Genre);  
     eKeywords.set_value(info->Keywords);  
     eEngineer.set_value(info->Engineer);  
     eTechnician.set_value(info->Technician);  
     eSoftware.set_value(info->Software);  
     eMedium.set_value(info->Medium);  
     eSource.set_value(info->Source);  
     eSourceForm.set_value(info->SourceForm);  
     eCommissioned.set_value(info->Commissioned);  
     eSubject.set_value(info->Subject);  
     update_model--;  
1005  }  }
1006    
 sigc::signal<void>& PropDialog::signal_info_changed()  
 {  
     return info_changed;  
 }  
1007    
1008  void InstrumentProps::set_IsDrum(bool value)  void InstrumentProps::set_IsDrum(bool value)
1009  {  {
1010      instrument->IsDrum = value;      m->IsDrum = value;
1011  }  }
1012    
1013  void InstrumentProps::set_MIDIBank(uint16_t value)  void InstrumentProps::set_MIDIBank(uint16_t value)
1014  {  {
1015      instrument->MIDIBank = value;      m->MIDIBank = value;
1016  }  }
1017    
1018  void InstrumentProps::set_MIDIProgram(uint32_t value)  void InstrumentProps::set_MIDIProgram(uint32_t value)
1019  {  {
1020      instrument->MIDIProgram = value;      m->MIDIProgram = value;
 }  
   
 void InstrumentProps::set_DimensionKeyRange_low(uint8_t value)  
 {  
     instrument->DimensionKeyRange.low = value;  
     if (value > instrument->DimensionKeyRange.high) {  
         eDimensionKeyRangeHigh.set_value(value);  
     }  
 }  
   
 void InstrumentProps::set_DimensionKeyRange_high(uint8_t value)  
 {  
     instrument->DimensionKeyRange.high = value;  
     if (value < instrument->DimensionKeyRange.low) {  
         eDimensionKeyRangeLow.set_value(value);  
     }  
1021  }  }
1022    
1023  InstrumentProps::InstrumentProps()  InstrumentProps::InstrumentProps() :
1024      : update_model(0),      quitButton(Gtk::Stock::CLOSE),
1025        quitButton(Gtk::Stock::CLOSE),      table(2,1),
1026        table(2,1),      eName(_("Name")),
1027        eName(_("Name")),      eIsDrum(_("Is drum")),
1028        eIsDrum(_("Is drum")),      eMIDIBank(_("MIDI bank"), 0, 16383),
1029        eMIDIBank(_("MIDI bank"), 0, 16383),      eMIDIProgram(_("MIDI program")),
1030        eMIDIProgram(_("MIDI program")),      eAttenuation(_("Attenuation"), 0, 96, 0, 1),
1031        eAttenuation(_("Attenuation"), 0, 96, 0, 1),      eGainPlus6(_("Gain +6dB"), eAttenuation, -6),
1032        eGainPlus6(_("Gain +6dB"), eAttenuation, -6),      eEffectSend(_("Effect send"), 0, 65535),
1033        eEffectSend(_("Effect send"), 0, 65535),      eFineTune(_("Fine tune"), -8400, 8400),
1034        eFineTune(_("Fine tune"), -8400, 8400),      ePitchbendRange(_("Pitchbend range"), 0, 12),
1035        ePitchbendRange(_("Pitchbend range"), 0, 12),      ePianoReleaseMode(_("Piano release mode")),
1036        ePianoReleaseMode(_("Piano release mode")),      eDimensionKeyRangeLow(_("Keyswitching range low")),
1037        eDimensionKeyRangeLow(_("Keyswitching range low")),      eDimensionKeyRangeHigh(_("Keyswitching range high"))
       eDimensionKeyRangeHigh(_("Keyswitching range high"))  
1038  {  {
1039      set_title(_("Instrument Properties"));      set_title(_("Instrument Properties"));
1040    
# Line 1120  InstrumentProps::InstrumentProps() Line 1056  InstrumentProps::InstrumentProps()
1056      connect(eFineTune, &gig::Instrument::FineTune);      connect(eFineTune, &gig::Instrument::FineTune);
1057      connect(ePitchbendRange, &gig::Instrument::PitchbendRange);      connect(ePitchbendRange, &gig::Instrument::PitchbendRange);
1058      connect(ePianoReleaseMode, &gig::Instrument::PianoReleaseMode);      connect(ePianoReleaseMode, &gig::Instrument::PianoReleaseMode);
1059      connect(eDimensionKeyRangeLow,      connect(eDimensionKeyRangeLow, eDimensionKeyRangeHigh,
1060              &InstrumentProps::set_DimensionKeyRange_low);              &gig::Instrument::DimensionKeyRange);
     connect(eDimensionKeyRangeHigh,  
             &InstrumentProps::set_DimensionKeyRange_high);  
1061    
1062      table.set_col_spacings(5);      table.set_col_spacings(5);
1063    
# Line 1162  InstrumentProps::InstrumentProps() Line 1096  InstrumentProps::InstrumentProps()
1096    
1097  void InstrumentProps::set_instrument(gig::Instrument* instrument)  void InstrumentProps::set_instrument(gig::Instrument* instrument)
1098  {  {
1099      this->instrument = instrument;      update(instrument);
1100    
1101      update_model++;      update_model++;
     eName.set_value(instrument->pInfo->Name);  
1102      eIsDrum.set_value(instrument->IsDrum);      eIsDrum.set_value(instrument->IsDrum);
1103      eMIDIBank.set_value(instrument->MIDIBank);      eMIDIBank.set_value(instrument->MIDIBank);
1104      eMIDIProgram.set_value(instrument->MIDIProgram);      eMIDIProgram.set_value(instrument->MIDIProgram);
     eAttenuation.set_value(instrument->Attenuation);  
     eGainPlus6.set_value(instrument->Attenuation);  
     eEffectSend.set_value(instrument->EffectSend);  
     eFineTune.set_value(instrument->FineTune);  
     ePitchbendRange.set_value(instrument->PitchbendRange);  
     ePianoReleaseMode.set_value(instrument->PianoReleaseMode);  
     eDimensionKeyRangeLow.set_value(instrument->DimensionKeyRange.low);  
     eDimensionKeyRangeHigh.set_value(instrument->DimensionKeyRange.high);  
1105      update_model--;      update_model--;
1106  }  }
1107    
 sigc::signal<void>& InstrumentProps::signal_instrument_changed()  
 {  
     return instrument_changed;  
 }  
1108    
1109  void MainWindow::file_changed()  void MainWindow::file_changed()
1110  {  {
# Line 1255  void MainWindow::load_gig(gig::File* gig Line 1176  void MainWindow::load_gig(gig::File* gig
1176      // select the first instrument      // select the first instrument
1177      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();      Glib::RefPtr<Gtk::TreeSelection> tree_sel_ref = m_TreeView.get_selection();
1178      tree_sel_ref->select(Gtk::TreePath("0"));      tree_sel_ref->select(Gtk::TreePath("0"));
1179    
1180        gig::Instrument* instrument = get_instrument();
1181        if (instrument) {
1182            instrumentProps.set_instrument(instrument);
1183        }
1184  }  }
1185    
1186  void MainWindow::show_instr_props()  void MainWindow::show_instr_props()
# Line 1383  void MainWindow::on_action_remove_instru Line 1309  void MainWindow::on_action_remove_instru
1309              // remove respective row from instruments tree view              // remove respective row from instruments tree view
1310              m_refTreeModel->erase(it);              m_refTreeModel->erase(it);
1311              file_changed();              file_changed();
1312    
1313                instr = get_instrument();
1314                if (instr) {
1315                    instrumentProps.set_instrument(instr);
1316                } else {
1317                    instrumentProps.hide();
1318                }
1319          } catch (RIFF::Exception e) {          } catch (RIFF::Exception e) {
1320              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1321              msg.run();              msg.run();

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

  ViewVC Help
Powered by ViewVC