#include <X11/IntrinsicP.h>#include <X11/StringDefs.h>#include <X11/Xaw3d/XawInit.h>#include <X11/Xaw3d/Cardinals.h>#include <X11/Xaw3d/TreeP.h>Include dependency graph for Tree.c:

Go to the source code of this file.
Defines | |
| #define | IsHorizontal(tw) |
Functions | |
| static void | ClassInitialize () |
| static void | Initialize () |
| static void | ConstraintInitialize () |
| static void | ConstraintDestroy () |
| static Boolean | ConstraintSetValues () |
| static void | Destroy () |
| static Boolean | SetValues () |
| static XtGeometryResult | GeometryManager () |
| static void | ChangeManaged () |
| static void | Redisplay () |
| static XtGeometryResult | QueryGeometry () |
| static void | insert_node () |
| static void | delete_node () |
| static void | layout_tree () |
| static void | initialize_dimensions (Dimension **listp, int *sizep, int n) |
| static GC | get_tree_gc (TreeWidget w) |
| static void | insert_node (Widget parent, Widget node) |
| static void | delete_node (Widget parent, Widget node) |
| static void | check_gravity (TreeWidget tw, XtGravity grav) |
| static void | Initialize (Widget grequest, Widget gnew, ArgList args, Cardinal *num_args) |
| static void | ConstraintInitialize (Widget request, Widget new, ArgList args, Cardinal *num_args) |
| static Boolean | SetValues (Widget gcurrent, Widget grequest, Widget gnew, ArgList args, Cardinal *num_args) |
| static Boolean | ConstraintSetValues (Widget current, Widget request, Widget new, ArgList args, Cardinal *num_args) |
| static void | ConstraintDestroy (Widget w) |
| static XtGeometryResult | GeometryManager (Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply) |
| static void | ChangeManaged (Widget gw) |
| static void | Destroy (Widget gw) |
| static void | Redisplay (Widget gw, XEvent *event, Region region) |
| static XtGeometryResult | QueryGeometry (Widget w, XtWidgetGeometry *intended, XtWidgetGeometry *preferred) |
| static void | compute_bounding_box_subtree (TreeWidget tree, Widget w, int depth) |
| static void | set_positions (TreeWidget tw, Widget w, int level) |
| static void | arrange_subtree (TreeWidget tree, Widget w, int depth, Position x, Position y) |
| static void | set_tree_size (TreeWidget tw, Boolean insetvalues, Dimension width, Dimension height) |
| static void | layout_tree (TreeWidget tw, Boolean insetvalues) |
| void | XawTreeForceLayout (Widget tree) |
Variables | |
| static XtResource | resources [] |
| static XtResource | treeConstraintResources [] |
| TreeClassRec | treeClassRec |
| WidgetClass | treeWidgetClass = (WidgetClass) &treeClassRec |
| #define IsHorizontal | ( | tw | ) |
Value:
((tw)->tree.gravity == WestGravity || \
(tw)->tree.gravity == EastGravity)
Definition at line 59 of file Tree.c.
Referenced by arrange_subtree(), compute_bounding_box_subtree(), Initialize(), and SetValues().
| static void arrange_subtree | ( | TreeWidget | tree, | |
| Widget | w, | |||
| int | depth, | |||
| Position | x, | |||
| Position | y | |||
| ) | [static] |
Definition at line 815 of file Tree.c.
References _TreeConstraintsPart::bbheight, _TreeConstraintsPart::bbsubheight, _TreeConstraintsPart::bbsubwidth, _TreeConstraintsPart::bbwidth, _TreeConstraintsPart::children, i, int, IsHorizontal, _TreeConstraintsPart::n_children, NULL, _TreeConstraintsRec::tree, TREE_CONSTRAINT, _TreeConstraintsPart::x, and _TreeConstraintsPart::y.
Referenced by layout_tree().
00820 { 00821 TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */ 00822 TreeConstraints firstcc, lastcc; 00823 int i; 00824 int newx, newy; 00825 Bool horiz = IsHorizontal (tree); 00826 Widget child = NULL; 00827 Dimension tmp; 00828 Dimension bw2 = w->core.border_width * 2; 00829 Bool relayout = True; 00830 00831 00832 /* 00833 * If no children, then just lay out where requested. 00834 */ 00835 tc->tree.x = x; 00836 tc->tree.y = y; 00837 00838 if (horiz) { 00839 int myh = (w->core.height + bw2); 00840 00841 if (myh > (int)tc->tree.bbsubheight) { 00842 y += (myh - (int)tc->tree.bbsubheight) / 2; 00843 relayout = False; 00844 } 00845 } else { 00846 int myw = (w->core.width + bw2); 00847 00848 if (myw > (int)tc->tree.bbsubwidth) { 00849 x += (myw - (int)tc->tree.bbsubwidth) / 2; 00850 relayout = False; 00851 } 00852 } 00853 00854 if ((tmp = ((Dimension) x) + tc->tree.bbwidth) > tree->tree.maxwidth) 00855 tree->tree.maxwidth = tmp; 00856 if ((tmp = ((Dimension) y) + tc->tree.bbheight) > tree->tree.maxheight) 00857 tree->tree.maxheight = tmp; 00858 00859 if (tc->tree.n_children == 0) return; 00860 00861 00862 /* 00863 * Have children, so walk down tree laying out children, then laying 00864 * out parents. 00865 */ 00866 if (horiz) { 00867 newx = x + tree->tree.largest[depth]; 00868 if (depth > 0) newx += tree->tree.hpad; 00869 newy = y; 00870 } else { 00871 newx = x; 00872 newy = y + tree->tree.largest[depth]; 00873 if (depth > 0) newy += tree->tree.vpad; 00874 } 00875 00876 for (i = 0; i < tc->tree.n_children; i++) { 00877 TreeConstraints cc; 00878 00879 child = tc->tree.children[i]; /* last value is used outside loop */ 00880 cc = TREE_CONSTRAINT(child); 00881 00882 arrange_subtree (tree, child, depth + 1, newx, newy); 00883 if (horiz) { 00884 newy += tree->tree.vpad + cc->tree.bbheight; 00885 } else { 00886 newx += tree->tree.hpad + cc->tree.bbwidth; 00887 } 00888 } 00889 00890 /* 00891 * now layout parent between first and last children 00892 */ 00893 if (relayout) { 00894 Position adjusted; 00895 firstcc = TREE_CONSTRAINT (tc->tree.children[0]); 00896 lastcc = TREE_CONSTRAINT (child); 00897 00898 /* Adjustments are disallowed if they result in a position above 00899 * or to the left of the originally requested position, because 00900 * this could collide with the position of the previous sibling. 00901 */ 00902 if (horiz) { 00903 tc->tree.x = x; 00904 adjusted = firstcc->tree.y + 00905 ((lastcc->tree.y + (Position) child->core.height + 00906 (Position) child->core.border_width * 2 - 00907 firstcc->tree.y - (Position) w->core.height - 00908 (Position) w->core.border_width * 2 + 1) / 2); 00909 if (adjusted > tc->tree.y) tc->tree.y = adjusted; 00910 } else { 00911 adjusted = firstcc->tree.x + 00912 ((lastcc->tree.x + (Position) child->core.width + 00913 (Position) child->core.border_width * 2 - 00914 firstcc->tree.x - (Position) w->core.width - 00915 (Position) w->core.border_width * 2 + 1) / 2); 00916 if (adjusted > tc->tree.x) tc->tree.x = adjusted; 00917 tc->tree.y = y; 00918 } 00919 } 00920 }
Here is the caller graph for this function:

| static void ChangeManaged | ( | Widget | gw | ) | [static] |
Definition at line 552 of file Tree.c.
References FALSE, and layout_tree().
00554 { 00555 layout_tree ((TreeWidget) gw, FALSE); 00556 }
Here is the call graph for this function:

| static void ChangeManaged | ( | ) | [static] |
| static void check_gravity | ( | TreeWidget | tw, | |
| XtGravity | grav | |||
| ) | [static] |
Definition at line 297 of file Tree.c.
Referenced by Initialize(), and SetValues().
00300 { 00301 switch (tw->tree.gravity) { 00302 case WestGravity: case NorthGravity: case EastGravity: case SouthGravity: 00303 break; 00304 default: 00305 tw->tree.gravity = grav; 00306 break; 00307 } 00308 }
Here is the caller graph for this function:

| static void ClassInitialize | ( | ) | [static] |
Definition at line 121 of file Simple.c.
References NULL, XawInitializeWidgetSet(), XmuCvtStringToColorCursor(), XmuCvtStringToOrientation(), XtNpointerColor, XtNpointerColorBackground, and XtRColorCursor.
00122 { 00123 static XtConvertArgRec convertArg[] = { 00124 {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen), 00125 sizeof(Screen *)}, 00126 {XtResourceString, (XtPointer) XtNpointerColor, sizeof(Pixel)}, 00127 {XtResourceString, (XtPointer) XtNpointerColorBackground, 00128 sizeof(Pixel)}, 00129 {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.colormap), 00130 sizeof(Colormap)} 00131 }; 00132 00133 XawInitializeWidgetSet(); 00134 XtSetTypeConverter( XtRString, XtRColorCursor, XmuCvtStringToColorCursor, 00135 convertArg, XtNumber(convertArg), 00136 XtCacheByDisplay, (XtDestructor)NULL); 00137 }
Here is the call graph for this function:

