Skip to content

Commit

Permalink
Merge pull request #163 from dmalec/migrate_to_wxWidgets_3_2
Browse files Browse the repository at this point in the history
Migrate to wxWidgets 3.2
  • Loading branch information
dmalec authored Mar 22, 2023
2 parents 0737e81 + 90fcf5f commit b55a983
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 24 deletions.
62 changes: 53 additions & 9 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
INNO_VERSION: 6.1.2
WX_WIDGETS_VERSION: 3.0.5
WX_WIDGETS_VERSION: 3.2.2.1
TARGET_OSX_VERSION: 10.14

jobs:
Expand All @@ -21,6 +21,40 @@ jobs:
# over 30 minutes to build.
# ############################################################################

build_wxwidgets_linux:
name: Build wxWidgets for Linux
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Cache wxWidgets
uses: actions/cache@v3
id: wxwidgets-cache
with:
path: ${{ runner.temp }}/wxWidgets-${{ env.WX_WIDGETS_VERSION }}
key: ${{ runner.os }}-wxWidgets-${{ env.WX_WIDGETS_VERSION }}
- name: Update Package Info
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
run: |
sudo apt-get update
- name: Install Dependencies
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
run: >
sudo apt-get install libgtk-3-dev
- name: Download wxWidgets
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
working-directory: ${{ runner.temp }}
run: |
wget https://github.com/wxWidgets/wxWidgets/releases/download/v${{ env.WX_WIDGETS_VERSION }}/wxWidgets-${{ env.WX_WIDGETS_VERSION }}.tar.bz2
tar -xjf wxWidgets-${{ env.WX_WIDGETS_VERSION }}.tar.bz2
- name: Build wxwidgets
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
working-directory: ${{ runner.temp }}/wxWidgets-${{ env.WX_WIDGETS_VERSION }}
run: |
mkdir gtk-build
cd gtk-build
../configure
make -j2
build_wxwidgets_osx:
name: Build wxWidgets for OSX
runs-on: macos-latest
Expand Down Expand Up @@ -82,15 +116,11 @@ jobs:
if: steps.wxwidgets-cache.outputs.cache-hit != 'true'
working-directory: ${{ runner.temp }}\wxWidgets-${{ env.WX_WIDGETS_VERSION }}\build\msw
shell: msys2 {0}
env:
# NOTE: wxWidgets 3.1.x has a fix for the narrowing issue; but, this
# approach should work for now given with wxWidgets 3.0.x
CFLAGS: -Wno-narrowing
CXXFLAGS: -Wno-narrowing
# NOTE: using -j2 appears to cause problems on the MinGW builds
# NOTE: prebuilding setup.h using the setup_h tag allows the main build to use multiple cores
run: |
mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release clean
mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release
mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release setup_h
mingw32-make -j2 -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release
# ############################################################################
# The build_<platform> jobs handle building Logo for each platform.
Expand All @@ -101,6 +131,7 @@ jobs:

build_linux:
name: Build Logo for Linux
needs: [ build_wxwidgets_linux ]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -111,9 +142,22 @@ jobs:
run: >
sudo apt-get install
autoconf-archive
libwxgtk3.0-gtk3-dev
libgtk-3-dev
texlive
zip
- name: wxWidgets Cache
uses: actions/cache@v3
id: wxwidgets-cache
with:
path: ${{ runner.temp }}/wxWidgets-${{ env.WX_WIDGETS_VERSION }}
key: ${{ runner.os }}-wxWidgets-${{ env.WX_WIDGETS_VERSION }}
- name: Install wxwidgets
# Install wxwidgets from cache on build machine so autoconf has WX_CONFIG_CHECK
working-directory: ${{ runner.temp }}/wxWidgets-${{ env.WX_WIDGETS_VERSION }}
run: |
cd gtk-build
sudo make install
sudo cp ../wxwin.m4 /usr/share/aclocal/
- name: Checkout Repository
uses: actions/checkout@v3
with:
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,35 @@ on:
branches:
- master

env:
WX_WIDGETS_VERSION: 3.2.2.1

jobs:
build_and_test:
strategy:
matrix:
wx_version: [ libwxgtk3.0-gtk3-dev, libwxgtk3.2unofficial-dev ]
name: Build and Test
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Conditionally Add wxWidgets Unofficial Repo
if: contains(matrix.wx_version, 'unofficial')
run: |
sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc
sudo apt-add-repository 'deb https://repos.codelite.org/wx${{ env.WX_WIDGETS_VERSION }}/ubuntu/ jammy universe'
- name: Update Package Info
run: |
sudo apt-get update
- name: Install Dependencies
run: >
sudo apt-get install
autoconf-archive
libwxgtk3.0-gtk3-dev
libgtk-3-dev
${{ matrix.wx_version }}
libnotify-dev
- name: Build Logo
run: |
autoreconf --install
Expand All @@ -48,7 +61,7 @@ jobs:
# Fail the step (and job) if any tests failed or had an error.
run: |
awk '/\.\.\./ && ! /Ok$/{print "::error::"$0}' logo-unit-test-results.txt
awk "/\.\.\./ && ! /Ok$/{exit 1}" logo-unit-test-results.txt
awk "/\.\.\./ && ! /Ok$/{exit 1}" logo-unit-test-results.txt
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions makefile.msys
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ CC = gcc
CFLAGS = -g -O -DHAVE_CONFIG_H -DHAVE_WX -DX_DISPLAY_MISSING -O0
CXX = g++
MINGW_BIN_DIR = /mingw/bin
WX_DIR = $(HOME)/wxWidgets-3.0.5
WX_DIR = $(HOME)/wxWidgets-3.2.2.1
CXXFLAGS = -DHAVE_CONFIG_H -DHAVE_WX -I$(WX_DIR)/include -I$(WX_DIR)/lib/gcc_lib/mswu -D__WXDEBUG__ -D__WXMSW__ -mthreads
LDFLAGS = -mwindows
WX_LIB_LOC = $(WX_DIR)/lib/gcc_lib/
LIBS = -lm -L/usr/local/lib -mwindows -mthreads -mwindows -Wl,--subsystem,windows -mwindows -L$(WX_LIB_LOC) -lwxmsw30u_richtext -lwxmsw30u_aui -lwxmsw30u_html -lwxmsw30u_adv -lwxmsw30u_core -lwxbase30u_net -lwxbase30u -lwxregexu -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32
LIBS = -lm -L/usr/local/lib -mwindows -mthreads -mwindows -Wl,--subsystem,windows -mwindows -L$(WX_LIB_LOC) -lwxmsw32u_richtext -lwxmsw32u_aui -lwxmsw32u_html -lwxmsw32u_adv -lwxmsw32u_core -lwxbase32u_net -lwxbase32u -lwxregexu -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lversion -lshlwapi -luxtheme -loleacc
prefix = /c/ucblogo
BINDIR = $(prefix)/bin
LIBLOC = $(prefix)/lib/logo
Expand Down
2 changes: 1 addition & 1 deletion wxTerminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ extern "C" void color_init(void);
SetMinSize(wxSize(50, 50));

for(i = 0; i < 16; i++)
m_colorPens[i] = wxPen(m_colors[i], 1, wxSOLID);
m_colorPens[i] = wxPen(m_colors[i], 1, wxPENSTYLE_SOLID);

m_printerFN = 0;
m_printerName = 0;
Expand Down
20 changes: 10 additions & 10 deletions wxTurtleGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ TurtleCanvas::TurtleCanvas(wxFrame *parent)

PrepareDC(*m_memDC);
wxBrush myBrush(TurtleCanvas::colors[turtleFrame->back_ground
+SPECIAL_COLORS],wxSOLID);
+SPECIAL_COLORS], wxBRUSHSTYLE_SOLID);
m_memDC->SelectObject(*m_bitmap);
m_memDC->SetBackgroundMode( wxSOLID );
m_memDC->SetBackground( myBrush );
Expand Down Expand Up @@ -359,7 +359,7 @@ void TurtleCanvas::DrawTurtle(wxDC &dc) {
//move_to(screen_x_center + right_x, screen_y_center - right_y);
//line_to(screen_x_center + left_x, screen_y_center - left_y);
dc.SetPen(wxPen(colors[turtleFrame->xgr_pen.color+SPECIAL_COLORS],
turtleFrame->xgr_pen.pw, wxSOLID));
turtleFrame->xgr_pen.pw, wxPENSTYLE_SOLID));
dc.DrawLine(screen_x_center + right_x, screen_y_center - right_y,
screen_x_center + left_x, screen_y_center - left_y);
//line_to(screen_x_center + top_x, screen_y_center - top_y);
Expand Down Expand Up @@ -432,20 +432,20 @@ void TurtleCanvas::drawOneLine(struct line *l, wxDC *dc) {
if (l->pm==PEN_ERASE) {
myPen = wxPen(TurtleCanvas::colors[turtleFrame->back_ground+
SPECIAL_COLORS],
l->pw, wxSOLID);
l->pw, wxPENSTYLE_SOLID);

} else if (l->pm==PEN_REVERSE) {
unsigned int pr, pg, pb, br, bg, bb;
get_palette(l->color, &pr, &pg, &pb);
get_palette(turtleFrame->back_ground, &br, &bg, &bb);
xorColor=wxColour((pr^br)/256, (pg^bg)/256, (pb^bb)/256);
myPen = wxPen(xorColor, l->pw, wxSOLID);
myPen = wxPen(xorColor, l->pw, wxPENSTYLE_SOLID);

} else if(drawToPrinter && turtleFrame->back_ground==0 && l->color==7){
myPen = wxPen( wxT("black"), l->pw, wxSOLID);
myPen = wxPen( wxT("black"), l->pw, wxPENSTYLE_SOLID);
} else {
myPen = wxPen(TurtleCanvas::colors[l->color+SPECIAL_COLORS],
l->pw, wxSOLID);
l->pw, wxPENSTYLE_SOLID);
}
dc->SetPen(myPen);

Expand Down Expand Up @@ -549,7 +549,7 @@ extern "C" pen_info* getPen();

void TurtleCanvas::realClearScreen(wxDC *dc) {
wxBrush myBrush(TurtleCanvas::colors[turtleFrame->back_ground+
SPECIAL_COLORS],wxSOLID);
SPECIAL_COLORS], wxBRUSHSTYLE_SOLID);
if(drawToPrinter && turtleFrame->back_ground==0){
myBrush.SetColour(_T("white"));
}
Expand Down Expand Up @@ -598,13 +598,13 @@ void TurtleCanvas::realdoFilled(int fillcolor, int count,

if(drawToPrinter && turtleFrame->back_ground==0 &&
turtleFrame->xgr_pen.color==7){
myPen = wxPen( wxT("black"), turtleFrame->xgr_pen.pw, wxSOLID);
myPen = wxPen( wxT("black"), turtleFrame->xgr_pen.pw, wxPENSTYLE_SOLID);
} else {
myPen = wxPen(colors[turtleFrame->xgr_pen.color+SPECIAL_COLORS],
turtleFrame->xgr_pen.pw, wxSOLID);
turtleFrame->xgr_pen.pw, wxPENSTYLE_SOLID);
}
dc->SetPen(myPen);
wxBrush brush(TurtleCanvas::colors[fillcolor+SPECIAL_COLORS], wxSOLID);
wxBrush brush(TurtleCanvas::colors[fillcolor+SPECIAL_COLORS], wxBRUSHSTYLE_SOLID);

dc->SetBrush(brush);
dc->DrawPolygon(count, wxpoints);
Expand Down

0 comments on commit b55a983

Please sign in to comment.