windows_gui 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ec23607fe3529f755af6166bb29d24030adca1d
4
- data.tar.gz: bfd01485c8c783919aedb5f32d25f1e1197d7a19
3
+ metadata.gz: dd68025b2fa21a94a85522e2f447ec2e335bbe31
4
+ data.tar.gz: 6d17c971061189d5336ecaf88125a906f143f44e
5
5
  SHA512:
6
- metadata.gz: e791e779aa10e363f028acec6d8d2e6344649ed715b2ff5cb3f1045a18850fae0e2a0f26bedf7aef7c75d180bb68fc4bf8df18875c74dcfd30554428c2eda363
7
- data.tar.gz: 628ac854859fb18eb80586fb0c788a377d09a8510d05625892aec071672f0ecfa81c6fa243c209bcf1b1243290c132f545962aff63e6ed7f780266cc1bc41fe0
6
+ metadata.gz: c57f65b54fea603c8a3d02c303f95d834605cafdce9cc0c6e46244ccb5f77fc624a594c63b27ff1dc1947e04a236458a9ac729774d1fee1b04d9581a5f9c6dc7
7
+ data.tar.gz: d72617c3447e74b1ece4dc38a5aefa77144da6090991dfd5c986a166f0f7c8194f6d42b65728ad161e0cfe34e67f527bdd8bdb301dcf41e476bee9e6af8bca35
@@ -1,5 +1,9 @@
1
1
  # Release Notes
2
2
 
3
+ ## 4.2.1
4
+
5
+ Add ShellExecute bindings and option to open the UIRibbon resources build log on build failure
6
+
3
7
  ## 4.2.0
4
8
 
5
9
  Add crude mechanism for building UIRibbon resources on the fly (requires devenv)
@@ -12,23 +12,27 @@ CmdTab1Group1_SmallImages_RESID = 60005
12
12
  CmdTab1Group1_SmallImages_120__RESID = 60006
13
13
  CmdTab1Group1_LargeImages_RESID = 60007
14
14
  CmdTab1Group1_LargeImages_120__RESID = 60008
15
- CmdItem1 = 6
16
- CmdItem1_LabelTitle_RESID = 60009
17
- CmdItem1_LabelDescription_RESID = 60010
18
- CmdItem1_TooltipDescription_RESID = 60011
19
- CmdItem1_SmallImages_RESID = 60012
20
- CmdItem1_SmallImages_120__RESID = 60013
21
- CmdItem1_LargeImages_RESID = 60014
22
- CmdItem1_LargeImages_120__RESID = 60015
23
- CmdButton1 = 7
24
- CmdButton1_LabelTitle_RESID = 60016
25
- CmdButton1_LabelDescription_RESID = 60017
26
- CmdButton1_TooltipDescription_RESID = 60018
27
- CmdButton1_SmallImages_RESID = 60019
28
- CmdButton1_SmallImages_120__RESID = 60020
29
- CmdButton1_LargeImages_RESID = 60021
30
- CmdButton1_LargeImages_120__RESID = 60022
31
- CmdAOT = 8
32
- CmdAOT_LabelTitle_RESID = 60023
33
- CmdAOT_LabelDescription_RESID = 60024
34
- CmdAOT_TooltipDescription_RESID = 60025
15
+ CmdAOT = 6
16
+ CmdAOT_LabelTitle_RESID = 60009
17
+ CmdAOT_LabelDescription_RESID = 60010
18
+ CmdAOT_TooltipDescription_RESID = 60011
19
+ CmdAOT_SmallImages_RESID = 60012
20
+ CmdAOT_SmallImages_120__RESID = 60013
21
+ CmdAOT_LargeImages_RESID = 60014
22
+ CmdAOT_LargeImages_120__RESID = 60015
23
+ CmdItem1 = 7
24
+ CmdItem1_LabelTitle_RESID = 60016
25
+ CmdItem1_LabelDescription_RESID = 60017
26
+ CmdItem1_TooltipDescription_RESID = 60018
27
+ CmdItem1_SmallImages_RESID = 60019
28
+ CmdItem1_SmallImages_120__RESID = 60020
29
+ CmdItem1_LargeImages_RESID = 60021
30
+ CmdItem1_LargeImages_120__RESID = 60022
31
+ CmdButton1 = 8
32
+ CmdButton1_LabelTitle_RESID = 60023
33
+ CmdButton1_LabelDescription_RESID = 60024
34
+ CmdButton1_TooltipDescription_RESID = 60025
35
+ CmdButton1_SmallImages_RESID = 60026
36
+ CmdButton1_SmallImages_120__RESID = 60027
37
+ CmdButton1_LargeImages_RESID = 60028
38
+ CmdButton1_LargeImages_120__RESID = 60029
@@ -2,6 +2,7 @@
2
2
  #WINDOWS_COM_TRACE_CALL_ARGS = true
3
3
 
4
4
  require 'windows_gui'
5
+ require 'windows_gui/shell'
5
6
  require 'windows_gui/uiribbon'
6
7
 
7
8
  include WindowsGUI
@@ -11,7 +12,7 @@ class UIF < UIFramework
11
12
  def initialize(hwnd)
12
13
  @hwnd = hwnd
13
14
 
14
- super()
15
+ super() # wire COM stuff
15
16
  end
16
17
 
17
18
  attr_reader :hwnd
@@ -21,19 +22,19 @@ class UICH < IUICommandHandlerImpl
21
22
  def initialize(uif)
22
23
  @uif = uif
23
24
 
24
- super()
25
+ super() # wire COM stuff
25
26
  end
26
27
 
27
28
  attr_reader :uif
28
29
 
29
30
  def OnAOT(*args)
30
- UsingFFIStructs(PROPVARIANT.new) { |v|
31
- uif.GetUICommandProperty(CmdAOT, UI_PKEY_BooleanValue, v)
31
+ aot = PROPVARIANT[VT_BOOL, :boolVal, 0]
32
32
 
33
- SetWindowPos(uif.hwnd,
34
- (v[:boolVal] == -1) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
35
- )
36
- }
33
+ uif.GetUICommandProperty(CmdAOT, UI_PKEY_BooleanValue, aot)
34
+ SetWindowPos(uif.hwnd,
35
+ (aot[:boolVal] == -1) ? HWND_TOPMOST : HWND_NOTOPMOST,
36
+ 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
37
+ )
37
38
  end
38
39
 
39
40
  def OnItem1(*args)
@@ -58,6 +59,8 @@ class UICH < IUICommandHandlerImpl
58
59
  uif.SetUICommandProperty(CmdButton1, UI_PKEY_Enabled, PROPVARIANT[VT_BOOL, :boolVal, 0])
59
60
  end
60
61
 
62
+ # COM interface method implementations
63
+
61
64
  def Execute(*args)
62
65
  case args[0]
63
66
  when CmdAOT
@@ -76,11 +79,13 @@ class UIA < IUIApplicationImpl
76
79
  def initialize(uich)
77
80
  @uich = uich
78
81
 
79
- super()
82
+ super() # wire COM stuff
80
83
  end
81
84
 
82
85
  attr_reader :uich
83
86
 
87
+ # COM interface method implementations
88
+
84
89
  def OnCreateUICommand(*args)
85
90
  uich.QueryInterface(uich.class::IID, args[-1])
86
91
 
@@ -99,7 +104,13 @@ def OnCreate(hwnd,
99
104
  )
100
105
  xtra = Id2Ref[GetWindowLong(hwnd, GWL_USERDATA)]
101
106
 
102
- UIResources.Build(clean: true) if UIResources.BuildNeeded?()
107
+ # attempt to build UIRibbon resources if the resource dll is missing
108
+ # or UIRibbon description xml file exists and is newer than the resource dll
109
+ # (requires installed developement environment (Visual Studio Express will do))
110
+ UIResources.Build(
111
+ clean_byproducts: true,
112
+ open_log_if_failed: true
113
+ ) if UIResources.BuildNeeded?()
103
114
 
104
115
  xtra[:uif] = UIF.new(hwnd)
105
116
  xtra[:uich] = UICH.new(xtra[:uif])
@@ -108,9 +119,7 @@ def OnCreate(hwnd,
108
119
  xtra[:uif].Initialize(hwnd, xtra[:uia])
109
120
  xtra[:uif].LoadUI(UIResources.Load(), L('APPLICATION_RIBBON'))
110
121
 
111
- UsingFFIStructs(PROPVARIANT[VT_BOOL, :boolVal, -1]) { |v|
112
- xtra[:uif].SetUICommandProperty(CmdAOT, UI_PKEY_BooleanValue, v)
113
- }
122
+ xtra[:uif].SetUICommandProperty(CmdAOT, UI_PKEY_BooleanValue, PROPVARIANT[VT_BOOL, :boolVal, -1])
114
123
 
115
124
  0
116
125
  end
@@ -17,6 +17,17 @@
17
17
  </Command.LargeImages>
18
18
  </Command>
19
19
 
20
+ <Command Name='cmdAOT' LabelTitle='&amp;Always On Top' LabelDescription='Toggle Always On Top state' TooltipDescription='Toggle Always On Top state'>
21
+ <Command.SmallImages>
22
+ <Image>../res/go-top-small.bmp</Image>
23
+ <Image MinDPI='120'>../res/go-top.bmp</Image>
24
+ </Command.SmallImages>
25
+ <Command.LargeImages>
26
+ <Image>../res/go-top.bmp</Image>
27
+ <Image MinDPI='120'>../res/go-top-big.bmp</Image>
28
+ </Command.LargeImages>
29
+ </Command>
30
+
20
31
  <Command Name='cmdItem1' LabelTitle='&amp;Item1' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
21
32
  <Command.SmallImages>
22
33
  <Image>../res/go-previous-small.bmp</Image>
@@ -37,9 +48,6 @@
37
48
  <Image>../res/go-next.bmp</Image>
38
49
  <Image MinDPI='120'>../res/go-next-big.bmp</Image>
39
50
  </Command.LargeImages>
40
- </Command>
41
-
42
- <Command Name='cmdAOT' LabelTitle='&amp;Always On Top' LabelDescription='LabelDescription...' TooltipDescription='TooltipDescription...'>
43
51
  </Command>
44
52
  </Application.Commands>
45
53
 
@@ -56,7 +64,7 @@
56
64
  <Ribbon.QuickAccessToolbar>
57
65
  <QuickAccessToolbar CommandName='cmdQAT'>
58
66
  <QuickAccessToolbar.ApplicationDefaults>
59
- <CheckBox CommandName='cmdAOT' />
67
+ <ToggleButton CommandName='cmdAOT' />
60
68
  <Button CommandName='cmdItem1' />
61
69
  <Button CommandName='cmdButton1' />
62
70
  </QuickAccessToolbar.ApplicationDefaults>
Binary file
@@ -1,7 +1,7 @@
1
1
  require 'weakref'
2
2
  require 'ffi'
3
3
 
4
- WINDOWS_GUI_VERSION = '4.2.0'
4
+ WINDOWS_GUI_VERSION = '4.2.1'
5
5
 
6
6
  WINDOWS_GUI_VISUAL_STYLES = true unless defined?(WINDOWS_GUI_VISUAL_STYLES)
7
7
  WINDOWS_GUI_DPI_AWARE = true unless defined?(WINDOWS_GUI_DPI_AWARE)
@@ -0,0 +1,30 @@
1
+ if __FILE__ == $0
2
+ require_relative 'common'
3
+ require_relative 'libc'
4
+ end
5
+
6
+ module WindowsGUI
7
+ ffi_lib 'shell32'
8
+ ffi_convention :stdcall
9
+
10
+ SE_ERR_FNF = 2
11
+ SE_ERR_PNF = 3
12
+ SE_ERR_ACCESSDENIED = 5
13
+ SE_ERR_OOM = 8
14
+ SE_ERR_DLLNOTFOUND = 32
15
+ SE_ERR_SHARE = 26
16
+ SE_ERR_ASSOCINCOMPLETE = 27
17
+ SE_ERR_DDETIMEOUT = 28
18
+ SE_ERR_DDEFAIL = 29
19
+ SE_ERR_DDEBUSY = 30
20
+ SE_ERR_NOASSOC = 31
21
+
22
+ attach_function :ShellExecute, :ShellExecuteW, [
23
+ :pointer,
24
+ :buffer_in,
25
+ :buffer_in,
26
+ :buffer_in,
27
+ :buffer_in,
28
+ :int
29
+ ], :int
30
+ end
@@ -64,8 +64,12 @@ call "#{opts[:vcvars]}" >> "#{opts[:name]}.log" && \
64
64
  "#{opts[:link]}" /nologo /machine:x86 /dll /noentry /out:"#{opts[:name]}.dll" "#{ENV['TEMP']}/#{opts[:name]}.res" >> "#{opts[:name]}.log"
65
65
  CMD
66
66
 
67
- raise "UIRibbon resources build FAILED - see #{log_path} for details" if
68
- File.read(log_path) =~ /error/im
67
+ if File.read(log_path) =~ /error/im
68
+ ShellExecute(nil, L('open'), L(log_path.dup), nil, nil, SW_SHOWNORMAL) if
69
+ opts[:open_log_if_failed]
70
+
71
+ raise "UIRibbon resources build FAILED - see #{log_path} for details"
72
+ end
69
73
 
70
74
  File.open(rb_path, 'w') { |rb|
71
75
  rb.puts "# Generated by the UIRibbon build, do NOT modify\n\n"
@@ -77,7 +81,7 @@ call "#{opts[:vcvars]}" >> "#{opts[:name]}.log" && \
77
81
 
78
82
  %w{bml h rc}.each { |ext|
79
83
  File.delete("#{path}/#{opts[:name]}.#{ext}") if File.exist?("#{path}/#{opts[:name]}.#{ext}")
80
- } if opts[:clean]
84
+ } if opts[:clean_byproducts]
81
85
 
82
86
  STDERR.puts "UIRibbon resources build succeeded"
83
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: windows_gui
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radoslav Peev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-04 00:00:00.000000000 Z
11
+ date: 2017-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -63,11 +63,15 @@ files:
63
63
  - examples/res/go-previous-big.bmp
64
64
  - examples/res/go-previous-small.bmp
65
65
  - examples/res/go-previous.bmp
66
+ - examples/res/go-top-big.bmp
67
+ - examples/res/go-top-small.bmp
68
+ - examples/res/go-top.bmp
66
69
  - lib/windows_gui.rb
67
70
  - lib/windows_gui/common.rb
68
71
  - lib/windows_gui/gdi.rb
69
72
  - lib/windows_gui/kernel.rb
70
73
  - lib/windows_gui/libc.rb
74
+ - lib/windows_gui/shell.rb
71
75
  - lib/windows_gui/uiribbon.rb
72
76
  - lib/windows_gui/user.rb
73
77
  - screenshot.png