MG: fixed non AutoCheck menuitems and editor bookmark popupmenu

git-svn-id: trunk@2941 -
This commit is contained in:
lazarus 2002-08-18 08:56:25 +00:00
parent 760e69253a
commit 2719ecdfd2
5 changed files with 53 additions and 23 deletions

View File

@ -458,7 +458,8 @@ type
SrcPopUpMenu : TPopupMenu;
StatusBar : TStatusBar;
SetBookmarkMenuItem : TMenuItem;
property OnAddJumpPoint: TOnAddJumpPoint
GotoBookmarkMenuItem : TMenuItem;
property OnAddJumpPoint: TOnAddJumpPoint
read FOnAddJumpPoint write FOnAddJumpPoint;
property OnCloseClicked : TNotifyEvent read FOnCloseClicked write FOnCloseClicked;
property OnDeleteLastJumpPoint: TNotifyEvent
@ -2252,6 +2253,7 @@ end;
procedure TSourceNotebook.SrcPopUpMenuPopup(Sender: TObject);
var
ASrcEdit: TSourceEditor;
i: integer;
begin
if not (Sender is TPopupMenu) then exit;
ASrcEdit:=FindSourceEditorWithEditorComponent(TPopupMenu(Sender).PopupComponent);
@ -2259,6 +2261,10 @@ begin
ReadOnlyMenuItem.Checked:=ASrcEdit.ReadOnly;
ShowLineNumbersMenuItem.Checked:=
ASrcEdit.EditorComponent.Gutter.ShowLineNumbers;
for i:=0 to 9 do begin
SetBookmarkMenuItem[i].Checked:=(FindBookmark(i)<>nil);
GotoBookmarkMenuItem[i].Checked:=SetBookmarkMenuItem[i].Checked;
end;
end;
Procedure TSourceNotebook.BuildPopupMenu;
@ -2312,10 +2318,10 @@ Begin
SetBookmarkMenuItem.Add(SubMenuItem);
end;
MenuItem := TMenuItem.Create(Self);
MenuItem.Name:='GotoBookmarkMenuItem';
MenuItem.Caption := '&Goto Bookmark';
SrcPopupMenu.Items.Add(MenuItem);
GotoBookmarkMenuItem := TMenuItem.Create(Self);
GotoBookmarkMenuItem.Name:='GotoBookmarkMenuItem';
GotoBookmarkMenuItem.Caption := '&Goto Bookmark';
SrcPopupMenu.Items.Add(GotoBookmarkMenuItem);
for I := 0 to 9 do
Begin
@ -2323,7 +2329,7 @@ Begin
SubmenuItem.Name:='GotoBookmark'+IntToStr(I)+'MenuItem';
SubMenuItem.Caption := 'Bookmark '+inttostr(i);
SubMenuItem.OnClick := @BookmarkGotoClicked;
MenuItem.Add(SubMenuItem);
GotoBookmarkMenuItem.Add(SubMenuItem);
end;
SrcPopupMenu.Items.Add(Seperator);
@ -2804,16 +2810,16 @@ var
ActEdit,AnEdit:TSourceEditor;
Begin
MenuItem := TMenuItem(SetBookmarkMenuItem.Items[Value]);
if not MenuItem.Checked then begin
MenuItem.Checked := true;
MenuItem.Caption := MenuItem.Caption + '*';
end;
ActEdit:=GetActiveSE;
AnEdit:=FindBookmark(Value);
if AnEdit<>nil then AnEdit.EditorComponent.ClearBookMark(Value);
if AnEdit<>nil then begin
AnEdit.EditorComponent.ClearBookMark(Value);
end;
ActEdit.EditorComponent.SetBookMark(Value,
ActEdit.EditorComponent.CaretX,ActEdit.EditorComponent.CaretY);
MenuItem.Checked := true;
GotoBookmarkMenuItem[Value].Checked:=true;
end;
{This is called from outside to set a bookmark}
@ -3143,7 +3149,7 @@ begin
BookMarkGoto(Command - ecGotoMarker0);
ecSetMarker0..ecSetMarker9:
BookMarkToggle(Command - ecSetMarker0);
BookMarkSet(Command - ecSetMarker0);
ecJumpBack:
HistoryJump(Self,jhaBack);

View File

@ -289,7 +289,8 @@ end;
Draws the requested image on the given canvas.
------------------------------------------------------------------------------}
procedure TCustomImageList.Draw(Canvas: TCanvas; X, Y, Index: Integer; Enabled: Boolean);
procedure TCustomImageList.Draw(Canvas: TCanvas; X, Y, Index: Integer;
Enabled: Boolean);
var
aBitmap : TBitmap;
begin
@ -839,6 +840,9 @@ end;
{
$Log$
Revision 1.12 2002/08/22 13:45:58 lazarus
MG: fixed non AutoCheck menuitems and editor bookmark popupmenu
Revision 1.11 2002/06/08 17:16:02 lazarus
MG: added close buttons and images to TNoteBook and close buttons to source editor

View File

@ -62,12 +62,14 @@ end;
Creates the handle ( = object).
------------------------------------------------------------------------------}
procedure TMenu.CreateHandle;
var i: integer;
begin
InterfaceObject.IntSendMessage3(LM_CREATE, Self, nil); // CreateComponent(nil);
// initiate creation of subitems
// Note: FItems is a MenuItem, by using Createhandle all subitems will be
// created.
FItems.CreateHandle;
for i:=0 to Items.Count-1 do
Items[i].HandleNeeded;
end;
{------------------------------------------------------------------------------
@ -168,6 +170,9 @@ end;
{ =============================================================================
$Log$
Revision 1.12 2002/08/22 13:45:58 lazarus
MG: fixed non AutoCheck menuitems and editor bookmark popupmenu
Revision 1.11 2002/08/12 15:32:29 lazarus
MG: started enhanced menuitem

View File

@ -66,26 +66,32 @@ end;
Creates the handle ( = object).
------------------------------------------------------------------------------}
procedure TMenuItem.CreateHandle;
var
n: Integer;
var i: Integer;
begin
InterfaceObject.IntSendMessage3(LM_CREATE, Self, nil);
if FItems<>nil then begin
for i := 0 to Count - 1 do begin
Items[i].HandleNeeded;
end;
end;
if Parent <> nil then
begin
Parent.HandleNeeded;
if Parent.HandleAllocated and (not HandleAllocated) then
InterfaceObject.IntSendMessage3(LM_CREATE, Self, nil);
if HandleAllocated then
begin
if Parent.HandleAllocated then
InterfaceObject.IntSendMessage3(LM_ATTACHMENU, Self, nil);
if HandleAllocated then begin
if ShortCut <> 0 then ShortCutChanged(0, Shortcut);
end;
end;
if (FItems <> nil) and ((Parent = nil) or Parent.HandleAllocated)
{
if (FItems <> nil) and ((Parent = nil) or Parent.HandleAllocated)
then begin
for n := 0 to FItems.Count - 1 do
begin
InterfaceObject.IntSendMessage3(LM_ATTACHMENU, TObject(FItems[n]), nil);
end;
end;
}
end;
{------------------------------------------------------------------------------
@ -420,7 +426,7 @@ procedure TMenuItem.RecreateHandle;
begin
if not HandleAllocated then exit;
DestroyHandle;
CreateHandle;
HandleNeeded;
end;
{------------------------------------------------------------------------------
@ -916,6 +922,9 @@ end;
{ =============================================================================
$Log$
Revision 1.26 2002/08/22 13:45:58 lazarus
MG: fixed non AutoCheck menuitems and editor bookmark popupmenu
Revision 1.25 2002/08/15 13:37:57 lazarus
MG: started menuitem icon, checked, radio and groupindex
@ -1019,6 +1028,9 @@ end;
$Log$
Revision 1.26 2002/08/22 13:45:58 lazarus
MG: fixed non AutoCheck menuitems and editor bookmark popupmenu
Revision 1.25 2002/08/15 13:37:57 lazarus
MG: started menuitem icon, checked, radio and groupindex

View File

@ -182,7 +182,7 @@ type
property Parent: TMenuItem read GetParent;
function IsCheckItem: boolean; virtual;
published
property AutoCheck: boolean read FAutoCheck write SetAutoCheck;
property AutoCheck: boolean read FAutoCheck write SetAutoCheck default False;
property Caption: String
read FCaption write SetCaption stored IsCaptionStored;
property Checked: Boolean
@ -463,6 +463,9 @@ end.
{
$Log$
Revision 1.26 2002/08/22 13:45:57 lazarus
MG: fixed non AutoCheck menuitems and editor bookmark popupmenu
Revision 1.25 2002/08/17 07:57:05 lazarus
MG: added TPopupMenu.OnPopup and SourceEditor PopupMenu checks