New ShowInfoDialog() function for text message plus OK button. Resizability more obvious now, and cursor at position 0.

This commit is contained in:
james.k.crook 2010-02-13 18:24:57 +00:00
parent a2ad4dae36
commit f4e81220b3
7 changed files with 75 additions and 52 deletions

View File

@ -44,6 +44,7 @@ simplifies construction of menu items.
#include <wx/progdlg.h>
#include <wx/scrolbar.h>
#include <wx/ffile.h>
#include <wx/statusbr.h>
#include "Project.h"
#include "effects/EffectManager.h"
@ -5421,28 +5422,11 @@ void AudacityProject::OnScreenshot()
void AudacityProject::OnAudioDeviceInfo()
{
wxString info = gAudioIO->GetDeviceInfo();
wxTextCtrl *tc;
wxDialog dlg(this, wxID_ANY,
wxString(wxT("Audio Device Info")),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
ShuttleGui S(&dlg, eIsCreating);
S.StartHorizontalLay(wxEXPAND, true);
{
S.SetStyle( wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 |
wxTE_AUTO_URL | wxTE_NOHIDESEL | wxHSCROLL );
tc = S.AddTextWindow(wxT(""));
tc->WriteText(info);
}
S.EndHorizontalLay();
S.AddStandardButtons(eOkButton);
dlg.Center();
dlg.ShowModal();
ShowInfoDialog( this,
_("Audio Device Info"),
wxT(""),
info,
350,450);
}
void AudacityProject::OnSeparator()

View File

@ -521,6 +521,9 @@ wxTextCtrl * ShuttleGuiBase::AddTextWindow(const wxString &Value)
mpWind = pTextCtrl = new wxTextCtrl(mpParent, miId, Value,
wxDefaultPosition, wxDefaultSize, Style( wxTE_MULTILINE ));
UpdateSizers();
// Start off at start of window...
pTextCtrl->SetInsertionPoint( 0 );
pTextCtrl->ShowPosition( 0 );
return pTextCtrl;
}

View File

@ -1278,12 +1278,8 @@ NyquistOutputDialog::NyquistOutputDialog(wxWindow * parent, wxWindowID id,
item = new wxStaticText(this, -1, prompt);
mainSizer->Add(item, 0, wxALIGN_LEFT | wxLEFT | wxTOP | wxRIGHT, 10);
// TODO: Convert this to using ShuttleGui.
// using S.AddTextWindow();
// TODO: Consider using:
// wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 |
// wxTE_AUTO_URL | wxTE_NOHIDESEL | wxHSCROLL
// Haven't made this change as this dialog MUST work with screen readers.
// TODO use ShowInfoDialog() instead.
// Beware this dialog MUST work with screen readers.
item = new wxTextCtrl(this, -1, message,
wxDefaultPosition, wxSize(400, 200),
wxTE_MULTILINE | wxTE_READONLY);

View File

@ -418,6 +418,7 @@ int ExportCL::Export(AudacityProject *project,
// Display output on error or if the user wants to see it
if (p->GetStatus() != 0 || show) {
// TODO use ShowInfoDialog() instead.
wxDialog dlg(NULL,
wxID_ANY,
wxString(_("Command Output")),

View File

@ -47,6 +47,7 @@
#include "../Project.h"
#include "../Prefs.h"
#include "../Tags.h"
#include "../widgets/ErrorDialog.h"
/* define our dynamic array of export settings */
@ -534,30 +535,17 @@ void ExportMultiple::OnExport(wxCommandEvent& event)
)
), mExported.GetCount());
// This results dialog is a child of this dialog.
SuccessDialog dlg(this,
wxID_ANY,
wxString(_("Export Multiple")) );
ShuttleGui S(&dlg, eIsCreating);
S.StartVerticalLay();
{
S.AddTitle(msg);
wxString FileList;
for (size_t i = 0; i < mExported.GetCount(); i++) {
FileList += mExported[i];
FileList += '\n';
}
S.SetStyle( wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 |
wxTE_AUTO_URL | wxTE_NOHIDESEL | wxHSCROLL );
S.AddTextWindow( FileList );
S.AddStandardButtons(eOkButton);
wxString FileList;
for (size_t i = 0; i < mExported.GetCount(); i++) {
FileList += mExported[i];
FileList += '\n';
}
S.EndVerticalLay();
dlg.SetMinSize( wxSize(125,200) );
dlg.SetSize( wxSize(450,400) );
dlg.Center();
dlg.ShowModal();
// This results dialog is a child of this dialog.
ShowInfoDialog( this,
_("Export Multiple"),
msg,
FileList,
450,400);
}
if (ok == eProgressSuccess || ok == eProgressStopped) {

View File

@ -247,6 +247,49 @@ void ShowErrorDialog(wxWindow *parent,
}
/// Mostly we use this so that we have the code for resizability
/// in one place. Other considerations like screen readers are also
/// handled by having the code in one place.
void ShowInfoDialog( wxWindow *parent,
const wxString &dlogTitle,
const wxString &shortMsg,
const wxString &message,
const int xSize, const int ySize)
{
wxDialog dlog(parent, wxID_ANY,
dlogTitle,
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX /*| wxDEFAULT_FRAME_STYLE */);
ShuttleGui S(&dlog, eIsCreating);
S.StartVerticalLay(1);
{
S.AddTitle( shortMsg);
S.SetStyle( wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_RICH2 |
wxTE_AUTO_URL | wxTE_NOHIDESEL | wxHSCROLL );
S.AddTextWindow(message);
}
S.SetBorder( 0 );
S.StartHorizontalLay(wxALIGN_RIGHT|wxALIGN_BOTTOM, 0);
S.AddStandardButtons(eOkButton);
// Next three lines add a tiny dragger.
wxStatusBar * pBar = new wxStatusBar( &dlog );
pBar->SetSize( 18, 38);
S.AddWindow( pBar, wxALIGN_BOTTOM|wxALIGN_RIGHT );
S.EndHorizontalLay();
S.EndVerticalLay();
// Smallest size is half default size. Seems reasonable.
dlog.SetMinSize( wxSize(xSize/2, ySize/2) );
dlog.SetSize( wxSize(xSize, ySize) );
dlog.Center();
dlog.ShowModal();
}
void ShowHelpDialog(wxWindow *parent,
const wxString &localFileName,
const wxString &remoteURL)

View File

@ -5,6 +5,7 @@
ErrorDialog.h
Jimmy Johnson
James Crook
**********************************************************************/
@ -19,7 +20,14 @@
void ShowErrorDialog(wxWindow *parent,
const wxString &dlogTitle,
const wxString &message,
const wxString &helpURL);
const wxString &helpURL);
/// Displays cutable information in a text ctrl, with an OK button.
void ShowInfoDialog( wxWindow *parent,
const wxString &dlogTitle,
const wxString &shortMsg,
const wxString &message,
const int xSize, const int ySize);
/// Displays a new window with wxHTML help.
void ShowHtmlText( wxWindow * pParent,