[goffice] Don't use unexisting "deactivate" signal.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Don't use unexisting "deactivate" signal.
- Date: Thu, 4 Aug 2011 16:24:04 +0000 (UTC)
commit 95d9119ebd489352c1691b3ce39330aa3c657df6
Author: Jean Brefort <jean brefort normalesup org>
Date: Thu Aug 4 18:28:03 2011 +0200
Don't use unexisting "deactivate" signal.
ChangeLog | 10 ++++++++++
goffice/canvas/goc-group.c | 20 ++++++++++++++++++++
goffice/canvas/goc-group.h | 3 +++
goffice/gtk/go-optionmenu.c | 20 +++-----------------
4 files changed, 36 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2613e60..3f41d04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-08-04 Jean Brefort <jean brefort normalesup org>
+ * goffice/canvas/goc-group.c (goc_group_update_bounds),
+ (goc_group_draw_region), (goc_group_distance),
+ (goc_group_cairo_transform), (goc_group_set_clip_path): start support for
+ clipping at the GocGroup level.
+ * goffice/canvas/goc-group.h:
+ * goffice/gtk/go-optionmenu.c (handle_menu_signals),
+ (go_option_menu_set_menu): don't use an unexisting sgnal.
+
+2011-08-04 Jean Brefort <jean brefort normalesup org>
+
* goffice/data/go-data-impl.h: fix get_markup method declaration.
* goffice/graph/gog-renderer.c (gog_renderer_draw_text),
(gog_renderer_get_text_OBR): removed obsolete variables.
diff --git a/goffice/canvas/goc-group.c b/goffice/canvas/goc-group.c
index 83540d6..f0f57d4 100644
--- a/goffice/canvas/goc-group.c
+++ b/goffice/canvas/goc-group.c
@@ -110,6 +110,8 @@ goc_group_update_bounds (GocItem *item)
item->x1 += group->x;
item->y1 += group->y;
}
+ if (group->clip_path) {
+ }
}
static gboolean
@@ -122,6 +124,12 @@ goc_group_draw_region (GocItem const *item, cairo_t *cr,
if (!l)
return TRUE;
cairo_save (cr);
+ if (group->clip_path) {
+ cairo_translate (cr, group->x , group->y);
+ cairo_set_fill_rule (cr, group->clip_rule);
+ go_path_to_cairo (group->clip_path, GO_PATH_DIRECTION_FORWARD, cr);
+ cairo_clip (cr);
+ }
x0 -= group->x;
y0 -= group->y;
x1 -= group->x;
@@ -172,6 +180,9 @@ goc_group_distance (GocItem *item, double x, double y, GocItem **near_item)
if (result == 0.)
break;
}
+ // check if the click is not outside the clipping region
+ if (group->clip_path) {
+ }
return result;
}
@@ -440,3 +451,12 @@ goc_group_cairo_transform (GocGroup const *group, cairo_t *cr, double x, double
cairo_translate (cr, x - canvas->scroll_x1, y - canvas->scroll_y1);
}
}
+
+void
+goc_group_set_clip_path (GocGroup *group, GOPath *clip_path, cairo_fill_rule_t clip_rule)
+{
+ g_return_if_fail (GOC_IS_GROUP (group));
+ group->clip_path = clip_path;
+ group->clip_rule = clip_rule;
+ goc_item_bounds_changed (GOC_ITEM (group));
+}
diff --git a/goffice/canvas/goc-group.h b/goffice/canvas/goc-group.h
index 49416f0..c1fc5a7 100644
--- a/goffice/canvas/goc-group.h
+++ b/goffice/canvas/goc-group.h
@@ -32,6 +32,8 @@ struct _GocGroup {
double x, y; /* group offset */
GList *children;
+ GOPath *clip_path;
+ cairo_fill_rule_t clip_rule;
};
typedef struct _GocGroupClass GocGroupClass;
@@ -53,6 +55,7 @@ void goc_group_remove_child (GocGroup *parent, GocItem *item);
void goc_group_adjust_bounds (GocGroup const *group, double *x0, double *y0, double *x1, double *y1);
void goc_group_adjust_coords (GocGroup const *group, double *x, double *y);
void goc_group_cairo_transform (GocGroup const *group, cairo_t *cr, double x, double y);
+void goc_group_set_clip_path (GocGroup *group, GOPath *clip_path, cairo_fill_rule_t clip_rule);
G_END_DECLS
diff --git a/goffice/gtk/go-optionmenu.c b/goffice/gtk/go-optionmenu.c
index ad884db..081d176 100644
--- a/goffice/gtk/go-optionmenu.c
+++ b/goffice/gtk/go-optionmenu.c
@@ -220,15 +220,6 @@ cb_select (GtkMenuItem *item, GOOptionMenu *option_menu)
option_menu->active = TRUE;
}
-
-static void
-cb_unselect (GtkMenuItem *item, GOOptionMenu *option_menu)
-{
- go_option_menu_select_item (option_menu, item);
- g_signal_emit (option_menu, signals[CHANGED], 0);
- option_menu->active = FALSE;
-}
-
static void
handle_menu_signals (GOOptionMenu *option_menu, gboolean connect)
{
@@ -246,19 +237,13 @@ handle_menu_signals (GOOptionMenu *option_menu, gboolean connect)
if (sub)
children = g_list_concat (children,
gtk_container_get_children (GTK_CONTAINER (sub)));
- else if (connect) {
+ else if (connect)
g_signal_connect (child, "activate",
G_CALLBACK (cb_select),
option_menu);
- g_signal_connect (child, "deactivate",
- G_CALLBACK (cb_unselect),
- option_menu);
- } else {
+ else
g_signal_handlers_disconnect_by_func
(child, G_CALLBACK (cb_select), option_menu);
- g_signal_handlers_disconnect_by_func
- (child, G_CALLBACK (cb_unselect), option_menu);
- }
}
}
@@ -282,6 +267,7 @@ go_option_menu_set_menu (GOOptionMenu *option_menu,
gtk_menu_shell_cancel (option_menu->menu);
handle_menu_signals (option_menu, FALSE);
+ option_menu->active = FALSE;
gtk_menu_detach (GTK_MENU (option_menu->menu));
g_object_unref (option_menu->menu);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]