Mercurial > hg > xemacs-beta
comparison src/glyphs-x.c @ 400:a86b2b5e0111 r21-2-30
Import from CVS: tag r21-2-30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:14:34 +0200 |
parents | 74fd4e045ea6 |
children | 5a2589c672dc |
comparison
equal
deleted
inserted
replaced
399:376370fb5946 | 400:a86b2b5e0111 |
---|---|
2178 /* Update all attributes that have changed. Lwlib actually does most | 2178 /* Update all attributes that have changed. Lwlib actually does most |
2179 of this for us. */ | 2179 of this for us. */ |
2180 static void | 2180 static void |
2181 x_update_widget (Lisp_Image_Instance *p) | 2181 x_update_widget (Lisp_Image_Instance *p) |
2182 { | 2182 { |
2183 /* This function can GC if IN_REDISPLAY is false. */ | |
2183 #ifdef HAVE_WIDGETS | 2184 #ifdef HAVE_WIDGETS |
2184 widget_value* wv = 0; | 2185 widget_value* wv = 0; |
2185 Boolean deep_p = False; | 2186 |
2186 /* Possibly update the size. */ | 2187 /* First get the items if they have changed since this is a |
2187 if (IMAGE_INSTANCE_SIZE_CHANGED (p)) | 2188 structural change. As such it will nuke all added values so we |
2188 { | 2189 need to update most other things after the items have changed.*/ |
2189 Arg al[2]; | |
2190 | |
2191 assert (IMAGE_INSTANCE_X_WIDGET_ID (p) && | |
2192 IMAGE_INSTANCE_X_CLIPWIDGET (p)) ; | |
2193 | |
2194 if ( !XtIsManaged(IMAGE_INSTANCE_X_WIDGET_ID (p)) | |
2195 || | |
2196 IMAGE_INSTANCE_X_WIDGET_ID (p)->core.being_destroyed ) | |
2197 { | |
2198 Lisp_Object sw; | |
2199 XSETIMAGE_INSTANCE (sw, p); | |
2200 signal_simple_error ("XEmacs bug: subwindow is deleted", sw); | |
2201 } | |
2202 | |
2203 XtSetArg (al [0], XtNwidth, (Dimension)IMAGE_INSTANCE_WIDTH (p)); | |
2204 XtSetArg (al [1], XtNheight, (Dimension)IMAGE_INSTANCE_HEIGHT (p)); | |
2205 XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (p), al, 2); | |
2206 } | |
2207 | |
2208 /* First get the items if they have changed since this is a structural change. */ | |
2209 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) | 2190 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) |
2210 { | 2191 { |
2211 wv = gui_items_to_widget_values | 2192 wv = gui_items_to_widget_values |
2212 (IMAGE_INSTANCE_WIDGET_ITEMS (p)); | 2193 (IMAGE_INSTANCE_WIDGET_ITEMS (p)); |
2213 deep_p = True; | 2194 wv->change = STRUCTURAL_CHANGE; |
2214 } | 2195 /* now modify the widget */ |
2196 lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (p), | |
2197 wv, True); | |
2198 free_widget_value_tree (wv); | |
2199 } | |
2200 | |
2201 /* Now do non structural updates. */ | |
2202 wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (p)); | |
2215 | 2203 |
2216 /* Possibly update the colors and font */ | 2204 /* Possibly update the colors and font */ |
2217 if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)) | 2205 if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p) |
2206 || | |
2207 XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (p))->faces_changed | |
2208 || | |
2209 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) | |
2218 { | 2210 { |
2219 update_widget_face (wv, p, IMAGE_INSTANCE_SUBWINDOW_FRAME (p)); | 2211 update_widget_face (wv, p, IMAGE_INSTANCE_SUBWINDOW_FRAME (p)); |
2220 } | 2212 } |
2221 | 2213 |
2222 /* Possibly update the text. */ | 2214 /* Possibly update the text. */ |
2228 C_STRING_ALLOCA, str, | 2220 C_STRING_ALLOCA, str, |
2229 Qnative); | 2221 Qnative); |
2230 wv->value = str; | 2222 wv->value = str; |
2231 } | 2223 } |
2232 | 2224 |
2225 /* Possibly update the size. */ | |
2226 if (IMAGE_INSTANCE_SIZE_CHANGED (p) | |
2227 || | |
2228 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) | |
2229 { | |
2230 assert (IMAGE_INSTANCE_X_WIDGET_ID (p) && | |
2231 IMAGE_INSTANCE_X_CLIPWIDGET (p)) ; | |
2232 | |
2233 if (IMAGE_INSTANCE_X_WIDGET_ID (p)->core.being_destroyed | |
2234 || !XtIsManaged(IMAGE_INSTANCE_X_WIDGET_ID (p))) | |
2235 { | |
2236 Lisp_Object sw; | |
2237 XSETIMAGE_INSTANCE (sw, p); | |
2238 signal_simple_error ("XEmacs bug: subwindow is deleted", sw); | |
2239 } | |
2240 | |
2241 lw_add_widget_value_arg (wv, XtNwidth, | |
2242 (Dimension)IMAGE_INSTANCE_WIDTH (p)); | |
2243 lw_add_widget_value_arg (wv, XtNheight, | |
2244 (Dimension)IMAGE_INSTANCE_HEIGHT (p)); | |
2245 } | |
2246 | |
2233 /* now modify the widget */ | 2247 /* now modify the widget */ |
2234 lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (p), | 2248 lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (p), |
2235 wv, deep_p); | 2249 wv, False); |
2236 free_widget_value_tree (wv); | |
2237 #endif | 2250 #endif |
2238 } | 2251 } |
2239 | 2252 |
2240 /* instantiate and x type subwindow */ | 2253 /* instantiate and x type subwindow */ |
2241 static void | 2254 static void |
2430 required. */ | 2443 required. */ |
2431 clip_wv = xmalloc_widget_value (); | 2444 clip_wv = xmalloc_widget_value (); |
2432 | 2445 |
2433 lw_add_widget_value_arg (clip_wv, XtNresize, False); | 2446 lw_add_widget_value_arg (clip_wv, XtNresize, False); |
2434 lw_add_widget_value_arg (clip_wv, XtNwidth, | 2447 lw_add_widget_value_arg (clip_wv, XtNwidth, |
2435 (Dimension)IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii)); | 2448 (Dimension)IMAGE_INSTANCE_WIDTH (ii)); |
2436 lw_add_widget_value_arg (clip_wv, XtNheight, | 2449 lw_add_widget_value_arg (clip_wv, XtNheight, |
2437 (Dimension)IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii)); | 2450 (Dimension)IMAGE_INSTANCE_HEIGHT (ii)); |
2438 clip_wv->enabled = True; | 2451 clip_wv->enabled = True; |
2439 | 2452 |
2440 clip_wv->name = xstrdup ("clip-window"); | 2453 clip_wv->name = xstrdup ("clip-window"); |
2441 clip_wv->value = xstrdup ("clip-window"); | 2454 clip_wv->value = xstrdup ("clip-window"); |
2442 | 2455 |
2468 lw_add_widget_value_arg (wv, XtNbackground, bcolor.pixel); | 2481 lw_add_widget_value_arg (wv, XtNbackground, bcolor.pixel); |
2469 lw_add_widget_value_arg (wv, XtNforeground, fcolor.pixel); | 2482 lw_add_widget_value_arg (wv, XtNforeground, fcolor.pixel); |
2470 /* we cannot allow widgets to resize themselves */ | 2483 /* we cannot allow widgets to resize themselves */ |
2471 lw_add_widget_value_arg (wv, XtNresize, False); | 2484 lw_add_widget_value_arg (wv, XtNresize, False); |
2472 lw_add_widget_value_arg (wv, XtNwidth, | 2485 lw_add_widget_value_arg (wv, XtNwidth, |
2473 (Dimension)IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii)); | 2486 (Dimension)IMAGE_INSTANCE_WIDTH (ii)); |
2474 lw_add_widget_value_arg (wv, XtNheight, | 2487 lw_add_widget_value_arg (wv, XtNheight, |
2475 (Dimension)IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii)); | 2488 (Dimension)IMAGE_INSTANCE_HEIGHT (ii)); |
2476 /* update the font. */ | 2489 /* update the font. */ |
2477 update_widget_face (wv, ii, domain); | 2490 update_widget_face (wv, ii, domain); |
2478 | 2491 |
2479 wid = lw_create_widget (type, wv->name, id, wv, IMAGE_INSTANCE_X_CLIPWIDGET (ii), | 2492 wid = lw_create_widget (type, wv->name, id, wv, IMAGE_INSTANCE_X_CLIPWIDGET (ii), |
2480 False, 0, popup_selection_callback, 0); | 2493 False, 0, popup_selection_callback, 0); |
2669 x_tab_control_update (Lisp_Object image_instance) | 2682 x_tab_control_update (Lisp_Object image_instance) |
2670 { | 2683 { |
2671 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2684 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2672 | 2685 |
2673 /* Possibly update the face. */ | 2686 /* Possibly update the face. */ |
2674 if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (ii)) | 2687 if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (ii) |
2688 || | |
2689 XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))->faces_changed | |
2690 || | |
2691 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii)) | |
2675 { | 2692 { |
2676 widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii)); | 2693 widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii)); |
2677 update_tab_widget_face (wv, ii, | 2694 update_tab_widget_face (wv, ii, |
2678 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); | 2695 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); |
2679 | 2696 |
2680 lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (ii), wv, True); | 2697 lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (ii), wv, True); |
2681 free_widget_value_tree (wv); | |
2682 } | 2698 } |
2683 } | 2699 } |
2684 | 2700 |
2685 /* instantiate a static control possible for putting other things in */ | 2701 /* instantiate a static control possible for putting other things in */ |
2686 static void | 2702 static void |