| static void compute_bounding_box_subtree | ( | TreeWidget | tree, | |
| Widget | w, | |||
| int | depth | |||
| ) | [static] |
Definition at line 701 of file Tree.c.
References _TreeConstraintsPart::bbheight, _TreeConstraintsPart::bbsubheight, _TreeConstraintsPart::bbsubwidth, _TreeConstraintsPart::bbwidth, _TreeConstraintsPart::children, i, initialize_dimensions(), IsHorizontal, _TreeConstraintsPart::n_children, _TreeConstraintsRec::tree, and TREE_CONSTRAINT.
Referenced by layout_tree().
00705 { 00706 TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */ 00707 int i; 00708 Bool horiz = IsHorizontal (tree); 00709 Dimension newwidth, newheight; 00710 Dimension bw2 = w->core.border_width * 2; 00711 00712 /* 00713 * Set the max-size per level. 00714 */ 00715 if (depth >= tree->tree.n_largest) { 00716 initialize_dimensions (&tree->tree.largest, 00717 &tree->tree.n_largest, depth + 1); 00718 } 00719 newwidth = ((horiz ? w->core.width : w->core.height) + bw2); 00720 if (tree->tree.largest[depth] < newwidth) 00721 tree->tree.largest[depth] = newwidth; 00722 00723 00724 /* 00725 * initialize 00726 */ 00727 tc->tree.bbwidth = w->core.width + bw2; 00728 tc->tree.bbheight = w->core.height + bw2; 00729 00730 if (tc->tree.n_children == 0) return; 00731 00732 /* 00733 * Figure the size of the opposite dimension (vertical if tree is 00734 * horizontal, else vice versa). The other dimension will be set 00735 * in the second pass once we know the maximum dimensions. 00736 */ 00737 newwidth = 0; 00738 newheight = 0; 00739 for (i = 0; i < tc->tree.n_children; i++) { 00740 Widget child = tc->tree.children[i]; 00741 TreeConstraints cc = TREE_CONSTRAINT(child); 00742 00743 compute_bounding_box_subtree (tree, child, depth + 1); 00744 00745 if (horiz) { 00746 if (newwidth < cc->tree.bbwidth) newwidth = cc->tree.bbwidth; 00747 newheight += tree->tree.vpad + cc->tree.bbheight; 00748 } else { 00749 if (newheight < cc->tree.bbheight) newheight = cc->tree.bbheight; 00750 newwidth += tree->tree.hpad + cc->tree.bbwidth; 00751 } 00752 } 00753 00754 00755 tc->tree.bbsubwidth = newwidth; 00756 tc->tree.bbsubheight = newheight; 00757 00758 /* 00759 * Now fit parent onto side (or top) of bounding box and correct for 00760 * extra padding. Be careful of unsigned arithmetic. 00761 */ 00762 if (horiz) { 00763 tc->tree.bbwidth += tree->tree.hpad + newwidth; 00764 newheight -= tree->tree.vpad; 00765 if (newheight > tc->tree.bbheight) tc->tree.bbheight = newheight; 00766 } else { 00767 tc->tree.bbheight += tree->tree.vpad + newheight; 00768 newwidth -= tree->tree.hpad; 00769 if (newwidth > tc->tree.bbwidth) tc->tree.bbwidth = newwidth; 00770 } 00771 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void ConstraintDestroy | ( | Widget | w | ) | [static] |
Definition at line 495 of file Tree.c.
References _TreeConstraintsPart::children, delete_node(), FALSE, i, insert_node(), layout_tree(), _TreeConstraintsPart::n_children, NULL, _TreeConstraintsPart::parent, _TreeConstraintsRec::tree, _TreeRec::tree, TREE_CONSTRAINT, and TreePart::tree_root.
00497 { 00498 TreeConstraints tc = TREE_CONSTRAINT(w); 00499 TreeWidget tw = (TreeWidget) XtParent(w); 00500 int i; 00501 00502 /* 00503 * Remove the widget from its parent's sub-nodes list and 00504 * make all this widget's sub-nodes sub-nodes of the parent. 00505 */ 00506 00507 if (tw->tree.tree_root == w) { 00508 if (tc->tree.n_children > 0) 00509 tw->tree.tree_root = tc->tree.children[0]; 00510 else 00511 tw->tree.tree_root = NULL; 00512 } 00513 00514 delete_node (tc->tree.parent, (Widget) w); 00515 for (i = 0; i< tc->tree.n_children; i++) 00516 insert_node (tc->tree.parent, tc->tree.children[i]); 00517 00518 layout_tree ((TreeWidget) (w->core.parent), FALSE); 00519 }
Here is the call graph for this function:

| static void ConstraintDestroy | ( | ) | [static] |
| static void ConstraintInitialize | ( | Widget | request, | |
| Widget | new, | |||
| ArgList | args, | |||
| Cardinal * | num_args | |||
| ) | [static] |
Definition at line 384 of file Tree.c.
References _TreeConstraintsPart::bbsubheight, _TreeConstraintsPart::bbsubwidth, _TreeConstraintsPart::children, insert_node(), _TreeConstraintsPart::max_children, _TreeConstraintsPart::n_children, NULL, _TreeConstraintsPart::parent, _TreeRec::tree, _TreeConstraintsRec::tree, TREE_CONSTRAINT, TreePart::tree_root, _TreeConstraintsPart::x, and _TreeConstraintsPart::y.
00388 { 00389 TreeConstraints tc = TREE_CONSTRAINT(new); 00390 TreeWidget tw = (TreeWidget) new->core.parent; 00391 00392 /* 00393 * Initialize the widget to have no sub-nodes. 00394 */ 00395 tc->tree.n_children = 0; 00396 tc->tree.max_children = 0; 00397 tc->tree.children = (Widget *) NULL; 00398 tc->tree.x = tc->tree.y = 0; 00399 tc->tree.bbsubwidth = 0; 00400 tc->tree.bbsubheight = 0; 00401 00402 00403 /* 00404 * If this widget has a super-node, add it to that 00405 * widget' sub-nodes list. Otherwise make it a sub-node of 00406 * the tree_root widget. 00407 */ 00408 if (tc->tree.parent) 00409 insert_node (tc->tree.parent, new); 00410 else if (tw->tree.tree_root) 00411 insert_node (tw->tree.tree_root, new); 00412 }
Here is the call graph for this function:

| static void ConstraintInitialize | ( | ) | [static] |
| static Boolean ConstraintSetValues | ( | Widget | current, | |
| Widget | request, | |||
| Widget | new, | |||
| ArgList | args, | |||
| Cardinal * | num_args | |||
| ) | [static] |
Definition at line 464 of file Tree.c.
References delete_node(), FALSE, insert_node(), layout_tree(), _TreeConstraintsPart::parent, _TreeConstraintsRec::tree, and TREE_CONSTRAINT.
00468 { 00469 TreeConstraints newc = TREE_CONSTRAINT(new); 00470 TreeConstraints curc = TREE_CONSTRAINT(current); 00471 TreeWidget tw = (TreeWidget) new->core.parent; 00472 00473 /* 00474 * If the parent field has changed, remove the widget 00475 * from the old widget's children list and add it to the 00476 * new one. 00477 */ 00478 if (curc->tree.parent != newc->tree.parent){ 00479 if (curc->tree.parent) 00480 delete_node (curc->tree.parent, new); 00481 if (newc->tree.parent) 00482 insert_node(newc->tree.parent, new); 00483 00484 /* 00485 * If the Tree widget has been realized, 00486 * compute new layout. 00487 */ 00488 if (XtIsRealized((Widget)tw)) 00489 layout_tree (tw, FALSE); 00490 } 00491 return False; 00492 }
Here is the call graph for this function:

| static Boolean ConstraintSetValues | ( | ) | [static] |
| static void delete_node | ( | Widget | parent, | |
| Widget | node | |||
| ) | [static] |
Definition at line 261 of file Tree.c.
References _TreeConstraintsPart::children, i, _TreeConstraintsPart::n_children, pos, _TreeConstraintsRec::tree, and TREE_CONSTRAINT.
00263 { 00264 TreeConstraints pc; 00265 int pos, i; 00266 00267 /* 00268 * Make sure the parent exists. 00269 */ 00270 if (!parent) return; 00271 00272 pc = TREE_CONSTRAINT(parent); 00273 00274 /* 00275 * Find the sub_node on its parent's list. 00276 */ 00277 for (pos = 0; pos < pc->tree.n_children; pos++) 00278 if (pc->tree.children[pos] == node) break; 00279 00280 if (pos == pc->tree.n_children) return; 00281 00282 /* 00283 * Decrement the number of children 00284 */ 00285 pc->tree.n_children--; 00286 00287 /* 00288 * Fill in the gap left by the sub_node. 00289 * Zero the last slot for good luck. 00290 */ 00291 for (i = pos; i < pc->tree.n_children; i++) 00292 pc->tree.children[i] = pc->tree.children[i+1]; 00293 00294 pc->tree.children[pc->tree.n_children]=0; 00295 }
| static void delete_node | ( | ) | [static] |
Referenced by ConstraintDestroy(), and ConstraintSetValues().
Here is the caller graph for this function:

| static void Destroy | ( | Widget | gw | ) | [static] |
Definition at line 559 of file Tree.c.
References w.
00561 { 00562 TreeWidget w = (TreeWidget) gw; 00563 00564 XtReleaseGC (gw, w->tree.gc); 00565 if (w->tree.largest) XtFree ((char *) w->tree.largest); 00566 }
| static void Destroy | ( | ) | [static] |
| static XtGeometryResult GeometryManager | ( | Widget | w, | |
| XtWidgetGeometry * | request, | |||
| XtWidgetGeometry * | reply | |||
| ) | [static] |
Definition at line 522 of file Tree.c.
References TreePart::auto_reconfigure, FALSE, layout_tree(), and _TreeRec::tree.
00526 { 00527 00528 TreeWidget tw = (TreeWidget) w->core.parent; 00529 00530 /* 00531 * No position changes allowed!. 00532 */ 00533 if ((request->request_mode & CWX && request->x!=w->core.x) 00534 ||(request->request_mode & CWY && request->y!=w->core.y)) 00535 return (XtGeometryNo); 00536 00537 /* 00538 * Allow all resize requests. 00539 */ 00540 00541 if (request->request_mode & CWWidth) 00542 w->core.width = request->width; 00543 if (request->request_mode & CWHeight) 00544 w->core.height = request->height; 00545 if (request->request_mode & CWBorderWidth) 00546 w->core.border_width = request->border_width; 00547 00548 if (tw->tree.auto_reconfigure) layout_tree (tw, FALSE); 00549 return (XtGeometryYes); 00550 }
Here is the call graph for this function:

| static XtGeometryResult GeometryManager | ( | ) | [static] |
| static GC get_tree_gc | ( | TreeWidget | w | ) | [static] |
Definition at line 211 of file Tree.c.
Referenced by Initialize(), and SetValues().
00213 { 00214 XtGCMask valuemask = GCBackground | GCForeground; 00215 XGCValues values; 00216 00217 values.background = w->core.background_pixel; 00218 values.foreground = w->tree.foreground; 00219 if (w->tree.line_width != 0) { 00220 valuemask |= GCLineWidth; 00221 values.line_width = w->tree.line_width; 00222 } 00223 00224 return XtGetGC ((Widget) w, valuemask, &values); 00225 }
Here is the caller graph for this function:

| static void Initialize | ( | Widget | grequest, | |
| Widget | gnew, | |||
| ArgList | args, | |||
| Cardinal * | num_args | |||
| ) | [static] |
Definition at line 326 of file Tree.c.
References check_gravity(), _TreeRec::core, get_tree_gc(), TreePart::hpad, initialize_dimensions(), IsHorizontal, NULL, _TreeRec::tree, TREE_HORIZONTAL_DEFAULT_SPACING, TREE_INITIAL_DEPTH, TREE_VERTICAL_DEFAULT_SPACING, TWO, and TreePart::vpad.
00330 { 00331 TreeWidget request = (TreeWidget) grequest, new = (TreeWidget) gnew; 00332 Arg arglist[2]; 00333 00334 /* 00335 * Make sure the widget's width and height are 00336 * greater than zero. 00337 */ 00338 if (request->core.width <= 0) new->core.width = 5; 00339 if (request->core.height <= 0) new->core.height = 5; 00340 00341 /* 00342 * Set the padding according to the orientation 00343 */ 00344 if (request->tree.hpad == 0 && request->tree.vpad == 0) { 00345 if (IsHorizontal (request)) { 00346 new->tree.hpad = TREE_HORIZONTAL_DEFAULT_SPACING; 00347 new->tree.vpad = TREE_VERTICAL_DEFAULT_SPACING; 00348 } else { 00349 new->tree.hpad = TREE_VERTICAL_DEFAULT_SPACING; 00350 new->tree.vpad = TREE_HORIZONTAL_DEFAULT_SPACING; 00351 } 00352 } 00353 00354 /* 00355 * Create a graphics context for the connecting lines. 00356 */ 00357 new->tree.gc = get_tree_gc (new); 00358 00359 /* 00360 * Create the hidden root widget. 00361 */ 00362 new->tree.tree_root = (Widget) NULL; 00363 XtSetArg(arglist[0], XtNwidth, 1); 00364 XtSetArg(arglist[1], XtNheight, 1); 00365 new->tree.tree_root = XtCreateWidget ("root", widgetClass, gnew, 00366 arglist,TWO); 00367 00368 /* 00369 * Allocate the array used to hold the widest values per depth 00370 */ 00371 new->tree.largest = NULL; 00372 new->tree.n_largest = 0; 00373 initialize_dimensions (&new->tree.largest, &new->tree.n_largest, 00374 TREE_INITIAL_DEPTH); 00375 00376 /* 00377 * make sure that our gravity is one of the acceptable values 00378 */ 00379 check_gravity (new, WestGravity); 00380 }
Here is the call graph for this function:

| static void Initialize | ( | ) | [static] |
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 }
Definition at line 184 of file Tree.c.
Referenced by compute_bounding_box_subtree(), Initialize(), and layout_tree().
00188 { 00189 int i; 00190 Dimension *l; 00191 00192 if (!*listp) { 00193 *listp = (Dimension *) XtCalloc ((unsigned int) n, 00194 (unsigned int) sizeof(Dimension)); 00195 *sizep = ((*listp) ? n : 0); 00196 return; 00197 } 00198 if (n > *sizep) { 00199 *listp = (Dimension *) XtRealloc((char *) *listp, 00200 (unsigned int) (n*sizeof(Dimension))); 00201 if (!*listp) { 00202 *sizep = 0; 00203 return; 00204 } 00205 for (i = *sizep, l = (*listp) + i; i < n; i++, l++) *l = 0; 00206 *sizep = n; 00207 } 00208 return; 00209 }
Here is the caller graph for this function:

