summaryrefslogtreecommitdiff
path: root/docview/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-08-25 15:08:33 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-08-25 15:08:33 +0200
commit695e46e5bf96e49bcdda2c5fac43282a137c8d1d (patch)
treed5ddc76f2bfc321ab12502203e433cac3bf35e43 /docview/src
parentf1b15fe77b2fa2ea4855a67ea03b65d54e57ff71 (diff)
downloadfpGUI-695e46e5bf96e49bcdda2c5fac43282a137c8d1d.tar.xz
docview: Two new items added to Tools menu.
Display Topic by (ID | Name). Debug items.
Diffstat (limited to 'docview/src')
-rw-r--r--docview/src/frm_main.pas80
1 files changed, 80 insertions, 0 deletions
diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas
index 5adc008e..a6e8a8b6 100644
--- a/docview/src/frm_main.pas
+++ b/docview/src/frm_main.pas
@@ -117,6 +117,8 @@ type
procedure miHelpUsingDocView(Sender: TObject);
procedure miDebugHeader(Sender: TObject);
procedure miDebugHex(Sender: TObject);
+ procedure miToolsFindByResourceID(Sender: TObject);
+ procedure miToolsFindTopifByName(Sender: TObject);
procedure miFileSaveTopicAsIPF(Sender: TObject);
procedure OnMRUMenuItemClick(Sender: TObject);
procedure btnShowIndex(Sender: TObject);
@@ -172,6 +174,9 @@ type
function FindTopicForLink( Link: THelpLink ): TTopic;
function FindTopicByResourceID( ID: word ): TTopic;
function FindTopicByName(const AName: string): TTopic;
+ function DisplayTopicByResourceID( ID: word ): boolean;
+ function DisplayTopicByName(const TopicName: string): boolean;
+ function DisplayTopicByGlobalName(const TopicName: string): boolean;
procedure ViewSourceMIOnClick(Sender: TObject);
procedure AddCurrentToMRUFiles;
procedure CreateMRUMenuItems;
@@ -509,6 +514,38 @@ begin
DisplayTopic(nil);
end;
+procedure TMainForm.miToolsFindByResourceID(Sender: TObject);
+var
+ ResourceIDString: string;
+ ResourceID: word;
+begin
+ if not fpgInputQuery('Find Resource ID', 'Enter the resource ID to find', ResourceIDString) then
+ exit;
+ try
+ ResourceID := StrToInt(ResourceIDString);
+ except
+ TfpgMessageDialog.Critical('Find Resource ID', 'Invalid resource ID entered');
+ exit;
+ end;
+
+ if not DisplayTopicByResourceID( ResourceID ) then
+ TfpgMessageDialog.Critical('Find Resource ID', 'Resource ID not found');
+end;
+
+procedure TMainForm.miToolsFindTopifByName(Sender: TObject);
+var
+ TopicNameString: string;
+Begin
+ if not fpgInputQuery( 'Find Topic By Name',
+ 'Enter the topic name to search for',
+ TopicNameString ) then
+ exit;
+
+ if not DisplayTopicByName( TopicNameString ) then
+ if not DisplayTopicByGlobalName( TopicNameString ) then
+ TfpgMessageDialog.Critical( 'Find Topic By Name', 'Topic name not found' );
+end;
+
procedure TMainForm.miFileSaveTopicAsIPF(Sender: TObject);
var
F: TextFile;
@@ -2340,6 +2377,9 @@ begin
Name := 'miTools';
SetPosition(428, 96, 120, 20);
AddMenuItem('Show file info', '', @miDebugHeader);
+ AddMenuItem('Find topic by resource ID', '', @miToolsFindByResourceID);
+ AddMenuItem('Find topic by resource name', '', @miToolsFindTopifByName);
+ miDebugHexInfo := AddMenuItem('Toggle hex INF values in contents', '', @miDebugHex);
AddMenuItem('View source of RichView component', '', @ViewSourceMIOnClick);
end;
@@ -2717,6 +2757,46 @@ begin
Result := nil;
end;
+function TMainForm.DisplayTopicByResourceID(ID: word): boolean;
+var
+ Topic: TTopic;
+begin
+ Topic := FindTopicByResourceID( ID );
+ if Topic = nil then
+ begin
+ Result := false;
+ exit;
+ end;
+ result := true;
+ DisplayTopic(Topic);
+end;
+
+function TMainForm.DisplayTopicByName(const TopicName: string): boolean;
+var
+ Topic: TTopic;
+begin
+ Topic := FindTopicByName(TopicName);
+ if Topic = nil then
+ begin
+ Result := false;
+ exit;
+ end;
+ result := true;
+ DisplayTopic(Topic);
+end;
+
+function TMainForm.DisplayTopicByGlobalName(const TopicName: string): boolean;
+begin
+ Result := False;
+ // TODO: implement me
+end;
+
+procedure TMainForm.ViewSourceMIOnClick(Sender: TObject);
+begin
+ ShowText('RichView Source Text', RichView.Text);
+End;
+
+
// Add the current list of open files as
// a Most Recently Used entry
procedure TMainForm.AddCurrentToMRUFiles;