Re: [Lazarus] Feature Request: more intelligent code completion

2017-01-30 Thread Ondrej Pokorny via Lazarus
Ctrl+Shift+X is a new feature for upcoming 1.8: 
http://wiki.freepascal.org/Lazarus_1.8.0_release_notes


It cannot create properties - neither in the current class nor in a 
different class.


It's a rather easy feature to add because CodeTools already have 
everything that is needed for it. The "most complex" thing is the dialog 
- the user needs to choose Getters/Setters and maybe also the ancestor 
class where to put the property.


A handy feature indeed.

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


Re: [Lazarus] Feature Request: more intelligent code completion

2017-01-30 Thread Graeme Geldenhuys via Lazarus
On 2017-01-30 11:47, Mattias Gaertner via Lazarus wrote:
> 
> It did correctly deduce the datatype Boolean, did it not?

Yes it did.


> The only missing thing is to place it at the right place,

Indeed. The code I wrote was "BuildProject.Verbose := ...", so it should
query the data type of the BuildProject object, and make the class
completion suggestion for that class.


> There are currently two code completions: the interactive Ctrl+Shift+X
> and the non interactive Ctrl+Shift+C.
> In this case you almost always wants the interactive version.

Ah, so we learn something new. I didn't know about the interactive one.
I also see Lazarus v1.3 didn't have that functionality - I guess I need
to update that development VM with a newer Lazarus.


> And this dialog needs to be extended with options for what to create
> (in which class, a var or a property, what kind of property).

Yes. I just tried the interactive code completion now - just to see what
it does. It created a public variable bit in the wrong class. It didn't
use the BuildProject object, but rather the class I was in. So in this
case the generated code also didn't make any sense of leave code that is
actually compilable.


> It is a half implemented feature.

Indeed, it seems the functionality is almost there.


>> I can file this as a feature request on Mantis if need be.
> 
> Yes, please.

Reported as

  http://mantis.freepascal.org/view.php?id=31299


Thanks Mattias.


Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Feature Request: more intelligent code completion

2017-01-30 Thread Graeme Geldenhuys via Lazarus
On 2017-01-30 11:37, Michael Van Canneyt wrote:
> I'm not sure that I want the IDE to modify another class than the one I am
> working in at the moment, when I press "code completion" ?

Well, then maybe introduce another action - an intermediate step that
the developer must confirm.

Again, Eclipse does this very nicely. It gives a error icon in the
gutter (the icon can change to a hint icon for other functionality like
possible refactoring suggestions etc). If you click the icon, it
presents a list of actions (a keyboard shortcut will show that list as
well, so you are not forced to use the mouse).

Then simply pick the "Create property in class XYZ..." option. Eclipse
goes even further and shows you another window next to the popup window
of how the generated code snippet will look like - but this is obviously
not needed for Lazarus IDE.

I know Eclipse has a massive developer team (compared to Lazarus), and
Lazarus can't compete with the amount of features Eclipse has. But
allowing Lazarus to generate code that is not even compilable is not
acceptable - its a big let down.


And as I mentioned, this feature is a massive advantage in Test Driven
Development, where you often write the API (method) calls first, then
implement them afterwards to resolve the compilation error.

Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Feature Request: more intelligent code completion

2017-01-30 Thread Mattias Gaertner via Lazarus
On Mon, 30 Jan 2017 12:37:16 +0100 (CET)
Michael Van Canneyt via Lazarus  wrote:

>[...]
> > Now the BuildProject class doesn't have a Verbose property. The
> > TBuildDelphiProjects class does have a FVerbose field of type boolean.
> > So the data type of FVerbose is known, so to deduce what the missing
> > property "Verbose"'s data type should be is known (or should be known).  
> 
> I'm not sure that I want the IDE to modify another class than the one I am
> working in at the moment, when I press "code completion" ?

+1
Only the interactive code completion should do that.

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


Re: [Lazarus] Feature Request: more intelligent code completion

2017-01-30 Thread Mattias Gaertner via Lazarus
On Mon, 30 Jan 2017 11:09:19 +
Graeme Geldenhuys via Lazarus  wrote:

>[...]
> Now the BuildProject class doesn't have a Verbose property. The
> TBuildDelphiProjects class does have a FVerbose field of type boolean.
> So the data type of FVerbose is known, so to deduce what the missing
> property "Verbose"'s data type should be is known (or should be known).

It did correctly deduce the datatype Boolean, did it not?
The only missing thing is to place it at the right place, somewhere in
TBuildDelphiProjects or its ancestors. Since this is not yet
implemented you have to do that manually. 

 
>[...]
> It would have been a lot more logical, and to actually generate
> compilable code, if Lazarus prompted me (user configurable) to say that
> it wants to implement the missing property "Verbose" for the object
> BuildProject (of type TBuildProject).

There are currently two code completions: the interactive Ctrl+Shift+X
and the non interactive Ctrl+Shift+C.
In this case you almost always wants the interactive version.
And this dialog needs to be extended with options for what to create
(in which class, a var or a property, what kind of property).


>[...] 
> Lazarus (v1.3 and v1.7) generated the same code as show above, and
> neither is compilable afterwards! So I don't know what Lazarus was
> trying to achieve by introducing that local Verbose: boolean variable.

It is a half implemented feature.

 
>[...]
> I can file this as a feature request on Mantis if need be.

Yes, please.

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


Re: [Lazarus] Feature Request: more intelligent code completion

2017-01-30 Thread Michael Van Canneyt via Lazarus



On Mon, 30 Jan 2017, Graeme Geldenhuys via Lazarus wrote:


Hi,

I've using the Eclipse IDE for a while now, and the developer is really
spoilt with intelligent code/class completion. I'm wondering if Lazarus
IDE could benefit of some of those features too.

For example - improved (more intelligent) code completion.

I have this code:

==
procedure TBuildDelphiProjects.DoRun;
var
 lProjDirName: string;
 lDefFile: string; // global defaults INI file
 lFullProjFile: string;
begin
 CaseSensitiveOptions:=True;

 if HasOption('h','help') then
   WriteHelp(0)
 else if not HasOption('p','project') then
   WriteHelp(1)
 else
 begin
   FVerbose := HasOption('V','verbose');
   BuildProject.Verbose := FVerbose;//  <-- I just typed this.
==


Now the BuildProject class doesn't have a Verbose property. The
TBuildDelphiProjects class does have a FVerbose field of type boolean.
So the data type of FVerbose is known, so to deduce what the missing
property "Verbose"'s data type should be is known (or should be known).


I'm not sure that I want the IDE to modify another class than the one I am
working in at the moment, when I press "code completion" ?


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


Re: [Lazarus] Running an app on boot

2017-01-30 Thread Michael Schnell via Lazarus

On 25.01.2017 11:40, Ed Murashie via Lazarus wrote:

No matter what I try I get “ Gtk-WARNING **: cannot open display: “.  
This also happen on a Beaglebone


What am I doing wrong and how can I fix it?


Do you *want* a GUI ?

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


[Lazarus] Feature Request: more intelligent code completion

2017-01-30 Thread Graeme Geldenhuys via Lazarus
Hi,

I've using the Eclipse IDE for a while now, and the developer is really
spoilt with intelligent code/class completion. I'm wondering if Lazarus
IDE could benefit of some of those features too.

For example - improved (more intelligent) code completion.

I have this code:

==
procedure TBuildDelphiProjects.DoRun;
var
  lProjDirName: string;
  lDefFile: string; // global defaults INI file
  lFullProjFile: string;
begin
  CaseSensitiveOptions:=True;

  if HasOption('h','help') then
WriteHelp(0)
  else if not HasOption('p','project') then
WriteHelp(1)
  else
  begin
