namespace Standard {
+// Config
+HexConfig::HexConfig()
+ : Margin(10, 10, 10, 10)
+ , ByteMargin(0, 0, 5, 5)
+ , Font("times", 24)
+ , FontMetrics(Font)
+{
+ Colors[0] = QColor(255,0,0);
+ Colors[1] = QColor(0,0,255);
+
+ calculate();
+}
+
+void HexConfig::calculate()
+{
+}
+
+// View
HexView::HexView(QWidget *parent, Document *doc)
: ::View(parent, doc)
{
void HexView::refreshPixmap()
{
- pix_.fill(QColor(0,255,255));
+ pix_.fill(getConfig().Colors[Color::Background]);
+
QPainter painter(&pix_);
//painter.initFrom(this);
#ifndef STDHEXVIEW_H_INC
#define STDHEXVIEW_H_INC
+#include <QFont>
+#include <QFontMetrics>
#include "../view.h"
namespace Standard {
+ namespace Color {
+ enum color {
+ Background = 0,
+ Text,
+ };
+ }
+
+ class HexConfig
+ {
+ public:
+ QRect Margin;
+ QRect ByteMargin;
+ QFont Font;
+ QColor Colors[16];
+
+ private:
+ QFontMetrics FontMetrics;
+ int x[16];
+
+ public:
+ HexConfig();
+
+ void updateFont()
+ {
+ FontMetrics = QFontMetrics(Font);
+ }
+ void calculate();
+ };
class HexView : public ::View
{
Q_OBJECT
- public:
- HexView(QWidget *parent = NULL, Document *doc = NULL);
+ public:
+ HexView(QWidget *parent = NULL, Document *doc = NULL);
+
+ HexConfig & getConfig() { return config_; }
+
+ protected:
+
+ void refreshPixmap();
- protected:
- void refreshPixmap();
+ protected:
+ HexConfig config_;
};
}