far-plugins
far-plugins copied to clipboard
FarHints 1.0.16 and Far2 with mode /w
Проблемы с позиционированием вывода при
использовании новой фичи Far2 - ключа "/w".
Original issue reported on code.google.com by [email protected]
on 9 Aug 2010 at 3:06
fix: "FarHintsMain.pas"
function GetConsoleMousePos :TPoint;
{ Вычисляем позицию мыши в консольных координатах }
var
vWnd :THandle;
vPos :TPoint;
vRect :TRect;
//+
vFarRect: TSmallRect;
//+.
begin
GetCursorPos(vPos);{}
vWnd := hConsoleWnd;
ScreenToClient(vWnd, vPos);
GetClientRect(vWnd, vRect);
//+
vFarRect := FarGetWindowRect;
with vFarRect do begin
dec(Bottom, Top);
Top:=0;
dec(Right, Left);
Left := 0;
Result.Y := Top + MulDivTrunc(vPos.Y, Bottom - Top + 1, vRect.Bottom - vRect.Top);
Result.X := Left + MulDivTrunc(vPos.X, Right - Left + 1, vRect.Right - vRect.Left);
end;
//+.
end;
function ConsolePosToWindowPos(AX, AY :Integer) :TPoint;
{ Пересчитываем консольные координаты в координаты Windows }
var
vWnd :THandle;
vRect :TRect;
//+
vFarRect: TSmallRect;
//+.
begin
vWnd := hConsoleWnd;
GetClientRect(vWnd, vRect);
//+
vFarRect := FarGetWindowRect;
with vFarRect do begin
dec(Bottom, Top);
Top:=0;
dec(Right, Left);
Left := 0;
Result.Y := MulDiv(AY - Top, vRect.Bottom, Bottom - Top + 1);
Result.X := MulDiv(AX - Left, vRect.Right, Right - Left + 1);
end;
//+.
ClientToScreen(vWnd, Result);
end;
Original comment by [email protected]
on 20 Oct 2010 at 8:20
Attachments: