#include "Language.h"
#include "Dimension.h"
+#include "insets/Inset.h"
+
#include <boost/assert.hpp>
using namespace std;
}
+static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
+
void GuiFontMetrics::rectText(docstring const & str,
int & w, int & ascent, int & descent) const
{
- static int const d = 2;
- w = width(str) + d * 2 + 2;
+ w = width(str) + Inset::TEXT_TO_INSET_OFFSET;
ascent = metrics_.ascent() + d;
descent = metrics_.descent() + d;
}
void GuiFontMetrics::buttonText(docstring const & str,
int & w, int & ascent, int & descent) const
{
- static int const d = 3;
- w = width(str) + d * 2 + 2;
+ w = width(str) + 2 * Inset::TEXT_TO_INSET_OFFSET;
ascent = metrics_.ascent() + d;
descent = metrics_.descent() + d;
}
line(x, y + h - 1, x - 1 + w, y + h - 1, Color_buttonframe);
}
+static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
void GuiPainter::rectText(int x, int y, docstring const & str,
FontInfo const & font, ColorCode back, ColorCode frame)
FontMetrics const & fm = theFontMetrics(font);
fm.buttonText(str, width, ascent, descent);
- button(x + 1, y - ascent, width - 2, descent + ascent, mouseHover);
- text(x + 4, y - 1, str, font);
+ button(x + d, y - ascent, width - d, descent + ascent, mouseHover);
+ text(x + Inset::TEXT_TO_INSET_OFFSET, y, str, font);
}