Paned.c File Reference

#include <X11/IntrinsicP.h>
#include <X11/cursorfont.h>
#include <X11/StringDefs.h>
#include <X11/Xmu/Misc.h>
#include <X11/Xmu/Converters.h>
#include <X11/Xaw3d/XawInit.h>
#include <X11/Xaw3d/Grip.h>
#include <X11/Xaw3d/PanedP.h>
#include <X11/Xaw3d/XawImP.h>
#include <ctype.h>

Include dependency graph for Paned.c:

Go to the source code of this file.

Defines

#define NO_INDEX   -100
#define IS_GRIP   NULL
#define PaneInfo(w)   ((Pane)(w)->core.constraints)
#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 ForAllPanes(pw, childP)
#define ForAllChildren(pw, childP)
#define offset(field)   XtOffsetOf(PanedRec, paned.field)
#define offset(field)   XtOffsetOf(PanedConstraintsRec, paned.field)
#define SuperClass   ((ConstraintWidgetClass)&constraintClassRec)
#define DrawInternalBorders(pw)   _DrawInternalBorders((pw), (pw)->paned.normgc);
#define EraseInternalBorders(pw)   _DrawInternalBorders((pw), (pw)->paned.invgc);
#define DrawTrackLines(pw)   _DrawTrackLines((pw), FALSE);
#define EraseTrackLines(pw)   _DrawTrackLines((pw), TRUE);

Enumerations

enum  Direction { UpLeftPane = 'U', LowRightPane = 'L', ThisBorderOnly = 'T', AnyPane = 'A' }

Functions

static void ClassInitialize ()
static void Initialize ()
static void Realize ()
static void Resize ()
static void Redisplay ()
static void GetGCs ()
static void 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 ()
static Dimension GetRequestInfo ()
static Boolean SatisfiesRule1 ()
static Boolean SatisfiesRule2 ()
static Boolean SatisfiesRule3 ()
static void PushPaneStack ()
static void GetPaneStack ()
static Boolean PopPaneStack ()
static void ClearPaneStack ()
static void AdjustPanedSize (PanedWidget pw, Dimension off_size, XtGeometryResult *result_ret, Dimension *on_size_ret, Dimension *off_size_ret)
static Dimension PaneSize (Widget w, Boolean vertical)
static Dimension GetRequestInfo (XtWidgetGeometry *geo_struct, Boolean vert)
static Pane ChoosePaneToResize (PanedWidget pw, int paneindex, Direction dir, Boolean shrink)
static Boolean SatisfiesRule1 (Pane pane, Boolean shrink)
static Boolean SatisfiesRule2 (Pane pane)
static Boolean SatisfiesRule3 (Pane pane, Boolean shrink)
static void LoopAndRefigureChildren (PanedWidget pw, int paneindex, Direction dir, int *sizeused)
static void RefigureLocations (PanedWidget pw, int paneindex, Direction dir)
static void CommitNewLocations (PanedWidget pw)
static void RefigureLocationsAndCommit (Widget w)
static void _DrawRect (PanedWidget pw, GC gc, int on_loc, int off_loc, unsigned int on_size, unsigned int off_size)
static void _DrawInternalBorders (PanedWidget pw, GC gc)
static void _DrawTrackLines (PanedWidget pw, Boolean erase)
static int GetEventLocation (PanedWidget pw, XEvent *event)
static void StartGripAdjustment (PanedWidget pw, Widget grip, Direction dir)
static void MoveGripAdjustment (PanedWidget pw, Widget grip, Direction dir, int loc)
static void CommitGripAdjustment (PanedWidget pw)
static void HandleGrip (Widget grip, XtPointer junk, XtPointer callData)
static void ResortChildren (PanedWidget pw)
static void ManageAndUnmanageGrips (PanedWidget pw)
static void CreateGrip (Widget child)
static void GetGCs (Widget w)
static void SetChildrenPrefSizes (PanedWidget pw, Dimension off_size)
static void ChangeAllGripCursors (PanedWidget pw)
static void PushPaneStack (PanedWidget pw, Pane pane)
static void GetPaneStack (PanedWidget pw, Boolean shrink, Pane *pane, int *start_size)
static Boolean PopPaneStack (PanedWidget pw)
static void ClearPaneStack (PanedWidget pw)
static XtGeometryResult GeometryManager (Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply)
static void Initialize (Widget request, Widget new, ArgList args, Cardinal *num_args)
static void Realize (Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
static void ReleaseGCs (Widget w)
static void InsertChild (Widget w)
static void DeleteChild (Widget w)
static void ChangeManaged (Widget w)
static void Resize (Widget w)
static void Redisplay (Widget w, XEvent *event, Region region)
static Boolean SetValues (Widget old, Widget request, Widget new, ArgList args, Cardinal *num_args)
static Boolean PaneSetValues (Widget old, Widget request, Widget new, ArgList args, Cardinal *num_args)
void XawPanedSetMinMax (Widget widget, int min, int max)
void XawPanedGetMinMax (Widget widget, int *min, int *max)
void XawPanedSetRefigureMode (Widget w, Boolean mode)
int XawPanedGetNumSub (Widget w)
void XawPanedAllowResize (Widget widget, Boolean allow_resize)

Variables

static char defGripTranslations []
static XtResource resources []
static XtResource subresources []
PanedClassRec panedClassRec
WidgetClass panedWidgetClass = (WidgetClass) &panedClassRec
WidgetClass vPanedWidgetClass = (WidgetClass) &panedClassRec


Define Documentation

#define DrawInternalBorders ( pw   )     _DrawInternalBorders((pw), (pw)->paned.normgc);

Definition at line 804 of file Paned.c.

Referenced by CommitGripAdjustment(), and Redisplay().

#define DrawTrackLines ( pw   )     _DrawTrackLines((pw), FALSE);

Definition at line 854 of file Paned.c.

Referenced by MoveGripAdjustment().

#define EraseInternalBorders ( pw   )     _DrawInternalBorders((pw), (pw)->paned.invgc);

Definition at line 805 of file Paned.c.

Referenced by StartGripAdjustment().

#define EraseTrackLines ( pw   )     _DrawTrackLines((pw), TRUE);

Definition at line 855 of file Paned.c.

Referenced by CommitGripAdjustment().

#define ForAllChildren ( pw,
childP   ) 

Value:

for ( (childP) = (pw)->composite.children ; \
        (childP) < (pw)->composite.children + (pw)->composite.num_children ; \
        (childP)++ )

Definition at line 96 of file Paned.c.

#define ForAllPanes ( pw,
childP   ) 

Value:

for ( (childP) = (pw)->composite.children ; \
        (childP) < (pw)->composite.children + (pw)->paned.num_panes ; \
        (childP)++ )

Definition at line 91 of file Paned.c.

Referenced by _DrawInternalBorders(), _DrawTrackLines(), AdjustPanedSize(), ChangeAllGripCursors(), CommitNewLocations(), Realize(), RefigureLocations(), SetChildrenPrefSizes(), and StartGripAdjustment().

#define HasGrip ( w   )     (PaneInfo(w)->grip != NULL)

Definition at line 86 of file Paned.c.

Referenced by ChangeAllGripCursors(), ChangeManaged(), CommitNewLocations(), DeleteChild(), ManageAndUnmanageGrips(), PaneSetValues(), and Realize().

#define IS_GRIP   NULL

Definition at line 83 of file Paned.c.

#define IsPane ( w   )     ((w)->core.widget_class != gripWidgetClass)

Definition at line 87 of file Paned.c.

Referenced by ChangeManaged(), DeleteChild(), InsertChild(), ManageAndUnmanageGrips(), and ResortChildren().

#define IsVert ( w   )     ( (w)->paned.orientation == XtorientVertical )

Definition at line 89 of file Paned.c.

Referenced by _DrawInternalBorders(), _DrawRect(), _DrawTrackLines(), AdjustPanedSize(), ChangeAllGripCursors(), ChangeManaged(), CommitNewLocations(), CreateGrip(), GeometryManager(), GetEventLocation(), InsertChild(), LoopAndRefigureChildren(), MoveGripAdjustment(), RefigureLocations(), Resize(), SetChildrenPrefSizes(), SetValues(), and StartGripAdjustment().

#define NO_INDEX   -100

Definition at line 82 of file Paned.c.

Referenced by ChoosePaneToResize(), RefigureLocations(), and RefigureLocationsAndCommit().

#define offset ( field   )     XtOffsetOf(PanedConstraintsRec, paned.field)

Definition at line 164 of file Paned.c.

#define offset ( field   )     XtOffsetOf(PanedRec, paned.field)

Definition at line 164 of file Paned.c.

#define PaneIndex ( w   )     (PaneInfo(w)->position)

Definition at line 88 of file Paned.c.

Referenced by ChoosePaneToResize(), GeometryManager(), MoveGripAdjustment(), and StartGripAdjustment().

#define PaneInfo ( w   )     ((Pane)(w)->core.constraints)

Definition at line 85 of file Paned.c.

Referenced by _DrawTrackLines(), AdjustPanedSize(), ChangeAllGripCursors(), ChangeManaged(), ChoosePaneToResize(), CommitGripAdjustment(), CommitNewLocations(), CreateGrip(), DeleteChild(), GeometryManager(), InsertChild(), ManageAndUnmanageGrips(), MoveGripAdjustment(), PaneSetValues(), Realize(), RefigureLocations(), SetChildrenPrefSizes(), StartGripAdjustment(), XawPanedAllowResize(), XawPanedGetMinMax(), and XawPanedSetMinMax().

#define SuperClass   ((ConstraintWidgetClass)&constraintClassRec)

Definition at line 207 of file Paned.c.


Enumeration Type Documentation

enum Direction

Enumerator:
UpLeftPane 
LowRightPane 
ThisBorderOnly 
AnyPane 

Definition at line 79 of file Paned.c.

00079              {UpLeftPane = 'U', LowRightPane = 'L', 
00080               ThisBorderOnly = 'T', AnyPane = 'A' } Direction;


Function Documentation

static void _DrawInternalBorders ( PanedWidget  pw,
GC  gc 
) [static]

Definition at line 772 of file Paned.c.

References _DrawRect(), ForAllPanes, IsVert, and PaneSize().

00775 {
00776     Widget *childP;
00777     int on_loc, off_loc;
00778     unsigned int on_size, off_size;
00779 
00780 /*
00781  * This is an optimization.  Do not paint the internal borders if
00782  * they are the same color as the background.
00783  */
00784 
00785     if (pw->core.background_pixel == pw->paned.internal_bp)
00786         return;
00787 
00788     off_loc = 0; 
00789     off_size = (unsigned int) PaneSize( (Widget) pw, !IsVert(pw) );
00790     on_size = (unsigned int) pw->paned.internal_bw;
00791 
00792     ForAllPanes(pw, childP) {
00793         on_loc = IsVert(pw) ? (*childP)->core.y : (*childP)->core.x;
00794         on_loc -= (int) on_size;
00795 
00796         _DrawRect( pw, gc, on_loc, off_loc, on_size, off_size);
00797     }
00798 }

Here is the call graph for this function:

static void _DrawRect ( PanedWidget  pw,
GC  gc,
int  on_loc,
int  off_loc,
unsigned int  on_size,
unsigned int  off_size 
) [static]

Definition at line 750 of file Paned.c.

References IsVert.

Referenced by _DrawInternalBorders(), and _DrawTrackLines().

00755 {
00756   if (IsVert(pw)) 
00757     XFillRectangle(XtDisplay(pw), XtWindow(pw), gc, 
00758                    off_loc, on_loc, off_size, on_size);
00759   else
00760     XFillRectangle(XtDisplay(pw), XtWindow(pw), gc,
00761                    on_loc, off_loc, on_size, off_size);
00762 }

Here is the caller graph for this function:

static void _DrawTrackLines ( PanedWidget  pw,
Boolean  erase 
) [static]

Definition at line 817 of file Paned.c.

References _DrawRect(), _PanedConstraintsPart::delta, ForAllPanes, IsVert, _PanedConstraintsPart::olddelta, PaneInfo, and PaneSize().

00820 {
00821     Widget *childP;
00822     Pane pane;
00823     int on_loc, off_loc;
00824     unsigned int on_size, off_size;
00825 
00826     off_loc = 0;
00827     off_size = PaneSize( (Widget) pw, !IsVert(pw));
00828 
00829     ForAllPanes(pw, childP) {
00830         pane = PaneInfo(*childP);
00831         if ( erase || (pane->olddelta != pane->delta) ) {
00832             on_size = pw->paned.internal_bw; 
00833             if (!erase) {
00834                 on_loc = PaneInfo(*childP)->olddelta - (int) on_size;
00835 
00836                 _DrawRect( pw, pw->paned.flipgc,
00837                           on_loc, off_loc, on_size, off_size);
00838             }
00839 
00840             on_loc = PaneInfo(*childP)->delta - (int) on_size;
00841 
00842             _DrawRect(pw, pw->paned.flipgc,
00843                       on_loc, off_loc, on_size, off_size);
00844 
00845             pane->olddelta = pane->delta;
00846         }
00847     }
00848 }

Here is the call graph for this function:

static void AdjustPanedSize ( PanedWidget  pw,
Dimension  off_size,
XtGeometryResult *  result_ret,
Dimension *  on_size_ret,
Dimension *  off_size_ret 
) [static]

Definition at line 285 of file Paned.c.

References _XawImCallVendorShellExtResize(), AssignMin, ForAllPanes, GetRequestInfo(), IsVert, Max, PaneInfo, PaneSize(), and size.

Referenced by ChangeManaged(), GeometryManager(), and SetValues().

00290 {
00291     Dimension old_size = PaneSize( (Widget) pw, IsVert(pw));
00292     Dimension newsize = 0;
00293     Widget * childP;
00294     XtWidgetGeometry request, reply;
00295     request.request_mode = CWWidth | CWHeight;
00296 
00297     ForAllPanes(pw, childP) {
00298         int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min);
00299         AssignMin(size, (int) PaneInfo(*childP)->max);
00300         newsize += size + pw->paned.internal_bw;
00301     }
00302     newsize -= pw->paned.internal_bw;
00303 
00304     if (newsize < 1) newsize = 1;
00305 
00306     if ( IsVert(pw) ) {
00307         request.width = off_size;
00308         request.height = newsize;
00309     }
00310     else {
00311         request.width = newsize;
00312         request.height = off_size;
00313     }
00314 
00315     if (result_ret != NULL) {
00316       request.request_mode |= XtCWQueryOnly;
00317 
00318       *result_ret = XtMakeGeometryRequest( (Widget) pw, &request, &reply );
00319       _XawImCallVendorShellExtResize( (Widget) pw );
00320 
00321       if ( (newsize == old_size) || (*result_ret == XtGeometryNo) ) {
00322           *on_size_ret = old_size;
00323           *off_size_ret = off_size;
00324           return;
00325       }
00326       if (*result_ret != XtGeometryAlmost) {
00327           *on_size_ret = GetRequestInfo( &request, IsVert(pw) );
00328           *off_size_ret = GetRequestInfo( &request, !IsVert(pw) );
00329           return;
00330       }
00331       *on_size_ret = GetRequestInfo( &reply, IsVert(pw) );
00332       *off_size_ret = GetRequestInfo( &reply, !IsVert(pw) );
00333       return;
00334     }
00335 
00336     if (newsize == old_size) return;
00337 
00338     if (XtMakeGeometryRequest( (Widget) pw,
00339                               &request, &reply) == XtGeometryAlmost)
00340         XtMakeGeometryRequest( (Widget) pw, &reply, &request);
00341 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ChangeAllGripCursors ( PanedWidget  pw  )  [static]

Definition at line 1302 of file Paned.c.

References ForAllPanes, HasGrip, IsVert, PaneInfo, and XtNcursor.

Referenced by SetValues().

01304 {
01305     Widget * childP;
01306 
01307     ForAllPanes(pw, childP) {
01308         Arg arglist[1];
01309         Cursor cursor;
01310       
01311         if ( (cursor = pw->paned.grip_cursor) == None )
01312             if ( IsVert(pw) )
01313                 cursor = pw->paned.v_grip_cursor;
01314             else
01315                 cursor = pw->paned.h_grip_cursor;
01316 
01317         if (HasGrip (*childP)) {
01318             XtSetArg(arglist[0], XtNcursor, cursor);
01319             XtSetValues(PaneInfo(*childP)->grip, arglist, (Cardinal) 1);
01320         }
01321     }
01322 }

Here is the caller graph for this function:

static void ChangeManaged ( Widget  w  )  [static]

Definition at line 1648 of file Paned.c.

References AdjustPanedSize(), ForAllChildren, _PanedConstraintsPart::grip, HasGrip, IsPane, IsVert, ManageAndUnmanageGrips(), _PanedRec::paned, PaneInfo, PaneSize(), _PanedConstraintsPart::position, PanedPart::recursively_called, RefigureLocationsAndCommit(), ResortChildren(), SetChildrenPrefSizes(), and size.

