mtfgui.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  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)
  10. * any later version.
  11. *
  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
  16. * details.
  17. *
  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
  22. */
  23. /* mtfgui.c 1.21 - Fujitsu source for CDEnext 96/10/30 13:13:46 */
  24. /* $XConsortium: mtfgui.c /main/11 1996/11/08 01:55:01 cde-fuj $ */
  25. /*
  26. * (c) Copyright 1995 FUJITSU LIMITED
  27. * This is source code modified by FUJITSU LIMITED under the Joint
  28. * Development Agreement for the CDEnext PST.
  29. * This is unpublished proprietary source code of FUJITSU LIMITED
  30. */
  31. #include <stdio.h>
  32. #include <locale.h>
  33. #include <X11/Intrinsic.h>
  34. #include <Xm/MessageB.h>
  35. #ifdef __linux__
  36. /* needed for intptr_t */
  37. #include <stdint.h>
  38. #endif
  39. #include "xoakufont.h"
  40. #include "util.h"
  41. void CBeOblB_aEnd(Widget widget, caddr_t clientData, caddr_t callData);
  42. void EHeStaT_list(Widget widget, int select, XEvent *e);
  43. void CBeScro(Widget widget, caddr_t clientData, caddr_t callData);
  44. void EHeBulB_eMEv(Widget widget, caddr_t clientData, XEvent *e);
  45. void EHeBulB_eExp(Widget widget, caddr_t clientData, XEvent *e);
  46. void EHeBulB_dExp(Widget widget, caddr_t clientData);
  47. static void EHStaT_disp(Widget widget, int i);
  48. extern Resource resource;
  49. extern int efctPtnNum(void);
  50. extern char *char_set(char *str);
  51. extern char *fullpath;
  52. extern FalFontData fullFontData;
  53. extern FalCodeRegion CodeArea[16];
  54. /********************************************************************
  55. structure of widgets
  56. ********************************************************************/
  57. extern Widget toplevel;
  58. extern Widget wgeScro;
  59. extern Widget editPopW;
  60. Widget wgeBulB_edit;
  61. static Widget wgeStaT_form[EDLIST_MAX],
  62. wgeStaT_disp[EDLIST_MAX],
  63. wgeStaT_list[EDLIST_MAX],
  64. wgeBulB_disp;
  65. /**********************************************************************
  66. display windows
  67. **********************************************************************/
  68. /*
  69. * contents : displays the "User Defined Charactrer editor" window
  70. */
  71. static Widget CreateEditPtn(Widget owner);
  72. void OpenCB(Widget w, XtPointer client_data, XtPointer call_data);
  73. void MngPtnCB(void);
  74. void CpyPtnCB(void);
  75. void CBeRecB_obj(Widget widget, int obj, XmToggleButtonCallbackStruct *call);
  76. void CBeOblB_aAdd(void);
  77. void CBeOblB_rCmd(Widget widget, int proc, caddr_t callData);
  78. void CBeOblB_rCmdp(Widget widget, int proc, caddr_t callData);
  79. void CBeOblB_rCan(Widget widget, caddr_t clientData, caddr_t callData);
  80. /**
  81. ** contents : manage the codes list
  82. ** ===================================================================
  83. **/
  84. static void
  85. XlfdCB(void)
  86. {
  87. Widget dialog;
  88. Arg args[5];
  89. char mess[1024];
  90. int n = 0;
  91. XmString cs, cs1, cs2;
  92. sprintf(mess, "%s : %s", resource.file_name, fullpath);
  93. cs = XmStringCreateLocalized(mess);
  94. cs1 = XmStringSeparatorCreate();
  95. cs2 = XmStringConcat(cs, cs1);
  96. XmStringFree(cs);
  97. XmStringFree(cs1);
  98. sprintf(mess, "%s : %s", resource.xlfd_name, fullFontData.xlfdname);
  99. cs1 = XmStringCreateLocalized(mess);
  100. cs = XmStringConcat(cs2, cs1);
  101. XmStringFree(cs1);
  102. XmStringFree(cs2);
  103. XtSetArg (args[n], XmNtitle, resource.l_xlfd_title); n++;
  104. XtSetArg (args[n], XmNmessageString, cs); n++;
  105. XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
  106. dialog = XmCreateInformationDialog (toplevel, "Xlfd_name", args, n);
  107. XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
  108. XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
  109. XtManageChild (dialog);
  110. XmStringFree(cs);
  111. }
  112. static void
  113. CodeAreaCB(void)
  114. {
  115. char mess[256];
  116. char tmp[16];
  117. Widget dialog;
  118. Arg args[5];
  119. int n;
  120. XmString cs;
  121. sprintf(mess, "%s : ", resource.codearea);
  122. switch (fullFontData.cd_set) {
  123. case FAL_FONT_CS0:
  124. strcat(mess, "CS0:");
  125. break;
  126. case FAL_FONT_CS1:
  127. strcat(mess, "CS1:");
  128. break;
  129. case FAL_FONT_CS2:
  130. strcat(mess, "CS2:");
  131. break;
  132. case FAL_FONT_CS3:
  133. strcat(mess, "CS3:");
  134. break;
  135. }
  136. for (n=0; CodeArea[n].start != -1; n++) {
  137. sprintf(tmp, " %X - %X ", CodeArea[n].start, CodeArea[n].end);
  138. strcat(mess, tmp);
  139. }
  140. cs = XmStringCreateLocalized(mess);
  141. n = 0;
  142. XtSetArg (args[n], XmNtitle, resource.l_codearea_title); n++;
  143. XtSetArg (args[n], XmNmessageString, cs); n++;
  144. XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
  145. XtSetArg (args[n], XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON); n++;
  146. dialog = XmCreateInformationDialog (toplevel, "UDCarea", args, n);
  147. XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
  148. XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
  149. XtManageChild (dialog);
  150. XmStringFree(cs);
  151. }
  152. void
  153. ListSetLabelStr(int i, String str)
  154. {
  155. SetLabelString( wgeStaT_list[i], str );
  156. }
  157. void
  158. ListSelectItem(int i)
  159. {
  160. XtVaSetValues( wgeStaT_list[i],
  161. XmNbackground, (XtArgVal) resource.foreground,
  162. XmNforeground, (XtArgVal) resource.background,
  163. NULL);
  164. xl.list_winID = XtWindow( wgeStaT_disp[i] ) ;
  165. }
  166. void
  167. ListUnselectItem(int i)
  168. {
  169. XtVaSetValues( wgeStaT_list[i],
  170. XmNbackground, (XtArgVal) resource.background,
  171. XmNforeground, (XtArgVal) resource.foreground,
  172. NULL);
  173. xl.list_winID = 0 ;
  174. }
  175. void
  176. ListSetGlyphImage( int i )
  177. {
  178. int code ;
  179. dl_glyph[i].disp_winID = XtWindow(wgeStaT_disp[i]);
  180. code = noToCode(ptnSqToNo(sq_disp[i]));
  181. if (codeCheck(code)) {
  182. XClearWindow(xl.display, dl_glyph[i].disp_winID);
  183. return;
  184. }
  185. if (code == edg.code && xl.dispImage != NULL) {
  186. XPutImage(xl.display, dl_glyph[i].disp_winID, xl.borderGC,
  187. xl.dispImage, 0,0,0,0, edg.width, edg.height );
  188. } else {
  189. if (dl_glyph[i].dispImage)
  190. XFree((char *)dl_glyph[i].dispImage);
  191. if (ptnGet(code, dl_glyph[i].ptn))
  192. return ;
  193. dl_glyph[i].dispImage = XCreateImage( xl.display,
  194. DefaultVisual(xl.display, DefaultScreen(xl.display)), 1,
  195. XYBitmap, 0, dl_glyph[i].ptn, edg.width, edg.height, 8, 0);
  196. dl_glyph[i].dispImage->bitmap_bit_order = MSBFirst;
  197. dl_glyph[i].dispImage->byte_order = MSBFirst;
  198. XPutImage(xl.display, dl_glyph[i].disp_winID, xl.borderGC,
  199. dl_glyph[i].dispImage, 0,0,0,0, edg.width, edg.height);
  200. }
  201. }
  202. /*ARGSUSED*/
  203. static void
  204. EHStaT_disp( Widget widget, int i /* widget that have some ivent */ )
  205. {
  206. ListSetGlyphImage( i );
  207. }
  208. /**
  209. ** contents : create the icon
  210. ** ===================================================================
  211. **/
  212. /**
  213. ** contents : set callback functions for UDC editor window
  214. ** ===================================================================
  215. **/
  216. static void _create_editptn_after();
  217. static Widget FooterMessage;
  218. static Widget codeLabel;
  219. static menuButtonItems menu_btn[] = {
  220. MENUBTNARGS( 'F' ),
  221. MENUBTNARGS( 'E' ),
  222. MENUBTNARGS( 'C' ),
  223. MENUBTNARGS( 'I' ),
  224. };
  225. static MButton MenuBTN = MBUTTONS( menu_btn );
  226. static ButtonItems file_btn[] = {
  227. BTNARGS( OpenCB, NULL, 'O', True, False),
  228. BTNARGS( CBeOblB_aAdd, NULL, 'S', True, False),
  229. BTNARGS( NULL, NULL, NULL, NULL, NULL),
  230. BTNARGS( CBeOblB_aEnd, NULL, 'E', True, False),
  231. };
  232. static Button FileBTN = BUTTONS( file_btn );
  233. static ButtonItems edit_btn[] = {
  234. BTNARGS( CBeOblB_rCmd, PROC_CLS, 'C', True, False),
  235. BTNARGS( CBeOblB_rCmd, PROC_SET, 'S', True, False),
  236. BTNARGS( CBeOblB_rCmd, PROC_REV, 'R', True, False),
  237. BTNARGS( CBeOblB_rCmdp, PROC_CUT, 'U', True, False),
  238. BTNARGS( CBeOblB_rCmdp, PROC_CPY, 'O', True, False),
  239. BTNARGS( CBeOblB_rCmdp, PROC_PASTE,'P', True, False),
  240. BTNARGS( CBeOblB_rCmd, PROC_ROLL, 'A', True, False),
  241. BTNARGS( CBeOblB_rCmd, PROC_SYMV, 'V', True, False),
  242. BTNARGS( CBeOblB_rCmd, PROC_SYMH, 'H', True, False),
  243. BTNARGS( CBeOblB_rCan, NULL, 'N', True, False),
  244. };
  245. static Button EditBTN = BUTTONS( edit_btn );
  246. static ButtonItems char_btn[] = {
  247. BTNARGS( MngPtnCB, NULL, 'A', True, False ),
  248. BTNARGS( CpyPtnCB, NULL, 'C', True, False ),
  249. };
  250. static Button CharBTN = BUTTONS( char_btn );
  251. static ButtonItems info_btn[] = {
  252. BTNARGS( XlfdCB, NULL, 'X', True, False ),
  253. BTNARGS( CodeAreaCB, NULL, 'C', True, False ),
  254. };
  255. static Button InfoBTN = BUTTONS( info_btn );
  256. static ExclusiveItems draw_ex[] = {
  257. EXARGS( PROC_POINT, "pencil", True, CBeRecB_obj, True ),
  258. EXARGS( PROC_LINE, "line", True, CBeRecB_obj, False ),
  259. EXARGS( PROC_RECT, "rectangle", True, CBeRecB_obj, False ),
  260. EXARGS( PROC_CIRCLE, "circle", True, CBeRecB_obj, False ),
  261. EXARGS( PROC_ERASE, "erase", True, CBeRecB_obj, False ),
  262. EXARGS( PROC_SELECT, "select", True, CBeRecB_obj, False ),
  263. };
  264. static Exclusive DrawEX = EXCLUSIVE( draw_ex );
  265. static void
  266. Unset(void)
  267. {
  268. XtSetSensitive(EditBTN.w[0], False);
  269. XtSetSensitive(EditBTN.w[1], False);
  270. XtSetSensitive(EditBTN.w[2], False);
  271. XtSetSensitive(EditBTN.w[3], False);
  272. XtSetSensitive(EditBTN.w[4], False);
  273. XtSetSensitive(EditBTN.w[5], False);
  274. XtSetSensitive(EditBTN.w[6], False);
  275. XtSetSensitive(EditBTN.w[7], False);
  276. XtSetSensitive(EditBTN.w[8], False);
  277. XtSetSensitive(EditBTN.w[9], False);
  278. }
  279. void
  280. SelectSet(void)
  281. {
  282. XtSetSensitive(EditBTN.w[0], True);
  283. XtSetSensitive(EditBTN.w[1], True);
  284. XtSetSensitive(EditBTN.w[2], True);
  285. XtSetSensitive(EditBTN.w[3], True);
  286. XtSetSensitive(EditBTN.w[4], True);
  287. XtSetSensitive(EditBTN.w[6], True);
  288. XtSetSensitive(EditBTN.w[7], True);
  289. XtSetSensitive(EditBTN.w[8], True);
  290. }
  291. void
  292. SelectUnset(void)
  293. {
  294. XtSetSensitive(EditBTN.w[0], False);
  295. XtSetSensitive(EditBTN.w[1], False);
  296. XtSetSensitive(EditBTN.w[2], False);
  297. XtSetSensitive(EditBTN.w[3], False);
  298. XtSetSensitive(EditBTN.w[4], False);
  299. XtSetSensitive(EditBTN.w[6], False);
  300. XtSetSensitive(EditBTN.w[7], False);
  301. XtSetSensitive(EditBTN.w[8], False);
  302. }
  303. void
  304. CopySet(void)
  305. {
  306. XtSetSensitive(EditBTN.w[5], True);
  307. }
  308. void
  309. UndoSet(void)
  310. {
  311. XtSetSensitive(EditBTN.w[9], True);
  312. }
  313. void
  314. UndoUnset(void)
  315. {
  316. XtSetSensitive(EditBTN.w[9], False);
  317. }
  318. /**
  319. ** contents : create the UDC editor window
  320. ** --------------------------------
  321. **/
  322. void
  323. PopupEditPtn(Widget owner)
  324. {
  325. if (! editPtnW){
  326. editPtnW = CreateEditPtn(owner);
  327. _create_editptn_after();
  328. }
  329. XtPopup(editPtnW, XtGrabNone);
  330. }
  331. static Widget
  332. CreateEditPtn(Widget owner)
  333. {
  334. int slimax;
  335. int i;
  336. Widget baseForm, pop, font_menu, edit_menu, char_menu, info_menu;
  337. Widget listBase, listFrame, rc, editFrame, figure_w;
  338. Widget imageFrame, imageForm, editPane, image;
  339. extern Widget CreateFrame();
  340. extern Widget CreatePixButton();
  341. Arg arg[1];
  342. SetItemLabel(&MenuBTN, 0, resource.l_font);
  343. SetItemLabel(&MenuBTN, 1, resource.l_edit);
  344. SetItemLabel(&MenuBTN, 2, resource.l_manage);
  345. SetItemLabel(&MenuBTN, 3, resource.l_info);
  346. baseForm = (Widget)
  347. CreateMenuBarAndFooterMessageForm( owner, "dtudcfonted",
  348. &MenuBTN, XtNumber(menu_btn), &pop, &FooterMessage );
  349. editPopW = pop;
  350. AddDeleteProc(pop, CBeOblB_aEnd);
  351. font_menu = GetMenuWidget( &MenuBTN, 0 );
  352. edit_menu = GetMenuWidget( &MenuBTN, 1 );
  353. char_menu = GetMenuWidget( &MenuBTN, 2 );
  354. info_menu = GetMenuWidget( &MenuBTN, 3 );
  355. SetItemLabel(&FileBTN, 0, resource.l_open_w);
  356. SetItemLabel(&FileBTN, 1, resource.l_save);
  357. SetItemLabel(&FileBTN, 3, resource.l_exit);
  358. SetItemLabel(&EditBTN, 0, resource.l_clear);
  359. SetItemLabel(&EditBTN, 1, resource.l_set);
  360. SetItemLabel(&EditBTN, 2, resource.l_reverse);
  361. SetItemLabel(&EditBTN, 3, resource.l_cut);
  362. SetItemLabel(&EditBTN, 4, resource.l_Copy);
  363. SetItemLabel(&EditBTN, 5, resource.l_paste);
  364. SetItemLabel(&EditBTN, 6, resource.l_roll);
  365. SetItemLabel(&EditBTN, 7, resource.l_updown_roll);
  366. SetItemLabel(&EditBTN, 8, resource.l_leftright_roll);
  367. SetItemLabel(&EditBTN, 9, resource.l_undo);
  368. SetItemLabel(&CharBTN, 0, resource.l_manage_w);
  369. SetItemLabel(&CharBTN, 1, resource.l_copy_w);
  370. SetItemLabel(&InfoBTN, 0, resource.l_xlfd);
  371. SetItemLabel(&InfoBTN, 1, resource.l_codearea);
  372. CreateMenuButtons( font_menu, &FileBTN, XtNumber(file_btn));
  373. CreateMenuButtons( edit_menu, &EditBTN, XtNumber(edit_btn));
  374. Unset();
  375. CreateMenuButtons( char_menu, &CharBTN, XtNumber(char_btn));
  376. CreateMenuButtons( info_menu, &InfoBTN, XtNumber(info_btn));
  377. /* create "Character list" */
  378. listFrame =
  379. CreateFrame( baseForm, "listFrame", XmSHADOW_IN, 2);
  380. AddTopAttachForm(listFrame, resource.ed_wge_topoff);
  381. AddLeftAttachForm(listFrame, resource.ed_wge_lftoff);
  382. AddBottomAttachForm(listFrame, resource.ed_wge_btmoff);
  383. listBase =
  384. CreateRowColumn( listFrame, "listFrame", L_VERTICAL, 4, 2, 2);
  385. for( i=0 ; i < edlist.nlist ; i++ ) {
  386. wgeStaT_form[i] = CreateForm( listBase, "listform" );
  387. wgeStaT_list[i] =
  388. CreateLabel( wgeStaT_form[i], "label", "0000" );
  389. wgeStaT_disp[i] = CreateDrawingArea( wgeStaT_form[i], "image",
  390. edg.width, edg.height, EHStaT_disp, i ) ;
  391. AddLeftAttachWidget( wgeStaT_disp[i], wgeStaT_list[i], 0 ) ;
  392. XtAddEventHandler( wgeStaT_list[i],
  393. ButtonPressMask|ButtonReleaseMask,
  394. False, EHeStaT_list, (XtPointer) (intptr_t) i );
  395. XtAddEventHandler( wgeStaT_disp[i],
  396. ButtonPressMask|ButtonReleaseMask,
  397. False, EHeStaT_list, (XtPointer) (intptr_t) i );
  398. if (i==0){
  399. XtVaGetValues(wgeStaT_disp[i],
  400. XmNheight, &(edlist.elem_h),
  401. XmNwidth, &(edlist.elem_w), NULL);
  402. edlist.back = resource.pane_background;
  403. edlist.border = resource.pane_foreground;
  404. dn.elem_h = edlist.elem_h;
  405. dn.elem_w = edlist.elem_w;
  406. /*
  407. */
  408. edpane.pix_w = edpane.width / edg.width;
  409. edpane.pix_h = edpane.height / edg.height;
  410. if(edpane.pix_w > edpane.pix_h)
  411. edpane.pix_w = edpane.pix_h;
  412. else
  413. edpane.pix_h = edpane.pix_w;
  414. /* */
  415. edpane.pix_w = ( edpane.pix_w < 8 ) ? 8 : edpane.pix_w;
  416. edpane.pix_h = ( edpane.pix_h < 8 ) ? 8 : edpane.pix_h;
  417. /*
  418. */
  419. edpane.width = edpane.pix_w * edg.width - 1;
  420. edpane.height = edpane.pix_h * edg.height - 1;
  421. edlist.nlist = (edpane.height +2)/(int)(edlist.elem_h +8);
  422. edlist.nlist =
  423. (edlist.nlist<EDLIST_MAX)?edlist.nlist:EDLIST_MAX;
  424. }
  425. }
  426. XtManageChildren( wgeStaT_form, edlist.nlist );
  427. for( i=0 ; i < edlist.nlist ; i++ ) {
  428. XtManageChild( wgeStaT_list[i] );
  429. XtManageChild( wgeStaT_disp[i] );
  430. }
  431. /* create the scroll bar for Charcter list */
  432. XtVaGetValues( listBase, XmNheight, &(edlist.list_h), NULL);
  433. if (( slimax = efctPtnNum()) < edlist.nlist)
  434. slimax = edlist.nlist;
  435. wgeScro = CreateScrollBar( baseForm, "scrollBar", (edpane.height+2),
  436. edlist.nlist, 0, slimax, CBeScro);
  437. AddLeftAttachWidget( wgeScro, listFrame, 4 );
  438. AddTopAttachForm( wgeScro, resource.ed_wge_topoff );
  439. AddBottomAttachForm( wgeScro, resource.ed_wge_btmoff );
  440. rc =
  441. CreateForm( baseForm, "rc" );
  442. AddTopAttachForm( rc, resource.ed_wge_topoff );
  443. AddRightAttachForm( rc, resource.ed_wge_rghoff );
  444. AddBottomAttachForm( rc, resource.ed_wge_btmoff );
  445. editFrame =
  446. CreateFrame( baseForm, "editFrame", XmSHADOW_IN, 2);
  447. AddTopAttachForm(editFrame, resource.ed_wge_topoff);
  448. AddLeftAttachWidget(editFrame, wgeScro, 4);
  449. AddRightAttachWidget(editFrame, rc, 10);
  450. figure_w =
  451. CreatePixButton(rc, "Draw", &DrawEX);
  452. AddTopAttachForm(figure_w, 0);
  453. AddLeftAttachForm(figure_w, 0);
  454. AddRightAttachForm(figure_w, 0);
  455. imageFrame =
  456. CreateCaptionFrame( rc, "Frame", " ", XmSHADOW_IN, 1);
  457. AddTopAttachWidget(XtParent(imageFrame), figure_w, 4);
  458. AddLeftAttachForm(XtParent(imageFrame), 0);
  459. AddRightAttachForm(XtParent(imageFrame), 0);
  460. AddBottomAttachForm(XtParent(imageFrame), 0);
  461. imageForm =
  462. CreateForm( imageFrame, "separator" );
  463. /* create the Editing pane */
  464. wgeBulB_edit = editPane =
  465. CreateDrawingArea( editFrame, "editPane",
  466. edpane.width, edpane.height, EHeBulB_eExp, 0);
  467. XtAddEventHandler( editPane,
  468. ButtonPressMask | ButtonMotionMask | ButtonReleaseMask,
  469. False, EHeBulB_eMEv, NULL );
  470. AddTopAttachForm( editPane, 2 );
  471. AddLeftAttachForm( editPane, 2 );
  472. /* create character image */
  473. codeLabel = CreateLabel( imageForm, "codeLabel", "0000" );
  474. AddTopAttachForm( codeLabel, 3 );
  475. AddLeftAttachForm( codeLabel, 3 );
  476. wgeBulB_disp = image = CreateDrawingArea( imageForm, "image", edg.width,
  477. edg.height, EHeBulB_dExp, 0);
  478. AddTopAttachWidget( image, codeLabel, 3 );
  479. AddLeftAttachForm( image, 6 );
  480. XtRealizeWidget( editPopW );
  481. return(editPopW);
  482. }
  483. void
  484. SetCodeString(int code)
  485. {
  486. char str[8];
  487. if (! code){
  488. str[0] = '\0';
  489. }
  490. else{
  491. sprintf( str, "%4x:", code );
  492. }
  493. SetLabelString(codeLabel, str);
  494. }
  495. static void
  496. _create_editptn_after(void)
  497. {
  498. int slctloc;
  499. static char dashPtn[] = {1,1}; /* Editing pane's border pattern */
  500. extern void chgEdList();
  501. /*
  502. * set X-library interface
  503. */
  504. xl.display = XtDisplayOfObject( editPopW );
  505. xl.root_winID = RootWindow( xl.display, DefaultScreen(xl.display) );
  506. xl.edit_winID = XtWindow( wgeBulB_edit );
  507. xl.disp_winID = XtWindow( wgeBulB_disp );
  508. xl.list_winID = XtWindow( wgeStaT_disp[0] );
  509. /*
  510. * Graphic Context ( Pixel clear )
  511. */
  512. xl.backGC = XCreateGC( xl.display, xl.root_winID, 0, 0 );
  513. XSetForeground( xl.display, xl.backGC, edpane.back );
  514. XSetBackground( xl.display, xl.backGC, edpane.border );
  515. /*
  516. * Graphic Context ( Pixel set )
  517. */
  518. xl.borderGC = XCreateGC( xl.display, xl.root_winID, 0, 0 );
  519. XSetForeground( xl.display, xl.borderGC, edpane.border );
  520. XSetBackground( xl.display, xl.borderGC, edpane.back );
  521. /*
  522. * Graphic Context ( rubber band )
  523. */
  524. xl.rubGC = XCreateGC( xl.display, xl.root_winID, 0, 0 );
  525. XSetForeground(xl.display, xl.rubGC, edpane.border ^ edpane.back);
  526. XSetFunction ( xl.display, xl.rubGC, GXxor );
  527. /*
  528. * Graphc Context ( lattice of Editing pane )
  529. */
  530. xl.dashGC = XCreateGC( xl.display, xl.root_winID, 0, 0 );
  531. XSetForeground( xl.display, xl.dashGC, edpane.border );
  532. XSetBackground( xl.display, xl.dashGC, edpane.back );
  533. XSetLineAttributes( xl.display, xl.dashGC, 0,
  534. LineDoubleDash, CapButt, JoinMiter );
  535. XSetDashes ( xl.display, xl.dashGC, 0, dashPtn, 2 );
  536. /*
  537. * display Editing pane
  538. */
  539. xl.dispImage = XCreateImage( xl.display,
  540. DefaultVisual( xl.display, DefaultScreen(xl.display) ),
  541. 1, XYBitmap, 0, edg.ptn, edg.width, edg.height, 8, 0 );
  542. xl.dispImage->bitmap_bit_order = MSBFirst;
  543. xl.dispImage->byte_order = MSBFirst;
  544. /*
  545. * initialize
  546. */
  547. edpane.color = ON;
  548. edpane.obj = PROC_POINT;
  549. em.proc = PROC_POINT;
  550. if(efctPtnNum() > 0){
  551. slctloc = 0;
  552. SetCodeString(edg.code);
  553. }
  554. else{
  555. slctloc = -1;
  556. }
  557. chgEdList( 0, slctloc, ON );
  558. }
  559. void
  560. UpdateMessage(String str)
  561. {
  562. static Boolean nomsg = False;
  563. if (! str || ! *str){
  564. if (nomsg){
  565. return;
  566. }
  567. else{
  568. nomsg = True;
  569. }
  570. }
  571. else{
  572. nomsg = False;
  573. }
  574. SetFooterString(FooterMessage, str);
  575. }