gui_tool.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * gui_tool.h - GUI, tool bar
  3. *
  4. * Written 2009, 2010 by Werner Almesberger
  5. * Copyright 2009, 2010 by Werner Almesberger
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. */
  12. #ifndef GUI_TOOL_H
  13. #define GUI_TOOL_H
  14. #include <gtk/gtk.h>
  15. #include "inst.h"
  16. struct tool_ops {
  17. void (*tool_selected)(void);
  18. void (*tool_deselected)(void);
  19. struct inst *(*find_point)(struct coord pos);
  20. void (*begin_drag_new)(struct inst *from);
  21. struct pix_buf *(*drag_new)(struct inst *from, struct coord to);
  22. int (*end_new_raw)(struct inst *from, struct coord to);
  23. int (*end_new)(struct inst *from, struct inst *to);
  24. void (*cancel_drag_new)(void);
  25. };
  26. struct pix_buf *draw_move_vec(struct inst *inst, struct coord pos, int i);
  27. struct pix_buf *draw_move_line(struct inst *inst, struct coord pos, int i);
  28. struct pix_buf *draw_move_rect(struct inst *inst, struct coord pos, int i);
  29. struct pix_buf *draw_move_pad(struct inst *inst, struct coord pos, int i);
  30. struct pix_buf *draw_move_rpad(struct inst *inst, struct coord pos, int i);
  31. struct pix_buf *draw_move_hole(struct inst *inst, struct coord pos, int i);
  32. struct pix_buf *draw_move_arc(struct inst *inst, struct coord pos, int i);
  33. struct pix_buf *draw_move_meas(struct inst *inst, struct coord pos, int i);
  34. struct pix_buf *draw_move_frame(struct inst *inst, struct coord pos, int i);
  35. struct pix_buf *gui_hover_vec(struct inst *self);
  36. struct pix_buf *gui_hover_frame(struct inst *self);
  37. void do_move_to_arc(struct inst *inst, struct inst *to, int i);
  38. void tool_dehover(void);
  39. int tool_hover(struct coord pos);
  40. const char *tool_tip(struct coord pos);
  41. int tool_consider_drag(struct coord pos);
  42. void tool_drag(struct coord to);
  43. void tool_cancel_drag(void);
  44. int tool_end_drag(struct coord to);
  45. void tool_redraw(void);
  46. /*
  47. * The following functions are for measurements which are now in a separate
  48. * compilation unit.
  49. */
  50. struct obj *new_obj_unconnected(enum obj_type type, struct inst *base);
  51. void connect_obj(struct frame *frame, struct obj *obj);
  52. int is_parent_of(const struct frame *p, const struct frame *c);
  53. struct pix_buf *draw_move_line_common(struct inst *inst,
  54. struct coord end, struct coord pos, int i);
  55. struct pix_buf *drag_new_line(struct inst *from, struct coord to);
  56. void tool_push_frame(struct frame *frame);
  57. int tool_place_frame(struct frame *frame, struct coord pos);
  58. void tool_pop_frame(void);
  59. void tool_selected_inst(struct inst *inst);
  60. GtkWidget *get_icon_by_inst(const struct inst *inst);
  61. void tool_reset(void);
  62. GtkWidget *gui_setup_tools(GdkDrawable *drawable);
  63. void gui_cleanup_tools(void);
  64. #endif /* !GUI_TOOL_H */