111
gradient_editor_left_color_type_cmd_callback (GtkAction *action,
115
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
116
GimpGradient *gradient;
119
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
121
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
123
if (gradient && value >= 0)
125
GimpGradientColor color_type = value;
128
gimp_gradient_get_color_at (gradient,
129
GIMP_DATA_EDITOR (editor)->context,
130
editor->control_sel_l,
131
editor->control_sel_l->left, FALSE,
134
gimp_data_freeze (GIMP_DATA (gradient));
136
gimp_gradient_segment_set_left_color_type (gradient,
137
editor->control_sel_l,
140
if (color_type == GIMP_GRADIENT_COLOR_FIXED)
141
gimp_gradient_segment_set_left_color (gradient,
142
editor->control_sel_l,
145
gimp_data_thaw (GIMP_DATA (gradient));
110
150
gradient_editor_load_left_cmd_callback (GtkAction *action,
114
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
154
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
155
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
115
156
GimpGradient *gradient;
116
GimpContext *context;
117
157
GimpGradientSegment *seg;
120
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
123
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
159
GimpGradientColor color_type = GIMP_GRADIENT_COLOR_FIXED;
161
gradient = GIMP_GRADIENT (data_editor->data);
127
case 0: /* Fetch from left neighbor's right endpoint */
165
case GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT:
128
166
if (editor->control_sel_l->prev != NULL)
129
seg = editor->control_sel_l->prev;
167
seg = editor->control_sel_l->prev;
131
seg = gimp_gradient_segment_get_last (editor->control_sel_l);
133
color = seg->right_color;
136
case 1: /* Fetch from right endpoint */
137
color = editor->control_sel_r->right_color;
140
case 2: /* Fetch from FG color */
141
gimp_context_get_foreground (context, &color);
144
case 3: /* Fetch from BG color */
145
gimp_context_get_background (context, &color);
169
seg = gimp_gradient_segment_get_last (editor->control_sel_l);
171
color = seg->right_color;
172
color_type = seg->right_color_type;
175
case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
176
color = editor->control_sel_r->right_color;
177
color_type = editor->control_sel_l->right_color_type;
180
case GRADIENT_EDITOR_COLOR_FOREGROUND:
181
gimp_context_get_foreground (data_editor->context, &color);
184
case GRADIENT_EDITOR_COLOR_BACKGROUND:
185
gimp_context_get_background (data_editor->context, &color);
148
188
default: /* Load a color */
149
color = editor->saved_colors[value - 4];
189
color = editor->saved_colors[value - GRADIENT_EDITOR_COLOR_FIRST_CUSTOM];
193
gimp_data_freeze (GIMP_DATA (gradient));
153
195
gimp_gradient_segment_range_blend (gradient,
154
196
editor->control_sel_l,
155
197
editor->control_sel_r,
157
199
&editor->control_sel_r->right_color,
201
gimp_gradient_segment_set_left_color_type (gradient,
202
editor->control_sel_l,
205
gimp_data_thaw (GIMP_DATA (gradient));
262
gradient_editor_right_color_type_cmd_callback (GtkAction *action,
266
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
267
GimpGradient *gradient;
270
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
272
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
274
if (gradient && value >= 0)
276
GimpGradientColor color_type = value;
279
gimp_gradient_get_color_at (gradient,
280
GIMP_DATA_EDITOR (editor)->context,
281
editor->control_sel_r,
282
editor->control_sel_r->right, FALSE,
285
gimp_data_freeze (GIMP_DATA (gradient));
287
gimp_gradient_segment_set_right_color_type (gradient,
288
editor->control_sel_r,
291
if (color_type == GIMP_GRADIENT_COLOR_FIXED)
292
gimp_gradient_segment_set_right_color (gradient,
293
editor->control_sel_r,
296
gimp_data_thaw (GIMP_DATA (gradient));
214
301
gradient_editor_load_right_cmd_callback (GtkAction *action,
218
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
305
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
306
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data);
219
307
GimpGradient *gradient;
220
GimpContext *context;
221
308
GimpGradientSegment *seg;
224
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
227
gimp_get_user_context (GIMP_DATA_EDITOR (editor)->data_factory->gimp);
310
GimpGradientColor color_type = GIMP_GRADIENT_COLOR_FIXED;
312
gradient = GIMP_GRADIENT (data_editor->data);
231
case 0: /* Fetch from right neighbor's left endpoint */
316
case GRADIENT_EDITOR_COLOR_NEIGHBOR_ENDPOINT:
232
317
if (editor->control_sel_r->next != NULL)
233
seg = editor->control_sel_r->next;
318
seg = editor->control_sel_r->next;
235
seg = gimp_gradient_segment_get_first (editor->control_sel_r);
237
color = seg->left_color;
240
case 1: /* Fetch from left endpoint */
241
color = editor->control_sel_l->left_color;
244
case 2: /* Fetch from FG color */
245
gimp_context_get_foreground (context, &color);
248
case 3: /* Fetch from BG color */
249
gimp_context_get_background (context, &color);
320
seg = gimp_gradient_segment_get_first (editor->control_sel_r);
322
color = seg->left_color;
323
color_type = seg->left_color_type;
326
case GRADIENT_EDITOR_COLOR_OTHER_ENDPOINT:
327
color = editor->control_sel_l->left_color;
328
color_type = editor->control_sel_l->left_color_type;
331
case GRADIENT_EDITOR_COLOR_FOREGROUND:
332
gimp_context_get_foreground (data_editor->context, &color);
335
case GRADIENT_EDITOR_COLOR_BACKGROUND:
336
gimp_context_get_background (data_editor->context, &color);
252
339
default: /* Load a color */
253
color = editor->saved_colors[value - 4];
340
color = editor->saved_colors[value - GRADIENT_EDITOR_COLOR_FIRST_CUSTOM];
344
gimp_data_freeze (GIMP_DATA (gradient));
257
346
gimp_gradient_segment_range_blend (gradient,
258
347
editor->control_sel_l,
259
348
editor->control_sel_r,
260
349
&editor->control_sel_l->left_color,
352
gimp_gradient_segment_set_right_color_type (gradient,
353
editor->control_sel_l,
356
gimp_data_thaw (GIMP_DATA (gradient));
407
508
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 4);
408
509
gtk_widget_show (scale);
410
g_signal_connect (scale_data, "value_changed",
411
G_CALLBACK (gimp_int_adjustment_update),
412
&editor->replicate_times);
511
g_signal_connect (scale_data, "value-changed",
512
G_CALLBACK (gimp_int_adjustment_update),
513
&editor->replicate_times);
414
515
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
415
516
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,
502
610
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 4);
503
611
gtk_widget_show (scale);
505
g_signal_connect (scale_data, "value_changed",
506
G_CALLBACK (gimp_int_adjustment_update),
507
&editor->split_parts);
613
g_signal_connect (scale_data, "value-changed",
614
G_CALLBACK (gimp_int_adjustment_update),
615
&editor->split_parts);
509
617
gtk_widget_set_sensitive (GTK_WIDGET (editor), FALSE);
510
618
gimp_ui_manager_update (GIMP_EDITOR (editor)->ui_manager,