mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-25 21:56:19 +02:00
Source Editor: Preparation for PageControl (the PageControl with tabs Code/Design is provided later). r49389 from free-sparta branch by Maciej Izak.
This change should be improved, maybe introduce some interface/class in IdeIntf. git-svn-id: trunk@49536 -
This commit is contained in:
parent
295e472a3a
commit
a3f11fc51c
@ -6826,10 +6826,35 @@ function TSourceNotebook.FindSourceEditorWithPageIndex(APageIndex: integer): TSo
|
|||||||
var
|
var
|
||||||
I: integer;
|
I: integer;
|
||||||
TempEditor: TControl;
|
TempEditor: TControl;
|
||||||
|
|
||||||
|
function FindSynEdit(AControl: TWinControl): TControl;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
|
||||||
|
with AControl do
|
||||||
|
for I := 0 to ControlCount - 1 do
|
||||||
|
begin
|
||||||
|
if Controls[I] is TIDESynEditor then
|
||||||
|
Exit(Controls[I])
|
||||||
|
else
|
||||||
|
if Controls[I] is TWinControl then
|
||||||
|
begin
|
||||||
|
Result := FindSynEdit(TWinControl(Controls[I]));
|
||||||
|
if Result <> nil then
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if (FSourceEditorList=nil)
|
if (FSourceEditorList=nil)
|
||||||
or (APageIndex < 0) or (APageIndex >= PageCount) then exit;
|
or (APageIndex < 0) or (APageIndex >= PageCount) then exit;
|
||||||
|
|
||||||
|
TempEditor := FindSynEdit(NotebookPage[APageIndex]);
|
||||||
|
{
|
||||||
TempEditor:=nil;
|
TempEditor:=nil;
|
||||||
with NotebookPage[APageIndex] do
|
with NotebookPage[APageIndex] do
|
||||||
for I := 0 to ControlCount-1 do
|
for I := 0 to ControlCount-1 do
|
||||||
@ -6838,6 +6863,7 @@ begin
|
|||||||
TempEditor := Controls[I];
|
TempEditor := Controls[I];
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
if TempEditor=nil then exit;
|
if TempEditor=nil then exit;
|
||||||
I := FSourceEditorList.Count-1;
|
I := FSourceEditorList.Count-1;
|
||||||
while (I>=0) and (TSourceEditor(FSourceEditorList[I]).EditorComponent <> TempEditor) do
|
while (I>=0) and (TSourceEditor(FSourceEditorList[I]).EditorComponent <> TempEditor) do
|
||||||
@ -7290,6 +7316,9 @@ begin
|
|||||||
|
|
||||||
if (PageCount = 0) and (Parent=nil) and not FIsClosing then
|
if (PageCount = 0) and (Parent=nil) and not FIsClosing then
|
||||||
Close;
|
Close;
|
||||||
|
|
||||||
|
DoActiveEditorChanged;
|
||||||
|
Manager.ActiveEditor := Edit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.CopyEditor(OldPageIndex, NewWindowIndex,
|
procedure TSourceNotebook.CopyEditor(OldPageIndex, NewWindowIndex,
|
||||||
@ -7590,7 +7619,8 @@ begin
|
|||||||
// Move focus from Notebook-tabs to editor
|
// Move focus from Notebook-tabs to editor
|
||||||
TempEditor:=FindSourceEditorWithPageIndex(PageIndex);
|
TempEditor:=FindSourceEditorWithPageIndex(PageIndex);
|
||||||
if IsVisible and (TempEditor <> nil) and (FUpdateLock = 0) then
|
if IsVisible and (TempEditor <> nil) and (FUpdateLock = 0) then
|
||||||
TempEditor.EditorComponent.SetFocus;
|
// this line raises exception when editor is in other tab (for example - focused is designer)
|
||||||
|
;// TempEditor.EditorComponent.SetFocus;
|
||||||
finally
|
finally
|
||||||
debugln(SRCED_CLOSE, ['TSourceNotebook.CloseFile UnLock']);
|
debugln(SRCED_CLOSE, ['TSourceNotebook.CloseFile UnLock']);
|
||||||
DebugBoss.UnLockCommandProcessing;
|
DebugBoss.UnLockCommandProcessing;
|
||||||
@ -7904,11 +7934,25 @@ End;
|
|||||||
|
|
||||||
function TSourceNotebook.FindPageWithEditor(
|
function TSourceNotebook.FindPageWithEditor(
|
||||||
ASourceEditor: TSourceEditor):integer;
|
ASourceEditor: TSourceEditor):integer;
|
||||||
|
var
|
||||||
|
LParent: TWinControl;
|
||||||
|
LTabSheet: TWinControl;
|
||||||
begin
|
begin
|
||||||
if (ASourceEditor.EditorComponent.Parent is TTabSheet) and
|
if (ASourceEditor.EditorComponent.Parent is TTabSheet) then
|
||||||
(TTabSheet(ASourceEditor.EditorComponent.Parent).Parent = FNotebook)
|
begin
|
||||||
then
|
LParent := ASourceEditor.EditorComponent.Parent.Parent;
|
||||||
Result:=TTabSheet(ASourceEditor.EditorComponent.Parent).PageIndex
|
LTabSheet := ASourceEditor.EditorComponent.Parent;
|
||||||
|
while (LParent <> FNotebook) and (LParent <> nil) do
|
||||||
|
begin
|
||||||
|
LTabSheet := LParent;
|
||||||
|
LParent := LParent.Parent;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (LParent <> nil) and (LTabSheet is TTabSheet) then
|
||||||
|
Result:=TTabSheet(LTabSheet).PageIndex
|
||||||
|
else
|
||||||
|
Result:=-1;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Result:=-1;
|
Result:=-1;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user