Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed changes to build aMule with wx 3.1.x #168

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/ColorFrameCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ END_EVENT_TABLE()
/////////////////////////////////////////////////////////////////////////////
void CColorFrameCtrl::SetFrameBrushColour(const wxColour& colour)
{
#if wxCHECK_VERSION(3, 0, 0)
m_brushFrame = *(wxTheBrushList->FindOrCreateBrush(colour, wxBRUSHSTYLE_SOLID));
#else
m_brushFrame = *(wxTheBrushList->FindOrCreateBrush(colour, wxSOLID));
#endif


Refresh(FALSE);
} // SetFrameColor
Expand All @@ -70,7 +75,12 @@ void CColorFrameCtrl::SetFrameBrushColour(const wxColour& colour)
/////////////////////////////////////////////////////////////////////////////
void CColorFrameCtrl::SetBackgroundBrushColour(const wxColour& colour)
{
#if wxCHECK_VERSION(3, 0, 0)
m_brushBack = *(wxTheBrushList->FindOrCreateBrush(colour, wxBRUSHSTYLE_SOLID));
#else
m_brushBack = *(wxTheBrushList->FindOrCreateBrush(colour, wxSOLID));
#endif


// clear out the existing garbage, re-start with a clean plot
Refresh(FALSE);
Expand Down
10 changes: 10 additions & 0 deletions src/DownloadListCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,12 @@ void CDownloadListCtrl::OnDrawItem(
dc->SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
dc->SetPen( colour.Blend(65).GetPen() );
} else {
#if wxCHECK_VERSION(3, 0, 0)
dc->SetBackground(*(wxTheBrushList->FindOrCreateBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX), wxBRUSHSTYLE_SOLID)));
#else
dc->SetBackground(*(wxTheBrushList->FindOrCreateBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX), wxSOLID)));
#endif

dc->SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
dc->SetPen(*wxTRANSPARENT_PEN);
}
Expand Down Expand Up @@ -1407,7 +1412,12 @@ void CDownloadListCtrl::DrawFileStatusBar(
dc->DrawLine( rect.x, rect.y + 2, rect.x + width, rect.y + 2 );

// Draw the green line
#if wxCHECK_VERSION(3, 0, 0)
dc->SetPen( *(wxThePenList->FindOrCreatePen( crProgress , 1, wxPENSTYLE_SOLID ) ));
#else
dc->SetPen( *(wxThePenList->FindOrCreatePen( crProgress , 1, wxSOLID ) ));
#endif

dc->DrawLine( rect.x, rect.y + 1, rect.x + width, rect.y + 1 );
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/GenericClientListCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,12 @@ void CGenericClientListCtrl::OnDrawItem(
dc->SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
dc->SetPen( colour.Blend(65).GetPen() );
} else {
#if wxCHECK_VERSION(3, 0, 0)
dc->SetBackground(*(wxTheBrushList->FindOrCreateBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX), wxBRUSHSTYLE_SOLID)));
#else
dc->SetBackground(*(wxTheBrushList->FindOrCreateBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX), wxSOLID)));
#endif

dc->SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
dc->SetPen(*wxTRANSPARENT_PEN);
}
Expand Down
10 changes: 10 additions & 0 deletions src/MuleColour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
std::map<uint32_t, wxPen*> wxPenCache;
std::map<uint32_t, wxBrush*> wxBrushCache;

#if wxCHECK_VERSION(3, 0, 0)
const wxPen& CMuleColour::GetPen(int width, wxPenStyle style) const
#else
const wxPen& CMuleColour::GetPen(int width, int style) const
#endif

{
#if USE_MULE_PEN_CACHE
wxPen* result = NULL;
Expand All @@ -61,7 +66,12 @@ const wxPen& CMuleColour::GetPen(int width, int style) const
#endif
}

#if wxCHECK_VERSION(3, 0, 0)
const wxBrush& CMuleColour::GetBrush(wxBrushStyle style) const
#else
const wxBrush& CMuleColour::GetBrush(int style) const
#endif

{
#if USE_MULE_BRUSH_CACHE
wxBrush* result = NULL;
Expand Down
11 changes: 11 additions & 0 deletions src/MuleColour.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@

#include <wx/colour.h>
#include <wx/settings.h>
#if wxCHECK_VERSION(3, 0, 0)
#include <wx/pen.h> // needed for wxPenStyle enum values
#include <wx/brush.h> // needed for wxBrushStyle enum values
#include <wx/font.h> // needed for wxFontStyle enum values
#endif
#include "Types.h"

class wxPen;
Expand Down Expand Up @@ -95,8 +100,14 @@ class CMuleColour
return wxColor(m_red, m_green, m_blue);
}

#if wxCHECK_VERSION(3, 0, 0)
const wxPen& GetPen(int width = 1, wxPenStyle style = wxPENSTYLE_SOLID) const;
const wxBrush& GetBrush(wxBrushStyle style = wxBRUSHSTYLE_SOLID) const;
#else
const wxPen& GetPen(int width = 1, int style = wxSOLID) const;
const wxBrush& GetBrush(int style = wxSOLID) const;
#endif


private:
byte m_red;
Expand Down
5 changes: 5 additions & 0 deletions src/MuleGifCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ void MuleGifCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
int x = (clientsize.GetWidth()-gifsize.GetWidth())/2;
int y = (clientsize.GetHeight()-gifsize.GetHeight())/2;

#if wxCHECK_VERSION(3, 0, 0)
dc.SetBackground(*(wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID)));
#else
dc.SetBackground(*(wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID)));
#endif

dc.Clear();
dc.DrawBitmap(m_frame, x, y, true);
}
Expand Down
25 changes: 25 additions & 0 deletions src/OScopeCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ COScopeCtrl::COScopeCtrl(int cntTrends, int nDecimals, StatsGraphType type, wxWi
PlotData_t* ppds = pdsTrends;
for(unsigned i=0; i<nTrends; ++i, ++ppds){
ppds->crPlot = (i<15 ? crPreset[i] : *wxWHITE);
#if wxCHECK_VERSION(3, 0, 0)
ppds->penPlot=*(wxThePenList->FindOrCreatePen(ppds->crPlot, 1, wxPENSTYLE_SOLID));
#else
ppds->penPlot=*(wxThePenList->FindOrCreatePen(ppds->crPlot, 1, wxSOLID));
#endif
ppds->fPrev = ppds->fLowerLimit = ppds->fUpperLimit = 0.0;
}

Expand Down Expand Up @@ -166,7 +170,12 @@ void COScopeCtrl::SetPlotColor(const wxColour& cr, unsigned iTrend)
if (ppds->crPlot == cr)
return;
ppds->crPlot = cr;
#if wxCHECK_VERSION(3, 0, 0)
ppds->penPlot=*(wxThePenList->FindOrCreatePen(ppds->crPlot, 1, wxPENSTYLE_SOLID));
#else
ppds->penPlot=*(wxThePenList->FindOrCreatePen(ppds->crPlot, 1, wxSOLID));
#endif

InvalidateGraph();
}

Expand All @@ -179,7 +188,11 @@ void COScopeCtrl::SetBackgroundColor(const wxColour& cr)
}

m_bgColour = cr;
#if wxCHECK_VERSION(3, 0, 0)
brushBack= *(wxTheBrushList->FindOrCreateBrush(cr, wxBRUSHSTYLE_SOLID));
#else
brushBack= *(wxTheBrushList->FindOrCreateBrush(cr, wxSOLID));
#endif
InvalidateCtrl() ;
}

Expand All @@ -196,7 +209,11 @@ void COScopeCtrl::RecreateGrid()

wxMemoryDC dcGrid(m_bmapGrid);

#if wxCHECK_VERSION(3, 0, 0)
wxPen solidPen = *(wxThePenList->FindOrCreatePen(m_gridColour, 1, wxPENSTYLE_SOLID));
#else
wxPen solidPen = *(wxThePenList->FindOrCreatePen(m_gridColour, 1, wxSOLID));
#endif
wxString strTemp;

// fill the grid background
Expand All @@ -213,7 +230,11 @@ void COScopeCtrl::RecreateGrid()
dcGrid.SetPen(wxNullPen);

// create some fonts (horizontal and vertical)
#if wxCHECK_VERSION(3, 1, 0)
wxFont axisFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false);
#else
wxFont axisFont(10, wxSWISS, wxNORMAL, wxNORMAL, false);
#endif
dcGrid.SetFont(axisFont);

// y max
Expand Down Expand Up @@ -320,7 +341,11 @@ void COScopeCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt))
// operation, preventing us from simply blitting the plot on top of
// the grid bitmap.

#if wxCHECK_VERSION(3, 0, 0)
dc.SetPen(*(wxThePenList->FindOrCreatePen(m_gridColour, 1, wxPENSTYLE_LONG_DASH)));
#else
dc.SetPen(*(wxThePenList->FindOrCreatePen(m_gridColour, 1, wxLONG_DASH)));
#endif
for (unsigned j = 1; j < (nYGrids + 1); ++j) {
unsigned GridPos = (m_rectPlot.GetHeight())*j/( nYGrids + 1 ) + m_rectPlot.GetTop();

Expand Down
9 changes: 9 additions & 0 deletions src/SearchListCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,11 @@ void CSearchListCtrl::OnDrawItem(

// Define the border of the drawn area
if (highlighted) {
#if wxCHECK_VERSION(3, 0, 0)
dc->SetPen(*(wxThePenList->FindOrCreatePen(CMuleColour(dc->GetBackground().GetColour()).Blend(65), 1, wxPENSTYLE_SOLID)));
#else
dc->SetPen(*(wxThePenList->FindOrCreatePen(CMuleColour(dc->GetBackground().GetColour()).Blend(65), 1, wxSOLID)));
#endif
} else {
dc->SetPen(*wxTRANSPARENT_PEN);
dc->SetTextForeground(GetItemTextColour(item));
Expand Down Expand Up @@ -912,7 +916,12 @@ void CSearchListCtrl::OnDrawItem(
const int middle = cur_rec.y + ( cur_rec.height + 1 ) / 2;

// Set up a new pen for drawing the tree
#if wxCHECK_VERSION(3, 0, 0)
dc->SetPen( *(wxThePenList->FindOrCreatePen(dc->GetTextForeground(), 1, wxPENSTYLE_SOLID)) );
#else
dc->SetPen( *(wxThePenList->FindOrCreatePen(dc->GetTextForeground(), 1, wxSOLID)) );
#endif


if (file->GetParent()) {
// Draw the line to the filename
Expand Down
5 changes: 5 additions & 0 deletions src/ServerListCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,12 @@ void CServerListCtrl::HighlightServer( const CServer* server, bool highlight )
wxFont font = GetFont();

if ( highlight ) {
#if wxCHECK_VERSION(3, 1, 0)
font.SetWeight( wxFONTWEIGHT_BOLD );
#else
font.SetWeight( wxBOLD );
#endif


m_connected = server;
}
Expand Down
14 changes: 14 additions & 0 deletions src/amuleDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,11 @@ void CamuleDlg::ShowConnectionState(bool skinChanged)
if ( (true == skinChanged) || (currentState != s_oldState) ) {
wxWindowUpdateLocker freezer(m_wndToolbar);

#if wxCHECK_VERSION(3, 1, 0)
wxToolBarToolBase* toolbarTool = m_wndToolbar->FindById(ID_BUTTONCONNECT);
#else
wxToolBarToolBase* toolbarTool = m_wndToolbar->RemoveTool(ID_BUTTONCONNECT);
#endif

switch (currentState) {
case ECS_Connecting:
Expand All @@ -788,8 +792,10 @@ void CamuleDlg::ShowConnectionState(bool skinChanged)
toolbarTool->SetNormalBitmap(m_tblist.GetBitmap(0));
}

#if !wxCHECK_VERSION(3, 1, 0)
m_wndToolbar->InsertTool(0, toolbarTool);
m_wndToolbar->Realize();
#endif
m_wndToolbar->EnableTool(ID_BUTTONCONNECT, (thePrefs::GetNetworkED2K() || thePrefs::GetNetworkKademlia()) && theApp->ipfilter->IsReady());

s_oldState = currentState;
Expand Down Expand Up @@ -1443,7 +1449,11 @@ void CamuleDlg::DoNetworkRearrange()
wxWindowUpdateLocker freezer(this);
#endif

#if wxCHECK_VERSION(3, 1, 0)
wxToolBarToolBase* toolbarTool = m_wndToolbar->FindById(ID_BUTTONNETWORKS);
#else
wxToolBarToolBase* toolbarTool = m_wndToolbar->RemoveTool(ID_BUTTONNETWORKS);
#endif

// set the log windows
wxNotebook* logs_notebook = CastChild( ID_SRVLOG_NOTEBOOK, wxNotebook);
Expand Down Expand Up @@ -1534,11 +1544,15 @@ void CamuleDlg::DoNetworkRearrange()

// Tool bar

#if!wxCHECK_VERSION(3, 1, 0)
m_wndToolbar->InsertTool(2, toolbarTool);
#endif
m_wndToolbar->EnableTool(ID_BUTTONNETWORKS, (thePrefs::GetNetworkED2K() || thePrefs::GetNetworkKademlia()));
m_wndToolbar->EnableTool(ID_BUTTONCONNECT, (thePrefs::GetNetworkED2K() || thePrefs::GetNetworkKademlia()) && theApp->ipfilter->IsReady());

# if !wxCHECK_VERSION(3, 1, 0)
m_wndToolbar->Realize();
# endif

ShowConnectionState(); // status in the bottom right
m_searchwnd->FixSearchTypes();
Expand Down
41 changes: 37 additions & 4 deletions src/extern/wxWidgets/listctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,8 +1453,11 @@ bool wxListLineData::SetAttributes(wxDC *dc,
if ( highlighted )
dc->SetBrush( m_owner->GetHighlightBrush() );
else
#if wxCHECK_VERSION(3, 0, 0)
dc->SetBrush(*(wxTheBrushList->FindOrCreateBrush(attr->GetBackgroundColour(), wxBRUSHSTYLE_SOLID)));
#else
dc->SetBrush(*(wxTheBrushList->FindOrCreateBrush(attr->GetBackgroundColour(), wxSOLID)));

#endif
dc->SetPen( *wxTRANSPARENT_PEN );

return true;
Expand Down Expand Up @@ -2325,15 +2328,24 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent,
(
wxSYS_COLOUR_HIGHLIGHT
),

#if wxCHECK_VERSION(3, 0, 0)
wxBRUSHSTYLE_SOLID
#else
wxSOLID
#endif
));

m_highlightUnfocusedBrush = *(wxTheBrushList->FindOrCreateBrush(
wxSystemSettings::GetColour
(
wxSYS_COLOUR_BTNSHADOW
),
wxSOLID
#if wxCHECK_VERSION(3, 0, 0)
wxBRUSHSTYLE_SOLID
#else
wxSOLID
#endif
));

SetScrollbars( 0, 0, 0, 0, 0, 0 );
Expand Down Expand Up @@ -2734,7 +2746,11 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )

// Ensure an uniform background color, as to avoid differences between
// the automatically cleared parts and the rest of the canvas.
#if wxCHECK_VERSION(3, 0, 0)
dc.SetBackground(*(wxTheBrushList->FindOrCreateBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX), wxBRUSHSTYLE_SOLID)));
#else
dc.SetBackground(*(wxTheBrushList->FindOrCreateBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX), wxSOLID)));
#endif

// We need to clear the DC manually, since we intercept BG-erase events.
// Clearing must be done first thing because caching of the double-buffering causes artifacts otherwise.
Expand Down Expand Up @@ -2805,7 +2821,11 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )

if ( HasFlag(wxLC_HRULES) )
{
#if wxCHECK_VERSION(3, 0, 0)
wxPen pen = *(wxThePenList->FindOrCreatePen(GetRuleColour(), 1, wxPENSTYLE_SOLID));
#else
wxPen pen = *(wxThePenList->FindOrCreatePen(GetRuleColour(), 1, wxSOLID));
#endif
wxSize clientSize = GetClientSize();

size_t i = visibleFrom;
Expand All @@ -2831,7 +2851,12 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
// Draw vertical rules if required
if ( HasFlag(wxLC_VRULES) && !IsEmpty() )
{
#if wxCHECK_VERSION(3, 0, 0)
wxPen pen = *(wxThePenList->FindOrCreatePen(GetRuleColour(), 1, wxPENSTYLE_SOLID));
#else
wxPen pen = *(wxThePenList->FindOrCreatePen(GetRuleColour(), 1, wxSOLID));
#endif

wxRect firstItemRect, lastItemRect;

GetItemRect(visibleFrom, firstItemRect);
Expand Down Expand Up @@ -4859,13 +4884,21 @@ void wxListMainWindow::SortItems( MuleListCtrlCompare fn, long data )

void wxListMainWindow::OnScroll(wxScrollWinEvent& event)
{
// FIXME
#if ( defined(__WXGTK__) || defined(__WXMAC__) ) && !defined(__WXUNIVERSAL__)
// wxScrolledWindows::OnScroll is deprecated in wx 3.0.0 and it does not exist anymore in 3.1.0.
// Please also notice that call to
// - wxScrolledWindow::OnScroll
// - HandleOnScroll
// have been removed in code present in
// src/generic/listctrl.cpp, wxListMainWindow::OnScroll
// of wxWidgets 3.0
// FIXME
#if ( defined(__WXGTK__) || defined(__WXMAC__) ) && !defined(__WXUNIVERSAL__) && !wxCHECK_VERSION(3,0,0)
wxScrolledWindow::OnScroll(event);
#else
HandleOnScroll( event );
#endif


// update our idea of which lines are shown when we redraw the window the
// next time
ResetVisibleLinesRange();
Expand Down
Loading