~s-cecilio/lomse/master

« back to all changes in this revision

Viewing changes to include/lomse_shapes.h

  • Committer: cecilios
  • Date: 2010-11-14 17:47:31 UTC
  • Revision ID: git-v1:1fa3764c8c4d338b95b1a537b1e78271170c0025
latest new code. demo_1 tested on linux and win32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//---------------------------------------------------------------------------------------
 
2
//  This file is part of the Lomse library.
 
3
//  Copyright (c) 2010 Lomse project
 
4
//
 
5
//  Lomse is free software; you can redistribute it and/or modify it under the
 
6
//  terms of the GNU General Public License as published by the Free Software Foundation,
 
7
//  either version 3 of the License, or (at your option) any later version.
 
8
//
 
9
//  Lomse is distributed in the hope that it will be useful, but WITHOUT ANY
 
10
//  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 
11
//  PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
12
//
 
13
//  You should have received a copy of the GNU General Public License along
 
14
//  with Lomse; if not, see <http://www.gnu.org/licenses/>.
 
15
//  
 
16
//  For any comment, suggestion or feature request, please contact the manager of
 
17
//  the project at cecilios@users.sourceforge.net
 
18
//
 
19
//---------------------------------------------------------------------------------------
 
20
 
 
21
#ifndef __LOMSE_SHAPES_H__        //to avoid nested includes
 
22
#define __LOMSE_SHAPES_H__
 
23
 
 
24
#include "lomse_shape_base.h"
 
25
//#include <sstream>
 
26
//using namespace std;
 
27
 
 
28
namespace lomse
 
