4pane/0001-Compilation-fixes-for-wxWidgets-3.1.6.patch
Luigi Baldoni 81ab9b5187 Accepting request 999180 from home:alois:branches:X11:Utilities
- Added 0001-Compilation-fixes-for-wxWidgets-3.1.6.patch,
  0001-Compilation-fix-for-wxWidgets-3.1.5.patch,
  0001-Fix-a-wx-assert-complaining-that-a-panel-was-being-a.patch,
  0001-Fix-a-wxAssert-when-showing-the-Command-line-termina.patch,
  and
  0001-Prevent-a-wx-build-warning-about-wxPATH_NORM_ALL-bei.patch
  to fix build with wxWidgets 3.2

OBS-URL: https://build.opensuse.org/request/show/999180
OBS-URL: https://build.opensuse.org/package/show/X11:Utilities/4pane?expand=0&rev=20
2022-08-25 07:21:42 +00:00

141 lines
5.7 KiB
Diff

From 66ae9a6f2ac526d80559967cda428cd48e5859ee Mon Sep 17 00:00:00 2001
From: dghart <dghart@users.sourceforge.net>
Date: Sat, 12 Feb 2022 15:45:54 +0000
Subject: [PATCH] Compilation fixes for wxWidgets 3.1.6
Workarounds for the addition of wxBitmapBundle.
---
Devices.cpp | 4 ++++
MyDirs.cpp | 9 +++++++++
MyTreeCtrl.cpp | 49 ++++++++++++++++++++++++++++++++++++++-----------
3 files changed, 51 insertions(+), 11 deletions(-)
diff --git a/Devices.cpp b/Devices.cpp
index 5b8cfe9..dc77cdc 100644
--- a/Devices.cpp
+++ b/Devices.cpp
@@ -210,7 +210,11 @@ wxString bitmap; config->Read(Rootname+subgrp+wxT("/Bitmap"), &bitmap);
wxString tooltip; config->Read(Rootname+subgrp+wxT("/Tooltip"), &tooltip);
bitmap = BITMAPSDIR + bitmap;
+#if wxVERSION_NUMBER > 3105
+Create(MyFrame::mainframe->panelette, -1, wxBitmapBundle::FromBitmap(bitmap), wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
+#else
Create(MyFrame::mainframe->panelette, -1, bitmap, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
+#endif
SetToolTip(tooltip);
}
diff --git a/MyDirs.cpp b/MyDirs.cpp
index 68f41a8..f370d5b 100644
--- a/MyDirs.cpp
+++ b/MyDirs.cpp
@@ -522,10 +522,19 @@ for (size_t n=0; n < count; ++n)
array->Item(n)->tooltip, wxITEM_NORMAL);
else
{ if (array->Item(n)->bitmaplocation.AfterLast(('/')) == wxT("MyDocuments.xpm")) // If Documents and the label is empty, supply a default
+#if wxVERSION_NUMBER > 3105
+ toolBar->AddTool(IDM_TOOLBAR_bmfirst+n, label.empty() ? wxString(_("Documents")) : label,wxBitmapBundle::FromBitmap(array->Item(n)->bitmaplocation),
+ array->Item(n)->tooltip, wxITEM_NORMAL);
+ else
+ toolBar->AddTool(IDM_TOOLBAR_bmfirst + n, label, wxBitmapBundle::FromBitmap(array->Item(n)->bitmaplocation), array->Item(n)->tooltip, wxITEM_NORMAL);
+
+#else
toolBar->AddTool(IDM_TOOLBAR_bmfirst+n, label.empty() ? wxString(_("Documents")) : label, array->Item(n)->bitmaplocation,
+
array->Item(n)->tooltip, wxITEM_NORMAL);
else
toolBar->AddTool(IDM_TOOLBAR_bmfirst + n, label, array->Item(n)->bitmaplocation, array->Item(n)->tooltip, wxITEM_NORMAL);
+#endif //wxVERSION_NUMBER > 3105
}
}
diff --git a/MyTreeCtrl.cpp b/MyTreeCtrl.cpp
index bc1b607..735b6cf 100644
--- a/MyTreeCtrl.cpp
+++ b/MyTreeCtrl.cpp
@@ -1336,7 +1336,27 @@ void MyTreeCtrl::PaintLevel(wxGenericTreeItem *item, wxDC &dc, int level, int &y
dc.DrawLine(3, y_mid, x - 5, y_mid);
dc.DrawLine(x + 5, y_mid, x + m_spacing, y_mid);
}
+#if wxVERSION_NUMBER > 3105
+ if ( m_imagesButtons.HasImages() )
+ {
+ // draw the image button here
+ int image_h = 0, image_w = 0;
+ int image = item->IsExpanded() ? wxTreeItemIcon_Expanded
+ : wxTreeItemIcon_Normal;
+ if ( item->IsSelected() )
+ image += wxTreeItemIcon_Selected - wxTreeItemIcon_Normal;
+
+ wxImageList* const
+ imageListButtons = m_imagesButtons.GetImageList();
+ imageListButtons->GetSize(image, image_w, image_h);
+ int xx = x - image_w/2;
+ int yy = y_mid - image_h/2;
+ wxDCClipper clip(dc, xx, yy, image_w, image_h);
+ imageListButtons->Draw(image, dc, xx, yy,
+ wxIMAGELIST_DRAW_TRANSPARENT);
+ }
+#else // !wxVERSION_NUMBER > 3105
if (m_imageListButtons != NULL)
{
// draw the image button here
@@ -1352,9 +1372,10 @@ void MyTreeCtrl::PaintLevel(wxGenericTreeItem *item, wxDC &dc, int level, int &y
wxIMAGELIST_DRAW_TRANSPARENT);
dc.DestroyClippingRegion();
}
-
+#endif
}
}
+
else // no custom buttons
{
static const int wImage = 9;
@@ -1495,15 +1516,17 @@ if (headerwindow->IsHidden(i)) continue; // //
image = NO_IMAGE; // //item->GetImage(i);
}
- if(image != NO_IMAGE)
- {
- if(m_imageListNormal) {
- m_imageListNormal->GetSize(image, image_w, image_h);
- image_w += 4;
- }
- else {
- image = NO_IMAGE;
- }
+ if (image != NO_IMAGE)
+ {
+#if wxVERSION_NUMBER > 3105
+ if (GetImageList()) {
+ GetImageList()->GetSize(image, image_w, image_h);
+#else
+ if (m_imageListNormal) {
+ m_imageListNormal->GetSize(image, image_w, image_h);
+#endif // wxVERSION_NUMBER > 3105
+ image_w += 4;
+ } else { image = NO_IMAGE; }
}
// honor text alignment
@@ -1581,8 +1604,12 @@ if (headerwindow->IsHidden(i)) continue; // //
item->GetY() + extraH, clip_width,
total_h);
- if(image != NO_IMAGE) {
+ if (image != NO_IMAGE) {
+#if wxVERSION_NUMBER > 3105
+ GetImageList()->Draw(image, dc, image_x,
+#else
m_imageListNormal->Draw(image, dc, image_x,
+#endif
item->GetY() +((total_h > image_h)?
((total_h-image_h)/2):0),
wxIMAGELIST_DRAW_TRANSPARENT);
--
2.37.2