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

View File

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

View File

@ -298,6 +298,7 @@ type
procedure OnSrcNotebookDeleteLastJumPoint(Sender: TObject); procedure OnSrcNotebookDeleteLastJumPoint(Sender: TObject);
procedure OnSrcNotebookEditorVisibleChanged(Sender: TObject); procedure OnSrcNotebookEditorVisibleChanged(Sender: TObject);
procedure OnSrcNotebookEditorChanged(Sender: TObject); procedure OnSrcNotebookEditorChanged(Sender: TObject);
procedure OnSrcNotebookCurCodeBufferChanged(Sender: TObject);
procedure OnSrcNotebookFileNew(Sender: TObject); procedure OnSrcNotebookFileNew(Sender: TObject);
procedure OnSrcNotebookFileOpen(Sender: TObject); procedure OnSrcNotebookFileOpen(Sender: TObject);
procedure OnSrcNotebookFileOpenAtCursor(Sender: TObject); procedure OnSrcNotebookFileOpenAtCursor(Sender: TObject);
@ -1355,6 +1356,7 @@ begin
SourceNotebook.OnAddJumpPoint := @OnSrcNoteBookAddJumpPoint; SourceNotebook.OnAddJumpPoint := @OnSrcNoteBookAddJumpPoint;
SourceNotebook.OnCloseClicked := @OnSrcNotebookFileClose; SourceNotebook.OnCloseClicked := @OnSrcNotebookFileClose;
SourceNotebook.OnCtrlMouseUp := @OnSrcNoteBookCtrlMouseUp; SourceNotebook.OnCtrlMouseUp := @OnSrcNoteBookCtrlMouseUp;
SourceNotebook.OnCurrentCodeBufferChanged:=@OnSrcNotebookCurCodeBufferChanged;
SourceNotebook.OnDeleteLastJumpPoint := @OnSrcNotebookDeleteLastJumPoint; SourceNotebook.OnDeleteLastJumpPoint := @OnSrcNotebookDeleteLastJumPoint;
SourceNotebook.OnEditorVisibleChanged := @OnSrcNotebookEditorVisibleChanged; SourceNotebook.OnEditorVisibleChanged := @OnSrcNotebookEditorVisibleChanged;
SourceNotebook.OnEditorChanged := @OnSrcNotebookEditorChanged; SourceNotebook.OnEditorChanged := @OnSrcNotebookEditorChanged;
@ -10191,6 +10193,12 @@ begin
MainIDEBar.SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSE.Modified; MainIDEBar.SaveSpeedBtn.Enabled := SourceNotebook.GetActiveSE.Modified;
end; 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; procedure TMainIDE.OnSrcNotebookShowHintForSource(SrcEdit: TSourceEditor;
ClientPos: TPoint; CaretPos: TPoint); ClientPos: TPoint; CaretPos: TPoint);
var var
@ -11265,6 +11273,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.814 2005/01/01 11:32:16 mattias
fixed New dialog getting new item fixed New dialog getting new item

View File

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

View File

@ -2946,6 +2946,7 @@ end;
function TGtkWidgetSet.EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean; function TGtkWidgetSet.EnableWindow(hWnd: HWND; bEnable: Boolean): Boolean;
begin begin
Assert(False, Format('Trace: [TGtkWidgetSet.EnableWindow] hWnd: 0x%x, Enable: %s', [hwnd, BOOL_TEXT[bEnable]])); Assert(False, Format('Trace: [TGtkWidgetSet.EnableWindow] hWnd: 0x%x, Enable: %s', [hwnd, BOOL_TEXT[bEnable]]));
if hWnd <> 0 then if hWnd <> 0 then
gtk_widget_set_sensitive(pgtkwidget(hWnd), bEnable); gtk_widget_set_sensitive(pgtkwidget(hWnd), bEnable);
Result:=true; Result:=true;
@ -8810,6 +8811,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.380 2004/12/22 19:56:44 mattias
started TFont mirgration to fpCanvas font started TFont mirgration to fpCanvas font