Commit efce7cb0 authored by Kaleb Keithley Keithley's avatar Kaleb Keithley Keithley
Browse files

R6.6 is the Xorg base-line

parents
! $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.
#include "Editres"
*flashColor: Yellow
*Background: RoyalBlue4
*Foreground: Azure
*BorderColor: LightCyan1
*Tree.Background: Grey
*Tree.Foreground: White
*Tree.Toggle.Foreground: Gold
*Tree.Toggle.BorderWidth: 0
*MenuButton.Foreground: Gold
*MenuButton.BorderWidth: 0
*SmeBSB.Foreground: Gold
*Porthole.Background: Grey
*porthole.panner*Foreground: red
*porthole.panner*Background: Grey
*porthole.panner*BorderColor: Grey
*porthole.panner*ShadowColor: Black
*porthole.panner*BackgroundStipple: None
*resourceBox*namesAndClasses.Background: Grey
*resourceBox*namesAndClasses*Toggle.Background: RoyalBlue4
*resourceBox*namesAndClasses*Toggle.Foreground: White
*resourceBox*valueForm.Background: Grey
*resourceBox*valueLabel.Background: Grey
*resourceBox*valueLabel.Foreground: White
*resourceBox*Command.Foreground: Gold
! $Xorg: Editres.ad,v 1.3 2000/08/17 19:53:51 cpqbld Exp $
! The App-defaults file for Editres.
Editres.Geometry: 500x600
*ShapeStyle: Oval
*Tree*ShapeStyle: Rectangle
! The rest of this file are either button names, or important for
! functionality, modifying these values may cause strange program
! behavior.
*flash.BorderWidth: 0
! Menu Button Names
*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
*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 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*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
*iv*refreshTree.Label: Refresh Current Style Tree
*iv*dumpTreeToFile.Label: Dump Style Tree to a File
*iv*getResourceList.Label: Show Attribute Box
*iv*setValues.Label: Set Attribute
*iv*showClientWidget.Label: Select Style in Client
*iv*showWidgetNames.Label: Show Style Names
*iv*showClassNames.Label: Show Class Names
*iv*showWidgetIDs.Label: Show Style IDs
*iv*showWidgetWindows.Label: Show Style Windows
*iv*flashActiveWidgets.Label: Flash Active Styles
! Universal Toolkit Messages
*label0: Action `%s' must have the Editres Protocol.
*label1: Action %s's argument must be either `cancel' or `okay'.
*label2: Action `%s' must have exactly one argument.
*label3: Unknown parameter to action `%s' must be one of:\n
*label4: It appears that this client does not understand\nthe Editres Protocol.
*label5: Can't grab the mouse.\n
*label6: Click the mouse pointer on any toolkit client.
*label8: Message sent to client%s.
*label9: Incorrectly formatted message from client.
*label10: Unable to own the Resource Editor Command Selection
*label11: Unknown Error code %d
*label13: Welcome to the X Resource Editor version 1.1
*label15: That window does not appear to be\nin the currently displayed client.
*label16: Editres Internal Error: Unable to FindNode.\n
*label18: There are no active nodes.
*label20: ApplyResource: found no matches.
*label21: Error: SVActiveEntry Action must have exactly one argument.
*label22: Error: SVActiveEntry Action's first Argument must be either 'Resource' or 'Value'.
*label24: Unable to open the file `%s' for writing.
*label25: Error while trying to save Context\nAborting file dialog popup.
*label26: Error while trying to find Context\nAborting...
*label28: Loop in tree: node %s's parent (%s) has not been created yet\n
*label30: There are no active nodes.
*label31: Internal Error: Unknown select type.
*label32: Internal Error: Unknown label type.
*label33: Internal Error: Unknown activate type.
*label34: Only one Resource Box can be active at a time.
*label35: Unable to unpack protocol request.
*label36: This version of editres uses protocol version %s,\nbut the client speaks version %s.
! Xt Messages
*xt*label7: Unable to own the Resource Selection
*xt*label12: Widget Tree for client %s(%s).
*xt*label14: Click on any widget in the client.\nEditres will select that widget in the tree display.
*xt*label17: No widget Tree is avaliable.
*xt*label19: This function requires exactly one (1) widget to be selected.
*xt*label23: There are no currently active widgets.
*xt*label27: There is no widget tree to display.
*xt*label29: XSaveContext failed on widget %s.
! InterViews Messages
*iv*label7: Unable to own the Attribute Selection
*iv*label12: Style Tree for client %s(%s).
*iv*label14: Click on any style in the client.\nEditres will select that style in the tree display.
*iv*label17: No style Tree is avaliable.
*iv*label19: This function requires exactly one (1) style to be selected.
*iv*label23: There are no currently active styles.
*iv*label27: There is no style tree to display.
*iv*label29: XSaveContext failed on style %s.
*MenuButton.leftBitmap: menu10
! For the Top Area
*hPane.orientation: horizontal
*hPane.preferredPaneSize: 100
*hPane.Panner.width: 100
*hPane.Panner.height: 100
*hPane.Panner.preferredPaneSize: 100
*Paned.Panner.showGrip: False
*Paned.box.showGrip: False
*Paned.hPane.showGrip: True
! For the Filename popup dialog.
*fileDialog*value:
*fileDialog*allowShellResize: True
*fileDialog*Text.baseTranslations: #override \n\
<Key>Return: PopdownFileDialog(okay)
! Universal Resources for the Resource Box.
*resourceLabel.font: \
-*-new century schoolbook-bold-r-*-*-20-*-*-*-*-*-*-*
*allowShellResize: True
*resourceLabel.allowResize: True
*List.verticalList: True
*namesAndClasses*BorderWidth: 0
*star.Label: *
*dot.Label: .
*namesLabel.font: \
-*-new century schoolbook-bold-r-*-*-17-*-*-*-*-*-*-*
*constraintLabel.font: \
-*-new century schoolbook-bold-r-*-*-17-*-*-*-*-*-*-*
*valueLabel.BorderWidth: 0
*valueForm*preferredPaneSize: 100
*valueText*editType: edit
*valueText.Scroll: WhenNeeded
*valueText.width: 300
*setFile.Label: Set Save File
*save.Label: Save
*apply.Label: Apply
*saveAndApply.Label: Save and Apply
*commandBox.show.Label: Show
! InterViews Resources for the Resource Box.
*iv*single.Label: Any Style
*iv*any.Label: Any Style Chain
*iv*namesLabel.Label: Normal Attributes: mb2 gets a value
*iv*constraintLabel.Label: Constraint Attributes
*iv*valueLabel.Label: Enter Attribute Value:
*iv*commandBox.cancel.Label: Popdown Attribute Box
! Xt Resources for the Resource Box.
*xt*single.Label: Any Widget
*xt*any.Label: Any Widget Chain
*xt*namesLabel.Label: Normal Resources: mb2 gets a value
*xt*constraintLabel.Label: Constraint Resources
*xt*valueLabel.Label: Enter Resource Value:
*xt*commandBox.cancel.Label: Popdown Resource Box
! This gives us an exactly one of many toggle, if toggle is
! not set in each group the application will probabally core dump.
*namesAndClasses*Toggle.baseTranslations: #override \n\
<Btn1Down>,<Btn1Up>: set() notify()
*commandBox.skipAdjust: True
! Get resource values action binding.
*List.baseTranslations: #override \n\
<Btn2Down>,<Btn2Up>: Set() EnableGetVal() Notify()
! Keyboard Actions for Tree and children of the Tree.
*Tree.baseTranslations: #override \n\
:<Key>space: Select(nothing) \n\
:<Key>w: Select(widget) \n\
:<Key>s: Select(all) \n\
:<Key>i: Select(invert) \n\
:<Key>c: Select(children) \n\
:<Key>d: Select(descendants) \n\
:<Key>p: Select(parent) \n\
:<Key>a: Select(ancestors) \n\
:<Key>N: Relabel(name) \n\
:<Key>C: Relabel(class) \n\
:<Key>I: Relabel(id) \n\
:<Key>W: Relabel(window)
*Tree.Toggle.baseTranslations: #override \n\
:<Key>space: Select(nothing) \n\
:<Key>w: Select(widget) \n\
:<Key>s: Select(all) \n\
:<Key>i: Select(invert) \n\
:<Key>c: Select(children) \n\
:<Key>d: Select(descendants) \n\
:<Key>p: Select(parent) \n\
:<Key>a: Select(ancestors) \n\
:<Key>N: Relabel(name) \n\
:<Key>C: Relabel(class) \n\
:<Key>I: Relabel(id) \n\
:<Key>W: Relabel(window) \n\
<Btn2Down>,<Btn2Up>: Select(nothing) toggle() notify() \n\
<Btn3Down>,<Btn3Up>: Relabel(toggle)
! For the SetValues popup
*setValuesPopup*resizable: True
*setValuesPopup*left: ChainLeft
*setValuesPopup*right: ChainLeft
*setValuesPopup*label*Label: Use <Tab> to Change Fields.
*setValuesPopup*Label*BorderWidth: 0
*setValuesPopup*resourceLabel.Label: Resource Name:
*setValuesPopup*valueLabel.Label: Value:
*SimpleMenu*setValuesPopup*setValues.Label: Apply
*setValuesPopup*cancel.Label: Cancel
*setValuesPopup*Text*EditType: Edit
*setValuesPopup*Text*resize: Width
*setValuesPopup*resourceText.baseTranslations: #override \
<Key>Return: no-op(RingBell) \n\
Ctrl<Key>q,<Key>Tab: insert-char() \n\
<Btn1Down>: select-start() SVActiveEntry(Resource) \n\
<Key>Tab: SVActiveEntry(Value)
*setValuesPopup*valueText.baseTranslations: #override \
<Key>Return: no-op(RingBell) \n\
Ctrl<Key>q,<Key>Tab: insert-char() \n\
<Btn1Down>: select-start() SVActiveEntry(Value)\n\
<Key>Tab: SVActiveEntry(Resource)
/*
* $Xorg: actions.c,v 1.4 2001/02/09 02:05:29 xorgcvs Exp $
*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.
*/
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Xutil.h>
#include <X11/Xaw/Cardinals.h>
#include "editresP.h"
/*
* External Functions.
*/
extern void SetMessage(), _TreeSelect(), _TreeSelectNode(), _FindWidget();
extern void _TreeActivateNode(), _TreeRelabel(), _TreeRelabelNode();
extern void PrepareToLayoutTree(), LayoutTree(), _PopdownFileDialog();
/*
* Private data.
*/
struct ActionValues {
String name;
int type;
};
static struct ActionValues select_values[] = {
{ "widget", (int) SelectWidget },
{ "all", (int) SelectAll },
{ "nothing", (int) SelectNone },
{ "invert", (int) SelectInvert },
{ "children", (int) SelectChildren },
{ "descendants", (int) SelectDescendants },
{ "parent", (int) SelectParent },
{ "ancestors", (int) SelectAncestors }
};
static struct ActionValues label_values[] = {
{ "name", (int) NameLabel },
{ "class", (int) ClassLabel },
{ "id", (int) IDLabel },
{ "window", (int) WindowLabel },
{ "toggle", (int) ToggleLabel }
};
static WNode * FindTreeNodeFromWidget();
static Boolean CheckAndFindEntry();
/* Function Name: EnableGetVal
* Description: sets a global variable to notify the Notify action
* for the resource list widet to do GetValues.
* Arguments: w - any widget in the widget tree.
* event - NOT USED.
* params, num_params - the parameters paseed to the action
* routine.
*
*/
Boolean do_get_values = False;
/* ARGSUSED */
static void
EnableGetVal(w, event, params, num_params)
Widget w;
XEvent * event;
String * params;
Cardinal * num_params;
{
do_get_values = True;
}
/* Function Name: SelectAction
* Description:
* Arguments: w - any widget in the widget tree.
* event - NOT USED.
* params, num_params - the parameters paseed to the action
* routine.
*
* params[0] - One of "nothing", "parent", "children", "ancestors",
* "descendants", "invert", "all"
* num_params - must be one.
*/
/* ARGSUSED */
static void
SelectAction(w, event, params, num_params)
Widget w;
XEvent * event;
String * params;
Cardinal * num_params;
{
WNode * node;
int type;
if (!CheckAndFindEntry("Select", params, *num_params,
select_values, XtNumber(select_values), &type))
return;
switch(type) {
case SelectAll:
case SelectNone:
case SelectInvert:
_TreeSelect(global_tree_info, type);
break;
case SelectWidget:
_FindWidget(XtParent(w));
break;
default:
node = FindTreeNodeFromWidget(w);
if (node)
_TreeActivateNode(node, type);
else
_TreeSelect(global_tree_info, type);
break;
}
}
/* Function Name: RelabelAction
* Description:
* Arguments: w - any widget in the widget tree.
* event - NOT USED.
* params, num_params - the parameters paseed to the action
* routine.
*
* params[0] - One of "name", "class", "id"
* num_params - must be one.
*/
/* ARGSUSED */
static void
RelabelAction(w, event, params, num_params)
Widget w;
XEvent * event;
String * params;
Cardinal * num_params;
{
WNode * node;
int type;
if (!CheckAndFindEntry("Relabel", params, *num_params,
label_values, XtNumber(label_values), &type))
return;
if ((node = FindTreeNodeFromWidget(w)) == NULL)
_TreeRelabel(global_tree_info, type);
else {
PrepareToLayoutTree(global_tree_info->tree_widget);
_TreeRelabelNode(node, type, FALSE);
LayoutTree(global_tree_info->tree_widget);
}
}
/* Function Name: PopdownFileDialogAction
* Description: Pops down the file dialog widget.
* and calls the approipriate handler.
* Arguments: w - any child of the dialog widget.
* event - the event that caused this action.
* params, num_params - params passed to the action routine.
* RETURNED none.
*/
/* ARGSUSED */
static void
PopdownFileDialogAction(w, event, params, num_params)
Widget w;
XEvent * event;
String * params;
Cardinal * num_params;
{
char buf[BUFSIZ];
Boolean val;
if (*num_params != 1) {
sprintf(buf, res_labels[2],
"PopdownFileDialog");
SetMessage(global_screen_data.info_label, buf);
return;
}
XmuCopyISOLatin1Lowered(buf, params[0]);
if (streq(buf, "cancel"))
val = FALSE;
else if (streq(buf, "okay"))
val = TRUE;
else {
sprintf(buf, res_labels[1],
"PopdownFileDialog");
SetMessage(global_screen_data.info_label, buf);
return;
}
_PopdownFileDialog(w, (XtPointer)(long) val, NULL);
}
/* Function Name: ActionQuit
* Description: This function prints a message to stdout.
* Arguments: w - ** UNUSED **
* call_data - ** UNUSED **
* client_data - ** UNUSED **
* Returns: none
*/
/* ARGSUSED */
static void
ActionQuit(w, event, params, num_params)
Widget w;
XEvent * event;
String * params;
Cardinal * num_params;
{
if (w==global_toplevel) {
XtDestroyApplicationContext(XtWidgetToApplicationContext(w));
exit(0);
}
else {
if (streq(XtName(w), RESOURCE_BOX))
global_resource_box_up = FALSE;
XtPopdown(w);
XtDestroyWidget(w);
}
}
/* Function Name: SetApplicationActions
* Description: Sets my application actions.
* Arguments: app_con - the application context.
* Returns: none.
*/
extern void ModifySVEntry();
static XtActionsRec actions[] = {
{"EnableGetVal", EnableGetVal},
{"Select", SelectAction},
{"SVActiveEntry", ModifySVEntry},
{"Relabel", RelabelAction},
{"PopdownFileDialog", PopdownFileDialogAction},
{"quit", ActionQuit}
};
void
SetApplicationActions(app_con)
XtAppContext app_con;
{
XtAppAddActions(app_con, actions, XtNumber(actions));
}
/************************************************************
*
* Private functions
*
************************************************************/
/* Function Name: CheckAndFindEntry
* Description: Checks the args to make sure they are valid,
* then parses the arg list to find the correct action
* to take.
* Arguments: action_name - name of the action (for error messages).
* params, num_params - params passed to the action routine.
* table, num_table - table to check the parameters against.
* RETURNED type - info about the action to take.
* Returns: TRUE if the arguments are okay.
*/
static Boolean
CheckAndFindEntry(action_name, params, num_params, table, num_table, type)
String * params, action_name;
Cardinal num_params, num_table;
struct ActionValues * table;
int * type;
{
char buf[BUFSIZ];
int i;
if (num_params != 1) {
sprintf(buf, res_labels[2],
action_name);
SetMessage(global_screen_data.info_label, buf);
return(FALSE);
}
XmuCopyISOLatin1Lowered(buf, params[0]);
for ( i = 0 ; i < num_table; i++ )
if (streq(buf, table[i].name)) {
*type = table[i].type;
return(TRUE);
}
sprintf(buf,res_labels[3],
action_name);
for (i = 0; i < num_table; ) {
strcat(buf, table[i++].name);
if (i == (num_table - 1))
strcat(buf, ", or ");
else if (i < num_table)
strcat(buf, ", ");
}
SetMessage(global_screen_data.info_label, buf);
return(FALSE);
}
/* Function Name: FindTreeNodeFromWidget
* Description: finds the tree node associated with a widget.
* Arguments: w - widget to check.
* Returns: the node associated with this widget, or NULL.
*/
static WNode *
FindTreeNodeFromWidget(w)
Widget w;
{
int ret_val;
XPointer data_return;
/*
* Yes, I really am casting a widget to a window ** TRUST ME ***
*/
ret_val = XFindContext(XtDisplay(w), (Window) w, NODE_INFO, &data_return);
if (ret_val == 0)
return((WNode *) data_return);
return(NULL);
}
This diff is collapsed.