mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2024-06-16 16:29:33 +00:00
Made mainwidget scrollable on viewer
This commit is contained in:
parent
400db17b3c
commit
823ae4dd57
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>588</width>
|
<width>766</width>
|
||||||
<height>397</height>
|
<height>515</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>857</width>
|
<width>294</width>
|
||||||
<height>469</height>
|
<height>270</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
|
|
@ -36,7 +36,7 @@ void CharSetViewer::setFile(BinaryFile *file)
|
||||||
int ypos = 0;
|
int ypos = 0;
|
||||||
foreach (CharSetCharacter csc, m_charset.allCharacters())
|
foreach (CharSetCharacter csc, m_charset.allCharacters())
|
||||||
{
|
{
|
||||||
CharacterWidget *cw = new CharacterWidget(this,csc,4);
|
CharacterWidget *cw = new CharacterWidget(this,csc);
|
||||||
cw->showGrid(true);
|
cw->showGrid(true);
|
||||||
cw->enableBitShift(true);
|
cw->enableBitShift(true);
|
||||||
cw->setBgColor(Qt::white);
|
cw->setBgColor(Qt::white);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>749</width>
|
<width>146</width>
|
||||||
<height>516</height>
|
<height>129</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -29,6 +29,14 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FileViewerInterface</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>viewerbase.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>836</width>
|
<width>107</width>
|
||||||
<height>540</height>
|
<height>117</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -35,6 +35,14 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FileViewerInterface</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>viewerbase.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -42,6 +42,8 @@ HiresViewWidget::HiresViewWidget(QWidget *parent) :
|
||||||
perPixelColorAction->setChecked(false);
|
perPixelColorAction->setChecked(false);
|
||||||
formatGroup->addAction(perPixelColorAction);
|
formatGroup->addAction(perPixelColorAction);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
showScanLinesAction = new QAction("Show Scan Lines",this);
|
showScanLinesAction = new QAction("Show Scan Lines",this);
|
||||||
showScanLinesAction->setCheckable(true);
|
showScanLinesAction->setCheckable(true);
|
||||||
showScanLinesAction->setChecked(m_showScanLines);
|
showScanLinesAction->setChecked(m_showScanLines);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
MazeViewer::MazeViewer(QWidget *parent) : FileViewerInterface(parent)
|
MazeViewer::MazeViewer(QWidget *parent) : FileViewerInterface(parent)
|
||||||
{
|
{
|
||||||
setMinimumSize(480,600);
|
//setMinimumSize(480,600);
|
||||||
m_maze = QPixmap(width(),height());
|
m_maze = QPixmap(width(),height());
|
||||||
drawMaze();
|
drawMaze();
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ void MazeViewer::paintEvent(QPaintEvent *event)
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
drawMaze();
|
drawMaze();
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.drawPixmap(0,0,m_maze);
|
painter.drawPixmap(0, 0, m_maze);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MazeViewer::setFile(GenericFile *file)
|
void MazeViewer::setFile(GenericFile *file)
|
||||||
|
@ -45,7 +45,6 @@ void MazeViewer::setFile(BinaryFile *file)
|
||||||
|
|
||||||
quint16 address = file->address();
|
quint16 address = file->address();
|
||||||
mem.addFile(file->data(), address);
|
mem.addFile(file->data(), address);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>836</width>
|
<width>152</width>
|
||||||
<height>540</height>
|
<height>121</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -26,6 +26,14 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FileViewerInterface</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>viewerbase.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QScrollArea>
|
||||||
|
|
||||||
#include "applesoftfileviewer.h"
|
#include "applesoftfileviewer.h"
|
||||||
#include "hexdumpviewer.h"
|
#include "hexdumpviewer.h"
|
||||||
|
@ -24,6 +25,12 @@ ViewerBase::ViewerBase(QWidget *parent) :
|
||||||
|
|
||||||
m_stack = new QStackedWidget(this);
|
m_stack = new QStackedWidget(this);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
// QScrollArea *scroller = new QScrollArea(this);
|
||||||
|
// scroller->setWidgetResizable(true);
|
||||||
|
// setCentralWidget(scroller);
|
||||||
|
// scroller->setWidget(m_stack);
|
||||||
|
|
||||||
setCentralWidget(m_stack);
|
setCentralWidget(m_stack);
|
||||||
|
|
||||||
m_toolbar = new QToolBar(this);
|
m_toolbar = new QToolBar(this);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>954</width>
|
<width>919</width>
|
||||||
<height>614</height>
|
<height>609</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>954</width>
|
<width>919</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QBitArray>
|
#include <QBitArray>
|
||||||
|
|
||||||
CharacterWidget::CharacterWidget(QWidget *parent, CharSetCharacter ch, int scale)
|
CharacterWidget::CharacterWidget(QWidget *parent, CharSetCharacter ch)
|
||||||
: QWidget(parent), m_character(ch), m_scale(scale)
|
: QWidget(parent), m_character(ch)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_dobitshift = true;
|
m_dobitshift = true;
|
||||||
m_showgrid = true;
|
m_showgrid = true;
|
||||||
resize(15*m_scale, 16*m_scale);
|
// setMaximumSize(this->size());
|
||||||
setMaximumSize(this->size());
|
// setMinimumSize(this->size());
|
||||||
setMinimumSize(this->size());
|
|
||||||
m_pixmap = QPixmap(this->size());
|
m_pixmap = QPixmap(this->size());
|
||||||
setFgColor(Qt::black);
|
setFgColor(Qt::black);
|
||||||
setBgColor(Qt::white);
|
setBgColor(Qt::white);
|
||||||
|
@ -25,10 +25,19 @@ CharacterWidget::CharacterWidget(QWidget *parent, CharSetCharacter ch, int scale
|
||||||
doRepaint();
|
doRepaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CharacterWidget::hasHeightForWidth() const { return true; }
|
||||||
|
int CharacterWidget::heightForWidth(int w) const { return w * 9 / 8; }
|
||||||
|
|
||||||
void CharacterWidget::doRepaint()
|
void CharacterWidget::doRepaint()
|
||||||
{
|
{
|
||||||
m_pixmap.fill(m_bgcolor);
|
m_pixmap.fill(QColor(0,0,0,0));
|
||||||
QPainter painter(&m_pixmap);
|
QPainter painter(&m_pixmap);
|
||||||
|
float hscale = width() / 15;
|
||||||
|
float vscale = height() / 8;
|
||||||
|
|
||||||
|
painter.setPen(m_bgcolor);
|
||||||
|
painter.setBrush(m_bgcolor);
|
||||||
|
painter.drawRect(0,0, hscale * 15, vscale * 8);
|
||||||
|
|
||||||
painter.setPen(m_fgcolor);
|
painter.setPen(m_fgcolor);
|
||||||
painter.setBrush(m_fgcolor);
|
painter.setBrush(m_fgcolor);
|
||||||
|
@ -37,7 +46,7 @@ void CharacterWidget::doRepaint()
|
||||||
|
|
||||||
for (quint8 yval = 0; yval < 8; yval++)
|
for (quint8 yval = 0; yval < 8; yval++)
|
||||||
{
|
{
|
||||||
int ypos = yval * m_scale*2;
|
int ypos = yval * vscale;
|
||||||
|
|
||||||
quint8 line = chardata[yval];
|
quint8 line = chardata[yval];
|
||||||
|
|
||||||
|
@ -61,8 +70,8 @@ void CharacterWidget::doRepaint()
|
||||||
{
|
{
|
||||||
if (bits.testBit(jdx))
|
if (bits.testBit(jdx))
|
||||||
{
|
{
|
||||||
painter.drawRect((jdx*2+shiftval)*m_scale, ypos,
|
painter.drawRect((jdx*2+shiftval)*hscale, ypos,
|
||||||
m_scale*2, m_scale*2);
|
hscale*2, vscale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,19 +80,21 @@ void CharacterWidget::doRepaint()
|
||||||
{
|
{
|
||||||
painter.setPen(QPen(m_gridcolor,1,Qt::DotLine));
|
painter.setPen(QPen(m_gridcolor,1,Qt::DotLine));
|
||||||
painter.setBrush(Qt::NoBrush);
|
painter.setBrush(Qt::NoBrush);
|
||||||
for (int idx = 0; idx < 8; idx++)
|
|
||||||
{
|
|
||||||
painter.drawLine(0, idx*m_scale*2, m_pixmap.width(), idx*m_scale*2);
|
|
||||||
}
|
|
||||||
for (int idx = 0; idx < 9; idx++)
|
for (int idx = 0; idx < 9; idx++)
|
||||||
{
|
{
|
||||||
painter.drawLine(idx*m_scale*2, 0, idx*m_scale*2, m_pixmap.width());
|
painter.drawLine(0, idx*vscale,
|
||||||
|
hscale * 15, idx*vscale);
|
||||||
|
}
|
||||||
|
for (int idx = 0; idx < 8; idx++)
|
||||||
|
{
|
||||||
|
painter.drawLine(idx*hscale*2, 0,
|
||||||
|
idx*hscale*2, vscale * 8);
|
||||||
}
|
}
|
||||||
painter.setPen(QPen(m_gridcolor,2,Qt::SolidLine));
|
painter.setPen(QPen(m_gridcolor,2,Qt::SolidLine));
|
||||||
painter.drawLine(0,0, 0,m_pixmap.height());
|
painter.drawLine(0,0, 0, vscale * 8);
|
||||||
painter.drawLine(0,m_pixmap.height(), m_pixmap.width(), m_pixmap.height());
|
painter.drawLine(0,vscale * 8, hscale * 15, vscale * 8);
|
||||||
painter.drawLine(m_pixmap.width(), m_pixmap.height(), m_pixmap.width(),0);
|
painter.drawLine(hscale * 15, vscale * 8, hscale * 15,0);
|
||||||
painter.drawLine(m_pixmap.width(),0, 0,0);
|
painter.drawLine(hscale * 15,0, 0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
|
|
|
@ -12,11 +12,12 @@ class CharacterWidget : public QWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CharacterWidget(QWidget *parent = 0,
|
CharacterWidget(QWidget *parent = 0,
|
||||||
CharSetCharacter ch = CharSetCharacter(),
|
CharSetCharacter ch = CharSetCharacter());
|
||||||
int scale = 4);
|
|
||||||
|
|
||||||
void doRepaint();
|
void doRepaint();
|
||||||
|
|
||||||
|
bool hasHeightForWidth() const;
|
||||||
|
int heightForWidth(int w) const;
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
|
||||||
|
@ -43,6 +44,5 @@ private:
|
||||||
|
|
||||||
CharSetCharacter m_character;
|
CharSetCharacter m_character;
|
||||||
|
|
||||||
int m_scale;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user