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