Merge fixes from 4.8 branch to trunk

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2788 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2013-09-07 19:08:28 +00:00
parent d40caa283a
commit d67d6d0a63
56 changed files with 2436 additions and 1236 deletions

View File

@ -30,9 +30,20 @@
{$define EnableAlphaBlend} {$define EnableAlphaBlend}
{.$define EnableAccessible} {.$define EnableAccessible}
{$define ThemeSupport} {$define ThemeSupport}
{$if defined(LCLWin32) or defined(LCLWinCE)}
{$define LCLWin}
{$endif}
{.$define DEBUG_VTV} {.$define DEBUG_VTV}
{$define USE_DELPHICOMPAT}
//since
{$if not defined(USE_DELPHICOMPAT) and not defined(LCLWin)}
{$define INCOMPLETE_WINAPI}
{$endif}
//under linux the performance is poor with threading enabled //under linux the performance is poor with threading enabled
{$ifdef Windows} {$ifdef Windows}
{$define EnableThreadSupport} {$define EnableThreadSupport}
{$endif} {$endif}
{$ifdef CPU64}
{$define PACKARRAYPASCAL}
{$endif}

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,21 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="7"/>
<General> <General>
<Flags> <Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/> <LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@ -41,6 +42,7 @@
<Unit0> <Unit0>
<Filename Value="Advanced.lpr"/> <Filename Value="Advanced.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="Advanced"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="WindowsXPStyleDemo.pas"/> <Filename Value="WindowsXPStyleDemo.pas"/>
@ -132,6 +134,7 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="StateForm"/> <ComponentName Value="StateForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="States"/> <UnitName Value="States"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
@ -150,8 +153,13 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>

View File

@ -11,7 +11,7 @@ interface
uses uses
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, VirtualTrees, ComCtrls, ExtCtrls, Menus, LResources; StdCtrls, ComCtrls, VirtualTrees, ExtCtrls, Menus, LResources;
type type
TAlignForm = class(TForm) TAlignForm = class(TForm)

View File

@ -20,8 +20,8 @@ uses
{$ifdef Windows} {$ifdef Windows}
Windows, Windows,
{$endif} {$endif}
LCLIntf, delphicompat, LCLType, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, LCLIntf, delphicompat, LCLType, SysUtils, Classes, ComCtrls, Graphics, Controls, Forms, Dialogs,
VirtualTrees, StdCtrls, ComCtrls, shlobjext, LResources; VirtualTrees, StdCtrls, shlobjext, LResources, FileUtil;
type type
TDrawTreeForm = class(TForm) TDrawTreeForm = class(TForm)
@ -96,10 +96,10 @@ var
SR: TSearchRec; SR: TSearchRec;
begin begin
Result := FindFirst(IncludeTrailingPathDelimiter(Folder) + {$ifdef Windows}'*.*'{$else}'*'{$endif}, Result := FindFirstUTF8(IncludeTrailingPathDelimiter(Folder) + {$ifdef Windows}'*.*'{$else}'*'{$endif},
faAnyFile, SR) = 0; faAnyFile, SR) = 0;
if Result then if Result then
FindClose(SR); FindCloseUTF8(SR);
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -529,7 +529,7 @@ var
begin begin
Data := Sender.GetNodeData(Node); Data := Sender.GetNodeData(Node);
if FindFirst(IncludeTrailingPathDelimiter(Data.FullPath) + {$ifdef Windows}'*.*'{$else}'*'{$endif}, if FindFirstUTF8(IncludeTrailingPathDelimiter(Data.FullPath) + {$ifdef Windows}'*.*'{$else}'*'{$endif},
faAnyFile, SR) = 0 then faAnyFile, SR) = 0 then
begin begin
Screen.Cursor := crHourGlass; Screen.Cursor := crHourGlass;
@ -554,14 +554,14 @@ begin
Sender.ValidateNode(Node, False); Sender.ValidateNode(Node, False);
end; end;
end; end;
until FindNext(SR) <> 0; until FindNextUTF8(SR) <> 0;
ChildCount := Sender.ChildCount[Node]; ChildCount := Sender.ChildCount[Node];
// finally sort node // finally sort node
if ChildCount > 0 then if ChildCount > 0 then
Sender.Sort(Node, 0, TVirtualStringTree(Sender).Header.SortDirection, False); Sender.Sort(Node, 0, TVirtualStringTree(Sender).Header.SortDirection, False);
finally finally
FindClose(SR); FindCloseUTF8(SR);
Screen.Cursor := crDefault; Screen.Cursor := crDefault;
end; end;
end; end;

View File

@ -9,8 +9,7 @@ interface
uses uses
LCLIntf, delphicompat, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, LCLIntf, delphicompat, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, VirtualTrees, ExtDlgs, Buttons, ExtCtrls, ComCtrls, StdCtrls, VirtualTrees, Buttons, ExtCtrls, MaskEdit, LCLType, EditBtn;
MaskEdit, LCLType, EditBtn;
type type
// Describes the type of value a property tree node stores in its data property. // Describes the type of value a property tree node stores in its data property.
@ -36,6 +35,9 @@ type
end; end;
// Our own edit link to implement several different node editors. // Our own edit link to implement several different node editors.
{ TPropertyEditLink }
TPropertyEditLink = class(TInterfacedObject, IVTEditLink) TPropertyEditLink = class(TInterfacedObject, IVTEditLink)
private private
FEdit: TWinControl; // One of the property editor classes. FEdit: TWinControl; // One of the property editor classes.
@ -43,6 +45,7 @@ type
FNode: PVirtualNode; // The node being edited. FNode: PVirtualNode; // The node being edited.
FColumn: Integer; // The column of the node being edited. FColumn: Integer; // The column of the node being edited.
protected protected
procedure EditExit(Sender: TObject);
procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
public public
destructor Destroy; override; destructor Destroy; override;
@ -201,12 +204,17 @@ uses
destructor TPropertyEditLink.Destroy; destructor TPropertyEditLink.Destroy;
begin begin
FEdit.Free; Application.ReleaseComponent(FEdit);
inherited; inherited;
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
procedure TPropertyEditLink.EditExit(Sender: TObject);
begin
FTree.EndEditNode;
end;
procedure TPropertyEditLink.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure TPropertyEditLink.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var var
@ -252,7 +260,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TPropertyEditLink.BeginEdit: Boolean; function TPropertyEditLink.BeginEdit: Boolean; stdcall;
begin begin
Result := True; Result := True;
@ -262,7 +270,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TPropertyEditLink.CancelEdit: Boolean; function TPropertyEditLink.CancelEdit: Boolean; stdcall;
begin begin
Result := True; Result := True;
@ -271,7 +279,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TPropertyEditLink.EndEdit: Boolean; function TPropertyEditLink.EndEdit: Boolean; stdcall;
var var
Data: PPropertyData; Data: PPropertyData;
@ -304,7 +312,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TPropertyEditLink.GetBounds: TRect; function TPropertyEditLink.GetBounds: TRect; stdcall;
begin begin
Result := FEdit.BoundsRect; Result := FEdit.BoundsRect;
@ -312,7 +320,8 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TPropertyEditLink.PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex): Boolean; function TPropertyEditLink.PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex): Boolean; stdcall;
var var
Data: PPropertyData; Data: PPropertyData;
@ -336,7 +345,6 @@ begin
Visible := False; Visible := False;
Parent := Tree; Parent := Tree;
Text := Data.Value; Text := Data.Value;
OnKeyDown := EditKeyDown;
end; end;
end; end;
vtPickString: vtPickString:
@ -351,7 +359,6 @@ begin
Items.Add('Standard'); Items.Add('Standard');
Items.Add('Additional'); Items.Add('Additional');
Items.Add('Win32'); Items.Add('Win32');
OnKeyDown := EditKeyDown;
end; end;
end; end;
vtNumber: vtNumber:
@ -363,7 +370,6 @@ begin
Parent := Tree; Parent := Tree;
EditMask := '9999'; EditMask := '9999';
Text := Data.Value; Text := Data.Value;
OnKeyDown := EditKeyDown;
end; end;
end; end;
vtPickNumber: vtPickNumber:
@ -374,7 +380,6 @@ begin
Visible := False; Visible := False;
Parent := Tree; Parent := Tree;
Text := Data.Value; Text := Data.Value;
OnKeyDown := EditKeyDown;
end; end;
end; end;
vtMemo: vtMemo:
@ -388,7 +393,6 @@ begin
Parent := Tree; Parent := Tree;
Text := Data.Value; Text := Data.Value;
Items.Add(Data.Value); Items.Add(Data.Value);
OnKeyDown := EditKeyDown;
end; end;
end; end;
vtDate: vtDate:
@ -399,17 +403,21 @@ begin
Visible := False; Visible := False;
Parent := Tree; Parent := Tree;
Date := StrToDate(Data.Value); Date := StrToDate(Data.Value);
OnKeyDown := EditKeyDown;
end; end;
end; end;
else else
Result := False; Result := False;
end; end;
if Result then
begin
FEdit.OnKeyDown := EditKeyDown;
FEdit.OnExit := EditExit;
end;
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
procedure TPropertyEditLink.ProcessMessage(var Message: TMessage); procedure TPropertyEditLink.ProcessMessage(var Message: TMessage); stdcall;
begin begin
FEdit.WindowProc(Message); FEdit.WindowProc(Message);
@ -417,7 +425,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
procedure TPropertyEditLink.SetBounds(R: TRect); procedure TPropertyEditLink.SetBounds(R: TRect); stdcall;
var var
Dummy: Integer; Dummy: Integer;

View File

@ -79,7 +79,7 @@ begin
if Node.Index mod 6 = 0 then if Node.Index mod 6 = 0 then
Color := $49DDEF // $70A33F // $436BFF Color := $49DDEF // $70A33F // $436BFF
else else
Color := VST5.Color; Color := VST5.Brush.Color;
EraseAction := eaColor; EraseAction := eaColor;
end; end;
end; end;

View File

@ -106,7 +106,7 @@ begin
begin begin
if hpeBackground in Elements then if hpeBackground in Elements then
begin begin
TargetCanvas.Brush.Color := clBackground; TargetCanvas.Brush.Color := clBtnFace;
TargetCanvas.FillRect(PaintRectangle); TargetCanvas.FillRect(PaintRectangle);
end; end;
end end

View File

@ -198,7 +198,7 @@ begin
// to start a new edit operation if the last one is still in progress. So we post us a special message and // to start a new edit operation if the last one is still in progress. So we post us a special message and
// in the message handler we then can start editing the new node. This works because the posted message // in the message handler we then can start editing the new node. This works because the posted message
// is first executed *after* this event and the message, which triggered it is finished. // is first executed *after* this event and the message, which triggered it is finished.
PostMessage(Self.Handle, WM_STARTEDITING, Integer(Node), 0); PostMessage(Self.Handle, WM_STARTEDITING, PtrInt(Node), 0);
end; end;
end; end;
end; end;

View File

@ -9,30 +9,29 @@ object SpeedForm: TSpeedForm
ClientWidth = 566 ClientWidth = 566
Font.Height = -13 Font.Height = -13
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
LCLVersion = '0.9.29' LCLVersion = '1.1'
Visible = True
object Label1: TLabel object Label1: TLabel
Left = 7 Left = 7
Height = 18 Height = 16
Top = 8 Top = 8
Width = 156 Width = 139
Caption = 'Last operation duration:' Caption = 'Last operation duration:'
ParentColor = False ParentColor = False
end end
object Label3: TLabel object Label3: TLabel
Left = 6 Left = 6
Height = 18 Height = 16
Top = 508 Top = 510
Width = 104 Width = 93
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Caption = 'Nodes in tree: 0' Caption = 'Nodes in tree: 0'
ParentColor = False ParentColor = False
end end
object Label6: TLabel object Label6: TLabel
Left = 164 Left = 164
Height = 18 Height = 16
Top = 508 Top = 510
Width = 73 Width = 67
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Caption = 'Selected: 0' Caption = 'Selected: 0'
ParentColor = False ParentColor = False
@ -42,9 +41,9 @@ object SpeedForm: TSpeedForm
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = VST1 AnchorSideTop.Control = VST1
Left = 261 Left = 261
Height = 102 Height = 16
Top = 24 Top = 24
Width = 296 Width = 1203
BorderSpacing.Left = 4 BorderSpacing.Left = 4
Caption = 'Test how fast the Virtual Treeview is. You can add and delete nodes as much as you like (provided your system has enough memory). An upper limit of one million nodes for a 128MB system is a good start.' Caption = 'Test how fast the Virtual Treeview is. You can add and delete nodes as much as you like (provided your system has enough memory). An upper limit of one million nodes for a 128MB system is a good start.'
ParentColor = False ParentColor = False
@ -56,9 +55,9 @@ object SpeedForm: TSpeedForm
AnchorSideTop.Control = Label4 AnchorSideTop.Control = Label4
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 261 Left = 261
Height = 18 Height = 16
Top = 136 Top = 50
Width = 135 Width = 121
BorderSpacing.Left = 4 BorderSpacing.Left = 4
BorderSpacing.Top = 10 BorderSpacing.Top = 10
Caption = 'As an orientation:' Caption = 'As an orientation:'
@ -74,9 +73,9 @@ object SpeedForm: TSpeedForm
AnchorSideTop.Control = Label2 AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 265 Left = 265
Height = 60 Height = 16
Top = 156 Top = 68
Width = 292 Width = 520
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Caption = '1.000.000 nodes on Windows XP Pro, 650Mhz Athlon, 256 MB RAM, take ~ 850ms to add.' Caption = '1.000.000 nodes on Windows XP Pro, 650Mhz Athlon, 256 MB RAM, take ~ 850ms to add.'
@ -89,9 +88,9 @@ object SpeedForm: TSpeedForm
AnchorSideTop.Control = Label5 AnchorSideTop.Control = Label5
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 265 Left = 265
Height = 39 Height = 16
Top = 218 Top = 86
Width = 292 Width = 519
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Caption = '5.000.000 nodes on Windows XP Pro, 1.8Ghz Pentium M , 1 GB RAM, are added in ~1.6s.' Caption = '5.000.000 nodes on Windows XP Pro, 1.8Ghz Pentium M , 1 GB RAM, are added in ~1.6s.'
@ -1576,7 +1575,6 @@ object SpeedForm: TSpeedForm
TreeOptions.SelectionOptions = [toMultiSelect] TreeOptions.SelectionOptions = [toMultiSelect]
OnChange = VST1Change OnChange = VST1Change
OnGetText = VST1GetText OnGetText = VST1GetText
OnStateChange = VST1StateChange
OnStructureChange = VST1StructureChange OnStructureChange = VST1StructureChange
end end
object GroupBox2: TGroupBox object GroupBox2: TGroupBox
@ -1588,15 +1586,15 @@ object SpeedForm: TSpeedForm
Width = 281 Width = 281
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
Caption = ' Background ' Caption = ' Background '
ClientHeight = 38 ClientHeight = 39
ClientWidth = 277 ClientWidth = 277
DragMode = dmAutomatic DragMode = dmAutomatic
TabOrder = 1 TabOrder = 1
object SBCheckBox: TCheckBox object SBCheckBox: TCheckBox
Left = 24 Left = 24
Height = 22 Height = 20
Top = 10 Top = 10
Width = 140 Width = 129
Caption = 'Show Background' Caption = 'Show Background'
OnClick = SBCheckBoxClick OnClick = SBCheckBoxClick
TabOrder = 0 TabOrder = 0
@ -1622,7 +1620,7 @@ object SpeedForm: TSpeedForm
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
BorderSpacing.Bottom = 10 BorderSpacing.Bottom = 10
Caption = ' Add and remove nodes ' Caption = ' Add and remove nodes '
ClientHeight = 103 ClientHeight = 104
ClientWidth = 277 ClientWidth = 277
TabOrder = 2 TabOrder = 2
object AddRootButton: TButton object AddRootButton: TButton
@ -1637,7 +1635,7 @@ object SpeedForm: TSpeedForm
end end
object NodeCountEdit: TEdit object NodeCountEdit: TEdit
Left = 12 Left = 12
Height = 27 Height = 24
Top = 16 Top = 16
Width = 81 Width = 81
TabOrder = 1 TabOrder = 1

View File

@ -11,7 +11,7 @@ interface
uses uses
LCLIntf, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, LCLIntf, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, VirtualTrees, ExtDlgs, ComCtrls, Menus, LResources, Buttons; StdCtrls, VirtualTrees, ExtDlgs, Menus, LResources, Buttons;
type type
TSpeedForm = class(TForm) TSpeedForm = class(TForm)

View File

@ -10,7 +10,7 @@ interface
uses uses
LCLIntf, SysUtils, Classes, Graphics, Controls, Forms, LCLIntf, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, VirtualTrees, ComCtrls, Menus, StdCtrls, Dialogs, ComCtrls, VirtualTrees, Menus, StdCtrls,
LResources, Printers, PrintersDlgs, ExtCtrls; LResources, Printers, PrintersDlgs, ExtCtrls;
type type

View File

@ -1,40 +1,41 @@
object Form1: TForm1 object Form1: TForm1
Left = 188 Left = 188
Height = 437 Height = 434
Top = 104 Top = 104
Width = 612 Width = 648
ActiveControl = Button1 ActiveControl = MyTree
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 437 ClientHeight = 434
ClientWidth = 612 ClientWidth = 648
Font.Height = -11 Font.Height = -11
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
OnClose = FormClose OnClose = FormClose
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '0.9.27' Position = poScreenCenter
LCLVersion = '0.9.29'
object Label1: TLabel object Label1: TLabel
Left = 207 Left = 224
Height = 14 Height = 14
Top = 351 Top = 348
Width = 149 Width = 174
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
Caption = 'Array data of the clicked node' Caption = 'Array data of the clicked node:'
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
Left = 367 Left = 224
Height = 14 Height = 14
Top = 335 Top = 382
Width = 222 Width = 256
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
Caption = 'Find and show the node by specific array index' Caption = 'Find and show the node by specific array index'
ParentColor = False ParentColor = False
end end
object Label3: TLabel object Label3: TLabel
Left = 367 Left = 224
Height = 14 Height = 14
Top = 351 Top = 398
Width = 237 Width = 274
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
Caption = 'Type index to get related tree node on the screen:' Caption = 'Type index to get related tree node on the screen:'
ParentColor = False ParentColor = False
@ -42,7 +43,7 @@ object Form1: TForm1
object Button1: TButton object Button1: TButton
Left = 8 Left = 8
Height = 25 Height = 25
Top = 342 Top = 344
Width = 83 Width = 83
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
@ -53,7 +54,7 @@ object Form1: TForm1
object btnDelete: TButton object btnDelete: TButton
Left = 96 Left = 96
Height = 25 Height = 25
Top = 342 Top = 344
Width = 97 Width = 97
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
@ -62,18 +63,21 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
end end
object Edit1: TEdit object Edit1: TEdit
Left = 208 AnchorSideLeft.Control = Label1
Height = 21 AnchorSideLeft.Side = asrBottom
Top = 376 Left = 402
Width = 153 Height = 23
Anchors = [akRight, akBottom] Top = 344
Width = 170
Anchors = [akLeft, akBottom]
BorderSpacing.Left = 4
ReadOnly = True ReadOnly = True
TabOrder = 2 TabOrder = 2
end end
object btnCleanAll: TButton object btnCleanAll: TButton
Left = 56 Left = 56
Height = 25 Height = 25
Top = 374 Top = 376
Width = 75 Width = 75
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
@ -82,25 +86,29 @@ object Form1: TForm1
TabOrder = 3 TabOrder = 3
end end
object Edit2: TEdit object Edit2: TEdit
Left = 368 AnchorSideLeft.Control = Label3
Height = 21 AnchorSideLeft.Side = asrBottom
Top = 378 Left = 502
Height = 23
Top = 394
Width = 97 Width = 97
Anchors = [akRight, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Left = 4
OnChange = Edit2Change OnChange = Edit2Change
TabOrder = 4 TabOrder = 4
end end
object MyTree: TVirtualStringTree object MyTree: TVirtualStringTree
Left = 3 Left = 3
Height = 321 Height = 326
Top = 8 Top = 8
Width = 605 Width = 641
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
AutoScrollDelay = 1 AutoScrollDelay = 1
BorderStyle = bsSingle
DefaultText = 'Node' DefaultText = 'Node'
Header.AutoSizeIndex = 0
Header.Columns = < Header.Columns = <
item item
Position = 0
Text = 'Text' Text = 'Text'
Width = 150 Width = 150
end end
@ -115,6 +123,7 @@ object Form1: TForm1
Text = 'Random' Text = 'Random'
Width = 100 Width = 100
end> end>
Header.DefaultHeight = 17
Header.Font.Height = -11 Header.Font.Height = -11
Header.Font.Name = 'MS Sans Serif' Header.Font.Name = 'MS Sans Serif'
Header.Options = [hoColumnResize, hoDblClickResize, hoDrag, hoShowSortGlyphs, hoVisible] Header.Options = [hoColumnResize, hoDblClickResize, hoDrag, hoShowSortGlyphs, hoVisible]

View File

@ -1,23 +1,24 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="7"/>
<General> <General>
<Flags> <Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/> <LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions> </PublishOptions>
@ -52,8 +53,13 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking> <Linking>
<Options> <Options>
<Win32> <Win32>

View File

@ -10,6 +10,8 @@ uses
Forms Forms
{ add your units here }, virtualtreeview_package, Main; { add your units here }, virtualtreeview_package, Main;
{$R *.res}
begin begin
Application.Initialize; Application.Initialize;
Application.CreateForm(TForm1, Form1); Application.CreateForm(TForm1, Form1);

View File

@ -0,0 +1,61 @@
object MainForm: TMainForm
Left = 569
Height = 349
Top = 219
Width = 454
Caption = 'VTV Drag and Drop'
ClientHeight = 349
ClientWidth = 454
Position = poScreenCenter
LCLVersion = '1.1'
object VirtualStringTree1: TVirtualStringTree
Left = 8
Height = 315
Top = 26
Width = 200
DefaultText = 'Node'
DragMode = dmAutomatic
DragType = dtVCL
Header.AutoSizeIndex = 0
Header.Columns = <>
Header.DefaultHeight = 17
Header.MainColumn = -1
RootNodeCount = 30
TabOrder = 0
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScroll, toAutoScrollOnExpand, toAutoTristateTracking, toAutoDeleteMovedNodes]
OnDragOver = VirtualStringTree1DragOver
OnDragDrop = VirtualStringTree1DragDrop
OnGetText = VirtualStringTree1GetText
OnGetNodeDataSize = VirtualStringTree1GetNodeDataSize
OnInitNode = VirtualStringTree1InitNode
end
object ListBox1: TListBox
Left = 248
Height = 315
Top = 26
Width = 200
DragMode = dmAutomatic
Items.Strings = (
'List Item 1'
'List Item 2'
'List Item 3'
'List Item 4'
'List Item 5'
'List Item 6'
)
ItemHeight = 15
OnDragDrop = ListBox1DragDrop
OnDragOver = ListBox1DragOver
ScrollWidth = 190
TabOrder = 1
end
object ShowHeaderCheckBox: TCheckBox
Left = 8
Height = 19
Top = 3
Width = 90
Caption = 'Show Header'
OnChange = ShowHeaderCheckBoxChange
TabOrder = 2
end
end

View File

@ -0,0 +1,146 @@
unit fMain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
VirtualTrees, {$ifdef windows}ActiveX{$else}FakeActiveX{$endif};
type
{ TMainForm }
TMainForm = class(TForm)
ShowHeaderCheckBox: TCheckBox;
ListBox1: TListBox;
VirtualStringTree1: TVirtualStringTree;
procedure ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);
procedure ListBox1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure ShowHeaderCheckBoxChange(Sender: TObject);
procedure VirtualStringTree1DragDrop(Sender: TBaseVirtualTree;
Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
Shift: TShiftState; const Pt: TPoint; var Effect: Integer; Mode: TDropMode);
procedure VirtualStringTree1DragOver(Sender: TBaseVirtualTree;
Source: TObject; Shift: TShiftState; State: TDragState; const Pt: TPoint;
Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
procedure VirtualStringTree1GetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
procedure VirtualStringTree1GetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: String);
procedure VirtualStringTree1InitNode(Sender: TBaseVirtualTree; ParentNode,
Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates);
private
{ private declarations }
public
{ public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.lfm}
type
TNodeData = record
Title: String;
end;
PNodeData = ^TNodeData;
{ TMainForm }
procedure TMainForm.VirtualStringTree1GetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: String);
begin
CellText := PNodeData(Sender.GetNodeData(Node))^.Title;
end;
procedure TMainForm.VirtualStringTree1InitNode(Sender: TBaseVirtualTree;
ParentNode, Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates);
begin
PNodeData(Sender.GetNodeData(Node))^.Title := 'VTV Item ' + IntToStr(Node^.Index);
end;
procedure TMainForm.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
begin
Accept := (Source = VirtualStringTree1) or (Source = ListBox1);
end;
procedure TMainForm.ShowHeaderCheckBoxChange(Sender: TObject);
begin
if ShowHeaderCheckBox.Checked then
VirtualStringTree1.Header.Options := VirtualStringTree1.Header.Options + [hoVisible]
else
VirtualStringTree1.Header.Options := VirtualStringTree1.Header.Options - [hoVisible];
end;
procedure TMainForm.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
Node: PVirtualNode;
begin
if Source = VirtualStringTree1 then
begin
Node := VirtualStringTree1.FocusedNode;
if Node <> nil then
ListBox1.Items.Append(VirtualStringTree1.Text[Node, 0]);
end;
end;
procedure TMainForm.VirtualStringTree1DragDrop(Sender: TBaseVirtualTree;
Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
Shift: TShiftState; const Pt: TPoint; var Effect: Integer; Mode: TDropMode);
var
Node: PVirtualNode;
NodeTitle: String;
begin
case Mode of
dmAbove: Node := Sender.InsertNode(Sender.DropTargetNode, amInsertBefore);
dmBelow: Node := Sender.InsertNode(Sender.DropTargetNode, amInsertAfter);
dmNowhere: Exit;
else
Node := Sender.AddChild(Sender.DropTargetNode);
end;
Sender.ValidateNode(Node, True);
if Source = ListBox1 then
begin
if ListBox1.ItemIndex = -1 then
NodeTitle := 'Unknow Item from List'
else
NodeTitle := ListBox1.Items[ListBox1.ItemIndex];
end
else if Source = Sender then
begin
if Sender.FocusedNode <> nil then
NodeTitle := VirtualStringTree1.Text[Sender.FocusedNode, 0]
else
NodeTitle := 'Unknow Source Node';
end
else
NodeTitle := 'Unknow Source Control';
PNodeData(Sender.GetNodeData(Node))^.Title := NodeTitle;
end;
procedure TMainForm.VirtualStringTree1DragOver(Sender: TBaseVirtualTree;
Source: TObject; Shift: TShiftState; State: TDragState; const Pt: TPoint;
Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
begin
Accept := (Sender = VirtualStringTree1) or (Source = ListBox1);
end;
procedure TMainForm.VirtualStringTree1GetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := SizeOf(TNodeData);
end;
end.

View File

@ -0,0 +1,91 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="virtualtreeview_package"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="vtvdragdrop.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="vtvdragdrop"/>
</Unit0>
<Unit1>
<Filename Value="fmain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fMain"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="vtvdragdrop"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,21 @@
program vtvdragdrop;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, fMain, virtualtreeview_package
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.

View File

@ -10,10 +10,12 @@ object Form1: TForm1
Font.Height = -11 Font.Height = -11
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '0.9.27' LCLVersion = '0.9.29'
object VST1: TVirtualStringTree object VST1: TVirtualStringTree
Cursor = 63 Cursor = 63
Left = 0
Height = 440 Height = 440
Top = 0
Width = 500 Width = 500
Align = alClient Align = alClient
CheckImageKind = ckXP CheckImageKind = ckXP
@ -22,10 +24,12 @@ object Form1: TForm1
DragMode = dmAutomatic DragMode = dmAutomatic
DragOperations = [doCopy, doMove, doLink] DragOperations = [doCopy, doMove, doLink]
DrawSelectionMode = smBlendedRectangle DrawSelectionMode = smBlendedRectangle
Header.AutoSizeIndex = 0
Header.Columns = < Header.Columns = <
item item
Hint = 'Glavna kolona' Hint = 'Glavna kolona'
ImageIndex = 0 ImageIndex = 0
Position = 0
Text = 'Main' Text = 'Main'
Width = 200 Width = 200
end end
@ -46,6 +50,7 @@ object Form1: TForm1
Text = 'Percent' Text = 'Percent'
Width = 150 Width = 150
end> end>
Header.DefaultHeight = 17
Header.Font.Height = -11 Header.Font.Height = -11
Header.Font.Name = 'MS Sans Serif' Header.Font.Name = 'MS Sans Serif'
Header.Height = 24 Header.Height = 24

View File

@ -17,7 +17,6 @@
</VersionInfo> </VersionInfo>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions> </PublishOptions>
@ -43,9 +42,9 @@
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="Unit1.pas"/> <Filename Value="Unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/> <UnitName Value="Unit1"/>
</Unit1> </Unit1>

View File

@ -2,7 +2,7 @@ program images;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{$define DEBUG_VTV} {.$define DEBUG_VTV}
uses uses
{$IFDEF UNIX}{$IFDEF UseCThreads} {$IFDEF UNIX}{$IFDEF UseCThreads}

View File

@ -1,23 +1,24 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="7"/>
<General> <General>
<Flags> <Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/> <LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions> </PublishOptions>
@ -52,8 +53,13 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>

View File

@ -10,6 +10,8 @@ uses
Forms Forms
{ add your units here }, Main; { add your units here }, Main;
{$R *.res}
begin begin
Application.Initialize; Application.Initialize;
Application.CreateForm(TMainForm,MainForm); Application.CreateForm(TMainForm,MainForm);

View File

@ -1,22 +1,24 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="6"/>
<General> <General>
<Flags> <Flags>
<AlwaysBuild Value="False"/> <LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions> </PublishOptions>
@ -45,11 +47,10 @@
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="MVCDemoMain.pas"/> <Filename Value="MVCDemoMain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmMVCDemo"/> <ComponentName Value="fmMVCDemo"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<ResourceFilename Value="MVCDemoMain.lrs"/>
<UnitName Value="MVCDemoMain"/> <UnitName Value="MVCDemoMain"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
@ -65,8 +66,13 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>

View File

@ -10,6 +10,8 @@ uses
Forms Forms
{ add your units here }, MVCDemoMain, lclextensions_package; { add your units here }, MVCDemoMain, lclextensions_package;
{$R *.res}
begin begin
Application.Initialize; Application.Initialize;
Application.CreateForm(TfmMVCDemo, fmMVCDemo); Application.CreateForm(TfmMVCDemo, fmMVCDemo);

View File

@ -1,23 +1,23 @@
object MainForm: TMainForm object MainForm: TMainForm
Left = 192 Left = 356
Height = 575 Height = 574
Top = 261 Top = 70
Width = 790 Width = 790
ActiveControl = Button1 ActiveControl = Button1
Caption = 'Demo for drag''n drop and clipboard transfers' Caption = 'Demo for drag''n drop and clipboard transfers'
ClientHeight = 575 ClientHeight = 574
ClientWidth = 790 ClientWidth = 790
Font.CharSet = ANSI_CHARSET Font.CharSet = ANSI_CHARSET
Font.Height = -12 Font.Height = -12
Font.Name = 'Arial' Font.Name = 'Arial'
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '0.9.27' LCLVersion = '1.1'
Visible = True Visible = True
object Label1: TLabel object Label1: TLabel
Left = 10 Left = 8
Height = 15 Height = 14
Top = 96 Top = 96
Width = 239 Width = 238
Caption = 'Tree 1 uses OLE when initiating a drag operation.' Caption = 'Tree 1 uses OLE when initiating a drag operation.'
Font.CharSet = ANSI_CHARSET Font.CharSet = ANSI_CHARSET
Font.Height = -11 Font.Height = -11
@ -26,7 +26,7 @@ object MainForm: TMainForm
ParentFont = False ParentFont = False
end end
object Label2: TLabel object Label2: TLabel
Left = 360 Left = 364
Height = 33 Height = 33
Top = 80 Top = 80
Width = 337 Width = 337
@ -40,7 +40,9 @@ object MainForm: TMainForm
WordWrap = True WordWrap = True
end end
object Panel3: TPanel object Panel3: TPanel
Left = 0
Height = 69 Height = 69
Top = 0
Width = 790 Width = 790
Align = alTop Align = alTop
ClientHeight = 69 ClientHeight = 69
@ -67,7 +69,7 @@ object MainForm: TMainForm
object Button1: TButton object Button1: TButton
Left = 705 Left = 705
Height = 25 Height = 25
Top = 527 Top = 526
Width = 75 Width = 75
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
@ -92,7 +94,6 @@ object MainForm: TMainForm
Height = 180 Height = 180
Top = 116 Top = 116
Width = 330 Width = 330
BorderStyle = bsSingle
ClipboardFormats.Strings = ( ClipboardFormats.Strings = (
'Plain text' 'Plain text'
'Unicode text' 'Unicode text'
@ -109,9 +110,12 @@ object MainForm: TMainForm
Font.CharSet = ANSI_CHARSET Font.CharSet = ANSI_CHARSET
Font.Height = -11 Font.Height = -11
Font.Name = 'Lucida Sans Unicode' Font.Name = 'Lucida Sans Unicode'
Header.AutoSizeIndex = 0
Header.Columns = <> Header.Columns = <>
Header.DefaultHeight = 17
Header.Font.Height = -11 Header.Font.Height = -11
Header.Font.Name = 'MS Sans Serif' Header.Font.Name = 'MS Sans Serif'
Header.Height = 24
Header.MainColumn = -1 Header.MainColumn = -1
Header.Options = [hoColumnResize, hoDrag] Header.Options = [hoColumnResize, hoDrag]
HintMode = hmTooltip HintMode = hmTooltip
@ -137,7 +141,6 @@ object MainForm: TMainForm
Height = 180 Height = 180
Top = 116 Top = 116
Width = 330 Width = 330
BorderStyle = bsSingle
ClipboardFormats.Strings = ( ClipboardFormats.Strings = (
'CSV' 'CSV'
'HTML Format' 'HTML Format'
@ -156,9 +159,12 @@ object MainForm: TMainForm
Font.CharSet = ANSI_CHARSET Font.CharSet = ANSI_CHARSET
Font.Height = -11 Font.Height = -11
Font.Name = 'Verdana' Font.Name = 'Verdana'
Header.AutoSizeIndex = 0
Header.Columns = <> Header.Columns = <>
Header.DefaultHeight = 17
Header.Font.Height = -11 Header.Font.Height = -11
Header.Font.Name = 'MS Sans Serif' Header.Font.Name = 'MS Sans Serif'
Header.Height = 24
Header.MainColumn = -1 Header.MainColumn = -1
Header.Options = [hoColumnResize, hoDrag] Header.Options = [hoColumnResize, hoDrag]
HintMode = hmTooltip HintMode = hmTooltip
@ -179,32 +185,33 @@ object MainForm: TMainForm
OnNewText = Tree1NewText OnNewText = Tree1NewText
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 12 Left = 8
Height = 245 Height = 224
Top = 308 Top = 328
Width = 685 Width = 686
ActivePage = TabSheet1 ActivePage = LogTabSheet
Anchors = [akTop, akLeft, akBottom] Anchors = [akTop, akLeft, akBottom]
TabIndex = 3 TabIndex = 1
TabOrder = 5 TabOrder = 5
object RichTextTabSheet: TTabSheet object RichTextTabSheet: TTabSheet
Caption = 'Rich text' Caption = 'Rich text'
ClientHeight = 217 ClientHeight = 196
ClientWidth = 677 ClientWidth = 678
ImageIndex = 1 ImageIndex = 1
TabVisible = False
object Label3: TLabel object Label3: TLabel
Left = 8 Left = 8
Height = 15 Height = 15
Top = 8 Top = 8
Width = 453 Width = 452
Caption = 'You can use the rich edit control as source and as target. It initiates OLE drag'' drop.' Caption = 'You can use the rich edit control as source and as target. It initiates OLE drag'' drop.'
ParentColor = False ParentColor = False
end end
end end
object LogTabSheet: TTabSheet object LogTabSheet: TTabSheet
Caption = 'Drag''n drop operation log' Caption = 'Drag''n drop operation log'
ClientHeight = 217 ClientHeight = 196
ClientWidth = 677 ClientWidth = 678
object Label7: TLabel object Label7: TLabel
Left = 6 Left = 6
Height = 41 Height = 41
@ -217,18 +224,19 @@ object MainForm: TMainForm
end end
object LogListBox: TListBox object LogListBox: TListBox
Left = 4 Left = 4
Height = 143 Height = 122
Hint = 'Use the list box to initiate a VCL drag''n drop.' Hint = 'Use the list box to initiate a VCL drag''n drop.'
Top = 56 Top = 56
Width = 661 Width = 662
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
DragMode = dmAutomatic DragMode = dmAutomatic
ItemHeight = 0
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 0 TabOrder = 0
end end
object Button2: TButton object Button2: TButton
Left = 590 Left = 591
Height = 25 Height = 25
Top = 10 Top = 10
Width = 75 Width = 75
@ -241,7 +249,7 @@ object MainForm: TMainForm
end end
object TabSheet2: TTabSheet object TabSheet2: TTabSheet
Caption = 'More info' Caption = 'More info'
ClientHeight = 217 ClientHeight = 197
ClientWidth = 677 ClientWidth = 677
ImageIndex = 3 ImageIndex = 3
object Label4: TLabel object Label4: TLabel
@ -277,7 +285,7 @@ object MainForm: TMainForm
end end
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Tips' Caption = 'Tips'
ClientHeight = 217 ClientHeight = 197
ClientWidth = 677 ClientWidth = 677
ImageIndex = 2 ImageIndex = 2
object Label8: TLabel object Label8: TLabel
@ -302,24 +310,39 @@ object MainForm: TMainForm
end end
end end
end end
object ShowHeader1CheckBox: TCheckBox
Left = 8
Height = 19
Top = 302
Width = 95
Caption = 'Show Header'
OnChange = ShowHeader1CheckBoxChange
TabOrder = 6
end
object ShowHeader2CheckBox: TCheckBox
Left = 364
Height = 19
Top = 302
Width = 95
Caption = 'Show Header'
OnChange = ShowHeader2CheckBoxChange
TabOrder = 7
end
object ActionList1: TActionList object ActionList1: TActionList
left = 724 left = 724
top = 156 top = 156
object CutAction: TAction object CutAction: TAction
Caption = 'Cut' Caption = 'Cut'
DisableIfNoHandler = True
OnExecute = CutActionExecute OnExecute = CutActionExecute
ShortCut = 16472 ShortCut = 16472
end end
object CopyAction: TAction object CopyAction: TAction
Caption = 'Copy' Caption = 'Copy'
DisableIfNoHandler = True
OnExecute = CopyActionExecute OnExecute = CopyActionExecute
ShortCut = 16451 ShortCut = 16451
end end
object PasteAction: TAction object PasteAction: TAction
Caption = 'Paste' Caption = 'Paste'
DisableIfNoHandler = True
OnExecute = PasteActionExecute OnExecute = PasteActionExecute
ShortCut = 16470 ShortCut = 16470
end end
@ -327,6 +350,8 @@ object MainForm: TMainForm
object FontDialog: TFontDialog object FontDialog: TFontDialog
Font.Height = -11 Font.Height = -11
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
MinFontSize = 0
MaxFontSize = 0
left = 756 left = 756
top = 168 top = 168
end end

View File

@ -19,6 +19,7 @@ type
TMainForm = class(TForm) TMainForm = class(TForm)
ActionList1: TActionList; ActionList1: TActionList;
ShowHeader1CheckBox: TCheckBox;
CutAction: TAction; CutAction: TAction;
CopyAction: TAction; CopyAction: TAction;
PasteAction: TAction; PasteAction: TAction;
@ -27,6 +28,7 @@ type
Label6: TLabel; Label6: TLabel;
Button1: TButton; Button1: TButton;
Button3: TButton; Button3: TButton;
ShowHeader2CheckBox: TCheckBox;
Tree2: TVirtualStringTree; Tree2: TVirtualStringTree;
Label1: TLabel; Label1: TLabel;
Tree1: TVirtualStringTree; Tree1: TVirtualStringTree;
@ -51,6 +53,8 @@ type
procedure CutActionExecute(Sender: TObject); procedure CutActionExecute(Sender: TObject);
procedure CopyActionExecute(Sender: TObject); procedure CopyActionExecute(Sender: TObject);
procedure PasteActionExecute(Sender: TObject); procedure PasteActionExecute(Sender: TObject);
procedure ShowHeader1CheckBoxChange(Sender: TObject);
procedure ShowHeader2CheckBoxChange(Sender: TObject);
procedure TreeFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode); procedure TreeFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure Tree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; procedure Tree1GetText(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var Text: String); var Text: String);
@ -71,7 +75,7 @@ type
procedure AddUnicodeText(DataObject: IDataObject; Target: TVirtualStringTree; Mode: TVTNodeAttachMode); procedure AddUnicodeText(DataObject: IDataObject; Target: TVirtualStringTree; Mode: TVTNodeAttachMode);
procedure AddVCLText(Target: TVirtualStringTree; const Text: String; Mode: TVTNodeAttachMode); procedure AddVCLText(Target: TVirtualStringTree; const Text: String; Mode: TVTNodeAttachMode);
function FindCPFormatDescription(CPFormat: Word): string; function FindCPFormatDescription(CPFormat: Word): string;
procedure InsertData(Sender: TVirtualStringTree; DataObject: IDataObject; Formats: TFormatArray; Effect: Integer; procedure InsertData(Sender: TVirtualStringTree; DataObject: IDataObject; Formats: TFormatArray; Effect: LongWord;
Mode: TVTNodeAttachMode); Mode: TVTNodeAttachMode);
end; end;
@ -187,6 +191,22 @@ begin
// RichEdit1.PasteFromClipboard; // RichEdit1.PasteFromClipboard;
end; end;
procedure TMainForm.ShowHeader1CheckBoxChange(Sender: TObject);
begin
if ShowHeader1CheckBox.Checked then
Tree1.Header.Options := Tree1.Header.Options + [hoVisible]
else
Tree1.Header.Options := Tree1.Header.Options - [hoVisible];
end;
procedure TMainForm.ShowHeader2CheckBoxChange(Sender: TObject);
begin
if ShowHeader2CheckBox.Checked then
Tree2.Header.Options := Tree2.Header.Options + [hoVisible]
else
Tree2.Header.Options := Tree2.Header.Options - [hoVisible];
end;
procedure TMainForm.TreeFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode); procedure TMainForm.TreeFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
var var
Data: PNodeData; Data: PNodeData;
@ -633,7 +653,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
procedure TMainForm.InsertData(Sender: TVirtualStringTree; DataObject: IDataObject; Formats: TFormatArray; procedure TMainForm.InsertData(Sender: TVirtualStringTree; DataObject: IDataObject; Formats: TFormatArray;
Effect: Integer; Mode: TVTNodeAttachMode); Effect: LongWord; Mode: TVTNodeAttachMode);
var var
FormatAccepted: Boolean; FormatAccepted: Boolean;

View File

@ -1,20 +1,22 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="7"/>
<General> <General>
<Flags> <Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/> <LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@ -42,20 +44,21 @@
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="Main.pas"/> <Filename Value="Main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/> <ComponentName Value="MainForm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="Main"/> <UnitName Value="Main"/>
</Unit1> </Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Parsing> <Parsing>
<SyntaxOptions> <SyntaxOptions>
<CStyleOperator Value="False"/> <CStyleOperator Value="False"/>
<UseAnsiStrings Value="False"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking> <Linking>

View File

@ -10,6 +10,8 @@ uses
Forms Forms
{ add your units here }, Main; { add your units here }, Main;
{$R *.res}
begin begin
Application.Initialize; Application.Initialize;
Application.CreateForm(TMainForm, MainForm); Application.CreateForm(TMainForm, MainForm);

View File

@ -3,32 +3,37 @@ object MainForm: TMainForm
Height = 504 Height = 504
Top = 166 Top = 166
Width = 613 Width = 613
Caption = 'Unicode Demo' Caption = 'VirtualTreeView Unicode Demo'
ClientHeight = 504 ClientHeight = 504
ClientWidth = 613 ClientWidth = 613
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '0.9.27' Position = poDesktopCenter
object MainNotebook: TNotebook LCLVersion = '1.1'
object MainNotebook: TPageControl
Left = 0
Height = 504 Height = 504
Top = 0
Width = 613 Width = 613
ActivePage = WelcomePage
Align = alClient Align = alClient
PageIndex = 0 TabIndex = 0
TabOrder = 0 TabOrder = 0
object WelcomePage: TPage object WelcomePage: TTabSheet
Caption = 'Welcome Translations' Caption = 'Welcome Translations'
ClientWidth = 605 ClientHeight = 465
ClientHeight = 478 ClientWidth = 607
object WelcomeTree: TVirtualStringTree object WelcomeTree: TVirtualStringTree
Left = 3 Left = 3
Height = 444 Height = 431
Top = 31 Top = 31
Width = 599 Width = 601
Align = alClient Align = alClient
BorderSpacing.Around = 3 BorderSpacing.Around = 3
BorderStyle = bsSingle
DefaultText = 'Node' DefaultText = 'Node'
Header.AutoSizeIndex = 0
Header.Columns = < Header.Columns = <
item item
Position = 0
Text = 'Language' Text = 'Language'
Width = 200 Width = 200
end end
@ -37,18 +42,22 @@ object MainForm: TMainForm
Text = 'Translation' Text = 'Translation'
Width = 200 Width = 200
end> end>
Header.DefaultHeight = 17
Header.Height = 20
Header.Options = [hoColumnResize, hoDrag, hoVisible] Header.Options = [hoColumnResize, hoDrag, hoVisible]
TabOrder = 0 TabOrder = 0
OnFreeNode = WelcomeTreeFreeNode OnFreeNode = WelcomeTreeFreeNode
OnGetText = WelcomeTreeGetText OnGetText = WelcomeTreeGetText
end end
object WelcomeTopPanel: TPanel object WelcomeTopPanel: TPanel
Left = 0
Height = 28 Height = 28
Width = 605 Top = 0
Width = 607
Align = alTop Align = alTop
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 28 ClientHeight = 28
ClientWidth = 605 ClientWidth = 607
TabOrder = 1 TabOrder = 1
object ChooseWelcomeFontButton: TButton object ChooseWelcomeFontButton: TButton
Left = 4 Left = 4
@ -63,23 +72,24 @@ object MainForm: TMainForm
end end
end end
end end
object LCLTextPage: TPage object LCLTextPage: TTabSheet
Caption = 'LCL Text' Caption = 'LCL Text'
ClientWidth = 605 ClientHeight = 465
ClientHeight = 478 ClientWidth = 607
object LCLTextTree: TVirtualStringTree object LCLTextTree: TVirtualStringTree
Left = 3 Left = 3
Height = 440 Height = 440
Top = 3 Top = 3
Width = 272 Width = 272
BorderSpacing.Around = 3 BorderSpacing.Around = 3
BorderStyle = bsSingle
DefaultText = 'Node' DefaultText = 'Node'
Header.AutoSizeIndex = 0
Header.Columns = <> Header.Columns = <>
Header.DefaultHeight = 17
Header.MainColumn = -1 Header.MainColumn = -1
Header.Options = [hoColumnResize, hoDrag] Header.Options = [hoColumnResize, hoDrag]
TabOrder = 0 TabOrder = 0
TreeOptions.MiscOptions = [toAcceptOLEDrop, toEditable, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning] TreeOptions.MiscOptions = [toEditable, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
OnFreeNode = LCLTextTreeFreeNode OnFreeNode = LCLTextTreeFreeNode
OnGetText = LCLTextTreeGetText OnGetText = LCLTextTreeGetText
OnNewText = LCLTextTreeNewText OnNewText = LCLTextTreeNewText
@ -95,7 +105,7 @@ object MainForm: TMainForm
end end
object TextEdit: TEdit object TextEdit: TEdit
Left = 284 Left = 284
Height = 23 Height = 21
Top = 2 Top = 2
Width = 184 Width = 184
TabOrder = 2 TabOrder = 2
@ -105,7 +115,7 @@ object MainForm: TMainForm
Height = 21 Height = 21
Top = 58 Top = 58
Width = 184 Width = 184
ItemHeight = 13 ItemHeight = 0
Items.Strings = ( Items.Strings = (
'Não' 'Não'
'Coração' 'Coração'
@ -132,8 +142,10 @@ object MainForm: TMainForm
'Coração' 'Coração'
'Sim' 'Sim'
) )
ItemHeight = 13 ItemHeight = 0
ScrollWidth = 182
TabOrder = 5 TabOrder = 5
TopIndex = -1
end end
object AddListTextButton: TButton object AddListTextButton: TButton
Left = 476 Left = 476
@ -172,6 +184,8 @@ object MainForm: TMainForm
end end
end end
object FontDialog1: TFontDialog object FontDialog1: TFontDialog
MinFontSize = 0
MaxFontSize = 0
left = 136 left = 136
top = 24 top = 24
end end

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, VirtualTrees, StdCtrls, LCLProc; ExtCtrls, VirtualTrees, StdCtrls, LCLProc, ComCtrls;
type type
@ -24,12 +24,12 @@ type
TextComboBox: TComboBox; TextComboBox: TComboBox;
TextEdit: TEdit; TextEdit: TEdit;
FontDialog1: TFontDialog; FontDialog1: TFontDialog;
MainNotebook: TNotebook; MainNotebook: TPageControl;
LCLTextPage: TPage; LCLTextPage: TTabsheet;
LCLTextTree: TVirtualStringTree; LCLTextTree: TVirtualStringTree;
WelcomeTopPanel: TPanel; WelcomeTopPanel: TPanel;
WelcomeTree: TVirtualStringTree; WelcomeTree: TVirtualStringTree;
WelcomePage: TPage; WelcomePage: TTabsheet;
procedure AddComboTextButtonClick(Sender: TObject); procedure AddComboTextButtonClick(Sender: TObject);
procedure AddEditTextButtonClick(Sender: TObject); procedure AddEditTextButtonClick(Sender: TObject);
procedure AddListTextButtonClick(Sender: TObject); procedure AddListTextButtonClick(Sender: TObject);

View File

@ -1,22 +1,20 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="7"/>
<General> <General>
<Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/> <ResourceType Value="res"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IgnoreBinaries Value="False"/> <IgnoreBinaries Value="False"/>
@ -26,7 +24,7 @@
<RunParams> <RunParams>
<local> <local>
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
@ -46,16 +44,24 @@
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="fmain.pas"/> <Filename Value="fmain.pas"/>
<ComponentName Value="MainForm"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="fMain"/> <UnitName Value="fMain"/>
</Unit1> </Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="10"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking> <Linking>
<Options> <Options>
<Win32> <Win32>
@ -64,6 +70,9 @@
</Options> </Options>
</Linking> </Linking>
<Other> <Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>

View File

@ -8,12 +8,12 @@ uses
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms Forms
{ you can add units after this }, fMain, LResources, virtualtreeview_package; { you can add units after this }, fMain;
{$IFDEF WINDOWS}{$R unicode.rc}{$ENDIF}
{$R *.res}
begin begin
{$I unicode.lrs}
Application.Initialize; Application.Initialize;
Application.CreateForm(TMainForm, MainForm); Application.CreateForm(TMainForm, MainForm);
Application.Run; Application.Run;

View File

@ -22,7 +22,7 @@ unit VTDBExample;
interface interface
uses uses
delphicompat, LCLIntf, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, delphicompat, LCLIntf, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, LCLType,
VirtualTrees, StdCtrls, ExtCtrls, sqlite3ds, Menus, VTreeData, Buttons, LResources; VirtualTrees, StdCtrls, ExtCtrls, sqlite3ds, Menus, VTreeData, Buttons, LResources;
type type
@ -113,8 +113,8 @@ implementation
r : TRect; r : TRect;
begin begin
{get size of desktop} {get size of desktop}
//todo: not implemented under gtk {$ifdef LCLWin32}
{$ifdef Windows} //todo: enable when SPI_GETWORKAREA is implemented
SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0); SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0);
Height := r.Bottom-Top; Height := r.Bottom-Top;
Width := r.Right-Left; Width := r.Right-Left;

View File

@ -3,7 +3,7 @@ object frmVTNoData: TfrmVTNoData
Height = 346 Height = 346
Top = 154 Top = 154
Width = 401 Width = 401
ActiveControl = VT ActiveControl = Panel1
Caption = 'Basic VT as a Tree (no node data used)' Caption = 'Basic VT as a Tree (no node data used)'
ClientHeight = 346 ClientHeight = 346
ClientWidth = 401 ClientWidth = 401
@ -14,9 +14,11 @@ object frmVTNoData: TfrmVTNoData
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
Position = poDefaultPosOnly Position = poDefaultPosOnly
LCLVersion = '0.9.27' LCLVersion = '0.9.29'
object Panel1: TPanel object Panel1: TPanel
Left = 0
Height = 346 Height = 346
Top = 0
Width = 401 Width = 401
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
@ -31,9 +33,10 @@ object frmVTNoData: TfrmVTNoData
Top = 7 Top = 7
Width = 387 Width = 387
Align = alClient Align = alClient
BorderStyle = bsSingle
DefaultText = 'Node' DefaultText = 'Node'
Header.AutoSizeIndex = 0
Header.Columns = <> Header.Columns = <>
Header.DefaultHeight = 17
Header.Font.Height = -11 Header.Font.Height = -11
Header.Font.Name = 'MS Shell Dlg 2' Header.Font.Name = 'MS Shell Dlg 2'
Header.MainColumn = -1 Header.MainColumn = -1
@ -64,7 +67,7 @@ object frmVTNoData: TfrmVTNoData
Left = 9 Left = 9
Height = 14 Height = 14
Top = 9 Top = 9
Width = 76 Width = 82
Alignment = taCenter Alignment = taCenter
Caption = 'VT.TreeOptions' Caption = 'VT.TreeOptions'
Font.Color = clRed Font.Color = clRed
@ -75,27 +78,27 @@ object frmVTNoData: TfrmVTNoData
end end
object chkCheckBoxes: TCheckBox object chkCheckBoxes: TCheckBox
Left = 180 Left = 180
Height = 17 Height = 22
Top = 7 Top = 7
Width = 81 Width = 93
Caption = 'Check Boxes' Caption = 'Check Boxes'
OnClick = chkCheckBoxesClick OnClick = chkCheckBoxesClick
TabOrder = 0 TabOrder = 0
end end
object chkFullExpand: TCheckBox object chkFullExpand: TCheckBox
Left = 100 Left = 100
Height = 17 Height = 22
Top = 7 Top = 7
Width = 75 Width = 86
Caption = 'Full Expand' Caption = 'Full Expand'
OnClick = chkFullExpandClick OnClick = chkFullExpandClick
TabOrder = 1 TabOrder = 1
end end
object chkShowLevel: TCheckBox object chkShowLevel: TCheckBox
Left = 271 Left = 271
Height = 17 Height = 22
Top = 7 Top = 7
Width = 74 Width = 86
Caption = 'Show Level' Caption = 'Show Level'
OnClick = chkShowLevelClick OnClick = chkShowLevelClick
TabOrder = 2 TabOrder = 2

View File

@ -20,7 +20,7 @@ interface
uses uses
delphicompat, LCLIntf, SysUtils, Variants, Classes, Graphics, Controls, Forms, delphicompat, LCLIntf, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, VirtualTrees, ExtCtrls, StdCtrls, LResources; Dialogs, VirtualTrees, ExtCtrls, StdCtrls, LResources, LCLType;
type type
TfrmVTNoData = TfrmVTNoData =
@ -167,7 +167,9 @@ implementation
'VariableNodeHeight', 'VariableNodeHeight',
'FullRowDrag', 'FullRowDrag',
'NodeHeightResize', 'NodeHeightResize',
'NodeHeightDblClickResize' 'NodeHeightDblClickResize',
'EditOnClick',
'EditOnDblClick'
); );
aPaintOpts : array[0..Ord(High(TVTPaintOption ))] of string[25] = aPaintOpts : array[0..Ord(High(TVTPaintOption ))] of string[25] =
@ -191,7 +193,8 @@ implementation
'UseBlendedSelection', // Enable alpha blending for node selections. 'UseBlendedSelection', // Enable alpha blending for node selections.
'StaticBackground', 'StaticBackground',
'ChildrenAbove', 'ChildrenAbove',
'FixedIndent' 'FixedIndent',
'UseExplorerTheme'
); );
aSelOpts : array[0..Ord(High(TVTSelectionOption))] of string[25] = aSelOpts : array[0..Ord(High(TVTSelectionOption))] of string[25] =
@ -268,8 +271,9 @@ implementation
var var
r : TRect; r : TRect;
begin begin
{$ifdef LCLWin32}
//todo: enable when SPI_GETWORKAREA is implemented
{get size of desktop} {get size of desktop}
{$ifdef Windows}
SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0); SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0);
Height := r.Bottom-Top; Height := r.Bottom-Top;
{$endif} {$endif}

View File

@ -3,8 +3,8 @@ unit ViewCode;
interface interface
uses uses
delphicompat, LCLIntf, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, DelphiCompat, LCLIntf, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, LResources, SynHighlighterPas, SynEdit; Dialogs, StdCtrls, LResources, SynHighlighterPas, SynEdit, LCLType;
type type
@ -29,7 +29,8 @@ implementation
r : TRect; r : TRect;
begin begin
{get size of desktop} {get size of desktop}
{$ifdef Windows} {$ifdef LCLWin32}
//todo: enable when SPI_GETWORKAREA is implemented
SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0); SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0);
Height := r.Bottom-Top; Height := r.Bottom-Top;
Width := r.Right-Left; Width := r.Right-Left;

View File

@ -1,23 +1,24 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="7"/>
<General> <General>
<Flags> <Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/> <LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions> </PublishOptions>
@ -50,9 +51,9 @@
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="Main.pas"/> <Filename Value="Main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmMain"/> <ComponentName Value="frmMain"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="Main"/> <UnitName Value="Main"/>
</Unit1> </Unit1>
@ -63,17 +64,17 @@
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="VTNoData.pas"/> <Filename Value="VTNoData.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmVTNoData"/> <ComponentName Value="frmVTNoData"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="VTNoData"/> <UnitName Value="VTNoData"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="VTPropEdit.pas"/> <Filename Value="VTPropEdit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmVTPropEdit"/> <ComponentName Value="frmVTPropEdit"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="VTPropEdit"/> <UnitName Value="VTPropEdit"/>
</Unit4> </Unit4>
@ -84,32 +85,37 @@
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="ViewCode.pas"/> <Filename Value="ViewCode.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmViewCode"/> <ComponentName Value="frmViewCode"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ViewCode"/> <UnitName Value="ViewCode"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<Filename Value="VTCheckList.pas"/> <Filename Value="VTCheckList.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmVTCheckList"/> <ComponentName Value="frmVTCheckList"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="VTCheckList"/> <UnitName Value="VTCheckList"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<Filename Value="VTDBExample.pas"/> <Filename Value="VTDBExample.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmVTDBExample"/> <ComponentName Value="frmVTDBExample"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="VTDBExample"/> <UnitName Value="VTDBExample"/>
</Unit8> </Unit8>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking> <Linking>
<Options> <Options>
<Win32> <Win32>

