Re: [Lazarus] Can't add new form to Lazarus App

2016-09-29 Thread brian via Lazarus
On Fri, 30 Sep 2016 00:38:39 +0300, Maxim Ganetsky wrote:

>29.09.2016 22:26, Terry A. Haimann via Lazarus ?:
>> I created the form by clicking on NewForm and then I tried to rename it
>> from the Object Inspector.  I am running Lazarus 1.2.4  This app has
>
>Lazarus 1.2.4? Is it a joke?
>

This is straying from the point, but anybody who has worked for a
LARGE (probably governmental) bureaucracy is likely to be all too
familiar with being forced to use out-of-date software. Performing
'unapproved' upgrades may well mean disciplinary proceedings. Yes,
I've had to work under those conditions. :(

I completely understand the logic for the Lazarus developers wanting
to know whether a problem can be reproduced with the latest version.
You just have to remember that some people aren't allowed to use that
version, as much as they would like to do so. 


Brian. 
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Can't add new form to Lazarus App

2016-09-29 Thread Maxim Ganetsky via Lazarus

29.09.2016 22:26, Terry A. Haimann via Lazarus пишет:

I created the form by clicking on NewForm and then I tried to rename it
from the Object Inspector.  I am running Lazarus 1.2.4  This app has


Lazarus 1.2.4? Is it a joke?


probably been used by several versions of Lazarus.


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Can't add new form to Lazarus App

2016-09-29 Thread Mattias Gaertner via Lazarus
On Thu, 29 Sep 2016 14:26:02 -0500
"Terry A. Haimann"  wrote:

> On Thu, 2016-09-29 at 13:17 +0200, Mattias Gaertner via Lazarus wrote:
> > On Thu, 29 Sep 2016 05:59:49 -0500
> > "Terry A. Haimann"  wrote:
> >   
> > >[...]  
> > > > What means messed up? It's an empty form, isn't it?
> > > 
> > > The new form and it's source will not compile unless i comment out the:
> > > 
> > > {$I unit1.lrs} 
> > > 
> > > I tried renaming unit1 to the new unit name, but it did not like the lrs
> > > file.  It refused to compile.  
> > 
> > How did you create the form?
> > Can you post the first few lines of the unit1.lrs?
> > 
> > Mattias  
> 
> I created the form by clicking on NewForm and then I tried to rename it
> from the Object Inspector.  I am running Lazarus 1.2.4  This app has
> probably been used by several versions of Lazarus.
> 
> Terry
> 
> 
> It renamed it to the new filename:
> 
> { This is an automatically generated lazarus resource file }
> 
> LazarusResources.Add('TStRschForm','FORMDATA',[
> 
> 'TPF0'#11'TStRschForm'#10'StRschForm'#4'Left'#3#235#0#6'Height'#3#240#0#3'Top'
> 
> +#3#145#0#5'Width'#3#250#2#7'Caption'#6#10'StRschForm'#12'ClientHeight'#3#240
> 
> +#0#11'ClientWidth'#3#250#2#10'LCLVersion'#6#7'1.2.4.0'#0#6'TLabel'#6'Label1'
> 
> +#4'Left'#2#24#6'Height'#2#15#3'Top'#2#30#5'Width'#2#23#7'Caption'#6#4'Test'
>   +#11'ParentColor'#8#0#0#0
> ]);

Ok. So it is *not* an empty form.

Please post the whole unit and the compiler error you get.


Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Can't add new form to Lazarus App

2016-09-29 Thread Terry A. Haimann via Lazarus
On Thu, 2016-09-29 at 13:17 +0200, Mattias Gaertner via Lazarus wrote:
> On Thu, 29 Sep 2016 05:59:49 -0500
> "Terry A. Haimann"  wrote:
> 
> >[...]
> > > What means messed up? It's an empty form, isn't it?  
> > 
> > The new form and it's source will not compile unless i comment out the:
> > 
> > {$I unit1.lrs} 
> > 
> > I tried renaming unit1 to the new unit name, but it did not like the lrs
> > file.  It refused to compile.
> 
> How did you create the form?
> Can you post the first few lines of the unit1.lrs?
> 
> Mattias

