Root/gui_tool.h

Source at commit 82a12023cdc81c3a4768ac8339b28f3a561272de created 9 years 5 months ago.
By werner, I thought there was a bug in frame ordering, but it turns out that it works fine. Anyway, here's a new debug construct (%frame) and a bunch of new regression tests.
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
22struct 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
34struct pix_buf *draw_move_vec(struct inst *inst, struct coord pos, int i);
35struct pix_buf *draw_move_line(struct inst *inst, struct coord pos, int i);
36struct pix_buf *draw_move_rect(struct inst *inst, struct coord pos, int i);
37struct pix_buf *draw_move_pad(struct inst *inst, struct coord pos, int i);
38struct pix_buf *draw_move_rpad(struct inst *inst, struct coord pos, int i);
39struct pix_buf *draw_move_hole(struct inst *inst, struct coord pos, int i);
40struct pix_buf *draw_move_arc(struct inst *inst, struct coord pos, int i);
41struct pix_buf *draw_move_meas(struct inst *inst, struct coord pos, int i);
42struct pix_buf *draw_move_frame(struct inst *inst, struct coord pos, int i);
43
44struct pix_buf *gui_hover_vec(struct inst *self);
45struct pix_buf *gui_hover_frame(struct inst *self);
46
47void do_move_to_arc(struct inst *inst, struct inst *to, int i);
48
49void tool_dehover(void);
50int tool_hover(struct coord pos);
51const char *tool_tip(struct coord pos);
52int tool_consider_drag(struct coord pos);
53void tool_drag(struct coord to);
54void tool_cancel_drag(void);
55int tool_end_drag(struct coord to);
56void tool_redraw(void);
57
58/*
59 * The following functions are for measurements which are now in a separate
60 * compilation unit.
61 */
62
63struct obj *new_obj_unconnected(enum obj_type type, struct inst *base);
64void connect_obj(struct frame *frame, struct obj *obj);
65int is_parent_of(const struct frame *p, const struct frame *c);
66
67struct pix_buf *draw_move_line_common(struct inst *inst,
68    struct coord end, struct coord pos, int i);
69struct pix_buf *drag_new_line(struct inst *from, struct coord to);
70
71void tool_push_frame(struct frame *frame);
72int tool_place_frame(struct frame *frame, struct coord pos);
73void tool_pop_frame(void);
74
75void tool_selected_inst(struct inst *inst);
76
77GtkWidget *get_icon_by_inst(const struct inst *inst);
78
79void tool_reset(void);
80
81GtkWidget *gui_setup_tools(GdkDrawable *drawable);
82void gui_cleanup_tools(void);
83
84#endif /* !GUI_TOOL_H */
85

Archive Download this file

Branches:
master



interactive