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: udcexc.c /main/4 1996/09/02 18:50:32 cde-fuj $ */
25 * (c) Copyright 1995 FUJITSU LIMITED
26 * This is source code modified by FUJITSU LIMITED under the Joint
27 * Development Agreement for the CDEnext PST.
28 * This is unpublished proprietary source code of FUJITSU LIMITED
32 #include "xoakufont.h"
33 #include "selectxlfd.h"
35 #include <Xm/RowColumn.h>
36 #include <Xm/ToggleB.h>
37 #include <Xm/MessageB.h>
46 #define ERROR_1 errmsg_org[fal_utyerrno & 0xff]
47 /*#define ERROR_1 fal_errmsg_org[fal_utyerrno & 0xff]*/
48 /*#define ERROR_2 fal_errmsg_func[fal_utyerrno >>8]*/
50 Widget toplevel, mainw;
55 /*char *terminatemsg = "Do you want to terminate dtudcexch";*/
58 * Error messages(by origin)
61 char *errmsg_org[0xff];
65 #define Rchar(name, class, member,def){ \
66 name, class, XtRString, sizeof(char *), \
67 XtOffsetOf(Rsrc, member), XtRString, (XtPointer)def }
69 Widget excCreateRadioButton(Widget parent, String name, String label,
70 XtCallbackProc callback_func,
71 XtPointer client_data)
76 widget = XtVaCreateManagedWidget(name,
77 xmToggleButtonWidgetClass, parent,
78 XmNindicatorType, XmONE_OF_MANY,
80 XtAddCallback(widget, XmNvalueChangedCallback,
81 (XtCallbackProc) callback_func,
82 (XtPointer) client_data);
84 xms = XmStringCreateLocalized(label);
94 int main(int argc, char * argv[])
96 XtAppContext app_context;
97 Widget row, expfunc, impfunc, exit/*, help*/;
100 static char *explabel;
101 static char *implabel;
102 static char *exitlabel;
103 /* static char helplabel[] = "Help";*/
104 /* char msg1[] = "Failed in the start of dtudcexch";*/
108 int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
110 FalFontDataList *fontlist;
113 XtSetLanguageProc(NULL,NULL,NULL);
116 toplevel = XtAppInitialize(&app_context, "UDCexchange",
117 (XrmOptionDescList) NULL,
118 0, (int *) &argc, argv, (String *) NULL,
121 maintitle = GETMESSAGE(8, 2, "UDC data exchange utitlity");
123 errmsg_org[0] = GETMESSAGE(8, 4, "Fatal error occurred.");
124 errmsg_org[1] = GETMESSAGE(8, 6, "Cannot open the font file.");
125 errmsg_org[2] = GETMESSAGE(8, 8, "Cannot read the font file.");
126 errmsg_org[3] = GETMESSAGE(8, 10, "There is no more memory.");
127 errmsg_org[4] = GETMESSAGE(8, 12, "Fatal error occurred.");
128 errmsg_org[5] = GETMESSAGE(8, 14, "The specified font file does not exist.");
129 errmsg_org[6] = GETMESSAGE(8, 16, "This font is not a pcf or snf font.");
130 errmsg_org[7] = GETMESSAGE(8, 18, "Cannot open fonts.list file.");
131 errmsg_org[8] = GETMESSAGE(8, 20, "The format of fonts.list file is illegal.");
132 errmsg_org[9] = GETMESSAGE(8, 22, "The descriptions of the fonts.list file are incorrect.");
133 errmsg_org[10] = GETMESSAGE(8, 24, "The format of fonts.list file is illegal.");
134 errmsg_org[11] = GETMESSAGE(8, 26, "Cannot open fonts.dir file.");
135 errmsg_org[12] = GETMESSAGE(8, 28, "Cannot read fonts.dir file.");
136 errmsg_org[13] = GETMESSAGE(8, 30, "Cannot read font properties.");
137 errmsg_org[14] = GETMESSAGE(8, 32, "Cannot get FONT property.");
138 errmsg_org[15] = GETMESSAGE(8, 34, "Cannot get FAMILY_NAME property.");
139 errmsg_org[16] = GETMESSAGE(8, 36, "This font file is already opened by other application.");
140 errmsg_org[17] = GETMESSAGE(8, 38, "Cannot lock font file.");
141 errmsg_org[18] = GETMESSAGE(8, 40, "Cannot unlock font file.");
142 errmsg_org[19] = GETMESSAGE(8, 42, "Cannot get lock information from the font file.");
143 errmsg_org[20] = GETMESSAGE(8, 44, "Cannot find the specified font file.");
144 errmsg_org[21] = GETMESSAGE(8, 46, "Cannot read NLS database.");
145 errmsg_org[22] = GETMESSAGE(8, 48, "Cannot get charset names from NLS database.");
146 errmsg_org[23] = GETMESSAGE(8, 50, "Charset name not defined in NLS database.");
147 errmsg_org[24] = GETMESSAGE(8, 52, "The specified font has not been opened.");
148 errmsg_org[25] = GETMESSAGE(8, 54, "Fatal error occurred.");
150 resource.xlfd_label = GETMESSAGE(8, 56, "XLFD name :" ),
151 resource.copy_xlfd_label = GETMESSAGE(8, 58, "Original font (XLFD name) :");
152 resource.code_label = GETMESSAGE(8, 60, "UDC code area :");
153 resource.style_label = GETMESSAGE(8, 62, "Style :");
154 resource.size_label = GETMESSAGE(8, 64, "Size (letter size) :");
155 resource.exec_label = GETMESSAGE(8, 66, "Open");
156 resource.quit_label = GETMESSAGE(8, 68, "Cancel");
157 resource.ok_label = GETMESSAGE(8, 70, "OK");
158 resource.cancel_label = GETMESSAGE(8, 72, "cancel");
159 resource.copy_orgin = GETMESSAGE(8, 74, "Copy orgin code(hex) :");
160 resource.copy_target = GETMESSAGE(8, 76, "Copy target code(hex) :");
161 resource.copy_label = GETMESSAGE(8, 78, "Copy");
162 resource.overlay_label = GETMESSAGE(8, 80, "Overlay");
164 explabel = GETMESSAGE(8, 82, "export function");
165 implabel = GETMESSAGE(8, 84, "import function");
166 exitlabel = GETMESSAGE(8, 86, "Cancel");
169 if ((ed = (Exc_data *) malloc(sizeof(Exc_data))) == NULL) {
170 excerror(ed, EXCERRMALLOC, "main", "exit");
172 memset(ed,0x00,sizeof(Exc_data));
174 ed->app = app_context;
175 ed->toplevel = toplevel;
177 if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
178 fprintf( stderr, "GetFontList Err\n" );
179 sprintf(err, "%s", ERROR_1);
180 AskUser(ed->toplevel, ed, err, &ans, "error");
181 /* AskUser(ed->toplevel, ed, msg1, &ans, "error");*/
184 FalFreeFontList(fontlist);
187 /* make main window */
189 XtSetArg( args[n], XmNautoUnmanage, False ) ; n++ ;
190 XtSetArg(args[n], XmNtitle, maintitle); n++;
191 mainw = XmCreateTemplateDialog(toplevel, "mainw", args, n);
193 row = XtVaCreateManagedWidget("row", xmRowColumnWidgetClass, mainw,
194 XmNradioBehavior, True,
195 XmNradioAlwaysOne, True,
197 expfunc = excCreateRadioButton(row, "expfunc", explabel,
198 (XtCallbackProc) callexpCB, (XtPointer) ed);
200 impfunc = excCreateRadioButton(row, "impfunc", implabel,
201 (XtCallbackProc) callimpCB, (XtPointer) ed);
203 exit = excCreatePushButton(mainw, "exit", exitlabel,
204 (XtCallbackProc) exitCB, (XtPointer) ed);
206 /* help = excCreatePushButton(mainw, "help", helplabel,
207 (XtCallbackProc) helpCB, (XtPointer) ed);
210 XmNmessageWindow, exit,
213 XtManageChild(mainw);
215 /* XtRealizeWidget(toplevel);*/
217 XtAppMainLoop(app_context);
220 void callexpCB(Widget widget, Exc_data * ed, XtPointer call_data)
222 XtUnmanageChild(mainw);
225 void callimpCB(Widget widget, Exc_data * ed, XtPointer call_data)
227 XtUnmanageChild(mainw);
230 void exitCB(Widget widget, Exc_data * ed, XtPointer call_data)
234 /*void helpCB(Widget widget, Exc_data * ed, XtPointer call_data)