I created the form by clicking on NewForm and then I tried to rename it
from the Object Inspector.  I am running Lazarus 1.2.4  This app has
probably been used by several versions of Lazarus.

Terry


It renamed it to the new filename:

{ This is an automatically generated lazarus resource file }

LazarusResources.Add('TStRschForm','FORMDATA',[

'TPF0'#11'TStRschForm'#10'StRschForm'#4'Left'#3#235#0#6'Height'#3#240#0#3'Top'

+#3#145#0#5'Width'#3#250#2#7'Caption'#6#10'StRschForm'#12'ClientHeight'#3#240

+#0#11'ClientWidth'#3#250#2#10'LCLVersion'#6#7'1.2.4.0'#0#6'TLabel'#6'Label1'

+#4'Left'#2#24#6'Height'#2#15#3'Top'#2#30#5'Width'#2#23#7'Caption'#6#4'Test'
  +#11'ParentColor'#8#0#0#0
]);


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


[Lazarus] lazarus 1.6+fpc 2.6.4, win32, crashes in iphtml.pas

2016-09-29 Thread Luca Olivetti via Lazarus

Hello,

I'm playing with lazarus 1.6 (a bit late, I know) with fpc 2.6.4, win32, 
 and I have a strange problem with the ide:
the object inspector information box shows nothing and, eventually, when 
I click on fields in the object inspector, lazarus becomes unresponsive 
and then crashes.
If try to begug the ide under lazarus (tried both with the old 1.4.4 and 
the new 1.6), I see that it crashes in the heap manager (heap.inc) when 
it tries to allocate 1117978624 bytes (!)

This is the call stack:

#0 HANDLEERRORADDRFRAME(-1, 0x7c9201e0, 0x7c91e920) at 
D:\fpc-2.6.4\rtl\inc\system.inc:962

#1 HANDLEERRORFRAME(203, 0x10f6f92c) at D:\fpc-2.6.4\rtl\inc\system.inc:992
#2 HANDLEERROR(203) at D:\fpc-2.6.4\rtl\inc\system.inc:1002
#3 ALLOC_OSCHUNK(0x17619c4, 0, 1117978624) at 
D:\fpc-2.6.4\rtl\inc\heap.inc:833

#4 SYSGETMEM_VAR(1117973760) at D:\fpc-2.6.4\rtl\inc\heap.inc:1006
#5 SYSGETMEM(1117973760) at D:\fpc-2.6.4\rtl\inc\heap.inc:1050
#6 GETMEM(0x1b, 1117973745) at D:\fpc-2.6.4\rtl\inc\heap.inc:251
#7 NEWANSISTRING(1117973736) at D:\fpc-2.6.4\rtl\inc\astrings.inc:64
#8 FPC_TRUELY_ANSISTR_UNIQUE(0xfda683) at 
D:\fpc-2.6.4\rtl\inc\astrings.inc:659

#9 fpc_ansistr_unique at D:\fpc-2.6.4\rtl\i386\i386.inc:1585
#10 UPPERCASE(0xfda683 #255#139'E'#152#137'E'#248#198'E'#224, 0xfda683 
#255#139'E'#152#137'E'#248#198'E'#224) at 
D:\fpc-2.6.4\rtl\objpas\sysutils\sysstr.inc:97

#11 TIPHTML__NEXTTOKEN() at iphtml.pas:5132
#12 TIPHTML__PARSEHEAD(0x154e04c0, ) at 
iphtml.pas:5451

#13 TIPHTML__PARSEHTML() at iphtml.pas:7474
#14 TIPHTML__PARSE() at iphtml.pas:7538
#15 TIPHTML__LOADFROMSTREAM(0x131e14c0, ) at 
iphtml.pas:4725
#16 TLAZIPHTMLCONTROL__SETHTMLCONTENT(0x131e14c0, 0x0, variable>) at ipidehtmlcontrol.pas:368
#17 TMAINIDE__OICHANGEDTIMERTIMER(0x1324fc48, ) 
at main.pp:11811

