Skip to content

Commit

Permalink
Merge pull request #88 from mcorino/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mcorino committed Jun 20, 2023
2 parents b770666 + 58c9d08 commit 5fa9039
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 43 deletions.
2 changes: 1 addition & 1 deletion lib/wx/core/artprovider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class << self

wx_delete = instance_method(:delete)
define_method(:delete) do | art_prov |
wx_push.bind(self).call(art_prov)
wx_delete.bind(self).call(art_prov)
@__art_provs.delete(art_prov)
end
end
Expand Down
24 changes: 3 additions & 21 deletions lib/wx/wxruby/cmd/sampler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ def self.description
" sampler [help]|[copy DEST]\tRun wxRuby3 Sampler application (or copy samples)."
end

def self.parse_args(args)
opts = OptionParser.new
opts.banner = "Usage: wxruby [global options] sampler [-h]|[-s PATH]\n"
opts.separator ''
opts.on('-s PATH', '--save=PATH',
'Save wxRuby samples under PATH.') do |v|
OPTIONS[:save_path] = v.to_s
end
opts.on('-h', '--help',
'Show this message.') do |v|
puts opts
puts
exit(0)
end
opts.raise_unknown = false
opts.parse!(args)
end

def self.run(argv)
if argv == :describe
description
Expand All @@ -47,15 +29,15 @@ def self.run(argv)
puts ' Starts the sampler application if called without arguments.'
puts ' Otherwise shows this help for argument "help" or copies the included wxRuby'
puts ' sample folders under the directory indicated by DEST for argument "copy DEST".'
puts ' The directory indicated by DEST *must* already exist.'
puts ' The directory indicated by DEST *must* already exist.'
puts
elsif arg == 'copy'
unless File.directory?(dest = argv.shift)
STDERR.puts "ERROR: Invalid destination folder #{DEST}"
STDERR.puts "ERROR: Invalid destination folder #{dest}"
exit(1)
end
Dir[File.join(WxRuby::ROOT, 'samples', '*')].each do |fp|
FileUtils.cp_r(fp, dest, verbose: true, noop: true)
FileUtils.cp_r(fp, dest, verbose: true)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions rakelib/gem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ file WXRuby3::Gem.gem_file('wxruby3', WXRuby3::WXRUBY_VERSION) => WXRuby3::Gem.m
'--exclude=lib/wx/*.rb' <<
"'--exclude=lib/wx/(aui|core|grid|html|pg|prt|rbn|rtc|stc|wxruby)/.*'"
gem.metadata = {
"bug_tracker_uri" => "https://github.com/mcorino/wxruby3/issues",
"source_code_uri" => "https://github.com/mcorino/wxruby3",
"bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues",
"source_code_uri" => "https://github.com/mcorino/wxRuby3",
"documentation_uri" => "https://mcorino.github.io/wxRuby3",
"homepage_uri" => "https://github.com/mcorino/wxruby3",
"homepage_uri" => "https://github.com/mcorino/wxRuby3",
}
gem.post_install_message = <<~__MSG
Expand Down Expand Up @@ -97,10 +97,10 @@ if WXRuby3.is_bootstrapped?
gem.add_dependency 'test-unit', '~> 3.5'
gem.rdoc_options << '--exclude=\\.dll' << '--exclude=\\.so'
gem.metadata = {
"bug_tracker_uri" => "https://github.com/mcorino/wxruby3/issues",
"source_code_uri" => "https://github.com/mcorino/wxruby3",
"bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues",
"source_code_uri" => "https://github.com/mcorino/wxRuby3",
"documentation_uri" => "https://mcorino.github.io/wxRuby3",
"homepage_uri" => "https://github.com/mcorino/wxruby3",
"homepage_uri" => "https://github.com/mcorino/wxRuby3",
}
end
WXRuby3::Gem.build_gem(gemspec)
Expand Down
4 changes: 2 additions & 2 deletions rakelib/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def self.manifest(gemtype = :src)
manifest = Rake::FileList.new
manifest.include %w[bin/*] # *nix executables in bin/
manifest.exclude %w[bin/*.bat] unless WXRuby3.config.windows?
manifest.include %w[lib/**/* samples/**/* tests/**/*]
manifest.include %w[assets/**/* lib/**/* samples/**/* tests/**/*]
if gemtype == :bin
if WXRuby3.config.get_config('with-wxwin')
manifest.include "ext/*.#{WXRuby3.config.dll_mask}"
Expand All @@ -39,7 +39,7 @@ def self.manifest(gemtype = :src)
manifest.include 'rakelib/**/*'
manifest.exclude %w[rakefile/install.rake rakelib/help.* rakelib/package.* rakelib/gem.* rakelib/bin.* rakelib/memcheck.* rakelib/memcheck/**/*]
end
manifest.include %w{LICENSE README.md CREDITS.md .yardopts}
manifest.include %w{LICENSE README.md CREDITS.md INSTALL.md .yardopts}
manifest
end

Expand Down
34 changes: 23 additions & 11 deletions rakelib/lib/director/window.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,29 @@ def setup
extern VALUE wxRuby_GetWindowClass() {
return SwigClassWxWindow.klass;
}
// we need this static method here because we do not want SWIG to parse the preprocessor
// statements (#if/#else/#endif) which it does in %extend blocks
static VALUE do_paint_buffered(wxWindow* ptr)
{
VALUE rc = Qnil;
wxAutoBufferedPaintDC dc(ptr);
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
wxPaintDC* ptr_dc = &dc;
VALUE r_class = rb_const_get(mWxCore, rb_intern("PaintDC"));
#else
wxMemoryDC* ptr_dc = &dc;
VALUE r_class = rb_const_get(mWxCore, rb_intern("MemoryDC"));
#endif
swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(r_class);
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ptr_dc), swig_type, 0);
rc = rb_yield(rb_dc);
SWIG_RubyRemoveTracking((void *)ptr_dc);
DATA_PTR(rb_dc) = NULL;
return rc;
}
__HEREDOC
spec.add_header_code 'static VALUE do_paint_buffered(wxWindow* ptr);'
spec.add_extend_code 'wxWindow', <<~__HEREDOC
// passes a DC for drawing on Window into a passed ruby block, and
// ensure that the DC is correctly deleted when drawing is
Expand Down Expand Up @@ -200,17 +222,7 @@ def setup
{
if (!rb_block_given_p()) rb_raise(rb_eArgError, "No block given for Window#paint_buffered");
VALUE rc = Qnil;
wxWindow *ptr = self;
wxAutoBufferedPaintDC dc(ptr);
VALUE r_class = rb_const_get(mWxCore, rb_intern("MemoryDC"));
swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(r_class);
VALUE rb_dc = SWIG_NewPointerObj((void *) &dc, swig_type, 0);
rc = rb_yield(rb_dc);
SWIG_RubyRemoveTracking((void *) &dc);
DATA_PTR(rb_dc) = NULL;
return rc;
return do_paint_buffered(self);
}
// Return a window handle as a platform-specific ruby integer
Expand Down
4 changes: 2 additions & 2 deletions rakelib/package.rake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Rake::PackageTask.new("wxruby3", WXRuby3::WXRUBY_VERSION) do |p|
p.need_tar_gz = true
p.need_zip = true
p.package_files.include(%w{ext/wxruby3/wxruby.ico ext/wxruby3/swig/**/*.{i,rc,swg}})
p.package_files.include(%w{samples/**/* lib/**/* tests/**/* rakelib/**/*})
p.package_files.include(%w{assets/**/* samples/**/* lib/**/* tests/**/* rakelib/**/*})
p.package_files.exclude(%w{lib/wx/doc/gen/**/* rakelib/deps/**/*})
p.package_files.include(%w{CHANGES* INSTALL* LICENSE* Gemfile rakefile README.md CREDITS.md .yardopts ext/ext_conf*.rb})
p.package_files.include(%w{INSTALL* LICENSE* Gemfile rakefile README.md CREDITS.md .yardopts ext/ext_conf*.rb})
end

0 comments on commit 5fa9039

Please sign in to comment.