mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2024-06-09 18:29:28 +00:00
Added word wrap to all text-based viewer widgets.
This commit is contained in:
parent
441dc4613e
commit
28f6f66234
|
@ -18,13 +18,13 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
|
||||||
m_formatter = new ApplesoftFormatter(this);
|
m_formatter = new ApplesoftFormatter(this);
|
||||||
//m_formatter->setFlags(ApplesoftFormatter::PrettyFlags | ApplesoftFormatter::BreakAfterReturn);
|
|
||||||
m_formatter->setFlags(ApplesoftFormatter::PrettyFlags);
|
m_formatter->setFlags(ApplesoftFormatter::PrettyFlags);
|
||||||
connect(ui->findButton,SIGNAL(clicked(bool)), SLOT(findText()));
|
connect(ui->findButton,SIGNAL(clicked(bool)), SLOT(findText()));
|
||||||
m_isFirstFind = true;
|
m_isFirstFind = true;
|
||||||
ui->textArea->setUndoRedoEnabled(false);
|
ui->textArea->setUndoRedoEnabled(false);
|
||||||
ui->textArea->setUndoRedoEnabled(true);
|
ui->textArea->setUndoRedoEnabled(true);
|
||||||
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
|
|
||||||
|
toggleWordWrap(settings.value("ASViewer.WordWrap",true).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplesoftFileViewer::~ApplesoftFileViewer()
|
ApplesoftFileViewer::~ApplesoftFileViewer()
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "relocatablefile.h"
|
#include "relocatablefile.h"
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QAction>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
DisassemblerViewer::DisassemblerViewer(QWidget *parent) :
|
DisassemblerViewer::DisassemblerViewer(QWidget *parent) :
|
||||||
|
@ -14,6 +17,9 @@ DisassemblerViewer::DisassemblerViewer(QWidget *parent) :
|
||||||
|
|
||||||
QString title = QString("Disassembly Viewer");
|
QString title = QString("Disassembly Viewer");
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
toggleWordWrap(settings.value("DisassemblerViewer.WordWrap",true).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
DisassemblerViewer::~DisassemblerViewer()
|
DisassemblerViewer::~DisassemblerViewer()
|
||||||
|
@ -33,6 +39,20 @@ void DisassemblerViewer::setFile(GenericFile *file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DisassemblerViewer::toggleWordWrap(bool enabled)
|
||||||
|
{
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
ui->textArea->setWordWrapMode(QTextOption::WordWrap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
|
||||||
|
}
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("DisassemblerViewer.WordWrap",enabled);
|
||||||
|
}
|
||||||
|
|
||||||
void DisassemblerViewer::setFile(BinaryFile *file) {
|
void DisassemblerViewer::setFile(BinaryFile *file) {
|
||||||
m_file = file;
|
m_file = file;
|
||||||
|
|
||||||
|
@ -1391,6 +1411,19 @@ QString DisassemblerViewer::getPotentialLabel(quint16 address) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DisassemblerViewer::optionsMenuItems(QMenu *menu)
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
QAction *action = new QAction("&Word Wrap");
|
||||||
|
action->setCheckable(true);
|
||||||
|
action->setChecked(settings.value("DisassemblerViewer.WordWrap",true).toBool());
|
||||||
|
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool)));
|
||||||
|
menu->addAction(action);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DisassemblerViewer::setData(QByteArray data)
|
void DisassemblerViewer::setData(QByteArray data)
|
||||||
{
|
{
|
||||||
ui->textArea->setText(data);
|
ui->textArea->setText(data);
|
||||||
|
|
|
@ -26,10 +26,11 @@ public:
|
||||||
void setText(QString text);
|
void setText(QString text);
|
||||||
|
|
||||||
QString getPotentialLabel(quint16 address);
|
QString getPotentialLabel(quint16 address);
|
||||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
virtual bool optionsMenuItems(QMenu *);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setFile(GenericFile *file);
|
void setFile(GenericFile *file);
|
||||||
|
void toggleWordWrap(bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DisassemblerViewer *ui;
|
Ui::DisassemblerViewer *ui;
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
HexDumpViewer::HexDumpViewer(QWidget *parent) :
|
HexDumpViewer::HexDumpViewer(QWidget *parent) :
|
||||||
FileViewerInterface(parent),
|
FileViewerInterface(parent),
|
||||||
|
@ -13,6 +16,9 @@ HexDumpViewer::HexDumpViewer(QWidget *parent) :
|
||||||
|
|
||||||
QString title = QString("Hex Viewer");
|
QString title = QString("Hex Viewer");
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
toggleWordWrap(settings.value("HexViewer.WordWrap",true).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
HexDumpViewer::~HexDumpViewer()
|
HexDumpViewer::~HexDumpViewer()
|
||||||
|
@ -20,6 +26,24 @@ HexDumpViewer::~HexDumpViewer()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HexDumpViewer::toggleWordWrap(bool enabled)
|
||||||
|
{
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
ui->textArea->setWordWrapMode(QTextOption::WordWrap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
|
||||||
|
}
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("HexViewer.WordWrap",enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HexDumpViewer::showHexAndAsciiValues()
|
void HexDumpViewer::showHexAndAsciiValues()
|
||||||
{
|
{
|
||||||
int offset = ui->textArea->verticalScrollBar()->value();
|
int offset = ui->textArea->verticalScrollBar()->value();
|
||||||
|
@ -107,6 +131,19 @@ void HexDumpViewer::setFile(GenericFile *file, quint16 offset)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HexDumpViewer::optionsMenuItems(QMenu *menu)
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
QAction *action = new QAction("&Word Wrap");
|
||||||
|
action->setCheckable(true);
|
||||||
|
action->setChecked(settings.value("HexViewer.WordWrap",true).toBool());
|
||||||
|
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool)));
|
||||||
|
menu->addAction(action);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void HexDumpViewer::setData(QByteArray data)
|
void HexDumpViewer::setData(QByteArray data)
|
||||||
{
|
{
|
||||||
ui->textArea->setHtml(data);
|
ui->textArea->setHtml(data);
|
||||||
|
|
|
@ -24,10 +24,11 @@ public:
|
||||||
void setFile(GenericFile *file) { setFile(file,0); }
|
void setFile(GenericFile *file) { setFile(file,0); }
|
||||||
void setFile(GenericFile *file, quint16 offset);
|
void setFile(GenericFile *file, quint16 offset);
|
||||||
|
|
||||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
virtual bool optionsMenuItems(QMenu *menu);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showHexAndAsciiValues();
|
void showHexAndAsciiValues();
|
||||||
|
void toggleWordWrap(bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setText(QString text);
|
void setText(QString text);
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
TextHexDumpViewer::TextHexDumpViewer(QWidget *parent) :
|
TextHexDumpViewer::TextHexDumpViewer(QWidget *parent) :
|
||||||
FileViewerInterface(parent),
|
FileViewerInterface(parent),
|
||||||
|
@ -14,6 +17,9 @@ TextHexDumpViewer::TextHexDumpViewer(QWidget *parent) :
|
||||||
|
|
||||||
QString title = QString("Text/Hex File Viewer");
|
QString title = QString("Text/Hex File Viewer");
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
toggleWordWrap(settings.value("TexHexViewer.WordWrap",true).toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
TextHexDumpViewer::~TextHexDumpViewer()
|
TextHexDumpViewer::~TextHexDumpViewer()
|
||||||
|
@ -21,6 +27,21 @@ TextHexDumpViewer::~TextHexDumpViewer()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextHexDumpViewer::toggleWordWrap(bool enabled)
|
||||||
|
{
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
ui->textArea->setWordWrapMode(QTextOption::WordWrap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
|
||||||
|
}
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("TextHexViewer.WordWrap",enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString TextHexDumpViewer::makeHexStr(QByteArray data)
|
QString TextHexDumpViewer::makeHexStr(QByteArray data)
|
||||||
{
|
{
|
||||||
QString retval;
|
QString retval;
|
||||||
|
@ -93,3 +114,16 @@ void TextHexDumpViewer::setText(QString text)
|
||||||
{
|
{
|
||||||
ui->textArea->setHtml(text);
|
ui->textArea->setHtml(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TextHexDumpViewer::optionsMenuItems(QMenu *menu)
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
QAction *action = new QAction("&Word Wrap");
|
||||||
|
action->setCheckable(true);
|
||||||
|
action->setChecked(settings.value("TexHexViewer.WordWrap",true).toBool());
|
||||||
|
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool)));
|
||||||
|
menu->addAction(action);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -26,8 +26,10 @@ public:
|
||||||
void setData(QByteArray data);
|
void setData(QByteArray data);
|
||||||
void setText(QString text);
|
void setText(QString text);
|
||||||
|
|
||||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
virtual bool optionsMenuItems(QMenu *menu);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void toggleWordWrap(bool enabled);
|
||||||
protected:
|
protected:
|
||||||
QString makeTextStr(QByteArray data);
|
QString makeTextStr(QByteArray data);
|
||||||
QString makeHexStr(QByteArray data);
|
QString makeHexStr(QByteArray data);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user