diff --git a/ide/uniteditor.pp b/ide/uniteditor.pp index 2bbcb92b0c..66ab5ae0fb 100644 --- a/ide/uniteditor.pp +++ b/ide/uniteditor.pp @@ -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); diff --git a/lcl/include/imglist.inc b/lcl/include/imglist.inc index 25fc438837..a10c174c6b 100644 --- a/lcl/include/imglist.inc +++ b/lcl/include/imglist.inc @@ -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 diff --git a/lcl/include/menu.inc b/lcl/include/menu.inc index d72eddf731..2ec71ba838 100644 --- a/lcl/include/menu.inc +++ b/lcl/include/menu.inc @@ -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 diff --git a/lcl/include/menuitem.inc b/lcl/include/menuitem.inc index 618b4cea63..d206cfc093 100644 --- a/lcl/include/menuitem.inc +++ b/lcl/include/menuitem.inc @@ -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 diff --git a/lcl/menus.pp b/lcl/menus.pp index a7cac3c904..99925912c0 100644 --- a/lcl/menus.pp +++ b/lcl/menus.pp @@ -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