Re: [Lazarus] Trunk Version: Error "lclclasses.pp(26, 10) Error: unit not found: Classes"

2015-11-10 Thread Jamal Gabra
Many thanks Mattias, that fixed it. Appreciate it.

Jamal

On Wed, Nov 11, 2015 at 3:16 AM, Mattias Gaertner  wrote:

> On Wed, 11 Nov 2015 02:39:35 +0300
> Jamal Gabra  wrote:
>
> > Hi,
> >
> > I used FPCup to get the latest trunk version FPC 3/Laz 1.5
> (native_trunk).
> > It compiles successfully and no issues when running existing projects,
> > however when trying to get the Auto-Complete list of any
> > Variable/Object/Component the error: "Unit Not Found: Classes" appears.
>
> Have you tried
> Tools / Rescan FPC source directory
> ?
>
> Mattias
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 23:37, Graeme Geldenhuys ha escrit:

On 2015-11-10 21:09, Luca Olivetti wrote:

But in the end I have to render it on the LCL canvas


Via a single BitBlt which should be more than fast enough for what you
described. Unless LCL is seriously broken.


I don't know if it's broken, but, AFAIK, there are two ways to animate 
something


1) with a timer (constrained by the windows resolution)
2) with a thread+synchronize (only the main thread can access the gui, 
and the constraint here is the rate the application loop calls 
CheckSynchronize)


But what really puzzles me is the different behavior between xp and 7 
(maybe it's aero, I could try disabling it). The fact that it's a font 
of size 100 with a bitmap below it doesn't help, but it should be possible.




But as the AggPas demos shows, text animation (more advanced that what
you described - movement of text on a constantly moving bezier curve) is
easy and possible with excellent results. So AggPas will not be the
bottleneck.



See above, the problem lies somewhere else, a simple TextRect is enough 
for what I'm doing. I just used BGRABitmaps to split the background 
image so only the part under the scrolling label has to be redrawn (I 
probably could have done the same with TLazIntfImage), but it didn't help.



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Trunk Version: Error "lclclasses.pp(26, 10) Error: unit not found: Classes"

2015-11-10 Thread Mattias Gaertner
On Wed, 11 Nov 2015 02:39:35 +0300
Jamal Gabra  wrote:

> Hi,
> 
> I used FPCup to get the latest trunk version FPC 3/Laz 1.5 (native_trunk).
> It compiles successfully and no issues when running existing projects,
> however when trying to get the Auto-Complete list of any
> Variable/Object/Component the error: "Unit Not Found: Classes" appears.

Have you tried
Tools / Rescan FPC source directory
?

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Trunk Version: Error "lclclasses.pp(26, 10) Error: unit not found: Classes"

2015-11-10 Thread Jamal Gabra
Hi,

I used FPCup to get the latest trunk version FPC 3/Laz 1.5 (native_trunk).
It compiles successfully and no issues when running existing projects,
however when trying to get the Auto-Complete list of any
Variable/Object/Component the error: "Unit Not Found: Classes" appears.

Even starting a new project and just by double clicking on the Main Form to
generate the OnCreate Event, does not go through and that error persists.

Is there anything to be done to fix that?

Am on Win 8, FPC3.1.1, Laz1.5 (not sure of the build version but I got it
on Nov-10).

Thank you,

Jamal
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Graeme Geldenhuys
On 2015-11-10 21:16, Luca Olivetti wrote:
> Here is the component I adapted from the forum posting.

I quickly created my own scrolling label test widget for fpGUI. Attached
is the unit. I set the scrolling step to 2 pixels and scrolling speed at
20 milliseconds. It uses a fpGUI Timer (no threads). I didn't even use
AggPas, just the standard Canvas.DrawText().

The result is a smooth horizontal scroll at a readable speed. CPU load
was a constant 0.5% which is considered pretty much idle. Moving the
mouse or the window makes no difference to the scrolling speed.

Feel free to port that to LCL and see how it fares.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
unit scrollinglabel;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, fpg_base, fpg_main, fpg_widget, fpg_label;

type
  TScrollingLabel = class(TfpgLabel)
  private
FScrolling: boolean;
FNeedsCalc: Boolean;
FTimer: TfpgTimer;
FOffset: integer;
FTextWidth: integer;
procedure SetScrolling(AValue: boolean);
procedure TimerFired(Sender: TObject);
  protected
procedure HandlePaint; override;
  public
constructor Create(AOwner: TComponent); override;
property Scrolling: boolean read FScrolling write SetScrolling;
  end;

implementation

{ TScrollingLabel }

procedure TScrollingLabel.TimerFired(Sender: TObject);
begin
  Inc(FOffset, 2);  // step
  Invalidate;
end;

procedure TScrollingLabel.SetScrolling(AValue: boolean);
begin
  if FScrolling = AValue then Exit;
  FScrolling := AValue;
  FTimer.Enabled := FScrolling;
end;

procedure TScrollingLabel.HandlePaint;
var
  lTxtFlags: TfpgTextFlags;
begin
  if FNeedsCalc then
  begin
FTextWidth := Font.TextWidth(Text);
FNeedsCalc := False;
  end;
  Canvas.Clear(clWindowBackground);
  Canvas.SetFont(Font);
  if Enabled then
Canvas.SetTextColor(FTextColor)
  else
Canvas.SetTextColor(clShadow1);

  lTxtFlags:= [];
  if not Enabled then
Include(lTxtFlags, txtDisabled);

  Include(lTxtFlags, txtLeft);
  Include(lTxtFlags, txtVCenter);

  FTextHeight := Canvas.DrawText(Width-FOffset, 0, Width, Height, FText, 
lTxtFlags);
  if FOffset > (Width + FTextWidth) then
FOffset := 0; // wrap the scrolling
end;

constructor TScrollingLabel.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FScrolling := False;
  FNeedsCalc := True;
  FOffset := 0;

  FTimer := TfpgTimer.Create(20); // scroll speed
  FTimer.OnTimer := @TimerFired;
end;

end.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Graeme Geldenhuys
On 2015-11-10 21:09, Luca Olivetti wrote:
> But in the end I have to render it on the LCL canvas 

Via a single BitBlt which should be more than fast enough for what you
described. Unless LCL is seriously broken.

But as the AggPas demos shows, text animation (more advanced that what
you described - movement of text on a constantly moving bezier curve) is
easy and possible with excellent results. So AggPas will not be the
bottleneck.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 17:48, Aradeonas ha escrit:

Probably you are somewhere wrong, provide your code so we can check.

Regards,
Ara




Here is the component I adapted from the forum posting. Originally it 
used a timer instead of a thread and I have to clean it up once I decide 
for one option or the other.
Tomorrow I'll see if I can create a simple application that reproduces 
the problem using it.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
unit scrollinglabel;

{$mode objfpc}{$H+}

interface

uses
  Classes, StdCtrls, ExtCtrls, Controls, LResources, sysutils;

type

  { TScrollingLabel }
  TScrollingLabel=class;

  { TScrollThread }

  TScrollThread=class(TThread)
private
  FOwner:TScrollingLabel;
  procedure SyncTimer;
   public
 constructor Create(AOwner:TScrollingLabel);
 procedure Execute;override;
  end;

  TScrollingLabel=class(TCustomLabel)
  private
FOffset: integer;
FScrollRefresh: integer;
FScrolling: boolean;
FStep: integer;
FTimer: TScrollThread;
FNeededWidth:integer;
procedure OnTimer(Sender: TObject);
procedure SetScrolling(AValue: boolean);
procedure SetScrollRefresh(aValue: integer);
procedure EnableTimer(enable:boolean);
  protected
procedure Paint; override;
procedure AdjustSize; override;
procedure DoMeasureTextPosition(var TextTop: integer; var TextLeft: integer);
  override;
  public
constructor Create(anOwner: TComponent);override;
destructor Destroy; override;
  published
property ScrollRate: integer read FScrollRefresh write SetScrollRefresh default 500;
property ScrollStep: integer read FStep write FStep default 1;
property Scrolling: boolean read FScrolling write SetScrolling default True;
property Align;
property Alignment;
property Anchors;
//property AutoSize;
property BidiMode;
property BorderSpacing;
property Caption;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FocusControl;
property Font;
property Layout;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowAccelChar;
property ShowHint;
property Transparent;
property Visible;
//property WordWrap;
property OnChangeBounds;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnResize;
property OnStartDrag;
//property OptimalFill;
  end;

procedure register;

implementation

uses Graphics;

procedure register;
begin
  RegisterComponents('Additional', [TScrollingLabel]);
end;

{ TScrollThread }

procedure TScrollThread.SyncTimer;
begin
  FOwner.OnTimer(nil);
end;

constructor TScrollThread.Create(AOwner: TScrollingLabel);
begin
  FOwner:=AOwner;
  inherited create(false);
end;

procedure TScrollThread.Execute;
begin
  while not terminated do
  begin
sleep(FOwner.FScrollRefresh);
Synchronize(@SyncTimer);
  end;
end;

procedure TScrollingLabel.OnTimer(Sender: TObject);
begin
  Dec(FOffset, FStep);
  if FOffset+FNeededwidth<0 then
FOffset:=-FStep;
  Invalidate;
end;

procedure TScrollingLabel.SetScrolling(AValue: boolean);
begin
  if FScrolling=AValue then Exit;
  FScrolling:=AValue;
  EnableTimer(FScrolling and (FNeededWidth>Width));
  if not FScrolling then
FOffset:=0;
  Invalidate;
end;

procedure TScrollingLabel.SetScrollRefresh(aValue: integer);
begin
  if FScrollRefresh=aValue then
Exit;
  FScrollRefresh:=aValue;
  //FTimer.Interval:=FScrollRefresh;
  Invalidate;
end;

procedure TScrollingLabel.EnableTimer(enable: boolean);
begin
  if enable then
  begin
if FTimer=Nil then
  FTimer:=TScrollThread.Create(self)
  end else
  begin
if FTimer<>Nil then
  FreeAndNil(FTimer);
  end;

end;

procedure TScrollingLabel.Paint;
var
  txtStyle : TTextStyle;
  R : TRect;
  TextLeft, TextTop: integer;
  LabelText: string;
  OldFontColor: TColor;
  scroll: Boolean;
begin
  R := Rect(0,0,Width,Height);
  with Canvas do
  begin
Brush.Color := Self.Color;
if (Color<>clNone) and not Transparent then
begin
  Brush.Style:=bsSolid;
  FillRect(R);
end;
Brush.Style:=bsClear;
Font := Self.Font;
FillChar(txtStyle,SizeOf(txtStyle),0);
scroll:=FScrolling and (FNeededWidth>Self.Width);
with txtStyle do
begin
  if scroll then
Alignment:=BidiFlipAlignment(taLeftJustify, UseRightToLeftAlignment)
  else
Alignment := BidiFlipAlignment(Self.Alignment, UseRightToLeftAlignment);
  Layout := Se

Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Aradeonas
If you have a design and could share it,send it to me maybe I can make
an example.

Regards,
Ara


-- 
http://www.fastmail.com - Access all of your messages and folders
  wherever you are


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 18:47, Graeme Geldenhuys ha escrit:

On 2015-11-10 16:43, Luca Olivetti wrote:

Impressive, but I looked at the source and it uses its own kind of
application.


Don't let the demos confuse you. The demos were implemented to be
cross-platform in their own way, with its own widgets used by the demos.
The idea comes from the original C++ AGG framework, and only meant for
the demos.

You can use the AggPas API directly (most powerful) in Lazarus or fpGUI
or Console applications. There is also a TAgg2D Canvas class which gives
you a more Delphi-like Canvas API - a much smoother/easier introduction
to AggPas. The TAgg2D canvas is available for LCL and fpGUI.


But in the end I have to render it on the LCL canvas (a simple 
TextRect), and I cannot do it faster than the LCL allows me. If I use a 
timer[**] I'm constrained by the timer resolution (around 15ms in 
windows with a minimum value of 10ms), if I use a thread+synchronize I'm 
constrained by how often the application loop calls CheckSynchronize 
(aside: if I move the mouse over the label, it goes faster, probably 
because the application is managing more windows messages and calls 
CheckSynchronize more often).
I also tried without Synchronize, but that's a no-no (apparently works 
until you hit a timing issue and the application crashes or gets stuck).



[*] there are also multimedia timers, but I don't know if/how I can use 
them, and they are windows specific anyway.



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Anthony Walter
I am actually working on a new project which will be used to create a
beautiful text animations. I'm not sure when I'll have anything previewable
done, but the basic idea is you layout curves with spline nodes, put text
on the curve, set timeline values for text offset in x and y along the
curve, set timeline values for curve node changes, and press render to
create an mp4 of the animated text suitable for video title sequences.
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Graeme Geldenhuys
On 2015-11-10 16:48, Aradeonas wrote:
> Probably you are somewhere wrong,

+1


Regards,
  - Graeme -


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Graeme Geldenhuys
On 2015-11-10 16:43, Luca Olivetti wrote:
> Impressive, but I looked at the source and it uses its own kind of 
> application.

Don't let the demos confuse you. The demos were implemented to be
cross-platform in their own way, with its own widgets used by the demos.
The idea comes from the original C++ AGG framework, and only meant for
the demos.

You can use the AggPas API directly (most powerful) in Lazarus or fpGUI
or Console applications. There is also a TAgg2D Canvas class which gives
you a more Delphi-like Canvas API - a much smoother/easier introduction
to AggPas. The TAgg2D canvas is available for LCL and fpGUI.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Aradeonas
Probably you are somewhere wrong, provide your code so we can check.

Regards,
Ara


-- 
http://www.fastmail.com - Same, same, but different...


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 16:55, Graeme Geldenhuys ha escrit:

On 2015-11-10 12:28, Luca Olivetti wrote:

I guess codebot needs a newer fpc, it doesn't compile with 2.6.4.


You can also take a look at AggPas, which can easily accomplish what you
ask for - with out 0-1% CPU load (tested previously on my system).
Lazarus includes a copy of AggPas as standard.

Here are some examples to show you smoothness - and even warped text on
a bezier curve.

   http://crossgl.com/aggpas/aggpas-demo.htm

Take a look at the Trans_curve1.exe and Trans_curev2.exe example
executables (if you have Windows).


Impressive, but I looked at the source and it uses its own kind of 
application.
Anyway, I don't think that cpu is the limiting factor, the application 
loop is.
Let me explain: I modified the application so that, instead of a big 
background bitmap that needs to be redrawn every time the text moves, I 
have two, the big one and a smaller one just where the scrolling label 
is (I used BGRABitmap to split the previous one in two).


I then used a thread with a simple loop


  while not terminated do
  begin
sleep(FOwner.FScrollRefresh);
Synchronize(@SyncTimer);
  end;


where synctimer just updates the offset and invalidates the label so 
that it redraws itself.


On a virtualized windows xp I can use FScrollRefresh of 1 and it scrolls 
very fast and the application is responsive.
On a real hardware windows 7 (in theory much more powerful) or a 
virtualized one, not only the refresh cycle is much longer (I suppose 
the limiting factor is the rate of the CheckSynchronize calls from the 
main thread), but it cannot cope with the other messages (i.e., I update 
a clock with a timer, but it doesn't update, it doesn't react once I 
clicked on the button to confirm exit, etc.).
Before I thought it was cpu bound (since it had to repaint the whole 
screen), but now that it only repaints 10% it works exactly the same.
The strange thing is, it seems to work fine (albeit not at the rate it 
works under xp) if I start it as wsNormal (the application should be 
wsFullScreen and BorderStyle bsNone).



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Debian Packager released

2015-11-10 Thread JuuS


On 11/10/2015 05:32 AM, Anthony Walter wrote:
> A new version is available with a much better dependency resolver. 

Beautiful, works great, VMs/machines, 32/64, qt/gtk2. Now, on to
codebot  Thanks for your work.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Graeme Geldenhuys
On 2015-11-10 12:28, Luca Olivetti wrote:
> I guess codebot needs a newer fpc, it doesn't compile with 2.6.4.

You can also take a look at AggPas, which can easily accomplish what you
ask for - with out 0-1% CPU load (tested previously on my system).
Lazarus includes a copy of AggPas as standard.

Here are some examples to show you smoothness - and even warped text on
a bezier curve.

  http://crossgl.com/aggpas/aggpas-demo.htm

Take a look at the Trans_curve1.exe and Trans_curev2.exe example
executables (if you have Windows).

AggPas as been tested on Linux, Windows, FreeBSD and OS/2. And on 32-bit
and 64-bit where OSes support that.

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Event created by program logic rather than user