29
{
 
30
 
 
31
////forward declarations
 
32
//class ImoStaffInfo;
 
33
//class lmScoreObj;
 
34
//class GmoShapeLine;
 
35
//class GmoShapeFBLine;
 
36
 
 
37
 
 
38
//---------------------------------------------------------------------------------------
 
39
// a shape drawn by using a single glyph from LenMus font
 
40
class GmoShapeGlyph : public GmoSimpleShape
 
41
{
 
42
protected:
 
43
    int m_nGlyph;
 
44
    UPoint m_uGlyphPos;
 
45
 
 
46
public:
 
47
    virtual ~GmoShapeGlyph() {}
 
48
 
 
49
    //implementation of virtual methods from base class
 
50
    virtual void on_draw(Drawer* pDrawer, RenderOptions& opt, UPoint& origin);
 
51
//    void RenderHighlighted(wxDC* pDC, Color colorC);
 
52
 
 
53
//    wxString Dump(int nIndent);
 
54
//    void Shift(LUnits xIncr, LUnits yIncr);
 
55
//      virtual wxBitmap* OnBeginDrag(double rScale, wxDC* pDC);
 
56
//    virtual UPoint OnDrag(lmPaper* pPaper, const UPoint& uPos);
 
57
//      virtual void OnEndDrag(lmPaper* pPaper, lmController* pCanvas, const UPoint& uPos);
 
58
//      UPoint GetObjectOrigin();
 
59
 
 
60
protected:
 
61
    GmoShapeGlyph(GmoBox* owner, int type, int nShapeIdx, int nGlyph, UPoint pos);
 
62
 
 
63
//    wxBitmap* GetBitmapFromShape(double rScale, Color colorF, Color colorB = *wxWHITE);
 
64
//    virtual double GetPointSize();
 
65
 
 
66
};
 
67
 
 
68
//---------------------------------------------------------------------------------------
 
69
class GmoShapeClef : public GmoShapeGlyph
 
70
{
 
71
public:
 
72
    GmoShapeClef(GmoBox* owner, int nShapeIdx, int nGlyph, UPoint pos, bool fSmallClef);
 
73
    ~GmoShapeClef() {}
 
74
 
 
75
//      //overrides
 
76
//    UPoint OnDrag(lmPaper* pPaper, const UPoint& uPos);
 
77
//    void OnEndDrag(lmPaper* pPaper, lmController* pCanvas, const UPoint& uPos);
 
78
//    double GetPointSize();
 
79
//
 
80
//protected:
 
81
//    bool        m_fSmallClef;
 
82
};
 
83
 
 
84
////---------------------------------------------------------------------------------------
 
85
//class GmoShapeSimpleLine : public GmoSimpleShape
 
86
//{
 
87
//public:
 
88
//    GmoShapeSimpleLine(GmoBox* owner, LUnits xStart, LUnits yStart,
 
89
//                LUnits xEnd, LUnits yEnd, LUnits uWidth,
 
90
//                              LUnits uBoundsExtraWidth, Color nColor, wxString sName = _T("Line"),
 
91
//                              ELineEdges nEdge = lm_eEdgeNormal);
 
92
//    ~GmoShapeSimpleLine() {}
 
93
//
 
94
//    //implementation of virtual methods from base class
 
95
//    void on_draw(Drawer* pDrawer, RenderOptions& opt, UPoint& origin);
 
96
//    wxString Dump(int nIndent);
 
97
//    void Shift(LUnits xIncr, LUnits yIncr);
 
98
//
 
99
//protected:
 
100
//      void Create(LUnits xStart, LUnits yStart, LUnits xEnd, LUnits yEnd,
 
101
//                              LUnits uWidth, LUnits uBoundsExtraWidth, Color nColor,
 
102
//                              ELineEdges nEdge);
 
103
//
 
104
//
 
105
//    LUnits            m_xStart, m_yStart;
 
106
//    LUnits            m_xEnd, m_yEnd;
 
107
//    LUnits            m_uWidth;
 
108
//      LUnits          m_uBoundsExtraWidth;
 
109
//      ELineEdges      m_nEdge;
 
110
//
 
111
//};
 
112
//
 
113
////---------------------------------------------------------------------------------------
 
114
//class GmoShapeRectangle : public GmoSimpleShape
 
115
//{
 
116
//public:
 
117
//    //TODO: remove this backwards compatibility constructor
 
118
//    GmoShapeRectangle(GmoBox* owner, LUnits xLeft, LUnits yTop,
 
119
//                     LUnits xRight, LUnits yBottom, LUnits uWidth,
 
120
//                     Color color = *wxBLACK, wxString sName = _T("Rectangle"),
 
121
//                                   bool fDraggable = true, bool fSelectable = true,
 
122
//                     bool fVisible = true);
 
123
//
 
124
//    //new rectangle constructor
 
125
//    GmoShapeRectangle(GmoBox* owner,
 
126
//                     //position and size
 
127
//                     LUnits uxLeft, LUnits uyTop, LUnits uxRight, LUnits uyBottom,
 
128
//                     //border
 
129
//                     LUnits uBorderWidth, Color nBorderColor,
 
130
//                     //content
 
131
//                     Color nBgColor = *wxWHITE,
 
132
//                     //other
 
133
//                     int nShapeIdx = 0, wxString sName = _T("Rectangle"),
 
134
//                                   bool fDraggable = true, bool fSelectable = true,
 
135
//                     bool fVisible = true);
 
136
//
 
137
//    virtual ~GmoShapeRectangle();
 
138
//
 
139
//    //implementation of virtual methods from base class
 
140
//    void on_draw(Drawer* pDrawer, RenderOptions& opt, UPoint& origin);
 
141
//    void RenderNormal(lmPaper* pPaper, Color color);
 
142
//    void RenderWithHandlers(lmPaper* pPaper);
 
143
//    wxString Dump(int nIndent);
 
144
//    void Shift(LUnits uxIncr, LUnits uyIncr);
 
145
//
 
146
//    //Handler IDs. AWARE: Used also as array indexes
 
147
//    enum
 
148
//    {
 
149
//        lmID_TOP_LEFT = 0,
 
150
//        lmID_TOP_RIGHT,
 
151
//        lmID_BOTTOM_RIGHT,
 
152
//        lmID_BOTTOM_LEFT,
 
153
//        //
 
154
//        lmID_LEFT_CENTER,
 
155
//        lmID_TOP_CENTER,
 
156
//        lmID_RIGHT_CENTER,
 
157
//        lmID_BOTTOM_CENTER,
 
158
//        //
 
159
//        lmID_NUM_HANDLERS
 
160
//    };
 
161
//
 
162
//    //settings
 
163
//    void SetCornerRadius(LUnits uRadius);
 
164
//    inline void SetBorderStyle(ELineStyle nBorderStyle) { m_nBorderStyle = nBorderStyle; }
 
165
//
 
166
//    //shape dragging
 
167
//    wxBitmap* OnBeginDrag(double rScale, wxDC* pDC);
 
168
//      UPoint OnDrag(lmPaper* pPaper, const UPoint& uPos);
 
169
//      void OnEndDrag(lmPaper* pPaper, lmController* pCanvas, const UPoint& uPos);
 
170
//
 
171
//    //handlers dragging
 
172
//    UPoint OnHandlerDrag(lmPaper* pPaper, const UPoint& uPos, long nHandlerID);
 
173
//    void OnHandlerEndDrag(lmController* pCanvas, const UPoint& uPos, long nHandlerID);
 
174
//
 
175
//    //call backs
 
176
//    void MovePoints(int nNumPoints, int nShapeIdx, UPoint* pShifts, bool fAddShifts);
 
177
//
 
178
//
 
179
//protected:
 
180
//    void Create(LUnits xLeft, LUnits yTop, LUnits xRight, LUnits yBottom,
 
181
//                LUnits uBorderWidth, Color nBorderColor, Color nBgColor);
 
182
//    void DrawRectangle(lmPaper* pPaper, Color colorC, bool fSketch);
 
183
//    void ComputeNewPointsAndHandlersPositions(const UPoint& uPos, long nHandlerID);
 
184
//    void ComputeCenterPoints();
 
185
//    void UpdateBounds();
 
186
//    void SavePoints();
 
187
//
 
188
//    //rectangle
 
189
//    Color        m_nBgColor;
 
190
//    LUnits        m_uCornerRadius;
 
191
//
 
192
//    //border
 
193
//    LUnits        m_uBorderWidth;
 
194
//    Color        m_nBorderColor;
 
195
//    ELineStyle    m_nBorderStyle;
 
196
//
 
197
//    //rectangle points and handlers
 
198
//    UPoint            m_uPoint[lmID_NUM_HANDLERS];       //four corners + anchor point + centers of rectangle sides
 
199
//    UPoint            m_uSavePoint[lmID_NUM_HANDLERS];   //to save start and end points when dragging/moving
 
200
//    lmHandlerSquare*    m_pHandler[lmID_NUM_HANDLERS];     //handlers
 
201
//
 
202
//};
 
203
//
 
204
////---------------------------------------------------------------------------------------
 
205
//class GmoShapeInvisible : public GmoSimpleShape
 
206
//{
 
207
//public:
 
208
//    GmoShapeInvisible(GmoBox* owner, int nShapeIdx, UPoint uPos, lmUSize uSize,
 
209
//                     wxString sName=_T("Invisible"));
 
210
//    ~GmoShapeInvisible() {}
 
211
//
 
212
//      //overrides
 
213
//    wxString Dump(int nIndent);
 
214
//      void Render(lmPaper* pPaper, Color color);
 
215
//
 
216
//
 
217
//};
 
218
//
 
219
////---------------------------------------------------------------------------------------
 
220
//class GmoShapeStem : public GmoShapeSimpleLine
 
221
//{
 
222
//public:
 
223
//    GmoShapeStem(GmoBox* owner, LUnits xPos, LUnits yStart, LUnits uExtraLength,
 
224
//                LUnits yEnd, bool fStemDown, LUnits uWidth, Color nColor);
 
225
//    ~GmoShapeStem() {}
 
226
//
 
227
//      //specific methods
 
228
//      void SetLength(LUnits uLenght, bool fModifyTop);
 
229
//      inline bool StemDown() const { return m_fStemDown; }
 
230
//      void Adjust(LUnits xPos, LUnits yStart, LUnits yEnd, bool fStemDown);
 
231
//      LUnits GetYStartStem();
 
232
//      LUnits GetYEndStem();
 
233
//      LUnits GetXCenterStem();
 
234
//    inline LUnits GetExtraLenght() { return m_uExtraLength; }
 
235
//
 
236
//private:
 
237
//      bool        m_fStemDown;
 
238
//    LUnits    m_uExtraLength;
 
239
//
 
240
//};
 
241
//
 
242
////---------------------------------------------------------------------------------------
 
243
//class GmoShapeFiguredBass : public lmCompositeShape
 
244
//{
 
245
//public:
 
246
//    GmoShapeFiguredBass(GmoBox* owner, int nShapeIdx, Color nColor)
 
247
//        : lmCompositeShape(pOwner, nShapeIdx, nColor, _T("Figured bass"), true)  //true= lmDRAGGABLE
 
248
//        { m_nType = GmoObj::k_shape_FiguredBass; }
 
249
//    ~GmoShapeFiguredBass() {}
 
250
//
 
251
//      //info about related shapes
 
252
//    inline void OnFBLineAttached(int nLine, GmoShapeLine* pShapeFBLine) 
 
253
//                    { m_pFBLineShape[nLine] = pShapeFBLine; }
 
254
//
 
255
//    //overrides
 
256
//    void Shift(LUnits uxIncr, LUnits uyIncr);
 
257
//
 
258
//private:
 
259
//    GmoShapeLine*  m_pFBLineShape[2];     //The two lines of a FB line. This is the end FB of the line
 
260
//
 
261
//};
 
262
//
 
263
////---------------------------------------------------------------------------------------
 
264
//class GmoShapeWindow : public GmoShapeRectangle
 
265
//{
 
266
//public:
 
267
//    GmoShapeWindow(GmoBox* owner, int nShapeIdx,
 
268
//                  //position and size
 
269
//                  LUnits uxLeft, LUnits uyTop, LUnits uxRight, LUnits uyBottom,
 
270
//                  //border
 
271
//                  LUnits uBorderWidth, Color nBorderColor,
 
272
//                  //content
 
273
//                  Color nBgColor = *wxWHITE,
 
274
//                  //other
 
275
//                  wxString sName = _T("Window"),
 
276
//                                bool fDraggable = true, bool fSelectable = true,
 
277
//                  bool fVisible = true);
 
278
//    virtual ~GmoShapeWindow() {}
 
279
//
 
280
//    //renderization
 
281
//    void on_draw(Drawer* pDrawer, RenderOptions& opt, UPoint& origin);
 
282
//
 
283
//      //specific methods
 
284
//
 
285
//protected:
 
286
//
 
287
//    wxWindow*       m_pWidget;      //the window to embbed
 
288
//};
 
289
//
 
290
////global functions defined in this module
 
291
//extern wxBitmap* GetBitmapForGlyph(double rScale, int nGlyph, double rPointSize,
 
292
//                                   Color colorF, Color colorB);
 
293
//
 
294
 
 
295
 
 
296
}   //namespace lomse
 
297
 
 
298
#endif    // __LOMSE_SHAPES_H__
 
299