Skip to content

Commit 71ff6d7

Browse files
author
delphidabbler
committed
Merge branch 'feature/update-external-obj' into develop
2 parents 7a9a1cc + ff2cc47 commit 71ff6d7

File tree

10 files changed

+33
-244
lines changed

10 files changed

+33
-244
lines changed

Src/CodeSnip.dpr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ uses
313313
USelectionIOMgr in 'USelectionIOMgr.pas',
314314
USettings in 'USettings.pas',
315315
UShowCaseCtrl in 'UShowCaseCtrl.pas',
316-
UShowPrefsPageAction in 'UShowPrefsPageAction.pas',
317316
USimpleDispatch in 'USimpleDispatch.pas',
318317
USingleton in 'USingleton.pas',
319318
USnipKindListAdapter in 'USnipKindListAdapter.pas',

Src/CodeSnip.dproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@
510510
<DCCReference Include="USelectionIOMgr.pas"/>
511511
<DCCReference Include="USettings.pas"/>
512512
<DCCReference Include="UShowCaseCtrl.pas"/>
513-
<DCCReference Include="UShowPrefsPageAction.pas"/>
514513
<DCCReference Include="USimpleDispatch.pas"/>
515514
<DCCReference Include="USingleton.pas"/>
516515
<DCCReference Include="USnipKindListAdapter.pas"/>

Src/ExternalObj.ridl

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
[
1414
uuid(DA95AEFB-3FB5-4A9E-9F9D-A53DD05CA7D4),
15-
version(13.0),
15+
version(14.0),
1616
helpstring("CodeSnip DOM External Object Extender Type Library"),
1717
custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 117441012),
1818
custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 1219706147)
@@ -24,19 +24,19 @@ library ExternalObj
2424
importlib("stdole2.tlb");
2525

2626
/*
27-
* V13 interface of extension to browser DOM's "external" object.
27+
* V14 interface of extension to browser DOM's "external" object.
2828
*/
29-
interface IWBExternal13;
29+
interface IWBExternal14;
3030

3131

3232
[
3333
uuid(BA971829-ED4D-4092-BCAE-4B5DB1A2D74A),
34-
version(13.0),
34+
version(14.0),
3535
helpstring("DOM external object extender"),
3636
dual,
3737
oleautomation
3838
]
39-
interface IWBExternal13: IDispatch
39+
interface IWBExternal14: IDispatch
4040
{
4141
/*
4242
* Update database from internet.
@@ -72,38 +72,25 @@ library ExternalObj
7272
*/
7373
[id(0x0000006E)]
7474
HRESULT _stdcall DisplayCategory([in] BSTR CatID, [in] VARIANT_BOOL NewTab);
75-
[id(0x0000006F)]
7675

7776
/*
7877
* Open Snippets Editor ready to create a new snippet.
7978
*/
79+
[id(0x0000006F)]
8080
HRESULT _stdcall NewSnippet(void);
81-
[id(0x00000070)]
8281

8382
/*
8483
* Show news items from CodeSnip news feed.
8584
*/
85+
[id(0x00000070)]
8686
HRESULT _stdcall ShowNews(void);
87-
[id(0x00000071)]
88-
89-
/*
90-
* Check for program updates.
91-
*/
92-
HRESULT _stdcall CheckForUpdates(void);
93-
[id(0x00000072)]
9487

9588
/*
9689
* Display the program's About box.
9790
*/
91+
[id(0x00000071)]
9892
HRESULT _stdcall ShowAboutBox(void);
99-
[id(0x00000073)]
10093

101-
/*
102-
* Displays a tab in the Preferences dialogue box.
103-
* @param TagCls [in] Class name of frame hosting required dialogue box
104-
* page.
105-
*/
106-
HRESULT _stdcall ShowPrefsPage([in] BSTR ClsName);
10794
};
10895

10996
};

Src/FmMain.pas

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,6 @@ TMainForm = class(THelpAwareForm)
529529
/// <summary>Selects a tab in the details pane where the tab is provided by
530530
/// the TDetailTabAction instance referenced by Sender.</summary>
531531
procedure ActSelectDetailTabExecute(Sender: TObject);
532-
/// <summary>Displays Preferences dialogue box containing the single page
533-
/// specified by the TShowPrefsPageAction instance referenced by Sender.
534-
/// </summary>
535-
procedure ActShowPrefsPageExecute(Sender: TObject);
536532
/// <summary>Handles events that inform of changes to the database. The
537533
/// EvtInfo object provides information about the change.</summary>
538534
procedure DBChangeHandler(Sender: TObject; const EvtInfo: IInterface);
@@ -587,8 +583,8 @@ implementation
587583
UCopySourceMgr, UDatabaseLoader, UDatabaseLoaderUI, UDetailTabAction,
588584
UEditSnippetAction, UExceptions, UHelpMgr, UHistoryMenus, UKeysHelper,
589585
UMessageBox, UNotifier, UNulDropTarget, UPrintMgr, UQuery, USaveSnippetMgr,
590-
USaveUnitMgr, USelectionIOMgr, UShowPrefsPageAction, UUrl, UUserDBMgr, UView,
591-
UViewItemAction, UWBExternal;
586+
USaveUnitMgr, USelectionIOMgr, UUrl, UUserDBMgr, UView, UViewItemAction,
587+
UWBExternal;
592588

593589

594590
{$R *.dfm}
@@ -1048,17 +1044,6 @@ procedure TMainForm.actSelectSnippetsExecute(Sender: TObject);
10481044
DoSearchFilter(Search);
10491045
end;
10501046

1051-
procedure TMainForm.ActShowPrefsPageExecute(Sender: TObject);
1052-
var
1053-
UpdateUI: Boolean; // flag true if preference changes affect main window UI
1054-
begin
1055-
fDialogMgr.ExecPreferencesDlg(
1056-
(Sender as TShowPrefsPageAction).FrameClassName, UpdateUI
1057-
);
1058-
if UpdateUI then
1059-
fMainDisplayMgr.CompleteRefresh;
1060-
end;
1061-
10621047
procedure TMainForm.ActSubmitOrExportUpdate(Sender: TObject);
10631048
begin
10641049
// TODO -cRefactor: rename method - no longer shared
@@ -1387,11 +1372,7 @@ procedure TMainForm.InitForm;
13871372
);
13881373
SetNewSnippetAction(actAddSnippet);
13891374
SetNewsAction(actBlog);
1390-
// SetCheckForUpdatesAction(actProgramUpdates);
13911375
SetAboutBoxAction(actAbout);
1392-
SetShowPrefsPageAction(
1393-
TActionFactory.CreateShowPrefsPageAction(Self, ActShowPrefsPageExecute)
1394-
);
13951376
end;
13961377

13971378
// Customise web browser controls in Details pane

Src/IntfNotifier.pas

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,9 @@ interface
7777
/// <summary>Displays news items from the CodeSnip news feed.</summary>
7878
procedure ShowNews;
7979

80-
// TODO -cNotifier: remove this method and remove from external object
81-
/// <summary>Checks for program updates.</summary>
82-
procedure CheckForUpdates;
83-
8480
/// <summary>Displays the program's About Box.</summary>
8581
procedure ShowAboutBox;
8682

87-
/// <summary>Displays the Preferences dialogue box containing the specified
88-
/// page.</summary>
89-
/// <param name="ClsName">string [in] Class name of the frame that
90-
/// implements the required preferences page.</param>
91-
procedure ShowPrefsPage(const ClsName: string);
9283
end;
9384

9485
type
@@ -149,18 +140,10 @@ interface
149140
/// <param name="Action">TBasicAction [in] Required action.</param>
150141
procedure SetNewsAction(const Action: TBasicAction);
151142

152-
/// <summary>Sets action used to check for program updates.</summary>
153-
/// <param name="Action">TBasicAction [in] Required action.</param>
154-
procedure SetCheckForUpdatesAction(const Action: TBasicAction);
155-
156143
/// <summary>Sets action used to display the program's About Box.</summary>
157144
/// <param name="Action">TBasicAction [in] Required action.</param>
158145
procedure SetAboutBoxAction(const Action: TBasicAction);
159146

160-
/// <summary>Sets action used to display a given page of the Preferences
161-
/// dialogue box.</summary>
162-
/// <param name="Action">TBasicAction [in] Required action.</param>
163-
procedure SetShowPrefsPageAction(const Action: TBasicAction);
164147
end;
165148

166149
type

Src/Res/Scripts/external.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ function showNews() {
8585
return false;
8686
}
8787

88-
/*
89-
* Calls external object to get host application to check for program updates.
90-
* @return False.
91-
*/
92-
function checkForUpdates() {
93-
external.CheckForUpdates();
94-
return false;
95-
}
96-
9788
/*
9889
* Calls external object to get host application to display About box.
9990
* @return False,
@@ -102,15 +93,3 @@ function showAboutBox() {
10293
external.ShowAboutBox();
10394
return false;
10495
}
105-
106-
/*
107-
* Calls external object to display the tab with the given frame class in the
108-
* Preferences dialogue box.
109-
* @param string tabCls [in] Name of class of frame hosting required
110-
* preferences page.
111-
* @return False.
112-
*/
113-
function showPrefsPage(tabCls) {
114-
external.ShowPrefsPage(tabCls);
115-
return false;
116-
}

Src/UActionFactory.pas

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,6 @@ TActionFactory = class(TNoConstructObject)
8585
@param OnExecHandler [in] Handler for action's OnExecute event.
8686
@return Reference to newly created action.
8787
}
88-
class function CreateShowPrefsPageAction(const AOwner: TComponent;
89-
const OnExecHandler: TNotifyEvent = nil): TBasicAction;
90-
{Creates a Show Preferences Page action and sets OnExecute handler id
91-
provided.
92-
@param AOwner [in] Owner of action.
93-
@param OnExecHandler [in] Handler for action's OnExecute event.
94-
@return Reference to newly created action.
95-
}
9688
end;
9789

9890

@@ -103,8 +95,12 @@ implementation
10395
// Delphi
10496
StdActns,
10597
// Project
106-
UCategoryAction, UDetailTabAction, UEditSnippetAction, ULinkAction,
107-
UShowPrefsPageAction, USnippetAction, UViewItemAction;
98+
UCategoryAction,
99+
UDetailTabAction,
100+
UEditSnippetAction,
101+
ULinkAction,
102+
USnippetAction,
103+
UViewItemAction;
108104

109105

