Skip to content

Commit 6c57b03

Browse files
author
delphidabbler
committed
Revised text of intro page and styling of intro and finish pages of SWAG import wizard
1 parent 9b6d5b8 commit 6c57b03

File tree

5 files changed

+113
-112
lines changed

5 files changed

+113
-112
lines changed

Src/FmSWAGImportDlg.dfm

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,24 @@ 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
32-
inline frmIntro: TFixedHTMLDlgFrame
28+
inline frmIntro: THTMLTpltDlgFrame
3329
Left = 0
3430
Top = 0
3531
Width = 663
36-
Height = 446
32+
Height = 236
3733
Align = alTop
3834
TabOrder = 0
3935
TabStop = True
40-
ExplicitWidth = 663
41-
ExplicitHeight = 446
36+
ExplicitLeft = 8
37+
ExplicitTop = 8
4238
inherited pnlBrowser: TPanel
4339
Width = 663
44-
Height = 446
45-
ExplicitWidth = 663
46-
ExplicitHeight = 446
4740
inherited wbBrowser: TWebBrowser
4841
Width = 663
49-
Height = 446
50-
ExplicitWidth = 663
51-
ExplicitHeight = 446
42+
ExplicitWidth = 320
43+
ExplicitHeight = 240
5244
ControlData = {
53-
4C00000086440000182E00000000000000000000000000000000000000000000
45+
4C00000086440000641800000000000000000000000000000000000000000000
5446
000000004C000000000000000000000001000000E0D057007335CF11AE690800
5547
2B2E126208000000000000004C0000000114020000000000C000000000000046
5648
8000000000000000000000000000000000000000000000000000000000000000
@@ -63,10 +55,6 @@ inherited SWAGImportDlg: TSWAGImportDlg
6355
Caption = 'tsFolder'
6456
ImageIndex = 4
6557
TabVisible = False
66-
ExplicitLeft = 0
67-
ExplicitTop = 27
68-
ExplicitWidth = 0
69-
ExplicitHeight = 425
7058
object lblFolder: TLabel
7159
Left = 0
7260
Top = 8
@@ -110,10 +98,6 @@ inherited SWAGImportDlg: TSWAGImportDlg
11098
Caption = 'tsCategories'
11199
ImageIndex = 1
112100
TabVisible = False
113-
ExplicitLeft = 0
114-
ExplicitTop = 0
115-
ExplicitWidth = 0
116-
ExplicitHeight = 0
117101
object lblCategories: TLabel
118102
Left = 0
119103
Top = 45
@@ -186,10 +170,6 @@ inherited SWAGImportDlg: TSWAGImportDlg
186170
Caption = 'tsUpdate'
187171
ImageIndex = 2
188172
TabVisible = False
189-
ExplicitLeft = 0
190-
ExplicitTop = 0
191-
ExplicitWidth = 0
192-
ExplicitHeight = 0
193173
object lblUpdateDesc: TLabel
194174
Left = 0
195175
Top = 3
@@ -232,16 +212,14 @@ inherited SWAGImportDlg: TSWAGImportDlg
232212
Caption = 'tsFinish'
233213
ImageIndex = 3
234214
TabVisible = False
235-
ExplicitLeft = 0
236-
ExplicitTop = 0
237-
ExplicitWidth = 0
238-
ExplicitHeight = 0
239215
inline frmOutro: THTMLTpltDlgFrame
240216
Left = 0
241217
Top = 0
242218
Width = 663
243219
Height = 446
244220
Align = alTop
221+
DoubleBuffered = False
222+
ParentDoubleBuffered = False
245223
TabOrder = 0
246224
TabStop = True
247225
ExplicitWidth = 663

Src/FmSWAGImportDlg.pas

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ interface
4444
FrHTMLTpltDlg,
4545
UBaseObjects,
4646
UContainers,
47+
UCSSBuilder,
4748
SWAG.UCommon,
4849
SWAG.UImporter,
4950
SWAG.UReader, ActnList;
@@ -57,7 +58,6 @@ TSWAGImportDlg = class(TWizardDlg, INoPublicConstruct)
5758
tsIntro: TTabSheet;
5859
tsCategories: TTabSheet;
5960
lblCategories: TLabel;
60-
frmIntro: TFixedHTMLDlgFrame;
6161
lbCategories: TListBox;
6262
lblCategoriesDesc: TLabel;
6363
lblSelectSnippets: TLabel;
@@ -78,6 +78,7 @@ TSWAGImportDlg = class(TWizardDlg, INoPublicConstruct)
7878
lblFolderPageInfo: TLabel;
7979
btnBrowse: TButton;
8080
actBrowse: TAction;
81+
frmIntro: THTMLTpltDlgFrame;
8182
/// <summary>Handles clicks on the check boxes next to snippets in the
8283
/// snippet selection list box by selecting and deselecting snippets for
8384
/// inclusion in the import.</summary>
@@ -150,6 +151,13 @@ TSWAGImportDlg = class(TWizardDlg, INoPublicConstruct)
150151
/// <summary>Validates entries on the wizard page identified by the given
151152
/// page index.</summary>
152153
procedure ValidatePage(const PageIdx: Integer);
154+
/// <summary>Handles HTML template frame's OnBuildCSS event. Adds
155+
/// additional CSS required by HTML in this form.</summary>
156+
/// <param name="Sender">TObject [in] Reference to object triggering event.
157+
/// </param>
158+
/// <param name="CSSBuilder">TCSSBuilder [in] Object used to construct the
159+
/// CSS.</param>
160+
procedure BuildCSS(Sender: TObject; const CSSBuilder: TCSSBuilder);
153161
/// <summary>Displays snippets selected for import in list view on Update
154162
/// page.</summary>
155163
procedure PopulateImportsLV;
@@ -246,14 +254,17 @@ implementation
246254
FmPreviewDlg,
247255
FmWaitDlg,
248256
UBrowseForFolderDlg,
257+
UColours,
249258
UConsts,
259+
UCSSUtils,
250260
UCtrlArranger,
251261
UEncodings,
252262
UExceptions,
253263
UHTMLTemplate,
254264
UMessageBox,
255265
UStrUtils,
256-
UWaitForThreadUI;
266+
UWaitForThreadUI,
267+
Web.UInfo;
257268

258269
{$R *.dfm}
259270

@@ -403,6 +414,21 @@ procedure TSWAGImportDlg.BeginPage(const PageIdx: Integer);
403414
end;
404415
end;
405416

417+
procedure TSWAGImportDlg.BuildCSS(Sender: TObject;
418+
const CSSBuilder: TCSSBuilder);
419+
begin
420+
inherited;
421+
// Set body text spacing
422+
with CSSBuilder.Selectors['body'] do
423+
AddProperty(TCSS.LineHeightProp(120));
424+
// Create .framed border style
425+
with CSSBuilder.AddSelector('.framed') do
426+
begin
427+
AddProperty(TCSS.BorderProp(cssAll, 1, cbsSolid, clBorder));
428+
AddProperty(TCSS.PaddingProp(4));
429+
end;
430+
end;
431+
406432
procedure TSWAGImportDlg.clbSelectSnippetsClickCheck(Sender: TObject);
407433
var
408434
SelIdx: Integer;
@@ -440,6 +466,7 @@ procedure TSWAGImportDlg.ConfigForm;
440466
begin
441467
inherited;
442468
pcWizard.ActivePage := tsFinish;
469+
frmOutro.OnBuildCSS := BuildCSS;
443470
frmOutro.Initialise(
444471
'dlg-swag-import-outro-tplt.html',
445472
procedure (Tplt: THTMLTemplate)
@@ -451,7 +478,17 @@ procedure TSWAGImportDlg.ConfigForm;
451478
end
452479
);
453480
pcWizard.ActivePage := tsIntro;
454-
frmIntro.Initialise('dlg-swag-import-intro.html');
481+
frmIntro.OnBuildCSS := BuildCSS;
482+
frmIntro.Initialise(
483+
'dlg-swag-import-intro-tplt.html',
484+
procedure (Tplt: THTMLTemplate)
485+
begin
486+
Tplt.ResolvePlaceholderText(
487+
'SWAGReleaseURL',
488+
TWebInfo.SWAGReleaseURL
489+
);
490+
end
491+
);
455492
end;
456493

457494
destructor TSWAGImportDlg.Destroy;

Src/HTML.hrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Res\HTML\dlg-activetext-preview-tplt.html
4141
Res\HTML\dlg-rssnews.html
4242

4343
# SWAG import dialogue
44-
Res\HTML\dlg-swag-import-intro.html
44+
Res\HTML\dlg-swag-import-intro-tplt.html
4545
Res\HTML\dlg-swag-import-outro-tplt.html
4646

4747
# code submission wizard
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE html
4+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
5+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
6+
7+
<!--
8+
* This Source Code Form is subject to the terms of the Mozilla Public License,
9+
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
10+
* obtain one at http://mozilla.org/MPL/2.0/
11+
*
12+
* Copyright (C) 2013, Peter Johnson (www.delphidabbler.com).
13+
*
14+
* $Rev$
15+
* $Date$
16+
*
17+
* Introductory information displayed on the first page of the SWAG Import
18+
* Wizard.
19+
-->
20+
21+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
22+
23+
<head>
24+
<title>dlg-swag-import-intro.html</title>
25+
</head>
26+
27+
<body>
28+
29+
<p>
30+
This wizard enables you to import snippets from the <a
31+
class="help-link"
32+
href="help:AboutSWAG"
33+
>SWAG database</a> into your local user database.
34+
</p>
35+
36+
<p class="framed">
37+
You must have a copy of a specially prepared version of SWAG on your local system before continuing. If you haven't already got it then you need to download it from the <em>delphidabbler/swag</em> repository on GitHub. Go to <a
38+
class="external-link"
39+
href="<%SWAGReleaseURL%>"
40+
><%SWAGReleaseURL%></a> and find the latest release of the XML version of SWAG. The file name will be in the form <code>swag-xml-vX.X.X</code> where <code>X.X.X</code> is the version number. Download the file and unzip it into a folder on your computer. Make a note of the folder's location - it will be needed in the next step.
41+
42+
<p>
43+
On the next page of the wizard you will be asked for the location of the folder containing the SWAG database. <em>CodeSnip</em> will then open the database and display all SWAG's categories on the following page. From there you can browse and display the snippets in each category before selecting those you want to import. You get a chance to review these before importing.
44+
</p>
45+
46+
<p>
47+
All snippets are imported as <a
48+
class="help-link"
49+
href="help:SnippetFreeform"
50+
>freeform</a>.
51+
</p>
52+
53+
<p>
54+
<em>CodeSnip</em> does not keep a track of snippets imported from SWAG &ndash; it treats them just like any other user defined snippet. This means it is possible to import the same snippet more than once. It's up to you to keep track of this.
55+
</p>
56+
57+
<p>
58+
<strong>Note:</strong> It can take quite some time to import snippets from SWAG. You are advised not to import more than about 20 snippets in one go. If you want to import a lot of snippets you should run this wizard more than once.
59+
</p>
60+
61+
</body>
62+
63+
</html>

Src/Res/HTML/dlg-swag-import-intro.html

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)