diff options
author | Vasily_Makarov <danilka.pro@gmail.com> | 2012-01-30 20:53:21 +0400 |
---|---|---|
committer | Vasily_Makarov <danilka.pro@gmail.com> | 2012-01-30 20:53:21 +0400 |
commit | dfee2a915a49e479345add234e453a423881d12e (patch) | |
tree | ba62963db8b8ecc1b3c43b01be9c6fe1a3171e90 /saedit | |
parent | d11287c58f26792828d46e2c21d4bb42b2c7981a (diff) | |
download | evol-tools-dfee2a915a49e479345add234e453a423881d12e.tar.gz evol-tools-dfee2a915a49e479345add234e453a423881d12e.tar.bz2 evol-tools-dfee2a915a49e479345add234e453a423881d12e.tar.xz evol-tools-dfee2a915a49e479345add234e453a423881d12e.zip |
Correcting drawing at main DrawingArea
Diffstat (limited to 'saedit')
-rw-r--r-- | saedit/interface.ui | 2 | ||||
-rw-r--r-- | saedit/main.c | 9 | ||||
-rw-r--r-- | saedit/main.h | 2 |
3 files changed, 5 insertions, 8 deletions
diff --git a/saedit/interface.ui b/saedit/interface.ui index 82ed481..69c52fd 100644 --- a/saedit/interface.ui +++ b/saedit/interface.ui @@ -606,7 +606,7 @@ Reid Yaro <reidyaro@gmail.com></property> <property name="height_request">120</property> <property name="visible">True</property> <property name="can_focus">False</property> - <signal name="event" handler="darea_expose_event" swapped="no"/> + <signal name="draw" handler="darea_draw_event" swapped="no"/> </object> <packing> <property name="resize">True</property> diff --git a/saedit/main.c b/saedit/main.c index 62e07c3..a87850f 100644 --- a/saedit/main.c +++ b/saedit/main.c @@ -45,19 +45,17 @@ cairo_surface_t *get_grid_surface(int w, int h) { return surface; } -gboolean darea_expose_event(GtkWidget *widget, GdkEvent *event, SAEInfo *sae_info) { - if (!(event->type == GDK_EXPOSE || event->type == GDK_DAMAGE)) return FALSE; +gboolean darea_draw_event(GtkWidget *widget, cairo_t *cr, SAEInfo *sae_info) { + if (sae_info == NULL) sae_info = gen_sae_info; int width = gtk_widget_get_allocated_width(widget), height = gtk_widget_get_allocated_height(widget); - printf("W and H: %d %d\n", width, height); - int w = 3, h = 3; - cairo_t *cr = gdk_cairo_create(gtk_widget_get_parent_window(widget)); + //cairo_t *cr = gdk_cairo_create(gtk_widget_get_parent_window(widget)); cairo_surface_t *surface = get_grid_surface(w, h); cairo_set_source_surface(cr, surface, width/2 - GRID_SIZE * (w + 2) * 0.5, height/2 - GRID_SIZE * (h + 2) * 0.5); @@ -79,7 +77,6 @@ gboolean darea_expose_event(GtkWidget *widget, GdkEvent *event, SAEInfo *sae_inf height/2 +GRID_SIZE/2 - sae_info->imageset->height + sae_info->offsetY + sae_info->sprite->offsetY + sae_info->imageset->offsetY); cairo_paint(cr); - cairo_destroy(cr); cairo_surface_destroy(surface); return FALSE; } diff --git a/saedit/main.h b/saedit/main.h index ff3eb4a..059e091 100644 --- a/saedit/main.h +++ b/saedit/main.h @@ -59,7 +59,7 @@ Keys *config; //Cairo functions cairo_surface_t *get_grid_surface(int w, int h); -gboolean darea_expose_event(GtkWidget *widget, GdkEvent *event, SAEInfo *sae_info); +gboolean darea_draw_event(GtkWidget *widget, cairo_t *cr, SAEInfo *sae_info); //String functions (common) gchar *markup_bold(gchar *str); |