mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 10:39:30 +02:00
implemented dynamic menu item in MenuIntf, Source Editor now uses the menuintf
git-svn-id: trunk@7616 -
This commit is contained in:
parent
a2253ceb2e
commit
ff7171bad0
@ -255,8 +255,7 @@ end;
|
|||||||
|
|
||||||
procedure TCodeExplorerView.CodeExplorerViewDestroy(Sender: TObject);
|
procedure TCodeExplorerView.CodeExplorerViewDestroy(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
debugln('TCodeExplorerView.CodeExplorerViewDestroy');
|
//debugln('TCodeExplorerView.CodeExplorerViewDestroy');
|
||||||
CodeExplorerMenuRoot.MenuItem:=nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodeExplorerView.CodeExplorerViewRESIZE(Sender: TObject);
|
procedure TCodeExplorerView.CodeExplorerViewRESIZE(Sender: TObject);
|
||||||
|
@ -41,7 +41,9 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, SysUtils, Forms, Controls, Dialogs, Menus, FileUtil, LCLProc,
|
Classes, SysUtils, Forms, Controls, Dialogs, Menus, FileUtil, LCLProc,
|
||||||
Laz_XMLCfg,
|
Laz_XMLCfg,
|
||||||
SynEdit, CodeCache, CodeToolManager, LazConf, DebugOptionsFrm,
|
SynEdit, CodeCache, CodeToolManager,
|
||||||
|
MenuIntf,
|
||||||
|
LazConf, DebugOptionsFrm,
|
||||||
CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, UnitEditor,
|
CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, UnitEditor,
|
||||||
Project, IDEProcs, InputHistory, Debugger,
|
Project, IDEProcs, InputHistory, Debugger,
|
||||||
IDEOptionDefs, LazarusIDEStrConsts,
|
IDEOptionDefs, LazarusIDEStrConsts,
|
||||||
|
@ -332,7 +332,7 @@ type
|
|||||||
procedure OnSrcNotebookToggleObjectInsp(Sender: TObject);
|
procedure OnSrcNotebookToggleObjectInsp(Sender: TObject);
|
||||||
procedure OnSrcNotebookViewJumpHistory(Sender: TObject);
|
procedure OnSrcNotebookViewJumpHistory(Sender: TObject);
|
||||||
procedure OnSrcNotebookShowSearchResultsView(Sender: TObject);
|
procedure OnSrcNotebookShowSearchResultsView(Sender: TObject);
|
||||||
procedure OnSrcNoteBookPopupMenu(AddMenuItemProc: TAddMenuItemProc);
|
procedure OnSrcNoteBookPopupMenu(const AddMenuItemProc: TAddMenuItemProc);
|
||||||
|
|
||||||
// ObjectInspector + PropertyEditorHook events
|
// ObjectInspector + PropertyEditorHook events
|
||||||
procedure OIOnSelectPersistents(Sender: TObject);
|
procedure OIOnSelectPersistents(Sender: TObject);
|
||||||
@ -11214,7 +11214,8 @@ begin
|
|||||||
CreateSearchResultWindow;
|
CreateSearchResultWindow;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OnSrcNoteBookPopupMenu(AddMenuItemProc: TAddMenuItemProc);
|
procedure TMainIDE.OnSrcNoteBookPopupMenu(
|
||||||
|
const AddMenuItemProc: TAddMenuItemProc);
|
||||||
begin
|
begin
|
||||||
PkgBoss.OnSourceEditorPopupMenu(AddMenuItemProc);
|
PkgBoss.OnSourceEditorPopupMenu(AddMenuItemProc);
|
||||||
end;
|
end;
|
||||||
|
@ -208,7 +208,6 @@ begin
|
|||||||
ClearItems;
|
ClearItems;
|
||||||
FreeThenNil(FItems);
|
FreeThenNil(FItems);
|
||||||
FreeThenNil(FVisibleItems);
|
FreeThenNil(FVisibleItems);
|
||||||
MessagesMenuRoot.MenuItem:=nil;
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -49,9 +49,6 @@ type
|
|||||||
|
|
||||||
TGetSourceMarkHintEvent =
|
TGetSourceMarkHintEvent =
|
||||||
procedure(SenderMark: TSourceMark; var Hint: string) of object;
|
procedure(SenderMark: TSourceMark; var Hint: string) of object;
|
||||||
TAddMenuItemProc =
|
|
||||||
function (const NewCaption: string; const NewEnabled: boolean;
|
|
||||||
const NewOnClick: TNotifyEvent): TMenuItem of object;
|
|
||||||
TCreateSourceMarkPopupMenuEvent =
|
TCreateSourceMarkPopupMenuEvent =
|
||||||
procedure(SenderMark: TSourceMark;
|
procedure(SenderMark: TSourceMark;
|
||||||
const AddMenuItem: TAddMenuItemProc) of object;
|
const AddMenuItem: TAddMenuItemProc) of object;
|
||||||
@ -98,7 +95,7 @@ type
|
|||||||
ALine: integer): integer;
|
ALine: integer): integer;
|
||||||
function GetFilename: string;
|
function GetFilename: string;
|
||||||
function GetHint: string; virtual;
|
function GetHint: string; virtual;
|
||||||
procedure CreatePopupMenuItems(AddMenuItemProc: TAddMenuItemProc);
|
procedure CreatePopupMenuItems(const AddMenuItemProc: TAddMenuItemProc);
|
||||||
public
|
public
|
||||||
// handlers
|
// handlers
|
||||||
procedure RemoveAllHandlersForObject(HandlerObject: TObject);
|
procedure RemoveAllHandlersForObject(HandlerObject: TObject);
|
||||||
@ -392,7 +389,8 @@ begin
|
|||||||
TGetSourceMarkHintEvent(FHandlers[smhGetHint][i])(Self,Result);
|
TGetSourceMarkHintEvent(FHandlers[smhGetHint][i])(Self,Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceMark.CreatePopupMenuItems(AddMenuItemProc: TAddMenuItemProc);
|
procedure TSourceMark.CreatePopupMenuItems(
|
||||||
|
const AddMenuItemProc: TAddMenuItemProc);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
@ -325,7 +325,7 @@ type
|
|||||||
CaretPos: TPoint) of object;
|
CaretPos: TPoint) of object;
|
||||||
TOnInitIdentCompletion = procedure(Sender: TObject; JumpToError: boolean;
|
TOnInitIdentCompletion = procedure(Sender: TObject; JumpToError: boolean;
|
||||||
out Handled, Abort: boolean) of object;
|
out Handled, Abort: boolean) of object;
|
||||||
TSrcEditPopupMenuEvent = procedure(AddMenuItemProc: TAddMenuItemProc
|
TSrcEditPopupMenuEvent = procedure(const AddMenuItemProc: TAddMenuItemProc
|
||||||
) of object;
|
) of object;
|
||||||
TOnShowCodeContext = procedure(JumpToError: boolean;
|
TOnShowCodeContext = procedure(JumpToError: boolean;
|
||||||
out Abort: boolean) of object;
|
out Abort: boolean) of object;
|
||||||
@ -408,8 +408,10 @@ type
|
|||||||
private
|
private
|
||||||
fAutoFocusLock: integer;
|
fAutoFocusLock: integer;
|
||||||
FCodeTemplateModul: TSynEditAutoComplete;
|
FCodeTemplateModul: TSynEditAutoComplete;
|
||||||
|
{$IFDEF DisableMenuIntf}
|
||||||
fCustomPopupMenuItems: TList;
|
fCustomPopupMenuItems: TList;
|
||||||
fContextPopupMenuItems: TList;
|
fContextPopupMenuItems: TList;
|
||||||
|
{$ENDIF}
|
||||||
fIdentCompletionJumpToError: boolean;
|
fIdentCompletionJumpToError: boolean;
|
||||||
FIncrementalSearchPos: TPoint; // last set position
|
FIncrementalSearchPos: TPoint; // last set position
|
||||||
fIncrementalSearchStartPos: TPoint; // position where to start searching
|
fIncrementalSearchStartPos: TPoint; // position where to start searching
|
||||||
@ -461,11 +463,11 @@ type
|
|||||||
procedure RemoveUserDefinedMenuItems;
|
procedure RemoveUserDefinedMenuItems;
|
||||||
function AddUserDefinedPopupMenuItem(const NewCaption: string;
|
function AddUserDefinedPopupMenuItem(const NewCaption: string;
|
||||||
const NewEnabled: boolean;
|
const NewEnabled: boolean;
|
||||||
const NewOnClick: TNotifyEvent): TMenuItem;
|
const NewOnClick: TNotifyEvent): TIDEMenuItem;
|
||||||
procedure RemoveContextMenuItems;
|
procedure RemoveContextMenuItems;
|
||||||
function AddContextPopupMenuItem(const NewCaption: string;
|
function AddContextPopupMenuItem(const NewCaption: string;
|
||||||
const NewEnabled: boolean;
|
const NewEnabled: boolean;
|
||||||
const NewOnClick: TNotifyEvent): TMenuItem;
|
const NewOnClick: TNotifyEvent): TIDEMenuItem;
|
||||||
|
|
||||||
procedure UpdateActiveEditColors;
|
procedure UpdateActiveEditColors;
|
||||||
procedure SetIncrementalSearchStr(const AValue: string);
|
procedure SetIncrementalSearchStr(const AValue: string);
|
||||||
@ -2484,10 +2486,6 @@ destructor TSourceNotebook.Destroy;
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
{$IFDEF UseMenuIntf}
|
|
||||||
SourceEditorMenuRoot.MenuItem:=nil;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
FProcessingCommand:=false;
|
FProcessingCommand:=false;
|
||||||
for i:=FSourceEditorList.Count-1 downto 0 do
|
for i:=FSourceEditorList.Count-1 downto 0 do
|
||||||
Editors[i].Free;
|
Editors[i].Free;
|
||||||
@ -2504,8 +2502,10 @@ begin
|
|||||||
FreeThenNil(aCompletion);
|
FreeThenNil(aCompletion);
|
||||||
FreeThenNil(FHintTimer);
|
FreeThenNil(FHintTimer);
|
||||||
FreeThenNil(FHintWindow);
|
FreeThenNil(FHintWindow);
|
||||||
|
{$IFDEF DisableMenuIntf}
|
||||||
FreeThenNil(fCustomPopupMenuItems);
|
FreeThenNil(fCustomPopupMenuItems);
|
||||||
FreeThenNil(fContextPopupMenuItems);
|
FreeThenNil(fContextPopupMenuItems);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
@ -3058,7 +3058,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.SrcPopUpMenuPopup(Sender: TObject);
|
procedure TSourceNotebook.SrcPopUpMenuPopup(Sender: TObject);
|
||||||
{$IFDEF UseMenuIntf}
|
{$IFNDEF DisableMenuIntf}
|
||||||
var
|
var
|
||||||
ASrcEdit: TSourceEditor;
|
ASrcEdit: TSourceEditor;
|
||||||
BookMarkID, BookMarkX, BookMarkY: integer;
|
BookMarkID, BookMarkX, BookMarkY: integer;
|
||||||
@ -3076,8 +3076,8 @@ var
|
|||||||
SelAvailAndWritable: Boolean;
|
SelAvailAndWritable: Boolean;
|
||||||
CurFilename: String;
|
CurFilename: String;
|
||||||
begin
|
begin
|
||||||
//RemoveUserDefinedMenuItems;
|
RemoveUserDefinedMenuItems;
|
||||||
//RemoveContextMenuItems;
|
RemoveContextMenuItems;
|
||||||
|
|
||||||
ASrcEdit:=
|
ASrcEdit:=
|
||||||
FindSourceEditorWithEditorComponent(TPopupMenu(Sender).PopupComponent);
|
FindSourceEditorWithEditorComponent(TPopupMenu(Sender).PopupComponent);
|
||||||
@ -3135,14 +3135,14 @@ begin
|
|||||||
if Marks<>nil then begin
|
if Marks<>nil then begin
|
||||||
for i:=0 to MarkCount-1 do begin
|
for i:=0 to MarkCount-1 do begin
|
||||||
CurMark:=Marks[i];
|
CurMark:=Marks[i];
|
||||||
//CurMark.CreatePopupMenuItems(@AddUserDefinedPopupMenuItem);
|
CurMark.CreatePopupMenuItems(@AddUserDefinedPopupMenuItem);
|
||||||
end;
|
end;
|
||||||
FreeMem(Marks);
|
FreeMem(Marks);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// add context specific menu items
|
// add context specific menu items
|
||||||
{CurFilename:=ASrcEdit.FileName;
|
CurFilename:=ASrcEdit.FileName;
|
||||||
if FilenameIsPascalUnit(CurFilename)
|
if FilenameIsPascalUnit(CurFilename)
|
||||||
and (FilenameIsAbsolute(CurFilename)) then begin
|
and (FilenameIsAbsolute(CurFilename)) then begin
|
||||||
if FileExists(ChangeFileExt(CurFilename,'.lfm')) then
|
if FileExists(ChangeFileExt(CurFilename,'.lfm')) then
|
||||||
@ -3164,7 +3164,7 @@ begin
|
|||||||
AddContextPopupMenuItem(
|
AddContextPopupMenuItem(
|
||||||
'Open '+ChangeFileExt(ExtractFileName(CurFilename),'.pp'),
|
'Open '+ChangeFileExt(ExtractFileName(CurFilename),'.pp'),
|
||||||
true,@OnPopupMenuOpenPPFile);
|
true,@OnPopupMenuOpenPPFile);
|
||||||
end;}
|
end;
|
||||||
|
|
||||||
//if Assigned(OnPopupMenu) then OnPopupMenu(@AddContextPopupMenuItem);
|
//if Assigned(OnPopupMenu) then OnPopupMenu(@AddContextPopupMenuItem);
|
||||||
end;
|
end;
|
||||||
@ -3316,11 +3316,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceNotebook.BuildPopupMenu;
|
Procedure TSourceNotebook.BuildPopupMenu;
|
||||||
{$IFDEF UseMenuIntf}
|
{$IFNDEF DisableMenuIntf}
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
debugln('TSourceNotebook.BuildPopupMenu');
|
//debugln('TSourceNotebook.BuildPopupMenu');
|
||||||
|
|
||||||
SrcPopupMenu := TPopupMenu.Create(Self);
|
SrcPopupMenu := TPopupMenu.Create(Self);
|
||||||
with SrcPopupMenu do begin
|
with SrcPopupMenu do begin
|
||||||
@ -3330,8 +3330,11 @@ begin
|
|||||||
|
|
||||||
// assign the root TMenuItem to the registered menu root.
|
// assign the root TMenuItem to the registered menu root.
|
||||||
// This will automatically create all registered items
|
// This will automatically create all registered items
|
||||||
SourceEditorMenuRoot.MenuItem:=SrcPopupMenu.Items;
|
{$IFDEF VerboseMenuIntf}
|
||||||
SrcPopupMenu.Items.WriteDebugReport('TSourceNotebook.BuildPopupMenu ');
|
SrcPopupMenu.Items.WriteDebugReport('TSourceNotebook.BuildPopupMenu ');
|
||||||
|
SourceEditorMenuRoot.ConsistencyCheck;
|
||||||
|
{$ENDIF}
|
||||||
|
SourceEditorMenuRoot.MenuItem:=SrcPopupMenu.Items;
|
||||||
|
|
||||||
SrcEditMenuFindDeclaration.OnClickMethod:=@FindDeclarationClicked;
|
SrcEditMenuFindDeclaration.OnClickMethod:=@FindDeclarationClicked;
|
||||||
SrcEditMenuOpenFileAtCursor.OnClickMethod:=@OpenAtCursorClicked;
|
SrcEditMenuOpenFileAtCursor.OnClickMethod:=@OpenAtCursorClicked;
|
||||||
@ -3671,6 +3674,11 @@ end;
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TSourceNotebook.RemoveUserDefinedMenuItems;
|
procedure TSourceNotebook.RemoveUserDefinedMenuItems;
|
||||||
|
{$IFNDEF DisableMenuIntf}
|
||||||
|
begin
|
||||||
|
SrcEditMenuSectionFirstDynamic.Clear;
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
var
|
var
|
||||||
AMenuItem: TMenuItem;
|
AMenuItem: TMenuItem;
|
||||||
begin
|
begin
|
||||||
@ -3681,9 +3689,17 @@ begin
|
|||||||
fCustomPopupMenuItems.Delete(fCustomPopupMenuItems.Count-1);
|
fCustomPopupMenuItems.Delete(fCustomPopupMenuItems.Count-1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function TSourceNotebook.AddUserDefinedPopupMenuItem(const NewCaption: string;
|
function TSourceNotebook.AddUserDefinedPopupMenuItem(const NewCaption: string;
|
||||||
const NewEnabled: boolean; const NewOnClick: TNotifyEvent): TMenuItem;
|
const NewEnabled: boolean; const NewOnClick: TNotifyEvent): TIDEMenuItem;
|
||||||
|
{$IFNDEF DisableMenuIntf}
|
||||||
|
begin
|
||||||
|
Result:=RegisterIDEMenuCommand(SrcEditMenuSectionFirstDynamic.GetPath,
|
||||||
|
'Dynamic',NewCaption,NewOnClick);
|
||||||
|
Result.Enabled:=NewEnabled;
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
var
|
var
|
||||||
NewIndex: Integer;
|
NewIndex: Integer;
|
||||||
begin
|
begin
|
||||||
@ -3696,8 +3712,17 @@ begin
|
|||||||
Result.OnClick:=NewOnClick;
|
Result.OnClick:=NewOnClick;
|
||||||
SrcPopUpMenu.Items.Insert(NewIndex,Result);
|
SrcPopUpMenu.Items.Insert(NewIndex,Result);
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TSourceNotebook.RemoveContextMenuItems;
|
procedure TSourceNotebook.RemoveContextMenuItems;
|
||||||
|
{$IFNDEF DisableMenuIntf}
|
||||||
|
begin
|
||||||
|
SrcEditMenuSectionFileDynamic.Clear;
|
||||||
|
{$IFDEF VerboseMenuIntf}
|
||||||
|
SrcEditMenuSectionFileDynamic.WriteDebugReport('TSourceNotebook.RemoveContextMenuItems ');
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
var
|
var
|
||||||
AMenuItem: TMenuItem;
|
AMenuItem: TMenuItem;
|
||||||
begin
|
begin
|
||||||
@ -3708,9 +3733,17 @@ begin
|
|||||||
fContextPopupMenuItems.Delete(fContextPopupMenuItems.Count-1);
|
fContextPopupMenuItems.Delete(fContextPopupMenuItems.Count-1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function TSourceNotebook.AddContextPopupMenuItem(const NewCaption: string;
|
function TSourceNotebook.AddContextPopupMenuItem(const NewCaption: string;
|
||||||
const NewEnabled: boolean; const NewOnClick: TNotifyEvent): TMenuItem;
|
const NewEnabled: boolean; const NewOnClick: TNotifyEvent): TIDEMenuItem;
|
||||||
|
{$IFNDEF DisableMenuIntf}
|
||||||
|
begin
|
||||||
|
Result:=RegisterIDEMenuCommand(SrcEditMenuSectionFileDynamic.GetPath,
|
||||||
|
'FileDynamic',NewCaption,NewOnClick);
|
||||||
|
Result.Enabled:=NewEnabled;
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
var
|
var
|
||||||
NewIndex: Integer;
|
NewIndex: Integer;
|
||||||
begin
|
begin
|
||||||
@ -3730,6 +3763,7 @@ begin
|
|||||||
NewIndex:=fContextPopupMenuItems.Count+ClosePageMenuItem.MenuIndex;
|
NewIndex:=fContextPopupMenuItems.Count+ClosePageMenuItem.MenuIndex;
|
||||||
SrcPopUpMenu.Items.Insert(NewIndex,Result);
|
SrcPopUpMenu.Items.Insert(NewIndex,Result);
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
Procedure TSourceNotebook.EditorChanged
|
Procedure TSourceNotebook.EditorChanged
|
||||||
|
@ -33,11 +33,13 @@ uses
|
|||||||
IDECommands;
|
IDECommands;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TIDEMenuItem = class;
|
||||||
|
TIDEMenuSection = class;
|
||||||
|
|
||||||
TAddMenuItemProc =
|
TAddMenuItemProc =
|
||||||
function (const NewCaption: string; const NewEnabled: boolean;
|
function (const NewCaption: string; const NewEnabled: boolean;
|
||||||
const NewOnClick: TNotifyEvent): TMenuItem of object;
|
const NewOnClick: TNotifyEvent): TIDEMenuItem of object;
|
||||||
|
|
||||||
TIDEMenuSection = class;
|
|
||||||
TNotifyProcedure = procedure(Sender: TObject);
|
TNotifyProcedure = procedure(Sender: TObject);
|
||||||
|
|
||||||
{ TIDEMenuItem
|
{ TIDEMenuItem
|
||||||
@ -48,6 +50,7 @@ type
|
|||||||
|
|
||||||
TIDEMenuItem = class(TPersistent)
|
TIDEMenuItem = class(TPersistent)
|
||||||
private
|
private
|
||||||
|
FAutoFreeMenuItem: boolean;
|
||||||
FBitmap: TBitmap;
|
FBitmap: TBitmap;
|
||||||
FCaption: string;
|
FCaption: string;
|
||||||
FEnabled: Boolean;
|
FEnabled: Boolean;
|
||||||
@ -62,7 +65,9 @@ type
|
|||||||
FSectionIndex: Integer;
|
FSectionIndex: Integer;
|
||||||
FSize: integer;
|
FSize: integer;
|
||||||
FVisible: Boolean;
|
FVisible: Boolean;
|
||||||
|
FLastVisibleActive: boolean;
|
||||||
procedure MenuItemClick(Sender: TObject);
|
procedure MenuItemClick(Sender: TObject);
|
||||||
|
procedure MenuItemDestroy(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
function GetBitmap: TBitmap; virtual;
|
function GetBitmap: TBitmap; virtual;
|
||||||
function GetCaption: string; virtual;
|
function GetCaption: string; virtual;
|
||||||
@ -87,6 +92,8 @@ type
|
|||||||
function GetContainerSection: TIDEMenuSection;
|
function GetContainerSection: TIDEMenuSection;
|
||||||
function GetContainerMenuItem: TMenuItem;
|
function GetContainerMenuItem: TMenuItem;
|
||||||
function Size: integer; virtual;
|
function Size: integer; virtual;
|
||||||
|
procedure WriteDebugReport(const Prefix: string); virtual;
|
||||||
|
procedure ConsistencyCheck; virtual;
|
||||||
public
|
public
|
||||||
property Name: string read FName write SetName;
|
property Name: string read FName write SetName;
|
||||||
property Bitmap: TBitmap read GetBitmap write SetBitmap;
|
property Bitmap: TBitmap read GetBitmap write SetBitmap;
|
||||||
@ -101,6 +108,7 @@ type
|
|||||||
property MenuItem: TMenuItem read FMenuItem write SetMenuItem;
|
property MenuItem: TMenuItem read FMenuItem write SetMenuItem;
|
||||||
property MenuItemClass: TMenuItemClass read FMenuItemClass write FMenuItemClass;
|
property MenuItemClass: TMenuItemClass read FMenuItemClass write FMenuItemClass;
|
||||||
property SectionIndex: Integer read FSectionIndex;
|
property SectionIndex: Integer read FSectionIndex;
|
||||||
|
property AutoFreeMenuItem: boolean read FAutoFreeMenuItem write FAutoFreeMenuItem;
|
||||||
end;
|
end;
|
||||||
TIDEMenuItemClass = class of TIDEMenuItem;
|
TIDEMenuItemClass = class of TIDEMenuItem;
|
||||||
|
|
||||||
@ -130,9 +138,12 @@ type
|
|||||||
FTopSeparator: TMenuItem;
|
FTopSeparator: TMenuItem;
|
||||||
FChildMenuItemsCreated: boolean;
|
FChildMenuItemsCreated: boolean;
|
||||||
FVisibleCount: integer;
|
FVisibleCount: integer;
|
||||||
FInvalidChildVisibility: Integer;
|
FInvalidChildStartIndex: Integer;
|
||||||
|
FInvalidChildEndIndex: Integer;
|
||||||
FUpdateLock: Integer;
|
FUpdateLock: Integer;
|
||||||
function GetItems(Index: Integer): TIDEMenuItem;
|
function GetItems(Index: Integer): TIDEMenuItem;
|
||||||
|
procedure SeparatorDestroy(Sender : TObject);
|
||||||
|
procedure FreeSeparators;
|
||||||
protected
|
protected
|
||||||
procedure SetMenuItem(const AValue: TMenuItem); override;
|
procedure SetMenuItem(const AValue: TMenuItem); override;
|
||||||
procedure SetChildsAsSubMenu(const AValue: boolean); virtual;
|
procedure SetChildsAsSubMenu(const AValue: boolean); virtual;
|
||||||
@ -142,6 +153,7 @@ type
|
|||||||
procedure UpdateChildsIndex(StartIndex: Integer);
|
procedure UpdateChildsIndex(StartIndex: Integer);
|
||||||
procedure UpdateMenuStructure;
|
procedure UpdateMenuStructure;
|
||||||
procedure UpdateSize(Diff: integer);
|
procedure UpdateSize(Diff: integer);
|
||||||
|
procedure Invalidate(FromIndex, ToIndex: integer);
|
||||||
public
|
public
|
||||||
constructor Create(const TheName: string); override;
|
constructor Create(const TheName: string); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -162,6 +174,8 @@ type
|
|||||||
function Size: integer; override;
|
function Size: integer; override;
|
||||||
procedure BeginUpdate;
|
procedure BeginUpdate;
|
||||||
procedure EndUpdate;
|
procedure EndUpdate;
|
||||||
|
procedure WriteDebugReport(const Prefix: string); override;
|
||||||
|
procedure ConsistencyCheck; override;
|
||||||
public
|
public
|
||||||
property ChildsAsSubMenu: boolean read FChildsAsSubMenu
|
property ChildsAsSubMenu: boolean read FChildsAsSubMenu
|
||||||
write SetChildsAsSubMenu default true;
|
write SetChildsAsSubMenu default true;
|
||||||
@ -353,10 +367,18 @@ begin
|
|||||||
if Assigned(OnClickProc) then OnClickProc(Sender);
|
if Assigned(OnClickProc) then OnClickProc(Sender);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDEMenuItem.MenuItemDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FMenuItem:=nil;
|
||||||
|
FAutoFreeMenuItem:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIDEMenuItem.SetEnabled(const AValue: Boolean);
|
procedure TIDEMenuItem.SetEnabled(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if FEnabled=AValue then exit;
|
if FEnabled=AValue then exit;
|
||||||
FEnabled:=AValue;
|
FEnabled:=AValue;
|
||||||
|
if MenuItem<>nil then
|
||||||
|
MenuItem.Enabled:=Enabled;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEMenuItem.GetBitmap: TBitmap;
|
function TIDEMenuItem.GetBitmap: TBitmap;
|
||||||
@ -417,8 +439,12 @@ procedure TIDEMenuItem.SetMenuItem(const AValue: TMenuItem);
|
|||||||
begin
|
begin
|
||||||
if FMenuItem=AValue then exit;
|
if FMenuItem=AValue then exit;
|
||||||
if FMenuItem<>nil then ClearMenuItems;
|
if FMenuItem<>nil then ClearMenuItems;
|
||||||
if FMenuItem=nil then
|
if FMenuItem=nil then begin
|
||||||
FMenuItem:=AValue;
|
FMenuItem:=AValue;
|
||||||
|
AutoFreeMenuItem:=false;
|
||||||
|
if MenuItem<>nil then
|
||||||
|
MenuItem.AddHandlerOnDestroy(@MenuItemDestroy);
|
||||||
|
end;
|
||||||
if MenuItem<>nil then begin
|
if MenuItem<>nil then begin
|
||||||
MenuItem.Caption:=Caption;
|
MenuItem.Caption:=Caption;
|
||||||
MenuItem.Bitmap:=FBitmap;
|
MenuItem.Bitmap:=FBitmap;
|
||||||
@ -464,7 +490,10 @@ end;
|
|||||||
|
|
||||||
procedure TIDEMenuItem.ClearMenuItems;
|
procedure TIDEMenuItem.ClearMenuItems;
|
||||||
begin
|
begin
|
||||||
|
if AutoFreeMenuItem then begin
|
||||||
|
FAutoFreeMenuItem:=false;
|
||||||
FMenuItem.Free;
|
FMenuItem.Free;
|
||||||
|
end;
|
||||||
FMenuItem:=nil;
|
FMenuItem:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -476,6 +505,7 @@ begin
|
|||||||
FEnabled:=true;
|
FEnabled:=true;
|
||||||
FVisible:=true;
|
FVisible:=true;
|
||||||
FMenuItemClass:=TMenuItem;
|
FMenuItemClass:=TMenuItem;
|
||||||
|
FSectionIndex:=-1;
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
//debugln('TIDEMenuItem.Create ',dbgsName(Self),' Name="',Name,'"');
|
//debugln('TIDEMenuItem.Create ',dbgsName(Self),' Name="',Name,'"');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -486,7 +516,12 @@ begin
|
|||||||
if Section<>nil then
|
if Section<>nil then
|
||||||
Section.Remove(Self);
|
Section.Remove(Self);
|
||||||
FreeAndNil(FBitmap);
|
FreeAndNil(FBitmap);
|
||||||
FreeAndNil(FMenuItem);
|
if FMenuItem<>nil then begin
|
||||||
|
if FAutoFreeMenuItem then
|
||||||
|
FreeAndNil(FMenuItem)
|
||||||
|
else
|
||||||
|
FMenuItem.RemoveAllHandlersOfObject(Self);
|
||||||
|
end;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -504,6 +539,8 @@ begin
|
|||||||
//debugln('TIDEMenuItem.CreateMenuItem ',dbgsName(Self),' Name="',Name,'"');
|
//debugln('TIDEMenuItem.CreateMenuItem ',dbgsName(Self),' Name="',Name,'"');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
MenuItem:=MenuItemClass.Create(nil);
|
MenuItem:=MenuItemClass.Create(nil);
|
||||||
|
MenuItem.AddHandlerOnDestroy(@MenuItemDestroy);
|
||||||
|
AutoFreeMenuItem:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEMenuItem.GetPath: string;
|
function TIDEMenuItem.GetPath: string;
|
||||||
@ -551,6 +588,46 @@ begin
|
|||||||
Result:=FSize;
|
Result:=FSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDEMenuItem.WriteDebugReport(const Prefix: string);
|
||||||
|
begin
|
||||||
|
debugln(Prefix,'SectionIndex=',dbgs(SectionIndex),' Name="',DbgStr(Name),'" VisibleActive=',dbgs(VisibleActive));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TIDEMenuItem.ConsistencyCheck;
|
||||||
|
|
||||||
|
procedure RaiseError;
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
s:='TIDEMenuItem.ConsistencyCheck Name="'+Name+'" Caption="'+DbgStr(Caption)+'"';
|
||||||
|
debugln(s);
|
||||||
|
RaiseGDBException(s);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if MenuItem<>nil then begin
|
||||||
|
if MenuItem.HasBitmap<>HasBitmap then
|
||||||
|
RaiseError;
|
||||||
|
if MenuItem.Enabled<>Enabled then
|
||||||
|
RaiseError;
|
||||||
|
if MenuItem.Visible<>Visible then
|
||||||
|
RaiseError;
|
||||||
|
if MenuItem.Caption<>Caption then
|
||||||
|
RaiseError;
|
||||||
|
if MenuItem.ImageIndex<>ImageIndex then
|
||||||
|
RaiseError;
|
||||||
|
if MenuItem.Hint<>Hint then
|
||||||
|
RaiseError;
|
||||||
|
end;
|
||||||
|
if (Section=nil) then begin
|
||||||
|
if SectionIndex<>-1 then
|
||||||
|
RaiseError;
|
||||||
|
end else begin
|
||||||
|
if SectionIndex<0 then
|
||||||
|
RaiseError;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TIDEMenuSection }
|
{ TIDEMenuSection }
|
||||||
|
|
||||||
procedure TIDEMenuSection.SetSubMenuImages(const AValue: TCustomImageList);
|
procedure TIDEMenuSection.SetSubMenuImages(const AValue: TCustomImageList);
|
||||||
@ -565,6 +642,7 @@ procedure TIDEMenuSection.ClearMenuItems;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
FreeSeparators;
|
||||||
for i:=0 to Count-1 do Items[i].ClearMenuItems;
|
for i:=0 to Count-1 do Items[i].ClearMenuItems;
|
||||||
inherited ClearMenuItems;
|
inherited ClearMenuItems;
|
||||||
end;
|
end;
|
||||||
@ -583,6 +661,7 @@ var
|
|||||||
ContainerMenuItem: TMenuItem;
|
ContainerMenuItem: TMenuItem;
|
||||||
ContainerMenuIndex: integer;
|
ContainerMenuIndex: integer;
|
||||||
Item: TIDEMenuItem;
|
Item: TIDEMenuItem;
|
||||||
|
CurSection: TIDEMenuSection;
|
||||||
|
|
||||||
procedure UpdateNeedTopSeparator;
|
procedure UpdateNeedTopSeparator;
|
||||||
// a separator at top is needed, if
|
// a separator at top is needed, if
|
||||||
@ -602,6 +681,7 @@ var
|
|||||||
if Section[i].VisibleActive then begin
|
if Section[i].VisibleActive then begin
|
||||||
// there is a visible menu item in front
|
// there is a visible menu item in front
|
||||||
// => the Top separator is needed
|
// => the Top separator is needed
|
||||||
|
//debugln('TIDEMenuSection.UpdateNeedTopSeparator Name="',Name,'" ItemInFront="',Section[i].Name,'"');
|
||||||
NewNeedTopSeparator:=true;
|
NewNeedTopSeparator:=true;
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
@ -623,12 +703,16 @@ var
|
|||||||
if TopSeparator<>nil then begin
|
if TopSeparator<>nil then begin
|
||||||
// TopSeparator is not needed anymore
|
// TopSeparator is not needed anymore
|
||||||
FreeAndNil(FTopSeparator);
|
FreeAndNil(FTopSeparator);
|
||||||
|
{$IFDEF VerboseMenuIntf}
|
||||||
|
debugln('TIDEMenuSection.UpdateMenuStructure FREE TopSeparator Name="',Name,'"');
|
||||||
|
{$ENDIF}
|
||||||
end else begin
|
end else begin
|
||||||
// TopSeparator is needed
|
// TopSeparator is needed
|
||||||
FTopSeparator:=TMenuItem.Create(nil);
|
FTopSeparator:=TMenuItem.Create(nil);
|
||||||
|
FTopSeparator.AddHandlerOnDestroy(@SeparatorDestroy);
|
||||||
FTopSeparator.Caption:='-';
|
FTopSeparator.Caption:='-';
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.UpdateMenuStructure TopSeparator Name="',Name,'" ContainerMenuIndex=',dbgs(ContainerMenuIndex));
|
debugln('TIDEMenuSection.UpdateNeedTopSeparator CREATE TopSeparator Name="',Name,'" ContainerMenuIndex=',dbgs(ContainerMenuIndex),' ContainerMenuItem.Count=',dbgs(ContainerMenuItem.Count));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
ContainerMenuItem.Insert(ContainerMenuIndex,FTopSeparator);
|
ContainerMenuItem.Insert(ContainerMenuIndex,FTopSeparator);
|
||||||
end;
|
end;
|
||||||
@ -647,6 +731,7 @@ var
|
|||||||
NewNeedBottomSeparator: Boolean;
|
NewNeedBottomSeparator: Boolean;
|
||||||
begin
|
begin
|
||||||
NewNeedBottomSeparator:=false;
|
NewNeedBottomSeparator:=false;
|
||||||
|
//debugln('TIDEMenuSection.UpdateNeedBottomSeparator Name="',Name,'" ChildsAsSubMenu=',dbgs(ChildsAsSubMenu),' Section=',dbgs(Section<>nil),' VisibleActive=',dbgs(VisibleActive));
|
||||||
if (not ChildsAsSubMenu) and (Section<>nil) and VisibleActive then begin
|
if (not ChildsAsSubMenu) and (Section<>nil) and VisibleActive then begin
|
||||||
// check for any visible item in front
|
// check for any visible item in front
|
||||||
i:=SectionIndex+1;
|
i:=SectionIndex+1;
|
||||||
@ -654,10 +739,11 @@ var
|
|||||||
ItemBehind:=Section[i];
|
ItemBehind:=Section[i];
|
||||||
if ItemBehind.VisibleActive then begin
|
if ItemBehind.VisibleActive then begin
|
||||||
// there is a visible menu item behind
|
// there is a visible menu item behind
|
||||||
|
//debugln('TIDEMenuSection.UpdateNeedBottomSeparator Name="',Name,'" ItemBehind="',ItemBehind.Name,'"');
|
||||||
if (ItemBehind is TIDEMenuSection)
|
if (ItemBehind is TIDEMenuSection)
|
||||||
and (not TIDEMenuSection(ItemBehind).ChildsAsSubMenu)
|
and (not TIDEMenuSection(ItemBehind).ChildsAsSubMenu)
|
||||||
then begin
|
then begin
|
||||||
// the visible menu item behind has already a separator
|
// the visible menu item behind will create its own separator
|
||||||
end else begin
|
end else begin
|
||||||
// the Bottom separator is needed
|
// the Bottom separator is needed
|
||||||
NewNeedBottomSeparator:=true;
|
NewNeedBottomSeparator:=true;
|
||||||
@ -667,6 +753,9 @@ var
|
|||||||
inc(i);
|
inc(i);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$IFDEF VerboseMenuIntf}
|
||||||
|
debugln('TIDEMenuSection.UpdateNeedBottomSeparator Name="',Name,'" Need BottomSeparator=',dbgs(NewNeedBottomSeparator));
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
if NewNeedBottomSeparator<>FNeedBottomSeparator then begin
|
if NewNeedBottomSeparator<>FNeedBottomSeparator then begin
|
||||||
FNeedBottomSeparator:=NewNeedBottomSeparator;
|
FNeedBottomSeparator:=NewNeedBottomSeparator;
|
||||||
@ -682,12 +771,16 @@ var
|
|||||||
if BottomSeparator<>nil then begin
|
if BottomSeparator<>nil then begin
|
||||||
// BottomSeparator is not needed anymore
|
// BottomSeparator is not needed anymore
|
||||||
FreeAndNil(FBottomSeparator);
|
FreeAndNil(FBottomSeparator);
|
||||||
|
{$IFDEF VerboseMenuIntf}
|
||||||
|
debugln('TIDEMenuSection.UpdateMenuStructure FREE BottomSeparator Name="',Name,'"');
|
||||||
|
{$ENDIF}
|
||||||
end else begin
|
end else begin
|
||||||
// BottomSeparator is needed
|
// BottomSeparator is needed
|
||||||
FBottomSeparator:=TMenuItem.Create(nil);
|
FBottomSeparator:=TMenuItem.Create(nil);
|
||||||
|
FBottomSeparator.AddHandlerOnDestroy(@SeparatorDestroy);
|
||||||
FBottomSeparator.Caption:='-';
|
FBottomSeparator.Caption:='-';
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.UpdateMenuStructure BottomSeparator Name="',Name,'" ContainerMenuIndex=',dbgs(ContainerMenuIndex));
|
debugln('TIDEMenuSection.UpdateMenuStructure CREATE BottomSeparator Name="',Name,'" ContainerMenuIndex=',dbgs(ContainerMenuIndex),' ContainerMenuItem.Count=',dbgs(ContainerMenuItem.Count));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
ContainerMenuItem.Insert(ContainerMenuIndex,FBottomSeparator);
|
ContainerMenuItem.Insert(ContainerMenuIndex,FBottomSeparator);
|
||||||
end;
|
end;
|
||||||
@ -695,17 +788,18 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (FInvalidChildVisibility>=Count) then exit;
|
if (FInvalidChildStartIndex>FInvalidChildEndIndex) then exit;
|
||||||
if FUpdateLock>0 then begin
|
if FUpdateLock>0 then begin
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
if FInvalidChildStartIndex<0 then FInvalidChildStartIndex:=0;
|
||||||
|
|
||||||
if (Section<>nil) and (not Section.ChildsAsSubMenu)
|
if (Section<>nil) and (not Section.ChildsAsSubMenu)
|
||||||
and (Section.FInvalidChildVisibility<=SectionIndex) then begin
|
and (Section.FInvalidChildStartIndex<=SectionIndex) then begin
|
||||||
// the sections in front need update too
|
// the sections in front need update too
|
||||||
// => start the update in front
|
// => start the update in front
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.UpdateMenuStructure Front Section="',Section.Name,'" Name="',Name,'" Section.FInvalidChildVisibility=',dbgs(Section.FInvalidChildVisibility),' Count=',dbgs(Count),' SectionIndex=',dbgs(SectionIndex));
|
debugln('TIDEMenuSection.UpdateMenuStructure Front Section="',Section.Name,'" Name="',Name,'" Section.Invalid=',dbgs(Section.FInvalidChildStartIndex),'..',dbgs(Section.FInvalidChildEndIndex),' Count=',dbgs(Count),' SectionIndex=',dbgs(SectionIndex));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Section.UpdateMenuStructure;
|
Section.UpdateMenuStructure;
|
||||||
end else begin
|
end else begin
|
||||||
@ -716,36 +810,52 @@ begin
|
|||||||
else
|
else
|
||||||
ContainerMenuIndex:=GetContainerIndex(false);
|
ContainerMenuIndex:=GetContainerIndex(false);
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.UpdateMenuStructure Childs Name="',Name,'" FInvalidChildVisibility=',dbgs(FInvalidChildVisibility),' Count=',dbgs(Count));
|
debugln('TIDEMenuSection.UpdateMenuStructure Childs Name="',Name,'" Invalid=',dbgs(FInvalidChildStartIndex),'..',dbgs(FInvalidChildEndIndex),' Count=',dbgs(Count));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
// update TopSeparator
|
// update TopSeparator
|
||||||
if FInvalidChildVisibility=0 then
|
if FInvalidChildStartIndex=0 then
|
||||||
UpdateNeedTopSeparator;
|
UpdateNeedTopSeparator;
|
||||||
if FTopSeparator<>nil then
|
if FTopSeparator<>nil then
|
||||||
inc(ContainerMenuIndex);
|
inc(ContainerMenuIndex);
|
||||||
|
|
||||||
// update childs
|
// update childs
|
||||||
while FInvalidChildVisibility<FItems.Count do begin
|
while (FInvalidChildStartIndex<=FInvalidChildEndIndex)
|
||||||
Item:=Items[FInvalidChildVisibility];
|
and (FInvalidChildStartIndex<Count) do begin
|
||||||
inc(FInvalidChildVisibility);
|
Item:=Items[FInvalidChildStartIndex];
|
||||||
|
inc(FInvalidChildStartIndex);
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.UpdateMenuStructure Name="',Name,'" Item.Name="',Item.Name,'" ContainerMenuIndex=',dbgs(ContainerMenuIndex));
|
debugln('TIDEMenuSection.UpdateMenuStructure Name="',Name,'" Item.Name="',Item.Name,'" ContainerMenuIndex=',dbgs(ContainerMenuIndex));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if Item is TIDEMenuSection then begin
|
if Item is TIDEMenuSection then
|
||||||
TIDEMenuSection(Item).FInvalidChildVisibility:=0;
|
CurSection:=TIDEMenuSection(Item)
|
||||||
TIDEMenuSection(Item).UpdateMenuStructure;
|
else
|
||||||
end else begin
|
CurSection:=nil;
|
||||||
|
// insert menu item
|
||||||
|
if (CurSection=nil) or CurSection.ChildsAsSubMenu then begin
|
||||||
if ContainerMenuItem<>nil then begin
|
if ContainerMenuItem<>nil then begin
|
||||||
Item.CreateMenuItem;
|
Item.CreateMenuItem;
|
||||||
if Item.MenuItem.Parent=nil then
|
if Item.MenuItem.Parent=nil then begin
|
||||||
|
{$IFDEF VerboseMenuIntf}
|
||||||
|
debugln('TIDEMenuSection.UpdateMenuStructure INSERT MenuItem Name="',Name,'" Item="',Item.Name,'" ContainerMenuIndex=',dbgs(ContainerMenuIndex),' ContainerMenuItem.Count=',dbgs(ContainerMenuItem.Count));
|
||||||
|
{$ENDIF}
|
||||||
ContainerMenuItem.Insert(ContainerMenuIndex,Item.MenuItem);
|
ContainerMenuItem.Insert(ContainerMenuIndex,Item.MenuItem);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
// update grand childs
|
||||||
|
if CurSection<>nil then begin
|
||||||
|
CurSection:=TIDEMenuSection(Item);
|
||||||
|
CurSection.FInvalidChildStartIndex:=0;
|
||||||
|
CurSection.FInvalidChildEndIndex:=CurSection.Count-1;
|
||||||
|
CurSection.UpdateMenuStructure;
|
||||||
|
end;
|
||||||
|
// next
|
||||||
inc(ContainerMenuIndex,Item.Size);
|
inc(ContainerMenuIndex,Item.Size);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// update BottomSeparator
|
// update BottomSeparator
|
||||||
|
if FInvalidChildEndIndex>=Count-1 then
|
||||||
UpdateNeedBottomSeparator;
|
UpdateNeedBottomSeparator;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -762,27 +872,68 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDEMenuSection.Invalidate(FromIndex, ToIndex: integer);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if (FInvalidChildStartIndex>FInvalidChildEndIndex) then begin
|
||||||
|
// init invalid range
|
||||||
|
FInvalidChildStartIndex:=Count;
|
||||||
|
FInvalidChildEndIndex:=-1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (FInvalidChildStartIndex>FromIndex) then begin
|
||||||
|
FInvalidChildStartIndex:=FromIndex;
|
||||||
|
// adjust FInvalidChildStartIndex
|
||||||
|
// the bottom separators depend on the next visible item
|
||||||
|
// => If the next visible item is invalidated, then the update must start
|
||||||
|
// at the nearest visible in front
|
||||||
|
i:=FInvalidChildStartIndex-1;
|
||||||
|
while (i>=0) and (not Items[i].VisibleActive) do dec(i);
|
||||||
|
if i>=0 then
|
||||||
|
FInvalidChildStartIndex:=i;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if FInvalidChildEndIndex<ToIndex then begin
|
||||||
|
FInvalidChildEndIndex:=ToIndex;
|
||||||
|
// adjust FInvalidChildEndIndex
|
||||||
|
// the top separators depend on the previous visible item
|
||||||
|
// => If the previous visible item is invalidated, then the update must end
|
||||||
|
// at the nearest visible behind
|
||||||
|
i:=FInvalidChildEndIndex+1;
|
||||||
|
while (i<Count) and (not Items[i].VisibleActive) do inc(i);
|
||||||
|
if i<Count then
|
||||||
|
FInvalidChildEndIndex:=i;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIDEMenuSection.ItemVisibleActiveChanged(AnItem: TIDEMenuItem);
|
procedure TIDEMenuSection.ItemVisibleActiveChanged(AnItem: TIDEMenuItem);
|
||||||
var
|
var
|
||||||
OldVisibleActive: Boolean;
|
OldVisibleActive: Boolean;
|
||||||
begin
|
begin
|
||||||
FInvalidChildVisibility:=AnItem.SectionIndex;
|
if imssClearing in FStates then
|
||||||
|
exit;
|
||||||
|
if AnItem.VisibleActive=AnItem.FLastVisibleActive then
|
||||||
|
RaiseGDBException('');
|
||||||
|
AnItem.FLastVisibleActive:=AnItem.VisibleActive;
|
||||||
|
|
||||||
|
Invalidate(AnItem.SectionIndex,AnItem.SectionIndex);
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.ItemVisibleActiveChanged Self="',Name,'" AnItem="',AnItem.Name,'" FInvalidChildVisibility=',dbgs(FInvalidChildVisibility));
|
debugln('TIDEMenuSection.ItemVisibleActiveChanged Self="',Name,'" AnItem="',AnItem.Name,'" AnItem.VisibleActive=',dbgs(AnItem.VisibleActive));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
OldVisibleActive:=VisibleActive;
|
OldVisibleActive:=VisibleActive;
|
||||||
|
|
||||||
// update FVisibleCount
|
// update FVisibleCount
|
||||||
if (AnItem.Section=Self) and AnItem.VisibleActive then
|
if AnItem.VisibleActive then
|
||||||
inc(FVisibleCount)
|
inc(FVisibleCount)
|
||||||
else
|
else
|
||||||
dec(FVisibleCount);
|
dec(FVisibleCount);
|
||||||
|
|
||||||
// invalidate Sections in front
|
|
||||||
if (OldVisibleActive<>VisibleActive) and (Section<>nil) then begin
|
if (OldVisibleActive<>VisibleActive) and (Section<>nil) then begin
|
||||||
FInvalidChildVisibility:=0;
|
// section visibility changed
|
||||||
|
Invalidate(0,Count-1);
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.ItemVisibleActiveChanged B Self="',Name,'" FInvalidChildVisibility=',dbgs(FInvalidChildVisibility));
|
debugln('TIDEMenuSection.ItemVisibleActiveChanged B Self="',Name,'"');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Section.ItemVisibleActiveChanged(Self);
|
Section.ItemVisibleActiveChanged(Self);
|
||||||
end;
|
end;
|
||||||
@ -809,20 +960,28 @@ end;
|
|||||||
procedure TIDEMenuSection.Clear;
|
procedure TIDEMenuSection.Clear;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
OldVisibleActive: Boolean;
|
OldVisibleActive: boolean;
|
||||||
begin
|
begin
|
||||||
|
BeginUpdate;
|
||||||
if imssClearing in FStates then
|
if imssClearing in FStates then
|
||||||
raise Exception.Create('TIDEMenuSection.Clear imssClearing is set');
|
raise Exception.Create('TIDEMenuSection.Clear imssClearing is set');
|
||||||
Include(FStates,imssClearing);
|
Include(FStates,imssClearing);
|
||||||
FInvalidChildVisibility:=0;
|
|
||||||
OldVisibleActive:=VisibleActive;
|
OldVisibleActive:=VisibleActive;
|
||||||
|
|
||||||
|
FInvalidChildStartIndex:=0;
|
||||||
|
FInvalidChildEndIndex:=0;
|
||||||
|
|
||||||
|
FreeSeparators;
|
||||||
|
|
||||||
UpdateSize(-FItems.Count);
|
UpdateSize(-FItems.Count);
|
||||||
for i:=FItems.Count-1 downto 0 do TObject(FItems[i]).Free;
|
for i:=FItems.Count-1 downto 0 do TObject(FItems[i]).Free;
|
||||||
FItems.Clear;
|
FItems.Clear;
|
||||||
FChildMenuItemsCreated:=false;
|
FChildMenuItemsCreated:=false;
|
||||||
|
FVisibleCount:=0;
|
||||||
Exclude(FStates,imssClearing);
|
Exclude(FStates,imssClearing);
|
||||||
if (OldVisibleActive<>VisibleActive) and (Section<>nil) then
|
if (Section<>nil) and (OldVisibleActive<>VisibleActive) then
|
||||||
Section.ItemVisibleActiveChanged(Self);
|
Section.ItemVisibleActiveChanged(Self);
|
||||||
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEMenuSection.Count: Integer;
|
function TIDEMenuSection.Count: Integer;
|
||||||
@ -847,8 +1006,11 @@ begin
|
|||||||
UpdateChildsIndex(Index);
|
UpdateChildsIndex(Index);
|
||||||
UpdateSize(1);
|
UpdateSize(1);
|
||||||
AnItem.FSection:=Self;
|
AnItem.FSection:=Self;
|
||||||
if AnItem.Visible then
|
if AnItem.VisibleActive then
|
||||||
ItemVisibleActiveChanged(AnItem);
|
ItemVisibleActiveChanged(AnItem);
|
||||||
|
{$IFDEF VerboseMenuIntf}
|
||||||
|
ConsistencyCheck;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEMenuSection.Remove(AnItem: TIDEMenuItem);
|
procedure TIDEMenuSection.Remove(AnItem: TIDEMenuItem);
|
||||||
@ -964,18 +1126,62 @@ begin
|
|||||||
UpdateMenuStructure;
|
UpdateMenuStructure;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDEMenuSection.WriteDebugReport(const Prefix: string);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
inherited WriteDebugReport(Prefix);
|
||||||
|
for i:=0 to Count-1 do Items[i].WriteDebugReport(Prefix+' ');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TIDEMenuSection.ConsistencyCheck;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Item: TIDEMenuItem;
|
||||||
|
RealVisibleCount: Integer;
|
||||||
|
begin
|
||||||
|
inherited ConsistencyCheck;
|
||||||
|
RealVisibleCount:=0;
|
||||||
|
for i:=0 to Count-1 do begin
|
||||||
|
Item:=Items[i];
|
||||||
|
Item.ConsistencyCheck;
|
||||||
|
if Item.SectionIndex<>i then
|
||||||
|
RaiseGDBException('');
|
||||||
|
if Item.VisibleActive then
|
||||||
|
inc(RealVisibleCount);
|
||||||
|
end;
|
||||||
|
if RealVisibleCount<>VisibleCount then
|
||||||
|
RaiseGDBException('');
|
||||||
|
end;
|
||||||
|
|
||||||
function TIDEMenuSection.GetItems(Index: Integer): TIDEMenuItem;
|
function TIDEMenuSection.GetItems(Index: Integer): TIDEMenuItem;
|
||||||
begin
|
begin
|
||||||
Result:=TIDEMenuItem(FItems[Index]);
|
Result:=TIDEMenuItem(FItems[Index]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDEMenuSection.SeparatorDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if Sender=FTopSeparator then
|
||||||
|
FTopSeparator:=nil;
|
||||||
|
if Sender=FBottomSeparator then
|
||||||
|
FBottomSeparator:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TIDEMenuSection.FreeSeparators;
|
||||||
|
begin
|
||||||
|
FNeedTopSeparator:=false;
|
||||||
|
FreeAndNil(FTopSeparator);
|
||||||
|
FNeedBottomSeparator:=false;
|
||||||
|
FreeAndNil(FBottomSeparator);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIDEMenuSection.SetMenuItem(const AValue: TMenuItem);
|
procedure TIDEMenuSection.SetMenuItem(const AValue: TMenuItem);
|
||||||
begin
|
begin
|
||||||
if MenuItem=AValue then exit;
|
if MenuItem=AValue then exit;
|
||||||
inherited SetMenuItem(AValue);
|
inherited SetMenuItem(AValue);
|
||||||
FInvalidChildVisibility:=0;
|
Invalidate(0,Count-1);
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.SetMenuItem ',Name,' FInvalidChildVisibility=',dbgs(FInvalidChildVisibility));
|
debugln('TIDEMenuSection.SetMenuItem Name="',Name,'"');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
UpdateMenuStructure;
|
UpdateMenuStructure;
|
||||||
end;
|
end;
|
||||||
@ -986,9 +1192,9 @@ begin
|
|||||||
FChildsAsSubMenu:=AValue;
|
FChildsAsSubMenu:=AValue;
|
||||||
ClearMenuItems;
|
ClearMenuItems;
|
||||||
if Section<>nil then begin
|
if Section<>nil then begin
|
||||||
Section.FInvalidChildVisibility:=SectionIndex;
|
Section.Invalidate(SectionIndex,SectionIndex);
|
||||||
{$IFDEF VerboseMenuIntf}
|
{$IFDEF VerboseMenuIntf}
|
||||||
debugln('TIDEMenuSection.SetChildsAsSubMenu FInvalidChildVisibility=',dbgs(FInvalidChildVisibility));
|
debugln('TIDEMenuSection.SetChildsAsSubMenu Name="',Name,'"');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Section.UpdateMenuStructure;
|
Section.UpdateMenuStructure;
|
||||||
end;
|
end;
|
||||||
|
@ -985,7 +985,7 @@ type
|
|||||||
procedure DoOnShowHint(HintInfo: Pointer);
|
procedure DoOnShowHint(HintInfo: Pointer);
|
||||||
procedure VisibleChanging; dynamic;
|
procedure VisibleChanging; dynamic;
|
||||||
procedure AddHandler(HandlerType: TControlHandlerType;
|
procedure AddHandler(HandlerType: TControlHandlerType;
|
||||||
const AMethod: TMethod; AsLast: boolean);
|
const AMethod: TMethod; AsLast: boolean = false);
|
||||||
procedure RemoveHandler(HandlerType: TControlHandlerType;
|
procedure RemoveHandler(HandlerType: TControlHandlerType;
|
||||||
const AMethod: TMethod);
|
const AMethod: TMethod);
|
||||||
procedure DoContextPopup(const MousePos: TPoint; var Handled: Boolean); virtual;
|
procedure DoContextPopup(const MousePos: TPoint; var Handled: Boolean); virtual;
|
||||||
@ -1104,11 +1104,12 @@ type
|
|||||||
public
|
public
|
||||||
// Event lists
|
// Event lists
|
||||||
procedure RemoveAllHandlersOfObject(AnObject: TObject); override;
|
procedure RemoveAllHandlersOfObject(AnObject: TObject); override;
|
||||||
procedure AddHandlerOnResize(OnResizeEvent: TNotifyEvent; AsLast: boolean);
|
procedure AddHandlerOnResize(const OnResizeEvent: TNotifyEvent;
|
||||||
procedure RemoveHandlerOnResize(OnResizeEvent: TNotifyEvent);
|
AsLast: boolean = false);
|
||||||
procedure AddHandlerOnChangeBounds(OnChangeBoundsEvent: TNotifyEvent;
|
procedure RemoveHandlerOnResize(const OnResizeEvent: TNotifyEvent);
|
||||||
AsLast: boolean);
|
procedure AddHandlerOnChangeBounds(const OnChangeBoundsEvent: TNotifyEvent;
|
||||||
procedure RemoveHandlerOnChangeBounds(OnChangeBoundsEvent: TNotifyEvent);
|
AsLast: boolean = false);
|
||||||
|
procedure RemoveHandlerOnChangeBounds(const OnChangeBoundsEvent: TNotifyEvent);
|
||||||
public
|
public
|
||||||
// standard properties, which should be supported by all descendants
|
// standard properties, which should be supported by all descendants
|
||||||
property Action: TBasicAction read GetAction write SetAction;
|
property Action: TBasicAction read GetAction write SetAction;
|
||||||
|
@ -3039,25 +3039,25 @@ begin
|
|||||||
Result:=Control.ManualDock(NewDockSite,DropControl,ControlSide);
|
Result:=Control.ManualDock(NewDockSite,DropControl,ControlSide);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControl.AddHandlerOnResize(OnResizeEvent: TNotifyEvent;
|
procedure TControl.AddHandlerOnResize(const OnResizeEvent: TNotifyEvent;
|
||||||
AsLast: boolean);
|
AsLast: boolean);
|
||||||
begin
|
begin
|
||||||
AddHandler(chtOnResize,TMethod(OnResizeEvent),AsLast);
|
AddHandler(chtOnResize,TMethod(OnResizeEvent),AsLast);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControl.RemoveHandlerOnResize(OnResizeEvent: TNotifyEvent);
|
procedure TControl.RemoveHandlerOnResize(const OnResizeEvent: TNotifyEvent);
|
||||||
begin
|
begin
|
||||||
RemoveHandler(chtOnResize,TMethod(OnResizeEvent));
|
RemoveHandler(chtOnResize,TMethod(OnResizeEvent));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControl.AddHandlerOnChangeBounds(OnChangeBoundsEvent: TNotifyEvent;
|
procedure TControl.AddHandlerOnChangeBounds(
|
||||||
AsLast: boolean);
|
const OnChangeBoundsEvent: TNotifyEvent; AsLast: boolean);
|
||||||
begin
|
begin
|
||||||
AddHandler(chtOnChangeBounds,TMethod(OnChangeBoundsEvent),AsLast);
|
AddHandler(chtOnChangeBounds,TMethod(OnChangeBoundsEvent),AsLast);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControl.RemoveHandlerOnChangeBounds(OnChangeBoundsEvent: TNotifyEvent
|
procedure TControl.RemoveHandlerOnChangeBounds(
|
||||||
);
|
const OnChangeBoundsEvent: TNotifyEvent);
|
||||||
begin
|
begin
|
||||||
RemoveHandler(chtOnChangeBounds,TMethod(OnChangeBoundsEvent));
|
RemoveHandler(chtOnChangeBounds,TMethod(OnChangeBoundsEvent));
|
||||||
end;
|
end;
|
||||||
|
@ -175,6 +175,9 @@ destructor TMenuItem.Destroy;
|
|||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
begin
|
begin
|
||||||
|
i:=FMenuItemHandlers[mihtDestroy].Count;
|
||||||
|
while FMenuItemHandlers[mihtDestroy].NextDownIndex(i) do
|
||||||
|
TNotifyEvent(FMenuItemHandlers[mihtDestroy][i])(Self);
|
||||||
if FBitmap<>nil then
|
if FBitmap<>nil then
|
||||||
FreeAndNil(FBitmap);
|
FreeAndNil(FBitmap);
|
||||||
DestroyHandle;
|
DestroyHandle;
|
||||||
@ -796,6 +799,40 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMenuItem.RemoveAllHandlersOfObject(AnObject: TObject);
|
||||||
|
var
|
||||||
|
HandlerType: TMenuItemHandlerType;
|
||||||
|
begin
|
||||||
|
inherited RemoveAllHandlersOfObject(AnObject);
|
||||||
|
for HandlerType:=Low(TMenuItemHandlerType) to High(TMenuItemHandlerType) do
|
||||||
|
FMenuItemHandlers[HandlerType].RemoveAllMethodsOfObject(AnObject);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMenuItem.AddHandlerOnDestroy(const OnDestroyEvent: TNotifyEvent;
|
||||||
|
AsLast: boolean);
|
||||||
|
begin
|
||||||
|
AddHandler(mihtDestroy,TMethod(OnDestroyEvent),AsLast);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMenuItem.RemoveHandlerOnDestroy(const OnDestroyEvent: TNotifyEvent);
|
||||||
|
begin
|
||||||
|
RemoveHandler(mihtDestroy,TMethod(OnDestroyEvent));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMenuItem.AddHandler(HandlerType: TMenuItemHandlerType;
|
||||||
|
const AMethod: TMethod; AsLast: boolean);
|
||||||
|
begin
|
||||||
|
if FMenuItemHandlers[HandlerType]=nil then
|
||||||
|
FMenuItemHandlers[HandlerType]:=TMethodList.Create;
|
||||||
|
FMenuItemHandlers[HandlerType].Add(AMethod);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMenuItem.RemoveHandler(HandlerType: TMenuItemHandlerType;
|
||||||
|
const AMethod: TMethod);
|
||||||
|
begin
|
||||||
|
FMenuItemHandlers[HandlerType].Remove(AMethod);
|
||||||
|
end;
|
||||||
|
|
||||||
function TMenuItem.MenuVisibleIndex: integer;
|
function TMenuItem.MenuVisibleIndex: integer;
|
||||||
begin
|
begin
|
||||||
Result:=-1;
|
Result:=-1;
|
||||||
|
15
lcl/menus.pp
15
lcl/menus.pp
@ -92,6 +92,10 @@ type
|
|||||||
|
|
||||||
{ TMenuItem }
|
{ TMenuItem }
|
||||||
|
|
||||||
|
TMenuItemHandlerType = (
|
||||||
|
mihtDestroy
|
||||||
|
);
|
||||||
|
|
||||||
TMenuItem = class(TLCLComponent)
|
TMenuItem = class(TLCLComponent)
|
||||||
private
|
private
|
||||||
FActionLink: TMenuActionLink;
|
FActionLink: TMenuActionLink;
|
||||||
@ -119,6 +123,7 @@ type
|
|||||||
FShowAlwaysCheckable: boolean;
|
FShowAlwaysCheckable: boolean;
|
||||||
FSubMenuImages: TCustomImageList;
|
FSubMenuImages: TCustomImageList;
|
||||||
FVisible: Boolean;
|
FVisible: Boolean;
|
||||||
|
FMenuItemHandlers: array[TMenuItemHandlerType] of TMethodList;
|
||||||
function GetBitmap: TBitmap;
|
function GetBitmap: TBitmap;
|
||||||
function GetCount: Integer;
|
function GetCount: Integer;
|
||||||
function GetItem(Index: Integer): TMenuItem;
|
function GetItem(Index: Integer): TMenuItem;
|
||||||
@ -203,6 +208,16 @@ type
|
|||||||
procedure Clear;
|
procedure Clear;
|
||||||
function HasBitmap: boolean;
|
function HasBitmap: boolean;
|
||||||
function GetIconSize: TPoint; virtual;
|
function GetIconSize: TPoint; virtual;
|
||||||
|
public
|
||||||
|
// Event lists
|
||||||
|
procedure RemoveAllHandlersOfObject(AnObject: TObject); override;
|
||||||
|
procedure AddHandlerOnDestroy(const OnDestroyEvent: TNotifyEvent;
|
||||||
|
AsLast: boolean = false);
|
||||||
|
procedure RemoveHandlerOnDestroy(const OnDestroyEvent: TNotifyEvent);
|
||||||
|
procedure AddHandler(HandlerType: TMenuItemHandlerType;
|
||||||
|
const AMethod: TMethod; AsLast: boolean);
|
||||||
|
procedure RemoveHandler(HandlerType: TMenuItemHandlerType;
|
||||||
|
const AMethod: TMethod);
|
||||||
public
|
public
|
||||||
property Count: Integer read GetCount;
|
property Count: Integer read GetCount;
|
||||||
property Handle: HMenu read GetHandle write FHandle;
|
property Handle: HMenu read GetHandle write FHandle;
|
||||||
|
@ -83,7 +83,7 @@ type
|
|||||||
procedure SaveSettings; virtual; abstract;
|
procedure SaveSettings; virtual; abstract;
|
||||||
procedure UpdateVisibleComponentPalette; virtual; abstract;
|
procedure UpdateVisibleComponentPalette; virtual; abstract;
|
||||||
procedure ProcessCommand(Command: word; var Handled: boolean); virtual; abstract;
|
procedure ProcessCommand(Command: word; var Handled: boolean); virtual; abstract;
|
||||||
procedure OnSourceEditorPopupMenu(AddMenuItemProc: TAddMenuItemProc); virtual; abstract;
|
procedure OnSourceEditorPopupMenu(const AddMenuItemProc: TAddMenuItemProc); virtual; abstract;
|
||||||
|
|
||||||
// files
|
// files
|
||||||
function GetDefaultSaveDirectoryForFile(const Filename: string): string; virtual; abstract;
|
function GetDefaultSaveDirectoryForFile(const Filename: string): string; virtual; abstract;
|
||||||
|
@ -194,7 +194,7 @@ type
|
|||||||
procedure SaveSettings; override;
|
procedure SaveSettings; override;
|
||||||
procedure UpdateVisibleComponentPalette; override;
|
procedure UpdateVisibleComponentPalette; override;
|
||||||
procedure ProcessCommand(Command: word; var Handled: boolean); override;
|
procedure ProcessCommand(Command: word; var Handled: boolean); override;
|
||||||
procedure OnSourceEditorPopupMenu(AddMenuItemProc: TAddMenuItemProc); override;
|
procedure OnSourceEditorPopupMenu(const AddMenuItemProc: TAddMenuItemProc); override;
|
||||||
|
|
||||||
// files
|
// files
|
||||||
function GetDefaultSaveDirectoryForFile(const Filename: string): string; override;
|
function GetDefaultSaveDirectoryForFile(const Filename: string): string; override;
|
||||||
@ -2113,8 +2113,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPkgManager.OnSourceEditorPopupMenu(AddMenuItemProc: TAddMenuItemProc
|
procedure TPkgManager.OnSourceEditorPopupMenu(
|
||||||
);
|
const AddMenuItemProc: TAddMenuItemProc);
|
||||||
var
|
var
|
||||||
PkgFile: TPkgFile;
|
PkgFile: TPkgFile;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user