/[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 3637 by schoenebeck, Thu Oct 24 13:12:52 2019 UTC revision 3711 by schoenebeck, Fri Jan 10 14:22:25 2020 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2019 Andreas Persson   * Copyright (C) 2006-2020 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 451  MainWindow::MainWindow() : Line 451  MainWindow::MainWindow() :
451          m_actionGroup->add_action_bool("Statusbar", sigc::mem_fun(*this, &MainWindow::on_action_view_status_bar), true);          m_actionGroup->add_action_bool("Statusbar", sigc::mem_fun(*this, &MainWindow::on_action_view_status_bar), true);
452      m_actionToggleRestoreWinDim =      m_actionToggleRestoreWinDim =
453          m_actionGroup->add_action_bool("AutoRestoreWinDim", sigc::mem_fun(*this, &MainWindow::on_auto_restore_win_dim), Settings::singleton()->autoRestoreWindowDimension);          m_actionGroup->add_action_bool("AutoRestoreWinDim", sigc::mem_fun(*this, &MainWindow::on_auto_restore_win_dim), Settings::singleton()->autoRestoreWindowDimension);
454        m_actionInstrDoubleClickOpensProps =
455            m_actionGroup->add_action_bool(
456                "OpenInstrPropsByDoubleClick",
457                sigc::mem_fun(*this, &MainWindow::on_instr_double_click_opens_props),
458                Settings::singleton()->instrumentDoubleClickOpensProps
459            );
460      m_actionToggleShowTooltips = m_actionGroup->add_action_bool(      m_actionToggleShowTooltips = m_actionGroup->add_action_bool(
461          "ShowTooltips", sigc::mem_fun(*this, &MainWindow::on_action_show_tooltips),          "ShowTooltips", sigc::mem_fun(*this, &MainWindow::on_action_show_tooltips),
462          Settings::singleton()->showTooltips          Settings::singleton()->showTooltips
# Line 478  MainWindow::MainWindow() : Line 484  MainWindow::MainWindow() :
484                           *this, &MainWindow::on_auto_restore_win_dim));                           *this, &MainWindow::on_auto_restore_win_dim));
485    
486      toggle_action =      toggle_action =
487            Gtk::ToggleAction::create("OpenInstrPropsByDoubleClick", _("Instrument Properties by Double Click"));
488        toggle_action->set_active(Settings::singleton()->instrumentDoubleClickOpensProps);
489        actionGroup->add(toggle_action,
490                         sigc::mem_fun(
491                             *this, &MainWindow::on_instr_double_click_opens_props));
492    
493        toggle_action =
494          Gtk::ToggleAction::create("ShowTooltips", _("Tooltips for Beginners"));          Gtk::ToggleAction::create("ShowTooltips", _("Tooltips for Beginners"));
495      toggle_action->set_active(Settings::singleton()->showTooltips);      toggle_action->set_active(Settings::singleton()->showTooltips);
496      actionGroup->add(      actionGroup->add(
# Line 935  MainWindow::MainWindow() : Line 948  MainWindow::MainWindow() :
948          "          <attribute name='label' translatable='yes'>Auto restore Window Dimensions</attribute>"          "          <attribute name='label' translatable='yes'>Auto restore Window Dimensions</attribute>"
949          "          <attribute name='action'>AppMenu.AutoRestoreWinDim</attribute>"          "          <attribute name='action'>AppMenu.AutoRestoreWinDim</attribute>"
950          "        </item>"          "        </item>"
951            "        <item id='OpenInstrPropsByDoubleClick'>"
952            "          <attribute name='label' translatable='yes'>Instrument Properties by Double Click</attribute>"
953            "          <attribute name='action'>AppMenu.OpenInstrPropsByDoubleClick</attribute>"
954            "        </item>"
955          "      </section>"          "      </section>"
956          "      <section>"          "      <section>"
957          "        <item id='RefreshAll'>"          "        <item id='RefreshAll'>"
# Line 1163  MainWindow::MainWindow() : Line 1180  MainWindow::MainWindow() :
1180          "      <menuitem action='Statusbar'/>"          "      <menuitem action='Statusbar'/>"
1181          "      <menuitem action='ShowTooltips'/>"          "      <menuitem action='ShowTooltips'/>"
1182          "      <menuitem action='AutoRestoreWinDim'/>"          "      <menuitem action='AutoRestoreWinDim'/>"
1183            "      <menuitem action='OpenInstrPropsByDoubleClick'/>"
1184          "      <separator/>"          "      <separator/>"
1185          "      <menuitem action='RefreshAll'/>"          "      <menuitem action='RefreshAll'/>"
1186          "    </menu>"          "    </menu>"
# Line 1286  MainWindow::MainWindow() : Line 1304  MainWindow::MainWindow() :
1304      }      }
1305      {      {
1306          Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(          Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
1307                uiManager->get_widget("/MenuBar/MenuView/OpenInstrPropsByDoubleClick"));
1308            item->set_tooltip_text(_("If checked, double clicking an instrument opens its properties dialog."));
1309        }
1310        {
1311            Gtk::MenuItem* item = dynamic_cast<Gtk::MenuItem*>(
1312              uiManager->get_widget("/MenuBar/MenuTools/CombineInstruments"));              uiManager->get_widget("/MenuBar/MenuTools/CombineInstruments"));
1313          item->set_tooltip_text(_("Create combi sounds out of individual sounds of this .gig file."));          item->set_tooltip_text(_("Create combi sounds out of individual sounds of this .gig file."));
1314      }      }
# Line 2851  InstrumentProps::InstrumentProps() : Line 2874  InstrumentProps::InstrumentProps() :
2874      eIsDrum(_("Is drum")),      eIsDrum(_("Is drum")),
2875      eMIDIBank(_("MIDI bank"), 0, 16383),      eMIDIBank(_("MIDI bank"), 0, 16383),
2876      eMIDIProgram(_("MIDI program")),      eMIDIProgram(_("MIDI program")),
2877      eAttenuation(_("Attenuation"), 0, 96, 0, 1),      eAttenuation(_("Attenuation (dB)"), -96, +96, 0, 1),
     eGainPlus6(_("Gain +6dB"), eAttenuation, -6),  
2878      eEffectSend(_("Effect send"), 0, 65535),      eEffectSend(_("Effect send"), 0, 65535),
2879      eFineTune(_("Fine tune"), -8400, 8400),      eFineTune(_("Fine tune"), -8400, 8400),
2880      ePitchbendRange(_("Pitchbend range"), 0, 48),      ePitchbendRange(_("Pitchbend range (halftones)"), 0, 48),
2881      ePianoReleaseMode(_("Piano release mode")),      ePianoReleaseMode(_("Piano release mode")),
2882      eDimensionKeyRangeLow(_("Keyswitching range low")),      eDimensionKeyRangeLow(_("Keyswitching range low")),
2883      eDimensionKeyRangeHigh(_("Keyswitching range high")),      eDimensionKeyRangeHigh(_("Keyswitching range high")),
# Line 2901  InstrumentProps::InstrumentProps() : Line 2923  InstrumentProps::InstrumentProps() :
2923      connect(eMIDIBank, &InstrumentProps::set_MIDIBank);      connect(eMIDIBank, &InstrumentProps::set_MIDIBank);
2924      connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram);      connect(eMIDIProgram, &InstrumentProps::set_MIDIProgram);
2925      connect(eAttenuation, &gig::Instrument::Attenuation);      connect(eAttenuation, &gig::Instrument::Attenuation);
     connect(eGainPlus6, &gig::Instrument::Attenuation);  
2926      connect(eEffectSend, &gig::Instrument::EffectSend);      connect(eEffectSend, &gig::Instrument::EffectSend);
2927      connect(eFineTune, &gig::Instrument::FineTune);      connect(eFineTune, &gig::Instrument::FineTune);
2928      connect(ePitchbendRange, &gig::Instrument::PitchbendRange);      connect(ePitchbendRange, &gig::Instrument::PitchbendRange);
# Line 2969  InstrumentProps::InstrumentProps() : Line 2990  InstrumentProps::InstrumentProps() :
2990      table.add(eMIDIBank);      table.add(eMIDIBank);
2991      table.add(eMIDIProgram);      table.add(eMIDIProgram);
2992      table.add(eAttenuation);      table.add(eAttenuation);
     table.add(eGainPlus6);  
2993      table.add(eEffectSend);      table.add(eEffectSend);
2994      table.add(eFineTune);      table.add(eFineTune);
2995      table.add(ePitchbendRange);      table.add(ePitchbendRange);
# Line 3767  void MainWindow::on_auto_restore_win_dim Line 3787  void MainWindow::on_auto_restore_win_dim
3787  #endif  #endif
3788  }  }
3789    
3790    void MainWindow::on_instr_double_click_opens_props() {
3791    #if USE_GLIB_ACTION
3792        bool active = false;
3793        m_actionInstrDoubleClickOpensProps->get_state(active);
3794        // for some reason toggle state does not change automatically
3795        active = !active;
3796        m_actionInstrDoubleClickOpensProps->change_state(active);
3797        Settings::singleton()->instrumentDoubleClickOpensProps = active;
3798    #else
3799        Gtk::CheckMenuItem* item =
3800            dynamic_cast<Gtk::CheckMenuItem*>(uiManager->get_widget("/MenuBar/MenuView/OpenInstrPropsByDoubleClick"));
3801        if (!item) {
3802            std::cerr << "/MenuBar/MenuView/OpenInstrPropsByDoubleClick == NULL\n";
3803            return;
3804        }
3805        Settings::singleton()->instrumentDoubleClickOpensProps = item->get_active();
3806    #endif
3807    }
3808    
3809  void MainWindow::on_save_with_temporary_file() {  void MainWindow::on_save_with_temporary_file() {
3810  #if USE_GLIB_ACTION  #if USE_GLIB_ACTION
3811      bool active = false;      bool active = false;
# Line 3841  bool MainWindow::on_button_release(Gdk:: Line 3880  bool MainWindow::on_button_release(Gdk::
3880  void MainWindow::on_button_release(GdkEventButton* button) {  void MainWindow::on_button_release(GdkEventButton* button) {
3881  #endif  #endif
3882      if (button->type == GDK_2BUTTON_PRESS) {      if (button->type == GDK_2BUTTON_PRESS) {
3883          show_instr_props();          if (Settings::singleton()->instrumentDoubleClickOpensProps)
3884                show_instr_props();
3885      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {      } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) {
3886          // gig v2 files have no midi rules          // gig v2 files have no midi rules
3887          const bool bEnabled = !(file->pVersion && file->pVersion->major == 2);          const bool bEnabled = !(file->pVersion && file->pVersion->major == 2);

Legend:
Removed from v.3637  
changed lines
  Added in v.3711

  ViewVC Help
Powered by ViewVC