UPD: Move FileViewNotebook related code in uFileViewNotebook unit

This commit is contained in:
Alexander Koblov 2012-05-12 17:18:55 +00:00
commit d2df735208
2 changed files with 20 additions and 19 deletions

View file

@ -3080,11 +3080,6 @@ procedure TfrmMain.pnlLeftRightDblClick(Sender: TObject);
var
APanel: TPanel;
FileViewNotebook: TFileViewNotebook;
{$IF DEFINED(LCLGTK2)}
X, ArrowWidth: Integer;
arrow_spacing: gint = 0;
scroll_arrow_hlength: gint = 16;
{$ENDIF}
begin
if Sender is TPanel then
begin
@ -3097,21 +3092,10 @@ begin
if Sender is TFileViewNotebook then
begin
FileViewNotebook:= Sender as TFileViewNotebook;
if FileViewNotebook.DoubleClickPageIndex >= 0 then
Commands.DoRemoveTab(FileViewNotebook, FileViewNotebook.DoubleClickPageIndex)
if FileViewNotebook.DoubleClickPageIndex < 0 then
Commands.DoNewTab(FileViewNotebook)
else
begin
{$IF DEFINED(LCLGTK2)}
gtk_widget_style_get(PGtkWidget(FileViewNotebook.Handle),
'arrow-spacing', @arrow_spacing,
'scroll-arrow-hlength', @scroll_arrow_hlength,
nil);
ArrowWidth:= arrow_spacing + scroll_arrow_hlength;
X:= FileViewNotebook.ScreenToClient(Mouse.CursorPos).X;
if (X > ArrowWidth) and (X < FileViewNotebook.ClientWidth - ArrowWidth) then
{$ENDIF}
Commands.DoNewTab(FileViewNotebook);
end;
Commands.DoRemoveTab(FileViewNotebook, FileViewNotebook.DoubleClickPageIndex);
end;
end;

View file

@ -148,6 +148,9 @@ uses
LCLProc,
DCStrUtils,
uGlobs
{$IF DEFINED(LCLGTK2)}
, Glib2, Gtk2
{$ENDIF}
{$IF DEFINED(LCLQT) and (LCL_FULLVERSION < 093100)}
, qt4, qtwidgets
{$ENDIF}
@ -484,6 +487,12 @@ begin
end;
procedure TFileViewNotebook.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
{$IF DEFINED(LCLGTK2)}
var
ArrowWidth: Integer;
arrow_spacing: gint = 0;
scroll_arrow_hlength: gint = 16;
{$ENDIF}
begin
inherited;
@ -502,6 +511,14 @@ begin
end
else if (FDraggedPageIndex = FLastMouseDownPageIndex) then
begin
{$IF DEFINED(LCLGTK2)}
gtk_widget_style_get(PGtkWidget(Self.Handle),
'arrow-spacing', @arrow_spacing,
'scroll-arrow-hlength', @scroll_arrow_hlength,
nil);
ArrowWidth:= arrow_spacing + scroll_arrow_hlength;
if (X > ArrowWidth) and (X < ClientWidth - ArrowWidth) then
{$ENDIF}
OnDblClick(Self);
FStartDrag:= False;
FLastMouseDownTime:= 0;