Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-05

IDE layouts

14 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hans-Peter Diettrich

Here's my idea about loadable IDE layouts:

1) When the IDE starts, it looks for a user layout, then for a default layout, and if one is found, restores that screen layout. Otherwise no additional windows are shown, so far.

2) When a project is opened, the IDE looks for a project specific layout to restore, otherwise like (1).

3) The user can open and close, arrange and dock forms as desired, and store the layout on disk.

4) The user can reload a stored layout at any time.

Now about possible options. I'd like to have different layouts for Edit, Form design, Run/Debug. Others may want different layouts for screen sizes. That's all feasable, but before you start voting and adding features, you should consider:

A) Every layout is stored in an file. How can the IDE find the most appropriate layout file?

B) With multiple editor windows, the layout includes the files, open in an editor window. How to deal with the currently open files, when a different layout is restored?

Unless you can answer these questions, your wishes can not be taken into account.

If you want to have an preview, look at examples/dockmanager/mini_ide2. It's not perfect, but it allows to create windows, dock them together or to the main window, and the layouts can be stored and reloaded from disk.

DoDi

Reply by email

Vannus
to Hans-Peter Diettrich

1) When the IDE starts, it looks for a user layout, then for a default layout, and if one is found, restores that screen layout. Otherwise no additional windows are shown, so far.

2) When a project is opened, the IDE looks for a project specific layout to restore, otherwise like (1).

3) The user can open and close, arrange and dock forms as desired, and store the layout on disk.

window 'snapping' would be good. thing is youre then duplicating linux functionality for windows users...

Show quoted text 9 lines
4) The user can reload a stored layout at any time. Now about possible options. I'd like to have different layouts for Edit, Form design, Run/Debug. Others may want different layouts for screen sizes. That's all feasable, but before you start voting and adding features, you should consider:

to handle screen sizes maybe layouts should allow 'absolute' (1280 pixels) or 'relative' (100%) positioning/sizing?

A) Every layout is stored in an file. How can the IDE find the most appropriate layout file?

project1.layout
%user%/lazarus/layouts/default.layout
%user%/lazarus/layouts/myother.layout
%lazarus%/layouts/default.layout

instead of just a generic default.layout, id also suggest:- vcl_app.layout
simplecgi_app.layout
console_app.layout

Show quoted text 5 lines
B) With multiple editor windows, the layout includes the files, open in an editor window. How to deal with the currently open files, when a different layout is restored?

maybe leave them in their own editor window, just open new ones for restored layout.

Unless you can answer these questions, your wishes can not be taken into account.

eh?

Show quoted text 7 lines
If you want to have an preview, look at examples/dockmanager/mini_ide2. It's not perfect, but it allows to create windows, dock them together or to the main window, and the layouts can be stored and reloaded from disk. DoDi

- V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100521/a224df7b/attachment.html>

Reply by email

Sven Barth
to Reimar Grabowski
Reimar Grabowski wrote 9 lines
On Fri, 21 May 2010 21:26:22 +0200 Hans-Peter Diettrich wrote: > B) With multiple editor windows, the layout includes the files, open in > an editor window. Can you explain why? IMHO layout and content should be separated. R.

But the editor windows are part of the layout.

Imagine you have a layout that has two editor windows open. Now you switch to another layout that has only one editor window (now the open files might get "merged"). If you now switch back to your previous layout you might want to have all files open in their previous corresponding editor windows (and the newly opened files in the default editor) - at least I would want that. So you have to store the opened files per editor window somewhere.

Regards,
Sven

Reply by email

Mattias Gaertner
to Sven Barth
Show quoted text 20 lines
Am 22.05.2010 06:15, schrieb Reimar Grabowski: > On Fri, 21 May 2010 21:26:22 +0200 > Hans-Peter Diettrich wrote: > >> B) With multiple editor windows, the layout includes the files, open in >> an editor window. > > Can you explain why? IMHO layout and content should be separated. > > R. But the editor windows are part of the layout. Imagine you have a layout that has two editor windows open. Now you switch to another layout that has only one editor window (now the open files might get "merged"). If you now switch back to your previous layout you might want to have all files open in their previous corresponding editor windows (and the newly opened files in the default editor) - at least I would want that. So you have to store the opened files per editor window somewhere.

Imagine further you opened some file in one window and you now switch to another view, for example when debugging ends (switching from debug layout to edit layout). If the open file list is stored with the layout then the new files are now gone. I would not like that.

The open files, cursor positions, jump history and breakpoints are stored in the session info (.lps file). The window layouts for editing, debugging should be stored in the session too.

Maybe you want multiple sessions for a project?

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 34 lines
On Sat, 22 May 2010 09:29:05 +0200 Sven Barth wrote: > Am 22.05.2010 06:15, schrieb Reimar Grabowski: >> On Fri, 21 May 2010 21:26:22 +0200 >> Hans-Peter Diettrich wrote: >> >>> B) With multiple editor windows, the layout includes the files, open in >>> an editor window. >> >> Can you explain why? IMHO layout and content should be separated. >> >> R. > > But the editor windows are part of the layout. > > Imagine you have a layout that has two editor windows open. Now you > switch to another layout that has only one editor window (now the open > files might get "merged"). If you now switch back to your previous > layout you might want to have all files open in their previous > corresponding editor windows (and the newly opened files in the default > editor) - at least I would want that. So you have to store the opened > files per editor window somewhere. Imagine further you opened some file in one window and you now switch to another view, for example when debugging ends (switching from debug layout to edit layout). If the open file list is stored with the layout then the new files are now gone. I would not like that. The open files, cursor positions, jump history and breakpoints are stored in the session info (.lps file). The window layouts for editing, debugging should be stored in the session too. Maybe you want multiple sessions for a project?

Delphi has that: named layouts ?

Michael.

Reply by email

Hans-Peter Diettrich
to Vannus: 1) When the IDE starts, it looks for a user layout, then for a default layout, and if one…
to handle screen sizes maybe layouts should allow 'absolute' (1280 pixels) or 'relative' (100%) positioning/sizing?

A nice idea.

It may lead to strange results, when restoring a layout from a 600x800 screen on a multi-monitor desktop, regardless of whether it's absolute or relative. Another problem to be solved...

Also, who specifies which coordinates should be absolute, and which should be relative? Do you want to write and use such an editor? Whenever a layout is to be saved?

Show quoted text 8 lines
A) Every layout is stored in an file. How can the IDE find the most appropriate layout file? project1.layout %user%/lazarus/layouts/default.layout %user%/lazarus/layouts/myother.layout %lazarus%/layouts/default.layout

Question is not *where* the layouts are, instead *what* the layouts are for, i.e. *which* of these files to use.

Lazarus can be shipped with any number of layouts, and the user can pick from them whatever he likes - this requires no special coding. Question is about automatic selection, based on which criteria, and in which situation.

instead of just a generic default.layout, id also suggest:- vcl_app.layout simplecgi_app.layout console_app.layout

These could be loaded when a new project is created. I'm not sure whether the project type is known later, when an existing project is reopened.

Show quoted text 7 lines
B) With multiple editor windows, the layout includes the files, open in an editor window. How to deal with the currently open files, when a different layout is restored? maybe leave them in their own editor window, just open new ones for restored layout.

It may be not a good idea to restore open files with a layout at all...

Nonetheless it's not a problem to remove that part from the code, and replace it by any other mechanism - we only should find a convenient solution for handling open files when switching between layouts. In the IDE, every editor file may be tagged with a "preferred" editor window number...

DoDi

Reply by email

Vannus
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 13 lines
Vannus schrieb: to handle screen sizes maybe layouts should allow 'absolute' (1280 pixels) > or 'relative' (100%) positioning/sizing? > A nice idea. It may lead to strange results, when restoring a layout from a 600x800 screen on a multi-monitor desktop, regardless of whether it's absolute or relative. Another problem to be solved...

layout should have single, dual, etc modes.

if i use my laptop, all windows are on that monitor. if i plug monitor into my laptop, and move source editor onto this then lazarus should save this as dual mode of the layout. every time i use laptop without extra screen it uses single mode, every time i plug in monitor it uses dual mode.

Also, who specifies which coordinates should be absolute, and which should be relative? Do you want to write and use such an editor? Whenever a layout is to be saved?

an editor in lazarus windows menu where you can select left, top, width, height, and possibly even anchors editor.
you would rarely need to use the editor - windows should 'just remember' their relative left, top, width, height positions.

Show quoted text 20 lines
A) Every layout is stored in an file. How can the IDE find the most > appropriate layout file? > > > project1.layout > %user%/lazarus/layouts/default.layout > %user%/lazarus/layouts/myother.layout > %lazarus%/layouts/default.layout > Question is not *where* the layouts are, instead *what* the layouts are for, i.e. *which* of these files to use. Lazarus can be shipped with any number of layouts, and the user can pick from them whatever he likes - this requires no special coding. Question is about automatic selection, based on which criteria, and in which situation.

not just use the same as windows/unix PATH's? how did delphi do it? actually... (how does emberdecardero/visual studio handle multi-monitors??) firstly, projects own layout (if there was a layouts menu in lazarus, you could copy this for user project type default as well) user project type default
project type default
lastly, lazarus default

konqueror in KDE3.5 handles this sort of thing as well. might be easy to copy from it :)

Show quoted text 29 lines
instead of just a generic default.layout, id also suggest:- > vcl_app.layout > simplecgi_app.layout > console_app.layout > These could be loaded when a new project is created. I'm not sure whether the project type is known later, when an existing project is reopened. B) With multiple editor windows, the layout includes the files, open > in an editor window. How to deal with the currently open files, when > a different layout is restored? > > > maybe leave them in their own editor window, just open new ones for > restored layout. > It may be not a good idea to restore open files with a layout at all... Nonetheless it's not a problem to remove that part from the code, and replace it by any other mechanism - we only should find a convenient solution for handling open files when switching between layouts. In the IDE, every editor file may be tagged with a "preferred" editor window number...

sounds good.

DoDi

- V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100523/af31a6ef/attachment.html>

Reply by email

Hans-Peter Diettrich
to Vannus
Show quoted text 7 lines
layout should have single, dual, etc modes. if i use my laptop, all windows are on that monitor. if i plug monitor into my laptop, and move source editor onto this then lazarus should save this as dual mode of the layout. every time i use laptop without extra screen it uses single mode, every time i plug in monitor it uses dual mode.

Please provide the algorithm to select the file to use, taking into account non-existing files.

Say you change your dual layout, then the single layout is not normally updated. You also have to provide how to find the files that should be updated as well, and code to perform the update.

Show quoted text 7 lines
Also, who specifies which coordinates should be absolute, and which should be relative? Do you want to write and use such an editor? Whenever a layout is to be saved? an editor in lazarus windows menu where you can select left, top, width, height, and possibly even anchors editor.

Write that editor, and guarantee that it will not make the files unusable by accident.

you would rarely need to use the editor - windows should 'just remember' their relative left, top, width, height positions.

That's why the current screen layout can be saved, nothing more. No editing or other processing of the layout files, that has to be done on screen.

Question is not *where* the layouts are, instead *what* the layouts are for, i.e. *which* of these files to use. not just use the same as windows/unix PATH's? how did delphi do it?

It's not a mather of paths, it's a matter of file names.

DoDi

Reply by email

dmitry boyarintsev
to Hans-Peter Diettrich: Here's my idea about loadable IDE layouts: 1) When the IDE starts, it looks for a user…
Hans-Peter Diettrich wrote
Here's my idea about loadable IDE layouts: ...

What prevents you from makeing "IDE layouts" as IDE extension rather than modification of IDE itself?
I always prefer "extension" way instead of "modification". Since extensions are easy to maintain, add and remove later when necessary. Imho, concept of modularity should be used as much as possible, especially by Lazarus itself.

I can't find the idea really great. Each of the developer has uses only one layout (at least all developers i know uses only single layout) that he/she setups on the first IDE run.

thanks,
dmitry

Reply by email

Hans-Peter Diettrich
to dmitry boyarintsev
Show quoted text 5 lines
> Here's my idea about loadable IDE layouts: > ... What prevents you from makeing "IDE layouts" as IDE extension rather than modification of IDE itself?

Loadable layouts are only a second step, after the IDE includes docking

Reply by email

Vannus
to Hans-Peter Diettrich: Please provide the algorithm to select the file to use, taking into account non-existing…

wanted to fill in an hour or so, so heres the (partial) proof of concept :)

Hans-Peter Diettrich wrote 15 lines
Vannus schrieb: layout should have single, dual, etc modes. > > if i use my laptop, all windows are on that monitor. > if i plug monitor into my laptop, and move source editor onto this then > lazarus should save this as dual mode of the layout. > every time i use laptop without extra screen it uses single mode, every > time i plug in monitor it uses dual mode. > Please provide the algorithm to select the file to use, taking into account non-existing files.
layouts:=TStringList.Create;
if FileExists('project/layouts.txt') then // project layouts file
  layouts.LoadFromFile('project/layouts.txt')
else if FileExists('layouts.txt') then // app layouts file
  layouts.LoadFromFile('layouts.txt')
else begin // embedded layouts file
  with layouts do begin
    Add('1:Form1'); // single monitor
    Add('50'); // Left
    Add('50'); // top
    Add('500'); // width
    Add('100'); // height
    Add('2:Form1'); // dual monitor
    Add('500'); // Left
    Add('500'); // top
    Add('500'); // width
    Add('100'); // height
// etc...
  end;
end;
Say you change your dual layout, then the single layout is not normally updated. You also have to provide how to find the files that should be updated as well, and code to perform the update.
i:=layouts.IndexOf(inttostr(screen.MonitorCount)+':'+AForm.Name);
if (i>=0) then
  with AForm do begin
  Top:=strtoint(layouts.Strings[i+1]);
  Left:=strtoint(layouts.Strings[i+2]);
  Width:=strtoint(layouts.Strings[i+3]);
  Height:=strtoint(layouts.Strings[i+4]);
end;
and layouts.Strings[i+1]:=IntToStr(Left), etc for saving
Show quoted text 14 lines
Also, who specifies which coordinates should be absolute, and which > should be relative? Do you want to write and use such an editor? > Whenever a layout is to be saved? > > > an editor in lazarus windows menu where you can select left, top, width, > height, and possibly even anchors editor. > Write that editor, and guarantee that it will not make the files unusable by accident.

it wont make the files any less usable than above code

Show quoted text 8 lines
you would rarely need to use the editor - windows should 'just remember' > their relative left, top, width, height positions. > That's why the current screen layout can be saved, nothing more. No editing or other processing of the layout files, that has to be done on screen.

i quite like my simple '1:', '2:', etc solution to multi-monitor layouts :)

Show quoted text 15 lines
Question is not *where* the layouts are, instead *what* the layouts are > for, i.e. *which* of these files to use. > not just use the same as windows/unix PATH's? how did delphi do it? > It's not a mather of paths, it's a matter of file names. DoDi

ive attached my partial proof of concept. the bits i've left incomplete are fairly obvious from rest of code.
(add the others forms to layouts with '1:Form2', etc.) (add saving by reversing IntToStr as mentioned above.)

at this point the code should be moved to a component or something as LoadFromFile is called every time a form reads its layout, rather than when project is opened.

- V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100603/ac82efe7/attachment.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: layouts.zip
Type: application/zip
Size: 3444 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100603/ac82efe7/attachment.zip>

Reply by email