LCL, avoid storing default (translated) title for dialogs

git-svn-id: trunk@13303 -
This commit is contained in:
jesus 2007-12-12 23:48:04 +00:00
parent 003c9a735e
commit c247e2ee08
5 changed files with 49 additions and 6 deletions

View File

@ -74,8 +74,10 @@ type
procedure SetHandle(const AValue: THandle);
procedure SetHeight(const AValue: integer);
procedure SetWidth(const AValue: integer);
function IsTitleStored: boolean;
protected
function DoExecute : boolean; virtual;
function DefaultTitle: string; virtual;
public
FCompStyle : LongInt;
constructor Create(TheOwner: TComponent); override;
@ -94,7 +96,7 @@ type
property HelpContext: THelpContext read FHelpContext write FHelpContext default 0;
property Width: integer read FWidth write SetWidth;
property Height: integer read FHeight write SetHeight;
property Title: string read FTitle write FTitle;
property Title: string read FTitle write FTitle stored IsTitleStored;
end;
@ -189,6 +191,7 @@ type
function CheckFileMustExist(const AFileName: string): boolean; virtual;
function CheckAllFiles: boolean; virtual;
function DoExecute: boolean; override;
function DefaultTitle: string; override;
public
constructor Create(TheOwner: TComponent); override;
procedure DoFolderChange; virtual;
@ -204,6 +207,8 @@ type
{ TSaveDialog }
TSaveDialog = class(TOpenDialog)
protected
function DefaultTitle: string; override;
public
constructor Create(AOwner: TComponent); override;
end;
@ -214,6 +219,7 @@ type
TSelectDirectoryDialog = class(TOpenDialog)
protected
function CheckFileMustExist(const AFilename: string): boolean; override;
function DefaultTitle: string; override;
public
constructor Create(AOwner: TComponent); override;
end;
@ -224,6 +230,8 @@ type
TColorDialog = class(TCommonDialog)
private
FColor: TColor;
protected
function DefaultTitle: string; override;
public
constructor Create(TheOwner: TComponent); override;
published
@ -317,6 +325,8 @@ type
FOptions: TFontDialogOptions;
FPreviewText: string;
procedure SetFont(const AValue: TFont);
protected
function DefaultTitle: string; override;
public
procedure ApplyClicked; virtual;
constructor Create (AOwner : TComponent); override;

View File

@ -27,5 +27,11 @@ constructor TColorDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
fCompStyle := csColorDialog;
FTitle:= rsSelectcolorTitle;
end;
function TColorDialog.DefaultTitle: string;
begin
Result:=rsSelectcolorTitle;
end;

View File

@ -27,6 +27,7 @@
constructor TCommonDialog.Create (TheOwner: TComponent);
begin
inherited Create(TheOwner);
FTitle := DefaultTitle;
end;
function TCommonDialog.Execute: boolean;
@ -71,6 +72,11 @@ begin
FHandle:=AValue;
end;
function TCommonDialog.IsTitleStored: boolean;
begin
result := FTitle<>DefaultTitle;
end;
procedure TCommonDialog.SetHeight(const AValue: integer);
begin
if FHeight=AValue then exit;
@ -110,3 +116,8 @@ begin
end;
Result := (FUserChoice = mrOk);
end;
function TCommonDialog.DefaultTitle: string;
begin
result := '';
end;

View File

@ -250,6 +250,11 @@ begin
Result:=CheckAllFiles;
end;
function TOpenDialog.DefaultTitle: string;
begin
Result:= rsfdOpenFile;
end;
{------------------------------------------------------------------------------
Method: TOpenDialog.Create
Params: AOwner: the owner of the class
@ -261,7 +266,6 @@ constructor TOpenDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
fCompStyle:=csOpenFileDialog;
FTitle:= rsfdOpenFile;
FOptions := DefaultOpenDialogOptions;
end;
@ -280,6 +284,11 @@ begin
if Assigned(OnSelectionChange) then OnSelectionChange(Self);
end;
function TSaveDialog.DefaultTitle: string;
begin
Result:=rsfdFileSaveAs;
end;
{******************************************************************************
TSaveDialog
******************************************************************************}
@ -294,7 +303,6 @@ constructor TSaveDialog.Create (AOwner : TComponent);
begin
inherited Create(AOwner);
fCompStyle:=csSaveFileDialog;
FTitle:= rsfdFileSaveAs;
end;
{******************************************************************************
@ -307,7 +315,6 @@ constructor TSelectDirectoryDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fCompStyle:=csSelectDirectoryDialog;
FTitle:=rsfdSelectDirectory;
end;
function TSelectDirectoryDialog.CheckFileMustExist(const AFilename: string): boolean;
@ -321,4 +328,9 @@ begin
Result:=true;
end;
function TSelectDirectoryDialog.DefaultTitle: string;
begin
Result:=rsfdSelectDirectory;
end;

View File

@ -40,7 +40,6 @@ constructor TFontDialog.Create (AOwner : TComponent);
begin
inherited Create(AOwner);
fCompStyle := csFontDialog;
FTitle:= rsSelectFontTitle;
FFont := TFont.Create;
FOptions := [fdEffects];
end;
@ -56,3 +55,8 @@ begin
FFont.Assign(AValue);
end;
function TFontDialog.DefaultTitle: string;
begin
Result:=rsSelectFontTitle;
end;