You've already forked lazarus-ccr
tvplanit: In WavDlg, replace FileListbox by ShellListview. Some gui improvements in WavDlg.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4741 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -714,6 +714,10 @@ msgctxt "vpsr.rsnoteslbl"
|
||||
msgid "Notes:"
|
||||
msgstr "Notizen:"
|
||||
|
||||
#: vpsr.rsnothingtoselectfrom
|
||||
msgid "There is nothing to select if default sound is used."
|
||||
msgstr "Keine Auswahl möglich, wenn der Standard-Klang verwendet wird."
|
||||
|
||||
#: vpsr.rsnotimersavail
|
||||
msgid "No Window's timers are available."
|
||||
msgstr "Es sind keine Windows-Timer mehr verfügbar"
|
||||
|
@ -704,6 +704,10 @@ msgctxt "vpsr.rsnoteslbl"
|
||||
msgid "Notes:"
|
||||
msgstr ""
|
||||
|
||||
#: vpsr.rsnothingtoselectfrom
|
||||
msgid "There is nothing to select if default sound is used."
|
||||
msgstr ""
|
||||
|
||||
#: vpsr.rsnotimersavail
|
||||
msgid "No Window's timers are available."
|
||||
msgstr ""
|
||||
|
@ -680,7 +680,7 @@ begin
|
||||
if SoundFinder.CBDefault.Checked then
|
||||
AlarmWavPath := ''
|
||||
else
|
||||
AlarmWavPath := SoundFinder.FileListBox1.FileName;
|
||||
AlarmWavPath := SoundFinder.GetSelectedFilename;
|
||||
end;
|
||||
finally
|
||||
SoundFinder.Release;
|
||||
|
@ -217,6 +217,7 @@ resourcestring
|
||||
RSSelectASound = 'Select A Sound';
|
||||
RSSoundFinder = 'Sound Finder';
|
||||
RSDefaultSound = 'Use the default sound';
|
||||
RSNothingToSelectFrom = 'There is nothing to select if default sound is used.';
|
||||
|
||||
{ Event Edit Dialog Captions }
|
||||
RSDlgEventEdit = 'Event';
|
||||
|
@ -1,7 +1,7 @@
|
||||
object FrmSoundDialog: TFrmSoundDialog
|
||||
Left = 328
|
||||
Left = 323
|
||||
Height = 474
|
||||
Top = 242
|
||||
Top = 278
|
||||
Width = 736
|
||||
HorzScrollBar.Page = 401
|
||||
VertScrollBar.Page = 261
|
||||
@ -28,24 +28,25 @@ object FrmSoundDialog: TFrmSoundDialog
|
||||
ClientHeight = 446
|
||||
ClientWidth = 728
|
||||
object RightPanel: TPanel
|
||||
Left = 453
|
||||
Left = 395
|
||||
Height = 446
|
||||
Top = 0
|
||||
Width = 275
|
||||
Width = 333
|
||||
Align = alRight
|
||||
BevelOuter = bvNone
|
||||
Caption = 'Nothing to select from...'
|
||||
ClientHeight = 446
|
||||
ClientWidth = 275
|
||||
ClientWidth = 333
|
||||
TabOrder = 2
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 34
|
||||
Top = 0
|
||||
Width = 275
|
||||
Width = 333
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 34
|
||||
ClientWidth = 275
|
||||
ClientWidth = 333
|
||||
TabOrder = 0
|
||||
object CBDefault: TCheckBox
|
||||
Left = 8
|
||||
@ -61,11 +62,11 @@ object FrmSoundDialog: TFrmSoundDialog
|
||||
Left = 0
|
||||
Height = 38
|
||||
Top = 408
|
||||
Width = 275
|
||||
Width = 333
|
||||
Align = alBottom
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 38
|
||||
ClientWidth = 275
|
||||
ClientWidth = 333
|
||||
TabOrder = 2
|
||||
object PlayButton: TSpeedButton
|
||||
Left = 8
|
||||
@ -94,7 +95,7 @@ object FrmSoundDialog: TFrmSoundDialog
|
||||
OnClick = PlayButtonClick
|
||||
end
|
||||
object OkBtn: TButton
|
||||
Left = 112
|
||||
Left = 170
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 75
|
||||
@ -105,7 +106,7 @@ object FrmSoundDialog: TFrmSoundDialog
|
||||
TabOrder = 0
|
||||
end
|
||||
object CancelBtn: TButton
|
||||
Left = 192
|
||||
Left = 250
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 75
|
||||
@ -115,22 +116,34 @@ object FrmSoundDialog: TFrmSoundDialog
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object FileListBox1: TFileListBox
|
||||
object ShellListView: TShellListView
|
||||
Left = 0
|
||||
Height = 374
|
||||
Top = 34
|
||||
Width = 271
|
||||
Width = 329
|
||||
Align = alClient
|
||||
BorderSpacing.Right = 4
|
||||
Directory = 'D:\lazarus'
|
||||
ItemHeight = 0
|
||||
Color = clDefault
|
||||
HideSelection = False
|
||||
Mask = '*.wav'
|
||||
OnChange = FileListBox1Change
|
||||
TabOrder = 1
|
||||
ObjectTypes = [otNonFolders]
|
||||
ShellTreeView = ShellTreeView
|
||||
end
|
||||
object Panel3: TPanel
|
||||
Left = 61
|
||||
Height = 90
|
||||
Top = 110
|
||||
Width = 170
|
||||
BevelOuter = bvNone
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'Nothing to select from'
|
||||
TabOrder = 3
|
||||
Wordwrap = True
|
||||
end
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 448
|
||||
Left = 390
|
||||
Height = 446
|
||||
Top = 0
|
||||
Width = 5
|
||||
@ -141,15 +154,27 @@ object FrmSoundDialog: TFrmSoundDialog
|
||||
Left = 4
|
||||
Height = 438
|
||||
Top = 4
|
||||
Width = 444
|
||||
Width = 386
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Bottom = 4
|
||||
FileSortType = fstNone
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
OnChange = ShellTreeViewChange
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||
ObjectTypes = [otFolders]
|
||||
ShellListView = ShellListView
|
||||
end
|
||||
object Panel4: TPanel
|
||||
Left = 61
|
||||
Height = 90
|
||||
Top = 110
|
||||
Width = 170
|
||||
BevelOuter = bvNone
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'Nothing to select from'
|
||||
TabOrder = 3
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -51,14 +51,14 @@ type
|
||||
PageControl1: TPageControl;
|
||||
Panel1: TPanel;
|
||||
Panel2: TPanel;
|
||||
Panel3: TPanel;
|
||||
Panel4: TPanel;
|
||||
RightPanel: TPanel;
|
||||
ShellListView: TShellListView;
|
||||
ShellTreeView: TShellTreeView;
|
||||
Splitter1: TSplitter;
|
||||
TabSheet1: TTabSheet;
|
||||
PlayButton: TSpeedButton;
|
||||
// DriveComboBox1: TDriveComboBox;
|
||||
// DirectoryListBox1: TDirectoryListBox;
|
||||
FileListBox1: TFileListBox;
|
||||
CBDefault: TCheckBox;
|
||||
OkBtn: TButton;
|
||||
CancelBtn: TButton;
|
||||
@ -70,12 +70,13 @@ type
|
||||
procedure CancelBtnClick(Sender: TObject);
|
||||
procedure FormKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure ShellTreeViewChange(Sender: TObject; Node: TTreeNode);
|
||||
private
|
||||
FOnPlaySound: TVpPlaySoundEvent;
|
||||
function FindFileItem(AFilename: String): TListItem;
|
||||
public
|
||||
DingPath: string;
|
||||
ReturnCode : TVpEditorReturnCode;
|
||||
function GetSelectedFileName: String;
|
||||
procedure Populate;
|
||||
property OnPlaySound: TVpPlaySoundEvent read FOnPlaySound write FOnPlaySound;
|
||||
end;
|
||||
@ -94,9 +95,9 @@ uses
|
||||
|
||||
procedure TFrmSoundDialog.FileListBox1Change(Sender: TObject);
|
||||
begin
|
||||
if FileListBox1.Items.Count > 0 then begin
|
||||
if ShellListview.Items.Count > 0 then begin
|
||||
PlayButton.Enabled := true;
|
||||
DingPath := FileListBox1.FileName;
|
||||
DingPath := GetSelectedFileName;
|
||||
end else begin
|
||||
PlayButton.Enabled := false;
|
||||
DingPath := '';
|
||||
@ -108,55 +109,63 @@ procedure TFrmSoundDialog.PlayButtonClick(Sender: TObject);
|
||||
begin
|
||||
if Assigned(FOnPlaySound) then begin
|
||||
PlayButton.Enabled := false;
|
||||
FOnPlaySound(self, FileListbox1.FileName, psmSync);
|
||||
FOnPlaySound(self, GetSelectedFileName, psmSync);
|
||||
PlayButton.Enabled := true;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TFrmSoundDialog.Populate;
|
||||
function TFrmSoundDialog.FindFileItem(AFileName: String): TListItem;
|
||||
var
|
||||
Drive: char;
|
||||
i: Integer;
|
||||
begin
|
||||
AFileName := ExtractFileName(AFileName);
|
||||
for i:=0 to ShellListview.Items.Count-1 do
|
||||
if ShellListview.Items[i].Caption = AFilename then begin
|
||||
Result := ShellListview.Items[i];
|
||||
exit;
|
||||
end;
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure TFrmSoundDialog.Populate;
|
||||
begin
|
||||
TabSheet1.Caption := RSSelectASound;
|
||||
Self.Caption := RSSoundFinder;
|
||||
CBDefault.Caption := RSDefaultSound;
|
||||
OkBtn.Caption := RSOkBtn;
|
||||
CancelBtn.Caption := RSCancelBtn;
|
||||
Panel3.Caption := RSNothingToSelectFrom;
|
||||
Panel4.Caption := RSNothingToSelectFrom;
|
||||
if DingPath = '' then begin
|
||||
CBDefault.Checked := true;
|
||||
ShellTreeView.Path := ExtractFileDir(ParamStr(0));
|
||||
// DirectoryListBox1.Directory := ExtractFileDir(ParamStr(0));
|
||||
end else begin
|
||||
Drive := UpCase(ExtractFileDrive(DingPath)[1]);
|
||||
if FileExists(DingPath) and (Drive in ['A'..'Z']) then begin
|
||||
end else
|
||||
if FileExists(DingPath) then begin
|
||||
ShellTreeview.Path := ExtractFileDir(DingPath);
|
||||
FileListBox1.FileName := DingPath;
|
||||
ShellListview.Selected := FindFileItem(DingPath);
|
||||
end else begin
|
||||
ShellTreeView.Path := ExtractFileDir(ParamStr(0));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFrmSoundDialog.ShellTreeViewChange(Sender: TObject; Node: TTreeNode);
|
||||
begin
|
||||
FileListbox1.Directory := ShellTreeView.Path;
|
||||
CBDefaultClick(nil);
|
||||
end;
|
||||
|
||||
{=====}
|
||||
|
||||
procedure TFrmSoundDialog.CBDefaultClick(Sender: TObject);
|
||||
begin
|
||||
// DriveComboBox1.Enabled := not CBDefault.Checked;
|
||||
// DirectoryListBox1.Enabled := not CBDefault.Checked;
|
||||
ShellTreeview.Enabled := not CBDefault.Checked;
|
||||
FileListBox1.Enabled := not CBDefault.Checked;
|
||||
PlayButton.Enabled := not CBDefault.Checked;
|
||||
ShellTreeview.Visible := not CBDefault.Checked;
|
||||
ShellListview.Visible := not CBDefault.Checked;
|
||||
Panel3.Visible := CBDefault.Checked;
|
||||
Panel4.Visible := CBDefault.Checked;
|
||||
PlayButton.Visible := not CBDefault.Checked;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TFrmSoundDialog.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Panel3.Align := alClient;
|
||||
Panel4.Align := alClient;
|
||||
ReturnCode := rtAbandon;
|
||||
end;
|
||||
{=====}
|
||||
@ -181,5 +190,13 @@ begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
function TFrmSoundDialog.GetSelectedFileName: String;
|
||||
begin
|
||||
if ShellListview.ItemFocused <> nil then
|
||||
Result := IncludeTrailingPathDelimiter(ShellTreeView.Path) + ShellListview.ItemFocused.Caption
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user