2015-11-10 Thread Lukasz Sokol
On 10/11/15 12:23, Michael Schnell wrote:
> On 11/10/2015 01:14 PM, Engelbert Buxbaum wrote:
>> 
>> as far as I can see the only advantage of running the math-routine
>> in a thread would be that the program could be terminated at any
>> time, rather than only in the main loop.
> If a long winding calculation runs in a Thread, the complete main
> thread (including the GUI) is not blocked and the program can do any
> other stuff (e.g. as a reaction on  TTimer events, and also as a
> reaction on Events this or any other  thread fires via
> TThread.Queue).
> 
I'd just add, but,

> Moreover on a multi-CPU system (which is standard nowadays), multiple
> threads can do long winding calculations at the same time and finish
> by far faster than a single threaded program.
> 

 - this, only if the calculation itself is possible to be multithreaded
(e.g. formula possible to calculate in chunks/portions/arbitrary bounds etc). 

> 
>> 
>> Even if one did it like that, the original problem remains: who is
>> the sender in the FormPaint call?
> As any GUI stuff is only allowed in the main thread it can only be
> the Main thread (if this is what you are asking)
> 
> -Michael
> 

el es


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Sven Barth
Am 10.11.2015 14:37 schrieb "Sven Barth" :
>
> Am 10.11.2015 12:27 schrieb "Jürgen Hestermann" :
> >
> > Am 2015-11-10 um 11:32 schrieb Sven Barth:
> >>
> >> The user doesn't need to know the detail that the value is kept in a
temporary register, because that statement by itself is utterly useless for
the user, as on load/store architectures like ARM you /always/ have values
in registers if they are worked with and the compiler will happily spill
around the contents if necessary.
> >
> >
> > Does that mean, that local variables and with statements are treated
completely identically?
> > Are both held in registers with the same mechanism and will there never
be an (speed) adavantage of one of them?
> > If there is only the chance that it may speed up the code (even when
only on certain platforms) then I would like to know it.
>
> It always depends on the specific code (its complexity) and the specific
compiler settings (optimizations) and maybe also the target architecture
(because of register pressure and such). There is nothing general I can say
/except/ that the with expression will be evaluated only once. Thus
depending on the circumstances a local variable and the usage of with might
behave the same. In simple cases the with /might/ be faster because it
won't result in the expression result being stored on the stack, but that's
by no means a given.

