Dialog-box 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ed9922e87d9bc840759806e8e112abd2e17abafdae5b76ddbd10e4fd96087575
4
+ data.tar.gz: 3f23fa852b2c0bdf8eb8aca2caf214f0a03c5e6f973051132a245e3c071ff09a
5
+ SHA512:
6
+ metadata.gz: 5fe855be5712a4ec0057b9b8f7edc70b3977a832e2ce283d8b6a8f39e65710218aa6195d96f559e9b82aeb672a55ef83293fc309c1b5200a3e81214a7386806b
7
+ data.tar.gz: e03543adedbe048d803e2b9aae0bcc4378f06f93d3fd2cc40322a1fac16d763a16afee4bb5e56863601a46c89d61400dba46e473a7b65493187229dfa2cdaea8
@@ -0,0 +1,115 @@
1
+ require 'fiddle/import'
2
+
3
+ module DIALOG_BOX
4
+
5
+ extend Fiddle::Importer
6
+
7
+
8
+ DIALOG_BOX_FUNCTIONS_MAP = {}
9
+ def self.extern(signature, *opts)
10
+ symname, ctype, argtype = parse_signature(signature, @type_alias)
11
+ opt = parse_bind_options(opts)
12
+ f = import_function(symname, ctype, argtype, opt[:call_type])
13
+ name = symname.gsub(/@.+/,'')
14
+
15
+
16
+ DIALOG_BOX_FUNCTIONS_MAP[name] = f
17
+ begin
18
+ /^(.+?):(\d+)/ =~ caller.first
19
+ file, line = $1, $2.to_i
20
+ rescue
21
+ file, line = __FILE__, __LINE__+3
22
+ end
23
+ args_str="*args"
24
+ module_eval(<<-EOS, file, line)
25
+ def #{name}(*args, &block)
26
+ DIALOG_BOX_FUNCTIONS_MAP['#{name}'].call(*args,&block)
27
+ end
28
+ EOS
29
+ module_function(name)
30
+ f
31
+ end
32
+
33
+
34
+ @@dialog_box_import_done = false
35
+
36
+ # Load native dll libary
37
+ def self.load_lib(lib = nil, path = nil, output_error = false)
38
+ if lib == nil && path == nil
39
+
40
+ if RUBY_PLATFORM =~ /64/
41
+
42
+ # puts "You have a 64-bit Architecture ruby"
43
+ if RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
44
+ # puts "With Windows"
45
+ lib, path = 'dialog_box_x64.dll', "#{__dir__}/dlls"
46
+ elsif RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /cygwin/
47
+ # puts "With Linux"
48
+ lib, path = 'libstb_x64.so', "#{__dir__}/dlls"
49
+ elsif RUBY_PLATFORM =~ /darwin/
50
+ # puts "With macOS"
51
+ else
52
+ # puts "I have no idea what os are you using, so it's possible that stbimage wont't work"
53
+ end
54
+
55
+ elsif RUBY_PLATFORM =~ /arm/
56
+
57
+ # puts "You have a arm architecture"
58
+ lib, path = 'libstb_arm.so', "#{__dir__}/dlls"
59
+
60
+ elsif RUBY_PLATFORM =~ /java/
61
+
62
+ # puts "You have jruby!"
63
+
64
+ else
65
+
66
+ # puts "You have a 32-bit Architecture ruby"
67
+ if RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/
68
+ # puts "With Windows"
69
+ lib, path = 'dialog_box_x86.dll', "#{__dir__}/dlls"
70
+ elsif RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /cygwin/
71
+ # puts "With Linux"
72
+ lib, path = 'libstb_x86.so', "#{__dir__}/dlls"
73
+ elsif RUBY_PLATFORM =~ /darwin/
74
+ # puts "With macOS"
75
+ else
76
+ # puts "I have no idea what os are you using, so it's possible that stbimage wont't work"
77
+ end
78
+
79
+ end
80
+
81
+ end
82
+
83
+ if path
84
+ dlload (path + '/' + lib)
85
+ else
86
+ dlload ("#{__dir__}/#{lib}")
87
+
88
+ end
89
+ import_symbols(output_error) unless @@dialog_box_import_done
90
+ end
91
+
92
+ @@lib_signature = [
93
+
94
+ 'char* get_file_dialog()'
95
+
96
+ ]
97
+
98
+
99
+
100
+ def self.import_symbols(output_error = false)
101
+
102
+ # function
103
+ @@lib_signature.each do |sig|
104
+
105
+ extern sig
106
+
107
+ end
108
+
109
+ @@dialog_box_import_done = true
110
+
111
+ end
112
+
113
+ end
114
+
115
+ DIALOG_BOX.load_lib()
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Dialog-box
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Keresztes
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-01-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Opens a Windows FileOpenDialogBox and return the filepath. Only works
14
+ with Win32 and Win64 obviously. Check out the Homepage for usage instructions.
15
+ email: ''
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/dialog_box.rb
21
+ - lib/dlls/dialog_box_x64.dll
22
+ - lib/dlls/dialog_box_x86.dll
23
+ homepage: https://github.com/fellowchap-samuel/dialog-box
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.1.4
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Opens a Windows FileOpenDialogBox and return the filepath.
46
+ test_files: []