gr = *ip++;
bl = *ip++;
conv.val = pixarray[QUANT_GET_COLOR(qtable,rd,gr,bl)];
-#if WORDS_BIGENDIAN
+#ifdef WORDS_BIGENDIAN
if (outimg->byte_order == MSBFirst)
for (q = 4-byte_cnt; q < 4; q++) *dp++ = conv.cp[q];
else
bl = *ip++ >> (8 - bbits);
conv.val = (rd << rshift) | (gr << gshift) | (bl << bshift);
-#if WORDS_BIGENDIAN
+#ifdef WORDS_BIGENDIAN
if (outimg->byte_order == MSBFirst)
for (q = 4-byte_cnt; q < 4; q++) *dp++ = conv.cp[q];
else
need to update most other things after the items have changed.*/
if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
{
- /* Pick up the items we recorded earlier. We do this here so
- that the callbacks get set up with the new items. */
- IMAGE_INSTANCE_WIDGET_ITEMS (p) =
- IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p);
- IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p) = Qnil;
+ Lisp_Object image_instance;
+ XSETIMAGE_INSTANCE (image_instance, p);
wv = gui_items_to_widget_values
- (IMAGE_INSTANCE_WIDGET_ITEMS (p));
+ (image_instance, IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p));
wv->change = STRUCTURAL_CHANGE;
/* now modify the widget */
lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (p),
return;
/* Possibly update the colors and font */
- if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)
+ if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)
||
XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (p))->faces_changed
||
/* Possibly update the size. */
if (IMAGE_INSTANCE_SIZE_CHANGED (p)
||
- IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
+ IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)
+ ||
+ IMAGE_INSTANCE_TEXT_CHANGED (p))
{
assert (IMAGE_INSTANCE_X_WIDGET_ID (p) &&
IMAGE_INSTANCE_X_CLIPWIDGET (p)) ;
IMAGE_INSTANCE_SUBWINDOW_ID (ii) = (void*)wid;
IMAGE_INSTANCE_X_WIDGET_LWID (ii) = id;
-#if 0
- /* Resize the widget here so that the values do not get copied by
- lwlib. */
- ac = 0;
- XtSetArg (al [ac], XtNwidth,
- (Dimension)IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii)); ac++;
- XtSetArg (al [ac], XtNheight,
- (Dimension)IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii)); ac++;
- XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, ac);
-#endif
/* because the EmacsManager is the widgets parent we have to
offset the redisplay of the widget by the amount the text
widget is inside the manager. */
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image);
- widget_value* wv = xmalloc_widget_value ();
-
- button_item_to_widget_value (gui, wv, 1, 1);
+ widget_value* wv = gui_items_to_widget_values (image_instance, gui);
if (!NILP (glyph))
{
}
}
+/* Update a button's clicked state.
+
+ #### This is overkill, but it works. Right now this causes all
+ button instances to flash for some reason buried deep in lwlib. In
+ theory this should be the Right Thing to do since lwlib should only
+ merge in changed values - and if nothing has changed then nothing
+ should get done. This may be because of the args stuff,
+ i.e. although the arg contents may be the same the args look
+ different and so are re-applied to the widget. */
+static void
+x_button_update (Lisp_Object image_instance)
+{
+ /* This function can GC if IN_REDISPLAY is false. */
+ Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
+ widget_value* wv =
+ gui_items_to_widget_values (image_instance,
+ IMAGE_INSTANCE_WIDGET_ITEMS (p));
+
+ /* now modify the widget */
+ lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (p),
+ wv, True);
+ free_widget_value_tree (wv);
+}
+
/* get properties of a button */
static Lisp_Object
x_button_property (Lisp_Object image_instance, Lisp_Object prop)
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
- widget_value* wv = xmalloc_widget_value ();
-
- button_item_to_widget_value (gui, wv, 1, 1);
+ widget_value* wv = gui_items_to_widget_values (image_instance, gui);
x_widget_instantiate (image_instance, instantiator, pointer_fg,
pointer_bg, dest_mask, domain, "progress", wv);
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
- if (IMAGE_INSTANCE_WIDGET_PERCENT_CHANGED (ii))
+ if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii))
{
Arg al [1];
- /* #### I'm not convinced we should store this in the plist. */
- Lisp_Object val = Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii),
- Q_percent, Qnil);
+ Lisp_Object val;
+#ifdef ERROR_CHECK_GLYPHS
+ assert (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)));
+#endif
+ val = XGUI_ITEM (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii))->value;
XtSetArg (al[0], XtNvalue, XINT (val));
XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, 1);
}
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
- widget_value* wv = xmalloc_widget_value ();
-
- button_item_to_widget_value (gui, wv, 1, 1);
+ widget_value* wv = gui_items_to_widget_values (image_instance, gui);
x_widget_instantiate (image_instance, instantiator, pointer_fg,
pointer_bg, dest_mask, domain, "text-field", wv);
widget_instantiate (image_instance, instantiator, pointer_fg,
pointer_bg, dest_mask, domain);
- wv = gui_items_to_widget_values (IMAGE_INSTANCE_WIDGET_ITEMS (ii));
+ wv = gui_items_to_widget_values (image_instance,
+ IMAGE_INSTANCE_WIDGET_ITEMS (ii));
x_widget_instantiate (image_instance, instantiator, pointer_fg,
pointer_bg, dest_mask, domain, "combo-box", wv);
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
widget_value * wv =
- gui_items_to_widget_values (IMAGE_INSTANCE_WIDGET_ITEMS (ii));
+ gui_items_to_widget_values (image_instance,
+ IMAGE_INSTANCE_WIDGET_ITEMS (ii));
update_tab_widget_face (wv, ii,
IMAGE_INSTANCE_SUBWINDOW_FRAME (ii));
/* set the properties of a tab control */
static void
-x_tab_control_update (Lisp_Object image_instance)
+x_tab_control_update (Lisp_Object image_instance)
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
/* Possibly update the face. */
- if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (ii)
+ if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (ii)
||
XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))->faces_changed
||
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
- widget_value* wv = xmalloc_widget_value ();
-
- button_item_to_widget_value (gui, wv, 1, 1);
+ widget_value* wv = gui_items_to_widget_values (image_instance, gui);
x_widget_instantiate (image_instance, instantiator, pointer_fg,
pointer_bg, dest_mask, domain, "button", wv);
INITIALIZE_DEVICE_IIFORMAT (x, button);
IIFORMAT_HAS_DEVMETHOD (x, button, property);
IIFORMAT_HAS_DEVMETHOD (x, button, instantiate);
+ IIFORMAT_HAS_DEVMETHOD (x, button, update);
INITIALIZE_DEVICE_IIFORMAT (x, widget);
IIFORMAT_HAS_DEVMETHOD (x, widget, property);