xchm/0001-Fix-for-compiling-under-older-versions-of-wxWidgets.patch
wangtaozhi 3e67e8c19d Package init
- 初始化提交
2023-06-26 14:14:41 +08:00

89 lines
4.5 KiB
Diff

From 856ede8dec0898210060c6d4ae7cbf91f0ac1aac Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Mon, 29 May 2023 17:28:37 +0800
Subject: [PATCH] Fix for compiling under older versions of wxWidgets
---
src/chmframe.cpp | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/src/chmframe.cpp b/src/chmframe.cpp
index 16ad993..650aae9 100644
--- a/src/chmframe.cpp
+++ b/src/chmframe.cpp
@@ -42,6 +42,13 @@
#include <wx/mimetype.h>
#include <wx/statbox.h>
#include <wx/utils.h>
+#include <wx/version.h>
+
+#if wxCHECK_VERSION(3, 1, 6)
+#define ARTPROV_GETTOOLBARBITMAP wxArtProvider::GetBitmapBundle
+#else
+#define ARTPROV_GETTOOLBARBITMAP wxArtProvider::GetBitmap
+#endif
#define OPEN_HELP _("Open a CHM book.")
#define FONTS_HELP _("Change fonts.")
@@ -851,27 +858,26 @@ namespace {
bool CHMFrame::InitToolBar(wxToolBar* toolbar)
{
- toolbar->AddTool(ID_Open, _("Open .."), wxArtProvider::GetBitmapBundle(wxART_FILE_OPEN, wxART_TOOLBAR), OPEN_HELP);
- toolbar->AddTool(ID_Print, _("Print .."), wxArtProvider::GetBitmapBundle(wxART_PRINT, wxART_TOOLBAR), PRINT_HELP);
+ toolbar->AddTool(ID_Open, _("Open .."), ARTPROV_GETTOOLBARBITMAP(wxART_FILE_OPEN, wxART_TOOLBAR), OPEN_HELP);
+ toolbar->AddTool(ID_Print, _("Print .."), ARTPROV_GETTOOLBARBITMAP(wxART_PRINT, wxART_TOOLBAR), PRINT_HELP);
#ifdef __WXGTK__
- toolbar->AddTool(ID_Fonts, _("Fonts .."), wxArtProvider::GetBitmapBundle("gtk-select-font", wxART_TOOLBAR),
- FONTS_HELP);
- toolbar->AddCheckTool(ID_Contents, _("Contents"), wxArtProvider::GetBitmapBundle("gtk-index", wxART_TOOLBAR),
- wxArtProvider::GetBitmapBundle("gtk-index", wxART_TOOLBAR), CONTENTS_HELP);
+ toolbar->AddTool(ID_Fonts, _("Fonts .."), ARTPROV_GETTOOLBARBITMAP("gtk-select-font", wxART_TOOLBAR), FONTS_HELP);
+ toolbar->AddCheckTool(ID_Contents, _("Contents"), ARTPROV_GETTOOLBARBITMAP("gtk-index", wxART_TOOLBAR),
+ ARTPROV_GETTOOLBARBITMAP("gtk-index", wxART_TOOLBAR), CONTENTS_HELP);
#else
toolbar->AddTool(ID_Fonts, _("Fonts .."), wxBitmap(htmoptns_xpm), FONTS_HELP);
toolbar->AddCheckTool(ID_Contents, _("Contents"), wxBitmap(htmsidep_xpm), wxBitmap(htmsidep_xpm), CONTENTS_HELP);
#endif
toolbar->AddSeparator();
- toolbar->AddTool(ID_CopySelection, _("Copy"), wxArtProvider::GetBitmapBundle(wxART_COPY, wxART_TOOLBAR), COPY_HELP);
- toolbar->AddTool(ID_FindInPage, _("Find"), wxArtProvider::GetBitmapBundle(wxART_FIND, wxART_TOOLBAR), FIND_HELP);
+ toolbar->AddTool(ID_CopySelection, _("Copy"), ARTPROV_GETTOOLBARBITMAP(wxART_COPY, wxART_TOOLBAR), COPY_HELP);
+ toolbar->AddTool(ID_FindInPage, _("Find"), ARTPROV_GETTOOLBARBITMAP(wxART_FIND, wxART_TOOLBAR), FIND_HELP);
toolbar->AddSeparator();
#ifdef __WXGTK__
- toolbar->AddTool(ID_FullScreen, _("Fullscreen"), wxArtProvider::GetBitmapBundle("gtk-fullscreen", wxART_TOOLBAR),
+ toolbar->AddTool(ID_FullScreen, _("Fullscreen"), ARTPROV_GETTOOLBARBITMAP("gtk-fullscreen", wxART_TOOLBAR),
FULLSCREEN_HELP);
#else
toolbar->AddTool(ID_FullScreen, _("Fullscreen"), wxBitmap(fullscreen_xpm), FULLSCREEN_HELP);
@@ -879,16 +885,15 @@ bool CHMFrame::InitToolBar(wxToolBar* toolbar)
toolbar->AddSeparator();
- toolbar->AddTool(ID_Back, _("Back"), wxArtProvider::GetBitmapBundle(wxART_GO_BACK, wxART_TOOLBAR), BACK_HELP);
- toolbar->AddTool(ID_Forward, _("Forward"), wxArtProvider::GetBitmapBundle(wxART_GO_FORWARD, wxART_TOOLBAR),
- FORWARD_HELP);
- toolbar->AddTool(ID_Home, _("Home"), wxArtProvider::GetBitmapBundle(wxART_GO_HOME, wxART_TOOLBAR), HOME_HELP);
+ toolbar->AddTool(ID_Back, _("Back"), ARTPROV_GETTOOLBARBITMAP(wxART_GO_BACK, wxART_TOOLBAR), BACK_HELP);
+ toolbar->AddTool(ID_Forward, _("Forward"), ARTPROV_GETTOOLBARBITMAP(wxART_GO_FORWARD, wxART_TOOLBAR), FORWARD_HELP);
+ toolbar->AddTool(ID_Home, _("Home"), ARTPROV_GETTOOLBARBITMAP(wxART_GO_HOME, wxART_TOOLBAR), HOME_HELP);
toolbar->AddSeparator();
#ifdef __WXGTK__
- toolbar->AddTool(ID_About, _("About"), wxArtProvider::GetBitmapBundle("gtk-about", wxART_TOOLBAR), ABOUT_HELP);
+ toolbar->AddTool(ID_About, _("About"), ARTPROV_GETTOOLBARBITMAP("gtk-about", wxART_TOOLBAR), ABOUT_HELP);
#else
- toolbar->AddTool(ID_About, _("About"), wxArtProvider::GetBitmapBundle(wxART_HELP, wxART_TOOLBAR), ABOUT_HELP);
+ toolbar->AddTool(ID_About, _("About"), ARTPROV_GETTOOLBARBITMAP(wxART_HELP, wxART_TOOLBAR), ABOUT_HELP);
#endif
toolbar->Realize();
--
2.33.0