| static void insert_node | ( | Widget | parent, | |
| Widget | node | |||
| ) | [static] |
Definition at line 227 of file Tree.c.
References _TreeConstraintsPart::children, _TreeConstraintsPart::max_children, _TreeConstraintsPart::n_children, nc, NULL, _TreeConstraintsRec::tree, and TREE_CONSTRAINT.
00229 { 00230 TreeConstraints pc; 00231 TreeConstraints nc = TREE_CONSTRAINT(node); 00232 int nindex; 00233 00234 nc->tree.parent = parent; 00235 00236 if (parent == NULL) return; 00237 00238 /* 00239 * If there isn't more room in the children array, 00240 * allocate additional space. 00241 */ 00242 pc = TREE_CONSTRAINT(parent); 00243 nindex = pc->tree.n_children; 00244 00245 if (pc->tree.n_children == pc->tree.max_children) { 00246 pc->tree.max_children += (pc->tree.max_children / 2) + 2; 00247 pc->tree.children = (WidgetList) XtRealloc ((char *)pc->tree.children, 00248 (unsigned int) 00249 ((pc->tree.max_children) * 00250 sizeof(Widget))); 00251 } 00252 00253 /* 00254 * Add the sub_node in the next available slot and 00255 * increment the counter. 00256 */ 00257 pc->tree.children[nindex] = node; 00258 pc->tree.n_children++; 00259 }
| static void insert_node | ( | ) | [static] |
Referenced by ConstraintDestroy(), ConstraintInitialize(), and ConstraintSetValues().
Here is the caller graph for this function:

