tag:blogger.com,1999:blog-49395231727686792772024-03-05T05:19:00.297+01:00Lazarus DevelopmentNotes and thoughts about <a href="http://www.lazarus.freepascal.org">Lazarus</a> Development.Vincent Snijdershttp://www.blogger.com/profile/04065272115346942274noreply@blogger.comBlogger47125tag:blogger.com,1999:blog-4939523172768679277.post-8629969940331362692021-06-27T18:51:00.001+02:002021-06-27T19:19:10.694+02:00FreePascal and Lazarus Development will switch to GIT<p>The Free Pascal and Lazarus teams are in the process of switching to Gitlab to manage their source code and issue reports.<br /><br />In order to lower maintenance of their own infrastructure, a hosted solution<br />has been chosen, and an open source license was granted to the teams.<br /><br />You can see the current progress at:<br /><br /><a class="bbc_link" href="https://gitlab.com/freepascal.org" rel="noopener noreferrer" target="_blank">https://gitlab.com/freepascal.org</a><br /><br />2 subgroups have been made:<br /><br /><a class="bbc_link" href="https://gitlab.com/freepascal.org/fpc" rel="noopener noreferrer" target="_blank">https://gitlab.com/freepascal.org/fpc</a><br /><a class="bbc_link" href="https://gitlab.com/freepascal.org/lazarus-ide" rel="noopener noreferrer" target="_blank">https://gitlab.com/freepascal.org/lazarus-ide</a><br /><br />Several testconversions of the SVN history to a Git repository have been<br />done, with ever improving results. All repositories will be switched to git.</p><p><br />A program has been written to convert Mantis bug reports to Gitlab issues;<br />it is very complete, and all available info will be converted.<br />You can see (partial) conversion results on the above projects.<br /></p><p><br />The date for the final conversion has been established as the weekend of<br />17/18 july. People that wish to report bugs after that will have to create a<br />gitlab account in order to do so. (Those with a github account can normally<br />also use that account to log in with gitlab, see the gitlab login page.)<br /></p><p><span style="font-size: large;"><u><b>If you are a user on our Bugtracker (Mantis):</b></u></span><br /></p><p style="margin-left: 40px; text-align: left;">The conversion program will attempt to convert existing bugs using the<br />account of the new gitlab user.<u> To map your gitlab user name (or ID) to the<br />mantis user</u>, we ask that you <u>file an issue in the mantis project</u> of the<br />current bugtracker, <u>assign it the category gitlab</u>, and set the <u>summary of<br />the bugreport to your gitlab account name</u> or ID number (not both!).<br /></p><p><br />All accounts that can be collected in this manner <u><b>by 17 july</b></u> will be used in the final conversion.<br /></p><p><br />All necessary information to connect to gitlab will be collected in the FPC &<br />Lazarus Wiki. Several pages have already been set up:<br /><br /><a class="bbc_link" href="https://wiki.freepascal.org/FPC_git" rel="noopener noreferrer" target="_blank">https://wiki.freepascal.org/FPC_git</a><br /><a class="bbc_link" href="https://wiki.freepascal.org/FPC_git_concepts" rel="noopener noreferrer" target="_blank">https://wiki.freepascal.org/FPC_git_concepts</a><br /><a class="bbc_link" href="https://wiki.freepascal.org/SVN_to_GIT_Cheatsheet" rel="noopener noreferrer" target="_blank">https://wiki.freepascal.org/SVN_to_GIT_Cheatsheet</a><br /><br />These
pages will be updated with the correct URLS when the final conversion
happens. The FPC & Lazarus websites will also be adapted with new
instructions.<br /><br />For the FPC & Lazarus teams,<br />Martin (Message originally by Michael)</p>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-4939523172768679277.post-34162176094555945572015-02-24T03:40:00.000+01:002015-02-26T00:40:04.077+01:00Updates to LHelp the CHM help viewer for Lazarus<p>LHelp is the help viewer that is included with Lazarus to view the chm files usually included in releases. </p>
<p>Some time ago some changes were made so that when F1 is pressed and LHelp is started, LHelp would load several help files such as the Lazarus Component Library(LCL) the Runtime Library(RTL) the Free Component Library(FCL) and several others. This is nice because then it's possible to search all the open files for keywords.</p>
<p>The down side to this is that every time a chm is loaded, the Table of Contents updates and the default page of the help file was rendered. So it was very visible as each help file was loaded in LHelp and not very pretty. </p>
<p>Additions the the protocol used for communication between LHelp and Lazarus, made by Reinier Olislagers, allowed LHelp to load the files while it was not yet visible and then be shown afterwards. This worked well but there was a long delay in the time F1 was pressed and the time LHelp became visible. Almost ten seconds on a modern multi-core desktop computer.</p>
<p>Investigation into the cause revealed a couple of slowdowns. The major cause was the speed at which the IPCServer.PeekMessage routine was polled. Only every 200 milleseconds. Sending commands to open 10 files would take 2 seconds. Also it used the syntax <i>if IPCServer.PeekMessage(5) then ...</i> which was not ideal. Changing this to <i>while IPCServer.PeekMessage(5) do ...</i> allows it to handle another message immediately if one is available.</p>
<p>Another factor was the way that Lazarus looked up the chm files to open. It would collect all files in any folder that could contain a chm file without using a file mask. Adding a mask for *.chm files sped this up significantly.</p>
<p>Speedups in LHelp were implemented by adding <i>BeginUpdate</i> and <i>EndUpdate</i> to the protocol. This allows chm's to be loaded without rendering the default page for each chm as it's loaded. When the last EndUpdate is sent, the final requested help topic is the only one rendered.</p>
<p>All of this results in a startup time of ~2 seconds. A big improvement over 10 seconds. The changes are committed in the svn version of Lazarus and will be available in Lazarus 1.4 Release Candidate 2</p>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhub4AqeSGmkfovvBuPCFfKmwHPqO7LFZeqj18M4RSlX5B2jbAkkJCT5ASr7ynyiMAsg8b7eKpCsYM0I8GFkbExrAT2XbXW5g_FfLPswcZjnF84yy3sPaFWcXOWpz_VafT1a5aciFYhQwc/s1600/Screenshot+from+2015-02-23+20:40:34.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhub4AqeSGmkfovvBuPCFfKmwHPqO7LFZeqj18M4RSlX5B2jbAkkJCT5ASr7ynyiMAsg8b7eKpCsYM0I8GFkbExrAT2XbXW5g_FfLPswcZjnF84yy3sPaFWcXOWpz_VafT1a5aciFYhQwc/s320/Screenshot+from+2015-02-23+20:40:34.png" /></a></div>Andrew Haineshttp://www.blogger.com/profile/10679351403152710881noreply@blogger.com0tag:blogger.com,1999:blog-4939523172768679277.post-5952384622298470552014-05-10T21:17:00.000+02:002019-08-16T14:38:14.918+02:00(De-) Bug wars - A new hope<h4>
"This are not the bugs you are looking for"</h4>
Well hopefully in future it will get easier to find those parts of your code, that joined the dark side.<br />
The Lazarus Team is currently working on improving the Debugger in the IDE. And not just improving, but adding an all new shiny debugger.<br />
In fact not just one either.<br />
<br />
Here is what we are currently working on. In future we will offer 3 kind of debuggers in the IDE.<br />
<br />
<ol>
<li><u>The existing gdb based debugger: "GdbmiDebugger".</u><br /> And it's variations for gdbserver, and gdb over ssh.<br />We will continue to maintain them, as they support additional targets (arm, powerppc, ...) that the new debuggers do not (or not yet) have.<br /></li>
<li><u>A gdb free debugger: "FpDebugger".</u><br />This is still in its very early alpha stage. So far it will be for Intel targets only. And initial work concentrates on supporting Mac (which no longer comes with GDB, and urgently needs a replacement), and Windows 32 bits. But Win64 and Linux are planned too.<br /></li>
<li><u>A hybrid: "FpGdbmiDebugger".</u><br />Like the existing GdbmiDebugger it uses GDB. In fact it inherits much of the functionality from GdbmiDebugger.<br />But it will have its own routines to evaluate watches itself (without GDB). So it will be able to deal better with Pascal data. As a side effect watch evaluation will also be faster. <br />Other debugging tasks, such as running or stepping the exe, and handling breakpoints are handled by the GdbmiDebugger code using GDB.<br /><br />But why this one at all?<br />The same watch evaluation is available when using FpDebugger?<br />Well, with FpGdbmiDebugger being GDB based, it will be easier to support more of the targets that GDB can support (like arm). It will still need some additions (e.g. a reader for arm executables, to read debug info) in order to do this. And FpGdbmiDebugger also has the potential to be extended to be gdbserver based and support remote debugging in future.<br /><br />The progress of FpGdbmiDebugger can be watched on its wiki page: <a href="http://wiki.lazarus.freepascal.org/FpGdbmiDebugger">FpGdbmiDebugger on our wiki</a>.<br />A page for FpDebugger does not yet exist.</li>
</ol>
<br />
The two new debuggers are developed in our SVN version (1.3). And if all goes to plan, then they will be part of Lazarus 1.4 (Probably sometime in 2015)<br />
<br />
May Pascal live long and prosper (Oops wrong source).<br />
May the force be with Pascal.Unknownnoreply@blogger.comtag:blogger.com,1999:blog-4939523172768679277.post-48670224152804383772013-08-25T16:44:00.000+02:002013-08-25T18:36:00.470+02:00Threads with LazarusIt seems every time I use threads in a program I make, I need to lookup again how threads work. So if you're like me perhaps this will help you.<br />
<br />
<a href="http://wiki.freepascal.org/Multithreaded_Application_Tutorial">Here's a more complete tutorial to read.</a>
<br />
<br />
Threads are a great way to do a large amount of processing in your program while allowing the visual part of your program to remain responsive. If you can split up the processing into several threads you can take advantage of modern processors multi core capability and complete a job in a fraction of the time.<br />
<br />
Lazarus programs can use threads in GUI and Console programs. If you use threading in your program you should define the compiler option <code>-dUseCThreads</code>. This can be done in Project->Options->Compiler Options->Other - Custom Options. This does nothing under Windows but on any *nix it includes a needed threadmanager. If your program crashes with the first use of thread.Start; then this is probably your problem.<br />
<br />
Now that your program is thread enabled here's some basic information about threads. You must subclass the <code>TThread</code> type and make your own thread type and override the <code>Execute</code> method.<br />
<br />
The <code>Execute</code> method is never called directly in your program. It is the method the thread will run on it's own when it is started. If you are using <code>MyThread.Execute</code> then you are making a mistake.<br />
<br />
Here's a basic example of a new thread type<br />
<br />
<code>
type </code><br />
<code> TFooThread = class(TThread) </code><br />
<code> protected</code><br />
<code> procedure Execute; override;</code><br />
<code> end;</code><br />
<br />
<code>... </code><br />
<br />
<code>implementation </code><br />
<br />
<code>procedure TFooThread.Execute;</code><br />
<code>begin</code><br />
<code> // do stuff </code><br />
<code>end;</code><br />
<br />
<code> </code>
<br />
To create an instance of your thread you can use<br />
<br />
<code>FooThread := TFooThread.Create(True);</code><br />
<br />
The argument <code>True</code> creates the thread in suspended state, meaning the OS thread is created but not yet run. If you use <code>False</code> then the thread begins and <code>Execute</code> is called immediately. You can of course make your own constructor with whatever parameters you need and use <code>inherited Create(False)</code> there.<br />
<br />
To start a thread you should use <code>FooThread.Start</code>. <code>FooThread.Resume</code> is deprecated as well as <code>.Suspend</code> which is not reliable on *nix's and can cause your program to hang.<br />
<br />
Now your thread is running and working and making your life easier. Your program is snappier and you decide that you need to make your program display the progress your thread is making processing some data.<br />
<br />
So in TFooThread.Execute you add Form1.ProgressBar1.Position := SomeValue.<br />
Bad idea. It may work or your program could immediately crash or it might cause some other harder to find error that happens later. <b>Never ever do this.</b><br />
<br />
The reason this is so bad is because the GUI part of your program is run in a separate thread (duh!) and has it's own memory area. Changing the memory in one thread from another needs to be coordinated carefully. You should never change a LCL control value from a thread other than the main process.<br />
<br />
A way to update the main thread from another thread is the <code>Synchronize(@SomeProc)</code> method. The <code>Syncronize</code> method, which is called within a created thread, causes the thread to pause and wait for the main thread to call a procedure. Also see CritialSections from the link at the beginning of this article<br />
<br />
When your thread terminates you should assume that any code in it's destructor may be called a thread other than your main process thread, especially if you set <code>FreeOnTerminate</code> to <code>True</code>. If you assign a handler for the OnTerminate property then that procedure will be run in the main thread.<br />
<br />
After all the code in the <code>Execute</code> method is run your thread cannot be restarted. You will have to free and create another instance of the thread type you need. It's common to include <code>while not Terminated do begin ... end</code> around the code inside the <code>Execute</code> method in order to use a thread multiple times without having to recreate it.<br />
<br />
Most of the basic stuff I have run into is now covered. Go code, or read some more: <a href="http://wiki.freepascal.org/Multithreaded_Application_Tutorial">Threading Tutorial on the Wiki</a>Andrew Haineshttp://www.blogger.com/profile/10679351403152710881noreply@blogger.com1tag:blogger.com,1999:blog-4939523172768679277.post-41228619135903446602012-08-28T14:56:00.000+02:002012-08-28T15:16:28.826+02:00Gtk3, GObject Introspection and Free PascalA while back the <a href="http://www.gtk.org/">Gtk</a> community started a project called <a href="https://live.gnome.org/GObjectIntrospection/">GObject Introspection.</a> In short it exports the Gtk and Glib api, as well as many others, to an easily parsed xml format.<br />
<br />
The result is <a href="http://wiki.freepascal.org/gir2pascal">gir2pascal.</a><br />
<br />
gir2pascal can create bindings to pascal from any library that supports gobject introspection in just a few moments! The result is that <a href="http://wiki.freepascal.org/Gtk%2B3">Gtk3 bindings</a> have been created fairly easily for pascal and can easily be updated simply by running gir2pascal against the latest version.<br />
<br />
Here is part of the XML code from the Gtk3.gir file relating to the caption of the button: <br />
<br />
<pre style="background: #ffffff; color: black;"><span style="color: #a65700;"><span style="color: #5f5035;"><</span></span><span style="color: #5f5035;">class</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"Button"</span><span style="color: #274796;"></span>
<span style="color: #274796;"> c:symbol-prefix</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"button"</span><span style="color: #274796;"></span>
<span style="color: #274796;"> c:</span><span style="color: #074726;">type</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"GtkButton"</span><span style="color: #274796;"></span>
<span style="color: #274796;"> parent</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"Bin"</span><span style="color: #274796;"></span>
<span style="color: #274796;"> glib:</span><span style="color: #074726;">type</span><span style="color: #274796;">-</span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"GtkButton"</span><span style="color: #274796;"></span>
<span style="color: #274796;"> glib:get-</span><span style="color: #074726;">type</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"gtk_button_get_type"</span><span style="color: #274796;"></span>
<span style="color: #274796;"> glib:</span><span style="color: #074726;">type</span><span style="color: #274796;">-struct</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"ButtonClass"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">implements</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"Atk.ImplementorIface"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">implements</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"Actionable"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">implements</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"Activatable"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">implements</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"Buildable"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">constructor</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"new"</span><span style="color: #274796;"> c:identifier</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"gtk_button_new"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">return-value</span><span style="color: #274796;"> transfer-ownership</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"none"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">type</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"Widget"</span><span style="color: #274796;"> c:</span><span style="color: #074726;">type</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"GtkWidget*"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">return-value</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">constructor</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">method</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"get_label"</span><span style="color: #274796;"> c:identifier</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"gtk_button_get_label"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">return-value</span><span style="color: #274796;"> transfer-ownership</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"none"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">type</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"utf8"</span><span style="color: #274796;"> c:</span><span style="color: #074726;">type</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"gchar*"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">return-value</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">method</span><span style="color: #a65700;">></span> <span style="color: #a65700;"><</span><span style="color: #5f5035;">method</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"set_label"</span><span style="color: #274796;"> c:identifier</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"gtk_button_set_label"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">return-value</span><span style="color: #274796;"> transfer-ownership</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"none"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">type</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"none"</span><span style="color: #274796;"> c:</span><span style="color: #074726;">type</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"void"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">return-value</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">parameters</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">parameter</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"label"</span><span style="color: #274796;"> transfer-ownership</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"none"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">type</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"utf8"</span><span style="color: #274796;"> c:</span><span style="color: #074726;">type</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"gchar*"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">parameter</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">parameters</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">method</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">property</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"label"</span><span style="color: #274796;"> construct</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"1"</span><span style="color: #274796;"></span>
<span style="color: #274796;"> transfer-ownership</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"none"</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"><</span><span style="color: #5f5035;">type</span><span style="color: #274796;"> </span><span style="color: #074726;">name</span><span style="color: #808030;">=</span><span style="color: #0000e6;">"utf8"</span><span style="color: #a65700;">/></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">property</span><span style="color: #a65700;">></span>
<span style="color: #a65700;"></</span><span style="color: #5f5035;">class</span><span style="color: #a65700;">></span></pre>
<pre style="background: #ffffff; color: black;"><span style="color: #a65700;"> </span></pre>
One improvement over the current (Gtk2) bindings in use is that
Pascal objects (not classes) have been used in place of records. The
advantage is that GObjects, a C style quasi-object, can be accessed in
an object oriented way instead of the flat C functions we use currently.<br />
<br />
Here is the corresponding generated pascal code from the XML above:<br />
<br />
<pre style="background: #ffffff; color: black;"><span style="color: maroon; font-weight: bold;">type</span>
TGtkButton <span style="color: #808030;">=</span> <span style="color: maroon; font-weight: bold;">object</span><span style="color: #808030;">(</span>TGtkBin<span style="color: #808030;">)</span>
priv3<span style="color: #808030;">:</span> PGtkButtonPrivate<span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">function</span> new<span style="color: #808030;">:</span> PGtkButton<span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">inline</span><span style="color: purple;">;</span> static<span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">function</span> get_label<span style="color: #808030;">:</span> Pgchar<span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">inline</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">procedure</span> set_label<span style="color: #808030;">(</span>label_<span style="color: #808030;">:</span> Pgchar<span style="color: #808030;">)</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">inline</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">property</span> label_<span style="color: #808030;">:</span> Pgchar <span style="color: maroon; font-weight: bold;">read</span> get_label <span style="color: maroon; font-weight: bold;">write</span> set_label<span style="color: #808030;">;</span>
<span style="color: maroon; font-weight: bold;">end</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">function</span> gtk_button_new<span style="color: #808030;">:</span> PGtkButton<span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">external</span><span style="color: #808030;">;</span>
<span style="color: maroon; font-weight: bold;">function</span> gtk_button_get_label<span style="color: #808030;">(</span>AButton<span style="color: #808030;">:</span> PGtkButton<span style="color: #808030;">)</span><span style="color: #808030;">:</span> Pgchar<span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">external</span><span style="color: #808030;">;</span>
<span style="color: maroon; font-weight: bold;">procedure</span> gtk_button_set_label<span style="color: #808030;">(</span>AButton<span style="color: #808030;">:</span> PGtkButton<span style="color: purple;">;</span> label_<span style="color: #808030;">:</span> Pgchar<span style="color: #808030;">)</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">external</span><span style="color: #808030;">;</span>
<span style="color: maroon; font-weight: bold;">implementation</span>
<span style="color: maroon; font-weight: bold;">function</span> TGtkButton<span style="color: #808030;">.</span>new<span style="color: #808030;">:</span> PGtkButton<span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">begin</span>
<span style="color: maroon; font-weight: bold;">Result</span> <span style="color: #808030;">:</span><span style="color: #808030;">=</span> Gtk3<span style="color: #808030;">.</span>gtk_button_new<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">end</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">function</span> TGtkButton<span style="color: #808030;">.</span>get_label<span style="color: #808030;">:</span> Pgchar<span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">begin</span>
<span style="color: maroon; font-weight: bold;">Result</span> <span style="color: #808030;">:</span><span style="color: #808030;">=</span> Gtk3<span style="color: #808030;">.</span>gtk_button_get_label<span style="color: #808030;">(</span><span style="color: #808030;">@</span><span style="color: maroon; font-weight: bold;">self</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">end</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">procedure</span> TGtkButton<span style="color: #808030;">.</span>set_label<span style="color: #808030;">(</span>label_<span style="color: #808030;">:</span> Pgchar<span style="color: #808030;">)</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">begin</span>
Gtk3<span style="color: #808030;">.</span>gtk_button_set_label<span style="color: #808030;">(</span><span style="color: #808030;">@</span><span style="color: maroon; font-weight: bold;">self</span><span style="color: #808030;">,</span> label_<span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">end</span><span style="color: purple;">;</span>
</pre>
<br />
You can see that we are using objects instead of records, compare this to the current Gtk2 bindings:<br />
<br />
<pre style="background: #ffffff; color: black;"><span style="color: maroon; font-weight: bold;">type</span>
PGtkButton <span style="color: #808030;">=</span> <span style="color: #808030;">^</span>TGtkButton<span style="color: purple;">;</span>
TGtkButton <span style="color: #808030;">=</span> <span style="color: maroon; font-weight: bold;">record</span>
bin <span style="color: #808030;">:</span> TGtkBin<span style="color: purple;">;</span>
event_window <span style="color: #808030;">:</span> PGdkWindow<span style="color: purple;">;</span>
label_text <span style="color: #808030;">:</span> Pgchar<span style="color: purple;">;</span>
activate_timeout <span style="color: #808030;">:</span> guint<span style="color: purple;">;</span>
flag0 <span style="color: #808030;">:</span> <span style="color: #bb7977;">word</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">end</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">function</span> gtk_button_new<span style="color: #808030;">:</span>PGtkWidget<span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">external</span> gtklib<span style="color: #808030;">;</span>
<span style="color: maroon; font-weight: bold;">procedure</span> gtk_button_set_label<span style="color: #808030;">(</span>button<span style="color: #808030;">:</span>PGtkButton<span style="color: purple;">;</span> _label<span style="color: #808030;">:</span>Pgchar<span style="color: #808030;">)</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">external</span> gtklib<span style="color: #808030;">;</span>
<span style="color: maroon; font-weight: bold;">function</span> gtk_button_get_label<span style="color: #808030;">(</span>button<span style="color: #808030;">:</span>PGtkButton<span style="color: #808030;">)</span><span style="color: #808030;">:</span>Pgchar<span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">cdecl</span><span style="color: purple;">;</span> <span style="color: maroon; font-weight: bold;">external</span> gtklib<span style="color: #808030;">;</span></pre>
<br />
<br />
Before, our code would look like this:<br />
<br />
<pre style="background: #ffffff; color: black;"><span style="color: maroon; font-weight: bold;">procedure</span> Foo<span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">var</span>
Button<span style="color: #808030;">:</span> PGtkWidget<span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">begin</span>
Button <span style="color: #808030;">:</span><span style="color: #808030;">=</span> gtk_button_new<span style="color: purple;">;</span>
gtk_button_set_label<span style="color: #808030;">(</span>PGtkButton<span style="color: #808030;">(</span>Button<span style="color: #808030;">)</span><span style="color: #808030;">,</span> <span style="color: #0000e6;">'Hello World!'</span><span style="color: #808030;">)</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">end</span><span style="color: purple;">;</span>
</pre>
<br />
<br />
But now it's possible to use this instead:<br />
<br />
<pre style="background: #ffffff; color: black;"><span style="color: maroon; font-weight: bold;">procedure</span> Foo<span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">var</span>
Button<span style="color: #808030;">:</span> PGtkButton<span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">begin</span>
Button <span style="color: #808030;">:</span><span style="color: #808030;">=</span> TGtkButton<span style="color: #808030;"></span><span style="color: #808030;">.</span>new<span style="color: purple;">;</span>
Button<span style="color: #808030;">^</span><span style="color: #808030;">.</span>label_ <span style="color: #808030;">:</span><span style="color: #808030;">=</span> <span style="color: #0000e6;">'Hello World!'</span><span style="color: purple;">;</span>
<span style="color: maroon; font-weight: bold;">end</span><span style="color: purple;">;</span>
</pre>
<br />
As you see it's a bit shorter to type the second way. Although either will work since the 'flat' functions are still available to use.<br />
<br />
Using objects instead of records it is of course possible to access inherited methods and properties with greater ease than before, especially when using the code completion feature of <a href="http://www.lazarus.freepascal.org/" target="_blank">Lazarus</a> (which is extremely close to 1.0 now!). <span style="font-family: "Courier New",Courier,monospace;">Button</span> in the example above descends from <span style="font-family: "Courier New",Courier,monospace;">GtkWidget</span> which has the property <span style="font-family: "Courier New",Courier,monospace;">tooltip_text.</span><br />
<br />
This can be accessed with <br />
<pre style="background: #ffffff; color: black;">Button<span style="color: #808030;">^</span><span style="color: #808030;">.</span>tooltip_text <span style="color: #808030;">:</span><span style="color: #808030;">=</span> <span style="color: #0000e6;">'Don'</span><span style="color: #0000e6;">'t click me unless you want to!'</span><span style="color: purple;">;</span>
</pre>
whereas before you had to do <br />
<pre style="background: #ffffff; color: black;">gtk_widget_set_tooltip_text<span style="color: #808030;">(</span>PGtkWidget<span style="color: #808030;">(</span>Button<span style="color: #808030;">)</span> <span style="color: #808030;">,</span><span style="color: #0000e6;">'Don'</span><span style="color: #0000e6;">'t click me unless you want to!'</span><span style="color: #808030;">)</span><span style="color: purple;">;</span> </pre>
<br />
Here's the HelloWorld example included with the bindings, modified to have a tooltip.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTl44T7JQjjPAw11gkrM5MTEi7BxQdJ9d0Eec03vTP0NMQ1WTMgAlwJl5BIlJCj-m9DJdlHG0PIneYLIb8ZiwAY0chyphenhyphenN17sNNnRgYhGn4Ih7-LwFF66cFJKlSlqIdsqPkDzM7ICCESp-k/s1600/Gtk3-Button.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTl44T7JQjjPAw11gkrM5MTEi7BxQdJ9d0Eec03vTP0NMQ1WTMgAlwJl5BIlJCj-m9DJdlHG0PIneYLIb8ZiwAY0chyphenhyphenN17sNNnRgYhGn4Ih7-LwFF66cFJKlSlqIdsqPkDzM7ICCESp-k/s640/Gtk3-Button.png" width="640" /></a></div>
<br />
<br />
The Pascal Gtk3 bindings are not yet well tested. There are a couple of examples in the <a href="http://wiki.freepascal.org/Gtk%2B3#SVN" target="_blank">Lazarus-ccr repository</a> in the folder /bindings/gtk3/examples/ including an example of GtkWebkit.<br />
<br />
Perhaps you would like to try it out :) Andrew Haineshttp://www.blogger.com/profile/10679351403152710881noreply@blogger.com10tag:blogger.com,1999:blog-4939523172768679277.post-3625075352660551952012-08-02T15:31:00.001+02:002012-08-02T15:33:36.517+02:00Preparing for Lazarus 1.0 (RC1)Just to announce: Lazarus is preparing to go 1.0. <br />
<br />
The first release candidate for the new Version has just been made public on sourceforge. Please test it.<br />
<br />
You can find the announcement for the RC here: <a href="http://forum.lazarus.freepascal.org/index.php/topic,17717">http://forum.lazarus.freepascal.org/index.php/topic,17717</a><br />
And a list of what changed is here: <a href="http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes">http://wiki.lazarus.freepascal.org/Lazarus_1.0_release_notes</a>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-4939523172768679277.post-54272910160146703592012-02-17T14:52:00.003+01:002012-03-01T10:18:31.529+01:00Pascal does a strong showing in the Linux Questions Members ChoiceOf course that internet quiz is not something scientific but it is nevertheless good news. Both Pascal and Lazarus made a strong showing in the Linux Questions Annual Members Choice Awards, competing with software sponsored by huge corporations. Other software written in Lazarus also appeared in the show, such as Double Commander and LazPaint.<br /><br />Let's start with Lazarus itself running against other IDEs:<br /><br /><img src="http://img141.imageshack.us/img141/1290/ides.png" /><br /><br />And how Pascal / Object Pascal as a language fared well too (despite someone mistakenly having added it as "Free Pascal"). It is pretty hard to see because of so many multiple lines, so I added a bigger line connector, but anyone can check in the full description of the results here: http://www.linuxquestions.org/questions/linux-news-59/2011-linuxquestions-org-members-choice-award-winners-928502/<br /><br /><img src="http://img528.imageshack.us/img528/4420/languagex.png" /><br /><br />See also how Double Commander fared:<br /><br /><img src="http://img844.imageshack.us/img844/7832/filemanager.png" /><br /><br />And LazPaint:<br /><br /><img src="http://img829.imageshack.us/img829/4838/graphicsu.png" /><br /><br />If there was a category for Accessibility probably the Virtual Magnifying Glass would appear =)<br /><br />Felipe Monteiro de CarvalhoFelipe Monteiro de Carvalhohttp://www.blogger.com/profile/02603979169608559234noreply@blogger.com3tag:blogger.com,1999:blog-4939523172768679277.post-41973852195842332532012-02-15T10:57:00.004+01:002012-03-01T10:14:57.672+01:00Exploring the iPhoneAs all should know, since my previous post I managed to finish off all the missing bits and get a decent initial support for Android in the LCL. But of course we are not stopping there, so I started exploring the iPhone. I haven't yet done any programming, but I already found a lot of interesting thing. Many good things, but also many bad things.<br /><br />So let's start with the good things:<br /><br />I was expecting something similar to Android, just more expensive, but while the user interface is remarkably similar, I must say that Apple has an extremely good taste for designing things. Everything in the iPhone is just beautiful. Each small detail seams well though out to look good, while in Android everything exists in a similar shape, it just looks OK in Android while it look great in the iPhone. Sure that some manufacturer like HTC and Sony Ericsson changes radically the user interface and even UI widgetset look, but in all cases they don't come close to looking as good as the iPhone.<br /><br />The available RAM in the iPhone is pretty excellent. The iPhone 4 comes with 512MB of RAM of which aprox. 300MB are free for user applications. That's a huge amount in comparison to Android devices where you might even have 300MB or RAM, but the system is already eating 250MB =( The iPhone is also free of all that crapware which manufacturers like to fill the scarce ROM memory of Android phones, and the iPhone has a huge common memory for both media files and applications, which makes it able to run bigger apps without problems.<br /><br />Now some things which are different:<br /><br />The start screen is nearly identical with horizontal scrolling except that the iPhone home screen is much less configurable. You cannot place those nice widgetset to turn on/off mobile network or WiFi on a single click. The iPhone is also not very intuitive to use at times, with only icons and no perceived way for me to find out what an icon does except by guessing or testing, while in Android text labels are used much more often. There are no hints either. <br /><br />And now the bad:<br /><br />Frankly I am appalled that I have never heard of the evil side of the iPhone before. Why is nobody commenting that?? Am I the only one deeply bothered by this!? For me this was so terrible that I will never buy an iPhone again, for sure my next smartphone will be Android again. The iPhone is just the most restricted device, the most DRM filled, the most anti-freedom, the most monopolist, the most anti file owning device I have seen in my life. Let's start with the basic. On Android you put a SDCard in the phone and then you connect it with a USB cable to the computer and voilà! It opens as a mass media device with zero drivers installation in *any* operating system. Windows, Linux, Mac, works just as great in all! Then you can copy your music there, copy APK packages, you can copy your personal documents, you can copy source code, I don't know, you can do whatever you want! Sadly Android doesn't come with a File Browser but you can easily install the "OI File Browser" and then with it you see all your files on the phone and manage them. You can install any app to read your files. You can use the phone as a pen drive, you can create a new application to open, view and modify any file extension in the world and share that application. You can share your files. That's freedom! That's general computing! The freedom that any computer should offer.<br /><br />And the iPhone!? Where are the file managers? I haven't yet found a single one which will show my photos, movies and music. WTF!?!? There are some file managers which require installing extra programs in the desktop and essentially are a sort of hack around the limitations imposed by Apple. Is music just a product you consume from bigshot producers? Can you even run you own music there? Where is my freedom to run my MP3 which I generated myself from a CD I bought in Paraguay? Those guys are not in the iTunes Mr. Jobs and I don't want to restrict myself to your iWorld. Cloud storage as an extra option, OK, but ban file owning, copying and sharing!? That's the evil dream of any monopolist. I don't want to be part of that evil iWorld, I want a general computer. But that's what the iPhone certainly does not want to be.<br /><br />So, well, let's say you are conformed with the iPhone having zero file owning capabilities. What's next? It only docks to your computer via the iTunes after installing a plethora of drivers and does not work at all in Linux. You cannot freely install applications which you wrote yourself without joining the Apple Developer Program and go through a complicated process. In Android you can write apps and share them easily without any of this non-sense.<br /><br />And to make it worse: Apple is monopolistic. It banned 3rd party browsers. Where is the freedom? I don't want to be stuck with Safari. I already like Opera Mobile, but they banned it. Sure there is Opera Mini, but Mobile is much more what I want.<br /><br />So here we are: A superb phone, the best looking GUI and design I have ever seen. Excellent quality of the touch screen. All ruined by monopolistic, anti-freedom non-sense! All ruined by a company which wants to ban people from owning files.<br /><br />Felipe Monteiro de CarvalhoFelipe Monteiro de Carvalhohttp://www.blogger.com/profile/02603979169608559234noreply@blogger.com3tag:blogger.com,1999:blog-4939523172768679277.post-60400687677249965622011-11-25T14:55:00.004+01:002011-11-25T16:56:29.201+01:00LCL for AndroidAs the maintainer of LCL-WinCE of course I was quite shocked when Microsoft dropped Windows Mobile into the limbo and announced that native applications would be restricted to a very small list of favorite partners. Because of this, since almost 1 year now I have been trying to port the LCL for Android.<br /><br />My first success was in 19th January 2011 when I first built a good x86-linux -> arm-linux cross-compiler which I have been using ever since and I hosted here: http://sourceforge.net/projects/p-tools/files/Free%20Pascal%20for%20ARM/<br /><br />After that I slowly started exploring Android and the SDK with many pauses. My free time floats a lot depending on the work load, my mood and my current interests. I have other hobbies which alternate as my biggest interest from time to time. The most important ones are: trains (reading news and discussing in skyscrapercity as well as travelling), politics (I'm right wing / conservative), keyboard playing and Pascal programming.<br /><br />Ok, so next thing around in August I got some bounties which motivated me to make a good push. When I started we were in Android 2.2 still, and I bought a HTC Wildfire which came with 2.1 and can be upgraded only up to 2.2. At this time the perspectives for native applications were quite doomed, you had to interface with Java via the horrible JNI, I got pissed off by that and I developed an alternative system which worked by running a native executable and communicating with pipes with a Java machine. I posted about it in the android-ndk Google group and the Google guys hated my idea, they told me to buy and iPhone and try programming for that instead =D Well, I could do that, but seriously the Lazarus community is on a high mood for Android support, I don't remember yet anyone asking about iPhone support ... even requests of WebOS and Bada were heard. My hacky development strategy might sound like a bad idea, but I had many motivators for it:<br />1> If you can only have a library then the way LCL applications work changes dramatically =( I'm not sure yet how this will be worked around. You cannot keep the same main project file if Android requires a library and you also need changes in the project code flow.<br />2> FPC has a lot more bugs for library development then for executable development, specially in ARM-Linux<br />3> Using my method I could access the entire SDK without JNI! A true blessing. So I could quickly push some controls and get things working.<br />4> I also hoped that if people pushed then Google would flexibilize and support executables, but now I think I was too optimistic. At that time Android 2.3 was released and it brought a lot of improvements for native applications, but ever since there were very few changes in the NDK, so I lost my hope that Google would support native executables.<br /><br />The alternative way would be creating a native library which draws all controls, and there are enourmous challanges in doing this. So, fast forwarding a bit into the future, after a bounty I got some expertise in NDK development with OpenGL so I got quite animated and I started a huge push to see how far I can push LCL-CustomDrawn until I run out of steam.<br /><br />These days I feel like soldiers must have felt in the Market Garden operation, running against time to take all bridges in the way. I am not trying to consolidate the entire area, I just need to make as many breakthroughs as possible in as many key areas as possible to make sure that my development strategy works. Every time that we start doing something which was never done before, like LCL in Android you have a huge uncertainty about whether or not it will actually be possible to work, or if I will face a huge wall somewhere, like a compiler bug or a problem which needs a lot more steam then I got to solve ... so I want to clear the way and establish that my strategy indeed will work.<br /><br />So far I have already taken the following bridges:<br /><br />1> Lazarus Custom Drawn Controls - The first one to be tackled, it is far from complete, but I advanced it so well and so fast that it is clearly proven that we can have our own set of custom drawn controls inside Lazarus<br /><br />Reference: http://wiki.lazarus.freepascal.org/Lazarus_Custom_Drawn_Controls<br /><br />2> Developing the major structure of LCL-CustomDrawn to allow painting with a non-native Canvas into a native surface. I already implemented this for Win32, X11 and Cocoa, so we are quite advanced here.<br /><br />3> Develop a system to clip the painting of sub-controls and also clip events from sub-controls inside a form. In LCL-CustomDrawn TWinControl will be non-native, because some platforms like the Android surface do not support it. I have achieved success here too.<br /><br />Now I am trying to push into a last bridge, which is resisting heavily:<br /><br />4> Achieving a minimal LCL-CustomDrawn application which can run in Android and paint at least a rectangle or something.<br /><br />I am facing big challanges in this task, the major ones being that when I simply include the LCL the application starts to crash, even if I don't call anything from it =( I have narrowed down to cwstrings, which is a major source of crashes, so I disabled it, but now the application crashes when clicking on it. I tryed to comment out all initialization sections in the LCL, but it didn't help. My greatest fear is a compiler bug somewhere which would reproduce only in big programs like LCL apps and stop me =( But so far it appears that I am going well, let's hope we will succeed here and clear 1 more obstacle in this difficult road.<br /><br />Edit: I managed to get it working now, the second problem was introduced while debugging the cwstring issue. Now it works fine =) So we are each day closer to have LCL-CustomDrawn running in Android. From what I can see my snapshot compiler has no bug which could defeat us, so the path is ready =)<br /><br />Edit2: Now it loads the application and it can draw some green stuff =D Really exciting days for LCL-CustomDrawn-Android. It still doesn't do anything useful, but the entire fact that it loads without crashing and can render something is excellent.Felipe Monteiro de Carvalhohttp://www.blogger.com/profile/02603979169608559234noreply@blogger.com3tag:blogger.com,1999:blog-4939523172768679277.post-25161647695524709452011-05-16T03:41:00.005+02:002011-05-16T12:56:51.092+02:00Remember, Remember ... The History of Debugging<div class="moz-text-flowed" style="font-family: -moz-fixed; font-size: 14px; text-align: justify;" lang="x-western"><br />Debugging your application can be an intriguing task. And analyzing what happens in your application, and what went wrong (or maybe right), often requires the developer to keep an eye on quite a lot of data.<br />Sometimes that means not only to look at the data as it is on the current step of execution, but also to compare it to what it was on the previous step(s).<br /></div><div style="text-align: justify;"><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyoZFHlimUOZOZAqiZ87y5-_uIdkVCn-uT61mYsQdcSE3Wmd1dyiAyBsCxge_MdxNpgXh2OfVDcbRqE9iUJplY1Mv7_MV5npe0ytARoL3lS2bELv_mSxJJibr76cXp6KDPfJ76ji8Vfg/s1600/LazDbgHistory.png"><img style="cursor:pointer; cursor:hand;width: 550px; height: 221px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyoZFHlimUOZOZAqiZ87y5-_uIdkVCn-uT61mYsQdcSE3Wmd1dyiAyBsCxge_MdxNpgXh2OfVDcbRqE9iUJplY1Mv7_MV5npe0ytARoL3lS2bELv_mSxJJibr76cXp6KDPfJ76ji8Vfg/s1600/LazDbgHistory.png" alt="" id="BLOGGER_PHOTO_ID_5607260790231520002" border="0" /></a><br /></div><div class="moz-text-flowed" style="font-family: -moz-fixed; font-size: 14px; text-align: justify;" lang="x-western"><br /><br />Lazarus does now provide a history overview for watched values, locals, and call-stack. Each time your application stops, a record of this data is made and stored.<br />By default Watches and Locals are recorded for the current stack-frame/thread. But if you browse other frames or threads by selecting them in the stack or threads overview windows, then Lazarus will notice this and keep track of those too.<br /><br />A new debug window "History" provides access to all recorded values. Currently this is up to 25 history entries. And you can even browse the history after you program terminated.<br />If you have a history entry selected, you can use the stack-window to change the current stack. If any data was collected for the selected frame, it will be shown. Currently data for extra stack frames is only collected if the frame was selected, while your app was running, and if the watches or locals window where open and active.<br /><br />There is however a little twist to it. Collecting all the data takes some time. To avoid any slowdown of the debugger, this new feature works on idle time only. It collects data, only if the debugger has no other work. This even means that you can continue the execution of your application, without having to wait the full time it would have taken to get all the data. In this case the snapshot will be incomplete.<br />If you want to ensure complete snapshots, you can open the watches, locals and stack window, and observe when the information has been fully fetched, as it gets displayed to you.<br /><br /><span style="font-size:78%;">This feature is available in Lazarus 0.9.31</span><br /></div>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-4939523172768679277.post-1507575212003495912010-11-15T22:54:00.008+01:002010-11-18T10:37:35.551+01:00Profiles for Build LazarusThe dialog opens from Tools --> Configure "Build Lazarus".<br />It is meant for building Lazarus or parts of it, using the given parameters.<br />The original dialog looked about like this.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifJh26NAQ_oAVs1DOTNom14NuoPF9yKMntrfMEkU1JR-TDwA8mw1GF_fsrdu3GyCewIrIVnllUZuVrlzu1D0QAl301NMCmuIlVNEN3Vi30pbFvnDjCOubHiibZhaiS7Kscel_Y324qxrQ/s1600/BuildLazAdvanced.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 298px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifJh26NAQ_oAVs1DOTNom14NuoPF9yKMntrfMEkU1JR-TDwA8mw1GF_fsrdu3GyCewIrIVnllUZuVrlzu1D0QAl301NMCmuIlVNEN3Vi30pbFvnDjCOubHiibZhaiS7Kscel_Y324qxrQ/s320/BuildLazAdvanced.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5539898741556868098" /></a><br /><br />The dialog was made by the same developers that actually use it all the time. Thus the GUI is little confusing, it's main design goal was not "ease of use".<br /><br />Then some people made an effort to simplify the GUI. They didn't touch the original GUI but instead added another "Quick" tab sheet to the dialog.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia086lyOWdabOakb2YHihYnuTEHV7V1gxKnkOgfyIueOcW4mVlb_uAnlGw1eq0bKTJLY2T2mER2WxTkG1QDpujzOl25tlNw3TL3JHSqNAELr47KZr_D7IXTy_F-RH-Ym4aojx1VLroNQ0/s1600/BuildLazQuick.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 298px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia086lyOWdabOakb2YHihYnuTEHV7V1gxKnkOgfyIueOcW4mVlb_uAnlGw1eq0bKTJLY2T2mER2WxTkG1QDpujzOl25tlNw3TL3JHSqNAELr47KZr_D7IXTy_F-RH-Ym4aojx1VLroNQ0/s320/BuildLazQuick.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5539906084867435346" /></a><br /><br />The original GUI was named "Advanced" tab sheet (as seen in the first picture).<br />A problem was that this Quick page was not very intuitive either.<br />There were radiobuttons for options which is OK but then also 2 settings for LCL Interface, Target and IDE. They were never both enabled at the same time. So weird. If some Lazarus user really was so "non-advanced" that he needed this simplified page, how could he understand the difference between Target and IDE LCL Interfaces?<br /><br />The worst problem however was that the Quick settings modified directly the Advanced settings, but there was no visual feedback about it. It took some time to realize it. A generally accepted GUI convention is that tabs have individual separate sheets. I remember I started using the Advanced page very soon although I was not an advanced user yet. I dare to say very few people used the Quick page.<br /><br />Already a year ago I created a big patch implementing Build Profiles. It kind of extended the idea of quick selections and made it configurable. It also made the GUI more intuitive. In fact the sane GUI was my main motivation, the profiles were more like an extra bonus.<br />It was my first substantial patch for Lazarus and I had to study lots of code for it. At the same autumn I had started evening school (although I am not young). Now I can reveal that I made the Lazarus patch partly when I should have read to my math exam. Under pressure my mind goes into a hyper-active state or something. A psychologist could maybe explain it better. Anyway, I scored well in the math exam, too, no problem.<br /><br />My feature got attention and mails were written but it was not accepted. Actually I created many versions of the GUI based on feedback.<br />The first version had everything at the same page in 2 panes, Profiles pane and Details pane. That was intuitive but big and crowded.<br />The second version had a clear list of profile names and a button that opened a details form for the selected profile. That is still my favourite. It is the most intuitive GUI for such things.<br />It was rejected because the (hard-)core developers want to use the settings as before. The dialog has to be "settings oriented", not "profile oriented". The third version (= the current dialog) follows that idea.<br /><br />For a while the patch was forgotten but I salvaged it using a local git branch. Recently, finally, it was accepted to Lazarus trunk! After that it was changed some more based on feedback. Widgetset is now selected using a combobox instead of radiobuttons. Options have more room in a multi-line memo and there is a user-configurable list of defines to select from. Etc...<br />The latest (for now) version looks like this:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjokWa3p0TultbzbDXJuSwc3NxGnZIqsEwQqxc-lLU3CqZMShcw1X9oHQ0RH9LtKBYRoUkeoGyEfhoXbLWU1GC0R9pdvJGGfEWxeOk2LoIpy1QLjSNo786vjuv_JIA64wwaSLWXl0IPMoI/s1600/BuildProfiles.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 293px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjokWa3p0TultbzbDXJuSwc3NxGnZIqsEwQqxc-lLU3CqZMShcw1X9oHQ0RH9LtKBYRoUkeoGyEfhoXbLWU1GC0R9pdvJGGfEWxeOk2LoIpy1QLjSNo786vjuv_JIA64wwaSLWXl0IPMoI/s320/BuildProfiles.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5539926183060881794" /></a><br /><br />There is another dialog for managing the profiles:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7KXLCcsKyWGOgX0S_P4E-aFJ2oXpTF6oHVSMS50PQilVanwgdYQ_ufBFpFCkIjhOvB9oQdEa4areq3PVb8a_cGR40y3ibxx7LXs3BkaVXnBMBJk58hDsEoWYRpyCQjIc_VKKc8zjEKr4/s1600/BuildProfilesManager.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 302px; height: 317px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7KXLCcsKyWGOgX0S_P4E-aFJ2oXpTF6oHVSMS50PQilVanwgdYQ_ufBFpFCkIjhOvB9oQdEa4areq3PVb8a_cGR40y3ibxx7LXs3BkaVXnBMBJk58hDsEoWYRpyCQjIc_VKKc8zjEKr4/s320/BuildProfilesManager.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5539927423979110338" /></a><br /><br />I got positive feedback especially from people who cross-compile. The GUI is still complex but it is intuitive and very usable.<br /><br />A more philosophical point can be made, too. GUIs should be designed and implemented by different people. As a mind-set, GUI design is more close to graphics design than to computer programming.<br />If no such designers are available, at least comments from outsiders (not Lazarus user) should be listened. I noticed myself that one gets used to confusing GUIs very quickly. A month or two passed and I didn't pay attention to it myself.<br />Open source projects with financial backing usually concentrate more on visual appearance. And commercial SW, too, of course, but sometimes they consider visual appearance more important than code quality which is not good either.<br /><br /><br />JuhaJuhahttp://www.blogger.com/profile/00683714934356550090noreply@blogger.com2tag:blogger.com,1999:blog-4939523172768679277.post-44193779908723900942010-09-27T11:05:00.016+02:002010-09-27T13:30:23.534+02:00Delphi Converter improvesConverter has taken a big step forward during the past few months. The main features I had in mind are now implemented. Most details are configurable in Settings dialog. All settings are saved in file <span style="font-weight:bold;">delphiconverter.xml</span> in local Lazarus configuration directory and thus are persistent.<br /><br />This is the settings dialog:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh64zWnciLcR7qZBS7hOheJgNLjgToLZPPKUKmGhgx7H9Fq1wrRoMVYC1MviN0RWjUP24gMo7I7V2RSlu5QHyt_-OTOX_JNUoGyPIP3wE-9RuSFuISS-EDxKJKvJMPA_Ws5s4Ila9JO6cs/s1600/ConvertSettings.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 281px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh64zWnciLcR7qZBS7hOheJgNLjgToLZPPKUKmGhgx7H9Fq1wrRoMVYC1MviN0RWjUP24gMo7I7V2RSlu5QHyt_-OTOX_JNUoGyPIP3wE-9RuSFuISS-EDxKJKvJMPA_Ws5s4Ila9JO6cs/s320/ConvertSettings.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5521520534486885810" /></a><br /><br /><br />There is a wiki page with detailed explanation of conversions: <a href="http://wiki.lazarus.freepascal.org/Delphi_Converter_in_Lazarus">Delphi_Converter_in_Lazarus</a><br /><br />Here is a brief list of them.<br /><br /><H2>Conversions for Unit file</H2><br />* All unit source files get a {$mode delphi} directive. It makes the compiler support language syntax exactly like Delphi has it.<br /><br />* {$R *.DFM} is replaced with {$R *.lfm} if the form file is renamed and converted. Conditional compilation is used if the target is "Lazarus and Delphi".<br /><br />* Unit names in Uses section and include file names are fixed to match the real case sensitive name found in the file system. This is needed for case sensitive file systems.<br /><br />* Some unit names in Uses section are either replaced or removed.<br /><br />* Some Delphi types are replaced with "fall-back" LCL types (same as in form files).<br /><br />* Some function names called in the code are replaced.<br /><br /><H2>Conversions for Form file</H2><br />* Older Delphi versions used a binary format for .dfm form files. The converter always converts them to ascii text format.<br /><br />* .dfm form file is renamed or copied to .lfm and converted as needed. There is also an option to use the same Delphi form file directly. See section Target below.<br /><br />* Unknown properties are removed.<br /><br />* Some Delphi types are replaced with "fall-back" LCL types (same as in unit files).<br /><br />* Top and Left coordinate offset adjustment for controls inside visual containers.<br /><br /><H2>Implementation details</H2><br />Codetools are used a lot when changing the source code and .lfm form file. <br /><br />One challenge was to replace function calls inside the source code, using parameters from the original call as defined in configuration. Codetools create a parse tree of the code but it includes only definitions, not function calls or other code constructs.<br />It means that the source code must be parsed char by char when looking for function calls to replace. Fortunately there was <span style="font-weight:bold;">TFindDeclarationTool.FindReferences</span> which I could use as the base for my <span style="font-weight:bold;">TConvDelphiCodeTool.ReplaceFuncCalls</span>. I copied the code, studied and debugged it for some time, then stripped useless parts out and added more code for replacing the function calls.<br /><br />Another challenge was adjusting <span style="font-weight:bold;">Top</span> and <span style="font-weight:bold;">Left</span> coordinates of controls inside visual containers.<br />I based my <span style="font-weight:bold;">TConvDelphiCodeTool.CheckTopOffsets</span> on <span style="font-weight:bold;">TStandardCodeTool.CheckLFM</span>.<br />Again, I copied, studied, stripped, modified and added code.<br /><br />The huge code-base of codetools looks first almost incomprehensible. The code browsing features of Lazarus are a big help here. They let you jump around code with no delays. After jumping and debugging for some time the code starts to make sense, piece by piece.<br /><br />It is funny. When you first look at complicated code in a big project, you think: "oh, who is able create such code?". Then you make some code yourself and then have a month or 2 pause, and then look at the code and think: "oh, who has made this? Must be a clever person! ... oops, it is my own code...".<br />I guess other coders have similar feelings. Nobody can handle big amounts of code at one time. Sometimes you concentrate on the big picture and forget the details, sometimes you fiddle with the details and forget everything else.<br />In the end, for an outsider, the code may look like some intelligent person had made it. :-)<br /><br />Juha ManninenJuhahttp://www.blogger.com/profile/00683714934356550090noreply@blogger.com2tag:blogger.com,1999:blog-4939523172768679277.post-28400955038051850482010-06-02T20:55:00.004+02:002010-06-02T21:22:43.191+02:00User defined color-schemes<div style="text-align: justify;">As the lazarus community grows people yearn for more customizations to please their personal habits.<br /></div><br /><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNjBQe5-mqcQVPgtEpNZMWiirV6JKaxlv_sfWVUBn-_Jj434Y8L0QfmyDqLhqAbRvPauxFf8coqLjNEtfoWnClXBu4ZkiIJbDUAXhvwq5e2d8EWRaS7fQnYHd5vvlPkKBMDusnMEd8DA/s1600/OwnColorScheme.png"><img style="cursor: pointer; width: 400px; height: 167px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNjBQe5-mqcQVPgtEpNZMWiirV6JKaxlv_sfWVUBn-_Jj434Y8L0QfmyDqLhqAbRvPauxFf8coqLjNEtfoWnClXBu4ZkiIJbDUAXhvwq5e2d8EWRaS7fQnYHd5vvlPkKBMDusnMEd8DA/s400/OwnColorScheme.png" alt="" id="BLOGGER_PHOTO_ID_5478254023553564338" border="0" /></a><br /><br /><div style="text-align: left;"><div style="text-align: justify;">To help creating a wider choice of readily available settings, user defined color schemes have been introduced.<br /></div><br /><div style="text-align: center;">So now, your community needs you.<br /></div><br />Get the latest Lazarus snapshot, load your favourite color settings (or create the perfect scheme from scratch) and then make it available to all of us. All you need is press "Export", enter a Name and save it.<br />Upload it to your home page, or a place of your choice and link it on our wiki so everyone will find it.<br /><br /><div style="text-align: left;">Wiki page to link to your scheme(s): <a href="http://wiki.lazarus.freepascal.org/UserSuppliedSchemeSettings">wiki.lazarus.freepascal.org/UserSuppliedSchemeSettings</a><br />Documentation: <a href="http://wiki.lazarus.freepascal.org/IDE_Window:_Editor_Options_HighlightColors">wiki.lazarus.freepascal.org/IDE_Window:_Editor_Options_HighlightColors</a><br /></div></div></div>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-4939523172768679277.post-47066636015095920492010-04-22T14:56:00.007+02:002010-04-22T16:46:42.317+02:00"Page-Locking" or "multiply Editor-Windows (part 2)"<div style="text-align: justify;">Following up the article about <a href="http://lazarus-dev.blogspot.com/2010/04/using-multiply-editor-windows.html">"Using multiply Editor-Windows"</a>, let's look at some more advanced scenarios.<br /></div><br /><div style="text-align: justify;">You may want to use two editors, so that one shows you the interface of your class, while in the second you can work on the implementation of it.<br /></div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEVKzy-WGuvK_l0gZ6LoyERcTz_DBK1TlVwW7533Rj1HRvcKvuNsmCgT_nPd1QrAm7BIBkE6I16PfyRc5rf1yxfZRtXuyfttG_UhJhPzG69z041sDAlXb7kuKPuPNXWd8eJ6AKDftAcQ/s1600/locked_edit2.png"><img style="display: block; margin: 0px auto 10px; cursor: pointer; text-align: center;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEVKzy-WGuvK_l0gZ6LoyERcTz_DBK1TlVwW7533Rj1HRvcKvuNsmCgT_nPd1QrAm7BIBkE6I16PfyRc5rf1yxfZRtXuyfttG_UhJhPzG69z041sDAlXb7kuKPuPNXWd8eJ6AKDftAcQ/s400/locked_edit2.png" alt="" id="BLOGGER_PHOTO_ID_5462945447775251554" border="0" /></a><br /><div style="text-align: justify;">The only thing is, once you have carefully positioned the first editor, you must always make sure, that you don't move it by accident. If it gets focus and you trigger a jump-to-implementation (or a jump to history/bookmark in this file), it will move away from your chosen location and you have to re-position it again.<br /></div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0gwhtf2odD7s31-d6gQyuHMuHcwzN9Mtld_VBeoeryneiW2b5dy6WUNk1ajxxHdA0CDtwUCyPOxnTOmOyImiYvj55NEg06_xjDxwQSPddSD8vieCE-1FDDDfs072-jxI_cmt8fr5-0Q/s1600/lock_menu2.png"><img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 140px; height: 119px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0gwhtf2odD7s31-d6gQyuHMuHcwzN9Mtld_VBeoeryneiW2b5dy6WUNk1ajxxHdA0CDtwUCyPOxnTOmOyImiYvj55NEg06_xjDxwQSPddSD8vieCE-1FDDDfs072-jxI_cmt8fr5-0Q/s320/lock_menu2.png" alt="" id="BLOGGER_PHOTO_ID_5462948159635180082" border="0" /></a><div style="text-align: justify;">This is where page-locking comes in. You can tell Lazarus, that it shouldn't move this editor away from your chosen location. The context menu has an entry "Lock Page" which will toggle the lock for the page. If the page is locked the entry in the context menu has a checked mark, and the editor tab will show an "#" in front of the file-name. (The command can also be assigned to the keyboard.)<br /></div><br /><div style="text-align: justify;">Once your page is locked, Lazarus will no longer move it to other locations. You can still go to the editor and use the cursor keys or page up/down to reposition it. But if you try to jump between interface and implementation, go to declaration, bookmarks, etc, the IDE will automatically change to the other editor showing this file and move the other editor to the location you want to see.<br /></div><br /><div style="text-align: justify;">So now in the example with the class declaration in one window, you can choose any method declaration of the class in the fixed window, and then trigger a jump to it's implementation. And it will always end you up in the 2nd window, in which you want to edit the code.<br /></div><br /><div style="text-align: justify;">But what if you are in the 2nd window and jump back to the interface of your class? You don't need to have both windows showing the same code. By default Lazarus will recognize that your first (locked) window, already displays the interface. And the IDE will take you back to this first window.<br />Lazarus offers you some settings, to change this behaviour, if you like a different behaviour. (<a href="http://wiki.lazarus.freepascal.org/IDE_Window:_Editor_Options_MultiWindow">See Options / Editor / Multi Window</a>)<br /></div><br /><div style="text-align: justify;">And what happens if you accidentally lock an editor that has no 2nd view of the file? or you lock all editors of a given file? If that happens, Lazarus will open a new editor in a new tab (in an existing or even in a new window) for you. And if you don't like that, you can change the options so lazarus will ignore the locks, if this case arises.<br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4939523172768679277.post-88033618396454638262010-04-20T15:36:00.016+02:002010-04-20T19:21:20.166+02:00Using multiply Editor-Windows<div style="text-align: justify;">During development a programmer encounters many different tasks. Some of them require you to work locally on the implementation of a single method. Code completion and hints can provide you with anything you need to know about other methods or objects that you access.<br /></div><br /><div style="text-align: justify;">Other work requires you to frequently work on many different places in your code. Refactoring is a good example:<br /><ul style="text-align: justify;"><li>Comparing different methods side by side to find duplication.</li><li>Extracting functionality and moving it to a new location. Viewing both locations at the same time.</li><li>Changing the interface of your class, viewing interface and implementation next to each other</li></ul></div><br /><div style="text-align: center; font-weight: bold; font-size: 1.2em">Multiply Windows</div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiQxhAFrNWYKbXTYDKXcSmMEa3Hn0NQSBm9UOfq2vfMqInsUz7yP9ZRFD2ZSLkNV9Lsyd7QmOOOqLV9z6zfEDMkcLjGi97FyDcWGPS_ebYkRHn1YTIMqmDJsZv-y9nF5vv3w76OhOtfg/s1600/three_src_edit_medium2.png"><img style="float: right; margin: 0pt 0pt 10px 10px; cursor: pointer; width: 400px; height: 335px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiQxhAFrNWYKbXTYDKXcSmMEa3Hn0NQSBm9UOfq2vfMqInsUz7yP9ZRFD2ZSLkNV9Lsyd7QmOOOqLV9z6zfEDMkcLjGi97FyDcWGPS_ebYkRHn1YTIMqmDJsZv-y9nF5vv3w76OhOtfg/s400/three_src_edit_medium2.png" alt="" id="BLOGGER_PHOTO_ID_5462215293450036338" border="0" /></a><div style="text-align: justify;">Lazarus can now open as many Source-Editor-Windows as you want, and you can freely move files between them.</div><br /><div style="text-align: justify;">Each Window offers you the same functionality as the current Source-Editor-Window. Each window can hold one or more files, accessible through editor-tabs.<br /></div><p style="clear: both;"> </p><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSaGw14w27td7ALJabZDFQuFma-d_cT-QvvWywg1rVgFtomT4Gy2TgvLwOok_tqmdiVHKe7R11zCdxfyJlphzfhfflawrWaIRkOEP5Ozwv_4zDK741p_cpfcXdgEQyTnu8WBmc9JsN5Q/s1600/menu.png"><img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 145px; height: 132px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSaGw14w27td7ALJabZDFQuFma-d_cT-QvvWywg1rVgFtomT4Gy2TgvLwOok_tqmdiVHKe7R11zCdxfyJlphzfhfflawrWaIRkOEP5Ozwv_4zDK741p_cpfcXdgEQyTnu8WBmc9JsN5Q/s200/menu.png" alt="" id="BLOGGER_PHOTO_ID_5462217058400267202" border="0" /></a><div style="text-align: justify;">You can move a file by using the context menu and selecting "Move to new Window".<br/>Once you have more than one Window open, you can also choose "Move to other Window".<br /></div><br /><div style="text-align: justify;">Or you can drag and drop the editor tabs between the windows. If you prefer using the keyboard, you can assign your own key-shortcuts.<br /></div><br /><div style="text-align: justify;">If you often have a window with just one tab open, you may find it helpful to hide the tab header and get more space for the editor. An option to do so can be found on the misc editor options.<br /></div><br /><div style="text-align: center; font-weight: bold; font-size: 1.2em">Editing the same file in multiply Windows.</div><br /><div style="text-align: justify;">Sometimes it is not enough to view two different units side by side. Sometimes you need to see different parts of the same unit.<br /></div><br /><div style="text-align: justify;">Lazarus can do that too. You can open as many editors for the same file as you want.</div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU5wRP4PafgA7FxddQOoAlPqvUDEbf2fN-0RkdwjgPFSHIsz9hWg_gl3p_dQVPr_X_qqDxhsAigP3NHg9VGTyq5IL8BcBqjZBYK9NZmDUgptugBGKQWML1F6s2TcFHGNjyExRKkPxD_g/s1600/dual_view.png"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 129px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU5wRP4PafgA7FxddQOoAlPqvUDEbf2fN-0RkdwjgPFSHIsz9hWg_gl3p_dQVPr_X_qqDxhsAigP3NHg9VGTyq5IL8BcBqjZBYK9NZmDUgptugBGKQWML1F6s2TcFHGNjyExRKkPxD_g/s400/dual_view.png" alt="" id="BLOGGER_PHOTO_ID_5462221052779518962" border="0" /></a><div style="text-align: justify;">Choose "Copy to new Window" from the context menu. Or once you have several windows open drag and drop while pressing the CTRL key.<br /></div><br /><div style="text-align: center; font-weight: bold; font-size: 1.2em">How it works:</div><br /><div style="text-align: justify;">Lazarus will keep one single instance of the file open. This instance is shared by all the editors that you opened for this file.<br />If you type in one editor, the changes are always made in all open editors at the same time.<br /></div><br /><div style="text-align: justify;">Actions like saving or reverting your code always act on the file. It does not matter in which of the opened editors you trigger them, they will affect all the editors that display the file.<br /></div><br /><div style="text-align: justify;"><br />Other actions are done per editor. For example you can select a different block of text in each editor, and the selection(s) will be kept while you can edit the text in an other editor.<br /></div><br /><div style="text-align: center; font-weight: bold; font-size: 1.2em">Limitations</div><br /><div style="text-align: justify;">Lazarus only allows you one copy of a file per window. You can not have two tabs with the same file in the same Window. But you can open as many windows as you like, each having one copy of the file.<br /></div><br /><div style="text-align: justify;">Undo information is combined for all editors of a file.<br />For example: Modify a file in one editor, then do further modifications in another editor. Now go back to the first editor. If you press undo in the first editor, it will first undo the changes of the other editor, before undoing the changes you applied in this editor.<br /></div><br /><div style="text-align: justify;">This is necessary to avoid conflicts. If you had inserted text in the first editor and then deleted this text in the 2nd editor, it would be impossible for the first editor to undo the insert, because the inserted text is no longer there.<br /></div><br /><div style="text-align: center; font-weight: bold; font-size: 1.2em">A word about adding more windows to Lazarus.</div><br /><div style="text-align: justify;">Many people feel that the Lazarus IDE already has to many Windows, and efforts should be made to reduce the amount. So why adding even more Windows?<br /></div><br /><div style="text-align: justify;">Very simple. Using multiply Windows did offer the highest amount of flexibility for now. Having to implement all this with splitters inside a single window would have added serious amounts of extra work or more likely cut-backs on the flexibility of this feature.<br /></div><br /><div style="text-align: justify;">Once Lazarus will have docking, the Source-Editor-Windows will benefit from this as well.<br/>On top of that there is of course room to think about specific optimizations, such as splitting a single tab, for two views of the same file. When and if this will be done, remains to be seen.<br /></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4939523172768679277.post-66523256618329190962010-04-15T15:29:00.017+02:002010-04-23T01:32:10.613+02:00Delphi ConverterThe converter has improved during past few months. The main focus has been in Delphi project conversion. Delphi package conversion should get most of the same improvements automatically but it is not tested much.<br /><br />I think Delphi converter is a very important piece of Lazarus because new people coming from Delphi often want to try it. They get their first impression of Lazarus from it.<br />When I started to learn Lazarus last year, it was one of the first things to test. Then it failed to convert most projects. Its quality was not equal to the rest of Lazarus.<br /><br />On February 2010 I got write access to SVN trunk converter directory. I made the converter code more object oriented. Using object member variables instead of function parameters made it easier to extend the code later. I refactored the code heavily, actually more than really necessary, partly to organize it better and partly to learn what it does.<br /><br />The initial dialog shows there are three possible targets for the conversion:<br />* "Lazarus/LCL" -- One way conversion.<br />* "Lazarus/LCL for Windows only" -- Does not remove or convert windows specific unit names.<br />* "Both Lazarus/LCL and Delphi" -- Tries to maintain the code compatible with both Delphi and Lazarus using conditional compilation.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRtXysBAJd02a0cbqHo3UL0Ppeo4pMIldeKwhJC2ja6GzyRLnqps00dtVKgmv-Z1Gwn-zC9ow4KbXSHYgyf7KywCWmfid1i82hKzntnFby2kKLggV5-4KXZ9XPEYsp8H05HjoqBjdITv0/s1600/ConverterStart.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 221px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRtXysBAJd02a0cbqHo3UL0Ppeo4pMIldeKwhJC2ja6GzyRLnqps00dtVKgmv-Z1Gwn-zC9ow4KbXSHYgyf7KywCWmfid1i82hKzntnFby2kKLggV5-4KXZ9XPEYsp8H05HjoqBjdITv0/s320/ConverterStart.jpg" alt="" id="BLOGGER_PHOTO_ID_5463054493158040594" border="0" /></a><br /><br /><h3>Source file conversion</h3><br />Initially the main goal was to reduce messageboxes and other notifications. Converting a big Delphi project was not realistic because there were so many messages. Now useless questions are removed and notifications go to IDE messagewindow.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkwendaqAQyCX6XMnnO69JNq-JmN5Y3r-NIYWmrgu5Ey8euQ9AZFwA1ZhM6DzBFOAUMJ3Jj2YOfb9hZjEsv6edhAD9VabZp1wTqfk2_b3X-cT16Bko2M_BXsxXTqWC8_VJN77KtuQf20c/s1600/UnitsNotFound.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 110px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkwendaqAQyCX6XMnnO69JNq-JmN5Y3r-NIYWmrgu5Ey8euQ9AZFwA1ZhM6DzBFOAUMJ3Jj2YOfb9hZjEsv6edhAD9VabZp1wTqfk2_b3X-cT16Bko2M_BXsxXTqWC8_VJN77KtuQf20c/s320/UnitsNotFound.jpg" alt="" id="BLOGGER_PHOTO_ID_5463051952950825842" border="0" /></a><br /><br />Earlier it was possible to comment out not-found unit names in USES section. Now that is extended. The user can either comment them out or search for a unit path during conversion. If the units are found, their path is added to project settings. If user chooses to comment them out, the same units are then commented automatically in following source files.<br /><br />Used unit names can also be replaced by other unit names. Regular expression syntax for replacement is supported.<br /><br /><br /><h3>Form file conversion</h3><br /><br />The other big part of conversion is the DFM form file conversion. Some properties of Delphi components do not exist in the equivalent LCL components. They can be deleted, either automatically or interactively.<br />A bigger problem are Delphi components which don't exist in LCL at all. It is important to replace them with a "fall-back" LCL component, especially if they are containers and have more components inside them.<br />Now the components can be replaced and regular expression syntax is supported, just like for unit name replacement.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaXQ0Ck0DxcuEBRle8F1LHdwHailfwHtGNYLH69Y3V5j6HtKGCgFi57-ktxmsFOJCLH4T2qB8XT3cBRbSkwaqrsarfPt1f0-p2wsTyBmL3rIPIvAYRH_7O2pJTi3cwbYx6_GPhhJ1Cpr0/s1600/FixLfm.jpg"><img style="margin: 0pt 10px 10px 0pt; display: block; cursor: pointer; width: 320px; height: 197px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaXQ0Ck0DxcuEBRle8F1LHdwHailfwHtGNYLH69Y3V5j6HtKGCgFi57-ktxmsFOJCLH4T2qB8XT3cBRbSkwaqrsarfPt1f0-p2wsTyBmL3rIPIvAYRH_7O2pJTi3cwbYx6_GPhhJ1Cpr0/s320/FixLfm.jpg" alt="" id="BLOGGER_PHOTO_ID_5463052951013953506" border="0" /></a><br /><br /><h3>Issues</h3><br />The converter is not ready yet. These are some issues and problems I must solve.<br /><br />Replacement names for both units and components are hard-coded. Soon they will be stored in a XML configuration file and the user can edit them.<br /><br />A complex codetools function CheckLFM is used for scanning the form file. It stops working when there are errors in source. There are often errors in a unit under conversion so this is a problem.<br />I must study and fix the codetools functions or even replace them with something.<br /><br />Replacing a component with a "fall-back" LCL component leads to more unknown properties. It must be solved somehow.<br /><br />JuhaJuhahttp://www.blogger.com/profile/00683714934356550090noreply@blogger.com2tag:blogger.com,1999:blog-4939523172768679277.post-9005526927699168352010-02-12T09:28:00.008+01:002010-11-30T09:58:14.325+01:00Work on 0.9.30: changes in resource handlingOne of the big changes we have in the svn trunk (you'll get it with the 0.9.30 release) is the modified resource subsystem. Since the first time I tried Lazarus I felt a big displeasure regards the resource handling. I believe you had similar feeling too if you are an old Delphi developer. The main problem was that each lfm stream (Lazarus form) must be duplicated in a .lrs file which is included in unit initialization section. What is bad in this? <div><ul><li>First of all lrs needs to be <b>stored</b> with your project and therefore eats the free space. </li><li>The second bad thing is <b>initialization </b>section - a special routine which is called on your program start. Thus your application will run 200 routines at the start if you have 200 forms. Not very nice if you care about the speed.</li><li>And the last is the amount of <b>memory </b>required for resources and how this memory is allocated. Lrs resources are stored both in the code of your executable (which loads on start) and a TList. Thus each resource is stored twice. Moreover when you add a new resource TList code needs to reallocate the memory used for all resources it has (look at TList.Grow).</li></ul>All these problems are perfectly solved by the native resource support which is finally implemented by FPC 2.4.0 Starting from 2.4.0 release of FPC it is possible to include a form resource using the {$R *.lfm} (or {$R *.dfm} if you want to include a Delphi form resource) directive. Of course we don't need to store lrs file anymore, we don't initialization section and each resource is stored once in some section of your executable.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgro8uJLVcEryoqyaeRb8GRN9pdtlhKUC9p5mYrRvslmsXx6_h_trHGptjnkp0mogNTy4kr4_QOsWX7vflLTu_rfKfqdPto1wHBg1H47Z51iDnv06oZjw75KzfYZWwnQKCUkjrvOxiqZBXx/s1600-h/resource_type.PNG"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 400px; height: 201px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgro8uJLVcEryoqyaeRb8GRN9pdtlhKUC9p5mYrRvslmsXx6_h_trHGptjnkp0mogNTy4kr4_QOsWX7vflLTu_rfKfqdPto1wHBg1H47Z51iDnv06oZjw75KzfYZWwnQKCUkjrvOxiqZBXx/s400/resource_type.PNG" border="0" alt="" id="BLOGGER_PHOTO_ID_5437284607144214674" /></a></div><div>Since this way of resource handling is more effective we decided to use it by default in Lazarus. Of course we don't deprecate or remove in anyway lrs support. You are able to choose how to store the form resources in the project options dialog.</div><div><br /></div><div><span class="Apple-style-span" style="color:#FF0000;"><b>Warning</b></span>: FPC 2.4.0 has 2 small bugs which are already fixed in the svn trunk (revisions 14805 and 14824). It opens all the resource files during linking and if you have small <b>ulimit </b>value you may see a linker error. To workaround the problem set ulimit to a bigger value. The second problem is that your project can't contain special symbols (like spaces) in the path.</div><div><br /></div><div>Another rework we've made regards resources are the <b>xp manifest</b>, <b>version info</b> and <b>project icon</b> handling. Previously we created up to 5 files to add those resources to an executable: lrs file with an icon resource, rc file which included in turn manifest, version info and project icon files. So you had a whole zoo in the project directory. Now you have only a res and an icon files. We are building the res files ourself using the new FP package <b>fcl-res</b>. This mean also that we don't need finally to use windres. Res file is now used for all platforms while previosly rc was used for windows only and lrs for other platforms.</div><div><br /></div><div></div><div><span class="Apple-style-span" style="color:#FF0000;"><b>Warning</b></span>: you need to remove {$ifdef windows}{$R you_project.rc}{$endif} from your lpr file manually (if you have it there). Maybe we'll implement a way to detect and remove that automatically before the release.</div><div><br /></div><div>I want to summarize what advantages we have with the new resource support:</div><div><ol><li>Less garbage in the project directory and smaller size.</li><li>Smaller and faster executables (because of no initialization sections).</li><li>Less memory usage.</li><li>Unified resource handling on all platforms.</li></ol>As as special bonus for component developers I can note a possibility to use one form resource for both Delphi and Lazarus which can be included by {$R *.dfm} :)</div><div><br /></div><div>This is a resource handling revolution, isn't it?</div>Anonymoushttp://www.blogger.com/profile/13087299539963377503noreply@blogger.com4tag:blogger.com,1999:blog-4939523172768679277.post-41985833402536659362009-06-23T08:28:00.011+02:002009-06-24T09:37:52.828+02:00Vote for LazarusThank you, people from the Lazarus community! For the first time of our project history Lazarus has been nominated for SourceForge's <a href="https://sourceforge.net/community/cca09/">Community Choice Award</a> in the category "<a href="https://sourceforge.net/community/cca09/categories/">Best Tool or Utility for Developers</a>".<br /><br />Grab your chance to let others know how much you like Lazarus by <a href="http://sf.net/community/cca09/vote/?f=476">voting</a> for Lazarus. Spread the news and don't forget to <a href="http://sf.net/community/cca09/vote/?f=476">vote</a>, this time to make us winners.Vincent Snijdershttp://www.blogger.com/profile/04065272115346942274noreply@blogger.com1tag:blogger.com,1999:blog-4939523172768679277.post-14038536136818207102009-05-13T05:20:00.010+02:002009-05-13T10:02:45.098+02:00Changes with Button Glyphs<div style="text-align: left;"><span class="Apple-tab-span" style="white-space: pre;"> </span>If you ever worked with the Lazarus IDE under windows (or just compiled an LCL application for windows) you were probably sickened by the glyphs on the dialog buttons since it is not native for windows. But on linux all is vice versa - most of the buttons have glyphs (and for example gtk and qt suggest an appropriate API to query "stock" images for buttons with various actions like save, open, apply, cancel, ...).</div><div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>Therefore I needed a solution which can satisfy both windows and linux users. I started from the TBitBtn class which represents a button control with an image inside it. What I have added is a new property "GlyphShowMode" with 4 states:</div><div><ul><li>gsmAlways</li><li>gsmNever</li><li>gsmApplication</li><li>gsmSystem</li></ul></div><div>It is clear what the <b>gsmAlways </b>and <b>gsmNever </b>states are for: <b>gsmAlways </b>- to show the glyph always and this is how it worked before, <b>gsmNever </b>- to show the glyph never. Well, you may ask: <i>What </i><i>do I need the gsmNever state for<span class="Apple-style-span" style="font-style: normal;"><i>, if I can use a TButton instead?</i>. And I would answer: <i>TBitBtn is not just a button <span class="Apple-style-span" style="font-style: normal;"><i>with an image. It also has a Kind property which is very useful to set the ModalResult and Caption of a button :)</i> But let's return to the other modes. <b>gsmSystem </b>can be used to show glyph depending on current OS - on MS Windows glyph will not be shown and on other system it will. And the last mode which is also default for this property - <b>gsmApplication</b>. In this mode TBitBtn (well, not exactly TBitBtn but TButtonGlyph) will look at the Application object for its value.</span></i></span></i></div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>So, you can control the visibility of all button glyphs using the Application object. How? There are 2 ways: at run time by changing the Application.ShowButtonGlyphs property or at design time by changing the same property for the TApplicationProperties component. TShowButtonGlyphs is an enumeration too with following elements similar to TGlyphShowMode:</div><div><ul><li>sbgAlways</li><li>sbgNever</li><li>sbgSystem</li></ul><span class="Apple-tab-span" style="white-space: pre;"> </span>The default value for the ShowButtonGlyphs property is sbgAlways and not sbgSystem as one may expect. The reason is compatibility with old applications. Developers don't like surprises after a development tool upgrade and the loss of images is not a nice surprise. Anyway, it is not difficult to change the behavior of your application.</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>One more thing - glyphs are always visible when you are designing your forms. The glyph visibility mode is applied to the controls only at run time (when you start your application).</div><div><br /></div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>And now with regards to the Lazarus IDE. After this change the IDE on windows does not show glyphs on buttons by default, but if you really liked them, you can ask IDE to return them. You need to open the IDE options dialog and select Desktop settings:</div></div><div><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcNILu9EHU-kyNFSlGaOsR_5LW-yW3PIprwhwxoQeyiDnYIUcHr_TaF0WZ7288sELcVknsFSunfn_0befEL5i4x272GX3gSqwCeYnyqSunybhFHE-J62cQSzhGj5EB5skndXIppCCwi0-R/s400/glyphs_options.PNG" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 310px;" alt="" id="BLOGGER_PHOTO_ID_5335177495425534434" border="0" /><div><br /></div></div>Anonymoushttp://www.blogger.com/profile/13087299539963377503noreply@blogger.com6tag:blogger.com,1999:blog-4939523172768679277.post-44668270217995606862009-04-21T19:50:00.005+02:002009-04-21T20:35:42.542+02:00No updates on the 0.9.26 fixes branchI have decided to stop merging revisions from Lazarus trunk to the fixes_0_9_26 branch. There are two reasons:<br /><ol><li>The differences between trunk and the fixes branch have become too many, over a thounds revisions. It is difficult to oversee their relations and dependencies, so I cannot guarantee the quality of the fixes branch just by looking at the patches and revision logs.</li><br /><li>I want to focus on the 0.9.28 release rather than maintaining 0.9.26.3 and working on a 0.9.26.4 release.</li></ol>That said, it doesn't mean 0.9.28 is almost ready, a lot of work still needs to be done. The list of issues with that we want to fix before the 0.9.28 release contains about 50 items.<br /><br />So, from now on nobody from the current Lazarus team maintains the 0.9.26.3 branch. If somebody from the community is using the Lazarus fixes branch on a daily basis and want to extend its life, then that is possible. The new maintainer would supply me a list of revisions to be merged and tests the fixes branch. I would do the actual merging and keep the snapshots of the fixes branch alive. If you are interested, you can contact me and we can work out the details.Vincent Snijdershttp://www.blogger.com/profile/04065272115346942274noreply@blogger.com1tag:blogger.com,1999:blog-4939523172768679277.post-79857501605196847982009-03-26T09:48:00.005+01:002009-03-26T13:49:01.526+01:00fpsvnsync, thanks for your servicesSince March 2007, the Lazarus SVN repository has been mirrored on <a href="http://lazarus.svn.sourceforge.net/viewvc/lazarus/">SourceForge</a>. Mirroring it on SourceForge is nice, sometimes people have trouble reaching svn.freepascal.org. And the svn commits count for the SourceForge ranking. Because SourceForge did not allow changing the revprops like author and date, I could not use the official tool called <a href="http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.reposadmin.maint.replication">svnsync</a> to create such a mirror. I submitted <a href="https://sourceforge.net/tracker/?func=detail&aid=1655191&group_id=1&atid=350001">a tracker item</a> at SourceForge to allow changing revprops, but two years nothing happened. So I wrote a watered down version of svnsync which would do almost the same as svnsync and named it <a href="http://wiki.lazarus.freepascal.org/fpsvnsync">fpsvnsync</a>.<br /><br />Last week I browsed the SourceForge site status and found an <a href="http://apps.sourceforge.net/wordpress/sourceforge/2009/03/13/subversion-revprops-management-enabled/">announcement about enabling revprops</a>. This is good news, fpsvnsync does it job, but it needs both trees checked out and it is not as efficient as svnsync itself, because it starts a svn process several times for each changed file.<br /><br />Last Monday I made a svndump of the Lazarus repository to get all those names and dates (which fpsvnsync cannot / could not set correctly) right. For your information, is a 700 MB file after bzip2-ing. I imported it on SourceForge using the svn migration page. Then I had a surprise when started svnsync init:<br /><pre>svnsync init https://lazarus.svn.sourceforge.net/svnroot/lazarus \<br />http://svn.freepascal.org/svn/lazarus<br />svnsync: Cannot initialize a repository with content in it</pre><br />It only works on empty repositories. Three hours of import wasted.<br /><br />So I imported an empty repository and called svn init on that repository. Using svnsync sync would be an option to make the mirror up to date, but importing more than 19000 revision this way didn't seem to be a wise choice. So I imported the 700 MB dump again, but without clearing the existing one. But still the svnsync utility didn't want to work. I had to set the svn:sync-last-merged-rev property manually, svnsync keeps this revprop for its administrative puproses at revision 0:<br /><pre>svn propset svn:sync-last-merged-rev --revprop -r0 19091 \<br />https://lazarus.svn.sourceforge.net/svnroot/lazarus</pre><br />I updated my crontab to call svnsync every three minutes and the Lazarus svn mirror at SourceForge has been updated nicely after.Vincent Snijdershttp://www.blogger.com/profile/04065272115346942274noreply@blogger.com0tag:blogger.com,1999:blog-4939523172768679277.post-60422188763977212162009-01-23T10:25:00.005+01:002009-01-23T11:00:37.114+01:00Next Lazarus release: 0.9.26.2More than three months (and 1500 revisions) have passed since the latest Lazarus release, so it is time for a new release. Lazarus trunk has now gtk2 as default widget set on Linux and is not yet in a releasable state. Further, gtk2 on newer Linux distros, requires fpc 2.2.4, which has not been released yet. The first release candidate is expected in the coming week(s). So I don't expect the final fpc 2.2.4 release before March. Waiting for fpc 2.2.4 would mean waiting for the next Lazarus release till April or May.<br /><br />Fortunately, selected revisions from trunk have been merged to the fixes 0.9.26 branch, which actually has become more than just fixes, also 'stable', finished features from 0.9.27 have been merged, such as the use frames and the project icon.<br /><br />This release can been regarded as an experiment with time based releases. Trunk releases usually have been scheduled to follow a fpc release or some finished feature and bug fixes. The exact timing of such releases was hard to predict. I tried to keep the fixes 0.9.26 branch always in a releasable state, so for example the switch to gtk2 has not been merged, because that depends on a fpc release.<br /><br /> I think the challenge with this release is the testing. The fixes branch is (almost?) not used by the Lazarus developers and I doubt that Lazarus snapshot users use 0.9.26.1 snapshots as much 0.9.27 snapshots. I want to ask you to try these 0.9.26.1 <a href="http://www.hu.freepascal.org/lazarus/">snapshots</a> and <a href="http://wiki.lazarus.freepascal.org/How_do_I_create_a_bug_report">report</a> any regressions compared to the 0.9.26 release.<br /><br />If everything goes well, we have a 0.9.26.2 release next month. Keep an eye on the <a href="http://wiki.lazarus.freepascal.org/Lazarus_0.9.26.2_release_plan">release plan</a>.Vincent Snijdershttp://www.blogger.com/profile/04065272115346942274noreply@blogger.com3tag:blogger.com,1999:blog-4939523172768679277.post-14184552762583840462008-11-19T02:42:00.001+01:002008-11-19T13:06:31.334+01:00New TPen properties<span style="font-size:130%;">1. What is a Pen?</span><div><br /></div><div>You know we are using pens when we draw a line or a shape border on a graphic canvas. A Pen defines how our lines will look. It can be thick or thin, dotted or solid, color or black. So lets review what properties a pen can have?</div><div><br /></div><div>First of all pens can be <span class="Apple-style-span" style="font-style: italic;">cosmetic</span> and <span class="Apple-style-span" style="font-style: italic;">geometric</span>. Cosmetic pens are always 1 pixel wide, while geometric pens can have any width. But width of geometric pens are defined in world units and thus depends on transforms (scaling, rotation, shear, reflection) applied to canvas. Operations with cosmetic pens are faster.</div><div style="text-align: center;"><br /></div><div>The next pen property is <span class="Apple-style-span" style="font-style: italic;">pattern</span>. Different libraries suggest different sets of default patterns (<span class="Apple-style-span" style="font-style: italic;">dot</span>, <span class="Apple-style-span" style="font-style: italic;">dash</span>, <span class="Apple-style-span" style="font-style: italic;">dash dot</span>, <span class="Apple-style-span" style="font-style: italic;">dash dot dot</span>, etc<span class="Apple-style-span" style="font-style: italic;">)<span class="Apple-style-span" style="font-style: normal;">. Some of them don't contain any predefined pattern but allow to set a custom pattern. All libraries allow to set a solid pen pattern (usually default pattern) and some of then an empty pattern (invisible :) ).</span></span></div><div style="text-align: center;"><br /></div><div>The next usual pen property is <span class="Apple-style-span" style="font-style: italic;">color</span>. Every library allows to set any custom pen color.</div><div style="text-align: center;"><br /></div><div>Geometric pens usually allow to set the style of end caps and the style of the joins between lines. <span class="Apple-style-span">The </span><span class="Apple-style-span" style="font-style: italic;">end cap</span> can be: Round, Square and Flat. Look at the picture - they are placed in this order. When end caps are round - last points are drawn round, when end caps are square - last points are drawn square. When end caps are flat - last points are not drawn at all.</div><div style="text-align: center;"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRrjO4UaHGRle9Ne2ekg0gZQX-KMeIZaaLeOTzboUAKs5dAgliRqiOvZAR2_KxdpgdBUCjGd9MktxHhjPnLwUx4Mw2Ybdl0V5i_KtR28cu3O2NwfBSxOCXve3IqevHAU3hwv8nZ9G_AoNy/s400/endcaps.png" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 66px; height: 65px;" alt="" id="BLOGGER_PHOTO_ID_5268762243056882578" border="0" /></div><div><div><span class="Apple-style-span">The</span><span class="Apple-style-span" style="font-style: italic;"><span style="font-style: italic;"> </span>join style</span> can be: Round, Bevel and Miter. Look at the picture - they area placed in the same order. </div><div><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirG06jZcpedKHVUNEXVtMH6zwv30hg_tkGdV0lc7BhqKqiv84_giiLzhXsRT-0FRFgFq5ZkkFDNs2yQEHYgtiehwZ2lMIqjmVwPkw03oFJsxdhV1iHnUkpNO-H4k9_sBryHFqB_J_d-7uv/s400/joinstyle.png" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 122px; height: 40px;" alt="" id="BLOGGER_PHOTO_ID_5268761423786806946" border="0" /></div><div>Lazarus is using different libraries and each of them has a different pen implementation. For example Carbon does not supports cosmetic pens. And gtk does not support flat end caps for geometric pens (a similar style exists - GDK_CAP_NOT_LAST but it behaves as GDK_BUTT for geometric pens).</div><div><span class="Apple-style-span" style="white-space: pre;font-family:-webkit-monospace;"><br /></span></div><div><div><span style="font-size:130%;">2. What was added and how it behaves</span></div><div><br /></div><div>Before 0.9.27 pens were the same in Delphi and Lazarus. Pens were (and are) implemented through TPen class and had the following properties: Color, Style, Width (which cannot be less than 1). In order to create a widgetset object, TPen used a call to the CreatePenIndirect winapi compatibility function.</div><div><br /></div><div>Thus I looked at how winapi works with all those end caps, join styles, cosmetic/geomtric and found another function which can create all what I need - ExtCreatePen. So the first thing I've done was inclusion of ExtCreatePen into LCL. I tried different pens by assigning that function result to Canvas.Pen.Handle. ExtCreatePen allows to choose whether your pen be cosmetic or geomtric, set a predefined line style or use custom dashes, set a solid color or even any brush to draw a line, set end cap style and join style. Don't expect full winapi compatibility from LCL, if you try to use this function directly. Only solid colors are supported - thus you need to pass BS_SOLID for the brush style and hatch = 0.</div><div><br /></div><div>Another winapi compatibility function I touched was GetObject. It returns a description for the given GDI object. I've extended it to return correct TLogPen if a pen was created by CreatePenIndirect and TExtLogPen if a pen was created by ExtCreatePen.</div><div><br /></div><div>Next I touched the TPen class itself. I've added TPenEndCap, TPenJoinStlye enumerations and TPen.EndCap, TPen.JoinStyle properties. Also I've added TPen.Cosmetic property since TPen.Width cannot be less than 1 (in other case I would use Pen.Width = 0 as cosmetic). So if you set TPen.Width = 1 and TPen.Cosmetic = True - you'll get your cosmetic pen (this is set by default for newly created pens). In all other cases pens are geometric. Pen is always geometric if Pen.Width > 1 even if Pen.Cosmetic = True. I've also added TPen.SetPattern method to set user defined patterns. If Pen.Style = psPattern lines will be drawn with dashes defined in the pattern array (first number means dash length, second space length and so forth).</div><div> </div><div><span class="Apple-style-span" style="font-size:18px;"><br /></span></div><div><span style="font-size:130%;">3. Limitations</span></div><div><br /></div><div>As I wrote before, Carbon does not support cosmetic pens and Gtk has its own point of view about Flat end caps :) But is this all you need to keep in mind?</div><div><br /></div><div>When I wrote my test application and launched it on Mac OS X I've found that anti aliasing is not always a good friend :) My dashes were invisible and the pen looked almost solid for all styles when its width was equal to one. To eliminate this defects I've added TCanvas.Antialiasing property and now we can control it (only on Carbon and Qt though).</div><div><br /></div><div><span style="font-size:130%;">4. Conclusion</span></div><div><br /></div><div>Almost all pen capabilities you can find in different libraries are now present in the LCL TPen class. If you missed ExtCreatePen or GetObject winapi functions - you can use them now too. If you don't understand something or just need more info then read msdn (ExtCreatePen), Qt help (QPen class reference) and Gtk reference manual (Graphics Contexts). If you want to look at TPen extensions yourself then launch our "Pen and Brush" example (I was inspired by a Qt Basic Drawing example when wrote it).</div></div></div>Anonymoushttp://www.blogger.com/profile/13087299539963377503noreply@blogger.com8tag:blogger.com,1999:blog-4939523172768679277.post-31051619844755256492008-11-18T16:29:00.003+01:002008-11-18T19:33:13.841+01:00Compressed HTML help (CHM) in Freepascal<span style="font-weight:bold;">What are CHM files?</span><br /><br />CHM files are html archives that are compressed using the LZX compression algorithm. <br /><br /><span style="font-weight:bold;">The Idea</span><br /><br />In early 2000 something, there was a discussion about Lazarus and making the help system better. Many different ideas were thrown around but the one that caught my eye was CHM, to me it made sense.<br /><br />So I began to search for a way to make Lazarus help available as CHM files. The Freepascal documentation: the Run Time Library(RTL), Free Component Library(FCL) and the Lazarus Documentation Lazarus Component Library(LCL) were and are, all available in html format either to download as a zip file or from a website for browsing. This was good because CHM's are just html files in a special archive so in theory it's easy to make CHM's from the existing HTML files.<br /><br /><span style="font-weight:bold;">A bunch of History</span><br /><br />I used the MS HTML Help Workshop to make some CHM's from the existing html files. This worked just fine but already I was seeing a problem: CHM readers only exist for Windows. <br /><br />I found a library, libchm, which was capable of reading and decompressing CHM files. I started working with that and in not too long I was able to extract any file from within a CHM file and display it. This was wonderful but still it was not a perfect solution since Lazarus, if it provided a CHM help system, would rely on an uncommon library.<br /><br />So I searched using google for an explanation of the CHM file format and found a very detailed specification. <a href="http://www.speakeasy.org/~russotto/chm/">http://www.speakeasy.org/~russotto/chm/</a><br />The real work began. I converted the LZX decompression code in chmlib from C to Pascal. At first it did not work, but with the help of Micha Nelissen I corrected the mistakes from the conversion and that was finished.<br /><br />Next came the part which required actual understanding of the innermost workings of a CHM archive. This is when I realized that reading CHM files was not just one file to understand but many. I'll explain: We already know that a CHM file is an archive that contains compressed HTML documents, but how do we know which HTLM documents are included and where they are, or how big they are? CHM's have a document index which uses a tree structure to store information about the directory and files within. After some time I was able to read this structure and see a list of all files and directories in CHM's. Subsequently I realized that a CHM has files stored within it that are added when it is made, which contain information about the Table of Contents, Index, which file is the “Home page” of the CHM and many other disinteresting but important things. Understanding a CHM involves understanding these internal files of a chm.<br /><br />The specification I referred to above had all the information I needed about reading a CHM's contents but not how to understand these other internal files. Google to the rescue. I found another website <a href="http://www.nongnu.org/chmspec/latest/">http://www.nongnu.org/chmspec/latest/</a> that had information about the internal files! Not much later I was able to open, extract, and show correctly chm files. All without any external library dependencies.<br /><br />I was very pleased but the CHMs made by the MS HTML Workshop did not have a very helpful Table of Contents or Index. Additionally there was some discomfort on the part of Lazarus developers that the documentation could only be compiled on Windows PC's since many of the Lazarus developers only used Linux.<br /><br />This is why several months later, I began work on a CHM compiler! During a two week period I converted more C code to Pascal so a LZX compressor existed for pascal, and wrote from scratch several units to write CHM files.<br /><br />Now it is possible to write and read CHM's files. The code is included with Freepascal in the packages/chm folder. Also fpdoc the Freepascal documentation tool incorporates the ability to write CHM files.<br /><br />A program was made (LHelp) and a package made for Lazarus to integrate CHM help. It did not gain popularity however. Why? I'm not sure but it could be because people didn't know it was there. It required setting up in the Lazarus which may have been too compilicated for some. But regardless two years go by. <br /><br /><span style="font-weight:bold;">Recent Progress</span><br /><br />I had recently been distracted away from Lazarus development by life and not paying much attention to it's progress. Then an email on the mailinglist caught my eye. A Freepascal dev, Marco van de Voort, was working on integration CHM help into the FP ide. I immediately started reading the logs to find out what interest had been shown in CHM's.<br /><br />So in the last few weeks I implemented something I had wanted to but as yet, not been motivated to do: I implemented creating and reading the search index CHM's can contain. <br /><br />What does this mean? This means that now it is possible to author searchable CHM files in any os/platform that FreePascal supports and also read them, all with Pascal code and with no external library requirements. <br /><br />In the not too distant future, Lazarus may by default use these CHM files to display help when you need it.Andrew Haineshttp://www.blogger.com/profile/10679351403152710881noreply@blogger.com6tag:blogger.com,1999:blog-4939523172768679277.post-12997844076833573382008-09-30T15:34:00.000+02:002008-09-30T15:38:29.261+02:00Lazarus cross platform and cross widget set exampleToday I read a news item on the <a href="http://www.lazarus.freepascal.org/modules.php?op=modload&name=News&file=index">Lazarus</a> site about a <a href="http://www.sobox.it/si_browser-en.html">SI_Browser, a simple DICOM viewer</a>. I didn't know what DICOM was, but google led me to the <a href="http://en.wikipedia.org/wiki/Digital_Imaging_and_Communications_in_Medicine">wikipedia article</a> about it.<br /><br />At the bottom of the site, I found a familiar link about the <a href="http://www.mricro.com/mricron/">MRIcron DICOM viewer</a>. I knew MRIcron is built using Lazarus; Chris Rorden, the developer, has made and paid several successful <a href="http://wiki.lazarus.freepascal.org/Bounties#Closed_bounties">bounties </a>to support MRIcron and Lazarus.<br /><br />The actual reason I write this post, is the <a href="http://www.sph.sc.edu/comd/rorden/mricron/install.html">installation page</a> of MRIcron. MRIcron is a Lazarus application that really shows the strength of Lazarus cross platfrom and widget set support. Chris offers MRIcron in 8 differenent flavours:<br /><ul><li>Windows (WinAPI widgetset)</li><li>Linux</li><ul><li>32-bit (QT widgetset)</li><li>32-bit (GTK1 widgetset)</li><li>32-bit (GTK2 widgetset)</li><li>64-bit (GTK1 widgetset)</li><li>64-bit (GTK2 widgetset)</li></ul><li>Macintosh OSX</li><ul><li>OSX 10.4 or later (Universal binary, Carbon widgetset)</li><li>OSX 10.3 or earlier (PowerPC, GTK1 widgetset)</li></ul></ul><br />Chris, thanks for showing the power of Lazarus.Vincent Snijdershttp://www.blogger.com/profile/04065272115346942274noreply@blogger.com5