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
@@ -0,0 +1,180 @@
|
|
1
|
+
# Copyright (c) 2004-2006 by Henon (meinrad dot recheis at gmail dot com)
|
2
|
+
|
3
|
+
if __FILE__ == $0
|
4
|
+
$: << "gui"
|
5
|
+
Dir.chdir ".."
|
6
|
+
STDOUT.sync = true
|
7
|
+
HOME = "."
|
8
|
+
require "libGUIb16"
|
9
|
+
end
|
10
|
+
require "_guib_event_editor"
|
11
|
+
require "serialize"
|
12
|
+
require "singleton"
|
13
|
+
require "textview"
|
14
|
+
|
15
|
+
SELECTED_EVENT_COLOR = Fox::FXRGB(255, 255, 255)
|
16
|
+
UNSELECTED_EVENT_COLOR = Fox::FXRGB(200, 200, 200)
|
17
|
+
|
18
|
+
class EventEditor < GuibEventEditor
|
19
|
+
include Singleton
|
20
|
+
include Serialize
|
21
|
+
def initialize
|
22
|
+
super(MAINWIN.topwin)
|
23
|
+
@widget = nil # the widget we are going to edit events for
|
24
|
+
@eventGroup = FX::RadioGroup.new
|
25
|
+
@eventsframe.layoutHints = Fox::LAYOUT_FIX_WIDTH | Fox::LAYOUT_FILL_Y
|
26
|
+
@eventsframe.width = 240
|
27
|
+
init_event_list
|
28
|
+
build_event_list
|
29
|
+
@eventGroup.on_event_selected { |radio|
|
30
|
+
@widget.set_behaviour(@selectedEvent, @Text.text) if @widget
|
31
|
+
@selectedEvent = radio.text
|
32
|
+
update
|
33
|
+
}
|
34
|
+
@CheckButton.connect(Fox::SEL_COMMAND) { update }
|
35
|
+
@CheckButton.state = false
|
36
|
+
@Text.connect(Fox::SEL_CHANGED) {
|
37
|
+
next unless @widget and @selectedEvent
|
38
|
+
@widget.set_behaviour(@selectedEvent, @Text.text)
|
39
|
+
}
|
40
|
+
@TextView = TextView.new(@topwin)
|
41
|
+
@TextView.topwin.hide
|
42
|
+
@TextView.topwin.resize(400, 200)
|
43
|
+
update
|
44
|
+
end
|
45
|
+
|
46
|
+
def init_event_list
|
47
|
+
@events = {}
|
48
|
+
loader = YamlLoader.new(HOME)
|
49
|
+
loader.on_fail { |filename, msg|
|
50
|
+
puts "Warning: Event editor couldnt load data! - Error loading <#{filename}>: \n\t#{msg}"
|
51
|
+
}
|
52
|
+
loader.load("src/events.yaml") { |events|
|
53
|
+
events.each { |name|
|
54
|
+
begin
|
55
|
+
@events[name] = Fox.const_get(name)
|
56
|
+
rescue Exception
|
57
|
+
puts "cannot instantiate constant #{name}"
|
58
|
+
end
|
59
|
+
}
|
60
|
+
}
|
61
|
+
loader.load("src/events_docu.yaml") { |docu| @docu = docu }
|
62
|
+
end
|
63
|
+
|
64
|
+
def build_event_list
|
65
|
+
@radioButtons = {}
|
66
|
+
@events.keys.sort.each { |name|
|
67
|
+
FX::HorizontalFrame.new(@eventList) { |h|
|
68
|
+
h.wdg_name = name
|
69
|
+
h.layoutHints = Fox::LAYOUT_FILL_X
|
70
|
+
h.backColor = UNSELECTED_EVENT_COLOR
|
71
|
+
FX::RadioButton.new(h) { |r|
|
72
|
+
r.text = name
|
73
|
+
@radioButtons[name] = r
|
74
|
+
r.backColor = UNSELECTED_EVENT_COLOR
|
75
|
+
@eventGroup << r
|
76
|
+
}
|
77
|
+
next unless @docu
|
78
|
+
FX::Button.new(h) { |b|
|
79
|
+
b.layoutHints = Fox::LAYOUT_RIGHT
|
80
|
+
b.backColor = UNSELECTED_EVENT_COLOR
|
81
|
+
b.text = " ? "
|
82
|
+
b.connect(Fox::SEL_COMMAND) {
|
83
|
+
next unless @widget
|
84
|
+
@TextView.heading.text = "#{@widget.class}: #{name}"
|
85
|
+
@TextView.Text.text = "#{@docu[@widget.class.to_s][name]}\n\nExtracted from www.fxruby.org - Copyright by Lyle Johnson"
|
86
|
+
@TextView.topwin.create if $app.created?
|
87
|
+
@TextView.topwin.show(Fox::PLACEMENT_SCREEN)
|
88
|
+
}
|
89
|
+
b.visible = (@widget and @docu[@widget.class.to_s] and @docu[@widget.class.to_s].has_key?(name))
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
def update
|
96
|
+
unless @widget
|
97
|
+
@Text.text = "No widget is selected!"
|
98
|
+
@Text.disable
|
99
|
+
return
|
100
|
+
end
|
101
|
+
@editframeLabel.text = "@#{@widget.wdg_name}.connect(#{@selectedEvent}){"
|
102
|
+
@evframeLabel.text = "#{@widget.class}:"
|
103
|
+
on = @CheckButton.state
|
104
|
+
@eventList.children.each { |h|
|
105
|
+
event = h.wdg_name
|
106
|
+
next unless h.is_a? FX::HorizontalFrame and event
|
107
|
+
documented = (@widget and @docu[@widget.class.to_s] and @docu[@widget.class.to_s].has_key?(event))
|
108
|
+
h.visible = (on or documented)
|
109
|
+
h.children[1].visible = documented
|
110
|
+
c = (@widget.get_behaviour(event).strip.empty? ? UNSELECTED_EVENT_COLOR : SELECTED_EVENT_COLOR)
|
111
|
+
h.backColor = c
|
112
|
+
h.children.each { |w| w.backColor = c }
|
113
|
+
}
|
114
|
+
@eventList.recalc
|
115
|
+
if @selectedEvent
|
116
|
+
@Text.text = @widget.get_behaviour(@selectedEvent).to_s
|
117
|
+
@Text.enable
|
118
|
+
else
|
119
|
+
@Text.text = "No event is selected!"
|
120
|
+
@Text.disable
|
121
|
+
@CheckButton.setFocus
|
122
|
+
end
|
123
|
+
# Disable setFocus for now as it aborts on X-Windows with
|
124
|
+
# "FXComposeContext: illegal window parameter"
|
125
|
+
# @Text.setFocus
|
126
|
+
end
|
127
|
+
|
128
|
+
def set_widget w
|
129
|
+
@widget = w
|
130
|
+
update
|
131
|
+
end
|
132
|
+
|
133
|
+
def show
|
134
|
+
w = @topwin
|
135
|
+
w.create
|
136
|
+
w.resize(800, 500)
|
137
|
+
w.show(Fox::PLACEMENT_VISIBLE)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
module Behaviour
|
142
|
+
def set_behaviour event, code
|
143
|
+
return unless event
|
144
|
+
return if code.strip.empty?
|
145
|
+
@behaviour ||= {}
|
146
|
+
@behaviour[event] = code
|
147
|
+
end
|
148
|
+
|
149
|
+
def get_behaviour event
|
150
|
+
return "" unless @behaviour
|
151
|
+
@behaviour[event].to_s
|
152
|
+
end
|
153
|
+
|
154
|
+
def behaviour
|
155
|
+
@behaviour
|
156
|
+
end
|
157
|
+
|
158
|
+
def behaviour= b
|
159
|
+
@behaviour = b
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
class Fox::FXWindow
|
164
|
+
include Behaviour
|
165
|
+
end
|
166
|
+
|
167
|
+
# unit test
|
168
|
+
if __FILE__ == $0
|
169
|
+
app = FX::App.new
|
170
|
+
MAINWIN = Class.new
|
171
|
+
def MAINWIN.topwin
|
172
|
+
@topwin
|
173
|
+
end
|
174
|
+
MAINWIN.instance_variable_set :@topwin, FX::MainWindow.new(app)
|
175
|
+
w = EventEditor.instance
|
176
|
+
w.topwin.show(0)
|
177
|
+
w.set_widget w.CheckButton
|
178
|
+
app.create
|
179
|
+
app.run
|
180
|
+
end
|
data/src/gui/genruby.rb
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
# Copyright (c) 2004-2006 by Henon (meinrad dot recheis at gmail dot com)
|
2
|
+
|
3
|
+
require "_guib_genruby"
|
4
|
+
class GenRubyDialog
|
5
|
+
def init
|
6
|
+
@topwin.hide
|
7
|
+
@rg_startpoint = FX::RadioGroup.new
|
8
|
+
@rg_startpoint.on_event_selected { |radio| update }
|
9
|
+
@rg_startpoint << @topmost
|
10
|
+
@rg_startpoint << @selected
|
11
|
+
@rg_source = FX::RadioGroup.new
|
12
|
+
@plain.wdg_name = "plain"
|
13
|
+
@to_class.wdg_name = "class"
|
14
|
+
@rg_source << @plain
|
15
|
+
@rg_source << @to_class
|
16
|
+
@rg_source.on_event_selected { |radio|
|
17
|
+
@format = radio.wdg_name
|
18
|
+
update
|
19
|
+
}
|
20
|
+
@to_console.connect(Fox::SEL_COMMAND) {
|
21
|
+
$console.text.text = ""
|
22
|
+
$console.out(generate)
|
23
|
+
$console.topwin.show(0)
|
24
|
+
}
|
25
|
+
@fs = FileSelector.new(@Packer)
|
26
|
+
@fs.patterns << "Ruby Script (*.rb)"
|
27
|
+
@fs.currentPattern = 1
|
28
|
+
@fs.description = ""
|
29
|
+
FlatStyle.new.apply_to(@fs.topwin)
|
30
|
+
@fs.topwin.padTop = 5
|
31
|
+
@fs.topwin.layoutHints = Fox::LAYOUT_FILL_X
|
32
|
+
@fs.topwin.padLeft = 8
|
33
|
+
@fs.topwin.padRight = 8
|
34
|
+
@fs.browse.text = "..."
|
35
|
+
@fs.textfield.connect(Fox::SEL_CHANGED) { update }
|
36
|
+
@fs.onNewFilenameBlock = proc { update }
|
37
|
+
@cancel.connect(Fox::SEL_COMMAND) {
|
38
|
+
hide
|
39
|
+
}
|
40
|
+
@OK.connect(Fox::SEL_COMMAND) {
|
41
|
+
begin
|
42
|
+
File.open(@fs.textfield.text, "wb") { |f|
|
43
|
+
f.puts generate
|
44
|
+
}
|
45
|
+
@topwin.hide
|
46
|
+
rescue Exception
|
47
|
+
puts $! # TODO write msg to the dialog!!
|
48
|
+
puts $!.backtrace
|
49
|
+
end
|
50
|
+
}
|
51
|
+
@locked.connect(Fox::SEL_COMMAND, method(:update_locked))
|
52
|
+
|
53
|
+
initialize_fields
|
54
|
+
@topwin.resize(350, 350)
|
55
|
+
end
|
56
|
+
|
57
|
+
def update_locked(*args)
|
58
|
+
for w in [@plain, @topmost, @selected, @to_class, @fs.textfield, @fs.browse, @className]
|
59
|
+
# ~ puts w.class
|
60
|
+
w.enabled = !@locked.checked?
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# saves the dialog state in a hash
|
65
|
+
def to_h
|
66
|
+
h = {}
|
67
|
+
h[:classname] = @fs.textfield.text
|
68
|
+
h[:filename] = @className.text
|
69
|
+
h[:to_class] = @to_class.state
|
70
|
+
h[:plain] = @plain.state
|
71
|
+
h[:topmost] = @topmost.state
|
72
|
+
h[:selected] = @selected.state
|
73
|
+
h[:locked] = @locked.state
|
74
|
+
h
|
75
|
+
end
|
76
|
+
|
77
|
+
def from_h h
|
78
|
+
return unless h
|
79
|
+
@fs.textfield.text = h[:classname] if h[:classname]
|
80
|
+
@className.text = h[:filename] if h[:filename]
|
81
|
+
@rg_source.select(@to_class) if h[:to_class]
|
82
|
+
@rg_source.select(@plain.state) if h[:plain]
|
83
|
+
@rg_startpoint.select(@topmost.state) if h[:topmost]
|
84
|
+
@rg_startpoint.select(@selected) if h[:selected]
|
85
|
+
@locked.state = h[:locked] if h[:locked]
|
86
|
+
end
|
87
|
+
|
88
|
+
def initialize_fields
|
89
|
+
@locked.check = false
|
90
|
+
@format = "class"
|
91
|
+
@plain.check = false
|
92
|
+
@to_class.check = true
|
93
|
+
@topmost.check = true
|
94
|
+
@selected.check = false
|
95
|
+
@className.text = ""
|
96
|
+
@fs.textfield.text = ""
|
97
|
+
end
|
98
|
+
|
99
|
+
def update
|
100
|
+
update_locked
|
101
|
+
@item = if @selected.state
|
102
|
+
DocMan.instance.current.fxtree.currentItem
|
103
|
+
else
|
104
|
+
DocMan.instance.current.topwin.userData.treeitem
|
105
|
+
end
|
106
|
+
name = DocMan.instance.current.make_class_name @item
|
107
|
+
@node.text = name
|
108
|
+
@className.text = capitalize(@item.to_s) unless @locked.state
|
109
|
+
# can only write if a filename is given:
|
110
|
+
@OK.enabled = (@fs.textfield.text.size > 0)
|
111
|
+
# save state to the document
|
112
|
+
DocMan.instance.current.gendlg_state = to_h
|
113
|
+
end
|
114
|
+
|
115
|
+
def show
|
116
|
+
initialize_fields
|
117
|
+
unless DocMan.instance.current
|
118
|
+
puts "no document found."
|
119
|
+
return
|
120
|
+
end
|
121
|
+
from_h DocMan.instance.current.gendlg_state
|
122
|
+
# @item=DocMan.instance.current.topwin.userData.treeitem
|
123
|
+
update
|
124
|
+
@topwin.show(PLACEMENT_SCREEN)
|
125
|
+
end
|
126
|
+
|
127
|
+
def hide
|
128
|
+
DocMan.instance.current.gendlg_state = to_h
|
129
|
+
@topwin.hide
|
130
|
+
end
|
131
|
+
|
132
|
+
def generate
|
133
|
+
# puts "generate"
|
134
|
+
DocMan.instance.current.gendlg_state = to_h
|
135
|
+
s = ""
|
136
|
+
begin
|
137
|
+
s = DocMan.instance.generate_code "ruby.#{@format}", @item, capitalize(@className.text), true
|
138
|
+
rescue Exception
|
139
|
+
s = $!.to_s + "\n\t" + $!.backtrace.join("\n\t")
|
140
|
+
end
|
141
|
+
# puts "generated source:",s
|
142
|
+
s
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
if __FILE__ == $0
|
147
|
+
Dir.chdir ".."
|
148
|
+
$: << "gui"
|
149
|
+
require "libGUIb14"
|
150
|
+
app = FX::App.new
|
151
|
+
w = GenRubyDialog.new app
|
152
|
+
w.topwin.show(0)
|
153
|
+
app.create
|
154
|
+
app.run
|
155
|
+
end
|
@@ -0,0 +1,265 @@
|
|
1
|
+
class BaseConsole
|
2
|
+
def initialize(parent)
|
3
|
+
construct_widget_tree(parent)
|
4
|
+
init if respond_to? :init
|
5
|
+
end
|
6
|
+
|
7
|
+
def construct_widget_tree(parent)
|
8
|
+
@topwin =
|
9
|
+
FX::DialogBox.new(parent) { |w|
|
10
|
+
@BaseConsole = w
|
11
|
+
w.padLeft = 0
|
12
|
+
w.width = 638
|
13
|
+
w.padRight = 0
|
14
|
+
w.shown = true
|
15
|
+
w.y = 336
|
16
|
+
w.height = 441
|
17
|
+
w.padBottom = 0
|
18
|
+
w.title = "Console Window"
|
19
|
+
w.padTop = 0
|
20
|
+
w.x = 270
|
21
|
+
FX::Splitter.new(@BaseConsole) { |w|
|
22
|
+
@Splitter = w
|
23
|
+
w.backColor = Fox::FXRGBA(198, 198, 198, 255)
|
24
|
+
w.width = 638
|
25
|
+
w.height = 441
|
26
|
+
w.splitterStyle = 131072
|
27
|
+
FX::VerticalFrame.new(@Splitter) { |w|
|
28
|
+
@RightFrame = w
|
29
|
+
w.backColor = Fox::FXRGBA(138, 138, 138, 255)
|
30
|
+
w.padLeft = 0
|
31
|
+
w.frameStyle = 12288
|
32
|
+
w.width = 468
|
33
|
+
w.padRight = 0
|
34
|
+
w.height = 441
|
35
|
+
w.vSpacing = 1
|
36
|
+
w.x = 0
|
37
|
+
FX::HorizontalFrame.new(@RightFrame) { |w|
|
38
|
+
@HorizontalFrame5 = w
|
39
|
+
w.baseColor = Fox::FXRGBA(238, 238, 238, 255)
|
40
|
+
w.backColor = Fox::FXRGBA(238, 238, 238, 255)
|
41
|
+
w.padLeft = 0
|
42
|
+
w.frameStyle = 0
|
43
|
+
w.width = 466
|
44
|
+
w.padRight = 0
|
45
|
+
w.y = 1
|
46
|
+
w.height = 19
|
47
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
48
|
+
w.layoutHints = 1024
|
49
|
+
w.x = 1
|
50
|
+
FX::Label.new(@HorizontalFrame5) { |w|
|
51
|
+
@Label5 = w
|
52
|
+
w.text = "LANGID_ADDRESS|:"
|
53
|
+
w.backColor = Fox::FXRGBA(238, 238, 238, 255)
|
54
|
+
w.width = 101
|
55
|
+
w.x = 0
|
56
|
+
}
|
57
|
+
FX::ComboBox.new(@HorizontalFrame5) { |w|
|
58
|
+
@AddressComboBox = w
|
59
|
+
w.baseColor = Fox::FXRGBA(236, 233, 216, 255)
|
60
|
+
w.width = 365
|
61
|
+
w.selBackColor = Fox::FXRGBA(49, 106, 197, 255)
|
62
|
+
w.y = 0
|
63
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
64
|
+
w.comboStyle = 524288
|
65
|
+
w.layoutHints = 1024
|
66
|
+
w.x = 101
|
67
|
+
}
|
68
|
+
}
|
69
|
+
FX::Text.new(@RightFrame) { |w|
|
70
|
+
@text = w
|
71
|
+
w.textTextStyle = 3145728
|
72
|
+
w.font = Font.new.from_s("Arial|90|400|1|0|0|0").to_FXFont
|
73
|
+
w.width = 466
|
74
|
+
w.y = 21
|
75
|
+
w.height = 401
|
76
|
+
w.textColor = Fox::FXRGBA(138, 138, 138, 255)
|
77
|
+
w.x = 1
|
78
|
+
}
|
79
|
+
FX::HorizontalFrame.new(@RightFrame) { |w|
|
80
|
+
@HorizontalFrame = w
|
81
|
+
w.padLeft = 0
|
82
|
+
w.frameStyle = 0
|
83
|
+
w.width = 466
|
84
|
+
w.padRight = 0
|
85
|
+
w.y = 423
|
86
|
+
w.height = 17
|
87
|
+
w.layoutHints = 1024
|
88
|
+
w.x = 1
|
89
|
+
FX::Label.new(@HorizontalFrame) { |w|
|
90
|
+
@Label4 = w
|
91
|
+
w.text = "LANGID_CMDLN| >"
|
92
|
+
w.backColor = Fox::FXRGBA(245, 245, 220, 255)
|
93
|
+
w.width = 96
|
94
|
+
w.x = 0
|
95
|
+
}
|
96
|
+
FX::TextField.new(@HorizontalFrame) { |w|
|
97
|
+
@cmdln = w
|
98
|
+
w.backColor = Fox::FXRGBA(245, 245, 220, 255)
|
99
|
+
w.frameStyle = 0
|
100
|
+
w.width = 370
|
101
|
+
w.y = 0
|
102
|
+
w.height = 17
|
103
|
+
w.layoutHints = 1024
|
104
|
+
w.x = 96
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
FX::VerticalFrame.new(@Splitter) { |w|
|
109
|
+
@LeftFrame = w
|
110
|
+
w.baseColor = Fox::FXRGBA(238, 238, 238, 255)
|
111
|
+
w.backColor = Fox::FXRGBA(238, 238, 238, 255)
|
112
|
+
w.padLeft = 0
|
113
|
+
w.frameStyle = 12288
|
114
|
+
w.width = 166
|
115
|
+
w.padRight = 0
|
116
|
+
w.height = 441
|
117
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
118
|
+
w.x = 472
|
119
|
+
FX::MenuButton.new(@LeftFrame) { |w|
|
120
|
+
@MenuButton = w
|
121
|
+
w.baseColor = Fox::FXRGBA(236, 233, 216, 255)
|
122
|
+
w.text = "LANGID_CONSOLE_MENU"
|
123
|
+
w.backColor = Fox::FXRGBA(238, 238, 238, 255)
|
124
|
+
w.width = 143
|
125
|
+
w.y = 1
|
126
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
127
|
+
w.menuButtonStyle = 33554432
|
128
|
+
w.x = 1
|
129
|
+
FX::MenuPane.new(@MenuButton) { |w|
|
130
|
+
@MenuPane = w
|
131
|
+
w.baseColor = Fox::FXRGBA(236, 233, 216, 255)
|
132
|
+
w.backColor = Fox::FXRGBA(236, 233, 216, 255)
|
133
|
+
w.y = 430
|
134
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
135
|
+
w.x = 735
|
136
|
+
}
|
137
|
+
}
|
138
|
+
FX::TabBook.new(@LeftFrame) { |w|
|
139
|
+
@TabBook = w
|
140
|
+
w.baseColor = Fox::FXRGBA(238, 238, 238, 255)
|
141
|
+
w.backColor = Fox::FXRGBA(238, 238, 238, 255)
|
142
|
+
w.padLeft = 0
|
143
|
+
w.current = 0
|
144
|
+
w.width = 164
|
145
|
+
w.padRight = 0
|
146
|
+
w.tabStyle = 131072
|
147
|
+
w.y = 18
|
148
|
+
w.height = 422
|
149
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
150
|
+
w.padBottom = 0
|
151
|
+
w.padTop = 0
|
152
|
+
w.x = 1
|
153
|
+
FX::TabItem.new(@TabBook) { |w|
|
154
|
+
@HistoryTabItem = w
|
155
|
+
w.baseColor = Fox::FXRGBA(236, 233, 216, 255)
|
156
|
+
w.text = "LANGID_HISTORY"
|
157
|
+
w.backColor = Fox::FXRGBA(238, 238, 238, 255)
|
158
|
+
w.width = 98
|
159
|
+
w.y = 399
|
160
|
+
w.height = 23
|
161
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
162
|
+
w.tabOrientation = 25165824
|
163
|
+
}
|
164
|
+
FX::VerticalFrame.new(@TabBook) { |w|
|
165
|
+
@HistoryFrame = w
|
166
|
+
w.baseColor = Fox::FXRGBA(236, 233, 216, 255)
|
167
|
+
w.backColor = Fox::FXRGBA(236, 233, 216, 255)
|
168
|
+
w.padLeft = 0
|
169
|
+
w.frameStyle = 12288
|
170
|
+
w.width = 164
|
171
|
+
w.padRight = 0
|
172
|
+
w.borderColor = Fox::FXRGBA(135, 135, 135, 255)
|
173
|
+
w.y = 0
|
174
|
+
w.height = 401
|
175
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
176
|
+
w.x = 0
|
177
|
+
FX::Text.new(@HistoryFrame) { |w|
|
178
|
+
@HistoryText = w
|
179
|
+
w.textTextStyle = 69206016
|
180
|
+
w.font = Font.new.from_s("Arial|90|400|1|0|0|0").to_FXFont
|
181
|
+
w.width = 162
|
182
|
+
w.y = 1
|
183
|
+
w.height = 399
|
184
|
+
w.textColor = Fox::FXRGBA(138, 138, 138, 255)
|
185
|
+
w.barColor = Fox::FXRGBA(190, 190, 190, 255)
|
186
|
+
w.x = 1
|
187
|
+
}
|
188
|
+
}
|
189
|
+
FX::TabItem.new(@TabBook) { |w|
|
190
|
+
@CmdsTabItem = w
|
191
|
+
w.baseColor = Fox::FXRGBA(236, 233, 216, 255)
|
192
|
+
w.text = "LANGID_COMMANDS"
|
193
|
+
w.backColor = Fox::FXRGBA(238, 238, 238, 255)
|
194
|
+
w.width = 109
|
195
|
+
w.y = 399
|
196
|
+
w.height = 21
|
197
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
198
|
+
w.tabOrientation = 25165824
|
199
|
+
w.x = 97
|
200
|
+
}
|
201
|
+
FX::VerticalFrame.new(@TabBook) { |w|
|
202
|
+
@CmdsFrame = w
|
203
|
+
w.baseColor = Fox::FXRGBA(236, 233, 216, 255)
|
204
|
+
w.backColor = Fox::FXRGBA(236, 233, 216, 255)
|
205
|
+
w.padLeft = 0
|
206
|
+
w.frameStyle = 12288
|
207
|
+
w.width = 164
|
208
|
+
w.padRight = 0
|
209
|
+
w.borderColor = Fox::FXRGBA(143, 143, 143, 255)
|
210
|
+
w.y = 0
|
211
|
+
w.height = 401
|
212
|
+
w.shadowColor = Fox::FXRGBA(172, 168, 153, 255)
|
213
|
+
w.x = 0
|
214
|
+
FX::Text.new(@CmdsFrame) { |w|
|
215
|
+
@CmdsText = w
|
216
|
+
w.backColor = Fox::FXRGBA(238, 238, 238, 255)
|
217
|
+
w.textTextStyle = 70254592
|
218
|
+
w.font = Font.new.from_s("Arial|90|400|1|0|0|0").to_FXFont
|
219
|
+
w.width = 162
|
220
|
+
w.y = 1
|
221
|
+
w.height = 399
|
222
|
+
w.barColor = Fox::FXRGBA(236, 233, 216, 255)
|
223
|
+
w.x = 1
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
end
|
231
|
+
attr_accessor :topwin,
|
232
|
+
:BaseConsole,
|
233
|
+
:Splitter,
|
234
|
+
:RightFrame,
|
235
|
+
:HorizontalFrame5,
|
236
|
+
:Label5,
|
237
|
+
:AddressComboBox,
|
238
|
+
:text,
|
239
|
+
:HorizontalFrame,
|
240
|
+
:Label4,
|
241
|
+
:cmdln,
|
242
|
+
:LeftFrame,
|
243
|
+
:MenuButton,
|
244
|
+
:MenuPane,
|
245
|
+
:TabBook,
|
246
|
+
:HistoryTabItem,
|
247
|
+
:HistoryFrame,
|
248
|
+
:HistoryText,
|
249
|
+
:CmdsTabItem,
|
250
|
+
:CmdsFrame,
|
251
|
+
:CmdsText,
|
252
|
+
:__foxGUIb__last__
|
253
|
+
end
|
254
|
+
|
255
|
+
s = "BaseConsole-extension.rb"
|
256
|
+
require s if File.exist?(s)
|
257
|
+
# unit test
|
258
|
+
if __FILE__ == $0
|
259
|
+
require "libGUIb14"
|
260
|
+
app = FX::App.new
|
261
|
+
w = BaseConsole.new app
|
262
|
+
w.topwin.show(0)
|
263
|
+
app.create
|
264
|
+
app.run
|
265
|
+
end
|
data/src/gui/mainwin.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Copyright (c) 2004-2006 by Henon (meinrad dot recheis at gmail dot com)
|
2
|
+
|
3
|
+
# initialisation of the foxGUIb main window
|
4
|
+
require "_guib_mainwin"
|
5
|
+
require "event_editor"
|
6
|
+
require "textview"
|
7
|
+
|
8
|
+
class MainWin
|
9
|
+
def init
|
10
|
+
@topwin.title = "#{FOXGUIB} - Interactive FOX GUI Builder and Code Generator"
|
11
|
+
@open_project.connect(SEL_COMMAND) { DocMan.instance.set_wdir }
|
12
|
+
@new_mainwin.connect(SEL_COMMAND) { DocMan.instance.create "mainwin" }
|
13
|
+
@new_dialog.connect(SEL_COMMAND) { DocMan.instance.create "dlg" }
|
14
|
+
@open_dialog.connect(SEL_COMMAND) { DocMan.instance.load }
|
15
|
+
@close_dialog.connect(SEL_COMMAND) { DocMan.instance.close }
|
16
|
+
@save_dialog.connect(SEL_COMMAND) { DocMan.instance.save }
|
17
|
+
@save_dialog_as.connect(SEL_COMMAND) { DocMan.instance.save_as }
|
18
|
+
@genruby.connect(SEL_COMMAND) {
|
19
|
+
DocMan.instance.genruby
|
20
|
+
}
|
21
|
+
@viewEventEditor.connect(SEL_COMMAND) {
|
22
|
+
EventEditor.instance.show
|
23
|
+
}
|
24
|
+
@viewRubyConsole.connect(SEL_COMMAND) {
|
25
|
+
$console.topwin.show(PLACEMENT_SCREEN)
|
26
|
+
}
|
27
|
+
@viewDialog.connect(SEL_COMMAND) {
|
28
|
+
DocMan.instance.current.topwin.show(PLACEMENT_SCREEN)
|
29
|
+
}
|
30
|
+
# ~ @hideDialog.connect(SEL_COMMAND) {
|
31
|
+
# ~ DocMan.instance.current.topwin.hide
|
32
|
+
# ~ }
|
33
|
+
@about.connect(SEL_COMMAND) { about }
|
34
|
+
@quit.connect(SEL_COMMAND) { exit }
|
35
|
+
@topwin.connect(SEL_CLOSE) { exit }
|
36
|
+
end
|
37
|
+
|
38
|
+
def exit
|
39
|
+
DocMan.instance.ask_save
|
40
|
+
DocMan.instance.save_all
|
41
|
+
$fxapp.exit
|
42
|
+
end
|
43
|
+
|
44
|
+
def about
|
45
|
+
# ~ puts "about"
|
46
|
+
# $console.topwin.show(0)
|
47
|
+
tv = TextView.new(@topwin)
|
48
|
+
tv.topwin.resize(600, 400)
|
49
|
+
tv.heading.text = "About foxGUIb:"
|
50
|
+
msg = [
|
51
|
+
"Created by Henon, Copyright (c) 2004-2006, (mail: meinrad.recheis#gmail.com)",
|
52
|
+
"License: \"Artistic License\". The source of foxGUIb including the libGUIb library may be changed and redistributed if the license and copyrights are kept.",
|
53
|
+
"Any generated sources are free to use (commercial or noncommercial) but the author of foxGUIb does not take any responsibilities.",
|
54
|
+
"",
|
55
|
+
"Homepage: http://fox-tool.rubyforge.org",
|
56
|
+
"Users Guide: http://www.mikeparr.info/rubyguib/foxguibhome.htm",
|
57
|
+
"Rubyforge: http://rubyforge.org/projects/fox-tool/",
|
58
|
+
"",
|
59
|
+
"foxGUIb version: #{FOXGUIB_VERSION}",
|
60
|
+
"\tFXRuby version: #{Fox.fxrubyversion}",
|
61
|
+
"\tFOX version: #{Fox.fxversion}\n\n"
|
62
|
+
]
|
63
|
+
# $console.styled_out($console.s_cmd, msg.join("\n\t"))
|
64
|
+
tv.Text.appendText msg.join("\n")
|
65
|
+
Loader.new(HOME).load("license.rd") { |text|
|
66
|
+
tv.Text.appendText(text)
|
67
|
+
}
|
68
|
+
tv.topwin.show
|
69
|
+
tv.topwin.create
|
70
|
+
end
|
71
|
+
end
|