01650 {
01651    PanedWidget pw = (PanedWidget)w;
01652    Boolean vert = IsVert(pw);
01653    Dimension size;
01654    Widget *childP;
01655 
01656    if (pw->paned.recursively_called++) return;
01657 
01658 /*
01659  * If the size is zero then set it to the size of the widest or tallest pane.
01660  */
01661 
01662    if ( (size = PaneSize( (Widget) pw, !vert )) == 0) {
01663        size = 1;
01664        ForAllChildren(pw, childP)
01665            if ( XtIsManaged(*childP) && (PaneSize( *childP, !vert ) > size) )
01666                size = PaneSize( *childP, !vert );
01667    }
01668 
01669    ManageAndUnmanageGrips(pw);
01670    pw->paned.recursively_called = False;
01671    ResortChildren(pw);          
01672 
01673    pw->paned.num_panes = 0;
01674    ForAllChildren(pw, childP) 
01675        if ( IsPane(*childP) )
01676            if ( XtIsManaged(*childP) ) {
01677                Pane pane = PaneInfo(*childP);
01678                if (HasGrip(*childP))
01679                    PaneInfo(pane->grip)->position = pw->paned.num_panes;
01680                pane->position = pw->paned.num_panes; /*TEMPORY -CDP 3/89 */
01681                pw->paned.num_panes++;
01682            }
01683            else
01684                break;           /* This list is already sorted. */
01685 
01686    SetChildrenPrefSizes( (PanedWidget) w, size);
01687 
01688 /*
01689  * ForAllPanes can now be used. 
01690  */
01691 
01692    if ( PaneSize((Widget) pw, vert) == 0 ) 
01693        AdjustPanedSize(pw, size, (XtGeometryResult *)NULL, 
01694                         (Dimension *)NULL, (Dimension *)NULL);
01695 
01696    if (XtIsRealized( (Widget) pw)) 
01697        RefigureLocationsAndCommit( (Widget) pw); 
01698 
01699 } /* ChangeManaged */

Here is the call graph for this function:

static void ChangeManaged (  )  [static]

static Pane ChoosePaneToResize ( PanedWidget  pw,
int  paneindex,
Direction  dir,
Boolean  shrink 
) [static]

Definition at line 404 of file Paned.c.

References AnyPane, LowRightPane, NO_INDEX, PaneIndex, PaneInfo, SatisfiesRule1(), SatisfiesRule2(), SatisfiesRule3(), and TRUE.

Referenced by LoopAndRefigureChildren().

00409 {
00410     Widget *childP;
00411     int rules = 3;
00412     Direction _dir = dir;
00413     int _index = paneindex;
00414 
00415     if ( (paneindex == NO_INDEX) || (dir == AnyPane) ) {  /* Use defaults. */
00416       _dir = LowRightPane;              /* Go up. - really. */
00417       _index = pw->paned.num_panes - 1; /* Start the last pane, and work
00418                                            backwards. */
00419     }
00420     childP = pw->composite.children + _index;
00421 
00422     /* CONSTCOND */
00423     while(TRUE) {
00424         Pane pane = PaneInfo(*childP);
00425         
00426         if ( (rules < 3 || SatisfiesRule3(pane, shrink)) &&
00427              (rules < 2 || SatisfiesRule2(pane))         &&
00428              (SatisfiesRule1(pane, shrink))              &&
00429              ((paneindex != PaneIndex(*childP)) || (dir == AnyPane)) )
00430             return(pane);
00431 
00432 /*
00433  * This is counter-intuitive, but if we are resizing the pane
00434  * above the grip we want to choose a pane below the grip to lose,
00435  * and visa-versa.
00436  */
00437 
00438         if (_dir == LowRightPane) --childP; else ++childP;
00439 
00440 /*
00441  * If we have come to and edge then reduce the rule set, and try again.
00442  * If we are reduced the rules to none, then return NULL.
00443  */
00444         
00445         if ( (childP - pw->composite.children < 0) ||
00446              (childP - pw->composite.children >= pw->paned.num_panes) ) {
00447             if (--rules < 1)  /* less strict rules. */
00448               return(NULL);
00449             childP = pw->composite.children + _index;
00450         }
00451     }
00452 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ClassInitialize (  )  [static]

Definition at line 1426 of file Paned.c.

References XawInitializeWidgetSet(), and XmuCvtStringToOrientation().

01427 {
01428     XawInitializeWidgetSet();
01429     XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation,
01430                     (XtConvertArgList)NULL, (Cardinal)0 );
01431 }

Here is the call graph for this function:

static void ClearPaneStack ( PanedWidget  pw  )  [static]

Definition at line 1407 of file Paned.c.

References PopPaneStack().

01409 {
01410   while(PopPaneStack(pw));
01411 }

Here is the call graph for this function:

static void ClearPaneStack (  )  [static]

Referenced by CommitNewLocations().

Here is the caller graph for this function:

static void CommitGripAdjustment ( PanedWidget  pw  )  [static]

Definition at line 1018 of file Paned.c.

References CommitNewLocations(), DrawInternalBorders, EraseTrackLines, PaneInfo, _PanedConstraintsPart::size, and _PanedConstraintsPart::wp_size.

Referenced by HandleGrip().

01020 {
01021     EraseTrackLines(pw);
01022     CommitNewLocations(pw);
01023     DrawInternalBorders(pw);
01024            
01025 /*
01026  * Since the user selected this size then use it as the preferred size. 
01027  */
01028 
01029     if (pw->paned.whichadd) {
01030         Pane pane = PaneInfo(pw->paned.whichadd);
01031         pane->wp_size = pane->size;
01032     }
01033     if (pw->paned.whichsub) {
01034         Pane pane = PaneInfo(pw->paned.whichsub);
01035         pane->wp_size = pane->size;
01036     }
01037 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void CommitNewLocations ( PanedWidget  pw  )  [static]

Definition at line 657 of file Paned.c.

References ClearPaneStack(), _PanedConstraintsPart::delta, ForAllPanes, _PanedConstraintsPart::grip, HasGrip, IsVert, PaneInfo, and _PanedConstraintsPart::size.

Referenced by CommitGripAdjustment(), GeometryManager(), PaneSetValues(), RefigureLocationsAndCommit(), and SetValues().

00659 {
00660     Widget *childP;
00661     XWindowChanges changes;
00662 
00663     changes.stack_mode = Above;
00664 
00665     ForAllPanes(pw, childP) {
00666         Pane pane = PaneInfo(*childP);
00667         Widget grip = pane->grip; /* may be NULL. */
00668 
00669         if (IsVert(pw)) {
00670             XtMoveWidget(*childP, (Position) 0, pane->delta);
00671             XtResizeWidget(*childP, pw->core.width, (Dimension) pane->size,
00672                            (Dimension) 0);
00673 
00674             if (HasGrip(*childP)) {         /* Move and Display the Grip */
00675                 changes.x = pw->core.width - pw->paned.grip_indent -
00676                             grip->core.width - grip->core.border_width*2;
00677                 changes.y = (*childP)->core.y + (*childP)->core.height -
00678                             grip->core.height/2 - grip->core.border_width + 
00679                             pw->paned.internal_bw/2;
00680             }
00681         }
00682         else {
00683             XtMoveWidget(*childP, pane->delta, (Position) 0);
00684             XtResizeWidget(*childP, (Dimension) pane->size, pw->core.height,
00685                            (Dimension) 0);
00686 
00687 
00688             if (HasGrip(*childP)) {         /* Move and Display the Grip */
00689                 changes.x = (*childP)->core.x + (*childP)->core.width -
00690                             grip->core.width/2 - grip->core.border_width + 
00691                             pw->paned.internal_bw/2;
00692                 changes.y = pw->core.height - pw->paned.grip_indent -
00693                             grip->core.height - grip->core.border_width*2;
00694             }
00695         }
00696 
00697 /*
00698  * This should match XtMoveWidget, except that we're also insuring the 
00699  * grip is Raised in the same request.
00700  */
00701 
00702         if (HasGrip(*childP)) {
00703             grip->core.x = changes.x;
00704             grip->core.y = changes.y;
00705 
00706             if (XtIsRealized(pane->grip))
00707                 XConfigureWindow( XtDisplay(pane->grip), XtWindow(pane->grip),
00708                                   CWX | CWY | CWStackMode, &changes );
00709         }
00710     }
00711     ClearPaneStack(pw);
00712 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void CreateGrip ( Widget  child  )  [static]

Definition at line 1185 of file Paned.c.

References PanedPart::grip_cursor, PanedPart::grip_translations, gripWidgetClass, HandleGrip(), IsVert, _PanedRec::paned, PaneInfo, and XtNcursor.

Referenced by InsertChild(), and PaneSetValues().

01187 {
01188     PanedWidget pw = (PanedWidget) XtParent(child);
01189     Arg arglist[2];
01190     Cardinal num_args = 0;
01191     Cursor cursor;
01192      
01193     XtSetArg(arglist[num_args], XtNtranslations, pw->paned.grip_translations);
01194     num_args++;
01195     if ( (cursor = pw->paned.grip_cursor) == None )
01196         if (IsVert(pw))
01197             cursor = pw->paned.v_grip_cursor;
01198         else
01199             cursor = pw->paned.h_grip_cursor;
01200 
01201     XtSetArg(arglist[num_args], XtNcursor, cursor);
01202     num_args++;
01203     PaneInfo(child)->grip = XtCreateWidget("grip", gripWidgetClass, (Widget)pw,
01204                                            arglist, num_args);
01205     
01206     XtAddCallback(PaneInfo(child)->grip, XtNcallback, 
01207                   HandleGrip, (XtPointer) child);
01208 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void DeleteChild ( Widget  w  )  [static]

Definition at line 1635 of file Paned.c.

References HasGrip, IsPane, PaneInfo, and SuperClass.

01637 {
01638     /* remove the subwidget info and destroy the grip */
01639    
01640     if ( IsPane(w) && HasGrip(w) ) XtDestroyWidget(PaneInfo(w)->grip);
01641 
01642     /* delete the child widget in the composite children list with the */
01643     /* superclass delete_child routine.                                */
01644     (*SuperClass->composite_class.delete_child) (w);
01645 
01646 } /* DeleteChild */

static void DeleteChild (  )  [static]

static XtGeometryResult GeometryManager ( Widget  w,
XtWidgetGeometry *  request,
XtWidgetGeometry *  reply 
) [static]

Definition at line 1447 of file Paned.c.

References AdjustPanedSize(), _PanedConstraintsPart::allow_resize, AnyPane, CommitNewLocations(), FALSE, GetRequestInfo(), IsVert, PaneIndex, PaneInfo, PaneSize(), RefigureLocations(), result, _PanedConstraintsPart::size, and _PanedConstraintsPart::wp_size.

01450 {
01451     PanedWidget pw = (PanedWidget) XtParent(w);
01452     XtGeometryMask mask = request->request_mode;
01453     Dimension old_size, old_wpsize, old_paned_size;
01454     Pane pane = PaneInfo(w);
01455     Boolean vert = IsVert(pw);
01456     Dimension on_size, off_size;
01457     XtGeometryResult result;
01458     Boolean almost = FALSE;
01459 
01460 /*
01461  * If any of the following is true, disallow the geometry change.
01462  *
01463  * o The paned widget is realized and allow_resize is false for the pane.
01464  * o The child did not ask to change the on_size.
01465  * o The request is not a width or height request.
01466  * o The requested size is the same as the current size.
01467  */
01468 
01469     if ( (XtIsRealized((Widget)pw) && !pane->allow_resize)        ||
01470          !(mask & ((vert) ? CWHeight : CWWidth))                  ||
01471          (mask & ~(CWWidth | CWHeight))                           ||
01472          (GetRequestInfo(request, vert) ==  PaneSize(w, vert)) ) {
01473         return XtGeometryNo;
01474     }
01475 
01476     old_paned_size = PaneSize( (Widget) pw, vert);
01477     old_wpsize = pane->wp_size;
01478     old_size = pane->size;
01479 
01480     pane->wp_size = pane->size = GetRequestInfo(request, vert);
01481 
01482     AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), &result, &on_size,
01483                     &off_size);
01484 
01485 /*
01486  * Fool the Refigure Locations proc to thinking that we are
01487  * a different on_size;
01488  */
01489 
01490     if (result != XtGeometryNo) 
01491         if (vert) 
01492             pw->core.height = on_size;
01493         else 
01494             pw->core.width = on_size;
01495     
01496     RefigureLocations(pw, PaneIndex(w), AnyPane);
01497 
01498 /* 
01499  * Set up reply struct and reset core on_size.
01500  */
01501     
01502     if (vert) {
01503         pw->core.height = old_paned_size;
01504         reply->height = pane->size;
01505         reply->width = off_size;
01506     }
01507     else {
01508         pw->core.width = old_paned_size;
01509         reply->height = off_size;
01510         reply->width = pane->size;
01511     }    
01512 
01513 /*
01514  * IF either of the following is true.
01515  *
01516  * o There was a "off_size" request and the new "off_size" is different
01517  *   from that requested.
01518  * o There was no "off_size" request and the new "off_size" is different
01519  * 
01520  * o The "on_size" we will allow is different from that requested.
01521  * 
01522  * THEN: set almost
01523  */
01524 
01525     if ( !((vert ? CWWidth : CWHeight) & mask))
01526         if (vert) 
01527             request->width = w->core.width;
01528         else
01529             request->height = w->core.height;
01530 
01531     almost = GetRequestInfo(request, !vert) != GetRequestInfo(reply, !vert);
01532     almost |= (GetRequestInfo(request, vert) != GetRequestInfo(reply, vert));
01533 
01534     if ( (mask & XtCWQueryOnly) || almost ) {
01535         pane->wp_size = old_wpsize;
01536         pane->size = old_size;
01537         RefigureLocations(pw, PaneIndex(w), AnyPane);
01538         reply->request_mode = CWWidth | CWHeight;
01539         if (almost) return XtGeometryAlmost;
01540     }
01541     else {
01542         AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), 
01543                         (XtGeometryResult *)NULL, 
01544                         (Dimension *)NULL, (Dimension *)NULL);
01545         CommitNewLocations( pw );       /* layout already refigured. */
01546     }
01547     return XtGeometryDone;
01548 }

Here is the call graph for this function:

static XtGeometryResult GeometryManager (  )  [static]

static int GetEventLocation ( PanedWidget  pw,
XEvent *  event 
) [static]

Definition at line 865 of file Paned.c.

References IsVert, x, and y.

Referenced by HandleGrip().

00868 {
00869     int x, y;
00870 
00871     switch (event->xany.type) {
00872         case ButtonPress:
00873         case ButtonRelease: 
00874             x = event->xbutton.x_root;
00875             y = event->xbutton.y_root;
00876             break;
00877         case KeyPress:
00878         case KeyRelease:    
00879             x = event->xkey.x_root;
00880             y = event->xkey.y_root;
00881             break;
00882         case MotionNotify:  
00883             x = event->xmotion.x_root;
00884             y = event->xmotion.y_root;
00885             break;
00886         default:            
00887             x = pw->paned.start_loc;
00888             y = pw->paned.start_loc;
00889     }
00890     if (IsVert(pw)) 
00891         return(y);
00892     return(x);
00893 }

Here is the caller graph for this function:

static void GetGCs ( Widget  w  )  [static]

Definition at line 1217 of file Paned.c.

References _PanedRec::core, PanedPart::flipgc, GXinvert, PanedPart::internal_bp, PanedPart::invgc, PanedPart::normgc, and _PanedRec::paned.

01219 {
01220     PanedWidget pw = (PanedWidget) w;
01221     XtGCMask valuemask;
01222     XGCValues values;
01223 
01224 /*
01225  * Draw pane borders in internal border color. 
01226  */
01227 
01228     values.foreground = pw->paned.internal_bp;  
01229     valuemask = GCForeground;
01230     pw->paned.normgc = XtGetGC(w, valuemask, &values);
01231 
01232 /*
01233  * Erase pane borders with background color. 
01234  */
01235 
01236     values.foreground = pw->core.background_pixel;      
01237     valuemask = GCForeground;
01238     pw->paned.invgc = XtGetGC(w, valuemask, &values);
01239 
01240 /*
01241  * Draw Track lines (animate pane borders) in internal border color ^ bg color.
01242  */
01243 
01244     values.function = GXinvert;
01245     values.plane_mask = pw->paned.internal_bp ^ pw->core.background_pixel;
01246     values.subwindow_mode = IncludeInferiors; 
01247     valuemask = GCPlaneMask | GCFunction | GCSubwindowMode;
01248     pw->paned.flipgc = XtGetGC(w, valuemask, &values);
01249 }

static void GetGCs (  )  [static]

static void GetPaneStack ( PanedWidget  pw,
Boolean  shrink,
Pane pane,
int start_size 
) [static]

Definition at line 1362 of file Paned.c.

01367 {
01368   if (pw->paned.stack == NULL) { 
01369     *pane = NULL; 
01370     return;
01371   }
01372 
01373   *pane = pw->paned.stack->pane;
01374   *start_size = pw->paned.stack->start_size;
01375 
01376   if (shrink != ((*pane)->size > *start_size)) *pane = NULL;
01377 }

static void GetPaneStack (  )  [static]

Referenced by LoopAndRefigureChildren().

Here is the caller graph for this function:

static Dimension GetRequestInfo ( XtWidgetGeometry *  geo_struct,
Boolean  vert 
) [static]

Definition at line 371 of file Paned.c.

00374 {
00375     if ( vert ) return ( (Dimension) geo_struct->height);
00376     return ( (Dimension) geo_struct->width);
00377 }

static Dimension GetRequestInfo (  ) 

Referenced by AdjustPanedSize(), and GeometryManager().

Here is the caller graph for this function:

static void HandleGrip ( Widget  grip,
XtPointer  junk,
XtPointer  callData 
) [static]

Definition at line 1049 of file Paned.c.

References CommitGripAdjustment(), _XawGripCallData::event, FALSE, GetEventLocation(), MoveGripAdjustment(), _XawGripCallData::num_params, _PanedRec::paned, _XawGripCallData::params, PanedPart::resize_children_to_pref, PanedPart::start_loc, StartGripAdjustment(), and XtNcursor.

Referenced by CreateGrip().

01052 {
01053     XawGripCallData call_data = (XawGripCallData)callData;
01054     PanedWidget pw = (PanedWidget) XtParent(grip);
01055     int loc;
01056     char action_type;
01057     Cursor cursor;
01058     Direction direction = 0;
01059     Arg arglist[1];
01060 
01061     action_type = *call_data->params[0];
01062 
01063     if (call_data->num_params == 0                             ||
01064         (action_type == 'C' && call_data->num_params != 1)      ||
01065         (action_type != 'C' && call_data->num_params != 2))
01066         XtError( "Paned GripAction has been passed incorrect parameters." );
01067 
01068     if (islower(action_type)) action_type = toupper(action_type);
01069 
01070     loc = GetEventLocation(pw, (XEvent *) (call_data->event));
01071 
01072     if (action_type != 'C') {
01073         if ( isupper(*call_data->params[1]) )
01074           direction = (Direction) *call_data->params[1];
01075         else
01076           direction = (Direction) toupper(*call_data->params[1]);
01077     }
01078 
01079     switch (action_type) {
01080         case 'S':               /* Start adjustment */
01081             pw->paned.resize_children_to_pref = FALSE;
01082             StartGripAdjustment(pw, grip, direction);
01083             pw->paned.start_loc = loc;  
01084             break;
01085 
01086         case 'M': 
01087             MoveGripAdjustment(pw, grip, direction, loc);
01088             break;
01089 
01090         case 'C':
01091             XtSetArg(arglist[0], XtNcursor, &cursor);
01092             XtGetValues(grip, arglist, (Cardinal) 1);
01093             XDefineCursor(XtDisplay(grip), XtWindow(grip), cursor);
01094             CommitGripAdjustment(pw);
01095             break;
01096 
01097         default:
01098             XtError( "Paned GripAction(); 1st parameter invalid" );
01099      }
01100 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void Initialize ( Widget  request,
Widget  new,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 1551 of file Paned.c.

References GetGCs(), and TRUE.

01555 {
01556     PanedWidget pw = (PanedWidget)new;
01557 
01558     GetGCs( (Widget) pw);
01559 
01560     pw->paned.recursively_called = False;
01561     pw->paned.stack = NULL;
01562     pw->paned.resize_children_to_pref = TRUE;
01563     pw->paned.num_panes = 0;
01564 }

Here is the call graph for this function:

static void Initialize (  ) 

Definition at line 26 of file javasci_globals.c.

00027 {
00028   static char env[1024];
00029   static char initstr[]="exec(\"SCI/etc/scilab.start\",-1);quit;";
00030   static int iflag=-1, stacksize = 1000000, ierr=0;
00031 
00032   #ifdef _MSC_VER
00033     static char JavaSciInterf[]="javasci";
00034     static char nw[]="-nw";
00035     static char nb[]="-nb";
00036   #endif
00037 
00038   
00039   char *p1 = (char*)getenv ("SCI");
00040   
00041   
00042   #ifdef _MSC_VER
00043   /* Supprime le mode windows et la baniere */
00044     add_sci_argv(JavaSciInterf);
00045     add_sci_argv(nb);
00046   #endif
00047   
00048   #ifdef _MSC_VER 
00049     if ( p1== NULL )
00050     {
00051                 /* Detection Scilab path */
00052                 char modname[MAX_PATH+1];
00053                 if (!GetModuleFileName (GetModuleHandle("javasci.dll"), modname, MAX_PATH))
00054                 {
00055                         MessageBox(NULL,"javasci.dll not found","Warning",MB_ICONWARNING);
00056                 }
00057                 else
00058                 {
00059                         char *p;
00060                         if ((p = strrchr (modname, '\\')) == NULL) exit(1); /* remove \javasci.dll from modname */
00061                         else
00062                         {
00063                                 *p='\0';
00064                                 if ((p = strrchr (modname, '\\')) == NULL) exit(1); /* remove \bin from modname */
00065                                 else
00066                                 {
00067                                         *p='\0';
00068                                         set_sci_env(modname);
00069                                 }
00070                         }
00071                 }
00072     }
00073     else 
00074         {
00075                 char *pathSCI=(char*)MALLOC((strlen(p1)+1)*sizeof(char));
00076                 sprintf(pathSCI,"%s",p1);
00077                 set_sci_env(pathSCI);
00078                 if (pathSCI) {FREE(pathSCI);pathSCI=NULL;}
00079         }
00080   #else
00081    if (p1==NULL)
00082    {
00083         fprintf(stderr,"Please define SCI environment variable\n");
00084         sprintf (env, "%s=%s", "SCI",SCI);
00085         setSCIpath(SCI);
00086         putenv (env);
00087    }
00088   #endif
00089   /* set TMPDIR */
00090   C2F(settmpdir)();
00091   /* Scilab Initialization */
00092   C2F(inisci)(&iflag,&stacksize,&ierr);
00093   if ( ierr > 0 ) 
00094     {
00095       fprintf(stderr,"Scilab initialization failed !\n");
00096       exit(1);
00097     }
00098 
00099 
00100   /* Initialisation fenetre graphique */
00101   #ifdef _MSC_VER
00102     InitWindowGraphDll();
00103   #endif
00104 
00105   /* pour initialisation de la primitive scilab : fromjava() */
00106   SetFromJavaToON();
00107 
00108   /* Chargement de Scilab.start */
00109   C2F(scirun)(initstr,(int)strlen(initstr));
00110  
00111 }

static void InsertChild ( Widget  w  )  [static]

Definition at line 1606 of file Paned.c.

References CreateGrip(), FALSE, _PanedConstraintsPart::grip, IsPane, IsVert, _PanedConstraintsPart::min, _PanedConstraintsPart::paned_adjusted_me, PANED_GRIP_SIZE, PaneInfo, PaneSize(), _PanedConstraintsPart::show_grip, _PanedConstraintsPart::size, SuperClass, and TRUE.

01608 {
01609    Pane pane = PaneInfo(w);
01610 
01611    /* insert the child widget in the composite children list with the */
01612    /* superclass insert_child routine.                                */
01613    (*SuperClass->composite_class.insert_child)(w);
01614 
01615    if (!IsPane(w)) return;
01616 
01617    /* ||| Panes will be added in the order they are created, temporarily */
01618 
01619    if ( pane->show_grip == TRUE ) {
01620        CreateGrip(w);
01621        if (pane->min == PANED_GRIP_SIZE) 
01622            pane->min = PaneSize(pane->grip, IsVert((PanedWidget) XtParent(w)));
01623    }
01624    else {
01625        if (pane->min == PANED_GRIP_SIZE)
01626            pane->min = 1;
01627        pane->grip = NULL;
01628    }
01629 
01630    pane->size = 0;
01631    pane->paned_adjusted_me = FALSE;
01632 
01633 } /* InsertChild */

Here is the call graph for this function:

static void InsertChild (  )  [static]

static void LoopAndRefigureChildren ( PanedWidget  pw,
int  paneindex,
Direction  dir,
int sizeused 
) [static]

Definition at line 513 of file Paned.c.

References AssignMax, AssignMin, ChoosePaneToResize(), FALSE, GetPaneStack(), IsVert, LowRightPane, _PanedConstraintsPart::max, _PanedConstraintsPart::min, _PanedConstraintsPart::paned_adjusted_me, PaneSize(), PopPaneStack(), PushPaneStack(), SatisfiesRule3(), _PanedConstraintsPart::size, TRUE, void(), and _PanedConstraintsPart::wp_size.

Referenced by RefigureLocations().

00517 {
00518     int pane_size = (int) PaneSize( (Widget) pw, IsVert(pw));
00519     Boolean shrink = (*sizeused > pane_size);
00520 
00521     if (dir == LowRightPane) paneindex++;
00522 
00523     while (*sizeused != pane_size) { /* While all panes do not fit properly. */
00524 /*
00525  * Choose a pane to resize.
00526  * First look on the Pane Stack, and then go hunting for another one.
00527  * If we fail to find a pane to resize then give up.
00528  */
00529         Pane pane;
00530         int start_size;
00531         Dimension old;
00532         Boolean rule3_ok = FALSE, from_stack = TRUE;
00533 
00534         GetPaneStack(pw, shrink, &pane, &start_size);
00535         if (pane == NULL) {
00536             pane = ChoosePaneToResize(pw, paneindex, dir, shrink);
00537             if (pane == NULL) 
00538                 return; /* no one to resize, give up. */
00539 
00540             rule3_ok = SatisfiesRule3(pane, shrink);
00541             from_stack = FALSE;
00542             PushPaneStack(pw, pane);
00543         }
00544 
00545 
00546 /*
00547  * Try to resize this pane so that all panes will fit, take min and max
00548  * into account.
00549  */
00550         old = pane->size;
00551         pane->size += pane_size - *sizeused;
00552 
00553         if (from_stack) {
00554             if (shrink) {
00555                 AssignMax(pane->size, start_size);
00556             }                   /* don't remove these braces. */
00557             else
00558                 AssignMin(pane->size, start_size);
00559 
00560             if (pane->size == start_size) (void) PopPaneStack(pw);
00561         }
00562         else if (rule3_ok) {
00563             if (shrink) {
00564                 AssignMax(pane->size, (int) pane->wp_size);
00565             }                   /* don't remove these braces. */
00566             else
00567                 AssignMin(pane->size, (int) pane->wp_size);
00568         }
00569 
00570         pane->paned_adjusted_me = (pane->size != pane->wp_size);
00571         AssignMax(pane->size, (int) pane->min);
00572         AssignMin(pane->size, (int) pane->max);
00573         *sizeused += (pane->size - old);
00574     }
00575 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void ManageAndUnmanageGrips ( PanedWidget  pw  )  [static]

Definition at line 1147 of file Paned.c.

References ForAllChildren, HasGrip, IsPane, and PaneInfo.

Referenced by ChangeManaged().

01149 {
01150    WidgetList managed_grips, unmanaged_grips;
01151    Widget *managedP, *unmanagedP, *childP;
01152    Cardinal alloc_size;
01153 
01154    alloc_size = (Cardinal) sizeof(Widget) * pw->composite.num_children / 2;
01155    managedP = managed_grips = (WidgetList) XtMalloc(alloc_size);
01156    unmanagedP = unmanaged_grips = (WidgetList) XtMalloc(alloc_size);
01157 
01158    ForAllChildren(pw, childP) 
01159        if (IsPane(*childP) && HasGrip(*childP))
01160            if ( XtIsManaged(*childP) ) 
01161                *managedP++ = PaneInfo(*childP)->grip;
01162            else
01163                *unmanagedP++ = PaneInfo(*childP)->grip;
01164    
01165    if (managedP != managed_grips) {
01166        *unmanagedP++ = *--managedP;   /* Last grip is never managed */
01167        XtManageChildren( managed_grips, (Cardinal)(managedP - managed_grips) );
01168    }
01169 
01170    if (unmanagedP != unmanaged_grips)
01171        XtUnmanageChildren( unmanaged_grips,
01172                            (Cardinal)(unmanagedP - unmanaged_grips) );
01173 
01174    XtFree((char *)managed_grips);
01175    XtFree((char *)unmanaged_grips);
01176 }

Here is the caller graph for this function:

static void MoveGripAdjustment ( PanedWidget  pw,
Widget  grip,
Direction  dir,
int  loc 
) [static]

Definition at line 968 of file Paned.c.

References AssignMax, AssignMin, DrawTrackLines, IsVert, PaneIndex, PaneInfo, PaneSize(), RefigureLocations(), and ThisBorderOnly.

Referenced by HandleGrip().

00973 {
00974     int diff, add_size = 0, sub_size = 0;
00975 
00976     diff = loc - pw->paned.start_loc;
00977 
00978     if (pw->paned.whichadd) 
00979         add_size = PaneSize(pw->paned.whichadd, IsVert(pw) ) + diff;
00980 
00981     if (pw->paned.whichsub) 
00982         sub_size = PaneSize(pw->paned.whichsub, IsVert(pw) ) - diff;
00983 
00984 /*
00985  * If moving this border only then do not allow either of the borders
00986  * to go beyond the min or max size allowed.
00987  */
00988 
00989     if ( (dir == ThisBorderOnly) ) {
00990       int old_add_size = add_size, old_sub_size;
00991 
00992       AssignMax(add_size, (int) PaneInfo(pw->paned.whichadd)->min);
00993       AssignMin(add_size, (int) PaneInfo(pw->paned.whichadd)->max);
00994       if (add_size != old_add_size) 
00995           sub_size += old_add_size - add_size;
00996 
00997       old_sub_size = sub_size;
00998       AssignMax(sub_size, (int) PaneInfo(pw->paned.whichsub)->min);
00999       AssignMin(sub_size, (int) PaneInfo(pw->paned.whichsub)->max);
01000       if (sub_size != old_sub_size) return; /* Abort to current sizes. */
01001     }
01002 
01003     if (add_size != 0)
01004         PaneInfo(pw->paned.whichadd)->size = add_size;
01005     if (sub_size != 0)
01006         PaneInfo(pw->paned.whichsub)->size = sub_size;
01007     RefigureLocations(pw, PaneIndex(grip), dir);
01008     DrawTrackLines(pw);
01009 }

Here is the call graph for this function:

Here is the caller graph for this function:

static Boolean PaneSetValues ( Widget  old,
Widget  request,
Widget  new,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 1791 of file Paned.c.

References CommitNewLocations(), CreateGrip(), FALSE, _PanedConstraintsPart::grip, HasGrip, _PanedConstraintsPart::max, _PanedConstraintsPart::min, PaneInfo, _PanedConstraintsPart::show_grip, TRUE, and XawPanedSetMinMax().

01795 {
01796     Pane old_pane = PaneInfo(old);
01797     Pane new_pane = PaneInfo(new);
01798     Boolean redisplay = FALSE;
01799 
01800     /* Check for new min and max. */
01801 
01802     if (old_pane->min != new_pane->min || old_pane->max != new_pane->max)
01803         XawPanedSetMinMax(new, (int)new_pane->min, (int)new_pane->max);
01804 
01805     /* Check for change in XtNshowGrip. */
01806 
01807     if (old_pane->show_grip != new_pane->show_grip)
01808         if (new_pane->show_grip == TRUE) {
01809             CreateGrip(new);
01810             if (XtIsRealized(XtParent(new))) {
01811                 if (XtIsManaged(new)) /* if paned is unrealized this will
01812                                        happen automatically at realize time.*/
01813                     XtManageChild(PaneInfo(new)->grip); /* manage the grip. */
01814                 XtRealizeWidget(PaneInfo(new)->grip); /* realize the grip. */
01815                 CommitNewLocations( (PanedWidget) XtParent(new) );
01816             }
01817         }
01818         else if ( HasGrip(old) ) {
01819             XtDestroyWidget( old_pane->grip );
01820             new_pane->grip = NULL;
01821             redisplay = TRUE;
01822         }
01823 
01824   /* ||| need to look at position changes */
01825 
01826     return(redisplay);
01827 }

Here is the call graph for this function:

static Boolean PaneSetValues (  )  [static]

static Dimension PaneSize ( Widget  w,
Boolean  vertical 
) [static]

Definition at line 355 of file Paned.c.

00358 {
00359     if (vertical) return (w->core.height);
00360     return (w->core.width);
00361 }

static Dimension PaneSize (  )  [static]

Referenced by _DrawInternalBorders(), _DrawTrackLines(), AdjustPanedSize(), ChangeManaged(), GeometryManager(), InsertChild(), LoopAndRefigureChildren(), MoveGripAdjustment(), RefigureLocations(), Resize(), SetChildrenPrefSizes(), and SetValues().

Here is the caller graph for this function:

static Boolean PopPaneStack ( PanedWidget  pw  )  [static]

Definition at line 1386 of file Paned.c.

References FALSE, _PaneStack::next, and TRUE.

01388 {
01389   PaneStack * stack = pw->paned.stack;
01390 
01391   if (stack == NULL) return(FALSE);
01392 
01393   pw->paned.stack = stack->next;
01394   XtFree((char*)stack);
01395 
01396   if (pw->paned.stack == NULL) return(FALSE);
01397   return(TRUE);
01398 }

static Boolean PopPaneStack (  )  [static]

Referenced by ClearPaneStack(), and LoopAndRefigureChildren().

Here is the caller graph for this function:

static void PushPaneStack ( PanedWidget  pw,
Pane  pane 
) [static]

Definition at line 1338 of file Paned.c.

References _PaneStack::next, _PaneStack::pane, _PanedConstraintsPart::size, and _PaneStack::start_size.

01341 {
01342   PaneStack * stack = (PaneStack *) XtMalloc(sizeof(PaneStack));
01343 
01344   stack->next = pw->paned.stack;
01345   stack->pane = pane;
01346   stack->start_size = pane->size;
01347 
01348   pw->paned.stack = stack;
01349 }

static void PushPaneStack (  )  [static]

Referenced by LoopAndRefigureChildren().

Here is the caller graph for this function:

static void Realize ( Widget  w,
Mask *  valueMask,
XSetWindowAttributes *  attributes 
) [static]

Definition at line 1567 of file Paned.c.

References FALSE, ForAllPanes, HasGrip, _PanedRec::paned, PaneInfo, RefigureLocationsAndCommit(), PanedPart::resize_children_to_pref, and SuperClass.

01571 {
01572     PanedWidget pw = (PanedWidget) w;
01573     Widget * childP;
01574 
01575     if ((attributes->cursor = (pw)->paned.cursor) != None)
01576         *valueMask |= CWCursor;
01577 
01578     (*SuperClass->core_class.realize) (w, valueMask, attributes);
01579 
01580 /*
01581  * Before we commit the new locations we need to realize all the panes and
01582  * their grips.
01583  */
01584 
01585     ForAllPanes(pw, childP) {
01586         XtRealizeWidget( *childP );
01587         if (HasGrip (*childP))
01588             XtRealizeWidget( PaneInfo(*childP)->grip );
01589     }
01590 
01591     RefigureLocationsAndCommit(w);
01592     pw->paned.resize_children_to_pref = FALSE;
01593 } /* Realize */

Here is the call graph for this function:

static void Realize (  )  [static]

static void Redisplay ( Widget  w,
XEvent *  event,
Region  region 
) [static]

Definition at line 1718 of file Paned.c.

References DrawInternalBorders.

01722 {
01723     DrawInternalBorders( (PanedWidget) w);
01724 }

static void Redisplay (  )  [static]

static void RefigureLocations ( PanedWidget  pw,
int  paneindex,
Direction  dir 
) [static]

Definition at line 594 of file Paned.c.

References AnyPane, AssignMax, AssignMin, ForAllPanes, IsVert, LoopAndRefigureChildren(), _PanedConstraintsPart::max, _PanedConstraintsPart::min, NO_INDEX, PaneInfo, PaneSize(), _PanedConstraintsPart::size, and ThisBorderOnly.

Referenced by GeometryManager(), MoveGripAdjustment(), and RefigureLocationsAndCommit().

00598 {
00599     Widget *childP;
00600     int pane_size = (int) PaneSize( (Widget) pw, IsVert(pw) );
00601     int sizeused = 0;
00602     Position loc = 0;
00603 
00604     if (pw->paned.num_panes == 0 || !pw->paned.refiguremode) return;
00605 
00606 /*
00607  * Get an initial estimate of the size we will use.
00608  */
00609 
00610     ForAllPanes(pw, childP) {
00611         Pane pane = PaneInfo(*childP);
00612         AssignMax(pane->size, (int) pane->min);
00613         AssignMin(pane->size, (int) pane->max);
00614         sizeused += (int) pane->size + (int) pw->paned.internal_bw;
00615     }
00616     sizeused -= (int) pw->paned.internal_bw;
00617 
00618     if ( (dir != ThisBorderOnly) && (sizeused != pane_size) ) 
00619       LoopAndRefigureChildren(pw, paneindex, dir, &sizeused);
00620 
00621 /* 
00622  * If we still are not the right size, then tell the pane that
00623  * wanted to resize that it can't.
00624  */
00625 
00626 
00627     if ( (paneindex != NO_INDEX) && (dir != AnyPane) ) {
00628         Pane pane = PaneInfo(*(pw->composite.children + paneindex));
00629         Dimension old = pane->size;
00630 
00631         pane->size += pane_size - sizeused;
00632         AssignMax(pane->size, (int) pane->min);
00633         AssignMin(pane->size, (int) pane->max);
00634         sizeused += pane->size - old;
00635     }
00636     
00637 /*
00638  * It is possible that the panes will not fit inside the vpaned widget, but
00639  * we have tried out best.
00640  *
00641  * Assign each pane a location.
00642  */
00643 
00644     ForAllPanes(pw, childP) {
00645         PaneInfo(*childP)->delta = loc;
00646         loc += PaneInfo(*childP)->size + pw->paned.internal_bw;
00647     }
00648 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void RefigureLocationsAndCommit ( Widget  w  )  [static]

Definition at line 729 of file Paned.c.

References AnyPane, CommitNewLocations(), NO_INDEX, _PanedRec::paned, RefigureLocations(), and PanedPart::refiguremode.

00731 {
00732     PanedWidget pw = (PanedWidget) w;
00733     if (pw->paned.refiguremode && XtIsRealized( (Widget) pw) &&
00734         pw->paned.num_panes > 0 ) {
00735         RefigureLocations(pw, NO_INDEX, AnyPane);
00736         CommitNewLocations(pw);
00737     }
00738 }

Here is the call graph for this function:

static void RefigureLocationsAndCommit (  )  [static]

Referenced by ChangeManaged(), Realize(), Resize(), SetValues(), XawPanedSetMinMax(), and XawPanedSetRefigureMode().

Here is the caller graph for this function:

static void ReleaseGCs ( Widget  w  )  [static]

Definition at line 1596 of file Paned.c.

References PanedPart::flipgc, PanedPart::invgc, PanedPart::normgc, and _PanedRec::paned.

01598 {
01599     PanedWidget pw = (PanedWidget)w;
01600 
01601     XtReleaseGC( w, pw->paned.normgc );
01602     XtReleaseGC( w, pw->paned.invgc );
01603     XtReleaseGC( w, pw->paned.flipgc );
01604 } 

static void ReleaseGCs (  ) 

Referenced by SetValues().

Here is the caller graph for this function:

static void Resize ( Widget  w  )  [static]

Definition at line 1708 of file Paned.c.

References IsVert, PaneSize(), RefigureLocationsAndCommit(), SetChildrenPrefSizes(), and w.

01710 {
01711     SetChildrenPrefSizes( (PanedWidget) w,
01712                           PaneSize(w, !IsVert((PanedWidget) w)) );
01713     RefigureLocationsAndCommit(w);
01714 }

Here is the call graph for this function:

static void Resize (  ) 

static void ResortChildren ( PanedWidget  pw  )  [static]

Definition at line 1110 of file Paned.c.

References ForAllChildren, and IsPane.

Referenced by ChangeManaged().

01112 {
01113     Widget * unmanagedP, * childP;
01114 
01115     unmanagedP = NULL;
01116     ForAllChildren(pw, childP) {
01117        if (!IsPane(*childP) || !XtIsManaged(*childP)) {
01118            /*
01119             * We only keep track of the first unmanaged pane.
01120             */
01121            if (unmanagedP == NULL)    
01122                unmanagedP = childP;
01123        }
01124        else {                        /* must be a managed pane */
01125            /*
01126             * If an earlier widget was not a managed pane, then swap 
01127             */
01128            if (unmanagedP != NULL) {       
01129                Widget child = *unmanagedP;
01130                *unmanagedP = *childP;
01131                *childP = child;
01132                childP = unmanagedP;  /* easiest to just back-track */
01133                unmanagedP = NULL;    /* in case there is another managed */
01134            }
01135        }
01136    }
01137 }

Here is the caller graph for this function:

static Boolean SatisfiesRule1 ( Pane  pane,
Boolean  shrink 
) [static]

Definition at line 462 of file Paned.c.

00465 {
00466   return( (shrink && (pane->size != pane->min)) ||
00467           (!shrink && (pane->size != pane->max)) );
00468 }

static Boolean SatisfiesRule1 (  )  [static]

Referenced by ChoosePaneToResize().

Here is the caller graph for this function:

static Boolean SatisfiesRule2 ( Pane  pane  )  [static]

Definition at line 477 of file Paned.c.

00479 {
00480   return(!pane->skip_adjust || pane->paned_adjusted_me);
00481 }

static Boolean SatisfiesRule2 (  ) 

Referenced by ChoosePaneToResize().

Here is the caller graph for this function:

static Boolean SatisfiesRule3 ( Pane  pane,
Boolean  shrink 
) [static]

Definition at line 491 of file Paned.c.

00494 {
00495   return ( pane->paned_adjusted_me &&
00496            ( (shrink && ((int)pane->wp_size <= pane->size)) ||
00497              (!shrink && ((int)pane->wp_size >= pane->size))) );
00498 }

static Boolean SatisfiesRule3 (  ) 

Referenced by ChoosePaneToResize(), and LoopAndRefigureChildren().

Here is the caller graph for this function:

static void SetChildrenPrefSizes ( PanedWidget  pw,
Dimension  off_size 
) [static]

Definition at line 1258 of file Paned.c.

References ForAllPanes, IsVert, PANED_ASK_CHILD, PaneInfo, and PaneSize().

Referenced by ChangeManaged(), and Resize().

01261 {
01262     Widget * childP;
01263     Boolean vert = IsVert(pw);
01264     XtWidgetGeometry request, reply;
01265 
01266     ForAllPanes(pw, childP)
01267         if ( pw->paned.resize_children_to_pref          ||
01268              (PaneInfo(*childP)->size == 0)             ||
01269              (PaneInfo(*childP)->resize_to_pref) ) {
01270 
01271             if (PaneInfo(*childP)->preferred_size != PANED_ASK_CHILD) 
01272                 PaneInfo(*childP)->wp_size=PaneInfo(*childP)->preferred_size;
01273             else {
01274                 if( vert ) {
01275                     request.request_mode = CWWidth;
01276                     request.width = off_size;
01277                 }
01278                 else {
01279                     request.request_mode = CWHeight;
01280                     request.height = off_size;
01281                 }
01282 
01283                 if ((XtQueryGeometry( *childP, &request, &reply ) 
01284                                                  == XtGeometryAlmost) &&
01285                     (reply.request_mode = (vert ? CWHeight : CWWidth)))
01286                     PaneInfo(*childP)->wp_size = GetRequestInfo(&reply, vert);
01287                 else
01288                     PaneInfo(*childP)->wp_size = PaneSize(*childP, vert);
01289             } 
01290 
01291             PaneInfo(*childP)->size = PaneInfo(*childP)->wp_size;
01292           }
01293 }

Here is the call graph for this function:

Here is the caller graph for this function:

static Boolean SetValues ( Widget  old,
Widget  request,
Widget  new,
ArgList  args,
Cardinal *  num_args 
) [static]

Definition at line 1728 of file Paned.c.

References AdjustPanedSize(), ChangeAllGripCursors(), ChangeManaged(), CommitNewLocations(), _PanedRec::core, PanedPart::cursor, FALSE, GetGCs(), PanedPart::grip_cursor, PanedPart::grip_indent, PanedPart::h_grip_cursor, PanedPart::internal_bp, PanedPart::internal_bw, IsVert, _PanedRec::paned, PaneSize(), RefigureLocationsAndCommit(), ReleaseGCs(), TRUE, and PanedPart::v_grip_cursor.

01732 {
01733     PanedWidget old_pw = (PanedWidget) old;
01734     PanedWidget new_pw = (PanedWidget) new;
01735     Boolean redisplay = FALSE;
01736 
01737     if ( (old_pw->paned.cursor != new_pw->paned.cursor) && XtIsRealized(new))
01738         XDefineCursor(XtDisplay(new), XtWindow(new), new_pw->paned.cursor);
01739 
01740     if ( (old_pw->paned.internal_bp != new_pw->paned.internal_bp) ||
01741          (old_pw->core.background_pixel != new_pw->core.background_pixel) ) {
01742         ReleaseGCs(old);
01743         GetGCs(new);
01744         redisplay = TRUE;
01745     }
01746 
01747     if ( (old_pw->paned.grip_cursor != new_pw->paned.grip_cursor)     ||
01748          (old_pw->paned.v_grip_cursor != new_pw->paned.v_grip_cursor) ||
01749          (old_pw->paned.h_grip_cursor != new_pw->paned.h_grip_cursor) ) {
01750         ChangeAllGripCursors(new_pw);
01751     }
01752         
01753     if ( IsVert(old_pw) != IsVert(new_pw)) {
01754 /*
01755  * We are fooling the paned widget into thinking that is needs to
01756  * fully refigure everything, which is what we want.
01757  */
01758         if (IsVert(new_pw))
01759             new_pw->core.width = 0;
01760         else
01761             new_pw->core.height = 0;
01762 
01763         new_pw->paned.resize_children_to_pref = TRUE;
01764         ChangeManaged(new);     /* Seems weird, but does the right thing. */
01765         new_pw->paned.resize_children_to_pref = FALSE;
01766         if (new_pw->paned.grip_cursor == None)
01767             ChangeAllGripCursors(new_pw);
01768         return(TRUE);
01769     }
01770 
01771     if (old_pw->paned.internal_bw != new_pw->paned.internal_bw) {
01772         AdjustPanedSize( new_pw, PaneSize(new, !IsVert(old_pw)),
01773                          (XtGeometryResult *)NULL, 
01774                          (Dimension *)NULL, (Dimension *)NULL);
01775         RefigureLocationsAndCommit(new);
01776         return(TRUE);           /* We have done a full configuration, return.*/
01777     }
01778     
01779     if ( (old_pw->paned.grip_indent != new_pw->paned.grip_indent) &&
01780          (XtIsRealized(new)) ) {
01781         CommitNewLocations(new_pw);
01782         redisplay = TRUE;
01783     }
01784 
01785     return (redisplay);
01786 } /* SetValues */

Here is the call graph for this function:

static Boolean SetValues (  )  [static]

static void StartGripAdjustment ( PanedWidget  pw,
Widget  grip,
Direction  dir 
) [static]

Definition at line 904 of file Paned.c.

References EraseInternalBorders, ForAllPanes, IsVert, LowRightPane, PaneIndex, PaneInfo, ThisBorderOnly, and UpLeftPane.

Referenced by HandleGrip().

00908 {
00909     Widget *childP;
00910     Cursor cursor;
00911 
00912     pw->paned.whichadd = pw->paned.whichsub = (Widget) NULL;
00913 
00914     if (dir == ThisBorderOnly || dir == UpLeftPane)
00915       pw->paned.whichadd = pw->composite.children[PaneIndex(grip)];
00916     if (dir == ThisBorderOnly || dir == LowRightPane)
00917       pw->paned.whichsub = pw->composite.children[PaneIndex(grip) + 1];
00918 
00919 /*
00920  * Change the cursor.
00921  */
00922 
00923     if (XtIsRealized(grip)) {
00924         if ( IsVert(pw) ) {
00925             if (dir == UpLeftPane) 
00926                 cursor = pw->paned.adjust_upper_cursor;
00927             else if (dir == LowRightPane) 
00928                 cursor = pw->paned.adjust_lower_cursor;
00929             else {
00930                 if ( pw->paned.adjust_this_cursor == None)
00931                     cursor = pw->paned.v_adjust_this_cursor;
00932                 else
00933                     cursor = pw->paned.adjust_this_cursor;
00934             }
00935         }
00936         else {
00937             if (dir == UpLeftPane) 
00938                 cursor = pw->paned.adjust_left_cursor;
00939             else if (dir == LowRightPane) 
00940                 cursor = pw->paned.adjust_right_cursor;
00941             else {
00942                 if (pw->paned.adjust_this_cursor == None)
00943                     cursor = pw->paned.h_adjust_this_cursor;
00944                 else
00945                     cursor = pw->paned.adjust_this_cursor;
00946             }
00947         }
00948     
00949         XDefineCursor(XtDisplay(grip), XtWindow(grip), cursor);
00950     }
00951 
00952     EraseInternalBorders(pw);
00953     ForAllPanes(pw, childP) 
00954         PaneInfo(*childP)->olddelta = -99;
00955 }

Here is the caller graph for this function:

void XawPanedAllowResize ( Widget  widget,
Boolean  allow_resize 
)

Definition at line 1939 of file Paned.c.

References PaneInfo.

Referenced by DisableWindowResize().

01943 {
01944     PaneInfo(widget)->allow_resize = allow_resize;
01945 }

Here is the caller graph for this function:

void XawPanedGetMinMax ( Widget  widget,
int min,
int max 
)

Definition at line 1869 of file Paned.c.

References _PanedConstraintsPart::max, _PanedConstraintsPart::min, and PaneInfo.

01873 {
01874     Pane pane = PaneInfo(widget);
01875 
01876     *min = pane->min;
01877     *max = pane->max;
01878 }

int XawPanedGetNumSub ( Widget  w  ) 

Definition at line 1916 of file Paned.c.

01919 {
01920     return ((PanedWidget)w)->paned.num_panes;
01921 }

void XawPanedSetMinMax ( Widget  widget,
int  min,
int  max 
)

Definition at line 1846 of file Paned.c.

References _PanedConstraintsPart::max, _PanedConstraintsPart::min, PaneInfo, and RefigureLocationsAndCommit().

Referenced by DisableWindowResize(), and PaneSetValues().

01850 {
01851     Pane pane = PaneInfo(widget);
01852 
01853     pane->min = min;
01854     pane->max = max;
01855     RefigureLocationsAndCommit( widget->core.parent );
01856 }

Here is the call graph for this function:

Here is the caller graph for this function:

void XawPanedSetRefigureMode ( Widget  w,
Boolean  mode 
)

Definition at line 1897 of file Paned.c.

References mode, and RefigureLocationsAndCommit().

01901 {
01902     ((PanedWidget) w)->paned.refiguremode = mode;
01903     RefigureLocationsAndCommit( w );
01904 }

Here is the call graph for this function:


Variable Documentation

char defGripTranslations[] [static]

Initial value:

    "<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)"

Definition at line 107 of file Paned.c.

PanedClassRec panedClassRec

Definition at line 209 of file Paned.c.

WidgetClass panedWidgetClass = (WidgetClass) &panedClassRec

Definition at line 263 of file Paned.c.

XtResource resources[] [static]

Definition at line 118 of file Paned.c.

XtResource subresources[] [static]

Initial value:

 {
    {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},
}

Definition at line 166 of file Paned.c.

WidgetClass vPanedWidgetClass = (WidgetClass) &panedClassRec

Definition at line 266 of file Paned.c.


Generated on Sun Mar 4 16:01:35 2007 for Scilab [trunk] by  doxygen 1.5.1