annotate window/widget.cc @ 52:15a18fbe6f21

* Known bugs added to the README * Code cleaning (0 -> NULL when needed, indentation, spaces, ...)
author thib
date Sat, 18 Apr 2009 18:35:39 +0000
parents 5f548e5957a8
children ddbcbd000206
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
223b71206888 Initial import
thib
parents:
diff changeset
1 /*
223b71206888 Initial import
thib
parents:
diff changeset
2 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
223b71206888 Initial import
thib
parents:
diff changeset
3 * All rights reserved.
223b71206888 Initial import
thib
parents:
diff changeset
4 *
223b71206888 Initial import
thib
parents:
diff changeset
5 * Redistribution and use in source and binary forms, with or without
223b71206888 Initial import
thib
parents:
diff changeset
6 * modification, are permitted provided that the following conditions
223b71206888 Initial import
thib
parents:
diff changeset
7 * are met:
223b71206888 Initial import
thib
parents:
diff changeset
8 * 1. Redistributions of source code must retain the above copyright
223b71206888 Initial import
thib
parents:
diff changeset
9 * notice, this list of conditions and the following disclaimer.
223b71206888 Initial import
thib
parents:
diff changeset
10 * 2. Redistributions in binary form must reproduce the above copyright
223b71206888 Initial import
thib
parents:
diff changeset
11 * notice, this list of conditions and the following disclaimer in the
223b71206888 Initial import
thib
parents:
diff changeset
12 * documentation and/or other materials provided with the distribution.
223b71206888 Initial import
thib
parents:
diff changeset
13 * 3. The name of the author may not be used to endorse or promote products
223b71206888 Initial import
thib
parents:
diff changeset
14 * derived from this software without specific prior written permission.
223b71206888 Initial import
thib
parents:
diff changeset
15 *
223b71206888 Initial import
thib
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
223b71206888 Initial import
thib
parents:
diff changeset
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
223b71206888 Initial import
thib
parents:
diff changeset
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
223b71206888 Initial import
thib
parents:
diff changeset
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
223b71206888 Initial import
thib
parents:
diff changeset
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
223b71206888 Initial import
thib
parents:
diff changeset
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
223b71206888 Initial import
thib
parents:
diff changeset
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
223b71206888 Initial import
thib
parents:
diff changeset
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
223b71206888 Initial import
thib
parents:
diff changeset
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
223b71206888 Initial import
thib
parents:
diff changeset
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
223b71206888 Initial import
thib
parents:
diff changeset
26 */
223b71206888 Initial import
thib
parents:
diff changeset
27
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
28 #include "widget.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
29 #include <algorithm>
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
30 #include <map>
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
31 #include <string>
0
223b71206888 Initial import
thib
parents:
diff changeset
32
223b71206888 Initial import
thib
parents:
diff changeset
33 Rect DSurfaceRenderText(TextGlyphStream::iterator start, TextGlyphStream::iterator end, const Rect& srcrect,
223b71206888 Initial import
thib
parents:
diff changeset
34 Surface* dst, const Rect& dstrect);
223b71206888 Initial import
thib
parents:
diff changeset
35 void DSurfaceFill(Surface* src, const Rect& rect, int r, int g, int b, int a = 0xff);
223b71206888 Initial import
thib
parents:
diff changeset
36 void DSurfaceMove(Surface* src, const Rect& srcrect, Surface* dst_o, const Rect& dstrect);
223b71206888 Initial import
thib
parents:
diff changeset
37
223b71206888 Initial import
thib
parents:
diff changeset
38 //static char* wdefault_font_orig = "msgothic.ttc;times.ttf;";
223b71206888 Initial import
thib
parents:
diff changeset
39 static std::map<int, XKFont::HorizLayout*> size_to_layout;
47
5f548e5957a8 * get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents: 14
diff changeset
40 static const char* wdefault_font_orig = "times.ttf;msgothic.ttc";
0
223b71206888 Initial import
thib
parents:
diff changeset
41 static std::string wdefault_font = wdefault_font_orig;
223b71206888 Initial import
thib
parents:
diff changeset
42
223b71206888 Initial import
thib
parents:
diff changeset
43 void SetFont(const char* font) {
223b71206888 Initial import
thib
parents:
diff changeset
44 if (font == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
45 std::map<int,XKFont::HorizLayout*>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
46 for (it=size_to_layout.begin(); it != size_to_layout.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
47 delete it->second;
223b71206888 Initial import
thib
parents:
diff changeset
48 }
223b71206888 Initial import
thib
parents:
diff changeset
49 size_to_layout.clear();
223b71206888 Initial import
thib
parents:
diff changeset
50 wdefault_font = font;
223b71206888 Initial import
thib
parents:
diff changeset
51 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
52
0
223b71206888 Initial import
thib
parents:
diff changeset
53 // namespace Widget {
223b71206888 Initial import
thib
parents:
diff changeset
54 #define TimeCursor WidTimeCursor
223b71206888 Initial import
thib
parents:
diff changeset
55 #define MouseCursor WidMouseCursor
223b71206888 Initial import
thib
parents:
diff changeset
56 #define Button WidButton
223b71206888 Initial import
thib
parents:
diff changeset
57 #define Scale WidScale
223b71206888 Initial import
thib
parents:
diff changeset
58 #define TextButton WidTextButton
223b71206888 Initial import
thib
parents:
diff changeset
59 #define Text WidText
223b71206888 Initial import
thib
parents:
diff changeset
60 #define AnmTime WidAnmTime
223b71206888 Initial import
thib
parents:
diff changeset
61 #define AnmMove WidAnmMove
223b71206888 Initial import
thib
parents:
diff changeset
62 #define AnmAlpha WidAnmAlpha
223b71206888 Initial import
thib
parents:
diff changeset
63 #define AnmPtnSolid WidAnmPtnSolid
223b71206888 Initial import
thib
parents:
diff changeset
64 #define AnmPtnAlpha WidAnmPtnAlpha
223b71206888 Initial import
thib
parents:
diff changeset
65
223b71206888 Initial import
thib
parents:
diff changeset
66 XKFont::HorizLayout* DefaultLayout(int text_size) {
14
8da1d92ac8f8 Don't create fonts faces for size <= 0, and update objects when their font size is set
thib
parents: 0
diff changeset
67 if(text_size <= 0) abort();//FIXME: Find why the hell text_size can be <= 0
0
223b71206888 Initial import
thib
parents:
diff changeset
68 if (size_to_layout.find(text_size) == size_to_layout.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
69 size_to_layout[text_size] = new XKFont::HorizLayout(wdefault_font.c_str(), text_size);
223b71206888 Initial import
thib
parents:
diff changeset
70 }
223b71206888 Initial import
thib
parents:
diff changeset
71 return size_to_layout[text_size];
223b71206888 Initial import
thib
parents:
diff changeset
72 }
223b71206888 Initial import
thib
parents:
diff changeset
73
223b71206888 Initial import
thib
parents:
diff changeset
74 void PicWidget::activate(void) {
223b71206888 Initial import
thib
parents:
diff changeset
75 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
76
0
223b71206888 Initial import
thib
parents:
diff changeset
77 void PicWidget::deactivate(void) {
223b71206888 Initial import
thib
parents:
diff changeset
78 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
79
0
223b71206888 Initial import
thib
parents:
diff changeset
80 void PicWidget::SetRegion(const Rect& apos) {
223b71206888 Initial import
thib
parents:
diff changeset
81 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
82
0
223b71206888 Initial import
thib
parents:
diff changeset
83 void PicWidget::show(void) {
223b71206888 Initial import
thib
parents:
diff changeset
84 Pic()->show();
223b71206888 Initial import
thib
parents:
diff changeset
85 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
86
0
223b71206888 Initial import
thib
parents:
diff changeset
87 void PicWidget::hide(void) {
223b71206888 Initial import
thib
parents:
diff changeset
88 Pic()->hide();
223b71206888 Initial import
thib
parents:
diff changeset
89 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
90
0
223b71206888 Initial import
thib
parents:
diff changeset
91 void PicWidget::show_all(void) {
223b71206888 Initial import
thib
parents:
diff changeset
92 Pic()->show_all();
223b71206888 Initial import
thib
parents:
diff changeset
93 }
223b71206888 Initial import
thib
parents:
diff changeset
94
223b71206888 Initial import
thib
parents:
diff changeset
95 TimeCursor::TimeCursor(Event::Container& container, int _interval, PicContainer* parent, const char* s, int _sx, int _sy, int _sdx, int _sdy, int _nptn, const Rect& r) :
223b71206888 Initial import
thib
parents:
diff changeset
96 Time(container) {
223b71206888 Initial import
thib
parents:
diff changeset
97 interval = _interval;
223b71206888 Initial import
thib
parents:
diff changeset
98 if (interval < 0) interval = 100;
223b71206888 Initial import
thib
parents:
diff changeset
99 nptn = _nptn;
223b71206888 Initial import
thib
parents:
diff changeset
100 if (nptn < 0) nptn = 1;
223b71206888 Initial import
thib
parents:
diff changeset
101 count = 0; old_time = 0;
223b71206888 Initial import
thib
parents:
diff changeset
102
223b71206888 Initial import
thib
parents:
diff changeset
103 x = _sx; y = _sy; dx = _sdx; dy = _sdy;
223b71206888 Initial import
thib
parents:
diff changeset
104 SetPic(parent->create_leaf(r, PicBase::CACHE_BACK));
223b71206888 Initial import
thib
parents:
diff changeset
105 Pic()->SetSurface(s, _sx, _sy);
223b71206888 Initial import
thib
parents:
diff changeset
106 };
223b71206888 Initial import
thib
parents:
diff changeset
107 void TimeCursor::Elapsed(unsigned int current_time) {
223b71206888 Initial import
thib
parents:
diff changeset
108 int move = (current_time-old_time)/interval;
223b71206888 Initial import
thib
parents:
diff changeset
109 if (move) {
223b71206888 Initial import
thib
parents:
diff changeset
110 old_time += move*interval;
223b71206888 Initial import
thib
parents:
diff changeset
111 count += move;
223b71206888 Initial import
thib
parents:
diff changeset
112 count %= nptn;
223b71206888 Initial import
thib
parents:
diff changeset
113 Pic()->SetSurfacePos(x + count*dx, y + count*dy);
223b71206888 Initial import
thib
parents:
diff changeset
114 }
223b71206888 Initial import
thib
parents:
diff changeset
115 if (current_time > old_time+interval) SetWakeup(current_time);
223b71206888 Initial import
thib
parents:
diff changeset
116 else SetWakeup(old_time+interval);
223b71206888 Initial import
thib
parents:
diff changeset
117 }
223b71206888 Initial import
thib
parents:
diff changeset
118
223b71206888 Initial import
thib
parents:
diff changeset
119 MouseCursor::MouseCursor(Event::Container& _container, PicContainer* parent, const char* s, int x, int y, int w, int h) :
223b71206888 Initial import
thib
parents:
diff changeset
120 Event::Video(_container), container(_container) {
223b71206888 Initial import
thib
parents:
diff changeset
121 int sx, sy;
223b71206888 Initial import
thib
parents:
diff changeset
122 _container.MousePos(sx, sy);
223b71206888 Initial import
thib
parents:
diff changeset
123 SetPic(parent->create_leaf(Rect(sx, sy, sx+w, sy+h), 0));
223b71206888 Initial import
thib
parents:
diff changeset
124 Pic()->SetSurface(s, x, y);
223b71206888 Initial import
thib
parents:
diff changeset
125 x = 0; y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
126 container.RegisterGlobalMotionFunc(&Motionfunc, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
127 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
128
0
223b71206888 Initial import
thib
parents:
diff changeset
129 MouseCursor::MouseCursor(Event::Container& _container, PicContainer* parent, Surface* s, int x, int y, int w, int h) :
223b71206888 Initial import
thib
parents:
diff changeset
130 Event::Video(_container), container(_container) {
223b71206888 Initial import
thib
parents:
diff changeset
131 int sx, sy;
223b71206888 Initial import
thib
parents:
diff changeset
132 _container.MousePos(sx, sy);
223b71206888 Initial import
thib
parents:
diff changeset
133 SetPic(parent->create_leaf(Rect(sx, sy, sx+w, sy+h), 0));
223b71206888 Initial import
thib
parents:
diff changeset
134 Pic()->SetSurface(s, x, y);
223b71206888 Initial import
thib
parents:
diff changeset
135 x = 0; y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
136 container.RegisterGlobalMotionFunc(&Motionfunc, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
137 }
223b71206888 Initial import
thib
parents:
diff changeset
138
223b71206888 Initial import
thib
parents:
diff changeset
139 MouseCursor::~MouseCursor() {
223b71206888 Initial import
thib
parents:
diff changeset
140 container.DeleteGlobalMotionFunc(&Motionfunc, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
141 }
223b71206888 Initial import
thib
parents:
diff changeset
142
223b71206888 Initial import
thib
parents:
diff changeset
143 bool MouseCursor::Motionfunc(int x, int y, void* pointer) {
223b71206888 Initial import
thib
parents:
diff changeset
144 MouseCursor* _this = (MouseCursor*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
145 // º¸¾å¤¬¥«¡¼¥½¥ë¥Ý¥¤¥ó¥È¤Î¾ì¹ç
223b71206888 Initial import
thib
parents:
diff changeset
146 // _this->Pic()->Move(x,y);
223b71206888 Initial import
thib
parents:
diff changeset
147 // º¸²¼¤¬¥«¡¼¥½¥ë¥Ý¥¤¥ó¥È¤Î¾ì¹ç
223b71206888 Initial import
thib
parents:
diff changeset
148 _this->Pic()->Move(x,y-_this->Pic()->Height());
223b71206888 Initial import
thib
parents:
diff changeset
149 return true;
223b71206888 Initial import
thib
parents:
diff changeset
150 }
223b71206888 Initial import
thib
parents:
diff changeset
151
223b71206888 Initial import
thib
parents:
diff changeset
152 Button::Button(Event::Container& container, PicContainer* parent, const char* s, int _sx, int _sy, int _sdx, int _sdy, int _nptn, const Rect& r, int _z) : sx(_sx), sy(_sy), sdx(_sdx), sdy(_sdy), nptn(_nptn) ,Event::Video(container,r, _z) {
223b71206888 Initial import
thib
parents:
diff changeset
153 SetPic(parent->create_leaf(r, 0));
223b71206888 Initial import
thib
parents:
diff changeset
154 Pic()->SetSurface(s, _sx, _sy);
223b71206888 Initial import
thib
parents:
diff changeset
155 show();
223b71206888 Initial import
thib
parents:
diff changeset
156 is_in = false;
223b71206888 Initial import
thib
parents:
diff changeset
157 is_toggled = false;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
158 press_func = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
159 press_pointer = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
160 drag_func = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
161 drag_pointer = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
162 is_toggle_switch = false;
223b71206888 Initial import
thib
parents:
diff changeset
163 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
164
0
223b71206888 Initial import
thib
parents:
diff changeset
165 Button::Button(Event::Container& container, PicContainer* parent, Surface* s, int _sx, int _sy, int _sdx, int _sdy, int _nptn, const Rect& r, int _z) : sx(_sx), sy(_sy), sdx(_sdx), sdy(_sdy), nptn(_nptn) ,Event::Video(container,r, _z) {
223b71206888 Initial import
thib
parents:
diff changeset
166 SetPic(parent->create_leaf(r, 0));
223b71206888 Initial import
thib
parents:
diff changeset
167 Pic()->SetSurface(s, _sx, _sy);
223b71206888 Initial import
thib
parents:
diff changeset
168 show();
223b71206888 Initial import
thib
parents:
diff changeset
169 is_in = false;
223b71206888 Initial import
thib
parents:
diff changeset
170 is_toggled = false;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
171 press_func = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
172 press_pointer = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
173 drag_func = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
174 drag_pointer = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
175 is_toggle_switch = false;
223b71206888 Initial import
thib
parents:
diff changeset
176 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
177
0
223b71206888 Initial import
thib
parents:
diff changeset
178 Button::~Button() {
223b71206888 Initial import
thib
parents:
diff changeset
179 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
180
0
223b71206888 Initial import
thib
parents:
diff changeset
181 void Button::In(void) {
223b71206888 Initial import
thib
parents:
diff changeset
182 is_in = true;
223b71206888 Initial import
thib
parents:
diff changeset
183 if (nptn > 1)
223b71206888 Initial import
thib
parents:
diff changeset
184 if (! is_toggled)
223b71206888 Initial import
thib
parents:
diff changeset
185 Pic()->SetSurfacePos(sx+sdx, sy+sdy);
223b71206888 Initial import
thib
parents:
diff changeset
186 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
187
0
223b71206888 Initial import
thib
parents:
diff changeset
188 void Button::Out(void) {
223b71206888 Initial import
thib
parents:
diff changeset
189 is_in = false;
223b71206888 Initial import
thib
parents:
diff changeset
190 if (!is_toggled)
223b71206888 Initial import
thib
parents:
diff changeset
191 Pic()->SetSurfacePos(sx, sy);
223b71206888 Initial import
thib
parents:
diff changeset
192 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
193
0
223b71206888 Initial import
thib
parents:
diff changeset
194 void Button::Toggle(bool new_toggle) {
223b71206888 Initial import
thib
parents:
diff changeset
195 if (is_toggled == new_toggle) {
223b71206888 Initial import
thib
parents:
diff changeset
196 return;
223b71206888 Initial import
thib
parents:
diff changeset
197 }
223b71206888 Initial import
thib
parents:
diff changeset
198 is_toggled = new_toggle;
223b71206888 Initial import
thib
parents:
diff changeset
199 // if (is_in) return; // is_in ¤Ë´Ø¤ï¤é¤º¥¦¥£¥¸¥Ã¥È¤Îɽ¼¨¤òÊѹ¹¤¹¤ë¤³¤È¤Ë¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
200 if (is_toggled) {
223b71206888 Initial import
thib
parents:
diff changeset
201 if (nptn > 2)
223b71206888 Initial import
thib
parents:
diff changeset
202 Pic()->SetSurfacePos(sx+sdx*2, sy+sdy*2);
223b71206888 Initial import
thib
parents:
diff changeset
203 else if (nptn > 1)
223b71206888 Initial import
thib
parents:
diff changeset
204 Pic()->SetSurfacePos(sx+sdx, sy+sdy);
223b71206888 Initial import
thib
parents:
diff changeset
205 else
223b71206888 Initial import
thib
parents:
diff changeset
206 Pic()->SetSurfacePos(sx, sy);
223b71206888 Initial import
thib
parents:
diff changeset
207 } else {
223b71206888 Initial import
thib
parents:
diff changeset
208 Pic()->SetSurfacePos(sx, sy);
223b71206888 Initial import
thib
parents:
diff changeset
209 }
223b71206888 Initial import
thib
parents:
diff changeset
210 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
211
0
223b71206888 Initial import
thib
parents:
diff changeset
212 void Button::Press(void) {
223b71206888 Initial import
thib
parents:
diff changeset
213 is_in = true;
223b71206888 Initial import
thib
parents:
diff changeset
214 if (is_toggled) ;
223b71206888 Initial import
thib
parents:
diff changeset
215 else if (nptn > 2)
223b71206888 Initial import
thib
parents:
diff changeset
216 Pic()->SetSurfacePos(sx+sdx*2, sy+sdy*2);
223b71206888 Initial import
thib
parents:
diff changeset
217 else if (nptn > 1)
223b71206888 Initial import
thib
parents:
diff changeset
218 Pic()->SetSurfacePos(sx+sdx, sy+sdy);
223b71206888 Initial import
thib
parents:
diff changeset
219 if (press_func) press_func(press_pointer, this);
223b71206888 Initial import
thib
parents:
diff changeset
220 if (is_toggle_switch) Toggle(!is_toggled);
223b71206888 Initial import
thib
parents:
diff changeset
221 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
222
0
223b71206888 Initial import
thib
parents:
diff changeset
223 void Button::Release(void) {
223b71206888 Initial import
thib
parents:
diff changeset
224 if (is_toggled) ;
223b71206888 Initial import
thib
parents:
diff changeset
225 else if (nptn > 1 && is_in)
223b71206888 Initial import
thib
parents:
diff changeset
226 Pic()->SetSurfacePos(sx+sdx, sy+sdy);
223b71206888 Initial import
thib
parents:
diff changeset
227 else if (nptn > 1)
223b71206888 Initial import
thib
parents:
diff changeset
228 Pic()->SetSurfacePos(sx, sy);
223b71206888 Initial import
thib
parents:
diff changeset
229 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
230
0
223b71206888 Initial import
thib
parents:
diff changeset
231 void Button::Drag(int x_from, int y_from, int x_to, int y_to) {
223b71206888 Initial import
thib
parents:
diff changeset
232 if (drag_func) drag_func(x_from,y_from,x_to, y_to,drag_pointer, this);
223b71206888 Initial import
thib
parents:
diff changeset
233 }
223b71206888 Initial import
thib
parents:
diff changeset
234
223b71206888 Initial import
thib
parents:
diff changeset
235 Scale::Scale(Event::Container& _container, PicContainer* _parent, const Rect& r_orig, const Color& _color, bool _is_vertical) :
223b71206888 Initial import
thib
parents:
diff changeset
236 Event::Video(_container,Rect(0,0), 1),
223b71206888 Initial import
thib
parents:
diff changeset
237 container(_container), parent(_parent), cursor_color(_color),
223b71206888 Initial import
thib
parents:
diff changeset
238 mouse_x(0), mouse_y(0), max(0), min(0),
223b71206888 Initial import
thib
parents:
diff changeset
239 value(0), value_add(0), value_dragstart(0), is_vertical(_is_vertical),
223b71206888 Initial import
thib
parents:
diff changeset
240 change_func(0), change_pointer(0) {
223b71206888 Initial import
thib
parents:
diff changeset
241
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
242 arrow_down = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
243 arrow_up = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
244 cursor = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
245 panel = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
246
223b71206888 Initial import
thib
parents:
diff changeset
247 Init(r_orig);
223b71206888 Initial import
thib
parents:
diff changeset
248 }
223b71206888 Initial import
thib
parents:
diff changeset
249
223b71206888 Initial import
thib
parents:
diff changeset
250 extern char* create_button(int number, int& width, int& height, int r, int g, int b);
223b71206888 Initial import
thib
parents:
diff changeset
251 extern char* create_box(int& width, int& height, int r, int g, int b);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
252
0
223b71206888 Initial import
thib
parents:
diff changeset
253 void Scale::Init(Rect r_orig) {
223b71206888 Initial import
thib
parents:
diff changeset
254 int r=cursor_color.r, g=cursor_color.g, b=cursor_color.b;
223b71206888 Initial import
thib
parents:
diff changeset
255 // Ìð°õ
223b71206888 Initial import
thib
parents:
diff changeset
256 int arrow_width = -1;
223b71206888 Initial import
thib
parents:
diff changeset
257 cursor_width = -1;
223b71206888 Initial import
thib
parents:
diff changeset
258 char* button1;
223b71206888 Initial import
thib
parents:
diff changeset
259 char* button2;
223b71206888 Initial import
thib
parents:
diff changeset
260 if (is_vertical) {
223b71206888 Initial import
thib
parents:
diff changeset
261 // Ìð°õ¤ËɬÍפÊÎΰè³ÎÊÝ
223b71206888 Initial import
thib
parents:
diff changeset
262 int arrow_height = r_orig.width();
223b71206888 Initial import
thib
parents:
diff changeset
263 button1 = create_button(2, arrow_height, arrow_width, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
264 button2 = create_button(3, arrow_height, arrow_width, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
265 if (r_orig.height() < arrow_width*4) {
223b71206888 Initial import
thib
parents:
diff changeset
266 if (r_orig.height() < 8) r_orig.by = r_orig.ty + 8; // ¾®¤µ¤¹¤®¤ë¾ì¹ç¤Ï¶¯À©Êѹ¹
223b71206888 Initial import
thib
parents:
diff changeset
267 free( (void*)button1);
223b71206888 Initial import
thib
parents:
diff changeset
268 free( (void*)button2);
223b71206888 Initial import
thib
parents:
diff changeset
269 arrow_width = r_orig.height()/4;
223b71206888 Initial import
thib
parents:
diff changeset
270 // ºÆ³ä¤êÅö¤Æ
223b71206888 Initial import
thib
parents:
diff changeset
271 button1 = create_button(2, arrow_height, arrow_width, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
272 button2 = create_button(3, arrow_height, arrow_width, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
273 }
223b71206888 Initial import
thib
parents:
diff changeset
274 // Ìð°õ¥Ü¥¿¥ó¤ÎºîÀ®
223b71206888 Initial import
thib
parents:
diff changeset
275 Surface* a1s = parent->Root().NewSurfaceFromRGBAData(arrow_height, arrow_width*3, button1, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
276 int x = r_orig.lx; int y = r_orig.ty;
223b71206888 Initial import
thib
parents:
diff changeset
277 arrow_up = new Button(container, parent, a1s, 0, 0, 0, arrow_width, 3, Rect(x,y,x+arrow_height,y+arrow_width),1);
223b71206888 Initial import
thib
parents:
diff changeset
278 arrow_up->Pic()->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
279 Surface* a2s = parent->Root().NewSurfaceFromRGBAData(arrow_height, arrow_width*3, button2, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
280 x = r_orig.rx - arrow_height; y = r_orig.by - arrow_width;
223b71206888 Initial import
thib
parents:
diff changeset
281 arrow_down = new Button(container, parent, a2s, 0, 0, 0, arrow_width, 3, Rect(x,y,x+arrow_height,y+arrow_width),1);
223b71206888 Initial import
thib
parents:
diff changeset
282 arrow_down->Pic()->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
283 // pictureºîÀ®¡Ê¥Ü¥¿¥ó¤ÎÆ°¤¯Îΰè¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
284 Rect r = r_orig;
223b71206888 Initial import
thib
parents:
diff changeset
285 r.ty += arrow_width;
223b71206888 Initial import
thib
parents:
diff changeset
286 r.by -= arrow_width;
223b71206888 Initial import
thib
parents:
diff changeset
287 panel = parent->create_node(r, 0);
223b71206888 Initial import
thib
parents:
diff changeset
288 SetPic(panel);
223b71206888 Initial import
thib
parents:
diff changeset
289 // ¥Ü¥¿¥ó¤ÎÃæ¿´Àþ¤òÉÁ²è¡¢ÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
290 Surface* s = parent->Root().NewSurface(r.width()/2, r.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
291 DSurfaceFill(s, Rect(0,0,r.width()/2,r.height()), 0, 0, 0, 0xff);
223b71206888 Initial import
thib
parents:
diff changeset
292 Pic()->SetSurface(s, -r.width()/4, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
293 Pic()->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
294 } else {
223b71206888 Initial import
thib
parents:
diff changeset
295 // Ìð°õ¤ËɬÍפÊÎΰè³ÎÊÝ
223b71206888 Initial import
thib
parents:
diff changeset
296 int arrow_height = r_orig.height();
223b71206888 Initial import
thib
parents:
diff changeset
297 button1 = create_button(0, arrow_width, arrow_height, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
298 button2 = create_button(1, arrow_width, arrow_height, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
299 if (r_orig.width() < arrow_width*4) {
223b71206888 Initial import
thib
parents:
diff changeset
300 if (r_orig.width() < 8) r_orig.rx = r_orig.lx + 8; // ¾®¤µ¤¹¤®¤ë¾ì¹ç¤Ï¶¯À©Êѹ¹
223b71206888 Initial import
thib
parents:
diff changeset
301 free( (void*)button1);
223b71206888 Initial import
thib
parents:
diff changeset
302 free( (void*)button2);
223b71206888 Initial import
thib
parents:
diff changeset
303 arrow_width = r_orig.width()/4;
223b71206888 Initial import
thib
parents:
diff changeset
304 // ºÆ³ä¤êÅö¤Æ
223b71206888 Initial import
thib
parents:
diff changeset
305 button1 = create_button(2, arrow_width, arrow_height, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
306 button2 = create_button(3, arrow_width, arrow_height, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
307 }
223b71206888 Initial import
thib
parents:
diff changeset
308 // Ìð°õ¥Ü¥¿¥ó¤ÎºîÀ®
223b71206888 Initial import
thib
parents:
diff changeset
309 Surface* a1s = parent->Root().NewSurfaceFromRGBAData(arrow_width, arrow_height*3, button1, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
310 int x = r_orig.lx; int y = r_orig.ty;
223b71206888 Initial import
thib
parents:
diff changeset
311 arrow_up = new Button(container, parent, a1s, 0, 0, 0, arrow_height, 3, Rect(x,y,x+arrow_width,y+arrow_height),1);
223b71206888 Initial import
thib
parents:
diff changeset
312 arrow_up->Pic()->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
313 Surface* a2s = parent->Root().NewSurfaceFromRGBAData(arrow_width, arrow_height*3, button2, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
314 x = r_orig.rx - arrow_width; y = r_orig.by - arrow_height;
223b71206888 Initial import
thib
parents:
diff changeset
315 arrow_down = new Button(container, parent, a2s, 0, 0, 0, arrow_height, 3, Rect(x,y,x+arrow_width,y+arrow_height),1);
223b71206888 Initial import
thib
parents:
diff changeset
316 arrow_down->Pic()->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
317 // pictureºîÀ®¡Ê¥Ü¥¿¥ó¤ÎÆ°¤¯Îΰè¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
318 Rect r = r_orig;
223b71206888 Initial import
thib
parents:
diff changeset
319 r.lx += arrow_width;
223b71206888 Initial import
thib
parents:
diff changeset
320 r.rx -= arrow_width;
223b71206888 Initial import
thib
parents:
diff changeset
321 panel = parent->create_node(r, 0);
223b71206888 Initial import
thib
parents:
diff changeset
322 SetPic(panel);
223b71206888 Initial import
thib
parents:
diff changeset
323 // ¥Ü¥¿¥ó¤ÎÃæ¿´Àþ¤òÉÁ²è¡¢ÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
324 Surface* s = parent->Root().NewSurface(r.width(), r.height()/2, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
325 DSurfaceFill(s, Rect(0,0,r.width(),r.height()/2), 0, 0, 0, 0xff);
223b71206888 Initial import
thib
parents:
diff changeset
326 Pic()->SetSurface(s, 0, -r.height()/4, 0);
223b71206888 Initial import
thib
parents:
diff changeset
327 Pic()->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
328 }
223b71206888 Initial import
thib
parents:
diff changeset
329 arrow_up->press_func = &Scale::PressArrowUp;
223b71206888 Initial import
thib
parents:
diff changeset
330 arrow_up->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
331 arrow_down->press_func = &Scale::PressArrowDown;
223b71206888 Initial import
thib
parents:
diff changeset
332 arrow_down->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
333 arrow_up->show();
223b71206888 Initial import
thib
parents:
diff changeset
334 arrow_down->show();
223b71206888 Initial import
thib
parents:
diff changeset
335 panel->show();
223b71206888 Initial import
thib
parents:
diff changeset
336 InitCursor(0);
223b71206888 Initial import
thib
parents:
diff changeset
337 }
223b71206888 Initial import
thib
parents:
diff changeset
338
223b71206888 Initial import
thib
parents:
diff changeset
339 void Scale::InitCursor(int width_ratio) {
223b71206888 Initial import
thib
parents:
diff changeset
340 int r=cursor_color.r, g=cursor_color.g, b=cursor_color.b;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
341 if (cursor != NULL) delete cursor;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
342 cursor = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
343 Rect region(0,0);
223b71206888 Initial import
thib
parents:
diff changeset
344 if (width_ratio < 0) width_ratio = 0;
223b71206888 Initial import
thib
parents:
diff changeset
345 else if (width_ratio > 1024) width_ratio = 1024;
223b71206888 Initial import
thib
parents:
diff changeset
346 if (is_vertical) {
223b71206888 Initial import
thib
parents:
diff changeset
347 if (width_ratio == 0) cursor_width = Pic()->Width() * 3 / 2; // Éý¤Î1.5ÇÜ
223b71206888 Initial import
thib
parents:
diff changeset
348 else cursor_width = Pic()->Height()*width_ratio/1024;
223b71206888 Initial import
thib
parents:
diff changeset
349 if (cursor_width <= 0) return; // ¥«¡¼¥½¥ë¤Ê¤·¡Ê¤¤¤¤¤Î¤«¡©¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
350 region = Rect(0, 0, Pic()->Width(), cursor_width);
223b71206888 Initial import
thib
parents:
diff changeset
351 } else { // horizontal
223b71206888 Initial import
thib
parents:
diff changeset
352 if (width_ratio == 0) cursor_width = Pic()->Height() * 3 / 2; // ¹â¤µ¤Î1.5ÇÜ
223b71206888 Initial import
thib
parents:
diff changeset
353 else cursor_width = Pic()->Width()*width_ratio/1024;
223b71206888 Initial import
thib
parents:
diff changeset
354 if (cursor_width <= 0) return; // ¥«¡¼¥½¥ë¤Ê¤·¡Ê¤¤¤¤¤Î¤«¡©¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
355 region = Rect(0, 0, cursor_width, Pic()->Height());
223b71206888 Initial import
thib
parents:
diff changeset
356 }
223b71206888 Initial import
thib
parents:
diff changeset
357
223b71206888 Initial import
thib
parents:
diff changeset
358 int height = region.height();
223b71206888 Initial import
thib
parents:
diff changeset
359 int width = region.width();
223b71206888 Initial import
thib
parents:
diff changeset
360 char* box = create_box(width, height, r, g, b);
223b71206888 Initial import
thib
parents:
diff changeset
361 Surface* boxs = parent->Root().NewSurfaceFromRGBAData(width, height*3, box, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
362 cursor = new Button(container, panel, boxs, 0, 0, 0, height, 3, region, 2);
223b71206888 Initial import
thib
parents:
diff changeset
363 cursor->Pic()->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
364
223b71206888 Initial import
thib
parents:
diff changeset
365 cursor->press_func = &Scale::PressCursor;
223b71206888 Initial import
thib
parents:
diff changeset
366 cursor->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
367 cursor->drag_func = &Scale::DragCursor;
223b71206888 Initial import
thib
parents:
diff changeset
368 cursor->drag_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
369 cursor->show();
223b71206888 Initial import
thib
parents:
diff changeset
370
223b71206888 Initial import
thib
parents:
diff changeset
371 // Ìð°õÅù¤ò¥¯¥ê¥Ã¥¯¤·¤¿¤È¤­¤Î°ÜÆ°ÎÌ·×»»
223b71206888 Initial import
thib
parents:
diff changeset
372 int bar_width;
223b71206888 Initial import
thib
parents:
diff changeset
373 if (is_vertical) bar_width = Pic()->Height();
223b71206888 Initial import
thib
parents:
diff changeset
374 else bar_width = Pic()->Width();
223b71206888 Initial import
thib
parents:
diff changeset
375 if (bar_width <= 0) value_add = max-min;
223b71206888 Initial import
thib
parents:
diff changeset
376 else if (cursor_width == 0) value_add = 2;
223b71206888 Initial import
thib
parents:
diff changeset
377 else value_add = scale_max*cursor_width/bar_width;
223b71206888 Initial import
thib
parents:
diff changeset
378 }
223b71206888 Initial import
thib
parents:
diff changeset
379
223b71206888 Initial import
thib
parents:
diff changeset
380 void Scale::PressArrowDown(void* pointer, Button* from) {
223b71206888 Initial import
thib
parents:
diff changeset
381 Scale* self = (Scale*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
382 self->SetScaleValue(self->value + self->value_add);
223b71206888 Initial import
thib
parents:
diff changeset
383 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
384
0
223b71206888 Initial import
thib
parents:
diff changeset
385 void Scale::PressArrowUp(void* pointer, Button* from){
223b71206888 Initial import
thib
parents:
diff changeset
386 Scale* self = (Scale*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
387 self->SetScaleValue(self->value - self->value_add);
223b71206888 Initial import
thib
parents:
diff changeset
388 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
389
0
223b71206888 Initial import
thib
parents:
diff changeset
390 void Scale::PressCursor(void* pointer, Button* from){
223b71206888 Initial import
thib
parents:
diff changeset
391 Scale* self = (Scale*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
392 self->value_dragstart = self->value;
223b71206888 Initial import
thib
parents:
diff changeset
393 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
394
0
223b71206888 Initial import
thib
parents:
diff changeset
395 void Scale::DragCursor(int x_from, int y_from,int x, int y, void* pointer, Button* from){
223b71206888 Initial import
thib
parents:
diff changeset
396 Scale* self = (Scale*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
397 int dx, w;
223b71206888 Initial import
thib
parents:
diff changeset
398 if (self->is_vertical) {
223b71206888 Initial import
thib
parents:
diff changeset
399 dx = y-y_from;
223b71206888 Initial import
thib
parents:
diff changeset
400 w = self->Event::Video::Region().height();
223b71206888 Initial import
thib
parents:
diff changeset
401 } else {
223b71206888 Initial import
thib
parents:
diff changeset
402 dx = x-x_from;
223b71206888 Initial import
thib
parents:
diff changeset
403 w = self->Event::Video::Region().width();
223b71206888 Initial import
thib
parents:
diff changeset
404 }
223b71206888 Initial import
thib
parents:
diff changeset
405 if (w == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
406 self->SetScaleValue(self->value_dragstart + dx*scale_max/w);
223b71206888 Initial import
thib
parents:
diff changeset
407 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
408
0
223b71206888 Initial import
thib
parents:
diff changeset
409 int Scale::CalcValue(void) {
223b71206888 Initial import
thib
parents:
diff changeset
410 Rect own_region = Event::Video::Region();
223b71206888 Initial import
thib
parents:
diff changeset
411 int x, w;
223b71206888 Initial import
thib
parents:
diff changeset
412 if (is_vertical) {
223b71206888 Initial import
thib
parents:
diff changeset
413 w = own_region.height();
223b71206888 Initial import
thib
parents:
diff changeset
414 x = mouse_y - own_region.ty;
223b71206888 Initial import
thib
parents:
diff changeset
415 } else {
223b71206888 Initial import
thib
parents:
diff changeset
416 w = own_region.width();
223b71206888 Initial import
thib
parents:
diff changeset
417 x = mouse_x - own_region.lx;
223b71206888 Initial import
thib
parents:
diff changeset
418 }
223b71206888 Initial import
thib
parents:
diff changeset
419 if (w == 0) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
420 if (x < 0) x = 0;
223b71206888 Initial import
thib
parents:
diff changeset
421 else if (x > w) x = w;
223b71206888 Initial import
thib
parents:
diff changeset
422 return x*scale_max/w;
223b71206888 Initial import
thib
parents:
diff changeset
423 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
424
0
223b71206888 Initial import
thib
parents:
diff changeset
425 void Scale::Press(void){
223b71206888 Initial import
thib
parents:
diff changeset
426 int v = CalcValue();
223b71206888 Initial import
thib
parents:
diff changeset
427 if (v < value) SetScaleValue(value-value_add);
223b71206888 Initial import
thib
parents:
diff changeset
428 else SetScaleValue(value+value_add);
223b71206888 Initial import
thib
parents:
diff changeset
429 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
430
0
223b71206888 Initial import
thib
parents:
diff changeset
431 void Scale::Motion(int x, int y){
223b71206888 Initial import
thib
parents:
diff changeset
432 mouse_x = x;
223b71206888 Initial import
thib
parents:
diff changeset
433 mouse_y = y;
223b71206888 Initial import
thib
parents:
diff changeset
434 }
223b71206888 Initial import
thib
parents:
diff changeset
435
223b71206888 Initial import
thib
parents:
diff changeset
436 void Scale::SetRange(int new_min, int new_max) {
223b71206888 Initial import
thib
parents:
diff changeset
437 min = new_min;
223b71206888 Initial import
thib
parents:
diff changeset
438 max = new_max;
223b71206888 Initial import
thib
parents:
diff changeset
439 SetValue(value);
223b71206888 Initial import
thib
parents:
diff changeset
440 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
441
0
223b71206888 Initial import
thib
parents:
diff changeset
442 void Scale::SetValue(int new_value) {
223b71206888 Initial import
thib
parents:
diff changeset
443 if (min == max) {
223b71206888 Initial import
thib
parents:
diff changeset
444 value = min;
223b71206888 Initial import
thib
parents:
diff changeset
445 SetScaleValue(0);
223b71206888 Initial import
thib
parents:
diff changeset
446 return;
223b71206888 Initial import
thib
parents:
diff changeset
447 }
223b71206888 Initial import
thib
parents:
diff changeset
448 int scale_value = (new_value-min) * scale_max / (max-min);
223b71206888 Initial import
thib
parents:
diff changeset
449 SetScaleValue(scale_value);
223b71206888 Initial import
thib
parents:
diff changeset
450 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
451
0
223b71206888 Initial import
thib
parents:
diff changeset
452 int Scale::GetValue(void) const{
223b71206888 Initial import
thib
parents:
diff changeset
453 return min + value * (max-min) / scale_max;
223b71206888 Initial import
thib
parents:
diff changeset
454 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
455
0
223b71206888 Initial import
thib
parents:
diff changeset
456 void Scale::SetScaleValue(int new_value) {
223b71206888 Initial import
thib
parents:
diff changeset
457 if (new_value < 0) value = 0;
223b71206888 Initial import
thib
parents:
diff changeset
458 else if (new_value > scale_max) value = scale_max;
223b71206888 Initial import
thib
parents:
diff changeset
459 else value = new_value;
223b71206888 Initial import
thib
parents:
diff changeset
460 if (is_vertical) {
223b71206888 Initial import
thib
parents:
diff changeset
461 int h = Pic()->Height();
223b71206888 Initial import
thib
parents:
diff changeset
462 int y = (h-cursor_width) * value / scale_max;
223b71206888 Initial import
thib
parents:
diff changeset
463 if (y < 0) y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
464 cursor->Pic()->Move(0, y);
223b71206888 Initial import
thib
parents:
diff changeset
465 } else { // horizontal
223b71206888 Initial import
thib
parents:
diff changeset
466 int w = Pic()->Width();
223b71206888 Initial import
thib
parents:
diff changeset
467 int x = (w-cursor_width) * value / scale_max;
223b71206888 Initial import
thib
parents:
diff changeset
468 if (x < 0) x = 0;
223b71206888 Initial import
thib
parents:
diff changeset
469 cursor->Pic()->Move(x, 0);
223b71206888 Initial import
thib
parents:
diff changeset
470 }
223b71206888 Initial import
thib
parents:
diff changeset
471 if (change_func) {
223b71206888 Initial import
thib
parents:
diff changeset
472 (*change_func)(change_pointer, this);
223b71206888 Initial import
thib
parents:
diff changeset
473 }
223b71206888 Initial import
thib
parents:
diff changeset
474 }
223b71206888 Initial import
thib
parents:
diff changeset
475
223b71206888 Initial import
thib
parents:
diff changeset
476 TextButton::TextButton(Event::Container& container, PicContainer* parent, const char* text, int _text_size, Attribute attr, const Rect& r_orig, int _z, const Color& _fore, const Color& _pressed, const Color& _back) :
223b71206888 Initial import
thib
parents:
diff changeset
477 Button(container, parent, (Surface*)0, 0, 0, 0, 0, 0, r_orig, _z),
223b71206888 Initial import
thib
parents:
diff changeset
478 root(parent->Root()), surface(0), attribute(attr), text_size(_text_size),
223b71206888 Initial import
thib
parents:
diff changeset
479 fore(_fore), pressed(_pressed), back(_back)
223b71206888 Initial import
thib
parents:
diff changeset
480 {
223b71206888 Initial import
thib
parents:
diff changeset
481 bool rect_changed = false;
223b71206888 Initial import
thib
parents:
diff changeset
482 // ¤Þ¤º¡¢¥Æ¥­¥¹¥ÈÎΰè¤Î¹­¤µ¤òÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
483 Rect r(r_orig);
223b71206888 Initial import
thib
parents:
diff changeset
484
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
485 if (text == NULL) text = "";
0
223b71206888 Initial import
thib
parents:
diff changeset
486 int width = r.width(); int height = r.height();
223b71206888 Initial import
thib
parents:
diff changeset
487 if (width == 0) width = parent->Width() - r.lx;
223b71206888 Initial import
thib
parents:
diff changeset
488
223b71206888 Initial import
thib
parents:
diff changeset
489 TextGlyphStream gs = DefaultLayout(text_size)->Layout(text, width);
223b71206888 Initial import
thib
parents:
diff changeset
490
223b71206888 Initial import
thib
parents:
diff changeset
491 if (r.width() == 0) { // ʸ»ú¤Ë¹ç¤ï¤»¤Æ¥¦¥£¥¸¥Ã¥ÈºîÀ®
223b71206888 Initial import
thib
parents:
diff changeset
492 rect_changed = true;
223b71206888 Initial import
thib
parents:
diff changeset
493 width = gs.width() + text_size;
223b71206888 Initial import
thib
parents:
diff changeset
494 r.rx = r.lx + gs.width();
223b71206888 Initial import
thib
parents:
diff changeset
495 attribute = Attribute(attribute | CENTER);
223b71206888 Initial import
thib
parents:
diff changeset
496 }
223b71206888 Initial import
thib
parents:
diff changeset
497 if (r.height() == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
498 rect_changed = true;
223b71206888 Initial import
thib
parents:
diff changeset
499 if (attribute & NOPADDING) r.by = r.ty + gs.height();
223b71206888 Initial import
thib
parents:
diff changeset
500 else r.by = r.ty + gs.height() + text_size/2;
223b71206888 Initial import
thib
parents:
diff changeset
501 }
223b71206888 Initial import
thib
parents:
diff changeset
502
223b71206888 Initial import
thib
parents:
diff changeset
503 if (rect_changed) {
223b71206888 Initial import
thib
parents:
diff changeset
504 // Â礭¤µÊѹ¹
223b71206888 Initial import
thib
parents:
diff changeset
505 Pic()->SetSurfaceRect(r);
223b71206888 Initial import
thib
parents:
diff changeset
506 }
223b71206888 Initial import
thib
parents:
diff changeset
507
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
508 sx = 0; sy = 0; sdx = 0;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
509 sdy = r.height();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
510 nptn = 3;
0
223b71206888 Initial import
thib
parents:
diff changeset
511 int x = 0, y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
512 if (attribute & CENTER)
223b71206888 Initial import
thib
parents:
diff changeset
513 x = (Pic()->Width() - gs.width()) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
514 y = (Pic()->Height() - gs.height()) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
515
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
516 //FIXME: (back.a == NULL ?)
0
223b71206888 Initial import
thib
parents:
diff changeset
517 if (back.a == 0) { // Çطʤʤ·¡¢¤â¤·¤¯¤Ï¥Ü¥¿¥ó²¡¤Î¾õÂ֤ΤßÇطʤ¢¤ê
223b71206888 Initial import
thib
parents:
diff changeset
518 surface = root.NewSurface(r.width(), r.height()*2, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
519 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
520 if (attribute & REVERSE) {
223b71206888 Initial import
thib
parents:
diff changeset
521 DSurfaceFill(surface, Rect(0,r.height(),r.width(),r.height()*2), pressed.r, pressed.g, pressed.b, 0xff);
223b71206888 Initial import
thib
parents:
diff changeset
522 }
223b71206888 Initial import
thib
parents:
diff changeset
523 gs.SetColor(fore.r, fore.g, fore.b);
223b71206888 Initial import
thib
parents:
diff changeset
524 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
525 gs.SetColor(pressed.r, pressed.g, pressed.b);
223b71206888 Initial import
thib
parents:
diff changeset
526 if (attribute & REVERSE) {
223b71206888 Initial import
thib
parents:
diff changeset
527 gs.SetReverse(true);
223b71206888 Initial import
thib
parents:
diff changeset
528 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), surface, Rect(x,y+r.height()));
223b71206888 Initial import
thib
parents:
diff changeset
529 gs.SetReverse(false);
223b71206888 Initial import
thib
parents:
diff changeset
530 } else {
223b71206888 Initial import
thib
parents:
diff changeset
531 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), surface, Rect(x,y+r.height()));
223b71206888 Initial import
thib
parents:
diff changeset
532 }
223b71206888 Initial import
thib
parents:
diff changeset
533 nptn = 2;
223b71206888 Initial import
thib
parents:
diff changeset
534 } else { // ¥Ü¥¿¥ó·¿¤ÎÇطʤ¢¤ê
223b71206888 Initial import
thib
parents:
diff changeset
535 /* ¥é¥Ù¥ëÍѤΠSurface ¤òºî¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
536 width = r.width(); height = r.height();
223b71206888 Initial import
thib
parents:
diff changeset
537 char* box = create_box(width, height, back.r, back.g, back.b);
223b71206888 Initial import
thib
parents:
diff changeset
538 surface = root.NewSurfaceFromRGBAData(r.width(), r.height()*3, box, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
539
223b71206888 Initial import
thib
parents:
diff changeset
540 Surface* text_surface = root.NewSurface(r.width(), r.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
541 DSurfaceFill(text_surface, Rect(*text_surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
542
223b71206888 Initial import
thib
parents:
diff changeset
543 gs.SetColor(fore.r, fore.g, fore.b);
223b71206888 Initial import
thib
parents:
diff changeset
544 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), text_surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
545 root.BlitSurface(text_surface, Rect(0,0,width,height), surface, Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
546 gs.SetColor(pressed.r, pressed.g, pressed.b);
223b71206888 Initial import
thib
parents:
diff changeset
547 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), text_surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
548 root.BlitSurface(text_surface, Rect(0,0,width,height), surface, Rect(0,height));
223b71206888 Initial import
thib
parents:
diff changeset
549 root.BlitSurface(text_surface, Rect(0,0,width,height), surface, Rect(0,height*2));
223b71206888 Initial import
thib
parents:
diff changeset
550 root.DeleteSurface(text_surface);
223b71206888 Initial import
thib
parents:
diff changeset
551 }
223b71206888 Initial import
thib
parents:
diff changeset
552
223b71206888 Initial import
thib
parents:
diff changeset
553 Pic()->SetSurface(surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
554 show();
223b71206888 Initial import
thib
parents:
diff changeset
555 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
556
0
223b71206888 Initial import
thib
parents:
diff changeset
557 void TextButton::SetText(const char* text, const Color& _fore, const Color& _pressed, const Color& _back)
223b71206888 Initial import
thib
parents:
diff changeset
558 {
223b71206888 Initial import
thib
parents:
diff changeset
559 int width = Pic()->Width(); int height = Pic()->Height();
223b71206888 Initial import
thib
parents:
diff changeset
560 // ¤Þ¤º¡¢¥Æ¥­¥¹¥ÈÎΰè¤Î¹­¤µ¤òÆÀ¤ë
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
561 if (text == NULL) text = "";
0
223b71206888 Initial import
thib
parents:
diff changeset
562
223b71206888 Initial import
thib
parents:
diff changeset
563 TextGlyphStream gs = DefaultLayout(text_size)->Layout(text, width);
223b71206888 Initial import
thib
parents:
diff changeset
564
223b71206888 Initial import
thib
parents:
diff changeset
565 int x = 0, y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
566 if (attribute & CENTER) {
223b71206888 Initial import
thib
parents:
diff changeset
567 x = (width - gs.width()) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
568 y = (height - gs.height()) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
569 }
223b71206888 Initial import
thib
parents:
diff changeset
570 int surf_x = Pic()->SurfacePosX();
223b71206888 Initial import
thib
parents:
diff changeset
571 int surf_y = Pic()->SurfacePosY();
223b71206888 Initial import
thib
parents:
diff changeset
572 Pic()->SetSurface( (Surface*)0,0,0);
223b71206888 Initial import
thib
parents:
diff changeset
573 root.DeleteSurface(surface);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
574 surface = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
575
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
576 //FIXME: (back.a == NULL) ?
0
223b71206888 Initial import
thib
parents:
diff changeset
577 if (back.a == 0) { // Çطʤʤ·
223b71206888 Initial import
thib
parents:
diff changeset
578 surface = root.NewSurface(width, height*2, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
579 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
580 if (attribute & REVERSE) {
223b71206888 Initial import
thib
parents:
diff changeset
581 DSurfaceFill(surface, Rect(0,height,width,height*2), pressed.r, pressed.g, pressed.b, 0xff);
223b71206888 Initial import
thib
parents:
diff changeset
582 }
223b71206888 Initial import
thib
parents:
diff changeset
583 gs.SetColor(_fore.r, _fore.g, _fore.b);
223b71206888 Initial import
thib
parents:
diff changeset
584 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
585 gs.SetColor(_pressed.r, _pressed.g, _pressed.b);
223b71206888 Initial import
thib
parents:
diff changeset
586 gs.SetReverse(true);
223b71206888 Initial import
thib
parents:
diff changeset
587 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), surface, Rect(x,y+height));
223b71206888 Initial import
thib
parents:
diff changeset
588 gs.SetReverse(false);
223b71206888 Initial import
thib
parents:
diff changeset
589 nptn = 2;
223b71206888 Initial import
thib
parents:
diff changeset
590 } else {
223b71206888 Initial import
thib
parents:
diff changeset
591 /* ¥é¥Ù¥ëÍѤΠSurface ¤òºî¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
592 char* box = create_box(width, height, _back.r, _back.g, _back.b);
223b71206888 Initial import
thib
parents:
diff changeset
593 surface = root.NewSurfaceFromRGBAData(width, height*3, box, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
594
223b71206888 Initial import
thib
parents:
diff changeset
595 Surface* text_surface = root.NewSurface(width, height, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
596 DSurfaceFill(text_surface, Rect(*text_surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
597
223b71206888 Initial import
thib
parents:
diff changeset
598 gs.SetColor(_fore.r, _fore.g, _fore.b);
223b71206888 Initial import
thib
parents:
diff changeset
599 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), text_surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
600 root.BlitSurface(text_surface, Rect(0,0,width,height), surface, Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
601 gs.SetColor(_pressed.r, _pressed.g, _pressed.b);
223b71206888 Initial import
thib
parents:
diff changeset
602 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0,0,gs.width(),gs.height()), text_surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
603 root.BlitSurface(text_surface, Rect(0,0,width,height), surface, Rect(0,height));
223b71206888 Initial import
thib
parents:
diff changeset
604 root.BlitSurface(text_surface, Rect(0,0,width,height), surface, Rect(0,height*2));
223b71206888 Initial import
thib
parents:
diff changeset
605 root.DeleteSurface(text_surface);
223b71206888 Initial import
thib
parents:
diff changeset
606 }
223b71206888 Initial import
thib
parents:
diff changeset
607
223b71206888 Initial import
thib
parents:
diff changeset
608 Pic()->SetSurface(surface, surf_x, surf_y);
223b71206888 Initial import
thib
parents:
diff changeset
609 show();
223b71206888 Initial import
thib
parents:
diff changeset
610 }
223b71206888 Initial import
thib
parents:
diff changeset
611
223b71206888 Initial import
thib
parents:
diff changeset
612 TextButton::~TextButton() {
223b71206888 Initial import
thib
parents:
diff changeset
613 if (surface) root.DeleteSurface(surface);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
614 surface = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
615 }
223b71206888 Initial import
thib
parents:
diff changeset
616
223b71206888 Initial import
thib
parents:
diff changeset
617 Text::Text(Event::Container& container, PicContainer* parent, const Rect& r, const Rect& text_r, int _fontsize) :
223b71206888 Initial import
thib
parents:
diff changeset
618 Event::Video(container),
223b71206888 Initial import
thib
parents:
diff changeset
619 Event::Time(container),
223b71206888 Initial import
thib
parents:
diff changeset
620 event(container),
223b71206888 Initial import
thib
parents:
diff changeset
621 srcrect(0,0,0,0),
223b71206888 Initial import
thib
parents:
diff changeset
622 layout(wdefault_font.c_str(), _fontsize), fontsize(_fontsize) {
223b71206888 Initial import
thib
parents:
diff changeset
623
223b71206888 Initial import
thib
parents:
diff changeset
624 SetPic(parent->create_node(r, 0));
223b71206888 Initial import
thib
parents:
diff changeset
625 surface = parent->Root().NewSurface(text_r.width(), text_r.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
626 pictext = PicNode()->create_leaf(text_r, PicBase::CACHE_BACK);
223b71206888 Initial import
thib
parents:
diff changeset
627 pictext->SetSurface(surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
628 pictext->show();
223b71206888 Initial import
thib
parents:
diff changeset
629 cursor = 0;
223b71206888 Initial import
thib
parents:
diff changeset
630 cursor_activated = false;
223b71206888 Initial import
thib
parents:
diff changeset
631 window_activated = false;
223b71206888 Initial import
thib
parents:
diff changeset
632
223b71206888 Initial import
thib
parents:
diff changeset
633 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
634
223b71206888 Initial import
thib
parents:
diff changeset
635 speed = 10;
223b71206888 Initial import
thib
parents:
diff changeset
636 wait_delay = -1;
223b71206888 Initial import
thib
parents:
diff changeset
637 status = PREPARE;
223b71206888 Initial import
thib
parents:
diff changeset
638 old_time = wait_starttime = 0;
223b71206888 Initial import
thib
parents:
diff changeset
639 }
223b71206888 Initial import
thib
parents:
diff changeset
640
223b71206888 Initial import
thib
parents:
diff changeset
641 Text::~Text() {
223b71206888 Initial import
thib
parents:
diff changeset
642 event.DeleteGlobalPressFunc(&Pressed, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
643 PicNode()->Root().DeleteSurface(surface);
223b71206888 Initial import
thib
parents:
diff changeset
644 }
223b71206888 Initial import
thib
parents:
diff changeset
645
223b71206888 Initial import
thib
parents:
diff changeset
646 void Text::SetSpeed(int new_speed) {
223b71206888 Initial import
thib
parents:
diff changeset
647 speed = new_speed;
223b71206888 Initial import
thib
parents:
diff changeset
648 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
649
0
223b71206888 Initial import
thib
parents:
diff changeset
650 void Text::SetWait(int new_wait) {
223b71206888 Initial import
thib
parents:
diff changeset
651 if (new_wait < 0) new_wait = 100000000;
223b71206888 Initial import
thib
parents:
diff changeset
652 wait_delay = new_wait;
223b71206888 Initial import
thib
parents:
diff changeset
653 }
223b71206888 Initial import
thib
parents:
diff changeset
654
223b71206888 Initial import
thib
parents:
diff changeset
655 int Text::CalcScrollHeight(void) {
223b71206888 Initial import
thib
parents:
diff changeset
656 int i;
223b71206888 Initial import
thib
parents:
diff changeset
657 int len = bottom_pos.size();
223b71206888 Initial import
thib
parents:
diff changeset
658 int y0 = bottom_pos[line_number];
223b71206888 Initial import
thib
parents:
diff changeset
659 int height = Rect(*surface).height();
223b71206888 Initial import
thib
parents:
diff changeset
660 for (i=line_number; i<len; i++)
223b71206888 Initial import
thib
parents:
diff changeset
661 if (bottom_pos[i] - y0 > height) break;
223b71206888 Initial import
thib
parents:
diff changeset
662 if (i == line_number) i = line_number + 1;
223b71206888 Initial import
thib
parents:
diff changeset
663 return i - line_number - 1;
223b71206888 Initial import
thib
parents:
diff changeset
664 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
665
0
223b71206888 Initial import
thib
parents:
diff changeset
666 void Text::Elapsed(unsigned int current_time) {
223b71206888 Initial import
thib
parents:
diff changeset
667 SetWakeup(current_time + 50);
223b71206888 Initial import
thib
parents:
diff changeset
668 if (status == PREPARE) {
223b71206888 Initial import
thib
parents:
diff changeset
669 old_time = current_time;
223b71206888 Initial import
thib
parents:
diff changeset
670 return;
223b71206888 Initial import
thib
parents:
diff changeset
671 }
223b71206888 Initial import
thib
parents:
diff changeset
672 int nChar = speed * (current_time - old_time) / 1000;
223b71206888 Initial import
thib
parents:
diff changeset
673 if (speed == -1 || press_count) nChar = -1;
223b71206888 Initial import
thib
parents:
diff changeset
674 if (nChar == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
675 if (speed == -1) old_time = current_time;
223b71206888 Initial import
thib
parents:
diff changeset
676 else old_time += nChar * 1000 / speed;
223b71206888 Initial import
thib
parents:
diff changeset
677
223b71206888 Initial import
thib
parents:
diff changeset
678 switch(status) {
223b71206888 Initial import
thib
parents:
diff changeset
679 case WAIT: goto label_wait;
223b71206888 Initial import
thib
parents:
diff changeset
680 case SCROLL: goto label_scroll;
223b71206888 Initial import
thib
parents:
diff changeset
681 case DRAW2: goto label_draw2;
223b71206888 Initial import
thib
parents:
diff changeset
682 case WAIT2: goto label_wait2;
223b71206888 Initial import
thib
parents:
diff changeset
683 }
223b71206888 Initial import
thib
parents:
diff changeset
684
223b71206888 Initial import
thib
parents:
diff changeset
685 status = DRAW;
223b71206888 Initial import
thib
parents:
diff changeset
686 if (press_count) {
223b71206888 Initial import
thib
parents:
diff changeset
687 nChar = -1;
223b71206888 Initial import
thib
parents:
diff changeset
688 press_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
689 }
223b71206888 Initial import
thib
parents:
diff changeset
690 DrawText(nChar);
223b71206888 Initial import
thib
parents:
diff changeset
691 if (nChar == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
692 status = WAIT;
223b71206888 Initial import
thib
parents:
diff changeset
693 cursor_activated = true;
223b71206888 Initial import
thib
parents:
diff changeset
694 if (cursor_activated && window_activated && cursor) cursor->show();
223b71206888 Initial import
thib
parents:
diff changeset
695 wait_starttime = current_time;
223b71206888 Initial import
thib
parents:
diff changeset
696 label_wait:
223b71206888 Initial import
thib
parents:
diff changeset
697 if (current_time < wait_starttime + wait_delay && press_count == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
698 press_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
699 nChar = 0;
223b71206888 Initial import
thib
parents:
diff changeset
700 cursor_activated = false;
223b71206888 Initial import
thib
parents:
diff changeset
701 if (cursor) cursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
702 while(cur_pos != gstream.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
703 // ¥¹¥¯¥í¡¼¥ë¤·¤Æ¤Ï¼¡¹ÔÉÁ²è¡¢¤ò·«¤êÊÖ¤¹
223b71206888 Initial import
thib
parents:
diff changeset
704 for (scroll_height = CalcScrollHeight(); scroll_height > 0; scroll_height--) {
223b71206888 Initial import
thib
parents:
diff changeset
705 status = SCROLL;
223b71206888 Initial import
thib
parents:
diff changeset
706 label_scroll:
223b71206888 Initial import
thib
parents:
diff changeset
707 if (press_count) break;
223b71206888 Initial import
thib
parents:
diff changeset
708 Scrollup(nChar);
223b71206888 Initial import
thib
parents:
diff changeset
709 if (nChar == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
710 status = DRAW2;
223b71206888 Initial import
thib
parents:
diff changeset
711 label_draw2:
223b71206888 Initial import
thib
parents:
diff changeset
712 if (press_count) break;
223b71206888 Initial import
thib
parents:
diff changeset
713 DrawText(nChar);
223b71206888 Initial import
thib
parents:
diff changeset
714 if (nChar == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
715 }
223b71206888 Initial import
thib
parents:
diff changeset
716 if (nChar != 0 && scroll_height) {
223b71206888 Initial import
thib
parents:
diff changeset
717 nChar = 100000;
223b71206888 Initial import
thib
parents:
diff changeset
718 if (status == SCROLL) Scrollup(nChar);
223b71206888 Initial import
thib
parents:
diff changeset
719 DrawText(nChar);
223b71206888 Initial import
thib
parents:
diff changeset
720 scroll_height--;
223b71206888 Initial import
thib
parents:
diff changeset
721 for (; scroll_height > 0; scroll_height--) {
223b71206888 Initial import
thib
parents:
diff changeset
722 Scrollup(nChar);
223b71206888 Initial import
thib
parents:
diff changeset
723 DrawText(nChar);
223b71206888 Initial import
thib
parents:
diff changeset
724 }
223b71206888 Initial import
thib
parents:
diff changeset
725 }
223b71206888 Initial import
thib
parents:
diff changeset
726 press_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
727 status = WAIT2;
223b71206888 Initial import
thib
parents:
diff changeset
728 cursor_activated = true;
223b71206888 Initial import
thib
parents:
diff changeset
729 if (cursor_activated && window_activated && cursor) cursor->show();
223b71206888 Initial import
thib
parents:
diff changeset
730 wait_starttime = current_time;
223b71206888 Initial import
thib
parents:
diff changeset
731 label_wait2:
223b71206888 Initial import
thib
parents:
diff changeset
732 if (current_time < wait_starttime + wait_delay && press_count == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
733 press_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
734 nChar = 0;
223b71206888 Initial import
thib
parents:
diff changeset
735 cursor_activated = false;
223b71206888 Initial import
thib
parents:
diff changeset
736 if (cursor) cursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
737 }
223b71206888 Initial import
thib
parents:
diff changeset
738 status = PREPARE;
223b71206888 Initial import
thib
parents:
diff changeset
739 }
223b71206888 Initial import
thib
parents:
diff changeset
740
223b71206888 Initial import
thib
parents:
diff changeset
741 bool Text::Pressed(int x, int y, void* pointer) {
223b71206888 Initial import
thib
parents:
diff changeset
742 Text* wid = (Text*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
743 if (wid->Pic()->IsHidden()) return true;
223b71206888 Initial import
thib
parents:
diff changeset
744 wid->press_count++;
223b71206888 Initial import
thib
parents:
diff changeset
745 return true;
223b71206888 Initial import
thib
parents:
diff changeset
746 }
223b71206888 Initial import
thib
parents:
diff changeset
747
223b71206888 Initial import
thib
parents:
diff changeset
748 void Text::Clear(void) {
223b71206888 Initial import
thib
parents:
diff changeset
749 stream.container.clear();
223b71206888 Initial import
thib
parents:
diff changeset
750 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
751 pictext->ReBlit();
223b71206888 Initial import
thib
parents:
diff changeset
752 status = PREPARE;
223b71206888 Initial import
thib
parents:
diff changeset
753 }
223b71206888 Initial import
thib
parents:
diff changeset
754
223b71206888 Initial import
thib
parents:
diff changeset
755 void Text::Flush(void) {
223b71206888 Initial import
thib
parents:
diff changeset
756 int nChar = -1;
223b71206888 Initial import
thib
parents:
diff changeset
757 DrawText(nChar);
223b71206888 Initial import
thib
parents:
diff changeset
758 }
223b71206888 Initial import
thib
parents:
diff changeset
759
223b71206888 Initial import
thib
parents:
diff changeset
760 void Text::Start(void) {
223b71206888 Initial import
thib
parents:
diff changeset
761 gstream.clear();
223b71206888 Initial import
thib
parents:
diff changeset
762 bottom_pos.clear();
223b71206888 Initial import
thib
parents:
diff changeset
763 layout.Layout(stream, gstream, bottom_pos, pictext->Width()-fontsize/2);
223b71206888 Initial import
thib
parents:
diff changeset
764
223b71206888 Initial import
thib
parents:
diff changeset
765 // height ¤ÎÀÑ»»ÃͤȤ·¤Æ bottom_pos ¤ò·×»»
223b71206888 Initial import
thib
parents:
diff changeset
766 std::vector<int>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
767 int pos = 0;
223b71206888 Initial import
thib
parents:
diff changeset
768 for (it = bottom_pos.begin(); it != bottom_pos.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
769 pos += *it;
223b71206888 Initial import
thib
parents:
diff changeset
770 *it = pos;
223b71206888 Initial import
thib
parents:
diff changeset
771 }
223b71206888 Initial import
thib
parents:
diff changeset
772
223b71206888 Initial import
thib
parents:
diff changeset
773 cur_pos = gstream.begin();
223b71206888 Initial import
thib
parents:
diff changeset
774 line_number = 0;
223b71206888 Initial import
thib
parents:
diff changeset
775 scrolled_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
776 srcrect = Rect(0, 0, pictext->Width(), pictext->Height());
223b71206888 Initial import
thib
parents:
diff changeset
777 press_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
778
223b71206888 Initial import
thib
parents:
diff changeset
779 status = DRAW;
223b71206888 Initial import
thib
parents:
diff changeset
780 cursor_activated = false;
223b71206888 Initial import
thib
parents:
diff changeset
781 if (cursor) cursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
782 }
223b71206888 Initial import
thib
parents:
diff changeset
783
223b71206888 Initial import
thib
parents:
diff changeset
784 void Text::DrawText(int& nChar) {
223b71206888 Initial import
thib
parents:
diff changeset
785 // ÉÁ²èÈϰϤòÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
786 iterator end = gstream.end();
223b71206888 Initial import
thib
parents:
diff changeset
787 iterator it = cur_pos;
223b71206888 Initial import
thib
parents:
diff changeset
788 while(nChar && it != end) { // nChar < 0 ¤Ê¤é½ÐÍè¤ë¤À¤±¤Îʸ»ú¤òÉÁ²è
223b71206888 Initial import
thib
parents:
diff changeset
789 if (! (it->flag & TextGlyph::Group)) nChar--;
223b71206888 Initial import
thib
parents:
diff changeset
790 if (it->flag & TextGlyph::LineEnd) {
223b71206888 Initial import
thib
parents:
diff changeset
791 if (bottom_pos[line_number+1] > srcrect.by) { //²þ¹Ô¤¹¤ë¤È²èÌ̤«¤é½Ð¤Æ¤·¤Þ¤¦
223b71206888 Initial import
thib
parents:
diff changeset
792 it++;
223b71206888 Initial import
thib
parents:
diff changeset
793 if (nChar == 0) nChar = 1;
223b71206888 Initial import
thib
parents:
diff changeset
794 break;
223b71206888 Initial import
thib
parents:
diff changeset
795 }
223b71206888 Initial import
thib
parents:
diff changeset
796 line_number++;
223b71206888 Initial import
thib
parents:
diff changeset
797 }
223b71206888 Initial import
thib
parents:
diff changeset
798 it++;
223b71206888 Initial import
thib
parents:
diff changeset
799 }
223b71206888 Initial import
thib
parents:
diff changeset
800 // ÉÁ²è¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
801 Rect r = DSurfaceRenderText(cur_pos, it, srcrect, surface, Rect(0,0,0,0));
223b71206888 Initial import
thib
parents:
diff changeset
802 pictext->ReBlit(r);
223b71206888 Initial import
thib
parents:
diff changeset
803 cur_pos = it;
223b71206888 Initial import
thib
parents:
diff changeset
804 }
223b71206888 Initial import
thib
parents:
diff changeset
805
223b71206888 Initial import
thib
parents:
diff changeset
806 void Text::Scrollup(int& nChar) {
223b71206888 Initial import
thib
parents:
diff changeset
807 if (nChar < 0) { // °ì²èÌÌʬ¥¹¥¯¥í¡¼¥ë¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
808 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
809 pictext->ReBlit();
223b71206888 Initial import
thib
parents:
diff changeset
810 srcrect = Rect(*surface);
223b71206888 Initial import
thib
parents:
diff changeset
811 srcrect.rmove(0, bottom_pos[line_number]);
223b71206888 Initial import
thib
parents:
diff changeset
812 line_number++;
223b71206888 Initial import
thib
parents:
diff changeset
813 scrolled_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
814 return;
223b71206888 Initial import
thib
parents:
diff changeset
815 }
223b71206888 Initial import
thib
parents:
diff changeset
816 // ¥¹¥¯¥í¡¼¥ëÉý¤òµá¤á¤ë
223b71206888 Initial import
thib
parents:
diff changeset
817 const int max_scroll_count = 8;
223b71206888 Initial import
thib
parents:
diff changeset
818 int dy = bottom_pos[line_number+1] - bottom_pos[line_number];
223b71206888 Initial import
thib
parents:
diff changeset
819 int cur_dy;
223b71206888 Initial import
thib
parents:
diff changeset
820 if (scrolled_count+nChar >= max_scroll_count) {
223b71206888 Initial import
thib
parents:
diff changeset
821 cur_dy = dy - (scrolled_count*dy/max_scroll_count);
223b71206888 Initial import
thib
parents:
diff changeset
822 nChar -= max_scroll_count-scrolled_count;
223b71206888 Initial import
thib
parents:
diff changeset
823 nChar++;
223b71206888 Initial import
thib
parents:
diff changeset
824 scrolled_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
825 line_number++;
223b71206888 Initial import
thib
parents:
diff changeset
826 srcrect.rmove(0, dy);
223b71206888 Initial import
thib
parents:
diff changeset
827 } else {
223b71206888 Initial import
thib
parents:
diff changeset
828 cur_dy = (scrolled_count+nChar)*dy/max_scroll_count;
223b71206888 Initial import
thib
parents:
diff changeset
829 cur_dy -=(scrolled_count*dy/max_scroll_count);
223b71206888 Initial import
thib
parents:
diff changeset
830 scrolled_count += nChar;
223b71206888 Initial import
thib
parents:
diff changeset
831 nChar = 0;
223b71206888 Initial import
thib
parents:
diff changeset
832 }
223b71206888 Initial import
thib
parents:
diff changeset
833 Rect r(*surface);
223b71206888 Initial import
thib
parents:
diff changeset
834 DSurfaceMove(surface, r, surface, Rect(0, -cur_dy, 0, 0));
223b71206888 Initial import
thib
parents:
diff changeset
835 r.ty = r.by-cur_dy;
223b71206888 Initial import
thib
parents:
diff changeset
836 DSurfaceFill(surface, r, 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
837 pictext->ReBlit();
223b71206888 Initial import
thib
parents:
diff changeset
838 }
223b71206888 Initial import
thib
parents:
diff changeset
839
223b71206888 Initial import
thib
parents:
diff changeset
840 void Text::activate(void) {
223b71206888 Initial import
thib
parents:
diff changeset
841 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
842 Event::Video::activate();
223b71206888 Initial import
thib
parents:
diff changeset
843 window_activated = true;
223b71206888 Initial import
thib
parents:
diff changeset
844 if (cursor_activated && window_activated && cursor) cursor->show();
223b71206888 Initial import
thib
parents:
diff changeset
845 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
846
0
223b71206888 Initial import
thib
parents:
diff changeset
847 void Text::deactivate(void) {
223b71206888 Initial import
thib
parents:
diff changeset
848 event.DeleteGlobalPressFunc(&Pressed, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
849 Event::Video::deactivate();
223b71206888 Initial import
thib
parents:
diff changeset
850 window_activated = false;
223b71206888 Initial import
thib
parents:
diff changeset
851 if (cursor) cursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
852 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
853
0
223b71206888 Initial import
thib
parents:
diff changeset
854 void Text::SetCursor(TimeCursor* c) {
223b71206888 Initial import
thib
parents:
diff changeset
855 cursor = c;
223b71206888 Initial import
thib
parents:
diff changeset
856 if (c) {
223b71206888 Initial import
thib
parents:
diff changeset
857 if (cursor_activated && window_activated) c->show();
223b71206888 Initial import
thib
parents:
diff changeset
858 else c->hide();
223b71206888 Initial import
thib
parents:
diff changeset
859 }
223b71206888 Initial import
thib
parents:
diff changeset
860 }
223b71206888 Initial import
thib
parents:
diff changeset
861
223b71206888 Initial import
thib
parents:
diff changeset
862 Label::Label(PicContainer* parent, const Rect& r_orig, bool _is_center, const char* text, int _text_size) :
223b71206888 Initial import
thib
parents:
diff changeset
863 is_center(_is_center),
223b71206888 Initial import
thib
parents:
diff changeset
864 root(parent->Root()),
223b71206888 Initial import
thib
parents:
diff changeset
865 text_size(_text_size) {
223b71206888 Initial import
thib
parents:
diff changeset
866 Rect r(r_orig);
223b71206888 Initial import
thib
parents:
diff changeset
867
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
868 if (text == NULL) text = "";
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
869 int width = r.width();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
870 int height = r.height();
0
223b71206888 Initial import
thib
parents:
diff changeset
871 if (width == 0) width = parent->Width() - r.lx;
223b71206888 Initial import
thib
parents:
diff changeset
872
223b71206888 Initial import
thib
parents:
diff changeset
873 TextGlyphStream gs = DefaultLayout(text_size)->Layout(text, width);
223b71206888 Initial import
thib
parents:
diff changeset
874
223b71206888 Initial import
thib
parents:
diff changeset
875 if (r.width() == 0) { // ʸ»ú¤Ë¹ç¤ï¤»¤Æ¥¦¥£¥¸¥Ã¥ÈºîÀ®
223b71206888 Initial import
thib
parents:
diff changeset
876 width = gs.width();
223b71206888 Initial import
thib
parents:
diff changeset
877 r.rx = r.lx + gs.width();
223b71206888 Initial import
thib
parents:
diff changeset
878 }
223b71206888 Initial import
thib
parents:
diff changeset
879 if (r.height() == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
880 r.by = r.ty + gs.height();
223b71206888 Initial import
thib
parents:
diff changeset
881 }
223b71206888 Initial import
thib
parents:
diff changeset
882
223b71206888 Initial import
thib
parents:
diff changeset
883 SetPic(parent->create_leaf(r, 0));
223b71206888 Initial import
thib
parents:
diff changeset
884
223b71206888 Initial import
thib
parents:
diff changeset
885 /* ¥é¥Ù¥ëÍѤΠSurface ¤òºî¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
886 surface = parent->Root().NewSurface(r.width(), r.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
887
223b71206888 Initial import
thib
parents:
diff changeset
888 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
889 int x = 0, y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
890 if (is_center) {
223b71206888 Initial import
thib
parents:
diff changeset
891 x = (Pic()->Width() - gs.width()) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
892 y = (Pic()->Height() - gs.height()) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
893 }
223b71206888 Initial import
thib
parents:
diff changeset
894
223b71206888 Initial import
thib
parents:
diff changeset
895 DSurfaceRenderText(gs.begin(), gs.end(), Rect(*surface), surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
896
223b71206888 Initial import
thib
parents:
diff changeset
897 Pic()->SetSurface(surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
898 show();
223b71206888 Initial import
thib
parents:
diff changeset
899 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
900
0
223b71206888 Initial import
thib
parents:
diff changeset
901 Label::~Label() {
223b71206888 Initial import
thib
parents:
diff changeset
902 root.DeleteSurface(surface);
223b71206888 Initial import
thib
parents:
diff changeset
903 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
904
0
223b71206888 Initial import
thib
parents:
diff changeset
905 void Label::SetText(const char* text) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
906 if (text == NULL) text = "";
0
223b71206888 Initial import
thib
parents:
diff changeset
907 TextGlyphStream gs = DefaultLayout(text_size)->Layout(text, Pic()->Width());
223b71206888 Initial import
thib
parents:
diff changeset
908 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
909 int x = 0, y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
910 if (is_center) {
223b71206888 Initial import
thib
parents:
diff changeset
911 x = (Pic()->Width() - gs.width()) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
912 y = (Pic()->Height() - gs.height()) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
913 }
223b71206888 Initial import
thib
parents:
diff changeset
914
223b71206888 Initial import
thib
parents:
diff changeset
915 DSurfaceRenderText(gs.begin(), gs.end(), Rect(*surface), surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
916 Pic()->ReBlit();
223b71206888 Initial import
thib
parents:
diff changeset
917 }
223b71206888 Initial import
thib
parents:
diff changeset
918
223b71206888 Initial import
thib
parents:
diff changeset
919 Dialog::Dialog(Event::Container& container, PicContainer* parent, const char* text, bool with_cancel) :
223b71206888 Initial import
thib
parents:
diff changeset
920 Event::Video(container) {
223b71206888 Initial import
thib
parents:
diff changeset
921
223b71206888 Initial import
thib
parents:
diff changeset
922 int x,y;
223b71206888 Initial import
thib
parents:
diff changeset
923 status = WAIT;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
924 set_func = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
925 set_pointer = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
926
223b71206888 Initial import
thib
parents:
diff changeset
927 XKFont::HorizLayout& layout = *DefaultLayout(26);
223b71206888 Initial import
thib
parents:
diff changeset
928 int dialog_width = parent->Width() / 2;
223b71206888 Initial import
thib
parents:
diff changeset
929 TextGlyphStream s_ok = layout.Layout("£Ï£Ë", dialog_width);
223b71206888 Initial import
thib
parents:
diff changeset
930 TextGlyphStream s_cancel = layout.Layout("¼è¾Ã", dialog_width);
223b71206888 Initial import
thib
parents:
diff changeset
931 TextGlyphStream s_text = layout.Layout(text, dialog_width);
223b71206888 Initial import
thib
parents:
diff changeset
932
223b71206888 Initial import
thib
parents:
diff changeset
933 Rect r_text(0, 0, s_text.width(), s_text.height());
223b71206888 Initial import
thib
parents:
diff changeset
934 Rect r_ok(0, 0, s_ok.width(), s_ok.height());
223b71206888 Initial import
thib
parents:
diff changeset
935 Rect r_cancel(0, 0, s_cancel.width(), s_cancel.height());
223b71206888 Initial import
thib
parents:
diff changeset
936
223b71206888 Initial import
thib
parents:
diff changeset
937 /* ¥À¥¤¥¢¥í¥°¥Ü¥Ã¥¯¥¹¤Î Surface ¤òºî¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
938 int dwidth = r_text.width() + (r_text.width()/10)*2 + 6;
223b71206888 Initial import
thib
parents:
diff changeset
939 int dheight = r_text.height() + r_ok.height() + r_cancel.height()*3 + 4;
223b71206888 Initial import
thib
parents:
diff changeset
940 surface_diag = parent->Root().NewSurface(dwidth, dheight, NO_MASK); // alpha ¤Ê¤·
223b71206888 Initial import
thib
parents:
diff changeset
941 DSurfaceFill(surface_diag, Rect(*surface_diag), 0xf0, 0xd0, 0xa0);
223b71206888 Initial import
thib
parents:
diff changeset
942 DrawBox(surface_diag, Rect(0,0,dwidth,dheight));
223b71206888 Initial import
thib
parents:
diff changeset
943
223b71206888 Initial import
thib
parents:
diff changeset
944 Surface* surface_text = parent->Root().NewSurface(r_text.width(), r_text.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
945 s_text.SetColor(0x38, 0x20, 0x18);
223b71206888 Initial import
thib
parents:
diff changeset
946 DSurfaceRenderText(s_text.begin(), s_text.end(), r_text, surface_text, Rect(0, 0, 0, 0));
223b71206888 Initial import
thib
parents:
diff changeset
947 x = r_text.width()/10 + 3;
223b71206888 Initial import
thib
parents:
diff changeset
948 y = r_cancel.height()+2;
223b71206888 Initial import
thib
parents:
diff changeset
949 parent->Root().BlitSurface(surface_text, r_text, surface_diag, Rect(x, y, x+r_text.width(), y+r_text.height()));
223b71206888 Initial import
thib
parents:
diff changeset
950 parent->Root().DeleteSurface(surface_text);
223b71206888 Initial import
thib
parents:
diff changeset
951
223b71206888 Initial import
thib
parents:
diff changeset
952 /* panel ¤ò¤Ä¤¯¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
953 x = (parent->Width()-dwidth)/2;
223b71206888 Initial import
thib
parents:
diff changeset
954 y = (parent->Height()-dheight)/2;
223b71206888 Initial import
thib
parents:
diff changeset
955 SetPic(parent->create_node(Rect(x, y, x+dwidth, y+dheight), 0));
223b71206888 Initial import
thib
parents:
diff changeset
956
223b71206888 Initial import
thib
parents:
diff changeset
957 /* ¥Ü¥¿¥ó¤òºîÀ®¤¹¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
958 /* f8d8c8 ÇØ·Ê(ÌÀ)*/
223b71206888 Initial import
thib
parents:
diff changeset
959 /* f0d0a0 ÇØ·Ê*/
223b71206888 Initial import
thib
parents:
diff changeset
960 /* b08040 ÏÈ¡ÊÌÀ)*/
223b71206888 Initial import
thib
parents:
diff changeset
961 /* 805010 ÏÈ*/
223b71206888 Initial import
thib
parents:
diff changeset
962 /* 382018 ¹õ*/
223b71206888 Initial import
thib
parents:
diff changeset
963 /* 9890f8 ÀÄ*/
223b71206888 Initial import
thib
parents:
diff changeset
964 /* dc6448 ÀÖ*/
223b71206888 Initial import
thib
parents:
diff changeset
965 /* ³Æ¥Ü¥¿¥ó¤Ïº¸±¦¤Ë¥Ü¥¿¥óÉý¤Î 1/4, ¾å²¼¤Ë¥Ü¥¿¥óÉý¤Î 1/4 ¤Î¥Þ¡¼¥¸¥ó¤ò»ý¤Ä */
223b71206888 Initial import
thib
parents:
diff changeset
966 Rect r_btn(r_ok); r_btn.join(r_cancel);
223b71206888 Initial import
thib
parents:
diff changeset
967 int btn_width = r_btn.width() * 3 / 2;
223b71206888 Initial import
thib
parents:
diff changeset
968 int btn_height = r_btn.height() * 3 / 2;
223b71206888 Initial import
thib
parents:
diff changeset
969 surface_btn = parent->Root().NewSurface(btn_width, btn_height*4, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
970 DSurfaceFill(surface_btn, Rect(*surface_btn), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
971 s_ok.SetColor(0x38, 0x20, 0x18);
223b71206888 Initial import
thib
parents:
diff changeset
972 DSurfaceRenderText(s_ok.begin(), s_ok.end(), r_ok, surface_btn, Rect( (btn_width-r_ok.width())/2,(btn_height-r_ok.height())/2));
223b71206888 Initial import
thib
parents:
diff changeset
973 s_ok.SetColor(0x98, 0x90, 0xf8);
223b71206888 Initial import
thib
parents:
diff changeset
974 DSurfaceRenderText(s_ok.begin(), s_ok.end(), r_ok, surface_btn, Rect( (btn_width-r_ok.width())/2,(btn_height-r_ok.height())/2 + btn_height));
223b71206888 Initial import
thib
parents:
diff changeset
975 s_cancel.SetColor(0x38, 0x20, 0x18);
223b71206888 Initial import
thib
parents:
diff changeset
976 DSurfaceRenderText(s_cancel.begin(), s_cancel.end(), r_cancel, surface_btn, Rect( (btn_width-r_cancel.width())/2,(btn_height-r_cancel.height())/2 + btn_height*2));
223b71206888 Initial import
thib
parents:
diff changeset
977 s_cancel.SetColor(0xdc, 0x64, 0x48);
223b71206888 Initial import
thib
parents:
diff changeset
978 DSurfaceRenderText(s_cancel.begin(), s_cancel.end(), r_cancel, surface_btn, Rect( (btn_width-r_cancel.width())/2,(btn_height-r_cancel.height())/2 + btn_height*3));
223b71206888 Initial import
thib
parents:
diff changeset
979
223b71206888 Initial import
thib
parents:
diff changeset
980 x = (dwidth - btn_width*2) / 3;;
223b71206888 Initial import
thib
parents:
diff changeset
981 y = r_cancel.height()*3/2 + r_text.height() + 2;
223b71206888 Initial import
thib
parents:
diff changeset
982 if (!with_cancel) x = (dwidth - btn_width) / 2;
223b71206888 Initial import
thib
parents:
diff changeset
983 Button* b_ok = new Button(container, PicNode(), surface_btn, 0, 0, 0, btn_height, 2, Rect(x, y, x+btn_width, y+btn_height), 1);
223b71206888 Initial import
thib
parents:
diff changeset
984 DrawBox(surface_diag, Rect(x-3,y-2,x+btn_width+3,y+btn_height+2));
223b71206888 Initial import
thib
parents:
diff changeset
985 b_ok->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
986 b_ok->press_func = &press_ok;
223b71206888 Initial import
thib
parents:
diff changeset
987 if (with_cancel) {
223b71206888 Initial import
thib
parents:
diff changeset
988 x += x + btn_width;
223b71206888 Initial import
thib
parents:
diff changeset
989 Button* b_cancel = new Button(container, PicNode(), surface_btn, 0, btn_height*2, 0, btn_height, 2, Rect(x, y, x+btn_width, y+btn_height), 1);
223b71206888 Initial import
thib
parents:
diff changeset
990 DrawBox(surface_diag, Rect(x-3,y-2,x+btn_width+3,y+btn_height+2));
223b71206888 Initial import
thib
parents:
diff changeset
991 b_cancel->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
992 b_cancel->press_func = &press_cancel;
223b71206888 Initial import
thib
parents:
diff changeset
993 }
223b71206888 Initial import
thib
parents:
diff changeset
994
223b71206888 Initial import
thib
parents:
diff changeset
995 Pic()->SetSurface(surface_diag, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
996 Pic()->ZMove(ZMOVE_TOP);
223b71206888 Initial import
thib
parents:
diff changeset
997
223b71206888 Initial import
thib
parents:
diff changeset
998 show_all();
223b71206888 Initial import
thib
parents:
diff changeset
999 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1000
0
223b71206888 Initial import
thib
parents:
diff changeset
1001 Dialog::~Dialog() {
223b71206888 Initial import
thib
parents:
diff changeset
1002 PicRoot& root = PicNode()->Root();
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1003 SetPic(NULL);
0
223b71206888 Initial import
thib
parents:
diff changeset
1004 root.DeleteSurface(surface_btn);
223b71206888 Initial import
thib
parents:
diff changeset
1005 root.DeleteSurface(surface_diag);
223b71206888 Initial import
thib
parents:
diff changeset
1006 }
223b71206888 Initial import
thib
parents:
diff changeset
1007
223b71206888 Initial import
thib
parents:
diff changeset
1008 void Dialog::press_ok(void* pointer, Button* btn) {
223b71206888 Initial import
thib
parents:
diff changeset
1009 if (pointer) {
223b71206888 Initial import
thib
parents:
diff changeset
1010 Dialog* wid = (Dialog*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
1011 wid->status = OK;
223b71206888 Initial import
thib
parents:
diff changeset
1012 if (wid->set_func) {
223b71206888 Initial import
thib
parents:
diff changeset
1013 (*wid->set_func)(wid->set_pointer, wid);
223b71206888 Initial import
thib
parents:
diff changeset
1014 }
223b71206888 Initial import
thib
parents:
diff changeset
1015 }
223b71206888 Initial import
thib
parents:
diff changeset
1016 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1017
0
223b71206888 Initial import
thib
parents:
diff changeset
1018 void Dialog::press_cancel(void* pointer, Button* btn) {
223b71206888 Initial import
thib
parents:
diff changeset
1019 if (pointer) {
223b71206888 Initial import
thib
parents:
diff changeset
1020 Dialog* wid = (Dialog*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
1021 wid->status = CANCEL;
223b71206888 Initial import
thib
parents:
diff changeset
1022 if (wid->set_func) {
223b71206888 Initial import
thib
parents:
diff changeset
1023 (*wid->set_func)(wid->set_pointer, wid);
223b71206888 Initial import
thib
parents:
diff changeset
1024 }
223b71206888 Initial import
thib
parents:
diff changeset
1025 }
223b71206888 Initial import
thib
parents:
diff changeset
1026 }
223b71206888 Initial import
thib
parents:
diff changeset
1027
223b71206888 Initial import
thib
parents:
diff changeset
1028 void Dialog::DrawBox(Surface* s, const Rect& r) {
223b71206888 Initial import
thib
parents:
diff changeset
1029 DSurfaceFill(s, Rect(r.lx, r.ty, r.rx, r.ty+1), 0x80, 0x50, 0x10);
223b71206888 Initial import
thib
parents:
diff changeset
1030 DSurfaceFill(s, Rect(r.lx, r.ty+1, r.rx, r.ty+2), 0x38, 0x20, 0x18);
223b71206888 Initial import
thib
parents:
diff changeset
1031 DSurfaceFill(s, Rect(r.lx, r.by-2, r.rx, r.by-1), 0x80, 0x50, 0x10);
223b71206888 Initial import
thib
parents:
diff changeset
1032 DSurfaceFill(s, Rect(r.lx, r.by-1, r.rx, r.by), 0x38, 0x20, 0x18);
223b71206888 Initial import
thib
parents:
diff changeset
1033
223b71206888 Initial import
thib
parents:
diff changeset
1034 DSurfaceFill(s, Rect(r.lx, r.ty, r.lx+1, r.by), 0xb0, 0x80, 0x40);
223b71206888 Initial import
thib
parents:
diff changeset
1035 DSurfaceFill(s, Rect(r.lx+1, r.ty+1, r.lx+2, r.by-1), 0x80, 0x50, 0x10);
223b71206888 Initial import
thib
parents:
diff changeset
1036 DSurfaceFill(s, Rect(r.lx+1, r.ty+2, r.lx+2, r.by-2), 0x38, 0x20, 0x18);
223b71206888 Initial import
thib
parents:
diff changeset
1037 DSurfaceFill(s, Rect(r.rx-3, r.ty+2, r.rx-2, r.by-2), 0xb0, 0x80, 0x40);
223b71206888 Initial import
thib
parents:
diff changeset
1038 DSurfaceFill(s, Rect(r.rx-2, r.ty+1, r.rx-1, r.by-1), 0x80, 0x50, 0x10);
223b71206888 Initial import
thib
parents:
diff changeset
1039 DSurfaceFill(s, Rect(r.rx-1, r.ty, r.rx, r.by), 0x38, 0x20, 0x18);
223b71206888 Initial import
thib
parents:
diff changeset
1040 }
223b71206888 Initial import
thib
parents:
diff changeset
1041
223b71206888 Initial import
thib
parents:
diff changeset
1042 AnmTime::AnmTime(Event::Container& container, PicBase* _pic, int _total_time, int _all_count) :
223b71206888 Initial import
thib
parents:
diff changeset
1043 Event::Time(container),
223b71206888 Initial import
thib
parents:
diff changeset
1044 PicAnm(_pic), start_time(0), total_time(_total_time), all_count(_all_count) {
223b71206888 Initial import
thib
parents:
diff changeset
1045 status = FINISHED;
223b71206888 Initial import
thib
parents:
diff changeset
1046 if (total_time == 0) total_time = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1047 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1048
0
223b71206888 Initial import
thib
parents:
diff changeset
1049 AnmTime::AnmTime(Event::Container& container, std::vector<PicBase*> _pic, int _total_time, int _all_count) :
223b71206888 Initial import
thib
parents:
diff changeset
1050 Event::Time(container),
223b71206888 Initial import
thib
parents:
diff changeset
1051 PicAnm(_pic), start_time(0), total_time(_total_time), all_count(_all_count) {
223b71206888 Initial import
thib
parents:
diff changeset
1052 status = FINISHED;
223b71206888 Initial import
thib
parents:
diff changeset
1053 if (total_time == 0) total_time = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1054 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1055
0
223b71206888 Initial import
thib
parents:
diff changeset
1056 void AnmTime::Elapsed(unsigned int current_time) {
223b71206888 Initial import
thib
parents:
diff changeset
1057 if (total_time == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
1058 if (status == FINISHED || current_time == 0) {SetWakeup(current_time+1); return;}
223b71206888 Initial import
thib
parents:
diff changeset
1059 if (start_time == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1060 start_time = current_time;
223b71206888 Initial import
thib
parents:
diff changeset
1061 Start();
223b71206888 Initial import
thib
parents:
diff changeset
1062 }
223b71206888 Initial import
thib
parents:
diff changeset
1063 unsigned int time_elapsed = current_time - start_time;
223b71206888 Initial import
thib
parents:
diff changeset
1064 if (time_elapsed < total_time) {
223b71206888 Initial import
thib
parents:
diff changeset
1065 int count = time_elapsed * all_count / total_time;
223b71206888 Initial import
thib
parents:
diff changeset
1066 Exec(count);
223b71206888 Initial import
thib
parents:
diff changeset
1067 int next_time = start_time + (count+1) * total_time / all_count;
223b71206888 Initial import
thib
parents:
diff changeset
1068 SetWakeup(next_time);
223b71206888 Initial import
thib
parents:
diff changeset
1069 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1070 Exec(all_count);
223b71206888 Initial import
thib
parents:
diff changeset
1071 Finish();
223b71206888 Initial import
thib
parents:
diff changeset
1072 status = FINISHED;
223b71206888 Initial import
thib
parents:
diff changeset
1073 }
223b71206888 Initial import
thib
parents:
diff changeset
1074 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1075
0
223b71206888 Initial import
thib
parents:
diff changeset
1076 void AnmTime::Abort(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1077 if (status == FINISHED) return;
223b71206888 Initial import
thib
parents:
diff changeset
1078 if (start_time == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1079 Start();
223b71206888 Initial import
thib
parents:
diff changeset
1080 Exec(all_count);
223b71206888 Initial import
thib
parents:
diff changeset
1081 }
223b71206888 Initial import
thib
parents:
diff changeset
1082 if (total_time) {
223b71206888 Initial import
thib
parents:
diff changeset
1083 Finish();
223b71206888 Initial import
thib
parents:
diff changeset
1084 }
223b71206888 Initial import
thib
parents:
diff changeset
1085 status = FINISHED;
223b71206888 Initial import
thib
parents:
diff changeset
1086 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1087
0
223b71206888 Initial import
thib
parents:
diff changeset
1088 bool AnmTime::IsEnd(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1089 return status == FINISHED;
223b71206888 Initial import
thib
parents:
diff changeset
1090 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1091
0
223b71206888 Initial import
thib
parents:
diff changeset
1092 AnmMove::AnmMove(Event::Container& container, PicBase* _pic, const Rect& _to, int total_time) :
223b71206888 Initial import
thib
parents:
diff changeset
1093 AnmTime(container, _pic, total_time),
223b71206888 Initial import
thib
parents:
diff changeset
1094 from(0,0), to(_to) {
223b71206888 Initial import
thib
parents:
diff changeset
1095 from.lx = _pic->PosX();
223b71206888 Initial import
thib
parents:
diff changeset
1096 from.ty = _pic->PosY();
223b71206888 Initial import
thib
parents:
diff changeset
1097 from.rx = from.lx + _pic->Width();
223b71206888 Initial import
thib
parents:
diff changeset
1098 from.by = from.ty + _pic->Height();
223b71206888 Initial import
thib
parents:
diff changeset
1099
223b71206888 Initial import
thib
parents:
diff changeset
1100 int dx = to.lx - from.lx;
223b71206888 Initial import
thib
parents:
diff changeset
1101 int dy = to.ty - from.ty;
223b71206888 Initial import
thib
parents:
diff changeset
1102 if (dx < 0) dx = -dx;
223b71206888 Initial import
thib
parents:
diff changeset
1103 if (dy < 0) dy = -dy;
223b71206888 Initial import
thib
parents:
diff changeset
1104 if (dx < dy) dx = dy;
223b71206888 Initial import
thib
parents:
diff changeset
1105 if (dx == 0) dx = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1106 SetAllCount(dx);
223b71206888 Initial import
thib
parents:
diff changeset
1107 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1108
0
223b71206888 Initial import
thib
parents:
diff changeset
1109 void AnmMove::Exec(int count) {
223b71206888 Initial import
thib
parents:
diff changeset
1110 Rect r(from);
223b71206888 Initial import
thib
parents:
diff changeset
1111 int dx = to.lx - from.lx;
223b71206888 Initial import
thib
parents:
diff changeset
1112 int dy = to.ty - from.ty;
223b71206888 Initial import
thib
parents:
diff changeset
1113 r.rmove(dx*count/all_count, dy*count/all_count);
223b71206888 Initial import
thib
parents:
diff changeset
1114 iterator it;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1115 for (it=pic.begin(); it!=pic.end(); it++)
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1116 (*it)->Move(r.lx, r.ty);
0
223b71206888 Initial import
thib
parents:
diff changeset
1117 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1118
0
223b71206888 Initial import
thib
parents:
diff changeset
1119 AnmAlpha::AnmAlpha(Event::Container& container, PicBase* _pic, int alpha_from, int alpha_to, int total_time) :
223b71206888 Initial import
thib
parents:
diff changeset
1120 AnmTime(container, _pic, total_time),
223b71206888 Initial import
thib
parents:
diff changeset
1121 from(alpha_from), to(alpha_to), alpha_r(0,0,1,1) {
223b71206888 Initial import
thib
parents:
diff changeset
1122 if (from < 0) from = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1123 if (from >= ALPHA_MAX) from = ALPHA_MAX;
223b71206888 Initial import
thib
parents:
diff changeset
1124 if (to < 0) to = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1125 if (to >= ALPHA_MAX) to = ALPHA_MAX;
223b71206888 Initial import
thib
parents:
diff changeset
1126 int c = from - to;
223b71206888 Initial import
thib
parents:
diff changeset
1127 if (c < 0) c = -c;
223b71206888 Initial import
thib
parents:
diff changeset
1128 if (c == 0) c = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1129 SetAllCount(c);
223b71206888 Initial import
thib
parents:
diff changeset
1130 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1131
0
223b71206888 Initial import
thib
parents:
diff changeset
1132 AnmAlpha::AnmAlpha(Event::Container& container, std::vector<PicBase*> _pic, int alpha_from, int alpha_to, int total_time) :
223b71206888 Initial import
thib
parents:
diff changeset
1133 AnmTime(container, _pic, total_time),
223b71206888 Initial import
thib
parents:
diff changeset
1134 from(alpha_from), to(alpha_to), alpha_r(0,0,1,1) {
223b71206888 Initial import
thib
parents:
diff changeset
1135 if (from < 0) from = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1136 if (from >= ALPHA_MAX) from = ALPHA_MAX;
223b71206888 Initial import
thib
parents:
diff changeset
1137 if (to < 0) to = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1138 if (to >= ALPHA_MAX) to = ALPHA_MAX;
223b71206888 Initial import
thib
parents:
diff changeset
1139 int c = from - to;
223b71206888 Initial import
thib
parents:
diff changeset
1140 if (c < 0) c = -c;
223b71206888 Initial import
thib
parents:
diff changeset
1141 if (c == 0) c = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1142 SetAllCount(c);
223b71206888 Initial import
thib
parents:
diff changeset
1143 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1144
0
223b71206888 Initial import
thib
parents:
diff changeset
1145 void AnmAlpha::Start(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1146 iterator it;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1147 for (it=pic.begin(); it!=pic.end(); it++)
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1148 (*it)->show();
0
223b71206888 Initial import
thib
parents:
diff changeset
1149 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1150
0
223b71206888 Initial import
thib
parents:
diff changeset
1151 void AnmAlpha::Exec(int count) {
223b71206888 Initial import
thib
parents:
diff changeset
1152 alpha = (from * (all_count-count) + (to-from) * count) / all_count;
223b71206888 Initial import
thib
parents:
diff changeset
1153 iterator it;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1154 for (it=pic.begin(); it!=pic.end(); it++)
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1155 (*it)->SetSurfaceAlpha(&alpha, alpha_r);
0
223b71206888 Initial import
thib
parents:
diff changeset
1156 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1157
0
223b71206888 Initial import
thib
parents:
diff changeset
1158 void AnmAlpha::Finish(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1159 iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1160 for (it=pic.begin(); it!=pic.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1161 if (to == 0) (*it)->hide();
223b71206888 Initial import
thib
parents:
diff changeset
1162 else if (to != ALPHA_MAX) fprintf(stderr,"Warning in AnmAlpha::Finish: alpha value suddenly changed.\n");
223b71206888 Initial import
thib
parents:
diff changeset
1163 (*it)->SetSurfaceAlpha(0,Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
1164 }
223b71206888 Initial import
thib
parents:
diff changeset
1165 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1166
0
223b71206888 Initial import
thib
parents:
diff changeset
1167 AnmAlphaMove::AnmAlphaMove(Event::Container& container, PicBase* _pic) :
223b71206888 Initial import
thib
parents:
diff changeset
1168 AnmTime(container, _pic, 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1169 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1170
0
223b71206888 Initial import
thib
parents:
diff changeset
1171 void AnmAlphaMove::SetPtn(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1172 int total = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1173 std::vector<Ptn>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1174 for (it=ptns.begin(); it!=ptns.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1175 if (total < it->next_tick) total = it->next_tick;
223b71206888 Initial import
thib
parents:
diff changeset
1176 }
223b71206888 Initial import
thib
parents:
diff changeset
1177 SetAllCount(total);
223b71206888 Initial import
thib
parents:
diff changeset
1178 SetTotalTime(total);
223b71206888 Initial import
thib
parents:
diff changeset
1179 cur_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1180 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1181
0
223b71206888 Initial import
thib
parents:
diff changeset
1182 void AnmAlphaMove::Exec(int count) {
223b71206888 Initial import
thib
parents:
diff changeset
1183 if (ptns.empty()) return;
223b71206888 Initial import
thib
parents:
diff changeset
1184 if (cur_count != 0 && ptns[cur_count].next_tick > count) return;
223b71206888 Initial import
thib
parents:
diff changeset
1185 if (cur_count >= ptns.size()) return;
223b71206888 Initial import
thib
parents:
diff changeset
1186 // ¼¡¤Î¥Ñ¥¿¡¼¥ó¤òõ¤¹
223b71206888 Initial import
thib
parents:
diff changeset
1187 // count <= it->next_tick ¤Ê¤ë¾ò·ï¤òËþ¤¿¤¹ºÇ¸å¤Î it ¤òõ¤¹
223b71206888 Initial import
thib
parents:
diff changeset
1188 std::vector<Ptn>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1189 for (it=ptns.begin()+cur_count; it != ptns.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1190 if (count <= it->next_tick) break;
223b71206888 Initial import
thib
parents:
diff changeset
1191 }
223b71206888 Initial import
thib
parents:
diff changeset
1192 if (it == ptns.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
1193 fprintf(stderr,"end\n");
223b71206888 Initial import
thib
parents:
diff changeset
1194 it = ptns.end() - 1;
223b71206888 Initial import
thib
parents:
diff changeset
1195 }
223b71206888 Initial import
thib
parents:
diff changeset
1196 cur_count = it - ptns.begin();
223b71206888 Initial import
thib
parents:
diff changeset
1197
223b71206888 Initial import
thib
parents:
diff changeset
1198 iterator p;
223b71206888 Initial import
thib
parents:
diff changeset
1199 for (p=pic.begin(); p!=pic.end(); p++) {
223b71206888 Initial import
thib
parents:
diff changeset
1200 // move
223b71206888 Initial import
thib
parents:
diff changeset
1201 (*p)->Move(it->pos.lx, it->pos.ty);
223b71206888 Initial import
thib
parents:
diff changeset
1202 (*p)->SetSurfacePos(it->surface_pos.lx, it->surface_pos.ty);
223b71206888 Initial import
thib
parents:
diff changeset
1203 // alpha set
223b71206888 Initial import
thib
parents:
diff changeset
1204 if (it->alpha == 0) (*p)->hide();
223b71206888 Initial import
thib
parents:
diff changeset
1205 else if (it->alpha == ALPHA_MAX) { (*p)->show(); (*p)->SetSurfaceAlpha(0, Rect(0,0)); }
223b71206888 Initial import
thib
parents:
diff changeset
1206 else { (*p)->show(); (*p)->SetSurfaceAlpha( &(it->alpha), Rect(0,0,1,1)); }
223b71206888 Initial import
thib
parents:
diff changeset
1207 }
223b71206888 Initial import
thib
parents:
diff changeset
1208 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1209
0
223b71206888 Initial import
thib
parents:
diff changeset
1210 void AnmAlphaMove::Finish(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1211 if (ptns.empty()) return;
223b71206888 Initial import
thib
parents:
diff changeset
1212 if (cur_count >= ptns.size() - 1) return;
223b71206888 Initial import
thib
parents:
diff changeset
1213 cur_count = ptns.size() - 1;
223b71206888 Initial import
thib
parents:
diff changeset
1214 Exec(ptns[cur_count].next_tick); // ºÇ¸å¤Î pattern ¤Î¾õÂ֤ˤ¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1215 }
223b71206888 Initial import
thib
parents:
diff changeset
1216
223b71206888 Initial import
thib
parents:
diff changeset
1217 AnmPtnSolid::AnmPtnSolid(Event::Container& container, PicBase* _pic, const unsigned char* _ptn, const Rect& _alpha_r, int total_time) :
223b71206888 Initial import
thib
parents:
diff changeset
1218 AnmTime(container, _pic, total_time),
223b71206888 Initial import
thib
parents:
diff changeset
1219 ptn(_ptn), alpha_r(_alpha_r)
223b71206888 Initial import
thib
parents:
diff changeset
1220 {
223b71206888 Initial import
thib
parents:
diff changeset
1221 ptn_len = alpha_r.width() * alpha_r.height();
223b71206888 Initial import
thib
parents:
diff changeset
1222 alpha = new unsigned char[ptn_len];
223b71206888 Initial import
thib
parents:
diff changeset
1223 int max_a = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1224 for (int i=0; i<ptn_len; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1225 if (ptn[i] > max_a) max_a = ptn[i];
223b71206888 Initial import
thib
parents:
diff changeset
1226 }
223b71206888 Initial import
thib
parents:
diff changeset
1227 if (max_a == 0) max_a = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1228 SetAllCount(max_a);
223b71206888 Initial import
thib
parents:
diff changeset
1229 }
223b71206888 Initial import
thib
parents:
diff changeset
1230
223b71206888 Initial import
thib
parents:
diff changeset
1231 AnmPtnAlpha::AnmPtnAlpha(Event::Container& container, PicBase* _pic, const unsigned char* _ptn, const Rect& _alpha_r, int _band_width, int total_time) :
223b71206888 Initial import
thib
parents:
diff changeset
1232 AnmTime(container, _pic, total_time),
223b71206888 Initial import
thib
parents:
diff changeset
1233 ptn(_ptn), band(_band_width), alpha_r(_alpha_r)
223b71206888 Initial import
thib
parents:
diff changeset
1234 {
223b71206888 Initial import
thib
parents:
diff changeset
1235 ptn_len = alpha_r.width() * alpha_r.height();
223b71206888 Initial import
thib
parents:
diff changeset
1236 alpha = new unsigned char[ptn_len];
223b71206888 Initial import
thib
parents:
diff changeset
1237 if (band <= 0) band = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1238 SetAllCount(ALPHA_MAX+band);
223b71206888 Initial import
thib
parents:
diff changeset
1239 }
223b71206888 Initial import
thib
parents:
diff changeset
1240
223b71206888 Initial import
thib
parents:
diff changeset
1241 void AnmPtnSolid::Exec(int count) {
223b71206888 Initial import
thib
parents:
diff changeset
1242 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1243 for (i=0; i<ptn_len; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1244 if (ptn[i] <= count) alpha[i] = ALPHA_MAX;
223b71206888 Initial import
thib
parents:
diff changeset
1245 else alpha[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1246 }
223b71206888 Initial import
thib
parents:
diff changeset
1247 iterator it;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1248 for (it=pic.begin(); it!=pic.end(); it++)
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1249 (*it)->SetSurfaceAlpha(alpha, alpha_r);
0
223b71206888 Initial import
thib
parents:
diff changeset
1250 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1251
0
223b71206888 Initial import
thib
parents:
diff changeset
1252 void AnmPtnAlpha::Exec(int count) {
223b71206888 Initial import
thib
parents:
diff changeset
1253 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1254 int ptn_zero = count;
223b71206888 Initial import
thib
parents:
diff changeset
1255 int ptn_max = count - band;
223b71206888 Initial import
thib
parents:
diff changeset
1256 for (i=0; i<ptn_len; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1257 if (ptn[i] >= ptn_zero) alpha[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1258 else if (ptn[i] < ptn_max) alpha[i] = ALPHA_MAX;
223b71206888 Initial import
thib
parents:
diff changeset
1259 else alpha[i] = (ptn_zero-ptn[i])*ALPHA_MAX/band;
223b71206888 Initial import
thib
parents:
diff changeset
1260 }
223b71206888 Initial import
thib
parents:
diff changeset
1261 iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1262 for (it=pic.begin(); it!=pic.end(); it++) (*it)->SetSurfaceAlpha(alpha, alpha_r);
223b71206888 Initial import
thib
parents:
diff changeset
1263 }
223b71206888 Initial import
thib
parents:
diff changeset
1264
223b71206888 Initial import
thib
parents:
diff changeset
1265 void AnmPtnSolid::Start(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1266 iterator it;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1267 for (it=pic.begin(); it!=pic.end(); it++)
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1268 (*it)->show();
0
223b71206888 Initial import
thib
parents:
diff changeset
1269 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1270
0
223b71206888 Initial import
thib
parents:
diff changeset
1271 void AnmPtnSolid::Finish(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1272 iterator it;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1273 for (it=pic.begin(); it!=pic.end(); it++)
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1274 (*it)->SetSurfaceAlpha(0, Rect(0,0));
0
223b71206888 Initial import
thib
parents:
diff changeset
1275 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1276
0
223b71206888 Initial import
thib
parents:
diff changeset
1277 void AnmPtnAlpha::Start(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1278 iterator it;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1279 for (it=pic.begin(); it!=pic.end(); it++)
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1280 (*it)->show();
0
223b71206888 Initial import
thib
parents:
diff changeset
1281 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 47
diff changeset
1282
0
223b71206888 Initial import
thib
parents:
diff changeset
1283 void AnmPtnAlpha::Finish(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1284 iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1285 for (it=pic.begin(); it!=pic.end(); it++) (*it)->SetSurfaceAlpha(0, Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
1286 }
223b71206888 Initial import
thib
parents:
diff changeset
1287
223b71206888 Initial import
thib
parents:
diff changeset
1288 /*
223b71206888 Initial import
thib
parents:
diff changeset
1289
223b71206888 Initial import
thib
parents:
diff changeset
1290 Widget ¤Î¼ïÎà
223b71206888 Initial import
thib
parents:
diff changeset
1291 Mouse: ¥Þ¥¦¥¹°ÌÃÖ¤ËϢư¤¹¤ë¡£Surface ¤È origin ¤¬É¬¿Ü
223b71206888 Initial import
thib
parents:
diff changeset
1292 Panel : ¤Ê¤Ë¤â¸ºß¤·¤Ê¤¤¤È¤³¤í¤ËÄ¥¤ê¤Ä¤±¤Æ¤¤¤¯
223b71206888 Initial import
thib
parents:
diff changeset
1293 ÇØ·ÊÄ¥¤ê¤Ä¤±¤â²Äǽ
223b71206888 Initial import
thib
parents:
diff changeset
1294 ButtonPanel : ̵¸ú²½²Äǽ¡£Group ¤Î Button ¤¬¥«¡¼¥½¥ë¤ËÆþ¤Ã¤¿¤é¡¢Á´Button / Label ¤¬¡Ö¥«¡¼¥½¥ë²¼¡×¾õÂ֤ˤʤë
223b71206888 Initial import
thib
parents:
diff changeset
1295 Ʊ°ìÊÑ¿ô¤ò°·¤¦¥Ü¥¿¥ó¤Ï¸¶Â§¡¢Æ±°ìButtonPanel ¤Î²¼¤ËÆþ¤ë¤³¤È¡ÊƱ´ü¤¹¤ë¡£¹â®²½²Äǽ¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
1296 ¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¡¢¥Ü¥¿¥ó¤Î GlobalVariable ¥Õ¥é¥°¤òΩ¤Æ¤ëɬÍפ¬¤¢¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1297 ÇطʼïÎࡧWindow
223b71206888 Initial import
thib
parents:
diff changeset
1298 ÆâÉô¤ÎÆ©ÌÀÅÙ¤ÈÏÈ·Á¤òÊÌ¡¹¤Ë»ØÄê²Äǽ¡£ÏÈ·Á¤ÏÁ´ÏÈ¡¢ÉôʬÏȤɤÁ¤é¤Î·Á¤Ç¤â²Äǽ
223b71206888 Initial import
thib
parents:
diff changeset
1299 ¡ÊÉôʬÏȤʤ顢ÆâÉôŪ¤Ë¤Ï¾åÏÈ¡¢²¼ÏÈ¡¢º¸±¦ÏȤÈÊÌ Surface ¤Ç´ÉÍý¤¹¤ë¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
1300 DragButton
223b71206888 Initial import
thib
parents:
diff changeset
1301 Panel Á´ÂΤò¥É¥é¥Ã¥°¤·¡¢¾ì½êÊѹ¹¤Ç¤­¤ë¥Ü¥¿¥ó¡£
223b71206888 Initial import
thib
parents:
diff changeset
1302 Button: ̵¸ú²½¡äÄ̾ï¡ä¥«¡¼¥½¥ë²¼¡ä¥Ü¥¿¥ó²¡²¼ ¤Îpicture / animation
223b71206888 Initial import
thib
parents:
diff changeset
1303 Toggle Button ¤Ë¤Ç¤­¤ë(Group²½¤¹¤ì¤ÐRadioButton¤Ë¤â¤Ç¤­¤ë)
223b71206888 Initial import
thib
parents:
diff changeset
1304 Label : ̵¸ú²½¡äÄ̾ï¡ä¥«¡¼¥½¥ë²¼¡¡¤Îanimation
223b71206888 Initial import
thib
parents:
diff changeset
1305 animation ¤Ï
223b71206888 Initial import
thib
parents:
diff changeset
1306 ¡¦¾å¤Ø¤ÎÊѲ½
223b71206888 Initial import
thib
parents:
diff changeset
1307 ¡¦²¼¤Ø¤ÎÊѲ½
223b71206888 Initial import
thib
parents:
diff changeset
1308 ¡¦¾ï»þÊÑ·Á
223b71206888 Initial import
thib
parents:
diff changeset
1309 ¤Î£³¤Ä¤Î·Á¼°¤ò¤â¤Ä¡£
223b71206888 Initial import
thib
parents:
diff changeset
1310 ·Á¼°¤Ï
223b71206888 Initial import
thib
parents:
diff changeset
1311 ¡¦x / y increment ¤Ë¤è¤ë¡ÊÁ´Îΰè¤È x,y ¤ÎÂ礭¤µ¤ò»ØÄꤹ¤ë¤Èº¸¾å¤«¤é±¦¾å¡¢º¸²¼¡¢¤È¤¤¤¦Êý¤Ø¾¡¼ê¤ËÎΰè¤òÊѹ¹¤·¤Æ¤¤¤¯¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
1312 ¡¦¿§ÊѲ½¡ÊÌÀÅÙÊѲ½¡Ë¡£¿§¥Æ¡¼¥Ö¥ë¤ò»ØÄꤹ¤ë¡£Surface ¤Ï alpha ¤Î¤ß¤È¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1313 ¤É¤Á¤é¤â¡¢°ì¤Ä¤Î¥é¥Ù¥ë¤Ë»È¤¦»þ´Ö¤ÎŤµ¤ò»ØÄꤹ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1314 ¡¦callback ¤Ë¤è¤ë¡£»ØÄꤷ¤¿°ìÄê»þ´Ö°Ê¾å¤¬Î©¤Ä¤ÈCallBack ¤¬¸Æ¤Ó½Ð¤µ¤ì¡¢¿·¤¿¤ÊSurface , origin ¤ò»ØÄꤹ¤ë¡£
223b71206888 Initial import
thib
parents:
diff changeset
1315
223b71206888 Initial import
thib
parents:
diff changeset
1316 ¡¦Surface ¤Ï
223b71206888 Initial import
thib
parents:
diff changeset
1317 ÉáÄ̤βèÁü
223b71206888 Initial import
thib
parents:
diff changeset
1318 ʸ»úÎó¡ÊŬÅö¤Ë²¾ÁÛ²½¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
1319 ²èÁü¿ôÃÍÎó
223b71206888 Initial import
thib
parents:
diff changeset
1320 ¤Î¤¤¤º¤ì¤«
223b71206888 Initial import
thib
parents:
diff changeset
1321 Cursor
223b71206888 Initial import
thib
parents:
diff changeset
1322 ¥ê¥¿¡¼¥ó¥«¡¼¥½¥ë¡£Label ¤Î°ì¼ï¡£
223b71206888 Initial import
thib
parents:
diff changeset
1323 Number
223b71206888 Initial import
thib
parents:
diff changeset
1324 ¿ô»ú¤òɽ¼¨¤¹¤ë¡£¥Õ¥©¥ó¥È¤ÎÂ礭¤µ¡¢¤â¤·¤¯¤Ï²èÁü¿ôÃÍÎó
223b71206888 Initial import
thib
parents:
diff changeset
1325 Text
223b71206888 Initial import
thib
parents:
diff changeset
1326 ¥Æ¥­¥¹¥È¤òɽ¼¨¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1327 ¥Ñ¥Í¥ë¤ÎÂ礭¤µ¤À¤±»ØÄꤹ¤ë¤ÈŬÅö¤Ë¤ä¤Ã¤Æ¤¯¤ì¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1328 ¥«¡¼¥½¥ë¤Î°ÌÃÖ¡Êʸ»ú¤Î¼¡/ºÇ½ª¡Ë¤ò»ØÄꤹ¤ë¤³¤È
223b71206888 Initial import
thib
parents:
diff changeset
1329 µ¡Ç½¡§Ê¸»úÁ÷¤ê®ÅÙÀßÄê¡¢ÆɤßÈô¤Ð¤·ÀßÄê¡Ê¾ï¤ËºÇ¹â®¤Ç²¡¤·¤Ã¤Ñ¤Ê¤·¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
1330 ProgressBar ¤Ê¤É
223b71206888 Initial import
thib
parents:
diff changeset
1331 ¥Ð¡¼¤ÎŤµ¡¢¤¢¤ë¤¤¤Ï°ÌÃÖ¤ÇÊÑ¿ô¤ÎÂ礭¤µ¤ò¼¨¤¹¡£
223b71206888 Initial import
thib
parents:
diff changeset
1332 Tick, Max ¤ò»ØÄê¡¢ÊÑ¿ô¤ÎÊѲ½¤Ë¤ÏŬÅö¤ËÂбþ¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1333 ¥Ð¡¼¤ÎÊý¸þ¤È¤·¤Æ½Ä/²£¡£Surface ¤Ï·«¤êÊÖ¤·¤Ç»È¤¦¡Ê®Åپ塢32pixel ¤¯¤é¤¤¤¢¤Ã¤¿¤Û¤¦¤¬¤¤¤¤¤«¤â¡©¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
1334 ¥Ð¡¼¤ÎÂå¤ï¤ê¤Ë¥Ü¥¿¥ó¤â»È¤¨¤ë¡£Surface »ØÄê¤Î¥á¥½¥Ã¥É¤¬°ã¤¦¤À¤±¡£
223b71206888 Initial import
thib
parents:
diff changeset
1335 ¥ª¥×¥·¥ç¥ó¡§¥Ð¡¼¤Î¤É¤³¤«¤ò¥¯¥ê¥Ã¥¯¤µ¤ì¤¿¤È¤­¡¢¤½¤³¤Ë°ÜÆ°¤¹¤ë¤«¤½¤³¤Ë¸þ¤«¤Ã¤Æ°ÜÆ°¤¹¤ë¤«
223b71206888 Initial import
thib
parents:
diff changeset
1336 ¥ª¥×¥·¥ç¥ó¡©¡§Ìð°õ¥Ü¥¿¥ó¡Ê¤¤¤é¤Ê¤¤¤«¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
1337 ScrollBar
223b71206888 Initial import
thib
parents:
diff changeset
1338 ²£/½Ä¡£Panel ¤ÈϢư¤¹¤ë(ÀìÍÑ, ProgressBar ¤Î°ì¼ï¤È¤·¤Æ¼ÂÁõ)
223b71206888 Initial import
thib
parents:
diff changeset
1339 (Panel ¦¤Ç¡Ö¸«¤¨¤Ê¤¤Éôʬ¤Ïdelete, ¸«¤¨¤ëÉôʬ¤Ï¼«Æ°¤ÇºîÀ®¡×µ¡Ç½¤ò¤Ä¤±¤ë¡©¡§¥Ð¥Ã¥¯¥í¥°¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
1340
223b71206888 Initial import
thib
parents:
diff changeset
1341
223b71206888 Initial import
thib
parents:
diff changeset
1342
223b71206888 Initial import
thib
parents:
diff changeset
1343 ¥á¥Ë¥å¡¼¤Î½Ð¤·Êý
223b71206888 Initial import
thib
parents:
diff changeset
1344 ±¦¥¯¥ê¥Ã¥¯
223b71206888 Initial import
thib
parents:
diff changeset
1345 ¥Ü¥¿¥ó¤ò²¡¤¹
223b71206888 Initial import
thib
parents:
diff changeset
1346 ¾å¤ÎÊý¡¢±¦¤ÎÊý¤Ê¤ÉÎΰè¤Ë¹Ô¤¯¤È¥Ì¤Ã¤È½Ð¤Æ¤¯¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1347 ¥á¥Ë¥å¡¼¥â¡¼¥ÉÆâ
223b71206888 Initial import
thib
parents:
diff changeset
1348 ¥Ü¥¿¥ó¤ò²¡¤·¤Æ½ªÎ»
223b71206888 Initial import
thib
parents:
diff changeset
1349 ¥Þ¥Ã¥×¤òºî¤Ã¤Æ¤ª¤­¡¢³Æ¥á¥Ë¥å¡¼¤Ë̾Á°¤ò³ä¤ê¿¶¤ë¤ÈÆ󼡸µ¤Ë¹­¤¬¤Ã¤¿¥á¥Ë¥å¡¼¤Ë¤Ê¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1350 ̾Á°¤ò³ä¤ê¿¶¤ë¤È¾å¤Ë̾Á°¥ê¥¹¥È¤¬¤Ç¤Æ¤¯¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1351 ̾Á°¤ò³ä¤ê¿¶¤ë¤È²£¤Ë̾Á°¥ê¥¹¥È¤¬½Ð¤Æ¤¯¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1352
223b71206888 Initial import
thib
parents:
diff changeset
1353 */
223b71206888 Initial import
thib
parents:
diff changeset
1354 // }