Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #257

Merged
merged 18 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ permissions:
env:
WXWIDGETS_ROOT: ${{ github.workspace }}/ext/wxWidgets
WXWIN_INSTALL: ${{ github.workspace }}/ext/wxWidgets/install
WXWIDGETS_LATEST_STABLE: 3.2.4

jobs:
build:
Expand Down Expand Up @@ -284,7 +285,16 @@ jobs:
if [ "${{ matrix.wxw_type }}" == "develop" ]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WXWIN_INSTALL/lib
fi
wxruby check
wxruby check

- name: Check embedded wxWidgets version
if: matrix.wxw_type == 'embed'
run: |
if [ "${{ matrix.wxr_type }}" == "develop" ]; then
bundle exec rake wxruby:exec[ruby,tools/check_wxw_version.rb,$WXWIDGETS_LATEST_STABLE]
else
ruby tools/check_wxw_version.rb "$WXWIDGETS_LATEST_STABLE"
fi

- name: Run wxRuby3 regression tests
run: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
NSUnbufferedIO: YES
WXWIDGETS_ROOT: ${{ github.workspace }}/ext/wxWidgets
WXWIN_INSTALL: ${{ github.workspace }}/ext/wxWidgets/install
WXWIDGETS_LATEST_STABLE: 3.2.4

steps:
- name: Show default Ruby
Expand Down Expand Up @@ -328,6 +329,15 @@ jobs:
run: |
wxruby check

- name: Check embedded wxWidgets version
if: matrix.wxw_type == 'embed'
run: |
if [ "${{ matrix.wxr_type }}" == "develop" ]; then
bundle exec rake wxruby:exec[ruby,tools/check_wxw_version.rb,$WXWIDGETS_LATEST_STABLE]
else
ruby tools/check_wxw_version.rb "$WXWIDGETS_LATEST_STABLE"
fi

- name: Run wxRuby3 regression tests
run: |
if [ "${{ matrix.wxr_type }}" == "develop" ]; then
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/msw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ env:
DOXYGEN_ROOT: ${{ github.workspace }}\doxygen
WXWIDGETS_ROOT: ${{ github.workspace }}\ext\wxWidgets
WXWIN_ROOT: ${{ github.workspace }}\ext\wxWidgets\install
# WXRUBY_RELEASE: 1
WXWIDGETS_LATEST_STABLE: 3.2.4

jobs:
build:
Expand Down Expand Up @@ -216,6 +216,16 @@ jobs:
run: |
wxruby check

- name: Check embedded wxWidgets version
if: matrix.wxw_type == 'embed'
run: |
If ("${{ matrix.wxr_type }}" -eq "develop") {
bundle exec rake "wxruby:exec[ruby,tools/check_wxw_version.rb,$env:WXWIDGETS_LATEST_STABLE]"
}
Else {
ruby tools/check_wxw_version.rb "$env:WXWIDGETS_LATEST_STABLE"
}

- name: Run wxRuby3 regression tests
run: |
If ("${{ matrix.wxr_type }}" -eq "develop") {
Expand Down
11 changes: 11 additions & 0 deletions lib/wx/core/menu_bar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ class Wx::MenuBar

def initialize(*args, &block)
wx_initialize(*args)
if Wx::PLATFORM == 'WXOSX'
# OSX's standard Apple/Application menu gets titled with the executables name by default
# which is 'ruby' for wxRuby and this title is near impossible to reliably change.
# Therefor we implemented (a little stunted) workaround here to deal with Apple's crap.
# We insert a disabled item at the start of this menu with the AppDisplayName and follow
# it up with a nice separator. This way at least we will always be able to see which wxRuby
# app the visible menu belongs to.
apple_menu = osx_get_apple_menu
apple_menu.insert(0, Wx::ID_NONE, Wx.get_app.get_app_display_name).enable(false)
apple_menu.insert_separator(1)
end
if block
if block.arity == -1 or block.arity == 0
self.instance_eval(&block)
Expand Down
14 changes: 12 additions & 2 deletions lib/wx/doc/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,82 @@ class App
class << self

# Set the menu item id for the About menu item.
# Default is {Wx::ID_ABOUT}
# Default is {Wx::ID_ABOUT}. Setting to {Wx::ID_NONE} will disable moving the About item to the Application menu.
# @param [Integer] id
# @wxrb_require WXOSX
# @see Wx::App.get_mac_about_menu_itemid
def set_mac_about_menu_itemid(id) end
alias :mac_about_menu_itemid= :set_mac_about_menu_itemid

# Get the current menu item id for the About menu item.
# Default is {Wx::ID_ABOUT}
# @return [Integer]
# @wxrb_require WXOSX
# @see Wx::App.set_mac_about_menu_itemid
def get_mac_about_menu_itemid; end
alias :mac_about_menu_itemid :get_mac_about_menu_itemid

# Set the menu item id for the Preferences menu item.
# Default is {Wx::ID_PREFERENCES}
# @param [Integer] id
# @wxrb_require WXOSX
# @see Wx::App.get_mac_preferences_menu_itemid
def set_mac_preferences_menu_itemid(id) end
alias :mac_preferences_menu_itemid= :set_mac_preferences_menu_itemid

# Get the current menu item id for the Preferences menu item.
# Default is {Wx::ID_PREFERENCES}
# @return [Integer]
# @wxrb_require WXOSX
# @see Wx::App.set_mac_preferences_menu_itemid
def get_mac_preferences_menu_itemid; end
alias :mac_preferences_menu_itemid :get_mac_preferences_menu_itemid

# Set the menu item id for the Exit menu item.
# Default is {Wx::ID_EXIT}
# Default is {Wx::ID_EXIT}. Setting to {Wx::ID_NONE} will disable hiding the exit item. Standard item will still be added to Application menu.
# @param [Integer] id
# @wxrb_require WXOSX
# @see Wx::App.get_mac_exit_menu_itemid
def set_mac_exit_menu_itemid(id) end
alias :mac_exit_menu_itemid= :set_mac_exit_menu_itemid

# Get the current menu item id for the Exit menu item.
# Default is {Wx::ID_EXIT}
# @return [Integer]
# @wxrb_require WXOSX
# @see Wx::App.set_mac_exit_menu_itemid
def get_mac_exit_menu_itemid; end
alias :mac_exit_menu_itemid :get_mac_exit_menu_itemid

# Set the menu title for the Help menu.
# Default is '&Help'
# @param [String] title
# @wxrb_require WXOSX
# @see Wx::App.get_mac_help_menu_title
def set_mac_help_menu_title(title) end
alias :mac_help_menu_title= :set_mac_help_menu_title

# Get the current title for the Help menu.
# Default is '&Help'
# @return [String]
# @wxrb_require WXOSX
# @see Wx::App.set_mac_help_menu_title
def get_mac_help_menu_title; end
alias :mac_help_menu_title :get_mac_help_menu_title

# Set the menu title for the Window menu.
# Default is '&Window'
# @param [String] title
# @wxrb_require WXOSX
# @see Wx::App.get_mac_window_menu_title
def set_mac_window_menu_title(title) end
alias :mac_window_menu_title= :set_mac_window_menu_title

# Get the current title for the Window menu.
# Default is '&Window'
# @return [String]
# @wxrb_require WXOSX
# @see Wx::App.set_mac_window_menu_title
def get_mac_window_menu_title; end
alias :mac_window_menu_title :get_mac_window_menu_title

Expand Down
2 changes: 1 addition & 1 deletion rakelib/lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def make_ruby_cmd(*cmd, verbose: true)
private :make_ruby_cmd

def execute(*cmd)
do_run(*cmd.flatten)
sh(exec_env.merge({'RUBYLIB'=>rb_lib_path}), cmd.flatten.join(' '), fail_on_error: true)
end

def run(*cmd, capture: nil, verbose: true)
Expand Down
24 changes: 7 additions & 17 deletions rakelib/lib/config/unixish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,18 @@ def download_file(url, dest)

private

def wx_gitref
super ||
expand("#{get_cfg_string('git')} tag").split("\n").select do |t|
(/\Av(\d+)\.(\d+)\.\d+\Z/ =~ t) && (($1.to_i == 3 && $2.to_i >= 2) || $1.to_i > 3)
end.max
end

def wx_checkout
$stdout.print 'Checking out wxWidgets...' if run_silent?
# clone wxWidgets GIT repository under ext_path
chdir(ext_path) do
if (rc = sh("#{get_cfg_string('git')} clone https://github.com/wxWidgets/wxWidgets.git"))
chdir('wxWidgets') do
tag = if @wx_version
"v#{@wx_version}"
else
expand("#{get_cfg_string('git')} tag").split("\n").select do |t|
(/\Av(\d+)\.(\d+)\.\d+\Z/ =~ t) && (($1.to_i==3 && $2.to_i >= 2) || $1.to_i>3)
end.max
end
tag = wx_gitref ||
expand("#{get_cfg_string('git')} tag").split("\n").select do |t|
(/\Av(\d+)\.(\d+)\.\d+\Z/ =~ t) && (($1.to_i == 3 && $2.to_i >= 2) || $1.to_i > 3)
end.max
# checkout the version we are building against
rc = sh("#{get_cfg_string('git')} checkout #{wx_gitref}")
rc = sh("#{get_cfg_string('git')} checkout #{tag}")
end
end
if rc
Expand Down Expand Up @@ -229,8 +219,8 @@ def init_unix_platform
# add ruby defined shared ruby lib(s); not any other flags
@ruby_libs.concat RB_CONFIG['LIBRUBYARG_SHARED'].split(' ').select { |s| s.start_with?('-l')}

# maintain minimum compatibility with ABI 3.0.0
@wx_abi_version = [ @wx_version, "3.0.0" ].min
# maintain minimum compatibility with ABI 3.0.1
@wx_abi_version = [ @wx_version, "3.0.1" ].min
@wx_cppflags << "-DwxABI_VERSION=%s" % @wx_abi_version.tr(".", "0")
end
end
Expand Down
3 changes: 0 additions & 3 deletions rakelib/lib/director/menu_bar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ def setup
'wxMenuBar::GetLabelTop',
'wxMenuBar::SetLabelTop',
'wxMenuBar::Refresh')
unless Config.instance.wx_version >= '3.3' || Config.instance.wx_abi_version > '3.0.0'
spec.ignore 'wxMenuBar::OSXGetAppleMenu'
end
# for FindItem
spec.map 'wxMenu **' => 'Wx::Menu' do
map_in ignore: true, temp: 'wxMenu *tmp', code: '$1 = &tmp;'
Expand Down
24 changes: 14 additions & 10 deletions samples/sampler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,15 @@ def initialize(title)
@sample_editor = nil

menu_bar = Wx::MenuBar.new
# The "file" menu
menu_file = Wx::Menu.new
# Using Wx::ID_EXIT standard id means the menu item will be given
# the right label for the platform and language, and placed in the
# correct platform-specific menu - eg on OS X, in the Application's menu
menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit wxRuby Sampler")
menu_bar.append(menu_file, "&File")
unless Wx::PLATFORM == 'WXOSX'
# The "file" menu
menu_file = Wx::Menu.new
# Don't add a File menu with only Exit item on OSX as on OSX
# the Exit item there will be hidden and a standard one added to
# the Apple Application menu leaving an empty File menu
menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit wxRuby Sampler")
menu_bar.append(menu_file, "&File")
end

# The "help" menu
menu_help = Wx::Menu.new
Expand Down Expand Up @@ -357,9 +359,11 @@ def on_close(_evt)
destroy
end

def on_iconize(_evt)
hide
_evt.skip
def on_iconize(evt)
# hide is required to hide the application icon from the taskbar on Windows and Linux GTK
# but brings no benefits and causes problems on MacOSX so don't hide there
hide if evt.iconized? && Wx::PLATFORM != 'WXOSX'
evt.skip
end

# End the application; it should finish automatically when the last
Expand Down
3 changes: 3 additions & 0 deletions tools/check_wxw_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

require 'wx'
fail "ERROR: Expected #{ARGV[0]} but is #{Wx::WXWIDGETS_VERSION}" unless Wx::WXWIDGETS_VERSION == ARGV[0]