[Lazarus] Desktops and multiple source editors

Martin Frb lazarus at mfriebe.de
Wed Sep 9 21:17:04 CEST 2015

On 09/09/2015 16:16, Ondrej Pokorny wrote:
> On 09.09.2015 12:58, Juha Manninen wrote:
>> Martin Friebe noticed a problem with desktops and multiple source
>> editor windows.
>> In fact I also noticed that a second source editor is not restored
>> correctly when changing desktops.
>> Now I realized the 2nd, 3rd etc. editor windows are project specific,
>> while other layout settings are global. This is not very logical. How
>> to solve it?
>> I think all layout settings should be global for the sake of consistency.
>> Juha
> The settings are saved correctly in the environment settings. Try to 
> save a desktop with 2 editor windows, move something (including the 
> editor windows) and then load the desktop. Both editor windows are 
> positioned correctly.

I have 2 source editors open. Always. In all projects, since forever.

Now I updated the ide, while 2 SrcEd are open, I checked that the 
desktop settings were:
- one layout named "default" (set as default)
- autosave desktop.

Both SE are open
I have 2 monitors, both are on the left, with negative x-coordinate

After an IDE restart, I find this in environmentopts.

  <Desktops Count="1" ActiveDesktop="default">
     <Desktop1 Name="default">
         <Caption Value="SourceNotebook2"/>
         <WindowPlacement Value="RestoreWindowGeometry"/>
         <CustomPosition Left="-879" Width="862" Height="996"/>
         <WindowState Value="Normal"/>
         <Caption Value="SourceNotebook"/>
         <WindowPlacement Value="RestoreWindowGeometry"/>
         <CustomPosition Left="-1680" Width="823" Height="991"/>
         <WindowState Value="Normal"/>

Those values are ok. Sometimes the order is SourceNotebook2 first

So I debug it.
The first sourcenotebook is created in 
#0 RESTORESIMPLELAYOUT(0x11a7f988) at idewindowintf.pas:2248
#1 RESTOREDESKTOP(0x156848) at environmentopts.pp:2109
#2 RESTOREIDEWINDOWS(0x11a50548) at main.pp:2336
#3 STARTIDE(0x11a50548) at main.pp:1548
#4 main at lazarus.pp:127

But the 2nd is NOT !

It is created later (when it is actually needed):
#0 CREATE(0x15b023c0, 0x1, 0x12b3c1b0, 1) at sourceeditor.pp:5733
#1 CREATENEWWINDOW(0x12b3c1b0, false, false, 1) at sourceeditor.pp:10554
#2 SOURCEWINDOWWITHID(0x12b3c1b0, 1) at sourceeditor.pp:9403
#3 OPENFILEINSOURCEEDITOR(0x1383a078, 0x154d5d20) at 
#4 OPENEDITORFILE(0x1383a078, -1, 1, 0x154d5d20, 
#5 OPENEDITORFILE(0x154c6528 
'B:\lazarus_latest\ide\sourcefilemanager.pas', -1, 1, 0x154d5d20, 
#6 INITOPENEDPROJECTFILE(0x147c1e48, 0x15244d60 
'B:\lazarus_latest\ide\lazarus.lpi', []) at sourcefilemanager.pas:3424
#7 DOOPENPROJECTFILE(0x11a50548, 0x15244d60 
'B:\lazarus_latest\ide\lazarus.lpi', []) at main.pp:6022
#8 SETUPSTARTPROJECT(0x11a50548) at main.pp:2219
#9 STARTIDE(0x11a50548) at main.pp:1553
#10 main at lazarus.pp:127

And so the desktop is not applied.

Opening the second SE-win in RestoreSimpleLayout wil only partly fix issues.

Because a desktop may have positions for 10 SE-win.
A project may load with just one or two open at start.
But then more get open while working on the project (I often open a 3rd 
or 4th temporarily). When they get opened they need to be placed 
according to the active desktop.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150909/dd8b6f38/attachment-0003.html>

More information about the Lazarus mailing list