| static void layout_tree | ( | TreeWidget | tw, | |
| Boolean | insetvalues | |||
| ) | [static] |
Definition at line 946 of file Tree.c.
References arrange_subtree(), compute_bounding_box_subtree(), i, initialize_dimensions(), NULL, set_positions(), and set_tree_size().
00949 { 00950 int i; 00951 Dimension *dp; 00952 00953 /* 00954 * Do a depth-first search computing the width and height of the bounding 00955 * box for the tree at that position (and below). Then, walk again using 00956 * this information to layout the children at each level. 00957 */ 00958 00959 if (tw->tree.tree_root == NULL) 00960 return; 00961 00962 tw->tree.maxwidth = tw->tree.maxheight = 0; 00963 for (i = 0, dp = tw->tree.largest; i < tw->tree.n_largest; i++, dp++) 00964 *dp = 0; 00965 initialize_dimensions (&tw->tree.largest, &tw->tree.n_largest, 00966 tw->tree.n_largest); 00967 compute_bounding_box_subtree (tw, tw->tree.tree_root, 0); 00968 00969 /* 00970 * Second pass to do final layout. Each child's bounding box is stacked 00971 * on top of (if horizontal, else next to) on top of its siblings. The 00972 * parent is centered between the first and last children. 00973 */ 00974 arrange_subtree (tw, tw->tree.tree_root, 0, 0, 0); 00975 00976 /* 00977 * Move each widget into place. 00978 */ 00979 set_tree_size (tw, insetvalues, tw->tree.maxwidth, tw->tree.maxheight); 00980 set_positions (tw, tw->tree.tree_root, 0); 00981 00982 /* 00983 * And redisplay. 00984 */ 00985 if (XtIsRealized ((Widget) tw)) { 00986 XClearArea (XtDisplay(tw), XtWindow((Widget)tw), 0, 0, 0, 0, True); 00987 } 00988 }
Here is the call graph for this function:

| static void layout_tree | ( | ) | [static] |
Referenced by ChangeManaged(), ConstraintDestroy(), ConstraintSetValues(), GeometryManager(), SetValues(), and XawTreeForceLayout().
Here is the caller graph for this function:

| static XtGeometryResult QueryGeometry | ( | Widget | w, | |
| XtWidgetGeometry * | intended, | |||
| XtWidgetGeometry * | preferred | |||
| ) | [static] |
Definition at line 667 of file Tree.c.
References TreePart::maxheight, TreePart::maxwidth, and _TreeRec::tree.
00670 { 00671 TreeWidget tw = (TreeWidget) w; 00672 00673 preferred->request_mode = (CWWidth | CWHeight); 00674 preferred->width = tw->tree.maxwidth; 00675 preferred->height = tw->tree.maxheight; 00676 00677 if (((intended->request_mode & (CWWidth | CWHeight)) == 00678 (CWWidth | CWHeight)) && 00679 intended->width == preferred->width && 00680 intended->height == preferred->height) 00681 return XtGeometryYes; 00682 else if (preferred->width == w->core.width && 00683 preferred->height == w->core.height) 00684 return XtGeometryNo; 00685 else 00686 return XtGeometryAlmost; 00687 }
| static XtGeometryResult QueryGeometry | ( | ) | [static] |
| static void Redisplay | ( | Widget | gw, | |
| XEvent * | event, | |||
| Region | region | |||
| ) | [static] |
Definition at line 570 of file Tree.c.
References _TreeRec::composite, _TreeRec::core, dpy, TreePart::gc, gc, TreePart::gravity, i, j, _TreeRec::tree, TREE_CONSTRAINT, TreePart::tree_root, and w.
00574 { 00575 TreeWidget tw = (TreeWidget) gw; 00576 00577 /* 00578 * If the Tree widget is visible, visit each managed child. 00579 */ 00580 if (tw->core.visible) { 00581 int i, j; 00582 Display *dpy = XtDisplay (tw); 00583 Window w = XtWindow (tw); 00584 00585 for (i = 0; i < tw->composite.num_children; i++) { 00586 Widget child = tw->composite.children[i]; 00587 TreeConstraints tc = TREE_CONSTRAINT(child); 00588 00589 /* 00590 * Don't draw lines from the fake tree_root. 00591 */ 00592 if (child != tw->tree.tree_root && tc->tree.n_children) { 00593 int srcx = child->core.x + child->core.border_width; 00594 int srcy = child->core.y + child->core.border_width; 00595 00596 switch (tw->tree.gravity) { 00597 case WestGravity: 00598 srcx += child->core.width + child->core.border_width; 00599 /* fall through */ 00600 case EastGravity: 00601 srcy += child->core.height / 2; 00602 break; 00603 00604 case NorthGravity: 00605 srcy += child->core.height + child->core.border_width; 00606 /* fall through */ 00607 case SouthGravity: 00608 srcx += child->core.width / 2; 00609 break; 00610 } 00611 00612 for (j = 0; j < tc->tree.n_children; j++) { 00613 Widget k = tc->tree.children[j]; 00614 GC gc = (tc->tree.gc ? tc->tree.gc : tw->tree.gc); 00615 00616 switch (tw->tree.gravity) { 00617 case WestGravity: 00618 /* 00619 * right center to left center 00620 */ 00621 XDrawLine (dpy, w, gc, srcx, srcy, 00622 (int) k->core.x, 00623 (k->core.y + ((int) k->core.border_width) + 00624 ((int) k->core.height) / 2)); 00625 break; 00626 00627 case NorthGravity: 00628 /* 00629 * bottom center to top center 00630 */ 00631 XDrawLine (dpy, w, gc, srcx, srcy, 00632 (k->core.x + ((int) k->core.border_width) + 00633 ((int) k->core.width) / 2), 00634 (int) k->core.y); 00635 break; 00636 00637 case EastGravity: 00638 /* 00639 * left center to right center 00640 */ 00641 XDrawLine (dpy, w, gc, srcx, srcy, 00642 (k->core.x + 00643 (((int) k->core.border_width) << 1) + 00644 (int) k->core.width), 00645 (k->core.y + ((int) k->core.border_width) + 00646 ((int) k->core.height) / 2)); 00647 break; 00648 00649 case SouthGravity: 00650 /* 00651 * top center to bottom center 00652 */ 00653 XDrawLine (dpy, w, gc, srcx, srcy, 00654 (k->core.x + ((int) k->core.border_width) + 00655 ((int) k->core.width) / 2), 00656 (k->core.y + 00657 (((int) k->core.border_width) << 1) + 00658 (int) k->core.height)); 00659 break; 00660 } 00661 } 00662 } 00663 } 00664 } 00665 }
| static void Redisplay | ( | ) | [static] |
| static void set_positions | ( | TreeWidget | tw, | |
| Widget | w, | |||
| int | level | |||
| ) | [static] |
Definition at line 774 of file Tree.c.
References _TreeConstraintsPart::children, i, _TreeConstraintsPart::n_children, _TreeConstraintsRec::tree, TREE_CONSTRAINT, _TreeConstraintsPart::x, and _TreeConstraintsPart::y.
Referenced by layout_tree().
00778 { 00779 int i; 00780 00781 if (w) { 00782 TreeConstraints tc = TREE_CONSTRAINT(w); 00783 00784 if (level > 0) { 00785 /* 00786 * mirror if necessary 00787 */ 00788 switch (tw->tree.gravity) { 00789 case EastGravity: 00790 tc->tree.x = (((Position) tw->tree.maxwidth) - 00791 ((Position) w->core.width) - tc->tree.x); 00792 break; 00793 00794 case SouthGravity: 00795 tc->tree.y = (((Position) tw->tree.maxheight) - 00796 ((Position) w->core.height) - tc->tree.y); 00797 break; 00798 } 00799 00800 /* 00801 * Move the widget into position. 00802 */ 00803 XtMoveWidget (w, tc->tree.x, tc->tree.y); 00804 } 00805 00806 /* 00807 * Set the positions of all children. 00808 */ 00809 for (i = 0; i < tc->tree.n_children; i++) 00810 set_positions (tw, tc->tree.children[i], level + 1); 00811 } 00812 }
Here is the caller graph for this function:

