View Issue Details

IDProjectCategoryView StatusLast Update
0018977LazarusIDEpublic2011-12-13 15:23
Reporteryang jixian Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version0.9.31 (SVN) 
Target Version0.9.30.3 (SVN)Fixed in Version0.9.30.3 (SVN) 
Summary0018977: The form position in Delphi2006 style Lazarus IDE is not right.
Descriptionthe position of forms is always not right when it is moved, it is its screen position.
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0012194 resolvedMattias Gaertner docking problems 
related to 0018538 closedJuha Manninen Under certain configurations docked windows, lower window arbitrarily increasing its height 
related to 0018553 resolvedMattias Gaertner docked form designer, docking manager does not include the form 
related to 0018407 resolvedyang jixian Problem editing a form with AnchorDockingDsgn installed 
related to 0018406 resolvedJuha Manninen IDE crashes with package AnchorDockingDsgn installed 
related to 0018298 resolvedMattias Gaertner Please update the default layout provided with anchor docking package 
related to 0017130 closedMattias Gaertner Anchordocking: Design form gets docked and becomes unfunctional 
related to 0017129 closedMattias Gaertner AnchorDocking: Imposible to "close" source editor window 

Activities

2011-03-24 08:51

 

ide20110324.patch (10,395 bytes)   
Index: lazarus.pp
===================================================================
--- lazarus.pp	(revision 30005)
+++ lazarus.pp	(working copy)
@@ -54,7 +54,7 @@
   LazConf,
   Splash,
   Main,
-  AboutFrm,
+  AboutFrm, ExtCtrls, Controls,
   // use the custom IDE static packages AFTER 'main'
   {$IFDEF AddStaticPkgs}
   {$I staticpackages.inc}
@@ -79,6 +79,9 @@
 {$I revision.inc}
 {$R lazarus.res}
 
+var ModernForm: TForm; toppanel, leftpanel, rightpanel: TPanel;
+  topsplitter, leftsplitter, rightsplitter: TSplitter; FormContainer: TScrollBox;
+
 begin
   {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('lazarus.pp: begin');{$ENDIF}
 
@@ -94,6 +97,38 @@
   Application.Title:='Lazarus';
   OnGetApplicationName:=@GetLazarusApplicationName;
   Application.Initialize;
+  Application.CreateForm(TForm, ModernForm);
+  ModernForm.Top := 2;
+  ModernForm.Left := 2;
+  ModernForm.Width:=Screen.Width - 20;
+  ModernForm.Height:=Screen.Height - 50;
+  toppanel := TPanel.Create(nil);
+  toppanel.Parent := ModernForm;
+  toppanel.Align := alTop;
+  toppanel.BevelOuter := bvNone;
+  leftpanel := TPanel.Create(nil);
+  leftpanel.Parent := ModernForm;
+  leftpanel.Align := alLeft;
+  leftpanel.BevelOuter := bvNone;
+  topsplitter := TSplitter.Create(nil);
+  topsplitter.Parent:=ModernForm;
+  topsplitter.Align:=alTop;
+  leftsplitter := TSplitter.Create(nil);
+  leftsplitter.Parent:=ModernForm;
+  leftsplitter.Align:=alLeft;
+  rightpanel := TPanel.Create(nil);
+  rightpanel.Parent := ModernForm;
+  rightpanel.Align := alClient;
+  rightpanel.BevelOuter := bvNone;
+  rightsplitter := TSplitter.Create(nil);
+  rightsplitter.Parent:=rightpanel;
+  rightsplitter.Align:=alBottom;
+  FormContainer := TScrollBox.Create(rightpanel);
+  FormContainer.Parent:=rightpanel;
+  FormContainer.Align:=alClient;
+  //FormContainer.ControlStyle := FormContainer.ControlStyle + [csAcceptsControls];
+
+  Application.TaskBarBehavior:=tbSingleButton;
   TMainIDE.ParseCmdLineOptions;
   if Application.Terminated then exit;
 
@@ -105,6 +140,7 @@
   end;
 
   MainIDE:=TMainIDE.Create(Application);
+  MainIDE.GetNewModernForm(ModernForm, FormContainer);
   if not Application.Terminated then
   begin
     MainIDE.CreateOftenUsedForms;
@@ -115,6 +151,8 @@
     end;
     {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('lazarus.pp: TMainIDE created');{$ENDIF}
 
+    MainIDE.ReDirectWindow(toppanel, leftpanel, rightpanel, rightsplitter);
+
     try
       Application.Run;
     except
Index: main.pp
===================================================================
--- main.pp	(revision 30005)
+++ main.pp	(working copy)
@@ -632,6 +632,12 @@
     OldCompilerFilename, OldLanguage: String;
     OIChangedTimer: TIdleTimer;
 
+    NewModernForm: TForm;
+    NewFormContainer: TScrollBox;
+    CurrentSrcEditor: TSourceNotebook;
+    CurrentSrcEditorContainer: TPanel;
+    mainsplitter: TSplitter;
+
     procedure RenameInheritedMethods(AnUnitInfo: TUnitInfo; List: TStrings);
     function OIHelpProvider: TAbstractIDEHTMLProvider;
     function CheckEditorNeedsSave(AEditor: TSourceEditorInterface; IgnoreSharedEdits: Boolean): Boolean;
@@ -1078,6 +1084,9 @@
     procedure SaveEnvironment; override;
     procedure LoadDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
     procedure SaveDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
+    procedure ReDirectWindow(toppanel, leftpanel, rightpanel: TPanel; asplitter: TSplitter); override;
+    procedure GetNewModernForm(aForm: TForm; FormContainer: TScrollBox); override;
+    procedure SrcEditorContainerResize(Sender: TObject);
   end;
 
 
@@ -3705,9 +3714,26 @@
 
 procedure TMainIDE.ShowDesignerForm(AForm: TCustomForm);
 begin
+  if NewFormContainer = nil then Exit;
+//  AForm.Parent := NewFormContainer;
+//  AForm.Dock(NewFormContainer, NewFormContainer.ClientRect);
+  //AForm.ParentWindow := NewFormContainer.Handle;
+  SetParent(AForm.Handle, NewFormContainer.Handle);
+  if CurrentSrcEditor <> nil then
+    CurrentSrcEditor.Hide;
+  NewFormContainer.Show;
+  NewFormContainer.BringToFront;
+//  AForm.Caption := IntToStr(AForm.Left) + '*' + IntToStr(AForm.Top);
+//AForm.Caption := IntToStr(AForm.Parent.Handle);
+  //AForm.ControlStyle := AForm.ControlStyle + [csAcceptsControls];
   // do not call 'AForm.Show', because it will set Visible to true
   AForm.BringToFront;
   LCLIntf.ShowWindow(AForm.Handle,SW_SHOWNORMAL);
+  AForm.Left := 0;
+  AForm.Top := 0;
+    //2011-03-21
+  //GlobalDesignHook.Modified(NewFormContainer);
+  AForm.Designer.Modified;
 end;
 
 procedure TMainIDE.DoViewAnchorEditor(Show: boolean);
@@ -5127,7 +5153,7 @@
 
   // Figure out where we want to put the new form
   // if there is more place left of the OI put it left, otherwise right
-  p:=ObjectInspector1.ClientOrigin;
+  p:=Point(0, 0); //2011-03-22  ObjectInspector1.ClientOrigin;
   new_x:=p.X;
   if new_x>Screen.Width div 2 then
     new_x:=new_x-500
@@ -6636,6 +6662,12 @@
     DesignerForm.ControlStyle := DesignerForm.ControlStyle - [csNoDesignVisible];
     if NewComponent is TControl then
       TControl(NewComponent).ControlStyle:= TControl(NewComponent).ControlStyle - [csNoDesignVisible];
+
+    //2011-03-21
+    if NewFormContainer = nil then Exit;
+    SetParent(DesignerForm.Handle, NewFormContainer.Handle);
+    NewFormContainer.Show;
+    NewFormContainer.BringToFront;
     LCLIntf.ShowWindow(DesignerForm.Handle, ShowCommands[AnUnitInfo.ComponentState]);
     FLastFormActivated := DesignerForm;
   end;
@@ -11618,7 +11650,9 @@
   CanClose:=true;
   MainIDEBar.OnCloseQuery(Self, CanClose);
   if not CanClose then exit;
-  MainIDEBar.Close;
+  //MainIDEBar.Close;
+  NewModernForm.Close;
+  //Application.Terminate;
   if Application.Terminated then begin
     if StartedByStartLazarus then
       ExitCode := ExitCodeRestartLazarus
@@ -12953,6 +12987,8 @@
   end;
   MainIDEBar.Caption := NewCaption;
   Application.Title := NewTitle;
+  if NewModernForm <> nil then
+    NewModernForm.Caption := NewCaption;
 end;
 
 procedure TMainIDE.HideIDE;
@@ -13086,7 +13122,7 @@
 
 procedure TMainIDE.DoShowSourceOfActiveDesignerForm;
 var
-  ActiveUnitInfo: TUnitInfo;
+  ActiveUnitInfo: TUnitInfo; //i: integer;
 begin
   if SourceEditorManager.SourceEditorCount = 0 then exit;
   if FLastFormActivated <> nil then begin
@@ -13099,6 +13135,14 @@
   end;
   SourceEditorManager.ShowActiveWindowOnTop(False);
   FDisplayState:= dsSource;
+  if NewFormContainer = nil then Exit;
+  {for i := 0 to NewFormContainer.ComponentCount - 1 do
+  begin
+    LCLIntf.ShowWindow(TForm(NewFormContainer.Components[i]).Handle, SW_HIDE);
+  end;   }
+  NewFormContainer.Hide;
+  if CurrentSrcEditor <> nil then
+    CurrentSrcEditor.Show;
 end;
 
 procedure TMainIDE.OnMacroSubstitution(TheMacro: TTransferMacro;
@@ -18025,7 +18069,71 @@
   DoFindDeclarationAtCursor;
 end;
 
+procedure TMainIDE.ReDirectWindow(toppanel, leftpanel, rightpanel: TPanel; asplitter: TSplitter);
+var i: integer; //tmpobj: TWinControl;
+begin
+  MainIDEBar.Menu := nil;
+  TForm(topPanel.Parent).Menu := MainIDEBar.mnuMainMenu;
+  MainIDEBar.BorderStyle:=bsNone;
+  toppanel.Height:=MainIDEBar.Height;
+  MainIDEBar.Parent:=toppanel;
+  //SetParent(MainIDEBar.Handle, toppanel.Handle);
+  MainIDEBar.Align:=alClient;
+  MainIDEBar.Top:=0;
+  MainIDEBar.Left:=0;
+  MainIDEBar.Visible:=True;
+  TForm(toppanel.Parent).Caption:=MainIDEBar.Caption;
+  ObjectInspector1.Parent := leftpanel;
+  ObjectInspector1.BorderStyle:=bsNone;
+  ObjectInspector1.Top := 0;
+  ObjectInspector1.Align:=alClient;
+  leftpanel.Width:=ObjectInspector1.ClientWidth;
+  MessagesView.Parent := rightpanel;
+  //SetParent(MessagesView.Handle, rightbottompanel.Handle);
+  MessagesView.BorderStyle:=bsNone;
+  MessagesView.Align:=alBottom;
+  MessagesView.Top:=0;
+  MessagesView.Left:=0;
+  for i := 0 to Screen.FormCount - 1 do
+    if Screen.Forms[i].ClassName = 'TSourceNotebook' then
+    begin
+      CurrentSrcEditor := TSourceNotebook(Screen.Forms[i]);
+      break;
+    end;
+  mainsplitter := asplitter;
+  //CurrentSrcEditor.Parent := rightpanel;
+  //SetParent(CurrentSrcEditor.Handle, leftpanel.Handle);
+  CurrentSrcEditor.Dock(rightpanel, rightpanel.ClientRect);
+  //CurrentSrcEditor.ParentWindow := rightpanel.Handle;
+  CurrentSrcEditor.BorderStyle:=bsNone;
+  CurrentSrcEditor.Left := rightpanel.ClientRect.Left;
+  CurrentSrcEditor.Top := rightpanel.ClientRect.Top;
+  CurrentSrcEditor.Align := alClient;
+  {CurrentSrcEditor.Width := rightpanel.ClientRect.Right - rightpanel.ClientRect.Left;
+  CurrentSrcEditor.Height := rightpanel.ClientRect.Bottom
+    - rightpanel.ClientRect.Top - MessagesView.Height - mainsplitter.Height;}
+  //rightpanel.OnResize:=@SrcEditorContainerResize;
+  CurrentSrcEditorContainer := rightpanel;
+end;
 
+procedure TMainIDE.GetNewModernForm(aForm: TForm; FormContainer: TScrollBox);
+begin
+  NewModernForm := aForm;
+  NewFormContainer := FormContainer;
+end;
+
+procedure TMainIDE.SrcEditorContainerResize(Sender: TObject);
+begin
+  CurrentSrcEditor.ParentWindow := CurrentSrcEditorContainer.Handle;
+  CurrentSrcEditor.BorderStyle:=bsNone;
+  CurrentSrcEditor.Left := CurrentSrcEditorContainer.ClientRect.Left;
+  CurrentSrcEditor.Top := CurrentSrcEditorContainer.ClientRect.Top;
+  CurrentSrcEditor.Width := CurrentSrcEditorContainer.ClientRect.Right
+    - CurrentSrcEditorContainer.ClientRect.Left;
+  CurrentSrcEditor.Height := CurrentSrcEditorContainer.ClientRect.Bottom
+    - CurrentSrcEditorContainer.ClientRect.Top - MessagesView.Height - mainsplitter.Height;
+end;
+
 //-----------------------------------------------------------------------------
 
 initialization
@@ -18033,6 +18141,7 @@
   {$I ../images/laz_images.lrs}
   // we have a bundle icon, don't use low quality standard icon
   ShowSplashScreen:=true;
+
 end.
 
 
Index: mainbase.pas
===================================================================
--- mainbase.pas	(revision 30005)
+++ mainbase.pas	(working copy)
@@ -181,6 +181,8 @@
 
     procedure FindInFilesPerDialog(AProject: TProject); override;
     procedure FindInFiles(AProject: TProject; const FindText: string); override;
+    procedure ReDirectWindow(toppanel, leftpanel, rightpanel: TPanel; asplitter: TSplitter); virtual; abstract;
+    procedure GetNewModernForm(aForm: TForm; FormContainer: TScrollBox); virtual; abstract;
   end;
 
 var
ide20110324.patch (10,395 bytes)   

Juha Manninen

2011-03-24 10:57

developer   ~0046782

The patch creates kind of a "permanently docked" IDE.
The user can't undock any parts of the IDE if he wants.
Note: even Delphi2006 supports docking, so this patch does not create a "Delphi2006 style Lazarus IDE".

The same idea for Lazarus is already implemented better with a docking system. See:
 http://wiki.lazarus.freepascal.org/Anchor_Docking#Docking_in_the_IDE
You are welcome to improve that.

BTW, Lazarus patched with this "ide20110324.patch" leaks memory.
Try compiling with -gh and you can see it yourself.

Juha Manninen

2011-03-24 11:40

developer   ~0046786

yang jixian: I added some issues related to docking in case you want to work on it.

yang jixian

2011-03-24 15:08

developer   ~0046791

Last edited: 2011-03-24 15:22

Thanks a lot for your work. The docking is very insteresting.

2011-03-25 01:54

 

ide20110324B.patch (10,929 bytes)   
Index: lazarus.pp
===================================================================
--- lazarus.pp	(revision 30007)
+++ lazarus.pp	(working copy)
@@ -54,7 +54,7 @@
   LazConf,
   Splash,
   Main,
-  AboutFrm,
+  AboutFrm, ExtCtrls, Controls,
   // use the custom IDE static packages AFTER 'main'
   {$IFDEF AddStaticPkgs}
   {$I staticpackages.inc}
@@ -79,6 +79,9 @@
 {$I revision.inc}
 {$R lazarus.res}
 
+var ModernForm: TForm; toppanel, leftpanel, rightpanel: TPanel;
+  topsplitter, leftsplitter, rightsplitter: TSplitter; FormContainer: TScrollBox;
+
 begin
   {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('lazarus.pp: begin');{$ENDIF}
 
@@ -94,6 +97,38 @@
   Application.Title:='Lazarus';
   OnGetApplicationName:=@GetLazarusApplicationName;
   Application.Initialize;
+  Application.CreateForm(TForm, ModernForm);
+  ModernForm.Top := 2;
+  ModernForm.Left := 2;
+  ModernForm.Width:=Screen.Width - 20;
+  ModernForm.Height:=Screen.Height - 50;
+  toppanel := TPanel.Create(nil);
+  toppanel.Parent := ModernForm;
+  toppanel.Align := alTop;
+  toppanel.BevelOuter := bvNone;
+  leftpanel := TPanel.Create(nil);
+  leftpanel.Parent := ModernForm;
+  leftpanel.Align := alLeft;
+  leftpanel.BevelOuter := bvNone;
+  topsplitter := TSplitter.Create(nil);
+  topsplitter.Parent:=ModernForm;
+  topsplitter.Align:=alTop;
+  leftsplitter := TSplitter.Create(nil);
+  leftsplitter.Parent:=ModernForm;
+  leftsplitter.Align:=alLeft;
+  rightpanel := TPanel.Create(nil);
+  rightpanel.Parent := ModernForm;
+  rightpanel.Align := alClient;
+  rightpanel.BevelOuter := bvNone;
+  rightsplitter := TSplitter.Create(nil);
+  rightsplitter.Parent:=rightpanel;
+  rightsplitter.Align:=alBottom;
+  FormContainer := TScrollBox.Create(rightpanel);
+  FormContainer.Parent:=rightpanel;
+  FormContainer.Align:=alClient;
+  //FormContainer.ControlStyle := FormContainer.ControlStyle + [csAcceptsControls];
+
+  Application.TaskBarBehavior:=tbSingleButton;
   TMainIDE.ParseCmdLineOptions;
   if Application.Terminated then exit;
 
@@ -105,6 +140,7 @@
   end;
 
   MainIDE:=TMainIDE.Create(Application);
+  MainIDE.GetNewModernForm(ModernForm, FormContainer);
   if not Application.Terminated then
   begin
     MainIDE.CreateOftenUsedForms;
@@ -115,6 +151,8 @@
     end;
     {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('lazarus.pp: TMainIDE created');{$ENDIF}
 
+    MainIDE.ReDirectWindow(toppanel, leftpanel, rightpanel, rightsplitter);
+
     try
       Application.Run;
     except
@@ -132,5 +170,13 @@
   // free the IDE, so everything is freed before the finalization sections
   MainIDE.Free;
   MainIDE:=nil;
+
+  FormContainer.Free;
+  toppanel.Free;
+  leftpanel.Free;
+  rightpanel.Free;
+  topsplitter.Free;
+  leftsplitter.Free;
+  rightsplitter.Free;
 end.
 
Index: main.pp
===================================================================
--- main.pp	(revision 30007)
+++ main.pp	(working copy)
@@ -632,6 +632,12 @@
     OldCompilerFilename, OldLanguage: String;
     OIChangedTimer: TIdleTimer;
 
+    NewModernForm: TForm;
+    NewFormContainer: TScrollBox;
+    CurrentSrcEditor: TSourceNotebook;
+    CurrentSrcEditorContainer: TPanel;
+    mainsplitter: TSplitter;
+
     procedure RenameInheritedMethods(AnUnitInfo: TUnitInfo; List: TStrings);
     function OIHelpProvider: TAbstractIDEHTMLProvider;
     function CheckEditorNeedsSave(AEditor: TSourceEditorInterface; IgnoreSharedEdits: Boolean): Boolean;
@@ -1078,6 +1084,9 @@
     procedure SaveEnvironment; override;
     procedure LoadDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
     procedure SaveDesktopSettings(TheEnvironmentOptions: TEnvironmentOptions);
+    procedure ReDirectWindow(toppanel, leftpanel, rightpanel: TPanel; asplitter: TSplitter); override;
+    procedure GetNewModernForm(aForm: TForm; FormContainer: TScrollBox); override;
+    procedure SrcEditorContainerResize(Sender: TObject);
   end;
 
 
@@ -3705,9 +3714,30 @@
 
 procedure TMainIDE.ShowDesignerForm(AForm: TCustomForm);
 begin
+  if NewFormContainer = nil then Exit;
+//  AForm.Parent := NewFormContainer;
+//  AForm.Dock(NewFormContainer, NewFormContainer.ClientRect);
+  //AForm.ParentWindow := NewFormContainer.Handle;
+  SetParent(AForm.Handle, NewFormContainer.Handle);
+  if CurrentSrcEditor <> nil then
+    CurrentSrcEditor.Hide;
+  NewFormContainer.Show;
+  NewFormContainer.BringToFront;
+//  AForm.Caption := IntToStr(AForm.Left) + '*' + IntToStr(AForm.Top);
+//AForm.Caption := IntToStr(AForm.Parent.Handle);
+  //AForm.ControlStyle := AForm.ControlStyle + [csAcceptsControls];
   // do not call 'AForm.Show', because it will set Visible to true
   AForm.BringToFront;
   LCLIntf.ShowWindow(AForm.Handle,SW_SHOWNORMAL);
+  AForm.Left := 0;
+  AForm.Top := 0;
+  if AForm.Width > NewFormContainer.HorzScrollBar.Range then
+    NewFormContainer.HorzScrollBar.Range:=AForm.Width + 3;
+  if AForm.Height > NewFormContainer.VertScrollBar.Range then
+    NewFormContainer.VertScrollBar.Range:=AForm.Height + 3;
+    //2011-03-21
+  //GlobalDesignHook.Modified(NewFormContainer);
+  AForm.Designer.Modified;
 end;
 
 procedure TMainIDE.DoViewAnchorEditor(Show: boolean);
@@ -5127,7 +5157,7 @@
 
   // Figure out where we want to put the new form
   // if there is more place left of the OI put it left, otherwise right
-  p:=ObjectInspector1.ClientOrigin;
+  p:=Point(0, 0); //2011-03-22  ObjectInspector1.ClientOrigin;
   new_x:=p.X;
   if new_x>Screen.Width div 2 then
     new_x:=new_x-500
@@ -6636,6 +6666,12 @@
     DesignerForm.ControlStyle := DesignerForm.ControlStyle - [csNoDesignVisible];
     if NewComponent is TControl then
       TControl(NewComponent).ControlStyle:= TControl(NewComponent).ControlStyle - [csNoDesignVisible];
+
+    //2011-03-21
+    if NewFormContainer = nil then Exit;
+    SetParent(DesignerForm.Handle, NewFormContainer.Handle);
+    NewFormContainer.Show;
+    NewFormContainer.BringToFront;
     LCLIntf.ShowWindow(DesignerForm.Handle, ShowCommands[AnUnitInfo.ComponentState]);
     FLastFormActivated := DesignerForm;
   end;
@@ -11618,7 +11654,9 @@
   CanClose:=true;
   MainIDEBar.OnCloseQuery(Self, CanClose);
   if not CanClose then exit;
-  MainIDEBar.Close;
+  //MainIDEBar.Close;
+  NewModernForm.Close;
+  //Application.Terminate;
   if Application.Terminated then begin
     if StartedByStartLazarus then
       ExitCode := ExitCodeRestartLazarus
@@ -12953,6 +12991,8 @@
   end;
   MainIDEBar.Caption := NewCaption;
   Application.Title := NewTitle;
+  if NewModernForm <> nil then
+    NewModernForm.Caption := NewCaption;
 end;
 
 procedure TMainIDE.HideIDE;
@@ -13086,7 +13126,7 @@
 
 procedure TMainIDE.DoShowSourceOfActiveDesignerForm;
 var
-  ActiveUnitInfo: TUnitInfo;
+  ActiveUnitInfo: TUnitInfo; //i: integer;
 begin
   if SourceEditorManager.SourceEditorCount = 0 then exit;
   if FLastFormActivated <> nil then begin
@@ -13099,6 +13139,14 @@
   end;
   SourceEditorManager.ShowActiveWindowOnTop(False);
   FDisplayState:= dsSource;
+  if NewFormContainer = nil then Exit;
+  {for i := 0 to NewFormContainer.ComponentCount - 1 do
+  begin
+    LCLIntf.ShowWindow(TForm(NewFormContainer.Components[i]).Handle, SW_HIDE);
+  end;   }
+  NewFormContainer.Hide;
+  if CurrentSrcEditor <> nil then
+    CurrentSrcEditor.Show;
 end;
 
 procedure TMainIDE.OnMacroSubstitution(TheMacro: TTransferMacro;
@@ -18025,7 +18073,71 @@
   DoFindDeclarationAtCursor;
 end;
 
+procedure TMainIDE.ReDirectWindow(toppanel, leftpanel, rightpanel: TPanel; asplitter: TSplitter);
+var i: integer; //tmpobj: TWinControl;
+begin
+  MainIDEBar.Menu := nil;
+  TForm(topPanel.Parent).Menu := MainIDEBar.mnuMainMenu;
+  MainIDEBar.BorderStyle:=bsNone;
+  toppanel.Height:=MainIDEBar.Height;
+  MainIDEBar.Parent:=toppanel;
+  //SetParent(MainIDEBar.Handle, toppanel.Handle);
+  MainIDEBar.Align:=alClient;
+  MainIDEBar.Top:=0;
+  MainIDEBar.Left:=0;
+  MainIDEBar.Visible:=True;
+  TForm(toppanel.Parent).Caption:=MainIDEBar.Caption;
+  ObjectInspector1.Parent := leftpanel;
+  ObjectInspector1.BorderStyle:=bsNone;
+  ObjectInspector1.Top := 0;
+  ObjectInspector1.Align:=alClient;
+  leftpanel.Width:=ObjectInspector1.ClientWidth;
+  MessagesView.Parent := rightpanel;
+  //SetParent(MessagesView.Handle, rightbottompanel.Handle);
+  MessagesView.BorderStyle:=bsNone;
+  MessagesView.Align:=alBottom;
+  MessagesView.Top:=0;
+  MessagesView.Left:=0;
+  for i := 0 to Screen.FormCount - 1 do
+    if Screen.Forms[i].ClassName = 'TSourceNotebook' then
+    begin
+      CurrentSrcEditor := TSourceNotebook(Screen.Forms[i]);
+      break;
+    end;
+  mainsplitter := asplitter;
+  //CurrentSrcEditor.Parent := rightpanel;
+  //SetParent(CurrentSrcEditor.Handle, leftpanel.Handle);
+  CurrentSrcEditor.Dock(rightpanel, rightpanel.ClientRect);
+  //CurrentSrcEditor.ParentWindow := rightpanel.Handle;
+  CurrentSrcEditor.BorderStyle:=bsNone;
+  CurrentSrcEditor.Left := rightpanel.ClientRect.Left;
+  CurrentSrcEditor.Top := rightpanel.ClientRect.Top;
+  CurrentSrcEditor.Align := alClient;
+  {CurrentSrcEditor.Width := rightpanel.ClientRect.Right - rightpanel.ClientRect.Left;
+  CurrentSrcEditor.Height := rightpanel.ClientRect.Bottom
+    - rightpanel.ClientRect.Top - MessagesView.Height - mainsplitter.Height;}
+  //rightpanel.OnResize:=@SrcEditorContainerResize;
+  CurrentSrcEditorContainer := rightpanel;
+end;
 
+procedure TMainIDE.GetNewModernForm(aForm: TForm; FormContainer: TScrollBox);
+begin
+  NewModernForm := aForm;
+  NewFormContainer := FormContainer;
+end;
+
+procedure TMainIDE.SrcEditorContainerResize(Sender: TObject);
+begin
+  CurrentSrcEditor.ParentWindow := CurrentSrcEditorContainer.Handle;
+  CurrentSrcEditor.BorderStyle:=bsNone;
+  CurrentSrcEditor.Left := CurrentSrcEditorContainer.ClientRect.Left;
+  CurrentSrcEditor.Top := CurrentSrcEditorContainer.ClientRect.Top;
+  CurrentSrcEditor.Width := CurrentSrcEditorContainer.ClientRect.Right
+    - CurrentSrcEditorContainer.ClientRect.Left;
+  CurrentSrcEditor.Height := CurrentSrcEditorContainer.ClientRect.Bottom
+    - CurrentSrcEditorContainer.ClientRect.Top - MessagesView.Height - mainsplitter.Height;
+end;
+
 //-----------------------------------------------------------------------------
 
 initialization
@@ -18033,6 +18145,7 @@
   {$I ../images/laz_images.lrs}
   // we have a bundle icon, don't use low quality standard icon
   ShowSplashScreen:=true;
+
 end.
 
 
Index: mainbase.pas
===================================================================
--- mainbase.pas	(revision 30007)
+++ mainbase.pas	(working copy)
@@ -181,6 +181,8 @@
 
     procedure FindInFilesPerDialog(AProject: TProject); override;
     procedure FindInFiles(AProject: TProject; const FindText: string); override;
+    procedure ReDirectWindow(toppanel, leftpanel, rightpanel: TPanel; asplitter: TSplitter); virtual; abstract;
+    procedure GetNewModernForm(aForm: TForm; FormContainer: TScrollBox); virtual; abstract;
   end;
 
 var
ide20110324B.patch (10,929 bytes)   

2011-03-25 01:55

 

idefiles20110325.zip (145,314 bytes)

Juha Manninen

2011-03-25 11:09

developer   ~0046810

yang jixian: please don't continue developing your original patch. It is clearly a dead end and will never replace the docking system.

Instead, please look at the packages:
 examples/anchordocking/anchordocking.lpk
and
 examples/anchordocking/design/anchordockingdsgn.lpk

See the problems reported in related issues and figure out how to solve them in docking code.
Hint for a task: All windows should be restored to sane locations and dimensions after anchordockingdsgn.lpk is uninstalled. Then everybody could safely test the docked IDE.

yang jixian

2011-03-25 17:09

developer   ~0046813

Thanks for your reply.

Docking is a better solution. I am learning.

Juha Manninen

2011-10-04 10:21

developer   ~0052487

Closing this as "no change required".

yang jixian

2011-12-13 15:23

developer   ~0055011

no change required

Issue History

Date Modified Username Field Change
2011-03-24 08:51 yang jixian New Issue
2011-03-24 08:51 yang jixian File Added: ide20110324.patch
2011-03-24 08:51 yang jixian LazTarget => -
2011-03-24 08:51 yang jixian Widgetset => Win32/Win64
2011-03-24 10:46 Juha Manninen Status new => assigned
2011-03-24 10:46 Juha Manninen Assigned To => Juha Manninen
2011-03-24 10:57 Juha Manninen Note Added: 0046782
2011-03-24 11:16 Juha Manninen Relationship added related to 0012194
2011-03-24 11:20 Juha Manninen Relationship added related to 0018538
2011-03-24 11:22 Juha Manninen Relationship added related to 0018553
2011-03-24 11:26 Juha Manninen Relationship added related to 0018407
2011-03-24 11:28 Juha Manninen Relationship added related to 0018406
2011-03-24 11:31 Juha Manninen Relationship added related to 0018298
2011-03-24 11:34 Juha Manninen Relationship added related to 0017130
2011-03-24 11:35 Juha Manninen Relationship added related to 0017129
2011-03-24 11:40 Juha Manninen Note Added: 0046786
2011-03-24 15:08 yang jixian Note Added: 0046791
2011-03-24 15:22 yang jixian Note Edited: 0046791
2011-03-25 01:54 yang jixian File Added: ide20110324B.patch
2011-03-25 01:55 yang jixian File Added: idefiles20110325.zip
2011-03-25 11:09 Juha Manninen Note Added: 0046810
2011-03-25 17:09 yang jixian Note Added: 0046813
2011-10-04 10:21 Juha Manninen Status assigned => resolved
2011-10-04 10:21 Juha Manninen Resolution open => no change required
2011-10-04 10:21 Juha Manninen Note Added: 0052487
2011-12-13 15:23 yang jixian Status resolved => closed
2011-12-13 15:23 yang jixian Note Added: 0055011
2011-12-13 15:23 yang jixian Fixed in Version => 0.9.30.3 (SVN)
2011-12-13 15:23 yang jixian Target Version => 0.9.30.3 (SVN)