Live data from Hacker News

Lazarus IDE 3.0

forum.lazarus.freepascal.org

61–70 of 78 posts

Re: Lazarus IDE 3.0

#61

This wont be part of a Lazarus release any time soon (ok, it might be in 4.0 but i don't know when 4.0 will happen) as it is only on trunk, but recently i was fixing bugs for the Gtk1 backend. The neat bit is that Gtk1 is very small and while it isn't preinstalled anywhere nowadays (except Slackware) you can carry the .so as they are around 5-6MB or so. However it also supports static linking and after some quick hac…

Does FPC avoid using versioned symbols from glibc that would prevent it from running on distros without a recent glibc, unlike any C/C++ program compiled using system libc headers? This is a particular problem with recent Slackware-current: I used to compile portable x86/64 linux binaries (from C+C++ sources or from FreeBASIC compiled to C) by patching out those versioned symbols using ld --wrap= flags, but since gli…

I think there was some effort to allow specifying versioned symbols or something along these lines that was inspired by some breakage introduced by a recent glibc, but i don't know where that went.

However the safe and really recommended approach is to link against older libraries (easiest way is to use a VM running an older Linux distro), like with C and C++. Free Pascal is largely self-contained so Free Pascal on an older distro is trivial and even if you have to build from source it is just a couple of commands.

Re: Lazarus IDE 3.0

#62

This wont be part of a Lazarus release any time soon (ok, it might be in 4.0 but i don't know when 4.0 will happen) as it is only on trunk, but recently i was fixing bugs for the Gtk1 backend. The neat bit is that Gtk1 is very small and while it isn't preinstalled anywhere nowadays (except Slackware) you can carry the .so as they are around 5-6MB or so. However it also supports static linking and after some quick hac…

Would this GTK1 version work with Windows as well?

I'm using this[0] version of Gtk which (AFAIK) is the latest stable Gtk 1.2 with Slackware's patches (gdk_pixbuf isn't the latest version, but i patched it to compile).

I do not see any Win32-specific code in there though, so it wouldn't compile. It might be interesting to try and make a Win32 backend (Gtk 1.2 was ported to Win32 but i think the port lived out of the main tree), especially a Win9x compatible one for retrocoding :-P. Though for Lazarus use it'd also need modifications on LCL/Gtk1 as in many places it uses X11 directly (and when it comes to retrocoding FPC and Lazarus do not support Win9x anymore, only Win2K and later).

[0] http://runtimeterror.com/pages/badsector/gtk12/

Re: Lazarus IDE 3.0

#63

i wish for lazarus IDE, but with golang XD

Me too. But deploying to web unless it's a Steam game, console game, video editor, DAW, audio-editor, 3D-modeller or graphics editor seems to be the way to go. But mostly they would benefit from heavy GPU use and something like OpenGL or Vulkan.

An IDE similar to Lazarus, that creates executables for those non-web cases, and has the GPU in mind, and supports Go (+ Rust, Zig, Mojo, Swift, Nim, Crystal, Odin and Hare), would be fun.

Re: Lazarus IDE 3.0

#64

Earlier quoted context omitted.

IMO there are two main reasons nowadays to check codegear's IDEs: you either have some huge Delphi codebase that you can't move anywhere else or you want C++ support with a full RAD IDE (i do not think there is anything as RAD-y as C++ Builder). QtCreator is a workable alternative though. Well, there is a third reason, you want to have some company to blame (and ask help from) when things break :-P

RAD, now there's a term I haven't heard in 10 years. Can you unpack how one modern compiled language can be more RAD than another? I thought it just meant having an IDE.

Part of what signaru described but in Lazarus/FPC (and Delphi) it actually generalizes more - it isn't just the GUI that you can edit visually in the IDE and you aren't just editing some sort of visual stand-in/proxy: instead what the IDE edits is "live" object instances, there is support for properties at the language level as well as enough RTTI and metaclass functionality to be able to reflect an object's making and state at runtime, which allows for things like object serialization and editing said live object instances via property editors. In Lazarus (and Delphi) programs are made up of "components" (which are just subclasses of the TComponent class) and these components lie inside "packages" which are basically libraries - the same libraries your program will use - that are linked against the IDE. The libraries register the classes with the framework and the IDE (which is written against its own framework) queries the registered classes and can use them in the visual designers: when you place a component on a form you are creating an instance of a registered component class, the properties of that instance show up in the object inspector allowing you to edit them in place. When you save the form, the objects in it are serialized to the form file.

This is how the GUI editing works, but there is more to that since components do not have to be visual elements. For example check this screenshot[0], this shows some components from a package i have written that i use across various tools (mainly 3D related). The edited form (which btw is a component itself) has a visual component that represents a 3D viewport (the big black box) and four non-visual components, a component that represents a fragment/vertex shader pair for OpenGL, a component that provides undo/redo management, a component that represents a manager for all viewports and a component that can be used to render multiple viewports at the same time. The first component (the shader pair one) has its properties shown in the object inspector at the left with a "strings" editor opened for editing the FragmentCode property (which is a collection of strings meant to represent lines in an editor) and shows some GLSL code. The undo manager has its own properties and two of them are "UndoAction" and "RedoAction", meant to be assigned to "TAction" instances that will be automatically updated whenever undo events are handled. TAction is a non-visual component provided by Lazarus itself that can be used to represent GUI actions that can be invoked via various places (e.g. menu items, toolbar buttons or programmatically) so that instead of writing code against menu items, buttons, etc directly you write the code against the action and then associate the action with the menus, buttons, etc you want.

Another thing to note is that so far i mentioned GUIs but Lazarus (and Delphi) is not limited to that. As i wrote above a form (window) itself is also a component but there are also non-visual "toplevel" components too: data modules. These can contain only non-visual components (and you can even use them in non-GUI applications, e.g. command line applications or web applications). Some are used to "RAD" only meaning GUI editors and might find that weird, but if you take all of the above in consideration, it becomes obvious that since you can edit non-visual objects in a form via the IDE you may also want to be able to edit only non-visual objects in a non-visual container (which also allows making programs without a GUI while still being able to edit objects visually via the IDE).

In fact one may use the aforementioned actions but placing them inside a data module instead of a form, thus separating the logic of the program from its GUI while still being able to take advantage of the IDE's visual editing functionality.

In a way it is similar to how some game engines like, e.g. Unreal Engine, work (though UE needs a preprocessor to generate the class information while Lazarus/Delphi use language features) and is probably among the closest you can get to a Smalltalk-like environment without being able to serialize the entire environment to disk and instead working on a traditional "edit, build, run" cycle with clearly separated "editing" and "running" states.

[0] https://i.imgur.com/Yw1tTcD.png

Re: Lazarus IDE 3.0

#65
post #56

Earlier quoted context omitted.

RAD, now there's a term I haven't heard in 10 years. Can you unpack how one modern compiled language can be more RAD than another? I thought it just meant having an IDE.

In the context here, it is about rapidly making a GUI by visually editing widgets, usually via drag and drop, pretty much like placing shapes in a power point slide. The IDE doesn't just contain a source code editor, but also that visual window/form "designer" (in Visual Studio jargon). The RAD IDE generates the GUI code from what you've drawn, instead of you having to manually type it yourself, hence the "Rapid" par…

Note that in Lazarus / Delphi things aren't exactly like that: while the IDE does generate some code, it is largely declarations for the object instances and event handles. There is no code generated for building the GUI itself, instead the framework uses language features like the RTTI and metaclasses to implement object serialization and the IDE is modifying live instances. Check my sibling comment to yours for more details.

Also note that Lazarus has way more layout functionality than what you'd see in, e.g. WinForms (in fact IIRC WinForms is even more limited than the version of Delphi that existed around its introduction). In addition to a simple "Align" property (which existed in Delphi and also has something similar in WinForms) that allows placing components at the edges and/or center area of a container (which already allows you to do a lot of layouts, e.g. many "vbox"-like layouts in other toolkits can be done in Lazarus/Delphi by setting the Align property to "alTop" or "alBottom" in all of the container's children - similar with "hbox"-like layouts by using "alLeft" or "alRight") it also has an "anchor" functionality that allows either anchoring the edges of control in place (so that, e.g., if you resize a form and you have a button anchored to the left and right sides, it will be resized horizontally) or specifying how controls relate to each other via their edges. This allows you to do things like having one button have its right edge anchored 10 pixels from to the form's right edge, its left edge not being anchored anywhere, a listbox's right edge anchored 5 pixels from the button's left edge and a bunch of other buttons having their left and right edges anchored to the left and right edges of the first button while their top edges are anchored to one of the other buttons so they form a stack. Almost all controls have an "AutoSize" property which allows them to resize themselves automatically (often to fit their contents - or, for containers, their children), which essentially means that you get automatic layout that works when forms are resized and regardless of font sizes, etc. When anchors are not enough, all containers have a ChildSizing property which allows you to specify some simple automatic layouts for children, like using row-major or column-major ordering, having them use the exact same width and/or height, etc. Finally if none of these are enough, there are some other layout-related controls like a splitter (which automatically adjusts the width of controls laid out via the Align property), pairsplitter (which provides a container with a splitter in case Align isn't enough), flow panel (which lays out children in various ways like, left to right, right to left, top to bottom, bottom to top, etc with wrapping based on rules you set for each child), scroll box (which is basically a container with automatic scrollbars when the contents do not fit), etc.

Also note that all the above are done visually without any code, though of course you can also write code if you want. It is just that it is way more rare to need to do that, especially when compared to WinForms or (worse) classic VB.

Personally whenever i make a GUI in Lazarus i place the controls manually approximating how i want the layout to be and then open the anchor editor and start assigning relations. This is enough for 99% of the layouts.

Re: Lazarus IDE 3.0

#66
post #57

Years ago I was discouraged that there is a lack of a grid component like WPF's Grid or Delphi's TGridPanel. Something that I can specify the number of rows/cols and their sizing. Has this changed since? Or perhaps this is achievable nowadays with (nested?) TFlowPanels?

If i understand what you mean, i don't think you need TFlowPanel at all and you can just use a regular TPanel (for small grids) or TScrollBox (if you want scrollbars) and modify ChildSizing with Layout set to cclLeftToRightThenTopToBottom and ControlsPerLine to the number of columns you want. You can also set the spacing properties to allow space between the controls and/or the Enlarge/Shrink Horizontal/Vertical properties to force children use the full width/height. I did a quick test[0] and seems to work fine. Note that as this uses the controls' automatic sizing, the controls will always be resized to match their autosize, however you can use the Constrains property to set a minimum (or maximum) size and/or use a TPanel for a "cell" so you can specify whatever size you want (or have cells with multiple controls).

[0] https://i.imgur.com/DZBrSvh.png

Re: Lazarus IDE 3.0

#67
post #60

This wont be part of a Lazarus release any time soon (ok, it might be in 4.0 but i don't know when 4.0 will happen) as it is only on trunk, but recently i was fixing bugs for the Gtk1 backend. The neat bit is that Gtk1 is very small and while it isn't preinstalled anywhere nowadays (except Slackware) you can carry the .so as they are around 5-6MB or so. However it also supports static linking and after some quick hac…

I like the idea if including the UI library. I know that ie. Ardour are not looking forward to upgrading from Gtk2. Could this technique be used with Gtk4+Wayland as well?

Well, Gtk4 isn't supported (in fact even Gtk3 support is buggy, AFAIK the original maintainer abandoned it after getting tired of Gtk4 breaking the API again - i think there is someone else fixing bugs for Gtk3 right now though but there isn't any Gtk4 code), though from a quick search it can be statically linked if you build it from source yourself (the Gtk developers do not seem to like that though and all comments i saw in a couple of relevant bugtracker posts were along the lines of "do not do that, we don't want to support that"). So assuming a Gtk4 backend is made and you are able to create a static Gtk4 library (together with static versions of all the libraries it needs aside from common stuff like the C library, OpenGL, etc) it should work.

It might be possible to link against Qt6 though (the LCL widgetset of which is more actively developed) but you'd still need to make a static library for both Qt6 and libQt6Pas (a "proxy" library that exposes a C API for Qt6 that LCL can use, currently it is part of the Lazarus project but there was some discussion recently to make it its own separate thing). Personally i've only tried linking statically against libQt6Pas (with the Qt6 libraries being linked dynamically so the program can use the distro libs) so i wont have to carry the libQt6Pas.so[0] (Qt6 is or at least should be available pretty much everywhere nowadays and will be around for years to come).

In general you should be able to link against any static C or C++ library (note that for the latter you also need to link against the C++ libraries).

[0] https://i.imgur.com/Cw89XtC.png

Re: Lazarus IDE 3.0

#68
post #5

Glad to see that RISC-V is supported as a target: https://wiki.freepascal.org/Platform_list#Supported_targets_...

The code generation has been pretty good upstream for many years now. It's easy enough

The hardest part of adding full support for RISC-V is to support the hardware floating point ABI. It's incredibly complicated for likely no real world reason. It will likely require a ton of code still to make freepascal fully compliant

The software and ABI ecosystem of RISC-V is what made me personally lose my love for it. The ISA is great

Re: Lazarus IDE 3.0

#69

Earlier quoted context omitted.

It's funny how that sort of immediacy is what people like about lisps, but to my knowledge there is nothing like the RAD interface Lazarus and Delphi have in the open source lisp world.

> there is nothing like the RAD interface Lazarus and Delphi have in the open source lisp world. The key phrase there is 'open source' I believe, because tools like Lazarus come out of a pretty distinct Borland / Windows culture of making bespoke usually paid graphical development tools. Lisps have a lot of their roots in the academic and Unix culture with a lot of folks seemingly allergic to GUIs to this day. There'…

It seems like there used to be more of a paid, proprietary, GUI using culture for Lisp, too, in the form of Lisp machines and products like that. They used to not only advertise their programming environment, but also advertise Lisp machines for things like 3D animation and editing office documents.

Re: Lazarus IDE 3.0

#70
post #68
post #5

Glad to see that RISC-V is supported as a target: https://wiki.freepascal.org/Platform_list#Supported_targets_...

The code generation has been pretty good upstream for many years now. It's easy enough The hardest part of adding full support for RISC-V is to support the hardware floating point ABI. It's incredibly complicated for likely no real world reason. It will likely require a ton of code still to make freepascal fully compliant The software and ABI ecosystem of RISC-V is what made me personally lose my love for it. The ISA…

> It's incredibly complicated for likely no real world reason

Can you explain or link to somewhere to read about this? Isn't psABI quite simple?

Post reply on HN