/[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 2464 by schoenebeck, Thu Sep 5 00:49:13 2013 UTC revision 2536 by schoenebeck, Mon Apr 21 17:49:17 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 89  MainWindow::MainWindow() : Line 89  MainWindow::MainWindow() :
89      dimreg_vbox.pack_start(dimreg_hbox, Gtk::PACK_SHRINK);      dimreg_vbox.pack_start(dimreg_hbox, Gtk::PACK_SHRINK);
90      m_HPaned.add2(dimreg_vbox);      m_HPaned.add2(dimreg_vbox);
91    
92        dimreg_label.set_tooltip_text(_("To automatically apply your changes above globally to the entire instrument, check all 3 check boxes on the right."));
93        dimreg_all_regions.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied to all regions of this instrument as well."));
94        dimreg_all_dimregs.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied as well to all dimension splits of the region selected below."));
95        dimreg_stereo.set_tooltip_text(_("If checked: all changes you perform above will automatically be applied to both audio channel splits (only if a \"stereo\" dimension is defined below)."));
96    
97      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples"));      m_TreeViewNotebook.append_page(m_ScrolledWindowSamples, _("Samples"));
98      m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments"));      m_TreeViewNotebook.append_page(m_ScrolledWindow, _("Instruments"));
# Line 123  MainWindow::MainWindow() : Line 127  MainWindow::MainWindow() :
127                                           Gtk::Stock::PROPERTIES),                                           Gtk::Stock::PROPERTIES),
128                       sigc::mem_fun(                       sigc::mem_fun(
129                           *this, &MainWindow::show_instr_props));                           *this, &MainWindow::show_instr_props));
130        actionGroup->add(Gtk::Action::create("MidiRules",
131                                             _("_Midi Rules")),
132                         sigc::mem_fun(
133                             *this, &MainWindow::show_midi_rules));
134      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),      actionGroup->add(Gtk::Action::create("Quit", Gtk::Stock::QUIT),
135                       sigc::mem_fun(                       sigc::mem_fun(
136                           *this, &MainWindow::on_action_quit));                           *this, &MainWindow::on_action_quit));
# Line 132  MainWindow::MainWindow() : Line 140  MainWindow::MainWindow() :
140      actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));      actionGroup->add(Gtk::Action::create("MenuEdit", _("_Edit")));
141    
142      Glib::RefPtr<Gtk::ToggleAction> toggle_action =      Glib::RefPtr<Gtk::ToggleAction> toggle_action =
143          Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note"), "ffaga");          Gtk::ToggleAction::create("CopySampleUnity", _("Copy Sample's _Unity Note"));
144      toggle_action->set_active(true);      toggle_action->set_active(true);
     //FIXME: doesn't work, why?  
     toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));  
145      actionGroup->add(toggle_action);      actionGroup->add(toggle_action);
146    
147      toggle_action =      toggle_action =
148          Gtk::ToggleAction::create("CopySampleTune", _("Copy Sample's _Fine Tune"));          Gtk::ToggleAction::create("CopySampleTune", _("Copy Sample's _Fine Tune"));
149      toggle_action->set_active(true);      toggle_action->set_active(true);
     //FIXME: doesn't work, why?  
     toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));  
150      actionGroup->add(toggle_action);      actionGroup->add(toggle_action);
151    
152      toggle_action =      toggle_action =
153          Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points"));          Gtk::ToggleAction::create("CopySampleLoop", _("Copy Sample's _Loop Points"));
154      toggle_action->set_active(true);      toggle_action->set_active(true);
     //FIXME: doesn't work, why?  
     toggle_action->set_tooltip(_("Used when dragging a sample to a region's sample reference field."));  
