From 6e4057717156adf6dba781d30db3f60a475ea7e4 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Fri, 14 Nov 2003 16:48:57 +0000 Subject: XFree86 4.3.0.1 --- Editres-color.ad | 58 +++++++++++++++++++++++++- Editres.ad | 124 ++++++++++++++++++++++++++++++++++++------------------- actions.c | 30 ++++++++------ comm.c | 38 ++++++++--------- editres.c | 15 +++---- editres.man | 13 ++++-- editresP.h | 85 ++++++++++++++++++++++++++++++++++++-- geometry.c | 70 +++++++------------------------ handler.c | 32 ++++++-------- setvalues.c | 4 +- svpopup.c | 14 +++---- utils.c | 41 +++++++++--------- widgets.c | 104 +++++++++++++++++++++++++--------------------- wtree.c | 41 ++++++------------ 14 files changed, 395 insertions(+), 274 deletions(-) diff --git a/Editres-color.ad b/Editres-color.ad index 62efee5..3e40e1f 100644 --- a/Editres-color.ad +++ b/Editres-color.ad @@ -1,14 +1,16 @@ ! $Xorg: Edit-col.ad,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ ! Here are some suggested resources if you are using a color workstation. ! They look pretty good on my display, your mileage may vary. +! $XFree86: xc/programs/editres/Edit-col.ad,v 1.4 2002/07/04 17:04:23 paulo Exp $ #include "Editres" *flashColor: Yellow *Background: RoyalBlue4 -*Foreground: Azure -*BorderColor: LightCyan1 +!*Foreground: Azure +!*BorderColor: LightCyan1 +*cursorColor: Azure *Tree.Background: Grey *Tree.Foreground: White @@ -35,3 +37,55 @@ *resourceBox*valueLabel.Background: Grey *resourceBox*valueLabel.Foreground: White *resourceBox*Command.Foreground: Gold + + + +*displayList: foreground rgb:20/35/73;lines 1,-1,-1,-1,-1,1;foreground rgb:30/4e/ab;lines -1,0,0,0,0,-1 +*Foreground: Azure3 +*borderColor: rgb:1d/30/69 +*internalBorderColor: rgb:1d/30/69 + +*SmeLine.lineWidth: 1 +*SmeLine.foreground: rgb:1d/30/69 +*SimpleMenu.VerticalMargins: 2 +*SimpleMenu.HorizontalMargins: 2 +*SimpleMenu.?.HorizontalMargins:8 + +*MenuButton.displayList: +*MenuButton.borderWidth: 1 +*MenuButton.borderColor: RoyalBlue4 +*MenuButton.shapeStyle: rectangle +*MenuButton.leftBitmap: None +*MenuButton.translations: \ +: set-values(1, background, "rgb:29/44/94", borderColor, "rgb:1d/30/69", displayList, "foreground rgb:20/35/73;lines 1,-1,-1,-1,-1,1;foreground rgb:30/4e/ab;lines -1,0,0,0,0,-1")\n\ +: set-values(1, background, RoyalBlue4, borderColor, RoyalBlue4, displayList, "")\n\ +Any: set-values(1, background, "rgb:23/3a/7d", displayList, "foreground rgb:30/4e/ab;lines 1,-1,-1,-1,-1,1;foreground rgb:20/35/73;lines -1,0,0,0,0,-1") PopupMenu() + +*List.displayList: +*List.background: rgb:23/3a/7d + +*Tree.displayList: + +*Label.displayList: +*Paned.?.displayList: foreground rgb:20/35/73;lines 1,-1,-1,-1,-1,1;foreground rgb:30/4e/ab;lines -1,0,0,0,0,-1 + +*Grip.foreground: rgb:30/4e/ab + +*Toggle.displayList:\ +foreground rgb:30/4e/ab;\ +lines 1,-1,-1,-1,-1,1;\ +lines -2,1,1,1,1,-2;\ +foreground rgb:20/35/73;\ +lines -1,0,0,0,0,-1;\ +lines 2,-2,-2,-2,-2,2 + +*Text.background: rgb:29/44/94 +*Text.?.background: rgb:29/44/94 +*Text.displayList: foreground rgb:30/4e/ab;lines 1,-1,-1,-1,-1,1;foreground rgb:20/35/73;lines -1,0,0,0,0,-1 + +*Scrollbar.foreground: rgb:2e/4c/a5 +*Scrollbar.background: rgb:23/3a/7d +*Scrollbar.thumb: black + +*Command.shapeStyle: rectangle +*Command.background: rgb:29/44/94 diff --git a/Editres.ad b/Editres.ad index 7f5c45f..d10c7c3 100644 --- a/Editres.ad +++ b/Editres.ad @@ -1,7 +1,13 @@ ! $Xorg: Editres.ad,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ +! +! +! +! +! $XFree86: xc/programs/editres/Editres.ad,v 1.4 2002/07/04 17:04:23 paulo Exp $ +! ! The App-defaults file for Editres. -Editres.Geometry: 500x600 +Editres.Geometry: 500x568 *ShapeStyle: Oval *Tree*ShapeStyle: Rectangle @@ -14,37 +20,37 @@ Editres.Geometry: 500x600 ! Menu Button Names -*Box*commands.Label: Commands -*Box*treeCommands.Label: Tree +*Box.commands.Label: Commands +*Box.treeCommands.Label: Tree *porthole.tree.width: 500 *porthole.tree.height: 480 ! Universal Menu Entry Names -*sendTree.Label: Get Tree -*quit.Label: Quit +*xt.sendTree.Label: Get Tree +*xt.quit.Label: Quit -*selectAll.Label: Select All -*unselectAll.Label: Unselect All -*invertAll.Label: Invert All -*selectChildren.Label: Select Children -*selectParent.Label: Select Parent -*selectDescendants.Label: Select Descendants -*selectAncestors.Label: Select Ancestors +*xt.selectAll.Label: Select All +*xt.unselectAll.Label: Unselect All +*xt.invertAll.Label: Invert All +*xt.selectChildren.Label: Select Children +*xt.selectParent.Label: Select Parent +*xt.selectDescendants.Label: Select Descendants +*xt.selectAncestors.Label: Select Ancestors ! Xt Menu Entry Names -*xt*refreshTree.Label: Refresh Current Widget Tree -*xt*dumpTreeToFile.Label: Dump Widget Tree to a File -*xt*getResourceList.Label: Show Resource Box -*xt*setValues.Label: Set Resource +*xt.refreshTree.Label: Refresh Current Widget Tree +*xt.dumpTreeToFile.Label: Dump Widget Tree to a File +*xt.getResourceList.Label: Show Resource Box +*xt.setValues.Label: Set Resource -*xt*showClientWidget.Label: Select Widget in Client -*xt*showWidgetNames.Label: Show Widget Names -*xt*showClassNames.Label: Show Class Names -*xt*showWidgetIDs.Label: Show Widget IDs -*xt*showWidgetWindows.Label: Show Widget Windows -*xt*flashActiveWidgets.Label: Flash Active Widgets +*xt.showClientWidget.Label: Select Widget in Client +*xt.showWidgetNames.Label: Show Widget Names +*xt.showClassNames.Label: Show Class Names +*xt.showWidgetIDs.Label: Show Widget IDs +*xt.showWidgetWindows.Label: Show Widget Windows +*xt.flashActiveWidgets.Label: Flash Active Widgets ! InterViews Menu Entry Names @@ -137,8 +143,8 @@ Editres.Geometry: 500x600 ! Universal Resources for the Resource Box. -*resourceLabel.font: \ --*-new century schoolbook-bold-r-*-*-20-*-*-*-*-*-*-* +*mainViewport*resourceLabel.font: \ +-*-new century schoolbook-bold-r-*-*-14-*-*-*-*-*-*-* *allowShellResize: True *resourceLabel.allowResize: True *List.verticalList: True @@ -146,19 +152,22 @@ Editres.Geometry: 500x600 *star.Label: * *dot.Label: . *namesLabel.font: \ --*-new century schoolbook-bold-r-*-*-17-*-*-*-*-*-*-* +-*-new century schoolbook-bold-r-*-*-14-*-*-*-*-*-*-* *constraintLabel.font: \ --*-new century schoolbook-bold-r-*-*-17-*-*-*-*-*-*-* +-*-new century schoolbook-bold-r-*-*-14-*-*-*-*-*-*-* *valueLabel.BorderWidth: 0 -*valueForm*preferredPaneSize: 100 +*valueForm*preferredPaneSize: 40 +*valueForm*min: 28 *valueText*editType: edit *valueText.Scroll: WhenNeeded -*valueText.width: 300 +*valueText.width: 297 +*setValuesPopup*resourceText.width: 297 *setFile.Label: Set Save File *save.Label: Save *apply.Label: Apply *saveAndApply.Label: Save and Apply *commandBox.show.Label: Show +*commandBox.min: 28 ! InterViews Resources for the Resource Box. @@ -171,8 +180,8 @@ Editres.Geometry: 500x600 ! Xt Resources for the Resource Box. -*xt*single.Label: Any Widget -*xt*any.Label: Any Widget Chain +*xt*single.Label: ? +*xt*any.Label: * *xt*namesLabel.Label: Normal Resources: mb2 gets a value *xt*constraintLabel.Label: Constraint Resources *xt*valueLabel.Label: Enter Resource Value: @@ -226,29 +235,58 @@ Editres.Geometry: 500x600 ! For the SetValues popup -*setValuesPopup*resizable: True -*setValuesPopup*left: ChainLeft -*setValuesPopup*right: ChainLeft +*setValuesPopup.form.?.resizable: True +*setValuesPopup.form.?.left: ChainLeft +*setValuesPopup.form.?.right: ChainLeft -*setValuesPopup*label*Label: Use to Change Fields. -*setValuesPopup*Label*BorderWidth: 0 +*setValuesPopup.form.label.Label: Use to Change Fields. +*setValuesPopup.form.Label.BorderWidth: 0 -*setValuesPopup*resourceLabel.Label: Resource Name: -*setValuesPopup*valueLabel.Label: Value: -*SimpleMenu*setValuesPopup*setValues.Label: Apply -*setValuesPopup*cancel.Label: Cancel +*xt*setValuesPopup.form.resourceLabel.Label: Resource Name: +*xt*setValuesPopup.form.resourceLabel.width: 114 +*xt*setValuesPopup.form.resourceLabel.justify: right +*xt*setValuesPopup.form.valueLabel.Label: Resource Value: +*xt*setValuesPopup.form.valueLabel.width: 114 +*xt*setValuesPopup.form.setValues.Label: Apply +*xt*setValuesPopup.form.cancel.Label: Cancel -*setValuesPopup*Text*EditType: Edit -*setValuesPopup*Text*resize: Width +*setValuesPopup.form.Text.?.EditType: Edit +*setValuesPopup.form.Text.resize: Width -*setValuesPopup*resourceText.baseTranslations: #override \ +*setValuesPopup.form.resourceText.baseTranslations: #override \ Return: no-op(RingBell) \n\ Ctrlq,Tab: insert-char() \n\ : select-start() SVActiveEntry(Resource) \n\ Tab: SVActiveEntry(Value) -*setValuesPopup*valueText.baseTranslations: #override \ +*setValuesPopup.form.valueText.baseTranslations: #override \ Return: no-op(RingBell) \n\ Ctrlq,Tab: insert-char() \n\ : select-start() SVActiveEntry(Value)\n\ Tab: SVActiveEntry(Resource) + +*Text.translations: #override \ + mI: no-op(r)\n\ + cS: no-op(r)\n\ + cR: no-op(r)\n\ + Escape: no-op() + +*fileDialog.?.Text.width: 280 + +! New resource settings +*normalViewport.min: 19 +*normalViewport.allowVert: True +*constraintViewport.min: 19 +*constraintViewport.allowVert: True +*mainViewport.allowHoriz: True +*mainViewport.pane.namesAndClasses.defaultDistance: 0 +*mainViewport.useBottom: True +*mainViewport.pane.Label.min: 22 +*mainViewport.pane.Label.max: 22 +*mainViewport.pane.Form.showGrip: False +*mainViewport.pane.Label.showGrip: False +*mainViewport.pane.Form.min: 66 +*mainViewport.pane.Form.max: 66 +*tree*TransientShell.translations: #override \ +: get-values(1, $w, width) \ + set-values(1, maxWidth, $w) diff --git a/actions.c b/actions.c index 80e8940..eec4207 100644 --- a/actions.c +++ b/actions.c @@ -23,23 +23,18 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/editres/actions.c,v 1.6 2001/12/14 20:00:42 dawes Exp $ */ #include +#include #include #include #include +#include #include "editresP.h" -/* - * External Functions. - */ - -extern void SetMessage(), _TreeSelect(), _TreeSelectNode(), _FindWidget(); -extern void _TreeActivateNode(), _TreeRelabel(), _TreeRelabelNode(); -extern void PrepareToLayoutTree(), LayoutTree(), _PopdownFileDialog(); - /* * Private data. */ @@ -68,8 +63,21 @@ static struct ActionValues label_values[] = { { "toggle", (int) ToggleLabel } }; -static WNode * FindTreeNodeFromWidget(); -static Boolean CheckAndFindEntry(); +static void EnableGetVal ( Widget w, XEvent *event, + String *params, Cardinal * num_params ); +static void SelectAction ( Widget w, XEvent *event, + String *params, Cardinal *num_params ); +static void RelabelAction ( Widget w, XEvent *event, + String *params, Cardinal *num_params ); +static void PopdownFileDialogAction ( Widget w, XEvent *event, + String *params, Cardinal *num_params ); +static void ActionQuit ( Widget w, XEvent *event, + String *params, Cardinal *num_params ); +static WNode * FindTreeNodeFromWidget ( Widget w ); +static Boolean CheckAndFindEntry ( String action_name, + String * params, Cardinal num_params, + struct ActionValues * table, + Cardinal num_table, int * type ); /* Function Name: EnableGetVal * Description: sets a global variable to notify the Notify action @@ -255,8 +263,6 @@ Cardinal * num_params; * Returns: none. */ -extern void ModifySVEntry(); - static XtActionsRec actions[] = { {"EnableGetVal", EnableGetVal}, {"Select", SelectAction}, diff --git a/comm.c b/comm.c index 3cd1e71..10494fb 100644 --- a/comm.c +++ b/comm.c @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/editres/comm.c,v 1.5 2001/12/14 20:00:42 dawes Exp $ */ /* @@ -42,6 +43,7 @@ from The Open Group. #include #include +#include #include "editresP.h" @@ -52,29 +54,23 @@ from The Open Group. static Atom atom_comm, atom_command, atom_resource_editor, atom_client_value; static Atom atom_editres_protocol; -/* - * external function definitions. - */ - -extern void RebuildMenusAndLabel(); -extern ResIdent GetNewIdent(); -extern void SetMessage(), BuildVisualTree(),DisplayChild(); -extern char * GetFormattedSetValuesError(), *HandleFlashWidget(); -extern char * HandleGetResources(), *PrintSetValuesError(); -char * GetFailureMessage(), * ProtocolFailure(); -extern int HandleXErrors(); -extern void SetEntriesSensitive(); - -static void TellUserAboutMessage(), BuildHeader(), FreeEvent(); -static Event * BuildEvent(); -static char * DispatchEvent(); -static void GetClientValue(); -static void ClientTimedOut(), LoseSelection(), SelectionDone(); -static Boolean ConvertCommand(); - - extern Widget CM_entries[NUM_CM_ENTRIES], TM_entries[NUM_TM_ENTRIES]; +static void ClientTimedOut ( XtPointer data, XtIntervalId * id ); +static void TellUserAboutMessage ( Widget label, ResCommand command ); +static Boolean ConvertCommand ( Widget w, Atom * selection, Atom * target, + Atom * type_ret, XtPointer *value_ret, + unsigned long * length_ret, int * format_ret ); +static void SelectionDone ( Widget w, Atom *sel, Atom *targ ); +static void LoseSelection ( Widget w, Atom * sel ); +static void GetClientValue ( Widget w, XtPointer data, Atom *selection, + Atom *type, XtPointer value, + unsigned long *length, int * format ); +static void BuildHeader ( CurrentClient * client_data ); +static Event * BuildEvent ( ProtocolStream * stream ); +static void FreeEvent ( Event * event ); +static char * DispatchEvent ( Event * event ); + /* Function Name: ClientTimedOut diff --git a/editres.c b/editres.c index 93fad17..3a2c9b9 100644 --- a/editres.c +++ b/editres.c @@ -23,8 +23,10 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/editres/editres.c,v 1.7 2001/12/14 20:00:42 dawes Exp $ */ #include +#include #include #include #include @@ -49,7 +51,7 @@ char *global_effective_toolkit = "xt"; int global_error_code; unsigned long global_serial_num; -int (*global_old_error_handler)(); +int (*global_old_error_handler)(Display *, XErrorEvent *); Boolean global_resource_box_up = FALSE; TreeInfo *global_tree_info = NULL; @@ -60,14 +62,8 @@ Widget global_paned = NULL; /* named after toolkit */ Widget global_toplevel; AppResources global_resources; -/* - * external function definitions. - */ - -extern void InternAtoms(), SetMessage(), BuildWidgetTree(); -extern void SetApplicationActions(); -static void Syntax(); +static void Syntax ( XtAppContext app_con, char *call ); String fallback_resources[] = { NULL, @@ -90,7 +86,7 @@ static XtResource editres_resources[] = { Atom wm_delete_window; -void +int main(argc, argv) int argc; char **argv; @@ -133,6 +129,7 @@ char **argv; XtWindow(global_toplevel), &wm_delete_window, 1); XtAppMainLoop(app_con); + exit(0); } /* Function Name: Syntax diff --git a/editres.man b/editres.man index 3261876..174a027 100644 --- a/editres.man +++ b/editres.man @@ -22,7 +22,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. -.TH EDITRES 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/editres/editres.man,v 1.9 2002/10/12 16:06:44 herrb Exp $ +.\" +.TH EDITRES 1 __xorgversion__ .SH NAME editres \- a dynamic resource editor for X Toolkit applications .SH SYNTAX @@ -30,7 +33,7 @@ editres \- a dynamic resource editor for X Toolkit applications .SH OPTIONS .I Editres accepts all of the standard X Toolkit command line -options (see \fIX(1)\fP). The order of the command line options is +options (see \fIX(__miscmansuffix__)\fP). The order of the command line options is not important. .SH DESCRIPTION Editres is a tool that allows users and application developers to view @@ -421,9 +424,11 @@ to get the default host and display number. to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH FILES -/lib/X11/app-defaults/Editres - specifies required resources +.TP +.I __apploaddir__/Editres +specifies required resources .SH SEE ALSO -X(1), xrdb(1), Athena Widget Set +X(__miscmansuffix__), xrdb(1), Athena Widget Set .SH RESTRICTIONS This is a prototype, there are lots of nifty features I would love to add, but I hope this will give you some ideas about what a resource editor diff --git a/editresP.h b/editresP.h index a2f3d7b..8973fff 100644 --- a/editresP.h +++ b/editresP.h @@ -26,6 +26,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Chris D. Peterson, MIT X Consortium */ +/* $XFree86: xc/programs/editres/editresP.h,v 1.7 2001/12/14 20:00:42 dawes Exp $ */ #include #include @@ -56,13 +57,13 @@ in this Software without prior written authorization from The Open Group. #define ANY_RADIO_DATA ("the any widget") #define RESOURCE_BOX ("resourceBox") -extern void exit(); /* - * Retrieving ResType and Boolean is the same as retrieving a Card8. + * Retrieving ResType and Boolean is the same as retrieving a Card8 except + * possibly for signedness. */ -#define _XEditResGetBoolean _XEditResGet8 +#define _XEditResGetBoolean(_s, _r) _XEditResGet8((_s), (unsigned char *)(_r)) #define _XEditResGetResType _XEditResGet8 /* @@ -320,7 +321,7 @@ typedef union _Event { extern char* global_effective_toolkit; extern int global_error_code; extern unsigned long global_serial_num; - extern int (*global_old_error_handler)(); + extern int (*global_old_error_handler)(Display *, XErrorEvent *); extern Boolean global_resource_box_up; extern TreeInfo *global_tree_info; @@ -350,3 +351,79 @@ typedef union _Event { #define NUM_TM_ENTRIES 16 #define TM_OFFSET 0 #define TM_NUM 16 + +/* + * Prototypes + */ +extern void ActivateResourceWidgets ( Widget w, XtPointer node_ptr, XtPointer junk ); +extern void ActivateWidgetsAndSetResourceString ( Widget w, XtPointer node_ptr, XtPointer call_data ); +extern void AddString ( char ** str, char *add ); +extern void AddTreeNode ( Widget tree, WNode * top ); +extern void AnyChosen ( Widget w, XtPointer any_info_ptr, XtPointer state_ptr ); +extern void ApplyResource ( Widget w, XtPointer node_ptr, XtPointer junk ); +extern void BuildVisualTree ( Widget tree_parent, Event * event ); +extern void BuildWidgetTree ( Widget parent ); +extern Boolean CheckDatabase ( XrmDatabase db, XrmQuarkList names, XrmQuarkList classes ); +extern void CreateResourceBox ( WNode * node, char ** errors ); +extern void CreateResourceBoxWidgets ( WNode * node, char **names, char **cons_names ); +extern TreeInfo * CreateTree ( Event * event ); +extern void DisplayChild ( Event * event ); +extern void DumpTreeToFile ( Widget w, XtPointer junk, XtPointer garbage ); +extern void ExecuteOverAllNodes ( WNode * top_node, void (*func)(WNode *, XtPointer), XtPointer data ); +extern WNode * FindNode ( WNode *top_node, unsigned long * ids, Cardinal number ); +extern void FindWidget ( Widget w, XtPointer client_data, XtPointer call_data ); +extern WNode * FindWidgetFromWindow ( TreeInfo * tree_info, Window win ); +extern void FlashActiveWidgets ( Widget w, XtPointer junk, XtPointer garbage ); +extern void GetAllStrings ( char *in, char sep, char ***out, int * num ); +extern Window GetClientWindow ( Widget w, int *x, int *y ); +extern char * GetFailureMessage ( ProtocolStream * stream ); +extern void GetNamesAndClasses ( WNode * node, char *** names, char ***classes ); +extern ResIdent GetNewIdent ( void ); +extern void GetResourceList ( Widget w, XtPointer junk, XtPointer garbage ); +extern char * GetResourceValueForSetValues ( WNode * node, unsigned short * size ); +extern char * HandleFlashWidget ( Event * event ); +extern char * HandleGetResources ( Event * event ); +extern int HandleXErrors ( Display * display, XErrorEvent * error ); +extern void InitSetValues ( Widget w, XtPointer client_data, XtPointer call_data ); +extern void InsertWidgetFromNode ( ProtocolStream * stream, WNode * node ); +extern void InternAtoms ( Display * dpy ); +extern void LayoutTree ( Widget tree ); +extern int main ( int argc, char **argv ); +extern void ModifySVEntry ( Widget w, XEvent *event, String * params, Cardinal * num_params ); +extern void PannerCallback ( Widget w, XtPointer closure, XtPointer report_ptr ); +extern void PerformTreeToFileDump ( WNode * node, int num_tabs, FILE * fp ); +extern void PopdownResBox ( Widget w, XtPointer shell_ptr, XtPointer junk ); +extern void PopupCentered ( XEvent * event, Widget w, XtGrabKind mode ); +extern void PopupSetValues ( Widget parent, XEvent * event ); +extern void PortholeCallback ( Widget w, XtPointer panner_ptr, XtPointer report_ptr ); +extern void PrepareToLayoutTree ( Widget tree ); +extern void PrintNodes ( WNode * top ); +extern char * PrintSetValuesError ( Event * event ); +extern char * ProtocolFailure ( ProtocolStream * stream ); +extern XrmQuarkList Quarkify ( char ** list, char * ptr ); +extern void Quit ( Widget w, XtPointer client_data, XtPointer call_data ); +extern void RebuildMenusAndLabel ( String toolkit ); +extern void ResourceListCallback ( Widget list, XtPointer node_ptr, XtPointer junk ); +extern void SaveResource ( Widget w, XtPointer res_box_ptr, XtPointer junk ); +extern void SendTree ( Widget w, XtPointer value, XtPointer call_data ); +extern void SetAndCenterTreeNode ( WNode * node ); +extern void SetApplicationActions ( XtAppContext app_con ); +extern void SetCommand ( Widget w, ResCommand command, char * msg ); +extern void SetEntriesSensitive ( Widget *entries, int num, Boolean sensitive ); +extern void SetFile ( Widget w, XtPointer junk, XtPointer garbage ); +extern void SetMessage ( Widget w, char * str ); +extern void SetResourceString ( Widget w, XtPointer node_ptr, XtPointer junk ); +extern void TreeRelabel ( Widget w, XtPointer client_data, XtPointer call_data ); +extern void TreeSelect ( Widget w, XtPointer client_data, XtPointer call_data ); +extern void TreeToggle ( Widget w, XtPointer node_ptr, XtPointer state_ptr ); +extern void _DumpTreeToFile ( Widget w, XtPointer tree_ptr, XtPointer filename ); +extern void _FindWidget ( Widget w ); +extern void _FlashActiveWidgets ( TreeInfo * tree_info ); +extern void _PopdownFileDialog ( Widget w, XtPointer client_data, XtPointer junk ); +extern void _PopupFileDialog ( Widget w, String str, String default_value, XtCallbackProc func, XtPointer data ); +extern void _TreeActivateNode ( WNode * node, SelectTypes type ); +extern void _TreeRelabel ( TreeInfo * tree_info, LabelTypes type ); +extern void _TreeRelabelNode ( WNode * node, LabelTypes type, Boolean recurse ); +extern void _TreeSelect ( TreeInfo * tree_info, SelectTypes type ); +extern void _TreeSelectNode ( WNode * node, SelectTypes type, Boolean recurse ); + diff --git a/geometry.c b/geometry.c index 164308c..34f6c22 100644 --- a/geometry.c +++ b/geometry.c @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Chris D. Peterson, MIT X Consortium */ +/* $XFree86: xc/programs/editres/geometry.c,v 1.5 2001/12/14 20:00:43 dawes Exp $ */ #include #include @@ -35,15 +36,20 @@ in this Software without prior written authorization from The Open Group. #include "editresP.h" -extern void SetMessage(), SetCommand(), SetAndCenterTreeNode(), AddString(); -extern void GetAllStrings(), InsertWidgetFromNode(); -extern int HandleXErrors(); -extern WNode * FindNode(); - -static WNode *FindWidgetFromWindow(), *FindWidgetFromWindowGivenNode(); -static void CreateFlashWidget(), FlashWidgets(); -static void AddToFlashList(), _AddToFlashList(); -static void FlashWidgetsOn(), FlashWidgetsOff(), FlashWidgetsCleanup(); +/* + * Local function definitions + */ +static void AddToFlashList ( TreeInfo * tree_info, GetGeomInfo * geom_info, + char ** errors ); +static void _AddToFlashList ( TreeInfo * tree_info, char ** errors, + WNode * node, int x, int y, unsigned int width, + unsigned int height ); +static void CreateFlashWidget ( TreeInfo * tree_info, int x, int y, + unsigned int width, unsigned int height ); +static void FlashWidgets ( TreeInfo * tree_info ); +static void FlashWidgetsOn ( XtPointer info_ptr, XtIntervalId * id ); +static void FlashWidgetsOff ( XtPointer info_ptr, XtIntervalId * id ); +static void FlashWidgetsCleanup ( XtPointer info_ptr, XtIntervalId * id ); /* Function Name: _FindWidget * Description: Finds a widget in the tree and shows it to the user. @@ -57,7 +63,7 @@ Widget w; { char msg[BUFSIZ]; WNode * node; - Window win, GetClientWindow(); + Window win; int x, y; /* location of event in root coordinates. */ sprintf(msg, res_labels[14]); @@ -82,49 +88,6 @@ Widget w; res_labels[15]); } -/* Function Name: FindWidgetFromWindow - * Description: finds a widget in the current tree given its window id. - * Arguments: tree_info - information about this tree. - * win - window to search for. - * Returns: node - the node corrosponding to this widget. - */ - -static WNode * -FindWidgetFromWindow(tree_info, win) -TreeInfo * tree_info; -Window win; -{ - if (tree_info == NULL) - return(NULL); - - return(FindWidgetFromWindowGivenNode(tree_info->top_node, win)); -} - -/* Function Name: FindWidgetFromWindowGivenNode - * Description: finds a widget in the current tree given its window id. - * Arguments: node - current node. - * win - window to search for. - * Returns: node - the node corrosponding to this widget. - */ - -static WNode * -FindWidgetFromWindowGivenNode(node, win) -WNode * node; -Window win; -{ - int i; - WNode * ret_node; - - if (node->window == win) - return(node); - - for (i = 0; i < node->num_children; i++) { - ret_node = FindWidgetFromWindowGivenNode(node->children[i], win); - if (ret_node != NULL) - return(ret_node); - } - return(NULL); -} /* Function Name: DisplayChild * Description: Displays the child node returned by the client @@ -139,7 +102,6 @@ Event * event; FindChildEvent * find_event = (FindChildEvent *) event; WNode * node; char msg[BUFSIZ]; - void _FlashActiveWidgets(); node = FindNode(global_tree_info->top_node, find_event->widgets.ids, find_event->widgets.num_widgets); diff --git a/handler.c b/handler.c index 2c3ebeb..4ea861c 100644 --- a/handler.c +++ b/handler.c @@ -24,6 +24,8 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/editres/handler.c,v 1.7 2001/12/14 20:00:43 dawes Exp $ */ + #include #include @@ -35,27 +37,21 @@ in this Software without prior written authorization from The Open Group. #include /* for W_OK def */ #include +#include #include "editresP.h" /* - * Function Definitions. + * Local function definitions. */ - -extern void SetCommand(), PopupSetValues(), SetAndCenterTreeNode(); -extern void _TreeSelect(), _TreeRelabel(), _TreeActivate(), SetMessage(); -extern void _FlashActiveWidgets(), _DumpTreeToFile(), _PopupFileDialog(); -extern void AddString(), CreateResourceBox(), ExecuteOverAllNodes(); -extern void GetNamesAndClasses(), TreeToggle(), InsertWidgetFromNode(); -extern Boolean CheckDatabase(); -extern XrmQuarkList Quarkify(); -extern char *GetResourceValueForSetValues(); - -void SetResourceString(), ActivateResourceWidgets(); -void ActivateWidgetsAndSetResourceString(); -static void SetOnlyMatchingWidgets(); -static void CreateSetValuesCommand(); -static void ObtainResource(); +static char * GetResourceName ( ResourceBoxInfo * res_box ); +static void _AppendResourceString ( Widget w, XtPointer res_box_ptr, + XtPointer filename_ptr ); +static void _SetResourcesFile ( Widget w, XtPointer junk, + XtPointer filename_ptr ); +static void ObtainResource ( XtPointer node_ptr ); +static void CreateSetValuesCommand ( WNode * node, XtPointer info_ptr ); +static void SetOnlyMatchingWidgets ( WNode * node, XtPointer info_ptr ); /* Function Name: Quit * Description: This function prints a message to stdout. @@ -117,7 +113,6 @@ FindWidget(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { - void _FindWidget(); _FindWidget(XtParent(w)); /* Use parent since it is a "real" widget not a rect_obj. */ @@ -812,8 +807,7 @@ XtPointer node_ptr; /*CreateGetValuesCommand(node, (XtPointer)&info); Inserts widget */ /* Insert widget */ - _XEditResPut16(stream, 1); - _XEditResPut32(stream, node->id); + InsertWidgetFromNode(stream, node); SetCommand(node->tree_info->tree_widget, LocalGetValues, NULL); } diff --git a/setvalues.c b/setvalues.c index 602d639..c80c254 100644 --- a/setvalues.c +++ b/setvalues.c @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Chris D. Peterson, MIT X Consortium */ +/* $XFree86: xc/programs/editres/setvalues.c,v 1.5 2001/12/14 20:00:43 dawes Exp $ */ #include #include @@ -38,9 +39,6 @@ in this Software without prior written authorization from The Open Group. #include #include "editresP.h" -extern WNode * FindNode(); -extern void AddString(); - #define RESOURCE_NAME ("name") #define RESOURCE_CLASS ("Class") diff --git a/svpopup.c b/svpopup.c index cd0e504..cccfee0 100644 --- a/svpopup.c +++ b/svpopup.c @@ -25,6 +25,7 @@ in this Software without prior written authorization from The Open Group. * * Author: Chris D. Peterson, MIT X Consortium */ +/* $XFree86: xc/programs/editres/svpopup.c,v 1.6 2001/12/14 20:00:43 dawes Exp $ */ #include #include /* Get standard string definations. */ @@ -32,8 +33,6 @@ in this Software without prior written authorization from The Open Group. #include #include -#include "editresP.h" - #include #include #include @@ -46,11 +45,12 @@ in this Software without prior written authorization from The Open Group. #include #endif -extern void SetMessage(), SetCommand(), InsertWidgetFromNode(); -extern void GetAllStrings(), PopupCentered(); +#include "editresP.h" -static void _SetField(), CreateSetValuesPopup(); -static void DoSetValues(), CancelSetValues(); +static void _SetField ( Widget new, Widget old ); +static void CreateSetValuesPopup ( Widget parent, ScreenData * scr_data ); +static void DoSetValues ( Widget w, XtPointer junk, XtPointer garbage ); +static void CancelSetValues ( Widget w, XtPointer junk, XtPointer garbage ); /* Function Name: PopupSetValues * Description: This function pops up the setvalues dialog @@ -163,7 +163,7 @@ Widget new, old; Pixel new_border, old_border, old_bg; if (!XtIsSensitive(new)) { -#if XKB +#ifdef XKB /* Don't set field to an inactive Widget. */ XkbStdBell(XtDisplay(old), XtWindow(new), 0, XkbBI_InvalidLocation); #else diff --git a/utils.c b/utils.c index bcb9a1b..5c61ee3 100644 --- a/utils.c +++ b/utils.c @@ -23,6 +23,7 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/editres/utils.c,v 1.6 2001/12/14 20:00:43 dawes Exp $ */ #include #include @@ -34,17 +35,20 @@ in this Software without prior written authorization from The Open Group. #include #include +#include +#include #include "editresP.h" -static WidgetResources * ParseResources(); -static int CompareResourceEntries(); -static void FreeResources(), AddResource(); -static WNode * FindWidgetFromWindowGivenNode(); +static WNode * FindWidgetFromWindowGivenNode ( WNode * node, Window win ); +static WidgetResources * ParseResources ( GetResourcesInfo * info, + char **error ); +static int CompareResourceEntries ( const void *e1, + const void *e2 ); +static void AddResource ( ResourceInfo * res_info, + WidgetResourceInfo * resource ); +static void FreeResources ( WidgetResources * resources ); -void CreateResourceBox(); - -extern void PopupCentered(), PerformTreeToFileDump(); /* Function Name: SetMessage(w, str) * Description: shows the message to the user. @@ -75,9 +79,7 @@ char * str; */ void -GetAllStrings(in, sep, out, num) -char *in, sep, ***out; -int * num; +GetAllStrings(char *in, char sep, char ***out, int *num) { int size, i; char * ptr; @@ -272,7 +274,7 @@ void _DumpTreeToFile(w, tree_ptr, filename) Widget w; XtPointer tree_ptr; -char * filename; +XtPointer filename; { TreeInfo * tree_info = (TreeInfo *) tree_ptr; FILE * fp; @@ -283,10 +285,10 @@ char * filename; return; } - if ( (fp = fopen(filename, "w")) == NULL ) { + if ( (fp = fopen((char *)filename, "w")) == NULL ) { char buf[BUFSIZ]; - sprintf(buf, res_labels[24], filename); + sprintf(buf, res_labels[24], (char *)filename); SetMessage(global_screen_data.info_label, buf); return; } @@ -318,7 +320,7 @@ char * filename; static XContext file_dialog_context = None; typedef struct _FileDialogInfo { - void (*func)(); + XtCallbackProc func; XtPointer data; } FileDialogInfo; @@ -326,14 +328,13 @@ void _PopupFileDialog(w, str, default_value, func, data) Widget w; String str, default_value; -void (*func)(); +XtCallbackProc func; XtPointer data; { FileDialogInfo * file_info; Widget shell, dialog; Arg args[2]; Cardinal num_args; - void _PopdownFileDialog(); if (file_dialog_context == None) file_dialog_context = XUniqueContext(); @@ -578,7 +579,6 @@ CreateResourceBox(node, errors) WNode * node; char ** errors; { - void CreateResourceBoxWidgets(); WidgetResources * resources = node->resources; char ** names, ** cons_names; int i; @@ -695,9 +695,10 @@ char **error; static int CompareResourceEntries(e1, e2) -WidgetResourceInfo *e1, *e2; +const void *e1, *e2; { - return (strcmp(e1->name, e2->name)); + return (strcmp(((WidgetResourceInfo *)e1)->name, + ((WidgetResourceInfo *)e2)->name)); } /* Function Name: AddResource @@ -818,7 +819,7 @@ char * ptr; void ExecuteOverAllNodes(top_node, func, data) WNode * top_node; -void (*func)(); +void (*func)(WNode *, XtPointer); XtPointer data; { int i; diff --git a/widgets.c b/widgets.c index 2342e6a..a34c87f 100644 --- a/widgets.c +++ b/widgets.c @@ -23,6 +23,7 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/editres/widgets.c,v 1.6 2001/12/14 20:00:43 dawes Exp $ */ /* * Code for creating all widgets used by EditRes. @@ -56,21 +57,20 @@ in this Software without prior written authorization from The Open Group. * functions. */ -static void CreateResourceNameForm(), SetToggleGroupLeaders(), CreateLists(); -static void CreateCommandMenu(), CreateTreeCommandMenu(), FreeClientData(); -static void FreeResBox(), CreateValueWidget(), PopupOnNode(); -static Widget CreateTopArea(); -static void MakeBoxLookNice(); - -extern void GetResourceList(), AnyChosen(), SetResourceString(); -extern void PannerCallback(), PortholeCallback(), DumpTreeToFile(); -extern void Quit(), SendTree(), FlashActiveWidgets(); -extern void TreeSelect(), TreeRelabel(), TreeActivate(), FindWidget(); -extern void ResourceListCallback(), PopdownResBox(), SaveResource(); -extern void GetNamesAndClasses(), ApplyResource(), ActivateResourceWidgets(); -extern void ActivateWidgetsAndSetResourceString(), SetFile(); - -extern void InitSetValues(); +static Widget CreateTopArea ( Widget parent ); +static void CreateCommandMenu ( Widget parent, String toolkit ); +static void CreateTreeCommandMenu ( Widget parent, String toolkit ); +static void CreateResourceNameForm ( Widget parent, WNode * node ); +static void SetToggleGroupLeaders ( WNode * node ); +static void MakeBoxLookNice ( Widget dot, Widget star, Widget any, + Widget single, Widget name, Widget class, + int endbox ); +static void CreateLists ( Widget parent, WNode * node, char **names, + char **cons_names ); +static void CreateValueWidget ( Widget parent, WNode * node ); +static void PopupOnNode ( WNode * node, Widget shell ); +static void FreeClientData ( Widget w, XtPointer ptr, XtPointer junk ); +static void FreeResBox ( Widget w, XtPointer ptr, XtPointer junk ); @@ -240,10 +240,7 @@ Widget parent; * Returns: none. */ void -SetEntriesSensitive(entries, num, sensitive) -Widget *entries; -int num; -Boolean sensitive; +SetEntriesSensitive(Widget *entries, int num, Boolean sensitive) { int i; for (i=0; iwidget)) - 20; + Dimension max_height = HeightOfScreen(XtScreen(node->widget)) - 40; res_box = (ResourceBoxInfo *) XtMalloc(sizeof(ResourceBoxInfo)); node->resources->res_box = res_box; - res_box->shell = XtCreatePopupShell(global_effective_toolkit, - /*RESOURCE_BOX,*/ - transientShellWidgetClass, - node->widget, NULL, ZERO); + res_box->shell = XtVaCreatePopupShell(global_effective_toolkit, + /*RESOURCE_BOX,*/ + transientShellWidgetClass, + node->widget, + XtNmaxWidth, max_width, + XtNmaxHeight, max_height, NULL, ZERO); XtAddCallback(res_box->shell, XtNdestroyCallback, FreeResBox, (XtPointer) node); pane = XtCreateManagedWidget("pane", panedWidgetClass, res_box->shell, NULL, ZERO); + viewport = XtCreateManagedWidget("mainViewport", viewportWidgetClass, + pane, NULL, 0); + pane_child = XtCreateManagedWidget("pane", panedWidgetClass, + viewport, NULL, ZERO); + res_box->res_label = XtCreateManagedWidget("resourceLabel", labelWidgetClass, - pane, NULL, ZERO); + pane_child, NULL, ZERO); - CreateResourceNameForm(pane, node); - CreateLists(pane, node, names, cons_names); + CreateResourceNameForm(pane_child, node); + CreateLists(pane_child, node, names, cons_names); CreateValueWidget(pane, node); XtSetKeyboardFocus(pane, res_box->value_wid); /* send keyboard to value. */ @@ -552,7 +558,7 @@ Widget parent; WNode * node; { ResourceBoxInfo * res_box = node->resources->res_box; - AnyInfo *new_info, *old_info; + AnyInfo *new_info = NULL, *old_info; char **names, **classes; Widget form; NameInfo * name_info = NULL; @@ -794,12 +800,15 @@ int endbox; if (any_width > name_class_width) name_class_width = any_width; any_width = dot_star_width + h_dist[0] + name_class_width; - if (endbox < 0) - any_width += dot_star_width / 2; - else if (endbox > 0) - any_width += (dot_star_width - dot_star_width / 2); num_args = 0; + if (endbox < 0) { + any_width -= dot_star_width & 1; + XtSetArg(args[num_args], XtNhorizDistance, + h_dist[2] + (dot_star_width >> 1) + (dot_star_width & 1)); + ++num_args; + } + XtSetArg(args[num_args], XtNwidth, any_width); num_args++; XtSetValues(any, args, num_args); @@ -830,6 +839,7 @@ Widget parent; WNode * node; char **names, **cons_names; { + Widget viewport; Cardinal num_args; ResourceBoxInfo * res_box = node->resources->res_box; Arg args[3]; @@ -847,8 +857,10 @@ char **names, **cons_names; XtSetArg(args[num_args], XtNsensitive, False); num_args++; } else { XtSetArg(args[num_args], XtNlist, names); num_args++; } + viewport = XtCreateManagedWidget("normalViewport", viewportWidgetClass, + parent, NULL, 0); res_box->norm_list = XtCreateManagedWidget("namesList", listWidgetClass, - parent, args, num_args); + viewport, args, num_args); XtAddCallback(res_box->norm_list, XtNcallback, ResourceListCallback, (XtPointer) node); XtAddCallback(res_box->norm_list, XtNdestroyCallback, @@ -860,9 +872,11 @@ char **names, **cons_names; num_args = 0; XtSetArg(args[num_args], XtNlist, cons_names); num_args++; + viewport = XtCreateManagedWidget("constraintViewport", viewportWidgetClass, + parent, NULL, 0); res_box->cons_list = XtCreateManagedWidget("constraintList", listWidgetClass, - parent, args, num_args); + viewport, args, num_args); XtAddCallback(res_box->cons_list, XtNcallback, ResourceListCallback, (XtPointer) node); XtAddCallback(res_box->cons_list, XtNdestroyCallback, @@ -933,7 +947,7 @@ Widget shell; { Arg args[3]; Cardinal num_args; - Position x, y; + Position x, y, max_loc; Dimension width, height, bw; num_args = 0; @@ -957,23 +971,17 @@ Widget shell; x -= (Position) (width/2 + bw); y -= (Position) (height/2 + bw); + max_loc = WidthOfScreen(XtScreen(shell)) - (Position) (width + 2 * bw); + if (x > max_loc) + x = max_loc; if (x < 0) x = 0; - else { - Position max_loc = WidthOfScreen(XtScreen(shell)) - - (Position) (width + 2 * bw); - if (x > max_loc) - x = max_loc; - } + max_loc = HeightOfScreen(XtScreen(shell)) - (Position) (height + 2 * bw); + if (y > max_loc) + y = max_loc; if (y < 0) y = 0; - else { - Position max_loc = HeightOfScreen(XtScreen(shell)) - - (Position) (height + 2 * bw); - if (y > max_loc) - y = max_loc; - } num_args = 0; XtSetArg(args[num_args], XtNx, x); num_args++; diff --git a/wtree.c b/wtree.c index 07a6920..254f5d0 100644 --- a/wtree.c +++ b/wtree.c @@ -23,6 +23,7 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/editres/wtree.c,v 1.5 2001/12/14 20:00:44 dawes Exp $ */ #include #include @@ -36,20 +37,15 @@ in this Software without prior written authorization from The Open Group. #include "editresP.h" -extern ScreenData global_screen_data; -extern void SetMessage(); - -static Boolean IsActiveNode(); -static void AddChild(), FillNode(); -static void AddNode(); -static void AddNodeToActiveList(), RemoveNodeFromActiveList(); - -extern void PrepareToLayoutTree(), LayoutTree(); - -extern void _TreeSelectNode(), _TreeActivateNode(), _TreeRelabelNode(); -static WNode ** CopyActiveNodes(); - -void TreeToggle(); +static void AddNodeToActiveList ( WNode * node ); +static void RemoveNodeFromActiveList ( WNode * node ); +static Boolean IsActiveNode ( WNode * node ); +static void AddNode ( WNode ** top_node, WidgetTreeInfo * info, + TreeInfo * tree_info ); +static void FillNode ( WidgetTreeInfo * info, WNode * node, + TreeInfo * tree_info ); +static void AddChild ( WNode * parent, WNode * child ); +static WNode ** CopyActiveNodes ( TreeInfo * tree_info ); /* Function Name: BuildVisualTree * Description: Creates the Tree and shows it. @@ -65,8 +61,6 @@ Widget tree_parent; Event * event; { WNode * top; - TreeInfo *CreateTree(); - void AddTreeNode(); char msg[BUFSIZ]; if (global_tree_info != NULL) { @@ -326,9 +320,7 @@ LabelTypes type; */ void -_TreeSelect(tree_info, type) -TreeInfo * tree_info; -SelectTypes type; +_TreeSelect(TreeInfo *tree_info, SelectTypes type) { WNode ** active_nodes; Cardinal num_active_nodes; @@ -374,10 +366,7 @@ SelectTypes type; */ void -_TreeSelectNode(node, type, recurse) -WNode * node; -SelectTypes type; -Boolean recurse; +_TreeSelectNode(WNode *node, SelectTypes type, Boolean recurse) { int i; Arg args[1]; @@ -422,10 +411,7 @@ Boolean recurse; */ void -_TreeRelabelNode(node, type, recurse) -WNode * node; -LabelTypes type; -Boolean recurse; +_TreeRelabelNode(WNode *node, LabelTypes type, Boolean recurse) { int i; Arg args[1]; @@ -523,7 +509,6 @@ SelectTypes type; * ************************************************************/ -WNode * FindNode(); /* Function Name: AddNode * Description: adds a node to the widget tree. -- cgit v1.2.3