Added DragBar widget to replace horizontal thumbwheels.
This commit is contained in:
parent
46b0858b17
commit
f1b2cb179c
16
BUGS
16
BUGS
|
@ -6,7 +6,6 @@ recording makes undo semi useless
|
|||
missing graphics
|
||||
undo is buggy at least when using layers
|
||||
export midi does not include some important meta events
|
||||
track settings need readjustment
|
||||
paste is missing
|
||||
quantize is missing
|
||||
hand updates need to be regularized
|
||||
|
@ -14,6 +13,19 @@ channel 10 bank 127 bug
|
|||
undo block creation from inside pattern editor probably leads to problems
|
||||
|
||||
backend should send init/stop events on all present channels, not all tracks
|
||||
backend perhaps shouldnt send tons of messages at time zero
|
||||
|
||||
end of frame sequencing bug - unknown cause
|
||||
out of order dispatch bug - sequencer needs to sort dispatched events
|
||||
|
||||
some track settings are not saved or restored (one or the other)
|
||||
|
||||
remembered scroll position doesnt seems to work after some block ops
|
||||
|
||||
track modules gui for prog, bank, etc needs to be changed
|
||||
bank needs 'none' option
|
||||
|
||||
paste does not fully work
|
||||
|
||||
undo and redo should reset the select flag
|
||||
|
||||
|
||||
|
|
|
@ -13,4 +13,4 @@ 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 \
|
||||
theme.cpp theme.h
|
||||
theme.cpp theme.h dragbar.cpp dragbar.h
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
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 <fltk/Widget.h>
|
||||
#include <fltk/Group.h>
|
||||
#include <fltk/draw.h>
|
||||
#include <fltk/events.h>
|
||||
|
||||
#include "dragbar.h"
|
||||
|
||||
|
||||
DragBar::DragBar(int x, int y, int w, int h, const char* label) :
|
||||
fltk::Widget(x, y, w, h, label) {
|
||||
|
||||
cached_flag;
|
||||
|
||||
}
|
||||
|
||||
int DragBar::handle(int event){
|
||||
int X = fltk::event_x();
|
||||
switch(event){
|
||||
case fltk::PUSH:
|
||||
orig_x = X;
|
||||
return 1;
|
||||
case fltk::DRAG:
|
||||
val = last_val - (X - orig_x);
|
||||
if(val < 0){val=0;}
|
||||
if(val != last_val){
|
||||
redraw();
|
||||
do_callback();
|
||||
}
|
||||
return 1;
|
||||
case fltk::RELEASE:
|
||||
last_val = val;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DragBar::draw(){
|
||||
draw_box();
|
||||
|
||||
fltk::push_clip(2,2,w()-4,h()-4);
|
||||
|
||||
fltk::setcolor(fltk::GRAY60);
|
||||
fltk::fillrect(2,2,w()-4,h()-4);
|
||||
|
||||
if(!cached_flag){//draw first time
|
||||
for(int i=-val; i<w(); i+=6){
|
||||
if(i+10 > 0){
|
||||
fltk::setcolor(fltk::GRAY80);
|
||||
fltk::fillrect(i+5,4,3,1);
|
||||
fltk::fillrect(i+5,4,1,2);
|
||||
|
||||
fltk::setcolor(fltk::GRAY30);
|
||||
fltk::fillrect(i+5,6,3,1);
|
||||
fltk::fillrect(i+7,5,1,2);
|
||||
|
||||
fltk::setcolor(fltk::GRAY80);
|
||||
fltk::fillrect(i+5,4+5,3,1);
|
||||
fltk::fillrect(i+5,4+5,1,2);
|
||||
|
||||
fltk::setcolor(fltk::GRAY30);
|
||||
fltk::fillrect(i+5,6+5,3,1);
|
||||
fltk::fillrect(i+7,5+5,1,2);
|
||||
}
|
||||
}
|
||||
|
||||
int GX=x();
|
||||
int GY=y();
|
||||
fltk::Widget* p = parent();
|
||||
while(p){
|
||||
if(p->parent() != NULL){//the window
|
||||
GX+=p->x();
|
||||
GY+=p->y();
|
||||
}
|
||||
p = p->parent();
|
||||
}
|
||||
readimage(gfxbuf,fltk::RGB,fltk::Rectangle(GX+2,GY+2,102,h()-4));
|
||||
cached_flag=1;
|
||||
}
|
||||
else{
|
||||
for(int i=-val; i<w(); i+=102){
|
||||
if(i+200 > 0){
|
||||
drawimage(gfxbuf,fltk::RGB,fltk::Rectangle(2+i,2,102,h()-4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fltk::pop_clip();
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
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 dragbar_h
|
||||
#define dragbar_h
|
||||
|
||||
class DragBar : public fltk::Widget {
|
||||
int orig_x;
|
||||
int last_val;
|
||||
int val;
|
||||
int cached_flag;
|
||||
|
||||
unsigned char gfxbuf[102*11*3];
|
||||
|
||||
public:
|
||||
|
||||
int value(){return val;}
|
||||
void value(int zv){val=zv;}
|
||||
|
||||
DragBar(int x, int y, int w, int h, const char* label=0);
|
||||
int handle(int event);
|
||||
void draw();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -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>
|
||||
|
|
19
src/ui.cpp
19
src/ui.cpp
|
@ -75,10 +75,10 @@ void UI::cb_song_vscroll(fltk::Scrollbar* o, void* v) {
|
|||
((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_song_vscroll_i(o,v);
|
||||
}
|
||||
|
||||
inline void UI::cb_song_hscroll_i(fltk::ThumbWheel* o, void*) {
|
||||
ui->arranger->scrollTo((int)o->value(),ui->arranger->scrolly);
|
||||
inline void UI::cb_song_hscroll_i(DragBar* o, void*) {
|
||||
ui->arranger->scrollTo(o->value(), ui->arranger->scrolly);
|
||||
}
|
||||
void UI::cb_song_hscroll(fltk::ThumbWheel* o, void* v) {
|
||||
void UI::cb_song_hscroll(DragBar* o, void* v) {
|
||||
((UI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_song_hscroll_i(o,v);
|
||||
}
|
||||
|
||||
|
@ -91,10 +91,10 @@ void UI::cb_pattern_vscroll(fltk::Scrollbar* o, void* v) {
|
|||
((UI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_pattern_vscroll_i(o,v);
|
||||
}
|
||||
|
||||
inline void UI::cb_pattern_hscroll_i(fltk::ThumbWheel* o, void*) {
|
||||
ui->piano_roll->scrollTo((int)o->value(),ui->piano_roll->scrolly);
|
||||
inline void UI::cb_pattern_hscroll_i(DragBar* o, void*) {
|
||||
ui->piano_roll->scrollTo(o->value(),ui->piano_roll->scrolly);
|
||||
}
|
||||
void UI::cb_pattern_hscroll(fltk::ThumbWheel* o, void* v) {
|
||||
void UI::cb_pattern_hscroll(DragBar* o, void* v) {
|
||||
((UI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_pattern_hscroll_i(o,v);
|
||||
}
|
||||
|
||||
|
@ -683,9 +683,7 @@ UI::UI() {
|
|||
o->slider_size(60);
|
||||
o->callback((fltk::Callback*)cb_song_vscroll);
|
||||
}
|
||||
{fltk::ThumbWheel* o = song_hscroll = new fltk::ThumbWheel(0, 415, 370, 15);
|
||||
o->maximum(10000);
|
||||
o->step(10);
|
||||
{DragBar* o = song_hscroll = new DragBar(0, 415, 370, 15);
|
||||
o->callback((fltk::Callback*)cb_song_hscroll);
|
||||
}
|
||||
o->end();
|
||||
|
@ -717,8 +715,7 @@ UI::UI() {
|
|||
o->set_vertical();
|
||||
o->callback((fltk::Callback*)cb_pattern_vscroll);
|
||||
}
|
||||
{fltk::ThumbWheel* o = pattern_hscroll = new fltk::ThumbWheel(0, 340, 580, 15);
|
||||
o->step(10);
|
||||
{DragBar* o = pattern_hscroll = new DragBar(0, 340, 580, 15);
|
||||
o->callback((fltk::Callback*)cb_pattern_hscroll);
|
||||
}
|
||||
o->end();
|
||||
|
|
24
src/ui.fl
24
src/ui.fl
|
@ -72,10 +72,10 @@ save_config();} open
|
|||
o->size_range(640,455);
|
||||
o->resize(640,455);} visible
|
||||
} {
|
||||
{fltk::Group} {} {
|
||||
{fltk::Group} {} {open
|
||||
xywh {0 0 640 445} resizable
|
||||
} {
|
||||
{fltk::Group} song_edit {open
|
||||
{fltk::Group} song_edit {
|
||||
xywh {0 0 640 445}
|
||||
} {
|
||||
{fltk::Group} {} {open
|
||||
|
@ -136,13 +136,15 @@ int dummy = ui->arranger->scrollx;
|
|||
ui->arranger->scrollTo(dummy,target);}
|
||||
xywh {370 0 15 415} slider_size 60
|
||||
}
|
||||
{fltk::ThumbWheel} song_hscroll {
|
||||
callback {ui->arranger->scrollTo((int)o->value(),ui->arranger->scrolly);}
|
||||
xywh {0 415 370 15} maximum 10000 step 10
|
||||
{fltk::Widget} song_hscroll {
|
||||
callback {ui->arranger->scrollTo(o->value(), ui->arranger->scrolly);}
|
||||
xywh {0 415 370 15}
|
||||
extra_code {\#include "dragbar.h"}
|
||||
class DragBar
|
||||
}
|
||||
}
|
||||
}
|
||||
{fltk::Group} pattern_edit {
|
||||
{fltk::Group} pattern_edit {open
|
||||
xywh {0 0 640 445} hide
|
||||
} {
|
||||
{fltk::Group} {} {open
|
||||
|
@ -174,9 +176,11 @@ int dummy = ui->piano_roll->scrollx;
|
|||
ui->piano_roll->scrollTo(dummy,target);}
|
||||
xywh {580 0 15 340}
|
||||
}
|
||||
{fltk::ThumbWheel} pattern_hscroll {
|
||||
callback {ui->piano_roll->scrollTo((int)o->value(),ui->piano_roll->scrolly);}
|
||||
xywh {0 340 580 15} step 10
|
||||
{fltk::Widget} pattern_hscroll {
|
||||
callback {ui->piano_roll->scrollTo(o->value(),ui->piano_roll->scrolly);} selected
|
||||
xywh {0 340 580 15}
|
||||
extra_code {\#include "dragbar.h"}
|
||||
class DragBar
|
||||
}
|
||||
}
|
||||
{fltk::Group} {} {
|
||||
|
@ -471,7 +475,7 @@ if(filename){
|
|||
if(loadsmf(filename)<0){
|
||||
reset_song();
|
||||
}
|
||||
}} selected
|
||||
}}
|
||||
}
|
||||
{fltk::Item} {} {
|
||||
label export
|
||||
|
|
15
src/ui.h
15
src/ui.h
|
@ -12,7 +12,7 @@
|
|||
#include <fltk/Button.h>
|
||||
#include "arranger.h"
|
||||
#include <fltk/Scrollbar.h>
|
||||
#include <fltk/ThumbWheel.h>
|
||||
#include "dragbar.h"
|
||||
#include "timeline.h"
|
||||
#include "pianoroll.h"
|
||||
#include "eventedit.h"
|
||||
|
@ -28,6 +28,7 @@
|
|||
#include <fltk/TabGroup.h>
|
||||
#include <fltk/ValueInput.h>
|
||||
#include <fltk/ValueOutput.h>
|
||||
#include <fltk/ThumbWheel.h>
|
||||
#include <fltk/CheckButton.h>
|
||||
#include <fltk/Choice.h>
|
||||
#include <fltk/Input.h>
|
||||
|
@ -59,10 +60,10 @@ private:
|
|||
inline void cb_song_vscroll_i(fltk::Scrollbar*, void*);
|
||||
static void cb_song_vscroll(fltk::Scrollbar*, void*);
|
||||
public:
|
||||
fltk::ThumbWheel *song_hscroll;
|
||||
DragBar *song_hscroll;
|
||||
private:
|
||||
inline void cb_song_hscroll_i(fltk::ThumbWheel*, void*);
|
||||
static void cb_song_hscroll(fltk::ThumbWheel*, void*);
|
||||
inline void cb_song_hscroll_i(DragBar*, void*);
|
||||
static void cb_song_hscroll(DragBar*, void*);
|
||||
public:
|
||||
fltk::Group *pattern_edit;
|
||||
Timeline *pattern_timeline;
|
||||
|
@ -73,10 +74,10 @@ private:
|
|||
inline void cb_pattern_vscroll_i(fltk::Scrollbar*, void*);
|
||||
static void cb_pattern_vscroll(fltk::Scrollbar*, void*);
|
||||
public:
|
||||
fltk::ThumbWheel *pattern_hscroll;
|
||||
DragBar *pattern_hscroll;
|
||||
private:
|
||||
inline void cb_pattern_hscroll_i(fltk::ThumbWheel*, void*);
|
||||
static void cb_pattern_hscroll(fltk::ThumbWheel*, void*);
|
||||
inline void cb_pattern_hscroll_i(DragBar*, void*);
|
||||
static void cb_pattern_hscroll(DragBar*, void*);
|
||||
public:
|
||||
EventEdit *event_edit;
|
||||
EventMenu *event_menu;
|
||||
|
|
|
@ -812,17 +812,12 @@ void init_gui(){
|
|||
ui->song_vscroll->slider_size(60);
|
||||
ui->song_vscroll->value(0);
|
||||
|
||||
ui->song_hscroll->minimum(0);
|
||||
ui->song_hscroll->maximum(1<<20);
|
||||
|
||||
ui->pattern_timeline->edit_flag = 1;
|
||||
ui->pattern_timeline->zoom = 15;
|
||||
ui->pattern_vscroll->minimum(12*75);
|
||||
ui->pattern_vscroll->maximum(0);
|
||||
ui->pattern_vscroll->value(300);
|
||||
ui->pattern_vscroll->slider_size(50);
|
||||
ui->pattern_hscroll->minimum(0);
|
||||
ui->pattern_hscroll->maximum(1<<20);
|
||||
ui->pattern_hscroll->value(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue