2 using System.Collections.Generic;
3 using System.Globalization;
4 using System.Threading;
5 using System.Windows.Forms;
7 using System.ComponentModel;
10 using System.Diagnostics;
11 using System.Xml.Serialization;
12 using DTXCreator.チップパレット関連;
14 using DTXCreator.WAV_BMP_AVI;
15 using DTXCreator.UndoRedo;
16 using DTXCreator.オプション関連;
17 using DTXCreator.MIDIインポート;
18 using DTXCreator.MIDIExport;
20 using DTXCreator.Properties;
25 public partial class Cメインフォーム : Form
33 this.InitializeComponent();
44 public AppSetting appアプリ設定;
45 public Cチップパレット dlgチップパレット;
46 private Cオプション管理 mgrオプション管理者 = null;
47 private C選択モード管理 mgr選択モード管理者 = null;
48 internal C編集モード管理 mgr編集モード管理者 = null;
49 internal C譜面管理 mgr譜面管理者 = null;
50 internal CWAVリスト管理 mgrWAVリスト管理者 = null;
51 internal CBMPリスト管理 mgrBMPリスト管理者 = null;
52 internal CAVIリスト管理 mgrAVIリスト管理者 = null;
53 internal CUndoRedo管理 mgrUndoRedo管理者 = null;
54 internal Cクリップボード cbクリップボード = null;
55 private CMIDIインポート管理 mgrMIDIインポート管理者 = null;
56 private CMIDIExportManager mgrMIDIExportManager = null;
58 internal MakeTempDTX makeTempDTX = null;
64 if( this.toolStripButton選択モード.CheckState != CheckState.Checked )
75 if( this.toolStripButton編集モード.CheckState != CheckState.Checked )
82 public decimal dc現在のBPM
86 return this.numericUpDownBPM.Value;
89 internal int n現在選択中のWAV_BMP_AVIリストの行番号0to1294;
92 /// DTXC.exe のあるフォルダの絶対パス。
94 public string strDTXCのあるフォルダ名;
97 /// 各種ファイル(WAVなど)の相対パスの基点となるフォルダの絶対パス。
99 public string str作業フォルダ名;
102 /// 現在作成中のDTXファイル名。パスは含まない。(例:"test.dtx")
104 public string strDTXファイル名;
107 /// <para>未保存の場合にtrueとなり、ウィンドウタイトルに[*]が加えられる。</para>
119 if( this._b未保存 != value )
121 this._b未保存 = value; // #24133 2011.1.14 yyagi: 「代入後にif文分岐」するよう、代入を頭に移動。
125 string strタイトル = Resources.strデフォルトウィンドウタイトル;
127 if( this.strDTXファイル名.Length > 0 )
128 strタイトル = this.strDTXファイル名;
135 // 変更ありかつ未保存なら「*」を付ける
136 if (COS.bIsWin10OrLater(COS.WIN10BUILD._19H1)) // Win10 19H1以降のお作法は、タイトルバーの頭に*を表示
138 this.Text = "*DTXC [" + strタイトル + "]";
142 this.Text = "DTXC* [" + strタイトル + "]";
144 this.toolStripMenuItem上書き保存.Enabled = true;
145 this.toolStripButton上書き保存.Enabled = true;
151 this.Text = "DTXC [" + strタイトル + "]";
152 this.toolStripMenuItem上書き保存.Enabled = false;
153 this.toolStripButton上書き保存.Enabled = false;
160 /// 最後にMIDIを読み込んだフォルダ
162 public string strMIDIインポートフォルダ;
165 /// 最後に読み込まれたMIDIインポート設定ファイル
167 public string strMIDIインポート設定ファイル;
175 #region [ アプリの起動・初期化、終了 ]
177 private void tアプリ起動時に一度だけ行う初期化処理()
181 #region [ アプリ設定オブジェクトを生成する。]
183 this.appアプリ設定 = new AppSetting();
187 #region [ DTXCreator.exe の存在するフォルダを取得する。 ]
189 this.strDTXCのあるフォルダ名 = Directory.GetCurrentDirectory() + @"\";
192 #region [ 作業フォルダを取得する。]
194 this.str作業フォルダ名 = this.strDTXCのあるフォルダ名;
198 #region [ デザイナで設定できないイベントを実装する。]
200 this.splitContainerタブと譜面を分割.MouseWheel += new MouseEventHandler( this.splitContainerタブと譜面を分割_MouseWheel );
204 #region [ 全体を通して必要な管理者オブジェクトを生成する。]
206 this.mgrオプション管理者 = new Cオプション管理( this );
207 this.mgrMIDIインポート管理者 = new CMIDIインポート管理(this);
208 this.mgrMIDIExportManager = new CMIDIExportManager(this);
212 #region [ クリップボードオブジェクトを生成する。 ]
214 this.cbクリップボード = new Cクリップボード( this );
218 #region [ Viewer再生用一時DTX生成オブジェクトを生成する。 ]
219 makeTempDTX = new MakeTempDTX();
228 #region [ アプリ設定ファイル (DTXCreatorSetting.config) を読み込む。]
230 this.tアプリ設定の読み込み(); // 譜面の生成後に行うこと。(GUIイベント発生時にmgr各種が使われるため。)
234 #region [ チップパレットウィンドウの初期位置を変更する。(読み込んだアプリ設定に合わせる。)]
236 this.dlgチップパレット.Left = this.Left + ( ( this.Width - this.dlgチップパレット.Width ) / 2 );
237 this.dlgチップパレット.Top = this.Top + ( ( this.Height - this.dlgチップパレット.Height ) / 2 );
241 #region [ [ファイル]メニューに、最近使ったファイルを追加する。]
243 this.t最近使ったファイルをFileメニューへ追加する();
250 #region [ コマンドライン引数にファイルの指定があるならそれを開く。 ]
252 string[] commandLineArgs = Environment.GetCommandLineArgs();
253 if ((commandLineArgs.Length > 1) && File.Exists(commandLineArgs[1]))
255 this.t演奏ファイルを開いて読み込む(commandLineArgs[1]);
261 #region [ 設定で「最後に編集していたファイルを、DTXC起動時に読み込む」ようにしていたならそれを開く。 ]
263 if (this.appアプリ設定.RecentFilesNum > 0 && this.appアプリ設定.StartupMode == true)
265 this.t演奏ファイルを開いて読み込む(this.appアプリ設定.RecentUsedFile[0]);
270 private void tアプリ終了時に行う終了処理()
272 #region [ アプリ設定ファイル (DTXCreatorSetting.config) を保存する。]
278 #region [ 各管理者で必要な終了処理を行う。]
280 this.mgrWAVリスト管理者.tDirectSoundの解放();
284 #region [ Viewer再生用一時DTX生成オブジェクトの終了処理を行う。 ]
285 makeTempDTX.Dispose();
289 private void tアプリ設定の読み込み()
292 this.strDTXCのあるフォルダ名 + @"DTXCreatorSetting.config";
297 #region [ アプリ設定ファイルを読み込む。 → 失敗したら内容リセットして継続する。]
299 if( File.Exists( str設定ファイル名 ) )
303 // アプリ設定ファイル(XML形式)を this.appアプリ設定 に読み込む。
305 var serializer = new XmlSerializer( typeof( AppSetting ) );
306 var stream = new FileStream( str設定ファイル名, FileMode.Open );
307 this.appアプリ設定 = (AppSetting) serializer.Deserialize( stream );
312 // 失敗時:内容をリセットして継続する。
314 this.appアプリ設定 = new AppSetting();
318 // 反復要素とか足りなかったりしてもリセットする。
320 if( this.appアプリ設定.SoundListColumnWidth.Length != 5
321 || this.appアプリ設定.GraphicListColumnWidth.Length != 4
322 || this.appアプリ設定.MovieListColumnWidth.Length != 3
323 || !this.appアプリ設定.bSameVersion() )
325 this.appアプリ設定 = new AppSetting();
331 this.appアプリ設定.Confirm();
337 // 読み込んだアプリ設定を DTXCreator に反映する。
339 #region [ ウィンドウの位置とサイズ ]
341 #region [ ウインドウが画面外に表示されようとしている場合は、左上にウインドウを強制的に移動する ]
342 int h = System.Windows.Forms.Screen.GetBounds( this ).Height;
343 int w = System.Windows.Forms.Screen.GetBounds( this ).Width;
344 if (this.appアプリ設定.X > w || this.appアプリ設定.Y > h)
346 this.appアプリ設定.X = this.appアプリ設定.Y = 0;
349 this.SetDesktopBounds( this.appアプリ設定.X, this.appアプリ設定.Y, this.appアプリ設定.Width, this.appアプリ設定.Height );
354 if( this.appアプリ設定.Maximized )
355 this.WindowState = FormWindowState.Maximized;
358 #region [ タブ(左側)と譜面(右側)の表示幅の割合 ]
360 this.splitContainerタブと譜面を分割.SplitterDistance =
361 this.appアプリ設定.SplitterDistance;
364 #region [ WAV・BMP・AVIリストの各列の幅 ]
366 for( int i = 0; i < 5; i++ )
367 this.listViewWAVリスト.Columns[ i ].Width = this.appアプリ設定.SoundListColumnWidth[ i ];
369 for( int i = 0; i < 4; i++ )
370 this.listViewBMPリスト.Columns[ i ].Width = this.appアプリ設定.GraphicListColumnWidth[ i ];
372 for( int i = 0; i < 3; i++ )
373 this.listViewAVIリスト.Columns[ i ].Width = this.appアプリ設定.MovieListColumnWidth[ i ];
378 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
379 this.toolStripComboBox譜面拡大率.SelectedIndex =
380 this.appアプリ設定.HViewScaleIndex;
385 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
386 this.toolStripComboBoxガイド間隔.SelectedIndex =
387 this.appアプリ設定.GuideIndex;
392 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
393 this.toolStripComboBox演奏速度.SelectedIndex = 5;
399 this.appアプリ設定.LastWorkFolder;
401 if( Directory.Exists( this.str作業フォルダ名 ) )
403 //Directory.SetCurrentDirectory( this.str作業フォルダ名 ); // #35399: 2015/8/15 カレントディレクトリを変更すると、.NET4以降用にbuildしたDTXMania本体での再生に失敗するため、カレントディレクトリの変更を中止する
404 // #35399: ただし作業フォルダは維持する(書き設定行は不要だが、if分岐は残す必要あり)
405 // this.str作業フォルダ名 = this.appアプリ設定.LastWorkFolder;
409 // 作業フォルダが既になくなってる場合はカレントフォルダを適用。
411 this.str作業フォルダ名 = Directory.GetCurrentDirectory();
415 #region [ レーン表示/非表示の反映 #26005 2011.8.29 yyagi; added ]
416 for ( int i = 0; i < this.appアプリ設定.LanesInfo.Count; i++ )
418 for ( int j = 0; j < this.mgr譜面管理者.listレーン.Count; j++ )
420 if ( this.mgr譜面管理者.listレーン[ j ].strレーン名 == this.appアプリ設定.LanesInfo[ i ].Name )
422 this.mgr譜面管理者.listレーン[ j ].bIsVisible = this.appアプリ設定.LanesInfo[ i ].Checked;
427 this.mgr譜面管理者.tRefreshDisplayLanes();
429 #region [ 選択モード/編集モードの設定 ]
430 if ( this.appアプリ設定.InitialOperationMode )
439 #region [ MIDIインポートフォルダ関連 ]
441 this.strMIDIインポートフォルダ = this.appアプリ設定.LastMIDIImportFolder;
443 if( ! Directory.Exists( this.strMIDIインポートフォルダ ) )
444 this.strMIDIインポートフォルダ = Directory.GetCurrentDirectory();
447 this.strMIDIインポート設定ファイル = this.appアプリ設定.LastMIDIImportSettingsFile;
449 if( ! File.Exists( this.strMIDIインポート設定ファイル ) ) this.strMIDIインポート設定ファイル = Directory.GetCurrentDirectory() + @"\" + "DTXCreatorSMFSettings.xml";
454 private void tアプリ設定の保存()
457 this.strDTXCのあるフォルダ名 + @"DTXCreatorSetting.config";
460 // DTXCreator から保存すべきアプリ設定を取得する。
462 #region [ #23729 2010.11.22 yyagi: to get DTXC's x, y, width & height correctly, set windowstate "normal" if it is "minimized." ]
463 if (this.WindowState == FormWindowState.Minimized)
465 this.WindowState = FormWindowState.Normal;
468 #region [ ウィンドウの位置とサイズ ]
470 this.appアプリ設定.X = this.Location.X;
471 this.appアプリ設定.Y = this.Location.Y;
472 this.appアプリ設定.Width = this.Width;
473 this.appアプリ設定.Height = this.Height;
478 this.appアプリ設定.Maximized =
479 ( this.WindowState == FormWindowState.Maximized ) ? true : false;
482 #region [ タブ(左側)と譜面(右側)の表示幅の割合 ]
484 this.appアプリ設定.SplitterDistance =
485 this.splitContainerタブと譜面を分割.SplitterDistance;
488 #region [ WAV・BMP・AVIリストの各列の幅 ]
490 for( int i = 0; i < 5; i++ )
491 this.appアプリ設定.SoundListColumnWidth[ i ] = this.listViewWAVリスト.Columns[ i ].Width;
493 for( int i = 0; i < 4; i++ )
494 this.appアプリ設定.GraphicListColumnWidth[ i ] = this.listViewBMPリスト.Columns[ i ].Width;
496 for( int i = 0; i < 3; i++ )
497 this.appアプリ設定.MovieListColumnWidth[ i ] = this.listViewAVIリスト.Columns[ i ].Width;
502 this.appアプリ設定.HViewScaleIndex =
503 this.toolStripComboBox譜面拡大率.SelectedIndex;
508 this.appアプリ設定.GuideIndex =
509 this.toolStripComboBoxガイド間隔.SelectedIndex;
514 this.appアプリ設定.LastWorkFolder =
518 #region [ レーン表示/非表示 #26005 2011.8.29 yyagi; added ]
519 this.appアプリ設定.LanesInfo.Clear();
520 foreach ( DTXCreator.譜面.Cレーン c in this.mgr譜面管理者.listレーン )
522 this.appアプリ設定.AddLanesInfo( c.strレーン名, c.bIsVisible );
525 #region [ MIDIインポートフォルダ関連 ]
527 this.appアプリ設定.LastMIDIImportFolder = this.strMIDIインポートフォルダ;
528 this.appアプリ設定.LastMIDIImportSettingsFile = this.strMIDIインポート設定ファイル;
534 #region [ アプリ設定をXML形式ファイルで出力する。 ]
536 var serializer = new XmlSerializer( typeof( AppSetting ) );
537 using ( var stream = new FileStream( str設定ファイル名, FileMode.Create ) ) // #33204 2014.2.13 yyagi usingを使って、エラー発生時のファイルロックを回避
539 serializer.Serialize( (Stream) stream, this.appアプリ設定 );
548 public void tシナリオ_新規作成()
552 #region [ 未保存なら保存する。→ キャンセルされた場合はここで中断。]
554 if( this.t未保存なら保存する() == DialogResult.Cancel )
562 #region [「初期化中です」ポップアップを表示する。]
564 this.dlgチップパレット.t一時的に隠蔽する();
567 = new Cメッセージポップアップ( Resources.str初期化中ですMSG + Environment.NewLine + Resources.strしばらくお待ち下さいMSG );
576 #region [「初期化中です」ポップアップを閉じる。]
579 this.dlgチップパレット.t一時的な隠蔽を解除する();
581 this.Refresh(); // リスト内容等を消すために再描画
585 private void t譜面を初期化する()
587 this.strDTXファイル名 = "";
591 #region [ 基本情報タブの初期化 ]
593 CUndoRedo管理.bUndoRedoした直後 = true; this.textBox曲名.Clear();
594 CUndoRedo管理.bUndoRedoした直後 = true; this.textBox製作者.Clear();
595 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxGenre.Clear();
596 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxコメント.Clear();
597 CUndoRedo管理.bUndoRedoした直後 = true; this.numericUpDownBPM.Value = 120.0M;
598 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxDLEVEL.Text = "50";
599 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxGLEVEL.Text = "0";
600 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxBLEVEL.Text = "0";
601 CUndoRedo管理.bUndoRedoした直後 = true; this.hScrollBarDLEVEL.Value = 50;
602 CUndoRedo管理.bUndoRedoした直後 = true; this.hScrollBarGLEVEL.Value = 0;
603 CUndoRedo管理.bUndoRedoした直後 = true; this.hScrollBarBLEVEL.Value = 0;
604 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxパネル.Clear();
605 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxPREVIEW.Clear();
606 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxPREIMAGE.Clear();
607 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxSTAGEFILE.Clear();
608 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxBACKGROUND.Clear();
609 CUndoRedo管理.bUndoRedoした直後 = true; this.textBoxRESULTIMAGE.Clear();
610 CUndoRedo管理.bUndoRedoした直後 = true; this.check556x710BGAAVI.Checked = false;
614 #region [ WAVタブ・BMPタブ・AVIタブの初期化 ]
616 this.listViewWAVリスト.Items.Clear();
617 this.mgrWAVリスト管理者 = new CWAVリスト管理( this, this.listViewWAVリスト );
619 this.listViewBMPリスト.Items.Clear();
620 this.mgrBMPリスト管理者 = new CBMPリスト管理( this, this.listViewBMPリスト );
622 this.listViewAVIリスト.Items.Clear();
623 this.mgrAVIリスト管理者 = new CAVIリスト管理( this, this.listViewAVIリスト );
625 this.tWAV_BMP_AVIリストのカーソルを全部同じ行に合わせる( 0 );
629 #region [ 自由入力タブの初期化 ]
631 CUndoRedo管理.bUndoRedoした直後 = true; this.textBox自由入力欄.Clear();
635 #region [ チップパレットの初期化 ]
637 if( this.dlgチップパレット != null )
638 this.dlgチップパレット.Close();
640 this.dlgチップパレット = new Cチップパレット( this );
641 this.dlgチップパレット.Left = this.Left + ( this.Width - this.dlgチップパレット.Width ) / 2;
642 this.dlgチップパレット.Top = this.Top + ( this.Height - this.dlgチップパレット.Height ) / 2;
643 this.dlgチップパレット.Owner = this;
645 if( this.toolStripButtonチップパレット.CheckState == CheckState.Checked )
646 this.dlgチップパレット.t表示する();
650 #region [ 譜面の生成・初期化 ]
652 if ( this.mgr譜面管理者 == null ) // 初回起動時は、レーン表示有無の構成に初期値を使用(して、後でDTXCreatorConfig.settingsのものに置き換える)
654 this.mgr譜面管理者 = new C譜面管理( this );
655 this.mgr譜面管理者.t初期化();
657 else // 起動後のdtxファイル読み込み等の場合は、直前のレーン表示有無の構成を踏襲する
659 #region [ レーン表示/非表示状態の待避 #26005 2011.8.30 yyagi; added ]
660 List<Cレーン> lc = new List<Cレーン>(this.mgr譜面管理者.listレーン);
663 this.mgr譜面管理者 = new C譜面管理( this );
664 this.mgr譜面管理者.t初期化();
666 #region [ レーン表示/非表示の反映 #26005 2011.8.30 yyagi; added ]
667 for ( int i = 0; i < this.mgr譜面管理者.listレーン.Count; i++ )
669 this.mgr譜面管理者.listレーン[ i ].bIsVisible = lc[ i ].bIsVisible;
671 this.mgr譜面管理者.tRefreshDisplayLanes();
677 #region [ DTXViewer 関連 GUI の初期化 ]
679 this.tDTXV演奏関連のボタンとメニューのEnabledの設定();
683 #region [ ガイド間隔の初期値を設定する。]
685 this.tガイド間隔を変更する( 16 );
692 #region [ Undo/Redoリストのリセット ]
694 this.mgrUndoRedo管理者 = new CUndoRedo管理();
696 CUndoRedo管理.bUndoRedoした直後 = false;
697 this.tUndoRedo用GUIの有効無効を設定する();
701 #region [ 「2大モード」の管理者を生成、初期モードは、設定値から取得する・・・が、起動時は譜面生成後に設定値を読みだすので、設定値読み出し後に再設定すること。。]
703 this.mgr選択モード管理者 = new C選択モード管理( this );
704 this.mgr編集モード管理者 = new C編集モード管理( this );
706 if ( this.appアプリ設定.InitialOperationMode )
718 // 上記のプロパティ変更操作により未保存フラグがtrueになってしまってるので、元に戻す。
720 #region [ 未保存フラグをクリアする。]
725 #region [ 再生制御用フラグを立てる。(DTXVに必ずリロードさせるため) ]
727 this.bDTXファイルを開いた = true;
735 private void tシナリオ_開く()
739 #region [ 未保存なら保存する。→ キャンセルされた場合はここで中断。]
741 if( this.t未保存なら保存する() == DialogResult.Cancel )
749 #region [ 「ファイルを開く」ダイアログでファイルを選択する。 ]
751 this.dlgチップパレット.t一時的に隠蔽する();
753 OpenFileDialog dialog = new OpenFileDialog();
754 dialog.Title = Resources.strDTXファイル選択ダイアログのタイトル;
755 dialog.Filter = Resources.strDTXファイル選択ダイアログのフィルタ;
756 dialog.FilterIndex = 1;
757 dialog.InitialDirectory = this.str作業フォルダ名;
758 DialogResult result = dialog.ShowDialog();
760 this.dlgチップパレット.t一時的な隠蔽を解除する();
761 this.Refresh(); // メインフォームを再描画してダイアログを完全に消す
763 if( result != DialogResult.OK )
771 #region [ ファイルを読み込む。]
773 this.t演奏ファイルを開いて読み込む( dialog.FileName );
777 private void tシナリオ_DragDropされたファイルを開く( string[] DropFiles )
781 #region [ Dropされたファイルが複数個ある → 先頭のファイルだけを有効とする。 ]
783 string strファイル名 = DropFiles[ 0 ];
790 #region [ 未保存なら保存する。→ キャンセルされた場合はここで中断。]
792 if( this.t未保存なら保存する() == DialogResult.Cancel )
798 // Drop されたファイルを読み込む。
800 #region [ ファイルを読み込む。]
802 string strExt = Path.GetExtension( strファイル名 ).ToLower();
804 if ( strExt.Equals(".dtx") || strExt.Equals(".gda") || strExt.Equals(".g2d") || strExt.Equals(".bms") || strExt.Equals(".bme") )
806 this.t演奏ファイルを開いて読み込む( strファイル名 );
808 else if (strExt.Equals(".smf") || strExt.Equals(".mid"))
810 this.mgrMIDIインポート管理者.tMIDIインポート管理を開く( strファイル名 );
811 this.mgr譜面管理者.tRefreshDisplayLanes(); // レーンの表示/非表示切り替えに備えて追加
816 Resources.strDTXファイルではありませんMSG,
817 Resources.str確認ダイアログのタイトル,
818 MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
825 private void t演奏ファイルを開いて読み込む( string strファイル名 )
829 #region [ ファイルの存在を確認する。なかったらその旨を表示して中断する。]
831 if( !File.Exists( strファイル名 ) )
834 Resources.strファイルが存在しませんMSG,
835 Resources.str確認ダイアログのタイトル,
836 MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1 );
843 #region [ 拡張子からデータ種別を判定する。]
846 CDTX入出力.E種別 e種別 = CDTX入出力.E種別.DTX;
848 string str拡張子 = Path.GetExtension( strファイル名 );
850 if( str拡張子.Equals( ".dtx", StringComparison.OrdinalIgnoreCase ) )
852 e種別 = CDTX入出力.E種別.DTX;
854 else if( str拡張子.Equals( ".gda", StringComparison.OrdinalIgnoreCase ) )
856 e種別 = CDTX入出力.E種別.GDA;
858 else if( str拡張子.Equals( ".g2d", StringComparison.OrdinalIgnoreCase ) )
860 e種別 = CDTX入出力.E種別.G2D;
862 else if( str拡張子.Equals( ".bms", StringComparison.OrdinalIgnoreCase ) )
864 e種別 = CDTX入出力.E種別.BMS;
866 else if( str拡張子.Equals( ".bme", StringComparison.OrdinalIgnoreCase ) )
868 e種別 = CDTX入出力.E種別.BME;
873 Resources.strDTXファイルではありませんMSG,
874 Resources.str確認ダイアログのタイトル,
875 MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
882 this.dlgチップパレット.t一時的に隠蔽する();
884 #region [「読み込み中です」ポップアップを表示する。]
887 = new Cメッセージポップアップ( Resources.str読み込み中ですMSG + Environment.NewLine + Resources.strしばらくお待ち下さいMSG );
900 #region [ DTXファイルを読み込む。]
903 // 全部を1つの string として読み込む。
905 StreamReader reader = new StreamReader( strファイル名, Encoding.GetEncoding( 932/*Shift-JIS*/ ) );
906 string str全入力文字列 = reader.ReadToEnd();
910 // その string から DTX データを読み込む。
912 new CDTX入出力( this ).tDTX入力( e種別, ref str全入力文字列 );
915 // ファイル名、作業フォルダ名を更新する。
917 this.strDTXファイル名 = Path.ChangeExtension( Path.GetFileName( strファイル名 ), ".dtx" ); // 拡張子は強制的に .dtx に変更。
918 this.str作業フォルダ名 = Path.GetDirectoryName( strファイル名 ) + @"\"; // 読み込み後、カレントフォルダは、作業ファイルのあるフォルダに移動する。
919 // #35399: カレントディレクトリの変更はしない。.NET4以降でbuildしたDTXMania本体で再生できなくなるため。
923 #region [ 読み込んだファイルを [ファイル]メニューの最近使ったファイル一覧に追加する。]
925 this.appアプリ設定.AddRecentUsedFile( this.str作業フォルダ名 + this.strDTXファイル名 );
926 this.t最近使ったファイルをFileメニューへ追加する();
930 #region [ DTX以外を読み込んだ場合は、(DTXに変換されているので)最初から未保存フラグを立てる。]
932 if( e種別 != CDTX入出力.E種別.DTX )
938 #region [「読み込み中です」ポップアップを閉じる。 ]
941 this.Refresh(); // リスト内容等を消すために再描画する。
945 #region [ 未保存フラグをクリアする。]
947 this.b未保存 = true; // ウィンドウタイトルを書き換えるため、一度未保存フラグをtrueにして b未保存の setter を作動させる。
954 #region [ 上書き保存/名前をつけて保存 ]
956 private void tシナリオ_上書き保存()
961 this.dlgチップパレット.t一時的に隠蔽する();
963 #region [「保存中です」ポップアップを表示する。 ]
965 var msg = new Cメッセージポップアップ( Resources.str保存中ですMSG + Environment.NewLine + Resources.strしばらくお待ち下さいMSG );
972 #region [ ファイル名がない → 初めての保存と見なし、ファイル保存ダイアログで保存ファイル名を指定させる。 ]
974 if( string.IsNullOrEmpty( this.strDTXファイル名 ) )
978 string str絶対パスファイル名 = this.tファイル保存ダイアログを開いてファイル名を取得する();
980 if (string.IsNullOrEmpty(str絶対パスファイル名))
986 //this.str作業フォルダ名 = Directory.GetCurrentDirectory() + @"\"; // ダイアログでディレクトリを変更した場合、カレントディレクトリも変更されている。
987 this.str作業フォルダ名 = Path.GetDirectoryName(str絶対パスファイル名) + @"\";
988 this.strDTXファイル名 = Path.GetFileName(str絶対パスファイル名);
990 // WAV・BMP・AVIリストにあるすべてのファイル名を、作業フォルダに対する相対パスに変換する。
991 this.mgrWAVリスト管理者.tファイル名の相対パス化(this.str作業フォルダ名);
992 this.mgrBMPリスト管理者.tファイル名の相対パス化(this.str作業フォルダ名);
993 this.mgrAVIリスト管理者.tファイル名の相対パス化(this.str作業フォルダ名);
1003 #region [ 選択モードだったなら選択を解除する。]
1006 this.mgr選択モード管理者.t全チップの選択を解除する();
1010 #region [ DTXファイルを出力する。]
1012 var sw = new StreamWriter(this.str作業フォルダ名 + this.strDTXファイル名, false, Encoding.GetEncoding("utf-16"));
1013 new CDTX入出力(this).tDTX出力(sw);
1018 #region [ 出力したファイルのパスを、[ファイル]メニューの最近使ったファイル一覧に追加する。 ]
1020 this.appアプリ設定.AddRecentUsedFile(this.str作業フォルダ名 + this.strDTXファイル名);
1021 this.t最近使ったファイルをFileメニューへ追加する();
1025 #region [ Viewer用の一時ファイルを削除する (修正+保存、直後のViewer再生時に、直前の修正が反映されなくなることへの対応) ]
1026 tViewer用の一時ファイルを削除する();
1033 #region [「保存中です」ポップアップを閉じる。]
1036 this.Refresh(); // リスト内容等を消すために再描画する。
1040 this.dlgチップパレット.t一時的な隠蔽を解除する();
1042 private void tシナリオ_名前をつけて保存()
1046 #region [ ユーザに保存ファイル名を入力させる。]
1048 // ファイル保存ダイアログを表示し、出力するファイル名を指定させる。キャンセルされたらここで中断。
1050 string str絶対パスファイル名 = this.tファイル保存ダイアログを開いてファイル名を取得する();
1051 if( string.IsNullOrEmpty( str絶対パスファイル名 ) )
1057 //this.str作業フォルダ名 = Directory.GetCurrentDirectory() + @"\"; // ダイアログでディレクトリを変更した場合は、カレントディレクトリも変更されている。
1058 this.str作業フォルダ名 = Path.GetDirectoryName(str絶対パスファイル名) + @"\";
1059 this.strDTXファイル名 = Path.GetFileName( str絶対パスファイル名 );
1063 #region [ WAV・BMP・AVIリストにあるすべてのファイル名を、作業フォルダに対する相対パスに変換する。 ]
1065 this.mgrWAVリスト管理者.tファイル名の相対パス化( this.str作業フォルダ名 );
1066 this.mgrBMPリスト管理者.tファイル名の相対パス化( this.str作業フォルダ名 );
1067 this.mgrAVIリスト管理者.tファイル名の相対パス化( this.str作業フォルダ名 );
1079 this.b未保存 = true; // ウィンドウタイトルに表示されているファイル名を変更するため一度 true にする。
1082 private string tファイル保存ダイアログを開いてファイル名を取得する()
1086 this.dlgチップパレット.t一時的に隠蔽する();
1088 string _title = (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ja") ?
1089 "名前を付けて保存" : "Save As";
1091 string _filter = (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ja") ?
1092 "DTXファイル(*.dtx)|*.dtx" : "DTX file(*.dtx)|*.dtx";
1094 var dialog = new SaveFileDialog() {
1098 InitialDirectory = this.str作業フォルダ名
1100 DialogResult result = dialog.ShowDialog();
1102 this.dlgチップパレット.t一時的な隠蔽を解除する();
1110 // キャンセルされたら "" を返す。
1112 if( result != DialogResult.OK )
1116 // ファイルの拡張子を .dtx に変更。
1118 string fileName = dialog.FileName;
1119 if( Path.GetExtension( fileName ).Length == 0 )
1120 fileName = Path.ChangeExtension( fileName, ".dtx" );
1128 private void tシナリオ_終了()
1138 private void tシナリオ_検索()
1140 this.mgr選択モード管理者.t検索する(); // モードによらず、検索はすべて選択モード管理者が行う。
1142 private void tシナリオ_置換()
1144 this.mgr選択モード管理者.t置換する(); // モードによらず、置換はすべて選択モード管理者が行う。
1148 #region [ 小節長変更/小節の挿入/小節の削除 ]
1150 private void tシナリオ_小節長を変更する( C小節 cs )
1154 #region [ 小節長をユーザに入力させる。]
1157 // 小節長ダイアログを表示し、小節長を取得する。
1159 this.dlgチップパレット.t一時的に隠蔽する();
1161 var dlg = new C小節長変更ダイアログ( cs.n小節番号0to3599 );
1162 dlg.f倍率 = cs.f小節長倍率;
1165 this.dlgチップパレット.t一時的な隠蔽を解除する();
1169 if( dlg.ShowDialog() != DialogResult.OK )
1179 int n変更開始小節番号 = cs.n小節番号0to3599;
1180 int n変更終了小節番号 = ( dlg.b後続変更 ) ? this.mgr譜面管理者.n現在の最大の小節番号を返す() : cs.n小節番号0to3599;
1182 #region [ BEATレーンをすべてバックアップ(コピー)しておく。小節長変更でBEATチップが削除されると困るので。]
1183 int laneBEAT = this.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BEAT" );
1184 List<Cチップ> listBEATチップ = new List<Cチップ>();
1185 foreach ( KeyValuePair<int, C小節> pair in this.mgr譜面管理者.dic小節 )
1187 C小節 c小節 = pair.Value;
1188 for ( int index = 0; index < c小節.listチップ.Count; index++ )
1190 if ( c小節.listチップ[ index ].nレーン番号0to == laneBEAT )
1192 listBEATチップ.Add( c小節.listチップ[ index ] );
1198 #region [ 小節長変更を実行する ]
1199 for ( int n小節番号 = n変更開始小節番号; n小節番号 <= n変更終了小節番号; n小節番号++ )
1201 #region [ 指定した小節が存在しなければ、中断 ]
1202 C小節 c小節 = this.mgr譜面管理者.p小節を返す( n変更開始小節番号 );
1209 int n旧Grid数 = (int) ( c小節.f小節長倍率 * CWholeNoteDivision.n分解能 + 0.5 );
1210 int n新Grid数 = (int) ( dlg.f倍率 * CWholeNoteDivision.n分解能 + 0.5 );
1211 int nGrid増減 = n旧Grid数 - n新Grid数;
1213 this.t小節長を変更する_小節単位( n小節番号, dlg.f倍率 );
1215 // そして、Gridの増減があった分だけ、コピーしたBEATチップのGridを増減する
1216 int nGrid_BAR = this.mgr譜面管理者.n譜面先頭からみた小節先頭の位置gridを返す( n変更開始小節番号 );
1217 for ( int index = 0; index < listBEATチップ.Count; index++ )
1219 // Gridを増減するのは、小節長変更した小節以降のチップだけ。
1220 // 更に、小節長変更した小節上では、新しい小節長で溢れた分のチップだけGridを増減する。
1221 // (この条件で、Grid数が増えた場合も対応できている)
1223 ( n小節番号 > n変更開始小節番号 ) ||
1224 ( ( n小節番号 == n変更開始小節番号 ) && ( nGrid_BAR + n新Grid数 < listBEATチップ[ index ].n位置grid ) )
1227 Cチップ cc = new Cチップ();
1228 cc.tコピーfrom( listBEATチップ[ index ] );
1229 cc.n位置grid += nGrid増減;
1230 listBEATチップ[ index ] = cc;
1238 this.mgrUndoRedo管理者.tトランザクション記録を開始する();
1240 #region [ BEATレーンのチップを全削除する ]
1241 //this.mgr選択モード管理者.tレーン上の全チップを選択する( laneBEAT );
1243 foreach ( KeyValuePair<int, C小節> pair in this.mgr譜面管理者.dic小節 )
1245 C小節 c小節 = pair.Value;
1246 for( int i = 0; i < c小節.listチップ.Count; i++ )
1248 Cチップ cチップ = c小節.listチップ[ i ];
1250 if( cチップ.nレーン番号0to == laneBEAT )
1252 #region [ UndoRedo リストにこの操作(チップ削除)を記録する。]
1254 var cc = new Cチップ();
1255 cc.tコピーfrom( cチップ );
1257 var ur = new Cチップ配置用UndoRedo( c小節.n小節番号0to3599, cc );
1259 this.mgrUndoRedo管理者.tノードを追加する(
1260 new CUndoRedoセル<Cチップ配置用UndoRedo>(
1262 new DGUndoを実行する<Cチップ配置用UndoRedo>( this.mgr譜面管理者.tチップ削除のUndo ),
1263 new DGRedoを実行する<Cチップ配置用UndoRedo>( this.mgr譜面管理者.tチップ削除のRedo ),
1268 // チップを小節のチップリストから削除する。
1269 c小節.listチップ.RemoveAt( i );
1271 // リストが更新されたので、最初のチップから見直す。
1278 #region [ コピーしておいた(そして、nGridを更新した))BEATチップを、BEATレーンに戻す ]
1279 foreach ( Cチップ cチップ in listBEATチップ )
1281 this.mgr編集モード管理者.tBeatチップを配置する( cチップ.n位置grid, cチップ.n値_整数1to1295, cチップ.f値_浮動小数, cチップ.b裏 );
1287 this.mgrUndoRedo管理者.tトランザクション記録を終了する();
1288 listBEATチップ.Clear();
1292 this.tUndoRedo用GUIの有効無効を設定する();
1295 public void t小節長を変更する_小節単位( int n小節番号, float f倍率 )
1299 #region [ 小節番号から小節オブジェクトを取得する。→ 指定された小節が存在しない場合はここで中断。]
1302 C小節 c小節 = this.mgr譜面管理者.p小節を返す( n小節番号 );
1313 this.mgrUndoRedo管理者.tトランザクション記録を開始する();
1315 #region [ UndoRedo リストにこの操作(小節長変更)を記録する。 ]
1317 var ur変更前 = new C小節用UndoRedo( c小節.n小節番号0to3599, c小節.f小節長倍率 );
1318 var ur変更後 = new C小節用UndoRedo( c小節.n小節番号0to3599, f倍率 );
1320 this.mgrUndoRedo管理者.tノードを追加する(
1321 new CUndoRedoセル<C小節用UndoRedo>(
1323 new DGUndoを実行する<C小節用UndoRedo>( this.mgr譜面管理者.t小節長変更のUndo ),
1324 new DGRedoを実行する<C小節用UndoRedo>( this.mgr譜面管理者.t小節長変更のRedo ),
1332 #region [ 小節長倍率を変更する。]
1338 #region [ 小節からはみ出したチップを削除する。チップの削除操作は Undo/Redo に記録する。]
1341 for( int i = 0; i < c小節.listチップ.Count; i++ )
1343 Cチップ cチップ = c小節.listチップ[ i ];
1345 if( cチップ.n位置grid >= c小節.n小節長倍率を考慮した現在の小節の高さgrid )
1348 #region [ UndoRedo リストにこの操作(チップ削除)を記録する。]
1350 var cc = new Cチップ();
1351 cc.tコピーfrom( cチップ );
1353 var ur = new Cチップ配置用UndoRedo( c小節.n小節番号0to3599, cc );
1355 this.mgrUndoRedo管理者.tノードを追加する(
1356 new CUndoRedoセル<Cチップ配置用UndoRedo>(
1358 new DGUndoを実行する<Cチップ配置用UndoRedo>( this.mgr譜面管理者.tチップ削除のUndo ),
1359 new DGRedoを実行する<Cチップ配置用UndoRedo>( this.mgr譜面管理者.tチップ削除のRedo ),
1365 // チップを小節のチップリストから削除する。
1367 c小節.listチップ.RemoveAt( i );
1370 // リストが更新されたので、最初のチップから見直す。
1381 this.mgrUndoRedo管理者.tトランザクション記録を終了する();
1386 this.tUndoRedo用GUIの有効無効を設定する();
1388 private void tシナリオ_小節を挿入する( int n挿入位置の小節番号 )
1392 #region [ UndoRedo リストにこの操作(小節挿入)を記録する。]
1394 this.mgrUndoRedo管理者.tノードを追加する(
1395 new CUndoRedoセル<int>(
1397 new DGUndoを実行する<int>( this.mgr譜面管理者.t小節挿入のUndo ),
1398 new DGRedoを実行する<int>( this.mgr譜面管理者.t小節挿入のRedo ),
1399 n挿入位置の小節番号, n挿入位置の小節番号 ) );
1406 #region [ 挿入位置以降の小節を1つずつ後ろにずらす(小節番号を +1 していく)。 ]
1408 for( int i = this.mgr譜面管理者.n現在の最大の小節番号を返す(); i >= n挿入位置の小節番号; i-- )
1410 // ずらす小節オブジェクトを取得する。
1412 C小節 cずらす小節 = this.mgr譜面管理者.p小節を返す( i );
1413 if( cずらす小節 == null )
1419 this.mgr譜面管理者.dic小節.Remove( i ); // 小節番号は Dictionary のキー値であるため、番号が変われば再登録が必要。
1420 cずらす小節.n小節番号0to3599 = i + 1;
1421 this.mgr譜面管理者.dic小節.Add( cずらす小節.n小節番号0to3599, cずらす小節 );
1426 #region [ 新しい小節を作成し、譜面の持つ小節リストに追加する。 ]
1431 this.mgr譜面管理者.dic小節.Add( n挿入位置の小節番号, new C小節( n挿入位置の小節番号 ) );
1436 this.pictureBox譜面パネル.Refresh();
1444 this.tUndoRedo用GUIの有効無効を設定する();
1447 private void tシナリオ_小節を削除する( int n削除位置の小節番号 )
1451 this.mgrUndoRedo管理者.tトランザクション記録を開始する();
1456 #region [ 最大小節番号を取得する。]
1458 int n最大小節番号 = this.mgr譜面管理者.n現在の最大の小節番号を返す(); // 小節を削除すると数が変わるので、削除前に取得する。
1461 #region [ 削除する小節オブジェクトを取得する。]
1463 C小節 c削除する小節 = this.mgr譜面管理者.p小節を返す( n削除位置の小節番号 );
1467 #region [ その小節が持っているチップを全て削除する。チップの削除作業は、Undo/Redoリストに記録する。]
1470 while( c削除する小節.listチップ.Count > 0 )
1472 #region [ UndoRedo リストにこの操作(チップ削除)を記録する。]
1474 var cc = new Cチップ();
1475 cc.tコピーfrom( c削除する小節.listチップ[ 0 ] );
1476 var redo = new Cチップ配置用UndoRedo( c削除する小節.n小節番号0to3599, cc );
1478 this.mgrUndoRedo管理者.tノードを追加する(
1479 new CUndoRedoセル<Cチップ配置用UndoRedo>(
1481 new DGUndoを実行する<Cチップ配置用UndoRedo>( this.mgr譜面管理者.tチップ削除のUndo ),
1482 new DGRedoを実行する<Cチップ配置用UndoRedo>( this.mgr譜面管理者.tチップ削除のRedo ),
1489 c削除する小節.listチップ.RemoveAt( 0 );
1495 #region [ UndoRedo リストにこの操作(小節削除)を記録する。]
1497 this.mgrUndoRedo管理者.tノードを追加する(
1498 new CUndoRedoセル<int>(
1500 new DGUndoを実行する<int>( this.mgr譜面管理者.t小節削除のUndo ),
1501 new DGRedoを実行する<int>( this.mgr譜面管理者.t小節削除のRedo ),
1502 n削除位置の小節番号, n削除位置の小節番号 ) );
1505 #region [ 該当小節を譜面の小節リストから削除する。]
1507 this.mgr譜面管理者.dic小節.Remove( n削除位置の小節番号 );
1510 #region [ 削除した小節より後方にある小節を1つずつ前にずらす。(小節番号を -1 していく)]
1513 for( int i = n削除位置の小節番号 + 1; i <= n最大小節番号; i++ )
1517 C小節 cずらす小節 = this.mgr譜面管理者.p小節を返す( i );
1518 if( cずらす小節 == null )
1523 this.mgr譜面管理者.dic小節.Remove( i ); // 小節番号は Dictionary のキー値であるため、番号が変われば再登録が必要。
1524 cずらす小節.n小節番号0to3599--;
1525 this.mgr譜面管理者.dic小節.Add( cずらす小節.n小節番号0to3599, cずらす小節 );
1528 // 譜面内の小節が全部無くなったらさすがにまずいので、最低1個の小節は残す。
1530 if( this.mgr譜面管理者.dic小節.Count == 0 )
1531 this.mgr譜面管理者.dic小節.Add( 0, new C小節( 0 ) );
1539 this.mgrUndoRedo管理者.tトランザクション記録を終了する();
1544 this.tUndoRedo用GUIの有効無効を設定する();
1545 this.pictureBox譜面パネル.Refresh();
1550 #region [ 選択チップの切り取り/コピー/貼り付け/削除 ]
1552 private void tシナリオ_切り取り()
1556 #region [ 譜面にフォーカスが来てないなら何もしない。 ]
1558 if( !this.pictureBox譜面パネル.Focused )
1566 #region [ 切り取り = コピー + 削除 ]
1573 private void tシナリオ_コピー()
1577 #region [ 譜面にフォーカスが来てないなら何もしない。 ]
1579 if( !this.pictureBox譜面パネル.Focused )
1587 this.cbクリップボード.t現在選択されているチップをボードにコピーする();
1592 #region [ 画面を再描画する。]
1594 this.t選択チップの有無に応じて編集用GUIの有効無効を設定する();
1595 this.pictureBox譜面パネル.Refresh();
1599 private void tシナリオ_貼り付け( int n譜面先頭からの位置grid )
1603 #region [ 譜面にフォーカスが来てないなら何もしない。 ]
1605 if( !this.pictureBox譜面パネル.Focused )
1613 #region [ 貼り付け先の小節と貼り付け開始位置を取得する。]
1615 C小節 c小節 = this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( n譜面先頭からの位置grid );
1619 int n小節先頭からの位置grid =
1620 n譜面先頭からの位置grid - this.mgr譜面管理者.n譜面先頭からみた小節先頭の位置gridを返す( c小節.n小節番号0to3599 );
1624 #region [ クリップボードからチップを貼り付ける。]
1626 this.cbクリップボード.tチップを指定位置から貼り付ける( c小節, n小節先頭からの位置grid );
1633 #region [ 画面を再描画する。]
1635 this.t選択チップの有無に応じて編集用GUIの有効無効を設定する();
1636 this.pictureBox譜面パネル.Refresh();
1640 private void tシナリオ_削除()
1644 #region [ 譜面にフォーカスが来てないなら何もしない。 ]
1646 if( !this.pictureBox譜面パネル.Focused )
1654 this.mgrUndoRedo管理者.tトランザクション記録を開始する();
1659 #region [ 譜面が持つすべての小節について、選択されているチップがあれば削除する。]
1661 foreach( KeyValuePair<int, C小節> pair in this.mgr譜面管理者.dic小節 )
1663 C小節 c小節 = pair.Value;
1665 bool b削除されたチップがある = false;
1667 int laneBEAT = this.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BEAT" );
1668 List<int> list削除処理済BEAT_index = new List<int>();
1672 #region [ 小節の持つチップのうち、選択されているチップがあれば削除してループする。なくなったら抜ける。]
1677 // 小節が持つすべてのチップについて……
1678 foreach( Cチップ cチップ in c小節.listチップ )
1682 #region [ UndoRedo リストにこの操作(チップ削除)を記録する。]
1684 var cc = new Cチップ();
1685 cc.tコピーfrom( cチップ );
1686 var redo = new Cチップ配置用UndoRedo( c小節.n小節番号0to3599, cc );
1688 this.mgrUndoRedo管理者.tノードを追加する(
1689 new CUndoRedoセル<Cチップ配置用UndoRedo>(
1691 new DGUndoを実行する<Cチップ配置用UndoRedo>( this.mgr譜面管理者.tチップ削除のUndo ),
1692 new DGRedoを実行する<Cチップ配置用UndoRedo>( this.mgr譜面管理者.tチップ削除のRedo ),
1698 #region [ チップオブジェクトを削除する。ただしBEATオブジェクトは削除禁止。表裏を反転するだけ。]
1699 if ( cチップ.nレーン番号0to != laneBEAT )
1701 c小節.listチップ.Remove( cチップ );
1703 // フラグを設定してループする。(foreachのlistを更新しているため)
1704 b削除完了 = false; // まだ終わらんよ
1705 b削除されたチップがある = true;
1710 int p = c小節.listチップ.IndexOf( cチップ );
1711 if ( !list削除処理済BEAT_index.Contains( p ) ) // まだ裏表反転したことがないチップならば
1713 cチップ.nチャンネル番号00toFF = ( cチップ.b裏 ) ? 0xF3 : 0xF8; // 表裏反転
1715 c小節.listチップ[ p ] = cチップ;
1716 list削除処理済BEAT_index.Add( p );
1718 // フラグを設定してループする。(foreachのlistを更新しているため)
1719 b削除完了 = false; // まだ終わらんよ
1720 b削除されたチップがある = true;
1730 list削除処理済BEAT_index.Clear();
1731 list削除処理済BEAT_index = null;
1733 #region [ 1つでもチップを削除したなら、未保存フラグを立てる。 ]
1746 this.mgrUndoRedo管理者.tトランザクション記録を終了する();
1751 this.tUndoRedo用GUIの有効無効を設定する();
1752 this.t選択チップの有無に応じて編集用GUIの有効無効を設定する();
1753 this.pictureBox譜面パネル.Refresh();
1756 internal struct Cc小節cチップ総tick
1759 internal Cチップ pCチップ;
1760 internal long lTotalGrid;
1763 internal Cc小節cチップ総tick(in C小節 _pC小節, in Cチップ _pCチップ, long _lTotalGrid)
1767 lTotalGrid = _lTotalGrid;
1771 private void tシナリオ_等間隔に配置()
1773 #region [ 譜面にフォーカスが来てないなら何もしない。 ]
1775 if (!this.pictureBox譜面パネル.Focused)
1780 #region [ 譜面が持つすべての小節について、選択されているチップを走査しlist化する。]
1783 List<Cc小節cチップ総tick> listc小節cチップ数総tick = new List<Cc小節cチップ総tick>();
1785 foreach (KeyValuePair<int, C小節> pair in this.mgr譜面管理者.dic小節)
1787 C小節 c小節 = pair.Value;
1789 #region [ 小節の持つチップのうち、選択されているチップがあればlistにコピー(参照渡し)する。]
1791 foreach (Cチップ cチップ in c小節.listチップ)
1795 #region [ listにコピーする。]
1796 var cl = new Cc小節cチップ総tick(in c小節, in cチップ, this.mgr譜面管理者.n譜面先頭からみた小節先頭の位置gridを返す(c小節.n小節番号0to3599) + cチップ.n位置grid);
1797 listc小節cチップ数総tick.Add(cl);
1807 #region [ 選択されたチップの中で、uniqueなgridがいくつかあるか数える (念のためlistをlTotalGrid順でソートする) ]
1808 long lastTotalGrid = -1;
1809 int uniqueCount = 0;
1810 listc小節cチップ数総tick.Sort
1813 return (int)(a.lTotalGrid - b.lTotalGrid);
1816 foreach ( var c in listc小節cチップ数総tick)
1818 if (c.lTotalGrid != lastTotalGrid)
1821 lastTotalGrid = c.lTotalGrid;
1826 #region [ ユニークなgridが0,1,2個の場合は意味がないので抜ける]
1827 if (lastTotalGrid < 3)
1829 listc小節cチップ数総tick?.Clear();
1830 listc小節cチップ数総tick = null;
1836 #region [ ユニークなgridが3以上なら、最初と最後のチップのgrid差を測る ]
1837 long gridTotalDuration =
1838 listc小節cチップ数総tick[ listc小節cチップ数総tick.Count - 1].lTotalGrid -
1839 listc小節cチップ数総tick[0].lTotalGrid;
1843 #region [ grid差を(チップ数-1)で割り、等分割の間隔を求める ]
1844 float gridEachDuration = (float)gridTotalDuration / (uniqueCount - 1);
1847 #region [ 最初と最後以外のチップを等間隔になるよう再配置する (誤差が大きくならないように注意) ]
1849 this.mgr選択モード管理者.t移動開始処理(new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0));
1851 float newTotalGrid = listc小節cチップ数総tick[0].lTotalGrid;
1852 lastTotalGrid = listc小節cチップ数総tick[0].lTotalGrid;
1854 foreach (var c in listc小節cチップ数総tick)
1856 if (c.lTotalGrid != lastTotalGrid)
1858 lastTotalGrid = c.lTotalGrid;
1859 newTotalGrid += gridEachDuration;
1865 continue; // 最初のgridは再配置不要
1868 if (count2 >= uniqueCount) break; // 最後のgridも再配置不要のため、処理終了
1870 this.mgr選択モード管理者.tチップを縦に移動する(
1872 (int)(newTotalGrid - c.lTotalGrid),
1875 this.mgr選択モード管理者.t移動終了処理(new MouseEventArgs(MouseButtons.None, 0, 0, 0, 0));
1877 listc小節cチップ数総tick?.Clear();
1878 listc小節cチップ数総tick = null;
1882 #region [ 未保存フラグを立てる。 ]
1888 #region [ 画面を再描画する。]
1889 this.tUndoRedo用GUIの有効無効を設定する();
1890 this.t選択チップの有無に応じて編集用GUIの有効無効を設定する();
1891 this.pictureBox譜面パネル.Refresh();
1896 #region [ DTXViewer での再生・停止 ]
1898 private void tシナリオ_Viewerで最初から再生する()
1900 #region [ DTXViewer 用の一時ファイルを出力する。]
1902 this.tViewer用の一時ファイルを出力する( false, this.b未保存 | !this.b前回BGMありで再生した | this.b再生速度を変更した | this.bDTXファイルを開いた );
1903 this.b前回BGMありで再生した = true;
1907 #region [ 再生開始オプション引数に一時ファイルを指定して DTXViewer プロセスを起動する。]
1911 string strDTXViewerのパス = this.strDTXCのあるフォルダ名 + this.appアプリ設定.ViewerInfo.Path;
1913 #region [ DTXViewer が起動していなければ起動する。]
1915 // DTXManiaGR.exeはコンパクトモードで起動する必要があるため、「一旦起動してから再生オプションを渡す」やり方はやめる
1916 // Process.Start( strDTXViewerのパス ).WaitForInputIdle( 20 * 1000 ); // 起動完了まで最大20秒待つ
1920 #region [ 実行中の DTXViewer に再生オプションを渡す。 ]
1922 Process.Start( strDTXViewerのパス,
1923 this.appアプリ設定.ViewerInfo.PlaySoundOption + this.appアプリ設定.ViewerInfo.PlayStartOption + " " +
1924 "\"" + this.strViewer演奏用一時ファイル名 + "\""
1925 ).WaitForInputIdle( 20 * 1000 );
1931 #region [ 失敗ダイアログを表示する。]
1934 Resources.strプロセスの起動に失敗しましたMSG,
1935 Resources.strエラーダイアログのタイトル,
1936 MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
1943 private void tシナリオ_Viewerで現在位置から再生する()
1945 #region [ DTXViewer 用の一時ファイルを出力する。]
1947 this.tViewer用の一時ファイルを出力する( false, this.b未保存 | !this.b前回BGMありで再生した | this.b再生速度を変更した | this.bDTXファイルを開いた );
1948 this.b前回BGMありで再生した = true;
1954 string strDTXViewerのパス = this.strDTXCのあるフォルダ名 + this.appアプリ設定.ViewerInfo.Path;
1956 #region [ DTXViewer が起動していなければ起動する。]
1958 // DTXManiaGR.exeはコンパクトモードで起動する必要があるため、「一旦起動してから再生オプションを渡す」やり方はやめる
1959 // Process.Start( strDTXViewerのパス ).WaitForInputIdle( 20 * 1000 ); // 起動完了まで最大20秒待つ
1963 #region [ 実行中の DTXViewer に再生オプションを渡す。 ]
1967 this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( this.mgr譜面管理者.n現在の譜面表示下辺の譜面先頭からの位置grid );
1969 Process.Start( strDTXViewerのパス,
1970 this.appアプリ設定.ViewerInfo.PlaySoundOption + this.appアプリ設定.ViewerInfo.PlayStartFromOption + c小節.n小節番号0to3599 + " " +
1971 "\"" + this.strViewer演奏用一時ファイル名 + "\""
1972 ).WaitForInputIdle( 20 * 1000 );
1979 #region [ 失敗ダイアログを表示する。]
1982 Resources.strプロセスの起動に失敗しましたMSG,
1983 Resources.strエラーダイアログのタイトル,
1984 MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
1989 private void tシナリオ_Viewerで現在位置からBGMのみ再生する()
1991 #region [ DTXViewer 用の一時ファイルを出力する。]
1993 this.tViewer用の一時ファイルを出力する( true, this.b未保存 | this.b前回BGMありで再生した | this.b再生速度を変更した | this.bDTXファイルを開いた );
1994 this.b前回BGMありで再生した = false;
2000 string strDTXViewerのパス = this.strDTXCのあるフォルダ名 + this.appアプリ設定.ViewerInfo.Path;
2002 #region [ DTXViewer が起動していなければ起動する。]
2004 // DTXManiaGR.exeはコンパクトモードで起動する必要があるため、「一旦起動してから再生オプションを渡す」やり方はやめる
2005 // Process.Start( strDTXViewerのパス ).WaitForInputIdle( 20 * 1000 ); // 起動完了まで最大20秒待つ
2009 #region [ 実行中の DTXViewer に再生オプションを渡す。 ]
2011 C小節 c小節 = this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( this.mgr譜面管理者.n現在の譜面表示下辺の譜面先頭からの位置grid );
2012 Process.Start( strDTXViewerのパス,
2013 this.appアプリ設定.ViewerInfo.PlaySoundOption + this.appアプリ設定.ViewerInfo.PlayStartFromOption + c小節.n小節番号0to3599 + " " +
2014 "\"" + this.strViewer演奏用一時ファイル名 + "\""
2015 ).WaitForInputIdle( 20 * 1000 );
2021 #region [ 失敗ダイアログを表示する。]
2024 Resources.strプロセスの起動に失敗しましたMSG,
2025 Resources.strエラーダイアログのタイトル,
2026 MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
2031 private void tシナリオ_Viewerを再生停止する()
2035 string strViewerのパス = this.strDTXCのあるフォルダ名 + this.appアプリ設定.ViewerInfo.Path;
2037 #region [ 実行中の DTXViewer に再生停止オプションを渡す。 ]
2040 // 停止のときは1回のプロセス起動で完結(BMSV仕様)
2042 Process.Start( strViewerのパス, this.appアプリ設定.ViewerInfo.PlayStopOption );
2050 #region [ 失敗ダイアログを表示する。]
2053 Resources.strプロセスの起動に失敗しましたMSG,
2054 Resources.strエラーダイアログのタイトル,
2055 MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1 );
2061 private string strViewer演奏用一時ファイル名 = "";
2062 private void tViewer用の一時ファイルを出力する( bool bBGMのみ出力, bool b前回から更新があった )
2066 // 前回から更新がなければ(連続して再生ボタンを押した、など)、前回の生成ファイルをそのまま返す。
2067 // (初めての再生の場合は、tempファイル未生成のため、このまま生成フローを続ける。)
2068 if ( !b前回から更新があった && File.Exists( Path.Combine( this.mgr譜面管理者.strPATH_WAV, this.strViewer演奏用一時ファイル名 ) ) )
2075 bDTXファイルを開いた = false;
2077 //this.strViewer演奏用一時ファイル名 = Path.GetTempFileName(); //
2078 this.strViewer演奏用一時ファイル名 = makeTempDTX.GetTempFileName(); // #24746 2011.4.1 yyagi add; a countermeasure for temp-flooding
2082 this.mgr譜面管理者.strPATH_WAV = this.str作業フォルダ名;
2086 #region [ もし小数点にコンマを使うcultureなら、一時的に(小数点を使う)"en-GB"に切り替える。(DTXVはピリオドしか使えないため) ]
2087 string currentCultureEnglishName = CultureInfo.CurrentCulture.Name;
2088 bool bSwitchCulture = false;
2089 if (CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ",")
2091 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB", false); // #24241, #24790 2011.4.8 yyagi: switch culture where the country uses period as the decimal point
2092 bSwitchCulture = true; // I mistook here using CurrentUICulture. Use CurrentCulture to work correctly.
2095 #region [ 一時ファイルにDTXを出力する。 ]
2097 StreamWriter sw = new StreamWriter( this.strViewer演奏用一時ファイル名, false, Encoding.GetEncoding( 0x3a4 ) );
2098 new CDTX入出力( this ).tDTX出力( sw, bBGMのみ出力 );
2102 #region [ cultureを元に戻す。 ]
2105 Thread.CurrentThread.CurrentCulture = new CultureInfo(currentCultureEnglishName, false);
2111 this.mgr譜面管理者.strPATH_WAV = "";
2114 private void tViewer用の一時ファイルを削除する()
2116 this.strViewer演奏用一時ファイル名 = ""; // #35351 2015.7.23 yyagi add; to fix viewer plyback correctly just after save.
2120 #region [ Undo / Redo ]
2122 private void tシナリオ_Undoする()
2126 #region [ Undo する対象を Undo/Redo リストから取得する。]
2129 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す();
2142 #region [ GUI を再描画する。]
2144 this.tUndoRedo用GUIの有効無効を設定する();
2145 this.t選択チップの有無に応じて編集用GUIの有効無効を設定する();
2146 this.pictureBox譜面パネル.Refresh();
2150 private void tシナリオ_Redoする()
2154 #region [ Redo する対象を Undo/Redo リストから取得する。]
2157 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tRedoするノードを取得して返す();
2170 #region [ GUI を再描画する。]
2172 this.tUndoRedo用GUIの有効無効を設定する();
2173 this.t選択チップの有無に応じて編集用GUIの有効無効を設定する();
2174 this.pictureBox譜面パネル.Refresh();
2184 public enum Eタブ種別 : int
2193 public void t選択モードにする()
2195 this.toolStripButton選択モード.CheckState = CheckState.Checked;
2196 this.toolStripButton編集モード.CheckState = CheckState.Unchecked;
2197 this.toolStripMenuItem選択モード.CheckState = CheckState.Checked;
2198 this.toolStripMenuItem編集モード.CheckState = CheckState.Unchecked;
2200 public void t編集モードにする()
2202 this.mgr選択モード管理者.t全チップの選択を解除する();
2203 this.pictureBox譜面パネル.Refresh();
2204 this.toolStripButton選択モード.CheckState = CheckState.Unchecked;
2205 this.toolStripButton編集モード.CheckState = CheckState.Checked;
2206 this.toolStripMenuItem選択モード.CheckState = CheckState.Unchecked;
2207 this.toolStripMenuItem編集モード.CheckState = CheckState.Checked;
2209 public void t選択チップの有無に応じて編集用GUIの有効無効を設定する()
2211 bool b譜面上に選択チップがある = this.b選択チップがある;
2212 bool bクリップボードに選択チップがある = ( this.cbクリップボード != null ) && ( this.cbクリップボード.nセル数 > 0 );
2217 this.toolStripMenuItemコピー.Enabled = b譜面上に選択チップがある;
2218 this.toolStripMenuItem切り取り.Enabled = b譜面上に選択チップがある;
2219 this.toolStripMenuItem貼り付け.Enabled = bクリップボードに選択チップがある;
2220 this.toolStripMenuItem削除.Enabled = b譜面上に選択チップがある;
2225 this.toolStripButtonコピー.Enabled = b譜面上に選択チップがある;
2226 this.toolStripButton切り取り.Enabled = b譜面上に選択チップがある;
2227 this.toolStripButton貼り付け.Enabled = bクリップボードに選択チップがある;
2228 this.toolStripButton削除.Enabled = b譜面上に選択チップがある;
2233 this.toolStripMenuItem選択チップのコピー.Enabled = b譜面上に選択チップがある;
2234 this.toolStripMenuItem選択チップの切り取り.Enabled = b譜面上に選択チップがある;
2235 this.toolStripMenuItem選択チップの貼り付け.Enabled = bクリップボードに選択チップがある;
2236 this.toolStripMenuItem選択チップの削除.Enabled = b譜面上に選択チップがある;
2238 public void t選択モードのコンテクストメニューを表示する( int x, int y )
2240 // メニューの左上隅座標を控えておく。
2242 this.pt選択モードのコンテクストメニューを開いたときのマウスの位置 = new Point( x, y );
2244 #region [ クリックされた箇所のレーン番号を取得する。]
2246 int lane = this.mgr譜面管理者.nX座標dotが位置するレーン番号を返す( pt選択モードのコンテクストメニューを開いたときのマウスの位置.X );
2247 string strLane = (lane < 0)? "" : this.mgr譜面管理者.listレーン[ lane ].strレーン名;
2251 #region [ クリックされた箇所の小節番号を取得する。]
2253 int n譜面先頭からの位置grid = this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( pt選択モードのコンテクストメニューを開いたときのマウスの位置.Y );
2254 C小節 csクリックされた小節 = this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( n譜面先頭からの位置grid );
2255 if ( csクリックされた小節 == null ) return; // 小節が生成されていないところで右クリックした場合は何もしない(NullReferenceException回避)
2256 int nPartNo = csクリックされた小節.n小節番号0to3599;
2257 string strPartNo = C変換.str小節番号を文字列3桁に変換して返す( nPartNo );
2261 #region [ コンテクストメニューの[選択]項目に、レーン名と小節番号の情報をを付与する。 ]
2262 int indexMenuLaneSelect1 = this.contextMenuStrip譜面右メニュー.Items.IndexOfKey( "toolStripMenuItemレーン内のすべてのチップの選択1" );
2263 int indexMenuLaneSelect2 = this.contextMenuStrip譜面右メニュー.Items.IndexOfKey( "toolStripMenuItemレーン内のすべてのチップの選択_特定小節以降2" );
2264 int indexMenuPartSelect = this.contextMenuStrip譜面右メニュー.Items.IndexOfKey( "toolStripMenuItem小節内のすべてのチップの選択" );
2266 string strItemMenuLaneSelect = this.contextMenuStrip譜面右メニュー.Items[ indexMenuLaneSelect1 ].Text;
2267 strItemMenuLaneSelect = System.Text.RegularExpressions.Regex.Replace(
2268 strItemMenuLaneSelect , @"\[(.*)\]", "[" + strLane + "]" );
2269 this.contextMenuStrip譜面右メニュー.Items[ indexMenuLaneSelect1 ].Text = strItemMenuLaneSelect;
2271 strItemMenuLaneSelect = this.contextMenuStrip譜面右メニュー.Items[ indexMenuLaneSelect2 ].Text;
2272 strItemMenuLaneSelect = System.Text.RegularExpressions.Regex.Replace(
2273 strItemMenuLaneSelect, @"\[(.*)\]", "[" + strLane + "]" );
2274 this.contextMenuStrip譜面右メニュー.Items[ indexMenuLaneSelect2 ].Text = strItemMenuLaneSelect;
2276 string strItemMenuPartSelect = this.contextMenuStrip譜面右メニュー.Items[ indexMenuPartSelect ].Text;
2277 strItemMenuPartSelect = System.Text.RegularExpressions.Regex.Replace(
2278 strItemMenuPartSelect, @"\[(.*)\]", "[" + strPartNo + "]" );
2279 this.contextMenuStrip譜面右メニュー.Items[ indexMenuPartSelect ].Text = strItemMenuPartSelect;
2284 this.contextMenuStrip譜面右メニュー.Show( this.pictureBox譜面パネル, x, y );
2286 public void t最近使ったファイルをFileメニューへ追加する()
2288 #region [ [ファイル] メニューから、最近使ったファイルの一覧をクリアする。]
2290 for( int i = 0; i < this.toolStripMenuItemファイル.DropDownItems.Count; i++ )
2292 ToolStripItem item = this.toolStripMenuItemファイル.DropDownItems[ i ];
2294 // ↓削除したくないサブメニューの一覧。これ以外のサブメニュー項目はすべて削除する。
2295 if( item != this.toolStripMenuItem新規 &&
2296 item != this.toolStripMenuItem開く &&
2297 item != this.toolStripMenuItem上書き保存 &&
2298 item != this.toolStripMenuItem名前を付けて保存 &&
2299 item != this.toolStripSeparator1 &&
2300 item != this.toolStripMenuItemMIDIImportFromFileMenu &&
2301 item != this.exportMIDIFileToolStripMenuItem &&
2302 item != this.toolStripMenuItem終了 )
2304 this.toolStripMenuItemファイル.DropDownItems.Remove( item );
2305 i = -1; // 要素数が変わったので列挙しなおし
2311 #region [ 表示しないオプション設定であるか、履歴が0件ならここで終了する。]
2313 if( !this.appアプリ設定.ShowRecentFiles || this.appアプリ設定.RecentUsedFile.Count == 0 )
2318 #region [ アプリ設定が持つ履歴にそって、[ファイル] メニューにサブメニュー項目リストを追加する(ただし最大表示数まで)。 ]
2321 // [ファイル] のサブメニューリストに項目が1つでもある場合は、履歴サブメニュー項目の追加の前に「終了」の下にセパレータを入れる。手動で。
2323 bool bセパレータの追加がまだ = true;
2326 // すべての「最近使ったファイル」について...
2328 for( int i = 0; i < this.appアプリ設定.RecentUsedFile.Count; i++ )
2330 #region [ 最大表示数を越えたらここで終了。 ]
2332 if( i >= this.appアプリ設定.RecentFilesNum )
2337 #region [ ファイル名を、サブメニュー項目として [ファイル] メニューに追加する。 ]
2339 string path = this.appアプリ設定.RecentUsedFile[ i ];
2341 if( path.Length == 0 )
2344 #region [ セパレータの追加がまだなら追加する。]
2348 var separator = new ToolStripSeparator();
2349 separator.Size = this.toolStripSeparator1.Size;
2350 this.toolStripMenuItemファイル.DropDownItems.Add( separator );
2351 bセパレータの追加がまだ = false;
2356 #region [ ToolStripMenuItem を手動で作って [ファイル] のサブメニューリストに追加する。]
2358 string strShotenPath = AdjustPathString( path ); // #35890 2016.1.3 yyagi; shorten "RecentFiles" text if needed
2359 var item2 = new ToolStripMenuItem() {
2360 Name = "最近使ったファイル" + i,
2361 Size = this.toolStripMenuItem終了.Size,
2362 Text = "&" + i + " " + strShotenPath,
2365 item2.Click += new EventHandler( this.toolStripMenuItem最近使ったファイル_Click );
2366 this.toolStripMenuItemファイル.DropDownItems.Add( item2 );
2370 #region [ 追加したファイルが既に存在していないなら項目を無効化(グレー表示)する。]
2372 if( !File.Exists( path ) )
2373 item2.Enabled = false;
2383 // 参考: http://gushwell.ldblog.jp/archives/50815731.html
2384 private string AdjustPathString( string text )
2386 int nTargetWidth = (int)(this.Width * 0.8f);
2387 Bitmap bmp = new Bitmap(nTargetWidth, this.Height);
2388 Graphics g = Graphics.FromImage( bmp );
2389 var item = new ToolStripMenuItem();
2390 SizeF size = g.MeasureString( text, item.Font );
2391 //Debug.WriteLine( "WinWidth"+ this.Width + ", now=" + size.Width + ", font=" + this.Font.ToString());
2392 while ( nTargetWidth < size.Width )
2394 string text2 = ShortenPathString( text );
2395 if ( text == text2 )
2397 size = g.MeasureString( text2, this.Font );
2399 //Debug.WriteLine( "winWidth" + this.Width + ", now=" + size.Width + ", font=" + this.Font.ToString() );
2406 private string ShortenPathString( string text )
2408 int nWidth = this.Width;
2409 List<string> list = new List<string>(text.Split('\\'));
2410 int i = list.Count / 2;
2411 if ( list[i] != "..." )
2417 if ( list.Count % 2 == 0 && i > 1 )
2418 list.RemoveAt(i - 1);
2419 else if ( list.Count % 2 == 1 && i < list.Count - 2 )
2420 list.RemoveAt(i + 1);
2422 StringBuilder sb = new StringBuilder(list[0]);
2423 for ( int n = 1; n < list.Count; n++ ) {
2424 sb.Append('\\').Append(list[n]);
2426 //Debug.WriteLine( "org:" + text );
2427 //Debug.WriteLine( "now:" + sb );
2428 return sb.ToString();
2430 public void tWAV_BMP_AVIリストのカーソルを全部同じ行に合わせる( int nIndex番号0to1294 )
2432 if( nIndex番号0to1294 >= 0 && nIndex番号0to1294 <= 1294 )
2434 this.mgrWAVリスト管理者.tItemを選択する( nIndex番号0to1294 );
2435 this.mgrBMPリスト管理者.tItemを選択する( nIndex番号0to1294 );
2436 this.mgrAVIリスト管理者.tItemを選択する( nIndex番号0to1294 );
2438 this.n現在選択中のWAV_BMP_AVIリストの行番号0to1294 = nIndex番号0to1294;
2441 public string strファイルの存在するディレクトリを絶対パスで返す( string strファイル )
2443 string strファイルの絶対パス = strファイル;
2447 // ファイルが絶対パスかどうかを判定する。(new Uri() は相対パスを指定されると例外が発生するので、それを利用する。)
2453 // 例外が発生したので相対パスとみなし、絶対パスに直す。
2455 strファイルの絶対パス = Path.Combine( this.str作業フォルダ名, strファイル );
2458 // 正規化する。(\a\b\c\..\d を \a\b\d にする)
2460 FileInfo fi = new FileInfo( strファイルの絶対パス );
2461 strファイルの絶対パス = fi.FullName;
2463 return strファイルの絶対パス;
2465 public Point pt現在のマウス位置を譜面の可視領域相対の座標dotで返す()
2467 Point p = new Point( Cursor.Position.X, Cursor.Position.Y );
2468 return this.splitContainerタブと譜面を分割.Panel2.PointToClient( p );
2470 public Size sz譜面の可視領域の大きさdotを返す()
2472 return new Size( this.splitContainerタブと譜面を分割.Panel2.Width, this.pictureBox譜面パネル.Height );
2474 public void tUndoRedo用GUIの有効無効を設定する()
2476 this.toolStripMenuItemアンドゥ.Enabled = this.mgrUndoRedo管理者.nUndo可能な回数 > 0;
2477 this.toolStripMenuItemリドゥ.Enabled = this.mgrUndoRedo管理者.nRedo可能な回数 > 0;
2478 this.toolStripButtonアンドゥ.Enabled = this.mgrUndoRedo管理者.nUndo可能な回数 > 0;
2479 this.toolStripButtonリドゥ.Enabled = this.mgrUndoRedo管理者.nRedo可能な回数 > 0;
2481 public void tタブを選択する( Eタブ種別 eタブ種別 )
2483 this.tabControl情報パネル.SelectedIndex = (int) eタブ種別;
2491 private bool _b未保存 = true;
2492 private bool b前回BGMありで再生した = true;
2493 private bool b再生速度を変更した = false;
2494 private bool bDTXファイルを開いた = false;
2495 private Point pt選択モードのコンテクストメニューを開いたときのマウスの位置;
2496 private int n現在のガイド間隔4to64or0 = 16; // 初期は16分間隔
2497 private bool b選択チップがある
2501 foreach( KeyValuePair<int, C小節> pair in this.mgr譜面管理者.dic小節 )
2503 foreach( Cチップ cチップ in pair.Value.listチップ )
2513 public void tDTXV演奏関連のボタンとメニューのEnabledの設定()
2515 if( File.Exists( this.strDTXCのあるフォルダ名 + this.appアプリ設定.ViewerInfo.Path ) )
2517 // DTXViewer(DTXManiaGR) が存在するなら Enable
2519 this.toolStripButton先頭から再生.Enabled = true;
2520 this.toolStripButton現在位置から再生.Enabled = true;
2521 this.toolStripButton現在位置からBGMのみ再生.Enabled = true;
2522 this.toolStripButton再生停止.Enabled = true;
2523 this.toolStripMenuItem先頭から再生.Enabled = true;
2524 this.toolStripMenuItem現在位置から再生.Enabled = true;
2525 this.toolStripMenuItem現在位置からBGMのみ再生.Enabled = true;
2526 this.toolStripMenuItem再生停止.Enabled = true;
2530 // DTXViewer(DTXManiaGR) が存在しないなら Disable
2532 this.toolStripButton先頭から再生.Enabled = false;
2533 this.toolStripButton現在位置から再生.Enabled = false;
2534 this.toolStripButton現在位置からBGMのみ再生.Enabled = false;
2535 this.toolStripButton再生停止.Enabled = false;
2536 this.toolStripMenuItem先頭から再生.Enabled = false;
2537 this.toolStripMenuItem現在位置から再生.Enabled = false;
2538 this.toolStripMenuItem現在位置からBGMのみ再生.Enabled = false;
2539 this.toolStripMenuItem再生停止.Enabled = false;
2542 private string tファイル選択ダイアログでファイルを選択し相対パスにして返す( string strタイトル, string strフィルタ, string str初期フォルダ )
2544 string str相対ファイル名 = "";
2546 this.dlgチップパレット.t一時的に隠蔽する();
2548 var dialog = new OpenFileDialog() {
2552 InitialDirectory = str初期フォルダ,
2554 if( dialog.ShowDialog() == DialogResult.OK )
2556 str相対ファイル名 = Cファイル選択_パス変換.str基点からの相対パスに変換して返す( dialog.FileName, this.str作業フォルダ名 );
2557 str相対ファイル名.Replace( '/', '\\' );
2562 this.dlgチップパレット.t一時的な隠蔽を解除する();
2566 public DialogResult t未保存なら保存する()
2568 var result = DialogResult.OK;
2574 this.dlgチップパレット.t一時的に隠蔽する();
2575 result = MessageBox.Show( Resources.str編集中のデータを保存しますかMSG, Resources.str確認ダイアログのタイトル, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1 );
2576 this.dlgチップパレット.t一時的な隠蔽を解除する();
2581 if( result == DialogResult.Yes )
2591 private void t次のプロパティ変更処理がUndoRedoリストに載らないようにする()
2593 CUndoRedo管理.bUndoRedoした直後 = true;
2595 private void t次のプロパティ変更処理がUndoRedoリストに載るようにする()
2597 CUndoRedo管理.bUndoRedoした直後 = false;
2601 /// <para>n分 … 4分間隔なら 4、8分間隔なら 8 など、フリー間隔なら 0 を指定する。</para>
2603 private void tガイド間隔を変更する( int n分 )
2607 #region [ 新しいガイド間隔を設定。 ]
2610 this.n現在のガイド間隔4to64or0 = n分;
2612 this.mgr譜面管理者.n現在のガイド幅grid =
2613 ( n分 == 0 ) ? 1 : ( C小節.n基準の高さgrid / n分 );
2619 // ガイド間隔メニュー GUI を更新。
2621 #region [ 一度すべてのガイド間隔メニューのチェックをはずし、制定された分数のメニューのみチェックする。 ]
2623 this.toolStripMenuItemガイド間隔4分.CheckState = CheckState.Unchecked;
2624 this.toolStripMenuItemガイド間隔8分.CheckState = CheckState.Unchecked;
2625 this.toolStripMenuItemガイド間隔12分.CheckState = CheckState.Unchecked;
2626 this.toolStripMenuItemガイド間隔16分.CheckState = CheckState.Unchecked;
2627 this.toolStripMenuItemガイド間隔24分.CheckState = CheckState.Unchecked;
2628 this.toolStripMenuItemガイド間隔32分.CheckState = CheckState.Unchecked;
2629 this.toolStripMenuItemガイド間隔48分.CheckState = CheckState.Unchecked;
2630 this.toolStripMenuItemガイド間隔64分.CheckState = CheckState.Unchecked;
2631 this.toolStripMenuItemガイド間隔フリー.CheckState = CheckState.Unchecked;
2636 this.toolStripMenuItemガイド間隔8分.CheckState = CheckState.Checked;
2637 this.toolStripComboBoxガイド間隔.SelectedIndex = 1;
2641 this.toolStripMenuItemガイド間隔12分.CheckState = CheckState.Checked;
2642 this.toolStripComboBoxガイド間隔.SelectedIndex = 2;
2646 this.toolStripMenuItemガイド間隔フリー.CheckState = CheckState.Checked;
2647 this.toolStripComboBoxガイド間隔.SelectedIndex = 8;
2651 this.toolStripMenuItemガイド間隔4分.CheckState = CheckState.Checked;
2652 this.toolStripComboBoxガイド間隔.SelectedIndex = 0;
2656 this.toolStripMenuItemガイド間隔16分.CheckState = CheckState.Checked;
2657 this.toolStripComboBoxガイド間隔.SelectedIndex = 3;
2661 this.toolStripMenuItemガイド間隔24分.CheckState = CheckState.Checked;
2662 this.toolStripComboBoxガイド間隔.SelectedIndex = 4;
2666 this.toolStripMenuItemガイド間隔32分.CheckState = CheckState.Checked;
2667 this.toolStripComboBoxガイド間隔.SelectedIndex = 5;
2671 this.toolStripMenuItemガイド間隔48分.CheckState = CheckState.Checked;
2672 this.toolStripComboBoxガイド間隔.SelectedIndex = 6;
2676 this.toolStripMenuItemガイド間隔64分.CheckState = CheckState.Checked;
2677 this.toolStripComboBoxガイド間隔.SelectedIndex = 7;
2686 #region [ 画面を再描画する。]
2688 this.pictureBox譜面パネル.Invalidate();
2696 #region [ GUIイベント:メインフォーム ]
2698 private void Cメインフォーム_DragDrop( object sender, DragEventArgs e )
2700 string[] data = (string[]) e.Data.GetData( DataFormats.FileDrop );
2701 if( data.Length >= 1 )
2703 this.tシナリオ_DragDropされたファイルを開く( data );
2706 private void Cメインフォーム_DragEnter( object sender, DragEventArgs e )
2708 if( e.Data.GetDataPresent( DataFormats.FileDrop ) )
2710 e.Effect = DragDropEffects.Copy;
2714 e.Effect = DragDropEffects.None;
2717 private void Cメインフォーム_FormClosing( object sender, FormClosingEventArgs e )
2719 if( this.t未保存なら保存する() == DialogResult.Cancel )
2725 this.tアプリ終了時に行う終了処理();
2728 private void Cメインフォーム_Load( object sender, EventArgs e )
2730 this.tアプリ起動時に一度だけ行う初期化処理();
2731 // this.t譜面を初期化する(); // 2011.8.29 yyagi; removed this.t譜面を初期化する() because it has already done in this.tアプリ起動時に一度だけ行う初期化処理().
2735 #region [ GUIイベント:pictureBox譜面パネル、Panel2、スクロールバー関連 ]
2737 private void pictureBox譜面パネル_MouseClick( object sender, MouseEventArgs e )
2741 this.pictureBox譜面パネル.Focus();
2744 // 選択・編集のいずれかの管理者へ処理を引き継ぐ。
2746 if( this.b選択モードである )
2748 this.mgr選択モード管理者.MouseClick( e );
2752 this.mgr編集モード管理者.MouseClick( e );
2755 private void pictureBox譜面パネル_MouseDown( object sender, MouseEventArgs e )
2757 if( this.b選択モードである )
2758 this.mgr選択モード管理者.MouseDown( e );
2760 private void pictureBox譜面パネル_MouseEnter( object sender, EventArgs e )
2762 #region [ オートフォーカスが有効の場合、譜面にマウスが入ったら譜面がフォーカスを得る。 ]
2764 if( this.appアプリ設定.AutoFocus )
2765 this.pictureBox譜面パネル.Focus();
2769 private void pictureBox譜面パネル_MouseLeave( object sender, EventArgs e )
2771 if( this.b編集モードである )
2772 this.mgr編集モード管理者.MouseLeave( e );
2774 private void pictureBox譜面パネル_MouseMove( object sender, MouseEventArgs e )
2776 // 選択・編集のいずれかの管理者へ処理を引き継ぐ。
2778 if( this.b選択モードである )
2780 this.mgr選択モード管理者.MouseMove( e );
2784 this.mgr編集モード管理者.MouseMove( e );
2787 private void pictureBox譜面パネル_Paint( object sender, PaintEventArgs e )
2789 if( this.mgr譜面管理者 == null )
2790 return; // まだ初期化が終わってないうちに Paint が呼び出される場合がある。
2792 #region [ 小節数が変わってたら、スクロールバーの値域を調整する。]
2794 int n全譜面の高さgrid = this.mgr譜面管理者.n全小節の高さgridの合計を返す();
2796 if( this.vScrollBar譜面用垂直スクロールバー.Maximum != n全譜面の高さgrid - 1 ) // 小節数が変わっている
2798 // 譜面の高さ(grid)がどれだけ変わったか?
2800 int n増加分grid = ( n全譜面の高さgrid - 1 ) - this.vScrollBar譜面用垂直スクロールバー.Maximum;
2805 #region [ スクロールバーの状態を新しい譜面の高さに合わせる。]
2807 this.vScrollBar譜面用垂直スクロールバー.Maximum = n全譜面の高さgrid - 1;
2809 if( ( this.vScrollBar譜面用垂直スクロールバー.Value + n増加分grid ) < 0 )
2811 this.vScrollBar譜面用垂直スクロールバー.Value = 0;
2815 this.vScrollBar譜面用垂直スクロールバー.Value += n増加分grid;
2823 #region [ 譜面表示下辺の位置を更新する。 ]
2825 this.mgr譜面管理者.n現在の譜面表示下辺の譜面先頭からの位置grid =
2826 ( ( this.vScrollBar譜面用垂直スクロールバー.Maximum - this.vScrollBar譜面用垂直スクロールバー.LargeChange ) + 1 ) - this.vScrollBar譜面用垂直スクロールバー.Value;
2835 int nPicBoxの幅 = this.pictureBox譜面パネル.ClientSize.Width;
2836 int nPanel2の幅 = this.splitContainerタブと譜面を分割.Panel2.Width;
2838 var rc可視領域 = new Rectangle() {
2839 X = -this.pictureBox譜面パネル.Location.X,
2841 Width = ( nPanel2の幅 > nPicBoxの幅 ) ? nPicBoxの幅 : nPanel2の幅,
2842 Height = this.pictureBox譜面パネル.ClientSize.Height,
2845 this.mgr譜面管理者.t譜面を描画する( e.Graphics, this.pictureBox譜面パネル.ClientSize, rc可視領域 );
2849 #region [ 現在のモード管理者の Paint() を呼び出す。]
2851 if( this.b選択モードである )
2853 if( this.mgr選択モード管理者 != null )
2854 this.mgr選択モード管理者.Paint( e );
2858 if( this.mgr編集モード管理者 != null )
2859 this.mgr編集モード管理者.Paint( e );
2864 private void pictureBox譜面パネル_PreviewKeyDown( object sender, PreviewKeyDownEventArgs e )
2866 if( e.KeyCode == Keys.Prior )
2868 #region [ PageUp → 移動量に対応する grid だけ垂直つまみを移動させる。あとはこの移動で生じる ChangedValue イベントで処理。]
2870 int n移動すべき数grid = -C小節.n基準の高さgrid;
2871 int n新しい位置 = this.vScrollBar譜面用垂直スクロールバー.Value + n移動すべき数grid;
2872 int n最小値 = this.vScrollBar譜面用垂直スクロールバー.Minimum;
2873 int n最大値 = ( this.vScrollBar譜面用垂直スクロールバー.Maximum + 1 ) - this.vScrollBar譜面用垂直スクロールバー.LargeChange;
2879 else if( n新しい位置 > n最大値 )
2884 this.vScrollBar譜面用垂直スクロールバー.Value = n新しい位置;
2888 else if( e.KeyCode == Keys.Next )
2890 #region [ PageDown → 移動量に対応する grid だけ垂直つまみを移動させる。あとはこの移動で生じる ChangedValue イベントで処理。]
2892 int n移動すべき数grid = C小節.n基準の高さgrid;
2893 int n新しい位置 = this.vScrollBar譜面用垂直スクロールバー.Value + n移動すべき数grid;
2894 int n最小値 = this.vScrollBar譜面用垂直スクロールバー.Minimum;
2895 int n最大値 = ( this.vScrollBar譜面用垂直スクロールバー.Maximum + 1 ) - this.vScrollBar譜面用垂直スクロールバー.LargeChange;
2901 else if( n新しい位置 > n最大値 )
2906 this.vScrollBar譜面用垂直スクロールバー.Value = n新しい位置;
2912 private void splitContainerタブと譜面を分割_MouseWheel( object sender, MouseEventArgs e )
2914 if ( ( Control.ModifierKeys & Keys.Shift ) == Keys.Shift )
2916 #region [ Shiftを押しながらホイール操作すると、横スクロール。]
2920 // e.Delta は、スクロールバーを下へ動かしたいときに負、上へ動かしたいときに正となる。
2922 int n移動すべき行数 = ( -e.Delta * SystemInformation.MouseWheelScrollLines ) / 120;
2924 // 1行=1レーン とする。(が、実際には適当に設定しただけ。1レーンには設定していない)
2926 int n移動すべき数grid = n移動すべき行数 * 16;
2931 int n新しい位置 = this.hScrollBar譜面用水平スクロールバー.Value + n移動すべき数grid;
2932 int n最小値 = this.hScrollBar譜面用水平スクロールバー.Minimum;
2933 int n最大値 = ( this.hScrollBar譜面用水平スクロールバー.Maximum + 1 ) - this.hScrollBar譜面用水平スクロールバー.LargeChange;
2935 if ( n新しい位置 < n最小値 )
2939 else if ( n新しい位置 > n最大値 )
2944 this.hScrollBar譜面用水平スクロールバー.Value = n新しい位置;
2950 #region [ 移動量に対応する grid だけ垂直つまみを移動させる。あとはこの移動で生じる ChangedValue イベントで処理する。]
2956 // e.Delta は、スクロールバーを下へ動かしたいときに負、上へ動かしたいときに正となる。
2958 int n移動すべき行数 = ( -e.Delta * SystemInformation.MouseWheelScrollLines ) / 120;
2961 // 1行=1拍(64/4=16グリッド)とする。
2963 int n移動すべき数grid = n移動すべき行数 * 16;
2968 int n新しい位置 = this.vScrollBar譜面用垂直スクロールバー.Value + n移動すべき数grid;
2969 int n最小値 = this.vScrollBar譜面用垂直スクロールバー.Minimum;
2970 int n最大値 = ( this.vScrollBar譜面用垂直スクロールバー.Maximum + 1 ) - this.vScrollBar譜面用垂直スクロールバー.LargeChange;
2972 if ( n新しい位置 < n最小値 )
2976 else if ( n新しい位置 > n最大値 )
2981 this.vScrollBar譜面用垂直スクロールバー.Value = n新しい位置;
2986 private void splitContainerタブと譜面を分割_Panel2_SizeChanged( object sender, EventArgs e )
2988 if( this.mgr譜面管理者 != null ) // 初期化前に呼び出されることがある。
2990 this.mgr譜面管理者.t水平スクロールバーと譜面パネル左右位置の調整();
2991 this.mgr譜面管理者.t垂直スクロールバーと譜面可視領域の上下位置の調整();
2995 private void hScrollBar譜面用水平スクロールバー_ValueChanged( object sender, EventArgs e )
2997 if( this.mgr譜面管理者 != null )
2998 this.mgr譜面管理者.t水平スクロールバーと譜面パネル左右位置の調整();
3000 private void vScrollBar譜面用垂直スクロールバー_ValueChanged( object sender, EventArgs e )
3002 if( mgr譜面管理者 != null )
3003 this.mgr譜面管理者.t垂直スクロールバーと譜面可視領域の上下位置の調整();
3007 #region [ GUIイベント:譜面右メニュー関連 ]
3009 private void toolStripMenuItem選択チップの切り取り_Click( object sender, EventArgs e )
3013 private void toolStripMenuItem選択チップのコピー_Click( object sender, EventArgs e )
3017 private void toolStripMenuItem選択チップの貼り付け_Click( object sender, EventArgs e )
3021 Point ptMenu = new Point( this.contextMenuStrip譜面右メニュー.Left, this.contextMenuStrip譜面右メニュー.Top );
3022 Point ptMenuClient = this.contextMenuStrip譜面右メニュー.SourceControl.PointToClient( ptMenu );
3025 // Y座標から位置gridを得て、そこへ貼り付ける。
3027 this.tシナリオ_貼り付け( this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( ptMenuClient.Y ) );
3029 private void toolStripMenuItem選択チップの削除_Click( object sender, EventArgs e )
3034 private void toolStripMenuItemすべてのチップの選択_Click( object sender, EventArgs e )
3036 // 編集モードなら強制的に選択モードにする。
3038 if( this.b編集モードである )
3044 this.mgr選択モード管理者.t全チップを選択する();
3046 private void toolStripMenuItemレーン内のすべてのチップの選択_Click( object sender, EventArgs e )
3048 // 編集モードなら強制的に選択モードにする。
3050 if ( this.b編集モードである )
3053 // メニューが開かれたときのマウスの座標を取得。
3054 // ※メニューは必ずマウス位置を左上にして表示されるとは限らないため、
3055 // メニューの表示位置からは取得しないこと。
3057 Point ptマウスの位置 = this.pt選択モードのコンテクストメニューを開いたときのマウスの位置;
3062 #region [ クリックされた箇所のレーン番号を取得する。]
3064 int lane = this.mgr譜面管理者.nX座標dotが位置するレーン番号を返す( ptマウスの位置.X );
3066 return; // クリックされた箇所にレーンがない
3071 this.mgr選択モード管理者.tレーン上の全チップを選択する( lane );
3074 private void toolStripMenuItemレーン内のすべてのチップの選択_特定小節以降_Click( object sender, EventArgs e )
3076 // 編集モードなら強制的に選択モードにする。
3078 if ( this.b編集モードである )
3081 // メニューが開かれたときのマウスの座標を取得。
3082 // ※メニューは必ずマウス位置を左上にして表示されるとは限らないため、
3083 // メニューの表示位置からは取得しないこと。
3085 Point ptマウスの位置 = this.pt選択モードのコンテクストメニューを開いたときのマウスの位置;
3087 #region [ クリックされた箇所のレーン番号を取得する。]
3089 int lane = this.mgr譜面管理者.nX座標dotが位置するレーン番号を返す( ptマウスの位置.X );
3091 return; // クリックされた箇所にレーンがない
3095 #region [ クリックされた箇所の小節を取得する。]
3097 if ( this.mgr譜面管理者.nX座標dotが位置するレーン番号を返す( ptマウスの位置.X ) < 0 )
3098 return; // クリックされた箇所にレーンがない
3100 int n譜面先頭からの位置grid = this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( ptマウスの位置.Y );
3102 C小節 csクリックされた小節 = this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( n譜面先頭からの位置grid );
3106 this.mgr選択モード管理者.tレーン上の全チップを選択する( lane, csクリックされた小節.n小節番号0to3599 );
3109 private void toolStripMenuItem小節内のすべてのチップの選択_Click( object sender, EventArgs e )
3111 // 編集モードなら強制的に選択モードにする。
3113 if ( this.b編集モードである )
3116 // メニューが開かれたときのマウスの座標を取得。
3117 // ※メニューは必ずマウス位置を左上にして表示されるとは限らないため、
3118 // メニューの表示位置からは取得しないこと。
3120 Point ptマウスの位置 = this.pt選択モードのコンテクストメニューを開いたときのマウスの位置;
3122 #region [ クリックされた箇所の小節を取得する。]
3124 if ( this.mgr譜面管理者.nX座標dotが位置するレーン番号を返す( ptマウスの位置.X ) < 0 )
3125 return; // クリックされた箇所にレーンがない
3127 int n譜面先頭からの位置grid = this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( ptマウスの位置.Y );
3128 C小節 csクリックされた小節 = this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( n譜面先頭からの位置grid );
3132 this.mgr選択モード管理者.t小節上の全チップを選択する( csクリックされた小節.n小節番号0to3599 );
3135 private void toolStripMenuItem選択したチップを等間隔に配置_Click(object sender, EventArgs e)
3137 this.tシナリオ_等間隔に配置();
3139 private void toolStripMenuItem小節長変更_Click( object sender, EventArgs e )
3141 // メニューが開かれたときのマウスの座標を取得。
3142 // ※メニューは必ずマウス位置を左上にして表示されるとは限らないため、
3143 // メニューの表示位置からは取得しないこと。
3145 Point ptマウス位置 = this.pt選択モードのコンテクストメニューを開いたときのマウスの位置;
3150 #region [ クリックされた小節を取得する。]
3152 if( this.mgr譜面管理者.nX座標dotが位置するレーン番号を返す( ptマウス位置.X ) < 0 )
3153 return; // クリックされた箇所にレーンがないなら無視。
3155 int n譜面先頭からの位置grid = this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( ptマウス位置.Y );
3156 C小節 csクリックされた小節 = this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( n譜面先頭からの位置grid );
3160 #region [ 取得した小節の小節長を変更する。]
3162 if( csクリックされた小節 != null )
3163 this.tシナリオ_小節長を変更する( csクリックされた小節 );
3167 private void toolStripMenuItem小節の挿入_Click( object sender, EventArgs e )
3169 // メニューが開かれたときのマウスの座標を取得。
3170 // ※メニューは必ずマウス位置を左上にして表示されるとは限らないため、
3171 // メニューの表示位置からは取得しないこと。
3173 Point ptマウスの位置 = this.pt選択モードのコンテクストメニューを開いたときのマウスの位置;
3178 #region [ クリックされた箇所の小節を取得する。]
3180 if( this.mgr譜面管理者.nX座標dotが位置するレーン番号を返す( ptマウスの位置.X ) < 0 )
3181 return; // クリックされた箇所にレーンがない
3183 int n譜面先頭からの位置grid = this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( ptマウスの位置.Y );
3184 C小節 csクリックされた小節 = this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( n譜面先頭からの位置grid );
3188 #region [ 該当小節の下へ新しい小節を挿入する。]
3190 if( csクリックされた小節 != null )
3191 this.tシナリオ_小節を挿入する( csクリックされた小節.n小節番号0to3599 );
3195 private void toolStripMenuItem小節の削除_Click( object sender, EventArgs e )
3197 // メニューが開かれたときのマウスの座標を取得。
3198 // ※メニューは必ずマウス位置を左上にして表示されるとは限らないため、
3199 // メニューの表示位置からは取得しないこと。
3201 Point ptマウス位置 = this.pt選択モードのコンテクストメニューを開いたときのマウスの位置;
3206 #region [ クリックされた箇所の小節を取得する。 ]
3208 if( this.mgr譜面管理者.nX座標dotが位置するレーン番号を返す( ptマウス位置.X ) < 0 )
3209 return; // クリックされた箇所にレーンがないなら無視。
3211 int n譜面先頭からの位置grid = this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( ptマウス位置.Y );
3212 C小節 cs削除する小節 = this.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( n譜面先頭からの位置grid );
3216 #region [ 該当小節を削除する。]
3218 if( cs削除する小節 != null )
3219 this.tシナリオ_小節を削除する( cs削除する小節.n小節番号0to3599 );
3226 #region [ GUIイベント:基本情報関連 ]
3229 private string textBox曲名_以前の値 = "";
3230 private void textBox曲名_TextChanged( object sender, EventArgs e )
3232 // Undo/Redo リストを修正する。
3234 #region [ Undo/Redo リストを修正。]
3236 if( !CUndoRedo管理.bUndoRedoした直後 )
3238 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3240 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBox曲名 ) )
3244 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBox曲名.Text;
3250 this.mgrUndoRedo管理者.tノードを追加する(
3251 new CUndoRedoセル<string>(
3253 new DGUndoを実行する<string>( this.textBox曲名_Undo ),
3254 new DGRedoを実行する<string>( this.textBox曲名_Redo ),
3255 this.textBox曲名_以前の値, this.textBox曲名.Text ) );
3260 this.tUndoRedo用GUIの有効無効を設定する();
3269 this.textBox曲名_以前の値 = this.textBox曲名.Text;
3274 CUndoRedo管理.bUndoRedoした直後 = false;
3277 private void textBox曲名_Leave( object sender, EventArgs e )
3279 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3282 oセル仮想.t所有権の放棄( this.textBox曲名 );
3284 private void textBox曲名_Undo( string str変更前, string str変更後 )
3288 this.tタブを選択する( Eタブ種別.基本情報 );
3290 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3291 this.textBox曲名.Text = str変更前;
3293 this.textBox曲名.Focus();
3295 private void textBox曲名_Redo( string str変更前, string str変更後 )
3299 this.tタブを選択する( Eタブ種別.基本情報 );
3301 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3302 this.textBox曲名.Text = str変更後;
3304 this.textBox曲名.Focus();
3308 private string textBox製作者_以前の値 = "";
3309 private void textBox製作者_TextChanged( object sender, EventArgs e )
3311 // Undo/Redo リストを修正する。
3313 #region [ Undo/Redo リストを修正。]
3315 if( !CUndoRedo管理.bUndoRedoした直後 )
3317 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3319 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBox製作者 ) )
3323 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBox製作者.Text;
3329 this.mgrUndoRedo管理者.tノードを追加する(
3330 new CUndoRedoセル<string>(
3332 new DGUndoを実行する<string>( this.textBox製作者_Undo ),
3333 new DGRedoを実行する<string>( this.textBox製作者_Redo ),
3334 this.textBox製作者_以前の値, this.textBox製作者.Text ) );
3339 this.tUndoRedo用GUIの有効無効を設定する();
3348 this.textBox製作者_以前の値 = this.textBox製作者.Text;
3353 CUndoRedo管理.bUndoRedoした直後 = false;
3356 private void textBox製作者_Leave( object sender, EventArgs e )
3358 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3361 oセル仮想.t所有権の放棄( this.textBox製作者 );
3363 private void textBox製作者_Undo( string str変更前, string str変更後 )
3367 this.tタブを選択する( Eタブ種別.基本情報 );
3369 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3370 this.textBox製作者.Text = str変更前;
3372 this.textBox製作者.Focus();
3374 private void textBox製作者_Redo( string str変更前, string str変更後 )
3378 this.tタブを選択する( Eタブ種別.基本情報 );
3380 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3381 this.textBox製作者.Text = str変更後;
3383 this.textBox製作者.Focus();
3387 private string textBoxコメント_以前の値 = "";
3388 private void textBoxコメント_TextChanged( object sender, EventArgs e )
3390 // Undo/Redo リストを修正する。
3392 #region [ Undo/Redo リストを修正。]
3394 if( !CUndoRedo管理.bUndoRedoした直後 )
3396 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3398 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBoxコメント ) )
3402 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBoxコメント.Text;
3408 this.mgrUndoRedo管理者.tノードを追加する(
3409 new CUndoRedoセル<string>(
3411 new DGUndoを実行する<string>( this.textBoxコメント_Undo ),
3412 new DGRedoを実行する<string>( this.textBoxコメント_Redo ),
3413 this.textBoxコメント_以前の値, this.textBoxコメント.Text ) );
3417 this.tUndoRedo用GUIの有効無効を設定する();
3426 this.textBoxコメント_以前の値 = this.textBoxコメント.Text;
3431 CUndoRedo管理.bUndoRedoした直後 = false;
3434 private void textBoxコメント_Leave( object sender, EventArgs e )
3436 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3439 oセル仮想.t所有権の放棄( this.textBoxコメント );
3441 private void textBoxコメント_Undo( string str変更前, string str変更後 )
3445 this.tタブを選択する( Eタブ種別.基本情報 );
3447 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3448 this.textBoxコメント.Text = str変更前;
3450 this.textBoxコメント.Focus();
3452 private void textBoxコメント_Redo( string str変更前, string str変更後 )
3456 this.tタブを選択する( Eタブ種別.基本情報 );
3458 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3459 this.textBoxコメント.Text = str変更後;
3461 this.textBoxコメント.Focus();
3465 private string textBoxGenre_以前の値 = "";
3466 private void textBoxGenre_TextChanged( object sender, EventArgs e )
3468 // Undo/Redo リストを修正する。
3470 #region [ Undo/Redo リストを修正。]
3472 if ( !CUndoRedo管理.bUndoRedoした直後 )
3474 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3476 if ( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBoxGenre ) )
3480 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBoxGenre.Text;
3486 this.mgrUndoRedo管理者.tノードを追加する(
3487 new CUndoRedoセル<string>(
3489 new DGUndoを実行する<string>( this.textBoxGenre_Undo ),
3490 new DGRedoを実行する<string>( this.textBoxGenre_Redo ),
3491 this.textBoxGenre_以前の値, this.textBoxGenre.Text ) );
3495 this.tUndoRedo用GUIの有効無効を設定する();
3504 this.textBoxGenre_以前の値 = this.textBoxGenre.Text;
3509 CUndoRedo管理.bUndoRedoした直後 = false;
3512 private void textBoxGenre_Leave( object sender, EventArgs e )
3514 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3516 if ( oセル仮想 != null )
3517 oセル仮想.t所有権の放棄( this.textBoxGenre );
3519 private void textBoxGenre_Undo( string str変更前, string str変更後 )
3523 this.tタブを選択する( Eタブ種別.基本情報 );
3525 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3526 this.textBoxGenre.Text = str変更前;
3528 this.textBoxGenre.Focus();
3530 private void textBoxGenre_Redo( string str変更前, string str変更後 )
3534 this.tタブを選択する( Eタブ種別.基本情報 );
3536 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3537 this.textBoxGenre.Text = str変更後;
3539 this.textBoxGenre.Focus();
3544 private decimal numericUpDownBPM_以前の値 = 120.0M;
3545 private void numericUpDownBPM_ValueChanged( object sender, EventArgs e )
3547 // Undo/Redo リストを修正する。
3549 #region [ Undo/Redo リストの修正。]
3551 if( !CUndoRedo管理.bUndoRedoした直後 )
3553 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3555 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.numericUpDownBPM ) )
3559 ( (CUndoRedoセル<decimal>) oセル仮想 ).変更後の値 = this.numericUpDownBPM.Value;
3565 this.mgrUndoRedo管理者.tノードを追加する(
3566 new CUndoRedoセル<decimal>(
3567 this.numericUpDownBPM,
3568 new DGUndoを実行する<decimal>( this.numericUpDownBPM_Undo ),
3569 new DGRedoを実行する<decimal>( this.numericUpDownBPM_Redo ),
3570 this.numericUpDownBPM_以前の値, this.numericUpDownBPM.Value ) );
3575 this.tUndoRedo用GUIの有効無効を設定する();
3584 this.numericUpDownBPM_以前の値 = this.numericUpDownBPM.Value;
3589 CUndoRedo管理.bUndoRedoした直後 = false;
3592 private void numericUpDownBPM_Leave( object sender, EventArgs e )
3594 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3597 oセル仮想.t所有権の放棄( this.numericUpDownBPM );
3599 private void numericUpDownBPM_Undo( decimal dec変更前, decimal dec変更後 )
3603 this.tタブを選択する( Eタブ種別.基本情報 );
3605 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3606 this.numericUpDownBPM.Value = dec変更前;
3608 this.numericUpDownBPM.Focus();
3610 private void numericUpDownBPM_Redo( decimal dec変更前, decimal dec変更後 )
3614 this.tタブを選択する( Eタブ種別.基本情報 );
3616 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3617 this.numericUpDownBPM.Value = dec変更後;
3619 this.numericUpDownBPM.Focus();
3624 private int nDLEVEL_以前の値 = 50;
3625 private void textBoxDLEVEL_TextChanged( object sender, EventArgs e )
3627 // 何もしない。→ 数字以外が入力されていることもあるため、Leaveまで待つ。
3629 private void textBoxDLEVEL_Leave( object sender, EventArgs e )
3631 if( this.textBoxDLEVEL.Text.Length > 0 )
3636 if( !int.TryParse( this.textBoxDLEVEL.Text, out n値 ) )
3652 if( this.hScrollBarDLEVEL.Value != n値 )
3654 this.t次のプロパティ変更処理がUndoRedoリストに載るようにする();
3655 this.hScrollBarDLEVEL.Value = n値; // ここで hScrollBarDLEVEL_ValueChanged が発動 → UndoRedo処理はそちらで。
3659 private void hScrollBarDLEVEL_ValueChanged( object sender, EventArgs e )
3663 this.textBoxDLEVEL.Text = this.hScrollBarDLEVEL.Value.ToString();
3666 // Undo/Redo リストを修正。
3668 #region [ Undo/Redo リストを修正する。]
3670 if( !CUndoRedo管理.bUndoRedoした直後 )
3672 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3674 if( oセル仮想 != null && oセル仮想.b所有権がある( this.hScrollBarDLEVEL ) )
3678 ( (CUndoRedoセル<int>) oセル仮想 ).変更後の値 = this.hScrollBarDLEVEL.Value;
3684 this.mgrUndoRedo管理者.tノードを追加する(
3685 new CUndoRedoセル<int>(
3686 this.hScrollBarDLEVEL,
3687 new DGUndoを実行する<int>( this.nDLEVEL_Undo ),
3688 new DGRedoを実行する<int>( this.nDLEVEL_Redo ),
3689 this.nDLEVEL_以前の値, this.hScrollBarDLEVEL.Value ) );
3694 this.tUndoRedo用GUIの有効無効を設定する();
3703 this.nDLEVEL_以前の値 = this.hScrollBarDLEVEL.Value;
3708 CUndoRedo管理.bUndoRedoした直後 = false;
3711 private void nDLEVEL_Undo( int n変更前, int n変更後 )
3715 this.tタブを選択する( Eタブ種別.基本情報 );
3717 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3718 this.textBoxDLEVEL.Text = n変更前.ToString();
3720 this.textBoxDLEVEL.Focus();
3725 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3726 this.hScrollBarDLEVEL.Value = n変更前;
3728 private void nDLEVEL_Redo( int n変更前, int n変更後 )
3732 this.tタブを選択する( Eタブ種別.基本情報 );
3734 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3735 this.textBoxDLEVEL.Text = n変更後.ToString();
3737 this.textBoxDLEVEL.Focus();
3742 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3743 this.hScrollBarDLEVEL.Value = n変更後;
3747 private int nGLEVEL_以前の値;
3748 private void textBoxGLEVEL_TextChanged( object sender, EventArgs e )
3750 // 何もしない。→ 数字以外が入力されていることもあるため、Leaveまで待つ。
3752 private void textBoxGLEVEL_Leave( object sender, EventArgs e )
3754 if( this.textBoxGLEVEL.Text.Length > 0 )
3759 if( !int.TryParse( this.textBoxGLEVEL.Text, out n値 ) )
3775 if( this.hScrollBarGLEVEL.Value != n値 )
3777 this.t次のプロパティ変更処理がUndoRedoリストに載るようにする();
3778 this.hScrollBarGLEVEL.Value = n値; // ここで hScrollBarGLEVEL_ValueChanged が発動 → UndoRedo処理はそちらで。
3782 private void hScrollBarGLEVEL_ValueChanged( object sender, EventArgs e )
3786 this.textBoxGLEVEL.Text = this.hScrollBarGLEVEL.Value.ToString();
3788 // Undo/Redo リストを修正。
3790 #region [ Undo/Redo リストを修正する。]
3792 if( !CUndoRedo管理.bUndoRedoした直後 )
3794 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3796 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.hScrollBarGLEVEL ) )
3800 ( (CUndoRedoセル<int>) oセル仮想 ).変更後の値 = this.hScrollBarGLEVEL.Value;
3806 this.mgrUndoRedo管理者.tノードを追加する(
3807 new CUndoRedoセル<int>(
3808 this.hScrollBarGLEVEL,
3809 new DGUndoを実行する<int>( this.nGLEVEL_Undo ),
3810 new DGRedoを実行する<int>( this.nGLEVEL_Redo ),
3811 this.nGLEVEL_以前の値, this.hScrollBarGLEVEL.Value ) );
3816 this.tUndoRedo用GUIの有効無効を設定する();
3825 this.nGLEVEL_以前の値 = this.hScrollBarGLEVEL.Value;
3830 CUndoRedo管理.bUndoRedoした直後 = false;
3833 private void nGLEVEL_Undo( int n変更前, int n変更後 )
3837 this.tタブを選択する( Eタブ種別.基本情報 );
3839 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3840 this.textBoxGLEVEL.Text = n変更前.ToString();
3842 this.textBoxGLEVEL.Focus();
3845 // 値を水平スクロールバーにも反映する。
3847 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3848 this.hScrollBarGLEVEL.Value = n変更前;
3850 private void nGLEVEL_Redo( int n変更前, int n変更後 )
3854 this.tタブを選択する( Eタブ種別.基本情報 );
3856 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3857 this.textBoxGLEVEL.Text = n変更後.ToString();
3859 this.textBoxGLEVEL.Focus();
3862 // 値を水平スクロールバーにも反映する。
3864 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3865 this.hScrollBarGLEVEL.Value = n変更後;
3869 private int nBLEVEL_以前の値;
3870 private void textBoxBLEVEL_TextChanged( object sender, EventArgs e )
3872 // 何もしない。→ 数字以外が入力されていることもあるため、Leaveまで待つ。
3874 private void textBoxBLEVEL_Leave( object sender, EventArgs e )
3876 if( this.textBoxBLEVEL.Text.Length > 0 )
3881 if( !int.TryParse( this.textBoxBLEVEL.Text, out n値 ) )
3897 if( this.hScrollBarBLEVEL.Value != n値 )
3899 this.t次のプロパティ変更処理がUndoRedoリストに載るようにする();
3900 this.hScrollBarBLEVEL.Value = n値; // ここで hScrollBarBLEVEL_ValueChanged が発動 → UndoRedo処理はそちらで。
3904 private void hScrollBarBLEVEL_ValueChanged( object sender, EventArgs e )
3908 this.textBoxBLEVEL.Text = this.hScrollBarBLEVEL.Value.ToString();
3911 // Undo/Redo リストを修正。
3913 #region [ Undo/Redo リストを修正する。]
3915 if( !CUndoRedo管理.bUndoRedoした直後 )
3917 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
3919 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.hScrollBarBLEVEL ) )
3923 ( (CUndoRedoセル<int>) oセル仮想 ).変更後の値 = this.hScrollBarBLEVEL.Value;
3929 this.mgrUndoRedo管理者.tノードを追加する(
3930 new CUndoRedoセル<int>(
3931 this.hScrollBarBLEVEL,
3932 new DGUndoを実行する<int>( this.nBLEVEL_Undo ),
3933 new DGRedoを実行する<int>( this.nBLEVEL_Redo ),
3934 this.nBLEVEL_以前の値, this.hScrollBarBLEVEL.Value ) );
3939 this.tUndoRedo用GUIの有効無効を設定する();
3948 this.nBLEVEL_以前の値 = this.hScrollBarBLEVEL.Value;
3953 CUndoRedo管理.bUndoRedoした直後 = false;
3956 private void nBLEVEL_Undo( int n変更前, int n変更後 )
3960 this.tタブを選択する( Eタブ種別.基本情報 );
3962 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3963 this.textBoxBLEVEL.Text = n変更前.ToString();
3965 this.textBoxBLEVEL.Focus();
3970 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3971 this.hScrollBarBLEVEL.Value = n変更前;
3973 private void nBLEVEL_Redo( int n変更前, int n変更後 )
3977 this.tタブを選択する( Eタブ種別.基本情報 );
3979 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3980 this.textBoxBLEVEL.Text = n変更後.ToString();
3982 this.textBoxBLEVEL.Focus();
3987 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
3988 this.hScrollBarBLEVEL.Value = n変更後;
3993 private string textBoxパネル_以前の値 = "";
3994 private void textBoxパネル_TextChanged( object sender, EventArgs e )
3996 // Undo/Redo リストを修正。
3998 #region [ Undo/Redo リストを修正する。]
4000 if( !CUndoRedo管理.bUndoRedoした直後 )
4002 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4004 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBoxパネル ) )
4008 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBoxパネル.Text;
4014 this.mgrUndoRedo管理者.tノードを追加する(
4015 new CUndoRedoセル<string>(
4017 new DGUndoを実行する<string>( this.textBoxパネル_Undo ),
4018 new DGRedoを実行する<string>( this.textBoxパネル_Redo ),
4019 this.textBoxパネル_以前の値, this.textBoxパネル.Text ) );
4024 this.tUndoRedo用GUIの有効無効を設定する();
4033 this.textBoxパネル_以前の値 = this.textBoxパネル.Text;
4038 CUndoRedo管理.bUndoRedoした直後 = false;
4041 private void textBoxパネル_Leave( object sender, EventArgs e )
4043 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4046 oセル仮想.t所有権の放棄( this.textBoxパネル );
4048 private void textBoxパネル_Undo( string str変更前, string str変更後 )
4052 this.tタブを選択する( Eタブ種別.基本情報 );
4054 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4055 this.textBoxパネル.Text = str変更前;
4057 this.textBoxパネル.Focus();
4059 private void textBoxパネル_Redo( string str変更前, string str変更後 )
4063 this.tタブを選択する( Eタブ種別.基本情報 );
4065 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4066 this.textBoxパネル.Text = str変更後;
4068 this.textBoxパネル.Focus();
4072 private string textBoxPREVIEW_以前の値 = "";
4073 private void textBoxPREVIEW_TextChanged( object sender, EventArgs e )
4075 // Undo/Redo リストを修正。
4077 #region [ Undo/Redo リストを修正する。]
4079 if( !CUndoRedo管理.bUndoRedoした直後 )
4081 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4083 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBoxPREVIEW ) )
4087 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBoxPREVIEW.Text;
4093 this.mgrUndoRedo管理者.tノードを追加する(
4094 new CUndoRedoセル<string>(
4095 this.textBoxPREVIEW,
4096 new DGUndoを実行する<string>( this.textBoxPREVIEW_Undo ),
4097 new DGRedoを実行する<string>( this.textBoxPREVIEW_Redo ),
4098 this.textBoxPREVIEW_以前の値, this.textBoxPREVIEW.Text ) );
4103 this.tUndoRedo用GUIの有効無効を設定する();
4112 this.textBoxPREVIEW_以前の値 = this.textBoxPREVIEW.Text;
4117 CUndoRedo管理.bUndoRedoした直後 = false;
4120 private void textBoxPREVIEW_Leave( object sender, EventArgs e )
4122 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4125 oセル仮想.t所有権の放棄( this.textBoxPREVIEW );
4127 private void textBoxPREVIEW_Undo( string str変更前, string str変更後 )
4131 this.tタブを選択する( Eタブ種別.基本情報 );
4133 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4134 this.textBoxPREVIEW.Text = str変更前;
4136 this.textBoxPREVIEW.Focus();
4138 private void textBoxPREVIEW_Redo( string str変更前, string str変更後 )
4142 this.tタブを選択する( Eタブ種別.基本情報 );
4144 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4145 this.textBoxPREVIEW.Text = str変更後;
4147 this.textBoxPREVIEW.Focus();
4150 #region [ PREIMAGE ]
4151 private string textBoxPREIMAGE_以前の値 = "";
4152 private void textBoxPREIMAGE_TextChanged( object sender, EventArgs e )
4154 // Undo/Redo リストを修正。
4156 #region [ Undo/Redo リストを修正する。]
4158 if( !CUndoRedo管理.bUndoRedoした直後 )
4160 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4162 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBoxPREIMAGE ) )
4166 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBoxPREIMAGE.Text;
4172 this.mgrUndoRedo管理者.tノードを追加する(
4173 new CUndoRedoセル<string>(
4174 this.textBoxPREIMAGE,
4175 new DGUndoを実行する<string>( this.textBoxPREIMAGE_Undo ),
4176 new DGRedoを実行する<string>( this.textBoxPREIMAGE_Redo ),
4177 this.textBoxPREIMAGE_以前の値, this.textBoxPREIMAGE.Text ) );
4182 this.tUndoRedo用GUIの有効無効を設定する();
4191 this.textBoxPREIMAGE_以前の値 = this.textBoxPREIMAGE.Text;
4196 CUndoRedo管理.bUndoRedoした直後 = false;
4199 private void textBoxPREIMAGE_Leave( object sender, EventArgs e )
4201 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4204 oセル仮想.t所有権の放棄( this.textBoxPREIMAGE );
4206 private void textBoxPREIMAGE_Undo( string str変更前, string str変更後 )
4210 this.tタブを選択する( Eタブ種別.基本情報 );
4212 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4213 this.textBoxPREIMAGE.Text = str変更前;
4215 this.textBoxPREIMAGE.Focus();
4217 private void textBoxPREIMAGE_Redo( string str変更前, string str変更後 )
4221 this.tタブを選択する( Eタブ種別.基本情報 );
4223 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4224 this.textBoxPREIMAGE.Text = str変更後;
4226 this.textBoxPREIMAGE.Focus();
4229 #region [ STAGEFILE ]
4230 private string textBoxSTAGEFILE_以前の値 = "";
4231 private void textBoxSTAGEFILE_TextChanged( object sender, EventArgs e )
4233 // Undo/Redo リストを修正。
4235 #region [ Undo/Redo リストを修正する。]
4237 if( !CUndoRedo管理.bUndoRedoした直後 )
4239 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4241 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBoxSTAGEFILE ) )
4245 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBoxSTAGEFILE.Text;
4251 this.mgrUndoRedo管理者.tノードを追加する(
4252 new CUndoRedoセル<string>(
4253 this.textBoxSTAGEFILE,
4254 new DGUndoを実行する<string>( this.textBoxSTAGEFILE_Undo ),
4255 new DGRedoを実行する<string>( this.textBoxSTAGEFILE_Redo ),
4256 this.textBoxSTAGEFILE_以前の値, this.textBoxSTAGEFILE.Text ) );
4261 this.tUndoRedo用GUIの有効無効を設定する();
4270 this.textBoxSTAGEFILE_以前の値 = this.textBoxSTAGEFILE.Text;
4275 CUndoRedo管理.bUndoRedoした直後 = false;
4278 private void textBoxSTAGEFILE_Leave( object sender, EventArgs e )
4280 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4283 oセル仮想.t所有権の放棄( this.textBoxSTAGEFILE );
4285 private void textBoxSTAGEFILE_Undo( string str変更前, string str変更後 )
4289 this.tタブを選択する( Eタブ種別.基本情報 );
4291 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4292 this.textBoxSTAGEFILE.Text = str変更前;
4294 this.textBoxSTAGEFILE.Focus();
4296 private void textBoxSTAGEFILE_Redo( string str変更前, string str変更後 )
4300 this.tタブを選択する( Eタブ種別.基本情報 );
4302 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4303 this.textBoxSTAGEFILE.Text = str変更後;
4305 this.textBoxSTAGEFILE.Focus();
4308 #region [ BACKGROUND ]
4309 private string textBoxBACKGROUND_以前の値 = "";
4310 private void textBoxBACKGROUND_TextChanged( object sender, EventArgs e )
4312 // Undo/Redo リストを修正。
4314 #region [ Undo/Redo リストを修正する。]
4316 if( !CUndoRedo管理.bUndoRedoした直後 )
4318 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4320 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBoxBACKGROUND ) )
4324 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBoxBACKGROUND.Text;
4330 this.mgrUndoRedo管理者.tノードを追加する(
4331 new CUndoRedoセル<string>(
4332 this.textBoxBACKGROUND,
4333 new DGUndoを実行する<string>( this.textBoxBACKGROUND_Undo ),
4334 new DGRedoを実行する<string>( this.textBoxBACKGROUND_Redo ),
4335 this.textBoxBACKGROUND_以前の値, this.textBoxBACKGROUND.Text ) );
4340 this.tUndoRedo用GUIの有効無効を設定する();
4349 this.textBoxBACKGROUND_以前の値 = this.textBoxBACKGROUND.Text;
4354 CUndoRedo管理.bUndoRedoした直後 = false;
4357 private void textBoxBACKGROUND_Leave( object sender, EventArgs e )
4359 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4362 oセル仮想.t所有権の放棄( this.textBoxBACKGROUND );
4364 private void textBoxBACKGROUND_Undo( string str変更前, string str変更後 )
4368 this.tタブを選択する( Eタブ種別.基本情報 );
4370 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4371 this.textBoxBACKGROUND.Text = str変更前;
4373 this.textBoxBACKGROUND.Focus();
4375 private void textBoxBACKGROUND_Redo( string str変更前, string str変更後 )
4379 this.tタブを選択する( Eタブ種別.基本情報 );
4381 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4382 this.textBoxBACKGROUND.Text = str変更後;
4384 this.textBoxBACKGROUND.Focus();
4387 #region [ RESULTIMAGE ]
4388 private string textBoxRESULTIMAGE_以前の値 = "";
4389 private void textBoxRESULTIMAGE_TextChanged( object sender, EventArgs e )
4391 // Undo/Redo リストを修正。
4393 #region [ Undo/Redo リストを修正する。]
4395 if( !CUndoRedo管理.bUndoRedoした直後 )
4397 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4399 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBoxRESULTIMAGE ) )
4403 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBoxRESULTIMAGE.Text;
4409 this.mgrUndoRedo管理者.tノードを追加する(
4410 new CUndoRedoセル<string>(
4411 this.textBoxRESULTIMAGE,
4412 new DGUndoを実行する<string>( this.textBoxRESULTIMAGE_Undo ),
4413 new DGRedoを実行する<string>( this.textBoxRESULTIMAGE_Redo ),
4414 this.textBoxRESULTIMAGE_以前の値, this.textBoxRESULTIMAGE.Text ) );
4419 this.tUndoRedo用GUIの有効無効を設定する();
4428 this.textBoxRESULTIMAGE_以前の値 = this.textBoxRESULTIMAGE.Text;
4433 CUndoRedo管理.bUndoRedoした直後 = false;
4436 private void textBoxRESULTIMAGE_Leave( object sender, EventArgs e )
4438 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4441 oセル仮想.t所有権の放棄( this.textBoxRESULTIMAGE );
4443 private void textBoxRESULTIMAGE_Undo( string str変更前, string str変更後 )
4447 this.tタブを選択する( Eタブ種別.基本情報 );
4449 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4450 this.textBoxRESULTIMAGE.Text = str変更前;
4452 this.textBoxRESULTIMAGE.Focus();
4454 private void textBoxRESULTIMAGE_Redo( string str変更前, string str変更後 )
4458 this.tタブを選択する( Eタブ種別.基本情報 );
4460 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4461 this.textBoxRESULTIMAGE.Text = str変更後;
4463 this.textBoxRESULTIMAGE.Focus();
4467 #region [ PREVIEW参照ボタン ]
4468 private void buttonPREVIEW参照_Click( object sender, EventArgs e )
4470 string str初期フォルダ名 = this.str作業フォルダ名;
4472 if( this.textBoxPREVIEW.Text.Length > 0 )
4473 str初期フォルダ名 = this.strファイルの存在するディレクトリを絶対パスで返す( this.textBoxPREVIEW.Text );
4475 string strファイル名 = this.tファイル選択ダイアログでファイルを選択し相対パスにして返す(
4476 Resources.strプレビュー音ファイル選択ダイアログのタイトル,
4477 Resources.strサウンドファイル選択ダイアログのフィルタ,
4480 if( strファイル名.Length > 0 )
4482 this.textBoxPREVIEW.Text = strファイル名;
4487 #region [ PREIMAGE参照ボタン ]
4488 private void buttonPREIMAGE参照_Click( object sender, EventArgs e )
4490 string str初期フォルダ名 = this.str作業フォルダ名;
4492 if( this.textBoxPREIMAGE.Text.Length > 0 )
4493 str初期フォルダ名 = this.strファイルの存在するディレクトリを絶対パスで返す( this.textBoxPREIMAGE.Text );
4495 string strファイル名 = this.tファイル選択ダイアログでファイルを選択し相対パスにして返す(
4496 Resources.strプレビュー画像ファイル選択ダイアログのタイトル,
4497 Resources.str画像ファイル選択ダイアログのフィルタ,
4500 if( strファイル名.Length > 0 )
4502 this.textBoxPREIMAGE.Text = strファイル名;
4507 #region [ STAGEFILE参照ボタン ]
4508 private void buttonSTAGEFILE参照_Click( object sender, EventArgs e )
4510 string str初期フォルダ名 = this.str作業フォルダ名;
4512 if( this.textBoxSTAGEFILE.Text.Length > 0 )
4513 str初期フォルダ名 = this.strファイルの存在するディレクトリを絶対パスで返す( this.textBoxSTAGEFILE.Text );
4515 string strファイル名 = this.tファイル選択ダイアログでファイルを選択し相対パスにして返す(
4516 Resources.strステージ画像ファイル選択ダイアログのタイトル,
4517 Resources.str画像ファイル選択ダイアログのフィルタ,
4520 if( strファイル名.Length > 0 )
4522 this.textBoxSTAGEFILE.Text = strファイル名;
4527 #region [ BACKGROUND参照ボタン ]
4528 private void buttonBACKGROUND参照_Click( object sender, EventArgs e )
4530 string str初期フォルダ名 = this.str作業フォルダ名;
4532 if( this.textBoxBACKGROUND.Text.Length > 0 )
4533 str初期フォルダ名 = this.strファイルの存在するディレクトリを絶対パスで返す( this.textBoxBACKGROUND.Text );
4535 string strファイル名 = this.tファイル選択ダイアログでファイルを選択し相対パスにして返す(
4536 Resources.str背景画像ファイル選択ダイアログのタイトル,
4537 Resources.str画像ファイル選択ダイアログのフィルタ,
4540 if( strファイル名.Length > 0 )
4542 this.textBoxBACKGROUND.Text = strファイル名;
4547 #region [ RESULTIMAGE参照ボタン ]
4548 private void buttonRESULTIMAGE参照_Click( object sender, EventArgs e )
4550 string str初期フォルダ名 = this.str作業フォルダ名;
4552 if( this.textBoxRESULTIMAGE.Text.Length > 0 )
4553 str初期フォルダ名 = this.strファイルの存在するディレクトリを絶対パスで返す( this.textBoxRESULTIMAGE.Text );
4555 string strファイル名 = this.tファイル選択ダイアログでファイルを選択し相対パスにして返す(
4556 Resources.str結果画像ファイル選択ダイアログのタイトル,
4557 Resources.str画像ファイル選択ダイアログのフィルタ,
4560 if( strファイル名.Length > 0 )
4562 this.textBoxRESULTIMAGE.Text = strファイル名;
4567 #region [ Use 556 x 710 BGA/AVI ]
4568 private bool check556x710BGAAVI_以前の値 = false;
4569 private void check556x710BGAAVI_CheckedChanged(object sender, EventArgs e)
4571 // Undo/Redo リストを修正する。
4573 #region [ Undo/Redo リストを修正。]
4575 if (!CUndoRedo管理.bUndoRedoした直後)
4577 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4579 if ((oセル仮想 != null) && oセル仮想.b所有権がある(this.check556x710BGAAVI))
4583 ((CUndoRedoセル<bool>)oセル仮想).変更後の値 = this.check556x710BGAAVI.Checked;
4589 this.mgrUndoRedo管理者.tノードを追加する(
4590 new CUndoRedoセル<bool>(
4591 this.check556x710BGAAVI.Checked,
4592 new DGUndoを実行する<bool>(this.check556x710BGAAVI_Undo),
4593 new DGRedoを実行する<bool>(this.check556x710BGAAVI_Redo),
4594 this.check556x710BGAAVI_以前の値, this.check556x710BGAAVI.Checked));
4598 this.tUndoRedo用GUIの有効無効を設定する();
4607 this.check556x710BGAAVI_以前の値 = this.check556x710BGAAVI.Checked;
4612 CUndoRedo管理.bUndoRedoした直後 = false;
4615 private void check556x710BGAAVI_Leave(object sender, EventArgs e)
4617 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
4620 oセル仮想.t所有権の放棄(this.check556x710BGAAVI);
4622 private void check556x710BGAAVI_Undo(bool b変更前, bool b変更後)
4626 this.tタブを選択する(Eタブ種別.基本情報);
4628 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4629 this.check556x710BGAAVI.Checked = b変更前;
4631 this.check556x710BGAAVI.Focus();
4633 private void check556x710BGAAVI_Redo(bool b変更前, bool b変更後)
4637 this.tタブを選択する(Eタブ種別.基本情報);
4639 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
4640 this.check556x710BGAAVI.Checked = b変更後;
4642 this.check556x710BGAAVI.Focus();
4647 #region [ GUIイベント:WAVリスト関連 ]
4649 private void listViewWAVリスト_Click( object sender, EventArgs e )
4651 #region [ プレビュー音を再生する。]
4653 if( this.listViewWAVリスト.SelectedIndices.Count > 0 && this.toolStripButtonWAVリストプレビュースイッチ.Checked )
4655 ListViewItem item = this.listViewWAVリスト.Items[ this.listViewWAVリスト.SelectedIndices[ 0 ] ];
4656 this.mgrWAVリスト管理者.tプレビュー音を再生する( C変換.n36進数2桁の文字列を数値に変換して返す( item.SubItems[ 1 ].Text ) );
4661 private void listViewWAVリスト_DoubleClick( object sender, EventArgs e )
4663 #region [ サウンドプロパティを開いて編集する。]
4665 if( this.mgrWAVリスト管理者.n現在選択中のItem番号0to1294 < 0 )
4668 this.mgrWAVリスト管理者.tサウンドプロパティを開いて編集する( this.mgrWAVリスト管理者.n現在選択中のItem番号0to1294 + 1, this.str作業フォルダ名 );
4672 private void listViewWAVリスト_ItemDrag( object sender, ItemDragEventArgs e )
4674 #region [ CWAVデータをDragDrop用データに格納し、DoDragDrop()を呼び出す。]
4676 var item = (ListViewItem) e.Item;
4678 var data = new Cチップパレット向けDragDropデータ() {
4680 strラベル名 = item.SubItems[ 0 ].Text,
4681 n番号1to1295 = C変換.n36進数2桁の文字列を数値に変換して返す( item.SubItems[ 1 ].Text ),
4682 strファイル名 = item.SubItems[ 2 ].Text,
4683 col文字色 = item.ForeColor,
4684 col背景色 = item.BackColor,
4687 this.DoDragDrop( data, DragDropEffects.Copy );
4692 private void listViewWAVリスト_KeyPress( object sender, KeyPressEventArgs e )
4694 #region [ ENTER が押下されたら、サウンドプロパティを開いて編集する。]
4696 if( e.KeyChar == (char) Keys.Return )
4698 if( this.mgrWAVリスト管理者.n現在選択中のItem番号0to1294 < 0 )
4701 this.mgrWAVリスト管理者.tサウンドプロパティを開いて編集する( this.mgrWAVリスト管理者.n現在選択中のItem番号0to1294 + 1, this.str作業フォルダ名 );
4706 private void listViewWAVリスト_MouseEnter( object sender, EventArgs e )
4708 #region [ WAVリストにフォーカスを移動する。]
4710 if( this.appアプリ設定.AutoFocus )
4711 this.mgrWAVリスト管理者.tWAVリストにフォーカスを当てる();
4715 private void listViewWAVリスト_RetrieveVirtualItem( object sender, RetrieveVirtualItemEventArgs e )
4717 e.Item = this.mgrWAVリスト管理者.tCWAVとListViewItemを生成して返す( e.ItemIndex + 1 );
4719 private void listViewWAVリスト_SelectedIndexChanged( object sender, EventArgs e )
4721 #region [ WAV, BMP, AVI のカーソルを、選択された行に全部合わせる。]
4723 if( this.listViewWAVリスト.SelectedIndices.Count > 0 )
4724 this.tWAV_BMP_AVIリストのカーソルを全部同じ行に合わせる( this.listViewWAVリスト.SelectedIndices[ 0 ] );
4729 private void toolStripButtonWAVリストプレビュースイッチ_CheckStateChanged( object sender, EventArgs e )
4731 #region [ 再生ボタンと停止ボタンの有効・無効を設定する。]
4733 bool b再生有効 = ( this.toolStripButtonWAVリストプレビュースイッチ.CheckState == CheckState.Checked ) ? true : false;
4734 this.toolStripButtonWAVリストプレビュー再生開始.Enabled = b再生有効;
4735 this.toolStripButtonWAVリストプレビュー再生停止.Enabled = b再生有効;
4739 #region [ 無効かつ再生中ならプレビュー音を停止する。]
4742 this.mgrWAVリスト管理者.tプレビュー音を停止する();
4746 private void toolStripButtonWAVリストプレビュー再生開始_Click( object sender, EventArgs e )
4748 #region [ 現在選択中のWAVのプレビュー音を再生する。]
4750 if( this.listViewWAVリスト.SelectedIndices.Count <= 0 )
4753 bool b再生有効 = ( this.toolStripButtonWAVリストプレビュースイッチ.CheckState == CheckState.Checked ) ? true : false;
4757 int nWAV番号1to1295 = this.mgrWAVリスト管理者.n現在選択中のItem番号0to1294 + 1;
4758 this.mgrWAVリスト管理者.tプレビュー音を再生する( nWAV番号1to1295 );
4763 private void toolStripButtonWAVリストプレビュー再生停止_Click( object sender, EventArgs e )
4765 this.mgrWAVリスト管理者.tプレビュー音を停止する();
4767 private void toolStripButtonWAVリスト上移動_Click( object sender, EventArgs e )
4769 #region [ 上の行とWAVを交換する。]
4771 if( this.listViewWAVリスト.SelectedIndices.Count <= 0 )
4774 int n選択されたItem番号0to1294 = this.listViewWAVリスト.SelectedIndices[ 0 ];
4776 if( n選択されたItem番号0to1294 == 0 )
4779 this.mgrWAVリスト管理者.tItemを交換する( n選択されたItem番号0to1294, n選択されたItem番号0to1294 - 1 );
4783 private void toolStripButtonWAVリスト下移動_Click( object sender, EventArgs e )
4785 if( this.listViewWAVリスト.SelectedIndices.Count <= 0 )
4788 int n選択されたItem番号0to1294 = this.listViewWAVリスト.SelectedIndices[ 0 ];
4790 if( n選択されたItem番号0to1294 >= 1294 )
4793 this.mgrWAVリスト管理者.tItemを交換する( n選択されたItem番号0to1294, n選択されたItem番号0to1294 + 1 );
4797 #region [ GUIイベント:BMPリスト関連 ]
4799 private void listViewBMPリスト_Click( object sender, EventArgs e )
4803 private void listViewBMPリスト_DoubleClick( object sender, EventArgs e )
4805 #region [ 画像プロパティを開いて編集する。]
4807 if( this.mgrBMPリスト管理者.n現在選択中のItem番号0to1294 < 0 )
4810 this.mgrBMPリスト管理者.t画像プロパティを開いて編集する( this.mgrBMPリスト管理者.n現在選択中のItem番号0to1294 + 1, this.str作業フォルダ名 );
4814 private void listViewBMPリスト_ItemDrag( object sender, ItemDragEventArgs e )
4816 #region [ CBMPデータをDragDrop用データに格納し、DoDragDrop()を呼び出す。]
4818 var item = (ListViewItem) e.Item;
4820 var data = new Cチップパレット向けDragDropデータ() {
4822 strラベル名 = item.SubItems[ 1 ].Text,
4823 n番号1to1295 = C変換.n36進数2桁の文字列を数値に変換して返す( item.SubItems[ 2 ].Text ),
4824 strファイル名 = item.SubItems[ 3 ].Text,
4825 col文字色 = item.ForeColor,
4826 col背景色 = item.BackColor,
4829 this.DoDragDrop( data, DragDropEffects.Copy );
4833 private void listViewBMPリスト_KeyPress( object sender, KeyPressEventArgs e )
4835 #region [ ENTER が押下されたら、画像プロパティを開いて編集する。]
4837 if( e.KeyChar == (char) Keys.Return )
4839 if( this.mgrBMPリスト管理者.n現在選択中のItem番号0to1294 < 0 )
4842 this.mgrBMPリスト管理者.t画像プロパティを開いて編集する( this.mgrBMPリスト管理者.n現在選択中のItem番号0to1294 + 1, this.str作業フォルダ名 );
4847 private void listViewBMPリスト_MouseEnter( object sender, EventArgs e )
4849 #region [ BMPリストにフォーカスを移動する。]
4851 if( this.appアプリ設定.AutoFocus )
4852 this.mgrBMPリスト管理者.tBMPリストにフォーカスを当てる();
4856 private void listViewBMPリスト_RetrieveVirtualItem( object sender, RetrieveVirtualItemEventArgs e )
4858 e.Item = this.mgrBMPリスト管理者.tCBMPとListViewItemを生成して返す( e.ItemIndex + 1 );
4860 private void listViewBMPリスト_SelectedIndexChanged( object sender, EventArgs e )
4862 #region [ WAV, BMP, AVI のカーソルを、選択された行に全部合わせる。]
4864 if( this.listViewBMPリスト.SelectedIndices.Count > 0 )
4865 this.tWAV_BMP_AVIリストのカーソルを全部同じ行に合わせる( this.listViewBMPリスト.SelectedIndices[ 0 ] );
4870 private void toolStripButtonBMPリスト上移動_Click( object sender, EventArgs e )
4872 #region [ 上の行とBMPを交換する。]
4874 if( this.listViewBMPリスト.SelectedIndices.Count <= 0 )
4877 int n選択されたItem番号0to1294 = this.listViewBMPリスト.SelectedIndices[ 0 ];
4879 if( n選択されたItem番号0to1294 != 0 )
4880 this.mgrBMPリスト管理者.tItemを交換する( n選択されたItem番号0to1294, n選択されたItem番号0to1294 - 1 );
4884 private void toolStripButtonBMPリスト下移動_Click( object sender, EventArgs e )
4886 #region [ 下の行とBMPを交換する。]
4888 if( this.listViewBMPリスト.SelectedIndices.Count <= 0 )
4891 int n選択されたItem番号0to1294 = this.listViewBMPリスト.SelectedIndices[ 0 ];
4893 if( n選択されたItem番号0to1294 >= 1294 )
4896 this.mgrBMPリスト管理者.tItemを交換する( n選択されたItem番号0to1294, n選択されたItem番号0to1294 + 1 );
4902 #region [ GUIイベント:AVIリスト関連 ]
4904 private void listViewAVIリスト_Click( object sender, EventArgs e )
4908 private void listViewAVIリスト_DoubleClick( object sender, EventArgs e )
4910 #region [ 動画プロパティを開いて編集する。]
4912 if( this.mgrAVIリスト管理者.n現在選択中のItem番号0to1294 < 0 )
4915 this.mgrAVIリスト管理者.t動画プロパティを開いて編集する( this.mgrAVIリスト管理者.n現在選択中のItem番号0to1294 + 1, this.str作業フォルダ名 );
4919 private void listViewAVIリスト_ItemDrag( object sender, ItemDragEventArgs e )
4921 #region [ CAVIデータをDragDrop用データに格納してDoDragDrop()を呼び出す。]
4923 var item = (ListViewItem) e.Item;
4925 var data = new Cチップパレット向けDragDropデータ() {
4927 strラベル名 = item.SubItems[ 0 ].Text,
4928 n番号1to1295 = C変換.n36進数2桁の文字列を数値に変換して返す( item.SubItems[ 1 ].Text ),
4929 strファイル名 = item.SubItems[ 2 ].Text,
4930 col文字色 = item.ForeColor,
4931 col背景色 = item.BackColor,
4934 this.DoDragDrop( data, DragDropEffects.Copy );
4938 private void listViewAVIリスト_KeyPress( object sender, KeyPressEventArgs e )
4940 #region [ ENTER が押下されたら、動画プロパティを開いて編集する。]
4942 if( e.KeyChar == (char) Keys.Return )
4944 if( this.mgrAVIリスト管理者.n現在選択中のItem番号0to1294 < 0 )
4947 this.mgrAVIリスト管理者.t動画プロパティを開いて編集する( this.mgrAVIリスト管理者.n現在選択中のItem番号0to1294 + 1, this.str作業フォルダ名 );
4952 private void listViewAVIリスト_MouseEnter( object sender, EventArgs e )
4954 #region [ AVIリストにフォーカスを移動する。]
4956 if( this.appアプリ設定.AutoFocus )
4957 this.mgrAVIリスト管理者.tAVIリストにフォーカスを当てる();
4961 private void listViewAVIリスト_RetrieveVirtualItem( object sender, RetrieveVirtualItemEventArgs e )
4963 e.Item = this.mgrAVIリスト管理者.tCAVIとListViewItemを生成して返す( e.ItemIndex + 1 );
4965 private void listViewAVIリスト_SelectedIndexChanged( object sender, EventArgs e )
4967 #region [ WAV, BMP, AVI のカーソルを、選択された行に全部合わせる。]
4969 if( this.listViewAVIリスト.SelectedIndices.Count > 0 )
4970 this.tWAV_BMP_AVIリストのカーソルを全部同じ行に合わせる( this.listViewAVIリスト.SelectedIndices[ 0 ] );
4975 private void toolStripButtonAVIリスト上移動_Click( object sender, EventArgs e )
4977 #region [ 上の行とAVIを交換する。]
4979 if( this.listViewAVIリスト.SelectedIndices.Count <= 0 )
4982 int n選択されたItem番号0to1294 = this.listViewAVIリスト.SelectedIndices[ 0 ];
4984 if( n選択されたItem番号0to1294 == 0 )
4987 this.mgrAVIリスト管理者.tItemを交換する( n選択されたItem番号0to1294, n選択されたItem番号0to1294 - 1 );
4991 private void toolStripButtonAVIリスト下移動_Click( object sender, EventArgs e )
4993 #region [ 下の行とAVIを交換する。]
4995 if( this.listViewAVIリスト.SelectedIndices.Count <= 0 )
4998 int n選択されたItem番号0to1294 = this.listViewAVIリスト.SelectedIndices[ 0 ];
5000 if( n選択されたItem番号0to1294 >= 1294 )
5003 this.mgrAVIリスト管理者.tItemを交換する( n選択されたItem番号0to1294, n選択されたItem番号0to1294 + 1 );
5009 #region [ GUIイベント:自由入力関連 ]
5011 private string textBox自由入力欄_以前の値 = "";
5012 private void textBox自由入力欄_TextChanged( object sender, EventArgs e )
5014 // Undo/Redo リストを修正。
5016 #region [ Undo/Redo リストを修正する。]
5018 if( !CUndoRedo管理.bUndoRedoした直後 )
5020 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
5022 if( ( oセル仮想 != null ) && oセル仮想.b所有権がある( this.textBox自由入力欄 ) )
5026 ( (CUndoRedoセル<string>) oセル仮想 ).変更後の値 = this.textBox自由入力欄.Text;
5032 this.mgrUndoRedo管理者.tノードを追加する(
5033 new CUndoRedoセル<string>(
5035 new DGUndoを実行する<string>( this.textBox自由入力欄_Undo ),
5036 new DGRedoを実行する<string>( this.textBox自由入力欄_Redo ),
5037 this.textBox自由入力欄_以前の値, this.textBox自由入力欄.Text ) );
5042 this.tUndoRedo用GUIの有効無効を設定する();
5051 this.textBox自由入力欄_以前の値 = this.textBox自由入力欄.Text;
5056 CUndoRedo管理.bUndoRedoした直後 = false;
5059 private void textBox自由入力欄_Leave( object sender, EventArgs e )
5061 CUndoRedoセル仮想 oセル仮想 = this.mgrUndoRedo管理者.tUndoするノードを取得して返す_見るだけ();
5064 oセル仮想.t所有権の放棄( this.textBox自由入力欄 );
5066 private void textBox自由入力欄_Undo( string str変更前, string str変更後 )
5070 this.tタブを選択する( Eタブ種別.自由入力 );
5072 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
5073 this.textBox自由入力欄.Text = str変更前;
5075 this.textBox自由入力欄.Focus();
5077 private void textBox自由入力欄_Redo( string str変更前, string str変更後 )
5081 this.tタブを選択する( Eタブ種別.自由入力 );
5083 this.t次のプロパティ変更処理がUndoRedoリストに載らないようにする();
5084 this.textBox自由入力欄.Text = str変更後;
5086 this.textBox自由入力欄.Focus();
5091 #region [ GUIイベント:メニューバー [ファイル] ]
5093 private void toolStripMenuItem新規_Click( object sender, EventArgs e )
5097 private void toolStripMenuItem開く_Click( object sender, EventArgs e )
5101 private void toolStripMenuItem上書き保存_Click( object sender, EventArgs e )
5105 private void toolStripMenuItem名前を付けて保存_Click( object sender, EventArgs e )
5107 this.tシナリオ_名前をつけて保存();
5109 private void exportMIDIFileToolStripMenuItem_Click_1(object sender, EventArgs e)
5111 this.mgrMIDIExportManager.tOpenMIDIExportManagerFromMenu();
5112 this.mgr譜面管理者.tRefreshDisplayLanes(); // レーンの表示/非表示切り替えに備えて追加
5115 private void toolStripMenuItem終了_Click( object sender, EventArgs e )
5119 private void toolStripMenuItem最近使ったファイル_Click( object sender, EventArgs e )
5121 // ※このイベントハンドラに対応する「toolStripMenuItem最近使ったファイル」というアイテムはデザイナにはないので注意。
5122 // this.t最近使ったファイルをFileメニューへ追加する() の中で、手動で作って追加したアイテムに対するハンドラである。
5124 if( this.t未保存なら保存する() == DialogResult.Cancel )
5127 this.t演奏ファイルを開いて読み込む( ( (ToolStripMenuItem) sender ).ToolTipText );
5131 #region [ GUIイベント:メニューバー [編集] ]
5133 private void toolStripMenuItemアンドゥ_Click( object sender, EventArgs e )
5135 this.tシナリオ_Undoする();
5137 private void toolStripMenuItemリドゥ_Click( object sender, EventArgs e )
5139 this.tシナリオ_Redoする();
5141 private void toolStripMenuItem切り取り_Click( object sender, EventArgs e )
5145 private void toolStripMenuItemコピー_Click( object sender, EventArgs e )
5149 private void toolStripMenuItem貼り付け_Click( object sender, EventArgs e )
5151 // マウスが譜面上にあるならそこから貼り付ける。
5153 Point ptマウス位置 = this.pt現在のマウス位置を譜面の可視領域相対の座標dotで返す();
5154 Size sz譜面の可視サイズ = this.sz譜面の可視領域の大きさdotを返す();
5157 if( ( ( ptマウス位置.X < 0 ) || ( ptマウス位置.Y < 0 ) ) || ( ( ptマウス位置.X > sz譜面の可視サイズ.Width ) || ( ptマウス位置.Y > sz譜面の可視サイズ.Height ) ) )
5159 // マウスが譜面上になかった → 表示領域下辺から貼り付ける
5161 this.tシナリオ_貼り付け( this.mgr譜面管理者.n現在の譜面表示下辺の譜面先頭からの位置grid );
5167 this.tシナリオ_貼り付け( this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( ptマウス位置.Y ) );
5170 private void toolStripMenuItem削除_Click( object sender, EventArgs e )
5174 private void toolStripMenuItemすべて選択_Click( object sender, EventArgs e )
5176 // 編集モードなら強制的に選択モードにする。
5178 if( this.b編集モードである )
5184 this.mgr選択モード管理者.t全チップを選択する();
5186 private void toolStripMenuItem選択モード_Click( object sender, EventArgs e )
5190 private void toolStripMenuItem編集モード_Click( object sender, EventArgs e )
5194 private void toolStripMenuItemモード切替_Click( object sender, EventArgs e )
5196 if( this.b選択モードである )
5205 private void toolStripMenuItem検索_Click( object sender, EventArgs e )
5209 private void toolStripMenuItem置換_Click( object sender, EventArgs e )
5215 #region [ GUIイベント:メニューバー [表示] ]
5217 private void toolStripMenuItemチップパレット_Click( object sender, EventArgs e )
5219 if( this.toolStripMenuItemチップパレット.CheckState == CheckState.Checked )
5221 this.dlgチップパレット.t表示する();
5225 this.dlgチップパレット.t隠す();
5228 private void toolStripMenuItemガイド間隔4分_Click( object sender, EventArgs e )
5230 this.tガイド間隔を変更する( 4 );
5232 private void toolStripMenuItemガイド間隔8分_Click( object sender, EventArgs e )
5234 this.tガイド間隔を変更する( 8 );
5236 private void toolStripMenuItemガイド間隔12分_Click( object sender, EventArgs e )
5238 this.tガイド間隔を変更する( 12 );
5240 private void toolStripMenuItemガイド間隔16分_Click( object sender, EventArgs e )
5242 this.tガイド間隔を変更する( 0x10 );
5244 private void toolStripMenuItemガイド間隔24分_Click( object sender, EventArgs e )
5246 this.tガイド間隔を変更する( 0x18 );
5248 private void toolStripMenuItemガイド間隔32分_Click( object sender, EventArgs e )
5250 this.tガイド間隔を変更する( 0x20 );
5252 private void toolStripMenuItemガイド間隔48分_Click( object sender, EventArgs e )
5254 this.tガイド間隔を変更する( 0x30 );
5256 private void toolStripMenuItemガイド間隔64分_Click( object sender, EventArgs e )
5258 this.tガイド間隔を変更する( 0x40 );
5260 private void toolStripMenuItemガイド間隔フリー_Click( object sender, EventArgs e )
5262 this.tガイド間隔を変更する( 0 );
5264 private void toolStripMenuItemガイド間隔拡大_Click( object sender, EventArgs e )
5266 switch( this.n現在のガイド間隔4to64or0 )
5269 case 8: this.tガイド間隔を変更する( 4 ); break;
5270 case 12: this.tガイド間隔を変更する( 8 ); break;
5271 case 16: this.tガイド間隔を変更する( 12 ); break;
5272 case 24: this.tガイド間隔を変更する( 16 ); break;
5273 case 32: this.tガイド間隔を変更する( 24 ); break;
5274 case 48: this.tガイド間隔を変更する( 32 ); break;
5275 case 64: this.tガイド間隔を変更する( 48 ); break;
5276 case 0: this.tガイド間隔を変更する( 64 ); break;
5279 private void toolStripMenuItemガイド間隔縮小_Click( object sender, EventArgs e )
5281 switch( this.n現在のガイド間隔4to64or0 )
5283 case 4: this.tガイド間隔を変更する( 8 ); break;
5284 case 8: this.tガイド間隔を変更する( 12 ); break;
5285 case 12: this.tガイド間隔を変更する( 16 ); break;
5286 case 16: this.tガイド間隔を変更する( 24 ); break;
5287 case 24: this.tガイド間隔を変更する( 32 ); break;
5288 case 32: this.tガイド間隔を変更する( 48 ); break;
5289 case 48: this.tガイド間隔を変更する( 64 ); break;
5290 case 64: this.tガイド間隔を変更する( 0 ); break;
5296 #region [ GUIイベント:メニューバー [再生] ]
5298 private void toolStripMenuItem先頭から再生_Click( object sender, EventArgs e )
5300 this.tシナリオ_Viewerで最初から再生する();
5302 private void toolStripMenuItem現在位置から再生_Click( object sender, EventArgs e )
5304 this.tシナリオ_Viewerで現在位置から再生する();
5306 private void toolStripMenuItem現在位置からBGMのみ再生_Click( object sender, EventArgs e )
5308 this.tシナリオ_Viewerで現在位置からBGMのみ再生する();
5310 private void toolStripMenuItem再生停止_Click( object sender, EventArgs e )
5312 this.tシナリオ_Viewerを再生停止する();
5316 #region [ GUIイベント:メニューバー [ツール] ]
5318 private void toolStripMenuItemオプション_Click( object sender, EventArgs e )
5320 this.mgrオプション管理者.tオプションダイアログを開いて編集し結果をアプリ設定に格納する();
5321 this.mgr譜面管理者.tRefreshDisplayLanes(); // レーンの表示/非表示切り替えに備えて追加
5323 private void toolStripMenuItemMIDIImport_Click( object sender, EventArgs e)
5325 this.mgrMIDIインポート管理者.tMIDIインポート管理をインポートメニューから開く();
5326 this.mgr譜面管理者.tRefreshDisplayLanes(); // レーンの表示/非表示切り替えに備えて追加
5328 private void exportMIDIFileToolStripMenuItem_Click(object sender, EventArgs e)
5330 this.mgrMIDIExportManager.tOpenMIDIExportManagerFromMenu();
5331 this.mgr譜面管理者.tRefreshDisplayLanes(); // レーンの表示/非表示切り替えに備えて追加
5336 #region [ GUIイベント:メニューバー [ヘルプ] ]
5338 private void toolStripMenuItemDTXCreaterマニュアル_Click( object sender, EventArgs e )
5342 // マニュアルサイトをブラウザで開く。
5343 string strURL = (CultureInfo.CurrentUICulture.Name == "ja-JP")?
5344 "https://osdn.net/projects/dtxmania/wiki/faq_index#h2-DTX.E3.83.87.E3.83.BC.E3.82.BF.E5.88.B6.E4.BD.9C.E8.80.85.E5.90.91.E3.81.91.E3.81.AE.E3.82.88.E3.81.8F.E3.81.82.E3.82.8B.E8.B3.AA.E5.95.8F"
5345 : "https://osdn.net/projects/dtxmania/wiki/faq_index_e#h2-For.20DTX.20data.20Manipulators";
5346 Process.Start(strURL);
5350 //this.toolStripMenuItemDTXCreaterマニュアル.Enabled = false;
5353 private void toolStripMenuItemバージョン_Click( object sender, EventArgs e )
5355 this.dlgチップパレット.t一時的に隠蔽する();
5357 Cバージョン情報 cバージョン情報 = new Cバージョン情報();
5358 cバージョン情報.ShowDialog();
5361 this.dlgチップパレット.t一時的な隠蔽を解除する();
5366 #region [ GUIイベント:ツールバー ]
5368 private void toolStripButton新規作成_Click( object sender, EventArgs e )
5372 private void toolStripButton開く_Click( object sender, EventArgs e )
5376 private void toolStripButton上書き保存_Click( object sender, EventArgs e )
5380 private void toolStripButton切り取り_Click( object sender, EventArgs e )
5384 private void toolStripButtonコピー_Click( object sender, EventArgs e )
5388 private void toolStripButton貼り付け_Click( object sender, EventArgs e )
5390 // マウスが譜面上にあるならそこから貼り付ける。
5392 Point ptマウスの位置 = this.pt現在のマウス位置を譜面の可視領域相対の座標dotで返す();
5393 Size sz譜面の可視サイズ = this.sz譜面の可視領域の大きさdotを返す();
5396 if( ( ( ptマウスの位置.X < 0 ) || ( ptマウスの位置.Y < 0 ) ) || ( ( ptマウスの位置.X > sz譜面の可視サイズ.Width ) || ( ptマウスの位置.Y > sz譜面の可視サイズ.Height ) ) )
5398 // マウスが譜面上になかった → 表示領域下辺から貼り付ける
5400 this.tシナリオ_貼り付け( this.mgr譜面管理者.n現在の譜面表示下辺の譜面先頭からの位置grid );
5406 this.tシナリオ_貼り付け( this.mgr譜面管理者.nY座標dotが位置するgridを返す_ガイド幅単位( ptマウスの位置.Y ) );
5409 private void toolStripButton削除_Click( object sender, EventArgs e )
5413 private void toolStripButtonアンドゥ_Click( object sender, EventArgs e )
5415 this.tシナリオ_Undoする();
5417 private void toolStripButtonリドゥ_Click( object sender, EventArgs e )
5419 this.tシナリオ_Redoする();
5421 private void toolStripButtonチップパレット_Click( object sender, EventArgs e )
5423 if( this.toolStripButtonチップパレット.CheckState == CheckState.Checked )
5425 this.dlgチップパレット.t表示する();
5429 this.dlgチップパレット.t隠す();
5432 private void toolStripComboBox譜面拡大率_SelectedIndexChanged( object sender, EventArgs e )
5434 C小節.n基準の高さdot = CWholeNoteDivision.n分解能_表示用 * ( this.toolStripComboBox譜面拡大率.SelectedIndex + 1 );
5436 this.pictureBox譜面パネル.Refresh();
5438 private void toolStripComboBoxガイド間隔_SelectedIndexChanged( object sender, EventArgs e )
5440 switch( this.toolStripComboBoxガイド間隔.SelectedIndex )
5443 this.tガイド間隔を変更する( 4 );
5447 this.tガイド間隔を変更する( 8 );
5451 this.tガイド間隔を変更する( 12 );
5455 this.tガイド間隔を変更する( 16 );
5459 this.tガイド間隔を変更する( 24 );
5463 this.tガイド間隔を変更する( 32 );
5467 this.tガイド間隔を変更する( 48 );
5471 this.tガイド間隔を変更する( 64 );
5475 this.tガイド間隔を変更する( 0 );
5479 private void toolStripButton選択モード_Click( object sender, EventArgs e )
5483 private void toolStripButton編集モード_Click( object sender, EventArgs e )
5487 private void toolStripButton先頭から再生_Click( object sender, EventArgs e )
5489 this.tシナリオ_Viewerで最初から再生する();
5491 private void toolStripButton現在位置から再生_Click( object sender, EventArgs e )
5493 this.tシナリオ_Viewerで現在位置から再生する();
5495 private void toolStripButton現在位置からBGMのみ再生_Click( object sender, EventArgs e )
5497 this.tシナリオ_Viewerで現在位置からBGMのみ再生する();
5499 private void toolStripButton再生停止_Click( object sender, EventArgs e )
5501 this.tシナリオ_Viewerを再生停止する();
5504 //private void ToolStripMenuItemBeatChipsGeneration_Click( object sender, EventArgs e ) // Beat Detections
5506 // GenarateBeatChip_Main();
5510 // 2度続けて実行するとチップが増えておかしくなる?要調査。
5511 private void GenarateBeatChip_Main()
5513 string filename = "";
5515 #region [ BGM, BPM, BEATレーンのレーン番号を取得 ]
5516 int laneBGM = this.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BGM" );
5517 int laneBPM = this.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BPM" );
5518 int laneBEAT = this.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BEAT" );
5521 #region [ BGMレーンにあるチップを抽出して、beat検出する対象のサウンドファイルを決める ]
5522 // とりあえずBGMチップは1個しかない前提で進める。追々、複数のBGMチップでも動作するようにはしたい。
5523 #region [ BGMチップ抽出 ]
5524 int nBGMチップの小節番号 = -1;
5525 int nBGMチップのindex = -1;
5526 foreach ( KeyValuePair<int, C小節> pair in this.mgr譜面管理者.dic小節 )
5528 C小節 c小節 = pair.Value;
5529 nBGMチップのindex = c小節.listチップ.FindIndex(
5530 delegate( Cチップ cチップ )
5532 return ( cチップ.nレーン番号0to == laneBGM );
5535 if ( nBGMチップのindex >= 0 )
5537 nBGMチップの小節番号 = c小節.n小節番号0to3599;
5538 filename = this.mgrWAVリスト管理者.tファイル名を絶対パスで返す( c小節.listチップ[ nBGMチップのindex ].n値_整数1to1295);
5539 Debug.WriteLine( filename );
5540 break; // とりあえず1個見つけたらbreakしちゃう
5542 //for ( int i = 0; i < c小節.listチップ.Count; i++ )
5544 //Cチップ cチップ = c小節.listチップ[ i ];
5545 //if ( cチップ.nレーン番号0to == lane )
5547 // nBGMチップのindex = i;
5548 // filename = this.mgrWAVリスト管理者.tファイル名を絶対パスで返す( cチップ.n値・整数1to1295 );
5549 // Debug.WriteLine( filename );
5553 if ( filename == "" )
5555 MessageBox.Show( "BGMチップが配置されていません。BGMチップを1つ配置してください。", "BGMチップ検出エラー", MessageBoxButtons.OK, MessageBoxIcon.Error );
5561 #region [ マウスカーソルを待機中に変更 (アプリウインドウ外で右クリックメニュー選択していると、効果がない・・・) ]
5562 this.Cursor = Cursors.WaitCursor;
5565 #region [ BPM,BEATレーンの情報を消去 ]
5566 this.mgr選択モード管理者.tレーン上の全チップを選択する( laneBPM );
5568 this.mgr選択モード管理者.tレーン上の全チップを選択する( laneBEAT );
5573 #region [ BASSFXのBeat detectionを実行する ]
5574 FDK.CBeatDetect cbd = new CBeatDetect( filename );
5576 float tempo = cbd.GetTempo();
5577 // Debug.WriteLine( "BPM=" + tempo );
5579 List<FDK.CBeatDetect.stBeatPos> listBeatPositions = cbd.GetBeatPositions();
5580 // Debug.WriteLine( "Count: " + listBeatPositions.Count );
5583 // 四分音符以下、8分音符以下などと選べるようにしたい。
5584 #region [ 四分音符以下の間隔で検出されたbeatを、端折る。端折らないと、検出beat数が多過ぎて、人が扱えなくなる。ただ、端折り方はもう少し熟慮が必要。]
5586 float minBeatDelta = 60.0f / tempo; // 4分音符の長さ
5589 // 最初の10個くらいは、端折らない。まず拍の頭をとるのに必要な情報を落とすわけにはいかないので。
5590 // 10個目以降は、四分音符未満の長さのbeatを、端折る。(裏BEATレーンに回す)
5591 //if ( listBeatPositions.Count > 10 )
5593 // for ( int i = count; i < listBeatPositions.Count; i++ )
5595 // if ( listBeatPositions[ i ].fBeatTime - last < minBeatDelta )
5597 // FDK.CBeatDetect.stBeatPos sbp = new CBeatDetect.stBeatPos(
5598 // listBeatPositions[ i ].fBeatTime,
5602 // ( listBeatPositions[ i ].fBeatTime - last < minBeatDelta ),
5606 // listBeatPositions[ i ] = sbp;
5608 // last = listBeatPositions[ i ].fBeatTime;
5613 #region [ ただのデバッグ表示 ]
5615 //for ( int i = 0; i < listBeatPositions.Count; i++ )
5617 // //Debug.WriteLine( listBeatPositionsLight[ i ] - last );
5618 // Debug.WriteLine( listBeatPositions[ i ].fBeatTime );
5619 // last = listBeatPositions[ i ].fBeatTime;
5621 //Debug.WriteLine( "========================" );
5624 #region [ 未使用: 端折った区間内で、それぞれBPMを再取得してみる → これは意味なし。1つのbeatしか得られないため、正しいBPMを取得できない。]
5625 //List<float> listTempo_interval = new List<float>();
5627 //for ( int i = 0; i < listBeatPositionsLight.Count - 1; i++ )
5629 // listTempo_interval.Add( cbd.GetTempo( last, listBeatPositionsLight[ i ] ) );
5630 // last = listBeatPositionsLight[ i ];
5631 // Debug.WriteLine( listTempo_interval[ i ] );
5636 int n1拍目のBeatPositionIndex = 0;
5638 #region [ 1小節目の頭に1発目の拍が来るよう、BGMチップをずらす。ただしこれだけだと、最大1grid分の時間誤差が発生する。(BPM=125時に最大10msの誤差)]
5640 if ( nBGMチップの小節番号 >= 0 && nBGMチップのindex >= 0 )
5642 // float f小節長倍率 = 1.0f;
5643 C小節 c小節_0小節目 = this.mgr譜面管理者.dic小節[ nBGMチップの小節番号 ];
5644 Cチップ cチップBGM = c小節_0小節目.listチップ[ nBGMチップのindex ];
5645 nBGM位置grid = (int) ( CWholeNoteDivision.n分解能 * c小節_0小節目.f小節長倍率 * listBeatPositions[ n1拍目のBeatPositionIndex ].fBeatTime / ( ( 60 * 4 ) / tempo ) + 0.5 );
5646 // ここでnBGM位置Gridが192(x小節長)を超えることがある
5647 // → 192(x小節長)をひいて、次の小節に回す。(小節ごとに小節長倍率が変化する可能性があることに注意)
5648 // → スマン、この実装ではまだ、DTXデータの最初はしばらく小節倍率が一定である前提になっちゃってる・・
5649 cチップBGM.n位置grid = (int) ( CWholeNoteDivision.n分解能 * c小節_0小節目.f小節長倍率 + 0.5f ) - ( nBGM位置grid % CWholeNoteDivision.n分解能 ); // "192-" が必要なことに注意
5650 c小節_0小節目.listチップ[ nBGMチップのindex ] = cチップBGM;
5651 this.mgr譜面管理者.dic小節[ nBGMチップの小節番号 ] = c小節_0小節目;
5655 #region [ 0小節目のBPMを設定し、1つ目の拍が1小節目の頭に来るようにする。]
5656 // まず、0小節の頭にBPM設定を追加する。
5657 this.mgr編集モード管理者.tBPMチップを配置する( 0 * CWholeNoteDivision.n分解能, tempo ); // 既にBPMチップが配置されている場合の処理は????????????????
5658 this.numericUpDownBPM.Value = (decimal) ( (int) ( tempo + 0.5 ) );
5659 numericUpDownBPM_ValueChanged( null, null );
5660 numericUpDownBPM_Leave( null, null );
5662 // 更に、先の1グリッド分の誤差をなくすために、BGMチップの位置だけでなく、0小節目のBPMも微調整する。
5663 float f小節長倍率_ = this.mgr譜面管理者.dic小節[ nBGMチップの小節番号 ].f小節長倍率; // 手抜き。すまん。
5664 float fBGM再生直後のBPM = ( 60 * 4 ) * nBGM位置grid / ( CWholeNoteDivision.n分解能 * f小節長倍率_ ) / listBeatPositions[ n1拍目のBeatPositionIndex ].fBeatTime;
5665 this.mgr編集モード管理者.tBPMチップを配置する( CWholeNoteDivision.n分解能 - ( nBGM位置grid % CWholeNoteDivision.n分解能 ), fBGM再生直後のBPM );
5670 // 頭の1個目のBEATチップがちゃんと配置されてないよ!!!!!
5674 #region [ BEATレーンにチップを配置する ]
5675 // int lastGrid = (int) ( 192 * this.mgr譜面管理者.dic小節[ 0 ].f小節長倍率 ); // 0小節目の倍率
5676 //int last小節内Grid = 0;
5677 //int last小節番号 = nBGMチップの小節番号;
5678 int n最初の拍のある小節番号 = 1 + ( nBGM位置grid / CWholeNoteDivision.n分解能 );
5679 float lastBeatTime = listBeatPositions[ n1拍目のBeatPositionIndex ].fBeatTime;
5682 for ( int index = n1拍目のBeatPositionIndex; index < listBeatPositions.Count; index++ )
5684 //Debug.Write( "[" + index + "] " );
5686 // 今注目しているBEATチップが、どの小節・拍(grid)に収まるかを計算する
5687 // // 誤差を小さくするため、直前のBEATポイントからの相対位置として計算すること。
5688 // // 絶対位置で計算すると、最初のBPM計算の誤差がそのままBEAT位置に現れる。 // やり残し★★★★★★
5689 // // ...としたいのだが、まだできてない。全部絶対位置で計算している。
5690 FDK.CBeatDetect.stBeatPos sbp = listBeatPositions[ index ];
5692 float deltatime = sbp.fBeatTime - lastBeatTime;
5693 //Debug.Write( "delta=" + deltatime );
5694 int n小節番号 = n最初の拍のある小節番号;
5695 float f1小節の時間 = ( 60 / tempo ) * 4;
5697 if ( deltatime < 0 )
5699 while ( n小節番号 >= 0 && deltatime < 0 )
5702 deltatime += f1小節の時間 * this.mgr譜面管理者.dic小節[ n小節番号 ].f小節長倍率;
5703 //(int) ( 192 * this.mgr譜面管理者.dic小節[ n小節番号 ].f小節長倍率 ); // 0小節目の倍率
5705 if ( deltatime < 0 )
5707 Debug.WriteLine( "[" + index + "]: deltatime < 0; error (" + deltatime );
5712 #region [ 1小節目以降の場合 ]
5715 //Debug.Write( " + " + f1小節の時間 * this.mgr譜面管理者.dic小節[ n小節番号 ].f小節長倍率 * last小節内Grid / 192 + "(" + lastGrid + "|" + last小節内Grid +")=" );
5716 // deltatime += f1小節の時間 * this.mgr譜面管理者.dic小節[ n小節番号 ].f小節長倍率 * last小節内Grid / 192; // 直前のgrid(その小節の頭から)の分
5717 //Debug.WriteLine( deltatime );
5720 if ( deltatime < f1小節の時間 * this.mgr譜面管理者.dic小節[ n小節番号 ].f小節長倍率 )
5726 #region [ 小節ノードが不足しているなら、追加する ]
5727 if ( this.mgr譜面管理者.n現在の最大の小節番号を返す() < n小節番号 )
5729 for ( int i = n小節番号; i < n小節番号 + 5; i++ )
5731 this.mgr譜面管理者.dic小節.Add( i, new C小節( i ) );
5732 this.mgrUndoRedo管理者.tノードを追加する( new CUndoRedoセル<int>( null, new DGUndoを実行する<int>( this.mgr譜面管理者.t小節挿入のUndo ), new DGRedoを実行する<int>( this.mgr譜面管理者.t小節挿入のRedo ), i, i ) );
5737 deltatime -= f1小節の時間 * this.mgr譜面管理者.dic小節[ n小節番号 ].f小節長倍率;
5739 if ( deltatime < 0 )
5741 Debug.WriteLine( "[" + index + "]: deltatime < 0; error (" + deltatime );
5748 // ここで、更にgridを得たうえで、16分音符相当にquantizeして、BEATチップの位置とする
5750 #region [ BEATチップを置く ]
5751 float f小節長倍率 = this.mgr譜面管理者.dic小節[ n小節番号 ].f小節長倍率;
5752 int n小節内Grid = (int) ( CWholeNoteDivision.n分解能 * f小節長倍率 * deltatime / ( ( 60 * 4 ) / tempo ) + 0.5 );
5754 #region [ Gridを16分音符単位(==12grid単位)でquantizeする ]
5755 //Debug.Write( "nGrid: " + n小節内Grid + " -> " );
5756 n小節内Grid = ( ( n小節内Grid + 6 ) / 12 ) * 12;
5757 //Debug.WriteLine( n小節内Grid );
5760 int nGrid = this.mgr譜面管理者.n譜面先頭からみた小節先頭の位置gridを返す( n小節番号 ) + n小節内Grid;
5762 if ( lastnGrid != nGrid )
5764 // indexを+1しているのは、チップ番号を01から開始するため。
5765 this.mgr編集モード管理者.tBeatチップを配置する( nGrid, index + 1, sbp.fBeatTime, sbp.b無効 );
5766 // this.mgr編集モード管理者.tHHチップを配置する( nGrid, 1, sbp.b無効 ); // デバッグ用・見やすくするために暫定的に。
5769 listBeatPositions[ index ] = sbp; // Grid情報を入れて、listを更新 (この情報はBPx挿入時に使う)
5775 //last小節内Grid = n小節内Grid;
5777 //lastBeatTime = sbp.fBeatTime;
5780 //Debug.WriteLine( "[" + index + "]: n小節番号=" + n小節番号 + ", Grid= " + n小節内Grid + "/" + nGrid + ", BeatTime=" + sbp.fBeatTime + ", 裏=" + sbp.b無効 );
5784 BPMchipsGeneneration_Main();
5789 #region [ Beatレーンを表示する ]
5790 this.mgr譜面管理者.listレーン[ laneBEAT ].bIsVisible = true;
5794 this.pictureBox譜面パネル.Invalidate();
5798 #region [ listBeatPositionsの開放 ]
5799 listBeatPositions.Clear();
5800 listBeatPositions = null;
5803 #region [ マウスカーソルの形を元に戻す ]
5804 this.Cursor = Cursors.Default;
5808 //private void ToolStripMenuItemBPMChipsGeneration_Click( object sender, EventArgs e )
5810 // BPMchipsGeneneration_Main();
5813 private void BPMchipsGeneneration_Main()
5815 #region [ BPMレーンとHHレーンを消去(0小節目を除く) ]
5816 int laneBPM = this.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BPM" );
5817 this.mgr選択モード管理者.tレーン上の全チップを選択する( laneBPM, 1 );
5820 #region [ デバッグ用: HHレーンを消去 ]
5821 int laneHH = this.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "HH" );
5822 this.mgr選択モード管理者.tレーン上の全チップを選択する( laneHH, 1 );
5827 //★★★★小節長1.00以外の場合に後で対応のこと。
5828 #region [ BEATレーンから、listBestPositionを生成 ]
5829 int laneBEAT = this.mgr譜面管理者.nレーン名に対応するレーン番号を返す( "BEAT" );
5830 //Debug.WriteLine( "laneBEAT=" + laneBEAT );
5831 List<FDK.CBeatDetect.stBeatPos> listBeatPositions = new List<CBeatDetect.stBeatPos>();
5832 foreach ( KeyValuePair<int, C小節> pair in this.mgr譜面管理者.dic小節 )
5834 C小節 c小節 = pair.Value;
5835 for ( int index = 0; index < c小節.listチップ.Count; index++ )
5837 if ( c小節.listチップ[ index ].nレーン番号0to == laneBEAT &&
5838 !c小節.listチップ[ index ].b裏 )
5840 int n小節番号 = c小節.n小節番号0to3599;
5841 //Debug.WriteLine( "n小節番号=" + c小節.n小節番号0to3599 + ", 小節内Grid=" + c小節.listチップ[ index ].n位置grid + ",lane=" + c小節.listチップ[ index ].nレーン番号0to + ", f値=" + c小節.listチップ[ index ].f値・浮動小数 );
5844 listBeatPositions.Add(
5845 new CBeatDetect.stBeatPos(
5846 c小節.listチップ[ index ].f値_浮動小数,
5848 this.mgr譜面管理者.n譜面先頭からみた小節先頭の位置gridを返す( n小節番号 ) + c小節.listチップ[ index ].n位置grid,
5849 c小節.listチップ[ index ].n位置grid,
5850 c小節.listチップ[ index ].b裏,
5857 //Debug.WriteLine( "N小節番号=" + c小節.n小節番号0to3599 + ", 小節内Grid=" + c小節.listチップ[ index ].n位置grid + ",lane=" + c小節.listチップ[ index ].nレーン番号0to + ", f値=" + c小節.listチップ[ index ].f値・浮動小数 );
5864 #region [ BEATチップの位置に合わせて、BPMを計算し、BPxチップを配置する ]
5866 int n1拍目のBeatPositionIndex = 0;
5869 for ( int index = n1拍目のBeatPositionIndex; index < listBeatPositions.Count; index++ )
5871 if ( listBeatPositions[ index ].b無効 )
5875 #region [ 次の有効なBeatPointを検出する ]
5877 for ( int i = index + 1; i < listBeatPositions.Count; i++ )
5879 if ( listBeatPositions[ i ].bレーン表示する && !listBeatPositions[ i ].b無効 )
5880 //if ( listBeatPositions[ i ].bレーン表示する )
5888 #region [ BPMチップを置く]
5889 //int lastgrid = (int) ( 192 * this.mgr譜面管理者.dic小節[ 0 ].f小節長倍率 ); // 0小節目の倍率
5890 //int lastindex = n1拍目のBeatPositionIndex;
5891 //int last小節番号 = nBGMチップの小節番号;
5893 if ( nextIndex >= 0 )
5895 float deltatime = listBeatPositions[ nextIndex ].fBeatTime - listBeatPositions[ index ].fBeatTime;
5896 //Debug.WriteLine( "deltatime=" + deltatime+ ", nextIndex=" + nextIndex + ", fBeatTime(nextIndex)=" + listBeatPositions[ nextIndex ].fBeatTime+ ", index=" + index + ", fBeatTIme(index) =" + listBeatPositions[ index ].fBeatTime );
5898 //int current小節番号 = listBeatPositionsLight[ index ].n小節番号;
5899 //int next小節番号 = listBeatPositionsLight[ nextIndex ].n小節番号;
5900 int deltagrid = listBeatPositions[ nextIndex ].nGrid - listBeatPositions[ index ].nGrid;
5901 //Debug.WriteLine( "deltagrid=" + deltagrid + ", nextIndex=" + nextIndex + ", nGrid(nextIndex)=" + listBeatPositions[ nextIndex ].nGrid + ", index=" + index + ", nGrid(index) =" + listBeatPositions[ index ].nGrid );
5902 float fBPM = 60.0f / ( deltatime / deltagrid * 48 ); // 四分音符==48grid
5903 //Debug.WriteLine( "fBPM=" + fBPM + ", deltatime=" + deltatime + ", deltagrid=" + deltagrid );
5905 // BPMチップを配置する(裏BEATチップに対しては、配置しない)
5906 if ( nextIndex >= 0 )
5908 this.mgr編集モード管理者.tBPMチップを配置する( listBeatPositions[ index ].nGrid, fBPM );
5909 // Debug.WriteLine( " tBPM: #" + index + "=" + fBPM );
5913 //this.mgr編集モード管理者.tHHチップを配置する( listBeatPositions[ index ].nGrid, 1, listBeatPositions[ index ].b無効 ); // デバッグ用・見やすくするために暫定的に。
5915 // Debug.WriteLine( "(" + index + "->" + nextIndex + "): BPM=" + fBPM + ", nGrid=" + listBeatPositions[ index ].nGrid + ", deltagrid=" + deltagrid +" , deltatime=" + deltatime );
5920 #region [ デバッグ用: HHチップを置く ]
5921 for ( int index = n1拍目のBeatPositionIndex; index < listBeatPositions.Count; index++ )
5923 this.mgr編集モード管理者.tHHチップを配置する( listBeatPositions[ index ].nGrid, 1, listBeatPositions[ index ].b無効 ); // デバッグ用・見やすくするために暫定的に。
5927 #region [ listBeatPositionsの開放 ]
5928 listBeatPositions.Clear();
5929 listBeatPositions = null;
5935 private void generateBeatChipsToolStripMenuItem_Click( object sender, EventArgs e )
5937 GenarateBeatChip_Main();
5940 private void generateBPMFromBeatChipsToolStripMenuItem_Click( object sender, EventArgs e )
5942 BPMchipsGeneneration_Main();
5945 private void toolStripComboBox演奏速度_SelectedIndexChanged( object sender, EventArgs e )
5947 this.b再生速度を変更した = true;
5950 public bool DetectDTXManiaProcess()
5952 // 検索結果のハンドルがZeroになることがあるので、50ms間隔で1回リトライする
5953 #region [ 既に起動中のDTXManiaプロセスを検索する。]
5954 // #39609 DTXManiaプロセス検索の単純化&高速化
5955 System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcessesByName("DTXManiaGR");
5956 if (ps.Length > 0) return true;
5959 ps = System.Diagnostics.Process.GetProcessesByName("DTXManiaGR");
5960 if (ps.Length > 0) return true;
5965 private void calcDifficultyToolStripMenuItem_Click(object sender, EventArgs e)
5967 DTXCreator.コード._05.譜面.C難易度自動計算マン f = new コード._05.譜面.C難易度自動計算マン(this);
5969 Cメッセージポップアップ pop = new Cメッセージポップアップ(Resources.str難易度計算マン計算中);
5975 hScrollBarDLEVEL.Value = f.DLevel;
5976 hScrollBarGLEVEL.Value = f.GLevel;
5977 hScrollBarBLEVEL.Value = f.BLevel;