]> git.donarmstrong.com Git - xournal.git/blob - src/xo-misc.h
Image patch
[xournal.git] / src / xo-misc.h
1 /*
2  *  This program is free software; you can redistribute it and/or
3  *  modify it under the terms of the GNU General Public
4  *  License as published by the Free Software Foundation; either
5  *  version 2 of the License, or (at your option) any later version.
6  *
7  *  This software is distributed in the hope that it will be useful,
8  *  but WITHOUT ANY WARRANTY; without even the implied warranty of  
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  *  General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License
13  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
14  */
15
16 // data manipulation misc functions
17
18 struct Page *new_page(struct Page *template);
19 struct Page *new_page_with_bg(struct Background *bg, double width, double height);
20 void set_current_page(gdouble *pt);
21 void realloc_cur_path(int n);
22 void realloc_cur_widths(int n);
23 void clear_redo_stack(void);
24 void clear_undo_stack(void);
25 void prepare_new_undo(void);
26 void delete_journal(struct Journal *j);
27 void delete_page(struct Page *pg);
28 void delete_layer(struct Layer *l);
29
30 // referenced strings
31
32 struct Refstring *new_refstring(const char *s);
33 struct Refstring *refstring_ref(struct Refstring *rs);
34 void refstring_unref(struct Refstring *rs);
35
36 // helper functions
37
38 int finite_sized(double x);
39 void get_pointer_coords(GdkEvent *event, double *ret);
40 void get_current_pointer_coords(double *ret);
41 double get_pressure_multiplier(GdkEvent *event);
42 void fix_xinput_coords(GdkEvent *event);
43 void update_item_bbox(struct Item *item);
44 void make_page_clipbox(struct Page *pg);
45 void make_canvas_items(void);
46 void make_canvas_item_one(GnomeCanvasGroup *group, struct Item *item);
47 void update_canvas_bg(struct Page *pg);
48 gboolean is_visible(struct Page *pg);
49 void rescale_bg_pixmaps(void);
50
51 gboolean have_intersect(struct BBox *a, struct BBox *b);
52 void lower_canvas_item_to(GnomeCanvasGroup *g, GnomeCanvasItem *item, GnomeCanvasItem *after);
53
54 void rgb_to_gdkcolor(guint rgba, GdkColor *color);
55 guint32 gdkcolor_to_rgba(GdkColor gdkcolor, guint16 alpha);
56
57 // interface misc functions
58
59 void update_thickness_buttons(void);
60 void update_color_buttons(void);
61 void update_tool_buttons(void);
62 void update_tool_menu(void);
63 void update_ruler_indicator(void);
64 void update_color_menu(void);
65 void update_pen_props_menu(void);
66 void update_eraser_props_menu(void);
67 void update_highlighter_props_menu(void);
68 void update_mappings_menu_linkings(void);
69 void update_mappings_menu(void);
70 void update_page_stuff(void);
71 void update_toolbar_and_menu(void);
72 void update_file_name(char *filename);
73 void update_undo_redo_enabled(void);
74 void update_copy_paste_enabled(void);
75 void update_vbox_order(int *order);
76
77 gchar *make_cur_font_name(void);
78 void update_font_button(void);
79
80 void update_mapping_linkings(int toolno);
81 void do_switch_page(int pg, gboolean rescroll, gboolean refresh_all);
82 void set_cur_color(int color_no, guint color_rgba);
83 void recolor_temp_text(int color_no, guint color_rgba);
84 void process_color_activate(GtkMenuItem *menuitem, int color_no, guint color_rgba);
85 void process_thickness_activate(GtkMenuItem *menuitem, int tool, int val);
86 void process_papercolor_activate(GtkMenuItem *menuitem, int color, guint rgba);
87 void process_paperstyle_activate(GtkMenuItem *menuitem, int style);
88
89 gboolean ok_to_close(void);
90
91 void reset_focus(void);
92
93 // selection / clipboard stuff
94
95 void reset_selection(void);
96 void move_journal_items_by(GList *itemlist, double dx, double dy,
97                            struct Layer *l1, struct Layer *l2, GList *depths);
98 void resize_journal_items_by(GList *itemlist, double scaling_x, double scaling_y,
99                              double offset_x, double offset_y);
100
101
102 // switch between mappings
103
104 void switch_mapping(int m);
105 void process_mapping_activate(GtkMenuItem *menuitem, int m, int tool);
106
107 // always allow accels
108 void allow_all_accels(void);
109 gboolean can_accel(GtkWidget *widget, guint id, gpointer data);
110 void add_scroll_bindings(void);
111
112 gboolean is_event_within_textview(GdkEventButton *event);
113
114 void hide_unimplemented(void);
115
116 void do_fullscreen(gboolean active);
117
118 // fix GTK+ 2.16/2.17 issues with XInput events
119 gboolean filter_extended_events(GtkWidget *widget, GdkEvent *event, gpointer user_data);
120 // gboolean fix_extended_events(GtkWidget *widget, GdkEvent *event, gpointer user_data);
121
122 // help with focus
123 gboolean handle_activate_signal(GtkWidget *widget, gpointer user_data);
124 void unset_flags(GtkWidget *w, gpointer flag);
125 gboolean intercept_activate_events(GtkWidget *w, GdkEvent *ev, gpointer data);
126 void install_focus_hooks(GtkWidget *w, gpointer data);
127
128 // wrapper for a function no longer provided by poppler 0.17+
129 void
130 wrapper_poppler_page_render_to_pixbuf (PopplerPage *page,
131                                int src_x, int src_y,
132                                int src_width, int src_height,
133                                double scale,
134                                int rotation,
135                                GdkPixbuf *pixbuf);
136
137 // defines for paper rulings
138
139 #define RULING_MARGIN_COLOR 0xff0080ff
140 #define RULING_COLOR 0x40a0ffff
141 #define RULING_THICKNESS 0.5
142 #define RULING_LEFTMARGIN 72.0
143 #define RULING_TOPMARGIN 80.0
144 #define RULING_SPACING 24.0
145 #define RULING_BOTTOMMARGIN RULING_SPACING
146 #define RULING_GRAPHSPACING 14.17