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