2009-08-03 19:12:47 +03:00
|
|
|
/*
|
2009-08-08 22:44:17 +03:00
|
|
|
* gui_tool.h - GUI, tool bar
|
2009-08-03 19:12:47 +03:00
|
|
|
*
|
|
|
|
* Written 2009 by Werner Almesberger
|
|
|
|
* Copyright 2009 by Werner Almesberger
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-08-08 22:44:17 +03:00
|
|
|
#ifndef GUI_TOOL_H
|
|
|
|
#define GUI_TOOL_H
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2009-08-04 15:06:04 +03:00
|
|
|
#include "inst.h"
|
|
|
|
|
|
|
|
|
2009-08-08 21:50:17 +03:00
|
|
|
struct tool_ops {
|
|
|
|
void (*tool_selected)(void);
|
|
|
|
void (*tool_deselected)(void);
|
|
|
|
struct inst *(*find_point)(struct coord pos);
|
|
|
|
void (*begin_drag_new)(struct inst *from);
|
|
|
|
struct pix_buf *(*drag_new)(struct inst *from, struct coord to);
|
|
|
|
int (*end_new_raw)(struct inst *from, struct coord to);
|
|
|
|
int (*end_new)(struct inst *from, struct inst *to);
|
2009-08-10 16:51:51 +03:00
|
|
|
void (*cancel_drag_new)(void);
|
2009-08-08 21:50:17 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-08-08 17:11:26 +03:00
|
|
|
struct pix_buf *draw_move_vec(struct inst *inst, struct coord pos, int i);
|
|
|
|
struct pix_buf *draw_move_line(struct inst *inst, struct coord pos, int i);
|
|
|
|
struct pix_buf *draw_move_rect(struct inst *inst, struct coord pos, int i);
|
|
|
|
struct pix_buf *draw_move_pad(struct inst *inst, struct coord pos, int i);
|
|
|
|
struct pix_buf *draw_move_arc(struct inst *inst, struct coord pos, int i);
|
|
|
|
struct pix_buf *draw_move_meas(struct inst *inst, struct coord pos, int i);
|
|
|
|
struct pix_buf *draw_move_frame(struct inst *inst, struct coord pos, int i);
|
|
|
|
|
|
|
|
struct pix_buf *gui_hover_vec(struct inst *self);
|
|
|
|
struct pix_buf *gui_hover_frame(struct inst *self);
|
2009-08-05 00:45:33 +03:00
|
|
|
|
2009-08-10 16:51:51 +03:00
|
|
|
void do_move_to_arc(struct inst *inst, struct inst *to, int i);
|
2009-08-05 00:45:33 +03:00
|
|
|
|
2009-08-08 17:11:26 +03:00
|
|
|
void tool_dehover(void);
|
|
|
|
void tool_hover(struct coord pos);
|
|
|
|
int tool_consider_drag(struct coord pos);
|
|
|
|
void tool_drag(struct coord to);
|
|
|
|
void tool_cancel_drag(void);
|
|
|
|
int tool_end_drag(struct coord to);
|
|
|
|
void tool_redraw(void);
|
|
|
|
|
2009-08-08 21:50:17 +03:00
|
|
|
/*
|
|
|
|
* The following functions are for measurements which are now in a separate
|
|
|
|
* compilation unit.
|
|
|
|
*/
|
|
|
|
|
2009-08-12 00:54:18 +03:00
|
|
|
struct obj *new_obj_unconnected(enum obj_type type, struct inst *base);
|
|
|
|
void connect_obj(struct frame *frame, struct obj *obj);
|
2009-08-08 21:50:17 +03:00
|
|
|
struct pix_buf *draw_move_line_common(struct inst *inst,
|
|
|
|
struct coord end, struct coord pos, int i);
|
|
|
|
struct pix_buf *drag_new_line(struct inst *from, struct coord to);
|
|
|
|
|
2009-08-04 15:06:04 +03:00
|
|
|
|
2009-08-05 17:44:36 +03:00
|
|
|
/*
|
|
|
|
* Cache the frame and track it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void tool_frame_update(void);
|
|
|
|
void tool_frame_deleted(const struct frame *frame);
|
|
|
|
|
2009-08-11 23:52:33 +03:00
|
|
|
void tool_selected_inst(struct inst *inst);
|
|
|
|
|
2009-08-04 15:06:04 +03:00
|
|
|
void tool_reset(void);
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2009-08-04 10:24:13 +03:00
|
|
|
GtkWidget *gui_setup_tools(GdkDrawable *drawable);
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2009-08-08 22:44:17 +03:00
|
|
|
#endif /* !GUI_TOOL_H */
|