/[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 1830 by persson, Sat Dec 6 13:49:26 2008 UTC revision 1831 by persson, Tue Feb 3 19:38:19 2009 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006 - 2008 Andreas Persson   * Copyright (C) 2006-2009 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 130  MainWindow::MainWindow() : Line 130  MainWindow::MainWindow() :
130      m_HPaned.add2(dimreg_vbox);      m_HPaned.add2(dimreg_vbox);
131    
132    
133      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, "Samples");      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples"));
134      m_TreeViewNotebook.append_page(m_ScrolledWindow, "Instruments");      m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments"));
135    
136    
137      actionGroup = Gtk::ActionGroup::create();      actionGroup = Gtk::ActionGroup::create();
# Line 571  void MainWindow::on_action_file_new() Line 571  void MainWindow::on_action_file_new()
571      gig::File* pFile = new gig::File;      gig::File* pFile = new gig::File;
572      // already add one new instrument by default      // already add one new instrument by default
573      gig::Instrument* pInstrument = pFile->AddInstrument();      gig::Instrument* pInstrument = pFile->AddInstrument();
574      pInstrument->pInfo->Name = "Unnamed Instrument";      pInstrument->pInfo->Name = _("Unnamed Instrument");
575      // update GUI with that new gig::File      // update GUI with that new gig::File
576      load_gig(pFile, 0 /*no file name yet*/);      load_gig(pFile, 0 /*no file name yet*/);
577  }  }
# Line 641  void MainWindow::on_action_file_open() Line 641  void MainWindow::on_action_file_open()
641  void MainWindow::load_file(const char* name)  void MainWindow::load_file(const char* name)
642  {  {
643      __clear();      __clear();
644      load_dialog = new LoadDialog("Loading...", *this);      load_dialog = new LoadDialog(_("Loading..."), *this);
645      load_dialog->show_all();      load_dialog->show_all();
646      loader = new Loader(strdup(name));      loader = new Loader(strdup(name));
647      loader->signal_progress().connect(      loader->signal_progress().connect(
# Line 760  bool MainWindow::file_save_as() Line 760  bool MainWindow::file_save_as()
760      {      {
761          std::string basename = Glib::path_get_basename(filename);          std::string basename = Glib::path_get_basename(filename);
762          std::string dir = Glib::path_get_dirname(filename);          std::string dir = Glib::path_get_dirname(filename);
763          basename = std::string("copy_of_") + basename;          basename = std::string(_("copy_of_")) + basename;
764          Glib::ustring copyFileName = Glib::build_filename(dir, basename);          Glib::ustring copyFileName = Glib::build_filename(dir, basename);
765          if (Glib::path_is_absolute(filename)) {          if (Glib::path_is_absolute(filename)) {
766              dialog.set_filename(copyFileName);              dialog.set_filename(copyFileName);
# Line 828  void MainWindow::__import_queued_samples Line 828  void MainWindow::__import_queued_samples
828          info.format = 0;          info.format = 0;
829          SNDFILE* hFile = sf_open((*iter).sample_path.c_str(), SFM_READ, &info);          SNDFILE* hFile = sf_open((*iter).sample_path.c_str(), SFM_READ, &info);
830          try {          try {
831              if (!hFile) throw std::string("could not open file");              if (!hFile) throw std::string(_("could not open file"));
832              // determine sample's bit depth              // determine sample's bit depth
833              int bitdepth;              int bitdepth;
834              switch (info.format & 0xff) {              switch (info.format & 0xff) {
# Line 845  void MainWindow::__import_queued_samples Line 845  void MainWindow::__import_queued_samples
845                      break;                      break;
846                  default:                  default:
847                      sf_close(hFile); // close sound file                      sf_close(hFile); // close sound file
848                      throw std::string("format not supported"); // unsupported subformat (yet?)                      throw std::string(_("format not supported")); // unsupported subformat (yet?)
849              }              }
850    
851              const int bufsize = 10000;              const int bufsize = 10000;
# Line 918  void MainWindow::on_action_help_about() Line 918  void MainWindow::on_action_help_about()
918  #ifdef ABOUT_DIALOG  #ifdef ABOUT_DIALOG
919      Gtk::AboutDialog dialog;      Gtk::AboutDialog dialog;
920      dialog.set_version(VERSION);      dialog.set_version(VERSION);
921      dialog.set_copyright("Copyright (C) 2006,2007 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2009 Andreas Persson");
922      dialog.set_comments(      dialog.set_comments(_(
923          "Released under the GNU General Public License.\n"          "Released under the GNU General Public License.\n"
924          "\n"          "\n"
925          "Please notice that this is still a very young instrument editor. "          "Please notice that this is still a very young instrument editor. "
926          "So better backup your Gigasampler files before editing them with "          "So better backup your Gigasampler files before editing them with "
927          "this application.\n"          "this application.\n"
928          "\n"          "\n"
929          "Please report bugs to: http://bugs.linuxsampler.org"          "Please report bugs to: http://bugs.linuxsampler.org")
930      );      );
931      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
932      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
# Line 936  void MainWindow::on_action_help_about() Line 936  void MainWindow::on_action_help_about()
936    
937  PropDialog::PropDialog()  PropDialog::PropDialog()
938      : table(2,1),      : table(2,1),
939        eName("Name"),        eName(_("Name")),
940        eCreationDate("Creation date"),        eCreationDate(_("Creation date")),
941        eComments("Comments"),        eComments(_("Comments")),
942        eProduct("Product"),        eProduct(_("Product")),
943        eCopyright("Copyright"),        eCopyright(_("Copyright")),
944        eArtists("Artists"),        eArtists(_("Artists")),
945        eGenre("Genre"),        eGenre(_("Genre")),
946        eKeywords("Keywords"),        eKeywords(_("Keywords")),
947        eEngineer("Engineer"),        eEngineer(_("Engineer")),
948        eTechnician("Technician"),        eTechnician(_("Technician")),
949        eSoftware("Software"),        eSoftware(_("Software")),
950        eMedium("Medium"),        eMedium(_("Medium")),
951        eSource("Source"),        eSource(_("Source")),
952        eSourceForm("Source form"),        eSourceForm(_("Source form")),
953        eCommissioned("Commissioned"),        eCommissioned(_("Commissioned")),
954        eSubject("Subject"),        eSubject(_("Subject")),
955        quitButton(Gtk::Stock::CLOSE),        quitButton(Gtk::Stock::CLOSE),
956        update_model(0)        update_model(0)
957  {  {
958      set_title("File Properties");      set_title(_("File Properties"));
959      eName.set_width_chars(50);      eName.set_width_chars(50);
960    
961      connect(eName, &DLS::Info::Name);      connect(eName, &DLS::Info::Name);
# Line 1073  void InstrumentProps::set_DimensionKeyRa Line 1073  void InstrumentProps::set_DimensionKeyRa
1073  InstrumentProps::InstrumentProps()  InstrumentProps::InstrumentProps()
1074      : table(2,1),      : table(2,1),
1075        quitButton(Gtk::Stock::CLOSE),        quitButton(Gtk::Stock::CLOSE),
1076        eName("Name"),        eName(_("Name")),
1077        eIsDrum("Is drum"),        eIsDrum(_("Is drum")),
1078        eMIDIBank("MIDI bank", 0, 16383),        eMIDIBank(_("MIDI bank"), 0, 16383),
1079        eMIDIProgram("MIDI program"),        eMIDIProgram(_("MIDI program")),
1080        eAttenuation("Attenuation", 0, 96, 0, 1),        eAttenuation(_("Attenuation"), 0, 96, 0, 1),
1081        eGainPlus6("Gain +6dB", eAttenuation, -6),        eGainPlus6(_("Gain +6dB"), eAttenuation, -6),
1082        eEffectSend("Effect send", 0, 65535),        eEffectSend(_("Effect send"), 0, 65535),
1083        eFineTune("Fine tune", -8400, 8400),        eFineTune(_("Fine tune"), -8400, 8400),
1084        ePitchbendRange("Pitchbend range", 0, 12),        ePitchbendRange(_("Pitchbend range"), 0, 12),
1085        ePianoReleaseMode("Piano release mode"),        ePianoReleaseMode(_("Piano release mode")),
1086        eDimensionKeyRangeLow("Keyswitching range low"),        eDimensionKeyRangeLow(_("Keyswitching range low")),
1087        eDimensionKeyRangeHigh("Keyswitching range high"),        eDimensionKeyRangeHigh(_("Keyswitching range high")),
1088        update_model(0)        update_model(0)
1089  {  {
1090      set_title("Instrument Properties");      set_title(_("Instrument Properties"));
1091    
1092      eDimensionKeyRangeLow.set_tip(      eDimensionKeyRangeLow.set_tip(
1093          _("start of the keyboard area which should switch the "          _("start of the keyboard area which should switch the "
# Line 1312  void MainWindow::on_action_add_instrumen Line 1312  void MainWindow::on_action_add_instrumen
1312      gig::Instrument* instrument = file->AddInstrument();      gig::Instrument* instrument = file->AddInstrument();
1313      __instrument_indexer++;      __instrument_indexer++;
1314      instrument->pInfo->Name =      instrument->pInfo->Name =
1315          "Unnamed Instrument " + ToString(__instrument_indexer);          _("Unnamed Instrument ") + ToString(__instrument_indexer);
1316      // update instrument tree view      // update instrument tree view
1317      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();      Gtk::TreeModel::iterator iterInstr = m_refTreeModel->append();
1318      Gtk::TreeModel::Row rowInstr = *iterInstr;      Gtk::TreeModel::Row rowInstr = *iterInstr;
# Line 1355  void MainWindow::on_action_remove_instru Line 1355  void MainWindow::on_action_remove_instru
1355  void MainWindow::on_action_sample_properties() {  void MainWindow::on_action_sample_properties() {
1356      //TODO: show a dialog where the selected sample's properties can be edited      //TODO: show a dialog where the selected sample's properties can be edited
1357      Gtk::MessageDialog msg(      Gtk::MessageDialog msg(
1358          *this, "Sorry, yet to be implemented!", false, Gtk::MESSAGE_INFO          *this, _("Sorry, yet to be implemented!"), false, Gtk::MESSAGE_INFO
1359      );      );
1360      msg.run();      msg.run();
1361  }  }
# Line 1364  void MainWindow::on_action_add_group() { Line 1364  void MainWindow::on_action_add_group() {
1364      static int __sample_indexer = 0;      static int __sample_indexer = 0;
1365      if (!file) return;      if (!file) return;
1366      gig::Group* group = file->AddGroup();      gig::Group* group = file->AddGroup();
1367      group->Name = "Unnamed Group";      group->Name = _("Unnamed Group");
1368      if (__sample_indexer) group->Name += " " + ToString(__sample_indexer);      if (__sample_indexer) group->Name += " " + ToString(__sample_indexer);
1369      __sample_indexer++;      __sample_indexer++;
1370      // update sample tree view      // update sample tree view
# Line 1408  void MainWindow::on_action_add_sample() Line 1408  void MainWindow::on_action_add_sample()
1408      };      };
1409      for (int i = 0; supportedFileTypes[i]; i++)      for (int i = 0; supportedFileTypes[i]; i++)
1410          soundfilter.add_pattern(supportedFileTypes[i]);          soundfilter.add_pattern(supportedFileTypes[i]);
1411      soundfilter.set_name("Sound Files");      soundfilter.set_name(_("Sound Files"));
1412      Gtk::FileFilter allpassfilter; // matches every file      Gtk::FileFilter allpassfilter; // matches every file
1413      allpassfilter.add_pattern("*.*");      allpassfilter.add_pattern("*.*");
1414      allpassfilter.set_name("All Files");      allpassfilter.set_name(_("All Files"));
1415      dialog.add_filter(soundfilter);      dialog.add_filter(soundfilter);
1416      dialog.add_filter(allpassfilter);      dialog.add_filter(allpassfilter);
1417      if (current_sample_dir != "") {      if (current_sample_dir != "") {
# Line 1429  void MainWindow::on_action_add_sample() Line 1429  void MainWindow::on_action_add_sample()
1429              info.format = 0;              info.format = 0;
1430              SNDFILE* hFile = sf_open((*iter).c_str(), SFM_READ, &info);              SNDFILE* hFile = sf_open((*iter).c_str(), SFM_READ, &info);
1431              try {              try {
1432                  if (!hFile) throw std::string("could not open file");                  if (!hFile) throw std::string(_("could not open file"));
1433                  int bitdepth;                  int bitdepth;
1434                  switch (info.format & 0xff) {                  switch (info.format & 0xff) {
1435                      case SF_FORMAT_PCM_S8:                      case SF_FORMAT_PCM_S8:
# Line 1445  void MainWindow::on_action_add_sample() Line 1445  void MainWindow::on_action_add_sample()
1445                          break;                          break;
1446                      default:                      default:
1447                          sf_close(hFile); // close sound file                          sf_close(hFile); // close sound file
1448                          throw std::string("format not supported"); // unsupported subformat (yet?)                          throw std::string(_("format not supported")); // unsupported subformat (yet?)
1449                  }                  }
1450                  // add a new sample to the .gig file                  // add a new sample to the .gig file
1451                  gig::Sample* sample = file->AddSample();                  gig::Sample* sample = file->AddSample();
# Line 1584  void MainWindow::on_action_replace_all_s Line 1584  void MainWindow::on_action_replace_all_s
1584              SNDFILE* hFile = sf_open(filename.c_str(), SFM_READ, &info);              SNDFILE* hFile = sf_open(filename.c_str(), SFM_READ, &info);
1585              try              try
1586              {              {
1587                  if (!hFile) throw std::string("could not open file");                  if (!hFile) throw std::string(_("could not open file"));
1588                  int bitdepth;                  int bitdepth;
1589                  switch (info.format & 0xff) {                  switch (info.format & 0xff) {
1590                      case SF_FORMAT_PCM_S8:                      case SF_FORMAT_PCM_S8:
# Line 1600  void MainWindow::on_action_replace_all_s Line 1600  void MainWindow::on_action_replace_all_s
1600                          break;                          break;
1601                      default:                      default:
1602                          sf_close(hFile);                          sf_close(hFile);
1603                          throw std::string("format not supported");                          throw std::string(_("format not supported"));
1604                  }                  }
1605                  SampleImportItem sched_item;                  SampleImportItem sched_item;
1606                  sched_item.gig_sample  = sample;                  sched_item.gig_sample  = sample;

Legend:
Removed from v.1830  
changed lines
  Added in v.1831

  ViewVC Help
Powered by ViewVC