comparison src/glyphs-widget.c @ 1065:332649c64dbc

[xemacs-hg @ 2002-10-24 13:44:51 by youngs] 2002-10-24 Andy Piper <andy@xemacs.org> * glyphs-widget.c (layout_query_geometry): only resize dynamically if static sizes haven't been set.
author youngs
date Thu, 24 Oct 2002 13:45:04 +0000
parents 79c6ff3eef26
children 9d75b4fe084c
comparison
equal deleted inserted replaced
1064:bfff82cca6e6 1065:332649c64dbc
1299 `widget-logical-to-character-height' and 1299 `widget-logical-to-character-height' and
1300 `widget-logical-to-character-width' allow conversion between 1300 `widget-logical-to-character-width' allow conversion between
1301 characters and logical units so that frames can be sized 1301 characters and logical units so that frames can be sized
1302 appropriately. */ 1302 appropriately. */
1303 1303
1304 /* Query the geometry of a layout widget. We assume that we can only 1304 /* Query the geometry of a layout widget. */
1305 get here if the size is not already fixed. */
1306 static void 1305 static void
1307 layout_query_geometry (Lisp_Object image_instance, int* width, 1306 layout_query_geometry (Lisp_Object image_instance, int* width,
1308 int* height, enum image_instance_geometry disp, 1307 int* height, enum image_instance_geometry disp,
1309 Lisp_Object domain) 1308 Lisp_Object domain)
1310 { 1309 {
1357 } 1356 }
1358 } 1357 }
1359 1358
1360 /* Work out minimum space we need to fit all the items. This could 1359 /* Work out minimum space we need to fit all the items. This could
1361 have been fixed by the user. */ 1360 have been fixed by the user. */
1362 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii))) 1361 if (IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) {
1363 { 1362 if (!NILP (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)))
1364 Lisp_Object dynamic_width = 1363 {
1365 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii)); 1364 Lisp_Object dynamic_width =
1366 if (INTP (dynamic_width)) 1365 Feval (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii));
1367 *width = XINT (dynamic_width); 1366 if (INTP (dynamic_width))
1368 } 1367 *width = XINT (dynamic_width);
1369 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL) 1368 }
1370 { 1369 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL)
1371 *width = maxpw + ((nitems + 1) * widget_instance_border_width (ii) + 1370 {
1372 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2; 1371 *width = maxpw + ((nitems + 1) * widget_instance_border_width (ii) +
1373 } 1372 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2;
1374 else 1373 }
1375 { 1374 else
1376 *width = maxpw + 2 * (widget_instance_border_width (ii) * 2 + 1375 {
1377 IMAGE_INSTANCE_MARGIN_WIDTH (ii)); 1376 *width = maxpw + 2 * (widget_instance_border_width (ii) * 2 +
1378 } 1377 IMAGE_INSTANCE_MARGIN_WIDTH (ii));
1379 1378 }
1379 }
1380
1380 /* Work out vertical spacings. */ 1381 /* Work out vertical spacings. */
1381 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii))) 1382 if (IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii)) {
1382 { 1383 if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)))
1383 Lisp_Object dynamic_height = 1384 {
1384 eval_within_redisplay (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii)); 1385 Lisp_Object dynamic_height =
1385 if (INTP (dynamic_height)) 1386 Feval (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii));
1386 *height = XINT (dynamic_height); 1387 if (INTP (dynamic_height))
1387 } 1388 *height = XINT (dynamic_height);
1388 else if (IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT (ii)) 1389 }
1389 { 1390 else if (IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT (ii))
1390 *height = nitems * luh + ph_adjust; 1391 {
1391 } 1392 *height = nitems * luh + ph_adjust;
1392 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_VERTICAL) 1393 }
1393 { 1394 else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_VERTICAL)
1394 *height = maxph + ((nitems + 1) * widget_instance_border_width (ii) + 1395 {
1395 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; 1396 *height = maxph + ((nitems + 1) * widget_instance_border_width (ii) +
1396 } 1397 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust;
1397 else 1398 }
1398 { 1399 else
1399 *height = maxph + (2 * widget_instance_border_width (ii) + 1400 {
1400 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; 1401 *height = maxph + (2 * widget_instance_border_width (ii) +
1401 } 1402 IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust;
1403 }
1404 }
1402 #ifdef DEBUG_WIDGET_OUTPUT 1405 #ifdef DEBUG_WIDGET_OUTPUT
1403 stderr_out ("layout wants %dx%d\n", *width, *height); 1406 stderr_out ("layout wants %dx%d\n", *width, *height);
1404 #endif 1407 #endif
1405 } 1408 }
1406 1409