annotate scn2k/scn2k_text.cc @ 67:419761c8d9b9

Add configure option to build scn2kdump.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 23 Feb 2011 01:48:51 +0100
parents d112357a0ec1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
223b71206888 Initial import
thib
parents:
diff changeset
1 /*
223b71206888 Initial import
thib
parents:
diff changeset
2 TODO:
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
3 日付のラベルが画面切り替え時に欠けるのを修正
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
4 画像効果 : 人間の入れ換わりなど
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
5 kcursor の操作を WidText クラスに任せる
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
6 WidText クラスには新たに以下の操作を加える
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
7 ・ウェイト終了後、クリアなしに新たなテキストを追加、新たにstart-waitする
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
8 ・文字の描画 (Start) と Wait(カーソル表示待ち)の分離。
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
9 Start すると文字を描画開始する。クリックで全描画。
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
10 Flush するとバッファ内の文字をすべて描画する
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
11 Wait すると全描画後、クリックされるまでカーソルを表示するまで待つ
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
12 Text 側の状態としては Wait のみを持つ (PREPAREに戻るのを待つ)
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
13 ただし、Skip の権利はどっちがもつ?(現状は?)
0
223b71206888 Initial import
thib
parents:
diff changeset
14
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
15 GrpObj: NextObj と GrpObj を分離。CreateObj は現状通り、Visible=1 時に行う。
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
16 それぞれ num=0 (screen) の枝leaf として実装。delete時は親のdeleteのみを
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
17 行い、子はGrpObjの実体だけを削除する
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
18 Visible 後のhide は実際に hide とする
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
19 ExecReservedCmd() はなくせるはず。Delete() もなくなる。
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
20 カノギ:ReBlit() がうまくいかないせいで名前ウィンドウが消えた時の背景がなくなる
0
223b71206888 Initial import
thib
parents:
diff changeset
21
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
22 くら:回想表示
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
23 SEL画像効果
0
223b71206888 Initial import
thib
parents:
diff changeset
24 DONE:
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
25 ともよのテキストウィンドウ実装、ボタン実装
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
26 shake の画像効果
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
27 オブジェクト内のテキスト色の実装
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
28 画像効果の改善
0
223b71206888 Initial import
thib
parents:
diff changeset
29 */
223b71206888 Initial import
thib
parents:
diff changeset
30
223b71206888 Initial import
thib
parents:
diff changeset
31 /*
223b71206888 Initial import
thib
parents:
diff changeset
32 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
223b71206888 Initial import
thib
parents:
diff changeset
33 * All rights reserved.
223b71206888 Initial import
thib
parents:
diff changeset
34 *
223b71206888 Initial import
thib
parents:
diff changeset
35 * Redistribution and use in source and binary forms, with or without
223b71206888 Initial import
thib
parents:
diff changeset
36 * modification, are permitted provided that the following conditions
223b71206888 Initial import
thib
parents:
diff changeset
37 * are met:
223b71206888 Initial import
thib
parents:
diff changeset
38 * 1. Redistributions of source code must retain the above copyright
223b71206888 Initial import
thib
parents:
diff changeset
39 * notice, this list of conditions and the following disclaimer.
223b71206888 Initial import
thib
parents:
diff changeset
40 * 2. Redistributions in binary form must reproduce the above copyright
223b71206888 Initial import
thib
parents:
diff changeset
41 * notice, this list of conditions and the following disclaimer in the
223b71206888 Initial import
thib
parents:
diff changeset
42 * documentation and/or other materials provided with the distribution.
223b71206888 Initial import
thib
parents:
diff changeset
43 * 3. The name of the author may not be used to endorse or promote products
223b71206888 Initial import
thib
parents:
diff changeset
44 * derived from this software without specific prior written permission.
223b71206888 Initial import
thib
parents:
diff changeset
45 *
223b71206888 Initial import
thib
parents:
diff changeset
46 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
223b71206888 Initial import
thib
parents:
diff changeset
47 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
223b71206888 Initial import
thib
parents:
diff changeset
48 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
223b71206888 Initial import
thib
parents:
diff changeset
49 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
223b71206888 Initial import
thib
parents:
diff changeset
50 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
223b71206888 Initial import
thib
parents:
diff changeset
51 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
223b71206888 Initial import
thib
parents:
diff changeset
52 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
223b71206888 Initial import
thib
parents:
diff changeset
53 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
223b71206888 Initial import
thib
parents:
diff changeset
54 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
223b71206888 Initial import
thib
parents:
diff changeset
55 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
223b71206888 Initial import
thib
parents:
diff changeset
56 */
223b71206888 Initial import
thib
parents:
diff changeset
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
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
60 #include "system/file.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
61 #include "scn2k.h"
0
223b71206888 Initial import
thib
parents:
diff changeset
62
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
63 #include <string>
0
223b71206888 Initial import
thib
parents:
diff changeset
64 using namespace std;
223b71206888 Initial import
thib
parents:
diff changeset
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
223b71206888 Initial import
thib
parents:
diff changeset
67
223b71206888 Initial import
thib
parents:
diff changeset
68 /**************************************************************::
223b71206888 Initial import
thib
parents:
diff changeset
69 **
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
70 ** Text(implementation)
0
223b71206888 Initial import
thib
parents:
diff changeset
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),
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
74 old_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
223b71206888 Initial import
thib
parents:
diff changeset
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
223b71206888 Initial import
thib
parents:
diff changeset
78 int i;
223b71206888 Initial import
thib
parents:
diff changeset
79 for (i=0; i<32; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
80 widgets[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
81 }
223b71206888 Initial import
thib
parents:
diff changeset
82 text_stream.kanji_type = TextStream::sjis;
223b71206888 Initial import
thib
parents:
diff changeset
83 event.RegisterGlobalPressFunc(&PressFunc, (void*)this);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
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
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
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
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
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
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
104 RegisterCommand(1, 4, 2600, "DefMessageSpeed", (CmdImpl) &Text::impl_GetDefConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
105 RegisterCommand(1, 4, 2601, "DefMessageNoWait", (CmdImpl) &Text::impl_GetDefConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
106 RegisterCommand(1, 4, 2604, "DefAutoMode", (CmdImpl) &Text::impl_GetDefConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
107 RegisterCommand(1, 4, 2605, "DefAutoCharTime", (CmdImpl) &Text::impl_GetDefConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
108 RegisterCommand(1, 4, 2606, "DefAutoBaseTime", (CmdImpl) &Text::impl_GetDefConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
109
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
110 RegisterCommand(1, 4, 2323, "MessageSpeed", (CmdImpl) &Text::impl_GetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
111 RegisterCommand(1, 4, 2324, "MessageNoWait", (CmdImpl) &Text::impl_GetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
112 RegisterCommand(1, 4, 2350, "AutoMode", (CmdImpl) &Text::impl_GetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
113 RegisterCommand(1, 4, 2351, "AutoCharTime", (CmdImpl) &Text::impl_GetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
114 RegisterCommand(1, 4, 2352, "AutoBaseTime", (CmdImpl) &Text::impl_GetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
115
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
116 RegisterCommand(1, 4, 2223, "SetMessageSpeed", (CmdImpl) &Text::impl_SetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
117 RegisterCommand(1, 4, 2224, "SetMessageNoWait", (CmdImpl) &Text::impl_SetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
118 RegisterCommand(1, 4, 2250, "SetAutoMode", (CmdImpl) &Text::impl_SetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
119 RegisterCommand(1, 4, 2251, "SetAutoCharTime", (CmdImpl) &Text::impl_SetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
120 RegisterCommand(1, 4, 2252, "SetAutoBaseTime", (CmdImpl) &Text::impl_SetConfig);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
121
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
122 RegisterCommand(1, 4, 1300, "GetName", (CmdImpl) &Text::impl_GetName);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
123 RegisterCommand(1, 4, 1301, "SetName", (CmdImpl) &Text::impl_SetName);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
124 RegisterCommand(1, 4, 1310, "GetLocalName", (CmdImpl) &Text::impl_GetLocalName);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
125 RegisterCommand(1, 4, 1311, "SetLocalName", (CmdImpl) &Text::impl_SetLocalName);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
126
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
127 RegisterCommand(0, 2, 1, "select", (CmdImpl) &Text::impl_createSelect);
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
128 RegisterCommand(0, 2, 3, "select2?", (CmdImpl) &Text::impl_createSelect); //FIXME: What difference with select?
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
129
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
130 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
131 RegisterCommand(0, 4, 1100, "SetSkipMode", (CmdImpl) &Text::impl_SetSkipMode);
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
132
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
133 RegisterCommand(1, 4, 2260, "SetWindowAttrR", (CmdImpl) &Text::impl_SetWindowAttr);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
134 RegisterCommand(1, 4, 2261, "SetWindowAttrG", (CmdImpl) &Text::impl_SetWindowAttr);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
135 RegisterCommand(1, 4, 2262, "SetWindowAttrB", (CmdImpl) &Text::impl_SetWindowAttr);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
136 RegisterCommand(1, 4, 2263, "SetWindowAttrA", (CmdImpl) &Text::impl_SetWindowAttr);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
137 RegisterCommand(1, 4, 2264, "SetWindowAttrF", (CmdImpl) &Text::impl_SetWindowAttr);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
138 RegisterCommand(1, 4, 2267, "SetWindowAttr", (CmdImpl) &Text::impl_SetWindowAttr);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
139 RegisterCommand(1, 4, 2367, "GetWindowAttr", (CmdImpl) &Text::impl_GetWindowAttr);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
140 RegisterCommand(1, 4, 2617, "DefWindowAttr", (CmdImpl) &Text::impl_GetWindowAttr);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
141
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
142 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
143 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
144 RegisterCommand(1, 4, 121, "timeEx", (CmdImpl) &Text::impl_Wait);
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
145 RegisterCommand(1, 4, 101, "waitC", (CmdImpl) &Text::impl_Wait);
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
146 RegisterCommand(1, 4, 112, "timeC", (CmdImpl) &Text::impl_Wait);
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
147 RegisterCommand(1, 4, 131, "GetClick", (CmdImpl) &Text::impl_GetClick);
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
148
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
149 RegisterCommand(1, 4, 364, "PauseCursor", (CmdImpl) &Text::impl_PauseCursor);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
150 RegisterCommand(1, 4, 3009, "load", (CmdImpl) &Text::impl_load);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
151
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
152 RegisterCommand(1, 4, 500, "InitFrame", (CmdImpl) &Text::impl_InitFrame);
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
153 RegisterCommand(1, 4, 510, "ReadFrame", (CmdImpl) &Text::impl_ReadFrame);
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
154 RegisterCommand(1, 4, 620, "InitExFrames", (CmdImpl) &Text::impl_InitFrames);
59
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
155 RegisterCommand(1, 4, 624, "InitExFramesDecel", (CmdImpl) &Text::impl_InitFrames);
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
156 RegisterCommand(1, 4, 630, "ReadExFrames", (CmdImpl) &Text::impl_ReadFrames);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
157
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
158 RegisterCommand(1, 4, 110, "ResetTimer", (CmdImpl) &Text::impl_ResetTimer);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
159 RegisterCommand(1, 4, 120, "ResetExTimer", (CmdImpl) &Text::impl_ResetTimer);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
160 RegisterCommand(1, 4, 114, "Timer", (CmdImpl) &Text::impl_Timer);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
161
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
162 RegisterCommand(1, 4, 800, "index_series", (CmdImpl) &Text::impl_index_series);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
163
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
164 RegisterCommand(1, 4, 1000, "rnd", (CmdImpl) &Text::impl_rnd);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
165 RegisterCommand(1, 4, 1001, "pcnt", (CmdImpl) &Text::impl_pcnt);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
166 RegisterCommand(1, 4, 1002, "abs", (CmdImpl) &Text::impl_abs);
59
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
167 RegisterCommand(1, 4, 1003, "power", (CmdImpl) &Text::impl_power);
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
168 RegisterCommand(1, 4, 1004, "sin", (CmdImpl) &Text::impl_sin);
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
169 RegisterCommand(1, 4, 1007, "min", (CmdImpl) &Text::impl_min);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
170 RegisterCommand(1, 4, 1008, "max", (CmdImpl) &Text::impl_max);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
171 RegisterCommand(1, 4, 1009, "constrain", (CmdImpl) &Text::impl_constrain);
0
223b71206888 Initial import
thib
parents:
diff changeset
172 }
223b71206888 Initial import
thib
parents:
diff changeset
173
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
174 Text::~Text() {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
175 if (sel_widget != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
176 delete sel_widget;
0
223b71206888 Initial import
thib
parents:
diff changeset
177 int i;
223b71206888 Initial import
thib
parents:
diff changeset
178 for (i=0; i<32; i++) {
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
179 if (widgets[i] != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
180 delete widgets[i];
0
223b71206888 Initial import
thib
parents:
diff changeset
181 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
182 if (backlog_widget != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
183 delete backlog_widget;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
184 if (sel_bg1 != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
185 parent.Root().DeleteSurface(sel_bg1);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
186 if (sel_bg2 != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
187 parent.Root().DeleteSurface(sel_bg2);
0
223b71206888 Initial import
thib
parents:
diff changeset
188 event.DeleteGlobalPressFunc(&PressFunc, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
189 }
223b71206888 Initial import
thib
parents:
diff changeset
190
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
191 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
192 Text* t = (Text*)pointer;
0
223b71206888 Initial import
thib
parents:
diff changeset
193 if (t->status == WAIT_CLICK) {
223b71206888 Initial import
thib
parents:
diff changeset
194 t->status = WAIT_ABORT;
223b71206888 Initial import
thib
parents:
diff changeset
195 } else if (t->status == WAIT_CLICK_MOUSEPOS) {
223b71206888 Initial import
thib
parents:
diff changeset
196 t->status = WAIT_CLICK_MOUSEPOSEND_L;
223b71206888 Initial import
thib
parents:
diff changeset
197 } else if (t->status_mask & CLEARSCR_WAIT_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
198 t->status_mask = Status(t->status_mask & (~CLEARSCR_WAIT_MASK));
223b71206888 Initial import
thib
parents:
diff changeset
199 if (t->text) t->text->show();
223b71206888 Initial import
thib
parents:
diff changeset
200 if (t->kcursor) {
223b71206888 Initial import
thib
parents:
diff changeset
201 if (t->status == WAIT_TEXT) t->kcursor->show();
223b71206888 Initial import
thib
parents:
diff changeset
202 }
223b71206888 Initial import
thib
parents:
diff changeset
203 if (t->sel_widget) t->sel_widget->show();
223b71206888 Initial import
thib
parents:
diff changeset
204 if (t->backlog_widget) t->backlog_widget->show();
223b71206888 Initial import
thib
parents:
diff changeset
205 } else if (t->status_mask & BACKLOG_WAIT_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
206 t->status_mask = Status(t->status_mask | BACKLOG_MASK_KOE);
223b71206888 Initial import
thib
parents:
diff changeset
207 } else if ( (t->skip_mode & SKIP_TEXT) && (!(t->skip_mode & SKIP_IN_MENU)) ) {
223b71206888 Initial import
thib
parents:
diff changeset
208 if (t->status == WAIT_SELECT_INBOX) ;
223b71206888 Initial import
thib
parents:
diff changeset
209 else if (t->status == WAIT_SELECT_OUTBOX) ;
223b71206888 Initial import
thib
parents:
diff changeset
210 else if (t->status == WAIT_SELECT_VALUE) ;
223b71206888 Initial import
thib
parents:
diff changeset
211 else t->status_mask = Status(t->status_mask | SKIPEND_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
212 }
223b71206888 Initial import
thib
parents:
diff changeset
213 return true; // event not deleted
223b71206888 Initial import
thib
parents:
diff changeset
214 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
215
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
216 void Text::PressFuncButton(void* pointer, WidButton* from) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
217 Text* t = (Text*)pointer;
0
223b71206888 Initial import
thib
parents:
diff changeset
218 if (t->status != WAIT_SELECT_INBOX && t->status != WAIT_SELECT_OUTBOX) return;
223b71206888 Initial import
thib
parents:
diff changeset
219 vector<WidTextButton*>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
220 int sel = 0;
223b71206888 Initial import
thib
parents:
diff changeset
221 for (it=t->selects.begin(); it != t->selects.end(); it++, sel++) {
223b71206888 Initial import
thib
parents:
diff changeset
222 if (from == *it) break;
223b71206888 Initial import
thib
parents:
diff changeset
223 }
223b71206888 Initial import
thib
parents:
diff changeset
224 if (it == t->selects.end()) {
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
225 fprintf(stderr,"Text::PressFuncButton: Cannot find select widget\n");
0
223b71206888 Initial import
thib
parents:
diff changeset
226 return;
223b71206888 Initial import
thib
parents:
diff changeset
227 }
223b71206888 Initial import
thib
parents:
diff changeset
228 t->status = Status(WAIT_SELECT_VALUE + sel);
223b71206888 Initial import
thib
parents:
diff changeset
229 }
223b71206888 Initial import
thib
parents:
diff changeset
230
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
231 void Text::SetSkipMode(SkipMode _mode) {
0
223b71206888 Initial import
thib
parents:
diff changeset
232 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
233 if (status_mask & BACKLOG_WAIT_MASK) { // backlog mode から復帰
0
223b71206888 Initial import
thib
parents:
diff changeset
234 status_mask = Status(status_mask & (~(BACKLOG_MASK|BACKLOG_MASK_FWD|BACKLOG_MASK_KOE|BACKLOG_WAIT_MASK)));
223b71206888 Initial import
thib
parents:
diff changeset
235 text->wid->Clear();
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
236 if (status == WAIT_TEXT && text != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
237 text->StartText(text_stream);
223b71206888 Initial import
thib
parents:
diff changeset
238 text->ShowFace(backlog_item.face.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
239 text->wid->Flush();
223b71206888 Initial import
thib
parents:
diff changeset
240 if (kcursor) kcursor->show();
223b71206888 Initial import
thib
parents:
diff changeset
241 }
223b71206888 Initial import
thib
parents:
diff changeset
242 drawn_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
243 }
223b71206888 Initial import
thib
parents:
diff changeset
244 if (text) text->wid->activate();
223b71206888 Initial import
thib
parents:
diff changeset
245 if (sel_widget) {
223b71206888 Initial import
thib
parents:
diff changeset
246 sel_widget->show();
223b71206888 Initial import
thib
parents:
diff changeset
247 if (kcursor) kcursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
248 }
223b71206888 Initial import
thib
parents:
diff changeset
249 if (backlog_widget) backlog_widget->show();
223b71206888 Initial import
thib
parents:
diff changeset
250 if (status_mask & STATSAVE_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
251 status_mask = Status(status_mask & (~STATSAVE_MASK));
223b71206888 Initial import
thib
parents:
diff changeset
252 status = status_saved;
223b71206888 Initial import
thib
parents:
diff changeset
253 }
223b71206888 Initial import
thib
parents:
diff changeset
254 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) {
223b71206888 Initial import
thib
parents:
diff changeset
255 if (text) text->wid->deactivate();
223b71206888 Initial import
thib
parents:
diff changeset
256 if (sel_widget) sel_widget->hide();
223b71206888 Initial import
thib
parents:
diff changeset
257 if (backlog_widget) backlog_widget->hide();
223b71206888 Initial import
thib
parents:
diff changeset
258 }
223b71206888 Initial import
thib
parents:
diff changeset
259 skip_mode = _mode;
223b71206888 Initial import
thib
parents:
diff changeset
260 }
223b71206888 Initial import
thib
parents:
diff changeset
261
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
262 void Text::InitWindow(void) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
263 int i;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
264 int w;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
265 std::string str;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
266
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
267 for (w=0; w<32; w++) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
268 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
269 if (widgets[w]->wid == 0) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
270 delete widgets[w];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
271 widgets[w] = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
272 }
223b71206888 Initial import
thib
parents:
diff changeset
273 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
274 SetCursor(0);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
275 for (i=0; i<26; i++) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
276 char buf[1024];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
277 sprintf(buf, "#NAME.%c", i+'A');
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
278 const char* s = config->GetParaStr(buf);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
279 if (s != NULL) replace_name[i] = s;
0
223b71206888 Initial import
thib
parents:
diff changeset
280 }
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
281 // replace_name2 : 初期設定
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
282 // 渚、秋生、渚 (CLANNAD)
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
283 char name_nagisa[3] = {'\x8f', '\x8d', '\0'};
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
284 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
285 replace_name2[0] = name_nagisa;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
286 replace_name2[1] = name_akio;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
287 replace_name2[2] = name_nagisa;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
288 text = NULL;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
289 /* テキスト速度の設定 */
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
290 int speed, mod, wait, auto_mod;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
291 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
292 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
293 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
294 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
295 if (mod) speed = -1;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
296 if (!auto_mod) wait = -1;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
297 SetTextSpeed(speed);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
298 SetTextWait(wait);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
299 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
300
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
301 void Text::Save(string& str, bool rollback_save) {
0
223b71206888 Initial import
thib
parents:
diff changeset
302 char buf[1024];
223b71206888 Initial import
thib
parents:
diff changeset
303 str = "\n";
66
d112357a0ec1 Fix a bug with savegames introduced with changeset c7bcc0ec2267.
Thibaut Girka <thib@sitedethib.com>
parents: 65
diff changeset
304 str += "[TextImpl Window]\n";
d112357a0ec1 Fix a bug with savegames introduced with changeset c7bcc0ec2267.
Thibaut Girka <thib@sitedethib.com>
parents: 65
diff changeset
305 sprintf(buf, "TextImplWindow=%d\n", text_window_number);
0
223b71206888 Initial import
thib
parents:
diff changeset
306 str += buf;
223b71206888 Initial import
thib
parents:
diff changeset
307 if (rollback_save) {
223b71206888 Initial import
thib
parents:
diff changeset
308 ++save_selectcount;
223b71206888 Initial import
thib
parents:
diff changeset
309 BacklogItem save_item;
223b71206888 Initial import
thib
parents:
diff changeset
310 save_item.SetSavepos(save_selectcount);
223b71206888 Initial import
thib
parents:
diff changeset
311 backlog.push_back(save_item);
223b71206888 Initial import
thib
parents:
diff changeset
312 }
223b71206888 Initial import
thib
parents:
diff changeset
313 sprintf(buf, "SaveSelectCount=%d\n",save_selectcount);
223b71206888 Initial import
thib
parents:
diff changeset
314
223b71206888 Initial import
thib
parents:
diff changeset
315 str += buf;
223b71206888 Initial import
thib
parents:
diff changeset
316 int i;
223b71206888 Initial import
thib
parents:
diff changeset
317 for (i=0; i<26; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
318 if (replace_name2[i].empty()) continue;
223b71206888 Initial import
thib
parents:
diff changeset
319 sprintf(buf, "RName.%c=%s\n",i+'A',replace_name2[i].c_str());
223b71206888 Initial import
thib
parents:
diff changeset
320 str += buf;
223b71206888 Initial import
thib
parents:
diff changeset
321 }
223b71206888 Initial import
thib
parents:
diff changeset
322 int cnt = 0;
223b71206888 Initial import
thib
parents:
diff changeset
323 vector<BacklogItem>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
324 it = backlog.begin();
223b71206888 Initial import
thib
parents:
diff changeset
325 if (!rollback_save) {
223b71206888 Initial import
thib
parents:
diff changeset
326 SaveFaceHash face_log;
223b71206888 Initial import
thib
parents:
diff changeset
327 do {
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
328 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
329 sprintf(buf, "Backlog.%d=",++cnt);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
330 str += buf;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
331 for (; it != backlog.end(); it++) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
332 buf[0] = 0;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
333 int buflen = 0;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
334 if (it->scn == -1)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
335 continue;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
336 if (it->pos == -1 && it->scn != 0)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
337 continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
338
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
339 buf[buflen++] = ';';
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
340 if (it->scn == 0 && it->pos == -1)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
341 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
342 else {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
343 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
344 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
345 if (!it->text.container.empty()) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
346 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
347 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
348 if (cur_scn == -1) { // scene change
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
349 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
350 cur_scn = it->scn;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
351 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
352 else
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
353 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
354 cur_pos = it->pos;
0
223b71206888 Initial import
thib
parents:
diff changeset
355 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
356 if (it->koe != -1)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
357 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
358 if (!it->face.empty()) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
359 if (it->koe == -1) buf[buflen++] = ',';
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
360 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
361 if (face_num >= 0 && face_num < 20)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
362 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
363 else
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
364 buflen += snprintf(buf+buflen, 1000-buflen, ",\"%s\"", it->face.c_str());
0
223b71206888 Initial import
thib
parents:
diff changeset
365 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
366 buf[buflen++] = '\0';
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
367 if (buflen >= 1000) { // 万が一、バックログ1アイテムの大きさが 1000byte を越えるとき
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
368 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
369 } else str += buf;
0
223b71206888 Initial import
thib
parents:
diff changeset
370 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
371 str += "\n";
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
372 } while(it != backlog.end());
0
223b71206888 Initial import
thib
parents:
diff changeset
373 }
223b71206888 Initial import
thib
parents:
diff changeset
374 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
375
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
376 void Text::Load(const char* str) {
0
223b71206888 Initial import
thib
parents:
diff changeset
377 if (text) text->wid->Clear();
223b71206888 Initial import
thib
parents:
diff changeset
378 hide();
223b71206888 Initial import
thib
parents:
diff changeset
379 text_window_number = 0;
223b71206888 Initial import
thib
parents:
diff changeset
380 save_selectcount = 0;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
381 if (sel_widget != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
382 selects.clear();
223b71206888 Initial import
thib
parents:
diff changeset
383 sel_backlog_pos.clear();
223b71206888 Initial import
thib
parents:
diff changeset
384 delete sel_widget;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
385 sel_widget = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
386 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
387 if (backlog_widget != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
388 delete backlog_widget;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
389 backlog_widget = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
390 }
223b71206888 Initial import
thib
parents:
diff changeset
391 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
392 status_mask = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
393 status_saved = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
394 text_parsing = false;
223b71206888 Initial import
thib
parents:
diff changeset
395 text_stream.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
396 // backlog.clear();
223b71206888 Initial import
thib
parents:
diff changeset
397 vector<BacklogItem> new_backlog;
223b71206888 Initial import
thib
parents:
diff changeset
398 backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
399 cur_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
400 drawn_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
401
66
d112357a0ec1 Fix a bug with savegames introduced with changeset c7bcc0ec2267.
Thibaut Girka <thib@sitedethib.com>
parents: 65
diff changeset
402 str = strstr(str, "\n[TextImpl Window]\n");
0
223b71206888 Initial import
thib
parents:
diff changeset
403
223b71206888 Initial import
thib
parents:
diff changeset
404 if (str) {
223b71206888 Initial import
thib
parents:
diff changeset
405 SaveFaceHash face_log;
66
d112357a0ec1 Fix a bug with savegames introduced with changeset c7bcc0ec2267.
Thibaut Girka <thib@sitedethib.com>
parents: 65
diff changeset
406 str += strlen("\n[TextImpl Window]\n");
0
223b71206888 Initial import
thib
parents:
diff changeset
407 const char* strend = str;
223b71206888 Initial import
thib
parents:
diff changeset
408 do {
223b71206888 Initial import
thib
parents:
diff changeset
409 str = strend;
223b71206888 Initial import
thib
parents:
diff changeset
410
223b71206888 Initial import
thib
parents:
diff changeset
411 strend = strchr(str, '\n');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
412 if (strend == NULL) strend = str + strlen(str);
0
223b71206888 Initial import
thib
parents:
diff changeset
413 else strend++;
223b71206888 Initial import
thib
parents:
diff changeset
414
223b71206888 Initial import
thib
parents:
diff changeset
415 if (str[0] == '[') break; // next section
66
d112357a0ec1 Fix a bug with savegames introduced with changeset c7bcc0ec2267.
Thibaut Girka <thib@sitedethib.com>
parents: 65
diff changeset
416 if (strncmp(str, "TextImplWindow=",15) == 0) {
0
223b71206888 Initial import
thib
parents:
diff changeset
417 str += 15;
223b71206888 Initial import
thib
parents:
diff changeset
418 sscanf(str, "%d", &text_window_number);
223b71206888 Initial import
thib
parents:
diff changeset
419 } else if (strncmp(str, "SaveSelectCount=",16) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
420 str += 16;
223b71206888 Initial import
thib
parents:
diff changeset
421 sscanf(str, "%d", &save_selectcount);
223b71206888 Initial import
thib
parents:
diff changeset
422 } else if (strncmp(str, "RName.", 6) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
423 int n = str[6]-'A';
223b71206888 Initial import
thib
parents:
diff changeset
424 if (n >= 0 && n < 26 && str[7] == '=') {
223b71206888 Initial import
thib
parents:
diff changeset
425 const char* s = strchr(str, '\n');
223b71206888 Initial import
thib
parents:
diff changeset
426 int len = -1;
223b71206888 Initial import
thib
parents:
diff changeset
427 if (s) len = s-(str+8);
223b71206888 Initial import
thib
parents:
diff changeset
428 if (len > 0) {
223b71206888 Initial import
thib
parents:
diff changeset
429 replace_name2[n].assign(str+8, len);
223b71206888 Initial import
thib
parents:
diff changeset
430 }
223b71206888 Initial import
thib
parents:
diff changeset
431 }
223b71206888 Initial import
thib
parents:
diff changeset
432 } else if (strncmp(str, "Backlog.", 8) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
433 int cur_scn = -1;
223b71206888 Initial import
thib
parents:
diff changeset
434 int n = -1;
223b71206888 Initial import
thib
parents:
diff changeset
435 sscanf(str+8, "%d", &n); /* not used */
223b71206888 Initial import
thib
parents:
diff changeset
436 const char* next_str = strchr(str, ';');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
437 while(next_str != NULL && next_str < strend) {
0
223b71206888 Initial import
thib
parents:
diff changeset
438 str = next_str + 1;
223b71206888 Initial import
thib
parents:
diff changeset
439 next_str = strchr(str, ';');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
440 if (next_str == NULL) next_str = strend;
0
223b71206888 Initial import
thib
parents:
diff changeset
441
223b71206888 Initial import
thib
parents:
diff changeset
442 BacklogItem item;
223b71206888 Initial import
thib
parents:
diff changeset
443 if (str[0] == '"') {
223b71206888 Initial import
thib
parents:
diff changeset
444 const char* send = strchr(str+1, '"');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
445 if (send == NULL || send > next_str) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
446 string tmp_str; tmp_str.assign(str+1, send-str-1);
223b71206888 Initial import
thib
parents:
diff changeset
447 item.DeleteTextPos();
223b71206888 Initial import
thib
parents:
diff changeset
448 item.text.Load(tmp_str);
223b71206888 Initial import
thib
parents:
diff changeset
449 str = send + 1;
223b71206888 Initial import
thib
parents:
diff changeset
450 }
223b71206888 Initial import
thib
parents:
diff changeset
451 if (str[0] == '.') {
223b71206888 Initial import
thib
parents:
diff changeset
452 item.DeleteTextPos();
223b71206888 Initial import
thib
parents:
diff changeset
453 str++;
223b71206888 Initial import
thib
parents:
diff changeset
454 } else if (str[0] == ':') {
223b71206888 Initial import
thib
parents:
diff changeset
455 sscanf(str, ":%d:%d", &item.scn, &item.pos);
223b71206888 Initial import
thib
parents:
diff changeset
456 cur_scn = item.scn;
223b71206888 Initial import
thib
parents:
diff changeset
457
223b71206888 Initial import
thib
parents:
diff changeset
458 } else {
223b71206888 Initial import
thib
parents:
diff changeset
459 item.scn = cur_scn;
223b71206888 Initial import
thib
parents:
diff changeset
460 sscanf(str, "%d", &item.pos);
223b71206888 Initial import
thib
parents:
diff changeset
461 }
223b71206888 Initial import
thib
parents:
diff changeset
462 str = strchr(str, ',');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
463 if (str == NULL || str > next_str) goto backlog_store;
0
223b71206888 Initial import
thib
parents:
diff changeset
464 str++;
223b71206888 Initial import
thib
parents:
diff changeset
465 if (str[0] == ';' || str[0] == ',')
223b71206888 Initial import
thib
parents:
diff changeset
466 item.koe = -1;
223b71206888 Initial import
thib
parents:
diff changeset
467 else
223b71206888 Initial import
thib
parents:
diff changeset
468 sscanf(str, "%d", &item.koe);
223b71206888 Initial import
thib
parents:
diff changeset
469 str = strchr(str, ',');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
470 if (str == NULL || str > next_str) goto backlog_store;
0
223b71206888 Initial import
thib
parents:
diff changeset
471 str++;
223b71206888 Initial import
thib
parents:
diff changeset
472 if (*str == '"') {
223b71206888 Initial import
thib
parents:
diff changeset
473 const char* send = strchr(str+1, '"');
223b71206888 Initial import
thib
parents:
diff changeset
474 if (send) {
223b71206888 Initial import
thib
parents:
diff changeset
475 item.face.assign(str+1, send-str-1);
223b71206888 Initial import
thib
parents:
diff changeset
476 }
223b71206888 Initial import
thib
parents:
diff changeset
477 } else if (*str >= 'A' && *str <= 'Z') {
223b71206888 Initial import
thib
parents:
diff changeset
478 item.face = face_log.Get(*str - 'A');
223b71206888 Initial import
thib
parents:
diff changeset
479 }
223b71206888 Initial import
thib
parents:
diff changeset
480 face_log.Add(item.face);
223b71206888 Initial import
thib
parents:
diff changeset
481 backlog_store:
223b71206888 Initial import
thib
parents:
diff changeset
482 new_backlog.push_back(item);
223b71206888 Initial import
thib
parents:
diff changeset
483 }
223b71206888 Initial import
thib
parents:
diff changeset
484 }
223b71206888 Initial import
thib
parents:
diff changeset
485 } while (*strend != 0);
223b71206888 Initial import
thib
parents:
diff changeset
486 }
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
487 if (new_backlog.empty() && (!backlog.empty())) { // empty なら save_selectcount まで backlog を巻き戻す
0
223b71206888 Initial import
thib
parents:
diff changeset
488 vector<BacklogItem>::iterator it = backlog.end();
223b71206888 Initial import
thib
parents:
diff changeset
489 do {
223b71206888 Initial import
thib
parents:
diff changeset
490 it--;
223b71206888 Initial import
thib
parents:
diff changeset
491 if (it->scn == BacklogItem::SaveSelect && it->pos == save_selectcount) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
492 // Save 位置を見つけたらそれ以降を erase
0
223b71206888 Initial import
thib
parents:
diff changeset
493 backlog.erase(it, backlog.end());
223b71206888 Initial import
thib
parents:
diff changeset
494 break;
223b71206888 Initial import
thib
parents:
diff changeset
495 }
223b71206888 Initial import
thib
parents:
diff changeset
496 } while(it != backlog.begin());
223b71206888 Initial import
thib
parents:
diff changeset
497 --save_selectcount;
223b71206888 Initial import
thib
parents:
diff changeset
498 } else {
223b71206888 Initial import
thib
parents:
diff changeset
499 backlog.swap(new_backlog);
223b71206888 Initial import
thib
parents:
diff changeset
500 }
223b71206888 Initial import
thib
parents:
diff changeset
501 // backlog.clear();
223b71206888 Initial import
thib
parents:
diff changeset
502 }
223b71206888 Initial import
thib
parents:
diff changeset
503
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
504 void Text::hide(void) {
0
223b71206888 Initial import
thib
parents:
diff changeset
505 if (text) text->hide();
223b71206888 Initial import
thib
parents:
diff changeset
506 if (kcursor) kcursor->hide();
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
507 text = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
508 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
509 void Text::show(int num) {
0
223b71206888 Initial import
thib
parents:
diff changeset
510 if (num != text_window_number) {
223b71206888 Initial import
thib
parents:
diff changeset
511 hide();
223b71206888 Initial import
thib
parents:
diff changeset
512 if (num >= 0 && num < 32 && widgets[num] != 0) {
223b71206888 Initial import
thib
parents:
diff changeset
513 text_window_number = num;
223b71206888 Initial import
thib
parents:
diff changeset
514 }
223b71206888 Initial import
thib
parents:
diff changeset
515 }
223b71206888 Initial import
thib
parents:
diff changeset
516 text = widgets[text_window_number];
223b71206888 Initial import
thib
parents:
diff changeset
517 text->show();
223b71206888 Initial import
thib
parents:
diff changeset
518 if (kcursor) {
223b71206888 Initial import
thib
parents:
diff changeset
519 int kx, ky, d;
223b71206888 Initial import
thib
parents:
diff changeset
520 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
521 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
522 config->GetParam(key, 3, &d, &kx, &ky);
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
523 // 正しくない気がする
0
223b71206888 Initial import
thib
parents:
diff changeset
524 kx += text->wid->Pic()->PosX();
223b71206888 Initial import
thib
parents:
diff changeset
525 ky += text->wid->Pic()->PosY();
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
526 // 微妙に下にする
0
223b71206888 Initial import
thib
parents:
diff changeset
527 ky += 8;
223b71206888 Initial import
thib
parents:
diff changeset
528 kcursor->Pic()->Move(kx, ky);
223b71206888 Initial import
thib
parents:
diff changeset
529 }
223b71206888 Initial import
thib
parents:
diff changeset
530 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
531
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
532 void Text::DrawBacklog(BacklogItem& item, Cmd& cmd) {
18
4d7486cb20a9 Sync with upstream
thib
parents: 17
diff changeset
533 show();
0
223b71206888 Initial import
thib
parents:
diff changeset
534 text->wid->deactivate();
223b71206888 Initial import
thib
parents:
diff changeset
535 status_mask = Status(status_mask | BACKLOG_WAIT_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
536 drawn_backlog_item = item;
223b71206888 Initial import
thib
parents:
diff changeset
537 if (item.text.container.empty()) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
538 // cmd から text 内容を再構成
0
223b71206888 Initial import
thib
parents:
diff changeset
539 TextStream saved_text = text_stream;
223b71206888 Initial import
thib
parents:
diff changeset
540 text_stream.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
541 AddText(cmd.Str(cmd.args[0]));
223b71206888 Initial import
thib
parents:
diff changeset
542 item.text = text_stream;
223b71206888 Initial import
thib
parents:
diff changeset
543 text_stream = saved_text;
223b71206888 Initial import
thib
parents:
diff changeset
544 }
18
4d7486cb20a9 Sync with upstream
thib
parents: 17
diff changeset
545 item.text.InsertColor(0, item.text.container.size(), 0xff,0xff,0);
17
a95c130b567b Shows name in backlog
thib
parents: 0
diff changeset
546 text->StartText(item.text);
0
223b71206888 Initial import
thib
parents:
diff changeset
547 text->wid->Flush();
223b71206888 Initial import
thib
parents:
diff changeset
548 if (item.face.empty()) text->ResetFace();
223b71206888 Initial import
thib
parents:
diff changeset
549 else text->ShowFace(item.face.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
550 if (kcursor) kcursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
551 }
223b71206888 Initial import
thib
parents:
diff changeset
552
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
553 void Text::CreateSelBG(void) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
554 if (sel_bg1 != NULL || sel_bg2 != NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
555
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
556 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
557 const char* btnfile2 = config->GetParaStr("#SELBTN.000.BACK");
0
223b71206888 Initial import
thib
parents:
diff changeset
558 char path[1024];
223b71206888 Initial import
thib
parents:
diff changeset
559 strcpy(path, btnfile1);
223b71206888 Initial import
thib
parents:
diff changeset
560 sel_bg1 = parent.Root().NewSurface(path);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
561 if (sel_bg1 == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
562 sprintf(path,"%s.g00",btnfile1);
223b71206888 Initial import
thib
parents:
diff changeset
563 sel_bg1 = parent.Root().NewSurface(path);
223b71206888 Initial import
thib
parents:
diff changeset
564 }
223b71206888 Initial import
thib
parents:
diff changeset
565 strcpy(path, btnfile2);
223b71206888 Initial import
thib
parents:
diff changeset
566 sel_bg2 = parent.Root().NewSurface(path);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
567 if (sel_bg2 == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
568 sprintf(path,"%s.g00",btnfile2);
223b71206888 Initial import
thib
parents:
diff changeset
569 sel_bg2 = parent.Root().NewSurface(path);
223b71206888 Initial import
thib
parents:
diff changeset
570 }
223b71206888 Initial import
thib
parents:
diff changeset
571 sel_bg_rect = Rect(0,0,0,0);
223b71206888 Initial import
thib
parents:
diff changeset
572 if (sel_bg1) sel_bg_rect.join(Rect(*sel_bg1));
223b71206888 Initial import
thib
parents:
diff changeset
573 if (sel_bg2) sel_bg_rect.join(Rect(*sel_bg2));
223b71206888 Initial import
thib
parents:
diff changeset
574 }
223b71206888 Initial import
thib
parents:
diff changeset
575
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
576 void Text::CreateSelect(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
577 char key[23];
0
223b71206888 Initial import
thib
parents:
diff changeset
578 sprintf(key, "#WINDOW.%03d.SELCOM_USE",text_window_number);
223b71206888 Initial import
thib
parents:
diff changeset
579 int sel_type = 0;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
580 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
581 else if (cmd.cmd3 == 3) sel_type = 0;
0
223b71206888 Initial import
thib
parents:
diff changeset
582
223b71206888 Initial import
thib
parents:
diff changeset
583 int sel_size = cmd.args.size() / 2;
223b71206888 Initial import
thib
parents:
diff changeset
584 int i;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
585 // cur_backlog_item に次にbacklogに入るべき内容を作成
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
586 // CreateSelect() 後、SAVEPOINT なので現在のbacklogの内容(前のメッセージ)が
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
587 // backlog に代入される。その後、backlog_item に cur_backlog_item の内容がセットされる(Wait()内)
0
223b71206888 Initial import
thib
parents:
diff changeset
588 char backlog_sel_text[11] = {0x81,0x69,0x91,0x49,0x91,0xf0,0x8e,0x88,0x81,0x6a,0x00};
223b71206888 Initial import
thib
parents:
diff changeset
589 cur_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
590 cur_backlog_item.AddTextPos(cmd);
223b71206888 Initial import
thib
parents:
diff changeset
591 cur_backlog_item.text.Add(backlog_sel_text);
223b71206888 Initial import
thib
parents:
diff changeset
592 cur_backlog_item.text.AddReturn();
223b71206888 Initial import
thib
parents:
diff changeset
593 sel_backlog_pos.clear();
223b71206888 Initial import
thib
parents:
diff changeset
594 for (i=0; i<sel_size; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
595 sel_backlog_pos.push_back(cur_backlog_item.text.container.size());
223b71206888 Initial import
thib
parents:
diff changeset
596 cur_backlog_item.text.Add(cmd.Str(cmd.args[i*2]));
223b71206888 Initial import
thib
parents:
diff changeset
597 cur_backlog_item.text.AddReturn();
223b71206888 Initial import
thib
parents:
diff changeset
598 }
223b71206888 Initial import
thib
parents:
diff changeset
599 sel_backlog_pos.push_back(cur_backlog_item.text.container.size());
223b71206888 Initial import
thib
parents:
diff changeset
600
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
601 if (sel_type == 0) { // Princess Bride: 選択ウィンドウを別表示
0
223b71206888 Initial import
thib
parents:
diff changeset
602 External_select:
223b71206888 Initial import
thib
parents:
diff changeset
603 CreateSelBG();
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
604 hide(); // なので、テキストウィンドウは消去
40
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
605 int baseposx, baseposy, repposx, repposy, centerx, centery;
0
223b71206888 Initial import
thib
parents:
diff changeset
606 int mojisize, col1, col2;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
607 config->GetParam("#SELBTN.000.CENTERING", 2, &centerx, &centery);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
608 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
609 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
610 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
611 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
612 config->GetParam("#SELBTN.000.MOJISELECTCOL", 1, &col2);
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
613 if (col1 == col2) col2 = 1; // CLANNAD でとりあえず。
0
223b71206888 Initial import
thib
parents:
diff changeset
614 int r, g, b;
223b71206888 Initial import
thib
parents:
diff changeset
615 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
616 config->GetParam(key, 3, &r, &g, &b);
0
223b71206888 Initial import
thib
parents:
diff changeset
617 Color fore(r,g,b);
223b71206888 Initial import
thib
parents:
diff changeset
618 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
619 config->GetParam(key, 3, &r, &g, &b);
0
223b71206888 Initial import
thib
parents:
diff changeset
620 Color seled(r,g,b);
223b71206888 Initial import
thib
parents:
diff changeset
621
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
622 /* ウィジット作成 */
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
623 /* ウィンドウ背景の大きさを求める */
0
223b71206888 Initial import
thib
parents:
diff changeset
624 if (baseposx == 0 && sel_bg_rect.width() != 0)
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
625 baseposx = (parent.Width()-sel_bg_rect.width()) / 2; // ボタン位置をセンタリング
40
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
626 if (centerx)
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
627 baseposx = (parent.Width()-sel_bg_rect.width()-sel_size*repposx) / 2;
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
628 if (centery)
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
629 baseposy = (parent.Height()-sel_bg_rect.height()-sel_size*repposy) / 2;
0
223b71206888 Initial import
thib
parents:
diff changeset
630
223b71206888 Initial import
thib
parents:
diff changeset
631 sel_widget = parent.create_node( Rect(0, 0, parent.Width(), parent.Height()),0);
223b71206888 Initial import
thib
parents:
diff changeset
632
223b71206888 Initial import
thib
parents:
diff changeset
633 for (i=0; i<sel_size; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
634 PicBase* p;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
635 // 背景作成
0
223b71206888 Initial import
thib
parents:
diff changeset
636 if (sel_bg2) {
223b71206888 Initial import
thib
parents:
diff changeset
637 p = sel_widget->create_node(Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()),0);
223b71206888 Initial import
thib
parents:
diff changeset
638 p->SetSurface(sel_bg2, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
639 }
223b71206888 Initial import
thib
parents:
diff changeset
640 if (sel_bg1) {
223b71206888 Initial import
thib
parents:
diff changeset
641 p = sel_widget->create_node(Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()),0);
223b71206888 Initial import
thib
parents:
diff changeset
642 p->SetSurface(sel_bg1, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
643 }
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
644 /* ボタン作成 */
0
223b71206888 Initial import
thib
parents:
diff changeset
645 const char* str = cmd.Str(cmd.args[i*2]);
223b71206888 Initial import
thib
parents:
diff changeset
646 int value = cmd.args[i*2+1].value;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
647 while(selects.size() <= value) selects.push_back(0); // vector の大きさを広げる
0
223b71206888 Initial import
thib
parents:
diff changeset
648
223b71206888 Initial import
thib
parents:
diff changeset
649 kconv( (const unsigned char*)str, (unsigned char*)key);
223b71206888 Initial import
thib
parents:
diff changeset
650 selects[value] = new WidTextButton(event, sel_widget, key, mojisize, WidTextButton::CENTER,
223b71206888 Initial import
thib
parents:
diff changeset
651 Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()), 1, fore, seled, Color(0,0,0,0));
223b71206888 Initial import
thib
parents:
diff changeset
652 selects[value]->press_func = &PressFuncButton;
223b71206888 Initial import
thib
parents:
diff changeset
653 selects[value]->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
654
223b71206888 Initial import
thib
parents:
diff changeset
655 baseposx += repposx;
223b71206888 Initial import
thib
parents:
diff changeset
656 baseposy += repposy;
223b71206888 Initial import
thib
parents:
diff changeset
657 }
223b71206888 Initial import
thib
parents:
diff changeset
658 sel_widget->show_all();
223b71206888 Initial import
thib
parents:
diff changeset
659 status = WAIT_SELECT_OUTBOX;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
660 } else { // CLANNAD: テキストウィンドウ内に選択肢表示
0
223b71206888 Initial import
thib
parents:
diff changeset
661 int mojisize;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
662 config->GetParam("#SELBTN.000.MOJISIZE", 1, &mojisize);
0
223b71206888 Initial import
thib
parents:
diff changeset
663 Color fore(0xff,0xff,0xff);
223b71206888 Initial import
thib
parents:
diff changeset
664 Color seled(0xff,0xff,0xff);
223b71206888 Initial import
thib
parents:
diff changeset
665
223b71206888 Initial import
thib
parents:
diff changeset
666 show();
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
667 if (text == NULL) goto External_select; // テキスト・ウィンドウを表示できなければ外部選択肢にする
0
223b71206888 Initial import
thib
parents:
diff changeset
668 text->wid->Clear();
223b71206888 Initial import
thib
parents:
diff changeset
669 if (kcursor) kcursor->hide();
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
670 /* ウィジット作成 : テキスト表示範囲と同じ*/
0
223b71206888 Initial import
thib
parents:
diff changeset
671 int posx = text->wid->pictext->PosX();
223b71206888 Initial import
thib
parents:
diff changeset
672 int posy = text->wid->pictext->PosY();
223b71206888 Initial import
thib
parents:
diff changeset
673 int sel_w = text->wid->pictext->Width();
223b71206888 Initial import
thib
parents:
diff changeset
674 int sel_h = text->wid->pictext->Height();
223b71206888 Initial import
thib
parents:
diff changeset
675 sel_widget = text->wid->PicNode()->create_node(Rect(posx, posy, posx+sel_w, posy+sel_h), 0);
223b71206888 Initial import
thib
parents:
diff changeset
676
223b71206888 Initial import
thib
parents:
diff changeset
677 int sel_y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
678 for (i=0; i<sel_size; i++) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
679 /* ボタン作成 */
0
223b71206888 Initial import
thib
parents:
diff changeset
680 const char* str = cmd.Str(cmd.args[i*2]);
223b71206888 Initial import
thib
parents:
diff changeset
681 int value = cmd.args[i*2+1].value;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
682 while(selects.size() <= value) selects.push_back(0); // vector の大きさを広げる
0
223b71206888 Initial import
thib
parents:
diff changeset
683
223b71206888 Initial import
thib
parents:
diff changeset
684 kconv( (const unsigned char*)str, (unsigned char*)key);
223b71206888 Initial import
thib
parents:
diff changeset
685 selects[value] = new WidTextButton(event, sel_widget, key, mojisize, WidTextButton::Attribute(WidTextButton::REVERSE | WidTextButton::NOPADDING),
223b71206888 Initial import
thib
parents:
diff changeset
686 Rect(0, sel_y, sel_w, sel_y), 1, fore, seled, Color(0,0,0,0));
223b71206888 Initial import
thib
parents:
diff changeset
687 selects[value]->press_func = &PressFuncButton;
223b71206888 Initial import
thib
parents:
diff changeset
688 selects[value]->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
689
223b71206888 Initial import
thib
parents:
diff changeset
690 sel_y += selects[value]->Pic()->Height() + 1;
223b71206888 Initial import
thib
parents:
diff changeset
691 }
223b71206888 Initial import
thib
parents:
diff changeset
692 sel_widget->show_all();
223b71206888 Initial import
thib
parents:
diff changeset
693 status = WAIT_SELECT_INBOX;
223b71206888 Initial import
thib
parents:
diff changeset
694 }
223b71206888 Initial import
thib
parents:
diff changeset
695 }
223b71206888 Initial import
thib
parents:
diff changeset
696
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
697 void Text::AddText(const char* str_o) {
0
223b71206888 Initial import
thib
parents:
diff changeset
698 char str[10001];
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
699 if (text == NULL) return;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
700 /* まず、replace string を変換 */
0
223b71206888 Initial import
thib
parents:
diff changeset
701 int i;
223b71206888 Initial import
thib
parents:
diff changeset
702 int cnt = 0;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
703 /* * = 81 96 A-Z = 0x82 [0x60-0x79] */
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
704 /* % = 81 93 A-Z = 0x82 [0x60-0x79] */
0
223b71206888 Initial import
thib
parents:
diff changeset
705 for (i=0; cnt<10000 && str_o[i] != 0; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
706 if (str_o[i] < 0) {
223b71206888 Initial import
thib
parents:
diff changeset
707 if ( (unsigned char)str_o[i] == 0x81 && (unsigned char)str_o[i+1] == 0x96 && (unsigned char)str_o[i+2] == 0x82) {
223b71206888 Initial import
thib
parents:
diff changeset
708 int c = str_o[i+3];
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
709 if (c >= 0x60 && c <= 0x79 && replace_name[c-0x60].length() != 0) { // 名前変換
0
223b71206888 Initial import
thib
parents:
diff changeset
710 i += 3;
223b71206888 Initial import
thib
parents:
diff changeset
711 strcpy(str+cnt, replace_name[c-0x60].c_str());
223b71206888 Initial import
thib
parents:
diff changeset
712 cnt += replace_name[c-0x60].length();
223b71206888 Initial import
thib
parents:
diff changeset
713 continue;
223b71206888 Initial import
thib
parents:
diff changeset
714 }
223b71206888 Initial import
thib
parents:
diff changeset
715 } else if ( (unsigned char)str_o[i] == 0x81 && (unsigned char)str_o[i+1] == 0x93 && (unsigned char)str_o[i+2] == 0x82) {
223b71206888 Initial import
thib
parents:
diff changeset
716 int c = str_o[i+3];
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
717 if (c >= 0x60 && c <= 0x79 && replace_name2[c-0x60].length() != 0) { // 名前変換2
0
223b71206888 Initial import
thib
parents:
diff changeset
718 i += 3;
223b71206888 Initial import
thib
parents:
diff changeset
719 strcpy(str+cnt, replace_name2[c-0x60].c_str());
223b71206888 Initial import
thib
parents:
diff changeset
720 cnt += replace_name2[c-0x60].length();
223b71206888 Initial import
thib
parents:
diff changeset
721 continue;
223b71206888 Initial import
thib
parents:
diff changeset
722 }
223b71206888 Initial import
thib
parents:
diff changeset
723 }
223b71206888 Initial import
thib
parents:
diff changeset
724 str[cnt++] = str_o[i++];
223b71206888 Initial import
thib
parents:
diff changeset
725 }
223b71206888 Initial import
thib
parents:
diff changeset
726 str[cnt++] = str_o[i];
223b71206888 Initial import
thib
parents:
diff changeset
727 }
223b71206888 Initial import
thib
parents:
diff changeset
728 str[cnt] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
729 str[10000] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
730 char* str_top = str;
223b71206888 Initial import
thib
parents:
diff changeset
731
223b71206888 Initial import
thib
parents:
diff changeset
732 for (char* s = str_top; *s != 0; s++) {
223b71206888 Initial import
thib
parents:
diff changeset
733 // if (*(unsigned char*)s == 0xa1 && *(unsigned char*)(s+1) == 0xda) { /* euc */
223b71206888 Initial import
thib
parents:
diff changeset
734 if (*(unsigned char*)s == 0x81 && *(unsigned char*)(s+1) == 0x79) { /* sjis */
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
735 // 名前
0
223b71206888 Initial import
thib
parents:
diff changeset
736 *s = 0;
223b71206888 Initial import
thib
parents:
diff changeset
737 if (s != str_top) text_stream.Add(str_top);
223b71206888 Initial import
thib
parents:
diff changeset
738 s += 2;
223b71206888 Initial import
thib
parents:
diff changeset
739 char* name_top = s;
223b71206888 Initial import
thib
parents:
diff changeset
740 for (; *s != 0; s++) {
223b71206888 Initial import
thib
parents:
diff changeset
741 // if (*(unsigned char*)s == 0xa1 && *(unsigned char*)(s+1) == 0xdb) { /* euc */
223b71206888 Initial import
thib
parents:
diff changeset
742 if (*(unsigned char*)s == 0x81 && *(unsigned char*)(s+1) == 0x7a) { /* sjis */
223b71206888 Initial import
thib
parents:
diff changeset
743 *s = 0;
223b71206888 Initial import
thib
parents:
diff changeset
744 s += 2;
223b71206888 Initial import
thib
parents:
diff changeset
745 text_stream.AddName(name_top);
223b71206888 Initial import
thib
parents:
diff changeset
746 break;
223b71206888 Initial import
thib
parents:
diff changeset
747 }
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
748 if (*s < 0 && s[1] != 0) s++; // 全角文字なら2字飛ばす
0
223b71206888 Initial import
thib
parents:
diff changeset
749 }
223b71206888 Initial import
thib
parents:
diff changeset
750 str_top = s;
223b71206888 Initial import
thib
parents:
diff changeset
751 }
223b71206888 Initial import
thib
parents:
diff changeset
752 if (*s == 0x0a) {
223b71206888 Initial import
thib
parents:
diff changeset
753 *s = 0;
223b71206888 Initial import
thib
parents:
diff changeset
754 text_stream.Add(str_top);
223b71206888 Initial import
thib
parents:
diff changeset
755 text_stream.AddReturn();
223b71206888 Initial import
thib
parents:
diff changeset
756 str_top = s;
223b71206888 Initial import
thib
parents:
diff changeset
757 } else if (*s < 0 && s[1] != 0) s++;
223b71206888 Initial import
thib
parents:
diff changeset
758 }
223b71206888 Initial import
thib
parents:
diff changeset
759 text_stream.Add(str_top);
223b71206888 Initial import
thib
parents:
diff changeset
760 }
223b71206888 Initial import
thib
parents:
diff changeset
761
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
762 void Text::Exec(Cmd& cmd) {
0
223b71206888 Initial import
thib
parents:
diff changeset
763 if (cmd.cmd_type == CMD_TEXT) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
764 if (text == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
765 show();
223b71206888 Initial import
thib
parents:
diff changeset
766 }
223b71206888 Initial import
thib
parents:
diff changeset
767 if (cmd.args.size() != 1) return;
223b71206888 Initial import
thib
parents:
diff changeset
768 if (ruby_text_flag) {
223b71206888 Initial import
thib
parents:
diff changeset
769 ruby_text = cmd.Str(cmd.args[0]);
223b71206888 Initial import
thib
parents:
diff changeset
770 ruby_text_flag = 0;
223b71206888 Initial import
thib
parents:
diff changeset
771 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
772 return;
223b71206888 Initial import
thib
parents:
diff changeset
773 }
223b71206888 Initial import
thib
parents:
diff changeset
774 cur_backlog_item.AddTextPos(cmd);
223b71206888 Initial import
thib
parents:
diff changeset
775 AddText(cmd.Str(cmd.args[0]));
223b71206888 Initial import
thib
parents:
diff changeset
776 char debug[1024];
223b71206888 Initial import
thib
parents:
diff changeset
777 kconv( (unsigned char*)cmd.Str(cmd.args[0]), (unsigned char*)debug);
223b71206888 Initial import
thib
parents:
diff changeset
778 eprintf("text: %s\n",debug);
223b71206888 Initial import
thib
parents:
diff changeset
779 if (text_parsing)
223b71206888 Initial import
thib
parents:
diff changeset
780 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
781 else
223b71206888 Initial import
thib
parents:
diff changeset
782 cmd.cmd_type = CMD_SAVEPOINT;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
783 text_parsing = true; /* テキスト待ち直後のテキスト位置=セーブ位置 */
0
223b71206888 Initial import
thib
parents:
diff changeset
784 return;
223b71206888 Initial import
thib
parents:
diff changeset
785 }
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
786
0
223b71206888 Initial import
thib
parents:
diff changeset
787 if (cmd.cmd_type != CMD_OTHER) return;
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
788
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
789 CommandHandler::Exec(cmd);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
790 }
0
223b71206888 Initial import
thib
parents:
diff changeset
791
223b71206888 Initial import
thib
parents:
diff changeset
792 extern int print_blit;
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
793 bool Text::Wait(unsigned int current_time, Cmd& cmd) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
794 if (current_time != Event::Time::NEVER_WAKE) old_time = current_time;
0
223b71206888 Initial import
thib
parents:
diff changeset
795 /*
223b71206888 Initial import
thib
parents:
diff changeset
796 if (event.presscount(MOUSE_UP)) {
223b71206888 Initial import
thib
parents:
diff changeset
797 if (text) text->Pic()->ReBlit();
223b71206888 Initial import
thib
parents:
diff changeset
798 }
223b71206888 Initial import
thib
parents:
diff changeset
799 if (event.presscount(MOUSE_DOWN)) {
223b71206888 Initial import
thib
parents:
diff changeset
800 print_blit^=1;
223b71206888 Initial import
thib
parents:
diff changeset
801 }
223b71206888 Initial import
thib
parents:
diff changeset
802 */
223b71206888 Initial import
thib
parents:
diff changeset
803
223b71206888 Initial import
thib
parents:
diff changeset
804 if (status == NORMAL && status_mask == NORMAL) return false;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
805
0
223b71206888 Initial import
thib
parents:
diff changeset
806 if (status_mask & WAIT_EXTRN_MASK) return true;
223b71206888 Initial import
thib
parents:
diff changeset
807 if (status_mask & (BACKLOG_MASK|BACKLOG_MASK_FWD) ) {
223b71206888 Initial import
thib
parents:
diff changeset
808 if (status_mask & BACKLOG_WAIT_MASK) ;
223b71206888 Initial import
thib
parents:
diff changeset
809 else {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
810 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
0
223b71206888 Initial import
thib
parents:
diff changeset
811 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
812 text->wid->Flush(); // 表示を最後の状態にする
0
223b71206888 Initial import
thib
parents:
diff changeset
813 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
814 if (status == WAIT_TEXT && text != NULL && kcursor != NULL) kcursor->show();
0
223b71206888 Initial import
thib
parents:
diff changeset
815 }
223b71206888 Initial import
thib
parents:
diff changeset
816 }
223b71206888 Initial import
thib
parents:
diff changeset
817 if (status_mask & BACKLOG_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
818 cmd.cmd_type = CMD_BACKLOGREQ;
223b71206888 Initial import
thib
parents:
diff changeset
819 } else {
223b71206888 Initial import
thib
parents:
diff changeset
820 cmd.cmd_type = CMD_BACKLOGREQ_FWD;
223b71206888 Initial import
thib
parents:
diff changeset
821 }
223b71206888 Initial import
thib
parents:
diff changeset
822 status_mask = Status(status_mask & ~(BACKLOG_MASK|BACKLOG_MASK_FWD));
223b71206888 Initial import
thib
parents:
diff changeset
823 return false;
223b71206888 Initial import
thib
parents:
diff changeset
824 }
223b71206888 Initial import
thib
parents:
diff changeset
825 if ( (status_mask & BACKLOG_WAIT_MASK) && (status_mask & BACKLOG_MASK_KOE)) {
223b71206888 Initial import
thib
parents:
diff changeset
826 if (drawn_backlog_item.koe != -1) {
223b71206888 Initial import
thib
parents:
diff changeset
827 cmd.cmd_type = CMD_OTHER;
223b71206888 Initial import
thib
parents:
diff changeset
828 cmd.cmd1 = 1;
223b71206888 Initial import
thib
parents:
diff changeset
829 cmd.cmd2 = 0x17;
223b71206888 Initial import
thib
parents:
diff changeset
830 cmd.cmd3 = 0;
223b71206888 Initial import
thib
parents:
diff changeset
831 cmd.cmd4 = 1;
223b71206888 Initial import
thib
parents:
diff changeset
832 cmd.args.clear();
223b71206888 Initial import
thib
parents:
diff changeset
833 cmd.args.push_back(VarInfo(drawn_backlog_item.koe));
223b71206888 Initial import
thib
parents:
diff changeset
834 cmd.args.push_back(VarInfo(0));
223b71206888 Initial import
thib
parents:
diff changeset
835 }
223b71206888 Initial import
thib
parents:
diff changeset
836 status_mask = Status(status_mask & ~BACKLOG_MASK_KOE);
223b71206888 Initial import
thib
parents:
diff changeset
837 return false;
223b71206888 Initial import
thib
parents:
diff changeset
838 }
223b71206888 Initial import
thib
parents:
diff changeset
839 if (skip_mode & SKIP_IN_MENU) return false;
223b71206888 Initial import
thib
parents:
diff changeset
840 if (status_mask & SAVEMASK) {
223b71206888 Initial import
thib
parents:
diff changeset
841 cmd.cmd_type = CMD_SAVEREQ;
223b71206888 Initial import
thib
parents:
diff changeset
842 status_mask = Status(status_mask & ~SAVEMASK);
223b71206888 Initial import
thib
parents:
diff changeset
843 return false;
223b71206888 Initial import
thib
parents:
diff changeset
844 }
223b71206888 Initial import
thib
parents:
diff changeset
845 if (status_mask & LOADMASK) {
223b71206888 Initial import
thib
parents:
diff changeset
846 cmd.cmd_type = CMD_LOADREQ;
223b71206888 Initial import
thib
parents:
diff changeset
847 status_mask = Status(status_mask & ~LOADMASK);
223b71206888 Initial import
thib
parents:
diff changeset
848 return false;
223b71206888 Initial import
thib
parents:
diff changeset
849 }
223b71206888 Initial import
thib
parents:
diff changeset
850 if (status_mask & SKIPEND_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
851 if ( (skip_mode & SKIP_TEXT) && (skip_mode & SKIPEND_TEXT)) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
852 if (skip_mode & SKIPEND_KEY) { // shift skip 中
0
223b71206888 Initial import
thib
parents:
diff changeset
853 SkipMode new_mode = SkipMode(skip_mode & (~SKIPEND_TEXT));
223b71206888 Initial import
thib
parents:
diff changeset
854 if (new_mode & (SKIP_GRP_NOEFFEC || SKIP_GRP_NODRAW))
223b71206888 Initial import
thib
parents:
diff changeset
855 new_mode = SkipMode(new_mode & (~SKIP_GRP_FAST));
223b71206888 Initial import
thib
parents:
diff changeset
856 cmd.SetSysvar(TYPE_SYS_SKIPMODE, new_mode);
223b71206888 Initial import
thib
parents:
diff changeset
857 } else {
223b71206888 Initial import
thib
parents:
diff changeset
858 cmd.SetSysvar(TYPE_SYS_SKIPMODE, SKIP_NO);
223b71206888 Initial import
thib
parents:
diff changeset
859 }
223b71206888 Initial import
thib
parents:
diff changeset
860 }
223b71206888 Initial import
thib
parents:
diff changeset
861 status_mask = Status(status_mask & ~SKIPEND_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
862 }
223b71206888 Initial import
thib
parents:
diff changeset
863 if (status_mask & SKIPMASK) {
223b71206888 Initial import
thib
parents:
diff changeset
864 if (skip_mode != SKIP_NO) {
223b71206888 Initial import
thib
parents:
diff changeset
865 cmd.SetSysvar(TYPE_SYS_SKIPMODE, skip_mode | SKIPEND_TEXT);
223b71206888 Initial import
thib
parents:
diff changeset
866 } else {
223b71206888 Initial import
thib
parents:
diff changeset
867 cmd.SetSysvar(TYPE_SYS_SKIPMODE, SKIP_TEXT | SKIP_GRP_FAST | SKIPEND_TEXT);
223b71206888 Initial import
thib
parents:
diff changeset
868 }
223b71206888 Initial import
thib
parents:
diff changeset
869 status_mask = Status(status_mask & ~SKIPMASK);
223b71206888 Initial import
thib
parents:
diff changeset
870 return false;
223b71206888 Initial import
thib
parents:
diff changeset
871 }
223b71206888 Initial import
thib
parents:
diff changeset
872 if (event.presscount(MOUSE_RIGHT)) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
873 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
0
223b71206888 Initial import
thib
parents:
diff changeset
874 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
875 text->wid->Flush(); // 表示を最後の状態にする
0
223b71206888 Initial import
thib
parents:
diff changeset
876 }
223b71206888 Initial import
thib
parents:
diff changeset
877 cmd.cmd_type = CMD_MENUREQ;
223b71206888 Initial import
thib
parents:
diff changeset
878 if (!(status_mask & STATSAVE_MASK)) {
223b71206888 Initial import
thib
parents:
diff changeset
879 status_saved = status;
223b71206888 Initial import
thib
parents:
diff changeset
880 status_mask = Status(status_mask | STATSAVE_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
881 }
223b71206888 Initial import
thib
parents:
diff changeset
882 return false;
223b71206888 Initial import
thib
parents:
diff changeset
883 } else if (status == WAIT_CLICK_MOUSEPOS) {
223b71206888 Initial import
thib
parents:
diff changeset
884 status = WAIT_CLICK_MOUSEPOSEND_R;
223b71206888 Initial import
thib
parents:
diff changeset
885 }
223b71206888 Initial import
thib
parents:
diff changeset
886 }
223b71206888 Initial import
thib
parents:
diff changeset
887 if (event.presscount(MOUSE_UP)) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
888 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
0
223b71206888 Initial import
thib
parents:
diff changeset
889 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
890 text->wid->Flush(); // 表示を最後の状態にする
0
223b71206888 Initial import
thib
parents:
diff changeset
891 }
223b71206888 Initial import
thib
parents:
diff changeset
892 cmd.cmd_type = CMD_BACKLOGREQ;
223b71206888 Initial import
thib
parents:
diff changeset
893 if (!(status_mask & STATSAVE_MASK)) {
223b71206888 Initial import
thib
parents:
diff changeset
894 status_saved = status;
223b71206888 Initial import
thib
parents:
diff changeset
895 status_mask = Status(status_mask | STATSAVE_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
896 }
223b71206888 Initial import
thib
parents:
diff changeset
897 return false;
223b71206888 Initial import
thib
parents:
diff changeset
898 }
223b71206888 Initial import
thib
parents:
diff changeset
899 }
223b71206888 Initial import
thib
parents:
diff changeset
900 if (status_mask & CLEARSCR_MASK) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
901 if ( (status == WAIT_TEXT && text != NULL ) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
0
223b71206888 Initial import
thib
parents:
diff changeset
902 if (skip_mode) skip_mode = SKIP_NO;
223b71206888 Initial import
thib
parents:
diff changeset
903 if (text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
904 text->wid->Flush(); // 表示を最後の状態にする
0
223b71206888 Initial import
thib
parents:
diff changeset
905 return true;
223b71206888 Initial import
thib
parents:
diff changeset
906 }
223b71206888 Initial import
thib
parents:
diff changeset
907 status_mask = Status(status_mask & (~CLEARSCR_MASK) | CLEARSCR_WAIT_MASK);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
908 if (text != NULL) text->hide();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
909 if (kcursor != NULL) kcursor->hide();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
910 if (sel_widget != NULL) sel_widget->hide();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
911 if (backlog_widget != NULL) backlog_widget->hide();
0
223b71206888 Initial import
thib
parents:
diff changeset
912 return true;
223b71206888 Initial import
thib
parents:
diff changeset
913 }
223b71206888 Initial import
thib
parents:
diff changeset
914 status_mask = Status(status_mask & (~CLEARSCR_MASK));
223b71206888 Initial import
thib
parents:
diff changeset
915 return false;
223b71206888 Initial import
thib
parents:
diff changeset
916 }
223b71206888 Initial import
thib
parents:
diff changeset
917 if (status_mask & CLEARSCR_WAIT_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
918 return true;
223b71206888 Initial import
thib
parents:
diff changeset
919 }
223b71206888 Initial import
thib
parents:
diff changeset
920 if (status == WAIT_TEXT) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
921 if (text == NULL) {
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
922 status = NORMAL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
923 return false;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
924 }
0
223b71206888 Initial import
thib
parents:
diff changeset
925 if (skip_mode & SKIP_TEXT) {
223b71206888 Initial import
thib
parents:
diff changeset
926 } else if (text->wid->status != WidText::PREPARE) {
223b71206888 Initial import
thib
parents:
diff changeset
927 return true;
223b71206888 Initial import
thib
parents:
diff changeset
928 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
929 if (kcursor != NULL) kcursor->hide();
0
223b71206888 Initial import
thib
parents:
diff changeset
930 text_stream.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
931 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
932 cmd.cmd_type = CMD_TEXTEND;
223b71206888 Initial import
thib
parents:
diff changeset
933 return false;
223b71206888 Initial import
thib
parents:
diff changeset
934 }
223b71206888 Initial import
thib
parents:
diff changeset
935 if (status == WAIT) {
223b71206888 Initial import
thib
parents:
diff changeset
936 if (skip_mode & SKIP_TEXT) ;
223b71206888 Initial import
thib
parents:
diff changeset
937 else if (wait_time > current_time) return true;
223b71206888 Initial import
thib
parents:
diff changeset
938 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
939 } else if (status == WAIT_CLICK) {
223b71206888 Initial import
thib
parents:
diff changeset
940 if (skip_mode & SKIP_TEXT) ;
223b71206888 Initial import
thib
parents:
diff changeset
941 else if (wait_time > current_time) return true;
223b71206888 Initial import
thib
parents:
diff changeset
942 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
943 cmd.SetSysvar(0);
223b71206888 Initial import
thib
parents:
diff changeset
944 } else if (status == WAIT_ABORT) {
223b71206888 Initial import
thib
parents:
diff changeset
945 cmd.SetSysvar(1);
223b71206888 Initial import
thib
parents:
diff changeset
946 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
947 } else if (status == WAIT_CLICK_MOUSEPOS || status == WAIT_CLICK_MOUSEPOSEND_L || status == WAIT_CLICK_MOUSEPOSEND_R) {
223b71206888 Initial import
thib
parents:
diff changeset
948 if (status == WAIT_CLICK_MOUSEPOS && (skip_mode & SKIP_TEXT) == 0) return true; // keep wait
223b71206888 Initial import
thib
parents:
diff changeset
949 else {
223b71206888 Initial import
thib
parents:
diff changeset
950 int x, y;
223b71206888 Initial import
thib
parents:
diff changeset
951 event.MousePos(x,y);
223b71206888 Initial import
thib
parents:
diff changeset
952 if (status == WAIT_CLICK_MOUSEPOS) x = y = 0; // skip mode
223b71206888 Initial import
thib
parents:
diff changeset
953 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
954 cmd.SetFlagvar(wait_savedvar[0], x);
223b71206888 Initial import
thib
parents:
diff changeset
955 cmd.SetFlagvar(wait_savedvar[1], y);
223b71206888 Initial import
thib
parents:
diff changeset
956 if (status == WAIT_CLICK_MOUSEPOSEND_R) cmd.SetSysvar(-1);
223b71206888 Initial import
thib
parents:
diff changeset
957 else cmd.SetSysvar(0);
223b71206888 Initial import
thib
parents:
diff changeset
958 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
959 }
223b71206888 Initial import
thib
parents:
diff changeset
960 } else if (status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
223b71206888 Initial import
thib
parents:
diff changeset
961 return true;
223b71206888 Initial import
thib
parents:
diff changeset
962 } else if ( int(status) >= WAIT_SELECT_VALUE) {
223b71206888 Initial import
thib
parents:
diff changeset
963 int sel_val = int(status) - WAIT_SELECT_VALUE;
223b71206888 Initial import
thib
parents:
diff changeset
964 cmd.SetSysvar(sel_val);
223b71206888 Initial import
thib
parents:
diff changeset
965 selects.clear();
223b71206888 Initial import
thib
parents:
diff changeset
966 delete sel_widget;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
967 sel_widget = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
968 status = NORMAL;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
969 // CreateSelect() で作成された cur_backlog_item を backlog_item へ反映させる
0
223b71206888 Initial import
thib
parents:
diff changeset
970 cur_backlog_item.text.InsertColor(sel_backlog_pos[sel_val], sel_backlog_pos[sel_val+1], 0xff, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
971 backlog_item = cur_backlog_item;
223b71206888 Initial import
thib
parents:
diff changeset
972 cur_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
973 }
223b71206888 Initial import
thib
parents:
diff changeset
974 return false;
223b71206888 Initial import
thib
parents:
diff changeset
975 }
223b71206888 Initial import
thib
parents:
diff changeset
976
223b71206888 Initial import
thib
parents:
diff changeset
977 void clearbtn_press(void* pointer, WidButton* button) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
978 if (pointer == NULL) return;
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
979 Text* t = (Text*)pointer;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
980 t->status_mask = Text::Status(t->status_mask | Text::CLEARSCR_MASK);
0
223b71206888 Initial import
thib
parents:
diff changeset
981 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
982
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
983 void Text::PressFuncSkip(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
984 if (pointer == NULL) return;
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
985 Text* t = (Text*)pointer;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
986 t->status_mask = Text::Status(t->status_mask | Text::SKIPMASK);
0
223b71206888 Initial import
thib
parents:
diff changeset
987 return;
223b71206888 Initial import
thib
parents:
diff changeset
988 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
989 void Text::PressFuncLoad(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
990 if (pointer == NULL) return;
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
991 Text* t = (Text*)pointer;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
992 t->status_mask = Text::Status(t->status_mask | Text::LOADMASK);
0
223b71206888 Initial import
thib
parents:
diff changeset
993 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
994
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
995 void Text::PressFuncSave(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
996 if (pointer == NULL) return;
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
997 Text* t = (Text*)pointer;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
998 t->status_mask = Text::Status(t->status_mask | Text::SAVEMASK);
0
223b71206888 Initial import
thib
parents:
diff changeset
999 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1000
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1001 void Text::PressFuncBacklog(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1002 if (pointer == NULL) return;
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1003 Text* t = (Text*)pointer;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1004 t->status_mask = Text::Status(t->status_mask | Text::BACKLOG_MASK);
0
223b71206888 Initial import
thib
parents:
diff changeset
1005 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1006
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1007 void Text::PressFuncBacklogFwd(void* pointer, WidButton* from) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1008 if (pointer == NULL) return;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1009 Text* t = (Text*)pointer;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1010 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
1011 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1012
0
223b71206888 Initial import
thib
parents:
diff changeset
1013 void movebtn_drag(int from_x, int from_y, int x, int y, void* pointer, WidButton* button) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1014 if (pointer == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1015 fprintf(stderr,"drag.\n");
223b71206888 Initial import
thib
parents:
diff changeset
1016 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1017
0
223b71206888 Initial import
thib
parents:
diff changeset
1018 #define BTNCNT 10
47
5f548e5957a8 * get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents: 43
diff changeset
1019 static const char* btnname[BTNCNT] = {
0
223b71206888 Initial import
thib
parents:
diff changeset
1020 "MOVE",
223b71206888 Initial import
thib
parents:
diff changeset
1021 "CLEAR",
223b71206888 Initial import
thib
parents:
diff changeset
1022 "READJUMP",
223b71206888 Initial import
thib
parents:
diff changeset
1023 "AUTOMODE",
223b71206888 Initial import
thib
parents:
diff changeset
1024 "MSGBK",
223b71206888 Initial import
thib
parents:
diff changeset
1025 "MSGBKLEFT",
223b71206888 Initial import
thib
parents:
diff changeset
1026 "MSGBKRIGHT",
223b71206888 Initial import
thib
parents:
diff changeset
1027 "EXBTN_000",
223b71206888 Initial import
thib
parents:
diff changeset
1028 "EXBTN_001",
223b71206888 Initial import
thib
parents:
diff changeset
1029 "EXBTN_002"
223b71206888 Initial import
thib
parents:
diff changeset
1030 };
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1031
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1032 static int btnpos[BTNCNT] = { // g00 ファイル内のボタン情報の位置
0
223b71206888 Initial import
thib
parents:
diff changeset
1033 // 0, 1, 13, 12, 2, 3, 4, 5, 6, 7 // princess bride?
223b71206888 Initial import
thib
parents:
diff changeset
1034 0, 1, 13, 14, 2, 3, 4, 5, 6, 7 // tomoyo after?
223b71206888 Initial import
thib
parents:
diff changeset
1035 };
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1036
0
223b71206888 Initial import
thib
parents:
diff changeset
1037 static WidButton::PressFunc btnpress[BTNCNT] = {
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1038 0, clearbtn_press, &Text::PressFuncSkip,0,&Text::PressFuncBacklogFwd,&Text::PressFuncBacklog,&Text::PressFuncBacklogFwd,&Text::PressFuncSave,&Text::PressFuncLoad,0
0
223b71206888 Initial import
thib
parents:
diff changeset
1039 };
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1040
0
223b71206888 Initial import
thib
parents:
diff changeset
1041 static WidButton::DragFunc btndrag[BTNCNT] = {
223b71206888 Initial import
thib
parents:
diff changeset
1042 movebtn_drag, 0,0,0,0, 0,0,0,0, 0
223b71206888 Initial import
thib
parents:
diff changeset
1043 };
223b71206888 Initial import
thib
parents:
diff changeset
1044
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1045 void Text::SetTextSpeed(int speed) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1046 // 100 : 10char / sec
223b71206888 Initial import
thib
parents:
diff changeset
1047 // 10 : 100char / sec
223b71206888 Initial import
thib
parents:
diff changeset
1048 // text widget:
223b71206888 Initial import
thib
parents:
diff changeset
1049 if (speed <= 0) speed = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1050 else if (speed > 1000) speed = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1051 else speed = 1000 / speed;
223b71206888 Initial import
thib
parents:
diff changeset
1052 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1053 for (i=0; i<32; i++)
223b71206888 Initial import
thib
parents:
diff changeset
1054 if (widgets[i]) widgets[i]->wid->SetSpeed(speed);
223b71206888 Initial import
thib
parents:
diff changeset
1055 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1056
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1057 void Text::SetTextWait(int wait) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1058 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1059 for (i=0; i<32; i++)
223b71206888 Initial import
thib
parents:
diff changeset
1060 if (widgets[i]) widgets[i]->wid->SetWait(wait);
223b71206888 Initial import
thib
parents:
diff changeset
1061 }
223b71206888 Initial import
thib
parents:
diff changeset
1062
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1063 void Text::SetWindowColor(int r, int g, int b, int a, bool is_transparent) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1064 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1065 int w;
223b71206888 Initial import
thib
parents:
diff changeset
1066
223b71206888 Initial import
thib
parents:
diff changeset
1067 for (w=0; w<32; w++) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1068 if (widgets[w] == NULL) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1069 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
1070 const char* back = config->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1071 if (back == NULL || back[0] == 0) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1072 sprintf(key, "%s.g00", back);
223b71206888 Initial import
thib
parents:
diff changeset
1073 Surface* back_s = parent.Root().NewSurface(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1074 if (back_s == NULL) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1075 Rect rect(*back_s);
223b71206888 Initial import
thib
parents:
diff changeset
1076 Surface* new_s = parent.Root().NewSurface(rect.width(), rect.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1077 DSurfaceMove(back_s, rect, new_s, rect);
223b71206888 Initial import
thib
parents:
diff changeset
1078 DSurfaceFillA(new_s, rect, r, g, b, a);
223b71206888 Initial import
thib
parents:
diff changeset
1079 widgets[w]->wid->Pic()->SetSurface(new_s, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1080 widgets[w]->wid->Pic()->SetSurfaceFreeFlag(1);
223b71206888 Initial import
thib
parents:
diff changeset
1081 if (!is_transparent)
223b71206888 Initial import
thib
parents:
diff changeset
1082 widgets[w]->wid->Pic()->SetSurfaceAttribute(PicBase::BLIT_MULTIPLY);
223b71206888 Initial import
thib
parents:
diff changeset
1083 parent.Root().DeleteSurface(back_s);
223b71206888 Initial import
thib
parents:
diff changeset
1084 }
223b71206888 Initial import
thib
parents:
diff changeset
1085 }
223b71206888 Initial import
thib
parents:
diff changeset
1086
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1087 void Text::SetCursor(int cursor_no) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1088 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1089 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
1090 string path = config->GetParaStr(key);
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1091 if (path.length() == 0) return; // 名前なし
0
223b71206888 Initial import
thib
parents:
diff changeset
1092 path += ".pdt";
223b71206888 Initial import
thib
parents:
diff changeset
1093 int w,h,cont,speed;
223b71206888 Initial import
thib
parents:
diff changeset
1094 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
1095 config->GetParam(key, 2, &w, &h);
0
223b71206888 Initial import
thib
parents:
diff changeset
1096 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
1097 config->GetParam(key, 1, &cont);
0
223b71206888 Initial import
thib
parents:
diff changeset
1098 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
1099 config->GetParam(key, 1, &speed);
0
223b71206888 Initial import
thib
parents:
diff changeset
1100
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1101 // speed で1周、cont 回変化
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1102 if (kcursor != NULL) delete kcursor;
0
223b71206888 Initial import
thib
parents:
diff changeset
1103
223b71206888 Initial import
thib
parents:
diff changeset
1104 kcursor = new WidTimeCursor(event, speed/cont, &parent, path.c_str(), 0, 0, w, 0, cont, Rect(0,0,w,h));
223b71206888 Initial import
thib
parents:
diff changeset
1105 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1106 for (i=0; i<32; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1107 if (widgets[i]) widgets[i]->wid->SetCursor(kcursor);
223b71206888 Initial import
thib
parents:
diff changeset
1108 }
223b71206888 Initial import
thib
parents:
diff changeset
1109 }
223b71206888 Initial import
thib
parents:
diff changeset
1110
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1111 void kconv(const unsigned char* src, unsigned char* dest) { //FIXME: code duplication?
0
223b71206888 Initial import
thib
parents:
diff changeset
1112 /* input : sjis output: euc */
223b71206888 Initial import
thib
parents:
diff changeset
1113 while(*src) {
223b71206888 Initial import
thib
parents:
diff changeset
1114 unsigned int high = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1115 if (high < 0x80) {
223b71206888 Initial import
thib
parents:
diff changeset
1116 /* ASCII */
223b71206888 Initial import
thib
parents:
diff changeset
1117 *dest++ = high; continue;
223b71206888 Initial import
thib
parents:
diff changeset
1118 } else if (high < 0xa0) {
223b71206888 Initial import
thib
parents:
diff changeset
1119 /* SJIS */
223b71206888 Initial import
thib
parents:
diff changeset
1120 high -= 0x71;
223b71206888 Initial import
thib
parents:
diff changeset
1121 } else if (high < 0xe0) {
223b71206888 Initial import
thib
parents:
diff changeset
1122 /* hankaku KANA */
223b71206888 Initial import
thib
parents:
diff changeset
1123 *dest++ = 0x8e; *dest++ = high;
223b71206888 Initial import
thib
parents:
diff changeset
1124 continue;
223b71206888 Initial import
thib
parents:
diff changeset
1125 } else { /* high >= 0xe0 : SJIS */
223b71206888 Initial import
thib
parents:
diff changeset
1126 high -= 0xb1;
223b71206888 Initial import
thib
parents:
diff changeset
1127 }
223b71206888 Initial import
thib
parents:
diff changeset
1128 /* SJIS convert */
223b71206888 Initial import
thib
parents:
diff changeset
1129 high = (high<<1) + 1;
223b71206888 Initial import
thib
parents:
diff changeset
1130
223b71206888 Initial import
thib
parents:
diff changeset
1131 unsigned int low = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1132 if (low == 0) break; /* incorrect code */
223b71206888 Initial import
thib
parents:
diff changeset
1133 if (low > 0x7f) low--;
223b71206888 Initial import
thib
parents:
diff changeset
1134 if (low >= 0x9e) {
223b71206888 Initial import
thib
parents:
diff changeset
1135 low -= 0x7d;
223b71206888 Initial import
thib
parents:
diff changeset
1136 high++;
223b71206888 Initial import
thib
parents:
diff changeset
1137 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1138 low -= 0x1f;
223b71206888 Initial import
thib
parents:
diff changeset
1139 }
223b71206888 Initial import
thib
parents:
diff changeset
1140 *dest++ = high | 0x80; *dest++ = low | 0x80;
223b71206888 Initial import
thib
parents:
diff changeset
1141 }
223b71206888 Initial import
thib
parents:
diff changeset
1142 *dest = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1143 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1144
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1145 void kconv_rev(const unsigned char* src, unsigned char* dest) { //FIXME: code duplication?
0
223b71206888 Initial import
thib
parents:
diff changeset
1146 /* input : euc output: sjis */
223b71206888 Initial import
thib
parents:
diff changeset
1147 while(*src) {
223b71206888 Initial import
thib
parents:
diff changeset
1148 unsigned int high = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1149 if (high < 0x80) {
223b71206888 Initial import
thib
parents:
diff changeset
1150 /* ASCII */
223b71206888 Initial import
thib
parents:
diff changeset
1151 *dest++ = high; continue;
223b71206888 Initial import
thib
parents:
diff changeset
1152 } else if (high == 0x8e) { /* hankaku KANA */
223b71206888 Initial import
thib
parents:
diff changeset
1153 high = *src;
223b71206888 Initial import
thib
parents:
diff changeset
1154 if (high >= 0xa0 && high < 0xe0)
223b71206888 Initial import
thib
parents:
diff changeset
1155 *dest++ = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1156 continue;
223b71206888 Initial import
thib
parents:
diff changeset
1157 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1158 unsigned int low = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1159 if (low == 0) break; /* incorrect code , EOS */
223b71206888 Initial import
thib
parents:
diff changeset
1160 if (low < 0x80) continue; /* incorrect code */
223b71206888 Initial import
thib
parents:
diff changeset
1161 /* convert */
223b71206888 Initial import
thib
parents:
diff changeset
1162 low &= 0x7f; high &= 0x7f;
223b71206888 Initial import
thib
parents:
diff changeset
1163 low += (high & 1) ? 0x1f : 0x7d;
223b71206888 Initial import
thib
parents:
diff changeset
1164 high = (high-0x21)>>1;
223b71206888 Initial import
thib
parents:
diff changeset
1165 high += (high > 0x1e) ? 0xc1 : 0x81;
223b71206888 Initial import
thib
parents:
diff changeset
1166 *dest++ = high;
223b71206888 Initial import
thib
parents:
diff changeset
1167 if (low > 0x7f) low++;
223b71206888 Initial import
thib
parents:
diff changeset
1168 *dest++ = low;
223b71206888 Initial import
thib
parents:
diff changeset
1169 }
223b71206888 Initial import
thib
parents:
diff changeset
1170 }
223b71206888 Initial import
thib
parents:
diff changeset
1171 *dest = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1172 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1173
0
223b71206888 Initial import
thib
parents:
diff changeset
1174 string kconv(const string& s) {
223b71206888 Initial import
thib
parents:
diff changeset
1175 char* out = new char[s.length()*2+100];
223b71206888 Initial import
thib
parents:
diff changeset
1176 kconv((const unsigned char*)s.c_str(), (unsigned char*)out);
223b71206888 Initial import
thib
parents:
diff changeset
1177 string ret = out;
223b71206888 Initial import
thib
parents:
diff changeset
1178 delete[] out;
223b71206888 Initial import
thib
parents:
diff changeset
1179 return ret;
223b71206888 Initial import
thib
parents:
diff changeset
1180 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1181
0
223b71206888 Initial import
thib
parents:
diff changeset
1182 string kconv_rev(const string& s) {
223b71206888 Initial import
thib
parents:
diff changeset
1183 char* out = new char[s.length()*2+100];
223b71206888 Initial import
thib
parents:
diff changeset
1184 kconv_rev((const unsigned char*)s.c_str(), (unsigned char*)out);
223b71206888 Initial import
thib
parents:
diff changeset
1185 string ret = out;
223b71206888 Initial import
thib
parents:
diff changeset
1186 delete[] out;
223b71206888 Initial import
thib
parents:
diff changeset
1187 return ret;
223b71206888 Initial import
thib
parents:
diff changeset
1188 }
223b71206888 Initial import
thib
parents:
diff changeset
1189
223b71206888 Initial import
thib
parents:
diff changeset
1190 /**************************************************************::
223b71206888 Initial import
thib
parents:
diff changeset
1191 **
223b71206888 Initial import
thib
parents:
diff changeset
1192 ** BacklogItem
223b71206888 Initial import
thib
parents:
diff changeset
1193 */
223b71206888 Initial import
thib
parents:
diff changeset
1194
223b71206888 Initial import
thib
parents:
diff changeset
1195 BacklogItem::BacklogItem(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1196 scn = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1197 pos = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1198 koe = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1199 face = "";
223b71206888 Initial import
thib
parents:
diff changeset
1200 text.kanji_type = TextStream::sjis;
223b71206888 Initial import
thib
parents:
diff changeset
1201 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1202
0
223b71206888 Initial import
thib
parents:
diff changeset
1203 void BacklogItem::Clear(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1204 scn = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1205 pos = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1206 koe = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1207 text.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1208 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1209
0
223b71206888 Initial import
thib
parents:
diff changeset
1210 void BacklogItem::AddTextPos(Cmd& cmd) {
223b71206888 Initial import
thib
parents:
diff changeset
1211 if (scn == -1 && pos == -1) {
223b71206888 Initial import
thib
parents:
diff changeset
1212 scn = cmd.scn;
223b71206888 Initial import
thib
parents:
diff changeset
1213 pos = cmd.pos;
223b71206888 Initial import
thib
parents:
diff changeset
1214 return;
223b71206888 Initial import
thib
parents:
diff changeset
1215 }
223b71206888 Initial import
thib
parents:
diff changeset
1216 DeleteTextPos();
223b71206888 Initial import
thib
parents:
diff changeset
1217 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1218
0
223b71206888 Initial import
thib
parents:
diff changeset
1219 void BacklogItem::DeleteTextPos(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1220 scn = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1221 pos = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1222 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1223
0
223b71206888 Initial import
thib
parents:
diff changeset
1224 BacklogItem& BacklogItem::operator =(const BacklogItem& p) {
223b71206888 Initial import
thib
parents:
diff changeset
1225 scn = p.scn;
223b71206888 Initial import
thib
parents:
diff changeset
1226 pos = p.pos;
223b71206888 Initial import
thib
parents:
diff changeset
1227 koe = p.koe;
223b71206888 Initial import
thib
parents:
diff changeset
1228 face = p.face;
223b71206888 Initial import
thib
parents:
diff changeset
1229 text = p.text;
223b71206888 Initial import
thib
parents:
diff changeset
1230 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1231
0
223b71206888 Initial import
thib
parents:
diff changeset
1232 void BacklogItem::SetSavepos(int p) {
223b71206888 Initial import
thib
parents:
diff changeset
1233 Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1234 scn = SaveSelect;
223b71206888 Initial import
thib
parents:
diff changeset
1235 pos = p;
223b71206888 Initial import
thib
parents:
diff changeset
1236 }
223b71206888 Initial import
thib
parents:
diff changeset
1237
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1238
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1239 /**************************************************************::
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1240 **
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1241 ** TextWindow
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1242 */
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1243
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1244 Rect TextWindow::WakuSize(PicContainer& pic, int waku_no) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1245 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1246 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
1247 const char* name = AyuSysConfig::GetInstance()->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1248 if (name == NULL) return Rect(0,0,0,0);
0
223b71206888 Initial import
thib
parents:
diff changeset
1249 std::string str = name; str += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
1250 Surface* s = pic.Root().NewSurface(str.c_str());
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1251 if (s == NULL) return Rect(0,0,0,0);
0
223b71206888 Initial import
thib
parents:
diff changeset
1252 Rect r(*s);
223b71206888 Initial import
thib
parents:
diff changeset
1253 pic.Root().DeleteSurface(s);
223b71206888 Initial import
thib
parents:
diff changeset
1254 return r;
223b71206888 Initial import
thib
parents:
diff changeset
1255 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1256
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1257 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
1258 AyuSysConfig *config = AyuSysConfig::GetInstance();
0
223b71206888 Initial import
thib
parents:
diff changeset
1259 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1260 std::string str;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1261 /* 枠を作成 */
0
223b71206888 Initial import
thib
parents:
diff changeset
1262 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
1263 const char* name = config->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1264 if (name != NULL && name[0] == 0) name = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1265 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
1266 const char* back = config->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1267 if (back != NULL && back[0] == 0) back = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1268 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
1269 const char* btn = config->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1270 if (btn != NULL && btn[0] == 0) btn = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1271
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1272 if (name == NULL && back == NULL && btn == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1273
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1274 /* まず、テキスト背景を設定 */
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1275 if (back != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1276 str = back; str += ".g00";
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1277 int rc, gc, bc, ac, flag;
0
223b71206888 Initial import
thib
parents:
diff changeset
1278 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1279 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
1280 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
1281 config->GetParam("#WINDOW_ATTR", 5, &rc, &gc, &bc, &ac, &flag);
0
223b71206888 Initial import
thib
parents:
diff changeset
1282 }
223b71206888 Initial import
thib
parents:
diff changeset
1283 Surface* back_s = pic.Root().NewSurface(str.c_str());
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1284 if (back_s != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1285 Rect rect(*back_s);
223b71206888 Initial import
thib
parents:
diff changeset
1286 Surface* s = pic.Root().NewSurface(rect.width(), rect.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1287 DSurfaceMove(back_s, rect, s, rect);
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1288 DSurfaceFillA(s, rect, rc, gc, bc, ac); // 透明度設定
0
223b71206888 Initial import
thib
parents:
diff changeset
1289 pic.SetSurface(s, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1290 pic.SetSurfaceFreeFlag(1);
223b71206888 Initial import
thib
parents:
diff changeset
1291 if (flag == 0) wid->Pic()->SetSurfaceAttribute(PicBase::BLIT_MULTIPLY);
223b71206888 Initial import
thib
parents:
diff changeset
1292 pic.Root().DeleteSurface(back_s);
223b71206888 Initial import
thib
parents:
diff changeset
1293 }
223b71206888 Initial import
thib
parents:
diff changeset
1294 }
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1295 /* その前に枠飾りを設定 */
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1296 if (name != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1297 str = name; str += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
1298 Surface* s = pic.Root().NewSurface(str.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
1299 if (s) {
223b71206888 Initial import
thib
parents:
diff changeset
1300 Rect rect(*s);
223b71206888 Initial import
thib
parents:
diff changeset
1301 pic.Root().DeleteSurface(s);
223b71206888 Initial import
thib
parents:
diff changeset
1302 PicBase* p = pic.create_leaf(Rect(0, 0, rect.width(), rect.height()),0);
223b71206888 Initial import
thib
parents:
diff changeset
1303 p->SetSurface(str.c_str(), 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1304 p->ZMove(ZMOVE_BOTTOM);
223b71206888 Initial import
thib
parents:
diff changeset
1305 p->show();
223b71206888 Initial import
thib
parents:
diff changeset
1306 }
223b71206888 Initial import
thib
parents:
diff changeset
1307 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1308 if (btn == NULL) return;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1309 if (use_btn == NULL) return;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1310 // ボタンの作成
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1311 // 使用するボタンについては、必要に応じて show() すること
0
223b71206888 Initial import
thib
parents:
diff changeset
1312
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1313 /* ボタンの位置情報を求める */
0
223b71206888 Initial import
thib
parents:
diff changeset
1314 str = btn; str += ".g00";
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1315 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::PDT, str.c_str(), "g00");
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1316 if (info == NULL) return; // cannot find file
0
223b71206888 Initial import
thib
parents:
diff changeset
1317 const char* data = info->Read();
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1318 /* g00 ファイルのヘッダ部分に位置情報は入っている */
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1319 /* 存在しなければボタン画像ではない */
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1320 if (data == NULL || *data != 2) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1321 delete info;
223b71206888 Initial import
thib
parents:
diff changeset
1322 return;
223b71206888 Initial import
thib
parents:
diff changeset
1323 }
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1324 int index_count = read_little_endian_int(data+5); // 0x70 == 112 ( 8 個ずつグループなので、14個のボタン ) が標準
0
223b71206888 Initial import
thib
parents:
diff changeset
1325 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1326 for (i=0; i<BTNCNT; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1327 if (!use_btn[i]) continue;
223b71206888 Initial import
thib
parents:
diff changeset
1328 if (btnpos[i]*8 >= index_count) {
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1329 continue; // ボタンが存在しない
0
223b71206888 Initial import
thib
parents:
diff changeset
1330 }
223b71206888 Initial import
thib
parents:
diff changeset
1331 int x, y, w, h;
223b71206888 Initial import
thib
parents:
diff changeset
1332 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
1333 if (config->GetParam(key, 5, 0, &x, &y, &w, &h) == -1) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1334 int sx, sy, sdx, sdy, cnt;
223b71206888 Initial import
thib
parents:
diff changeset
1335 const char* d = data + 9 + btnpos[i]*24*8;
223b71206888 Initial import
thib
parents:
diff changeset
1336 sx = read_little_endian_int(d);
223b71206888 Initial import
thib
parents:
diff changeset
1337 sy = read_little_endian_int(d+4);
223b71206888 Initial import
thib
parents:
diff changeset
1338 sdx = read_little_endian_int(d+24) - sx;
223b71206888 Initial import
thib
parents:
diff changeset
1339 sdy = read_little_endian_int(d+24 + 4) - sy;
223b71206888 Initial import
thib
parents:
diff changeset
1340 cnt = 2;
223b71206888 Initial import
thib
parents:
diff changeset
1341 if (sx+sdx*2 == read_little_endian_int(d+2*24) && sy+sdy*2 == read_little_endian_int(d+2*24+4)) cnt = 3;
223b71206888 Initial import
thib
parents:
diff changeset
1342 WidButton* wid = new WidButton(event, &pic, str.c_str(), sx, sy, sdx, sdy, cnt, Rect(x, y, x+w, y+h), 1);
223b71206888 Initial import
thib
parents:
diff changeset
1343 if (btnpress[i]) { wid->press_func = btnpress[i]; wid->press_pointer = callback;}
223b71206888 Initial import
thib
parents:
diff changeset
1344 if (btndrag[i]) { wid->drag_func = btndrag[i]; wid->drag_pointer = callback;}
223b71206888 Initial import
thib
parents:
diff changeset
1345 }
223b71206888 Initial import
thib
parents:
diff changeset
1346 delete info;
223b71206888 Initial import
thib
parents:
diff changeset
1347 }
223b71206888 Initial import
thib
parents:
diff changeset
1348
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1349 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
1350 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
1351 {
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1352 AyuSysConfig *config = AyuSysConfig::GetInstance();
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1353 int i;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1354 for (i=0; i<8; i++)
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1355 face_pics[i]=0;
0
223b71206888 Initial import
thib
parents:
diff changeset
1356 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1357 bool use_btn[BTNCNT];
223b71206888 Initial import
thib
parents:
diff changeset
1358 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
1359 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
1360 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
1361 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
1362 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
1363 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
1364 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
1365 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
1366 sprintf(key, "#WINDOW.%03d.LUBY_SIZE", win_no); if (config->GetParam(key, 1, &ruby) == -1) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1367
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1368 /* テキストウィジット:画面の右下一杯まで使用 */
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1369 /* posd == 2 なら画面下にひっつくように配置 */
0
223b71206888 Initial import
thib
parents:
diff changeset
1370 Rect r(0,0);
223b71206888 Initial import
thib
parents:
diff changeset
1371 if (posd == 2) {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1372 r = WakuSize(parent, waku_no);
0
223b71206888 Initial import
thib
parents:
diff changeset
1373 r = Rect(0, parent.Height()-r.height(), r.width(), parent.Height());
223b71206888 Initial import
thib
parents:
diff changeset
1374 posx = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1375 posy = parent.Height()-r.height();
223b71206888 Initial import
thib
parents:
diff changeset
1376 } else /* posd == 0 ? */
223b71206888 Initial import
thib
parents:
diff changeset
1377 r = Rect(posx, posy, parent.Width(), parent.Height());
223b71206888 Initial import
thib
parents:
diff changeset
1378
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1379 /* テキストウィンドウの作成 */
0
223b71206888 Initial import
thib
parents:
diff changeset
1380 int w = size*cntw; int h = (size+ruby+2)*cnth;
223b71206888 Initial import
thib
parents:
diff changeset
1381 wid = new WidText(event, &parent, r, Rect(mposx, mposy, mposx+w, mposy+h), size);
223b71206888 Initial import
thib
parents:
diff changeset
1382 wid->stream.kanji_type = TextStream::sjis;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1383 /* 顔ウィンドウの作成 */
0
223b71206888 Initial import
thib
parents:
diff changeset
1384 for (i=0; i<8; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1385 int x,y;
223b71206888 Initial import
thib
parents:
diff changeset
1386 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
1387 if (config->GetParam(key, 2, &x, &y) == -1) continue;
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1388 /* 顔ウィンドウを作成する */
0
223b71206888 Initial import
thib
parents:
diff changeset
1389 if (x >= 0 && y >= 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1390 face_pics[i] = wid->PicNode()->create_leaf(Rect(x,y), PicBase::FIT_SURFACE);
223b71206888 Initial import
thib
parents:
diff changeset
1391 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1392 face_pics[i] = parent.create_leaf(Rect(x+posx,y+posy), PicBase::FIT_SURFACE);
223b71206888 Initial import
thib
parents:
diff changeset
1393 }
223b71206888 Initial import
thib
parents:
diff changeset
1394 face_pics[i]->show();
223b71206888 Initial import
thib
parents:
diff changeset
1395 }
223b71206888 Initial import
thib
parents:
diff changeset
1396 face = face_pics[0];
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1397 // ボタンの設定
0
223b71206888 Initial import
thib
parents:
diff changeset
1398 for (i=0; i<BTNCNT; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1399 int num;
223b71206888 Initial import
thib
parents:
diff changeset
1400 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
1401 config->GetParam(key, 1, &num);
0
223b71206888 Initial import
thib
parents:
diff changeset
1402 use_btn[i] = (num==0) ? false : true;
223b71206888 Initial import
thib
parents:
diff changeset
1403 }
223b71206888 Initial import
thib
parents:
diff changeset
1404 // make name window
223b71206888 Initial import
thib
parents:
diff changeset
1405 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
1406 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
1407 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
1408 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
1409 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
1410 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
1411 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
1412 sprintf(key, "#WINDOW.%03d.NAME_POS", win_no); config->GetParam(key, 2, &name_posx, &name_posy);
0
223b71206888 Initial import
thib
parents:
diff changeset
1413 // if name_mode==0 name is in the text window
223b71206888 Initial import
thib
parents:
diff changeset
1414 // if name_mode == 1 open name window
223b71206888 Initial import
thib
parents:
diff changeset
1415 // if name_mode == 2 name is not used
223b71206888 Initial import
thib
parents:
diff changeset
1416 if (name_mod) {
223b71206888 Initial import
thib
parents:
diff changeset
1417 if (name_mod == 1) {
223b71206888 Initial import
thib
parents:
diff changeset
1418 int w = name_size*name_min; int h = name_size;
223b71206888 Initial import
thib
parents:
diff changeset
1419 int name_waku;
223b71206888 Initial import
thib
parents:
diff changeset
1420 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
1421 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
1422 Rect waku_r = WakuSize(parent, name_waku);
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1423 waku_r.rmove(r.lx, r.ty); // テキストウィンドウ位置に動かす
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1424 waku_r.rmove(name_posx, name_posy-waku_r.height()); // NAME_POS へ位置補正
0
223b71206888 Initial import
thib
parents:
diff changeset
1425 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
1426 MakeWaku(*name_container, event, name_waku, win_no, 0, callback);
0
223b71206888 Initial import
thib
parents:
diff changeset
1427 Rect name_r(0,0,w,h);
223b71206888 Initial import
thib
parents:
diff changeset
1428 name_r.rmove(name_mposx, name_mposy);
223b71206888 Initial import
thib
parents:
diff changeset
1429 name = new WidLabel(name_container, name_r, true, 0, name_size);
223b71206888 Initial import
thib
parents:
diff changeset
1430 name->show();
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
1431 } else { // 名前専用枠なし
0
223b71206888 Initial import
thib
parents:
diff changeset
1432 Rect name_r(0, 0, w, h);
223b71206888 Initial import
thib
parents:
diff changeset
1433 name_r.rmove(r.lx, r.ty);
223b71206888 Initial import
thib
parents:
diff changeset
1434 name_r.rmove(name_posx, name_posy-name_size);
223b71206888 Initial import
thib
parents:
diff changeset
1435 name_container = parent.create_node(name_r, 0);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1436 name = new WidLabel(name_container, Rect(0, 0, w, h), true, 0, name_size);
0
223b71206888 Initial import
thib
parents:
diff changeset
1437 name->show();
223b71206888 Initial import
thib
parents:
diff changeset
1438 name_container->show();
223b71206888 Initial import
thib
parents:
diff changeset
1439 }
223b71206888 Initial import
thib
parents:
diff changeset
1440 } else { // name_mod == 2 or 3
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1441 name_container = parent.create_node( Rect(0, 0, 1, 1), 0);
0
223b71206888 Initial import
thib
parents:
diff changeset
1442 }
223b71206888 Initial import
thib
parents:
diff changeset
1443 }
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1444 MakeWaku(*wid->PicNode(), event,waku_no, win_no, use_btn, callback);
0
223b71206888 Initial import
thib
parents:
diff changeset
1445 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1446
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1447 TextWindow::~TextWindow()
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1448 {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1449 if (name_container != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1450 delete name_container;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1451 name_container = NULL;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1452 }
43
01aa5ddf7dc8 A lot of very minor improvements (deleted some unused variables, and other things like that...)
thib
parents: 40
diff changeset
1453 int i;
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1454 for (i=0; i<8; i++) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1455 if (face_pics[i] != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1456 delete face_pics[i];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1457 face_pics[i] = NULL;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1458 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1459 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1460 if (wid != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1461 delete wid;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1462 wid = NULL;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1463 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1464 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1465
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1466 void TextWindow::show(void)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1467 {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1468 wid->show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1469 if (name_container != NULL && name_visible)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1470 name_container->show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1471 if (face != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1472 face->show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1473 }
0
223b71206888 Initial import
thib
parents:
diff changeset
1474
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1475 void TextWindow::hide(void)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1476 {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1477 wid->hide();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1478 if (name_container != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1479 name_container->hide();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1480 if (face != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1481 face->hide();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1482 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1483
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1484 void TextWindow::ShowFace(const char* path)
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 if (face == NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1487 return;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1488 face->SetSurface(path, 0, 0);
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
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1491 void TextWindow::ResetFace(void) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1492 if (face == NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1493 return;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1494 face->SetSurface((Surface*) NULL, 0, 0);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1495 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1496
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1497 void TextWindow::StartText(const TextStream& _stream)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1498 {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1499 wid->Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1500 wid->stream = _stream;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1501 if (name_container != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1502 char namestr[1024];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1503 namestr[0] = 0;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1504 wid->stream.RemoveName(namestr, 1024);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1505 if (namestr[0] == 0) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1506 name_container->hide();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1507 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1508 else {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1509 if (name != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1510 name_container->show_all();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1511 name->SetText(namestr);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1512 }
0
223b71206888 Initial import
thib
parents:
diff changeset
1513 }
223b71206888 Initial import
thib
parents:
diff changeset
1514 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1515 wid->Start();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1516 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1517
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1518 void TextWindow::SetName(const char* n)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1519 {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1520 if (name_container != NULL && name != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1521 if (n[0]) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1522 name_container->show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1523 name->SetText(n);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1524 name_visible = true;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1525 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1526 else {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1527 name_container->hide();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1528 name_visible = false;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1529 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1530 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1531 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1532
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1533 /**************************************************************::
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1534 **
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1535 ** SaveFaceHash
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1536 */
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1537
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1538 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
1539 {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1540 facetonum[face] = face_id;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1541 container.push_front(Node(face, face_id));
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1542 if (container.size() > size_max) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1543 Node remove = container.back();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1544 container.pop_back();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1545 facetonum.erase(remove.first);
0
223b71206888 Initial import
thib
parents:
diff changeset
1546 }
223b71206888 Initial import
thib
parents:
diff changeset
1547 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1548
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1549 int SaveFaceHash::Add(string face)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1550 {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1551 int id;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1552 int ret = -1;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1553 int i;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1554 List::iterator it;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1555 if (face.empty()) return -1;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1556 if (facetonum.find(face) == facetonum.end()) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1557 id = ++id_max;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1558 NewNode(face, id);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1559 ret = -1;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1560 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1561 else {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1562 id = facetonum[face];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1563 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
1564 if (it->second == id) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1565 ret = i;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1566 Node n = *it;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1567 container.erase(it);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1568 container.push_front(n);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1569 break;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1570 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1571 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1572 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1573 return ret;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1574 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1575
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1576 string SaveFaceHash::Get(int num) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1577 if (num < 0) return "";
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1578 List::iterator it = container.begin();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1579 for (; it != container.end(); it++) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1580 if (num == 0) return it->first;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1581 num--;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1582 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1583 return "";
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1584 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1585
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1586 int SaveFaceHash::size_max = 20;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1587