Re: [lazarus] Behavior of ClientToScreen in scrolling windows across different widget sets

2008-02-07 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:

Luiz Americo Pereira Camara wrote:
While debugging scrolling bugs in LCL i found that ClientToScreen 
acts differently according to the widget set.


These are the behaviors:

1) The returned value is related to the actual position, i.e., it 
does not consider the scroll offset. If you pass Point(0,0) the value 
will be the same regardless of the scroll position. (Gtk1)


2) The returned value is related to the virtual position, i.e, it 
takes into account the scroll offset. If you pass Point(0, 0) the 
value changes inversely to scrollbar position. (Gtk2)  3)  The 
returned value is related to the virtual position, i.e, it takes into 
account the scroll offset. If you pass Point(0, 0) the value changes 
the same amount of scrollbar position. (Win32)


4) Nothing. Qt has no visible scrollbars so...

Notes:

Delphi does the same as (1)/Gtk1


Not really, internally Delphi does it like 2. All controls are moved.


I'm not referring to position of controls after scrolling. I'm referring 
to ClientToScreen return results. Say you query the ClientToScreen with 
0,0 will return value x, y. Now scroll vertically amount n. Under Delphi 
the returned value will still be x, y and not x, y-n that is the virtual 
position. The example shows this clearly. Move the window to position 
0,0. Get the ClientToScreen result of 0,0 = 0,0. Now scroll vertically 
10 (Notice that part of the client area is offscreen). Get again the 
value of 0,0. You will get


Win32: 0,10
Gtk1: 0,0
Gtk2: 0, -10
Delphi: 0,0
The patch makes win32 behaves like Gtk2 each makes more sense.




(3) is clearly buggy.

Between (1) and (2) is a design decision.


We started like delphi, move controls and report corrected values when 
asked. However this aproach is very inefficient on all widgetsets 
except win32. So the new approach is that controls stay at their 
position and only the "virtual parent" gets an offset.
This means that the top/left of a control on a say scrollbox are 
allways the same, an offset to the "virtual parent" top/left.

See above.


So now ClientToScreen.
The top/left of a scrolled control needs to get a scrolled offset, so 
that is reflects the "real" position relative to the "real" parent of 
the control.


The behavior described here is generic to any point, not control 
position related.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Behavior of ClientToScreen in scrolling windows across different widget sets

2008-02-06 Thread Luiz Americo Pereira Camara
While debugging scrolling bugs in LCL i found that ClientToScreen acts 
differently according to the widget set.


These are the behaviors:

1) The returned value is related to the actual position, i.e., it does 
not consider the scroll offset. If you pass Point(0,0) the value will be 
the same regardless of the scroll position. (Gtk1)


2) The returned value is related to the virtual position, i.e, it takes 
into account the scroll offset. If you pass Point(0, 0) the value 
changes inversely to scrollbar position. (Gtk2)   

3)  The returned value is related to the virtual position, i.e, it takes 
into account the scroll offset. If you pass Point(0, 0) the value 
changes the same amount of scrollbar position. (Win32)


4) Nothing. Qt has no visible scrollbars so...

Notes:

Delphi does the same as (1)/Gtk1

(3) is clearly buggy.

Between (1) and (2) is a design decision.


Attached is a patch that makes win32 acts like (2)/gtk2. It changes the 
offset signal when calculating the LCL bounds. With the change it 
becomes consistent with the TCustomGroupBox signal convention (LCL 
bounds at Right/Down  of win32 +, at Left/Up -).

It also fixes the scrolling paint and setcursor of non TWincontrol.

Luiz



Index: lcl/interfaces/win32/win32callback.inc
===
--- lcl/interfaces/win32/win32callback.inc  (revision 14008)
+++ lcl/interfaces/win32/win32callback.inc  (working copy)
@@ -471,12 +471,10 @@
   end;
   if ParentPaintWindow <> 0 then
 GetWin32ControlPos(Window, ParentPaintWindow, parLeft, parTop);
-  if not GetLCLClientBoundsOffset(lWinControl, ORect) then
-  begin
-ORect.Left := 0;
-ORect.Top := 0;
-{ we don't use ORect.Right and ORect.Bottom, initialize here if needed 
}
-  end;
+  //Is not necessary to check the result of GetLCLClientBoundsOffset since
+  //the false condition (lWincontrol = nil or lWincontrol <> TWinControl) 
is never met
+  //The rect is always initialized with 0
+  GetLCLClientBoundsOffset(lWinControl, ORect);
   PaintMsg.Msg := LM_PAINT;
   PaintMsg.PaintStruct := @PS;
   if not useDoubleBuffer then
Index: lcl/interfaces/win32/win32proc.pp
===
--- lcl/interfaces/win32/win32proc.pp   (revision 14008)
+++ lcl/interfaces/win32/win32proc.pp   (working copy)
@@ -852,8 +852,8 @@
   if HorzScrollBar <> nil then
   begin
 // left and right bounds are shifted by scroll position
-ORect.Left := HorzScrollBar.Position;
-ORect.Right := HorzScrollBar.Position;
+ORect.Left := -HorzScrollBar.Position;
+ORect.Right := -HorzScrollBar.Position;
   end;
   if VertScrollBar <> nil then
   begin
@@ -858,8 +858,8 @@
   if VertScrollBar <> nil then
   begin
 // top and bottom bounds are shifted by scroll position
-ORect.Top := VertScrollBar.Position;
-ORect.Bottom := VertScrollBar.Position;
+ORect.Top := -VertScrollBar.Position;
+ORect.Bottom := -VertScrollBar.Position;
   end;
 end;
   If (TheWinControl is TCustomGroupBox) Then


Re: [lazarus] Found serious bug in win32 interface #2

2008-01-31 Thread Luiz Americo Pereira Camara

Andrey Gusev wrote:
* Luiz Americo Pereira Camara <[EMAIL PROTECTED]> [Thu, 31 Jan 2008 
01:16:58 -0300]:

Andrey Gusev wrote:
> * Mattias Gärtner <[EMAIL PROTECTED]> [Wed, 30 Jan 2008
> 18:45:57 +0100]:
>> Zitat von Andrey Gusev <[EMAIL PROTECTED]>:
>>
>> > --- interfaces/win32/win32callback.inc (revision 13905)
>> > +++ interfaces/win32/win32callback.inc (working copy)
>> >  @@ -504,7 +504,7 @@
>> > if (ControlDC = 0) or not needParentPaint then
>> >  begin
>> >  DCIndex := Windows.SaveDC(PaintMsg.DC);
>> >  - MoveWindowOrgEx(PaintMsg.DC, ORect.Left, ORect.Top);
>> > + MoveWindowOrgEx(PaintMsg.DC, -ORect.Left, -ORect.Top);
>> >  {$ifdef DEBUG_DOUBLEBUFFER}
>> >  Windows.GetClipBox(PaintMsg.DC, ClipBox);
>> > DebugLn('LCL Drawing in DC ', IntToHex(PaintMsg.DC, 8), '
>> > with
>> > clipping rect (',
>> >
>> > I can provide application that's confirm my rightfulness.
>> > But i don't wish to do it, until all child-control negative 

effects

>> will
>> > debugged (by me), it need to LazReport designer functionality.
>> > If wished, try to place oversized TPaintBox on TScrollBox and try
it
>> to
>> > scroll (with above patch applied).
>>
>> It might improve the situation, but I guess it will not fix the 

whole

>> problem.
>> See here:
>> http://wiki.lazarus.freepascal.org/Win32/64_Interface
>
> It was said, about intermeditate layer, earlier (by You).
> Also, it implementation started in win32wsfrorms, rudimentary state.
> But observed, with above correction, child controls scrolls 

correctly,

> except
> page and line messages processing, which brings some negative shift,
> for childs.
> Undoubtedly, we can force to work existing variant, a few various
> methods can be invented
> (twice MoveWindowOrg for example).
> But pointed bug is nice explaination (and chance to eliminate) the
> strange opposite scrolling behaviour.
> see http://bugs.freepascal.org/view.php?id=10400,
> also observation, described in my #16900 reply,
> http://bugs.freepascal.org/view.php?id=10471,
> correspond to pointed bug presence.

Hi, do you have one or two small proof of concept LCL application that
shows the problem? (works in gtk fails in win32).
If you have please send me or post in the bugtracker/here.
I will take a look.


See attachement.
Form2 & Form3 demonstrates problems with tabbed controls, that brings 
by above patch,

it implementations must be corrected, as i mean.



Thanks.

Today and tomorrow i'm busy. I'll look at Saturday

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Found serious bug in win32 interface #2

2008-01-30 Thread Luiz Americo Pereira Camara

Andrey Gusev wrote:
* Mattias Gärtner <[EMAIL PROTECTED]> [Wed, 30 Jan 2008 
18:45:57 +0100]:

Zitat von Andrey Gusev <[EMAIL PROTECTED]>:

> --- interfaces/win32/win32callback.inc (revision 13905)
> +++ interfaces/win32/win32callback.inc (working copy)
>  @@ -504,7 +504,7 @@
> if (ControlDC = 0) or not needParentPaint then
>  begin
>  DCIndex := Windows.SaveDC(PaintMsg.DC);
>  - MoveWindowOrgEx(PaintMsg.DC, ORect.Left, ORect.Top);
> + MoveWindowOrgEx(PaintMsg.DC, -ORect.Left, -ORect.Top);
>  {$ifdef DEBUG_DOUBLEBUFFER}
>  Windows.GetClipBox(PaintMsg.DC, ClipBox);
> DebugLn('LCL Drawing in DC ', IntToHex(PaintMsg.DC, 8), '
> with
> clipping rect (',
>
> I can provide application that's confirm my rightfulness.
> But i don't wish to do it, until all child-control negative effects
will
> debugged (by me), it need to LazReport designer functionality.
> If wished, try to place oversized TPaintBox on TScrollBox and try it
to
> scroll (with above patch applied).

It might improve the situation, but I guess it will not fix the whole
problem.
See here:
http://wiki.lazarus.freepascal.org/Win32/64_Interface


It was said, about intermeditate layer, earlier (by You).
Also, it implementation started in win32wsfrorms, rudimentary state.
But observed, with above correction, child controls scrolls correctly, 
except
page and line messages processing, which brings some negative shift, 
for childs.
Undoubtedly, we can force to work existing variant, a few various 
methods can be invented

(twice MoveWindowOrg for example).
But pointed bug is nice explaination (and chance to eliminate) the 
strange opposite scrolling behaviour.

see http://bugs.freepascal.org/view.php?id=10400,
also observation, described in my #16900 reply, 
http://bugs.freepascal.org/view.php?id=10471,

correspond to pointed bug presence.


Hi, do you have one or two small proof of concept LCL application that 
shows the problem? (works in gtk fails in win32).

If you have please send me or post in the bugtracker/here.
I will take a look.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] How to load aRGBA data from a bitmap file using TLazIntfImage

2008-01-24 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

Should i pass the width, height when init datadescription?


This does not help. I hardcoded width and height to 2 and got the same 
result.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] How to load aRGBA data from a bitmap file using TLazIntfImage

2008-01-24 Thread Luiz Americo Pereira Camara

wile64 wrote:

Your image is in 24 bits, test load and then changing it to 32 bits

It seems the best description for what i want is 
Init_BPP32_B8G8R8_BIO_TTB that gives me a 24bit depth with a 32bits per 
pixel, but still getting random values.


Also tested Init_BPP24_B8G8R8_BIO_TTB.

No luck.

Thanks anyway.

Luiz


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] How to load aRGBA data from a bitmap file using TLazIntfImage

2008-01-24 Thread Luiz Americo Pereira Camara

Marco Alvarado wrote:

You could try using TLazIntfImage.GetDataLineStart() instead.

I think you can modify your code this way:

...
for y := 0 to IntfImg.DataDescription.Height-1 do
DumpMem(PCardinal(IntfImg.GetDataLineStart(y)), IntfImg.DataDescription.Width);
...
  


Thanks, but i still get random values. I would expect at least the same 
values for each pixel.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] How to load aRGBA data from a bitmap file using TLazIntfImage

2008-01-24 Thread Luiz Americo Pereira Camara
I need to load the data of bitmap files into a buffer in the RGBA 
format, but i'm somewhat lost.


Reading the wiki and the source i got to the following code:

procedure DumpMem(Data: PCardinal; Size: Integer);
var
 i: Integer;
 Color: TRGBA;
begin
 for i := 0 to Size - 1 do
 begin
   Color := TRGBA(Data[i]);
   WriteLn('Red: ', Color.R, ' Green: ', Color.G,
 ' Blue: ',Color.B, ' Alpha: ', Color.A);
 end;
end;

var
 ImgReader: TLazReaderBMP;
 IntfImg: TLazIntfImage;
begin
 ImgReader := TLazReaderBMP.Create;
 IntfImg := TLazIntfImage.Create(0,0);
 IntfImg.DataDescription.Init_BPP32_B8G8R8A8_M1_BIO_TTB(0, 0);
 IntfImg.LoadFromFile('red.bmp', ImgReader);

 DumpMem(PCardinal(IntfImg.PixelData), IntfImg.DataDescription.Height * 
IntfImg.DataDescription.Width);


 ImgReader.Destroy;
 IntfImg.Destroy;
end;

red.bmp is a 2x2 bmp file filled with red. (attached)

the DumpMem leads to different results if the program is run in IDE or 
outside it (Probably PixelData is not pointing to the data).


What's wrong with this code? Should i pass the width, height when init 
datadescription?


Luiz




<>

Re: [lazarus] Lazarus compiled with GTK2 [part 1 of 2]

2008-01-23 Thread Luiz Americo Pereira Camara

Damien Gerard wrote:


On Jan 22, 2008, at 10:20 PM, Marc Weustink wrote:


Luiz Americo Pereira Camara wrote:

Marc Weustink wrote:

Graeme Geldenhuys wrote:

On 22/01/2008, Giuliano Colla <[EMAIL PROTECTED]> wrote:
I gather that someone is already using GTK2, but I believe that 
he's not
much demanding in terms of graphic appearance. My customers would 
run
after me with a hammer if I'd dare to show them the current state 
of the

art. :-)


I've tried to use Lazarus/GTK2 for half a day now.  It's horribly 
slow

as well, compared to GTK1.  For now I switched back to GTK1 and will
try GTK2 in a few months again.


I fear that won't change much, gtk2 itself is slower than gtk1 due 
to all clientside graphic stuff
Gtk2 is in fact slower than Gtk1, every one agree, but LCL/Gtk2 
application are much slower than other Gtk2 applications


Compared to what apps ?




Personaly, I don't think the difference is so much. It is not like 
using a 3D engine to make transparent windows.

There is without a doubt.
We were speaking a few days ago the count of layers. As fpGUI, LCL is 
a layer as well, with its own overhead.
Additionally with Lazarus, we often naturally create more widgets than 
needed (enjoy nested panels) plus some arrangements which may not be 
lead to the best performance, done by the widgetset and all its 
policies to ensure its good work.




Other possible reasons for slowness:

- Some code is shared between gtk1 and gtk2. This leads to use of 
deprecated functions although this has improved a lot in the last times 
like using the new g_signal functions, use of pango instead of gdk 
functions.

- Double buffering is disabled by default

For sure, some of us are tired to read this ml and to see "GTK2 is 
slower" "GTK2/LCL is slower" with infinite threads.


It is a fact and we have to accept that. We have to choose for 
balance, according to our needs and philosophy.
Some of us think this is too slow for them ? They can use their own 
way if they want to and that's good. The future will tell if they were 
right. May day some day the different ways will lead to the same point.
I think others would like to focus on what really matters: To improve 
the great work done for Lazarus.


I'm fine to say that because this is what i do, i provide patches (when 
is in my knowledge/interest scope), make bug reports with full examples, 
and create third party controls.


And while all this threading is gone i already implemented two full 
working LCL controls, improved cairo binding, created a OOP wrapper for 
cairo integrating with LCL (gtk1, gtk2, win32), support for svg files. 
To be released soon.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus compiled with GTK2 [part 1 of 2]

2008-01-23 Thread Luiz Americo Pereira Camara

Paul Ishenin wrote:

Luiz Americo Pereira Camara wrote:


Gtk2 is in fact slower than Gtk1, every one agree, but LCL/Gtk2 
application are much slower than other Gtk2 applications


Is it possible to profile gtk2 lcl application and find what cause 
this slowleness? Who can do?


I'll take a look.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus compiled with GTK2 [part 1 of 2]

2008-01-22 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:

Graeme Geldenhuys wrote:

On 22/01/2008, Giuliano Colla <[EMAIL PROTECTED]> wrote:
I gather that someone is already using GTK2, but I believe that he's 
not

much demanding in terms of graphic appearance. My customers would run
after me with a hammer if I'd dare to show them the current state of 
the

art. :-)


I've tried to use Lazarus/GTK2 for half a day now.  It's horribly slow
as well, compared to GTK1.  For now I switched back to GTK1 and will
try GTK2 in a few months again.


I fear that won't change much, gtk2 itself is slower than gtk1 due to 
all clientside graphic stuff


Gtk2 is in fact slower than Gtk1, every one agree, but LCL/Gtk2 
application are much slower than other Gtk2 applications


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Introduction

2008-01-20 Thread Luiz Americo Pereira Camara

Lord Satan wrote:

On Sun, 20 Jan 2008 22:33:53 +0200
"Graeme Geldenhuys" <[EMAIL PROTECTED]> wrote:

  

I still think having a
custom Object Pascal written toolkit for Lazarus is the way to go. The
LCL would have progressed and stabilized much faster if the Lazarus
developers did that from the start.



That's correct. And if they had used OpenGL for it, it would be hardware 
accelerated, cross plattform and good looking, too. And we would need no stupid 
Aero or Compiz or other composition managers. And we could do things other 
widgetsets could only dream of. And porting to OpenES would be easy, too.
Stupid Lazarus developers. Now we only get this sucking Win API, GTK1, GTK2, 
Carbon and QT. Nothing really works and all is full of bugs.
  


Take easy.

If you are not help with it you have three options:

- Don't use anymore
- Make patches
- Do a fork

For myself i have some differences with Lazarus developers vision, but i 
will never call them stupid. Instead, i make patches.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] why sometime TLHTTPClientComponent can not get data?

2008-01-14 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:

Luiz Americo Pereira Camara wrote:

Marc Weustink wrote:


You are casting a pointer as a string... The way to convert PChar 
to a

string is to use the function StrPas


Only if you use shortstrings. When using ansistrings you can cast 
a PChar in to a string like: String(SomePchar)

With ansistrings you seldom (or never) need StrPas



What about the length that is stored just before the memory 
location of ansistrings? Does PChar created with StrAlloc have this 
field?


It is not really a cast. The compiler adds conversion code.


I'm interested in this since currently i use StrPas to convert from 
PChar to AnsiString.


that is not needed.

the following app is valid:
program a;
{$mode objfpc}{$h+}
var
  p: PChar;
  s: String;
begin
  p := 'abcdef';
  s := p;
end.

PChars will be "autoconverted" to strings
The use of StrPas is from the shortstring times.



Is this (String(PChar)) faster than StrPas?


lets compale to assembler and comapre:
# [10] s := p;
leal-48(%ebp),%eax
callFPC_ANSISTR_DECR_REF
movl$0,-48(%ebp)
movlU_P$S_P,%eax
callfpc_pchar_to_ansistr
movl%eax,-48(%ebp)
movl-48(%ebp),%eax
callFPC_ANSISTR_INCR_REF
movl$U_P$S_A,%eax
callFPC_ANSISTR_DECR_REF
movl-48(%ebp),%eax
movl%eax,U_P$S_A

# [11] s := StrPas(p);
leal-48(%ebp),%eax
callFPC_ANSISTR_DECR_REF
movl$0,-48(%ebp)
leal-304(%ebp),%edx
movlU_P$S_P,%eax
callFPC_PCHAR_TO_SHORTSTR
leal-304(%ebp),%eax
callfpc_shortstr_to_ansistr
movl%eax,-48(%ebp)
movl-48(%ebp),%eax
callFPC_ANSISTR_INCR_REF
movl$U_P$S_A,%eax
callFPC_ANSISTR_DECR_REF
movl-48(%ebp),%eax
movl%eax,U_P$S_A

You see... with StrPas, the pchar is first converted to a short string.


Is safe that will not change to a simple pointer cast in future?


This will break compatebility.


Does it copy the string content?


Yes, its the same code as assigning directly

# [12] s := String(p);
leal-48(%ebp),%eax
callFPC_ANSISTR_DECR_REF
movl$0,-48(%ebp)
movlU_P$S_P,%eax
callfpc_pchar_to_ansistr
movl%eax,-48(%ebp)
movl-48(%ebp),%eax
callFPC_ANSISTR_INCR_REF
movl$U_P$S_A,%eax
callFPC_ANSISTR_DECR_REF
movl-48(%ebp),%eax
movl%eax,U_P$S_A



Thanks.

This info is useful

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] why sometime TLHTTPClientComponent can not get data?

2008-01-14 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:


You are casting a pointer as a string... The way to convert PChar to a
string is to use the function StrPas


Only if you use shortstrings. When using ansistrings you can cast a 
PChar in to a string like: String(SomePchar)

With ansistrings you seldom (or never) need StrPas



What about the length that is stored just before the memory location 
of ansistrings? Does PChar created with StrAlloc have this field?


It is not really a cast. The compiler adds conversion code.


I'm interested in this since currently i use StrPas to convert from 
PChar to AnsiString.


Is this (String(PChar)) faster than StrPas?

Is safe that will not change to a simple pointer cast in future?

Does it copy the string content?

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] why sometime TLHTTPClientComponent can not get data?

2008-01-14 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:

ik wrote:

On Jan 14, 2008 3:59 AM, wfifi <[EMAIL PROTECTED]> wrote:

thanks ido
wireshark is a great tool, i attach a log, found data is got, but
Component's status not change.


I've read your code again (and looked at the log), I noticed this:
strstream.WriteString(String(ABuffer))

You are casting a pointer as a string... The way to convert PChar to a
string is to use the function StrPas


Only if you use shortstrings. When using ansistrings you can cast a 
PChar in to a string like: String(SomePchar)

With ansistrings you seldom (or never) need StrPas



What about the length that is stored just before the memory location of 
ansistrings? Does PChar created with StrAlloc have this field?


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] RSS for the subversion repository

2008-01-06 Thread Luiz Americo Pereira Camara

Damien Gerard wrote:


It seems the RSS for the subversion repository does not work anymore 
since the 07/12/26.

(http://www.freepascal.org/feeds/lazarussvn.rss)
I have got a 404 not found.

It is really usefull :)

May be has it been moved somewhere else ?



Try this link 
http://cia.vc/stats/project/lazarus/.rss?ver=2&medium=xhtml&limit=100


It provides more useful headers for my taste.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] New homepage and documentation for TSqlite3Dataset

2007-12-20 Thread Luiz Americo Pereira Camara

Damien Gerard wrote:


On Dec 20, 2007, at 12:14 AM, Luiz Americo Pereira Camara wrote:


Damien Gerard wrote:


On Dec 19, 2007, at 9:23 PM, Luiz Americo Pereira Camara wrote:

I updated the sqlite4fpc homepage adding documentation and some 
tutorials.


As a bonus i also added some features.

See http://www.geocities.com/camara_luiz/



Under Ubuntu :
 May be
 $ sudo apt-get install libsqlite3-dev
 is enough.

Under Mac OS X:
 There are several ways to do it. May be the most simple in a first 
time would be :

 $ sudo port install sqlite3


I forgot to mention : For this method MacPort is required 
(http://www.macports.org/)
For people who use fink under OS X I think "sudo apt-get install 
libsqlite3-dev" is good too but wait for a confirmation.


I will need to make a standalone app which use sqlite (without deps on 
MacPorts or Fink). At this moment I can send you the way to do it.




Please, when you get this info, send me a text explaining how to install 
sqlite on MacOSX, i will put in the page.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] New homepage and documentation for TSqlite3Dataset

2007-12-19 Thread Luiz Americo Pereira Camara

Damien Gerard wrote:


On Dec 19, 2007, at 9:23 PM, Luiz Americo Pereira Camara wrote:

I updated the sqlite4fpc homepage adding documentation and some 
tutorials.


As a bonus i also added some features.

See http://www.geocities.com/camara_luiz/



Under Ubuntu :
  May be
  $ sudo apt-get install libsqlite3-dev
  is enough.

Under Mac OS X:
  There are several ways to do it. May be the most simple in a first 
time would be :

  $ sudo port install sqlite3



Thanks. I'll update this section.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] New homepage and documentation for TSqlite3Dataset

2007-12-19 Thread Luiz Americo Pereira Camara

I updated the sqlite4fpc homepage adding documentation and some tutorials.

As a bonus i also added some features.

See http://www.geocities.com/camara_luiz/

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Class to store pointer values indexed by pointers

2007-12-08 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Fri, 07 Dec 2007 22:52:29 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:

  
I need a class that stores a pointer value indexed by a pointer. It 
should provide a way to retrieve the value using the indexed value.

I know TMap from Maps unit.

There's another class that comes with fpc/lazarus?



unit avglvltree TPointerToPointerTree

  


BTW: i found the TAVLTree/AVL_Tree unit in fpc code base. It's similar 
to TAvgLvlTree/AvgLvlTree found in LCL (even the author is the same = 
Mattias)


Is there any reason to not use the fpc (TAVLTree) version like being 
buggy or with less performance?


