?? ieopensavedlg.pas
字號:
(*
Copyright (c) 1998-2007 by HiComponents. All rights reserved.
This software comes without express or implied warranty.
In no case shall the author be liable for any damage or unwanted behavior of any
computer hardware and/or software.
HiComponents grants you the right to include the compiled component
in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE,
BUT YOU MAY NOT DISTRIBUTE THIS SOURCE CODE OR ITS COMPILED .DCU IN ANY FORM.
ImageEn, IEvolution and ImageEn ActiveX may not be included in any commercial,
shareware or freeware libraries or components.
email: support@hicomponents.com
http://www.hicomponents.com
*)
unit ieopensavedlg;
{$R-}
{$Q-}
{$I ie.inc}
{$IFDEF IEINCLUDEOPENSAVEDIALOGS}
interface
uses
Windows, Messages, SysUtils, CommDlg, Classes, Graphics, Controls, Forms, comctrls,
Clipbrd, stdctrls, buttons, extctrls, Dialogs, hyieutils, hyiedefs, ImageEnIO, ImageEnView,
IEMView, IEMIO, ievect;
type
{!!
<FS>TIEDBorderStyle
<FM>Declaration<FC>
TIEDBorderStyle = (iepsDefault, iepsCropped, iepsCropShadow, iepsSoftShadow);
<FM>Description<FN>
<TABLE>
<R> <H>Value</H> <H>Description</H> </R>
<R> <C>iepsDefault</C> <C>3d border around preview box</C> </R>
<R> <C>iepsCropped</C> <C>3d border around the image</C> </R>
<R> <C>iepsCropShadow</C> <C>a shadow around the image</C> </R>
<R> <C>iepsSoftShadow</C> <C>a soft (high quality) shadow around the image</C> </R>
</TABLE>
!!}
TIEDBorderStyle = (iepsDefault, iepsCropped, iepsCropShadow, iepsSoftShadow);
{!!
<FS>TIECommonDialog
<FM>Description<FN>
This is the common parent class of <A TOpenImageEnDialog> and <A TSaveImageEnDialog>.
<FM>Implemented Properties<FN>
<A TIECommonDialog.MsgLanguage>
<A TIECommonDialog.ShowPlacesBar>
<A TIECommonDialog.ExtendedDialog>
!!}
TIECommonDialog = class(TComponent)
private
fMsgLanguage: TMsgLanguage;
//
FCtl3D: Boolean;
FDefWndProc: Pointer;
FHelpContext: THelpContext;
FHandle: HWnd;
FObjectInstance: Pointer;
FTemplate: PChar;
FOnClose: TNotifyEvent;
FOnShow: TNotifyEvent;
fShowPlacesBar: boolean;
fWatchTimer:TTimer;
procedure WMDestroy(var Message: TWMDestroy); message WM_DESTROY;
procedure WMInitDialog(var Message: TWMInitDialog); message WM_INITDIALOG;
procedure WMNCDestroy(var Message: TWMNCDestroy); message WM_NCDESTROY;
procedure MainWndProc(var Message: TMessage);
protected
fExtendedDialog: boolean;
procedure DoClose; dynamic;
procedure DoShow; dynamic;
procedure WndProc(var Message: TMessage); virtual;
function MessageHook(var Msg: TMessage): Boolean; virtual;
function TaskModalDialog(DialogFunc: Pointer; var DialogData): Bool; virtual;
function Execute: Boolean; virtual; abstract;
property Template: PChar read FTemplate write FTemplate;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DefaultHandler(var Message); override;
property Handle: HWnd read FHandle;
published
property Ctl3D: Boolean read FCtl3D write FCtl3D default True;
property HelpContext: THelpContext read FHelpContext write FHelpContext default 0;
property OnClose: TNotifyEvent read FOnClose write FOnClose;
property OnShow: TNotifyEvent read FOnShow write FOnShow;
{!!
<FS>TIECommonDialog.MsgLanguage
<FM>Declaration<FC>
property MsgLanguage: <A TMsgLanguage>;
<FM>Description<FN>
MsgLanguage sets the language of the dialog.
!!}
property MsgLanguage: TMsgLanguage read fMsgLanguage write fMsgLanguage default msSystem;
{!!
<FS>TIECommonDialog.ShowPlacesBar
<FM>Declaration<FC>
property ShowPlacesBar:boolean;
<FM>Description<FN>
ShowPlacesBar shows or hides the places bar in Windows Me, Windows 2000 and XP.
!!}
property ShowPlacesBar: boolean read fShowPlacesBar write fShowPlacesBar default true;
{!!
<FS>TIECommonDialog.ExtendedDialog
<FM>Declaration<FC>
property ExtendedDialog:boolean;
<FM>Description<FN>
ExtendedDialog makes an ImageEn dialog like a standard VCL open/save picture dialog. The dialogs will continue to support ImageEn file formats.
!!}
property ExtendedDialog: boolean read fExtendedDialog write fExtendedDialog default true;
end;
{!!
<FS>TOpenImageEnDialog
<FM>Description<FN>
TOpenImageEnDialog displays a modal Windows dialog box for selecting and opening graphics files. This component includes a rectangular preview region where all ImageEn supported file formats are displayed. If the file is an animated GIF, AVI film or a multi page TIFF, all images will be shown in sequence: the "Play" button will be activated to animate the sequence.
The TOpenImageEnDialog displays image information such as dimensions, colors, dpi, file type, compression and file-memory sizes.
<FM>See also<FN>
<A TSaveImageEnDialog>
<FM>Properties<FN>
<A TOpenImageEnDialog.AlwaysAnimate>
<A TOpenImageEnDialog.AutoAdjustDPI>
<A TOpenImageEnDialog.AutoSetFilter>
<A TIECommonDialog.ExtendedDialog>
<A TOpenImageEnDialog.ExtendedFilters>
<A TOpenImageEnDialog.FilteredAdjustDPI>
<A TIECommonDialog.MsgLanguage>
<A TOpenImageEnDialog.PreviewBorderStyle>
<A TOpenImageEnDialog.SelectedFrame>
<A TOpenImageEnDialog.ShowAllFrames>
<A TOpenImageEnDialog.ShowAVI>
<A TIECommonDialog.ShowPlacesBar>
<A TOpenImageEnDialog.ZoomFilter>
!!}
TOpenImageEnDialog = class(TIECommonDialog)
private
m_blnInSelectionChange: Boolean;
FImageEnView: TImageEnVect;
{$IFDEF IEINCLUDEMULTIVIEW}
fImageEnMView: TImageEnMView;
{$ENDIF}
FPicturePanel: TPanel;
fPicLabel1: TLabel;
fPicLabel2: TLabel;
fPicLabel3: TLabel;
fInfoPanel: TPanel;
fInfoLabel1: TLabel;
fInfoLabel2: TLabel;
FPreviewButton: TSpeedButton;
FZoomComboBox: TComboBox;
fProgressBar: TProgressBar;
{$IFDEF IEINCLUDEMULTIVIEW}
fPlayButton: TSpeedButton;
{$ENDIF}
fAdvancedButton: TButton;
fPreviewCheck: TCheckBox;
fFileSize: integer; // size of last file loaded
fFrames: integer; // page count of last file loaded
fSelType: string;
fAutoSetFilter: boolean;
{$IFDEF IEINCLUDEMULTIVIEW}
fAlwaysAnimate: boolean;
{$ENDIF}
fAutoAdjustDPI: boolean;
fFilteredAdjustDPI: boolean;
//
FHistoryList: TStrings;
FOptions: TOpenOptions;
FFilter: string;
FFilterIndex: Integer;
FCurrentFilterIndex: Integer;
FInitialDir: string;
FTitle: string;
FDefaultExt: string;
FFileName: TFileName;
FFiles: TStrings;
FFileEditStyle: TFileEditStyle;
FOnSelectionChange: TNotifyEvent;
FOnFolderChange: TNotifyEvent;
FOnTypeChange: TNotifyEvent;
FOnCanClose: TCloseQueryEvent;
fPreviewBorderStyle: TIEDBorderStyle;
fShowAVI: boolean;
fExtendedFilters: string;
fShowAllFrames: boolean;
fSelectedFrame:integer;
function GetFileName: TFileName;
function GetFileName2: TFileName;
function GetFilterIndex: Integer;
procedure ReadFileEditStyle(Reader: TReader);
procedure SetHistoryList(Value: TStrings);
procedure SetInitialDir(const Value: string);
//function AdjustFileName(fn:string):string;
//
procedure PreviewClick(Sender: TObject);
procedure PreviewKeyPress(Sender: TObject; var Key: Char);
procedure ZoomComboChange(Sender: TObject);
procedure ImageEnIOProgress(Sender: TObject; per: integer);
procedure ShowIOParams(params: TIOParamsVals);
procedure DoCheckPreview(Sender: TObject);
procedure SetPreviewBorderStyle(v: TIEDBorderStyle);
procedure SetZoomFilter(v: TResampleFilter);
function GetZoomFilter: TResampleFilter;
function FileName2FilterIndex(e:string):integer;
{$IFDEF IEINCLUDEMULTIVIEW}
procedure SetAlwaysAnimate(value:boolean);
{$endif}
protected
fShowPreview: boolean; // if true show the preview of images
//
procedure PlayClick(Sender: TObject);
function CanClose(var OpenFileName: TOpenFileName): Boolean;
function DoCanClose: Boolean; dynamic;
function DoExecute(Func: Pointer): Bool;
procedure DoSelectionChange; dynamic;
procedure DoFolderChange; dynamic;
procedure DoTypeChange; dynamic;
procedure DefineProperties(Filer: TFiler); override;
procedure GetFileNames(var OpenFileName: TOpenFileName);
function GetStaticRect: TRect; virtual;
procedure WndProc(var Message: TMessage); override;
function BuildStrFilter: string;
//
procedure SetZoom; virtual;
procedure DoClose; override;
procedure DoShow; override;
procedure SetLang;
procedure OnMViewSelect(Sender: TObject; idx: integer);
procedure DoAllDisplayed(Sender:TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function Execute: Boolean; override;
property FileEditStyle: TFileEditStyle read FFileEditStyle write FFileEditStyle;
property Files: TStrings read FFiles;
property HistoryList: TStrings read FHistoryList write SetHistoryList;
{!!
<FS>TOpenImageEnDialog.ShowAVI
<FM>Declaration<FC>
property ShowAVI:boolean;
<FM>Description<FN>
If ShowAVI is True, the open dialog will show AVI extension in the file formats list. The default is True.
!!}
property ShowAVI: boolean read fShowAVI write fShowAVI;
property PreviewCheckBox: TCheckBox read fPreviewCheck;
{!!
<FS>TOpenImageEnDialog.ExtendedFilters
<FM>Declaration<FC>
property ExtendedFilters:string;
<FM>Description<FN>
ExtendedFilters specifies additional file formats to add when AutoSetFilter is True.
<FM>Example<FC>
OpenImageEnDialog1.ExtendedFilters:= 'Fun Bitmap|*.fun;*.fan
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -