implemented CodeExplorer auto update on switching source editor page

git-svn-id: trunk@6448 -
This commit is contained in:
mattias 2005-01-01 16:04:13 +00:00
parent e35647ff98
commit c83f9e671a
5 changed files with 52 additions and 10 deletions

View File

@ -35,7 +35,8 @@ interface
uses
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
Laz_XMLCfg, Buttons, ExtCtrls;
Laz_XMLCfg, Buttons, ExtCtrls, FileUtil,
LazConf;
type
{ TCodeExplorerOptions }
@ -86,7 +87,9 @@ type
const
CodeExplorerVersion = 1;
cerDefault = cerSwitchEditorPage;
CodeExplorerRefreshNames: array[TCodeExplorerRefresh] of string = (
'Manual',
'SwitchEditorPage',
@ -130,7 +133,8 @@ end;
constructor TCodeExplorerOptions.Create;
begin
FOptionsFilename:='codeexploreroptions.xml';
FOptionsFilename:=
AppendPathDelim(GetPrimaryConfigPath)+'codeexploreroptions.xml';
FRefresh:=cerDefault;
end;

View File

@ -104,6 +104,8 @@ type
procedure EndUpdate;
procedure Refresh;
procedure JumpToSelection;
procedure CurrentCodeBufferChanged;
public
property OnGetCodeTree: TOnGetCodeTree read FOnGetCodeTree
write FOnGetCodeTree;
property OnJumpToCode: TOnJumpToCode read FOnJumpToCode write FOnJumpToCode;
@ -488,6 +490,12 @@ begin
OnJumpToCode(Self,Caret.Code.Filename,Point(Caret.X,Caret.Y),NewTopLine);
end;
procedure TCodeExplorerView.CurrentCodeBufferChanged;
begin
if CodeExplorerOptions.Refresh=cerSwitchEditorPage then
Refresh;
end;
initialization
{$I codeexplorer.lrs}
CodeExplorerView:=nil;

View File

@ -298,6 +298,7 @@ type
procedure OnSrcNotebookDeleteLastJumPoint(Sender: TObject);
procedure OnSrcNotebookEditorVisibleChanged(Sender: TObject);
procedure OnSrcNotebookEditorChanged(Sender: TObject);
procedure OnSrcNotebookCurCodeBufferChanged(Sender: TObject);
procedure OnSrcNotebookFileNew(Sender: TObject);
procedure OnSrcNotebookFileOpen(Sender: TObject);
procedure OnSrcNotebookFileOpenAtCursor(Sender: TObject);
@ -1355,6 +1356,7 @@ begin
SourceNotebook.OnAddJumpPoint := @OnSrcNoteBookAddJumpPoint;
SourceNotebook.OnCloseClicked := @OnSrcNotebookFileClose;
SourceNotebook.OnCtrlMouseUp := @OnSrcNoteBookCtrlMouseUp;
SourceNotebook.OnCurrentCodeBufferChanged:=@OnSrcNotebookCurCodeBufferChanged;
SourceNotebook.OnDeleteLastJumpPoint := @OnSrcNotebookDeleteLastJumPoint;
SourceNotebook.OnEditorVisibleChanged := @OnSrcNotebookEditorVisibleChanged;
SourceNotebook.OnEditorChanged := @OnSrcNotebookEditorChanged;
@ -10191,6 +10193,12 @@ begin
MainIDEBar.SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSE.Modified;
end;
procedure TMainIDE.OnSrcNotebookCurCodeBufferChanged(Sender: TObject);
begin
if SourceNotebook.Notebook = nil then Exit;
if CodeExplorerView<>nil then CodeExplorerView.CurrentCodeBufferChanged;
end;
procedure TMainIDE.OnSrcNotebookShowHintForSource(SrcEdit: TSourceEditor;
ClientPos: TPoint; CaretPos: TPoint);
var
@ -11265,6 +11273,9 @@ end.
{ =============================================================================
$Log$
Revision 1.815 2005/01/01 16:04:13 mattias
implemented CodeExplorer auto update on switching source editor page
Revision 1.814 2005/01/01 11:32:16 mattias
fixed New dialog getting new item

View File

@ -376,20 +376,22 @@ type
procedure SrcPopUpMenuPopup(Sender: TObject);
Procedure ToggleLineNumbersClicked(Sender: TObject);
private
fAutoFocusLock: integer;
FCodeTemplateModul: TSynEditAutoComplete;
fCustomPopupMenuItems: TList;
fIncrementalSearchStartPos: TPoint;
FIncrementalSearchStr: string;
FKeyStrokes: TSynEditKeyStrokes;
FProcessingCommand: boolean;
FSourceEditorList: TList; // list of TSourceEditor
FLastCodeBuffer: TCodeBuffer;
FOnAddJumpPoint: TOnAddJumpPoint;
FOnAddWatchAtCursor: TOnAddWatch;
FOnCloseClicked: TNotifyEvent;
FOnCtrlMouseUp: TMouseEvent;
FOnCurrentCodeBufferChanged: TNotifyEvent;
FOnDeleteLastJumpPoint: TNotifyEvent;
FOnEditorVisibleChanged: TNotifyEvent;
FOnEditorChanged: TNotifyEvent;
FOnEditorPropertiesClicked: TNotifyEvent;
FOnEditorVisibleChanged: TNotifyEvent;
FOnFindDeclarationClicked: TNotifyEvent;
FOnInitIdentCompletion: TOnInitIdentCompletion;
FOnJumpToHistoryPoint: TOnJumpToHistoryPoint;
@ -398,11 +400,14 @@ type
FOnProcessUserCommand: TOnProcessUserCommand;
fOnReadOnlyChanged: TNotifyEvent;
FOnShowHintForSource: TOnShowHintForSource;
FOnShowSearchResultsView: TNotifyEvent;
FOnShowUnitInfo: TNotifyEvent;
FOnToggleFormUnitClicked: TNotifyEvent;
FOnToggleObjectInspClicked: TNotifyEvent;
FOnUserCommandProcessed: TOnProcessUserCommand;
FOnViewJumpHistory: TNotifyEvent;
FProcessingCommand: boolean;
FSourceEditorList: TList; // list of TSourceEditor
FUnUsedEditorComponents: TList; // list of TSynEdit
private
// colors for the completion form (popup form, e.g. word completion)
@ -415,10 +420,6 @@ type
FActiveEditSymbolFGColor: TColor;
FActiveEditSymbolBGColor: TColor;
fAutoFocusLock: integer;
fCustomPopupMenuItems: TList;
FOnShowSearchResultsView: TNotifyEvent;
// PopupMenu
Procedure BuildPopupMenu;
procedure RemoveUserDefinedMenuItems;
@ -503,6 +504,7 @@ type
function FindSourceEditorWithFilename(const Filename: string): TSourceEditor;
Function GetActiveSE: TSourceEditor;
procedure SetActiveSE(SrcEdit: TSourceEditor);
procedure CheckCurrentCodeBufferChanged;
procedure LockAllEditorsInSourceChangeCache;
procedure UnlockAllEditorsInSourceChangeCache;
@ -582,7 +584,6 @@ type
procedure FindReplaceDlgKey(Sender: TObject; var Key: Word;
Shift:TShiftState; FindDlgComponent: TFindDlgComponent);
published
property OnAddJumpPoint: TOnAddJumpPoint
read FOnAddJumpPoint write FOnAddJumpPoint;
@ -598,6 +599,8 @@ type
read FOnEditorChanged write FOnEditorChanged;
property OnEditorPropertiesClicked: TNotifyEvent
read FOnEditorPropertiesClicked write FOnEditorPropertiesClicked;
property OnCurrentCodeBufferChanged: TNotifyEvent
read FOnCurrentCodeBufferChanged write FOnCurrentCodeBufferChanged;
property OnFindDeclarationClicked: TNotifyEvent
read FOnFindDeclarationClicked write FOnFindDeclarationClicked;
property OnInitIdentCompletion: TOnInitIdentCompletion
@ -3267,6 +3270,17 @@ begin
NoteBook.PageIndex:=i;
end;
procedure TSourceNotebook.CheckCurrentCodeBufferChanged;
var
SrcEdit: TSourceEditor;
begin
SrcEdit:=GetActiveSE;
if FLastCodeBuffer=SrcEdit.CodeBuffer then exit;
FLastCodeBuffer:=SrcEdit.CodeBuffer;
if Assigned(OnCurrentCodeBufferChanged) then
OnCurrentCodeBufferChanged(Self);
end;
procedure TSourceNotebook.LockAllEditorsInSourceChangeCache;
// lock all sourceeditors that are to be modified by the CodeToolBoss
var i: integer;
@ -4304,6 +4318,7 @@ Begin
UpdateActiveEditColors;
if Assigned(FOnEditorVisibleChanged) then
FOnEditorVisibleChanged(sender);
CheckCurrentCodeBufferChanged;
end;
end;

View File

@ -2946,6 +2946,7 @@ end;
function TGtkWidgetSet.EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean;
begin
Assert(False, Format('Trace: [TGtkWidgetSet.EnableWindow] hWnd: 0x%x, Enable: %s', [hwnd, BOOL_TEXT[bEnable]]));
if hWnd <> 0 then
gtk_widget_set_sensitive(pgtkwidget(hWnd), bEnable);
Result:=true;
@ -8810,6 +8811,9 @@ end;
{ =============================================================================
$Log$
Revision 1.381 2005/01/01 16:04:13 mattias
implemented CodeExplorer auto update on switching source editor page
Revision 1.380 2004/12/22 19:56:44 mattias
started TFont mirgration to fpCanvas font