Mercurial > hg > xemacs-beta
diff src/toolbar-x.c @ 282:c42ec1d1cded r21-0b39
Import from CVS: tag r21-0b39
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:33:18 +0200 |
parents | c5d627a313b1 |
children | 57709be46d1b |
line wrap: on
line diff
--- a/src/toolbar-x.c Mon Aug 13 10:32:23 2007 +0200 +++ b/src/toolbar-x.c Mon Aug 13 10:33:18 2007 +0200 @@ -656,181 +656,6 @@ static void -x_toolbar_size_changed_in_frame_1 (struct frame *f, enum toolbar_pos pos, - Lisp_Object old_visibility) -{ - XtWidgetGeometry req, repl; - int newval; - int oldval = FRAME_X_OLD_TOOLBAR_SIZE (f, pos); - - if (NILP (f->toolbar_visible_p[pos])) - newval = 0; - else if (!f->init_finished && !INTP (f->toolbar_size[pos])) - /* the size might not be set at all if we're in the process of - creating the frame. Otherwise it better be, and we'll crash - out if not. */ - newval = 0; - else - { - Lisp_Object frame; - - XSETFRAME (frame, f); - newval = XINT (Fspecifier_instance (Vtoolbar_size[pos], frame, Qzero, - Qnil)); - } - - if (oldval == newval) - return; - - /* We want the text area to stay the same size. So, we query the - current size and then adjust it for the change in the toolbar - size. */ - - in_specifier_change_function++; - - if (!in_resource_setting) - /* mirror the value in the frame resources, unless already done. */ - Xt_SET_VALUE (FRAME_X_CONTAINER_WIDGET (f), - pos == TOP_TOOLBAR ? XtNtopToolBarHeight : - pos == BOTTOM_TOOLBAR ? XtNbottomToolBarHeight : - pos == LEFT_TOOLBAR ? XtNleftToolBarWidth : - XtNrightToolBarWidth, - newval); - - if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) - { - int change = newval - oldval; - Lisp_Object new_visibility = f->toolbar_visible_p[pos]; - - req.request_mode = 0; - /* the query-geometry method looks at the current value of - f->toolbar_size[pos], so temporarily set it back to the old - one. If we were called because of a visibility change we - also have to temporarily restore its old status as well. */ - f->toolbar_size[pos] = make_int (oldval); - if (!EQ (old_visibility, Qzero)) - f->toolbar_visible_p[pos] = old_visibility; - XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl); - f->toolbar_size[pos] = make_int (newval); - if (!EQ (old_visibility, Qzero)) - f->toolbar_visible_p[pos] = new_visibility; - - if (change < 0) - { - x_clear_toolbar (f, pos, change); - mark_frame_toolbar_buttons_dirty (f, pos); - } - if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR) - repl.width += change; - else - repl.height += change; - - MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); - EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width, - repl.height); - } - /* #### should this go within XtIsRealized()? probably not ... */ - FRAME_X_OLD_TOOLBAR_SIZE (f, pos) = newval; - in_specifier_change_function--; -} - -static void -x_toolbar_size_changed_in_frame (struct frame *f, enum toolbar_pos pos, - Lisp_Object oldval) -{ - x_toolbar_size_changed_in_frame_1 (f, pos, Qzero); -} - -static void -x_toolbar_visible_p_changed_in_frame (struct frame *f, enum toolbar_pos pos, - Lisp_Object oldval) -{ - x_toolbar_size_changed_in_frame_1 (f, pos, oldval); -} - -static void -x_toolbar_border_width_changed_in_frame (struct frame *f, enum toolbar_pos pos, - Lisp_Object lispoldval) -{ - XtWidgetGeometry req, repl; - int newval, oldval; - - if (NILP (f->toolbar_visible_p[pos]) || ZEROP (f->toolbar_size[pos])) - { - return; - } - else if (!f->init_finished && !INTP (f->toolbar_border_width[pos])) - /* the size might not be set at all if we're in the process of - creating the frame. Otherwise it better be, and we'll crash - out if not. */ - { - newval = 0; - } - else - { - Lisp_Object frame; - - XSETFRAME (frame, f); - newval = XINT (Fspecifier_instance (Vtoolbar_border_width[pos], - frame, Qzero, Qnil)); - } - - if (INTP (lispoldval)) - oldval = XINT (lispoldval); - else - oldval = 0; - - if (oldval == newval) - return; - - /* We want the text area to stay the same size. So, we query the - current size and then adjust it for the change in the toolbar - size. */ - - in_specifier_change_function++; - - if (!in_resource_setting) - /* mirror the value in the frame resources, unless already done. */ - Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f), - pos == TOP_TOOLBAR ? XtNtopToolBarBorderWidth : - pos == BOTTOM_TOOLBAR ? XtNbottomToolBarBorderWidth : - pos == LEFT_TOOLBAR ? XtNleftToolBarBorderWidth : - XtNrightToolBarBorderWidth, - newval); - - if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f))) - { - int change = 2 * (newval - oldval); - - req.request_mode = 0; - - /* - * We want the current size, not the future size, so briefly - * reset the border width value so the query method returns - * the correct value. - */ - f->toolbar_border_width[pos] = make_int (oldval); - XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl); - f->toolbar_border_width[pos] = make_int (newval); - - if (change < 0) - { - x_clear_toolbar (f, pos, change); - mark_frame_toolbar_buttons_dirty (f, pos); - } - if (pos == LEFT_TOOLBAR || pos == RIGHT_TOOLBAR) - repl.width += change; - else - repl.height += change; - - MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (f); - EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width, - repl.height); - } - in_specifier_change_function--; -} - -static void x_initialize_frame_toolbar_gcs (struct frame *f) { EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f); @@ -971,7 +796,4 @@ CONSOLE_HAS_METHOD (x, output_toolbar_button); CONSOLE_HAS_METHOD (x, redraw_exposed_toolbars); CONSOLE_HAS_METHOD (x, redraw_frame_toolbars); - CONSOLE_HAS_METHOD (x, toolbar_size_changed_in_frame); - CONSOLE_HAS_METHOD (x, toolbar_border_width_changed_in_frame); - CONSOLE_HAS_METHOD (x, toolbar_visible_p_changed_in_frame); }