Recent

Author Topic: convert Sebran delphi(4) code to lazarus  (Read 94125 times)

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: convert Sebran delphi(4) code to lazarus
« Reply #45 on: February 09, 2009, 03:48:35 pm »
* Compile the unit in mode Delphi
* BrushCopy is not available in the LCL.

von_ks

  • Jr. Member
  • **
  • Posts: 57
Re: convert Sebran delphi(4) code to lazarus
« Reply #46 on: February 11, 2009, 09:55:54 am »


Hi

There is still one error.
I have choosen delphi mode.
And I tried to find another MPlayer but I did not have success.
Is there a workaround for Brushcopy ?

Hint: Start of reading config file D:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg
Hint: End of reading config file D:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 2.2.2 [2008/10/05] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling package01.pas
Compiling D:\delphi\consts.pas
Writing Resource String Table file: consts.rst
Compiling MPlayer.pas
D:\Temp\MPlayer.pas(101,15) Warning: An inherited method is hidden by "TMediaPlayer.SetVisible(TButtonSet)"
D:\Temp\MPlayer.pas(283,52) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(503,14) Error: Identifier not found "BrushCopy"
D:\Temp\MPlayer.pas(848,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(898,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(943,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(978,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1000,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1030,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1050,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1110,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1168,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1196,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1240,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1267,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1288,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1314,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1324,47) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1335,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1346,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1373,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1417,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1431,61) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1465,61) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1487,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1501,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1518,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1523,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1528,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1533,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1538,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1547,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1560,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1571,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1582,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1592,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1602,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1613,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1694,36) Hint: Converting the operands to "Int64" before doing the add could prevent overflow errors.
D:\Temp\MPlayer.pas(1694,36) Hint: Converting the operands to "Int64" before doing the multiply could prevent overflow errors.
D:\Temp\MPlayer.pas(1695,18) Hint: Converting the operands to "Int64" before doing the multiply could prevent overflow errors.
D:\Temp\MPlayer.pas(1754) Fatal: There were 1 errors compiling module, stopping

Leledumbo

  • Hero Member
  • *****
  • Posts: 8273
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: convert Sebran delphi(4) code to lazarus
« Reply #47 on: February 11, 2009, 10:43:11 am »
Quote
There is still one error.
I have choosen delphi mode.
And I tried to find another MPlayer but I did not have success.
Is there a workaround for Brushcopy ?
There's no relation between selected mode and available methods (though you might have it so). The workaround is to implement BrushCopy yourself. I've found something in the bug tracker that might help.

von_ks

  • Jr. Member
  • **
  • Posts: 57
Re: convert Sebran delphi(4) code to lazarus
« Reply #48 on: February 11, 2009, 11:11:09 am »

Hi

What could be the probelm now ?
Parameter color is missing ?
wrong number of parametr ?



Hint: Start of reading config file D:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg
Hint: End of reading config file D:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 2.2.2 [2008/10/05] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling package01.pas
Compiling D:\delphi\consts.pas
Writing Resource String Table file: consts.rst
Compiling MPlayer.pas
D:\Temp\MPlayer.pas(101,15) Warning: An inherited method is hidden by "TMediaPlayer.SetVisible(TButtonSet)"
D:\Temp\MPlayer.pas(283,52) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(434,42) Hint: Parameter "Color" not used
D:\Temp\MPlayer.pas(515,63) Error: Wrong number of parameters specified for call to "BrushCopy"
D:\Temp\MPlayer.pas(433,11) Hint: Found declaration: BrushCopy(TCanvas,const RECT, TBitmap,const RECT, TGraphicsColor)
D:\Temp\MPlayer.pas(859,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(909,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(954,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(989,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1011,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1041,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1061,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1121,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1179,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1207,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1251,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1278,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1299,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1325,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1335,47) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1346,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1357,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1384,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1428,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1442,61) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1476,61) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1498,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1512,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1529,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1534,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1539,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1544,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1549,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1558,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1571,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1582,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1593,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1603,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1613,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1624,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1705,36) Hint: Converting the operands to "Int64" before doing the add could prevent overflow errors.
D:\Temp\MPlayer.pas(1705,36) Hint: Converting the operands to "Int64" before doing the multiply could prevent overflow errors.
D:\Temp\MPlayer.pas(1706,18) Hint: Converting the operands to "Int64" before doing the multiply could prevent overflow errors.
D:\Temp\MPlayer.pas(1765) Fatal: There were 1 errors compiling module, stopping

von_ks

  • Jr. Member
  • **
  • Posts: 57
Re: convert Sebran delphi(4) code to lazarus
« Reply #49 on: February 11, 2009, 02:31:57 pm »
Hi

Do you know some other usefull links ?
let me know please.

tanx

Leledumbo

  • Hero Member
  • *****
  • Posts: 8273
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: convert Sebran delphi(4) code to lazarus
« Reply #50 on: February 12, 2009, 05:13:05 am »
Would you mind posting the source around the lines where the error occurs (511-520 perhaps)?

von_ks

  • Jr. Member
  • **
  • Posts: 57
Re: convert Sebran delphi(4) code to lazarus
« Reply #51 on: February 12, 2009, 12:05:08 pm »
Hi

The line is programm stopping is the secound one.


    BrushCopy(Bounds(X + BX, BY, Bitmap.Width, Bitmap.Height),
      Bitmap, Rect(0, 0, Bitmap.Width, Bitmap.Height), clOlive);

the cursor is standing after clOlive.

and it happens in procedure Tmediaplayer


procedure TMediaPlayer.DrawButton(Btn: TMPBtnType; X: Integer);
var
  IsDown: Boolean;
  BX, BY: Integer;
  TheGlyph: TMPGlyph;
  Bitmap: TBitmap;
  R: TRect;
begin
  IsDown := Down and (Btn = CurrentButton);
  with Canvas do
  begin
    Brush.Style := bsSolid;
    Brush.Color := clBtnFace;
    Pen.Color := clWindowFrame;
    Pen.Width := 1;
    Rectangle(X, 0, X + ButtonWidth, Height);

    { draw button beveling }
    if IsDown then
    begin
      Pen.Color := clBtnShadow;
      MoveTo(X + 1, Height - 2);
      LineTo(X + 1, 1);
      LineTo(X + ButtonWidth - 1, 1);
    end
    else
    begin
      Pen.Color := clBtnHighlight;
      MoveTo(X + 1, Height - 2);
      LineTo(X + 1, 1);
      LineTo(X + ButtonWidth - 1, 1);
      Pen.Color := clBtnShadow;
      MoveTo(X + 2, Height - 2);
      LineTo(X + ButtonWidth - 2, Height - 2);
      LineTo(X + ButtonWidth - 2, 1);
    end;

    {which bitmap logic - based on Enabled, Colored, and AutoEnable}
    if Enabled or (csDesigning in ComponentState) then
    begin {Enabled only affects buttons at runtime}
      if FAutoEnable and not (csDesigning in ComponentState) then
      begin {AutoEnable only affects buttons at runtime}
        if Buttons[Btn].Auto then {is button available, based on device state}
        begin
          TheGlyph := mgEnabled;
          if Buttons[Btn].Colored then
            TheGlyph := mgColored;
        end
        else TheGlyph := mgDisabled; {button is not available}
      end
      else {when not AutoEnabled or at design-time, check Enabled}
      begin
        if Buttons[Btn].Enabled then
        begin
          TheGlyph := mgEnabled;
          if Buttons[Btn].Colored then
            TheGlyph := mgColored;
        end
        else TheGlyph := mgDisabled;
      end;
    end
    else TheGlyph := mgDisabled; {main switch set to disabled}

    Bitmap := Buttons[Btn].Bitmaps[TheGlyph];
    BX := (ButtonWidth div 2) - (Bitmap.Width div 2);
    BY := (Height div 2) - (Bitmap.Height div 2);
    if IsDown then
    begin
      Inc(BX);
      Inc(BY);
    end;
    BrushCopy(Bounds(X + BX, BY, Bitmap.Width, Bitmap.Height),
      Bitmap, Rect(0, 0, Bitmap.Width, Bitmap.Height), clOlive);
  end;

  if (GetFocus = Handle) and (Btn = FocusedButton) then
  begin
    R := Bounds(X, 0, ButtonWidth, Height);
    InflateRect(R, -3, -3);
    if IsDown then OffsetRect(R, 1, 1);
    DrawFocusRect(Canvas.Handle, R);
  end;
end;   

von_ks

  • Jr. Member
  • **
  • Posts: 57
Re: convert Sebran delphi(4) code to lazarus
« Reply #52 on: February 12, 2009, 12:09:20 pm »


I have see a site for replacing Brushcopy with CopyRect
but I think it is for linux.
http://wiki.lazarus.freepascal.org/RXfpc/fr
What do you think about that ?


Leledumbo

  • Hero Member
  • *****
  • Posts: 8273
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: convert Sebran delphi(4) code to lazarus
« Reply #53 on: February 13, 2009, 06:01:28 am »
Quote
Wrong number of parameters specified for call to "BrushCopy"
Indeed, the BrushCopy requires 5 parameters while the procedure only calls with 4. The first parameter (TCanvas) seems missing, please specify it.

