Surround uses of wxConfig with #of wxUSE_CONFIG in wxHTML code.
Closes #11750.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63548
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
wxHtmlHelpDialog* GetDialog() { return m_helpDialog; }
wxHtmlHelpFrame* GetFrame() { return m_helpFrame; }
wxHtmlHelpDialog* GetDialog() { return m_helpDialog; }
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
// Assigns config object to the Ctrl. This config is then
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
// Assigns config object to the Ctrl. This config is then
// Ctrl and it's wxHtmlWindow
virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
// Ctrl and it's wxHtmlWindow
virtual void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
virtual void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
//// Backward compatibility with wxHelpController API
//// Backward compatibility with wxHelpController API
wxHtmlHelpData m_helpData;
wxHtmlHelpWindow* m_helpWindow;
wxHtmlHelpData m_helpData;
wxHtmlHelpWindow* m_helpWindow;
wxConfigBase * m_Config;
wxString m_ConfigRoot;
wxConfigBase * m_Config;
wxString m_ConfigRoot;
wxString m_titleFormat;
int m_FrameStyle;
wxHtmlHelpFrame* m_helpFrame;
wxString m_titleFormat;
int m_FrameStyle;
wxHtmlHelpFrame* m_helpFrame;
wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); }
wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID,
const wxString& title = wxEmptyString,
wxHtmlHelpFrame(wxHtmlHelpData* data = NULL) { Init(data); }
wxHtmlHelpFrame(wxWindow* parent, wxWindowID wxWindowID,
const wxString& title = wxEmptyString,
- int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL,
- wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString);
+ int style = wxHF_DEFAULT_STYLE, wxHtmlHelpData* data = NULL
+#if wxUSE_CONFIG
+ , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString
+#endif // wxUSE_CONFIG
+ );
bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString,
bool Create(wxWindow* parent, wxWindowID id, const wxString& title = wxEmptyString,
- int style = wxHF_DEFAULT_STYLE,
- wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString);
+ int style = wxHF_DEFAULT_STYLE
+#if wxUSE_CONFIG
+ , wxConfigBase *config=NULL, const wxString& rootpath = wxEmptyString
+#endif // wxUSE_CONFIG
+ );
virtual ~wxHtmlHelpFrame();
/// Returns the data associated with the window.
virtual ~wxHtmlHelpFrame();
/// Returns the data associated with the window.
// (for title of displayed HTML page)
void SetTitleFormat(const wxString& format);
// (for title of displayed HTML page)
void SetTitleFormat(const wxString& format);
// For compatibility
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
// For compatibility
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString);
// Make the help controller's frame 'modal' if
// needed
// Make the help controller's frame 'modal' if
// needed
bool KeywordSearch(const wxString& keyword,
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
bool KeywordSearch(const wxString& keyword,
wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString)
{
m_Config = config;
void UseConfig(wxConfigBase *config, const wxString& rootpath = wxEmptyString)
{
m_Config = config;
// saved values : things set by SetFonts, SetBorders.
void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
// saved values : things set by SetFonts, SetBorders.
void ReadCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
void WriteCustomization(wxConfigBase *cfg, const wxString& path = wxEmptyString);
// call this to let wxHtmlHelpWindow know page changed
void NotifyPageChanged();
// call this to let wxHtmlHelpWindow know page changed
void NotifyPageChanged();
wxHtmlHelpFrameCfg m_Cfg;
wxHtmlHelpFrameCfg m_Cfg;
wxConfigBase *m_Config;
wxString m_ConfigRoot;
wxConfigBase *m_Config;
wxString m_ConfigRoot;
// pagenumbers of controls in notebook (usually 0,1,2)
int m_ContentsPage;
// pagenumbers of controls in notebook (usually 0,1,2)
int m_ContentsPage;
// when/if we have CSS support we could add other possibilities...)
void SetBackgroundImage(const wxBitmap& bmpBg) { m_bmpBg = bmpBg; }
// when/if we have CSS support we could add other possibilities...)
void SetBackgroundImage(const wxBitmap& bmpBg) { m_bmpBg = bmpBg; }
// Saves custom settings into cfg config. it will use the path 'path'
// if given, otherwise it will save info into currently selected path.
// saved values : things set by SetFonts, SetBorders.
virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
// ...
virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
// Saves custom settings into cfg config. it will use the path 'path'
// if given, otherwise it will save info into currently selected path.
// saved values : things set by SetFonts, SetBorders.
virtual void ReadCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
// ...
virtual void WriteCustomization(wxConfigBase *cfg, wxString path = wxEmptyString);
// Goes to previous/next page (in browsing history)
// Returns true if successful, false otherwise
// Goes to previous/next page (in browsing history)
// Returns true if successful, false otherwise
m_helpWindow = NULL;
m_helpFrame = NULL;
m_helpDialog = NULL;
m_helpWindow = NULL;
m_helpFrame = NULL;
m_helpDialog = NULL;
m_Config = NULL;
m_ConfigRoot = wxEmptyString;
m_Config = NULL;
m_ConfigRoot = wxEmptyString;
m_titleFormat = _("Help: %s");
m_FrameStyle = style;
}
wxHtmlHelpController::~wxHtmlHelpController()
{
m_titleFormat = _("Help: %s");
m_FrameStyle = style;
}
wxHtmlHelpController::~wxHtmlHelpController()
{
if (m_Config)
WriteCustomization(m_Config, m_ConfigRoot);
if (m_Config)
WriteCustomization(m_Config, m_ConfigRoot);
if (m_helpWindow)
DestroyHelpWindow();
}
if (m_helpWindow)
DestroyHelpWindow();
}
void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt)
{
void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt)
{
if (m_Config)
WriteCustomization(m_Config, m_ConfigRoot);
if (m_Config)
WriteCustomization(m_Config, m_ConfigRoot);
{
wxHtmlHelpFrame* frame = new wxHtmlHelpFrame(data);
frame->SetController(this);
{
wxHtmlHelpFrame* frame = new wxHtmlHelpFrame(data);
frame->SetController(this);
- frame->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle, m_Config, m_ConfigRoot);
+ frame->Create(m_parentWindow, -1, wxEmptyString, m_FrameStyle
+#if wxUSE_CONFIG
+ , m_Config, m_ConfigRoot
+#endif // wxUSE_CONFIG
+ );
frame->SetTitleFormat(m_titleFormat);
m_helpFrame = frame;
return frame;
frame->SetTitleFormat(m_titleFormat);
m_helpFrame = frame;
return frame;
if (m_Config == NULL)
{
m_Config = wxConfigBase::Get(false);
if (m_Config != NULL)
m_ConfigRoot = wxT("wxWindows/wxHtmlHelpController");
}
if (m_Config == NULL)
{
m_Config = wxConfigBase::Get(false);
if (m_Config != NULL)
m_ConfigRoot = wxT("wxWindows/wxHtmlHelpController");
}
if (m_FrameStyle & wxHF_DIALOG)
{
if (m_FrameStyle & wxHF_DIALOG)
{
void wxHtmlHelpController::ReadCustomization(wxConfigBase* cfg, const wxString& path)
{
/* should not be called by the user; call UseConfig, and the controller
void wxHtmlHelpController::ReadCustomization(wxConfigBase* cfg, const wxString& path)
{
/* should not be called by the user; call UseConfig, and the controller
if (m_helpWindow) m_helpWindow->UseConfig(config, rootpath);
ReadCustomization(config, rootpath);
}
if (m_helpWindow) m_helpWindow->UseConfig(config, rootpath);
ReadCustomization(config, rootpath);
}
//// Backward compatibility with wxHelpController API
//// Backward compatibility with wxHelpController API
END_EVENT_TABLE()
wxHtmlHelpFrame::wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, const wxString& title,
END_EVENT_TABLE()
wxHtmlHelpFrame::wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, const wxString& title,
- int style, wxHtmlHelpData* data,
- wxConfigBase *config, const wxString& rootpath)
+ int style, wxHtmlHelpData* data
+#if wxUSE_CONFIG
+ , wxConfigBase *config, const wxString& rootpath
+#endif // wxUSE_CONFIG
+ )
- Create(parent, id, title, style, config, rootpath);
+ Create(parent, id, title, style
+#if wxUSE_CONFIG
+ , config, rootpath
+#endif // wxUSE_CONFIG
+ );
}
void wxHtmlHelpFrame::Init(wxHtmlHelpData* data)
}
void wxHtmlHelpFrame::Init(wxHtmlHelpData* data)
// Create: builds the GUI components.
bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
// Create: builds the GUI components.
bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id,
- const wxString& WXUNUSED(title), int style,
- wxConfigBase *config, const wxString& rootpath)
+ const wxString& WXUNUSED(title), int style
+#if wxUSE_CONFIG
+ , wxConfigBase *config, const wxString& rootpath
+#endif // wxUSE_CONFIG
+ )
{
m_HtmlHelpWin = new wxHtmlHelpWindow(m_Data);
m_HtmlHelpWin->SetController(m_helpController);
{
m_HtmlHelpWin = new wxHtmlHelpWindow(m_Data);
m_HtmlHelpWin->SetController(m_helpController);
+#if wxUSE_CONFIG
+ if ( config )
m_HtmlHelpWin->UseConfig(config, rootpath);
m_HtmlHelpWin->UseConfig(config, rootpath);
wxFrame::Create(parent, id, _("Help"),
wxPoint(m_HtmlHelpWin->GetCfgData().x, m_HtmlHelpWin->GetCfgData().y),
wxFrame::Create(parent, id, _("Help"),
wxPoint(m_HtmlHelpWin->GetCfgData().x, m_HtmlHelpWin->GetCfgData().y),
// For compatibility
void wxHtmlHelpFrame::UseConfig(wxConfigBase *config, const wxString& rootPath)
{
if (m_HtmlHelpWin)
m_HtmlHelpWin->UseConfig(config, rootPath);
}
// For compatibility
void wxHtmlHelpFrame::UseConfig(wxConfigBase *config, const wxString& rootPath)
{
if (m_HtmlHelpWin)
m_HtmlHelpWin->UseConfig(config, rootPath);
}
#ifdef __WXMAC__
void wxHtmlHelpFrame::OnClose(wxCommandEvent& WXUNUSED(event))
#ifdef __WXMAC__
void wxHtmlHelpFrame::OnClose(wxCommandEvent& WXUNUSED(event))
m_Config = NULL;
m_ConfigRoot = wxEmptyString;
m_Config = NULL;
m_ConfigRoot = wxEmptyString;
m_Cfg.x = m_Cfg.y = wxDefaultCoord;
m_Cfg.w = 700;
m_Cfg.x = m_Cfg.y = wxDefaultCoord;
m_Cfg.w = 700;
// Do the config in two steps. We read the HtmlWindow customization after we
// create the window.
if (m_Config)
ReadCustomization(m_Config, m_ConfigRoot);
// Do the config in two steps. We read the HtmlWindow customization after we
// create the window.
if (m_Config)
ReadCustomization(m_Config, m_ConfigRoot);
wxWindow::Create(parent, id, pos, size, style, wxT("wxHtmlHelp"));
wxWindow::Create(parent, id, pos, size, style, wxT("wxHtmlHelp"));
topWindowSizer->Add(m_HtmlWin, 1, wxEXPAND);
}
topWindowSizer->Add(m_HtmlWin, 1, wxEXPAND);
}
if ( m_Config )
m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);
if ( m_Config )
m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);
// contents tree panel?
if ( helpStyle & wxHF_CONTENTS )
// contents tree panel?
if ( helpStyle & wxHF_CONTENTS )
void wxHtmlHelpWindow::ReadCustomization(wxConfigBase *cfg, const wxString& path)
{
wxString oldpath;
void wxHtmlHelpWindow::ReadCustomization(wxConfigBase *cfg, const wxString& path)
{
wxString oldpath;
if (path != wxEmptyString)
cfg->SetPath(oldpath);
}
if (path != wxEmptyString)
cfg->SetPath(oldpath);
}
static void SetFontsToHtmlWin(wxHtmlWindow *win, const wxString& scalf, const wxString& fixf, int size)
{
static void SetFontsToHtmlWin(wxHtmlWindow *win, const wxString& scalf, const wxString& fixf, int size)
{
void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
{
wxString oldpath;
void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
{
wxString oldpath;
if (path != wxEmptyString)
cfg->SetPath(oldpath);
}
if (path != wxEmptyString)
cfg->SetPath(oldpath);
}
bool wxHtmlWindow::HistoryBack()
{
bool wxHtmlWindow::HistoryBack()
{