kapai69 / far-plugins

Automatically exported from code.google.com/p/far-plugins
0 stars 0 forks source link

FarHints 1.0.16 and Far2 with mode /w #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Проблемы с позиционированием вывода при 
использовании новой фичи Far2 - ключа "/w".

Original issue reported on code.google.com by pult....@gmail.com on 9 Aug 2010 at 3:06

GoogleCodeExporter commented 9 years ago
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 pult....@gmail.com on 20 Oct 2010 at 8:20

Attachments:

GoogleCodeExporter commented 9 years ago
Проверил, работает! Спасибо!

Original comment by tsuli...@gmail.com on 20 Oct 2010 at 7:24