Audacity  2.2.2
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SplashDialog Class Referencefinal

The SplashDialog shows help information for Audacity when Audacity starts up. More...

#include <SplashDialog.h>

Inheritance diagram for SplashDialog:
wxDialogWrapper wxTabTraversalWrapper< wxDialog >

Public Member Functions

 SplashDialog (wxWindow *parent)
 
virtual ~SplashDialog ()
 
void OnOK (wxCommandEvent &event)
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&...args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Static Public Member Functions

static void Show2 (wxWindow *pParent)
 

Private Member Functions

void Populate (ShuttleGui &S)
 
void OnDontShow (wxCommandEvent &Evt)
 

Private Attributes

HtmlWindowmpHtml
 
std::unique_ptr< wxBitmap > m_pLogo
 

Static Private Attributes

static SplashDialogpSelf =NULL
 

Detailed Description

The SplashDialog shows help information for Audacity when Audacity starts up.

It was written for the benefit of NEW users who do not want to read the manual. The text of the dialog is kept short to increase the chance of it being read. The content is designed to reduce the most commonly asked questions about Audacity.

Definition at line 26 of file SplashDialog.h.

Constructor & Destructor Documentation

SplashDialog::SplashDialog ( wxWindow *  parent)

Definition at line 67 of file SplashDialog.cpp.

References eIsCreating.

Referenced by Show2().

