mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-14 23:30:23 +02:00
Merge LinkingHtmlWindow into HelpSystem...
... they cooperated closely in a cycle of two not worth breaking
This commit is contained in:
parent
f4b370d1e2
commit
d6317ae6af
@ -786,8 +786,6 @@ src/widgets/ImageRoll.cpp
|
||||
src/widgets/ImageRoll.h
|
||||
src/widgets/KeyView.cpp
|
||||
src/widgets/KeyView.h
|
||||
src/widgets/LinkingHtmlWindow.cpp
|
||||
src/widgets/LinkingHtmlWindow.h
|
||||
src/widgets/Meter.cpp
|
||||
src/widgets/Meter.h
|
||||
src/widgets/MeterPanelBase.cpp
|
||||
|
@ -428,7 +428,6 @@
|
||||
28105DAC0AD09FC500BB4269 /* px_mixer.h in Headers */ = {isa = PBXBuildFile; fileRef = 28105DA20AD09FC500BB4269 /* px_mixer.h */; };
|
||||
2810644B1818EEB5004F678B /* cpu_detect_x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2810644A1818EEB5004F678B /* cpu_detect_x86.cpp */; };
|
||||
2810644D1818EED3004F678B /* cpu_detect.h in Headers */ = {isa = PBXBuildFile; fileRef = 2810644C1818EED3004F678B /* cpu_detect.h */; };
|
||||
2816372E0BAE3B6C0079C746 /* LinkingHtmlWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2816372C0BAE3B6C0079C746 /* LinkingHtmlWindow.cpp */; };
|
||||
282B70331B682342009A1618 /* WaveformPrefs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 282B702F1B682342009A1618 /* WaveformPrefs.cpp */; };
|
||||
282B70341B682342009A1618 /* WaveformSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 282B70311B682342009A1618 /* WaveformSettings.cpp */; };
|
||||
282D474C0B9E8D900034BC49 /* Snap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 282D474A0B9E8D900034BC49 /* Snap.cpp */; };
|
||||
@ -2308,8 +2307,6 @@
|
||||
2812A5B90DF63FF000576305 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
2812A5BD0DF6400E00576305 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||
2813897919E6163C004111ED /* SelectedRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectedRegion.h; sourceTree = "<group>"; };
|
||||
2816372C0BAE3B6C0079C746 /* LinkingHtmlWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = LinkingHtmlWindow.cpp; sourceTree = "<group>"; tabWidth = 3; };
|
||||
2816372D0BAE3B6C0079C746 /* LinkingHtmlWindow.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = LinkingHtmlWindow.h; sourceTree = "<group>"; tabWidth = 3; };
|
||||
282B702E1B682342009A1618 /* GUISettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUISettings.h; sourceTree = "<group>"; };
|
||||
282B702F1B682342009A1618 /* WaveformPrefs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WaveformPrefs.cpp; sourceTree = "<group>"; };
|
||||
282B70301B682342009A1618 /* WaveformPrefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WaveformPrefs.h; sourceTree = "<group>"; };
|
||||
@ -4984,8 +4981,6 @@
|
||||
28F1D81C0A2D0019005506A7 /* ImageRoll.h */,
|
||||
2849A41E17F8BEC2005C653F /* KeyView.cpp */,
|
||||
2849A41F17F8BEC2005C653F /* KeyView.h */,
|
||||
2816372C0BAE3B6C0079C746 /* LinkingHtmlWindow.cpp */,
|
||||
2816372D0BAE3B6C0079C746 /* LinkingHtmlWindow.h */,
|
||||
1790B10309883BFD008A330A /* Meter.cpp */,
|
||||
1790B10409883BFD008A330A /* Meter.h */,
|
||||
5E135A4C22A62B7E0076E983 /* MeterPanelBase.cpp */,
|
||||
@ -8620,7 +8615,6 @@
|
||||
28D65C720B97E54B000E001A /* AutoDuck.cpp in Sources */,
|
||||
28D65C760B97E573000E001A /* DtmfGen.cpp in Sources */,
|
||||
282D474C0B9E8D900034BC49 /* Snap.cpp in Sources */,
|
||||
2816372E0BAE3B6C0079C746 /* LinkingHtmlWindow.cpp in Sources */,
|
||||
283B3D4D0BC21EBE00FA01D5 /* FileDialog.cpp in Sources */,
|
||||
2809C4B80BCB7E560006010F /* FileIO.cpp in Sources */,
|
||||
285DE1FA0BF03C7800A20DF0 /* Screenshot.cpp in Sources */,
|
||||
|
@ -41,7 +41,7 @@ hold information about one contributor to Audacity.
|
||||
#include "FileNames.h"
|
||||
#include "HelpText.h"
|
||||
#include "ShuttleGui.h"
|
||||
#include "widgets/LinkingHtmlWindow.h"
|
||||
#include "widgets/HelpSystem.h"
|
||||
|
||||
#include "AllThemeResources.h"
|
||||
|
||||
|
@ -768,8 +768,6 @@ audacity_SOURCES = \
|
||||
widgets/ImageRoll.h \
|
||||
widgets/KeyView.cpp \
|
||||
widgets/KeyView.h \
|
||||
widgets/LinkingHtmlWindow.cpp \
|
||||
widgets/LinkingHtmlWindow.h \
|
||||
widgets/Meter.cpp \
|
||||
widgets/Meter.h \
|
||||
widgets/MeterPanelBase.cpp \
|
||||
|
@ -593,8 +593,7 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \
|
||||
widgets/Grid.h widgets/HelpSystem.cpp widgets/HelpSystem.h \
|
||||
widgets/HtmlWindow.cpp widgets/HtmlWindow.h \
|
||||
widgets/ImageRoll.cpp widgets/ImageRoll.h widgets/KeyView.cpp \
|
||||
widgets/KeyView.h widgets/LinkingHtmlWindow.cpp \
|
||||
widgets/LinkingHtmlWindow.h widgets/Meter.cpp widgets/Meter.h \
|
||||
widgets/KeyView.h widgets/Meter.cpp widgets/Meter.h \
|
||||
widgets/MeterPanelBase.cpp widgets/MeterPanelBase.h \
|
||||
widgets/MultiDialog.cpp widgets/MultiDialog.h \
|
||||
widgets/NumericTextCtrl.cpp widgets/NumericTextCtrl.h \
|
||||
@ -956,7 +955,6 @@ am_audacity_OBJECTS = $(am__objects_1) audacity-AboutDialog.$(OBJEXT) \
|
||||
widgets/audacity-HtmlWindow.$(OBJEXT) \
|
||||
widgets/audacity-ImageRoll.$(OBJEXT) \
|
||||
widgets/audacity-KeyView.$(OBJEXT) \
|
||||
widgets/audacity-LinkingHtmlWindow.$(OBJEXT) \
|
||||
widgets/audacity-Meter.$(OBJEXT) \
|
||||
widgets/audacity-MeterPanelBase.$(OBJEXT) \
|
||||
widgets/audacity-MultiDialog.$(OBJEXT) \
|
||||
@ -1719,8 +1717,7 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \
|
||||
widgets/Grid.h widgets/HelpSystem.cpp widgets/HelpSystem.h \
|
||||
widgets/HtmlWindow.cpp widgets/HtmlWindow.h \
|
||||
widgets/ImageRoll.cpp widgets/ImageRoll.h widgets/KeyView.cpp \
|
||||
widgets/KeyView.h widgets/LinkingHtmlWindow.cpp \
|
||||
widgets/LinkingHtmlWindow.h widgets/Meter.cpp widgets/Meter.h \
|
||||
widgets/KeyView.h widgets/Meter.cpp widgets/Meter.h \
|
||||
widgets/MeterPanelBase.cpp widgets/MeterPanelBase.h \
|
||||
widgets/MultiDialog.cpp widgets/MultiDialog.h \
|
||||
widgets/NumericTextCtrl.cpp widgets/NumericTextCtrl.h \
|
||||
@ -2484,8 +2481,6 @@ widgets/audacity-ImageRoll.$(OBJEXT): widgets/$(am__dirstamp) \
|
||||
widgets/$(DEPDIR)/$(am__dirstamp)
|
||||
widgets/audacity-KeyView.$(OBJEXT): widgets/$(am__dirstamp) \
|
||||
widgets/$(DEPDIR)/$(am__dirstamp)
|
||||
widgets/audacity-LinkingHtmlWindow.$(OBJEXT): widgets/$(am__dirstamp) \
|
||||
widgets/$(DEPDIR)/$(am__dirstamp)
|
||||
widgets/audacity-Meter.$(OBJEXT): widgets/$(am__dirstamp) \
|
||||
widgets/$(DEPDIR)/$(am__dirstamp)
|
||||
widgets/audacity-MeterPanelBase.$(OBJEXT): widgets/$(am__dirstamp) \
|
||||
@ -3007,7 +3002,6 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@widgets/$(DEPDIR)/audacity-HtmlWindow.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@widgets/$(DEPDIR)/audacity-ImageRoll.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@widgets/$(DEPDIR)/audacity-KeyView.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@widgets/$(DEPDIR)/audacity-LinkingHtmlWindow.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@widgets/$(DEPDIR)/audacity-Meter.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@widgets/$(DEPDIR)/audacity-MeterPanelBase.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@widgets/$(DEPDIR)/audacity-MultiDialog.Po@am__quote@
|
||||
@ -7999,20 +7993,6 @@ widgets/audacity-KeyView.obj: widgets/KeyView.cpp
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o widgets/audacity-KeyView.obj `if test -f 'widgets/KeyView.cpp'; then $(CYGPATH_W) 'widgets/KeyView.cpp'; else $(CYGPATH_W) '$(srcdir)/widgets/KeyView.cpp'; fi`
|
||||
|
||||
widgets/audacity-LinkingHtmlWindow.o: widgets/LinkingHtmlWindow.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT widgets/audacity-LinkingHtmlWindow.o -MD -MP -MF widgets/$(DEPDIR)/audacity-LinkingHtmlWindow.Tpo -c -o widgets/audacity-LinkingHtmlWindow.o `test -f 'widgets/LinkingHtmlWindow.cpp' || echo '$(srcdir)/'`widgets/LinkingHtmlWindow.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) widgets/$(DEPDIR)/audacity-LinkingHtmlWindow.Tpo widgets/$(DEPDIR)/audacity-LinkingHtmlWindow.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='widgets/LinkingHtmlWindow.cpp' object='widgets/audacity-LinkingHtmlWindow.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o widgets/audacity-LinkingHtmlWindow.o `test -f 'widgets/LinkingHtmlWindow.cpp' || echo '$(srcdir)/'`widgets/LinkingHtmlWindow.cpp
|
||||
|
||||
widgets/audacity-LinkingHtmlWindow.obj: widgets/LinkingHtmlWindow.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT widgets/audacity-LinkingHtmlWindow.obj -MD -MP -MF widgets/$(DEPDIR)/audacity-LinkingHtmlWindow.Tpo -c -o widgets/audacity-LinkingHtmlWindow.obj `if test -f 'widgets/LinkingHtmlWindow.cpp'; then $(CYGPATH_W) 'widgets/LinkingHtmlWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/widgets/LinkingHtmlWindow.cpp'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) widgets/$(DEPDIR)/audacity-LinkingHtmlWindow.Tpo widgets/$(DEPDIR)/audacity-LinkingHtmlWindow.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='widgets/LinkingHtmlWindow.cpp' object='widgets/audacity-LinkingHtmlWindow.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o widgets/audacity-LinkingHtmlWindow.obj `if test -f 'widgets/LinkingHtmlWindow.cpp'; then $(CYGPATH_W) 'widgets/LinkingHtmlWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/widgets/LinkingHtmlWindow.cpp'; fi`
|
||||
|
||||
widgets/audacity-Meter.o: widgets/Meter.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT widgets/audacity-Meter.o -MD -MP -MF widgets/$(DEPDIR)/audacity-Meter.Tpo -c -o widgets/audacity-Meter.o `test -f 'widgets/Meter.cpp' || echo '$(srcdir)/'`widgets/Meter.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) widgets/$(DEPDIR)/audacity-Meter.Tpo widgets/$(DEPDIR)/audacity-Meter.Po
|
||||
|
@ -39,7 +39,7 @@ most commonly asked questions about Audacity.
|
||||
#include "Project.h"
|
||||
#include "ShuttleGui.h"
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
#include "widgets/LinkingHtmlWindow.h"
|
||||
#include "widgets/HelpSystem.h"
|
||||
|
||||
#include "AllThemeResources.h"
|
||||
#include "Prefs.h"
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "../prefs/PrefsDialog.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
#include "../widgets/HelpSystem.h"
|
||||
#include "../widgets/LinkingHtmlWindow.h"
|
||||
|
||||
#if defined(EXPERIMENTAL_CRASH_REPORT)
|
||||
#include <wx/debugrpt.h>
|
||||
|
@ -8,6 +8,15 @@
|
||||
Leland Lucius
|
||||
Richard Ash
|
||||
|
||||
was merged with LinkingHtmlWindow.h
|
||||
|
||||
Vaughan Johnson
|
||||
Dominic Mazzoni
|
||||
|
||||
utility fn and
|
||||
descendant of HtmlWindow that opens links in the user's
|
||||
default browser
|
||||
|
||||
*//********************************************************************/
|
||||
|
||||
#include "../Audacity.h" // for USE_* macros
|
||||
@ -32,7 +41,6 @@
|
||||
#include <wx/regex.h>
|
||||
|
||||
#include "../FileNames.h"
|
||||
#include "LinkingHtmlWindow.h"
|
||||
#include "../AllThemeResources.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../HelpText.h"
|
||||
@ -399,3 +407,154 @@ void HelpSystem::ShowHelp(wxWindow *parent,
|
||||
bModal
|
||||
);
|
||||
}
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#include <wx/mimetype.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/uri.h>
|
||||
|
||||
BEGIN_EVENT_TABLE(BrowserDialog, wxDialogWrapper)
|
||||
EVT_BUTTON(wxID_FORWARD, BrowserDialog::OnForward)
|
||||
EVT_BUTTON(wxID_BACKWARD, BrowserDialog::OnBackward)
|
||||
EVT_BUTTON(wxID_CANCEL, BrowserDialog::OnClose)
|
||||
EVT_KEY_DOWN(BrowserDialog::OnKeyDown)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
BrowserDialog::BrowserDialog(wxWindow *pParent, const wxString &title)
|
||||
: wxDialogWrapper{ pParent, ID, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER /*| wxMAXIMIZE_BOX */ }
|
||||
{
|
||||
int width, height;
|
||||
const int minWidth = 400;
|
||||
const int minHeight = 250;
|
||||
|
||||
gPrefs->Read(wxT("/GUI/BrowserWidth"), &width, minWidth);
|
||||
gPrefs->Read(wxT("/GUI/BrowserHeight"), &height, minHeight);
|
||||
|
||||
if (width < minWidth || width > wxSystemSettings::GetMetric(wxSYS_SCREEN_X))
|
||||
width = minWidth;
|
||||
if (height < minHeight || height > wxSystemSettings::GetMetric(wxSYS_SCREEN_Y))
|
||||
height = minHeight;
|
||||
|
||||
SetMinSize(wxSize(minWidth, minHeight));
|
||||
SetSize(wxDefaultPosition.x, wxDefaultPosition.y, width, height, wxSIZE_AUTO);
|
||||
}
|
||||
|
||||
void BrowserDialog::OnForward(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
mpHtml->HistoryForward();
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void BrowserDialog::OnBackward(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
mpHtml->HistoryBack();
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void BrowserDialog::OnClose(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
if (IsModal() && !mDismissed)
|
||||
{
|
||||
mDismissed = true;
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
auto parent = GetParent();
|
||||
|
||||
gPrefs->Write(wxT("/GUI/BrowserWidth"), GetSize().GetX());
|
||||
gPrefs->Write(wxT("/GUI/BrowserHeight"), GetSize().GetY());
|
||||
gPrefs->Flush();
|
||||
|
||||
#ifdef __WXMAC__
|
||||
auto grandparent = GetParent()->GetParent();
|
||||
#endif
|
||||
|
||||
parent->Destroy();
|
||||
|
||||
#ifdef __WXMAC__
|
||||
if(grandparent && grandparent->IsShown()) {
|
||||
grandparent->Raise();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BrowserDialog::OnKeyDown(wxKeyEvent & event)
|
||||
{
|
||||
bool bSkip = true;
|
||||
if (event.GetKeyCode() == WXK_ESCAPE)
|
||||
{
|
||||
bSkip = false;
|
||||
Close(false);
|
||||
}
|
||||
event.Skip(bSkip);
|
||||
}
|
||||
|
||||
|
||||
void BrowserDialog::UpdateButtons()
|
||||
{
|
||||
wxWindow * pWnd;
|
||||
if( (pWnd = FindWindowById( wxID_BACKWARD, this )) != NULL )
|
||||
{
|
||||
pWnd->Enable(mpHtml->HistoryCanBack());
|
||||
}
|
||||
if( (pWnd = FindWindowById( wxID_FORWARD, this )) != NULL )
|
||||
{
|
||||
pWnd->Enable(mpHtml->HistoryCanForward());
|
||||
}
|
||||
}
|
||||
|
||||
void OpenInDefaultBrowser(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
wxURI uri(link.GetHref());
|
||||
wxLaunchDefaultBrowser(uri.BuildURI());
|
||||
}
|
||||
|
||||
LinkingHtmlWindow::LinkingHtmlWindow(wxWindow *parent, wxWindowID id /*= -1*/,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/,
|
||||
long style /*= wxHW_SCROLLBAR_AUTO*/) :
|
||||
HtmlWindow(parent, id, pos, size, style)
|
||||
{
|
||||
}
|
||||
|
||||
void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
wxString href = link.GetHref();
|
||||
if( href.StartsWith(wxT("innerlink:")) )
|
||||
{
|
||||
wxString FileName =
|
||||
wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath();
|
||||
if( wxFileExists( FileName ) )
|
||||
{
|
||||
HelpSystem::ShowHelp(this, FileName, wxEmptyString, false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPage( HelpText( href.Mid( 10 )));
|
||||
wxGetTopLevelParent(this)->SetLabel( TitleText( href.Mid( 10 )));
|
||||
}
|
||||
}
|
||||
else if( href.StartsWith(wxT("mailto:")) || href.StartsWith(wxT("file:")) )
|
||||
{
|
||||
OpenInDefaultBrowser( link );
|
||||
return;
|
||||
}
|
||||
else if( !href.StartsWith( wxT("http:")) && !href.StartsWith( wxT("https:")) )
|
||||
{
|
||||
HtmlWindow::OnLinkClicked( link );
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenInDefaultBrowser(link);
|
||||
return;
|
||||
}
|
||||
BrowserDialog * pDlg = wxDynamicCast(
|
||||
GetRelatedFrame()->FindWindow(BrowserDialog::ID), BrowserDialog );
|
||||
if( pDlg )
|
||||
{
|
||||
pDlg->UpdateButtons();
|
||||
};
|
||||
}
|
||||
|
@ -7,6 +7,15 @@
|
||||
Jimmy Johnson
|
||||
James Crook
|
||||
|
||||
was merged with LinkingHtmlWindow.h
|
||||
|
||||
Vaughan Johnson
|
||||
Dominic Mazzoni
|
||||
|
||||
utility fn and
|
||||
descendant of HtmlWindow that opens links in the user's
|
||||
default browser
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_HELPSYSTEM__
|
||||
@ -104,4 +113,46 @@ public:
|
||||
|
||||
class ShuttleGui;
|
||||
|
||||
#include "HtmlWindow.h" // to inherit
|
||||
|
||||
void OpenInDefaultBrowser(const wxHtmlLinkInfo& link);
|
||||
|
||||
|
||||
/// \brief An HtmlWindow that handles linked clicked - usually the
|
||||
/// link will go to our own local copy of the manual, but it could
|
||||
/// launch a new browser window.
|
||||
class AUDACITY_DLL_API LinkingHtmlWindow final : public HtmlWindow
|
||||
{
|
||||
public:
|
||||
LinkingHtmlWindow(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHW_SCROLLBAR_AUTO);
|
||||
void OnLinkClicked(const wxHtmlLinkInfo& link) override;
|
||||
//void OnSetTitle(const wxString& title) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/// Adds some event handling to an HtmlWindow
|
||||
class BrowserDialog /* not final */ : public wxDialogWrapper
|
||||
{
|
||||
public:
|
||||
enum { ID = 0 };
|
||||
BrowserDialog(wxWindow *pParent, const wxString &title);
|
||||
|
||||
void OnForward(wxCommandEvent & event);
|
||||
void OnBackward(wxCommandEvent & event);
|
||||
void OnClose(wxCommandEvent & event);
|
||||
void OnKeyDown(wxKeyEvent & event);
|
||||
|
||||
void UpdateButtons();
|
||||
//void SetLabel(const wxString& label) override;
|
||||
|
||||
|
||||
HtmlWindow * mpHtml;
|
||||
bool mDismissed{};
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // __AUDACITY_HELPSYSTEM__
|
||||
|
@ -1,176 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
LinkingHtmlWindow.cpp
|
||||
|
||||
Vaughan Johnson
|
||||
Dominic Mazzoni
|
||||
|
||||
utility fn and
|
||||
descendant of HtmlWindow that opens links in the user's
|
||||
default browser
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "LinkingHtmlWindow.h"
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#include <wx/mimetype.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/uri.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
#include "../HelpText.h"
|
||||
#include "../FileNames.h"
|
||||
#include "../Prefs.h"
|
||||
#include "HelpSystem.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(BrowserDialog, wxDialogWrapper)
|
||||
EVT_BUTTON(wxID_FORWARD, BrowserDialog::OnForward)
|
||||
EVT_BUTTON(wxID_BACKWARD, BrowserDialog::OnBackward)
|
||||
EVT_BUTTON(wxID_CANCEL, BrowserDialog::OnClose)
|
||||
EVT_KEY_DOWN(BrowserDialog::OnKeyDown)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
BrowserDialog::BrowserDialog(wxWindow *pParent, const wxString &title)
|
||||
: wxDialogWrapper{ pParent, ID, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER /*| wxMAXIMIZE_BOX */ }
|
||||
{
|
||||
int width, height;
|
||||
const int minWidth = 400;
|
||||
const int minHeight = 250;
|
||||
|
||||
gPrefs->Read(wxT("/GUI/BrowserWidth"), &width, minWidth);
|
||||
gPrefs->Read(wxT("/GUI/BrowserHeight"), &height, minHeight);
|
||||
|
||||
if (width < minWidth || width > wxSystemSettings::GetMetric(wxSYS_SCREEN_X))
|
||||
width = minWidth;
|
||||
if (height < minHeight || height > wxSystemSettings::GetMetric(wxSYS_SCREEN_Y))
|
||||
height = minHeight;
|
||||
|
||||
SetMinSize(wxSize(minWidth, minHeight));
|
||||
SetSize(wxDefaultPosition.x, wxDefaultPosition.y, width, height, wxSIZE_AUTO);
|
||||
}
|
||||
|
||||
void BrowserDialog::OnForward(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
mpHtml->HistoryForward();
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void BrowserDialog::OnBackward(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
mpHtml->HistoryBack();
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
void BrowserDialog::OnClose(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
if (IsModal() && !mDismissed)
|
||||
{
|
||||
mDismissed = true;
|
||||
EndModal(wxID_CANCEL);
|
||||
}
|
||||
auto parent = GetParent();
|
||||
|
||||
gPrefs->Write(wxT("/GUI/BrowserWidth"), GetSize().GetX());
|
||||
gPrefs->Write(wxT("/GUI/BrowserHeight"), GetSize().GetY());
|
||||
gPrefs->Flush();
|
||||
|
||||
#ifdef __WXMAC__
|
||||
auto grandparent = GetParent()->GetParent();
|
||||
#endif
|
||||
|
||||
parent->Destroy();
|
||||
|
||||
#ifdef __WXMAC__
|
||||
if(grandparent && grandparent->IsShown()) {
|
||||
grandparent->Raise();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BrowserDialog::OnKeyDown(wxKeyEvent & event)
|
||||
{
|
||||
bool bSkip = true;
|
||||
if (event.GetKeyCode() == WXK_ESCAPE)
|
||||
{
|
||||
bSkip = false;
|
||||
Close(false);
|
||||
}
|
||||
event.Skip(bSkip);
|
||||
}
|
||||
|
||||
|
||||
void BrowserDialog::UpdateButtons()
|
||||
{
|
||||
wxWindow * pWnd;
|
||||
if( (pWnd = FindWindowById( wxID_BACKWARD, this )) != NULL )
|
||||
{
|
||||
pWnd->Enable(mpHtml->HistoryCanBack());
|
||||
}
|
||||
if( (pWnd = FindWindowById( wxID_FORWARD, this )) != NULL )
|
||||
{
|
||||
pWnd->Enable(mpHtml->HistoryCanForward());
|
||||
}
|
||||
}
|
||||
|
||||
void OpenInDefaultBrowser(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
wxURI uri(link.GetHref());
|
||||
wxLaunchDefaultBrowser(uri.BuildURI());
|
||||
}
|
||||
|
||||
LinkingHtmlWindow::LinkingHtmlWindow(wxWindow *parent, wxWindowID id /*= -1*/,
|
||||
const wxPoint& pos /*= wxDefaultPosition*/,
|
||||
const wxSize& size /*= wxDefaultSize*/,
|
||||
long style /*= wxHW_SCROLLBAR_AUTO*/) :
|
||||
HtmlWindow(parent, id, pos, size, style)
|
||||
{
|
||||
}
|
||||
|
||||
void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
wxString href = link.GetHref();
|
||||
if( href.StartsWith(wxT("innerlink:")) )
|
||||
{
|
||||
wxString FileName =
|
||||
wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath();
|
||||
if( wxFileExists( FileName ) )
|
||||
{
|
||||
HelpSystem::ShowHelp(this, FileName, wxEmptyString, false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPage( HelpText( href.Mid( 10 )));
|
||||
wxGetTopLevelParent(this)->SetLabel( TitleText( href.Mid( 10 )));
|
||||
}
|
||||
}
|
||||
else if( href.StartsWith(wxT("mailto:")) || href.StartsWith(wxT("file:")) )
|
||||
{
|
||||
OpenInDefaultBrowser( link );
|
||||
return;
|
||||
}
|
||||
else if( !href.StartsWith( wxT("http:")) && !href.StartsWith( wxT("https:")) )
|
||||
{
|
||||
HtmlWindow::OnLinkClicked( link );
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenInDefaultBrowser(link);
|
||||
return;
|
||||
}
|
||||
BrowserDialog * pDlg = wxDynamicCast(
|
||||
GetRelatedFrame()->FindWindow(BrowserDialog::ID), BrowserDialog );
|
||||
if( pDlg )
|
||||
{
|
||||
pDlg->UpdateButtons();
|
||||
};
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
LinkingHtmlWindow.h
|
||||
|
||||
Vaughan Johnson
|
||||
Dominic Mazzoni
|
||||
|
||||
utility fn and
|
||||
descendant of HtmlWindow that opens links in the user's
|
||||
default browser
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_LINKINGHTMLWINDOW__
|
||||
#define __AUDACITY_LINKINGHTMLWINDOW__
|
||||
|
||||
#include "HtmlWindow.h" // to inherit
|
||||
#include "wxPanelWrapper.h" // to inherit
|
||||
|
||||
void OpenInDefaultBrowser(const wxHtmlLinkInfo& link);
|
||||
|
||||
|
||||
/// \brief An HtmlWindow that handles linked clicked - usually the
|
||||
/// link will go to our own local copy of the manual, but it could
|
||||
/// launch a new browser window.
|
||||
class AUDACITY_DLL_API LinkingHtmlWindow final : public HtmlWindow
|
||||
{
|
||||
public:
|
||||
LinkingHtmlWindow(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHW_SCROLLBAR_AUTO);
|
||||
void OnLinkClicked(const wxHtmlLinkInfo& link) override;
|
||||
//void OnSetTitle(const wxString& title) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/// Adds some event handling to an HtmlWindow
|
||||
class BrowserDialog /* not final */ : public wxDialogWrapper
|
||||
{
|
||||
public:
|
||||
enum { ID = 0 };
|
||||
BrowserDialog(wxWindow *pParent, const wxString &title);
|
||||
|
||||
void OnForward(wxCommandEvent & event);
|
||||
void OnBackward(wxCommandEvent & event);
|
||||
void OnClose(wxCommandEvent & event);
|
||||
void OnKeyDown(wxKeyEvent & event);
|
||||
|
||||
void UpdateButtons();
|
||||
//void SetLabel(const wxString& label) override;
|
||||
|
||||
|
||||
HtmlWindow * mpHtml;
|
||||
bool mDismissed{};
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // __AUDACITY_LINKINGHTMLWINDOW__
|
@ -440,7 +440,6 @@
|
||||
<ClCompile Include="..\..\..\src\widgets\HtmlWindow.cpp" />
|
||||
<ClCompile Include="..\..\..\src\widgets\ImageRoll.cpp" />
|
||||
<ClCompile Include="..\..\..\src\widgets\KeyView.cpp" />
|
||||
<ClCompile Include="..\..\..\src\widgets\LinkingHtmlWindow.cpp" />
|
||||
<ClCompile Include="..\..\..\src\widgets\Meter.cpp" />
|
||||
<ClCompile Include="..\..\..\src\widgets\MeterPanelBase.cpp" />
|
||||
<ClCompile Include="..\..\..\src\widgets\MultiDialog.cpp" />
|
||||
@ -837,7 +836,6 @@
|
||||
<ClInclude Include="..\..\..\src\widgets\HtmlWindow.h" />
|
||||
<ClInclude Include="..\..\..\src\widgets\ImageRoll.h" />
|
||||
<ClInclude Include="..\..\..\src\widgets\KeyView.h" />
|
||||
<ClInclude Include="..\..\..\src\widgets\LinkingHtmlWindow.h" />
|
||||
<ClInclude Include="..\..\..\src\widgets\Meter.h" />
|
||||
<ClInclude Include="..\..\..\src\widgets\MeterPanelBase.h" />
|
||||
<ClInclude Include="..\..\..\src\widgets\MultiDialog.h" />
|
||||
|
@ -680,9 +680,6 @@
|
||||
<ClCompile Include="..\..\..\src\widgets\KeyView.cpp">
|
||||
<Filter>src\widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\widgets\LinkingHtmlWindow.cpp">
|
||||
<Filter>src\widgets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\widgets\Meter.cpp">
|
||||
<Filter>src\widgets</Filter>
|
||||
</ClCompile>
|
||||
@ -1828,9 +1825,6 @@
|
||||
<ClInclude Include="..\..\..\src\widgets\KeyView.h">
|
||||
<Filter>src\widgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\widgets\LinkingHtmlWindow.h">
|
||||
<Filter>src\widgets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\widgets\Meter.h">
|
||||
<Filter>src\widgets</Filter>
|
||||
</ClInclude>
|
||||
|
Loading…
x
Reference in New Issue
Block a user