~ubuntu-branches/ubuntu/raring/xfig/raring

« back to all changes in this revision

Viewing changes to w_mousefun.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2007-05-20 23:33:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070520233359-4ejk0ave70m2ihlz
Tags: 1:3.2.5-rel-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu change:
  - .desktop added.
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#define MOUSEFUN_MAX                   20
37
37
 
38
38
/* Function Prototypes */
39
 
static void     reset_mousefun();
 
39
static void     reset_mousefun(void);
40
40
 
41
41
DeclareStaticArgs(18);
42
42
static char     mousefun_l[MOUSEFUN_MAX];
56
56
 
57
57
#ifndef XAW3D1_5E
58
58
/* popup message over button when mouse enters it */
59
 
static void     mouse_balloon_trigger();
60
 
static void     mouse_unballoon();
 
59
static void     mouse_balloon_trigger(Widget widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch);
 
60
static void     mouse_unballoon(Widget widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch);
61
61
#endif /* XAW3D1_5E */
62
62
 
 
63
 
 
64
void mouse_title (void);
 
65
 
63
66
void
64
 
init_mousefun(tool)
65
 
    Widget          tool;
 
67
init_mousefun(Widget tool)
66
68
{
67
69
    /* start with nominal height and adjust later */
68
70
    FirstArg(XtNheight, MSGPANEL_HT);
97
99
/* widgets are realized and windows exist at this point */
98
100
 
99
101
void
100
 
setup_mousefun()
 
102
setup_mousefun(void)
101
103
{
102
104
    XDefineCursor(tool_d, XtWindow(mousefun), arrow_cursor);
103
105
    /* now that the message panel has the real height it needs (because of
112
114
}
113
115
 
114
116
#ifdef XAW3D1_5E
115
 
update_mousepanel()
 
117
void update_mousepanel()
116
118
{
117
119
    if (mousefun)
118
120
        if (appres.showballoons)
129
131
static  XtIntervalId balloon_id = (XtIntervalId) 0;
130
132
static  Widget balloon_w;
131
133
 
132
 
static void mouse_balloon();
 
134
static void mouse_balloon(void);
133
135
 
134
136
static void
135
 
mouse_balloon_trigger(widget, closure, event, continue_to_dispatch)
136
 
    Widget        widget;
137
 
    XtPointer     closure;
138
 
    XEvent*       event;
139
 
    Boolean*      continue_to_dispatch;
 
137
mouse_balloon_trigger(Widget widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch)
140
138
{
141
139
        if (!appres.showballoons)
142
140
                return;
146
144
}
147
145
 
148
146
static void
149
 
mouse_balloon()
 
147
mouse_balloon(void)
150
148
{
151
149
        Position  x, y;
152
150
        XtWidgetGeometry xtgeom,comp;
187
185
/* come here when the mouse leaves a button in the mouse panel */
188
186
 
189
187
static void
190
 
mouse_unballoon(widget, closure, event, continue_to_dispatch)
191
 
    Widget          widget;
192
 
    XtPointer       closure;
193
 
    XEvent*         event;
194
 
    Boolean*        continue_to_dispatch;
 
188
mouse_unballoon(Widget widget, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch)
195
189
{
196
190
    if (balloon_id) 
197
191
        XtRemoveTimeOut(balloon_id);
204
198
#endif /* XAW3D1_5E */
205
199
 
206
200
static void
207
 
reset_mousefun()
 
201
reset_mousefun(void)
208
202
{
209
203
    /* get the foreground and background from the mousefun widget */
210
204
    /* and create a gc with those values */
266
260
 
267
261
static char *title = "Mouse Buttons";
268
262
 
269
 
mouse_title()
 
263
void mouse_title(void)
270
264
{
271
265
    /* put a title in the window */
272
266
    XDrawImageString(tool_d, mousefun_pm, mouse_button_gc,
278
272
}
279
273
 
280
274
void
281
 
resize_mousefun()
 
275
resize_mousefun(void)
282
276
{
283
277
    XFreePixmap(tool_d, mousefun_pm);
284
278
    reset_mousefun();
285
279
}
286
280
 
287
281
void
288
 
set_mousefun(left, middle, right, sh_left, sh_middle, sh_right)
289
 
    char   *left, *middle, *right;
290
 
    char   *sh_left, *sh_middle, *sh_right;
 
282
set_mousefun(char *left, char *middle, char *right, char *sh_left, char *sh_middle, char *sh_right)
291
283
{
292
284
    strcpy(mousefun_l, left);
293
285
    strcpy(mousefun_m, middle);
301
293
#define KBD_POS_Y 1
302
294
 
303
295
void
304
 
draw_mousefun_kbd()
 
296
draw_mousefun_kbd(void)
305
297
{
306
298
    if (keybd_pm == 0) {
307
299
        keybd_pm = XCreatePixmapFromBitmapData(tool_d, canvas_win, 
319
311
}
320
312
 
321
313
void
322
 
clear_mousefun_kbd()
 
314
clear_mousefun_kbd(void)
323
315
{
324
316
    XFillRectangle(tool_d, mousefun_pm, mouse_blank_gc,
325
317
              MOUSEFUN_WD-10-kbd_ic.width, KBD_POS_Y, 
331
323
}
332
324
 
333
325
void
334
 
draw_mousefun_mode()
 
326
draw_mousefun_mode(void)
335
327
{
336
328
    draw_mousefun("Change Mode", "", "");
337
329
}
338
330
 
339
331
void
340
 
draw_mousefun_ind()
 
332
draw_mousefun_ind(void)
341
333
{
342
334
    draw_mousefun("Menu", "Dec/Prev", "Inc/Next");
343
335
}
344
336
 
345
337
void
346
 
draw_mousefun_unitbox()
 
338
draw_mousefun_unitbox(void)
347
339
{
348
340
    draw_mousefun("Pan to Origin", "", "Set Units/Scale");
349
341
}
350
342
 
351
343
void
352
 
draw_mousefun_topruler(w, event, params, num_params)
353
 
Widget w;
354
 
XEvent *event;
355
 
String *params;
356
 
Cardinal *num_params;
 
344
draw_mousefun_topruler(Widget w, XEvent *event, String *params, Cardinal *num_params)
357
345
{
358
346
    if (event->type == KeyPress) {
359
347
        KeySym      key;
366
354
}
367
355
 
368
356
void
369
 
draw_mousefun_sideruler(w, event, params, num_params)
370
 
Widget w;
371
 
XEvent *event;
372
 
String *params;
373
 
Cardinal *num_params;
 
357
draw_mousefun_sideruler(Widget w, XEvent *event, String *params, Cardinal *num_params)
374
358
{
375
359
    if (event->type == KeyPress) {
376
360
        KeySym      key;
383
367
}
384
368
 
385
369
void
386
 
draw_shift_mousefun_canvas()
 
370
draw_shift_mousefun_canvas(void)
387
371
{
388
372
    draw_mousefun(mousefun_sh_l, mousefun_sh_m, mousefun_sh_r);
389
373
}
390
374
 
391
375
void
392
 
draw_shift_mousefun_canvas2(tl, tm, tr)
393
 
    char *tl, *tm, *tr;
 
376
draw_shift_mousefun_canvas2(char *tl, char *tm, char *tr)
394
377
{
395
378
    if (!tl)
396
379
      tl = mousefun_sh_l;
402
385
}
403
386
 
404
387
void
405
 
draw_mousefun_canvas()
 
388
draw_mousefun_canvas(void)
406
389
{
407
390
    draw_mousefun(mousefun_l, mousefun_m, mousefun_r);
408
391
}
409
392
 
410
393
static void
411
 
draw_mousefun_msg(s, xctr, ypos)
412
 
    char           *s;
413
 
    int             xctr, ypos;
 
394
draw_mousefun_msg(char *s, int xctr, int ypos)
414
395
{
415
396
    int             width;
416
397
 
424
405
static char     mousefun_cur_r[MOUSEFUN_MAX];
425
406
 
426
407
void
427
 
draw_mousefun(left, middle, right)
428
 
    char     *left, *middle, *right;
 
408
draw_mousefun(char *left, char *middle, char *right)
429
409
{
430
410
  if (strcmp(left, mousefun_cur_l)
431
411
      || strcmp(middle, mousefun_cur_m)
438
418
#define MOUSE_LR_Y 32
439
419
#define MOUSE_MID_Y 10
440
420
void
441
 
draw_mousefn2(left, middle, right)
442
 
    char     *left, *middle, *right;
 
421
draw_mousefn2(char *left, char *middle, char *right)
443
422
{
444
423
  if (strcmp(left, mousefun_cur_l)
445
424
      || strcmp(middle, mousefun_cur_m)
458
437
}
459
438
 
460
439
void
461
 
notused_middle()
 
440
notused_middle(void)
462
441
{
463
442
    draw_mousefun_msg("Not Used", MOUSE_MID_CTR, MOUSE_MID_Y);
464
443
    FirstArg(XtNbackgroundPixmap, 0);
468
447
}
469
448
 
470
449
void
471
 
clear_middle()
 
450
clear_middle(void)
472
451
{
473
452
    draw_mousefun_msg(mid_blank, MOUSE_MID_CTR, MOUSE_MID_Y);
474
453
    FirstArg(XtNbackgroundPixmap, 0);
478
457
}
479
458
 
480
459
void
481
 
notused_right()
 
460
notused_right(void)
482
461
{
483
462
    draw_mousefun_msg("Not Used", MOUSE_RIGHT, MOUSE_LR_Y);
484
463
    FirstArg(XtNbackgroundPixmap, 0);
488
467
}
489
468
 
490
469
void
491
 
clear_right()
 
470
clear_right(void)
492
471
{
493
472
    draw_mousefun_msg(mid_blank, MOUSE_RIGHT, MOUSE_LR_Y);
494
473
    FirstArg(XtNbackgroundPixmap, 0);
498
477
}
499
478
 
500
479
void
501
 
clear_mousefun()
 
480
clear_mousefun(void)
502
481
{
503
482
    draw_mousefn2(lr_blank, mid_blank, lr_blank);
504
483
    /* redraw the title in case the blanks overwrite it */
518
497
static Boolean  actions_added=False;
519
498
 
520
499
void
521
 
init_kbd_actions()
 
500
init_kbd_actions(void)
522
501
{
523
502
    if (!actions_added) {
524
503
        actions_added = True;