本文整理汇总了C++中PluginStartupInfo::EditorControl方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginStartupInfo::EditorControl方法的具体用法?C++ PluginStartupInfo::EditorControl怎么用?C++ PluginStartupInfo::EditorControl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginStartupInfo
的用法示例。
在下文中一共展示了PluginStartupInfo::EditorControl方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Undo
static void Undo()
{
char *Lines = (char*)StackPop();
free(Lines);
EditorUndoRedo eur = {sizeof(EditorUndoRedo), EUR_UNDO};
Info.EditorControl(-1, ECTL_UNDOREDO, 0, &eur);
struct EditorSetPosition es = {sizeof(EditorSetPosition)};
if (--nChanges == 0) {
if (bLineChanged) {
es.CurLine = OriginalLine;
es.TopScreenLine = OriginalLine;
}
else {
es.CurLine = InitialLine;
es.TopScreenLine = InitialTop;
}
es.CurPos = InitialCol;
es.CurTabPos = es.LeftPos = es.Overtype = -1;
}
else {
es.CurLine = 0;
es.CurPos = 0;
es.TopScreenLine = 0;
es.CurTabPos = es.LeftPos = es.Overtype = -1;
}
Info.EditorControl(-1, ECTL_SETPOSITION, 0, &es);
}
示例2: HighlightLine
static void HighlightLine(intptr_t nLine)
{
EditorInfo einfo = {sizeof(EditorInfo)};
Info.EditorControl(-1, ECTL_GETINFO, 0, &einfo);
EditorSelect sel = {sizeof(EditorSelect)};
sel.BlockHeight=1;
sel.BlockStartLine=nLine;
sel.BlockStartPos=0;
sel.BlockType=BTYPE_STREAM;
sel.BlockWidth=einfo.WindowSizeX;
Info.EditorControl(-1, ECTL_SELECT, 0, &sel);
}
示例3: ScrollText
static void ScrollText(ScrollType st)
{
EditorInfo einfo = {sizeof(EditorInfo)};
EditorSetPosition es = {sizeof(EditorSetPosition)};
Info.EditorControl(-1, ECTL_GETINFO, 0, &einfo);
switch (st) {
case stDn:
es.CurLine = einfo.CurLine+1;
break;
case stUp:
es.CurLine = einfo.CurLine-1;
break;
case stPgDn:
es.CurLine = einfo.CurLine+einfo.WindowSizeY-1;
es.TopScreenLine = einfo.TopScreenLine+einfo.WindowSizeY-1;
break;
case stPgUp:
es.CurLine = einfo.CurLine-einfo.WindowSizeY+1;
es.TopScreenLine = einfo.TopScreenLine-einfo.WindowSizeY+1;
break;
case stEnd:
es.CurLine = /*es.TopScreenLine = */einfo.TotalLines-1;
break;
default:
es.CurLine = /*es.TopScreenLine = */0;
break;
}
bLineChanged = true;
es.CurPos = -1;
es.CurTabPos = es.LeftPos = es.Overtype = -1;
Info.EditorControl(-1, ECTL_SETPOSITION, 0, &es);
//обновим № исходной строки
Info.EditorControl(-1, ECTL_GETINFO, 0, &einfo);
char *Lines = (char*)StackPeek();
OriginalLine = CalcOriginalLine(einfo.CurLine);
HighlightLine(einfo.CurLine);
Info.AdvControl(&PluginId, ACTL_REDRAWALL, 0, NULL);
}
示例4: OpenW
HANDLE WINAPI OpenW(const OpenInfo *OInfo)
{
static FarDialogItem DlgItems[]={
/* 0*/ {DI_DOUBLEBOX,2, 1,37, 5, {0},NULL ,NULL ,0 ,GetMsg(MTitle)},
/* 1*/ {DI_EDIT ,4, 2,34, 2, {1},PluginName,NULL ,DIF_HISTORY ,L""},
/* 2*/ {DI_CHECKBOX ,4, 3, 0, 0, {0},0 ,NULL ,0 ,GetMsg(MCase)},
/* 3*/ {DI_BUTTON ,0, 4, 0, 0, {0},0 ,NULL ,DIF_CENTERGROUP|DIF_DEFAULTBUTTON,GetMsg(MOk)},
/* 4*/ {DI_BUTTON ,0, 4, 0, 0, {0},0 ,NULL ,DIF_CENTERGROUP ,GetMsg(MCancel)}
};
CFarSettings settings(PluginId);
bPrevCaseSensitive = settings.Get(L"CaseSensitive", false);
DlgItems[ixCaseSensitive].Selected = bPrevCaseSensitive ? 1 : 0;
HANDLE hEdit = Info.DialogInit(&PluginId, &DialogId,
-1, -1, 40, 7,
PluginName,
DlgItems, ArraySize(DlgItems),
0, 0,
MyDlgProc, 0);
if (hEdit == INVALID_HANDLE_VALUE)
return INVALID_HANDLE_VALUE;
EditorInfo einfo = {sizeof(EditorInfo)};
Info.EditorControl(-1, ECTL_GETINFO, 0, &einfo);
InitialLine = einfo.CurLine;
InitialCol = einfo.CurPos;
InitialTop = einfo.TopScreenLine;
TotalLines = einfo.TotalLines;
nChanges = 0;
bSequentialInput = true;
bLineChanged = false;
ctx = SearchAlloc();
if (Info.DialogRun(hEdit)!=ixOk)
UndoAll();
RemoveHighlight();
settings.Set(L"CaseSensitive", bPrevCaseSensitive);
Info.DialogFree(hEdit);
if (Length(PrevPattern)<MAX_PATTERN_LEN)
SearchFree(ctx);
else
SearchHFree(ctx);
SetLength(&PrevPattern,0);
return INVALID_HANDLE_VALUE;
}
示例5: Filter
static void Filter(const wchar_t *sFilter, bool bCaseSensitive)
{
if (sFilter!=NULL) {
size_t nFilter = wcslen(sFilter);
if (nFilter>0xFFFF) nFilter = 0xFFFF;
wchar_t *sFilterLower=NULL;
EditorUndoRedo eur = {sizeof(EditorUndoRedo)};
EditorSetPosition es = {sizeof(EditorSetPosition)};
char *Lines; //маска удалённых строк
Lines = MakeLineMask();
StackPush(Lines);
if (nFilter<=MAX_PATTERN_LEN) {
SearchPrepare(ctx, sFilter, bCaseSensitive);
}
else {
SearchHPrepare(ctx, sFilter, (WORD)nFilter, bCaseSensitive);
if (!bCaseSensitive) {
SetLength(&sFilterLower, (int)nFilter);
wcscpy(sFilterLower, sFilter);
CharLower(sFilterLower);
}
}
//непустой фильтр - создаём блок Undo и меняем текст внутри него
eur.Command=EUR_BEGIN;
Info.EditorControl(-1, ECTL_UNDOREDO, 0, &eur);
//ищем текст из диалога в каждой строке
EditorInfo einfo = {sizeof(EditorInfo)};
Info.EditorControl(-1, ECTL_GETINFO, 0, &einfo);
intptr_t nLines = einfo.TotalLines;
intptr_t line = nLines;
es.CurPos = 0;
es.CurTabPos = es.LeftPos = es.Overtype = es.TopScreenLine = -1;
while (--line>=0) {
es.CurLine = line;
Info.EditorControl(-1, ECTL_SETPOSITION, 0, &es);
EditorGetString egs = {sizeof(EditorGetString), -1};
Info.EditorControl(-1, ECTL_GETSTRING, 0, &egs);
const wchar_t *found;
if (nFilter <= MAX_PATTERN_LEN)
found = Search(ctx, egs.StringText);
else
found = SearchH(ctx,
bCaseSensitive ? sFilter : sFilterLower,
(WORD)nFilter,
egs.StringText,
egs.StringLength,
bCaseSensitive);
if (found==NULL) {
Info.EditorControl(-1, ECTL_DELETESTRING, 0, NULL);
MarkDeletedLine(Lines, line);
}
}
es.CurLine = 0;
es.CurPos = 0;
es.TopScreenLine = 0;
es.CurTabPos = es.LeftPos = es.Overtype = -1;
Info.EditorControl(-1, ECTL_SETPOSITION, 0, &es);
RemoveHighlight();
eur.Command=EUR_END;
Info.EditorControl(-1, ECTL_UNDOREDO, 0, &eur);
nChanges++;
if (nFilter<=MAX_PATTERN_LEN) {
SearchUnprepare(ctx,sFilter,bCaseSensitive);
}
else {
if (!bCaseSensitive)
SetLength(&sFilterLower, 0);
}
}
}
示例6: RemoveHighlight
static void RemoveHighlight()
{
EditorSelect sel = {sizeof(EditorSelect)};
sel.BlockType=BTYPE_NONE;
Info.EditorControl(-1, ECTL_SELECT, 0, &sel);
}
示例7: getEditorId
static int getEditorId(const PluginStartupInfo &info) {
EditorInfo ei = {0};
info.EditorControl(ECTL_GETINFO, &ei);
return ei.EditorID;
}