Lazarus

Programming => Packages and Libraries => Ported from Delphi/Kylix => Topic started by: taazz on July 09, 2013, 06:32:34 pm

Title: Simple Graph Port
Post by: taazz on July 09, 2013, 06:32:34 pm
I was trying to find the original thread that I start posting about the simple graph and I can't find it so I'm creating a new to keep you all informed about the progress.

I have just upload some changes at this point scrolling is fixed and is working here for me on QT, GTK2 and win32. I have disabled the ability to include background images on none win32 widget sets it create a lot of headaches for me and is something I do not need so after everything works as expected I might take an other look at it.

Problems remaining to be solved are
1) On GTK2 and function PtInRegion returns always false for some odd reason that breaks the drag and move abilities of the classes I have patched the rectangularNode to be able to respond correctly so at least I could finish the scrolling debugging the odd thing is that since the text of the classes have their own mouse detection if you give them a caption to show you can use it to move them around.

2) the GraphLink text out needs work, gtk2 and QT do not support some of the text out abilities that windows have and especially the bottom center alignment which is used to place the text on the line. I have no idea how to address this problem I'm thinking to use cairo/pango or aggpas to fake it but if there is an easier way around it I would prefer to take it.

After those 2 problem are solved a first stable release will be made and everything else will be put on a back burner unless a show stopper bug appears.

link : https://sourceforge.net/projects/evssimplegraph/ (https://sourceforge.net/projects/evssimplegraph/)

PS.
The cursors.res has been reworked to avoid invisible on screen cursors I would appreciate some feedback if they work on linux.
Title: Re: Simple Graph Port
Post by: taazz on July 11, 2013, 04:50:39 am
Just committed the corrections for the text placement on the graphlink. Now it should be rotated and follow the line correctly.

I'd appreciate any feed back from interested linux users. How does it work on linux?
Title: Re: Simple Graph Port
Post by: Jurassic Pork on July 12, 2013, 12:10:14 am
hello Taazz,

with your link : https://sourceforge.net/projects/evssimplegraph/ (https://sourceforge.net/projects/evssimplegraph/)

we can load 3rdParty.rar but this file doen't contain simplegraph. We can find inside rkVistaProBar.pas and uevssplitter.pas.

If we browse code section of the link, we can find uevssimplegraph.pas. how to use it ? Project in demo folder doen't compile because uevs components dependancies.
Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 12:38:30 am
I apologize for the inconvenience, I was so much light headed trying to find the region problems that I forgot to clean up afterwards. For starters you can safely remove all the file and forms that require any package other than lcl defaults. They are there by mistake. I will clean up everything and push a new version in the next 20 minutes. I'll try to include a new archive as well but the repo will be cleaned asap.

Let me add that the new version which I will push in the next 20 minutes have corrected all the problems I could see with Graphlink class and is dangerously close to the first stable beta.
The only think that does not work is the damn regions under gtk I would very much like to avoid writing ptInellipse, ptInRoundRect etc function my self, so I'm considering to drop support for GTK2 at this point and reconsider it when the LCL is able to support them especially the PtInRegion function.

Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 01:03:47 am
OK done. You can redownload the simpleGraph_Demo.0.0.2.0.rar which has been replaced with a new clean demo application that will work out of the box or download from the repository both have been cleaned and ready for consumptions.

 :-[ I apologize once more there was no excuse for what happened.
Title: Re: Simple Graph Port
Post by: Jurassic Pork on July 12, 2013, 01:20:24 am
it is better taazz   ;D but :
simplegraph unit is missing (unit UfrmSimpleGraphTest ->uses UEvsSimpleGraph, SimpleGraph;)
if i remove SimpleGraph and  procedure goDblClick2(Graph: TSimpleGraph; GraphObject: TGraphObject) i can compile but :
1 - Project options in demo project is  for QT build debug
2 - try to use win32_debug ( because qt dll error for me on windows 7) : debugger error on start when i launch the program.
Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 01:57:10 am
Thanks for input I've just removed the reference to the simplegraph and pushed a new commit to GIT. I have tested everything on win32 and QT before I pushed my previous commit and even now I do not see any errors. Please keep in mind that all the tests are done on the latest Release version and I haven't tested them on the trunk or patches branches of svn.

What kind of error do you get?
Title: Re: Simple Graph Port
Post by: Jurassic Pork on July 12, 2013, 02:05:03 am
the debugger error  with windows is gone . it was because  i used ui access in project options. i can run now the program.
I have tried the project on Ubuntu 12.04  64 bits gtk2 with GTK2_debug build. It is OK . In Attachments you can see a demo screen capture  when running the program.
Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 02:13:19 am
I see that you build it with GTK2 can you select the objects with simple click and move them around?
Is the speed of redraw while resizing/moving acceptable? In my windows 7 it is awful with gtk2 and I'm puzzled on how to address it.

Thank you for the feed back.

EDIT:

Wend back and enabled the UI access on the project options never paid any attention to its existence up until now. True the debugger goes in to a OOPS state and crashes, so I executed the exe directly from explore and I show the wanderful message of "A Referral was returned from the server" and the application closes. WTF! is that?
Title: Re: Simple Graph Port
Post by: Jurassic Pork on July 12, 2013, 02:35:33 am
speed of  redraw while resizing/moving is acceptable for me (immediate with my cpu Q8300 2.5 Ghz). The only problem that i can see is when i move a graphlink . i can have a staircase ? alias ? effect (sorry english isn't my natural language). Maybe it is a grid problem. See I1 I2 graphlinks in attachments for the problem.
Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 02:55:06 am
Well if I understand correctly, what you describe is the lack of antialised drawing what you see is literaly the pixel line changing from y to y-1, there is not much I can do about the pixel position on screen, I think that QT is already antialised and handles it better. when the first stable version is released I'm going to see what I can do about that problem, I already have a solution in design for windows using GDI+ and its antialised capabilities, but for linux I'll need something else I don't know yet what. I have to find some time to spend on aggpas that comes lazarus and see if I can create a universal solution based on it instead of using platform specific library like GDI+ or Cairo. The final speed and easy of achiving higher speeds will be the deciding factor on this one, and when I say final speed I mean from vector to screen. I do not care to have a really fast from vector to raster and then loose all the speed from raster to screen.

Oh well got carried away sorry for the rant.
Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 05:16:45 am
Just pushed a new commit. It contains some more clean up and a new Class TEvsBezierLink which is a bezier curved link. Be advised that it does not support poly bezier at this point it is only a single curve and you can't add or remove points as you can on the normal links. If you did not know you could then try to ctrl+click on a line to add a point or alt+click to add/remove points. The addition of points hasn't been tested yet, it might not work outside the window coordinates just test it with out any scroll bar visible to be safe.
Title: Re: Simple Graph Port
Post by: BigChimp on July 12, 2013, 10:21:30 am
Thanks for the hard work, Taazz - haven't tested your code but will certainly look into it whenever I need something that needs diagram support.
Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 10:54:41 am
:) thanks. Next step convert the original demo so I can better debug the components stay tuned.
Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 12:49:52 pm
The primary port of the original demo has been push to the repo. It works as it is if you comment out the registerclipboardformat call in the uevssimplegraph's unit initialization section. It currently has eveything enabled but as features are removed (eg zooming) then the corresponding features on the GUI will be removed as well.

Have fun and remember the component is in alpha state, every bug report, feature request helps to form its future.
Title: Re: Simple Graph Port
Post by: Jurassic Pork on July 12, 2013, 04:48:31 pm
hello,
for this problem :
Quote
Wend back and enabled the UI access on the project options never paid any attention to its existence up until now. True the debugger goes in to a OOPS state and crashes, so I executed the exe directly from explore and I show the wanderful message of "A Referral was returned from the server" and the application closes. WTF! is that?

you must never set uiaccess to true except for UI Accessibility Applications. But in this case read this :
Quote
UI Accessibility Applications can bypass UIPI by setting their "uiAccess" value to TRUE as part of their manifest file. This requires the application to be in the Program Files or Windows directory, as well as to be signed by a valid code signing authority.

Friendly, J.P
Title: Re: Simple Graph Port
Post by: taazz on July 12, 2013, 11:42:40 pm
Original Demo cleaned up and pushed on the repo, you can now downloaded from the pre-Release section as well. Next copy/paste.
Title: Re: Simple Graph Port
Post by: taazz on July 14, 2013, 11:27:22 pm
Lots of work the past 2 days. The original demo keeps giving me random errors on the initialization section of the uevssimplegraph.pas unit so I started transforming my debug/demo app to look and act the same as the original demo. A few minor bugs have been corrected. a Major regression of the scroll while dragging abilities has now been fixed. I have a first alpha of a GDI+ Canvas for windows based on the http://www.progdigy.com (http://www.progdigy.com) header translation. Its giving me a lot of headaches at the moment, by the way any one has subclasses the TCotrolCanvas? Any hints on what needs to be preserved or what can be safely overridden? This one I'm not planning to release since it is windows only, so just a heads up nothing to get from the repo.
Only on repo at this time the files section will be updated in the next 20 minutes.

Any ideas what to do with the GTK2 lack of support for the ptInRegion function? Is it something that is not supported from the GDK_Region_XXXXX functions or is it an over-site of LCL?
Title: Re: Simple Graph Port
Post by: taazz on July 15, 2013, 05:58:43 am
New Commit, some cleanup reworked some internals to avoid external sigsegv errors and fixed the background painting, it is now working on all 3 platforms. Repo is up to date and the a new archive at the pre-release section of the files is added. PtInRegion on GTK2 still does not work.
I also uploaded a screen shot with the experimental GDI+ canvas at work.
Title: Re: Simple Graph Port
Post by: taazz on July 15, 2013, 10:22:13 pm
OK. Components have been cleaned up. All calls to API have been changed to canvas calls except some measurement procedures which paint nothing. This will enable us to use any kind of canvas for drawing including svg canvas if any one cares to create one. I have downloaded the lmf files from the bugtracker by Anton Kavalenka which can be used as an intermediate between graph and printer or at least thats the reasoning behind me downloading them. I'm going to push the new version on repo in a few minutes mark it as beta and wait for the community's input before going for a stable release. There are a couple of things I'd like to add but I do not need them in my current development so I'll let you decide what to implement first. So here are the features in no particular order that I'm thinking

1) Printing.
2) Undo.
3) Layers.
4) Zoom.
5) Class Diagram node.
6) Dot language import/export
7) GraphViz layout support.

Re arrange them remove what ever you don't need and post a reply with what you want to see implemented. I wish SF had a poll tool or something.
Title: Re: Simple Graph Port
Post by: taazz on July 16, 2013, 08:51:11 am
New component added to 3rd party folder in repo. It is a ruler component to be used along side with the SimpleGraph requires more work but a preliminary port is ready it now compiles and run with out SIGSEGV or other problems of that type it would be easy from here on to correct some small misbehavior I noticed but I do not care to much about.
Title: Re: Simple Graph Port
Post by: BigChimp on July 16, 2013, 10:04:58 am
Not using the components yet, but I'd think these features could be useful
Interoperability:
1) Dot language import/export
2) GraphViz layout support.
3) Class Diagram node.
4) Printing.
The rest I wouldn't care too much about I'd think:
5) Zoom.
6) Layers.
7) Undo.
Thanks!
Title: Re: Simple Graph Port
Post by: taazz on July 16, 2013, 10:45:41 am
first of all thanks for the feed back. I appreciate it.

Now for printing support, since Lazarus lacks of a proper vector type of TGraphic descendant it will be a pain in the behind with out zoom support. All the windows printing subsystem is depended on metafile for a reason it is easily stretched to cover the difference in DPI between screen and printer. Knowing this I have 2 options either hope that the lcl developers would create something that I can use be it Tmetafile or zoom in the canvas or do it my self. in the second case I can only add zooming to Simple Graph component and if I do that then it would be a simple case to allow on screen zoom as well.

In any case your preference is recorded and the excel poll I'm keeping awaits for more votes.

As a side not I finally decided to post in this thread only for major changes like "printing is now supported" and keep the rest of the rand in a blog at the SF site. I'd hate to be kicked from the forums for noise pollution :P .
Title: Re: Simple Graph Port
Post by: BigChimp on July 16, 2013, 10:52:47 am
Thanks.

(Not knowing anything about printing, canvas etc, so please take the below with a couple of pinches of salt)
Having the Laz devs come up with some general solution of course sounds inviting, but.... if they don't do it, nothing happens ;)
Might be best if you write some proof of concept/demonstration code that works for graph and might be generalized.

Good idea about the blog - interested to read about your adventures.
Title: Re: Simple Graph Port
Post by: taazz on July 16, 2013, 11:06:14 am
Funny thing I was thinking in similar terms not so much of a proof of concept type of project as of a generic canvas that will support world /logical coordinates and will be able to map them correctly on the attached DC be it a bitmap or a window on the screen.

This will help remove some of the new code in the Nodes and links and make them independent from the screen that they have become. I might have some time this weekend to create it. Then it can be used as a proof of concept too, but I am a bit insecure about creating a proposal for the team at this point in time.
Title: Re: Simple Graph Port
Post by: BigChimp on July 16, 2013, 11:18:53 am
I wouldn't be insecure if I were you.

Even if it wouldn't work because of big flaws, presenting the concept and an idea for implementation may serve to inspire the devs to create something usable for your purposes.
You could float your idea on the Lazarus mailing list as well where a lot of Laz devs hang out.
Title: Re: Simple Graph Port
Post by: taazz on July 23, 2013, 08:11:54 am
I now have two canvases that implement my idea in a very simplistic way in the simplegraph component for the most part it works as I expected and then there is this line and lineto methods that can't be overridden that give me headaches at the moment. It only supports shifting the shape to be drawn in X and Y axis at this point.
I have a working theory for zooming as well but it does not work with ellipses and I'm thinking ways around it. All in all the new release has a few good points in it that make it worth downloading.

This will be the last release for a while as I have started a personal project that will require most of my free time, I'll just wait for the community to report bugs or enhancements they might need and if nothing is reported in the next 3 to 6 months I'll correct the 2 bugs I have in my list and release it.
TinyPortal © 2005-2018