summaryrefslogtreecommitdiff
path: root/graphics/cinepaint/patches/patch-af
blob: 56a3d0c7dbcc7455e55807e2287fea45bd572143 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
$NetBSD: patch-af,v 1.1 2005/03/16 18:32:50 rillig Exp $

gcc-2.95.3 cannot handle declarations intermixed with code.

--- app/color_correction_gui.c.orig	Tue Nov 23 12:58:15 2004
+++ app/color_correction_gui.c	Wed Mar 16 18:24:44 2005
@@ -246,12 +246,14 @@ static void _color_correction_gui_save_p
 
 void 
 color_correction_gui (GDisplay *display)
-{   if (! drawable_color (gimage_active_drawable (display->gimage)))
+{
+    _ColorCorrectionGui *data;
+    if (! drawable_color (gimage_active_drawable (display->gimage)))
     {   g_message ("Color correction operates only on RGB color drawables.");
         return;
     }
 
-    _ColorCorrectionGui *data = g_new(_ColorCorrectionGui, 1);
+    data = g_new(_ColorCorrectionGui, 1);
     data->display = display;
     data->active=TRUE;
     data->image_map = image_map_create (data->display, 
@@ -280,6 +282,7 @@ _color_correction_gui_create (_ColorCorr
     GtkWidget *label =NULL;
     GtkWidget *notebook = NULL;
     GtkWidget *frame = NULL;
+    int i;
        
 
     /*** MAIN SHELL AND NOTEBOOK */
@@ -308,9 +311,14 @@ _color_correction_gui_create (_ColorCorr
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), hbox, button);
 
     /*** WHEELS + SLIDERS + INPUTS ***/
-    int i;
     for (i=SHADOWS; i<=HIGHLIGHTS; i++)
-    {   data->settings->values[i][HUE]=0.0;      
+    {
+        _ColorCorrectionGuiWheel *wheel_data;
+        _ColorCorrectionGuiLSlider *lslider_data;
+        GtkObject *hue_adjustment, *saturation_adjustment, *lightness_adjustment;
+        _ColorCorrectionGuiSpin *spin_data;
+
+        data->settings->values[i][HUE]=0.0;      
         data->settings->values[i][SATURATION]=0.0;      
 	data->settings->values[i][LIGHTNESS]=0.0;      
       
@@ -334,7 +342,7 @@ _color_correction_gui_create (_ColorCorr
 	/* WHEEL */
 	data->color_wheels[i] = gtk_drawing_area_new ();
 	gtk_drawing_area_size(GTK_DRAWING_AREA(data->color_wheels[i]), WHEEL_RADIUS*2+2,WHEEL_RADIUS*2+2); 
-	_ColorCorrectionGuiWheel *wheel_data=g_new(_ColorCorrectionGuiWheel, 1);
+	wheel_data=g_new(_ColorCorrectionGuiWheel, 1);
 	wheel_data->range = i;
 	wheel_data->pixmap = NULL;
 	wheel_data->display_buffer = NULL;
@@ -366,7 +374,7 @@ _color_correction_gui_create (_ColorCorr
 	//	gtk_widget_set_style(frame, style);
 
 	data->lsliders[i] = gtk_drawing_area_new();    
-	_ColorCorrectionGuiLSlider *lslider_data = g_new(_ColorCorrectionGuiLSlider, 1);
+	lslider_data = g_new(_ColorCorrectionGuiLSlider, 1);
 	lslider_data->range= i;
 	lslider_data->gc = NULL;
 	lslider_data->pixmap = NULL;
@@ -384,15 +392,15 @@ _color_correction_gui_create (_ColorCorr
 
 
 	/* INNPUTS */
-	GtkObject *hue_adjustment = gtk_adjustment_new(0.0, 0.0, 360.0, 1.0, 0.0, 0.0);
-	GtkObject *saturation_adjustment = gtk_adjustment_new(0.0, 0.0, 100.0, 1.0, 0.0, 0.0);
-	GtkObject *lightness_adjustment = gtk_adjustment_new(0.0, 0.0, 100.0, 1.0, 0.0, 0.0);
+	hue_adjustment = gtk_adjustment_new(0.0, 0.0, 360.0, 1.0, 0.0, 0.0);
+	saturation_adjustment = gtk_adjustment_new(0.0, 0.0, 100.0, 1.0, 0.0, 0.0);
+	lightness_adjustment = gtk_adjustment_new(0.0, 0.0, 100.0, 1.0, 0.0, 0.0);
 
 	hbox = gtk_hbox_new(FALSE, 0);
 	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);    
 
 
-	_ColorCorrectionGuiSpin *spin_data = g_new(_ColorCorrectionGuiSpin, 1);
+	spin_data = g_new(_ColorCorrectionGuiSpin, 1);
 	spin_data->range = i;
 	spin_data->attribute = HUE;
 	label = gtk_label_new("H");
@@ -501,10 +509,10 @@ static void
 _color_correction_gui_update_wheel_handle (_ColorCorrectionGui *dialog,
 					   ColorCorrectionLightnessRange range)
 {   _ColorCorrectionGuiWheel *data;
+     gint new_pos[2]; 
      data = (_ColorCorrectionGuiWheel *)gtk_object_get_data(GTK_OBJECT(dialog->color_wheels[range]), 
 								"data");
      
-     gint new_pos[2]; 
      _color_correction_gui_wheel_hs_to_pos(dialog->settings->values[range][HUE],
 					   dialog->settings->values[range][SATURATION],
 					   data->radius, data->radius,
@@ -521,10 +529,11 @@ static void
 _color_correction_gui_update_lslider_handle (_ColorCorrectionGui *dialog,
 					     ColorCorrectionLightnessRange range)
 {   _ColorCorrectionGuiLSlider *data;
+    gint new_position;
     data = (_ColorCorrectionGuiLSlider *)gtk_object_get_data(GTK_OBJECT(dialog->lsliders[range]), 
 								  "data");
 
-    gint new_position =  (0.5-dialog->settings->values[range][LIGHTNESS]) * data->height;
+    new_position =  (0.5-dialog->settings->values[range][LIGHTNESS]) * data->height;
     if (new_position != data->position)
     {   _color_correction_gui_erase_lslider_handle(dialog->lsliders[range], data);
         data->position = new_position;
@@ -625,13 +634,13 @@ _color_correction_gui_wheel_events_cb (G
       {   data->active = data->active ? FALSE : TRUE;
 	  if (data->active) 
 	  {
+	     _ColorCorrectionGuiLSlider *slider_data;
    	     /* reset values from positions */
   	     _color_correction_gui_wheel_pos_to_hs(data->position[X]-data->x, 
 					      data->position[Y]-data->y, 
 					      data->radius, data->radius, 
 					      &dialog->settings->values[data->range][HUE], 
 					      &dialog->settings->values[data->range][SATURATION]); 
-	     _ColorCorrectionGuiLSlider *slider_data;
 	     slider_data = (_ColorCorrectionGuiLSlider *)gtk_object_get_data(GTK_OBJECT(dialog->lsliders[data->range]), 
 										 "data");
 	     dialog->settings->values[data->range][LIGHTNESS] = (1-slider_data->position/(gfloat)slider_data->height) - 0.5;	     
@@ -697,6 +706,7 @@ _color_correction_gui_lslider_events_cb 
 				 GdkEvent  *event,
 				 _ColorCorrectionGui *dialog)
 {   _ColorCorrectionGuiLSlider *data = (_ColorCorrectionGuiLSlider *)gtk_object_get_data(GTK_OBJECT(widget), "data");
+    gfloat new_lightness;
 
     switch (event->type)
     {
@@ -716,7 +726,7 @@ _color_correction_gui_lslider_events_cb 
       _color_correction_gui_erase_lslider_handle(widget, data);
 
       data->position=event->button.y;
-      gfloat new_lightness = (1-data->position/(gfloat)data->height) -0.5;
+      new_lightness = (1-data->position/(gfloat)data->height) -0.5;
       if (dialog->settings->values[data->range][LIGHTNESS] != new_lightness) 
       {   if(dialog->settings->values[data->range][LIGHTNESS] == 0)
 	  {   dialog->settings->lightness_modified ++;
@@ -740,7 +750,7 @@ _color_correction_gui_lslider_events_cb 
       if (data->dragging)
       {   _color_correction_gui_erase_lslider_handle(widget, data);
           data->position=event->button.y;
-	  gfloat new_lightness = (1-data->position/(gfloat)data->height) -0.5;
+	  new_lightness = (1-data->position/(gfloat)data->height) -0.5;
 	  if (dialog->settings->values[data->range][LIGHTNESS] != new_lightness) 
           {   if(dialog->settings->values[data->range][LIGHTNESS] == 0)
 	      {   dialog->settings->lightness_modified ++;
@@ -843,6 +853,7 @@ _color_correction_gui_draw_wheel (GtkWid
     gfloat h,s,l;
     guchar color[3];
     _ColorCorrectionGuiWheel *data = (_ColorCorrectionGuiWheel *)gtk_object_get_data(GTK_OBJECT(drawing_area), "data");
+    int xmax, ymax;
     
     /* translate the marker to the new size */
     gint new_width, new_height;
@@ -875,7 +886,6 @@ _color_correction_gui_draw_wheel (GtkWid
 		       TRUE, 0,0, data->width, data->height);
 
     /* iterate over wheel calculating hue and saturation */
-    int xmax, ymax;
     data->x = data->width/2-data->radius;
     data->y = data->height/2-data->radius;
     xmax = data->x + 2 * data->radius;
@@ -903,14 +913,20 @@ _color_correction_gui_draw_wheel (GtkWid
 
 static void
 _color_correction_gui_draw_wheel_handle (GtkWidget *drawing_area, _ColorCorrectionGuiWheel *data)
-{   gdk_gc_set_foreground(data->gc, &GTK_WIDGET(drawing_area)->style->black);
+{
+    GdkRectangle update_area;
+
+    gdk_gc_set_foreground(data->gc, &GTK_WIDGET(drawing_area)->style->black);
    
     gdk_draw_arc(data->display_buffer, data->gc, FALSE, 
 		 data->position[X]-5, data->position[Y]-5,
 		 10,10,0,23040); /* last two params are angle in 1/64th of degree */
     gdk_draw_point(data->display_buffer, data->gc, 
 		   data->position[X], data->position[Y]);
-    GdkRectangle update_area = {data->position[X]-5, data->position[Y]-5, 11, 11};
+    update_area.x = data->position[X]-5;
+    update_area.y = data->position[Y]-5;
+    update_area.width = 11;
+    update_area.height = 11;
     gtk_widget_draw(drawing_area, &update_area);
 }
 
@@ -931,6 +947,7 @@ _color_correction_gui_erase_wheel_handle
 static void
 _color_correction_gui_draw_wheel_toggle(GtkWidget *drawing_area)
 {   _ColorCorrectionGuiWheel *data = (_ColorCorrectionGuiWheel *)gtk_object_get_data(GTK_OBJECT(drawing_area), "data");
+    GdkRectangle update_area = {3,3,27,19};    
     if (data->active) 
     {   gdk_rgb_gc_set_foreground(data->gc, 0x777777);
         gdk_draw_rectangle(data->display_buffer, data->gc, TRUE, 3,3, 26, 19);
@@ -966,7 +983,6 @@ _color_correction_gui_draw_wheel_toggle(
 		      color_correction_wheel_labels[data->range], 3);
     }
 
-    GdkRectangle update_area = {3,3,27,19};    
     gtk_widget_draw(drawing_area, &update_area);
 }
 
@@ -1063,7 +1079,8 @@ static void
 _color_correction_gui_draw_lslider (GtkWidget *drawing_area)
 {   _ColorCorrectionGuiLSlider *data = (_ColorCorrectionGuiLSlider *)gtk_object_get_data(GTK_OBJECT(drawing_area), "data");
     gint y;
-    
+    int step_size, gray;
+
     data->height = drawing_area->allocation.height;
 
     if (data->gc == NULL)
@@ -1084,8 +1101,7 @@ _color_correction_gui_draw_lslider (GtkW
 
     /* draw the slider */
     gdk_gc_set_function(data->gc, GDK_COPY);
-    int step_size = 255/data->height;
-    int gray;
+    step_size = 255/data->height;
     for (y = 0; y < data->height; y++)
     {   gray=255-(y*step_size);
         gdk_rgb_gc_set_foreground(data->gc, (gray<<16) | (gray<<8) | gray);
@@ -1102,7 +1118,9 @@ _color_correction_gui_draw_lslider (GtkW
 
 static void
 _color_correction_gui_draw_lslider_handle (GtkWidget *drawing_area, _ColorCorrectionGuiLSlider *data)
-{   gdk_gc_set_foreground(data->gc, &drawing_area->style->white);
+{
+    GdkRectangle update_area;
+    gdk_gc_set_foreground(data->gc, &drawing_area->style->white);
     gdk_draw_line(data->display_buffer, data->gc,
 		  0, data->position-2, LSLIDER_WIDTH, data->position-2);
     gdk_gc_set_foreground(data->gc, &drawing_area->style->mid[GTK_STATE_NORMAL]);
@@ -1112,7 +1130,10 @@ _color_correction_gui_draw_lslider_handl
     gdk_draw_line(data->display_buffer, data->gc,
 		  0, data->position+2, LSLIDER_WIDTH, data->position+2);
 
-    GdkRectangle update_area = {0, data->position-2, LSLIDER_WIDTH, 5};
+    update_area.x = 0;
+    update_area.y = data->position-2;
+    update_area.width = LSLIDER_WIDTH;
+    update_area.height = 5;
     gtk_widget_draw(drawing_area, &update_area);		    
 }