mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-16 13:39:31 +02:00
IDE: fixed updating statusbar, notebookpagechange events are no longer triggered when PageIndex changes by program
git-svn-id: trunk@25639 -
This commit is contained in:
parent
f4fcb308d5
commit
808cdde51b
@ -45,6 +45,8 @@ type
|
|||||||
public
|
public
|
||||||
procedure MakeIDEWindowDockSite(AForm: TCustomForm); override;
|
procedure MakeIDEWindowDockSite(AForm: TCustomForm); override;
|
||||||
procedure MakeIDEWindowDockable(AControl: TWinControl); override;
|
procedure MakeIDEWindowDockable(AControl: TWinControl); override;
|
||||||
|
function IsDockSite(AForm: TCustomForm): boolean;
|
||||||
|
function IsDockable(AForm: TCustomForm): boolean;
|
||||||
procedure LoadDefaultLayout; override;
|
procedure LoadDefaultLayout; override;
|
||||||
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); override;
|
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean); override;
|
||||||
end;
|
end;
|
||||||
@ -70,9 +72,26 @@ begin
|
|||||||
DockMaster.MakeDockable(AControl);
|
DockMaster.MakeDockable(AControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TIDEEasyDockMaster.IsDockSite(AForm: TCustomForm): boolean;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if AForm=nil then exit;
|
||||||
|
if AForm.Parent<>nil then exit;
|
||||||
|
for i:=0 to AForm.ControlCount-1 do
|
||||||
|
if AForm.Controls[i] is TDockPanel then exit(true);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TIDEEasyDockMaster.IsDockable(AForm: TCustomForm): boolean;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if AForm=nil then exit;
|
||||||
|
if AForm.Parent=nil then exit;
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIDEEasyDockMaster.LoadDefaultLayout;
|
procedure TIDEEasyDockMaster.LoadDefaultLayout;
|
||||||
begin
|
begin
|
||||||
|
// ToDo: load the users default layout
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEEasyDockMaster.ShowForm(AForm: TCustomForm; BringToFront: boolean
|
procedure TIDEEasyDockMaster.ShowForm(AForm: TCustomForm; BringToFront: boolean
|
||||||
@ -85,10 +104,12 @@ var
|
|||||||
DockAlign: TAlign;
|
DockAlign: TAlign;
|
||||||
DockSibling: TCustomForm;
|
DockSibling: TCustomForm;
|
||||||
begin
|
begin
|
||||||
|
debugln(['TIDEEasyDockMaster.ShowForm ',DbgSName(AForm),' BringToFront=',BringToFront,' IsDockSite=',IsDockSite(AForm),' IsDockable=',IsDockable(AForm)]);
|
||||||
try
|
try
|
||||||
if not AForm.IsVisible then
|
if not (IsDockSite(AForm) or IsDockable(AForm)) then
|
||||||
begin
|
begin
|
||||||
// no layout found => use default
|
// this form was not yet docked
|
||||||
|
// place it at a default position and make it dockable
|
||||||
Creator:=IDEWindowCreators.FindWithName(AForm.Name);
|
Creator:=IDEWindowCreators.FindWithName(AForm.Name);
|
||||||
if Creator<>nil then
|
if Creator<>nil then
|
||||||
begin
|
begin
|
||||||
|
@ -517,7 +517,8 @@ type
|
|||||||
|
|
||||||
TSourceNotebookState = (
|
TSourceNotebookState = (
|
||||||
snIncrementalFind,
|
snIncrementalFind,
|
||||||
snWarnedFont
|
snWarnedFont,
|
||||||
|
snUpdateStatusBarNeeded
|
||||||
);
|
);
|
||||||
TSourceNotebookStates = set of TSourceNotebookState;
|
TSourceNotebookStates = set of TSourceNotebookState;
|
||||||
|
|
||||||
@ -685,6 +686,7 @@ type
|
|||||||
procedure ReleaseEditor(AnEditor: TSourceEditor);
|
procedure ReleaseEditor(AnEditor: TSourceEditor);
|
||||||
procedure EditorChanged(Sender: TObject);
|
procedure EditorChanged(Sender: TObject);
|
||||||
procedure DoClose(var CloseAction: TCloseAction); override;
|
procedure DoClose(var CloseAction: TCloseAction); override;
|
||||||
|
procedure DoShow; override;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
function GetActiveCompletionPlugin: TSourceEditorCompletionPlugin; override;
|
function GetActiveCompletionPlugin: TSourceEditorCompletionPlugin; override;
|
||||||
@ -2054,10 +2056,12 @@ begin
|
|||||||
OldModified := Modified; // Include SynEdit
|
OldModified := Modified; // Include SynEdit
|
||||||
FModified := AValue;
|
FModified := AValue;
|
||||||
if not FModified then
|
if not FModified then
|
||||||
|
begin
|
||||||
SynEditor.Modified := False; // All shared SynEdits share this value
|
SynEditor.Modified := False; // All shared SynEdits share this value
|
||||||
FEditorStampCommitedToCodetools := TSynEditLines(SynEditor.Lines).TextChangeStamp;
|
FEditorStampCommitedToCodetools := TSynEditLines(SynEditor.Lines).TextChangeStamp;
|
||||||
for i := 0 to FSharedEditorList.Count - 1 do
|
for i := 0 to FSharedEditorList.Count - 1 do
|
||||||
SharedEditors[i].FEditor.MarkTextAsSaved; // Todo: centralize in SynEdit
|
SharedEditors[i].FEditor.MarkTextAsSaved; // Todo: centralize in SynEdit
|
||||||
|
end;
|
||||||
if OldModified <> Modified then
|
if OldModified <> Modified then
|
||||||
for i := 0 to FSharedEditorList.Count - 1 do begin
|
for i := 0 to FSharedEditorList.Count - 1 do begin
|
||||||
SharedEditors[i].UpdatePageName;
|
SharedEditors[i].UpdatePageName;
|
||||||
@ -2651,8 +2655,7 @@ Begin
|
|||||||
{$IFDEF VerboseFocus}
|
{$IFDEF VerboseFocus}
|
||||||
debugln('TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name);
|
debugln('TSourceEditor.FocusEditor A ',PageName,' ',FEditor.Name);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if SourceNotebook<>nil then
|
IDEWindowCreators.ShowForm(SourceNotebook,true);
|
||||||
IDEWindowCreators.ShowForm(SourceNotebook,true);
|
|
||||||
if SourceNotebook.IsVisible then begin
|
if SourceNotebook.IsVisible then begin
|
||||||
FEditor.SetFocus;
|
FEditor.SetFocus;
|
||||||
FSharedValues.SetActiveSharedEditor(Self);
|
FSharedValues.SetActiveSharedEditor(Self);
|
||||||
@ -5448,6 +5451,7 @@ begin
|
|||||||
if Assigned(Manager) and (FNotebook.PageIndex = FPageIndex) then
|
if Assigned(Manager) and (FNotebook.PageIndex = FPageIndex) then
|
||||||
Manager.DoActiveEditorChanged;
|
Manager.DoActiveEditorChanged;
|
||||||
FNotebook.PageIndex := FPageIndex;
|
FNotebook.PageIndex := FPageIndex;
|
||||||
|
NotebookPageChanged(Self);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5662,6 +5666,14 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.DoShow;
|
||||||
|
begin
|
||||||
|
inherited DoShow;
|
||||||
|
// statusbar was not updated when visible=false, update now
|
||||||
|
if snUpdateStatusBarNeeded in States then
|
||||||
|
UpdateStatusBar;
|
||||||
|
end;
|
||||||
|
|
||||||
function TSourceNotebook.IndexOfEditorInShareWith(AnOtherEditor: TSourceEditor
|
function TSourceNotebook.IndexOfEditorInShareWith(AnOtherEditor: TSourceEditor
|
||||||
): Integer;
|
): Integer;
|
||||||
var
|
var
|
||||||
@ -6572,6 +6584,7 @@ Begin
|
|||||||
Result.PageName:= Manager.FindUniquePageName(NewShortName, Result);
|
Result.PageName:= Manager.FindUniquePageName(NewShortName, Result);
|
||||||
UpdatePageNames;
|
UpdatePageNames;
|
||||||
UpdateProjectFiles;
|
UpdateProjectFiles;
|
||||||
|
UpdateStatusBar;
|
||||||
finally
|
finally
|
||||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.NewFile'){$ENDIF};
|
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.NewFile'){$ENDIF};
|
||||||
end;
|
end;
|
||||||
@ -6585,12 +6598,14 @@ end;
|
|||||||
procedure TSourceNotebook.CloseFile(APageIndex:integer);
|
procedure TSourceNotebook.CloseFile(APageIndex:integer);
|
||||||
var
|
var
|
||||||
TempEditor: TSourceEditor;
|
TempEditor: TSourceEditor;
|
||||||
|
WasSelected: Boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF IDE_DEBUG}
|
{$IFDEF IDE_DEBUG}
|
||||||
writeln('TSourceNotebook.CloseFile A APageIndex=',APageIndex);
|
writeln('TSourceNotebook.CloseFile A APageIndex=',APageIndex);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
TempEditor:=FindSourceEditorWithPageIndex(APageIndex);
|
TempEditor:=FindSourceEditorWithPageIndex(APageIndex);
|
||||||
if TempEditor=nil then exit;
|
if TempEditor=nil then exit;
|
||||||
|
WasSelected:=PageIndex=APageIndex;
|
||||||
//debugln(['TSourceNotebook.CloseFile ',TempEditor.FileName,' ',TempEditor.APageIndex]);
|
//debugln(['TSourceNotebook.CloseFile ',TempEditor.FileName,' ',TempEditor.APageIndex]);
|
||||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.CloseFile'){$ENDIF};
|
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.CloseFile'){$ENDIF};
|
||||||
try
|
try
|
||||||
@ -6603,8 +6618,9 @@ begin
|
|||||||
NoteBookDeletePage(APageIndex);
|
NoteBookDeletePage(APageIndex);
|
||||||
//writeln('TSourceNotebook.CloseFile C APageIndex=',APageIndex,' PageCount=',PageCount,' NoteBook.APageIndex=',Notebook.APageIndex);
|
//writeln('TSourceNotebook.CloseFile C APageIndex=',APageIndex,' PageCount=',PageCount,' NoteBook.APageIndex=',Notebook.APageIndex);
|
||||||
UpdateProjectFiles;
|
UpdateProjectFiles;
|
||||||
UpdateStatusBar;
|
|
||||||
UpdatePageNames;
|
UpdatePageNames;
|
||||||
|
if WasSelected then
|
||||||
|
UpdateStatusBar;
|
||||||
// set focus to new editor
|
// set focus to new editor
|
||||||
TempEditor:=FindSourceEditorWithPageIndex(PageIndex);
|
TempEditor:=FindSourceEditorWithPageIndex(PageIndex);
|
||||||
if PageCount = 0 then begin
|
if PageCount = 0 then begin
|
||||||
@ -6632,7 +6648,6 @@ begin
|
|||||||
if (fAutoFocusLock>0) then exit;
|
if (fAutoFocusLock>0) then exit;
|
||||||
SrcEdit:=GetActiveSE;
|
SrcEdit:=GetActiveSE;
|
||||||
if SrcEdit=nil then exit;
|
if SrcEdit=nil then exit;
|
||||||
IDEWindowCreators.ShowForm(Self,true);
|
|
||||||
SrcEdit.FocusEditor;
|
SrcEdit.FocusEditor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6750,10 +6765,16 @@ var
|
|||||||
PanelFileMode: string;
|
PanelFileMode: string;
|
||||||
CurEditor: TSynEdit;
|
CurEditor: TSynEdit;
|
||||||
begin
|
begin
|
||||||
if not Visible then exit;
|
if not IsVisible then
|
||||||
|
begin
|
||||||
|
Include(States,snUpdateStatusBarNeeded);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Exclude(States,snUpdateStatusBarNeeded);
|
||||||
TempEditor := GetActiveSE;
|
TempEditor := GetActiveSE;
|
||||||
if TempEditor = nil then Exit;
|
if TempEditor = nil then Exit;
|
||||||
CurEditor:=TempEditor.EditorComponent;
|
CurEditor:=TempEditor.EditorComponent;
|
||||||
|
//debugln(['TSourceNotebook.UpdateStatusBar ',tempEditor.FileName,' ',PageIndex]);
|
||||||
|
|
||||||
if (snIncrementalFind in States)
|
if (snIncrementalFind in States)
|
||||||
and (CompareCaret(CurEditor.LogicalCaretXY,FIncrementalSearchPos)<>0) then
|
and (CompareCaret(CurEditor.LogicalCaretXY,FIncrementalSearchPos)<>0) then
|
||||||
@ -6768,7 +6789,6 @@ begin
|
|||||||
if (CurEditor.CaretY<>TempEditor.ErrorLine)
|
if (CurEditor.CaretY<>TempEditor.ErrorLine)
|
||||||
or (CurEditor.CaretX<>TempEditor.fErrorColumn) then
|
or (CurEditor.CaretX<>TempEditor.fErrorColumn) then
|
||||||
TempEditor.ErrorLine:=-1;
|
TempEditor.ErrorLine:=-1;
|
||||||
|
|
||||||
Statusbar.BeginUpdate;
|
Statusbar.BeginUpdate;
|
||||||
|
|
||||||
if snIncrementalFind in States then begin
|
if snIncrementalFind in States then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user