~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/include/ipegroup.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2009-12-11 21:22:35 UTC
  • mfrom: (4.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20091211212235-5iio4nzpra64snab
Tags: 7.0.10-1
* New upstream.  Closes: #551192.
  - New build-depends: libcairo2-dev, liblua5.1-0-dev, gsfonts
  - patches/config.diff: Remove.  Upstream build system replaced.
  - Runtime lib package changed to libipe7.0.10 from libipe1c2a
  - Devel package renamed to libipe-dev (from libipe1-dev)
  - Package ipe depends on lua5.1 due to ipe-update-master.

* rules: Re-write to use dh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
/*
6
6
 
7
7
    This file is part of the extensible drawing editor Ipe.
8
 
    Copyright (C) 1993-2007  Otfried Cheong
 
8
    Copyright (C) 1993-2009  Otfried Cheong
9
9
 
10
10
    Ipe is free software; you can redistribute it and/or modify it
11
11
    under the terms of the GNU General Public License as published by
12
 
    the Free Software Foundation; either version 2 of the License, or
 
12
    the Free Software Foundation; either version 3 of the License, or
13
13
    (at your option) any later version.
14
14
 
15
15
    As a special exception, you have permission to link Ipe with the
32
32
#ifndef IPEGROUP_H
33
33
#define IPEGROUP_H
34
34
 
35
 
#include "ipeobj.h"
 
35
#include "ipeobject.h"
 
36
#include "ipeshape.h"
36
37
 
37
38
// --------------------------------------------------------------------
38
39
 
39
 
class IPE_EXPORT IpeGroup : public IpeFillable {
40
 
private:
41
 
  typedef std::vector<const IpeObject *> List;
42
 
 
43
 
public:
44
 
  typedef List::const_iterator const_iterator;
45
 
 
46
 
  explicit IpeGroup();
47
 
  explicit IpeGroup(IpeRepository *rep, const IpeXmlAttributes &attr);
48
 
  IpeGroup(const IpeGroup &rhs);
49
 
  virtual ~IpeGroup();
50
 
  IpeGroup &operator=(const IpeGroup &rhs);
51
 
  virtual IpeObject *Clone() const;
52
 
 
53
 
  virtual IpeGroup *AsGroup();
54
 
 
55
 
  virtual TPinned pinned() const;
56
 
 
57
 
  virtual void Accept(IpeVisitor &visitor) const;
58
 
  virtual void SaveAsXml(IpePainter &painter, IpeStream &stream,
59
 
                         IpeString layer) const;
60
 
  virtual void Draw(IpePainter &painter) const;
61
 
  virtual void AddToBBox(IpeRect &box, const IpeMatrix &m) const;
62
 
  virtual double Distance(const IpeVector &v, const IpeMatrix &m,
63
 
                          double bound) const;
64
 
  virtual void SnapVtx(const IpeVector &mouse, const IpeMatrix &m,
65
 
                       IpeVector &pos, double &bound) const;
66
 
  virtual void SnapBnd(const IpeVector &mouse, const IpeMatrix &m,
67
 
                       IpeVector &pos, double &bound) const;
68
 
 
69
 
  //! Return number of component objects.
70
 
  inline int size() const { return iImp->iObjects.size(); }
71
 
  //! Return iterator for first object.
72
 
  inline const_iterator begin() const { return iImp->iObjects.begin(); }
73
 
  //! Return iterator for end of sequence.
74
 
  inline const_iterator end() const { return iImp->iObjects.end(); }
75
 
 
76
 
  void push_back(const IpeObject *);
77
 
 
78
 
  void SaveComponentsAsXml(IpePainter &painter, IpeStream &stream) const;
79
 
 
80
 
  virtual void CheckStyle(const IpeStyleSheet *sheet,
81
 
                           IpeAttributeSeq &seq) const;
82
 
 
83
 
  //! Return font size of text objects in the group.
84
 
  inline IpeAttribute TextSize() const { return iTextSize; }
85
 
  //! Return size of mark objects in the group.
86
 
  inline IpeAttribute MarkSize() const { return iMarkSize; }
87
 
  //! Return shape of mark objects in the group.
88
 
  inline int MarkShape() const { return iMarkShape; }
89
 
 
90
 
  //! Does this group contain any text objects?
91
 
  inline bool HasTexts() const { return iImp->iHasTexts; }
92
 
  //! Does this group contain any mark objects?
93
 
  inline bool HasMarks() const { return iImp->iHasMarks; }
94
 
 
95
 
  void SetTextSize(IpeAttribute size);
96
 
  void SetMarkSize(IpeAttribute size);
97
 
  void SetMarkShape(int shape);
98
 
 
99
 
private:
100
 
  void SaveGroupAttributesAsXml(IpePainter &painter, IpeStream &stream) const;
101
 
 
102
 
private:
103
 
  IpeAttribute iTextSize;
104
 
  IpeAttribute iMarkSize;
105
 
  int iMarkShape;
106
 
 
107
 
  struct Imp {
108
 
    List iObjects;
109
 
    bool iHasTexts;
110
 
    bool iHasMarks;
111
 
    int iRefCount;
112
 
    TPinned iPinned;
 
40
namespace ipe {
 
41
 
 
42
  class Shape;
 
43
 
 
44
  class Group : public Object {
 
45
  private:
 
46
    typedef std::vector<Object *> List;
 
47
 
 
48
  public:
 
49
    typedef List::const_iterator const_iterator;
 
50
 
 
51
    explicit Group();
 
52
    Group(const Group &rhs);
 
53
    virtual ~Group();
 
54
 
 
55
    explicit Group(const XmlAttributes &attr);
 
56
 
 
57
    Group &operator=(const Group &rhs);
 
58
    virtual Object *clone() const;
 
59
 
 
60
    virtual Group *asGroup();
 
61
 
 
62
    virtual Type type() const;
 
63
 
 
64
    virtual TPinned pinned() const;
 
65
 
 
66
    virtual void accept(Visitor &visitor) const;
 
67
 
 
68
    virtual void saveAsXml(Stream &stream, String layer) const;
 
69
    virtual void draw(Painter &painter) const;
 
70
    virtual void drawSimple(Painter &painter) const;
 
71
    virtual void addToBBox(Rect &box, const Matrix &m, bool cp) const;
 
72
    virtual double distance(const Vector &v, const Matrix &m,
 
73
                            double bound) const;
 
74
    virtual void snapVtx(const Vector &mouse, const Matrix &m,
 
75
                         Vector &pos, double &bound) const;
 
76
    virtual void snapBnd(const Vector &mouse, const Matrix &m,
 
77
                         Vector &pos, double &bound) const;
 
78
 
 
79
    inline const Shape &clip() const { return iClip; }
 
80
    void setClip(const Shape &clip);
 
81
 
 
82
    //! Return number of component objects.
 
83
    inline int count() const { return iImp->iObjects.size(); }
 
84
    //! Return object at index \a i.
 
85
    inline const Object *object(int i) const { return iImp->iObjects[i]; }
 
86
    //! Return iterator for first object.
 
87
    inline const_iterator begin() const { return iImp->iObjects.begin(); }
 
88
    //! Return iterator for end of sequence.
 
89
    inline const_iterator end() const { return iImp->iObjects.end(); }
 
90
 
 
91
    void push_back(Object *);
 
92
 
 
93
    void saveComponentsAsXml(Stream &stream) const;
 
94
 
 
95
    virtual void checkStyle(const Cascade *sheet, AttributeSeq &seq) const;
 
96
 
 
97
    virtual bool setAttribute(Property prop, Attribute value,
 
98
                              Attribute stroke, Attribute fill);
 
99
 
 
100
  private:
 
101
    void detach();
 
102
 
 
103
  private:
 
104
    struct Imp {
 
105
      List iObjects;
 
106
      int iRefCount;
 
107
      TPinned iPinned; // is any of the objects in the list pinned?
 
108
    };
 
109
 
 
110
    Imp *iImp;
 
111
    Shape iClip;
113
112
  };
114
113
 
115
 
  Imp *iImp;
116
 
};
 
114
} // namespace
117
115
 
118
116
// --------------------------------------------------------------------
119
117
#endif