110106
{ TActionFactory }
@@ -168,18 +164,6 @@ class function TActionFactory.CreateLinkAction(const AOwner: TComponent;
168164
Result := CreateAction(TLinkAction, AOwner, OnExecHandler) as TCustomAction;
169165
end;
170166

171-
class function TActionFactory.CreateShowPrefsPageAction(
172-
const AOwner: TComponent; const OnExecHandler: TNotifyEvent): TBasicAction;
173-
{Creates a Show Preferences Page action and sets OnExecute handler id
174-
provided.
175-
@param AOwner [in] Owner of action.
176-
@param OnExecHandler [in] Handler for action's OnExecute event.
177-
@return Reference to newly created action.
178-
}
179-
begin
180-
Result := CreateAction(TShowPrefsPageAction, AOwner, OnExecHandler);
181-
end;
182-
183167
class function TActionFactory.CreateSnippetAction(const AOwner: TComponent;
184168
const OnExecHandler: TNotifyEvent): TBasicAction;
185169
{Creates a Snippet action and sets OnExecute handler if provided.

Src/UNotifier.pas

Lines changed: 6 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,8 @@ TNotifier = class(TInterfacedObject, INotifier, ISetActions)
6262
/// <summary>Action that causes news items from CodeSnip news feed to be
6363
/// displayed.</summary>
6464
fNewsAction: TBasicAction;
65-
/// <summary>Action that causes a check for program updates to be
66-
/// performed.</summary>
67-
fCheckForUpdatesAction: TBasicAction;
6865
/// <summary>Action that causes About box to be displayed.</summary>
6966
fAboutBoxAction: TBasicAction;
70-
/// <summary>Action that displays a specified page in the preferences
71-
/// dialogue box.</summary>
72-
fShowPrefsPageAction: TBasicAction;
7367

7468
public
7569

@@ -135,21 +129,10 @@ TNotifier = class(TInterfacedObject, INotifier, ISetActions)
135129
/// <remarks>Methods of INotifier.</remarks>
136130
procedure ShowNews;
137131

138-
/// <summary>Checks for program updates.</summary>
139-
/// <remarks>Methods of INotifier.</remarks>
140-
procedure CheckForUpdates;
141-
142132
/// <summary>Displays the program's About Box.</summary>
143133
/// <remarks>Methods of INotifier.</remarks>
144134
procedure ShowAboutBox;
145135

146-
/// <summary>Displays the Preferences dialogue box containing the specified
147-
/// page.</summary>
148-
/// <param name="ClsName">string [in] Class name of the frame that
149-
/// implements the required preferences page.</param>
150-
/// <remarks>Method of INotifier.</remarks>
151-
procedure ShowPrefsPage(const ClsName: string);
152-
153136
/// <summary>Sets action used to request a database update.</summary>
154137
/// <param name="Action">TBasicAction [in] Required action.</param>
155138
/// <remarks>Methods of ISetActions.</remarks>
@@ -212,21 +195,11 @@ TNotifier = class(TInterfacedObject, INotifier, ISetActions)
212195
/// <remarks>Methods of ISetActions.</remarks>
213196
procedure SetNewsAction(const Action: TBasicAction);
214197

215-
/// <summary>Sets action used to check for program updates.</summary>
216-
/// <param name="Action">TBasicAction [in] Required action.</param>
217-
/// <remarks>Methods of ISetActions.</remarks>
218-
procedure SetCheckForUpdatesAction(const Action: TBasicAction);
219-
220198
/// <summary>Sets action used to display the program's About Box.</summary>
221199
/// <param name="Action">TBasicAction [in] Required action.</param>
222200
/// <remarks>Methods of ISetActions.</remarks>
223201
procedure SetAboutBoxAction(const Action: TBasicAction);
224202

225-
/// <summary>Sets action used to display a given page of the Preferences
226-
/// dialogue box.</summary>
227-
/// <param name="Action">TBasicAction [in] Required action.</param>
228-
/// <remarks>Method of ISetActions.</remarks>
229-
procedure SetShowPrefsPageAction(const Action: TBasicAction);
230203
end;
231204

232205

@@ -237,8 +210,12 @@ implementation
237210
// Delphi
238211
SysUtils, StdActns,
239212
// Project
240-
Compilers.UGlobals, UCategoryAction, UDetailTabAction, UEditSnippetAction,
241-
UShowPrefsPageAction, USnippetAction, UViewItemAction;
213+
Compilers.UGlobals,
214+
UCategoryAction,
215+
UDetailTabAction,
216+
UEditSnippetAction,
217+
USnippetAction,
218+
UViewItemAction;
242219

243220

244221
{ TNotifier }
@@ -260,12 +237,6 @@ procedure TNotifier.ChangeOverviewStyle(const Style: Integer);
260237
fOverviewStyleChangeActions[Style].Execute;
261238
end;
262239

263-
procedure TNotifier.CheckForUpdates;
264-
begin
265-
if Assigned(fCheckForUpdatesAction) then
266-
fCheckForUpdatesAction.Execute;
267-
end;
268-
269240
procedure TNotifier.ConfigCompilers;
270241
begin
271242
if Assigned(fConfigCompilersAction) then
@@ -314,11 +285,6 @@ procedure TNotifier.SetAboutBoxAction(const Action: TBasicAction);
314285
fAboutBoxAction := Action;
315286
end;
316287

317-
procedure TNotifier.SetCheckForUpdatesAction(const Action: TBasicAction);
318-
begin
319-
fCheckForUpdatesAction := Action;
320-
end;
321-
322288
procedure TNotifier.SetConfigCompilersAction(const Action: TBasicAction);
323289
begin
324290
fConfigCompilersAction := Action;
@@ -379,13 +345,6 @@ procedure TNotifier.SetOverviewStyleChangeActions(
379345
fOverviewStyleChangeActions[Idx] := Actions[Idx];
380346
end;
381347

382-
procedure TNotifier.SetShowPrefsPageAction(const Action: TBasicAction);
383-
begin
384-
Assert(Action is TShowPrefsPageAction, ClassName
385-
+ '.SetShowPreferencesAction: Action is not TShowPrefsPageAction');
386-
fShowPrefsPageAction := Action;
387-
end;
388-
389348
procedure TNotifier.SetShowViewItemAction(const Action: TBasicAction);
390349
begin
391350
fShowViewItemAction := Action;
@@ -409,15 +368,6 @@ procedure TNotifier.ShowNews;
409368
fNewsAction.Execute;
410369
end;
411370

412-
procedure TNotifier.ShowPrefsPage(const ClsName: string);
413-
begin
414-
if Assigned(fShowPrefsPageAction) then
415-
begin
416-
(fShowPrefsPageAction as TShowPrefsPageAction).FrameClassName := ClsName;
417-
fShowPrefsPageAction.Execute;
418-
end;
419-
end;
420-
421371
procedure TNotifier.ShowViewItem(ViewItem: IView; const NewTab: Boolean);
422372
begin
423373
if Assigned(fShowViewItemAction) then

0 commit comments

Comments
 (0)