mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-01 17:55:59 +02:00
ide: sourcenotebook better PopupMenu handling. Fixes also issue #29295
git-svn-id: trunk@51169 -
This commit is contained in:
parent
9972eb105e
commit
416b79849e
@ -727,6 +727,8 @@ type
|
|||||||
|
|
||||||
procedure NotebookMouseDown(Sender: TObject; Button: TMouseButton;
|
procedure NotebookMouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
{%H-}Shift: TShiftState; X,Y: Integer);
|
{%H-}Shift: TShiftState; X,Y: Integer);
|
||||||
|
procedure NotebookMouseUp(Sender: TObject; Button: TMouseButton;
|
||||||
|
{%H-}Shift: TShiftState; X,Y: Integer);
|
||||||
procedure NotebookDragDropEx(Sender, Source: TObject;
|
procedure NotebookDragDropEx(Sender, Source: TObject;
|
||||||
OldIndex, NewIndex: Integer; CopyDrag: Boolean;
|
OldIndex, NewIndex: Integer; CopyDrag: Boolean;
|
||||||
var Done: Boolean);
|
var Done: Boolean);
|
||||||
@ -6300,7 +6302,6 @@ Begin
|
|||||||
APage.Caption:='unit1';
|
APage.Caption:='unit1';
|
||||||
APage.Parent:=FNotebook;
|
APage.Parent:=FNotebook;
|
||||||
PageIndex := 0; // Set it to the first page
|
PageIndex := 0; // Set it to the first page
|
||||||
PopupMenu := TabPopupMenu;
|
|
||||||
if EditorOpts.ShowTabCloseButtons then
|
if EditorOpts.ShowTabCloseButtons then
|
||||||
Options:=Options+[nboShowCloseButtons]
|
Options:=Options+[nboShowCloseButtons]
|
||||||
else
|
else
|
||||||
@ -6315,6 +6316,7 @@ Begin
|
|||||||
OnChange := @NotebookPageChanged;
|
OnChange := @NotebookPageChanged;
|
||||||
OnCloseTabClicked := @CloseTabClicked;
|
OnCloseTabClicked := @CloseTabClicked;
|
||||||
OnMouseDown:=@NotebookMouseDown;
|
OnMouseDown:=@NotebookMouseDown;
|
||||||
|
OnMouseUp:=@NotebookMouseUp;
|
||||||
TabDragMode := dmAutomatic;
|
TabDragMode := dmAutomatic;
|
||||||
OnTabDragOverEx := @NotebookDragOverEx;
|
OnTabDragOverEx := @NotebookDragOverEx;
|
||||||
OnTabDragDropEx := @NotebookDragDropEx;
|
OnTabDragDropEx := @NotebookDragDropEx;
|
||||||
@ -8366,6 +8368,26 @@ begin
|
|||||||
if TabIndex>=0 then
|
if TabIndex>=0 then
|
||||||
CloseClicked(NoteBookPage[TabIndex],
|
CloseClicked(NoteBookPage[TabIndex],
|
||||||
(GetKeyState(VK_CONTROL) < 0) and EditorOpts.CtrlMiddleTabClickClosesOthers);
|
(GetKeyState(VK_CONTROL) < 0) and EditorOpts.CtrlMiddleTabClickClosesOthers);
|
||||||
|
end else
|
||||||
|
if (Button = mbRight) then
|
||||||
|
begin
|
||||||
|
//select on right click
|
||||||
|
TabIndex:=FNotebook.TabIndexAtClientPos(Point(X,Y));
|
||||||
|
if TabIndex>=0 then
|
||||||
|
FNotebook.ActivePageIndex := TabIndex;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSourceNotebook.NotebookMouseUp(Sender: TObject;
|
||||||
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
|
var
|
||||||
|
TabIndex: Integer;
|
||||||
|
begin
|
||||||
|
if (Button = mbRight) then
|
||||||
|
begin
|
||||||
|
TabIndex:=FNotebook.TabIndexAtClientPos(Point(X,Y));
|
||||||
|
if TabIndex>=0 then
|
||||||
|
TabPopUpMenu.PopUp;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user