106 |
/* control form callback routine */ |
/* control form callback routine */ |
107 |
void control_callback(FL_OBJECT *obj, void *d) |
void control_callback(FL_OBJECT *obj, void *d) |
108 |
{ |
{ |
109 |
if (obj == sizeobj) |
if (obj == sizeobj) |
110 |
cursize = (int)(40 * fl_get_slider_value(sizeobj)); |
cursize = (int)(40 * fl_get_slider_value(sizeobj)); |
111 |
else if (obj == exitobj) |
else if (obj == exitobj) |
112 |
exit(0); |
exit(0); |
113 |
} |
} |
114 |
|
|
140 |
create_controlform(); |
create_controlform(); |
141 |
fl_set_form_callback(controlform,control_callback, 0); |
fl_set_form_callback(controlform,control_callback, 0); |
142 |
fl_set_button(squareobj,1); |
fl_set_button(squareobj,1); |
143 |
fl_set_initial_placement(controlform, 20, -controlform->h - 40, |
fl_set_initial_placement(controlform, 20, -controlform->h - 40, |
144 |
controlform->w, controlform->h); |
controlform->w, controlform->h); |
145 |
fl_show_form(controlform,FL_PLACE_SIZE,FL_TRANSIENT,"Control"); |
fl_show_form(controlform,FL_PLACE_SIZE,FL_TRANSIENT,"Control"); |
146 |
} |
} |
159 |
fl_winset(main_win); |
fl_winset(main_win); |
160 |
fl_mapcolor(FL_FREE_COL1,obj->r, obj->g, obj->b); |
fl_mapcolor(FL_FREE_COL1,obj->r, obj->g, obj->b); |
161 |
if (obj->type == 1) |
if (obj->type == 1) |
162 |
fl_rectf(obj->x - obj->size, obj->y - obj->size, |
fl_rectf(obj->x - obj->size, obj->y - obj->size, |
163 |
obj->size * 2, obj->size *2, FL_FREE_COL1); |
obj->size * 2, obj->size *2, FL_FREE_COL1); |
164 |
else if (obj->type == 2) |
else if (obj->type == 2) |
165 |
fl_circf(obj->x, obj->y, obj->size, FL_FREE_COL1); |
fl_circf(obj->x, obj->y, obj->size, FL_FREE_COL1); |
197 |
int i; |
int i; |
198 |
|
|
199 |
XClearWindow(fl_display, main_win); |
XClearWindow(fl_display, main_win); |
200 |
for (i=0; i<onumb; i++) |
for (i=0; i<onumb; i++) |
201 |
drawit(ob + i); |
drawit(ob + i); |
202 |
} |
} |
203 |
|
|
219 |
return 0; |
return 0; |
220 |
} |
} |
221 |
|
|
222 |
void |
void |
223 |
init_mainpart(void) |
init_mainpart(void) |
224 |
{ |
{ |
225 |
fl_pref_wingeometry(400,300,400,400); |
fl_pref_wingeometry(400,300,400,400); |
226 |
fl_pref_winsize(400,400); |
fl_pref_winsize(400,400); |
227 |
fl_winbackground(0, fl_get_flcolor(FL_COL1)); |
fl_winbackground(0, fl_get_flcolor(FL_COL1)); |
228 |
main_win = fl_winopen("Drawing"); |
main_win = fl_winopen("Drawing"); |
229 |
fl_set_event_callback(main_callback, 0); |
fl_set_event_callback(main_callback, 0); |
230 |
} |
} |