FVerbose := HasOption('V','verbose');
BuildProject.Verbose := FVerbose;//  <-- I just typed this.
==


Now the BuildProject class doesn't have a Verbose property. The
TBuildDelphiProjects class does have a FVerbose field of type boolean.
So the data type of FVerbose is known, so to deduce what the missing
property "Verbose"'s data type should be is known (or should be known).

Now if I press Ctrl+Shift+C to code/class complete, Lazarus generates
the following, which has no relevance to what I typed! It doesn't even
solve the compiler error problem.

===
procedure TBuildDelphiProjects.DoRun;
var
  lProjDirName: string;
  lDefFile: string; // global defaults INI file
  lFullProjFile: string;
  Verbose: Boolean;  //  < Lazarus inserted this???
begin
  CaseSensitiveOptions:=True;

  if HasOption('h','help') then
WriteHelp(0)
  else if not HasOption('p','project') then
WriteHelp(1)
  else
  begin
FVerbose := HasOption('V','verbose');
BuildProject.Verbose := FVerbose;
===


It would have been a lot more logical, and to actually generate
compilable code, if Lazarus prompted me (user configurable) to say that
it wants to implement the missing property "Verbose" for the object
BuildProject (of type TBuildProject). The property simply needs to ask
what visibility do I want the Verbose property... Public of Published
(as TBuildProject is defined in another unit)?

Lazarus (v1.3 and v1.7) generated the same code as show above, and
neither is compilable afterwards! So I don't know what Lazarus was
trying to achieve by introducing that local Verbose: boolean variable.

This is the compiler output I get when I try to compile my project
before and after the code/class completion was triggered.

  builddelphiprojects.lpr(79,18) Error: identifier idents no member
"Verbose"

After using Eclipse for some time now, such shortcuts for the developer
is a massive time saver. It also works fantastically well if you do Test
Driven Development. I'm sure Lazarus IDE could benefit from such code
completion improvements too.

I can file this as a feature request on Mantis if need be.

Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] SVG Editor or Viewer

2017-01-30 Thread Graeme Geldenhuys via Lazarus
On 2017-01-30 04:39, Lars via Lazarus wrote:
> Does anyone know of any Lazarus projects or code that views SVG files...

As Adrian mentioned, AggPas (native Pascal port of Anti-Grain Geometry)
supports SVG and an example is included. fpGUI's repository includes the
most up to date (features and bug fixes) implementation of AggPas (that
I know of). Lazarus also includes a copy, but it is older that the fpGUI
one. And as Adrian mentioned, there is a heavily refactored one called
AggPasMod, but I have no idea in what state it is or what bug fixes it
had applied to it.

AggPas included with fpGUI gets used daily, so I know it works.

Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] SVG Editor or Viewer

2017-01-30 Thread Adrian Veith via Lazarus
Hi, there is the Anti Grain Geometry for Pascal - in the examples there
is a smal svgtest - maybe this helps.

https://github.com/CWBudde/AggPasMod

Adrian.


Am 30.01.2017 um 05:39 schrieb Lars via Lazarus:
> Does anyone know of any Lazarus projects or code that views SVG files...
>
> I remember there was some graphics editing program written in lazarus
> (multiple images not just svg format) and I think it was closed source.
>
> Or any delphi svg editors (that could potentially be converted to lazarus)?
>
> Or mseide (unlikely, and that would be off topic)
>
> Thanks

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


Re: [Lazarus] SVG Editor or Viewer

2017-01-30 Thread Lars via Lazarus
On Sun, January 29, 2017 11:37 pm, Sandro Cumerlato wrote:
> Hello Lars,
> I think you are talking about LazPaint: https://github.com/bgrabitmap
>
>

This is a great program, loads up super fast.

Just what I needed. I did try this before AFAIR but forgot.

But it won't open SVG images... yet Google says it can deal with SVG
related tasks... So I don't get it. It has some support for svg related,
but won't open svg files itself?
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus