From 0a108a051c98c90d400da9ae025e4a32a8c6861f Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 23 Jan 2026 23:13:06 +0100 Subject: WIP: EphyNotebook --- UMain.pas | 60 +++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'UMain.pas') diff --git a/UMain.pas b/UMain.pas index 3b83ff9..21e4658 100644 --- a/UMain.pas +++ b/UMain.pas @@ -169,7 +169,7 @@ type procedure NotebookReordered(Sender: TObject; const Source, Dest: integer); procedure NotebookTabClosed(Sender: TObject; const TabNum: integer; var CanClose: boolean); procedure NotebookTabDoubleClick(Sender: TObject; const TabNum: integer); - function NotebookFindNotebookAtPointerEvent(Sender: TObject; const AbsX, AbsY: integer): TEphyNotebook; +// function NotebookFindNotebookAtPointerEvent(Sender: TObject; const AbsX, AbsY: integer): TEphyNotebook; function NotebookMoveTabToAnotherNotebook(Sender: TObject; Destination: TEphyNotebook; const SourceTabNo, DestTabNo: integer): boolean; procedure NotebookTabFocusOnlyEvent(Sender: TObject; const TabNum: integer); procedure PasswordButtonClick(Sender: TObject); @@ -436,8 +436,8 @@ begin RightListView.OnMouseMove := @ListViewMouseMove; LeftQuickFindEntry.OnEnter := @QuickFindEntryEnter; RightQuickFindEntry.OnEnter := @QuickFindEntryEnter; - LeftPanelNotebook.OnTabSwitched := @TabNotebookSwitchPage; - RightPanelNotebook.OnTabSwitched := @TabNotebookSwitchPage; +{ LeftPanelNotebook.OnTabSwitched := @TabNotebookSwitchPage; + RightPanelNotebook.OnTabSwitched := @TabNotebookSwitchPage; } LeftPanelNotebook.PopupMenu := TabPopupMenu; RightPanelNotebook.PopupMenu := TabPopupMenu; AfterStart; @@ -556,35 +556,37 @@ begin LeftPathLabelEventBox.AddControl(LeftPathLabel); RightPathLabelEventBox.AddControl(RightPathLabel); LeftPanelNotebook := TEphyNotebook.Create(Self); + LeftPanelNotebook.GroupName := 'PanelNotebook'; LeftPanelNotebook.Visible := False; // LeftPanelNotebook.SetSizeRequest(10, -1); LeftPanelNotebook.Scrollable := True; LeftPanelNotebook.ShowBorder := False; LeftPanelNotebook.CanFocus := False; // Notebook should be focusable to allow scrolling when many tabs -- temporarily disabled LeftPanelNotebook.ShowCloseButtons := True; - LeftPanelNotebook.AllowDragDrop := True; - LeftPanelNotebook.AllowDragOutside := True; - LeftPanelNotebook.OnNotebookReordered := @NotebookReordered; +{ LeftPanelNotebook.AllowDragDrop := True; + LeftPanelNotebook.AllowDragOutside := True; } +// LeftPanelNotebook.OnNotebookReordered := @NotebookReordered; LeftPanelNotebook.OnTabClose := @NotebookTabClosed; - LeftPanelNotebook.OnTabDoubleClick := @NotebookTabDoubleClick; - LeftPanelNotebook.OnFindNotebookAtPointer := @NotebookFindNotebookAtPointerEvent; - LeftPanelNotebook.OnMoveTabToAnotherNotebook := @NotebookMoveTabToAnotherNotebook; - LeftPanelNotebook.OnTabFocusOnlyEvent := @NotebookTabFocusOnlyEvent; +// LeftPanelNotebook.OnTabDoubleClick := @NotebookTabDoubleClick; +{ LeftPanelNotebook.OnFindNotebookAtPointer := @NotebookFindNotebookAtPointerEvent; + LeftPanelNotebook.OnMoveTabToAnotherNotebook := @NotebookMoveTabToAnotherNotebook; } +// LeftPanelNotebook.OnTabFocusOnlyEvent := @NotebookTabFocusOnlyEvent; RightPanelNotebook := TEphyNotebook.Create(Self); + RightPanelNotebook.GroupName := LeftPanelNotebook.GroupName; RightPanelNotebook.Visible := False; // RightPanelNotebook.SetSizeRequest(10, -1); - RightPanelNotebook.Scrollable := True; +{ RightPanelNotebook.Scrollable := True; RightPanelNotebook.ShowBorder := False; - RightPanelNotebook.CanFocus := False; + RightPanelNotebook.CanFocus := False; } RightPanelNotebook.ShowCloseButtons := True; - RightPanelNotebook.AllowDragDrop := True; - RightPanelNotebook.AllowDragOutside := True; - RightPanelNotebook.OnNotebookReordered := @NotebookReordered; +{ RightPanelNotebook.AllowDragDrop := True; + RightPanelNotebook.AllowDragOutside := True; } +// RightPanelNotebook.OnNotebookReordered := @NotebookReordered; RightPanelNotebook.OnTabClose := @NotebookTabClosed; - RightPanelNotebook.OnTabDoubleClick := @NotebookTabDoubleClick; - RightPanelNotebook.OnFindNotebookAtPointer := @NotebookFindNotebookAtPointerEvent; - RightPanelNotebook.OnMoveTabToAnotherNotebook := @NotebookMoveTabToAnotherNotebook; - RightPanelNotebook.OnTabFocusOnlyEvent := @NotebookTabFocusOnlyEvent; +// RightPanelNotebook.OnTabDoubleClick := @NotebookTabDoubleClick; +{ RightPanelNotebook.OnFindNotebookAtPointer := @NotebookFindNotebookAtPointerEvent; + RightPanelNotebook.OnMoveTabToAnotherNotebook := @NotebookMoveTabToAnotherNotebook; } +// RightPanelNotebook.OnTabFocusOnlyEvent := @NotebookTabFocusOnlyEvent; LeftListBox := TGTKVBox.Create(Self); LeftListBox.AddControlEx(LeftScrolledWindow, True, True, 0); RightListBox := TGTKVBox.Create(Self); @@ -5504,7 +5506,7 @@ var ANotebook: TEphyNotebook; i: integer; ATabSortIDs: TList; ATabSortTypes: TList; - OldEvent: TEphyNotebookTabSwitchedEvent; + OldEvent: TNotifyEvent; begin if LeftPanel then begin ANotebook := LeftPanelNotebook; @@ -5543,10 +5545,10 @@ begin end; if not ANotebook.Visible then ANotebook.Visible := True; - OldEvent := ANotebook.OnTabSwitched; - ANotebook.OnTabSwitched := nil; + OldEvent := ANotebook.OnSwitchPage; + ANotebook.OnSwitchPage := nil; ANotebook.PageIndex := SetTabActive; - ANotebook.OnTabSwitched := OldEvent; + ANotebook.OnSwitchPage := OldEvent; TabNotebookSwitchPage(ANotebook, SetTabActive, True); end; @@ -5608,15 +5610,22 @@ begin CloseTab(TabNum, Sender = LeftPanelNotebook, True); end; +(* function TFMain.NotebookFindNotebookAtPointerEvent(Sender: TObject; const AbsX, AbsY: integer): TEphyNotebook; var wx, wy: Integer; allocation: TGtkAllocation; + seat: PGdkSeat; begin -// DebugMsg([' *** NotebookFindNotebookAtPointerEvent(AbsX = ', AbsX, ', AbsY = ', AbsY, ')']); + DebugMsg([' *** NotebookFindNotebookAtPointerEvent(AbsX = ', AbsX, ', AbsY = ', AbsY, ')']); Result := nil; - // TODO if LeftPanelNotebook.Visible then begin + seat := gdk_display_get_default_seat(gtk_widget_get_display(LeftPanelNotebook.FWidget)); + gdk_window_get_device_position (priv->window, + gdk_seat_get_pointer (seat), + x, y, NULL); + + gdk_window_get_device_position(gtk_widget_get_window(LeftPanelNotebook.FWidget), nil, @wx, @wy, nil); // gtk_widget_get_pointer(LeftPanelNotebook.FWidget, @wx, @wy); gtk_widget_get_allocation(LeftPanelNotebook.FWidget, @allocation); @@ -5651,6 +5660,7 @@ begin if Result = RightPanelNotebook then DebugMsg([' *** NotebookFindNotebookAtPointerEvent: inside RightPanelNotebook']); } end; +*) function TFMain.NotebookMoveTabToAnotherNotebook(Sender: TObject; Destination: TEphyNotebook; const SourceTabNo, DestTabNo: integer): boolean; var LeftPanel: boolean; -- cgit v1.2.3