home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume19 / xfig / part23 < prev    next >
Encoding:
Text File  |  1993-05-26  |  61.8 KB  |  2,161 lines

  1. Newsgroups: comp.sources.x
  2. From: envbvs@epb9.lbl.gov (Brian V. Smith)
  3. Subject: v19i135:  xfig - Draw amd manipulate objects in an X-Window, Part23/27
  4. Message-ID: <1993May21.021734.7376@sparky.imd.sterling.com>
  5. X-Md4-Signature: ad26ce0899a35778ebe9db5839d2141d
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Fri, 21 May 1993 02:17:34 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: envbvs@epb9.lbl.gov (Brian V. Smith)
  12. Posting-number: Volume 19, Issue 135
  13. Archive-name: xfig/part23
  14. Environment: X11
  15. Supersedes: xfig: Volume 16, Issue 6-30,39
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 23 (of 27)."
  24. # Contents:  w_indpanel.c
  25. # Wrapped by envbvs@epb9.lbl.gov.lbl.gov on Mon May  3 12:06:07 1993
  26. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  27. if test -f 'w_indpanel.c' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'w_indpanel.c'\"
  29. else
  30. echo shar: Extracting \"'w_indpanel.c'\" \(58921 characters\)
  31. sed "s/^X//" >'w_indpanel.c' <<'END_OF_FILE'
  32. X/*
  33. X * FIG : Facility for Interactive Generation of figures
  34. X * Copyright (c) 1991 by Paul King
  35. X *
  36. X * "Permission to use, copy, modify, distribute, and sell this software and its
  37. X * documentation for any purpose is hereby granted without fee, provided that
  38. X * the above copyright notice appear in all copies and that both the copyright
  39. X * notice and this permission notice appear in supporting documentation. 
  40. X * No representations are made about the suitability of this software for 
  41. X * any purpose.  It is provided "as is" without express or implied warranty."
  42. X */
  43. X
  44. X#include "fig.h"
  45. X#include "figx.h"
  46. X#include "resources.h"
  47. X#include "object.h"
  48. X#include "mode.h"
  49. X#include "paintop.h"
  50. X#include "u_fonts.h"
  51. X#include "w_drawprim.h"
  52. X#include "w_icons.h"
  53. X#include "w_indpanel.h"
  54. X#include "w_mousefun.h"
  55. X#include "w_setup.h"
  56. X#include "w_util.h"
  57. X#include "w_zoom.h"
  58. X
  59. Xextern Pixmap    psfont_menu_bitmaps[], latexfont_menu_bitmaps[];
  60. Xextern Atom    wm_delete_window;
  61. Xextern struct    _fstruct ps_fontinfo[], latex_fontinfo[];
  62. Xextern char    *panel_get_value();
  63. Xextern int    show_zoom();
  64. Xextern int    show_depth();
  65. Xextern int    cur_updatemask;
  66. Xextern Widget    make_popup_menu();
  67. X
  68. X/**************        local variables and routines   **************/
  69. X
  70. Xstatic int    cur_anglegeom = L_UNCONSTRAINED;
  71. Xstatic int    cur_indmask = I_MIN1;
  72. Xstatic int    cur_flagshown = 0;
  73. X#define MAX_FLAGS 2 /* maximum value for cur_flagshown */
  74. X
  75. Xstatic String    set_translations = 
  76. X    "<Key>Return: SetValue()";
  77. Xstatic void    nval_panel_set();
  78. Xstatic XtActionsRec set_actions[] =
  79. X{
  80. X    {"SetValue", (XtActionProc) nval_panel_set},
  81. X};
  82. Xstatic String   nval_translations =
  83. X        "<Message>WM_PROTOCOLS: QuitNval()\n";
  84. Xstatic void    nval_panel_cancel();
  85. Xstatic XtActionsRec     nval_actions[] =
  86. X{
  87. X    {"QuitNval", (XtActionProc) nval_panel_cancel},
  88. X};
  89. Xstatic String   choice_translations =
  90. X        "<Message>WM_PROTOCOLS: QuitChoice()\n";
  91. Xstatic void     choice_panel_cancel();
  92. Xstatic XtActionsRec     choice_actions[] =
  93. X{
  94. X    {"QuitChoice", (XtActionProc) choice_panel_cancel},
  95. X};
  96. X
  97. XDeclareStaticArgs(15);
  98. X
  99. X/* declarations for choice buttons */
  100. Xstatic int    inc_choice(), dec_choice();
  101. Xstatic int    show_valign(), show_halign(), show_textjust();
  102. Xstatic int    show_arrowmode(), show_linestyle(), show_anglegeom();
  103. Xstatic int    show_pointposn(), show_gridmode(), show_linkmode();
  104. X
  105. X/* declarations for value buttons */
  106. Xstatic int    show_linewidth(), inc_linewidth(), dec_linewidth();
  107. Xstatic int    show_boxradius(), inc_boxradius(), dec_boxradius();
  108. Xstatic int    show_fillstyle(), darken_fill(), lighten_fill();
  109. Xstatic int    show_color(), next_color(), prev_color();
  110. Xstatic int    show_font(), inc_font(), dec_font();
  111. Xstatic int    show_flags(), inc_flags(), dec_flags();
  112. Xstatic int    show_fontsize(), inc_fontsize(), dec_fontsize();
  113. Xstatic int    show_textstep(), inc_textstep(), dec_textstep();
  114. Xstatic int    inc_zoom(), dec_zoom();
  115. Xstatic int    show_rotnangle(), inc_rotnangle(), dec_rotnangle();
  116. Xstatic int    show_elltextangle(), inc_elltextangle(), dec_elltextangle();
  117. Xstatic int    show_numsides(), inc_numsides(), dec_numsides();
  118. Xstatic int    inc_depth(), dec_depth();
  119. X
  120. Xstatic int    popup_fonts();
  121. Xstatic void    note_state();
  122. X
  123. Xstatic char    indbuf[12];
  124. Xstatic float    old_zoomscale = -1.0;
  125. Xstatic int    old_rotnangle = -1;
  126. Xstatic float    old_elltextangle = -1.0;
  127. X
  128. X#define        DEF_IND_SW_HT        32
  129. X#define        DEF_IND_SW_WD        64
  130. X#define        FONT_IND_SW_WD        (40+PS_FONTPANE_WD)
  131. X#define        NARROW_IND_SW_WD    56
  132. X#define        WIDE_IND_SW_WD        76
  133. X#define        XWIDE_IND_SW_WD        86
  134. X
  135. X/* indicator switch definitions */
  136. X
  137. Xstatic choice_info anglegeom_choices[] = {
  138. X    {L_UNCONSTRAINED, &unconstrained_ic,},
  139. X    {L_LATEXLINE, &latexline_ic,},
  140. X    {L_LATEXARROW, &latexarrow_ic,},
  141. X    {L_MOUNTHATTAN, &mounthattan_ic,},
  142. X    {L_MANHATTAN, &manhattan_ic,},
  143. X    {L_MOUNTAIN, &mountain_ic,},
  144. X};
  145. X
  146. X#define NUM_ANGLEGEOM_CHOICES (sizeof(anglegeom_choices)/sizeof(choice_info))
  147. X
  148. Xstatic choice_info valign_choices[] = {
  149. X    {NONE, &none_ic,},
  150. X    {TOP, &valignt_ic,},
  151. X    {CENTER, &valignc_ic,},
  152. X    {BOTTOM, &valignb_ic,},
  153. X};
  154. X
  155. X#define NUM_VALIGN_CHOICES (sizeof(valign_choices)/sizeof(choice_info))
  156. X
  157. Xstatic choice_info halign_choices[] = {
  158. X    {NONE, &none_ic,},
  159. X    {LEFT, &halignl_ic,},
  160. X    {CENTER, &halignc_ic,},
  161. X    {RIGHT, &halignr_ic,},
  162. X};
  163. X
  164. X#define NUM_HALIGN_CHOICES (sizeof(halign_choices)/sizeof(choice_info))
  165. X
  166. Xstatic choice_info gridmode_choices[] = {
  167. X    {GRID_0, &none_ic,},
  168. X    {GRID_1, &grid1_ic,},
  169. X    {GRID_2, &grid2_ic,},
  170. X};
  171. X
  172. X#define NUM_GRIDMODE_CHOICES (sizeof(gridmode_choices)/sizeof(choice_info))
  173. X
  174. Xstatic choice_info pointposn_choices[] = {
  175. X    {P_ANY, &any_ic,},
  176. X    {P_MAGNET, &fine_grid_ic,},
  177. X    {P_GRID1, &grid1_ic,},
  178. X    {P_GRID2, &grid2_ic,},
  179. X};
  180. X
  181. X#define NUM_POINTPOSN_CHOICES (sizeof(pointposn_choices)/sizeof(choice_info))
  182. X
  183. Xstatic choice_info arrowmode_choices[] = {
  184. X    {L_NOARROWS, &noarrows_ic,},
  185. X    {L_FARROWS, &farrows_ic,},
  186. X    {L_FBARROWS, &fbarrows_ic,},
  187. X    {L_BARROWS, &barrows_ic,},
  188. X};
  189. X
  190. X#define NUM_ARROWMODE_CHOICES (sizeof(arrowmode_choices)/sizeof(choice_info))
  191. X
  192. Xstatic choice_info textjust_choices[] = {
  193. X    {T_LEFT_JUSTIFIED, &textL_ic,},
  194. X    {T_CENTER_JUSTIFIED, &textC_ic,},
  195. X    {T_RIGHT_JUSTIFIED, &textR_ic,},
  196. X};
  197. X
  198. X#define NUM_TEXTJUST_CHOICES (sizeof(textjust_choices)/sizeof(choice_info))
  199. X
  200. Xstatic choice_info linestyle_choices[] = {
  201. X    {SOLID_LINE, &solidline_ic,},
  202. X    {DASH_LINE, &dashline_ic,},
  203. X    {DOTTED_LINE, &dottedline_ic,},
  204. X};
  205. X
  206. X#define NUM_LINESTYLE_CHOICES (sizeof(linestyle_choices)/sizeof(choice_info))
  207. X
  208. Xstatic choice_info linkmode_choices[] = {
  209. X    {SMART_OFF, &smartoff_ic,},
  210. X    {SMART_MOVE, &smartmove_ic,},
  211. X    {SMART_SLIDE, &smartslide_ic,},
  212. X};
  213. X
  214. X#define NUM_LINKMODE_CHOICES (sizeof(linkmode_choices)/sizeof(choice_info))
  215. X
  216. Xchoice_info    fillstyle_choices[NUMFILLPATS + 1];
  217. X
  218. Xchoice_info    color_choices[NUMCOLORS + 1];
  219. Xstatic ind_sw_info *fill_style_sw;
  220. X
  221. X#define I_CHOICE    0
  222. X#define I_IVAL        1
  223. X#define I_FVAL        2
  224. X
  225. X#define        inc_action(z)    (z->inc_func)(z)
  226. X#define        dec_action(z)    (z->dec_func)(z)
  227. X#define        show_action(z)    (z->show_func)(z)
  228. X
  229. Xind_sw_info    ind_switches[] = {
  230. X    {I_FVAL, I_ZOOM, "Zoom", "Scale", NARROW_IND_SW_WD,
  231. X    NULL, &zoomscale, inc_zoom, dec_zoom, show_zoom,},
  232. X    {I_CHOICE, I_GRIDMODE, "Grid", "Mode", DEF_IND_SW_WD,
  233. X    &cur_gridmode, NULL, inc_choice, dec_choice, show_gridmode,
  234. X    gridmode_choices, NUM_GRIDMODE_CHOICES, NUM_GRIDMODE_CHOICES,},
  235. X    {I_CHOICE, I_POINTPOSN, "Point", "Posn", DEF_IND_SW_WD,
  236. X    &cur_pointposn, NULL, inc_choice, dec_choice, show_pointposn,
  237. X    pointposn_choices, NUM_POINTPOSN_CHOICES, NUM_POINTPOSN_CHOICES,},
  238. X    {I_IVAL, I_DEPTH, "Depth", "", NARROW_IND_SW_WD,
  239. X    &cur_depth, NULL, inc_depth, dec_depth, show_depth,},
  240. X    {I_IVAL, I_ROTNANGLE, "Rotn", "Angle", NARROW_IND_SW_WD,
  241. X    &cur_rotnangle, NULL, inc_rotnangle, dec_rotnangle, show_rotnangle,},
  242. X    {I_IVAL, I_NUMSIDES, "Num", "Sides", NARROW_IND_SW_WD,
  243. X    &cur_numsides, NULL, inc_numsides, dec_numsides, show_numsides,},
  244. X    {I_CHOICE, I_VALIGN, "Vert", "Align", DEF_IND_SW_WD,
  245. X    &cur_valign, NULL, inc_choice, dec_choice, show_valign,
  246. X    valign_choices, NUM_VALIGN_CHOICES, NUM_VALIGN_CHOICES,},
  247. X    {I_CHOICE, I_HALIGN, "Horiz", "Align", DEF_IND_SW_WD,
  248. X    &cur_halign, NULL, inc_choice, dec_choice, show_halign,
  249. X    halign_choices, NUM_HALIGN_CHOICES, NUM_HALIGN_CHOICES,},
  250. X    {I_CHOICE, I_ANGLEGEOM, "Angle", "Geom", DEF_IND_SW_WD,
  251. X    &cur_anglegeom, NULL, inc_choice, dec_choice, show_anglegeom,
  252. X    anglegeom_choices, NUM_ANGLEGEOM_CHOICES, NUM_ANGLEGEOM_CHOICES / 2,},
  253. X    {I_CHOICE, I_FILLSTYLE, "Fill", "Style", DEF_IND_SW_WD,
  254. X    &cur_fillstyle, NULL, darken_fill, lighten_fill, show_fillstyle,
  255. X    fillstyle_choices, NUMFILLPATS + 1, (NUMFILLPATS + 1) / 2},
  256. X    {I_CHOICE, I_COLOR, "Color", "", WIDE_IND_SW_WD,
  257. X    (int *) &cur_color, NULL, next_color, prev_color, show_color,
  258. X    color_choices, NUMCOLORS + 1, (NUMCOLORS + 1) / 2},
  259. X    {I_CHOICE, I_LINKMODE, "Smart", "Links", DEF_IND_SW_WD,
  260. X    &cur_linkmode, NULL, inc_choice, dec_choice, show_linkmode,
  261. X    linkmode_choices, NUM_LINKMODE_CHOICES, NUM_LINKMODE_CHOICES},
  262. X    {I_IVAL, I_LINEWIDTH, "Line", "Width", NARROW_IND_SW_WD,
  263. X    &cur_linewidth, NULL, inc_linewidth, dec_linewidth, show_linewidth,},
  264. X    {I_CHOICE, I_LINESTYLE, "Line", "Style", DEF_IND_SW_WD,
  265. X    &cur_linestyle, NULL, inc_choice, dec_choice, show_linestyle,
  266. X    linestyle_choices, NUM_LINESTYLE_CHOICES, NUM_LINESTYLE_CHOICES,},
  267. X    {I_IVAL, I_BOXRADIUS, "Box", "Curve", DEF_IND_SW_WD,
  268. X    &cur_boxradius, NULL, inc_boxradius, dec_boxradius, show_boxradius,},
  269. X    {I_CHOICE, I_ARROWMODE, "Arrow", "Mode", DEF_IND_SW_WD,
  270. X    &cur_arrowmode, NULL, inc_choice, dec_choice, show_arrowmode,
  271. X    arrowmode_choices, NUM_ARROWMODE_CHOICES, NUM_ARROWMODE_CHOICES,},
  272. X    {I_CHOICE, I_TEXTJUST, "Text", "Just", DEF_IND_SW_WD,
  273. X    &cur_textjust, NULL, inc_choice, dec_choice, show_textjust,
  274. X    textjust_choices, NUM_TEXTJUST_CHOICES, NUM_TEXTJUST_CHOICES,},
  275. X    {I_FVAL, I_ELLTEXTANGLE, "Text/Ellipse", "Angle", XWIDE_IND_SW_WD,
  276. X    NULL, &cur_elltextangle, inc_elltextangle, dec_elltextangle, 
  277. X    show_elltextangle,},
  278. X    {I_IVAL, I_TEXTFLAGS, "Text Flags", "", WIDE_IND_SW_WD,
  279. X    &cur_fontsize, NULL, inc_flags, dec_flags, show_flags,},
  280. X    {I_IVAL, I_FONTSIZE, "Text", "Size", NARROW_IND_SW_WD,
  281. X    &cur_fontsize, NULL, inc_fontsize, dec_fontsize, show_fontsize,},
  282. X    {I_FVAL, I_TEXTSTEP, "Text", "Step", NARROW_IND_SW_WD,
  283. X    NULL, &cur_textstep, inc_textstep, dec_textstep, show_textstep,},
  284. X    {I_IVAL, I_FONT, "Text", "Font", FONT_IND_SW_WD,
  285. X    &cur_ps_font, NULL, inc_font, dec_font, show_font,},
  286. X};
  287. X
  288. X#define        NUM_IND_SW    (sizeof(ind_switches) / sizeof(ind_sw_info))
  289. X
  290. Xstatic Arg    button_args[] =
  291. X{
  292. X     /* 0 */ {XtNlabel, (XtArgVal) "        "},
  293. X     /* 1 */ {XtNwidth, (XtArgVal) 0},
  294. X     /* 2 */ {XtNheight, (XtArgVal) 0},
  295. X     /* 3 */ {XtNresizable, (XtArgVal) False},
  296. X     /* 4 */ {XtNborderWidth, (XtArgVal) 0},
  297. X     /* 5 */ {XtNresize, (XtArgVal) False},    /* keeps buttons from being
  298. X                         * resized when there are not
  299. X                         * a multiple of three of
  300. X                         * them */
  301. X     /* 6 */ {XtNbackgroundPixmap, (XtArgVal) NULL},
  302. X};
  303. X
  304. X/* button selection event handler */
  305. Xstatic void    sel_ind_but();
  306. X
  307. X/* arguments for the update indicator boxes in the indicator buttons */
  308. X
  309. Xstatic Arg    upd_args[] = 
  310. X{
  311. X    /* 0 */ {XtNwidth, (XtArgVal) 8},
  312. X    /* 1 */ {XtNheight, (XtArgVal) 8},
  313. X    /* 2 */ {XtNborderWidth, (XtArgVal) 1},
  314. X    /* 3 */ {XtNtop, XtChainTop},
  315. X    /* 4 */ {XtNright, XtChainRight},
  316. X    /* 5 */ {XtNstate, (XtArgVal) True},
  317. X    /* 6 */ {XtNvertDistance, (XtArgVal) 0},
  318. X    /* 7 */ {XtNhorizDistance, (XtArgVal) 0},
  319. X    /* 8 */ {XtNlabel, (XtArgVal) " "},
  320. X    /* 9 */ {XtNhighlightThickness, (XtArgVal) 0},
  321. X};
  322. X
  323. Xstatic XtActionsRec ind_actions[] =
  324. X{
  325. X    {"EnterIndSw", (XtActionProc) draw_mousefun_ind},
  326. X    {"LeaveIndSw", (XtActionProc) clear_mousefun},
  327. X};
  328. X
  329. Xstatic String    ind_translations =
  330. X"<EnterWindow>:EnterIndSw()highlight()\n\
  331. X    <LeaveWindow>:LeaveIndSw()unhighlight()\n";
  332. X
  333. Xinit_ind_panel(tool)
  334. X    TOOL        tool;
  335. X{
  336. X    int        i;
  337. X    ind_sw_info    *sw;
  338. X
  339. X    /* does he want to always see ALL of the indicator buttons? */
  340. X    if (appres.ShowAllButtons) {
  341. X    cur_indmask = I_ALL;    /* yes */
  342. X    i = 2*DEF_IND_SW_HT+2*INTERNAL_BW+6;  /* two rows high when showing all buttons */
  343. X    } else {
  344. X    i = DEF_IND_SW_HT+4*INTERNAL_BW+14;   /* allow for thickness of scrollbar */
  345. X    }
  346. X
  347. X    /* make a scrollable viewport in case all the buttons don't fit */
  348. X    FirstArg(XtNallowHoriz, True);
  349. X    NextArg(XtNwidth, INDPANEL_WD);
  350. X    NextArg(XtNheight, i);
  351. X    NextArg(XtNborderWidth, 0);
  352. X    NextArg(XtNresizable, False);
  353. X    NextArg(XtNfromVert, canvas_sw);
  354. X    NextArg(XtNvertDistance, -INTERNAL_BW);
  355. X    NextArg(XtNtop, XtChainBottom);
  356. X    NextArg(XtNbottom, XtChainBottom);
  357. X    NextArg(XtNleft, XtChainLeft);
  358. X    NextArg(XtNright, XtChainRight);
  359. X    NextArg(XtNuseBottom, True);
  360. X
  361. X    ind_viewp = XtCreateWidget("ind_viewport", viewportWidgetClass, tool,
  362. X            Args, ArgCount);
  363. X
  364. X    FirstArg(XtNwidth, INDPANEL_WD);
  365. X    NextArg(XtNheight, i);
  366. X    NextArg(XtNhSpace, 0);
  367. X    NextArg(XtNvSpace, 0);
  368. X    NextArg(XtNresizable, True);
  369. X    NextArg(XtNborderWidth, 0);
  370. X    if (appres.ShowAllButtons) {
  371. X    NextArg(XtNorientation, XtorientVertical);    /* use two rows */
  372. X    } else {
  373. X    NextArg(XtNorientation, XtorientHorizontal);    /* expand horizontally */
  374. X    }
  375. X
  376. X    ind_panel = XtCreateManagedWidget("ind_panel", boxWidgetClass, ind_viewp,
  377. X                   Args, ArgCount);
  378. X
  379. X    /* start with all components affected by update */
  380. X    cur_updatemask = I_UPDATEMASK;
  381. X
  382. X    XtAppAddActions(tool_app, ind_actions, XtNumber(ind_actions));
  383. X
  384. X    for (i = 0; i < NUM_IND_SW; ++i) {
  385. X    sw = &ind_switches[i];
  386. X
  387. X    FirstArg(XtNwidth, sw->sw_width);
  388. X    NextArg(XtNheight, DEF_IND_SW_HT);
  389. X    NextArg(XtNdefaultDistance, 0);
  390. X    NextArg(XtNborderWidth, INTERNAL_BW);
  391. X    sw->formw = XtCreateWidget("button_form", formWidgetClass,
  392. X                 ind_panel, Args, ArgCount);
  393. X
  394. X    /* make an update button in the upper-right corner of the main button */
  395. X    if (sw->func & I_UPDATEMASK)
  396. X        {
  397. X        upd_args[7].value = sw->sw_width
  398. X                    - upd_args[0].value
  399. X                    - 2*upd_args[2].value;
  400. X        sw->updbut = XtCreateWidget("update", toggleWidgetClass,
  401. X                 sw->formw, upd_args, XtNumber(upd_args));
  402. X        sw->update = True;
  403. X        XtAddEventHandler(sw->updbut, ButtonReleaseMask, (Boolean) 0,
  404. X                 note_state, (XtPointer) sw);
  405. X        }
  406. X
  407. X    /* now create the command button */
  408. X    button_args[1].value = sw->sw_width;
  409. X    button_args[2].value = DEF_IND_SW_HT;
  410. X    sw->button = XtCreateManagedWidget("button", commandWidgetClass,
  411. X                 sw->formw, button_args, XtNumber(button_args));
  412. X    /* map this button if it is needed */
  413. X    if (sw->func & cur_indmask)
  414. X        XtManageChild(sw->formw);
  415. X
  416. X    /* allow left & right buttons */
  417. X    /* (callbacks pass same data for ANY button) */
  418. X    XtAddEventHandler(sw->button, ButtonReleaseMask, (Boolean) 0,
  419. X              sel_ind_but, (XtPointer) sw);
  420. X    XtOverrideTranslations(sw->button,
  421. X                   XtParseTranslationTable(ind_translations));
  422. X    }
  423. X    update_indpanel(cur_indmask);
  424. X}
  425. X
  426. Xstatic void
  427. Xnote_state(w, closure, ev, continue_to_dispatch)
  428. X    Widget        w;
  429. X    XtPointer        closure;
  430. X    XEvent         *ev;
  431. X    Boolean        *continue_to_dispatch;
  432. X
  433. X{
  434. X    ind_sw_info *sw = (ind_sw_info *) closure;
  435. X    XButtonEvent *event = &ev->xbutton;
  436. X
  437. X    if (event->button != Button1)
  438. X    return;
  439. X
  440. X    /* toggle update status of this indicator */
  441. X    sw->update = !sw->update;
  442. X    if (sw->update)
  443. X    cur_updatemask |= sw->func;    /* turn on update status */
  444. X    else
  445. X    cur_updatemask &= ~sw->func;    /* turn off update status */
  446. X}
  447. X
  448. Xmanage_update_buts()
  449. X{
  450. X    int            i;
  451. X    for (i = 0; i < NUM_IND_SW; ++i)
  452. X    if (ind_switches[i].func & I_UPDATEMASK)
  453. X        XtManageChild(ind_switches[i].updbut);
  454. X}
  455. X        
  456. Xunmanage_update_buts()
  457. X{
  458. X    int            i;
  459. X    for (i = 0; i < NUM_IND_SW; ++i)
  460. X    if (ind_switches[i].func & I_UPDATEMASK)
  461. X        XtUnmanageChild(ind_switches[i].updbut);
  462. X}
  463. X        
  464. Xsetup_ind_panel()
  465. X{
  466. X    int            i;
  467. X    ind_sw_info       *isw;
  468. X    Display       *d = tool_d;
  469. X    Screen       *s = tool_s;
  470. X    Pixmap        p;
  471. X
  472. X    /* get the foreground and background from the indicator widget */
  473. X    /* and create a gc with those values */
  474. X    ind_button_gc = XCreateGC(tool_d, XtWindow(ind_panel), (unsigned long) 0, NULL);
  475. X    FirstArg(XtNforeground, &ind_but_fg);
  476. X    NextArg(XtNbackground, &ind_but_bg);
  477. X    GetValues(ind_switches[0].button);
  478. X    XSetBackground(tool_d, ind_button_gc, ind_but_bg);
  479. X    XSetForeground(tool_d, ind_button_gc, ind_but_fg);
  480. X    XSetFont(tool_d, ind_button_gc, button_font->fid);
  481. X
  482. X    /* also create gc with fore=background for blanking areas */
  483. X    ind_blank_gc = XCreateGC(tool_d, XtWindow(ind_panel), (unsigned long) 0, NULL);
  484. X    XSetBackground(tool_d, ind_blank_gc, ind_but_bg);
  485. X    XSetForeground(tool_d, ind_blank_gc, ind_but_bg);
  486. X
  487. X    /* create a gc for the color 'palette' */
  488. X    color_gc = XCreateGC(tool_d, XtWindow(ind_panel), (unsigned long) 0, NULL);
  489. X
  490. X    /* initialize the fill style gc and pixmaps */
  491. X    init_fill_pm();
  492. X    init_fill_gc();
  493. X
  494. X    FirstArg(XtNbackgroundPixmap, fillstyle_choices[NUMFILLPATS].blackPM);
  495. X    SetValues(ind_viewp);
  496. X
  497. X    for (i = 0; i < NUM_IND_SW; ++i) {
  498. X    isw = &ind_switches[i];
  499. X    if (ind_switches[i].func == I_FILLSTYLE)
  500. X        fill_style_sw = isw;
  501. X
  502. X    p = XCreatePixmap(d, XtWindow(isw->button), isw->sw_width,
  503. X              DEF_IND_SW_HT, DefaultDepthOfScreen(s));
  504. X    XFillRectangle(d, p, ind_blank_gc, 0, 0,
  505. X               isw->sw_width, DEF_IND_SW_HT);
  506. X    XDrawImageString(d, p, ind_button_gc, 3, 12, isw->line1, strlen(isw->line1));
  507. X    XDrawImageString(d, p, ind_button_gc, 3, 25, isw->line2, strlen(isw->line2));
  508. X
  509. X    isw->normalPM = button_args[6].value = (XtArgVal) p;
  510. X    XtSetValues(isw->button, &button_args[6], 1);
  511. X    XtInstallAllAccelerators(isw->button, tool);
  512. X    }
  513. X    XtInstallAllAccelerators(ind_panel, tool);
  514. X
  515. X    XDefineCursor(d, XtWindow(ind_panel), arrow_cursor);
  516. X    update_current_settings();
  517. X
  518. X    FirstArg(XtNmappedWhenManaged, True);
  519. X    SetValues(ind_panel);
  520. X}
  521. X
  522. Xupdate_indpanel(mask)
  523. X    int            mask;
  524. X{
  525. X    register int    i;
  526. X    register ind_sw_info *isw;
  527. X
  528. X    /* only update current mask if user wants to see relevant ind buttons */
  529. X    if (appres.ShowAllButtons)
  530. X    return;
  531. X
  532. X    cur_indmask = mask;
  533. X    XtUnmanageChild(ind_panel);
  534. X    for (isw = ind_switches, i = 0; i < NUM_IND_SW; isw++, i++) {
  535. X    if (isw->func & cur_indmask) {
  536. X        XtManageChild(isw->formw);
  537. X    } else {
  538. X        XtUnmanageChild(isw->formw);
  539. X    }
  540. X    }
  541. X    XtManageChild(ind_panel);
  542. X}
  543. X
  544. X/* come here when a button is pressed in the indicator panel */
  545. X
  546. Xstatic void
  547. Xsel_ind_but(widget, closure, event, continue_to_dispatch)
  548. X    Widget        widget;
  549. X    XtPointer        closure;
  550. X    XEvent*        event;
  551. X    Boolean*        continue_to_dispatch;
  552. X{
  553. X    XButtonEvent xbutton;
  554. X    ind_sw_info *isw = (ind_sw_info *) closure;
  555. X    xbutton = event->xbutton;
  556. X    if ((xbutton.button == Button2)  ||
  557. X              (xbutton.button == Button3 && xbutton.state & Mod1Mask)) { /* middle button */
  558. X    dec_action(isw);
  559. X    } else if (xbutton.button == Button3) {    /* right button */
  560. X    inc_action(isw);
  561. X    } else {            /* left button */
  562. X    if (isw->func == I_FONT)
  563. X        popup_fonts(isw);
  564. X    else if (isw->func == I_TEXTFLAGS)
  565. X        popup_flags_panel(isw);
  566. X    else if (isw->type == I_IVAL || isw->type == I_FVAL)
  567. X        popup_nval_panel(isw);
  568. X    else if (isw->type == I_CHOICE)
  569. X        popup_choice_panel(isw);
  570. X    }
  571. X}
  572. X
  573. Xstatic
  574. Xupdate_string_pixmap(isw, buf, xpos, ypos)
  575. X    ind_sw_info       *isw;
  576. X    char       *buf;
  577. X    int            xpos, ypos;
  578. X{
  579. X    XDrawImageString(tool_d, isw->normalPM, ind_button_gc,
  580. X             xpos, ypos, buf, strlen(buf));
  581. X    /*
  582. X     * Fool the toolkit by changing the background pixmap to 0 then giving it
  583. X     * the modified one again.    Otherwise, it sees that the pixmap ID is not
  584. X     * changed and doesn't actually draw it into the widget window
  585. X     */
  586. X    button_args[6].value = 0;
  587. X    XtSetValues(isw->button, &button_args[6], 1);
  588. X
  589. X    /* put the pixmap in the widget background */
  590. X    button_args[6].value = isw->normalPM;
  591. X    XtSetValues(isw->button, &button_args[6], 1);
  592. X}
  593. X
  594. Xstatic
  595. Xupdate_choice_pixmap(isw, mode)
  596. X    ind_sw_info       *isw;
  597. X    int            mode;
  598. X{
  599. X    choice_info       *tmp_choice;
  600. X    register Pixmap p;
  601. X
  602. X    /* put the pixmap in the widget background */
  603. X    p = isw->normalPM;
  604. X    tmp_choice = isw->choices + mode;
  605. X    XPutImage(tool_d, p, ind_button_gc, tmp_choice->icon, 0, 0, 32, 0, 32, 32);
  606. X    /*
  607. X     * Fool the toolkit by changing the background pixmap to 0 then giving it
  608. X     * the modified one again.    Otherwise, it sees that the pixmap ID is not
  609. X     * changed and doesn't actually draw it into the widget window
  610. X     */
  611. X    button_args[6].value = 0;
  612. X    XtSetValues(isw->button, &button_args[6], 1);
  613. X    button_args[6].value = p;
  614. X    XtSetValues(isw->button, &button_args[6], 1);
  615. X}
  616. X
  617. X/********************************************************
  618. X
  619. X    auxiliary functions
  620. X
  621. X********************************************************/
  622. X
  623. Xstatic Widget    choice_popup;
  624. Xstatic ind_sw_info *choice_i;
  625. Xstatic Widget    nval_popup, form, cancel, set, beside, below, newvalue,
  626. X        label;
  627. Xstatic Widget    dash_length, dot_gap;
  628. Xstatic ind_sw_info *nval_i;
  629. X
  630. X/* handle choice settings */
  631. X
  632. Xstatic void
  633. Xchoice_panel_dismiss()
  634. X{
  635. X    XtDestroyWidget(choice_popup);
  636. X    XtSetSensitive(choice_i->button, True);
  637. X}
  638. X
  639. Xstatic void
  640. Xchoice_panel_cancel(w, ev)
  641. X    Widget        w;
  642. X    XButtonEvent   *ev;
  643. X{
  644. X    choice_panel_dismiss();
  645. X}
  646. X
  647. Xstatic void
  648. Xchoice_panel_set(w, sel_choice, ev)
  649. X    Widget        w;
  650. X    choice_info       *sel_choice;
  651. X    XButtonEvent   *ev;
  652. X{
  653. X    (*choice_i->i_varadr) = sel_choice->value;
  654. X    show_action(choice_i);
  655. X
  656. X    /* auxiliary info */
  657. X    switch (choice_i->func) {
  658. X    case I_LINESTYLE:
  659. X    /* dash length */
  660. X    cur_dashlength = (float) atof(panel_get_value(dash_length));
  661. X    if (cur_dashlength <= 0.0)
  662. X        cur_dashlength = DEF_DASHLENGTH;
  663. X    /* dot gap */
  664. X    cur_dotgap = (float) atof(panel_get_value(dot_gap));
  665. X    if (cur_dotgap <= 0.0)
  666. X        cur_dotgap = DEF_DOTGAP;
  667. X    break;
  668. X    }
  669. X
  670. X    choice_panel_dismiss();
  671. X}
  672. X
  673. Xpopup_choice_panel(isw)
  674. X    ind_sw_info       *isw;
  675. X{
  676. X    Position        x_val, y_val;
  677. X    Dimension        width, height;
  678. X    char        buf[32];
  679. X    choice_info       *tmp_choice;
  680. X    Pixmap        p;
  681. X    Pixel        form_fg;
  682. X    register int    i;
  683. X    static int      actions_added=0;
  684. X
  685. X    choice_i = isw;
  686. X    XtSetSensitive(choice_i->button, False);
  687. X
  688. X    FirstArg(XtNwidth, &width);
  689. X    NextArg(XtNheight, &height);
  690. X    GetValues(tool);
  691. X    /* position the popup 1/3 in from left and 2/3 down from top */
  692. X    XtTranslateCoords(tool, (Position) (width / 3), (Position) (2 * height / 3),
  693. X              &x_val, &y_val);
  694. X
  695. X    FirstArg(XtNx, x_val);
  696. X    NextArg(XtNy, y_val);
  697. X    NextArg(XtNresize, False);
  698. X    NextArg(XtNresizable, False);
  699. X    NextArg(XtNtitle, "Xfig: Set indicator panel");
  700. X
  701. X    choice_popup = XtCreatePopupShell("xfig_set_indicator_panel",
  702. X                      transientShellWidgetClass, tool,
  703. X                      Args, ArgCount);
  704. X    XtOverrideTranslations(choice_popup,
  705. X                       XtParseTranslationTable(choice_translations));
  706. X    if (!actions_added) {
  707. X        XtAppAddActions(tool_app, choice_actions, XtNumber(choice_actions));
  708. X    actions_added = 1;
  709. X    }
  710. X
  711. X    form = XtCreateManagedWidget("form", formWidgetClass, choice_popup, NULL, 0);
  712. X
  713. X    FirstArg(XtNborderWidth, 0);
  714. X    sprintf(buf, "%s %s", isw->line1, isw->line2);
  715. X    label = XtCreateManagedWidget(buf, labelWidgetClass, form, Args, ArgCount);
  716. X
  717. X    FirstArg(XtNlabel, "cancel");
  718. X    NextArg(XtNfromVert, label);
  719. X    NextArg(XtNresize, False);
  720. X    NextArg(XtNresizable, False);
  721. X    NextArg(XtNheight, 32);
  722. X    NextArg(XtNborderWidth, INTERNAL_BW);
  723. X    cancel = XtCreateManagedWidget("cancel", commandWidgetClass,
  724. X                   form, Args, ArgCount);
  725. X    XtAddEventHandler(cancel, ButtonReleaseMask, (Boolean) 0,
  726. X              (XtEventHandler)choice_panel_cancel, (XtPointer) NULL);
  727. X
  728. X    tmp_choice = isw->choices;
  729. X
  730. X    for (i = 0; i < isw->numchoices; tmp_choice++, i++) {
  731. X    if (isw->func == I_FILLSTYLE)
  732. X        p = ((cur_color==BLACK || cur_color==DEFAULT_COLOR ||
  733. X         (!all_colors_available && cur_color!=WHITE))?
  734. X        fillstyle_choices[i].blackPM :fillstyle_choices[i].normalPM);
  735. X    else if (isw->func == I_COLOR) {
  736. X        p = 0;
  737. X        tmp_choice->value = (i >= NUMCOLORS ? DEFAULT_COLOR : i);
  738. X    } else
  739. X        p = XCreatePixmapFromBitmapData(tool_d, XtWindow(ind_panel),
  740. X                (char *) tmp_choice->icon->data, tmp_choice->icon->width,
  741. X               tmp_choice->icon->height, ind_but_fg, ind_but_bg,
  742. X                        DefaultDepthOfScreen(tool_s));
  743. X    if (i % isw->sw_per_row == 0) {
  744. X        if (i == 0)
  745. X        below = label;
  746. X        else
  747. X        below = beside;
  748. X        beside = cancel;
  749. X    }
  750. X    FirstArg(XtNfromVert, below);
  751. X    NextArg(XtNfromHoriz, beside);
  752. X    if (isw->func != I_COLOR) {
  753. X        NextArg(XtNbackgroundPixmap, p);
  754. X        NextArg(XtNwidth, tmp_choice->icon->width);
  755. X        NextArg(XtNheight, tmp_choice->icon->height);
  756. X    } else {        /* Color popup menu */
  757. X        NextArg(XtNheight, 32);
  758. X        NextArg(XtNwidth, 64);
  759. X        if (i < NUMCOLORS && i >= 0) {    /* it's a proper color */
  760. X        if (all_colors_available) {
  761. X            XColor        col;
  762. X
  763. X            col.pixel = appres.color[i];
  764. X            XQueryColor(tool_d, DefaultColormapOfScreen(tool_s), &col);
  765. X            if ((0.3 * col.red + 0.59 * col.green + 0.11 * col.blue) < 0.5 * (255 << 8))
  766. X            form_fg = appres.color[WHITE];
  767. X            else
  768. X            form_fg = appres.color[BLACK];
  769. X            NextArg(XtNforeground, form_fg);
  770. X            NextArg(XtNbackground, appres.color[i]);
  771. X        }
  772. X        NextArg(XtNlabel, colorNames[i + 1]);
  773. X        } else {        /* it's the default color */
  774. X        NextArg(XtNforeground, x_fg_color.pixel);
  775. X        NextArg(XtNlabel, colorNames[0]);
  776. X        }
  777. X    }
  778. X    NextArg(XtNresize, False);
  779. X    NextArg(XtNresizable, False);
  780. X    NextArg(XtNborderWidth, INTERNAL_BW);
  781. X    beside = XtCreateManagedWidget(" ", commandWidgetClass,
  782. X                       form, Args, ArgCount);
  783. X    XtAddEventHandler(beside, ButtonReleaseMask, (Boolean) 0,
  784. X              (XtEventHandler)choice_panel_set, (XtPointer) tmp_choice);
  785. X    }
  786. X
  787. X    /* auxiliary info */
  788. X    switch (isw->func) {
  789. X    case I_LINESTYLE:
  790. X    /* dash length */
  791. X    FirstArg(XtNfromVert, beside);
  792. X    NextArg(XtNborderWidth, 0);
  793. X    NextArg(XtNlabel, "Default dash length =");
  794. X    label = XtCreateManagedWidget("default_dash_length",
  795. X                    labelWidgetClass, form, Args, ArgCount);
  796. X    sprintf(buf, "%1.1f", cur_dashlength);
  797. X    FirstArg(XtNfromVert, beside);
  798. X    NextArg(XtNborderWidth, INTERNAL_BW);
  799. X    NextArg(XtNfromHoriz, label);
  800. X    NextArg(XtNstring, buf);
  801. X    NextArg(XtNinsertPosition, strlen(buf));
  802. X    NextArg(XtNeditType, "append");
  803. X    NextArg(XtNwidth, 40);
  804. X    dash_length = XtCreateManagedWidget(buf, asciiTextWidgetClass,
  805. X                        form, Args, ArgCount);
  806. X    /* dot gap */
  807. X    FirstArg(XtNfromVert, dash_length);
  808. X    NextArg(XtNborderWidth, 0);
  809. X    NextArg(XtNlabel, "    Default dot gap =");
  810. X    label = XtCreateManagedWidget("default_dot_gap",
  811. X                    labelWidgetClass, form, Args, ArgCount);
  812. X    sprintf(buf, "%1.1f", cur_dotgap);
  813. X    FirstArg(XtNfromVert, dash_length);
  814. X    NextArg(XtNborderWidth, INTERNAL_BW);
  815. X    NextArg(XtNfromHoriz, label);
  816. X    NextArg(XtNstring, buf);
  817. X    NextArg(XtNinsertPosition, strlen(buf));
  818. X    NextArg(XtNeditType, "append");
  819. X    NextArg(XtNwidth, 40);
  820. X    dot_gap = XtCreateManagedWidget(buf, asciiTextWidgetClass,
  821. X                    form, Args, ArgCount);
  822. X    break;
  823. X    }
  824. X
  825. X    XtPopup(choice_popup, XtGrabExclusive);
  826. X    (void) XSetWMProtocols(XtDisplay(choice_popup), XtWindow(choice_popup),
  827. X                           &wm_delete_window, 1);
  828. X
  829. X}
  830. X
  831. X/* handle text flag settings */
  832. X
  833. Xstatic int      hidden_text_flag, special_text_flag, rigid_text_flag;
  834. Xstatic Widget   hidden_text_panel, rigid_text_panel, special_text_panel;
  835. Xstatic Widget   hidden_text_menu, special_text_menu, rigid_text_menu;
  836. X
  837. Xstatic void
  838. Xflags_panel_dismiss()
  839. X{
  840. X    XtDestroyWidget(nval_popup);
  841. X    XtSetSensitive(nval_i->button, True);
  842. X}
  843. X
  844. Xstatic void
  845. Xflags_panel_cancel(w, ev)
  846. X    Widget        w;
  847. X    XButtonEvent   *ev;
  848. X{
  849. X    flags_panel_dismiss();
  850. X}
  851. X
  852. Xstatic void
  853. Xflags_panel_set(w, ev)
  854. X    Widget        w;
  855. X    XButtonEvent   *ev;
  856. X{
  857. X    int            new_i_value;
  858. X    float        new_f_value;
  859. X
  860. X    if (hidden_text_flag)
  861. X    cur_textflags |= HIDDEN_TEXT;
  862. X    else
  863. X    cur_textflags &= ~HIDDEN_TEXT;
  864. X    if (special_text_flag)
  865. X    cur_textflags |= SPECIAL_TEXT;
  866. X    else
  867. X    cur_textflags &= ~SPECIAL_TEXT;
  868. X    if (rigid_text_flag)
  869. X    cur_textflags |= RIGID_TEXT;
  870. X    else
  871. X    cur_textflags &= ~RIGID_TEXT;
  872. X    flags_panel_dismiss();
  873. X    show_action(nval_i);
  874. X}
  875. X
  876. Xstatic void
  877. Xhidden_text_select(w, new_hidden_text, garbage)
  878. X    Widget          w;
  879. X    XtPointer       new_hidden_text, garbage;
  880. X{
  881. X    FirstArg(XtNlabel, XtName(w));
  882. X    SetValues(hidden_text_panel);
  883. X    hidden_text_flag = (int) new_hidden_text;
  884. X    if (hidden_text_flag)
  885. X    put_msg("Text will be displayed as hidden");
  886. X    else
  887. X    put_msg("Text will be displayed normally");
  888. X}
  889. X
  890. Xstatic void
  891. Xrigid_text_select(w, new_rigid_text, garbage)
  892. X    Widget          w;
  893. X    XtPointer       new_rigid_text, garbage;
  894. X{
  895. X    FirstArg(XtNlabel, XtName(w));
  896. X    SetValues(rigid_text_panel);
  897. X    rigid_text_flag = (int) new_rigid_text;
  898. X    if (rigid_text_flag)
  899. X    put_msg("Text in compound group will not scale with compound");
  900. X    else
  901. X    put_msg("Text in compound group will scale with compound");
  902. X}
  903. X
  904. Xstatic void
  905. Xspecial_text_select(w, new_special_text, garbage)
  906. X    Widget          w;
  907. X    XtPointer       new_special_text, garbage;
  908. X{
  909. X    FirstArg(XtNlabel, XtName(w));
  910. X    SetValues(special_text_panel);
  911. X    special_text_flag = (int) new_special_text;
  912. X    if (special_text_flag)
  913. X    put_msg("Text will be printed as special during print/export");
  914. X    else
  915. X    put_msg("Text will be printed as normal during print/export");
  916. X}
  917. X
  918. Xpopup_flags_panel(isw)
  919. X    ind_sw_info       *isw;
  920. X{
  921. X    Position        x_val, y_val;
  922. X    Dimension        width, height;
  923. X    char        buf[32];
  924. X    static int      actions_added=0;
  925. X    static char    *hidden_text_items[] = {
  926. X    "Normal ", "Hidden "};
  927. X    static char    *rigid_text_items[] = {
  928. X    "Normal ", "Rigid  "};
  929. X    static char    *special_text_items[] = {
  930. X    "Normal ", "Special"};
  931. X
  932. X    nval_i = isw;
  933. X    XtSetSensitive(nval_i->button, False);
  934. X    rigid_text_flag = (cur_textflags & RIGID_TEXT) ? 1 : 0;
  935. X    special_text_flag = (cur_textflags & SPECIAL_TEXT) ? 1 : 0;
  936. X    hidden_text_flag = (cur_textflags & HIDDEN_TEXT) ? 1 : 0;
  937. X
  938. X    FirstArg(XtNwidth, &width);
  939. X    NextArg(XtNheight, &height);
  940. X    GetValues(tool);
  941. X    /* position the popup 1/3 in from left and 2/3 down from top */
  942. X    XtTranslateCoords(tool, (Position) (width / 3), (Position) (2 * height / 3),
  943. X              &x_val, &y_val);
  944. X
  945. X    FirstArg(XtNx, x_val);
  946. X    NextArg(XtNy, y_val);
  947. X    NextArg(XtNwidth, 240);
  948. X
  949. X    nval_popup = XtCreatePopupShell("xfig_set_indicator_panel",
  950. X                    transientShellWidgetClass, tool,
  951. X                    Args, ArgCount);
  952. X    XtOverrideTranslations(nval_popup,
  953. X                       XtParseTranslationTable(nval_translations));
  954. X    if (!actions_added) {
  955. X        XtAppAddActions(tool_app, nval_actions, XtNumber(nval_actions));
  956. X    actions_added = 1;
  957. X    }
  958. X
  959. X    form = XtCreateManagedWidget("form", formWidgetClass, nval_popup, NULL, 0);
  960. X
  961. X    FirstArg(XtNborderWidth, 0);
  962. X    sprintf(buf, "%s %s", isw->line1, isw->line2);
  963. X    label = XtCreateManagedWidget(buf, labelWidgetClass, form, Args, ArgCount);
  964. X
  965. X    /* make hidden text menu */
  966. X
  967. X    FirstArg(XtNfromVert, label);
  968. X    NextArg(XtNborderWidth, 0);
  969. X    beside = XtCreateManagedWidget(" Hidden Flag     =", labelWidgetClass,
  970. X                                   form, Args, ArgCount);
  971. X
  972. X    FirstArg(XtNfromVert, label);
  973. X    NextArg(XtNfromHoriz, beside);
  974. X    hidden_text_panel = XtCreateManagedWidget(
  975. X                 hidden_text_items[hidden_text_flag], menuButtonWidgetClass,
  976. X                                              form, Args, ArgCount);
  977. X    below = hidden_text_panel;
  978. X    hidden_text_menu = make_popup_menu(hidden_text_items,
  979. X                                       XtNumber(hidden_text_items),
  980. X                                     hidden_text_panel, hidden_text_select);
  981. X
  982. X    /* make rigid text menu */
  983. X
  984. X    FirstArg(XtNfromVert, below);
  985. X    NextArg(XtNborderWidth, 0);
  986. X    beside = XtCreateManagedWidget(" Rigid Flag      =", labelWidgetClass,
  987. X                                   form, Args, ArgCount);
  988. X
  989. X    FirstArg(XtNfromVert, below);
  990. X    NextArg(XtNfromHoriz, beside);
  991. X    rigid_text_panel = XtCreateManagedWidget(
  992. X                   rigid_text_items[rigid_text_flag], menuButtonWidgetClass,
  993. X                                             form, Args, ArgCount);
  994. X    below = rigid_text_panel;
  995. X    rigid_text_menu = make_popup_menu(rigid_text_items,
  996. X                                      XtNumber(rigid_text_items),
  997. X                                      rigid_text_panel, rigid_text_select);
  998. X
  999. X    /* make special text menu */
  1000. X
  1001. X    FirstArg(XtNfromVert, below);
  1002. X    NextArg(XtNborderWidth, 0);
  1003. X    beside = XtCreateManagedWidget(" Special Flag    =", labelWidgetClass,
  1004. X                                   form, Args, ArgCount);
  1005. X
  1006. X    FirstArg(XtNfromVert, below);
  1007. X    NextArg(XtNfromHoriz, beside);
  1008. X    special_text_panel = XtCreateManagedWidget(
  1009. X                                      special_text_items[special_text_flag],
  1010. X                               menuButtonWidgetClass, form, Args, ArgCount);
  1011. X    below = special_text_panel;
  1012. X    special_text_menu = make_popup_menu(special_text_items,
  1013. X                                        XtNumber(special_text_items),
  1014. X                                   special_text_panel, special_text_select);
  1015. X
  1016. X    FirstArg(XtNlabel, "cancel");
  1017. X    NextArg(XtNfromVert, below);
  1018. X    NextArg(XtNborderWidth, INTERNAL_BW);
  1019. X    cancel = XtCreateManagedWidget("cancel", commandWidgetClass,
  1020. X                   form, Args, ArgCount);
  1021. X    XtAddEventHandler(cancel, ButtonReleaseMask, (Boolean) 0,
  1022. X              (XtEventHandler)flags_panel_cancel, (XtPointer) NULL);
  1023. X
  1024. X    FirstArg(XtNlabel, "set");
  1025. X    NextArg(XtNfromVert, below);
  1026. X    NextArg(XtNfromHoriz, cancel);
  1027. X    NextArg(XtNborderWidth, INTERNAL_BW);
  1028. X    set = XtCreateManagedWidget("set", commandWidgetClass,
  1029. X                form, Args, ArgCount);
  1030. X    XtAddEventHandler(set, ButtonReleaseMask, (Boolean) 0,
  1031. X              (XtEventHandler)flags_panel_set, (XtPointer) NULL);
  1032. X
  1033. X    XtPopup(nval_popup, XtGrabExclusive);
  1034. X    (void) XSetWMProtocols(XtDisplay(nval_popup), XtWindow(nval_popup),
  1035. X                           &wm_delete_window, 1);
  1036. X}
  1037. X
  1038. X/* handle integer and floating point settings */
  1039. X
  1040. Xstatic void
  1041. Xnval_panel_dismiss()
  1042. X{
  1043. X    XtDestroyWidget(nval_popup);
  1044. X    XtSetSensitive(nval_i->button, True);
  1045. X}
  1046. X
  1047. Xstatic void
  1048. Xnval_panel_cancel(w, ev)
  1049. X    Widget        w;
  1050. X    XButtonEvent   *ev;
  1051. X{
  1052. X    nval_panel_dismiss();
  1053. X}
  1054. X
  1055. Xstatic void
  1056. Xnval_panel_set(w, ev)
  1057. X    Widget        w;
  1058. X    XButtonEvent   *ev;
  1059. X{
  1060. X    int            new_i_value;
  1061. X    float        new_f_value;
  1062. X
  1063. X
  1064. X    if (nval_i->type == I_IVAL)
  1065. X        {
  1066. X        new_i_value = atoi(panel_get_value(newvalue));
  1067. X        (*nval_i->i_varadr) = new_i_value;
  1068. X        }
  1069. X    else
  1070. X        {
  1071. X        new_f_value = atof(panel_get_value(newvalue));
  1072. X        (*nval_i->f_varadr) = new_f_value;
  1073. X        }
  1074. X    nval_panel_dismiss();
  1075. X    show_action(nval_i);
  1076. X}
  1077. X
  1078. Xpopup_nval_panel(isw)
  1079. X    ind_sw_info       *isw;
  1080. X{
  1081. X    Position        x_val, y_val;
  1082. X    Dimension        width, height;
  1083. X    char        buf[32];
  1084. X    static int      actions_added=0;
  1085. X
  1086. X    nval_i = isw;
  1087. X    XtSetSensitive(nval_i->button, False);
  1088. X
  1089. X    FirstArg(XtNwidth, &width);
  1090. X    NextArg(XtNheight, &height);
  1091. X    GetValues(tool);
  1092. X    /* position the popup 1/3 in from left and 2/3 down from top */
  1093. X    XtTranslateCoords(tool, (Position) (width / 3), (Position) (2 * height / 3),
  1094. X              &x_val, &y_val);
  1095. X
  1096. X    FirstArg(XtNx, x_val);
  1097. X    NextArg(XtNy, y_val);
  1098. X    NextArg(XtNwidth, 240);
  1099. X
  1100. X    nval_popup = XtCreatePopupShell("xfig_set_indicator_panel",
  1101. X                    transientShellWidgetClass, tool,
  1102. X                    Args, ArgCount);
  1103. X    XtOverrideTranslations(nval_popup,
  1104. X                       XtParseTranslationTable(nval_translations));
  1105. X    if (!actions_added) {
  1106. X        XtAppAddActions(tool_app, nval_actions, XtNumber(nval_actions));
  1107. X    actions_added = 1;
  1108. X    }
  1109. X
  1110. X    form = XtCreateManagedWidget("form", formWidgetClass, nval_popup, NULL, 0);
  1111. X
  1112. X    FirstArg(XtNborderWidth, 0);
  1113. X    sprintf(buf, "%s %s", isw->line1, isw->line2);
  1114. X    label = XtCreateManagedWidget(buf, labelWidgetClass, form, Args, ArgCount);
  1115. X
  1116. X    FirstArg(XtNfromVert, label);
  1117. X    NextArg(XtNborderWidth, 0);
  1118. X    NextArg(XtNlabel, "Value =");
  1119. X    newvalue = XtCreateManagedWidget("value", labelWidgetClass,
  1120. X                     form, Args, ArgCount);
  1121. X    /* int or float? */
  1122. X    if (isw->type == I_IVAL)
  1123. X        sprintf(buf, "%d", (*isw->i_varadr));
  1124. X    else
  1125. X        sprintf(buf, "%4.2lf", (*isw->f_varadr));
  1126. X    FirstArg(XtNfromVert, label);
  1127. X    NextArg(XtNborderWidth, INTERNAL_BW);
  1128. X    NextArg(XtNfromHoriz, newvalue);
  1129. X    NextArg(XtNstring, buf);
  1130. X    NextArg(XtNinsertPosition, strlen(buf));
  1131. X    NextArg(XtNeditType, "append");
  1132. X    NextArg(XtNwidth, 40);
  1133. X    newvalue = XtCreateManagedWidget(buf, asciiTextWidgetClass,
  1134. X                     form, Args, ArgCount);
  1135. X
  1136. X    /* add translation and action to set value on carriage return */
  1137. X    XtAppAddActions(tool_app, set_actions, XtNumber(set_actions));
  1138. X    XtOverrideTranslations(newvalue, XtParseTranslationTable(set_translations));
  1139. X
  1140. X    FirstArg(XtNlabel, "cancel");
  1141. X    NextArg(XtNfromVert, newvalue);
  1142. X    NextArg(XtNborderWidth, INTERNAL_BW);
  1143. X    cancel = XtCreateManagedWidget("cancel", commandWidgetClass,
  1144. X                   form, Args, ArgCount);
  1145. X    XtAddEventHandler(cancel, ButtonReleaseMask, (Boolean) 0,
  1146. X              (XtEventHandler)nval_panel_cancel, (XtPointer) NULL);
  1147. X
  1148. X    FirstArg(XtNlabel, "set");
  1149. X    NextArg(XtNfromVert, newvalue);
  1150. X    NextArg(XtNfromHoriz, cancel);
  1151. X    NextArg(XtNborderWidth, INTERNAL_BW);
  1152. X    set = XtCreateManagedWidget("set", commandWidgetClass,
  1153. X                form, Args, ArgCount);
  1154. X    XtAddEventHandler(set, ButtonReleaseMask, (Boolean) 0,
  1155. X              (XtEventHandler)nval_panel_set, (XtPointer) NULL);
  1156. X
  1157. X    XtPopup(nval_popup, XtGrabExclusive);
  1158. X    (void) XSetWMProtocols(XtDisplay(nval_popup), XtWindow(nval_popup),
  1159. X                           &wm_delete_window, 1);
  1160. X}
  1161. X
  1162. X/********************************************************
  1163. X
  1164. X    commands to change indicator settings
  1165. X
  1166. X********************************************************/
  1167. X
  1168. Xupdate_current_settings()
  1169. X{
  1170. X    int            i;
  1171. X    ind_sw_info       *isw;
  1172. X
  1173. X    for (i = 0; i < NUM_IND_SW; ++i) {
  1174. X    isw = &ind_switches[i];
  1175. X    show_action(isw);
  1176. X    }
  1177. X}
  1178. X
  1179. Xstatic
  1180. Xdec_choice(sw)
  1181. X    ind_sw_info       *sw;
  1182. X{
  1183. X    if (--(*sw->i_varadr) < 0)
  1184. X    (*sw->i_varadr) = sw->numchoices - 1;
  1185. X    show_action(sw);
  1186. X}
  1187. X
  1188. Xstatic
  1189. Xinc_choice(sw)
  1190. X    ind_sw_info       *sw;
  1191. X{
  1192. X    if (++(*sw->i_varadr) > sw->numchoices - 1)
  1193. X    (*sw->i_varadr) = 0;
  1194. X    show_action(sw);
  1195. X}
  1196. X
  1197. X/* ARROW MODE         */
  1198. X
  1199. Xstatic
  1200. Xshow_arrowmode(sw)
  1201. X    ind_sw_info       *sw;
  1202. X{
  1203. X    update_choice_pixmap(sw, cur_arrowmode);
  1204. X    switch (cur_arrowmode) {
  1205. X    case L_NOARROWS:
  1206. X    autobackwardarrow_mode = 0;
  1207. X    autoforwardarrow_mode = 0;
  1208. X    put_msg("NO ARROWS");
  1209. X    break;
  1210. X    case L_FARROWS:
  1211. X    autobackwardarrow_mode = 0;
  1212. X    autoforwardarrow_mode = 1;
  1213. X    put_msg("Auto FORWARD ARROWS (for ARC, POLYLINE and SPLINE)");
  1214. X    break;
  1215. X    case L_FBARROWS:
  1216. X    autobackwardarrow_mode = 1;
  1217. X    autoforwardarrow_mode = 1;
  1218. X    put_msg("Auto FORWARD and BACKWARD ARROWS (for ARC, POLYLINE and SPLINE)");
  1219. X    break;
  1220. X    case L_BARROWS:
  1221. X    autobackwardarrow_mode = 1;
  1222. X    autoforwardarrow_mode = 0;
  1223. X    put_msg("Auto BACKWARD ARROWS (for ARC, POLYLINE and SPLINE)");
  1224. X    break;
  1225. X    }
  1226. X}
  1227. X
  1228. X/* LINE WIDTH         */
  1229. X
  1230. X#define MAXLINEWIDTH 200
  1231. X
  1232. Xstatic
  1233. Xdec_linewidth(sw)
  1234. X    ind_sw_info       *sw;
  1235. X{
  1236. X    --cur_linewidth;
  1237. X    show_linewidth(sw);
  1238. X}
  1239. X
  1240. Xstatic
  1241. Xinc_linewidth(sw)
  1242. X    ind_sw_info       *sw;
  1243. X{
  1244. X    ++cur_linewidth;
  1245. X    show_linewidth(sw);
  1246. X}
  1247. X
  1248. Xstatic
  1249. Xshow_linewidth(sw)
  1250. X    ind_sw_info       *sw;
  1251. X{
  1252. X    if (cur_linewidth > MAXLINEWIDTH)
  1253. X    cur_linewidth = MAXLINEWIDTH;
  1254. X    else if (cur_linewidth < 0)
  1255. X    cur_linewidth = 0;
  1256. X
  1257. X    /* erase by drawing wide, inverted (white) line */
  1258. X    pw_vector(sw->normalPM, DEF_IND_SW_WD / 2 + 2, DEF_IND_SW_HT / 2,
  1259. X          sw->sw_width - 2, DEF_IND_SW_HT / 2, ERASE,
  1260. X          DEF_IND_SW_HT, PANEL_LINE, 0.0, DEFAULT_COLOR);
  1261. X    /* draw current line thickness into pixmap */
  1262. X    if (cur_linewidth > 0)    /* don't draw line for zero-thickness */
  1263. X    pw_vector(sw->normalPM, DEF_IND_SW_WD / 2 + 2, DEF_IND_SW_HT / 2,
  1264. X          sw->sw_width - 2, DEF_IND_SW_HT / 2, PAINT,
  1265. X          cur_linewidth, PANEL_LINE, 0.0, DEFAULT_COLOR);
  1266. X
  1267. X    /*
  1268. X     * Fool the toolkit by changing the background pixmap to 0 then giving it
  1269. X     * the modified one again.    Otherwise, it sees that the pixmap ID is not
  1270. X     * changed and doesn't actually draw it into the widget window
  1271. X     */
  1272. X    button_args[6].value = 0;
  1273. X    XtSetValues(sw->button, &button_args[6], 1);
  1274. X    /* put the pixmap in the widget background */
  1275. X    button_args[6].value = (XtArgVal) sw->normalPM;
  1276. X    XtSetValues(sw->button, &button_args[6], 1);
  1277. X    put_msg("LINE Thickness = %d", cur_linewidth);
  1278. X}
  1279. X
  1280. X/* ANGLE GEOMETRY         */
  1281. X
  1282. Xstatic
  1283. Xshow_anglegeom(sw)
  1284. X    ind_sw_info       *sw;
  1285. X{
  1286. X    update_choice_pixmap(sw, cur_anglegeom);
  1287. X    switch (cur_anglegeom) {
  1288. X    case L_UNCONSTRAINED:
  1289. X    manhattan_mode = 0;
  1290. X    mountain_mode = 0;
  1291. X    latexline_mode = 0;
  1292. X    latexarrow_mode = 0;
  1293. X    put_msg("UNCONSTRAINED geometry (for POLYLINE and SPLINE)");
  1294. X    break;
  1295. X    case L_MOUNTHATTAN:
  1296. X    mountain_mode = 1;
  1297. X    manhattan_mode = 1;
  1298. X    latexline_mode = 0;
  1299. X    latexarrow_mode = 0;
  1300. X    put_msg("MOUNT-HATTAN geometry (for POLYLINE and SPLINE)");
  1301. X    break;
  1302. X    case L_MANHATTAN:
  1303. X    manhattan_mode = 1;
  1304. X    mountain_mode = 0;
  1305. X    latexline_mode = 0;
  1306. X    latexarrow_mode = 0;
  1307. X    put_msg("MANHATTAN geometry (for POLYLINE and SPLINE)");
  1308. X    break;
  1309. X    case L_MOUNTAIN:
  1310. X    mountain_mode = 1;
  1311. X    manhattan_mode = 0;
  1312. X    latexline_mode = 0;
  1313. X    latexarrow_mode = 0;
  1314. X    put_msg("MOUNTAIN geometry (for POLYLINE and SPLINE)");
  1315. X    break;
  1316. X    case L_LATEXLINE:
  1317. X    latexline_mode = 1;
  1318. X    manhattan_mode = 0;
  1319. X    mountain_mode = 0;
  1320. X    latexarrow_mode = 0;
  1321. X    put_msg("LATEX LINE geometry: allow only LaTeX line slopes");
  1322. X    break;
  1323. X    case L_LATEXARROW:
  1324. X    latexarrow_mode = 1;
  1325. X    manhattan_mode = 0;
  1326. X    mountain_mode = 0;
  1327. X    latexline_mode = 0;
  1328. X    put_msg("LATEX ARROW geometry: allow only LaTeX arrow slopes");
  1329. X    break;
  1330. X    }
  1331. X}
  1332. X
  1333. X/* LINE STYLE         */
  1334. X
  1335. Xstatic
  1336. Xshow_linestyle(sw)
  1337. X    ind_sw_info       *sw;
  1338. X{
  1339. X    update_choice_pixmap(sw, cur_linestyle);
  1340. X    switch (cur_linestyle) {
  1341. X    case SOLID_LINE:
  1342. X    cur_styleval = 0.0;
  1343. X    put_msg("SOLID LINE STYLE (for BOX, POLYGON and POLYLINE)");
  1344. X    break;
  1345. X    case DASH_LINE:
  1346. X    cur_styleval = cur_dashlength;
  1347. X    put_msg("DASH LINE STYLE (for BOX, POLYGON and POLYLINE)");
  1348. X    break;
  1349. X    case DOTTED_LINE:
  1350. X    cur_styleval = cur_dotgap;
  1351. X    put_msg("DOTTED LINE STYLE (for BOX, POLYGON and POLYLINE)");
  1352. X    break;
  1353. X    }
  1354. X}
  1355. X
  1356. X/* VERTICAL ALIGNMENT     */
  1357. X
  1358. Xstatic
  1359. Xshow_valign(sw)
  1360. X    ind_sw_info       *sw;
  1361. X{
  1362. X    update_choice_pixmap(sw, cur_valign);
  1363. X    switch (cur_valign) {
  1364. X    case NONE:
  1365. X    put_msg("No vertical alignment");
  1366. X    break;
  1367. X    case TOP:
  1368. X    put_msg("Vertically align to TOP");
  1369. X    break;
  1370. X    case CENTER:
  1371. X    put_msg("Center vertically when aligning");
  1372. X    break;
  1373. X    case BOTTOM:
  1374. X    put_msg("Vertically align to BOTTOM");
  1375. X    break;
  1376. X    }
  1377. X}
  1378. X
  1379. X/* HORIZ ALIGNMENT     */
  1380. X
  1381. Xstatic
  1382. Xshow_halign(sw)
  1383. X    ind_sw_info       *sw;
  1384. X{
  1385. X    update_choice_pixmap(sw, cur_halign);
  1386. X    switch (cur_halign) {
  1387. X    case NONE:
  1388. X    put_msg("No horizontal alignment");
  1389. X    break;
  1390. X    case LEFT:
  1391. X    put_msg("Horizontally align to LEFT");
  1392. X    break;
  1393. X    case CENTER:
  1394. X    put_msg("Center horizontally when aligning");
  1395. X    break;
  1396. X    case RIGHT:
  1397. X    put_msg("Horizontally align to RIGHT");
  1398. X    break;
  1399. X    }
  1400. X}
  1401. X
  1402. X/* GRID MODE     */
  1403. X
  1404. Xstatic
  1405. Xshow_gridmode(sw)
  1406. X    ind_sw_info       *sw;
  1407. X{
  1408. X    static int        prev_gridmode = -1;
  1409. X
  1410. X    update_choice_pixmap(sw, cur_gridmode);
  1411. X    switch (cur_gridmode) {
  1412. X    case GRID_0:
  1413. X    put_msg("No grid");
  1414. X    break;
  1415. X    case GRID_1:
  1416. X    put_msg("Small grid");
  1417. X    break;
  1418. X    case GRID_2:
  1419. X    put_msg("Large grid");
  1420. X    break;
  1421. X    }
  1422. X    if (cur_gridmode != prev_gridmode)
  1423. X    setup_grid(cur_gridmode);
  1424. X    prev_gridmode = cur_gridmode;
  1425. X}
  1426. X
  1427. X/* POINT POSITION     */
  1428. X
  1429. Xstatic
  1430. Xshow_pointposn(sw)
  1431. X    ind_sw_info       *sw;
  1432. X{
  1433. X    char        buf[80];
  1434. X
  1435. X    update_choice_pixmap(sw, cur_pointposn);
  1436. X    switch (cur_pointposn) {
  1437. X    case P_ANY:
  1438. X    put_msg("Arbitrary Positioning of Points");
  1439. X    break;
  1440. X    case P_MAGNET:
  1441. X    case P_GRID1:
  1442. X    case P_GRID2:
  1443. X    sprintf(buf,
  1444. X      "MAGNET MODE: entered points rounded to the nearest %s increment",
  1445. X        grid_name[cur_pointposn]);
  1446. X    put_msg(buf);
  1447. X    break;
  1448. X    }
  1449. X}
  1450. X
  1451. X/* SMART LINK MODE */
  1452. X
  1453. Xstatic
  1454. Xshow_linkmode(sw)
  1455. X    ind_sw_info       *sw;
  1456. X{
  1457. X    update_choice_pixmap(sw, cur_linkmode);
  1458. X    switch (cur_linkmode) {
  1459. X    case SMART_OFF:
  1460. X    put_msg("Do not adjust links automatically");
  1461. X    break;
  1462. X    case SMART_MOVE:
  1463. X    put_msg("Adjust links automatically by moving endpoint");
  1464. X    break;
  1465. X    case SMART_SLIDE:
  1466. X    put_msg("Adjust links automatically by sliding endlink");
  1467. X    break;
  1468. X    }
  1469. X}
  1470. X
  1471. X/* TEXT JUSTIFICATION     */
  1472. X
  1473. Xstatic
  1474. Xshow_textjust(sw)
  1475. X    ind_sw_info       *sw;
  1476. X{
  1477. X    update_choice_pixmap(sw, cur_textjust);
  1478. X    switch (cur_textjust) {
  1479. X    case T_LEFT_JUSTIFIED:
  1480. X    put_msg("Left justify text");
  1481. X    break;
  1482. X    case T_CENTER_JUSTIFIED:
  1483. X    put_msg("Center text");
  1484. X    break;
  1485. X    case T_RIGHT_JUSTIFIED:
  1486. X    put_msg("Right justify text");
  1487. X    break;
  1488. X    }
  1489. X}
  1490. X
  1491. X/* BOX RADIUS     */
  1492. X
  1493. Xstatic
  1494. Xdec_boxradius(sw)
  1495. X    ind_sw_info       *sw;
  1496. X{
  1497. X    --cur_boxradius;
  1498. X    show_boxradius(sw);
  1499. X}
  1500. X
  1501. Xstatic
  1502. Xinc_boxradius(sw)
  1503. X    ind_sw_info       *sw;
  1504. X{
  1505. X    ++cur_boxradius;
  1506. X    show_boxradius(sw);
  1507. X}
  1508. X
  1509. X#define MAXRADIUS 30
  1510. Xstatic
  1511. Xshow_boxradius(sw)
  1512. X    ind_sw_info       *sw;
  1513. X{
  1514. X    if (cur_boxradius > MAXRADIUS)
  1515. X    cur_boxradius = MAXRADIUS;
  1516. X    else if (cur_boxradius < 3)
  1517. X    cur_boxradius = 3;
  1518. X    /* erase by drawing wide, inverted (white) line */
  1519. X    pw_vector(sw->normalPM, DEF_IND_SW_WD / 2, DEF_IND_SW_HT / 2,
  1520. X          DEF_IND_SW_WD, DEF_IND_SW_HT / 2, ERASE,
  1521. X          DEF_IND_SW_HT, PANEL_LINE, 0.0, DEFAULT_COLOR);
  1522. X    /* draw current radius into pixmap */
  1523. X    curve(sw->normalPM, 0, cur_boxradius, -cur_boxradius, 0, 1,
  1524. X      cur_boxradius, cur_boxradius, DEF_IND_SW_WD - 2, DEF_IND_SW_HT - 2,
  1525. X      PAINT, 1, PANEL_LINE, 0.0, 0, DEFAULT_COLOR);
  1526. X
  1527. X    /*
  1528. X     * Fool the toolkit by changing the background pixmap to 0 then giving it
  1529. X     * the modified one again.    Otherwise, it sees that the pixmap ID is not
  1530. X     * changed and doesn't actually draw it into the widget window
  1531. X     */
  1532. X    button_args[6].value = 0;
  1533. X    XtSetValues(sw->button, &button_args[6], 1);
  1534. X    /* put the pixmap in the widget background */
  1535. X    button_args[6].value = (XtArgVal) sw->normalPM;
  1536. X    XtSetValues(sw->button, &button_args[6], 1);
  1537. X    put_msg("ROUNDED-CORNER BOX Radius = %d", cur_boxradius);
  1538. X}
  1539. X
  1540. X/* FILL STYLE */
  1541. X
  1542. Xstatic
  1543. Xdarken_fill(sw)
  1544. X    ind_sw_info       *sw;
  1545. X{
  1546. X    if (++cur_fillstyle > NUMFILLPATS)
  1547. X    cur_fillstyle = 0;
  1548. X    show_fillstyle(sw);
  1549. X}
  1550. X
  1551. Xstatic
  1552. Xlighten_fill(sw)
  1553. X    ind_sw_info       *sw;
  1554. X{
  1555. X    if (--cur_fillstyle < 0)
  1556. X    cur_fillstyle = NUMFILLPATS;
  1557. X    show_fillstyle(sw);
  1558. X}
  1559. X
  1560. Xstatic
  1561. Xshow_fillstyle(sw)
  1562. X    ind_sw_info       *sw;
  1563. X{
  1564. X    if (cur_fillstyle == 0) {
  1565. X    XCopyArea(tool_d, ((cur_color==BLACK ||
  1566. X           (cur_color==DEFAULT_COLOR && x_fg_color.pixel==appres.color[BLACK]) ||
  1567. X            (!all_colors_available && cur_color!=WHITE))? 
  1568. X            fillstyle_choices[0].blackPM: fillstyle_choices[0].normalPM),
  1569. X            sw->normalPM,
  1570. X            ind_button_gc, 0, 0, 32, 32, 32, 0);
  1571. X    put_msg("NO-FILL MODE");
  1572. X    } else {
  1573. X    /* put the pixmap in the widget background */
  1574. X    XCopyArea(tool_d, ((cur_color==BLACK ||
  1575. X           (cur_color==DEFAULT_COLOR && x_fg_color.pixel==appres.color[BLACK]) ||
  1576. X            (!all_colors_available && cur_color!=WHITE))? 
  1577. X                fillstyle_choices[cur_fillstyle].blackPM:
  1578. X                fillstyle_choices[cur_fillstyle].normalPM),
  1579. X            sw->normalPM,
  1580. X            ind_button_gc, 0, 0, 26, 24, 35, 4);
  1581. X    put_msg("FILL MODE (black density/color intensity = %d%%)",
  1582. X        ((cur_fillstyle - 1) * 100) / (NUMFILLPATS - 1));
  1583. X    }
  1584. X    button_args[6].value = 0;
  1585. X    XtSetValues(sw->button, &button_args[6], 1);
  1586. X    button_args[6].value = (XtArgVal) sw->normalPM;
  1587. X    XtSetValues(sw->button, &button_args[6], 1);
  1588. X}
  1589. X
  1590. X/* COLOR */
  1591. X
  1592. Xstatic
  1593. Xnext_color(sw)
  1594. X    ind_sw_info       *sw;
  1595. X{
  1596. X    if (++cur_color >= NUMCOLORS)
  1597. X    cur_color = DEFAULT_COLOR;
  1598. X    show_color(sw);
  1599. X}
  1600. X
  1601. Xstatic
  1602. Xprev_color(sw)
  1603. X    ind_sw_info       *sw;
  1604. X{
  1605. X    if (--cur_color < DEFAULT_COLOR)
  1606. X    cur_color = NUMCOLORS - 1;
  1607. X    show_color(sw);
  1608. X}
  1609. X
  1610. Xstatic
  1611. Xshow_color(sw)
  1612. X    ind_sw_info       *sw;
  1613. X{
  1614. X    int            color;
  1615. X
  1616. X    if (cur_color < 0 || cur_color >= NUMCOLORS) {
  1617. X    cur_color == DEFAULT_COLOR;
  1618. X    color = x_fg_color.pixel;
  1619. X    } else
  1620. X    color = all_colors_available ? appres.color[cur_color] : x_fg_color.pixel;
  1621. X
  1622. X    show_fillstyle(fill_style_sw);
  1623. X    put_msg("Color set to %s", colorNames[cur_color + 1]);
  1624. X    XSetForeground(tool_d, color_gc, color);
  1625. X    /* now fill the color rectangle with the new color */
  1626. X    XFillRectangle(tool_d, sw->normalPM, color_gc, sw->sw_width - 29, 4, 26, 24);
  1627. X    /*
  1628. X     * write the widget background over old color name before writing new
  1629. X     * name
  1630. X     */
  1631. X    /* first set the foreground color to the background for the fill */
  1632. X    XSetForeground(tool_d, ind_button_gc, ind_but_bg);
  1633. X    XFillRectangle(tool_d, sw->normalPM, ind_button_gc, 0, DEF_IND_SW_HT / 2,
  1634. X           sw->sw_width - 29, DEF_IND_SW_HT / 2);
  1635. X    /* now restore the foreground in the gc */
  1636. X    XSetForeground(tool_d, ind_button_gc, ind_but_fg);
  1637. X    XDrawImageString(tool_d, sw->normalPM, ind_button_gc, 3, 25,
  1638. X          colorNames[cur_color + 1], strlen(colorNames[cur_color + 1]));
  1639. X    button_args[6].value = 0;
  1640. X    XtSetValues(sw->button, &button_args[6], 1);
  1641. X    button_args[6].value = (XtArgVal) sw->normalPM;
  1642. X    XtSetValues(sw->button, &button_args[6], 1);
  1643. X}
  1644. X
  1645. X/* TEXT FLAGS */
  1646. X
  1647. Xstatic
  1648. Xinc_flags(sw)
  1649. X    ind_sw_info       *sw;
  1650. X{
  1651. X    if (++cur_flagshown > MAX_FLAGS)
  1652. X    cur_flagshown = 0;
  1653. X    show_flags(sw);
  1654. X}
  1655. X
  1656. Xstatic
  1657. Xdec_flags(sw)
  1658. X    ind_sw_info       *sw;
  1659. X{
  1660. X    if (--cur_flagshown < 0)
  1661. X    cur_flagshown = MAX_FLAGS;
  1662. X    show_flags(sw);
  1663. X}
  1664. X
  1665. Xstatic
  1666. Xshow_flags(sw)
  1667. X    ind_sw_info       *sw;
  1668. X{
  1669. X    put_msg("Text flags: Hidden=%s, Special=%s, Rigid=%s (Button 1 to change)",
  1670. X        (cur_textflags & HIDDEN_TEXT) ? "on" : "off",
  1671. X        (cur_textflags & SPECIAL_TEXT) ? "on" : "off",
  1672. X        (cur_textflags & RIGID_TEXT) ? "on" : "off");
  1673. X
  1674. X    /* write the text/ellipse angle in the background pixmap */
  1675. X    switch(cur_flagshown) {
  1676. X    case 0:
  1677. X        sprintf(indbuf, "hidden=%s",
  1678. X            (cur_textflags & HIDDEN_TEXT) ? "on  " : "off ");
  1679. X        break;
  1680. X    case 1:
  1681. X        sprintf(indbuf, "special=%s",
  1682. X            (cur_textflags & SPECIAL_TEXT) ? "on " : "off");
  1683. X        break;
  1684. X    default:
  1685. X        sprintf(indbuf, "rigid=%s",
  1686. X            (cur_textflags & RIGID_TEXT) ? "on   " : "off  ");
  1687. X    }
  1688. X    update_string_pixmap(sw, indbuf, 6, 26);
  1689. X}
  1690. X
  1691. X/* FONT */
  1692. X
  1693. Xstatic
  1694. Xinc_font(sw)
  1695. X    ind_sw_info       *sw;
  1696. X{
  1697. X    if (using_ps)
  1698. X    cur_ps_font++;
  1699. X    else
  1700. X    cur_latex_font++;
  1701. X    show_font(sw);
  1702. X}
  1703. X
  1704. Xstatic
  1705. Xdec_font(sw)
  1706. X    ind_sw_info       *sw;
  1707. X{
  1708. X    if (using_ps)
  1709. X    cur_ps_font--;
  1710. X    else
  1711. X    cur_latex_font--;
  1712. X    show_font(sw);
  1713. X}
  1714. X
  1715. Xstatic
  1716. Xshow_font(sw)
  1717. X    ind_sw_info       *sw;
  1718. X{
  1719. X    if (using_ps) {
  1720. X    if (cur_ps_font >= NUM_PS_FONTS)
  1721. X        cur_ps_font = DEFAULT;
  1722. X    else if (cur_ps_font < DEFAULT)
  1723. X        cur_ps_font = NUM_PS_FONTS - 1;
  1724. X    } else {
  1725. X    if (cur_latex_font >= NUM_LATEX_FONTS)
  1726. X        cur_latex_font = 0;
  1727. X    else if (cur_latex_font < 0)
  1728. X        cur_latex_font = NUM_LATEX_FONTS - 1;
  1729. X    }
  1730. X
  1731. X    /* erase larger fontpane bits if we switched to smaller (Latex) */
  1732. X    XFillRectangle(tool_d, sw->normalPM, ind_blank_gc, 0, 0,
  1733. X           32 + max2(PS_FONTPANE_WD, LATEX_FONTPANE_WD), DEF_IND_SW_HT);
  1734. X    /* and redraw info */
  1735. X    XDrawImageString(tool_d, sw->normalPM, ind_button_gc, 3, 12, sw->line1,
  1736. X             strlen(sw->line1));
  1737. X    XDrawImageString(tool_d, sw->normalPM, ind_button_gc, 3, 25, sw->line2, 
  1738. X             strlen(sw->line2));
  1739. X
  1740. X    XCopyArea(tool_d, using_ps ? psfont_menu_bitmaps[cur_ps_font + 1] :
  1741. X          latexfont_menu_bitmaps[cur_latex_font],
  1742. X          sw->normalPM, ind_button_gc, 0, 0,
  1743. X          using_ps ? PS_FONTPANE_WD : LATEX_FONTPANE_WD,
  1744. X          using_ps ? PS_FONTPANE_HT : LATEX_FONTPANE_HT,
  1745. X      using_ps ? 32 : 32 + (PS_FONTPANE_WD - LATEX_FONTPANE_WD) / 2, 6);
  1746. X
  1747. X    button_args[6].value = 0;
  1748. X    XtSetValues(sw->button, &button_args[6], 1);
  1749. X    /* put the pixmap in the widget background */
  1750. X    button_args[6].value = (XtArgVal) sw->normalPM;
  1751. X    XtSetValues(sw->button, &button_args[6], 1);
  1752. X    put_msg("Font: %s", using_ps ? ps_fontinfo[cur_ps_font + 1].name :
  1753. X        latex_fontinfo[cur_latex_font].name);
  1754. X}
  1755. X
  1756. X/* popup menu of printer fonts */
  1757. X
  1758. Xstatic int    psflag;
  1759. Xstatic ind_sw_info *return_sw;
  1760. X
  1761. Xint        show_font_return();
  1762. X
  1763. Xstatic
  1764. Xpopup_fonts(sw)
  1765. X    ind_sw_info       *sw;
  1766. X{
  1767. X    return_sw = sw;
  1768. X    psflag = using_ps ? 1 : 0;
  1769. X    fontpane_popup(&cur_ps_font, &cur_latex_font, &psflag,
  1770. X           show_font_return, sw->button);
  1771. X}
  1772. X
  1773. Xshow_font_return(w)
  1774. X    Widget        w;
  1775. X{
  1776. X    if (psflag)
  1777. X    cur_textflags = cur_textflags | PSFONT_TEXT;
  1778. X    else
  1779. X    cur_textflags = cur_textflags & (~PSFONT_TEXT);
  1780. X    show_font(return_sw);
  1781. X}
  1782. X
  1783. X/* FONT SIZE */
  1784. X
  1785. Xstatic
  1786. Xinc_fontsize(sw)
  1787. X    ind_sw_info       *sw;
  1788. X{
  1789. X    if (cur_fontsize >= 100) {
  1790. X    cur_fontsize = (cur_fontsize / 10) * 10;    /* round first */
  1791. X    cur_fontsize += 10;
  1792. X    } else if (cur_fontsize >= 50) {
  1793. X    cur_fontsize = (cur_fontsize / 5) * 5;
  1794. X    cur_fontsize += 5;
  1795. X    } else if (cur_fontsize >= 20) {
  1796. X    cur_fontsize = (cur_fontsize / 2) * 2;
  1797. X    cur_fontsize += 2;
  1798. X    } else
  1799. X    cur_fontsize++;
  1800. X    show_fontsize(sw);
  1801. X}
  1802. X
  1803. Xstatic
  1804. Xdec_fontsize(sw)
  1805. X    ind_sw_info       *sw;
  1806. X{
  1807. X    if (cur_fontsize > 100) {
  1808. X    cur_fontsize = (cur_fontsize / 10) * 10;    /* round first */
  1809. X    cur_fontsize -= 10;
  1810. X    } else if (cur_fontsize > 50) {
  1811. X    cur_fontsize = (cur_fontsize / 5) * 5;
  1812. X    cur_fontsize -= 5;
  1813. X    } else if (cur_fontsize > 20) {
  1814. X    cur_fontsize = (cur_fontsize / 2) * 2;
  1815. X    cur_fontsize -= 2;
  1816. X    } else if (cur_fontsize > 4)
  1817. X    cur_fontsize--;
  1818. X    show_fontsize(sw);
  1819. X}
  1820. X
  1821. Xstatic
  1822. Xshow_fontsize(sw)
  1823. X    ind_sw_info       *sw;
  1824. X{
  1825. X    if (cur_fontsize < 4)
  1826. X    cur_fontsize = 4;
  1827. X    else if (cur_fontsize > 1000)
  1828. X    cur_fontsize = 1000;
  1829. X
  1830. X    put_msg("Font size %d", cur_fontsize);
  1831. X    /* write the font size in the background pixmap */
  1832. X    indbuf[0] = indbuf[1] = indbuf[2] = indbuf[3] = indbuf[4] = '\0';
  1833. X    sprintf(indbuf, "%4d", cur_fontsize);
  1834. X    update_string_pixmap(sw, indbuf, sw->sw_width - 28, 20);
  1835. X}
  1836. X
  1837. X/* ELLIPSE/TEXT ANGLE */
  1838. X
  1839. Xstatic
  1840. Xinc_elltextangle(sw)
  1841. X    ind_sw_info       *sw;
  1842. X{
  1843. X
  1844. X    if (cur_elltextangle < 0.0)
  1845. X    cur_elltextangle = ((int) ((cur_elltextangle-14.999)/15.0))*15.0;
  1846. X    else
  1847. X    cur_elltextangle = ((int) (cur_elltextangle/15.0))*15.0;
  1848. X    cur_elltextangle += 15.0;
  1849. X    show_elltextangle(sw);
  1850. X}
  1851. X
  1852. Xstatic
  1853. Xdec_elltextangle(sw)
  1854. X    ind_sw_info       *sw;
  1855. X{
  1856. X    if (cur_elltextangle < 0.0)
  1857. X    cur_elltextangle = ((int) (cur_elltextangle/15.0))*15.0;
  1858. X    else
  1859. X    cur_elltextangle = ((int) ((cur_elltextangle+14.999)/15.0))*15.0;
  1860. X    cur_elltextangle -= 15.0;
  1861. X    show_elltextangle(sw);
  1862. X}
  1863. X
  1864. Xstatic
  1865. Xshow_elltextangle(sw)
  1866. X    ind_sw_info       *sw;
  1867. X{
  1868. X    cur_elltextangle = round(cur_elltextangle*10.0)/10.0;
  1869. X    if (cur_elltextangle <= -360.0 || cur_elltextangle >= 360)
  1870. X    cur_elltextangle = 0.0;
  1871. X
  1872. X    put_msg("Text/Ellipse angle %.1f", cur_elltextangle);
  1873. X    if (cur_elltextangle == old_elltextangle)
  1874. X    return;
  1875. X
  1876. X    /* write the text/ellipse angle in the background pixmap */
  1877. X    indbuf[0]=indbuf[1]=indbuf[2]=indbuf[3]=indbuf[4]=indbuf[5]=' ';
  1878. X    sprintf(indbuf, "%5.1f", cur_elltextangle);
  1879. X    update_string_pixmap(sw, indbuf, sw->sw_width - 40, 26);
  1880. X    old_elltextangle = cur_elltextangle;
  1881. X}
  1882. X
  1883. X/* ROTATION ANGLE */
  1884. X
  1885. Xstatic
  1886. Xinc_rotnangle(sw)
  1887. X    ind_sw_info       *sw;
  1888. X{
  1889. X    if (cur_rotnangle < 30 || cur_rotnangle >= 120)
  1890. X    cur_rotnangle = 30;
  1891. X    else if (cur_rotnangle < 45)
  1892. X    cur_rotnangle = 45;
  1893. X    else if (cur_rotnangle < 60)
  1894. X    cur_rotnangle = 60;
  1895. X    else if (cur_rotnangle < 90)
  1896. X    cur_rotnangle = 90;
  1897. X    else if (cur_rotnangle < 120)
  1898. X    cur_rotnangle = 120;
  1899. X    show_rotnangle(sw);
  1900. X}
  1901. X
  1902. Xstatic
  1903. Xdec_rotnangle(sw)
  1904. X    ind_sw_info       *sw;
  1905. X{
  1906. X    if (cur_rotnangle > 120 || cur_rotnangle <= 30)
  1907. X    cur_rotnangle = 120;
  1908. X    else if (cur_rotnangle > 90)
  1909. X    cur_rotnangle = 90;
  1910. X    else if (cur_rotnangle > 60)
  1911. X    cur_rotnangle = 60;
  1912. X    else if (cur_rotnangle > 45)
  1913. X    cur_rotnangle = 45;
  1914. X    else if (cur_rotnangle > 30)
  1915. X    cur_rotnangle = 30;
  1916. X    show_rotnangle(sw);
  1917. X}
  1918. X
  1919. Xstatic
  1920. Xshow_rotnangle(sw)
  1921. X    ind_sw_info       *sw;
  1922. X{
  1923. X    if (cur_rotnangle < 1)
  1924. X    cur_rotnangle = 1;
  1925. X    else if (cur_rotnangle > 180)
  1926. X    cur_rotnangle = 180;
  1927. X
  1928. X    put_msg("Angle of rotation %d", cur_rotnangle);
  1929. X    if (cur_rotnangle == old_rotnangle)
  1930. X    return;
  1931. X
  1932. X    /* write the rotation angle in the background pixmap */
  1933. X    indbuf[0] = indbuf[1] = indbuf[2] = indbuf[3] = indbuf[4] = '\0';
  1934. X    sprintf(indbuf, "%3d", cur_rotnangle);
  1935. X    update_string_pixmap(sw, indbuf, sw->sw_width - 22, 20);
  1936. X
  1937. X    /* change markers if we changed to or from 90 degrees (except at start) */
  1938. X    if (old_rotnangle != -1) {
  1939. X    if (cur_rotnangle == 90)
  1940. X        update_markers(M_ALL);
  1941. X    else if (old_rotnangle == 90)
  1942. X        update_markers(M_ROTATE_ANGLE);
  1943. X    }
  1944. X    old_rotnangle = cur_rotnangle;
  1945. X}
  1946. X
  1947. X/* NUMSIDES */
  1948. X
  1949. Xstatic
  1950. Xinc_numsides(sw)
  1951. X    ind_sw_info       *sw;
  1952. X{
  1953. X    cur_numsides++;
  1954. X    show_numsides(sw);
  1955. X}
  1956. X
  1957. Xstatic
  1958. Xdec_numsides(sw)
  1959. X    ind_sw_info       *sw;
  1960. X{
  1961. X    cur_numsides--;
  1962. X    show_numsides(sw);
  1963. X}
  1964. X
  1965. Xstatic
  1966. Xshow_numsides(sw)
  1967. X    ind_sw_info       *sw;
  1968. X{
  1969. X    if (cur_numsides < 3)
  1970. X    cur_numsides = 3;
  1971. X    else if (cur_numsides > 99)
  1972. X    cur_numsides = 99;
  1973. X
  1974. X    put_msg("Number of sides %2d", cur_numsides);
  1975. X    /* write the font size in the background pixmap */
  1976. X    indbuf[0] = indbuf[1] = indbuf[2] = indbuf[3] = indbuf[4] = '\0';
  1977. X    sprintf(indbuf, "%2d", cur_numsides);
  1978. X    update_string_pixmap(sw, indbuf, sw->sw_width - 18, 20);
  1979. X}
  1980. X
  1981. X/* ZOOM */
  1982. X
  1983. Xstatic
  1984. Xinc_zoom(sw)
  1985. X    ind_sw_info       *sw;
  1986. X{
  1987. X    if (zoomscale < 1.0)
  1988. X    {
  1989. X    zoomscale = (int)(zoomscale*4.0)/4.0 + 0.25;
  1990. X    if (zoomscale > 1.0)
  1991. X        zoomscale = 1.0;
  1992. X    }
  1993. X    else
  1994. X    zoomscale = (int)zoomscale + 1.0;
  1995. X    show_zoom(sw);
  1996. X}
  1997. X
  1998. Xstatic
  1999. Xdec_zoom(sw)
  2000. X    ind_sw_info       *sw;
  2001. X{
  2002. X    if (zoomscale <= 1.0)    /* keep to 0.25 increments */
  2003. X    zoomscale = (int)((zoomscale+0.23)*4.0)/4.0 - 0.25;
  2004. X    else
  2005. X    {
  2006. X    zoomscale = (int)zoomscale - 1.0;
  2007. X    if (zoomscale < 1.0)
  2008. X        zoomscale = 1.0;
  2009. X    }
  2010. X    show_zoom(sw);
  2011. X}
  2012. X
  2013. Xshow_zoom(sw)
  2014. X    ind_sw_info       *sw;
  2015. X{
  2016. X    if (zoomscale < 0.1)
  2017. X    zoomscale = 0.1;
  2018. X    else if (zoomscale > 10.0)
  2019. X    zoomscale = 10.0;
  2020. X
  2021. X    put_msg("Zoom scale %.2f", zoomscale);
  2022. X    if (zoomscale == old_zoomscale)
  2023. X    return;
  2024. X
  2025. X    /* write the font size in the background pixmap */
  2026. X    indbuf[0] = indbuf[1] = indbuf[2] = indbuf[3] = indbuf[4] = '\0';
  2027. X    if (zoomscale == (int) zoomscale)
  2028. X    sprintf(indbuf, " %.0f  ", zoomscale);
  2029. X    else
  2030. X    sprintf(indbuf, "%.2f", zoomscale);
  2031. X    update_string_pixmap(sw, indbuf, sw->sw_width - 24, 14);
  2032. X
  2033. X    /* fix up the rulers and grid */
  2034. X    reset_rulers();
  2035. X    redisplay_rulers();
  2036. X    /* reload text objects' font structures since we need 
  2037. X    to load larger/smaller fonts */
  2038. X    reload_text_fstructs();
  2039. X    setup_grid(cur_gridmode);
  2040. X    old_zoomscale = zoomscale;
  2041. X}
  2042. X
  2043. X/* DEPTH */
  2044. X
  2045. Xstatic
  2046. Xinc_depth(sw)
  2047. X    ind_sw_info       *sw;
  2048. X{
  2049. X    cur_depth++;
  2050. X    show_depth(sw);
  2051. X}
  2052. X
  2053. Xstatic
  2054. Xdec_depth(sw)
  2055. X    ind_sw_info       *sw;
  2056. X{
  2057. X    cur_depth--;
  2058. X    show_depth(sw);
  2059. X}
  2060. X
  2061. Xshow_depth(sw)
  2062. X    ind_sw_info       *sw;
  2063. X{
  2064. X    if (cur_depth < 0)
  2065. X    cur_depth = 0;
  2066. X    else if (cur_depth > MAXDEPTH)
  2067. X    cur_depth = MAXDEPTH;
  2068. X
  2069. X    put_msg("Depth %3d", cur_depth);
  2070. X
  2071. X    /* write the font size in the background pixmap */
  2072. X    indbuf[0] = indbuf[1] = indbuf[2] = indbuf[3] = indbuf[4] = '\0';
  2073. X    sprintf(indbuf, "%3d", cur_depth);
  2074. X    update_string_pixmap(sw, indbuf, sw->sw_width - 22, 20);
  2075. X}
  2076. X
  2077. X/* TEXTSTEP */
  2078. X
  2079. Xstatic
  2080. Xinc_textstep(sw)
  2081. X    ind_sw_info       *sw;
  2082. X{
  2083. X    if (cur_textstep >= 10.0) {
  2084. X    cur_textstep = (int) cur_textstep;    /* round first */
  2085. X    cur_textstep += 1.0;
  2086. X    } else if (cur_textstep >= 5.0) {
  2087. X    cur_textstep = ((int)(cur_textstep*2.0+0.01))/2.0;
  2088. X    cur_textstep += 0.5;
  2089. X    } else if (cur_textstep >= 2.0) {
  2090. X    cur_textstep = ((int)(cur_textstep*5.0+0.01))/5.0;
  2091. X    cur_textstep += 0.2;
  2092. X    } else
  2093. X    cur_textstep += 0.1;
  2094. X    show_textstep(sw);
  2095. X}
  2096. X
  2097. Xstatic
  2098. Xdec_textstep(sw)
  2099. X    ind_sw_info       *sw;
  2100. X{
  2101. X    if (cur_textstep > 10.0) {
  2102. X    cur_textstep = (int)cur_textstep;    /* round first */
  2103. X    cur_textstep -= 1.0;
  2104. X    } else if (cur_textstep > 5.0) {
  2105. X    cur_textstep = ((int)(cur_textstep*2.0+0.01))/2.0;
  2106. X    cur_textstep -= 0.5;
  2107. X    } else if (cur_textstep > 2.0) {
  2108. X    cur_textstep = ((int)(cur_textstep*5.0+0.01))/5.0;
  2109. X    cur_textstep -= 0.2;
  2110. X    } else if (cur_textstep > 0.4)
  2111. X    cur_textstep -= 0.1;
  2112. X    show_textstep(sw);
  2113. X}
  2114. X
  2115. X/* could make this more generic - but a copy will do for font set JNT */
  2116. Xstatic
  2117. Xshow_textstep(sw)
  2118. X    ind_sw_info       *sw;
  2119. X{
  2120. X    if (cur_textstep < 0)
  2121. X    cur_textstep = 0;
  2122. X    else if (cur_textstep > 99.0)
  2123. X    cur_textstep = 99.0;
  2124. X
  2125. X    put_msg("Text step %.1f", cur_textstep);
  2126. X    /* write the font size in the background pixmap */
  2127. X    indbuf[0] = indbuf[1] = indbuf[2] = indbuf[3] = indbuf[4] = '\0';
  2128. X    sprintf(indbuf, "%4.1f", cur_textstep);
  2129. X    update_string_pixmap(sw, indbuf, sw->sw_width - 28, 20);
  2130. X}
  2131. END_OF_FILE
  2132. if test 58921 -ne `wc -c <'w_indpanel.c'`; then
  2133.     echo shar: \"'w_indpanel.c'\" unpacked with wrong size!
  2134. fi
  2135. # end of 'w_indpanel.c'
  2136. fi
  2137. echo shar: End of archive 23 \(of 27\).
  2138. cp /dev/null ark23isdone
  2139. MISSING=""
  2140. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ; do
  2141.     if test ! -f ark${I}isdone ; then
  2142.     MISSING="${MISSING} ${I}"
  2143.     fi
  2144. done
  2145. if test "${MISSING}" = "" ; then
  2146.     echo You have unpacked all 27 archives.
  2147.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2148. else
  2149.     echo You still need to unpack the following archives:
  2150.     echo "        " ${MISSING}
  2151. fi
  2152. ##  End of shell archive.
  2153. exit 0
  2154.  
  2155. exit 0 # Just in case...
  2156. -- 
  2157.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  2158. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  2159.  "It's intuitively obvious to the |
  2160.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  2161.