155      actionGroup->add(toggle_action);      actionGroup->add(toggle_action);
156    
157    
# Line 237  MainWindow::MainWindow() : Line 239  MainWindow::MainWindow() :
239          "  </menubar>"          "  </menubar>"
240          "  <popup name='PopupMenu'>"          "  <popup name='PopupMenu'>"
241          "    <menuitem action='InstrProperties'/>"          "    <menuitem action='InstrProperties'/>"
242            "    <menuitem action='MidiRules'/>"
243          "    <menuitem action='AddInstrument'/>"          "    <menuitem action='AddInstrument'/>"
244          "    <menuitem action='DupInstrument'/>"          "    <menuitem action='DupInstrument'/>"
245          "    <separator/>"          "    <separator/>"
# Line 254  MainWindow::MainWindow() : Line 257  MainWindow::MainWindow() :
257      uiManager->add_ui_from_string(ui_info);      uiManager->add_ui_from_string(ui_info);
258    
259      popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu"));      popup_menu = dynamic_cast<Gtk::Menu*>(uiManager->get_widget("/PopupMenu"));
260        
261        // Set tooltips for menu items (for some reason, setting a tooltip on the
262        // respective Gtk::Action objects above will simply be ignored, no matter
263        // if using Gtk::Action::set_tooltip() or passing the tooltip string on
264        // Gtk::Action::create()).
265        {
266            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
267                uiManager->get_widget("/MenuBar/MenuEdit/CopySampleUnity"));
268            item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current unity note setting will be altered by this action."));
269        }
270        {
271            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
272                uiManager->get_widget("/MenuBar/MenuEdit/CopySampleTune"));
273            item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current sample playback tuning will be altered by this action."));
274        }
275        {
276            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
277                uiManager->get_widget("/MenuBar/MenuEdit/CopySampleLoop"));
278            item->set_tooltip_text(_("Used when dragging a sample to a region's sample reference field. You may disable this for example if you want to replace an existing sample in a region with a new sample, but don't want that the region's current loop informations to be altered by this action."));
279        }
280    
281      instrument_menu = static_cast<Gtk::MenuItem*>(      instrument_menu = static_cast<Gtk::MenuItem*>(
282          uiManager->get_widget("/MenuBar/MenuInstrument"))->get_submenu();          uiManager->get_widget("/MenuBar/MenuInstrument"))->get_submenu();
# Line 282  MainWindow::MainWindow() : Line 305  MainWindow::MainWindow() :
305      // Create the Tree model:      // Create the Tree model:
306      m_refTreeModel = Gtk::ListStore::create(m_Columns);      m_refTreeModel = Gtk::ListStore::create(m_Columns);
307      m_TreeView.set_model(m_refTreeModel);      m_TreeView.set_model(m_refTreeModel);
308        m_TreeView.set_tooltip_text(_("Right click here for actions on instruments & MIDI Rules."));
309      instrument_name_connection = m_refTreeModel->signal_row_changed().connect(      instrument_name_connection = m_refTreeModel->signal_row_changed().connect(
310          sigc::mem_fun(*this, &MainWindow::instrument_name_changed)          sigc::mem_fun(*this, &MainWindow::instrument_name_changed)
311      );      );
# Line 293  MainWindow::MainWindow() : Line 317  MainWindow::MainWindow() :
317      // create samples treeview (including its data model)      // create samples treeview (including its data model)
318      m_refSamplesTreeModel = SamplesTreeStore::create(m_SamplesModel);      m_refSamplesTreeModel = SamplesTreeStore::create(m_SamplesModel);
319      m_TreeViewSamples.set_model(m_refSamplesTreeModel);      m_TreeViewSamples.set_model(m_refSamplesTreeModel);
320        m_TreeViewSamples.set_tooltip_text(_("To actually use a sample, drag it from this list view to \"Sample\" -> \"Sample:\" on the region's settings pane on the right.\n\nRight click here for more actions on samples."));
321      // m_TreeViewSamples.set_reorderable();      // m_TreeViewSamples.set_reorderable();
322      m_TreeViewSamples.append_column_editable("Samples", m_SamplesModel.m_col_name);      m_TreeViewSamples.append_column_editable("Samples", m_SamplesModel.m_col_name);
323      m_TreeViewSamples.set_headers_visible(false);      m_TreeViewSamples.set_headers_visible(false);
# Line 327  MainWindow::MainWindow() : Line 352  MainWindow::MainWindow() :
352          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
353      propDialog.signal_changed().connect(      propDialog.signal_changed().connect(
354          sigc::mem_fun(*this, &MainWindow::file_changed));          sigc::mem_fun(*this, &MainWindow::file_changed));
355        midiRules.signal_changed().connect(
356            sigc::mem_fun(*this, &MainWindow::file_changed));
357    
358      dimreg_edit.signal_dimreg_to_be_changed().connect(      dimreg_edit.signal_dimreg_to_be_changed().connect(
359          dimreg_to_be_changed_signal.make_slot());          dimreg_to_be_changed_signal.make_slot());
# Line 936  void MainWindow::on_action_help_about() Line 963  void MainWindow::on_action_help_about()
963      dialog.set_name("Gigedit");      dialog.set_name("Gigedit");
964  #endif  #endif
965      dialog.set_version(VERSION);      dialog.set_version(VERSION);
966      dialog.set_copyright("Copyright (C) 2006-2013 Andreas Persson");      dialog.set_copyright("Copyright (C) 2006-2014 Andreas Persson");
967      dialog.set_comments(_(      const std::string sComment =
968          "Released under the GNU General Public License.\n"          _("Built " __DATE__ "\nUsing ") +
969          "\n"          ::gig::libraryName() + " " + ::gig::libraryVersion() + "\n\n" +
970          "Please notice that this is still a very young instrument editor. "          _(
971          "So better backup your Gigasampler files before editing them with "              "Gigedit is released under the GNU General Public License.\n"
972          "this application.\n"              "\n"
973          "\n"              "Please notice that this is still a very young instrument editor. "
974          "Please report bugs to: http://bugs.linuxsampler.org")              "So better backup your Gigasampler files before editing them with "
975      );              "this application.\n"
976                "\n"
977                "Please report bugs to: http://bugs.linuxsampler.org"
978            );
979        dialog.set_comments(sComment.c_str());
980      dialog.set_website("http://www.linuxsampler.org");      dialog.set_website("http://www.linuxsampler.org");
981      dialog.set_website_label("http://www.linuxsampler.org");      dialog.set_website_label("http://www.linuxsampler.org");
982      dialog.run();      dialog.run();
# Line 1211  void MainWindow::load_gig(gig::File* gig Line 1242  void MainWindow::load_gig(gig::File* gig
1242      m_TreeView.get_selection()->select(Gtk::TreePath("0"));      m_TreeView.get_selection()->select(Gtk::TreePath("0"));
1243    
1244      instr_props_set_instrument();      instr_props_set_instrument();
1245        gig::Instrument* instrument = get_instrument();
1246        if (instrument) {
1247            midiRules.set_instrument(instrument);
1248        }
1249  }  }
1250    
1251  bool MainWindow::instr_props_set_instrument()  bool MainWindow::instr_props_set_instrument()
# Line 1258  void MainWindow::instr_name_changed_by_i Line 1293  void MainWindow::instr_name_changed_by_i
1293      }      }
1294  }  }
1295    
1296    void MainWindow::show_midi_rules()
1297    {
1298        if (gig::Instrument* instrument = get_instrument())
1299        {
1300            midiRules.set_instrument(instrument);
1301            midiRules.show();
1302            midiRules.deiconify();
1303        }
1304    }
1305    
1306  void MainWindow::on_action_view_status_bar() {  void MainWindow::on_action_view_status_bar() {
1307      Gtk::CheckMenuItem* item =      Gtk::CheckMenuItem* item =
1308          dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar"));          dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/Statusbar"));
# Line 1304  void MainWindow::on_button_release(GdkEv Line 1349  void MainWindow::on_button_release(GdkEv
1349      if (button->type == GDK_2BUTTON_PRESS) {      if (button->type == GDK_2BUTTON_PRESS) {
1350          show_instr_props();          show_instr_props();
1351      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {
1352            // gig v2 files have no midi rules
1353            static_cast<Gtk::MenuItem*>(
1354                uiManager->get_widget("/PopupMenu/MidiRules"))->set_sensitive(
1355                    !(file->pVersion && file->pVersion->major == 2));
1356          popup_menu->popup(button->button, button->time);          popup_menu->popup(button->button, button->time);
1357      }      }
1358  }  }
# Line 1476  void MainWindow::on_action_remove_instru Line 1525  void MainWindow::on_action_remove_instru
1525              }              }
1526  #endif  #endif
1527              instr_props_set_instrument();              instr_props_set_instrument();
1528                instr = get_instrument();
1529                if (instr) {
1530                    midiRules.set_instrument(instr);
1531                } else {
1532                    midiRules.hide();
1533                }
1534          } catch (RIFF::Exception e) {          } catch (RIFF::Exception e) {
1535              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);              Gtk::MessageDialog msg(*this, e.Message.c_str(), false, Gtk::MESSAGE_ERROR);
1536              msg.run();              msg.run();
# Line 1624  void MainWindow::on_action_add_sample() Line 1679  void MainWindow::on_action_add_sample()
1679                                 &instrument, sizeof(instrument)) != SF_FALSE)                                 &instrument, sizeof(instrument)) != SF_FALSE)
1680                  {                  {
1681                      sample->MIDIUnityNote = instrument.basenote;                      sample->MIDIUnityNote = instrument.basenote;
1682                        sample->FineTune      = instrument.detune;
1683    
1684                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {                      if (instrument.loop_count && instrument.loops[0].mode != SF_LOOP_NONE) {
1685                          sample->Loops = 1;                          sample->Loops = 1;

Legend:
Removed from v.2464  
changed lines
  Added in v.2536

  ViewVC Help
Powered by ViewVC