foxguib 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/changelog.txt +128 -0
- data/doc/www/index.html +173 -0
- data/doc/www/upload.rb +9 -0
- data/examples/event_handler.rb +67 -0
- data/examples/event_handlers.rbin +0 -0
- data/examples/guib_testdialog.rb +31 -0
- data/examples/testdialog.rb +29 -0
- data/exe/foxguib +1 -0
- data/foxGUIb-debug.rb +37 -0
- data/foxGUIb.rb +88 -0
- data/foxGUIb_win32.rbw +1 -0
- data/foxguib.gemspec +26 -0
- data/license.txt +49 -0
- data/readme.txt +1 -0
- data/release_notes.txt +68 -0
- data/src/assert.rb +8 -0
- data/src/cfgman.rb +27 -0
- data/src/code-gen/code-generator.rb +171 -0
- data/src/code-gen/property-generators.rb +65 -0
- data/src/code-gen/widget-generator.rb +22 -0
- data/src/convert.rb +60 -0
- data/src/direct_widget_manipulation.rb +343 -0
- data/src/docman.rb +260 -0
- data/src/document.rb +405 -0
- data/src/event_categories.yaml +85 -0
- data/src/event_listener.rb +57 -0
- data/src/events.yaml +77 -0
- data/src/events_docu.yaml +228 -0
- data/src/get_events.rb +64 -0
- data/src/gui/ArrowButton.tga +0 -0
- data/src/gui/BoxMinus.tga +0 -0
- data/src/gui/BoxPlus.tga +0 -0
- data/src/gui/Button.tga +0 -0
- data/src/gui/CheckButton.tga +0 -0
- data/src/gui/ComboBox.tga +0 -0
- data/src/gui/Dial.tga +0 -0
- data/src/gui/GroupBox.tga +0 -0
- data/src/gui/HorizontalFrame.tga +0 -0
- data/src/gui/HorizontalSeparator.tga +0 -0
- data/src/gui/Label.tga +0 -0
- data/src/gui/MDIChild.tga +0 -0
- data/src/gui/MDIClient.tga +0 -0
- data/src/gui/Matrix.tga +0 -0
- data/src/gui/MenuCaption.tga +0 -0
- data/src/gui/MenuCascade.tga +0 -0
- data/src/gui/MenuCheck.tga +0 -0
- data/src/gui/MenuCommand.tga +0 -0
- data/src/gui/MenuPane.tga +0 -0
- data/src/gui/MenuRadio.tga +0 -0
- data/src/gui/MenuSeparator.tga +0 -0
- data/src/gui/MenuTitle.tga +0 -0
- data/src/gui/Menubar.tga +0 -0
- data/src/gui/Packer.tga +0 -0
- data/src/gui/ProgressBar.tga +0 -0
- data/src/gui/RadioButton.tga +0 -0
- data/src/gui/RadioMutex.tga +0 -0
- data/src/gui/ScrollWindow.tga +0 -0
- data/src/gui/Scrollbar.tga +0 -0
- data/src/gui/Shutter.tga +0 -0
- data/src/gui/ShutterItem.tga +0 -0
- data/src/gui/Slider.tga +0 -0
- data/src/gui/Spinner.tga +0 -0
- data/src/gui/Splitter.tga +0 -0
- data/src/gui/StatusBar.tga +0 -0
- data/src/gui/Statusline.tga +0 -0
- data/src/gui/Switcher.tga +0 -0
- data/src/gui/TabBar.tga +0 -0
- data/src/gui/TabBook.tga +0 -0
- data/src/gui/TabItem.tga +0 -0
- data/src/gui/Text.tga +0 -0
- data/src/gui/TextField.tga +0 -0
- data/src/gui/ToggleButton.tga +0 -0
- data/src/gui/Toolbar.tga +0 -0
- data/src/gui/VerticalFrame.tga +0 -0
- data/src/gui/VerticalSeparator.tga +0 -0
- data/src/gui/_guib_event_editor.rb +185 -0
- data/src/gui/_guib_event_editor.rbin +0 -0
- data/src/gui/_guib_genruby.rb +414 -0
- data/src/gui/_guib_genruby.rbin +0 -0
- data/src/gui/_guib_mainwin.rb +574 -0
- data/src/gui/_guib_mainwin.rbin +0 -0
- data/src/gui/event_editor.rb +180 -0
- data/src/gui/genruby.rb +155 -0
- data/src/gui/guib__console.rb +265 -0
- data/src/gui/mainwin.rb +71 -0
- data/src/gui/ruby_console.rb +263 -0
- data/src/gui/svg/Matrix.svg +87 -0
- data/src/gui/svg/MenuCheck.svg +135 -0
- data/src/gui/svg/MenuRadio.svg +130 -0
- data/src/gui/svg/RadioMutex.svg +119 -0
- data/src/gui/textview.rb +101 -0
- data/src/gui/textview.rbin +0 -0
- data/src/minitest.rb +60 -0
- data/src/prop-lists.rb +323 -0
- data/src/prop-types.rb +606 -0
- data/src/properties.rb +119 -0
- data/src/propman.rb +88 -0
- data/src/relink_mechanisms.rb +95 -0
- data/src/serialize.rb +167 -0
- data/src/state_machine.rb +73 -0
- data/src/version.rb +6 -0
- data/src/widget-lists.rb +118 -0
- data/src/widget-selector.rb +85 -0
- data/src/widgettree-controls.rb +183 -0
- data.tar.gz.sig +0 -0
- metadata +236 -0
- metadata.gz.sig +0 -0
data/license.txt
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
The Artistic License
|
2
|
+
|
3
|
+
Preamble
|
4
|
+
|
5
|
+
The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications.
|
6
|
+
|
7
|
+
Definitions:
|
8
|
+
"Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification.
|
9
|
+
"Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder.
|
10
|
+
"Copyright Holder" is whoever is named in the copyright or copyrights for the package.
|
11
|
+
"You" is you, if you're thinking about copying or distributing this Package.
|
12
|
+
"Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.)
|
13
|
+
"Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it.
|
14
|
+
|
15
|
+
1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers.
|
16
|
+
|
17
|
+
2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version.
|
18
|
+
|
19
|
+
3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following:
|
20
|
+
|
21
|
+
a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package.
|
22
|
+
|
23
|
+
b) use the modified Package only within your corporation or organization.
|
24
|
+
|
25
|
+
c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version.
|
26
|
+
|
27
|
+
d) make other distribution arrangements with the Copyright Holder.
|
28
|
+
|
29
|
+
4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following:
|
30
|
+
|
31
|
+
a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version.
|
32
|
+
|
33
|
+
b) accompany the distribution with the machine-readable source of the Package with your modifications.
|
34
|
+
|
35
|
+
c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version.
|
36
|
+
|
37
|
+
d) make other distribution arrangements with the Copyright Holder.
|
38
|
+
|
39
|
+
5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own.
|
40
|
+
|
41
|
+
6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package.
|
42
|
+
|
43
|
+
7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package.
|
44
|
+
|
45
|
+
8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission.
|
46
|
+
|
47
|
+
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
48
|
+
|
49
|
+
The End
|
data/readme.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
please have a look at doc/www/index.html or http://fox-tool.rubyforge.org
|
data/release_notes.txt
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
============================
|
2
|
+
foxGUIb v1.0.0 Release Notes
|
3
|
+
============================
|
4
|
+
|
5
|
+
We have been quite stable for 2 years now and I am wondering why I did not jump to version 1.0.0 earlier.
|
6
|
+
For this release only a few minor bugs have been fixed.
|
7
|
+
-- henon
|
8
|
+
|
9
|
+
============================
|
10
|
+
foxGUIb v0.7.1 Release Notes
|
11
|
+
============================
|
12
|
+
|
13
|
+
sorry i have dropped a big bug while refactoring that broke
|
14
|
+
load/save and copy/paste. it was subtle enought to slip
|
15
|
+
through my testing and into the release unnoticed.
|
16
|
+
(see changelog)
|
17
|
+
|
18
|
+
hope this one is stable.
|
19
|
+
-- henon
|
20
|
+
|
21
|
+
==========================
|
22
|
+
foxGUIb v0.7 Release Notes
|
23
|
+
==========================
|
24
|
+
|
25
|
+
== What is foxGUIb? ==
|
26
|
+
foxGUIb is a GUI creator and code generator for FXRuby. It's a
|
27
|
+
convenient tool that makes it easy to quickly build complex and
|
28
|
+
good looking graphical user interfaces for Ruby.
|
29
|
+
|
30
|
+
== Whom is foxGUIb for? ==
|
31
|
+
* FXRuby newbies who want to experiment with the widgets and layouts.
|
32
|
+
* FXRuby experts who want to prototype parts of their GUI components rapidly.
|
33
|
+
... ok, lets say everyone who wants to create a GUI with FXRuby ;)
|
34
|
+
|
35
|
+
== What has changed? ==
|
36
|
+
* Fixed the bug that allowed to change properties of a
|
37
|
+
deleted widget (caused a crash)
|
38
|
+
* Fixed several bugs that led to crashes when typing
|
39
|
+
improper values into the property manipulators. e.g.:
|
40
|
+
backColor="bad input" instead of "200,255,255"
|
41
|
+
* on startup foxGUIb logs important version infos to the
|
42
|
+
log file. the log file is appended instead of replaced.
|
43
|
+
in case of a problem you can send me your logfile.
|
44
|
+
* some minor convenience fixes.
|
45
|
+
|
46
|
+
== Links: ==
|
47
|
+
Homepage:
|
48
|
+
http://fox-tool.rubyforge.org
|
49
|
+
Mike Parr's User Guide:
|
50
|
+
http://www.mikeparr.info/rubyguib/foxguibhome.htm
|
51
|
+
Download:
|
52
|
+
http://rubyforge.org/frs/?group_id=88
|
53
|
+
|
54
|
+
== Copyright and License ==
|
55
|
+
foxGUIb is free software. Copyright (c) by Meinrad Recheis aka Henon
|
56
|
+
foxGUIb: Artistic License
|
57
|
+
libGUIb: lgpl
|
58
|
+
|
59
|
+
enjoy ;)
|
60
|
+
-- henon
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
Boring Disclaimer:
|
65
|
+
|
66
|
+
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
67
|
+
INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
|
68
|
+
FITNESS FOR A PARTICULAR PURPOSE.
|
data/src/assert.rb
ADDED
data/src/cfgman.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright (c) 2004-2006 by Henon (meinrad dot recheis at gmail dot com)
|
2
|
+
|
3
|
+
require "pp"
|
4
|
+
|
5
|
+
$cfg = {}
|
6
|
+
|
7
|
+
def load_settings filename
|
8
|
+
begin
|
9
|
+
$cfg = eval File.new(filename, "r").read
|
10
|
+
rescue Exception
|
11
|
+
$cfg = {}
|
12
|
+
ensure
|
13
|
+
$cfg ||= {}
|
14
|
+
end
|
15
|
+
# go to last working directory
|
16
|
+
Dir.chdir $cfg[:wdir] if $cfg[:wdir] and File.exist? $cfg[:wdir]
|
17
|
+
end
|
18
|
+
|
19
|
+
def save_settings filename
|
20
|
+
# memorize working directory
|
21
|
+
$cfg[:wdir] = Dir.getwd
|
22
|
+
|
23
|
+
Dir.chdir(HOME)
|
24
|
+
$stdout = File.new filename, "w"
|
25
|
+
puts "# foxGUIb configuration - edit carefully!"
|
26
|
+
pp $cfg
|
27
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
# Copyright (c) 2004-2006 by Henon (meinrad dot recheis at gmail dot com)
|
2
|
+
|
3
|
+
def capitalize name
|
4
|
+
name[0] = name[0..0].capitalize[0]
|
5
|
+
name
|
6
|
+
end
|
7
|
+
|
8
|
+
module CodeGenerator
|
9
|
+
def generate_code opts, item = @fxtree.currentItem, classname = nil, unittest = true
|
10
|
+
@wr = ""
|
11
|
+
unmark
|
12
|
+
w "# source generated by #{FOXGUIB}"
|
13
|
+
w
|
14
|
+
if opts == "ruby.plain"
|
15
|
+
gen_widget_tree "ruby", item
|
16
|
+
elsif opts == "ruby.class"
|
17
|
+
gen_class "ruby", item, classname, unittest
|
18
|
+
# elsif opts=="ruby.derived_class"
|
19
|
+
# ~ gen_app "ruby"
|
20
|
+
end
|
21
|
+
@wr
|
22
|
+
end
|
23
|
+
|
24
|
+
def i(text = "")
|
25
|
+
@indent ||= 0
|
26
|
+
@ws ||= " "
|
27
|
+
# @wr=$stdout if @wr.nil?
|
28
|
+
@wr += ((@ws * @indent) + text).rstrip + $/
|
29
|
+
@indent += 1
|
30
|
+
end
|
31
|
+
|
32
|
+
def w(text = "")
|
33
|
+
@indent ||= 0
|
34
|
+
@ws ||= " "
|
35
|
+
# @wr=$stdout if @wr.nil?
|
36
|
+
@wr += ((@ws * @indent) + text).rstrip + $/
|
37
|
+
end
|
38
|
+
|
39
|
+
def o(text = "")
|
40
|
+
@indent ||= 0
|
41
|
+
@indent -= 1
|
42
|
+
@ws ||= " "
|
43
|
+
# @wr=$stdout if @wr.nil?
|
44
|
+
@wr += ((@ws * @indent) + text).rstrip + $/
|
45
|
+
end
|
46
|
+
|
47
|
+
def gen_app lang
|
48
|
+
if lang == "ruby"
|
49
|
+
# TODO
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def make_class_name treeitem
|
54
|
+
name = treeitem.to_s
|
55
|
+
capitalize(name)
|
56
|
+
end
|
57
|
+
|
58
|
+
def gen_class lang, treeitem, name = nil, unittest = true
|
59
|
+
name ||= make_class_name treeitem
|
60
|
+
if lang == "ruby"
|
61
|
+
i("class #{name}")
|
62
|
+
i("def initialize(parent)")
|
63
|
+
w "construct_widget_tree(parent)"
|
64
|
+
w "init if respond_to? :init"
|
65
|
+
o("end")
|
66
|
+
w ""
|
67
|
+
i("def construct_widget_tree(parent)")
|
68
|
+
i "@topwin = "
|
69
|
+
gen_widget_tree lang, treeitem
|
70
|
+
o "@topwin"
|
71
|
+
o "end"
|
72
|
+
w "attr_reader :topwin"
|
73
|
+
gen_accessors lang, treeitem
|
74
|
+
o "end"
|
75
|
+
w
|
76
|
+
# w "s='#{name}-extension.rb'"
|
77
|
+
# w "require s if File.exist?(s)"
|
78
|
+
gen_unittest lang, treeitem, name
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def gen_widget_tree lang, treeitem, parent_name = "parent"
|
83
|
+
wdg = @w[treeitem.to_s]
|
84
|
+
raise "widget #{treeitem} is nil! cannot generate code." unless wdg
|
85
|
+
if lang == "ruby"
|
86
|
+
i("#{wdg.class}.new(#{parent_name}) { |w_#{treeitem}|")
|
87
|
+
w "@#{treeitem} = w_#{treeitem}"
|
88
|
+
w "w_#{treeitem}.wdg_name = \"#{treeitem}\""
|
89
|
+
wdg.generate_properties { |p| w p.to(lang, treeitem) }
|
90
|
+
generate_behaviour wdg, lang, treeitem
|
91
|
+
treeitem.each { |child|
|
92
|
+
gen_widget_tree lang, child, "@#{treeitem}"
|
93
|
+
}
|
94
|
+
o "}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def generate_behaviour wdg, lang, treeitem
|
99
|
+
return unless wdg.behaviour
|
100
|
+
wdg.behaviour.each { |event, code|
|
101
|
+
next if code.strip.empty?
|
102
|
+
i("@#{treeitem}.connect(Fox::#{event}) { ")
|
103
|
+
code.split($/).each { |line|
|
104
|
+
w line
|
105
|
+
}
|
106
|
+
o(" }")
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
def gen_accessors lang, treeitem
|
111
|
+
if lang == "ruby"
|
112
|
+
w "attr_reader :#{treeitem}"
|
113
|
+
treeitem.each { |child|
|
114
|
+
gen_accessors lang, child
|
115
|
+
}
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def gen_unittest lang, treeitem, name
|
120
|
+
if lang == "ruby"
|
121
|
+
w "# unit test"
|
122
|
+
i("if __FILE__ == $0")
|
123
|
+
w "require \"#{FOXGUIB_LIBRARY}\""
|
124
|
+
w "app = FX::App.new"
|
125
|
+
if @w[treeitem.to_s] == @topwin
|
126
|
+
w "w = #{name}.new app"
|
127
|
+
w "w.topwin.show(Fox::PLACEMENT_SCREEN)"
|
128
|
+
else
|
129
|
+
w "mw = MainWindow.new app"
|
130
|
+
w "w = #{name}.new mw"
|
131
|
+
w "mw.show(Fox::PLACEMENT_SCREEN)"
|
132
|
+
end
|
133
|
+
w "app.create"
|
134
|
+
w "app.run"
|
135
|
+
o "end"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# ~ def gen_multiling_code lang, treeitem
|
140
|
+
# ~ name=treeitem.to_s
|
141
|
+
# ~ name[0]=name[0..0].capitalize[0]
|
142
|
+
# ~ if lang=="ruby"
|
143
|
+
# ~ i("module #{name}Texts" )
|
144
|
+
# ~ i("def #{treeitem.to_s.downcase}_texts")
|
145
|
+
# ~ gen_texts lang, treeitem
|
146
|
+
# ~ o"end"
|
147
|
+
# ~ o "end"
|
148
|
+
# ~ end
|
149
|
+
# ~ end
|
150
|
+
|
151
|
+
# ~ def gen_texts lang, treeitem
|
152
|
+
# ~ wdg=@w[treeitem.to_s]
|
153
|
+
# ~ wdg.defaults.keys.each{|m|
|
154
|
+
# ~ p=$propman.props[m]
|
155
|
+
# ~ next unless p.kind_of? StringProp
|
156
|
+
# ~ value=wdg.send m.chop
|
157
|
+
# ~ next unless value.to_s.size == 0
|
158
|
+
# ~ if lang=="ruby"
|
159
|
+
# ~ w "$L.register @#{treeitem.to_s}," if m=="text="
|
160
|
+
# ~ w "$L.register_method @#{treeitem.to_s}, '#{m}'," if m!="text="
|
161
|
+
# ~ i()
|
162
|
+
# ~ w "['de', '#{value.to_s}'],"
|
163
|
+
# ~ w "['en', ' ']"
|
164
|
+
# ~ o()
|
165
|
+
# ~ end
|
166
|
+
# ~ }
|
167
|
+
# ~ treeitem.each{|child|
|
168
|
+
# ~ gen_texts lang, child
|
169
|
+
# ~ }
|
170
|
+
# ~ end
|
171
|
+
end # module CodeGenerator
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Copyright (c) 2004-2006 by Henon (meinrad dot recheis at gmail dot com)
|
2
|
+
|
3
|
+
module StringPropCodeGen
|
4
|
+
def to lang, treeitem
|
5
|
+
if lang == "ruby"
|
6
|
+
"w_#{treeitem}.#{method_s}#{serialize @wdg.send(method.chop).inspect}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module IntPropCodeGen
|
12
|
+
def to lang, treeitem
|
13
|
+
if lang == "ruby"
|
14
|
+
"w_#{treeitem}.#{method_s}#{serialize @wdg.send(method.chop)}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module BoolPropCodeGen
|
20
|
+
def to lang, treeitem
|
21
|
+
if lang == "ruby"
|
22
|
+
"w_#{treeitem}.#{method_s}#{serialize @wdg.send(method.chop)}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
module ConstPropCodeGen
|
28
|
+
def to lang, treeitem
|
29
|
+
if lang == "ruby"
|
30
|
+
"w_#{treeitem}.#{method_s}#{serialize @wdg.send(method.chop)}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
module ColorPropCodeGen
|
36
|
+
def to lang, treeitem
|
37
|
+
if lang == "ruby"
|
38
|
+
"w_#{treeitem}.#{method_s}Fox::FXRGBA(#{serialize @wdg.send(method.chop)})"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module FontPropCodeGen
|
44
|
+
def to lang, treeitem
|
45
|
+
if lang == "ruby"
|
46
|
+
"w_#{treeitem}.#{method_s}FX::Font.new.from_s(\"#{serialize(@wdg.send(method.chop))}\").to_FXFont"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
module IconPropCodeGen
|
52
|
+
def to lang, treeitem
|
53
|
+
if lang == "ruby"
|
54
|
+
"w_#{treeitem}.#{method_s}\"#{serialize @wdg.send(method.chop)}\""
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
module RangePropCodeGen
|
60
|
+
def to lang, treeitem
|
61
|
+
if lang == "ruby"
|
62
|
+
"w_#{treeitem}.#{method_s}#{serialize @wdg.send(method.chop)}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright (c) 2004-2006 by Henon (meinrad dot recheis at gmail dot com)
|
2
|
+
|
3
|
+
# generator extension for widgets
|
4
|
+
# ~ module WidgetGenerator
|
5
|
+
|
6
|
+
# ~ end
|
7
|
+
|
8
|
+
class Fox::FXWindow
|
9
|
+
# ~ include WidgetGenerator
|
10
|
+
# iterates over the widgets properties and yields { |method, Property_manipulator, | ... }
|
11
|
+
def generate_properties
|
12
|
+
PropMan.instance.props.each { |m, manip|
|
13
|
+
if @defaults.keys.member? m
|
14
|
+
value = send(m.chop)
|
15
|
+
manip.wdg = self
|
16
|
+
unless value.to_s == @defaults[m].to_s
|
17
|
+
yield(manip) if block_given?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
data/src/convert.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Copyright (c) 2004-2006 by Henon (meinrad dot recheis at gmail dot com)
|
2
|
+
|
3
|
+
# ~ require 'FX'
|
4
|
+
require "pp"
|
5
|
+
|
6
|
+
def load_from_file filename
|
7
|
+
data = nil
|
8
|
+
f = nil
|
9
|
+
if filename.split(".").pop == "pp"
|
10
|
+
f = File.new(filename)
|
11
|
+
# ~ puts 'pp load'
|
12
|
+
begin
|
13
|
+
data = eval(f.read)
|
14
|
+
rescue Exception
|
15
|
+
error "pp load error: ", $!.to_s
|
16
|
+
end
|
17
|
+
else
|
18
|
+
f = File.new(filename, "rb")
|
19
|
+
# ~ puts 'binary load'
|
20
|
+
begin
|
21
|
+
data = Marshal.load(f.read)
|
22
|
+
rescue Exception
|
23
|
+
error "binary load error: ", $!.to_s
|
24
|
+
end
|
25
|
+
end
|
26
|
+
f.close
|
27
|
+
data
|
28
|
+
end
|
29
|
+
|
30
|
+
def save data, filename
|
31
|
+
if filename.split(".").pop == "pp"
|
32
|
+
begin
|
33
|
+
out = $stdout
|
34
|
+
$stdout = File.new(filename.tr("\\", "/"), "w")
|
35
|
+
pp data
|
36
|
+
$stdout.flush
|
37
|
+
rescue Exception
|
38
|
+
filename += ".rbin"
|
39
|
+
puts "rescue marshal to: " + filename
|
40
|
+
puts $!
|
41
|
+
puts $!.backtrace.join($/)
|
42
|
+
try_marshal = true
|
43
|
+
ensure
|
44
|
+
$stdout.close
|
45
|
+
$stdout = out
|
46
|
+
end
|
47
|
+
else
|
48
|
+
try_marshal = true
|
49
|
+
end
|
50
|
+
if try_marshal
|
51
|
+
f = File.new(filename.tr("\\", "/"), "wb")
|
52
|
+
Marshal.dump data, f
|
53
|
+
f.flush
|
54
|
+
f.close
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
puts "converting #{ARGV[0]} to #{ARGV[1]}"
|
59
|
+
data = load_from_file ARGV[0]
|
60
|
+
save data, ARGV[1]
|