IDE, SourceEditor: Defer switching notebook-tab as it causes repaint on some OS (Windows), which may lead to intermittent incorrect display. Issue #15006

git-svn-id: trunk@22549 -
This commit is contained in:
martin 2009-11-12 21:02:08 +00:00
parent a6b1e4deb8
commit ba1566e224
2 changed files with 13 additions and 8 deletions

View File

@ -7204,6 +7204,7 @@ var NewSrcEdit: TSourceEditor;
NewErrorLine: LongInt;
NewExecutionLine: LongInt;
FoldState: String;
NewEditorIndex: LongInt;
begin
AFilename:=AnUnitInfo.Filename;
@ -7250,16 +7251,17 @@ begin
end;
// update editor indices in project
NewEditorIndex := SourceNotebook.FindPageWithEditor(NewSrcEdit);
if (not (ofProjectLoading in Flags)) and NewSrcEditorCreated then
Project1.InsertEditorIndex(SourceNotebook.Notebook.PageIndex);
AnUnitInfo.EditorIndex:=SourceNotebook.FindPageWithEditor(NewSrcEdit);
Project1.InsertEditorIndex(NewEditorIndex);
AnUnitInfo.EditorIndex := NewEditorIndex;
//debugln(['TMainIDE.DoOpenFileInSourceEditor ',AnUnitInfo.Filename,' ',AnUnitInfo.EditorIndex]);
// restore source editor settings
DoRestoreBookMarks(AnUnitInfo,NewSrcEdit);
DebugBoss.DoRestoreDebuggerMarks(AnUnitInfo);
NewSrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
NewSrcEdit.EditorComponent.AfterLoadFromFile;
NewSrcEdit.EditorComponent.AfterLoadFromFile;
try
NewSrcEdit.EditorComponent.FoldState := FoldState;
except
@ -7278,6 +7280,8 @@ begin
AnUnitInfo.Loaded:=true;
// update statusbar and focus editor
if NewSrcEditorCreated then
SourceNotebook.Notebook.PageIndex := AnUnitInfo.EditorIndex;
if (not (ofProjectLoading in Flags)) then
SourceNotebook.FocusEditor;
SourceNoteBook.UpdateStatusBar;

View File

@ -611,7 +611,7 @@ type
function CreateNotebook: Boolean;
function NewSE(Pagenum: Integer): TSourceEditor;
function NewSE(Pagenum: Integer; SwitchToTab: Boolean = True): TSourceEditor;
procedure EditorChanged(Sender: TObject);
procedure ccExecute(Sender: TObject);
@ -4875,7 +4875,7 @@ Begin
OnEditorChanged(Sender);
End;
function TSourceNotebook.NewSE(PageNum: Integer): TSourceEditor;
function TSourceNotebook.NewSE(PageNum: Integer; SwitchToTab: Boolean = True): TSourceEditor;
begin
{$IFDEF IDE_DEBUG}
writeln('TSourceNotebook.NewSE A ');
@ -4896,7 +4896,8 @@ begin
Result.EditorComponent.BeginUpdate;
FSourceEditorList.Add(Result);
Result.CodeTemplates:=CodeTemplateModul;
Notebook.PageIndex := Pagenum;
if SwitchToTab then
Notebook.PageIndex := Pagenum;
//debugln(['TSourceNotebook.NewSE C GetActiveSE=Result=',GetActiveSE=Result]);
Result.FPageName:=NoteBook.Pages[Pagenum];
Result.EditorComponent.BookMarkOptions.BookmarkImages := SourceEditorMarks.ImgList;
@ -6224,7 +6225,7 @@ Begin
writeln('[TSourceNotebook.NewFile] A ');
{$ENDIF}
Visible:=true;
Result := NewSE(-1);
Result := NewSE(-1, FocusIt);
{$IFDEF IDE_DEBUG}
writeln('[TSourceNotebook.NewFile] B ');
{$ENDIF}
@ -6232,7 +6233,7 @@ Begin
{$IFDEF IDE_DEBUG}
writeln('[TSourceNotebook.NewFile] D ');
{$ENDIF}
Result.PageName:=FindUniquePageName(NewShortName,Notebook.PageIndex);
Result.PageName:=FindUniquePageName(NewShortName, FindPageWithEditor(Result));
if FocusIt then FocusEditor;
{$IFDEF IDE_DEBUG}
writeln('[TSourceNotebook.NewFile] end');