| 1 |
using System; |
| 2 |
using System.Collections.Generic; |
| 3 |
using System.ComponentModel; |
| 4 |
using System.Data; |
| 5 |
using System.Drawing; |
| 6 |
using System.Text; |
| 7 |
using System.Windows.Forms; |
| 8 |
|
| 9 |
namespace RipSync.RsiEditor |
| 10 |
{ |
| 11 |
public partial class frmRsiEditor : Form |
| 12 |
{ |
| 13 |
public const String strVersion = "Version 0.7 2009/04/05版"; |
| 14 |
private const int iCheckModeString = 1; // 入力項目チェック文字モード |
| 15 |
private const int iCheckModeNumeric = 5; // 入力項目チェック数値モード |
| 16 |
private Boolean flgNotSave; //変更後保存していない:true |
| 17 |
private RsiManager rsi = new RsiManager(); |
| 18 |
|
| 19 |
public frmRsiEditor() |
| 20 |
{ |
| 21 |
InitializeComponent(); |
| 22 |
} |
| 23 |
|
| 24 |
/// <summary> |
| 25 |
/// ロード処理。 |
| 26 |
/// </summary> |
| 27 |
private void frmRsiEditor_Load(object sender, EventArgs e) |
| 28 |
{ |
| 29 |
InitializeControls(); |
| 30 |
|
| 31 |
//メッセージ表示領域 |
| 32 |
txtMessage.Text = "「新規作成」または「読み込み」ボタンをクリックしてください。"; |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
/// <summary> |
| 37 |
/// コントロールを初期化する。 |
| 38 |
/// </summary> |
| 39 |
public void InitializeControls() |
| 40 |
{ |
| 41 |
//初期化時のコントロール使用禁止設定 |
| 42 |
SetControlsEnable(false); |
| 43 |
|
| 44 |
//基本 |
| 45 |
txtRsiFileName.Text = ""; |
| 46 |
txtRsiFileName.BackColor = SystemColors.Control; |
| 47 |
txtEshi.Text = ""; |
| 48 |
txtEshi.BackColor = SystemColors.Window; |
| 49 |
txtBase.Text = ""; |
| 50 |
txtBase.BackColor = SystemColors.Control; |
| 51 |
txtBaseHeight.Text = ""; |
| 52 |
txtBaseHeight.BackColor = SystemColors.Window; |
| 53 |
txtBaseWidth.Text = ""; |
| 54 |
txtBaseWidth.BackColor = SystemColors.Window; |
| 55 |
|
| 56 |
|
| 57 |
//目 |
| 58 |
txtEyeClose.Text = ""; |
| 59 |
txtEyeClose.BackColor = SystemColors.Control; |
| 60 |
txtEyeThin.Text = ""; |
| 61 |
txtEyeThin.BackColor = SystemColors.Control; |
| 62 |
txtEyeNormal.Text = ""; |
| 63 |
txtEyeNormal.BackColor = SystemColors.Control; |
| 64 |
|
| 65 |
//口 |
| 66 |
txtMouthA.Text = ""; |
| 67 |
txtMouthA.BackColor = SystemColors.Control; |
| 68 |
txtMouthI.Text = ""; |
| 69 |
txtMouthI.BackColor = SystemColors.Control; |
| 70 |
txtMouthU.Text = ""; |
| 71 |
txtMouthU.BackColor = SystemColors.Control; |
| 72 |
txtMouthE.Text = ""; |
| 73 |
txtMouthE.BackColor = SystemColors.Control; |
| 74 |
txtMouthO.Text = ""; |
| 75 |
txtMouthO.BackColor = SystemColors.Control; |
| 76 |
txtMouthN.Text = ""; |
| 77 |
txtMouthN.BackColor = SystemColors.Control; |
| 78 |
txtMouthXo.Text = ""; |
| 79 |
txtMouthXo.BackColor = SystemColors.Control; |
| 80 |
txtMouthAa.Text = ""; |
| 81 |
txtMouthAa.BackColor = SystemColors.Control; |
| 82 |
|
| 83 |
//目追加 |
| 84 |
txtEyeAdd1Name.Text = ""; |
| 85 |
txtEyeAdd1Name.BackColor = SystemColors.Window; |
| 86 |
txtEyeAdd2Name.Text = ""; |
| 87 |
txtEyeAdd2Name.BackColor = SystemColors.Window; |
| 88 |
txtEyeAdd3Name.Text = ""; |
| 89 |
txtEyeAdd3Name.BackColor = SystemColors.Window; |
| 90 |
txtEyeAdd4Name.Text = ""; |
| 91 |
txtEyeAdd4Name.BackColor = SystemColors.Window; |
| 92 |
txtEyeAdd5Name.Text = ""; |
| 93 |
txtEyeAdd5Name.BackColor = SystemColors.Window; |
| 94 |
txtEyeAdd6Name.Text = ""; |
| 95 |
txtEyeAdd6Name.BackColor = SystemColors.Window; |
| 96 |
|
| 97 |
txtEyeAdd1.Text = ""; |
| 98 |
txtEyeAdd1.BackColor = SystemColors.Control; |
| 99 |
txtEyeAdd2.Text = ""; |
| 100 |
txtEyeAdd2.BackColor = SystemColors.Control; |
| 101 |
txtEyeAdd3.Text = ""; |
| 102 |
txtEyeAdd3.BackColor = SystemColors.Control; |
| 103 |
txtEyeAdd4.Text = ""; |
| 104 |
txtEyeAdd4.BackColor = SystemColors.Control; |
| 105 |
txtEyeAdd5.Text = ""; |
| 106 |
txtEyeAdd5.BackColor = SystemColors.Control; |
| 107 |
txtEyeAdd6.Text = ""; |
| 108 |
txtEyeAdd6.BackColor = SystemColors.Control; |
| 109 |
|
| 110 |
//口追加 |
| 111 |
txtMouthAdd1Name.Text = ""; |
| 112 |
txtMouthAdd1Name.BackColor = SystemColors.Window; |
| 113 |
txtMouthAdd2Name.Text = ""; |
| 114 |
txtMouthAdd2Name.BackColor = SystemColors.Window; |
| 115 |
txtMouthAdd3Name.Text = ""; |
| 116 |
txtMouthAdd3Name.BackColor = SystemColors.Window; |
| 117 |
txtMouthAdd4Name.Text = ""; |
| 118 |
txtMouthAdd4Name.BackColor = SystemColors.Window; |
| 119 |
txtMouthAdd5Name.Text = ""; |
| 120 |
txtMouthAdd5Name.BackColor = SystemColors.Window; |
| 121 |
txtMouthAdd6Name.Text = ""; |
| 122 |
txtMouthAdd6Name.BackColor = SystemColors.Window; |
| 123 |
|
| 124 |
txtMouthAdd1.Text = ""; |
| 125 |
txtMouthAdd1.BackColor = SystemColors.Control; |
| 126 |
txtMouthAdd2.Text = ""; |
| 127 |
txtMouthAdd2.BackColor = SystemColors.Control; |
| 128 |
txtMouthAdd3.Text = ""; |
| 129 |
txtMouthAdd3.BackColor = SystemColors.Control; |
| 130 |
txtMouthAdd4.Text = ""; |
| 131 |
txtMouthAdd4.BackColor = SystemColors.Control; |
| 132 |
txtMouthAdd5.Text = ""; |
| 133 |
txtMouthAdd5.BackColor = SystemColors.Control; |
| 134 |
txtMouthAdd6.Text = ""; |
| 135 |
txtMouthAdd6.BackColor = SystemColors.Control; |
| 136 |
|
| 137 |
//基本設定のタブを表示するにゃん |
| 138 |
tabGroup.SelectTab(0); |
| 139 |
|
| 140 |
//メッセージ表示領域初期化にゃ |
| 141 |
txtMessage.Text = ""; |
| 142 |
|
| 143 |
flgNotSave = false; |
| 144 |
} |
| 145 |
|
| 146 |
/// <summary> |
| 147 |
/// 終了ボタン |
| 148 |
/// </summary> |
| 149 |
private void btnClose_Click(object sender, EventArgs e) |
| 150 |
{ |
| 151 |
//終了にゃ |
| 152 |
this.Close(); |
| 153 |
} |
| 154 |
|
| 155 |
/// <summary> |
| 156 |
/// 画面を閉じるイベント |
| 157 |
/// </summary> |
| 158 |
private void frmRsiEditor_FormClosing(object sender, FormClosingEventArgs e) |
| 159 |
{ |
| 160 |
//保存されてなかったら確認にゃ |
| 161 |
if (flgNotSave) |
| 162 |
{ |
| 163 |
DialogResult dr = MessageBox.Show("設定が変更されていますよ?\n終了しちゃって良いんですか?", "質問", |
| 164 |
MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2 ); |
| 165 |
if (dr != DialogResult.OK) |
| 166 |
{ |
| 167 |
e.Cancel = true; |
| 168 |
return; |
| 169 |
} |
| 170 |
} |
| 171 |
|
| 172 |
} |
| 173 |
|
| 174 |
/// <summary> |
| 175 |
/// 新規作成ボタン |
| 176 |
/// </summary> |
| 177 |
private void btnNewFile_Click(object sender, EventArgs e) |
| 178 |
{ |
| 179 |
//保存されてなかったら確認にゃ |
| 180 |
if (flgNotSave) |
| 181 |
{ |
| 182 |
DialogResult dr = MessageBox.Show("設定が変更されていますよ?\n消しちゃって良いんですか?", "質問", |
| 183 |
MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); |
| 184 |
if (dr != DialogResult.OK) |
| 185 |
{ |
| 186 |
return; |
| 187 |
} |
| 188 |
} |
| 189 |
|
| 190 |
//初期化するにゃ |
| 191 |
InitializeControls(); |
| 192 |
|
| 193 |
//新規RSIファイルを選択にゃ |
| 194 |
//RSIファイル選択にゃ |
| 195 |
if (saveFileDialog.ShowDialog() != DialogResult.OK) |
| 196 |
{ |
| 197 |
return; |
| 198 |
} |
| 199 |
txtRsiFileName.Text = saveFileDialog.FileName; |
| 200 |
//初期化時のコントロール使用可能設定 |
| 201 |
SetControlsEnable(true); |
| 202 |
|
| 203 |
//未保存フラグ設定にゃ |
| 204 |
flgNotSave = true; |
| 205 |
|
| 206 |
} |
| 207 |
|
| 208 |
/// <summary> |
| 209 |
/// 読み込みボタン |
| 210 |
/// </summary> |
| 211 |
private void btnRead_Click(object sender, EventArgs e) |
| 212 |
{ |
| 213 |
//注意メッセージにゃ |
| 214 |
DialogResult dr = MessageBox.Show("当プログラムで保存したRSIファイル以外を選択すると、\n保存時にデータを破壊する恐れがあります。", "☆☆☆ 注 意 ☆☆☆", |
| 215 |
MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); |
| 216 |
if (dr != DialogResult.OK) |
| 217 |
{ |
| 218 |
return; |
| 219 |
} |
| 220 |
|
| 221 |
//保存されてなかったら確認にゃ |
| 222 |
if (flgNotSave) |
| 223 |
{ |
| 224 |
dr = MessageBox.Show("設定が変更されていますよ?\n消しちゃって良いんですか?", "質問", |
| 225 |
MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); |
| 226 |
if (dr != DialogResult.OK) |
| 227 |
{ |
| 228 |
return; |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
//RSIファイル選択にゃ |
| 233 |
if (openFileDialogRSI.ShowDialog() != DialogResult.OK) |
| 234 |
{ |
| 235 |
return; |
| 236 |
} |
| 237 |
|
| 238 |
//初期化するにゃ |
| 239 |
InitializeControls(); |
| 240 |
|
| 241 |
//RSIファイル読み込みにゃ |
| 242 |
rsi = new RsiManager(openFileDialogRSI.FileName); |
| 243 |
|
| 244 |
//画面に展開にゃ |
| 245 |
formDataSet(openFileDialogRSI.FileName, rsi); |
| 246 |
|
| 247 |
//初期化時のコントロール使用可能設定にゃん |
| 248 |
SetControlsEnable(true); |
| 249 |
|
| 250 |
//未保存フラグ初期化にゃ |
| 251 |
flgNotSave = false; |
| 252 |
|
| 253 |
} |
| 254 |
|
| 255 |
/// <summary> |
| 256 |
/// SingerConfigの内容を画面の各項目にセットする |
| 257 |
/// </summary> |
| 258 |
private void formDataSet(String filename, RsiManager rsi) |
| 259 |
{ |
| 260 |
|
| 261 |
//基本 |
| 262 |
txtRsiFileName.Text = filename; |
| 263 |
txtEshi.Text = rsi.Eshi; |
| 264 |
txtBase.Text = rsi.Base; |
| 265 |
txtBaseHeight.Text = rsi.BaseHeight; |
| 266 |
txtBaseWidth.Text = rsi.BaseWidth; |
| 267 |
|
| 268 |
//目 |
| 269 |
txtEyeClose.Text = rsi.EyeClose; |
| 270 |
txtEyeThin.Text = rsi.EyeThin; |
| 271 |
txtEyeNormal.Text = rsi.EyeNormal; |
| 272 |
|
| 273 |
//口 |
| 274 |
txtMouthA.Text = rsi.MouthA; |
| 275 |
txtMouthI.Text = rsi.MouthI; |
| 276 |
txtMouthU.Text = rsi.MouthU; |
| 277 |
txtMouthE.Text = rsi.MouthE; |
| 278 |
txtMouthO.Text = rsi.MouthO; |
| 279 |
txtMouthN.Text = rsi.MouthN; |
| 280 |
txtMouthXo.Text = rsi.MouthXo; |
| 281 |
txtMouthAa.Text = rsi.MouthAa; |
| 282 |
|
| 283 |
//目追加 |
| 284 |
// for で繰り返してぇなぁ~ |
| 285 |
txtEyeAdd1Name.Text = rsi.EyeAddName[0]; |
| 286 |
txtEyeAdd1.Text = rsi.EyeAdd[0]; |
| 287 |
txtEyeAdd2Name.Text = rsi.EyeAddName[1]; |
| 288 |
txtEyeAdd2.Text = rsi.EyeAdd[1]; |
| 289 |
txtEyeAdd3Name.Text = rsi.EyeAddName[2]; |
| 290 |
txtEyeAdd3.Text = rsi.EyeAdd[2]; |
| 291 |
txtEyeAdd4Name.Text = rsi.EyeAddName[3]; |
| 292 |
txtEyeAdd4.Text = rsi.EyeAdd[3]; |
| 293 |
txtEyeAdd5Name.Text = rsi.EyeAddName[4]; |
| 294 |
txtEyeAdd5.Text = rsi.EyeAdd[4]; |
| 295 |
txtEyeAdd6Name.Text = rsi.EyeAddName[5]; |
| 296 |
txtEyeAdd6.Text = rsi.EyeAdd[5]; |
| 297 |
|
| 298 |
//口追加 |
| 299 |
// for で繰り返してぇなぁ~ |
| 300 |
txtMouthAdd1Name.Text = rsi.MouthAddName[0]; |
| 301 |
txtMouthAdd1.Text = rsi.MouthAdd[0]; |
| 302 |
txtMouthAdd2Name.Text = rsi.MouthAddName[1]; |
| 303 |
txtMouthAdd2.Text = rsi.MouthAdd[1]; |
| 304 |
txtMouthAdd3Name.Text = rsi.MouthAddName[2]; |
| 305 |
txtMouthAdd3.Text = rsi.MouthAdd[2]; |
| 306 |
txtMouthAdd4Name.Text = rsi.MouthAddName[3]; |
| 307 |
txtMouthAdd4.Text = rsi.MouthAdd[3]; |
| 308 |
txtMouthAdd5Name.Text = rsi.MouthAddName[4]; |
| 309 |
txtMouthAdd5.Text = rsi.MouthAdd[4]; |
| 310 |
txtMouthAdd6Name.Text = rsi.MouthAddName[5]; |
| 311 |
txtMouthAdd6.Text = rsi.MouthAdd[5]; |
| 312 |
|
| 313 |
} |
| 314 |
|
| 315 |
/// <summary> |
| 316 |
/// 入力項目チェック処理 |
| 317 |
/// </summary> |
| 318 |
private bool formDataCheck() |
| 319 |
{ |
| 320 |
bool bRetFlg = false; //戻り値 true 正常、false エラーありにゃ |
| 321 |
bool bErrFlg = false; //エラーフラグ true エラーあり、false エラーなしにゃ |
| 322 |
try |
| 323 |
{ |
| 324 |
//メッセージ領域初期化 |
| 325 |
txtMessage.Text = ""; |
| 326 |
|
| 327 |
//・名称の空白詰め 半角・全角 |
| 328 |
txtEshi.Text = txtEshi.Text.Trim(); |
| 329 |
|
| 330 |
// ・絵師の必須チェック |
| 331 |
bErrFlg = formDataCheck_TextBox(txtEshi, "絵師・キャラ名", iCheckModeString, true) || bErrFlg; |
| 332 |
//・絵師-キャラの型式チェック |
| 333 |
// ⇒半角ハイフンの有無確認 |
| 334 |
if (txtEshi.Text.IndexOf("-") <= 0) |
| 335 |
{ |
| 336 |
bErrFlg = true; |
| 337 |
txtEshi.BackColor = Color.Red; |
| 338 |
if (txtMessage.Text.Length == 0) |
| 339 |
{ |
| 340 |
txtMessage.Text = "絵師-キャラ名の入力型式が合ってません"; |
| 341 |
} |
| 342 |
} |
| 343 |
|
| 344 |
// ・ベース画像、サイズの必須チェック |
| 345 |
bErrFlg = formDataCheck_TextBox(txtBase, "ベース画像", iCheckModeString, true) || bErrFlg; |
| 346 |
bErrFlg = formDataCheck_TextBox(txtBaseHeight, "ベース画像のサイズ", iCheckModeNumeric, true) || bErrFlg; |
| 347 |
bErrFlg = formDataCheck_TextBox(txtBaseWidth, "ベース画像のサイズ", iCheckModeNumeric, true) || bErrFlg; |
| 348 |
|
| 349 |
// ・目自動、口自動の必須チェック |
| 350 |
bErrFlg = formDataCheck_TextBox(txtEyeNormal, "目自動・目通常", iCheckModeString, true) || bErrFlg; |
| 351 |
bErrFlg = formDataCheck_TextBox(txtEyeThin, "目自動・薄目", iCheckModeString, true) || bErrFlg; |
| 352 |
bErrFlg = formDataCheck_TextBox(txtEyeClose, "目自動・閉目", iCheckModeString, true) || bErrFlg; |
| 353 |
bErrFlg = formDataCheck_TextBox(txtMouthA, "口自動・あ", iCheckModeString, true) || bErrFlg; |
| 354 |
bErrFlg = formDataCheck_TextBox(txtMouthI, "口自動・い", iCheckModeString, true) || bErrFlg; |
| 355 |
bErrFlg = formDataCheck_TextBox(txtMouthU, "口自動・う", iCheckModeString, true) || bErrFlg; |
| 356 |
bErrFlg = formDataCheck_TextBox(txtMouthE, "口自動・え", iCheckModeString, true) || bErrFlg; |
| 357 |
bErrFlg = formDataCheck_TextBox(txtMouthO, "口自動・お", iCheckModeString, true) || bErrFlg; |
| 358 |
bErrFlg = formDataCheck_TextBox(txtMouthN, "口自動・ん", iCheckModeString, true) || bErrFlg; |
| 359 |
bErrFlg = formDataCheck_TextBox(txtMouthAa, "口自動・ああ", iCheckModeString, true) || bErrFlg; |
| 360 |
bErrFlg = formDataCheck_TextBox(txtMouthXo, "口自動・ぉ", iCheckModeString, true) || bErrFlg; |
| 361 |
|
| 362 |
// ・目手動、口手動の片葉チェック |
| 363 |
// ・目手動、口手動の重複チェック |
| 364 |
// ・自動と重複 |
| 365 |
// ・手動と重複 |
| 366 |
|
| 367 |
|
| 368 |
if (bErrFlg == false) |
| 369 |
{ |
| 370 |
//エラーが見つからなかったら、戻り値は正常にゃ |
| 371 |
bRetFlg = true; |
| 372 |
} |
| 373 |
//else |
| 374 |
//{ |
| 375 |
// //エラーがあったらメッセージ表示にゃ |
| 376 |
// MessageBox.Show(strErrMsg, "入力エラー", |
| 377 |
// MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); |
| 378 |
//} |
| 379 |
return bRetFlg; |
| 380 |
} |
| 381 |
catch (Exception e) |
| 382 |
{ |
| 383 |
Logger.GetInstance().ErrorWrite("formDataCheck", e); |
| 384 |
bRetFlg = false; |
| 385 |
return bRetFlg; |
| 386 |
} |
| 387 |
} |
| 388 |
|
| 389 |
private bool formDataCheck_TextBox(TextBox _TxtBox, String _strChkKmk, int _chkMode, bool _bHissu) |
| 390 |
{ |
| 391 |
try |
| 392 |
{ |
| 393 |
bool bErrFlg = false; //エラーフラグ |
| 394 |
|
| 395 |
//最初のエラーだけ発見するためにwhileとbreakを使うにゃ |
| 396 |
while (true) |
| 397 |
{ |
| 398 |
//必須チェック |
| 399 |
if (_TxtBox.Text == "") |
| 400 |
{ |
| 401 |
if(txtMessage.Text.Length == 0 ) |
| 402 |
{ |
| 403 |
txtMessage.Text = _strChkKmk + "を入力してください。"; |
| 404 |
} |
| 405 |
bErrFlg = true; |
| 406 |
break; |
| 407 |
} |
| 408 |
|
| 409 |
//数値項目なら数値チェック |
| 410 |
if (_chkMode == iCheckModeNumeric) |
| 411 |
{ |
| 412 |
try |
| 413 |
{ |
| 414 |
int ii = Int16.Parse(_TxtBox.Text); |
| 415 |
} |
| 416 |
catch |
| 417 |
{ |
| 418 |
|
| 419 |
if(txtMessage.Text.Length == 0 ) |
| 420 |
{ |
| 421 |
txtMessage.Text = _strChkKmk + "には数値を入力してください。"; |
| 422 |
} |
| 423 |
bErrFlg = true; |
| 424 |
} |
| 425 |
} |
| 426 |
|
| 427 |
//ループしないのにゃ |
| 428 |
break; |
| 429 |
} |
| 430 |
|
| 431 |
//エラー項目の背景色を赤くするにゃ |
| 432 |
if (bErrFlg == true) |
| 433 |
{ |
| 434 |
_TxtBox.BackColor = Color.Red; |
| 435 |
} |
| 436 |
return bErrFlg; |
| 437 |
} |
| 438 |
catch(Exception e) |
| 439 |
{ |
| 440 |
Logger.GetInstance().ErrorWrite("formDataCheck", e); |
| 441 |
return true; |
| 442 |
} |
| 443 |
|
| 444 |
} |
| 445 |
|
| 446 |
/// <summary> |
| 447 |
/// 保存ボタン処理 |
| 448 |
/// </summary> |
| 449 |
private void btnSave_Click(object sender, EventArgs e) |
| 450 |
{ |
| 451 |
//入力項目をチェックにゃ |
| 452 |
if (formDataCheck() == false) |
| 453 |
{ |
| 454 |
//エラーがあった場合保存処理中止にゃ |
| 455 |
return; |
| 456 |
} |
| 457 |
|
| 458 |
//新規のときは名前をつけて保存に飛ばすにゃ |
| 459 |
if (txtRsiFileName.Text == "") |
| 460 |
{ |
| 461 |
btnSaveAs_Click(sender, e); |
| 462 |
} |
| 463 |
else |
| 464 |
{ |
| 465 |
|
| 466 |
//画面の各内容をRsiManagerにセットにゃ |
| 467 |
form2RsiManager(rsi); |
| 468 |
|
| 469 |
//保存するにゃ |
| 470 |
if (rsi.Save(txtRsiFileName.Text) == true) |
| 471 |
{ |
| 472 |
MessageBox.Show("保存しました。", "確認", MessageBoxButtons.OK, MessageBoxIcon.Information); |
| 473 |
} |
| 474 |
else |
| 475 |
{ |
| 476 |
MessageBox.Show("保存に失敗しました。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| 477 |
} |
| 478 |
|
| 479 |
//未保存フラグ初期化にゃ |
| 480 |
flgNotSave = false; |
| 481 |
} |
| 482 |
} |
| 483 |
|
| 484 |
/// <summary> |
| 485 |
/// 名前をつけて保存 |
| 486 |
/// </summary> |
| 487 |
private void btnSaveAs_Click(object sender, EventArgs e) |
| 488 |
{ |
| 489 |
//入力項目をチェックにゃ |
| 490 |
if (formDataCheck() == false) |
| 491 |
{ |
| 492 |
//エラーがあった場合保存処理中止にゃ |
| 493 |
return; |
| 494 |
} |
| 495 |
|
| 496 |
//RSIファイル選択にゃ |
| 497 |
if (saveFileDialog.ShowDialog() != DialogResult.OK) |
| 498 |
{ |
| 499 |
return; |
| 500 |
} |
| 501 |
txtRsiFileName.Text = saveFileDialog.FileName; |
| 502 |
|
| 503 |
|
| 504 |
//画面の各内容をRsiManagerにセットにゃ |
| 505 |
form2RsiManager(rsi); |
| 506 |
|
| 507 |
//保存するにゃ |
| 508 |
if (rsi.Save(txtRsiFileName.Text) == true) |
| 509 |
{ |
| 510 |
MessageBox.Show("保存しました。", "確認", MessageBoxButtons.OK, MessageBoxIcon.Information); |
| 511 |
} |
| 512 |
else |
| 513 |
{ |
| 514 |
MessageBox.Show("保存に失敗しました。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| 515 |
} |
| 516 |
|
| 517 |
//未保存フラグ初期化にゃ |
| 518 |
flgNotSave = false; |
| 519 |
} |
| 520 |
|
| 521 |
/// <summary> |
| 522 |
/// 画面の各項目をRsiManagerクラスにセットする。 |
| 523 |
/// </summary> |
| 524 |
private void form2RsiManager(RsiManager _rsi) |
| 525 |
{ |
| 526 |
//基本 |
| 527 |
rsi.Eshi = txtEshi.Text; |
| 528 |
rsi.Base = txtBase.Text; |
| 529 |
rsi.BaseHeight = txtBaseHeight.Text; |
| 530 |
rsi.BaseWidth = txtBaseWidth.Text; |
| 531 |
|
| 532 |
//目 |
| 533 |
rsi.EyeClose = txtEyeClose.Text; |
| 534 |
rsi.EyeThin = txtEyeThin.Text; |
| 535 |
rsi.EyeNormal = txtEyeNormal.Text; |
| 536 |
|
| 537 |
//口 |
| 538 |
rsi.MouthA = txtMouthA.Text; |
| 539 |
rsi.MouthI = txtMouthI.Text; |
| 540 |
rsi.MouthU = txtMouthU.Text; |
| 541 |
rsi.MouthE = txtMouthE.Text; |
| 542 |
rsi.MouthO = txtMouthO.Text; |
| 543 |
rsi.MouthN = txtMouthN.Text; |
| 544 |
rsi.MouthXo = txtMouthXo.Text; |
| 545 |
rsi.MouthAa = txtMouthAa.Text; |
| 546 |
|
| 547 |
//目追加 |
| 548 |
rsi.EyeAddName[0] = txtEyeAdd1Name.Text; |
| 549 |
rsi.EyeAdd[0] = txtEyeAdd1.Text; |
| 550 |
rsi.EyeAddName[1] = txtEyeAdd2Name.Text; |
| 551 |
rsi.EyeAdd[1] = txtEyeAdd2.Text; |
| 552 |
rsi.EyeAddName[2] = txtEyeAdd3Name.Text; |
| 553 |
rsi.EyeAdd[2] = txtEyeAdd3.Text; |
| 554 |
rsi.EyeAddName[3] = txtEyeAdd4Name.Text; |
| 555 |
rsi.EyeAdd[3] = txtEyeAdd4.Text; |
| 556 |
rsi.EyeAddName[4] = txtEyeAdd5Name.Text; |
| 557 |
rsi.EyeAdd[4] = txtEyeAdd5.Text; |
| 558 |
rsi.EyeAddName[5] = txtEyeAdd6Name.Text; |
| 559 |
rsi.EyeAdd[5] = txtEyeAdd6.Text; |
| 560 |
|
| 561 |
//口追加 |
| 562 |
rsi.MouthAddName[0] = txtMouthAdd1Name.Text; |
| 563 |
rsi.MouthAdd[0] = txtMouthAdd1.Text; |
| 564 |
rsi.MouthAddName[1] = txtMouthAdd2Name.Text; |
| 565 |
rsi.MouthAdd[1] = txtMouthAdd2.Text; |
| 566 |
rsi.MouthAddName[2] = txtMouthAdd3Name.Text; |
| 567 |
rsi.MouthAdd[2] = txtMouthAdd3.Text; |
| 568 |
rsi.MouthAddName[3] = txtMouthAdd4Name.Text; |
| 569 |
rsi.MouthAdd[3] = txtMouthAdd4.Text; |
| 570 |
rsi.MouthAddName[4] = txtMouthAdd5Name.Text; |
| 571 |
rsi.MouthAdd[4] = txtMouthAdd5.Text; |
| 572 |
rsi.MouthAddName[5] = txtMouthAdd6Name.Text; |
| 573 |
rsi.MouthAdd[5] = txtMouthAdd6.Text; |
| 574 |
|
| 575 |
} |
| 576 |
|
| 577 |
/// <summary> |
| 578 |
/// 選択ボタン共通処理 |
| 579 |
/// </summary> |
| 580 |
private bool btnSelectGraphic(string _title, Button _btn, TextBox _fname) |
| 581 |
{ |
| 582 |
//RSIファイル選択にゃ |
| 583 |
if (openFileDialogGraphic.ShowDialog() != DialogResult.OK) |
| 584 |
{ |
| 585 |
//選択されんかったにゃ (T_T) |
| 586 |
return false; |
| 587 |
} |
| 588 |
|
| 589 |
flgNotSave = true; //変更後保存していない:true |
| 590 |
|
| 591 |
if (txtRsiFileName.Text.Length == 0) |
| 592 |
{ |
| 593 |
_fname.Text = openFileDialogGraphic.FileName; |
| 594 |
} |
| 595 |
else |
| 596 |
{ |
| 597 |
//選択された画像から相対パスを取得するにゃ |
| 598 |
int i; |
| 599 |
String fname = openFileDialogGraphic.FileName; |
| 600 |
for (i = 0; i < fname.Length; i++) |
| 601 |
{ |
| 602 |
if (txtRsiFileName.Text.Length < i) break; |
| 603 |
if (fname.Substring(i, 1) != txtRsiFileName.Text.Substring(i, 1)) |
| 604 |
{ |
| 605 |
break; |
| 606 |
} |
| 607 |
} |
| 608 |
_fname.Text = fname.Substring(i); |
| 609 |
} |
| 610 |
|
| 611 |
return true; |
| 612 |
} |
| 613 |
|
| 614 |
/// <summary> |
| 615 |
/// コントロールの使用可否設定 |
| 616 |
/// </summary> |
| 617 |
private void SetControlsEnable(bool _enabled) |
| 618 |
{ |
| 619 |
btnSaveAs.Enabled = _enabled; |
| 620 |
btnSave.Enabled = _enabled; |
| 621 |
tabGroup.Enabled = _enabled; |
| 622 |
} |
| 623 |
|
| 624 |
/// <summary> |
| 625 |
/// バージン情報 |
| 626 |
/// </summary> |
| 627 |
private void btnVirsion_Click(object sender, EventArgs e) |
| 628 |
{ |
| 629 |
MessageBox.Show(String.Concat(strVersion, " "), " バージョン情報", MessageBoxButtons.OK, MessageBoxIcon.Information); |
| 630 |
} |
| 631 |
|
| 632 |
#region "選択ボタンをクリックしたときの処理" |
| 633 |
/// <summary> |
| 634 |
/// ベース画像選択ボタン |
| 635 |
/// </summary> |
| 636 |
private void btnSelectBase_Click(object sender, EventArgs e) |
| 637 |
{ |
| 638 |
if (btnSelectGraphic("ベース画像", btnSelectBase, txtBase)) |
| 639 |
{ |
| 640 |
//現在何も処理なし |
| 641 |
} |
| 642 |
} |
| 643 |
|
| 644 |
//----------------------------------------------------------------- |
| 645 |
/// 目選択ボタン |
| 646 |
//----------------------------------------------------------------- |
| 647 |
private void btnSelectEyeNormal_Click(object sender, EventArgs e) |
| 648 |
{ |
| 649 |
if (btnSelectGraphic("目通常", btnSelectEyeNormal, txtEyeNormal)) |
| 650 |
{ |
| 651 |
//現在何も処理なし |
| 652 |
} |
| 653 |
} |
| 654 |
|
| 655 |
/// <summary> |
| 656 |
/// 薄目選択ボタン |
| 657 |
/// </summary> |
| 658 |
private void btnSelectEyeThin_Click(object sender, EventArgs e) |
| 659 |
{ |
| 660 |
if (btnSelectGraphic("薄目", btnSelectEyeThin, txtEyeThin)) |
| 661 |
{ |
| 662 |
//現在何も処理なし |
| 663 |
} |
| 664 |
} |
| 665 |
|
| 666 |
/// <summary> |
| 667 |
/// 閉目選択ボタン |
| 668 |
/// </summary> |
| 669 |
private void btnSelectEyeClose_Click(object sender, EventArgs e) |
| 670 |
{ |
| 671 |
if (btnSelectGraphic("閉目", btnSelectEyeClose, txtEyeClose)) |
| 672 |
{ |
| 673 |
//現在何も処理なし |
| 674 |
} |
| 675 |
} |
| 676 |
|
| 677 |
//----------------------------------------------------------------- |
| 678 |
/// 口選択ボタン |
| 679 |
//----------------------------------------------------------------- |
| 680 |
private void btnSelectMouthA_Click(object sender, EventArgs e) |
| 681 |
{ |
| 682 |
if (btnSelectGraphic("口あ", btnSelectMouthA, txtMouthA)) |
| 683 |
{ |
| 684 |
//現在何も処理なし |
| 685 |
} |
| 686 |
} |
| 687 |
|
| 688 |
private void btnSelectMouthI_Click(object sender, EventArgs e) |
| 689 |
{ |
| 690 |
if (btnSelectGraphic("口い", btnSelectMouthI, txtMouthI)) |
| 691 |
{ |
| 692 |
//現在何も処理なし |
| 693 |
} |
| 694 |
} |
| 695 |
|
| 696 |
private void btnSelectMouthU_Click(object sender, EventArgs e) |
| 697 |
{ |
| 698 |
if (btnSelectGraphic("口う", btnSelectMouthU, txtMouthU)) |
| 699 |
{ |
| 700 |
//現在何も処理なし |
| 701 |
} |
| 702 |
} |
| 703 |
|
| 704 |
private void btnSelectMouthE_Click(object sender, EventArgs e) |
| 705 |
{ |
| 706 |
if (btnSelectGraphic("口え", btnSelectMouthE, txtMouthE)) |
| 707 |
{ |
| 708 |
//現在何も処理なし |
| 709 |
} |
| 710 |
} |
| 711 |
|
| 712 |
private void btnSelectMouthO_Click(object sender, EventArgs e) |
| 713 |
{ |
| 714 |
if (btnSelectGraphic("口お", btnSelectMouthO, txtMouthO)) |
| 715 |
{ |
| 716 |
//現在何も処理なし |
| 717 |
} |
| 718 |
} |
| 719 |
|
| 720 |
private void btnSelectMouthN_Click(object sender, EventArgs e) |
| 721 |
{ |
| 722 |
if (btnSelectGraphic("口ん", btnSelectMouthN, txtMouthN)) |
| 723 |
{ |
| 724 |
//現在何も処理なし |
| 725 |
} |
| 726 |
} |
| 727 |
|
| 728 |
private void btnSelectMouthAa_Click(object sender, EventArgs e) |
| 729 |
{ |
| 730 |
if (btnSelectGraphic("口ああ", btnSelectMouthAa, txtMouthAa)) |
| 731 |
{ |
| 732 |
//現在何も処理なし |
| 733 |
} |
| 734 |
} |
| 735 |
|
| 736 |
private void btnSelectMouthXo_Click(object sender, EventArgs e) |
| 737 |
{ |
| 738 |
if (btnSelectGraphic("口ぉ", btnSelectMouthXo, txtMouthXo)) |
| 739 |
{ |
| 740 |
//現在何も処理なし |
| 741 |
} |
| 742 |
} |
| 743 |
|
| 744 |
//----------------------------------------------------------------- |
| 745 |
/// 目手動選択ボタン |
| 746 |
//----------------------------------------------------------------- |
| 747 |
private void btnSelectEyeAdd1_Click(object sender, EventArgs e) |
| 748 |
{ |
| 749 |
if (btnSelectGraphic("目手動1", btnSelectEyeAdd1, txtEyeAdd1)) |
| 750 |
{ |
| 751 |
//現在何も処理なし |
| 752 |
} |
| 753 |
} |
| 754 |
|
| 755 |
private void btnSelectEyeAdd2_Click(object sender, EventArgs e) |
| 756 |
{ |
| 757 |
if (btnSelectGraphic("目手動2", btnSelectEyeAdd2, txtEyeAdd2)) |
| 758 |
{ |
| 759 |
//現在何も処理なし |
| 760 |
} |
| 761 |
} |
| 762 |
|
| 763 |
private void btnSelectEyeAdd3_Click(object sender, EventArgs e) |
| 764 |
{ |
| 765 |
if (btnSelectGraphic("目手動3", btnSelectEyeAdd3, txtEyeAdd3)) |
| 766 |
{ |
| 767 |
//現在何も処理なし |
| 768 |
} |
| 769 |
} |
| 770 |
|
| 771 |
private void btnSelectEyeAdd4_Click(object sender, EventArgs e) |
| 772 |
{ |
| 773 |
if (btnSelectGraphic("目手動4", btnSelectEyeAdd4, txtEyeAdd4)) |
| 774 |
{ |
| 775 |
//現在何も処理なし |
| 776 |
} |
| 777 |
} |
| 778 |
|
| 779 |
private void btnSelectEyeAdd5_Click(object sender, EventArgs e) |
| 780 |
{ |
| 781 |
if (btnSelectGraphic("目手動5", btnSelectEyeAdd5, txtEyeAdd5)) |
| 782 |
{ |
| 783 |
//現在何も処理なし |
| 784 |
} |
| 785 |
} |
| 786 |
|
| 787 |
private void btnSelectEyeAdd6_Click(object sender, EventArgs e) |
| 788 |
{ |
| 789 |
if (btnSelectGraphic("目手動6", btnSelectEyeAdd6, txtEyeAdd6)) |
| 790 |
{ |
| 791 |
//現在何も処理なし |
| 792 |
} |
| 793 |
} |
| 794 |
|
| 795 |
private void btnSelectMouthAdd1_Click(object sender, EventArgs e) |
| 796 |
{ |
| 797 |
if (btnSelectGraphic("口手動1", btnSelectMouthAdd1, txtMouthAdd1)) |
| 798 |
{ |
| 799 |
//現在何も処理なし |
| 800 |
} |
| 801 |
} |
| 802 |
|
| 803 |
private void btnSelectMouthAdd2_Click(object sender, EventArgs e) |
| 804 |
{ |
| 805 |
if (btnSelectGraphic("口手動2", btnSelectMouthAdd2, txtMouthAdd2)) |
| 806 |
{ |
| 807 |
//現在何も処理なし |
| 808 |
} |
| 809 |
} |
| 810 |
|
| 811 |
private void btnSelectMouthAdd3_Click(object sender, EventArgs e) |
| 812 |
{ |
| 813 |
if (btnSelectGraphic("口手動3", btnSelectMouthAdd3, txtMouthAdd3)) |
| 814 |
{ |
| 815 |
//現在何も処理なし |
| 816 |
} |
| 817 |
} |
| 818 |
|
| 819 |
private void btnSelectMouthAdd4_Click(object sender, EventArgs e) |
| 820 |
{ |
| 821 |
if (btnSelectGraphic("口手動4", btnSelectMouthAdd4, txtMouthAdd4)) |
| 822 |
{ |
| 823 |
//現在何も処理なし |
| 824 |
} |
| 825 |
} |
| 826 |
|
| 827 |
private void btnSelectMouthAdd5_Click(object sender, EventArgs e) |
| 828 |
{ |
| 829 |
if (btnSelectGraphic("口手動5", btnSelectMouthAdd5, txtMouthAdd5)) |
| 830 |
{ |
| 831 |
//現在何も処理なし |
| 832 |
} |
| 833 |
} |
| 834 |
|
| 835 |
private void btnSelectMouthAdd6_Click(object sender, EventArgs e) |
| 836 |
{ |
| 837 |
if (btnSelectGraphic("口手動6", btnSelectMouthAdd6, txtMouthAdd6)) |
| 838 |
{ |
| 839 |
//現在何も処理なし |
| 840 |
} |
| 841 |
} |
| 842 |
#endregion |
| 843 |
|
| 844 |
#region "テキストボックスを変更したときの処理" |
| 845 |
private void txtBoxCommon_TextChanged(object sender, EventArgs e) |
| 846 |
{ |
| 847 |
flgNotSave = true; //変更後保存していない:true |
| 848 |
TextBox txtBox = (TextBox)sender; |
| 849 |
if (txtBox.ReadOnly == true) |
| 850 |
{ |
| 851 |
txtBox.BackColor = SystemColors.Control; |
| 852 |
} |
| 853 |
else |
| 854 |
{ |
| 855 |
txtBox.BackColor = SystemColors.Window; |
| 856 |
} |
| 857 |
} |
| 858 |
|
| 859 |
#endregion |
| 860 |
|
| 861 |
#region "画像削除ボタンをクリックしたときの処理" |
| 862 |
private void btnDelEyeAdd1_Click(object sender, EventArgs e) |
| 863 |
{ |
| 864 |
txtEyeAdd1.Text = ""; |
| 865 |
} |
| 866 |
|
| 867 |
private void btnDelEyeAdd2_Click(object sender, EventArgs e) |
| 868 |
{ |
| 869 |
txtEyeAdd2.Text = ""; |
| 870 |
} |
| 871 |
|
| 872 |
private void btnDelEyeAdd3_Click(object sender, EventArgs e) |
| 873 |
{ |
| 874 |
txtEyeAdd3.Text = ""; |
| 875 |
} |
| 876 |
|
| 877 |
private void btnDelEyeAdd4_Click(object sender, EventArgs e) |
| 878 |
{ |
| 879 |
txtEyeAdd4.Text = ""; |
| 880 |
} |
| 881 |
|
| 882 |
private void btnDelEyeAdd5_Click(object sender, EventArgs e) |
| 883 |
{ |
| 884 |
txtEyeAdd5.Text = ""; |
| 885 |
} |
| 886 |
|
| 887 |
private void btnDelEyeAdd6_Click(object sender, EventArgs e) |
| 888 |
{ |
| 889 |
txtEyeAdd6.Text = ""; |
| 890 |
} |
| 891 |
|
| 892 |
private void btnDelMouthAdd1_Click(object sender, EventArgs e) |
| 893 |
{ |
| 894 |
txtMouthAdd1.Text = ""; |
| 895 |
} |
| 896 |
|
| 897 |
private void btnDelMouthAdd2_Click(object sender, EventArgs e) |
| 898 |
{ |
| 899 |
txtMouthAdd2.Text = ""; |
| 900 |
} |
| 901 |
|
| 902 |
private void btnDelMouthAdd3_Click(object sender, EventArgs e) |
| 903 |
{ |
| 904 |
txtMouthAdd3.Text = ""; |
| 905 |
} |
| 906 |
|
| 907 |
private void btnDelMouthAdd4_Click(object sender, EventArgs e) |
| 908 |
{ |
| 909 |
txtMouthAdd4.Text = ""; |
| 910 |
} |
| 911 |
|
| 912 |
private void btnDelMouthAdd5_Click(object sender, EventArgs e) |
| 913 |
{ |
| 914 |
txtMouthAdd5.Text = ""; |
| 915 |
} |
| 916 |
|
| 917 |
private void btnDelMouthAdd6_Click(object sender, EventArgs e) |
| 918 |
{ |
| 919 |
txtMouthAdd6.Text = ""; |
| 920 |
} |
| 921 |
#endregion |
| 922 |
|
| 923 |
private void tabGroup_Click(object sender, EventArgs e) |
| 924 |
{ |
| 925 |
switch (tabGroup.SelectedIndex) |
| 926 |
{ |
| 927 |
case 1: |
| 928 |
break; |
| 929 |
case 2: |
| 930 |
break; |
| 931 |
case 3: |
| 932 |
break; |
| 933 |
case 4: |
| 934 |
break; |
| 935 |
} |
| 936 |
} |
| 937 |
} |
| 938 |
} |