plug-ins: more cleanup in nova and tile-small

This commit is contained in:
Michael Natterer 2010-09-09 01:54:00 +02:00
parent c5658da09c
commit 0ad9051bc3
2 changed files with 48 additions and 46 deletions

View File

@ -534,10 +534,11 @@ nova_center_preview_expose (GtkWidget *widget,
{ {
if (show_cursor) if (show_cursor)
{ {
GtkWidget *prvw = center->preview->area; cairo_t *cr;
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (prvw)); gint x, y;
gint width, height; gint width, height;
gint x, y;
cr = gdk_cairo_create (gtk_widget_get_window (center->preview->area));
gimp_preview_transform (center->preview, gimp_preview_transform (center->preview,
pvals.xcenter, pvals.ycenter, pvals.xcenter, pvals.ycenter,
@ -545,11 +546,11 @@ nova_center_preview_expose (GtkWidget *widget,
gimp_preview_get_size (center->preview, &width, &height); gimp_preview_get_size (center->preview, &width, &height);
cairo_move_to (cr, x + 0.5, 1); cairo_move_to (cr, x + 0.5, 0);
cairo_line_to (cr, x + 0.5, height - 1); cairo_line_to (cr, x + 0.5, height);
cairo_move_to (cr, 1, y + 0.5); cairo_move_to (cr, 0, y + 0.5);
cairo_line_to (cr, width - 1, y + 0.5); cairo_line_to (cr, width, y + 0.5);
cairo_set_line_width (cr, 3.0); cairo_set_line_width (cr, 3.0);
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.6); cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.6);

View File

@ -97,28 +97,35 @@ static gboolean tileit_dialog (void);
static void tileit_scale_update (GtkAdjustment *adjustment, static void tileit_scale_update (GtkAdjustment *adjustment,
gpointer data); gpointer data);
static void tileit_exp_update (GtkWidget *widget, gpointer value); static void tileit_exp_update (GtkWidget *widget,
static void tileit_exp_update_f (GtkWidget *widget, gpointer value); gpointer value);
static void tileit_exp_update_f (GtkWidget *widget,
gpointer value);
static void tileit_reset (GtkWidget *widget, static void tileit_reset (GtkWidget *widget,
gpointer value); gpointer value);
static void tileit_radio_update (GtkWidget *widget, static void tileit_radio_update (GtkWidget *widget,
gpointer data); gpointer data);
static void tileit_hvtoggle_update (GtkWidget *widget, static void tileit_hvtoggle_update (GtkWidget *widget,
gpointer data); gpointer data);
static void do_tiles (void); static void do_tiles (void);
static gint tiles_xy (gint width, gint height,gint x,gint y,gint *nx,gint *ny); static gint tiles_xy (gint width,
static void all_update (void); gint height,
static void alt_update (void); gint x,
static void explict_update (gboolean); gint y,
gint *nx,
gint *ny);
static void all_update (void);
static void alt_update (void);
static void explicit_update (gboolean);
static void dialog_update_preview (void); static void dialog_update_preview (void);
static void cache_preview (void); static void cache_preview (void);
static gint tileit_preview_expose (GtkWidget *widget, static gboolean tileit_preview_expose (GtkWidget *widget,
GdkEvent *event); GdkEvent *event);
static gint tileit_preview_events (GtkWidget *widget, static gboolean tileit_preview_events (GtkWidget *widget,
GdkEvent *event); GdkEvent *event);
const GimpPlugInInfo PLUG_IN_INFO = const GimpPlugInInfo PLUG_IN_INFO =
@ -136,12 +143,12 @@ static TileItVals itvals =
}; };
/* Structures for call backs... */ /* Structures for call backs... */
/* The "explict tile" & family */ /* The "explicit tile" & family */
typedef enum typedef enum
{ {
ALL, ALL,
ALT, ALT,
EXPLICT EXPLICIT
} AppliedTo; } AppliedTo;
typedef struct typedef struct
@ -541,7 +548,7 @@ tileit_dialog (void)
g_object_set_data (G_OBJECT (label), "set_sensitive", spinbutton); g_object_set_data (G_OBJECT (label), "set_sensitive", spinbutton);
g_object_set_data (G_OBJECT (toggle), "gimp-item-data", g_object_set_data (G_OBJECT (toggle), "gimp-item-data",
GINT_TO_POINTER (EXPLICT)); GINT_TO_POINTER (EXPLICIT));
g_signal_connect (toggle, "toggled", g_signal_connect (toggle, "toggled",
G_CALLBACK (tileit_radio_update), G_CALLBACK (tileit_radio_update),
@ -627,17 +634,18 @@ tileit_hvtoggle_update (GtkWidget *widget,
alt_update (); alt_update ();
break; break;
case EXPLICT: case EXPLICIT:
break; break;
} }
dialog_update_preview (); dialog_update_preview ();
} }
static void static gboolean
draw_explict_sel (void) tileit_preview_expose (GtkWidget *widget,
GdkEvent *event)
{ {
if (exp_call.type == EXPLICT) if (exp_call.type == EXPLICIT)
{ {
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (tint.preview)); cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (tint.preview));
gdouble width = (gdouble) preview_width / (gdouble) itvals.numtiles; gdouble width = (gdouble) preview_width / (gdouble) itvals.numtiles;
@ -659,13 +667,6 @@ draw_explict_sel (void)
cairo_destroy (cr); cairo_destroy (cr);
} }
}
static gint
tileit_preview_expose (GtkWidget *widget,
GdkEvent *event)
{
draw_explict_sel ();
return FALSE; return FALSE;
} }
@ -743,7 +744,7 @@ tileit_preview_events (GtkWidget *widget,
} }
static void static void
explict_update (gboolean settile) explicit_update (gboolean settile)
{ {
gint x,y; gint x,y;
@ -813,8 +814,8 @@ tileit_radio_update (GtkWidget *widget,
alt_update (); alt_update ();
break; break;
case EXPLICT: case EXPLICIT:
explict_update (FALSE); explicit_update (FALSE);
break; break;
} }
@ -871,7 +872,7 @@ static void
tileit_exp_update (GtkWidget *widget, tileit_exp_update (GtkWidget *widget,
gpointer applied) gpointer applied)
{ {
explict_update (TRUE); explicit_update (TRUE);
dialog_update_preview (); dialog_update_preview ();
} }
@ -879,7 +880,7 @@ static void
tileit_exp_update_f (GtkWidget *widget, tileit_exp_update_f (GtkWidget *widget,
gpointer applied) gpointer applied)
{ {
explict_update (FALSE); explicit_update (FALSE);
dialog_update_preview (); dialog_update_preview ();
} }