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