#18 TCUSTOMTIMER__DOONTIMER() at customtimer.pas:175
#19 TCUSTOMTIMER__TIMER() at customtimer.pas:150
#20 TIMERCALLBACKPROC(0, 275, 20158, 489829657) at 
.\win32\win32callback.inc:2773

#21 USER32!GetDC at :0
#22 ?? at :0

The strange things is the transition between #10 and #11, line 5132 of 
iphtml.pas *doesn't* call uppercase, it is


   ParmName := ParmString

and ParmString is

  function ParmString: string;
  begin
if PBW = 0 then
  Result := ''
else begin
  ParmBuf[PBW] := #0;
  Result := StrPas(ParmBuf);
  PBW := 0;
end;
  end;

Maybe there's a stray pointer somewhere that messes up the stack?
If I uninstall turbopower_ipro I get the plain text information box in 
the object inspector and no crashes.


If I run lazarus directly under gdb, I get a different backtrace (but 
still crashes in TIpHtml.ParseHead):


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 3692.0x340]
fpc_ansistr_decr_ref (S=0xfda682) at D:/fpc-2.6.4/rtl/i386/i386.inc:1542
1542decl(%edx)
(gdb) bt
#0  fpc_ansistr_decr_ref (S=0xfda682) at D:/fpc-2.6.4/rtl/i386/i386.inc:1542
#1  0x10f6f810 in ?? ()
#2  0x00fdb714 in TIPHTML__PARSEHEAD (PARENT=0x13821af0,
this=) at iphtml.pas:5451
#3  0x00fe2865 in TIPHTML__PARSEHTML (this=)
at iphtml.pas:7474
#4  0x00fe2b96 in TIPHTML__PARSE (this=)
at iphtml.pas:7538
#5  0x00fd99fa in TIPHTML__LOADFROMSTREAM (S=0x1388c0c8,
this=) at iphtml.pas:4725
#6  0x01032007 in TLAZIPHTMLCONTROL__SETHTMLCONTENT (STREAM=0x1388c0c8,
NEWURL=0x0, this=) at ipidehtmlcontrol.pas:368
#7  0x00793a62 in DOHTML (parentfp=0x10f6fa84) at idehelpintf.pas:345
#8  0x00793913 in THINTWINDOWMANAGER__SHOWHINT (SCREENPOS=...,
THEHINT=0x14ad8838 'href="lazdoc://lazarus/lazdoc.css" type="text/css">'#13#10'http-equiv="Content-Type" content="text/html; 
charset=utf-8">'#13#10''#13#10' 
'..., this=) at idehelpintf.pas:367

#9  0x00849258 in TSOURCEEDITORHINTWINDOWMANAGER__ACTIVATEHINT (
SCREENRECT=..., ABASEURL=0x138b56c 'lazdoc://',
AHINT=0x14ad8838 'href="lazdoc://lazarus/lazdoc.css" type="text/css">'#13#10'http-equiv="Content-Type" content="text/html; 
charset=utf-8">'#13#10''#13#10' 
'..., AAUTOSHOWN=true, this=)

at sourceeditor.pp:1907
#10 0x0086589b in TSOURCEEDITORMANAGER__ACTIVATEHINT (SCREENRECT=...,
BASEURL=0x138b56c 'lazdoc://',
THEHINT=0x14ad8838 'href="lazdoc://lazaru
s/lazdoc.css" type="text/css">'#13#10'content="t
ext/html; charset=utf-8">'#13#10''#13#10'class="header">  
r>'..., AUTOSHOWN=true, this=)
at sourceeditor.pp:10685
#11 0x0084dbf0 in TSOURCEEDITOR__ACTIVATEHINT (CLIENTRECT=...,
ABASEURL=0x138b56c 'lazdoc://',
AHINT=0x14ad8838 'href="lazdoc://lazarus/
lazdoc.css" type="text/css">'#13#10'content="tex
t/html; charset=utf-8">'#13#10''#13#10' 
 

