summaryrefslogtreecommitdiff
path: root/src/Paned.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Paned.c')
-rw-r--r--src/Paned.c2532
1 files changed, 1326 insertions, 1206 deletions
diff --git a/src/Paned.c b/src/Paned.c
index 2c88c37..098e353 100644
--- a/src/Paned.c
+++ b/src/Paned.c
@@ -46,10 +46,9 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/Xaw/Paned.c,v 1.12 2001/12/14 19:54:41 dawes Exp $ */
/*
- * Paned.c - Paned Composite Widget.
- *
* Updated and significantly modified from the Athena VPaned Widget.
*
* Date: March 1, 1989
@@ -62,21 +61,22 @@ SOFTWARE.
#include <X11/IntrinsicP.h>
#include <X11/cursorfont.h>
#include <X11/StringDefs.h>
-
-#include <X11/Xmu/Misc.h>
+#include <X11/Xmu/CharSet.h>
#include <X11/Xmu/Converters.h>
-
-#include <X11/Xaw/XawInit.h>
+#include <X11/Xmu/Misc.h>
+#include <X11/Xmu/SysUtil.h>
#include <X11/Xaw/Grip.h>
#include <X11/Xaw/PanedP.h>
-
-/* I don't know why Paned.c calls _XawImCallVendorShellExtResize, but... */
#include <X11/Xaw/XawImP.h>
+#include <X11/Xaw/XawInit.h>
+#include "Private.h"
-#include <ctype.h>
-
-typedef enum {UpLeftPane = 'U', LowRightPane = 'L',
- ThisBorderOnly = 'T', AnyPane = 'A' } Direction;
+typedef enum {
+ UpLeftPane = 'U',
+ LowRightPane = 'L',
+ ThisBorderOnly = 'T',
+ AnyPane = 'A'
+} Direction;
#define NO_INDEX -100
#define IS_GRIP NULL
@@ -85,501 +85,640 @@ typedef enum {UpLeftPane = 'U', LowRightPane = 'L',
#define HasGrip(w) (PaneInfo(w)->grip != NULL)
#define IsPane(w) ((w)->core.widget_class != gripWidgetClass)
#define PaneIndex(w) (PaneInfo(w)->position)
-#define IsVert(w) ( (w)->paned.orientation == XtorientVertical )
+#define IsVert(w) ((w)->paned.orientation == XtorientVertical)
#define ForAllPanes(pw, childP) \
- for ( (childP) = (pw)->composite.children ; \
- (childP) < (pw)->composite.children + (pw)->paned.num_panes ; \
- (childP)++ )
+for ((childP) = (pw)->composite.children; \
+ (childP) < (pw)->composite.children + (pw)->paned.num_panes; \
+ (childP)++)
#define ForAllChildren(pw, childP) \
- for ( (childP) = (pw)->composite.children ; \
- (childP) < (pw)->composite.children + (pw)->composite.num_children ; \
- (childP)++ )
+for ((childP) = (pw)->composite.children; \
+ (childP) < (pw)->composite.children + (pw)->composite.num_children; \
+ (childP)++)
-/*****************************************************************************
- *
- * Full instance record declaration
- *
- ****************************************************************************/
+#define PaneSize(paned, vertical) \
+ ((vertical) ? XtHeight(paned) : XtWidth(paned))
+
+#define GetRequestInfo(geo, vertical) \
+ ((vertical) ? (geo)->height : (geo)->width)
+#define SatisfiesRule1(pane, shrink) \
+ (((shrink) && ((pane)->size != (pane)->min)) \
+ || (!(shrink) && ((pane)->size != (pane)->max)))
+
+#define SatisfiesRule2(pane) \
+ (!(pane)->skip_adjust || (pane)->paned_adjusted_me)
+
+#define SatisfiesRule3(pane, shrink) \
+ ((pane)->paned_adjusted_me \
+ && (((shrink) && ((int)(pane)->wp_size <= (pane)->size)) \
+ || (!(shrink) && ((int)(pane)->wp_size >= (pane)->size))))
+
+
+/*
+ * Class Methods
+ */
+static void XawPanedClassInitialize(void);
+static void XawPanedChangeManaged(Widget);
+static void XawPanedDeleteChild(Widget);
+static void XawPanedDestroy(Widget);
+static XtGeometryResult XawPanedGeometryManager(Widget, XtWidgetGeometry*,
+ XtWidgetGeometry*);
+static void XawPanedInitialize(Widget, Widget, ArgList, Cardinal*);
+static void XawPanedInsertChild(Widget);
+static Boolean XawPanedPaneSetValues(Widget, Widget, Widget,
+ ArgList, Cardinal*);
+static void XawPanedRealize(Widget, Mask*, XSetWindowAttributes*);
+static void XawPanedRedisplay(Widget, XEvent*, Region);
+static void XawPanedResize(Widget);
+static Boolean XawPanedSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
+
+/*
+ * Prototypes
+ */
+static void _DrawInternalBorders(PanedWidget, GC);
+static void _DrawRect(PanedWidget, GC, int, int, unsigned int, unsigned int);
+static void _DrawTrackLines(PanedWidget, Bool);
+static void AdjustPanedSize(PanedWidget, unsigned int, XtGeometryResult*,
+ Dimension*, Dimension*);
+static void ChangeAllGripCursors(PanedWidget);
+static Pane ChoosePaneToResize(PanedWidget, int, Direction, Bool);
+static void ClearPaneStack(PanedWidget);
+static void CommitGripAdjustment(PanedWidget);
+static void CreateGrip(Widget);
+static int GetEventLocation(PanedWidget, XEvent*);
+static void GetGCs(Widget);
+static void GetPaneStack(PanedWidget, Bool, Pane*, int*);
+static void HandleGrip(Widget, XtPointer, XtPointer);
+static void LoopAndRefigureChildren(PanedWidget, int, Direction, int*);
+static void ManageAndUnmanageGrips(PanedWidget);
+static void MoveGripAdjustment(PanedWidget, Widget, Direction, int);
+static Bool PopPaneStack(PanedWidget);
+static void PushPaneStack(PanedWidget, Pane);
+static void RefigureLocations(PanedWidget, int, Direction);
+static void RefigureLocationsAndCommit(Widget);
+static void ReleaseGCs(Widget);
+static void ResortChildren(PanedWidget);
+static void SetChildrenPrefSizes(PanedWidget, unsigned int);
+static void StartGripAdjustment(PanedWidget, Widget, Direction);
+
+/*
+ * Initialization
+ */
static char defGripTranslations[] =
- "<Btn1Down>: GripAction(Start, UpLeftPane) \n\
- <Btn2Down>: GripAction(Start, ThisBorderOnly) \n\
- <Btn3Down>: GripAction(Start, LowRightPane) \n\
- <Btn1Motion>: GripAction(Move, UpLeft) \n\
- <Btn2Motion>: GripAction(Move, ThisBorder) \n\
- <Btn3Motion>: GripAction(Move, LowRight) \n\
- Any<BtnUp>: GripAction(Commit)";
+"<Btn1Down>:" "GripAction(Start,UpLeftPane)\n"
+"<Btn2Down>:" "GripAction(Start,ThisBorderOnly)\n"
+"<Btn3Down>:" "GripAction(Start,LowRightPane)\n"
+"<Btn1Motion>:" "GripAction(Move,UpLeft)\n"
+"<Btn2Motion>:" "GripAction(Move,ThisBorder)\n"
+"<Btn3Motion>:" "GripAction(Move,LowRight)\n"
+"Any<BtnUp>:" "GripAction(Commit)\n"
+;
#define offset(field) XtOffsetOf(PanedRec, paned.field)
-
static XtResource resources[] = {
- {XtNinternalBorderColor, XtCBorderColor, XtRPixel, sizeof(Pixel),
- offset(internal_bp), XtRString,
- (XtPointer) XtDefaultForeground},
- {XtNinternalBorderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
- offset(internal_bw), XtRImmediate, (XtPointer) 1},
- {XtNgripIndent, XtCGripIndent, XtRPosition, sizeof(Position),
- offset(grip_indent), XtRImmediate, (XtPointer) 10},
- {XtNrefigureMode, XtCBoolean, XtRBoolean, sizeof(Boolean),
- offset(refiguremode), XtRImmediate, (XtPointer) TRUE},
- {XtNgripTranslations, XtCTranslations, XtRTranslationTable,
- sizeof(XtTranslations),
- offset(grip_translations), XtRString, (XtPointer)defGripTranslations},
- {XtNorientation, XtCOrientation, XtROrientation, sizeof(XtOrientation),
- offset(orientation), XtRImmediate, (XtPointer) XtorientVertical},
-
- /* Cursors - both horiz and vertical have to work. */
-
- {XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(cursor), XtRImmediate, None},
- {XtNgripCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(grip_cursor), XtRImmediate, None},
- {XtNverticalGripCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(v_grip_cursor), XtRString, "sb_v_double_arrow"},
- {XtNhorizontalGripCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(h_grip_cursor), XtRString, "sb_h_double_arrow"},
-
- {XtNbetweenCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(adjust_this_cursor), XtRString, None},
- {XtNverticalBetweenCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(v_adjust_this_cursor), XtRString, "sb_left_arrow"},
- {XtNhorizontalBetweenCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(h_adjust_this_cursor), XtRString, "sb_up_arrow"},
-
- {XtNupperCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(adjust_upper_cursor), XtRString, "sb_up_arrow"},
- {XtNlowerCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(adjust_lower_cursor), XtRString, "sb_down_arrow"},
- {XtNleftCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(adjust_left_cursor), XtRString, "sb_left_arrow"},
- {XtNrightCursor, XtCCursor, XtRCursor, sizeof(Cursor),
- offset(adjust_right_cursor), XtRString, "sb_right_arrow"},
+ {
+ XtNinternalBorderColor,
+ XtCBorderColor,
+ XtRPixel,
+ sizeof(Pixel),
+ offset(internal_bp),
+ XtRString,
+ (XtPointer)XtDefaultForeground
+ },
+ {
+ XtNinternalBorderWidth,
+ XtCBorderWidth,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(internal_bw),
+ XtRImmediate,
+ (XtPointer)1
+ },
+ {
+ XtNgripIndent,
+ XtCGripIndent,
+ XtRPosition,
+ sizeof(Position),
+ offset(grip_indent),
+ XtRImmediate,
+ (XtPointer)10
+ },
+ {
+ XtNrefigureMode,
+ XtCBoolean,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(refiguremode),
+ XtRImmediate,
+ (XtPointer)True
+ },
+ {
+ XtNgripTranslations,
+ XtCTranslations,
+ XtRTranslationTable,
+ sizeof(XtTranslations),
+ offset(grip_translations),
+ XtRString,
+ (XtPointer)defGripTranslations
+ },
+ {
+ XtNorientation,
+ XtCOrientation,
+ XtROrientation,
+ sizeof(XtOrientation),
+ offset(orientation),
+ XtRImmediate,
+ (XtPointer)XtorientVertical
+ },
+ {
+ XtNcursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(cursor),
+ XtRImmediate,
+ None
+ },
+ {
+ XtNgripCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(grip_cursor),
+ XtRImmediate,
+ None
+ },
+ {
+ XtNverticalGripCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(v_grip_cursor),
+ XtRString,
+ "sb_v_double_arrow"
+ },
+ {
+ XtNhorizontalGripCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(h_grip_cursor),
+ XtRString,
+ "sb_h_double_arrow"
+ },
+ {
+ XtNbetweenCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(adjust_this_cursor),
+ XtRString,
+ None
+ },
+ {
+ XtNverticalBetweenCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(v_adjust_this_cursor),
+ XtRString,
+ "sb_left_arrow"
+ },
+ {
+ XtNhorizontalBetweenCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(h_adjust_this_cursor),
+ XtRString,
+ "sb_up_arrow"
+ },
+ {
+ XtNupperCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(adjust_upper_cursor),
+ XtRString,
+ "sb_up_arrow"
+ },
+ {
+ XtNlowerCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(adjust_lower_cursor),
+ XtRString,
+ "sb_down_arrow"
+ },
+ {
+ XtNleftCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(adjust_left_cursor),
+ XtRString,
+ "sb_left_arrow"
+ },
+ {
+ XtNrightCursor,
+ XtCCursor,
+ XtRCursor,
+ sizeof(Cursor),
+ offset(adjust_right_cursor),
+ XtRString,
+ "sb_right_arrow"
+ },
};
-
#undef offset
#define offset(field) XtOffsetOf(PanedConstraintsRec, paned.field)
-
static XtResource subresources[] = {
- {XtNallowResize, XtCBoolean, XtRBoolean, sizeof(Boolean),
- offset(allow_resize), XtRImmediate, (XtPointer) FALSE},
- {XtNposition, XtCPosition, XtRInt, sizeof(int),
- offset(position), XtRImmediate, (XtPointer) 0},
- {XtNmin, XtCMin, XtRDimension, sizeof(Dimension),
- offset(min), XtRImmediate, (XtPointer) PANED_GRIP_SIZE},
- {XtNmax, XtCMax, XtRDimension, sizeof(Dimension),
- offset(max), XtRImmediate, (XtPointer) ~0},
- {XtNpreferredPaneSize, XtCPreferredPaneSize, XtRDimension,
- sizeof(Dimension), offset(preferred_size),
- XtRImmediate, (XtPointer) PANED_ASK_CHILD},
- {XtNresizeToPreferred, XtCBoolean, XtRBoolean, sizeof(Boolean),
- offset(resize_to_pref), XtRImmediate, (XtPointer) FALSE},
- {XtNskipAdjust, XtCBoolean, XtRBoolean, sizeof(Boolean),
- offset(skip_adjust), XtRImmediate, (XtPointer) FALSE},
- {XtNshowGrip, XtCShowGrip, XtRBoolean, sizeof(Boolean),
- offset(show_grip), XtRImmediate, (XtPointer) TRUE},
+ {
+ XtNallowResize,
+ XtCBoolean,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(allow_resize),
+ XtRImmediate,
+ (XtPointer)False
+ },
+ {
+ XtNposition,
+ XtCPosition,
+ XtRInt,
+ sizeof(int),
+ offset(position),
+ XtRImmediate,
+ (XtPointer)0
+ },
+ {
+ XtNmin,
+ XtCMin,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(min),
+ XtRImmediate,
+ (XtPointer)PANED_GRIP_SIZE
+ },
+ {
+ XtNmax,
+ XtCMax,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(max),
+ XtRImmediate,
+ (XtPointer)~0
+ },
+ {
+ XtNpreferredPaneSize,
+ XtCPreferredPaneSize,
+ XtRDimension,
+ sizeof(Dimension),
+ offset(preferred_size),
+ XtRImmediate,
+ (XtPointer)PANED_ASK_CHILD
+ },
+ {
+ XtNresizeToPreferred,
+ XtCBoolean,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(resize_to_pref),
+ XtRImmediate,
+ (XtPointer)False
+ },
+ {
+ XtNskipAdjust,
+ XtCBoolean,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(skip_adjust),
+ XtRImmediate,
+ (XtPointer)False
+ },
+ {
+ XtNshowGrip,
+ XtCShowGrip,
+ XtRBoolean,
+ sizeof(Boolean),
+ offset(show_grip),
+ XtRImmediate,
+ (XtPointer)True
+ },
};
-
#undef offset
-static void ClassInitialize(), Initialize();
-static void Realize(), Resize();
-static void Redisplay();
-static void GetGCs(), ReleaseGCs();
-static void RefigureLocationsAndCommit();
-static Boolean SetValues();
-static XtGeometryResult GeometryManager();
-static void ChangeManaged();
-static void InsertChild();
-static void DeleteChild();
-static Boolean PaneSetValues();
-static Dimension PaneSize(), GetRequestInfo();
-static Boolean SatisfiesRule1(), SatisfiesRule2(), SatisfiesRule3();
-
-static void PushPaneStack();
-static void GetPaneStack();
-static Boolean PopPaneStack();
-static void ClearPaneStack();
-
#define SuperClass ((ConstraintWidgetClass)&constraintClassRec)
PanedClassRec panedClassRec = {
+ /* core */
{
-/* core class fields */
- /* superclass */ (WidgetClass) SuperClass,
- /* class name */ "Paned",
- /* size */ sizeof(PanedRec),
- /* class_initialize */ ClassInitialize,
- /* class_part init */ NULL,
- /* class_inited */ FALSE,
- /* initialize */ Initialize,
- /* initialize_hook */ NULL,
- /* realize */ Realize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* resource_count */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ TRUE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ TRUE,
- /* visible_interest */ FALSE,
- /* destroy */ ReleaseGCs,
- /* resize */ Resize,
- /* expose */ Redisplay,
- /* set_values */ SetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback_private */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ XtInheritQueryGeometry,
- /* display_accelerator*/ XtInheritDisplayAccelerator,
- /* extension */ NULL
- }, {
-/* composite class fields */
- /* geometry_manager */ GeometryManager,
- /* change_managed */ ChangeManaged,
- /* insert_child */ InsertChild,
- /* delete_child */ DeleteChild,
- /* extension */ NULL
- }, {
-/* constraint class fields */
- /* subresources */ subresources,
- /* subresource_count */ XtNumber(subresources),
- /* constraint_size */ sizeof(PanedConstraintsRec),
- /* initialize */ NULL,
- /* destroy */ NULL,
- /* set_values */ PaneSetValues,
- /* extension */ NULL
- }
+ (WidgetClass)SuperClass, /* superclass */
+ "Paned", /* class name */
+ sizeof(PanedRec), /* size */
+ XawPanedClassInitialize, /* class_initialize */
+ NULL, /* class_part init */
+ False, /* class_inited */
+ XawPanedInitialize, /* initialize */
+ NULL, /* initialize_hook */
+ XawPanedRealize, /* realize */
+ NULL, /* actions */
+ 0, /* num_actions */
+ resources, /* resources */
+ XtNumber(resources), /* num_resources */
+ NULLQUARK, /* xrm_class */
+ True, /* compress_motion */
+ True, /* compress_exposure */
+ True, /* compress_enterleave */
+ False, /* visible_interest */
+ XawPanedDestroy, /* destroy */
+ XawPanedResize, /* resize */
+ XawPanedRedisplay, /* expose */
+ XawPanedSetValues, /* set_values */
+ NULL, /* set_values_hook */
+ XtInheritSetValuesAlmost, /* set_values_almost */
+ NULL, /* get_values_hook */
+ NULL, /* accept_focus */
+ XtVersion, /* version */
+ NULL, /* callback_private */
+ NULL, /* tm_table */
+ XtInheritQueryGeometry, /* query_geometry */
+ XtInheritDisplayAccelerator, /* display_accelerator */
+ NULL, /* extension */
+ },
+ /* composite */
+ {
+ XawPanedGeometryManager, /* geometry_manager */
+ XawPanedChangeManaged, /* change_managed */
+ XawPanedInsertChild, /* insert_child */
+ XawPanedDeleteChild, /* delete_child */
+ NULL, /* extension */
+ },
+ /* constraint */
+ {
+ subresources, /* subresources */
+ XtNumber(subresources), /* subresource_count */
+ sizeof(PanedConstraintsRec), /* constraint_size */
+ NULL, /* initialize */
+ NULL, /* destroy */
+ XawPanedPaneSetValues, /* set_values */
+ NULL, /* extension */
+ },
};
-WidgetClass panedWidgetClass = (WidgetClass) &panedClassRec;
+WidgetClass panedWidgetClass = (WidgetClass)&panedClassRec;
+WidgetClass vPanedWidgetClass = (WidgetClass)&panedClassRec;
-/* For compatibility. */
-WidgetClass vPanedWidgetClass = (WidgetClass) &panedClassRec;
-
-/***********************************************************
+/*
+ * Implementation
+ */
+/* Function:
+ * AdjustPanedSize
*
- * Private Functions.
+ * Parameters:
+ * pw - paned widget to adjust
+ * off_size - new off_size to use
+ * result_ret - result of query (return)
+ * on_size_ret - new on_size (return)
+ * off_size_ret - new off_size (return)
*
- ************************************************************/
-
-/* Function Name: AdjustPanedSize
- * Description: Adjusts the size of the pane.
- * Arguments: pw - the paned widget to adjust.
- * off_size - the new off_size to use.
- * result_ret - result of query ** RETURNED **
- * on_size_ret - the new on_size ** RETURNED **
- * off_size_ret - the new off_size ** RETURNED **
- * Returns: the amount of change in size.
+ * Description:
+ * Adjusts the size of the pane.
+ *
+ * Returns:
+ * amount of change in size
*/
-
static void
-AdjustPanedSize(pw, off_size, result_ret, on_size_ret, off_size_ret)
-PanedWidget pw;
-Dimension off_size;
-XtGeometryResult * result_ret;
-Dimension * on_size_ret, * off_size_ret;
+AdjustPanedSize(PanedWidget pw, unsigned int off_size,
+ XtGeometryResult *result_ret,
+ Dimension *on_size_ret, Dimension *off_size_ret)
{
- Dimension old_size = PaneSize( (Widget) pw, IsVert(pw));
+ Dimension old_size = PaneSize((Widget)pw, IsVert(pw));
Dimension newsize = 0;
- Widget * childP;
+ Widget *childP;
XtWidgetGeometry request, reply;
+
request.request_mode = CWWidth | CWHeight;
ForAllPanes(pw, childP) {
- int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min);
- AssignMin(size, (int) PaneInfo(*childP)->max);
- newsize += size + pw->paned.internal_bw;
+ int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min);
+
+ AssignMin(size, (int)PaneInfo(*childP)->max);
+ newsize += size + pw->paned.internal_bw;
}
newsize -= pw->paned.internal_bw;
- if (newsize < 1) newsize = 1;
+ if (newsize < 1)
+ newsize = 1;
- if ( IsVert(pw) ) {
- request.width = off_size;
+ if (IsVert(pw)) {
+ request.width = off_size;
request.height = newsize;
}
else {
- request.width = newsize;
+ request.width = newsize;
request.height = off_size;
}
if (result_ret != NULL) {
- request.request_mode |= XtCWQueryOnly;
-
- *result_ret = XtMakeGeometryRequest( (Widget) pw, &request, &reply );
- _XawImCallVendorShellExtResize( (Widget) pw );
-
- if ( (newsize == old_size) || (*result_ret == XtGeometryNo) ) {
- *on_size_ret = old_size;
- *off_size_ret = off_size;
- return;
- }
- if (*result_ret != XtGeometryAlmost) {
- *on_size_ret = GetRequestInfo( &request, IsVert(pw) );
- *off_size_ret = GetRequestInfo( &request, !IsVert(pw) );
- return;
- }
- *on_size_ret = GetRequestInfo( &reply, IsVert(pw) );
- *off_size_ret = GetRequestInfo( &reply, !IsVert(pw) );
- return;
- }
-
- if (newsize == old_size) return;
+ request.request_mode |= XtCWQueryOnly;
- if (XtMakeGeometryRequest( (Widget) pw,
- &request, &reply) == XtGeometryAlmost)
- XtMakeGeometryRequest( (Widget) pw, &reply, &request);
-}
-
-/* Function Name: PaneSize
- * Description: returns the width or height of the pane depending
- * upon the orientation we are using.
- * Arguments: w - and widget.
- * vertical - TRUE if this is vertically oriented pane.
- * Returns: the size requested
- *
- * vertical - return height
- * !vertical - return width
- */
+ *result_ret = XtMakeGeometryRequest((Widget)pw, &request, &reply);
+ _XawImCallVendorShellExtResize((Widget)pw);
-static Dimension
-PaneSize(w, vertical)
-Widget w;
-Boolean vertical;
-{
- if (vertical) return (w->core.height);
- return (w->core.width);
-}
+ if (newsize == old_size || *result_ret == XtGeometryNo) {
+ *on_size_ret = old_size;
+ *off_size_ret = off_size;
+ return;
+ }
+ if (*result_ret != XtGeometryAlmost) {
+ *on_size_ret = GetRequestInfo(&request, IsVert(pw));
+ *off_size_ret = GetRequestInfo(&request, !IsVert(pw));
+ return;
+ }
+ *on_size_ret = GetRequestInfo(&reply, IsVert(pw));
+ *off_size_ret = GetRequestInfo(&reply, !IsVert(pw));
+ return;
+ }
-/* Function Name: GetRequestInfo
- * Description: returns request information.
- * Arguments: geo_struct - a geometry struct to get information out of.
- * vert - TRUE if this is a vertical paned widget.
- * Returns: the request information.
- */
+ if (newsize == old_size)
+ return;
-static Dimension
-GetRequestInfo(geo_struct, vert)
-XtWidgetGeometry * geo_struct;
-Boolean vert;
-{
- if ( vert ) return ( (Dimension) geo_struct->height);
- return ( (Dimension) geo_struct->width);
+ if (XtMakeGeometryRequest((Widget)pw, &request, &reply) == XtGeometryAlmost)
+ XtMakeGeometryRequest((Widget)pw, &reply, &request);
}
-/* Function Name: ChoosePaneToResize.
- * Description: This function chooses a pane to resize.
- * They are chosen using the following rules:
- *
- * 1) size < max && size > min
- * 2) skip adjust == FALSE
- * 3) widget not its prefered height &&
- * this change will bring it closer &&
- * The user has not resized this pane.
- *
- * If no widgets are found that fits all the rules then
- * rule #3 is broken.
- * If there are still no widgets found than
- * rule #2 is broken.
- * Rule #1 is never broken.
- * If no widgets are found then NULL is returned.
+/*
+ * Function:
+ * ChoosePaneToResize.
+ *
+ * Parameters:
+ * pw - paned widget
+ * paneindex - index of the current pane
+ * dir - direction to search first
+ * shrink - True if we need to shrink a pane, False otherwise
+ *
+ * Description:
+ * This function chooses a pane to resize.
+ They are chosen using the following rules:
+ *
+ * 1) size < max && size > min
+ * 2) skip adjust == False
+ * 3) widget not its prefered height
+ * && this change will bring it closer
+ * && The user has not resized this pane.
+ *
+ * If no widgets are found that fits all the rules then
+ * rule #3 is broken.
+ * If there are still no widgets found than
+ * rule #2 is broken.
+ * Rule #1 is never broken.
+ * If no widgets are found then NULL is returned.
*
- * Arguments: pw - the paned widget.
- * paneindex - the index of the current pane.
- * dir - direction to search first.
- * shrink - TRUE if we need to shrink a pane, FALSE otherwise.
- * Returns: pane to resize or NULL.
+ * Returns:
+ * pane to resize or NULL
*/
-
static Pane
-ChoosePaneToResize(pw, paneindex, dir, shrink)
-PanedWidget pw;
-int paneindex;
-Direction dir;
-Boolean shrink;
+ChoosePaneToResize(PanedWidget pw, int paneindex, Direction dir, Bool shrink)
{
Widget *childP;
int rules = 3;
Direction _dir = dir;
int _index = paneindex;
- if ( (paneindex == NO_INDEX) || (dir == AnyPane) ) { /* Use defaults. */
- _dir = LowRightPane; /* Go up. - really. */
- _index = pw->paned.num_panes - 1; /* Start the last pane, and work
- backwards. */
+ if (paneindex == NO_INDEX || dir == AnyPane) { /* Use defaults */
+ _dir = LowRightPane; /* Go up - really */
+ _index = pw->paned.num_panes - 1; /* Start the last pane, and work
+ backwards */
}
childP = pw->composite.children + _index;
- /* CONSTCOND */
- while(TRUE) {
- Pane pane = PaneInfo(*childP);
-
- if ( (rules < 3 || SatisfiesRule3(pane, shrink)) &&
- (rules < 2 || SatisfiesRule2(pane)) &&
- (SatisfiesRule1(pane, shrink)) &&
- ((paneindex != PaneIndex(*childP)) || (dir == AnyPane)) )
- return(pane);
-
-/*
- * This is counter-intuitive, but if we are resizing the pane
- * above the grip we want to choose a pane below the grip to lose,
- * and visa-versa.
- */
-
- if (_dir == LowRightPane) --childP; else ++childP;
-
-/*
- * If we have come to and edge then reduce the rule set, and try again.
- * If we are reduced the rules to none, then return NULL.
- */
+ /*CONSTCOND*/
+ while(True) {
+ Pane pane = PaneInfo(*childP);
- if ( (childP - pw->composite.children < 0) ||
- (childP - pw->composite.children >= pw->paned.num_panes) ) {
- if (--rules < 1) /* less strict rules. */
- return(NULL);
+ if ((rules < 3 || SatisfiesRule3(pane, shrink))
+ && (rules < 2 || SatisfiesRule2(pane))
+ && SatisfiesRule1(pane, shrink)
+ && (paneindex != PaneIndex(*childP) || dir == AnyPane))
+ return (pane);
+
+ /*
+ * This is counter-intuitive, but if we are resizing the pane
+ * above the grip we want to choose a pane below the grip to lose,
+ * and visa-versa
+ */
+ if (_dir == LowRightPane)
+ --childP;
+ else
+ ++childP;
+
+ /*
+ * If we have come to and edge then reduce the rule set, and try again
+ * If we are reduced the rules to none, then return NULL
+ */
+ if ((childP - pw->composite.children) < 0 ||
+ (childP - pw->composite.children) >= pw->paned.num_panes) {
+ if (--rules < 1) /* less strict rules */
+ return (NULL);
childP = pw->composite.children + _index;
}
}
}
-/* Function Name: StatisfiesRule1
- * Description: check for to see if this pane satisfies rule 1.
- * Arguments: pane - the pane to check.
- * shrink -TRUE if we want to shrink this pane, FALSE otherwise
- * Returns: TRUE if the rule is satisfied.
- */
-
-static Boolean
-SatisfiesRule1(pane, shrink)
-Pane pane;
-Boolean shrink;
-{
- return( (shrink && (pane->size != pane->min)) ||
- (!shrink && (pane->size != pane->max)) );
-}
-
-/* Function Name: StatisfiesRule2
- * Description: check for to see if this pane satisfies rule 2.
- * Arguments: pane - the pane to check.
- * Returns: TRUE if the rule is satisfied.
- */
-
-static Boolean
-SatisfiesRule2(pane)
-Pane pane;
-{
- return(!pane->skip_adjust || pane->paned_adjusted_me);
-}
-
-/* Function Name: StatisfiesRule3
- * Description: check for to see if this pane satisfies rule 3.
- * Arguments: pane - the pane to check.
- * shrink -TRUE if we want to shrink this pane, FALSE otherwise
- * Returns: TRUE if the rule is satisfied.
- */
-
-static Boolean
-SatisfiesRule3(pane, shrink)
-Pane pane;
-Boolean shrink;
-{
- return ( pane->paned_adjusted_me &&
- ( (shrink && ((int)pane->wp_size <= pane->size)) ||
- (!shrink && ((int)pane->wp_size >= pane->size))) );
-}
-
-/* Function Name: LoopAndRefigureChildren.
- * Description: if we are resizing either the UpleftPane or LowRight Pane
- * loop through all the children to see if any will allow us
- * to resize them.
- * Arguments: pw - the paned widget.
- * paneindex - the number of the pane border we are moving.
- * dir - the pane to move (either UpLeftPane or LowRightPane).
- * sizeused - current amount of space used.
- * THIS VALUE IS USED AND RETURNED.
- * Returns: none.
+/*
+ * Function:
+ * LoopAndRefigureChildren
+ *
+ * Parameters:
+ * pw - paned widget
+ * paneindex - number of the pane border we are moving
+ * dir - pane to move (either UpLeftPane or LowRightPane)
+ * sizeused - current amount of space used (used and returned)
+ *
+ * Description:
+ * If we are resizing either the UpleftPane or LowRight Pane loop
+ * through all the children to see if any will allow us to resize them.
*/
-
static void
-LoopAndRefigureChildren(pw, paneindex, dir, sizeused)
-PanedWidget pw;
-int paneindex, *sizeused;
-Direction dir;
+LoopAndRefigureChildren(PanedWidget pw, int paneindex, Direction dir,
+ int *sizeused)
{
- int pane_size = (int) PaneSize( (Widget) pw, IsVert(pw));
+ int pane_size = (int)PaneSize((Widget)pw, IsVert(pw));
Boolean shrink = (*sizeused > pane_size);
- if (dir == LowRightPane) paneindex++;
-
- while (*sizeused != pane_size) { /* While all panes do not fit properly. */
-/*
- * Choose a pane to resize.
- * First look on the Pane Stack, and then go hunting for another one.
- * If we fail to find a pane to resize then give up.
- */
- Pane pane;
+ if (dir == LowRightPane)
+ paneindex++;
+
+ /* While all panes do not fit properly */
+ while (*sizeused != pane_size) {
+ /*
+ * Choose a pane to resize
+ * First look on the Pane Stack, and then go hunting for another one
+ * If we fail to find a pane to resize then give up
+ */
+ Pane pane;
int start_size;
Dimension old;
- Boolean rule3_ok = FALSE, from_stack = TRUE;
+ Boolean rule3_ok = False, from_stack = True;
GetPaneStack(pw, shrink, &pane, &start_size);
if (pane == NULL) {
pane = ChoosePaneToResize(pw, paneindex, dir, shrink);
if (pane == NULL)
- return; /* no one to resize, give up. */
+ return; /* no one to resize, give up */
rule3_ok = SatisfiesRule3(pane, shrink);
- from_stack = FALSE;
+ from_stack = False;
PushPaneStack(pw, pane);
}
-
-/*
- * Try to resize this pane so that all panes will fit, take min and max
- * into account.
- */
+ /*
+ * Try to resize this pane so that all panes will fit, take min and max
+ * into account
+ */
old = pane->size;
pane->size += pane_size - *sizeused;
if (from_stack) {
if (shrink) {
- AssignMax(pane->size, start_size);
- } /* don't remove these braces. */
+ AssignMax(pane->size, start_size);
+ } /* don't remove these braces */
else
- AssignMin(pane->size, start_size);
+ AssignMin(pane->size, start_size);
- if (pane->size == start_size) (void) PopPaneStack(pw);
+ if (pane->size == start_size)
+ (void)PopPaneStack(pw);
}
else if (rule3_ok) {
if (shrink) {
- AssignMax(pane->size, (int) pane->wp_size);
- } /* don't remove these braces. */
+ AssignMax(pane->size, (int)pane->wp_size);
+ } /* don't remove these braces */
else
- AssignMin(pane->size, (int) pane->wp_size);
+ AssignMin(pane->size, (int)pane->wp_size);
}
- pane->paned_adjusted_me = (pane->size != pane->wp_size);
- AssignMax(pane->size, (int) pane->min);
- AssignMin(pane->size, (int) pane->max);
+ pane->paned_adjusted_me = pane->size != pane->wp_size;
+ AssignMax(pane->size, (int)pane->min);
+ AssignMin(pane->size, (int)pane->max);
*sizeused += (pane->size - old);
}
}
-/* Function Name: RefigureLocations
- * Description: refigures all locations of children.
- * Arguments: pw - the paned widget.
- * paneindex - child to start refiguring at.
- * dir - direction to move from child.
- * Returns: none.
+/*
+ * Function:
+ * RefigureLocations
*
+ * Parameters:
+ * pw - paned widget
+ * paneindex - child to start refiguring at
+ * dir - direction to move from child
+ *
+ * Description:
+ * Refigures all locations of children.
* There are special arguments to paneindex and dir, they are:
* paneindex - NO_INDEX.
* dir - AnyPane.
@@ -588,44 +727,39 @@ Direction dir;
* the choosing of panes procedes in reverse order starting with the
* last child.
*/
-
static void
-RefigureLocations(pw, paneindex, dir)
-PanedWidget pw;
-int paneindex;
-Direction dir;
+RefigureLocations(PanedWidget pw, int paneindex, Direction dir)
{
Widget *childP;
- int pane_size = (int) PaneSize( (Widget) pw, IsVert(pw) );
+ int pane_size = (int)PaneSize((Widget)pw, IsVert(pw));
int sizeused = 0;
Position loc = 0;
- if (pw->paned.num_panes == 0 || !pw->paned.refiguremode) return;
-
-/*
- * Get an initial estimate of the size we will use.
- */
+ if (pw->paned.num_panes == 0 || !pw->paned.refiguremode)
+ return;
+ /*
+ * Get an initial estimate of the size we will use
+ */
ForAllPanes(pw, childP) {
- Pane pane = PaneInfo(*childP);
+ Pane pane = PaneInfo(*childP);
+
AssignMax(pane->size, (int) pane->min);
AssignMin(pane->size, (int) pane->max);
- sizeused += (int) pane->size + (int) pw->paned.internal_bw;
+ sizeused += (int)pane->size + (int)pw->paned.internal_bw;
}
- sizeused -= (int) pw->paned.internal_bw;
-
- if ( (dir != ThisBorderOnly) && (sizeused != pane_size) )
- LoopAndRefigureChildren(pw, paneindex, dir, &sizeused);
-
-/*
- * If we still are not the right size, then tell the pane that
- * wanted to resize that it can't.
- */
+ sizeused -= (int)pw->paned.internal_bw;
+ if (dir != ThisBorderOnly && sizeused != pane_size)
+ LoopAndRefigureChildren(pw, paneindex, dir, &sizeused);
- if ( (paneindex != NO_INDEX) && (dir != AnyPane) ) {
+ /*
+ * If we still are not the right size, then tell the pane that
+ * wanted to resize that it can't
+ */
+ if (paneindex != NO_INDEX && dir != AnyPane) {
Pane pane = PaneInfo(*(pw->composite.children + paneindex));
- Dimension old = pane->size;
+ Dimension old = pane->size;
pane->size += pane_size - sizeused;
AssignMax(pane->size, (int) pane->min);
@@ -633,28 +767,30 @@ Direction dir;
sizeused += pane->size - old;
}
-/*
- * It is possible that the panes will not fit inside the vpaned widget, but
- * we have tried out best.
- *
- * Assign each pane a location.
- */
-
+ /*
+ * It is possible that the panes will not fit inside the vpaned widget, but
+ * we have tried out best
+ *
+ * Assign each pane a location
+ */
ForAllPanes(pw, childP) {
- PaneInfo(*childP)->delta = loc;
- loc += PaneInfo(*childP)->size + pw->paned.internal_bw;
+ PaneInfo(*childP)->delta = loc;
+ loc += PaneInfo(*childP)->size + pw->paned.internal_bw;
}
}
-/* Function Name: CommitNewLocations
- * Description: Commits all of the previously figured locations.
- * Arguments: pw - the paned widget.
- * Returns: none.
+/*
+ * Function:
+ * CommitNewLocations
+ *
+ * Parameters:
+ * pw - paned widget
+ *
+ * Description:
+ * Commits all of the previously figured locations.
*/
-
static void
-CommitNewLocations(pw)
-PanedWidget pw;
+CommitNewLocations(PanedWidget pw)
{
Widget *childP;
XWindowChanges changes;
@@ -663,159 +799,157 @@ PanedWidget pw;
ForAllPanes(pw, childP) {
Pane pane = PaneInfo(*childP);
- Widget grip = pane->grip; /* may be NULL. */
+ Widget grip = pane->grip; /* may be NULL */
if (IsVert(pw)) {
XtMoveWidget(*childP, (Position) 0, pane->delta);
- XtResizeWidget(*childP, pw->core.width, (Dimension) pane->size,
- (Dimension) 0);
-
- if (HasGrip(*childP)) { /* Move and Display the Grip */
- changes.x = pw->core.width - pw->paned.grip_indent -
- grip->core.width - grip->core.border_width*2;
- changes.y = (*childP)->core.y + (*childP)->core.height -
- grip->core.height/2 - grip->core.border_width +
- pw->paned.internal_bw/2;
+ XtResizeWidget(*childP, XtWidth(pw), pane->size, 0);
+
+ if (HasGrip(*childP)) { /* Move and Display the Grip */
+ changes.x = XtWidth(pw) - pw->paned.grip_indent -
+ XtWidth(grip) - (XtBorderWidth(grip) << 1);
+ changes.y = XtY(*childP) + XtHeight(*childP) -
+ (XtHeight(grip) >> 1) - XtBorderWidth(grip) +
+ (pw->paned.internal_bw >> 1);
}
}
else {
- XtMoveWidget(*childP, pane->delta, (Position) 0);
- XtResizeWidget(*childP, (Dimension) pane->size, pw->core.height,
- (Dimension) 0);
-
-
- if (HasGrip(*childP)) { /* Move and Display the Grip */
- changes.x = (*childP)->core.x + (*childP)->core.width -
- grip->core.width/2 - grip->core.border_width +
- pw->paned.internal_bw/2;
- changes.y = pw->core.height - pw->paned.grip_indent -
- grip->core.height - grip->core.border_width*2;
+ XtMoveWidget(*childP, pane->delta, 0);
+ XtResizeWidget(*childP, pane->size, XtHeight(pw), 0);
+
+ if (HasGrip(*childP)) { /* Move and Display the Grip */
+ changes.x = XtX(*childP) + XtWidth(*childP) -
+ (XtWidth(grip) >> 1) - XtBorderWidth(grip) +
+ (pw->paned.internal_bw >> 1);
+ changes.y = XtHeight(pw) - pw->paned.grip_indent -
+ XtHeight(grip) - (XtBorderWidth(grip) << 1);
}
}
-/*
- * This should match XtMoveWidget, except that we're also insuring the
- * grip is Raised in the same request.
- */
+ /*
+ * This should match XtMoveWidget, except that we're also insuring the
+ * grip is Raised in the same request
+ */
if (HasGrip(*childP)) {
- grip->core.x = changes.x;
- grip->core.y = changes.y;
+ XtX(grip) = changes.x;
+ XtY(grip) = changes.y;
if (XtIsRealized(pane->grip))
- XConfigureWindow( XtDisplay(pane->grip), XtWindow(pane->grip),
- CWX | CWY | CWStackMode, &changes );
+ XConfigureWindow(XtDisplay(pane->grip), XtWindow(pane->grip),
+ CWX | CWY | CWStackMode, &changes);
}
}
ClearPaneStack(pw);
}
-/* Function Name: RefigureLocationsAndCommit
- * Description: Refigures all locations in a paned widget and
- * commits them immediately.
- * Arguments: pw - the paned widget.
- * Returns: none
+/*
+ * Function:
+ * RefigureLocationsAndCommit
+ *
+ * Parameters:
+ * pw - paned widget
+ *
+ * Description:
+ * Refigures all locations in a paned widget and commits them immediately.
*
* This function does nothing if any of the following are true.
* o refiguremode is false.
* o The widget is unrealized.
* o There are no panes is the paned widget.
- *
- * NOTE: This is the resize Procedure for the Paned widget.
*/
-
static void
-RefigureLocationsAndCommit(w)
-Widget w;
+RefigureLocationsAndCommit(Widget w)
{
- PanedWidget pw = (PanedWidget) w;
- if (pw->paned.refiguremode && XtIsRealized( (Widget) pw) &&
- pw->paned.num_panes > 0 ) {
+ PanedWidget pw = (PanedWidget)w;
+
+ if (pw->paned.refiguremode && XtIsRealized(w) && pw->paned.num_panes > 0) {
RefigureLocations(pw, NO_INDEX, AnyPane);
CommitNewLocations(pw);
}
}
-/* Function Name: _DrawRect
- * Description: Draws a rectangle in the proper orientation.
- * Arguments: pw - the paned widget.
- * gc - gc to used for the draw.
- * on_olc, off_loc - location of upper left corner of rect.
- * on_size, off_size - size of rectangle.
- * Returns: none
+/*
+ * Function:
+ * _DrawRect
+ *
+ * Parameters:
+ * pw - paned widget
+ * gc - gc to used for the draw
+ * on_olc - location of upper left corner of rect
+ * off_loc - ""
+ * on_size - size of rectangle
+ * off_size - ""
+ *
+ * Description:
+ * Draws a rectangle in the proper orientation.
*/
-
static void
-_DrawRect(pw, gc, on_loc, off_loc, on_size, off_size)
-PanedWidget pw;
-GC gc;
-int on_loc, off_loc;
-unsigned int on_size, off_size;
+_DrawRect(PanedWidget pw, GC gc, int on_loc, int off_loc,
+ unsigned int on_size, unsigned int off_size)
{
- if (IsVert(pw))
- XFillRectangle(XtDisplay(pw), XtWindow(pw), gc,
- off_loc, on_loc, off_size, on_size);
- else
- XFillRectangle(XtDisplay(pw), XtWindow(pw), gc,
- on_loc, off_loc, on_size, off_size);
+ if (IsVert(pw))
+ XFillRectangle(XtDisplay((Widget)pw), XtWindow((Widget)pw), gc,
+ off_loc, on_loc, off_size, on_size);
+ else
+ XFillRectangle(XtDisplay((Widget)pw), XtWindow((Widget)pw), gc,
+ on_loc, off_loc, on_size, off_size);
}
-/* Function Name: _DrawInternalBorders
- * Description: Draws the internal borders into the paned widget.
- * Arguments: pw - the paned widget.
- * gc - the GC to use to draw the borders.
- * Returns: none.
+/*
+ * Function:
+ * _DrawInternalBorders
+ *
+ * Parameters:
+ * pw - paned widget
+ * gc - GC to use to draw the borders
+ *
+ * Description:
+ * Draws the internal borders into the paned widget.
*/
-
static void
-_DrawInternalBorders(pw, gc)
-PanedWidget pw;
-GC gc;
+_DrawInternalBorders(PanedWidget pw, GC gc)
{
Widget *childP;
int on_loc, off_loc;
unsigned int on_size, off_size;
-/*
- * This is an optimization. Do not paint the internal borders if
- * they are the same color as the background.
- */
-
+ /*
+ * This is an optimization. Do not paint the internal borders if
+ * they are the same color as the background
+ */
if (pw->core.background_pixel == pw->paned.internal_bp)
return;
off_loc = 0;
- off_size = (unsigned int) PaneSize( (Widget) pw, !IsVert(pw) );
- on_size = (unsigned int) pw->paned.internal_bw;
+ off_size = (unsigned int) PaneSize((Widget)pw, !IsVert(pw));
+ on_size = (unsigned int)pw->paned.internal_bw;
ForAllPanes(pw, childP) {
- on_loc = IsVert(pw) ? (*childP)->core.y : (*childP)->core.x;
- on_loc -= (int) on_size;
+ on_loc = IsVert(pw) ? XtY(*childP) : XtX(*childP);
+ on_loc -= (int)on_size;
- _DrawRect( pw, gc, on_loc, off_loc, on_size, off_size);
+ _DrawRect(pw, gc, on_loc, off_loc, on_size, off_size);
}
}
+#define DrawInternalBorders(pw) \
+ _DrawInternalBorders((pw), (pw)->paned.normgc)
+#define EraseInternalBorders(pw) \
+ _DrawInternalBorders((pw), (pw)->paned.invgc)
/*
- * This allows good reuse of code, as well as descriptive function names.
- */
-
-#define DrawInternalBorders(pw) _DrawInternalBorders((pw), (pw)->paned.normgc);
-#define EraseInternalBorders(pw) _DrawInternalBorders((pw), (pw)->paned.invgc);
-
-/* Function Name: _DrawTrackLines
- * Description: Draws the lines that animate the pane borders when the
- * grips are moved.
- * Arguments: pw - the Paned widget.
- * erase - if True then just erase track lines, else
- * draw them in.
- * Returns: none.
+ * Function Name:
+ * _DrawTrackLines
+ *
+ * Parameters:
+ * pw - Paned widget
+ * erase - if True then just erase track lines, else draw them in
+ *
+ * Description:
+ * Draws the lines that animate the pane borders when the grips are moved.
*/
-
static void
-_DrawTrackLines(pw, erase)
-PanedWidget pw;
-Boolean erase;
+_DrawTrackLines(PanedWidget pw, Bool erase)
{
Widget *childP;
Pane pane;
@@ -823,20 +957,19 @@ Boolean erase;
unsigned int on_size, off_size;
off_loc = 0;
- off_size = PaneSize( (Widget) pw, !IsVert(pw));
+ off_size = PaneSize((Widget)pw, !IsVert(pw));
ForAllPanes(pw, childP) {
- pane = PaneInfo(*childP);
- if ( erase || (pane->olddelta != pane->delta) ) {
+ pane = PaneInfo(*childP);
+ if (erase || pane->olddelta != pane->delta) {
on_size = pw->paned.internal_bw;
if (!erase) {
- on_loc = PaneInfo(*childP)->olddelta - (int) on_size;
-
- _DrawRect( pw, pw->paned.flipgc,
+ on_loc = PaneInfo(*childP)->olddelta - (int) on_size;
+ _DrawRect(pw, pw->paned.flipgc,
on_loc, off_loc, on_size, off_size);
}
- on_loc = PaneInfo(*childP)->delta - (int) on_size;
+ on_loc = PaneInfo(*childP)->delta - (int)on_size;
_DrawRect(pw, pw->paned.flipgc,
on_loc, off_loc, on_size, off_size);
@@ -846,31 +979,31 @@ Boolean erase;
}
}
+#define DrawTrackLines(pw) _DrawTrackLines((pw), False);
+#define EraseTrackLines(pw) _DrawTrackLines((pw), True);
/*
- * This allows good reuse of code, as well as descriptive function names.
- */
-
-#define DrawTrackLines(pw) _DrawTrackLines((pw), FALSE);
-#define EraseTrackLines(pw) _DrawTrackLines((pw), TRUE);
-
-/* Function Name: GetEventLocation
- * Description: Converts and event to an x and y location.
- * Arguments: pw - the paned widget.
- * event - a pointer to an event.
- * Returns: if this is a vertical pane then (y) else (x).
+ * Function:
+ * GetEventLocation
+ *
+ * Parameters:
+ * pw - the paned widget
+ * event - pointer to an event
+ *
+ * Description:
+ * Converts and event to an x and y location.
+ *
+ * Returns:
+ * if this is a vertical pane then (y) else (x)
*/
-
static int
-GetEventLocation(pw, event)
-PanedWidget pw;
-XEvent *event;
+GetEventLocation(PanedWidget pw, XEvent *event)
{
int x, y;
switch (event->xany.type) {
- case ButtonPress:
+ case ButtonPress:
case ButtonRelease:
- x = event->xbutton.x_root;
+ x = event->xbutton.x_root;
y = event->xbutton.y_root;
break;
case KeyPress:
@@ -878,7 +1011,7 @@ XEvent *event;
x = event->xkey.x_root;
y = event->xkey.y_root;
break;
- case MotionNotify:
+ case MotionNotify:
x = event->xmotion.x_root;
y = event->xmotion.y_root;
break;
@@ -886,47 +1019,49 @@ XEvent *event;
x = pw->paned.start_loc;
y = pw->paned.start_loc;
}
+
if (IsVert(pw))
- return(y);
- return(x);
+ return (y);
+
+ return (x);
}
-/* Function Name: StartGripAdjustment
- * Description: Starts the grip adjustment procedure.
- * Arguments: pw - the paned widget.
- * grip - the grip widget selected.
- * dir - the direction that we are to be moving.
- * Returns: none.
+/*
+ * Function:
+ * StartGripAdjustment
+ *
+ * Parameters:
+ * pw - paned widget
+ * grip - grip widget selected
+ * dir - direction that we are to be moving
+ *
+ * Description:
+ * Starts the grip adjustment procedure.
*/
-
static void
-StartGripAdjustment(pw, grip, dir)
-PanedWidget pw;
-Widget grip;
-Direction dir;
+StartGripAdjustment(PanedWidget pw, Widget grip, Direction dir)
{
Widget *childP;
Cursor cursor;
- pw->paned.whichadd = pw->paned.whichsub = (Widget) NULL;
+ pw->paned.whichadd = pw->paned.whichsub = NULL;
if (dir == ThisBorderOnly || dir == UpLeftPane)
- pw->paned.whichadd = pw->composite.children[PaneIndex(grip)];
+ pw->paned.whichadd = pw->composite.children[PaneIndex(grip)];
if (dir == ThisBorderOnly || dir == LowRightPane)
- pw->paned.whichsub = pw->composite.children[PaneIndex(grip) + 1];
-
-/*
- * Change the cursor.
- */
+ pw->paned.whichsub = pw->composite.children[PaneIndex(grip) + 1];
+ /*
+ * Change the cursor
+ */
if (XtIsRealized(grip)) {
- if ( IsVert(pw) ) {
+ if (IsVert(pw)) {
if (dir == UpLeftPane)
- cursor = pw->paned.adjust_upper_cursor;
+ cursor = pw->paned.adjust_upper_cursor;
else if (dir == LowRightPane)
- cursor = pw->paned.adjust_lower_cursor;
+ cursor = pw->paned.adjust_lower_cursor;
else {
- if ( pw->paned.adjust_this_cursor == None)
+ if (pw->paned.adjust_this_cursor == None)
cursor = pw->paned.v_adjust_this_cursor;
else
cursor = pw->paned.adjust_this_cursor;
@@ -934,11 +1069,11 @@ Direction dir;
}
else {
if (dir == UpLeftPane)
- cursor = pw->paned.adjust_left_cursor;
+ cursor = pw->paned.adjust_left_cursor;
else if (dir == LowRightPane)
- cursor = pw->paned.adjust_right_cursor;
+ cursor = pw->paned.adjust_right_cursor;
else {
- if (pw->paned.adjust_this_cursor == None)
+ if (pw->paned.adjust_this_cursor == None)
cursor = pw->paned.h_adjust_this_cursor;
else
cursor = pw->paned.adjust_this_cursor;
@@ -950,252 +1085,265 @@ Direction dir;
EraseInternalBorders(pw);
ForAllPanes(pw, childP)
- PaneInfo(*childP)->olddelta = -99;
+ PaneInfo(*childP)->olddelta = -99;
+
+ EraseTrackLines(pw);
}
-/* Function Name: MoveGripAdjustment
- * Description: This routine moves all panes around when a grip is moved.
- * Arguments: pw - the paned widget.
- * grip - the grip that we are moving.
- * dir - the direction the pane we are interested is w.r.t the
- * grip.
- * loc - location of pointer in proper direction.
- * Returns: none.
+/*
+ * Function:
+ * MoveGripAdjustment
+ *
+ * Parameters:
+ * pw - paned widget
+ * grip - grip that we are moving
+ * dir - direction the pane we are interested is w.r.t the grip
+ * loc - location of pointer in proper direction
+ *
+ * Description:
+ * This routine moves all panes around when a grip is moved.
*/
-
static void
-MoveGripAdjustment(pw, grip, dir, loc)
-PanedWidget pw;
-Widget grip;
-Direction dir;
-int loc;
+MoveGripAdjustment(PanedWidget pw, Widget grip, Direction dir, int loc)
{
int diff, add_size = 0, sub_size = 0;
diff = loc - pw->paned.start_loc;
if (pw->paned.whichadd)
- add_size = PaneSize(pw->paned.whichadd, IsVert(pw) ) + diff;
+ add_size = PaneSize(pw->paned.whichadd, IsVert(pw)) + diff;
if (pw->paned.whichsub)
- sub_size = PaneSize(pw->paned.whichsub, IsVert(pw) ) - diff;
-
-/*
- * If moving this border only then do not allow either of the borders
- * to go beyond the min or max size allowed.
- */
-
- if ( (dir == ThisBorderOnly) ) {
- int old_add_size = add_size, old_sub_size;
-
- AssignMax(add_size, (int) PaneInfo(pw->paned.whichadd)->min);
- AssignMin(add_size, (int) PaneInfo(pw->paned.whichadd)->max);
- if (add_size != old_add_size)
- sub_size += old_add_size - add_size;
-
- old_sub_size = sub_size;
- AssignMax(sub_size, (int) PaneInfo(pw->paned.whichsub)->min);
- AssignMin(sub_size, (int) PaneInfo(pw->paned.whichsub)->max);
- if (sub_size != old_sub_size) return; /* Abort to current sizes. */
+ sub_size = PaneSize(pw->paned.whichsub, IsVert(pw)) - diff;
+
+ /*
+ * If moving this border only then do not allow either of the borders
+ * to go beyond the min or max size allowed
+ */
+ if (dir == ThisBorderOnly) {
+ int old_add_size = add_size, old_sub_size;
+
+ AssignMax(add_size, (int)PaneInfo(pw->paned.whichadd)->min);
+ AssignMin(add_size, (int)PaneInfo(pw->paned.whichadd)->max);
+ if (add_size != old_add_size)
+ sub_size += old_add_size - add_size;
+
+ old_sub_size = sub_size;
+ AssignMax(sub_size, (int)PaneInfo(pw->paned.whichsub)->min);
+ AssignMin(sub_size, (int)PaneInfo(pw->paned.whichsub)->max);
+ if (sub_size != old_sub_size)
+ return; /* Abort to current sizes */
}
if (add_size != 0)
- PaneInfo(pw->paned.whichadd)->size = add_size;
+ PaneInfo(pw->paned.whichadd)->size = add_size;
if (sub_size != 0)
- PaneInfo(pw->paned.whichsub)->size = sub_size;
+ PaneInfo(pw->paned.whichsub)->size = sub_size;
RefigureLocations(pw, PaneIndex(grip), dir);
DrawTrackLines(pw);
}
-/* Function Name: CommitGripAdjustment
- * Description: Commits the grip adjustment.
- * Arguments: pw - the paned widget.
- * Returns: none
+/*
+ * Function:
+ * CommitGripAdjustment
+ *
+ * Parameters:
+ * pw - paned widget
+ *
+ * Description:
+ * Commits the grip adjustment.
*/
-
static void
-CommitGripAdjustment(pw)
-PanedWidget pw;
+CommitGripAdjustment(PanedWidget pw)
{
EraseTrackLines(pw);
CommitNewLocations(pw);
DrawInternalBorders(pw);
-/*
- * Since the user selected this size then use it as the preferred size.
- */
-
+ /*
+ * Since the user selected this size then use it as the preferred size
+ */
if (pw->paned.whichadd) {
- Pane pane = PaneInfo(pw->paned.whichadd);
+ Pane pane = PaneInfo(pw->paned.whichadd);
+
pane->wp_size = pane->size;
}
if (pw->paned.whichsub) {
- Pane pane = PaneInfo(pw->paned.whichsub);
+ Pane pane = PaneInfo(pw->paned.whichsub);
+
pane->wp_size = pane->size;
}
}
-/* Function Name: HandleGrip
- * Description: Handles the grip manipulations.
- * Arguments: grip - the grip widget that has been moved.
- * junk - ** NOT USED **
- * call_data - data passed to us from the grip widget.
- * Returns: none.
+/*
+ * Function:
+ * HandleGrip
+ *
+ * Parameters:
+ * grip - grip widget that has been moved
+ * temp - (not used)
+ * call_data - data passed to us from the grip widget
+ *
+ * Description:
+ * Handles the grip manipulations.
*/
-
-/* ARGSUSED */
+/*ARGSUSED*/
static void
-HandleGrip(grip, junk, callData)
-Widget grip;
-XtPointer junk, callData;
+HandleGrip(Widget grip, XtPointer temp, XtPointer callData)
{
XawGripCallData call_data = (XawGripCallData)callData;
PanedWidget pw = (PanedWidget) XtParent(grip);
int loc;
- char action_type;
+ char action_type[2], direction[2];
Cursor cursor;
- Direction direction;
Arg arglist[1];
- action_type = *call_data->params[0];
+ if (call_data->num_params)
+ XmuNCopyISOLatin1Uppered(action_type, call_data->params[0],
+ sizeof(action_type));
- if (call_data->num_params == 0 ||
- (action_type == 'C' && call_data->num_params != 1) ||
- (action_type != 'C' && call_data->num_params != 2))
- XtError( "Paned GripAction has been passed incorrect parameters." );
+ if (call_data->num_params == 0
+ || (action_type[0] == 'C' && call_data->num_params != 1)
+ || (action_type[0] != 'C' && call_data->num_params != 2))
+ XtAppError(XtWidgetToApplicationContext(grip),
+ "Paned GripAction has been passed incorrect parameters.");
- if (islower(action_type)) action_type = toupper(action_type);
+ loc = GetEventLocation(pw, (XEvent *)call_data->event);
- loc = GetEventLocation(pw, (XEvent *) (call_data->event));
-
- if (action_type != 'C') {
- if ( isupper(*call_data->params[1]) )
- direction = (Direction) *call_data->params[1];
- else
- direction = (Direction) toupper(*call_data->params[1]);
- }
+ if (action_type[0] != 'C')
+ XmuNCopyISOLatin1Uppered(direction, call_data->params[1],
+ sizeof(direction));
- switch (action_type) {
+ switch (action_type[0]) {
case 'S': /* Start adjustment */
- pw->paned.resize_children_to_pref = FALSE;
- StartGripAdjustment(pw, grip, direction);
+ pw->paned.resize_children_to_pref = False;
+ StartGripAdjustment(pw, grip, (Direction)direction[0]);
pw->paned.start_loc = loc;
break;
-
case 'M':
- MoveGripAdjustment(pw, grip, direction, loc);
+ MoveGripAdjustment(pw, grip, (Direction)direction[0], loc);
break;
-
case 'C':
XtSetArg(arglist[0], XtNcursor, &cursor);
- XtGetValues(grip, arglist, (Cardinal) 1);
+ XtGetValues(grip, arglist, 1);
XDefineCursor(XtDisplay(grip), XtWindow(grip), cursor);
CommitGripAdjustment(pw);
break;
-
default:
- XtError( "Paned GripAction(); 1st parameter invalid" );
+ XtAppError(XtWidgetToApplicationContext(grip),
+ "Paned GripAction(); 1st parameter invalid");
+ break;
}
}
-/* Function Name: ResortChildren
- * Description: Resorts the children so that all managed children
- * are first.
- * Arguments: pw - the paned widget.
- * Returns: none.
+/*
+ * Function:
+ * ResortChildren
+ *
+ * Arguments:
+ * pw - paned widget
+ *
+ * Description:
+ * Resorts the children so that all managed children are first.
*/
-
static void
-ResortChildren(pw)
-PanedWidget pw;
+ResortChildren(PanedWidget pw)
{
- Widget * unmanagedP, * childP;
+ Widget *unmanagedP, *childP;
unmanagedP = NULL;
ForAllChildren(pw, childP) {
- if (!IsPane(*childP) || !XtIsManaged(*childP)) {
- /*
- * We only keep track of the first unmanaged pane.
- */
- if (unmanagedP == NULL)
- unmanagedP = childP;
- }
- else { /* must be a managed pane */
- /*
- * If an earlier widget was not a managed pane, then swap
- */
- if (unmanagedP != NULL) {
- Widget child = *unmanagedP;
- *unmanagedP = *childP;
- *childP = child;
- childP = unmanagedP; /* easiest to just back-track */
- unmanagedP = NULL; /* in case there is another managed */
+ if (!IsPane(*childP) || !XtIsManaged(*childP)) {
+ /*
+ * We only keep track of the first unmanaged pane
+ */
+ if (unmanagedP == NULL)
+ unmanagedP = childP;
+ }
+ else { /* must be a managed pane */
+ /*
+ * If an earlier widget was not a managed pane, then swap
+ */
+ if (unmanagedP != NULL) {
+ Widget child = *unmanagedP;
+
+ *unmanagedP = *childP;
+ *childP = child;
+ childP = unmanagedP; /* easiest to just back-track */
+ unmanagedP = NULL; /* in case there is another managed */
}
}
}
}
-/* Function Name: ManageAndUnmanageGrips
- * Description: This function manages and unmanages the grips so that
- * the managed state of each grip matches that of its pane.
- * Arguments: pw - the paned widget.
- * Returns: none.
+/*
+ * Function:
+ * ManageAndUnmanageGrips
+ *
+ * Parameters:
+ * pw - paned widget
+ *
+ * Description:
+ * This function manages and unmanages the grips so that
+ * the managed state of each grip matches that of its pane.
*/
-
static void
-ManageAndUnmanageGrips(pw)
-PanedWidget pw;
+ManageAndUnmanageGrips(PanedWidget pw)
{
- WidgetList managed_grips, unmanaged_grips;
- Widget *managedP, *unmanagedP, *childP;
- Cardinal alloc_size;
-
- alloc_size = (Cardinal) sizeof(Widget) * pw->composite.num_children / 2;
- managedP = managed_grips = (WidgetList) XtMalloc(alloc_size);
- unmanagedP = unmanaged_grips = (WidgetList) XtMalloc(alloc_size);
-
- ForAllChildren(pw, childP)
- if (IsPane(*childP) && HasGrip(*childP))
- if ( XtIsManaged(*childP) )
- *managedP++ = PaneInfo(*childP)->grip;
- else
- *unmanagedP++ = PaneInfo(*childP)->grip;
+ WidgetList managed_grips, unmanaged_grips;
+ Widget *managedP, *unmanagedP, *childP;
+ Cardinal alloc_size;
+
+ alloc_size = sizeof(Widget) * (pw->composite.num_children >> 1);
+ managedP = managed_grips = (WidgetList)XtMalloc(alloc_size);
+ unmanagedP = unmanaged_grips = (WidgetList)XtMalloc(alloc_size);
+
+ ForAllChildren(pw, childP)
+ if (IsPane(*childP) && HasGrip(*childP)) {
+ if (XtIsManaged(*childP))
+ *managedP++ = PaneInfo(*childP)->grip;
+ else
+ *unmanagedP++ = PaneInfo(*childP)->grip;
+ }
- if (managedP != managed_grips) {
- *unmanagedP++ = *--managedP; /* Last grip is never managed */
- XtManageChildren( managed_grips, (Cardinal)(managedP - managed_grips) );
- }
+ if (managedP != managed_grips) {
+ *unmanagedP++ = *--managedP; /* Last grip is never managed */
+ XtManageChildren(managed_grips, managedP - managed_grips);
+ }
- if (unmanagedP != unmanaged_grips)
- XtUnmanageChildren( unmanaged_grips,
- (Cardinal)(unmanagedP - unmanaged_grips) );
+ if (unmanagedP != unmanaged_grips)
+ XtUnmanageChildren(unmanaged_grips, unmanagedP - unmanaged_grips);
- XtFree((char *)managed_grips);
- XtFree((char *)unmanaged_grips);
+ XtFree((char *)managed_grips);
+ XtFree((char *)unmanaged_grips);
}
-/* Function Name: CreateGrip
- * Description: Creates a grip widget.
- * Arguments: child - the child that wants a grip to be created for it.
- * Returns: none.
+/*
+ * Function:
+ * CreateGrip
+ *
+ * Parameters:
+ * child - child that wants a grip to be created for it
+ *
+ * Description:
+ * Creates a grip widget.
*/
-
static void
-CreateGrip(child)
-Widget child;
+CreateGrip(Widget child)
{
- PanedWidget pw = (PanedWidget) XtParent(child);
+ PanedWidget pw = (PanedWidget)XtParent(child);
Arg arglist[2];
Cardinal num_args = 0;
Cursor cursor;
XtSetArg(arglist[num_args], XtNtranslations, pw->paned.grip_translations);
num_args++;
- if ( (cursor = pw->paned.grip_cursor) == None )
- if (IsVert(pw))
+ if ((cursor = pw->paned.grip_cursor) == None) {
+ if (IsVert(pw))
cursor = pw->paned.v_grip_cursor;
else
cursor = pw->paned.h_grip_cursor;
+ }
XtSetArg(arglist[num_args], XtNcursor, cursor);
num_args++;
@@ -1203,43 +1351,41 @@ Widget child;
arglist, num_args);
XtAddCallback(PaneInfo(child)->grip, XtNcallback,
- HandleGrip, (XtPointer) child);
+ HandleGrip, (XtPointer)child);
}
-/* Function Name: GetGCs
- * Description: Gets new GC's.
- * Arguments: w - the paned widget.
- * Returns: none.
+/*
+ * Function:
+ * GetGCs
+ *
+ * Parameters:
+ * w - paned widget
*/
-
static void
-GetGCs(w)
-Widget w;
+GetGCs(Widget w)
{
- PanedWidget pw = (PanedWidget) w;
+ PanedWidget pw = (PanedWidget)w;
XtGCMask valuemask;
XGCValues values;
-/*
- * Draw pane borders in internal border color.
- */
-
+ /*
+ * Draw pane borders in internal border color
+ */
values.foreground = pw->paned.internal_bp;
valuemask = GCForeground;
pw->paned.normgc = XtGetGC(w, valuemask, &values);
-/*
- * Erase pane borders with background color.
- */
-
+ /*
+ * Erase pane borders with background color
+ */
values.foreground = pw->core.background_pixel;
valuemask = GCForeground;
pw->paned.invgc = XtGetGC(w, valuemask, &values);
-/*
- * Draw Track lines (animate pane borders) in internal border color ^ bg color.
- */
-
+ /*
+ * Draw Track lines (animate pane borders) in
+ * internal border color ^ bg color
+ */
values.function = GXinvert;
values.plane_mask = pw->paned.internal_bp ^ pw->core.background_pixel;
values.subwindow_mode = IncludeInferiors;
@@ -1247,30 +1393,30 @@ Widget w;
pw->paned.flipgc = XtGetGC(w, valuemask, &values);
}
-/* Function Name: SetChildrenPrefSizes.
- * Description: Sets the preferred sizes of the children.
- * Arguments: pw - the paned widget.
- * Returns: none.
+/*
+ * Function:
+ * SetChildrenPrefSizes
+ *
+ * Parameters:
+ * pw - paned widget
+ *
+ * Description:
+ * Sets the preferred sizes of the children.
*/
-
static void
-SetChildrenPrefSizes(pw, off_size)
-PanedWidget pw;
-Dimension off_size;
+SetChildrenPrefSizes(PanedWidget pw, unsigned int off_size)
{
- Widget * childP;
+ Widget *childP;
Boolean vert = IsVert(pw);
XtWidgetGeometry request, reply;
ForAllPanes(pw, childP)
- if ( pw->paned.resize_children_to_pref ||
- (PaneInfo(*childP)->size == 0) ||
- (PaneInfo(*childP)->resize_to_pref) ) {
-
- if (PaneInfo(*childP)->preferred_size != PANED_ASK_CHILD)
- PaneInfo(*childP)->wp_size=PaneInfo(*childP)->preferred_size;
+ if (pw->paned.resize_children_to_pref || PaneInfo(*childP)->size == 0 ||
+ PaneInfo(*childP)->resize_to_pref) {
+ if (PaneInfo(*childP)->preferred_size != PANED_ASK_CHILD)
+ PaneInfo(*childP)->wp_size = PaneInfo(*childP)->preferred_size;
else {
- if( vert ) {
+ if(vert) {
request.request_mode = CWWidth;
request.width = off_size;
}
@@ -1279,154 +1425,156 @@ Dimension off_size;
request.height = off_size;
}
- if ((XtQueryGeometry( *childP, &request, &reply )
- == XtGeometryAlmost) &&
- (reply.request_mode = (vert ? CWHeight : CWWidth)))
+ if ((XtQueryGeometry(*childP, &request, &reply)
+ == XtGeometryAlmost)
+ && (reply.request_mode = (vert ? CWHeight : CWWidth)))
PaneInfo(*childP)->wp_size = GetRequestInfo(&reply, vert);
else
PaneInfo(*childP)->wp_size = PaneSize(*childP, vert);
- }
+ }
PaneInfo(*childP)->size = PaneInfo(*childP)->wp_size;
- }
+ }
}
-/* Function Name: ChangeAllGripCursors
- * Description: Changes all the grip cursors.
- * Arguments: pw - the paned widget.
- * Returns: none
+/*
+ * Function:
+ * ChangeAllGripCursors
+ *
+ * Parameters:
+ * pw - paned widget
+ *
+ * Description:
+ * Changes all the grip cursors.
*/
-
static void
-ChangeAllGripCursors(pw)
-PanedWidget pw;
+ChangeAllGripCursors(PanedWidget pw)
{
- Widget * childP;
+ Widget *childP;
ForAllPanes(pw, childP) {
Arg arglist[1];
Cursor cursor;
- if ( (cursor = pw->paned.grip_cursor) == None )
- if ( IsVert(pw) )
- cursor = pw->paned.v_grip_cursor;
+ if ((cursor = pw->paned.grip_cursor) == None) {
+ if (IsVert(pw))
+ cursor = pw->paned.v_grip_cursor;
else
- cursor = pw->paned.h_grip_cursor;
+ cursor = pw->paned.h_grip_cursor;
+ }
- if (HasGrip (*childP)) {
+ if (HasGrip(*childP)) {
XtSetArg(arglist[0], XtNcursor, cursor);
- XtSetValues(PaneInfo(*childP)->grip, arglist, (Cardinal) 1);
+ XtSetValues(PaneInfo(*childP)->grip, arglist, 1);
}
}
}
-/************************************************************
+/*
+ * Function:
+ * PushPaneStack
*
- * Stack Manipulation routines (Private).
+ * Parameters:
+ * pw - paned widget
+ * pane - pane that we are pushing
*
- ************************************************************/
-
-/* Function Name: PushPaneStack
- * Description: Pushes a value onto the pane stack.
- * Arguments: pw - the paned widget.
- * pane - the pane that we are pushing.
- * Returns: none.
+ * Description:
+ * Pushes a value onto the pane stack.
*/
-
static void
-PushPaneStack(pw, pane)
-PanedWidget pw;
-Pane pane;
+PushPaneStack(PanedWidget pw, Pane pane)
{
- PaneStack * stack = (PaneStack *) XtMalloc(sizeof(PaneStack));
+ PaneStack *stack = (PaneStack *)XtMalloc(sizeof(PaneStack));
- stack->next = pw->paned.stack;
- stack->pane = pane;
- stack->start_size = pane->size;
+ stack->next = pw->paned.stack;
+ stack->pane = pane;
+ stack->start_size = pane->size;
- pw->paned.stack = stack;
+ pw->paned.stack = stack;
}
-/* Function Name: GetPaneStack
- * Description: Gets the top value from the pane stack.
- * Arguments: pw - the paned widget.
- * shrink - TRUE if we want to shrink this pane,
- * FALSE otherwise.
- * ** RETURNED ** pane - the pane that we are popping.
- * ** RETURNED ** start_size - the size that this pane started at.
- * Returns: none.
+/*
+ * Function:
+ * GetPaneStack
+ *
+ * Parameters:
+ * pw - paned widget
+ * shrink - True if we want to shrink this pane, False otherwise
+ * pane - pane that we are popping (return)
+ * start_size - size that this pane started at (return)
+ *
+ * Description:
+ * Gets the top value from the pane stack.
*/
-
static void
-GetPaneStack(pw, shrink, pane, start_size)
-PanedWidget pw;
-Boolean shrink;
-Pane * pane;
-int * start_size;
+GetPaneStack(PanedWidget pw, Bool shrink, Pane *pane, int *start_size)
{
- if (pw->paned.stack == NULL) {
- *pane = NULL;
- return;
- }
+ if (pw->paned.stack == NULL) {
+ *pane = NULL;
+ return;
+ }
- *pane = pw->paned.stack->pane;
- *start_size = pw->paned.stack->start_size;
+ *pane = pw->paned.stack->pane;
+ *start_size = pw->paned.stack->start_size;
- if (shrink != ((*pane)->size > *start_size)) *pane = NULL;
+ if (shrink != ((*pane)->size > *start_size))
+ *pane = NULL;
}
-/* Function Name: PopPaneStack
- * Description: Pops the top item off the pane stack.
- * Arguments: pw - the paned widget.
- * Returns: TRUE if this is not the last element on the stack.
+/*
+ * Function:
+ * PopPaneStack
+ *
+ * Parameters:
+ * pw - paned widget
+ *
+ * Description:
+ * Pops the top item off the pane stack.
+ *
+ * Returns: True if this is not the last element on the stack
*/
-
-static Boolean
-PopPaneStack(pw)
-PanedWidget pw;
+static Bool
+PopPaneStack(PanedWidget pw)
{
- PaneStack * stack = pw->paned.stack;
+ PaneStack *stack = pw->paned.stack;
- if (stack == NULL) return(FALSE);
+ if (stack == NULL)
+ return (False);
- pw->paned.stack = stack->next;
- XtFree((char*)stack);
+ pw->paned.stack = stack->next;
+ XtFree((char *)stack);
- if (pw->paned.stack == NULL) return(FALSE);
- return(TRUE);
-}
-
-/* Function Name: ClearPaneStack
- * Description: removes all entries from the pane stack.
- * Arguments: pw - the paned widget.
- * Returns: none
- */
+ if (pw->paned.stack == NULL)
+ return (False);
-static void
-ClearPaneStack(pw)
-PanedWidget pw;
-{
- while(PopPaneStack(pw));
+ return (True);
}
-/************************************************************
+/*
+ * Function:
+ * ClearPaneStack
*
- * Semi-public routines.
+ * Parameters:
+ * pw - paned widget
*
- ************************************************************/
-
-/* Function Name: ClassInitialize
- * Description: The Paned widgets class initialization proc.
- * Arguments: none.
- * Returns: none.
+ * Description:
+ * Removes all entries from the pane stack.
*/
+static void
+ClearPaneStack(PanedWidget pw)
+{
+ while(PopPaneStack(pw))
+ ;
+}
static void
-ClassInitialize()
+XawPanedClassInitialize(void)
{
XawInitializeWidgetSet();
- XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation,
- (XtConvertArgList)NULL, (Cardinal)0 );
+ XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOrientation,
+ NULL, 0);
+ XtSetTypeConverter(XtROrientation, XtRString, XmuCvtOrientationToString,
+ NULL, 0, XtCacheNone, NULL);
}
/* The Geometry Manager only allows changes after Realize if
@@ -1442,433 +1590,406 @@ ClassInitialize()
* request will have no effect; i.e. when the requestor is already
* of the desired geometry.
*/
-
-static XtGeometryResult GeometryManager(w, request, reply)
-Widget w;
-XtWidgetGeometry *request, *reply;
+static XtGeometryResult
+XawPanedGeometryManager(Widget w, XtWidgetGeometry *request,
+ XtWidgetGeometry *reply)
{
- PanedWidget pw = (PanedWidget) XtParent(w);
+ PanedWidget pw = (PanedWidget)XtParent(w);
XtGeometryMask mask = request->request_mode;
Dimension old_size, old_wpsize, old_paned_size;
Pane pane = PaneInfo(w);
Boolean vert = IsVert(pw);
Dimension on_size, off_size;
XtGeometryResult result;
- Boolean almost = FALSE;
-
-/*
- * If any of the following is true, disallow the geometry change.
- *
- * o The paned widget is realized and allow_resize is false for the pane.
- * o The child did not ask to change the on_size.
- * o The request is not a width or height request.
- * o The requested size is the same as the current size.
- */
-
- if ( (XtIsRealized((Widget)pw) && !pane->allow_resize) ||
- !(mask & ((vert) ? CWHeight : CWWidth)) ||
- (mask & ~(CWWidth | CWHeight)) ||
- (GetRequestInfo(request, vert) == PaneSize(w, vert)) ) {
- return XtGeometryNo;
- }
-
- old_paned_size = PaneSize( (Widget) pw, vert);
+ Boolean almost = False;
+
+ /*
+ * If any of the following is true, disallow the geometry change
+ *
+ * o The paned widget is realized and allow_resize is false for the pane
+ * o The child did not ask to change the on_size
+ * o The request is not a width or height request
+ * o The requested size is the same as the current size
+ */
+
+ if ((XtIsRealized((Widget)pw) && !pane->allow_resize)
+ || !(mask & (vert ? CWHeight : CWWidth))
+ ||(mask & ~(CWWidth | CWHeight))
+ || GetRequestInfo(request, vert) == PaneSize(w, vert))
+ return (XtGeometryNo);
+
+ old_paned_size = PaneSize((Widget)pw, vert);
old_wpsize = pane->wp_size;
old_size = pane->size;
pane->wp_size = pane->size = GetRequestInfo(request, vert);
- AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), &result, &on_size,
+ AdjustPanedSize(pw, PaneSize((Widget)pw, !vert), &result, &on_size,
&off_size);
-/*
- * Fool the Refigure Locations proc to thinking that we are
- * a different on_size;
- */
+ /*
+ * Fool the Refigure Locations proc to thinking that we are
+ * a different on_size
+ */
- if (result != XtGeometryNo)
+ if (result != XtGeometryNo) {
if (vert)
- pw->core.height = on_size;
+ XtHeight(pw) = on_size;
else
- pw->core.width = on_size;
-
+ XtWidth(pw) = on_size;
+ }
+
RefigureLocations(pw, PaneIndex(w), AnyPane);
-/*
- * Set up reply struct and reset core on_size.
- */
-
+ /*
+ * Set up reply struct and reset core on_size
+ */
if (vert) {
- pw->core.height = old_paned_size;
- reply->height = pane->size;
+ XtHeight(pw) = old_paned_size;
+ reply->height = pane->size;
reply->width = off_size;
}
else {
- pw->core.width = old_paned_size;
- reply->height = off_size;
+ XtWidth(pw) = old_paned_size;
+ reply->height = off_size;
reply->width = pane->size;
}
-/*
- * IF either of the following is true.
- *
- * o There was a "off_size" request and the new "off_size" is different
- * from that requested.
- * o There was no "off_size" request and the new "off_size" is different
- *
- * o The "on_size" we will allow is different from that requested.
- *
- * THEN: set almost
- */
-
- if ( !((vert ? CWWidth : CWHeight) & mask))
- if (vert)
- request->width = w->core.width;
+ /*
+ * IF either of the following is true
+ *
+ * o There was a "off_size" request and the new "off_size" is different
+ * from that requested
+ * o There was no "off_size" request and the new "off_size" is different
+ *
+ * o The "on_size" we will allow is different from that requested
+ *
+ * THEN: set almost
+ */
+ if (!((vert ? CWWidth : CWHeight) & mask)) {
+ if (vert)
+ request->width = XtWidth(w);
else
- request->height = w->core.height;
+ request->height = XtHeight(w);
+ }
almost = GetRequestInfo(request, !vert) != GetRequestInfo(reply, !vert);
almost |= (GetRequestInfo(request, vert) != GetRequestInfo(reply, vert));
- if ( (mask & XtCWQueryOnly) || almost ) {
+ if ((mask & XtCWQueryOnly) || almost) {
pane->wp_size = old_wpsize;
pane->size = old_size;
RefigureLocations(pw, PaneIndex(w), AnyPane);
reply->request_mode = CWWidth | CWHeight;
- if (almost) return XtGeometryAlmost;
+ if (almost)
+ return (XtGeometryAlmost);
}
else {
- AdjustPanedSize(pw, PaneSize((Widget) pw, !vert),
- (XtGeometryResult *)NULL,
- (Dimension *)NULL, (Dimension *)NULL);
- CommitNewLocations( pw ); /* layout already refigured. */
+ AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), NULL, NULL, NULL);
+ CommitNewLocations(pw); /* layout already refigured */
}
- return XtGeometryDone;
+
+ return (XtGeometryDone);
}
-/* ARGSUSED */
-static void Initialize(request, new, args, num_args)
-Widget request, new;
-ArgList args;
-Cardinal *num_args;
+/*ARGSUSED*/
+static void
+XawPanedInitialize(Widget request, Widget cnew,
+ ArgList args, Cardinal *num_args)
{
- PanedWidget pw = (PanedWidget)new;
+ PanedWidget pw = (PanedWidget)cnew;
- GetGCs( (Widget) pw);
+ GetGCs((Widget)pw);
pw->paned.recursively_called = False;
pw->paned.stack = NULL;
- pw->paned.resize_children_to_pref = TRUE;
+ pw->paned.resize_children_to_pref = True;
pw->paned.num_panes = 0;
}
static void
-Realize(w, valueMask, attributes)
-Widget w;
-Mask *valueMask;
-XSetWindowAttributes *attributes;
+XawPanedRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
{
- PanedWidget pw = (PanedWidget) w;
- Widget * childP;
+ PanedWidget pw = (PanedWidget)w;
+ Widget *childP;
- if ((attributes->cursor = (pw)->paned.cursor) != None)
+ if ((attributes->cursor = pw->paned.cursor) != None)
*valueMask |= CWCursor;
- (*SuperClass->core_class.realize) (w, valueMask, attributes);
-
-/*
- * Before we commit the new locations we need to realize all the panes and
- * their grips.
- */
+ (*SuperClass->core_class.realize)(w, valueMask, attributes);
+ /*
+ * Before we commit the new locations we need to realize all the panes and
+ * their grips
+ */
ForAllPanes(pw, childP) {
- XtRealizeWidget( *childP );
- if (HasGrip (*childP))
- XtRealizeWidget( PaneInfo(*childP)->grip );
+ XtRealizeWidget(*childP);
+ if (HasGrip(*childP))
+ XtRealizeWidget(PaneInfo(*childP)->grip);
}
RefigureLocationsAndCommit(w);
- pw->paned.resize_children_to_pref = FALSE;
-} /* Realize */
+ pw->paned.resize_children_to_pref = False;
+}
static void
-ReleaseGCs(w)
-Widget w;
+XawPanedDestroy(Widget w)
+{
+ ReleaseGCs(w);
+}
+
+static void
+ReleaseGCs(Widget w)
{
PanedWidget pw = (PanedWidget)w;
- XtReleaseGC( w, pw->paned.normgc );
- XtReleaseGC( w, pw->paned.invgc );
- XtReleaseGC( w, pw->paned.flipgc );
+ XtReleaseGC(w, pw->paned.normgc);
+ XtReleaseGC(w, pw->paned.invgc);
+ XtReleaseGC(w, pw->paned.flipgc);
}
-static void InsertChild(w)
-Widget w;
+static void
+XawPanedInsertChild(Widget w)
{
- Pane pane = PaneInfo(w);
-
- /* insert the child widget in the composite children list with the */
- /* superclass insert_child routine. */
- (*SuperClass->composite_class.insert_child)(w);
-
- if (!IsPane(w)) return;
+ Pane pane = PaneInfo(w);
- /* ||| Panes will be added in the order they are created, temporarily */
+ /* insert the child widget in the composite children list with the
+ superclass insert_child routine
+ */
+ (*SuperClass->composite_class.insert_child)(w);
- if ( pane->show_grip == TRUE ) {
- CreateGrip(w);
- if (pane->min == PANED_GRIP_SIZE)
- pane->min = PaneSize(pane->grip, IsVert((PanedWidget) XtParent(w)));
- }
- else {
- if (pane->min == PANED_GRIP_SIZE)
- pane->min = 1;
- pane->grip = NULL;
- }
+ if (!IsPane(w))
+ return;
- pane->size = 0;
- pane->paned_adjusted_me = FALSE;
+ if (pane->show_grip == True) {
+ CreateGrip(w);
+ if (pane->min == PANED_GRIP_SIZE)
+ pane->min = PaneSize(pane->grip, IsVert((PanedWidget)XtParent(w)));
+ }
+ else {
+ if (pane->min == PANED_GRIP_SIZE)
+ pane->min = 1;
+ pane->grip = NULL;
+ }
-} /* InsertChild */
+ pane->size = 0;
+ pane->paned_adjusted_me = False;
+}
-static void DeleteChild(w)
-Widget w;
+static void
+XawPanedDeleteChild(Widget w)
{
/* remove the subwidget info and destroy the grip */
+ if (IsPane(w) && HasGrip(w))
+ XtDestroyWidget(PaneInfo(w)->grip);
- if ( IsPane(w) && HasGrip(w) ) XtDestroyWidget(PaneInfo(w)->grip);
-
- /* delete the child widget in the composite children list with the */
- /* superclass delete_child routine. */
- (*SuperClass->composite_class.delete_child) (w);
-
-} /* DeleteChild */
+ /* delete the child widget in the composite children list with the
+ superclass delete_child routine
+ */
+ (*SuperClass->composite_class.delete_child)(w);
+}
-static void ChangeManaged(w)
- Widget w;
+static void
+XawPanedChangeManaged(Widget w)
{
- PanedWidget pw = (PanedWidget)w;
- Boolean vert = IsVert(pw);
- Dimension size;
- Widget *childP;
-
- if (pw->paned.recursively_called++) return;
-
-/*
- * If the size is zero then set it to the size of the widest or tallest pane.
- */
+ PanedWidget pw = (PanedWidget)w;
+ Boolean vert = IsVert(pw);
+ Dimension size;
+ Widget *childP;
- if ( (size = PaneSize( (Widget) pw, !vert )) == 0) {
- size = 1;
- ForAllChildren(pw, childP)
- if ( XtIsManaged(*childP) && (PaneSize( *childP, !vert ) > size) )
- size = PaneSize( *childP, !vert );
- }
+ if (pw->paned.recursively_called++)
+ return;
- ManageAndUnmanageGrips(pw);
- pw->paned.recursively_called = False;
- ResortChildren(pw);
-
- pw->paned.num_panes = 0;
- ForAllChildren(pw, childP)
- if ( IsPane(*childP) )
- if ( XtIsManaged(*childP) ) {
- Pane pane = PaneInfo(*childP);
- if (HasGrip(*childP))
- PaneInfo(pane->grip)->position = pw->paned.num_panes;
- pane->position = pw->paned.num_panes; /*TEMPORY -CDP 3/89 */
- pw->paned.num_panes++;
- }
- else
- break; /* This list is already sorted. */
+ /*
+ * If the size is zero then set it to the size of the widest or tallest pane
+ */
- SetChildrenPrefSizes( (PanedWidget) w, size);
+ if ((size = PaneSize((Widget)pw, !vert)) == 0) {
+ size = 1;
+ ForAllChildren(pw, childP)
+ if (XtIsManaged(*childP) && (PaneSize(*childP, !vert) > size))
+ size = PaneSize(*childP, !vert);
+ }
-/*
- * ForAllPanes can now be used.
- */
+ ManageAndUnmanageGrips(pw);
+ pw->paned.recursively_called = False;
+ ResortChildren(pw);
- if ( PaneSize((Widget) pw, vert) == 0 )
- AdjustPanedSize(pw, size, (XtGeometryResult *)NULL,
- (Dimension *)NULL, (Dimension *)NULL);
+ pw->paned.num_panes = 0;
+ ForAllChildren(pw, childP)
+ if (IsPane(*childP)) {
+ if (XtIsManaged(*childP)) {
+ Pane pane = PaneInfo(*childP);
+
+ if (HasGrip(*childP))
+ PaneInfo(pane->grip)->position = pw->paned.num_panes;
+ pane->position = pw->paned.num_panes; /* TEMPORY -CDP 3/89 */
+ pw->paned.num_panes++;
+ }
+ else
+ break; /* This list is already sorted */
+ }
- if (XtIsRealized( (Widget) pw))
- RefigureLocationsAndCommit( (Widget) pw);
+ SetChildrenPrefSizes((PanedWidget) w, size);
-} /* ChangeManaged */
+ /*
+ * ForAllPanes can now be used
+ */
+ if (PaneSize((Widget) pw, vert) == 0)
+ AdjustPanedSize(pw, size, NULL, NULL, NULL);
-/* Function Name: Resize
- * Description: The paned widget's resize proc.
- * Arguments: w - the paned widget.
- * Returns: none.
- */
+ if (XtIsRealized((Widget)pw))
+ RefigureLocationsAndCommit((Widget)pw);
+}
static void
-Resize(w)
-Widget w;
+XawPanedResize(Widget w)
{
- SetChildrenPrefSizes( (PanedWidget) w,
- PaneSize(w, !IsVert((PanedWidget) w)) );
+ SetChildrenPrefSizes((PanedWidget)w,
+ PaneSize(w, !IsVert((PanedWidget)w)));
RefigureLocationsAndCommit(w);
}
-/* ARGSUSED */
+/*ARGSUSED*/
static void
-Redisplay(w, event, region)
-Widget w;
-XEvent * event; /* unused. */
-Region region; /* unused. */
+XawPanedRedisplay(Widget w, XEvent *event, Region region)
{
- DrawInternalBorders( (PanedWidget) w);
+ DrawInternalBorders((PanedWidget)w);
}
-/* ARGSUSED */
+/*ARGSUSED*/
static Boolean
-SetValues(old, request, new, args, num_args)
-Widget old, request, new;
-ArgList args;
-Cardinal *num_args;
+XawPanedSetValues(Widget old, Widget request, Widget cnew,
+ ArgList args, Cardinal *num_args)
{
- PanedWidget old_pw = (PanedWidget) old;
- PanedWidget new_pw = (PanedWidget) new;
- Boolean redisplay = FALSE;
-
- if ( (old_pw->paned.cursor != new_pw->paned.cursor) && XtIsRealized(new))
- XDefineCursor(XtDisplay(new), XtWindow(new), new_pw->paned.cursor);
-
- if ( (old_pw->paned.internal_bp != new_pw->paned.internal_bp) ||
- (old_pw->core.background_pixel != new_pw->core.background_pixel) ) {
- ReleaseGCs(old);
- GetGCs(new);
- redisplay = TRUE;
+ PanedWidget old_pw = (PanedWidget)old;
+ PanedWidget new_pw = (PanedWidget)cnew;
+ Boolean redisplay = False;
+
+ if ((old_pw->paned.cursor != new_pw->paned.cursor) && XtIsRealized(cnew))
+ XDefineCursor(XtDisplay(cnew), XtWindow(cnew), new_pw->paned.cursor);
+
+ if (old_pw->paned.internal_bp != new_pw->paned.internal_bp ||
+ old_pw->core.background_pixel != new_pw->core.background_pixel) {
+ ReleaseGCs(old);
+ GetGCs(cnew);
+ redisplay = True;
}
- if ( (old_pw->paned.grip_cursor != new_pw->paned.grip_cursor) ||
- (old_pw->paned.v_grip_cursor != new_pw->paned.v_grip_cursor) ||
- (old_pw->paned.h_grip_cursor != new_pw->paned.h_grip_cursor) ) {
- ChangeAllGripCursors(new_pw);
- }
+ if (old_pw->paned.grip_cursor != new_pw->paned.grip_cursor ||
+ old_pw->paned.v_grip_cursor != new_pw->paned.v_grip_cursor ||
+ old_pw->paned.h_grip_cursor != new_pw->paned.h_grip_cursor)
+ ChangeAllGripCursors(new_pw);
- if ( IsVert(old_pw) != IsVert(new_pw)) {
-/*
- * We are fooling the paned widget into thinking that is needs to
- * fully refigure everything, which is what we want.
- */
- if (IsVert(new_pw))
- new_pw->core.width = 0;
+ if (IsVert(old_pw) != IsVert(new_pw)) {
+ /*
+ * We are fooling the paned widget into thinking that is needs to
+ * fully refigure everything, which is what we want
+ */
+ if (IsVert(new_pw))
+ XtWidth(new_pw) = 0;
else
- new_pw->core.height = 0;
+ XtHeight(new_pw) = 0;
- new_pw->paned.resize_children_to_pref = TRUE;
- ChangeManaged(new); /* Seems weird, but does the right thing. */
- new_pw->paned.resize_children_to_pref = FALSE;
+ new_pw->paned.resize_children_to_pref = True;
+ XawPanedChangeManaged(cnew); /* Seems weird, but does the right thing */
+ new_pw->paned.resize_children_to_pref = False;
if (new_pw->paned.grip_cursor == None)
ChangeAllGripCursors(new_pw);
- return(TRUE);
+ return (True);
}
if (old_pw->paned.internal_bw != new_pw->paned.internal_bw) {
- AdjustPanedSize( new_pw, PaneSize(new, !IsVert(old_pw)),
- (XtGeometryResult *)NULL,
- (Dimension *)NULL, (Dimension *)NULL);
- RefigureLocationsAndCommit(new);
- return(TRUE); /* We have done a full configuration, return.*/
+ AdjustPanedSize(new_pw, PaneSize(cnew, !IsVert(old_pw)),
+ NULL, NULL, NULL);
+ RefigureLocationsAndCommit(cnew);
+ return (True); /* We have done a full configuration, return */
}
- if ( (old_pw->paned.grip_indent != new_pw->paned.grip_indent) &&
- (XtIsRealized(new)) ) {
- CommitNewLocations(new_pw);
- redisplay = TRUE;
+ if (old_pw->paned.grip_indent != new_pw->paned.grip_indent &&
+ XtIsRealized(cnew)) {
+ CommitNewLocations(new_pw);
+ redisplay = True;
}
return (redisplay);
-} /* SetValues */
-
+}
-/* ARGSUSED */
+/*ARGSUSED*/
static Boolean
-PaneSetValues(old, request, new, args, num_args)
-Widget old, request, new;
-ArgList args;
-Cardinal *num_args;
+XawPanedPaneSetValues(Widget old, Widget request, Widget cnew,
+ ArgList args, Cardinal *num_args)
{
Pane old_pane = PaneInfo(old);
- Pane new_pane = PaneInfo(new);
- Boolean redisplay = FALSE;
-
- /* Check for new min and max. */
+ Pane new_pane = PaneInfo(cnew);
+ Boolean redisplay = False;
+ /* Check for new min and max */
if (old_pane->min != new_pane->min || old_pane->max != new_pane->max)
- XawPanedSetMinMax(new, (int)new_pane->min, (int)new_pane->max);
-
- /* Check for change in XtNshowGrip. */
-
- if (old_pane->show_grip != new_pane->show_grip)
- if (new_pane->show_grip == TRUE) {
- CreateGrip(new);
- if (XtIsRealized(XtParent(new))) {
- if (XtIsManaged(new)) /* if paned is unrealized this will
- happen automatically at realize time.*/
- XtManageChild(PaneInfo(new)->grip); /* manage the grip. */
- XtRealizeWidget(PaneInfo(new)->grip); /* realize the grip. */
- CommitNewLocations( (PanedWidget) XtParent(new) );
+ XawPanedSetMinMax(cnew, (int)new_pane->min, (int)new_pane->max);
+
+ /* Check for change in XtNshowGrip */
+ if (old_pane->show_grip != new_pane->show_grip) {
+ if (new_pane->show_grip == True) {
+ CreateGrip(cnew);
+ if (XtIsRealized(XtParent(cnew))) {
+ if (XtIsManaged(cnew)) /* if paned is unrealized this will
+ happen automatically at realize time
+ */
+ XtManageChild(PaneInfo(cnew)->grip); /* manage the grip */
+ XtRealizeWidget(PaneInfo(cnew)->grip); /* realize the grip */
+ CommitNewLocations((PanedWidget)XtParent(cnew));
}
}
- else if ( HasGrip(old) ) {
- XtDestroyWidget( old_pane->grip );
+ else if (HasGrip(old)) {
+ XtDestroyWidget(old_pane->grip);
new_pane->grip = NULL;
- redisplay = TRUE;
+ redisplay = True;
}
+ }
- /* ||| need to look at position changes */
-
- return(redisplay);
+ return (redisplay);
}
-/************************************************************
+/*
+ * Public routines
+ */
+/*
+ * Function:
+ * XawPanedSetMinMax
*
- * Public routines.
+ * Parameters:
+ * widget - widget that is a child of the Paned widget
+ * min - new min and max size for the pane
+ * max - ""
*
- ************************************************************/
-
-/* Function Name: XawPanedSetMinMax
- * Description: Sets the min and max size for a pane.
- * Arguments: widget - the widget that is a child of the Paned widget.
- * min, max - the new min and max size for the pane.
- * Returns: none.
+ * Description:
+ * Sets the min and max size for a pane.
*/
-
void
-#if NeedFunctionPrototypes
XawPanedSetMinMax(Widget widget, int min, int max)
-#else
-XawPanedSetMinMax(widget, min, max)
-Widget widget;
-int min, max;
-#endif
{
Pane pane = PaneInfo(widget);
pane->min = min;
pane->max = max;
- RefigureLocationsAndCommit( widget->core.parent );
+ RefigureLocationsAndCommit(widget->core.parent);
}
-/* Function Name: XawPanedGetMinMax
- * Description: Gets the min and max size for a pane.
- * Arguments: widget - the widget that is a child of the Paned widget.
- ** RETURNED ** min, max - the current min and max size for the pane.
- * Returns: none.
+/*
+ * Function:
+ * XawPanedGetMinMax
+ *
+ * Parameters:
+ * widget - widget that is a child of the Paned widget
+ * min - current min and max size for the pane (return)
+ * max - ""
+ *
+ * Description:
+ * Gets the min and max size for a pane.
*/
-
void
-#if NeedFunctionPrototypes
XawPanedGetMinMax(Widget widget, int *min, int *max)
-#else
-XawPanedGetMinMax(widget, min, max)
-Widget widget;
-int *min, *max;
-#endif
{
Pane pane = PaneInfo(widget);
@@ -1876,69 +1997,68 @@ int *min, *max;
*max = pane->max;
}
-/* Function Name: XawPanedSetRefigureMode
- * Description: Allows a flag to be set the will inhibit
- * the paned widgets relayout routine.
- * Arguments: w - the paned widget.
- * mode - if FALSE then inhibit refigure.
- * Returns: none.
+/*
+ * Function:
+ * XawPanedSetRefigureMode
+ *
+ * Parameters:
+ * w - paned widget
+ * mode - if False then inhibit refigure
+ *
+ * Description:
+ * Allows a flag to be set the will inhibit
+ * the paned widgets relayout routine.
*/
-
void
-#if NeedFunctionPrototypes
XawPanedSetRefigureMode(Widget w,
#if NeedWidePrototypes
- int mode)
-#else
- Boolean mode)
-#endif
+ int mode
#else
-XawPanedSetRefigureMode(w, mode)
-Widget w;
-Boolean mode;
+ Boolean mode
#endif
+)
{
- ((PanedWidget) w)->paned.refiguremode = mode;
- RefigureLocationsAndCommit( w );
+ ((PanedWidget)w)->paned.refiguremode = mode;
+ RefigureLocationsAndCommit(w);
}
-/* Function Name: XawPanedGetNumSub
- * Description: Returns the number of panes in the paned widget.
- * Arguments: w - the paned widget.
- * Returns: the number of panes in the paned widget.
+/*
+ * Function:
+ * XawPanedGetNumSub
+ *
+ * Parameters:
+ * w - paned widget
+ *
+ * Description:
+ * Returns the number of panes in the paned widget.
+ * Returns:
+ * the number of panes in the paned widget
*/
-
int
-#if NeedFunctionPrototypes
XawPanedGetNumSub(Widget w)
-#else
-XawPanedGetNumSub(w)
-Widget w;
-#endif
{
- return ((PanedWidget)w)->paned.num_panes;
+ return (((PanedWidget)w)->paned.num_panes);
}
-/* Function Name: XawPanedAllowResize
- * Description: Allows a flag to be set that determines if the paned
- * widget will allow geometry requests from this child
- * Arguments: widget - a child of the paned widget.
- * Returns: none.
+/*
+ * Function:
+ * XawPanedAllowResize
+ *
+ * Parameters:
+ * widget - child of the paned widget
+ *
+ * Description:
+ * Allows a flag to be set that determines if the paned
+ * widget will allow geometry requests from this child.
*/
-
void
-#if NeedFunctionPrototypes
XawPanedAllowResize(Widget widget,
#if NeedWidePrototypes
- int allow_resize)
-#else
- Boolean allow_resize)
-#endif
+ int allow_resize
#else
-XawPanedAllowResize(widget, allow_resize)
-Widget widget;
-Boolean allow_resize;
+ Boolean allow_resize
#endif
+)
{
PaneInfo(widget)->allow_resize = allow_resize;
}