Shrink scroomer horizontally a bit to emphasise the 'real' keyboard.
authorDavid Robillard <d@drobilla.net>
Sun, 5 Oct 2008 01:07:44 +0000 (01:07 +0000)
committerDavid Robillard <d@drobilla.net>
Sun, 5 Oct 2008 01:07:44 +0000 (01:07 +0000)
Cleanup gtk2_ardour/midi_scroomer.cc.

git-svn-id: svn://localhost/ardour2/branches/3.0@3860 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/midi_scroomer.cc
libs/gtkmm2ext/scroomer.cc

index fc63f89611ddef58e5cbe55e9719eaf53de7893c..f3bafb75841c2f6750b4f41fe9efa655b043393b 100644 (file)
@@ -29,7 +29,8 @@ using namespace std;
 //std::map<int, Glib::RefPtr<Gdk::Pixmap> > 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<Cairo::Context> 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;
@@ -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,17 @@ MidiScroomer::get_colors(double color[], Component comp) {
 }
 
 void
-MidiScroomer::on_size_request(Gtk::Requisition* r) {
-       r->width = 16;
+MidiScroomer::on_size_request(Gtk::Requisition* r)
+{
+       r->width = 12;
        r->height = 100;
        //r->width = 32;
        //r->height = 512;
 }
 
 void
-MidiScroomer::on_size_allocate(Gtk::Allocation& a) {
+MidiScroomer::on_size_allocate(Gtk::Allocation& a)
+{
        Scroomer::on_size_allocate(a);
 }
+
index 0f252070064e0999632a665f1e76f36a69037ac3..a8bd0289f23771d5050a59cb3ab18ae9e43da38d 100644 (file)
@@ -118,8 +118,7 @@ Scroomer::on_motion_notify_event (GdkEventMotion* ev)
                break;
        }
 
-       /*
-        * Then we handle zoom, which is dragging horizontally. We zoom around the area that is
+       /* Then we handle zoom, which is dragging horizontally. We zoom around the area that is
         * the current y pointer value, not from the area that was the start of the drag.
         * the point of zoom must have the same 
         */
@@ -269,8 +268,7 @@ Scroomer::on_size_allocate (Allocation& a)
        update();
 }
 
-/*
- * assumes that x and width are correct, and they will not be altered
+/** Assumes that x and width are correct, and they will not be altered.
  */
 void
 Scroomer::set_comp_rect(GdkRectangle& r, Component c) const