remove MIDI scroomer from code

This commit is contained in:
Paul Davis 2023-08-18 11:40:02 -06:00
parent 605fd136e0
commit 090b9d4f60
5 changed files with 0 additions and 209 deletions

View File

@ -1,143 +0,0 @@
/*
* Copyright (C) 2008-2009 David Robillard <d@drobilla.net>
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <iostream>
#include <cairomm/context.h>
#include "midi_scroomer.h"
#include "ui_config.h"
using namespace Gtk;
using namespace std;
//std::map<int, Glib::RefPtr<Gdk::Pixmap> > MidiScroomer::piano_pixmaps;
MidiScroomer::MidiScroomer(Adjustment& adj)
: ArdourWidgets::Scroomer(adj)
{
adj.set_lower(0);
adj.set_upper(127);
/* set minimum view range to one octave */
set_min_page_size(12);
}
MidiScroomer::~MidiScroomer()
{
}
bool
MidiScroomer::on_expose_event(GdkEventExpose* ev)
{
Cairo::RefPtr<Cairo::Context> cc = get_window()->create_cairo_context();
GdkRectangle comp_rect, clip_rect;
Component first_comp = point_in(ev->area.y);
Component last_comp = point_in(ev->area.y + ev->area.height);
int height = get_height();
int lnote, hnote;
double y2note = (double) 127 / height;
double note2y = (double) height / 127;
double note_width = 0.8 * get_width();
double note_height = 1.4 * note2y;
double black_shift = 0.1 * note2y;
double colors[6] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
//cerr << ev->area.y << " " << ev->area.height << endl;
comp_rect.x = 0;
comp_rect.width = get_width();
for (int i = first_comp; i <= last_comp; ++i) {
Component comp = (Component) i;
set_comp_rect(comp_rect, comp);
//if (gdk_rectangle_intersect(&comp_rect, &ev->area, &clip_rect)) {
get_colors(colors, comp);
cc->set_source_rgb (1.f,0.f,0.f);//(colors[3], colors[4], colors[5]);
cc->rectangle(clip_rect.x, clip_rect.y, clip_rect.width, clip_rect.height);
//cc->fill_preserve();
//cc->clip();
cc->fill ();
//cc->set_source_rgb(colors[0], colors[1], colors[2]);
//cc->set_line_width(note_height);
lnote = 127 - (int) floor((double) (clip_rect.y + clip_rect.height) * y2note) - 1;
hnote = 127 - (int) floor((double) clip_rect.y * y2note) + 1;
if (i == Handle1 || i == Handle2) {
cc->rectangle(comp_rect.x + 0.5f, comp_rect.y + 0.5f, comp_rect.width - 1.0f, comp_rect.height - 1.0f);
cc->set_line_width(1.0f);
cc->set_source_rgb (1.0f, 1.0f, 1.0f);
cc->stroke();
}
cc->reset_clip();
//}
}
return true;
}
void
MidiScroomer::get_colors(double color[], Component comp)
{
switch (comp) {
case TopBase:
case BottomBase:
color[0] = 0.24f;
color[1] = 0.24f;
color[2] = 0.24f;
color[3] = 0.33f;
color[4] = 0.33f;
color[5] = 0.33f;
break;
case Handle1:
case Handle2:
color[0] = 0.91f;
color[1] = 0.91f;
color[2] = 0.91f;
color[3] = 0.0f;
color[4] = 0.0f;
color[5] = 0.0f;
break;
case Slider:
color[0] = 0.38f;
color[1] = 0.38f;
color[2] = 0.38f;
color[3] = 0.77f;
color[4] = 0.77f;
color[5] = 0.77f;
break;
default:
break;
}
}
void
MidiScroomer::on_size_request(Gtk::Requisition* r)
{
r->width = std::max (12.f, rintf (12.f * UIConfiguration::instance().get_ui_scale()));
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (C) 2008-2009 David Robillard <d@drobilla.net>
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __ardour_midi_scroomer_h__
#define __ardour_midi_scroomer_h__
#include "widgets/scroomer.h"
class MidiScroomer : public ArdourWidgets::Scroomer
{
public:
MidiScroomer(Gtk::Adjustment&);
~MidiScroomer();
bool on_expose_event(GdkEventExpose*);
void on_size_request(Gtk::Requisition*);
void get_colors(double color[], Component comp);
};
#endif /* __ardour_midi_scroomer_h__ */

View File

@ -84,7 +84,6 @@
#include "gui_thread.h"
#include "keyboard.h"
#include "midi_channel_selector.h"
#include "midi_scroomer.h"
#include "midi_streamview.h"
#include "midi_region_view.h"
#include "midi_time_axis.h"
@ -123,7 +122,6 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanva
, RouteTimeAxisView (ed, sess, canvas)
, _ignore_signals(false)
, _asked_all_automation(false)
, _range_scroomer(0)
, _piano_roll_header(0)
, _note_mode(Sustained)
, _note_mode_item(0)
@ -157,10 +155,6 @@ MidiTimeAxisView::set_route (std::shared_ptr<Route> rt)
if (is_track ()) {
_piano_roll_header = new PianoRollHeader(*midi_view());
//_range_scroomer = new MidiScroomer(midi_view()->note_range_adjustment);
//_piano_roll_header->DoubleClicked.connect (
// sigc::bind (sigc::mem_fun(*this, &MidiTimeAxisView::set_note_range),
// MidiStreamView::ContentsRange, false));
}
/* This next call will result in our height being set up, so it must come after
@ -179,9 +173,6 @@ MidiTimeAxisView::set_route (std::shared_ptr<Route> rt)
true);
}
_view->ContentsHeightChanged.connect (
sigc::mem_fun (*this, &MidiTimeAxisView::contents_height_changed));
if (is_midi_track()) {
_note_mode = midi_track()->note_mode();
}
@ -232,7 +223,6 @@ MidiTimeAxisView::set_route (std::shared_ptr<Route> rt)
VBox* v = manage (new VBox);
HBox* h = manage (new HBox);
h->pack_end (*_piano_roll_header);
//h->pack_end (*_range_scroomer);
v->pack_start (*separator, false, false);
v->pack_start (*h, true, true);
v->show ();
@ -351,9 +341,6 @@ MidiTimeAxisView::~MidiTimeAxisView ()
delete _piano_roll_header;
_piano_roll_header = 0;
delete _range_scroomer;
_range_scroomer = 0;
delete controller_menu;
delete _step_editor;
}
@ -684,16 +671,10 @@ MidiTimeAxisView::update_scroomer_visbility (uint32_t h, LayerDisplay d)
return;
}
if (h >= KEYBOARD_MIN_HEIGHT && d == Overlaid) {
if (_range_scroomer) {
_range_scroomer->show();
}
if (_piano_roll_header) {
_piano_roll_header->show();
}
} else {
if (_range_scroomer) {
_range_scroomer->hide();
}
if (_piano_roll_header) {
_piano_roll_header->hide();
}
@ -1882,12 +1863,6 @@ MidiTimeAxisView::note_range_changed ()
set_gui_property ("note-range-max", (int) midi_view()->highest_note ());
}
void
MidiTimeAxisView::contents_height_changed ()
{
//_range_scroomer->queue_resize ();
}
bool
MidiTimeAxisView::paste (timepos_t const & pos, const Selection& selection, PasteContext& ctx)
{

View File

@ -67,7 +67,6 @@ namespace Evoral {
class PublicEditor;
class MidiStreamView;
class MidiScroomer;
class PianoRollHeader;
class StepEntry;
class StepEditor;
@ -142,7 +141,6 @@ private:
void set_note_range (MidiStreamView::VisibleNoteRange range, bool apply_to_selection = false);
void route_active_changed ();
void note_range_changed ();
void contents_height_changed ();
void update_scroomer_visbility (uint32_t, LayerDisplay);
@ -153,7 +151,6 @@ private:
bool _asked_all_automation;
std::string _effective_model;
std::string _effective_mode;
MidiScroomer* _range_scroomer;
PianoRollHeader* _piano_roll_header;
ARDOUR::NoteMode _note_mode;
Gtk::RadioMenuItem* _note_mode_item;

View File

@ -174,7 +174,6 @@ gtk2_ardour_sources = [
'midi_region_operations_box.cc',
'midi_region_properties_box.cc',
'midi_trigger_properties_box.cc',
'midi_scroomer.cc',
'midi_selection.cc',
'midi_streamview.cc',
'midi_time_axis.cc',