Root/
| 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 | |
| 13 | |
| 14 | #ifndef GUI_TOOL_H |
| 15 | #define GUI_TOOL_H |
| 16 | |
| 17 | #include <gtk/gtk.h> |
| 18 | |
| 19 | #include "inst.h" |
| 20 | |
| 21 | |
| 22 | struct tool_ops { |
| 23 | void (*tool_selected)(void); |
| 24 | void (*tool_deselected)(void); |
| 25 | struct inst *(*find_point)(struct coord pos); |
| 26 | void (*begin_drag_new)(struct inst *from); |
| 27 | struct pix_buf *(*drag_new)(struct inst *from, struct coord to); |
| 28 | int (*end_new_raw)(struct inst *from, struct coord to); |
| 29 | int (*end_new)(struct inst *from, struct inst *to); |
| 30 | void (*cancel_drag_new)(void); |
| 31 | }; |
| 32 | |
| 33 | |
| 34 | struct pix_buf *draw_move_vec(struct inst *inst, struct coord pos, int i); |
| 35 | struct pix_buf *draw_move_line(struct inst *inst, struct coord pos, int i); |
| 36 | struct pix_buf *draw_move_rect(struct inst *inst, struct coord pos, int i); |
| 37 | struct pix_buf *draw_move_pad(struct inst *inst, struct coord pos, int i); |
| 38 | struct pix_buf *draw_move_rpad(struct inst *inst, struct coord pos, int i); |
| 39 | struct pix_buf *draw_move_hole(struct inst *inst, struct coord pos, int i); |
| 40 | struct pix_buf *draw_move_arc(struct inst *inst, struct coord pos, int i); |
| 41 | struct pix_buf *draw_move_meas(struct inst *inst, struct coord pos, int i); |
| 42 | struct pix_buf *draw_move_frame(struct inst *inst, struct coord pos, int i); |
| 43 | |
| 44 | struct pix_buf *gui_hover_vec(struct inst *self); |
| 45 | struct pix_buf *gui_hover_frame(struct inst *self); |
| 46 | |
| 47 | void do_move_to_arc(struct inst *inst, struct inst *to, int i); |
| 48 | |
| 49 | void tool_dehover(void); |
| 50 | int tool_hover(struct coord pos); |
| 51 | const char *tool_tip(struct coord pos); |
| 52 | int tool_consider_drag(struct coord pos); |
| 53 | void tool_drag(struct coord to); |
| 54 | void tool_cancel_drag(void); |
| 55 | int tool_end_drag(struct coord to); |
| 56 | void tool_redraw(void); |
| 57 | |
| 58 | /* |
| 59 | * The following functions are for measurements which are now in a separate |
| 60 | * compilation unit. |
| 61 | */ |
| 62 | |
| 63 | struct obj *new_obj_unconnected(enum obj_type type, struct inst *base); |
| 64 | void connect_obj(struct frame *frame, struct obj *obj); |
| 65 | int is_parent_of(const struct frame *p, const struct frame *c); |
| 66 | |
| 67 | struct pix_buf *draw_move_line_common(struct inst *inst, |
| 68 | struct coord end, struct coord pos, int i); |
| 69 | struct pix_buf *drag_new_line(struct inst *from, struct coord to); |
| 70 | |
| 71 | void tool_push_frame(struct frame *frame); |
| 72 | int tool_place_frame(struct frame *frame, struct coord pos); |
| 73 | void tool_pop_frame(void); |
| 74 | |
| 75 | void tool_selected_inst(struct inst *inst); |
| 76 | |
| 77 | GtkWidget *get_icon_by_inst(const struct inst *inst); |
| 78 | |
| 79 | void tool_reset(void); |
| 80 | |
| 81 | GtkWidget *gui_setup_tools(GdkDrawable *drawable); |
| 82 | void gui_cleanup_tools(void); |
| 83 | |
| 84 | #endif /* !GUI_TOOL_H */ |
| 85 |
Branches:
master
