[Lazarus] Mapping Cairo pixmap to FPC Bitmap and back

2014-09-21 Thread Giuliano Colla
Could anyone more knowledgeable than me point me in the right direction 
to find how a Cairo pixmap maps into a FPC Bitmap, and possibly to some 
existing code for doing the trick of converting from the one to the 
other, thus saving me hours of searching?


Thanks in advance for any hint.

Giuliano


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


Re: [Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Leonardo M. Ramé

On 21/09/14 16:54, Werner Pamler wrote:

To convert image coordinates (pixels within the chart rectangle which
you, indeed, can obtain from the global mouse position converted to the
local chart pixels) to "graph" coordinates you call the chart methods

* "XImageToGraph(x:Integer): Double" for x coordinates,
* "YImageToGraph(y:Integer): Double" for y coordinates, or
* "ImageToGraph(P:TPoint): TDoublePoint" (for both).

(or XGraphToImage() etc for the other direction).

If you do not use axis transformations, then graph coordinates directly
refer to the units of your data. If, on the other hand, axis
transformations are involved (logarithmic axes, multiple axes etc) the
values on the axes may be different from the graph units used in an
internal coordinate system. In this case, you have to link the series to
the axis (by means of the AxisIndexX and AxisIndexY properties) and call
the GraphToAxis or AxisToGraph methods of the AxisTransformation which
is obtained from the method GetTransform of the axis. In your example of
y values the transformation chain would be

   mouse point yi --> graph coords by yg := Chart.YImageToGraph(yi) -->
axis coords by ya := Chart.LeftAxis.GetTransform.GraphToAxis(yg).

Here, ya refers to your input data, yi to the pixel data.

But since you don't use transformations YImageToGraph is sufficient.




Great!, here's a screenshot.

Meanwhile I found a way to get the Y pixel value of a point, as you can 
see, the "19.60" with yellow background refers to the last point in my 
series, and is drawn exactly at the same position of the Close Y Point. 
For this I used GetYImgValue( Index of last point ) of the series.


--
Leonardo M. Ramé
http://leonardorame.blogspot.com
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Werner Pamler
To convert image coordinates (pixels within the chart rectangle which 
you, indeed, can obtain from the global mouse position converted to the 
local chart pixels) to "graph" coordinates you call the chart methods


* "XImageToGraph(x:Integer): Double" for x coordinates,
* "YImageToGraph(y:Integer): Double" for y coordinates, or
* "ImageToGraph(P:TPoint): TDoublePoint" (for both).

(or XGraphToImage() etc for the other direction).

If you do not use axis transformations, then graph coordinates directly 
refer to the units of your data. If, on the other hand, axis 
transformations are involved (logarithmic axes, multiple axes etc) the 
values on the axes may be different from the graph units used in an 
internal coordinate system. In this case, you have to link the series to 
the axis (by means of the AxisIndexX and AxisIndexY properties) and call 
the GraphToAxis or AxisToGraph methods of the AxisTransformation which 
is obtained from the method GetTransform of the axis. In your example of 
y values the transformation chain would be


  mouse point yi --> graph coords by yg := Chart.YImageToGraph(yi) -->  
axis coords by ya := Chart.LeftAxis.GetTransform.GraphToAxis(yg).


Here, ya refers to your input data, yi to the pixel data.

But since you don't use transformations YImageToGraph is sufficient.


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


[Lazarus] [Patch] - Menu Designer Drag/Drop Reordering

2014-09-21 Thread Michael Thompson
G'day,

I've submitted a patch for reordering menu items in the designer using
drag/drop.  Tested under Win32, but only by me.

http://bugs.freepascal.org/view.php?id=8733

Requires the minor TArrow fixes discussed earlier...
http://bugs.freepascal.org/view.php?id=26756

Feedback/ideas/bugs welcomed - either here, direct or on tracker...

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


Re: [Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Leonardo M. Ramé

On 21/09/14 11:56, Werner Pamler wrote:

Hi, I'm playing with the DataPointCrossHairTool, and I would like to
know if it's possible to display the horizontal line on cursor's
position, instead as the default data point value.


Not 100% sure, but I believe that this tool always snaps to the data
points.
An alternative would be to add a constant line series to the chart and use
a TDatapointDragTool to drag the line. Use the chart's MouseDown to show
and
the MouseUp to hide the line. The "toolsdemo" in TAChart's demo folder
is an
example of the basic idea (the green and purple dashed vertical lines).


--


I kind of got what I need, based on Mouse.CursorPos and 
TAChart.ScreenToClient.


Now, I need to convert the mouse pos to a relative value to the axis.

In the AfterDrawBackWall event, to get current Y cursos position, I have:

ASender.ScreenToClient(Mouse.CursorPos).Y

Now, how can I convert that value to its relative to axis value.

Please, take a look at the attached screenshot, in the bottom chart, you 
can see the cursor and an horizontal line, with its value at the rigth 
axis, in this case is a 64 (yellow bold) between 3.50 and 4.00, instead 
of 64 I want to display the correct value (approx. 3.95).



--
Leonardo M. Ramé
http://leonardorame.blogspot.com
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Werner Pamler

Hi, I'm playing with the DataPointCrossHairTool, and I would like to
know if it's possible to display the horizontal line on cursor's
position, instead as the default data point value.


Not 100% sure, but I believe that this tool always snaps to the data points.
An alternative would be to add a constant line series to the chart and use
a TDatapointDragTool to drag the line. Use the chart's MouseDown to show and
the MouseUp to hide the line. The "toolsdemo" in TAChart's demo folder is an
example of the basic idea (the green and purple dashed vertical lines).


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


Re: [Lazarus] TArrow Drag Drop functionality

2014-09-21 Thread Michael Thompson
> Just open an issue (feature) about it and I'll fix it asap (add missing
events).
> zeljko

Thanks for the offer.  I've created the issue, and attached a patch as well
if you like...
http://bugs.freepascal.org/view.php?id=26756

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


[Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Leonardo M. Ramé
Hi, I'm playing with the DataPointCrossHairTool, and I would like to 
know if it's possible to display the horizontal line on cursor's 
position, instead as the default data point value.


If mean, for example, my points are:

1: 10
2: 20
3: 30

When the mouse cursor is between 20 and 10, say 13 for example, the 
default behavior is displaying a line at 10 or 20, but what if I want to 
display the line just at 13?.



Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [Lazarus] TArrow Drag Drop functionality

2014-09-21 Thread zeljko

On 09/21/2014 04:01 PM, Michael Thompson wrote:

G'day,

Does anyone know why TArrow.OnDragDrop/OnDragOver/OnEndDrag/OnStartDrag
were commented out in lcl\arrow.pp?

I'm working on menu editor drag/drop rearranging.  As part of this I
uncommented the above.  All is working well, but you know that nagging
thought at the back of your mind?   It's telling me that just maybe they
were commented out for a reason...


Just open an issue (feature) about it and I'll fix it asap (add missing 
events).


zeljko


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


[Lazarus] TArrow Drag Drop functionality

2014-09-21 Thread Michael Thompson
G'day,

Does anyone know why TArrow.OnDragDrop/OnDragOver/OnEndDrag/OnStartDrag
were commented out in lcl\arrow.pp?

I'm working on menu editor drag/drop rearranging.  As part of this I
uncommented the above.  All is working well, but you know that nagging
thought at the back of your mind?   It's telling me that just maybe they
were commented out for a reason...

Ta

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


Re: [Lazarus] Hint as text over TAChart

2014-09-21 Thread Leonardo M. Ramé

On 21/09/14 07:25, Werner Pamler wrote:

The most general way: Use the CurrentExtent of the chart, it is in
"graph coorinates", though, and you have to convert it to pixels yourself:

uses
   TAChartUtils;

procedure TForm1.Button1Click(Sender: TObject);
var
   ext: TDoubleRect;
begin
   ext := Chart1.CurrentExtent;
   Label1.Caption := Format('Left = %d, Top = %d, Right = %d, Bottom =
%d', [
 Chart1.XGraphToImage(ext.a.x),   // "a" is the lower left corner
 Chart1.YGraphToImage(ext.b.y),   // "b" is the upper right corner
 Chart1.XGraphToImage(ext.b.x),
 Chart1.YGraphtoImage(ext.a.y)
   ]);
