Commit 609ae4f2 authored by hjk's avatar hjk
Browse files

bineditor: add a facility to invalidate the cache from the outside

This is necessary to handle "live updates". Originally done by ck.
parent b9f92c29
......@@ -1264,7 +1264,10 @@ void BinEditor::changeData(int position, uchar character, bool highNibble)
cmd.character = (uchar) dataAt(position);
cmd.highNibble = highNibble;
if (!highNibble && !m_undoStack.isEmpty() && m_undoStack.top().position == position && m_undoStack.top().highNibble) {
if (!highNibble
&& !m_undoStack.isEmpty()
&& m_undoStack.top().position == position
&& m_undoStack.top().highNibble) {
// compress
cmd.character = m_undoStack.top().character;
m_undoStack.pop();
......@@ -1400,6 +1403,11 @@ void BinEditor::setNewWindowRequestAllowed()
m_canRequestNewWindow = true;
}
void BinEditor::updateContents()
{
setLazyData(baseAddress() + cursorPosition(), dataSize(), m_blockSize);
}
QPoint BinEditor::offsetToPos(int offset)
{
const int x = m_labelWidth + (offset % 16) * m_columnWidth;
......
......@@ -73,6 +73,7 @@ public:
inline int lazyDataBlockSize() const { return m_blockSize; }
Q_INVOKABLE void addLazyData(quint64 block, const QByteArray &data);
Q_INVOKABLE void setNewWindowRequestAllowed();
Q_INVOKABLE void updateContents();
bool save(const QString &oldFileName, const QString &newFileName);
void zoomIn(int range = 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment