mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 23:49:28 +02:00
added saving and opening from file from Darius
git-svn-id: trunk@7477 -
This commit is contained in:
parent
8a2365929a
commit
8ec346b211
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -815,6 +815,8 @@ ide/delphiunit2laz.lfm svneol=native#text/plain
|
||||
ide/delphiunit2laz.lrs svneol=native#text/pascal
|
||||
ide/delphiunit2laz.pas svneol=native#text/pascal
|
||||
ide/dialogprocs.pas svneol=native#text/pascal
|
||||
ide/diffdialog.lfm svneol=native#text/plain
|
||||
ide/diffdialog.lrs svneol=native#text/plain
|
||||
ide/diffdialog.pas svneol=native#text/pascal
|
||||
ide/diffpatch.pas svneol=native#text/pascal
|
||||
ide/diskdiffsdialog.pas svneol=native#text/pascal
|
||||
|
510
ide/diffdialog.lfm
Normal file
510
ide/diffdialog.lfm
Normal file
@ -0,0 +1,510 @@
|
||||
object DiffDlg: TDiffDlg
|
||||
Caption = 'Diff dialog'
|
||||
ClientHeight = 500
|
||||
ClientWidth = 600
|
||||
PixelsPerInch = 96
|
||||
Position = poScreenCenter
|
||||
HorzScrollBar.Page = 599
|
||||
VertScrollBar.Page = 499
|
||||
Left = 197
|
||||
Height = 500
|
||||
Top = 91
|
||||
Width = 600
|
||||
HelpType = htKeyword
|
||||
object SaveDiffButton: TButton
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = 'Save Diff'
|
||||
OnClick = SaveDiffButtonClick
|
||||
TabOrder = 0
|
||||
Left = 517
|
||||
Height = 25
|
||||
Top = 467
|
||||
Width = 75
|
||||
end
|
||||
object OpenInEditorButton: TButton
|
||||
Anchors = [akRight, akBottom]
|
||||
Caption = 'OpenInEditorButton'
|
||||
ModalResult = 6
|
||||
TabOrder = 1
|
||||
Left = 278
|
||||
Height = 25
|
||||
Top = 467
|
||||
Width = 237
|
||||
end
|
||||
object CloseButton: TButton
|
||||
Anchors = [akRight, akBottom]
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'CloseButton'
|
||||
ModalResult = 1
|
||||
TabOrder = 2
|
||||
Left = 198
|
||||
Height = 25
|
||||
Top = 467
|
||||
Width = 75
|
||||
end
|
||||
object Text1GroupBox: TGroupBox
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Caption = 'Text1GroupBox'
|
||||
ClientHeight = 62
|
||||
ClientWidth = 580
|
||||
ParentColor = True
|
||||
TabOrder = 3
|
||||
Left = 8
|
||||
Height = 80
|
||||
Top = 8
|
||||
Width = 584
|
||||
object Text1Combobox: TComboBox
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
MaxLength = 0
|
||||
OnChange = Text1ComboboxChange
|
||||
TabOrder = 0
|
||||
Text = 'Text1Combobox'
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 488
|
||||
end
|
||||
object Text1OnlySelectionCheckBox: TCheckBox
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Caption = 'Text1OnlySelectionCheckBox'
|
||||
OnChange = OnChangeFlag
|
||||
TabOrder = 1
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 32
|
||||
Width = 488
|
||||
end
|
||||
object Text1FileOpenButton: TButton
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'File'
|
||||
OnClick = FileOpenClick
|
||||
TabOrder = 2
|
||||
Left = 499
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 75
|
||||
end
|
||||
end
|
||||
object Text2GroupBox: TGroupBox
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Caption = 'Text2GroupBox'
|
||||
ClientHeight = 62
|
||||
ClientWidth = 580
|
||||
ParentColor = True
|
||||
TabOrder = 4
|
||||
Left = 8
|
||||
Height = 80
|
||||
Top = 96
|
||||
Width = 584
|
||||
object Text2Combobox: TComboBox
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.OnChange = nil
|
||||
MaxLength = 0
|
||||
OnChange = Text2ComboboxChange
|
||||
TabOrder = 0
|
||||
Text = 'Text2Combobox'
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 488
|
||||
end
|
||||
object Text2OnlySelectionCheckBox: TCheckBox
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Text2OnlySelectionCheckBox'
|
||||
OnChange = OnChangeFlag
|
||||
TabOrder = 1
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 32
|
||||
Width = 488
|
||||
end
|
||||
object Text2FileOpenButton: TButton
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = 'File'
|
||||
OnClick = FileOpenClick
|
||||
TabOrder = 2
|
||||
Left = 499
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 75
|
||||
end
|
||||
end
|
||||
object OptionsGroupBox: TCheckGroup
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 100
|
||||
Caption = 'OptionsGroupBox'
|
||||
Columns = 2
|
||||
ParentColor = True
|
||||
AnchorSideTop.Control = Text2GroupBox
|
||||
Left = 8
|
||||
Height = 83
|
||||
Top = 375
|
||||
Width = 584
|
||||
end
|
||||
object DiffSynEdit: TSynEdit
|
||||
BorderSpacing.OnChange = nil
|
||||
Font.Color = clBlack
|
||||
Font.Height = -12
|
||||
Font.Name = 'courier'
|
||||
Font.Pitch = fpFixed
|
||||
Height = 184
|
||||
Name = 'DiffSynEdit'
|
||||
TabOrder = 6
|
||||
Width = 584
|
||||
BookMarkOptions.Xoffset = -18
|
||||
BookMarkOptions.OnChange = nil
|
||||
Gutter.Visible = False
|
||||
Gutter.OnChange = nil
|
||||
Gutter.CodeFoldingWidth = 14
|
||||
Keystrokes = <
|
||||
item
|
||||
Command = 3
|
||||
ShortCut = 38
|
||||
end
|
||||
item
|
||||
Command = 103
|
||||
ShortCut = 8230
|
||||
end
|
||||
item
|
||||
Command = 211
|
||||
ShortCut = 16422
|
||||
end
|
||||
item
|
||||
Command = 4
|
||||
ShortCut = 40
|
||||
end
|
||||
item
|
||||
Command = 104
|
||||
ShortCut = 8232
|
||||
end
|
||||
item
|
||||
Command = 212
|
||||
ShortCut = 16424
|
||||
end
|
||||
item
|
||||
Command = 1
|
||||
ShortCut = 37
|
||||
end
|
||||
item
|
||||
Command = 101
|
||||
ShortCut = 8229
|
||||
end
|
||||
item
|
||||
Command = 5
|
||||
ShortCut = 16421
|
||||
end
|
||||
item
|
||||
Command = 105
|
||||
ShortCut = 24613
|
||||
end
|
||||
item
|
||||
Command = 2
|
||||
ShortCut = 39
|
||||
end
|
||||
item
|
||||
Command = 102
|
||||
ShortCut = 8231
|
||||
end
|
||||
item
|
||||
Command = 6
|
||||
ShortCut = 16423
|
||||
end
|
||||
item
|
||||
Command = 106
|
||||
ShortCut = 24615
|
||||
end
|
||||
item
|
||||
Command = 10
|
||||
ShortCut = 34
|
||||
end
|
||||
item
|
||||
Command = 110
|
||||
ShortCut = 8226
|
||||
end
|
||||
item
|
||||
Command = 14
|
||||
ShortCut = 16418
|
||||
end
|
||||
item
|
||||
Command = 114
|
||||
ShortCut = 24610
|
||||
end
|
||||
item
|
||||
Command = 9
|
||||
ShortCut = 33
|
||||
end
|
||||
item
|
||||
Command = 109
|
||||
ShortCut = 8225
|
||||
end
|
||||
item
|
||||
Command = 13
|
||||
ShortCut = 16417
|
||||
end
|
||||
item
|
||||
Command = 113
|
||||
ShortCut = 24609
|
||||
end
|
||||
item
|
||||
Command = 7
|
||||
ShortCut = 36
|
||||
end
|
||||
item
|
||||
Command = 107
|
||||
ShortCut = 8228
|
||||
end
|
||||
item
|
||||
Command = 15
|
||||
ShortCut = 16420
|
||||
end
|
||||
item
|
||||
Command = 115
|
||||
ShortCut = 24612
|
||||
end
|
||||
item
|
||||
Command = 8
|
||||
ShortCut = 35
|
||||
end
|
||||
item
|
||||
Command = 108
|
||||
ShortCut = 8227
|
||||
end
|
||||
item
|
||||
Command = 16
|
||||
ShortCut = 16419
|
||||
end
|
||||
item
|
||||
Command = 116
|
||||
ShortCut = 24611
|
||||
end
|
||||
item
|
||||
Command = 223
|
||||
ShortCut = 45
|
||||
end
|
||||
item
|
||||
Command = 201
|
||||
ShortCut = 16429
|
||||
end
|
||||
item
|
||||
Command = 604
|
||||
ShortCut = 8237
|
||||
end
|
||||
item
|
||||
Command = 502
|
||||
ShortCut = 46
|
||||
end
|
||||
item
|
||||
Command = 603
|
||||
ShortCut = 8238
|
||||
end
|
||||
item
|
||||
Command = 501
|
||||
ShortCut = 8
|
||||
end
|
||||
item
|
||||
Command = 501
|
||||
ShortCut = 8200
|
||||
end
|
||||
item
|
||||
Command = 504
|
||||
ShortCut = 16392
|
||||
end
|
||||
item
|
||||
Command = 601
|
||||
ShortCut = 32776
|
||||
end
|
||||
item
|
||||
Command = 602
|
||||
ShortCut = 40968
|
||||
end
|
||||
item
|
||||
Command = 509
|
||||
ShortCut = 13
|
||||
end
|
||||
item
|
||||
Command = 199
|
||||
ShortCut = 16449
|
||||
end
|
||||
item
|
||||
Command = 201
|
||||
ShortCut = 16451
|
||||
end
|
||||
item
|
||||
Command = 610
|
||||
ShortCut = 24649
|
||||
end
|
||||
item
|
||||
Command = 509
|
||||
ShortCut = 16461
|
||||
end
|
||||
item
|
||||
Command = 510
|
||||
ShortCut = 16462
|
||||
end
|
||||
item
|
||||
Command = 503
|
||||
ShortCut = 16468
|
||||
end
|
||||
item
|
||||
Command = 611
|
||||
ShortCut = 24661
|
||||
end
|
||||
item
|
||||
Command = 604
|
||||
ShortCut = 16470
|
||||
end
|
||||
item
|
||||
Command = 603
|
||||
ShortCut = 16472
|
||||
end
|
||||
item
|
||||
Command = 507
|
||||
ShortCut = 16473
|
||||
end
|
||||
item
|
||||
Command = 506
|
||||
ShortCut = 24665
|
||||
end
|
||||
item
|
||||
Command = 601
|
||||
ShortCut = 16474
|
||||
end
|
||||
item
|
||||
Command = 602
|
||||
ShortCut = 24666
|
||||
end
|
||||
item
|
||||
Command = 301
|
||||
ShortCut = 16432
|
||||
end
|
||||
item
|
||||
Command = 302
|
||||
ShortCut = 16433
|
||||
end
|
||||
item
|
||||
Command = 303
|
||||
ShortCut = 16434
|
||||
end
|
||||
item
|
||||
Command = 304
|
||||
ShortCut = 16435
|
||||
end
|
||||
item
|
||||
Command = 305
|
||||
ShortCut = 16436
|
||||
end
|
||||
item
|
||||
Command = 306
|
||||
ShortCut = 16437
|
||||
end
|
||||
item
|
||||
Command = 307
|
||||
ShortCut = 16438
|
||||
end
|
||||
item
|
||||
Command = 308
|
||||
ShortCut = 16439
|
||||
end
|
||||
item
|
||||
Command = 309
|
||||
ShortCut = 16440
|
||||
end
|
||||
item
|
||||
Command = 310
|
||||
ShortCut = 16441
|
||||
end
|
||||
item
|
||||
Command = 351
|
||||
ShortCut = 24624
|
||||
end
|
||||
item
|
||||
Command = 352
|
||||
ShortCut = 24625
|
||||
end
|
||||
item
|
||||
Command = 353
|
||||
ShortCut = 24626
|
||||
end
|
||||
item
|
||||
Command = 354
|
||||
ShortCut = 24627
|
||||
end
|
||||
item
|
||||
Command = 355
|
||||
ShortCut = 24628
|
||||
end
|
||||
item
|
||||
Command = 356
|
||||
ShortCut = 24629
|
||||
end
|
||||
item
|
||||
Command = 357
|
||||
ShortCut = 24630
|
||||
end
|
||||
item
|
||||
Command = 358
|
||||
ShortCut = 24631
|
||||
end
|
||||
item
|
||||
Command = 359
|
||||
ShortCut = 24632
|
||||
end
|
||||
item
|
||||
Command = 360
|
||||
ShortCut = 24633
|
||||
end
|
||||
item
|
||||
Command = 231
|
||||
ShortCut = 24654
|
||||
end
|
||||
item
|
||||
Command = 232
|
||||
ShortCut = 24643
|
||||
end
|
||||
item
|
||||
Command = 233
|
||||
ShortCut = 24652
|
||||
end
|
||||
item
|
||||
Command = 612
|
||||
ShortCut = 9
|
||||
end
|
||||
item
|
||||
Command = 613
|
||||
ShortCut = 8201
|
||||
end
|
||||
item
|
||||
Command = 250
|
||||
ShortCut = 24642
|
||||
end>
|
||||
Lines.Strings = (
|
||||
'DiffSynEdit'
|
||||
)
|
||||
SelectedColor.OnChange = nil
|
||||
Cursor = crIBeam
|
||||
Left = 8
|
||||
Height = 184
|
||||
Top = 184
|
||||
Width = 584
|
||||
end
|
||||
object dlgSave: TSaveDialog
|
||||
Title = 'Save file as'
|
||||
DefaultExt = '.diff'
|
||||
Filter = 'diff|*.diff|any file|*.*'
|
||||
FilterIndex = 0
|
||||
Title = 'Save file as'
|
||||
left = 459
|
||||
top = 48
|
||||
end
|
||||
object dlgOpen: TOpenDialog
|
||||
Title = 'Open existing file'
|
||||
DefaultExt = '.pas'
|
||||
Filter = 'pascal files|*.pas;*.pp|any file|*.*'
|
||||
FilterIndex = 0
|
||||
Title = 'Open existing file'
|
||||
left = 459
|
||||
top = 12
|
||||
end
|
||||
end
|
101
ide/diffdialog.lrs
Normal file
101
ide/diffdialog.lrs
Normal file
@ -0,0 +1,101 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TDiffDlg','FORMDATA',[
|
||||
'TPF0'#8'TDiffDlg'#7'DiffDlg'#7'Caption'#6#11'Diff dialog'#12'ClientHeight'#3
|
||||
+#244#1#11'ClientWidth'#3'X'#2#13'PixelsPerInch'#2'`'#8'Position'#7#14'poScre'
|
||||
+'enCenter'#18'HorzScrollBar.Page'#3'W'#2#18'VertScrollBar.Page'#3#243#1#4'Le'
|
||||
+'ft'#3#197#0#6'Height'#3#244#1#3'Top'#2'['#5'Width'#3'X'#2#8'HelpType'#7#9'h'
|
||||
+'tKeyword'#0#7'TButton'#14'SaveDiffButton'#7'Anchors'#11#7'akRight'#8'akBott'
|
||||
+'om'#0#7'Caption'#6#9'Save Diff'#7'OnClick'#7#19'SaveDiffButtonClick'#8'TabO'
|
||||
+'rder'#2#0#4'Left'#3#5#2#6'Height'#2#25#3'Top'#3#211#1#5'Width'#2'K'#0#0#7'T'
|
||||
+'Button'#18'OpenInEditorButton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Cap'
|
||||
+'tion'#6#18'OpenInEditorButton'#11'ModalResult'#2#6#8'TabOrder'#2#1#4'Left'#3
|
||||
+#22#1#6'Height'#2#25#3'Top'#3#211#1#5'Width'#3#237#0#0#0#7'TButton'#11'Close'
|
||||
+'Button'#7'Anchors'#11#7'akRight'#8'akBottom'#0#22'BorderSpacing.OnChange'#13
|
||||
+#7'Caption'#6#11'CloseButton'#11'ModalResult'#2#1#8'TabOrder'#2#2#4'Left'#3
|
||||
+#198#0#6'Height'#2#25#3'Top'#3#211#1#5'Width'#2'K'#0#0#9'TGroupBox'#13'Text1'
|
||||
+'GroupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Caption'#6#13'Tex'
|
||||
+'t1GroupBox'#12'ClientHeight'#2'>'#11'ClientWidth'#3'D'#2#11'ParentColor'#9#8
|
||||
+'TabOrder'#2#3#4'Left'#2#8#6'Height'#2'P'#3'Top'#2#8#5'Width'#3'H'#2#0#9'TCo'
|
||||
+'mboBox'#13'Text1Combobox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#9'M'
|
||||
+'axLength'#2#0#8'OnChange'#7#19'Text1ComboboxChange'#8'TabOrder'#2#0#4'Text'
|
||||
+#6#13'Text1Combobox'#4'Left'#2#6#6'Height'#2#21#3'Top'#2#6#5'Width'#3#232#1#0
|
||||
+#0#9'TCheckBox'#26'Text1OnlySelectionCheckBox'#7'Anchors'#11#5'akTop'#6'akLe'
|
||||
+'ft'#7'akRight'#0#7'Caption'#6#26'Text1OnlySelectionCheckBox'#8'OnChange'#7
|
||||
+#12'OnChangeFlag'#8'TabOrder'#2#1#4'Left'#2#6#6'Height'#2#23#3'Top'#2' '#5'W'
|
||||
+'idth'#3#232#1#0#0#7'TButton'#19'Text1FileOpenButton'#7'Anchors'#11#5'akTop'
|
||||
+#7'akRight'#0#22'BorderSpacing.OnChange'#13#7'Caption'#6#4'File'#7'OnClick'#7
|
||||
+#13'FileOpenClick'#8'TabOrder'#2#2#4'Left'#3#243#1#6'Height'#2#21#3'Top'#2#6
|
||||
+#5'Width'#2'K'#0#0#0#9'TGroupBox'#13'Text2GroupBox'#7'Anchors'#11#5'akTop'#6
|
||||
+'akLeft'#7'akRight'#0#7'Caption'#6#13'Text2GroupBox'#12'ClientHeight'#2'>'#11
|
||||
+'ClientWidth'#3'D'#2#11'ParentColor'#9#8'TabOrder'#2#4#4'Left'#2#8#6'Height'
|
||||
+#2'P'#3'Top'#2'`'#5'Width'#3'H'#2#0#9'TComboBox'#13'Text2Combobox'#7'Anchors'
|
||||
+#11#5'akTop'#6'akLeft'#7'akRight'#0#22'BorderSpacing.OnChange'#13#9'MaxLengt'
|
||||
+'h'#2#0#8'OnChange'#7#19'Text2ComboboxChange'#8'TabOrder'#2#0#4'Text'#6#13'T'
|
||||
+'ext2Combobox'#4'Left'#2#6#6'Height'#2#21#3'Top'#2#6#5'Width'#3#232#1#0#0#9
|
||||
+'TCheckBox'#26'Text2OnlySelectionCheckBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7
|
||||
+'akRight'#0#22'BorderSpacing.OnChange'#13#7'Caption'#6#26'Text2OnlySelection'
|
||||
+'CheckBox'#8'OnChange'#7#12'OnChangeFlag'#8'TabOrder'#2#1#4'Left'#2#6#6'Heig'
|
||||
+'ht'#2#23#3'Top'#2' '#5'Width'#3#232#1#0#0#7'TButton'#19'Text2FileOpenButton'
|
||||
+#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#4'File'#7'OnClick'#7#13'Fi'
|
||||
+'leOpenClick'#8'TabOrder'#2#2#4'Left'#3#243#1#6'Height'#2#21#3'Top'#2#6#5'Wi'
|
||||
+'dth'#2'K'#0#0#0#11'TCheckGroup'#15'OptionsGroupBox'#7'Anchors'#11#6'akLeft'
|
||||
+#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2'd'#7'Caption'#6#15'Options'
|
||||
+'GroupBox'#7'Columns'#2#2#11'ParentColor'#9#21'AnchorSideTop.Control'#7#13'T'
|
||||
+'ext2GroupBox'#4'Left'#2#8#6'Height'#2'S'#3'Top'#3'w'#1#5'Width'#3'H'#2#0#0#8
|
||||
+'TSynEdit'#11'DiffSynEdit'#22'BorderSpacing.OnChange'#13#10'Font.Color'#7#7
|
||||
+'clBlack'#11'Font.Height'#2#244#9'Font.Name'#6#7'courier'#10'Font.Pitch'#7#7
|
||||
+'fpFixed'#6'Height'#3#184#0#4'Name'#6#11'DiffSynEdit'#8'TabOrder'#2#6#5'Widt'
|
||||
+'h'#3'H'#2#23'BookMarkOptions.Xoffset'#2#238#24'BookMarkOptions.OnChange'#13
|
||||
+#14'Gutter.Visible'#8#15'Gutter.OnChange'#13#23'Gutter.CodeFoldingWidth'#2#14
|
||||
+#10'Keystrokes'#14#1#7'Command'#2#3#8'ShortCut'#2'&'#0#1#7'Command'#2'g'#8'S'
|
||||
+'hortCut'#3'& '#0#1#7'Command'#3#211#0#8'ShortCut'#3'&@'#0#1#7'Command'#2#4#8
|
||||
+'ShortCut'#2'('#0#1#7'Command'#2'h'#8'ShortCut'#3'( '#0#1#7'Command'#3#212#0
|
||||
+#8'ShortCut'#3'(@'#0#1#7'Command'#2#1#8'ShortCut'#2'%'#0#1#7'Command'#2'e'#8
|
||||
+'ShortCut'#3'% '#0#1#7'Command'#2#5#8'ShortCut'#3'%@'#0#1#7'Command'#2'i'#8
|
||||
+'ShortCut'#3'%`'#0#1#7'Command'#2#2#8'ShortCut'#2''''#0#1#7'Command'#2'f'#8
|
||||
+'ShortCut'#3''' '#0#1#7'Command'#2#6#8'ShortCut'#3'''@'#0#1#7'Command'#2'j'#8
|
||||
+'ShortCut'#3'''`'#0#1#7'Command'#2#10#8'ShortCut'#2'"'#0#1#7'Command'#2'n'#8
|
||||
+'ShortCut'#3'" '#0#1#7'Command'#2#14#8'ShortCut'#3'"@'#0#1#7'Command'#2'r'#8
|
||||
+'ShortCut'#3'"`'#0#1#7'Command'#2#9#8'ShortCut'#2'!'#0#1#7'Command'#2'm'#8'S'
|
||||
+'hortCut'#3'! '#0#1#7'Command'#2#13#8'ShortCut'#3'!@'#0#1#7'Command'#2'q'#8
|
||||
+'ShortCut'#3'!`'#0#1#7'Command'#2#7#8'ShortCut'#2'$'#0#1#7'Command'#2'k'#8'S'
|
||||
+'hortCut'#3'$ '#0#1#7'Command'#2#15#8'ShortCut'#3'$@'#0#1#7'Command'#2's'#8
|
||||
+'ShortCut'#3'$`'#0#1#7'Command'#2#8#8'ShortCut'#2'#'#0#1#7'Command'#2'l'#8'S'
|
||||
+'hortCut'#3'# '#0#1#7'Command'#2#16#8'ShortCut'#3'#@'#0#1#7'Command'#2't'#8
|
||||
+'ShortCut'#3'#`'#0#1#7'Command'#3#223#0#8'ShortCut'#2'-'#0#1#7'Command'#3#201
|
||||
+#0#8'ShortCut'#3'-@'#0#1#7'Command'#3'\'#2#8'ShortCut'#3'- '#0#1#7'Command'#3
|
||||
,#246#1#8'ShortCut'#2'.'#0#1#7'Command'#3'['#2#8'ShortCut'#3'. '#0#1#7'Comman'
|
||||
+'d'#3#245#1#8'ShortCut'#2#8#0#1#7'Command'#3#245#1#8'ShortCut'#3#8' '#0#1#7
|
||||
+'Command'#3#248#1#8'ShortCut'#3#8'@'#0#1#7'Command'#3'Y'#2#8'ShortCut'#4#8
|
||||
+#128#0#0#0#1#7'Command'#3'Z'#2#8'ShortCut'#4#8#160#0#0#0#1#7'Command'#3#253#1
|
||||
+#8'ShortCut'#2#13#0#1#7'Command'#3#199#0#8'ShortCut'#3'A@'#0#1#7'Command'#3
|
||||
+#201#0#8'ShortCut'#3'C@'#0#1#7'Command'#3'b'#2#8'ShortCut'#3'I`'#0#1#7'Comma'
|
||||
+'nd'#3#253#1#8'ShortCut'#3'M@'#0#1#7'Command'#3#254#1#8'ShortCut'#3'N@'#0#1#7
|
||||
+'Command'#3#247#1#8'ShortCut'#3'T@'#0#1#7'Command'#3'c'#2#8'ShortCut'#3'U`'#0
|
||||
+#1#7'Command'#3'\'#2#8'ShortCut'#3'V@'#0#1#7'Command'#3'['#2#8'ShortCut'#3'X'
|
||||
+'@'#0#1#7'Command'#3#251#1#8'ShortCut'#3'Y@'#0#1#7'Command'#3#250#1#8'ShortC'
|
||||
+'ut'#3'Y`'#0#1#7'Command'#3'Y'#2#8'ShortCut'#3'Z@'#0#1#7'Command'#3'Z'#2#8'S'
|
||||
+'hortCut'#3'Z`'#0#1#7'Command'#3'-'#1#8'ShortCut'#3'0@'#0#1#7'Command'#3'.'#1
|
||||
+#8'ShortCut'#3'1@'#0#1#7'Command'#3'/'#1#8'ShortCut'#3'2@'#0#1#7'Command'#3
|
||||
+'0'#1#8'ShortCut'#3'3@'#0#1#7'Command'#3'1'#1#8'ShortCut'#3'4@'#0#1#7'Comman'
|
||||
+'d'#3'2'#1#8'ShortCut'#3'5@'#0#1#7'Command'#3'3'#1#8'ShortCut'#3'6@'#0#1#7'C'
|
||||
+'ommand'#3'4'#1#8'ShortCut'#3'7@'#0#1#7'Command'#3'5'#1#8'ShortCut'#3'8@'#0#1
|
||||
+#7'Command'#3'6'#1#8'ShortCut'#3'9@'#0#1#7'Command'#3'_'#1#8'ShortCut'#3'0`'
|
||||
+#0#1#7'Command'#3'`'#1#8'ShortCut'#3'1`'#0#1#7'Command'#3'a'#1#8'ShortCut'#3
|
||||
+'2`'#0#1#7'Command'#3'b'#1#8'ShortCut'#3'3`'#0#1#7'Command'#3'c'#1#8'ShortCu'
|
||||
+'t'#3'4`'#0#1#7'Command'#3'd'#1#8'ShortCut'#3'5`'#0#1#7'Command'#3'e'#1#8'Sh'
|
||||
+'ortCut'#3'6`'#0#1#7'Command'#3'f'#1#8'ShortCut'#3'7`'#0#1#7'Command'#3'g'#1
|
||||
+#8'ShortCut'#3'8`'#0#1#7'Command'#3'h'#1#8'ShortCut'#3'9`'#0#1#7'Command'#3
|
||||
+#231#0#8'ShortCut'#3'N`'#0#1#7'Command'#3#232#0#8'ShortCut'#3'C`'#0#1#7'Comm'
|
||||
+'and'#3#233#0#8'ShortCut'#3'L`'#0#1#7'Command'#3'd'#2#8'ShortCut'#2#9#0#1#7
|
||||
+'Command'#3'e'#2#8'ShortCut'#3#9' '#0#1#7'Command'#3#250#0#8'ShortCut'#3'B`'
|
||||
+#0#0#13'Lines.Strings'#1#6#11'DiffSynEdit'#0#22'SelectedColor.OnChange'#13#6
|
||||
+'Cursor'#7#7'crIBeam'#4'Left'#2#8#6'Height'#3#184#0#3'Top'#3#184#0#5'Width'#3
|
||||
+'H'#2#0#0#11'TSaveDialog'#7'dlgSave'#5'Title'#6#12'Save file as'#10'DefaultE'
|
||||
+'xt'#6#5'.diff'#6'Filter'#6#24'diff|*.diff|any file|*.*'#11'FilterIndex'#2#0
|
||||
+#5'Title'#6#12'Save file as'#4'left'#3#203#1#3'top'#2'0'#0#0#11'TOpenDialog'
|
||||
+#7'dlgOpen'#5'Title'#6#18'Open existing file'#10'DefaultExt'#6#4'.pas'#6'Fil'
|
||||
+'ter'#6'$pascal files|*.pas;*.pp|any file|*.*'#11'FilterIndex'#2#0#5'Title'#6
|
||||
+#18'Open existing file'#4'left'#3#203#1#3'top'#2#12#0#0#0
|
||||
]);
|
@ -1,8 +1,8 @@
|
||||
{ $Id$ }
|
||||
{
|
||||
/***************************************************************************
|
||||
diffdialog.pp
|
||||
-------------
|
||||
diffdialog.pas
|
||||
--------------
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
@ -29,9 +29,10 @@
|
||||
Author: Mattias Gaertner
|
||||
|
||||
Abstract:
|
||||
The TDiffDialog is the dialog for showing the differences between two files.
|
||||
The TDiffDlg is the dialog for showing the differences between two files.
|
||||
|
||||
}
|
||||
|
||||
unit DiffDialog;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
@ -40,8 +41,8 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Math, Forms, Controls, Buttons, StdCtrls,
|
||||
SynEdit, LResources, LazarusIDEStrConsts, EditorOptions, IDEWindowIntf,
|
||||
InputHistory, DiffPatch;
|
||||
LResources, LazarusIDEStrConsts, EditorOptions, IDEWindowIntf,
|
||||
InputHistory, DiffPatch, ExtCtrls, Dialogs, SynEdit;
|
||||
|
||||
type
|
||||
TOnGetDiffFile = procedure(TextID: integer; OnlySelection: boolean;
|
||||
@ -75,9 +76,20 @@ type
|
||||
end;
|
||||
|
||||
|
||||
{ TDiffDialog }
|
||||
{ TDiffDlg }
|
||||
|
||||
TDiffDialog = class(TForm)
|
||||
TDiffDlg = class(TForm)
|
||||
DiffSynEdit: TSynEdit;
|
||||
Text1FileOpenButton: TButton;
|
||||
dlgSave: TSaveDialog;
|
||||
dlgOpen: TOpenDialog;
|
||||
|
||||
//buttons
|
||||
SaveDiffButton: TButton;
|
||||
OpenInEditorButton: TButton;
|
||||
CloseButton: TButton;
|
||||
Text2FileOpenButton: TButton;
|
||||
|
||||
// text 1
|
||||
Text1GroupBox: TGroupBox;
|
||||
Text1Combobox: TComboBox;
|
||||
@ -87,34 +99,16 @@ type
|
||||
Text2GroupBox: TGroupBox;
|
||||
Text2Combobox: TComboBox;
|
||||
Text2OnlySelectionCheckBox: TCheckBox;
|
||||
|
||||
// diff preview
|
||||
DiffGroupbox: TGroupBox;
|
||||
DiffSynEdit: TSynEdit;
|
||||
|
||||
// options
|
||||
OptionsGroupBox: TGroupBox;
|
||||
IgnoreCaseCheckBox: TCheckBox;
|
||||
IgnoreEmptyLineChangesCheckBox: TCheckBox;
|
||||
IgnoreHeadingSpacesCheckBox: TCheckBox;
|
||||
IgnoreLineEndsCheckBox: TCheckBox;
|
||||
IgnoreSpaceCharAmountCheckBox: TCheckBox;
|
||||
IgnoreSpaceCharsCheckBox: TCheckBox;
|
||||
IgnoreTrailingSpacesCheckBox: TCheckBox;
|
||||
|
||||
// buttons
|
||||
CloseButton: TButton;
|
||||
OpenInEditorButton: TButton;
|
||||
|
||||
procedure CloseButtonClick(Sender: TObject);
|
||||
procedure DiffDialogResize(Sender: TObject);
|
||||
|
||||
// options
|
||||
OptionsGroupBox: TCheckGroup;
|
||||
|
||||
procedure FileOpenClick(Sender: TObject);
|
||||
procedure OnChangeFlag(Sender: TObject);
|
||||
procedure OpenInEditorButtonClick(Sender: TObject);
|
||||
procedure OptionsGroupBoxResize(Sender: TObject);
|
||||
procedure SaveDiffButtonClick(Sender: TObject);
|
||||
procedure Text1ComboboxChange(Sender: TObject);
|
||||
procedure Text1GroupBoxResize(Sender: TObject);
|
||||
procedure Text2ComboboxChange(Sender: TObject);
|
||||
procedure Text2GroupBoxResize(Sender: TObject);
|
||||
private
|
||||
FOnGetDiffFile: TOnGetDiffFile;
|
||||
fDiffNeedsUpdate: boolean;
|
||||
@ -145,18 +139,25 @@ function ShowDiffDialog(Files: TDiffFiles; Text1Index: integer;
|
||||
OnGetDiffFile: TOnGetDiffFile;
|
||||
var OpenDiffInEditor: boolean; var Diff: string): TModalResult;
|
||||
|
||||
const
|
||||
IgnoreCaseCheckBox = 0;
|
||||
IgnoreEmptyLineChangesCheckBox = 1;
|
||||
IgnoreHeadingSpacesCheckBox = 2;
|
||||
IgnoreLineEndsCheckBox = 3;
|
||||
IgnoreSpaceCharAmountCheckBox = 4;
|
||||
IgnoreSpaceCharsCheckBox = 5;
|
||||
IgnoreTrailingSpacesCheckBox = 6;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
function ShowDiffDialog(Files: TDiffFiles; Text1Index: integer;
|
||||
OnGetDiffFile: TOnGetDiffFile;
|
||||
var OpenDiffInEditor: boolean; var Diff: string): TModalResult;
|
||||
var
|
||||
DiffDlg: TDiffDialog;
|
||||
DiffDlg: TDiffDlg;
|
||||
begin
|
||||
OpenDiffInEditor:=false;
|
||||
DiffDlg:=TDiffDialog.Create(nil);
|
||||
DiffDlg:=TDiffDlg.Create(nil);
|
||||
DiffDlg.BeginUpdate;
|
||||
DiffDlg.OnGetDiffFile:=OnGetDiffFile;
|
||||
DiffDlg.Files:=Files;
|
||||
@ -175,295 +176,90 @@ begin
|
||||
DiffDlg.Free;
|
||||
end;
|
||||
|
||||
{ TDiffDialog }
|
||||
{ TDiffDlg }
|
||||
|
||||
procedure TDiffDialog.DiffDialogResize(Sender: TObject);
|
||||
begin
|
||||
// text 1
|
||||
with Text1GroupBox do begin
|
||||
SetBounds(3,3,(Parent.ClientWidth-3*3) div 2,70);
|
||||
end;
|
||||
|
||||
// text 2
|
||||
with Text2GroupBox do begin
|
||||
SetBounds(Text1GroupBox.Left+Text1GroupBox.Width+3,Text1GroupBox.Top,
|
||||
Text1GroupBox.Width,Text1GroupBox.Height);
|
||||
end;
|
||||
|
||||
// diff preview
|
||||
with DiffGroupbox do begin
|
||||
SetBounds(Text1GroupBox.Left,Text1GroupBox.Top+Text1GroupBox.Height+5,
|
||||
Parent.ClientWidth-2*Text1GroupBox.Left,
|
||||
Max(30,Parent.ClientHeight-Text1GroupBox.Height-Text1GroupBox.Top
|
||||
-170));
|
||||
end;
|
||||
|
||||
// options
|
||||
with OptionsGroupBox do begin
|
||||
SetBounds(Text1GroupBox.Left,DiffGroupbox.Top+DiffGroupbox.Height+5,
|
||||
DiffGroupbox.Width,116);
|
||||
end;
|
||||
|
||||
// buttons
|
||||
with CloseButton do begin
|
||||
SetBounds(Parent.ClientWidth-300,Parent.ClientHeight-32,80,Height);
|
||||
end;
|
||||
|
||||
with OpenInEditorButton do begin
|
||||
SetBounds(CloseButton.Left+CloseButton.Width+10,CloseButton.Top,
|
||||
200,CloseButton.Height);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.OnChangeFlag(Sender: TObject);
|
||||
procedure TDiffDlg.OnChangeFlag(Sender: TObject);
|
||||
begin
|
||||
UpdateDiff;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.OpenInEditorButtonClick(Sender: TObject);
|
||||
procedure TDiffDlg.FileOpenClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=mrYes;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.CloseButtonClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=mrOk;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.OptionsGroupBoxResize(Sender: TObject);
|
||||
var
|
||||
y: Integer;
|
||||
x: Integer;
|
||||
W: Integer;
|
||||
begin
|
||||
y:=0;
|
||||
x:=4;
|
||||
W:=(OptionsGroupBox.ClientWidth div 2)-8;
|
||||
|
||||
with IgnoreCaseCheckBox do begin
|
||||
SetBounds(x,y,w,Height);
|
||||
inc(y,Height+2);
|
||||
end;
|
||||
|
||||
with IgnoreEmptyLineChangesCheckBox do begin
|
||||
SetBounds(x,y,w,Height);
|
||||
inc(y,Height+2);
|
||||
end;
|
||||
|
||||
with IgnoreHeadingSpacesCheckBox do begin
|
||||
SetBounds(x,y,w,Height);
|
||||
inc(y,Height+2);
|
||||
end;
|
||||
|
||||
with IgnoreLineEndsCheckBox do begin
|
||||
SetBounds(x,y,w+w,Height);
|
||||
inc(y,Height+2);
|
||||
end;
|
||||
|
||||
x:=(OptionsGroupBox.ClientWidth div 2)+4;
|
||||
y:=2;
|
||||
with IgnoreSpaceCharAmountCheckBox do begin
|
||||
SetBounds(x,y,w,Height);
|
||||
inc(y,Height+2);
|
||||
end;
|
||||
|
||||
with IgnoreSpaceCharsCheckBox do begin
|
||||
SetBounds(x,y,w,Height);
|
||||
inc(y,Height+2);
|
||||
end;
|
||||
|
||||
with IgnoreTrailingSpacesCheckBox do begin
|
||||
SetBounds(x,y,w,Height);
|
||||
if dlgOpen.Execute then
|
||||
begin
|
||||
//only add new files
|
||||
if Text1ComboBox.Items.IndexOf(dlgOpen.FileName) = -1 then
|
||||
begin
|
||||
Files.Add(TDiffFile.Create(dlgOpen.FileName,-1,False));
|
||||
Text1ComboBox.Items.Add(dlgOpen.FileName);
|
||||
Text2ComboBox.Items.Add(dlgOpen.FileName);
|
||||
end;
|
||||
|
||||
//set the combobox and make the diff
|
||||
if TButton(Sender).Name = 'Text1FileOpenButton'then
|
||||
with Text1ComboBox do
|
||||
begin
|
||||
ItemIndex := Items.IndexOf(dlgOpen.FileName);
|
||||
SetText1Index(Items.IndexOf(dlgOpen.FileName));
|
||||
end
|
||||
else
|
||||
with Text2ComboBox do
|
||||
begin
|
||||
ItemIndex := Items.IndexOf(dlgOpen.FileName);
|
||||
SetText2Index(Items.IndexOf(dlgOpen.FileName));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.Text1ComboboxChange(Sender: TObject);
|
||||
procedure TDiffDlg.SaveDiffButtonClick(Sender: TObject);
|
||||
begin
|
||||
if dlgSave.Execute then
|
||||
DiffSynEdit.Lines.SaveToFile(dlgSave.FileName);
|
||||
end;
|
||||
|
||||
procedure TDiffDlg.Text1ComboboxChange(Sender: TObject);
|
||||
begin
|
||||
SetText1Index(Text1Combobox.Items.IndexOf(Text1Combobox.Text));
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.Text1GroupBoxResize(Sender: TObject);
|
||||
begin
|
||||
with Text1Combobox do begin
|
||||
SetBounds(0,0,Parent.ClientWidth,Height);
|
||||
end;
|
||||
|
||||
with Text1OnlySelectionCheckBox do begin
|
||||
SetBounds(10,Text1Combobox.Top+Text1Combobox.Height+1,
|
||||
Parent.ClientWidth-20,Height);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.Text2ComboboxChange(Sender: TObject);
|
||||
procedure TDiffDlg.Text2ComboboxChange(Sender: TObject);
|
||||
begin
|
||||
SetText2Index(Text2Combobox.Items.IndexOf(Text2Combobox.Text));
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.Text2GroupBoxResize(Sender: TObject);
|
||||
begin
|
||||
with Text2Combobox do begin
|
||||
SetBounds(0,0,Parent.ClientWidth,Height);
|
||||
end;
|
||||
|
||||
with Text2OnlySelectionCheckBox do begin
|
||||
SetBounds(10,Text1Combobox.Top+Text1Combobox.Height+1,
|
||||
Parent.ClientWidth-20,Height);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.SetupComponents;
|
||||
procedure TDiffDlg.SetupComponents;
|
||||
begin
|
||||
// text 1
|
||||
Text1GroupBox:=TGroupBox.Create(Self);
|
||||
with Text1GroupBox do begin
|
||||
Name:='Text1GroupBox';
|
||||
Parent:=Self;
|
||||
Caption:=lisDiffDlgText1;
|
||||
OnResize:=@Text1GroupBoxResize;
|
||||
end;
|
||||
|
||||
Text1Combobox:=TComboBox.Create(Self);
|
||||
with Text1Combobox do begin
|
||||
Name:='Text1Combobox';
|
||||
Parent:=Text1GroupBox;
|
||||
OnChange:=@Text1ComboboxChange;
|
||||
end;
|
||||
|
||||
Text1OnlySelectionCheckBox:=TCheckBox.Create(Self);
|
||||
with Text1OnlySelectionCheckBox do begin
|
||||
Name:='Text1OnlySelectionCheckBox';
|
||||
Parent:=Text1GroupBox;
|
||||
Caption:=lisDiffDlgOnlySelection;
|
||||
OnClick:=@OnChangeFlag;
|
||||
end;
|
||||
Text1GroupBox.Caption:=lisDiffDlgText1;
|
||||
Text1OnlySelectionCheckBox.Caption:=lisDiffDlgOnlySelection;
|
||||
|
||||
// text 2
|
||||
Text2GroupBox:=TGroupBox.Create(Self);
|
||||
with Text2GroupBox do begin
|
||||
Name:='Text2GroupBox';
|
||||
Parent:=Self;
|
||||
Caption:=lisDiffDlgText2;
|
||||
OnResize:=@Text2GroupBoxResize;
|
||||
end;
|
||||
|
||||
Text2Combobox:=TComboBox.Create(Self);
|
||||
with Text2Combobox do begin
|
||||
Name:='Text2Combobox';
|
||||
Parent:=Text2GroupBox;
|
||||
OnChange:=@Text2ComboboxChange;
|
||||
end;
|
||||
|
||||
Text2OnlySelectionCheckBox:=TCheckBox.Create(Self);
|
||||
with Text2OnlySelectionCheckBox do begin
|
||||
Name:='Text2OnlySelectionCheckBox';
|
||||
Parent:=Text2GroupBox;
|
||||
Caption:=lisDiffDlgOnlySelection;
|
||||
OnClick:=@OnChangeFlag;
|
||||
end;
|
||||
|
||||
// diff preview
|
||||
DiffGroupbox:=TGroupBox.Create(Self);
|
||||
with DiffGroupbox do begin
|
||||
Name:='DiffGroupbox';
|
||||
Parent:=Self;
|
||||
Caption:=lisMenuDiff;
|
||||
end;
|
||||
|
||||
DiffSynEdit:=TSynEdit.Create(Self);
|
||||
with DiffSynEdit do begin
|
||||
Name:='DiffSynEdit';
|
||||
Parent:=DiffGroupbox;
|
||||
Gutter.Visible:=false;
|
||||
Align:=alClient;
|
||||
end;
|
||||
Text2GroupBox.Caption:=lisDiffDlgText2;
|
||||
Text2OnlySelectionCheckBox.Caption:=lisDiffDlgOnlySelection;
|
||||
|
||||
// options
|
||||
OptionsGroupBox:=TGroupBox.Create(Self);
|
||||
with OptionsGroupBox do begin
|
||||
Name:='OptionsGroupBox';
|
||||
Parent:=Self;
|
||||
with OptionsGroupBox do
|
||||
begin
|
||||
Caption:=dlgFROpts;
|
||||
OnResize:=@OptionsGroupBoxResize;
|
||||
end;
|
||||
|
||||
IgnoreCaseCheckBox:=TCheckBox.Create(Self);
|
||||
with IgnoreCaseCheckBox do begin
|
||||
Name:='IgnoreCaseCheckBox';
|
||||
Parent:=OptionsGroupBox;
|
||||
Caption:=lisDiffDlgCaseInsensitive;
|
||||
OnClick:=@OnChangeFlag;
|
||||
end;
|
||||
|
||||
IgnoreEmptyLineChangesCheckBox:=TCheckBox.Create(Self);
|
||||
with IgnoreEmptyLineChangesCheckBox do begin
|
||||
Name:='IgnoreEmptyLineChangesCheckBox';
|
||||
Parent:=OptionsGroupBox;
|
||||
Caption:=lisDiffDlgIgnoreIfEmptyLinesWereAdd;
|
||||
OnClick:=@OnChangeFlag;
|
||||
end;
|
||||
|
||||
IgnoreHeadingSpacesCheckBox:=TCheckBox.Create(Self);
|
||||
with IgnoreHeadingSpacesCheckBox do begin
|
||||
Name:='IgnoreHeadingSpacesCheckBox';
|
||||
Parent:=OptionsGroupBox;
|
||||
Caption:=lisDiffDlgIgnoreSpacesAtStartOfLine;
|
||||
OnClick:=@OnChangeFlag;
|
||||
end;
|
||||
|
||||
IgnoreTrailingSpacesCheckBox:=TCheckBox.Create(Self);
|
||||
with IgnoreTrailingSpacesCheckBox do begin
|
||||
Name:='IgnoreTrailingSpacesCheckBox';
|
||||
Parent:=OptionsGroupBox;
|
||||
Caption:=lisDiffDlgIgnoreSpacesAtEndOfLine;
|
||||
OnClick:=@OnChangeFlag;
|
||||
end;
|
||||
|
||||
IgnoreLineEndsCheckBox:=TCheckBox.Create(Self);
|
||||
with IgnoreLineEndsCheckBox do begin
|
||||
Name:='IgnoreLineEndsCheckBox';
|
||||
Parent:=OptionsGroupBox;
|
||||
Caption:=lisDiffDlgIgnoreIfLineEndCharsDiffe;
|
||||
OnClick:=@OnChangeFlag;
|
||||
end;
|
||||
|
||||
IgnoreSpaceCharAmountCheckBox:=TCheckBox.Create(Self);
|
||||
with IgnoreSpaceCharAmountCheckBox do begin
|
||||
Name:='IgnoreSpaceCharAmountCheckBox';
|
||||
Parent:=OptionsGroupBox;
|
||||
Caption:=lisDiffDlgIgnoreIfSpaceCharsWereAdd;
|
||||
OnClick:=@OnChangeFlag;
|
||||
end;
|
||||
|
||||
IgnoreSpaceCharsCheckBox:=TCheckBox.Create(Self);
|
||||
with IgnoreSpaceCharsCheckBox do begin
|
||||
Name:='IgnoreSpaceCharsCheckBox';
|
||||
Parent:=OptionsGroupBox;
|
||||
Caption:=lisDiffDlgIgnoreSpaces;
|
||||
OnClick:=@OnChangeFlag;
|
||||
Items.Add(lisDiffDlgCaseInsensitive);
|
||||
Items.Add(lisDiffDlgIgnoreIfEmptyLinesWereAdd);
|
||||
Items.Add(lisDiffDlgIgnoreSpacesAtStartOfLine);
|
||||
Items.Add(lisDiffDlgIgnoreSpacesAtEndOfLine);
|
||||
Items.Add(lisDiffDlgIgnoreIfLineEndCharsDiffe);
|
||||
Items.Add(lisDiffDlgIgnoreIfSpaceCharsWereAdd);
|
||||
Items.Add(lisDiffDlgIgnoreSpaces);
|
||||
end;
|
||||
|
||||
// buttons
|
||||
CloseButton:=TButton.Create(Self);
|
||||
with CloseButton do begin
|
||||
Name:='CloseButton';
|
||||
Parent:=Self;
|
||||
Caption:=lisMenuClose;
|
||||
OnClick:=@CloseButtonClick;
|
||||
end;
|
||||
|
||||
OpenInEditorButton:=TButton.Create(Self);
|
||||
with OpenInEditorButton do begin
|
||||
Name:='OpenInEditorButton';
|
||||
Parent:=Self;
|
||||
Caption:=lisDiffDlgOpenDiffInEditor;
|
||||
OnClick:=@OpenInEditorButtonClick;
|
||||
end;
|
||||
CloseButton.Caption:=lisMenuClose;
|
||||
OpenInEditorButton.Caption:=lisDiffDlgOpenDiffInEditor;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.UpdateDiff;
|
||||
procedure TDiffDlg.UpdateDiff;
|
||||
var
|
||||
Text1Src, Text2Src: string;
|
||||
DiffTxt: String;
|
||||
dat : TStrings;
|
||||
begin
|
||||
if FLockCount>0 then begin
|
||||
fDiffNeedsUpdate:=true;
|
||||
@ -473,37 +269,50 @@ begin
|
||||
if (Text1=nil) or (Text2=nil) then begin
|
||||
DiffSynEdit.Lines.Text:='';
|
||||
end else begin
|
||||
OnGetDiffFile(Text1.ID,
|
||||
Text1.SelectionAvailable and Text1OnlySelectionCheckBox.Checked,
|
||||
Text1Src);
|
||||
OnGetDiffFile(Text2.ID,
|
||||
Text2.SelectionAvailable and Text2OnlySelectionCheckBox.Checked,
|
||||
Text2Src);
|
||||
if Text1.ID = -1 then
|
||||
begin
|
||||
dat := TStringList.Create;
|
||||
dat.LoadFromFile(Text1.Name);
|
||||
Text1Src := dat.Text;
|
||||
dat.Free;
|
||||
end
|
||||
else
|
||||
OnGetDiffFile(Text1.ID,
|
||||
Text1.SelectionAvailable and Text1OnlySelectionCheckBox.Checked,
|
||||
Text1Src);
|
||||
|
||||
if Text2.ID = -1 then
|
||||
begin
|
||||
dat := TStringList.Create;
|
||||
dat.LoadFromFile(Text2.Name);
|
||||
Text2Src := dat.Text;
|
||||
dat.Free;
|
||||
end
|
||||
else
|
||||
OnGetDiffFile(Text2.ID,
|
||||
Text2.SelectionAvailable and Text2OnlySelectionCheckBox.Checked,
|
||||
Text2Src);
|
||||
|
||||
DiffTxt:=CreateTextDiff(Text1Src,Text2Src,GetDiffOptions,tdoContext);
|
||||
|
||||
DiffSynEdit.Lines.Text:=DiffTxt;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TDiffDialog.Create(TheOwner: TComponent);
|
||||
constructor TDiffDlg.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
Name:='DiffDialog';
|
||||
Caption := lisMenuDiff;
|
||||
Width:=600;
|
||||
Height:=400;
|
||||
Position:=poScreenCenter;
|
||||
IDEDialogLayoutList.ApplyLayout(Self,600,400);
|
||||
OnResize:=@DiffDialogResize;
|
||||
IDEDialogLayoutList.ApplyLayout(Self,600,500);
|
||||
SetupComponents;
|
||||
OnResize(nil);
|
||||
end;
|
||||
|
||||
destructor TDiffDialog.Destroy;
|
||||
destructor TDiffDlg.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.Init;
|
||||
procedure TDiffDlg.Init;
|
||||
var
|
||||
LastText2Name: String;
|
||||
i: Integer;
|
||||
@ -526,7 +335,7 @@ begin
|
||||
UpdateDiff;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.FillTextComboBoxes;
|
||||
procedure TDiffDlg.FillTextComboBoxes;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -545,7 +354,7 @@ begin
|
||||
Text2Combobox.Items.EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.SetText1Index(NewIndex: integer);
|
||||
procedure TDiffDlg.SetText1Index(NewIndex: integer);
|
||||
var
|
||||
OldText1: TDiffFile;
|
||||
begin
|
||||
@ -562,7 +371,7 @@ begin
|
||||
if Text1<>OldText1 then UpdateDiff;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.SetText2Index(NewIndex: integer);
|
||||
procedure TDiffDlg.SetText2Index(NewIndex: integer);
|
||||
var
|
||||
OldText2: TDiffFile;
|
||||
begin
|
||||
@ -579,7 +388,7 @@ begin
|
||||
if Text2<>OldText2 then UpdateDiff;
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.SaveSettings;
|
||||
procedure TDiffDlg.SaveSettings;
|
||||
begin
|
||||
InputHistories.DiffFlags:=GetDiffOptions;
|
||||
if Text2<>nil then begin
|
||||
@ -592,42 +401,42 @@ begin
|
||||
IDEDialogLayoutList.SaveLayout(Self);
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.SetDiffOptions(NewOptions: TTextDiffFlags);
|
||||
procedure TDiffDlg.SetDiffOptions(NewOptions: TTextDiffFlags);
|
||||
begin
|
||||
IgnoreCaseCheckBox.Checked:=tdfIgnoreCase in NewOptions;
|
||||
IgnoreEmptyLineChangesCheckBox.Checked:=tdfIgnoreEmptyLineChanges in NewOptions;
|
||||
IgnoreHeadingSpacesCheckBox.Checked:=tdfIgnoreHeadingSpaces in NewOptions;
|
||||
IgnoreLineEndsCheckBox.Checked:=tdfIgnoreLineEnds in NewOptions;
|
||||
IgnoreSpaceCharAmountCheckBox.Checked:=tdfIgnoreSpaceCharAmount in NewOptions;
|
||||
IgnoreSpaceCharsCheckBox.Checked:=tdfIgnoreSpaceChars in NewOptions;
|
||||
IgnoreTrailingSpacesCheckBox.Checked:=tdfIgnoreTrailingSpaces in NewOptions;
|
||||
OptionsGroupBox.Checked[IgnoreCaseCheckBox]:=tdfIgnoreCase in NewOptions;
|
||||
OptionsGroupBox.Checked[IgnoreEmptyLineChangesCheckBox]:=tdfIgnoreEmptyLineChanges in NewOptions;
|
||||
OptionsGroupBox.Checked[IgnoreHeadingSpacesCheckBox]:=tdfIgnoreHeadingSpaces in NewOptions;
|
||||
OptionsGroupBox.Checked[IgnoreLineEndsCheckBox]:=tdfIgnoreLineEnds in NewOptions;
|
||||
OptionsGroupBox.Checked[IgnoreSpaceCharAmountCheckBox]:=tdfIgnoreSpaceCharAmount in NewOptions;
|
||||
OptionsGroupBox.Checked[IgnoreSpaceCharsCheckBox]:=tdfIgnoreSpaceChars in NewOptions;
|
||||
OptionsGroupBox.Checked[IgnoreTrailingSpacesCheckBox]:=tdfIgnoreTrailingSpaces in NewOptions;
|
||||
end;
|
||||
|
||||
function TDiffDialog.GetDiffOptions: TTextDiffFlags;
|
||||
function TDiffDlg.GetDiffOptions: TTextDiffFlags;
|
||||
begin
|
||||
Result:=[];
|
||||
if IgnoreCaseCheckBox.Checked then
|
||||
if OptionsGroupBox.Checked[IgnoreCaseCheckBox] then
|
||||
Include(Result,tdfIgnoreCase);
|
||||
if IgnoreEmptyLineChangesCheckBox.Checked then
|
||||
if OptionsGroupBox.Checked[IgnoreEmptyLineChangesCheckBox] then
|
||||
Include(Result,tdfIgnoreEmptyLineChanges);
|
||||
if IgnoreHeadingSpacesCheckBox.Checked then
|
||||
if OptionsGroupBox.Checked[IgnoreHeadingSpacesCheckBox] then
|
||||
Include(Result,tdfIgnoreHeadingSpaces);
|
||||
if IgnoreLineEndsCheckBox.Checked then
|
||||
if OptionsGroupBox.Checked[IgnoreLineEndsCheckBox] then
|
||||
Include(Result,tdfIgnoreLineEnds);
|
||||
if IgnoreSpaceCharAmountCheckBox.Checked then
|
||||
if OptionsGroupBox.Checked[IgnoreSpaceCharAmountCheckBox] then
|
||||
Include(Result,tdfIgnoreSpaceCharAmount);
|
||||
if IgnoreSpaceCharsCheckBox.Checked then
|
||||
if OptionsGroupBox.Checked[IgnoreSpaceCharsCheckBox] then
|
||||
Include(Result,tdfIgnoreSpaceChars);
|
||||
if IgnoreTrailingSpacesCheckBox.Checked then
|
||||
if OptionsGroupBox.Checked[IgnoreTrailingSpacesCheckBox] then
|
||||
Include(Result,tdfIgnoreTrailingSpaces);
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.BeginUpdate;
|
||||
procedure TDiffDlg.BeginUpdate;
|
||||
begin
|
||||
inc(FLockCount);
|
||||
end;
|
||||
|
||||
procedure TDiffDialog.EndUpdate;
|
||||
procedure TDiffDlg.EndUpdate;
|
||||
begin
|
||||
dec(FLockCount);
|
||||
if (FLockCount=0) and fDiffNeedsUpdate then UpdateDiff;
|
||||
@ -675,5 +484,8 @@ begin
|
||||
while (Result>=0) and (Items[Result].Name<>Name) do dec(Result);
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I diffdialog.lrs}
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user