Use various GTK+ accessors instead of object->member

This commit is contained in:
Michael Natterer 2009-10-10 15:10:14 +02:00
parent 85274ea1f3
commit 06673f27e2
10 changed files with 78 additions and 59 deletions

View File

@ -839,24 +839,24 @@ flare_center_cursor_draw (FlareCenter *center)
{ {
if (center->cursor_drawn) if (center->cursor_drawn)
{ {
gdk_draw_line (prvw->window, gdk_draw_line (gtk_widget_get_window (prvw),
style->black_gc, style->black_gc,
center->oldx, 1, center->oldx, 1,
center->oldx, center->oldx,
height - 1); height - 1);
gdk_draw_line (prvw->window, gdk_draw_line (gtk_widget_get_window (prvw),
style->black_gc, style->black_gc,
1, center->oldy, 1, center->oldy,
width - 1, width - 1,
center->oldy); center->oldy);
} }
gdk_draw_line (prvw->window, gdk_draw_line (gtk_widget_get_window (prvw),
style->black_gc, style->black_gc,
center->curx, 1, center->curx, 1,
center->curx, center->curx,
height - 1); height - 1);
gdk_draw_line (prvw->window, gdk_draw_line (gtk_widget_get_window (prvw),
style->black_gc, style->black_gc,
1, center->cury, 1, center->cury,
width - 1, width - 1,

View File

@ -621,6 +621,6 @@ noisify_double_adjustment_update (GtkAdjustment *adjustment,
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
if (adjustment != GTK_ADJUSTMENT (noise_int.channel_adj[i])) if (adjustment != GTK_ADJUSTMENT (noise_int.channel_adj[i]))
gtk_adjustment_set_value (GTK_ADJUSTMENT (noise_int.channel_adj[i]), gtk_adjustment_set_value (GTK_ADJUSTMENT (noise_int.channel_adj[i]),
adjustment->value); gtk_adjustment_get_value (adjustment));
} }
} }

View File

@ -530,21 +530,21 @@ nova_center_cursor_draw (NovaCenter *center)
{ {
if (center->cursor_drawn) if (center->cursor_drawn)
{ {
gdk_draw_line (prvw->window, gdk_draw_line (gtk_widget_get_window (prvw),
style->black_gc, style->black_gc,
center->oldx, 1, center->oldx, center->oldx, 1, center->oldx,
height - 1); height - 1);
gdk_draw_line (prvw->window, gdk_draw_line (gtk_widget_get_window (prvw),
style->black_gc, style->black_gc,
1, center->oldy, 1, center->oldy,
width - 1, center->oldy); width - 1, center->oldy);
} }
gdk_draw_line (prvw->window, gdk_draw_line (gtk_widget_get_window (prvw),
style->black_gc, style->black_gc,
center->curx, 1, center->curx, center->curx, 1, center->curx,
height - 1); height - 1);
gdk_draw_line (prvw->window, gdk_draw_line (gtk_widget_get_window (prvw),
style->black_gc, style->black_gc,
1, center->cury, 1, center->cury,
width - 1, center->cury); width - 1, center->cury);

View File

@ -541,6 +541,7 @@ browser_dialog_new (void)
GtkTreeStore *tree_store; GtkTreeStore *tree_store;
GtkWidget *list_view; GtkWidget *list_view;
GtkWidget *tree_view; GtkWidget *tree_view;
GtkWidget *parent;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
GtkTreeSelection *selection; GtkTreeSelection *selection;
@ -713,8 +714,10 @@ browser_dialog_new (void)
gtk_widget_show (scrolled_window); gtk_widget_show (scrolled_window);
gtk_widget_show (notebook); gtk_widget_show (notebook);
gtk_widget_set_size_request (GIMP_BROWSER (browser->browser)->right_vbox->parent->parent, parent = gtk_widget_get_parent (GIMP_BROWSER (browser->browser)->right_vbox);
DBL_WIDTH - DBL_LIST_WIDTH, -1); parent = gtk_widget_get_parent (parent);
gtk_widget_set_size_request (parent, DBL_WIDTH - DBL_LIST_WIDTH, -1);
/* now build the list */ /* now build the list */
browser_search (GIMP_BROWSER (browser->browser), "", 0, browser); browser_search (GIMP_BROWSER (browser->browser), "", 0, browser);

View File

@ -559,7 +559,7 @@ smp_adj_lvl_in_max_upd_callback (GtkAdjustment *adjustment)
gint32 value; gint32 value;
gint upd_flags; gint upd_flags;
value = CLAMP ((adjustment->value), 1, 255); value = CLAMP ((gtk_adjustment_get_value (adjustment)), 1, 255);
if (value != g_values.lvl_in_max) if (value != g_values.lvl_in_max)
{ {
@ -580,7 +580,7 @@ smp_adj_lvl_in_min_upd_callback (GtkAdjustment *adjustment)
double value; double value;
gint upd_flags; gint upd_flags;
value = CLAMP ((adjustment->value), 0, 254); value = CLAMP ((gtk_adjustment_get_value (adjustment)), 0, 254);
if (value != g_values.lvl_in_min) if (value != g_values.lvl_in_min)
{ {
@ -600,7 +600,7 @@ smp_text_gamma_upd_callback (GtkAdjustment *adjustment)
{ {
double value; double value;
value = CLAMP ((adjustment->value), 0.1, 10.0); value = CLAMP ((gtk_adjustment_get_value (adjustment)), 0.1, 10.0);
if (value != g_values.lvl_in_gamma) if (value != g_values.lvl_in_gamma)
{ {
@ -615,7 +615,7 @@ smp_adj_lvl_out_max_upd_callback (GtkAdjustment *adjustment)
gint32 value; gint32 value;
gint upd_flags; gint upd_flags;
value = CLAMP ((adjustment->value), 1, 255); value = CLAMP ((gtk_adjustment_get_value (adjustment)), 1, 255);
if (value != g_values.lvl_out_max) if (value != g_values.lvl_out_max)
{ {
@ -636,7 +636,7 @@ smp_adj_lvl_out_min_upd_callback (GtkAdjustment *adjustment)
double value; double value;
gint upd_flags; gint upd_flags;
value = CLAMP ((adjustment->value), 0, 254); value = CLAMP ((gtk_adjustment_get_value (adjustment)), 0, 254);
if (value != g_values.lvl_out_min) if (value != g_values.lvl_out_min)
{ {
@ -1020,9 +1020,9 @@ levels_update (gint update)
GtkStyle *style = gtk_widget_get_style (g_di.in_lvl_drawarea); GtkStyle *style = gtk_widget_get_style (g_di.in_lvl_drawarea);
gdouble width, mid, tmp; gdouble width, mid, tmp;
levels_erase_slider (g_di.in_lvl_drawarea->window, g_di.slider_pos[0]); levels_erase_slider (gtk_widget_get_window (g_di.in_lvl_drawarea), g_di.slider_pos[0]);
levels_erase_slider (g_di.in_lvl_drawarea->window, g_di.slider_pos[1]); levels_erase_slider (gtk_widget_get_window (g_di.in_lvl_drawarea), g_di.slider_pos[1]);
levels_erase_slider (g_di.in_lvl_drawarea->window, g_di.slider_pos[2]); levels_erase_slider (gtk_widget_get_window (g_di.in_lvl_drawarea), g_di.slider_pos[2]);
g_di.slider_pos[0] = DA_WIDTH * ((double) g_values.lvl_in_min / 255.0); g_di.slider_pos[0] = DA_WIDTH * ((double) g_values.lvl_in_min / 255.0);
g_di.slider_pos[2] = DA_WIDTH * ((double) g_values.lvl_in_max / 255.0); g_di.slider_pos[2] = DA_WIDTH * ((double) g_values.lvl_in_max / 255.0);
@ -1032,15 +1032,15 @@ levels_update (gint update)
tmp = log10 (1.0 / g_values.lvl_in_gamma); tmp = log10 (1.0 / g_values.lvl_in_gamma);
g_di.slider_pos[1] = (int) (mid + width * tmp + 0.5); g_di.slider_pos[1] = (int) (mid + width * tmp + 0.5);
levels_draw_slider (g_di.in_lvl_drawarea->window, levels_draw_slider (gtk_widget_get_window (g_di.in_lvl_drawarea),
style->black_gc, style->black_gc,
style->dark_gc[GTK_STATE_NORMAL], style->dark_gc[GTK_STATE_NORMAL],
g_di.slider_pos[1]); g_di.slider_pos[1]);
levels_draw_slider (g_di.in_lvl_drawarea->window, levels_draw_slider (gtk_widget_get_window (g_di.in_lvl_drawarea),
style->black_gc, style->black_gc,
style->black_gc, style->black_gc,
g_di.slider_pos[0]); g_di.slider_pos[0]);
levels_draw_slider (g_di.in_lvl_drawarea->window, levels_draw_slider (gtk_widget_get_window (g_di.in_lvl_drawarea),
style->black_gc, style->black_gc,
style->white_gc, style->white_gc,
g_di.slider_pos[2]); g_di.slider_pos[2]);
@ -1050,17 +1050,17 @@ levels_update (gint update)
{ {
GtkStyle *style = gtk_widget_get_style (g_di.sample_drawarea); GtkStyle *style = gtk_widget_get_style (g_di.sample_drawarea);
levels_erase_slider (g_di.sample_drawarea->window, g_di.slider_pos[3]); levels_erase_slider (gtk_widget_get_window (g_di.sample_drawarea), g_di.slider_pos[3]);
levels_erase_slider (g_di.sample_drawarea->window, g_di.slider_pos[4]); levels_erase_slider (gtk_widget_get_window (g_di.sample_drawarea), g_di.slider_pos[4]);
g_di.slider_pos[3] = DA_WIDTH * ((double) g_values.lvl_out_min / 255.0); g_di.slider_pos[3] = DA_WIDTH * ((double) g_values.lvl_out_min / 255.0);
g_di.slider_pos[4] = DA_WIDTH * ((double) g_values.lvl_out_max / 255.0); g_di.slider_pos[4] = DA_WIDTH * ((double) g_values.lvl_out_max / 255.0);
levels_draw_slider (g_di.sample_drawarea->window, levels_draw_slider (gtk_widget_get_window (g_di.sample_drawarea),
style->black_gc, style->black_gc,
style->black_gc, style->black_gc,
g_di.slider_pos[3]); g_di.slider_pos[3]);
levels_draw_slider (g_di.sample_drawarea->window, levels_draw_slider (gtk_widget_get_window (g_di.sample_drawarea),
style->black_gc, style->black_gc,
style->black_gc, style->black_gc,
g_di.slider_pos[4]); g_di.slider_pos[4]);

View File

@ -566,7 +566,7 @@ alpha_scale_cb (GtkAdjustment *adj,
color_button = GIMP_COLOR_BUTTON (data); color_button = GIMP_COLOR_BUTTON (data);
gimp_color_button_get_color (GIMP_COLOR_BUTTON (color_button), &color); gimp_color_button_get_color (GIMP_COLOR_BUTTON (color_button), &color);
gimp_rgb_set_alpha (&color, adj->value); gimp_rgb_set_alpha (&color, gtk_adjustment_get_value (adj));
gimp_color_button_set_color (GIMP_COLOR_BUTTON (color_button), &color); gimp_color_button_set_color (GIMP_COLOR_BUTTON (color_button), &color);
} }

View File

@ -2293,7 +2293,7 @@ expose_event (GtkWidget *widget,
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
guchar *data = img + event->area.y * 3 * PREVIEWSIZE + event->area.x * 3; guchar *data = img + event->area.y * 3 * PREVIEWSIZE + event->area.x * 3;
gdk_draw_rgb_image_dithalign (widget->window, gdk_draw_rgb_image_dithalign (gtk_widget_get_window (widget),
style->white_gc, style->white_gc,
event->area.x, event->area.y, event->area.x, event->area.y,
event->area.width, event->area.height, event->area.width, event->area.height,
@ -2365,25 +2365,25 @@ getscales (GtkWidget *widget,
if (!t) if (!t)
return; return;
t->amount = GTK_ADJUSTMENT (amountscale)->value; t->amount = gtk_adjustment_get_value (GTK_ADJUSTMENT (amountscale));
t->exp = GTK_ADJUSTMENT (expscale)->value; t->exp = gtk_adjustment_get_value (GTK_ADJUSTMENT (expscale));
f = GTK_ADJUSTMENT (turbulencescale)->value; f = gtk_adjustment_get_value (GTK_ADJUSTMENT (turbulencescale));
vset (&t->turbulence, f, f, f); vset (&t->turbulence, f, f, f);
t->oscale = GTK_ADJUSTMENT (scalescale)->value; t->oscale = gtk_adjustment_get_value (GTK_ADJUSTMENT (scalescale));
t->scale.x = GTK_ADJUSTMENT (scalexscale)->value; t->scale.x = gtk_adjustment_get_value (GTK_ADJUSTMENT (scalexscale));
t->scale.y = GTK_ADJUSTMENT (scaleyscale)->value; t->scale.y = gtk_adjustment_get_value (GTK_ADJUSTMENT (scaleyscale));
t->scale.z = GTK_ADJUSTMENT (scalezscale)->value; t->scale.z = gtk_adjustment_get_value (GTK_ADJUSTMENT (scalezscale));
t->rotate.x = GTK_ADJUSTMENT (rotxscale)->value; t->rotate.x = gtk_adjustment_get_value (GTK_ADJUSTMENT (rotxscale));
t->rotate.y = GTK_ADJUSTMENT (rotyscale)->value; t->rotate.y = gtk_adjustment_get_value (GTK_ADJUSTMENT (rotyscale));
t->rotate.z = GTK_ADJUSTMENT (rotzscale)->value; t->rotate.z = gtk_adjustment_get_value (GTK_ADJUSTMENT (rotzscale));
t->translate.x = GTK_ADJUSTMENT (posxscale)->value; t->translate.x = gtk_adjustment_get_value (GTK_ADJUSTMENT (posxscale));
t->translate.y = GTK_ADJUSTMENT (posyscale)->value; t->translate.y = gtk_adjustment_get_value (GTK_ADJUSTMENT (posyscale));
t->translate.z = GTK_ADJUSTMENT (poszscale)->value; t->translate.z = gtk_adjustment_get_value (GTK_ADJUSTMENT (poszscale));
restartrender (); restartrender ();
} }

View File

@ -180,9 +180,9 @@ static struct
static void static void
tile_width_adj_changed (GtkAdjustment *adj) tile_width_adj_changed (GtkAdjustment *adj)
{ {
if (p.params.tile_width != (gint)adj->value) if (p.params.tile_width != (gint)gtk_adjustment_get_value (adj))
{ {
p.params.tile_width = adj->value; p.params.tile_width = gtk_adjustment_get_value (adj);
p.params.division_x = p.drawable->width / p.params.tile_width; p.params.division_x = p.drawable->width / p.params.tile_width;
gtk_adjustment_set_value (GTK_ADJUSTMENT (w.division_x_adj), gtk_adjustment_set_value (GTK_ADJUSTMENT (w.division_x_adj),
p.params.division_x); p.params.division_x);
@ -192,9 +192,9 @@ tile_width_adj_changed (GtkAdjustment *adj)
static void static void
tile_height_adj_changed (GtkAdjustment *adj) tile_height_adj_changed (GtkAdjustment *adj)
{ {
if (p.params.tile_height != (gint)adj->value) if (p.params.tile_height != (gint)gtk_adjustment_get_value (adj))
{ {
p.params.tile_height = adj->value; p.params.tile_height = gtk_adjustment_get_value (adj);
p.params.division_y = p.drawable->height / p.params.tile_height; p.params.division_y = p.drawable->height / p.params.tile_height;
gtk_adjustment_set_value (GTK_ADJUSTMENT (w.division_y_adj), gtk_adjustment_set_value (GTK_ADJUSTMENT (w.division_y_adj),
p.params.division_y); p.params.division_y);
@ -204,9 +204,9 @@ tile_height_adj_changed (GtkAdjustment *adj)
static void static void
division_x_adj_changed (GtkAdjustment *adj) division_x_adj_changed (GtkAdjustment *adj)
{ {
if (p.params.division_x != (gint) adj->value) if (p.params.division_x != (gint) gtk_adjustment_get_value (adj))
{ {
p.params.division_x = adj->value; p.params.division_x = gtk_adjustment_get_value (adj);
p.params.tile_width = p.drawable->width / p.params.division_x; p.params.tile_width = p.drawable->width / p.params.division_x;
gtk_adjustment_set_value (GTK_ADJUSTMENT (w.tile_width_adj), gtk_adjustment_set_value (GTK_ADJUSTMENT (w.tile_width_adj),
p.params.tile_width); p.params.tile_width);
@ -216,9 +216,9 @@ division_x_adj_changed (GtkAdjustment *adj)
static void static void
division_y_adj_changed (GtkAdjustment *adj) division_y_adj_changed (GtkAdjustment *adj)
{ {
if (p.params.division_y != (gint)adj->value) if (p.params.division_y != (gint)gtk_adjustment_get_value (adj))
{ {
p.params.division_y = adj->value; p.params.division_y = gtk_adjustment_get_value (adj);
p.params.tile_height = p.drawable->height / p.params.division_y; p.params.tile_height = p.drawable->height / p.params.division_y;
gtk_adjustment_set_value (GTK_ADJUSTMENT (w.tile_height_adj), gtk_adjustment_set_value (GTK_ADJUSTMENT (w.tile_height_adj),
p.params.tile_height); p.params.tile_height);

View File

@ -649,21 +649,21 @@ draw_explict_sel (void)
gdk_gc_set_function (style->black_gc, GDK_INVERT); gdk_gc_set_function (style->black_gc, GDK_INVERT);
gdk_draw_rectangle (tint.preview->window, gdk_draw_rectangle (gtk_widget_get_window (tint.preview),
style->black_gc, style->black_gc,
0, 0,
(gint) x, (gint) x,
(gint) y, (gint) y,
(gint) width, (gint) width,
(gint) height); (gint) height);
gdk_draw_rectangle (tint.preview->window, gdk_draw_rectangle (gtk_widget_get_window (tint.preview),
style->black_gc, style->black_gc,
0, 0,
(gint) x + 1, (gint) x + 1,
(gint) y + 1, (gint) y + 1,
(gint) width - 2, (gint) width - 2,
(gint) height - 2); (gint) height - 2);
gdk_draw_rectangle (tint.preview->window, gdk_draw_rectangle (gtk_widget_get_window (tint.preview),
style->black_gc, style->black_gc,
0, 0,
(gint) x + 2, (gint) x + 2,
@ -763,12 +763,12 @@ explict_update (gboolean settile)
gint x,y; gint x,y;
/* Make sure bounds are OK */ /* Make sure bounds are OK */
y = ROUND (GTK_ADJUSTMENT (exp_call.r_adj)->value); y = ROUND (gtk_adjustment_get_value (GTK_ADJUSTMENT (exp_call.r_adj)));
if (y > itvals.numtiles || y <= 0) if (y > itvals.numtiles || y <= 0)
{ {
y = itvals.numtiles; y = itvals.numtiles;
} }
x = ROUND (GTK_ADJUSTMENT (exp_call.c_adj)->value); x = ROUND (gtk_adjustment_get_value (GTK_ADJUSTMENT (exp_call.c_adj)));
if (x > itvals.numtiles || x <= 0) if (x > itvals.numtiles || x <= 0)
{ {
x = itvals.numtiles; x = itvals.numtiles;

View File

@ -384,6 +384,8 @@ unit_editor_dialog (void)
GtkListStore *list_store; GtkListStore *list_store;
GtkWidget *tv; GtkWidget *tv;
GtkTreeViewColumn *col; GtkTreeViewColumn *col;
GtkWidget *col_widget;
GtkWidget *button;
GtkCellRenderer *rend; GtkCellRenderer *rend;
gint i; gint i;
@ -479,8 +481,15 @@ unit_editor_dialog (void)
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col); gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
gimp_help_set_help_data (col->button, col_widget = gtk_tree_view_column_get_widget (col);
if (col_widget)
{
button = gtk_widget_get_ancestor (col_widget, GTK_TYPE_BUTTON);
if (button)
gimp_help_set_help_data (button,
gettext (columns[SAVE].help), NULL); gettext (columns[SAVE].help), NULL);
}
g_signal_connect (rend, "toggled", g_signal_connect (rend, "toggled",
G_CALLBACK (saved_toggled_callback), G_CALLBACK (saved_toggled_callback),
@ -500,7 +509,14 @@ unit_editor_dialog (void)
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col); gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
gimp_help_set_help_data (col->button, gettext (columns[i].help), NULL); col_widget = gtk_tree_view_column_get_widget (col);
if (col_widget)
{
button = gtk_widget_get_ancestor (col_widget, GTK_TYPE_BUTTON);
if (button)
gimp_help_set_help_data (button, gettext (columns[i].help), NULL);
}
} }
unit_list_init (GTK_TREE_VIEW (tv)); unit_list_init (GTK_TREE_VIEW (tv));
@ -555,7 +571,7 @@ new_callback (GtkAction *action,
&iter); &iter);
adj = gtk_tree_view_get_vadjustment (tv); adj = gtk_tree_view_get_vadjustment (tv);
gtk_adjustment_set_value (adj, adj->upper); gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj));
} }
} }
} }
@ -597,7 +613,7 @@ duplicate_callback (GtkAction *action,
gtk_tree_selection_select_iter (sel, &iter); gtk_tree_selection_select_iter (sel, &iter);
adj = gtk_tree_view_get_vadjustment (tv); adj = gtk_tree_view_get_vadjustment (tv);
gtk_adjustment_set_value (adj, adj->upper); gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj));
} }
} }
} }