'..., AAUTOSHOWN=true, this=)
at sourceeditor.pp:3304
#12 0x00470cd8 in TMAINIDE__ONSRCNOTEBOOKSHOWHINTFORSOURCE (
SRCEDIT=0x128142c0, CARETPOS=..., AUTOSHOWN=true,
this=) at main.pp:10818
#13 0x0086074a in TSOURCENOTEBOOK__SHOWSYNEDITHINT (MOUSEPOS=...,
this=) at sourceeditor.pp:8860
#14 0x00849745 in TSOURCEEDITORHINTWINDOWMANAGER__HINTTIMER (
SENDER=0x1337d598, 

Re: [Lazarus] Can't add new form to Lazarus App

2016-09-29 Thread Mattias Gaertner via Lazarus
On Thu, 29 Sep 2016 05:59:49 -0500
"Terry A. Haimann"  wrote:

>[...]
> > What means messed up? It's an empty form, isn't it?  
> 
> The new form and it's source will not compile unless i comment out the:
> 
> {$I unit1.lrs} 
> 
> I tried renaming unit1 to the new unit name, but it did not like the lrs
> file.  It refused to compile.

How did you create the form?
Can you post the first few lines of the unit1.lrs?

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Can't add new form to Lazarus App

2016-09-29 Thread Terry A. Haimann via Lazarus
On Thu, 2016-09-29 at 09:57 +0200, Mattias Gaertner via Lazarus wrote:
> On Wed, 28 Sep 2016 16:49:15 -0500
> "Terry A. Haimann via Lazarus"  wrote:
> 
> > On an old Lazarus app (Linux) today I tried to add a form and got the
> 
> Do you mean add a new empty form or add an existing form? 

A new form.
> 
> > following:
> > 
> > http://www.haimann.us/Images/Test.png
> 
> I recommend to adapt the $mode and $H directive in the main source
> (usually projectname.lpr).
> 
>  
> > After selecting this option, the new form appears messed up.
> 
> What means messed up? It's an empty form, isn't it?

The new form and it's source will not compile unless i comment out the:

{$I unit1.lrs} 

I tried renaming unit1 to the new unit name, but it did not like the lrs
file.  It refused to compile.

> 
> 
> >  At the
> > botton of the unit.pas file the following is displayed:
> > 
> > initialization
> >   {$I unit1.lrs} 
> > 
> > Even after I save the unit under another name.   After compilation when
> > the form is displayed via a show.modal, the form is blank.
> > Is there someway to repair this app
> 
> How do you create the form?
> 
> Mattias


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


[Lazarus] Jpeg Exif reader was: TImage shows loaded image rotated by 90?

2016-09-29 Thread LacaK via Lazarus

Attached improved code.
(as far as there is a lot of Exif tags, not all are parsed and placed in 
FExif record, but all are in FIFD array)

-Laco.


I have created small Exif reader for my own needs.
I have looked also in FCL TFPReaderJpeg (which uses pasjpeg) if there
is
no support, but I do not see.
If there would be interest for extending functionality of this reader
to
support reading of Exif information I can prepare patch.

Here is my simple implementation if somebody is interested:

unit JpegExif;

{$IFDEF FPC}
  {$mode objfpc}
{$ENDIF}
{$H+}

interface

uses
  Classes, SysUtils;

type

  { TJpegExifReader }

  TJpegExifReader = class
private
  type
TIFDEntry = record
  TagNo: Word;
  DataType: Word;
  Count: DWord;
  Value: DWord; // This  tag  records  the  offset  from  the  start  
of  the  TIFF  header  to  the  position  where  the  value  itself  is  
recorded.
// In cases where the value fits in 4 bytes, the value 
itself is recorded. If the value is smaller than 4 bytes, the value is stored 
in the 4-byte area starting from the left, i.e., from the lower end
end;

TExifData = record
  Make,
  Model,
  Software,
  DateTime,
  Artist: string;
  Orientation: smallint;
  XResolution,
  YResolution: double;
  ResolutionUnit: smallint;
  ExposureTime: double;
  FNumber: double;
  ColorSpace: Word;
  ImageUniqueID: string;
end;

  var
FBA: Word;

  function Swap(w: Word): Word; overload;
  function Swap(dw: DWord): DWord; overload;
public
  FIFD: array of TIFDEntry;
  FExif: TExifData;
public
  constructor Create(const FileName: string); overload;
  constructor Create(Stream: TFileStream); overload;

  function Orientation: smallint;
  function XResolution: double;
  function YResolution: double;
  function ResolutionUnit: string;
  function DateTime: TDateTime;
  end;


implementation

{ TJpegExifReader }

function TJpegExifReader.Swap(w: Word): Word;
begin
  if FBA = $4D4D then
// Motorola align: first byte in data is highest byte (big endian)
Result := BEtoN(w)
  else
// Intel align: first byte in data is lowest byte (little endian)
Result := LEtoN(w);
end;
function TJpegExifReader.Swap(dw: DWord): DWord;
begin
  if FBA = $4D4D then
Result := BEtoN(dw)
  else
Result := LEtoN(dw);
end;

constructor TJpegExifReader.Create(const FileName: string);
var
  Stream: TFileStream;
begin
  Stream := TFileStream.Create(FileName, fmOpenRead+fmShareDenyWrite);
  try
Create(Stream);
  finally
Stream.Free;
  end;
end;

constructor TJpegExifReader.Create(Stream: TFileStream);
type
  TRATIONAL=record
numerator: dword;
denominator: dword;
  end;

var
  b: Byte;
  w, Marker, Size: Word;
  dw: DWord;
  i,c: Integer;
  S: AnsiString;
  R: TRATIONAL;
  D: Double;

  function ReadIFD(Offset: DWord): integer;
  var i,j: integer;
  begin
Stream.Position := 12 + Offset;
Stream.Read(w, SizeOf(w)); // No of IFD entries
Dec(Size, 2);
Result := Swap(w);
j := Length(FIFD);
SetLength(FIFD, j+Result);
// Read IFD entries
for i:=j to j+Result-1 do begin
  Stream.Read(FIFD[i], SizeOf(TIFDEntry));
  Dec(Size, SizeOf(TIFDEntry));
  FIFD[i].TagNo:= Swap(FIFD[i].TagNo);
  FIFD[i].DataType := Swap(FIFD[i].DataType);
  FIFD[i].Count:= Swap(FIFD[i].Count);
end;
Stream.Read(dw, SizeOf(dw));   // Offset to next IFD (0=last)
  end;

begin
  inherited Create;

  Stream.Position := 0;
  Stream.Read(w,SizeOf(w));
  if w <> NtoLE($D8FF) then Exit;  // 0-1: Jpeg SOI (Start of image: FFD8)
  Stream.Read(Marker, SizeOf(w));  // 2-3: Application marker
  Stream.Read(Size, SizeOf(Size)); // 4-5: Size of APP1 data area (high 
byte first)
  Size := BEtoN(Size);
  Dec(Size, 2);
  Stream.Read(dw, SizeOf(dw)); // 6-9: 'Exif' of 'JFIF'
  Dec(Size, 4);
  // APP0 (Application marker: FFE0) and 'JFIF'
  if (Marker = NtoLE($E0FF)) and (dw = NtoLE($4649464A)) then
begin
Stream.Read(b, 1); // 10: 0
Stream.Read(w, SizeOf(w)); // 11-12: JFIF version
Stream.Read(b, 1); // 13: Density units (1-in, 2-px)
FExif.ResolutionUnit := b+1;
Stream.Read(w, SizeOf(w)); // 14-15: XDensity
FExif.XResolution := BEtoN(w);
Stream.Read(w, SizeOf(w)); // 16-17: YDensity
FExif.YResolution := BEtoN(w);
end
  // APP1 (Application marker: FFE1) and 'Exif'
  else if (Marker = NtoLE($E1FF)) and (dw = NtoLE($66697845)) then
