diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-08-13 17:01:52 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-08-13 17:01:52 +0200 |
commit | 823767706b7990567fb8f9a5dd68efa8e30f2064 (patch) | |
tree | efa995b8d33c537fe10b51716e38929b885fa3c5 | |
parent | b7891fb5e43c938f60f20d61ba274be307f8a2ff (diff) | |
download | fpGUI-823767706b7990567fb8f9a5dd68efa8e30f2064.tar.xz |
docview: Now manages some images for RichTextView control.
The image list contains "missing image" images to indicate
where images where supposed to have been displayed.
-rw-r--r-- | docview/src/frm_main.pas | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas index 383b0429..3e24c320 100644 --- a/docview/src/frm_main.pas +++ b/docview/src/frm_main.pas @@ -7,7 +7,8 @@ interface uses SysUtils, Classes, fpg_base, fpg_main, fpg_form, fpg_panel, fpg_tab, fpg_tree, fpg_splitter, fpg_menu, fpg_button, fpg_listbox, - fpg_label, fpg_edit, fpg_radiobutton, fpg_progressbar, + fpg_label, fpg_edit, fpg_radiobutton, fpg_progressbar, fpg_imagelist, + fpg_imgfmt_bmp, HelpFile, RichTextView, HelpTopic; type @@ -76,6 +77,7 @@ type Debug: boolean; FFileOpenRecent: TfpgMenuItem; FHistorySelection: Boolean; + FImages: TfpgImageList; LoadingFilenameList: TStringList; LoadingFileIndex: integer; @@ -201,6 +203,7 @@ const cVersion = 'Version ' + FPGUI_VERSION; {$I arrows.inc} +{$I missing.inc} {@VFD_NEWFORM_IMPL} @@ -347,6 +350,8 @@ begin LoadSettings; CreateMRUMenuItems; ProcessCommandLineParams; + + RichView.Images := FImages; end; procedure TMainForm.MainFormDestroy(Sender: TObject); @@ -1700,10 +1705,11 @@ begin ImageIndices, nil {Highlights} ); + if ImageIndices.Count > 0 then + begin { TODO -oGraeme : We do not support images yet } -// THelpFile(CurrentTopic.HelpFile).GetImages(ImageOf) -// THelpFile( Topic.HelpFile ).GetImages( ImageOffsets, -// Images ); +// THelpFile(CurrentTopic.HelpFile).GetImages(ImageIndices, FImages); + end; ImageIndices.Free; @@ -1741,6 +1747,8 @@ begin end; constructor TMainForm.Create(AOwner: TComponent); +var + img: TfpgImage; begin inherited Create(AOwner); fpgApplication.OnException := @MainFormException; @@ -1755,6 +1763,16 @@ begin { TODO -oGraeme : Make Debug a menu option } Debug := False; + FImages := TfpgImageList.Create; + // store up to three images per Topic - while we don't support INF images + img := CreateImage_BMP(@dv_missing, sizeof(dv_missing)); + FImages.AddImage(img); + img := CreateImage_BMP(@dv_missing, sizeof(dv_missing)); + FImages.AddImage(img); + img := CreateImage_BMP(@dv_missing, sizeof(dv_missing)); + FImages.AddImage(img); + + // load toolbar images fpgImages.AddMaskedBMP( 'dv.arrowleft', @usr_arrow_left, @@ -1771,10 +1789,13 @@ begin fpgImages.AddMaskedBMP( 'dv.arrowdown', @usr_arrow_down, sizeof(usr_arrow_down), 0, 0); + end; destructor TMainForm.Destroy; begin + RichView.Images := nil; + FImages.Free; CurrentTopic := nil; // it was a reference only FFileOpenRecent := nil; // it was a reference only miOpenRecentMenu.Free; |