Recent

Author Topic: Perfect Layout  (Read 10578 times)

TheBlackSheep

  • Jr. Member
  • **
  • Posts: 93
Perfect Layout
« on: June 26, 2011, 01:04:27 pm »
I've struggled a little in getting the docking layout managers to work - the docking plugins just don't see to work correctly (or occasionaly throw errors) and I always preferred the non-docked Delphi7 style layout.

However, moving windows about for designing forms and then trying to get back to an editing layout isn't exactly the easiest - especially on a small screen (like a laptop or a low-powered PC that doesn't have a very large desktop space).

Erik Berry's excellent Delphi plugin GExperts from www.gexperts.org had an option called Perfect Layout (with a default shortcut of CTRL+Shift+L) which would adjust to a predefined or custom designed layout for the main windows (the main toolbar, edit window, object inspector and watch window).  This expert wasn't enabled by default - presumably because Delphi stopped having the undocked layout as a default in later versions and you have to use the Classic Undocked mode for it to work  - if you haven't tried it I suggest installing the GExperts plugins, enabling this from the GExperts configuration and then moving your editor window, object inspector and main-toolbar around and then pressing CTRL-SHIFT+L - and magically they're all reset to their default positions. 

In Lazarus I'd swap the Watch window for the Messages window but adopt a similar layout - is
this something that could be added to the IDE easily?

I did start writing a plugin but I didn't wan't to reinvent the wheel if something like this existed already or could be setup in the IDE and I just don't know how to configure it.




Carver413

  • Full Member
  • ***
  • Posts: 119
Re: Perfect Layout
« Reply #1 on: June 26, 2011, 06:08:27 pm »
personal I think window docking is highly over rated. there just isn't enough screen space to lay things out properly. in delphi I created a layout manager for managing programs with lots of windows. it allowed access to all open windows while maintaining order at all times.clicking on window that was in back would cause the window to be pulled down to the bottom of the stack and the whole stack was redone to mantain order. screen slicing was done to create zones and windows that were open were always added to the zone they were assigned. in each zone you could decide how many windows were visible before staking occurred each zone could choose from different stacking patterns. a window that was maximised would be maximised to its zone and stay ontop until de maximised. I started to implement this in lazarus but do to unresolved issues and unanswered help requests the project is on hold. this is a photo of its current status. its still a little crude at this point but should give you an Idea of what I'm talking about. currently I'm working on a new framework that I will re implement the layout manager but it wont work with the lcl           

http://dl.dropbox.com/u/17721962/Screenshot.png

TheBlackSheep

  • Jr. Member
  • **
  • Posts: 93
Re: Perfect Layout
« Reply #2 on: June 26, 2011, 07:24:18 pm »

I see what you're trying is more complicated and the best of luck on that one.

I guess I'm suggesting something a little more simplistic - really just a shortcut to the "Apply" button that you can configure in the Tools->Options->Environment->Window for the MainMenu, Object Inspector, Messages and Code Editor.  If you'd set them there with an initial "Get Position" then presumably an apply would put them back in place.   

Unfortunately, in practice I still think a keyboard shortcut is necessary to apply the settings to avoid going through the menu - going through the menu again to this point takes the geometry that they're currently at (i.e. where you've moved them to) and not the position you'd "anchored" them to previously - is this the behaviour that's really intended here?


Carver413

  • Full Member
  • ***
  • Posts: 119
Re: Perfect Layout
« Reply #3 on: June 26, 2011, 08:53:48 pm »
actually the design isn't really complicated at all.it's just that certain functionality is lacking on the lcl side of things and there are a few quirks in some of the lcl that produce unreliable results. I never really played around with lazarus layout manager until now but why in the world would you have to get and set every window,is there no way to restore them all with one click?     

TheBlackSheep

  • Jr. Member
  • **
  • Posts: 93
Re: Perfect Layout
« Reply #4 on: June 27, 2011, 01:48:13 am »

I've started creating a package to provide this functionality (on the understaning it doesn't exist already and I'm just missing it) - currently managed to add a menu option on the tools menu and am retreiving the ObjectInspector position using the following;

  EnvironmentOptions.Load(True);
  ...EnvironmentOptions.ObjectInspectorOptions.Left;
  ...EnvironmentOptions.ObjectInspectorOptions.Top;
  ...EnvironmentOptions.ObjectInspectorOptions.Height;
  ...EnvironmentOptions.ObjectInspectorOptions.Width;

this appears to pull the object inspector settings back from the "environmentoptions.xml" file.

On the assumption this is the right approach I guess I just need to find the ObjectInspector window and apply these window settings (I might also need to restore it if it's closed/minimized I suppose).

Again, on this basis, adding the MainIntf the IDE ObjectInspector is created as ObjectInspector1 - setting the above loaded environment variables does indeed reset the OI to the correct position.

Not sure at this stage why the OI is a special case as none of the other windows (MainIDE, CodeExplorerView or the MessagesView) appears to be referenced in the same way - i.e. as an property in the EnvironmentOptions class. So still need to work out how to get these from the loaded file..

Also, I found the references for the Messages and the CodeExplorer windows but not the MainIDE itself so some work still to do to get this fully working.

TheBlackSheep

  • Jr. Member
  • **
  • Posts: 93
Re: Perfect Layout
« Reply #5 on: June 27, 2011, 09:16:32 pm »

I've managed to get this working now with a shortcut of ctrl+shift+L  :) and it seems to be behaving ok (needs plenty of testing obviously).

If anyone thinks this might be useful I've attached the source for this (I don't have anywhere currently to allow a download so I'm hoping adding an attachment works here - if not I'll list the source below)- you'll need to compile/install the lpk file attached (and obviously rebuild the IDE).

Basically this just loads the windows position settings from the 'environmentoptions.xml' file so it's necessary to arrange the windows (ObjectInspector, Code editor and the Messages windows) how you want them to appear then go into the Tools->Options and select the Environment->Window to save the windows with the current geometry (not sure if it's necessary to select each of the windows in the list and press the Get Position button but I've done it this way) - then just ok and start editing as you would nomally (moving/closing the various windows).  Then just press Ctrl-Shift+L or choose the option on the Tools menu and the windows should be restored.

If anyone has experience of installing IDE extensions and can suggest some improvements (or point out stuff this code should/shouldn't be doing here) I'd be most grateful.

I couldn't find the actual form reference for the MainIDE (to enable changing it's left/top/width/height properties but it may not be necessary as most of the time you'd probably be leaving this one alone) - you'll see it's currently commented out.

Note: I haven't tried this on Linux/OSX yet so it would be good to know if it works here too.



TheBlackSheep

  • Jr. Member
  • **
  • Posts: 93
Re: Perfect Layout
« Reply #6 on: July 01, 2011, 12:33:04 am »

This seems to work on Linux - CodeTyphon on Ubuntu 11.04 at least.

Bit of a pig to install - eventually had to install the "ide" package first and then rebuild and only then install the defaultlayout package and rebuild the IDE.  It kept complaining about "MainIntf" being missing but it's in ide and that was included as a dependency package - two of the forms (pp/lfm) files in the ide package couldn't be found and needed removing too (not sure if the version of "ide" I'm using here is a stable one - CodeTyphon tends to get the code for their installer from the svn sources I think so they're likely to have odd compiling issues like this occasionally).   Also, not sure if it's just a case sensitive issue with MainIntf/mainintf and the unit name not matching the filename because of Unix case sensitivity (i.e. Lazarus can't find the unit because it's looking for the wrong filename) - have seen that before on my own units.

As far as the defaultlayout package is concerned had to set the windows to the correct positions and then check the  "custom position" radio button on the Tools->Options->Environment->Window for each of the Windows in the list (OI, Messages, Code Editor) before the CTRL+SHIFT+L works ok.

Anyone had any success with it, found it useful?
 


 

TinyPortal © 2005-2018