Skip to content

Commit

Permalink
Instrument: Replace the "locked" checkbox with a "select" button, (Fi…
Browse files Browse the repository at this point in the history
…x for #1412)
  • Loading branch information
kjetil_matheussen committed Feb 25, 2024
1 parent 822cb9a commit e97b402
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 13 deletions.
33 changes: 21 additions & 12 deletions Qt/Qt_patch_widget_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ class Patch_widget : public QWidget, public GL_PauseCaller, public Ui::Patch_wid
header->setMinimumHeight(header_height);
header->setMaximumHeight(header_height);

locked_instrument->setMinimumWidth(header_height);
locked_instrument->setMaximumWidth(header_height);
select_instrument->setMinimumWidth(header_height);
select_instrument->setMaximumWidth(header_height);

for(int i=0;i<NUM_PATCH_VOICES;i++){
const PatchVoice &voice=_patch->voices[i];
Expand Down Expand Up @@ -412,27 +412,30 @@ class Patch_widget : public QWidget, public GL_PauseCaller, public Ui::Patch_wid
adjust_labels();

{
QFont font;
locked_instrument->setFont(font); // don't know why
//QFont font;
//select_instrument->setFont(font); // don't know why

if (isCurrentInstrumentLocked())
locked_instrument->setText("locked.svg");
else
locked_instrument->setText("unlocked.svg");
//if (isCurrentInstrumentLocked())
//locked_instrument->setText("locked.svg");
select_instrument->setText("arrow-down-filled-triangle-svgrepo-com.svg");
//else
//locked_instrument->setText("unlocked.svg");

locked_instrument->_show_enabled_marker = false;
//locked_instrument->_show_enabled_marker = false;

/*
const QFontMetrics fn = QFontMetrics(font);
float width = 1.5 * fn.boundingRect("L").width();
*/

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

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

#endif

}

_called_from_update = false;
Expand Down Expand Up @@ -585,11 +588,17 @@ class Patch_widget : public QWidget, public GL_PauseCaller, public Ui::Patch_wid

public slots:

void on_select_instrument_clicked(void){
S7CALL2(void_void, "FROM_C-show-set-current-instrument-popup-menu");
}

#if 0
void on_locked_instrument_toggled(bool val){
if (!_called_from_update)
setCurrentInstrumentLocked(val);
}

#endif

void on_o1_toggled(bool val){onoff_toggled(0,val);}
void on_o2_toggled(bool val){onoff_toggled(1,val);}
void on_o3_toggled(bool val){onoff_toggled(2,val);}
Expand Down
2 changes: 1 addition & 1 deletion Qt/qt4_patch_widget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="locked_instrument">
<widget class="QToolButton" name="select_instrument">
<property name="toolTip">
<string/>
</property>
Expand Down
12 changes: 12 additions & 0 deletions bin/arrow-down-filled-triangle-svgrepo-com.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions bin/scheme/init.scm
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ FROM_C-show-mixer-config-settings-menu
FROM_C-pitch_type_button-pressed
FROM_C-create-cpu-usage-widget
FROM_C-show-mixer-popup-menu-effect
FROM_C-show-set-current-instrument-popup-menu
))

(define-constant *functions-and-symbols-used-by-C-that-are-not-available-at-program-startup*
Expand Down
3 changes: 3 additions & 0 deletions bin/scheme/instruments.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,9 @@ ra.evalScheme "(pmg-start (ra:create-new-instrument-conf) (lambda (descr) (creat
(get-all-audio-instruments)))))


(define (FROM_C-show-set-current-instrument-popup-menu)
(show-set-current-instrument-popup-menu))

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

0 comments on commit e97b402

Please sign in to comment.