1
Fork 0

Added CustomScroll class in customscroll.cpp and h.

This subclass is required if I want the arranger
widget to get mousewheel or arrow key events.
This commit is contained in:
EvanR 2008-12-31 23:32:23 -06:00
parent ad65eade83
commit a4aa27937a
9 changed files with 107 additions and 14 deletions

View File

@ -11,4 +11,5 @@ saveload.cpp seq.h backend.h ui.h pianoroll.h \
trackselect.h eventedit.h timeline.h sampleview.h \
trackinfo.h arranger.h keyboard.h trackmodule.h \
util.h midi.h uihelper.h saveload.h metronome.cpp \
metronome.h eventmenu.cpp eventmenu.h
metronome.h eventmenu.cpp eventmenu.h customscroll.cpp \
customscroll.h

View File

@ -92,10 +92,10 @@ int Arranger::handle(int event){
s = over_seqpat();
if(s){
if(event_dy()>0){
printf("up!\n");
printf("down!\n");
}
else if(event_dy()<0){
printf("down!\n");
printf("up!\n");
}
}
return 1;

55
src/customscroll.cpp Normal file
View File

@ -0,0 +1,55 @@
/*
Epichord - a midi sequencer
Copyright (C) 2008 Evan Rinehart
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 <stdlib.h>
#include <stdio.h>
#include <fltk/ScrollGroup.h>
#include <fltk/Widget.h>
#include "customscroll.h"
#include "ui.h"
extern UI* ui;
CustomScroll::CustomScroll(int x, int y, int w, int h, const char* label) : fltk::ScrollGroup(x, y, w, h, label) {
}
int CustomScroll::handle(int event){
switch(event){
case fltk::MOUSEWHEEL:
Widget* w = child(0);
if(w){
w->handle(event);
}
return 1;
break;
}
return fltk::ScrollGroup::handle(event);
}

34
src/customscroll.h Normal file
View File

@ -0,0 +1,34 @@
/*
Epichord - a midi sequencer
Copyright (C) 2008 Evan Rinehart
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 customscroll_h
#define customscroll_h
class CustomScroll : public fltk::ScrollGroup {
public:
CustomScroll(int x, int y, int w, int h, const char* label=0);
int handle(int event);
};
#endif

View File

@ -29,7 +29,6 @@
#include <fltk/ValueInput.h>
#include "ui.h"
#include "backend.h"
#include "uihelper.h"

View File

@ -20,7 +20,7 @@
Boston, MA 02110-1301, USA
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fltk/Group.h>
#include <fltk/Widget.h>

View File

@ -422,7 +422,7 @@ UI::UI() {
}
o->end();
}
{fltk::ScrollGroup* o = song_scroll = new fltk::ScrollGroup(255, 15, 385, 430);
{CustomScroll* o = song_scroll = new CustomScroll(255, 15, 385, 430);
o->set_vertical();
o->begin();
{Arranger* o = arranger = new Arranger(0, 0, 245, 220, "arranger");

View File

@ -55,7 +55,7 @@ action_window->hide();
scope_window->hide();
o->hide();
save_config();}
save_config();} open
xywh {31 41 640 480} resizable
extra_code {\#include <unistd.h>
\#include <stdio.h>
@ -67,7 +67,7 @@ o->resize(640,455);} visible
{fltk::Group} {} {open
xywh {0 0 640 445} resizable
} {
{fltk::Group} song_edit {
{fltk::Group} song_edit {open
xywh {0 0 640 445}
} {
{fltk::Group} {} {open
@ -96,9 +96,12 @@ o->label_scale=4;}
class Timeline
}
}
{fltk::ScrollGroup} song_scroll {
{fltk::ScrollGroup} song_scroll {open selected
xywh {255 15 385 430} resizable
extra_code {o->type(fltk::ScrollGroup::BOTH_ALWAYS);}
extra_code {\#include <fltk/ScrollGroup.h>
\#include "customscroll.h"
o->type(fltk::ScrollGroup::BOTH_ALWAYS);}
class CustomScroll
} {
{fltk::Widget} arranger {
label arranger
@ -233,7 +236,7 @@ ui->event_edit->redraw();}
}
}
}
{fltk::Group} {} {open
{fltk::Group} {} {
xywh {0 445 640 35} box UP_BOX
} {
{fltk::Button} play_button {
@ -373,7 +376,7 @@ ui->action_window->show();}
}
}
{fltk::Window} config_window {
label controls open
label controls
xywh {589 130 320 285} hide resizable
} {
{fltk::TabGroup} {} {open
@ -467,7 +470,7 @@ ui->bpm_output->value(o->value());}
}
}
{fltk::Choice} menu_rob {
label {record outside block} selected
label {record outside block}
xywh {5 240 160 25}
} {
{fltk::Item} {} {

View File

@ -11,6 +11,7 @@
#include "trackinfo.h"
#include <fltk/Button.h>
#include <fltk/ScrollGroup.h>
#include "customscroll.h"
#include "arranger.h"
#include "timeline.h"
#include "pianoroll.h"
@ -47,7 +48,7 @@ private:
static void cb_(fltk::Button*, void*);
public:
Timeline *song_timeline;
fltk::ScrollGroup *song_scroll;
CustomScroll *song_scroll;
Arranger *arranger;
fltk::Group *pattern_edit;
Timeline *pattern_timeline;