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