68  : wxDialogWrapper(parent, -1, _("Welcome to Audacity!"),
69  wxPoint( -1, 60 ), // default x position, y position 60 pixels from top of screen.
70  wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
71 {
72  SetName(GetTitle());
73  m_pLogo = NULL; //v
74  ShuttleGui S( this, eIsCreating );
75  Populate( S );
76  Fit();
77  this->Centre();
78  int x,y;
79  GetPosition( &x, &y );
80  Move( x, 60 );
81 }
void Populate(ShuttleGui &S)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
std::unique_ptr< wxBitmap > m_pLogo
Definition: SplashDialog.h:42
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
SplashDialog::~SplashDialog ( )
virtual

Definition at line 144 of file SplashDialog.cpp.

145 {
146 }

Member Function Documentation

void SplashDialog::OnDontShow ( wxCommandEvent &  Evt)
private

Definition at line 148 of file SplashDialog.cpp.

References gPrefs.

149 {
150  bool bShow = !Evt.IsChecked();
151  gPrefs->Write(wxT("/GUI/ShowSplashScreen"), bShow );
152  gPrefs->Flush();
153 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void SplashDialog::OnOK ( wxCommandEvent &  event)

Definition at line 155 of file SplashDialog.cpp.

156 {
157  Show( false );
158 
159 }
void SplashDialog::Populate ( ShuttleGui S)
private

Definition at line 83 of file SplashDialog.cpp.

References _(), ShuttleGuiBase::AddCheckBox(), ShuttleGuiBase::AddWindow(), DontShowID, ShuttleGuiBase::EndVerticalLay(), ShuttleGuiBase::GetParent(), gPrefs, HelpText(), ShuttleGui::Id(), LOGOWITHNAME_HEIGHT, LOGOWITHNAME_WIDTH, m_pLogo, mpHtml, ShuttleGui::Prop(), safenew, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::SetStretchyCol(), ShuttleGuiBase::StartMultiColumn(), and ShuttleGuiBase::StartVerticalLay().

84 {
85  bool bShow;
86  gPrefs->Read(wxT("/GUI/ShowSplashScreen"), &bShow, true );
87  S.StartVerticalLay(1);
88 
89  //v For now, change to AudacityLogoWithName via old-fashioned ways, not Theme.
90  m_pLogo = std::make_unique<wxBitmap>((const char **) AudacityLogoWithName_xpm); //v
91 
92 
93  // JKC: Resize to 50% of size. Later we may use a smaller xpm as
94  // our source, but this allows us to tweak the size - if we want to.
95  // It also makes it easier to revert to full size if we decide to.
96  const float fScale=0.5f;// smaller size.
97  wxImage RescaledImage( m_pLogo->ConvertToImage() );
98  wxColour MainColour(
99  RescaledImage.GetRed(1,1),
100  RescaledImage.GetGreen(1,1),
101  RescaledImage.GetBlue(1,1));
102  this->SetBackgroundColour(MainColour);
103 
104  // wxIMAGE_QUALITY_HIGH not supported by wxWidgets 2.6.1, or we would use it here.
105  RescaledImage.Rescale( (int)(LOGOWITHNAME_WIDTH * fScale), (int)(LOGOWITHNAME_HEIGHT *fScale) );
106  wxBitmap RescaledBitmap( RescaledImage );
107  wxStaticBitmap *const icon =
108  safenew wxStaticBitmap(S.GetParent(), -1,
109  //*m_pLogo, //v theTheme.Bitmap(bmpAudacityLogoWithName),
110  RescaledBitmap,
111  wxDefaultPosition,
112  wxSize((int)(LOGOWITHNAME_WIDTH*fScale), (int)(LOGOWITHNAME_HEIGHT*fScale)));
113 
114  S.Prop(0).AddWindow( icon );
115 
116 #if (0)
117  icon->Bind(wxEVT_LEFT_DOWN,
118  [this]( wxMouseEvent const & event ) ->void {
119  if ( event.ShiftDown() && event.ControlDown())
120  wxLaunchDefaultBrowser("https://www.audacityteam.org");
121  }
122  );
123 #endif
124 
126  wxDefaultPosition,
127  wxSize(506, 280),
128  wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER );
129  mpHtml->SetPage(HelpText( wxT("welcome") ));
130  S.Prop(1).AddWindow( mpHtml, wxEXPAND );
131  S.Prop(0).StartMultiColumn(2, wxEXPAND);
132  S.SetStretchyCol( 1 );// Column 1 is stretchy...
133  {
134  S.SetBorder( 5 );
135  S.Id( DontShowID).AddCheckBox( _("Don't show this again at start up"), bShow ? wxT("false") : wxT("true") );
136  wxButton *ok = safenew wxButton(S.GetParent(), wxID_OK);
137  ok->SetDefault();
138  S.SetBorder( 5 );
139  S.Prop(0).AddWindow( ok, wxALIGN_RIGHT| wxALL );
140  }
141  S.EndVerticalLay();
142 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
wxWindow * AddWindow(wxWindow *pWindow, int Flags=wxALIGN_CENTRE|wxALL)
Definition: ShuttleGui.cpp:288
std::unique_ptr< wxBitmap > m_pLogo
Definition: SplashDialog.h:42
#define safenew
Definition: Audacity.h:230
void EndVerticalLay()
#define LOGOWITHNAME_WIDTH
wxCheckBox * AddCheckBox(const wxString &Prompt, const wxString &Selected)
Definition: ShuttleGui.cpp:298
wxWindow * GetParent()
Definition: ShuttleGui.h:294
wxString HelpText(const wxString &Key)
Definition: HelpText.cpp:298
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
ShuttleGui & Id(int id)
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
HtmlWindow * mpHtml
Definition: SplashDialog.h:41
ShuttleGui & Prop(int iProp)
Definition: ShuttleGui.h:418
#define LOGOWITHNAME_HEIGHT
void SetBorder(int Border)
Definition: ShuttleGui.h:286
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:203
void StartVerticalLay(int iProp=1)
void SplashDialog::Show2 ( wxWindow *  pParent)
static

Definition at line 161 of file SplashDialog.cpp.

References HelpText(), mpHtml, pSelf, safenew, and SplashDialog().

Referenced by AudacityProject::OnHelpWelcome().

162 {
163  if( pSelf == NULL )
164  {
165  // pParent owns it
166  wxASSERT(pParent);
167  pSelf = safenew SplashDialog( pParent );
168  }
169  pSelf->mpHtml->SetPage(HelpText( wxT("welcome") ));
170  pSelf->Show( true );
171 }
SplashDialog(wxWindow *parent)
static SplashDialog * pSelf
Definition: SplashDialog.h:43
#define safenew
Definition: Audacity.h:230
wxString HelpText(const wxString &Key)
Definition: HelpText.cpp:298
HtmlWindow * mpHtml
Definition: SplashDialog.h:41

Member Data Documentation

std::unique_ptr<wxBitmap> SplashDialog::m_pLogo
private

Definition at line 42 of file SplashDialog.h.

Referenced by Populate().

HtmlWindow* SplashDialog::mpHtml
private

Definition at line 41 of file SplashDialog.h.

Referenced by Populate(), and Show2().

SplashDialog * SplashDialog::pSelf =NULL
staticprivate

Definition at line 43 of file SplashDialog.h.

Referenced by Show2().


The documentation for this class was generated from the following files: