This patch add the possibility to have the message window docked into the editor (how in Delphi).
I add the command for do it into the popup menu into the form editor window.

Note: This work only if the bug 0001052 is solved (see http://www.freepascal.org/mantis/view.php?id=1052)

Bye,
David
Index: msgview.pp
===================================================================
--- msgview.pp	(revision 10993)
+++ msgview.pp	(working copy)
@@ -63,6 +63,17 @@
 
   { TMessagesView }
   
+  TDockRecord = record
+    Docked      : Boolean;
+    Top         : Integer;
+    Left        : Integer;
+    Height      : Integer;
+    Width       : Integer;
+    BorderStyle : TFormBorderStyle;
+    Align       : TAlign;
+    OldParent   : TWinControl;
+  end;
+
   TMessagesView = class(TIDEMessagesWindowInterface)
     MessageTreeView: TTreeView;
     MainPopupMenu: TPopupMenu;
@@ -83,13 +94,16 @@
       var PaintImages, DefaultDraw: Boolean);
     procedure SaveAllToFileMenuItemClick(Sender: TObject);
     procedure OnQuickFixClick(Sender: TObject);
+    procedure FormCloseQuery ( Sender : TObject;var CanClose : boolean ) ;
   private
+    Status: TDockRecord; // Dock status of the window
     FItems: TFPList; // list of TLazMessageLine
     FVisibleItems: TFPList; // list of TLazMessageLine (visible Items of FItems)
     FSrcPositions: TAVLTree;// tree of TLazMessageLine sorted for Filename and LineNumber
     FLastLineIsProgress: boolean;
     FOnSelectionChanged: TNotifyEvent;
     FQuickFixItems: TFPList; // list of current TIDEMsgQuickFixItem
+    procedure SaveStatus; // Save the current Dock status
     function GetDirectory: string;
     function GetItems(Index: integer): TLazMessageLine;
     function GetMessage: string;
@@ -134,6 +148,8 @@
     procedure UpdateMsgLineInListBox(Line: TLazMessageLine);
     function ExecuteMsgLinePlugin(Step: TIMQuickFixStep): boolean;
     procedure ConsistencyCheck;
+    procedure EnableDockMode(NewParent : TWinControl);
+    procedure DisableDockMode;
   public
     property LastLineIsProgress: boolean read FLastLineIsProgress
                                          write SetLastLineIsProgress;
@@ -145,6 +161,8 @@
                              read FOnSelectionChanged write FOnSelectionChanged;
     property Items[Index: integer]: TLazMessageLine read GetItems;
     property VisibleItems[Index: integer]: TLazMessageLine read GetVisibleItems;
+  published
+    property IsDocked : Boolean Read Status.Docked;
   end;
 
 var
@@ -279,6 +297,7 @@
   FVisibleItems := TFPList.Create;
   FSrcPositions := TAVLTree.Create(@CompareMsgSrcPositions);
   FLastSelectedIndex := -1;
+  Status.Docked:= false;
 
   Caption := lisMenuViewMessages;
   MessageTreeView.OnAdvancedCustomDrawItem := @MessageViewDrawItem;
@@ -1085,6 +1104,54 @@
   end;
 end;
 
+procedure TMessagesView.FormCloseQuery ( Sender : TObject;var CanClose : boolean ) ;
+begin
+  If Status.Docked Then DisableDockMode;
+  CanClose := True;
+end;
+
+procedure TMessagesView.SaveStatus;
+begin
+  Status.Docked      := False;
+  Status.Top         := Top;
+  Status.Left        := Left;
+  Status.Height      := Height;
+  Status.Width       := Width;
+  Status.BorderStyle := BorderStyle;
+  Status.Align       := Align;
+end;
+
+procedure TMessagesView.EnableDockMode(NewParent : TWinControl);
+begin
+  if (Status.Docked) then Exit;
+
+  SaveStatus;
+
+  Status.Docked := True;
+  BorderStyle   := bsNone;
+  Align         := alclient;
+  ClientHeight  := NewParent.ClientHeight;
+  ClientWidth   := NewParent.ClientWidth;
+
+  SetParent(NewParent);
+end;
+
+procedure TMessagesView.DisableDockMode;
+begin
+  if (not Status.Docked) then Exit;
+
+  Status.Docked := False;
+
+  SetParent(Status.OldParent);
+
+  Top           := Status.Top;
+  Left          := Status.Left;
+  Height        := Status.Height;
+  Width         := Status.Width;
+  BorderStyle   := Status.BorderStyle;
+  Align         := Status.Align;
+end;
+
 initialization
   MessagesView := nil;
   {$I msgview.lrs}
Index: uniteditor.lfm
===================================================================
--- uniteditor.lfm	(revision 10993)
+++ uniteditor.lfm	(working copy)
@@ -1,14 +1,14 @@
-object SourceNotebook: TSourceNotebook
-  Left = 533
+inherited SourceNotebook: TSourceNotebook
+  Left = 490
   Height = 300
-  Top = 374
+  Top = 267
   Width = 400
   HorzScrollBar.Page = 399
   VertScrollBar.Page = 299
   Caption = 'SourceNotebook'
   object StatusBar: TStatusBar
-    Height = 23
-    Top = 277
+    Height = 20
+    Top = 280
     Width = 400
     Panels = <    
       item
@@ -27,4 +27,20 @@
     SimpleText = 'This is a test'
     SimplePanel = False
   end
+  object DockPanel: TPanel
+    Height = 48
+    Top = 232
+    Width = 400
+    Align = alBottom
+    BevelInner = bvLowered
+    TabOrder = 0
+  end
+  object DockSplitter: TSplitter
+    Cursor = crVSplit
+    Height = 5
+    Top = 227
+    Width = 400
+    Align = alBottom
+    ResizeAnchor = akBottom
+  end
 end
Index: uniteditor.lrs
===================================================================
--- uniteditor.lrs	(revision 10993)
+++ uniteditor.lrs	(working copy)
@@ -1,8 +1,14 @@
+{ Questo รจ un file risorse generato automaticamente da Lazarus }
+
 LazarusResources.Add('TSourceNotebook','FORMDATA',[
-  'TPF0'#15'TSourceNotebook'#14'SourceNotebook'#4'Left'#3#21#2#6'Height'#3','#1
-  +#3'Top'#3'v'#1#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScroll'
-  +'Bar.Page'#3'+'#1#7'Caption'#6#14'SourceNotebook'#0#10'TStatusBar'#9'StatusB'
-  +'ar'#6'Height'#2#23#3'Top'#3#21#1#5'Width'#3#144#1#6'Panels'#14#1#5'Width'#2
-  +'d'#0#1#5'Width'#3#150#0#0#1#5'Width'#2'2'#0#1#4'Text'#6#3'INS'#5'Width'#2'2'
-  +#0#0#10'SimpleText'#6#14'This is a test'#11'SimplePanel'#8#0#0#0
+  'TPF0'#241#15'TSourceNotebook'#14'SourceNotebook'#4'Left'#3#234#1#6'Height'#3
+  +','#1#3'Top'#3#11#1#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertS'
+  +'crollBar.Page'#3'+'#1#7'Caption'#6#14'SourceNotebook'#0#10'TStatusBar'#9'St'
+  +'atusBar'#6'Height'#2#20#3'Top'#3#24#1#5'Width'#3#144#1#6'Panels'#14#1#5'Wid'
+  +'th'#2'd'#0#1#5'Width'#3#150#0#0#1#5'Width'#2'2'#0#1#4'Text'#6#3'INS'#5'Widt'
+  +'h'#2'2'#0#0#10'SimpleText'#6#14'This is a test'#11'SimplePanel'#8#0#0#6'TPa'
+  +'nel'#9'DockPanel'#6'Height'#2'0'#3'Top'#3#232#0#5'Width'#3#144#1#5'Align'#7
+  +#8'alBottom'#10'BevelInner'#7#9'bvLowered'#8'TabOrder'#2#0#0#0#9'TSplitter'
+  +#12'DockSplitter'#6'Cursor'#7#8'crVSplit'#6'Height'#2#5#3'Top'#3#227#0#5'Wid'
+  +'th'#3#144#1#5'Align'#7#8'alBottom'#12'ResizeAnchor'#7#8'akBottom'#0#0#0
 ]);
Index: uniteditor.pp
===================================================================
--- uniteditor.pp	(revision 10993)
+++ uniteditor.pp	(working copy)
@@ -401,6 +401,8 @@
 
   TSourceNotebook = class(TSourceEditorWindowInterface)
     Notebook: TNoteBook;
+    DockPanel : TPanel;
+    DockSplitter : TSplitter;
     SrcPopUpMenu: TPopupMenu;
     StatusBar: TStatusBar;
     procedure AddBreakpointClicked(Sender: TObject);
@@ -426,6 +428,7 @@
     procedure BookmarkSetFreeClicked(Sender: TObject);
     procedure BookMarkToggle(Value: Integer);
     procedure EditorPropertiesClicked(Sender: TObject);
+    procedure DockEditWindowClicked(Sender: TObject);
     procedure HighlighterClicked(Sender: TObject);
     procedure FindDeclarationClicked(Sender: TObject);
     procedure ProcedureJumpClicked(Sender: TObject);
@@ -822,6 +825,7 @@
   SrcEditMenuShowLineNumbers: TIDEMenuCommand;
   SrcEditMenuShowUnitInfo: TIDEMenuCommand;
   SrcEditMenuEditorProperties: TIDEMenuCommand;
+  SrcDockEditWindow: TIDEMenuCommand;
 
 procedure RegisterStandardSourceEditorMenuItems;
 
@@ -964,6 +968,8 @@
   // register the Flags section
   SrcEditMenuSectionFlags:=RegisterIDEMenuSection(SourceEditorMenuRoot,
                                                   'Flags section');
+    SrcDockEditWindow:=RegisterIDEMenuCommand(SourceEditorMenuRoot, 'Dockmessage', 'Dock messages');
+    SrcDockEditWindow.ShowAlwaysCheckable:=true;
   AParent:=SrcEditMenuSectionFlags;
     SrcEditMenuReadOnly:=RegisterIDEMenuCommand(AParent,'ReadOnly',uemReadOnly);
     SrcEditMenuReadOnly.ShowAlwaysCheckable:=true;
@@ -2850,7 +2856,9 @@
   Caption := locWndSrcEditor;
   KeyPreview:=true;
   FProcessingCommand := false;
-  
+  DockPanel.Visible:= false;
+  DockSplitter.Visible:= false;
+
   SourceEditorWindow:=Self;
 
   EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
@@ -3608,6 +3616,21 @@
     FOnEditorPropertiesClicked(Sender);
 end;
 
+procedure TSourceNotebook.DockEditWindowClicked(Sender: TObject);
+begin
+  If MessagesView.IsDocked then begin
+     MessagesView.DisableDockMode;
+     DockSplitter.visible:= false;
+     DockPanel.visible := false;
+     SrcDockEditWindow.MenuItem.Checked:= true;
+  end else begin
+     DockPanel.visible:= true;
+     DockSplitter.visible:= true;
+     SrcDockEditWindow.MenuItem.Checked:= true;
+     MessagesView.EnableDockMode(DockPanel)
+  end;
+end;
+
 procedure TSourceNotebook.HighlighterClicked(Sender: TObject);
 var
   IDEMenuItem: TIDEMenuItem;
@@ -3848,6 +3871,7 @@
   SrcEditMenuShowLineNumbers.OnClick:[EMAIL PROTECTED];
   SrcEditMenuShowUnitInfo.OnClick:[EMAIL PROTECTED];
   SrcEditMenuEditorProperties.OnClick:[EMAIL PROTECTED];
+  SrcDockEditWindow.OnClick:[EMAIL PROTECTED];
 end;
 
 procedure TSourceNotebook.UpdateHighlightMenuItems;
begin:vcard
fn:David Guadagnini
n:Guadagnini;David
org:Biotecnica Instruments S.p.A.;R&D
adr:;;Via Licenza 18;Roma;RM;00133;Italy
email;internet:[EMAIL PROTECTED]
title:Software architet
tel;work:+39064112616
x-mozilla-html:FALSE
version:2.1
end:vcard

Reply via email to