| [ Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File ]
STR #2
Application: | FLTK Library |
Status: | 4 - Pending |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | Unclamped ROLLER with delta() |
Version: | 2.0-feature |
Created By: | dr_steve.users.sf |
Assigned To: | matt |
Fix Version: | Unassigned |
Update Notification: | |
Trouble Report Files:
[ Post File ]
Trouble Report Comments:
[ Post Text ]
|
#1 | dr_steve.users.sf 22:30 Apr 04, 2003 |
| (Sorry if this is partially duplicated. Stupid browser...)
I am relatively new to fltk, and am experimenting with it for some cross-platform OpenGL work. To control certain environments, I need an unclamped Fl_Roller with a delta() function.
1. Unclamped. Is not bounded by any range, will keep rolling endlessly in either direction. 2. Delta. In addition to value(), double delta() that returns the change since the last event.
This is relatively easy to implement by subclassing Fl_Roller and cut/pasting a little:
class Fl_Delta_Roller: public Fl_Roller { double delta_; int handle(int event); void handle_push() { delta_ = 0; Fl_Valuator::handle_push();} FL_EXPORT void handle_drag(double newvalue) { delta_ = newvalue - value(); Fl_Valuator::handle_drag(newvalue); }
public: Fl_Delta_Roller(int x, int y, int w, int h, char* l=NULL): Fl_Roller(x, y, w, h, l) {} double delta() { return delta_; } }; int Fl_Delta_Roller::handle(int event) { static int ipos; int newpos = horizontal() ? Fl::event_x() : Fl::event_y(); switch (event) { case FL_PUSH: handle_push(); ipos = newpos; return 1; case FL_DRAG: handle_drag(round(increment(previous_value (),newpos-ipos))); return 1; case FL_RELEASE: handle_release(); return 1; default: return 0; } }
The main changes are to eliminate the clamp() from the FL_DRAG event in handle(int event), and to put shells around handle_push and handle_drag to track individual events. Oh yeah, add delta() to return the delta_.
Can this be incorporated into an upcoming release (assuming fltk 2.0)? Add in a Roller/Valuator function clamping(bool) to allow the user to disable clamping and the bits for delta and there is no need for the separate Fl_Delta_Roller class. Likewise, other valuators (dial) may have use of this as well.
Thanks,
Steve | |
|
#2 | dr_steve.users.sf 22:31 Apr 04, 2003 |
| Blast, the tabs were destroyed and the code is highly difficult to read. I'm attaching the excerpt as a separate file. | |
|
#3 | mike 22:31 Apr 04, 2003 |
| Sounds like a useful addition, even for 1.1...
Will look into it... | |
|
#4 | darrenf.acres.com 17:42 May 15, 2003 |
| I would echo the usefullness of an unclamped roller. This would be useful in 3D where you want to continuously dolly through 360 degrees. | |
|
#5 | mike 18:18 May 25, 2003 |
| Reassigned to 2.0; no new features for 1.x... | |
|
#6 | fabien 04:45 Apr 12, 2006 |
| I did that uncampled feature as well with a complete graphical mixing table software implementation project I developed once.
Maybe I should have a look.
Mike, will I make your day today ? (i spent some time to understand what that meant in english) :) | |
|
#7 | dejan 08:37 Dec 15, 2007 |
| I think this can be added into the original Roller. Constructor would accept an additional argument clamped, which by default would be true. If false it will behave as DeltaRoller explained in this request. What You say? | |
|
#8 | mike 09:12 Dec 15, 2007 |
| The constructor is the wrong place - just make it a separate method to turn clamping on/off, which should probably be in the base class so all valuators can be clamped or unclamped... | |
[ Return to Bugs & Features | Post Text | Post File ]
|
| |