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
|
|
|
*
|
2010-01-02 14:55:34 +02:00
|
|
|
* Written 2009, 2010 by Werner Almesberger
|
|
|
|
* Copyright 2009, 2010 by Werner Almesberger
|
2009-08-03 19:12:47 +03:00
|
|
|
*
|
|
|
|
* 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);
|
2009-08-14 13:18:40 +03:00
|
|
|
struct pix_buf *draw_move_rpad(struct inst *inst, struct coord pos, int i);
|
2010-04-25 13:58:07 +03:00
|
|
|
struct pix_buf *draw_move_hole(struct inst *inst, struct coord pos, int i);
|
2009-08-08 17:11:26 +03:00
|
|
|
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);
|
Dragging a frame into the canvas now works. It's built on top of the frame
tool, with all the old code still around, so the code paths are a bit obscure.
- gui_frame_drag.c: use GTK_DEST_DEFAULT_MOTION instead of
GTK_DEST_DEFAULT_HIGHLIGHT
- gui_frame_drag.c: put meat on the frame and canvas drag and drop skeleton
- gui_frame_drag.c (setup_frame_drag, setup_canvas_drag): use GDK_ACTION_COPY
instead of GDK_ACTION_PRIVATE
- gui_frame_drag.h, gui_frame_drag.c (is_dragging_anything): new helper
function to check if we're dragging anything, without specifying what
- gui_canvas.h, gui_canvas.c: added thin interface layer between gui_frame.c
and gui_tool.c
- gui_canvas.c (enter_notify_event, leave_notify_event): return FALSE so that
other widgets can get the events, too
- gui_tool.h, gui_tool.c (tool_hover): return whether we found anything to
hover on
- gui_tool.h, gui_tool.c: added interface for dropping a frame on the canvas
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5932 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-25 00:46:43 +03:00
|
|
|
int tool_hover(struct coord pos);
|
2010-01-02 14:55:34 +02:00
|
|
|
const char *tool_tip(struct coord pos);
|
2009-08-08 17:11:26 +03:00
|
|
|
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);
|
2010-04-27 04:02:24 +03:00
|
|
|
int is_parent_of(const struct frame *p, const struct frame *c);
|
|
|
|
|
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);
|
|
|
|
|
Dragging a frame into the canvas now works. It's built on top of the frame
tool, with all the old code still around, so the code paths are a bit obscure.
- gui_frame_drag.c: use GTK_DEST_DEFAULT_MOTION instead of
GTK_DEST_DEFAULT_HIGHLIGHT
- gui_frame_drag.c: put meat on the frame and canvas drag and drop skeleton
- gui_frame_drag.c (setup_frame_drag, setup_canvas_drag): use GDK_ACTION_COPY
instead of GDK_ACTION_PRIVATE
- gui_frame_drag.h, gui_frame_drag.c (is_dragging_anything): new helper
function to check if we're dragging anything, without specifying what
- gui_canvas.h, gui_canvas.c: added thin interface layer between gui_frame.c
and gui_tool.c
- gui_canvas.c (enter_notify_event, leave_notify_event): return FALSE so that
other widgets can get the events, too
- gui_tool.h, gui_tool.c (tool_hover): return whether we found anything to
hover on
- gui_tool.h, gui_tool.c: added interface for dropping a frame on the canvas
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5932 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-04-25 00:46:43 +03:00
|
|
|
void tool_push_frame(struct frame *frame);
|
|
|
|
int tool_place_frame(struct frame *frame, struct coord pos);
|
|
|
|
void tool_pop_frame(void);
|
|
|
|
|
2009-08-11 23:52:33 +03:00
|
|
|
void tool_selected_inst(struct inst *inst);
|
|
|
|
|
2009-12-15 23:24:30 +02:00
|
|
|
GtkWidget *get_icon_by_inst(const 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-21 21:20:37 +03:00
|
|
|
void gui_cleanup_tools(void);
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2009-08-08 22:44:17 +03:00
|
|
|
#endif /* !GUI_TOOL_H */
|