wxruby3 0.9.8 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +23 -1
  3. data/README.md +13 -27
  4. data/ext/mkrf_conf_ext.rb +11 -7
  5. data/lib/wx/core/app.rb +16 -0
  6. data/lib/wx/core/colour.rb +36 -28
  7. data/lib/wx/core/const.rb +19 -0
  8. data/lib/wx/core/enum.rb +17 -1
  9. data/lib/wx/core/geometry.rb +121 -0
  10. data/lib/wx/core/graphics_pen_info.rb +18 -0
  11. data/lib/wx/core/image.rb +49 -0
  12. data/lib/wx/core/menu_bar.rb +11 -0
  13. data/lib/wx/core/paintdc.rb +9 -3
  14. data/lib/wx/doc/app.rb +97 -41
  15. data/lib/wx/doc/bitmap.rb +4 -0
  16. data/lib/wx/doc/client_dc.rb +2 -2
  17. data/lib/wx/doc/clipboard.rb +1 -1
  18. data/lib/wx/doc/colour.rb +12 -0
  19. data/lib/wx/doc/const.rb +16 -0
  20. data/lib/wx/doc/cursor.rb +4 -0
  21. data/lib/wx/doc/dc_overlay.rb +34 -0
  22. data/lib/wx/doc/enum.rb +7 -1
  23. data/lib/wx/doc/event_blocker.rb +1 -1
  24. data/lib/wx/doc/evthandler.rb +25 -3
  25. data/lib/wx/doc/functions.rb +3 -6
  26. data/lib/wx/doc/gc_dc.rb +13 -4
  27. data/lib/wx/doc/geometry.rb +136 -0
  28. data/lib/wx/doc/graphics_context.rb +25 -7
  29. data/lib/wx/doc/icon.rb +4 -0
  30. data/lib/wx/doc/image.rb +56 -0
  31. data/lib/wx/doc/list_ctrl.rb +6 -6
  32. data/lib/wx/doc/memory_dc.rb +2 -11
  33. data/lib/wx/doc/mirror_dc.rb +1 -1
  34. data/lib/wx/doc/pen.rb +26 -0
  35. data/lib/wx/doc/persistence_manager.rb +1 -1
  36. data/lib/wx/doc/persistent_object.rb +1 -1
  37. data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
  38. data/lib/wx/doc/prt/printer_dc.rb +2 -2
  39. data/lib/wx/doc/region_iterator.rb +1 -1
  40. data/lib/wx/doc/scaled_dc.rb +1 -1
  41. data/lib/wx/doc/screen_dc.rb +1 -1
  42. data/lib/wx/doc/svg_file_dc.rb +1 -1
  43. data/lib/wx/doc/textctrl.rb +1 -1
  44. data/lib/wx/doc/tree_ctrl.rb +2 -2
  45. data/lib/wx/doc/validator.rb +6 -6
  46. data/lib/wx/doc/variant.rb +2 -2
  47. data/lib/wx/doc/window.rb +5 -4
  48. data/lib/wx/grid/keyword_defs.rb +1 -1
  49. data/lib/wx/html/keyword_defs.rb +3 -3
  50. data/lib/wx/keyword_defs.rb +76 -71
  51. data/lib/wx/pg/keyword_defs.rb +2 -2
  52. data/lib/wx/pg/pg_property.rb +12 -0
  53. data/lib/wx/rbn/keyword_defs.rb +1 -1
  54. data/lib/wx/rtc/keyword_defs.rb +1 -1
  55. data/lib/wx/stc/keyword_defs.rb +1 -1
  56. data/lib/wx/version.rb +1 -1
  57. data/lib/wx/wxruby/cmd/setup.rb +3 -0
  58. data/rakelib/configure.rb +7 -0
  59. data/rakelib/gem.rake +3 -2
  60. data/rakelib/gem.rb +3 -2
  61. data/rakelib/lib/config/linux.rb +1 -1
  62. data/rakelib/lib/config/mingw.rb +4 -101
  63. data/rakelib/lib/config/pkgman/linux.rb +31 -8
  64. data/rakelib/lib/config/pkgman/mingw.rb +112 -0
  65. data/rakelib/lib/config/unixish.rb +6 -7
  66. data/rakelib/lib/config.rb +25 -4
  67. data/rakelib/lib/core/include/enum.inc +31 -1
  68. data/rakelib/lib/director/affine_matrix.rb +51 -0
  69. data/rakelib/lib/director/app.rb +29 -13
  70. data/rakelib/lib/director/art_provider.rb +4 -0
  71. data/rakelib/lib/director/cursor.rb +6 -2
  72. data/rakelib/lib/director/dc.rb +1 -6
  73. data/rakelib/lib/director/derived_dc.rb +88 -31
  74. data/rakelib/lib/director/dialog.rb +0 -8
  75. data/rakelib/lib/director/geometry.rb +142 -0
  76. data/rakelib/lib/director/graphics_context.rb +3 -2
  77. data/rakelib/lib/director/graphics_object.rb +18 -25
  78. data/rakelib/lib/director/image.rb +59 -0
  79. data/rakelib/lib/director/menu.rb +2 -3
  80. data/rakelib/lib/director/menu_bar.rb +0 -3
  81. data/rakelib/lib/director/pen.rb +1 -1
  82. data/rakelib/lib/director/richtext_ctrl.rb +1 -1
  83. data/rakelib/lib/director/system_settings.rb +1 -1
  84. data/rakelib/lib/director/window.rb +9 -3
  85. data/rakelib/lib/extractor/function.rb +1 -1
  86. data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
  87. data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
  88. data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
  89. data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
  90. data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
  91. data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
  92. data/rakelib/lib/generate/doc/icon.yaml +10 -0
  93. data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
  94. data/rakelib/lib/generate/doc/log.yaml +1 -1
  95. data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
  96. data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
  97. data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
  98. data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
  99. data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
  100. data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
  101. data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
  102. data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
  103. data/rakelib/lib/generate/doc/wizard.yaml +27 -0
  104. data/rakelib/lib/generate/doc.rb +4 -4
  105. data/rakelib/lib/generate/interface.rb +1 -1
  106. data/rakelib/lib/specs/interfaces.rb +3 -0
  107. data/rakelib/lib/swig_runner.rb +24 -3
  108. data/rakelib/lib/typemap/points_list.rb +8 -2
  109. data/rakelib/lib/typemap/richtext.rb +17 -0
  110. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
  111. data/samples/dialogs/wizard.rb +20 -19
  112. data/samples/drawing/art/drawing/image.bmp +0 -0
  113. data/samples/drawing/art/drawing/mask.bmp +0 -0
  114. data/samples/drawing/art/drawing/pat35.bmp +0 -0
  115. data/samples/drawing/art/drawing/pat36.bmp +0 -0
  116. data/samples/drawing/art/drawing/pat4.bmp +0 -0
  117. data/samples/drawing/art/drawing/smile.xpm +42 -0
  118. data/samples/drawing/drawing.rb +2276 -0
  119. data/samples/drawing/tn_drawing.png +0 -0
  120. data/samples/html/html.rb +1 -1
  121. data/samples/propgrid/propgrid.rb +1 -1
  122. data/samples/propgrid/propgrid_minimal.rb +1 -1
  123. data/samples/propgrid/sample_props.rb +1 -1
  124. data/samples/sampler/editor.rb +13 -11
  125. data/samples/sampler.rb +14 -10
  126. data/samples/text/richtext.rb +53 -0
  127. data/samples/text/scintilla.rb +1 -1
  128. data/samples/text/unicode.rb +4 -4
  129. data/tests/test_ext_controls.rb +12 -5
  130. data/tests/test_gdi_object.rb +2 -2
  131. data/tests/test_std_controls.rb +12 -12
  132. metadata +33 -32
  133. data/lib/wx/doc/extra/00_starting.md +0 -154
  134. data/lib/wx/doc/extra/01_packages.md +0 -180
  135. data/lib/wx/doc/extra/02_lifecycles.md +0 -166
  136. data/lib/wx/doc/extra/03_dialogs.md +0 -57
  137. data/lib/wx/doc/extra/04_enums.md +0 -143
  138. data/lib/wx/doc/extra/05_event-handling.md +0 -191
  139. data/lib/wx/doc/extra/06_geometry.md +0 -62
  140. data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
  141. data/lib/wx/doc/extra/08_extensions.md +0 -144
  142. data/lib/wx/doc/extra/09_exceptions.md +0 -54
  143. data/lib/wx/doc/extra/10_art.md +0 -111
  144. data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
  145. data/lib/wx/doc/extra/12_client_data.md +0 -89
  146. data/lib/wx/doc/extra/13_validators.md +0 -139
  147. data/lib/wx/doc/extra/14_config.md +0 -101
  148. data/lib/wx/doc/extra/15_persistence.md +0 -148
  149. data/samples/sampler/back.xpm +0 -21
  150. data/samples/sampler/copy.xpm +0 -44
  151. data/samples/sampler/cut.xpm +0 -46
  152. data/samples/sampler/filesave.xpm +0 -42
  153. data/samples/sampler/find.xpm +0 -62
  154. data/samples/sampler/findrepl.xpm +0 -63
  155. data/samples/sampler/forward.xpm +0 -21
  156. data/samples/sampler/paste.xpm +0 -46
  157. data/samples/sampler/redo.xpm +0 -58
  158. data/samples/sampler/undo.xpm +0 -58
data/rakelib/gem.rb CHANGED
@@ -93,12 +93,13 @@ module WXRuby3
93
93
  end
94
94
 
95
95
  def make_bin_name
96
+ basename = "wxruby3#{WXRuby3.config.with_wxhead? ? '-head' : ''}"
96
97
  os = WXRuby3.config.sysinfo.os
97
98
  case os.id
98
99
  when :windows
99
- "wxruby3_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
100
+ "#{basename}_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
100
101
  else
101
- "wxruby3_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
102
+ "#{basename}_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
102
103
  end
103
104
  end
104
105
  private :make_bin_name
@@ -81,7 +81,7 @@ module WXRuby3
81
81
  @dll_pfx = 'lib'
82
82
 
83
83
  if @wx_version
84
- @extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-maybe-uninitialized]
84
+ @extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-maybe-uninitialized -Wno-deprecated-copy]
85
85
  @extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
86
86
 
87
87
  @ruby_ldflags << '-s' if @release_build # strip debug symbols for release build
@@ -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
- unless pkg_deps.empty?
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 download_and_install(url, zip, exe, unpack_to=nil)
168
- # make sure the download destination exists
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
- rhel: %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],
20
- suse: %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],
21
- arch: %w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12]
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
- __ERROR_TXT
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
- __ERROR_TXT
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
- __ERROR_TXT
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
@@ -92,11 +92,10 @@ module WXRuby3
92
92
  chdir(ext_path) do
93
93
  if (rc = sh("#{get_cfg_string('git')} clone https://github.com/wxWidgets/wxWidgets.git"))
94
94
  chdir('wxWidgets') do
95
- tag = if @wx_version
96
- "v#{@wx_version}"
97
- else
98
- expand("#{get_cfg_string('git')} tag").split("\n").select { |t| (/\Av3\.(\d+)/ =~ t) && $1.to_i >= 2 }.max
99
- 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
100
99
  # checkout the version we are building against
101
100
  rc = sh("#{get_cfg_string('git')} checkout #{tag}")
102
101
  end
@@ -220,8 +219,8 @@ module WXRuby3
220
219
  # add ruby defined shared ruby lib(s); not any other flags
221
220
  @ruby_libs.concat RB_CONFIG['LIBRUBYARG_SHARED'].split(' ').select { |s| s.start_with?('-l')}
222
221
 
223
- # maintain minimum compatibility with ABI 3.0.0
224
- @wx_abi_version = [ @wx_version, "3.0.0" ].min
222
+ # maintain minimum compatibility with ABI 3.0.1
223
+ @wx_abi_version = [ @wx_version, "3.0.1" ].min
225
224
  @wx_cppflags << "-DwxABI_VERSION=%s" % @wx_abi_version.tr(".", "0")
226
225
  end
227
226
  end
@@ -313,7 +313,7 @@ module WXRuby3
313
313
  private :make_ruby_cmd
314
314
 
315
315
  def execute(*cmd)
316
- do_run(*cmd.flatten)
316
+ sh(exec_env.merge({'RUBYLIB'=>rb_lib_path}), cmd.flatten.join(' '), fail_on_error: true)
317
317
  end
318
318
 
319
319
  def run(*cmd, capture: nil, verbose: true)
@@ -720,6 +720,10 @@ module WXRuby3
720
720
  get_config('with-wxwin')
721
721
  end
722
722
 
723
+ def with_wxhead?
724
+ get_config('with-wxhead')
725
+ end
726
+
723
727
  def wx_version
724
728
  @wx_version || ''
725
729
  end
@@ -760,6 +764,17 @@ module WXRuby3
760
764
  [ rake_deps_path, src_path, src_gen_path, obj_path, classes_path, common_path, interface_path ]
761
765
  end
762
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
+
763
778
  def do_bootstrap
764
779
  install_prerequisites
765
780
  # do we have a local wxWidgets tree already?
@@ -832,9 +847,15 @@ module WXRuby3
832
847
  features = {}
833
848
 
834
849
  if is_configured? && wxwidgets_setup_h
835
- File.read(wxwidgets_setup_h).scan(/^\s*#define\s+(wx\w+|__\w+__)\s+([01])/) do | define |
836
- feat_val = $2.to_i.zero? ? false : true
837
- feat_id = $1.sub(/\Awx/i, '').gsub(/\A__|__\Z/, '')
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/, '')
838
859
  features[feat_id] = feat_val
839
860
  end
840
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
- return rb_hash_aref(enum_values_hash, INT2NUM(enum_val));
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
@@ -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
- $self->s_macAboutMenuItemId = menu_itemid;
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 $self->s_macAboutMenuItemId;
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
- $self->s_macPreferencesMenuItemId = menu_itemid;
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 $self->s_macPreferencesMenuItemId;
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
- $self->s_macExitMenuItemId = menu_itemid;
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 $self->s_macExitMenuItemId;
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
@@ -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[],int,int,int,int,const char[])',
24
- 'wxCursor::wxCursor(const char *const *)'
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
@@ -36,13 +36,8 @@ module WXRuby3
36
36
  'wxDC::GetLogicalOrigin(wxCoord *,wxCoord *) const',
37
37
  'wxDC::GetHandle'
38
38
  ]
39
- # ignore Matrix Transformation methods until someone asks for them
40
- # TODO : possibly wrap at a later time
41
- spec.ignore 'wxDC::SetTransformMatrix',
42
- 'wxDC::GetTransformMatrix',
43
- 'wxDC::ResetTransformMatrix',
44
- 'wxDC::CanUseTransformMatrix'
45
39
  spec.disable_proxies
40
+ spec.disown 'wxGraphicsContext *ctx'
46
41
  spec.rename_for_ruby({
47
42
  'GetDimensions' => 'wxDC::GetSize(wxCoord *, wxCoord *) const',
48
43
  'GetDimensionsMM' => 'wxDC::GetSizeMM(wxCoord *, wxCoord *) const',