| static void set_tree_size | ( | TreeWidget | tw, | |
| Boolean | insetvalues, | |||
| Dimension | width, | |||
| Dimension | height | |||
| ) | [static] |
Definition at line 922 of file Tree.c.
Referenced by layout_tree().
00926 { 00927 if (insetvalues) { 00928 tw->core.width = width; 00929 tw->core.height = height; 00930 } else { 00931 Dimension replyWidth = 0, replyHeight = 0; 00932 XtGeometryResult result = XtMakeResizeRequest ((Widget) tw, 00933 width, height, 00934 &replyWidth, 00935 &replyHeight); 00936 /* 00937 * Accept any compromise. 00938 */ 00939 if (result == XtGeometryAlmost) 00940 XtMakeResizeRequest ((Widget) tw, replyWidth, replyHeight, 00941 (Dimension *) NULL, (Dimension *) NULL); 00942 } 00943 return; 00944 }
Here is the caller graph for this function:

| static Boolean SetValues | ( | Widget | gcurrent, | |
| Widget | grequest, | |||
| Widget | gnew, | |||
| ArgList | args, | |||
| Cardinal * | num_args | |||
| ) | [static] |
Definition at line 416 of file Tree.c.
References check_gravity(), _TreeRec::core, FALSE, TreePart::foreground, get_tree_gc(), TreePart::gravity, TreePart::hpad, IsHorizontal, layout_tree(), TreePart::line_width, _TreeRec::tree, TRUE, and TreePart::vpad.
00420 { 00421 TreeWidget current = (TreeWidget) gcurrent, new = (TreeWidget) gnew; 00422 Boolean redraw = FALSE; 00423 00424 /* 00425 * If the foreground color has changed, redo the GC's 00426 * and indicate a redraw. 00427 */ 00428 if (new->tree.foreground != current->tree.foreground || 00429 new->core.background_pixel != current->core.background_pixel || 00430 new->tree.line_width != current->tree.line_width) { 00431 XtReleaseGC (gnew, new->tree.gc); 00432 new->tree.gc = get_tree_gc (new); 00433 redraw = TRUE; 00434 } 00435 00436 /* 00437 * If the minimum spacing has changed, recalculate the 00438 * tree layout. layout_tree() does a redraw, so we don't 00439 * need SetValues to do another one. 00440 */ 00441 if (new->tree.gravity != current->tree.gravity) { 00442 check_gravity (new, current->tree.gravity); 00443 } 00444 00445 if (IsHorizontal(new) != IsHorizontal(current)) { 00446 if (new->tree.vpad == current->tree.vpad && 00447 new->tree.hpad == current->tree.hpad) { 00448 new->tree.vpad = current->tree.hpad; 00449 new->tree.hpad = current->tree.vpad; 00450 } 00451 } 00452 00453 if (new->tree.vpad != current->tree.vpad || 00454 new->tree.hpad != current->tree.hpad || 00455 new->tree.gravity != current->tree.gravity) { 00456 layout_tree (new, TRUE); 00457 redraw = FALSE; 00458 } 00459 return redraw; 00460 }
Here is the call graph for this function:

