Support stepping bank by shift+scroll/arrow.
This commit is contained in:
parent
d2cafbe95a
commit
5f66300349
@ -1984,11 +1984,14 @@ MidiRegionView::delete_patch_change (PatchChange* pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiRegionView::step_patch (PatchChange& patch, int dbank, int dprog)
|
MidiRegionView::step_patch (PatchChange& patch, bool bank, int delta)
|
||||||
{
|
{
|
||||||
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key(patch.patch());
|
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key(patch.patch());
|
||||||
key.set_bank(key.bank() + dbank);
|
if (bank) {
|
||||||
key.set_program(key.program() + dprog);
|
key.set_bank(key.bank() + delta);
|
||||||
|
} else {
|
||||||
|
key.set_program(key.program() + delta);
|
||||||
|
}
|
||||||
change_patch_change(patch, key);
|
change_patch_change(patch, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,8 +153,11 @@ public:
|
|||||||
|
|
||||||
void delete_sysex (SysEx*);
|
void delete_sysex (SysEx*);
|
||||||
|
|
||||||
/** Change a patch to the next or previous bank/program. */
|
/** Change a patch to the next or previous bank/program.
|
||||||
void step_patch (PatchChange& patch, int dbank, int dprog);
|
* @param bank If true, step bank, otherwise, step program.
|
||||||
|
* @param delta Amount to adjust number.
|
||||||
|
*/
|
||||||
|
void step_patch (PatchChange& patch, bool bank, int delta);
|
||||||
|
|
||||||
/** Displays all patch change events in the region as flags on the canvas.
|
/** Displays all patch change events in the region as flags on the canvas.
|
||||||
*/
|
*/
|
||||||
|
@ -31,18 +31,18 @@
|
|||||||
#include "canvas/debug.h"
|
#include "canvas/debug.h"
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
#include "midi_region_view.h"
|
|
||||||
#include "patch_change.h"
|
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
#include "editor_drag.h"
|
#include "editor_drag.h"
|
||||||
|
#include "midi_region_view.h"
|
||||||
|
#include "patch_change.h"
|
||||||
|
|
||||||
using namespace MIDI::Name;
|
using namespace MIDI::Name;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using Gtkmm2ext::Keyboard;
|
||||||
|
|
||||||
/** @param x x position in pixels.
|
/** @param x x position in pixels.
|
||||||
*/
|
*/
|
||||||
PatchChange::PatchChange(
|
PatchChange::PatchChange(MidiRegionView& region,
|
||||||
MidiRegionView& region,
|
|
||||||
ArdourCanvas::Container* parent,
|
ArdourCanvas::Container* parent,
|
||||||
const string& text,
|
const string& text,
|
||||||
double height,
|
double height,
|
||||||
@ -60,8 +60,7 @@ PatchChange::PatchChange(
|
|||||||
height,
|
height,
|
||||||
ARDOUR_UI::config()->color ("midi patch change outline"),
|
ARDOUR_UI::config()->color ("midi patch change outline"),
|
||||||
ARDOUR_UI::config()->color_mod ("midi patch change fill", "midi patch change fill"),
|
ARDOUR_UI::config()->color_mod ("midi patch change fill", "midi patch change fill"),
|
||||||
ArdourCanvas::Duple (x, y)
|
ArdourCanvas::Duple (x, y));
|
||||||
);
|
|
||||||
|
|
||||||
CANVAS_DEBUG_NAME (_flag, text);
|
CANVAS_DEBUG_NAME (_flag, text);
|
||||||
|
|
||||||
@ -199,13 +198,15 @@ PatchChange::event_handler (GdkEvent* ev)
|
|||||||
case GDK_Up:
|
case GDK_Up:
|
||||||
case GDK_KP_Up:
|
case GDK_KP_Up:
|
||||||
case GDK_uparrow:
|
case GDK_uparrow:
|
||||||
_region.step_patch (*this, 0, -1);
|
_region.step_patch(
|
||||||
break;
|
*this, Keyboard::modifier_state_contains(ev->key.state, Keyboard::TertiaryModifier), 1);
|
||||||
|
return true;
|
||||||
case GDK_Down:
|
case GDK_Down:
|
||||||
case GDK_KP_Down:
|
case GDK_KP_Down:
|
||||||
case GDK_downarrow:
|
case GDK_downarrow:
|
||||||
_region.step_patch (*this, 0, 1);
|
_region.step_patch(
|
||||||
break;
|
*this, Keyboard::modifier_state_contains(ev->key.state, Keyboard::TertiaryModifier), -1);
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -213,10 +214,12 @@ PatchChange::event_handler (GdkEvent* ev)
|
|||||||
|
|
||||||
case GDK_SCROLL:
|
case GDK_SCROLL:
|
||||||
if (ev->scroll.direction == GDK_SCROLL_UP) {
|
if (ev->scroll.direction == GDK_SCROLL_UP) {
|
||||||
_region.step_patch (*this, 0, -1);
|
_region.step_patch(
|
||||||
|
*this, Keyboard::modifier_state_contains(ev->scroll.state, Keyboard::TertiaryModifier), 1);
|
||||||
return true;
|
return true;
|
||||||
} else if (ev->scroll.direction == GDK_SCROLL_DOWN) {
|
} else if (ev->scroll.direction == GDK_SCROLL_DOWN) {
|
||||||
_region.step_patch (*this, 0, 1);
|
_region.step_patch(
|
||||||
|
*this, Keyboard::modifier_state_contains(ev->scroll.state, Keyboard::TertiaryModifier), -1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -33,34 +33,29 @@ namespace MIDI {
|
|||||||
class PatchChange
|
class PatchChange
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PatchChange(
|
PatchChange(MidiRegionView& region,
|
||||||
MidiRegionView& region,
|
|
||||||
ArdourCanvas::Container* parent,
|
ArdourCanvas::Container* parent,
|
||||||
const std::string& text,
|
const std::string& text,
|
||||||
double height,
|
double height,
|
||||||
double x,
|
double x,
|
||||||
double y,
|
double y,
|
||||||
ARDOUR::InstrumentInfo& info,
|
ARDOUR::InstrumentInfo& info,
|
||||||
ARDOUR::MidiModel::PatchChangePtr patch
|
ARDOUR::MidiModel::PatchChangePtr patch);
|
||||||
);
|
|
||||||
|
|
||||||
~PatchChange();
|
~PatchChange();
|
||||||
|
|
||||||
ARDOUR::MidiModel::PatchChangePtr patch () const { return _patch; }
|
|
||||||
|
|
||||||
void initialize_popup_menus();
|
void initialize_popup_menus();
|
||||||
|
|
||||||
void on_patch_menu_selected(const MIDI::Name::PatchPrimaryKey& key);
|
void on_patch_menu_selected(const MIDI::Name::PatchPrimaryKey& key);
|
||||||
|
|
||||||
ArdourCanvas::Item* canvas_item () const {
|
|
||||||
return _flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
void move (ArdourCanvas::Duple);
|
void move (ArdourCanvas::Duple);
|
||||||
void set_height (ArdourCanvas::Distance);
|
void set_height (ArdourCanvas::Distance);
|
||||||
void hide ();
|
void hide ();
|
||||||
void show ();
|
void show ();
|
||||||
|
|
||||||
|
ARDOUR::MidiModel::PatchChangePtr patch() const { return _patch; }
|
||||||
|
ArdourCanvas::Item* canvas_item() const { return _flag; }
|
||||||
ArdourCanvas::Item& item() const { return *_flag; }
|
ArdourCanvas::Item& item() const { return *_flag; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user