~s-cecilio/lomse/master

« back to all changes in this revision

Viewing changes to include/lomse_instrument_engraver.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_INSTRUMENT_ENGRAVER_H__        //to avoid nested includes
 
22
#define __LOMSE_INSTRUMENT_ENGRAVER_H__
 
23
 
 
24
#include "lomse_basic.h"
 
25
#include <string>
 
26
using namespace std;
 
27
 
 
28
namespace lomse
 
29
{
 
30
 
 
31
//forward declarations
 
32
class ImoInstrument;
 
33
class TextMeter;
 
34
class GmoBox;
 
35
class GmoBoxSystem;
 
36
 
 
37
//---------------------------------------------------------------------------------------
 
38
class InstrumentEngraver
 
39
{
 
40
protected:
 
41
    ImoInstrument* m_pInstr;
 
42
    TextMeter* m_pTextMeter;
 
43
    LUnits m_uIndentFirst;
 
44
    LUnits m_uIndentOther;
 
45
    LUnits m_uBracketWidth;
 
46
    LUnits m_uBracketGap;
 
47
    //int m_bracketSymbol;      
 
48
 
 
49
    LUnits m_staffTop; 
 
50
    LUnits m_staffBottom; 
 
51
    LUnits m_staffLeft;
 
52
 
 
53
public:
 
54
    InstrumentEngraver(ImoInstrument* pInstr, TextMeter* pMeter);
 
55
    ~InstrumentEngraver();
 
56
 
 
57
    //indents
 
58
    void measure_indents();
 
59
    LUnits get_indent_first() { return m_uIndentFirst; }
 
60
    LUnits get_indent_other() { return m_uIndentOther; }
 
61
 
 
62
    //shapes
 
63
    void add_staff_lines(GmoBoxSystem* pBox, LUnits x, LUnits y, LUnits indent);
 
64
    void add_name_abbrev(GmoBox* pBox, int nSystem);
 
65
    void add_brace_bracket(GmoBox* pBox);
 
66
    LUnits get_staff_bottom() { return m_staffBottom; }
 
67
 
 
68
    //helper
 
69
    LUnits tenths_to_logical(Tenths value, int iStaff=0);
 
70
 
 
71
protected:
 
72
    void measure_name_abbrev();
 
73
    void measure_brace_or_bracket();
 
74
    bool has_brace_or_bracket();
 
75
    void add_text_shape(GmoBox* pBox, const std::string& text);
 
76
 
 
77
};
 
78
 
 
79
 
 
80
}   //namespace lomse
 
81
 
 
82
#endif    // __LOMSE_INSTRUMENT_ENGRAVER_H__
 
83