fxruby 1.2.3 → 1.2.4
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/ANNOUNCE +5 -5
- data/ChangeLog +166 -0
- data/README +2 -2
- data/doc/apes02.html +2 -2
- data/doc/apes03.html +1 -1
- data/doc/book.html +1 -1
- data/doc/changes.html +45 -4
- data/doc/cvs.html +2 -2
- data/doc/differences.html +3 -3
- data/doc/implementation.html +1 -1
- data/doc/library.html +5 -5
- data/doc/opengl.html +5 -5
- data/doc/pt02.html +1 -1
- data/doc/scintilla.html +4 -4
- data/examples/image.rb +37 -40
- data/examples/mditest2.rb +195 -0
- data/ext/fox12/FXRuby.cpp +62 -26
- data/ext/fox12/core_wrap.cpp +19 -27
- data/ext/fox12/image_wrap.cpp +53 -11
- data/ext/fox12/include/FXRbApp.h +20 -3
- data/ext/fox12/include/FXRbScrollArea.h +4 -1
- data/ext/fox12/include/FXRbScrollWindow.h +4 -1
- data/ext/fox12/include/FXRbTable.h +6 -1
- data/lib/fox12/aliases.rb +2 -0
- data/lib/fox12/core.rb +27 -0
- data/lib/fox12/splashscreen.rb +1 -1
- data/lib/fox12/version.rb +1 -1
- data/rdoc-sources/FXAccelTable.rb +8 -8
- data/rdoc-sources/FXImage.rb +10 -4
- data/rdoc-sources/FXMemoryBuffer.rb +8 -4
- data/rdoc-sources/FXMemoryStream.rb +24 -21
- data/rdoc-sources/fxdefs.rb +6 -6
- data/tests/TC_FXImage.rb +21 -10
- data/tests/TC_FXMemoryStream.rb +44 -34
- data/tests/testcase.rb +2 -3
- metadata +3 -3
- data/INSTALL +0 -50
data/examples/image.rb
CHANGED
|
@@ -83,57 +83,54 @@ class ImageWindow < FXMainWindow
|
|
|
83
83
|
getApp(), FXApp::ID_QUIT, (FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|
|
|
84
84
|
LAYOUT_TOP|LAYOUT_LEFT), 0, 0, 0, 0, 10, 10, 5, 5)
|
|
85
85
|
|
|
86
|
-
# Allocate the
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@red_ramp = "\0" * sizeInBytes
|
|
90
|
-
@green_ramp = "\0" * sizeInBytes
|
|
91
|
-
@blue_ramp = "\0" * sizeInBytes
|
|
86
|
+
# Allocate the color arrays
|
|
87
|
+
imgWidth = 512
|
|
88
|
+
imgHeight = 50
|
|
92
89
|
|
|
93
90
|
# Create images with dithering
|
|
94
|
-
@grey = FXImage.new(getApp(),
|
|
95
|
-
IMAGE_DITHER|IMAGE_SHMI|IMAGE_SHMP,
|
|
96
|
-
@red = FXImage.new(getApp(),
|
|
97
|
-
IMAGE_DITHER|IMAGE_SHMI|IMAGE_SHMP,
|
|
98
|
-
@green = FXImage.new(getApp(),
|
|
99
|
-
IMAGE_DITHER|IMAGE_SHMI|IMAGE_SHMP,
|
|
100
|
-
@blue = FXImage.new(getApp(),
|
|
101
|
-
IMAGE_DITHER|IMAGE_SHMI|IMAGE_SHMP,
|
|
91
|
+
@grey = FXImage.new(getApp(), nil,
|
|
92
|
+
IMAGE_OWNED|IMAGE_DITHER|IMAGE_SHMI|IMAGE_SHMP, imgWidth, imgHeight)
|
|
93
|
+
@red = FXImage.new(getApp(), nil,
|
|
94
|
+
IMAGE_OWNED|IMAGE_DITHER|IMAGE_SHMI|IMAGE_SHMP, imgWidth, imgHeight)
|
|
95
|
+
@green = FXImage.new(getApp(), nil,
|
|
96
|
+
IMAGE_OWNED|IMAGE_DITHER|IMAGE_SHMI|IMAGE_SHMP, imgWidth, imgHeight)
|
|
97
|
+
@blue = FXImage.new(getApp(), nil,
|
|
98
|
+
IMAGE_OWNED|IMAGE_DITHER|IMAGE_SHMI|IMAGE_SHMP, imgWidth, imgHeight)
|
|
102
99
|
|
|
103
100
|
# Create image with nearest color instead of dithering
|
|
104
|
-
@grey_nodither = FXImage.new(getApp(),
|
|
105
|
-
IMAGE_NEAREST|IMAGE_SHMI|IMAGE_SHMP,
|
|
106
|
-
@red_nodither = FXImage.new(getApp(),
|
|
107
|
-
IMAGE_NEAREST|IMAGE_SHMI|IMAGE_SHMP,
|
|
108
|
-
@green_nodither = FXImage.new(getApp(),
|
|
109
|
-
IMAGE_NEAREST|IMAGE_SHMI|IMAGE_SHMP,
|
|
110
|
-
@blue_nodither = FXImage.new(getApp(),
|
|
111
|
-
IMAGE_NEAREST|IMAGE_SHMI|IMAGE_SHMP,
|
|
101
|
+
@grey_nodither = FXImage.new(getApp(), nil,
|
|
102
|
+
IMAGE_OWNED|IMAGE_NEAREST|IMAGE_SHMI|IMAGE_SHMP, imgWidth, imgHeight)
|
|
103
|
+
@red_nodither = FXImage.new(getApp(), nil,
|
|
104
|
+
IMAGE_OWNED|IMAGE_NEAREST|IMAGE_SHMI|IMAGE_SHMP, imgWidth, imgHeight)
|
|
105
|
+
@green_nodither = FXImage.new(getApp(), nil,
|
|
106
|
+
IMAGE_OWNED|IMAGE_NEAREST|IMAGE_SHMI|IMAGE_SHMP, imgWidth, imgHeight)
|
|
107
|
+
@blue_nodither = FXImage.new(getApp(), nil,
|
|
108
|
+
IMAGE_OWNED|IMAGE_NEAREST|IMAGE_SHMI|IMAGE_SHMP, imgWidth, imgHeight)
|
|
112
109
|
|
|
113
110
|
# Result image
|
|
114
111
|
@picture = FXBMPImage.new(getApp(), nil, IMAGE_SHMI|IMAGE_SHMP, 850, 600)
|
|
115
112
|
|
|
116
113
|
# Fill up the color-ramp byte arrays (strings)
|
|
114
|
+
grey_data = @grey.data
|
|
115
|
+
grey_nodither_data = @grey_nodither.data
|
|
116
|
+
red_data = @red.data
|
|
117
|
+
red_nodither_data = @red_nodither.data
|
|
118
|
+
green_data = @green.data
|
|
119
|
+
green_nodither_data = @green_nodither.data
|
|
120
|
+
blue_data = @blue.data
|
|
121
|
+
blue_nodither_data = @blue_nodither.data
|
|
117
122
|
(0...512).each { |x|
|
|
123
|
+
halfX = x >> 1
|
|
118
124
|
(0...50).each { |y|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
(0...50).each { |y|
|
|
129
|
-
@green.data[3*(y*512+x) ] = 0
|
|
130
|
-
@green.data[3*(y*512+x)+1] = (x/2)
|
|
131
|
-
@green.data[3*(y*512+x)+2] = 0
|
|
132
|
-
}
|
|
133
|
-
(0...50).each { |y|
|
|
134
|
-
@blue.data[3*(y*512+x) ] = 0
|
|
135
|
-
@blue.data[3*(y*512+x)+1] = 0
|
|
136
|
-
@blue.data[3*(y*512+x)+2] = (x/2)
|
|
125
|
+
z = (y << 9) + x
|
|
126
|
+
grey_data[z] = FXRGB(halfX, halfX, halfX)
|
|
127
|
+
grey_nodither_data[z] = grey_data[z]
|
|
128
|
+
red_data[z] = FXRGB(halfX, 0, 0)
|
|
129
|
+
red_nodither_data[z] = red_data[z]
|
|
130
|
+
green_data[z] = FXRGB(0, halfX, 0)
|
|
131
|
+
green_nodither_data[z] = green_data[z]
|
|
132
|
+
blue_data[z] = FXRGB(0, 0, halfX)
|
|
133
|
+
blue_nodither_data[z] = blue_data[z]
|
|
137
134
|
}
|
|
138
135
|
}
|
|
139
136
|
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'fox12'
|
|
4
|
+
require 'fox12/colors'
|
|
5
|
+
|
|
6
|
+
include Fox
|
|
7
|
+
|
|
8
|
+
TYGER = <<END_OF_POEM
|
|
9
|
+
The Tyger
|
|
10
|
+
|
|
11
|
+
Tyger! Tyger! burning bright
|
|
12
|
+
In the forests of the night
|
|
13
|
+
What immortal hand or eye
|
|
14
|
+
Could frame thy fearful symmetry?
|
|
15
|
+
|
|
16
|
+
In what distant deeps or skies
|
|
17
|
+
Burnt the fire of thine eyes?
|
|
18
|
+
On what wings dare he aspire?
|
|
19
|
+
What the hand dare seize the fire?
|
|
20
|
+
|
|
21
|
+
And what shoulder, and what art,
|
|
22
|
+
Could twist the sinews of thy heart,
|
|
23
|
+
And when thy heart began to beat,
|
|
24
|
+
What dread hand? and what dread feet?
|
|
25
|
+
|
|
26
|
+
What the hammer? what the chain?
|
|
27
|
+
In what furnace was thy brain?
|
|
28
|
+
What the anvil? what dread grasp
|
|
29
|
+
Dare its deadly terrors clasp?
|
|
30
|
+
|
|
31
|
+
When the stars threw down their spears,
|
|
32
|
+
And water'd heaven with their tears,
|
|
33
|
+
Did he smile his work to see?
|
|
34
|
+
Did he who made the Lamb make thee?
|
|
35
|
+
|
|
36
|
+
Tyger! Tyger! burning bright
|
|
37
|
+
In the forests of the night,
|
|
38
|
+
What immortal hand or eye,
|
|
39
|
+
Dare frame thy fearful symmetry?
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
- William Blake
|
|
44
|
+
END_OF_POEM
|
|
45
|
+
|
|
46
|
+
class MDITestWindow < FXMainWindow
|
|
47
|
+
|
|
48
|
+
def initialize(app)
|
|
49
|
+
# Invoke base class initialize method first
|
|
50
|
+
super(app, "MDI Widget Test", nil, nil, DECOR_ALL, 0, 0, 800, 600)
|
|
51
|
+
|
|
52
|
+
# Create the font
|
|
53
|
+
@font = FXFont.new(getApp(), "courier", 15, FONTWEIGHT_BOLD)
|
|
54
|
+
|
|
55
|
+
# Menubar
|
|
56
|
+
menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
|
|
57
|
+
|
|
58
|
+
# Status bar
|
|
59
|
+
FXStatusBar.new(self,
|
|
60
|
+
LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER)
|
|
61
|
+
|
|
62
|
+
# MDI Client
|
|
63
|
+
@mdiclient = FXMDIClient.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
|
64
|
+
|
|
65
|
+
# Icon for MDI Child
|
|
66
|
+
@mdiicon = nil
|
|
67
|
+
File.open(File.join("icons", "penguin.png"), "rb") { |f|
|
|
68
|
+
@mdiicon = FXPNGIcon.new(getApp(), f.read)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# Make MDI Menu
|
|
72
|
+
@mdimenu = FXMDIMenu.new(self, @mdiclient)
|
|
73
|
+
|
|
74
|
+
# MDI buttons in menu:- note the message ID's!!!!!
|
|
75
|
+
# Normally, MDI commands are simply sensitized or desensitized;
|
|
76
|
+
# Under the menubar, however, they're hidden if the MDI Client is
|
|
77
|
+
# not maximized. To do this, they must have different ID's.
|
|
78
|
+
FXMDIWindowButton.new(menubar, @mdimenu, @mdiclient, FXMDIClient::ID_MDI_MENUWINDOW,
|
|
79
|
+
LAYOUT_LEFT)
|
|
80
|
+
FXMDIDeleteButton.new(menubar, @mdiclient, FXMDIClient::ID_MDI_MENUCLOSE,
|
|
81
|
+
FRAME_RAISED|LAYOUT_RIGHT)
|
|
82
|
+
FXMDIRestoreButton.new(menubar, @mdiclient, FXMDIClient::ID_MDI_MENURESTORE,
|
|
83
|
+
FRAME_RAISED|LAYOUT_RIGHT)
|
|
84
|
+
FXMDIMinimizeButton.new(menubar, @mdiclient,
|
|
85
|
+
FXMDIClient::ID_MDI_MENUMINIMIZE, FRAME_RAISED|LAYOUT_RIGHT)
|
|
86
|
+
|
|
87
|
+
# Create a few test windows to get started
|
|
88
|
+
mdichild = createTestWindow(10, 10, 400, 300)
|
|
89
|
+
@mdiclient.setActiveChild(mdichild)
|
|
90
|
+
createTestWindow(20, 20, 400, 300)
|
|
91
|
+
createTestWindow(30, 30, 400, 300)
|
|
92
|
+
|
|
93
|
+
# File menu
|
|
94
|
+
filemenu = FXMenuPane.new(self)
|
|
95
|
+
newCmd = FXMenuCommand.new(filemenu, "&New\tCtl-N\tCreate new document.")
|
|
96
|
+
newCmd.connect(SEL_COMMAND, method(:onCmdNew))
|
|
97
|
+
FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit application.", nil,
|
|
98
|
+
getApp(), FXApp::ID_QUIT, 0)
|
|
99
|
+
FXMenuTitle.new(menubar, "&File", nil, filemenu)
|
|
100
|
+
|
|
101
|
+
# Window menu
|
|
102
|
+
windowmenu = FXMenuPane.new(self)
|
|
103
|
+
FXMenuCommand.new(windowmenu, "Tile &Horizontally", nil,
|
|
104
|
+
@mdiclient, FXMDIClient::ID_MDI_TILEHORIZONTAL)
|
|
105
|
+
FXMenuCommand.new(windowmenu, "Tile &Vertically", nil,
|
|
106
|
+
@mdiclient, FXMDIClient::ID_MDI_TILEVERTICAL)
|
|
107
|
+
FXMenuCommand.new(windowmenu, "C&ascade", nil,
|
|
108
|
+
@mdiclient, FXMDIClient::ID_MDI_CASCADE)
|
|
109
|
+
FXMenuCommand.new(windowmenu, "&Close", nil,
|
|
110
|
+
@mdiclient, FXMDIClient::ID_MDI_CLOSE)
|
|
111
|
+
sep1 = FXMenuSeparator.new(windowmenu)
|
|
112
|
+
sep1.setTarget(@mdiclient)
|
|
113
|
+
sep1.setSelector(FXMDIClient::ID_MDI_ANY)
|
|
114
|
+
FXMenuCommand.new(windowmenu, nil, nil, @mdiclient, FXMDIClient::ID_MDI_1)
|
|
115
|
+
FXMenuCommand.new(windowmenu, nil, nil, @mdiclient, FXMDIClient::ID_MDI_2)
|
|
116
|
+
FXMenuCommand.new(windowmenu, nil, nil, @mdiclient, FXMDIClient::ID_MDI_3)
|
|
117
|
+
FXMenuCommand.new(windowmenu, nil, nil, @mdiclient, FXMDIClient::ID_MDI_4)
|
|
118
|
+
FXMenuCommand.new(windowmenu, "&Others...", nil, @mdiclient, FXMDIClient::ID_MDI_OVER_5)
|
|
119
|
+
FXMenuTitle.new(menubar,"&Window", nil, windowmenu)
|
|
120
|
+
|
|
121
|
+
# Help menu
|
|
122
|
+
helpmenu = FXMenuPane.new(self)
|
|
123
|
+
FXMenuCommand.new(helpmenu, "&About FOX...").connect(SEL_COMMAND) {
|
|
124
|
+
FXMessageBox.information(self, MBOX_OK, "About MDI Test",
|
|
125
|
+
"Test of the FOX MDI Widgets\nWritten by Jeroen van der Zijp")
|
|
126
|
+
}
|
|
127
|
+
FXMenuTitle.new(menubar, "&Help", nil, helpmenu, LAYOUT_RIGHT)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
#
|
|
131
|
+
# Create a new MDI child window.
|
|
132
|
+
#
|
|
133
|
+
# When Ruby's GC is marking the FXTable, we also call FXRbGcMark() on all of
|
|
134
|
+
# the table's items (see FXRbTable::markfunc in markfuncs.cpp).
|
|
135
|
+
#
|
|
136
|
+
def createTestWindow(x, y, w, h)
|
|
137
|
+
mdichild = FXMDIChild.new(@mdiclient, "Child", nil, nil,0, x, y, w, h)
|
|
138
|
+
scrollwindow = FXScrollWindow.new(mdichild, 0)
|
|
139
|
+
scrollwindow.verticalScrollBar.setLine(@font.fontHeight)
|
|
140
|
+
tbl = FXTable.new(scrollwindow, nil, 0, TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 2, 2, 2, 2)
|
|
141
|
+
nr, nc = 200, 200
|
|
142
|
+
tbl.setTableSize(nr, nc)
|
|
143
|
+
(0...nc).each { |c|
|
|
144
|
+
tbl.setColumnText(c,c.to_s)
|
|
145
|
+
}
|
|
146
|
+
(0...nr).each { |r|
|
|
147
|
+
tbl.setRowText(r,r.to_s)
|
|
148
|
+
}
|
|
149
|
+
(0...nr).each { |r|
|
|
150
|
+
(0...nc).each { |c|
|
|
151
|
+
tbl.setItemText(r,c,"#{r},#{c}")
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
mdichild
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# New
|
|
158
|
+
def onCmdNew(sender, sel, ptr)
|
|
159
|
+
mdichild = createTestWindow(20, 20, 300, 200)
|
|
160
|
+
mdichild.create
|
|
161
|
+
return 1
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Start
|
|
165
|
+
def create
|
|
166
|
+
super
|
|
167
|
+
|
|
168
|
+
# At the time the first three MDI windows are constructed, we don't
|
|
169
|
+
# yet know the font height and so we cannot accurately set the line
|
|
170
|
+
# height for the vertical scrollbar. Now that the real font has been
|
|
171
|
+
# created, we can go back and fix the scrollbar line heights for these
|
|
172
|
+
# windows.
|
|
173
|
+
@font.create
|
|
174
|
+
@mdiclient.each_child do |mdichild|
|
|
175
|
+
mdichild.contentWindow.verticalScrollBar.setLine(@font.fontHeight)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
show(PLACEMENT_SCREEN)
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
if __FILE__ == $0
|
|
183
|
+
# Make application
|
|
184
|
+
application = FXApp.new("MDIApp", "FoxTest")
|
|
185
|
+
application.init(ARGV)
|
|
186
|
+
|
|
187
|
+
# Make window
|
|
188
|
+
MDITestWindow.new(application)
|
|
189
|
+
|
|
190
|
+
# Create app
|
|
191
|
+
application.create
|
|
192
|
+
|
|
193
|
+
# Run
|
|
194
|
+
application.run
|
|
195
|
+
end
|
data/ext/fox12/FXRuby.cpp
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
***********************************************************************/
|
|
22
22
|
|
|
23
23
|
/***********************************************************************
|
|
24
|
-
* $Id: FXRuby.cpp,v 1.
|
|
24
|
+
* $Id: FXRuby.cpp,v 1.4 2005/01/27 03:58:46 lyle Exp $
|
|
25
25
|
***********************************************************************/
|
|
26
26
|
|
|
27
27
|
#ifdef _MSC_VER
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
#define RB_RESCUE2_BROKEN_PROTOTYPE 1
|
|
37
37
|
#endif
|
|
38
38
|
|
|
39
|
+
/* The prototype for st_foreach() changed at Ruby version 1.8.2 */
|
|
40
|
+
#if RUBY_VERSION_CODE < 182
|
|
41
|
+
#define ST_BROKEN_PROTOTYPES 1
|
|
42
|
+
#endif
|
|
43
|
+
|
|
39
44
|
#include "impl.h"
|
|
40
45
|
|
|
41
46
|
#ifdef __CYGWIN__
|
|
@@ -53,17 +58,32 @@ extern "C" {
|
|
|
53
58
|
// Symbol table functions from Ruby. If we included "st.h" directly
|
|
54
59
|
// we'd be dealing with broken prototypes anyways, so just duplicate
|
|
55
60
|
// the needed declarations here with the correct prototypes.
|
|
61
|
+
|
|
62
|
+
#ifdef ST_BROKEN_PROTOTYPES
|
|
63
|
+
|
|
56
64
|
extern "C" {
|
|
65
|
+
|
|
57
66
|
struct st_table;
|
|
58
67
|
|
|
68
|
+
typedef st_data_t char *; /* this type changed to unsigned long at Ruby 1.8.2 */
|
|
69
|
+
|
|
59
70
|
st_table *st_init_strtable();
|
|
60
71
|
st_table *st_init_numtable();
|
|
61
|
-
int st_lookup(st_table *table,
|
|
62
|
-
int st_insert(st_table *table,
|
|
63
|
-
int st_delete(st_table *table,
|
|
64
|
-
void st_foreach(st_table *table, int (*func)(
|
|
72
|
+
int st_lookup(st_table *table, st_data_t key, st_data_t *value);
|
|
73
|
+
int st_insert(st_table *table, st_data_t key, st_data_t value);
|
|
74
|
+
int st_delete(st_table *table, st_data_t *key, st_data_t *value);
|
|
75
|
+
void st_foreach(st_table *table, int (*func)(st_data_t, st_data_t, st_data_t), st_data_t arg);
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#else
|
|
80
|
+
|
|
81
|
+
extern "C" {
|
|
82
|
+
#include "st.h"
|
|
65
83
|
}
|
|
66
84
|
|
|
85
|
+
#endif
|
|
86
|
+
|
|
67
87
|
// Opaque type declaration from SWIG runtime
|
|
68
88
|
struct swig_type_info;
|
|
69
89
|
|
|
@@ -72,9 +92,9 @@ swig_type_info *FXRbTypeQuery(const char *desc){
|
|
|
72
92
|
FXASSERT(desc!=0);
|
|
73
93
|
static st_table *types=st_init_strtable();
|
|
74
94
|
swig_type_info *typeinfo=0;
|
|
75
|
-
if(st_lookup(types,const_cast<char*>(desc),(
|
|
95
|
+
if(st_lookup(types,reinterpret_cast<st_data_t>(const_cast<char*>(desc)),reinterpret_cast<st_data_t *>(&typeinfo))==0){
|
|
76
96
|
typeinfo=SWIG_Ruby_TypeQuery(desc);
|
|
77
|
-
st_insert(types,strdup(desc),(
|
|
97
|
+
st_insert(types,reinterpret_cast<st_data_t>(strdup(desc)),reinterpret_cast<st_data_t>(typeinfo));
|
|
78
98
|
}
|
|
79
99
|
FXASSERT(typeinfo!=0);
|
|
80
100
|
return typeinfo;
|
|
@@ -121,7 +141,7 @@ VALUE FXRbNewPointerObj(void *ptr,swig_type_info* ty){
|
|
|
121
141
|
obj=SWIG_Ruby_NewPointerObj(ptr,ty,1);
|
|
122
142
|
desc->obj=obj;
|
|
123
143
|
desc->borrowed=true;
|
|
124
|
-
result=st_insert(FXRuby_Objects,reinterpret_cast<
|
|
144
|
+
result=st_insert(FXRuby_Objects,reinterpret_cast<st_data_t>(ptr),reinterpret_cast<st_data_t>(desc));
|
|
125
145
|
FXASSERT(result==0);
|
|
126
146
|
return obj;
|
|
127
147
|
}
|
|
@@ -144,7 +164,7 @@ VALUE FXRbNewPointerObj(void *ptr,swig_type_info* ty){
|
|
|
144
164
|
bool FXRbIsBorrowed(void* ptr){
|
|
145
165
|
FXASSERT(ptr!=0);
|
|
146
166
|
FXRubyObjDesc *desc;
|
|
147
|
-
if(st_lookup(FXRuby_Objects,reinterpret_cast<
|
|
167
|
+
if(st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(ptr),reinterpret_cast<st_data_t *>(&desc))!=0){
|
|
148
168
|
return desc->borrowed;
|
|
149
169
|
}
|
|
150
170
|
else{
|
|
@@ -210,7 +230,7 @@ void FXRbRegisterRubyObj(VALUE rubyObj,const void* foxObj) {
|
|
|
210
230
|
if(FXMALLOC(&desc,FXRubyObjDesc,1)){
|
|
211
231
|
desc->obj=rubyObj;
|
|
212
232
|
desc->borrowed=false;
|
|
213
|
-
st_insert(FXRuby_Objects,reinterpret_cast<
|
|
233
|
+
st_insert(FXRuby_Objects,reinterpret_cast<st_data_t>(const_cast<void*>(foxObj)),reinterpret_cast<st_data_t>(desc));
|
|
214
234
|
}
|
|
215
235
|
else{
|
|
216
236
|
FXASSERT(FALSE);
|
|
@@ -225,11 +245,11 @@ void FXRbRegisterRubyObj(VALUE rubyObj,const void* foxObj) {
|
|
|
225
245
|
void FXRbUnregisterRubyObj(const void* foxObj){
|
|
226
246
|
if(foxObj!=0){
|
|
227
247
|
FXRubyObjDesc* desc;
|
|
228
|
-
if(st_lookup(FXRuby_Objects,reinterpret_cast<
|
|
248
|
+
if(st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(const_cast<void*>(foxObj)),reinterpret_cast<st_data_t *>(&desc))!=0){
|
|
229
249
|
DATA_PTR(desc->obj)=0;
|
|
230
250
|
FXFREE(&desc);
|
|
231
|
-
st_delete(FXRuby_Objects,(
|
|
232
|
-
FXASSERT(st_lookup(FXRuby_Objects,reinterpret_cast<
|
|
251
|
+
st_delete(FXRuby_Objects,reinterpret_cast<st_data_t *>(const_cast<void**>(&foxObj)),reinterpret_cast<st_data_t *>(0));
|
|
252
|
+
FXASSERT(st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(const_cast<void*>(foxObj)),reinterpret_cast<st_data_t *>(0))==0);
|
|
233
253
|
}
|
|
234
254
|
}
|
|
235
255
|
}
|
|
@@ -254,7 +274,7 @@ VALUE to_ruby(const FXObject* obj){
|
|
|
254
274
|
*/
|
|
255
275
|
VALUE FXRbGetRubyObj(const void *foxObj,bool searchBoth){
|
|
256
276
|
FXRubyObjDesc* desc;
|
|
257
|
-
if(foxObj!=0 && st_lookup(FXRuby_Objects,reinterpret_cast<
|
|
277
|
+
if(foxObj!=0 && st_lookup(FXRuby_Objects,reinterpret_cast<st_data_t>(const_cast<void*>(foxObj)),reinterpret_cast<st_data_t *>(&desc))!=0){
|
|
258
278
|
FXASSERT(desc!=0);
|
|
259
279
|
if(searchBoth){
|
|
260
280
|
return desc->obj;
|
|
@@ -1660,32 +1680,36 @@ static st_table * appSensitiveDCs;
|
|
|
1660
1680
|
void FXRbRegisterAppSensitiveObject(FXObject* obj){
|
|
1661
1681
|
FXASSERT(obj!=0);
|
|
1662
1682
|
FXTRACE((100,"%s:%d: FXRbRegisterAppSensitiveObject(obj=0x%08x(%s))\n",__FILE__,__LINE__,obj,obj->getClassName()));
|
|
1663
|
-
st_insert(appSensitiveObjs,reinterpret_cast<
|
|
1664
|
-
FXASSERT(st_lookup(appSensitiveObjs,reinterpret_cast<
|
|
1683
|
+
st_insert(appSensitiveObjs,reinterpret_cast<st_data_t>(obj),(st_data_t)0);
|
|
1684
|
+
FXASSERT(st_lookup(appSensitiveObjs,reinterpret_cast<st_data_t>(obj),reinterpret_cast<st_data_t *>(0))!=0);
|
|
1665
1685
|
}
|
|
1666
1686
|
|
|
1667
1687
|
void FXRbRegisterAppSensitiveObject(FXDC* dc){
|
|
1668
1688
|
FXASSERT(dc!=0);
|
|
1669
1689
|
FXTRACE((100,"%s:%d: FXRbRegisterAppSensitiveObject(dc=0x%08x)\n",__FILE__,__LINE__,dc));
|
|
1670
|
-
st_insert(appSensitiveDCs,reinterpret_cast<
|
|
1671
|
-
FXASSERT(st_lookup(appSensitiveDCs,reinterpret_cast<
|
|
1690
|
+
st_insert(appSensitiveDCs,reinterpret_cast<st_data_t>(dc),(st_data_t)0);
|
|
1691
|
+
FXASSERT(st_lookup(appSensitiveDCs,reinterpret_cast<st_data_t>(dc),reinterpret_cast<st_data_t *>(0))!=0);
|
|
1672
1692
|
}
|
|
1673
1693
|
|
|
1674
1694
|
void FXRbUnregisterAppSensitiveObject(FXObject* obj){
|
|
1675
1695
|
FXASSERT(obj!=0);
|
|
1676
1696
|
FXTRACE((100,"%s:%d: FXRbUnregisterAppSensitiveObject(obj=0x%08x(%s))\n",__FILE__,__LINE__,obj,obj->getClassName()));
|
|
1677
|
-
st_delete(appSensitiveObjs,reinterpret_cast<
|
|
1678
|
-
FXASSERT(st_lookup(appSensitiveObjs,reinterpret_cast<
|
|
1697
|
+
st_delete(appSensitiveObjs,reinterpret_cast<st_data_t *>(&obj),reinterpret_cast<st_data_t *>(0));
|
|
1698
|
+
FXASSERT(st_lookup(appSensitiveObjs,reinterpret_cast<st_data_t>(obj),reinterpret_cast<st_data_t *>(0))==0);
|
|
1679
1699
|
}
|
|
1680
1700
|
|
|
1681
1701
|
void FXRbUnregisterAppSensitiveObject(FXDC* dc){
|
|
1682
1702
|
FXASSERT(dc!=0);
|
|
1683
1703
|
FXTRACE((100,"%s:%d: FXRbUnregisterAppSensitiveObject(dc=0x%08x)\n",__FILE__,__LINE__,dc));
|
|
1684
|
-
st_delete(appSensitiveDCs,reinterpret_cast<
|
|
1685
|
-
FXASSERT(st_lookup(appSensitiveDCs,reinterpret_cast<
|
|
1704
|
+
st_delete(appSensitiveDCs,reinterpret_cast<st_data_t *>(&dc),reinterpret_cast<st_data_t *>(0));
|
|
1705
|
+
FXASSERT(st_lookup(appSensitiveDCs,reinterpret_cast<st_data_t>(dc),reinterpret_cast<st_data_t *>(0))==0);
|
|
1686
1706
|
}
|
|
1687
1707
|
|
|
1688
|
-
|
|
1708
|
+
#ifdef ST_BROKEN_PROTOTYPES
|
|
1709
|
+
static int st_cbfunc_obj(st_data_t key,st_data_t,st_data_t arg){
|
|
1710
|
+
#else
|
|
1711
|
+
static int st_cbfunc_obj(st_data_t key,st_data_t,st_data_t arg,int){
|
|
1712
|
+
#endif
|
|
1689
1713
|
FXASSERT(key!=0);
|
|
1690
1714
|
FXASSERT(arg!=0);
|
|
1691
1715
|
FXObjectListOf<FXObject> *pObjectList=reinterpret_cast<FXObjectListOf<FXObject>*>(arg);
|
|
@@ -1694,7 +1718,11 @@ static int st_cbfunc_obj(char *key,char *,char* arg){
|
|
|
1694
1718
|
return 0;
|
|
1695
1719
|
}
|
|
1696
1720
|
|
|
1697
|
-
|
|
1721
|
+
#ifdef ST_BROKEN_PROTOTYPES
|
|
1722
|
+
static int st_cbfunc_dc(st_data_t key,st_data_t,st_data_t arg){
|
|
1723
|
+
#else
|
|
1724
|
+
static int st_cbfunc_dc(st_data_t key,st_data_t,st_data_t arg,int){
|
|
1725
|
+
#endif
|
|
1698
1726
|
FXASSERT(key!=0);
|
|
1699
1727
|
FXASSERT(arg!=0);
|
|
1700
1728
|
FXArray<FXDC*> *pDCArray=reinterpret_cast<FXArray<FXDC*>*>(arg);
|
|
@@ -1707,7 +1735,11 @@ void FXRbDestroyAppSensitiveObjects(){
|
|
|
1707
1735
|
FXTRACE((100,"%s:%d: Begin destroying objects that hold references to the FXApp...\n",__FILE__,__LINE__));
|
|
1708
1736
|
|
|
1709
1737
|
FXObjectListOf<FXObject> objs;
|
|
1710
|
-
|
|
1738
|
+
#ifdef ST_BROKEN_PROTOTYPES
|
|
1739
|
+
st_foreach(appSensitiveObjs,st_cbfunc_obj,reinterpret_cast<st_data_t>(&objs));
|
|
1740
|
+
#else
|
|
1741
|
+
st_foreach(appSensitiveObjs,reinterpret_cast<int (*)(ANYARGS)>(st_cbfunc_obj),reinterpret_cast<st_data_t>(&objs));
|
|
1742
|
+
#endif
|
|
1711
1743
|
for(FXint i=0;i<objs.no();i++){
|
|
1712
1744
|
if(objs[i]->isMemberOf(FXMETACLASS(FXRbCursor))){
|
|
1713
1745
|
if(dynamic_cast<FXRbCursor*>(objs[i])->ownedByApp)
|
|
@@ -1737,7 +1769,11 @@ void FXRbDestroyAppSensitiveObjects(){
|
|
|
1737
1769
|
}
|
|
1738
1770
|
|
|
1739
1771
|
FXArray<FXDC*> dcs;
|
|
1740
|
-
|
|
1772
|
+
#ifdef ST_BROKEN_PROTOTYPES
|
|
1773
|
+
st_foreach(appSensitiveDCs,st_cbfunc_dc,reinterpret_cast<st_data_t>(&dcs));
|
|
1774
|
+
#else
|
|
1775
|
+
st_foreach(appSensitiveDCs,reinterpret_cast<int (*)(ANYARGS)>(st_cbfunc_dc),reinterpret_cast<st_data_t>(&dcs));
|
|
1776
|
+
#endif
|
|
1741
1777
|
for(FXint j=0;j<dcs.no();j++){
|
|
1742
1778
|
delete dcs[j];
|
|
1743
1779
|
}
|