tvplanit: Improved layout in VpWavDlg

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8477 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-09-12 17:04:46 +00:00
parent cf63f75a7a
commit cc58bebf0e
14 changed files with 110 additions and 58 deletions

View File

@ -261,6 +261,7 @@ resourcestring
RSSoundFinder = 'Sound Finder';
RSDefaultSound = 'Use the default sound';
RSNothingToSelectFrom = 'There is nothing to select if default sound is used.';
RSPlayBtn = 'Play';
{ Event Edit Dialog Captions }
RSDlgEventEdit = 'Event';

View File

@ -493,6 +493,45 @@ begin
end;
procedure AlignOKCancel(OKButton, CancelButton: TButton; APanel: TPanel);
var
w: Integer;
begin
OKButton.AutoSize := true;
CancelButton.AutoSize := true;
w := Max(OKButton.Width, CancelButton.Width);
OKButton.Constraints.MinWidth := w;
OKButton.Width := w;
CancelButton.Constraints.MinWidth := w;
CancelButton.Width := w;
{$IFDEF MSWINDOWS} // button order: OK - Cancel
CancelButton.AnchorSideRight.Control := APanel;
CancelButton.AnchorSideRight.Side := asrRight;
CancelButton.Anchors := [akTop, akRight];
OKButton.AnchorSideRight.Control := CancelButton;
OKButton.AnchorSideRight.Side := asrRight;
OKButton.Anchors := [akTop, akRight];
OKButton.TabOrder := 0;
CancelButton.TabOrder := 1;
{$ELSE}
OKButton.AnchorSideRight.Control := APanel;
OKButton.AnchorSideRight.Side := asrRight;
OKButton.Anchors := [akTop, akRight];
CancelButton.AnchorSideRight.Control := OKButton;
CancelButton.AnchorSideRight.Side := asrRight;
CancelButton.Anchors := [akTop, akRight];
CancelButton.TabOrder := 0;
OKButton.TabOrder := 1;
{$ENDIF}
APanel.AutoSize := true;
end;
(*
procedure AlignOKCancel(OKButton, CancelButton: TButton; APanel: TPanel);
var
w, h: Integer;
@ -538,6 +577,7 @@ begin
OKButton.TabOrder := 1;
{$ENDIF}
end;
*)
function PointInRect(Point: TPoint; Rect: TRect): Boolean;
begin

View File

@ -12,7 +12,6 @@ object FrmSoundDialog: TFrmSoundDialog
OnCreate = FormCreate
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.9.0.0'
object PageControl1: TPageControl
Left = 0
Height = 474
@ -54,7 +53,7 @@ object FrmSoundDialog: TFrmSoundDialog
Left = 4
Height = 19
Top = 4
Width = 73
Width = 71
BorderSpacing.Around = 4
Caption = 'CBDefault'
OnClick = CBDefaultClick
@ -72,38 +71,17 @@ object FrmSoundDialog: TFrmSoundDialog
ClientHeight = 33
ClientWidth = 515
TabOrder = 2
object PlayButton: TSpeedButton
object PlayBtn: TSpeedButton
AnchorSideTop.Control = OkBtn
AnchorSideBottom.Control = OkBtn
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 25
Top = 4
Width = 77
Width = 118
Anchors = [akTop, akLeft, akBottom]
Caption = 'Play'
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000010000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
6666666666666666666666660000666666660066666666666666668866666666
0000666666603086666666666666688886666666000066666603077866686666
66668887786668660000666660388FF866866666666888877866866600006666
03B07FF8686666666688787778686666000066003BF07FF8666666668887F877
7866666600006038BFB00FF866666668887F788778666666000063B7FBF080F8
6888866877F7F88878688886000063B7BFB070F866666668777F787878666666
000063F7FBF00FF866666668F7F7F8877866666600006633BFB07FF868666666
887F787778686666000066663BF07FF8668666666687F8777866866600006666
63B887F866686666666878877866686600006666663B07766666666666668787
7866666600006666666380866666666666666888866666660000666666660066
6666666666666688666666660000666666666666666666666666666666666666
0000
}
Margin = 4
NumGlyphs = 2
Spacing = -1
OnClick = PlayButtonClick
OnClick = PlayBtnClick
end
object OkBtn: TButton
Left = 361
@ -169,6 +147,7 @@ object FrmSoundDialog: TFrmSoundDialog
Alignment = taCenter
AutoSize = False
Caption = 'Nothing to select from'
Color = clDefault
Layout = tlCenter
ParentColor = False
WordWrap = True
@ -217,6 +196,7 @@ object FrmSoundDialog: TFrmSoundDialog
Alignment = taCenter
AutoSize = False
Caption = 'Nothing to select from'
Color = clDefault
Layout = tlCenter
ParentColor = False
WordWrap = True

View File

@ -61,7 +61,7 @@ type
ShellTreeView: TShellTreeView;
Splitter1: TSplitter;
TabSheet1: TTabSheet;
PlayButton: TSpeedButton;
PlayBtn: TSpeedButton;
CBDefault: TCheckBox;
OkBtn: TButton;
CancelBtn: TButton;
@ -70,7 +70,7 @@ type
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure OkBtnClick(Sender: TObject);
procedure PlayButtonClick(Sender: TObject);
procedure PlayBtnClick(Sender: TObject);
private
FOnPlaySound: TVpPlaySoundEvent;
function FindFileItem(AFilename: String): TListItem;
@ -107,7 +107,7 @@ begin
ShellListview.Visible := not CBDefault.Checked;
Panel3.Visible := CBDefault.Checked;
Label4.Visible := CBDefault.Checked;
PlayButton.Visible := not CBDefault.Checked;
PlayBtn.Visible := not CBDefault.Checked;
end;
{=====}
@ -135,15 +135,15 @@ begin
ShellListView.Mask := '*.wav';
{$ENDIF}
{$ENDIF}
{$IFDEF NEW_ICONS}
LoadGlyphFromRCDATA(PlayBtn.Glyph, 'VpSpeaker', 16, 24, 32);
{$ENDIF}
end;
procedure TFrmSoundDialog.FormShow(Sender: TObject);
begin
{$IFDEF NEW_ICONS}
LoadGlyphFromRCDATA(PlayButton.Glyph, 'VpSpeaker', 16, 24, 32);
{$ENDIF}
AlignOKCancel(OkBtn, CancelBtn, ButtonPanel);
PlayButton.Width := CancelBtn.Width; //MulDiv(PlayButton.Height, 3, 2) ;
PlayBtn.AutoSize := true;
end;
function TFrmSoundDialog.GetSelectedFileName: String;
@ -159,7 +159,7 @@ begin
StopSound;
end;
procedure TFrmSoundDialog.PlayButtonClick(Sender: TObject);
procedure TFrmSoundDialog.PlayBtnClick(Sender: TObject);
begin
DingPath := GetSelectedFileName;
PlaySound;
@ -178,6 +178,10 @@ begin
CBDefault.Caption := RSDefaultSound;
OkBtn.Caption := RSOkBtn;
CancelBtn.Caption := RSCancelBtn;
if BiDiMode = bdLeftToRight then
PlayBtn.Caption := RSPlayBtn + ' ' // Workaround for AutoSize bug of TSpeedButton ignoring right Margin
else
PlayBtn.Caption := ' ' + RSPlayBtn;
Label3.Caption := RSNothingToSelectFrom;
Label4.Caption := RSNothingToSelectFrom;