]> git.donarmstrong.com Git - xournal.git/blob - src/xo-misc.h
c4342b854e5af2147954c925c675783b5b5cb55e
[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 realloc_cur_path(int n);
21 void realloc_cur_widths(int n);
22 void clear_redo_stack(void);
23 void clear_undo_stack(void);
24 void prepare_new_undo(void);
25 void delete_journal(struct Journal *j);
26 void delete_page(struct Page *pg);
27 void delete_layer(struct Layer *l);
28
29 // referenced strings
30
31 struct Refstring *new_refstring(const char *s);
32 struct Refstring *refstring_ref(struct Refstring *rs);
33 void refstring_unref(struct Refstring *rs);
34
35 // helper functions
36
37 void get_pointer_coords(GdkEvent *event, double *ret);
38 double get_pressure_multiplier(GdkEvent *event);
39 void fix_xinput_coords(GdkEvent *event);
40 void update_item_bbox(struct Item *item);
41 void make_page_clipbox(struct Page *pg);
42 void make_canvas_items(void);
43 void make_canvas_item_one(GnomeCanvasGroup *group, struct Item *item);
44 void update_canvas_bg(struct Page *pg);
45 gboolean is_visible(struct Page *pg);
46 void rescale_bg_pixmaps(void);
47
48 gboolean have_intersect(struct BBox *a, struct BBox *b);
49 void lower_canvas_item_to(GnomeCanvasGroup *g, GnomeCanvasItem *item, GnomeCanvasItem *after);
50
51 void rgb_to_gdkcolor(guint rgba, GdkColor *color);
52 guint32 gdkcolor_to_rgba(GdkColor gdkcolor, guint16 alpha);
53
54 // interface misc functions
55
56 void update_thickness_buttons(void);
57 void update_color_buttons(void);
58 void update_tool_buttons(void);
59 void update_tool_menu(void);
60 void update_ruler_indicator(void);
61 void update_color_menu(void);
62 void update_pen_props_menu(void);
63 void update_eraser_props_menu(void);
64 void update_highlighter_props_menu(void);
65 void update_mappings_menu_linkings(void);
66 void update_mappings_menu(void);
67 void update_page_stuff(void);
68 void update_toolbar_and_menu(void);
69 void update_file_name(char *filename);
70 void update_undo_redo_enabled(void);
71 void update_copy_paste_enabled(void);
72 void update_vbox_order(int *order);
73
74 gchar *make_cur_font_name(void);
75 void update_font_button(void);
76
77 void update_mapping_linkings(int toolno);
78 void do_switch_page(int pg, gboolean rescroll, gboolean refresh_all);
79 void set_cur_color(int color_no, guint color_rgba);
80 void recolor_temp_text(int color_no, guint color_rgba);
81 void process_color_activate(GtkMenuItem *menuitem, int color_no, guint color_rgba);
82 void process_thickness_activate(GtkMenuItem *menuitem, int tool, int val);
83 void process_papercolor_activate(GtkMenuItem *menuitem, int color, guint rgba);
84 void process_paperstyle_activate(GtkMenuItem *menuitem, int style);
85
86 gboolean ok_to_close(void);
87
88 void reset_focus(void);
89
90 // selection / clipboard stuff
91
92 void reset_selection(void);
93 void move_journal_items_by(GList *itemlist, double dx, double dy,
94                            struct Layer *l1, struct Layer *l2, GList *depths);
95 void resize_journal_items_by(GList *itemlist, double scaling_x, double scaling_y,
96                              double offset_x, double offset_y);
97
98
99 // switch between mappings
100
101 void switch_mapping(int m);
102 void process_mapping_activate(GtkMenuItem *menuitem, int m, int tool);
103
104 // always allow accels
105 void allow_all_accels(void);
106 gboolean can_accel(GtkWidget *widget, guint id, gpointer data);
107 void add_scroll_bindings(void);
108
109 gboolean is_event_within_textview(GdkEventButton *event);
110
111 void hide_unimplemented(void);
112
113 void do_fullscreen(gboolean active);
114
115 // fix GTK+ 2.16/2.17 issues with XInput events
116 gboolean filter_extended_events(GtkWidget *widget, GdkEvent *event, gpointer user_data);
117 // gboolean fix_extended_events(GtkWidget *widget, GdkEvent *event, gpointer user_data);
118
119 // help with focus
120 gboolean handle_activate_signal(GtkWidget *widget, gpointer user_data);
121 void unset_flags(GtkWidget *w, gpointer flag);
122 gboolean intercept_activate_events(GtkWidget *w, GdkEvent *ev, gpointer data);
123 void install_focus_hooks(GtkWidget *w, gpointer data);
124
125 // wrapper for a function no longer provided by poppler 0.17+
126 void
127 wrapper_poppler_page_render_to_pixbuf (PopplerPage *page,
128                                int src_x, int src_y,
129                                int src_width, int src_height,
130                                double scale,
131                                int rotation,
132                                GdkPixbuf *pixbuf);
133
134 // defines for paper rulings
135
136 #define RULING_MARGIN_COLOR 0xff0080ff
137 #define RULING_COLOR 0x40a0ffff
138 #define RULING_THICKNESS 0.5
139 #define RULING_LEFTMARGIN 72.0
140 #define RULING_TOPMARGIN 80.0
141 #define RULING_SPACING 24.0
142 #define RULING_BOTTOMMARGIN RULING_SPACING
143 #define RULING_GRAPHSPACING 14.17