home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume19 / xfig / part02 / e_move.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-27  |  3.3 KB  |  127 lines

  1. /*
  2.  * FIG : Facility for Interactive Generation of figures
  3.  * Copyright (c) 1985 by Supoj Sutanthavibul
  4.  *
  5.  * "Permission to use, copy, modify, distribute, and sell this software and its
  6.  * documentation for any purpose is hereby granted without fee, provided that
  7.  * the above copyright notice appear in all copies and that both the copyright
  8.  * notice and this permission notice appear in supporting documentation. 
  9.  * No representations are made about the suitability of this software for 
  10.  * any purpose.  It is provided "as is" without express or implied warranty."
  11.  */
  12.  
  13. #include "fig.h"
  14. #include "resources.h"
  15. #include "object.h"
  16. #include "paintop.h"
  17. #include "u_draw.h"
  18. #include "u_elastic.h"
  19. #include "u_list.h"
  20. #include "u_search.h"
  21. #include "w_canvas.h"
  22. #include "w_mousefun.h"
  23.  
  24. static        init_move(), init_arb_move(), init_constrained_move();
  25.  
  26. move_selected()
  27. {
  28.     set_mousefun("move object", "horiz/vert move", "");
  29.     canvas_kbd_proc = null_proc;
  30.     canvas_locmove_proc = null_proc;
  31.     init_searchproc_left(init_arb_move);
  32.     init_searchproc_middle(init_constrained_move);
  33.     canvas_leftbut_proc = object_search_left;
  34.     canvas_middlebut_proc = object_search_middle;
  35.     canvas_rightbut_proc = null_proc;
  36.     return_proc = move_selected;
  37.     set_cursor(pick9_cursor);
  38.     reset_action_on();
  39. }
  40.  
  41. static
  42. init_arb_move(p, type, x, y, px, py)
  43.     char       *p;
  44.     int            type;
  45.     int            x, y, px, py;
  46. {
  47.     constrained = MOVE_ARB;
  48.     init_move(p, type, x, y, px, py);
  49.     canvas_middlebut_proc = null_proc;
  50.     set_mousefun("place object", "", "cancel");
  51.     draw_mousefun_canvas();
  52. }
  53.  
  54. static
  55. init_constrained_move(p, type, x, y, px, py)
  56.     char       *p;
  57.     int            type;
  58.     int            x, y, px, py;
  59. {
  60.     constrained = MOVE_HORIZ_VERT;
  61.     init_move(p, type, x, y, px, py);
  62.     canvas_middlebut_proc = canvas_leftbut_proc;
  63.     canvas_leftbut_proc = null_proc;
  64.     set_mousefun("", "place object", "cancel");
  65.     draw_mousefun_canvas();
  66. }
  67.  
  68. static
  69. init_move(p, type, x, y, px, py)
  70.     char       *p;
  71.     int            type;
  72.     int            x, y, px, py;
  73. {
  74.     switch (type) {
  75.     case O_COMPOUND:
  76.     set_temp_cursor(wait_cursor);
  77.     cur_c = (F_compound *) p;
  78.     list_delete_compound(&objects.compounds, cur_c);
  79.     redisplay_compound(cur_c);
  80.     set_temp_cursor(null_cursor);
  81.     init_compounddragging(cur_c, px, py);
  82.     break;
  83.     case O_POLYLINE:
  84.     set_temp_cursor(wait_cursor);
  85.     cur_l = (F_line *) p;
  86.     list_delete_line(&objects.lines, cur_l);
  87.     redisplay_line(cur_l);
  88.     set_temp_cursor(null_cursor);
  89.     init_linedragging(cur_l, px, py);
  90.     break;
  91.     case O_TEXT:
  92.     set_temp_cursor(wait_cursor);
  93.     cur_t = (F_text *) p;
  94.     list_delete_text(&objects.texts, cur_t);
  95.     redisplay_text(cur_t);
  96.     set_temp_cursor(null_cursor);
  97.     init_textdragging(cur_t, x, y);
  98.     break;
  99.     case O_ELLIPSE:
  100.     set_temp_cursor(wait_cursor);
  101.     cur_e = (F_ellipse *) p;
  102.     list_delete_ellipse(&objects.ellipses, cur_e);
  103.     redisplay_ellipse(cur_e);
  104.     set_temp_cursor(null_cursor);
  105.     init_ellipsedragging(cur_e, px, py);
  106.     break;
  107.     case O_ARC:
  108.     set_temp_cursor(wait_cursor);
  109.     cur_a = (F_arc *) p;
  110.     list_delete_arc(&objects.arcs, cur_a);
  111.     redisplay_arc(cur_a);
  112.     set_temp_cursor(null_cursor);
  113.     init_arcdragging(cur_a, px, py);
  114.     break;
  115.     case O_SPLINE:
  116.     set_temp_cursor(wait_cursor);
  117.     cur_s = (F_spline *) p;
  118.     list_delete_spline(&objects.splines, cur_s);
  119.     redisplay_spline(cur_s);
  120.     set_temp_cursor(null_cursor);
  121.     init_splinedragging(cur_s, px, py);
  122.     break;
  123.     default:
  124.     return;
  125.     }
  126. }
  127.