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: udcexp.c /main/5 1996/10/14 14:45:34 barstow $ */
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 <Xm/MessageB.h>
33 #include <Xm/RowColumn.h>
38 void setselectedcode();
40 extern char *maintitle;
42 void udcexp(Exc_data * ed)
44 ed->function = EXPORT;
45 strcpy(ed->bdfmode,"w");
47 PopupSelectXLFD(ed->toplevel);
50 void createbdf(Exc_data * ed)
53 char *comment_list[] = {""};
58 msg = GETMESSAGE(10, 2, "Failed to make the BDF file");
60 i = ExpGpftoBDF(ed->fontfile, ed->bdffile,
61 ed->code_num, ed->gpf_code_list,
62 comment_num, comment_list, 0);
64 AskUser(ed->toplevel, ed, msg, &ans, "error");
69 void selcharokCB(Widget widget, ListData * ld, XtPointer call_data)
76 msg = GETMESSAGE(10, 4, "No indexes are selected");
78 XtVaGetValues(ld->list, XmNselectedItemCount, &num, NULL);
80 /* AskUser(widget, ld->ed, msg, &ans, "error");*/
84 XtUnmanageChild(XtParent(widget));
90 void selcharcancelCB(Widget widget, ListData * ld, XtPointer call_data)
99 XmString * setxmslist(ListData * ld)
102 XmString *xmslist, *xmsp;
105 if ((xmslist = (XmString *) calloc(ld->existcode_num, sizeof(XmString *)))
107 excerror(ld->ed, EXCERRMALLOC, "setxmslist", "exit");
109 cp = ld->existcode_c;
111 for (i = 0; i < ld->existcode_num; i++) {
112 *xmsp = XmStringCreateLocalized(*cp);
119 void freexmslist(ListData * ld, XmString * xmslist)
124 if (xmslist != NULL) {
126 for (i = 0; i < ld->existcode_num; i++) {
134 void selcharcd(Exc_data * ed)
136 Widget mainw, selcd, ok, cancel;
137 Widget slctLabel, form;
146 oklabel = GETMESSAGE(10, 6, "OK");
147 cancellabel = GETMESSAGE(10, 8, "Cancel");
150 XtSetArg(args[n], XmNautoUnmanage, False); n++;
151 XtSetArg(args[n], XmNtitle, maintitle); n++;
152 mainw = XmCreateTemplateDialog(ed->toplevel, "mainw", args, n);
155 form = XmCreateForm( mainw, "form", args, n);
158 p = GETMESSAGE(10, 10, "glyph indexes");
160 XtSetArg( args[n], XmNx, 20 ) ; n++;
161 XtSetArg( args[n], XmNheight, 20 ) ; n++ ;
162 XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ) ; n++ ;
163 XtSetArg( args[n], XmNtopOffset, 10 ) ; n++ ;
164 slctLabel = XmCreateLabel( form, p, args, n);
165 XtManageChild(slctLabel);
168 xmslist = setxmslist(ld);
169 XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ) ; n++ ;
170 XtSetArg( args[n], XmNleftOffset, 20 ) ; n++ ;
171 XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++ ;
172 XtSetArg( args[n], XmNtopOffset, 5 ) ; n++ ;
173 XtSetArg( args[n], XmNwidth, 200 ) ; n++ ;
174 XtSetArg (args[n], XmNtopWidget, slctLabel ); n++;
175 XtSetArg(args[n], XmNitems, xmslist); n++;
176 XtSetArg(args[n], XmNitemCount, ld->existcode_num); n++;
177 XtSetArg(args[n], XmNvisibleItemCount, 10); n++;
178 XtSetArg(args[n], XmNlistSizePolicy, XmCONSTANT); n++;
179 XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmAS_NEEDED); n++;
180 XtSetArg(args[n], XmNselectionPolicy, XmEXTENDED_SELECT); n++;
181 selcd = XmCreateScrolledList(form, "Select codes", args, n);
182 freexmslist(ld, xmslist);
183 XtManageChild(selcd);
187 ok = excCreatePushButton(mainw, "ok", oklabel,
188 (XtCallbackProc) selcharokCB, (XtPointer) ld);
190 cancel = excCreatePushButton(mainw, "cancel", cancellabel,
191 (XtCallbackProc) selcharcancelCB,
194 XtManageChild(mainw);
197 void setselectedcode(ListData *ld)
204 XmListGetSelectedPos(ld->list, &position_list, &position_count);
206 ld->ed->code_num = position_count;
207 ld->ed->gpf_code_list = (int *) calloc(position_count, sizeof(int));
208 codep = ld->ed->gpf_code_list;
210 for (i = 0; i < position_count; i++) {
211 *codep = *((ld->existcode)+(position_list[i]-1));