end;

Or you could catch one of the events OnBeforeDrawBackwall or
OnAfterDrawBackwall which are fired during the painting process and
contain the rectangle enclosed by the axis lines as a parameter; simply
store that Rect for later usage.



Great!, I used the onAfterDrawBackwll's rect.


--
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


[Lazarus] TAchart frame left and top values

2014-09-21 Thread Werner Pamler

Sorry - my answer is in the other thread...

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


Re: [Lazarus] Eye Candy Controls 0.1.11 - screenshots

2014-09-21 Thread Vojtěch Čihák

Here are screenshots:
 
http://s26.postimg.org/fsed8fxxl/ECSlider_Qt.png
http://s26.postimg.org/g7pn1gjux/ECCWine.png
http://s26.postimg.org/k5cwqv6o9/Scheme_Designer_Qt.png
http://s26.postimg.org/kw5mwn91l/Scheme_Descendant_GTk.png 
http://s26.postimg.org/ib0294jnt/ECScale_Demo_Qt.png 
 
Vojtěch 
__

Od: Bernd 
Komu: Lazarus mailing list 
Datum: 21.09.2014 12:09
Předmět: Re: [Lazarus] Eye Candy Controls 0.1.11


Can you please upload some screenshots somewhere?


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



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


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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-21 Thread Bart
On 9/21/14, Giuliano Colla  wrote:

> Yes. That's the problem. e.g. you put the mouse on the first visible
> Icon, and you get the hint of the first Icon of the original window
> (before scrolling)
> [..]
...
> Yes. Should we open a bugtracker issue?

Yes we should.
I already have a listView example somewhere on my Linux VM, so when I
have time i'll do so.


> I know that Qt in itself provides a Qt_Listview, which should emulate
> Windows listview, but I don't know to what extent it's currently exploited.

I find it hard to beleive that the native QT implementatiosn does not
provide some method to allow more than one l;ne...


> In the meantime, did you give a look to my implementation of the graph
> window?
I did have a look at your code.
It looked impressive, but at the time I already implemented the
ListView approach.

> It doesn't exploit ListView, but it provides the same final result. It
> only lacks a better arrangement of Icons, but it's a rather trivial
> matter (after creating all of them, find the maximum width, then use
> this value to arrange them neatly).

Because all the drawing and all calculations need to be done by
ourselves, I decided to use a "standard" LCL control that is
_supposed_ to do all that just by itself.
This way we keep re-inventing the wheel.

> It might be a way to get more
> quickly a result, unless you want to take this occasion to try and fix
> ListView.

Maybe the current state of things (and the fact we show how awkward
the results can look) will trigger people in fixing the TListView on
GTK2 and QT.

Bart

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


[Lazarus] Hint as text over TAChart

2014-09-21 Thread Werner Pamler
The most general way: Use the CurrentExtent of the chart, it is in 
"graph coorinates", though, and you have to convert it to pixels yourself:


uses
  TAChartUtils;

procedure TForm1.Button1Click(Sender: TObject);
var
  ext: TDoubleRect;
begin
  ext := Chart1.CurrentExtent;
  Label1.Caption := Format('Left = %d, Top = %d, Right = %d, Bottom = 
%d', [

Chart1.XGraphToImage(ext.a.x),   // "a" is the lower left corner
Chart1.YGraphToImage(ext.b.y),   // "b" is the upper right corner
Chart1.XGraphToImage(ext.b.x),
Chart1.YGraphtoImage(ext.a.y)
  ]);
end;

Or you could catch one of the events OnBeforeDrawBackwall or 
OnAfterDrawBackwall which are fired during the painting process and 
contain the rectangle enclosed by the axis lines as a parameter; simply 
store that Rect for later usage.


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


Re: [Lazarus] Pochecker (was Fuzzy traslations ignored)

2014-09-21 Thread Giuliano Colla


Il 21/09/2014 00:27, Bart ha scritto:
[..]


You mean, you scroll, then put the mouse over an icon and wait for the
hitn, and the hint is the wrong one?


Yes. That's the problem. e.g. you put the mouse on the first visible 
Icon, and you get the hint of the first Icon of the original window 
(before scrolling)

[..]

It would mean that this part:
   pt:= listview.ScreenToClient( mouse.cursorpos );
   item := listview.GetItemAt( pt.x, pt.y );
does not function properly unde GTK2

Yes. Should we open a bugtracker issue?

With Qt no change: Icons are too small,

I tested QT-Linux, and IIRC the icons were the same size as on GTK2


all items in one row,

Yes, that sucks.
Do you know if QT interface has a native ListView, or how is the drawin done?
I know that Qt in itself provides a Qt_Listview, which should emulate 
Windows listview, but I don't know to what extent it's currently exploited.

But, Qt is somehow optional (even if IMHO Qt widgetset is
better and more complete than Gtk2) and we may live with it, if you
manage to make it work with Gtk2.

Many seem to prefer QT on Linux over GTK2 (visually more attractive?).


I'm among them. Not only more attractive, but also significantly less buggy.

Currently I'm trying to put some order in canvas drawing, because it 
would appear that each function and each widgetset has its own ideas of 
what the painting rectangle should be :-( , creating a mess if you want 
to have an ellipse inscribed in a rectangle, a pie slice into an 
ellipse, etc. and, in the process I'm trying to see if we may get a 
decent antialiasing for shapes and not only for fonts.


As soon as I'll have some time I'll give a look to the ListView 
implementation in Gtk2 and Qt, if nobody else is willing to do it.


In the meantime, did you give a look to my implementation of the graph 
window?
It doesn't exploit ListView, but it provides the same final result. It 
only lacks a better arrangement of Icons, but it's a rather trivial 
matter (after creating all of them, find the maximum width, then use 
this value to arrange them neatly). It might be a way to get more 
quickly a result, unless you want to take this occasion to try and fix 
ListView.


Giuliano


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


Re: [Lazarus] Eye Candy Controls 0.1.11

2014-09-21 Thread Bernd
Can you please upload some screenshots somewhere?

2014-09-21 11:48 GMT+02:00 Vojtěch Čihák :
> Hello,
>
> I'd like to announce new version of Eye-Candy Controls. I keep conservative 
> numbering, so version is 0.1.11 but they are stable, at least on LCL-Qt 
> (where I developed them). I had some problems with debugging under Wine but I 
> guess it is related to Wine rather than ECC.
>
> It is a set of visual components based on Themes. Contains ruler, 
> position-bar, image menu and visually atractive alternatives to TTrackBar, 
> TProgressBar, TCheckBox, TRadioGroup, TCheckGroup, TSpeedButton, TEditButton, 
> TColorEdit, TFloatSpinEdit and TUpDown with some extra options.
>
> News:
> License changed to modified LGPL
> TECScheme - new visual component for various configurations
> TBaseScrollControl - new abstract class for managing scrollbars (TECScheme is 
> derived from it)
> TECSpeedBtn - now supports multiline Caption
> and more small improvements, see CHANGELOG.txt.
> Note (for those who do not have Lazarus - SVN and install ECC for the first 
> time):
>
> ECControls requires following change in control.pp:
> these two methods must be virtual:
> line ~722 procedure GetSpaceAround(var SpaceAround: TRect); virtual;
>
> line ~724 function GetSpace(Kind: TAnchorKind): Integer; virtual;
>
> This is done in Lazarus trunk r.44805.
> That's all. Without it will package not compile.
> No matter if you have stable Lazarus (1.2) or trunk (1.3).
> No matter if you have stable FPC (2.6.4) or trunk (2.7.1)
> (but there were some patches to fpdoc which are not in 2.6.4,
>  so if you want to create html docs via attached script, you need 2.7.1).
>
> You can download preferably from SourceForge: 
> http://sourceforge.net/projects/eccontrols/files/
> or alternatively from MediaFire: https://www.mediafire.com/#3odj0y75aogy8
>
> There are five archives now:
> ECC.zip - Eye Candy Control package
> ECC-Demo.zip - demo that shows possibilities of ECC (except TECScheme)
> ECScale-Demo.zip - demo that shows how to use TECScale inyour own components
> SchemeDesigner.zip - tool for designing of TECScheme (don't forget to try to 
> attached demo.xml)
> ECSchemeDesc.zip - simple demo that shows how to create a visual component 
> derived from TECScheme (overridden painting routines etc.)
> Note: I tested them on Qt, GTK2 and Win32 (Win). I never tried with Carbon. 
> Feedback from Carbon testers is welcome.
>
> Thank you and have a nice day.
>
> Vojtěch
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

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


[Lazarus] Eye Candy Controls 0.1.11

2014-09-21 Thread Vojtěch Čihák
Hello,

I'd like to announce new version of Eye-Candy Controls. I keep conservative 
numbering, so version is 0.1.11 but they are stable, at least on LCL-Qt (where 
I developed them). I had some problems with debugging under Wine but I guess it 
is related to Wine rather than ECC.

It is a set of visual components based on Themes. Contains ruler, position-bar, 
image menu and visually atractive alternatives to TTrackBar, TProgressBar, 
TCheckBox, TRadioGroup, TCheckGroup, TSpeedButton, TEditButton, TColorEdit, 
TFloatSpinEdit and TUpDown with some extra options.

News:
License changed to modified LGPL
TECScheme - new visual component for various configurations
TBaseScrollControl - new abstract class for managing scrollbars (TECScheme is 
derived from it)
TECSpeedBtn - now supports multiline Caption
and more small improvements, see CHANGELOG.txt. 
Note (for those who do not have Lazarus - SVN and install ECC for the first 
time):

ECControls requires following change in control.pp:
these two methods must be virtual:
line ~722 procedure GetSpaceAround(var SpaceAround: TRect); virtual;

line ~724 function GetSpace(Kind: TAnchorKind): Integer; virtual;

This is done in Lazarus trunk r.44805.
That's all. Without it will package not compile.
No matter if you have stable Lazarus (1.2) or trunk (1.3).
No matter if you have stable FPC (2.6.4) or trunk (2.7.1)
(but there were some patches to fpdoc which are not in 2.6.4,
 so if you want to create html docs via attached script, you need 2.7.1).

You can download preferably from SourceForge: 
http://sourceforge.net/projects/eccontrols/files/
or alternatively from MediaFire: https://www.mediafire.com/#3odj0y75aogy8

There are five archives now:
ECC.zip - Eye Candy Control package
ECC-Demo.zip - demo that shows possibilities of ECC (except TECScheme)
ECScale-Demo.zip - demo that shows how to use TECScale inyour own components
SchemeDesigner.zip - tool for designing of TECScheme (don't forget to try to 
attached demo.xml)
ECSchemeDesc.zip - simple demo that shows how to create a visual component 
derived from TECScheme (overridden painting routines etc.)
Note: I tested them on Qt, GTK2 and Win32 (Win). I never tried with Carbon. 
Feedback from Carbon testers is welcome.

Thank you and have a nice day.
 
Vojtěch 
 

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