I would prefer using fpc to avoid LCL dependency.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Class to store pointer values indexed by pointers

2007-12-07 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Fri, 07 Dec 2007 22:52:29 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:

  
I need a class that stores a pointer value indexed by a pointer. It 
should provide a way to retrieve the value using the indexed value.

I know TMap from Maps unit.

There's another class that comes with fpc/lazarus?



unit avglvltree TPointerToPointerTree

  


Many thanks.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Class to store pointer values indexed by pointers

2007-12-07 Thread Luiz Americo Pereira Camara
I need a class that stores a pointer value indexed by a pointer. It 
should provide a way to retrieve the value using the indexed value.

I know TMap from Maps unit.

There's another class that comes with fpc/lazarus?

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] New bitmap :-)

2007-12-06 Thread Luiz Americo Pereira Camara

Paul Ishenin wrote:

wile64 wrote:


I may be stupid but what is the difference between TPageControl and 
TNoteBook exactly ?
TNoteBook is some obsoleted win 3.1 control. In current lazarus 
implementation TNotebook has about the same implementation as 
TPageControl. All difference is in how pages can be accessed and in 
way of controlling visibility of Tabs. In TNoteBook tabs (top part of 
control) can be totally visible or invisible. In TPageControl you can 
control visibility of separate tabs.




I can make separated tabs invisible by using TPage.TabVisible when using 
TNotebook here. (At least in win32)


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] SQLite 3 datetime and timestamp

2007-12-03 Thread Luiz Americo Pereira Camara

Roberto Padovani wrote:

Now, about assumptions.

in sqlite3ds there is the assumption that BOOLEAN fields are stored as
1 or 0. In fact, to recover a db that had "TRUE" and "FALSE", I made a
new class where I changed ftBool to fString. In this way I could read
them, parse them and then write them back as 1 or 0.

With the dates, the problem is similar, because sqlite3ds understands
that the field is of type "DATE", and so it makes the following
assumption in customsqliteds.pas line 603:

ftFloat,ftDateTime,ftTime,ftDate,ftCurrency:
  begin
Val(StrPas(FieldRow),Double(Buffer^),ValError);
Result:= ValError = 0;
  end;

  


True. It stores both in memory and in database the Double value.


In the database I have, the dates are in the ISO standard form
"2007-12-03 12:11:10.1234"
How do you suggest me to handle with them ?
1) by complicating the SQL queries with SELECT date(field_name) as
field_name FROM... which turns the field_name into a string in the
result set
  


Possible


2) by subclassing or anyway changing the TFieldType ?
  


Difficult


3) like with boolean, by making a special temporary class that parses
the whole database (not so big) and changes the dates into
Freepascal-style doubles (are they stored more efficiently ?)
  


I already started such tool. Not ready yet. Good if is one step eg you 
won't access that file every time.



4) other (please specify :-))

  


Modify the sqlite3ds or create a TSqlite3Dataset descendant that:

1) Recognize a TIMESTAMP field
2) Stores the field value as a string in the desired format
3) When the data is loaded convert from string to double
4) When do ApplyUpdates convert from Double to String


I can do that.


My brain-storming last night came up with the idea of adding a flag
that says "force every field as a string": this would let someone who
doesn't know which convention was used in which field to inspect it.
Is it somewhat crazy ?

  


It's more difficult than above, but possible.


By the way, I really like sqlite and the unit you made to access it.
  


Good

When the project I'm working on is finished, I'll strip everything
from the source code and only leave a detailed tutorial for using
sqlite without visual components. 

Good.

Meanwhile, I read somewhere in the
mailing that you are writing a documentation for sqlite3ds; is it
ready or partially ready ?
  


Partially ready. This is really needed because there's a lot of 
undocumented features and some feature misuses (like using QuickQuery 
for execute a SQL)
I'll be busy until 15/12. After that i will work on a solution for this 
case, finish the documentation, work in improvements in sqliteds and 
release a new sqlite3 wrapper.

I'll contact you.

I'm studying the whole code at the moment and some documentation would
help a lot, especially to see the global structure, to get the large
picture of it. Moreover, I'm going to keep on working a lot with
sqlite, so if some contribution is needed somewhere, let me know.
  

Fine. The documentation is a place that needs work.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] SQLite 3 datetime and timestamp

2007-12-03 Thread Luiz Americo Pereira Camara

Luca Olivetti wrote:

En/na Roberto Padovani ha escrit:


When the project I'm working on is finished, I'll strip everything
from the source code and only leave a detailed tutorial for using
sqlite without visual components.


FWIW to do that you can also use sqlite3 directly (or with a thin 
wrapper), you don't have the convenience of a full dataset descendant 
but you have complete control on what you get from the database.




BTW: I wrote a thin wrapper to sqlite3. See 
https://luipack.bountysource.com/svn/!tree/185#svn0_4|svn0_4_9


Is not in a release state yet. I'll release together with the documentation.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] SQLite 3 datetime and timestamp

2007-12-02 Thread Luiz Americo Pereira Camara

Roberto Padovani wrote:

Hi all!

two things: 1) a (possible) improvement to sqlite3ds; 2) the old
problem with dates and time

1) I found a sqlite database that uses the TIMESTAMP data type, but
this is not directly supported by the Tsqlite3Dataset written by Luiz.
I added the if-else checks in sqlite3ds.pas for this type, which
refers to ftTimestamp of TFieldType in db.pas. And I also added
db.DefaultFieldClasses[ftTimeStamp] := TDateTimeField at run-time,
because in db.pas it is defined as nil (and I didn't want to recompile
it).
So, now my app can understand a timestamp field as a TDateTime instead
of a string...

2)and here comes the problem! The code:

var d: TDateTime;
..
d := database.FieldByName('birthday').asDateTime;
...
will always store the zero date: 30 Dec 1899
why ?
  


It's necessary to see the changes you made.
To add a new type is necessary to modify InternalInitFieldDefs, 
GetFieldData and SetFieldData



Being urgent, at the moment I am reading the dates as strings by using
the "date" or "datetime" function of SQLite in the query, i.e.:

SELECT date(birthday) AS string_birthday FROM people;

and then parsing them with the powerful functions in the freepascal
RTL, but I would like to understand this once for all.
  


Here's how sqlite works (for good and bad):

- You can create tables with any "field type": TIMESTAMP, TIME_STAMP, 
QWERTY etc
- In any of this "field type" you can store anything: a integer, a 
float, a string


Many sqlite managers make assumptions (each one create its own 
convention). Examples:

BOOLEAN will store TRUE or FALSE strings,
DATE will store "02-12-2007".
This is completely random.

So program X can store DATE as "02-12-2007" but program Y will store as 
"02/12/2007". The program Z, worried with memory stores as "02122007" 
but program W is more smart so will store as "021207".


Supporting these conventions it would lead to code bloat and performance 
issues and someone would always ask "hey my DATE format is not 
supported, please do it".


In other words, sqliteds, as it was designed, has the objective of add a 
way to fpc programs to use sqlite as a database backend. So it does. It 
was not designed for access data files created with other managers or 
frameworks.
See as a balance between feature and code size/performance. Any design 
taken has advantages and disadvantages. In the sqliteds case, the 
decision was to trend to code simplicity, privilege the most common 
cases in detriment of not so common.


If you come until here, don't be pessimist. Some solutions:

- Don't forget is open source. You can modify to fill your needs. I can 
help with this. Send what you already did.
- If you don't want to modify sqliteds file directly you can write 
descendants.
- Try sqlitepass and sqldb/sqlite3. I vaguely remenber of sqlitepass to 
support timestamp. I don't know about sqldb.
- If you just want to import the data of a "strange" db file (you won't 
need to access directly this file all time) than convert to the sqliteds 
format (Double). I already started a program that does this but not 
finished. I can also help you.



Luiz


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus v0.9.25 r13078M with gtk 2 (screen flicker)

2007-11-30 Thread Luiz Americo Pereira Camara

Graeme Geldenhuys wrote:

Hi,

I haven't tried Lazarus compiled with GTK2 in months and thought I
would give it a go.  Compiling went fine.  Running Lazarus though, the
screens (any dialog windows I open) redraw quite slow.
Also scrolling the editor window up or down with the mouse causes
serious flicker on the text.

I double checked the About box to see if there is any newly added
epilepsy or seizure warning text. ;-)  Couldn't find any, so I guess
it's a software defect.  Other GTK2 based apps like Gimp, Thunderbird,
Firefox do not have this behaviour.
  


Maybe because double buffer is disabled?

Search for  gtk_widget_set_double_buffered in gtk intf folder

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Tips for lazarus projects and Subversion

2007-11-22 Thread Luiz Americo Pereira Camara

Damien Gerard wrote:
I had some headaches after adding lrs to svn repositories. Definitely 
i don't add lrs and lps files to my svn repositories.




I agree with lps due to it contains about the session. So it should be 
added into a repository.

Like .res and now I have nice commits.
And I don't have any problems with lrs. 


If you are fine keeping them so there's no need to change.


What's wrong with them ?


I ended in a situation where i got streaming exceptions. I don't know 
how to reproduce it.


Luiz


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Tips for lazarus projects and Subversion

2007-11-22 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Thu, 22 Nov 2007 11:51:36 +0100
Luca Olivetti <[EMAIL PROTECTED]> wrote:

  

En/na Mattias Gaertner ha escrit:



.lfm files: no
.lrs files: it depends. It is recommended to keep them.
  

Why? Cannot they be automatically generated from the lfm?



And I forgot:
lrs files are normally in the source directories, which can be
readonly, so the IDE can not create them.

  


In subversion case this is not valid since you assume its writeable.

I had some headaches after adding lrs to svn repositories. Definitely i 
don't add lrs and lps files to my svn repositories.


I created a bug report about the lpi file changes: 
http://www.freepascal.org/mantis/view.php?id=10238


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Tips for lazarus projects and Subversion

2007-11-21 Thread Luiz Americo Pereira Camara

Vincent Snijders wrote:

Damien Gerard schreef:


I use SVn with my projects in lazarus.

I added the file project.lpi. This file is sent nearly at each commit 
and always provides conflicts with others team members.
However I believe the file is needed due to there are some settings 
for the project.


Is there a way to avoid this ?


Do you store session information in a different file (.lps). Don't add 
this file to svn. See project options -> Session.


Another problem i face is that when you open a project saved in Win32 in 
a Linux machine the lpi file is changed because of the PathDelim even if 
you don't change the project options. The inverse (Linux > win32) is 
also true.

This leads to unnecessary file commits.

From some time i always check the changes in lpi files to see if worth 
commiting


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: Fw: Re[2]: [lazarus] Plots

2007-11-20 Thread Luiz Americo Pereira Camara

Vasily I. Volchenko wrote:

Thanks. This is a good start.

Luiz

-Original Message-
From: Vasily I. Volchenko <[EMAIL PROTECTED]>
To: Luiz Americo Pereira Camara <[EMAIL PROTECTED]>
Date: Tue, 20 Nov 2007 17:44:51 +0300
Subject: Re[2]: [lazarus] Plots

  

Hi,

Thanks, i got the packages and successfully compiled. But i did not find 
example of how to use it.


Can you post some small examples?

Luiz

  

Presently it is quite difficult for me (as I am at work). As far as I remember, 
there are the following rules:
1. TCustomPlot:
simple plotting control. You need to make a set of points, and them will be 
connected with line. Points should be set via Points property, which is a 
decendent of TStrings. So, in program you need to set points[i].x and points.y. 
In ObjectInspector you may edit it as a stringlist, each line is a point in 
format x:y, where x and y are float falues.
XMin,XMax,YMin,YMax - float properties for setting plot borders. Alternatively 
you may set AutoSizeX and/or AutoSizeY to true, so all points must be shown.
HasMarks means whether axes have a marks (float numbers). NMarksX and NMarksY 
shows how many such marks will be at the correspondend axis. XSpacer and 
YSpacer means how many space (in pixels) are left for float marks. XMarkDigits, 
YMarkDigits,XMarkDecimals, YMarkDecimals are about formatting the values.
2. TFunctionPlot:
Almost the same (it can work the such way), but a new event (OnFunctionCall) is 
defined. You should write a function body in it, like
begin
y=sin(x);
end;
Nothing more. Besides, AutoSizeX means nothing while plotting functions, you 
should set MinX and MaxX.
Property DividingTabs means how many points will be used to tabulate (and then 
draw) the function.

Wiki and examples will be tomorrow. Surface3d too.

Sorry for my terrible English. This is because all mathematical courses (from 
the beginning school's mathemathics to mathematical modelling in post graduate) 
were in Russian, and technical English doesn't include mathematics.




_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


  


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Recent gtk CreatePatternBrush implementation

2007-11-14 Thread Luiz Americo Pereira Camara

Paul Ishenin wrote:

Luiz Americo Pereira Camara wrote:

function CreatePatternBrush(hbmp:HBITMAP):HBRUSH;
var
 Log: TLogBrush;
begin
 with Log do
 begin
   lbColor := 0;
   lbHatch := hbmp;
   lbStyle := BS_PATTERN;
   Result := CreateBrushIndirect(Log);
 end;
end;
I warry in this case about DIBs, but for other widgetsets than windows 
I can use indeed CreateBrushIndirect.



Yes. In windows case there's a native CreatePatternBrush that already 
sets the lbHatch (BS_PATTERN/BS_DIBPATTERN) according to bitmap type. So 
no need to use this simplified version.


This example, in fact, was to be used by other widgetsets (similar to 
what i did in LCLExtensions package)


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Recent gtk CreatePatternBrush implementation

2007-11-14 Thread Luiz Americo Pereira Camara

@Paul

Recently, landed in svn an implementation of CreatePatternBrush for gtk.
I'd like to point that for some time a patch fixing the creation of 
pattern brushes through CreateBrushIndirect is available in mantis (see: 
http://www.freepascal.org/mantis/view.php?id=8814)


It has some advantages over the recent addition:

1) Fix the more generic function (CreateBrushIndirect), so if the user 
try to create a bitmap pattern using a TBrushLog will not get an error. 
In fact, based in my tests, it seems that win32.CreatePatternBrush is 
just a wrapper around CreateBrushIndirect


2) Works both for monochrome as well to color bitmaps/pixmaps. In the 
svn will work only for monochrome


3) Implementing CreatePatternBrush is as simple as:

function CreatePatternBrush(hbmp:HBITMAP):HBRUSH;
var
 Log: TLogBrush;
begin
 with Log do
 begin
   lbColor := 0;
   lbHatch := hbmp;
   lbStyle := BS_PATTERN;
   Result := CreateBrushIndirect(Log);
 end;
end;

Obs: recently gtkobject.inc file got renamed, so the patch will not 
apply without manual edit. I will update it as soon as possible


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] I need examples of SQLite

2007-11-04 Thread Luiz Americo Pereira Camara

Daniel Rincón García wrote:
Yes, I translated to sqlite3ds. The sqliteminimal example works 
correctly but the 3dcompare example do not works.


I did not change dumpdata.pas to use sqlite3ds.

How I do it?


replace TSqliteDataset  by TSqlite3Dataset and sqliteds by sqlite3ds

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] I need examples of SQLite

2007-11-04 Thread Luiz Americo Pereira Camara

Daniel Rincón García wrote:

I am trying to execute the examples but I obtain the next errors:

http://i12.tinypic.com/526id0j.jpg

http://i15.tinypic.com/2lmrm9t.jpg 

http://i2.tinypic.com/536k4l5.jpg

http://i9.tinypic.com/6g8t7ur.jpg

What is the problem?


This occurs when you try to open a non db file.

Do you translated to sqlite3ds?

Do you also changed dumpdata.pas to use sqlite3ds?

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Multiple targets

2007-11-02 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Fri, 02 Nov 2007 21:53:52 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:

  

Luiz Americo Pereira Camara wrote:


 The VirtualTreeView package is a lot big, even when zipped. I'll
try to create a smaller dummy package and will send to you.
  

I managed to create a very small example (package + project). Here it
is.

The breakpoint is set inside the ChildUnitProc.



Thanks. Fixed.

  

Many thanks.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Multiple targets

2007-11-02 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Fri, 02 Nov 2007 20:42:37 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:

  

Mattias Gaertner wrote:




[]

It's no trick - it's pascal.
The IDE will never get that flexible. That's why I think, this case
does not need any special IDE magic.
  
  
Yes. I'm fine with this workaround but this has a side effect (maybe 
just a bug in IDE/Debugger):

- I use a unit inside "units\$(LCLWidgetType)\"
- This unit is compiled for all widgetsets/oses (no problem here)
- The codetools find this file
- A breakpoint is set in that unit
- When the breakpoint is hit the debugger ask for the location of
that unit

PS: The cited package is the virtualtreeview-unstable and the unit is 
virtualpanningwindow



Can you send a small example including the packages (sources are
enough, no .ppu) zipped to my address?
  

The VirtualTreeView package is a lot big, even when zipped. I'll try to
create a smaller dummy package and will send to you.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Multiple targets

2007-11-02 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Fri, 02 Nov 2007 18:59:26 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:

  

Luiz Americo Pereira Camara wrote:


# There is no real need for conditional options for units
Maybe there's already a solution to this case and i'm missing
something.
  
In fact, i already found a workaround that i implemented in another 
package. I added a dummy unit to the package that  uses the required 
units by OS something like:


{$ifdef windows}
Uses
  WinUnits;
{$endif}
{$ifdef unix}
Uses
  UnixUnits;
{$endif}

"WinUnits" and "UnixUnits" are not used i the package but are i  the 
unit search path of the package


With this trick, "WinUnits" is compiled only under windows and 
"UnixUnits" under unixes.



It's no trick - it's pascal.
The IDE will never get that flexible. That's why I think, this case
does not need any special IDE magic.
  
Yes. I'm fine with this workaround but this has a side effect (maybe 
just a bug in IDE/Debugger):

- I use a unit inside "units\$(LCLWidgetType)\"
- This unit is compiled for all widgetsets/oses (no problem here)
- The codetools find this file
- A breakpoint is set in that unit
- When the breakpoint is hit the debugger ask for the location of that unit

PS: The cited package is the virtualtreeview-unstable and the unit is 
virtualpanningwindow


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Multiple targets

2007-11-02 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

# There is no real need for conditional options for units
Maybe there's already a solution to this case and i'm missing something.


In fact, i already found a workaround that i implemented in another 
package. I added a dummy unit to the package that  uses the required 
units by OS something like:


{$ifdef windows}
Uses
 WinUnits;
{$endif}
{$ifdef unix}
Uses
 UnixUnits;
{$endif}

"WinUnits" and "UnixUnits" are not used i the package but are i  the 
unit search path of the package


With this trick, "WinUnits" is compiled only under windows and 
"UnixUnits" under unixes.


Luiz


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Multiple targets

2007-11-02 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Fri, 02 Nov 2007 13:56:31 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:

  

2)Make units packages/projects optional according to widgetset.
Concrete situation: LCL extensions package has a unit (OleUtils) that 
implements TOLEStream. It only makes sense in win32. Currently the

unit is added in all widgetsets but all code is wrapped around a
ifdef Windows define so is seen as a dummy unit in other widgetsets.

Let me know the wiki address to add these cases



http://wiki.lazarus.freepascal.org/Conditional_Compiler_Options

  


Thanks.
You also saved me from adding these cases ;-) . Thanks again.

About the notes  you added in the second case:

# All units should be added to the package, independent if they are 
used. If they not always used, you can already check the flag.
If i uncheck the uses unit flag that unit will not be compiled in none 
cases. Nor in win32 (where is needed) neither in the other systems.


# The above example is about windows. That has nothing to do with the 
widgetset. The qt and gtk2 widgetsets are also running under windows.

Ok

# You can put units specific to targets into sub directories as 
demonstrated in the Lazarus and FPC sources.
I already did that. I created a units/win32 dir with OleUtils.pas inside 
and put units\$(TargetOS)\ in Other Units path but the unit is not 
compiled even in win32. See modified package source attached.


# There is no real need for conditional options for units
Maybe there's already a solution to this case and i'm missing something.

Luiz



  




  
  
  



  
  

  
  

  





  


  
  


  



  

  


  


  
  
  

  



Re: [lazarus] Multiple targets

2007-11-02 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

Mattias Gaertner wrote:

Yes, it is discussed from time to time.
It is definitely planned. It is mainly a GUI problem.
Perhaps it would be a good idea to start a wiki and collect some case
studies, so the GUI designers know, what the GUI should manage and what
not.   


Here's two cases where i need similar features:

1) Make possibly to define a package requirement as optional (Should 
be available both to package and program).
Concrete situation: VirtualTreeView requires multilog package to help 
debug code. In a release is not desired to have such dependency. 
Currently in the release is necessary to remove the dependency from 
the package, and then add again to reenable debugging.
An idea is to have groups of conditional requirements. Each group 
would have  a define value associated to be used at compile time (e.g: 
'DEBUG_CODE') and child packages. Each group would have a enabled 
flag. If enabled flag is set, the child packages are added as 
requirements and the define value used at compile time.


A more generic approach is to have "define triggers" for each group. As 
an example in a conditional group you could add the trigger: LCLWin32. 
In this case that group will run only when LCLWin32 is defined (the IDE 
does it automatically for win32). This would help in case 2. It could be 
valid for user defines also set at compiler options (eg DEBUG_CODE)



2)Make units packages/projects optional according to widgetset.
Concrete situation: LCL extensions package has a unit (OleUtils) that 
implements TOLEStream. It only makes sense in win32. Currently the 
unit is added in all widgetsets but all code is wrapped around a ifdef 
Windows define so is seen as a dummy unit in other widgetsets.




Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Multiple targets

2007-11-02 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Fri, 2 Nov 2007 16:16:06 +0100
Milipili Houbi <[EMAIL PROTECTED]> wrote:

  

I miss something with Lazarus. Something quite usefull I think.

I would like to be able to set multiple target, with different  
compiler options and different defines at the compilation.


It is possible to load/save the settings but it is not really easy
to use.

There are obviously more important things to do right now but I
would like to know if there is something like that planned,
discussed, rejected for some reaons...



Yes, it is discussed from time to time.
It is definitely planned. It is mainly a GUI problem.
Perhaps it would be a good idea to start a wiki and collect some case
studies, so the GUI designers know, what the GUI should manage and what
not.

  


Here's two cases where i need similar features:

1) Make possibly to define a package requirement as optional (Should be 
available both to package and program).
Concrete situation: VirtualTreeView requires multilog package to help 
debug code. In a release is not desired to have such dependency. 
Currently in the release is necessary to remove the dependency from the 
package, and then add again to reenable debugging.
An idea is to have groups of conditional requirements. Each group would 
have  a define value associated to be used at compile time (e.g: 
'DEBUG_CODE') and child packages. Each group would have a enabled flag. 
If enabled flag is set, the child packages are added as requirements and 
the define value used at compile time.


2)Make units packages/projects optional according to widgetset.
Concrete situation: LCL extensions package has a unit (OleUtils) that 
implements TOLEStream. It only makes sense in win32. Currently the unit 
is added in all widgetsets but all code is wrapped around a ifdef 
Windows define so is seen as a dummy unit in other widgetsets.


Let me know the wiki address to add these cases

Luiz


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Drawing Strategy in Carbon Lazarus

2007-10-11 Thread Luiz Americo Pereira Camara

James Chandler Jr wrote:

Hi Giuliano

The Carbon Lazarus works great with invalidate and the OnPaint events, 
as far as I've been able to tell. Mac double-buffering on the screen 
well-guarantees no flicker. And it is true that invalidate can be 
called multiple times before the event loop gets around to calling 
OnPaint.


But there is an expense with the double-buffering and 'delayed 
flush'-- Sometimes this circuitous route involving many messages, can 
cause 'slightly slow' screen updates. If an OnPaint does a lot of 
drawing and calculating (which sometimes can't be done in advance), 
the new screen draw appears very quick and clean onscreen, but there 
is some latency where nothing happens on the screen, before this quick 
clean change suddenly appears.




You can invalidate only the area that needs update using 
LCLIntf.InvalidateRect. Then you can get the update rect using the 
TLMPaint message. With this you can speed the drawing but will require a 
more sophisticated algorithm  to define what to draw.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Another icons for Lazarus

2007-09-14 Thread Luiz Americo Pereira Camara

wile64 wrote:



2007/9/11, Joost van der Sluis <[EMAIL PROTECTED] >:

Well... if you have time, do you also allow requests?

The icons of the sqldb-components aren't really beautiful. And the
components in the fp-web-package (lazarus/components/fp-web) are
non-existent... ;)


Joost


You finds that prettier?


Good work.

I noticed you are using 23x23 bitmaps. From some time the IDE supports 
24x24 bitmaps. Maybe this gives you a little more room for working.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] IDE, start once, open files

2007-09-12 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

https://svn.bountysource.com/luipack/trunk/uniqueinstance

If someone knows a way to hook in LCL message loop to be called more 
frequently than OnIdle or wants to implement a separeted thread i'm 
accepting patches.



Contrary to windows there are far less messages under linux/gtk so the
OnIdle is not called for long periods, when you work in another program.
Unless you start a TTimer.
  


Thnks for the tip. This worked.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus on one window (aka SDI)

2007-09-11 Thread Luiz Americo Pereira Camara

Graeme Geldenhuys wrote:

It is SO bad that I have gotten in the habit of using a dedicated
virtual desktop just for Lazarus. I would definitely be in favor of a
single window design.



Someone else that thinks like I do. I actually use 4 virtual desktops.
One for Lazarus, Firefox, Mozilla and a spare for things like VMWare.
  


We are three. I also use one exclusive virtual desktop for Lazarus.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] IDE, start once, open files

2007-09-11 Thread Luiz Americo Pereira Camara

Luca Olivetti wrote:

En/na Luiz Americo Pereira Camara ha escrit:

It's working here both under win32 and linux (testraw and 
testcomponent programs). Using fpc 220, Ubuntu Feisty Faw, recent 
lazarus svn.


I assure you that I could lauch various copies of my program. I used 
fpc 2.0.4, maybe that's the problem. I only used uniqueinstanceraw, 
since it's a daemon, not a gui app.


Did you tested the testraw program that comes bundled with the package? 
Although it uses a Lazarus app, the pattern usage can be transported to 
a non gui app straightforward.


Luiz


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] IDE, start once, open files

2007-09-11 Thread Luiz Americo Pereira Camara

Luca Olivetti wrote:

En/na Mattias Gärtner ha escrit:
Is there already a cross platform component for applications to check 
if it is
already running and if yes then pass some commands to the already 
application?


For example clicking on files in the file browser should not open a 
second

instance, but tell the already running instance to open the files.


There's uniqueinstance
http://sourceforge.net/project/shownotes.php?group_id=92177&release_id=471823 

(The wiki is down, so I cannot give you the wiki link) *but* it 
doesn't work here under Linux (I could launch more that one instance 
of my program).
Since I hadn't too much time to debug it, I slightly modified it to 
open and lock a file instead of using TSimpleIpc, but that makes it 
non-crossplatform.
Since it's short I'm including it here, it could be extended to write 
the pid in the file, so another instance can somewhat contact the 
first one.


It's working here both under win32 and linux (testraw and testcomponent 
programs). Using fpc 220, Ubuntu Feisty Faw, recent lazarus svn.


The only missing feature under linux is the parameter list passing:
Under windows the SimpleIpc mechanism is integrated with the win32 
message loop so the IPCServer.OnMessage is called without any further 
intervention.
Under unix, SimpleIpc is not integrated with any message loop so 
IPCServer.OnMessage is not called.

There are to ways of doing under unix:
 - Hook in the LCL message loop to call PeakMessage
 - Create a thread that will call PeakMessage at a time interval

In the below address you will find an updated component that hooks in 
Application.OnIdle to call PeakMessage. Its far from optimal because 
will prevent the use of OnIdle by the programmer and the parameter list 
will be peaked only when the app is idle/has focus.


https://svn.bountysource.com/luipack/trunk/uniqueinstance

If someone knows a way to hook in LCL message loop to be called more 
frequently than OnIdle or wants to implement a separeted thread i'm 
accepting patches.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Advanced unit dependency tree tool

2007-09-10 Thread Luiz Americo Pereira Camara
I'm looking for a tool that builds a complete unit dependency tree for 
object pascal. By complete i mean that not only the info "unit1 uses 
unit2" is given but also the functions used . Something like "unit1 uses 
functions foo and bar from unit2".


The tool can be for Delphi or Lazarus

Any help is appreciated

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Conditional package dependency. Is it possible?

2007-09-09 Thread Luiz Americo Pereira Camara
I use a package/component (Multilog) to debug another package/component 
(VirtualTreeView). Currently the Multilog is set as a dependency to VTV.


Would be possible to enable Multilog as a dependency only when a define 
is set?


This way i could provide a dependency free package as the time i keep 
possible to enable debugging code without changing the original package


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Performance of 24bit bitmap in 32bit color display

2007-09-02 Thread Luiz Americo Pereira Camara
In a recent thread i discussed with Marc the alpha bitmap design, and 
was pointed that would be no performance penalty if a 24bit bitmap is 
used in a 32bit color display since the number of bytes per pixel would 
be equal. Initially i agreed but i found that this info is incorrect.


A 24bit bitmap uses 4bytes/pixel (in average) in some sizes (1,2,3 
pixels) to fill the dword boundary. When the dword boundary is filled 
with 3bytes/pixel (4 pixels), it will use 3 bytes/pixel, in other 
situations (5 pixels) the bytes/pixel is not constant. So a bitmap with 
1,2,3 pixels will have the same size using 24bit or 32bit (4,8,12 
bytes), a 4 pixels bitmap will use 12 bytes and 16 bytes respectively, a 
5 pixels bitmap will have 16 and 20 bytes.


I also tested the performance of such issue.  A program that bitblt 1000 
times a 200x200 bitmap in a 32bit color display give the results below 
(an 77% overhead over 32bit bitmap). Attached is a program (used fpc 
214, XP SP2, celeron D 1.4 512MB). In the other side 24bit bitmaps use 
less memory.


Although i disagree with the design/solution (using a 24bit bitmap by 
default in 32bit color display), that has performance issues and other 
side effects, the bitmap support improved with recent changes and i wont 
question this issue anymore, as the current LCL code.


The info here is just for clarify a misconception.

PS: with the recent changes (using CreateDIBSection to create the 
bitmap) alpha blend in VTV under win32 i near ;-) .


Luiz


Bench24bit.rar
Description: Binary data

TChronoLog results - 2/9/2007 21:28:14
Session: 24bit first
Results (6):  microsec milisec seconds
-   ---   -   -
0 - 24bit   263.699 264   0
1 - 24bit   263.957 264   0
2 - 24bit   262.954 263   0
3 - 32bit   148.656 149   0
4 - 32bit   148.796 149   0
5 - 32bit   148.833 149   0

Accumulated (Miliseconds):1.237


TChronoLog results - 2/9/2007 21:28:30
Session: 32bit first
Results (6):  microsec milisec seconds
-   ---   -   -
0 - 32bit   149.329 149   0
1 - 32bit   149.110 149   0
2 - 32bit   148.376 148   0
3 - 24bit   263.509 264   0
4 - 24bit   263.677 264   0
5 - 24bit   264.157 264   0

Accumulated (Miliseconds):1.238


TChronoLog results - 2/9/2007 21:28:54
Session: Alternate
Results (6):  microsec milisec seconds
-   ---   -   -
0 - 24bit   264.219 264   0
1 - 32bit   148.475 148   0
2 - 24bit   264.444 264   0
3 - 32bit   148.353 148   0
4 - 24bit   264.141 264   0
5 - 32bit   149.036 149   0

Accumulated (Miliseconds):1.239


Re: [lazarus] TBitmap performance after alpha channel support (Was:Graphics dont work)

2007-08-30 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:


- The lower levels functions will be optimized. This would reduce 
the size/complexity of StretchMaskBlt helping in the 
maintainability/code quality since it will not be a handle all function


Now there is one function, otherwise you have to maintain 2.





I forgot to say that it will not be necessary to add code to convert 
from 32bit -> 24bit and not necessary to rework the 
CreateCompatibleBitmap and CreateDIBSection functions (with 
unpredictable  consequences/bugs). And maybe other changes should be 
necessary.


In the end, the "one function handles all" approach will need much more 
code to debug/maintain.


Also the old StretchMaskBlt function has already been tested widely, 
being necessary to debug mostly the alpha enabled function


It will be two smaller functions with a more specific design dealing 
with fewer variables. Currently StretchMaskBlt handles Mask presence, 
Alpha presence, Stretch need giving 8 possiblites.


Bugs can be fixed independently. Today fixing a bug in mask support 
can break alpha support and vice versa.


It will increase granularity of the api keeping it really low level:
Think of a developer that wants to work with bitmaps in low level 
using 32bit format but don't want/need to setup the alpha channel. If 
he calls StretchMaskBlt, currently, the alpha channel (with garbage 
data) will be always used leading to wrong display. There's no way to 
overcome this. With the two functions design he can chooses the 
appropriate functions.


In the end if a "handle all" function is desired in winapi level (i 
still think should be in higher levels and is not necessary in low 
level) create a function of type "if haschannel do call channel 
function else call non channel function"




Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TBitmap performance after alpha channel support (Was:Graphics dont work)

2007-08-30 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:
This solution would bring another performance penalty, when using 
32bit color display, since each time a BitBlt/StretchBlt is called a 
color conversion (three times when using mask) will be done.
It also breaks the PixelFormat = pfDevice (the default) idea of 
having the most suitable/faster pixel format depending of the 
display/device.


yes there will be some differences. there is no penalty between 24 or 
32 bpp. (except what we introduce)



OK
My idea is to let the higher levels (TBitmap/LazIntfImage) decides if 
will use Alpha or not:

[..]


I don't want to use different functions between alpha and non alpha.
IMO, the current vcl/windows implementation is completely alpha 
unaware. I want to avoid that.
So blitting an alpha image will use alpha, blitting a non alpha image 
no alpha. The Usealpha flag is implicit. It has no meaning for 
nonalpha images.



[..]
- The lower levels functions will be optimized. This would reduce the 
size/complexity of StretchMaskBlt helping in the maintainability/code 
quality since it will not be a handle all function


Now there is one function, otherwise you have to maintain 2.



It will be two smaller functions with a more specific design dealing 
with fewer variables. Currently StretchMaskBlt handles Mask presence, 
Alpha presence, Stretch need giving 8 possiblites.


Bugs can be fixed independently. Today fixing a bug in mask support can 
break alpha support and vice versa.


It will increase granularity of the api keeping it really low level:
Think of a developer that wants to work with bitmaps in low level using 
32bit format but don't want/need to setup the alpha channel. If he calls 
StretchMaskBlt, currently, the alpha channel (with garbage data) will be 
always used leading to wrong display. There's no way to overcome this. 
With the two functions design he can chooses the appropriate functions.


In the end if a "handle all" function is desired in winapi level (i 
still think should be in higher levels and is not necessary in low 
level) create a function of type "if haschannel do call channel function 
else call non channel function"


Luiz


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TBitmap performance after alpha channel support (Was:Graphics dont work)

2007-08-30 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:

Luiz Americo Pereira Camara wrote:

Luiz Americo Pereira Camara wrote:
The problem is that StretchMaskBlt is calling AlphaBlend and somehow 
this is not working.


It seems that TBitmap will have alpha channel by default (or at least 
LCL recognizes as having) when running in a display with 32bit color 
under win32.


Looking at StretchMaskBlt (the function used by TBitmap to draw) when 
a bitmap has alpha (checks if has 32bit depth), each time is draw an 
extra bitmap is created and also some other extra calls.


I don't think we need alpha channel by default when using TBitmap to 
e.g temporarily draw before sending to the canvas. Maybe a property 
could be added to enable alpha support at TBitmap level (when reading 
a file or when the user requires it). Another option is to split 
StretchMaskBlt



This will be fixed. By default a bitmap should be 24bpp when 32bpp is 
available. There was a fix, but at the wrong place. So I removed 
removed it when fixing 9501


This solution would bring another performance penalty, when using 32bit 
color display, since each time a BitBlt/StretchBlt is called a color 
conversion (three times when using mask) will be done.
It also breaks the PixelFormat = pfDevice (the default) idea of having 
the most suitable/faster pixel format depending of the display/device.


My idea is to let the higher levels (TBitmap/LazIntfImage) decides if 
will use Alpha or not:


- Create a "StrechAlphaBlt" function to use the alpha channel. Let 
StretchMaskBlt to handle masked and not transparent bitmaps.
- If an image with alpha channel is loaded or if the user explicitly 
requires, an "UseAlpha" flag is set
- When a draw is done if "UseAlpha" is set, use "StretchAlphaBlt" 
otherwise StretchMaskBlt


This has some advantages:

- The higher levels (TBitmap/LazIntfImage) will be flexible/able to 
handle any format

- TBitmap will use by default the faster pixel format in 32bit color display
- The lower levels functions will be optimized. This would reduce the 
size/complexity of StretchMaskBlt helping in the maintainability/code 
quality since it will not be a handle all function


What the core developers think?



BTW, a TBitmap has already such property. No need to add another one :)

Half of the way ;-)

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TBitmap performance after alpha channel support (Was:Graphics dont work)

2007-08-29 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:
The problem is that StretchMaskBlt is calling AlphaBlend and somehow 
this is not working.


It seems that TBitmap will have alpha channel by default (or at least 
LCL recognizes as having) when running in a display with 32bit color 
under win32.


Looking at StretchMaskBlt (the function used by TBitmap to draw) when a 
bitmap has alpha (checks if has 32bit depth), each time is draw an extra 
bitmap is created and also some other extra calls.


I don't think we need alpha channel by default when using TBitmap to e.g 
temporarily draw before sending to the canvas. Maybe a property could be 
added to enable alpha support at TBitmap level (when reading a file or 
when the user requires it). Another option is to split StretchMaskBlt


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Graphics dont work

2007-08-29 Thread Luiz Americo Pereira Camara

wile64 wrote:
2007/8/29, Luiz Americo Pereira Camara <[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>>:


wile64 wrote:
> example :
>
> FImagePaint is a TBitmap create with
> FImagePaint := TBitmap.Create;

Try to define the height and width of the bitmap



I repeat that all worked before the 27/08/2007, the size is well defined!


I'm just trying to help.

I isolated the problem.

The problem is that StretchMaskBlt is calling AlphaBlend and somehow 
this is not working.


Below is an excerpt of a LCL program with a TPaintBox, if BitBlt is 
called then works fine, StretchMaskBlt shows nothing:


var
 FImagePaint: TBitmap;
begin
 FImagePaint := TBitmap.Create;
 FImagePaint.Width := PaintBox1.Width;
 FImagePaint.Height := PaintBox1.Height;
 with FImagePaint.Canvas do
 begin
   Brush.Color := clWhite;
   Brush.Style := bsSolid;
   Pen.Color := clBlack;
   Rectangle(0, 0, FImagePaint.Width, FImagePaint.Height);
 end;
 with FImagePaint do
   //BitBlt(PaintBox1.Canvas.Handle, 0 ,0, Width, Height, 
Canvas.Handle, 0,0, SRCCOPY);
   StretchMaskBlt(PaintBox1.Canvas.Handle, 0 ,0, Width, Height, 
Canvas.Handle, 0,0,Width, Height,0,0,0,0);

 FImagePaint.Free;
end;


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Graphics dont work

2007-08-28 Thread Luiz Americo Pereira Camara

wile64 wrote:

example :

FImagePaint is a TBitmap create with
FImagePaint := TBitmap.Create;


Try to define the height and width of the bitmap


Luiz


  with FImagePaint.Canvas do
  begin
Brush.Color := BackColor;
Brush.Style := bsSolid;
Pen.Color := clGray;
Rectangle(0, 0, self.Width, self.Height);
  end;

and paint a form with Canvas.Draw(0, 0, FImagePaint);

Thanks,

2007/8/28, Luiz Americo Pereira Camara < [EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>>:


Marc Weustink wrote:
> wile64 wrote:
>> Hello,
>>
>> I create an bitmap and draw with functions RoundRect, Rectangle,
>> FillRect, TextRect, Ellipse, CopyRect.
>>
>> After install snapshot Lazarus-0.9.23-fpc-2.0.4-20070827 dont
work in
>> win32, work in gtk and gtk2.
>> with Lazarus-0.9.23-fpc-2.0.4-20070809 work ok...
>
> :(
> This might be caused by the fix for 9501. I knew the original code
> fixed something, ANyway I'll have a look.

I dont think the problem is with the fix, unless if he is calling
CreateBitmap directly (probably he is using TBitmap). An example
is welcome.

WidgetSet.CreateBitmap, which was changed, is not used in LCL and
TBitmap uses RawImage functions that in your time uses
CreateDIBSection

Probably related to bug 9512

Luiz

_
 To unsubscribe: mail [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives
<http://www.lazarus.freepascal.org/mailarchives>




--
Laurent.

My Web : http://wile64.neuf.fr/ <http://wile64.neuf.fr/>
French Forum : http://lazforum-fr.tuxfamily.org/index.php 


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Graphics dont work

2007-08-28 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:

wile64 wrote:

Hello,

I create an bitmap and draw with functions RoundRect, Rectangle, 
FillRect, TextRect, Ellipse, CopyRect.


After install snapshot Lazarus-0.9.23-fpc-2.0.4-20070827 dont work in 
win32, work in gtk and gtk2.

with Lazarus-0.9.23-fpc-2.0.4-20070809 work ok...


:(
This might be caused by the fix for 9501. I knew the original code 
fixed something, ANyway I'll have a look.


I dont think the problem is with the fix, unless if he is calling 
CreateBitmap directly (probably he is using TBitmap). An example is welcome.


WidgetSet.CreateBitmap, which was changed, is not used in LCL and 
TBitmap uses RawImage functions that in your time uses CreateDIBSection


Probably related to bug 9512

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Broken SVN

2007-08-26 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:

Luiz Americo Pereira Camara wrote:

Christian U. wrote:
TLazInfImage dont support AutoCreateMask anymore in actual SVN wich 
breaks the Virtualtrees Support.


Also no transparency works in any Lazarus Image Type


I can confirm this.
I reported two bugs: 9501 and 9502


9501 is fixed in r11865.
This fix might have some sideeffect when drawing on a 32bpp bitmap.


Under Delphi and win32, CreateBitmap is used mainly for monochrome 
bitmaps (although is possible to create color bitmaps with it, the 
recommended functions are CreateCompatibleBitmap and CreateDIBSection). 
So no loss here, is a know limitation.


9502 is due to wrong detection of common contols version. When you add 
a manifest, yuor images will be drawn transparent.



Also the Build Lazarus dialog is broken


We (Vincent, Paul and I) cannot reproduce that, do you have a 
screenshot ?

Yes,  the radio buttons are not show.

Also i noticed that the identifier completion list is blank, when you 
scroll you can see some itens



Using fpc 214, XP SP2, lazarus svn 11865. Compiled with comand line 
(make clean all)


Luiz




<>

Re: [lazarus] Merged: Image Alpha and Imagelist support

2007-08-25 Thread Luiz Americo Pereira Camara

Marc Weustink wrote:

Hi,

finally r11861, after some weeks of merging (i'm not sur if I do 
it again this way) 


Hi,

Did you look at bugs 8550 and 8814 ? They are still not fixed.


In 8814 (Bitmap Pattern Brushes) i uploaded a patch with the recent svn 
changes


In 8550 (Create a Bitmap with  predefined bits), CreateBitmap tries to 
load the data directly into a PixBuf but this uses a different format 
leading to the error message. Is necessary to do the same conversion 
that is done in RawImage_CreateBitmaps


Anyway, thanks for the work.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Broken SVN

2007-08-25 Thread Luiz Americo Pereira Camara

Christian U. wrote:
TLazInfImage dont support AutoCreateMask anymore in actual SVN wich 
breaks the Virtualtrees Support.


Also no transparency works in any Lazarus Image Type


I can confirm this.
I reported two bugs: 9501 and 9502

Also the Build Lazarus dialog is broken

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Problem developing TCustomLabel descendant (and change proposition)

2007-08-16 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

On Tue, 07 Aug 2007 14:12:19 -0300
Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:

  
As a change to a properly implementation i would propose to add a 
virtual method (DoMeasureTextPosition) to retrieve the TextLeft and 
TextTop values (see TCustomLabel.Paint). The default implementation

is equal to the current code in .Paint (I simplified a bit assuming
that R.Top and R.Left = 0, R.Bottom = Height)

The patch is attached.



Thanks. Applied.

  


Thanks for applying, Mattias.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Release of two new controls (TToggleLabel, TMenuButton)

2007-08-12 Thread Luiz Americo Pereira Camara

Today i released two open source LCL controls:

TToggleLabel: a label that can switch between two states with visual 
feedback (similar to what gtk has)
TMenuButton: a SpeedButton that integrates with a PopupMenu. I found 
similar controls in Firefox, Eclipse based apps (RSSOwl beta), camtasia 
studio


Screencast: http://www.geocities.com/camara_luiz/luicontrolsdemo.zip
More Info: http://wiki.lazarus.freepascal.org/Lui_Controls
Download: https://luipack.bountysource.com/

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Problems with TListView (Win32)

2007-08-04 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

Razvan Adrian Bogdan wrote:

I feel ListView isn't completed (other controls have issues too but
not that much), at least under gtk i get warnings about things, i was
wondering if VirtualTreeView might do the job, last time i checked it
had painting issues, like header not being painted. 


Try the version found in https://luipack.bountysource.com/. These 
problems are solved.


it's possible to mimetic a TListView setting some properties. See the 
dataarray demo or the grid example of the advanced demo. The later is 
found only in svn.


For owner draw examples see objects and images demos

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Problems with TListView (Win32)

2007-08-04 Thread Luiz Americo Pereira Camara

Razvan Adrian Bogdan wrote:

I feel ListView isn't completed (other controls have issues too but
not that much), at least under gtk i get warnings about things, i was
wondering if VirtualTreeView might do the job, last time i checked it
had painting issues, like header not being painted. 


Try the version found in https://luipack.bountysource.com/. These 
problems are solved.


it's possible to mimetic a TListView setting some properties. See the 
dataarray demo or the grid example of the advanced demo. The later is 
found only in svn.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Working on my components again

2007-07-21 Thread Luiz Americo Pereira Camara

Tony Maro wrote:
I got a Google Alert that said someone was having trouble finding my 
components for Lazarus.  I changed my blog software and never finished 
migrating all my old links over.


I've just thrown up the first page that posts my tmpack of components:

http://tony.maro.net/ossramblings/tmpack.php

It's been slightly modified since the old version, mostly to be 
compatible with the latest Lazarus.  I have _not_ tested every 
component under the latest Lazarus yet, so there may be issues.


I'll be putting up the rest of my stuff soon.  The original files are 
all still there, but there's no links on my site for downloading them yet.



Hi, congratulations.

As a suggestion it would be fine if you put your components in 
Lazarus-CCR svn repository 
(http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/ ) 
or other svn repository. This help to keep track of the progress.


Luiz


_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Unicode support and fonts

2007-07-16 Thread Luiz Americo Pereira Camara

Felipe Monteiro de Carvalho wrote:

On 7/16/07, ik <[EMAIL PROTECTED]> wrote:

Have you set the font family to unicode ?
Default font families are usually latin1 (or your system setting).


And how can I set that? (never heard about this)
Use the Font dialog component to select a font and set its return value 
to the Font property of the control.


You must have a unicode font installed. I know MS Unicode arial that 
comes with office 2003, but there also some ones free. Search in google


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Working with XML: crosscompatibility

2007-07-04 Thread Luiz Americo Pereira Camara

Alvise Nicoletti wrote:

Luiz Americo Pereira Camara ha scritto:

Alvise Nicoletti wrote:

Hi...

I have to parse xml both with Lazarus on linux (server) and Delphi 
on Windows (client).


Actually, with Lazarus, I'm using the DOM, ReadXML, WriteXML units.

Is there something that I can use in Delphi with the same code? Or, 
otherwise, is there some XML component compatible for both Delphi 
and Lazarus?




Some time ago i ported the fpc dom unit to delphi. It was just a 
matter of changing the places of const sections, no change was made 
at all, if i remenber well. I can send to you but is a bit outdated. 
A better option is to try to compile the most recent fpc dom version, 
probably will be easy.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives




Hi, can you give me some tips about that cross compilation thing ?



It seems is not more necessary. See Sergei message.
Just get the source from svn or fpc 2.1.4 and compile the units with Delphi

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Virtual Treeview port preview release

2007-07-01 Thread Luiz Americo Pereira Camara

zeljko wrote:

On Sunday 01 July 2007 13:56, Luiz Americo Pereira Camara wrote:
  

Today i released a preview release of the new port of Virtual Treeview
based in version 4.5.1 for those that want to test it.

For info about the port, how install, know issues see
https://luipack.bountysource.com/wiki/virtualtreeview .

Feel free to do bug reports.



what is exactly missing in qt interface to get qt port useable ? 
  
1) implement some functions of delphicompat unit (LCL extensions 
package) in qt. The utf-16 function (*W) should be pretty simple.  
GetBkColor, GetCurrentObject also should be simple. KillTimer and 
SetTimer can take more work. Anyway you can base on what is done in gtk. 
Others are really not necessary for basic work


2) test. i don't have a qt4 environment setup

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Virtual Treeview port preview release

2007-07-01 Thread Luiz Americo Pereira Camara
Today i released a preview release of the new port of Virtual Treeview 
based in version 4.5.1 for those that want to test it.


For info about the port, how install, know issues see 
https://luipack.bountysource.com/wiki/virtualtreeview .


Feel free to do bug reports.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Working with XML: crosscompatibility

2007-06-28 Thread Luiz Americo Pereira Camara

Alvise Nicoletti wrote:

Hi...

I have to parse xml both with Lazarus on linux (server) and Delphi on 
Windows (client).


Actually, with Lazarus, I'm using the DOM, ReadXML, WriteXML units.

Is there something that I can use in Delphi with the same code? Or, 
otherwise, is there some XML component compatible for both Delphi and 
Lazarus?




Some time ago i ported the fpc dom unit to delphi. It was just a matter 
of changing the places of const sections, no change was made at all, if 
i remenber well. I can send to you but is a bit outdated. A better 
option is to try to compile the most recent fpc dom version, probably 
will be easy.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Combo.OnClick

2007-06-18 Thread Luiz Americo Pereira Camara

Joao Morais wrote:
OnClick doesn't mean exactly a click, you have OnMouseDown to 
accompish this. OnClick means that the user sent information to the 
control, and this doesn't happen when he open a combo (not usually).


Did you tried OnSelect?

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] win32 snapshots with gdb 6.6

2007-06-18 Thread Luiz Americo Pereira Camara

Vincent Snijders wrote:

Hi,

I want to inform you that since a couple of days, the lazarus snapshots come 
with gdb 6.6 instead of gdb 6.0.
  


Are you using the binary found in 
http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82724&release_id=190586 
?


I use the svn and would like to know if i am using the same binary as 
the snapshot/releases.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Useless code in win32intf?

2007-06-18 Thread Luiz Americo Pereira Camara
Maybe i missed something but what's the meaning of the following code, 
found in win32callback.inc:710


if lWinControl.ClassName = 'TPairSplitter' then
P := P;


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] sqlite components

2007-06-14 Thread Luiz Americo Pereira Camara

Luca Olivetti wrote:

En/na Luiz Americo Pereira Camara ha escrit:


See as a balance between features/code size.


Sure, that's a good trade off. One has just to know the peculiarities 
of this dataset and where it diverges from the standard dataset 
behaviour (btw: why did you implement a method RefetchData instead of 
using Refresh?)
It has a different meaning. The problem is the lack of documentation. I 
already started the documentation but is not finished yet.




Anyway, for more featured, you can use ZeosLib which is by far the 
most complete database layer in fpc or even SqlitePass that has more 
options.


No, I'm actually after something rather lightweight (I won't be using 
dbgrids, I won't even have a user interface), so for this project I'll 
probably use sqlite3ds now that I know what are its strengths and 
weaknesses.

Besides, zeoslib has a nasty memory leak with sqlite.

It seems that the leak is with all backends and a specific fpc version 
does not leak as i read in a fpc list post


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] sqlite components

2007-06-12 Thread Luiz Americo Pereira Camara

Luca Olivetti wrote:

En/na Luiz Americo Pereira Camara ha escrit:

- ApplyUpdates error handling: Error is handled just does not follows 
the exception model. Check if ApplyUpdates is false. If so check 
ReturnCode (see sqlite docs for values) and ReturnString values.


I understand and appreciate the KISS concept, but that's not the 
behaviour I would expect from a dataset descendant.
Your approach is good enough only when you're controlling completely 
data access in code (which is most of the times, but not always, the 
correct thing to do), if you just want to write a quick'n'dirty data 
entry application where you just wire up a datasource with, e.g., a db 
grid and let the tool kit take care of the rest, with the exception 
model the user at least get a meaningful error message, with your 
implementation of ApplyUpdates the error is silently ignored and the 
data is still visible on the dbgrid.
And even if you check the result of ApplyUpdates, if there are more 
than 400 changes and the error only occurs in the first transaction I 
think it will be silently ignored.

This is a flaw and will be fixed.

Raising an exception would not help here since the data would still be 
there (in the grid).


- Primary key handling: sqliteds automatically handles primary key in 
two ways. First add a AutoInc field to the table (Using 
FieldDefs.Add/CreateTable) and sqliteds will ensure it will always be 
unique and not null without user intervention. Second, if you have a 
integer field as primary key set AutoIncrementKey to true and 
PrimaryKey to the field name.


Ok, I didn't set AutoIncrementKey to true. Now I tried it and the 
result is that I cannot edit the key in the dbgrid, I suppose that if 
I want to allow manual insertion of a primary case I have to manage 
that by myself.
Another test I did, is to leave AutoIncrementKey to false and try to 
deliberately insert a duplicate of the primary key. Even if I check 
the result of ApplyUpdates and use it to display a message, the 
"wrong" rows are still visible in the dbgrid, then subsequent updates 
succeed (without writing the data, since the dataset forgot about  the 
changes) and the wrong data is still visible in the grid. Ok, I can 
refetch the
Just call Delete in AfterPost. Or in TField.OnChange change the field 
value to one that you want or call Cancel (the last is not sure if will 
work).

data in case of errors, but that's not really KISS anymore.
You must agree that you are not following KISS philosophy in your 
program (maybe a requirement). How it is cover the most common user 
cases and let the corner cases to the developer creativity.


See as a balance between features/code size.

Anyway, for more featured, you can use ZeosLib which is by far the most 
complete database layer in fpc or even SqlitePass that has more options.


Luiz





_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] sqlite components

2007-06-11 Thread Luiz Americo Pereira Camara

Luca Olivetti wrote:

Hello,
I'm writing an embedded application that will need a small database 
(no more than a couple thousand records), and  I though sqlite could 
do it.
It probably won't have any graphical interface, so I don't need all 
the goodies of a TDataset descendant, OTOH I like some other things a 
dataset will buy me.
Needless to say, the application must be rock solid, running 
unattended 24/7.
I made a quick test with the sqlite3ds component that's included in 
lazarus and with SQLitePass http://source.online.free.fr/
I dropped either dataset in a form with a datasource and a dbgrid (as 
suggested in the wiki).
My first impression (and as every first impression may just be wrong) 
is tha sqlite3ds doesn't work well with a dbgrid, because it doesn't 
automatically update the underlying database and so it doesn't catches 
exceptions when you, e.g, try to insert a duplicate. What's worse, 
when I call ApplyUpdates it silently discards the data (I would have 
expected at least an exception, but I see that there's no exception 
raised and neither an event is called in case of errors in 
TCustomSqliteDataset.ApplyUpdates).

The behavior is by design (follows KISS philosophy).

- Update on post: sqliteds keeps the records in memory, works with them 
(add,update,delete) and than send the changes to the database when the 
user decides (more or less like sqldb). To update the database each time 
a change occurs add ApplyUpdates in the OnPost event.


- ApplyUpdates error handling: Error is handled just does not follows 
the exception model. Check if ApplyUpdates is false. If so check 
ReturnCode (see sqlite docs for values) and ReturnString values.


- Primary key handling: sqliteds automatically handles primary key in 
two ways. First add a AutoInc field to the table (Using 
FieldDefs.Add/CreateTable) and sqliteds will ensure it will always be 
unique and not null without user intervention. Second, if you have a 
integer field as primary key set AutoIncrementKey to true and PrimaryKey 
to the field name.

If the primary key is not integer the user must handle it yourself.
SQLitePass seems more solid (again, only with this simple test), since 
it automatically updates the database and raises an exception 
immediately if I try to insert a duplicate key. OTOH it raises a 
RunError(204) when I close the form.


Pros of sqlite3ds:
- included in lazarus
- author active on this mailing list
- ...?

Cons of sqlite3ds:
- incomplete (?) implementation

Sure.

- doesn't really check errors

See above.

- ...?

- Undocumented features (to be fixed soon)

PS: I would recommend version from fpc 214 which has a lot of bug fixes.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Store a utf-16 file in a lazarus resource file

2007-05-25 Thread Luiz Americo Pereira Camara

Paul Ishenin wrote:

Luiz Americo Pereira Camara wrote:
I want to store a utf-16 encoded file in a Lazarus resource file and 
than load  as a Stream.


I already did the first step (create the lrs file with lazres) now i 
want to load the file in a stream.

Does someone know how i can do that?


maybe so:

function GetResourceStream(ResourceName: String): TStream;
var
  Res: TLResource;
begin
  Res := LazarusResources.Find(ResourceName);
  if (Res <> nil) and (Res.Value <> '') then
  begin
Result := TMemoryStream.Create;
ResultWrite(Res.Value[1], length(Res.Value));
ResultPosition := 0;
  end;
end;


Thanks.

Its working

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Store a utf-16 file in a lazarus resource file

2007-05-24 Thread Luiz Americo Pereira Camara
I want to store a utf-16 encoded file in a Lazarus resource file and 
than load  as a Stream.


I already did the first step (create the lrs file with lazres) now i 
want to load the file in a stream.

Does someone know how i can do that?

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] ANN: Release of ATBinHex port

2007-05-19 Thread Luiz Americo Pereira Camara

Today i released the first version of ATBinHex LCL port.

ATBinHex (see original component 
http://atorg.net.ru/delphi/atbinhex.htm) is a viewer that can be view a 
file in Ansi, Binary, HEX and Unicode (UTF-16LE) modes.


More info and download at https://luipack.bountysource.com/

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Printer.Canvas.TextStyle.Alignment=taRightJustify => Argument can't be assigned to

2007-05-16 Thread Luiz Americo Pereira Camara

Burkhard Carstens wrote:

Am Mittwoch, 16. Mai 2007 16:35 schrieb fedorax:
  

Hello,

I just make a new svn update and i've a little problem:

using:
Printer.Canvas.TextStyle.Alignment=taRightJustify;
return this error:
cheques.pas(210,35) Error: Argument can't be assigned to

Did something change or is it a bug ?



This is not a bug. It is caused by a change in fpc. Assignments to 
fields of structured properties are not allowed anymore (since r7250). 
e.g.: 
property prop : trec read frec; 
instance.prop.a:=5;
  

I hope this will be optional at least

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: Object Inspector crash, and other interesting stuff

2007-05-16 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

Mattias Gaertner wrote:



I have tested this more thoroughly now. I have just had a complete
crash of IDE after bringing up the colors list in the OI and
scrolling from the last in the list (upon opening) to the first. The
screen froze momentarily and then the IDE closed.



Hmm. This works here.
  

Here also i got this same problem

Using kubuntu feist + fpc204 + recent svn

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: Object Inspector crash, and other interesting stuff

2007-05-16 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:



I have tested this more thoroughly now. I have just had a complete
crash of IDE after bringing up the colors list in the OI and
scrolling from the last in the list (upon opening) to the first. The
screen froze momentarily and then the IDE closed.



Hmm. This works here.
  

Here also i got this same problem

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] execute multiple sql statements

2007-05-14 Thread Luiz Americo Pereira Camara

tanila wrote:

hello all,
is it possible to execute multiple sql statement with TSQLite3Dataset ?
I tried to create a sqlite database with multiple tables.
The SQL File looks like this:

create table if not exists users
(USR_ID integer auto_increment primary key,
 USR_NAME VARCHAR(30) not null,
 USR_SURENAME VARCHAR(30) not null,
 USR_HEIGHT integer not null,
 USR_SEX varchar(1) not null,
 USR_BIRTHDATE date not null);

create table if not exists groups
(GRP_ID integer auto_increment primary key,
 GRP_NAME VARCHAR(30) not null);

create table if not exists activities
(ACT_ID integer auto_increment primary key,
 ACT_NAME VARCHAR(30) not null);

Only the first table has been created.
Do I have to create every table seperately ?
  
No. You can use the SQLList property (a TStringList). You can do 
something like:


 Sqlite3Dataset.SqlList.Clear;
 Sqlite3Dataset.SqlList.Add('Sql1');
 Sqlite3Dataset.SqlList.Add('Sql2');
 Sqlite3Dataset.ExecSqlList;

if the script is in a file do

 Sqlite3Dataset.SqlList.LoadFromFile('x');
 Sqlite3Dataset.ExecSqlList;

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Possible typo in GTKDialogRealizeCB

2007-04-13 Thread Luiz Americo Pereira Camara

Vincent Snijders wrote:

Felipe Monteiro de Carvalho schreef:

On 4/13/07, Vincent Snijders <[EMAIL PROTECTED]> wrote:

I haven't looked at the code, but sometimes this constructs are used to
suppress 'parameter Data not used' hints.


Is supressing a hint really that important that we need useless code?



Use svn blame to see who committed that code and ask the question to 
that persion.


Most of the code were committed by Mattias. Seeing the amount of such 
code i understand why it was done. In the other side makes the code bigger.


I added a feature wish to fpc bug tracker ( 
http://www.freepascal.org/mantis/view.php?id=8690 ), so maybe in the 
future this code can be removed.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Possible typo in GTKDialogRealizeCB

2007-04-13 Thread Luiz Americo Pereira Camara

Vincent Snijders wrote:

Luiz Americo Pereira Camara schreef:

In the cited function (gtkcallback.inc) there's a dead code:

 if (Data=nil) then ;   


I haven't looked at the code, but sometimes this constructs are used 
to suppress 'parameter Data not used' hints.


You are right. Such code is everywhere in this unit.

The long term solution would be a fpc option or directive to disable 
such hints.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Possible typo in GTKDialogRealizeCB

2007-04-12 Thread Luiz Americo Pereira Camara

In the cited function (gtkcallback.inc) there's a dead code:

 if (Data=nil) then ;


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] History of the widget set design?

2007-04-02 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

An example of a widgetset that looks good is eLiquid from Pixel editor.
In this interview ( 
http://www.linuxinterviews.com/index.php?option=com_content&task=view&id=14&Itemid=2 
) the Pixel developer considered Open Source eLiquid. The main concern 
was documentation. If this occurs would be of great value to fpc/Lazarus 
community.


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] History of the widget set design?

2007-04-02 Thread Luiz Americo Pereira Camara

Micha Nelissen wrote:

Burkhard Carstens wrote:
  
However, with win32/gtk LCL this is even worse... seems like one never 
knows, whether an event was fired before or after ..