View File

@ -14,6 +14,8 @@ uses
{$endif} {$endif}
; ;
{$R *.res}
begin begin
{$ifdef DEBUG_VTV} {$ifdef DEBUG_VTV}
Logger.Channels.Add(TIPCChannel.Create); Logger.Channels.Add(TIPCChannel.Create);

View File

@ -0,0 +1,23 @@
//todo: properly implement
procedure AlphaBlend(Source, Destination: HDC; const R: TRect; const Target: TPoint; Mode: TBlendMode; ConstantAlpha, Bias: Integer);
begin
case Mode of
bmConstantAlpha,
bmPerPixelAlpha,
bmMasterAlpha,
bmConstantAlphaAndColor:
begin
BitBlt(Destination, Target.X, Target.Y, R.Right - R.Left, R.Bottom - R.Top, Source, R.Left, R.Right, SRCCOPY);
end;
end;
end;
function CalculateScanline(Bits: Pointer; Width, Height, Row: Integer): Pointer;
begin
Result := nil;
end;
function GetBitmapBitsFromBitmap(Bitmap: HBITMAP): Pointer;
begin
Result := nil;
end;

View File

@ -666,6 +666,7 @@ function TVTDragManager.GetIsDropTarget: Boolean;
begin begin
//Result := FIsDropTarget; //Result := FIsDropTarget;
Result := True;
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -754,7 +755,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.GiveFeedback(Effect: Integer): HResult; function TVTDragManager.GiveFeedback(Effect: LongWord): HResult;
begin begin
//Result := DRAGDROP_S_USEDEFAULTCURSORS; //Result := DRAGDROP_S_USEDEFAULTCURSORS;
@ -762,7 +763,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult;
var var
RButton, RButton,

View File

