X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmidi_scroomer.cc;h=c3295c8f7344e7784a6610edfc4921b26ae81d11;hb=a366fba7d0933a8f2d97d95fefcbcdc9692d2117;hp=fc63f89611ddef58e5cbe55e9719eaf53de7893c;hpb=1b657585572298d1a69a7b43e611f59b7e185df3;p=ardour.git diff --git a/gtk2_ardour/midi_scroomer.cc b/gtk2_ardour/midi_scroomer.cc index fc63f89611..c3295c8f73 100644 --- a/gtk2_ardour/midi_scroomer.cc +++ b/gtk2_ardour/midi_scroomer.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2008 Paul Davis + Copyright (C) 2008 Paul Davis 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 @@ -29,7 +29,8 @@ using namespace std; //std::map > MidiScroomer::piano_pixmaps; MidiScroomer::MidiScroomer(Adjustment& adj) - : Gtkmm2ext::Scroomer(adj) { + : Gtkmm2ext::Scroomer(adj) +{ adj.set_lower(0); adj.set_upper(127); @@ -38,11 +39,13 @@ MidiScroomer::MidiScroomer(Adjustment& adj) set_min_page_size(12); } -MidiScroomer::~MidiScroomer() { +MidiScroomer::~MidiScroomer() +{ } bool -MidiScroomer::on_expose_event(GdkEventExpose* ev) { +MidiScroomer::on_expose_event(GdkEventExpose* ev) +{ Cairo::RefPtr cc = get_window()->create_cairo_context(); GdkRectangle comp_rect, clip_rect; Component first_comp = point_in(ev->area.y); @@ -61,11 +64,11 @@ MidiScroomer::on_expose_event(GdkEventExpose* ev) { comp_rect.x = 0; comp_rect.width = get_width(); - for(int i = first_comp; i <= last_comp; ++i) { + 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)) { + if (gdk_rectangle_intersect(&comp_rect, &ev->area, &clip_rect)) { get_colors(colors, comp); cc->rectangle(clip_rect.x, clip_rect.y, clip_rect.width, clip_rect.height); @@ -79,11 +82,11 @@ MidiScroomer::on_expose_event(GdkEventExpose* ev) { lnote = 127 - (int) floor((double) (clip_rect.y + clip_rect.height) * y2note) - 1; hnote = 127 - (int) floor((double) clip_rect.y * y2note) + 1; - for(int note = lnote; note < hnote + 1; ++note) { + for (int note = lnote; note < hnote + 1; ++note) { double y = height - note * note2y; bool draw = false; - - switch(note % 12) { + + switch (note % 12) { case 1: case 6: y -= black_shift; @@ -100,7 +103,7 @@ MidiScroomer::on_expose_event(GdkEventExpose* ev) { default: break; } - + if(draw) { cc->set_line_width(1.4 * note2y); cc->move_to(0, y); @@ -109,7 +112,7 @@ MidiScroomer::on_expose_event(GdkEventExpose* ev) { } } - if(i == Handle1 || i == Handle2) { + 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); @@ -124,7 +127,8 @@ MidiScroomer::on_expose_event(GdkEventExpose* ev) { } void -MidiScroomer::get_colors(double color[], Component comp) { +MidiScroomer::get_colors(double color[], Component comp) +{ switch (comp) { case TopBase: case BottomBase: @@ -158,14 +162,7 @@ MidiScroomer::get_colors(double color[], Component comp) { } void -MidiScroomer::on_size_request(Gtk::Requisition* r) { - r->width = 16; - r->height = 100; - //r->width = 32; - //r->height = 512; -} - -void -MidiScroomer::on_size_allocate(Gtk::Allocation& a) { - Scroomer::on_size_allocate(a); +MidiScroomer::on_size_request(Gtk::Requisition* r) +{ + r->width = 12; }