]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macroarg.C
remove LyXParagraph Clone use newly added copy constructor instead, some whitespace...
[lyx.git] / src / mathed / math_macroarg.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_macro.h"
8 #include "math_macroarg.h"
9 #include "mathed/support.h"
10 #include "Lsstream.h"
11 #include "debug.h"
12
13 using std::endl;
14
15
16 MathMacroArgument::MathMacroArgument(int n)
17         : MathedInset(string(), LM_OT_MACRO_ARG, LM_ST_TEXT),
18                 number_(n)
19 {
20         if (n < 1 || n > 9) {
21                 lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
22                         << n << endl;
23                 lyx::Assert(0);
24         }
25 }
26
27
28 MathedInset * MathMacroArgument::Clone()
29 {
30         //return new MathMacroArgument(*this);
31         return this;
32 }
33
34
35 int MathMacroArgument::number() const
36 {
37         return number_;
38 }
39
40
41 void MathMacroArgument::substitute(MathMacro * /*m*/)
42 {
43         lyxerr << "Calling MathMacroArgument::substitute!\n";
44         //return m->arg(number_)->Clone();
45 }
46
47
48 void MathMacroArgument::draw(Painter & pain, int x, int y)
49 {
50         char str[] = "#0";
51         str[1] += number_; 
52         drawStr(pain, LM_TC_TEX, size(), x, y, str);
53 }
54
55
56 void MathMacroArgument::Metrics()
57 {
58         char str[] = "#0";
59         str[1] += number_; 
60         width = mathed_string_width(LM_TC_TEX, size(), str);
61         mathed_string_height(LM_TC_TEX, size(), str, ascent, descent);
62 }
63
64
65 void MathMacroArgument::Write(std::ostream & os, bool /*fragile*/)
66 {
67         os << '#' << number_ << ' ';
68 }
69
70
71 void MathMacroArgument::WriteNormal(std::ostream & os)
72 {
73         os << "[macroarg " << number_ << "] ";
74 }