begin
Stream.Read(w, SizeOf(w));
if w <> NtoLE($) then Exit;// 10-11: 
Dec(Size, 2);
// TIFF header
Stream.Read(FBA, SizeOf(FBA)); // 12-13: byte order
if (FBA<>$4949) and (FBA<>$4D4D) then Exit; // 4949=Intel, 4D4D=Motorola

Re: [Lazarus] TLazIntfImage.Assign ?

2016-09-29 Thread LacaK via Lazarus



IMO it can be removed - obviously there are not any side
effects any more.

Ok, I will remove it ...

Thanks ;-)
-Laco
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TLazIntfImage.Assign ?

2016-09-29 Thread Juha Manninen via Lazarus
On Thu, Sep 29, 2016 at 11:10 AM, Ondrej Pokorny via Lazarus
 wrote:
> It looks like a left-over to me. It happens regularly also to myself during
> refactoring. IMO it can be removed - obviously there are not any side
> effects any more.

Ok, I will remove it ...

Juha
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TLazIntfImage.Assign ?

2016-09-29 Thread Ondrej Pokorny via Lazarus

On 29.09.2016 10:01, Juha Manninen via Lazarus wrote:

On Wed, Sep 28, 2016 at 8:39 AM, LacaK via Lazarus
 wrote:

Why we set Desc.Width and Height to 0 and later we do not use "Desc" , but
"Src.DataDescription" ?

Yes, now the Desc is unused and DataDescription is assigned as is.
What could be the "side effects" mentioned in comments? Is there any
reason to set Width and Height to 0?

I don't know the graph related code well but I can remove the unused
part after getting confirmation from others.


It looks like a left-over to me. It happens regularly also to myself 
during refactoring. IMO it can be removed - obviously there are not any 
side effects any more.


Ondrej
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Can't add new form to Lazarus App

2016-09-29 Thread Mattias Gaertner via Lazarus
On Wed, 28 Sep 2016 16:49:15 -0500
"Terry A. Haimann via Lazarus"  wrote:

> On an old Lazarus app (Linux) today I tried to add a form and got the

Do you mean add a new empty form or add an existing form? 

> following:
> 
> http://www.haimann.us/Images/Test.png

I recommend to adapt the $mode and $H directive in the main source
(usually projectname.lpr).

 
> After selecting this option, the new form appears messed up.

What means messed up? It's an empty form, isn't it?


>  At the
> botton of the unit.pas file the following is displayed:
> 
> initialization
>   {$I unit1.lrs} 
> 
> Even after I save the unit under another name.   After compilation when
> the form is displayed via a show.modal, the form is blank.
> Is there someway to repair this app

How do you create the form?

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Run Parameters Dialog

2016-09-29 Thread Mattias Gaertner via Lazarus
On Wed, 28 Sep 2016 14:19:02 -0600
Lars via Lazarus  wrote:

> On Mon, September 26, 2016 11:55 pm, Juha Manninen via Lazarus wrote:
> > On Tue, Sep 27, 2016 at 8:07 AM, Lars via Lazarus
> >  wrote:
> >  
> >> The designer of Lazarus didn't necessarily need this feature...
> >>  
> >
> > Mattias is the designer of Lazarus. :)
> 
> I thought there were more than one designer and it went through several
> phases of different people coming and going, hence the name Lazarus which
> was revived from the dead, and instead of just one Jesus like person being
> revived it was multiple people which makes it Lazaruses rather than
> Lazarus

Yes.
You asked about "The designer of Lazarus" and "this feature". I added
the IDE macros in general and to the run parameters in particular, so
Juha took the chance to answer in a similar manner. Context sensitive.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus