1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis 3 * 4 * GimpTextTool 5 * Copyright (C) 2002-2010 Sven Neumann <sven@gimp.org> 6 * Daniel Eddeland <danedde@svn.gnome.org> 7 * Michael Natterer <mitch@gimp.org> 8 * 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program. If not, see <https://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef __GIMP_TEXT_TOOL_H__ 24 #define __GIMP_TEXT_TOOL_H__ 25 26 27 #include "gimpdrawtool.h" 28 29 30 #define GIMP_TYPE_TEXT_TOOL (gimp_text_tool_get_type ()) 31 #define GIMP_TEXT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TEXT_TOOL, GimpTextTool)) 32 #define GIMP_IS_TEXT_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TEXT_TOOL)) 33 #define GIMP_TEXT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TEXT_TOOL, GimpTextToolClass)) 34 #define GIMP_IS_TEXT_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TEXT_TOOL)) 35 36 #define GIMP_TEXT_TOOL_GET_OPTIONS(t) (GIMP_TEXT_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t)))) 37 38 39 typedef struct _GimpTextTool GimpTextTool; 40 typedef struct _GimpTextToolClass GimpTextToolClass; 41 42 struct _GimpTextTool 43 { 44 GimpDrawTool parent_instance; 45 46 GimpText *proxy; 47 GList *pending; 48 guint idle_id; 49 50 gboolean moving; 51 52 GimpTextBuffer *buffer; 53 54 GimpText *text; 55 GimpTextLayer *layer; 56 GimpImage *image; 57 58 GtkWidget *confirm_dialog; 59 GimpUIManager *ui_manager; 60 61 gboolean handle_rectangle_change_complete; 62 gboolean text_box_fixed; 63 64 GimpTextLayout *layout; 65 gint drawing_blocked; 66 67 GimpToolWidget *widget; 68 GimpToolWidget *grab_widget; 69 70 /* text editor state: */ 71 72 GtkWidget *style_overlay; 73 GtkWidget *style_editor; 74 75 gboolean selecting; 76 GtkTextIter select_start_iter; 77 gboolean select_words; 78 gboolean select_lines; 79 80 GtkIMContext *im_context; 81 gboolean needs_im_reset; 82 83 gboolean preedit_active; 84 gchar *preedit_string; 85 gint preedit_cursor; 86 GtkTextMark *preedit_start; 87 GtkTextMark *preedit_end; 88 89 gboolean overwrite_mode; 90 gint x_pos; 91 92 GtkWidget *offscreen_window; 93 GtkWidget *proxy_text_view; 94 95 GtkWidget *editor_dialog; 96 }; 97 98 struct _GimpTextToolClass 99 { 100 GimpDrawToolClass parent_class; 101 }; 102 103 104 void gimp_text_tool_register (GimpToolRegisterCallback callback, 105 gpointer data); 106 107 GType gimp_text_tool_get_type (void) G_GNUC_CONST; 108 109 gboolean gimp_text_tool_set_layer (GimpTextTool *text_tool, 110 GimpLayer *layer); 111 112 gboolean gimp_text_tool_get_has_text_selection (GimpTextTool *text_tool); 113 114 void gimp_text_tool_delete_selection (GimpTextTool *text_tool); 115 void gimp_text_tool_cut_clipboard (GimpTextTool *text_tool); 116 void gimp_text_tool_copy_clipboard (GimpTextTool *text_tool); 117 void gimp_text_tool_paste_clipboard (GimpTextTool *text_tool); 118 119 void gimp_text_tool_create_vectors (GimpTextTool *text_tool); 120 void gimp_text_tool_create_vectors_warped (GimpTextTool *text_tool); 121 122 GimpTextDirection 123 gimp_text_tool_get_direction (GimpTextTool *text_tool); 124 125 /* only for the text editor */ 126 void gimp_text_tool_clear_layout (GimpTextTool *text_tool); 127 gboolean gimp_text_tool_ensure_layout (GimpTextTool *text_tool); 128 void gimp_text_tool_apply (GimpTextTool *text_tool, 129 gboolean push_undo); 130 131 132 #endif /* __GIMP_TEXT_TOOL_H__ */ 133