From 154d7472e752a8a215a8260666e3085375f036dd Mon Sep 17 00:00:00 2001 From: Paul Gilman Date: Mon, 8 Dec 2025 16:31:31 -0800 Subject: [PATCH 1/8] Initial implementation * Use native web browser to display Help * Use `wxHtmlWindow` to display version information regardless of platform --- src/main.cpp | 17 +++++++------ src/main_add.h | 69 +++++++++++++------------------------------------- 2 files changed, 27 insertions(+), 59 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6f5200354..b32293138 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -137,8 +137,7 @@ enum { __idFirst = wxID_HIGHEST+592, BEGIN_EVENT_TABLE( MainWindow, wxFrame ) EVT_CLOSE( MainWindow::OnClose ) - EVT_MENU( wxID_ABOUT, MainWindow::OnCommand ) - EVT_MENU( wxID_HELP, MainWindow::OnCommand ) + //EVT_MENU( wxID_HELP, MainWindow::OnCommand ) EVT_MENU( ID_SAVE_HOURLY, MainWindow::OnCommand ) EVT_MENU( ID_IMPORT_CASES, MainWindow::OnCommand ) EVT_MENU( wxID_NEW, MainWindow::OnCommand ) @@ -156,6 +155,7 @@ BEGIN_EVENT_TABLE( MainWindow, wxFrame ) EVT_BUTTON(ID_MAIN_MENU, MainWindow::OnCommand) EVT_LISTBOX( ID_CASE_TABS, MainWindow::OnCaseTabChange ) EVT_BUTTON( ID_CASE_TABS, MainWindow::OnCaseTabButton ) + EVT_BUTTON(wxID_ABOUT, MainWindow::OnCommand) EVT_BUTTON( wxID_HELP, MainWindow::OnCommand ) EVT_BUTTON( ID_PAGE_NOTES, MainWindow::OnCommand ) EVT_MENU_RANGE( __idCaseMenuFirst, __idCaseMenuLast, MainWindow::OnCaseMenu ) @@ -238,7 +238,8 @@ MainWindow::MainWindow() tools->Add( metbut = new wxMetroButton( m_caseTabPanel, ID_PAGE_NOTES, wxEmptyString, wxBITMAP_PNG_FROM_DATA( notes_white ), wxDefaultPosition, wxDefaultSize), 0, wxALL|wxEXPAND, 0 ); metbut->SetToolTip( "Add a page note" ); - tools->Add( new wxMetroButton( m_caseTabPanel, wxID_HELP, "Help",/* wxBITMAP_PNG_FROM_DATA(qmark) */ wxNullBitmap, wxDefaultPosition, wxDefaultSize), 0, wxALL|wxEXPAND, 0 ); + tools->Add(new wxMetroButton(m_caseTabPanel, wxID_ABOUT, "About",wxNullBitmap, wxDefaultPosition, wxDefaultSize), 0, wxALL | wxEXPAND, 0); + tools->Add( new wxMetroButton( m_caseTabPanel, wxID_HELP, "Help",/*wxBITMAP_PNG_FROM_DATA(qmark)*/ wxNullBitmap, wxDefaultPosition, wxDefaultSize), 0, wxALL | wxEXPAND, 0); m_caseNotebook = new wxSimplebook( m_caseTabPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE ); @@ -2466,15 +2467,15 @@ void SamApp::ShowHelp( const wxString &context ) wxFileName fn( SamApp::GetRuntimePath() + "/help/html/" ); fn.MakeAbsolute(); url = "file:///" + fn.GetFullPath( wxPATH_NATIVE ) + "index.html"; -#ifdef __WXGTK__ +//#ifdef __WXGTK__ if ( ! context.IsEmpty() ) url = "file:///" + fn.GetFullPath( wxPATH_NATIVE ) + context + ".html"; wxLaunchDefaultBrowser( url ); return; -#else - if ( ! context.IsEmpty() ) - url += "?" + context + ".html"; -#endif +//#else +// if ( ! context.IsEmpty() ) +// url += "?" + context + ".html"; +//#endif } wxWindow *modal_active = 0; diff --git a/src/main_add.h b/src/main_add.h index 5d4005b65..181c828aa 100644 --- a/src/main_add.h +++ b/src/main_add.h @@ -473,37 +473,21 @@ extern void RegisterReportObjectTypes(); class HelpWin : public wxFrame { -#if defined(__WXMSW__)||defined(__WXOSX__) - wxWebView *m_webView; -#else wxHtmlWindow *m_htmlView; -#endif wxString m_aboutHtml; public: HelpWin( wxWindow *parent ) - : wxFrame(parent, wxID_ANY, "System Advisor Model (Open Source) Help", wxDefaultPosition, wxScaleSize(1000, 600)) + : wxFrame(parent, wxID_ANY, "About System Advisor Model (SAM)", wxDefaultPosition, wxScaleSize(1000, 600)) { CreateAboutHtml(); -#ifdef __WXMSW__ - SetIcon( wxICON( appicon ) ); -#endif SetBackgroundColour( wxMetroTheme::Colour( wxMT_FOREGROUND ) ); -#if defined(__WXMSW__)||defined(__WXOSX__) - m_webView = wxWebView::New( this, ID_BROWSER, ::wxWebViewDefaultURLStr, wxDefaultPosition, wxDefaultSize, - ::wxWebViewBackendDefault, wxBORDER_NONE ); - m_webView->SetPage( m_aboutHtml, "About SAM" ); -#else m_htmlView = new wxHtmlWindow( this, ID_BROWSER ); m_htmlView->SetPage( m_aboutHtml ); -#endif - - wxBoxSizer *tools = new wxBoxSizer( wxHORIZONTAL ); -//#if defined(__WXMSW__)||defined(__WXOSX__) -// tools->Add( new wxMetroButton( this, ID_BACK, "Back" ), 0, wxALL|wxEXPAND, 0 ); -//#endif + /* + wxBoxSizer* tools = new wxBoxSizer(wxHORIZONTAL); tools->Add( new wxMetroButton( this, ID_HOME, "Home" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_WEBSITE, "Web site" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_FORUM, "Forum" ), 0, wxALL|wxEXPAND, 0 ); @@ -513,14 +497,10 @@ class HelpWin : public wxFrame tools->AddStretchSpacer(); tools->Add( new wxMetroButton( this, wxID_ABOUT, "About" ), 0, wxALL|wxEXPAND, 0 ); tools->Add( new wxMetroButton( this, wxID_CLOSE, "Close" ), 0, wxALL|wxEXPAND, 0 ); - + */ wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); - sizer->Add( tools, 0, wxALL|wxEXPAND, 0 ); -#if defined(__WXMSW__)||defined(__WXOSX__) - sizer->Add( m_webView, 1, wxALL|wxEXPAND, 0 ); -#else + //sizer->Add( tools, 0, wxALL|wxEXPAND, 0 ); sizer->Add( m_htmlView, 1, wxALL|wxEXPAND, 0 ); -#endif SetSizer( sizer ); } @@ -537,31 +517,25 @@ class HelpWin : public wxFrame patchStr.Printf( ", updated to revision %d", patch ); // int nbit = (sizeof(void*) == 8) ? 64 : 32; - m_aboutHtml = "" - "System Advisor Model (Open Source)

" - "BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/SAM/blob/develop/LICENSE
All rights reserved.
" - - "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met :

" - - "1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

" - - "2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and /or other materials provided with the distribution.

" - - "3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

" - - "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - "

"; + m_aboutHtml = "" + "

System Advisor Model (SAM)

" + "

Open Source Build

" + "

BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/SAM/blob/develop/LICENSE.

" + "

All rights reserved.

" + "

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

" + "
    " + "
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. " + "
  3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  4. " + "
  5. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  6. " + "
" + "

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

" + ""; } void LoadPage( wxString url ) { if ( url == ":about" ) { -#if defined(__WXMSW__)||defined(__WXOSX__) - m_webView->SetPage( m_aboutHtml, "About SAM" ); -#else m_htmlView->SetPage( m_aboutHtml ); -#endif - return; } else if ( url == ":release_notes" ) @@ -585,11 +559,7 @@ class HelpWin : public wxFrame else if ( url == ":website" ) url = SamApp::WebApi( "website" ); -#if defined(__WXMSW__)||defined(__WXOSX__) - m_webView->LoadURL( url ); -#else wxLaunchDefaultBrowser( url ); -#endif } @@ -604,9 +574,6 @@ class HelpWin : public wxFrame switch( evt.GetId() ) { case ID_BACK: -#if defined(__WXMSW__)||defined(__WXOSX__) - if ( m_webView->CanGoBack() ) m_webView->GoBack(); -#endif break; case ID_WEBSITE: LoadPage( ":website" ); From 4107c86d2c2f8a0a6c4267dd55ee7bd6f41c844a Mon Sep 17 00:00:00 2001 From: Paul Gilman Date: Wed, 10 Dec 2025 09:43:21 -0800 Subject: [PATCH 2/8] Move HelpWin to main.cpp --- src/main.cpp | 142 +++++++++++++++++++++++++++++++++++++++++++++++++ src/main.h | 1 + src/main_add.h | 44 ++++++++++++--- 3 files changed, 179 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b32293138..d929c433c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2457,6 +2457,148 @@ wxArrayString SamApp::RecentFiles() return files; } +class HelpWin : public wxFrame +{ + wxHtmlWindow* m_htmlView; + + wxString m_aboutHtml; +public: + HelpWin(wxWindow* parent) + : wxFrame(parent, wxID_ANY, "About System Advisor Model (SAM)", wxDefaultPosition, wxScaleSize(1000, 600)) + { + CreateAboutHtml(); + + SetBackgroundColour(wxMetroTheme::Colour(wxMT_FOREGROUND)); + + m_htmlView = new wxHtmlWindow(this, ID_BROWSER); + m_htmlView->SetPage(m_aboutHtml); + + wxBoxSizer* tools = new wxBoxSizer(wxHORIZONTAL); +// tools->Add( new wxMetroButton( this, ID_HOME, "Home" ), 0, wxALL|wxEXPAND, 0 ); +// tools->Add( new wxMetroButton( this, ID_WEBSITE, "Web site" ), 0, wxALL|wxEXPAND, 0 ); +// tools->Add( new wxMetroButton( this, ID_FORUM, "Forum" ), 0, wxALL|wxEXPAND, 0 ); +// tools->Add( new wxMetroButton( this, ID_EMAIL_SUPPORT, "Email support" ), 0, wxALL|wxEXPAND, 0 ); + tools->AddStretchSpacer(); + tools->Add( new wxMetroButton( this, ID_RELEASE_NOTES, "Release Notes" ), 0, wxALL|wxEXPAND, 0 ); +// tools->Add( new wxMetroButton( this, ID_SCRIPT_REFERENCE, "Scripting reference" ), 0, wxALL|wxEXPAND, 0 ); +// tools->Add( new wxMetroButton( this, wxID_ABOUT, "About" ), 0, wxALL|wxEXPAND, 0 ); +// tools->Add( new wxMetroButton( this, wxID_CLOSE, "Close" ), 0, wxALL|wxEXPAND, 0 ); + + wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add( tools, 0, wxALL|wxEXPAND, 0 ); + sizer->Add(m_htmlView, 1, wxALL | wxEXPAND, 0); + SetSizer(sizer); + } + + void CreateAboutHtml() + { + m_aboutHtml = SamApp::AboutSAM(); + } + + void LoadPage(wxString url) + { + if (url == ":about") + { + m_htmlView->SetPage(m_aboutHtml); + return; + } + else if (url == ":release_notes") + { + url = SamApp::WebApi("release_notes"); + } + else if (url == ":email_support") + { + wxLaunchDefaultBrowser(SamApp::WebApi("support_email")); + return; + } + else if (url == ":script_ref") + { + wxFileName file(SamApp::GetRuntimePath() + "/help/lk_guide.pdf"); + file.Normalize(); + wxLaunchDefaultBrowser(file.GetFullPath()); + return; + } + else if (url == ":forum") + url = SamApp::WebApi("website") + "/forum.html"; + else if (url == ":website") + url = SamApp::WebApi("website"); + + wxLaunchDefaultBrowser(url); + } + + + void OnClose(wxCloseEvent& evt) + { + Hide(); + evt.Veto(); + } + + void OnCommand(wxCommandEvent& evt) + { + switch (evt.GetId()) + { + case ID_BACK: + break; + case ID_WEBSITE: + LoadPage(":website"); + break; + case ID_FORUM: + LoadPage(":forum"); + break; + case ID_EMAIL_SUPPORT: + LoadPage(":email_support"); + break; + case ID_RELEASE_NOTES: + LoadPage(":release_notes"); + break; + case ID_SCRIPT_REFERENCE: + LoadPage(":script_ref"); + break; + case ID_HOME: + { + wxFileName fn(SamApp::GetRuntimePath() + "/help/html/index.html"); + fn.MakeAbsolute(); + LoadPage("file:///" + fn.GetFullPath()); + } + break; + case wxID_ABOUT: + LoadPage(":about"); + break; + case wxID_CLOSE: + Close(); + break; + } + } + +#if defined(__WXMSW__)||defined(__WXOSX__) + void OnNewWindow(wxWebViewEvent& evt) + { + wxLaunchDefaultBrowser(evt.GetURL()); + } +#endif + + DECLARE_EVENT_TABLE(); +}; + +BEGIN_EVENT_TABLE(HelpWin, wxFrame) +EVT_BUTTON(ID_BACK, HelpWin::OnCommand) +EVT_BUTTON(ID_HOME, HelpWin::OnCommand) +EVT_BUTTON(ID_WEBSITE, HelpWin::OnCommand) +EVT_BUTTON(ID_FORUM, HelpWin::OnCommand) +EVT_BUTTON(ID_RELEASE_NOTES, HelpWin::OnCommand) +EVT_BUTTON(ID_SCRIPT_REFERENCE, HelpWin::OnCommand) +EVT_BUTTON(ID_EMAIL_SUPPORT, HelpWin::OnCommand) +EVT_BUTTON(wxID_CLOSE, HelpWin::OnCommand) +EVT_BUTTON(wxID_ABOUT, HelpWin::OnCommand) +#if defined(__WXMSW__)||defined(__WXOSX__) +EVT_WEBVIEW_NEWWINDOW(ID_BROWSER, HelpWin::OnNewWindow) +#endif +EVT_CLOSE(HelpWin::OnClose) +END_EVENT_TABLE() + +class HelpWin; +static HelpWin* gs_helpWin = 0; + void SamApp::ShowHelp( const wxString &context ) { wxString url; diff --git a/src/main.h b/src/main.h index 50dfdf640..e86d54187 100644 --- a/src/main.h +++ b/src/main.h @@ -375,6 +375,7 @@ class SamApp : public wxApp static wxFileHistory &FileHistory(); static wxArrayString RecentFiles(); static void ShowHelp( const wxString &context = wxEmptyString ); + static wxString AboutSAM(); static wxString VersionStr( bool with_patches = false, bool short_style = false ); static int VersionMajor(); static int VersionMinor(); diff --git a/src/main_add.h b/src/main_add.h index 181c828aa..602c0e9e3 100644 --- a/src/main_add.h +++ b/src/main_add.h @@ -470,7 +470,7 @@ extern void RegisterReportObjectTypes(); } - +/* class HelpWin : public wxFrame { wxHtmlWindow *m_htmlView; @@ -486,18 +486,18 @@ class HelpWin : public wxFrame m_htmlView = new wxHtmlWindow( this, ID_BROWSER ); m_htmlView->SetPage( m_aboutHtml ); - /* - wxBoxSizer* tools = new wxBoxSizer(wxHORIZONTAL); - tools->Add( new wxMetroButton( this, ID_HOME, "Home" ), 0, wxALL|wxEXPAND, 0 ); + +//// wxBoxSizer* tools = new wxBoxSizer(wxHORIZONTAL); +//// tools->Add( new wxMetroButton( this, ID_HOME, "Home" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_WEBSITE, "Web site" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_FORUM, "Forum" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_EMAIL_SUPPORT, "Email support" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_RELEASE_NOTES, "Release notes" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_SCRIPT_REFERENCE, "Scripting reference" ), 0, wxALL|wxEXPAND, 0 ); - tools->AddStretchSpacer(); - tools->Add( new wxMetroButton( this, wxID_ABOUT, "About" ), 0, wxALL|wxEXPAND, 0 ); - tools->Add( new wxMetroButton( this, wxID_CLOSE, "Close" ), 0, wxALL|wxEXPAND, 0 ); - */ +//// tools->AddStretchSpacer(); +//// tools->Add( new wxMetroButton( this, wxID_ABOUT, "About" ), 0, wxALL|wxEXPAND, 0 ); +//// tools->Add( new wxMetroButton( this, wxID_CLOSE, "Close" ), 0, wxALL|wxEXPAND, 0 ); + wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); //sizer->Add( tools, 0, wxALL|wxEXPAND, 0 ); sizer->Add( m_htmlView, 1, wxALL|wxEXPAND, 0 ); @@ -635,3 +635,31 @@ END_EVENT_TABLE() class HelpWin; static HelpWin* gs_helpWin = 0; +*/ +wxString SamApp::AboutSAM() +{ + + wxString proxy(wxEasyCurl::GetProxyForURL(SamApp::WebApi("website"))); + if (proxy.IsEmpty()) proxy = "default"; + else proxy = "proxy: " + proxy; + + int patch = SamApp::RevisionNumber(); + wxString patchStr; + if (patch > 0) + patchStr.Printf(", updated to revision %d", patch); + + // int nbit = (sizeof(void*) == 8) ? 64 : 32; + return "" + "

System Advisor Model (SAM)

" + "

Open Source Build

" + "

BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/SAM/blob/develop/LICENSE.

" + "

All rights reserved.

" + "

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

" + "
    " + "
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. " + "
  3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  4. " + "
  5. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  6. " + "
" + "

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

" + ""; +} From 7e0614123f49e11e968c34bd1c45f1e19e3f2b5d Mon Sep 17 00:00:00 2001 From: Paul Gilman Date: Thu, 11 Dec 2025 13:49:19 -0800 Subject: [PATCH 3/8] Updates for macOS tests --- src/main.cpp | 115 ++++++++++++++++++++++++--------------------------- 1 file changed, 55 insertions(+), 60 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d929c433c..a3d9c87c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2479,7 +2479,7 @@ class HelpWin : public wxFrame // tools->Add( new wxMetroButton( this, ID_FORUM, "Forum" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_EMAIL_SUPPORT, "Email support" ), 0, wxALL|wxEXPAND, 0 ); tools->AddStretchSpacer(); - tools->Add( new wxMetroButton( this, ID_RELEASE_NOTES, "Release Notes" ), 0, wxALL|wxEXPAND, 0 ); + tools->Add( new wxMetroButton( this, ID_RELEASE_NOTES, "Open NLR release notes..." ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, ID_SCRIPT_REFERENCE, "Scripting reference" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, wxID_ABOUT, "About" ), 0, wxALL|wxEXPAND, 0 ); // tools->Add( new wxMetroButton( this, wxID_CLOSE, "Close" ), 0, wxALL|wxEXPAND, 0 ); @@ -2500,9 +2500,9 @@ class HelpWin : public wxFrame if (url == ":about") { m_htmlView->SetPage(m_aboutHtml); - return; + //return; } - else if (url == ":release_notes") + /*else if (url == ":release_notes") { url = SamApp::WebApi("release_notes"); } @@ -2523,7 +2523,7 @@ class HelpWin : public wxFrame else if (url == ":website") url = SamApp::WebApi("website"); - wxLaunchDefaultBrowser(url); + wxLaunchDefaultBrowser(url);*/ } @@ -2599,67 +2599,62 @@ END_EVENT_TABLE() class HelpWin; static HelpWin* gs_helpWin = 0; -void SamApp::ShowHelp( const wxString &context ) -{ - wxString url; - if ( context.Left(1) == ":" ) - url = context; // for things like :about, etc - else +void SamApp::ShowHelp( const wxString &help_context ) +{ + wxString url; + url = help_context; + if ( url.Left(1) == ":" ) // display things like :about in custom window + { + wxWindow *modal_active = 0; + wxWindow *nonmodal_tlw = 0; + for( wxWindowList::iterator wl = wxTopLevelWindows.begin(); wl != wxTopLevelWindows.end(); ++wl ) + { + wxTopLevelWindow *tlw = dynamic_cast( *wl ); + wxDialog *dia = dynamic_cast( *wl ); + + if ( tlw != 0 && (dia == 0 || !dia->IsModal()) ) + nonmodal_tlw = tlw; + + if ( dia != 0 && dia->IsActive() && dia->IsModal() ) + modal_active = dia; + } + + // try several different parent windows for the help window + // if possible, use the SAM main window + // otherwise, choose any top level window that is not modal + // last resort, choose a currently modal dialog box + wxWindow *parent = SamApp::Window(); + if ( !parent ) parent = nonmodal_tlw; + if ( !parent ) parent = modal_active; + + if ( modal_active && gs_helpWin != 0 && gs_helpWin->IsShown() ) + { + wxRect h_rect = gs_helpWin->GetRect(); + + if (gs_helpWin->Destroy()) + { + gs_helpWin = new HelpWin( parent ); + gs_helpWin->SetSize(h_rect); + } + } + else if ( 0 == gs_helpWin ) + gs_helpWin = new HelpWin( parent ); + + gs_helpWin->Show( ); + gs_helpWin->LoadPage( url ); + gs_helpWin->Raise(); + } + else // display help topics in default browser { wxFileName fn( SamApp::GetRuntimePath() + "/help/html/" ); fn.MakeAbsolute(); - url = "file:///" + fn.GetFullPath( wxPATH_NATIVE ) + "index.html"; -//#ifdef __WXGTK__ - if ( ! context.IsEmpty() ) - url = "file:///" + fn.GetFullPath( wxPATH_NATIVE ) + context + ".html"; - wxLaunchDefaultBrowser( url ); - return; -//#else -// if ( ! context.IsEmpty() ) -// url += "?" + context + ".html"; -//#endif - } - - wxWindow *modal_active = 0; - wxWindow *nonmodal_tlw = 0; - for( wxWindowList::iterator wl = wxTopLevelWindows.begin(); - wl != wxTopLevelWindows.end(); - ++wl ) - { - wxTopLevelWindow *tlw = dynamic_cast( *wl ); - wxDialog *dia = dynamic_cast( *wl ); - - if ( tlw != 0 && (dia == 0 || !dia->IsModal()) ) - nonmodal_tlw = tlw; - - if ( dia != 0 && dia->IsActive() && dia->IsModal() ) - modal_active = dia; - } - - // try several different parent windows for the help window - // if possible, use the SAM main window - // otherwise, choose any top level window that is not modal - // last resort, choose a currently modal dialog box - wxWindow *parent = SamApp::Window(); - if ( !parent ) parent = nonmodal_tlw; - if ( !parent ) parent = modal_active; - - if ( modal_active && gs_helpWin != 0 && gs_helpWin->IsShown() ) - { - wxRect h_rect = gs_helpWin->GetRect(); - - if (gs_helpWin->Destroy()) - { - gs_helpWin = new HelpWin( parent ); - gs_helpWin->SetSize(h_rect); - } + if ( help_context.IsEmpty() ) + url = "file:///" + fn.GetFullPath( wxPATH_NATIVE ) + "index.html"; + else + url = "file:///" + fn.GetFullPath( wxPATH_NATIVE ) + help_context + ".html"; + wxLaunchDefaultBrowser( url ); } - else if ( 0 == gs_helpWin ) - gs_helpWin = new HelpWin( parent ); - gs_helpWin->Show( ); - gs_helpWin->LoadPage( url ); - gs_helpWin->Raise(); } int SamApp::RevisionNumber() From 39f84aa23d49ccd43f709b1162b2d3a397357d82 Mon Sep 17 00:00:00 2001 From: Paul Gilman Date: Thu, 11 Dec 2025 13:54:56 -0800 Subject: [PATCH 4/8] Restore SAM icon to help window --- src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index a3d9c87c1..9d0a6a030 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2468,6 +2468,10 @@ class HelpWin : public wxFrame { CreateAboutHtml(); +#ifdef __WXMSW__ + SetIcon(wxICON(appicon)); +#endif + SetBackgroundColour(wxMetroTheme::Colour(wxMT_FOREGROUND)); m_htmlView = new wxHtmlWindow(this, ID_BROWSER); From 15f34663e86f89aaee2054ff077886337c24529b Mon Sep 17 00:00:00 2001 From: Paul Gilman Date: Thu, 11 Dec 2025 14:52:33 -0800 Subject: [PATCH 5/8] Clean up code for removed Help window buttons --- src/main.cpp | 55 ++++++++++++++++++++++++++++++-------------------- src/main_add.h | 2 +- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9d0a6a030..1e87849f8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,13 +106,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. static PythonConfig pythonConfig; - enum { __idFirst = wxID_HIGHEST+592, - ID_MAIN_MENU, ID_CASE_TABS, ID_PAGE_NOTES, - ID_CASE_CREATE, ID_RUN_ALL_CASES, ID_SAVE_HOURLY, + ID_MAIN_MENU, + ID_CASE_TABS, + ID_PAGE_NOTES, + ID_RELEASE_NOTES, + ID_BROWSER, + ID_CASE_CREATE, + ID_RUN_ALL_CASES, + ID_SAVE_HOURLY, ID_IMPORT_CASES, - ID_NEW_SCRIPT, ID_OPEN_SCRIPT, ID_BROWSE_INPUTS, + ID_NEW_SCRIPT, + ID_OPEN_SCRIPT, + ID_BROWSE_INPUTS, __idCaseMenuFirst, ID_CASE_CONFIG, ID_CASE_RENAME, @@ -2506,11 +2513,15 @@ class HelpWin : public wxFrame m_htmlView->SetPage(m_aboutHtml); //return; } - /*else if (url == ":release_notes") + else if (url == ":release_notes") { - url = SamApp::WebApi("release_notes"); + wxLaunchDefaultBrowser(SamApp::WebApi("release_notes")); } - else if (url == ":email_support") + else + { + wxLaunchDefaultBrowser(url); + } + /*else if (url == ":email_support") { wxLaunchDefaultBrowser(SamApp::WebApi("support_email")); return; @@ -2541,7 +2552,7 @@ class HelpWin : public wxFrame { switch (evt.GetId()) { - case ID_BACK: + /*case ID_BACK: break; case ID_WEBSITE: LoadPage(":website"); @@ -2551,11 +2562,11 @@ class HelpWin : public wxFrame break; case ID_EMAIL_SUPPORT: LoadPage(":email_support"); - break; + break;*/ case ID_RELEASE_NOTES: LoadPage(":release_notes"); break; - case ID_SCRIPT_REFERENCE: + /*case ID_SCRIPT_REFERENCE: LoadPage(":script_ref"); break; case ID_HOME: @@ -2570,7 +2581,7 @@ class HelpWin : public wxFrame break; case wxID_CLOSE: Close(); - break; + break;*/ } } @@ -2585,18 +2596,18 @@ class HelpWin : public wxFrame }; BEGIN_EVENT_TABLE(HelpWin, wxFrame) -EVT_BUTTON(ID_BACK, HelpWin::OnCommand) -EVT_BUTTON(ID_HOME, HelpWin::OnCommand) -EVT_BUTTON(ID_WEBSITE, HelpWin::OnCommand) -EVT_BUTTON(ID_FORUM, HelpWin::OnCommand) +//EVT_BUTTON(ID_BACK, HelpWin::OnCommand) +//EVT_BUTTON(ID_HOME, HelpWin::OnCommand) +//EVT_BUTTON(ID_WEBSITE, HelpWin::OnCommand) +//EVT_BUTTON(ID_FORUM, HelpWin::OnCommand) EVT_BUTTON(ID_RELEASE_NOTES, HelpWin::OnCommand) -EVT_BUTTON(ID_SCRIPT_REFERENCE, HelpWin::OnCommand) -EVT_BUTTON(ID_EMAIL_SUPPORT, HelpWin::OnCommand) -EVT_BUTTON(wxID_CLOSE, HelpWin::OnCommand) -EVT_BUTTON(wxID_ABOUT, HelpWin::OnCommand) -#if defined(__WXMSW__)||defined(__WXOSX__) -EVT_WEBVIEW_NEWWINDOW(ID_BROWSER, HelpWin::OnNewWindow) -#endif +//EVT_BUTTON(ID_SCRIPT_REFERENCE, HelpWin::OnCommand) +//EVT_BUTTON(ID_EMAIL_SUPPORT, HelpWin::OnCommand) +//EVT_BUTTON(wxID_CLOSE, HelpWin::OnCommand) +//EVT_BUTTON(wxID_ABOUT, HelpWin::OnCommand) +//#if defined(__WXMSW__)||defined(__WXOSX__) +//EVT_WEBVIEW_NEWWINDOW(ID_BROWSER, HelpWin::OnNewWindow) +//#endif EVT_CLOSE(HelpWin::OnClose) END_EVENT_TABLE() diff --git a/src/main_add.h b/src/main_add.h index 602c0e9e3..ff34dea01 100644 --- a/src/main_add.h +++ b/src/main_add.h @@ -67,7 +67,7 @@ void ShowIDEWindow() -enum { ID_BACK = wxID_HIGHEST + 439, ID_BROWSER, ID_HOME, ID_EMAIL_SUPPORT, ID_WEBSITE, ID_FORUM, ID_RELEASE_NOTES, ID_SCRIPT_REFERENCE }; +//enum { ID_BACK = wxID_HIGHEST + 439, ID_BROWSER, ID_HOME, ID_EMAIL_SUPPORT, ID_WEBSITE, ID_FORUM, ID_RELEASE_NOTES, ID_SCRIPT_REFERENCE }; static SamApp::ver releases[] = { From 1fac79c652b4b7e36fd43f04a0409987d29dd111 Mon Sep 17 00:00:00 2001 From: Paul Gilman Date: Fri, 12 Dec 2025 08:26:32 -0800 Subject: [PATCH 6/8] Remove unused webview references --- src/main.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1e87849f8..2d191cb37 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,12 +38,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#if defined(__WXMSW__)||defined(__WXOSX__) -#include -#else -#include // for linux - avoid webkitgtk dependencies -#endif +//#if defined(__WXMSW__)||defined(__WXOSX__) +//#include +//#else +//#include // for linux - avoid webkitgtk dependencies +//#endif +#include #include #include #include @@ -53,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include +//#include #include #include #include @@ -2584,14 +2585,14 @@ class HelpWin : public wxFrame break;*/ } } - +/* #if defined(__WXMSW__)||defined(__WXOSX__) void OnNewWindow(wxWebViewEvent& evt) { wxLaunchDefaultBrowser(evt.GetURL()); } #endif - +*/ DECLARE_EVENT_TABLE(); }; From cb0f1697192726694e7ba547ba14595902185777 Mon Sep 17 00:00:00 2001 From: Paul Gilman Date: Fri, 12 Dec 2025 09:49:16 -0800 Subject: [PATCH 7/8] Delete commented code --- src/main.cpp | 74 +--------------------- src/main_add.h | 168 ------------------------------------------------- 2 files changed, 1 insertion(+), 241 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2d191cb37..1ed360cbb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -145,7 +145,6 @@ enum { __idFirst = wxID_HIGHEST+592, BEGIN_EVENT_TABLE( MainWindow, wxFrame ) EVT_CLOSE( MainWindow::OnClose ) - //EVT_MENU( wxID_HELP, MainWindow::OnCommand ) EVT_MENU( ID_SAVE_HOURLY, MainWindow::OnCommand ) EVT_MENU( ID_IMPORT_CASES, MainWindow::OnCommand ) EVT_MENU( wxID_NEW, MainWindow::OnCommand ) @@ -2486,15 +2485,8 @@ class HelpWin : public wxFrame m_htmlView->SetPage(m_aboutHtml); wxBoxSizer* tools = new wxBoxSizer(wxHORIZONTAL); -// tools->Add( new wxMetroButton( this, ID_HOME, "Home" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_WEBSITE, "Web site" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_FORUM, "Forum" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_EMAIL_SUPPORT, "Email support" ), 0, wxALL|wxEXPAND, 0 ); tools->AddStretchSpacer(); tools->Add( new wxMetroButton( this, ID_RELEASE_NOTES, "Open NLR release notes..." ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_SCRIPT_REFERENCE, "Scripting reference" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, wxID_ABOUT, "About" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, wxID_CLOSE, "Close" ), 0, wxALL|wxEXPAND, 0 ); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); sizer->Add( tools, 0, wxALL|wxEXPAND, 0 ); @@ -2512,7 +2504,6 @@ class HelpWin : public wxFrame if (url == ":about") { m_htmlView->SetPage(m_aboutHtml); - //return; } else if (url == ":release_notes") { @@ -2522,24 +2513,6 @@ class HelpWin : public wxFrame { wxLaunchDefaultBrowser(url); } - /*else if (url == ":email_support") - { - wxLaunchDefaultBrowser(SamApp::WebApi("support_email")); - return; - } - else if (url == ":script_ref") - { - wxFileName file(SamApp::GetRuntimePath() + "/help/lk_guide.pdf"); - file.Normalize(); - wxLaunchDefaultBrowser(file.GetFullPath()); - return; - } - else if (url == ":forum") - url = SamApp::WebApi("website") + "/forum.html"; - else if (url == ":website") - url = SamApp::WebApi("website"); - - wxLaunchDefaultBrowser(url);*/ } @@ -2553,62 +2526,17 @@ class HelpWin : public wxFrame { switch (evt.GetId()) { - /*case ID_BACK: - break; - case ID_WEBSITE: - LoadPage(":website"); - break; - case ID_FORUM: - LoadPage(":forum"); - break; - case ID_EMAIL_SUPPORT: - LoadPage(":email_support"); - break;*/ case ID_RELEASE_NOTES: LoadPage(":release_notes"); break; - /*case ID_SCRIPT_REFERENCE: - LoadPage(":script_ref"); - break; - case ID_HOME: - { - wxFileName fn(SamApp::GetRuntimePath() + "/help/html/index.html"); - fn.MakeAbsolute(); - LoadPage("file:///" + fn.GetFullPath()); } - break; - case wxID_ABOUT: - LoadPage(":about"); - break; - case wxID_CLOSE: - Close(); - break;*/ - } - } -/* -#if defined(__WXMSW__)||defined(__WXOSX__) - void OnNewWindow(wxWebViewEvent& evt) - { - wxLaunchDefaultBrowser(evt.GetURL()); } -#endif -*/ + DECLARE_EVENT_TABLE(); }; BEGIN_EVENT_TABLE(HelpWin, wxFrame) -//EVT_BUTTON(ID_BACK, HelpWin::OnCommand) -//EVT_BUTTON(ID_HOME, HelpWin::OnCommand) -//EVT_BUTTON(ID_WEBSITE, HelpWin::OnCommand) -//EVT_BUTTON(ID_FORUM, HelpWin::OnCommand) EVT_BUTTON(ID_RELEASE_NOTES, HelpWin::OnCommand) -//EVT_BUTTON(ID_SCRIPT_REFERENCE, HelpWin::OnCommand) -//EVT_BUTTON(ID_EMAIL_SUPPORT, HelpWin::OnCommand) -//EVT_BUTTON(wxID_CLOSE, HelpWin::OnCommand) -//EVT_BUTTON(wxID_ABOUT, HelpWin::OnCommand) -//#if defined(__WXMSW__)||defined(__WXOSX__) -//EVT_WEBVIEW_NEWWINDOW(ID_BROWSER, HelpWin::OnNewWindow) -//#endif EVT_CLOSE(HelpWin::OnClose) END_EVENT_TABLE() diff --git a/src/main_add.h b/src/main_add.h index ff34dea01..0acfd0f0b 100644 --- a/src/main_add.h +++ b/src/main_add.h @@ -39,7 +39,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "uiobjects.h" #include #include -#include #include #include @@ -469,173 +468,6 @@ extern void RegisterReportObjectTypes(); return true; } - -/* -class HelpWin : public wxFrame -{ - wxHtmlWindow *m_htmlView; - - wxString m_aboutHtml; -public: - HelpWin( wxWindow *parent ) - : wxFrame(parent, wxID_ANY, "About System Advisor Model (SAM)", wxDefaultPosition, wxScaleSize(1000, 600)) - { - CreateAboutHtml(); - - SetBackgroundColour( wxMetroTheme::Colour( wxMT_FOREGROUND ) ); - - m_htmlView = new wxHtmlWindow( this, ID_BROWSER ); - m_htmlView->SetPage( m_aboutHtml ); - -//// wxBoxSizer* tools = new wxBoxSizer(wxHORIZONTAL); -//// tools->Add( new wxMetroButton( this, ID_HOME, "Home" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_WEBSITE, "Web site" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_FORUM, "Forum" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_EMAIL_SUPPORT, "Email support" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_RELEASE_NOTES, "Release notes" ), 0, wxALL|wxEXPAND, 0 ); -// tools->Add( new wxMetroButton( this, ID_SCRIPT_REFERENCE, "Scripting reference" ), 0, wxALL|wxEXPAND, 0 ); -//// tools->AddStretchSpacer(); -//// tools->Add( new wxMetroButton( this, wxID_ABOUT, "About" ), 0, wxALL|wxEXPAND, 0 ); -//// tools->Add( new wxMetroButton( this, wxID_CLOSE, "Close" ), 0, wxALL|wxEXPAND, 0 ); - - wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL ); - //sizer->Add( tools, 0, wxALL|wxEXPAND, 0 ); - sizer->Add( m_htmlView, 1, wxALL|wxEXPAND, 0 ); - SetSizer( sizer ); - } - - void CreateAboutHtml() - { - - wxString proxy( wxEasyCurl::GetProxyForURL( SamApp::WebApi("website") )); - if ( proxy.IsEmpty() ) proxy = "default"; - else proxy = "proxy: " + proxy; - - int patch = SamApp::RevisionNumber(); - wxString patchStr; - if ( patch > 0 ) - patchStr.Printf( ", updated to revision %d", patch ); - - // int nbit = (sizeof(void*) == 8) ? 64 : 32; - m_aboutHtml = "" - "

System Advisor Model (SAM)

" - "

Open Source Build

" - "

BSD 3-Clause License

Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/NREL/SAM/blob/develop/LICENSE.

" - "

All rights reserved.

" - "

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

" - "
    " - "
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. " - "
  3. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  4. " - "
  5. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  6. " - "
" - "

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

" - ""; - } - void LoadPage( wxString url ) - { - if ( url == ":about" ) - { - m_htmlView->SetPage( m_aboutHtml ); - return; - } - else if ( url == ":release_notes" ) - { - url = SamApp::WebApi("release_notes"); - } - else if ( url == ":email_support" ) - { - wxLaunchDefaultBrowser( SamApp::WebApi("support_email") ); - return; - } - else if ( url == ":script_ref" ) - { - wxFileName file( SamApp::GetRuntimePath() + "/help/lk_guide.pdf" ); - file.Normalize(); - wxLaunchDefaultBrowser( file.GetFullPath() ); - return; - } - else if ( url == ":forum" ) - url = SamApp::WebApi( "website" ) + "/forum.html"; - else if ( url == ":website" ) - url = SamApp::WebApi( "website" ); - - wxLaunchDefaultBrowser( url ); - } - - - void OnClose( wxCloseEvent &evt ) - { - Hide(); - evt.Veto(); - } - - void OnCommand( wxCommandEvent &evt ) - { - switch( evt.GetId() ) - { - case ID_BACK: - break; - case ID_WEBSITE: - LoadPage( ":website" ); - break; - case ID_FORUM: - LoadPage( ":forum" ); - break; - case ID_EMAIL_SUPPORT: - LoadPage( ":email_support" ); - break; - case ID_RELEASE_NOTES: - LoadPage( ":release_notes" ); - break; - case ID_SCRIPT_REFERENCE: - LoadPage( ":script_ref" ); - break; - case ID_HOME: - { - wxFileName fn( SamApp::GetRuntimePath() + "/help/html/index.html" ); - fn.MakeAbsolute(); - LoadPage( "file:///" + fn.GetFullPath() ); - } - break; - case wxID_ABOUT: - LoadPage( ":about" ); - break; - case wxID_CLOSE: - Close(); - break; - } - } - -#if defined(__WXMSW__)||defined(__WXOSX__) - void OnNewWindow( wxWebViewEvent &evt ) - { - wxLaunchDefaultBrowser( evt.GetURL() ); - } -#endif - - DECLARE_EVENT_TABLE(); -}; - -BEGIN_EVENT_TABLE( HelpWin, wxFrame ) - EVT_BUTTON( ID_BACK, HelpWin::OnCommand ) - EVT_BUTTON( ID_HOME, HelpWin::OnCommand ) - EVT_BUTTON( ID_WEBSITE, HelpWin::OnCommand ) - EVT_BUTTON( ID_FORUM, HelpWin::OnCommand ) - EVT_BUTTON( ID_RELEASE_NOTES, HelpWin::OnCommand ) - EVT_BUTTON( ID_SCRIPT_REFERENCE, HelpWin::OnCommand ) - EVT_BUTTON( ID_EMAIL_SUPPORT, HelpWin::OnCommand ) - EVT_BUTTON( wxID_CLOSE, HelpWin::OnCommand ) - EVT_BUTTON( wxID_ABOUT, HelpWin::OnCommand ) -#if defined(__WXMSW__)||defined(__WXOSX__) - EVT_WEBVIEW_NEWWINDOW( ID_BROWSER, HelpWin::OnNewWindow ) -#endif - EVT_CLOSE( HelpWin::OnClose ) -END_EVENT_TABLE() - - -class HelpWin; -static HelpWin* gs_helpWin = 0; -*/ wxString SamApp::AboutSAM() { From 6e9e2b18b79138bf68fa33df5a8c0a7edfd54d03 Mon Sep 17 00:00:00 2001 From: Paul Gilman Date: Mon, 15 Dec 2025 08:19:08 -0800 Subject: [PATCH 8/8] Remove commented code --- src/main.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1ed360cbb..5ac862eeb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,18 +32,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include //#include +#include #include #include #include -#include - -//#if defined(__WXMSW__)||defined(__WXOSX__) -//#include -//#else -//#include // for linux - avoid webkitgtk dependencies -//#endif - #include #include #include @@ -54,7 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -//#include #include #include #include @@ -67,7 +59,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include - #include "../resource/menu.cpng" #include "../resource/notes_white.cpng"