~ubuntu-branches/ubuntu/precise/easystroke/precise

« back to all changes in this revision

Viewing changes to stroke.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Jaeger
  • Date: 2009-01-16 11:31:54 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090116113154-kqvaghw9phb6280b
Tags: 0.3.98.1-0ubuntu1
* New upstream beta (LP: #318051)
* Use lzma compression in the deb.
  - pass -Z lzma to dh_builddeb
  - Pre-Depend on dpkg (>= 1.14.12ubuntu3)
* Build-Depend on intltool for the i18n of the desktop file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2008, Thomas Jaeger <ThJaeger@gmail.com>
 
2
 * Copyright (c) 2008-2009, Thomas Jaeger <ThJaeger@gmail.com>
3
3
 *
4
4
 * Permission to use, copy, modify, and/or distribute this software for any
5
5
 * purpose with or without fee is hereby granted, provided that the above
86
86
        double length() const;
87
87
        int size() const { return points.size(); }
88
88
 
89
 
        Stroke(PreStroke &s, int trigger_, int button_);
 
89
        Stroke(PreStroke &s, int trigger_, int button_, bool timeout_);
90
90
 
91
 
        Glib::RefPtr<Gdk::Pixbuf> draw_(int) const;
92
 
        mutable Glib::RefPtr<Gdk::Pixbuf> pb;
 
91
        Glib::RefPtr<Gdk::Pixbuf> draw_(int, bool) const;
 
92
        mutable Glib::RefPtr<Gdk::Pixbuf> pb[2];
93
93
        std::vector<Point> points;
94
94
 
95
95
        static Glib::RefPtr<Gdk::Pixbuf> drawEmpty_(int);
101
101
                ar & button;
102
102
                if (version >= 2)
103
103
                        ar & trigger;
104
 
                if (!trigger)
105
 
                        trigger = get_default_button();
 
104
                if (version < 4 && (!button || trigger == get_default_button()))
 
105
                        trigger = 0;
 
106
                if (version < 3)
 
107
                        return;
 
108
                ar & timeout;
106
109
        }
107
110
 
108
111
public:
109
112
        int trigger;
110
113
        int button;
111
 
 
112
 
        Stroke() : trigger(0), button(0) {}
113
 
        static RStroke create(PreStroke &s, int trigger_, int button_) { return RStroke(new Stroke(s, trigger_, button_)); }
114
 
 
115
 
        Glib::RefPtr<Gdk::Pixbuf> draw(int size) const;
116
 
        void draw(Cairo::RefPtr<Cairo::Surface> surface, int x, int y, int w, int h, bool invert = true) const;
 
114
        bool timeout;
 
115
 
 
116
        Stroke() : trigger(0), button(0), timeout(false) {}
 
117
        static RStroke create(PreStroke &s, int trigger_, int button_, bool timeout_) {
 
118
                return RStroke(new Stroke(s, trigger_, button_, timeout_));
 
119
        }
 
120
        Glib::RefPtr<Gdk::Pixbuf> draw(int size, bool big = false) const;
 
121
        void draw(Cairo::RefPtr<Cairo::Surface> surface, int x, int y, int w, int h, bool big) const;
117
122
        void draw_svg(std::string filename) const;
118
123
        bool show_icon();
119
124
 
120
125
        static RStroke trefoil();
121
 
        static double compare(RStroke, RStroke);
122
 
        static double compare(RStroke, RStroke, double);
 
126
        static bool compare(RStroke, RStroke, double &);
123
127
        static Glib::RefPtr<Gdk::Pixbuf> drawEmpty(int);
124
128
 
125
129
        void print() const;
126
130
        void normalize();
127
131
        bool trivial() const { return size() == 0 && button == 0; }
 
132
        bool is_timeout() const { return timeout; }
128
133
};
129
 
BOOST_CLASS_VERSION(Stroke, 2)
 
134
BOOST_CLASS_VERSION(Stroke, 4)
130
135
 
131
136
class PreStroke : public std::vector<RTriple> {
132
137
public: