LazReport: Implements Helper aligning guids, WIP.

git-svn-id: trunk@62436 -
This commit is contained in:
jesus 2019-12-23 18:45:34 +00:00
parent 251a2f91f6
commit 633d58980c
5 changed files with 385 additions and 240 deletions

1
.gitattributes vendored
View File

@ -2810,6 +2810,7 @@ components/lazreport/images/designer/lrd_copy.png -text
components/lazreport/images/designer/lrd_cut.png -text
components/lazreport/images/designer/lrd_grid.png -text
components/lazreport/images/designer/lrd_grid_align.png -text
components/lazreport/images/designer/lrd_guides.png -text
components/lazreport/images/designer/lrd_ins_fields.bmp -text svneol=unset#image/x-ms-bmp
components/lazreport/images/designer/lrd_italic.png -text
components/lazreport/images/designer/lrd_new.png -text

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

View File

@ -28,6 +28,7 @@ uses
const
lrMaxBandsInReport = 256; //temp fix. in future need remove this limit
lrSnapDistance: Integer = 10;
const
// object flags
@ -352,6 +353,7 @@ type
procedure SetBounds(aLeft, aTop, aWidth, aHeight: Integer);
function PointInView(aX,aY : Integer) : Boolean; virtual;
function FindAlignSide(const vert:boolean; const value: Integer; out found: Integer): boolean; virtual;
procedure Invalidate;
property Canvas : TCanvas read fCanvas write fCanvas;
@ -3281,6 +3283,29 @@ begin
Result:=((aX>Rc.Left) and (aX<Rc.Right) and (aY>Rc.Top) and (aY<Rc.Bottom));
end;
function TfrView.FindAlignSide(const vert: boolean; const value: Integer;
out found: Integer): boolean;
begin
result := false;
if vert then
begin
found := y;
if abs(value-found)<=lrSnapDistance then exit(true);
found := y+dy;
if abs(value-found)<=lrSnapDistance then exit(true);
found := y+dy div 2;
if abs(value-found)<=lrSnapDistance then exit(true);
end else
begin
found := x;
if abs(value-found)<=lrSnapDistance then exit(true);
found := x+dx;
if abs(value-found)<=lrSnapDistance then exit(true);
found := x+dx div 2;
if abs(value-found)<=lrSnapDistance then exit(true);
end;
end;
procedure TfrView.Invalidate;
begin
if Assigned(Canvas) and (fUpdate=0) then

View File

@ -9,7 +9,7 @@ object frDesignerForm: TfrDesignerForm
VertScrollBar.Range = 149
ActiveControl = frDock1
Caption = 'Designer'
ClientHeight = 406
ClientHeight = 414
ClientWidth = 695
KeyPreview = True
Menu = MainMenu1
@ -23,12 +23,12 @@ object frDesignerForm: TfrDesignerForm
OnResize = FormResize
OnShow = FormShow
ShowHint = True
LCLVersion = '1.7'
LCLVersion = '2.1.0.0'
WindowState = wsMaximized
object StatusBar1: TStatusBar
Left = 0
Height = 24
Top = 382
Height = 23
Top = 391
Width = 695
Panels = <
item
@ -731,10 +731,10 @@ object frDesignerForm: TfrDesignerForm
end
object ExitB: TSpeedButton
Tag = 58
Left = 455
Left = 477
Height = 24
Top = 1
Width = 78
Width = 59
Align = alLeft
Caption = 'Close'
Flat = True
@ -779,7 +779,7 @@ object frDesignerForm: TfrDesignerForm
end
object GB3: TSpeedButton
Tag = 57
Left = 407
Left = 429
Height = 24
Top = 1
Width = 22
@ -879,7 +879,7 @@ object frDesignerForm: TfrDesignerForm
ShowCaption = False
end
object HelpBtn: TSpeedButton
Left = 431
Left = 453
Height = 24
Top = 1
Width = 22
@ -1005,7 +1005,7 @@ object frDesignerForm: TfrDesignerForm
TabOrder = 3
end
object frTBSeparator5: TPanel
Left = 429
Left = 451
Height = 24
Top = 1
Width = 2
@ -1025,7 +1025,7 @@ object frDesignerForm: TfrDesignerForm
TabOrder = 5
end
object frTBSeparator11: TPanel
Left = 453
Left = 475
Height = 24
Top = 1
Width = 2
@ -1034,6 +1034,54 @@ object frDesignerForm: TfrDesignerForm
FullRepaint = False
TabOrder = 6
end
object btnGuides: TSpeedButton
Tag = 56
Left = 407
Height = 24
Top = 1
Width = 22
Align = alLeft
AllowAllUp = True
Flat = True
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000C76F7E00C76F
7E00C76F7E00C76F7E00C76F7E00C76F7E00C76F7E00C76F7E00C76F7E00C76F
7E00C76F7E00C76F7E00C76F7E000000FCFFC76F7E00C76F7E00C76F7E004C4C
4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C
4C004C4C4C004C4C4C00DBBB0DFF0000FCFFDBBB0DFFC76F7E00C76F7E004C4C
4C00BD5B6B00BD5B6B00C76F7E004C4C4C00BD5B6B00C76F7E00BD5B6B00BD5B
6B00C76F7E000000FC00DBBB0DFF0000FCFFDBBB0DFF0000FCFFC76F7E004C4C
4C00C76F7E00C76F7E00C76F7E004C4C4C00C76F7E00C76F7E00C76F7E00C76F
7E00C76F7E00C76F7E00DBBB0DFF0000FCFFDBBB0DFFC76F7E00C76F7E004C4C
4C004C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFFD998
A300D895A000D6919C00DBBB0DFF0000FCFFDBBB0DFFC76F7E00C76F7E004C4C
4C004C4C4CFFEDCBD100E9C0C7004C4C4C00E4B3BB00E1ACB4004C4C4CFFDC9F
A900D998A300D895A000DBBB0DFFC76F7E00DBBB0DFFC76F7E00C76F7E004C4C
4C004C4C4CFFEECED300EBC6CC004C4C4C00E7BBC200E5B6BE004C4C4CFFDFA7
B000DDA2AB00DA9AA500DBBB0DFF0000FCFFDBBB0DFFC76F7E00C76F7E004C4C
4C004C4C4CFFEECED300EBC6CC004C4C4C00EAC3C900E8BEC5004C4C4CFFE2AE
B700DFA7B000DDA2AB00DBBB0DFF0000FCFFDBBB0DFFC76F7E00C76F7E004C4C
4C004C4C4CFFF0D3D800EECED3004C4C4C00EDCBD100ECC8CE004C4C4CFFE8BE
C500E5B6BE00E3B1B900DBBB0DFFC76F7E00DBBB0DFFC76F7E00C76F7E004C4C
4C004C4C4CFF4C4C4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C4CFF4C4C
4C004C4C4C004C4C4C00DBBB0DFF0000FCFFDBBB0DFFC76F7E00C76F7E004C4C
4C004C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFF4C4C4CFFDB9D
A700D7939E00D7939E00C76F7E000000FCFFC76F7E00C76F7E00C76F7E004C4C
4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C4C004C4C
4C004C4C4C004C4C4C004C4C4C00C76F7E00C76F7E00C76F7E00C76F7E00BD5B
6B00C76F7E00F8EAEC00F7E7EA00F4DEE200F0D3D800F4DEE200F7E7EA00F7E7
EA00F7E7EA00F5E1E400C76F7E000000FCFFC76F7E00C76F7E00C76F7E00DBBB
0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB
0DFFDBBB0DFFDBBB0DFFDBBB0DFF0000FCFFC76F7E00C76F7E00C76F7E00BD5B
6BFFBD5B6BFFBD5B6BFFC76F7E00BD5B6BFFBD5B6BFFC76F7E00BD5B6BFFBD5B
6BFFC76F7E00BD5B6BFFBD5B6BFFBD5B6BFFC76F7E00C76F7E00C76F7E00DBBB
0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB0DFFDBBB
0DFFDBBB0DFFDBBB0DFFDBBB0DFFC76F7E00C76F7E00C76F7E00
}
GroupIndex = 3
OnClick = btnGuidesClick
end
end
object Panel3: TPanel
Left = 1
@ -1651,10 +1699,10 @@ object frDesignerForm: TfrDesignerForm
object C3: TComboBox
Tag = 8
Left = 161
Height = 32
Height = 23
Top = 2
Width = 67
ItemHeight = 0
ItemHeight = 15
Items.Strings = (
'5'
'6'
@ -1683,7 +1731,7 @@ object frDesignerForm: TfrDesignerForm
object C2: TComboBox
Tag = 7
Left = 1
Height = 34
Height = 19
Top = 2
Width = 155
ItemHeight = 13
@ -2080,7 +2128,7 @@ object frDesignerForm: TfrDesignerForm
object E1: TEdit
Tag = 6
Left = 4
Height = 30
Height = 23
Top = 1
Width = 31
TabOrder = 0
@ -2145,21 +2193,21 @@ object frDesignerForm: TfrDesignerForm
end
object frDock2: TPanel
Left = 0
Height = 302
Height = 311
Top = 80
Width = 27
Align = alLeft
ClientHeight = 302
ClientHeight = 311
ClientWidth = 27
FullRepaint = False
TabOrder = 1
object panForDlg: TPanel
Left = 1
Height = 300
Height = 309
Top = 1
Width = 25
Align = alClient
ClientHeight = 300
ClientHeight = 309
ClientWidth = 25
FullRepaint = False
TabOrder = 1
@ -2225,11 +2273,11 @@ object frDesignerForm: TfrDesignerForm
end
object Panel4: TPanel
Left = 1
Height = 300
Height = 309
Top = 1
Width = 25
Align = alClient
ClientHeight = 300
ClientHeight = 309
ClientWidth = 25
FullRepaint = False
TabOrder = 0
@ -2528,7 +2576,7 @@ object frDesignerForm: TfrDesignerForm
end
object Tab1: TTabControl
Left = 27
Height = 302
Height = 311
Top = 80
Width = 641
TabStop = False
@ -2542,25 +2590,25 @@ object frDesignerForm: TfrDesignerForm
TabOrder = 2
object panTab: TPanel
Left = 2
Height = 265
Top = 35
Height = 286
Top = 23
Width = 637
Align = alClient
BevelOuter = bvNone
Caption = 'panTab'
ClientHeight = 265
ClientHeight = 286
ClientWidth = 637
TabOrder = 1
object ScrollBox1: TScrollBox
Left = 0
Height = 265
Height = 286
Top = 0
Width = 637
HorzScrollBar.Page = 488
VertScrollBar.Page = 174
Align = alClient
ClientHeight = 263
ClientWidth = 635
ClientHeight = 282
ClientWidth = 633
Color = clGray
ParentColor = False
TabOrder = 0
@ -3837,12 +3885,12 @@ object frDesignerForm: TfrDesignerForm
end
object frDock4: TPanel
Left = 668
Height = 302
Height = 311
Top = 80
Width = 27
Align = alRight
Anchors = [akTop, akRight]
ClientHeight = 302
ClientHeight = 311
ClientWidth = 27
FullRepaint = False
TabOrder = 3
@ -4439,8 +4487,8 @@ object frDesignerForm: TfrDesignerForm
end
object Popup1: TPopupMenu
OnPopup = Popup1Popup
left = 368
top = 48
Left = 368
Top = 48
object N2: TMenuItem
Caption = ' '
ShortCut = 16472
@ -4475,8 +4523,8 @@ object frDesignerForm: TfrDesignerForm
end
object MainMenu1: TMainMenu
Images = ActionsImageList
left = 320
top = 48
Left = 320
Top = 48
object FileMenu: TMenuItem
Caption = '&File'
object N23: TMenuItem
@ -4486,81 +4534,9 @@ object frDesignerForm: TfrDesignerForm
end
object N19: TMenuItem
Action = FileOpen
Bitmap.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
20000000000000040000640000006400000000000000000000002C86D8D12D88
D8F72D87D8F72D88D8F72D88D8F72D88D8F72D88D8F72D88D8F72D88D8F72D88
D8F72D88D8F72D87D8F72D88D8F72C86D8D1FFFFFF00FFFFFF00338ED9FBDCF0
FAFF98E1F6FF95E0F6FF92DFF6FF8EDEF5FF89DCF5FF85DAF4FF80D9F4FF7AD7
F3FF74D5F3FF70D3F2FFC2EAF8FF3594DAFFFFFFFF00FFFFFF003594DAF7EFFA
FEFF93E5F8FF8FE4F8FF89E3F8FF82E1F7FF7ADFF7FF71DEF6FF67DBF5FF5BD8
F4FF4DD4F3FF40D1F2FFCAF2FBFF3594DAFFFFFFFF00FFFFFF00369ADAF8F2FA
FDFF94E6F8FF92E5F8FF90E5F8FF8BE3F8FF86E2F7FF7FE1F7FF77DEF6FF6CDC
F6FF5ED9F4FF4FD5F3FFCCF2FBFF3594DAFFFFFFFF00FFFFFF0036A1DAF9F6FC
FEFF94E5F8FF93E5F8FF93E5F8FF91E5F8FF93DBE9FF93D7E3FF93D2DCFF90CE
D7FF8CC8CFFF86C1C6FFC9D8D6FF3594DAFFC57444E8CA7F53F137A6DAFAFEFF
FFFFF8FDFFFFF6FDFFFFF5FCFFFFF3FCFEFF9AE4F4FF9AE6F7FF9BE6F6FF9DE5
F5FF9EE5F5FF9FE5F4FFDAF3F8FF3594DAFFFDF4EEFFCA8054F935ABDAFAE8F6
FBFF70BCE7FF55AAE2FF4DA5E0FF91C9EBFFFAF3EFFFFDFEFDFFFFFDFCFFFFFD
FCFFFEFDFCFFFEFCFBFFFEFEFDFF3594DAFFEFF2E8FFCE8156FF36AADAF2F1FA
FDFF94DEF5FF93DCF4FF64BCE9FF3594DAFF3594DAFF3594DAFF3594DAFF3594
DAFF3594DAFF3594DAFF3594DAFF3594DAFFFBF6EFFFCC8355FE35AFDAF0F7FC
FEFF8EE4F8FF91DEF5FF9FE0F5FFACE1F6FFCA8452FFFFF7F1FFFFE9D9FFFFEA
DBFFFFE9D9FFFFE7D7FFFFE5D2FFFFE2CBFFFFF7F1FFCB8555FE36B3DAF8FDFE
FEFFFEFFFFFFFEFEFFFFFDFEFFFFFEFFFFFFE4BA91FFFFF7F0FFFFE7D5FFFDE7
D6FFFDE6D4FFFCE4D0FFFBE3CBFFFADCC2FFFEF3E8FFCC8656FE34B4D9D05EC2
E1FA60C3E2FA60C3E2FA60C3E2FA5FC3E2FAE4BB91FFFFF7F2FFFEE7D5FFFEE7
D5FFFDE5D1FFFAE0CAFFF9DEC4FFF7D9BCFFFDF2E7FFCC8757FEFFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00E4BB92FFFEF7F1FFFCE5D2FFFCE4
D1FFFBE2CCFFF9DDC4FFF6D7BBFFF3D1AFFFFAEFE4FFCC8758FEFFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00E4BB92FFFEF6F0FFFCE2CDFFFCE3
CDFFFADFC8FFF7D9BCFFF5E9DDFFFAF3EBFFFBF8F3FFCA8353FEFFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00E4BB93FFFEF5EDFFFCDEC5FFFBE0
C7FFF9DCC2FFF5D3B4FFFEF9F3FFFAE2C4FFECC193FFC37D4893FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00E5BE96FFFFFFFEFFFDF3E9FFFDF3
EAFFFCF2E8FFFAEFE3FFFAF2E7FFEABB88FFCF8555B3B4693D0CFFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00EAC39DFFE6BF96FFE4BB92FFE4BB
92FFD1A06CF5D09E6DF6CC965FDAC479427EB2673C09FFFFFF00
}
end
object N20: TMenuItem
Action = FileSave
Bitmap.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000BD6931FFBD69
31FFBD6931FFB56931FFB56931FFB56531FFB56531FFB56531FFAD6531FFAD61
31FFAD6131FFAD6131FFAD6131FFA56131FFA56131FFAD6131FFBD6931FFEFC7
ADFFEFC7ADFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFCE9E7BFFC69E7BFFA56131FFBD6931FFEFCF
B5FFE7A67BFFFFFFF7FF63C78CFF63C78CFF63C78CFF63C78CFF63C78CFF63C7
8CFF63C78CFF63C78CFFFFFFF7FFCE8E63FFCE9E7BFFA56131FFBD6D39FFEFCF
B5FFE7A67BFFFFFFF7FFBDDFC6FFBDDFC6FFBDDFC6FFBDDFC6FFBDDFC6FFBDDF
C6FFBDDFC6FFBDDFC6FFFFFFF7FFCE966BFFCE9E84FFAD6131FFBD6939FFEFCF
BDFFE7A67BFFFFFFF7FF63C78CFF63C78CFF63C78CFF63C78CFF63C78CFF63C7
8CFF63C78CFF63C78CFFFFFFF7FFCE966BFFCEA684FFAD6131FFBD6931FFEFD7
BDFFE7A67BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFD6966BFFD6A68CFFAD6131FFBD6931FFF7D7
BDFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFDE9E73FFDE9E
73FFDE9E73FFDE9E73FFDE9E73FFD69E73FFD6AE8CFFAD6131FFBD6931FFF7D7
C6FFE7A67BFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFDEA6
73FFDE9E73FFDE9E73FFDE9E73FFDE9E73FFDEB694FFAD6531FFBD6931FFF7DF
C6FFE7A67BFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFE7A67BFFDEA6
73FFDE9E73FFDE9E73FFDE9E73FFDE9E73FFDEB69CFFB56531FFBD6931FFF7DF
C6FFE7A67BFFCE8E63FFCE8E63FFCE8E63FFCE966BFFCE966BFFCE966BFFCE8E
63FFCE8E63FFCE8E63FFCE8E63FFDE9E73FFE7BE9CFFB56531FFBD6931FFF7DF
CEFFE7A67BFFFFEFE7FFFFEFE7FFFFEFE7FFFFF7EFFFFFFFF7FFFFF7F7FFFFEF
E7FFF7E7DEFFF7E7DEFFF7E7DEFFDEA673FFE7BEA5FFB56531FFBD6931FFF7DF
CEFFE7AE7BFFFFF7EFFFFFF7EFFFCE8E63FFFFF7EFFFFFFFF7FFFFFFFFFFFFF7
EFFFFFEFDEFFF7E7DEFFF7E7DEFFE7A67BFFE7C7ADFFB56931FFBD6931FFF7DF
D6FFEFAE7BFFFFF7F7FFFFF7F7FFCE8E63FFFFF7EFFFFFF7EFFFFFFFF7FFFFFF
F7FFFFF7EFFFFFEFDEFFF7E7DEFFE7A67BFFEFD7C6FFB56931FFBD6931FFF7DF
D6FFEFAE84FFFFFFF7FFFFFFF7FFCE8E63FFFFF7EFFFFFF7EFFFFFF7F7FFFFFF
FFFFFFF7F7FFFFEFE7FFFFE7DEFFEFD7BDFFEFD7BDFFBD7139FFBD6931FFF7E7
D6FFF7E7D6FFFFFFFFFFFFFFF7FFFFFFF7FFFFF7F7FFFFF7EFFFFFF7EFFFFFFF
F7FFFFFFF7FFFFF7EFFFFFEFDEFFEFD7BDFFCE8E5AFF0000000000000000BD69
31FFBD6931FFBD6931FFBD6931FFBD6931FFBD6931FFBD6931FFBD6931FFBD6D
39FFBD6D39FFBD6D39FFBD6939FFBD7139FF0000000000000000
}
end
object N17: TMenuItem
Action = FileSaveAs
@ -4588,42 +4564,6 @@ object frDesignerForm: TfrDesignerForm
end
object N39: TMenuItem
Action = FilePreview
Bitmap.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000005A7DADFF5A86B5FF5A86B5FF5A86BDFF5A7D
B5FF5275ADFF0000000000000000000000000000000000000000000000000000
0000BDC7CEFF94AEC6FF84AEDEFF8CB6EFFF9CBEEFFFA5C7E7FFA5BEE7FFA5BE
E7FF94B6E7FF6B9EE7FF6386C6FF8496B5FF000000000000000000000000C6CF
DEFF9CBEE7FF9CC7EFFFBDD7EFFFD6DFEFFFE7E7EFFFEFEFEFFFEFEFEFFFEFEF
EFFFEFEFEFFFCED7EFFF94B6E7FF6396E7FF738EBDFF00000000D6DFE7FFADCF
EFFFC6D7EFFFE7E7EFFFEFEFEFFFEFDFD6FFE7BEA5FFDE9E73FFDE9E73FFDEB6
94FFEFD7CEFFF7F7F7FFE7EFEFFFB5CFEFFF6396E7FF849EC6FFC6D7E7FFD6E7
EFFFF7F7F7FFF7F7F7FFF7E7DEFFE7B69CFFE7A67BFFE79E73FFDE9E6BFFDE96
63FFE7A67BFFEFDFCEFFF7F7F7FFF7F7F7FFCED7E7FF7BA6DEFFDEE7E7FFEFEF
EFFFF7F7F7FFFFFFFFFFF7D7BDFFEFB68CFFE7AE84FFE7A67BFFE7A673FFE79E
73FFE7966BFFEFBE9CFFFFFFFFFFF7F7F7FFEFEFEFFF94B6DEFFB5CFDEFFDEE7
EFFFF7F7F7FFFFFFFFFFF7C7ADFFEFBE9CFFEFB694FF181008FF181008FFE7A6
7BFFE79E73FFE7A67BFFFFFFFFFFF7F7F7FFD6DFEFFF6B8ECEFFD6DFE7FFADCF
E7FFBDCFD6FFFFFFFFFFF7CFB5FFEFBEA5FFEFBE9CFF181410FF181408FFEFAE
84FFEFA67BFFEFAE84FFFFFFFFFFC6D7E7FF7BA6E7FF739ED6FFE7E7E7FFC6D7
E7FFB5D7EFFF94AEBDFFD6CFC6FFEFC7ADFFEFC7A5FFEFBE9CFFEFB694FFEFB6
8CFFEFAE84FFEFC7B5FFA5BEDEFF84AEE7FF84B6F7FFC6D7E7FF00000000E7E7
E7FFC6D7E7FFBDD7EFFFA5BED6FF8CA6B5FF9CA6ADFFB5AEA5FFB5A6A5FFB5A6
9CFF9C9EA5FF849EC6FF94BEEFFF94BEEFFFBDD7EFFF00000000000000000000
0000E7E7E7FFCEDFE7FFBDD7EFFFBDD7EFFFB5CFEFFFA5BEDEFF9CBED6FF9CBE
DEFFADCFF7FFA5C7EFFFA5C7EFFFD6DFEFFF0000000000000000000000000000
00000000000000000000DEDFE7FFC6D7E7FFBDD7E7FFBDCFE7FFB5CFE7FFB5CF
E7FFB5CFE7FFC6D7E7FF00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000
}
end
object N24: TMenuItem
Caption = '-'
@ -4637,81 +4577,9 @@ object frDesignerForm: TfrDesignerForm
Caption = '&Edit'
object N46: TMenuItem
Action = edtUndo
Bitmap.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000018A6C3691AA7C46900A0C4180000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000A0C45D66DBEAB211A6C2AE0000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000A0C42243C4DBFC43C5D8FE23A6C07F00000000000000000000
00000000000000000000000000000000000000A0C4FF00000000000000000000
000000000000000000000EAACBFE5DDAE9FE23A6C0EF00000000000000000000
000000000000000000000000000000A0C4FF00A0C4FF00000000000000000000
000000000000009EC11A02ACC8FF88E7F2FE11A2C2FF00000000000000000000
00000000000005797D1100A0C4FF76EDFBFF00A0C4FF000000000000000000A0
C4300099B95000A0C4C96DE6F5FF76E2EFFF19A3C1FF00000000000000000000
000005797D1100A0C4FF76EDFBFF76EDFBFF00A0C4FF00A0C4FF00A0C4FF00A0
C4FF01A9C4FF6EE1EEFF0FC9DFFF69E4F2FF1AA4C0F800000000000000000579
7D1100A0C4FF76EDFBFF04C3DAFF76EDFBFF69EAF9FF69EAF9FF69EAF9FF69EA
F9FF05DDF7FF0AC8DFFF07C2D8FF6FDCEBFF1BA3BFF40000000005797E1100A0
C4FF79EDFBFF32E2F8FF2CDFF4FF04C0D6FF04C0D6FF04C0D6FF1DD2E8FF1DD2
E8FF1DD2E8FF0BC8DFFF6AE5F3FF1BABC5F815A0BCCB0000000000A0C4FFADF3
FBFF2FE0F6FF32E2F8FF32E2F7FF32E2F7FF2FE0F5FF29DBF1FF1DD2E8FF1DD2
E8FF1DD2E8FF36D9ECFF40CDE1FF16A1BDCA05797D0A0000000005797D0A00A0
C4FFADF3FBFF2FE0F6FF32E2F7FF29DBF1FF2FE0F5FF29DBF1FF16CDE3FF36D9
ECFF69E7F6FF41CEE3FE13A3C1E405797D320000000000000000000000000579
7D1100A0C4FFADF3FBFF31E1F6FF20E3FAFF73ECFAFF6FEBFAFF6EE8F7FF6CE8
F7F814A1BCD414A3C1D505797D1C000000000000000000000000000000000000
000005797D1100A0C4FFADF3FBFF25E4FBFF00A0C4FF00A0C4FF13A1BEE7159F
BBCF1BA1BBA4067A7C0B00000000000000000000000000000000000000000000
00000000000005797D1100A0C4FFADF3FBFF00A0C4FF00000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000009DBF1400A0C4FF00A0C4FF00000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000A0C4FF00000000000000000000
0000000000000000000000000000000000000000000000000000
}
end
object N48: TMenuItem
Action = edtRedo
Bitmap.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF000000
000000A0C4181AA7C46918A6C369000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
000011A6C2AE66DBEAB200A0C45D000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF0023A6
C07F43C5D8FE43C4DBFC00A0C422000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF0023A6
C0EF5DDAE9FE0EAACBFE000000000000000000000000000000000000000000A0
C4FF000000000000000000000000000000000000000000000000FFFFFF0011A2
C2FF88E7F2FE02ACC8FF009EC11A0000000000000000000000000000000000A0
C4FF00A0C4FF0000000000000000000000000000000000000000FFFFFF0019A3
C1FF76E2EFFF6DE6F5FF00A0C4C90099B95000A0C430000000000000000000A0
C4FF76EDFBFF00A0C4FF05797D11000000000000000000000000FFFFFF001AA4
C0F869E4F2FF0FC9DFFF6EE1EEFF01A9C4FF00A0C4FF00A0C4FF00A0C4FF00A0
C4FF76EDFBFF76EDFBFF00A0C4FF05797D110000000000000000FFFFFF001BA3
BFF46FDCEBFF07C2D8FF0AC8DFFF05DDF7FF69EAF9FF69EAF9FF69EAF9FF69EA
F9FF76EDFBFF04C3DAFF76EDFBFF00A0C4FF05797D1100000000FFFFFF0015A0
BCCB1BABC5F86AE5F3FF0BC8DFFF1DD2E8FF1DD2E8FF1DD2E8FF04C0D6FF04C0
D6FF04C0D6FF2CDFF4FF32E2F8FF79EDFBFF00A0C4FF05797E11FFFFFF000579
7D0A16A1BDCA40CDE1FF36D9ECFF1DD2E8FF1DD2E8FF1DD2E8FF29DBF1FF2FE0
F5FF32E2F7FF32E2F7FF32E2F8FF2FE0F6FFADF3FBFF00A0C4FFFFFFFF000000
000005797D3213A3C1E441CEE3FE69E7F6FF36D9ECFF16CDE3FF29DBF1FF2FE0
F5FF29DBF1FF32E2F7FF2FE0F6FFADF3FBFF00A0C4FF05797D0AFFFFFF000000
00000000000005797D1C14A3C1D514A1BCD46CE8F7F86EE8F7FF6FEBFAFF73EC
FAFF20E3FAFF31E1F6FFADF3FBFF00A0C4FF05797D1100000000FFFFFF000000
00000000000000000000067A7C0B1BA1BBA4159FBBCF13A1BEE700A0C4FF00A0
C4FF25E4FBFFADF3FBFF00A0C4FF05797D110000000000000000FFFFFF000000
00000000000000000000000000000000000000000000000000000000000000A0
C4FFADF3FBFF00A0C4FF05797D11000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000000000000000000000A0
C4FF00A0C4FF009DBF1400000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000000000000000000000A0
C4FF000000000000000000000000000000000000000000000000
}
end
object N47: TMenuItem
Caption = '-'
@ -4850,20 +4718,20 @@ object frDesignerForm: TfrDesignerForm
object OpenDialog1: TOpenDialog
FilterIndex = 0
Options = [ofFileMustExist, ofEnableSizing, ofViewDetail]
left = 288
top = 200
Left = 288
Top = 200
end
object SaveDialog1: TSaveDialog
FilterIndex = 0
Options = [ofHideReadOnly]
left = 288
top = 264
Left = 288
Top = 264
end
object ImageList1: TImageList
Height = 15
Width = 15
left = 288
top = 360
Left = 288
Top = 360
Bitmap = {
4C69030000000F0000000F000000DCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFF0000
00FFDCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDC
@ -4954,8 +4822,8 @@ object frDesignerForm: TfrDesignerForm
end
object ImageList2: TImageList
Height = 14
left = 288
top = 312
Left = 288
Top = 312
Bitmap = {
4C6903000000100000000E000000DCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDC
DCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDCDCFFDCDC
@ -5045,8 +4913,8 @@ object frDesignerForm: TfrDesignerForm
}
end
object Popup2: TPopupMenu
left = 272
top = 56
Left = 272
Top = 56
object N41: TMenuItem
Caption = ' '
end
@ -5060,8 +4928,8 @@ object frDesignerForm: TfrDesignerForm
object ImgIndic: TImageList
Height = 8
Width = 8
left = 584
top = 8
Left = 584
Top = 8
Bitmap = {
4C69030000000800000008000000000000000000000000000000000000000000
00000000000000000000000000FF0000000000F900FF00F900FF00F900FF00F9
@ -5092,8 +4960,8 @@ object frDesignerForm: TfrDesignerForm
end
object actList: TActionList
Images = ActionsImageList
left = 640
top = 8
Left = 640
Top = 8
object acDuplicate: TAction
Category = 'Edit'
Caption = 'Duplicate object'
@ -5155,8 +5023,8 @@ object frDesignerForm: TfrDesignerForm
end
end
object ActionsImageList: TImageList
left = 584
top = 48
Left = 584
Top = 48
Bitmap = {
4C6905000000100000001000000000000000BD6931FFBD6931FFBD6931FFBD69
31FFBD6931FFBD6931FFBD6931FFBD6931FFBD6D39FFBD6D39FFBD6D39FFBD69
@ -5322,7 +5190,7 @@ object frDesignerForm: TfrDesignerForm
}
end
object IEPopupMenu: TPopupMenu
left = 411
top = 280
Left = 411
Top = 280
end
end

View File

@ -148,6 +148,7 @@ type
end;
TPaintSel = class;
TAlignGuides = class;
{ TfrDesignerPage }
@ -170,6 +171,7 @@ type
fPaintSel: TPaintSel;
fPainting: boolean;
fResizeDialog:boolean;
fGuides: TAlignGuides;
procedure NormalizeRect(var r: TRect);
procedure NormalizeCoord(t: TfrView);
@ -215,6 +217,7 @@ type
procedure Init;
procedure SetPage;
procedure GetMultipleSelected;
procedure CheckGuides;
end;
TPaintTimeStatusItem = (ptsFocusRect);
@ -241,12 +244,33 @@ type
procedure Paint;
end;
{ TAlignGuides }
TAlignGuides = class
private
fOwner: TfrDesignerPage;
fX,fY: Integer;
px,py: PInteger;
procedure InvalidateHorzGuide;
procedure InvalidateVertGuide;
procedure PaintGuides;
public
constructor Create(aOwner: TfrDesignerPage);
procedure Paint;
procedure FindGuides(ax, ay:Integer);
function SnapToGuide(var ax, ay: Integer): boolean;
procedure HideGuides;
//property X: PInteger read px;
//property Y: PInteger read py;
end;
{ TfrDesignerForm }
TfrDesignerForm = class(TfrReportDesigner)
acDuplicate: TAction;
edtRedo: TAction;
edtUndo: TAction;
btnGuides: TSpeedButton;
MenuItem2: TMenuItem;
IEPopupMenu: TPopupMenu;
IEButton: TSpeedButton;
@ -433,6 +457,7 @@ type
StB1: TSpeedButton;
procedure acDuplicateExecute(Sender: TObject);
procedure acToggleFramesExecute(Sender: TObject);
procedure btnGuidesClick(Sender: TObject);
procedure C2GetItems(Sender: TObject);
procedure edtRedoExecute(Sender: TObject);
procedure edtUndoExecute(Sender: TObject);
@ -527,7 +552,7 @@ type
ItemWidths: TStringList;
FCurPage: Integer;
FGridSize: Integer;
FGridShow, FGridAlign: Boolean;
FGridShow, FGridAlign, FGuidesShow: Boolean;
FUnits: TfrReportUnits;
FGrayedButtons: Boolean;
FUndoBuffer, FRedoBuffer: TfrUndoBuffer;
@ -561,6 +586,7 @@ type
procedure SetGridSize(Value: Integer);
procedure SetGridShow(Value: Boolean);
procedure SetGridAlign(Value: Boolean);
procedure SetGuidesShow(AValue: boolean);
procedure SetUnits(Value: TfrReportUnits);
procedure SetGrayedButtons(Value: Boolean);
procedure SetCurDocName(Value: String);
@ -672,6 +698,7 @@ type
property GridSize: Integer read FGridSize write SetGridSize;
property ShowGrid: Boolean read FGridShow write SetGridShow;
property GridAlign: Boolean read FGridAlign write SetGridAlign;
property ShowGuides: boolean read FGuidesShow write SetGuidesShow;
property Units: TfrReportUnits read FUnits write SetUnits;
property GrayedButtons: Boolean read FGrayedButtons write SetGrayedButtons;
end;
@ -752,6 +779,190 @@ begin
DeleteObject(TR);
end;
{ TAlignGuides }
procedure TAlignGuides.InvalidateHorzGuide;
var
r: TRect;
begin
if (px<>nil) then
begin
r := Rect(px^-4, 0 , px^+4, fOwner.ClientHeight-1);
InvalidateRect(fOwner.Handle, @r, false);
end;
end;
procedure TAlignGuides.InvalidateVertGuide;
var
r: TRect;
begin
if (py<>nil) then
begin
r := Rect(0, py^-4, fOwner.ClientWidth-1, py^+4);
InvalidateRect(fOwner.Handle, @r, false);
end;
end;
procedure TAlignGuides.PaintGuides;
var
oldStyle: TPenStyle;
oldColor: TColor;
oldCosmetic: Boolean;
i, v, oldWidth: Integer;
t: TfrView;
begin
if (px<>nil) or (py<>nil) then
with fOwner.Canvas do
begin
oldStyle := Pen.Style;
oldColor := Pen.Color;
oldCosmetic := Pen.Cosmetic;
oldWidth := Pen.Width;
// paint object's aligned sides
// TODO: make an option for the fixed values
Pen.Cosmetic := true;
Pen.Style := psSolid;
Pen.Width := 5;
Pen.Color := clSkyBlue;
for i:=0 to Objects.Count-1 do
begin
t := TfrView(Objects[i]);
if px<>nil then
if t.FindAlignSide(false, px^, v) and (v=px^) then
begin
MoveTo(px^, t.y);
LineTo(px^, t.y + t.dy);
end;
if py<>nil then
if t.FindAlignSide(true, py^, v) and (v=py^) then
begin
MoveTo(t.x, py^);
LineTo(t.x + t.dx, py^);
end;
end;
// paint guides
// TODO: make an option for the fixed values
Pen.Style := psDash;
Pen.Cosmetic := false;
Pen.Width := 1;
if px<>nil then
begin
Pen.Color := clRed;
MoveTo(px^, 0);
LineTo(px^, fOwner.ClientHeight);
end;
if py<>nil then
begin
Pen.Color := clBlue;
MoveTo(0, py^);
LineTo(fOwner.ClientWidth, py^);
end;
Pen.Cosmetic := oldCosmetic;
Pen.Style := oldStyle;
Pen.Color := oldColor;
Pen.Width := oldWidth;
end;
end;
constructor TAlignGuides.Create(aOwner: TfrDesignerPage);
begin
inherited create;
fOwner := aOwner;
end;
procedure TAlignGuides.Paint;
begin
PaintGuides;
end;
procedure TAlignGuides.FindGuides(ax, ay: Integer);
var
i, tx, ty: Integer;
t: TfrView;
foundVert, foundHorz: boolean;
begin
foundVert := false;
foundHorz := false;
// TODO: start looking at the nearest object to (ax, ay)
for i := 0 to Objects.Count-1 do
begin
t := TfrView(Objects[i]);
if not foundHorz and t.FindAlignSide(false, ax, tx) then
begin
if (px=nil) or (px^<>tx) then
begin
InvalidateHorzGuide;
fx := tx;
px := @fx;
InvalidateHorzGuide;
end;
foundHorz := true;
end;
if not foundVert and t.FindAlignSide(true, ay, ty) then
begin
if (py=nil) or (py^<>ty) then
begin
InvalidateVertGuide;
fy := ty;
py := @fy;
InvalidateVertGuide;
end;
foundvert := true;
end;
if foundHorz and foundVert then
break;
end;
if not foundHorz and (px<>nil) then
begin
InvalidateHorzGuide;
px := nil;
end;
if not foundVert and (py<>nil) then
begin
InvalidateVertGuide;
py := nil;
end;
end;
function TAlignGuides.SnapToGuide(var ax, ay: Integer): boolean;
var
newX, newY: Integer;
begin
newX := ax; newY := ay;
if (px<>nil) and (Abs(ax-px^)<=lrSnapDistance) then
newX := px^;
if (py<>nil) and (Abs(ay-py^)<=lrSnapDistance) then
newY := py^;
result := (newX<>ax) or (newY<>ay);
if result then
begin
ax := newX;
ay := newY;
end;
end;
procedure TAlignGuides.HideGuides;
begin
InvalidateHorzGuide;
InvalidateVertGuide;
px := nil;
py := nil;
end;
{ TPaintSel }
constructor TPaintSel.Create(AOwner: TfrDesignerPage);
@ -934,7 +1145,8 @@ begin
Parent := AOwner as TWinControl;
Color := clWhite;
EnableEvents;
fPaintSel := TPaintSel.Create(self);
fPaintSel := TPaintSel.Create(self);
fGuides := TAlignGuides.Create(self);
end;
destructor TfrDesignerPage.destroy;
@ -981,6 +1193,7 @@ procedure TfrDesignerPage.Paint;
begin
fPainting := true;
Draw(10000, 0);
fGuides.Paint;
fPaintSel.Paint;
fPainting := false;
end;
@ -1519,11 +1732,17 @@ end;
procedure TfrDesignerPage.RoundCoord(var x, y: Integer);
begin
with FDesigner do
begin
if ShowGuides and fGuides.SnapToGuide(x, y) then
exit;
if GridAlign then
begin
x := x div GridSize * GridSize;
y := y div GridSize * GridSize;
end;
end;
end;
procedure TfrDesignerPage.GetMultipleSelected;
@ -1560,6 +1779,12 @@ begin
end;
end;
procedure TfrDesignerPage.CheckGuides;
begin
if not FDesigner.ShowGuides then
fGuides.HideGuides;
end;
procedure TfrDesignerPage.MDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
@ -2214,6 +2439,9 @@ begin
Moved := True;
w := 2;
if FDesigner.ShowGuides then
fGuides.FindGuides(x, y);
if FirstChange and Down and not RFlag then
begin
kx := x - LastX;
@ -2437,13 +2665,19 @@ begin
// sizing several objects
if Down and TfrDesignerForm(frDesigner).MRFlag and (Mode = mdSelect) and (Cursor <> crDefault) then
begin
kx := x - LastX;
ky := y - LastY;
if FDesigner.GridAlign and not GridCheck then begin
{$IFDEF DebugLR}
DebugLnExit('TfrDesignerPage.MMove DONE: sizing seveal, not gridcheck');
{$ENDIF}
Exit;
if FDesigner.ShowGuides and fGuides.SnapToGuide(x, y) then begin
kx := x - LastX;
ky := y - LastY;
end else begin
kx := x - LastX;
ky := y - LastY;
if FDesigner.GridAlign and not GridCheck then begin
{$IFDEF DebugLR}
DebugLnExit('TfrDesignerPage.MMove DONE: sizing seveal, not gridcheck');
{$ENDIF}
Exit;
end;
end;
if FDesigner.ShapeMode = smFrame then
@ -2876,6 +3110,7 @@ begin
NPEraseFocusRect;
OffsetRect(OldRect, -10000, -10000);
end;
fGuides.HideGuides;
end;
{-----------------------------------------------------------------------------}
@ -3532,6 +3767,11 @@ begin
ViewsAction(nil, @ToggleFrames, -1);
end;
procedure TfrDesignerForm.btnGuidesClick(Sender: TObject);
begin
ShowGuides := btnGuides.Down;
end;
procedure TfrDesignerForm.FormShow(Sender: TObject);
var
CursorImage: TCursorImage;
@ -3698,6 +3938,14 @@ begin
FGridAlign := Value;
end;
procedure TfrDesignerForm.SetGuidesShow(AValue: boolean);
begin
if FGuidesShow = AValue then Exit;
FGuidesShow := AValue;
btnGuides.Down := AValue;
PageView.CheckGuides;
end;
procedure TfrDesignerForm.SetUnits(Value: TfrReportUnits);
var
s: String;
@ -6505,6 +6753,7 @@ const
rsGridShow = 'GridShow';
rsGridAlign = 'GridAlign';
rsGridSize = 'GridSize';
rsGuidesShow = 'GuidesShow';
rsUnits = 'Units';
rsButtons = 'GrayButtons';
rsEdit = 'EditAfterInsert';
@ -6534,6 +6783,7 @@ begin
Ini.WriteBool('frEditorForm', rsGridShow, ShowGrid);
Ini.WriteBool('frEditorForm', rsGridAlign, GridAlign);
Ini.WriteBool('frEditorForm', rsGuidesShow, ShowGuides);
Ini.WriteInteger('frEditorForm', rsGridSize, GridSize);
Ini.WriteInteger('frEditorForm', rsUnits, Word(Units));
Ini.WriteBool('frEditorForm', rsButtons, GrayedButtons);
@ -6584,6 +6834,7 @@ begin
GridSize := Ini.ReadInteger('frEditorForm', rsGridSize, 4);
GridAlign := Ini.ReadBool('frEditorForm', rsGridAlign, True);
ShowGrid := Ini.ReadBool('frEditorForm', rsGridShow, True);
ShowGuides := Ini.ReadBool('frEditorForm', rsGuidesShow, true);
Units := TfrReportUnits(Ini.ReadInteger('frEditorForm', rsUnits, 0));
// GrayedButtons := Ini.ReadBool('frEditorForm', rsButtons, False);
EditAfterInsert := Ini.ReadBool('frEditorForm', rsEdit, True);