Skip to content

Commit b3273e8

Browse files
author
delphidabbler
committed
Revised SWAG importing to use local data instead of web service.
Local data is a folder containing a copy of the SWAG source from the delphidabbler/swag project on GitHub. It includes a main XML file and separate source files for each snippet. As few changes made as possible. A new SWAG.UXMLProcessor unit provides access to the XML file SWAG.UReader was modified to use SWAG.UXMLProcessor instead of Web.USWAGRESTMgr to get SWAG data, A new tab was added to TSWAGImportDlg where the user provides the path to the local folder containing SWAG data. The form was also modified to validate the data path and to use the modified data format.
1 parent 145f65d commit b3273e8

File tree

6 files changed

+821
-197
lines changed

6 files changed

+821
-197
lines changed

Src/CodeSnip.dpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ uses
186186
SWAG.UImporter in 'SWAG.UImporter.pas',
187187
SWAG.UReader in 'SWAG.UReader.pas',
188188
SWAG.USnippetCache in 'SWAG.USnippetCache.pas',
189+
SWAG.UXMLProcessor in 'SWAG.UXMLProcessor.pas',
189190
UActionFactory in 'UActionFactory.pas',
190191
UAnchors in 'UAnchors.pas',
191192
UAppInfo in 'UAppInfo.pas',

Src/CodeSnip.dproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@
384384
<DCCReference Include="SWAG.UImporter.pas"/>
385385
<DCCReference Include="SWAG.UReader.pas"/>
386386
<DCCReference Include="SWAG.USnippetCache.pas"/>
387+
<DCCReference Include="SWAG.UXMLProcessor.pas"/>
387388
<DCCReference Include="UActionFactory.pas"/>
388389
<DCCReference Include="UAnchors.pas"/>
389390
<DCCReference Include="UAppInfo.pas"/>

Src/FmSWAGImportDlg.dfm

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ inherited SWAGImportDlg: TSWAGImportDlg
44
ClientHeight = 505
55
ClientWidth = 687
66
ExplicitWidth = 693
7-
ExplicitHeight = 533
7+
ExplicitHeight = 534
88
PixelsPerInch = 96
99
TextHeight = 13
1010
inherited pnlBody: TPanel
@@ -25,6 +25,10 @@ inherited SWAGImportDlg: TSWAGImportDlg
2525
object tsIntro: TTabSheet
2626
Caption = 'tsIntro'
2727
TabVisible = False
28+
ExplicitLeft = 0
29+
ExplicitTop = 0
30+
ExplicitWidth = 0
31+
ExplicitHeight = 0
2832
inline frmIntro: TFixedHTMLDlgFrame
2933
Left = 0
3034
Top = 0
@@ -55,10 +59,61 @@ inherited SWAGImportDlg: TSWAGImportDlg
5559
end
5660
end
5761
end
62+
object tsFolder: TTabSheet
63+
Caption = 'tsFolder'
64+
ImageIndex = 4
65+
TabVisible = False
66+
ExplicitLeft = 0
67+
ExplicitTop = 27
68+
ExplicitWidth = 0
69+
ExplicitHeight = 425
70+
object lblFolder: TLabel
71+
Left = 0
72+
Top = 8
73+
Width = 393
74+
Height = 13
75+
Caption =
76+
'Enter the SWAG database download &folder: (click the button to b' +
77+
'rowse for folder)'
78+
FocusControl = edPath
79+
end
80+
object lblFolderPageInfo: TLabel
81+
Left = 0
82+
Top = 72
83+
Width = 270
84+
Height = 13
85+
Caption = 'Click the Next button to choose which snippets to import'
86+
end
87+
object edPath: TEdit
88+
Left = 0
89+
Top = 28
90+
Width = 484
91+
Height = 21
92+
TabOrder = 0
93+
end
94+
object btnBrowse: TButton
95+
Left = 490
96+
Top = 28
97+
Width = 27
98+
Height = 21
99+
Action = actBrowse
100+
Font.Charset = DEFAULT_CHARSET
101+
Font.Color = clWindowText
102+
Font.Height = -11
103+
Font.Name = 'Tahoma'
104+
Font.Style = [fsBold]
105+
ParentFont = False
106+
TabOrder = 1
107+
end
108+
end
58109
object tsCategories: TTabSheet
59110
Caption = 'tsCategories'
60111
ImageIndex = 1
61112
TabVisible = False
113+
ExplicitLeft = 0
114+
ExplicitTop = 0
115+
ExplicitWidth = 0
116+
ExplicitHeight = 0
62117
object lblCategories: TLabel
63118
Left = 0
64119
Top = 45
@@ -131,6 +186,10 @@ inherited SWAGImportDlg: TSWAGImportDlg
131186
Caption = 'tsUpdate'
132187
ImageIndex = 2
133188
TabVisible = False
189+
ExplicitLeft = 0
190+
ExplicitTop = 0
191+
ExplicitWidth = 0
192+
ExplicitHeight = 0
134193
object lblUpdateDesc: TLabel
135194
Left = 0
136195
Top = 3
@@ -173,6 +232,10 @@ inherited SWAGImportDlg: TSWAGImportDlg
173232
Caption = 'tsFinish'
174233
ImageIndex = 3
175234
TabVisible = False
235+
ExplicitLeft = 0
236+
ExplicitTop = 0
237+
ExplicitWidth = 0
238+
ExplicitHeight = 0
176239
inline frmOutro: THTMLTpltDlgFrame
177240
Left = 0
178241
Top = 0
@@ -218,5 +281,9 @@ inherited SWAGImportDlg: TSWAGImportDlg
218281
OnExecute = actDisplaySnippetExecute
219282
OnUpdate = actDisplaySnippetUpdate
220283
end
284+
object actBrowse: TAction
285+
Caption = '...'
286+
OnExecute = actBrowseExecute
287+
end
221288
end
222289
end

0 commit comments

Comments
 (0)