]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macroarg.C
compilation fixes when using lyxstring
[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 MathMacroArgument::MathMacroArgument(int n)
16         : MathedInset(string(), LM_OT_MACRO_ARG, LM_ST_TEXT),
17                 number_(n)
18 {
19         if (n < 1 || n > 9) {
20                 lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
21                         << n << endl;
22                 lyx::Assert(0);
23         }
24 }
25
26 MathedInset * MathMacroArgument::Clone()
27 {
28         //return new MathMacroArgument(*this);
29         return this;
30 }
31
32 int MathMacroArgument::number() const
33 {
34         return number_;
35 }
36
37 void MathMacroArgument::substitute(MathMacro * /*m*/)
38 {
39         lyxerr << "Calling MathMacroArgument::substitute!\n";
40         //return m->arg(number_)->Clone();
41 }
42
43
44 void MathMacroArgument::draw(Painter & pain, int x, int y)
45 {
46         char str[] = "#0";
47         str[1] += number_; 
48         drawStr(pain, LM_TC_TEX, size(), x, y, str);
49 }
50
51
52 void MathMacroArgument::Metrics()
53 {
54         char str[] = "#0";
55         str[1] += number_; 
56         width = mathed_string_width(LM_TC_TEX, size(), str);
57         mathed_string_height(LM_TC_TEX, size(), str, ascent, descent);
58 }
59
60
61 void MathMacroArgument::Write(std::ostream & os, bool /*fragile*/)
62 {
63         os << '#' << number_ << ' ';
64 }
65
66
67 void MathMacroArgument::WriteNormal(std::ostream & os)
68 {
69         os << "[macroarg " << number_ << "] ";
70 }