mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-07 01:25:57 +02:00
SourceEditor: Improved dragging tabs
git-svn-id: trunk@24249 -
This commit is contained in:
parent
8b981c9c48
commit
aedba3f0d2
@ -5275,8 +5275,11 @@ end;
|
|||||||
procedure TSourceNotebook.NoteBookDeletePage(Index: Integer);
|
procedure TSourceNotebook.NoteBookDeletePage(Index: Integer);
|
||||||
begin
|
begin
|
||||||
if PageCount > 1 then begin
|
if PageCount > 1 then begin
|
||||||
|
if Index < PageCount - 1 then
|
||||||
|
FNoteBook.PageIndex := Index + 1
|
||||||
|
else
|
||||||
|
FNoteBook.PageIndex := Index - 1;
|
||||||
NotebookPages.Delete(Index);
|
NotebookPages.Delete(Index);
|
||||||
FNoteBook.PageIndex := Min(Index, PageCount-1);
|
|
||||||
end else
|
end else
|
||||||
FNotebook.Visible := False;
|
FNotebook.Visible := False;
|
||||||
end;
|
end;
|
||||||
@ -6765,6 +6768,7 @@ procedure TSourceDragableNotebook.DragOver(Source: TObject; X, Y: Integer; State
|
|||||||
var Accept: Boolean);
|
var Accept: Boolean);
|
||||||
var
|
var
|
||||||
TabIndex: Integer;
|
TabIndex: Integer;
|
||||||
|
TabPos: TRect;
|
||||||
begin
|
begin
|
||||||
inherited DragOver(Source, X, Y, State, Accept);
|
inherited DragOver(Source, X, Y, State, Accept);
|
||||||
// currently limited to source=self => extendable to allow dragging tabs from other notebooks
|
// currently limited to source=self => extendable to allow dragging tabs from other notebooks
|
||||||
@ -6772,6 +6776,16 @@ begin
|
|||||||
(TSourceDragableNotebook(Source).FMouseDownTabIndex >= 0)
|
(TSourceDragableNotebook(Source).FMouseDownTabIndex >= 0)
|
||||||
then begin
|
then begin
|
||||||
TabIndex := TabIndexAtClientPos(Point(X,Y));
|
TabIndex := TabIndexAtClientPos(Point(X,Y));
|
||||||
|
if TabIndex < 0 then begin
|
||||||
|
TabPos := TabRect(PageCount-1);
|
||||||
|
if (TabPos.Right > 1) and (X > TabPos.Right) then
|
||||||
|
TabIndex := PageCount - 1;
|
||||||
|
end;
|
||||||
|
TabPos := TabRect(TabIndex);
|
||||||
|
if X > (TabPos.Left + TabPos.Right) div 2 then
|
||||||
|
inc(TabIndex);
|
||||||
|
if (Source = self) and (TabIndex > TSourceDragableNotebook(Source).MouseDownTabIndex) then
|
||||||
|
dec(TabIndex);
|
||||||
Accept := (TabIndex >= 0) and ((Source <> self) or (TabIndex <> FMouseDownTabIndex));
|
Accept := (TabIndex >= 0) and ((Source <> self) or (TabIndex <> FMouseDownTabIndex));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -6779,6 +6793,7 @@ end;
|
|||||||
procedure TSourceDragableNotebook.DragDrop(Source: TObject; X, Y: Integer);
|
procedure TSourceDragableNotebook.DragDrop(Source: TObject; X, Y: Integer);
|
||||||
var
|
var
|
||||||
TabIndex: Integer;
|
TabIndex: Integer;
|
||||||
|
TabPos: TRect;
|
||||||
begin
|
begin
|
||||||
inherited DragDrop(Source, X, Y);
|
inherited DragDrop(Source, X, Y);
|
||||||
|
|
||||||
@ -6786,6 +6801,16 @@ begin
|
|||||||
(TSourceDragableNotebook(Source).MouseDownTabIndex >= 0)
|
(TSourceDragableNotebook(Source).MouseDownTabIndex >= 0)
|
||||||
then begin
|
then begin
|
||||||
TabIndex := TabIndexAtClientPos(Point(X,Y));
|
TabIndex := TabIndexAtClientPos(Point(X,Y));
|
||||||
|
if TabIndex < 0 then begin
|
||||||
|
TabPos := TabRect(PageCount-1);
|
||||||
|
if (TabPos.Right > 1) and (X > TabPos.Right) then
|
||||||
|
TabIndex := PageCount - 1;
|
||||||
|
end;
|
||||||
|
TabPos := TabRect(TabIndex);
|
||||||
|
if X > (TabPos.Left + TabPos.Right) div 2 then
|
||||||
|
inc(TabIndex);
|
||||||
|
if (Source = self) and (TabIndex > TSourceDragableNotebook(Source).MouseDownTabIndex) then
|
||||||
|
dec(TabIndex);
|
||||||
if (TabIndex >= 0) and ( (Source <> self) or (TabIndex <> MouseDownTabIndex) )
|
if (TabIndex >= 0) and ( (Source <> self) or (TabIndex <> MouseDownTabIndex) )
|
||||||
then begin
|
then begin
|
||||||
FTabDragged:=true;
|
FTabDragged:=true;
|
||||||
|
Loading…
Reference in New Issue
Block a user