/* Function Name: SendTree
* Description: This function initiates the client communication.
* by getting the resource tree.
* Arguments: w - the widget that made the selection.
* value - a boolean value stored as a pointer.
* if True then get a new client, otherwise
* refresh the current client.
* call_data - ** UNUSED **
* Returns: none
*/
if (!XtIsWidget(w)) /* Make sure that we use a "Real" widget here. */
w = XtParent(w);
_XEditResResetStream(&(global_client.stream)); /* an empty message. */
SetCommand(w, LocalSendWidgetTree, NULL);
}
/* Function Name: FindWidget
* Description: Maps a widget in the client to one in the currently
* displayed widget tree.
* Arguments: w - the widget that invoked this action.
* call_data, client_data ** UNUSED **
* Returns: none
*/
_FindWidget(XtParent(w)); /* Use parent since it is a "real"
widget not a rect_obj. */
}
/* Function Name: InitSetValues
* Description: This function pops up the setvalues dialog
* Arguments: w - the widget caused this action.
* call_data - ** UNUSED **
* client_data - ** UNUSED **
* Returns: none
*/
/* ARGSUSED */
void
InitSetValues(w, client_data, call_data)
Widget w;
XtPointer call_data, client_data;
{
if (!XtIsWidget(w)) /* Make sure that we use a "Real" widget here. */
w = XtParent(w);
PopupSetValues(w, NULL);
}
/* Function Name: TreeSelect
* Description: Selects all widgets.
* Arguments: w - the widget caused this action.
* call_data - ** UNUSED **
* client_data - The type of thing to select.
* Returns: none
*/
/* Function Name: TreeRelabel
* Description: Relabels a tree to the type specified.
* Arguments: w - the widget caused this action.
* call_data - ** UNUSED **
* client_data - the type of label to assign to each node.
* Returns: none
*/
/* Function Name: PannerCallback
* Description: called when the panner has moved.
* Arguments: panner - the panner widget.
* closure - *** NOT USED ***.
* report_ptr - the panner record.
* Returns: none.
*/
/* Function Name: PortholeCallback
* Description: called when the porthole or its child has
* changed
* Arguments: porthole - the porthole widget.
* panner_ptr - the panner widget.
* report_ptr - the porthole record.
* Returns: none.
*/
/* Function Name: FlashActiveWidgets
* Description: called to flass all active widgets in the display.
* Arguments: *** NOT USED ***
* Returns: none.
*/
/* Function Name: DumpTreeToFile
* Description: Dumps all widgets in the tree to a file.
* Arguments: w - the widget that activated this callback.
* junk, garbage - ** NOT USED **.
* Returns: none.
*/
/************************************************************
*
* Callbacks for the Resource Box.
*
************************************************************/
/* Function Name: AnyChosen
* Description: Callback that is called when the "any" widget
* is activated.
* Arguments: w - the "any" widget that activated this callback.
* any_info_ptr - pointer to struct containing
* dot and star widgets to lock.
* state_ptr - state of the any toggle.
* Returns: none.
*/
/* Function Name: GetResourceName
* Description: Gets the name of the current resource.
* Arguments: res_box - the resource box.
* Returns: the name of the currently selected resource.
*/
if (list_info->list_index == XAW_LIST_NONE)
result = "unknown";
else
result = list_info->string;
return(result);
}
/* Function Name: ActivateWidgetsAndSetResourceString
* Description: Sets the new resources string, then
* activates all widgets that match this resource,
* Arguments: w - the widget that activated this.
* node_ptr - the node that owns this resource box.
* call_data - passed on to other callbacks.
* Returns: none.
*
* NOTE: I cannot just have two callback routines, since I care which
* order that these are executed in, sigh...
*/
/* Function Name: SetResourceString
* Description: Sets the resource label to correspond to the currently
* chosen string.
* Arguments: w - The widget that invoked this callback, or NULL.
* node_ptr - pointer to widget node contating this res box.
* call_data - The call data for the action that invoked
* this callback.
* Returns: none.
*/
void
SetResourceString(w, node_ptr, junk)
Widget w;
XtPointer node_ptr, junk;
{
static char * malloc_string; /* These are both inited to zero. */
static Cardinal malloc_size;
if ((w != NULL) && XtIsSubclass(w, toggleWidgetClass)) {
/*
* Only set resources when toggles are activated, not when they are
* deactivated.
*/
if (!((Boolean) junk))
return;
}
buf[0] = '\0'; /* clear out string. */
/*
* Get the widget name/class info.
*/
if ((temp = (char *) XawToggleGetCurrent(name_node->sep_leader)) != NULL)
strcat(buf, temp);
/* Function Name: ResourceListCallback
* Description: Callback functions for the resource lists. This
* routine is essentialy called by the list widgets
* Notify action. If action EnableGetVal has been
* invoked, ResourceListCallback will perform a
* GetValues protocol request.
* Arguments: list - the list widget that we are dealing with.
* node_ptr - pointer to widget node contating this res box.
* junk - UNUSED.
* Returns: none
*/
/* get the resource value from the application */
if (global_effective_protocol_version >=
PROTOCOL_VERSION_ONE_POINT_ONE && do_get_values) {
ObtainResource(node_ptr);
do_get_values = False;
}
}
/* Function Name: PopdownResBox
* Description: Pops down the resource box.
* Arguments: w - UNUSED
* shell_ptr - pointer to the shell to pop down.
* junk - UNUSED.
* Returns: none
*/
if ((fp = fopen(global_resources.save_resources_file, "a+")) == NULL) {
sprintf(buf, "Unable to open this file for writing, would %s",
"you like To try again?");
_PopupFileDialog(global_toplevel ,buf,
global_resources.save_resources_file,
_AppendResourceString, res_box_ptr);
return;
}
/* Function Name: SaveResource
* Description: Save the current resource to your resource file
* Arguments: w - any widget in the application.
* res_box_ptr - the resource box info.
* junk - UNUSED.
* Returns: none
*/
/* ARGSUSED */
void
SaveResource(w, res_box_ptr, junk)
Widget w;
XtPointer res_box_ptr, junk;
{
/*
* If there is no filename the ask for one, otherwise just save to
* current file.
*/
if (streq(global_resources.save_resources_file, ""))
_PopupFileDialog(XtParent(w), "Enter file to dump resources into:",
global_resources.save_resources_file,
_AppendResourceString, res_box_ptr);
else
_AppendResourceString(w, res_box_ptr, NULL);
}
/* Function Name: _SetResourcesFile
* Description: Sets the filename of the file to save the resources to.
* Arguments: w - UNUSED
* junk - UNUSED
* filename_ptr - a pointer to the filename;
* Returns: none
*/
/* Function Name: SetFile
* Description: Changes the current save file
* Arguments: w - UNUSED.
* res_box_ptr - UNUSED.
* junk - UNUSED.
* Returns: none
*/
/* ARGSUSED */
void
SetFile(w, junk, garbage)
Widget w;
XtPointer junk, garbage;
{
/*
* If there is no filename the ask for one, otherwise just save to
* current file.
*/
/* Function Name: ApplyResource
* Description: Apply the current resource to the running application.
* Arguments: w - any widget in the application.
* node_ptr - a pointer to the node containing
* the current resouce box.
* junk - UNUSED.
* Returns: none
*/
_XEditResResetStream(stream);
_XEditResPutString8(stream, info.name); /* Insert name */
_XEditResPutString8(stream, XtRString); /* insert type */
/*
* Insert value.
*/
value = GetResourceValueForSetValues(node, &size);
_XEditResPut16(stream, size);
for (i = 0; i < size; i++)
_XEditResPut8(stream, value[i]);
XtFree(value);
len = stream->current - stream->top;
/* Function Name: ObtainResource
* Description: Obtain the current resource from the running application.
* Arguments: node_ptr - a pointer to the node containing
* the current resouce box.
* Returns: none
*/
/* Function Name: CreateSetValuesCommand
* Description: Creates the SetValues command if this widget
* matches the resource string in the database.
* Arguments: node - the current node.
* info_ptr - the pointer to the apply info.
* Returns: none
*/
/* Function Name: CreateGetValuesCommand
* Description: Creates the GetValues command.
* Arguments: node - the current node.
* info_ptr - the pointer to the apply info.
* Returns: none
*/
/* Function Name: ActivateResourceWidgets
* Description: Activates all widgets that match this resource.
* Arguments: w - UNUSED.
* node_ptr - the node that owns this resource box.
* junk - UNUSED.
* Returns: none.
*/
/* Function Name: SetOnlyMatchingWidgets
* Description: Activates all widgets in the tree that match this
* resource specifiction.
* Arguments: node - the current node.
* info_ptr - the pointer to the apply info.
* Returns: none
*/