So... I quickly rechecked the code and can now make a more fundated
statement. In case of a more complex expression (e.g. not a field that's a
class or something like that) the expression will be stored in a temporary
/variable/ not a register. Thus the generated code should be the same as
for a local variable. For non complex expressions the value is used
directly (e.g. as if the with didn't happen), though further optimizations
(e.g. the regvars optimization) might improve that.

Regards,
Sven
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Sven Barth
Am 10.11.2015 12:27 schrieb "Jürgen Hestermann" :
>
> Am 2015-11-10 um 11:32 schrieb Sven Barth:
>>
>> The user doesn't need to know the detail that the value is kept in a
temporary register, because that statement by itself is utterly useless for
the user, as on load/store architectures like ARM you /always/ have values
in registers if they are worked with and the compiler will happily spill
around the contents if necessary.
>
>
> Does that mean, that local variables and with statements are treated
completely identically?
> Are both held in registers with the same mechanism and will there never
be an (speed) adavantage of one of them?
> If there is only the chance that it may speed up the code (even when only
on certain platforms) then I would like to know it.

It always depends on the specific code (its complexity) and the specific
compiler settings (optimizations) and maybe also the target architecture
(because of register pressure and such). There is nothing general I can say
/except/ that the with expression will be evaluated only once. Thus
depending on the circumstances a local variable and the usage of with might
behave the same. In simple cases the with /might/ be faster because it
won't result in the expression result being stored on the stack, but that's
by no means a given.

Regards,
Sven
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Aradeonas
Yes for codebot you can use Trunk version or easily get nigh version
from GetLazarus website.

Regards,
Ara


-- 
http://www.fastmail.com - Email service worth paying for. Try it for free


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

El 10/11/15 a les 12:36, Aradeonas ha escrit:

If I were you I used BGRABitmap or Codebot,they have good text option
and you can made a simple one easily,it will be fast,light and
beautiful.


I guess codebot needs a newer fpc, it doesn't compile with 2.6.4.
I'm following the tutorials for BGRABitmap to see if it's easy enough to 
add it to my project.


Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Event created by program logic rather than user

2015-11-10 Thread Michael Schnell

On 11/10/2015 01:14 PM, Engelbert Buxbaum wrote:


as far as I can see the only advantage of running the math-routine in 
a thread
would be that the program could be terminated at any time, rather than 
only

in the main loop.
If a long winding calculation runs in a Thread, the complete main thread 
(including the GUI) is not blocked and the program can do any other 
stuff (e.g. as a reaction on  TTimer events, and also as a reaction on 
Events this or any other  thread fires via TThread.Queue).


Moreover on a multi-CPU system (which is standard nowadays), multiple 
threads can do long winding calculations at the same time and finish by 
far faster than a single threaded program.



Even if one did it like that, the original problem remains: who is the 
sender

in the FormPaint call?
As any GUI stuff is only allowed in the main thread it can only be the 
Main thread (if this is what you are asking)


-Michael
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Event created by program logic rather than user

2015-11-10 Thread Engelbert Buxbaum
 
 
Message: 4
Date: Sun, 8 Nov 2015 12:33:42 -0500
From: Anthony Walter 
Subject: Re: [Lazarus] Event created by program logic rather than user
action
To: Lazarus mailing list 
Message-ID:

Content-Type: text/plain; charset="utf-8"

Here's an example which calculates Pi forever in a thread. It's important
to note a few things:

1. Periodically check if the thread should stop by checking the Terminated
property inside Execute
2. If you want to communicate with the user interface, such as refreshing
the screen based on some calculations, use the Synchronize method to do so
3. Do not share data the thread is using in calculations with anything. If
you need access to the data in somewhere else, use Synchronize and make a
copy there.

 

Hi,

 

as far as I can see the only advantage of running the math-routine in a thread

would be that the program could be terminated at any time, rather than only

in the main loop.

 

Even if one did it like that, the original problem remains: who is the sender

in the FormPaint call?

 

Sincerely

 

Engelbert




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Mattias Gaertner
On Tue, 10 Nov 2015 12:26:56 +0100
Jürgen Hestermann  wrote:

>[...]
> Does that mean, that local variables and with statements are treated 
> completely identically?

A local var can be changed. Without optimization the compiler puts the
local var on the stack. With optimization enabled the compiler can
find out that the local var is only read, which is also true for a 
with-expression and applies the same optimizations.

Optimizing read only variables is basic code optimization.

> Are both held in registers with the same mechanism and will there never be an 
> (speed) adavantage of one of them?
> If there is only the chance that it may speed up the code (even when only on 
> certain platforms) then I would like to know it.

If speed matters you should enable optimization. When optimization is
enabled there is no difference.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Michael Schnell

On 11/10/2015 12:30 PM, Luca Olivetti wrote:
- it is very cpu intensive (I have to put it over a picture, so the 
invalidate will also force the repainting of the bitmap I guess)
The only cure for this is using the graphic processor: only once create 
a wide pixel array from the text and then use Direct X (Open GL or 
similar API) to display part of the text "behind" in a rectangle.






- the minimum timer interval is 10ms, and even that it's not 
guaranteed (the resolution on windows is around 15ms and I got a very 
different speed of the label using 10ms under virtualized windows xp 
and a real windows 7 machine)


- with such a low value (10ms) sometimes the application gets bogged 
down, specifically it cannot process the modal dialog I use to shut 
down the application.
What you are trying to do is a multimedia application and hence "soft 
realtime". This can't decently be done with "normal" desktop-Type 
paradigms.





- I solved the flickering by setting DoubleBuffered to the containing 
widget (a TPageControl), but, again, I think that takes its toll on 
cpu usage.

see above.

I tried to use a thread (with synchronize) instead of a ttimer to 
obtain a lower interval, but that only compounds the problems.

 Obviously



Any suggestion


A thing that we (company) do for a similar application (moving text 
"behind" a rectangle) is programming the "movie" in Adobe Flash and have 
the flash player show it on the screen (multiple instances). Works great !


A new development supposedly should avoid Flash (as support for same is 
dying out) and use HTML4 instead.



-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Aradeonas
If I were you I used BGRABitmap or Codebot,they have good text option
and you can made a simple one easily,it will be fast,light and
beautiful.

Regards,
Ara


-- 
http://www.fastmail.com - Accessible with your email software
  or over the web


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Smooth scrolling label (marquee)

2015-11-10 Thread Luca Olivetti

Hello,

in my current project, I need a marquee.
I adapted the component from here:

http://forum.lazarus.freepascal.org/index.php?topic=24646.0

which is a descendant of a TCustomLabel using a timer to move the text 
position.

I have several problems with it:

- it is very cpu intensive (I have to put it over a picture, so the 
invalidate will also force the repainting of the bitmap I guess)


- the minimum timer interval is 10ms, and even that it's not guaranteed 
(the resolution on windows is around 15ms and I got a very different 
speed of the label using 10ms under virtualized windows xp and a real 
windows 7 machine)


- with such a low value (10ms) sometimes the application gets bogged 
down, specifically it cannot process the modal dialog I use to shut down 
the application.


- I solved the flickering by setting DoubleBuffered to the containing 
widget (a TPageControl), but, again, I think that takes its toll on cpu 
usage.



I tried to use a thread (with synchronize) instead of a ttimer to obtain 
a lower interval, but that only compounds the problems.


For the time being, I'm using 50ms and change the number of pixels to 
change the speed, however if I scroll more than 2 pixels every 50ms the 
scrolling isn't smooth enough, but the required speed should be 6 or 7 
pixels, and that's very unpleasant to the eye.


Any suggestion?


--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Jürgen Hestermann

Am 2015-11-10 um 11:32 schrieb Sven Barth:

The user doesn't need to know the detail that the value is kept in a temporary 
register, because that statement by itself is utterly useless for the user, as 
on load/store architectures like ARM you /always/ have values in registers if 
they are worked with and the compiler will happily spill around the contents if 
necessary.


Does that mean, that local variables and with statements are treated completely 
identically?
Are both held in registers with the same mechanism and will there never be an 
(speed) adavantage of one of them?
If there is only the chance that it may speed up the code (even when only on 
certain platforms) then I would like to know it.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Sven Barth
Am 10.11.2015 09:40 schrieb "Jürgen Hestermann" :
>
> Am 2015-11-09 um 14:26 schrieb Sven Barth:
>>
>>
>> > The docs already note that the compiler uses a temporary register
>> > for 'With'.
>> > http://www.freepascal.org/docs-html/ref/refsu58.html#x155-16500013.2.8
>> > Of course if there is no register left the compiler uses the stack.
>>
>> Please note that this is an implementation detail. The point a user
should care about is that the expression of the with is evaluated only once
(before the block of the with is entered). Everything else is up to the
compiler.
>> (I would prefer if it wouldn't be mentioned as is in the documentation)
>>
>>
> This information is very important IMO.
> The programmer should know which coding has which performance.

Which is solved by saying that the expression is only evaluated once. The
user doesn't need to know the detail that the value is kept in a temporary
register, because that statement by itself is utterly useless for the user,
as on load/store architectures like ARM you /always/ have values in
registers if they are worked with and the compiler will happily spill
around the contents if necessary.

Regards,
Sven
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] More testing please

2015-11-10 Thread Aradeonas
OK thanks, let me know if I could help.

Regards, Ara


-- 
http://www.fastmail.com - Does exactly what it says on the tin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Extending TRect breaks Lazarus

2015-11-10 Thread Jürgen Hestermann

Am 2015-11-09 um 14:26 schrieb Sven Barth:


> The docs already note that the compiler uses a temporary register
> for 'With'.
> http://www.freepascal.org/docs-html/ref/refsu58.html#x155-16500013.2.8
> Of course if there is no register left the compiler uses the stack.

Please note that this is an implementation detail. The point a user should care 
about is that the expression of the with is evaluated only once (before the 
block of the with is entered). Everything else is up to the compiler.
(I would prefer if it wouldn't be mentioned as is in the documentation)



This information is very important IMO.
The programmer should know which coding has which performance.

The reason for many slow programs is that
the programmer(s) do not know about such details.
If i.e. a loop over a huge array can be speeded up with
a slight coding change  it should be done.
The attitude: "don't worry about the details" is wrong IMO.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Tdbf

2015-11-10 Thread LacaK

As far as I remember only MDX and IDX are supported.
(IMO you can use simple index file (not compound))
L.

Can Tdbf use and maintain Foxpro indexes (*.cdx) yet?  If not, can you 
still index a Foxpro file somehow?


Thanks.

Bob B.



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus