summaryrefslogtreecommitdiff
path: root/saedit
diff options
context:
space:
mode:
authorVasily_Makarov <danilka.pro@gmail.com>2012-01-30 20:31:21 +0400
committerVasily_Makarov <danilka.pro@gmail.com>2012-01-30 20:31:21 +0400
commitd11287c58f26792828d46e2c21d4bb42b2c7981a (patch)
treec3111ab7184eb908f455bc9530b2ce503c06ceb6 /saedit
parent52bc7fcc1a89355d51fe55ab160f9bcc2842fa3e (diff)
downloadevol-tools-d11287c58f26792828d46e2c21d4bb42b2c7981a.tar.gz
evol-tools-d11287c58f26792828d46e2c21d4bb42b2c7981a.tar.bz2
evol-tools-d11287c58f26792828d46e2c21d4bb42b2c7981a.tar.xz
evol-tools-d11287c58f26792828d46e2c21d4bb42b2c7981a.zip
Correcting event bug
Diffstat (limited to 'saedit')
-rw-r--r--saedit/interface.ui2
-rw-r--r--saedit/main.c16
-rw-r--r--saedit/main.h2
3 files changed, 12 insertions, 8 deletions
diff --git a/saedit/interface.ui b/saedit/interface.ui
index 59127fd..82ed481 100644
--- a/saedit/interface.ui
+++ b/saedit/interface.ui
@@ -606,7 +606,7 @@ Reid Yaro &lt;reidyaro@gmail.com&gt;</property>
<property name="height_request">120</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <signal name="expose-event" handler="darea_expose_event" swapped="no"/>
+ <signal name="event" handler="darea_expose_event" swapped="no"/>
</object>
<packing>
<property name="resize">True</property>
diff --git a/saedit/main.c b/saedit/main.c
index ccf91a0..62e07c3 100644
--- a/saedit/main.c
+++ b/saedit/main.c
@@ -45,13 +45,16 @@ cairo_surface_t *get_grid_surface(int w, int h) {
return surface;
}
-gboolean darea_expose_event(GtkWidget *widget, GdkEventExpose *event, SAEInfo *sae_info) {
+gboolean darea_expose_event(GtkWidget *widget, GdkEvent *event, SAEInfo *sae_info) {
+ if (!(event->type == GDK_EXPOSE || event->type == GDK_DAMAGE)) return FALSE;
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));
@@ -214,13 +217,13 @@ gboolean frame_image_button_press_event_callback(GtkWidget *widget, GdkEventButt
}
void open_menu_item_activate_callback(GtkMenuItem *menuitem, GtkFileChooserDialog *fcdialog) {
- gtk_dialog_run(fcdialog);
+ gtk_dialog_run(GTK_DIALOG(fcdialog));
}
//Dialogs
void show_about_dialog() {
- gtk_dialog_run(about_dialog);
+ gtk_dialog_run(GTK_DIALOG(about_dialog));
gtk_widget_hide(about_dialog);
}
@@ -229,7 +232,7 @@ void show_imageset_dialog() {
GtkWidget *dialog = gtk_dialog_new();
GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
gtk_window_set_title(GTK_WINDOW(dialog), _("Imageset preview"));
- gtk_window_set_transient_for(dialog, GTK_WINDOW(win));
+ gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(win));
int w = gen_sae_info->imageset->spriteset_width / gen_sae_info->imageset->width;
int h = gen_sae_info->imageset->spriteset_height / gen_sae_info->imageset->height;
@@ -241,10 +244,11 @@ void show_imageset_dialog() {
int x, y;
for (y = 0; y < h; y++) {
hbox = gtk_hbox_new(TRUE, 0);
- gtk_container_add(content_area, hbox);
+ gtk_container_add(GTK_CONTAINER(content_area), hbox);
for (x = 0; x < w; x++) {
+ int id = w * y + x;
event_box = gtk_event_box_new();
- g_signal_connect(G_OBJECT(event_box), "button-press-event", G_CALLBACK(frame_image_button_press_event_callback), w * y + x);
+ g_signal_connect(G_OBJECT(event_box), "button-press-event", G_CALLBACK(frame_image_button_press_event_callback), &id);
gtk_box_pack_start(GTK_BOX(hbox), event_box, TRUE, TRUE, 0);
image = gtk_image_new_from_pixbuf(get_sprite_by_index(w * y + x, gen_sae_info));
diff --git a/saedit/main.h b/saedit/main.h
index 3b6e519..ff3eb4a 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, GdkEventExpose *event, SAEInfo *sae_info);
+gboolean darea_expose_event(GtkWidget *widget, GdkEvent *event, SAEInfo *sae_info);
//String functions (common)
gchar *markup_bold(gchar *str);