These are all bugs. The developer interface should be as consistent as
possible, yet the look and feel for the user as native as possible.
Problem is that the order of events is not documented (since they are
delphi internals), and we should do this as we go along; this requires
some discipline however.

The wiki could be a good place to store these events plus their
relationship to programmer and user actions. It would make porting to a
new platform a lot easier as well.

  
I agree that documenting the LCL behavior is a good thing and could 
improve the Lazarus quality. As a example if a Delphi feature  is not 
doable in LCL, just document  and show an alternative (like done for 
TBitmap.Scanline).


Another point is defining the set of features/controls provided by LCL:

- Is necessary TCListBox?
- Is already deprecated in GTK and TListView fills the function 
with advantages

- Is necessary TPairSplitter?
   - AFAIK it was introduced only because TSplitter was not available
   - It could be implemented as a package
- Should non visual code like *CriticalSection functions be in LCL?
  - SyncObjs already exists and can be used in a more elegant way
  - Imagine the pain to implement them in a crossplatform widgetset 
like QT, fpGUI, or even GTK2?


Removing the unnecessary, duplicate functions/components, not doable 
features would help in the development and maintenance of Lazarus, not 
to say the code size.


Of course this could not be done immediately, would be something after a 
1.0 release with 2.0 in mind.



Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] History of the widget set design?

2007-04-02 Thread Luiz Americo Pereira Camara

Graeme Geldenhuys wrote:

On 4/2/07, Burkhard Carstens <[EMAIL PROTECTED]> wrote:

hmm, I prefer a ugly but working solution over a potentially beautifull
but unusabel (from programmes pov) one.


Dito


Of course consistently working native widget bindings would be the best,
but as said before, fpGUI can be ported quickly and easily. It might
even serve as reference, how/when events should occour ..


Exactly. All events, plus everything alse will be in the widget set's
full control.  Not to mention much less code layers and a lot smaller
3rd Party library dependencies!


A interesting point is that popular apps, even Microsoft ones, like 
Windows Media Player, Windows Messenger, Firefox, WinAmp do not have the 
native look. They are written with another toolkit, or use custom draw 
controls.


An example of a widgetset that looks good is eLiquid from Pixel editor.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Document editing (doc, rtf) and/or interfacing with external editors

2007-03-29 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

Razvan Adrian Bogdan wrote:

On 3/29/07, Florian Klaempfl <[EMAIL PROTECTED]> wrote:

Razvan Adrian Bogdan schrieb:
> Win only is enough for now but Lazarus doesn't support ActiveX (COM)

It does?


Florian i don't understand what you mean, does Laz have an ActiveX
importer of some sort that i don't know of ?
It's possible to use ActiveX under windows using fpc/Lazarus. I have 
an example app that does OLE drag and drop.


Some remarks:
 - Unlike Delphi, Lazarus does not provides ActiveX components so you 
have to import then at hand, using the ole32 functions (found in 
ActiveX unit)
 - The ActiveX unit that comes with fpc204 has wrong calling 
convention. Fixed in trunk/2.2
You should be aware of some differences to Delphi unit also. See: 
http://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg07205.html


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Document editing (doc, rtf) and/or interfacing with external editors

2007-03-29 Thread Luiz Americo Pereira Camara

Razvan Adrian Bogdan wrote:

On 3/29/07, Florian Klaempfl <[EMAIL PROTECTED]> wrote:

Razvan Adrian Bogdan schrieb:
> Win only is enough for now but Lazarus doesn't support ActiveX (COM)

It does?


Florian i don't understand what you mean, does Laz have an ActiveX
importer of some sort that i don't know of ?
It's possible to use ActiveX under windows using fpc/Lazarus. I have an 
example app that does OLE drag and drop.


Some remarks:
 - Unlike Delphi, Lazarus does not provides ActiveX components so you 
have to import then at hand, using the ole32 functions (found in ActiveX 
unit)
 - The ActiveX unit that comes with fpc204 has wrong calling 
convention. Fixed in trunk/2.2


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] AllocateHWnd

2007-03-14 Thread Luiz Americo Pereira Camara

Vincent Snijders wrote:

Felipe Monteiro de Carvalho schreef:

On 3/13/07, Luiz Americo Pereira Camara <[EMAIL PROTECTED]> wrote:
Just one tip maybe would be better to dereference PMethod after 
assigned

check in the Callback proc


Ok, didn´t think about it.

Reattaching the patch, which this fixed. Now I tested with both nil
and non-nil methods.



IMHO Self.SetWindowLong is not so nice looking, SetWindowLong looks 
better.


To be on the safe side, I would always call SetWindowLong for 
GWL_USERDATA, if the method is nil, you can decide if you want to set 
it to 0 (nil) or to PMethod pointer referencing a nil method.



I would suggest this too.

In the current implementation would be 0.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] AllocateHWnd

2007-03-13 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

Felipe Monteiro de Carvalho wrote:

Forgot to attach the patch =)

Just one tip maybe would be better to dereference PMethod after 
assigned check in the Callback proc


 Method := PMethod^; //-> if PMethod is nil there would be problems

 if Assigned(PMethod) then
   Method(Msg)

Did you tested passing Method as nil in AllocateHwnd ? In this case you 
can get an access violation here, since PMethod would point to nil.

Maybe was a typo and you mean Assigned(Method) instead of Assigned(PMethod)?

In this case the code below does not make sense

Luiz


as alternative you can skip one assignment (Method copy):

// Method := PMethod^; delete this
 if Assigned(PMethod) then
   PMethod^(Msg)

PS: not tested.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives



_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] AllocateHWnd

2007-03-13 Thread Luiz Americo Pereira Camara

Vincent Snijders wrote:

One thing I noted is that on Delphi, the WndProc will normally have a
call to DefWindowProc, and this is obviously Windows only. So, to keep
compatibility with Delphi, every WndProc used with AllocateHWnd would
need to have a IFDEF Windows, with a call to DefWindowProc inside.


Why? I think you have called DefWindowProc already in 
CallbackAllocateHWnd.

No, he is calling DefWindowProc only when Pmethod  is not assigned

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] AllocateHWnd

2007-03-13 Thread Luiz Americo Pereira Camara

Felipe Monteiro de Carvalho wrote:

Forgot to attach the patch =)

Just one tip maybe would be better to dereference PMethod after assigned 
check in the Callback proc


 Method := PMethod^; //-> if PMethod is nil there would be problems

 if Assigned(PMethod) then
   Method(Msg)


as alternative you can skip one assignment (Method copy):

// Method := PMethod^; delete this
 if Assigned(PMethod) then
   PMethod^(Msg)

PS: not tested.

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Code Readability [Was: Patch - Small Cleanup and Possible bug]

2007-03-10 Thread Luiz Americo Pereira Camara

Luiz Americo Pereira Camara wrote:

Mattias Gaertner wrote:

Probably should be like that:

 aStyle := gtk_widget_get_style(Widget);
 if aStyle=nil then
 begin
 aStyle := GetStyle(lgsButton);
 If aStyle = nil then
   aStyle := GetStyle(lgsGTK_Default);
end;



Applied for readability.
  

Thanks.

Speaking in readability, another thing that should be done is to 
follow a unique coding style for Lazarus source. Different 
capitalizations of reserved words (if, var etc), same times in the 
same code, is the most frequent issue. In the wiki points that we 
should follow the Borland Coding Styles but there's no link at all.


I found two: http://dn.codegear.com/article/10280 (original)  
http://homepages.borland.com/jedi/jvcl/StyleGuide.htm (jvcl)

I added the original to the wiki.

Maybe we can discuss here at least a minimum denominator so who 
contributes new or revised code can follow it

To be more precise, define some critical points here like:

- Capitalization of reserved words
- space between = <> < > :=
- Capitalization of nil
- Capitalization of functions and variables

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Patch - Small Cleanup and Possible bug

2007-03-10 Thread Luiz Americo Pereira Camara

Mattias Gaertner wrote:

Probably should be like that:

 aStyle := gtk_widget_get_style(Widget);
 if aStyle=nil then
 begin
 aStyle := GetStyle(lgsButton);
 If aStyle = nil then
   aStyle := GetStyle(lgsGTK_Default);
end;



Applied for readability.
  

Thanks.

Speaking in readability, another thing that should be done is to follow 
a unique coding style for Lazarus source. Different capitalizations of 
reserved words (if, var etc), same times in the same code, is the most 
frequent issue. In the wiki points that we should follow the Borland 
Coding Styles but there's no link at all.


I found two: http://dn.codegear.com/article/10280 (original)  
http://homepages.borland.com/jedi/jvcl/StyleGuide.htm (jvcl)

I added the original to the wiki.

Maybe we can discuss here at least a minimum denominator so who 
contributes new or revised code can follow it


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Patch - Small Cleanup and Possible bug

2007-03-06 Thread Luiz Americo Pereira Camara

Sergei Gorelkin wrote:

Tuesday, March 06, 2007, 10:14:10 PM, Luiz wrote:

LAPC> Vincent Snijders wrote:
  

Luiz Americo Pereira Camara schreef:
  

1 - Attached patch remove some redundant checks in gtk intf.

2 - Some lines above (in TGtkWidgetSet.DrawFrameControl)  there's 
this code:


  aStyle := gtk_widget_get_style(Widget);
   if aStyle=nil then
 aStyle := GetStyle(lgsButton);
   If aStyle = nil then
  aStyle := GetStyle(lgsGTK_Default);


aStyle is checked for nil twice. Maybe a typo. I would suggest 
something like that (based in what the other code does - not sure if 
is the correct sequence):


   if gtk_widget_get_style(Widget) = nil then
 aStyle := GetStyle(lgsButton)
  else
  aStyle := GetStyle(lgsGTK_Default);


There is an important difference:
Are you sure that GetStyle(lgsButton) always returns a non-nil value?
The code  below would be the equivalent without redundant checks.

if gtk_widget_get_style(Widget) = nil then
  begin
 aStyle := GetStyle(lgsButton)
 If aStyle = nil then
aStyle := GetStyle(lgsGTK_Default);
  end;
  
LAPC> I was assuming the second check was aStyle <> nil just like in DrawCheck 
LAPC> (maybe the DrawCheck should be modified to behave like DrawButtonPush? 
LAPC> or the contrary?). Assuming that is a equal check you are correct.


LAPC> PS: I dont know what is the correct sequence. I just could not resist 
LAPC> and refactored the code. (Note that the second point is not in the patch 
LAPC> and that the changes in the patch does not alter the code flow - be 
LAPC> buggy or not ;-))


LAPC> Luiz

Umm... It looks like the proposed change is even more significant. The
original code may be interpreted like this:
"Try to use individual style assigned to the widget;
if that fails, use the default style for buttons;
if even that fails, use GTK default style for any widget".

Both versions of modified code, however, completely ignore widget's individual
style and always use a default style - for either button or for any widget.
  
You are correct. The pretext i used was wrong (I assumed there was a 
typo - and maybe the typo is in DrawCheck code). See above.


Probably should be like that:

aStyle := gtk_widget_get_style(Widget);
if aStyle=nil then
begin
aStyle := GetStyle(lgsButton);
If aStyle = nil then
  aStyle := GetStyle(lgsGTK_Default);
end;

Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Patch - Small Cleanup and Possible bug

2007-03-06 Thread Luiz Americo Pereira Camara

Vincent Snijders wrote:

Luiz Americo Pereira Camara schreef:

1 - Attached patch remove some redundant checks in gtk intf.

2 - Some lines above (in TGtkWidgetSet.DrawFrameControl)  there's 
this code:


  aStyle := gtk_widget_get_style(Widget);
   if aStyle=nil then
 aStyle := GetStyle(lgsButton);
   If aStyle = nil then
  aStyle := GetStyle(lgsGTK_Default);


aStyle is checked for nil twice. Maybe a typo. I would suggest 
something like that (based in what the other code does - not sure if 
is the correct sequence):


   if gtk_widget_get_style(Widget) = nil then
 aStyle := GetStyle(lgsButton)
  else
  aStyle := GetStyle(lgsGTK_Default);


There is an important difference:
Are you sure that GetStyle(lgsButton) always returns a non-nil value?
The code  below would be the equivalent without redundant checks.

if gtk_widget_get_style(Widget) = nil then
  begin
 aStyle := GetStyle(lgsButton)
 If aStyle = nil then
aStyle := GetStyle(lgsGTK_Default);
  end;
I was assuming the second check was aStyle <> nil just like in DrawCheck 
(maybe the DrawCheck should be modified to behave like DrawButtonPush? 
or the contrary?). Assuming that is a equal check you are correct.


PS: I dont know what is the correct sequence. I just could not resist 
and refactored the code. (Note that the second point is not in the patch 
and that the changes in the patch does not alter the code flow - be 
buggy or not ;-))


Luiz

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


  1   2   >