/[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 3643 by schoenebeck, Sat Dec 7 15:04:51 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 3764  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 3838  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.3643  
changed lines
  Added in v.3711

  ViewVC Help
Powered by ViewVC