@ -1,12 +1,17 @@
uses uses
gtkdef, gdk2, GTKProc, Cairo; gtk2def, gdk2, GTK2Proc, Cairo, LCLVersion;
{$MACRO ON}
{$if lcl_fullversion > 1000000}
{$define TGtk2DeviceContext:=TGtkDeviceContext}
{$endif}
function gdk_cairo_create(drawable: PGdkDrawable): Pcairo_t cdecl external gdklib; function gdk_cairo_create(drawable: PGdkDrawable): Pcairo_t cdecl external gdklib;
procedure AlphaBlend(Source, Destination: HDC; const R: TRect; const Target: TPoint; Mode: TBlendMode; ConstantAlpha, Bias: Integer); procedure AlphaBlend(Source, Destination: HDC; const R: TRect; const Target: TPoint; Mode: TBlendMode; ConstantAlpha, Bias: Integer);
function GetContext(GtkDC: TGtkDeviceContext): Pcairo_t; function GetContext(GtkDC: TGtk2DeviceContext): Pcairo_t;
begin begin
Result := nil; Result := nil;
if (GtkDC <> nil) and (GtkDC.Drawable <> nil) then if (GtkDC <> nil) and (GtkDC.Drawable <> nil) then
@ -14,8 +19,8 @@ procedure AlphaBlend(Source, Destination: HDC; const R: TRect; const Target: TPo
end; end;
var var
SrcDC: TGtkDeviceContext absolute Source; SrcDC: TGtk2DeviceContext absolute Source;
DestDC: TGtkDeviceContext absolute Destination; DestDC: TGtk2DeviceContext absolute Destination;
SrcContext, DestContext: Pcairo_t; SrcContext, DestContext: Pcairo_t;
begin begin
case Mode of case Mode of

View File

@ -1,6 +1,8 @@
uses uses
qt4, qtobjects; qt4, qtobjects;
{$ASMMODE INTEL}
procedure AlphaBlendLineConstant(Source, Destination: Pointer; Count: Integer; ConstantAlpha, Bias: Integer); procedure AlphaBlendLineConstant(Source, Destination: Pointer; Count: Integer; ConstantAlpha, Bias: Integer);
// Blends a line of Count pixels from Source to Destination using a constant alpha value. // Blends a line of Count pixels from Source to Destination using a constant alpha value.
@ -8,13 +10,106 @@ procedure AlphaBlendLineConstant(Source, Destination: Pointer; Count: Integer; C
// ConstantAlpha must be in the range 0..255 where 0 means totally transparent (destination pixel only) // ConstantAlpha must be in the range 0..255 where 0 means totally transparent (destination pixel only)
// and 255 totally opaque (source pixel only). // and 255 totally opaque (source pixel only).
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
//windows
// RCX contains Source
// RDX contains Destination
// R8D contains Count
// R9D contains ConstantAlpha
// Bias is on the stack
//non windows
// RDI contains Source
// RSI contains Destination
// EDX contains Count
// ECX contains ConstantAlpha
// R8D contains Bias
//.NOFRAME
// Load XMM3 with the constant alpha value (replicate it for every component).
// Expand it to word size.
{$ifdef windows}
MOVD XMM3, R9D // ConstantAlpha
{$else}
MOVD XMM3, ECX // ConstantAlpha
{$endif}
PUNPCKLWD XMM3, XMM3
PUNPCKLDQ XMM3, XMM3
// Load XMM5 with the bias value.
{$ifdef windows}
MOVD XMM5, [Bias]
{$else}
MOVD XMM5, R8D //Bias
{$endif}
PUNPCKLWD XMM5, XMM5
PUNPCKLDQ XMM5, XMM5
// Load XMM4 with 128 to allow for saturated biasing.
MOV R10D, 128
MOVD XMM4, R10D
PUNPCKLWD XMM4, XMM4
PUNPCKLDQ XMM4, XMM4
@1: // The pixel loop calculates an entire pixel in one run.
// Note: The pixel byte values are expanded into the higher bytes of a word due
// to the way unpacking works. We compensate for this with an extra shift.
{$ifdef windows}
MOVD XMM1, DWORD PTR [RCX] // data is unaligned
MOVD XMM2, DWORD PTR [RDX] // data is unaligned
{$else}
MOVD XMM1, DWORD PTR [RDI] // data is unaligned
MOVD XMM2, DWORD PTR [RSI] // data is unaligned
{$endif}
PXOR XMM0, XMM0 // clear source pixel register for unpacking
PUNPCKLBW XMM0, XMM1{[RCX]} // unpack source pixel byte values into words
PSRLW XMM0, 8 // move higher bytes to lower bytes
PXOR XMM1, XMM1 // clear target pixel register for unpacking
PUNPCKLBW XMM1, XMM2{[RDX]} // unpack target pixel byte values into words
MOVQ XMM2, XMM1 // make a copy of the shifted values, we need them again
PSRLW XMM1, 8 // move higher bytes to lower bytes
// calculation is: target = (alpha * (source - target) + 256 * target) / 256
PSUBW XMM0, XMM1 // source - target
PMULLW XMM0, XMM3 // alpha * (source - target)
PADDW XMM0, XMM2 // add target (in shifted form)
PSRLW XMM0, 8 // divide by 256
// Bias is accounted for by conversion of range 0..255 to -128..127,
// doing a saturated add and convert back to 0..255.
PSUBW XMM0, XMM4
PADDSW XMM0, XMM5
PADDW XMM0, XMM4
PACKUSWB XMM0, XMM0 // convert words to bytes with saturation
{$ifdef windows}
MOVD DWORD PTR [RDX], XMM0 // store the result
{$else}
MOVD DWORD PTR [RSI], XMM0 // store the result
{$endif}
@3:
{$ifdef windows}
ADD RCX, 4
ADD RDX, 4
DEC R8D
{$else}
ADD RDI, 4
ADD RSI, 4
DEC EDX
{$endif}
JNZ @1
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// ConstantAlpha and Bias are on the stack // ConstantAlpha and Bias are on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -71,6 +166,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -80,13 +176,100 @@ procedure AlphaBlendLinePerPixel(Source, Destination: Pointer; Count, Bias: Inte
// Blends a line of Count pixels from Source to Destination using the alpha value of the source pixels. // Blends a line of Count pixels from Source to Destination using the alpha value of the source pixels.
// The layout of a pixel must be BGRA. // The layout of a pixel must be BGRA.
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
//windows
// RCX contains Source
// RDX contains Destination
// R8D contains Count
// R9D contains Bias
//non windows
// RDI contains Source
// RSI contains Destination
// EDX contains Count
// ECX contains Bias
//.NOFRAME
// Load XMM5 with the bias value.
{$ifdef windows}
MOVD XMM5, R9D // Bias
{$else}
MOVD XMM5, ECX // Bias
{$endif}
PUNPCKLWD XMM5, XMM5
PUNPCKLDQ XMM5, XMM5
// Load XMM4 with 128 to allow for saturated biasing.
MOV R10D, 128
MOVD XMM4, R10D
PUNPCKLWD XMM4, XMM4
PUNPCKLDQ XMM4, XMM4
@1: // The pixel loop calculates an entire pixel in one run.
// Note: The pixel byte values are expanded into the higher bytes of a word due
// to the way unpacking works. We compensate for this with an extra shift.
{$ifdef windows}
MOVD XMM1, DWORD PTR [RCX] // data is unaligned
MOVD XMM2, DWORD PTR [RDX] // data is unaligned
{$else}
MOVD XMM1, DWORD PTR [RDI] // data is unaligned
MOVD XMM2, DWORD PTR [RSI] // data is unaligned
{$endif}
PXOR XMM0, XMM0 // clear source pixel register for unpacking
PUNPCKLBW XMM0, XMM1{[RCX]} // unpack source pixel byte values into words
PSRLW XMM0, 8 // move higher bytes to lower bytes
PXOR XMM1, XMM1 // clear target pixel register for unpacking
PUNPCKLBW XMM1, XMM2{[RDX]} // unpack target pixel byte values into words
MOVQ XMM2, XMM1 // make a copy of the shifted values, we need them again
PSRLW XMM1, 8 // move higher bytes to lower bytes
// Load XMM3 with the source alpha value (replicate it for every component).
// Expand it to word size.
MOVQ XMM3, XMM0
PUNPCKHWD XMM3, XMM3
PUNPCKHDQ XMM3, XMM3
// calculation is: target = (alpha * (source - target) + 256 * target) / 256
PSUBW XMM0, XMM1 // source - target
PMULLW XMM0, XMM3 // alpha * (source - target)
PADDW XMM0, XMM2 // add target (in shifted form)
PSRLW XMM0, 8 // divide by 256
// Bias is accounted for by conversion of range 0..255 to -128..127,
// doing a saturated add and convert back to 0..255.
PSUBW XMM0, XMM4
PADDSW XMM0, XMM5
PADDW XMM0, XMM4
PACKUSWB XMM0, XMM0 // convert words to bytes with saturation
{$ifdef windows}
MOVD DWORD PTR [RDX], XMM0 // store the result
{$else}
MOVD DWORD PTR [RSI], XMM0 // store the result
{$endif}
@3:
{$ifdef windows}
ADD RCX, 4
ADD RDX, 4
DEC R8D
{$else}
ADD RDI, 4
ADD RSI, 4
DEC EDX
{$endif}
JNZ @1
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// Bias is on the stack // Bias is on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -142,6 +325,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -152,13 +336,115 @@ procedure AlphaBlendLineMaster(Source, Destination: Pointer; Count: Integer; Con
// The layout of a pixel must be BGRA. // The layout of a pixel must be BGRA.
// ConstantAlpha must be in the range 0..255. // ConstantAlpha must be in the range 0..255.
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
//windows
// RCX contains Source
// RDX contains Destination
// R8D contains Count
// R9D contains ConstantAlpha
// Bias is on the stack
//non windows
// RDI contains Source
// RSI contains Destination
// EDX contains Count
// ECX contains ConstantAlpha
// R8D contains Bias
//.SAVENV XMM6 //todo see how implement in fpc
// Load XMM3 with the constant alpha value (replicate it for every component).
// Expand it to word size.
{$ifdef windows}
MOVD XMM3, R9D // ConstantAlpha
{$else}
MOVD XMM3, ECX // ConstantAlpha
{$endif}
PUNPCKLWD XMM3, XMM3
PUNPCKLDQ XMM3, XMM3
// Load XMM5 with the bias value.
{$ifdef windows}
MOV R10D, [Bias]
MOVD XMM5, R10D
{$else}
MOVD XMM5, R8D
{$endif}
PUNPCKLWD XMM5, XMM5
PUNPCKLDQ XMM5, XMM5
// Load XMM4 with 128 to allow for saturated biasing.
MOV R10D, 128
MOVD XMM4, R10D
PUNPCKLWD XMM4, XMM4
PUNPCKLDQ XMM4, XMM4
@1: // The pixel loop calculates an entire pixel in one run.
// Note: The pixel byte values are expanded into the higher bytes of a word due
// to the way unpacking works. We compensate for this with an extra shift.
{$ifdef windows}
MOVD XMM1, DWORD PTR [RCX] // data is unaligned
MOVD XMM2, DWORD PTR [RDX] // data is unaligned
{$else}
MOVD XMM1, DWORD PTR [RDI] // data is unaligned
MOVD XMM2, DWORD PTR [RSI] // data is unaligned
{$endif}
PXOR XMM0, XMM0 // clear source pixel register for unpacking
PUNPCKLBW XMM0, XMM1{[RCX]} // unpack source pixel byte values into words
PSRLW XMM0, 8 // move higher bytes to lower bytes
PXOR XMM1, XMM1 // clear target pixel register for unpacking
PUNPCKLBW XMM1, XMM2{[RCX]} // unpack target pixel byte values into words
MOVQ XMM2, XMM1 // make a copy of the shifted values, we need them again
PSRLW XMM1, 8 // move higher bytes to lower bytes
// Load XMM6 with the source alpha value (replicate it for every component).
// Expand it to word size.
MOVQ XMM6, XMM0
PUNPCKHWD XMM6, XMM6
PUNPCKHDQ XMM6, XMM6
PMULLW XMM6, XMM3 // source alpha * master alpha
PSRLW XMM6, 8 // divide by 256
// calculation is: target = (alpha * master alpha * (source - target) + 256 * target) / 256
PSUBW XMM0, XMM1 // source - target
PMULLW XMM0, XMM6 // alpha * (source - target)
PADDW XMM0, XMM2 // add target (in shifted form)
PSRLW XMM0, 8 // divide by 256
// Bias is accounted for by conversion of range 0..255 to -128..127,
// doing a saturated add and convert back to 0..255.
PSUBW XMM0, XMM4
PADDSW XMM0, XMM5
PADDW XMM0, XMM4
PACKUSWB XMM0, XMM0 // convert words to bytes with saturation
{$ifdef windows}
MOVD DWORD PTR [RDX], XMM0 // store the result
{$else}
MOVD DWORD PTR [RSI], XMM0 // store the result
{$endif}
@3:
{$ifdef windows}
ADD RCX, 4
ADD RDX, 4
DEC R8D
{$else}
ADD RDI, 4
ADD RSI, 4
DEC EDX
{$endif}
JNZ @1
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// ConstantAlpha and Bias are on the stack // ConstantAlpha and Bias are on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -223,6 +509,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -232,13 +519,94 @@ procedure AlphaBlendLineMasterAndColor(Destination: Pointer; Count: Integer; Con
// Blends a line of Count pixels in Destination against the given color using a constant alpha value. // Blends a line of Count pixels in Destination against the given color using a constant alpha value.
// The layout of a pixel must be BGRA and Color must be rrggbb00 (as stored by a COLORREF). // The layout of a pixel must be BGRA and Color must be rrggbb00 (as stored by a COLORREF).
// ConstantAlpha must be in the range 0..255. // ConstantAlpha must be in the range 0..255.
//
asm
{$ifdef CPU64}
//windows
// RCX contains Destination
// EDX contains Count
// R8D contains ConstantAlpha
// R9D contains Color
//non windows
// RDI contains Destination
// ESI contains Count
// EDX contains ConstantAlpha
// ECX contains Color
//.NOFRAME
// The used formula is: target = (alpha * color + (256 - alpha) * target) / 256.
// alpha * color (factor 1) and 256 - alpha (factor 2) are constant values which can be calculated in advance.
// The remaining calculation is therefore: target = (F1 + F2 * target) / 256
// Load XMM3 with the constant alpha value (replicate it for every component).
// Expand it to word size. (Every calculation here works on word sized operands.)
{$ifdef windows}
MOVD XMM3, R8D // ConstantAlpha
{$else}
MOVD XMM3, EDX // ConstantAlpha
{$endif}
PUNPCKLWD XMM3, XMM3
PUNPCKLDQ XMM3, XMM3
// Calculate factor 2.
MOV R10D, $100
MOVD XMM2, R10D
PUNPCKLWD XMM2, XMM2
PUNPCKLDQ XMM2, XMM2
PSUBW XMM2, XMM3 // XMM2 contains now: 255 - alpha = F2
// Now calculate factor 1. Alpha is still in XMM3, but the r and b components of Color must be swapped.
{$ifdef windows}
BSWAP R9D // Color
ROR R9D, 8
MOVD XMM1, R9D // Load the color and convert to word sized values.
{$else}
BSWAP ECX // Color
ROR ECX, 8
MOVD XMM1, ECX // Load the color and convert to word sized values.
{$endif}
PXOR XMM4, XMM4
PUNPCKLBW XMM1, XMM4
PMULLW XMM1, XMM3 // XMM1 contains now: color * alpha = F1
@1: // The pixel loop calculates an entire pixel in one run.
{$ifdef windows}
MOVD XMM0, DWORD PTR [RCX]
{$else}
MOVD XMM0, DWORD PTR [RDI]
{$endif}
PUNPCKLBW XMM0, XMM4
PMULLW XMM0, XMM2 // calculate F1 + F2 * target
PADDW XMM0, XMM1
PSRLW XMM0, 8 // divide by 256
PACKUSWB XMM0, XMM0 // convert words to bytes with saturation
{$ifdef windows}
MOVD DWORD PTR [RCX], XMM0 // store the result
ADD RCX, 4
DEC EDX
{$else}
MOVD DWORD PTR [RDI], XMM0 // store the result
ADD RDI, 4
DEC ESI
{$endif}
JNZ @1
{$else}
// EAX contains Destination // EAX contains Destination
// EDX contains Count // EDX contains Count
// ECX contains ConstantAlpha // ECX contains ConstantAlpha
// Color is passed on the stack // Color is passed on the stack
asm
// The used formula is: target = (alpha * color + (256 - alpha) * target) / 256. // The used formula is: target = (alpha * color + (256 - alpha) * target) / 256.
// alpha * color (factor 1) and 256 - alpha (factor 2) are constant values which can be calculated in advance. // alpha * color (factor 1) and 256 - alpha (factor 2) are constant values which can be calculated in advance.
// The remaining calculation is therefore: target = (F1 + F2 * target) / 256 // The remaining calculation is therefore: target = (F1 + F2 * target) / 256
@ -279,6 +647,7 @@ asm
ADD EAX, 4 ADD EAX, 4
DEC EDX DEC EDX
JNZ @1 JNZ @1
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -287,9 +656,17 @@ procedure EMMS;
// Reset MMX state to use the FPU for other tasks again. // Reset MMX state to use the FPU for other tasks again.
{$ifdef CPU64}
inline;
begin
end;
{$else}
asm asm
DB $0F, $77 /// EMMS DB $0F, $77 /// EMMS
end; end;
{$endif}
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -386,6 +763,11 @@ var
begin begin
if not IsRectEmpty(R) then if not IsRectEmpty(R) then
begin begin
{$ifdef CPU64}
//avoid MasterAlpha due to incomplete AlphaBlendLineMaster. See comment in procedure
if Mode = bmMasterAlpha then
Mode := bmConstantAlpha;
{$endif}
// Note: it is tempting to optimize the special cases for constant alpha 0 and 255 by just ignoring soure // Note: it is tempting to optimize the special cases for constant alpha 0 and 255 by just ignoring soure
// (alpha = 0) or simply do a blit (alpha = 255). But this does not take the bias into account. // (alpha = 0) or simply do a blit (alpha = 255). But this does not take the bias into account.
case Mode of case Mode of

View File

@ -1,4 +1,6 @@
{$ASMMODE INTEL}
procedure AlphaBlendLineConstant(Source, Destination: Pointer; Count: Integer; ConstantAlpha, Bias: Integer); procedure AlphaBlendLineConstant(Source, Destination: Pointer; Count: Integer; ConstantAlpha, Bias: Integer);
// Blends a line of Count pixels from Source to Destination using a constant alpha value. // Blends a line of Count pixels from Source to Destination using a constant alpha value.
@ -6,13 +8,75 @@ procedure AlphaBlendLineConstant(Source, Destination: Pointer; Count: Integer; C
// ConstantAlpha must be in the range 0..255 where 0 means totally transparent (destination pixel only) // ConstantAlpha must be in the range 0..255 where 0 means totally transparent (destination pixel only)
// and 255 totally opaque (source pixel only). // and 255 totally opaque (source pixel only).
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
// RCX contains Source
// RDX contains Destination
// R8D contains Count
// R9D contains ConstantAlpha
// Bias is on the stack
//.NOFRAME
// Load XMM3 with the constant alpha value (replicate it for every component).
// Expand it to word size.
MOVD XMM3, R9D // ConstantAlpha
PUNPCKLWD XMM3, XMM3
PUNPCKLDQ XMM3, XMM3
// Load XMM5 with the bias value.
MOVD XMM5, [Bias]
PUNPCKLWD XMM5, XMM5
PUNPCKLDQ XMM5, XMM5
// Load XMM4 with 128 to allow for saturated biasing.
MOV R10D, 128
MOVD XMM4, R10D
PUNPCKLWD XMM4, XMM4
PUNPCKLDQ XMM4, XMM4
@1: // The pixel loop calculates an entire pixel in one run.
// Note: The pixel byte values are expanded into the higher bytes of a word due
// to the way unpacking works. We compensate for this with an extra shift.
MOVD XMM1, DWORD PTR [RCX] // data is unaligned
MOVD XMM2, DWORD PTR [RDX] // data is unaligned
PXOR XMM0, XMM0 // clear source pixel register for unpacking
PUNPCKLBW XMM0, XMM1{[RCX]} // unpack source pixel byte values into words
PSRLW XMM0, 8 // move higher bytes to lower bytes
PXOR XMM1, XMM1 // clear target pixel register for unpacking
PUNPCKLBW XMM1, XMM2{[RDX]} // unpack target pixel byte values into words
MOVQ XMM2, XMM1 // make a copy of the shifted values, we need them again
PSRLW XMM1, 8 // move higher bytes to lower bytes
// calculation is: target = (alpha * (source - target) + 256 * target) / 256
PSUBW XMM0, XMM1 // source - target
PMULLW XMM0, XMM3 // alpha * (source - target)
PADDW XMM0, XMM2 // add target (in shifted form)
PSRLW XMM0, 8 // divide by 256
// Bias is accounted for by conversion of range 0..255 to -128..127,
// doing a saturated add and convert back to 0..255.
PSUBW XMM0, XMM4
PADDSW XMM0, XMM5
PADDW XMM0, XMM4
PACKUSWB XMM0, XMM0 // convert words to bytes with saturation
MOVD DWORD PTR [RDX], XMM0 // store the result
@3:
ADD RCX, 4
ADD RDX, 4
DEC R8D
JNZ @1
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// ConstantAlpha and Bias are on the stack // ConstantAlpha and Bias are on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -69,6 +133,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -78,13 +143,74 @@ procedure AlphaBlendLinePerPixel(Source, Destination: Pointer; Count, Bias: Inte
// Blends a line of Count pixels from Source to Destination using the alpha value of the source pixels. // Blends a line of Count pixels from Source to Destination using the alpha value of the source pixels.
// The layout of a pixel must be BGRA. // The layout of a pixel must be BGRA.
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
// RCX contains Source
// RDX contains Destination
// R8D contains Count
// R9D contains Bias
//.NOFRAME
// Load XMM5 with the bias value.
MOVD XMM5, R9D // Bias
PUNPCKLWD XMM5, XMM5
PUNPCKLDQ XMM5, XMM5
// Load XMM4 with 128 to allow for saturated biasing.
MOV R10D, 128
MOVD XMM4, R10D
PUNPCKLWD XMM4, XMM4
PUNPCKLDQ XMM4, XMM4
@1: // The pixel loop calculates an entire pixel in one run.
// Note: The pixel byte values are expanded into the higher bytes of a word due
// to the way unpacking works. We compensate for this with an extra shift.
MOVD XMM1, DWORD PTR [RCX] // data is unaligned
MOVD XMM2, DWORD PTR [RDX] // data is unaligned
PXOR XMM0, XMM0 // clear source pixel register for unpacking
PUNPCKLBW XMM0, XMM1{[RCX]} // unpack source pixel byte values into words
PSRLW XMM0, 8 // move higher bytes to lower bytes
PXOR XMM1, XMM1 // clear target pixel register for unpacking
PUNPCKLBW XMM1, XMM2{[RDX]} // unpack target pixel byte values into words
MOVQ XMM2, XMM1 // make a copy of the shifted values, we need them again
PSRLW XMM1, 8 // move higher bytes to lower bytes
// Load XMM3 with the source alpha value (replicate it for every component).
// Expand it to word size.
MOVQ XMM3, XMM0
PUNPCKHWD XMM3, XMM3
PUNPCKHDQ XMM3, XMM3
// calculation is: target = (alpha * (source - target) + 256 * target) / 256
PSUBW XMM0, XMM1 // source - target
PMULLW XMM0, XMM3 // alpha * (source - target)
PADDW XMM0, XMM2 // add target (in shifted form)
PSRLW XMM0, 8 // divide by 256
// Bias is accounted for by conversion of range 0..255 to -128..127,
// doing a saturated add and convert back to 0..255.
PSUBW XMM0, XMM4
PADDSW XMM0, XMM5
PADDW XMM0, XMM4
PACKUSWB XMM0, XMM0 // convert words to bytes with saturation
MOVD DWORD PTR [RDX], XMM0 // store the result
@3:
ADD RCX, 4
ADD RDX, 4
DEC R8D
JNZ @1
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// Bias is on the stack // Bias is on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -140,6 +266,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -150,13 +277,84 @@ procedure AlphaBlendLineMaster(Source, Destination: Pointer; Count: Integer; Con
// The layout of a pixel must be BGRA. // The layout of a pixel must be BGRA.
// ConstantAlpha must be in the range 0..255. // ConstantAlpha must be in the range 0..255.
// Bias is an additional value which gets added to every component and must be in the range -128..127 // Bias is an additional value which gets added to every component and must be in the range -128..127
//
asm
{$ifdef CPU64}
// RCX contains Source
// RDX contains Destination
// R8D contains Count
// R9D contains ConstantAlpha
// Bias is on the stack
//.SAVENV XMM6 //todo see how implement in fpc AlphaBlendLineMaster
// Load XMM3 with the constant alpha value (replicate it for every component).
// Expand it to word size.
MOVD XMM3, R9D // ConstantAlpha
PUNPCKLWD XMM3, XMM3
PUNPCKLDQ XMM3, XMM3
// Load XMM5 with the bias value.
MOV R10D, [Bias]
MOVD XMM5, R10D
PUNPCKLWD XMM5, XMM5
PUNPCKLDQ XMM5, XMM5
// Load XMM4 with 128 to allow for saturated biasing.
MOV R10D, 128
MOVD XMM4, R10D
PUNPCKLWD XMM4, XMM4
PUNPCKLDQ XMM4, XMM4
@1: // The pixel loop calculates an entire pixel in one run.
// Note: The pixel byte values are expanded into the higher bytes of a word due
// to the way unpacking works. We compensate for this with an extra shift.
MOVD XMM1, DWORD PTR [RCX] // data is unaligned
MOVD XMM2, DWORD PTR [RDX] // data is unaligned
PXOR XMM0, XMM0 // clear source pixel register for unpacking
PUNPCKLBW XMM0, XMM1{[RCX]} // unpack source pixel byte values into words
PSRLW XMM0, 8 // move higher bytes to lower bytes
PXOR XMM1, XMM1 // clear target pixel register for unpacking
PUNPCKLBW XMM1, XMM2{[RCX]} // unpack target pixel byte values into words
MOVQ XMM2, XMM1 // make a copy of the shifted values, we need them again
PSRLW XMM1, 8 // move higher bytes to lower bytes
// Load XMM6 with the source alpha value (replicate it for every component).
// Expand it to word size.
MOVQ XMM6, XMM0
PUNPCKHWD XMM6, XMM6
PUNPCKHDQ XMM6, XMM6
PMULLW XMM6, XMM3 // source alpha * master alpha
PSRLW XMM6, 8 // divide by 256
// calculation is: target = (alpha * master alpha * (source - target) + 256 * target) / 256
PSUBW XMM0, XMM1 // source - target
PMULLW XMM0, XMM6 // alpha * (source - target)
PADDW XMM0, XMM2 // add target (in shifted form)
PSRLW XMM0, 8 // divide by 256
// Bias is accounted for by conversion of range 0..255 to -128..127,
// doing a saturated add and convert back to 0..255.
PSUBW XMM0, XMM4
PADDSW XMM0, XMM5
PADDW XMM0, XMM4
PACKUSWB XMM0, XMM0 // convert words to bytes with saturation
MOVD DWORD PTR [RDX], XMM0 // store the result
@3:
ADD RCX, 4
ADD RDX, 4
DEC R8D
JNZ @1
{$else}
// EAX contains Source // EAX contains Source
// EDX contains Destination // EDX contains Destination
// ECX contains Count // ECX contains Count
// ConstantAlpha and Bias are on the stack // ConstantAlpha and Bias are on the stack
asm
PUSH ESI // save used registers PUSH ESI // save used registers
PUSH EDI PUSH EDI
@ -221,6 +419,7 @@ asm
JNZ @1 JNZ @1
POP EDI POP EDI
POP ESI POP ESI
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -230,13 +429,65 @@ procedure AlphaBlendLineMasterAndColor(Destination: Pointer; Count: Integer; Con
// Blends a line of Count pixels in Destination against the given color using a constant alpha value. // Blends a line of Count pixels in Destination against the given color using a constant alpha value.
// The layout of a pixel must be BGRA and Color must be rrggbb00 (as stored by a COLORREF). // The layout of a pixel must be BGRA and Color must be rrggbb00 (as stored by a COLORREF).
// ConstantAlpha must be in the range 0..255. // ConstantAlpha must be in the range 0..255.
//
asm
{$ifdef CPU64}
// RCX contains Destination
// EDX contains Count
// R8D contains ConstantAlpha
// R9D contains Color
//.NOFRAME
// The used formula is: target = (alpha * color + (256 - alpha) * target) / 256.
// alpha * color (factor 1) and 256 - alpha (factor 2) are constant values which can be calculated in advance.
// The remaining calculation is therefore: target = (F1 + F2 * target) / 256
// Load XMM3 with the constant alpha value (replicate it for every component).
// Expand it to word size. (Every calculation here works on word sized operands.)
MOVD XMM3, R8D // ConstantAlpha
PUNPCKLWD XMM3, XMM3
PUNPCKLDQ XMM3, XMM3
// Calculate factor 2.
MOV R10D, $100
MOVD XMM2, R10D
PUNPCKLWD XMM2, XMM2
PUNPCKLDQ XMM2, XMM2
PSUBW XMM2, XMM3 // XMM2 contains now: 255 - alpha = F2
// Now calculate factor 1. Alpha is still in XMM3, but the r and b components of Color must be swapped.
BSWAP R9D // Color
ROR R9D, 8
MOVD XMM1, R9D // Load the color and convert to word sized values.
PXOR XMM4, XMM4
PUNPCKLBW XMM1, XMM4
PMULLW XMM1, XMM3 // XMM1 contains now: color * alpha = F1
@1: // The pixel loop calculates an entire pixel in one run.
MOVD XMM0, DWORD PTR [RCX]
PUNPCKLBW XMM0, XMM4
PMULLW XMM0, XMM2 // calculate F1 + F2 * target
PADDW XMM0, XMM1
PSRLW XMM0, 8 // divide by 256
PACKUSWB XMM0, XMM0 // convert words to bytes with saturation
MOVD DWORD PTR [RCX], XMM0 // store the result
ADD RCX, 4
DEC EDX
JNZ @1
{$else}
// EAX contains Destination // EAX contains Destination
// EDX contains Count // EDX contains Count
// ECX contains ConstantAlpha // ECX contains ConstantAlpha
// Color is passed on the stack // Color is passed on the stack
asm
// The used formula is: target = (alpha * color + (256 - alpha) * target) / 256. // The used formula is: target = (alpha * color + (256 - alpha) * target) / 256.
// alpha * color (factor 1) and 256 - alpha (factor 2) are constant values which can be calculated in advance. // alpha * color (factor 1) and 256 - alpha (factor 2) are constant values which can be calculated in advance.
// The remaining calculation is therefore: target = (F1 + F2 * target) / 256 // The remaining calculation is therefore: target = (F1 + F2 * target) / 256
@ -277,6 +528,7 @@ asm
ADD EAX, 4 ADD EAX, 4
DEC EDX DEC EDX
JNZ @1 JNZ @1
{$endif}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -285,9 +537,17 @@ procedure EMMS;
// Reset MMX state to use the FPU for other tasks again. // Reset MMX state to use the FPU for other tasks again.
{$ifdef CPU64}
inline;
begin
end;
{$else}
asm asm
DB $0F, $77 /// EMMS DB $0F, $77 /// EMMS
end; end;
{$endif}
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -383,6 +643,11 @@ var
begin begin
if not IsRectEmpty(R) then if not IsRectEmpty(R) then
begin begin
{$ifdef CPU64}
//avoid MasterAlpha due to incomplete AlphaBlendLineMaster. See comment in procedure
if Mode = bmMasterAlpha then
Mode := bmConstantAlpha;
{$endif}
// Note: it is tempting to optimize the special cases for constant alpha 0 and 255 by just ignoring soure // Note: it is tempting to optimize the special cases for constant alpha 0 and 255 by just ignoring soure
// (alpha = 0) or simply do a blit (alpha = 255). But this does not take the bias into account. // (alpha = 0) or simply do a blit (alpha = 255). But this does not take the bias into account.
case Mode of case Mode of

View File

@ -481,7 +481,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDataObject.SetData(const FormatEtc: TFormatEtc; {$ifdef VER2_0}var{$else}const{$endif} Medium: TStgMedium; DoRelease: BOOL): HResult; function TVTDataObject.SetData(const FormatEtc: TFormatEtc; const Medium: TStgMedium; DoRelease: BOOL): HResult;
// Allows dynamic adding to the IDataObject during its existance. Most noteably it is used to implement // Allows dynamic adding to the IDataObject during its existance. Most noteably it is used to implement
// IDropSourceHelper and allows to set a special format for optimized moves during a shell transfer. // IDropSourceHelper and allows to set a special format for optimized moves during a shell transfer.
@ -686,7 +686,11 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.GiveFeedback(Effect: Integer): HResult; {$IF FPC_FULLVERSION < 020601}
function TVTDragManager.GiveFeedback(Effect: Longint): HResult;
{$ELSE}
function TVTDragManager.GiveFeedback(Effect: LongWord): HResult;
{$ENDIF}
begin begin
Result := DRAGDROP_S_USEDEFAULTCURSORS; Result := DRAGDROP_S_USEDEFAULTCURSORS;
@ -694,7 +698,11 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; {$IF FPC_FULLVERSION < 020601}
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Longint): HResult;
{$ELSE}
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult;
{$ENDIF}
var var
RButton, RButton,

View File

@ -291,8 +291,8 @@ type
IDropSource = interface(IUnknown) IDropSource = interface(IUnknown)
['{00000121-0000-0000-C000-000000000046}'] ['{00000121-0000-0000-C000-000000000046}']
function QueryContinueDrag(fEscapePressed: BOOL; function QueryContinueDrag(fEscapePressed: BOOL;
grfKeyState: Longint):HResult;StdCall; grfKeyState: LongWord):HResult;StdCall;
function GiveFeedback(dwEffect: Longint): HResult;StdCall; function GiveFeedback(dwEffect: LongWord): HResult;StdCall;
end; end;
@ -332,10 +332,10 @@ type
IDropTargetHelper = interface(IUnknown) IDropTargetHelper = interface(IUnknown)
[SID_IDropTargetHelper] [SID_IDropTargetHelper]
function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function DragLeave: HRESULT; stdcall; function DragLeave: HRESULT; stdcall;
function DragOver(var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragOver(var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Show(fShow: Boolean): HRESULT; stdcall; function Show(fShow: Boolean): HRESULT; stdcall;
end; end;
@ -434,8 +434,8 @@ type
function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
procedure ForceDragLeave; stdcall; procedure ForceDragLeave; stdcall;
function GiveFeedback(Effect: Integer): HResult; stdcall; function GiveFeedback(Effect: LongWord): HResult; stdcall;
function QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; stdcall; function QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult; stdcall;
end; end;
//Ole helper functions //Ole helper functions
@ -1583,7 +1583,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.GiveFeedback(Effect: Integer): HResult; function TVTDragManager.GiveFeedback(Effect: LongWord): HResult;
begin begin
{$ifdef DEBUG_VTV}Logger.SendError([lcOle],'Ole function called in Linux');{$endif} {$ifdef DEBUG_VTV}Logger.SendError([lcOle],'Ole function called in Linux');{$endif}
@ -1593,7 +1593,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult;
var var
RButton, RButton,

View File

@ -281,8 +281,8 @@ type
IDropSource = interface(IUnknown) IDropSource = interface(IUnknown)
['{00000121-0000-0000-C000-000000000046}'] ['{00000121-0000-0000-C000-000000000046}']
function QueryContinueDrag(fEscapePressed: BOOL; function QueryContinueDrag(fEscapePressed: BOOL;
grfKeyState: Longint):HResult;StdCall; grfKeyState: DWORD):HResult;StdCall;
function GiveFeedback(dwEffect: Longint): HResult;StdCall; function GiveFeedback(dwEffect: DWORD): HResult;StdCall;
end; end;

View File

@ -291,8 +291,8 @@ type
IDropSource = interface(IUnknown) IDropSource = interface(IUnknown)
['{00000121-0000-0000-C000-000000000046}'] ['{00000121-0000-0000-C000-000000000046}']
function QueryContinueDrag(fEscapePressed: BOOL; function QueryContinueDrag(fEscapePressed: BOOL;
grfKeyState: Longint):HResult;StdCall; grfKeyState: LongWord):HResult;StdCall;
function GiveFeedback(dwEffect: Longint): HResult;StdCall; function GiveFeedback(dwEffect: LongWord): HResult;StdCall;
end; end;
@ -332,10 +332,10 @@ type
IDropTargetHelper = interface(IUnknown) IDropTargetHelper = interface(IUnknown)
[SID_IDropTargetHelper] [SID_IDropTargetHelper]
function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function DragLeave: HRESULT; stdcall; function DragLeave: HRESULT; stdcall;
function DragOver(var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragOver(var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Show(fShow: Boolean): HRESULT; stdcall; function Show(fShow: Boolean): HRESULT; stdcall;
end; end;
@ -434,8 +434,8 @@ type
function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
procedure ForceDragLeave; stdcall; procedure ForceDragLeave; stdcall;
function GiveFeedback(Effect: Integer): HResult; stdcall; function GiveFeedback(Effect: LongWord): HResult; stdcall;
function QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; stdcall; function QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult; stdcall;
end; end;
//Ole helper functions //Ole helper functions
@ -1583,7 +1583,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.GiveFeedback(Effect: Integer): HResult; function TVTDragManager.GiveFeedback(Effect: LongWord): HResult;
begin begin
{$ifdef DEBUG_VTV}Logger.SendError([lcOle],'Ole function called in Linux');{$endif} {$ifdef DEBUG_VTV}Logger.SendError([lcOle],'Ole function called in Linux');{$endif}
@ -1593,7 +1593,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult;
var var
RButton, RButton,

View File

@ -5,7 +5,7 @@ unit fakemmsystem;
interface interface
uses uses
Classes, SysUtils, Types; Classes, SysUtils, Types, LCLIntf;
function timeBeginPeriod(x1: DWord): DWord; function timeBeginPeriod(x1: DWord): DWord;
@ -17,21 +17,17 @@ implementation
function timeBeginPeriod(x1: DWord): DWord; function timeBeginPeriod(x1: DWord): DWord;
begin begin
//
end; end;
function timeEndPeriod(x1: DWord): DWord; function timeEndPeriod(x1: DWord): DWord;
begin begin
//
end; end;
function timeGetTime: DWORD; function timeGetTime: DWORD;
var
ATime: TSystemTime;
begin begin
//todo: properly implement Result := GetTickCount;
GetLocalTime(ATime);
Result := ATime.MilliSecond;
end; end;
end. end.

View File

@ -291,8 +291,8 @@ type
IDropSource = interface(IUnknown) IDropSource = interface(IUnknown)
['{00000121-0000-0000-C000-000000000046}'] ['{00000121-0000-0000-C000-000000000046}']
function QueryContinueDrag(fEscapePressed: BOOL; function QueryContinueDrag(fEscapePressed: BOOL;
grfKeyState: Longint):HResult;StdCall; grfKeyState: LongWord):HResult;StdCall;
function GiveFeedback(dwEffect: Longint): HResult;StdCall; function GiveFeedback(dwEffect: LongWord): HResult;StdCall;
end; end;
@ -332,10 +332,10 @@ type
IDropTargetHelper = interface(IUnknown) IDropTargetHelper = interface(IUnknown)
[SID_IDropTargetHelper] [SID_IDropTargetHelper]
function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function DragLeave: HRESULT; stdcall; function DragLeave: HRESULT; stdcall;
function DragOver(var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragOver(var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Show(fShow: Boolean): HRESULT; stdcall; function Show(fShow: Boolean): HRESULT; stdcall;
end; end;
@ -434,8 +434,8 @@ type
function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
procedure ForceDragLeave; stdcall; procedure ForceDragLeave; stdcall;
function GiveFeedback(Effect: Integer): HResult; stdcall; function GiveFeedback(Effect: LongWord): HResult; stdcall;
function QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; stdcall; function QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult; stdcall;
end; end;
//Ole helper functions //Ole helper functions
@ -1583,7 +1583,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.GiveFeedback(Effect: Integer): HResult; function TVTDragManager.GiveFeedback(Effect: LongWord): HResult;
begin begin
{$ifdef DEBUG_VTV}Logger.SendError([lcOle],'Ole function called in Linux');{$endif} {$ifdef DEBUG_VTV}Logger.SendError([lcOle],'Ole function called in Linux');{$endif}
@ -1593,7 +1593,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult;
var var
RButton, RButton,

View File

@ -291,8 +291,8 @@ type
IDropSource = interface(IUnknown) IDropSource = interface(IUnknown)
['{00000121-0000-0000-C000-000000000046}'] ['{00000121-0000-0000-C000-000000000046}']
function QueryContinueDrag(fEscapePressed: BOOL; function QueryContinueDrag(fEscapePressed: BOOL;
grfKeyState: Longint):HResult;StdCall; grfKeyState: LongWord):HResult;StdCall;
function GiveFeedback(dwEffect: Longint): HResult;StdCall; function GiveFeedback(dwEffect: LongWord): HResult;StdCall;
end; end;
@ -332,10 +332,10 @@ type
IDropTargetHelper = interface(IUnknown) IDropTargetHelper = interface(IUnknown)
[SID_IDropTargetHelper] [SID_IDropTargetHelper]
function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function DragLeave: HRESULT; stdcall; function DragLeave: HRESULT; stdcall;
function DragOver(var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragOver(var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Show(fShow: Boolean): HRESULT; stdcall; function Show(fShow: Boolean): HRESULT; stdcall;
end; end;
@ -434,8 +434,8 @@ type
function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
procedure ForceDragLeave; stdcall; procedure ForceDragLeave; stdcall;
function GiveFeedback(Effect: Integer): HResult; stdcall; function GiveFeedback(Effect: LongWord): HResult; stdcall;
function QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; stdcall; function QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult; stdcall;
end; end;
//Ole helper functions //Ole helper functions
@ -1583,7 +1583,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.GiveFeedback(Effect: Integer): HResult; function TVTDragManager.GiveFeedback(Effect: LongWord): HResult;
begin begin
{$ifdef DEBUG_VTV}Logger.SendError([lcOle],'Ole function called in Linux');{$endif} {$ifdef DEBUG_VTV}Logger.SendError([lcOle],'Ole function called in Linux');{$endif}
@ -1593,7 +1593,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult;
var var
RButton, RButton,

View File

@ -71,10 +71,10 @@ type
IDropTargetHelper = interface(IUnknown) IDropTargetHelper = interface(IUnknown)
[SID_IDropTargetHelper] [SID_IDropTargetHelper]
function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragEnter(hwndTarget: HWND; pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function DragLeave: HRESULT; stdcall; function DragLeave: HRESULT; stdcall;
function DragOver(var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function DragOver(var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: Integer): HRESULT; stdcall; function Drop(pDataObject: IDataObject; var ppt: TPoint; dwEffect: LongWord): HRESULT; stdcall;
function Show(fShow: Boolean): HRESULT; stdcall; function Show(fShow: Boolean): HRESULT; stdcall;
end; end;
@ -173,8 +173,8 @@ type
function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function DragOver(KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall; function Drop(const DataObject: IDataObject; KeyState: LongWord; Pt: TPoint; var Effect: LongWord): HResult; stdcall;
procedure ForceDragLeave; stdcall; procedure ForceDragLeave; stdcall;
function GiveFeedback(Effect: Integer): HResult; stdcall; function GiveFeedback(Effect: LongWord): HResult; stdcall;
function QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; stdcall; function QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult; stdcall;
end; end;
//Ole helper functions //Ole helper functions
@ -1100,7 +1100,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.GiveFeedback(Effect: Integer): HResult; function TVTDragManager.GiveFeedback(Effect: LongWord): HResult;
begin begin
Result := DRAGDROP_S_USEDEFAULTCURSORS; Result := DRAGDROP_S_USEDEFAULTCURSORS;
@ -1108,7 +1108,7 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer): HResult; function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: LongWord): HResult;
var var
RButton, RButton,

View File

@ -38,7 +38,7 @@ var
begin begin
if Msg = WM_PAINT then if Msg = WM_PAINT then
begin begin
PanningObject:=TVirtualPanningWindow(GetWindowLong(Window,GWL_USERDATA)); PanningObject:=TVirtualPanningWindow(GetWindowLongPtrW(Window,GWL_USERDATA));
if Assigned(PanningObject) then if Assigned(PanningObject) then
PanningObject.HandlePaintMessage; PanningObject.HandlePaintMessage;
end end

View File

@ -1,24 +1,30 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<Package Version="3"> <Package Version="4">
<Name Value="virtualtreeview_package"/> <Name Value="virtualtreeview_package"/>
<Author Value="Mike Lischke (LCL Port: Luiz Americo)"/> <AddToProjectUsesSection Value="True"/>
<Author Value="Mike Lischke (LCL Port: Luiz Am�rico)"/>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="include/intf/$(LCLWidgetType)/;units/;include/intf/"/> <IncludeFiles Value="include/intf/$(LCLWidgetType);units;include/intf"/>
<OtherUnitFiles Value="units/$(LCLWidgetType)/"/> <OtherUnitFiles Value="units/$(LCLWidgetType)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(LCLWidgetType)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(LCLWidgetType)"/>
</SearchPaths> </SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Description Value="Virtual Treeview is an advanced component originally created for Delphi <Description Value="Virtual Treeview is an advanced component originally created for Delphi
"/> "/>
<License Value=" Moziall Public License 1.1 (MPL 1.1) or GNU Lesser General Public License <License Value=" Mozilla Public License 1.1 (MPL 1.1) or GNU Lesser General Public License
"/> "/>
<Version Major="4" Minor="5" Release="1"/> <Version Major="4" Minor="8" Release="7" Build="3"/>
<Files Count="7"> <Files Count="7">
<Item1> <Item1>
<Filename Value="virtualtrees.lrs"/> <Filename Value="virtualtrees.lrs"/>
@ -51,19 +57,17 @@
</Item7> </Item7>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3"> <RequiredPkgs Count="2">
<Item1> <Item1>
<PackageName Value="multiloglaz"/> <PackageName Value="lclextensions_package"/>
<MinVersion Minor="5" Valid="True"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="lclextensions_package"/>
</Item2>
<Item3>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item3> </Item2>
</RequiredPkgs> </RequiredPkgs>
<UsageOptions> <UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/> <UnitPath Value="$(PkgOutDir)"/>
</UsageOptions> </UsageOptions>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>

View File

@ -1,4 +1,4 @@
{ This file was automatically created by Lazarus. do not edit ! { This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package. This source is only used to compile and install the package.
} }
@ -7,7 +7,7 @@ unit virtualtreeview_package;
interface interface
uses uses
VirtualTrees, VTHeaderPopup, registervirtualtreeview, VTGraphics, VirtualTrees, VTHeaderPopup, registervirtualtreeview, VTGraphics,
LazarusPackageIntf; LazarusPackageIntf;
implementation implementation