22#ifndef CALF_CTL_CURVE_H
23#define CALF_CTL_CURVE_H
30#define CALF_TYPE_CURVE (calf_curve_get_type())
31#define CALF_CURVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_CURVE, CalfCurve))
32#define CALF_IS_CURVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_CURVE))
33#define CALF_CURVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_CURVE, CalfCurveClass))
34#define CALF_IS_CURVE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_CURVE))
42 typedef std::pair<float, float>
point;
67 for(
size_t i = 0;
i <
data.size();
i++)
68 g_message(
"Point %d: (%f, %f)", (
int)
i,
data[
i].first,
data[
i].second);
102 void clip(
int pt,
float &
x,
float &
y,
bool &hide);
GType calf_curve_get_type()
Return a GObject type for class CalfCurve.
Definition ctl_curve.cpp:335
void calf_curve_set_points(GtkWidget *widget, const CalfCurve::point_vector &src)
Set points and update the widget.
Definition ctl_curve.cpp:323
GtkWidget * calf_curve_new(unsigned int point_limit=-1)
Create a CalfCurve.
Definition ctl_curve.cpp:30
int y
Definition inflate.c:1588
register unsigned i
Definition inflate.c:1575
unsigned x[BMAX+1]
Definition inflate.c:1586
JSAMPIMAGE data
Definition jpeglib.h:945
Null implementation of EventSink.
Definition ctl_curve.h:58
virtual void curve_changed(CalfCurve *src, const point_vector &data)
Called when a point has been edited, added or removed.
Definition ctl_curve.h:59
virtual void clip(CalfCurve *src, int pt, float &x, float &y, bool &hide)
Called to clip/snap/otherwise adjust candidate point coordinates.
Definition ctl_curve.h:60
User callbacks for handling curve events.
Definition ctl_curve.h:48
virtual void curve_changed(CalfCurve *src, const point_vector &data)=0
Called when a point has been edited, added or removed.
virtual void clip(CalfCurve *src, int pt, float &x, float &y, bool &hide)=0
Called to clip/snap/otherwise adjust candidate point coordinates.
virtual ~EventSink()
Definition ctl_curve.h:53
Debug implementation of EventSink.
Definition ctl_curve.h:65
virtual void curve_changed(CalfCurve *src, const point_vector &data)
Called when a point has been edited, added or removed.
Definition ctl_curve.h:66
Definition ctl_curve.h:106
GtkWidgetClass parent_class
Definition ctl_curve.h:107
Definition ctl_curve.h:40
float y1
Definition ctl_curve.h:77
GdkCursor * arrow_cursor
Cached arrow (do not add point) cursor.
Definition ctl_curve.h:89
void log2phys(float &x, float &y)
Convert logical (mapping) to physical (screen) coordinates.
Definition ctl_curve.cpp:288
void phys2log(float &x, float &y)
Convert physical (screen) to logical (mapping) coordinates.
Definition ctl_curve.cpp:293
unsigned int point_limit
Maximum number of points.
Definition ctl_curve.h:91
point_vector * points
Array of points.
Definition ctl_curve.h:75
int cur_pt
Currently selected point (when dragging/adding), or -1 if none is selected.
Definition ctl_curve.h:79
void clip(int pt, float &x, float &y, bool &hide)
Definition ctl_curve.cpp:298
float x1
Definition ctl_curve.h:77
GdkCursor * hand_cursor
Cached hand (drag) cursor.
Definition ctl_curve.h:85
GtkWidget parent
Base class instance members.
Definition ctl_curve.h:73
float y0
Definition ctl_curve.h:77
bool hide_current
If currently selected point is a candidate for deletion (ie. outside of graph+margin range).
Definition ctl_curve.h:81
std::vector< point > point_vector
A collection of points.
Definition ctl_curve.h:44
GdkCursor * pencil_cursor
Cached pencil (add point) cursor.
Definition ctl_curve.h:87
EventSink * sink
Interface for notification.
Definition ctl_curve.h:83
std::pair< float, float > point
A point with floating point X and Y coordinates.
Definition ctl_curve.h:42
float x0
Coordinate ranges (in logical coordinates for top left and bottom right).
Definition ctl_curve.h:77