Re: [Lazarus] Sparta Docked Formed Editor Removed Without Discussion?

2023-10-16 Thread Anthony Walter via lazarus
Thank for for such a prompt and relevant response. I just noticed from the
GitLab commit comment the alternative was listed right there. To all others
please disregard my original message.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Sparta Docked Formed Editor Removed Without Discussion?

2023-10-16 Thread Anthony Walter via lazarus
I have been happy using Lazarus without rebuilding the IDE from source for
some time but yesterday I finally built a new version from GitLab source
trunk.

I noticed that the Sparta docked form editor was removed and there doesn't
seem to be any discussion here on the subject. Is there an
equivalent package to Sparta that is part of the default component or
designer options that are currently part of the Lazarus source included in
the official GitLab repository?

For those who do not know this is a screen capture of the Lazarus IDE with
the Sparta docker form editor installed.

https://cache.getlazarus.org/images/docked-lazarus.png

Please take note that the Lazarus form designer is docked within the code
editor window using a code / designer tab. Some of you might be used to
working with multiple monitors to split code editing and form design, but
my vision is impeded. I do not have room on my desk for more than one very
large monitor. I also often use large screen laptops where I only have just
the one laptop screen.

I realize there was a bit of drama and perhaps some "bad blood" between
some of the core team working on Lazarus the original developer of Sparta
docked form editor, but the removal of a functional package without a clear
alternative seems perplexing, especially if it had utility for a segment of
users. If there is no replacement, then given the choice of using Lazarus
in multiple window mode versus using it in single window docked form, I
will continue to use and encourage other people (along with my students) to
use old versions of Lazarus.

To reiterate, while some users may prefer multiple window mode, it makes
little sense to remove the ability for other people to use a working docked
form editor mode. Yes there might have been conflicts with the Sparta
generics unit, but those conflicts in no way impeded other code. As far as
I can tell this is the only note I can find about the removal, which is
lacks reasoning or a discussion context:

https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/9964bfc872f8c2e3a0664153277d30ca945b3893

Thank you for your attention.
Anthony
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] GTK 3 Widget Set Status?

2023-09-26 Thread Anthony Walter via lazarus
Would someone be so kind to tell me if the GTK 3 widget set is working yet?
Does the IDE work when built using GTK 3 and can I write most normal
desktop applications using GTK 3 right now when using the a most recent
trunk revision? What's not working in a general sense?

I thought I'd ask you guys rather than clone Lazarus from git, build it,
and hunt for problems.

Thanks.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Copilot, VS Code, and OmniPascal

2023-05-15 Thread Anthony Walter via lazarus
Hello all!

I would very much like to use Github Copilot with Free Pascal, and possibly
within the Lazarus IDE.

I have been using Github Copilot a lot recently with my C and C# coding
projects and have found it to be an immensely useful tool. Recently I used
it rapidly to create documentation comments for a large C# API I wrote and
was impressed with the speed and accuracy. I've also found it extremely
productive when it comes to working with third-party libraries where I
haven't much used a new-to-me library. Copilot aids me greatly by
generating code to do tasks with such code while I learn and become
familiar with how to use the aforementioned libraries.

This has led me to experiment with using Github Copilot in Visual Studio
Code with Pascal, and while it simply works by opening files with a ".pas"
extension, there is obviously a lot more which can be done to make a tool
like Copilot with better IDE support. Specifically supporting Pascal
project files that reference packages with their unit source paths,
building and debugging, and problem solving (fixing errors in source code).

My question to you in the Lazarus community is has anyone even attempted to
integrate the Copilot system into Lazarus? If this is not at all possible,
has anyone here used the OmniPascal extension to VS Code and configured it
to work with lazbuild and have working tasks and launch JSON configuration
files they could share along with their insights? I've googled a few
supposed "guides" on the subject and found them to be horribly wrong or
missing many critical steps.

If anyone could give me advice on the matter, I'd be willing to write up
and host a thorough guide on the matter after being able to solve the
numerous configuration problems I'm attempting to solve.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] More Flood Photos

2022-10-02 Thread Anthony Walter via lazarus
By your request here are more photos I took as hurricane Ian passed Cape
Canaveral.

Clubhouse 
Boardwalk 
Manatee 
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Improving my Pascal Simulation with a Fragment Shader

2022-09-13 Thread Anthony Walter via lazarus
I am writing some demos for my Tiny Sim library and also teaching kids
programming. I wrote an interesting tutorial that is a good introduction to
writing fragment shaders and thought I'd share it with you guys on this
forum.

https://www.getlazarus.org/pool/rendering/

I hope you find it educational and interesting.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] More Gtk3 Status

2022-07-20 Thread Anthony Walter via lazarus
After some research, I found a few more serious issues with Gtk3. I will
not bother filing bugs as the issues seem too ingrained to the
implementation.

Here are some problems:

1) TGtkWidget makes custom drawing an inaccessible private field value that
cannot be set. What this means is that only certain predefined widgets
(with enumerated contents) in Gtk3Widgets.pas are allowed to receive paint
handling events.

2) The CreateWidget virtual method of TGtkWidget is designed to create an
underlying Gtk3 widget instance. But the design makes
brings inheritance problems, as you cannot make use of the inherited
CreateWidget implementation if you want a different widget type. For
example, a TCustomControl backed by a Gtk.DrawingArea.

3) TGtkWidget is defined as having a "property Widget: PGtkWidget".
PGtkWidget is ^TGtkWidget. TGtkWidget is not a TGtkWidget. Ridiculous.

4) There are a reduplication of header file translations, and they are each
incomplete in their own different ways. There is LazGtk3.pas and Gtk3.pas,
LazGdk3.pas and Gdk3, Pango and LazPango1. The latter names in the list are
duplicates to the lclgtk3 widgetset and are incomplete and different from
the former named units.

5) Colors are not being handled correctly with the Gtk3 implementation. I
don't know how many I have found where clWindowText is not being correctly
translated to a valid RGB (ColorToRGB). For example on my system theme
clWindowText is near white, but with lots of code parts of this Gtk3
implementation it's translated to near black because no RGB translations
are being made.

6) All drawing is being handled by cairo on Gtk3 and drawing on a parent
control (a Form for example) can change the drawing state in a child
control (TPaintBox for example). If I invalidate a form and draw using a
transform, the paintbox drawing is automatically transformed. There are
cairo functions to preserve the state, but they are not being used
correclty in the Gtk3 widgetset implementation.

7) There are lots of other problems.

I completed a couple of tasks related
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] More Gtk3 Status

2022-07-15 Thread Anthony Walter via lazarus
Kostas,

We already have an object oriented layer to interact with controls. That
layer is the LCL. What you are saying is it makes sense for each widgetset
to create their own separate and independent class hierarchy, or to use
TWidgetInfo, or have something akin to:

  LCL-> WSClasses -> TSomePlatformWidgets (ie TGtk3Widget class and
derivitatives) -> Flat C API

What would make more sense to me would be:

  LCL Object -> IWidget -> Flat C API

Where any control would need to fill implement the requirements of IWidget
to be complete. In this way we could have a contract between the LCL and
what is expected of a control (IWidget), a button (IButton), a listbox
(IListBox), a page control (IPageControl), and so on.

You might ask how does this fix anything? Well first it nails down three
layers instead of four of five. Second, it creates a contact between the
LCL and someone writing the part to go between the LCL and flat C APIs.
Third, it provides a consistent model for  ANYONE wanting to implement a
widgetset, thus making it MUCH easier for people to understand what is
going on. Forth, implementors can look at other widgetsets to understand
how to create a new or fix a malfunctioning part of the widgetset they are
working on.

Again, I would support the idea of using Handles on platform specific
objects, like a Canvas (DC on Windows, CairoRed of gtk3), a WinControl
(HWND on Windows, PGtkObject on gtk2/Gtk3)

IN ADDITION TO

A well described non reference counted interface model for platform
specific objects (IWidget, ICanvas, IButton, IListBox) which the LCL would
depend on to automatically take care of the platform and widget specific
glue.

uses
  { This unit would defines the contract between the LCL and all Widgetset
be defining all relevant
  interfaces  that must be implemented to make a LCL widgetset }
  Widgets,
...
  ;

type
  TWinControl = class(TControl, IWidget)
  private
FWidget: IWidget;
  protected
property Widget: IWidget read FWidget  implements IWidget;

  end;

...

  TCustomListBox = class(TWinControl, IListBox)
  private
function GetListBox: IListBox;
  protected
property ListBox: IListBox read GetListBox implements IListBox;

  end;

...

function TCustomListBox.GetListBox: IListBox;
begin
  Result := Widget as IListBox;
end;
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] More Gtk3 Status

2022-07-15 Thread Anthony Walter via lazarus
Denis,

I will attempt the big design flaws I have found so far while wrangling
with the current Gtk3 widget implementation.
There are three main layers underpinning cross platform LCL widgetset.

1) We obviously have the LCL itself that mimics the VCL and creates a cross
platform component and control library with the same classes and
hierarchy across multiple platforms. This piece works well enough.

2) We have underlying native toolkits written in C or C++, or some other
language, whose functionality is exposed to Free Pascal by a flat C style
API of imported functions, enumerations, constants, and records. This piece
works well enough also.

3) We have a series of pascal WS (widgetset) classes used in conjunction
with the "RegisterWSComponent(TSomeControl, TWSSomeControl);" that is
responsible for binding the 1 and 2 layers. The WS classes are responsible
for creating the actual underlying native toolkit widget or control from
layers 2 and bridging access to specific properties and methods to layer 1.
Okay, this works.  I would have designed a set of interfaces to bridge this
piece instead, but we have these WS classes. I'll deal with it.

Now here is the first big problem with the Gtk3 widgetset as implemented.
Somehow someone decided it would be a neat idea to add a 4th piece just for
Gtk3. This piece attempts to wedge itself between 2 and 3 by recreating the
already existing flat C style API from piece 3 as a big series of pascal
objects that redeclare the Gtk3 API as a series of objects (see TGtk3Widget
in the file gtk3widgets.pas). Now we have a 4th layer just for Gtk3 that
not only adds more complexity, but also introduces peculiar behaviors
altering what someone writing a Gtk3 native widget port needs to know while
following through with creating a control or component.

For an example of the problem this additional with Gtk3 4th layer
introduces, consider my attempts to take some Gtk2 widgets I have written
and also support them in Gtk3 with its extra layer. I recently updated my
gtk vte (virtual terminal emulator control, code here
 and video here
) that currently
works under Gtk2. While writing the Gtk2 version I referenced the flat C
API from here
 and had
little to no problems getting it working. With the Gtk2 widgetset
implementation in Lazarus I was able to just use the Gtk2 documents online
to see what functions existed related to working with Gtk2 widgets and it
worked. This is what I expect when working with a native widgetset, that is
I read the documentation provided by the actual widget to toolkit maker
(reading documentation at gnome.og).

Now with the current Gtk3 widget implementation tries to introduce a whole
other extra layer that works differently than the actual Gtk3 documentation
provides. Not only are the Gtk/Gdk functions I need hidden elsewhere, but
they work differently in most cases, as decided by whomever is maintaining
the base Gtk3 widgetset for Lazarus. I DO NOT want to spend my time trying
to figure out where someone has hidden a Gtk3 widget API inside some class
from which I am supposed to figure out to inherit in the hopes that the
Gtk3 widgetset maker got right. This whole declaration of the flat Gtk3 C
style API and putting them into another set of pascal classes that are then
references by WS classes and then referenced by LCL controls and components
is just BAD BAD BAD.

It should be KISS. Just make the control handle an actual reference to the
underlying system toolkit handle, and please DO NOT attempt to recreate
another object hierarchy (in addition to the WS classes) of each possible
widget or object type present on a platform or toolkit combination. Stay
with a straight flat C style API and let me read the actual developers
documentation instead of forcing me to figure and find errors you created
in wiring a whole new API re-duplicating their APIs above and beyond and
behind the LCL.

For reference, in addition the vte example I posted above, I have also been
wrangling with webkitgtk for Gtk3 also OpenGL under Gtk3 with the same
problems.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] More Gtk3 Status

2022-07-15 Thread Anthony Walter via lazarus
Respectfully, I believe the current underlying implementation of Gtk3 is
fundamentally a bad design making it unnecessarily difficult to work with.
I do not see it being completed and see its poor design as a large part of
the reason it has been languishing for so long.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] More Gtk3 Status

2022-07-15 Thread Anthony Walter via lazarus
Last year in September 2021 I wrote this list asking about the status of
the Gtk3 widgetset implementation for Lazarus. The consensus at the time
seemed to indicate that the package was still incomplete and had no
maintainer.

Over the past few days, I have been attempting to add Gtk3 widgetset
support to a few upcoming library projects I will soon release. As
someone with a lot of experience in the areas of general programming,
object pascal programming, code library design, and importantly the inner
workings of the Lazarus WS (widgetset) abstraction layers for a few
different backends, I have this to say.

The design of the Gtk3 widgetset backend for Lazarus is fundamentally a bad
design and unnecessarily difficult to work with.

I can provide specifics about all the problems I see with it in a follow up
message if anyone cares to know more, but I am more interested and
motivated to get an answer to a burning question that I hope someone can
answer.

My question is: After 11 years of the Gtk3 release by the Gnome Foundation,
and the unmaintained status of Gtk2 by the same foundation, when are we
within the Lazarus community going to be comfortable going seeing something
someone has started, recognize it as a fundamentally bad design, and
officially delete it, thereby allowing someone else to start fresh perhaps
steering clear of the problems inherited in a prior bad design attempt?

I know I will hear people responding to my question with the statement that
I could do this if it's something I care about. That is, I could start
writing what might consider a proper design of the Gtk3 widgetset for
Lazarus.

To those people, I would say I have a lot of other projects and problems
IRL I am working on at the the moment and don't have the time to start yet
another endeavor as big as redesigning and rewriting the Gtk3 widgetset for
Lazarus. Sure I can provide a lot of valuable insight as to what is wrong
with the current attempt, but don't have the time (my actual health is
failing IRL), but it would be foolish for me to try to take over the Gtk3
widgetset at this point.

In brief, if anyone out there cares about helping Lazarus and bringing its
support for the Linux desktop more up to date with its current underlying
toolkit options, I would offer them both encouragement and some guidance as
to both what to avoid and what to do that is good.

I have a whole bunch of web browser
 related
source code for Lazarus Gtk3 that I have been sitting on, waiting to
publish when Gtk3 support in Lazarus was a bit more mature. I also have a new
OpenGL toolkit  (an example of the source
code interface is here
) I want
to release with Gtk3 support on Lazarus. I'd like to be able to release
this stuff and a lot more before I die.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Codebot Cross Landing Page and Update

2022-07-01 Thread Anthony Walter via lazarus
Hello everyone.

I wanted to let you all know I created a landing page for my recently
updated Codebot Cross library. I've been working on the library as my base
set of units for some time now, but have only been pushing updates to my
private git server. With a FOSS application I published recently, I pushed
a big update to my public facing repository on Github. Some people were
asking me for documentation or pictures, so I cobles together this landing
page:

https://www.getlazarus.org/cross/

It contains installation, documentation, and organization information about
the library along with links to some demonstration projects and articles.

Now that I have my private and public code synched, I plan to push more
regularly to Github. I also have been going through an old external hard
drive I picked out of my closet and found a few projects I'd like to dust
off, bring up to standards, and publish.

Thank you for your attention.

Anthony
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] 6000+ Open Source Icon Tool and Git Repository

2022-06-30 Thread Anthony Walter via lazarus
Hi guys. I just wanted to post some information to this board about a cross
platform programming and designer tool I wrote using Lazarus.

https://www.getlazarus.org/apps/matview/

This tool is called Material Design Icon Viewer, and in summary, it allows
programmers and designers to quickly browse through over 6000 open source
icons and copy and paste them into Lazarus or any code editor. It features
incremental searching of icons, character and code point copying, as well
as exporting icons to PNG images at any scale.

The source code is available here.

https://github.com/sysrpl/Codebot.MatView

Also, with the release of this tool I intend to release several new related
tools and projects shortly. To that end, I've updated my cross platform
class library for general purpose, custom control, and optionally opengl es
rendering. To recompile the Material Design Icon Viewer you'll need to get
a copy of the cross library, as it depends on it.

https://github.com/sysrpl/Codebot.Cross
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Type Library Viewer, Importer, and Editor?

2022-06-26 Thread Anthony Walter via lazarus
Thank you for the information. I'll take a look ay and see if it can be
improved.

I normally use Linux these days, which obliviates all use or reference to
type libraries, but I have a need to write a program to automate AutoCAD
with some specific hardware I recently acquired. While working with COM,
type libraries, and automation again I started remembering how useful,
easy, and productive these technologies are. I get that they were / are a
huge security nightmare, but that's what comes with ease of use and the
power of getting components of your operating system and applications to
share methods, data, and resources in a programming language agnostic way.

I think it's too bad Microsoft has decided to shelf it all. They could have
fixed the security issues with it rather than dropping it altogether.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Type Library Viewer, Importer, and Editor?

2022-06-26 Thread Anthony Walter via lazarus
Does Lazarus have a type library viewer for previewing all the type
libraries on your computer in the form of converted pascal source code?

Does Lazarus have a type library editor allowing you to define plain COM
and automation interfaces, enums, records, and such as IDL? If so does this
tool generate and synchronize source code implementing those interfaces
either TComObject as TAutoObject respectively?

I am asking because I have been going through an old external backup drive
with some of the projects and tools I've written over the years.
Simultaneously I am also working on an automation project for AutoCAD. This
led me to review a type library viewer and importer utility I wrote some
time ago and ...

IF the answer to my above questions is "NO" and ...
IF there is moderate interest from the community

I might add some enhancements to the work I've already completed and create
a Lazarus add-in to perform these tasks and abilities based on your
feedback.

For reference here is a screen shot of my existing type library viewer and
importer. It works by examining the registered COM objects on your computer
with supporting type library information and shows your contents as Pascal
source code. It has some searching, sorting, and filtering features. With
your interest and feedback, I will consider making some modifications
including a type library editor and implementing class generator.

https://cache.getlazarus.org/images/showcase/windows.type.libraries.jpg
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Programming Mechanical Simulations

2021-12-15 Thread Anthony Walter via lazarus
I wanted to share this
.

I can't stop writing code. I was inspired to design a program that can
convert any SVG drawing into a simulation of a physical machine. I am just
getting started writing such a program, but have had some promising initial
results. See the link at the top of this message for context.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] All Demos Are Done

2021-12-02 Thread Anthony Walter via lazarus
I've completed writing all the demos and most of the documentation for my
soon to be released vector graphics and physics simulation library. The
library is named Tiny Sim and the first version will be published soon. I
have lots of planned features and improvements to come.

If you are interested I posted a very brief overview page and a video
containing all nine demos for my library on this web page:

https://www.getlazarus.org/videos/physics/demos/
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] New Synthwave Demo

2021-11-30 Thread Anthony Walter via lazarus
Did someone steal access to Juha's email? Not only are his ramblings
off-topic, but he sounds like a deluded conspiracy theorist bent on
disenfranchising rational people from using these mailing lists.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] New Synthwave Demo

2021-11-30 Thread Anthony Walter via lazarus
Here you go:

https://en.wikipedia.org/wiki/Synthwave

Also this:

https://duckduckgo.com/?q=synthwave=images=images
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] New Synthwave Demo

2021-11-29 Thread Anthony Walter via lazarus
Hi guys,

I just wanted to let you know I completed writing my final demo to be
included in my soon to be released vector graphics and custom UI toolkit.

On this page  is the
video and source code of the project.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Vector Based UI Supports Any Transform

2021-11-23 Thread Anthony Walter via lazarus
I've been busy with family ongoings the past week but managed to squeeze in
a small quality of life improvement to my vector graphics toolkit with UI
widgets and SVG parsing and rendering support.

https://streamable.com/cv137g

Above is a link to a quickly recorded video demonstrating UI widgets
supporting any type of transform, while maintaining crisp and smooth vector
edges. Note that even when transformed, UI widgets properly map mouse input
coordinates, both for mouse clicking and mouse dragging.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] SVG Rendering Performance using Free Pascal

2021-11-17 Thread Anthony Walter via lazarus
I was watching an older video from Nvidia regarding their path rendering
extensions, a feature specific to their video card drivers. I've written a
more open implementation and have run an initial quality and performance
test.

https://www.youtube.com/watch?v=fTm_s_pCBEM

This is test was run on an i5 3470 CPU with a Radeon 550 on Mint Linux.
Free Pascal 3.3 fixes branch with no optimizations.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Rendering SVG Documents in realtime in less than 160 lines of code

2021-11-14 Thread Anthony Walter via lazarus
It took me about 24 hours to design and write an SVG parser and rendering
system from scratch. You can check it out on this page:

https://www.getlazarus.org/videos/physics/svg/

The source code for the rendering is only 156 lines of Pascal code, Most of
the work is done by the parser. It even handles stylesheets inside SVG
documents.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Crayon physics written in Pascal

2021-11-11 Thread Anthony Walter via lazarus
Thank you. Corrected.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Crayon physics written in Pascal

2021-11-11 Thread Anthony Walter via lazarus
In less than 500 lines of code, I created a crayon physics demo program
using Free Pascal. Check it out at the link below. Source code is included
at the bottom of the page.

https://www.getlazarus.org/videos/physics/catapult/

I've tested it out and it runs well on Windows, Linux, Mac, and smoothly on
Raspberry Pi (using the OpenGL ES2 backend).
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Asteroids in Pascal

2021-11-09 Thread Anthony Walter via lazarus
As one of several demos of my vector graphics library for Free Pascal, I've
recreated an arcade game.

I've included a copy of the entire game logic code. Check it out here:

https://www.getlazarus.org/videos/physics/asteroids/
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] GTK3 Status?

2021-09-10 Thread Anthony Walter via lazarus
After more research, here is a small bit of anecdotal information from my
tests.

Using the most recent git version LCL GTK3 seems to run somewhat but has
errors and operates incorrectly in some situations. There seems to be
rendering problems when I tested a TTIPropertyGrid. Colors and line
styles were wrong, controls were sized improperly, and scroll bars appeared
and disappeared strangely with content offset incorrectly. Basic
controls like menus, buttons, paintbox, and trackbars seemed to work fine.
The string grid control seems to have issues similar to the property grid
control.

Please keep in mind, I was using a GTK2 version of Lazarus and the LCL GTK3
only using a small sampling of programs I'd just written today. Based on
the information above it seems to me that building and using an LCL GTK3
version of Lazarus is not currently possible. There are likely other
problems, but we'd need some test suite to find them, and am unsure if one
for the LCL has been written.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] GTK3 Status?

2021-09-10 Thread Anthony Walter via lazarus
After a small bit of research, it looks like most of the information
related to the LCL GTK3 can be found on this page. I am unsure how up to
date the issues are as the README.txt file was last updated 8 years ago.

https://gitlab.com/freepascal.org/lazarus/lazarus/-/tree/main/lcl/interfaces/gtk3

>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] GTK3 Status?

2021-09-10 Thread Anthony Walter via lazarus
Can anyone tell me who is actively working on the LCL GTK3 or greater
toolkit and also possibly refer me to a page or document listing what work
was is or is remains to be done on it?

Thanks,
Anthony
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Going Through My Educational Projects Material

2021-05-10 Thread Anthony Walter via lazarus
Upon request of some of the parents of the kids I teach, I am working on a
document providing an overview of the methods, materials, and content used
in my online classes. Thanks to a new government resource upon approval the
parents of the kids I teach may be able to get reimbursement from
the government for payments made to me.

As such I've finally begun going through the materials I've generated for
my classes and pushing some of them to Github. Recently Github added the
ability to embed videos in their markdown files, so tonight I started the
task of checking in code, recording videos, and taking screenshots. I have
probably 100 projects to go through, but I pushed a couple to Github
already along with a brief demonstration video or picture for each project.

Until I finish my overview document, I am listing the projects I go
through, review, and publish at this location:

https://www.getlazarus.org/learn/tutorials/examples/

There are several big projects I need to push include my webkit based web
browser controls and tools project, a powerful and current javascript
engine library, from scratch json parser, a high resolution satellite image
movie make r, a simple platform
game engine using opengl, text to speech and speech to text using web
services demo and so on. I also have many smaller but interesting projects
to go through as well.

Please note, I haven't updated my main Codebot.Cross library used in most
of the examples linked above. I should have it updated in a few days after
I send out my document overview. After it's been updated all the examples
should be able to cross compile on Linux, Mac, and Windows.

Finally, I have been working on some other projects unrelated to Lazarus,
but they might be of interest to some of you. For the past few months I
have been working on custom electronics and programming `IoT` code for the
Raspberry Pi. I am also designing custom PCBs
 to pair with my Pi
software library. Some of that material is hosted here
.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Clipboard Data Goes Away

2021-04-01 Thread Anthony Walter via lazarus
Colin,

After some research I've found that LCL Gtk2 isn't using gtk_clipboard_x
functions, rather it's using gtk_selection_x functions. There are
gtk_clipboard functions to do the same thing as gtk_selection functions,
but because the gtk_clipboard functions are not being used, the
gtk_clipboard_store function does not work with the LCL Gtk2 clipboard.
I've written a mini clipboard class that allows for multiple formats on the
clipboard at the same time and it works well and also allows clipboard data
to persist after my application closes, but my design does not conform to
the WS (widgetset) model used by the LCL, and thus operates outside of the
LCL.

In the end, I'm confident that if LCL Gtk2 were written to use
gtk_clipboard functions instead of gtk_selection functions, the problem
could be fixed. I do not mean to place blame on any of the LCL Gtk2
developers, as the gtk_clipboard functions were most likely developed and
released sometime after the first few iterations of Gtk2. Particularly, the
gtk_clipboard_set_can_store did not exist until Gtk 2.6.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Clipboard Data Goes Away

2021-04-01 Thread Anthony Walter via lazarus
Here is a follow-up.

I wrote a simple test using LCL Gtk2 and gtk_clipboard_store. This test
allows the clipboard data to persist after my program exited. Button1 click
sets the clipboard data. If Button2 clicked the data will persist after the
program exits. If Button2 is not clicked, the data does not persist.
Curiously, as the LCL Gtk2 currently stands, gtk_clipboard_store() does not
work. I suspect the LCL is not using the same GdkAtom clipboard as returned
by gtk_clipboard_get(GDK_SELECTION_CLIPBOARD).

uses
  Gtk2, Gdk2;

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
  S: string;
begin
  S := Edit1.Text;
  gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD),
PChar(S), Length(S))
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  gtk_clipboard_store(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  Close;
end;

>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Clipboard Data Goes Away

2021-04-01 Thread Anthony Walter via lazarus
Thanks Michael.

It looks as if this problem was fixed in Gtk2 by version 2.6. The
developers added this function to work around this problem:

void gtk_clipboard_store (GtkClipboard *clipboard);

Stores the current clipboard data somewhere so that it will stay around
after the application has quit.

Parameters
clipboard

a GtkClipboard

Since: 2.6

Looking at the LCL source, it seems the Gtk3 LCL is using this function to
save the clipboard data after the program exists, but it's not being used
in the Gtk2 LCL. With this function, the problem I've described should be
fixable in LCL Gtk2.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Clipboard Data Goes Away

2021-04-01 Thread Anthony Walter via lazarus
Perhaps there is a Linux service that can be used by applications to hand
over and take ownership of clipboard data, and applications such as those I
mentioned are using it in order to solve the problem I am describing?
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Clipboard Data Goes Away

2021-04-01 Thread Anthony Walter via lazarus
I noticed a recent discussion touching on this problem posted by Bo
Berglund on November 20, 2020 to this same mailing list.

Andreas Schneider replied in that thread, 'Pasting basically asks the
application that "copied" it to get the content. If that app is gone in the
meantime, there's nothing to paste anymore.'

Also, Colin Western replied this is how Linux applications work, 'the data
is kept with the source program, so goes when the program closes'.

I disagree.

I've tested several Gtk2 applications, including older versions of Gimp
and  Geany. Both these programs have clipboard copy functions and the data
on the clipboard from those applications my tests show their clipboard data
persists after they have been closed. So it would seem that Gtk2 the
clipboard works correctly and handles persisting data after an application
has exited.

I stepped through the LCL source and it looks like the clipboard code is
using some Gtk clipboard functions, and not using X windows functions,
thereby introducing a possible problem, but I am unsure if the LCL is using
the Gtk clipboard correctly. That is, the LCL might be using some Gtk
clipboard functions which seem to work well, but exhibit the problematic
behaviour I've described.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Clipboard Data Goes Away

2021-04-01 Thread Anthony Walter via lazarus
On Linux Gtk2, over time I have noticed a problem where data copied to the
clipboard by a Lazarus application does not persist on the clipboard after
the Lazarus program has exited.

While writing this application
 that
captures image data to the clipboard, the data on the clipboard is only
available to other applications while mine is running. If I exit my program
the clipboard data goes away. The same problem occurs if the clipboard data
is text rather than a bitmap.

Is this a known issue on Linux LCL Gtk2? Is there a workaround?

Thank you for your attention.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] *** SPAM *** Open Source IDE Written Using Delphi

2020-12-26 Thread Anthony Walter via lazarus
Why was the subject of my submission changed with "*** SPAM ***" inserted?

Curious
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Open Source IDE Written Using Delphi

2020-12-26 Thread Anthony Walter via lazarus
I thought this bit of information might be of interest and useful to us
Lazarus people.

Apparently Embarcadero has forked the Bloodshed IDE

and rewritten it to run natively using Delphi. Although this is a C++ IDE,
it's lightweight, fast, and free open source software. It may be worth our
effort to examine it and see if it contains any parts that are innovative,
then either fork or be inspired by some of their code to bring about
Lazarus enhancements.

I believe this is totally within the spirit of the open source movement. At
the minimum it would be nice to look at the Pascal source code of another
IDE and determine how someone else has decided to implement existing and
different features, laying the way for using that knowledge to improve upon
Lazarus.

https://blogs.embarcadero.com/dev-c-is-a-low-memory-windows-native-c-ide-built-in-delphi/
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TSQLQuery component editor

2020-04-30 Thread Anthony Walter via lazarus
Great! I'll test it out shortly. Thank you for enhancements :)
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] We are planning the next release: Lazarus 2.0.8

2020-04-02 Thread Anthony Walter via lazarus
Martin,

I haven't reported this bug because it's difficult to reproduce, but with
some of the recent releases and many of the trunk check in there seems to
be a lot of problems with the sparta docked form designer (DFD), at least
on Linux gtk2.

What happens is that with the DFD installed on Linux gtk2 as the user tries
to use the left mouse button in the designer to either click on or lasso
select controls, the designer acts as if the previous selection is included
in the selection. This happens randomly. The effect is that DFD is
difficult to use. You go to select a control by clicking on it and instead
it creates a selection group including the item you click on and whatever
was last selected. This prevents users from editing a component or control
using the DFD and instead they have to clear the selection (by clicking on
a blank area of the form) then clicking on a control or component. It is
very annoying, but doesn't happen 100% of the time, more like 50%.

When you have a revision number you feel comfortable for me to test, I can
try it and report the status of this issue back. If it fails with that
revision I can submit a mantis issue and perhaps look at what's going on as
well.

For anyone else, if you are using Linux, gtk2, and the DFD, it would be
helpful if you could confirm this behavior and perhaps note the pattern you
see. That is what is happening when this problem occurs.

Thanks.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] The Problem with the Linux Desktop

2020-03-29 Thread Anthony Walter via lazarus
Teresa, thank you for your considered opinion.

I agree with most of what you said, but with regards to the option of
moving back to Windows, for me that is a non starter. I don't use Linux
rather than Window because of some technical benefit. The primary reason I
use Linux because I don't want to worry around my privacy being
compromised, either from malware or viruses which are a big problem with
Windows or from software vendors themselves be it Microsoft telemetry or
other spying features that now a days so commonly bundled with 1st, 2nd,
and 3rd part software on Windows. These problems are pretty much non
existent on Linux.

I also value the efficiency of Linux. I have all processing speed and file
system the room I need on a 2008 Core2Duo, 4GB or RAM, and a 60GB SSD using
Linux, even with the newest distros. On the latest Windows 10, not so much.
Just getting the OS installed is about 30GB. And yes this is a big deal for
me because I always have 10 or more of these laptops on hand and use them
to teach my students basic computers usage, online safety, and programming.
Even if I wasn't using these machine for teaching, they still make for
great everyday computers when running Linux. Using them with the most
recent Windows, not so much.

My complaints, as you expanded upon, center mostly around the fractured
nature of the Linux desktop ecosystem. Even popular distros such as Ubuntu
break things from release to release. Windows seems to always try to
protect that backward compatibility, at least since they made the move to a
true 32 bit OS. Of course with Windows upgrades some hardware is no longer
supported (I can't use the Canon photo capture system on other than XP),
but most of the time everything still works.

Thanks again for your considerate thoughts.
Anthony
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] The Problem with the Linux Desktop

2020-03-27 Thread Anthony Walter via lazarus
Juha,

I saw someone had had modifications and unfortunately it caused the
appindicator to stop working on my desktop. I rolled back the version to my
last check in and it worked again. I also found that on the Cinnamon
desktop you can add a systray applet and the old Gtk2 style tray icons
work, albeit in a separate applet contain in your panel.

I have a few projects I am working on in addition to my tutoring of kids. I
want to work on the Lazarus Gtk3 widgset and get it working enough to
compile and run Lazarus with it. I have soem changes to it already that
made some stuff work a lot better, but I haven't worked on the Gtk3
widgetset for about 8 months. When I do I try to coordinate with David.

Thanks, Anthony.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] The Problem with the Linux Desktop

2020-03-27 Thread Anthony Walter via lazarus
Michael,

I've been using the Linux desktop as my primary OS since 2006. I had
dabbled in in before, but typically went back to windows when my networking
had troubles.

That said, I want Linux to be better. Yes I understand your points, but
please understand even when you choose an environment like Gnome vs KDE,
even they break things or don't provide all the tools you need. that is
the frustrating part, when an environment either breaks something like tray
icons or provides little to no assistance in completing some requirement,
such as hit testing a window for transparent pixels, or registering a
global hotkey.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] The Problem with the Linux Desktop

2020-03-27 Thread Anthony Walter via lazarus
On Linux ...

I was looking at the Unity tray icon code I submitted a while back and it
had stopped working on my desktop environment. I was also looking for a way
to track user log off events, monitor clipboard history, and how to
register a global hot key.

The sheer scattering of different systems, libraries, and what not that I
needed to search through to find solutions which are typically as simple as
a single function on a single document site with Windows prompted me to
write this brief diatribe:

The Problem with the Linux Desktop



I also posted that page to the r/linux
,
and am likely to get down voted there, but if anyone wants to chime in,
feel free. It might make use both feel better.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Problems teaching kids programming

2020-03-24 Thread Anthony Walter via lazarus
Here is something I had to resort to this to teach one of my students:

https://www.getlazarus.org/learn/courseware/homework/project-4/

For the effort I made for this one child in creating this lesson, I thought
I'd at least share my sorrows.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Gtk2 Linux detect user logoff?

2020-03-23 Thread Anthony Walter via lazarus
Does anyone here know how to detect user log off and gracefully terminate
under Gtk2 Linux? I have an app which uses some temporary files (in /tmp)
and I want to ensure those files are deleted when the user logs off. The
application query/end session events don't seem to be connected when using
the Gtk2 widgetset.

>From this stack overflow answer it would seem there is a 'save-yourself'
sinal to notify you when the user logs off, but I don't know what the LCL
value of client might be. Could it be application handle? Is there a better
way to detect user log off on Gtk2?

https://stackoverflow.com/a/2519829/269630
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Linux GNU Debugger Freezing App on Run

2020-03-09 Thread Anthony Walter via lazarus
>
> Thanks for that help Martin. It would seem gdb itself is hanging and it's
tied to some code in my library that was problematic previously. I don't
believe I am doing anything wrong, but it's related to a problem I had with
gdb. I will research further to try to isolate the exact cause.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Linux GNU Debugger Freezing App on Run

2020-03-09 Thread Anthony Walter via lazarus
Has anyone else experienced the following problem?

I continually have a problem where running a program on Linux with the GNU
debugger through Lazarus results in either no control showing on my form or
controls show but everything is frozen.

This happens occasionally, probably on about 50% of the times I run and
program through Lazarus with debugging on. This happens with any program I
create with Lazarus on Linux when running an app through the IDE with
debugging on. If I turn off debugging or run my application through the
Linux desktop, it runs fine without any of the freezing.

So it would seem this problem is tied to Lazarus and how it interacts with
the GNU debugger. I have tried many version of Lazarus through SVN and I
get the same behavior. I am on Ubuntu 16.04 64-bit Linux.

My gdb debugger version is GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
My Linux kernel version is Linux 4.15.0-88-generic
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] libgphoto2 camera capture and control

2020-03-03 Thread Anthony Walter via lazarus
My libgphoto2 pascal file is located here
.

That's what I've been doing on an idle timer, but admittedly when I
submitted the changes I didn't actually change any of the libgphoto2
"widget" values. I just am calling ...

function TCamera.ApplyChanges: Boolean;
begin
  if Connected then
Result := gp_camera_set_config(FCamera, FWindow.FWidget, FContext) =
GP_OK
  else
Result := False;
end;

>From a timer without settings and new "widget" values. I might try changing
a widget value and see if that works. I will upload complete application
sources to a a git repo soon and maybe someone with a gphoto2 supported
camera  can test.

Thanks for the advice.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] libgphoto2 camera capture and control

2020-03-03 Thread Anthony Walter via lazarus
Does anyone know if any projects exists for libgphoto2?

I wrote an object oriented interface to libgphoto2 and have a problem with
tethering (using the computer to control a camera) where after some time my
camera will turn off during a period of inactivity.

To reset camera tethering you have to manually turn the switch on the
camera to off then turn it back on again, wait a bit then press a button in
my application to try and connect again. This is a inconvenient as you have
to stop using the computer and fiddle with the camera constantly. I am
wondering if anyone has handled this before and had any insight on how to
prevent a camera from just powering down. If I continually take photos this
might fix the problem, but that would interfere with other operations as
the camera is occupied during that period and it would cause random
intervals where camera settings could not be made.

The library seems to have some application idle timeout functions, but they
don't seem to do anything with my camera at least.

I appreciate your thoughts.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Delphi is 25 years old today

