2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*****************************************************************************
29 * Description: This file contains the function which prints out the
30 * front panel contents. It is used as a client for this
33 * (c) Copyright 1993, 1994 Hewlett-Packard Company
34 * (c) Copyright 1993, 1994 International Business Machines Corp.
35 * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
36 * (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of Novell, Inc.
38 ****************************************************************************/
40 #include <Dt/DtP.h> /* required for DtDirPaths type */
41 #include <Dt/DbReader.h> /* required for DtDbPathId type */
43 #include <Dt/IconFile.h>
45 #include "DataBaseLoad.h"
50 const char *szWM_TOOL_CLASS = DtWM_TOOL_CLASS;
52 char *szWM_TOOL_CLASS = DtWM_TOOL_CLASS;
57 String unpost_arrow_image;
58 String unpost_monitor_arrow_image;
60 /************************************************************************
62 * CheckOtherMonitorsOn
63 * Due to a dependancy, CheckOtherMonitorsOn must be defined. This
64 * is a stubbed procedure that ensures that the procedure is defined.
66 ************************************************************************/
68 CheckOtherMonitorsOn(SubpanelData * subpanel_data)
74 /************************************************************************
76 * ToggleDefaultControl
77 * Due to a dependancy, ToggleDefaultControl must be defined. This
78 * is a stubbed procedure that ensures that the procedure is defined.
80 ************************************************************************/
84 ToggleDefaultControl (ControlData * main_control_data,
85 SubpanelData * subpanel_data,
86 ControlData * control_data)
95 /************************************************************************
98 * Get the file name for an icon by extracting the panel resolution
99 * and then looking up the image name.
101 ************************************************************************/
105 GetIconName (String image_name,
106 unsigned int icon_size)
111 Screen * screen = XtScreen (panel.shell);
115 return_name = _DtGetIconFileName (screen, image_name, NULL, NULL, icon_size);
117 if (return_name == NULL)
118 return_name = _DtGetIconFileName (screen, image_name, NULL, NULL,
120 if (return_name == NULL)
121 return_name = XtNewString (image_name);
124 /* Return value to be freed by caller. */
126 return (return_name);
132 /************************************************************************
134 * PrintFrontPanelContents
135 * Using the information from the loading of the database
136 * print out the contents of the database.
138 ************************************************************************/
142 PrintFrontPanelContents(void)
146 SwitchData * switch_data;
147 ControlData * control_data, * switch_control_data;
148 SubpanelData * subpanel_data;
149 int switch_position = POSITION_FIRST;
153 /* print out the component tree */
155 printf ("PANEL %s\n", (char *) panel.element_values[0].parsed_value);
157 for (i = 0; i < panel.box_data_count; i++)
159 box_data = panel.box_data[i];
161 if (box_data->switch_data != NULL)
163 switch_data = box_data->switch_data;
164 switch_position = (int) (intptr_t) box_data->switch_data->element_values[SWITCH_POSITION_HINTS].parsed_value;
171 (char *) box_data->element_values[0].parsed_value);
173 for (j = 0; j < box_data->control_data_count; j++)
175 control_data = box_data->control_data[j];
177 if (switch_data != NULL &&
178 switch_position < (int) (intptr_t) (control_data->element_values[CONTROL_POSITION_HINTS].parsed_value))
180 printf (" SWITCH %s\n",
181 (char *) switch_data->element_values[0].parsed_value);
183 switch_position = POSITION_LAST;
185 for (k = 0; k < switch_data->control_data_count; k++)
187 switch_control_data = switch_data->control_data[k];
189 printf (" CONTROL %s\n", (char *)
190 switch_control_data->element_values[0].parsed_value);
195 printf (" CONTROL %s\n",
196 (char *) control_data->element_values[0].parsed_value);
198 if (control_data->subpanel_data != NULL)
200 subpanel_data = control_data->subpanel_data;
202 printf(" SUBPANEL %s\n", (char *)
203 subpanel_data->element_values[0].parsed_value);
205 for (k = 0; k < subpanel_data->control_data_count; k++)
207 control_data = subpanel_data->control_data[k];
209 printf (" CONTROL %s\n", (char *)
210 control_data->element_values[0].parsed_value);
220 /************************************************************************
222 * The main program for the fron panel print function.
224 ************************************************************************/
232 XtAppContext appContext;
235 /* This call is required to have values to pass to DtAppInitialize */
236 widget = XtAppInitialize( &appContext, "Dtfplist",
237 NULL, 0, &argc, argv, NULL, NULL, 0);
239 /* This is required initialization so that FrontPanelReadDatabases()
240 * procedure complete successfully.
242 DtAppInitialize( appContext, XtDisplay(widget), widget,
243 argv[0], (char *)szWM_TOOL_CLASS);
246 /* Load the database for use in printing. If it is able to load print
247 * contents of front panel.
251 panel.app_name = strdup(argv[0]);
252 if (FrontPanelReadDatabases ())
254 /* Print out the contents of the .fp database */
255 PrintFrontPanelContents ();
259 /* NEEDS TO BE LOCALIZED */
260 printf ("PANEL not found. Error in reading database.\n");