Mercurial > otakunoraifu
annotate scn2k/scn2k_text.cc @ 56:c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
* splitted scn2k.h into smaller header files
* moved some definitions from scn2k_*.cc to the header files
* moved opcode implementation to scn2k_*impl.cc
author | thib |
---|---|
date | Thu, 30 Apr 2009 19:05:09 +0000 |
parents | f1a27ee7e03c |
children | 6d9146f56ccf |
rev | line source |
---|---|
0 | 1 /* |
2 TODO: | |
3 ÆüÉդΥé¥Ù¥ë¤¬²èÌÌÀÚ¤êÂؤ¨»þ¤Ë·ç¤±¤ë¤Î¤ò½¤Àµ | |
4 ²èÁü¸ú²Ì : ¿Í´Ö¤ÎÆþ¤ì´¹¤ï¤ê¤Ê¤É | |
5 kcursor ¤ÎÁàºî¤ò WidText ¥¯¥é¥¹¤ËǤ¤»¤ë | |
6 WidText ¥¯¥é¥¹¤Ë¤Ï¿·¤¿¤Ë°Ê²¼¤ÎÁàºî¤ò²Ã¤¨¤ë | |
7 ¡¦¥¦¥§¥¤¥È½ªÎ»¸å¡¢¥¯¥ê¥¢¤Ê¤·¤Ë¿·¤¿¤Ê¥Æ¥¥¹¥È¤òÄɲᢿ·¤¿¤Ëstart-wait¤¹¤ë | |
8 ¡¦Ê¸»ú¤ÎÉÁ²è (Start) ¤È Wait(¥«¡¼¥½¥ëɽ¼¨ÂÔ¤Á)¤ÎʬΥ¡£ | |
9 Start ¤¹¤ë¤Èʸ»ú¤òÉÁ²è³«»Ï¤¹¤ë¡£¥¯¥ê¥Ã¥¯¤ÇÁ´ÉÁ²è¡£ | |
10 Flush ¤¹¤ë¤È¥Ð¥Ã¥Õ¥¡Æâ¤Îʸ»ú¤ò¤¹¤Ù¤ÆÉÁ²è¤¹¤ë | |
11 Wait ¤¹¤ë¤ÈÁ´ÉÁ²è¸å¡¢¥¯¥ê¥Ã¥¯¤µ¤ì¤ë¤Þ¤Ç¥«¡¼¥½¥ë¤òɽ¼¨¤¹¤ë¤Þ¤ÇÂÔ¤Ä | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
12 Text ¦¤Î¾õÂ֤Ȥ·¤Æ¤Ï Wait ¤Î¤ß¤ò»ý¤Ä (PREPARE¤ËÌá¤ë¤Î¤òÂÔ¤Ä) |
0 | 13 ¤¿¤À¤·¡¢Skip ¤Î¸¢Íø¤Ï¤É¤Ã¤Á¤¬¤â¤Ä¡©¡Ê¸½¾õ¤Ï¡©¡Ë |
14 | |
15 GrpObj: NextObj ¤È GrpObj ¤òʬΥ¡£CreateObj ¤Ï¸½¾õÄ̤ꡢVisible=1 »þ¤Ë¹Ô¤¦¡£ | |
16 ¤½¤ì¤¾¤ì num=0 (screen) ¤Î»Þleaf ¤È¤·¤Æ¼ÂÁõ¡£delete»þ¤Ï¿Æ¤Îdelete¤Î¤ß¤ò | |
17 ¹Ô¤¤¡¢»Ò¤ÏGrpObj¤Î¼ÂÂΤÀ¤±¤òºï½ü¤¹¤ë | |
18 Visible ¸å¤Îhide ¤Ï¼ÂºÝ¤Ë hide ¤È¤¹¤ë | |
19 ExecReservedCmd() ¤Ï¤Ê¤¯¤»¤ë¤Ï¤º¡£Delete() ¤â¤Ê¤¯¤Ê¤ë¡£ | |
20 ¥«¥Î¥®¡§ReBlit() ¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤»¤¤¤Ç̾Á°¥¦¥£¥ó¥É¥¦¤¬¾Ã¤¨¤¿»þ¤ÎÇطʤ¬¤Ê¤¯¤Ê¤ë | |
21 | |
22 ¤¯¤é¡§²óÁÛɽ¼¨ | |
23 SEL²èÁü¸ú²Ì | |
24 DONE: | |
25 ¤È¤â¤è¤Î¥Æ¥¥¹¥È¥¦¥£¥ó¥É¥¦¼ÂÁõ¡¢¥Ü¥¿¥ó¼ÂÁõ | |
26 shake ¤Î²èÁü¸ú²Ì | |
27 ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤Î¥Æ¥¥¹¥È¿§¤Î¼ÂÁõ | |
28 ²èÁü¸ú²Ì¤Î²þÁ± | |
29 */ | |
30 | |
31 /* | |
32 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno | |
33 * All rights reserved. | |
34 * | |
35 * Redistribution and use in source and binary forms, with or without | |
36 * modification, are permitted provided that the following conditions | |
37 * are met: | |
38 * 1. Redistributions of source code must retain the above copyright | |
39 * notice, this list of conditions and the following disclaimer. | |
40 * 2. Redistributions in binary form must reproduce the above copyright | |
41 * notice, this list of conditions and the following disclaimer in the | |
42 * documentation and/or other materials provided with the distribution. | |
43 * 3. The name of the author may not be used to endorse or promote products | |
44 * derived from this software without specific prior written permission. | |
45 * | |
46 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
47 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
48 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
49 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
50 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
51 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
52 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
53 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
54 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
55 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
56 */ | |
57 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
58 #include "scn2k_text.h" |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
59 |
52 | 60 #include "system/file.h" |
61 #include "scn2k.h" | |
0 | 62 |
52 | 63 #include <string> |
0 | 64 using namespace std; |
65 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
66 #include "window/render.h" |
0 | 67 |
68 /**************************************************************:: | |
69 ** | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
70 ** Text(implementation) |
0 | 71 */ |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
72 Text::Text(Event::Container& _event, PicContainer& _parent) : |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
73 text(0),status(Text::NORMAL), status_saved(Text::NORMAL), status_mask(Text::NORMAL), ruby_text_flag(false), |
0 | 74 old_time(0), base_time(0), text_window_number(0), text_parsing(false), skip_mode(SKIP_NO), save_selectcount(0), sel_widget(0), |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
75 backlog_widget(0), parent(_parent), event(_event), |
0 | 76 kcursor(0), sel_bg1(0), sel_bg2(0), sel_bg_rect(0,0,0,0) { |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
77 config = AyuSysConfig::GetInstance(); |
0 | 78 int i; |
79 for (i=0; i<32; i++) { | |
80 widgets[i] = 0; | |
81 } | |
82 text_stream.kanji_type = TextStream::sjis; | |
83 event.RegisterGlobalPressFunc(&PressFunc, (void*)this); | |
55 | 84 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
85 RegisterCommand(1, 33, 73, "grpOpenBg", (CmdImpl) &Text::impl_txtClear); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
86 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &Text::impl_txtClear); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
87 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &Text::impl_txtClear); |
55 | 88 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
89 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &Text::impl_logKoe); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
90 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &Text::impl_logKoe); |
55 | 91 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
92 RegisterCommand(0, 3, 151, "msgHide", (CmdImpl) &Text::impl_txtClear); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
93 RegisterCommand(0, 3, 17, "pause", (CmdImpl) &Text::impl_pause); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
94 RegisterCommand(0, 3, 3, "par", (CmdImpl) &Text::impl_br); //FIXME |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
95 RegisterCommand(0, 3, 201, "br", (CmdImpl) &Text::impl_br); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
96 RegisterCommand(0, 3, 1000, "FaceOpen", (CmdImpl) &Text::impl_FaceOpen); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
97 RegisterCommand(0, 3, 1001, "FaceClear", (CmdImpl) &Text::impl_FaceClear); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
98 RegisterCommand(0, 3, 120, "__doruby", (CmdImpl) &Text::impl_doRuby); //FIXME: I don't know how it works |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
99 RegisterCommand(0, 3, 102, "TextWindow", (CmdImpl) &Text::impl_TextWindow); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
100 RegisterCommand(0, 3, 103, "FastText", NULL);//FIXME: (CmdImpl) &Text::impl_FastText); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
101 RegisterCommand(0, 3, 104, "NormalText", NULL); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
102 RegisterCommand(0, 3, 152, "msgClear", (CmdImpl) &Text::impl_msgClear); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
103 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
104 RegisterCommand(0, 2, 1, "select", (CmdImpl) &Text::impl_createSelect); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
105 RegisterCommand(0, 2, 3, "select2?", (CmdImpl) &Text::impl_createSelect); //What difference with select? |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
106 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
107 RegisterCommand(0, 4, 1000, "ShowBackground", (CmdImpl) &Text::impl_ShowBackground); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
108 RegisterCommand(0, 4, 1100, "SetSkipMode", (CmdImpl) &Text::impl_SetSkipMode); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
109 RegisterCommand(1, 4, 100, "wait", (CmdImpl) &Text::impl_Wait); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
110 RegisterCommand(1, 4, 111, "time", (CmdImpl) &Text::impl_Wait); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
111 RegisterCommand(1, 4, 121, "timeEx", (CmdImpl) &Text::impl_Wait); |
0 | 112 } |
113 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
114 Text::~Text() { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
115 if (sel_widget != NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
116 delete sel_widget; |
0 | 117 int i; |
118 for (i=0; i<32; i++) { | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
119 if (widgets[i] != NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
120 delete widgets[i]; |
0 | 121 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
122 if (backlog_widget != NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
123 delete backlog_widget; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
124 if (sel_bg1 != NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
125 parent.Root().DeleteSurface(sel_bg1); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
126 if (sel_bg2 != NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
127 parent.Root().DeleteSurface(sel_bg2); |
0 | 128 event.DeleteGlobalPressFunc(&PressFunc, (void*)this); |
129 } | |
130 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
131 bool Text::PressFunc(int x, int y, void* pointer) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
132 Text* t = (Text*)pointer; |
0 | 133 if (t->status == WAIT_CLICK) { |
134 t->status = WAIT_ABORT; | |
135 } else if (t->status == WAIT_CLICK_MOUSEPOS) { | |
136 t->status = WAIT_CLICK_MOUSEPOSEND_L; | |
137 } else if (t->status_mask & CLEARSCR_WAIT_MASK) { | |
138 t->status_mask = Status(t->status_mask & (~CLEARSCR_WAIT_MASK)); | |
139 if (t->text) t->text->show(); | |
140 if (t->kcursor) { | |
141 if (t->status == WAIT_TEXT) t->kcursor->show(); | |
142 } | |
143 if (t->sel_widget) t->sel_widget->show(); | |
144 if (t->backlog_widget) t->backlog_widget->show(); | |
145 } else if (t->status_mask & BACKLOG_WAIT_MASK) { | |
146 t->status_mask = Status(t->status_mask | BACKLOG_MASK_KOE); | |
147 } else if ( (t->skip_mode & SKIP_TEXT) && (!(t->skip_mode & SKIP_IN_MENU)) ) { | |
148 if (t->status == WAIT_SELECT_INBOX) ; | |
149 else if (t->status == WAIT_SELECT_OUTBOX) ; | |
150 else if (t->status == WAIT_SELECT_VALUE) ; | |
151 else t->status_mask = Status(t->status_mask | SKIPEND_MASK); | |
152 } | |
153 return true; // event not deleted | |
154 } | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
155 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
156 void Text::PressFuncButton(void* pointer, WidButton* from) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
157 Text* t = (Text*)pointer; |
0 | 158 if (t->status != WAIT_SELECT_INBOX && t->status != WAIT_SELECT_OUTBOX) return; |
159 vector<WidTextButton*>::iterator it; | |
160 int sel = 0; | |
161 for (it=t->selects.begin(); it != t->selects.end(); it++, sel++) { | |
162 if (from == *it) break; | |
163 } | |
164 if (it == t->selects.end()) { | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
165 fprintf(stderr,"Text::PressFuncButton: Cannot find select widget\n"); |
0 | 166 return; |
167 } | |
168 t->status = Status(WAIT_SELECT_VALUE + sel); | |
169 } | |
170 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
171 void Text::SetSkipMode(SkipMode _mode) { |
0 | 172 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) { |
173 if (status_mask & BACKLOG_WAIT_MASK) { // backlog mode ¤«¤éÉüµ¢ | |
174 status_mask = Status(status_mask & (~(BACKLOG_MASK|BACKLOG_MASK_FWD|BACKLOG_MASK_KOE|BACKLOG_WAIT_MASK))); | |
175 text->wid->Clear(); | |
52 | 176 if (status == WAIT_TEXT && text != NULL) { |
0 | 177 text->StartText(text_stream); |
178 text->ShowFace(backlog_item.face.c_str()); | |
179 text->wid->Flush(); | |
180 if (kcursor) kcursor->show(); | |
181 } | |
182 drawn_backlog_item.Clear(); | |
183 } | |
184 if (text) text->wid->activate(); | |
185 if (sel_widget) { | |
186 sel_widget->show(); | |
187 if (kcursor) kcursor->hide(); | |
188 } | |
189 if (backlog_widget) backlog_widget->show(); | |
190 if (status_mask & STATSAVE_MASK) { | |
191 status_mask = Status(status_mask & (~STATSAVE_MASK)); | |
192 status = status_saved; | |
193 } | |
194 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) { | |
195 if (text) text->wid->deactivate(); | |
196 if (sel_widget) sel_widget->hide(); | |
197 if (backlog_widget) backlog_widget->hide(); | |
198 } | |
199 skip_mode = _mode; | |
200 } | |
201 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
202 void Text::InitWindow(void) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
203 int i; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
204 int w; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
205 std::string str; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
206 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
207 for (w=0; w<32; w++) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
208 widgets[w] = new TextWindow(parent, event, w, (void*)this); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
209 if (widgets[w]->wid == 0) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
210 delete widgets[w]; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
211 widgets[w] = NULL; |
0 | 212 } |
213 } | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
214 SetCursor(0); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
215 for (i=0; i<26; i++) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
216 char buf[1024]; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
217 sprintf(buf, "#NAME.%c", i+'A'); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
218 const char* s = config->GetParaStr(buf); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
219 if (s != NULL) replace_name[i] = s; |
0 | 220 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
221 // replace_name2 : ½é´üÀßÄê |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
222 // ½í¡¢½©À¸¡¢½í (CLANNAD) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
223 char name_nagisa[3] = {'\x8f', '\x8d', '\0'}; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
224 char name_akio[5] = {'\x8f', '\x48', '\x90', '\xb6', '\0'}; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
225 replace_name2[0] = name_nagisa; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
226 replace_name2[1] = name_akio; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
227 replace_name2[2] = name_nagisa; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
228 text = NULL; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
229 /* ¥Æ¥¥¹¥È®ÅÙ¤ÎÀßÄê */ |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
230 int speed, mod, wait, auto_mod; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
231 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
232 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &mod); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
233 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &auto_mod); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
234 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &wait); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
235 if (mod) speed = -1; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
236 if (!auto_mod) wait = -1; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
237 SetTextSpeed(speed); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
238 SetTextWait(wait); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
239 } |
52 | 240 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
241 void Text::Save(string& str, bool rollback_save) { |
0 | 242 char buf[1024]; |
243 str = "\n"; | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
244 str += "[Text Window]\n"; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
245 sprintf(buf, "TextWindow=%d\n",text_window_number); |
0 | 246 str += buf; |
247 if (rollback_save) { | |
248 ++save_selectcount; | |
249 BacklogItem save_item; | |
250 save_item.SetSavepos(save_selectcount); | |
251 backlog.push_back(save_item); | |
252 } | |
253 sprintf(buf, "SaveSelectCount=%d\n",save_selectcount); | |
254 | |
255 str += buf; | |
256 int i; | |
257 for (i=0; i<26; i++) { | |
258 if (replace_name2[i].empty()) continue; | |
259 sprintf(buf, "RName.%c=%s\n",i+'A',replace_name2[i].c_str()); | |
260 str += buf; | |
261 } | |
262 int cnt = 0; | |
263 vector<BacklogItem>::iterator it; | |
264 it = backlog.begin(); | |
265 if (!rollback_save) { | |
266 SaveFaceHash face_log; | |
267 do { | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
268 int cur_scn = -1; int cur_pos = -1; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
269 sprintf(buf, "Backlog.%d=",++cnt); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
270 str += buf; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
271 for (; it != backlog.end(); it++) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
272 buf[0] = 0; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
273 int buflen = 0; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
274 if (it->scn == -1) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
275 continue; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
276 if (it->pos == -1 && it->scn != 0) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
277 continue; |
0 | 278 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
279 buf[buflen++] = ';'; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
280 if (it->scn == 0 && it->pos == -1) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
281 buflen += snprintf(buf+buflen, 1000-buflen, "\"%s\".", it->text.Save().c_str()); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
282 else { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
283 if (cur_scn != -1 && cur_scn != it->scn) break; // scn change |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
284 if (cur_pos != -1 && cur_pos/5000 != it->pos/5000) break; // pos exceeded |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
285 if (!it->text.container.empty()) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
286 buflen += snprintf(buf+buflen, 1000-buflen, "\"%s\"", it->text.Save().c_str()); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
287 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
288 if (cur_scn == -1) { // scene change |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
289 buflen += snprintf(buf+buflen, 1000-buflen, ":%d:%d",it->scn,it->pos); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
290 cur_scn = it->scn; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
291 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
292 else |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
293 buflen += snprintf(buf+buflen, 1000-buflen, "%d",it->pos); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
294 cur_pos = it->pos; |
0 | 295 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
296 if (it->koe != -1) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
297 buflen += snprintf(buf+buflen, 1000-buflen, ",%d",it->koe); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
298 if (!it->face.empty()) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
299 if (it->koe == -1) buf[buflen++] = ','; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
300 int face_num = face_log.Add(it->face); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
301 if (face_num >= 0 && face_num < 20) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
302 buflen += snprintf(buf+buflen, 1000-buflen, ",%c", 'A'+face_num); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
303 else |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
304 buflen += snprintf(buf+buflen, 1000-buflen, ",\"%s\"", it->face.c_str()); |
0 | 305 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
306 buf[buflen++] = '\0'; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
307 if (buflen >= 1000) { // Ëü¤¬°ì¡¢¥Ð¥Ã¥¯¥í¥°£±¥¢¥¤¥Æ¥à¤ÎÂ礤µ¤¬ 1000byte ¤ò±Û¤¨¤ë¤È¤ |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
308 fprintf(stderr,"Fatal : Cannot save backlog crrectly; Please send bug report to the author.\n"); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
309 } else str += buf; |
0 | 310 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
311 str += "\n"; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
312 } while(it != backlog.end()); |
0 | 313 } |
314 } | |
52 | 315 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
316 void Text::Load(const char* str) { |
0 | 317 if (text) text->wid->Clear(); |
318 hide(); | |
319 text_window_number = 0; | |
320 save_selectcount = 0; | |
52 | 321 if (sel_widget != NULL) { |
0 | 322 selects.clear(); |
323 sel_backlog_pos.clear(); | |
324 delete sel_widget; | |
52 | 325 sel_widget = NULL; |
0 | 326 } |
52 | 327 if (backlog_widget != NULL) { |
0 | 328 delete backlog_widget; |
52 | 329 backlog_widget = NULL; |
0 | 330 } |
331 status = NORMAL; | |
332 status_mask = NORMAL; | |
333 status_saved = NORMAL; | |
334 text_parsing = false; | |
335 text_stream.Clear(); | |
336 // backlog.clear(); | |
337 vector<BacklogItem> new_backlog; | |
338 backlog_item.Clear(); | |
339 cur_backlog_item.Clear(); | |
340 drawn_backlog_item.Clear(); | |
341 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
342 str = strstr(str, "\n[Text Window]\n"); |
0 | 343 |
344 if (str) { | |
345 SaveFaceHash face_log; | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
346 str += strlen("\n[Text Window]\n"); |
0 | 347 const char* strend = str; |
348 do { | |
349 str = strend; | |
350 | |
351 strend = strchr(str, '\n'); | |
52 | 352 if (strend == NULL) strend = str + strlen(str); |
0 | 353 else strend++; |
354 | |
355 if (str[0] == '[') break; // next section | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
356 if (strncmp(str, "TextWindow=",15) == 0) { |
0 | 357 str += 15; |
358 sscanf(str, "%d", &text_window_number); | |
359 } else if (strncmp(str, "SaveSelectCount=",16) == 0) { | |
360 str += 16; | |
361 sscanf(str, "%d", &save_selectcount); | |
362 } else if (strncmp(str, "RName.", 6) == 0) { | |
363 int n = str[6]-'A'; | |
364 if (n >= 0 && n < 26 && str[7] == '=') { | |
365 const char* s = strchr(str, '\n'); | |
366 int len = -1; | |
367 if (s) len = s-(str+8); | |
368 if (len > 0) { | |
369 replace_name2[n].assign(str+8, len); | |
370 } | |
371 } | |
372 } else if (strncmp(str, "Backlog.", 8) == 0) { | |
373 int cur_scn = -1; | |
374 int n = -1; | |
375 sscanf(str+8, "%d", &n); /* not used */ | |
376 const char* next_str = strchr(str, ';'); | |
52 | 377 while(next_str != NULL && next_str < strend) { |
0 | 378 str = next_str + 1; |
379 next_str = strchr(str, ';'); | |
52 | 380 if (next_str == NULL) next_str = strend; |
0 | 381 |
382 BacklogItem item; | |
383 if (str[0] == '"') { | |
384 const char* send = strchr(str+1, '"'); | |
52 | 385 if (send == NULL || send > next_str) continue; |
0 | 386 string tmp_str; tmp_str.assign(str+1, send-str-1); |
387 item.DeleteTextPos(); | |
388 item.text.Load(tmp_str); | |
389 str = send + 1; | |
390 } | |
391 if (str[0] == '.') { | |
392 item.DeleteTextPos(); | |
393 str++; | |
394 } else if (str[0] == ':') { | |
395 sscanf(str, ":%d:%d", &item.scn, &item.pos); | |
396 cur_scn = item.scn; | |
397 | |
398 } else { | |
399 item.scn = cur_scn; | |
400 sscanf(str, "%d", &item.pos); | |
401 } | |
402 str = strchr(str, ','); | |
52 | 403 if (str == NULL || str > next_str) goto backlog_store; |
0 | 404 str++; |
405 if (str[0] == ';' || str[0] == ',') | |
406 item.koe = -1; | |
407 else | |
408 sscanf(str, "%d", &item.koe); | |
409 str = strchr(str, ','); | |
52 | 410 if (str == NULL || str > next_str) goto backlog_store; |
0 | 411 str++; |
412 if (*str == '"') { | |
413 const char* send = strchr(str+1, '"'); | |
414 if (send) { | |
415 item.face.assign(str+1, send-str-1); | |
416 } | |
417 } else if (*str >= 'A' && *str <= 'Z') { | |
418 item.face = face_log.Get(*str - 'A'); | |
419 } | |
420 face_log.Add(item.face); | |
421 backlog_store: | |
422 new_backlog.push_back(item); | |
423 } | |
424 } | |
425 } while (*strend != 0); | |
426 } | |
427 if (new_backlog.empty() && (!backlog.empty())) { // empty ¤Ê¤é save_selectcount ¤Þ¤Ç backlog ¤ò´¬¤Ì᤹ | |
428 vector<BacklogItem>::iterator it = backlog.end(); | |
429 do { | |
430 it--; | |
431 if (it->scn == BacklogItem::SaveSelect && it->pos == save_selectcount) { | |
432 // Save °ÌÃÖ¤ò¸«¤Ä¤±¤¿¤é¤½¤ì°Ê¹ß¤ò erase | |
433 backlog.erase(it, backlog.end()); | |
434 break; | |
435 } | |
436 } while(it != backlog.begin()); | |
437 --save_selectcount; | |
438 } else { | |
439 backlog.swap(new_backlog); | |
440 } | |
441 // backlog.clear(); | |
442 } | |
443 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
444 void Text::hide(void) { |
0 | 445 if (text) text->hide(); |
446 if (kcursor) kcursor->hide(); | |
52 | 447 text = NULL; |
0 | 448 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
449 void Text::show(int num) { |
0 | 450 if (num != text_window_number) { |
451 hide(); | |
452 if (num >= 0 && num < 32 && widgets[num] != 0) { | |
453 text_window_number = num; | |
454 } | |
455 } | |
456 text = widgets[text_window_number]; | |
457 text->show(); | |
458 if (kcursor) { | |
459 int kx, ky, d; | |
460 char key[1024]; | |
461 sprintf(key, "#WINDOW.%03d.KEYCUR_MOD", text_window_number); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
462 config->GetParam(key, 3, &d, &kx, &ky); |
0 | 463 // Àµ¤·¤¯¤Ê¤¤µ¤¤¬¤¹¤ë |
464 kx += text->wid->Pic()->PosX(); | |
465 ky += text->wid->Pic()->PosY(); | |
466 // Èù̯¤Ë²¼¤Ë¤¹¤ë | |
467 ky += 8; | |
468 kcursor->Pic()->Move(kx, ky); | |
469 } | |
470 } | |
52 | 471 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
472 void Text::DrawBacklog(BacklogItem& item, Cmd& cmd) { |
18 | 473 show(); |
0 | 474 text->wid->deactivate(); |
475 status_mask = Status(status_mask | BACKLOG_WAIT_MASK); | |
476 drawn_backlog_item = item; | |
477 if (item.text.container.empty()) { | |
478 // cmd ¤«¤é text ÆâÍƤòºÆ¹½À® | |
479 TextStream saved_text = text_stream; | |
480 text_stream.Clear(); | |
481 AddText(cmd.Str(cmd.args[0])); | |
482 item.text = text_stream; | |
483 text_stream = saved_text; | |
484 } | |
18 | 485 item.text.InsertColor(0, item.text.container.size(), 0xff,0xff,0); |
17 | 486 text->StartText(item.text); |
0 | 487 text->wid->Flush(); |
488 if (item.face.empty()) text->ResetFace(); | |
489 else text->ShowFace(item.face.c_str()); | |
490 if (kcursor) kcursor->hide(); | |
491 } | |
492 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
493 void Text::CreateSelBG(void) { |
52 | 494 if (sel_bg1 != NULL || sel_bg2 != NULL) return; |
0 | 495 |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
496 const char* btnfile1 = config->GetParaStr("#SELBTN.000.NAME"); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
497 const char* btnfile2 = config->GetParaStr("#SELBTN.000.BACK"); |
0 | 498 char path[1024]; |
499 strcpy(path, btnfile1); | |
500 sel_bg1 = parent.Root().NewSurface(path); | |
52 | 501 if (sel_bg1 == NULL) { |
0 | 502 sprintf(path,"%s.g00",btnfile1); |
503 sel_bg1 = parent.Root().NewSurface(path); | |
504 } | |
505 strcpy(path, btnfile2); | |
506 sel_bg2 = parent.Root().NewSurface(path); | |
52 | 507 if (sel_bg2 == NULL) { |
0 | 508 sprintf(path,"%s.g00",btnfile2); |
509 sel_bg2 = parent.Root().NewSurface(path); | |
510 } | |
511 sel_bg_rect = Rect(0,0,0,0); | |
512 if (sel_bg1) sel_bg_rect.join(Rect(*sel_bg1)); | |
513 if (sel_bg2) sel_bg_rect.join(Rect(*sel_bg2)); | |
514 } | |
515 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
516 void Text::CreateSelect(Cmd& cmd) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
517 char key[23]; |
0 | 518 sprintf(key, "#WINDOW.%03d.SELCOM_USE",text_window_number); |
519 int sel_type = 0; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
520 if (cmd.cmd3 == 1) config->GetParam(key, 1, &sel_type); |
38
658272d883ed
* Support (more or less) button style selects (fuuko's ones)
thib
parents:
18
diff
changeset
|
521 else if (cmd.cmd3 == 3) sel_type = 0; |
0 | 522 |
523 int sel_size = cmd.args.size() / 2; | |
524 int i; | |
525 // cur_backlog_item ¤Ë¼¡¤Ëbacklog¤ËÆþ¤ë¤Ù¤ÆâÍƤòºîÀ® | |
526 // CreateSelect() ¸å¡¢SAVEPOINT ¤Ê¤Î¤Ç¸½ºß¤Îbacklog¤ÎÆâÍÆ(Á°¤Î¥á¥Ã¥»¡¼¥¸)¤¬ | |
527 // backlog ¤ËÂåÆþ¤µ¤ì¤ë¡£¤½¤Î¸å¡¢backlog_item ¤Ë cur_backlog_item ¤ÎÆâÍƤ¬¥»¥Ã¥È¤µ¤ì¤ë(Wait()Æâ) | |
528 char backlog_sel_text[11] = {0x81,0x69,0x91,0x49,0x91,0xf0,0x8e,0x88,0x81,0x6a,0x00}; | |
529 cur_backlog_item.Clear(); | |
530 cur_backlog_item.AddTextPos(cmd); | |
531 cur_backlog_item.text.Add(backlog_sel_text); | |
532 cur_backlog_item.text.AddReturn(); | |
533 sel_backlog_pos.clear(); | |
534 for (i=0; i<sel_size; i++) { | |
535 sel_backlog_pos.push_back(cur_backlog_item.text.container.size()); | |
536 cur_backlog_item.text.Add(cmd.Str(cmd.args[i*2])); | |
537 cur_backlog_item.text.AddReturn(); | |
538 } | |
539 sel_backlog_pos.push_back(cur_backlog_item.text.container.size()); | |
540 | |
541 if (sel_type == 0) { // Princess Bride: ÁªÂò¥¦¥£¥ó¥É¥¦¤òÊÌɽ¼¨ | |
542 External_select: | |
543 CreateSelBG(); | |
544 hide(); // ¤Ê¤Î¤Ç¡¢¥Æ¥¥¹¥È¥¦¥£¥ó¥É¥¦¤Ï¾Ãµî | |
40 | 545 int baseposx, baseposy, repposx, repposy, centerx, centery; |
0 | 546 int mojisize, col1, col2; |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
547 config->GetParam("#SELBTN.000.CENTERING", 2, ¢erx, ¢ery); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
548 config->GetParam("#SELBTN.000.BASEPOS", 2, &baseposx, &baseposy); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
549 config->GetParam("#SELBTN.000.REPPOS", 2, &repposx, &repposy); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
550 config->GetParam("#SELBTN.000.MOJISIZE", 1, &mojisize); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
551 config->GetParam("#SELBTN.000.MOJIDEFAULTCOL", 1, &col1); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
552 config->GetParam("#SELBTN.000.MOJISELECTCOL", 1, &col2); |
0 | 553 if (col1 == col2) col2 = 1; // CLANNAD ¤Ç¤È¤ê¤¢¤¨¤º¡£ |
554 int r, g, b; | |
555 sprintf(key, "#COLOR_TABLE.%03d", col1); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
556 config->GetParam(key, 3, &r, &g, &b); |
0 | 557 Color fore(r,g,b); |
558 sprintf(key, "#COLOR_TABLE.%03d", col2); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
559 config->GetParam(key, 3, &r, &g, &b); |
0 | 560 Color seled(r,g,b); |
561 | |
562 /* ¥¦¥£¥¸¥Ã¥ÈºîÀ® */ | |
563 /* ¥¦¥£¥ó¥É¥¦ÇطʤÎÂ礤µ¤òµá¤á¤ë */ | |
564 if (baseposx == 0 && sel_bg_rect.width() != 0) | |
565 baseposx = (parent.Width()-sel_bg_rect.width()) / 2; // ¥Ü¥¿¥ó°ÌÃÖ¤ò¥»¥ó¥¿¥ê¥ó¥° | |
40 | 566 if (centerx) |
567 baseposx = (parent.Width()-sel_bg_rect.width()-sel_size*repposx) / 2; | |
568 if (centery) | |
569 baseposy = (parent.Height()-sel_bg_rect.height()-sel_size*repposy) / 2; | |
0 | 570 |
571 sel_widget = parent.create_node( Rect(0, 0, parent.Width(), parent.Height()),0); | |
572 | |
573 for (i=0; i<sel_size; i++) { | |
574 PicBase* p; | |
575 // ÇطʺîÀ® | |
576 if (sel_bg2) { | |
577 p = sel_widget->create_node(Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()),0); | |
578 p->SetSurface(sel_bg2, 0, 0); | |
579 } | |
580 if (sel_bg1) { | |
581 p = sel_widget->create_node(Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()),0); | |
582 p->SetSurface(sel_bg1, 0, 0); | |
583 } | |
584 /* ¥Ü¥¿¥óºîÀ® */ | |
585 const char* str = cmd.Str(cmd.args[i*2]); | |
586 int value = cmd.args[i*2+1].value; | |
587 while(selects.size() <= value) selects.push_back(0); // vector ¤ÎÂ礤µ¤ò¹¤²¤ë | |
588 | |
589 kconv( (const unsigned char*)str, (unsigned char*)key); | |
590 selects[value] = new WidTextButton(event, sel_widget, key, mojisize, WidTextButton::CENTER, | |
591 Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()), 1, fore, seled, Color(0,0,0,0)); | |
592 selects[value]->press_func = &PressFuncButton; | |
593 selects[value]->press_pointer = (void*)this; | |
594 | |
595 baseposx += repposx; | |
596 baseposy += repposy; | |
597 } | |
598 sel_widget->show_all(); | |
599 status = WAIT_SELECT_OUTBOX; | |
600 } else { // CLANNAD: ¥Æ¥¥¹¥È¥¦¥£¥ó¥É¥¦Æâ¤ËÁªÂò»èɽ¼¨ | |
601 int mojisize; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
602 config->GetParam("#SELBTN.000.MOJISIZE", 1, &mojisize); |
0 | 603 Color fore(0xff,0xff,0xff); |
604 Color seled(0xff,0xff,0xff); | |
605 | |
606 show(); | |
52 | 607 if (text == NULL) goto External_select; // ¥Æ¥¥¹¥È¡¦¥¦¥£¥ó¥É¥¦¤òɽ¼¨¤Ç¤¤Ê¤±¤ì¤Ð³°ÉôÁªÂò»è¤Ë¤¹¤ë |
0 | 608 text->wid->Clear(); |
609 if (kcursor) kcursor->hide(); | |
610 /* ¥¦¥£¥¸¥Ã¥ÈºîÀ® : ¥Æ¥¥¹¥Èɽ¼¨ÈϰϤÈƱ¤¸*/ | |
611 int posx = text->wid->pictext->PosX(); | |
612 int posy = text->wid->pictext->PosY(); | |
613 int sel_w = text->wid->pictext->Width(); | |
614 int sel_h = text->wid->pictext->Height(); | |
615 sel_widget = text->wid->PicNode()->create_node(Rect(posx, posy, posx+sel_w, posy+sel_h), 0); | |
616 | |
617 int sel_y = 0; | |
618 for (i=0; i<sel_size; i++) { | |
619 /* ¥Ü¥¿¥óºîÀ® */ | |
620 const char* str = cmd.Str(cmd.args[i*2]); | |
621 int value = cmd.args[i*2+1].value; | |
622 while(selects.size() <= value) selects.push_back(0); // vector ¤ÎÂ礤µ¤ò¹¤²¤ë | |
623 | |
624 kconv( (const unsigned char*)str, (unsigned char*)key); | |
625 selects[value] = new WidTextButton(event, sel_widget, key, mojisize, WidTextButton::Attribute(WidTextButton::REVERSE | WidTextButton::NOPADDING), | |
626 Rect(0, sel_y, sel_w, sel_y), 1, fore, seled, Color(0,0,0,0)); | |
627 selects[value]->press_func = &PressFuncButton; | |
628 selects[value]->press_pointer = (void*)this; | |
629 | |
630 sel_y += selects[value]->Pic()->Height() + 1; | |
631 } | |
632 sel_widget->show_all(); | |
633 status = WAIT_SELECT_INBOX; | |
634 } | |
635 } | |
636 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
637 void Text::AddText(const char* str_o) { |
0 | 638 char str[10001]; |
52 | 639 if (text == NULL) return; |
0 | 640 /* ¤Þ¤º¡¢replace string ¤òÊÑ´¹ */ |
641 int i; | |
642 int cnt = 0; | |
643 /* ¡ö = 81 96 A-Z = 0x82 [0x60-0x79] */ | |
644 /* ¡ó = 81 93 A-Z = 0x82 [0x60-0x79] */ | |
645 for (i=0; cnt<10000 && str_o[i] != 0; i++) { | |
646 if (str_o[i] < 0) { | |
647 if ( (unsigned char)str_o[i] == 0x81 && (unsigned char)str_o[i+1] == 0x96 && (unsigned char)str_o[i+2] == 0x82) { | |
648 int c = str_o[i+3]; | |
649 if (c >= 0x60 && c <= 0x79 && replace_name[c-0x60].length() != 0) { // ̾Á°ÊÑ´¹ | |
650 i += 3; | |
651 strcpy(str+cnt, replace_name[c-0x60].c_str()); | |
652 cnt += replace_name[c-0x60].length(); | |
653 continue; | |
654 } | |
655 } else if ( (unsigned char)str_o[i] == 0x81 && (unsigned char)str_o[i+1] == 0x93 && (unsigned char)str_o[i+2] == 0x82) { | |
656 int c = str_o[i+3]; | |
657 if (c >= 0x60 && c <= 0x79 && replace_name2[c-0x60].length() != 0) { // ̾Á°ÊÑ´¹£² | |
658 i += 3; | |
659 strcpy(str+cnt, replace_name2[c-0x60].c_str()); | |
660 cnt += replace_name2[c-0x60].length(); | |
661 continue; | |
662 } | |
663 } | |
664 str[cnt++] = str_o[i++]; | |
665 } | |
666 str[cnt++] = str_o[i]; | |
667 } | |
668 str[cnt] = 0; | |
669 str[10000] = 0; | |
670 char* str_top = str; | |
671 | |
672 for (char* s = str_top; *s != 0; s++) { | |
673 // if (*(unsigned char*)s == 0xa1 && *(unsigned char*)(s+1) == 0xda) { /* euc */ | |
674 if (*(unsigned char*)s == 0x81 && *(unsigned char*)(s+1) == 0x79) { /* sjis */ | |
675 // ̾Á° | |
676 *s = 0; | |
677 if (s != str_top) text_stream.Add(str_top); | |
678 s += 2; | |
679 char* name_top = s; | |
680 for (; *s != 0; s++) { | |
681 // if (*(unsigned char*)s == 0xa1 && *(unsigned char*)(s+1) == 0xdb) { /* euc */ | |
682 if (*(unsigned char*)s == 0x81 && *(unsigned char*)(s+1) == 0x7a) { /* sjis */ | |
683 *s = 0; | |
684 s += 2; | |
685 text_stream.AddName(name_top); | |
686 break; | |
687 } | |
688 if (*s < 0 && s[1] != 0) s++; // Á´³Ñʸ»ú¤Ê¤é£²»úÈô¤Ð¤¹ | |
689 } | |
690 str_top = s; | |
691 } | |
692 if (*s == 0x0a) { | |
693 *s = 0; | |
694 text_stream.Add(str_top); | |
695 text_stream.AddReturn(); | |
696 str_top = s; | |
697 } else if (*s < 0 && s[1] != 0) s++; | |
698 } | |
699 text_stream.Add(str_top); | |
700 } | |
701 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
702 void Text::Exec(Cmd& cmd) { |
0 | 703 if (cmd.cmd_type == CMD_TEXT) { |
52 | 704 if (text == NULL) { |
0 | 705 show(); |
706 } | |
707 if (cmd.args.size() != 1) return; | |
708 if (ruby_text_flag) { | |
709 ruby_text = cmd.Str(cmd.args[0]); | |
710 ruby_text_flag = 0; | |
711 cmd.clear(); | |
712 return; | |
713 } | |
714 cur_backlog_item.AddTextPos(cmd); | |
715 AddText(cmd.Str(cmd.args[0])); | |
716 char debug[1024]; | |
717 kconv( (unsigned char*)cmd.Str(cmd.args[0]), (unsigned char*)debug); | |
718 eprintf("text: %s\n",debug); | |
719 if (text_parsing) | |
720 cmd.clear(); | |
721 else | |
722 cmd.cmd_type = CMD_SAVEPOINT; | |
723 text_parsing = true; /* ¥Æ¥¥¹¥ÈÂÔ¤Áľ¸å¤Î¥Æ¥¥¹¥È°ÌÃ֡᥻¡¼¥Ö°ÌÃÖ */ | |
724 return; | |
725 } | |
55 | 726 |
0 | 727 if (cmd.cmd_type != CMD_OTHER) return; |
55 | 728 |
729 CommandHandler::Exec(cmd); | |
730 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
731 if (cmd.cmd1 == 1 && cmd.cmd2 == 4) { |
0 | 732 /* ¥¦¥§¥¤¥È´ØϢ̿Îá */ |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
733 if (cmd.cmd3 == 0x65 || cmd.cmd3 == 0x70) { |
0 | 734 eprintf("wait %dmsec(click stop)\n",cmd.args[0].value); |
735 if (cmd.cmd3 == 0x70) wait_time = base_time + cmd.args[0].value; | |
736 else wait_time = old_time + cmd.args[0].value; | |
737 status = WAIT_CLICK; | |
738 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // ²èÁüÉÁ²è¤ËÌá¤ë(skip»þ¤Ë¥Æ¥¥¹¥È¤¬ÉÁ²è¤µ¤ì¤ä¤¹¤¯¤¹¤ë¤¿¤á) | |
739 } else if (cmd.cmd3 == 0x83) { | |
740 /* ¥Þ¥¦¥¹¤¬¥¯¥ê¥Ã¥¯¤µ¤ì¤ë¤Þ¤ÇÂÔ¤Ä */ | |
741 eprintf("wait and get mouse pos at click\n"); | |
742 wait_time = old_time + 1000 * 1000; | |
743 status = WAIT_CLICK_MOUSEPOS; | |
744 wait_savedvar[0] = cmd.args[0]; | |
745 wait_savedvar[1] = cmd.args[1]; | |
746 cmd.clear(); | |
747 } else if (cmd.cmd3 == 0x1fe) { | |
748 eprintf("get timer value[%d]\n",cmd.args[0].value); | |
749 if (timer_var.find(cmd.args[0].value) == timer_var.end()) { | |
750 cmd.SetSysvar(0); | |
751 } else { | |
752 TimerAtom& atom = timer_var[cmd.args[0].value]; | |
753 if (atom.total_time <= 0) atom.total_time = 1; | |
754 int cur_tm = old_time - atom.start_time; | |
755 if (cur_tm < 0) cur_tm = atom.total_time; // ¥¨¥é¡¼¤Ê¤éºÇ½ª»þ´Ö¤Ë¹ç¤ï¤»¤ë | |
756 if (cur_tm > atom.total_time) cur_tm = atom.total_time; | |
757 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit. | |
758 int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time); | |
759 cmd.SetSysvar(v); | |
760 } | |
761 /* From rldev-1.40, reallive.kfn | |
762 0x72 fun Timer (store) <1:Sys:00114, 1> ('counter') () | |
763 0x73 fun CmpTimer (store) <1:Sys:00115, 1> ('time') ('time', 'counter') | |
764 0x74 fun SetTimer <1:Sys:00116, 1> ('time') ('time', 'counter') | |
765 | |
766 0x78 fun ResetExTimer <1:Sys:00120, 1> ('counter') () | |
767 0x79 fun timeEx <1:Sys:00121, 1> ('time') ('time', 'counter') | |
768 0x7a fun timeExC (store) <1:Sys:00122, 1> ('time') ('time', 'counter') | |
769 0x7b fun timeExC2 (store) <1:Sys:00123, 1> ('time') ('time', 'counter') // UNDOCUMENTED | |
770 0x7c fun ExTimer (store) <1:Sys:00124, 1> ('counter') () | |
771 0x7d fun CmpExTimer (store) <1:Sys:00125, 1> ('time') ('time', 'counter') | |
772 0x7e fun SetExTimer <1:Sys:00126, 1> ('time') ('time', 'counter') | |
773 */ | |
774 | |
775 } else if (cmd.cmd3 == 0x6e || cmd.cmd3 == 0x78) { // set basetime | |
776 if (cmd.cmd4 == 1) { | |
777 eprintf("set basetime\n"); | |
778 base_time = old_time; | |
779 cmd.clear(); | |
780 } else if (cmd.cmd4 == 0) { // n-th base time | |
781 int index = cmd.args[0].value; | |
782 eprintf("set basetime (%d)\n",index); | |
783 TimerAtom& atom = timer_var[index]; | |
784 atom.from = 0; | |
785 atom.to = 0; | |
786 atom.total_time = 0; | |
787 atom.start_time = old_time; | |
788 cmd.clear(); | |
789 } | |
790 } else if (cmd.cmd3 == 0x72 || cmd.cmd3 == 0x7c) { // get time | |
791 if (cmd.cmd4 == 1) { // get time | |
792 eprintf("get time\n"); | |
793 cmd.SetSysvar(old_time - base_time); | |
794 } else if (cmd.cmd4 == 0) { // n-th get time | |
795 int index = cmd.args[0].value; | |
796 eprintf("get time %dth\n",index); | |
797 if (timer_var.find(index) == timer_var.end()) cmd.SetSysvar(0); | |
798 else cmd.SetSysvar(old_time - timer_var[index].start_time); | |
799 } | |
800 } else if (cmd.cmd3 == 0x26c || cmd.cmd3 == 0x270) { // set basetime(multi) | |
801 int j = 0; | |
802 eprintf("set basetime\n"); | |
803 int i; for (i=0; i<cmd.argc; i++) { | |
804 int cnt = cmd.args[j++].value; // £³¤Ê¤Î¤Ç̵»ë | |
805 int num = cmd.args[j++].value; | |
806 TimerAtom& atom = timer_var[num]; | |
807 atom.from = cmd.args[j++].value; | |
808 atom.to = cmd.args[j++].value; | |
809 atom.total_time = cmd.args[j++].value; | |
810 atom.start_time = old_time; | |
811 } | |
812 cmd.clear(); | |
813 } else if (cmd.cmd3 == 0x276) { // get time (multi) | |
814 eprintf("get timer value\n"); | |
815 vector<VarInfo> args = cmd.args; | |
816 vector<VarInfo>::iterator it = args.begin(); | |
817 int argc = cmd.argc; | |
818 int active_timers = 0; | |
819 int i; for (i=0; i<argc; i++) { | |
820 int cnt = (it++)->value; | |
821 int num = (it++)->value; | |
822 | |
823 if (timer_var.find(num) == timer_var.end()) { | |
824 cmd.SetFlagvar(*it++, 0); | |
825 } else { | |
826 TimerAtom& atom = timer_var[num]; | |
827 if (atom.total_time <= 0) atom.total_time = 1; | |
828 int cur_tm = old_time - atom.start_time; | |
829 if (cur_tm < 0) cur_tm = atom.total_time; // ¥¨¥é¡¼¤Ê¤éºÇ½ª»þ´Ö¤Ë¹ç¤ï¤»¤ë | |
830 if (cur_tm > atom.total_time) cur_tm = atom.total_time; | |
831 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit. | |
832 int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time); | |
833 cmd.SetFlagvar(*it++, v); | |
834 if (atom.total_time != -1 && cur_tm < atom.total_time) active_timers++; | |
835 } | |
836 } | |
837 if (active_timers) active_timers = 1; | |
838 cmd.SetSysvar(active_timers); | |
839 } else if (cmd.cmd3 == 0x1f4) { | |
840 TimerAtom& atom = timer_var[cmd.args[0].value]; | |
841 atom.from = cmd.args[1].value; | |
842 atom.to = cmd.args[2].value; | |
843 atom.total_time = cmd.args[3].value; | |
844 atom.start_time = old_time; | |
845 cmd.clear(); | |
846 } else if (cmd.cmd3 == 0x3e8) { | |
847 /* rand() */ | |
848 int min = 0, max; | |
849 if (cmd.args.size() == 2) { | |
850 min = cmd.args[0].value; | |
851 max = cmd.args[1].value; | |
852 } else { | |
853 max = cmd.args[1].value; | |
854 } | |
855 if (min > max) { | |
856 int tmp = max; | |
857 max = min; | |
858 min = tmp; | |
859 } | |
860 int r = random(); | |
861 if (min == max) r = min; | |
862 else r = (r % (max-min)) + min; | |
863 cmd.SetSysvar(r); | |
864 } else if (cmd.cmd3 == 0x3ea) { | |
865 int val = cmd.args[0].value; | |
866 if (val < 0) val = -val; | |
867 cmd.SetSysvar(val); | |
868 } else if (cmd.cmd3 == 0x3ec) { | |
869 /* min ¤À¤è¤Ê¤¢¡¦¡¦¡¦*/ | |
870 int min = cmd.args[0].value; | |
871 int max = cmd.args[1].value; | |
872 if (max < min) min = max; | |
873 cmd.SetSysvar(min); | |
874 } else if (cmd.cmd3 == 0x3ef) { | |
875 /* min */ | |
876 int min = cmd.args[0].value; | |
877 int max = cmd.args[1].value; | |
878 if (max < min) min = max; | |
879 cmd.SetSysvar(min); | |
880 } else if (cmd.cmd3 == 0x320) { | |
881 /* range conversion : ÈæΨ¤Ë´Ý¤á¤ë */ | |
882 // ¥¢¥ë¥´¥ê¥º¥à¤Ï´Ö°ã¤¨¤Æ¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë | |
883 // | |
884 if (cmd.args.size() >= 7) { | |
885 int val = cmd.args[0].value; | |
886 int offset = cmd.args[1].value; | |
887 int r_min = cmd.args[2].value; | |
888 int v_min = cmd.args[3].value; | |
889 int v_max = cmd.args[4].value; | |
890 int r_max = cmd.args[5].value; | |
891 int mode = cmd.args[6].value; | |
892 // rldev : mode == 1,3 : 'acceralating curve', 2,3: 'decelerating curve' | |
893 // Ê£¿ô¤Î°ú¿ô¥ê¥¹¥È(r_min¤«¤émode¤Þ¤Ç¤Î¥ê¥¹¥È)¤â¤Ä¤³¤È¤â¤¢¤ê¡¢¤½¤Î¾ì¹ç¤Ï | |
894 // "cancel out in some way" ¤é¤·¤¤ | |
895 if (mode == 1 || mode == 3) val += offset; | |
896 else if (mode == 2 || mode == 4) val -= offset; | |
897 if (cmd.args.size() != 7) | |
898 fprintf(stderr,"\n%d/%d: cmd 01-04:0320 : XXXX NOT SUPPORTED LIST : DOUBLE RANGE CONVERSION! XXXXXXXXXXX\n",cmd.scn,cmd.pos); | |
899 if (val < v_min) val = v_min; | |
900 if (val > v_max) val = v_max; | |
901 val = (r_max-r_min)*(val-v_min)/(v_max-v_min) + r_min; | |
902 cmd.SetSysvar(val); | |
903 } | |
904 } else if (cmd.cmd3 == 0x3f1) { | |
905 /* range Æâ¤Ë´Ý¤á¤ë */ | |
906 int min = cmd.args[0].value; | |
907 int val = cmd.args[1].value; | |
908 int max = cmd.args[2].value; | |
909 if (min > max) { | |
910 int tmp = max; | |
911 max = min; | |
912 min = tmp; | |
913 } | |
914 if (val < min) val = min; | |
915 if (val > max) val = max; | |
916 cmd.SetSysvar(val); | |
917 } else if (cmd.cmd3 == 0x16c && cmd.cmd4 == 0) { | |
918 /* ¤Ê¤ó¤«¤è¤¯¤ï¤«¤é¤Ê¤¤¤±¤É¥«¡¼¥½¥ë·Á¾õÊѹ¹¤Ë¤·¤È¤¯ */ | |
919 SetCursor(cmd.args[0].value); | |
920 cmd.clear(); | |
921 } else if (cmd.cmd3 == 0x0bc1) { // ¥á¥Ë¥å¡¼¤«¤é¤Î¥í¡¼¥É | |
922 cmd.cmd_type = CMD_LOADREQ; | |
923 } else if ( (cmd.cmd3 >= 0x8d4 && cmd.cmd3 <= 0x8d8) || cmd.cmd3 == 0x8db || cmd.cmd3 == 0x93f || cmd.cmd3 == 0xa39) { | |
924 // ¥Æ¥¥¹¥È¥¦¥£¥ó¥É¥¦¤Î¿§ÀßÄê | |
925 int r, g, b, a, flag; | |
926 if (cmd.cmd3 == 0xa39) { // ¸µÀßÄê¤ò¼è¤ê½Ð¤¹ | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
927 config->GetOriginalParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag); |
0 | 928 } else { |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
929 config->GetParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag); |
0 | 930 } |
931 if (cmd.cmd3 == 0xa39 || cmd.cmd3 == 0x93f) { // ÀßÄê¤òÊÑ¿ô¤Ë¼è¤ê½Ð¤¹ | |
932 if (cmd.args.size() != 5) { | |
933 fprintf(stderr,"cmd 01-04:%4d : invalid arg size\n", cmd.cmd3); | |
934 } else { | |
935 vector<VarInfo> args(cmd.args); | |
936 cmd.SetFlagvar(args[0], r); | |
937 cmd.SetFlagvar(args[1], g); | |
938 cmd.SetFlagvar(args[2], b); | |
939 cmd.SetFlagvar(args[3], a); | |
940 cmd.SetFlagvar(args[4], flag); | |
941 } | |
942 } else { | |
943 switch(cmd.cmd3) { | |
944 case 0x8d4: r = cmd.args[0].value; break; | |
945 case 0x8d5: g = cmd.args[0].value; break; | |
946 case 0x8d6: b = cmd.args[0].value; break; | |
947 case 0x8d7: a = cmd.args[0].value; break; | |
948 case 0x8d8: flag = cmd.args[0].value; break; | |
949 case 0x8db: | |
950 r = cmd.args[0].value; | |
951 g = cmd.args[1].value; | |
952 b = cmd.args[2].value; | |
953 a = cmd.args[3].value; | |
954 flag = cmd.args[4].value; | |
955 break; | |
956 } | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
957 config->SetParam("#WINDOW_ATTR", 5, r, g, b, a, flag); |
0 | 958 SetWindowColor(r, g, b, a, flag); |
959 cmd.clear(); | |
960 } | |
961 } else if (cmd.cmd3 == 0xa28 || cmd.cmd3 == 0xa29 || cmd.cmd3 == 0xa2c || cmd.cmd3 == 0xa2d || cmd.cmd3 == 0xa2e) { | |
962 int v = 0; | |
963 switch(cmd.cmd3) { | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
964 case 0xa28: case 0xa2d: config->GetOriginalParam("#INIT_MESSAGE_SPEED", 1, &v); break; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
965 case 0xa29: config->GetOriginalParam("#INIT_MESSAGE_SPEED_MOD", 1, &v); break; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
966 case 0xa2c: config->GetOriginalParam("#MESSAGE_KEY_WAIT_USE", 1, &v); break; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
967 case 0xa2e: config->GetOriginalParam("#MESSAGE_KEY_WAIT_TIME", 1, &v); break; |
0 | 968 } |
969 cmd.SetSysvar(v); | |
970 } else if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x914 || cmd.cmd3 == 0x92f || cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8b0 || cmd.cmd3 == 0x8cb) { | |
971 // ¥Æ¥¥¹¥Èɽ¼¨Â®ÅÙ´ØÏ¢ | |
972 int m, speed; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
973 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
974 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &m); |
0 | 975 if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x92f) fprintf(stderr,"TEXT speed %d\n",speed); |
976 else if (cmd.cmd3 == 0x914) fprintf(stderr,"TEXT mode %d\n",m); | |
977 else if (cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8cb) fprintf(stderr,"TEXT %d, %d <- speed %d\n",m,speed,cmd.args[0].value); | |
978 else fprintf(stderr,"TEXT %d, %d <- mode %d\n",m,speed,cmd.args[0].value); | |
979 if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x92f) cmd.SetSysvar(speed); | |
980 else if (cmd.cmd3 == 0x914) cmd.SetSysvar(m); | |
981 else { | |
982 if (cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8cb) speed = cmd.args[0].value; | |
983 else m = cmd.args[0].value; | |
984 if (speed < 10) speed = 10; | |
985 else if (speed > 1000) speed = 1000; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
986 config->SetParam("#INIT_MESSAGE_SPEED", 1, speed); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
987 config->SetParam("#INIT_MESSAGE_SPEED_MOD", 1, m); |
0 | 988 if (m) speed = -1; |
989 SetTextSpeed(speed); | |
990 cmd.clear(); | |
991 } | |
992 } else if (cmd.cmd3 == 0x92e || cmd.cmd3 == 0x930 || cmd.cmd3 == 0x8ca || cmd.cmd3 == 0x8cc) { | |
993 // ¥Æ¥¥¹¥È¥ª¡¼¥È¥â¡¼¥É´ØÏ¢ | |
994 int m, wait; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
995 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &m); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
996 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &wait); |
0 | 997 if (cmd.cmd3 == 0x92e) fprintf(stderr,"AUTO mode %d\n",m); |
998 else if (cmd.cmd3 == 0x930) fprintf(stderr,"AUTO wait %d\n",wait); | |
999 else if (cmd.cmd3 == 0x8ca) fprintf(stderr,"AUTO %d,%d <- mode %d\n",m,wait,cmd.args[0].value); | |
1000 else fprintf(stderr,"AUTO %d,%d <- wait %d\n",m,wait,cmd.args[0].value); | |
1001 | |
1002 if (cmd.cmd3 == 0x92e) cmd.SetSysvar(m); | |
1003 else if (cmd.cmd3 == 0x930) cmd.SetSysvar(wait); | |
1004 else { | |
1005 if (cmd.cmd3 == 0x8ca) m = cmd.args[0].value; | |
1006 else wait = cmd.args[1].value; | |
1007 if (wait < 0) wait = 0; | |
1008 else if (wait > 60000) wait = 60000; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1009 config->SetParam("#MESSAGE_KEY_WAIT_USE", 1, m); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1010 config->SetParam("#MESSAGE_KEY_WAIT_TIME", 1, wait); |
0 | 1011 if (m) SetTextWait(wait); |
1012 else SetTextWait(-1); | |
1013 cmd.clear(); | |
1014 } | |
1015 } else if (cmd.cmd3 == 0x51f && cmd.cmd4 == 0) { // replace_name2 ¤ÎÀßÄê | |
1016 int n = cmd.args[0].value; | |
1017 if (n>=0 && n<26) { | |
1018 replace_name2[n] = cmd.Str(cmd.args[1]); | |
1019 } | |
1020 cmd.clear(); | |
1021 } else if (cmd.cmd3 == 0x51e && cmd.cmd4 == 0) { // replace_name2 ¤òÆÀ¤ë | |
1022 int n = cmd.args[0].value; | |
1023 if (n >= 0 && n < 26) { | |
1024 cmd.SetStrvar(cmd.args[1], replace_name2[n]); | |
1025 } else { | |
1026 cmd.SetStrvar(cmd.args[1], ""); | |
1027 } | |
1028 } else if (cmd.cmd3 == 0x514 && cmd.cmd4 == 0) { // replace_name ¤òÆÀ¤ë | |
1029 int n = cmd.args[0].value; | |
1030 if (n >= 0 && n < 26) { | |
1031 cmd.SetStrvar(cmd.args[1], replace_name[n]); | |
1032 } else { | |
1033 cmd.SetStrvar(cmd.args[1], ""); | |
1034 } | |
1035 } | |
1036 } | |
52 | 1037 } |
0 | 1038 |
1039 extern int print_blit; | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1040 bool Text::Wait(unsigned int current_time, Cmd& cmd) { |
52 | 1041 if (current_time != Event::Time::NEVER_WAKE) old_time = current_time; |
0 | 1042 /* |
1043 if (event.presscount(MOUSE_UP)) { | |
1044 if (text) text->Pic()->ReBlit(); | |
1045 } | |
1046 if (event.presscount(MOUSE_DOWN)) { | |
1047 print_blit^=1; | |
1048 } | |
1049 */ | |
1050 | |
1051 if (status == NORMAL && status_mask == NORMAL) return false; | |
52 | 1052 |
0 | 1053 if (status_mask & WAIT_EXTRN_MASK) return true; |
1054 if (status_mask & (BACKLOG_MASK|BACKLOG_MASK_FWD) ) { | |
1055 if (status_mask & BACKLOG_WAIT_MASK) ; | |
1056 else { | |
52 | 1057 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) { |
0 | 1058 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) { |
1059 text->wid->Flush(); // ɽ¼¨¤òºÇ¸å¤Î¾õÂ֤ˤ¹¤ë | |
1060 } | |
52 | 1061 if (status == WAIT_TEXT && text != NULL && kcursor != NULL) kcursor->show(); |
0 | 1062 } |
1063 } | |
1064 if (status_mask & BACKLOG_MASK) { | |
1065 cmd.cmd_type = CMD_BACKLOGREQ; | |
1066 } else { | |
1067 cmd.cmd_type = CMD_BACKLOGREQ_FWD; | |
1068 } | |
1069 status_mask = Status(status_mask & ~(BACKLOG_MASK|BACKLOG_MASK_FWD)); | |
1070 return false; | |
1071 } | |
1072 if ( (status_mask & BACKLOG_WAIT_MASK) && (status_mask & BACKLOG_MASK_KOE)) { | |
1073 if (drawn_backlog_item.koe != -1) { | |
1074 cmd.cmd_type = CMD_OTHER; | |
1075 cmd.cmd1 = 1; | |
1076 cmd.cmd2 = 0x17; | |
1077 cmd.cmd3 = 0; | |
1078 cmd.cmd4 = 1; | |
1079 cmd.args.clear(); | |
1080 cmd.args.push_back(VarInfo(drawn_backlog_item.koe)); | |
1081 cmd.args.push_back(VarInfo(0)); | |
1082 } | |
1083 status_mask = Status(status_mask & ~BACKLOG_MASK_KOE); | |
1084 return false; | |
1085 } | |
1086 if (skip_mode & SKIP_IN_MENU) return false; | |
1087 if (status_mask & SAVEMASK) { | |
1088 cmd.cmd_type = CMD_SAVEREQ; | |
1089 status_mask = Status(status_mask & ~SAVEMASK); | |
1090 return false; | |
1091 } | |
1092 if (status_mask & LOADMASK) { | |
1093 cmd.cmd_type = CMD_LOADREQ; | |
1094 status_mask = Status(status_mask & ~LOADMASK); | |
1095 return false; | |
1096 } | |
1097 if (status_mask & SKIPEND_MASK) { | |
1098 if ( (skip_mode & SKIP_TEXT) && (skip_mode & SKIPEND_TEXT)) { | |
1099 if (skip_mode & SKIPEND_KEY) { // shift skip Ãæ | |
1100 SkipMode new_mode = SkipMode(skip_mode & (~SKIPEND_TEXT)); | |
1101 if (new_mode & (SKIP_GRP_NOEFFEC || SKIP_GRP_NODRAW)) | |
1102 new_mode = SkipMode(new_mode & (~SKIP_GRP_FAST)); | |
1103 cmd.SetSysvar(TYPE_SYS_SKIPMODE, new_mode); | |
1104 } else { | |
1105 cmd.SetSysvar(TYPE_SYS_SKIPMODE, SKIP_NO); | |
1106 } | |
1107 } | |
1108 status_mask = Status(status_mask & ~SKIPEND_MASK); | |
1109 } | |
1110 if (status_mask & SKIPMASK) { | |
1111 if (skip_mode != SKIP_NO) { | |
1112 cmd.SetSysvar(TYPE_SYS_SKIPMODE, skip_mode | SKIPEND_TEXT); | |
1113 } else { | |
1114 cmd.SetSysvar(TYPE_SYS_SKIPMODE, SKIP_TEXT | SKIP_GRP_FAST | SKIPEND_TEXT); | |
1115 } | |
1116 status_mask = Status(status_mask & ~SKIPMASK); | |
1117 return false; | |
1118 } | |
1119 if (event.presscount(MOUSE_RIGHT)) { | |
52 | 1120 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) { |
0 | 1121 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) { |
1122 text->wid->Flush(); // ɽ¼¨¤òºÇ¸å¤Î¾õÂ֤ˤ¹¤ë | |
1123 } | |
1124 cmd.cmd_type = CMD_MENUREQ; | |
1125 if (!(status_mask & STATSAVE_MASK)) { | |
1126 status_saved = status; | |
1127 status_mask = Status(status_mask | STATSAVE_MASK); | |
1128 } | |
1129 return false; | |
1130 } else if (status == WAIT_CLICK_MOUSEPOS) { | |
1131 status = WAIT_CLICK_MOUSEPOSEND_R; | |
1132 } | |
1133 } | |
1134 if (event.presscount(MOUSE_UP)) { | |
52 | 1135 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) { |
0 | 1136 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) { |
1137 text->wid->Flush(); // ɽ¼¨¤òºÇ¸å¤Î¾õÂ֤ˤ¹¤ë | |
1138 } | |
1139 cmd.cmd_type = CMD_BACKLOGREQ; | |
1140 if (!(status_mask & STATSAVE_MASK)) { | |
1141 status_saved = status; | |
1142 status_mask = Status(status_mask | STATSAVE_MASK); | |
1143 } | |
1144 return false; | |
1145 } | |
1146 } | |
1147 if (status_mask & CLEARSCR_MASK) { | |
52 | 1148 if ( (status == WAIT_TEXT && text != NULL ) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) { |
0 | 1149 if (skip_mode) skip_mode = SKIP_NO; |
1150 if (text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) { | |
1151 text->wid->Flush(); // ɽ¼¨¤òºÇ¸å¤Î¾õÂ֤ˤ¹¤ë | |
1152 return true; | |
1153 } | |
1154 status_mask = Status(status_mask & (~CLEARSCR_MASK) | CLEARSCR_WAIT_MASK); | |
52 | 1155 if (text != NULL) text->hide(); |
1156 if (kcursor != NULL) kcursor->hide(); | |
1157 if (sel_widget != NULL) sel_widget->hide(); | |
1158 if (backlog_widget != NULL) backlog_widget->hide(); | |
0 | 1159 return true; |
1160 } | |
1161 status_mask = Status(status_mask & (~CLEARSCR_MASK)); | |
1162 return false; | |
1163 } | |
1164 if (status_mask & CLEARSCR_WAIT_MASK) { | |
1165 return true; | |
1166 } | |
1167 if (status == WAIT_TEXT) { | |
52 | 1168 if (text == NULL) { |
1169 status = NORMAL; | |
1170 return false; | |
1171 } | |
0 | 1172 if (skip_mode & SKIP_TEXT) { |
1173 } else if (text->wid->status != WidText::PREPARE) { | |
1174 return true; | |
1175 } | |
52 | 1176 if (kcursor != NULL) kcursor->hide(); |
0 | 1177 text_stream.Clear(); |
1178 status = NORMAL; | |
1179 cmd.cmd_type = CMD_TEXTEND; | |
1180 return false; | |
1181 } | |
1182 if (status == WAIT) { | |
1183 if (skip_mode & SKIP_TEXT) ; | |
1184 else if (wait_time > current_time) return true; | |
1185 status = NORMAL; | |
1186 } else if (status == WAIT_CLICK) { | |
1187 if (skip_mode & SKIP_TEXT) ; | |
1188 else if (wait_time > current_time) return true; | |
1189 status = NORMAL; | |
1190 cmd.SetSysvar(0); | |
1191 } else if (status == WAIT_ABORT) { | |
1192 cmd.SetSysvar(1); | |
1193 status = NORMAL; | |
1194 } else if (status == WAIT_CLICK_MOUSEPOS || status == WAIT_CLICK_MOUSEPOSEND_L || status == WAIT_CLICK_MOUSEPOSEND_R) { | |
1195 if (status == WAIT_CLICK_MOUSEPOS && (skip_mode & SKIP_TEXT) == 0) return true; // keep wait | |
1196 else { | |
1197 int x, y; | |
1198 event.MousePos(x,y); | |
1199 if (status == WAIT_CLICK_MOUSEPOS) x = y = 0; // skip mode | |
1200 cmd.clear(); | |
1201 cmd.SetFlagvar(wait_savedvar[0], x); | |
1202 cmd.SetFlagvar(wait_savedvar[1], y); | |
1203 if (status == WAIT_CLICK_MOUSEPOSEND_R) cmd.SetSysvar(-1); | |
1204 else cmd.SetSysvar(0); | |
1205 status = NORMAL; | |
1206 } | |
1207 } else if (status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) { | |
1208 return true; | |
1209 } else if ( int(status) >= WAIT_SELECT_VALUE) { | |
1210 int sel_val = int(status) - WAIT_SELECT_VALUE; | |
1211 cmd.SetSysvar(sel_val); | |
1212 selects.clear(); | |
1213 delete sel_widget; | |
52 | 1214 sel_widget = NULL; |
0 | 1215 status = NORMAL; |
1216 // CreateSelect() ¤ÇºîÀ®¤µ¤ì¤¿ cur_backlog_item ¤ò backlog_item ¤ØÈ¿±Ç¤µ¤»¤ë | |
1217 cur_backlog_item.text.InsertColor(sel_backlog_pos[sel_val], sel_backlog_pos[sel_val+1], 0xff, 0, 0); | |
1218 backlog_item = cur_backlog_item; | |
1219 cur_backlog_item.Clear(); | |
1220 } | |
1221 return false; | |
1222 } | |
1223 | |
1224 void clearbtn_press(void* pointer, WidButton* button) { | |
52 | 1225 if (pointer == NULL) return; |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1226 Text* t = (Text*)pointer; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1227 t->status_mask = Text::Status(t->status_mask | Text::CLEARSCR_MASK); |
0 | 1228 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1229 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1230 void Text::PressFuncSkip(void* pointer, WidButton* from) { |
52 | 1231 if (pointer == NULL) return; |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1232 Text* t = (Text*)pointer; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1233 t->status_mask = Text::Status(t->status_mask | Text::SKIPMASK); |
0 | 1234 return; |
1235 } | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1236 void Text::PressFuncLoad(void* pointer, WidButton* from) { |
52 | 1237 if (pointer == NULL) return; |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1238 Text* t = (Text*)pointer; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1239 t->status_mask = Text::Status(t->status_mask | Text::LOADMASK); |
0 | 1240 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1241 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1242 void Text::PressFuncSave(void* pointer, WidButton* from) { |
52 | 1243 if (pointer == NULL) return; |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1244 Text* t = (Text*)pointer; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1245 t->status_mask = Text::Status(t->status_mask | Text::SAVEMASK); |
0 | 1246 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1247 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1248 void Text::PressFuncBacklog(void* pointer, WidButton* from) { |
52 | 1249 if (pointer == NULL) return; |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1250 Text* t = (Text*)pointer; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1251 t->status_mask = Text::Status(t->status_mask | Text::BACKLOG_MASK); |
0 | 1252 } |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1253 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1254 void Text::PressFuncBacklogFwd(void* pointer, WidButton* from) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1255 if (pointer == NULL) return; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1256 Text* t = (Text*)pointer; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1257 t->status_mask = Text::Status(t->status_mask | Text::BACKLOG_MASK_FWD); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1258 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1259 |
0 | 1260 void movebtn_drag(int from_x, int from_y, int x, int y, void* pointer, WidButton* button) { |
52 | 1261 if (pointer == NULL) return; |
0 | 1262 fprintf(stderr,"drag.\n"); |
1263 } | |
52 | 1264 |
0 | 1265 #define BTNCNT 10 |
47
5f548e5957a8
* get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents:
43
diff
changeset
|
1266 static const char* btnname[BTNCNT] = { |
0 | 1267 "MOVE", |
1268 "CLEAR", | |
1269 "READJUMP", | |
1270 "AUTOMODE", | |
1271 "MSGBK", | |
1272 "MSGBKLEFT", | |
1273 "MSGBKRIGHT", | |
1274 "EXBTN_000", | |
1275 "EXBTN_001", | |
1276 "EXBTN_002" | |
1277 }; | |
52 | 1278 |
0 | 1279 static int btnpos[BTNCNT] = { // g00 ¥Õ¥¡¥¤¥ëÆâ¤Î¥Ü¥¿¥ó¾ðÊó¤Î°ÌÃÖ |
1280 // 0, 1, 13, 12, 2, 3, 4, 5, 6, 7 // princess bride? | |
1281 0, 1, 13, 14, 2, 3, 4, 5, 6, 7 // tomoyo after? | |
1282 }; | |
52 | 1283 |
0 | 1284 static WidButton::PressFunc btnpress[BTNCNT] = { |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1285 0, clearbtn_press, &Text::PressFuncSkip,0,&Text::PressFuncBacklogFwd,&Text::PressFuncBacklog,&Text::PressFuncBacklogFwd,&Text::PressFuncSave,&Text::PressFuncLoad,0 |
0 | 1286 }; |
52 | 1287 |
0 | 1288 static WidButton::DragFunc btndrag[BTNCNT] = { |
1289 movebtn_drag, 0,0,0,0, 0,0,0,0, 0 | |
1290 }; | |
1291 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1292 void Text::SetTextSpeed(int speed) { |
0 | 1293 // 100 : 10char / sec |
1294 // 10 : 100char / sec | |
1295 // text widget: | |
1296 if (speed <= 0) speed = -1; | |
1297 else if (speed > 1000) speed = 1; | |
1298 else speed = 1000 / speed; | |
1299 int i; | |
1300 for (i=0; i<32; i++) | |
1301 if (widgets[i]) widgets[i]->wid->SetSpeed(speed); | |
1302 } | |
52 | 1303 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1304 void Text::SetTextWait(int wait) { |
0 | 1305 int i; |
1306 for (i=0; i<32; i++) | |
1307 if (widgets[i]) widgets[i]->wid->SetWait(wait); | |
1308 } | |
1309 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1310 void Text::SetWindowColor(int r, int g, int b, int a, bool is_transparent) { |
0 | 1311 char key[1024]; |
1312 int w; | |
1313 | |
1314 for (w=0; w<32; w++) { | |
52 | 1315 if (widgets[w] == NULL) continue; |
0 | 1316 sprintf(key, "#WAKU.%03d.000.BACK", w); |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1317 const char* back = config->GetParaStr(key); |
52 | 1318 if (back == NULL || back[0] == 0) continue; |
0 | 1319 sprintf(key, "%s.g00", back); |
1320 Surface* back_s = parent.Root().NewSurface(key); | |
52 | 1321 if (back_s == NULL) continue; |
0 | 1322 Rect rect(*back_s); |
1323 Surface* new_s = parent.Root().NewSurface(rect.width(), rect.height(), ALPHA_MASK); | |
1324 DSurfaceMove(back_s, rect, new_s, rect); | |
1325 DSurfaceFillA(new_s, rect, r, g, b, a); | |
1326 widgets[w]->wid->Pic()->SetSurface(new_s, 0, 0); | |
1327 widgets[w]->wid->Pic()->SetSurfaceFreeFlag(1); | |
1328 if (!is_transparent) | |
1329 widgets[w]->wid->Pic()->SetSurfaceAttribute(PicBase::BLIT_MULTIPLY); | |
1330 parent.Root().DeleteSurface(back_s); | |
1331 } | |
1332 } | |
1333 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1334 void Text::SetCursor(int cursor_no) { |
0 | 1335 char key[1024]; |
1336 sprintf(key, "#CURSOR.%03d.NAME", cursor_no); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1337 string path = config->GetParaStr(key); |
0 | 1338 if (path.length() == 0) return; // ̾Á°¤Ê¤· |
1339 path += ".pdt"; | |
1340 int w,h,cont,speed; | |
1341 sprintf(key, "#CURSOR.%03d.SIZE", cursor_no); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1342 config->GetParam(key, 2, &w, &h); |
0 | 1343 sprintf(key, "#CURSOR.%03d.CONT", cursor_no); |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1344 config->GetParam(key, 1, &cont); |
0 | 1345 sprintf(key, "#CURSOR.%03d.SPEED", cursor_no); |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1346 config->GetParam(key, 1, &speed); |
0 | 1347 |
1348 // speed ¤Ç£±¼þ¡¢cont ²óÊѲ½ | |
52 | 1349 if (kcursor != NULL) delete kcursor; |
0 | 1350 |
1351 kcursor = new WidTimeCursor(event, speed/cont, &parent, path.c_str(), 0, 0, w, 0, cont, Rect(0,0,w,h)); | |
1352 int i; | |
1353 for (i=0; i<32; i++) { | |
1354 if (widgets[i]) widgets[i]->wid->SetCursor(kcursor); | |
1355 } | |
1356 } | |
1357 | |
52 | 1358 void kconv(const unsigned char* src, unsigned char* dest) { //FIXME: code duplication? |
0 | 1359 /* input : sjis output: euc */ |
1360 while(*src) { | |
1361 unsigned int high = *src++; | |
1362 if (high < 0x80) { | |
1363 /* ASCII */ | |
1364 *dest++ = high; continue; | |
1365 } else if (high < 0xa0) { | |
1366 /* SJIS */ | |
1367 high -= 0x71; | |
1368 } else if (high < 0xe0) { | |
1369 /* hankaku KANA */ | |
1370 *dest++ = 0x8e; *dest++ = high; | |
1371 continue; | |
1372 } else { /* high >= 0xe0 : SJIS */ | |
1373 high -= 0xb1; | |
1374 } | |
1375 /* SJIS convert */ | |
1376 high = (high<<1) + 1; | |
1377 | |
1378 unsigned int low = *src++; | |
1379 if (low == 0) break; /* incorrect code */ | |
1380 if (low > 0x7f) low--; | |
1381 if (low >= 0x9e) { | |
1382 low -= 0x7d; | |
1383 high++; | |
1384 } else { | |
1385 low -= 0x1f; | |
1386 } | |
1387 *dest++ = high | 0x80; *dest++ = low | 0x80; | |
1388 } | |
1389 *dest = 0; | |
1390 } | |
52 | 1391 |
1392 void kconv_rev(const unsigned char* src, unsigned char* dest) { //FIXME: code duplication? | |
0 | 1393 /* input : euc output: sjis */ |
1394 while(*src) { | |
1395 unsigned int high = *src++; | |
1396 if (high < 0x80) { | |
1397 /* ASCII */ | |
1398 *dest++ = high; continue; | |
1399 } else if (high == 0x8e) { /* hankaku KANA */ | |
1400 high = *src; | |
1401 if (high >= 0xa0 && high < 0xe0) | |
1402 *dest++ = *src++; | |
1403 continue; | |
1404 } else { | |
1405 unsigned int low = *src++; | |
1406 if (low == 0) break; /* incorrect code , EOS */ | |
1407 if (low < 0x80) continue; /* incorrect code */ | |
1408 /* convert */ | |
1409 low &= 0x7f; high &= 0x7f; | |
1410 low += (high & 1) ? 0x1f : 0x7d; | |
1411 high = (high-0x21)>>1; | |
1412 high += (high > 0x1e) ? 0xc1 : 0x81; | |
1413 *dest++ = high; | |
1414 if (low > 0x7f) low++; | |
1415 *dest++ = low; | |
1416 } | |
1417 } | |
1418 *dest = 0; | |
1419 } | |
52 | 1420 |
0 | 1421 string kconv(const string& s) { |
1422 char* out = new char[s.length()*2+100]; | |
1423 kconv((const unsigned char*)s.c_str(), (unsigned char*)out); | |
1424 string ret = out; | |
1425 delete[] out; | |
1426 return ret; | |
1427 } | |
52 | 1428 |
0 | 1429 string kconv_rev(const string& s) { |
1430 char* out = new char[s.length()*2+100]; | |
1431 kconv_rev((const unsigned char*)s.c_str(), (unsigned char*)out); | |
1432 string ret = out; | |
1433 delete[] out; | |
1434 return ret; | |
1435 } | |
1436 | |
1437 /**************************************************************:: | |
1438 ** | |
1439 ** BacklogItem | |
1440 */ | |
1441 | |
1442 BacklogItem::BacklogItem(void) { | |
1443 scn = -1; | |
1444 pos = -1; | |
1445 koe = -1; | |
1446 face = ""; | |
1447 text.kanji_type = TextStream::sjis; | |
1448 } | |
52 | 1449 |
0 | 1450 void BacklogItem::Clear(void) { |
1451 scn = -1; | |
1452 pos = -1; | |
1453 koe = -1; | |
1454 text.Clear(); | |
1455 } | |
52 | 1456 |
0 | 1457 void BacklogItem::AddTextPos(Cmd& cmd) { |
1458 if (scn == -1 && pos == -1) { | |
1459 scn = cmd.scn; | |
1460 pos = cmd.pos; | |
1461 return; | |
1462 } | |
1463 DeleteTextPos(); | |
1464 } | |
52 | 1465 |
0 | 1466 void BacklogItem::DeleteTextPos(void) { |
1467 scn = 0; | |
1468 pos = -1; | |
1469 } | |
52 | 1470 |
0 | 1471 BacklogItem& BacklogItem::operator =(const BacklogItem& p) { |
1472 scn = p.scn; | |
1473 pos = p.pos; | |
1474 koe = p.koe; | |
1475 face = p.face; | |
1476 text = p.text; | |
1477 } | |
52 | 1478 |
0 | 1479 void BacklogItem::SetSavepos(int p) { |
1480 Clear(); | |
1481 scn = SaveSelect; | |
1482 pos = p; | |
1483 } | |
1484 | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1485 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1486 /**************************************************************:: |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1487 ** |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1488 ** TextWindow |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1489 */ |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1490 |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1491 Rect TextWindow::WakuSize(PicContainer& pic, int waku_no) { |
0 | 1492 char key[1024]; |
1493 sprintf(key, "#WAKU.%03d.000.NAME", waku_no); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1494 const char* name = AyuSysConfig::GetInstance()->GetParaStr(key); |
52 | 1495 if (name == NULL) return Rect(0,0,0,0); |
0 | 1496 std::string str = name; str += ".g00"; |
1497 Surface* s = pic.Root().NewSurface(str.c_str()); | |
52 | 1498 if (s == NULL) return Rect(0,0,0,0); |
0 | 1499 Rect r(*s); |
1500 pic.Root().DeleteSurface(s); | |
1501 return r; | |
1502 } | |
52 | 1503 |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1504 void TextWindow::MakeWaku(PicContainer& pic, Event::Container& event, int waku_no, int window_no, bool* use_btn, void* callback) { |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1505 AyuSysConfig *config = AyuSysConfig::GetInstance(); |
0 | 1506 char key[1024]; |
1507 std::string str; | |
1508 /* ÏȤòºîÀ® */ | |
1509 sprintf(key, "#WAKU.%03d.000.NAME", waku_no); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1510 const char* name = config->GetParaStr(key); |
52 | 1511 if (name != NULL && name[0] == 0) name = NULL; |
0 | 1512 sprintf(key, "#WAKU.%03d.000.BACK", waku_no); |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1513 const char* back = config->GetParaStr(key); |
52 | 1514 if (back != NULL && back[0] == 0) back = NULL; |
0 | 1515 sprintf(key, "#WAKU.%03d.000.BTN", waku_no); |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1516 const char* btn = config->GetParaStr(key); |
52 | 1517 if (btn != NULL && btn[0] == 0) btn = NULL; |
0 | 1518 |
52 | 1519 if (name == NULL && back == NULL && btn == NULL) return; |
0 | 1520 |
1521 /* ¤Þ¤º¡¢¥Æ¥¥¹¥ÈÇطʤòÀßÄê */ | |
52 | 1522 if (back != NULL) { |
0 | 1523 str = back; str += ".g00"; |
52 | 1524 int rc, gc, bc, ac, flag; |
0 | 1525 char key[1024]; |
1526 sprintf(key, "#WINDOW.%03d.ATTR", window_no); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1527 if (config->GetParam(key, 5, &rc, &gc, &bc, &ac, &flag) == -1) { |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1528 config->GetParam("#WINDOW_ATTR", 5, &rc, &gc, &bc, &ac, &flag); |
0 | 1529 } |
1530 Surface* back_s = pic.Root().NewSurface(str.c_str()); | |
52 | 1531 if (back_s != NULL) { |
0 | 1532 Rect rect(*back_s); |
1533 Surface* s = pic.Root().NewSurface(rect.width(), rect.height(), ALPHA_MASK); | |
1534 DSurfaceMove(back_s, rect, s, rect); | |
1535 DSurfaceFillA(s, rect, rc, gc, bc, ac); // Æ©ÌÀÅÙÀßÄê | |
1536 pic.SetSurface(s, 0, 0); | |
1537 pic.SetSurfaceFreeFlag(1); | |
1538 if (flag == 0) wid->Pic()->SetSurfaceAttribute(PicBase::BLIT_MULTIPLY); | |
1539 pic.Root().DeleteSurface(back_s); | |
1540 } | |
1541 } | |
1542 /* ¤½¤ÎÁ°¤ËÏȾþ¤ê¤òÀßÄê */ | |
52 | 1543 if (name != NULL) { |
0 | 1544 str = name; str += ".g00"; |
1545 Surface* s = pic.Root().NewSurface(str.c_str()); | |
1546 if (s) { | |
1547 Rect rect(*s); | |
1548 pic.Root().DeleteSurface(s); | |
1549 PicBase* p = pic.create_leaf(Rect(0, 0, rect.width(), rect.height()),0); | |
1550 p->SetSurface(str.c_str(), 0, 0); | |
1551 p->ZMove(ZMOVE_BOTTOM); | |
1552 p->show(); | |
1553 } | |
1554 } | |
52 | 1555 if (btn == NULL) return; |
1556 if (use_btn == NULL) return; | |
0 | 1557 // ¥Ü¥¿¥ó¤ÎºîÀ® |
1558 // »ÈÍѤ¹¤ë¥Ü¥¿¥ó¤Ë¤Ä¤¤¤Æ¤Ï¡¢É¬Íפ˱þ¤¸¤Æ show() ¤¹¤ë¤³¤È | |
1559 | |
1560 /* ¥Ü¥¿¥ó¤Î°ÌÃÖ¾ðÊó¤òµá¤á¤ë */ | |
1561 str = btn; str += ".g00"; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1562 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::PDT, str.c_str(), "g00"); |
52 | 1563 if (info == NULL) return; // cannot find file |
0 | 1564 const char* data = info->Read(); |
1565 /* g00 ¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥ÀÉôʬ¤Ë°ÌÃÖ¾ðÊó¤ÏÆþ¤Ã¤Æ¤¤¤ë */ | |
1566 /* ¸ºß¤·¤Ê¤±¤ì¤Ð¥Ü¥¿¥ó²èÁü¤Ç¤Ï¤Ê¤¤ */ | |
52 | 1567 if (data == NULL || *data != 2) { |
0 | 1568 delete info; |
1569 return; | |
1570 } | |
1571 int index_count = read_little_endian_int(data+5); // 0x70 == 112 ( 8 ¸Ä¤º¤Ä¥°¥ë¡¼¥×¤Ê¤Î¤Ç¡¢14¸Ä¤Î¥Ü¥¿¥ó ) ¤¬É¸½à | |
1572 int i; | |
1573 for (i=0; i<BTNCNT; i++) { | |
1574 if (!use_btn[i]) continue; | |
1575 if (btnpos[i]*8 >= index_count) { | |
1576 continue; // ¥Ü¥¿¥ó¤¬Â¸ºß¤·¤Ê¤¤ | |
1577 } | |
1578 int x, y, w, h; | |
1579 sprintf(key, "#WAKU.%03d.000.%s_BOX", waku_no, btnname[i]); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1580 if (config->GetParam(key, 5, 0, &x, &y, &w, &h) == -1) continue; |
0 | 1581 int sx, sy, sdx, sdy, cnt; |
1582 const char* d = data + 9 + btnpos[i]*24*8; | |
1583 sx = read_little_endian_int(d); | |
1584 sy = read_little_endian_int(d+4); | |
1585 sdx = read_little_endian_int(d+24) - sx; | |
1586 sdy = read_little_endian_int(d+24 + 4) - sy; | |
1587 cnt = 2; | |
1588 if (sx+sdx*2 == read_little_endian_int(d+2*24) && sy+sdy*2 == read_little_endian_int(d+2*24+4)) cnt = 3; | |
1589 WidButton* wid = new WidButton(event, &pic, str.c_str(), sx, sy, sdx, sdy, cnt, Rect(x, y, x+w, y+h), 1); | |
1590 if (btnpress[i]) { wid->press_func = btnpress[i]; wid->press_pointer = callback;} | |
1591 if (btndrag[i]) { wid->drag_func = btndrag[i]; wid->drag_pointer = callback;} | |
1592 } | |
1593 delete info; | |
1594 } | |
1595 | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1596 TextWindow::TextWindow(PicContainer& parent, Event::Container& event, int win_no, void* callback) : |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1597 wid(0), name_visible(true),name(0),name_container(0), face(0) |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1598 { |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1599 AyuSysConfig *config = AyuSysConfig::GetInstance(); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1600 int i; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1601 for (i=0; i<8; i++) |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1602 face_pics[i]=0; |
0 | 1603 char key[1024]; |
1604 bool use_btn[BTNCNT]; | |
1605 int size, rep1, rep2, cntw, cnth, mposx, mposy, posd, posx, posy, minx, miny, waku_no, ruby; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1606 sprintf(key, "#WINDOW.%03d.MOJI_SIZE", win_no); if (config->GetParam(key, 1, &size) == -1) return; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1607 sprintf(key, "#WINDOW.%03d.MOJI_REP", win_no); if (config->GetParam(key, 2, &rep1, &rep2) == -1) return; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1608 sprintf(key, "#WINDOW.%03d.MOJI_CNT", win_no); if (config->GetParam(key, 2, &cntw, &cnth) == -1) return; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1609 sprintf(key, "#WINDOW.%03d.POS", win_no); if (config->GetParam(key, 3, &posd, &posx, &posy) == -1) return; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1610 sprintf(key, "#WINDOW.%03d.MOJI_POS", win_no); if (config->GetParam(key, 4, &mposy, NULL, &mposx, NULL) == -1) return; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1611 sprintf(key, "#WINDOW.%03d.MOJI_MIN", win_no); if (config->GetParam(key, 2, &minx, &miny) == -1) return; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1612 sprintf(key, "#WINDOW.%03d.WAKU_SETNO", win_no);if (config->GetParam(key, 1, &waku_no) == -1) return; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1613 sprintf(key, "#WINDOW.%03d.LUBY_SIZE", win_no); if (config->GetParam(key, 1, &ruby) == -1) return; |
0 | 1614 |
1615 /* ¥Æ¥¥¹¥È¥¦¥£¥¸¥Ã¥È¡§²èÌ̤ᦲ¼°ìÇդޤǻÈÍÑ */ | |
1616 /* posd == 2 ¤Ê¤é²èÌ̲¼¤Ë¤Ò¤Ã¤Ä¤¯¤è¤¦¤ËÇÛÃÖ */ | |
1617 Rect r(0,0); | |
1618 if (posd == 2) { | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1619 r = WakuSize(parent, waku_no); |
0 | 1620 r = Rect(0, parent.Height()-r.height(), r.width(), parent.Height()); |
1621 posx = 0; | |
1622 posy = parent.Height()-r.height(); | |
1623 } else /* posd == 0 ? */ | |
1624 r = Rect(posx, posy, parent.Width(), parent.Height()); | |
1625 | |
1626 /* ¥Æ¥¥¹¥È¥¦¥£¥ó¥É¥¦¤ÎºîÀ® */ | |
1627 int w = size*cntw; int h = (size+ruby+2)*cnth; | |
1628 wid = new WidText(event, &parent, r, Rect(mposx, mposy, mposx+w, mposy+h), size); | |
1629 wid->stream.kanji_type = TextStream::sjis; | |
1630 /* ´é¥¦¥£¥ó¥É¥¦¤ÎºîÀ® */ | |
1631 for (i=0; i<8; i++) { | |
1632 int x,y; | |
1633 sprintf(key, "#WINDOW.%03d.FACE.%03d", win_no, i); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1634 if (config->GetParam(key, 2, &x, &y) == -1) continue; |
0 | 1635 /* ´é¥¦¥£¥ó¥É¥¦¤òºîÀ®¤¹¤ë */ |
1636 if (x >= 0 && y >= 0) { | |
1637 face_pics[i] = wid->PicNode()->create_leaf(Rect(x,y), PicBase::FIT_SURFACE); | |
1638 } else { | |
1639 face_pics[i] = parent.create_leaf(Rect(x+posx,y+posy), PicBase::FIT_SURFACE); | |
1640 } | |
1641 face_pics[i]->show(); | |
1642 } | |
1643 face = face_pics[0]; | |
1644 // ¥Ü¥¿¥ó¤ÎÀßÄê | |
1645 for (i=0; i<BTNCNT; i++) { | |
1646 int num; | |
1647 sprintf(key, "#WINDOW.%03d.%s_USE", win_no, btnname[i]); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1648 config->GetParam(key, 1, &num); |
0 | 1649 use_btn[i] = (num==0) ? false : true; |
1650 } | |
1651 // make name window | |
1652 int shadow, name_mod, name_size, name_min, name_center, name_posx, name_posy, name_mposx, name_mposy; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1653 sprintf(key, "#WINDOW.%03d.MOJI_SHADOW", win_no); config->GetParam(key, 1, &shadow); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1654 sprintf(key, "#WINDOW.%03d.NAME_MOD", win_no); config->GetParam(key, 1, &name_mod); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1655 sprintf(key, "#WINDOW.%03d.NAME_MOJI_SIZE", win_no); config->GetParam(key, 1, &name_size); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1656 sprintf(key, "#WINDOW.%03d.NAME_MOJI_MIN", win_no); config->GetParam(key, 1, &name_min); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1657 sprintf(key, "#WINDOW.%03d.NAME_MOJI_POS", win_no); config->GetParam(key, 2, &name_mposx, &name_mposy); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1658 sprintf(key, "#WINDOW.%03d.NAME_CENTERING", win_no); config->GetParam(key, 1, &name_center); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1659 sprintf(key, "#WINDOW.%03d.NAME_POS", win_no); config->GetParam(key, 2, &name_posx, &name_posy); |
0 | 1660 // if name_mode==0 name is in the text window |
1661 // if name_mode == 1 open name window | |
1662 // if name_mode == 2 name is not used | |
1663 if (name_mod) { | |
1664 if (name_mod == 1) { | |
1665 int w = name_size*name_min; int h = name_size; | |
1666 int name_waku; | |
1667 sprintf(key, "#WINDOW.%03d.NAME_WAKU_SETNO", win_no); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1668 if (config->GetParam(key, 1, &name_waku) != -1 && name_waku != -1) { |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1669 Rect waku_r = WakuSize(parent, name_waku); |
0 | 1670 waku_r.rmove(r.lx, r.ty); // ¥Æ¥¥¹¥È¥¦¥£¥ó¥É¥¦°ÌÃÖ¤ËÆ°¤«¤¹ |
1671 waku_r.rmove(name_posx, name_posy-waku_r.height()); // NAME_POS ¤Ø°ÌÃÖÊäÀµ | |
1672 name_container = parent.create_node(waku_r, 0); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1673 MakeWaku(*name_container, event, name_waku, win_no, 0, callback); |
0 | 1674 Rect name_r(0,0,w,h); |
1675 name_r.rmove(name_mposx, name_mposy); | |
1676 name = new WidLabel(name_container, name_r, true, 0, name_size); | |
1677 name->show(); | |
1678 } else { // ̾Á°ÀìÍÑÏȤʤ· | |
1679 Rect name_r(0, 0, w, h); | |
1680 name_r.rmove(r.lx, r.ty); | |
1681 name_r.rmove(name_posx, name_posy-name_size); | |
1682 name_container = parent.create_node(name_r, 0); | |
52 | 1683 name = new WidLabel(name_container, Rect(0, 0, w, h), true, 0, name_size); |
0 | 1684 name->show(); |
1685 name_container->show(); | |
1686 } | |
1687 } else { // name_mod == 2 or 3 | |
52 | 1688 name_container = parent.create_node( Rect(0, 0, 1, 1), 0); |
0 | 1689 } |
1690 } | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1691 MakeWaku(*wid->PicNode(), event,waku_no, win_no, use_btn, callback); |
0 | 1692 } |
52 | 1693 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1694 TextWindow::~TextWindow() |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1695 { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1696 if (name_container != NULL) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1697 delete name_container; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1698 name_container = NULL; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1699 } |
43
01aa5ddf7dc8
A lot of very minor improvements (deleted some unused variables, and other things like that...)
thib
parents:
40
diff
changeset
|
1700 int i; |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1701 for (i=0; i<8; i++) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1702 if (face_pics[i] != NULL) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1703 delete face_pics[i]; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1704 face_pics[i] = NULL; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1705 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1706 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1707 if (wid != NULL) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1708 delete wid; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1709 wid = NULL; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1710 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1711 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1712 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1713 void TextWindow::show(void) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1714 { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1715 wid->show(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1716 if (name_container != NULL && name_visible) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1717 name_container->show(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1718 if (face != NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1719 face->show(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1720 } |
0 | 1721 |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1722 void TextWindow::hide(void) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1723 { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1724 wid->hide(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1725 if (name_container != NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1726 name_container->hide(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1727 if (face != NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1728 face->hide(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1729 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1730 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1731 void TextWindow::ShowFace(const char* path) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1732 { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1733 if (face == NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1734 return; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1735 face->SetSurface(path, 0, 0); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1736 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1737 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1738 void TextWindow::ResetFace(void) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1739 if (face == NULL) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1740 return; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1741 face->SetSurface((Surface*) NULL, 0, 0); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1742 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1743 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1744 void TextWindow::StartText(const TextStream& _stream) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1745 { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1746 wid->Clear(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1747 wid->stream = _stream; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1748 if (name_container != NULL) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1749 char namestr[1024]; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1750 namestr[0] = 0; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1751 wid->stream.RemoveName(namestr, 1024); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1752 if (namestr[0] == 0) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1753 name_container->hide(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1754 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1755 else { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1756 if (name != NULL) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1757 name_container->show_all(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1758 name->SetText(namestr); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1759 } |
0 | 1760 } |
1761 } | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1762 wid->Start(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1763 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1764 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1765 void TextWindow::SetName(const char* n) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1766 { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1767 if (name_container != NULL && name != NULL) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1768 if (n[0]) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1769 name_container->show(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1770 name->SetText(n); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1771 name_visible = true; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1772 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1773 else { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1774 name_container->hide(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1775 name_visible = false; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1776 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1777 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1778 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1779 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1780 /**************************************************************:: |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1781 ** |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1782 ** SaveFaceHash |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1783 */ |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1784 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1785 void SaveFaceHash::NewNode(string face, int face_id) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1786 { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1787 facetonum[face] = face_id; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1788 container.push_front(Node(face, face_id)); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1789 if (container.size() > size_max) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1790 Node remove = container.back(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1791 container.pop_back(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1792 facetonum.erase(remove.first); |
0 | 1793 } |
1794 } | |
56
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1795 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1796 int SaveFaceHash::Add(string face) |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1797 { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1798 int id; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1799 int ret = -1; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1800 int i; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1801 List::iterator it; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1802 if (face.empty()) return -1; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1803 if (facetonum.find(face) == facetonum.end()) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1804 id = ++id_max; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1805 NewNode(face, id); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1806 ret = -1; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1807 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1808 else { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1809 id = facetonum[face]; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1810 for (i=0, it=container.begin(); it != container.end(); i++, it++) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1811 if (it->second == id) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1812 ret = i; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1813 Node n = *it; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1814 container.erase(it); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1815 container.push_front(n); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1816 break; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1817 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1818 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1819 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1820 return ret; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1821 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1822 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1823 string SaveFaceHash::Get(int num) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1824 if (num < 0) return ""; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1825 List::iterator it = container.begin(); |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1826 for (; it != container.end(); it++) { |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1827 if (num == 0) return it->first; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1828 num--; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1829 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1830 return ""; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1831 } |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1832 |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1833 int SaveFaceHash::size_max = 20; |
c7bcc0ec2267
* replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
55
diff
changeset
|
1834 |