~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/live_effects/parameter/path.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 INKSCAPE_LIVEPATHEFFECT_PARAMETER_PATH_H
 
2
#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_PATH_H
 
3
 
 
4
/*
 
5
 * Inkscape::LivePathEffectParameters
 
6
 *
 
7
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
 
8
 *
 
9
 * Released under GNU GPL, read the file 'COPYING' for more information
 
10
 */
 
11
 
 
12
#include <glib/gtypes.h>
 
13
#include <2geom/path.h>
 
14
 
 
15
#include <gtkmm/tooltips.h>
 
16
 
 
17
#include "live_effects/parameter/parameter.h"
 
18
#include "live_effects/parameter/path-reference.h"
 
19
#include <sigc++/sigc++.h>
 
20
 
 
21
namespace Inkscape {
 
22
 
 
23
namespace LivePathEffect {
 
24
 
 
25
class PathParam : public Parameter {
 
26
public:
 
27
    PathParam ( const Glib::ustring& label,
 
28
                const Glib::ustring& tip,
 
29
                const Glib::ustring& key,
 
30
                Inkscape::UI::Widget::Registry* wr,
 
31
                Effect* effect,
 
32
                const gchar * default_value = "M0,0 L1,1");
 
33
    virtual ~PathParam();
 
34
 
 
35
    std::vector<Geom::Path> const & get_pathvector();
 
36
    Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2();
 
37
 
 
38
    virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
 
39
 
 
40
    virtual bool param_readSVGValue(const gchar * strvalue);
 
41
    virtual gchar * param_getSVGValue() const;
 
42
 
 
43
    virtual void param_set_default();
 
44
    void param_set_and_write_default();
 
45
    void set_new_value (std::vector<Geom::Path> const &newpath, bool write_to_svg);
 
46
    void set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &newpath, bool write_to_svg);
 
47
 
 
48
    virtual void param_editOncanvas(SPItem * item, SPDesktop * dt);
 
49
    virtual void param_setup_nodepath(Inkscape::NodePath::Path *np);
 
50
    virtual void addCanvasIndicators(SPLPEItem *lpeitem, std::vector<Geom::PathVector> &hp_vec);
 
51
 
 
52
    virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
 
53
 
 
54
    sigc::signal <void> signal_path_pasted;
 
55
    sigc::signal <void> signal_path_changed;
 
56
    bool changed; /* this gets set whenever the path is changed (this is set to true, and then the signal_path_changed signal is emitted).
 
57
                   * the user must set it back to false if she wants to use it sensibly */
 
58
 
 
59
    void paste_param_path(const char *svgd);
 
60
    void on_paste_button_click();
 
61
 
 
62
protected:
 
63
    std::vector<Geom::Path> _pathvector;   // this is primary data storage, since it is closest to SVG.
 
64
 
 
65
    Geom::Piecewise<Geom::D2<Geom::SBasis> > _pwd2; // secondary, hence the bool must_recalculate_pwd2
 
66
    bool must_recalculate_pwd2; // set when _pathvector was updated, but _pwd2 not
 
67
    void ensure_pwd2();  // ensures _pwd2 is up to date
 
68
 
 
69
    gchar * href;     // contains link to other object, e.g. "#path2428", NULL if PathParam contains pathdata itself
 
70
    PathReference ref;
 
71
    sigc::connection ref_changed_connection;
 
72
    sigc::connection linked_delete_connection;
 
73
    sigc::connection linked_modified_connection;
 
74
    void ref_changed(SPObject *old_ref, SPObject *new_ref);
 
75
    void remove_link();
 
76
    void start_listening(SPObject * to);
 
77
    void quit_listening(void);
 
78
    void linked_delete(SPObject *deleted);
 
79
    void linked_modified(SPObject *linked_obj, guint flags);
 
80
 
 
81
    void on_edit_button_click();
 
82
    void on_copy_button_click();
 
83
    void on_link_button_click();
 
84
 
 
85
    void emit_changed();
 
86
 
 
87
    gchar * defvalue;
 
88
 
 
89
private:
 
90
    PathParam(const PathParam&);
 
91
    PathParam& operator=(const PathParam&);
 
92
};
 
93
 
 
94
 
 
95
} //namespace LivePathEffect
 
96
 
 
97
} //namespace Inkscape
 
98
 
 
99
#endif