This is the function that is actually used by GetTextBuf, and loads a string rather than performing read-write to a PChar buffer
- GetTextBuf
- RealSetText
- SetTextBuf
+ GetTextBuf
+ RealSetText
+ SetTextBuf
@@ -5945,9 +5945,9 @@ mrLast=mrYesToAll=10
This is the procedure that is actually used by SetTextBuf, and stores text as a string rather than performing read-write to a PChar buffer
- SetTextBuf
- RealGetText
- GetTextBuf
+ SetTextBuf
+ RealGetText
+ GetTextBuf
@@ -6500,7 +6500,7 @@ mrLast=mrYesToAll=10
Remove a previously docked control and put a new control in its placeChecks to see whether there is a previously docked control, and removes it, then puts the new control in its place
- ManualDock
+ ManualDock
@@ -6654,7 +6654,7 @@ mrLast=mrYesToAll=10
Checks that this is a new control, then calls SetBounds to set up coordinates defining its position
- SetBounds
+ SetBounds
@@ -6890,8 +6890,8 @@ mrLast=mrYesToAll=10
Hide this control
-
-
+
+
@@ -6975,8 +6975,8 @@ mrLast=mrYesToAll=10
- RealGetText
- GetText
+ RealGetText
+ GetText
@@ -7021,8 +7021,8 @@ mrLast=mrYesToAll=10
- RealSetText
- SetText
+ RealSetText
+ SetText
@@ -7107,8 +7107,8 @@ mrLast=mrYesToAll=10
-
-
+
+
@@ -7258,7 +7258,7 @@ mrLast=mrYesToAll=10
May have no alignment, may have custom or client alignment, or can be aligned to top, bottom, left or right
-
+
@@ -7271,7 +7271,7 @@ mrLast=mrYesToAll=10
-
+
@@ -7284,7 +7284,7 @@ mrLast=mrYesToAll=10
-
+
@@ -7406,7 +7406,7 @@ introduced. These functions interface with the LCLInterface.
Determine Constraints (max and min height and width) for this control; reads the size constraints or stores new ones.
-
+
@@ -7434,7 +7434,7 @@ introduced. These functions interface with the LCLInterface.
- whether mouse has been clicked, data being read, control being re-drawn, etc. Reads or stores the state of the control.
-
+
@@ -7449,7 +7449,7 @@ introduced. These functions interface with the LCLInterface.
- whether the control responds to mouse clicks, can be re-sized, has particular actions, etc. Reads the stored style, or saves the new style
-
+
@@ -7512,7 +7512,8 @@ Reads a logical (boolean) flag or sets it to determine whether this object is a
Event Handler for resize of control
- // standard properties, which should be supported by all descendants Reads or Writes flag if control is re-sized.
+ This event is triggered whenever the Width, Height, ClientWidth or ClientHeight of the control has changed.
+During autosize the size can change multiple times and only the last change triggers the OnResize.
@@ -7522,8 +7523,8 @@ Reads a logical (boolean) flag or sets it to determine whether this object is a
Event Handler when a hint needs to be shown// standard properties, which should be supported by all descendants Reads or Writes a flag when a hint (a small pop-up box, appearing when the mouse hovers over an object) is to be shown
-
-
+
+
@@ -7532,7 +7533,7 @@ Reads a logical (boolean) flag or sets it to determine whether this object is a
// standard properties, which should be supported by all descendants
Reads or writes a flag to find or store the identity of the parent for this control. The parent is of type TWincontrol
-
+
@@ -7552,7 +7553,7 @@ Properties are defined in the parent class TPop
Flag to determine: Is hint to be displayed for this control?// standard properties, which should be supported by all descendants Reads flag or writes one to determine if a hint is to be shown when mouse hovers over this control. If value is stored, a storage flag is set. Display of the actual hint is controlled by OnShowHint
- OnShowHint
+ OnShowHint
@@ -7568,9 +7569,9 @@ Properties are defined in the parent class TPop
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.
-
-
-
+
+
+
@@ -7578,7 +7579,7 @@ Properties are defined in the parent class TPop
Reads or writes a message associated with this window// standard properties, which should be supported by all descendants Reads message from flag area, or stores a message
-
+
@@ -8253,7 +8254,7 @@ Properties are defined in the parent class TPop
Defines procedures and functions related to windowed controls, some of which override virtual methods defined in ancestor classes.
-
+
@@ -10100,7 +10101,8 @@ Properties are defined in the parent class TPop
CreateParams - create parameters for this windowed class
-
CreateParams - create parameters for this windowed class
+
+ CreateParams - create parameters for this windowed class
Definition of parameters:
TCreateParams = record
Caption: PChar;
@@ -10177,7 +10179,8 @@ End;
InitializeWnd - initialise the window for this control
-
InitializeWnd - initialise the window for this control
+
+ InitializeWnd - initialise the window for this control
Gets called after the Handle is created and before the child handles are created
@@ -10401,7 +10404,7 @@ End;
Definitions of how any child control is to be sizedReads values from flag or stores values to flag. Most of the properties are inherited from TControlChildSizing, which you should read to find out more about this control
-
+
@@ -10447,7 +10450,7 @@ End;
Property that actually controls the docking processReads or writes a flag. Derived from the parent class TDockManager
-
+
@@ -11246,7 +11249,7 @@ need the ability to accept keyboard input or contain other controls.
Paint method called in response to paint requests received by the parent control.
-
+
@@ -11336,8 +11339,8 @@ getting the parent control's Canvas dimensions.
Contains simple basic definitions to create, destroy and paint window controls and set basic properties like canvas and border
-
-
+
+
@@ -11369,7 +11372,7 @@ getting the parent control's Canvas dimensions.
Paint handler plug-inThis is a plug-in in TWinControl to get the DC, assign it to our canvas and call the paint method for descendants to do the actual painting
-
+
@@ -11425,7 +11428,7 @@ getting the parent control's Canvas dimensions.
Only a restricted series of options is available: none or a single border.
-
+
@@ -11978,7 +11981,7 @@ getting the parent control's Canvas dimensions.
-
+
@@ -12637,7 +12640,7 @@ getting the parent control's Canvas dimensions.
Calls CursorToIdent to find correct entry in look-up table
-
+
@@ -12653,7 +12656,8 @@ getting the parent control's Canvas dimensions.
StringToCursor - returns the cursor value corresponding to the name supplied
-
StringToCursor - returns the cursor value corresponding to the name supplied
+
+ StringToCursor - returns the cursor value corresponding to the name supplied
Finds the numeric cursor value corresponding to the name S in the cursor look-up table
diff --git a/ide/main.pp b/ide/main.pp
index 4de6bc8705..bd82c9202c 100644
--- a/ide/main.pp
+++ b/ide/main.pp
@@ -1527,7 +1527,6 @@ begin
InputHistories.Save;
PkgBoss.SaveSettings;
if TheControlSelection<>nil then TheControlSelection.Clear;
- if SourceNoteBook<>nil then SourceNoteBook.ClearUnUsedEditorComponents(true);
FreeIDEWindows;
end;
diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp
index 7812e1d6cc..74d0396721 100644
--- a/ide/sourceeditor.pp
+++ b/ide/sourceeditor.pp
@@ -172,6 +172,7 @@ type
procedure CreateEditor(AOwner: TComponent; AParent: TWinControl);
procedure SetVisible(Value: boolean);
+ procedure UnbindEditor;
protected
ErrorMsgs: TStrings;
procedure ReParent(AParent: TWinControl);
@@ -502,7 +503,6 @@ type
FOnViewJumpHistory: TNotifyEvent;
FProcessingCommand: boolean;
FSourceEditorList: TList; // list of TSourceEditor
- FUnUsedEditorComponents: TList; // list of TSynEdit
FOnPopupMenu: TSrcEditPopupMenuEvent;
private
// colors for the completion form (popup form, e.g. word completion)
@@ -658,7 +658,6 @@ type
function FindUniquePageName(FileName:string; IgnorePageIndex:integer):string;
function SomethingModified: boolean;
procedure UpdateStatusBar;
- procedure ClearUnusedEditorComponents(Force: boolean);
procedure ClearErrorLines; override;
procedure ClearExecutionLines;
@@ -1052,6 +1051,7 @@ Begin
CreateEditor(AOwner,AParent);
FEditPlugin := TSynEditPlugin1.Create(FEditor);
+ // IMPORTANT: when you change below, don't forget updating UnbindEditor
FEditPlugin.OnLinesInserted := @LinesInserted;
FEditPlugin.OnLinesDeleted := @LinesDeleted;
end;
@@ -1060,12 +1060,15 @@ destructor TSourceEditor.Destroy;
begin
//writeln('TSourceEditor.Destroy A ',FEditor.Name);
if (FAOwner<>nil) and (FEditor<>nil) then begin
+ UnbindEditor;
FEditor.Visible:=false;
FEditor.Parent:=nil;
if SourceEditorMarks<>nil then
SourceEditorMarks.DeleteAllForEditor(FEditor);
TSourceNotebook(FAOwner).FSourceEditorList.Remove(Self);
- TSourceNotebook(FAOwner).FUnUsedEditorComponents.Add(FEditor);
+ FreeAndNil(FEditor);
+ end else begin
+ FEditor:=nil;
end;
//writeln('TSourceEditor.Destroy B ');
inherited Destroy;
@@ -2250,6 +2253,8 @@ Begin
BookMarkOptions.EnableKeys := false;
BookMarkOptions.LeftMargin:=1;
WantTabs := true;
+
+ // IMPORTANT: when you change below, don't forget updating UnbindEditor
OnStatusChange := @EditorStatusChanged;
OnProcessCommand := @ProcessCommand;
OnProcessUserCommand := @ProcessUserCommand;
@@ -2263,6 +2268,8 @@ Begin
OnClickLink := @EditorClickLink;
OnMouseLink := @EditorMouseLink;
OnKeyDown := @EditorKeyDown;
+ // IMPORTANT: when you change above, don't forget updating UnbindEditor
+
end;
if FCodeTemplates<>nil then
FCodeTemplates.AddEditor(FEditor);
@@ -2578,6 +2585,7 @@ Begin
if aCompletion<>nil then
aCompletion.RemoveEditor(FEditor);
SourceEditorMarks.DeleteAllForEditor(FEditor);
+ UnbindEditor;
FEditor.Parent:=nil;
CodeBuffer := nil;
If Assigned(FOnAfterClose) then FOnAfterClose(Self);
@@ -2975,6 +2983,30 @@ begin
FVisible:=Value;
end;
+procedure TSourceEditor.UnbindEditor;
+// disconnect all events
+begin
+ with EditorComponent do begin
+ OnStatusChange := nil;
+ OnProcessCommand := nil;
+ OnProcessUserCommand := nil;
+ OnCommandProcessed := nil;
+ OnReplaceText := nil;
+ OnGutterClick := nil;
+ OnSpecialLineMarkup := nil;
+ OnMouseMove := nil;
+ OnMouseWheel := nil;
+ OnMouseDown := nil;
+ OnClickLink := nil;
+ OnMouseLink := nil;
+ OnKeyDown := nil;
+ end;
+ if FEditPlugin<>nil then begin
+ FEditPlugin.OnLinesInserted := nil;
+ FEditPlugin.OnLinesDeleted := nil;
+ end;
+end;
+
procedure TSourceEditor.DoEditorExecuteCommand(EditorCommand: word);
begin
EditorComponent.CommandProcessor(TSynEditorCommand(EditorCommand),' ',nil);
@@ -3003,7 +3035,6 @@ begin
{$ENDIF}
FSourceEditorList := TList.Create;
- FUnUsedEditorComponents := TList.Create;
// code templates
FCodeTemplateModul:=TSynEditAutoComplete.Create(Self);
@@ -3079,8 +3110,6 @@ begin
FProcessingCommand:=false;
for i:=FSourceEditorList.Count-1 downto 0 do
Editors[i].Free;
- ClearUnUsedEditorComponents(true);
- FUnUsedEditorComponents.Free;
if Notebook<>nil then begin
FreeThenNil(Notebook);
end;
@@ -3788,7 +3817,6 @@ Begin
{$IFDEF IDE_MEM_CHECK}
CheckHeapWrtMemCnt('[TSourceNotebook.CreateNotebook] A ');
{$ENDIF}
- ClearUnUsedEditorComponents(false);
{$IFDEF IDE_DEBUG}
writeln('[TSourceNotebook.CreateNotebook] A');
{$ENDIF}
@@ -3852,15 +3880,6 @@ Begin
{$ENDIF}
End;
-Procedure TSourceNotebook.ClearUnUsedEditorComponents(Force: boolean);
-var i:integer;
-begin
- if (not Force) and FProcessingCommand then exit;
- for i:=FUnUsedEditorComponents.Count-1 downto 0 do
- Application.ReleaseComponent(TSynEdit(FUnUsedEditorComponents[i]));
- FUnUsedEditorComponents.Clear;
-end;
-
procedure TSourceNotebook.EditorPropertiesClicked(Sender: TObject);
begin
if Assigned(FOnEditorPropertiesClicked) then
@@ -4362,10 +4381,10 @@ end;
Procedure TSourceNotebook.EditorChanged(Sender: TObject);
var SenderDeleted: boolean;
Begin
- SenderDeleted:=FUnUsedEditorComponents.IndexOf(Sender)>=0;
- ClearUnUsedEditorComponents(false);
+ SenderDeleted:=(Sender as TControl).Parent=nil;
+ if SenderDeleted then exit;
UpdateStatusBar;
- if (not SenderDeleted) and Assigned(OnEditorChanged) then
+ if Assigned(OnEditorChanged) then
OnEditorChanged(Sender);
End;
@@ -4417,7 +4436,6 @@ function TSourceNotebook.FindSourceEditorWithPageIndex(
var I: integer;
TempEditor: TControl;
begin
- ClearUnUsedEditorComponents(false);
Result := nil;
if (FSourceEditorList=nil)
or (Notebook=nil)