2020-02-14 Thread Anthony Walter via lazarus
As the title says, Delphi turns 25 years old today. A discussion is going
on over here on hacker news .
Feel free to chime in there to let other people know Free Pascal and
Lazarus is free open source software, under active development, and is
better in so many way.

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


Re: [Lazarus] NanoVG Graphics

2020-01-28 Thread Anthony Walter via lazarus
Marc,

The library does not have any code to manage creating a window, creating a
valid opengl context, or handle event processing. These are things which
are not exactly trivial in nature, especially in a cross platform manner.
Typically for simplicity makers of OpenGL demos rely upon things like GLFW
(Graphics Library FrameWork) to get a demo working. Other libraries to do
the same thing are SDL, GLUT, SFML, or other similar libraries.

The good news is that NanoVG is designed to work independently of those
things. The original C implementation has a callback stub to load the
appropriate OpenGL functions based on which back end you choose.
Fortunately this tool named Glad  makes it very
simple to create a correct Pascal (or other language) file for the various
OpenGL versions. This is probably something we ought to consider using in
the FCL, so that for example people would know what functions to load for
OpenGL ES versus the full version of OpenGL.

And finally the LCL and TOpenGLControl provided in the components folder
handle all the requirements already, so if you wanted to use a NanoVG port
with Lazarus it ought to be as simple as including some NanoVG.pas in your
project and putting a few NanoVG drawing function calls into your
TForm1.OpenGLControl1Paint method. In this way using hardware accelerated
animated vector text and graphics in any desktop project would be very
easy. NanoVG even includes functions to draw vector controls such as
sliders, check boxes, buttons, and combo boxes.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] NanoVG Graphics

2020-01-25 Thread Anthony Walter via lazarus
I am starting a rewrite of my 2D hardware accelerated Pascal graphics
library based on an OpenGL 3D backend, and I stumbled across an open source
project called NanoVG. I am impressed with how small and self contained
NanoVG is, and although I will recreated my 2D graphics library upon OpenGL
without using NanoVG, I though some of you on the mailing list might have
some interest.

Here is some reference material on NanoVG:

Original github page, but there might be an improved fork I can't find at
the moment 
How to build User Interfaces and 2D Shapes with NanoVG


What's important is that several people have ported the projects to other
languages and backends (DX11 for example). Looking at how small and self
contain it is, it would seem like a task that would not that difficult to
port to Pascal.

I believe it would be an interesting project that would benefit us Pascal
users greater if it were ported and was wondering if anyone of you might
pick up the torch so to speak. Normally I wouldn't have too much of an
issue with porting a project like this, but my graphics backend has already
been written once and I will be adding a few features beyond NanoVG, and
also using a different design. I would rather compare the two, NanoVG
written in Pascal, and my library rather than merge them or at the least be
though of as having copying ideas from NanoVG, so I want to keep these
worlds separate.

If anyone has thoughts about a Pascal version of NanoVG, possibly even from
a more updated git repo, please send you feedback to others in this thread.

Thank you, Anthony.

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


Re: [Lazarus] gdb problems on ubtuntu 19.10

2019-11-02 Thread Anthony Walter via lazarus
If anyone wants to follow along with this problem, I've posted a question
about it on askubuntu here:

https://askubuntu.com/questions/1185729/ubuntu-19-10-gdb-nearly-unusable-long-delay
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] gdb problems on ubtuntu 19.10

2019-11-01 Thread Anthony Walter via lazarus
An update. I installed Linux Mint 19.2 on the same laptop and re-ran my
install script. The problem previously described with gdb did not present
itself. This leads me to believe there is some kind of problem with gdb in
Ubtuntu 19.10, the prior OS I was testing.

>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] gdb problems on ubtuntu 19.10

2019-10-31 Thread Anthony Walter via lazarus
Stripping debug symbols from my test program has no effect. The gdb program
still takes 20-30 seconds to open my text programs written using Lazarus.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] gdb problems on ubtuntu 19.10

2019-10-31 Thread Anthony Walter via lazarus
I know this problem is not entirely Lazarus related, but I'm hoping someone
here might be able to provide some insight.

On a fresh install of Ubuntu 19.10 when running projects from Lazarus with
gdb debugging, any and all projects take anywhere from 20 to 30 seconds to
become interactive after a project has been compiled and run. That is, the
visual forms either do not appear when running, or appear but an
unresponsive for 20-30 seconds. If I run without the debugger the programs
start almost instantly.

When I run the same program from a terminal using gdb manually, I get the
same unresponsive delay.

Does anyone know what the problem might be and how to fix it? I've done a
little google foo searching and have come up empty.

Thanks for your help.

Anthony
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] OSX 64 bit Cocoa + Catalina Installer

2019-10-15 Thread Anthony Walter via lazarus
I have to search my backup drives for some of this code, but I believe I
also added a few extra classes to simplify some of the weirdness of Apple's
classes. For example I greatly simplified the steps needed to work with
CGContext and CGBitmapContextCreate such that it was completely
transparent. A TCGBitmap class was defined (not in the framework, but
wrapping CGBitmapContextCreate), and it would be compatible with
TCGContext, but adding methods for loading, saving, blitting ect.

Also some types have been simplified, NSString becomes regular pascal
string, NSRect/CGRect becomes TRectF, and so on.

Obviously defining all these types is definitely a lot of work, but to
reiterate it does aid in type safety, object management, and discovery (how
to combine the use the Framework objects with each other). One approach to
tackling all this work, if anyone decides it's beneficial, might be to add
it in gradually for what is needed, which is how I am using it right now.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] OSX 64 bit Cocoa + Catalina Installer

2019-10-15 Thread Anthony Walter via lazarus
Dimitry,

What I've done is created a reference counted class hierarchy to match part
of the Cocoa framework. It's only partially done, but it allows Pascal code
to be written to simplify interaction with native OSX frameworks and APIs
like AppKit in the following ways:

Using NSWindow class as an example:
https://developer.apple.com/documentation/appkit/nswindow

* TNSWindow mirrors NSWindow and uses an automatic reference counting
scheme to automatically release objects when they are are no longer needed.

* All methods and properties of NSWindow are provided by TNSWindow and
there is no need to pass native objects as handles to functions. It's
implicit in Self and the underlying handle is manged by TNSWindow ->
TNSResponder -> TNSObject  -> and ultimately TFrameworkObject.

* It uses an object oriented hierarchy the same as the Apple frameworks,
only translated to Pascal objects. That is you can pass a derived class to
methods of other object methods which may expect any less specific class.

* Other classes such as CGContext (TCGContext -> TFrameworkObject) are
provided as well as other Apple frameworks classes, all translated to
Pascal classes with all the same benefits as outlined above.

My implementation isn't complete, which is to say I haven't wrapped every
single Apple framework class in the manner described above. For the
extremely limited amount of translations I did complete, I saw a big
benefit in my own personal projects on OSX. Most notably the way of
organizing code I outlined above allowed me to much more easily understand
how to use Apple's frameworks, reduce errors with type safety and automatic
object lifetime management, as well as aid in the discovery when combining
Apple framework object to accomplish programming tasks. I expect if this
were integrated into the Cocoa widgetset it would make development a bit
easier. Certainly there is a lot of work involved in defining every Apple
framework object in this way, but it provides a certain level of
organization and usability that I at least feel makes a big difference when
working with native Apple APIs.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] OSX 64 bit Cocoa + Catalina Installer

2019-10-15 Thread Anthony Walter via lazarus
Note to all, the install source I posted comes from a random clone of svn
trunk fpc and trunk lazarus put together from whatever was in the svn
repository on Saturday. As such it might contain any number of
potential bugs. That said, the reason trunk sources should be used is that
the Cocoa widgetset is still in a beta state.

Personally I've implemented some OSX core classes in a manner that is much
more elegant manner that what's currently used in the Cocoa widgetset and
if time permits I may propose some of my changes that could push Cocoa
forward in a positive direction. I feel that many of the problems everyone
might be experiencing is tied to the specific implementation state we
currently have. This is not meant as a dig on the Cocoa LCL widgetset
developers, obviously its difficult and tedious work trying to create a
100% compatible and bug free implementation and you work is very much
appreciated so please keep it up! I know well get it working.

On a side note, if anyone reading this message has done some work on
committing widgetset code to Lazarus, either with the Gtk3 or Cocoa
libraries, and would like to coordinate some of my improvements we can take
this discussion to private emails or perhaps freenode irc and we can hash
out merging my work.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] OSX 64 bit Cocoa + Catalina Installer

2019-10-14 Thread Anthony Walter via lazarus
Here is a short video where I demonstrate how to switch between the gdb and
lldb inside Lazarus. I also demonstrate how to move docked windows. There
is no audio, but anyone should be able to follow along.  Interestingly the
Cocoa widgetset throws an exception when a docked window is undocked or
docked again. Would someone be kind enough to submit this issue to Mantis
on my behalf?

https://cache.getlazarus.org/videos/lazarus-lldb.mp4

Thanks.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] OSX 64 bit Cocoa + Catalina Installer

2019-10-14 Thread Anthony Walter via lazarus
Ryan,

To answer your question, I just haven't taken the time to try out lldb yet.
I guess it can be switched to lldb in the Lazarus interface.

About that crash, it probably comes from somewhere in the Cocoa widgetset,
which is currently still in development. It's far along enough to enable
the Lazarus IDE to run, but still has problems. Unfortunately Catalina and
all OSX versions going forward are 64 bit only, and Carbon is 32 bit only,
so we're all going to have to help improve the Cocoa widgetset. The means
were going to need to fix errors like you posted. Hopefully we can get some
patches submitted to Mantis tagged with Cocoa.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] OSX 64 bit Cocoa + Catalina Installer

2019-10-14 Thread Anthony Walter via lazarus
Also, about code signing gdb, my setup script will install it for you using
either Homebrew or Macports, you get to choose. You may want to try these
alternate steps and skip the debugger install steps (the script already
installed it), and proceed with the code signing steps:

https://gist.github.com/hlissner/898b7dfc0a3b63824a70e15cd0180154

https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html

If you used Homebrew, then this bit of code will test if the dnu debugger
is properly code signed:

SIGNED="$(codesign -dv /usr/local/bin/gdb 2>&1)"
echo $SIGNED

And on Macports use this code:

SIGNED="$(codesign -dv /opt/local/bin/ggdb 2>&1)"
echo $SIGNED

Unsigned gnu debuggers will include this text in $SIGNED:

"object is not signed"
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] OSX 64 bit Cocoa + Catalina Installer

2019-10-14 Thread Anthony Walter via lazarus
Martin,

Yes I read the message requesting lldb testing the other day. I haven't
taken the time to test it yet, but as I understand it's a great project
that will hopefully allow for better debugging (such as inspecting and
changing properties at runtime) but is still missing some important
functionality.

About code signing the gnu debugger, yes this page hopefully will help you
get started, but I understand it can be a bit finicky.

https://www.getlazarus.org/setup/macintosh/

Most of those steps apply, but the steps to stop the gatekeeper service and
restart it may vary a bit depending on your OSX version.

Additionally, there may be a more related problem for OSX Catalina users,
as it now is forcing non CLI applications from sources other than the
official app store to be notarized before being allowed to run. The same
gatekeeper service is responsible for this on Catalina. Apparently it can
take hours to generate a certificate for you program.app files, and you
need to manually insert xml data into the plist data. I've read that Apple
has suspended this requirement until sometime in 2020, giving developers
more time to adjust, but to me it seems rather draconian.

Here is a useful tip though, according to the first comment on a recent HN
article you can bypass notarization checks when running your visual apps by
right clicking them and selecting open the first time:

https://news.ycombinator.com/item?id=21179970

If that doesn't work I've heard holding alt when left clicking your
program.app will also bypass notarization checks.

And finally, Ryan Joseph put together this useful information and github
page related to fpc Catalina development:

https://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg51807.html

The short of all this information is: We need more testing.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] OSX 64 bit Cocoa + Catalina Installer

2019-10-14 Thread Anthony Walter via lazarus
Testers need.

I created a new installer for OSX that includes a 64-bit only Cocoa version
of FPC and Lazarus. I don't have Catalina installed, so I am looking for
testers and any variety of OSX.

The installer is a shells script that will walk you through Xcode, Homebrew
or Macports, as well as setting up the debugger. You will also be prompted
for a install folder that defaults to $HOME/Development/FreePascal, but you
can change the install path during installation.

This setup will use configuration files inside of their own folder and will
not interfere with you existing versions of Lazarus as long as you donot
choose the same folder as your already existing fpc and lazarus locations.
To uninstall simply delete the folder you choose for install.

Download setup.sh from:

https://www.getlazarus.org/download/?platform=macintosh

Then ...

chmod +x setup.sh
./setup.sh

After installation is complete you will get convenience lazarus.app file in
you install folder which can be moved anywhere including to your
Applications folder.

Please note, this setup program installs a 64 bit fpc and lazarus with
Cocoa only. It does not install a 32 bit fpc and does not use the Carbon
widgetset.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Default color of form in RGB?

2019-10-13 Thread Anthony Walter via lazarus
Okay, you made me laugh, but I hope you were joking. Just to be clear I
don't mean to ask how to get the color of something on my screen, I meant
how to calculate at runtime the default color of a form in RGB on all
platforms without having to take a screenshot of the form.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] OSX Catalina removes 32-bit and Carbon. Options?

2019-10-10 Thread Anthony Walter via lazarus
So it would seem that OSX Catalina entirely removes support for 32-bit
applications and the entire Carbon toolkit. That means that Lazarus
on Catalina will only work with 64-bit applications and the Cocoa toolkit.

Where does this leave Lazarus? Does the Lazarus IDE compile and operate as
exepcted using the Cocoa widgetset? Are there some big gotcha's with the
Cocoa version of Lazarus in it's current state? Last I heard context menus
didn't work. Is there anything else?
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] JsonTools issues in GH

2019-10-02 Thread Anthony Walter via lazarus
Thank you for posting that. I hadn't reviewed these issues at all until
right now. It looks like all the issues posted aren't actually issues, save
for the dual license request. All issues posted all already covered in the
comments embedded in the original source. I will update them forthwith.

Anthony
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Feedback requested: File Search, a visual file search utility

2019-09-27 Thread Anthony Walter via lazarus
Bart,

Thanks for suggesting TMaskList. I added it in and it works much better
than the normal FindFirst pattern matching. It also allowed me to remove
the duplicate checking.

Regarding TShellView, you might want to look at my Shell Control library.
It is explorer for Windows, as well as a few other controls including a
shell path with breadcrumb drop down menus, and a shell bubble type control
for listing common folders. The source code is Windows only, but it's now
available for free:

https://www.codebot.org/shell/
https://www.codebot.org/delphi/?doc=9613

and sources:

https://gitlab.com/sysrpl/codebot.shell

Feel free to modify the sources to work under Lazarus.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Environment monitoring software on Linux?

2019-09-26 Thread Anthony Walter via lazarus
>From what you describe it would seem a simple script or program invoked
through cron would be the best way to tackle this problem. Another option
is the watch command, which can execute a program every x intervals. And of
course if you want to kick off a process when run, you can add a script to
init.d or ~.profile. Finally, you also have the option of using ssh and
tmux. Tmux allows programs to run between logins, that is connecting and
disconnecting to your linux system you can check on a long running program
or even an pseudo tty using tmux.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Feedback requested: File Search, a visual file search utility

2019-09-25 Thread Anthony Walter via lazarus
Thanks. I'll look into TMaskList. I assume you mean this bit of code?

https://github.com/alrieckert/lazarus/blob/master/components/lazutils/masks.pas

I am not sure how much this slows things down, and the checking if a file
has already been added only happen on per directory basis, meaning the list
is emptied with each folder and the search if already exists is reset to
zero each time search enters a new folder. I will look into this though.

Thank you for your feedback.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Feedback requested: File Search, a visual file search utility

2019-09-24 Thread Anthony Walter via lazarus
If anyone is interested I've posted another hopefully useful program along
with the source.

https://www.getlazarus.org/apps/filesearch/

The File Search utility is a stand alone tool for Mac, Windows, and Linux
to search for files using a variety of criteria including containing text,
file size, and file dates. The full source code is available on github and
it has no dependencies other than the LCL, so anyone should be able to
compile with a default installation of Lazarus.

I believe the program is bug free and pretty much feature complete per my
original idea. If anyone would like to leave a comment of make a suggestion
I'd open to your ideas.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Best examples of cross platform visual file or folder search application?

2019-09-12 Thread Anthony Walter via lazarus
Thank you for the replies. I think what I was getting at is not the code
related to such a program, but the user interface design and popularity of
such a program. I think most of you remember Microsoft implemented a file
search into XP featuring an animate dog and a small form:

https://i.stack.imgur.com/vZbcr.jpg

But since Vista it's been replaced with a simplified edit box and many
search options are either hidden or harder to use. I've already written a
working cross platform search program (image of it below), but don't
understand why I can find this type of user interface design in any current
desktop OS or in the form of a tiny popular 3rd party program. Is it that
users don't want a file / folder search form, or that at some point an OS
dropped this kind of functionality and everyone else followed suite by
copying them and removing file / folder search forms? Do you people prefer
no file / folder search forms in your desktop OS?

https://cache.getlazarus.org/images/filesearch.png
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-31 Thread Anthony Walter via lazarus
Michael,

Internally JsonTools just stores the document as JSON fragments or text, in
the case of object, array, or null, the text is empty, but in the case of
number or bool, it converts the text to a number or bool when you ask
AsNumber or AsBoolean. Now normally this wont be a problem because as you
read a document you'll read a particular node possibly once as you hand it
off to some other system, be it a database insert, a subroutine, or other
use.

In practice what's happening is I am delaying the conversion until it's
needed, which makes my parser faster when just parsing a document. If you
need to use the node value as a number or a bool, then the cost of the
conversion happens at that time, but if you don't need to use a particular
field there is no conversion cost. This is one of the reasons my parser is
faster. I still validate the number, bool, and other fields but I don't
convert until needed. The downside, as you've seen is that converting the
same value over and over again results in longer execution time. That said,
if a user request every field as a number or bool once when processing an
incoming request (say you are writing a REST service) then the performance
would equal out and the speed difference would favor the faster parser.

A side benefit of storing JSON fragments is that the node kind can be
changed easily without the need to remove an item from an internal list,
destroy the class, create a new one of a different class, apply a copy of
the original name, and reinsert.

Of course this lazy evaluation of numbers and boolean scould be improved by
caching the conversion once calculated (e.g. StrToFloat) and reusing the
conversion in any subsequent calls. For now I will keep it simple as is as
I feel for most cases the user will either not need the conversion, or need
it once, and the performance lost in invoking it many times wills be made
up for in all the times the conversion is never used.

Real world examples of never used JSON fields:

Calling most web REST methods which return JSON as a web result where the
caller is only interested in success or failure with a message.
Acting as a RESTful service where many JSON request bodies use optional
values that are meant to be skipped.
Retrieving settings where and option is never used, yet stored, such as a
dockable or floating pallet position that is always left closed.

And so on...
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-31 Thread Anthony Walter via lazarus
> Could you include https://github.com/BeRo1985/pasjson in the comparison?

Sure. I also have a few other people have requested. I will also list the
license of each in the first table.

Regarding a huge gigabytes of JSON in a file, I know a small portion of
programmers of people might be inclined use it as an offline database
format much like CSV. Even though by far most JSON is used with
XMLHttpRequest, REST APIS, or storing settings and configurations, there
are bound to be endless requests for use cases with JSON.

For example to accommodate the reading a huge files as indoividual records
a helper class operating outside the definition of a JSON parser could
accomplish this goal. For example, it would be relatively easy to write in
a separate file:

type
  TJsonStreamReader = class
  public
constructor Create(Stream: TStream; OwnsStream: Boolean = False);
constructor CreateFromFile(const FileName: string);
destructor Destroy;
function Read(out Parser: TSomeJsonParser): Boolean;
  end;

Then use as ...

var
  R: TJsonStreamReader;
  P: TSomeJsonParser;
begin
  R := TJsonStreamReader.Create(InputStreamOrFileName);
  try
while R.Read(P) do
  // Read JSON record here
  finally
R.Free;
  end;
end;

And in this way a large file could be read in small blocks and given back
to the user as a parser to allow for processing of individual records. The
benefit of breaking this into its own class is that you do not need to mix
in every possible use case into the parser. You can simply write separate
use cases into their own independent units, rather than trying to make a
super class which handles every possible concern.

For example if wanted to store object state using RTTI in a JSON file,
create a separate TJsonObjectState class to handle this for you. Or if you
wanted to create a database table from a JSON file, or create a JSON file
from a database table, then again write this into its own class.

The point is, saying this JSON class does lots of these things is the wrong
approach (IMO), as these use case scenarios as likely endless and would add
unnecessary cruft to a parser. Even designing a plug in or other extensible
seems unnecessary, when simple separate classes to add functionality works
as well without all the complexity.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-31 Thread Anthony Walter via lazarus
Okay, going back and looking through the messages I see you did post a test
with:

{$codepage UTF8} and uses cwstring

Here are the results with that added:

On Linux using {$codepage UTF8} by itself causes both tests to fail. Adding
cwstring causes both tests to work. On Windows trying to use cwstring
causes the compilation to fail, but with {$codepage UTF8} added the tests
work. I will try a few more tests, but there should be an "out of the box"
option to get FPJson working without the need to add ifdefs along with
extra directives added outside of the FPJson units themselves.

I will write a few more unicode tests, perhaps with 4 byte character
strings, and some other potential unicode problems to be sure both are
working before we come to a final resolution.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-31 Thread Anthony Walter via lazarus
Michael, I hadn't tried your example code yet as I thought the discussion
was on the topic of the unicode failure, and your example was about parsing
speed. I'll be happy to take a look at speed improvements, but like you I
am interested to find our what's failing with VerifyUnicodeCharsFPJson.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-31 Thread Anthony Walter via lazarus
If there is any chance the char codes are being altered through whatever
browser / mail client you are using, here is a direct link to the program
source:

https://cache.getlazarus.org/projects/test.lpr
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-31 Thread Anthony Walter via lazarus
Michael, regarding this unicode problem, all the code has already been
posted in this thread.

program Test;

uses
  FPJson, JsonParser, JsonTools;

const
  UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae
" }';

function VerifyUnicodeCharsFPJson: Boolean;
var
  N: TJSONData;
begin
  N := GetJSON(UnicodeChars);
  Result := (N.Items[0].AsUnicodeString = 'Joe®Schmoe') and
(N.Items[1].AsUnicodeString = 'bank teller ® ');
  N.Free;
end;

function VerifyUnicodeCharsJsonTools: Boolean;
const
  UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae
" }';
var
  N: TJsonNode;
begin
  N := TJsonNode.Create;
  N.Parse(UnicodeChars);
  Result := (N.Child(0).AsString = 'Joe®Schmoe') and (N.Child(1).AsString =
'bank teller ® ');
  N.Free;
end;

begin
  WriteLn('FPJson Handles unicode chars correctly: ',
VerifyUnicodeCharsFPJson);
  WriteLn('JsonTools Handles unicode chars correctly: ',
VerifyUnicodeCharsJsonTools);
end.

Output:

FPJson Handles unicode chars correctly: FALSE
JsonTools Handles unicode chars correctly: TRUE

Tested on both Linux and Windows with the same results. Differing versions
of FPC on differing platforms and other people have verified the same
result. Try the tests yourself. Maybe you can figure out what's going wrong.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
Okay, so I turned on my Windows VM with a different version of FPC and ran
VerifyUnicodeChars with both FPJson and JsonTools. The resutls are the
same. JsonTools sees the unicode correctly, and something is wrong when
using FPJson. I don't know what the problem is, but other people are
noticing similar issues, so it would seem there is definitely a problem
resulting in a failure for FPJson.

Michael, you have all the information needed to find out what's wrong and
I'd be curious to learn why it's not working.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
For those tracking the unicode issue, could you please verify the problem
does not present in my JsonTools library on compiler revisions and
platforms? I always get true (passed) with my library, but not with any
other library. Here is the relevant test:

function VerifyUnicodeChars: Boolean;
const
  UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae
" }';
var
  N: TJsonNode;
begin
  N := TJsonNode.Create;
  N.Parse(UnicodeChars);
  Result := (N.Child(0).AsString = 'Joe®Schmoe') and (N.Child(1).AsString =
'bank teller ® ');
  N.Free;
end;

begin
  WriteLn('Handles unicode characters correctly: ', VerifyUnicodeChars);
end.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
I am not sure how under any situation parsing a JSON from a stream source
would be any faster than parsing a string. Also with regards to timing I am
not sure how accurate Now is. For this purpose I've written:

{ Return a time based on system performance counters }
function TimeQuery: Double;

Implemented as:

const
{$ifdef linux}
  libc = 'libc.so';
{$endif}
{$ifdef darwin}
  libc = 'libSystem.dylib';
{$endif}
function gettimeofday(out TimeVal: TTimeVal; TimeZone: PTimeVal): Integer;
apicall; external libc;

var
  TimeSec: SysInt;

function TimeQuery: Double;
var
  TimeVal: TTimeVal;
begin
  gettimeofday(TimeVal, nil);
  if TimeSec = 0 then
TimeSec := TimeVal.Sec;
  TimeVal.Sec := TimeVal.Sec - TimeSec;
  Result := TimeVal.Sec + TimeVal.MSec / 100;
end;
{$endif}

{$ifdef windows}
const
  kernel32  = 'kernel32.dll';

function QueryPerformanceCounter(var Counter: Int64): LongBool; apicall;
external kernel32;
function QueryPerformanceFrequency(var Frequency: Int64): LongBool;
apicall; external kernel32;

function TimeQuery: Double;
var
  C, F: Int64;
begin
  F := 0;
  C := 0;
  if QueryPerformanceFrequency(F) and QueryPerformanceCounter(C) then
Result := C / F
  else
Result := 0;
end;
{$endif}
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
Alan, oh that's a good idea. I will do that as well as add a few more
parser libraries as requested by a few people in other non mailing lists
threads. I will also try to find out what's going on the unicode strings as
it might be a problem with the compiler.

Michael,

I am on Linux as well, but I will test under Windows and Mac too.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
On my system with FPJson the test is failing it failing on "bank teller
\u00Ae ", but on when using approximately the same code with JSONTools it
passes on both "name" and  "occupation" always. What do you think is going
on?
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
Michael,

Can you tell me why the second half (N.Items[1].AsUnicodeString) this test
fails? This is the part that decodes "bank teller \u00Ae ".

function VerifyUnicodeChars: Boolean;
const
  UnicodeChars = '{ "name": "Joe®Schmoe", "occupation": "bank teller \u00Ae
" }';
var
  N: TJSONData;
begin
  N := GetJSON(UnicodeChars);
  Result := (N.Items[0].AsUnicodeString = 'Joe®Schmoe') and
(N.Items[1].AsUnicodeString = 'bank teller ® ');
  N.Free;
end;

begin
  WriteLn('Handles unicode chars correctly: ', VerifyUnicodeChars);
end.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
Michael,

I have a hurricane headed my way, but when I'm done evacuating I'll send
you a copy of my test. If you want to make improvements to the test program
to be sure the manner in which I am using the FPJson functions and classes
is correct and send me a revised test program, then that would be awesome.

Thanks
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] [fpc-pascal] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
With regards to duplicate key names, some libraries allow for the same key
to be parsed resulting in multiple child nodes of the same name. Others
throw an exception when parsing an object with a duplicate key name.

The correct way to handle duplicate keys is to overwrite the existing key
when a duplicate is encountered.

My library does have Save/Load To/From /File/Stream. Please see the
articles I posted. They are listed there.

Unicode support exists in both allowing unicode to be in the JSON, and
escape inotpced e.g. \u00ae becomes ® a two byte utf8 encoding char when
parsed by my parser. It also saves/load that utf8 encoding to steams or
files.

Regarding indentation and formatted, I support two options as noted in my
original article. The AsJson property create spaceless compact JSON
suitable for network traffic, while the Vale property allows for friendly
human readable formatting and indentation. Currently the friendly
indentation is fixed and I doesn't see a reason use case reason to allow
for custom indentation beyond what I already provide.

And finally regarding the unicode failure of FPJson, I am parsing a small
bit of JSON ...

{ "name": "Joe\u00aeSchmoe"}

And compare it to the value of 'name' to the string constant  'Joe®Schmoe'
in pascal code. If fails the first iteration, but if I run it a second time
it works, so there is something amiss.

And finally with regards to plugins and extensiblity, that's great to have,
but I am just trying to write something that handles the JSON spec and only
that. If I want something to stream a form layout or settings to JSON it
would be a separate wholly independent library that depends ona parser, but
isn't part of the parser library.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
Alexey,

Currently JsonTools anything that is valid JSON as described on this page:

https://www.json.org/

The only valid constants are: null, true, false
Arrays can contain other arrays and object to any reasonable level
  [[[]]] //  is a valid array
  [{}{}[{}{}]] // is a valid array
Objects can contain other objects and arrays to any reasonable level
  {"a":{"a":{"a":[[]]}}} // is a valid object

I will look into you request for comment support, even though comments are
not allowed in the official specification.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Tests results of several pascal based JSON parsers

2019-08-30 Thread Anthony Walter via lazarus
I've posted a new page that tests the speed and correctness of several
pascal based JSON parsers.

https://www.getlazarus.org/json/tests/

In full disclosure I am the author of the new open source JsonTools
library, and even though my parser seems to a big improvement over the
other alternatives, my tests were not biased.

If anyone would like help in replication the tests, let me know and I'll
see what I can do.

Also, to be thorough, you should read through both the article I posted at
the top this message, and my original page 
which has been updated with more information. Both pages took some time to
write, and I promise if you read through them some of your questions will
be answered without having to ask others for help or insight.

Thanks,
Anthony
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Anthony Walter via lazarus
In C# to define a property you write:

visibility typename propname { [visibility] get; [visibility] set; }
-or-
public int Age { get; set; }

This means you have a read write property that does nothing special. You
could also write ...

private int age;
public int Age { get { return age; } set { if (value > -1) age = value; } }

To use private a backing with code invoked to set or get. And finally you
can also write:

public int Age { get; private set; }
-or-
public int Age { get; private set; }
-or-
public int Age { get; protected set; }

To limit access to either a setter or getter of a property.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Anthony Walter via lazarus
I use FPC for a lot of web stuff, but generally not for servers. In this
project I am using an FPC program to create the database and download
updates using my TClientSocket class.

For long running stuff, which I may typically host on an Amazon cloud
server with Linux, I'll generally either use something from a package (apt
or docker) or write a custom service in C# hosted in Kestrel or Apache.

Don't worry though, I spend most of my time writing desktop apps, and for
that nothing beats FPC + Lazarus ;)
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Anthony Walter via lazarus
Yes, in C#. Personally I find ASP.NET or Core easier to use than a CGI
executable. Also the ability to dynamically compose anonymous objects,
write linq expressions, and use reflection can be quite powerful.

The object formatting system is C#, where everything is an object and
custom formatters can be easily added, allow for the same formatting
strings in both compiled code and external template files.

As is right now, the only time consuming or potentially difficult part is
writing html / css. As I mentioned html / css can be a time sink depending
on how much design, taste, and effort you want to put into the actual page
spit out in the end.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Anthony Walter via lazarus
Michael,

Here is an example of how easy it is.

public class CodeSearch : TemplateHandler
{
private static readonly string searchSql =
"search.sql".LoadResourceText();

protected override void Run(Templates templates, StringBuilder
output)
{
SearchItems = DataCommand
.Prepare(searchSql)
.Add("@phrase", Read("phrase"))
.Compose();
templates[Read("format") + "SearchItem"].FormatObject(this,
output);
}

public IEnumerable SearchItems { get; set; }
}

So given the url,
https://docs.getlazarus.org/?method=codesearch=xml=TStringList in
steps:

1) The library automatically finds the CodeSearch class without any code to
write
2) It runs the template handler automatically
3) In run we execute some SQL to search for a phrase and compose the
results as a collection of anonymous objects
4) The we select the template we want and format the CodeSearch object and
its available properties, in this case our search result "SearchItems".

The FormatObject method is a template engine that uses reflection to lookup
properties with mustache braces. It has the ability to query subproperties
and use all available format specifiers. Collection properties (IEnumerable
) are expanded by a detail template that can read through reflection the
properties of the anonymous objects in the collection by name and template
them as well.

Here are some template examples. Note you can access sub properties using
object.suprop.susubprop syntax as well as custom formatting in the template
(i.e. Price:C2 or Page.Modified:y-mm-dd).

{Title} or {Page.Title} // Welcome to our
website
Price is {Amount:C2} // Price is $15.75
Page modified on {Page.Modified:y-mm-dd} // Page modified on
2019-07-10
{SeachItems} // Expands our template
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-11 Thread Anthony Walter via lazarus
Ryan,

My sites are built on my custom web class library that optionally uses
templates to generate content. Templates are simple fill in the blank page
type text files which use reflection to pull properties of a objects into
the template.

Here is how a template is formatted:



Search Results: {Phrase}



{SearchItems}



And a template file for the search item:


{Bolden}
{Kind}
{Description}

If you want something specific with regards to layout, just send me a
custom template and possibly a css file to make it look however you want.

Since I have written this web library myself, its very easy to modify and
extend. I might add the ability for anyone to send their own templates and
browse or select from templates directly on every page, but that extension
is not likely to happen in the next few days.

If anyone is interested let me know and I'd produce a short instructional
video on how the my web library makes developing web pages easy. The only
hard part is writing html and css, which for plain stuff isn't hard at all
really. But html and css are design work, so you get out of html and css
work is whatever kind of design, taste, and effort you put into it.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-11 Thread Anthony Walter via lazarus
Ryan,

I was going to modify my project to allow for RESTful queries, when I
realized it already does this. The url and format are as follows:

https://docs.getlazarus.org/?method=codesearch=TStringList

Alternate request for xml format:

https://docs.getlazarus.org/?method=codesearch=xml=TStringList

Currently there is no custom formatting applied as this is meant to be an
AJAX request to create populate suggestions. As this is an API like RESTful
function is this good enough for you or do want a "pretty" result format?

Here are the templates, which I could easy swap out based on another
request parameter:

Page uses this template as an html fragment:

{SearchItems}

Results collection uses this template:


{Bolden}
{Kind}
{Description}

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


Re: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug

2019-08-09 Thread Anthony Walter via lazarus
The WS classes are very difficult to work with IMO. I've used them and they
are just messy, as in difficult and not exactly straight forward or
intuitive. I'd have to look them over again to put my finger on exactly
what's hard to use about them, but I distinctly remember having unnecessary
trouble with them. With regards to code size I believe the way it works
with WS classes and how it could only work with static linking is to make
use of defines and conditional uses that is hopefully limited to only one
place.

The way I image interfaces working is that they serve as contracts. One
master library unit file would define the interfaces which represent the
entirety of every function of a window manager. That is managing windows,
handling the mouse, keyboard, painting, and some common ideas such as image
lists, canvas, fonts, printing, then a platform implementor writes concrete
implementations of those. Native control interfaces for widgets such as
TEdit, TButton, TTreeView, TPageControl would be independent interfaces
defined in a cross platform control interface unit, but registered by name
with the window management so that their function could be loaded by
matching a window class name in the Params of WindowManager.WindowCreate().

Anyhow, to change anything now would mean a complete rewrite and at this
point it would be a huge undertaking to say the least.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug

2019-08-09 Thread Anthony Walter via lazarus
Marc,

I can completely understand how it evolved, and early on the features of
both the Free Pascal language, and the way the LCL library were to be
adapted to multiple platforms became more clear. Thanks for your hard work.

I've thought about the way the LCL is structured to handle many platforms
for quite some time now, and if it were remade I'd strongly prefer it if
every platform and native control were implemented through a set of well
defined platform agnostic interfaces. Then each platform would adhere to
that interface in order to implement it in classes such as TGtk2Canvas,
TGtk2Window, and TGtk2WindowManager. Of course this would never happen, as
it would mean a complete rewrite of everything, but perhaps someday someone
might want to remake a new non Delphi compatible library from scratch for
FPC and carry forward with this idea.

For example:

ICanvas = interface
  function MoveTo(X, Y: Integer): Boolean;
  function LineTo(X, Y: Integer): Boolean;
  ...
end;

IWindow = interface
  function Show: Boolean;
  function Hide: Boolean;
  function GetBounds(out Rect: TRect): Boolean;
  function SetBounds(const Rect: TRect): Boolean;
  function GetText(out S: string): Boolean;
  function SetText(out S: string): Boolean;
  ...
end;

IWindowManager = interface
  function WindowCreate(const Params: TWindowParams; out W: IWindow):
Boolean;
  function WindowDestroy(W: IWindow): Boolean;
  function BringToFront(Window: IWindow): Boolean;
  function SendToBack(Window: IWindow): Boolean;
  function GetCursorPos(out P: TPoint): Boolean;
  function SetCursorPos(const P: TPoint): Boolean;
  ...
end;
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Nice Lazarus ScrabbleControl, also a Gtk2 Bug

2019-08-09 Thread Anthony Walter via lazarus
While demonstrating objects to kids in my computer programming classes for
kids this summer, I wrote a Scrabble board game control. It's on Github
right now released under the LGPL.

Here is a brief video demonstration:

https://cache.getlazarus.org/videos/scrabble.mp4

The Github page for this free control is here:

https://github.com/sysrpl/Lazarus.Scrabble

Also, I found a bug with the LCL that prevents arrow key processing on Gtk2
(and maybe Gtk3) which I've written up here:

https://bugs.freepascal.org/view.php?id=35942
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-09 Thread Anthony Walter via lazarus
Ryan, that is a good idea and I can absolutely add a search page that pulls
a string from RESTful query string and returns a friendly hyperlinked
summary of the most useful results. Also, I don't know if you know this,
but you can edit Lazarus settings to open up https://docs.getlazarus.org to
the appropriate page when you press F1 on any identifier in the code editor.

Tools -> Options -> Help -> Help Options
  set StartPage / BaseURL = https://docs.getlazarus.org/
  set RTLUnits / BaseURL = https://docs.getlazarus.org/rtl/
  set FCLUnits / BaseURL = https://docs.getlazarus.org/fcl/
  set LCLUnits / BaseURL = https://docs.getlazarus.org/lcl/
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Lazarus Release 2.0.4

2019-08-06 Thread Anthony Walter via lazarus
Wow! Thanks for hard work, it's very much appreciated and congratulations!
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


  1   2   3   >