Конференция "KOL" » FreePascal [FPC, Windows]
 
  • awkward © (21.07.12 22:30) [0]
    Знаю, подобное уже обсуждалось. Попробовал скомпилировать KOL под FreePascal, введя дополнительное условие:

     {$IFNDEF FPC}
       {$IFDEF UNICODE_CTRLS}
         {$DEFINE interface_part} {$I KOL_unicode.inc} {$UNDEF interface_part}
       {$ELSE} // ANSI_CTRLS
         {$DEFINE interface_part} {$I KOL_ansi.inc} {$UNDEF interface_part}
       {$ENDIF UNICODE_CTRLS}
     {$ENDIF}


    и для реализации так же.
    Потом следующие 4-5 замен:

    {$IFDEF FPC}
      Result := CompareFileTime( @ft1, @ft2 );
    {$ELSE}
      Result := CompareFileTime( ft1, ft2 );
    {$ENDIF}


    Всё скомпилировалось, но надо сделать порядка 120 замен кода, где предупреждения типа:
    Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
    или
    Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.
    Может, автор сам сделает необходимые правки? А то будет обидно, если я сделаю у себя исправления, а потом будет другой вариант...

    PS. Компиляция FPC в 64 бит выдала пару ошибок, связанных с размерами операндов: в TStream.DoAsyncRead и TStream.DoAsyncWrite
  • Thaddy © (24.07.12 12:39) [1]
    It really depends on the source material.
    For example in FPC 2.7.1 you can have D2010 + compatability with some new compiler switches like
    {$MODE DelphiUnicode}



    Which version of FPC are you using? Do you use ppdelphi pack or the rtl sources from Delphi? In that case, which Delphi version are the sources written for?

    I recommend to NOT use ppdelphi pack, but the rtl/win sources from either Delphi 5 or 7.
    For FPC version 2.6.0 or higher I recommend to add:

    {$UNDEF FPC} //!! first
    {$DEFINE VER170}
    {$MODE DELPHI} //(or c.l. -Mdelphi )
    //{$MODE DelphiUnicode} //Activates unicode string type (refcounted) instead of widestring
    {$DEFINE PASVERSION} //or c.l. -dPASVERSION




    Btw: if some changes the assembler OFFSET pseudo instructions with LEA based code then even all assembler will work from FPC 2.6.0.
  • thaddy © (24.07.12 13:15) [2]
    Oh sorry, not complete:
    First the last: You can not use KOL in 64 bit FPC yet. There is a lot of hardcoded pointer sizes ( * 4 instead if * SizeOf(Pointer) ) and other issues, like integer sizes: Pointersize maps to NativeInt, not to integer which always maps to 32bit

    The warnings can be turned off by their warning number in FPC.
    FPC is a lot more verbose than Delphi. In principle these can be switched off  by compiler option:
    fpc <more options> -vm4056,4086 <your program>



    Or put that in fpc.cfg

    This turns the two "warnings" that you mention off.
    TIP: You can find the warning numbers by compiling with
    fpc -vq

  • awkward © (24.07.12 14:31) [3]
    i don't remember all settings but i prefer to use native FPC (2.6) units/sources, no any "compatibility" packs.  By working with not my project, keep "string" types as AnsiString and WideString atm, maybe will remove these types in future (prefer to use WinAPI level things). Uses Delphi mode by default, btw, added next lines to KOLDEF.inc

    {$IFDEF WIN64}
     {$DEFINE x64}
     {$DEFINE PAS_VERSION}
    {$ENDIF}


    ... and i still need both, 32 and 64 bit...
    ... and hope what KOL will be changed for FPC compiler work...
  • Thaddy © (25.07.12 11:59) [4]
    If you can send me the sources, I know I can compile them in Delphi and FPC 32 bit.

    I also know that at the moment it is not possible to have KOL related sources in XE2 and the other way around.....

    But I hope the advice worked: these messages are for Xplatform. As long as you compile for windows 32, you can swtich them off
  • awkward © (25.07.12 13:51) [5]
    i don't uses KOL+FPC compilation atm. and fight with XE2 bugs and KOL misunderstanding in other project. but these sources will not help in anything.
    but all "working" plugins sources are at https://code.google.com/p/delphi-miranda-plugins/ (i trying to avoid KOL where it is not necessary, kept in mRadio and Watrack plugins only)
  • NetSpirit (04.10.12 16:34) [6]
    Hi, I make test project for FPC 2.6.0 + KOL 3.18. Anyone can get it here:
    http://rghost.ru/40733629
    There is instructions in this archive.
    But, what my question: as you can see, there is a bug with transparence of Label (in Delphi 7 also) and wrong display of TabControl (only FPC). Can anyone help with this?

    =====

    Здравствуйте! Удалось подключить KOL 3.18 к FPC 2.6.0. Здесь тестовый проект и все необходимое для компиляции под FPC: http://rghost.ru/40733629
    Собственно, вопрос: в тестовом проекте видно ошибку в отрисовке Label со включенной прозрачностью (на Делфи 7 то же самое), а также неверно отрисовывается первая вкладка TabControl (только в FPC). Можно как-то это исправить?
  • Дмитрий К © (04.10.12 17:22) [7]
    По поводу TabControl. Не поможет ли -dUSE_OLD_FLAGS?
  • NetSpirit (04.10.12 19:11) [8]
    Спасибо, помогло. А не знаете, что с прозрачностью Label?
  • Дмитрий К © (04.10.12 19:14) [9]
    Не знаю. Есть подозрение, что работает только поверх родителя.
  • Smile (04.10.12 21:04) [10]
    Объясните мне, необразованному, в чем прикол использовать (юзать) KOL?
  • Hallif © (05.10.12 10:51) [11]

    > видно ошибку в отрисовке Label со включенной прозрачностью

    Обсуждалось в этой ветке [url]http://pda.delphimaster.net/?id=1244657683&n=10[/url]
    пробуйте с директивой OLD_TRANSPARENT
  • Hallif © (05.10.12 11:56) [12]

    > в чем прикол использовать (юзать) KOL?

    Так сразу и не скажешь... Читайте книги и "образуетесь".
  • NetSpirit (05.10.12 12:20) [13]
    Насчет TabControl - проблема в процедуре WndProcTabControl, в той части, что работает при включенном дефайне NEW_ALIGN. То-есть, избежать этой ошибки помогает кроме дефайна USE_OLD_FLAGS ещё и дефайн OLD_ALIGN. Пытаюсь выяснить, почему в Delphi работает правильно, а в FPC - нет.
  • NetSpirit (05.10.12 12:24) [14]
    > пробуйте с директивой OLD_TRANSPARENT
    Попробовал, появляются синтаксические ошибки, видно давно на этот дефайн не обращали внимания. Пока не разбирался.
  • Hallif © (05.10.12 16:19) [15]
    Исправленная функция:
    где строка  --//--, далее по тексту нет изменений

    {$IFDEF OLD_TRANSPARENT}
    function WndProcTransparent( Sender: PControl; var Msg: TMsg;
        var Rslt: Integer ): Boolean;
    var      DC, PDC, BLTDC: HDC;
             Save: integer;
             OLDp: THANDLE;
             L, T: SmallInt;
             TP, ParentClient: TPoint;
             TR, Margins: TRect;
             Wnd: HWND;
             tRgn: HRgn;
             C: PControl;
    begin
        Result := FALSE;
        {$IFDEF STOP_WNDPROCTRANSPARENT_AFTER_APPLETTERMINATED}
        if AppletTerminated or not Sender.ToBeVisible then
        begin
          Exit;
        end;
        {$ENDIF}

        case Msg.message of
            WM_HSCROLL, WM_VSCROLL:
                begin
                    Sender.Invalidate;
                    exit;
                end;
            WM_SETTEXT:
                begin
                    if  {$IFDEF USE_FLAGS} not(G1_IsStaticControl in Sender.fFlagsG1)
                        {$ELSE} Sender.fIsStaticControl = 0 {$ENDIF} then exit;
                    Sender.Invalidate;
                    Rslt := DefWindowProc
                      ( Sender.fHandle, WM_SETTEXT, Msg.wParam, Msg.lParam );
                    Result := TRUE;
                    exit;
                end;
            WM_NCPAINT:
                begin
                    if {$IFDEF USE_FLAGS} G2_Transparent in Sender.fFlagsG2
                       {$ELSE} Sender.fTransparent {$ENDIF} then
                        Result := TRUE;
                    exit;
                end;
        end;

        if  {$IFDEF USE_FLAGS} (G2_Transparent in Sender.fFlagsG2)
            {$ELSE} Sender.fTransparent {$ENDIF} and (
            {$IFDEF USE_FLAGS} not(G2_DoubleBuffered in Sender.FParent.fFlagsG2)
            {$ELSE} not Sender.fParent.fDoubleBuffered {$ENDIF} ) then
            {$IFDEF USE_FLAGS} exclude( Sender.fFlagsG2, G2_Transparent );
            {$ELSE}  Sender.fTransparent := FALSE; {$ENDIF}
        if  {$IFDEF USE_FLAGS} [G2_DoubleBuffered, G2_Transparent] * Sender.fFlagsG2 = []
            {$ELSE} not (Sender.fTransparent or Sender.fDoubleBuffered) {$ENDIF} then exit;
        if  Sender.fAnchors and SELF_REQ_PAINT <> 0 then exit;

        case Msg.message of
            WM_ERASEBKGND:
                begin
                    Result := TRUE;
                end;
            WM_PAINT:
                begin
                    ValidateRect(Sender.fHandle, nil);  //???--brandys???
                    if {$IFDEF USE_FLAGS} (G2_Transparent in Sender.fFlagsG2)
                       {$ELSE} Sender.fTransparent {$ENDIF}
                    and (Sender.fAnchors and PARENT_REQ_PAINT = 0) then
                    begin
                        InvalidateRect(Sender.fParent.Handle, nil, FALSE);
                        Result := TRUE;
                        exit;
                    end;

                    GetClientRect(Msg.hwnd, Margins);
                    OLDp := 0;
                    if  Sender.fAnchors and PARENT_REQ_PAINT = 0 then
                    begin
                        Sender.fDblExcludeRgn := CreateRectRgn(0, 0, Margins.Right, Margins.Bottom);
                        DC := GetDC(0);
                        PDC := CreateCompatibleDC( DC );
                        OLDp := SelectObject(PDC,
                            CreateCompatibleBitmap(DC, Margins.Right, Margins.Bottom) );
                        ReleaseDC(0, DC);
                        Sender.fParentCoordX := 0;
                        Sender.fParentCoordy := 0;
                    end else begin
                        PDC := Msg.wParam;
                        Sender.fDblExcludeRgn := Sender.fParent.fDblExcludeRgn;
                    end;

                    Sender.fAnchors := Sender.fAnchors or SELF_REQ_PAINT;
                    Sender.fPaintDC := PDC;
                    if  (Sender.fAnchors and PARENT_REQ_PAINT = 0) or
                        {$IFDEF USE_FLAGS} (G2_DoubleBuffered in Sender.fFlagsG2)
                        {$ELSE} Sender.fDoubleBuffered {$ENDIF} then
                        Sender.Perform(WM_ERASEBKGND, PDC, 0);
                    Sender.Perform(WM_PAINT, PDC, 0);

                    Wnd := GetWindow( Sender.fHandle, GW_CHILD );
                    Wnd := GetWindow( Wnd, GW_HWNDLAST);
                    while Wnd <> 0 do begin
                        if IsWindowVisible(Wnd) then begin
                            {$IFDEF USE_PROP}
                            C := Pointer( GetProp( Wnd, ID_SELF ) );
                            {$ELSE}
                            C := Pointer( GetWindowLong( Wnd, GWL_USERDATA ) );
                            {$ENDIF}
                            with C^ do begin
                                if  (C <> nil) and
                                    {$IFDEF USE_FLAGS} ( [G2_DoubleBuffered, G2_Transparent]
                                            * fFlagsG2 <> [] )
                                    {$ELSE} (fTransparent or fDoubleBuffered) {$ENDIF} then
                                begin
    --//--
    end;
    {$ELSE NEW_TRANSPARENT}

  • NetSpirit (05.10.12 16:46) [16]
    FPC ругнулся на конструкции Include(...), Exclude (...) - поправил, скомпилировало. Но внешний облик Label с прозрачностью не изменился - перекрывающиеся области двух Label не перерисовываются.
  • gur © (17.09.13 13:45) [17]
    доброго времени суток

    не пойму - как можно в лазарус установить kol_mck?????

    подскажите добрые люди

    и вообще можно-ли в него чтото установить, а то я в нём начинаю потихоньку разочаровываться
  • L`Autour (19.09.13 06:11) [18]
    gur
    KOL-CE
  • Gur © (21.09.13 20:47) [19]
    Есть подробные инструкции?
 
Конференция "KOL" » FreePascal [FPC, Windows]
Есть новые Нет новых   [118591   +45][b:0][p:0.006]