--- gigedit/trunk/src/gigedit/mainwindow.cpp 2020/01/10 13:32:34 3710 +++ gigedit/trunk/src/gigedit/mainwindow.cpp 2020/01/10 14:22:25 3711 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2019 Andreas Persson + * Copyright (C) 2006-2020 Andreas Persson * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -451,6 +451,12 @@ m_actionGroup->add_action_bool("Statusbar", sigc::mem_fun(*this, &MainWindow::on_action_view_status_bar), true); m_actionToggleRestoreWinDim = m_actionGroup->add_action_bool("AutoRestoreWinDim", sigc::mem_fun(*this, &MainWindow::on_auto_restore_win_dim), Settings::singleton()->autoRestoreWindowDimension); + m_actionInstrDoubleClickOpensProps = + m_actionGroup->add_action_bool( + "OpenInstrPropsByDoubleClick", + sigc::mem_fun(*this, &MainWindow::on_instr_double_click_opens_props), + Settings::singleton()->instrumentDoubleClickOpensProps + ); m_actionToggleShowTooltips = m_actionGroup->add_action_bool( "ShowTooltips", sigc::mem_fun(*this, &MainWindow::on_action_show_tooltips), Settings::singleton()->showTooltips @@ -478,6 +484,13 @@ *this, &MainWindow::on_auto_restore_win_dim)); toggle_action = + Gtk::ToggleAction::create("OpenInstrPropsByDoubleClick", _("Instrument Properties by Double Click")); + toggle_action->set_active(Settings::singleton()->instrumentDoubleClickOpensProps); + actionGroup->add(toggle_action, + sigc::mem_fun( + *this, &MainWindow::on_instr_double_click_opens_props)); + + toggle_action = Gtk::ToggleAction::create("ShowTooltips", _("Tooltips for Beginners")); toggle_action->set_active(Settings::singleton()->showTooltips); actionGroup->add( @@ -935,6 +948,10 @@ " Auto restore Window Dimensions" " AppMenu.AutoRestoreWinDim" " " + " " + " Instrument Properties by Double Click" + " AppMenu.OpenInstrPropsByDoubleClick" + " " " " "
" " " @@ -1163,6 +1180,7 @@ " " " " " " + " " " " " " " " @@ -1286,6 +1304,11 @@ } { Gtk::MenuItem* item = dynamic_cast( + uiManager->get_widget("/MenuBar/MenuView/OpenInstrPropsByDoubleClick")); + item->set_tooltip_text(_("If checked, double clicking an instrument opens its properties dialog.")); + } + { + Gtk::MenuItem* item = dynamic_cast( uiManager->get_widget("/MenuBar/MenuTools/CombineInstruments")); item->set_tooltip_text(_("Create combi sounds out of individual sounds of this .gig file.")); } @@ -3764,6 +3787,25 @@ #endif } +void MainWindow::on_instr_double_click_opens_props() { +#if USE_GLIB_ACTION + bool active = false; + m_actionInstrDoubleClickOpensProps->get_state(active); + // for some reason toggle state does not change automatically + active = !active; + m_actionInstrDoubleClickOpensProps->change_state(active); + Settings::singleton()->instrumentDoubleClickOpensProps = active; +#else + Gtk::CheckMenuItem* item = + dynamic_cast(uiManager->get_widget("/MenuBar/MenuView/OpenInstrPropsByDoubleClick")); + if (!item) { + std::cerr << "/MenuBar/MenuView/OpenInstrPropsByDoubleClick == NULL\n"; + return; + } + Settings::singleton()->instrumentDoubleClickOpensProps = item->get_active(); +#endif +} + void MainWindow::on_save_with_temporary_file() { #if USE_GLIB_ACTION bool active = false; @@ -3838,7 +3880,8 @@ void MainWindow::on_button_release(GdkEventButton* button) { #endif if (button->type == GDK_2BUTTON_PRESS) { - show_instr_props(); + if (Settings::singleton()->instrumentDoubleClickOpensProps) + show_instr_props(); } else if (button->type == GDK_BUTTON_PRESS && button->button == 3) { // gig v2 files have no midi rules const bool bEnabled = !(file->pVersion && file->pVersion->major == 2);