~ubuntu-branches/ubuntu/oneiric/inkscape/oneiric-updates

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/text-context.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __SP_TEXT_CONTEXT_H__
 
2
#define __SP_TEXT_CONTEXT_H__
 
3
 
 
4
/*
 
5
 * SPTextContext
 
6
 *
 
7
 * Authors:
 
8
 *   Lauris Kaplinski <lauris@kaplinski.com>
 
9
 *   bulia byak <buliabyak@users.sf.net>
 
10
 *
 
11
 * Copyright (C) 1999-2005 authors
 
12
 * Copyright (C) 2001 Ximian, Inc.
 
13
 *
 
14
 * Released under GNU GPL, read the file 'COPYING' for more information
 
15
 */
 
16
 
 
17
/*  #include <gdk/gdkic.h> */
 
18
#include <sigc++/sigc++.h>
 
19
#include <gtk/gtkimcontext.h>
 
20
 
 
21
#include "event-context.h"
 
22
#include <display/display-forward.h>
 
23
#include <2geom/point.h>
 
24
#include "libnrtype/Layout-TNG.h"
 
25
 
 
26
#define SP_TYPE_TEXT_CONTEXT (sp_text_context_get_type ())
 
27
#define SP_TEXT_CONTEXT(obj) (GTK_CHECK_CAST ((obj), SP_TYPE_TEXT_CONTEXT, SPTextContext))
 
28
#define SP_TEXT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), SP_TYPE_TEXT_CONTEXT, SPTextContextClass))
 
29
#define SP_IS_TEXT_CONTEXT(obj) (GTK_CHECK_TYPE ((obj), SP_TYPE_TEXT_CONTEXT))
 
30
#define SP_IS_TEXT_CONTEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), SP_TYPE_TEXT_CONTEXT))
 
31
 
 
32
class SPTextContext;
 
33
class SPTextContextClass;
 
34
class SPCanvasArena;
 
35
 
 
36
struct SPTextContext : public SPEventContext {
 
37
 
 
38
    sigc::connection sel_changed_connection;
 
39
    sigc::connection sel_modified_connection;
 
40
    sigc::connection style_set_connection;
 
41
    sigc::connection style_query_connection;
 
42
 
 
43
    GtkIMContext *imc;
 
44
 
 
45
    SPItem *text; // the text we're editing, or NULL if none selected
 
46
 
 
47
    /* Text item position in root coordinates */
 
48
    Geom::Point pdoc;
 
49
    /* Insertion point position */
 
50
    Inkscape::Text::Layout::iterator text_sel_start;
 
51
    Inkscape::Text::Layout::iterator text_sel_end;
 
52
 
 
53
    gchar uni[9];
 
54
    bool unimode;
 
55
    guint unipos;
 
56
 
 
57
    SPCanvasItem *cursor;
 
58
    SPCanvasItem *indicator;
 
59
    SPCanvasItem *frame; // hiliting the first frame of flowtext; FIXME: make this a list to accommodate arbitrarily many chained shapes
 
60
    std::vector<SPCanvasItem*> text_selection_quads;
 
61
    gint timeout;
 
62
    guint show : 1;
 
63
    guint phase : 1;
 
64
    guint nascent_object : 1; // true if we're clicked on canvas to put cursor, but no text typed yet so ->text is still NULL
 
65
 
 
66
    guint over_text : 1; // true if cursor is over a text object
 
67
 
 
68
    guint dragging : 2; // dragging selection over text
 
69
 
 
70
    guint creating : 1; // dragging rubberband to create flowtext
 
71
    SPCanvasItem *grabbed; // we grab while we are creating, to get events even if the mouse goes out of the window
 
72
    Geom::Point p0; // initial point if the flowtext rect
 
73
 
 
74
    /* Preedit String */
 
75
    gchar* preedit_string;
 
76
};
 
77
 
 
78
struct SPTextContextClass {
 
79
    SPEventContextClass parent_class;
 
80
};
 
81
 
 
82
/* Standard Gtk function */
 
83
GtkType sp_text_context_get_type (void);
 
84
 
 
85
bool sp_text_paste_inline(SPEventContext *ec);
 
86
Glib::ustring sp_text_get_selected_text(SPEventContext const *ec);
 
87
SPCSSAttr *sp_text_get_style_at_cursor(SPEventContext const *ec);
 
88
bool sp_text_delete_selection(SPEventContext *ec);
 
89
void sp_text_context_place_cursor (SPTextContext *tc, SPObject *text, Inkscape::Text::Layout::iterator where);
 
90
void sp_text_context_place_cursor_at (SPTextContext *tc, SPObject *text, Geom::Point const p);
 
91
Inkscape::Text::Layout::iterator *sp_text_context_get_cursor_position(SPTextContext *tc, SPObject *text);
 
92
 
 
93
#endif