wxruby3 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/wxruby3/swig/common.i +8 -0
- data/lib/wx/version.rb +1 -1
- data/rakelib/build.rb +12 -2
- data/rakelib/gem.rake +1 -1
- data/rakelib/install.rb +4 -1
- data/rakelib/lib/config/macosx.rb +32 -7
- data/rakelib/lib/config/mingw.rb +4 -101
- data/rakelib/lib/config/pkgman/linux.rb +31 -8
- data/rakelib/lib/config/pkgman/mingw.rb +112 -0
- data/rakelib/lib/core/package.rb +118 -10
- data/rakelib/lib/director/aui_tab_art.rb +1 -0
- data/rakelib/lib/director/aui_toolbar_art.rb +2 -1
- data/rakelib/lib/director/dc.rb +44 -14
- data/rakelib/lib/director/derived_dc.rb +53 -1
- data/rakelib/lib/director/ribbon_art_provider.rb +2 -0
- data/rakelib/lib/director/richtext_buffer.rb +16 -0
- data/rakelib/lib/director/window.rb +6 -0
- data/tests/test_gdi_object.rb +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '079f38ae02dfcba5a96738f73c678e0d9a5396920739cb370c47d79b6bb81adf'
|
4
|
+
data.tar.gz: 510b7637e541b981deb048d4b0aa3898ea8152900b570ead984dcb9c6daee534
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b3c4ad6e1c31636d658cd9f0d986c57caf6bc6f72af19af449b7d371c3b9af45b229533f1ae3593b7c23b2b29bf74dfaac8e88740fcca0699dc093f40b29d8f
|
7
|
+
data.tar.gz: 827044bb4256d7afc741e77209096cd527f2c77688c0b619fd72cf1ad0bf03992de4e3c60ec93e17795835345b15932ae2773381de85177d941d8b205ab120f7
|
data/README.md
CHANGED
@@ -101,7 +101,7 @@ Currently the following are fully supported:
|
|
101
101
|
|
102
102
|
| Platform | Ruby version(s) | wxWidgets version(s) |
|
103
103
|
|------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|----------------------|
|
104
|
-
| Windows 10
|
104
|
+
| Windows >= 10 | Ruby >= 2.5<br>(RubyInstaller MSYS2-DevKit) | wxWidgets >= 3.2 |
|
105
105
|
| Linux (tested; all major AMD64 and ARM64 distributions: Ubuntu, Debian, Fedora, OpenSuSE and ArchLinux)<br>(most likely also i686) | Ruby >= 2.5 | wxWidgets >= 3.2 |
|
106
106
|
| MacOS >= 10.10 using Cocoa (tested on AMD64 and ARM64 M1/M2 Chip) | Ruby >= 2.5 (MacPorts, Homebrew, ruby-install, RVM) | wxWidgets >= 3.2 |
|
107
107
|
|
data/ext/wxruby3/swig/common.i
CHANGED
@@ -42,6 +42,14 @@
|
|
42
42
|
* wxWidgets we define our own.
|
43
43
|
*/
|
44
44
|
|
45
|
+
#if defined(__GNUC__)
|
46
|
+
# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
47
|
+
# ifndef GCC_HASCLASSVISIBILITY
|
48
|
+
# define GCC_HASCLASSVISIBILITY
|
49
|
+
# endif
|
50
|
+
# endif
|
51
|
+
#endif
|
52
|
+
|
45
53
|
#ifndef WXRB_EXPORT_FLAG
|
46
54
|
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
47
55
|
# if defined(WXRUBY_STATIC_BUILD)
|
data/lib/wx/version.rb
CHANGED
data/rakelib/build.rb
CHANGED
@@ -55,8 +55,18 @@ if WXRuby3.is_bootstrapped?
|
|
55
55
|
pkg.generate_initializer
|
56
56
|
end
|
57
57
|
|
58
|
-
#
|
59
|
-
file pkg.
|
58
|
+
# only for MacOSX
|
59
|
+
file pkg.initializer_loader_src => pkg.initializer_src do
|
60
|
+
pkg.generate_initializer_loader
|
61
|
+
end
|
62
|
+
|
63
|
+
# Target to run the linker to create a final wxruby package shared library (MacOSX only)
|
64
|
+
file pkg.shlib_target => [*pkg.all_obj_files, *pkg.dep_libs] do |t|
|
65
|
+
WXRuby3.config.do_shlib_link(pkg)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Target to run the linker to create a final .so/.dll/.bundle wxruby3 package library
|
69
|
+
file pkg.lib_target => pkg.lib_target_deps do | t |
|
60
70
|
WXRuby3.config.do_link(pkg)
|
61
71
|
end
|
62
72
|
|
data/rakelib/gem.rake
CHANGED
@@ -79,7 +79,7 @@ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do
|
|
79
79
|
gem.add_dependency 'rake'
|
80
80
|
gem.add_dependency 'minitest', '~> 5.15'
|
81
81
|
gem.add_dependency 'test-unit', '~> 3.5'
|
82
|
-
gem.add_dependency 'plat4m', '~> 1.
|
82
|
+
gem.add_dependency 'plat4m', '~> 1.1'
|
83
83
|
gem.rdoc_options <<
|
84
84
|
'--exclude=\\.dll' <<
|
85
85
|
'--exclude=\\.so' <<
|
data/rakelib/install.rb
CHANGED
@@ -152,7 +152,10 @@ module WXRuby3
|
|
152
152
|
[File.join(WXRuby3.config.get_cfg_string('siterubyver'), 'wx'), ['lib/wx'], 0644],
|
153
153
|
]
|
154
154
|
# add wxRuby shared libraries
|
155
|
-
WXRuby3::Director.each_package
|
155
|
+
WXRuby3::Director.each_package do |pkg|
|
156
|
+
specs << [WXRuby3.config.get_cfg_string('siterubyverarch'), [pkg.lib_target], 0555]
|
157
|
+
specs << [WXRuby3.config.get_cfg_string('siterubyverarch'), [pkg.lib_target.sub(/\.#{WXRuby3.config.dll_ext}\Z/, '.dylib')], 0555] if WXRuby3.config.macosx?
|
158
|
+
end
|
156
159
|
if WXRuby3.config.get_config('with-wxwin')
|
157
160
|
specs << [WXRuby3.config.get_cfg_string('siterubyverarch'), Install.wxwin_shlibs, 0555]
|
158
161
|
end
|
@@ -46,6 +46,19 @@ module WXRuby3
|
|
46
46
|
end
|
47
47
|
protected :patch_rpath
|
48
48
|
|
49
|
+
# add deployment lookup paths for wxruby shared libraries
|
50
|
+
# and make loadpath for initializer dylibs relative
|
51
|
+
def update_shlib_loadpaths(shlib)
|
52
|
+
# in case of a .bundle library
|
53
|
+
if /\.bundle\Z/ =~ shlib
|
54
|
+
# change the full path of the complementary initializer .dylib to a path relative to any rpath-s
|
55
|
+
dylib = "lib#{File.basename(shlib, '.bundle')}.dylib"
|
56
|
+
dylib_path = File.expand_path(File.join(Config.instance.dest_dir, dylib))
|
57
|
+
sh("install_name_tool -change #{dylib_path} '@rpath/#{dylib}' #{shlib}")
|
58
|
+
end
|
59
|
+
super
|
60
|
+
end
|
61
|
+
|
49
62
|
# add Ruby library path for wxruby shared libraries
|
50
63
|
def update_shlib_ruby_libpath(shlib)
|
51
64
|
# fix lookup for the Ruby shared library
|
@@ -123,10 +136,23 @@ module WXRuby3
|
|
123
136
|
wx_libset.collect { |s| s.dup }
|
124
137
|
end
|
125
138
|
|
126
|
-
def
|
139
|
+
def do_shlib_link(pkg)
|
127
140
|
objs = pkg.all_obj_files.collect { |o| File.join('..', o) }.join(' ') + ' '
|
128
|
-
|
129
|
-
|
141
|
+
depsh = pkg.dep_libs.join(' ')
|
142
|
+
ldsh = WXRuby3.config.ld.sub(/-bundle/, '')
|
143
|
+
ldsh.sub!(/-dynamic/, '-dynamiclib')
|
144
|
+
sh "cd lib && " +
|
145
|
+
"#{ldsh} #{WXRuby3.config.ldflags(pkg.lib_target)} #{objs} #{depsh} " +
|
146
|
+
"#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.shlib_target}",
|
147
|
+
fail_on_error: true
|
148
|
+
end
|
149
|
+
|
150
|
+
def do_link(pkg)
|
151
|
+
sh "cd lib && " +
|
152
|
+
"#{WXRuby3.config.ld} #{WXRuby3.config.ldflags(pkg.lib_target)} #{File.join('..', pkg.init_obj_file)} " +
|
153
|
+
"-L. -l#{pkg.libname} " +
|
154
|
+
"#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}",
|
155
|
+
fail_on_error: true
|
130
156
|
end
|
131
157
|
|
132
158
|
private
|
@@ -151,15 +177,14 @@ module WXRuby3
|
|
151
177
|
|
152
178
|
if @wx_version
|
153
179
|
@cpp.sub!(/-std=gnu\+\+11/, '-std=gnu++14')
|
154
|
-
|
180
|
+
# on Mac OSX this differs from the wxWidgets linking setup
|
181
|
+
@ld = RB_CONFIG['LDSHAREDXX'] || 'g++ -std=gnu++14 -dynamic -bundle'
|
182
|
+
@ld.sub!(/-std=gnu\+\+11/, '-std=gnu++14')
|
155
183
|
|
156
184
|
@extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-sometimes-uninitialized
|
157
185
|
-Wno-overloaded-virtual -Wno-deprecated-copy]
|
158
186
|
@extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
|
159
187
|
|
160
|
-
# create a .dylib binary
|
161
|
-
@extra_ldflags << '-dynamic -bundle'
|
162
|
-
|
163
188
|
unless @wx_path.empty?
|
164
189
|
libdirs = @wx_libs.select {|s| s.start_with?('-L')}.collect {|s| s.sub(/^-L/,'')}
|
165
190
|
@exec_env['DYLD_LIBRARY_PATH'] = "#{ENV['DYLD_LIBRARY_PATH']}:#{dest_dir}:#{libdirs.join(':')}"
|
data/rakelib/lib/config/mingw.rb
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
###
|
8
8
|
|
9
9
|
require_relative './unixish'
|
10
|
+
require_relative 'pkgman/mingw'
|
10
11
|
|
11
12
|
require 'uri'
|
12
13
|
|
@@ -26,13 +27,6 @@ module WXRuby3
|
|
26
27
|
|
27
28
|
module Platform
|
28
29
|
|
29
|
-
SWIG_URL = 'https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.2.0/swigwin-4.2.0.zip/download'
|
30
|
-
SWIG_ZIP = 'swigwin-4.2.0.zip'
|
31
|
-
|
32
|
-
DOXYGEN_URL = 'https://www.doxygen.nl/files/doxygen-1.10.0.windows.x64.bin.zip'
|
33
|
-
|
34
|
-
GIT_URL = 'https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/MinGit-2.43.0-64-bit.zip'
|
35
|
-
|
36
30
|
def self.included(base)
|
37
31
|
base.class_eval do
|
38
32
|
include Config::UnixLike
|
@@ -85,71 +79,10 @@ module WXRuby3
|
|
85
79
|
|
86
80
|
def install_prerequisites
|
87
81
|
pkg_deps = super
|
88
|
-
|
89
|
-
# autoinstall or not?
|
90
|
-
unless wants_autoinstall?
|
91
|
-
STDERR.puts <<~__ERROR_TXT
|
92
|
-
ERROR: This system lacks installed versions of the following required software packages:
|
93
|
-
#{pkg_deps.join(', ')}
|
94
|
-
|
95
|
-
Install these packages and try again.
|
96
|
-
__ERROR_TXT
|
97
|
-
exit(1)
|
98
|
-
end
|
99
|
-
# if SWIG was not found in the PATH
|
100
|
-
if pkg_deps.include?('swig')
|
101
|
-
$stdout.print 'Installing SWIG...' if run_silent?
|
102
|
-
# download and install SWIG
|
103
|
-
fname = download_and_install(SWIG_URL, SWIG_ZIP, 'swig.exe')
|
104
|
-
$stdout.puts 'done!' if run_silent?
|
105
|
-
Config.instance.log_progress("Installed #{fname}")
|
106
|
-
set_config('swig', fname)
|
107
|
-
Config.save
|
108
|
-
end
|
109
|
-
# if doxygen was not found in the PATH
|
110
|
-
if pkg_deps.include?('doxygen')
|
111
|
-
$stdout.print 'Installing Doxygen...' if run_silent?
|
112
|
-
# download and install doxygen
|
113
|
-
fname = download_and_install(DOXYGEN_URL, File.basename(URI(DOXYGEN_URL).path), 'doxygen.exe', 'doxygen')
|
114
|
-
$stdout.puts 'done!' if run_silent?
|
115
|
-
Config.instance.log_progress("Installed #{fname}")
|
116
|
-
set_config('doxygen', fname)
|
117
|
-
Config.save
|
118
|
-
end
|
119
|
-
# if git was not found in the PATH
|
120
|
-
if pkg_deps.include?('git')
|
121
|
-
$stdout.print 'Installing Git...' if run_silent?
|
122
|
-
# download and install doxygen
|
123
|
-
fname = download_and_install(GIT_URL, File.basename(URI(GIT_URL).path), 'git.exe', 'git')
|
124
|
-
$stdout.puts 'done!' if run_silent?
|
125
|
-
Config.instance.log_progress("Installed #{fname}")
|
126
|
-
set_config('git', fname)
|
127
|
-
Config.save
|
128
|
-
end
|
129
|
-
end
|
82
|
+
PkgManager.install(pkg_deps)
|
130
83
|
[]
|
131
84
|
end
|
132
85
|
|
133
|
-
# only called after src gem build
|
134
|
-
def cleanup_prerequisites
|
135
|
-
tmp_tool_root = File.join(ENV['HOME'].gsub("\\", '/'), '.wxruby3')
|
136
|
-
path = get_cfg_string('swig')
|
137
|
-
unless path.empty? || !path.start_with?(tmp_tool_root)
|
138
|
-
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
|
139
|
-
rm_rf(path)
|
140
|
-
end
|
141
|
-
path = get_cfg_string('doxygen')
|
142
|
-
unless path.empty? || !path.start_with?(tmp_tool_root)
|
143
|
-
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
|
144
|
-
rm_rf(path)
|
145
|
-
end
|
146
|
-
path = get_cfg_string('git')
|
147
|
-
unless path.empty? || !path.start_with?(tmp_tool_root)
|
148
|
-
path = File.dirname(path) while File.dirname(path) != tmp_tool_root
|
149
|
-
rm_rf(path)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
86
|
def expand(cmd)
|
154
87
|
super("bash -c \"#{cmd}\"")
|
155
88
|
end
|
@@ -164,38 +97,8 @@ module WXRuby3
|
|
164
97
|
|
165
98
|
private
|
166
99
|
|
167
|
-
def
|
168
|
-
|
169
|
-
tmp_tool_root = File.join(ENV['HOME'].gsub("\\", '/'), '.wxruby3')
|
170
|
-
dest = unpack_to ? File.join(tmp_tool_root, unpack_to) : File.join(tmp_tool_root, File.basename(zip, '.*'))
|
171
|
-
mkdir(tmp_tool_root) unless File.directory?(tmp_tool_root)
|
172
|
-
# download
|
173
|
-
chdir(tmp_tool_root) do
|
174
|
-
unless download_file(url, zip)
|
175
|
-
STDERR.puts "ERROR: Failed to download installation package for #{exe}"
|
176
|
-
exit(1)
|
177
|
-
end
|
178
|
-
# unpack
|
179
|
-
unless sh("powershell Expand-Archive -LiteralPath '#{zip}' -DestinationPath #{dest} -Force")
|
180
|
-
STDERR.puts "ERROR: Failed to unpack installation package for #{exe}"
|
181
|
-
exit(1)
|
182
|
-
end
|
183
|
-
# cleanup
|
184
|
-
rm_f(zip)
|
185
|
-
end
|
186
|
-
# find executable
|
187
|
-
find_exe(dest, exe)
|
188
|
-
end
|
189
|
-
|
190
|
-
def find_exe(path, exe)
|
191
|
-
fp = Dir.glob(File.join(path, '*')).find { |p| File.file?(p) && File.basename(p) == exe }
|
192
|
-
unless fp
|
193
|
-
Dir.glob(File.join(path, '*')).each do |p|
|
194
|
-
fp = find_exe(p, exe) if File.directory?(p)
|
195
|
-
return fp if fp
|
196
|
-
end
|
197
|
-
end
|
198
|
-
fp
|
100
|
+
def wx_configure
|
101
|
+
bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --without-regex --with-expat=builtin --with-zlib=builtin --disable-debug_info')
|
199
102
|
end
|
200
103
|
|
201
104
|
def wx_make
|
@@ -14,11 +14,33 @@ module WXRuby3
|
|
14
14
|
|
15
15
|
module PkgManager
|
16
16
|
|
17
|
+
class PlatformDependencies
|
18
|
+
def initialize(*defaults)
|
19
|
+
@dependencies = ::Hash.new
|
20
|
+
@dependencies.default = ::Hash.new(defaults.flatten)
|
21
|
+
end
|
22
|
+
|
23
|
+
def add(distro, *deps, release: nil)
|
24
|
+
@dependencies[distro] ||= ::Hash.new
|
25
|
+
if release
|
26
|
+
@dependencies[distro][release] = deps.flatten
|
27
|
+
else
|
28
|
+
@dependencies[distro].default = deps.flatten
|
29
|
+
end
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
def get(distro, release: nil)
|
34
|
+
@dependencies[distro][release]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
17
38
|
PLATFORM_DEPS = {
|
18
|
-
debian: %w[libgtk-3-dev libwebkit2gtk-4.0-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev]
|
19
|
-
|
20
|
-
|
21
|
-
|
39
|
+
debian: PlatformDependencies.new(%w[libgtk-3-dev libwebkit2gtk-4.0-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev])
|
40
|
+
.add('ubuntu', %w[libgtk-3-dev libwebkit2gtk-4.1-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev], release: '24.04'),
|
41
|
+
rhel: PlatformDependencies.new(%w[expat-devel findutils gspell-devel gstreamer1-plugins-base-devel gtk3-devel libcurl-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel]),
|
42
|
+
suse: PlatformDependencies.new(%w[gtk3-devel webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel libjpeg-devel libpng-devel]),
|
43
|
+
arch: PlatformDependencies.new(%w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12])
|
22
44
|
}
|
23
45
|
PLATFORM_ALTS = {
|
24
46
|
suse: { 'g++' => 'gcc-c++' },
|
@@ -41,7 +63,7 @@ module WXRuby3
|
|
41
63
|
|
42
64
|
Make sure the following packages (or equivalent) are installed and than try again with `--no-autoinstall`:
|
43
65
|
#{pkgs.join(', ')}
|
44
|
-
|
66
|
+
__ERROR_TXT
|
45
67
|
exit(1)
|
46
68
|
end
|
47
69
|
# can we install?
|
@@ -63,7 +85,7 @@ module WXRuby3
|
|
63
85
|
#{pkgs.join(', ')}
|
64
86
|
|
65
87
|
Install these packages and try again.
|
66
|
-
|
88
|
+
__ERROR_TXT
|
67
89
|
exit(1)
|
68
90
|
end
|
69
91
|
# do the actual install
|
@@ -73,7 +95,7 @@ module WXRuby3
|
|
73
95
|
#{pkgs.join(', ')}
|
74
96
|
|
75
97
|
Fix any problems or install these packages yourself and try again.
|
76
|
-
|
98
|
+
__ERROR_TXT
|
77
99
|
if WXRuby3.config.run_silent?
|
78
100
|
$stderr.puts "For error details check #{WXRuby3.config.silent_log_name}"
|
79
101
|
end
|
@@ -90,7 +112,8 @@ module WXRuby3
|
|
90
112
|
end
|
91
113
|
|
92
114
|
def platform_pkgs
|
93
|
-
PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym]
|
115
|
+
deps = PLATFORM_DEPS[WXRuby3.config.sysinfo.os.variant.to_sym]
|
116
|
+
deps ? deps.get(WXRuby3.config.sysinfo.os.distro, release: WXRuby3.config.sysinfo.os.release) : []
|
94
117
|
end
|
95
118
|
|
96
119
|
def add_platform_pkgs(pkgs)
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
###
|
6
|
+
# wxRuby3 buildtools platform pkg manager base
|
7
|
+
###
|
8
|
+
|
9
|
+
module WXRuby3
|
10
|
+
|
11
|
+
module Config
|
12
|
+
|
13
|
+
module Platform
|
14
|
+
|
15
|
+
module PkgManager
|
16
|
+
|
17
|
+
XTRA_PLATFORM_DEPS = %w[python]
|
18
|
+
|
19
|
+
class << self
|
20
|
+
|
21
|
+
def install(pkgs)
|
22
|
+
# do we need to install anything?
|
23
|
+
if !pkgs.empty? || builds_wxwidgets?
|
24
|
+
# check windows distro compatibility
|
25
|
+
unless no_autoinstall? || pkgman
|
26
|
+
# do we need to build wxWidgets?
|
27
|
+
pkgs.concat(XTRA_PLATFORM_DEPS) if builds_wxwidgets?
|
28
|
+
$stderr.puts <<~__ERROR_TXT
|
29
|
+
ERROR: Do not know how to install required packages for distro type '#{WXRuby3.config.sysinfo.os.variant}'.
|
30
|
+
|
31
|
+
Make sure the following packages (or equivalent) are installed and than try again with `--no-autoinstall`:
|
32
|
+
#{pkgs.join(', ')}
|
33
|
+
__ERROR_TXT
|
34
|
+
exit(1)
|
35
|
+
end
|
36
|
+
# can we install?
|
37
|
+
unless no_autoinstall? || pkgman
|
38
|
+
$stderr.puts 'ERROR: Do not know how to check for or install required packages. Please install manually and than try again with `--no-autoinstall`.'
|
39
|
+
exit(1)
|
40
|
+
end
|
41
|
+
# do we need to build wxWidgets?
|
42
|
+
if builds_wxwidgets?
|
43
|
+
# add platform specific packages for wxWidgets
|
44
|
+
pkgs.concat(XTRA_PLATFORM_DEPS)
|
45
|
+
end
|
46
|
+
# do we actually have any packages to install?
|
47
|
+
unless pkgs.empty?
|
48
|
+
# autoinstall or not?
|
49
|
+
unless wants_autoinstall?
|
50
|
+
$stderr.puts <<~__ERROR_TXT
|
51
|
+
ERROR: This system may lack installed versions of the following required software packages:
|
52
|
+
#{pkgs.join(', ')}
|
53
|
+
|
54
|
+
Install these packages and try again.
|
55
|
+
__ERROR_TXT
|
56
|
+
exit(1)
|
57
|
+
end
|
58
|
+
# do the actual install
|
59
|
+
unless run(pkgman.make_install_command(*pkgs))
|
60
|
+
$stderr.puts <<~__ERROR_TXT
|
61
|
+
ERROR: Failed to install all or some of the following required software packages:
|
62
|
+
#{pkgs.join(', ')}
|
63
|
+
|
64
|
+
Fix any problems or install these packages yourself and try again.
|
65
|
+
__ERROR_TXT
|
66
|
+
if WXRuby3.config.run_silent?
|
67
|
+
$stderr.puts "For error details check #{WXRuby3.config.silent_log_name}"
|
68
|
+
end
|
69
|
+
exit(1)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def pkgman
|
78
|
+
@pkgman ||= WXRuby3.config.sysinfo.os.pkgman
|
79
|
+
end
|
80
|
+
|
81
|
+
def builds_wxwidgets?
|
82
|
+
Config.get_config('with-wxwin') && Config.get_cfg_string('wxwin').empty?
|
83
|
+
end
|
84
|
+
|
85
|
+
def no_autoinstall?
|
86
|
+
Config.get_config('autoinstall') == false
|
87
|
+
end
|
88
|
+
|
89
|
+
def wants_autoinstall?
|
90
|
+
WXRuby3.config.wants_autoinstall?
|
91
|
+
end
|
92
|
+
|
93
|
+
def run(cmd)
|
94
|
+
$stdout.print "Running #{cmd}..."
|
95
|
+
rc = WXRuby3.config.bash(cmd)
|
96
|
+
$stderr.puts(rc ? 'done!' : 'FAILED!')
|
97
|
+
rc
|
98
|
+
end
|
99
|
+
|
100
|
+
def expand(cmd)
|
101
|
+
`#{is_root? ? '' : 'sudo '}#{cmd}`
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
data/rakelib/lib/core/package.rb
CHANGED
@@ -69,6 +69,10 @@ module WXRuby3
|
|
69
69
|
File.join(Config.instance.dest_dir, "#{libname}.#{Config.instance.dll_ext}")
|
70
70
|
end
|
71
71
|
|
72
|
+
def shlib_target
|
73
|
+
Config.instance.macosx? ? File.join(Config.instance.dest_dir, "lib#{libname}.dylib") : nil
|
74
|
+
end
|
75
|
+
|
72
76
|
def package(pkgname)
|
73
77
|
subpackages[pkgname] ||= Package.new(pkgname, self)
|
74
78
|
end
|
@@ -156,9 +160,30 @@ module WXRuby3
|
|
156
160
|
@all_obj_files
|
157
161
|
end
|
158
162
|
|
163
|
+
# only used for MacOSX
|
164
|
+
def init_obj_file
|
165
|
+
if Config.instance.macosx?
|
166
|
+
File.join(Config.instance.obj_dir, "#{libname}_init_loader.#{Config.instance.obj_ext}")
|
167
|
+
else
|
168
|
+
File.join(Config.instance.obj_dir, "#{libname}_init.#{Config.instance.obj_ext}")
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def lib_target_deps
|
173
|
+
if Config.instance.macosx?
|
174
|
+
[init_obj_file, shlib_target, *dep_libs]
|
175
|
+
else
|
176
|
+
[*all_obj_files, *dep_libs]
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
159
180
|
def dep_libs
|
160
181
|
if parent
|
161
|
-
parent.dep_libs +
|
182
|
+
parent.dep_libs + if Config.instance.macosx?
|
183
|
+
[parent.shlib_target]
|
184
|
+
else
|
185
|
+
[parent.lib_target]
|
186
|
+
end
|
162
187
|
else
|
163
188
|
[]
|
164
189
|
end
|
@@ -176,6 +201,11 @@ module WXRuby3
|
|
176
201
|
File.join(Config.instance.src_dir, "#{libname}_init.cpp")
|
177
202
|
end
|
178
203
|
|
204
|
+
# only for MacOSX
|
205
|
+
def initializer_loader_src
|
206
|
+
File.join(Config.instance.src_dir, "#{libname}_init_loader.cpp")
|
207
|
+
end
|
208
|
+
|
179
209
|
def is_dir_with_fulfilled_deps?(dir, cls_set)
|
180
210
|
if (modreg = Spec.module_registry[dir.spec.module_name]) && !modreg.empty?
|
181
211
|
# check if all base classes are defined previously or part of the same director or outside the current package
|
@@ -286,6 +316,14 @@ module WXRuby3
|
|
286
316
|
fsrc.puts '#include <ruby.h>'
|
287
317
|
fsrc.puts '#include <ruby/version.h>'
|
288
318
|
fsrc.puts <<~__HEREDOC
|
319
|
+
#if defined(__GNUC__)
|
320
|
+
# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
321
|
+
# ifndef GCC_HASCLASSVISIBILITY
|
322
|
+
# define GCC_HASCLASSVISIBILITY
|
323
|
+
# endif
|
324
|
+
# endif
|
325
|
+
#endif
|
326
|
+
|
289
327
|
#ifndef WXRB_EXPORT_FLAG
|
290
328
|
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
291
329
|
# if defined(WXRUBY_STATIC_BUILD)
|
@@ -338,7 +376,11 @@ module WXRuby3
|
|
338
376
|
fsrc.puts '#ifdef __cplusplus'
|
339
377
|
fsrc.puts 'extern "C"'
|
340
378
|
fsrc.puts '#endif'
|
341
|
-
|
379
|
+
if Config.instance.macosx?
|
380
|
+
fsrc.puts "WXRB_EXPORT_FLAG void wxruby_init_#{libname}()"
|
381
|
+
else
|
382
|
+
fsrc.puts "WXRB_EXPORT_FLAG void Init_#{libname}()"
|
383
|
+
end
|
342
384
|
fsrc.puts '{'
|
343
385
|
fsrc.indent do
|
344
386
|
fsrc.puts 'static bool initialized;'
|
@@ -357,7 +399,7 @@ module WXRuby3
|
|
357
399
|
fsrc << <<~__HERDOC
|
358
400
|
// define Enum class
|
359
401
|
wx_define_Enum_class();
|
360
|
-
|
402
|
+
__HERDOC
|
361
403
|
fsrc.puts
|
362
404
|
# generate constant definitions for feature defines from setup.h
|
363
405
|
fsrc.puts %Q{VALUE mWxSetup = rb_define_module_under(#{module_variable}, "Setup");}
|
@@ -391,6 +433,72 @@ module WXRuby3
|
|
391
433
|
generate_event_list if included_directors.any? {|dir| dir.has_events? }
|
392
434
|
end
|
393
435
|
|
436
|
+
# only for MacOSX
|
437
|
+
def generate_initializer_loader
|
438
|
+
STDERR.puts "* generating package #{name} initializer : #{initializer_src}" if Director.verbose?
|
439
|
+
|
440
|
+
Stream.transaction do
|
441
|
+
fsrc = CodeStream.new(initializer_loader_src)
|
442
|
+
fsrc.puts '#include <ruby.h>'
|
443
|
+
fsrc.puts '#include <ruby/version.h>'
|
444
|
+
fsrc.puts <<~__HEREDOC
|
445
|
+
#if defined(__GNUC__)
|
446
|
+
# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
447
|
+
# ifndef GCC_HASCLASSVISIBILITY
|
448
|
+
# define GCC_HASCLASSVISIBILITY
|
449
|
+
# endif
|
450
|
+
# endif
|
451
|
+
#endif
|
452
|
+
|
453
|
+
#ifndef WXRB_EXPORT_FLAG
|
454
|
+
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
455
|
+
# if defined(WXRUBY_STATIC_BUILD)
|
456
|
+
# define WXRB_EXPORT_FLAG
|
457
|
+
# else
|
458
|
+
# define WXRB_EXPORT_FLAG __declspec(dllexport)
|
459
|
+
# endif
|
460
|
+
# else
|
461
|
+
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
462
|
+
# define WXRB_EXPORT_FLAG __attribute__ ((visibility("default")))
|
463
|
+
# else
|
464
|
+
# define WXRB_EXPORT_FLAG
|
465
|
+
# endif
|
466
|
+
# endif
|
467
|
+
#endif
|
468
|
+
|
469
|
+
#ifndef WXRB_IMPORT_FLAG
|
470
|
+
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
471
|
+
# if defined(WXRUBY_STATIC_BUILD)
|
472
|
+
# define WXRB_IMPORT_FLAG
|
473
|
+
# else
|
474
|
+
# define WXRB_IMPORT_FLAG __declspec(dllimport)
|
475
|
+
# endif
|
476
|
+
# else
|
477
|
+
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
|
478
|
+
# define WXRB_IMPORT_FLAG __attribute__ ((visibility("default")))
|
479
|
+
# else
|
480
|
+
# define WXRB_IMPORT_FLAG
|
481
|
+
# endif
|
482
|
+
# endif
|
483
|
+
#endif
|
484
|
+
__HEREDOC
|
485
|
+
fsrc.puts '#ifdef __cplusplus'
|
486
|
+
fsrc.puts 'extern "C"'
|
487
|
+
fsrc.puts '#endif'
|
488
|
+
fsrc.puts "WXRB_IMPORT_FLAG void wxruby_init_#{libname}();"
|
489
|
+
fsrc.puts
|
490
|
+
fsrc.puts '#ifdef __cplusplus'
|
491
|
+
fsrc.puts 'extern "C"'
|
492
|
+
fsrc.puts '#endif'
|
493
|
+
fsrc.puts "WXRB_EXPORT_FLAG void Init_#{libname}()"
|
494
|
+
fsrc.puts '{'
|
495
|
+
fsrc.indent do
|
496
|
+
fsrc.puts "wxruby_init_#{libname}();"
|
497
|
+
end
|
498
|
+
fsrc.puts '}'
|
499
|
+
end
|
500
|
+
end
|
501
|
+
|
394
502
|
def extract(*mods, genint: true)
|
395
503
|
included_directors.each do |dir|
|
396
504
|
dir.extract_interface(genint) if (mods.empty? || mods.include?(dir.spec.name))
|
@@ -420,11 +528,11 @@ module WXRuby3
|
|
420
528
|
raise "Don't know Event class for #{evh_name} event type (from #{item.name})"
|
421
529
|
end
|
422
530
|
fout.puts ' '+<<~__HEREDOC.split("\n").join("\n ")
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
531
|
+
self.register_event_type EventType[
|
532
|
+
'#{evh_name}', #{evt_arity},
|
533
|
+
#{fullname}::#{evt_type},
|
534
|
+
#{fullname}::#{evt_klass.sub(/\Awx/i, '')}
|
535
|
+
] if #{fullname}.const_defined?(:#{evt_type})
|
428
536
|
__HEREDOC
|
429
537
|
evts_handled << evh_name
|
430
538
|
end
|
@@ -562,7 +670,7 @@ module WXRuby3
|
|
562
670
|
|
563
671
|
class EvtHandler
|
564
672
|
|
565
|
-
|
673
|
+
__HEREDOC
|
566
674
|
fdoc.indent(2) do
|
567
675
|
fdoc.doc.puts "@!group #{name} Event handler methods"
|
568
676
|
fdoc.puts
|
@@ -651,7 +759,7 @@ module WXRuby3
|
|
651
759
|
|
652
760
|
end
|
653
761
|
__HEREDOC
|
654
|
-
|
762
|
+
__SCRIPT
|
655
763
|
begin
|
656
764
|
tmpfile = Tempfile.new('script')
|
657
765
|
ftmp_name = tmpfile.path.dup
|
@@ -16,7 +16,8 @@ module WXRuby3
|
|
16
16
|
super
|
17
17
|
spec.items << 'wxAuiDefaultToolBarArt'
|
18
18
|
spec.gc_as_object
|
19
|
-
spec.
|
19
|
+
spec.make_abstract 'wxAuiToolBarArt'
|
20
|
+
spec.disable_proxies
|
20
21
|
spec.suppress_warning(473, 'wxAuiToolBarArt::Clone', 'wxAuiDefaultToolBarArt::Clone')
|
21
22
|
spec.map 'const wxAuiToolBarItemArray&' => 'Array<Wx::AUI::AuiToolBarItem>,nil' do
|
22
23
|
map_in temp: 'wxAuiToolBarItemArray tmp', code: <<~__CODE
|
data/rakelib/lib/director/dc.rb
CHANGED
@@ -16,6 +16,13 @@ module WXRuby3
|
|
16
16
|
|
17
17
|
def setup
|
18
18
|
super
|
19
|
+
_readDC = if Config.instance.wx_version >= '3.3.0'
|
20
|
+
spec.items.unshift 'wxReadOnlyDC' # prepend before wxDC
|
21
|
+
spec.items << 'wxInfoDC'
|
22
|
+
'wxReadOnlyDC'
|
23
|
+
else
|
24
|
+
'wxDC'
|
25
|
+
end
|
19
26
|
spec.items << 'wxFontMetrics'
|
20
27
|
# it's not safe to track DC objects as these are often created on the stack in C++
|
21
28
|
# before being passed to Ruby methods
|
@@ -29,22 +36,24 @@ module WXRuby3
|
|
29
36
|
'wxFontMetrics::externalLeading',
|
30
37
|
'wxFontMetrics::averageWidth'
|
31
38
|
spec.ignore [
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
'wxDC::DrawLines(const wxPointList *,wxCoord,wxCoord)',
|
40
|
+
'wxDC::DrawPolygon(const wxPointList *,wxCoord,wxCoord,wxPolygonFillMode)',
|
41
|
+
'wxDC::DrawSpline(const wxPointList *)',
|
42
|
+
'wxDC::GetHandle'
|
43
|
+
]
|
44
|
+
spec.ignore [
|
45
|
+
"#{_readDC}::GetPartialTextExtents",
|
46
|
+
"#{_readDC}::GetLogicalOrigin(wxCoord *,wxCoord *) const",
|
38
47
|
]
|
48
|
+
spec.rename_for_ruby({
|
49
|
+
'GetDimensions' => "#{_readDC}::GetSize(wxCoord *, wxCoord *) const",
|
50
|
+
'GetDimensionsMM' => "#{_readDC}::GetSizeMM(wxCoord *, wxCoord *) const",
|
51
|
+
'GetTextSize' => "#{_readDC}::GetTextExtent(const wxString &) const",
|
52
|
+
'GetMultiLineTextSize' => "#{_readDC}::GetMultiLineTextExtent(const wxString &) const"
|
53
|
+
})
|
39
54
|
spec.disable_proxies
|
40
55
|
spec.disown 'wxGraphicsContext *ctx'
|
41
|
-
spec.
|
42
|
-
'GetDimensions' => 'wxDC::GetSize(wxCoord *, wxCoord *) const',
|
43
|
-
'GetDimensionsMM' => 'wxDC::GetSizeMM(wxCoord *, wxCoord *) const',
|
44
|
-
'GetTextSize' => 'wxDC::GetTextExtent(const wxString &) const',
|
45
|
-
'GetMultiLineTextSize' => 'wxDC::GetMultiLineTextExtent(const wxString &) const'
|
46
|
-
})
|
47
|
-
spec.add_extend_code 'wxDC', <<~__HEREDOC
|
56
|
+
spec.add_extend_code _readDC, <<~__HEREDOC
|
48
57
|
// Needs to return input parameter with list of lengths
|
49
58
|
VALUE get_partial_text_extents(VALUE text) {
|
50
59
|
wxString str = wxString(StringValuePtr(text), wxConvUTF8);
|
@@ -57,10 +66,31 @@ module WXRuby3
|
|
57
66
|
}
|
58
67
|
return rb_result;
|
59
68
|
}
|
60
|
-
|
69
|
+
__HEREDOC
|
61
70
|
# for GetUserScale and GetLogicalScale
|
62
71
|
spec.map_apply 'double * OUTPUT' => 'double *'
|
63
72
|
spec.swig_import 'swig/classes/include/wxGDICommon.h'
|
73
|
+
if Config.instance.wx_version >= '3.3.0'
|
74
|
+
# add similar block-style creator as #draw_on methods
|
75
|
+
spec.add_extend_code 'wxInfoDC', <<~__HEREDOC
|
76
|
+
static VALUE inform_on(wxWindow* win)
|
77
|
+
{
|
78
|
+
if (!wxRuby_IsAppRunning())
|
79
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
80
|
+
if (!win)
|
81
|
+
rb_raise(rb_eRuntimeError, "A running valid Wx::Window is required for argument.");
|
82
|
+
VALUE rc = Qnil;
|
83
|
+
if (rb_block_given_p ())
|
84
|
+
{
|
85
|
+
wxInfoDC info_dc(win);
|
86
|
+
wxReadOnlyDC* dc_ptr = &info_dc; // wxInfoDC::operator&() returns wxReadOnlyDC*
|
87
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxInfoDC, 0);
|
88
|
+
rc = rb_yield(rb_dc);
|
89
|
+
}
|
90
|
+
return rc;
|
91
|
+
}
|
92
|
+
__HEREDOC
|
93
|
+
end
|
64
94
|
end
|
65
95
|
end # class DC
|
66
96
|
|
@@ -18,6 +18,7 @@ module WXRuby3
|
|
18
18
|
spec.gc_as_untracked spec.module_name
|
19
19
|
case spec.module_name
|
20
20
|
when 'wxScreenDC'
|
21
|
+
spec.override_inheritance_chain('wxScreenDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
21
22
|
spec.make_abstract 'wxScreenDC'
|
22
23
|
# as a ScreenDC should always be a temporary stack object
|
23
24
|
# we do not allow creation in Ruby but rather provide a class
|
@@ -43,6 +44,7 @@ module WXRuby3
|
|
43
44
|
'wxScreenDC::EndDrawingOnTop',
|
44
45
|
'wxScreenDC::wxScreenDC'
|
45
46
|
when 'wxClientDC'
|
47
|
+
spec.override_inheritance_chain('wxClientDC', ['wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
46
48
|
spec.make_abstract 'wxClientDC'
|
47
49
|
spec.ignore 'wxClientDC::wxClientDC'
|
48
50
|
# as a ClientDC should best always be a temporary stack object
|
@@ -65,6 +67,7 @@ module WXRuby3
|
|
65
67
|
}
|
66
68
|
__HEREDOC
|
67
69
|
when 'wxPaintDC'
|
70
|
+
spec.override_inheritance_chain('wxPaintDC', ['wxClientDC', 'wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
68
71
|
spec.make_abstract 'wxPaintDC'
|
69
72
|
spec.ignore 'wxPaintDC::wxPaintDC'
|
70
73
|
spec.add_header_code <<~__HEREDOC
|
@@ -89,7 +92,10 @@ module WXRuby3
|
|
89
92
|
__HEREDOC
|
90
93
|
when 'wxMemoryDC'
|
91
94
|
spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC'
|
95
|
+
spec.override_inheritance_chain('wxMemoryDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
92
96
|
spec.gc_as_untracked %w[wxBufferedDC wxBufferedPaintDC]
|
97
|
+
spec.override_inheritance_chain('wxBufferedDC', ['wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
98
|
+
spec.override_inheritance_chain('wxBufferedPaintDC', ['wxBufferedDC', 'wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
93
99
|
spec.make_abstract 'wxMemoryDC'
|
94
100
|
spec.make_abstract 'wxBufferedDC'
|
95
101
|
spec.make_abstract 'wxBufferedPaintDC'
|
@@ -218,6 +224,7 @@ module WXRuby3
|
|
218
224
|
}
|
219
225
|
__HEREDOC
|
220
226
|
when 'wxMirrorDC'
|
227
|
+
spec.override_inheritance_chain('wxMirrorDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
221
228
|
spec.make_abstract 'wxMirrorDC'
|
222
229
|
spec.ignore 'wxMirrorDC::wxMirrorDC'
|
223
230
|
# as a MirrorDC should best always be a temporary stack object
|
@@ -240,6 +247,7 @@ module WXRuby3
|
|
240
247
|
}
|
241
248
|
__HEREDOC
|
242
249
|
when 'wxSVGFileDC'
|
250
|
+
spec.override_inheritance_chain('wxSVGFileDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
243
251
|
spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler]
|
244
252
|
spec.make_abstract 'wxSVGFileDC'
|
245
253
|
spec.ignore 'wxSVGFileDC::wxSVGFileDC'
|
@@ -277,6 +285,7 @@ module WXRuby3
|
|
277
285
|
'wxSVGFileDC::StartPage',
|
278
286
|
'wxSVGFileDC::EndPage'
|
279
287
|
when 'wxGCDC'
|
288
|
+
spec.override_inheritance_chain('wxGCDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
280
289
|
spec.make_abstract 'wxGCDC'
|
281
290
|
spec.ignore 'wxGCDC::wxGCDC'
|
282
291
|
# like all DC this should best always be a temporary stack object
|
@@ -382,7 +391,11 @@ module WXRuby3
|
|
382
391
|
spec.ignore 'wxGCDC::wxGCDC(const wxEnhMetaFileDC &)'
|
383
392
|
when 'wxScaledDC'
|
384
393
|
spec.items.clear # wxRuby extension; no XML docs
|
385
|
-
|
394
|
+
if Config.instance.wx_version >= '3.3.0'
|
395
|
+
spec.override_inheritance_chain('wxScaledDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject'])
|
396
|
+
else
|
397
|
+
spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
|
398
|
+
end
|
386
399
|
# as there are no dependencies parsed from XML make sure we're initialized after Wx::DC
|
387
400
|
spec.initialize_at_end = true
|
388
401
|
spec.no_proxy 'wxScaledDC'
|
@@ -422,6 +435,7 @@ module WXRuby3
|
|
422
435
|
};
|
423
436
|
__HEREDOC
|
424
437
|
when 'wxPrinterDC'
|
438
|
+
spec.override_inheritance_chain('wxPrinterDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
425
439
|
spec.make_abstract 'wxPrinterDC'
|
426
440
|
spec.ignore 'wxPrinterDC::wxPrinterDC'
|
427
441
|
# as a PrinterDC should best always be a temporary stack object
|
@@ -444,6 +458,7 @@ module WXRuby3
|
|
444
458
|
}
|
445
459
|
__HEREDOC
|
446
460
|
when 'wxPostScriptDC'
|
461
|
+
spec.override_inheritance_chain('wxPostScriptDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
447
462
|
spec.make_abstract 'wxPostScriptDC'
|
448
463
|
spec.ignore 'wxPostScriptDC::wxPostScriptDC'
|
449
464
|
# as a PostScriptDC should best always be a temporary stack object
|
@@ -499,7 +514,44 @@ module WXRuby3
|
|
499
514
|
return rc;
|
500
515
|
}
|
501
516
|
__HEREDOC
|
517
|
+
if Config.instance.wx_version >= '3.3.0'
|
518
|
+
spec.items << 'wxOverlayDC'
|
519
|
+
spec.override_inheritance_chain('wxOverlayDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject'])
|
520
|
+
spec.make_abstract 'wxOverlayDC'
|
521
|
+
spec.ignore 'wxOverlayDC::wxOverlayDC'
|
522
|
+
spec.add_extend_code 'wxOverlayDC', <<~__HEREDOC
|
523
|
+
static VALUE draw_on(wxOverlay &overlay, wxWindow *win)
|
524
|
+
{
|
525
|
+
if (!wxRuby_IsAppRunning())
|
526
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
527
|
+
VALUE rc = Qnil;
|
528
|
+
if (rb_block_given_p ())
|
529
|
+
{
|
530
|
+
wxOverlayDC ovl_dc(overlay, win);
|
531
|
+
wxOverlayDC* ovl_dc_ptr = &ovl_dc;
|
532
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxOverlayDC, 0);
|
533
|
+
rc = rb_yield(rb_dc);
|
534
|
+
}
|
535
|
+
return rc;
|
536
|
+
}
|
537
|
+
static VALUE draw_on(wxOverlay &overlay, wxWindow *win, const wxRect &rect)
|
538
|
+
{
|
539
|
+
if (!wxRuby_IsAppRunning())
|
540
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
541
|
+
VALUE rc = Qnil;
|
542
|
+
if (rb_block_given_p ())
|
543
|
+
{
|
544
|
+
wxOverlayDC ovl_dc(overlay, win, rect);
|
545
|
+
wxOverlayDC* ovl_dc_ptr = &ovl_dc;
|
546
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxOverlayDC, 0);
|
547
|
+
rc = rb_yield(rb_dc);
|
548
|
+
}
|
549
|
+
return rc;
|
550
|
+
}
|
551
|
+
__HEREDOC
|
552
|
+
end
|
502
553
|
else
|
554
|
+
spec.override_inheritance_chain(spec.module_name, ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
|
503
555
|
# ctors of all other derived DC require a running App
|
504
556
|
spec.require_app spec.module_name
|
505
557
|
end
|
@@ -16,7 +16,9 @@ module WXRuby3
|
|
16
16
|
spec.items << 'wxRibbonPageTabInfo' << 'wxRibbonMSWArtProvider' << 'wxRibbonAUIArtProvider'
|
17
17
|
super
|
18
18
|
spec.gc_as_object 'wxRibbonArtProvider'
|
19
|
+
spec.make_abstract 'wxRibbonArtProvider'
|
19
20
|
spec.gc_as_untracked 'wxRibbonPageTabInfo'
|
21
|
+
spec.disable_proxies
|
20
22
|
spec.suppress_warning(473,
|
21
23
|
'wxRibbonArtProvider::Clone',
|
22
24
|
'wxRibbonMSWArtProvider::Clone',
|
@@ -20,6 +20,22 @@ module WXRuby3
|
|
20
20
|
super
|
21
21
|
spec.items << 'wxRichTextFontTable' << 'wxRichTextFieldType' << 'wxRichTextFieldTypeStandard' << 'wxRichTextDrawingHandler'
|
22
22
|
spec.make_abstract 'wxRichTextFieldType'
|
23
|
+
if Config.instance.wx_version >= '3.3.0'
|
24
|
+
# make Ruby director and wrappers use custom implementation
|
25
|
+
spec.use_class_implementation('wxRichTextFieldType', 'wxRubyRichTextFieldType')
|
26
|
+
spec.add_header_code <<~__HEREDOC
|
27
|
+
class wxRubyRichTextFieldType : public wxRichTextFieldType
|
28
|
+
{
|
29
|
+
public:
|
30
|
+
virtual ~wxRubyRichTextFieldType() {}
|
31
|
+
wxRubyRichTextFieldType(const wxString &name=wxEmptyString) : wxRichTextFieldType(name) {}
|
32
|
+
wxRubyRichTextFieldType(const wxRichTextFieldType &fieldType) : wxRichTextFieldType(fieldType) {}
|
33
|
+
virtual bool Draw(wxRichTextField *, wxDC &, wxRichTextDrawingContext &, const wxRichTextRange &, const wxRichTextSelection &, const wxRect &, int , int ) { return false; }
|
34
|
+
virtual bool Layout(wxRichTextField *, wxReadOnlyDC &, wxRichTextDrawingContext &, const wxRect &, const wxRect &, int) { return false; }
|
35
|
+
virtual bool GetRangeSize(wxRichTextField *, const wxRichTextRange &, wxSize &, int &, wxReadOnlyDC &, wxRichTextDrawingContext &, int, const wxPoint &, const wxSize &, wxArrayInt *) const { return false; }
|
36
|
+
};
|
37
|
+
__HEREDOC
|
38
|
+
end
|
23
39
|
spec.no_proxy 'wxRichTextFontTable'
|
24
40
|
spec.include 'wx/richtext/richtextstyles.h'
|
25
41
|
spec.ignore %w[
|
@@ -120,6 +120,7 @@ module WXRuby3
|
|
120
120
|
end
|
121
121
|
if Config.instance.wx_version >= '3.3.0'
|
122
122
|
spec.ignore_unless('WXMSW', 'wxWindow::MSWDisableComposited')
|
123
|
+
spec.ignore('wxWindow::GTKGetWin32Handle')
|
123
124
|
end
|
124
125
|
if Config.instance.features_set?('USE_ACCESSIBILITY')
|
125
126
|
spec.disown 'wxAccessible *accessible'
|
@@ -315,6 +316,11 @@ module WXRuby3
|
|
315
316
|
"#{spec.class_name(citem)}::WarpPointer",
|
316
317
|
"#{spec.class_name(citem)}::AdjustForLayoutDirection",
|
317
318
|
"#{spec.class_name(citem)}::IsTransparentBackgroundSupported")
|
319
|
+
if Config.instance.features_set?('USE_ACCESSIBILITY')
|
320
|
+
if Config.instance.wx_version > '3.2.4'
|
321
|
+
spec.no_proxy "#{spec.class_name(citem)}::CreateAccessible"
|
322
|
+
end
|
323
|
+
end
|
318
324
|
end
|
319
325
|
end
|
320
326
|
if spec.module_name == 'wxWindow'
|
data/tests/test_gdi_object.rb
CHANGED
@@ -12,14 +12,14 @@ class TestGDIObjects < Test::Unit::TestCase
|
|
12
12
|
frame = Wx::Frame.new(nil)
|
13
13
|
frame.set_icon(ico)
|
14
14
|
GC.start
|
15
|
-
ico_cpy = frame.
|
15
|
+
ico_cpy = frame.get_icons.get_icon_by_index(0)
|
16
16
|
GC.start
|
17
17
|
assert(ico_cpy.ok?)
|
18
18
|
assert_not_equal(ico.object_id, ico_cpy.object_id)
|
19
19
|
ico = nil
|
20
20
|
ico_cpy = nil
|
21
21
|
GC.start
|
22
|
-
ico_cpy = frame.
|
22
|
+
ico_cpy = frame.get_icons.get_icon_by_index(0)
|
23
23
|
GC.start
|
24
24
|
assert(ico_cpy.ok?)
|
25
25
|
assert_not_equal(ico.object_id, ico_cpy.object_id)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wxruby3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Corino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.1'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.1'
|
83
83
|
description: wxRuby3 is a Ruby library providing an extension for the wxWidgets C++
|
84
84
|
UI framework
|
85
85
|
email: mcorino@m2c-software.nl
|
@@ -425,6 +425,7 @@ files:
|
|
425
425
|
- rakelib/lib/config/mingw.rb
|
426
426
|
- rakelib/lib/config/pkgman/linux.rb
|
427
427
|
- rakelib/lib/config/pkgman/macosx.rb
|
428
|
+
- rakelib/lib/config/pkgman/mingw.rb
|
428
429
|
- rakelib/lib/config/unixish.rb
|
429
430
|
- rakelib/lib/config/unknown.rb
|
430
431
|
- rakelib/lib/core/include/client_data.inc
|
@@ -1190,7 +1191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1190
1191
|
- !ruby/object:Gem::Version
|
1191
1192
|
version: '0'
|
1192
1193
|
requirements: []
|
1193
|
-
rubygems_version: 3.5.
|
1194
|
+
rubygems_version: 3.5.11
|
1194
1195
|
signing_key:
|
1195
1196
|
specification_version: 4
|
1196
1197
|
summary: wxWidgets extension for Ruby
|