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 librararies 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>
45 #include "DataBaseLoad.h"
49 const char *szWM_TOOL_CLASS = DtWM_TOOL_CLASS;
51 char *szWM_TOOL_CLASS = DtWM_TOOL_CLASS;
56 String unpost_arrow_image;
57 String unpost_monitor_arrow_image;
59 /************************************************************************
61 * CheckOtherMonitorsOn
62 * Due to a dependancy, CheckOtherMonitorsOn must be defined. This
63 * is a stubbed procedure that ensures that the procedure is defined.
65 ************************************************************************/
67 CheckOtherMonitorsOn(SubpanelData * subpanel_data)
73 /************************************************************************
75 * ToggleDefaultControl
76 * Due to a dependancy, ToggleDefaultControl must be defined. This
77 * is a stubbed procedure that ensures that the procedure is defined.
79 ************************************************************************/
83 ToggleDefaultControl (ControlData * main_control_data,
84 SubpanelData * subpanel_data,
85 ControlData * control_data)
94 /************************************************************************
97 * Get the file name for an icon by extracting the panel resolution
98 * and then looking up the image name.
100 ************************************************************************/
104 GetIconName (String image_name,
105 unsigned int icon_size)
110 Screen * screen = XtScreen (panel.shell);
114 return_name = _DtGetIconFileName (screen, image_name, NULL, NULL, icon_size);
116 if (return_name == NULL)
117 return_name = _DtGetIconFileName (screen, image_name, NULL, NULL,
119 if (return_name == NULL)
120 return_name = XtNewString (image_name);
123 /* Return value to be freed by caller. */
125 return (return_name);
131 /************************************************************************
133 * PrintFrontPanelContents
134 * Using the information from the loading of the database
135 * print out the contents of the database.
137 ************************************************************************/
141 PrintFrontPanelContents(void)
145 SwitchData * switch_data;
146 ControlData * control_data, * switch_control_data;
147 SubpanelData * subpanel_data;
148 int switch_position = POSITION_FIRST;
152 /* print out the component tree */
154 printf ("PANEL %s\n", (char *) panel.element_values[0].parsed_value);
156 for (i = 0; i < panel.box_data_count; i++)
158 box_data = panel.box_data[i];
160 if (box_data->switch_data != NULL)
162 switch_data = box_data->switch_data;
163 switch_position = (int) box_data->switch_data->element_values[SWITCH_POSITION_HINTS].parsed_value;
170 (char *) box_data->element_values[0].parsed_value);
172 for (j = 0; j < box_data->control_data_count; j++)
174 control_data = box_data->control_data[j];
176 if (switch_data != NULL &&
177 switch_position < (int) (control_data->element_values[CONTROL_POSITION_HINTS].parsed_value))
179 printf (" SWITCH %s\n",
180 (char *) switch_data->element_values[0].parsed_value);
182 switch_position = POSITION_LAST;
184 for (k = 0; k < switch_data->control_data_count; k++)
186 switch_control_data = switch_data->control_data[k];
188 printf (" CONTROL %s\n", (char *)
189 switch_control_data->element_values[0].parsed_value);
194 printf (" CONTROL %s\n",
195 (char *) control_data->element_values[0].parsed_value);
197 if (control_data->subpanel_data != NULL)
199 subpanel_data = control_data->subpanel_data;
201 printf(" SUBPANEL %s\n", (char *)
202 subpanel_data->element_values[0].parsed_value);
204 for (k = 0; k < subpanel_data->control_data_count; k++)
206 control_data = subpanel_data->control_data[k];
208 printf (" CONTROL %s\n", (char *)
209 control_data->element_values[0].parsed_value);
219 /************************************************************************
221 * The main program for the fron panel print function.
223 ************************************************************************/
231 XtAppContext appContext;
234 /* This call is required to have values to pass to DtAppInitialize */
235 widget = XtAppInitialize( &appContext, "Dtfplist",
236 NULL, 0, &argc, argv, NULL, NULL, 0);
238 /* This is required initialization so that FrontPanelReadDatabases()
239 * procedure complete successfully.
241 DtAppInitialize( appContext, XtDisplay(widget), widget,
242 argv[0], (char *)szWM_TOOL_CLASS);
245 /* Load the database for use in printing. If it is able to load print
246 * contents of front panel.
250 panel.app_name = strdup(argv[0]);
251 if (FrontPanelReadDatabases ())
253 /* Print out the contents of the .fp database */
254 PrintFrontPanelContents ();
258 /* NEEDS TO BE LOCALIZED */
259 printf ("PANEL not found. Error in reading database.\n");