1 /* $XConsortium: Print.c /main/4 1995/11/01 11:29:33 rswiston $ */
2 /*****************************************************************************
8 * Description: This file contains the function which prints out the
9 * front panel contents. It is used as a client for this
12 * (c) Copyright 1993, 1994 Hewlett-Packard Company
13 * (c) Copyright 1993, 1994 International Business Machines Corp.
14 * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
15 * (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of Novell, Inc.
17 ****************************************************************************/
19 #include <Dt/DtP.h> /* required for DtDirPaths type */
20 #include <Dt/DbReader.h> /* required for DtDbPathId type */
22 #include <Dt/IconFile.h>
23 #include "DataBaseLoad.h"
27 const char *szWM_TOOL_CLASS = DtWM_TOOL_CLASS;
29 char *szWM_TOOL_CLASS = DtWM_TOOL_CLASS;
34 String unpost_arrow_image;
35 String unpost_monitor_arrow_image;
37 /************************************************************************
39 * CheckOtherMonitorsOn
40 * Due to a dependancy, CheckOtherMonitorsOn must be defined. This
41 * is a stubbed procedure that ensures that the procedure is defined.
43 ************************************************************************/
45 CheckOtherMonitorsOn(SubpanelData * subpanel_data)
51 /************************************************************************
53 * ToggleDefaultControl
54 * Due to a dependancy, ToggleDefaultControl must be defined. This
55 * is a stubbed procedure that ensures that the procedure is defined.
57 ************************************************************************/
61 ToggleDefaultControl (ControlData * main_control_data,
62 SubpanelData * subpanel_data,
63 ControlData * control_data)
72 /************************************************************************
75 * Get the file name for an icon by extracting the panel resolution
76 * and then looking up the image name.
78 ************************************************************************/
82 GetIconName (String image_name,
83 unsigned int icon_size)
88 Screen * screen = XtScreen (panel.shell);
92 return_name = _DtGetIconFileName (screen, image_name, NULL, NULL, icon_size);
94 if (return_name == NULL)
95 return_name = _DtGetIconFileName (screen, image_name, NULL, NULL,
97 if (return_name == NULL)
98 return_name = XtNewString (image_name);
101 /* Return value to be freed by caller. */
103 return (return_name);
109 /************************************************************************
111 * PrintFrontPanelContents
112 * Using the information from the loading of the database
113 * print out the contents of the database.
115 ************************************************************************/
119 PrintFrontPanelContents(void)
123 SwitchData * switch_data;
124 ControlData * control_data, * switch_control_data;
125 SubpanelData * subpanel_data;
126 int switch_position = POSITION_FIRST;
130 /* print out the component tree */
132 printf ("PANEL %s\n", (char *) panel.element_values[0].parsed_value);
134 for (i = 0; i < panel.box_data_count; i++)
136 box_data = panel.box_data[i];
138 if (box_data->switch_data != NULL)
140 switch_data = box_data->switch_data;
141 switch_position = (int) box_data->switch_data->element_values[SWITCH_POSITION_HINTS].parsed_value;
148 (char *) box_data->element_values[0].parsed_value);
150 for (j = 0; j < box_data->control_data_count; j++)
152 control_data = box_data->control_data[j];
154 if (switch_data != NULL &&
155 switch_position < (int) (control_data->element_values[CONTROL_POSITION_HINTS].parsed_value))
157 printf (" SWITCH %s\n",
158 (char *) switch_data->element_values[0].parsed_value);
160 switch_position = POSITION_LAST;
162 for (k = 0; k < switch_data->control_data_count; k++)
164 switch_control_data = switch_data->control_data[k];
166 printf (" CONTROL %s\n", (char *)
167 switch_control_data->element_values[0].parsed_value);
172 printf (" CONTROL %s\n",
173 (char *) control_data->element_values[0].parsed_value);
175 if (control_data->subpanel_data != NULL)
177 subpanel_data = control_data->subpanel_data;
179 printf(" SUBPANEL %s\n", (char *)
180 subpanel_data->element_values[0].parsed_value);
182 for (k = 0; k < subpanel_data->control_data_count; k++)
184 control_data = subpanel_data->control_data[k];
186 printf (" CONTROL %s\n", (char *)
187 control_data->element_values[0].parsed_value);
197 /************************************************************************
199 * The main program for the fron panel print function.
201 ************************************************************************/
209 XtAppContext appContext;
212 /* This call is required to have values to pass to DtAppInitialize */
213 widget = XtAppInitialize( &appContext, "Dtfplist",
214 NULL, 0, &argc, argv, NULL, NULL, 0);
216 /* This is required initialization so that FrontPanelReadDatabases()
217 * procedure complete successfully.
219 DtAppInitialize( appContext, XtDisplay(widget), widget,
220 argv[0], (char *)szWM_TOOL_CLASS);
223 /* Load the database for use in printing. If it is able to load print
224 * contents of front panel.
228 panel.app_name = strdup(argv[0]);
229 if (FrontPanelReadDatabases ())
231 /* Print out the contents of the .fp database */
232 PrintFrontPanelContents ();
236 /* NEEDS TO BE LOCALIZED */
237 printf ("PANEL not found. Error in reading database.\n");