von_ks

  • Jr. Member
  • **
  • Posts: 57
Re: convert Sebran delphi(4) code to lazarus
« Reply #54 on: February 13, 2009, 09:07:34 am »
could you give me more details how should I specify the missing parameter please ?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8273
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: convert Sebran delphi(4) code to lazarus
« Reply #55 on: February 13, 2009, 11:28:29 am »
What about:
Code: [Select]
BrushCopy(Canvas,Bounds(X + BX, BY, Bitmap.Width, Bitmap.Height),
      Bitmap, Rect(0, 0, Bitmap.Width, Bitmap.Height), clOlive);

von_ks

  • Jr. Member
  • **
  • Posts: 57
Re: convert Sebran delphi(4) code to lazarus
« Reply #56 on: February 13, 2009, 11:54:06 am »

The problem with Brushcopy seems to be solved.
I came one step forward.
But compiler is now stopped at the End of Mplayer.pas and give the folowing message.

D:\Temp\MPlayer.pas(1762,3) Error: Can't open resource file: MPLAYER.res
D:\Temp\MPlayer.pas(1762,3) Fatal: There were 1 errors compiling module, stopping


here is the whole compiller message

Hint: Start of reading config file D:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg
Hint: End of reading config file D:\lazarus\fpc\2.2.2\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 2.2.2 [2008/10/05] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling package01.pas
Compiling D:\delphi\consts.pas
Writing Resource String Table file: consts.rst
Compiling MPlayer.pas
D:\Temp\MPlayer.pas(101,15) Warning: An inherited method is hidden by "TMediaPlayer.SetVisible(TButtonSet)"
D:\Temp\MPlayer.pas(283,52) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(434,42) Hint: Parameter "Color" not used
D:\Temp\MPlayer.pas(104,33) Hint: Parameter "YPos" not used
D:\Temp\MPlayer.pas(123,23) Hint: Parameter "Button" not used
D:\Temp\MPlayer.pas(124,27) Hint: Parameter "Button" not used
D:\Temp\MPlayer.pas(111,31) Hint: Parameter "Message" not used
D:\Temp\MPlayer.pas(113,30) Hint: Parameter "Message" not used
D:\Temp\MPlayer.pas(115,31) Hint: Parameter "Message" not used
D:\Temp\MPlayer.pas(149,38) Hint: Parameter "Shift" not used
D:\Temp\MPlayer.pas(859,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(909,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(954,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(989,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1011,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1041,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1061,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1121,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1179,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1207,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1251,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1278,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1299,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1325,57) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1335,47) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1346,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1357,49) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1384,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1428,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1442,61) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1476,61) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1498,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1512,60) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1529,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1534,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1539,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1544,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1549,53) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1558,58) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1571,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1582,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1593,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1603,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1613,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1624,59) Hint: Conversion between ordinals and pointers is not portable
D:\Temp\MPlayer.pas(1705,36) Hint: Converting the operands to "Int64" before doing the add could prevent overflow errors.
D:\Temp\MPlayer.pas(1705,36) Hint: Converting the operands to "Int64" before doing the multiply could prevent overflow errors.
D:\Temp\MPlayer.pas(1706,18) Hint: Converting the operands to "Int64" before doing the multiply could prevent overflow errors.
D:\Temp\MPlayer.pas(242,3) Hint: Local const "mci_Back" is not used
D:\Temp\MPlayer.pas(1762,3) Error: Can't open resource file: MPLAYER.res
D:\Temp\MPlayer.pas(1762,3) Fatal: There were 1 errors compiling module, stopping




Leledumbo

  • Hero Member
  • *****
  • Posts: 8273
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: convert Sebran delphi(4) code to lazarus
« Reply #57 on: February 13, 2009, 01:13:14 pm »
As the error says, is there any mplayer.res in the project dir (or somewhere where the compiler can find)?

Legolas

  • Full Member
  • ***
  • Posts: 117
    • http://itaprogaming.free.fr
Re: convert Sebran delphi(4) code to lazarus
« Reply #58 on: February 13, 2009, 01:48:19 pm »
Try to comment out {$R MPLAYER}

von_ks

  • Jr. Member
  • **
  • Posts: 57
Re: convert Sebran delphi(4) code to lazarus
« Reply #59 on: February 13, 2009, 01:53:54 pm »


I did not know that is also necessary.
If there is not a workaround so I should find it first.



 

TinyPortal © 2005-2018