~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/ui/widget/ruler.cpp

  • Committer: JazzyNico
  • Date: 2011-08-29 20:25:30 UTC
  • Revision ID: nicoduf@yahoo.fr-20110829202530-6deuoz11q90usldv
Code refactoring and merging with trunk (revision 10599).

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Authors:
7
7
 *   Ralf Stephan <ralf@ark.in-berlin.de>
8
8
 *   Lauris Kaplinski
 
9
 *   Jon A. Cruz <jon@joncruz.org>
 
10
 *   Abhishek Sharma
9
11
 *
10
12
 * Copyright (C) 2005 Ralf Stephan
11
13
 *
24
26
#include "ui/widget/ruler.h"
25
27
 
26
28
#include "xml/repr.h"
 
29
#include "display/sp-canvas.h"
27
30
#include "display/guideline.h"
28
31
#include "desktop.h"
29
32
#include "desktop-handles.h"
99
102
{
100
103
    g_assert(_dt);
101
104
    Geom::Point const &event_dt = get_event_dt();
102
 
    Inkscape::XML::Node *repr = SP_OBJECT_REPR(_dt->namedview);
 
105
    Inkscape::XML::Node *repr = _dt->namedview->getRepr();
103
106
 
104
107
    if (evb->button == 1) {
105
108
        _dragging = true;
106
109
        sp_repr_set_boolean(repr, "showguides", TRUE);
107
110
        sp_repr_set_boolean(repr, "inkscape:guide-bbox", TRUE);
108
 
        _guide = sp_guideline_new(_dt->guides, event_dt, _horiz_f ? Geom::Point(0.,1.) : Geom::Point(1.,0.));
 
111
        _guide = sp_guideline_new(_dt->guides, NULL, event_dt, _horiz_f ? Geom::Point(0.,1.) : Geom::Point(1.,0.));
109
112
        sp_guideline_set_color(SP_GUIDELINE(_guide), _dt->namedview->guidehicolor);
110
113
        (void) get_window()->pointer_grab(false,
111
114
                        Gdk::BUTTON_RELEASE_MASK |
145
148
        _dragging = false;
146
149
 
147
150
        if ( (_horiz_f ? wy : wx ) >= 0 ) {
148
 
            Inkscape::XML::Document *xml_doc = sp_document_repr_doc(_dt->doc());
 
151
            Inkscape::XML::Document *xml_doc = _dt->doc()->getReprDoc();
149
152
            Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
150
153
            repr->setAttribute("orientation", _horiz_f ? "horizontal" : "vertical");
151
154
            double const guide_pos_dt = event_dt[ _horiz_f ? Geom::Y : Geom::X ];
152
155
            sp_repr_set_svg_double(repr, "position", guide_pos_dt);
153
 
            SP_OBJECT_REPR(_dt->namedview)->appendChild(repr);
 
156
            _dt->namedview->getRepr()->appendChild(repr);
154
157
            Inkscape::GC::release(repr);
155
 
            sp_document_done(sp_desktop_document(_dt), SP_VERB_NONE, 
156
 
                             /* TODO: annotate */ "ruler.cpp:157");
 
158
            DocumentUndo::done(sp_desktop_document(_dt), SP_VERB_NONE, 
 
159
                               /* TODO: annotate */ "ruler.cpp:157");
157
160
        }
158
161
        _dt->set_coordinate_status(event_dt);
159
162
    }
197
200
  fill-column:99
198
201
  End:
199
202
*/
200
 
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
 
203
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :