fzeet 0.4.2 → 0.5.0
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.
- data/examples/Dialog/FileDialog.rbw +34 -0
- data/examples/Raw/UIRibbon/Command.dll +0 -0
- data/examples/Raw/UIRibbon/Command.rb +22 -0
- data/examples/Raw/UIRibbon/Command.rbw +51 -0
- data/examples/Raw/UIRibbon/Command.xml +65 -0
- data/examples/Raw/UIRibbon/Minimal.dll +0 -0
- data/examples/Raw/UIRibbon/Minimal.rb +16 -0
- data/examples/Raw/UIRibbon/Minimal.rbw +39 -0
- data/examples/Raw/UIRibbon/Minimal.xml +55 -0
- data/examples/UIRibbon/Command.dll +0 -0
- data/examples/UIRibbon/Command.rb +22 -0
- data/examples/UIRibbon/Command.rbw +20 -0
- data/examples/UIRibbon/Command.xml +65 -0
- data/examples/UIRibbon/Minimal.dll +0 -0
- data/examples/UIRibbon/Minimal.rb +16 -0
- data/examples/UIRibbon/Minimal.rbw +8 -0
- data/examples/UIRibbon/Minimal.xml +55 -0
- data/examples/UIRibbon/Viewer.rbw +9 -0
- data/examples/res/go-next-small.bmp +0 -0
- data/examples/res/go-next.bmp +0 -0
- data/examples/res/go-previous-small.bmp +0 -0
- data/examples/res/go-previous.bmp +0 -0
- data/lib/fzeet/Control.rb +1 -89
- data/lib/fzeet/ControlButton.rb +28 -0
- data/lib/fzeet/ControlCommon.rb +64 -0
- data/lib/fzeet/Dialog.rb +1 -0
- data/lib/fzeet/DialogCommon.rb +5 -0
- data/lib/fzeet/DialogFileDialog.rb +116 -0
- data/lib/fzeet/UIRibbon.rb +99 -0
- data/lib/fzeet/Window.rb +2 -336
- data/lib/fzeet/WindowCommon.rb +256 -0
- data/lib/fzeet/WindowDialog.rb +73 -0
- data/lib/fzeet/WindowWindow.rb +13 -0
- data/lib/fzeet/common.rb +2 -0
- data/lib/fzeet/windows/com.rb +186 -0
- data/lib/fzeet/windows/comctl.rb +1 -59
- data/lib/fzeet/windows/comctlbutton.rb +30 -0
- data/lib/fzeet/windows/comctlcommon.rb +34 -0
- data/lib/fzeet/windows/comdlg.rb +1 -0
- data/lib/fzeet/windows/comdlgcommon.rb +9 -0
- data/lib/fzeet/windows/comdlgofn.rb +70 -0
- data/lib/fzeet/windows/common.rb +18 -0
- data/lib/fzeet/windows/kernel.rb +3 -0
- data/lib/fzeet/windows/libc.rb +1 -0
- data/lib/fzeet/windows/ole.rb +213 -0
- data/lib/fzeet/windows/shell.rb +43 -0
- data/lib/fzeet/windows/uiribbon.rb +111 -0
- data/lib/fzeet/windows/user.rb +7 -438
- data/lib/fzeet/windows/usercommon.rb +8 -0
- data/lib/fzeet/windows/userctl.rb +1 -68
- data/lib/fzeet/windows/userctlbutton.rb +56 -0
- data/lib/fzeet/windows/userctlcommon.rb +12 -0
- data/lib/fzeet/windows/userkbd.rb +20 -0
- data/lib/fzeet/windows/usermbox.rb +62 -0
- data/lib/fzeet/windows/usermenu.rb +50 -0
- data/lib/fzeet/windows/usermsg.rb +1 -6
- data/lib/fzeet/windows/userspi.rb +29 -0
- data/lib/fzeet/windows/userwnd.rb +276 -0
- data/lib/fzeet/windows.rb +24 -4
- data/lib/fzeet.rb +2 -0
- metadata +54 -6
- /data/examples/{Dialog.rbw → Dialog/Dialog.rbw} +0 -0
- /data/examples/{DialogApplication.rbw → Dialog/DialogApplication.rbw} +0 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
require_relative 'comdlgcommon'
|
2
|
+
|
3
|
+
module Fzeet
|
4
|
+
module Windows
|
5
|
+
OFN_READONLY = 0x00000001
|
6
|
+
OFN_OVERWRITEPROMPT = 0x00000002
|
7
|
+
OFN_HIDEREADONLY = 0x00000004
|
8
|
+
OFN_NOCHANGEDIR = 0x00000008
|
9
|
+
OFN_SHOWHELP = 0x00000010
|
10
|
+
OFN_ENABLEHOOK = 0x00000020
|
11
|
+
OFN_ENABLETEMPLATE = 0x00000040
|
12
|
+
OFN_ENABLETEMPLATEHANDLE = 0x00000080
|
13
|
+
OFN_NOVALIDATE = 0x00000100
|
14
|
+
OFN_ALLOWMULTISELECT = 0x00000200
|
15
|
+
OFN_EXTENSIONDIFFERENT = 0x00000400
|
16
|
+
OFN_PATHMUSTEXIST = 0x00000800
|
17
|
+
OFN_FILEMUSTEXIST = 0x00001000
|
18
|
+
OFN_CREATEPROMPT = 0x00002000
|
19
|
+
OFN_SHAREAWARE = 0x00004000
|
20
|
+
OFN_NOREADONLYRETURN = 0x00008000
|
21
|
+
OFN_NOTESTFILECREATE = 0x00010000
|
22
|
+
OFN_NONETWORKBUTTON = 0x00020000
|
23
|
+
OFN_NOLONGNAMES = 0x00040000
|
24
|
+
OFN_EXPLORER = 0x00080000
|
25
|
+
OFN_NODEREFERENCELINKS = 0x00100000
|
26
|
+
OFN_LONGNAMES = 0x00200000
|
27
|
+
OFN_ENABLEINCLUDENOTIFY = 0x00400000
|
28
|
+
OFN_ENABLESIZING = 0x00800000
|
29
|
+
OFN_DONTADDTORECENT = 0x02000000
|
30
|
+
OFN_FORCESHOWHIDDEN = 0x10000000
|
31
|
+
|
32
|
+
OFN_EX_NOPLACESBAR = 0x00000001
|
33
|
+
|
34
|
+
OFN_SHAREFALLTHROUGH = 2
|
35
|
+
OFN_SHARENOWARN = 1
|
36
|
+
OFN_SHAREWARN = 0
|
37
|
+
|
38
|
+
callback :OFNHOOKPROC, [:pointer, :uint, :uint, :long], :uint
|
39
|
+
|
40
|
+
class OPENFILENAME < FFI::Struct
|
41
|
+
layout \
|
42
|
+
:lStructSize, :ulong,
|
43
|
+
:hwndOwner, :pointer,
|
44
|
+
:hInstance, :pointer,
|
45
|
+
:lpstrFilter, :pointer,
|
46
|
+
:lpstrCustomFilter, :pointer,
|
47
|
+
:nMaxCustFilter, :ulong,
|
48
|
+
:nFilterIndex, :ulong,
|
49
|
+
:lpstrFile, :pointer,
|
50
|
+
:nMaxFile, :ulong,
|
51
|
+
:lpstrFileTitle, :pointer,
|
52
|
+
:nMaxFileTitle, :ulong,
|
53
|
+
:lpstrInitialDir, :pointer,
|
54
|
+
:lpstrTitle, :pointer,
|
55
|
+
:Flags, :ulong,
|
56
|
+
:nFileOffset, :ushort,
|
57
|
+
:nFileExtension, :ushort,
|
58
|
+
:lpstrDefExt, :pointer,
|
59
|
+
:lCustData, :long,
|
60
|
+
:lpfnHook, :OFNHOOKPROC,
|
61
|
+
:lpTemplateName, :pointer,
|
62
|
+
:pvReserved, :pointer,
|
63
|
+
:dwReserved, :ulong,
|
64
|
+
:FlagsEx, :ulong
|
65
|
+
end
|
66
|
+
|
67
|
+
attach_function :GetOpenFileName, :GetOpenFileNameA, [:pointer], :int
|
68
|
+
attach_function :GetSaveFileName, :GetSaveFileNameA, [:pointer], :int
|
69
|
+
end
|
70
|
+
end
|
data/lib/fzeet/windows/common.rb
CHANGED
@@ -34,5 +34,23 @@ module Fzeet
|
|
34
34
|
:right, :long,
|
35
35
|
:bottom, :long
|
36
36
|
end
|
37
|
+
|
38
|
+
class LOGFONT < FFI::Struct
|
39
|
+
layout \
|
40
|
+
:lfHeight, :long,
|
41
|
+
:lfWidth, :long,
|
42
|
+
:lfEscapement, :long,
|
43
|
+
:lfOrientation, :long,
|
44
|
+
:lfWeight, :long,
|
45
|
+
:lfItalic, :uchar,
|
46
|
+
:lfUnderline, :uchar,
|
47
|
+
:lfStrikeOut, :uchar,
|
48
|
+
:lfCharSet, :uchar,
|
49
|
+
:lfOutPrecision, :uchar,
|
50
|
+
:lfClipPrecision, :uchar,
|
51
|
+
:lfQuality, :uchar,
|
52
|
+
:lfPitchAndFamily, :uchar,
|
53
|
+
:lfFaceName, [:char, 32]
|
54
|
+
end
|
37
55
|
end
|
38
56
|
end
|
data/lib/fzeet/windows/kernel.rb
CHANGED
@@ -27,5 +27,8 @@ module Fzeet
|
|
27
27
|
attach_function :DeactivateActCtx, [:ulong, :ulong], :int
|
28
28
|
|
29
29
|
attach_function :GetModuleHandle, :GetModuleHandleA, [:string], :pointer
|
30
|
+
|
31
|
+
attach_function :LoadLibrary, :LoadLibraryA, [:string], :pointer
|
32
|
+
attach_function :FreeLibrary, [:pointer], :int
|
30
33
|
end
|
31
34
|
end
|
data/lib/fzeet/windows/libc.rb
CHANGED
@@ -0,0 +1,213 @@
|
|
1
|
+
require_relative 'com'
|
2
|
+
|
3
|
+
module Fzeet
|
4
|
+
module Windows
|
5
|
+
ffi_lib 'ole32'
|
6
|
+
ffi_convention :stdcall
|
7
|
+
|
8
|
+
attach_function :OleInitialize, [:pointer], :long
|
9
|
+
attach_function :OleUninitialize, [], :void
|
10
|
+
|
11
|
+
attach_function :CoTaskMemFree, [:pointer], :void
|
12
|
+
|
13
|
+
VT_BOOL = 11
|
14
|
+
|
15
|
+
class PROPERTYKEY < FFI::Struct
|
16
|
+
layout \
|
17
|
+
:fmtid, GUID,
|
18
|
+
:pid, :ulong
|
19
|
+
|
20
|
+
def self.[](type, index)
|
21
|
+
new.tap { |key|
|
22
|
+
key[:fmtid].tap { |guid|
|
23
|
+
guid[:Data1] = 0x00000000 + index
|
24
|
+
guid[:Data2] = 0x7363
|
25
|
+
guid[:Data3] = 0x696e
|
26
|
+
[0x84, 0x41, 0x79, 0x8a, 0xcf, 0x5a, 0xeb, 0xb7].each_with_index { |part, i|
|
27
|
+
guid[:Data4][i] = part
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
key[:pid] = type
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module AnonymousSupport
|
37
|
+
def [](k)
|
38
|
+
if members.include?(k)
|
39
|
+
super
|
40
|
+
elsif self[:_].members.include?(k)
|
41
|
+
self[:_][k]
|
42
|
+
else
|
43
|
+
self[:_][:_][k]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def []=(k, v)
|
48
|
+
if members.include?(k)
|
49
|
+
super
|
50
|
+
elsif self[:_].members.include?(k)
|
51
|
+
self[:_][k] = v
|
52
|
+
else
|
53
|
+
self[:_][:_][k] = v
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class LARGE_INTEGER < FFI::Union
|
59
|
+
include AnonymousSupport
|
60
|
+
|
61
|
+
layout \
|
62
|
+
:_, Class.new(FFI::Struct) {
|
63
|
+
layout \
|
64
|
+
:LowPart, :ulong,
|
65
|
+
:HighPart, :long
|
66
|
+
},
|
67
|
+
|
68
|
+
:QuadPart, :long_long
|
69
|
+
end
|
70
|
+
|
71
|
+
class ULARGE_INTEGER < FFI::Union
|
72
|
+
include AnonymousSupport
|
73
|
+
|
74
|
+
layout \
|
75
|
+
:_, Class.new(FFI::Struct) {
|
76
|
+
layout \
|
77
|
+
:LowPart, :ulong,
|
78
|
+
:HighPart, :ulong
|
79
|
+
},
|
80
|
+
|
81
|
+
:QuadPart, :ulong_long
|
82
|
+
end
|
83
|
+
|
84
|
+
class FILETIME < FFI::Struct
|
85
|
+
layout \
|
86
|
+
:dwLowDateTime, :ulong,
|
87
|
+
:dwHighDateTime, :ulong
|
88
|
+
end
|
89
|
+
|
90
|
+
class BSTRBLOB < FFI::Struct
|
91
|
+
layout \
|
92
|
+
:cbSize, :ulong,
|
93
|
+
:pData, :pointer
|
94
|
+
end
|
95
|
+
|
96
|
+
class BLOB < FFI::Struct
|
97
|
+
layout \
|
98
|
+
:cbSize, :ulong,
|
99
|
+
:pBlobData, :pointer
|
100
|
+
end
|
101
|
+
|
102
|
+
class CA < FFI::Struct
|
103
|
+
layout \
|
104
|
+
:cElems, :ulong,
|
105
|
+
:pElems, :pointer
|
106
|
+
end
|
107
|
+
|
108
|
+
class DECIMAL < FFI::Struct
|
109
|
+
layout \
|
110
|
+
:wReserved, :ushort,
|
111
|
+
:scale, :uchar,
|
112
|
+
:sign, :uchar,
|
113
|
+
:Hi32, :ulong,
|
114
|
+
:Lo64, :ulong_long
|
115
|
+
end
|
116
|
+
|
117
|
+
class PROPVARIANT < FFI::Union
|
118
|
+
include AnonymousSupport
|
119
|
+
|
120
|
+
layout \
|
121
|
+
:_, Class.new(FFI::Struct) {
|
122
|
+
layout \
|
123
|
+
:vt, :ushort,
|
124
|
+
:wReserved1, :ushort,
|
125
|
+
:wReserved2, :ushort,
|
126
|
+
:wReserved3, :ushort,
|
127
|
+
:_, Class.new(FFI::Union) {
|
128
|
+
layout \
|
129
|
+
:cVal, :char,
|
130
|
+
:bVal, :uchar,
|
131
|
+
:iVal, :short,
|
132
|
+
:uiVal, :ushort,
|
133
|
+
:lVal, :long,
|
134
|
+
:ulVal, :ulong,
|
135
|
+
:intVal, :int,
|
136
|
+
:uintVal, :uint,
|
137
|
+
:hVal, LARGE_INTEGER,
|
138
|
+
:uhVal, ULARGE_INTEGER,
|
139
|
+
:fltVal, :float,
|
140
|
+
:dblVal, :double,
|
141
|
+
:boolVal, :short,
|
142
|
+
:bool, :short,
|
143
|
+
:scode, :long,
|
144
|
+
:cyVal, :long_long,
|
145
|
+
:date, :double,
|
146
|
+
:filetime, FILETIME,
|
147
|
+
:puuid, :pointer,
|
148
|
+
:pclipdata, :pointer,
|
149
|
+
:bstrVal, :pointer,
|
150
|
+
:bstrblobVal, BSTRBLOB,
|
151
|
+
:blob, BLOB,
|
152
|
+
:pszVal, :pointer,
|
153
|
+
:pwszVal, :pointer,
|
154
|
+
:punkVal, :pointer,
|
155
|
+
:pdispVal, :pointer,
|
156
|
+
:pStream, :pointer,
|
157
|
+
:pStorage, :pointer,
|
158
|
+
:pVersionedStream, :pointer,
|
159
|
+
:parray, :pointer,
|
160
|
+
:cac, CA,
|
161
|
+
:caub, CA,
|
162
|
+
:cai, CA,
|
163
|
+
:caui, CA,
|
164
|
+
:cal, CA,
|
165
|
+
:caul, CA,
|
166
|
+
:cah, CA,
|
167
|
+
:cauh, CA,
|
168
|
+
:caflt, CA,
|
169
|
+
:cadbl, CA,
|
170
|
+
:cabool, CA,
|
171
|
+
:cascode, CA,
|
172
|
+
:cacy, CA,
|
173
|
+
:cadate, CA,
|
174
|
+
:cafiletime, CA,
|
175
|
+
:cauuid, CA,
|
176
|
+
:caclipdata, CA,
|
177
|
+
:cabstr, CA,
|
178
|
+
:cabstrblob, CA,
|
179
|
+
:calpstr, CA,
|
180
|
+
:calpwstr, CA,
|
181
|
+
:capropvar, CA,
|
182
|
+
:pcVal, :pointer,
|
183
|
+
:pbVal, :pointer,
|
184
|
+
:piVal, :pointer,
|
185
|
+
:puiVal, :pointer,
|
186
|
+
:plVal, :pointer,
|
187
|
+
:pulVal, :pointer,
|
188
|
+
:pintVal, :pointer,
|
189
|
+
:puintVal, :pointer,
|
190
|
+
:pfltVal, :pointer,
|
191
|
+
:pdblVal, :pointer,
|
192
|
+
:pboolVal, :pointer,
|
193
|
+
:pdecVal, :pointer,
|
194
|
+
:pscode, :pointer,
|
195
|
+
:pcyVal, :pointer,
|
196
|
+
:pdate, :pointer,
|
197
|
+
:pbstrVal, :pointer,
|
198
|
+
:ppunkVal, :pointer,
|
199
|
+
:ppdispVal, :pointer,
|
200
|
+
:pparray, :pointer,
|
201
|
+
:pvarVal, :pointer
|
202
|
+
}
|
203
|
+
},
|
204
|
+
|
205
|
+
:decVal, DECIMAL
|
206
|
+
|
207
|
+
def self.[](t, *v) new.tap { |var| var.send("#{t}=", *v) } end
|
208
|
+
|
209
|
+
def bool; raise 'Wrong type tag.' unless self[:vt] == VT_BOOL; self[:boolVal] != 0 end
|
210
|
+
def bool=(bool) self[:vt] = VT_BOOL; self[:boolVal] = (bool) ? -1 : 0 end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative 'com'
|
2
|
+
|
3
|
+
module Fzeet
|
4
|
+
module Windows
|
5
|
+
ffi_lib 'shell32'
|
6
|
+
ffi_convention :stdcall
|
7
|
+
|
8
|
+
BIF_RETURNONLYFSDIRS = 0x00000001
|
9
|
+
BIF_DONTGOBELOWDOMAIN = 0x00000002
|
10
|
+
BIF_STATUSTEXT = 0x00000004
|
11
|
+
BIF_RETURNFSANCESTORS = 0x00000008
|
12
|
+
BIF_EDITBOX = 0x00000010
|
13
|
+
BIF_VALIDATE = 0x00000020
|
14
|
+
BIF_NEWDIALOGSTYLE = 0x00000040
|
15
|
+
BIF_USENEWUI = BIF_NEWDIALOGSTYLE | BIF_EDITBOX
|
16
|
+
BIF_BROWSEINCLUDEURLS = 0x00000080
|
17
|
+
BIF_UAHINT = 0x00000100
|
18
|
+
BIF_NONEWFOLDERBUTTON = 0x00000200
|
19
|
+
BIF_NOTRANSLATETARGETS = 0x00000400
|
20
|
+
BIF_BROWSEFORCOMPUTER = 0x00001000
|
21
|
+
BIF_BROWSEFORPRINTER = 0x00002000
|
22
|
+
BIF_BROWSEINCLUDEFILES = 0x00004000
|
23
|
+
BIF_SHAREABLE = 0x00008000
|
24
|
+
BIF_BROWSEFILEJUNCTIONS = 0x00010000
|
25
|
+
|
26
|
+
callback :BFFCALLBACK, [:pointer, :uint, :long, :long], :int
|
27
|
+
|
28
|
+
class BROWSEINFO < FFI::Struct
|
29
|
+
layout \
|
30
|
+
:hwndOwner, :pointer,
|
31
|
+
:pidlRoot, :pointer,
|
32
|
+
:pszDisplayName, :pointer,
|
33
|
+
:lpszTitle, :pointer,
|
34
|
+
:ulFlags, :uint,
|
35
|
+
:lpfn, :BFFCALLBACK,
|
36
|
+
:lParam, :long,
|
37
|
+
:iImage, :int
|
38
|
+
end
|
39
|
+
|
40
|
+
attach_function :SHBrowseForFolder, :SHBrowseForFolderA, [:pointer], :pointer
|
41
|
+
attach_function :SHGetPathFromIDList, :SHGetPathFromIDListA, [:pointer, :pointer], :int
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require_relative 'ole'
|
2
|
+
|
3
|
+
module Fzeet
|
4
|
+
module Windows
|
5
|
+
ffi_lib 'uiribbon'
|
6
|
+
ffi_convention :stdcall
|
7
|
+
|
8
|
+
def LoadRibbonDll(name = File.basename($0, '.rbw'), opts = {})
|
9
|
+
if !File.exist?("#{File.dirname($0)}/#{name}.dll") || (
|
10
|
+
File.exist?("#{File.dirname($0)}/#{name}.xml") &&
|
11
|
+
test(?M, "#{File.dirname($0)}/#{name}.xml") > test(?M, "#{File.dirname($0)}/#{name}.dll")
|
12
|
+
)
|
13
|
+
|
14
|
+
opts[:sdkroot] ||= "#{ENV['SystemDrive']}/Program Files/Microsoft SDKs/Windows/v7.1"
|
15
|
+
opts[:vcroot] ||= "#{ENV['ProgramFiles']}/Microsoft Visual Studio 10.0/VC"
|
16
|
+
#opts[:mingwroot] ||= "#{ENV['SystemDrive']}/MinGW"
|
17
|
+
|
18
|
+
opts[:uicc] ||= "#{opts[:sdkroot]}/bin/uicc.exe"
|
19
|
+
opts[:rc] ||= "#{opts[:sdkroot]}/bin/rc.exe"
|
20
|
+
opts[:vcvars] ||= "#{opts[:vcroot]}/bin/vcvars32.bat"
|
21
|
+
opts[:link] ||= "#{opts[:vcroot]}/bin/link.exe"
|
22
|
+
#opts[:windres] ||= "#{opts[:mingwroot]}/bin/windres.exe"
|
23
|
+
#opts[:gcc] ||= "#{opts[:mingwroot]}/bin/gcc.exe"
|
24
|
+
|
25
|
+
opts[:clean] = true if opts[:clean].nil?
|
26
|
+
|
27
|
+
raise 'Building the Ribbon requires Windows SDK and VC.' unless
|
28
|
+
[:uicc, :rc, :vcvars, :link].all? { |tool| File.exist?(opts[tool]) }
|
29
|
+
#raise 'Building the Ribbon requires Windows SDK and MinGW.' unless
|
30
|
+
# [:uicc, :windres, :gcc].all? { |tool| File.exist?(opts[tool]) }
|
31
|
+
|
32
|
+
system <<-CMD
|
33
|
+
@echo off &\
|
34
|
+
"#{opts[:uicc]}" "#{name}.xml" "#{name}.bml" /header:"#{name}.h" /res:"#{name}.rc" > "#{name}.log" &\
|
35
|
+
"#{opts[:rc]}" /nologo /fo"#{ENV['TEMP']}/#{name}.res" "#{name}.rc" >> "#{name}.log" &\
|
36
|
+
call "#{opts[:vcvars]}" >> "#{name}.log" &\
|
37
|
+
"#{opts[:link]}" /nologo /machine:x86 /dll /noentry /out:"#{name}.dll" "#{ENV['TEMP']}/#{name}.res" >> "#{name}.log"
|
38
|
+
CMD
|
39
|
+
# system <<-CMD
|
40
|
+
#@echo off &\
|
41
|
+
# "#{opts[:uicc]}" "#{name}.xml" "#{name}.bml" /header:"#{name}.h" /res:"#{name}.rc" > "#{name}.log" &\
|
42
|
+
# "#{opts[:windres]}" -o"#{ENV['TEMP']}/#{name}.o" "#{name}.rc" >> "#{name}.log" &\
|
43
|
+
# "#{opts[:gcc]}" -shared -o"#{name}.dll" "#{ENV['TEMP']}/#{name}.o" >> "#{name}.log"
|
44
|
+
# CMD
|
45
|
+
|
46
|
+
raise "Ribbon build failed - see #{name}.log for details." if File.read("#{name}.log") =~ /error/i
|
47
|
+
|
48
|
+
File.open("#{name}.rb", 'w') { |rb|
|
49
|
+
File.foreach("#{name}.h") { |line|
|
50
|
+
rb.puts "#{$1[0].upcase}#{$1[1..-1]} = #{$2}" if line =~ /^\s*#define\s+(\w+)\s+(\d+)/
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
%w{bml h rc}.each { |ext|
|
55
|
+
File.delete("#{name}.#{ext}") if File.exist?("#{name}.#{ext}")
|
56
|
+
} if opts[:clean]
|
57
|
+
end
|
58
|
+
|
59
|
+
require name
|
60
|
+
|
61
|
+
raise "LoadLibrary('#{File.dirname($0)}/#{name}.dll') failed." if (hdll = LoadLibrary("#{File.dirname($0)}/#{name}.dll")).null?
|
62
|
+
|
63
|
+
hdll.tap { at_exit { FreeLibrary(hdll) } }
|
64
|
+
end
|
65
|
+
|
66
|
+
module_function :LoadRibbonDll
|
67
|
+
|
68
|
+
UI_PKEY_Enabled = PROPERTYKEY[VT_BOOL, 1]
|
69
|
+
|
70
|
+
LIBID_UIRibbon = GUID['942f35c2-e83b-45ef-b085-ac295dd63d5b']
|
71
|
+
|
72
|
+
CLSID_UIRibbonFramework = GUID['926749fa-2615-4987-8845-c33e65f2b957']
|
73
|
+
|
74
|
+
IID_IUICommandHandler = GUID['75ae0a2d-dc03-4c9f-8883-069660d0beb6']
|
75
|
+
IID_IUIApplication = GUID['D428903C-729A-491d-910D-682A08FF2522']
|
76
|
+
IID_IUIFramework = GUID['F4F0385D-6872-43a8-AD09-4C339CB3F5C5']
|
77
|
+
|
78
|
+
IUICommandHandler = COM::Interface[IUnknown,
|
79
|
+
IID_IUICommandHandler,
|
80
|
+
|
81
|
+
Execute: [[:uint, :int, :pointer, :pointer, :pointer], :long],
|
82
|
+
UpdateProperty: [[:uint, :pointer, :pointer, :pointer], :long]
|
83
|
+
]
|
84
|
+
|
85
|
+
IUIApplication = COM::Interface[IUnknown,
|
86
|
+
IID_IUIApplication,
|
87
|
+
|
88
|
+
OnViewChanged: [[:uint, :int, :pointer, :int, :int], :long],
|
89
|
+
OnCreateUICommand: [[:uint, :int, :pointer], :long],
|
90
|
+
OnDestroyUICommand: [[:uint, :int, :pointer], :long]
|
91
|
+
]
|
92
|
+
|
93
|
+
IUIFramework = COM::Interface[IUnknown,
|
94
|
+
IID_IUIFramework,
|
95
|
+
|
96
|
+
Initialize: [[:pointer, :pointer], :long],
|
97
|
+
Destroy: [[], :long],
|
98
|
+
LoadUI: [[:pointer, :buffer_in], :long],
|
99
|
+
GetView: [[:uint, :pointer, :pointer], :long],
|
100
|
+
GetUICommandProperty: [[:uint, :pointer, :pointer], :long],
|
101
|
+
SetUICommandProperty: [[:uint, :pointer, :pointer], :long],
|
102
|
+
InvalidateUICommand: [[:uint, :int, :pointer], :long],
|
103
|
+
FlushPendingInvalidations: [[], :long],
|
104
|
+
SetModes: [[:int], :long]
|
105
|
+
]
|
106
|
+
|
107
|
+
UICommandHandler = COM::Callback[IUICommandHandler]
|
108
|
+
UIApplication = COM::Callback[IUIApplication]
|
109
|
+
UIFramework = COM::Factory[IUIFramework, CLSID_UIRibbonFramework]
|
110
|
+
end
|
111
|
+
end
|