Skip to content

Commit

Permalink
Instrument: Add popup menu for the "select instrument" button to make…
Browse files Browse the repository at this point in the history
… it possible to assign shortcut. Fix for #1412
  • Loading branch information
kmatheussen committed Mar 3, 2024
1 parent 4b3c8a2 commit f205ce5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 29 deletions.
58 changes: 29 additions & 29 deletions Qt/Qt_patch_widget_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,33 +201,35 @@ class Patch_widget : public QWidget, public GL_PauseCaller, public Ui::Patch_wid

setup_popup_menus_and_stuff();

#if 0
IsAlive is_alive(this);

//locked_instrument->_hovered_callback = [is_alive](bool do_enter){
// if (is_alive){
// if (do_enter){
//
// QString settings_key, default_dir;
// QString path =
// "Select whether Radium is allowed to change to a different instrument by itself.<br>"
// "<p>Right-click to configure keybinding and change current instrument.";
//
// //QToolTip::showText(QCursor::pos(),path + "gakk",NULL,QRect()); // QToolTip tries to be smart, but does of course fail. Why not let the programmer decide how things should behave instead? (shold probably make a custom tooltip function to avoid alle these workarounds)
// QToolTip::showText(QCursor::pos(),path,NULL,QRect());

// if (isCurrentInstrumentLocked())
// GFX_SetStatusBar("Current instrument locked");
// else
// GFX_SetStatusBar("Current instrument unlocked");
//
// } else {
//
// QToolTip::hideText();
// GFX_SetStatusBar("");
//
// }
// }
//};
locked_instrument->_hovered_callback = [is_alive](bool do_enter){
if (is_alive){
if (do_enter){

QString settings_key, default_dir;
QString path =
"Select whether Radium is allowed to change to a different instrument by itself.<br>"
"<p>Right-click to configure keybinding and change current instrument.";

//QToolTip::showText(QCursor::pos(),path + "gakk",NULL,QRect()); // QToolTip tries to be smart, but does of course fail. Why not let the programmer decide how things should behave instead? (shold probably make a custom tooltip function to avoid alle these workarounds)
QToolTip::showText(QCursor::pos(),path,NULL,QRect());

if (isCurrentInstrumentLocked())
GFX_SetStatusBar("Current instrument locked");
else
GFX_SetStatusBar("Current instrument unlocked");

} else {

QToolTip::hideText();
GFX_SetStatusBar("");

}
}
};
#endif

updateWidgets();
initing = false;
Expand Down Expand Up @@ -430,11 +432,9 @@ class Patch_widget : public QWidget, public GL_PauseCaller, public Ui::Patch_wid

//locked_instrument->setChecked(isCurrentInstrumentLocked());

#if 0
locked_instrument->_show_popup_menu = [](){
S7CALL2(void_void,"FROM_C-show-lock-instrument-popup-menu");
select_instrument->_show_popup_menu = [](){
S7CALL2(void_void,"FROM_C-show-select-instrument-right-click");
};
#endif

}

Expand Down
1 change: 1 addition & 0 deletions bin/scheme/init.scm
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ FROM_C-pitch_type_button-pressed
FROM_C-create-cpu-usage-widget
FROM_C-show-mixer-popup-menu-effect
FROM_C-show-set-current-audio-or-midi-instrument-popup-menu
FROM_C-show-select-instrument-right-click
))

(define-constant *functions-and-symbols-used-by-C-that-are-not-available-at-program-startup*
Expand Down
10 changes: 10 additions & 0 deletions bin/scheme/instruments.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,16 @@ ra.evalScheme "(pmg-start (ra:create-new-instrument-conf) (lambda (descr) (creat
(define (FROM_C-show-set-current-audio-or-midi-instrument-popup-menu)
(show-set-current-audio-or-midi-instrument-popup-menu))


(define (FROM_C-show-select-instrument-right-click)
(popup-menu
"-------Keybindings"
(get-keybinding-configuration-popup-menu-entries "FROM_C-show-set-current-audio-or-midi-instrument-popup-menu")
"-------------"
"Help keybindings" show-keybinding-help-window
))


(define (delete-all-unused-MIDI-instruments)
(define used-instruments (<new> :container '() equal?))
(define unused-MIDI-instruments '())
Expand Down

0 comments on commit f205ce5

Please sign in to comment.