summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ganv/canvas-base.h14
-rw-r--r--src/canvas-base.c26
-rw-r--r--src/ganv-private.h10
-rw-r--r--src/item.c5
-rw-r--r--src/widget.c1
-rw-r--r--wscript1
6 files changed, 15 insertions, 42 deletions
diff --git a/ganv/canvas-base.h b/ganv/canvas-base.h
index 63633b0..8299132 100644
--- a/ganv/canvas-base.h
+++ b/ganv/canvas-base.h
@@ -30,9 +30,6 @@
G_BEGIN_DECLS
-/* "Small" value used by canvas stuff */
-#define GANV_CANVAS_BASE_EPSILON 1e-10
-
typedef struct _GanvCanvasBase GanvCanvasBase;
typedef struct _GanvCanvasBaseClass GanvCanvasBaseClass;
@@ -182,22 +179,11 @@ void ganv_canvas_base_scroll_to(GanvCanvasBase* canvas, int cx, int cy);
*/
void ganv_canvas_base_get_scroll_offsets(GanvCanvasBase* canvas, int* cx, int* cy);
-/* Requests that the canvas be repainted immediately instead of in the idle
- * loop.
- */
-void ganv_canvas_base_update_now(GanvCanvasBase* canvas);
-
/* Returns the item that is at the specified position in world coordinates, or
* NULL if no item is there.
*/
GanvItem* ganv_canvas_base_get_item_at(GanvCanvasBase* canvas, double x, double y);
-/* For use only by item type implementations. Request that the canvas
- * eventually redraw the specified region, specified in canvas pixel
- * coordinates. The region contains (x1, y1) but not (x2, y2).
- */
-void ganv_canvas_base_request_redraw(GanvCanvasBase* canvas, int x1, int y1, int x2, int y2);
-
/* Gets the affine transform that converts world coordinates into canvas pixel
* coordinates.
*/
diff --git a/src/canvas-base.c b/src/canvas-base.c
index 89a3e4e..9691bff 100644
--- a/src/canvas-base.c
+++ b/src/canvas-base.c
@@ -1365,7 +1365,7 @@ ganv_canvas_base_set_pixels_per_unit(GanvCanvasBase* canvas, double n)
int anchor_x, anchor_y;
g_return_if_fail(GANV_IS_CANVAS_BASE(canvas));
- g_return_if_fail(n > GANV_CANVAS_BASE_EPSILON);
+ g_return_if_fail(n > 1e-10);
if (canvas->center_scroll_region) {
anchor_x = GTK_WIDGET(canvas)->allocation.width / 2;
@@ -1445,30 +1445,6 @@ ganv_canvas_base_get_scroll_offsets(GanvCanvasBase* canvas, int* cx, int* cy)
}
/**
- * ganv_canvas_base_update_now:
- * @canvas: A canvas.
- *
- * Forces an immediate update and redraw of a canvas. If the canvas does not
- * have any pending update or redraw requests, then no action is taken. This is
- * typically only used by applications that need explicit control of when the
- * display is updated, like games. It is not needed by normal applications.
- */
-void
-ganv_canvas_base_update_now(GanvCanvasBase* canvas)
-{
- g_return_if_fail(GANV_IS_CANVAS_BASE(canvas));
-
- if (!(canvas->need_update || canvas->need_redraw)) {
- g_assert(canvas->idle_id == 0);
- g_assert(canvas->redraw_region == NULL);
- return;
- }
-
- remove_idle(canvas);
- do_update(canvas);
-}
-
-/**
* ganv_canvas_base_get_item_at:
* @canvas: A canvas.
* @x: X position in world coordinates.
diff --git a/src/ganv-private.h b/src/ganv-private.h
index d70f00c..227c46b 100644
--- a/src/ganv-private.h
+++ b/src/ganv-private.h
@@ -22,8 +22,9 @@ extern "C" {
#include <cairo.h>
-#include "ganv/types.h"
+#include "ganv/canvas-base.h"
#include "ganv/text.h"
+#include "ganv/types.h"
extern guint signal_moved;
@@ -217,6 +218,13 @@ ganv_canvas_base_request_update(GanvCanvasBase* canvas);
int
ganv_canvas_base_emit_event(GanvCanvasBase* canvas, GdkEvent* event);
+/* For use only by item type implementations. Request that the canvas
+ * eventually redraw the specified region, specified in canvas pixel
+ * coordinates. The region contains (x1, y1) but not (x2, y2).
+ */
+void
+ganv_canvas_base_request_redraw(GanvCanvasBase* canvas,
+ int x1, int y1, int x2, int y2);
/* Edge */
diff --git a/src/item.c b/src/item.c
index 6fcd110..05295bb 100644
--- a/src/item.c
+++ b/src/item.c
@@ -664,8 +664,9 @@ ganv_item_default_bounds(GanvItem* item, double* x1, double* y1, double* x2, dou
* @x2: Rightmost edge of the bounding box (return value).
* @y2: Lower edge of the bounding box (return value).
*
- * Queries the bounding box of a canvas item. The bounds are returned in the
- * coordinate system of the item's parent.
+ * Queries the bounding box of a canvas item. The bounding box may not be
+ * exactly tight, but the canvas items will do the best they can. The bounds
+ * are returned in the coordinate system of the item's parent.
**/
void
ganv_item_get_bounds(GanvItem* item, double* x1, double* y1, double* x2, double* y2)
diff --git a/src/widget.c b/src/widget.c
index d6c7a0b..afbf56c 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -21,6 +21,7 @@
#include <gtk/gtksignal.h>
+#include "ganv/canvas-base.h"
#include "ganv/widget.h"
#include "./gettext.h"
diff --git a/wscript b/wscript
index a9fb442..fca4701 100644
--- a/wscript
+++ b/wscript
@@ -88,6 +88,7 @@ ganv_source = [
'src/edge.c',
'src/ganv-marshal.c',
'src/group.c',
+ 'src/item.c',
'src/module.c',
'src/node.c',
'src/port.c',