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 /* $XConsortium: Print.c /main/4 1995/11/01 11:29:33 rswiston $ */
24 /*****************************************************************************
30 * Description: This file contains the function which prints out the
31 * front panel contents. It is used as a client for this
34 * (c) Copyright 1993, 1994 Hewlett-Packard Company
35 * (c) Copyright 1993, 1994 International Business Machines Corp.
36 * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
37 * (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of Novell, Inc.
39 ****************************************************************************/
41 #include <Dt/DtP.h> /* required for DtDirPaths type */
42 #include <Dt/DbReader.h> /* required for DtDbPathId type */
44 #include <Dt/IconFile.h>
46 #include "DataBaseLoad.h"
51 const char *szWM_TOOL_CLASS = DtWM_TOOL_CLASS;
53 char *szWM_TOOL_CLASS = DtWM_TOOL_CLASS;
58 String unpost_arrow_image;
59 String unpost_monitor_arrow_image;
61 /************************************************************************
63 * CheckOtherMonitorsOn
64 * Due to a dependancy, CheckOtherMonitorsOn must be defined. This
65 * is a stubbed procedure that ensures that the procedure is defined.
67 ************************************************************************/
69 CheckOtherMonitorsOn(SubpanelData * subpanel_data)
75 /************************************************************************
77 * ToggleDefaultControl
78 * Due to a dependancy, ToggleDefaultControl must be defined. This
79 * is a stubbed procedure that ensures that the procedure is defined.
81 ************************************************************************/
85 ToggleDefaultControl (ControlData * main_control_data,
86 SubpanelData * subpanel_data,
87 ControlData * control_data)
96 /************************************************************************
99 * Get the file name for an icon by extracting the panel resolution
100 * and then looking up the image name.
102 ************************************************************************/
106 GetIconName (String image_name,
107 unsigned int icon_size)
112 Screen * screen = XtScreen (panel.shell);
116 return_name = _DtGetIconFileName (screen, image_name, NULL, NULL, icon_size);
118 if (return_name == NULL)
119 return_name = _DtGetIconFileName (screen, image_name, NULL, NULL,
121 if (return_name == NULL)
122 return_name = XtNewString (image_name);
125 /* Return value to be freed by caller. */
127 return (return_name);
133 /************************************************************************
135 * PrintFrontPanelContents
136 * Using the information from the loading of the database
137 * print out the contents of the database.
139 ************************************************************************/
143 PrintFrontPanelContents(void)
147 SwitchData * switch_data;
148 ControlData * control_data, * switch_control_data;
149 SubpanelData * subpanel_data;
150 int switch_position = POSITION_FIRST;
154 /* print out the component tree */
156 printf ("PANEL %s\n", (char *) panel.element_values[0].parsed_value);
158 for (i = 0; i < panel.box_data_count; i++)
160 box_data = panel.box_data[i];
162 if (box_data->switch_data != NULL)
164 switch_data = box_data->switch_data;
165 switch_position = (int) (intptr_t) box_data->switch_data->element_values[SWITCH_POSITION_HINTS].parsed_value;
172 (char *) box_data->element_values[0].parsed_value);
174 for (j = 0; j < box_data->control_data_count; j++)
176 control_data = box_data->control_data[j];
178 if (switch_data != NULL &&
179 switch_position < (int) (intptr_t) (control_data->element_values[CONTROL_POSITION_HINTS].parsed_value))
181 printf (" SWITCH %s\n",
182 (char *) switch_data->element_values[0].parsed_value);
184 switch_position = POSITION_LAST;
186 for (k = 0; k < switch_data->control_data_count; k++)
188 switch_control_data = switch_data->control_data[k];
190 printf (" CONTROL %s\n", (char *)
191 switch_control_data->element_values[0].parsed_value);
196 printf (" CONTROL %s\n",
197 (char *) control_data->element_values[0].parsed_value);
199 if (control_data->subpanel_data != NULL)
201 subpanel_data = control_data->subpanel_data;
203 printf(" SUBPANEL %s\n", (char *)
204 subpanel_data->element_values[0].parsed_value);
206 for (k = 0; k < subpanel_data->control_data_count; k++)
208 control_data = subpanel_data->control_data[k];
210 printf (" CONTROL %s\n", (char *)
211 control_data->element_values[0].parsed_value);
221 /************************************************************************
223 * The main program for the fron panel print function.
225 ************************************************************************/
233 XtAppContext appContext;
236 /* This call is required to have values to pass to DtAppInitialize */
237 widget = XtAppInitialize( &appContext, "Dtfplist",
238 NULL, 0, &argc, argv, NULL, NULL, 0);
240 /* This is required initialization so that FrontPanelReadDatabases()
241 * procedure complete successfully.
243 DtAppInitialize( appContext, XtDisplay(widget), widget,
244 argv[0], (char *)szWM_TOOL_CLASS);
247 /* Load the database for use in printing. If it is able to load print
248 * contents of front panel.
252 panel.app_name = strdup(argv[0]);
253 if (FrontPanelReadDatabases ())
255 /* Print out the contents of the .fp database */
256 PrintFrontPanelContents ();
260 /* NEEDS TO BE LOCALIZED */
261 printf ("PANEL not found. Error in reading database.\n");