wxruby3 0.9.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +183 -42
- data/README.md +40 -48
- data/ext/mkrf_conf_ext.rb +72 -0
- data/lib/wx/core/app.rb +16 -0
- data/lib/wx/core/colour.rb +36 -28
- data/lib/wx/core/const.rb +19 -0
- data/lib/wx/core/enum.rb +17 -1
- data/lib/wx/core/geometry.rb +121 -0
- data/lib/wx/core/graphics_pen_info.rb +18 -0
- data/lib/wx/core/image.rb +49 -0
- data/lib/wx/core/menu_bar.rb +11 -0
- data/lib/wx/core/paintdc.rb +9 -3
- data/lib/wx/core/secret_store.rb +38 -0
- data/lib/wx/doc/app.rb +97 -41
- data/lib/wx/doc/bitmap.rb +4 -0
- data/lib/wx/doc/client_dc.rb +2 -2
- data/lib/wx/doc/clipboard.rb +1 -1
- data/lib/wx/doc/colour.rb +12 -0
- data/lib/wx/doc/const.rb +16 -0
- data/lib/wx/doc/cursor.rb +4 -0
- data/lib/wx/doc/dc_overlay.rb +34 -0
- data/lib/wx/doc/enum.rb +7 -1
- data/lib/wx/doc/event_blocker.rb +1 -1
- data/lib/wx/doc/evthandler.rb +25 -3
- data/lib/wx/doc/functions.rb +3 -6
- data/lib/wx/doc/gc_dc.rb +13 -4
- data/lib/wx/doc/geometry.rb +136 -0
- data/lib/wx/doc/graphics_context.rb +25 -7
- data/lib/wx/doc/icon.rb +4 -0
- data/lib/wx/doc/image.rb +56 -0
- data/lib/wx/doc/list_ctrl.rb +6 -6
- data/lib/wx/doc/memory_dc.rb +2 -11
- data/lib/wx/doc/mirror_dc.rb +1 -1
- data/lib/wx/doc/pen.rb +26 -0
- data/lib/wx/doc/persistence_manager.rb +1 -1
- data/lib/wx/doc/persistent_object.rb +1 -1
- data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
- data/lib/wx/doc/prt/printer_dc.rb +2 -2
- data/lib/wx/doc/region_iterator.rb +1 -1
- data/lib/wx/doc/scaled_dc.rb +1 -1
- data/lib/wx/doc/screen_dc.rb +1 -1
- data/lib/wx/doc/secret_store.rb +55 -0
- data/lib/wx/doc/svg_file_dc.rb +1 -1
- data/lib/wx/doc/textctrl.rb +1 -1
- data/lib/wx/doc/tree_ctrl.rb +2 -2
- data/lib/wx/doc/validator.rb +6 -6
- data/lib/wx/doc/variant.rb +2 -2
- data/lib/wx/doc/window.rb +5 -4
- data/lib/wx/grid/keyword_defs.rb +1 -1
- data/lib/wx/html/keyword_defs.rb +3 -3
- data/lib/wx/keyword_defs.rb +76 -71
- data/lib/wx/pg/keyword_defs.rb +2 -2
- data/lib/wx/pg/pg_property.rb +12 -0
- data/lib/wx/rbn/keyword_defs.rb +1 -1
- data/lib/wx/rtc/keyword_defs.rb +1 -1
- data/lib/wx/stc/keyword_defs.rb +1 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/base.rb +3 -5
- data/lib/wx/wxruby/cmd/check.rb +182 -0
- data/lib/wx/wxruby/cmd/sampler.rb +1 -1
- data/lib/wx/wxruby/cmd/setup.rb +9 -3
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- data/rakelib/configure.rb +67 -52
- data/rakelib/gem.rake +97 -66
- data/rakelib/gem.rb +294 -41
- data/rakelib/install.rb +3 -3
- data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
- data/rakelib/lib/config/linux.rb +4 -2
- data/rakelib/lib/config/macosx.rb +42 -11
- data/rakelib/lib/config/mingw.rb +2 -2
- data/rakelib/lib/config/pkgman/{base.rb → linux.rb} +36 -61
- data/rakelib/lib/config/pkgman/macosx.rb +17 -78
- data/rakelib/lib/config/unixish.rb +17 -8
- data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
- data/rakelib/lib/config.rb +74 -33
- data/rakelib/lib/core/include/enum.inc +31 -1
- data/rakelib/lib/director/affine_matrix.rb +51 -0
- data/rakelib/lib/director/app.rb +29 -13
- data/rakelib/lib/director/art_provider.rb +4 -0
- data/rakelib/lib/director/aui_manager.rb +1 -1
- data/rakelib/lib/director/cursor.rb +6 -2
- data/rakelib/lib/director/dc.rb +1 -6
- data/rakelib/lib/director/derived_dc.rb +88 -31
- data/rakelib/lib/director/geometry.rb +142 -0
- data/rakelib/lib/director/graphics_context.rb +3 -2
- data/rakelib/lib/director/graphics_object.rb +18 -25
- data/rakelib/lib/director/grid_ctrl.rb +2 -2
- data/rakelib/lib/director/image.rb +59 -0
- data/rakelib/lib/director/menu.rb +2 -3
- data/rakelib/lib/director/menu_bar.rb +0 -3
- data/rakelib/lib/director/pen.rb +1 -1
- data/rakelib/lib/director/richtext_composite_object.rb +2 -4
- data/rakelib/lib/director/richtext_ctrl.rb +1 -1
- data/rakelib/lib/director/secret_store.rb +117 -0
- data/rakelib/lib/director/system_settings.rb +1 -1
- data/rakelib/lib/director/tree_event.rb +2 -2
- data/rakelib/lib/director/window.rb +4 -3
- data/rakelib/lib/extractor/function.rb +1 -1
- data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
- data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
- data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
- data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
- data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
- data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
- data/rakelib/lib/generate/doc/icon.yaml +10 -0
- data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
- data/rakelib/lib/generate/doc/log.yaml +1 -1
- data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
- data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
- data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
- data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
- data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
- data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
- data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
- data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
- data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
- data/rakelib/lib/generate/doc/wizard.yaml +27 -0
- data/rakelib/lib/generate/doc.rb +5 -5
- data/rakelib/lib/generate/interface.rb +1 -1
- data/rakelib/lib/specs/interfaces.rb +4 -0
- data/rakelib/lib/swig_runner.rb +24 -3
- data/rakelib/lib/typemap/common.rb +10 -0
- data/rakelib/lib/typemap/points_list.rb +8 -2
- data/rakelib/lib/typemap/richtext.rb +17 -0
- data/rakelib/prepost.rake +8 -1
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +4 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
- data/samples/dialogs/wizard.rb +20 -19
- data/samples/drawing/art/drawing/image.bmp +0 -0
- data/samples/drawing/art/drawing/mask.bmp +0 -0
- data/samples/drawing/art/drawing/pat35.bmp +0 -0
- data/samples/drawing/art/drawing/pat36.bmp +0 -0
- data/samples/drawing/art/drawing/pat4.bmp +0 -0
- data/samples/drawing/art/drawing/smile.xpm +42 -0
- data/samples/drawing/drawing.rb +2276 -0
- data/samples/drawing/tn_drawing.png +0 -0
- data/samples/html/html.rb +1 -1
- data/samples/propgrid/propgrid.rb +1 -1
- data/samples/propgrid/propgrid_minimal.rb +1 -1
- data/samples/propgrid/sample_props.rb +1 -1
- data/samples/sampler/editor.rb +13 -11
- data/samples/sampler/sample.rb +2 -0
- data/samples/sampler.rb +14 -10
- data/samples/text/richtext.rb +53 -0
- data/samples/text/scintilla.rb +1 -1
- data/samples/text/unicode.rb +4 -4
- data/tests/lib/wxapp_runner.rb +1 -1
- data/tests/test_config.rb +7 -4
- data/tests/test_ext_controls.rb +12 -5
- data/tests/test_secret_store.rb +83 -0
- data/tests/test_std_controls.rb +12 -12
- metadata +66 -47
- data/lib/wx/doc/extra/00_starting.md +0 -154
- data/lib/wx/doc/extra/01_packages.md +0 -180
- data/lib/wx/doc/extra/02_lifecycles.md +0 -166
- data/lib/wx/doc/extra/03_dialogs.md +0 -57
- data/lib/wx/doc/extra/04_enums.md +0 -143
- data/lib/wx/doc/extra/05_event-handling.md +0 -191
- data/lib/wx/doc/extra/06_geometry.md +0 -62
- data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
- data/lib/wx/doc/extra/08_extensions.md +0 -144
- data/lib/wx/doc/extra/09_exceptions.md +0 -54
- data/lib/wx/doc/extra/10_art.md +0 -111
- data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
- data/lib/wx/doc/extra/12_client_data.md +0 -89
- data/lib/wx/doc/extra/13_validators.md +0 -139
- data/lib/wx/doc/extra/14_config.md +0 -101
- data/lib/wx/doc/extra/15_persistence.md +0 -148
- data/rakefile +0 -14
- data/rakelib/lib/config/pkgman/arch.rb +0 -53
- data/rakelib/lib/config/pkgman/debian.rb +0 -66
- data/rakelib/lib/config/pkgman/rhel.rb +0 -54
- data/rakelib/lib/config/pkgman/suse.rb +0 -54
- data/samples/sampler/back.xpm +0 -21
- data/samples/sampler/copy.xpm +0 -44
- data/samples/sampler/cut.xpm +0 -46
- data/samples/sampler/filesave.xpm +0 -42
- data/samples/sampler/find.xpm +0 -62
- data/samples/sampler/findrepl.xpm +0 -63
- data/samples/sampler/forward.xpm +0 -21
- data/samples/sampler/paste.xpm +0 -46
- data/samples/sampler/redo.xpm +0 -58
- data/samples/sampler/undo.xpm +0 -58
@@ -18,7 +18,7 @@ module WXRuby3
|
|
18
18
|
|
19
19
|
def install(pkgs)
|
20
20
|
# do we need to install anything?
|
21
|
-
|
21
|
+
unless pkgs.empty?
|
22
22
|
# can we install XCode commandline tools?
|
23
23
|
unless no_autoinstall? || !pkgs.include?('xcode') || has_sudo? || is_root?
|
24
24
|
STDERR.puts 'ERROR: Cannot check for or install required packages. Please install sudo or run as root and try again.'
|
@@ -50,18 +50,20 @@ module WXRuby3
|
|
50
50
|
|
51
51
|
private
|
52
52
|
|
53
|
+
def pkgman
|
54
|
+
@pkgman ||= WXRuby3.config.sysinfo.os.pkgman
|
55
|
+
end
|
56
|
+
|
53
57
|
def do_install(pkgs)
|
54
58
|
rc = true
|
55
59
|
# first see if we need to install XCode commandline tools
|
56
60
|
if pkgs.include?('xcode')
|
57
61
|
pkgs.delete('xcode')
|
58
|
-
rc =
|
62
|
+
rc = auth_run('xcode-select --install')
|
59
63
|
end
|
60
|
-
# now check if we need any other packages
|
64
|
+
# now check if we need any other packages
|
61
65
|
if rc && !pkgs.empty?
|
62
|
-
|
63
|
-
if has_macports? &&
|
64
|
-
(ruby_info = expand('port -q installed installed').strip.split("\n").find { |ln| ln.strip =~ /\Aruby\d+\s/ })
|
66
|
+
if pkgman.macports?
|
65
67
|
|
66
68
|
# this is really crap; with MacPorts we need to install swig-ruby instead of simply swig
|
67
69
|
# which for whatever nonsensical reason will pull in another (older) Ruby version (probably 2.3 or such)
|
@@ -70,59 +72,15 @@ module WXRuby3
|
|
70
72
|
pkgs.delete('swig')
|
71
73
|
pkgs << 'swig-ruby'
|
72
74
|
end
|
73
|
-
# in case MacPorts was installed with root privileges this install would also have to be run
|
74
|
-
# with root privileges (otherwise it would fail early on with access problems) so we can
|
75
|
-
# just run without sudo as we either have root privileges for root-installed MacPorts or
|
76
|
-
# we're running without root privileges for user-installed MacPorts
|
77
|
-
pkgs.each { |pkg| rc &&= sh("port install #{pkg}") }
|
78
|
-
|
79
|
-
# or are we running without root privileges and have Homebrew installed?
|
80
|
-
# (Ruby may be installed using Homebrew itself or using a Ruby version manager like RVM)
|
81
|
-
elsif !is_root? && has_homebrew?
|
82
75
|
|
83
|
-
pkgs.each { |pkg| rc &&= sh("brew install #{pkg}") }
|
84
|
-
|
85
|
-
# or do we have MacPorts (running either privileged or not) and
|
86
|
-
# a Ruby installed using a Ruby version manager.
|
87
|
-
elsif has_macports?
|
88
|
-
|
89
|
-
# same crap as above
|
90
|
-
if pkgs.include?('swig')
|
91
|
-
pkgs.delete('swig')
|
92
|
-
pkgs << 'swig-ruby'
|
93
|
-
end
|
94
|
-
# in case MacPorts was installed with root privileges this install would also have to be run
|
95
|
-
# with root privileges (otherwise it would fail early on with access problems) so we can
|
96
|
-
# just run without sudo as we either have root privileges for root-installed MacPorts or
|
97
|
-
# we're running without root privileges for user-installed MacPorts
|
98
|
-
pkgs.each { |pkg| rc &&= sh("port install #{pkg}") }
|
99
|
-
|
100
|
-
else
|
101
|
-
if has_homebrew? || is_root?
|
102
|
-
$stderr.puts <<~__ERROR_TXT
|
103
|
-
ERROR: Unsupported Ruby installation. wxRuby3 can only be installed for Ruby with root privileges
|
104
|
-
in case Ruby was installed with MacPorts. Homebrew should not be run with root privileges.
|
105
|
-
|
106
|
-
Re-install a supported Ruby setup and try again.
|
107
|
-
__ERROR_TXT
|
108
|
-
else
|
109
|
-
$stderr.puts <<~__ERROR_TXT
|
110
|
-
ERROR: Unsupported Ruby installation. wxRuby3 requires either a MacPorts installed Ruby version
|
111
|
-
or a non-privileged Ruby installation and have Homebrew installed.
|
112
|
-
|
113
|
-
Install either Homebrew or MacPorts and try again.
|
114
|
-
__ERROR_TXT
|
115
|
-
end
|
116
|
-
exit(1)
|
117
76
|
end
|
77
|
+
|
78
|
+
# actually install packages
|
79
|
+
pkgs.each { |pkg| rc &&= run(pkgman.make_install_command(pkg)); break unless rc }
|
118
80
|
end
|
119
81
|
rc
|
120
82
|
end
|
121
83
|
|
122
|
-
def builds_wxwidgets?
|
123
|
-
Config.get_config('with-wxwin') && Config.get_cfg_string('wxwin').empty?
|
124
|
-
end
|
125
|
-
|
126
84
|
def no_autoinstall?
|
127
85
|
Config.get_config('autoinstall') == false
|
128
86
|
end
|
@@ -132,46 +90,27 @@ module WXRuby3
|
|
132
90
|
end
|
133
91
|
|
134
92
|
def has_sudo?
|
135
|
-
|
93
|
+
WXRuby3.config.sysinfo.os.has_sudo?
|
136
94
|
end
|
137
95
|
|
138
96
|
def is_root?
|
139
|
-
|
140
|
-
@is_root = (`id -u 2>/dev/null`.chomp == '0')
|
141
|
-
end
|
142
|
-
@is_root
|
143
|
-
end
|
144
|
-
|
145
|
-
def has_macports?
|
146
|
-
if @has_macports.nil?
|
147
|
-
@has_macports = system('command -v port>/dev/null')
|
148
|
-
end
|
97
|
+
WXRuby3.config.sysinfo.os.is_root?
|
149
98
|
end
|
150
99
|
|
151
|
-
def
|
152
|
-
if @has_homebrew.nil?
|
153
|
-
@has_homebrew = system('command -v brew>/dev/null')
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def run(cmd)
|
100
|
+
def auth_run(cmd)
|
158
101
|
$stdout.print "Running #{cmd}..."
|
159
102
|
rc = WXRuby3.config.sh("#{is_root? ? '' : 'sudo '}#{cmd}")
|
160
|
-
$stderr.puts
|
103
|
+
$stderr.puts(rc ? 'done!' : 'FAILED!')
|
161
104
|
rc
|
162
105
|
end
|
163
106
|
|
164
|
-
def
|
107
|
+
def run(*cmd, title: nil)
|
165
108
|
$stdout.print(title ? title : "Running #{cmd}...")
|
166
109
|
rc = WXRuby3.config.sh(*cmd)
|
167
|
-
$stderr.puts
|
110
|
+
$stderr.puts(rc ? 'done!' : 'FAILED!')
|
168
111
|
rc
|
169
112
|
end
|
170
113
|
|
171
|
-
def expand(cmd)
|
172
|
-
WXRuby3.config.expand(cmd)
|
173
|
-
end
|
174
|
-
|
175
114
|
end
|
176
115
|
|
177
116
|
end
|
@@ -66,6 +66,12 @@ module WXRuby3
|
|
66
66
|
def get_rpath_origin
|
67
67
|
"$ORIGIN"
|
68
68
|
end
|
69
|
+
protected :get_rpath_origin
|
70
|
+
|
71
|
+
# add deployment lookup paths for wxruby shared libraries
|
72
|
+
def update_shlib_loadpaths(shlib)
|
73
|
+
WXRuby3.config.patch_rpath(shlib, WXRuby3.config.get_rpath_origin, "#{WXRuby3.config.get_rpath_origin}/../ext")
|
74
|
+
end
|
69
75
|
|
70
76
|
def expand(cmd)
|
71
77
|
STDERR.puts "> sh: #{cmd}" if verbose?
|
@@ -74,6 +80,10 @@ module WXRuby3
|
|
74
80
|
s
|
75
81
|
end
|
76
82
|
|
83
|
+
def download_file(url, dest)
|
84
|
+
sh("curl -L #{url} --output #{dest}")
|
85
|
+
end
|
86
|
+
|
77
87
|
private
|
78
88
|
|
79
89
|
def wx_checkout
|
@@ -82,11 +92,10 @@ module WXRuby3
|
|
82
92
|
chdir(ext_path) do
|
83
93
|
if (rc = sh("#{get_cfg_string('git')} clone https://github.com/wxWidgets/wxWidgets.git"))
|
84
94
|
chdir('wxWidgets') do
|
85
|
-
tag =
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
95
|
+
tag = wx_gitref ||
|
96
|
+
expand("#{get_cfg_string('git')} tag").split("\n").select do |t|
|
97
|
+
(/\Av(\d+)\.(\d+)\.\d+\Z/ =~ t) && (($1.to_i == 3 && $2.to_i >= 2) || $1.to_i > 3)
|
98
|
+
end.max
|
90
99
|
# checkout the version we are building against
|
91
100
|
rc = sh("#{get_cfg_string('git')} checkout #{tag}")
|
92
101
|
end
|
@@ -101,7 +110,7 @@ module WXRuby3
|
|
101
110
|
end
|
102
111
|
|
103
112
|
def wx_configure
|
104
|
-
bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info')
|
113
|
+
bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --without-regex --disable-debug_info')
|
105
114
|
end
|
106
115
|
|
107
116
|
def wx_make
|
@@ -210,8 +219,8 @@ module WXRuby3
|
|
210
219
|
# add ruby defined shared ruby lib(s); not any other flags
|
211
220
|
@ruby_libs.concat RB_CONFIG['LIBRUBYARG_SHARED'].split(' ').select { |s| s.start_with?('-l')}
|
212
221
|
|
213
|
-
# maintain minimum compatibility with ABI 3.0.
|
214
|
-
@wx_abi_version = [ @wx_version, "3.0.
|
222
|
+
# maintain minimum compatibility with ABI 3.0.1
|
223
|
+
@wx_abi_version = [ @wx_version, "3.0.1" ].min
|
215
224
|
@wx_cppflags << "-DwxABI_VERSION=%s" % @wx_abi_version.tr(".", "0")
|
216
225
|
end
|
217
226
|
end
|
data/rakelib/lib/config.rb
CHANGED
@@ -11,6 +11,7 @@ require 'fileutils'
|
|
11
11
|
require 'json'
|
12
12
|
require 'open3'
|
13
13
|
require 'monitor'
|
14
|
+
require 'plat4m'
|
14
15
|
|
15
16
|
module FileUtils
|
16
17
|
# add convenience methods
|
@@ -67,7 +68,8 @@ module WXRuby3
|
|
67
68
|
'sodir' => '$siterubyverarch',
|
68
69
|
}
|
69
70
|
|
70
|
-
CFG_KEYS.concat(%w{wxwin wxxml wxwininstdir with-wxwin with-debug swig doxygen})
|
71
|
+
CFG_KEYS.concat(%w{wxwin wxxml wxwininstdir with-wxwin with-debug swig doxygen git})
|
72
|
+
WXW_SYS_KEY = 'with-system-wxwin'
|
71
73
|
CONFIG.merge!({
|
72
74
|
'wxwin' => ENV['WXWIN'] || '',
|
73
75
|
'wxxml' => ENV['WXXML'] || '',
|
@@ -280,7 +282,7 @@ module WXRuby3
|
|
280
282
|
end
|
281
283
|
begin
|
282
284
|
# setup ENV for child execution
|
283
|
-
ENV.
|
285
|
+
ENV.update(Config.instance.exec_env)
|
284
286
|
output = `#{cmd.join(' ')}`
|
285
287
|
ensure
|
286
288
|
# restore ENV
|
@@ -311,7 +313,7 @@ module WXRuby3
|
|
311
313
|
private :make_ruby_cmd
|
312
314
|
|
313
315
|
def execute(*cmd)
|
314
|
-
|
316
|
+
sh(exec_env.merge({'RUBYLIB'=>rb_lib_path}), cmd.flatten.join(' '), fail_on_error: true)
|
315
317
|
end
|
316
318
|
|
317
319
|
def run(*cmd, capture: nil, verbose: true)
|
@@ -350,7 +352,7 @@ module WXRuby3
|
|
350
352
|
|
351
353
|
def test(*tests, **options)
|
352
354
|
errors = 0
|
353
|
-
excludes = (ENV['WXRUBY_TEST_EXCLUDE'] || '').split('
|
355
|
+
excludes = (ENV['WXRUBY_TEST_EXCLUDE'] || '').split(':')
|
354
356
|
tests = Dir.glob(File.join(Config.instance.test_dir, '*.rb')) if tests.empty?
|
355
357
|
tests.each do |test|
|
356
358
|
unless excludes.include?(File.basename(test, '.*'))
|
@@ -381,6 +383,10 @@ module WXRuby3
|
|
381
383
|
[]
|
382
384
|
end
|
383
385
|
|
386
|
+
def download_file(_url, _dest)
|
387
|
+
raise NoMethodError
|
388
|
+
end
|
389
|
+
|
384
390
|
def install_prerequisites
|
385
391
|
pkg_deps = check_tool_pkgs
|
386
392
|
if get_config('autoinstall') == false
|
@@ -443,16 +449,22 @@ module WXRuby3
|
|
443
449
|
def get_rpath_origin
|
444
450
|
''
|
445
451
|
end
|
452
|
+
protected :get_rpath_origin
|
446
453
|
|
447
|
-
def
|
454
|
+
def patch_rpath(_shlib, *)
|
448
455
|
true
|
449
456
|
end
|
457
|
+
protected :patch_rpath
|
450
458
|
|
451
|
-
def
|
459
|
+
def update_shlib_loadpaths(_shlib)
|
452
460
|
true
|
453
461
|
end
|
454
462
|
|
455
|
-
def
|
463
|
+
def update_shlib_ruby_libpath(_shlib)
|
464
|
+
true
|
465
|
+
end
|
466
|
+
|
467
|
+
def update_shlib_wxwin_libpaths(_shlib, _deplibs)
|
456
468
|
true
|
457
469
|
end
|
458
470
|
|
@@ -494,15 +506,23 @@ module WXRuby3
|
|
494
506
|
end
|
495
507
|
|
496
508
|
def save
|
509
|
+
cfg = WXRuby3::CONFIG.dup
|
510
|
+
wxw_system = !!cfg.delete(WXW_SYS_KEY)
|
511
|
+
cfg['wxwin'] = '@system' if wxw_system
|
497
512
|
File.open(build_cfg, 'w') do |f|
|
498
|
-
f << JSON.pretty_generate(
|
513
|
+
f << JSON.pretty_generate(cfg)
|
499
514
|
end
|
500
515
|
end
|
501
516
|
|
502
517
|
def load
|
503
518
|
if File.file?(build_cfg)
|
504
519
|
File.open(build_cfg, 'r') do |f|
|
505
|
-
|
520
|
+
cfg = JSON.load(f.read)
|
521
|
+
if cfg['wxwin'] == '@system'
|
522
|
+
cfg[WXW_SYS_KEY] = true
|
523
|
+
cfg.delete('wxwin')
|
524
|
+
end
|
525
|
+
WXRuby3::CONFIG.merge!(cfg)
|
506
526
|
end
|
507
527
|
end
|
508
528
|
end
|
@@ -515,10 +535,8 @@ module WXRuby3
|
|
515
535
|
case RUBY_PLATFORM
|
516
536
|
when /mingw/
|
517
537
|
:mingw
|
518
|
-
when /
|
519
|
-
:
|
520
|
-
when /netbsd/
|
521
|
-
:netbsd
|
538
|
+
when /freebsd/
|
539
|
+
:freebsd
|
522
540
|
when /darwin/
|
523
541
|
:macosx
|
524
542
|
when /linux/
|
@@ -538,15 +556,26 @@ module WXRuby3
|
|
538
556
|
def initialize
|
539
557
|
@ruby_exe = RB_CONFIG["ruby_install_name"]
|
540
558
|
|
541
|
-
@
|
542
|
-
@platform =
|
543
|
-
|
559
|
+
@sysinfo = Plat4m.current rescue nil
|
560
|
+
@platform = if @sysinfo
|
561
|
+
case @sysinfo.os.id
|
562
|
+
when :darwin
|
563
|
+
:macosx
|
564
|
+
when :windows
|
565
|
+
RUBY_PLATFORM =~ /mingw/ ? :mingw : :unknown
|
566
|
+
else
|
567
|
+
@sysinfo.os.id
|
568
|
+
end
|
569
|
+
else
|
570
|
+
:unknown
|
571
|
+
end
|
572
|
+
require_relative File.join('config', @platform.to_s)
|
544
573
|
self.class.include(WXRuby3::Config::Platform)
|
545
574
|
|
546
575
|
init # initialize settings
|
547
576
|
end
|
548
577
|
|
549
|
-
attr_reader :ruby_exe, :
|
578
|
+
attr_reader :ruby_exe, :sysinfo, :platform, :helper_modules, :helper_inits, :include_modules, :verbosity
|
550
579
|
attr_reader :release_build, :debug_build, :verbose_debug, :no_deprecate
|
551
580
|
attr_reader :ruby_cppflags, :ruby_ldflags, :ruby_libs, :extra_cflags, :extra_cppflags, :extra_ldflags,
|
552
581
|
:extra_libs, :cpp_out_flag, :link_output_flag, :obj_ext, :dll_ext,
|
@@ -593,11 +622,6 @@ module WXRuby3
|
|
593
622
|
|
594
623
|
# Extra swig helper files to be built
|
595
624
|
@helper_modules = %w|RubyStockObjects|
|
596
|
-
# if macosx?
|
597
|
-
# %w|RubyStockObjects Mac|
|
598
|
-
# else
|
599
|
-
# %w|RubyStockObjects|
|
600
|
-
# end
|
601
625
|
# helper to initialize on startup (stock objects can only be initialized after App creation)
|
602
626
|
@helper_inits = @helper_modules - %w|RubyStockObjects|
|
603
627
|
|
@@ -640,7 +664,7 @@ module WXRuby3
|
|
640
664
|
@obj_ext = RB_CONFIG["OBJEXT"]
|
641
665
|
@dll_ext = RB_CONFIG['DLEXT']
|
642
666
|
|
643
|
-
# Exclude
|
667
|
+
# Exclude certain classes from being built, even if they are present
|
644
668
|
# in the configuration of wxWidgets.
|
645
669
|
if ENV['WXRUBY_EXCLUDED']
|
646
670
|
ENV['WXRUBY_EXCLUDED'].split(",").each { |classname| exclude_module(classname) }
|
@@ -696,6 +720,10 @@ module WXRuby3
|
|
696
720
|
get_config('with-wxwin')
|
697
721
|
end
|
698
722
|
|
723
|
+
def with_wxhead?
|
724
|
+
get_config('with-wxhead')
|
725
|
+
end
|
726
|
+
|
699
727
|
def wx_version
|
700
728
|
@wx_version || ''
|
701
729
|
end
|
@@ -704,16 +732,12 @@ module WXRuby3
|
|
704
732
|
@wx_abi_version || ''
|
705
733
|
end
|
706
734
|
|
707
|
-
def cygwin?
|
708
|
-
@platform == :cygwin
|
709
|
-
end
|
710
|
-
|
711
735
|
def mingw?
|
712
736
|
@platform == :mingw
|
713
737
|
end
|
714
738
|
|
715
|
-
def
|
716
|
-
@platform == :
|
739
|
+
def freebsd?
|
740
|
+
@platform == :freebsd
|
717
741
|
end
|
718
742
|
|
719
743
|
def macosx?
|
@@ -725,7 +749,7 @@ module WXRuby3
|
|
725
749
|
end
|
726
750
|
|
727
751
|
def windows?
|
728
|
-
mingw?
|
752
|
+
mingw?
|
729
753
|
end
|
730
754
|
|
731
755
|
def ldflags(_target)
|
@@ -740,6 +764,17 @@ module WXRuby3
|
|
740
764
|
[ rake_deps_path, src_path, src_gen_path, obj_path, classes_path, common_path, interface_path ]
|
741
765
|
end
|
742
766
|
|
767
|
+
def wx_gitref
|
768
|
+
if @wx_version
|
769
|
+
"v#{@wx_version}"
|
770
|
+
elsif get_config('with-wxhead')
|
771
|
+
'master'
|
772
|
+
else
|
773
|
+
nil
|
774
|
+
end
|
775
|
+
end
|
776
|
+
private :wx_gitref
|
777
|
+
|
743
778
|
def do_bootstrap
|
744
779
|
install_prerequisites
|
745
780
|
# do we have a local wxWidgets tree already?
|
@@ -812,9 +847,15 @@ module WXRuby3
|
|
812
847
|
features = {}
|
813
848
|
|
814
849
|
if is_configured? && wxwidgets_setup_h
|
815
|
-
File.read(wxwidgets_setup_h).scan(/^\s*#define\s+(wx\w+|__\w+__)\s+([01])/) do | define |
|
816
|
-
|
817
|
-
|
850
|
+
File.read(wxwidgets_setup_h).scan(/^\s*#define\s+(wx\w+|__\w+__)\s+([01]|wx\w+)/) do | define |
|
851
|
+
val_str = $2
|
852
|
+
feat_str = $1
|
853
|
+
if val_str.start_with?('wx')
|
854
|
+
feat_val = !!features[val_str.sub(/\Awx/i, '')]
|
855
|
+
else
|
856
|
+
feat_val = val_str.to_i.zero? ? false : true
|
857
|
+
end
|
858
|
+
feat_id = feat_str.sub(/\Awx/i, '').gsub(/\A__|__\Z/, '')
|
818
859
|
features[feat_id] = feat_val
|
819
860
|
end
|
820
861
|
# make sure correct platform defines are included as well which will not be the case always
|
@@ -177,6 +177,7 @@ static VALUE wx_Enum_sc_create_enum_class(int argc, VALUE *argv, VALUE self)
|
|
177
177
|
ID id_to_i = rb_intern("to_i");
|
178
178
|
ID id_const_set = rb_intern("const_set");
|
179
179
|
VALUE enum_klass = rb_funcall(rb_cClass, id_new, 1, cWxEnum, 0);
|
180
|
+
VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
|
180
181
|
VALUE enum_values = rb_funcall(argv[1], rb_intern("keys"), 0, 0);
|
181
182
|
for (int i=0; i<RARRAY_LEN(enum_values) ;++i)
|
182
183
|
{
|
@@ -184,6 +185,8 @@ static VALUE wx_Enum_sc_create_enum_class(int argc, VALUE *argv, VALUE self)
|
|
184
185
|
VALUE enum_value_num = rb_funcall(rb_hash_aref(argv[1], enum_value_name), id_to_i, 0, 0);
|
185
186
|
VALUE enum_value = rb_funcall(enum_klass, id_new, 1, enum_value_num, 0);
|
186
187
|
rb_funcall(enum_klass, id_const_set, 2, enum_value_name, enum_value, 0);
|
188
|
+
rb_hash_aset(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values), enum_value_num, enum_value);
|
189
|
+
rb_hash_aset(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_to_symbol(enum_value_name), enum_value);
|
187
190
|
}
|
188
191
|
rb_hash_aset(rb_iv_get(cEnum_Singleton, __iv_Enum_sc_enums), enum_name, enum_klass);
|
189
192
|
return enum_klass;
|
@@ -230,10 +233,31 @@ static VALUE wx_Enum_sc_get_enum_value(int argc, VALUE *argv, VALUE self)
|
|
230
233
|
return rb_hash_aref(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_to_symbol(argv[0]));
|
231
234
|
}
|
232
235
|
|
236
|
+
static VALUE wx_Enum_sc_get_enum_values(VALUE self)
|
237
|
+
{
|
238
|
+
VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
|
239
|
+
return rb_iv_get(enum_singleton_klass, __iv_enum_klass_values);
|
240
|
+
}
|
241
|
+
|
242
|
+
static VALUE wx_Enum_sc_get_enum_values_by_name(VALUE self)
|
243
|
+
{
|
244
|
+
VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
|
245
|
+
return rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name);
|
246
|
+
}
|
247
|
+
|
248
|
+
static VALUE wx_Enum_sc_get_enum_names_by_value(VALUE self)
|
249
|
+
{
|
250
|
+
VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
|
251
|
+
return rb_funcall(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_intern("invert"), 0);
|
252
|
+
}
|
253
|
+
|
233
254
|
WXRB_EXPORT_FLAG VALUE wxRuby_CreateEnumClass(const char* enum_class_name_cstr)
|
234
255
|
{
|
235
256
|
VALUE enum_klass = rb_funcall(rb_cClass, rb_intern("new"), 1, cWxEnum, 0);
|
236
257
|
rb_define_singleton_method(enum_klass, "[]", VALUEFUNC(wx_Enum_sc_get_enum_value), -1);
|
258
|
+
rb_define_singleton_method(enum_klass, "values", VALUEFUNC(wx_Enum_sc_get_enum_values), 0);
|
259
|
+
rb_define_singleton_method(enum_klass, "values_by_name", VALUEFUNC(wx_Enum_sc_get_enum_values_by_name), 0);
|
260
|
+
rb_define_singleton_method(enum_klass, "names_by_value", VALUEFUNC(wx_Enum_sc_get_enum_names_by_value), 0);
|
237
261
|
VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
|
238
262
|
rb_iv_set(enum_singleton_klass, __iv_enum_klass_values, rb_hash_new());
|
239
263
|
rb_iv_set(enum_singleton_klass, __iv_enum_klass_values_by_name, rb_hash_new());
|
@@ -266,7 +290,13 @@ WXRB_EXPORT_FLAG VALUE wxRuby_GetEnumValueObject(const char* enum_wx_class_name_
|
|
266
290
|
VALUE enum_klass = rb_hash_aref(enum_hash, ID2SYM(rb_intern(enum_class_name)));
|
267
291
|
VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
|
268
292
|
VALUE enum_values_hash = rb_iv_get(enum_singleton_klass, __iv_enum_klass_values);
|
269
|
-
|
293
|
+
VALUE rc = rb_hash_aref(enum_values_hash, INT2NUM(enum_val));
|
294
|
+
if (NIL_P(rc))
|
295
|
+
{
|
296
|
+
VALUE args[1] = { INT2NUM(enum_val) };
|
297
|
+
rc = rb_class_new_instance(1, args, enum_klass);
|
298
|
+
}
|
299
|
+
return rc;
|
270
300
|
}
|
271
301
|
return Qnil;
|
272
302
|
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
###
|
6
|
+
# wxRuby3 wxWidgets interface director
|
7
|
+
###
|
8
|
+
|
9
|
+
module WXRuby3
|
10
|
+
|
11
|
+
class Director
|
12
|
+
|
13
|
+
class AffineMatrix2D < Director
|
14
|
+
|
15
|
+
def setup
|
16
|
+
spec.items.unshift('wxAffineMatrix2DBase') << 'wxMatrix2D'
|
17
|
+
|
18
|
+
spec.make_abstract 'wxAffineMatrix2DBase'
|
19
|
+
spec.disable_proxies
|
20
|
+
|
21
|
+
spec.map_apply 'int * OUTPUT' => ['wxDouble *']
|
22
|
+
spec.map 'wxPoint2DDouble *' => 'Wx::Point2DDouble' do
|
23
|
+
map_in ignore: true, temp: 'wxPoint2DDouble tmp', code: '$1 = &tmp;'
|
24
|
+
|
25
|
+
map_argout code: <<~__CODE
|
26
|
+
$result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(new wxPoint2DDouble(tmp$argnum), SWIGTYPE_p_wxPoint2DDouble, SWIG_POINTER_OWN));
|
27
|
+
__CODE
|
28
|
+
end
|
29
|
+
spec.map 'wxMatrix2D *' => 'Wx::Matrix2D' do
|
30
|
+
map_in ignore: true, temp: 'wxMatrix2D tmp', code: '$1 = &tmp;'
|
31
|
+
|
32
|
+
map_argout code: <<~__CODE
|
33
|
+
$result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(new wxMatrix2D(tmp$argnum), SWIGTYPE_p_wxPoint2DDouble, SWIG_POINTER_OWN));
|
34
|
+
__CODE
|
35
|
+
end
|
36
|
+
|
37
|
+
spec.ignore 'wxAffineMatrix2D::Mirror',
|
38
|
+
'wxAffineMatrix2D::TransformPoint',
|
39
|
+
'wxAffineMatrix2D::TransformDistance',
|
40
|
+
'wxAffineMatrix2D::IsEqual'
|
41
|
+
|
42
|
+
spec.regard 'wxMatrix2D::m_11', 'wxMatrix2D::m_12',
|
43
|
+
'wxMatrix2D::m_21', 'wxMatrix2D::m_22'
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/rakelib/lib/director/app.rb
CHANGED
@@ -87,31 +87,47 @@ module WXRuby3
|
|
87
87
|
}
|
88
88
|
__HEREDOC
|
89
89
|
if Config.platform == :macosx
|
90
|
-
# add accessor methods for the standard OSX menu items
|
90
|
+
# add static accessor methods for the standard OSX menu items
|
91
91
|
spec.add_extend_code 'wxApp', <<~__HEREDOC
|
92
|
-
void set_mac_about_menu_itemid(long menu_itemid)
|
92
|
+
static void set_mac_about_menu_itemid(long menu_itemid)
|
93
93
|
{
|
94
|
-
|
94
|
+
wxApp::s_macAboutMenuItemId = menu_itemid;
|
95
95
|
}
|
96
|
-
long get_mac_about_menu_itemid(long menu_itemid)
|
96
|
+
static long get_mac_about_menu_itemid(long menu_itemid)
|
97
97
|
{
|
98
|
-
return
|
98
|
+
return wxApp::s_macAboutMenuItemId;
|
99
99
|
}
|
100
|
-
void set_mac_preferences_menu_itemid(long menu_itemid)
|
100
|
+
static void set_mac_preferences_menu_itemid(long menu_itemid)
|
101
101
|
{
|
102
|
-
|
102
|
+
wxApp::s_macPreferencesMenuItemId = menu_itemid;
|
103
103
|
}
|
104
|
-
long get_mac_preferences_menu_itemid(long menu_itemid)
|
104
|
+
static long get_mac_preferences_menu_itemid(long menu_itemid)
|
105
105
|
{
|
106
|
-
return
|
106
|
+
return wxApp::s_macPreferencesMenuItemId;
|
107
107
|
}
|
108
|
-
void set_mac_exit_menu_itemid(long menu_itemid)
|
108
|
+
static void set_mac_exit_menu_itemid(long menu_itemid)
|
109
109
|
{
|
110
|
-
|
110
|
+
wxApp::s_macExitMenuItemId = menu_itemid;
|
111
111
|
}
|
112
|
-
long get_mac_exit_menu_itemid(long menu_itemid)
|
112
|
+
static long get_mac_exit_menu_itemid(long menu_itemid)
|
113
113
|
{
|
114
|
-
return
|
114
|
+
return wxApp::s_macExitMenuItemId;
|
115
|
+
}
|
116
|
+
static void set_mac_help_menu_title(const wxString& title)
|
117
|
+
{
|
118
|
+
wxApp::s_macHelpMenuTitleName = title;
|
119
|
+
}
|
120
|
+
static const wxString& get_mac_help_menu_title()
|
121
|
+
{
|
122
|
+
return wxApp::s_macHelpMenuTitleName;
|
123
|
+
}
|
124
|
+
static void set_mac_window_menu_title(const wxString& title)
|
125
|
+
{
|
126
|
+
wxApp::s_macWindowMenuTitleName = title;
|
127
|
+
}
|
128
|
+
static const wxString& get_mac_window_menu_title()
|
129
|
+
{
|
130
|
+
return wxApp::s_macWindowMenuTitleName;
|
115
131
|
}
|
116
132
|
__HEREDOC
|
117
133
|
end
|
@@ -28,6 +28,10 @@ module WXRuby3
|
|
28
28
|
// ArtId and ArtClient are basically just strings ...
|
29
29
|
typedef wxString wxArtID;
|
30
30
|
typedef wxString wxArtClient;
|
31
|
+
|
32
|
+
// Missing from docs
|
33
|
+
%constant const char* wxART_STOP = wxART_STOP;
|
34
|
+
%constant const char* wxART_REFRESH = wxART_REFRESH;
|
31
35
|
__HEREDOC
|
32
36
|
spec.map *%w[wxArtID wxArtClient], as: 'String', swig: false do
|
33
37
|
map_in
|
@@ -53,7 +53,7 @@ module WXRuby3
|
|
53
53
|
m_actionWindow = NULL;
|
54
54
|
m_hoverButton = NULL;
|
55
55
|
m_art = new wxAuiDefaultDockArt;
|
56
|
-
m_hintWnd = NULL;
|
56
|
+
#{Config.instance.wx_version < '3.3.0' ? 'm_hintWnd = NULL;' : ''}
|
57
57
|
m_flags = wxAUI_MGR_DEFAULT;
|
58
58
|
m_hasMaximized = false;
|
59
59
|
m_dockConstraintX = 0.3;
|
@@ -20,8 +20,12 @@ module WXRuby3
|
|
20
20
|
'wxCursor::wxCursor(const wxImage &)',
|
21
21
|
'wxCursor::wxCursor(const char *const *)',
|
22
22
|
'wxCursor::wxCursor(const wxCursor &)'
|
23
|
-
spec.ignore 'wxCursor::wxCursor(const char
|
24
|
-
|
23
|
+
spec.ignore 'wxCursor::wxCursor(const char *const *)'
|
24
|
+
if Config.instance.wx_version >= '3.3.0'
|
25
|
+
spec.ignore 'wxCursor::wxCursor(const char[],int,int,int,int,const char[], const wxColour*, const wxColour*)'
|
26
|
+
else
|
27
|
+
spec.ignore 'wxCursor::wxCursor(const char[],int,int,int,int,const char[])'
|
28
|
+
end
|
25
29
|
# ignore stock object (see RubyStockObjects.i)
|
26
30
|
spec.ignore %w[wxSTANDARD_CURSOR wxHOURGLASS_CURSOR wxCROSS_CURSOR]
|
27
31
|
super
|