This commit is contained in:
parent
658e60825e
commit
2370619d19
|
@ -1127,7 +1127,8 @@ void MainWindow::connectBase(IWingPlugin *plugin) {
|
||||||
PCHECKRETURN(hexfiles[_pcurfile].render->documentLines(), quint64(0));
|
PCHECKRETURN(hexfiles[_pcurfile].render->documentLines(), quint64(0));
|
||||||
});
|
});
|
||||||
ConnectBaseLamba2(WingPlugin::Reader::documentBytes, [=] {
|
ConnectBaseLamba2(WingPlugin::Reader::documentBytes, [=] {
|
||||||
PCHECKRETURN(quint64(hexfiles[_pcurfile].doc->length()), quint64(0));
|
PCHECKRETURN(quint64(hexfiles[_pcurfile].doc->length()),
|
||||||
|
quint64(hexeditor->documentBytes()));
|
||||||
});
|
});
|
||||||
ConnectBaseLamba2(WingPlugin::Reader::currentPos, [=] {
|
ConnectBaseLamba2(WingPlugin::Reader::currentPos, [=] {
|
||||||
HexPosition pos;
|
HexPosition pos;
|
||||||
|
@ -1478,6 +1479,11 @@ void MainWindow::connectControl(IWingPlugin *plugin) {
|
||||||
PCHECK(hexfiles[_pcurfile].doc->cursor()->select(length), );
|
PCHECK(hexfiles[_pcurfile].doc->cursor()->select(length), );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ConnectControlLamba2(WingPlugin::Controller::enabledCursor, [=](bool b) {
|
||||||
|
plgsys->resetTimeout(qobject_cast<IWingPlugin *>(sender()));
|
||||||
|
PCHECK(hexfiles[_pcurfile].render->enableCursor(b), )
|
||||||
|
});
|
||||||
|
|
||||||
ConnectControlLamba2(WingPlugin::Controller::selectOffset, [=](qint64 offset,
|
ConnectControlLamba2(WingPlugin::Controller::selectOffset, [=](qint64 offset,
|
||||||
int length) {
|
int length) {
|
||||||
plgsys->resetTimeout(qobject_cast<IWingPlugin *>(sender()));
|
plgsys->resetTimeout(qobject_cast<IWingPlugin *>(sender()));
|
||||||
|
@ -1964,6 +1970,7 @@ ErrFile MainWindow::openFile(QString filename, bool readonly, int *openedindex,
|
||||||
tabs->setCurrentIndex(index);
|
tabs->setCurrentIndex(index);
|
||||||
tabs->setTabToolTip(index, filename);
|
tabs->setTabToolTip(index, filename);
|
||||||
setEditModeEnabled(true);
|
setEditModeEnabled(true);
|
||||||
|
_currentfile = index;
|
||||||
|
|
||||||
if (_enableplugin) {
|
if (_enableplugin) {
|
||||||
params << ErrFile::Success;
|
params << ErrFile::Success;
|
||||||
|
|
|
@ -138,6 +138,7 @@ enum HookIndex {
|
||||||
Q_DECLARE_METATYPE(WingPluginMessage)
|
Q_DECLARE_METATYPE(WingPluginMessage)
|
||||||
Q_DECLARE_METATYPE(ResponseMsg)
|
Q_DECLARE_METATYPE(ResponseMsg)
|
||||||
Q_DECLARE_METATYPE(HookIndex)
|
Q_DECLARE_METATYPE(HookIndex)
|
||||||
|
Q_DECLARE_METATYPE(ErrFile)
|
||||||
|
|
||||||
namespace WingPlugin {
|
namespace WingPlugin {
|
||||||
class Reader : public QObject {
|
class Reader : public QObject {
|
||||||
|
@ -241,6 +242,7 @@ signals:
|
||||||
void selectOffset(qint64 offset, int length);
|
void selectOffset(qint64 offset, int length);
|
||||||
void setInsertionMode(bool isinsert);
|
void setInsertionMode(bool isinsert);
|
||||||
void setLineWidth(quint8 width);
|
void setLineWidth(quint8 width);
|
||||||
|
void enabledCursor(bool b);
|
||||||
|
|
||||||
// metadata
|
// metadata
|
||||||
bool metadata(qint64 begin, qint64 end, const QColor &fgcolor,
|
bool metadata(qint64 begin, qint64 end, const QColor &fgcolor,
|
||||||
|
@ -370,6 +372,12 @@ public:
|
||||||
|
|
||||||
#define PluginMenuInitEnd() }
|
#define PluginMenuInitEnd() }
|
||||||
|
|
||||||
|
#define USINGCONTROL(Segment) \
|
||||||
|
if (this->requestControl()) { \
|
||||||
|
Segment; \
|
||||||
|
this->requestRelease(); \
|
||||||
|
}
|
||||||
|
|
||||||
class PluginUtils {
|
class PluginUtils {
|
||||||
public:
|
public:
|
||||||
static QString GetPUID(IWingPlugin *plugin) {
|
static QString GetPUID(IWingPlugin *plugin) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ QList<IWingPlugin *> PluginSystem::plugins() { return loadedplgs; }
|
||||||
|
|
||||||
void PluginSystem::raiseDispatch(HookIndex hookindex, QList<QVariant> params) {
|
void PluginSystem::raiseDispatch(HookIndex hookindex, QList<QVariant> params) {
|
||||||
auto dispatch = dispatcher[hookindex];
|
auto dispatch = dispatcher[hookindex];
|
||||||
params << hookindex;
|
params.push_front(hookindex);
|
||||||
for (auto item : dispatch) {
|
for (auto item : dispatch) {
|
||||||
item->plugin2MessagePipe(WingPluginMessage::HookMessage, params);
|
item->plugin2MessagePipe(WingPluginMessage::HookMessage, params);
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,7 @@ void PluginSystem::loadPlugin(QFileInfo fileinfo) {
|
||||||
INSERTSUBSCRIBE(HookIndex::CloseFileEnd);
|
INSERTSUBSCRIBE(HookIndex::CloseFileEnd);
|
||||||
INSERTSUBSCRIBE(HookIndex::NewFileBegin);
|
INSERTSUBSCRIBE(HookIndex::NewFileBegin);
|
||||||
INSERTSUBSCRIBE(HookIndex::NewFileEnd);
|
INSERTSUBSCRIBE(HookIndex::NewFileEnd);
|
||||||
|
INSERTSUBSCRIBE(HookIndex::DocumentSwitched);
|
||||||
|
|
||||||
emit p->plugin2MessagePipe(WingPluginMessage::PluginLoaded, emptyparam);
|
emit p->plugin2MessagePipe(WingPluginMessage::PluginLoaded, emptyparam);
|
||||||
|
|
||||||
|
@ -177,6 +178,7 @@ bool PluginSystem::requestRelease(IWingPlugin *plugin) {
|
||||||
plugintimer[plugin]->stop();
|
plugintimer[plugin]->stop();
|
||||||
plugintimeout[plugin] = false;
|
plugintimeout[plugin] = false;
|
||||||
curpluginctl = nullptr;
|
curpluginctl = nullptr;
|
||||||
|
mutex.unlock();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue