mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 01:19:37 +02:00
MG: fixed sourcenotebook closing and form-unit switching
git-svn-id: trunk@1433 -
This commit is contained in:
parent
f52032df06
commit
f8f190fabb
49
ide/main.pp
49
ide/main.pp
@ -2824,6 +2824,8 @@ writeln('TMainIDE.DoCloseEditorUnit A PageIndex=',PageIndex);
|
||||
Result:=mrCancel;
|
||||
GetUnitWithPageIndex(PageIndex,ActiveSrcEdit,ActiveUnitInfo);
|
||||
if ActiveUnitInfo=nil then exit;
|
||||
if ActiveUnitInfo.Form=FLastFormActivated then
|
||||
FLastFormActivated:=nil;
|
||||
ActiveUnitInfo.ReadOnly:=ActiveSrcEdit.ReadOnly;
|
||||
ActiveUnitInfo.TopLine:=ActiveSrcEdit.EditorComponent.TopLine;
|
||||
ActiveUnitInfo.CursorPos:=ActiveSrcEdit.EditorComponent.CaretXY;
|
||||
@ -4662,40 +4664,32 @@ procedure TMainIDE.DoBringToFrontFormOrUnit;
|
||||
var AForm: TCustomForm;
|
||||
ActiveUnitInfo: TUnitInfo;
|
||||
begin
|
||||
if FCodeLastActivated then
|
||||
begin
|
||||
if SourceNoteBook.NoteBook<>nil then
|
||||
AForm:=SourceNotebook
|
||||
else
|
||||
AForm:=nil;
|
||||
//if AForm is set, make sure the right tab is being displayed.
|
||||
if AForm <> nil then
|
||||
begin
|
||||
AForm:=nil;
|
||||
if FCodeLastActivated then begin
|
||||
if SourceNoteBook.NoteBook<>nil then begin
|
||||
AForm:=SourceNotebook;
|
||||
if FLastFormActivated<>nil then begin
|
||||
ActiveUnitInfo := Project.UnitWithForm(FLastFormActivated);
|
||||
if ActiveUnitInfo <> nil then
|
||||
begin
|
||||
SourceNotebook.Notebook.PageIndex := ActiveUnitInfo.EditorIndex;
|
||||
end;
|
||||
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (SourceNoteBook.NoteBook<>nil) then
|
||||
begin
|
||||
if (ActiveUnitInfo <> nil) and (ActiveUnitInfo.EditorIndex>=0) then
|
||||
begin
|
||||
SourceNotebook.Notebook.PageIndex := ActiveUnitInfo.EditorIndex;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (SourceNoteBook.NoteBook<>nil) then begin
|
||||
ActiveUnitInfo:=Project.UnitWithEditorIndex(
|
||||
SourceNoteBook.NoteBook.PageIndex);
|
||||
if (ActiveUnitInfo<>nil) then
|
||||
AForm:=TCustomForm(ActiveUnitInfo.Form);
|
||||
FLastFormActivated := AForm;
|
||||
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if AForm<>nil then
|
||||
begin
|
||||
if AForm<>nil then begin
|
||||
BringWindowToTop(AForm.Handle);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnMacroSubstitution(TheMacro: TTransferMacro; var s:string;
|
||||
@ -5850,6 +5844,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.219 2002/02/09 21:09:19 lazarus
|
||||
MG: fixed sourcenotebook closing and form-unit switching
|
||||
|
||||
Revision 1.218 2002/02/09 20:32:08 lazarus
|
||||
MG: many fixes on my way to events
|
||||
|
||||
|
@ -256,8 +256,6 @@ type
|
||||
FUnUsedEditorComponents: TList; // list of TSynEdit
|
||||
FProcessingCommand: boolean;
|
||||
|
||||
FSaveDialog : TSaveDialog;
|
||||
|
||||
FOnAddJumpPoint: TOnAddJumpPoint;
|
||||
FOnCloseClicked: TNotifyEvent;
|
||||
FOnDeleteLastJumpPoint: TNotifyEvent;
|
||||
@ -516,8 +514,8 @@ begin
|
||||
if (FAOwner<>nil) and (FEditor<>nil) then begin
|
||||
FEditor.Visible:=false;
|
||||
FEditor.Parent:=nil;
|
||||
TSourceNoteBook(FAOwner).FSourceEditorList.Remove(FEditor);
|
||||
TSourceNoteBook(FAOwner).FUnUsedEditorComponents.Remove(FEditor);
|
||||
TSourceNoteBook(FAOwner).FSourceEditorList.Remove(Self);
|
||||
TSourceNoteBook(FAOwner).FUnUsedEditorComponents.Add(FEditor);
|
||||
end;
|
||||
//writeln('TSourceEditor.Destroy B ');
|
||||
inherited Destroy;
|
||||
@ -1565,7 +1563,6 @@ begin
|
||||
OnGetSource:=@OnWordCompletionGetSource;
|
||||
end;
|
||||
end;
|
||||
FSaveDialog := TSaveDialog.Create(Self);
|
||||
BuildPopupMenu;
|
||||
|
||||
|
||||
@ -1663,7 +1660,6 @@ end;
|
||||
destructor TSourceNotebook.Destroy;
|
||||
var i: integer;
|
||||
begin
|
||||
//writeln('[TSourceNotebook.Destroy]');
|
||||
FProcessingCommand:=false;
|
||||
for i:=FSourceEditorList.Count-1 downto 0 do
|
||||
Editors[i].Free;
|
||||
@ -2674,11 +2670,7 @@ writeln('TSourceNotebook.CloseFile A PageIndex=',PageIndex);
|
||||
TempEditor:=FindSourceEditorWithPageIndex(PageIndex);
|
||||
if TempEditor=nil then exit;
|
||||
TempEditor.Close;
|
||||
FSourceEditorList.Remove(TempEditor);
|
||||
if FProcessingCommand then
|
||||
FUnUsedEditorComponents.Add(TempEditor)
|
||||
else
|
||||
TempEditor.Free;
|
||||
TempEditor.Free;
|
||||
if Notebook.Pages.Count>1 then begin
|
||||
//writeln('TSourceNotebook.CloseFile B PageIndex=',PageIndex);
|
||||
Notebook.Pages.Delete(PageIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user