| static Boolean SetValues | ( | ) | [static] |
| void XawTreeForceLayout | ( | Widget | tree | ) |
Definition at line 1002 of file Tree.c.
References FALSE, and layout_tree().
01005 { 01006 layout_tree ((TreeWidget) tree, FALSE); 01007 }
Here is the call graph for this function:

XtResource resources[] [static] |
Initial value:
{
{ XtNautoReconfigure, XtCAutoReconfigure, XtRBoolean, sizeof (Boolean),
XtOffsetOf(TreeRec, tree.auto_reconfigure), XtRImmediate,
(XtPointer) FALSE },
{ XtNhSpace, XtCHSpace, XtRDimension, sizeof (Dimension),
XtOffsetOf(TreeRec, tree.hpad), XtRImmediate, (XtPointer) 0 },
{ XtNvSpace, XtCVSpace, XtRDimension, sizeof (Dimension),
XtOffsetOf(TreeRec, tree.vpad), XtRImmediate, (XtPointer) 0 },
{ XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel),
XtOffsetOf(TreeRec, tree.foreground), XtRString,
XtDefaultForeground},
{ XtNlineWidth, XtCLineWidth, XtRDimension, sizeof (Dimension),
XtOffsetOf(TreeRec, tree.line_width), XtRImmediate, (XtPointer) 0 },
{ XtNgravity, XtCGravity, XtRGravity, sizeof (XtGravity),
XtOffsetOf(TreeRec, tree.gravity), XtRImmediate,
(XtPointer) WestGravity },
}
XtResource treeConstraintResources[] [static] |
Initial value:
{
{ XtNtreeParent, XtCTreeParent, XtRWidget, sizeof (Widget),
XtOffsetOf(TreeConstraintsRec, tree.parent), XtRImmediate, NULL },
{ XtNtreeGC, XtCTreeGC, XtRGC, sizeof(GC),
XtOffsetOf(TreeConstraintsRec, tree.gc), XtRImmediate, NULL },
}
| WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec |
1.5.1