Skip to content

Commit

Permalink
Instrument: Remove all "locked instrument" entries from popup menus. …
Browse files Browse the repository at this point in the history
…The concept has been removed. Fix for #1412
  • Loading branch information
kmatheussen committed Mar 3, 2024
1 parent f205ce5 commit 989f716
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Qt/Qt_instruments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ static void GFX_PP_Update_internal(struct Patch *patch, bool is_loading, bool op

struct Patch *old_current = PATCH_get_current();

if (old_current != NULL && g_is_loading==false && open_even_if_locked==false && isCurrentInstrumentLocked())
if (old_current != NULL && g_is_loading==false && open_even_if_locked==false)
return;

called_from_pp_update = true;{
Expand Down
9 changes: 7 additions & 2 deletions api/api_instruments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3849,8 +3849,9 @@ void setCurrentInstrumentDown(bool set_current_instrument, bool set_current_inst
S7CALL2(void_bool_bool,"FROM_C-move-current-instrument-down", set_current_instrument, set_current_instrument_under_mouse);
}

static bool g_curr_instrument_is_locked = true;// = createIllegalInstrument();
//static bool g_curr_instrument_is_locked = true;// = createIllegalInstrument();

#if 0
void setCurrentInstrumentLocked(bool lockit){
if (lockit==g_curr_instrument_is_locked)
return;
Expand All @@ -3867,7 +3868,9 @@ void setCurrentInstrumentLocked(bool lockit){
g_curr_locked_instrument = createIllegalInstrument();
*/
}
#endif

#if 0
bool isCurrentInstrumentLocked(void){
return g_curr_instrument_is_locked;
/*
Expand All @@ -3877,7 +3880,9 @@ bool isCurrentInstrumentLocked(void){
return PATCH_get_from_id(g_curr_locked_instrument) != NULL;
*/
}
#endif

#if 0
void switchSetCurrentInstrumentLocked(void){
setCurrentInstrumentLocked(!isCurrentInstrumentLocked());

Expand All @@ -3888,7 +3893,7 @@ void switchSetCurrentInstrumentLocked(void){
g_curr_locked_instrument = createIllegalInstrument();
*/
}

#endif

static radium::ProtectedS7FuncVector g_current_instrument_changed_callbacks(true);

Expand Down
6 changes: 3 additions & 3 deletions api/protos.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1249,9 +1249,9 @@ void setCurrentInstrumentRight | bool set_current_instrument ? false | bool set_
void setCurrentInstrumentUp | bool set_current_instrument ? false | bool set_current_instrument_under_mouse ? true
void setCurrentInstrumentDown | bool set_current_instrument ? false | bool set_current_instrument_under_mouse ? true

void setCurrentInstrumentLocked | bool lockit # if lockit is true, the program will not (by itself) change current instrument to a different instrument.
bool isCurrentInstrumentLocked
switchSetCurrentInstrumentLocked
#void setCurrentInstrumentLocked | bool lockit # if lockit is true, the program will not (by itself) change current instrument to a different instrument.
#bool isCurrentInstrumentLocked
#switchSetCurrentInstrumentLocked

void addCurrentInstrumentChangedCallback | func_t* callback # If callback returns #f, the callback will not be called again.
void removeCurrentInstrumentChangedCallback | func_t* callback
Expand Down
2 changes: 1 addition & 1 deletion bin/scheme/init.scm
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ FROM_C-delete-selected-pianonotes!
show-keybinding-help-window
FROM_C-ensure-curr-block-is-visible-in-blocklist
FROM_C-call-me-after-curr-seqblock-under-mouse-has-been-called
FROM_C-show-lock-instrument-popup-menu
;;FROM_C-show-lock-instrument-popup-menu
FROM_C-show-mixer-popup-menu
FROM_C-show-mixer-connection-popup-menu
FROM_C-delete-editor-beat
Expand Down
42 changes: 21 additions & 21 deletions bin/scheme/instruments.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1716,26 +1716,26 @@


;; Note: used for shortcut
(delafina (switch-force-as-current-instrument :instrument-id (<ra> :get-current-instrument-under-mouse))
(define is-forced (and (<ra> :is-current-instrument-locked)
(equal? instrument-id (<ra> :get-current-instrument-under-mouse))))
(if is-forced
(<ra> :set-current-instrument-locked #f)
(begin
(<ra> :set-current-instrument-locked #t)
(<ra> :set-current-instrument instrument-id))))

(define (get-forced-as-current-instrument-menu-entry instrument-id)
(list "Forced as current instrument"
:check (and (<ra> :is-current-instrument-locked)
(equal? instrument-id (<ra> :get-current-instrument)))
:shortcut switch-force-as-current-instrument
(lambda (setit)
(if setit
(begin
(<ra> :set-current-instrument-locked #t)
(<ra> :set-current-instrument instrument-id))
(<ra> :set-current-instrument-locked #f)))))
;;(delafina (switch-force-as-current-instrument :instrument-id (<ra> :get-current-instrument-under-mouse))
;; (define is-forced (and (<ra> :is-current-instrument-locked)
;; (equal? instrument-id (<ra> :get-current-instrument-under-mouse))))
;; (if is-forced
;; (<ra> :set-current-instrument-locked #f)
;; (begin
;; (<ra> :set-current-instrument-locked #t)
;; (<ra> :set-current-instrument instrument-id))))

;;(define (get-forced-as-current-instrument-menu-entry instrument-id)
;; (list "Forced as current instrument"
;; :check (and (<ra> :is-current-instrument-locked)
;; (equal? instrument-id (<ra> :get-current-instrument)))
;; :shortcut switch-force-as-current-instrument
;; (lambda (setit)
;; (if setit
;; (begin
;; (<ra> :set-current-instrument-locked #t)
;; (<ra> :set-current-instrument instrument-id))
;; (<ra> :set-current-instrument-locked #f)))))

(delafina (get-insert-plugin-entry :instrument-id
:enabled #t
Expand Down Expand Up @@ -1808,7 +1808,7 @@
(lambda (doit)
(switch-connect-instrument-to-main-pipe instrument-id)))

(get-forced-as-current-instrument-menu-entry instrument-id)
;;(get-forced-as-current-instrument-menu-entry instrument-id)

(list "Assign to current editor track"
:shortcut assign-instrument-to-current-editor-track
Expand Down
2 changes: 1 addition & 1 deletion bin/scheme/mixer-strips.scm
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
(lambda ()
(strips-config :show-config-gui))))

(get-forced-as-current-instrument-menu-entry instrument-id)
;;(get-forced-as-current-instrument-menu-entry instrument-id)

(list "Set current instrument..."
show-set-current-instrument-popup-menu)
Expand Down
20 changes: 10 additions & 10 deletions bin/scheme/various.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1044,16 +1044,16 @@
;; Instruments


(define (FROM_C-show-lock-instrument-popup-menu)
(popup-menu
(get-keybinding-configuration-popup-menu-entries "ra:switch-set-current-instrument-locked"
'()
"")
"-------------"
"Set current instrument..." show-set-current-instrument-popup-menu
"-------------"
"Help keybindings" show-keybinding-help-window
))
;;(define (FROM_C-show-lock-instrument-popup-menu)
;; (popup-menu
;; (get-keybinding-configuration-popup-menu-entries "ra:switch-set-current-instrument-locked"
;; '()
;; "")
;; "-------------"
;; "Set current instrument..." show-set-current-instrument-popup-menu
;; "-------------"
;; "Help keybindings" show-keybinding-help-window
;; ))



Expand Down

0 comments on commit 989f716

Please sign in to comment.