m_midi_event;
+ private int m_edited_start = Integer.MAX_VALUE;
+ private int m_edited_end = Integer.MIN_VALUE;
+
+ public VsqEventIterator singerEventEnumerator() {
+ return m_meta_text.getEventList().iterator( VsqEventIteratorMode.Singer );
+ }
+
+ public VsqEventIterator noteEventEnumerator() {
+ return m_meta_text.getEventList().iterator( VsqEventIteratorMode.Anote );
+ }
+
+ public void printMetaText( TextMemoryStream sw, boolean encode, long eos, int start ) {
+ m_meta_text.print( sw, encode, eos, start );
+ }
+
+ public void printMetaText( String file ) throws IOException {
+ TextMemoryStream tms = new TextMemoryStream();
+ int count = m_meta_text.getEventList().size();
+ int clLast = m_meta_text.getEventList().get( count - 1 ).Clock + 480;
+ m_meta_text.print( tms, true, (long)clLast, 0 );
+ BufferedWriter sw = new BufferedWriter( new FileWriter( file ) );
+ tms.rewind();
+ while ( tms.peek() >= 0 ) {
+ String line = tms.readLine();
+ sw.write( line + "\n" );
+ }
+ }
+
+ /**
+ * for future implement:
+ *property VsqMaster Master {
+ * public get {
+ * return m_meta_text.master;
+ * }
+ * protected set {
+ * m_meta_text.master = value;
+ * }
+ *};
+ * @return
+ */
+ public VsqMaster getMaster() {
+ return m_meta_text.master;
+ }
+
+ protected void setMaster( VsqMaster value ) {
+ m_meta_text.master = value;
+ }
+
+ /**
+ * for future implement:
+ *property VsqMixer Mixer {
+ * public get {
+ * return m_meta_text.mixer;
+ * }
+ * protected set {
+ * m_meta_text.mixer = value;
+ * }
+ *};
+ * @return
+ */
+ public VsqMixer getMixer() {
+ return m_meta_text.mixer;
+ }
+
+ protected void setMixer( VsqMixer value ) {
+ m_meta_text.mixer = value;
+ }
+
+ public VsqBPList getVsqBPList( VsqCurveType curveType ) {
+ return m_meta_text.getVsqBPList( curveType );
+ }
+
+ public void setVsqBPList( VsqCurveType curveType, VsqBPList value ) {
+ m_meta_text.setVsqBPList( curveType, value );
+ }
+
+ public VsqEventList getEvents() {
+ return m_meta_text.getEventList();
+ }
+
+ /**
+ * for future implement:
+ * property int EditedStart {
+ * public get {
+ * return m_edited_start;
+ * }
+ * protected set {
+ * if ( value < m_edited_start ) {
+ * m_edited_start = value;
+ * }
+ * }
+ * };
+ */
+ public int getEditedStart(){
+ return m_edited_start;
+ }
+ protected void setEditedStart( int value ){
+ m_edited_start = value;
+ }
+ public int getEditedEnd() {
+ return m_edited_end;
+ }
+
+ protected void setEditedEnd( int value ) {
+ if ( m_edited_end < value ) {
+ m_edited_end = value;
+ }
+ }
+
+ public void resetEditedArea() {
+ m_edited_start = Integer.MAX_VALUE;
+ m_edited_end = Integer.MIN_VALUE;
+ }
+
+ public Object clone() {
+ VsqTrack res = new VsqTrack();
+ res.m_name = m_name;
+ if ( m_meta_text != null ) {
+ res.m_meta_text = (VsqMetaText)m_meta_text.clone();
+ }
+ if ( m_midi_event != null ) {
+ res.m_midi_event = new Vector();
+ for ( int i = 0; i < m_midi_event.size(); i++ ) {
+ MidiEvent item = m_midi_event.get( i );
+ res.m_midi_event.add( (MidiEvent)item.clone() );
+ }
+ }
+ res.m_edited_start = m_edited_start;
+ res.m_edited_end = m_edited_end;
+ return res;
+ }
+
+ private VsqTrack() {
+ }
+
+ /**
+ * Master Track繧呈ァ狗ッ
+ * @param tempo
+ * @param numerator
+ * @param denominator
+ */
+ public VsqTrack( int tempo, int numerator, int denominator ) {
+ this.m_name = "Master Track";
+ this.m_meta_text = null;
+ this.m_midi_event = new Vector();
+ this.m_midi_event.add( new MidiEvent( "0 Tempo " + tempo ) );
+ this.m_midi_event.add( new MidiEvent( "0 TimeSig " + numerator + "/" + denominator + " 24 8" ) );
+ }
+
+ /**
+ * Master Track縺ァ縺ェ縺繝医Λ繝繧ッ繧呈ァ狗ッ峨
+ * @param name
+ * @param singer
+ */
+ public VsqTrack( String name, String singer ) {
+ m_name = name;
+ m_meta_text = new VsqMetaText( name, singer );
+ m_midi_event = new Vector();
+ }
+
+ /**
+ *
+ * 繝。繧ソ繝繧ュ繧ケ繝医
+ * private property VsqMetaText MetaText {
+ * get {
+ * return m_meta_text;
+ * }
+ * };
+ */
+ protected VsqMetaText getVsqMetaText() {
+ return m_meta_text;
+ }
+
+ /**
+ * 繝医Λ繝繧ッ縺ョ蜷榊燕縲
+ * public property String Name {
+ * get {
+ * return m_name;
+ * }
+ * set {
+ * m_name = value;
+ * }
+ * };
+ */
+ public String getName() {
+ return m_name;
+ }
+
+ public void setName( String value ) {
+ m_name = value;
+ }
+
+ /**
+ * 豁瑚ゥ槭ョ譁蟄玲焚繧定ェソ縺ケ縺セ縺
+ * @returns
+ */
+ public int getLyricLength() {
+ int counter = 0;
+ VsqEventList list = m_meta_text.getEventList();
+ for ( int i = 0; i < list.size(); i++ ) {
+ if ( list.get( i ).ID.type == VsqIDType.Anote ) {
+ counter++;
+ }
+ }
+ return counter;
+ }
+
+ /**
+ * vsq繝輔ぃ繧、繝ォ繧知f2t蠖「蠑上↓繝繧ュ繧ケ繝亥喧縺輔l縺溘ヵ繧。繧、繝ォ縺九i繧ウ繝ウ繧ケ繝医Λ繧ッ繝医
+ * @param lines
+ */
+ public VsqTrack( Vector lines ) throws IOException {
+ m_midi_event = new Vector();
+ m_name = "";
+ String meta_text_path;
+ File temp_file = File.createTempFile( "temp", ".bin" );
+ meta_text_path = temp_file.getPath();
+
+ TextMemoryStream sw = new TextMemoryStream();
+ int signal;
+ for ( int j = 0; j < lines.size(); j++ ) {
+ String s = lines.get( j );
+ String line = s;
+ // signal繧貞叙蠕
+ int index = line.indexOf( ' ' );
+ String str_signal = line.substring( 0, index );
+ signal = Integer.parseInt( str_signal );
+ String remain = line.substring( index + 1 );
+
+ // 繧、繝吶Φ繝医ョ遞ョ鬘槭〒蜃ヲ逅繧貞蟯
+ String[] spl = remain.split( " " );
+ if ( spl[0] == "Meta" && spl[1] == "Text" ) {
+ line = line.replace( signal + " Meta Text \"", "" );
+ int second_colon = line.indexOf( ":", 3 );
+ line = line.substring( second_colon + 1 );
+ line = line.substring( 0, line.length() - 1 );
+ line = line.replace( "\\n", "\n" );
+ sw.write( line );
+ } else if ( spl[0] == "Meta" && (spl[1] == "TrkName" || spl[1] == "SeqName") ) {
+ m_name = spl[2];
+ for ( int i = 3; i < spl.length; i++ ) {
+ m_name += " " + spl[i];
+ }
+ m_name = m_name.replace( "\"", "" );
+ m_name = Lyric.decode( m_name );
+ } else {
+ m_midi_event.add( new MidiEvent( line ) );
+ }
+ }
+ sw.rewind();
+ m_meta_text = new VsqMetaText( sw );
+ temp_file.delete();
+ }
+
+ /**
+ * MidiEvent縺ョ荳ュ縺九i繝繝ウ繝晄ュ蝣ア繧呈歓蜃コ縺励∪縺
+ * @returns
+ */
+ public Vector getTempoList() {
+ Vector list = new Vector();
+ for ( int i = 0; i < m_midi_event.size(); i++ ) {
+ if ( m_midi_event.get( i ).type == MidiEventType.tempo ) {
+ list.add( m_midi_event.get( i ) );
+ }
+ }
+ Collections.sort( list );
+ return list;
+ }
+
+ /**
+ * MidiEvent縺ョ荳ュ縺九i諡榊ュ先ュ蝣ア繧呈歓蜃コ縺励∪縺
+ * @returns
+ */
+ public Vector getTimeSigList() {
+ Vector list = new Vector();
+ for ( int i = 0; i < m_midi_event.size(); i++ ) {
+ if ( m_midi_event.get( i ).type == MidiEventType.time_signal ) {
+ list.add( m_midi_event.get( i ) );
+ }
+ }
+ Collections.sort( list );
+ return list;
+ }
+
+}
\ No newline at end of file
diff --git a/trunk/JVsq/src/jp/sourceforge/lipsync/vsq/VsqUtil.java b/trunk/JVsq/src/jp/sourceforge/lipsync/vsq/VsqUtil.java
new file mode 100644
index 0000000..d25209b
--- /dev/null
+++ b/trunk/JVsq/src/jp/sourceforge/lipsync/vsq/VsqUtil.java
@@ -0,0 +1,326 @@
+/*
+ * VsqUtil.java
+ * Copyright (c) 2008 kbinani
+ *
+ * This file is part of jp.sourceforge.lipsync.vsq.
+ *
+ * jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+package jp.sourceforge.lipsync.vsq;
+
+import java.util.*;
+ ///
+ /// 繧ウ繝ウ繝斐Η繝シ繧ソ縺ォ繧、繝ウ繧ケ繝医シ繝ォ縺輔l縺欸OCALOID2繧キ繧ケ繝繝縺ォ縺、縺縺ヲ縺ョ諠蝣ア繧貞叙蠕励☆繧九◆繧√ョ繧ケ繧ソ繝繧」繝繧ッ繝サ繝ゥ繧、繝悶Λ繝ェ縲
+ ///
+ public class VsqUtil {
+ ///
+ /// VOCALOID繧キ繧ケ繝繝縺ョ莉墓ァ倅ク願ィュ螳壼庄閭ス縺ェ豁梧焔縺ョ譛螟ァ謨ー
+ ///
+ public final int MAX_SINGERS = 0x4000;
+
+ private static String s_dll_path = "";
+ private static boolean s_dll_path_done = false;
+ private static String s_exp_db_dir = "";
+ private static boolean s_exp_db_dir_done = false;
+ private static Dictionary s_singer_configs = null;
+ private static Vector s_installed_singers = new Vector();
+
+ ///
+ /// 謖螳壹@縺溘励Ο繧ー繝ゥ繝繝√ぉ繝ウ繧ク縺梧球蠖薙☆繧区ュ梧焔縺ョ豁悟罰險隱槭r陦ィ縺吶う繝ウ繝繧ッ繧ケ繧貞叙蠕励@縺セ縺
+ ///
+ ///
+ ///
+ public static VsqVoiceLanguage GetLanguage( int program_change ) {
+ String name = GetOriginalSinger( program_change );
+ switch ( name ) {
+ case "Miku":
+ case "Rin":
+ case "Len":
+ case "Rin_ACT2":
+ case "Len_ACT2":
+ case "Gackpoid":
+ return VsqVoiceLanguage.Japanese;
+ }
+ return VsqVoiceLanguage.Default;
+ }
+
+
+ ///
+ /// 謖螳壹@縺溘励Ο繧ー繝ゥ繝繝√ぉ繝ウ繧ク縺梧球蠖薙☆繧区ュ梧焔縺ョ縲√が繝ェ繧ク繝翫Ν縺ョ豁梧焔蜷阪r蜿門セ励@縺セ縺吶
+ ///
+ ///
+ ///
+ public static String GetOriginalSinger( int program_change ) {
+ if ( s_singer_configs == null ) {
+ LoadSingerConfigs();
+ }
+ if ( s_singer_configs.ContainsKey( program_change ) ) {
+ SingerConfig sc = GetSingerInfo( program_change );
+ String voiceidstr = sc.VOICEIDSTR;
+ foreach ( SingerConfig installed in s_installed_singers ) {
+ if ( installed.VOICEIDSTR == voiceidstr ) {
+ return installed.VOICENAME;
+ }
+ }
+ }
+ return "";
+ }
+
+
+ ///
+ /// 謖螳壹@縺溘励Ο繧ー繝ゥ繝繝√ぉ繝ウ繧ク縺梧球蠖薙☆繧区ュ梧焔縺ョ諠蝣ア繧偵〃sqID縺ォ螟画鋤縺励◆迚ゥ繧貞叙蠕励@縺セ縺
+ ///
+ ///
+ ///
+ public static VsqID GetSingerID( int program_change ) {
+ VsqID ret = new VsqID( 0 );
+ ret.type = VsqIDType.Singer;
+ SingerConfig sc = GetSingerInfo( program_change );
+ int language = 0;
+ foreach ( SingerConfig sc2 in s_installed_singers ) {
+ if ( sc.VOICEIDSTR == sc2.VOICEIDSTR ) {
+ switch ( sc2.VOICENAME ) {
+ case "Miku":
+ language = 0;
+ break;
+ }
+ }
+ }
+ ret.IconHandle = new IconHandle();
+ ret.IconHandle.IconID = "$0701" + program_change.ToString( "0000" );
+ ret.IconHandle.IDS = sc.VOICENAME;
+ ret.IconHandle.Index = 0;
+ ret.IconHandle.Language = language;
+ ret.IconHandle.Length = 1;
+ ret.IconHandle.Original = sc.Original;
+ ret.IconHandle.Program = program_change;
+ ret.IconHandle.Type = VsqHandleType.Singer;
+ ret.IconHandle.Caption = "";
+ return ret;
+ }
+
+
+ ///
+ /// 謖螳壹@縺溘励Ο繧ー繝ゥ繝繝√ぉ繝ウ繧ク縺ョ豁梧焔諠蝣ア繧貞叙蠕励@縺セ縺吶
+ ///
+ ///
+ ///
+ public static SingerConfig GetSingerInfo( int program_change ) {
+ if ( s_singer_configs == null ) {
+ LoadSingerConfigs();
+ }
+ if ( s_singer_configs.ContainsKey( program_change ) ) {
+ return s_singer_configs[program_change];
+ } else {
+ return null;
+ }
+ }
+
+
+ ///
+ /// 豁梧焔險ュ螳壹r隱ュ縺ソ霎シ繧縲GetSingerInfo, GetSingerID縺梧怙蛻昴↓蜻シ縺ー繧後◆譎ゅ↓閾ェ蜍慕噪縺ォ蜻シ縺ウ蜃コ縺輔l繧九′縲∵守、コ逧縺ォ蜻シ縺ウ蜃コ縺励※繧り憶縺縲
+ ///
+ public static void LoadSingerConfigs() {
+ if ( s_singer_configs == null ) {
+ LoadSingerConfigs( GetExpDbPath() );
+ }
+ }
+
+
+ ///
+ /// SingerEditor縺ォ繧医▲縺ヲ險ュ螳壹&繧後◆豁梧焔縺ョ繝ェ繧ケ繝医r蜿門セ励☆繧具シ弱Μ繧ケ繝医ョ繧ュ繝シ縺ッ縲後励Ο繧ー繝ゥ繝繝√ぉ繝ウ繧ク縲阪ョ蛟、縺ォ蟇セ蠢懊☆繧
+ ///
+ ///
+ ///
+ private static void LoadSingerConfigs( String path ) {
+ s_singer_configs = new Dictionary();
+ String map_file = Path.Combine( path, "voice.map" );
+ if ( !File.Exists( map_file ) ) {
+ return;
+ }
+ using ( FileStream fs = new FileStream( map_file, FileMode.Open, FileAccess.Read ) ) {
+ byte[] dat = new byte[8];
+ fs.Seek( 0x20, SeekOrigin.Begin );
+ for ( int i = 0; i < MAX_SINGERS; i++ ) {
+ fs.Read( dat, 0, 8 );
+ ulong value = makelong_le( dat );
+ if ( value >= 1 ) {
+#if DEBUG
+ Console.WriteLine( " value=" + value );
+#endif
+ String file = Path.Combine( path, "vvoice" + value + ".vvd" );
+ if ( File.Exists( file ) ) {
+ s_singer_configs.Add( i, new SingerConfig( file, (int)(value - 1) ) );
+ }
+ }
+ }
+ }
+ Vector voiceidstrs = new Vector();
+ foreach ( SingerConfig sc in s_singer_configs.Values ) {
+ if ( !voiceidstrs.Contains( sc.VOICEIDSTR ) ) {
+ voiceidstrs.Add( sc.VOICEIDSTR );
+ }
+ }
+ foreach ( String s in voiceidstrs ) {
+ String dir = Path.Combine( path, s );
+ String[] files = Directory.GetFiles( dir, "*.vvd" );
+ foreach ( String s2 in files ) {
+ String file = Path.Combine( dir, s2 );
+ if ( File.Exists( file ) ) {
+ s_installed_singers.Add( new SingerConfig( file, -1 ) );
+ }
+ }
+ }
+ }
+
+
+ ///
+ /// 髟キ縺8縺ョ繝舌う繝亥励r繝ェ繝医Ν繧ィ繝ウ繝繧」繧「繝ウ縺ィ縺ソ縺ェ縺励「nsigned long縺ォ螟画鋤縺励∪縺
+ ///
+ ///
+ ///
+ private static long makelong_le( byte[] oct ) {
+ return (ulong)oct[7] << 56 | (ulong)oct[6] << 48 | (ulong)oct[5] << 40 | (ulong)oct[4] << 32 | (ulong)oct[3] << 24 | (ulong)oct[2] << 16 | (ulong)oct[1] << 8 | (ulong)oct[0];
+ }
+
+
+ ///
+ /// VOCALOID2 VSTi縺ョdll縺ク縺ョ繝輔Ν繝代せ繧貞叙蠕励@縺セ縺
+ ///
+ ///
+ public static unsafe String GetVstiDllPath() {
+ if ( s_dll_path_done ) {
+ return s_dll_path;
+ }
+ try {
+ uint hKey;
+ int ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2\\APPLICATION", 0, windows.KEY_READ, &hKey );
+ if ( ret != windows.ERROR_SUCCESS ) {
+ ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2_DEMO\\APPLICATION", 0, windows.KEY_READ, &hKey );
+ if ( ret != windows.ERROR_SUCCESS ) {
+ return s_dll_path;
+ }
+ }
+
+ FILETIME ft;
+ for ( uint i = 0; ; i++ ) {
+ String lpszName = new String( new char[64] );
+ String pClass = new String( new char[64] );
+ uint dwNameSize = (uint)lpszName.Length;
+ uint pcbClass = 64;
+ int lRes = windows.RegEnumKeyExW( hKey, i, lpszName, &dwNameSize, (uint*)0, pClass, &pcbClass, &ft );
+ if ( lRes != windows.ERROR_SUCCESS ) {
+ break;
+ }
+
+ uint hChildKey;
+ ret = windows.RegOpenKeyExW( hKey, lpszName, 0, windows.KEY_READ, &hChildKey );
+ if ( ret != windows.ERROR_SUCCESS ) {
+ continue;
+ }
+
+ uint dwType = windows.REG_SZ;
+ uint dwSize = windows.MAX_PATH;
+ byte[] tszVSTPlugin = new byte[windows.MAX_PATH];
+ tszVSTPlugin[0] = (byte)'\0';
+ fixed ( byte* pData = &tszVSTPlugin[0] ) {
+ ret = windows.RegQueryValueExW( hChildKey, "PATH", (uint*)0, &dwType, pData, &dwSize );
+ }
+ windows.RegCloseKey( hChildKey );
+ if ( ret != windows.ERROR_SUCCESS ) {
+ continue;
+ }
+
+ String name = Encoding.Unicode.GetString( tszVSTPlugin, 0, (int)dwSize );
+ if ( name.EndsWith( "\0" ) ) {
+ name = name.SubString( 0, name.Length - 1 );
+ }
+ // 陬ス蜩∫沿
+ if ( name.EndsWith( "\\vocaloid2.dll" ) ) {
+ s_dll_path = name;
+ break;
+ }
+ // 繝繝「迚
+ if ( name.EndsWith( "\\vocaloid2_demo.dll" ) ) {
+ s_dll_path = name;
+ break;
+ }
+ }
+ windows.RegCloseKey( hKey );
+ } catch {
+ } finally {
+ s_dll_path_done = true;
+ }
+ return s_dll_path;
+ }
+
+
+ ///
+ /// 豁悟罰繝繝シ繧ソ繝吶シ繧ケ縺御ソ晏ュ倥&繧後※縺繧九ョ繧」繝ャ繧ッ繝医Μ縺ョ繝輔Ν繝代せ繧貞叙蠕励@縺セ縺
+ ///
+ ///
+ public static unsafe String GetExpDbPath() {
+ if ( s_exp_db_dir_done ) {
+ return s_exp_db_dir;
+ }
+ try {
+ uint hKey;
+ int ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2\\DATABASE\\VOICE", 0, windows.KEY_READ, &hKey );
+ if ( ret != windows.ERROR_SUCCESS ) {
+ ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2_DEMO\\DATABASE\\VOICE", 0, windows.KEY_READ, &hKey );
+ if ( ret != windows.ERROR_SUCCESS ) {
+ return s_exp_db_dir;
+ }
+ }
+
+ FILETIME ft;
+ for ( uint i = 0; ; i++ ) {
+ String lpszName = new String( new char[64] );
+ String pClass = new String( new char[64] );
+ uint dwNameSize = (uint)lpszName.Length;
+ uint pcbClass = 64;
+ int lRes = windows.RegEnumKeyExW( hKey, i, lpszName, &dwNameSize, (uint*)0, pClass, &pcbClass, &ft );
+ if ( lRes != windows.ERROR_SUCCESS ) {
+ break;
+ }
+
+ uint hChildKey;
+ ret = windows.RegOpenKeyExW( hKey, lpszName, 0, windows.KEY_READ, &hChildKey );
+ if ( ret != windows.ERROR_SUCCESS ) {
+ continue;
+ }
+
+ uint dwType = windows.REG_SZ;
+ uint dwSize = windows.MAX_PATH;
+ byte[] tszVSTPlugin = new byte[windows.MAX_PATH];
+ tszVSTPlugin[0] = (byte)'\0';
+ fixed ( byte* pData = &tszVSTPlugin[0] ) {
+ ret = windows.RegQueryValueExW( hChildKey, "INSTALLDIR", (uint*)0, &dwType, pData, &dwSize );
+ }
+ windows.RegCloseKey( hChildKey );
+ if ( ret != windows.ERROR_SUCCESS ) {
+ continue;
+ }
+
+ String name = Encoding.Unicode.GetString( tszVSTPlugin, 0, (int)dwSize );
+ if ( name.EndsWith( "\0" ) ) {
+ name = name.SubString( 0, name.Length - 1 );
+ }
+ if ( name.EndsWith( "\\voicedbdir" ) ) {
+ s_exp_db_dir = name;
+ break;
+ }
+ }
+ windows.RegCloseKey( hKey );
+ } catch {
+ } finally {
+ s_exp_db_dir_done = true;
+ }
+ return s_exp_db_dir;
+ }
+ }
diff --git a/trunk/JVsq/src/jp/sourceforge/lipsync/vsq/VsqVoiceLanguage.java b/trunk/JVsq/src/jp/sourceforge/lipsync/vsq/VsqVoiceLanguage.java
new file mode 100644
index 0000000..4dc2c5d
--- /dev/null
+++ b/trunk/JVsq/src/jp/sourceforge/lipsync/vsq/VsqVoiceLanguage.java
@@ -0,0 +1,29 @@
+/*
+ * VsqVoiceLanguage.java
+ * Copyright (c) 2008 kbinani
+ *
+ * This file is part of jp.sourceforge.lipsync.vsq.
+ *
+ * jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * jp.sourceforge.lipsync.vsq is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+package jp.sourceforge.lipsync.vsq;
+
+/**
+ *VOCALOID2縺ョ豁悟罰險隱
+ * @author kbinani
+ */
+public enum VsqVoiceLanguage {
+ /**
+ * 繝繝輔か繝ォ繝医Japanese縺ィ蜷悟、
+ */
+ Default,
+ /**
+ * 譌・譛ャ隱
+ */
+ Japanese,
+}
diff --git a/trunk/LipSync.sln b/trunk/LipSync.sln
new file mode 100644
index 0000000..136543e
--- /dev/null
+++ b/trunk/LipSync.sln
@@ -0,0 +1,86 @@
+サソ
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C# Express 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LipSync", "LipSync\LipSync.csproj", "{15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPlugin", "IPlugin\IPlugin.csproj", "{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NicoComment", "NicoComment\NicoComment.csproj", "{6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VFlip", "VFlip\VFlip.csproj", "{E5F9AD85-0C02-4286-AC4C-F5B34EA10650}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Background", "Background\Background.csproj", "{F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevUtl", "DevUtl\DevUtl.csproj", "{A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lang2po", "lang2po\lang2po.csproj", "{D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boare.Lib.AppUtil", "..\Boare.Lib.AppUtil\Boare.Lib.AppUtil.csproj", "{0C58B068-272F-4390-A14F-3D72AFCF3DFB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boare.Lib.Media", "..\Boare.Lib.Media\Boare.Lib.Media.csproj", "{F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boare.Lib.Vsq", "..\Boare.Lib.Vsq\Boare.Lib.Vsq.csproj", "{673347F3-6FC2-4F82-9273-BF158E0F8CB1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bocoree", "..\bocoree\bocoree.csproj", "{C8AAE632-9C6C-4372-8175-811528A66742}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boare.Lib.Swf", "..\Boare.Lib.Swf\Boare.Lib.Swf.csproj", "{D861973B-3BC6-4F52-83BE-49A8C269C09F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E5F9AD85-0C02-4286-AC4C-F5B34EA10650}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E5F9AD85-0C02-4286-AC4C-F5B34EA10650}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E5F9AD85-0C02-4286-AC4C-F5B34EA10650}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E5F9AD85-0C02-4286-AC4C-F5B34EA10650}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Release|Any CPU.Build.0 = Release|Any CPU
+ {673347F3-6FC2-4F82-9273-BF158E0F8CB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {673347F3-6FC2-4F82-9273-BF158E0F8CB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {673347F3-6FC2-4F82-9273-BF158E0F8CB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {673347F3-6FC2-4F82-9273-BF158E0F8CB1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C8AAE632-9C6C-4372-8175-811528A66742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C8AAE632-9C6C-4372-8175-811528A66742}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C8AAE632-9C6C-4372-8175-811528A66742}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C8AAE632-9C6C-4372-8175-811528A66742}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D861973B-3BC6-4F52-83BE-49A8C269C09F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D861973B-3BC6-4F52-83BE-49A8C269C09F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D861973B-3BC6-4F52-83BE-49A8C269C09F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D861973B-3BC6-4F52-83BE-49A8C269C09F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/trunk/LipSync/Common/AviutlPlugin.cs b/trunk/LipSync/Common/AviutlPlugin.cs
new file mode 100644
index 0000000..6f2d0f4
--- /dev/null
+++ b/trunk/LipSync/Common/AviutlPlugin.cs
@@ -0,0 +1,45 @@
+サソusing System.Runtime.InteropServices;
+
+namespace Boare.Lib.AviutlPlugin{
+
+ /*class aviutl {
+
+ [DllImport( "Invoke", EntryPoint="GetFilterTable")]
+ public extern static FILTER_DLL GetFilterTable();
+
+ }
+
+
+ struct FILTER_DLL {
+ int flag;
+ int x,y;
+ TCHAR *name;
+ int track_n;
+ TCHAR **track_name;
+ int* track_default;
+ int* track_s;
+ int* track_e;
+ int check_n;
+ TCHAR **check_name;
+ int* check_default;
+ BOOL (*func_proc)( FILTER *fp,FILTER_PROC_INFO *fpip );
+ BOOL (*func_init)( FILTER *fp );
+ BOOL (*func_exit)( FILTER *fp );
+ BOOL (*func_update)( FILTER *fp,int status );
+ BOOL (*func_WndProc)( HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam,void *editp,FILTER *fp );
+ int* track;
+ int* check;
+ void* ex_data_ptr;
+ int ex_data_size;
+ TCHAR *information;
+ BOOL (*func_save_start)( FILTER *fp,int s,int e,void *editp );
+ BOOL (*func_save_end)( FILTER *fp,void *editp );
+ EXFUNC *exfunc;
+ HWND hwnd;
+ HINSTANCE dll_hinst;
+ void* ex_data_def;
+ BOOL (*func_is_saveframe)( FILTER *fp,void *editp,int saveno,int frame,int fps,int edit_flag,int inter );
+ int[] reserve = new int[6];
+ }*/
+
+}
diff --git a/trunk/LipSync/Common/Common.cs b/trunk/LipSync/Common/Common.cs
new file mode 100644
index 0000000..d5cd2c5
--- /dev/null
+++ b/trunk/LipSync/Common/Common.cs
@@ -0,0 +1,264 @@
+サソ/*
+ * Common.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+namespace LipSync {
+
+ ///
+ /// LipSync蜈ア逕ィ縺ョ髢「謨ー
+ ///
+ public class Common {
+ private static string m_log_file = "";
+ private static StreamWriter m_sw = null;
+ private static SaveFileDialog s_dialog = null;
+ public static Color CURVE_X = Color.Black;
+ public static Color CURVE_Y = Color.White;
+ public static Color CURVE_SCALE = Color.Orange;
+ public static Color CURVE_ALPHA = Color.Red;
+ public static Color CURVE_ROTATE = Color.Navy;
+
+ ///
+ /// 繝輔ぃ繧、繝ォ繝繧、繧「繝ュ繧ー縺ョFilter縺ォ謖螳壹@繧医≧縺ィ縺励※縺繧区枚蟄怜励′繧ィ繝ゥ繝シ繧定オキ縺薙&縺ェ縺縺九←縺縺九r遒コ縺九a縺セ縺
+ ///
+ ///
+ ///
+ public static bool CheckFilterValidity( string filter ) {
+ if ( s_dialog == null ) {
+ s_dialog = new SaveFileDialog();
+ }
+ try {
+ s_dialog.Filter = filter;
+ return true;
+ } catch {
+ return false;
+ }
+ }
+
+ public static void DebugWriteLine( string s ) {
+#if DEBUG
+#if MONO
+ Console.WriteLine( s );
+ System.Diagnostics.Trace.WriteLine( s );
+ System.Diagnostics.Debug.WriteLine( s );
+#else
+ //System.Diagnostics.Debug.WriteLine( s );
+ Console.WriteLine( s );
+#endif
+#endif
+ }
+
+ public static Image GetThumbnailImage( Image image, int width, int height ) {
+ Bitmap res = new Bitmap( width, height, PixelFormat.Format32bppArgb );
+ if ( image == null ) {
+ return res;
+ }
+ int w = image.Width;
+ int h = image.Height;
+ float ASPECTO = (float)width / (float)height;
+ float aspecto = (float)w / (float)h;
+ float order = 1f; //諡。螟ァ邇
+ int top = 0; //謠冗判菴咲スョy蠎ァ讓
+ int left = 0; //謠冗判菴咲スョx蠎ァ讓
+ if ( ASPECTO > aspecto ) {
+ // 繧オ繝繝阪う繝ォ縺ョ縺サ縺縺梧ィェ髟キ
+ order = (float)height / (float)h;
+ left = (int)(width - order * w) / 2;
+ } else {
+ // 繧オ繝繝阪う繝ォ縺ョ縺サ縺縺檎クヲ髟キ
+ order = (float)width / (float)w;
+ top = (int)(height - order * h) / 2;
+ }
+ using ( Graphics g = Graphics.FromImage( res ) ) {
+ g.Clear( Color.Transparent );
+ g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
+ g.DrawImage( image, left, top, w * order, h * order );
+ }
+ return res;
+ }
+
+ ///
+ /// 2縺、縺ョ謨エ謨ー縺ョ譛螟ァ蜈ャ邏謨ー繧定ソ斐@縺セ縺吶
+ ///
+ ///
+ ///
+ ///
+ public static long GetGCD( long m, long n ) {
+ if ( n > m ) {
+ long a = n;
+ n = m;
+ m = a;
+ }
+ while ( true ) {
+ if ( n == 0 ) {
+ return m;
+ }
+ long quotient = m / n;
+ long odd = m - n * quotient;
+ if ( odd == 0 ) {
+ return n;
+ }
+ m = n;
+ n = odd;
+ }
+ }
+
+
+ public static Point PointFromPointF( PointF point_f ) {
+ return new Point( (int)point_f.X, (int)point_f.Y );
+ }
+
+
+ public static Size SizeFromSizeF( SizeF size_f ) {
+ return new Size( (int)size_f.Width, (int)size_f.Height );
+ }
+
+
+ ///
+ /// 逕サ蜒上°繧我ク埼乗朱伜沺繧呈、懷コ縺吶k縲
+ ///
+ ///
+ ///
+ public static Rectangle GetNonTransparentRegion( Bitmap bmp ) {
+ if ( bmp.PixelFormat != PixelFormat.Format32bppArgb ) {
+ return new Rectangle();
+ }
+ BitmapData bmpdat = bmp.LockBits(
+ new Rectangle( 0, 0, bmp.Width, bmp.Height ),
+ ImageLockMode.ReadOnly,
+ PixelFormat.Format32bppArgb
+ );
+
+ int stride = bmpdat.Stride;
+
+ int ymax = 0;
+ int ymin = (bmp.Height - 1) * stride;
+ int xmax = 0;
+ int xmin = (bmp.Width - 1) * 4;
+ const byte ZERO = 0;
+ unsafe {
+ byte* dat = (byte*)(void*)bmpdat.Scan0;
+ int xend = bmp.Width * 4;
+ int yend;
+ for ( int x = 0; x < xend; x += 4 ) {
+ // ymin繧呈アコ繧√k
+ yend = ymin;//ymin* stride;
+ for ( int y = 0; y <= yend; y += stride ) {
+ if ( dat[x + y + 3] != ZERO ) {
+ //ymin = Math.Min( ymin, y / stride );
+ ymin = Math.Min( ymin, y );
+ break;
+ }
+ }
+
+ // ymax繧呈アコ繧√k
+ yend = ymax;// ymax * stride;
+ for ( int y = (bmp.Height - 1) * stride; y >= yend; y -= stride ) {
+ if ( dat[x + y + 3] != ZERO ) {
+ //ymax = Math.Max( ymax, y / stride );
+ ymax = Math.Max( ymax, y );
+ break;
+ }
+ }
+ }
+
+ yend = ymax;// ymax * stride;
+ for ( int y = ymin; y <= yend; y += stride ) {
+ // xmin繧呈アコ繧√k
+ for ( int x = 0; x < xmin; x += 4 ) {
+ if ( dat[x + y + 3] != ZERO ) {
+ //xmin = Math.Min( xmin, x / 4 );
+ xmin = Math.Min( xmin, x );
+ break;
+ }
+ }
+
+ // xmax繧呈アコ繧√k
+ for ( int x = (bmp.Width - 1) * 4; x >= xmax; x -= 4 ) {
+ if ( dat[x + y + 3] != ZERO ) {
+ //xmax = Math.Max( xmax, x / 4 );
+ xmax = Math.Max( xmax, x );
+ break;
+ }
+ }
+ }
+ if ( xmax <= xmin || ymax <= ymin ) {
+ xmin = 0;
+ xmax = bmp.Width - 1;
+ ymin = 0;
+ ymax = bmp.Height - 1;
+ } else {
+ xmin = xmin / 4;
+ xmax = xmax / 4;
+ ymin = ymin / stride;
+ ymax = ymax / stride;
+ }
+ }
+ bmp.UnlockBits( bmpdat );
+ return new Rectangle( xmin, ymin, xmax - xmin + 1, ymax - ymin + 1 );
+ }
+
+ public static void LogPush( Exception ex ) {
+ LogPush( ex.Source + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace );
+ }
+ public static void LogPush( string procedure, string message_type, string message ) {
+ LogPush( procedure + ";" + message_type + ";" + message );
+ }
+ static void LogPush( string message ) {
+ if ( m_sw == null ) {
+ m_log_file = Path.Combine( Application.StartupPath, "error.log" );
+ m_sw = new StreamWriter( m_log_file, true, Encoding.Unicode );
+ m_sw.WriteLine( "************************************************************************" );
+ m_sw.WriteLine( "Logger started : " + DateTime.Now.ToString() );
+ m_sw.WriteLine( "------------------------------------------------------------------------" );
+ }
+ m_sw.WriteLine( DateTime.Now.ToString() + ";" + message );
+ m_sw.Flush();
+ }
+
+ public static void LogClose() {
+ if ( m_sw != null ) {
+ m_sw.Close();
+ m_sw = null;
+ }
+ }
+
+ ///
+ /// 謖螳壹@縺溘ヱ繧ケ縺ョ繝輔ぃ繧、繝ォ縺九i繧、繝。繝シ繧ク繧定ェュ縺ソ霎シ縺ソ縺セ縺
+ ///
+ /// 繧、繝。繝シ繧ク繝輔ぃ繧、繝ォ縺ク縺ョ繝代せ
+ ///
+ public static Image ImageFromFile( string fpath ) {
+ Bitmap result = null;
+ if ( File.Exists( fpath ) ) {
+ using ( FileStream fs = new FileStream( fpath, FileMode.Open, FileAccess.Read ) ) {
+ Image temp = Image.FromStream( fs );
+ result = new Bitmap( temp.Width, temp.Height, PixelFormat.Format32bppArgb );
+ using ( Graphics g = Graphics.FromImage( result ) ) {
+ g.DrawImage( temp, 0, 0, temp.Width, temp.Height );
+ }
+ temp.Dispose();
+ }
+ }
+ return result;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Common/CurveEditor.cs b/trunk/LipSync/Common/CurveEditor.cs
new file mode 100644
index 0000000..8ebfbd8
--- /dev/null
+++ b/trunk/LipSync/Common/CurveEditor.cs
@@ -0,0 +1,2653 @@
+/*
+ * CurveEditor.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Windows.Forms;
+
+using Boare.Lib.AppUtil;
+using LipSync;
+
+namespace CurveEditor {
+
+ public partial class CurveEditor : UserControl {
+ public delegate void CurveEditedEventHandler();
+
+ public enum MouseDownMode {
+ Nothing,
+ MovePoint,
+ }
+
+ private class ScaleAndOffset {
+ public float Scale;
+ public float Offset;
+
+ public ScaleAndOffset( float scale, float offset ) {
+ Scale = scale;
+ Offset = offset;
+ }
+ }
+
+ Dictionary m_list = new Dictionary();
+ Dictionary m_list_minmax = new Dictionary();
+ bool m_drag_ = false;
+ bool m_drag_with_space_key = false;
+ Point m_drag_start;
+ float m_old_xoffset;
+ float m_old_yoffset;
+ const int LABEL_WIDTH = 15;
+ const int LIST_WIDTH = 60;
+ string m_selected = "";
+ int m_picked_point_id = -1;
+ PickedSide m_picked_side;
+ bool m_scale_locked = false;
+ ControlType m_last_added_type = ControlType.None;
+ List m_commands = new List();
+ int m_command_position = -1;
+ PointF m_before_edit;
+ //bool m_moved = false;
+ //bool m_mouse_upped = true;
+ bool m_change_xscale = false;
+ bool m_change_yscale = false;
+ int m_change_origin;
+ float m_old_scale;
+ float CHANGE_SCALE_ORDER = 70f;
+ bool m_spacekey_down = false;
+ Cursor HAND;
+ bool _number_visible = false;
+ PointF _number;
+ Font _font;
+ Point _mouse_position;
+ ContextMenuStrip _cmenu;
+ ToolStripMenuItem _cmenuNumericInput;
+ bool m_rescaley_enabled = true;
+ XLabel m_xlabel = XLabel.None;
+ YLabel m_ylabel = YLabel.None;
+ bool m_change_xscale_with_wheel = true;
+ bool m_change_yscale_with_wheel = true;
+ bool m_show_list = true;
+ float m_max_xscale = 100f;
+ float m_min_xscale = 1e-4f;
+ float m_max_yscale = 100f;
+ float m_min_yscale = 1e-4f;
+ Color m_origin_scale_line = Color.FromArgb( 44, 44, 44 );
+ Color m_scale_line = Color.FromArgb( 94, 94, 94 );
+ Color m_sub_scale_line = Color.FromArgb( 110, 110, 110 );
+ Color m_cHandle_master = Color.FromArgb( 240, 144, 160 );
+ Color m_cControl_master = Color.FromArgb( 255, 130, 0 );
+ Color m_cHandle_normal = Color.FromArgb( 255, 130, 0 );
+ Color m_cControl_normal = Color.FromArgb( 51, 192, 64 );
+ Color m_data_point = Color.Black;
+ Color m_data_point_hilight = Color.Red;
+ int m_data_point_size = 2;
+ int m_control_point_size = 2;
+ PointType m_data_point_type;
+ PointType m_control_point_type;
+ Color m_label_back = Color.FromArgb( 172, 172, 172 );
+ Color m_list_back = Color.FromArgb( 143, 143, 143 );
+ float m_xscale = 1f;
+ float m_yscale = 1f;
+ float m_xoffset = 0f;
+ float m_yoffset = 0f;
+ int m_place_count_x = 1;
+ int m_place_count_y = 1;
+ bool m_scroll_enabled = true;
+ bool m_mouse_moved = false;
+ MouseDownMode m_mouse_down_mode = MouseDownMode.Nothing;
+
+ ///
+ /// 繧ォ繝シ繝悶ョ繝繝シ繧ソ轤ケ繝サ蛻カ蠕。轤ケ縺ェ縺ゥ縺檎キィ髮縺輔l縺滓凾縺ォ逋コ逕溘@縺セ縺
+ ///
+ public event CurveEditedEventHandler CurveEdited;
+
+ ///
+ /// 繝代ヶ繝ェ繝繧ッ繧ウ繝ウ繧ケ繝医Λ繧ッ繧ソ
+ ///
+ public CurveEditor() {
+ InitializeComponent();
+ this.MouseWheel += new MouseEventHandler( CurveEditor_MouseWheel );
+ this.SetStyle( ControlStyles.DoubleBuffer, true );
+ this.SetStyle( ControlStyles.UserPaint, true );
+ this.SetStyle( ControlStyles.AllPaintingInWmPaint, true );
+ byte[] foo = new byte[] { 0x0, 0x0, 0x2, 0x0, 0x1, 0x0, 0x20, 0x20, 0x0, 0x0, 0x10, 0x0, 0x10, 0x0, 0xe8, 0x2, 0x0, 0x0, 0x16, 0x0,
+ 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x80, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0,
+ 0x80, 0x0, 0x80, 0x0, 0x80, 0x0, 0x0, 0x80, 0x80, 0x0, 0xc0, 0xc0, 0xc0, 0x0, 0x80, 0x80, 0x80, 0x0, 0xff, 0x0,
+ 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0xff,
+ 0xff, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xf0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0,
+ 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xf8,
+ 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xcf, 0xf3, 0xff, 0xff, 0x87, 0xe1, 0xff, 0xff, 0x7,
+ 0xe0, 0xff, 0xff, 0x7, 0xe0, 0xff, 0xff, 0x87, 0xe1, 0xff, 0xff, 0xcf, 0xf3, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xf8,
+ 0x1f, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, };
+ using ( MemoryStream ms = new MemoryStream( foo ) ) {
+ HAND = new Cursor( ms );
+ }
+ _font = new Font( "MS UI Gothic", 10 );
+ }
+
+ public bool GetYScaleAndYOffset( string ID, out float y_scale, out float y_offset ) {
+ if ( m_list_minmax.ContainsKey( ID ) ) {
+ y_scale = m_list_minmax[ID].Scale;
+ y_offset = m_list_minmax[ID].Offset;
+ return true;
+ } else {
+ y_scale = 1f;
+ y_offset = 0f;
+ return false;
+ }
+ }
+
+ public void SetYScaleAndYOffset( string ID, float y_scale, float y_offset ) {
+ if ( m_list_minmax.ContainsKey( ID ) ) {
+ m_list_minmax[ID].Scale = y_scale;
+ m_list_minmax[ID].Offset = y_offset;
+ this.Invalidate();
+ }
+ }
+
+ public static string _( string s ) {
+ return Messaging.GetMessage( s );
+ }
+
+ public Size GraphSize {
+ get {
+ int width, height;
+ if ( XLabel != XLabel.None ) {
+ height = this.Height - LABEL_WIDTH;
+ } else {
+ height = this.Height;
+ }
+ if ( YLabel != YLabel.None ) {
+ width = this.Width - LABEL_WIDTH;
+ } else {
+ width = this.Width;
+ }
+ if ( ShowList ) {
+ width -= LIST_WIDTH;
+ }
+ return new Size( width, height );
+ }
+ }
+
+ ///
+ /// 邵ヲ霆ク繧ケ繧ア繝シ繝ォ縺ョ螟画峩繧定ィア蜿ッ縺吶k縺九←縺縺九r蜿門セ励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public bool RescaleYEnabled {
+ get {
+ return m_rescaley_enabled;
+ }
+ set {
+ m_rescaley_enabled = value;
+ }
+ }
+
+ bool Drag {
+ get {
+ return m_drag_;
+ }
+ set {
+ m_drag_ = value;
+ if ( m_drag_ ) {
+ this.Cursor = HAND;
+ } else {
+ this.Cursor = Cursors.Default;
+ }
+ }
+ }
+
+ ///
+ /// 迴セ蝨ィ繧ォ繝シ繝悶お繝繧」繧ソ縺ォ險ュ螳壹&繧後※縺繧九ョ繝シ繧ソ繧貞ィ縺ヲ遐エ譽縺暦シ悟晄悄蛹悶@縺セ縺
+ ///
+ public void Clear() {
+ m_list.Clear();
+ m_list_minmax.Clear();
+ m_commands.Clear();
+ m_command_position = -1;
+ m_selected = "";
+ m_picked_point_id = -1;
+ }
+
+ ///
+ /// Undo, Redo逕ィ縺ョ繝舌ャ繝輔ぃ繧貞ィ縺ヲ遐エ譽縺暦シ悟晄悄蛹悶@縺セ縺
+ ///
+ public void ClearBuffer() {
+ m_commands.Clear();
+ m_command_position = -1;
+ }
+
+ ///
+ /// 讓ェ霆ク縺ョ逶ョ逶帙ョ遞ョ鬘槭r蜿門セ励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public XLabel XLabel {
+ get {
+ return m_xlabel;
+ }
+ set {
+ m_xlabel = value;
+ }
+ }
+
+ ///
+ /// 邵ヲ霆ク縺ョ逶ョ逶帙ョ遞ョ鬘槭r蜿門セ励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public YLabel YLabel {
+ get {
+ return m_ylabel;
+ }
+ set {
+ m_ylabel = value;
+ }
+ }
+
+ ///
+ /// 繝槭え繧ケ繝帙う繝シ繝ォ縺ァ讓ェ霆ク縺ョ繧ケ繧ア繝シ繝ォ繧貞、画峩縺吶k縺九←縺縺九r蜿門セ励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public bool ChangeXScaleWithWheel {
+ get {
+ return m_change_xscale_with_wheel;
+ }
+ set {
+ m_change_xscale_with_wheel = value;
+ }
+ }
+
+ ///
+ /// 繝槭え繧ケ繝帙う繝シ繝ォ縺ァ邵ヲ霆ク縺ョ繧ケ繧ア繝シ繝ォ繧貞、画峩縺吶k縺九←縺縺九r蜿門セ励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public bool ChangeYScaleWithWheel {
+ get {
+ return m_change_yscale_with_wheel;
+ }
+ set {
+ m_change_yscale_with_wheel = value;
+ }
+ }
+
+ ///
+ /// 邱ィ髮蟇セ雎。縺ィ縺ェ繧九き繝シ繝悶ョ繝ェ繧ケ繝医rシ檎判髱「蜿ウ蛛エ縺ォ陦ィ遉コ縺吶k縺九←縺縺九r蜿門セ励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public bool ShowList {
+ get {
+ return m_show_list;
+ }
+ set {
+ m_show_list = value;
+ }
+ }
+
+ ///
+ /// 讓ェ霆ク縺ョ繧ケ繧ア繝シ繝ォ縺ィ縺励※險ュ螳壹〒縺阪k譛螟ァ蛟、繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public float MaxXScale {
+ get {
+ return m_max_xscale;
+ }
+ set {
+ if ( value > 0 && value > m_min_xscale ) {
+ m_max_xscale = value;
+ }
+ }
+ }
+
+ ///
+ /// 讓ェ霆ク縺ョ繧ケ繧ア繝シ繝ォ縺ィ縺励※險ュ螳壹〒縺阪k譛蟆丞、繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public float MinXScale {
+ get {
+ return m_min_xscale;
+ }
+ set {
+ if ( value > 0 && value < m_max_xscale ) {
+ m_min_xscale = value;
+ }
+ }
+ }
+
+ ///
+ /// 邵ヲ霆ク縺ョ繧ケ繧ア繝シ繝ォ縺ィ縺励※險ュ螳壹〒縺阪k譛螟ァ蛟、繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public float MaxYScale {
+ get {
+ return m_max_yscale;
+ }
+ set {
+ if ( value > 0 && value > m_min_yscale ) {
+ m_max_yscale = value;
+ }
+ }
+ }
+
+ ///
+ /// 邵ヲ霆ク縺ョ繧ケ繧ア繝シ繝ォ縺ィ縺励※險ュ螳壹〒縺阪k譛蟆丞、繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public float MinYScale {
+ get {
+ return m_min_yscale;
+ }
+ set {
+ if ( value > 0 && value < m_max_yscale ) {
+ m_min_yscale = value;
+ }
+ }
+ }
+
+ void CurveEditor_MouseWheel( object sender, MouseEventArgs e ) {
+ Keys modifier = Control.ModifierKeys;
+ if ( modifier == Keys.Control ) {
+ float dx = e.Delta / XScale;
+ XOffset -= dx;
+ this.Invalidate();
+ } else if ( modifier == Keys.Shift ) {
+ float dy = e.Delta / YScale;
+ YOffset -= dy;
+ if ( m_selected != "" ) {
+ m_list_minmax[m_selected].Offset = YOffset;
+ }
+ this.Invalidate();
+ } else if ( modifier == Keys.None ) {
+ float count = e.Delta / 120f;
+ float n_xscale;
+ float n_yscale;
+ float order;
+ if ( count < 0 ) {
+ order = (float)Math.Pow( 0.83, Math.Abs( count ) );
+ } else {
+ order = (float)(1f / Math.Pow( 0.83, Math.Abs( count ) ));
+ }
+ if ( m_change_xscale_with_wheel ) {
+ n_xscale = m_xscale * order;
+ } else {
+ n_xscale = m_xscale;
+ }
+ if ( m_change_yscale_with_wheel ) {
+ n_yscale = m_yscale * order;
+ } else {
+ n_yscale = m_yscale;
+ }
+ if ( m_xscale != n_xscale || m_yscale != n_yscale ) {
+ bool changed = false;
+ if ( MinXScale <= n_xscale && n_xscale <= MaxXScale ) {
+ XOffset = e.X * (1f / n_xscale - 1f / XScale) + XOffset;
+ XScale = n_xscale;
+ changed = true;
+ }
+ if ( MinYScale <= n_yscale && n_yscale <= MaxYScale ) {
+ YOffset = (this.Height - e.Y) * (1f / n_yscale - 1f / YScale) + YOffset;
+ YScale = n_yscale;
+ changed = true;
+ }
+ if ( changed ) {
+ this.Invalidate();
+ }
+ }
+ }
+ }
+
+ ///
+ /// 邱ィ髮蟇セ雎。縺ィ縺ェ繧九き繝シ繝悶rシ後%縺ョ繧ウ繝ウ繝医Ο繝シ繝ォ縺ォ霑ス蜉縺励∪縺
+ ///
+ ///
+ ///
+ /*public void Add( string ID, Color curve ) {
+ m_list.Add( ID, new BezierChain( curve ) );
+ }*/
+
+ public void Add( string ID, BezierChain chain ) {
+ m_list.Add( ID, chain );
+ m_list_minmax.Add( ID, new ScaleAndOffset( 1f, 0f ) );
+ }
+
+ //todo:蜍輔°縺励≧繧休縺ョ遽蝗イ繧呈爾遏・縺ァ縺阪k繧医≧縺ォ縺吶kシ殫t1-4縺昴l縺槭l縺悟虚縺丞エ蜷医
+ ///
+ /// 4縺、縺ョ蛻カ蠕。轤ケ縺九i縺ェ繧九吶ず繧ィ譖イ邱壹′縲』霆ク縺ォ縺、縺縺ヲ髯ー縺九←縺縺九r蛻、螳壹☆繧
+ ///
+ /// 蟋狗せ
+ /// 蛻カ蠕。轤ケ1
+ /// 蛻カ蠕。轤ケ2
+ /// 邨らせ
+ ///
+ public static bool IsBezierImplicit( float pt1, float pt2, float pt3, float pt4 ) {
+ double a = pt4 - 3 * pt3 + 3 * pt2 - pt1;
+ double b = 2 * pt3 - 4 * pt2 + 2 * pt1;
+ double c = pt2 - pt1;
+ if ( a == 0 ) {
+ if ( c >= 0 && b + c >= 0 ) {
+ return true;
+ } else {
+ return false;
+ }
+ } else if ( a > 0 ) {
+ if ( -b / (2 * a) <= 0 ) {
+ if ( c >= 0 ) {
+ return true;
+ } else {
+ return false;
+ }
+ } else if ( 1 <= -b / (2 * a) ) {
+ if ( a + b + c >= 0 ) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ if ( c - b * b / (4 * a) >= 0 ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ if ( -b / (2 * a) <= 0.5 ) {
+ if ( a + b + c >= 0 ) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ if ( c >= 0 ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ #region 謠冗判險ュ螳
+ public Color MainScaleLine {
+ get {
+ return m_origin_scale_line;
+ }
+ set {
+ m_origin_scale_line = value;
+ }
+ }
+
+
+ public Color ScaleLine {
+ get {
+ return m_scale_line;
+ }
+ set {
+ m_scale_line = value;
+ }
+ }
+
+
+ public Color SubScaleLine {
+ get {
+ return m_sub_scale_line;
+ }
+ set {
+ m_sub_scale_line = value;
+ }
+ }
+
+
+ public Color HandleMaster {
+ get {
+ return m_cHandle_master;
+ }
+ set {
+ m_cHandle_master = value;
+ }
+ }
+
+
+ public Color ControlMaster {
+ get {
+ return m_cControl_master;
+ }
+ set {
+ m_cControl_master = value;
+ }
+ }
+
+
+ public Color HandleNormal {
+ get {
+ return m_cHandle_normal;
+ }
+ set {
+ m_cHandle_normal = value;
+ }
+ }
+
+
+ public Color ControlNormal {
+ get {
+ return m_cControl_normal;
+ }
+ set {
+ m_cControl_normal = value;
+ }
+ }
+
+ ///
+ /// 繝繝シ繧ソ繝昴う繝ウ繝医ョ謠冗判濶イ繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public Color DataPoint {
+ get {
+ return m_data_point;
+ }
+ set {
+ m_data_point = value;
+ }
+ }
+
+ ///
+ /// 驕ク謚槭&繧後◆繝繝シ繧ソ繝昴う繝ウ繝医ョ謠冗判濶イ繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public Color DataPointHilight {
+ get {
+ return m_data_point_hilight;
+ }
+ set {
+ m_data_point_hilight = value;
+ }
+ }
+
+ public int DataPointSize {
+ get {
+ return m_data_point_size;
+ }
+ set {
+ m_data_point_size = value;
+ }
+ }
+
+
+ public int ControlPointSize {
+ get {
+ return m_control_point_size;
+ }
+ set {
+ m_control_point_size = value;
+ }
+ }
+
+
+ public PointType DataPointType {
+ get {
+ return m_data_point_type;
+ }
+ set {
+ m_data_point_type = value;
+ }
+ }
+
+
+ public PointType ControlPointType {
+ get {
+ return m_control_point_type;
+ }
+ set {
+ m_control_point_type = value;
+ }
+ }
+
+
+ public Color LabelBackground {
+ get {
+ return m_label_back;
+ }
+ set {
+ m_label_back = value;
+ }
+ }
+
+
+ public Color ListBackground {
+ get {
+ return m_list_back;
+ }
+ set {
+ m_list_back = value;
+ }
+ }
+ #endregion
+
+ ///
+ /// 讓ェ霆ク縺ョ繧ケ繧ア繝シ繝ォ繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺兌pixel/(莉サ諢上ョ蜊倅ス)]
+ ///
+ public float XScale {
+ get {
+ return m_xscale;
+ }
+ set {
+ if ( !m_scale_locked && MinXScale <= value && value <= MaxXScale ) {
+ m_xscale = value;
+ }
+ }
+ }
+
+ ///
+ /// 邵ヲ霆ク縺ョ繧ケ繧ア繝シ繝ォ繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺兌pixel/(莉サ諢上ョ蜊倅ス)]
+ ///
+ public float YScale {
+ get {
+ return m_yscale;
+ }
+ set {
+ if ( !m_scale_locked && MinYScale <= value && value <= MaxYScale ) {
+ m_yscale = value;
+ }
+ }
+ }
+
+ ///
+ /// 逕サ髱「蟾ヲ遶ッ縺ォ縺翫¢繧休霆ク縺ョ蛟、繧貞叙蠕励∪縺溘ッ險ュ螳壹@縺セ縺
+ ///
+ public float XOffset {
+ get {
+ return m_xoffset;
+ }
+ set {
+ m_xoffset = value;
+ }
+ }
+
+ ///
+ ///
+ ///
+ public float YOffset {
+ get {
+ return m_yoffset;
+ }
+ set {
+ m_yoffset = value;
+ }
+ }
+
+ ///
+ /// 繧ー繝ゥ繝穂ク翫ョX蠎ァ讓吶rシ後さ繝ウ繝医Ο繝シ繝ォ荳翫ョ蠎ァ讓(pixel)縺ォ謠帷ョ励@縺セ縺
+ ///
+ ///
+ ///
+ private int cX( float sX ) {
+ return (int)((sX + XOffset) * XScale);
+ }
+
+ ///
+ /// 繧ー繝ゥ繝穂ク翫ョY蠎ァ讓吶rシ後さ繝ウ繝医Ο繝シ繝ォ荳翫ョ蠎ァ讓(pixel)縺ォ謠帷ョ励@縺セ縺
+ ///
+ ///
+ ///
+ private int cY( float sY ) {
+ return this.Height - (int)((sY + YOffset) * YScale);
+ }
+
+ private Point cPoint( PointF sPoint ) {
+ return new Point( cX( sPoint.X ), cY( sPoint.Y ) );
+ }
+
+ private float sX( int cX ) {
+ return cX / XScale - XOffset;
+ }
+
+ private float sY( int cY ) {
+ return (this.Height - cY) / YScale - YOffset;
+ }
+
+ private PointF sPoint( Point cPoint ) {
+ return new PointF( sX( cPoint.X ), sY( cPoint.Y ) );
+ }
+
+ private float m_place_x {
+ get {
+ int n1 = (int)Math.Log10( 400 / XScale );
+ int n2 = (int)Math.Log10( 200 / XScale );
+ int n5 = (int)Math.Log10( 80 / XScale );
+ float d1 = (float)Math.Pow( 10, n1 );
+ float d2 = (float)Math.Pow( 10, n2 );
+ float d5 = (float)Math.Pow( 10, n5 );
+ if ( d1 <= 2 * d2 && d1 <= 5 * d5 ) {
+ m_place_count_x = 1;
+ return d1;
+ } else if ( 2 * d2 <= d1 && 2 * d2 <= 5 * d5 ) {
+ m_place_count_x = 2;
+ return d2;
+ } else {
+ m_place_count_x = 5;
+ return d5;
+ }
+ }
+ }
+
+ private float m_place_y {
+ get {
+ int n1 = (int)Math.Log10( 400 / YScale );
+ int n2 = (int)Math.Log10( 200 / YScale );
+ int n5 = (int)Math.Log10( 80 / YScale );
+ float d1 = (float)Math.Pow( 10, n1 );
+ float d2 = (float)Math.Pow( 10, n2 );
+ float d5 = (float)Math.Pow( 10, n5 );
+ if ( d1 <= 2 * d2 && d1 <= 5 * d5 ) {
+ m_place_count_y = 1;
+ return d1;
+ } else if ( 2 * d2 <= d1 && 2 * d2 <= 5 * d5 ) {
+ m_place_count_y = 2;
+ return d2;
+ } else {
+ m_place_count_y = 5;
+ return d5;
+ }
+ }
+ }
+
+ public BezierChain this[string ID] {
+ get {
+ return m_list[ID];
+ }
+ set {
+ m_list[ID] = value;
+ }
+ }
+
+ public float this[string ID, float x] {
+ get {
+ return m_list[ID].GetValue( x );
+ }
+ }
+
+ public bool ScrollEnabled {
+ get {
+ return m_scroll_enabled;
+ }
+ set {
+ m_scroll_enabled = value;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// 髢「謨ー繧呈栢縺代k縺ィ縺咲「コ螳溘↓m_scale_locked = false縺ィ縺吶k縺薙→シシ
+ private void CurveEditor_Paint( object sender, PaintEventArgs e ) {
+ m_scale_locked = true;
+
+ //繧ー繝ゥ繝募縺ョ繝。繝「繝ェ繧呈緒逕サ
+ int o_x = cX( 0f );
+ int o_y = cY( 0f );
+ e.Graphics.DrawLine( new Pen( MainScaleLine ), new Point( 0, o_y ), new Point( this.Width, o_y ) );
+ e.Graphics.DrawLine( new Pen( MainScaleLine ), new Point( o_x, 0 ), new Point( o_x, this.Height ) );
+#if DEBUG
+ //MessageBox.Show( "place_x=" + place_x );
+#endif
+ float place_x = m_place_count_x * m_place_x;
+ int start_x = (int)(sX( 0 ) / place_x) - 1;
+ int end_x = (int)(sX( this.Width ) / place_x) + 1;
+ for ( int i = start_x; i <= end_x; i++ ) {
+ float sx;
+ int px;
+ if ( i != 0 ) {
+ sx = i * place_x;
+ px = cX( sx );
+ e.Graphics.DrawLine( new Pen( ScaleLine ), new Point( px, 0 ), new Point( px, this.Height ) );
+ }
+ sx = (i + 0.5f) * place_x;
+ px = cX( sx );
+ e.Graphics.DrawLine( new Pen( SubScaleLine ), new Point( px, 0 ), new Point( px, this.Height ) );
+ }
+
+ float place_y = m_place_count_y * m_place_y;
+ int start_y = (int)(sY( this.Height ) / place_y) - 1;
+ int end_y = (int)(sY( 0 ) / place_y) + 1;
+ for ( int i = start_y; i <= end_y; i++ ) {
+ float sy;
+ int py;
+ if ( i != 0 ) {
+ sy = i * place_y;
+ py = cY( sy );
+ e.Graphics.DrawLine( new Pen( ScaleLine ), new Point( 0, py ), new Point( this.Width, py ) );
+ }
+ sy = (i + 0.5f) * place_y;
+ py = cY( sy );
+ e.Graphics.DrawLine( new Pen( SubScaleLine ), new Point( 0, py ), new Point( this.Width, py ) );
+ }
+
+ //foreach ( BezierChain chain in m_list.Values ) {
+ foreach ( string ID in m_list.Keys ) {
+ BezierChain chain = m_list[ID];
+ BezierPoint last;
+ if ( chain.Count >= 2 ) {
+ last = chain.List[0];
+ } else {
+ int default_y = cY( chain.Default );
+ e.Graphics.DrawLine( new Pen( chain.Color ), new Point( 0, default_y ), new Point( this.Width, default_y ) );
+ if ( ID == m_selected && chain.Count >= 1 ) {
+ int width2 = m_data_point_size;
+ switch ( DataPointType ) {
+ case PointType.Circle:
+ if ( chain.List[0].ID == m_picked_point_id ) {
+ e.Graphics.FillEllipse( new SolidBrush( DataPointHilight ),
+ new Rectangle( cX( chain.List[0].Base.X ) - width2, cY( chain.List[0].Base.Y ) - width2, 2 * width2, 2 * width2 ) );
+ } else {
+ e.Graphics.FillEllipse( new SolidBrush( DataPoint ),
+ new Rectangle( cX( chain.List[0].Base.X ) - width2, cY( chain.List[0].Base.Y ) - width2, 2 * width2, 2 * width2 ) );
+ }
+ break;
+ case PointType.Rectangle:
+ if ( chain.List[0].ID == m_picked_point_id ) {
+ e.Graphics.FillRectangle( new SolidBrush( DataPointHilight ),
+ new Rectangle( cX( chain.List[0].Base.X ) - width2, cY( chain.List[0].Base.Y ) - width2, 2 * width2, 2 * width2 ) );
+ } else {
+ e.Graphics.FillRectangle( new SolidBrush( DataPoint ),
+ new Rectangle( cX( chain.List[0].Base.X ) - width2, cY( chain.List[0].Base.Y ) - width2, 2 * width2, 2 * width2 ) );
+ }
+ break;
+ }
+ }
+ continue;
+ }
+ int width = m_data_point_size;
+ if ( ID == m_selected ) {
+ switch ( DataPointType ) {
+ case PointType.Circle:
+ if ( chain.List[0].ID == m_picked_point_id ) {
+ e.Graphics.FillEllipse( new SolidBrush( DataPointHilight ),
+ new Rectangle( cX( chain.List[0].Base.X ) - width, cY( chain.List[0].Base.Y ) - width, 2 * width, 2 * width ) );
+ } else {
+ e.Graphics.FillEllipse( new SolidBrush( DataPoint ),
+ new Rectangle( cX( chain.List[0].Base.X ) - width, cY( chain.List[0].Base.Y ) - width, 2 * width, 2 * width ) );
+ }
+ break;
+ case PointType.Rectangle:
+ if ( chain.List[0].ID == m_picked_point_id ) {
+ e.Graphics.FillRectangle( new SolidBrush( DataPointHilight ),
+ new Rectangle( cX( chain.List[0].Base.X ) - width, cY( chain.List[0].Base.Y ) - width, 2 * width, 2 * width ) );
+ } else {
+ e.Graphics.FillRectangle( new SolidBrush( DataPoint ),
+ new Rectangle( cX( chain.List[0].Base.X ) - width, cY( chain.List[0].Base.Y ) - width, 2 * width, 2 * width ) );
+ }
+ break;
+ }
+ }
+
+ //繝繝輔か繝ォ繝亥、シ亥キヲ蛛エシ峨ョ謠冗判
+ if ( chain.Count >= 1 ) {
+ int default_y = cY( chain.Default );
+ int x = cX( chain.List[0].Base.X );
+ int y = cY( chain.List[0].Base.Y );
+ e.Graphics.DrawLine( new Pen( chain.Color ), new Point( x, default_y ), new Point( -1, default_y ) );
+ e.Graphics.DrawLine( new Pen( chain.Color ), new Point( x, default_y ), new Point( x, y ) );
+ }
+ //for ( int i = 1; i < chain.Count; i++ ) {
+ bool first = true;
+ Size sz = new Size( 2 * width, 2 * width );
+ for( int i = 0; i < chain.List.Count; i++ ){
+ BezierPoint bp = chain.List[i];
+ if ( first ) {
+ last = bp;
+ first = false;
+ continue;
+ }
+ //if ( last.ControlRightType != ControlType.None && chain[i].ControlLeftType != ControlType.None ) {
+ e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
+ e.Graphics.DrawBezier( new Pen( chain.Color ),
+ cPoint( last.Base ),
+ cPoint( last.ControlRight ),
+ cPoint( bp.ControlLeft ),
+ cPoint( bp.Base ) );
+ e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
+
+ //蛻カ蠕。繝上Φ繝峨Ν逕ィ縺ョ邱
+ if ( ID == m_selected ) {
+ if ( bp.ControlLeftType == ControlType.Master ) {
+ e.Graphics.DrawLine( new Pen( HandleMaster ), cPoint( bp.Base ), cPoint( bp.ControlLeft ) );
+ } else if ( bp.ControlLeftType == ControlType.Normal ) {
+ e.Graphics.DrawLine( new Pen( HandleNormal ), cPoint( bp.Base ), cPoint( bp.ControlLeft ) );
+ }
+ if ( last.ControlRightType == ControlType.Master ) {
+ e.Graphics.DrawLine( new Pen( HandleMaster ), cPoint( last.Base ), cPoint( last.ControlRight ) );
+ } else if ( last.ControlRightType == ControlType.Normal ) {
+ e.Graphics.DrawLine( new Pen( HandleNormal ), cPoint( last.Base ), cPoint( last.ControlRight ) );
+ }
+
+ //繝繝シ繧ソ轤ケ
+ width = m_data_point_size;
+ Point data_point = new Point( cX( bp.Base.X ) - width, cY( bp.Base.Y ) - width );
+ switch ( DataPointType ) {
+ case PointType.Circle:
+ if ( bp.ID == m_picked_point_id ) {
+ e.Graphics.FillEllipse( new SolidBrush( DataPointHilight ),
+ new Rectangle( data_point, sz ) );
+ } else {
+ e.Graphics.FillEllipse( new SolidBrush( DataPoint ),
+ new Rectangle( data_point, sz ) );
+ }
+ break;
+ case PointType.Rectangle:
+ if ( bp.ID == m_picked_point_id ) {
+ e.Graphics.FillRectangle( new SolidBrush( DataPointHilight ),
+ new Rectangle( data_point, sz ) );
+ } else {
+ e.Graphics.FillRectangle( new SolidBrush( DataPoint ),
+ new Rectangle( data_point, sz ) );
+ }
+ break;
+ }
+
+ //蛻カ蠕。繝上Φ繝峨Ν轤ケ
+ width = m_control_point_size;
+ Color cLeft = Color.Black;
+ Color cRight = Color.Black;
+ if ( bp.ControlLeftType == ControlType.Master ) {
+ cLeft = ControlMaster;
+ } else if ( bp.ControlLeftType == ControlType.Normal ) {
+ cLeft = ControlNormal;
+ }
+ if ( last.ControlRightType == ControlType.Master ) {
+ cRight = ControlMaster;
+ } else if ( last.ControlRightType == ControlType.Normal ) {
+ cRight = ControlNormal;
+ }
+ if ( bp.ControlLeftType != ControlType.None && (bp.ControlLeft.X != bp.Base.X || bp.ControlLeft.Y != bp.Base.Y) ) {
+ Point ctrl_left = new Point( cX( bp.ControlLeft.X ) - width, cY( bp.ControlLeft.Y ) - width );
+ switch ( ControlPointType ) {
+ case PointType.Circle:
+ e.Graphics.FillEllipse( new SolidBrush( cLeft ), new Rectangle( ctrl_left, sz ) );
+ break;
+ case PointType.Rectangle:
+ e.Graphics.FillRectangle( new SolidBrush( cLeft ), new Rectangle( ctrl_left, sz ) );
+ break;
+ }
+ }
+ if ( last.ControlRightType != ControlType.None && (last.ControlRight.X != last.Base.X || last.ControlRight.Y != last.Base.Y) ) {
+ Point ctrl_right = new Point( cX( last.ControlRight.X ) - width, cY( last.ControlRight.Y ) - width );
+ switch ( ControlPointType ) {
+ case PointType.Circle:
+ e.Graphics.FillEllipse( new SolidBrush( cRight ), new Rectangle( ctrl_right, sz ) );
+ break;
+ case PointType.Rectangle:
+ e.Graphics.FillRectangle( new SolidBrush( cRight ), new Rectangle( ctrl_right, sz ) );
+ break;
+ }
+ }
+ }
+ last = bp;
+ }
+
+ //繝繝輔か繝ォ繝亥、シ亥承蛛エシ峨ョ謠冗判
+ if ( chain.Count >= 1 ) {
+ int default_y = cY( chain.Default );
+ int x = cX( last.Base.X );
+ int y = cY( last.Base.Y );
+ e.Graphics.DrawLine( new Pen( chain.Color ), new Point( x, default_y ), new Point( this.Width + 1, default_y ) );
+ e.Graphics.DrawLine( new Pen( chain.Color ), new Point( x, default_y ), new Point( x, y ) );
+ }
+ }
+
+ // 繝槭え繧ケ菴咲スョ縺ョ謨ー蛟、繧呈緒逕サ
+ if ( _number_visible ) {
+ int x = cX( _number.X );
+ int y = cY( _number.Y );
+ e.Graphics.DrawString( "x : " + _number.X,
+ _font,
+ Brushes.Black,
+ new PointF( x, y - 24 ) );
+ e.Graphics.DrawString( "y : " + _number.Y,
+ _font,
+ Brushes.Black,
+ new PointF( x, y - 12 ) );
+ } else {
+ float x = sX( _mouse_position.X );
+ float y = sY( _mouse_position.Y );
+ e.Graphics.DrawString( "x : " + x,
+ _font,
+ Brushes.Black,
+ new PointF( _mouse_position.X, _mouse_position.Y - 24 ) );
+ e.Graphics.DrawString( "y : " + y,
+ _font,
+ Brushes.Black,
+ new PointF( _mouse_position.X, _mouse_position.Y - 12 ) );
+ }
+
+ int label_y = 0;
+ using ( Font font = new Font( "MS UI Gothic", 9 ) ) {
+ //繝ゥ繝吶Ν繧呈緒逕サ縲ゑシ亥ソ隕√↑繧会シ
+ switch ( XLabel ) {
+ case XLabel.Top:
+ e.Graphics.FillRectangle( new SolidBrush( LabelBackground ),
+ new Rectangle( 0, 0, this.Width, LABEL_WIDTH ) );
+ break;
+ case XLabel.Bottom:
+ e.Graphics.FillRectangle( new SolidBrush( LabelBackground ),
+ new Rectangle( 0, this.Height - LABEL_WIDTH, this.Width, LABEL_WIDTH ) );
+ label_y = this.Height - LABEL_WIDTH;
+ break;
+ }
+ if ( XLabel != XLabel.None ) {
+ for ( int i = start_x; i <= end_x; i++ ) {
+ float sx = i * place_x;
+ int px = cX( sx );
+ e.Graphics.DrawString( sx.ToString(), font, Brushes.Black, new PointF( px, label_y ) );
+ }
+ }
+
+ int label_x = 0;
+ switch ( YLabel ) {
+ case YLabel.Left:
+ e.Graphics.FillRectangle(
+ new SolidBrush( LabelBackground ),
+ new Rectangle( 0, 0, LABEL_WIDTH, this.Height ) );
+ break;
+ case YLabel.Right:
+ if ( ShowList ) {
+ label_x = this.Width - LABEL_WIDTH - LIST_WIDTH;
+ } else {
+ label_x = this.Width - LABEL_WIDTH;
+ }
+ e.Graphics.FillRectangle(
+ new SolidBrush( LabelBackground ),
+ new Rectangle( label_x, 0, LABEL_WIDTH, this.Height ) );
+ break;
+ }
+ if ( YLabel != YLabel.None ) {
+ for ( int i = start_y; i <= end_y; i++ ) {
+ float sy = i * place_y;
+ int py = cY( sy );
+ e.Graphics.DrawString( sy.ToString(), font, Brushes.Black, new PointF( label_x, py ) );
+ }
+ }
+
+ //繝ェ繧ケ繝医r謠上¥
+ if ( ShowList ) {
+ e.Graphics.FillRectangle(
+ new SolidBrush( ListBackground ),
+ new Rectangle( this.Width - LIST_WIDTH, 0, LIST_WIDTH, this.Height ) );
+ e.Graphics.DrawLine(
+ Pens.Black,
+ new Point( this.Width - LIST_WIDTH, 0 ),
+ new Point( this.Width - LIST_WIDTH, this.Height ) );
+ int count = 0;
+ using ( Font labelfont = new Font( "Arial", 12, FontStyle.Bold, GraphicsUnit.Pixel ) ) {
+ foreach ( string name in m_list.Keys ) {
+ e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
+ if ( name == m_selected ) {
+ e.Graphics.DrawString(
+ name,
+ labelfont,
+ Brushes.White,
+ new PointF( this.Width - 40, count * 17 + 2 ) );
+ } else {
+ e.Graphics.DrawString(
+ name,
+ labelfont,
+ Brushes.Black,
+ new PointF( this.Width - 40, count * 17 + 2 ) );
+ }
+ e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
+ e.Graphics.FillRectangle(
+ new SolidBrush( m_list[name].Color ),
+ new Rectangle( this.Width - 55, count * 17 + 2, 10, 15 ) );
+ count++;
+ }
+ }
+ }
+ }
+ m_scale_locked = false;
+ }
+
+ private void CurveEditor_MouseDown( object sender, MouseEventArgs e ) {
+ m_mouse_moved = false;
+ if ( e.Button == MouseButtons.Middle || (m_spacekey_down && e.Button == MouseButtons.Left ) ) {
+ if ( m_spacekey_down && ((e.Button & MouseButtons.Left) == MouseButtons.Left) ) {
+ m_drag_with_space_key = true;
+ }
+ #region MouseButtons.Middle
+ if ( ScrollEnabled ) {
+ switch ( XLabel ) {
+ case XLabel.Top:
+ if ( e.Y <= LABEL_WIDTH ) {
+ return;
+ }
+ break;
+ case XLabel.Bottom:
+ if ( this.Height - LABEL_WIDTH <= e.Y ) {
+ return;
+ }
+ break;
+ }
+ switch ( YLabel ) {
+ case YLabel.Left:
+ if ( e.X <= LABEL_WIDTH ) {
+ return;
+ }
+ if ( ShowList && this.Width - LIST_WIDTH <= e.X ) {
+ return;
+ }
+ break;
+ case YLabel.Right:
+ if ( ShowList ) {
+ if ( this.Width - LIST_WIDTH - LABEL_WIDTH <= e.X && e.X <= this.Width - LIST_WIDTH ) {
+ // 霆ク繝ゥ繝吶Ν縺ョ驛ィ蛻縺ァ繝槭え繧ケ繝繧ヲ繝ウ
+ return;
+ } else if ( this.Width - LIST_WIDTH <= e.X ) {
+ // 繝ェ繧ケ繝医ョ驛ィ蛻縺ァ繝槭え繧ケ繝繧ヲ繝ウ
+ return;
+ }
+ } else {
+ if ( this.Width - LABEL_WIDTH <= e.X ) {
+ return;
+ }
+ }
+ break;
+ }
+ m_drag_start = e.Location;
+ m_old_xoffset = m_xoffset;
+ m_old_yoffset = m_yoffset;
+ Drag = true;
+ }
+ #endregion
+ } else if ( e.Button == MouseButtons.Left ) {
+ #region MouseButtons.Left
+
+ #region 繝ェ繧ケ繝
+ // 蜿ウ縺ョ繝ェ繧ケ繝医ョ驛ィ蛻縺後け繝ェ繝繧ッ縺輔l縺溘°縺ゥ縺縺九r讀懈渊
+ if ( ShowList && this.Width - LIST_WIDTH <= e.X ) {
+ int count = 0;
+
+ foreach ( string name in m_list.Keys ) {
+ Rectangle active = new Rectangle( this.Width - 55, count * 17, 50, 16 );
+ if ( active.X <= e.X && e.X <= active.X + active.Width &&
+ active.Y <= e.Y && e.Y <= active.Y + active.Height ) {
+ m_selected = name;
+ if ( RescaleYEnabled ) {
+ /*float min, max;
+ m_list[m_selected].GetMinMax( out min, out max );
+#if DEBUG
+ LipSync.Common.DebugWriteLine( "min,max=" + min + "," + max );
+#endif
+ if ( min != max ) {
+ float dif = max - min;
+ YScale = this.GraphSize.Height / (dif * 1.1f);
+ float new_offset;
+ if ( XLabel == XLabel.Bottom ) {
+ new_offset = -(min - dif * 0.05f - LABEL_WIDTH / YScale);
+ } else {
+ new_offset = -min + dif * 0.05f;
+ }
+ YOffset = new_offset;
+ }*/
+ YScale = m_list_minmax[m_selected].Scale;
+ YOffset = m_list_minmax[m_selected].Offset;
+ }
+ this.Invalidate();
+ return;
+ }
+ count++;
+ }
+ m_selected = "";
+ this.Invalidate();
+ return;
+ }
+
+ #endregion
+
+ #region 繧ケ繧ア繝シ繝ォ驛ィ蛻
+ if ( XLabel == XLabel.Top ) {
+ if ( 0 <= e.Y && e.Y <= LABEL_WIDTH ) {
+ m_change_xscale = true;
+ m_change_origin = e.X;
+ m_old_scale = XScale;
+ return;
+ }
+ } else if ( XLabel == XLabel.Bottom ) {
+ if ( this.Height - LABEL_WIDTH <= e.Y && e.Y <= this.Height ) {
+ m_change_xscale = true;
+ m_change_origin = e.X;
+ m_old_scale = XScale;
+ return;
+ }
+ }
+
+ if ( YLabel == YLabel.Left ) {
+ if ( 0 <= e.X && e.X <= LABEL_WIDTH ) {
+ m_change_yscale = true;
+ m_change_origin = e.Y;
+ m_old_scale = YScale;
+ return;
+ }
+ } else if ( YLabel == YLabel.Right ) {
+ if ( ShowList ) {
+ if ( this.Width - LIST_WIDTH - LABEL_WIDTH <= e.X && e.X <= this.Width - LIST_WIDTH ) {
+ m_change_yscale = true;
+ m_change_origin = e.Y;
+ m_old_scale = YScale;
+ return;
+ }
+ } else {
+ if ( this.Width - LABEL_WIDTH <= e.X && e.X <= this.Width ) {
+ m_change_yscale = true;
+ m_change_origin = e.Y;
+ m_old_scale = YScale;
+ return;
+ }
+ }
+ }
+
+ #endregion
+
+ #region 繝槭え繧ケ菴咲スョ縺ョ繝繝シ繧ソ轤ケ繧呈、懃エ「
+
+ DetectSelectedPoint( e.Location, out m_picked_point_id, out m_picked_side );
+#if DEBUG
+ Common.DebugWriteLine( "CureveEditor_MouseDown" );
+ Common.DebugWriteLine( " m_picked_point_id=" + m_picked_point_id );
+ Common.DebugWriteLine( " m_picked_side=" + m_picked_side );
+#endif
+ if ( m_picked_point_id >= 0 ) {
+ if ( m_picked_side == PickedSide.Base ) {
+ m_before_edit = m_list[m_selected][m_picked_point_id].Base;
+ } else if ( m_picked_side == PickedSide.Left ) {
+ m_before_edit = m_list[m_selected][m_picked_point_id].ControlLeft;
+ } else {
+ m_before_edit = m_list[m_selected][m_picked_point_id].ControlRight;
+ }
+ _number_visible = true;
+ m_mouse_down_mode = MouseDownMode.MovePoint;
+ Invalidate();
+ } else {
+ m_mouse_down_mode = MouseDownMode.Nothing;
+ }
+
+ #endregion
+ #endregion
+ }
+ }
+
+ ///
+ /// 繧ォ繝シ繝悶お繝繧」繧ソ逕サ髱「荳翫ョ謖螳壹&繧後◆轤ケ縺ォ縺ゅk繝繝シ繧ソ轤ケ繧定ェソ縺ケ縺セ縺吶
+ ///
+ ///
+ ///
+ ///
+ private void DetectSelectedPoint( Point e, out int picked_point_id, out PickedSide picked_side ) {
+ picked_point_id = -1;
+ picked_side = PickedSide.Base;
+ if ( m_selected != "" ) {
+ Rectangle active;
+ Point pt;
+ for ( int i = 0; i < m_list[m_selected].List.Count; i++ ) {
+ pt = cPoint( m_list[m_selected].List[i].Base );
+ int width = m_data_point_size;
+ pt = new Point( pt.X - width - 1, pt.Y - width - 1 );
+ active = new Rectangle( pt, new Size( width * 2 + 2, width * 2 + 2 ) );
+ if ( active.X <= e.X && e.X <= active.X + active.Width &&
+ active.Y <= e.Y && e.Y <= active.Y + active.Height ) {
+ picked_point_id = m_list[m_selected].List[i].ID;
+ picked_side = PickedSide.Base;
+ //m_before_edit = m_list[m_selected][i].Base;
+ //m_mouse_upped = false;
+ //_number_visible = true;
+ return;
+ }
+
+ pt = cPoint( m_list[m_selected].List[i].ControlLeft );
+ width = m_control_point_size;
+ pt = new Point( pt.X - width - 1, pt.Y - width - 1 );
+ active = new Rectangle( pt, new Size( width * 2 + 2, width * 2 + 2 ) );
+ if ( active.X <= e.X && e.X <= active.X + active.Width &&
+ active.Y <= e.Y && e.Y <= active.Y + active.Height ) {
+ picked_point_id = m_list[m_selected].List[i].ID;
+ picked_side = PickedSide.Left;
+ //m_before_edit = m_list[m_selected][i].ControlLeft;
+ //m_mouse_upped = false;
+ //_number_visible = true;
+ return;
+ }
+ pt = cPoint( m_list[m_selected].List[i].ControlRight );
+ width = m_control_point_size;
+ pt = new Point( pt.X - width - 1, pt.Y - width - 1 );
+ active = new Rectangle( pt, new Size( width * 2 + 2, width * 2 + 2 ) );
+ if ( active.X <= e.X && e.X <= active.X + active.Width &&
+ active.Y <= e.Y && e.Y <= active.Y + active.Height ) {
+ picked_point_id = m_list[m_selected].List[i].ID;
+ picked_side = PickedSide.Right;
+ //m_before_edit = m_list[m_selected][i].ControlRight;
+ //m_mouse_upped = false;
+ //_number_visible = true;
+ return;
+ }
+ }
+ //m_picked_point = -1;
+ //m_mouse_upped = true;
+ }
+ }
+
+ private void CurveEditor_MouseUp( object sender, MouseEventArgs e ) {
+ Drag = false;
+ m_drag_with_space_key = false;
+ if ( m_selected != "" && m_mouse_down_mode == MouseDownMode.MovePoint && m_picked_point_id >= 0 && m_mouse_moved ) {
+ PointF new_pt = m_list[m_selected][m_picked_point_id].GetPosition( m_picked_side );
+ Command run = Command.GCommandEditPosition( m_selected, m_picked_point_id, m_picked_side, new_pt );
+ m_list[m_selected][m_picked_point_id].SetPosition( m_picked_side, m_before_edit );
+ Register( Execute( run ) );
+ this.Invalidate();
+ }
+ m_mouse_down_mode = MouseDownMode.Nothing;
+
+ m_change_xscale = false;
+ m_change_yscale = false;
+
+ _number_visible = false;
+ }
+
+ private void CurveEditor_MouseMove( object sender, MouseEventArgs e ) {
+ m_mouse_moved = true;
+ _mouse_position = e.Location;
+ if ( Drag ) {
+ bool drag_ok = false;
+ if ( m_drag_with_space_key ) {
+ if ( m_spacekey_down ) {
+ drag_ok = true;
+ }
+ } else {
+ drag_ok = true;
+ }
+ if ( drag_ok && m_selected != "" ) {
+ int dx = e.X - m_drag_start.X;
+ int dy = m_drag_start.Y - e.Y;
+ XOffset = m_old_xoffset + dx / m_xscale;
+ YOffset = m_old_yoffset + dy / m_yscale;
+ m_list_minmax[m_selected].Offset = YOffset;
+ this.Invalidate();
+ }
+ } else if ( m_picked_point_id >= 0 && m_mouse_down_mode == MouseDownMode.MovePoint ) {
+ PointF new_pt = sPoint( e.Location );
+ BezierPoint bp = m_list[m_selected][m_picked_point_id];
+ int centre = m_list[m_selected].GetIndexFromId( m_picked_point_id );
+ int left_id = m_list[m_selected].GetIdFromIndex( centre - 1 );
+ int right_id = m_list[m_selected].GetIdFromIndex( centre + 1 );
+ switch ( m_picked_side ) {
+ case PickedSide.Base:
+ #region PickedSide.Base
+ if ( 1 <= centre ) {
+ if ( new_pt.X < m_list[m_selected][left_id].Base.X ) {
+ new_pt.X = m_list[m_selected][left_id].Base.X;
+ }
+ if ( bp.ControlLeftType != ControlType.None ) {
+ float x1 = m_list[m_selected][left_id].Base.X;
+ float x2 = m_list[m_selected][left_id].ControlRight.X;
+ float x3 = new_pt.X + (bp.ControlLeft.X - bp.Base.X);
+ float x4 = new_pt.X;
+ if ( !IsBezierImplicit( x1, x2, x3, x4 ) ) {
+ bp.Base = new PointF( bp.Base.X, new_pt.Y );
+ _number = bp.Base;
+ this.Invalidate();
+ return;
+ }
+ }
+ }
+ if ( centre < m_list[m_selected].Count - 1 ) {
+ if ( m_list[m_selected][right_id].Base.X < new_pt.X ) {
+ new_pt.X = m_list[m_selected][right_id].Base.X;
+ }
+ if ( bp.ControlRightType != ControlType.None ) {
+ float x1 = new_pt.X;
+ float x2 = new_pt.X + (bp.ControlRight.X - bp.Base.X);
+ float x3 = m_list[m_selected][right_id].ControlLeft.X;
+ float x4 = m_list[m_selected][right_id].Base.X;
+ if ( !IsBezierImplicit( x1, x2, x3, x4 ) ) {
+ bp.Base = new PointF( bp.Base.X, new_pt.Y );
+ _number = bp.Base;
+ this.Invalidate();
+ return;
+ }
+ }
+ }
+ bp.Base = new_pt;
+ _number = bp.Base;
+ #endregion
+ break;
+ case PickedSide.Right:
+ #region PickedSide.Right
+ if ( centre < m_list[m_selected].Count - 1 ) {
+ float x1 = bp.Base.X;
+ float x2 = new_pt.X;
+ float x3 = m_list[m_selected][right_id].ControlLeft.X;
+ float x4 = m_list[m_selected][right_id].Base.X;
+ bool is_right = IsBezierImplicit( x1, x2, x3, x4 );
+
+ bool is_left = true;
+ float dx = new_pt.X - bp.Base.X;
+ float dy = new_pt.Y - bp.Base.Y;
+ float k = 1f;
+ //if ( bp.ControlRightType == ControlType.Master && m_picked_point >= 1 ) {
+ if ( bp.ControlRightType != ControlType.None && centre >= 1 ) {
+ x1 = m_list[m_selected][left_id].Base.X;
+ x2 = m_list[m_selected][left_id].ControlRight.X;
+ float dx1 = (bp.ControlLeft.X - bp.Base.X) * XScale;
+ float dy1 = (bp.ControlLeft.Y - bp.Base.Y) * YScale;
+ float length = (float)Math.Sqrt( dx1 * dx1 + dy1 * dy1 );
+ float tdx = dx * XScale;
+ float tdy = dy * YScale;
+ k = length / (float)Math.Sqrt( tdx * tdx + tdy * tdy );
+ x3 = bp.Base.X - dx * k;
+ x4 = bp.Base.X;
+ is_left = IsBezierImplicit( x1, x2, x3, x4 );
+ }
+ if ( is_right && is_left ) {
+ bp.ControlRight = new_pt;
+ _number = bp.ControlRight;
+ if ( bp.ControlRightType == ControlType.Master && centre >= 1 && bp.ControlLeftType != ControlType.None ) {
+ bp.ControlLeft = new PointF( bp.Base.X - dx * k, bp.Base.Y - dy * k );
+ }
+ this.Invalidate();
+ return;
+ } else {
+ if ( centre == 0 ) {
+ bp.ControlRight = new PointF( bp.ControlRight.X, new_pt.Y );
+ _number = bp.ControlRight;
+ this.Invalidate();
+ return;
+ } else {
+ //縺ィ繧翫≠縺医★new_pt縺ョy縺縺第崛縺医※縺ソ縺ヲ蜀崎ゥ穂セ。縺励※縺ソ繧
+ new_pt = new PointF( bp.ControlRight.X, new_pt.Y );
+ dx = new_pt.X - bp.Base.X;
+ dy = new_pt.Y - bp.Base.Y;
+ x1 = bp.Base.X;
+ x2 = new_pt.X;
+ x3 = m_list[m_selected][right_id].ControlLeft.X;
+ x4 = m_list[m_selected][right_id].Base.X;
+ is_right = IsBezierImplicit( x1, x2, x3, x4 );
+ is_left = true;
+ if ( bp.ControlRightType == ControlType.Master ) {
+ x1 = m_list[m_selected][left_id].Base.X;
+ x2 = m_list[m_selected][left_id].ControlRight.X;
+ float dx2 = (bp.ControlLeft.X - bp.Base.X) * XScale;
+ float dy2 = (bp.ControlLeft.Y - bp.Base.Y) * YScale;
+ float length = (float)Math.Sqrt( dx2 * dx2 + dy2 * dy2 );
+ float tdx = dx * XScale;
+ float tdy = dy * YScale;
+ k = length / (float)Math.Sqrt( tdx * tdx + tdy * tdy );
+ x3 = bp.Base.X - dx * k;
+ x4 = bp.Base.X;
+ is_left = IsBezierImplicit( x1, x2, x3, x4 );
+ }
+ if ( is_right && is_left ) {
+ bp.ControlRight = new PointF( bp.ControlRight.X, new_pt.Y );
+ _number = bp.ControlRight;
+ if ( bp.ControlRightType == ControlType.Master ) {
+ bp.ControlLeft = new PointF( bp.Base.X - dx * k, bp.Base.Y - dy * k );
+ }
+ this.Invalidate();
+ return;
+ }
+ }
+ }
+ } else {
+ bp.ControlRight = new_pt;
+ _number = bp.ControlRight;
+ }
+ #endregion
+ break;
+ case PickedSide.Left:
+ #region PickedSide.Left
+ if ( centre >= 1 ) {
+ float x1 = m_list[m_selected][left_id].Base.X;
+ float x2 = m_list[m_selected][left_id].ControlRight.X;
+ float x3 = new_pt.X;
+ float x4 = bp.Base.X;
+ bool is_left = IsBezierImplicit( x1, x2, x3, x4 );
+
+ bool is_right = true;
+ float dx = new_pt.X - bp.Base.X;
+ float dy = new_pt.Y - bp.Base.Y;
+ float k = 1f;
+ if ( bp.ControlLeftType != ControlType.None && centre < m_list[m_selected].Count - 1 ) {
+ //if ( bp.ControlLeftType == ControlType.Master && m_picked_point < m_list[m_selected].Count - 1 ) {
+ float dx1 = (bp.ControlRight.X - bp.Base.X) * XScale;
+ float dy1 = (bp.ControlRight.Y - bp.Base.Y) * YScale;
+ float length = (float)Math.Sqrt( dx1 * dx1 + dy1 * dy1 );
+ float tdx = dx * XScale;
+ float tdy = dy * YScale;
+ k = length / (float)Math.Sqrt( tdx * tdx + tdy * tdy );
+ x1 = bp.Base.X;
+ x2 = bp.Base.X - dx * k;
+ x3 = m_list[m_selected][right_id].ControlLeft.X;
+ x4 = m_list[m_selected][right_id].Base.X;
+ is_right = IsBezierImplicit( x1, x2, x3, x4 );
+ }
+ if ( is_right && is_left ) {
+ bp.ControlLeft = new_pt;
+ _number = bp.ControlLeft;
+ if ( bp.ControlLeftType == ControlType.Master && centre >= 1 && bp.ControlRightType != ControlType.None ) {
+ bp.ControlRight = new PointF( bp.Base.X - dx * k, bp.Base.Y - dy * k );
+ }
+ this.Invalidate();
+ return;
+ } else {
+ if ( centre == m_list[m_selected].Count - 1 ) {
+ bp.ControlLeft = new PointF( bp.ControlLeft.X, new_pt.Y );
+ _number = bp.ControlLeft;
+ this.Invalidate();
+ return;
+ } else {
+ //縺ィ繧翫≠縺医★new_pt縺ョy縺縺第崛縺医※縺ソ縺ヲ蜀崎ゥ穂セ。縺励※縺ソ繧
+ new_pt = new PointF( bp.ControlLeft.X, new_pt.Y );
+ dx = new_pt.X - bp.Base.X;
+ dy = new_pt.Y - bp.Base.Y;
+ x1 = m_list[m_selected][left_id].Base.X;
+ x2 = m_list[m_selected][left_id].ControlRight.X;
+ x3 = new_pt.X;
+ x4 = bp.Base.X;
+ is_left = IsBezierImplicit( x1, x2, x3, x4 );
+ is_right = true;
+ if ( bp.ControlLeftType == ControlType.Master ) {
+ float dx2 = (bp.ControlRight.X - bp.Base.X) * XScale;
+ float dy2 = (bp.ControlRight.Y - bp.Base.Y) * YScale;
+ float length = (float)Math.Sqrt( dx2 * dx2 + dy2 * dy2 );
+ float tdx = dx * XScale;
+ float tdy = dy * YScale;
+ k = length / (float)Math.Sqrt( tdx * tdx + tdy * tdy );
+ x1 = bp.Base.X;
+ x2 = bp.Base.X - dx * k;
+ x3 = m_list[m_selected][right_id].ControlLeft.X;
+ x4 = m_list[m_selected][right_id].Base.X;
+ is_right = IsBezierImplicit( x1, x2, x3, x4 );
+ }
+ if ( is_right && is_left ) {
+ bp.ControlLeft = new PointF( bp.ControlLeft.X, new_pt.Y );
+ _number = bp.ControlLeft;
+ if ( bp.ControlLeftType == ControlType.Master ) {
+ bp.ControlRight = new PointF( bp.Base.X - dx * k, bp.Base.Y - dy * k );
+ }
+ this.Invalidate();
+ return;
+ }
+ }
+ }
+ } else {
+ bp.ControlLeft = new_pt;
+ _number = bp.ControlLeft;
+ }
+ //譏斐ョ=>
+ /*if ( m_picked_point >= 1 ) {
+ float x1 = m_list[m_selected][m_picked_point - 1].Base.X;
+ float x2 = m_list[m_selected][m_picked_point - 1].ControlRight.X;
+ float x3 = new_pt.X;
+ float x4 = bp.Base.X;
+ if ( !IsBezierImplicit( x1, x2, x3, x4 ) ) {
+ bp.ControlLeft = new PointF( bp.ControlLeft.X, new_pt.Y );
+ this.Invalidate();
+ return;
+ }
+ }
+ bp.ControlLeft = new_pt;*/
+ //<=縺薙%縺セ縺ァ
+ #endregion
+ break;
+ }
+ this.Invalidate();
+ } else if ( m_change_xscale ) {
+ float new_scale = m_old_scale * (float)Math.Pow( 10, (e.X - m_change_origin) / CHANGE_SCALE_ORDER );
+ if ( new_scale < MinXScale ) {
+ new_scale = MinXScale;
+ } else if ( MaxXScale < new_scale ) {
+ new_scale = MaxXScale;
+ }
+ if ( new_scale != XScale ) {
+ XOffset = (m_change_origin) * (1f / new_scale - 1f / XScale) + XOffset;
+ XScale = new_scale;
+ this.Invalidate();
+ }
+ } else if ( m_change_yscale ) {
+ float new_scale = m_old_scale * (float)Math.Pow( 10, (e.Y - m_change_origin) / CHANGE_SCALE_ORDER );
+ if ( new_scale < MinYScale ) {
+ new_scale = MinYScale;
+ } else if ( MaxYScale < new_scale ) {
+ new_scale = MaxYScale;
+ }
+ if ( new_scale != YScale ) {
+ YOffset = m_change_origin * (1f / new_scale - 1f / YScale) + YOffset;
+ YScale = new_scale;
+ m_list_minmax[m_selected].Offset = YOffset;
+ m_list_minmax[m_selected].Scale = YScale;
+ this.Invalidate();
+ }
+ }
+ this.Invalidate();
+ }
+
+ private void CurveEditor_Resize( object sender, EventArgs e ) {
+ this.Invalidate();
+ }
+
+ private void CurveEditor_MouseDoubleClick( object sender, MouseEventArgs e ) {
+ if ( m_selected == "" ) {
+ return;
+ }
+ float x = sX( e.X );
+ float y = sY( e.Y );
+
+ int picked_id;
+ PickedSide picked_side;
+ DetectSelectedPoint( e.Location, out picked_id, out picked_side );
+ if ( picked_id >= 0 ) {
+ m_picked_point_id = picked_id;
+ m_picked_side = picked_side;
+ m_before_edit = m_list[m_selected][m_picked_point_id].GetPosition( m_picked_side );
+ using ( LipSync.SetSize dlg = new LipSync.SetSize(
+ _( "Numeric entry" ),
+ "x",
+ "y",
+ m_before_edit.X,
+ m_before_edit.Y ) ) {
+ if ( dlg.ShowDialog() == DialogResult.OK ) {
+ SizeF res = new SizeF( dlg.ResultWidth, dlg.ResultHeight );
+ PointF new_pt = new PointF( res.Width, res.Height );
+ Command run = Command.GCommandEditPosition( m_selected, m_picked_point_id, m_picked_side, new_pt );
+ m_list[m_selected][m_picked_point_id].SetPosition( m_picked_side, m_before_edit );
+ Register( Execute( run ) );
+ this.Invalidate();
+ }
+ }
+ } else {
+ float handle_length;
+ float slope = 0f;
+ if ( m_list[m_selected].Count == 0 ) {
+ handle_length = x * 0.5f;
+ } else {
+ int right_point = -1;
+ //蜿ウ蛛エ縺ョ轤ケ繧呈、懃エ「
+ for ( int i = 0; i < m_list[m_selected].List.Count; i++ ) {
+ if ( x == m_list[m_selected].List[i].Base.X ) {
+ //x縺檎ュ峨@縺上↑繧倶ス咲スョ縺ォ縺ッ繝繝シ繧ソ轤ケ繧定ソス蜉縺ァ縺阪↑縺莉墓ァ倥
+ return;
+ }
+ if ( x < m_list[m_selected].List[i].Base.X ) {
+ right_point = i;
+ break;
+ }
+ }
+ if ( right_point == -1 ) {
+ // 譛繧ょ承
+ float dx = Math.Abs( x - m_list[m_selected].List[m_list[m_selected].List.Count - 1].Base.X );
+ handle_length = dx / 2;
+ } else if ( right_point == 0 ) {
+ float dx = Math.Abs( m_list[m_selected].List[0].Base.X - x );
+ handle_length = dx / 2;
+ } else {
+ float dx_r = Math.Abs( m_list[m_selected].List[right_point].Base.X - x );
+ float dx_l = Math.Abs( x - m_list[m_selected].List[right_point - 1].Base.X );
+ handle_length = Math.Min( dx_r, dx_l ) / 2;
+ slope = (m_list[m_selected].List[right_point].Base.Y - m_list[m_selected].List[right_point - 1].Base.Y) /
+ (m_list[m_selected].List[right_point].Base.X - m_list[m_selected].List[right_point - 1].Base.X);
+ }
+ }
+
+ PointF p_left, p_right;
+ p_right = new PointF( x + handle_length, y + handle_length * slope );
+ p_left = new PointF( x - handle_length, y - handle_length * slope );
+ BezierPoint bp = new BezierPoint( new PointF( x, y ),
+ p_left,
+ p_right );
+ bp.ControlLeftType = m_last_added_type;
+ bp.ControlRightType = m_last_added_type;
+ Command run = Command.GCommandAdd( m_selected, bp );
+ Register( Execute( run ) );
+ m_picked_side = PickedSide.Base;
+ for ( int i = 0; i < m_list[m_selected].List.Count; i++ ) {
+ BezierPoint bpoint = m_list[m_selected].List[i];
+ if ( x == bpoint.Base.X ) {
+ m_picked_point_id = bpoint.ID;
+ break;
+ }
+ }
+ }
+ this.Invalidate();
+ }
+
+ private void CurveEditor_PreviewKeyDown( object sender, PreviewKeyDownEventArgs e ) {
+ if ( m_selected != "" && m_picked_point_id >= 0 ) {
+ if ( m_picked_side != PickedSide.Base ) {
+ switch ( e.KeyCode ) {
+ case Keys.H:
+ if ( m_list[m_selected][m_picked_point_id].GetControlType( m_picked_side ) != ControlType.Master ) {
+ Command run = Command.GCommandChangeType( m_selected, m_picked_point_id, m_picked_side, ControlType.Master );
+ Register( Execute( run ) );
+ }
+ break;
+ case Keys.V:
+ if ( m_list[m_selected][m_picked_point_id].GetControlType( m_picked_side ) != ControlType.Normal ) {
+ Command run = Command.GCommandChangeType( m_selected, m_picked_point_id, m_picked_side, ControlType.Normal );
+ Register( Execute( run ) );
+ }
+ break;
+ case Keys.Delete:
+ if ( m_list[m_selected][m_picked_point_id].GetControlType( m_picked_side ) != ControlType.None ) {
+ Command run = Command.GCommandChangeType( m_selected, m_picked_point_id, m_picked_side, ControlType.None );
+ Register( Execute( run ) );
+ }
+ break;
+ }
+ this.Invalidate();
+ } else {
+ ControlType target;
+ switch ( e.KeyCode ) {
+ case Keys.H:
+ target = ControlType.Master;
+ break;
+ case Keys.V:
+ target = ControlType.Normal;
+ break;
+ case Keys.Delete:
+ Command run = Command.GCommandDelete( m_selected, m_picked_point_id );
+ Register( Execute( run ) );
+ m_picked_point_id = -1;
+ this.Invalidate();
+ return;
+ default:
+ return;
+ }
+ BezierPoint bpoint = m_list[m_selected][m_picked_point_id];
+ if ( bpoint != null ) {
+ if ( m_list[m_selected][m_picked_point_id].ControlLeftType != target ||
+ m_list[m_selected][m_picked_point_id].ControlRightType != target ) {
+ BezierPoint bp = m_list[m_selected][m_picked_point_id].Clone();
+ bp.ControlLeftType = target;
+ bp.ControlRightType = target;
+ Command run = Command.GCommandEdit( m_selected, m_picked_point_id, bp );
+ Register( Execute( run ) );
+ this.Invalidate();
+ }
+ }
+ }
+ }
+ }
+
+ private Command Execute( Command run ) {
+#if DEBUG
+ Common.DebugWriteLine( "CurveEditor.Execute" );
+ /*Common.DebugWriteLine( " before" );
+ for ( int i = 0; i < m_list[m_selected].List.Count; i++ ) {
+ BezierPoint bp = m_list[m_selected].List[i];
+ Common.DebugWriteLine( " Base.X=" + bp.Base.X + ", ID=" + bp.ID );
+ }*/
+#endif
+ Command ret = null;
+ switch ( run.Type ) {
+ case CommandType.Position:
+ switch ( run.Side ) {
+ case PickedSide.Base:
+ ret = Command.GCommandEditPosition( run.ID, run.PointID, run.Side, m_list[run.ID][run.PointID].Base );
+ break;
+ case PickedSide.Left:
+ ret = Command.GCommandEditPosition( run.ID, run.PointID, run.Side, m_list[run.ID][run.PointID].ControlLeft );
+ break;
+ case PickedSide.Right:
+ ret = Command.GCommandEditPosition( run.ID, run.PointID, run.Side, m_list[run.ID][run.PointID].ControlRight );
+ break;
+ }
+#if DEBUG
+ LipSync.Common.DebugWriteLine( " before;Position=" + m_list[run.ID][run.PointID].GetPosition( PickedSide.Base ) );
+#endif
+ m_list[run.ID][run.PointID].SetPosition( run.Side, run.Position );
+#if DEBUG
+ for ( int i = 0; i < AppManager.SaveData.m_telop_ex2.Count; i++ ) {
+ if ( AppManager.SaveData.m_telop_ex2[i].Text == run.ID ) {
+
+ }
+ }
+#endif
+ break;
+ case CommandType.Type:
+ switch ( run.Side ) {
+ case PickedSide.Left:
+ ret = Command.GCommandChangeType( run.ID, run.PointID, run.Side, m_list[run.ID][run.PointID].ControlLeftType );
+ m_list[run.ID][run.PointID].ControlLeftType = run.ControlType;
+ break;
+ case PickedSide.Right:
+ ret = Command.GCommandChangeType( run.ID, run.PointID, run.Side, m_list[run.ID][run.PointID].ControlRightType );
+ m_list[run.ID][run.PointID].ControlRightType = run.ControlType;
+ break;
+ }
+ break;
+ case CommandType.Add:
+ BezierPoint bp = run.BezierPoint.Clone();
+ bp.ID = m_list[run.ID].GetNextID();
+ ret = Command.GCommandDelete( run.ID, bp.ID );
+ m_list[run.ID].Add( bp );
+ break;
+ case CommandType.Delete:
+ ret = Command.GCommandAdd( run.ID, m_list[run.ID][run.PointID] );
+ m_list[run.ID].RemoveAt( run.PointID );
+ break;
+ case CommandType.Edit:
+ ret = Command.GCommandEdit( run.ID, run.PointID, m_list[run.ID][run.PointID] );
+ m_list[run.ID][run.PointID] = run.BezierPoint.Clone();
+ break;
+ default:
+ return null;
+ }
+ if ( this.CurveEdited != null ) {
+ CurveEdited();
+ }
+#if DEBUG
+ /*Common.DebugWriteLine( " after" );
+ for ( int i = 0; i < m_list[m_selected].List.Count; i++ ) {
+ BezierPoint bp = m_list[m_selected].List[i];
+ Common.DebugWriteLine( " Base.X=" + bp.Base.X + ", ID=" + bp.ID );
+ }*/
+#endif
+ return ret;
+ }
+
+ ///
+ /// 繧「繝ウ繝峨ぇ蜃ヲ逅陦後>縺セ縺
+ ///
+ public void Undo() {
+ if ( IsUndoAvailable ) {
+ Command run = m_commands[m_command_position].Clone();
+ m_commands[m_command_position] = Execute( run );
+ m_command_position--;
+ this.Invalidate();
+ }
+ }
+
+ ///
+ /// 繝ェ繝峨ぇ蜃ヲ逅陦後>縺セ縺
+ ///
+ public void Redo() {
+ if ( IsRedoAvailable ) {
+ Command run = m_commands[m_command_position + 1].Clone();
+ m_commands[m_command_position + 1] = Execute( run );
+ m_command_position++;
+ this.Invalidate();
+ }
+ }
+
+ ///
+ /// 繝ェ繝峨ぇ謫堺ス懊′蜿ッ閭ス縺九←縺縺九r陦ィ縺吝、繧貞叙蠕励@縺セ縺
+ ///
+ public bool IsRedoAvailable {
+ get {
+ if ( m_command_position + 1 < m_commands.Count ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// 繧「繝ウ繝峨ぇ謫堺ス懊′蜿ッ閭ス縺九←縺縺九r陦ィ縺吝、繧貞叙蠕励@縺セ縺
+ ///
+ public bool IsUndoAvailable {
+ get {
+ if ( 0 > m_command_position ) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ ///
+ /// 繧ウ繝槭Φ繝峨ヰ繝繝輔ぃ縺ォ謖螳壹&繧後◆繧ウ繝槭Φ繝峨r逋サ骭イ縺励∪縺
+ ///
+ ///
+ void Register( Command command ) {
+ if ( m_command_position == m_commands.Count - 1 ) {
+ // 譁ー縺励>繧ウ繝槭Φ繝峨ヰ繝繝輔ぃ繧定ソス蜉縺吶k蝣エ蜷
+ m_commands.Add( command.Clone() );
+ m_command_position = m_commands.Count - 1;
+ } else {
+ // 譌「縺ォ縺ゅk繧ウ繝槭Φ繝峨ヰ繝繝輔ぃ繧剃ク頑嶌縺阪☆繧句エ蜷
+ m_commands[m_command_position + 1].Dispose();
+ m_commands[m_command_position + 1] = command.Clone();
+ for ( int i = m_commands.Count - 1; i >= m_command_position + 2; i-- ) {
+ m_commands.RemoveAt( i );
+ }
+ m_command_position++;
+ }
+ }
+
+ private void CurveEditor_KeyDown( object sender, KeyEventArgs e ) {
+ if ( e.KeyCode == Keys.Space ) {
+ m_spacekey_down = true;
+ this.Cursor = HAND;
+ } else {
+ m_spacekey_down = false;
+ this.Cursor = Cursors.Default;
+ }
+ }
+
+ private void CurveEditor_KeyUp( object sender, KeyEventArgs e ) {
+ m_spacekey_down = false;
+ this.Cursor = Cursors.Default;
+ }
+
+ void _num_input_FormClosing( object sender, FormClosingEventArgs e ) {
+ e.Cancel = true;
+ }
+
+ ///
+ /// 繝繝シ繧ソ轤ケ縺ョ謨ー蛟、蜈・蜉帷畑縺ョ繧ウ繝ウ繝繧ュ繧ケ繝医Γ繝九Η繝シ繧貞晄悄蛹悶@縺セ縺
+ ///
+ private void InitializeContextMenu() {
+ if( _cmenu != null ) {
+ _cmenu.Dispose();
+ }
+ if( _cmenuNumericInput != null ) {
+ _cmenuNumericInput.Dispose();
+ }
+ _cmenu = new ContextMenuStrip();
+ _cmenu.ShowCheckMargin = false;
+ _cmenu.ShowImageMargin = false;
+ _cmenuNumericInput = new ToolStripMenuItem();
+ _cmenu.Items.AddRange( new ToolStripItem[] {
+ _cmenuNumericInput} );
+ _cmenu.Name = "cmenu";
+ _cmenu.Size = new System.Drawing.Size( 135, 26 );
+ _cmenu.Font = this.Font;
+ _cmenuNumericInput.Name = "cmenuNumericInput";
+ _cmenuNumericInput.Size = new System.Drawing.Size( 134, 22 );
+ _cmenuNumericInput.Text = _( "Numeric entry" ) + "(&N)";
+ _cmenuNumericInput.Click += new EventHandler( _cmenuNumericInput_Click );
+ }
+
+ void _cmenuNumericInput_Click( object sender, EventArgs e ) {
+ m_before_edit = m_list[m_selected][m_picked_point_id].GetPosition( m_picked_side );
+ using ( LipSync.SetSize dlg = new LipSync.SetSize(
+ _( "Numeric entry" ),
+ "x",
+ "y",
+ m_before_edit.X,
+ m_before_edit.Y ) ) {
+ if ( dlg.ShowDialog() == DialogResult.OK ) {
+ SizeF res = new SizeF( dlg.ResultWidth, dlg.ResultHeight );
+ PointF new_pt = new PointF( res.Width, res.Height );
+ Command run = Command.GCommandEditPosition( m_selected, m_picked_point_id, m_picked_side, new_pt );
+ m_list[m_selected][m_picked_point_id].SetPosition( m_picked_side, m_before_edit );
+ Register( Execute( run ) );
+ this.Invalidate();
+ }
+ }
+ }
+
+ private void CurveEditor_MouseClick( object sender, MouseEventArgs e ) {
+ if ( (e.Button & MouseButtons.Right) == MouseButtons.Right ) {
+ DetectSelectedPoint( e.Location, out m_picked_point_id, out m_picked_side );
+#if DEBUG
+ Common.DebugWriteLine( "CureveEditor_MouseClick" );
+ Common.DebugWriteLine( " m_picked_point_id=" + m_picked_point_id );
+ Common.DebugWriteLine( " m_picked_side=" + m_picked_side );
+#endif
+ if ( m_picked_point_id >= 0 ) {
+ InitializeContextMenu();
+ _cmenu.Show( this, e.Location );
+ _number_visible = false;
+#if DEBUG
+ LipSync.Common.DebugWriteLine( "MouseClick, m_picked_point_id=" + m_picked_point_id );
+#endif
+ }
+ }
+ }
+
+ private void CurveEditor_FontChanged( object sender, EventArgs e ) {
+ if ( _cmenu != null ) {
+ _cmenu.Font = this.Font;
+ }
+ }
+ }
+
+
+ internal class Command /*: ICloneable*/ {
+ string m_id;
+ //int m_picked_index;
+ PickedSide m_picked_side;
+ PointF m_new_position;
+ CommandType m_command_type;
+ ControlType m_control_type;
+ BezierPoint m_bp;
+ //float m_x;
+ int m_pid;
+
+ public override string ToString() {
+ return "{ID=" + ID + ", PointID=" + PointID + ", Side=" + Side + ", CommandType=" + Type + ", Position=" + Position + "}";
+ }
+
+ public Command Clone() {
+ Command result = new Command();
+ result.m_id = this.m_id;
+ //result.m_picked_index = this.m_picked_index;
+ result.m_new_position = this.m_new_position;
+ result.m_command_type = this.m_command_type;
+ result.m_control_type = this.m_control_type;
+ if ( this.m_bp != null ) {
+ result.m_bp = this.m_bp.Clone();
+ }
+ result.m_pid = this.m_pid;
+ result.m_picked_side = this.m_picked_side;
+ return result;
+ }
+
+ public void Dispose(){
+ m_bp = null;
+ }
+
+ public static Command GCommandEditPosition( string ID, int picked_id, PickedSide picked_side, PointF new_position ) {
+ Command ret = new Command();
+ ret.m_id = ID;
+ ret.m_pid = picked_id;
+ ret.m_picked_side = picked_side;
+ ret.m_new_position = new_position;
+ ret.m_command_type = CommandType.Position;
+ ret.m_control_type = ControlType.None;
+ return ret;
+ }
+
+ public static Command GCommandChangeType( string ID, int picked_id, PickedSide picked_side, ControlType control_type ){
+ Command ret = new Command();
+ ret.m_id = ID;
+ ret.m_pid = picked_id;
+ ret.m_picked_side = picked_side;
+ ret.m_command_type = CommandType.Type;
+ ret.m_control_type = control_type;
+ return ret;
+ }
+
+ public static Command GCommandAdd( string ID, BezierPoint point ) {
+ Command ret = new Command();
+ ret.m_id = ID;
+ if ( point != null ) {
+ ret.m_bp = (BezierPoint)point.Clone();
+ }
+ ret.m_command_type = CommandType.Add;
+ return ret;
+ }
+
+ public static Command GCommandDelete( string ID, /*float*/int pid ) {
+ Command ret = new Command();
+ ret.m_id = ID;
+ //this.m_x = x;
+ ret.m_pid = pid;
+ ret.m_command_type = CommandType.Delete;
+ return ret;
+ }
+
+ public static Command GCommandNothing() {
+ return new Command();
+ }
+
+ private Command() {
+ this.m_command_type = CommandType.None;
+ }
+
+ public static Command GCommandEdit( string ID, int picked_id, BezierPoint point ) {
+ Command ret = new Command();
+ ret.m_id = ID;
+ ret.m_pid = picked_id;
+ if ( point != null ) {
+ ret.m_bp = (BezierPoint)point.Clone();
+ }
+ ret.m_command_type = CommandType.Edit;
+ return ret;
+ }
+
+ public int PointID {
+ get {
+ return m_pid;
+ }
+ }
+
+ /*public float X {
+ get {
+ return m_x;
+ }
+ }*/
+
+ public BezierPoint BezierPoint {
+ get {
+ return m_bp;
+ }
+ }
+
+ public CommandType Type{
+ get{
+ return m_command_type;
+ }
+ }
+
+ public ControlType ControlType {
+ get {
+ return m_control_type;
+ }
+ }
+
+ public string ID{
+ get{
+ return m_id;
+ }
+ }
+
+ public PickedSide Side{
+ get{
+ return m_picked_side;
+ }
+ }
+
+ public PointF Position{
+ get{
+ return m_new_position;
+ }
+ }
+ }
+
+ internal enum CommandType {
+ Position,//蜊倥↓菴咲スョ繧貞、画峩縺吶k
+ Type,//蛻カ蠕。轤ケ縺ョ繧ソ繧、繝励r螟画峩縺吶k
+ Add,
+ Delete,
+ None,
+ Edit,
+ }
+
+
+ public enum PickedSide {
+ Right,
+ Base,
+ Left,
+ }
+
+
+ public enum PointType {
+ Circle,
+ Rectangle,
+ }
+
+ public enum XLabel {
+ None,
+ Top,
+ Bottom,
+ }
+
+ public enum YLabel {
+ None,
+ Left,
+ Right,
+ }
+
+ [Serializable]
+ public class BezierChain : IDisposable, ICloneable {
+ private List list;
+ private float m_default = 0f;
+ private Color m_color;
+
+ public bool GetKeyMinMax( out float min, out float max ) {
+ if ( list.Count == 0 ) {
+ min = 0f;
+ max = 0f;
+ return false;
+ }
+ min = float.MaxValue;
+ max = float.MinValue;
+ for ( int i = 0; i < list.Count; i++ ) {
+ min = Math.Min( min, list[i].Base.X );
+ max = Math.Max( max, list[i].Base.X );
+ }
+ return true;
+ }
+
+ public int GetIndexFromId( int id ) {
+ for ( int i = 0; i < list.Count; i++ ) {
+ if ( list[i].ID == id ) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int GetIdFromIndex( int index ) {
+ if ( 0 <= index && index < list.Count ) {
+ return list[index].ID;
+ }
+ return -1;
+ }
+
+ public List List {
+ get {
+ return list;
+ }
+ set {
+ list = value;
+ }
+ }
+
+ [OnDeserialized]
+ void onDeserialized( StreamingContext sc ) {
+ for ( int i = 0; i < list.Count; i++ ) {
+ list[i].ID = i;
+ list[i].Order = i;
+ }
+ }
+
+ public void Sort() {
+ //list.Sort( new BezierChainOrderIgnoaringComparator() );
+ list.Sort();
+ for ( int i = 0; i < list.Count; i++ ) {
+ list[i].Order = i;
+ }
+ }
+
+ public void Dispose() {
+ if ( list != null ) {
+ list.Clear();
+ }
+ }
+
+ public int GetNextID() {
+ int max = -1;
+ for ( int i = 0; i < list.Count; i++ ) {
+ max = Math.Max( max, list[i].ID );
+ }
+ return max + 1;
+ }
+
+ public void GetValueMinMax( out float min, out float max ){
+ //todo: 繝吶ず繧ィ縺梧怏蜉ケ縺ェ縺ィ縺阪↓縲∵峇邱壹ョ謠上¥譛螟ァ蛟、縲∵怙蟆丞、繧り諷ョ
+ min = Default;
+ max = Default;
+ foreach ( BezierPoint bp in list ) {
+ min = Math.Min( min, bp.Base.Y );
+ max = Math.Max( max, bp.Base.Y );
+ }
+ }
+
+ public object Clone() {
+ BezierChain result = new BezierChain( this.m_color );
+ foreach ( BezierPoint bp in list ) {
+ result.list.Add( bp.Clone() );
+ }
+ result.m_default = this.m_default;
+ return result;
+ }
+
+ public float Default {
+ get {
+ return m_default;
+ }
+ set {
+ m_default = value;
+ }
+ }
+
+ public BezierChain( Color curve ) {
+ list = new List();
+ m_color = curve;
+ }
+
+ public BezierPoint this[int id] {
+ get {
+ for ( int i = 0; i < list.Count; i++ ) {
+ if ( list[i].ID == id ) {
+ return list[i];
+ }
+ }
+ return null;
+ }
+ set {
+ for ( int i = 0; i < list.Count; i++ ) {
+ if ( list[i].ID == id ) {
+ list[i] = value;
+ return;
+ }
+ }
+ throw new Exception( "invalid point id" );
+ }
+ }
+
+ public Color Color {
+ get {
+ return m_color;
+ }
+ set {
+ m_color = value;
+ }
+ }
+
+ public void Add( BezierPoint bp ) {
+ if ( list == null ) {
+ list = new List();
+ m_color = Color.Black;
+ }
+#if DEBUG
+ Common.DebugWriteLine( "BezierChain.Add" );
+ Common.DebugWriteLine( " before" );
+ for ( int i = 0; i < list.Count; i++ ) {
+ Common.DebugWriteLine( " Base.X=" + list[i].Base.X + ", Order=" + list[i].Order );
+ }
+#endif
+ bool found = false;
+ for ( int i = 0; i < list.Count - 1; i++ ) {
+ if ( list[i].Base.X <= bp.Base.X && bp.Base.X < list[i + 1].Base.X ) {
+ bp.Order = list[i].Order + 1;
+ for ( int j = i + 1; j < list.Count; j++ ) {
+ list[j].Order = list[j].Order + 1;
+ }
+ found = true;
+ break;
+ }
+ }
+ if ( !found ) {
+ if ( list.Count == 0 ){
+ bp.Order = 0;
+ }else{
+ bp.Order = list[list.Count - 1].Order + 1;
+ }
+ }
+ list.Add( bp );
+ Sort();
+#if DEBUG
+ Common.DebugWriteLine( "BezierChain.Add" );
+ Common.DebugWriteLine( " after" );
+ for ( int i = 0; i < list.Count; i++ ) {
+ Common.DebugWriteLine( " Base.X=" + list[i].Base.X + ", Order=" + list[i].Order );
+ }
+#endif
+ }
+
+ public void RemoveAt( int id ) {
+ for ( int i = 0; i < list.Count; i++ ) {
+ if ( list[i].ID == id ) {
+ list.RemoveAt( i );
+ Sort();
+ return;
+ }
+ }
+ }
+
+ /*public void RemoveAt( float x ) {
+ for ( int i = 0; i < list.Count; i++ ) {
+ if ( list[i].Base.X == x ) {
+ list.RemoveAt( i );
+ break;
+ }
+ }
+ }*/
+
+ public int Count {
+ get {
+ if ( list == null ) {
+ return 0;
+ }
+ return list.Count;
+ }
+ }
+
+ public float GetValue( float x ) {
+ for ( int i = 0; i < list.Count - 1; i++ ) {
+ if ( list[i].Base.X <= x && x <= list[i + 1].Base.X ) {
+ if ( list[i].ControlRightType == ControlType.None && list[i + 1].ControlLeftType == ControlType.None ) {
+ PointF p1 = list[i].Base;
+ PointF p2 = list[i + 1].Base;
+ float slope = (p2.Y - p1.Y) / (p2.X - p1.X);
+ return p1.Y + slope * (x - p1.X);
+ } else {
+ float x1 = list[i].Base.X;
+ float x2 = list[i].ControlRight.X;
+ float x3 = list[i + 1].ControlLeft.X;
+ float x4 = list[i + 1].Base.X;
+ float a3 = x4 - 3 * x3 + 3 * x2 - x1;
+ float a2 = 3 * x3 - 6 * x2 + 3 * x1;
+ float a1 = 3 * (x2 - x1);
+ float a0 = x1;
+ if ( x1 == x ) {
+ return list[i].Base.Y;
+ } else if ( x4 == x ) {
+ return list[i + 1].Base.Y;
+ } else {
+ float t = SolveCubicEquation( a3, a2, a1, a0, x );
+ x1 = list[i].Base.Y;
+ x2 = list[i].ControlRight.Y;
+ x3 = list[i + 1].ControlLeft.Y;
+ x4 = list[i + 1].Base.Y;
+ a3 = x4 - 3 * x3 + 3 * x2 - x1;
+ a2 = 3 * x3 - 6 * x2 + 3 * x1;
+ a1 = 3 * (x2 - x1);
+ a0 = x1;
+ return ((a3 * t + a2) * t + a1) * t + a0;
+ }
+ }
+ }
+ }
+ return m_default;
+ }
+
+ ///
+ /// 3谺。譁ケ遞句シ渋3*x^3 + a2*x^2 + a1*x + a0 = ans縺ョ隗」繧偵ル繝・繝シ繝医Φ豕輔r菴ソ縺」縺ヲ險育ョ励@縺セ縺吶ゅ◆縺縺励∝腰隱ソ蠅怜刈縺ァ縺ゅk蠢隕√′縺ゅk縲
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private static float SolveCubicEquation( float a3, float a2, float a1, float a0, float ans ) {
+ double EPSILON = 1e-9;
+ double suggested_t = 0.4;
+ double a3_3 = a3 * 3.0;
+ double a2_2 = a2 * 2.0;
+ while ( (a3_3 * suggested_t + a2_2) * suggested_t + a1 == 0.0 ) {
+ suggested_t += 0.1;
+ }
+ double x = suggested_t;
+ double new_x = suggested_t;
+ for( int i = 0; i < 5000; i++ ){
+ new_x = x - (((a3 * x + a2) * x + a1) * x + a0 - ans) / ((a3_3 * x + a2_2) * x + a1);
+ if ( Math.Abs( new_x - x ) < EPSILON * new_x ) {
+ break;
+ }
+ x = new_x;
+ }
+ return (float)new_x;
+ }
+ }
+
+ public enum ControlType {
+ None,
+ Normal,
+ Master,
+ }
+
+ ///
+ /// 繝吶ず繧ィ譖イ邱壹r讒区舌☆繧九ョ繝シ繧ソ轤ケ縲
+ ///
+ [Serializable]
+ public class BezierPoint : IComparable {
+ PointF m_base;
+ internal PointF m_control_left;
+ internal PointF m_control_right;
+ ControlType m_type_left;
+ ControlType m_type_right;
+ [NonSerialized]
+ int m_id;
+ [OptionalField]
+ public int Order;
+
+ public int ID {
+ get {
+ return m_id;
+ }
+ internal set {
+ m_id = value;
+ }
+ }
+
+ public override string ToString() {
+ return "m_base=" + m_base.X + "," + m_base.Y + "\n" +
+ "m_control_left=" + m_control_left.X + "," + m_control_left.Y + "\n" +
+ "m_control_right=" + m_control_right.X + "," + m_control_right.Y + "\n" +
+ "m_type_left=" + m_type_left + "\n" +
+ "m_type_right=" + m_type_right + "\n";
+ }
+
+ public BezierPoint( PointF p1, PointF left, PointF right ) {
+ m_base = p1;
+ m_control_left = new PointF( left.X - m_base.X, left.Y - m_base.Y );
+ m_control_right = new PointF( right.X - m_base.X, right.Y - m_base.Y );
+ m_type_left = ControlType.None;
+ m_type_right = ControlType.None;
+ }
+
+ public BezierPoint Clone() {
+ BezierPoint result = new BezierPoint( this.Base, this.ControlLeft, this.ControlRight );
+ result.m_control_left = this.m_control_left;
+ result.m_control_right = this.m_control_right;
+ result.m_type_left = this.m_type_left;
+ result.m_type_right = this.m_type_right;
+ result.Order = this.Order;
+ result.m_id = this.m_id;
+ return result;
+ }
+
+ public int CompareTo( BezierPoint item ) {
+ if ( this.Base.X > item.Base.X ) {
+ return 1;
+ } else if ( this.Base.X < item.Base.X ) {
+ return -1;
+ } else {
+ return this.Order - item.Order;
+ /*if ( this.ID > item.ID ) {
+ return 1;
+ } else if ( this.ID < item.ID ) {
+ return -1;
+ } else {
+ return 0;
+ }*/
+ }
+ }
+
+ public PointF Base {
+ get {
+ return m_base;
+ }
+ set {
+ m_base = value;
+ }
+ }
+
+ public void SetPosition( PickedSide picked_side, PointF new_position ) {
+ if ( picked_side == PickedSide.Base ) {
+ this.Base = new_position;
+ } else if ( picked_side == PickedSide.Left ) {
+ this.m_control_left = new PointF( new_position.X - this.Base.X, new_position.Y - this.Base.Y);
+ } else {
+ this.m_control_right = new PointF( new_position.X - this.Base.X, new_position.Y - this.Base.Y );
+ }
+ }
+
+ public PointF GetPosition( PickedSide picked_side ) {
+ if ( picked_side == PickedSide.Base ) {
+ return this.Base;
+ } else if ( picked_side == PickedSide.Left ) {
+ return this.ControlLeft;
+ } else {
+ return this.ControlRight;
+ }
+ }
+
+ public ControlType GetControlType( PickedSide picked_side ) {
+ if ( picked_side == PickedSide.Left ) {
+ return this.ControlLeftType;
+ } else if ( picked_side == PickedSide.Right ) {
+ return this.ControlRightType;
+ } else {
+ return ControlType.None;
+ }
+ }
+
+ public PointF ControlLeft {
+ get {
+ if ( m_type_left != ControlType.None ) {
+ return new PointF( m_base.X + m_control_left.X, m_base.Y + m_control_left.Y );
+ } else {
+ return m_base;
+ }
+ }
+ set {
+ m_control_left = new PointF( value.X - m_base.X, value.Y - m_base.Y );
+ }
+ }
+
+ public PointF ControlRight {
+ get {
+ if ( m_type_right != ControlType.None ) {
+ return new PointF( m_base.X + m_control_right.X, m_base.Y + m_control_right.Y );
+ } else {
+ return m_base;
+ }
+ }
+ set {
+ m_control_right = new PointF( value.X - m_base.X, value.Y - m_base.Y );
+ }
+ }
+
+ public ControlType ControlLeftType {
+ get {
+ return m_type_left;
+ }
+ set {
+ m_type_left = value;
+ }
+ }
+
+ public ControlType ControlRightType {
+ get {
+ return m_type_right;
+ }
+ set {
+ m_type_right = value;
+ }
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Common/CurveEditor.designer.cs b/trunk/LipSync/Common/CurveEditor.designer.cs
new file mode 100644
index 0000000..322262a
--- /dev/null
+++ b/trunk/LipSync/Common/CurveEditor.designer.cs
@@ -0,0 +1,68 @@
+サソ/*
+ * CurveEditor.designer.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace CurveEditor {
+ partial class CurveEditor {
+ ///
+ /// 蠢隕√↑繝繧カ繧、繝雁、画焚縺ァ縺吶
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 菴ソ逕ィ荳ュ縺ョ繝ェ繧ス繝シ繧ケ繧偵☆縺ケ縺ヲ繧ッ繝ェ繝シ繝ウ繧「繝繝励@縺セ縺吶
+ ///
+ /// 繝槭ロ繝シ繧ク 繝ェ繧ス繝シ繧ケ縺檎エ譽縺輔l繧句エ蜷 true縲∫エ譽縺輔l縺ェ縺蝣エ蜷医ッ false 縺ァ縺吶
+ protected override void Dispose( bool disposing ) {
+ if ( disposing && (components != null) ) {
+ components.Dispose();
+ }
+ base.Dispose( disposing );
+ }
+
+ #region 繧ウ繝ウ繝昴シ繝阪Φ繝 繝繧カ繧、繝翫〒逕滓舌&繧後◆繧ウ繝シ繝
+
+ ///
+ /// 繝繧カ繧、繝 繧オ繝昴シ繝医↓蠢隕√↑繝。繧ス繝繝峨〒縺吶ゅ%縺ョ繝。繧ス繝繝峨ョ蜀螳ケ繧
+ /// 繧ウ繝シ繝 繧ィ繝繧」繧ソ縺ァ螟画峩縺励↑縺縺ァ縺上□縺輔>縲
+ ///
+ private void InitializeComponent() {
+ this.SuspendLayout();
+ //
+ // CurveEditor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.SystemColors.Control;
+ this.Name = "CurveEditor";
+ this.Size = new System.Drawing.Size( 333, 120 );
+ this.Paint += new System.Windows.Forms.PaintEventHandler( this.CurveEditor_Paint );
+ this.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler( this.CurveEditor_PreviewKeyDown );
+ this.MouseMove += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseMove );
+ this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseDoubleClick );
+ this.FontChanged += new System.EventHandler( this.CurveEditor_FontChanged );
+ this.KeyUp += new System.Windows.Forms.KeyEventHandler( this.CurveEditor_KeyUp );
+ this.MouseClick += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseClick );
+ this.MouseDown += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseDown );
+ this.Resize += new System.EventHandler( this.CurveEditor_Resize );
+ this.MouseUp += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseUp );
+ this.KeyDown += new System.Windows.Forms.KeyEventHandler( this.CurveEditor_KeyDown );
+ this.ResumeLayout( false );
+
+ }
+
+ #endregion
+
+
+
+ }
+}
diff --git a/trunk/LipSync/Common/NativeMethods.cs b/trunk/LipSync/Common/NativeMethods.cs
new file mode 100644
index 0000000..85267d8
--- /dev/null
+++ b/trunk/LipSync/Common/NativeMethods.cs
@@ -0,0 +1,290 @@
+サソ/*================================================================================
+ File: NativeMethods.cs
+
+ Summary: This is part of a sample showing how to place Windows Forms controls
+ inside one of the common file dialogs.
+----------------------------------------------------------------------------------
+Copyright (C) Microsoft Corporation. All rights reserved.
+
+This source code is intended only as a supplement to Microsoft Development Tools
+and/or on-line documentation. See these other materials for detailed information
+regarding Microsoft code samples.
+
+This sample is not intended for production use. Code and policy for a production
+application must be developed to meet the specific data and security requirements
+of the application.
+
+THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
+================================================================================*/
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace ExtensibleDialogs
+{
+ ///
+ /// Defines the shape of hook procedures that can be called by the OpenFileDialog
+ ///
+ internal delegate IntPtr OfnHookProc( IntPtr hWnd, UInt16 msg, Int32 wParam, Int32 lParam );
+
+ ///
+ /// Values that can be placed in the OPENFILENAME structure, we don't use all of them
+ ///
+ internal class OpenFileNameFlags
+ {
+ public const Int32 ReadOnly = 0x00000001;
+ public const Int32 OverWritePrompt = 0x00000002;
+ public const Int32 HideReadOnly = 0x00000004;
+ public const Int32 NoChangeDir = 0x00000008;
+ public const Int32 ShowHelp = 0x00000010;
+ public const Int32 EnableHook = 0x00000020;
+ public const Int32 EnableTemplate = 0x00000040;
+ public const Int32 EnableTemplateHandle = 0x00000080;
+ public const Int32 NoValidate = 0x00000100;
+ public const Int32 AllowMultiSelect = 0x00000200;
+ public const Int32 ExtensionDifferent = 0x00000400;
+ public const Int32 PathMustExist = 0x00000800;
+ public const Int32 FileMustExist = 0x00001000;
+ public const Int32 CreatePrompt = 0x00002000;
+ public const Int32 ShareAware = 0x00004000;
+ public const Int32 NoReadOnlyReturn = 0x00008000;
+ public const Int32 NoTestFileCreate = 0x00010000;
+ public const Int32 NoNetworkButton = 0x00020000;
+ public const Int32 NoLongNames = 0x00040000;
+ public const Int32 Explorer = 0x00080000;
+ public const Int32 NoDereferenceLinks = 0x00100000;
+ public const Int32 LongNames = 0x00200000;
+ public const Int32 EnableIncludeNotify = 0x00400000;
+ public const Int32 EnableSizing = 0x00800000;
+ public const Int32 DontAddToRecent = 0x02000000;
+ public const Int32 ForceShowHidden = 0x10000000;
+ };
+
+ ///
+ /// Values that can be placed in the FlagsEx field of the OPENFILENAME structure
+ ///
+ internal class OpenFileNameFlagsEx
+ {
+ public const Int32 NoPlacesBar = 0x00000001;
+ };
+
+ ///
+ /// A small subset of the window messages that can be sent to the OpenFileDialog
+ /// These are just the ones that this implementation is interested in
+ ///
+ internal class WindowMessage
+ {
+ public const UInt16 InitDialog = 0x0110;
+ public const UInt16 Size = 0x0005;
+ public const UInt16 Notify = 0x004E;
+ };
+
+ ///
+ /// The possible notification messages that can be generated by the OpenFileDialog
+ /// We only look for CDN_SELCHANGE
+ ///
+ internal class CommonDlgNotification
+ {
+ private const UInt16 First = unchecked((UInt16)((UInt16)0 - (UInt16)601));
+
+ public const UInt16 InitDone = (First - 0x0000);
+ public const UInt16 SelChange = (First - 0x0001);
+ public const UInt16 FolderChange = (First - 0x0002);
+ public const UInt16 ShareViolation = (First - 0x0003);
+ public const UInt16 Help = (First - 0x0004);
+ public const UInt16 FileOk = (First - 0x0005);
+ public const UInt16 TypeChange = (First - 0x0006);
+ public const UInt16 IncludeItem = (First - 0x0007);
+ }
+
+ ///
+ /// Messages that can be send to the common dialogs
+ /// We only use CDM_GETFILEPATH
+ ///
+ internal class CommonDlgMessage {
+ private const UInt16 User = 0x0400;
+ private const UInt16 First = User + 100;
+ private const UInt16 Last = User + 200;
+ public const UInt16 GetSpec = First;
+ public const UInt16 GetFilePath = First + 0x0001;
+ public const UInt16 GetFolderPath = First + 0x0002;
+ public const UInt16 GetFolderIDList = First + 0x0003;
+ public const UInt16 SetControlText = First + 0x0004;
+ public const UInt16 HideControl = First + 0x0005;
+ public const UInt16 SetDefExt = First + 0x0006;
+ };
+
+ ///
+ /// See the documentation for OPENFILENAME
+ ///
+ internal struct OpenFileName
+ {
+ public Int32 lStructSize;
+ public IntPtr hwndOwner;
+ public IntPtr hInstance;
+ public IntPtr lpstrFilter;
+ public IntPtr lpstrCustomFilter;
+ public Int32 nMaxCustFilter;
+ public Int32 nFilterIndex;
+ public IntPtr lpstrFile;
+ public Int32 nMaxFile;
+ public IntPtr lpstrFileTitle;
+ public Int32 nMaxFileTitle;
+ public IntPtr lpstrInitialDir;
+ public IntPtr lpstrTitle;
+ public Int32 Flags;
+ public Int16 nFileOffset;
+ public Int16 nFileExtension;
+ public IntPtr lpstrDefExt;
+ public Int32 lCustData;
+ public OfnHookProc lpfnHook;
+ public IntPtr lpTemplateName;
+ public IntPtr pvReserved;
+ public Int32 dwReserved;
+ public Int32 FlagsEx;
+ };
+
+ ///
+ /// Part of the notification messages sent by the common dialogs
+ ///
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct NMHDR
+ {
+ [FieldOffset(0)] public IntPtr hWndFrom;
+ [FieldOffset(4)] public UInt16 idFrom;
+ [FieldOffset(8)] public UInt16 code;
+ };
+
+ ///
+ /// Part of the notification messages sent by the common dialogs
+ ///
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct OfNotify
+ {
+ [FieldOffset(0)] public NMHDR hdr;
+ [FieldOffset(12)] public IntPtr ipOfn;
+ [FieldOffset(16)] public IntPtr ipFile;
+ };
+
+ ///
+ /// Win32 window style constants
+ /// We use them to set up our child window
+ ///
+ internal class DlgStyle
+ {
+ public const Int32 DsSetFont = 0x00000040;
+ public const Int32 Ds3dLook = 0x00000004;
+ public const Int32 DsControl = 0x00000400;
+ public const Int32 WsChild = 0x40000000;
+ public const Int32 WsClipSiblings = 0x04000000;
+ public const Int32 WsVisible = 0x10000000;
+ public const Int32 WsGroup = 0x00020000;
+ public const Int32 SsNotify = 0x00000100;
+ };
+
+ ///
+ /// Win32 "extended" window style constants
+ ///
+ internal class ExStyle
+ {
+ public const Int32 WsExNoParentNotify = 0x00000004;
+ public const Int32 WsExControlParent = 0x00010000;
+ };
+
+ ///
+ /// An in-memory Win32 dialog template
+ /// Note: this has a very specific structure with a single static "label" control
+ /// See documentation for DLGTEMPLATE and DLGITEMTEMPLATE
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ internal class DlgTemplate
+ {
+ // The dialog template - see documentation for DLGTEMPLATE
+ public Int32 style = DlgStyle.Ds3dLook | DlgStyle.DsControl | DlgStyle.WsChild | DlgStyle.WsClipSiblings | DlgStyle.SsNotify;
+ public Int32 extendedStyle = ExStyle.WsExControlParent;
+ public Int16 numItems = 1;
+ public Int16 x = 0;
+ public Int16 y = 0;
+ public Int16 cx = 0;
+ public Int16 cy = 0;
+ public Int16 reservedMenu = 0;
+ public Int16 reservedClass = 0;
+ public Int16 reservedTitle = 0;
+
+ // Single dlg item, must be dword-aligned - see documentation for DLGITEMTEMPLATE
+ public Int32 itemStyle = DlgStyle.WsChild;
+ public Int32 itemExtendedStyle = ExStyle.WsExNoParentNotify;
+ public Int16 itemX = 0;
+ public Int16 itemY = 0;
+ public Int16 itemCx = 0;
+ public Int16 itemCy = 0;
+ public Int16 itemId = 0;
+ public UInt16 itemClassHdr = 0xffff; // we supply a constant to indicate the class of this control
+ public Int16 itemClass = 0x0082; // static label control
+ public Int16 itemText = 0x0000; // no text for this control
+ public Int16 itemData = 0x0000; // no creation data for this control
+ };
+
+ ///
+ /// The rectangle structure used in Win32 API calls
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct RECT
+ {
+ public int left;
+ public int top;
+ public int right;
+ public int bottom;
+ };
+
+ ///
+ /// The point structure used in Win32 API calls
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct POINT
+ {
+ public int X;
+ public int Y;
+ };
+
+ ///
+ /// Contains all of the p/invoke declarations for the Win32 APIs used in this sample
+ ///
+ public class NativeMethods
+ {
+
+ [DllImport("User32.dll", CharSet = CharSet.Unicode)]
+ internal static extern IntPtr GetDlgItem( IntPtr hWndDlg, Int16 Id );
+
+ [DllImport("User32.dll", CharSet = CharSet.Unicode)]
+ internal static extern IntPtr GetParent( IntPtr hWnd );
+
+ [DllImport("User32.dll", CharSet = CharSet.Unicode)]
+ internal static extern IntPtr SetParent( IntPtr hWndChild, IntPtr hWndNewParent );
+
+ [DllImport("User32.dll", CharSet = CharSet.Unicode)]
+ internal static extern UInt32 SendMessage( IntPtr hWnd, UInt32 msg, UInt32 wParam, StringBuilder buffer );
+
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)]
+ internal static extern int GetWindowRect( IntPtr hWnd, ref RECT rc );
+
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)]
+ internal static extern int GetClientRect( IntPtr hWnd, ref RECT rc );
+
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)]
+ internal static extern bool ScreenToClient( IntPtr hWnd, ref POINT pt );
+
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)]
+ internal static extern bool MoveWindow( IntPtr hWnd, int X, int Y, int Width, int Height, bool repaint );
+
+ [DllImport("ComDlg32.dll", CharSet = CharSet.Unicode)]
+ internal static extern bool GetOpenFileName( ref OpenFileName ofn );
+
+ [DllImport("ComDlg32.dll", CharSet = CharSet.Unicode)]
+ internal static extern Int32 CommDlgExtendedError();
+
+ }
+}
diff --git a/trunk/LipSync/Common/NumericUpDownEx.Designer.cs b/trunk/LipSync/Common/NumericUpDownEx.Designer.cs
new file mode 100644
index 0000000..158b79a
--- /dev/null
+++ b/trunk/LipSync/Common/NumericUpDownEx.Designer.cs
@@ -0,0 +1,45 @@
+サソ/*
+ * NumericUpDownEx.Designer.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+ partial class NumericUpDownEx {
+ ///
+ /// 蠢隕√↑繝繧カ繧、繝雁、画焚縺ァ縺吶
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 菴ソ逕ィ荳ュ縺ョ繝ェ繧ス繝シ繧ケ繧偵☆縺ケ縺ヲ繧ッ繝ェ繝シ繝ウ繧「繝繝励@縺セ縺吶
+ ///
+ /// 繝槭ロ繝シ繧ク 繝ェ繧ス繝シ繧ケ縺檎エ譽縺輔l繧句エ蜷 true縲∫エ譽縺輔l縺ェ縺蝣エ蜷医ッ false 縺ァ縺吶
+ protected override void Dispose( bool disposing ) {
+ if ( disposing && (components != null) ) {
+ components.Dispose();
+ }
+ base.Dispose( disposing );
+ }
+
+ #region 繧ウ繝ウ繝昴シ繝阪Φ繝 繝繧カ繧、繝翫〒逕滓舌&繧後◆繧ウ繝シ繝
+
+ ///
+ /// 繝繧カ繧、繝 繧オ繝昴シ繝医↓蠢隕√↑繝。繧ス繝繝峨〒縺吶ゅ%縺ョ繝。繧ス繝繝峨ョ蜀螳ケ繧
+ /// 繧ウ繝シ繝 繧ィ繝繧」繧ソ縺ァ螟画峩縺励↑縺縺ァ縺上□縺輔>縲
+ ///
+ private void InitializeComponent() {
+ components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ }
+
+ #endregion
+ }
+}
diff --git a/trunk/LipSync/Common/NumericUpDownEx.cs b/trunk/LipSync/Common/NumericUpDownEx.cs
new file mode 100644
index 0000000..95a6718
--- /dev/null
+++ b/trunk/LipSync/Common/NumericUpDownEx.cs
@@ -0,0 +1,44 @@
+サソ/*
+ * NumericUpDownEx.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+//using System.Data;
+using System.Text;
+using System.Windows.Forms;
+
+namespace LipSync {
+ ///
+ /// MouseWheel縺ァIncrement縺壹▽蛟、繧貞「玲ク帙&縺帙k縺薙→縺ョ縺ァ縺阪kNumericUpDown
+ ///
+ public partial class NumericUpDownEx : NumericUpDown {
+ public NumericUpDownEx() {
+ InitializeComponent();
+ }
+ protected override void OnMouseWheel( MouseEventArgs e ) {
+ decimal new_val;
+ if ( e.Delta > 0 ) {
+ new_val = this.Value + this.Increment;
+ } else if ( e.Delta < 0 ) {
+ new_val = this.Value - this.Increment;
+ } else {
+ return;
+ }
+ if ( this.Minimum <= new_val && new_val <= this.Maximum ) {
+ this.Value = new_val;
+ }
+ }
+ }
+}
diff --git a/trunk/LipSync/Common/OpenFileDialog.cs b/trunk/LipSync/Common/OpenFileDialog.cs
new file mode 100644
index 0000000..4c180fc
--- /dev/null
+++ b/trunk/LipSync/Common/OpenFileDialog.cs
@@ -0,0 +1,506 @@
+/*================================================================================
+ File: OpenFileDialog.cs
+
+ Summary: This is part of a sample showing how to place Windows Forms controls
+ inside one of the common file dialogs.
+----------------------------------------------------------------------------------
+Copyright (C) Microsoft Corporation. All rights reserved.
+
+This source code is intended only as a supplement to Microsoft Development Tools
+and/or on-line documentation. See these other materials for detailed information
+regarding Microsoft code samples.
+
+This sample is not intended for production use. Code and policy for a production
+application must be developed to meet the specific data and security requirements
+of the application.
+
+THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
+================================================================================*/
+
+using System;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Drawing;
+using System.IO;
+
+namespace ExtensibleDialogs {
+ ///
+ /// The extensible OpenFileDialog
+ ///
+ public class OpenFileDialog : IDisposable {
+ // The maximum number of characters permitted in a path
+ private const int _MAX_PATH = 260;
+
+ // The "control ID" of the content window inside the OpenFileDialog
+ // See the accompanying article to learn how I discovered it
+ private const int _CONTENT_PANEL_ID = 0x0461;
+
+ // A constant that determines the spacing between panels inside the OpenFileDialog
+ private const int _PANEL_GAP_FACTOR = 3;
+
+ ///
+ /// Clients can implement handlers of this type to catch "selection changed" events
+ ///
+ public delegate void SelectionChangedHandler( string path );
+
+ ///
+ /// This event is fired whenever the user selects an item in the dialog
+ ///
+ public event SelectionChangedHandler SelectionChanged;
+
+ public delegate void FolderChangedHandler( string path );
+ public event FolderChangedHandler FolderChanged;
+
+ // unmanaged memory buffers to hold the file name (with and without full path)
+ private IntPtr _fileNameBuffer;
+ private IntPtr _fileTitleBuffer;
+ private IntPtr _initialDirBuffer;
+
+ // user-supplied control that gets placed inside the OpenFileDialog
+ private System.Windows.Forms.Control _userControl;
+
+ // unmanaged memory buffer that holds the Win32 dialog template
+ private IntPtr _ipTemplate;
+
+ private string _filter;
+ private string _fileName;
+ private string _defaultExtension;
+ private int _filterIndex;
+ private short _fileOffset;
+ private short _fileExtension;
+ private string _initialDir;
+
+ public string InitialDirectory {
+ get {
+ return _initialDir;
+ }
+ set {
+ _initialDir = value;
+ if ( !Path.IsPathRooted( _initialDir ) ) {
+ if ( !Directory.Exists( _initialDir ) ) {
+ _initialDir = Path.GetDirectoryName( _initialDir );
+ }
+ }
+ _fileName = "";
+ UnicodeEncoding ue = new UnicodeEncoding();
+ byte[] zero = new byte[2 * _MAX_PATH];
+ for ( int i = 0; i < 2 * _MAX_PATH; i++ ) {
+ zero[i] = 0;
+ }
+ Marshal.Copy( zero, 0, _initialDirBuffer, 2 * _MAX_PATH );
+ Marshal.Copy( zero, 0, _fileNameBuffer, 2 * _MAX_PATH );
+ if ( _initialDir.Length > 0 ) {
+ byte[] initial_dir_buffer = ue.GetBytes( _initialDir );
+ Marshal.Copy( initial_dir_buffer, 0, _initialDirBuffer, initial_dir_buffer.Length );
+ }
+ }
+ }
+
+
+ public int FilterIndex {
+ get {
+ return _filterIndex;
+ }
+ set {
+ _filterIndex = value;
+ }
+ }
+
+
+ public OpenFileDialog( System.Windows.Forms.Control userControl )
+ : this( "", "", "", userControl ) {
+ }
+
+
+ ///
+ /// Sets up the data structures necessary to display the OpenFileDialog
+ ///
+ /// The file extension to use if the user doesn't specify one (no "." required)
+ /// You can specify a filename to appear in the dialog, although the user can change it
+ /// See the documentation for the OPENFILENAME structure for a description of filter strings
+ /// Any Windows Forms control, it will be placed inside the OpenFileDialog
+ private OpenFileDialog( string defaultExtension, string fileName, string filter, System.Windows.Forms.Control userControl ) {
+ _filter = filter;
+ _fileName = fileName;
+ _defaultExtension = defaultExtension;
+
+ // LipSync Character Config(*.lsc,content.xml)|*.lsc;content.xml|All Files(*.*)|*.*
+ // 竊・
+ // LipSync Character Config(*.lsc,content.xml)\0*.lsc;content.xml\0All Files(*.*)\0*.*\0\0
+ filter = filter.Replace( "|", "\0" ) + "\0\0";
+
+ // Need two buffers in unmanaged memory to hold the filename
+ // Note: the multiplication by 2 is to allow for Unicode (16-bit) characters
+ _fileNameBuffer = Marshal.AllocCoTaskMem( 2 * _MAX_PATH );
+ _fileTitleBuffer = Marshal.AllocCoTaskMem( 2 * _MAX_PATH );
+ _initialDirBuffer = Marshal.AllocCoTaskMem( 2 * _MAX_PATH );
+
+ // Zero these two buffers
+ byte[] zeroBuffer = new byte[2 * (_MAX_PATH + 1)];
+ for ( int i = 0; i < 2 * (_MAX_PATH + 1); i++ ) {
+ zeroBuffer[i] = 0;
+ }
+ Marshal.Copy( zeroBuffer, 0, _fileNameBuffer, 2 * _MAX_PATH );
+ Marshal.Copy( zeroBuffer, 0, _fileTitleBuffer, 2 * _MAX_PATH );
+ Marshal.Copy( zeroBuffer, 0, _initialDirBuffer, 2 * _MAX_PATH );
+
+ _filterIndex = 0;
+ _fileOffset = 0;
+ _fileExtension = 0;
+
+ // keep a reference to the user-supplied control
+ _userControl = userControl;
+ }
+
+
+ public string FileName {
+ get {
+ return _fileName;
+ }
+ set {
+ if ( value == null ) {
+ return;
+ }
+ _fileName = value;
+ string folder;
+ if ( Path.IsPathRooted( _fileName ) ) {
+ folder = _fileName;
+ _fileName = "";
+ } else {
+ if ( Directory.Exists( _fileName ) ) {
+ folder = _fileName;
+ _fileName = "";
+ } else {
+ if ( _fileName != "" ) {
+ folder = Path.GetDirectoryName( _fileName );
+ } else {
+ folder = "";
+ }
+ }
+ }
+#if DEBUG
+ LipSync.Common.DebugWriteLine( "FileName.set(); folder=" + folder );
+ LipSync.Common.DebugWriteLine( "FileName.set(); _fileName=" + _fileName );
+#endif
+ byte[] zero = new byte[2 * _MAX_PATH];
+ for ( int i = 0; i < 2 * _MAX_PATH; i++ ) {
+ zero[i] = 0;
+ }
+ Marshal.Copy( zero, 0, _fileNameBuffer, 2 * _MAX_PATH );
+ Marshal.Copy( zero, 0, _initialDirBuffer, 2 * _MAX_PATH );
+
+ UnicodeEncoding ue = new UnicodeEncoding();
+ if ( _fileName.Length > 0 ) {
+ byte[] file_name_bytes = ue.GetBytes( _fileName );
+ Marshal.Copy( file_name_bytes, 0, _fileNameBuffer, file_name_bytes.Length );
+ }
+
+ if ( folder.Length > 0 ) {
+ byte[] initial_dir_bytes = ue.GetBytes( folder );
+ Marshal.Copy( initial_dir_bytes, 0, _initialDirBuffer, initial_dir_bytes.Length );
+ }
+#if DEBUG
+ LipSync.Common.DebugWriteLine( "FileName.set(); _fileNameBuffer=" + Marshal.PtrToStringUni( _fileNameBuffer ) );
+ LipSync.Common.DebugWriteLine( "FileName.set(); _initialDir=" + Marshal.PtrToStringUni( _initialDirBuffer ) );
+#endif
+ }
+ }
+
+
+ public string Filter {
+ get {
+ return _filter;
+ }
+ set {
+ _filter = value;
+ }
+ }
+
+
+ public string DefaultExt {
+ get {
+ return _defaultExtension;
+ }
+ set {
+ _defaultExtension = value;
+ }
+ }
+
+
+ ///
+ /// The finalizer will release the unmanaged memory, if I should forget to call Dispose
+ ///
+ ~OpenFileDialog() {
+ Dispose( false );
+ }
+
+
+ ///
+ /// Display the OpenFileDialog and allow user interaction
+ ///
+ /// true if the user clicked OK, false if they clicked cancel (or close)
+ public System.Windows.Forms.DialogResult ShowDialog() {
+ // Create an in-memory Win32 dialog template; this will be a "child" window inside the FileOpenDialog
+ // We have no use for this child window, except that its presence allows us to capture events when
+ // the user interacts with the FileOpenDialog
+ _ipTemplate = BuildDialogTemplate();
+
+ // Populate the OPENFILENAME structure
+ // The flags specified are the minimal set to get the appearance and behaviour we need
+ OpenFileName ofn = new OpenFileName();
+ ofn.lStructSize = Marshal.SizeOf( ofn );
+ ofn.lpstrFile = _fileNameBuffer;
+ ofn.nMaxFile = _MAX_PATH;
+ ofn.lpstrDefExt = Marshal.StringToCoTaskMemUni( _defaultExtension );
+ ofn.lpstrFileTitle = _fileTitleBuffer;
+ ofn.nMaxFileTitle = _MAX_PATH;
+ string filter = _filter.Replace( "|", "\0" ) + "\0\0";
+ ofn.lpstrFilter = Marshal.StringToCoTaskMemUni( filter );
+ ofn.Flags = OpenFileNameFlags.EnableHook | OpenFileNameFlags.EnableTemplateHandle | OpenFileNameFlags.EnableSizing | OpenFileNameFlags.Explorer;
+ ofn.hInstance = _ipTemplate;
+ ofn.lpfnHook = new OfnHookProc( MyHookProc );
+ ofn.lpstrInitialDir = _initialDirBuffer;
+ ofn.nFilterIndex = _filterIndex;
+ ofn.nFileOffset = _fileOffset;
+ ofn.nFileExtension = _fileExtension;
+
+ // copy initial file name into unmanaged memory buffer
+ UnicodeEncoding ue = new UnicodeEncoding();
+ byte[] fileNameBytes = ue.GetBytes( _fileName );
+ Marshal.Copy( fileNameBytes, 0, _fileNameBuffer, fileNameBytes.Length );
+ Marshal.Copy( fileNameBytes, 0, _initialDirBuffer, fileNameBytes.Length );
+
+ if ( NativeMethods.GetOpenFileName( ref ofn ) ) {
+ _fileName = Marshal.PtrToStringUni( _fileNameBuffer );
+ _filterIndex = ofn.nFilterIndex;
+ byte[] file_name_buffer = ue.GetBytes( _fileName );
+ Marshal.Copy( file_name_buffer, 0, _initialDirBuffer, file_name_buffer.Length );
+ _fileOffset = ofn.nFileOffset;
+ _fileExtension = ofn.nFileExtension;
+ return System.Windows.Forms.DialogResult.OK;
+ } else {
+ return System.Windows.Forms.DialogResult.Cancel;
+ }
+ }
+
+
+ ///
+ /// Builds an in-memory Win32 dialog template. See documentation for DLGTEMPLATE.
+ ///
+ /// a pointer to an unmanaged memory buffer containing the dialog template
+ private IntPtr BuildDialogTemplate() {
+ // We must place this child window inside the standard FileOpenDialog in order to get any
+ // notifications sent to our hook procedure. Also, this child window must contain at least
+ // one control. We make no direct use of the child window, or its control.
+
+ // Set up the contents of the DLGTEMPLATE
+ DlgTemplate template = new DlgTemplate();
+
+ // Allocate some unmanaged memory for the template structure, and copy it in
+ IntPtr ipTemplate = Marshal.AllocCoTaskMem( Marshal.SizeOf( template ) );
+ Marshal.StructureToPtr( template, ipTemplate, true );
+ return ipTemplate;
+ }
+
+
+ ///
+ /// The hook procedure for window messages generated by the FileOpenDialog
+ ///
+ /// the handle of the window at which this message is targeted
+ /// the message identifier
+ /// message-specific parameter data
+ /// mess-specific parameter data
+ ///
+ public IntPtr MyHookProc( IntPtr hWnd, UInt16 msg, Int32 wParam, Int32 lParam ) {
+ if ( hWnd == IntPtr.Zero )
+ return IntPtr.Zero;
+
+ // Behaviour is dependant on the message received
+ switch ( msg ) {
+ // We're not interested in every possible message; just return a NULL for those we don't care about
+ default: {
+ return IntPtr.Zero;
+ }
+
+ // WM_INITDIALOG - at this point the OpenFileDialog exists, so we pull the user-supplied control
+ // into the FileOpenDialog now, using the SetParent API.
+ case WindowMessage.InitDialog: {
+ if( _userControl != null ){
+ IntPtr hWndParent = NativeMethods.GetParent( hWnd );
+ NativeMethods.SetParent( _userControl.Handle, hWndParent );
+ }
+ return IntPtr.Zero;
+ }
+
+ // WM_SIZE - the OpenFileDialog has been resized, so we'll resize the content and user-supplied
+ // panel to fit nicely
+ case WindowMessage.Size: {
+ FindAndResizePanels( hWnd );
+ return IntPtr.Zero;
+ }
+
+ // WM_NOTIFY - we're only interested in the CDN_SELCHANGE notification message:
+ // we grab the currently-selected filename and fire our event
+ case WindowMessage.Notify: {
+ IntPtr ipNotify = new IntPtr( lParam );
+ OfNotify ofNot = (OfNotify)Marshal.PtrToStructure( ipNotify, typeof( OfNotify ) );
+ UInt16 code = ofNot.hdr.code;
+ if ( code == CommonDlgNotification.SelChange ) {
+ // This is the first time we can rely on the presence of the content panel
+ // Resize the content and user-supplied panels to fit nicely
+ FindAndResizePanels( hWnd );
+
+ // get the newly-selected path
+ IntPtr hWndParent = NativeMethods.GetParent( hWnd );
+ StringBuilder pathBuffer = new StringBuilder( _MAX_PATH );
+ UInt32 ret = NativeMethods.SendMessage( hWndParent, CommonDlgMessage.GetFilePath, _MAX_PATH, pathBuffer );
+ string path = pathBuffer.ToString();
+
+ // copy the string into the path buffer
+ byte[] zero = new byte[2 * _MAX_PATH];
+ for ( int i = 0; i < 2 * _MAX_PATH; i++ ) {
+ zero[i] = 0;
+ }
+ Marshal.Copy( zero, 0, _fileNameBuffer, 2 * _MAX_PATH );
+ UnicodeEncoding ue = new UnicodeEncoding();
+ byte[] pathBytes = ue.GetBytes( path );
+ Marshal.Copy( pathBytes, 0, _fileNameBuffer, pathBytes.Length );
+
+ _fileName = path;
+#if DEBUG
+ LipSync.Common.DebugWriteLine( "ExtensibleDialog.OpenFiledialog.MyHookProc; SelChange; _fileName=" + path );
+#endif
+ // fire selection-changed event
+ if ( SelectionChanged != null ) {
+ SelectionChanged( path );
+ }
+ } else if ( code == CommonDlgNotification.FolderChange ) {
+ // This is the first time we can rely on the presence of the content panel
+ // Resize the content and user-supplied panels to fit nicely
+ FindAndResizePanels( hWnd );
+
+ // get the newly-selected path
+ IntPtr hWndParent = NativeMethods.GetParent( hWnd );
+ StringBuilder pathBuffer = new StringBuilder( _MAX_PATH );
+ UInt32 ret = NativeMethods.SendMessage( hWndParent, CommonDlgMessage.GetFolderPath, _MAX_PATH, pathBuffer );
+ string path = pathBuffer.ToString();
+
+ // copy the string into the path buffer
+ byte[] zero = new byte[2 * _MAX_PATH];
+ for ( int i = 0; i < 2 * _MAX_PATH; i++ ) {
+ zero[i] = 0;
+ }
+ Marshal.Copy( zero, 0, _initialDirBuffer, 2 * _MAX_PATH );
+ Marshal.Copy( zero, 0, _fileNameBuffer, 2 * _MAX_PATH );
+ UnicodeEncoding ue = new UnicodeEncoding();
+ byte[] pathBytes = ue.GetBytes( path );
+ Marshal.Copy( pathBytes, 0, _initialDirBuffer, pathBytes.Length );
+
+ // fire selection-changed event
+ if ( FolderChanged != null ) {
+ FolderChanged( path );
+ }
+ }
+ return IntPtr.Zero;
+ }
+ }
+ }
+
+
+ ///
+ /// Layout the content of the OpenFileDialog, according to the overall size of the dialog
+ ///
+ /// handle of window that received the WM_SIZE message
+ private void FindAndResizePanels( IntPtr hWnd ) {
+ // The FileOpenDialog is actually of the parent of the specified window
+ IntPtr hWndParent = NativeMethods.GetParent( hWnd );
+
+ // The "content" window is the one that displays the filenames, tiles, etc.
+ // The _CONTENT_PANEL_ID is a magic number - see the accompanying text to learn
+ // how I discovered it.
+ IntPtr hWndContent = NativeMethods.GetDlgItem( hWndParent, _CONTENT_PANEL_ID );
+
+ Rectangle rcClient = new Rectangle( 0, 0, 0, 0 );
+ Rectangle rcContent = new Rectangle( 0, 0, 0, 0 );
+
+ // Get client rectangle of dialog
+ RECT rcTemp = new RECT();
+ NativeMethods.GetClientRect( hWndParent, ref rcTemp );
+ rcClient.X = rcTemp.left;
+ rcClient.Y = rcTemp.top;
+ rcClient.Width = rcTemp.right - rcTemp.left;
+ rcClient.Height = rcTemp.bottom - rcTemp.top;
+
+ // The content window may not be present when the dialog first appears
+ if ( hWndContent != IntPtr.Zero ) {
+ // Find the dimensions of the content panel
+ RECT rc = new RECT();
+ NativeMethods.GetWindowRect( hWndContent, ref rc );
+
+ // Translate these dimensions into the dialog's coordinate system
+ POINT topLeft;
+ topLeft.X = rc.left;
+ topLeft.Y = rc.top;
+ NativeMethods.ScreenToClient( hWndParent, ref topLeft );
+ POINT bottomRight;
+ bottomRight.X = rc.right;
+ bottomRight.Y = rc.bottom;
+ NativeMethods.ScreenToClient( hWndParent, ref bottomRight );
+ rcContent.X = topLeft.X;
+ rcContent.Width = bottomRight.X - topLeft.X;
+ rcContent.Y = topLeft.Y;
+ rcContent.Height = bottomRight.Y - topLeft.Y;
+
+ // Shrink content panel's width
+ int width = rcClient.Right - rcContent.Left;
+ if ( _userControl != null ) {
+ rcContent.Width = (width / 2) + _PANEL_GAP_FACTOR;
+ } else {
+ rcContent.Width = width + _PANEL_GAP_FACTOR;
+ }
+ NativeMethods.MoveWindow( hWndContent, rcContent.Left, rcContent.Top, rcContent.Width, rcContent.Height, true );
+ }
+
+ if( _userControl != null ){
+ // Position the user-supplied control alongside the content panel
+ Rectangle rcUser = new Rectangle( rcContent.Right + (2 * _PANEL_GAP_FACTOR), rcContent.Top, rcClient.Right - rcContent.Right - (3 * _PANEL_GAP_FACTOR), rcContent.Bottom - rcContent.Top );
+ NativeMethods.MoveWindow( _userControl.Handle, rcUser.X, rcUser.Y, rcUser.Width, rcUser.Height, true );
+ }
+ }
+
+ ///
+ /// returns the path currently selected by the user inside the OpenFileDialog
+ ///
+ public string SelectedPath {
+ get {
+ return Marshal.PtrToStringUni( _fileNameBuffer );
+ }
+ }
+
+ #region IDisposable Members
+
+ public void Dispose() {
+ Dispose( true );
+ }
+
+ ///
+ /// Free any unamanged memory used by this instance of OpenFileDialog
+ ///
+ /// true if called by Dispose, false otherwise
+ public void Dispose( bool disposing ) {
+ if ( disposing ) {
+ GC.SuppressFinalize( this );
+ }
+
+ Marshal.FreeCoTaskMem( _fileNameBuffer );
+ Marshal.FreeCoTaskMem( _fileTitleBuffer );
+ Marshal.FreeCoTaskMem( _initialDirBuffer );
+ Marshal.FreeCoTaskMem( _ipTemplate );
+ }
+
+ #endregion
+ }
+
+}
diff --git a/trunk/LipSync/EditResx.pl b/trunk/LipSync/EditResx.pl
new file mode 100644
index 0000000..2d68c6c
--- /dev/null
+++ b/trunk/LipSync/EditResx.pl
@@ -0,0 +1,14 @@
+$file = $ARGV[0];
+
+$index = rindex( $file, "." );
+$newfile = substr( $file, 0, $index ) . "_.resx";
+
+open( FILE, $file );
+open( EDIT, ">" . $newfile );
+while( $line = ){
+# chomp $line;
+ $line =~ s/[\\]/\//g;
+ print EDIT $line;
+}
+close( FILE );
+close( EDIT );
diff --git a/trunk/LipSync/Editor/AppManager.cs b/trunk/LipSync/Editor/AppManager.cs
new file mode 100644
index 0000000..fb4a32d
--- /dev/null
+++ b/trunk/LipSync/Editor/AppManager.cs
@@ -0,0 +1,468 @@
+サソ/*
+ * AppManager.cs
+ * Copyright (c) 2008-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Reflection;
+using System.Windows.Forms;
+
+namespace LipSync {
+
+ public static class AppManager {
+ public static bool Playing = false;
+ public static SettingsEx SaveData;
+ public static EnvSettings Config;
+ internal static List m_commands = new List();
+ internal static int m_command_position = -1;
+ private static readonly Bitmap m_author_list = null;
+ ///
+ /// telop縺ョ謠冗判縺ォ蠢隕√↑譛螟ァ縺ョ繝医Λ繝繧ッ謨ー
+ ///
+ public static int MaxTelopLanes = 0;
+ private static bool m_edited;
+
+ ///
+ /// Edited繝励Ο繝代ユ繧」縺悟、画峩縺輔l縺滓凾逋コ逕溘@縺セ縺
+ ///
+ public static event EventHandler EditedChanged;
+
+ #region _AUTHOR_LIST
+ private const string _AUTHOR_LSIT = "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" +
+ "MC83dOc2+P8BipnMHXM09SIAAAAASUVORK5CYII=";
+ #endregion
+
+ ///
+ /// rect縺ョ荳ュ縺ォpoint縺悟・縺」縺ヲ縺繧九°縺ゥ縺縺九r蛻、螳
+ ///
+ ///
+ ///
+ ///
+ public static bool IsInRectangle( Point point, Rectangle rect ) {
+ if ( rect.X <= point.X && point.X <= rect.X + rect.Width ) {
+ if ( rect.Y <= point.Y && point.Y <= rect.Y + rect.Height ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static bool Edited {
+ get {
+ return m_edited;
+ }
+ set {
+ bool old = m_edited;
+ m_edited = value;
+ if ( EditedChanged != null ) {
+ EditedChanged( typeof( AppManager ), new EventArgs() );
+ }
+ }
+ }
+
+ public static string VERSION {
+ get {
+#if DEBUG
+ return GetAssemblyVersion( typeof( Form1 ) ) + " (build:debug)";
+#else
+ return GetAssemblyVersion( typeof( Form1 ) ) + " (build:release)";
+#endif
+ }
+ }
+
+ private static string GetAssemblyVersion( Type t ) {
+ Assembly a = Assembly.GetAssembly( t );
+ AssemblyFileVersionAttribute afva = (AssemblyFileVersionAttribute)Attribute.GetCustomAttribute( a, typeof( AssemblyFileVersionAttribute ) );
+ return afva.Version;
+ }
+
+ ///
+ /// pictureBox1縺ョ陦後ョ陦ィ遉コ迥カ諷九r陦ィ縺咎榊励r蜿門セ励@縺セ縺吶
+ ///
+ ///
+ public static int[] GetTimeLineLanes() {
+ List ret = new List();
+ // vsq
+ if ( SaveData.m_group_vsq.Folded ) {
+ ret.Add( 1 );
+ } else {
+ ret.Add( SaveData.m_group_vsq.Count + 1 );
+ }
+ // character
+ for ( int i = 0; i < SaveData.m_groups_character.Count; i++ ) {
+ if ( SaveData.m_groups_character[i].Folded ) {
+ ret.Add( 1 );
+ } else {
+ ret.Add( SaveData.m_groups_character[i].Count + 1 );
+ }
+ }
+ // telop
+ if ( SaveData.TelopListFolded ) {
+ ret.Add( 1 );
+ } else {
+ ret.Add( MaxTelopLanes + 1 );
+ }
+ // another image
+ if ( SaveData.m_group_another.Folded ) {
+ ret.Add( 1 );
+ } else {
+ ret.Add( SaveData.m_group_another.Count + 1 );
+ }
+ // plugin
+ if ( SaveData.m_group_plugin.Folded ) {
+ ret.Add( 1 );
+ } else {
+ ret.Add( SaveData.m_group_plugin.Count + 1 );
+ }
+ return ret.ToArray();
+ }
+
+ ///
+ /// 繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ縺ョ繝。繧、繝ウ 繧ィ繝ウ繝医Μ 繝昴う繝ウ繝医〒縺吶
+ ///
+ [STAThread]
+ static void Main( string[] argv ) {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault( false );
+#if !DEBUG
+ try {
+#endif
+ string file = "";
+ if ( argv.Length > 0 ) {
+ file = argv[0];
+ }
+ Form1 form1 = null;
+ if ( File.Exists( file ) ) {
+ form1 = new Form1( file );
+ } else {
+ form1 = new Form1( "" );
+ }
+ Application.Run( form1 );
+ Common.LogClose();
+#if !DEBUG
+ } catch ( Exception e ) {
+ Common.LogPush( e );
+ Common.LogClose();
+ }
+#endif
+ }
+
+ static AppManager() {
+ using ( MemoryStream ms = new MemoryStream( Convert.FromBase64String( _AUTHOR_LSIT ) ) ) {
+ m_author_list = new Bitmap( ms );
+ }
+ }
+
+ ///
+ /// 迴セ蝨ィ菫晄戟縺励※縺繧九さ繝槭Φ繝峨ヰ繝繝輔ぃ繧偵け繝ェ繧「縺励∪縺吶
+ ///
+ public static void ClearCommandBuffer() {
+ m_commands.Clear();
+ m_command_position = -1;
+ }
+
+ ///
+ /// 谺。蝗槭い繝ウ繝峨ぇ蜃ヲ逅縺輔l繧九さ繝槭Φ繝峨ョ遞ョ鬘槭r隱ソ縺ケ縺セ縺
+ ///
+ ///
+ public static CommandType GetNextUndoCommandType() {
+ if ( IsUndoAvailable ) {
+ return m_commands[m_command_position].type;
+ } else {
+ return CommandType.nothing;
+ }
+ }
+
+ ///
+ /// 繧「繝ウ繝峨ぇ蜃ヲ逅繧定。後>縺セ縺
+ ///
+ public static void Undo() {
+ if ( IsUndoAvailable ) {
+ Command run = m_commands[m_command_position];
+ Command inv = SaveData.Execute( run );
+ m_commands[m_command_position] = inv;
+ m_command_position--;
+ }
+ }
+
+ ///
+ /// 谺。蝗槭Μ繝峨ぇ蜃ヲ逅縺輔l繧九さ繝槭Φ繝峨ョ遞ョ鬘槭r隱ソ縺ケ縺セ縺
+ ///
+ ///
+ public static CommandType GetNextRedoCommandType() {
+ if ( IsRedoAvailable ) {
+ return m_commands[m_command_position + 1].type;
+ } else {
+ return CommandType.nothing;
+ }
+ }
+
+ ///
+ /// 繝ェ繝峨ぇ蜃ヲ逅繧定。後>縺セ縺
+ ///
+ public static void Redo() {
+ if ( IsRedoAvailable ) {
+ Command run = m_commands[m_command_position + 1];
+ Command inv = SaveData.Execute( run );
+ m_commands[m_command_position + 1] = inv;
+ m_command_position++;
+ }
+ }
+
+ ///
+ /// 繝ェ繝峨ぇ謫堺ス懊′蜿ッ閭ス縺九←縺縺九r陦ィ縺吶励Ο繝代ユ繧」
+ ///
+ public static bool IsRedoAvailable {
+ get {
+ if ( m_commands.Count > 0 && 0 <= m_command_position + 1 && m_command_position + 1 < m_commands.Count ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// 繧「繝ウ繝峨ぇ謫堺ス懊′蜿ッ閭ス縺九←縺縺九r陦ィ縺吶励Ο繝代ユ繧」
+ ///
+ public static bool IsUndoAvailable {
+ get {
+ if ( m_commands.Count > 0 && 0 <= m_command_position && m_command_position < m_commands.Count ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ ///
+ /// 繧ウ繝槭Φ繝峨ヰ繝繝輔ぃ縺ォ謖螳壹&繧後◆繧ウ繝槭Φ繝峨r逋サ骭イ縺励∪縺
+ ///
+ ///
+ public static void Register( Command command ) {
+ if ( m_command_position == m_commands.Count - 1 ) {
+ // 譁ー縺励>繧ウ繝槭Φ繝峨ヰ繝繝輔ぃ繧定ソス蜉縺吶k蝣エ蜷
+ m_commands.Add( command );
+ m_command_position = m_commands.Count - 1;
+ } else {
+ // 譌「縺ォ縺ゅk繧ウ繝槭Φ繝峨ヰ繝繝輔ぃ繧剃ク頑嶌縺阪☆繧句エ蜷
+ //m_commands[m_command_position + 1].Dispose();
+ m_commands[m_command_position + 1] = command;
+ for ( int i = m_commands.Count - 1; i >= m_command_position + 2; i-- ) {
+ m_commands.RemoveAt( i );
+ }
+ m_command_position++;
+ }
+ }
+
+ public static Bitmap author_list {
+ get {
+ return (Bitmap)m_author_list.Clone();
+ }
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/AviOutput.cs b/trunk/LipSync/Editor/AviOutput.cs
new file mode 100644
index 0000000..9b86e8a
--- /dev/null
+++ b/trunk/LipSync/Editor/AviOutput.cs
@@ -0,0 +1,220 @@
+/*
+ * AviOutput.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.IO;
+using System.Windows.Forms;
+using System.Drawing;
+
+using Boare.Lib.AppUtil;
+
+namespace LipSync {
+
+ public partial class AviOutput : Form, IMultiLanguageControl {
+ private bool m_raw_mode = false;
+ private float m_start = 0f;
+ private float m_end = 0f;
+
+ public AviOutput( bool raw_mode ) {
+ InitializeComponent();
+ ApplyLanguage();
+ ApplyFont( AppManager.Config.Font.GetFont() );
+ m_raw_mode = raw_mode;
+ if ( groupAudio.Enabled ) {
+ if ( File.Exists( AppManager.SaveData.m_audioFile ) ) {
+ this.chkMergeAudio.Enabled = true;
+ } else {
+ this.chkMergeAudio.Enabled = false;
+ }
+ }
+ if ( m_raw_mode ) {
+ btnVideoCompression.Enabled = false;
+ txtDescription.Enabled = false;
+ } else {
+ btnVideoCompression.Enabled = true;
+ txtDescription.Enabled = true;
+ }
+ txtFile.Text = AppManager.Config.LastAviPath;
+ JudgeWritable();
+ }
+
+ public void ApplyFont( Font font ) {
+ this.Font = font;
+ foreach ( Control c in this.Controls ) {
+ Boare.Lib.AppUtil.Misc.ApplyFontRecurse( c, font );
+ }
+ }
+
+ public void ApplyLanguage() {
+ btnCancel.Text = _( "Cancel" );
+ btnOK.Text = _( "Save" );
+ lblFileName.Text = _( "File Name" );
+ if ( AppManager.Config.PathFFmpeg != "" && File.Exists( AppManager.Config.PathFFmpeg ) ) {
+ groupAudio.Text = _( "Audio" );
+ groupAudio.Enabled = true;
+ } else {
+ groupAudio.Text = _( "Audio" ) + " (" + _( "Set the path of ffmpeg to enable this option" ) + ")";
+ groupAudio.Enabled = false;
+ }
+ if ( AppManager.Config.PathMEncoder != "" && File.Exists( AppManager.Config.PathMEncoder ) ) {
+ groupFlv.Text = _( "FLV and MP4" );
+ groupFlv.Enabled = true;
+ } else {
+ groupFlv.Text = _( "FLV and MP4" ) + " (" + _( "Set the path of mencoder and ffmpeg to enable this option" ) + ")";
+ groupFlv.Enabled = false;
+ }
+ chkFLV.Text = _( "Convert to FLV" );
+ chkMP4.Text = _( "Convert to MP4" );
+ chkMergeAudio.Text = _( "Merge WAVE to AVI" );
+ chkDeleteIntermediate.Text = _( "Delete Intermediate File" );
+ btnVideoCompression.Text = _( "Video Compression" );
+ groupStartEnd.Text = _( "Specify Output Range" );
+ chkStart.Text = _( "Start" );
+ chkEnd.Text = _( "End" );
+ checkContainsAlpha.Text = _( "Add Alpha" );
+ }
+
+ public static string _( string s ) {
+ return Messaging.GetMessage( s );
+ }
+
+ public AviOutputArguments Arguments {
+ get {
+ AviOutputArguments aoa = new AviOutputArguments();
+ aoa.AviFile = this.FileName;
+ aoa.End = m_end;
+ aoa.EndSpecified = chkEnd.Checked;
+ aoa.FileNameParser = "";
+ aoa.ImageFormat = null;
+ aoa.IsDeleteIntermediateRequired = chkDeleteIntermediate.Checked;
+ aoa.IsFlvEncodeRequired = chkFLV.Checked;
+ aoa.IsMp4EncodeRequired = chkMP4.Checked;
+ if ( aoa.IsMp4EncodeRequired && aoa.IsFlvEncodeRequired ) {
+ aoa.IsFlvEncodeRequired = false;
+ }
+ aoa.IsTransparent = checkContainsAlpha.Checked;
+ aoa.IsWaveMergeRequired = chkMergeAudio.Checked;
+ aoa.Start = m_start;
+ aoa.StartSpecified = chkStart.Checked;
+ aoa.UseVfwEncoder = radioVfw.Checked;
+ return aoa;
+ }
+ }
+
+ private void btnOK_Click( object sender, EventArgs e ) {
+ //繝繧」繝ャ繧ッ繝医Μ縺悟ュ伜惠縺吶k縺九←縺縺九r遒コ隱
+ string name = FileName;
+ if ( !Directory.Exists( Path.GetDirectoryName( name ) ) ) {
+ MessageBox.Show( string.Format( _( "Directory {0} does not exist." ), Path.GetDirectoryName( name ) ),
+ _( "Error" ),
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation );
+ return;
+ }
+
+ //譌「縺ォ繝輔ぃ繧、繝ォ縺悟ュ伜惠縺吶k縺薙→繧定ュヲ蜻
+ if ( File.Exists( name ) ) {
+ if ( MessageBox.Show( string.Format( _( "{0} already exists.\nDo you want to replace it?" ), name ),
+ "LipSync",
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Exclamation ) == DialogResult.No ) {
+ return;
+ }
+ }
+ try {
+ m_start = float.Parse( txtStart.Text );
+ m_end = float.Parse( txtEnd.Text );
+ this.DialogResult = DialogResult.OK;
+ } catch ( Exception ex ) {
+ MessageBox.Show( _( "Invalid value has been entered" ),
+ _( "Error" ),
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation );
+ Common.LogPush( ex );
+ }
+ }
+
+ private string FileName {
+ get {
+ if ( Path.GetExtension( txtFile.Text ).ToLower() != ".avi" ) {
+ string name = txtFile.Text;
+ txtFile.Text = Path.Combine( Path.GetDirectoryName( name ), Path.GetFileNameWithoutExtension( name ) + ".avi" );
+ }
+ return txtFile.Text;
+ }
+ }
+
+ private void btnFile_Click( object sender, EventArgs e ) {
+ using ( SaveFileDialog dlg = new SaveFileDialog() ) {
+ if ( AppManager.Config.LastAviPath != "" ) {
+ try {
+ dlg.InitialDirectory = Path.GetDirectoryName( AppManager.Config.LastAviPath );
+ } catch {
+ }
+ }
+ try {
+ dlg.Filter = _( "Avi file(*.avi)|*.avi" ) + "|" + _( "All Files(*.*)|*.*" );
+ } catch {
+ dlg.Filter = "Avi file(*.avi)|*.avi|All Files(*.*)|*.*";
+ }
+ dlg.OverwritePrompt = false;
+ if ( dlg.ShowDialog() == DialogResult.OK ) {
+ AppManager.Config.LastAviPath = dlg.FileName;
+ txtFile.Text = dlg.FileName;
+ JudgeWritable();
+ }
+ }
+ }
+
+ private void JudgeWritable() {
+ if ( txtFile.Text != "" ) {
+ btnOK.Enabled = true;
+ } else {
+ btnOK.Enabled = false;
+ }
+ }
+
+ private void chkStart_CheckedChanged( object sender, EventArgs e ) {
+ txtStart.Enabled = chkStart.Checked;
+ if ( txtStart.Enabled ) {
+ txtStart.Focus();
+ }
+ }
+
+ private void checkBox1_CheckedChanged( object sender, EventArgs e ) {
+ txtEnd.Enabled = chkEnd.Checked;
+ if ( txtEnd.Enabled ) {
+ txtEnd.Focus();
+ }
+ }
+
+ private void chkFLV_CheckedChanged( object sender, EventArgs e ) {
+ if ( chkFLV.Checked && chkMP4.Checked ) {
+ chkMP4.Checked = false;
+ }
+ this.chkDeleteIntermediate.Enabled = chkFLV.Checked | chkMP4.Checked | chkMergeAudio.Checked;
+ }
+
+ private void chkMP4_CheckedChanged( object sender, EventArgs e ) {
+ if ( chkMP4.Checked && chkFLV.Checked ) {
+ chkFLV.Checked = false;
+ }
+ this.chkDeleteIntermediate.Enabled = chkFLV.Checked | chkMP4.Checked | chkMergeAudio.Checked;
+ }
+
+ private void chkMergeAudio_CheckedChanged( object sender, EventArgs e ) {
+ this.chkDeleteIntermediate.Enabled = chkFLV.Checked | chkMP4.Checked | chkMergeAudio.Checked;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/AviOutput.designer.cs b/trunk/LipSync/Editor/AviOutput.designer.cs
new file mode 100644
index 0000000..dae5946
--- /dev/null
+++ b/trunk/LipSync/Editor/AviOutput.designer.cs
@@ -0,0 +1,378 @@
+/*
+ * AviOutput.designer.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+ partial class AviOutput {
+ ///
+ /// 蠢隕√↑繝繧カ繧、繝雁、画焚縺ァ縺吶
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 菴ソ逕ィ荳ュ縺ョ繝ェ繧ス繝シ繧ケ繧偵☆縺ケ縺ヲ繧ッ繝ェ繝シ繝ウ繧「繝繝励@縺セ縺吶
+ ///
+ /// 繝槭ロ繝シ繧ク 繝ェ繧ス繝シ繧ケ縺檎エ譽縺輔l繧句エ蜷 true縲∫エ譽縺輔l縺ェ縺蝣エ蜷医ッ false 縺ァ縺吶
+ protected override void Dispose( bool disposing ) {
+ if ( disposing && (components != null) ) {
+ components.Dispose();
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows 繝輔か繝シ繝 繝繧カ繧、繝翫〒逕滓舌&繧後◆繧ウ繝シ繝
+
+ ///
+ /// 繝繧カ繧、繝 繧オ繝昴シ繝医↓蠢隕√↑繝。繧ス繝繝峨〒縺吶ゅ%縺ョ繝。繧ス繝繝峨ョ蜀螳ケ繧
+ /// 繧ウ繝シ繝 繧ィ繝繧」繧ソ縺ァ螟画峩縺励↑縺縺ァ縺上□縺輔>縲
+ ///
+ private void InitializeComponent() {
+ this.txtFile = new System.Windows.Forms.TextBox();
+ this.lblFileName = new System.Windows.Forms.Label();
+ this.btnFile = new System.Windows.Forms.Button();
+ this.btnVideoCompression = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.chkStart = new System.Windows.Forms.CheckBox();
+ this.groupStartEnd = new System.Windows.Forms.GroupBox();
+ this.txtEnd = new System.Windows.Forms.TextBox();
+ this.txtStart = new System.Windows.Forms.TextBox();
+ this.chkEnd = new System.Windows.Forms.CheckBox();
+ this.groupFlv = new System.Windows.Forms.GroupBox();
+ this.chkMP4 = new System.Windows.Forms.CheckBox();
+ this.chkDeleteIntermediate = new System.Windows.Forms.CheckBox();
+ this.chkFLV = new System.Windows.Forms.CheckBox();
+ this.checkContainsAlpha = new System.Windows.Forms.CheckBox();
+ this.txtDescription = new System.Windows.Forms.Label();
+ this.groupAudio = new System.Windows.Forms.GroupBox();
+ this.chkMergeAudio = new System.Windows.Forms.CheckBox();
+ this.groupAviEncoder = new System.Windows.Forms.GroupBox();
+ this.radioVcm = new System.Windows.Forms.RadioButton();
+ this.radioVfw = new System.Windows.Forms.RadioButton();
+ this.groupStartEnd.SuspendLayout();
+ this.groupFlv.SuspendLayout();
+ this.groupAudio.SuspendLayout();
+ this.groupAviEncoder.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // txtFile
+ //
+ this.txtFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtFile.BackColor = System.Drawing.SystemColors.Window;
+ this.txtFile.Location = new System.Drawing.Point( 73, 14 );
+ this.txtFile.Name = "txtFile";
+ this.txtFile.Size = new System.Drawing.Size( 221, 19 );
+ this.txtFile.TabIndex = 0;
+ //
+ // lblFileName
+ //
+ this.lblFileName.AutoSize = true;
+ this.lblFileName.Location = new System.Drawing.Point( 15, 17 );
+ this.lblFileName.Name = "lblFileName";
+ this.lblFileName.Size = new System.Drawing.Size( 51, 12 );
+ this.lblFileName.TabIndex = 4;
+ this.lblFileName.Text = "繝輔ぃ繧、繝ォ蜷";
+ //
+ // btnFile
+ //
+ this.btnFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnFile.Location = new System.Drawing.Point( 300, 12 );
+ this.btnFile.Name = "btnFile";
+ this.btnFile.Size = new System.Drawing.Size( 24, 23 );
+ this.btnFile.TabIndex = 1;
+ this.btnFile.Text = "...";
+ this.btnFile.UseVisualStyleBackColor = true;
+ this.btnFile.Click += new System.EventHandler( this.btnFile_Click );
+ //
+ // btnVideoCompression
+ //
+ this.btnVideoCompression.Enabled = false;
+ this.btnVideoCompression.Location = new System.Drawing.Point( 142, 423 );
+ this.btnVideoCompression.Name = "btnVideoCompression";
+ this.btnVideoCompression.Size = new System.Drawing.Size( 113, 24 );
+ this.btnVideoCompression.TabIndex = 14;
+ this.btnVideoCompression.Text = "繝薙ョ繧ェ蝨ァ邵ョ";
+ this.btnVideoCompression.UseVisualStyleBackColor = true;
+ this.btnVideoCompression.Visible = false;
+ //
+ // btnCancel
+ //
+ this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Location = new System.Drawing.Point( 246, 381 );
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size( 75, 23 );
+ this.btnCancel.TabIndex = 13;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ //
+ // btnOK
+ //
+ this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnOK.Enabled = false;
+ this.btnOK.Location = new System.Drawing.Point( 147, 381 );
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size( 75, 23 );
+ this.btnOK.TabIndex = 12;
+ this.btnOK.Text = "菫晏ュ";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler( this.btnOK_Click );
+ //
+ // chkStart
+ //
+ this.chkStart.AutoSize = true;
+ this.chkStart.Location = new System.Drawing.Point( 35, 18 );
+ this.chkStart.Name = "chkStart";
+ this.chkStart.Size = new System.Drawing.Size( 48, 16 );
+ this.chkStart.TabIndex = 8;
+ this.chkStart.Text = "髢句ァ";
+ this.chkStart.UseVisualStyleBackColor = true;
+ this.chkStart.CheckedChanged += new System.EventHandler( this.chkStart_CheckedChanged );
+ //
+ // groupStartEnd
+ //
+ this.groupStartEnd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupStartEnd.Controls.Add( this.txtEnd );
+ this.groupStartEnd.Controls.Add( this.txtStart );
+ this.groupStartEnd.Controls.Add( this.chkEnd );
+ this.groupStartEnd.Controls.Add( this.chkStart );
+ this.groupStartEnd.Location = new System.Drawing.Point( 12, 293 );
+ this.groupStartEnd.Name = "groupStartEnd";
+ this.groupStartEnd.Size = new System.Drawing.Size( 308, 72 );
+ this.groupStartEnd.TabIndex = 7;
+ this.groupStartEnd.TabStop = false;
+ this.groupStartEnd.Text = "蜃コ蜉帷ッ蝗イ繧呈欠螳";
+ //
+ // txtEnd
+ //
+ this.txtEnd.Enabled = false;
+ this.txtEnd.Location = new System.Drawing.Point( 103, 40 );
+ this.txtEnd.Name = "txtEnd";
+ this.txtEnd.Size = new System.Drawing.Size( 144, 19 );
+ this.txtEnd.TabIndex = 11;
+ this.txtEnd.Text = "0";
+ //
+ // txtStart
+ //
+ this.txtStart.Enabled = false;
+ this.txtStart.Location = new System.Drawing.Point( 103, 16 );
+ this.txtStart.Name = "txtStart";
+ this.txtStart.Size = new System.Drawing.Size( 144, 19 );
+ this.txtStart.TabIndex = 9;
+ this.txtStart.Text = "0";
+ //
+ // chkEnd
+ //
+ this.chkEnd.AutoSize = true;
+ this.chkEnd.Location = new System.Drawing.Point( 35, 42 );
+ this.chkEnd.Name = "chkEnd";
+ this.chkEnd.Size = new System.Drawing.Size( 48, 16 );
+ this.chkEnd.TabIndex = 10;
+ this.chkEnd.Text = "邨ゆコ";
+ this.chkEnd.UseVisualStyleBackColor = true;
+ this.chkEnd.CheckedChanged += new System.EventHandler( this.checkBox1_CheckedChanged );
+ //
+ // groupFlv
+ //
+ this.groupFlv.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupFlv.Controls.Add( this.chkMP4 );
+ this.groupFlv.Controls.Add( this.chkFLV );
+ this.groupFlv.Location = new System.Drawing.Point( 13, 148 );
+ this.groupFlv.Name = "groupFlv";
+ this.groupFlv.Size = new System.Drawing.Size( 311, 72 );
+ this.groupFlv.TabIndex = 2;
+ this.groupFlv.TabStop = false;
+ this.groupFlv.Text = "FLV";
+ //
+ // chkMP4
+ //
+ this.chkMP4.AutoSize = true;
+ this.chkMP4.Location = new System.Drawing.Point( 23, 44 );
+ this.chkMP4.Name = "chkMP4";
+ this.chkMP4.Size = new System.Drawing.Size( 104, 16 );
+ this.chkMP4.TabIndex = 4;
+ this.chkMP4.Text = "Convert to MP4";
+ this.chkMP4.UseVisualStyleBackColor = true;
+ this.chkMP4.CheckedChanged += new System.EventHandler( this.chkMP4_CheckedChanged );
+ //
+ // chkDeleteIntermediate
+ //
+ this.chkDeleteIntermediate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.chkDeleteIntermediate.AutoSize = true;
+ this.chkDeleteIntermediate.Enabled = false;
+ this.chkDeleteIntermediate.Location = new System.Drawing.Point( 173, 48 );
+ this.chkDeleteIntermediate.Name = "chkDeleteIntermediate";
+ this.chkDeleteIntermediate.Size = new System.Drawing.Size( 134, 16 );
+ this.chkDeleteIntermediate.TabIndex = 3;
+ this.chkDeleteIntermediate.Text = "荳ュ髢薙ヵ繧。繧、繝ォ繧貞炎髯、縺吶k";
+ this.chkDeleteIntermediate.UseVisualStyleBackColor = true;
+ //
+ // chkFLV
+ //
+ this.chkFLV.AutoSize = true;
+ this.chkFLV.Location = new System.Drawing.Point( 23, 22 );
+ this.chkFLV.Name = "chkFLV";
+ this.chkFLV.Size = new System.Drawing.Size( 103, 16 );
+ this.chkFLV.TabIndex = 2;
+ this.chkFLV.Text = "Convert to FLV";
+ this.chkFLV.UseVisualStyleBackColor = true;
+ this.chkFLV.CheckedChanged += new System.EventHandler( this.chkFLV_CheckedChanged );
+ //
+ // checkContainsAlpha
+ //
+ this.checkContainsAlpha.AutoSize = true;
+ this.checkContainsAlpha.Location = new System.Drawing.Point( 36, 48 );
+ this.checkContainsAlpha.Name = "checkContainsAlpha";
+ this.checkContainsAlpha.Size = new System.Drawing.Size( 110, 16 );
+ this.checkContainsAlpha.TabIndex = 4;
+ this.checkContainsAlpha.Text = "繧「繝ォ繝輔ぃ蛟、繧貞性繧√k";
+ this.checkContainsAlpha.UseVisualStyleBackColor = true;
+ //
+ // txtDescription
+ //
+ this.txtDescription.AutoSize = true;
+ this.txtDescription.Enabled = false;
+ this.txtDescription.Location = new System.Drawing.Point( 294, 429 );
+ this.txtDescription.Name = "txtDescription";
+ this.txtDescription.Size = new System.Drawing.Size( 9, 12 );
+ this.txtDescription.TabIndex = 19;
+ this.txtDescription.Text = " ";
+ this.txtDescription.Visible = false;
+ //
+ // groupAudio
+ //
+ this.groupAudio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupAudio.Controls.Add( this.chkMergeAudio );
+ this.groupAudio.Location = new System.Drawing.Point( 12, 226 );
+ this.groupAudio.Name = "groupAudio";
+ this.groupAudio.Size = new System.Drawing.Size( 311, 61 );
+ this.groupAudio.TabIndex = 5;
+ this.groupAudio.TabStop = false;
+ this.groupAudio.Text = "繧ェ繝シ繝繧」繧ェ";
+ //
+ // chkMergeAudio
+ //
+ this.chkMergeAudio.AutoSize = true;
+ this.chkMergeAudio.Enabled = false;
+ this.chkMergeAudio.Location = new System.Drawing.Point( 35, 26 );
+ this.chkMergeAudio.Name = "chkMergeAudio";
+ this.chkMergeAudio.Size = new System.Drawing.Size( 96, 16 );
+ this.chkMergeAudio.TabIndex = 6;
+ this.chkMergeAudio.Text = "AVI縺ォ蝓九a霎シ繧";
+ this.chkMergeAudio.UseVisualStyleBackColor = true;
+ this.chkMergeAudio.CheckedChanged += new System.EventHandler( this.chkMergeAudio_CheckedChanged );
+ //
+ // groupAviEncoder
+ //
+ this.groupAviEncoder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupAviEncoder.Controls.Add( this.radioVcm );
+ this.groupAviEncoder.Controls.Add( this.radioVfw );
+ this.groupAviEncoder.Location = new System.Drawing.Point( 13, 70 );
+ this.groupAviEncoder.Name = "groupAviEncoder";
+ this.groupAviEncoder.Size = new System.Drawing.Size( 311, 72 );
+ this.groupAviEncoder.TabIndex = 20;
+ this.groupAviEncoder.TabStop = false;
+ this.groupAviEncoder.Text = "Avi Encoder";
+ //
+ // radioVcm
+ //
+ this.radioVcm.AutoSize = true;
+ this.radioVcm.Location = new System.Drawing.Point( 23, 45 );
+ this.radioVcm.Name = "radioVcm";
+ this.radioVcm.Size = new System.Drawing.Size( 169, 16 );
+ this.radioVcm.TabIndex = 1;
+ this.radioVcm.TabStop = true;
+ this.radioVcm.Text = "Video Compression Manager";
+ this.radioVcm.UseVisualStyleBackColor = true;
+ //
+ // radioVfw
+ //
+ this.radioVfw.AutoSize = true;
+ this.radioVfw.Checked = true;
+ this.radioVfw.Location = new System.Drawing.Point( 23, 23 );
+ this.radioVfw.Name = "radioVfw";
+ this.radioVfw.Size = new System.Drawing.Size( 118, 16 );
+ this.radioVfw.TabIndex = 0;
+ this.radioVfw.TabStop = true;
+ this.radioVfw.Text = "Video for Windows";
+ this.radioVfw.UseVisualStyleBackColor = true;
+ //
+ // AviOutput
+ //
+ this.AcceptButton = this.btnOK;
+ this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size( 335, 421 );
+ this.Controls.Add( this.groupAviEncoder );
+ this.Controls.Add( this.chkDeleteIntermediate );
+ this.Controls.Add( this.checkContainsAlpha );
+ this.Controls.Add( this.txtDescription );
+ this.Controls.Add( this.groupAudio );
+ this.Controls.Add( this.groupFlv );
+ this.Controls.Add( this.groupStartEnd );
+ this.Controls.Add( this.btnVideoCompression );
+ this.Controls.Add( this.btnCancel );
+ this.Controls.Add( this.btnOK );
+ this.Controls.Add( this.btnFile );
+ this.Controls.Add( this.lblFileName );
+ this.Controls.Add( this.txtFile );
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "AviOutput";
+ this.ShowInTaskbar = false;
+ this.Text = "AviOutput";
+ this.groupStartEnd.ResumeLayout( false );
+ this.groupStartEnd.PerformLayout();
+ this.groupFlv.ResumeLayout( false );
+ this.groupFlv.PerformLayout();
+ this.groupAudio.ResumeLayout( false );
+ this.groupAudio.PerformLayout();
+ this.groupAviEncoder.ResumeLayout( false );
+ this.groupAviEncoder.PerformLayout();
+ this.ResumeLayout( false );
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox txtFile;
+ private System.Windows.Forms.Label lblFileName;
+ private System.Windows.Forms.Button btnFile;
+ private System.Windows.Forms.Button btnVideoCompression;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.CheckBox chkStart;
+ private System.Windows.Forms.GroupBox groupStartEnd;
+ private System.Windows.Forms.TextBox txtEnd;
+ private System.Windows.Forms.TextBox txtStart;
+ private System.Windows.Forms.CheckBox chkEnd;
+ private System.Windows.Forms.GroupBox groupFlv;
+ private System.Windows.Forms.CheckBox chkDeleteIntermediate;
+ private System.Windows.Forms.CheckBox chkFLV;
+ private System.Windows.Forms.GroupBox groupAudio;
+ private System.Windows.Forms.CheckBox chkMergeAudio;
+ private System.Windows.Forms.Label txtDescription;
+ private System.Windows.Forms.CheckBox checkContainsAlpha;
+ private System.Windows.Forms.CheckBox chkMP4;
+ private System.Windows.Forms.GroupBox groupAviEncoder;
+ private System.Windows.Forms.RadioButton radioVfw;
+ private System.Windows.Forms.RadioButton radioVcm;
+ }
+}
diff --git a/trunk/LipSync/Editor/AviOutputArguments.cs b/trunk/LipSync/Editor/AviOutputArguments.cs
new file mode 100644
index 0000000..a650413
--- /dev/null
+++ b/trunk/LipSync/Editor/AviOutputArguments.cs
@@ -0,0 +1,32 @@
+サソ/*
+ * AviOutputArguments.cs
+ * Copyright (c) 2008-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+
+ public class AviOutputArguments {
+ public string AviFile = "";
+ public float Start = 0f;
+ public float End = 0f;
+ public bool StartSpecified = false;
+ public bool EndSpecified = false;
+ public bool IsWaveMergeRequired = false;
+ public bool IsFlvEncodeRequired = false;
+ public bool IsMp4EncodeRequired = false;
+ public bool IsDeleteIntermediateRequired = false;
+ public bool IsTransparent = false;
+ public string FileNameParser;
+ public System.Drawing.Imaging.ImageFormat ImageFormat;
+ public bool UseVfwEncoder = true;
+ }
+
+}
diff --git a/trunk/LipSync/Editor/AviReaderEx.cs b/trunk/LipSync/Editor/AviReaderEx.cs
new file mode 100644
index 0000000..24e9801
--- /dev/null
+++ b/trunk/LipSync/Editor/AviReaderEx.cs
@@ -0,0 +1,47 @@
+サソ/*
+ * AviReaderEx.cs
+ * Copyright (c) 2008-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+
+using Boare.Lib.Media;
+
+namespace LipSync {
+
+ public class AviReaderEx : AviReader {
+ private int m_num_openfailed = 0;
+
+ ///
+ /// avi繝輔ぃ繧、繝ォ縺ョOpen縺ォ螟ア謨励@縺溽エッ遨榊屓謨ー繧貞叙蠕励@縺セ縺
+ ///
+ public int NumFailed {
+ get {
+ return m_num_openfailed;
+ }
+ }
+
+
+ public AviReaderEx() : base() {
+ m_num_openfailed = 0;
+ }
+
+
+ public new void Open( string file ){
+ try {
+ base.Open( file );
+ } catch {
+ m_num_openfailed++;
+ }
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/BarLineType.cs b/trunk/LipSync/Editor/BarLineType.cs
new file mode 100644
index 0000000..7af7074
--- /dev/null
+++ b/trunk/LipSync/Editor/BarLineType.cs
@@ -0,0 +1,28 @@
+サソ/*
+ * BarLineType.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+
+ public struct BarLineType {
+ public double Time;
+ public bool IsSeparator;
+ public bool NeverUseForSnapPoint;
+
+ public BarLineType( double time, bool is_separator, bool never_use_for_snap_point ) {
+ Time = time;
+ IsSeparator = is_separator;
+ NeverUseForSnapPoint = never_use_for_snap_point;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/BugReport.Designer.cs b/trunk/LipSync/Editor/BugReport.Designer.cs
new file mode 100644
index 0000000..d099432
--- /dev/null
+++ b/trunk/LipSync/Editor/BugReport.Designer.cs
@@ -0,0 +1,75 @@
+サソ/*
+ * BugReport.Designer.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+
+ partial class BugReport {
+ ///
+ /// 蠢隕√↑繝繧カ繧、繝雁、画焚縺ァ縺吶
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 菴ソ逕ィ荳ュ縺ョ繝ェ繧ス繝シ繧ケ繧偵☆縺ケ縺ヲ繧ッ繝ェ繝シ繝ウ繧「繝繝励@縺セ縺吶
+ ///
+ /// 繝槭ロ繝シ繧ク 繝ェ繧ス繝シ繧ケ縺檎エ譽縺輔l繧句エ蜷 true縲∫エ譽縺輔l縺ェ縺蝣エ蜷医ッ false 縺ァ縺吶
+ protected override void Dispose( bool disposing ) {
+ if ( disposing && (components != null) ) {
+ components.Dispose();
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows 繝輔か繝シ繝 繝繧カ繧、繝翫〒逕滓舌&繧後◆繧ウ繝シ繝
+
+ ///
+ /// 繝繧カ繧、繝 繧オ繝昴シ繝医↓蠢隕√↑繝。繧ス繝繝峨〒縺吶ゅ%縺ョ繝。繧ス繝繝峨ョ蜀螳ケ繧
+ /// 繧ウ繝シ繝 繧ィ繝繧」繧ソ縺ァ螟画峩縺励↑縺縺ァ縺上□縺輔>縲
+ ///
+ private void InitializeComponent() {
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // textBox1
+ //
+ this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textBox1.Font = new System.Drawing.Font( "シュシウ 繧エ繧キ繝繧ッ", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)) );
+ this.textBox1.Location = new System.Drawing.Point( 12, 49 );
+ this.textBox1.Multiline = true;
+ this.textBox1.Name = "textBox1";
+ this.textBox1.Size = new System.Drawing.Size( 357, 223 );
+ this.textBox1.TabIndex = 0;
+ //
+ // BugReport
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size( 381, 284 );
+ this.Controls.Add( this.textBox1 );
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.Name = "BugReport";
+ this.ShowIcon = false;
+ this.Text = "BugReport";
+ this.ResumeLayout( false );
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox textBox1;
+ }
+}
\ No newline at end of file
diff --git a/trunk/LipSync/Editor/BugReport.cs b/trunk/LipSync/Editor/BugReport.cs
new file mode 100644
index 0000000..bce1710
--- /dev/null
+++ b/trunk/LipSync/Editor/BugReport.cs
@@ -0,0 +1,84 @@
+サソ/*
+ * BugReport.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Windows.Forms;
+
+namespace LipSync {
+
+ public partial class BugReport : Form {
+ public BugReport() {
+ InitializeComponent();
+ string runtime_version = System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion();
+ textBox1.Text = "[ OS ]:" + OsVersion() + Environment.NewLine +
+ "[.NET runtime]:" + runtime_version + Environment.NewLine +
+ "[ LipSync ]:v" + AppManager.VERSION;
+ }
+
+ private static string OsVersion() {
+ OperatingSystem os = System.Environment.OSVersion;
+ string version = "(" + os.Version.ToString() + ")";
+ switch ( os.Platform ) {
+ case PlatformID.Win32Windows:
+ if ( os.Version.Major >= 4 ) {
+ switch ( os.Version.Minor ) {
+ case 0:
+ return "Windows 95" + version;
+ case 10:
+ return "Windows 98" + version;
+ case 90:
+ return "Windows Me" + version;
+ }
+ }
+ break;
+ case PlatformID.Win32NT:
+ switch ( os.Version.Major ) {
+ case 3:
+ switch ( os.Version.Minor ) {
+ case 0:
+ return "Windows NT 3" + version;
+ case 1:
+ return "Windows NT 3.1" + version;
+ case 5:
+ return "Windows NT 3.5" + version;
+ case 51:
+ return "Windows NT 3.51" + version;
+ }
+ break;
+ case 4:
+ if ( os.Version.Minor == 0 ) {
+ return "Windows NT 4.0" + version;
+ }
+ break;
+ case 5:
+ if ( os.Version.Minor == 0 ) {
+ return "Windows 2000" + version;
+ } else if ( os.Version.Minor == 1 ) {
+ return "Windows XP" + version;
+ }
+ break;
+ case 6:
+ if ( os.Version.Minor == 0 ) {
+ return "Windows Vista" + version;
+ }
+ break;
+ }
+ break;
+ case PlatformID.Win32S:
+ return "Win32s" + version;
+ }
+ return os.Platform.ToString() + version;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/Character.cs b/trunk/LipSync/Editor/Character.cs
new file mode 100644
index 0000000..dfe2fda
--- /dev/null
+++ b/trunk/LipSync/Editor/Character.cs
@@ -0,0 +1,300 @@
+サソ/*
+ * Character.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+
+namespace LipSync {
+
+ public enum CharacterType {
+ def,
+ plugin
+ }
+
+ [Serializable]
+ public class Character : IDisposable {
+ public CharacterType type;
+ string m_Name;
+ public PluginConfig m_pluginConfig;
+ public Size m_plugin_drawarea;
+
+ [Obsolete]
+ public Image Base;
+ [Obsolete]
+ public Image a;
+ [Obsolete]
+ public Image aa;
+ [Obsolete]
+ public Image i;
+ [Obsolete]
+ public Image u;
+ [Obsolete]
+ public Image e;
+ [Obsolete]
+ public Image o;
+ [Obsolete]
+ public Image xo;
+ [Obsolete]
+ public Image nn;
+
+ public List Images;
+ [NonSerialized]
+ private Bitmap m_cache = null;
+ [NonSerialized]
+ private string m_cache_draw = "";
+ [OptionalField]
+ public string version;//setDefault縺ァ螟画峩縺吶k縺ョ縺ァ縲〉eadonly縺ォ縺励◆縺縺代←縺ァ縺阪s
+ [OptionalField]
+ public Size m_size;
+ [OptionalField]
+ public Bitmap m_preview = null;
+
+ [NonSerialized]
+ bool internal_operation = false;
+
+ [OnDeserializing]
+ private void onDeserializing( StreamingContext sc ) {
+ version = "0";
+ m_size = new Size( 0, 0 );
+ }
+
+ [OnSerialized]
+ private void onSerialized( StreamingContext sc ) {
+ if ( m_size.Equals( new Size( 0, 0 ) ) ) {
+ foreach ( ImageEntry img in Images ) {
+ if ( img.title == "base" ) {
+ if ( img.Image != null ) {
+ m_size = new Size( img.Image.Width, img.Image.Height );
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ [OnDeserialized]
+ private void onDeserialized( StreamingContext sc ){
+ // 蜿、縺繝舌シ繧ク繝ァ繝ウ縺ョ*.lse縺ィ縺ョ莠呈鋤諤ァ繧剃ソ昴▽縺溘a縲
+ // base, a, ..., nn縺ョ繝繝シ繧ソ繧棚mages縺ォ遘サ蜍輔&縺帙k
+ if ( nn != null ) {
+ Images.Insert( 0, new ImageEntry( "nn", nn, "蜿」", false ) );
+ nn.Dispose();
+ }
+ if ( xo != null ) {
+ Images.Insert( 0, new ImageEntry( "xo", xo, "蜿」", false ) );
+ xo.Dispose();
+ }
+ if ( o != null ) {
+ Images.Insert( 0, new ImageEntry( "o", o, "蜿」", false ) );
+ o.Dispose();
+ }
+ if ( e != null ) {
+ Images.Insert( 0, new ImageEntry( "e", e, "蜿」", false ) );
+ e.Dispose();
+ }
+ if ( u != null ) {
+ Images.Insert( 0, new ImageEntry( "u", u, "蜿」", false ) );
+ u.Dispose();
+ }
+ if ( i != null ) {
+ Images.Insert( 0, new ImageEntry( "i", i, "蜿」", false ) );
+ i.Dispose();
+ }
+ if ( aa != null ) {
+ Images.Insert( 0, new ImageEntry( "aa", aa, "蜿」", false ) );
+ aa.Dispose();
+ }
+ if ( a != null ) {
+ Images.Insert( 0, new ImageEntry( "a", a, "蜿」", false ) );
+ a.Dispose();
+ }
+ if ( Base != null ) {
+ Images.Insert( 0, new ImageEntry( "base", Base, "譛ャ菴", true ) );
+ Base.Dispose();
+ }
+ if ( version == "0" ) {
+ for ( int k = 0; k < Images.Count; k++ ) {
+ if ( Images[k].title == "base" ) {
+ Images[k].IsDefault = true;
+ m_size = Images[k].Image.Size;
+ version = "2";
+ }
+ }
+ }
+
+ if ( m_size.Width <= 0 || m_size.Height <= 0 ) {
+ int max_x = 0;
+ int max_y = 0;
+ foreach ( ImageEntry img in Images ) {
+ if ( img.Image != null ) {
+ max_x = Math.Max( max_x, img.Image.Width + img.XOffset );
+ max_y = Math.Max( max_y, img.Image.Height + img.YOffset );
+ }
+ }
+ m_size = new Size( max_x, max_y );
+ }
+
+ }
+
+ public void Dispose() {
+ m_Name = null;
+ m_pluginConfig = null;
+ if ( Base != null ) {
+ Base.Dispose();
+ }
+ if ( a != null ) {
+ a.Dispose();
+ }
+ if ( aa != null ) {
+ aa.Dispose();
+ }
+ if ( i != null ) {
+ i.Dispose();
+ }
+ if ( u != null ) {
+ u.Dispose();
+ }
+ if ( e != null ) {
+ e.Dispose();
+ }
+ if ( o != null ) {
+ o.Dispose();
+ }
+ if ( xo != null ) {
+ xo.Dispose();
+ }
+ if ( nn != null ) {
+ nn.Dispose();
+ }
+ Images.Clear();
+ }
+
+ public void Write( Stream stream ) {
+ BinaryFormatter bf = new BinaryFormatter();
+ bf.Serialize( stream, this );
+ }
+
+ public string GetMD5() {
+ System.Security.Cryptography.MD5CryptoServiceProvider mcsp = new System.Security.Cryptography.MD5CryptoServiceProvider();
+ using ( MemoryStream ms = new MemoryStream() ) {
+ this.Write( ms );
+ byte[] dat = mcsp.ComputeHash( ms );
+ string res = "";
+ foreach ( byte b in dat ) {
+ res += b.ToString( "x2" );
+ }
+ return res;
+ }
+ return "";
+ }
+
+ public static Character FromFile( Stream stream ) {
+ Character result = null;
+ BinaryFormatter bf = new BinaryFormatter();
+ result = (Character)bf.Deserialize( stream );
+ bf = null;
+ return result;
+ }
+
+ public static Character FromFile( string filepath ) {
+ Character result = null;
+ if ( File.Exists( filepath ) ) {
+ using ( FileStream fs = new FileStream( filepath, FileMode.Open ) ) {
+ result = FromFile( fs );
+ }
+ }
+ return result;
+ }
+
+ public int Width {
+ get {
+ return m_size.Width;
+ }
+ }
+
+ public int Height {
+ get {
+ return m_size.Height;
+ }
+ }
+
+ public string Name {
+ get {
+ return m_Name;
+ }
+ set {
+ m_Name = value;
+ }
+ }
+
+ public Bitmap DefaultFace {
+ get {
+ string type = "";
+ foreach ( ImageEntry img in this.Images ) {
+ if ( img.IsDefault ) {
+ type += img.title + "\n";
+ }
+ }
+ Bitmap res = Face( type );
+#if DEBUG
+ if ( res == null ) {
+ Common.DebugWriteLine( "Character.DefaultFace.get(); res==null" );
+ Common.DebugWriteLine( " Width=" + Width );
+ Common.DebugWriteLine( " Height=" + Height );
+ Common.DebugWriteLine( " type=" + type );
+ }
+#endif
+ return res;
+ }
+ }
+
+ public Bitmap Face( string type ) {
+ if ( Width <= 0 || Height <= 0 ) {
+ return null;
+ }
+
+ if ( m_cache != null ) {
+ if ( m_cache_draw == type ) {
+ return (Bitmap)m_cache.Clone();
+ }
+ }
+
+ Bitmap bmp = new Bitmap( Width, Height );
+ string[] spl = type.Split( "\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries );
+ using ( Graphics g = Graphics.FromImage( bmp ) ) {
+ //Image drawing;
+ for ( int i = 0; i < spl.Length; i++ ) {
+ for ( int index = 0; index < Images.Count; index++ ) {
+ if ( Images[index].title == spl[i] ) {
+ //drawing = Images[index].image;
+ Images[index].DrawTo( g );
+ break;
+ }
+ }
+ }
+ }
+
+ m_cache_draw = type;
+ if ( m_cache != null ) {
+ m_cache.Dispose();
+ }
+ m_cache = (Bitmap)bmp.Clone();
+ return bmp;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/Character3.cs b/trunk/LipSync/Editor/Character3.cs
new file mode 100644
index 0000000..11362af
--- /dev/null
+++ b/trunk/LipSync/Editor/Character3.cs
@@ -0,0 +1,739 @@
+サソ/*
+ * Character3.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Xml.Serialization;
+
+using LipSync.Properties;
+
+namespace LipSync {
+
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ繧貞叙繧頑桶縺繧ッ繝ゥ繧ケ縲
+ /// 隨ャ3荳紋サ」
+ ///
+ [Serializable]
+ public class Character3 : ICloneable, IDisposable {
+ string m_name;
+ CharacterType m_type;
+ ImageEntry[] m_basic = new ImageEntry[9];
+ List m_another;
+ Size m_size;
+ [NonSerialized]
+ Bitmap m_cache = null;
+ [NonSerialized]
+ int[] m_cache_draw;
+ string m_author;
+ string m_version;
+ PluginConfig m_plugin_config;
+ bool m_updated = false; // 隨ャ2荳紋サ」縺ョCharacter縺九i繧「繝繝励ョ繝シ繝医&繧後◆繧ゅョ縺ァ縺ゅk縺薙→繧定。ィ縺吶ヵ繝ゥ繧ー
+ bool m_is_build_in = false;
+ ///
+ /// 菴ソ逕ィ荳翫ョ豕ィ諢上↑縺ゥ
+ ///
+ [OptionalField]
+ string m_lisence;
+
+ #region public static field
+ ///
+ /// 繝薙Ν繝医う繝ウ繝サ繧ュ繝」繝ゥ繧ッ繧ソ縲
+ ///
+ public static readonly Character3 Miku = new Character3(
+ "Miku",
+ "縺輔↑繧",
+ "",
+ new ImageEntry[] {
+ new ImageEntry( "base", Resources.b_miku175_base, "base", true ),
+ new ImageEntry( "a", Resources.b_miku175_a, "mouth", false ),
+ new ImageEntry( "aa", Resources.b_miku175_aa, "mouth", false ),
+ new ImageEntry( "i", Resources.b_miku175_i, "mouth", false ),
+ new ImageEntry( "u", Resources.b_miku175_u, "mouth", false ),
+ new ImageEntry( "e", Resources.b_miku175_e, "mouth", false ),
+ new ImageEntry( "o", Resources.b_miku175_o, "mouth", false ),
+ new ImageEntry( "xo", Resources.b_miku175_xo, "mouth", false ),
+ new ImageEntry( "nn", Resources.b_miku175_nn, "mouth", false )
+ },
+ new ImageEntry[] {
+ new ImageEntry( "逶ョ髢峨§", Resources.b_miku175_eyeclose, "eye", false ),
+ new ImageEntry( "菴守岼縺ォ縺」縺薙j", Resources.b_miku175_smile, "eye", false ),
+ new ImageEntry( "逶ョ蜊顔岼", Resources.b_miku175_eyethin, "eye", false ),
+ new ImageEntry( "縺薙↑縺", Resources.b_miku175_konata, "eye", false ),
+ new ImageEntry( "シ橸シ", Resources.b_miku175_kudo, "eye", false ),
+ new ImageEntry( "蜩蟾ヲ繧ヲ繧」繝ウ繧ッ", Resources.b_miku175_winkleft, "eye", false ),
+ new ImageEntry( "蜿ウ繧ヲ繧」繝ウ繧ッ", Resources.b_miku175_winkright, "eye", false ),
+ new ImageEntry( "bee", Resources.b_miku175_bee, "mouth", false),
+ new ImageEntry( "neko", Resources.b_miku175_neko, "mouth", false )
+ },
+ true
+ );
+
+ public static readonly Character3 Rin = new Character3(
+ "Rin",
+ "縺輔↑繧",
+ "",
+ new ImageEntry[] {
+ new ImageEntry( "base", Resources.b_rin100_base, "base",true ),
+ new ImageEntry( "a", Resources.b_rin100_a, "mouth", false ),
+ new ImageEntry( "aa", Resources.b_rin100_aa, "mouth", false ),
+ new ImageEntry( "i", Resources.b_rin100_i, "mouth", false ),
+ new ImageEntry( "u", Resources.b_rin100_u, "mouth", false ),
+ new ImageEntry( "e", Resources.b_rin100_e, "mouth", false ),
+ new ImageEntry( "o", Resources.b_rin100_o, "mouth", false ),
+ new ImageEntry( "xo", Resources.b_rin100_xo, "mouth", false ),
+ new ImageEntry( "nn", Resources.b_rin100_nn, "mouth", false )
+ },
+ new ImageEntry[] {
+ new ImageEntry( "逶ョ髢峨§", Resources.b_rin100_eyeclose, "eye", false ),
+ new ImageEntry( "菴守岼縺ォ縺」縺薙j", Resources.b_rin100_smile, "eye", false ),
+ new ImageEntry( "逶ョ蜊顔岼", Resources.b_rin100_eyethin, "eye", false ),
+ new ImageEntry( "シ橸シ", Resources.b_rin100_kudo, "eye", false ),
+ new ImageEntry( "蜩蟾ヲ繧ヲ繧」繝ウ繧ッ", Resources.b_rin100_winkleft, "eye", false ),
+ new ImageEntry( "菴主承繧ヲ繧」繝ウ繧ッ", Resources.b_rin100_winkright, "eye" , false),
+ new ImageEntry( "bee", Resources.b_rin100_bee, "mouth", false ),
+ new ImageEntry( "neko", Resources.b_rin100_neko, "mouth", false ),
+ new ImageEntry( "縺阪@縺", Resources.b_rin100_kisisi, "mouth", false )
+ },
+ true
+ );
+
+ public static readonly Character3 Len = new Character3(
+ "Len",
+ "縺輔↑繧",
+ "",
+ new ImageEntry[] {
+ new ImageEntry( "base", Resources.b_len100_base, "譛ャ菴", true ),
+ new ImageEntry( "a", Resources.b_len100_a, "mouth", false ),
+ new ImageEntry( "aa", Resources.b_len100_aa, "mouth", false ),
+ new ImageEntry( "i", Resources.b_len100_i, "mouth", false ),
+ new ImageEntry( "u", Resources.b_len100_u, "mouth", false ),
+ new ImageEntry( "e", Resources.b_len100_e, "mouth", false ),
+ new ImageEntry( "o", Resources.b_len100_o, "mouth", false ),
+ new ImageEntry( "xo", Resources.b_len100_xo, "mouth", false ),
+ new ImageEntry( "nn", Resources.b_len100_nn, "mouth", false )
+ },
+ new ImageEntry[] {
+ new ImageEntry( "逶ョ髢峨§", Resources.b_len100_eyeclose, "eye", false ),
+ new ImageEntry( "菴守岼縺ォ縺」縺薙j", Resources.b_len100_smile, "eye", false ),
+ new ImageEntry( "逶ョ蜊顔岼", Resources.b_len100_eyethin, "eye", false ),
+ new ImageEntry( "シ茨ス繝サマ峨サツエシ", Resources.b_len100_shakin, "eye", false ),
+ new ImageEntry( "蜩蟾ヲ繧ヲ繧」繝ウ繧ッ", Resources.b_len100_winkleft, "eye", false ),
+ new ImageEntry( "荳ュ蜿ウ繧ヲ繧」繝ウ繧ッ", Resources.b_len100_winkright, "eye", false ),
+ new ImageEntry( "縺阪@縺", Resources.b_len100_kisisi, "mouth", false )
+ },
+ true
+ );
+ #endregion
+
+ [OnDeserialized]
+ private void onDeserialized( StreamingContext sc ) {
+ SortedList slist = new SortedList();
+ foreach ( ImageEntry ie in m_basic ) {
+ slist.Add( ie.Z, ie.title );
+ }
+ foreach ( ImageEntry ie in m_another ) {
+ slist.Add( ie.Z, ie.title );
+ }
+ for ( int i = 0; i < slist.Keys.Count; i++ ) {
+ string title = slist[slist.Keys[i]];
+ bool found = false;
+ for ( int j = 0; j < m_basic.Length; j++ ) {
+ if ( m_basic[j].title == title ) {
+ m_basic[j].Z = i;
+ found = true;
+ break;
+ }
+ }
+ if ( !found ) {
+ for ( int j = 0; j < m_another.Count; j++ ) {
+ if ( m_another[j].title == title ) {
+ m_another[j].Z = i;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public bool IsBuildIn {
+ get {
+ return m_is_build_in;
+ }
+ }
+
+ public void Remove( string title ) {
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ if ( m_another[i].title == title ) {
+ m_another.RemoveAt( i );
+ break;
+ }
+ }
+ }
+
+ public void SetImage( Image img, int index ) {
+ this[index].SetImage( img );
+ }
+
+ public void SetImage( Image img, string title ) {
+ this[title].SetImage( img );
+ }
+
+ public PluginConfig PluginConfig {
+ get {
+ return m_plugin_config;
+ }
+ set {
+ m_plugin_config = value;
+ }
+ }
+
+ public int Count {
+ get {
+ return 9 + m_another.Count;
+ }
+ }
+
+ public void Dispose() {
+ m_basic = null;
+ m_another.Clear();
+ if ( m_cache != null ) {
+ m_cache.Dispose();
+ }
+ }
+
+ public void Add( ImageEntry item ) {
+ ImageEntry adding = (ImageEntry)item.Clone();
+ adding.Z = this.Count;
+ m_another.Add( adding );
+ }
+
+ public string Version {
+ get {
+ return m_version;
+ }
+ set {
+ m_version = value;
+ }
+ }
+
+ public string Author {
+ get {
+ return m_author;
+ }
+ set {
+ m_author = value;
+ }
+ }
+
+ public Character3() {
+ m_name = "";
+ m_type = CharacterType.def;
+ m_basic = new ImageEntry[9];
+ m_basic[0] = new ImageEntry( "base", null, "base", true );
+ m_basic[1] = new ImageEntry( "a", null, "mouth", false );
+ m_basic[2] = new ImageEntry( "aa", null, "mouth", false );
+ m_basic[3] = new ImageEntry( "i", null, "mouth", false );
+ m_basic[4] = new ImageEntry( "u", null, "mouth", false );
+ m_basic[5] = new ImageEntry( "e", null, "mouth", false );
+ m_basic[6] = new ImageEntry( "o", null, "mouth", false );
+ m_basic[7] = new ImageEntry( "xo", null, "mouth", false );
+ m_basic[8] = new ImageEntry( "nn", null, "mouth", false );
+ for ( int i = 0; i < 9; i++ ) {
+ m_basic[i].Z = i;
+ }
+ m_another = new List();
+ m_size = new Size();
+ m_author = "";
+ m_version = "";
+ }
+
+ public void Write( Stream s ) {
+ BinaryFormatter bf = new BinaryFormatter();
+ bf.Serialize( s, this );
+ }
+
+ public string GetMD5() {
+ System.Security.Cryptography.MD5CryptoServiceProvider mcsp = new System.Security.Cryptography.MD5CryptoServiceProvider();
+ using ( MemoryStream ms = new MemoryStream() ) {
+ this.Write( ms );
+ byte[] dat = mcsp.ComputeHash( ms );
+ string res = "";
+ foreach ( byte b in dat ) {
+ res += b.ToString( "x2" );
+ }
+ return res;
+ }
+ return "";
+ }
+
+ ///
+ /// 繝輔ぃ繧、繝ォ縺ォ菫晏ュ倥☆繧
+ ///
+ ///
+ ///
+ public void WriteXml( string path ) {
+ string f = Path.GetFileName( path );
+ if ( f != "content.xml" ) {
+ return;
+ }
+ int width = this.Width;
+ int height = this.Height;
+ string base_path = Path.GetDirectoryName( path );
+ string image_path = Path.Combine( base_path, "images" );
+ if ( !Directory.Exists( image_path ) ) {
+ Directory.CreateDirectory( Path.Combine( base_path, "images" ) );
+ }
+ using ( FileStream fs = new FileStream( Path.Combine( base_path, "content.xml" ), FileMode.Create ) ) {
+ XmlSerializer xs = new XmlSerializer( typeof( Character3 ) );
+ xs.Serialize( fs, this );
+ }
+ using ( FileStream fs = new FileStream( Path.Combine( base_path, "basic.xml" ), FileMode.Create ) ) {
+ XmlSerializer xs = new XmlSerializer( typeof( ImageEntry[] ) );
+ xs.Serialize( fs, m_basic );
+ }
+ using ( FileStream fs = new FileStream( Path.Combine( base_path, "another.xml" ), FileMode.Create ) ) {
+ XmlSerializer xs = new XmlSerializer( typeof( List ) );
+ xs.Serialize( fs, m_another );
+ }
+ int count = -1;
+ foreach ( ImageEntry img in this ) {
+ count++;
+ if ( img.Image != null ) {
+ string file = Path.Combine( Path.Combine( base_path, "images" ), img.Z + ".png" );
+ Bitmap temp = img.GetImage( width, height );
+ temp.Save( file );
+ }
+ }
+ }
+
+ public Character3( PluginConfig plugin_config ) {
+ m_name = plugin_config.ID;
+ m_type = CharacterType.plugin;
+ m_plugin_config = plugin_config.Clone();
+ m_updated = false;
+ }
+
+ public static Character3 Read( Stream s ) {
+ BinaryFormatter bf = new BinaryFormatter();
+ Character3 res = null;
+ try {
+ res = (Character3)bf.Deserialize( s );
+ return res;
+ } catch {
+ return null;
+ }
+ }
+
+ ///
+ /// xml繝輔ぃ繧、繝ォ縺九i縺ョ繧ウ繝ウ繧ケ繝医Λ繧ッ繧ソ
+ ///
+ public static Character3 FromXml( string path ) {
+#if DEBUG
+ Common.DebugWriteLine( "Character3.ctor(string);" );
+#endif
+ Character3 res;
+ string dir = Path.GetDirectoryName( path );
+ using ( FileStream fs = new FileStream( path, FileMode.Open ) ) {
+ XmlSerializer xs = new XmlSerializer( typeof( Character3 ) );
+ res = (Character3)xs.Deserialize( fs );
+ }
+
+ using ( FileStream fs = new FileStream( Path.Combine( dir, "basic.xml" ), FileMode.Open ) ) {
+ XmlSerializer xs = new XmlSerializer( typeof( ImageEntry[] ) );
+ res.m_basic = (ImageEntry[])xs.Deserialize( fs );
+ }
+ using ( FileStream fs = new FileStream( Path.Combine( dir, "another.xml" ), FileMode.Open ) ) {
+ XmlSerializer xs = new XmlSerializer( typeof( List ) );
+ res.m_another = (List)xs.Deserialize( fs );
+ }
+ //res.ZReorder();
+ for ( int i = 0; i < res.Count; i++ ) {
+ int z = res[i].Z;
+ string file = Path.Combine( Path.Combine( dir, "images" ), z + ".png" );
+#if DEBUG
+ Common.DebugWriteLine( "Character3.ctor(String); file=" + file );
+#endif
+ if ( File.Exists( file ) ) {
+ res[i].SetImage( Common.ImageFromFile( file ) );
+ }
+ }
+#if DEBUG
+ Common.DebugWriteLine( "Character3.FromXml()" );
+ for ( int i = 0; i < res.Count; i++ ) {
+ Common.DebugWriteLine( "i=" + i + "; title=" + res[i].title + "; (image==null)=" + (res[i].Image == null) );
+ }
+ Common.DebugWriteLine( "m_size=" + res.m_size );
+#endif
+ return res;
+ }
+
+ public static Character3 FromFile( string path ) {
+ Character3 res;
+ using ( FileStream fs = new FileStream( path, FileMode.Open ) ) {
+ BinaryFormatter bf = new BinaryFormatter();
+ res = (Character3)bf.Deserialize( fs );
+ }
+ return res;
+ }
+
+ ///
+ /// 隨ャ2荳紋サ」逶ョ縺ョCharacter縺九i縺ョ繧ウ繝ウ繝舌シ繝
+ ///
+ ///
+ ///
+ public Character3( Character character ) {
+ List basic = new List();
+ List another = new List();
+ string[] titles = new string[] { "base", "a", "aa", "i", "u", "e", "o", "xo", "nn" };
+
+ // z繧ェ繝シ繝繝シ繧呈峩譁ー縺励※縺翫¥
+ for ( int i = 0; i < character.Images.Count; i++ ) {
+ character.Images[i].Z = i;
+ }
+#if DEBUG
+ string t1 = "";
+ for ( int i = 0; i < character.Images.Count; i++ ) {
+ t1 += character.Images[i].ToString() + "\n";
+ }
+ System.Windows.Forms.MessageBox.Show( t1 );
+#endif
+ foreach ( string title in titles ) {
+ bool found = false;
+ foreach ( ImageEntry img in character.Images ) {
+ if ( img.title == title ) {
+ ImageEntry cp = new ImageEntry( img.title, null, img.tag, img.IsDefault, img.Z );
+ cp.SetImage( img.GetImage() );
+ basic.Add( cp );
+ found = true;
+ break;
+ }
+ }
+ if ( !found ) {
+ if ( title == "base" ) {
+ basic.Add( new ImageEntry( title, null, "base", true ) );
+ } else {
+ basic.Add( new ImageEntry( title, null, "mouth", false ) );
+ }
+ }
+ }
+
+ // another
+ foreach ( ImageEntry img in character.Images ) {
+ bool is_basic = false;
+ foreach ( string title in titles ) {
+ if ( img.title == title ) {
+ is_basic = true;
+ break;
+ }
+ }
+ if ( !is_basic ) {
+ ImageEntry cp = new ImageEntry( img.title, null, img.tag, img.IsDefault, img.Z );
+ cp.SetImage( img.GetImage() );
+ another.Add( cp );
+ }
+ }
+
+ m_name = character.Name;
+ m_basic = basic.ToArray();
+ m_another = new List( another.ToArray() );
+ m_size = character.m_size;
+ m_type = CharacterType.def;
+ m_author = "";
+ m_version = "";
+ m_updated = true;
+ //ZReorder();
+#if DEBUG
+ string t = "";
+ for ( int i = 0; i < m_basic.Length; i++ ) {
+ t += m_basic[i].ToString() + "\n";
+ }
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ t += m_another[i].ToString() + "\n";
+ }
+ System.Windows.Forms.MessageBox.Show( t );
+#endif
+ }
+
+ [XmlIgnore]
+ public Bitmap DefaultFace {
+ get {
+ List type = new List();
+ int count = -1;
+ foreach ( ImageEntry img in this ) {
+ count++;
+ if ( img.IsDefault ) {
+ type.Add( count );
+ }
+ }
+ return Face( type.ToArray() );
+ }
+ }
+
+ public IEnumerator GetEnumerator() {
+ for ( int i = 0; i < m_basic.Length; i++ ) {
+ yield return m_basic[i];
+ }
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ yield return m_another[i];
+ }
+ }
+
+ public Bitmap Face( int[] targets ) {
+ if ( Width <= 0 || Height <= 0 ) {
+ return null;
+ }
+
+ // z繧ェ繝シ繝繝シ鬆縺ォ謠冗判縺吶k逕サ蜒上r荳ヲ縺ケ譖ソ縺医k
+ int[] zorder = new int[targets.Length];
+ for ( int i = 0; i < targets.Length; i++ ) {
+ zorder[i] = this[targets[i]].Z;
+ }
+ bool c = true;
+ while ( c ) {
+ c = false;
+ for ( int i = 0; i < targets.Length - 1; i++ ) {
+ if ( zorder[i] > zorder[i + 1] ) {
+ int b = targets[i];
+ targets[i] = targets[i + 1];
+ targets[i + 1] = b;
+ b = zorder[i];
+ zorder[i] = zorder[i + 1];
+ zorder[i + 1] = b;
+ c = true;
+ }
+ }
+ if ( !c ) {
+ break;
+ }
+ }
+
+ // 蜑榊屓謠冗判縺励◆縺ョ縺ィ蜷後§謠冗判隕∵アゅ〒縺ゅl縺ー縲√く繝」繝繧キ繝・繧偵◎縺ョ縺セ縺セ霑斐☆
+ if ( m_cache != null && m_cache_draw != null ) {
+ if ( m_cache_draw.Length == targets.Length ) {
+ bool match = true;
+ for ( int i = 0; i < targets.Length; i++ ) {
+ if ( m_cache_draw[i] != targets[i] ) {
+ match = false;
+ break;
+ }
+ }
+ if ( match ) {
+ return (Bitmap)m_cache.Clone();
+ }
+ }
+ }
+ m_cache_draw = targets;
+
+ Bitmap bmp = new Bitmap( Width, Height );
+ using ( Graphics g = Graphics.FromImage( bmp ) ) {
+ for ( int i = 0; i < targets.Length; i++ ) {
+ ImageEntry img = this[targets[i]];
+ if ( img != null ) {
+ img.DrawTo( g );
+ }
+ }
+ }
+
+ if ( m_cache != null ) {
+ m_cache = null;
+ }
+ m_cache = (Bitmap)bmp.Clone();
+ return bmp;
+ }
+
+ public ImageEntry this[string title] {
+ get {
+ for ( int i = 0; i < m_basic.Length; i++ ) {
+ if ( m_basic[i].title == title ) {
+ return m_basic[i];
+ }
+ }
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ if ( m_another[i].title == title ) {
+ return m_another[i];
+ }
+ }
+ return null;
+ }
+ /*set {
+ for ( int i = 0; i < m_basic.Length; i++ ) {
+ if ( m_basic[i].title == title ) {
+ m_basic[i] = value;
+ }
+ }
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ if ( m_another[i].title == title ) {
+ m_another[i] = value;
+ }
+ }
+ }*/
+ }
+
+ public ImageEntry this[int zorder] {
+ get {
+ for ( int i = 0; i < m_basic.Length; i++ ) {
+ if ( m_basic[i].Z == zorder ) {
+ return m_basic[i];
+ }
+ }
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ if ( m_another[i].Z == zorder ) {
+ return m_another[i];
+ }
+ }
+ return null;
+ }
+ set {
+ for ( int i = 0; i < m_basic.Length; i++ ) {
+ if ( m_basic[i].Z == zorder ) {
+ m_basic[i] = value;
+ m_basic[i].Z = zorder;
+ return;
+ }
+ }
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ if ( m_another[i].Z == zorder ) {
+ m_another[i] = value;
+ m_another[i].Z = zorder;
+ return;
+ }
+ }
+ }
+ }
+
+ public Size Size {
+ get {
+ if ( m_type == CharacterType.def ) {
+ return m_size;
+ } else {
+ throw new NotImplementedException();
+ }
+ }
+ set {
+ m_size = value;
+ }
+ }
+
+ [XmlIgnore]
+ public int Width {
+ get {
+ return m_size.Width;
+ }
+ }
+
+ [XmlIgnore]
+ public int Height {
+ get {
+ return m_size.Height;
+ }
+ }
+
+ public object Clone() {
+ Character3 res = new Character3();
+ res.m_name = m_name;
+ res.m_author = m_author;
+ res.m_version = m_version;
+ res.m_type = m_type;
+ if ( m_plugin_config != null ) {
+ res.m_plugin_config = m_plugin_config.Clone();
+ }
+ for ( int i = 0; i < 9; i++ ) {
+ res.m_basic[i] = (ImageEntry)m_basic[i].Clone();
+ }
+ res.m_another.Clear();
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ res.m_another.Add( (ImageEntry)m_another[i].Clone() );
+ }
+ res.m_updated = m_updated;
+ res.m_size = m_size;
+ return res;
+ }
+
+ private Character3( string name, string author, string version, ImageEntry[] basic, ImageEntry[] another, bool is_build_in )
+ : this( name, author, version, basic, another ) {
+ m_is_build_in = is_build_in;
+ }
+
+ public Character3( string name, string author, string version, ImageEntry[] basic, ImageEntry[] another ) {
+ m_type = CharacterType.def;
+ m_name = name;
+ m_author = author;
+ m_version = version;
+ if ( basic.Length < 9 ) {
+ throw new ArgumentException( "basic.Length < 9" );
+ }
+ int z = -1;
+ for ( int i = 0; i < 9; i++ ) {
+ z++;
+ m_basic[i] = (ImageEntry)basic[i].Clone();
+ m_basic[i].Z = z;
+ }
+ if ( another != null ) {
+ m_another = new List( another );
+ } else {
+ m_another = new List();
+ }
+ for ( int i = 0; i < m_another.Count; i++ ) {
+ z++;
+ m_another[i].Z = z;
+ }
+ int width = 0;
+ int height = 0;
+ if ( basic != null ) {
+ foreach ( ImageEntry img in basic ) {
+ if ( img.Image != null ) {
+ width = Math.Max( width, img.Image.Width );
+ height = Math.Max( height, img.Image.Height );
+ }
+ }
+ }
+ if ( another != null ) {
+ foreach ( ImageEntry img in another ) {
+ if ( img.Image != null ) {
+ width = Math.Max( width, img.Image.Width );
+ height = Math.Max( height, img.Image.Height );
+ }
+ }
+ }
+ //ZReorder();
+ m_size = new Size( width, height );
+ m_updated = false;
+ }
+
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ縺ョ繧ソ繧、繝励r蜿門セ励@縺セ縺
+ ///
+ public CharacterType Type {
+ get {
+ return m_type;
+ }
+ }
+
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ縺ョ蜷咲ァー繧貞叙蠕励@縺セ縺
+ ///
+ public string Name {
+ get {
+ return m_name;
+ }
+ set {
+ m_name = value;
+ }
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/CharacterConfigCollection.cs b/trunk/LipSync/Editor/CharacterConfigCollection.cs
new file mode 100644
index 0000000..89b4d73
--- /dev/null
+++ b/trunk/LipSync/Editor/CharacterConfigCollection.cs
@@ -0,0 +1,136 @@
+サソ/*
+ * CharacterConfigCollection.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+
+namespace LipSync {
+
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ縺ョ繝ェ繧ケ繝医r邂。逅縺吶k繧ッ繝ゥ繧ケ
+ ///
+ public static class CharacterConfigCollection {
+
+ ///
+ /// 繝ェ繧ケ繝医ョ譛螟ァ髟キ
+ ///
+ const int MAX_DICT_LEN = 128;
+ static List m_list = new List();
+
+ ///
+ /// ID縺景d縺ァ縺ゅk繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ縺後Μ繧ケ繝医↓逋サ骭イ縺輔l縺ヲ縺繧九°縺ゥ縺縺九r霑斐@縺セ縺
+ ///
+ ///
+ ///
+ public static bool IsRegistered( string id ) {
+ foreach ( CharacterConfigSpecifier item in m_list ) {
+ if ( item.ID == id ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ ///
+ /// 迴セ蝨ィ縺ョ繝ェ繧ケ繝医ョ蜀螳ケ繧帝先ャ。霑斐☆iterator
+ ///
+ ///
+ public static IEnumerator GetEnumerator() {
+ foreach ( CharacterConfigSpecifier item in m_list ) {
+ yield return item;
+ }
+ yield break;
+ }
+
+
+ ///
+ /// 繝輔ぃ繧、繝ォ蜷阪′id縺ァ縺ゅk繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ縺ョ繝励Ξ繝薙Η繝シ繧定ソ斐@縺セ縺呻シ取悴逋サ骭イ縺ョ蝣エ蜷医ッnull繧定ソ斐@縺セ縺
+ ///
+ ///
+ ///
+ public static Image GetPreviewImage( string id ) {
+ foreach ( CharacterConfigSpecifier item in m_list ) {
+ if ( item.ID == id ) {
+ return item.Image;
+ }
+ }
+ return null;
+ }
+
+
+ ///
+ /// 繝輔ぃ繧、繝ォ蜷阪′file縺ァ縺ゅk繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ繧定ェュ縺ソ霎シ縺ソシ後Μ繧ケ繝医↓逋サ骭イ縺励∪縺呻シ
+ /// 譌「縺ォ逋サ骭イ貂医∩縺ァ縺ゅ▲縺ヲ繧ゑシ檎匳骭イ縺輔l縺滓凾轤ケ繧医j繝輔ぃ繧、繝ォ縺梧眠縺励¢繧後ーシ檎匳骭イ蜀螳ケ繧呈峩譁ー縺励∪縺
+ ///
+ ///
+ public static void Register( string file ) {
+#if DEBUG
+ Common.DebugWriteLine( "CharacterConfigCollection.Register(String); m_list.Count=" + m_list.Count );
+#endif
+ if ( !File.Exists( file ) ) {
+ return;
+ }
+ DateTime date = File.GetLastWriteTimeUtc( file );
+ DateTime date_registered = new DateTime();
+ int index = -1;
+ for( int i = 0; i < m_list.Count; i++ ){
+ if ( m_list[i].ID == file ) {
+ index = i;
+ date_registered = m_list[i].LastModefied;
+ break;
+ }
+ }
+
+ // Character, Character3繧ッ繝ゥ繧ケ繧定ェュ縺ソ霎シ繧薙〒シ檎匳骭イ
+ CharacterConfigSpecifier item = null;
+ if ( Path.GetFileName( file ).ToLower() == "content.xml" ) {
+ Character3 ch = Character3.FromXml( file );
+ item = new CharacterConfigSpecifier( ch, file, File.GetLastWriteTimeUtc( file ) );
+ } else {
+ try {
+ Character3 ch = Character3.FromFile( file );
+ item = new CharacterConfigSpecifier( ch, file, File.GetLastWriteTimeUtc( file ) );
+ } catch {
+ try {
+ Character t = LipSync.Character.FromFile( file );
+ item = new CharacterConfigSpecifier( t, file, File.GetLastWriteTimeUtc( file ) );
+ } catch {
+ item = new CharacterConfigSpecifier( file, File.GetLastWriteTimeUtc( file ) );
+ }
+ }
+ }
+ if ( item != null ) {
+#if DEBUG
+ string dir = Path.GetDirectoryName( file );
+ Common.GetThumbnailImage( item.Image, 128, 128 ).Save( Path.Combine( dir, Path.GetFileNameWithoutExtension( file ) ) + ".png" );
+#endif
+ if ( index >= 0 ) {
+ if ( date > date_registered ) {
+ m_list.RemoveAt( index );
+ if ( m_list.Count > MAX_DICT_LEN ) {
+ m_list.RemoveAt( 0 );
+ }
+ m_list.Add( item );
+ }
+ } else {
+ m_list.Add( item );
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/trunk/LipSync/Editor/CharacterConfigSpecifier.cs b/trunk/LipSync/Editor/CharacterConfigSpecifier.cs
new file mode 100644
index 0000000..bd52768
--- /dev/null
+++ b/trunk/LipSync/Editor/CharacterConfigSpecifier.cs
@@ -0,0 +1,95 @@
+サソ/*
+ * CharacterConfigSpecifier.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Drawing;
+
+namespace LipSync {
+
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ繧定ュ伜挨縺吶k縺溘a縺ョ繧ッ繝ゥ繧ケ
+ ///
+ public class CharacterConfigSpecifier {
+ Image m_preview;
+ string m_id;
+ DateTime m_last_modefied;
+
+ const int w = 256;
+ const int h = 256;
+
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ繧堤音螳壹☆繧紀Dシ朱壼クク縺ッ繝輔ぃ繧、繝ォ縺ク縺ョ繝輔Ν繝代せ
+ ///
+ public string ID {
+ get {
+ return m_id;
+ }
+ }
+
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ縺ョ譛邨よ峩譁ー譎ょ綾
+ ///
+ public DateTime LastModefied {
+ get {
+ return m_last_modefied;
+ }
+ }
+
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ縺ョ繝励Ξ繝薙Η繝シ
+ ///
+ public Image Image {
+ get {
+ return m_preview;
+ }
+ }
+
+ public CharacterConfigSpecifier( string id, DateTime date ) {
+ m_id = id;
+ m_last_modefied = date;
+ }
+
+ public CharacterConfigSpecifier( Character3 character, string id, DateTime date ) {
+ if ( character != null ) {
+ Bitmap bmp = character.DefaultFace;
+ Rectangle rc = Common.GetNonTransparentRegion( bmp );
+ using ( Bitmap t = new Bitmap( rc.Width, rc.Height ) )
+ using ( Graphics g = Graphics.FromImage( t ) ) {
+ g.DrawImage(
+ bmp,
+ 0, 0, rc, GraphicsUnit.Pixel );
+ m_preview = Common.GetThumbnailImage( t, w, h );
+ }
+ }
+ m_id = id;
+ m_last_modefied = date;
+ }
+
+ public CharacterConfigSpecifier( Character character, string id, DateTime date ) {
+ if ( character != null ) {
+ Bitmap bmp = character.DefaultFace;
+ Rectangle rc = Common.GetNonTransparentRegion( bmp );
+ using ( Bitmap t = new Bitmap( rc.Width, rc.Height ) )
+ using ( Graphics g = Graphics.FromImage( t ) ) {
+ g.DrawImage(
+ bmp,
+ 0, 0, rc, GraphicsUnit.Pixel );
+ m_preview = Common.GetThumbnailImage( t, w, h );
+ }
+ }
+ m_id = id;
+ m_last_modefied = date;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/ColorSet.cs b/trunk/LipSync/Editor/ColorSet.cs
new file mode 100644
index 0000000..3a24365
--- /dev/null
+++ b/trunk/LipSync/Editor/ColorSet.cs
@@ -0,0 +1,95 @@
+サソ/*
+ * ColorSet.cs
+ * Copyright (c) 2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Drawing;
+
+namespace LipSync {
+
+ public class ColorSet {
+ public int A = 255;
+ public int R;
+ public int G;
+ public int B;
+
+ public ColorSet( int alpha, int red, int green, int blue ) {
+ if ( red < 0 || 255 < red ) {
+ throw new ArgumentOutOfRangeException( "red" );
+ }
+ if ( green < 0 || 255 < green ) {
+ throw new ArgumentOutOfRangeException( "green" );
+ }
+ if ( blue < 0 || 255 < blue ) {
+ throw new ArgumentOutOfRangeException( "blue" );
+ }
+ if ( alpha < 0 || 255 < alpha ) {
+ throw new ArgumentOutOfRangeException( "alpha" );
+ }
+ R = red;
+ G = green;
+ B = blue;
+ A = alpha;
+ }
+
+ public ColorSet()
+ : this( 255, 255, 255, 255 ) {
+ }
+
+ public ColorSet( int red, int green, int blue )
+ : this( 255, red, green, blue ) {
+ }
+
+ public ColorSet( Color color )
+ : this( color.A, color.R, color.G, color.B ) {
+ }
+
+ public ColorSet( int alpha, ColorSet color )
+ : this( alpha, color.R, color.G, color.B ) {
+ }
+
+ public ColorSet( int alpha, Color color ) :
+ this( alpha, color.R, color.G, color.B ) {
+ }
+
+ public Color Color {
+ get {
+ return Color.FromArgb( A, R, G, B );
+ }
+ }
+
+ public override bool Equals( object obj ) {
+ return Equals( obj, false );
+ }
+
+ public bool Equals( object obj, bool ignore_alpha ) {
+ if ( obj is ColorSet ) {
+ ColorSet item = (ColorSet)obj;
+ if ( ignore_alpha ) {
+ return (item.R == R && item.G == G && item.B == B);
+ } else {
+ return (item.A == A && item.R == R && item.G == G && item.B == B);
+ }
+ } else if ( obj is Color ) {
+ Color item = (Color)obj;
+ if ( ignore_alpha ) {
+ return (item.R == R && item.G == G && item.B == B);
+ } else {
+ return (item.A == A && item.R == R && item.G == G && item.B == B);
+ }
+ } else {
+ return base.Equals( obj );
+ }
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/Command.cs b/trunk/LipSync/Editor/Command.cs
new file mode 100644
index 0000000..2d48d7e
--- /dev/null
+++ b/trunk/LipSync/Editor/Command.cs
@@ -0,0 +1,316 @@
+サソ/*
+ * Command.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Drawing;
+
+namespace LipSync {
+
+ public class Command {
+ public TimeTableType target;
+ public CommandType type;
+ public TimeTableEntry item;
+ public TimeTable table;
+ public TimeTableGroup tablegroup;
+ public Image image;
+ public Point position;
+ public int group;
+ public int track;
+ public int entry;
+ public string str;
+ public float floatValue;
+ public Size size;
+ public Telop telop;
+ public uint dwRate;
+ public uint dwScale;
+ public Color color;
+ public Command child;
+ public object[] args;
+
+ public static Command GCommandChangeBackgroundColor( Color color ){
+ Command ret = new Command();
+ ret.target = TimeTableType.whole;
+ ret.type = CommandType.changeBackgroundColor;
+ ret.color = color;
+ return ret;
+ }
+
+ public static Command GCommandAddTelop( Telop telop ) {
+ Command ret = new Command();
+ ret.target = TimeTableType.telop;
+ ret.type = CommandType.addTelop;
+ if ( telop != null ) {
+ ret.telop = (Telop)telop.Clone();
+ }
+ return ret;
+ }
+
+ public static Command GCommandAddTelopRange( Telop[] telops ) {
+ Command ret = new Command();
+ ret.target = TimeTableType.telop;
+ ret.type = CommandType.addTelopRange;
+ ret.args = new object[1];
+ Telop[] add = new Telop[telops.Length];
+ for ( int i = 0; i < add.Length; i++ ) {
+ add[i] = (Telop)telops[i].Clone();
+ }
+ ret.args[0] = add;
+ return ret;
+ }
+
+ public static Command GCommandEditTelop( int id, Telop telop ) {
+ Command ret = new Command();
+ ret.target = TimeTableType.telop;
+ ret.type = CommandType.editTelop;
+ ret.entry = id;
+ if ( telop != null ) {
+ ret.telop = (Telop)telop.Clone();
+ }
+ return ret;
+ }
+
+ public static Command GCommandDeleteTelop( Telop item ) {
+ Command ret = new Command();
+ ret.target = TimeTableType.telop;
+ ret.type = CommandType.deleteTelop;
+ ret.telop = (Telop)item.Clone();
+ return ret;
+ }
+
+ public static Command GCommandDeleteTelopRange( Telop[] items ) {
+ Command ret = new Command();
+ ret.target = TimeTableType.telop;
+ ret.type = CommandType.deleteTelopRange;
+ ret.args = new object[1];
+ Telop[] items2 = new Telop[items.Length];
+ for ( int i = 0; i < items2.Length; i++ ) {
+ items2[i] = (Telop)items[i].Clone();
+ }
+ ret.args[0] = items2;
+ return ret;
+ }
+
+ public static Command GCommandDeleteTimeTableGroup( TimeTableType target, int group ) {
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.deleteGroup;
+ ret.group = group;
+ return ret;
+ }
+
+ public static Command GCommandDeleteTimeTable( TimeTableType target, int group, int track ) {
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.deleteTimeTable;
+ ret.group = group;
+ ret.track = track;
+ return ret;
+ }
+
+ public static Command GCommandSetMp3( string file_name ){
+ Command ret = new Command();
+ ret.target = TimeTableType.whole;
+ ret.type = CommandType.setMP3;
+ ret.str = file_name;
+ return ret;
+ }
+
+ public static Command GCommandChangeVideoSize( Size size ){
+ Command ret = new Command();
+ ret.target = TimeTableType.whole;
+ ret.type = CommandType.changeVideoSize;
+ ret.size = size;
+ return ret;
+ }
+
+ public static Command GCommandShiftTimeTable( TimeTableType target, int track, float floatValue ){
+ Command ret = new Command();
+ ret.target = target;
+ if ( target == TimeTableType.character ) {
+ ret.group = track;
+ } else {
+ ret.track = track;
+ }
+ ret.type = CommandType.shiftTimeTable;
+ ret.floatValue = floatValue;
+ return ret;
+ }
+
+ public static Command GCommandChangeFps( uint rate, uint scale ){
+ Command ret = new Command();
+ ret.target = TimeTableType.whole;
+ ret.type = CommandType.changeFps;
+ ret.dwRate = rate;
+ ret.dwScale = scale;
+ return ret;
+ }
+
+ public static Command GCommandChangeScale( TimeTableType target, int group, int track, float scale ){
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.changeScale;
+ ret.group = group;
+ ret.track = track;
+ ret.floatValue = scale;
+ return ret;
+ }
+
+ public static Command GCommandChangePluginConfig( int track, string config ) {
+ Command ret = new Command();
+ ret.target = TimeTableType.whole;
+ ret.type = CommandType.changePluginConfig;
+ ret.track = track;
+ ret.str = config;
+ return ret;
+ }
+
+ public static Command GCommandSetAvi( int track, string file_name ){
+ Command ret = new Command();
+ ret.target = TimeTableType.another;
+ ret.type = CommandType.setAvi;
+ ret.track = track;
+ ret.str = file_name;
+ return ret;
+ }
+
+ public static Command GCommandEditTimeTableEntry( TimeTableType target, int group, int track, int entry, TimeTableEntry item ) {
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.editEntry;
+ ret.group = group;
+ ret.track = track;
+ ret.entry = entry;
+ if ( item != null ) {
+ ret.item = (TimeTableEntry)item.Clone();
+ }
+ return ret;
+ }
+
+ public static Command GCommandAddTimeTableEntry( TimeTableType target, int group, int track, TimeTableEntry item ) {
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.addEntry;
+ ret.group = group;
+ ret.track = track;
+ if ( item != null ) {
+ ret.item = (TimeTableEntry)item.Clone();
+ }
+ return ret;
+ }
+
+ public static Command GCommandDeleteTimeTableEntry( TimeTableType target, int group, int track, TimeTableEntry item ) {
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.deleteEntry;
+ ret.group = group;
+ ret.track = track;
+ if ( item != null ) {
+ ret.item = (TimeTableEntry)item.Clone();
+ }
+ return ret;
+ }
+
+ public static Command GCommandEditTimeTable( TimeTableType target, int group, int track, TimeTable table ) {
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.editTimeTable;
+ ret.group = group;
+ ret.track = track;
+ if ( table != null ) {
+ ret.table = (TimeTable)table.Clone();
+ }
+ return ret;
+ }
+
+ public static Command GCommandAddTimeTable( TimeTableType target, int group, int track, TimeTable table ){
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.addTimeTable;
+ ret.group = group;
+ ret.track = track;
+ if ( table != null ) {
+ ret.table = (TimeTable)table.Clone();
+ }
+ return ret;
+ }
+
+ public static Command GCommandEditGroup( TimeTableType target, int group, TimeTableGroup table_group ) {
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.editGroup;
+ ret.group = group;
+ ret.tablegroup = (TimeTableGroup)table_group.Clone();
+ return ret;
+ }
+
+ public static Command GCommandAddGroup( TimeTableType target, int group, TimeTableGroup tablegroup ){
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.addGroup;
+ ret.group = group;
+ if ( tablegroup != null ) {
+ ret.tablegroup = (TimeTableGroup)tablegroup.Clone();
+ } else {
+ ret.tablegroup = null;
+ }
+ return ret;
+ }
+
+ public static Command GCommandSetImage( int track, Image img ){
+ Command ret = new Command();
+ ret.target = TimeTableType.another;
+ ret.type = CommandType.setImage;
+ ret.track = track;
+ if ( img != null ) {
+ ret.image = (Image)img.Clone();
+ } else {
+ ret.image = null;
+ }
+ return ret;
+ }
+
+ public static Command GCommandSetPosition( TimeTableType target, int group, int track, Point position ){
+ Command ret = new Command();
+ ret.target = target;
+ ret.type = CommandType.setPosition;
+ ret.group = group;
+ ret.track = track;
+ ret.position = position;
+ return ret;
+ }
+
+ public static Command GCommandNothing() {
+ Command ret = new Command();
+ ret.target = TimeTableType.none;
+ return ret;
+ }
+
+ private Command() {
+ }
+
+ public override string ToString() {
+ string res = "";
+ res += target.ToString();
+ res += "," + type.ToString();
+ res += ",group=" + group + ",track=" + track + ";entry=" + entry;
+
+ if ( item == null ) {
+ res += ";item=null";
+ } else {
+ res += ";item={begin=" + item.begin + ",end=" + item.end + ",body=" + item.body;
+ }
+ return res;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/CommandType.cs b/trunk/LipSync/Editor/CommandType.cs
new file mode 100644
index 0000000..d921dba
--- /dev/null
+++ b/trunk/LipSync/Editor/CommandType.cs
@@ -0,0 +1,44 @@
+サソ/*
+ * CommandType.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+
+ public enum CommandType {
+ nothing,
+ addEntry,
+ deleteEntry,
+ editEntry,
+ addTimeTable,
+ deleteTimeTable,
+ editTimeTable,
+ addGroup, // CommandTarget == character縺ョ譎ゅョ縺ソ
+ editGroup, // CommandTarget == character縺ョ譎ゅョ縺ソ
+ deleteGroup, // CommandTarget == character縺ョ譎ゅョ縺ソ
+ setPosition,
+ setImage,
+ changePluginConfig,
+ changeFps,
+ changeVideoSize,
+ shiftTimeTable,
+ changeScale,
+ setMP3,
+ addTelop,
+ addTelopRange,
+ editTelop,
+ deleteTelop,
+ deleteTelopRange,
+ setAvi,
+ changeBackgroundColor,
+ }
+
+}
diff --git a/trunk/LipSync/Editor/DisplacementControl.cs b/trunk/LipSync/Editor/DisplacementControl.cs
new file mode 100644
index 0000000..73113ea
--- /dev/null
+++ b/trunk/LipSync/Editor/DisplacementControl.cs
@@ -0,0 +1,235 @@
+サソ/*
+ * DisplacementControl.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+using Boare.Lib.AppUtil;
+
+namespace LipSync {
+
+ public partial class DisplacementControl : Form, IMultiLanguageControl {
+ private PointF m_scaleandoffset_x = new PointF( 1f, 0f );
+ private PointF m_scaleandoffset_y = new PointF( 1f, 0f );
+ private PointF m_scaleandoffset_alpha = new PointF( 400f, 0.3f );
+ private PointF m_scaleandoffset_scale = new PointF( 40f, 0.5f );
+ private PointF m_scaleandoffset_rotate = new PointF( 1f, 0f );
+ private bool m_first_scaleandoffset = true;
+
+ public DisplacementControl() {
+ InitializeComponent();
+ ApplyFont( AppManager.Config.Font.GetFont() );
+ ApplyLanguage();
+ Rectangle r = AppManager.Config.CurveWindowPos;
+ Point pt_lt = new Point( r.Left, r.Top );
+ Point pt_lb = new Point( r.Left, r.Bottom );
+ Point pt_rt = new Point( r.Right, r.Top );
+ Point pt_rb = new Point( r.Right, r.Bottom );
+ bool visible = false;
+ foreach ( Screen s in Screen.AllScreens ) {
+ visible = visible | (IsInRectangle( pt_lt, s.Bounds ) | IsInRectangle( pt_lb, s.Bounds ) | IsInRectangle( pt_rt, s.Bounds ) | IsInRectangle( pt_rb, s.Bounds ));
+ }
+ if ( visible ) {
+ this.Left = r.Left;
+ this.Top = r.Top;
+ this.Width = r.Width;
+ this.Height = r.Height;
+ } else {
+ this.Width = Screen.PrimaryScreen.Bounds.Width / 2;
+ this.Height = Screen.PrimaryScreen.Bounds.Height / 2;
+ this.Left = this.Width / 2;
+ this.Top = this.Height / 2;
+ }
+ if ( AppManager.Config.CurveMaximized ) {
+ this.WindowState = FormWindowState.Maximized;
+ } else {
+ this.WindowState = FormWindowState.Normal;
+ }
+ this.SizeChanged += new EventHandler( DisplacementControl_LocationOrSizeChanged );
+ this.LocationChanged += new EventHandler( DisplacementControl_LocationOrSizeChanged );
+ }
+
+ ///
+ /// 縺ゥ縺ョ繧ォ繝シ繝悶b驕ク謚槭&繧後※縺縺ェ縺迥カ諷九↓縺励∪縺
+ ///
+ public void SetSelectedNone() {
+ curveEditor.Clear();
+ curveEditor.ClearBuffer();
+ comboObjects.SelectedIndex = -1;
+ }
+
+ ///
+ /// rect縺ョ荳ュ縺ォpoint縺悟・縺」縺ヲ縺繧九°縺ゥ縺縺九r蛻、螳
+ ///
+ ///
+ ///
+ ///
+ private static bool IsInRectangle( Point point, Rectangle rect ) {
+ if ( rect.X <= point.X && point.X <= rect.X + rect.Width ) {
+ if ( rect.Y <= point.Y && point.Y <= rect.Y + rect.Height ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void ApplyLanguage() {
+ this.Text = _( "Edit Motion Curve" );
+ menuClose.Text = _( "Close" ) + "(&C)";
+ menuFile.Text = _( "File" ) + "(&F)";
+ menuRedo.Text = _( "Redo" );
+ menuUndo.Text = _( "Undo" );
+ menuEdit.Text = _( "Edit" ) + "(&E)";
+
+ }
+
+ public void ApplyFont( Font font ) {
+ this.Font = font;
+ foreach ( Control c in this.Controls ) {
+ Boare.Lib.AppUtil.Misc.ApplyFontRecurse( c, font );
+ }
+ }
+
+ public static string _( string s ) {
+ return Messaging.GetMessage( s );
+ }
+
+ ///
+ /// 迴セ蝨ィ縺ョ邱ィ髮諠蝣ア繧堤エ譽縺励∪縺
+ ///
+ public void Clear() {
+ curveEditor.Clear();
+ comboObjects.Items.Clear();
+ comboObjects.Text = "";
+ }
+
+ private void DisplacementControl_FormClosing( object sender, FormClosingEventArgs e ) {
+ e.Cancel = true;
+ }
+
+ private void menuUndo_Click( object sender, EventArgs e ) {
+ curveEditor.Undo();
+ }
+
+ private void menuRedo_Click( object sender, EventArgs e ) {
+ curveEditor.Redo();
+ }
+
+ private void menuEdit_DropDownOpening( object sender, EventArgs e ) {
+ menuUndo.Enabled = curveEditor.IsUndoAvailable;
+ menuRedo.Enabled = curveEditor.IsRedoAvailable;
+ }
+
+ private void comboObjects_SelectedIndexChanged( object sender, EventArgs e ) {
+ int index = comboObjects.SelectedIndex;
+#if DEBUG
+ Console.WriteLine( "DisplacementControl+comboObjects_SelectedIndexChanged" );
+ Console.WriteLine( " index=" + index );
+#endif
+ if ( m_first_scaleandoffset ) {
+ float scale, offset;
+ if ( curveEditor.GetYScaleAndYOffset( "X", out scale, out offset ) ) {
+ m_scaleandoffset_x = new PointF( scale, offset );
+ }
+ if ( curveEditor.GetYScaleAndYOffset( "Y", out scale, out offset ) ) {
+ m_scaleandoffset_y = new PointF( scale, offset );
+ }
+ if ( curveEditor.GetYScaleAndYOffset( "Alpha", out scale, out offset ) ) {
+ m_scaleandoffset_alpha = new PointF( scale, offset );
+
+#if DEBUG
+ Console.WriteLine( "Alpha, scale=" + scale + "; offset=" + offset );
+#endif
+ }
+ if ( curveEditor.GetYScaleAndYOffset( "Scale", out scale, out offset ) ) {
+ m_scaleandoffset_scale = new PointF( scale, offset );
+ }
+ if ( curveEditor.GetYScaleAndYOffset( "Rotate", out scale, out offset ) ) {
+ m_scaleandoffset_rotate = new PointF( scale, offset );
+ }
+ }
+ curveEditor.Clear();
+ curveEditor.ClearBuffer();
+ if ( index >= 0 ) {
+ TagForTreeNode node = (TagForTreeNode)comboObjects.Items[index];
+ int id = node.id_or_index;
+ switch ( node.type ) {
+ case ZorderItemType.another:
+ curveEditor.Add( "X", AppManager.SaveData.m_group_another[id].mc_x );
+ curveEditor.Add( "Y", AppManager.SaveData.m_group_another[id].mc_y );
+ curveEditor.Add( "Alpha", AppManager.SaveData.m_group_another[id].mc_alpha );
+ curveEditor.Add( "Scale", AppManager.SaveData.m_group_another[id].mc_scale );
+ curveEditor.Add( "Roate", AppManager.SaveData.m_group_another[id].mc_rotate );
+ break;
+ case ZorderItemType.character:
+ curveEditor.Add( "X", AppManager.SaveData.m_groups_character[id].mc_x );
+ curveEditor.Add( "Y", AppManager.SaveData.m_groups_character[id].mc_y );
+ curveEditor.Add( "Alpha", AppManager.SaveData.m_groups_character[id].mc_alpha );
+ curveEditor.Add( "Scale", AppManager.SaveData.m_groups_character[id].mc_scale );
+ curveEditor.Add( "Roate", AppManager.SaveData.m_groups_character[id].mc_rotate );
+ break;
+ case ZorderItemType.plugin:
+ curveEditor.Add( "X", AppManager.SaveData.m_group_plugin[id].mc_x );
+ curveEditor.Add( "Y", AppManager.SaveData.m_group_plugin[id].mc_y );
+ curveEditor.Add( "Alpha", AppManager.SaveData.m_group_plugin[id].mc_alpha );
+ curveEditor.Add( "Scale", AppManager.SaveData.m_group_plugin[id].mc_scale );
+ curveEditor.Add( "Roate", AppManager.SaveData.m_group_plugin[id].mc_rotate );
+ break;
+ case ZorderItemType.telop:
+ curveEditor.Add( "X", AppManager.SaveData[id].mc_x );
+ curveEditor.Add( "Y", AppManager.SaveData[id].mc_y );
+ curveEditor.Add( "Alpha", AppManager.SaveData[id].mc_alpha );
+ curveEditor.Add( "Scale", AppManager.SaveData[id].mc_scale );
+ curveEditor.Add( "Roate", AppManager.SaveData[id].mc_rotate );
+ break;
+ }
+ curveEditor.SetYScaleAndYOffset( "X", m_scaleandoffset_x.X, m_scaleandoffset_x.Y );
+ curveEditor.SetYScaleAndYOffset( "Y", m_scaleandoffset_y.X, m_scaleandoffset_y.Y );
+ curveEditor.SetYScaleAndYOffset( "Alpha", m_scaleandoffset_alpha.X, m_scaleandoffset_alpha.Y );
+ curveEditor.SetYScaleAndYOffset( "Scale", m_scaleandoffset_scale.X, m_scaleandoffset_scale.Y );
+ curveEditor.SetYScaleAndYOffset( "Rotate", m_scaleandoffset_rotate.X, m_scaleandoffset_rotate.Y );
+ if ( m_first_scaleandoffset ) {
+ m_first_scaleandoffset = false;
+ }
+ curveEditor.Invalidate();
+ }
+ }
+
+ private void DisplacementControl_VisibleChanged( object sender, EventArgs e ) {
+ ApplyLanguage();
+ }
+
+ private void menuVisualNumericInput_CheckedChanged( object sender, EventArgs e ) {
+ this.Invalidate();
+ }
+
+ private void curveEditor_CurveEdited() {
+ AppManager.Edited = true;
+ }
+
+ private void DisplacementControl_LocationOrSizeChanged( object sender, EventArgs e ) {
+ if ( AppManager.Config != null ) {
+ if ( this.WindowState == FormWindowState.Normal ) {
+ AppManager.Config.CurveWindowPos = this.Bounds;
+ }
+ AppManager.Config.CurveMaximized = (this.WindowState == FormWindowState.Maximized);
+ }
+ }
+
+ private void menuClose_Click( object sender, EventArgs e ) {
+ this.Close();
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/DisplacementControl.designer.cs b/trunk/LipSync/Editor/DisplacementControl.designer.cs
new file mode 100644
index 0000000..2bfc5d7
--- /dev/null
+++ b/trunk/LipSync/Editor/DisplacementControl.designer.cs
@@ -0,0 +1,194 @@
+/*
+ * DisplacementControl.designer.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+
+ partial class DisplacementControl {
+ ///
+ /// 蠢隕√↑繝繧カ繧、繝雁、画焚縺ァ縺吶
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 菴ソ逕ィ荳ュ縺ョ繝ェ繧ス繝シ繧ケ繧偵☆縺ケ縺ヲ繧ッ繝ェ繝シ繝ウ繧「繝繝励@縺セ縺吶
+ ///
+ /// 繝槭ロ繝シ繧ク 繝ェ繧ス繝シ繧ケ縺檎エ譽縺輔l繧句エ蜷 true縲∫エ譽縺輔l縺ェ縺蝣エ蜷医ッ false 縺ァ縺吶
+ protected override void Dispose( bool disposing ) {
+ if ( disposing && (components != null) ) {
+ components.Dispose();
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows 繝輔か繝シ繝 繝繧カ繧、繝翫〒逕滓舌&繧後◆繧ウ繝シ繝
+
+ ///
+ /// 繝繧カ繧、繝 繧オ繝昴シ繝医↓蠢隕√↑繝。繧ス繝繝峨〒縺吶ゅ%縺ョ繝。繧ス繝繝峨ョ蜀螳ケ繧
+ /// 繧ウ繝シ繝 繧ィ繝繧」繧ソ縺ァ螟画峩縺励↑縺縺ァ縺上□縺輔>縲
+ ///
+ private void InitializeComponent() {
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.menuFile = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuClose = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuEdit = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuUndo = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuRedo = new System.Windows.Forms.ToolStripMenuItem();
+ this.comboObjects = new System.Windows.Forms.ComboBox();
+ this.curveEditor = new CurveEditor.CurveEditor();
+ this.menuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange( new System.Windows.Forms.ToolStripItem[] {
+ this.menuFile,
+ this.menuEdit} );
+ this.menuStrip1.Location = new System.Drawing.Point( 0, 0 );
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size( 557, 24 );
+ this.menuStrip1.TabIndex = 7;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // menuFile
+ //
+ this.menuFile.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] {
+ this.menuClose} );
+ this.menuFile.Name = "menuFile";
+ this.menuFile.Size = new System.Drawing.Size( 66, 20 );
+ this.menuFile.Text = "繝輔ぃ繧、繝ォ(&F)";
+ //
+ // menuClose
+ //
+ this.menuClose.Name = "menuClose";
+ this.menuClose.ShortcutKeys = System.Windows.Forms.Keys.F9;
+ this.menuClose.Size = new System.Drawing.Size( 152, 22 );
+ this.menuClose.Text = "髢峨§繧(&C)";
+ this.menuClose.Click += new System.EventHandler( this.menuClose_Click );
+ //
+ // menuEdit
+ //
+ this.menuEdit.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] {
+ this.menuUndo,
+ this.menuRedo} );
+ this.menuEdit.Name = "menuEdit";
+ this.menuEdit.Size = new System.Drawing.Size( 56, 20 );
+ this.menuEdit.Text = "邱ィ髮(&E)";
+ this.menuEdit.DropDownOpening += new System.EventHandler( this.menuEdit_DropDownOpening );
+ //
+ // menuUndo
+ //
+ this.menuUndo.Name = "menuUndo";
+ this.menuUndo.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
+ this.menuUndo.Size = new System.Drawing.Size( 192, 22 );
+ this.menuUndo.Text = "蜈縺ォ謌サ縺(&U)";
+ this.menuUndo.Click += new System.EventHandler( this.menuUndo_Click );
+ //
+ // menuRedo
+ //
+ this.menuRedo.Name = "menuRedo";
+ this.menuRedo.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
+ | System.Windows.Forms.Keys.Z)));
+ this.menuRedo.Size = new System.Drawing.Size( 192, 22 );
+ this.menuRedo.Text = "繧繧顔峩縺(&R)";
+ this.menuRedo.Click += new System.EventHandler( this.menuRedo_Click );
+ //
+ // comboObjects
+ //
+ this.comboObjects.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.comboObjects.FormattingEnabled = true;
+ this.comboObjects.Location = new System.Drawing.Point( 0, 24 );
+ this.comboObjects.Margin = new System.Windows.Forms.Padding( 0, 0, 0, 1 );
+ this.comboObjects.Name = "comboObjects";
+ this.comboObjects.Size = new System.Drawing.Size( 557, 20 );
+ this.comboObjects.TabIndex = 8;
+ this.comboObjects.SelectedIndexChanged += new System.EventHandler( this.comboObjects_SelectedIndexChanged );
+ //
+ // curveEditor1
+ //
+ this.curveEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.curveEditor.BackColor = System.Drawing.SystemColors.AppWorkspace;
+ this.curveEditor.ChangeXScaleWithWheel = true;
+ this.curveEditor.ChangeYScaleWithWheel = true;
+ this.curveEditor.ControlMaster = System.Drawing.Color.FromArgb( ((int)(((byte)(255)))), ((int)(((byte)(130)))), ((int)(((byte)(0)))) );
+ this.curveEditor.ControlNormal = System.Drawing.Color.FromArgb( ((int)(((byte)(51)))), ((int)(((byte)(192)))), ((int)(((byte)(64)))) );
+ this.curveEditor.ControlPointSize = 2;
+ this.curveEditor.ControlPointType = CurveEditor.PointType.Circle;
+ this.curveEditor.DataPoint = System.Drawing.Color.Black;
+ this.curveEditor.DataPointHilight = System.Drawing.Color.Red;
+ this.curveEditor.DataPointSize = 2;
+ this.curveEditor.DataPointType = CurveEditor.PointType.Circle;
+ this.curveEditor.HandleMaster = System.Drawing.Color.FromArgb( ((int)(((byte)(240)))), ((int)(((byte)(144)))), ((int)(((byte)(160)))) );
+ this.curveEditor.HandleNormal = System.Drawing.Color.FromArgb( ((int)(((byte)(255)))), ((int)(((byte)(130)))), ((int)(((byte)(0)))) );
+ this.curveEditor.LabelBackground = System.Drawing.Color.FromArgb( ((int)(((byte)(172)))), ((int)(((byte)(172)))), ((int)(((byte)(172)))) );
+ this.curveEditor.ListBackground = System.Drawing.Color.FromArgb( ((int)(((byte)(143)))), ((int)(((byte)(143)))), ((int)(((byte)(143)))) );
+ this.curveEditor.Location = new System.Drawing.Point( 0, 45 );
+ this.curveEditor.MainScaleLine = System.Drawing.Color.FromArgb( ((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44)))) );
+ this.curveEditor.Margin = new System.Windows.Forms.Padding( 0 );
+ this.curveEditor.MaxXScale = 100F;
+ this.curveEditor.MaxYScale = 1000F;
+ this.curveEditor.MinimumSize = new System.Drawing.Size( 100, 100 );
+ this.curveEditor.MinXScale = 1F;
+ this.curveEditor.MinYScale = 0.2F;
+ this.curveEditor.Name = "curveEditor1";
+ this.curveEditor.RescaleYEnabled = true;
+ this.curveEditor.ScaleLine = System.Drawing.Color.FromArgb( ((int)(((byte)(94)))), ((int)(((byte)(94)))), ((int)(((byte)(94)))) );
+ this.curveEditor.ScrollEnabled = true;
+ this.curveEditor.ShowList = true;
+ this.curveEditor.Size = new System.Drawing.Size( 557, 340 );
+ this.curveEditor.SubScaleLine = System.Drawing.Color.FromArgb( ((int)(((byte)(110)))), ((int)(((byte)(110)))), ((int)(((byte)(110)))) );
+ this.curveEditor.TabIndex = 6;
+ this.curveEditor.XLabel = CurveEditor.XLabel.Bottom;
+ this.curveEditor.XOffset = 0F;
+ this.curveEditor.XScale = 1F;
+ this.curveEditor.YLabel = CurveEditor.YLabel.Left;
+ this.curveEditor.YOffset = 0F;
+ this.curveEditor.YScale = 0.2F;
+ this.curveEditor.CurveEdited += new CurveEditor.CurveEditor.CurveEditedEventHandler( this.curveEditor_CurveEdited );
+ //
+ // DisplacementControl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.SystemColors.Control;
+ this.ClientSize = new System.Drawing.Size( 557, 385 );
+ this.Controls.Add( this.comboObjects );
+ this.Controls.Add( this.curveEditor );
+ this.Controls.Add( this.menuStrip1 );
+ this.MainMenuStrip = this.menuStrip1;
+ this.Name = "DisplacementControl";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
+ this.Text = "螟我ス阪ョ蛻カ蠕。";
+ this.VisibleChanged += new System.EventHandler( this.DisplacementControl_VisibleChanged );
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler( this.DisplacementControl_FormClosing );
+ this.menuStrip1.ResumeLayout( false );
+ this.menuStrip1.PerformLayout();
+ this.ResumeLayout( false );
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private CurveEditor.CurveEditor curveEditor;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem menuFile;
+ private System.Windows.Forms.ToolStripMenuItem menuEdit;
+ public System.Windows.Forms.ToolStripMenuItem menuUndo;
+ public System.Windows.Forms.ToolStripMenuItem menuRedo;
+ public System.Windows.Forms.ComboBox comboObjects;
+ private System.Windows.Forms.ToolStripMenuItem menuClose;
+ }
+}
diff --git a/trunk/LipSync/Editor/EditEntry.Designer.cs b/trunk/LipSync/Editor/EditEntry.Designer.cs
new file mode 100644
index 0000000..adb2a34
--- /dev/null
+++ b/trunk/LipSync/Editor/EditEntry.Designer.cs
@@ -0,0 +1,207 @@
+/*
+ * EditEntry.Designer.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+
+ partial class EditEntry {
+ ///
+ /// 蠢隕√↑繝繧カ繧、繝雁、画焚縺ァ縺吶
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 菴ソ逕ィ荳ュ縺ョ繝ェ繧ス繝シ繧ケ繧偵☆縺ケ縺ヲ繧ッ繝ェ繝シ繝ウ繧「繝繝励@縺セ縺吶
+ ///
+ /// 繝槭ロ繝シ繧ク 繝ェ繧ス繝シ繧ケ縺檎エ譽縺輔l繧句エ蜷 true縲∫エ譽縺輔l縺ェ縺蝣エ蜷医ッ false 縺ァ縺吶
+ protected override void Dispose( bool disposing ) {
+ if ( disposing && (components != null) ) {
+ components.Dispose();
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows 繝輔か繝シ繝 繝繧カ繧、繝翫〒逕滓舌&繧後◆繧ウ繝シ繝
+
+ ///
+ /// 繝繧カ繧、繝 繧オ繝昴シ繝医↓蠢隕√↑繝。繧ス繝繝峨〒縺吶ゅ%縺ョ繝。繧ス繝繝峨ョ蜀螳ケ繧
+ /// 繧ウ繝シ繝 繧ィ繝繧」繧ソ縺ァ螟画峩縺励↑縺縺ァ縺上□縺輔>縲
+ ///
+ private void InitializeComponent() {
+ this.lblOnTime = new System.Windows.Forms.Label();
+ this.lblOffTime = new System.Windows.Forms.Label();
+ this.txtStart = new System.Windows.Forms.TextBox();
+ this.txtEnd = new System.Windows.Forms.TextBox();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.txtMinStart = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.txtMaxEnd = new System.Windows.Forms.TextBox();
+ this.btnUseThisValue = new System.Windows.Forms.Button();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.groupBox1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // lblOnTime
+ //
+ this.lblOnTime.AutoSize = true;
+ this.lblOnTime.Location = new System.Drawing.Point( 12, 20 );
+ this.lblOnTime.Name = "lblOnTime";
+ this.lblOnTime.Size = new System.Drawing.Size( 69, 12 );
+ this.lblOnTime.TabIndex = 0;
+ this.lblOnTime.Text = "ON譎ょ綾 (遘)";
+ //
+ // lblOffTime
+ //
+ this.lblOffTime.AutoSize = true;
+ this.lblOffTime.Location = new System.Drawing.Point( 12, 53 );
+ this.lblOffTime.Name = "lblOffTime";
+ this.lblOffTime.Size = new System.Drawing.Size( 75, 12 );
+ this.lblOffTime.TabIndex = 1;
+ this.lblOffTime.Text = "OFF譎ょ綾 (遘)";
+ //
+ // txtStart
+ //
+ this.txtStart.Location = new System.Drawing.Point( 109, 17 );
+ this.txtStart.Name = "txtStart";
+ this.txtStart.Size = new System.Drawing.Size( 100, 19 );
+ this.txtStart.TabIndex = 0;
+ this.txtStart.Text = "0";
+ this.txtStart.TextChanged += new System.EventHandler( this.txtStart_TextChanged );
+ this.txtStart.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler( this.txtStart_PreviewKeyDown );
+ this.txtStart.KeyPress += new System.Windows.Forms.KeyPressEventHandler( this.txtStart_KeyPress );
+ //
+ // txtEnd
+ //
+ this.txtEnd.Location = new System.Drawing.Point( 109, 50 );
+ this.txtEnd.Name = "txtEnd";
+ this.txtEnd.Size = new System.Drawing.Size( 100, 19 );
+ this.txtEnd.TabIndex = 1;
+ this.txtEnd.Text = "0";
+ this.txtEnd.TextChanged += new System.EventHandler( this.txtEnd_TextChanged );
+ this.txtEnd.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler( this.txtEnd_PreviewKeyDown );
+ this.txtEnd.KeyPress += new System.Windows.Forms.KeyPressEventHandler( this.txtEnd_KeyPress );
+ //
+ // btnCancel
+ //
+ this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Location = new System.Drawing.Point( 229, 171 );
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size( 75, 23 );
+ this.btnCancel.TabIndex = 7;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ //
+ // btnOK
+ //
+ this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnOK.Location = new System.Drawing.Point( 131, 171 );
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size( 75, 23 );
+ this.btnOK.TabIndex = 6;
+ this.btnOK.Text = "OK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler( this.btnOK_Click );
+ //
+ // txtMinStart
+ //
+ this.txtMinStart.Location = new System.Drawing.Point( 18, 26 );
+ this.txtMinStart.Name = "txtMinStart";
+ this.txtMinStart.ReadOnly = true;
+ this.txtMinStart.Size = new System.Drawing.Size( 63, 19 );
+ this.txtMinStart.TabIndex = 3;
+ this.txtMinStart.Text = "0";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point( 87, 29 );
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size( 17, 12 );
+ this.label3.TabIndex = 9;
+ this.label3.Text = "ス";
+ //
+ // txtMaxEnd
+ //
+ this.txtMaxEnd.Location = new System.Drawing.Point( 110, 26 );
+ this.txtMaxEnd.Name = "txtMaxEnd";
+ this.txtMaxEnd.ReadOnly = true;
+ this.txtMaxEnd.Size = new System.Drawing.Size( 63, 19 );
+ this.txtMaxEnd.TabIndex = 4;
+ this.txtMaxEnd.Text = "0";
+ //
+ // btnUseThisValue
+ //
+ this.btnUseThisValue.Location = new System.Drawing.Point( 188, 24 );
+ this.btnUseThisValue.Name = "btnUseThisValue";
+ this.btnUseThisValue.Size = new System.Drawing.Size( 89, 23 );
+ this.btnUseThisValue.TabIndex = 5;
+ this.btnUseThisValue.Text = "縺薙ョ蛟、繧剃スソ縺";
+ this.btnUseThisValue.UseVisualStyleBackColor = true;
+ this.btnUseThisValue.Click += new System.EventHandler( this.btnUseThisValue_Click );
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add( this.btnUseThisValue );
+ this.groupBox1.Controls.Add( this.txtMinStart );
+ this.groupBox1.Controls.Add( this.txtMaxEnd );
+ this.groupBox1.Controls.Add( this.label3 );
+ this.groupBox1.Location = new System.Drawing.Point( 12, 84 );
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size( 293, 69 );
+ this.groupBox1.TabIndex = 2;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "螟画峩蜿ッ閭ス縺ェ蛟、縺ョ遽蝗イ";
+ //
+ // EditEntry
+ //
+ this.AcceptButton = this.btnOK;
+ this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size( 319, 211 );
+ this.Controls.Add( this.groupBox1 );
+ this.Controls.Add( this.btnCancel );
+ this.Controls.Add( this.btnOK );
+ this.Controls.Add( this.txtEnd );
+ this.Controls.Add( this.txtStart );
+ this.Controls.Add( this.lblOffTime );
+ this.Controls.Add( this.lblOnTime );
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "EditEntry";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "謨ー蛟、蜈・蜉";
+ this.groupBox1.ResumeLayout( false );
+ this.groupBox1.PerformLayout();
+ this.ResumeLayout( false );
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lblOnTime;
+ private System.Windows.Forms.Label lblOffTime;
+ private System.Windows.Forms.TextBox txtStart;
+ private System.Windows.Forms.TextBox txtEnd;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.TextBox txtMinStart;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.TextBox txtMaxEnd;
+ private System.Windows.Forms.Button btnUseThisValue;
+ private System.Windows.Forms.GroupBox groupBox1;
+ }
+}
diff --git a/trunk/LipSync/Editor/EditEntry.cs b/trunk/LipSync/Editor/EditEntry.cs
new file mode 100644
index 0000000..76f4f46
--- /dev/null
+++ b/trunk/LipSync/Editor/EditEntry.cs
@@ -0,0 +1,178 @@
+サソ/*
+ * EditEntry.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+using Boare.Lib.AppUtil;
+
+namespace LipSync {
+
+ public partial class EditEntry : Form, IMultiLanguageControl {
+ private float m_start;
+ private float m_end;
+ private float m_min_start;
+ private float m_max_end;
+ ///
+ /// On time縺後ユ繧ュ繧ケ繝医懊ャ繧ッ繧ケ縺ォ繧医▲縺ヲ邱ィ髮縺輔l縺溘°縺ゥ縺縺
+ ///
+ private bool m_start_edited = false;
+ ///
+ /// Off time縺後ユ繧ュ繧ケ繝医懊ャ繧ッ繧ケ縺ォ繧医▲縺ヲ邱ィ髮縺輔l縺溘°縺ゥ縺縺
+ ///
+ private bool m_end_edited = false;
+
+ public EditEntry( float start, float end, float min_start, float max_end ) {
+ InitializeComponent();
+ ApplyLanguage();
+ ApplyFont( AppManager.Config.Font.GetFont() );
+ txtStart.Text = start.ToString();
+ txtEnd.Text = end.ToString();
+ txtMinStart.Text = min_start.ToString();
+ txtMaxEnd.Text = max_end.ToString();
+ m_min_start = min_start;
+ m_max_end = max_end;
+ m_start_edited = false;
+ m_end_edited = false;
+ }
+
+ public void ApplyFont( Font font ) {
+ this.Font = font;
+ foreach ( Control c in this.Controls ) {
+ Boare.Lib.AppUtil.Misc.ApplyFontRecurse( c, font );
+ }
+ }
+
+ public void ApplyLanguage() {
+ this.lblOnTime.Text = _( "ON time (sec)" );
+ this.lblOffTime.Text = _( "OFF time (sec)" );
+ this.btnCancel.Text = _( "Cancel" );
+ this.btnOK.Text = _( "OK" );
+ this.btnUseThisValue.Text = _( "Use this value" );
+ this.groupBox1.Text = _( "Expandable range of this entry" );
+ this.Text = _( "Numeric entry" );
+ }
+
+ public static string _( string s ) {
+ return Messaging.GetMessage( s );
+ }
+
+ public float Start {
+ get {
+ return m_start;
+ }
+ }
+
+ public float End {
+ get {
+ return m_end;
+ }
+ }
+
+ private void btnOK_Click( object sender, EventArgs e ) {
+ /*if ( !m_start_edited ) {
+ m_start = m_start;
+ }
+ if ( !m_end_edited ) {
+ m_end = m_end;
+ }*/
+ if ( m_start >= m_end || m_start < m_min_start || m_max_end < m_end ) {
+ MessageBox.Show( _( "Invalid value has been entered" ), _( "Error" ), MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
+ this.DialogResult = DialogResult.Cancel;
+ } else {
+ this.DialogResult = (!m_end_edited && !m_start_edited) ? DialogResult.Cancel : DialogResult.OK;
+ }
+ this.Close();
+ }
+
+ private void btnUseThisValue_Click( object sender, EventArgs e ) {
+ if ( m_start != m_min_start || m_end != m_max_end ) {
+ txtStart.Text = m_min_start.ToString();
+ txtEnd.Text = m_max_end.ToString();
+ m_start = m_min_start;
+ m_end = m_max_end;
+ m_end_edited = true;
+ m_start_edited = true;
+ }
+ }
+
+ private void txtStart_TextChanged( object sender, EventArgs e ) {
+ float old_begin = m_start;
+ m_start_edited = true;
+ try {
+ m_start = float.Parse( txtStart.Text );
+ } catch ( Exception ex ) {
+ m_start = old_begin;
+ txtStart.Text = m_start.ToString();
+ txtStart.SelectAll();
+ Common.LogPush( ex );
+ }
+ }
+
+ private void txtEnd_TextChanged( object sender, EventArgs e ) {
+ float old_end = m_end;
+ m_end_edited = true;
+ try {
+ m_end = float.Parse( txtEnd.Text );
+ } catch ( Exception ex ) {
+ m_end = old_end;
+ txtEnd.Text = m_end.ToString();
+ txtEnd.SelectAll();
+ }
+ }
+
+ private void txtStart_KeyPress( object sender, KeyPressEventArgs e ) {
+ if ( (e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b' && e.KeyChar != '.' ) {
+ e.Handled = true;
+ }
+ }
+
+ private void txtEnd_KeyPress( object sender, KeyPressEventArgs e ) {
+ if ( (e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b' && e.KeyChar != '.' ) {
+ e.Handled = true;
+ }
+ }
+
+ private void txtStart_PreviewKeyDown( object sender, PreviewKeyDownEventArgs e ) {
+ if ( (e.Modifiers & Keys.Control) == Keys.Control ) {
+ if ( (e.KeyCode & Keys.X) == Keys.X ) {
+ Clipboard.SetText( txtStart.Text );
+ txtStart.Text = "";
+ } else if ( (e.KeyCode & Keys.C) == Keys.C ) {
+ Clipboard.SetText( txtStart.Text );
+ } else if ( (e.KeyCode & Keys.V) == Keys.V ) {
+ if ( Clipboard.ContainsText() ) {
+ txtStart.Text = Clipboard.GetText();
+ }
+ }
+ }
+ }
+
+ private void txtEnd_PreviewKeyDown( object sender, PreviewKeyDownEventArgs e ) {
+ if ( (e.Modifiers & Keys.Control) == Keys.Control ) {
+ if ( (e.KeyCode & Keys.X) == Keys.X ) {
+ Clipboard.SetText( txtEnd.Text );
+ txtEnd.Text = "";
+ } else if ( (e.KeyCode & Keys.C) == Keys.C ) {
+ Clipboard.SetText( txtEnd.Text );
+ } else if ( (e.KeyCode & Keys.V) == Keys.V ) {
+ if ( Clipboard.ContainsText() ) {
+ txtEnd.Text = Clipboard.GetText();
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/EditMode.cs b/trunk/LipSync/Editor/EditMode.cs
new file mode 100644
index 0000000..6d6f036
--- /dev/null
+++ b/trunk/LipSync/Editor/EditMode.cs
@@ -0,0 +1,43 @@
+サソ/*
+ * EditMode.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+
+ enum EditMode {
+ ///
+ /// 繝繝輔か繝ォ繝医ゆス輔b邱ィ髮縺励※辟。縺
+ ///
+ None,
+ ///
+ /// 繧ィ繝ウ繝医Μ縺碁∈謚槭&繧後※繧九□縺代ョ迥カ諷
+ ///
+ Selected,
+ ///
+ /// 繧ィ繝ウ繝医Μ縺ョ蜿ウ遶ッ繧偵ラ繝ゥ繝繧ー縺励※邨ゆコ譎ょ綾繧堤キィ髮縺吶k繝「繝シ繝
+ ///
+ EditingRight,
+ ///
+ /// 繧ィ繝ウ繝医Μ縺ョ蟾ヲ遶ッ繧偵ラ繝ゥ繝繧ー縺励※髢句ァ区凾蛻サ繧堤キィ髮縺吶k繝「繝シ繝
+ ///
+ EditingLeft,
+ ///
+ /// 繧ソ繧、繝繝ゥ繧、繝ウ荳翫ョ蟾ヲ繝懊ち繝ウ繝峨Λ繝繧ー縺ォ繧医j繧ィ繝ウ繝医Μ繧定ソス蜉縺吶k繝「繝シ繝
+ ///
+ Dragging,
+ ///
+ /// 繧ィ繝ウ繝医Μ繧偵ラ繝ゥ繝繧ー縺励※繧ケ繝ゥ繧、繝峨&縺帙k繝「繝シ繝
+ ///
+ Sliding,
+ }
+
+}
diff --git a/trunk/LipSync/Editor/EditingBounds.cs b/trunk/LipSync/Editor/EditingBounds.cs
new file mode 100644
index 0000000..5a6e95c
--- /dev/null
+++ b/trunk/LipSync/Editor/EditingBounds.cs
@@ -0,0 +1,76 @@
+サソ/*
+ * EditingBounds.cs
+ * Copyright (c) 2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Drawing;
+
+namespace LipSync {
+
+ public class EditingBounds {
+ private Rectangle m_rect;
+ private bool m_fixed;
+ public bool XFixed;
+ public bool YFixed;
+
+ public EditingBounds() {
+ m_rect = new Rectangle();
+ m_fixed = false;
+ XFixed = false;
+ YFixed = false;
+ }
+
+ public EditingBounds( Rectangle bounds, bool item_fixed, bool x_fixed, bool y_fixed ) {
+ m_rect = bounds;
+ m_fixed = item_fixed;
+ XFixed = x_fixed;
+ YFixed = y_fixed;
+ }
+
+ public int X {
+ get {
+ return m_rect.X;
+ }
+ }
+
+ public int Y {
+ get {
+ return m_rect.Y;
+ }
+ }
+
+ public int Width {
+ get {
+ return m_rect.Width;
+ }
+ }
+
+ public int Height {
+ get {
+ return m_rect.Height;
+ }
+ }
+
+ public bool Fixed {
+ get {
+ return m_fixed;
+ }
+ }
+
+ public Rectangle Bounds {
+ get {
+ return m_rect;
+ }
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/EnvConfiguration.Designer.cs b/trunk/LipSync/Editor/EnvConfiguration.Designer.cs
new file mode 100644
index 0000000..5e63cb2
--- /dev/null
+++ b/trunk/LipSync/Editor/EnvConfiguration.Designer.cs
@@ -0,0 +1,871 @@
+サソ/*
+ * EnvConfiguration.Designer.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+namespace LipSync {
+
+ partial class EnvConfiguration {
+ ///
+ /// 蠢隕√↑繝繧カ繧、繝雁、画焚縺ァ縺吶
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 菴ソ逕ィ荳ュ縺ョ繝ェ繧ス繝シ繧ケ繧偵☆縺ケ縺ヲ繧ッ繝ェ繝シ繝ウ繧「繝繝励@縺セ縺吶
+ ///
+ /// 繝槭ロ繝シ繧ク 繝ェ繧ス繝シ繧ケ縺檎エ譽縺輔l繧句エ蜷 true縲∫エ譽縺輔l縺ェ縺蝣エ蜷医ッ false 縺ァ縺吶
+ protected override void Dispose( bool disposing ) {
+ if ( disposing && (components != null) ) {
+ components.Dispose();
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows 繝輔か繝シ繝 繝繧カ繧、繝翫〒逕滓舌&繧後◆繧ウ繝シ繝
+
+ ///
+ /// 繝繧カ繧、繝 繧オ繝昴シ繝医↓蠢隕√↑繝。繧ス繝繝峨〒縺吶ゅ%縺ョ繝。繧ス繝繝峨ョ蜀螳ケ繧
+ /// 繧ウ繝シ繝 繧ィ繝繧」繧ソ縺ァ螟画峩縺励↑縺縺ァ縺上□縺輔>縲
+ ///
+ private void InitializeComponent() {
+ this.btnOK = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.comboLanguage = new System.Windows.Forms.ComboBox();
+ this.tabControl1 = new System.Windows.Forms.TabControl();
+ this.tabUserConfig = new System.Windows.Forms.TabPage();
+ this.groupControl = new System.Windows.Forms.GroupBox();
+ this.chkSyncAtCenter = new System.Windows.Forms.CheckBox();
+ this.lblWheelRatio = new System.Windows.Forms.Label();
+ this.btnWheelRatioDefault = new System.Windows.Forms.Button();
+ this.groupLanguage = new System.Windows.Forms.GroupBox();
+ this.btnReloadLanguageConfig = new System.Windows.Forms.Button();
+ this.tabAppearance = new System.Windows.Forms.TabPage();
+ this.groupDesign = new System.Windows.Forms.GroupBox();
+ this.btnFontDefault = new System.Windows.Forms.Button();
+ this.lblFontName = new System.Windows.Forms.Label();
+ this.lblFont = new System.Windows.Forms.Label();
+ this.btnChangeFont = new System.Windows.Forms.Button();
+ this.lblEntryHeight = new System.Windows.Forms.Label();
+ this.btnEntryHeightDefault = new System.Windows.Forms.Button();
+ this.groupColor = new System.Windows.Forms.GroupBox();
+ this.lblTimeLineTitle = new System.Windows.Forms.Label();
+ this.lblTimelineTitleColor = new System.Windows.Forms.Label();
+ this.btnChangeTimeLineTitle = new System.Windows.Forms.Button();
+ this.btnTimeLineTitleDefault = new System.Windows.Forms.Button();
+ this.lblTimeLineVSQ = new System.Windows.Forms.Label();
+ this.btnTimeLineDefaultDefault = new System.Windows.Forms.Button();
+ this.lblTimeLineVSQColor = new System.Windows.Forms.Label();
+ this.btnChangeTimeLineDefault = new System.Windows.Forms.Button();
+ this.btnChangeTimeLineVSQ = new System.Windows.Forms.Button();
+ this.lblTimeLineDefaultColor = new System.Windows.Forms.Label();
+ this.btnTimeLineVSQDefault = new System.Windows.Forms.Button();
+ this.lblTimeLineDefault = new System.Windows.Forms.Label();
+ this.lblTimeLinePlugin = new System.Windows.Forms.Label();
+ this.btnTimeLinePluginDefault = new System.Windows.Forms.Button();
+ this.lblTimeLinePluginColor = new System.Windows.Forms.Label();
+ this.btnChangeTimeLinePlugin = new System.Windows.Forms.Button();
+ this.tabLipSync = new System.Windows.Forms.TabPage();
+ this.groupSerialVowel = new System.Windows.Forms.GroupBox();
+ this.txtCombineThreshold = new System.Windows.Forms.TextBox();
+ this.lblCombineThreshold = new System.Windows.Forms.Label();
+ this.chkSerialVowel = new System.Windows.Forms.CheckBox();
+ this.groupPhoneticSymbol = new System.Windows.Forms.GroupBox();
+ this.tabSystem = new System.Windows.Forms.TabPage();
+ this.groupAnotherBehavior = new System.Windows.Forms.GroupBox();
+ this.chkHeavyOpenCharacterDialog = new System.Windows.Forms.CheckBox();
+ this.chkGenCharacterAutomaticaly = new System.Windows.Forms.CheckBox();
+ this.groupEncoder = new System.Windows.Forms.GroupBox();
+ this.txtFFmpeg = new System.Windows.Forms.TextBox();
+ this.lblFFmpeg = new System.Windows.Forms.Label();
+ this.btnMEncoder = new System.Windows.Forms.Button();
+ this.txtMEncoder = new System.Windows.Forms.TextBox();
+ this.btnFFmpeg = new System.Windows.Forms.Button();
+ this.lblMEncoder = new System.Windows.Forms.Label();
+ this.colorDialog1 = new System.Windows.Forms.ColorDialog();
+ this.fontDialog = new System.Windows.Forms.FontDialog();
+ this.numWheelRatio = new LipSync.NumericUpDownEx();
+ this.numEntryHeight = new LipSync.NumericUpDownEx();
+ this.mListClose = new LipSync.MListView();
+ this.mListU = new LipSync.MListView();
+ this.mListI = new LipSync.MListView();
+ this.tabControl1.SuspendLayout();
+ this.tabUserConfig.SuspendLayout();
+ this.groupControl.SuspendLayout();
+ this.groupLanguage.SuspendLayout();
+ this.tabAppearance.SuspendLayout();
+ this.groupDesign.SuspendLayout();
+ this.groupColor.SuspendLayout();
+ this.tabLipSync.SuspendLayout();
+ this.groupSerialVowel.SuspendLayout();
+ this.groupPhoneticSymbol.SuspendLayout();
+ this.tabSystem.SuspendLayout();
+ this.groupAnotherBehavior.SuspendLayout();
+ this.groupEncoder.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numWheelRatio)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numEntryHeight)).BeginInit();
+ this.SuspendLayout();
+ //
+ // btnOK
+ //
+ this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnOK.Location = new System.Drawing.Point( 182, 421 );
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size( 71, 24 );
+ this.btnOK.TabIndex = 13;
+ this.btnOK.Text = "OK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler( this.btnOK_Click );
+ //
+ // btnCancel
+ //
+ this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Location = new System.Drawing.Point( 285, 421 );
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size( 71, 24 );
+ this.btnCancel.TabIndex = 14;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ //
+ // comboLanguage
+ //
+ this.comboLanguage.FormattingEnabled = true;
+ this.comboLanguage.Location = new System.Drawing.Point( 15, 28 );
+ this.comboLanguage.Name = "comboLanguage";
+ this.comboLanguage.Size = new System.Drawing.Size( 121, 20 );
+ this.comboLanguage.TabIndex = 1;
+ this.comboLanguage.SelectedIndexChanged += new System.EventHandler( this.comboLanguage_SelectedIndexChanged );
+ //
+ // tabControl1
+ //
+ this.tabControl1.Controls.Add( this.tabUserConfig );
+ this.tabControl1.Controls.Add( this.tabAppearance );
+ this.tabControl1.Controls.Add( this.tabLipSync );
+ this.tabControl1.Controls.Add( this.tabSystem );
+ this.tabControl1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.tabControl1.Location = new System.Drawing.Point( 0, 0 );
+ this.tabControl1.Margin = new System.Windows.Forms.Padding( 0 );
+ this.tabControl1.Name = "tabControl1";
+ this.tabControl1.SelectedIndex = 0;
+ this.tabControl1.Size = new System.Drawing.Size( 409, 402 );
+ this.tabControl1.TabIndex = 0;
+ //
+ // tabUserConfig
+ //
+ this.tabUserConfig.BackColor = System.Drawing.SystemColors.Control;
+ this.tabUserConfig.Controls.Add( this.groupControl );
+ this.tabUserConfig.Controls.Add( this.groupLanguage );
+ this.tabUserConfig.Location = new System.Drawing.Point( 4, 21 );
+ this.tabUserConfig.Name = "tabUserConfig";
+ this.tabUserConfig.Padding = new System.Windows.Forms.Padding( 3 );
+ this.tabUserConfig.Size = new System.Drawing.Size( 401, 377 );
+ this.tabUserConfig.TabIndex = 0;
+ this.tabUserConfig.Text = "繝ヲ繝シ繧カ繝シ險ュ螳";
+ this.tabUserConfig.UseVisualStyleBackColor = true;
+ //
+ // groupControl
+ //
+ this.groupControl.Controls.Add( this.chkSyncAtCenter );
+ this.groupControl.Controls.Add( this.lblWheelRatio );
+ this.groupControl.Controls.Add( this.btnWheelRatioDefault );
+ this.groupControl.Controls.Add( this.numWheelRatio );
+ this.groupControl.Location = new System.Drawing.Point( 10, 79 );
+ this.groupControl.Name = "groupControl";
+ this.groupControl.Size = new System.Drawing.Size( 381, 100 );
+ this.groupControl.TabIndex = 30;
+ this.groupControl.TabStop = false;
+ this.groupControl.Text = "謫堺ス";
+ //
+ // chkSyncAtCenter
+ //
+ this.chkSyncAtCenter.AutoSize = true;
+ this.chkSyncAtCenter.Location = new System.Drawing.Point( 24, 56 );
+ this.chkSyncAtCenter.Name = "chkSyncAtCenter";
+ this.chkSyncAtCenter.Size = new System.Drawing.Size( 199, 16 );
+ this.chkSyncAtCenter.TabIndex = 16;
+ this.chkSyncAtCenter.Text = "Fix cursor to center in Sync mode";
+ this.chkSyncAtCenter.UseVisualStyleBackColor = true;
+ this.chkSyncAtCenter.CheckedChanged += new System.EventHandler( this.chkSyncAtCenter_CheckedChanged );
+ //
+ // lblWheelRatio
+ //
+ this.lblWheelRatio.AutoSize = true;
+ this.lblWheelRatio.Location = new System.Drawing.Point( 22, 24 );
+ this.lblWheelRatio.Name = "lblWheelRatio";
+ this.lblWheelRatio.Size = new System.Drawing.Size( 95, 12 );
+ this.lblWheelRatio.TabIndex = 15;
+ this.lblWheelRatio.Text = "繝槭え繧ケ繝帙う繝シ繝ォ騾溷コヲ";
+ //
+ // btnWheelRatioDefault
+ //
+ this.btnWheelRatioDefault.Location = new System.Drawing.Point( 313, 19 );
+ this.btnWheelRatioDefault.Name = "btnWheelRatioDefault";
+ this.btnWheelRatioDefault.Size = new System.Drawing.Size( 57, 23 );
+ this.btnWheelRatioDefault.TabIndex = 4;
+ this.btnWheelRatioDefault.Text = "Default";
+ this.btnWheelRatioDefault.UseVisualStyleBackColor = true;
+ this.btnWheelRatioDefault.Click += new System.EventHandler( this.btnWheelRatioDefault_Click );
+ //
+ // groupLanguage
+ //
+ this.groupLanguage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupLanguage.AutoSize = true;
+ this.groupLanguage.Controls.Add( this.btnReloadLanguageConfig );
+ this.groupLanguage.Controls.Add( this.comboLanguage );
+ this.groupLanguage.Location = new System.Drawing.Point( 10, 6 );
+ this.groupLanguage.Name = "groupLanguage";
+ this.groupLanguage.Size = new System.Drawing.Size( 381, 67 );
+ this.groupLanguage.TabIndex = 29;
+ this.groupLanguage.TabStop = false;
+ this.groupLanguage.Text = "險隱";
+ //
+ // btnReloadLanguageConfig
+ //
+ this.btnReloadLanguageConfig.Location = new System.Drawing.Point( 207, 26 );
+ this.btnReloadLanguageConfig.Name = "btnReloadLanguageConfig";
+ this.btnReloadLanguageConfig.Size = new System.Drawing.Size( 163, 23 );
+ this.btnReloadLanguageConfig.TabIndex = 2;
+ this.btnReloadLanguageConfig.Text = "險隱櫁ィュ螳壹ヵ繧。繧、繝ォ繧偵Μ繝ュ繝シ繝";
+ this.btnReloadLanguageConfig.UseVisualStyleBackColor = true;
+ this.btnReloadLanguageConfig.Click += new System.EventHandler( this.btnReloadLanguageConfig_Click );
+ //
+ // tabAppearance
+ //
+ this.tabAppearance.Controls.Add( this.groupDesign );
+ this.tabAppearance.Controls.Add( this.groupColor );
+ this.tabAppearance.Location = new System.Drawing.Point( 4, 21 );
+ this.tabAppearance.Name = "tabAppearance";
+ this.tabAppearance.Padding = new System.Windows.Forms.Padding( 3 );
+ this.tabAppearance.Size = new System.Drawing.Size( 401, 377 );
+ this.tabAppearance.TabIndex = 3;
+ this.tabAppearance.Text = "螟冶ヲウ";
+ this.tabAppearance.UseVisualStyleBackColor = true;
+ //
+ // groupDesign
+ //
+ this.groupDesign.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupDesign.AutoSize = true;
+ this.groupDesign.Controls.Add( this.numEntryHeight );
+ this.groupDesign.Controls.Add( this.btnFontDefault );
+ this.groupDesign.Controls.Add( this.lblFontName );
+ this.groupDesign.Controls.Add( this.lblFont );
+ this.groupDesign.Controls.Add( this.btnChangeFont );
+ this.groupDesign.Controls.Add( this.lblEntryHeight );
+ this.groupDesign.Controls.Add( this.btnEntryHeightDefault );
+ this.groupDesign.Location = new System.Drawing.Point( 8, 171 );
+ this.groupDesign.Name = "groupDesign";
+ this.groupDesign.Size = new System.Drawing.Size( 381, 100 );
+ this.groupDesign.TabIndex = 32;
+ this.groupDesign.TabStop = false;
+ this.groupDesign.Text = "陦ィ遉コ";
+ //
+ // btnFontDefault
+ //
+ this.btnFontDefault.Location = new System.Drawing.Point( 312, 59 );
+ this.btnFontDefault.Name = "btnFontDefault";
+ this.btnFontDefault.Size = new System.Drawing.Size( 57, 23 );
+ this.btnFontDefault.TabIndex = 12;
+ this.btnFontDefault.Text = "Default";
+ this.btnFontDefault.UseVisualStyleBackColor = true;
+ this.btnFontDefault.Click += new System.EventHandler( this.btnFontDefault_Click );
+ //
+ // lblFontName
+ //
+ this.lblFontName.AutoSize = true;
+ this.lblFontName.Location = new System.Drawing.Point( 61, 64 );
+ this.lblFontName.Name = "lblFontName";
+ this.lblFontName.Size = new System.Drawing.Size( 0, 12 );
+ this.lblFontName.TabIndex = 31;
+ //
+ // lblFont
+ //
+ this.lblFont.AutoSize = true;
+ this.lblFont.Location = new System.Drawing.Point( 16, 64 );
+ this.lblFont.Name = "lblFont";
+ this.lblFont.Size = new System.Drawing.Size( 38, 12 );
+ this.lblFont.TabIndex = 30;
+ this.lblFont.Text = "繝輔か繝ウ繝";
+ //
+ // btnChangeFont
+ //
+ this.btnChangeFont.Location = new System.Drawing.Point( 232, 59 );
+ this.btnChangeFont.Name = "btnChangeFont";
+ this.btnChangeFont.Size = new System.Drawing.Size( 75, 23 );
+ this.btnChangeFont.TabIndex = 11;
+ this.btnChangeFont.Text = "螟画峩";
+ this.btnChangeFont.UseVisualStyleBackColor = true;
+ this.btnChangeFont.Click += new System.EventHandler( this.btnChangeFont_Click );
+ //
+ // lblEntryHeight
+ //
+ this.lblEntryHeight.AutoSize = true;
+ this.lblEntryHeight.Location = new System.Drawing.Point( 16, 27 );
+ this.lblEntryHeight.Name = "lblEntryHeight";
+ this.lblEntryHeight.Size = new System.Drawing.Size( 117, 12 );
+ this.lblEntryHeight.TabIndex = 26;
+ this.lblEntryHeight.Text = "繧ィ繝ウ繝医Μ縺ョ鬮倥& (繝斐け繧サ繝ォ)";
+ //
+ // btnEntryHeightDefault
+ //
+ this.btnEntryHeightDefault.Location = new System.Drawing.Point( 312, 22 );
+ this.btnEntryHeightDefault.Name = "btnEntryHeightDefault";
+ this.btnEntryHeightDefault.Size = new System.Drawing.Size( 57, 23 );
+ this.btnEntryHeightDefault.TabIndex = 10;
+ this.btnEntryHeightDefault.Text = "Default";
+ this.btnEntryHeightDefault.UseVisualStyleBackColor = true;
+ this.btnEntryHeightDefault.Click += new System.EventHandler( this.btnEntryHeightDefault_Click );
+ //
+ // groupColor
+ //
+ this.groupColor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupColor.AutoSize = true;
+ this.groupColor.Controls.Add( this.lblTimeLineTitle );
+ this.groupColor.Controls.Add( this.lblTimelineTitleColor );
+ this.groupColor.Controls.Add( this.btnChangeTimeLineTitle );
+ this.groupColor.Controls.Add( this.btnTimeLineTitleDefault );
+ this.groupColor.Controls.Add( this.lblTimeLineVSQ );
+ this.groupColor.Controls.Add( this.btnTimeLineDefaultDefault );
+ this.groupColor.Controls.Add( this.lblTimeLineVSQColor );
+ this.groupColor.Controls.Add( this.btnChangeTimeLineDefault );
+ this.groupColor.Controls.Add( this.btnChangeTimeLineVSQ );
+ this.groupColor.Controls.Add( this.lblTimeLineDefaultColor );
+ this.groupColor.Controls.Add( this.btnTimeLineVSQDefault );
+ this.groupColor.Controls.Add( this.lblTimeLineDefault );
+ this.groupColor.Controls.Add( this.lblTimeLinePlugin );
+ this.groupColor.Controls.Add( this.btnTimeLinePluginDefault );
+ this.groupColor.Controls.Add( this.lblTimeLinePluginColor );
+ this.groupColor.Controls.Add( this.btnChangeTimeLinePlugin );
+ this.groupColor.Location = new System.Drawing.Point( 8, 6 );
+ this.groupColor.Name = "groupColor";
+ this.groupColor.Size = new System.Drawing.Size( 381, 159 );
+ this.groupColor.TabIndex = 31;
+ this.groupColor.TabStop = false;
+ this.groupColor.Text = "驟崎牡";
+ //
+ // lblTimeLineTitle
+ //
+ this.lblTimeLineTitle.AutoSize = true;
+ this.lblTimeLineTitle.Location = new System.Drawing.Point( 6, 24 );
+ this.lblTimeLineTitle.Name = "lblTimeLineTitle";
+ this.lblTimeLineTitle.Size = new System.Drawing.Size( 103, 12 );
+ this.lblTimeLineTitle.TabIndex = 10;
+ this.lblTimeLineTitle.Text = "繧ソ繧、繝繝ゥ繧、繝ウ縺ョ繧ソ繧、繝医Ν";
+ //
+ // lblTimelineTitleColor
+ //
+ this.lblTimelineTitleColor.BackColor = System.Drawing.Color.White;
+ this.lblTimelineTitleColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.lblTimelineTitleColor.Location = new System.Drawing.Point( 116, 18 );
+ this.lblTimelineTitleColor.Name = "lblTimelineTitleColor";
+ this.lblTimelineTitleColor.Size = new System.Drawing.Size( 100, 23 );
+ this.lblTimelineTitleColor.TabIndex = 11;
+ //
+ // btnChangeTimeLineTitle
+ //
+ this.btnChangeTimeLineTitle.Location = new System.Drawing.Point( 232, 19 );
+ this.btnChangeTimeLineTitle.Name = "btnChangeTimeLineTitle";
+ this.btnChangeTimeLineTitle.Size = new System.Drawing.Size( 75, 23 );
+ this.btnChangeTimeLineTitle.TabIndex = 1;
+ this.btnChangeTimeLineTitle.Text = "螟画峩";
+ this.btnChangeTimeLineTitle.UseVisualStyleBackColor = true;
+ this.btnChangeTimeLineTitle.Click += new System.EventHandler( this.btnChangeTimeLineTitle_Click );
+ //
+ // btnTimeLineTitleDefault
+ //
+ this.btnTimeLineTitleDefault.Location = new System.Drawing.Point( 313, 19 );
+ this.btnTimeLineTitleDefault.Name = "btnTimeLineTitleDefault";
+ this.btnTimeLineTitleDefault.Size = new System.Drawing.Size( 57, 23 );
+ this.btnTimeLineTitleDefault.TabIndex = 2;
+ this.btnTimeLineTitleDefault.Text = "Default";
+ this.btnTimeLineTitleDefault.UseVisualStyleBackColor = true;
+ this.btnTimeLineTitleDefault.Click += new System.EventHandler( this.btnTimeLineTitleDefault_Click );
+ //
+ // lblTimeLineVSQ
+ //
+ this.lblTimeLineVSQ.AutoSize = true;
+ this.lblTimeLineVSQ.Location = new System.Drawing.Point( 6, 57 );
+ this.lblTimeLineVSQ.Name = "lblTimeLineVSQ";
+ this.lblTimeLineVSQ.Size = new System.Drawing.Size( 61, 12 );
+ this.lblTimeLineVSQ.TabIndex = 14;
+ this.lblTimeLineVSQ.Text = "VSQ繧ィ繝ウ繝医Μ";
+ //
+ // btnTimeLineDefaultDefault
+ //
+ this.btnTimeLineDefaultDefault.Location = new System.Drawing.Point( 313, 118 );
+ this.btnTimeLineDefaultDefault.Name = "btnTimeLineDefaultDefault";
+ this.btnTimeLineDefaultDefault.Size = new System.Drawing.Size( 57, 23 );
+ this.btnTimeLineDefaultDefault.TabIndex = 8;
+ this.btnTimeLineDefaultDefault.Text = "Default";
+ this.btnTimeLineDefaultDefault.UseVisualStyleBackColor = true;
+ this.btnTimeLineDefaultDefault.Click += new System.EventHandler( this.btnTimeLineDefaultDefault_Click );
+ //
+ // lblTimeLineVSQColor
+ //
+ this.lblTimeLineVSQColor.BackColor = System.Drawing.Color.White;
+ this.lblTimeLineVSQColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.lblTimeLineVSQColor.Location = new System.Drawing.Point( 116, 51 );
+ this.lblTimeLineVSQColor.Name = "lblTimeLineVSQColor";
+ this.lblTimeLineVSQColor.Size = new System.Drawing.Size( 100, 23 );
+ this.lblTimeLineVSQColor.TabIndex = 15;
+ //
+ // btnChangeTimeLineDefault
+ //
+ this.btnChangeTimeLineDefault.Location = new System.Drawing.Point( 232, 118 );
+ this.btnChangeTimeLineDefault.Name = "btnChangeTimeLineDefault";
+ this.btnChangeTimeLineDefault.Size = new System.Drawing.Size( 75, 23 );
+ this.btnChangeTimeLineDefault.TabIndex = 7;
+ this.btnChangeTimeLineDefault.Text = "螟画峩";
+ this.btnChangeTimeLineDefault.UseVisualStyleBackColor = true;
+ this.btnChangeTimeLineDefault.Click += new System.EventHandler( this.btnChangeTimeLineDefault_Click );
+ //
+ // btnChangeTimeLineVSQ
+ //
+ this.btnChangeTimeLineVSQ.Location = new System.Drawing.Point( 232, 52 );
+ this.btnChangeTimeLineVSQ.Name = "btnChangeTimeLineVSQ";
+ this.btnChangeTimeLineVSQ.Size = new System.Drawing.Size( 75, 23 );
+ this.btnChangeTimeLineVSQ.TabIndex = 3;
+ this.btnChangeTimeLineVSQ.Text = "螟画峩";
+ this.btnChangeTimeLineVSQ.UseVisualStyleBackColor = true;
+ this.btnChangeTimeLineVSQ.Click += new System.EventHandler( this.btnChangeTimeLineVSQ_Click );
+ //
+ // lblTimeLineDefaultColor
+ //
+ this.lblTimeLineDefaultColor.BackColor = System.Drawing.Color.White;
+ this.lblTimeLineDefaultColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.lblTimeLineDefaultColor.Location = new System.Drawing.Point( 116, 117 );
+ this.lblTimeLineDefaultColor.Name = "lblTimeLineDefaultColor";
+ this.lblTimeLineDefaultColor.Size = new System.Drawing.Size( 100, 23 );
+ this.lblTimeLineDefaultColor.TabIndex = 23;
+ //
+ // btnTimeLineVSQDefault
+ //
+ this.btnTimeLineVSQDefault.Location = new System.Drawing.Point( 313, 52 );
+ this.btnTimeLineVSQDefault.Name = "btnTimeLineVSQDefault";
+ this.btnTimeLineVSQDefault.Size = new System.Drawing.Size( 57, 23 );
+ this.btnTimeLineVSQDefault.TabIndex = 4;
+ this.btnTimeLineVSQDefault.Text = "Default";
+ this.btnTimeLineVSQDefault.UseVisualStyleBackColor = true;
+ this.btnTimeLineVSQDefault.Click += new System.EventHandler( this.btnTimeLineVSQDefault_Click );
+ //
+ // lblTimeLineDefault
+ //
+ this.lblTimeLineDefault.AutoSize = true;
+ this.lblTimeLineDefault.Location = new System.Drawing.Point( 6, 123 );
+ this.lblTimeLineDefault.Name = "lblTimeLineDefault";
+ this.lblTimeLineDefault.Size = new System.Drawing.Size( 79, 12 );
+ this.lblTimeLineDefault.TabIndex = 22;
+ this.lblTimeLineDefault.Text = "縺昴ョ莉悶ョ繧ィ繝ウ繝医Μ";
+ //
+ // lblTimeLinePlugin
+ //
+ this.lblTimeLinePlugin.AutoSize = true;
+ this.lblTimeLinePlugin.Location = new System.Drawing.Point( 6, 90 );
+ this.lblTimeLinePlugin.Name = "lblTimeLinePlugin";
+ this.lblTimeLinePlugin.Size = new System.Drawing.Size( 82, 12 );
+ this.lblTimeLinePlugin.TabIndex = 18;
+ this.lblTimeLinePlugin.Text = "繝励Λ繧ー繧、繝ウ繧ィ繝ウ繝医Μ";
+ //
+ // btnTimeLinePluginDefault
+ //
+ this.btnTimeLinePluginDefault.Location = new System.Drawing.Point( 313, 85 );
+ this.btnTimeLinePluginDefault.Name = "btnTimeLinePluginDefault";
+ this.btnTimeLinePluginDefault.Size = new System.Drawing.Size( 57, 23 );
+ this.btnTimeLinePluginDefault.TabIndex = 6;
+ this.btnTimeLinePluginDefault.Text = "Default";
+ this.btnTimeLinePluginDefault.UseVisualStyleBackColor = true;
+ this.btnTimeLinePluginDefault.Click += new System.EventHandler( this.btnTimeLinePluginDefault_Click );
+ //
+ // lblTimeLinePluginColor
+ //
+ this.lblTimeLinePluginColor.BackColor = System.Drawing.Color.White;
+ this.lblTimeLinePluginColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.lblTimeLinePluginColor.Location = new System.Drawing.Point( 116, 84 );
+ this.lblTimeLinePluginColor.Name = "lblTimeLinePluginColor";
+ this.lblTimeLinePluginColor.Size = new System.Drawing.Size( 100, 23 );
+ this.lblTimeLinePluginColor.TabIndex = 19;
+ //
+ // btnChangeTimeLinePlugin
+ //
+ this.btnChangeTimeLinePlugin.Location = new System.Drawing.Point( 232, 85 );
+ this.btnChangeTimeLinePlugin.Name = "btnChangeTimeLinePlugin";
+ this.btnChangeTimeLinePlugin.Size = new System.Drawing.Size( 75, 23 );
+ this.btnChangeTimeLinePlugin.TabIndex = 5;
+ this.btnChangeTimeLinePlugin.Text = "螟画峩";
+ this.btnChangeTimeLinePlugin.UseVisualStyleBackColor = true;
+ this.btnChangeTimeLinePlugin.Click += new System.EventHandler( this.btnChangeTimeLinePlugin_Click );
+ //
+ // tabLipSync
+ //
+ this.tabLipSync.BackColor = System.Drawing.SystemColors.Control;
+ this.tabLipSync.Controls.Add( this.groupSerialVowel );
+ this.tabLipSync.Controls.Add( this.groupPhoneticSymbol );
+ this.tabLipSync.Location = new System.Drawing.Point( 4, 21 );
+ this.tabLipSync.Name = "tabLipSync";
+ this.tabLipSync.Padding = new System.Windows.Forms.Padding( 3 );
+ this.tabLipSync.Size = new System.Drawing.Size( 401, 377 );
+ this.tabLipSync.TabIndex = 1;
+ this.tabLipSync.Text = "蜿」繝代け逕滓";
+ this.tabLipSync.UseVisualStyleBackColor = true;
+ //
+ // groupSerialVowel
+ //
+ this.groupSerialVowel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupSerialVowel.Controls.Add( this.txtCombineThreshold );
+ this.groupSerialVowel.Controls.Add( this.lblCombineThreshold );
+ this.groupSerialVowel.Controls.Add( this.chkSerialVowel );
+ this.groupSerialVowel.Location = new System.Drawing.Point( 8, 277 );
+ this.groupSerialVowel.Name = "groupSerialVowel";
+ this.groupSerialVowel.Size = new System.Drawing.Size( 385, 89 );
+ this.groupSerialVowel.TabIndex = 5;
+ this.groupSerialVowel.TabStop = false;
+ this.groupSerialVowel.Text = "縺昴ョ莉悶ョ險ュ螳";
+ //
+ // txtCombineThreshold
+ //
+ this.txtCombineThreshold.Location = new System.Drawing.Point( 222, 54 );
+ this.txtCombineThreshold.Name = "txtCombineThreshold";
+ this.txtCombineThreshold.Size = new System.Drawing.Size( 132, 19 );
+ this.txtCombineThreshold.TabIndex = 5;
+ this.txtCombineThreshold.Text = "0";
+ //
+ // lblCombineThreshold
+ //
+ this.lblCombineThreshold.AutoSize = true;
+ this.lblCombineThreshold.Location = new System.Drawing.Point( 17, 57 );
+ this.lblCombineThreshold.Name = "lblCombineThreshold";
+ this.lblCombineThreshold.Size = new System.Drawing.Size( 128, 12 );
+ this.lblCombineThreshold.TabIndex = 1;
+ this.lblCombineThreshold.Text = "騾」邯夐浹縺ィ縺ソ縺ェ縺咏┌髻ウ譎る俣";
+ //
+ // chkSerialVowel
+ //
+ this.chkSerialVowel.Location = new System.Drawing.Point( 19, 25 );
+ this.chkSerialVowel.Name = "chkSerialVowel";
+ this.chkSerialVowel.Size = new System.Drawing.Size( 360, 16 );
+ this.chkSerialVowel.TabIndex = 4;
+ this.chkSerialVowel.Text = "蜷御ク豈埼浹縺碁」邯壹☆繧九→縺阪∝哨繧帝哩縺倥k";
+ this.chkSerialVowel.UseVisualStyleBackColor = true;
+ //
+ // groupPhoneticSymbol
+ //
+ this.groupPhoneticSymbol.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupPhoneticSymbol.Controls.Add( this.mListClose );
+ this.groupPhoneticSymbol.Controls.Add( this.mListU );
+ this.groupPhoneticSymbol.Controls.Add( this.mListI );
+ this.groupPhoneticSymbol.Location = new System.Drawing.Point( 8, 6 );
+ this.groupPhoneticSymbol.Name = "groupPhoneticSymbol";
+ this.groupPhoneticSymbol.Size = new System.Drawing.Size( 385, 265 );
+ this.groupPhoneticSymbol.TabIndex = 4;
+ this.groupPhoneticSymbol.TabStop = false;
+ this.groupPhoneticSymbol.Text = "逋コ髻ウ縺ョ逶エ蜑阪↓蜿」縺ョ蠖「繧貞、牙喧縺輔○繧狗匱髻ウ險伜捷繧呈欠螳壹@縺セ縺";
+ //
+ // tabSystem
+ //
+ this.tabSystem.BackColor = System.Drawing.SystemColors.Control;
+ this.tabSystem.Controls.Add( this.groupAnotherBehavior );
+ this.tabSystem.Controls.Add( this.groupEncoder );
+ this.tabSystem.Location = new System.Drawing.Point( 4, 21 );
+ this.tabSystem.Name = "tabSystem";
+ this.tabSystem.Padding = new System.Windows.Forms.Padding( 3 );
+ this.tabSystem.Size = new System.Drawing.Size( 401, 377 );
+ this.tabSystem.TabIndex = 2;
+ this.tabSystem.Text = "繧キ繧ケ繝繝";
+ this.tabSystem.UseVisualStyleBackColor = true;
+ //
+ // groupAnotherBehavior
+ //
+ this.groupAnotherBehavior.Controls.Add( this.chkHeavyOpenCharacterDialog );
+ this.groupAnotherBehavior.Controls.Add( this.chkGenCharacterAutomaticaly );
+ this.groupAnotherBehavior.Location = new System.Drawing.Point( 6, 118 );
+ this.groupAnotherBehavior.Name = "groupAnotherBehavior";
+ this.groupAnotherBehavior.Size = new System.Drawing.Size( 389, 94 );
+ this.groupAnotherBehavior.TabIndex = 19;
+ this.groupAnotherBehavior.TabStop = false;
+ this.groupAnotherBehavior.Text = "縺昴ョ莉悶ョ蜍穂ス懆ィュ螳";
+ //
+ // chkHeavyOpenCharacterDialog
+ //
+ this.chkHeavyOpenCharacterDialog.Location = new System.Drawing.Point( 14, 56 );
+ this.chkHeavyOpenCharacterDialog.Name = "chkHeavyOpenCharacterDialog";
+ this.chkHeavyOpenCharacterDialog.Size = new System.Drawing.Size( 364, 16 );
+ this.chkHeavyOpenCharacterDialog.TabIndex = 6;
+ this.chkHeavyOpenCharacterDialog.Text = "繝励Ξ繝薙Η繝シ蜿ッ閭ス縺ェ繧ュ繝」繝ゥ繧ッ繧ソ繝輔ぃ繧、繝ォ驕ク謚槭ム繧、繧「繝ュ繧ー繧剃スソ逕ィ";
+ this.chkHeavyOpenCharacterDialog.UseVisualStyleBackColor = true;
+ this.chkHeavyOpenCharacterDialog.CheckedChanged += new System.EventHandler( this.chkHeavyOpenCharacterDialog_CheckedChanged );
+ //
+ // chkGenCharacterAutomaticaly
+ //
+ this.chkGenCharacterAutomaticaly.Location = new System.Drawing.Point( 14, 27 );
+ this.chkGenCharacterAutomaticaly.Name = "chkGenCharacterAutomaticaly";
+ this.chkGenCharacterAutomaticaly.Size = new System.Drawing.Size( 364, 16 );
+ this.chkGenCharacterAutomaticaly.TabIndex = 5;
+ this.chkGenCharacterAutomaticaly.Text = "VSQ隱ュ霎シ縺ソ譎ゅ↓繧ュ繝」繝ゥ繧ッ繧ソ繧定ェ蜍慕函謌舌☆繧";
+ this.chkGenCharacterAutomaticaly.UseVisualStyleBackColor = true;
+ this.chkGenCharacterAutomaticaly.CheckedChanged += new System.EventHandler( this.chkGenCharacterAutomaticaly_CheckedChanged );
+ //
+ // groupEncoder
+ //
+ this.groupEncoder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.groupEncoder.Controls.Add( this.txtFFmpeg );
+ this.groupEncoder.Controls.Add( this.lblFFmpeg );
+ this.groupEncoder.Controls.Add( this.btnMEncoder );
+ this.groupEncoder.Controls.Add( this.txtMEncoder );
+ this.groupEncoder.Controls.Add( this.btnFFmpeg );
+ this.groupEncoder.Controls.Add( this.lblMEncoder );
+ this.groupEncoder.Location = new System.Drawing.Point( 6, 6 );
+ this.groupEncoder.Name = "groupEncoder";
+ this.groupEncoder.Size = new System.Drawing.Size( 389, 106 );
+ this.groupEncoder.TabIndex = 18;
+ this.groupEncoder.TabStop = false;
+ this.groupEncoder.Text = "繧ィ繝ウ繧ウ繝シ繝/繝繧ウ繝シ繝";
+ //
+ // txtFFmpeg
+ //
+ this.txtFFmpeg.Location = new System.Drawing.Point( 100, 32 );
+ this.txtFFmpeg.Name = "txtFFmpeg";
+ this.txtFFmpeg.Size = new System.Drawing.Size( 248, 19 );
+ this.txtFFmpeg.TabIndex = 1;
+ this.txtFFmpeg.TextChanged += new System.EventHandler( this.txtFFmpeg_TextChanged );
+ //
+ // lblFFmpeg
+ //
+ this.lblFFmpeg.AutoSize = true;
+ this.lblFFmpeg.Location = new System.Drawing.Point( 6, 35 );
+ this.lblFFmpeg.Name = "lblFFmpeg";
+ this.lblFFmpeg.Size = new System.Drawing.Size( 74, 12 );
+ this.lblFFmpeg.TabIndex = 0;
+ this.lblFFmpeg.Text = "ffmpeg縺ョ蝣エ謇";
+ //
+ // btnMEncoder
+ //
+ this.btnMEncoder.Location = new System.Drawing.Point( 354, 68 );
+ this.btnMEncoder.Name = "btnMEncoder";
+ this.btnMEncoder.Size = new System.Drawing.Size( 24, 23 );
+ this.btnMEncoder.TabIndex = 4;
+ this.btnMEncoder.Text = "...";
+ this.btnMEncoder.UseVisualStyleBackColor = true;
+ this.btnMEncoder.Click += new System.EventHandler( this.btnMEncoder_Click );
+ //
+ // txtMEncoder
+ //
+ this.txtMEncoder.Location = new System.Drawing.Point( 100, 70 );
+ this.txtMEncoder.Name = "txtMEncoder";
+ this.txtMEncoder.Size = new System.Drawing.Size( 248, 19 );
+ this.txtMEncoder.TabIndex = 3;
+ this.txtMEncoder.TextChanged += new System.EventHandler( this.txtMEncoder_TextChanged );
+ //
+ // btnFFmpeg
+ //
+ this.btnFFmpeg.Location = new System.Drawing.Point( 354, 30 );
+ this.btnFFmpeg.Name = "btnFFmpeg";
+ this.btnFFmpeg.Size = new System.Drawing.Size( 24, 23 );
+ this.btnFFmpeg.TabIndex = 2;
+ this.btnFFmpeg.Text = "...";
+ this.btnFFmpeg.UseVisualStyleBackColor = true;
+ this.btnFFmpeg.Click += new System.EventHandler( this.btnFFmpeg_Click );
+ //
+ // lblMEncoder
+ //
+ this.lblMEncoder.AutoSize = true;
+ this.lblMEncoder.Location = new System.Drawing.Point( 6, 73 );
+ this.lblMEncoder.Name = "lblMEncoder";
+ this.lblMEncoder.Size = new System.Drawing.Size( 88, 12 );
+ this.lblMEncoder.TabIndex = 15;
+ this.lblMEncoder.Text = "mencoder縺ョ蝣エ謇";
+ //
+ // numWheelRatio
+ //
+ this.numWheelRatio.Location = new System.Drawing.Point( 168, 22 );
+ this.numWheelRatio.Minimum = new decimal( new int[] {
+ 1,
+ 0,
+ 0,
+ 0} );
+ this.numWheelRatio.Name = "numWheelRatio";
+ this.numWheelRatio.Size = new System.Drawing.Size( 120, 19 );
+ this.numWheelRatio.TabIndex = 3;
+ this.numWheelRatio.Value = new decimal( new int[] {
+ 50,
+ 0,
+ 0,
+ 0} );
+ this.numWheelRatio.ValueChanged += new System.EventHandler( this.numWheelRatio_ValueChanged );
+ //
+ // numEntryHeight
+ //
+ this.numEntryHeight.Location = new System.Drawing.Point( 149, 25 );
+ this.numEntryHeight.Minimum = new decimal( new int[] {
+ 10,
+ 0,
+ 0,
+ 0} );
+ this.numEntryHeight.Name = "numEntryHeight";
+ this.numEntryHeight.Size = new System.Drawing.Size( 120, 19 );
+ this.numEntryHeight.TabIndex = 9;
+ this.numEntryHeight.Value = new decimal( new int[] {
+ 10,
+ 0,
+ 0,
+ 0} );
+ this.numEntryHeight.ValueChanged += new System.EventHandler( this.numEntryHeight_ValueChanged );
+ //
+ // mListClose
+ //
+ this.mListClose.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.mListClose.CheckBoxes = true;
+ this.mListClose.Header = "蜿」繧帝哩縺倥k";
+ this.mListClose.HeaderAlignment = System.Windows.Forms.HorizontalAlignment.Left;
+ this.mListClose.Location = new System.Drawing.Point( 6, 18 );
+ this.mListClose.Name = "mListClose";
+ this.mListClose.Size = new System.Drawing.Size( 373, 68 );
+ this.mListClose.TabIndex = 1;
+ //
+ // mListU
+ //
+ this.mListU.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.mListU.CheckBoxes = true;
+ this.mListU.Header = "\"縺\"縺ョ蜿」";
+ this.mListU.HeaderAlignment = System.Windows.Forms.HorizontalAlignment.Left;
+ this.mListU.Location = new System.Drawing.Point( 6, 167 );
+ this.mListU.Name = "mListU";
+ this.mListU.Size = new System.Drawing.Size( 373, 87 );
+ this.mListU.TabIndex = 3;
+ //
+ // mListI
+ //
+ this.mListI.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.mListI.CheckBoxes = true;
+ this.mListI.Header = "\"縺Ы"縺ョ蜿」";
+ this.mListI.HeaderAlignment = System.Windows.Forms.HorizontalAlignment.Left;
+ this.mListI.Location = new System.Drawing.Point( 6, 92 );
+ this.mListI.Name = "mListI";
+ this.mListI.Size = new System.Drawing.Size( 373, 69 );
+ this.mListI.TabIndex = 2;
+ //
+ // EnvConfiguration
+ //
+ this.AcceptButton = this.btnOK;
+ this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size( 409, 461 );
+ this.Controls.Add( this.tabControl1 );
+ this.Controls.Add( this.btnOK );
+ this.Controls.Add( this.btnCancel );
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "EnvConfiguration";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "繧ェ繝励す繝ァ繝ウ";
+ this.Load += new System.EventHandler( this.EnvConfiguration_Load );
+ this.tabControl1.ResumeLayout( false );
+ this.tabUserConfig.ResumeLayout( false );
+ this.tabUserConfig.PerformLayout();
+ this.groupControl.ResumeLayout( false );
+ this.groupControl.PerformLayout();
+ this.groupLanguage.ResumeLayout( false );
+ this.tabAppearance.ResumeLayout( false );
+ this.tabAppearance.PerformLayout();
+ this.groupDesign.ResumeLayout( false );
+ this.groupDesign.PerformLayout();
+ this.groupColor.ResumeLayout( false );
+ this.groupColor.PerformLayout();
+ this.tabLipSync.ResumeLayout( false );
+ this.groupSerialVowel.ResumeLayout( false );
+ this.groupSerialVowel.PerformLayout();
+ this.groupPhoneticSymbol.ResumeLayout( false );
+ this.tabSystem.ResumeLayout( false );
+ this.groupAnotherBehavior.ResumeLayout( false );
+ this.groupEncoder.ResumeLayout( false );
+ this.groupEncoder.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numWheelRatio)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numEntryHeight)).EndInit();
+ this.ResumeLayout( false );
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ private System.Windows.Forms.ComboBox comboLanguage;
+ private System.Windows.Forms.TabControl tabControl1;
+ private System.Windows.Forms.TabPage tabUserConfig;
+ private System.Windows.Forms.TabPage tabLipSync;
+ private System.Windows.Forms.ColorDialog colorDialog1;
+ private MListView mListClose;
+ private MListView mListU;
+ private MListView mListI;
+ private System.Windows.Forms.GroupBox groupLanguage;
+ private System.Windows.Forms.TabPage tabSystem;
+ private System.Windows.Forms.TextBox txtFFmpeg;
+ private System.Windows.Forms.Label lblFFmpeg;
+ private System.Windows.Forms.Button btnFFmpeg;
+ private System.Windows.Forms.Button btnMEncoder;
+ private System.Windows.Forms.TextBox txtMEncoder;
+ private System.Windows.Forms.Label lblMEncoder;
+ private System.Windows.Forms.FontDialog fontDialog;
+ private System.Windows.Forms.GroupBox groupPhoneticSymbol;
+ private System.Windows.Forms.GroupBox groupSerialVowel;
+ private System.Windows.Forms.CheckBox chkSerialVowel;
+ private System.Windows.Forms.GroupBox groupEncoder;
+ private System.Windows.Forms.GroupBox groupAnotherBehavior;
+ private System.Windows.Forms.CheckBox chkGenCharacterAutomaticaly;
+ private System.Windows.Forms.TextBox txtCombineThreshold;
+ private System.Windows.Forms.Label lblCombineThreshold;
+ private System.Windows.Forms.CheckBox chkHeavyOpenCharacterDialog;
+ private System.Windows.Forms.Button btnReloadLanguageConfig;
+ private System.Windows.Forms.TabPage tabAppearance;
+ private System.Windows.Forms.GroupBox groupColor;
+ private System.Windows.Forms.Label lblTimeLineTitle;
+ private System.Windows.Forms.Label lblTimelineTitleColor;
+ private System.Windows.Forms.Button btnChangeTimeLineTitle;
+ private System.Windows.Forms.Button btnTimeLineTitleDefault;
+ private System.Windows.Forms.Label lblTimeLineVSQ;
+ private System.Windows.Forms.Button btnTimeLineDefaultDefault;
+ private System.Windows.Forms.Label lblTimeLineVSQColor;
+ private System.Windows.Forms.Button btnChangeTimeLineDefault;
+ private System.Windows.Forms.Button btnChangeTimeLineVSQ;
+ private System.Windows.Forms.Label lblTimeLineDefaultColor;
+ private System.Windows.Forms.Button btnTimeLineVSQDefault;
+ private System.Windows.Forms.Label lblTimeLineDefault;
+ private System.Windows.Forms.Label lblTimeLinePlugin;
+ private System.Windows.Forms.Button btnTimeLinePluginDefault;
+ private System.Windows.Forms.Label lblTimeLinePluginColor;
+ private System.Windows.Forms.Button btnChangeTimeLinePlugin;
+ private System.Windows.Forms.GroupBox groupDesign;
+ private NumericUpDownEx numEntryHeight;
+ private System.Windows.Forms.Button btnFontDefault;
+ private System.Windows.Forms.Label lblFontName;
+ private System.Windows.Forms.Label lblFont;
+ private System.Windows.Forms.Button btnChangeFont;
+ private System.Windows.Forms.Label lblEntryHeight;
+ private System.Windows.Forms.Button btnEntryHeightDefault;
+ private System.Windows.Forms.GroupBox groupControl;
+ private System.Windows.Forms.Button btnWheelRatioDefault;
+ private NumericUpDownEx numWheelRatio;
+ private System.Windows.Forms.Label lblWheelRatio;
+ private System.Windows.Forms.CheckBox chkSyncAtCenter;
+ }
+}
diff --git a/trunk/LipSync/Editor/EnvConfiguration.cs b/trunk/LipSync/Editor/EnvConfiguration.cs
new file mode 100644
index 0000000..338bd5a
--- /dev/null
+++ b/trunk/LipSync/Editor/EnvConfiguration.cs
@@ -0,0 +1,412 @@
+/*
+ * EnvConfiguration.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Windows.Forms;
+
+using Boare.Lib.AppUtil;
+
+namespace LipSync {
+
+ public partial class EnvConfiguration : Form, IMultiLanguageControl {
+ const string _DEFAULT_LANGUAGE_STRING = "Default";
+ EnvSettings m_config;
+
+ public EnvConfiguration( EnvSettings config ) {
+ InitializeComponent();
+ ApplyLanguage();
+ ApplyFont( AppManager.Config.Font.GetFont() );
+
+ m_config = (EnvSettings)config.Clone();
+ int selected = -1;
+
+ string[] t_list = Messaging.GetRegisteredLanguage();
+ comboLanguage.Items.Clear();
+ comboLanguage.Items.Add( _DEFAULT_LANGUAGE_STRING );
+ foreach ( string lang in t_list ) {
+ comboLanguage.Items.Add( lang );
+ if ( lang == Messaging.Language ) {
+ selected = comboLanguage.Items.Count - 1;
+ }
+ }
+ if ( selected >= 0 ) {
+ comboLanguage.SelectedIndex = selected;
+ } else {
+ comboLanguage.SelectedIndex = 0;
+ }
+
+ // nn
+ string[] list_nn = new string[] { "b", "p", "m", "b'", "p'", "m'" };
+ mListClose.Items.Clear();
+ for ( int i = 0; i < list_nn.Length; i++ ) {
+ string s = list_nn[i];
+ mListClose.Items.Add( new ListViewItem( s ) );
+ mListClose.Items[i].Checked = VowelType.IsRegisteredToNN( s );
+ }
+
+ // i
+ string[] list_i = new string[] { "k'", "g'", "S", "dZ", "tS", "J", "C" };
+ mListI.Items.Clear();
+ for ( int i = 0; i < list_i.Length; i++ ) {
+ string s = list_i[i];
+ mListI.Items.Add( new ListViewItem( s ) );
+ mListI.Items[i].Checked = VowelType.IsRegisteredToI( s );
+ }
+
+ // u
+ string[] list_u = new string[] { @"p\", @"p\'", "w", "ts", "dz" };
+ for ( int i = 0; i < list_u.Length; i++ ) {
+ string s = list_u[i];
+ mListU.Items.Add( new ListViewItem( s ) );
+ mListU.Items[i].Checked = VowelType.IsRegisteredToU( s );
+ }
+ //mListClose.BackColor = tabLipSync.BackColor;
+ //mListI.BackColor = tabLipSync.BackColor;
+ //mListU.BackColor = tabLipSync.BackColor;
+
+ ScreenFont = m_config.Font.GetFont();
+ numWheelRatio.Value = (decimal)(1.0 / m_config.WheelRatio);
+
+ chkGenCharacterAutomaticaly.Checked = m_config.GenerateCharacterAutomatically;
+ chkHeavyOpenCharacterDialog.Checked = m_config.UseHeavyDialogInOpeningCharacterSettings;
+ chkSerialVowel.Checked = m_config.CloseMouthWhenSameVowelsRepeated;
+
+ txtFFmpeg.Text = m_config.PathFFmpeg;
+ txtMEncoder.Text = m_config.PathMEncoder;
+
+ chkSyncAtCenter.Checked = m_config.SyncAtCentre;
+ }
+
+ public void ApplyFont( Font font ) {
+ this.Font = font;
+ foreach ( Control c in this.Controls ) {
+ Boare.Lib.AppUtil.Misc.ApplyFontRecurse( c, font );
+ }
+ }
+
+ public void ApplyLanguage() {
+ this.btnOK.Text = _( "OK" );
+ this.btnCancel.Text = _( "Cancel" );
+ this.groupLanguage.Text = _( "Language" );
+ this.Text = _( "Option" );
+
+ this.tabUserConfig.Text = _( "User Config" );
+ this.tabAppearance.Text = _( "Appearance" );
+ this.tabLipSync.Text = _( "lip-sync Option" );
+ this.tabSystem.Text = _( "System" );
+
+ this.lblTimeLineTitle.Text = _( "Title of timeline" );
+ this.lblTimeLineVSQ.Text = _( "VSQ Entry" );
+ this.lblTimeLinePlugin.Text = _( "Plugin Entry" );
+ this.lblTimeLineDefault.Text = _( "Another Entry" );
+ this.lblEntryHeight.Text = _( "Entry height (pixel)" );
+ this.btnChangeTimeLineTitle.Text = _( "Change" );
+ this.btnChangeTimeLineVSQ.Text = _( "Change" );
+ this.btnChangeTimeLinePlugin.Text = _( "Change" );
+ this.btnChangeTimeLineDefault.Text = _( "Change" );
+ this.groupPhoneticSymbol.Text = _( "Check phonetic symbol to configure detailed mouth shape control" );
+ this.mListClose.Header = _( "Close mouth before pronunciation" );
+ this.mListI.Header = _( "\"i\" shaped mouth before pronunciation" );
+ this.mListU.Header = _( "\"u\" shaped mouth before pronunciation" );
+ this.groupColor.Text = _( "Color" );
+ this.groupDesign.Text = _( "Design" );
+ this.lblFFmpeg.Text = _( "Path of ffmpeg" );
+ this.lblMEncoder.Text = _( "Path of mencoder" );
+ this.lblFont.Text = _( "Font" );
+ this.btnChangeFont.Text = _( "Change" );
+ this.groupSerialVowel.Text = _( "Another settings" );
+ this.chkSerialVowel.Text = _( "Close mouth when same vowels repeated" );
+ this.groupEncoder.Text = _( "Encoder/Decoder" );
+ this.chkGenCharacterAutomaticaly.Text = _( "Generate character automaticaly when importing vsq" );
+ this.lblCombineThreshold.Text = _( "Threshold silence length(sec)" );
+ this.groupAnotherBehavior.Text = _( "Another settings" );
+ this.chkHeavyOpenCharacterDialog.Text = _( "Use preview-enabled dialog in character selection" );
+ this.btnReloadLanguageConfig.Text = _( "Reload language configurations" );
+ this.groupControl.Text = _( "Operation" );
+ this.lblWheelRatio.Text = _( "mouse wheel rate" );
+ this.chkSyncAtCenter.Text = _( "Fix cursor to center in Sync mode" );
+ }
+
+ public static string _( string s ) {
+ return Messaging.GetMessage( s );
+ }
+
+ private Font ScreenFont {
+ get {
+ return m_config.Font.GetFont();
+ }
+ set {
+ m_config.Font = new FontConfig( value );
+ lblFontName.Text = m_config.Font.GetFont().FontFamily.Name + ", " + m_config.Font.GetFont().SizeInPoints + "pt, " + m_config.Font.GetFont().Style.ToString();
+ }
+ }
+
+ private void btnOK_Click( object sender, EventArgs e ) {
+ m_config.CloseMouthPhoneticSymbols.Clear();
+ foreach ( ListViewItem item in mListClose.Items ) {
+ if ( item.Checked ) {
+ m_config.CloseMouthPhoneticSymbols.Add( item.Text );
+ }
+ }
+
+ m_config.IMouthPhoneticSymbols.Clear();
+ foreach ( ListViewItem item in mListI.Items ) {
+ if ( item.Checked ) {
+ m_config.IMouthPhoneticSymbols.Add( item.Text );
+ }
+ }
+
+ m_config.UMouthPhoneticSymbols.Clear();
+ foreach ( ListViewItem item in mListU.Items ) {
+ if ( item.Checked ) {
+ m_config.UMouthPhoneticSymbols.Add( item.Text );
+ }
+ }
+
+ try {
+ m_config.EntryCombineThreshold = float.Parse( txtCombineThreshold.Text );
+ } catch {
+ MessageBox.Show(
+ _( "Invalid value has been entered" ),
+ _( "Error" ),
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation );
+ this.DialogResult = DialogResult.Cancel;
+ }
+ this.DialogResult = DialogResult.OK;
+ }
+
+ private void EnvConfiguration_Load( object sender, EventArgs e ) {
+ ApplyColorConfig();
+ numEntryHeight.Value = m_config.TrackHeight;
+ txtCombineThreshold.Text = m_config.EntryCombineThreshold + "";
+ }
+
+ private void ApplyColorConfig() {
+ lblTimelineTitleColor.BackColor = m_config.TimeLineTitleColor.Color;
+ lblTimeLineVSQColor.BackColor = m_config.TimeLineVsqColor.Color;
+ lblTimeLinePluginColor.BackColor = m_config.TimeLinePluginColor.Color;
+ lblTimeLineDefaultColor.BackColor = m_config.TimeLineDefaultColor.Color;
+ this.Invalidate();
+ }
+
+ private void btnChangeTimeLineTitle_Click( object sender, EventArgs e ) {
+ colorDialog1.Reset();
+ colorDialog1.Color = m_config.TimeLineTitleColor.Color;
+ if ( colorDialog1.ShowDialog() == DialogResult.OK ) {
+ m_config.TimeLineTitleColor = new ColorSet( colorDialog1.Color );
+ ApplyColorConfig();
+ }
+ }
+
+ private void btnChangeTimeLineVSQ_Click( object sender, EventArgs e ) {
+ colorDialog1.Reset();
+ colorDialog1.Color = m_config.TimeLineVsqColor.Color;
+ if ( colorDialog1.ShowDialog() == DialogResult.OK ) {
+ m_config.TimeLineVsqColor = new ColorSet( colorDialog1.Color );
+ ApplyColorConfig();
+ }
+ }
+
+ private void btnChangeTimeLinePlugin_Click( object sender, EventArgs e ) {
+ colorDialog1.Reset();
+ colorDialog1.Color = m_config.TimeLinePluginColor.Color;
+ if ( colorDialog1.ShowDialog() == DialogResult.OK ) {
+ m_config.TimeLinePluginColor = new ColorSet( colorDialog1.Color );
+ ApplyColorConfig();
+ }
+ }
+
+ private void btnChangeTimeLineDefault_Click( object sender, EventArgs e ) {
+ colorDialog1.Reset();
+ colorDialog1.Color = m_config.TimeLineDefaultColor.Color;
+ if ( colorDialog1.ShowDialog() == DialogResult.OK ) {
+ m_config.TimeLineDefaultColor = new ColorSet( colorDialog1.Color );
+ ApplyColorConfig();
+ }
+ }
+
+ private void btnTimeLineTitleDefault_Click( object sender, EventArgs e ) {
+ m_config.TimeLineTitleColor = new ColorSet( Color.LightPink );
+ ApplyColorConfig();
+ }
+
+ private void btnTimeLineVSQDefault_Click( object sender, EventArgs e ) {
+ m_config.TimeLineVsqColor = new ColorSet( Color.FromArgb( 175, 222, 82 ) );
+ ApplyColorConfig();
+ }
+
+ private void btnTimeLinePluginDefault_Click( object sender, EventArgs e ) {
+ m_config.TimeLinePluginColor = new ColorSet( Color.FromArgb( 255, 184, 51 ) );
+ ApplyColorConfig();
+ }
+
+ private void btnTimeLineDefaultDefault_Click( object sender, EventArgs e ) {
+ m_config.TimeLineDefaultColor = new ColorSet( Color.LightBlue );
+ ApplyColorConfig();
+ }
+
+ private void btnEntryHeightDefault_Click( object sender, EventArgs e ) {
+ m_config.TrackHeight = 18;
+ numEntryHeight.Value = m_config.TrackHeight;
+ }
+
+ private void numEntryHeight_ValueChanged( object sender, EventArgs e ) {
+ m_config.TrackHeight = (int)numEntryHeight.Value;
+ }
+
+ private void btnFFmpeg_Click( object sender, EventArgs e ) {
+ using ( OpenFileDialog dlg = new OpenFileDialog() ) {
+ if ( m_config.PathFFmpeg != "" ) {
+ try {
+ dlg.InitialDirectory = Path.GetDirectoryName( m_config.PathFFmpeg );
+ dlg.FileName = m_config.PathFFmpeg;
+ } catch {
+ }
+ }
+ try {
+ dlg.Filter = _( "Executable file(*.exe)|*.exe" ) + "|" + _( "All Files(*.*)|*.*" );
+ } catch {
+ dlg.Filter = "Executable file(*.exe)|*.exe|All Files(*.*)|*.*";
+ }
+ if ( dlg.ShowDialog() == DialogResult.OK ) {
+ string file = dlg.FileName;
+ if ( File.Exists( file ) ) {
+ txtFFmpeg.Text = file;
+ m_config.PathFFmpeg = file;
+ }
+ }
+ }
+ }
+
+ private void btnMEncoder_Click( object sender, EventArgs e ) {
+ using ( OpenFileDialog dlg = new OpenFileDialog() ) {
+ if ( m_config.PathMEncoder != "" ) {
+ try {
+ dlg.InitialDirectory = Path.GetDirectoryName( m_config.PathMEncoder );
+ dlg.FileName = m_config.PathMEncoder;
+ } catch {
+ }
+ }
+ try {
+ dlg.Filter = _( "Executable file(*.exe)|*.exe" ) + "|" + _( "All Files(*.*)|*.*" );
+ } catch {
+ dlg.Filter = "Executable file(*.exe)|*.exe|All Files(*.*)|*.*";
+ }
+ if ( dlg.ShowDialog() == DialogResult.OK ) {
+ string file = dlg.FileName;
+ if ( File.Exists( file ) ) {
+ txtMEncoder.Text = file;
+ m_config.PathMEncoder = file;
+ }
+ }
+ }
+ }
+
+ public string PathFFmpeg {
+ get {
+ return txtFFmpeg.Text;
+ }
+ set {
+ txtFFmpeg.Text = value;
+ }
+ }
+
+ public string PathMEncoder {
+ get {
+ return txtMEncoder.Text;
+ }
+ set {
+ txtMEncoder.Text = value;
+ }
+ }
+
+ private void btnChangeFont_Click( object sender, EventArgs e ) {
+ fontDialog.Font = ScreenFont;
+ if ( fontDialog.ShowDialog() == DialogResult.OK ) {
+ ScreenFont = fontDialog.Font;
+ }
+ }
+
+ private void btnFontDefault_Click( object sender, EventArgs e ) {
+ ScreenFont = new Font( "MS UI Gothic", 9 );
+ }
+
+ private void btnReloadLanguageConfig_Click( object sender, EventArgs e ) {
+ Messaging.LoadMessages();
+ string current_lang = m_config.Language;
+ comboLanguage.Items.Clear();
+ List list = new List( Messaging.GetRegisteredLanguage() );
+ if ( !list.Contains( current_lang ) ) {
+ current_lang = _DEFAULT_LANGUAGE_STRING;
+ }
+ list.Insert( 0, _DEFAULT_LANGUAGE_STRING );
+ comboLanguage.Items.AddRange( list.ToArray() );
+ for ( int i = 0; i < list.Count; i++ ) {
+ if ( list[i] == current_lang ) {
+ comboLanguage.SelectedIndex = i;
+ break;
+ }
+ }
+ }
+
+ private void comboLanguage_SelectedIndexChanged( object sender, EventArgs e ) {
+ string res = "";
+ if( comboLanguage.SelectedIndex >= 0 ) {
+ res = (string)comboLanguage.Items[comboLanguage.SelectedIndex];
+ }
+ if ( res == _DEFAULT_LANGUAGE_STRING ) {
+ res = "";
+ }
+ m_config.Language = res;
+ }
+
+ private void numWheelRatio_ValueChanged( object sender, EventArgs e ) {
+ m_config.WheelRatio = (float)(1.0 / (double)numWheelRatio.Value);
+ }
+
+ private void btnWheelRatioDefault_Click( object sender, EventArgs e ) {
+ numWheelRatio.Value = 5;
+ }
+
+ public EnvSettings EnvSettings {
+ get {
+ return m_config;
+ }
+ }
+
+ private void chkHeavyOpenCharacterDialog_CheckedChanged( object sender, EventArgs e ) {
+ m_config.UseHeavyDialogInOpeningCharacterSettings = chkHeavyOpenCharacterDialog.Checked;
+ }
+
+ private void chkGenCharacterAutomaticaly_CheckedChanged( object sender, EventArgs e ) {
+ m_config.GenerateCharacterAutomatically = chkGenCharacterAutomaticaly.Checked;
+ }
+
+ private void txtFFmpeg_TextChanged( object sender, EventArgs e ) {
+ m_config.PathFFmpeg = txtFFmpeg.Text;
+ }
+
+ private void txtMEncoder_TextChanged( object sender, EventArgs e ) {
+ m_config.PathMEncoder = txtMEncoder.Text;
+ }
+
+ private void chkSyncAtCenter_CheckedChanged( object sender, EventArgs e ) {
+ m_config.SyncAtCentre = chkSyncAtCenter.Checked;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/EnvSettings.cs b/trunk/LipSync/Editor/EnvSettings.cs
new file mode 100644
index 0000000..efaac18
--- /dev/null
+++ b/trunk/LipSync/Editor/EnvSettings.cs
@@ -0,0 +1,351 @@
+サソ/*
+ * EnvSettings.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Windows.Forms;
+using System.Xml.Serialization;
+
+using Boare.Lib.AppUtil;
+
+namespace LipSync {
+
+ ///
+ /// 謫堺ス懃腸蠅縺ョ險ュ螳壼、繧呈シ邏阪@縺セ縺
+ ///
+ public class EnvSettings : ICloneable{
+ private static XmlSerializer m_xml_serializer = null;
+
+ public float PixelPerSec = 150.0f;
+ public float WheelRatio = 0.2f;
+ public int TimeLineInterval = 5;
+ public Rectangle WindowPosition = new Rectangle( 0, 0, 473, 435 );
+ public bool WindowIsMaximized = false;
+ public Rectangle PreviewWindowPos = new Rectangle( 0, 0, 349, 340 );
+ public Rectangle CurveWindowPos = new Rectangle( 0, 0, 349, 340 );
+ public bool PreviewMaximized = false;
+ public bool CurveMaximized = false;
+ public PictureBoxSizeMode PreviewZoomMode = PictureBoxSizeMode.Zoom;
+ public string Language = "";
+ public ColorSet TimeLineTitleColor = new ColorSet( Color.LightPink );
+ public ColorSet TimeLineVsqColor = new ColorSet( Color.FromArgb( 175, 222, 82 ) );
+ public ColorSet TimeLinePluginColor = new ColorSet( Color.FromArgb( 255, 184, 51 ) );
+ public ColorSet TimeLineDefaultColor = new ColorSet( Color.LightBlue );
+ public string PathFFmpeg = "";
+ public string PathMEncoder = "";
+ public bool PreviewHidden = false;
+ public float LastPreviewAspecto = 0.5f;
+ public FontConfig TelopDefaultFont = new FontConfig( "MS UI Gothic", 18 );
+ public ColorSet TelopDefaultColor = new ColorSet( Color.Black );
+ public bool PropertyHidden = false;
+ public int LastPropertyWidth = 175;
+ public int VerticalStringOffset = 3;
+ public bool CloseMouthWhenSameVowelsRepeated = true;
+ public bool GenerateCharacterAutomatically = true;
+ public float EntryCombineThreshold = 0f;
+ public string LastCharacterPath = "";
+ public string LastMusicPath = "";
+ public string LastVsqPath = "";
+ public bool UseHeavyDialogInOpeningCharacterSettings = false;
+ public bool DrawBars = true;
+ ///
+ /// Vsq繝医Λ繝繧ッ繧貞クク縺ォ陦ィ遉コ縺吶k縺九←縺縺九r陦ィ縺
+ ///
+ public bool FixVsqTrackPosition = false;
+ ///
+ /// 譛蠕後↓菴ソ逕ィ縺輔l縺蘗vi繝輔ぃ繧、繝ォ縺ク縺ョ繝代せ
+ ///
+ public string LastAviPath = "";
+ public FontConfig Font = new FontConfig( "MS UI Gothic", 9 );
+ ///
+ /// 繧ュ繝」繝ゥ繧ッ繧ソ險ュ螳壹ヵ繧。繧、繝ォ縺ョ邱ィ髮譎ゅ↓縲髱呎ュ「逕サ繝輔ぃ繧、繝ォ縺ョ蜷榊燕繧偵◎縺ョ縺セ縺セ逕サ蜒上ョ繧ソ繧、繝医Ν縺ィ縺吶k縺九←縺縺
+ ///
+ public bool FileNameAsImageTitle = true;
+
+ private QuantizeMode m_quantize_mode = QuantizeMode.off; // 髻ウ隨ヲ邱ィ髮譎ゅョ驥丞ュ仙喧繝「繝シ繝
+ private bool m_quantize_triplet = false; // 3騾」隨ヲ繝「繝シ繝峨′譛牙柑縺九←縺縺
+ private bool m_sync_at_centre = true;
+ private int m_track_height = 15;
+ private bool m_save_character_config_outside = false;
+ private List m_close_mouth_phonetic_symbols = new List( new string[] { "b", "p", "m", "b'", "p'", "m'" } );
+ private List m_i_mouth_phonetic_symbols = new List( new string[] { "k'", "g'", "S", "dZ", "tS", "J", "C" } );
+ private List m_u_mouth_phonetic_symbols = new List( new string[] { @"p\", @"p\'", "w", "ts", "dz" } );
+
+ public int TrackHeight {
+ get {
+ return m_track_height;
+ }
+ set {
+ m_track_height = value;
+ Size font_size = Misc.MeasureString( "abQBHqj", Font.GetFont() );
+ VerticalStringOffset = (m_track_height - font_size.Height) / 2;
+ }
+ }
+
+ public static EnvSettings FromFile( string config_file ) {
+ EnvSettings env;
+ if ( File.Exists( config_file ) ) {
+ if ( m_xml_serializer == null ) {
+ m_xml_serializer = new XmlSerializer( typeof( EnvSettings ) );
+ }
+ FileStream fs = null;
+ try {
+ fs = new FileStream( config_file, FileMode.Open );
+ env = (EnvSettings)m_xml_serializer.Deserialize( fs );
+ } catch {
+#if DEBUG
+ Common.DebugWriteLine( "EnvSettings2+FromFile" );
+ Common.DebugWriteLine( " ctor from xml has been failed. trying ctor from EnvSettings." );
+#endif
+ /*if ( fs != null ) {
+ fs.Close();
+ }
+ try {
+ fs = new FileStream( config_file, FileMode.Open );
+ BinaryFormatter bf = new BinaryFormatter();
+ EnvSettings env1 = (EnvSettings)bf.Deserialize( fs );
+ env = new EnvSettings2( env1 );
+ } catch ( Exception ex ){
+#if DEBUG
+ Common.DebugWriteLine( " ex=" + ex.ToString() );
+#endif
+ env = new EnvSettings2();
+ } finally {
+ if ( fs != null ) {
+ fs.Close();
+ }
+ }*/
+ env = new EnvSettings();
+ } finally {
+ if ( fs != null ) {
+ fs.Close();
+ }
+ }
+ } else {
+ env = new EnvSettings();
+ env.Save( config_file );
+ }
+ return env;
+ }
+
+ public EnvSettings() {
+ }
+
+ /*internal EnvSettings2( EnvSettings old ) {
+ PixelPerSec = old.PIXEL_PER_SEC;
+ WheelRatio = old.WHEEL_RATIO;
+ TimeLineInterval = old.TIMELINE_INTERVAL;
+ WindowPosition = old.WINDOW_POS;
+ WindowIsMaximized = old.MAXIMIZED;
+ PreviewWindowPos = old.PREVIEW_WINDOW_POS;
+ CurveWindowPos = new Rectangle( 0, 0, 349, 340 );
+ PreviewMaximized = false;
+ CurveMaximized = false;
+ PreviewZoomMode = old.PREVIEW_PICTUREMODE;
+ if ( old.LANGUAGE == LipSync.Language.ja ) {
+ Language = "ja";
+ } else {
+ Language = "";
+ }
+ TimeLineTitleColor = new ColorSet( old.TIMELINE_TITLE );
+ TimeLineVsqColor = new ColorSet( old.TIMELINE_VSQ_ENTRY );
+ TimeLinePluginColor = new ColorSet( old.TIMELINE_PLUGIN_ENTRY );
+ TimeLineDefaultColor = new ColorSet( old.TIMELINE_DEFAULT_ENTRY );
+ PathFFmpeg = old.PATH_FFMPEG;
+ PathMEncoder = old.PATH_MENCODER;
+ PreviewHidden = old.PREVIEW_HIDDEN;
+ LastPreviewAspecto = old.LAST_ASPECTO;
+ TelopDefaultFont = new FontConfig( old.TELOP_DEFAULT_FONT );
+ TelopDefaultColor = new ColorSet( old.TELOP_DEFAULT_COLOR );
+ PropertyHidden = old.PROPERTY_HIDDEN;
+ LastPropertyWidth = old.LAST_PROPERTY_WIDTH;
+ VerticalStringOffset = old.STRING_OFFSET;
+ CloseMouthWhenSameVowelsRepeated = old.CLOSE_MOUTH_WHEN_SAME_VOWEL_REPEATED;
+ GenerateCharacterAutomatically = old.GEN_CHARACTER_AUTOMATICELY;
+ EntryCombineThreshold = old.COMBINE_THRESHOLD;
+ LastCharacterPath = old.LAST_CHARACTER_PATH;
+ LastMusicPath = old.LAST_MUSIC_PATH;
+ LastVsqPath = old.LAST_VSQ_PATH;
+ UseHeavyDialogInOpeningCharacterSettings = old.USE_HEAVY_DIALOG;
+ DrawBars = true;
+ FixVsqTrackPosition = false;
+ LastAviPath = "";
+ Font = new FontConfig( "MS UI Gothic", 9 );
+ m_quantize_mode = QuantizeMode.off;
+ m_quantize_triplet = false;
+ m_sync_at_centre = true;
+ m_track_height = old.TRACK_HEIGHT;
+ m_save_character_config_outside = false;
+ m_close_mouth_phonetic_symbols = old.LIST_NN;
+ m_i_mouth_phonetic_symbols = old.LIST_I;
+ m_u_mouth_phonetic_symbols = old.LIST_U;
+ }*/
+
+ public void Save( string file ) {
+ if ( m_xml_serializer == null ) {
+ m_xml_serializer = new XmlSerializer( typeof( EnvSettings ) );
+ }
+ using ( FileStream fs = new FileStream( file, FileMode.Create ) ) {
+ m_xml_serializer.Serialize( fs, this );
+ }
+ }
+
+ public bool SaveCharacterConfigOutside {
+ get {
+ return m_save_character_config_outside;
+ }
+ }
+
+ [XmlArrayItem(typeof(string), ElementName="PhoneticSymbol")]
+ public List CloseMouthPhoneticSymbols {
+ get {
+ return m_close_mouth_phonetic_symbols;
+ }
+ set {
+ m_close_mouth_phonetic_symbols = new List( value.ToArray() );
+ }
+ }
+
+ [XmlArrayItem( typeof( string ), ElementName = "PhoneticSymbol" )]
+ public List IMouthPhoneticSymbols {
+ get {
+ return m_i_mouth_phonetic_symbols;
+ }
+ set {
+ m_i_mouth_phonetic_symbols = new List( value.ToArray() );
+ }
+ }
+
+ [XmlArrayItem( typeof( string ), ElementName = "PhoneticSymbol" )]
+ public List UMouthPhoneticSymbols {
+ get {
+ return m_u_mouth_phonetic_symbols;
+ }
+ set {
+ m_u_mouth_phonetic_symbols = new List( value.ToArray() );
+ }
+ }
+
+ public QuantizeMode QuantizeMode {
+ get {
+ return m_quantize_mode;
+ }
+ set {
+ m_quantize_mode = value;
+ }
+ }
+
+ public bool QuantizeTripletEnabled {
+ get {
+ return m_quantize_triplet;
+ }
+ set {
+ m_quantize_triplet = value;
+ }
+ }
+
+ public void CleanUpMouthList() {
+ for ( int i = 0; i < IMouthPhoneticSymbols.Count - 1; i++ ) {
+ bool changed = true;
+ while ( changed ) {
+ changed = false;
+ for ( int j = i + 1; j < IMouthPhoneticSymbols.Count; j++ ) {
+ if ( IMouthPhoneticSymbols[i] == IMouthPhoneticSymbols[j] ) {
+ IMouthPhoneticSymbols.RemoveAt( j );
+ changed = true;
+ break;
+ }
+ }
+ }
+ }
+ for ( int i = 0; i < UMouthPhoneticSymbols.Count - 1; i++ ) {
+ bool changed = true;
+ while ( changed ) {
+ changed = false;
+ for ( int j = i + 1; j < UMouthPhoneticSymbols.Count; j++ ) {
+ if ( UMouthPhoneticSymbols[i] == UMouthPhoneticSymbols[j] ) {
+ UMouthPhoneticSymbols.RemoveAt( j );
+ changed = true;
+ break;
+ }
+ }
+ }
+ }
+ for ( int i = 0; i < CloseMouthPhoneticSymbols.Count - 1; i++ ) {
+ bool changed = true;
+ while ( changed ) {
+ changed = false;
+ for ( int j = i + 1; j < CloseMouthPhoneticSymbols.Count; j++ ) {
+ if ( CloseMouthPhoneticSymbols[i] == CloseMouthPhoneticSymbols[j] ) {
+ CloseMouthPhoneticSymbols.RemoveAt( j );
+ changed = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public bool SyncAtCentre {
+ get {
+ return m_sync_at_centre;
+ }
+ set {
+ m_sync_at_centre = value;
+ }
+ }
+
+ public object Clone() {
+ EnvSettings res = new EnvSettings();
+ res.CloseMouthWhenSameVowelsRepeated = this.CloseMouthWhenSameVowelsRepeated;
+ res.EntryCombineThreshold = this.EntryCombineThreshold;
+ res.GenerateCharacterAutomatically = this.GenerateCharacterAutomatically;
+ res.Language = this.Language;
+ res.LastPreviewAspecto = this.LastPreviewAspecto;
+ res.LastCharacterPath = this.LastCharacterPath;
+ res.LastMusicPath = this.LastMusicPath;
+ res.LastPropertyWidth = this.LastPropertyWidth;
+ res.LastVsqPath = this.LastVsqPath;
+ res.IMouthPhoneticSymbols = new List( this.IMouthPhoneticSymbols.ToArray() );
+ res.CloseMouthPhoneticSymbols = new List( this.CloseMouthPhoneticSymbols.ToArray() );
+ res.UMouthPhoneticSymbols = new List( this.UMouthPhoneticSymbols.ToArray() );
+ res.WindowIsMaximized = this.WindowIsMaximized;
+ res.PathFFmpeg = this.PathFFmpeg;
+ res.PathMEncoder = this.PathMEncoder;
+ res.PixelPerSec = this.PixelPerSec;
+ res.PreviewZoomMode = this.PreviewZoomMode;
+ res.PropertyHidden = this.PropertyHidden;
+ res.Font = (FontConfig)this.Font.Clone();
+ res.VerticalStringOffset = this.VerticalStringOffset;
+ res.TelopDefaultColor = this.TelopDefaultColor;
+ res.TelopDefaultFont = this.TelopDefaultFont;
+ res.TimeLineDefaultColor = this.TimeLineDefaultColor;
+ res.TimeLineInterval = this.TimeLineInterval;
+ res.TimeLinePluginColor = this.TimeLinePluginColor;
+ res.TimeLineTitleColor = this.TimeLineTitleColor;
+ res.TimeLineVsqColor = this.TimeLineVsqColor;
+ res.TrackHeight = this.TrackHeight;
+ res.UseHeavyDialogInOpeningCharacterSettings = this.UseHeavyDialogInOpeningCharacterSettings;
+ res.WheelRatio = this.WheelRatio;
+ res.WindowPosition = this.WindowPosition;
+ res.DrawBars = this.DrawBars;
+ res.m_quantize_mode = this.m_quantize_mode;
+ res.m_quantize_triplet = this.m_quantize_triplet;
+ res.m_sync_at_centre = this.m_sync_at_centre;
+ return res;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/FontConfig.cs b/trunk/LipSync/Editor/FontConfig.cs
new file mode 100644
index 0000000..ed9af3c
--- /dev/null
+++ b/trunk/LipSync/Editor/FontConfig.cs
@@ -0,0 +1,89 @@
+サソ/*
+ * FontConfig.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Drawing;
+
+namespace LipSync {
+
+ ///
+ /// 繝輔か繝ウ繝医ョ險ュ螳壼、繧湛mlSerializer縺ァ"鄒弱@縺"譬シ邏阪☆繧九◆繧√ョ繧ッ繝ゥ繧ケ
+ ///
+ public class FontConfig : ICloneable{
+ string m_font_family;
+ FontStyle m_font_style;
+ float m_font_size;
+ Font m_font = null;
+
+ public string Family {
+ get {
+ return m_font_family;
+ }
+ set {
+ m_font_family = value;
+ }
+ }
+
+ public string Style {
+ get {
+ return m_font_style + "";
+ }
+ set {
+ m_font_style = (FontStyle)System.Enum.Parse( typeof( FontStyle ), value );
+ }
+ }
+
+ public float Size {
+ get {
+ return m_font_size;
+ }
+ set {
+ m_font_size = value;
+ }
+ }
+
+ public FontConfig() {
+ m_font_family = "MS UI Gothic";
+ m_font_style = FontStyle.Regular;
+ m_font_size = 18;
+ }
+
+ public FontConfig( Font value ) {
+ m_font_family = value.FontFamily.Name;
+ m_font_style = value.Style;
+ m_font_size = value.Size;
+ }
+
+ public FontConfig( string family, float size ) {
+ m_font_family = family;
+ m_font_size = size;
+ m_font_style = FontStyle.Regular;
+ }
+
+ public Font GetFont() {
+ if ( m_font == null ) {
+ m_font = new Font( m_font_family, m_font_size, m_font_style );
+ }
+ return m_font;
+ }
+
+ public object Clone() {
+ FontConfig ret = new FontConfig();
+ ret.m_font_family = m_font_family;
+ ret.m_font_size = m_font_size;
+ ret.m_font_style = m_font_style;
+ return ret;
+ }
+ }
+
+}
diff --git a/trunk/LipSync/Editor/Form1.cs b/trunk/LipSync/Editor/Form1.cs
new file mode 100644
index 0000000..be51d96
--- /dev/null
+++ b/trunk/LipSync/Editor/Form1.cs
@@ -0,0 +1,3727 @@
+サソ/*
+ * Form1.cs
+ * Copyright (c) 2007-2009 kbinani
+ *
+ * This file is part of LipSync.
+ *
+ * LipSync is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * LipSync is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+using Boare.Lib.AppUtil;
+using Boare.Lib.Media;
+using Boare.Lib.Vsq;
+using Plugin;
+#if DEBUG
+using Boare.Lib.Swf;
+#endif
+
+namespace LipSync {
+
+ public partial class Form1 : Form, IMultiLanguageControl {
+ #region Constants
+ private const byte FILEFORMAT = 1;
+ ///
+ /// 繝励Ξ繝薙Η繝シ縺ィ繧ソ繧、繝繝ゥ繧、繝ウ縺ョ繧キ繝ウ繧ッ繝ュ繧定。後≧縺ィ縺阪∵ャ。縺ョ逕サ髱「縺ク遘サ蜍輔☆繧区凾縺ョ荳。蛛エ縺ョ驥崎、驛ィ蛻縺ョ蟷
+ ///
+ private const float SIDE_WIDTH = 0.15f;
+ ///
+ /// m_editHandleLeft, Right縺ョ蟷
+ ///
+ private const int HANDLE_WIDTH = 8;
+ ///
+ /// 閾ェ蜍輔せ繧ッ繝ュ繝シ繝ォ驕ゥ逕ィ逶エ蠕後∫判髱「縺ョ荳ュ螟ョ縺後∫樟蝨ィ縺ョ蜀咲函譎ょ綾菴咲スョ縺セ縺ァ貊代i縺九↓遘サ蜍輔☆繧九ヶ繝ャ繝ウ繝画凾髢
+ ///
+ private const float FIT_CENTER_BREND_TIME = 2f;
+ const int BUF_LEN = 10;
+ #endregion
+
+ #region Static Readonly Field
+ private static readonly AuthorListEntry[] m_credit = new AuthorListEntry[]{
+ new AuthorListEntry( "is developped by:", FontStyle.Italic ),
+ new AuthorListEntry( "kbinani" ),
+ new AuthorListEntry( "and he thanks to:", FontStyle.Italic ),
+ new AuthorListEntry(),
+ new AuthorListEntry( "author of embedded character", FontStyle.Italic ),
+ new AuthorListEntry( "縺輔↑繧" ),
+ new AuthorListEntry(),
+ new AuthorListEntry( "contributors", FontStyle.Italic ),
+ new AuthorListEntry( "evm" ),
+ new AuthorListEntry( "驤エ譚大━" ),
+ new AuthorListEntry( "縺昴m縺昴mP" ),
+ new AuthorListEntry( "繧√′縺ュシ托シ托シ" ),
+ new AuthorListEntry( "荳顔キ" ),
+ new AuthorListEntry( "NOIKE" ),
+ new AuthorListEntry( "騾莠。閠" ),
+ new AuthorListEntry(),
+ new AuthorListEntry( "translator", FontStyle.Italic ),
+ new AuthorListEntry( "E-Avalance" ),
+ new AuthorListEntry(),
+ new AuthorListEntry( "bugs and suggestions reporters", FontStyle.Italic ),
+ new AuthorListEntry( "縺繧薙■繧繧" ),
+ new AuthorListEntry( "轣ー" ),
+ new AuthorListEntry( "sanryo" ),
+ new AuthorListEntry( "繧縺ェ縺弱′縺繧" ),
+ new AuthorListEntry( "elthy" ),
+ new AuthorListEntry( "fyfy" ),
+ new AuthorListEntry( "k-roh" ),
+ new AuthorListEntry( "縺輔∴" ),
+ new AuthorListEntry( "荳顔キ" ),
+ new AuthorListEntry( "MI" ),
+ new AuthorListEntry( "縺サ縺ィ縺サ縺ィ" ),
+ new AuthorListEntry( "IGASIO" ),
+ new AuthorListEntry( "PEX" ),
+ new AuthorListEntry(),
+ new AuthorListEntry( "and you.", FontStyle.Bold | FontStyle.Italic ),
+ };
+ private static readonly Pen HILIGHT = new Pen( Color.Gray, 2 );
+ private static readonly Pen HILIGHT_EDIT = new Pen( Color.Red, 2 );
+ private static readonly Color REPEAT_AREA = Color.FromArgb( 105, 139, 105 );
+ private static readonly Pen _PEN_123_123_123 = new Pen( Color.FromArgb( 123, 123, 123 ) );
+ private static readonly SolidBrush _BRS_TRACKBG_ODD = new SolidBrush( Color.FromArgb( 240, 240, 240 ) );
+ private static readonly SolidBrush _BRS_TRACKBG_EVEN = new SolidBrush( Color.FromArgb( 212, 212, 212 ) );
+ private static readonly SolidBrush _BRS_TRACK_NAME = new SolidBrush( Color.FromArgb( 80, 80, 80 ) );
+ private static readonly Pen _PEN_BOUNDS = new Pen( new HatchBrush( HatchStyle.Percent50, Color.Black, Color.White ), 4 );
+ private static readonly Pen _PEN_FIXED_BOUNDS = new Pen( new HatchBrush( HatchStyle.Percent50, Color.Red, Color.White ), 4 );
+ #endregion
+
+ #region Static Field
+ //private static Color CANVAS_BACKGROUND_HILIGHT = Color.Black;
+ #endregion
+
+ #region Field
+ ///
+ /// 繝輔ぃ繧、繝ォ縺ォ縺ッ菫晏ュ倥&繧後※縺縺溘′縲∫樟蝨ィ縺ョ迺ー蠅縺ァ縺ッ菴ソ縺医↑縺繝励Λ繧ー繧、繝ウ縺ョ繝医Λ繝繧ッ諠蝣ア縲
+ /// 隱ュ霎シ譎ゅ↓蛻、螳壹@縺ヲ菴懈舌@縲∽ソ晏ュ俶凾縺ォ縺ッ荳蠢應ソ晏ュ倥☆繧九
+ ///
+ private List m_not_used_plugin = new List();
+ private List m_not_used_plugin_config = new List();
+ ///
+ /// 螟画峩蜿ッ閭ス縺ェ險ュ螳壼、
+ ///
+ //private EnvSettings AppManager.Config = new EnvSettings();
+ private Color TRIANGLE_COLOR = Color.SteelBlue;
+ ///
+ /// pictureBox1荳翫ョ繝槭え繧ケ縺ョ菴咲スョ
+ ///
+ private Point m_mousePosition;
+ ///
+ /// pictureBox1荳翫ョ繧ッ繝ェ繝繧ッ縺輔l縺溘い繧、繝繝縺ョ蝣エ謇
+ ///
+ private Item m_clicked;
+ private Rectangle m_rcHilight;
+ ///
+ /// 繧ィ繝ウ繝医Μ縺ョ邱ィ髮繝「繝シ繝峨〒縲√槭え繧ケ繧ォ繝シ繧ス繝ォ繧貞、画峩縺吶k縺ケ縺阪お繝ェ繧「
+ ///
+ private Rectangle m_editHandleLeft = new Rectangle();
+ private Rectangle m_editHandleRight = new Rectangle();
+ private Item m_edit_handle_ed_item;
+ private string m_filePath = "";
+ private int m_startToDrawX = 0;
+ private int m_startToDrawY = 0;
+ private PointF m_expandRange;
+ private bool m_initialized = false;
+ //private bool m_edited = false;
+ ///
+ /// 繧ウ繝斐シ縺輔l縺溘ち繧、繝繝繝シ繝悶Ν
+ ///
+ private TimeTable m_copied_timetable = null;
+ private Color TOOL_COLOR = Color.DarkGray;
+ ///
+ /// 繝医Λ繝繧ッ荳翫ョ繝峨Λ繝繧ー縺ォ繧医j繧ィ繝ウ繝医Μ繧定ソス蜉縺吶k繧ゅシ縺ゥ荳ュ縺ォ菫晄戟縺輔l繧九√b縺ィ繧ゅ→縺ョ繧ソ繧、繝繝繝シ繝悶Ν繧ー繝ォ繝シ繝励ョ繧ュ繝」繝繧キ繝・
+ ///
+ private TimeTableGroup m_editing_group;
+ ///
+ /// 繝峨Λ繝繧ー荳ュ縺ョ繧「繧、繝繝
+ ///
+ private Item m_dragging;
+ private float m_editing_t1, m_editing_t2;
+ private TimeTableEntry m_copied_entry = null;
+ private Telop m_copied_telop = null;
+ private Item m_copied;
+ private EditMode m_edit_mode = EditMode.None;
+ ///
+ /// 繝峨Λ繝繧ー縺ォ繧医j繧ィ繝ウ繝医Μ繧偵せ繝ゥ繧、繝峨☆繧九Δ繝シ繝峨〒縲√せ繝ゥ繧、繝蛾幕蟋句燕縺ョ縲√お繝ウ繝医Μ縺ョ繧ゅ→繧ゅ→縺ョbegin譎ょ綾
+ ///
+ private TimeTableEntry m_slide_original = null;
+ private bool m_slide_moved = false;
+ //private float m_total_memory = 0f;
+#if DEBUG
+ private long m_counter = 0L;
+#endif
+ private DateTime m_preview_time;
+ private VersionInfo m_version_form = null;
+
+ private bool m_avi_writing = false;
+ private Keys m_last_key = Keys.None;
+ private int m_realtime_group = 0;
+ private int m_realtime_track;
+ private int m_realtime_entry;
+ private DisplacementControl m_curve;
+ private bool m_is_repeat_mode = false;
+ ///
+ /// Paint繧、繝吶Φ繝医r繧ケ繧ュ繝繝励☆繧句ソ隕√ョ縺ゅk譎Urue
+ ///
+ private bool m_skip_paint = false;
+ ///
+ /// 繧ッ繧ェ繝ウ繧ソ繧、繧コ縺吶k髫帙ョ繧ー繝ェ繝繝画凾蛻サ縺ョ繝ェ繧ケ繝医ゅせ繧ッ繝ュ繝シ繝ォ繝舌シ縺檎ァサ蜍輔@縺滓凾縲∵峩譁ー
+ ///
+ private float[] m_grids;
+ ///
+ /// VSQ繝医Λ繝繧ッ繧貞崋螳夊。ィ遉コ縺吶k蝣エ蜷医ョ縲〃SQ繝医Λ繝繧ッ陦ィ遉コ驛ィ蛻縺ョ鬮倥&
+ ///
+ private int m_vsq_height = 0;
+ private FormPreview m_form_preview;
+ bool m_avi_cancel = false;
+ Thread m_stdout;
+ Process m_ffmpeg;
+ Process m_mencoder;
+ bool m_is_rawmode = false;
+ private int m_current_frame = 0;
+ private MediaPlayer m_player;
+ private ZorderItem m_editing_item = null;
+ private EditingBounds m_editing = new EditingBounds();
+ ///
+ /// 譛蛻晉判蜒上′繧ッ繝ェ繝繧ッ縺輔l縺滉ス咲スョ縺ョ縲∫判蜒丞コァ讓咏ウサ縺ァ縺ョ菴咲スョ
+ ///
+ private Point m_base_point;
+ ///
+ /// 逕サ蜒上′繧ッ繝ェ繝繧ッ縺輔l縺滓凾轤ケ縺ァ縺ョ縲√◎縺ョ逕サ蜒上ョ菴咲スョ險ュ螳壽ュ蝣ア
+ ///
+ private Point m_init_position;
+ ///
+ /// 繝繧ュ繧ケ繝医お繝繧」繝繝医Δ繝シ繝
+ ///
+ bool m_text_edit = false;
+ ///
+ /// 邱ィ髮荳ュ縺ョ繝繧ュ繧ケ繝
+ ///
+ TextBox m_text = null;
+ ///
+ /// 繧ェ繝ェ繧ク繝翫Ν縺ョ繝繧ュ繧ケ繝
+ ///
+ string m_text_original;
+ ///
+ /// 邱ィ髮縺励※縺繧九ユ繧ュ繧ケ繝医ョID
+ ///
+ int m_text_id;
+ double[] m_buf = new double[BUF_LEN];
+ double m_fps;
+ DateTime m_last_ignitted = new DateTime();
+ private DateTime m_started_date;
+ private Thread m_preview_thread = null;
+ private BSplitContainer m_panels;
+ private Telop m_editing_telop_original = null;
+ #endregion
+
+ private delegate void ChangeTitleTextDelegate( string encoder_type, int percent, int current_frame, int max_frames );
+ private delegate void ForceScreenUpdateDelegate();
+ private delegate void Form1_AviWritingChange( bool value );
+
+ public Form1( string file ) {
+ AppManager.SaveData = new SettingsEx();
+ m_filePath = file;
+ InitializeComponent();
+
+ m_panels = new BSplitContainer();
+
+ // m_panels
+ m_panels.Name = "m_panels";
+ m_panels.Orientation = Orientation.Vertical;
+ m_panels.Panel1.BorderColor = SystemColors.ControlDark;
+ m_panels.Panel1.BorderStyle = BorderStyle.FixedSingle;
+ m_panels.Panel2.BorderColor = SystemColors.ControlDark;
+ m_panels.Panel2.BorderStyle = BorderStyle.FixedSingle;
+ m_panels.FixedPanel = FixedPanel.Panel1;
+ m_panels.Panel1.Controls.Add( previewer );
+ m_panels.Panel2.Controls.AddRange( new Control[]{ side,
+ pictureBox1,
+ hScrollBar1,
+ vScrollBar1,
+ pictureBox2,
+ preview_image } );
+ m_panels.Panel1MinSize = 0;
+ m_panels.Panel2.SizeChanged += new EventHandler( Panel2_SizeChanged );
+ m_container.FixedPanel = FixedPanel.Panel1;
+ m_container.Panel1.Controls.Add( property );
+ m_container.Panel2.Controls.Add( m_panels );
+ m_panels.Dock = DockStyle.Fill;
+ property.Dock = DockStyle.Fill;
+ previewer.Dock = DockStyle.Fill;
+
+ this.pictureBox1.MouseWheel += new MouseEventHandler( pictureBox1_MouseWheel );
+ m_player = new MediaPlayer();
+ previewer.TrackVolumeValue = m_player.Volume;
+ Messaging.LoadMessages();
+ LoadConfig();
+ this.SizeChanged += new EventHandler( Form1_LocationOrSizeChanged );
+ this.LocationChanged += new EventHandler( Form1_LocationOrSizeChanged );
+ AppManager.EditedChanged += new EventHandler( AppManager_EditedChanged );
+ m_form_preview = new FormPreview();
+ m_form_preview.FormClosing += new FormClosingEventHandler( m_form_preview_FormClosing );
+ m_curve = new DisplacementControl();
+ m_curve.FormClosing += new FormClosingEventHandler( m_curve_FormClosing );
+ menuVisualVsqTrack.Checked = AppManager.Config.FixVsqTrackPosition;
+ ApplyLanguage();
+ }
+
+ private void m_curve_FormClosing( object sender, FormClosingEventArgs e ) {
+ e.Cancel = true;
+ menuVisualTransform.Checked = false;
+ }
+
+ private void AppManager_EditedChanged( object sender, EventArgs e ) {
+ UpdateFormTitle();
+ UpdateObjectList();
+ menuEditRedo.Enabled = AppManager.IsRedoAvailable; //Execute縺ィResiter縺碁屬繧後※縺繧九ョ縺ァシ後%縺薙〒譖エ譁ー縺吶k蠢隕√′縺ゅk
+ menuEditUndo.Enabled = AppManager.IsUndoAvailable;
+ if ( AppManager.Edited ) {
+ this.Invalidate();
+ }
+ }
+
+ private void Panel2_SizeChanged( object sender, EventArgs e ) {
+ ResizePanel2();
+ }
+
+ private void m_form_preview_FormClosing( object sender, FormClosingEventArgs e ) {
+ e.Cancel = true;
+ m_form_preview.Hide();
+ previewer.Parent = m_panels.Panel1;
+ int total_height = m_panels.Panel1.Height + m_panels.Panel2.Height;
+ int new_distance = (int)(total_height * AppManager.Config.LastPreviewAspecto);
+ m_panels.SplitterDistance = new_distance;
+ m_panels.IsSplitterFixed = false;
+ menuVisualPreviewSeparate.Checked = false;
+ }
+
+ #region property
+ private void property_TelopDeleting( ZorderItem e ) {
+#if DEBUG
+ Common.DebugWriteLine( "property1_TelopDeleting" );
+ Common.DebugWriteLine( " e.Type=" + e.Type );
+#endif
+ if ( e.Type == ZorderItemType.telop ) {
+ Command run = Command.GCommandDeleteTelop( AppManager.SaveData[e.Index] );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ Telop.DecideLane( AppManager.SaveData.m_telop_ex2 );
+ property.Editing = null;
+ if ( m_curve.comboObjects.SelectedItem != null ){
+ TagForTreeNode t = (TagForTreeNode)m_curve.comboObjects.SelectedItem;
+ if ( t.type == ZorderItemType.telop && t.id_or_index == e.Index ) {
+ m_curve.SetSelectedNone();
+ }
+ }
+ SetVScrollRange();
+ }
+ }
+
+ private void property_EditingItemChanged( ZorderItem item ) {
+#if DEBUG
+ Common.DebugWriteLine( "property1_EditingItemChanged" );
+#endif
+ if ( item != null ) {
+ switch ( item.Type ) {
+ case ZorderItemType.another:
+ property.SelectedObject = AppManager.SaveData.m_group_another[item.Index].Clone();
+ break;
+ case ZorderItemType.character:
+ property.SelectedObject = AppManager.SaveData.m_groups_character[item.Index].Clone();
+ break;
+ case ZorderItemType.telop:
+ //Telop.DecideLane( AppManager.SaveData.m_telop_ex2 );
+ property.SelectedObject = AppManager.SaveData[item.Index].Clone();
+ break;
+ }
+ } else {
+ property.SelectedObject = null;
+ }
+ }
+
+ private void property_TelopAdding() {
+ h_addTelop( this, new EventArgs() );
+ }
+
+ private void property_PropertyValueChanged( object sender, PropertyValueChangedEventArgs e ) {
+#if DEBUG
+ Common.DebugWriteLine( "property1_PropertyValueChanged(object,PropertyValueChangedEventArgs)" );
+#endif
+ int target = property.Editing.Index;
+ string start = "";
+ string type = "";
+ string name = "";
+
+#if DEBUG
+ Common.DebugWriteLine( " (property1.SelectedObject is TimeTable) =" + (property.SelectedObject is TimeTable) );
+ Common.DebugWriteLine( " (property1.SelectedObject is TimeTableGroup)=" + (property.SelectedObject is TimeTableGroup) );
+ Common.DebugWriteLine( " (property1.SelectedObject is Telop) =" + (property.SelectedObject is Telop) );
+#endif
+ // property1.SelectedObject縺ッシ後◎繧後◇繧後ョ邱ィ髮蟇セ雎。縺ョ蜊倥↑繧九け繝ュ繝シ繝ウ縺ェ縺ョ縺ァシ
+ // 螟画峩縺輔l縺溘iCommand繧剃スソ縺」縺ヲ譛ャ菴薙r譖エ譁ー縺吶k蠢隕√′縺ゅk
+ if ( property.SelectedObject is TimeTable ) {
+ Command run = Command.GCommandEditTimeTable( TimeTableType.another, -1, target, (TimeTable)property.SelectedObject );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ start = AppManager.SaveData[TimeTableType.another, -1].GetFirstOn( target ) + "";
+ type = "another";
+ name = AppManager.SaveData[TimeTableType.another, -1][target].Text;
+ } else if ( property.SelectedObject is TimeTableGroup ) {
+ Command run = Command.GCommandEditGroup( TimeTableType.character, target, (TimeTableGroup)property.SelectedObject );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ start = "" + AppManager.SaveData[TimeTableType.character, target].GetFirstOn();
+ type = "character";
+ name = AppManager.SaveData[TimeTableType.character, target].Text;
+ } else if ( property.SelectedObject is Telop ) {
+ Command run = Command.GCommandEditTelop( target, (Telop)property.SelectedObject );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ start = "" + AppManager.SaveData[target].Start;
+ type = "telop";
+ name = AppManager.SaveData[target].Text;
+ }
+
+ // property1.ListView縺ョ陦ィ遉コ蜀螳ケ繧呈峩譁ー
+ ZorderItem editing = property.Editing;
+#if DEBUG
+ Common.DebugWriteLine( " editing.Type=" + editing.Type );
+ Common.DebugWriteLine( " editing.Index=" + editing.Index );
+ Common.DebugWriteLine( " editing.Name=" + editing.Name );
+ bool found = false;
+#endif
+ foreach ( ListViewItem item in property.ListView.Items ) {
+ if ( item.Tag is ZorderItem ) {
+ ZorderItem zitem = (ZorderItem)item.Tag;
+ if ( zitem.Type == editing.Type && zitem.Index == editing.Index ) {
+ item.SubItems[0].Text = start;
+ item.SubItems[1].Text = type;
+ item.SubItems[2].Text = name;
+#if DEBUG
+ found = true;
+#endif
+ break;
+ }
+ }
+ }
+
+#if DEBUG
+ Common.DebugWriteLine( "found=" + found );
+#endif
+ UpdateEditHandle();
+ AppManager.Edited = true;
+ }
+ #endregion
+
+ #region hScrollBar1
+ private void hScrollBar1_Scroll( object sender, ScrollEventArgs e ) {
+ m_startToDrawX = StartToDrawX();
+ UpdateGridList();
+ pictureBox1.Invalidate();
+ }
+ #endregion
+
+ private void vScrollBar1_Scroll( object sender, ScrollEventArgs e ) {
+ m_startToDrawY = StartToDrawY();
+ side.Refresh();
+ pictureBox1.Refresh();
+ }
+
+ #region pictureBox1
+ private void pictureBox1_MouseWheel( object sender, MouseEventArgs e ) {
+ if ( (Control.ModifierKeys & Keys.Shift) == Keys.Shift ) {
+ if ( vScrollBar1.Enabled ) {
+ int prev = vScrollBar1.Value;
+ float add = -(float)e.Delta / AppManager.Config.WheelRatio;
+ int set = (int)((float)prev + add);
+ if ( set > vScrollBar1.Maximum + 1 - vScrollBar1.LargeChange ) {
+ set = vScrollBar1.Maximum + 1 - vScrollBar1.LargeChange;
+ } else if ( set < vScrollBar1.Minimum ) {
+ set = vScrollBar1.Minimum;
+ }
+ if ( prev != set ) {
+ vScrollBar1.Value = set;
+ m_startToDrawY = StartToDrawY();
+ pictureBox1.Invalidate();
+ side.Invalidate();
+ }
+ }
+ } else {
+ if ( hScrollBar1.Enabled ) {
+ int prev = hScrollBar1.Value;
+ float add = -(float)e.Delta / AppManager.Config.WheelRatio;
+ int set = (int)((float)prev + add);
+ if ( set > hScrollBar1.Maximum + 1 - hScrollBar1.LargeChange ) {
+ set = hScrollBar1.Maximum + 1 - hScrollBar1.LargeChange;
+ } else if ( set < hScrollBar1.Minimum ) {
+ set = hScrollBar1.Minimum;
+ }
+ if ( prev != set ) {
+ hScrollBar1.Value = set;
+ m_startToDrawX = StartToDrawX();
+ pictureBox1.Invalidate();
+ }
+ UpdateGridList();
+ }
+ }
+ }
+
+ private void pictureBox1_PreviewKeyDown( object sender, PreviewKeyDownEventArgs e ) {
+ if ( e.KeyCode == Keys.Delete ) {
+ DeleteEntry();
+ }
+ if ( AppManager.Playing && menuEditRealTime.Checked ) {
+ if ( m_last_key == e.KeyCode ) {
+ return;
+ }
+ string target = "";
+ float m_end = Now;
+ switch ( e.KeyCode ) {
+ case Keys.A:
+ target = "a";
+ break;
+ case Keys.I:
+ target = "i";
+ break;
+ case Keys.U:
+ target = "u";
+ break;
+ case Keys.E:
+ target = "e";
+ break;
+ case Keys.O:
+ target = "o";
+ break;
+ case Keys.Space:
+ if ( m_last_key != Keys.None ) {
+ TimeTableEntry tte = (TimeTableEntry)AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track][m_realtime_entry].Clone();
+ tte.end = m_end;
+ AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track][m_realtime_entry].end = m_end;
+ AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track].RemoveAt( m_realtime_entry );
+ Command run = Command.GCommandAddTimeTableEntry( TimeTableType.character,
+ m_realtime_group,
+ m_realtime_track,
+ tte );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ }
+ m_last_key = Keys.None;
+ return;
+ default:
+ return;
+ }
+ //縺セ縺壹∫峩蜑阪↓蜈・蜉帙&繧後◆繧ィ繝ウ繝医Μ繧堤オゆコ縺輔○繧句ヲ逅
+ if ( m_last_key != Keys.None ) {
+ TimeTableEntry tte = (TimeTableEntry)AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track][m_realtime_entry].Clone();
+ tte.end = m_end;
+ AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track].RemoveAt( m_realtime_entry );
+ Command run = Command.GCommandAddTimeTableEntry( TimeTableType.character,
+ m_realtime_group,
+ m_realtime_track,
+ tte );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ }
+ //莉翫@縺後◆謚シ縺輔l縺溘く繝シ縺ォ蟇セ蠢懊☆繧九お繝ウ繝医Μ繧定ソス蜉縲
+ for ( int i = 0; i < AppManager.SaveData.m_groups_character[m_realtime_group].Count; i++ ) {
+ if ( AppManager.SaveData.m_groups_character[m_realtime_group][i].Text == target ) {
+ m_realtime_track = i;
+ break;
+ }
+ }
+ AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track].Add( new TimeTableEntry( m_end, m_end, target ) );
+ AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track].Sort();
+ //sort縺励◆縺ョ縺ァm_realtime_entry繧呈、懃エ「縺ァ謗「縺
+ for ( int entry = 0; entry < AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track].Count; entry++ ) {
+ if ( AppManager.SaveData.m_groups_character[m_realtime_group][m_realtime_track][entry].begin == m_end ) {
+ m_realtime_entry = entry;
+ break;
+ }
+ }
+ m_last_key = e.KeyCode;
+ }
+ }
+
+ private void pictureBox1_MouseClick( object sender, MouseEventArgs e ) {
+ m_mousePosition.X = e.X;
+ m_mousePosition.Y = e.Y;
+
+ if ( e.Button == MouseButtons.Right ) {
+ if ( 0 <= e.Y && e.Y <= AppManager.Config.TrackHeight ) {
+ cmenuRepeat.Show( pictureBox1, e.X, e.Y );
+ return;
+ }
+ }
+
+ if ( m_edit_mode == EditMode.Dragging ) {
+ return;
+ }
+
+ if ( m_edit_mode == EditMode.Sliding ) {
+ if ( m_slide_moved ) {
+ return;
+ }
+ m_edit_mode = EditMode.None;
+ }
+
+ if ( m_edit_mode == EditMode.Selected ) {
+ if ( e.Button == MouseButtons.Right ) {
+ m_edit_mode = EditMode.None;
+ }
+ }
+
+ if ( m_edit_mode == EditMode.None/*!m_editMode*/ ) {
+ m_clicked = GetGroupItem( m_mousePosition.X + m_startToDrawX, m_mousePosition.Y + m_startToDrawY );
+ if ( e.Button == MouseButtons.Right ) {
+ #region 蜿ウ繧ッ繝ェ繝繧ッ
+ m_edit_mode = EditMode.None;
+ int group = m_clicked.group;
+ int track = m_clicked.track;
+ int entry = m_clicked.entry;
+
+ if ( !cmenu.IsDisposed || cmenu != null ) {
+ cmenu.Dispose();
+ }
+ cmenu = new ContextMenuStrip();
+ cmenu.RenderMode = ToolStripRenderMode.ManagerRenderMode;
+ cmenu.ShowCheckMargin = false;
+ cmenu.ShowImageMargin = false;
+ cmenu.Font = AppManager.Config.Font.GetFont();
+
+ if ( m_clicked.type == TimeTableType.top ) {
+ return;
+ }
+ if ( group < 0 ) {
+ cmenu.Items.Add( _( "Video size configuration" ),
+ null,
+ new EventHandler( h_setVideoSize ) );
+ } else {
+ if ( track < 0 ) {
+ #region 繧ソ繧、繝医Ν縺後け繝ェ繝繧ッ縺輔l縺溘→縺
+ switch ( m_clicked.type ) {
+ case TimeTableType.vsq:
+ cmenu.Items.Add( _( "Read from VSQ file" ), null, new EventHandler( h_readVsq ) );
+ break;
+ case TimeTableType.character:
+ if ( AppManager.SaveData.m_groups_character[group].Character != null ) {
+ cmenu.Items.Add( _( "Edit character" ), null, new EventHandler( h_editCharacter ) );
+ if ( AppManager.SaveData.m_groups_character[group].Character.Type == CharacterType.def ) {
+ cmenu.Items.Add( "-" );
+ cmenu.Items.Add( _( "Preview image" ), null, new EventHandler( h_previewImage ) );
+ cmenu.Items.Add( _( "Image placement" ), null, new EventHandler( h_setImagePosition ) );
+ cmenu.Items.Add( _( "Scale setting" ), null, new EventHandler( h_setScale ) );
+ cmenu.Items.Add( "-" );
+ cmenu.Items.Add( _( "Generate wink" ), null, new EventHandler( h_addWink ) );
+ }
+ }
+ cmenu.Items.Add( "-" );
+ cmenu.Items.Add( _( "Delete" ), null, new EventHandler( h_deleteTrack ) );
+ break;
+ case TimeTableType.telop:
+ cmenu.Items.Add( _( "Add Telop" ), null, new EventHandler( h_addTelop ) );
+ break;
+ case TimeTableType.another:
+ cmenu.Items.Add( _( "Add track" ), null, new EventHandler( h_addTrack ) );
+ break;
+ }
+ #endregion
+ } else {
+ bool copy_enabled = true;
+ if ( entry < 0 ) {
+ #region 繝医Λ繝繧ッ縺後け繝ェ繝繧ッ縺輔l縺溘→縺
+ switch ( m_clicked.type ) {
+ case TimeTableType.vsq:
+ cmenu.Items.Add( _( "Generate Lipsync from this track" ), null, new EventHandler( h_genMouthFromVsq ) );
+ if ( AppManager.SaveData.m_group_vsq[track].Count == 0 ) {
+ copy_enabled = false;
+ }
+ break;
+ case TimeTableType.character:
+ cmenu.Items.Add( _( "Note ON from here" ) + "(&O)",
+ null,
+ new EventHandler( h_noteON ) );
+ cmenu.Items.Add( _( "Preview image" ),
+ null,
+ new EventHandler( h_previewImage ) );
+ if ( AppManager.SaveData.m_groups_character[group][track].Count == 0 ) {
+ copy_enabled = false;
+ }
+ break;
+ case TimeTableType.another:
+ cmenu.Items.Add( _( "Note ON from here" ) + "(&O)",
+ null,
+ new EventHandler( h_noteON ) );
+ if ( AppManager.SaveData.m_group_another[track].Image == null ) {
+ cmenu.Items.Add( _( "Set image" ),
+ null,
+ new EventHandler( h_setImage ) );
+ } else {
+ cmenu.Items.Add( _( "Preview image" ),
+ null,
+ new EventHandler( h_previewImage ) );
+ cmenu.Items.Add( _( "Change image" ),
+ null,
+ new EventHandler( h_setImage ) );
+ }
+ ToolStripMenuItem mItemImage = new ToolStripMenuItem( _( "Image" ) );
+ mItemImage.DropDown = new ContextMenuStrip();
+ ((ContextMenuStrip)mItemImage.DropDown).Items.Add( _( "Image placement" ),
+ null,
+ new EventHandler( h_setImagePosition ) );
+ ((ContextMenuStrip)mItemImage.DropDown).Items.Add( _( "Scale setting" ),
+ null,
+ new EventHandler( h_setScale ) );
+ ((ContextMenuStrip)mItemImage.DropDown).ShowCheckMargin = false;
+ ((ContextMenuStrip)mItemImage.DropDown).ShowImageMargin = false;
+ cmenu.Items.Add( mItemImage );
+ if ( AppManager.SaveData.m_group_another[track].Count == 0 ) {
+ copy_enabled = false;
+ }
+ break;
+ case TimeTableType.plugin:
+ cmenu.Items.Add( _( "Note ON from here" ) + "(&O)",
+ null,
+ new EventHandler( h_noteON ) );
+ if ( AppManager.SaveData.m_group_plugin[track].Count == 0 ) {
+ copy_enabled = false;
+ }
+ break;
+ }
+
+ //繧ィ繝ウ繝医Μ縺ョ雋シ莉倥¢
+ if ( m_clicked.type != TimeTableType.vsq ) {
+ cmenu.Items.Add( _( "Paste" ) + "(&V)",
+ null,
+ new EventHandler( h_pasteEntry ) );
+ if ( m_copied_entry == null && m_copied_telop == null ) {
+ cmenu.Items[cmenu.Items.Count - 1].Enabled = false;
+ }
+ }
+
+
+ #endregion
+ } else {
+ #region 繧ィ繝ウ繝医Μ縺後け繝ェ繝繧ッ縺輔l縺溘→縺
+ copy_enabled = true;//繧ィ繝ウ繝医Μ縺後け繝ェ繝繧ッ縺輔l縺溘ョ縺ァ縲√お繝ウ繝医Μ縺ョ蛟区焚縺ッ1蛟倶サ・荳奇シ
+ if ( m_clicked.type != TimeTableType.vsq ) {
+ cmenu.Items.Add( _( "Note OFF" ) + "(&O)", null, new EventHandler( h_noteOFF ) );
+ if ( m_clicked.type == TimeTableType.character ) {
+ cmenu.Items.Add( _( "Image Preview" ), null, new EventHandler( h_previewImage ) );
+ }
+ cmenu.Items.Add( _( "Numeric Entry" ) + "(&N)", null, new EventHandler( h_editEntry ) );
+ if ( m_clicked.type != TimeTableType.telop ) {
+ cmenu.Items.Add( _( "Expand" ) + "(&E)", null, new EventHandler( h_expandEntry ) );
+ }
+ cmenu.Items.Add( "-" );
+
+ // 繧ー繝ォ繝シ繝怜崋譛峨ョ讖溯ス
+ if ( m_clicked.type == TimeTableType.another ) {
+ if ( AppManager.SaveData.m_group_another[track].Image == null ) {
+ //if ( s.m_group_another[track].GetImage( 0f ) == null ) {
+ cmenu.Items.Add( _( "Set Image" ), null, new EventHandler( h_setImage ) );
+ } else {
+ cmenu.Items.Add( _( "Preview Image" ), null, new EventHandler( h_previewImage ) );
+ cmenu.Items.Add( _( "Change Image" ), null, new EventHandler( h_setImage ) );
+ }
+ ToolStripMenuItem mItemImage = new ToolStripMenuItem( _( "Image" ) );
+ mItemImage.DropDown = new ContextMenuStrip();
+ ((ContextMenuStrip)mItemImage.DropDown).Items.Add( _( "Image placement" ),
+ null,
+ new EventHandler( h_setImagePosition ) );
+ ((ContextMenuStrip)mItemImage.DropDown).Items.Add( _( "Scale setting" ),
+ null,
+ new EventHandler( h_setScale ) );
+ ((ContextMenuStrip)mItemImage.DropDown).ShowCheckMargin = false;
+ ((ContextMenuStrip)mItemImage.DropDown).ShowImageMargin = false;
+ cmenu.Items.Add( mItemImage );
+ cmenu.Items.Add( "-" );
+ } else if ( m_clicked.type == TimeTableType.plugin ) {
+ if ( (AppManager.SaveData.m_plugins[m_clicked.track].Instance.Type & Constants.LS_ENABLES_ENTRY_SETTING) == Constants.LS_ENABLES_ENTRY_SETTING ) {
+ cmenu.Items.Add( _( "Plugin config. of this entry" ), null, new EventHandler( h_entrySetting ) );
+ cmenu.Items.Add( "-" );
+ }
+ }
+
+ //邱ィ髮邉サ縺ョ蜈ア騾壹さ繝槭Φ繝
+ cmenu.Items.Add( _( "Copy" ) + "(&C)", null, new EventHandler( h_copyEntry ) );
+ cmenu.Items.Add( _( "Cut" ) + "(&X)", null, new EventHandler( h_cutEntry ) );
+ cmenu.Items.Add( _( "Split Entry" ) + "(&S)", null, new EventHandler( h_splitEntry ) );
+ }
+ #endregion
+ }
+
+ #region 繧ソ繧、繝繝ゥ繧、繝ウ逕ィ縺ョ蜈ア騾壹さ繝槭Φ繝
+ //繧ソ繧、繝繝ゥ繧、繝ウ
+ if ( m_clicked.type != TimeTableType.telop ) {
+ ToolStripMenuItem mItemTimeline = new ToolStripMenuItem( _( "Timeline" ) );
+ ContextMenuStrip cItemTimeline = new ContextMenuStrip();
+ cItemTimeline.Items.Add( _( "Copy" ), null, new EventHandler( h_copyTimeTable ) );
+ if ( !copy_enabled ) {
+ cItemTimeline.Items[cItemTimeline.Items.Count - 1].Enabled = false;
+ }
+ cItemTimeline.Items.Add( _( "Copy On/Off inverted" ), null, new EventHandler( h_copyTimeTableInvert ) );
+ if ( !copy_enabled ) {
+ cItemTimeline.Items[cItemTimeline.Items.Count - 1].Enabled = false;
+ }
+ cItemTimeline.Items.Add( _( "Paste" ), null, new EventHandler( h_pasteTimeTable ) );
+ if ( m_copied_timetable == null ) {
+ cItemTimeline.Items[cItemTimeline.Items.Count - 1].Enabled = false;
+ }
+ cItemTimeline.Items.Add( _( "Import from TEXT" ), null, new EventHandler( h_importFromText ) );
+ cItemTimeline.Items.Add( _( "Export to TEXT" ), null, new EventHandler( h_exportToText ) );
+ cItemTimeline.ShowCheckMargin = false;
+ cItemTimeline.ShowImageMargin = false;
+ mItemTimeline.DropDown = cItemTimeline;
+ cmenu.Items.Add( mItemTimeline );
+ }
+
+ //邱ィ髮
+ ToolStripMenuItem mItemEdit = new ToolStripMenuItem( _( "Edit" ) );
+ ContextMenuStrip cItemEdit = new ContextMenuStrip();
+ if ( m_clicked.type != TimeTableType.plugin && m_clicked.type != TimeTableType.character && m_clicked.type != TimeTableType.telop ) {
+ cItemEdit.Items.Add( _( "Delete" ), null, new EventHandler( h_deleteTrack ) );
+ }
+ cItemEdit.Items.Add( _( "Delete entries" ), null, new EventHandler( h_clearEntry ) );
+ if ( !copy_enabled ) {
+ cItemEdit.Items[cItemEdit.Items.Count - 1].Enabled = false;
+ }
+ cItemEdit.Items.Add( _( "Shift this time-line" ), null, new EventHandler( h_shiftEntries ) );
+ if ( !copy_enabled ) {
+ cItemEdit.Items[cItemEdit.Items.Count - 1].Enabled = false;
+ }
+ cItemEdit.ShowCheckMargin = false;
+ cItemEdit.ShowImageMargin = false;
+ mItemEdit.DropDown = cItemEdit;
+ cmenu.Items.Add( mItemEdit );
+
+ #endregion
+
+ }
+ }
+ if ( cmenu.Items.Count >= 1 ) {
+ cmenu.Show( pictureBox1, new Point( e.X, e.Y ) );
+ }
+ #endregion
+ } else if ( e.Button == MouseButtons.Left ) {
+ #region 蟾ヲ繧ッ繝ェ繝繧ッ
+ if ( m_clicked.entry >= 0 ) {
+ m_edit_handle_ed_item = GetGroupItem( e.X + m_startToDrawX, e.Y + m_startToDrawY );
+#if DEBUG
+ Common.DebugWriteLine( "pictureBox1_MouseClick; m_edit_handle_ed_item.entry=" + m_edit_handle_ed_item.entry );
+#endif
+ UpdateEditHandle( e.X, e.Y );
+ m_edit_mode = EditMode.Selected;
+ float time = SecFromXCoord( e.X );
+ UpdateExpandRange( time );
+ if ( m_clicked.type == TimeTableType.telop ) {
+ Telop selected = AppManager.SaveData[m_clicked.entry];
+ property.Editing = new ZorderItem( selected.Text, ZorderItemType.telop, selected.ID );
+ }
+ pictureBox1.Invalidate();
+ }
+ #endregion
+ }
+ } else if ( m_edit_mode != EditMode.EditingLeft && m_edit_mode != EditMode.EditingRight/* !m_editEntry*/ ) {
+ m_clicked = GetGroupItem( e.X + m_startToDrawX, e.Y + m_startToDrawY );
+ if ( m_clicked.entry >= 0 ) {
+ UpdateEditHandle( e.X, e.Y );
+ float time = SecFromXCoord( e.X );
+ UpdateExpandRange( time );
+ if ( m_clicked.type == TimeTableType.telop ) {
+ Telop selected = AppManager.SaveData[m_clicked.entry];
+ property.Editing = new ZorderItem( selected.Text, ZorderItemType.telop, selected.ID );
+ }
+ pictureBox1.Invalidate();
+ } else {
+ m_edit_mode = EditMode.None;
+ }
+ }
+ }
+
+ private void pictureBox1_MouseMove( object sender, MouseEventArgs e ) {
+ if ( AppManager.Playing ) {
+ m_mousePosition = e.Location;
+ return;
+ }
+
+ Rectangle last = m_rcHilight;
+ m_rcHilight = GetHilightRect( m_mousePosition.X, m_mousePosition.Y );
+
+ if ( preview_image.Visible ) {
+ TimeSpan ts = DateTime.Now.Subtract( m_preview_time );
+ if ( ts.TotalMilliseconds > 1000 ) {
+ preview_image.Visible = false;
+ }
+ }
+
+ statusTime.Text = SecFromXCoord( e.X ).ToString( "0.00" ) + " sec";
+ if ( m_edit_mode != EditMode.Selected ) {
+ m_mousePosition.X = e.X;
+ m_mousePosition.Y = e.Y;
+ if ( m_edit_mode == EditMode.Dragging ) {
+ // 繧ィ繝ウ繝医Μ繧定ソス蜉縺吶k繝「繝シ繝
+ m_editing_t2 = SecFromXCoord( e.X );
+ m_slide_moved = true;
+ if ( AppManager.Config.QuantizeMode != QuantizeMode.off && m_grids != null ) {
+ m_editing_t2 = GetSnapPoint( m_editing_t2 );
+ }
+ float begin = m_editing_t1;
+ float end = m_editing_t2;
+ if ( begin > end ) {
+ float b = begin;
+ begin = end;
+ end = b;
+ }
+ if ( begin < 0f ) {
+ begin = 0f;
+ }
+ if ( AppManager.SaveData.m_totalSec < end ) {
+ end = AppManager.SaveData.m_totalSec;
+ }
+ if ( m_dragging.type == TimeTableType.telop ) {
+ AppManager.SaveData[m_editing_telop_original.ID].Start = begin;
+ AppManager.SaveData[m_editing_telop_original.ID].End = end;
+ } else if ( m_dragging.type != TimeTableType.vsq ) {
+ AppManager.SaveData[m_dragging.type, m_dragging.group] = null;
+ AppManager.SaveData[m_dragging.type, m_dragging.group] = (TimeTableGroup)m_editing_group.Clone();
+ AppManager.SaveData[m_dragging.type, m_dragging.group].Interrup( m_dragging.track, begin, end );
+ }
+ pictureBox1.Cursor = Cursors.Arrow;
+ } else if ( m_edit_mode == EditMode.Sliding ) {
+ // 繧ィ繝ウ繝医Μ繧偵ラ繝ゥ繝繧ー縺励※繧ケ繝ゥ繧、繝峨&縺帙k繝「繝シ繝
+ m_slide_moved = true;
+ m_editing_t2 = SecFromXCoord( e.X );
+ int group = m_dragging.group;
+ int track = m_dragging.track;
+ int entry = m_dragging.entry;
+ float diff = (m_editing_t2 - m_editing_t1);
+ float original_begin;
+ if ( m_dragging.type == TimeTableType.telop ) {
+ original_begin = m_editing_telop_original.Start;
+ } else {
+ original_begin = m_slide_original.begin;
+ }
+ float begin = original_begin + diff;
+
+ if ( AppManager.Config.QuantizeMode != QuantizeMode.off && m_grids != null ) {
+ begin = GetSnapPoint( begin );
+ diff = begin - original_begin;
+ }
+ float end = 0;
+ float length = 0;
+
+ if ( m_dragging.type == TimeTableType.telop ) {
+ end = m_editing_telop_original.End + diff;
+ length = m_editing_telop_original.Length;
+ } else if ( m_dragging.type != TimeTableType.vsq ) {
+ end = AppManager.SaveData[m_dragging.type, group][track][entry].end + diff;
+ length = AppManager.SaveData[m_dragging.type, group][track][entry].Length;
+ if ( begin < m_expandRange.X ) {
+ begin = m_expandRange.X;
+ end = begin + length;
+ } else {
+ if ( m_expandRange.Y < end ) {
+ end = m_expandRange.Y;
+ begin = end - length;
+ } else {
+ end = begin + length;
+ }
+ }
+ }
+
+ int ibegin = XCoordFromSec( begin );
+ int y = m_dragging.row_index * AppManager.Config.TrackHeight - m_startToDrawY;
+ int width = (int)(length * AppManager.Config.PixelPerSec);
+ m_rcHilight = new Rectangle( ibegin, y, width, AppManager.Config.TrackHeight );
+
+ if ( m_dragging.type == TimeTableType.telop ) {
+ AppManager.SaveData[m_editing_telop_original.ID].Start = begin;
+ AppManager.SaveData[m_editing_telop_original.ID].End = end;
+ } else if ( m_dragging.type != TimeTableType.vsq ) {
+ AppManager.SaveData[m_dragging.type, group][track][entry].begin = begin;
+ AppManager.SaveData[m_dragging.type, group][track][entry].end = end;
+ }
+ pictureBox1.Cursor = Cursors.Arrow;
+ } else if ( m_edit_mode == EditMode.EditingLeft || m_edit_mode == EditMode.EditingRight ) {
+ TimeTableType type = m_edit_handle_ed_item.type;
+ if ( type != TimeTableType.vsq ) {
+ int group = m_edit_handle_ed_item.group;
+ int track = m_edit_handle_ed_item.track;
+ int entry = m_edit_handle_ed_item.entry;
+ if ( entry < 0 ) {
+ m_edit_mode = EditMode.None;
+ return;
+ }
+ float draft_begin, draft_end;
+ if ( type == TimeTableType.telop ) {
+ draft_begin = m_editing_telop_original.Start;
+ draft_end = m_editing_telop_original.End;
+ } else {
+ draft_begin = m_editing_group[track][entry].begin;
+ draft_end = m_editing_group[track][entry].end;
+ }
+ if ( m_edit_mode == EditMode.EditingLeft ) {
+ draft_begin = SecFromXCoord( e.X );
+ if ( AppManager.Config.QuantizeMode != QuantizeMode.off && m_grids != null ) {
+ draft_begin = GetSnapPoint( draft_begin );
+ }
+ if ( draft_begin < 0f ) {
+ draft_begin = 0f;
+ }
+ } else {
+ draft_end = SecFromXCoord( e.X );
+ if ( AppManager.Config.QuantizeMode != QuantizeMode.off && m_grids != null ) {
+ draft_end = GetSnapPoint( draft_end );
+ }
+ if ( AppManager.SaveData.m_totalSec < draft_end ) {
+ draft_end = AppManager.SaveData.m_totalSec;
+ }
+ }
+ if ( draft_begin < draft_end ) {
+ if ( type == TimeTableType.telop ) {
+ AppManager.SaveData[entry].Start = draft_begin;
+ AppManager.SaveData[entry].End = draft_end;
+ } else {
+ AppManager.SaveData[type, group] = null;
+ AppManager.SaveData[type, group] = (TimeTableGroup)m_editing_group.Clone();
+ AppManager.SaveData[type, group][track].RemoveAt( entry );
+ AppManager.SaveData[type, group].Interrup( track, draft_begin, draft_end );
+ }
+ }
+ }
+ pictureBox1.Cursor = Cursors.VSplit;
+ }
+ } else {
+ Point pt = new Point( e.X, e.Y );
+ if ( AppManager.IsInRectangle( pt, m_editHandleLeft ) ) {
+ pictureBox1.Cursor = Cursors.VSplit;
+ } else if ( AppManager.IsInRectangle( pt, m_editHandleRight ) ) {
+ pictureBox1.Cursor = Cursors.VSplit;
+ } else {
+ pictureBox1.Cursor = Cursors.Arrow;
+ }
+ }
+ pictureBox1.Refresh();
+ }
+
+ private void pictureBox1_MouseLeave( object sender, EventArgs e ) {
+ pictureBox1.Invalidate();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void pictureBox1_MouseDown( object sender, MouseEventArgs e ) {
+ pictureBox1.Focus();
+
+ m_mousePosition.X = e.X;
+ m_mousePosition.Y = e.Y;
+
+ if ( m_edit_mode == EditMode.Selected ) {
+ if ( m_edit_handle_ed_item.type == TimeTableType.telop ) {
+ int id = m_edit_handle_ed_item.entry;
+ if ( AppManager.IsInRectangle( e.Location, m_editHandleLeft ) ) {
+ m_editing_telop_original = (Telop)AppManager.SaveData[id].Clone();
+ m_edit_mode = EditMode.EditingLeft;
+ } else if ( AppManager.IsInRectangle( e.Location, m_editHandleRight ) ) {
+ m_editing_telop_original = (Telop)AppManager.SaveData[id].Clone();
+ m_edit_mode = EditMode.EditingRight;
+ }
+ } else {
+ if ( AppManager.IsInRectangle( e.Location, m_editHandleLeft ) ) {
+ m_editing_group = null;
+ m_editing_group = (TimeTableGroup)AppManager.SaveData[m_edit_handle_ed_item.type, m_edit_handle_ed_item.group].Clone();
+ m_edit_mode = EditMode.EditingLeft;
+ } else if ( AppManager.IsInRectangle( e.Location, m_editHandleRight ) ) {
+ m_editing_group = null;
+ m_editing_group = (TimeTableGroup)AppManager.SaveData[m_edit_handle_ed_item.type, m_edit_handle_ed_item.group].Clone();
+ m_edit_mode = EditMode.EditingRight;
+ }
+ }
+#if DEBUG
+ Common.DebugWriteLine( "pictureBox1_MouseDown; m_edit_handle_ed_item.entry=" + m_edit_handle_ed_item.entry );
+#endif
+ } else if ( e.Button == MouseButtons.Left ) {
+ m_editing_t1 = SecFromXCoord( e.X );
+ if ( AppManager.Config.QuantizeMode != QuantizeMode.off ) {
+ m_editing_t1 = GetSnapPoint( m_editing_t1 );
+ }
+ m_clicked = GetGroupItem( m_mousePosition.X + m_startToDrawX, m_mousePosition.Y + m_startToDrawY );
+ if ( m_clicked.track >= 0 ) {
+ int track = m_clicked.track;
+ int group = m_clicked.group;
+ int entry = m_clicked.entry;
+ if ( m_clicked.type == TimeTableType.vsq ) {
+ m_edit_mode = EditMode.None;
+ } else if ( m_clicked.type == TimeTableType.telop ) {
+ m_slide_moved = false;
+ m_dragging = m_clicked;
+ if ( m_clicked.entry < 0 ) {
+ int id = AppManager.SaveData.GetNextID();
+ m_editing_telop_original = new Telop( id );
+ m_editing_telop_original.Text = "(none)";
+ m_editing_telop_original.Start = SecFromXCoord( e.X );
+ m_editing_telop_original.End = m_editing_telop_original.Start;
+ m_editing_telop_original.Lane = m_clicked.track;
+ Command run2 = Command.GCommandAddTelop( m_editing_telop_original );
+ AppManager.SaveData.Execute( run2 );
+ m_edit_mode = EditMode.Dragging;
+ } else {
+ m_editing_telop_original = (Telop)AppManager.SaveData[m_clicked.entry].Clone();
+ m_edit_mode = EditMode.Sliding;
+ }
+ } else {
+ m_editing_group = null;
+ m_editing_group = (TimeTableGroup)AppManager.SaveData[m_clicked.type, m_clicked.group].Clone();
+ m_dragging = new Item( m_clicked.type, m_clicked.group, m_clicked.track, m_clicked.entry, m_clicked.row_index );
+ m_slide_moved = false;
+ if ( m_clicked.entry < 0 ) {
+ // 繧ィ繝ウ繝医Μ霑ス蜉繝「繝シ繝
+ m_edit_mode = EditMode.Dragging;
+ } else {
+ // 繧ィ繝ウ繝医Μ繧ケ繝ゥ繧、繝峨Δ繝シ繝
+ m_edit_mode = EditMode.Sliding;
+ UpdateExpandRange( SecFromXCoord( e.X ) );
+ if ( m_clicked.type != TimeTableType.vsq ) {
+ m_slide_original = (TimeTableEntry)AppManager.SaveData[m_clicked.type, group][track][entry].Clone();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void pictureBox1_MouseDoubleClick( object sender, MouseEventArgs e ) {
+ if ( m_edit_mode == EditMode.None ) {
+ Item clicked = GetGroupItem( e.X + m_startToDrawX, e.Y + m_startToDrawY );
+ if ( clicked.type == TimeTableType.top ) {
+ float time = SecFromXCoord( e.X );
+ int nof = (int)(time * AppManager.SaveData.FrameRate);
+ if ( previewer.TrackBarMinimum <= nof && nof <= previewer.TrackBarMaximum ) {
+ previewer.TrackBarValue = nof;
+ correctPosition();
+ this.Invalidate();
+ }
+ } else if ( clicked.track < 0 ) {
+ if ( clicked.type == TimeTableType.telop ) {
+ AppManager.SaveData.TelopListFolded = !AppManager.SaveData.TelopListFolded;
+ SetVScrollRange();
+ Invalidate();
+ } else {
+ if ( AppManager.SaveData[clicked.type, clicked.group] != null ) {
+ AppManager.SaveData[clicked.type, clicked.group].Folded = !AppManager.SaveData[clicked.type, clicked.group].Folded;
+ SetVScrollRange();
+ this.Invalidate();
+ }
+ }
+ }
+ } else {
+ Item clicked = GetGroupItem( e.X + m_startToDrawX, e.Y + m_startToDrawY );
+ if ( clicked.entry >= 0 ) {
+ m_clicked = clicked;
+ h_editEntry( this, new EventArgs() );
+ }
+ }
+ }
+
+ private void pictureBox1_MouseUp( object sender, MouseEventArgs e ) {
+#if DEBUG
+ Common.DebugWriteLine( "pictureBox1_MouseUp" );
+ Common.DebugWriteLine( " m_slide_moved=" + m_slide_moved );
+#endif
+ if ( m_edit_mode == EditMode.EditingLeft || m_edit_mode == EditMode.EditingRight/* m_editEntry*/ ) {
+ #region EditMode.EditingLeft EditMode.EditRight
+ int x = e.X;
+
+ float time = SecFromXCoord( x );
+ float new_begin;
+ float new_end;
+
+ TimeTableType type = m_edit_handle_ed_item.type;
+ int group = m_edit_handle_ed_item.group;
+ int track = m_edit_handle_ed_item.track;
+ int entry = m_edit_handle_ed_item.entry;
+#if DEBUG
+ Common.DebugWriteLine( "pictureBox1_MouseUp; m_edit_mode==EditingLeft||EditingRight;" );
+ Common.DebugWriteLine( "type=" + type + "; group=" + group + "; track=" + track + "; entry=" + entry );
+#endif
+ if ( track < 0 || entry < 0 ) {
+ AppManager.SaveData[type, group] = null;
+ AppManager.SaveData[type, group] = (TimeTableGroup)m_editing_group.Clone();
+ return;
+ }
+
+ if ( type == TimeTableType.telop ) {
+ new_begin = AppManager.SaveData[entry].Start;
+ new_end = AppManager.SaveData[entry].End;
+ } else if ( type != TimeTableType.vsq ) {
+ new_begin = m_editing_group[track][entry].begin;
+ new_end = m_editing_group[track][entry].end;
+ } else {
+ m_edit_mode = EditMode.None;
+ return;
+ }
+
+ TimeTableEntry item;
+ if ( new_end <= new_begin ) {
+ // 邨ゆコ譎ょ綾縺ィ縺励※髢句ァ区凾蛻サ縺ィ蜷後§縺句ー上&縺譎ょ綾繧呈欠螳壹&繧後◆蝣エ蜷医ゅお繝ウ繝医Μ繧貞炎髯、
+ if ( type == TimeTableType.telop ) {
+ Command run = Command.GCommandDeleteTelop( AppManager.SaveData[entry] );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ } else if ( type != TimeTableType.vsq ) {
+ int g = group;
+ if ( type != TimeTableType.character ) {
+ g = -1;
+ }
+ Command run = Command.GCommandDeleteTimeTableEntry( type, g, track, AppManager.SaveData[type, group][track][entry] );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ }
+ AppManager.Edited = true;
+ this.Invalidate();
+ m_edit_mode = EditMode.None;
+ return;
+ }
+ if ( type == TimeTableType.telop ) {
+ Telop edited = (Telop)AppManager.SaveData[entry].Clone();
+ AppManager.SaveData[entry] = m_editing_telop_original;
+ Command run = Command.GCommandEditTelop( entry, edited );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ } else if ( type != TimeTableType.vsq ) {
+ item = (TimeTableEntry)m_editing_group[track][entry].Clone();
+ item.begin = new_begin;
+ item.end = new_end;
+ if ( type != TimeTableType.character ) {
+ group = -1;
+ }
+ Command run = Command.GCommandEditGroup( type, group, AppManager.SaveData[type, group] );
+ AppManager.SaveData[type, group] = (TimeTableGroup)m_editing_group.Clone();
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+#if DEBUG
+ Common.DebugWriteLine( "Command run & registered" );
+#endif
+ } else {
+ m_edit_mode = EditMode.None;
+ return;
+ }
+ pictureBox1.Cursor = Cursors.Arrow;
+ AppManager.Edited = true;
+ m_rcHilight = GetHilightRect( e.X, e.Y );
+ this.Invalidate();
+ m_edit_mode = EditMode.None;
+ #endregion
+ } else if ( m_edit_mode == EditMode.Dragging ) {
+ #region EditMode.Dragging
+ m_edit_mode = EditMode.None;
+ TimeTableType type = m_dragging.type;
+ int group = m_dragging.group;
+ int track = m_dragging.track;
+ if ( type == TimeTableType.telop ) {
+ Telop added = null;
+ for ( int i = 0; i < AppManager.SaveData.m_telop_ex2.Count; i++ ) {
+ if ( AppManager.SaveData.m_telop_ex2[i].ID == m_editing_telop_original.ID ) {
+ added = (Telop)AppManager.SaveData.m_telop_ex2[i].Clone();
+ AppManager.SaveData.m_telop_ex2.RemoveAt( i );
+ break;
+ }
+ }
+ if ( added != null && m_slide_moved ) {
+ Telop.DecideLane( AppManager.SaveData.m_telop_ex2 );
+ Command run2 = Command.GCommandAddTelop( added );
+ Command inv = AppManager.SaveData.Execute( run2 );
+ property.Editing = new ZorderItem( inv.telop.Text, ZorderItemType.telop, inv.telop.ID );
+ AppManager.Register( inv );
+ UpdateEditHandle();
+ SetVScrollRange();
+ AppManager.Edited = true;
+ }
+ } else if ( type != TimeTableType.vsq ) {
+ int g = group;
+ if ( type != TimeTableType.character ) {
+ g = -1;
+ }
+ Command run = Command.GCommandEditGroup( type, g, AppManager.SaveData[type, group] );
+ AppManager.SaveData[type, group] = null;
+ AppManager.SaveData[type, group] = (TimeTableGroup)m_editing_group.Clone();
+ if ( m_slide_moved ) {
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ AppManager.Edited = true;
+ }
+ }
+ m_slide_moved = false;
+ //timerTimeLine.Enabled = true;
+ this.Invalidate();
+ #endregion
+ } else if ( m_edit_mode == EditMode.Sliding ) {
+ #region EditMode.Sliding
+ TimeTableType type = m_dragging.type;
+ int group = m_dragging.group;
+ int track = m_dragging.track;
+ int entry = m_dragging.entry;
+ m_edit_mode = EditMode.None;
+ m_slide_moved = false;
+ if ( type == TimeTableType.telop ) {
+ Telop edited = (Telop)AppManager.SaveData[m_editing_telop_original.ID].Clone();
+ AppManager.SaveData[m_editing_telop_original.ID] = (Telop)m_editing_telop_original.Clone();
+ Command run2 = Command.GCommandEditTelop( edited.ID, edited );
+ AppManager.Register( AppManager.SaveData.Execute( run2 ) );
+ AppManager.Edited = true;
+ } else if ( type != TimeTableType.vsq ) {
+ int g = group;
+ if ( type != TimeTableType.character ) {
+ g = -1;
+ }
+ Command run = Command.GCommandEditTimeTableEntry( type, g, track, entry, AppManager.SaveData[type, group][track][entry] );
+ AppManager.SaveData[type, group][track][entry] = null;
+ AppManager.SaveData[type, group][track][entry] = (TimeTableEntry)m_slide_original.Clone();
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ AppManager.Edited = true;
+ }
+ //timerTimeLine.Enabled = true;
+ this.Invalidate();
+ #endregion
+ }
+ }
+
+ private void pictureBox1_Paint( object sender, PaintEventArgs e ) {
+ if ( m_skip_paint ) {
+ return;
+ }
+ Graphics g = e.Graphics;
+ g.Clear( SystemColors.Control );
+
+ int[] lanes = AppManager.GetTimeLineLanes();
+ int height;
+ bool always_show_vsq = AppManager.Config.FixVsqTrackPosition;
+ Rectangle clip_for_vsq = new Rectangle();
+ if ( always_show_vsq ) {
+ m_vsq_height = (AppManager.SaveData.m_group_vsq.VisibleTracks + 2) * AppManager.Config.TrackHeight;
+ clip_for_vsq = new Rectangle( 0,
+ AppManager.Config.TrackHeight,
+ pictureBox1.Width,
+ (AppManager.SaveData.m_group_vsq.VisibleTracks + 1) * AppManager.Config.TrackHeight );
+ }
+
+ int total_height = 0;
+ for ( int lane = 0; lane < lanes.Length; lane++ ) {
+ total_height += AppManager.Config.TrackHeight;
+ for ( int i = 2; i <= lanes[lane]; i++ ) {
+ int y = (i - 1) * AppManager.Config.TrackHeight - m_startToDrawY;
+ if ( always_show_vsq && lane == 0 ) {
+ y += m_startToDrawY;
+ }
+ Rectangle outline = new Rectangle( 0, total_height + y, pictureBox1.Width, AppManager.Config.TrackHeight );
+ if ( i % 2 == 0 ) {
+ g.FillRectangle( _BRS_TRACKBG_ODD, outline );
+ } else {
+ g.FillRectangle( _BRS_TRACKBG_EVEN, outline );
+ }
+ }
+ if ( always_show_vsq && lane == 0 ) {
+ g.ExcludeClip( clip_for_vsq );
+ }
+ if ( lanes[lane] >= 2 ) {
+ total_height += (lanes[lane] - 1) * AppManager.Config.TrackHeight;
+ }
+ }
+
+ // 蟆冗ッ豈弱ョ邱
+ g.ResetClip();
+ if ( menuVisualBars.Checked ) {
+ IEnumerable blte = AppManager.SaveData.GetBarLineTypeEnumerator( AppManager.Config.QuantizeMode, AppManager.Config.QuantizeTripletEnabled );
+ foreach ( BarLineType barsec in blte ) {
+ int x = (int)(barsec.Time * AppManager.Config.PixelPerSec) - m_startToDrawX;
+ if ( x > pictureBox1.Width ) {
+ break;
+ } else if ( 0 < x ) {
+ if ( barsec.IsSeparator ) {
+ g.DrawLine( new Pen( Color.FromArgb( 161, 157, 136 ) ),
+ new Point( x, 0 ),
+ new Point( x, pictureBox1.Height ) );
+ } else {
+ g.DrawLine( new Pen( Color.FromArgb( 209, 204, 172 ) ),
+ new Point( x, 0 ),
+ new Point( x, pictureBox1.Height ) );
+ }
+ }
+ }
+ }
+
+ g.ExcludeClip( clip_for_vsq );
+ total_height = AppManager.Config.TrackHeight;
+ if ( !always_show_vsq ) {
+ DrawTimeTableGroup( g,
+ new Point( 0, total_height - m_startToDrawY ),
+ out height,
+ AppManager.SaveData.m_group_vsq,
+ _( "VSQ Tracks" ) );
+ total_height += height;
+ } else {
+ total_height = m_vsq_height;
+ }
+
+ for ( int i = 0; i < AppManager.SaveData.m_groups_character.Count; i++ ) {
+ DrawTimeTableGroup( g,
+ new Point( 0, total_height - m_startToDrawY ),
+ out height,
+ AppManager.SaveData.m_groups_character[i],
+ _( "Character" ) + "(" + AppManager.SaveData.m_groups_character[i].Character.Name + ")" );
+ total_height += height;
+ }
+
+ DrawTelop( g,
+ new Point( 0, total_height - m_startToDrawY ),
+ out height,
+ _( "Telop" ) );
+ total_height += height;
+
+ DrawTimeTableGroup( g,
+ new Point( 0, total_height - m_startToDrawY ),
+ out height,
+ AppManager.SaveData.m_group_another,
+ _( "Another Images" ) );
+ total_height += height;
+
+ DrawTimeTableGroup( g,
+ new Point( 0, total_height - m_startToDrawY ),
+ out height,
+ AppManager.SaveData.m_group_plugin,
+ _( "Plugin" ) );
+
+ if ( always_show_vsq ) {
+ g.ResetClip();
+ DrawTimeTableGroup( g,
+ new Point( 0, AppManager.Config.TrackHeight ),
+ out height,
+ AppManager.SaveData.m_group_vsq,
+ _( "VSQ Tracks" ) );
+ total_height += height;
+ }
+
+ // 逕サ髱「縺ォ荳螳壽凾髢薙#縺ィ縺ョ繝ゥ繧、繝ウ繧貞シ輔¥
+ g.FillRectangle( new SolidBrush( TOOL_COLOR ), 0, 0, pictureBox1.Width, AppManager.Config.TrackHeight );
+ // 繝ェ繝斐シ繝医お繝ェ繧「繧貞挨濶イ縺ァ謠上¥
+ g.FillRectangle( new SolidBrush( REPEAT_AREA ),
+ new Rectangle( (int)(RepeatStart * AppManager.Config.PixelPerSec - m_startToDrawX),
+ 0,
+ (int)((RepeatEnd - RepeatStart) * AppManager.Config.PixelPerSec),
+ AppManager.Config.TrackHeight ) );
+ int start_to_draw_x = m_startToDrawX;
+ int start_sec = (int)((double)(start_to_draw_x) / AppManager.Config.PixelPerSec) / AppManager.Config.TimeLineInterval;
+ if ( start_sec == 0 ) {
+ start_sec = 1;
+ }
+ int end_sec = (int)((double)(start_to_draw_x + pictureBox1.Width) / AppManager.Config.PixelPerSec) / AppManager.Config.TimeLineInterval + 1;
+ for ( int i = start_sec; i <= end_sec; i++ ) {
+ int x = (int)(i * AppManager.Config.TimeLineInterval * AppManager.Config.PixelPerSec) - start_to_draw_x;
+ g.DrawString( i * AppManager.Config.TimeLineInterval + " sec",
+ AppManager.Config.Font.GetFont(),
+ Brushes.Black,
+ new Point( x, AppManager.Config.VerticalStringOffset ) );
+ g.DrawLine( new Pen( Color.FromArgb( 128, Color.Black ) ),
+ new Point( x, 0 ), new Point( x, pictureBox1.Height ) );
+ }
+
+ if ( m_edit_mode == EditMode.Selected/* m_editMode*/ ) {
+ g.DrawRectangle( HILIGHT_EDIT, m_rcHilight );
+ } else {
+ g.DrawRectangle( HILIGHT, m_rcHilight );
+ }
+
+ // 繧ォ繝シ繧ス繝ォ菴咲スョ縺ォ邵ヲ邱
+ int cursor;
+ float now = Now;
+ if ( menuVisualSync.Checked && AppManager.Config.SyncAtCentre ) {
+ float w = pictureBox1.Width / 2 / AppManager.Config.PixelPerSec;
+ if ( now < w || AppManager.SaveData.m_totalSec - w < now ) {
+ cursor = (int)(now * AppManager.Config.PixelPerSec - m_startToDrawX);
+ } else {
+ cursor = pictureBox1.Width / 2;
+ }
+ } else {
+ cursor = (int)(now * AppManager.Config.PixelPerSec - m_startToDrawX);
+ }
+ g.DrawLine( new Pen( Color.Black, 2.0f ), new Point( cursor, 0 ), new Point( cursor, pictureBox1.Height ) );
+ g.DrawLine(
+ Pens.Black,
+ new Point( m_mousePosition.X, 0 ),
+ new Point( m_mousePosition.X, pictureBox1.Height ) );
+
+ if ( always_show_vsq ) {
+ g.DrawLine( new Pen( Color.Black, 2 ),
+ new Point( 0, m_vsq_height ),
+ new Point( pictureBox1.Width, m_vsq_height ) );
+ }
+ }
+ #endregion
+
+ private void preview_image_MouseLeave( object sender, EventArgs e ) {
+ TimeSpan ts = DateTime.Now.Subtract( m_preview_time );
+ if ( ts.TotalMilliseconds > 200 ) {
+ preview_image.Visible = false;
+ }
+ }
+
+ #region menuHelp
+ private void menuHelpDebugExtract_Click( object sender, EventArgs e ) {
+#if DEBUG
+ /* using ( OpenFileDialog dlg = new OpenFileDialog() ) {
+ if ( dlg.ShowDialog() == DialogResult.OK ) {
+ string file = dlg.FileName;
+ string dir = Path.GetDirectoryName( file );
+ string fname = Path.GetFileNameWithoutExtension( file );
+ float scale = 0.45f;
+ using ( Character3 chara = new Character3( file ) ) {
+ foreach ( ImageEntry img in chara ) {
+ float width = img.image.Width;// * scale;
+ float height = img.image.Height;// *scale;
+ //using ( Bitmap t = new Bitmap( (int)width, (int)height, PixelFormat.Format32bppArgb ) )
+ //using ( Graphics g = Graphics.FromImage( t ) ) {
+ //g.InterpolationMode = InterpolationMode.HighQualityBicubic;
+ //g.DrawImage( img.image, 0f, 0f, width, height );
+ img.image.Save( Path.Combine( dir, fname + "_" + img.title + ".png" ) );
+ //}
+ }
+ }
+ }
+ }
+*/
+#endif
+ }
+
+ private void menuHelpBugReport_Click( object sender, EventArgs e ) {
+ BugReport dlg = new BugReport();
+ dlg.Show();
+ }
+
+ private void menuHelpDebugEditCharacter_Click( object sender, EventArgs e ) {
+#if DEBUG
+
+#endif
+ }
+
+ private void menuHelpDebugInverseImages_Click( object sender, EventArgs e ) {
+#if DEBUG
+
+#endif
+ }
+
+ private static string GetAssemblyNameAndVersion( Type t ) {
+ Assembly a = Assembly.GetAssembly( t );
+ AssemblyFileVersionAttribute afva = (AssemblyFileVersionAttribute)Attribute.GetCustomAttribute( a, typeof( AssemblyFileVersionAttribute ) );
+ return a.GetName().Name + " v" + afva.Version;
+ }
+
+ ///
+ /// 繝舌シ繧ク繝ァ繝ウ諠蝣ア繧定。ィ遉コ
+ ///
+ ///
+ ///
+ private void menuHelpVersionInfo_Click( object sender, EventArgs e ) {
+ if ( m_version_form == null ) {
+ string version_str = AppManager.VERSION + "\n\n" +
+ GetAssemblyNameAndVersion( typeof( Boare.Lib.AppUtil.Misc ) ) + "\n" +
+ GetAssemblyNameAndVersion( typeof( Boare.Lib.Media.AviWriterVcm ) ) + "\n" +
+ GetAssemblyNameAndVersion( typeof( Boare.Lib.Vsq.VsqFile ) ) + "\n" +
+#if DEBUG
+ GetAssemblyNameAndVersion( typeof( Boare.Lib.Swf.SwfWriter ) ) + "\n" +
+#endif
+ GetAssemblyNameAndVersion( typeof( bocoree.math ) );
+ m_version_form = new Boare.Lib.AppUtil.VersionInfo( _( "LipSync" ), version_str );
+ m_version_form.Font = AppManager.Config.Font.GetFont();
+ m_version_form.AuthorList = m_credit;
+ m_version_form.AppNameColor = Color.RoyalBlue;
+ m_version_form.VersionColor = Color.DimGray;
+#if !DEBUG
+ m_version_form.Credit = AppManager.author_list;
+#endif
+ m_version_form.FormClosed += new FormClosedEventHandler( m_version_form_FormClosed );
+ m_version_form.Show();
+ }
+ }
+ #endregion
+
+ void m_version_form_FormClosed( object sender, FormClosedEventArgs e ) {
+ m_version_form.Dispose();
+ m_version_form = null;
+ }
+
+ #region Form1
+ private void Form1_Shown( object sender, EventArgs e ) {
+ m_initialized = true;
+ ResizePanel2();
+ }
+
+ private void Form1_Load( object sender, EventArgs e ) {
+#if MONO
+ Common.DebugWriteLine( "this assembly was compiled under the define of \"NET_2_0\"" );
+#endif
+ ResizePanel2();
+ ApplyFont( AppManager.Config.Font.GetFont() );
+
+ // 繝励Λ繧ー繧、繝ウ繧定ェュ縺ソ霎シ縺ソ
+ //繧、繝ウ繧ケ繝医シ繝ォ縺輔l縺ヲ縺繧九励Λ繧ー繧、繝ウ繧定ェソ縺ケ繧
+ //縺吶∋縺ヲ縺ョ繝励Λ繧ー繧、繝ウ繧ッ繝ゥ繧ケ縺ョ繧、繝ウ繧ケ繧ソ繝ウ繧ケ繧剃ス懈舌☆繧
+ AppManager.SaveData.m_plugins = PluginInfo.FindPlugins();
+
+ AppManager.SaveData.m_group_plugin = new TimeTableGroup( _( "Plugin" ), -1, null );
+
+ AppManager.SaveData.m_plugins_config = new List();
+ for ( int i = 0; i < AppManager.SaveData.m_plugins.Length; i++ ) {
+ AppManager.SaveData.m_plugins_config.Add( new PluginConfig( AppManager.SaveData.m_plugins[i].Instance.Name, AppManager.SaveData.m_plugins[i].Instance.Config, Path.GetFileName( AppManager.SaveData.m_plugins[i].Location ) ) );
+ AppManager.SaveData.m_group_plugin.Add( new TimeTable( AppManager.SaveData.m_plugins_config[i].ID, 0, TimeTableType.plugin, null ) );
+ }
+
+ /*
+ * 繝励Λ繧ー繧、繝ウ縺ョ遞ョ鬘槭↓蠢懊§縺ヲ縲√Γ繧、繝ウ繝。繝九Η繝シ繧呈峩譁ー
+ */
+ // 繝励Λ繧ー繧、繝ウ險ュ螳
+ if ( AppManager.SaveData.m_plugins.Length > 0 ) {
+ for ( int i = 0; i < AppManager.SaveData.m_plugins.Length; i++ ) {
+ if ( (AppManager.SaveData.m_plugins[i].Instance.Type & Plugin.Constants.LS_NO_EVENT_HANDLER) != Plugin.Constants.LS_NO_EVENT_HANDLER ) {
+ menuToolPluginConfig.DropDownItems.Add( AppManager.SaveData.m_plugins_config[i].ID, null, new EventHandler( h_pluginSetting ) );
+ }
+ }
+ }
+
+ // 繝励Λ繧ー繧、繝ウ縺ョ諠蝣ア
+ menuHelpPluginInfo.DropDownItems.Clear();
+ for ( int i = 0; i < AppManager.SaveData.m_plugins.Length; i++ ) {
+ menuHelpPluginInfo.DropDownItems.Add( AppManager.SaveData.m_plugins[i].Instance.Name, null, new EventHandler( h_pluginInfo ) );
+ }
+
+ AppManager.SaveData.m_group_vsq = new TimeTableGroup( _( "VSQ Tracks" ), -1, null );
+ AppManager.SaveData.m_groups_character = new List();
+ AppManager.SaveData.m_group_another = new TimeTableGroup( _( "Another images" ), -1, null );
+ SettingsEx.CommandExecuted += new CommandExecutedEventHandler( SettingsEx_CommandExecuted );
+
+ AppManager.SaveData.m_screenWidth = this.Width;
+ AppManager.SaveData.m_screenHeight = this.Height;
+
+ AppManager.Edited = false;
+
+ if ( m_filePath != "" ) {
+ Read( m_filePath );
+ }
+ SetHScrollRange();
+ SetVScrollRange();
+
+ AppManager.SaveData.UpdateZorder();
+
+ preview_image.Parent = pictureBox1;
+
+ QuantizeMenuCheckedStateUpdate();
+ UpdateGridList();
+
+ property.PropertyValueChanged += new PropertyValueChangedEventHandler( property_PropertyValueChanged );
+ property.TelopAdding += new TelopAddingEventHandler( property_TelopAdding );
+ property.EditingItemChanged += new EditingItemChangedEventHandler( property_EditingItemChanged );
+ property.TelopDeleting += new TelopDeletingEventHandler( property_TelopDeleting );
+ property.ListUpdateRequired += new ListUpdateRequiredEventHandler( UpdateObjectList );
+ property.UpdateLayout();
+
+ previewer.Image = new Bitmap( AppManager.SaveData.m_movieSize.Width, AppManager.SaveData.m_movieSize.Height );
+ using ( Graphics g = Graphics.FromImage( previewer.Image ) ) {
+ AppManager.SaveData.DrawTo( g, new Size( AppManager.SaveData.m_movieSize.Width, AppManager.SaveData.m_movieSize.Height ), 0.0f, false );
+ }
+
+#if DEBUG
+ FormCommandHistory fch = new FormCommandHistory();
+ fch.Show();
+#endif
+ }
+
+ private void Form1_FormClosing( object sender, FormClosingEventArgs e ) {
+ if ( AppManager.Edited ) {
+ //MessageBox.Show( "Form1_FormClosing" );
+ DialogResult result = requestIntention();
+ switch ( result ) {
+ case DialogResult.Yes:
+ if ( m_filePath == "" ) {
+ if ( saveFileDialog1.ShowDialog() == DialogResult.OK ) {
+ m_filePath = saveFileDialog1.FileName;
+ Save( m_filePath );
+ } else {
+ return;
+ }
+ } else {
+ Save( m_filePath );
+ }
+ break;
+ case DialogResult.Cancel:
+ e.Cancel = true;
+ return;
+ }
+ }
+ if ( m_player != null ) {
+ m_player.Stop();
+ m_player.Close();
+ }
+ if ( m_preview_thread != null ) {
+ m_preview_thread.Abort();
+ while ( m_preview_thread.IsAlive ) {
+ Application.DoEvents();
+ }
+ }
+ SaveConfig();
+ }
+
+ private void Form1_DragEnter( object sender, DragEventArgs e ) {
+ e.Effect = DragDropEffects.All;
+ }
+
+ private void Form1_DragDrop( object sender, DragEventArgs e ) {
+ if ( e.Data.GetDataPresent( DataFormats.FileDrop ) ) {
+ string[] filename = (string[])e.Data.GetData( DataFormats.FileDrop );
+ if ( Path.GetExtension( filename[0] ).ToLower() == ".vsq" || Path.GetExtension( filename[0] ).ToLower() == ".ust" ) {
+ // vsq繝輔ぃ繧、繝ォ
+ ReadVsq( filename[0] );
+ } else if ( Path.GetExtension( filename[0] ).ToLower() == ".lse" ) {
+ // LipSync Editor繝輔ぃ繧、繝ォ
+ Read( filename[0] );
+ m_filePath = filename[0];
+ UpdateFormTitle();
+ SetHScrollRange();
+ SetVScrollRange();
+ //rebuildDrawing();
+ this.Invalidate();
+ }
+ }
+ }
+
+ private void Form1_Paint( object sender, PaintEventArgs e ) {
+ if ( m_skip_paint ) {
+ return;
+ }
+ float now;
+ if ( !AviWriting && !AppManager.Config.PreviewHidden ) {
+#if OBSOLETE_MODE
+ if ( PreviewP.Image != null ) {
+ PreviewP.Image.Dispose();
+ }
+ PreviewP.Image = getPicture( now );
+#endif
+ //PreviewP.Refresh();
+ //previewer.Preview.Invalidate();
+ }
+
+ float speed = m_player.Speed;
+ previewer.LabelSpeedText = "x" + speed.ToString( "0.00" );
+
+ pictureBox1.Refresh();
+ side.Refresh();
+ }
+
+ private void Form1_LocationOrSizeChanged( object sender, EventArgs e ) {
+ if ( AppManager.Config != null ) {
+ if ( this.WindowState == FormWindowState.Normal ) {
+ AppManager.Config.WindowPosition = this.Bounds;
+ }
+ AppManager.Config.WindowIsMaximized = (this.WindowState == FormWindowState.Maximized);
+ }
+ }
+
+ private void Form1_Activated( object sender, EventArgs e ) {
+ m_edit_mode = EditMode.None;
+ }
+
+ private void Form1_Deactivate( object sender, EventArgs e ) {
+ m_edit_mode = EditMode.None;
+ }
+ #endregion
+
+ #region bgWorkAvi
+ private void bgWorkAvi_DoWork( object sender, DoWorkEventArgs e ) {
+ IAviWriter writer = null;
+ AviOutputArguments args = (AviOutputArguments)e.Argument;
+ if ( File.Exists( args.AviFile ) ) {
+ File.Delete( args.AviFile );
+ }
+ Size size = AppManager.SaveData.m_movieSize;
+ m_avi_cancel = false;
+
+ long start_frame;
+ if ( args.StartSpecified ) {
+ start_frame = (long)(args.Start * AppManager.SaveData.FrameRate);
+ } else {
+ start_frame = 0L;
+ }
+
+ long end_frame;
+ if ( args.EndSpecified ) {
+ end_frame = (long)(args.End * AppManager.SaveData.FrameRate);
+ } else {
+ end_frame = (long)((AppManager.SaveData.m_totalSec) * AppManager.SaveData.FrameRate);
+ }
+ long total_frames = end_frame - start_frame + 1;
+#if !DEBUG
+ try {
+#endif
+ Bitmap bmp = null;
+ if ( args.UseVfwEncoder ) {
+ bmp = new Bitmap( size.Width, size.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb );
+ AviWriterVfw awvfw = new AviWriterVfw();
+ bool ret = awvfw.Open( args.AviFile,
+ AppManager.SaveData.DwScale,
+ AppManager.SaveData.DwRate,
+ size.Width,
+ size.Height,
+ Process.GetCurrentProcess().MainWindowHandle );
+ if ( !ret ) {
+ return;
+ }
+ writer = awvfw;
+ } else {
+ bmp = args.IsTransparent ?
+ new Bitmap( size.Width, size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb ) :
+ new Bitmap( size.Width, size.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb );
+ AviWriterVcm awvcm = new AviWriterVcm();
+ bool ret = awvcm.Open( args.AviFile,
+ AppManager.SaveData.DwScale,
+ AppManager.SaveData.DwRate,
+ size.Width,
+ size.Height,
+ !m_is_rawmode,
+ args.IsTransparent,
+ Process.GetCurrentProcess().MainWindowHandle );
+ if ( !ret ) {
+ return;
+ }
+ writer = awvcm;
+ }
+ using ( Graphics g = Graphics.FromImage( bmp ) ) {
+ for ( long frame = start_frame; frame <= end_frame; frame++ ) {
+ float now = (float)frame / AppManager.SaveData.FrameRate;
+ using ( Bitmap frm = GetPicture( now, args.IsTransparent ) ) {
+ frm.RotateFlip( RotateFlipType.Rotate180FlipX );
+ g.DrawImage( frm, 0, 0, size.Width, size.Height );
+ }
+ try {
+ writer.AddFrame( bmp );
+ } catch ( Exception ex ) {
+#if DEBUG
+ Common.LogPush( ex );
+#endif
+ writer.Close();
+ this.Invoke( new Form1_AviWritingChange( ChangeAviWriting ), new object[] { false } );
+ return;
+ }
+ bgWorkAvi.ReportProgress( (int)((double)(frame - start_frame) / (double)(total_frames) * 100.0), new long[] { frame - start_frame, total_frames } );
+ if ( m_avi_cancel ) {
+ bmp.Dispose();
+ g.Dispose();
+ writer.Close();
+ m_avi_cancel = false;
+ return;
+ }
+ }
+ writer.Close();
+
+ string audio_file = AppManager.SaveData.m_audioFile;
+
+#if DEBUG
+ Common.DebugWriteLine( "bgWorkAvi_DoWork" );
+ Common.DebugWriteLine( " args.IsWaveMergeRequired=" + args.IsWaveMergeRequired );
+#endif
+ if ( args.IsWaveMergeRequired ) {
+ #region merge wave file
+ if ( File.Exists( audio_file ) && AppManager.Config.PathFFmpeg != "" && File.Exists( AppManager.Config.PathFFmpeg ) ) {
+ string tmp_avi = Misc.GetTempFileNameIn( Path.GetDirectoryName( args.AviFile ), ".avi" );
+ File.Move( args.AviFile, tmp_avi );
+ // ffmpeg -i movie.mpeg -i audio.wav combined.avi
+ long frames = end_frame - start_frame + 1;
+ m_ffmpeg = new Process();
+ m_ffmpeg.StartInfo.FileName = "\"" + AppManager.Config.PathFFmpeg + "\"";
+ m_ffmpeg.StartInfo.Arguments = "-i \"" + audio_file + "\" -i \"" + tmp_avi + "\" -vframes " + frames + " -vcodec copy -acodec copy \"" + args.AviFile + "\"";
+#if DEBUG
+ Common.DebugWriteLine( " m_ffmpeg.StarInfo.Arguments=" + m_ffmpeg.StartInfo.Arguments );
+#endif
+ m_ffmpeg.StartInfo.CreateNoWindow = true;
+ m_ffmpeg.StartInfo.UseShellExecute = false;
+ m_ffmpeg.StartInfo.RedirectStandardError = true;
+ m_ffmpeg.Start();
+
+ this.m_stdout = new Thread( new ParameterizedThreadStart( this.FFMpegOutputRead ) );
+ this.m_stdout.Name = "output_ffmpeg";
+ this.m_stdout.Start( end_frame - start_frame );
+ m_ffmpeg.WaitForExit();
+ if ( args.IsDeleteIntermediateRequired ) {
+ File.Delete( tmp_avi );
+ }
+ }
+ #endregion
+ }
+
+ if ( args.IsFlvEncodeRequired && AppManager.Config.PathMEncoder != "" && File.Exists( AppManager.Config.PathMEncoder ) ) {
+ #region encode flv
+ //string flv_file = @"C:\test.flv";
+ string flv_file = Path.Combine( Path.GetDirectoryName( args.AviFile ), Path.GetFileNameWithoutExtension( args.AviFile ) + ".flv" );
+ string arguments = "\"" + args.AviFile + "\" -of lavf -lavfopts format=flv -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:ss:aiv:umv:preme=2:mv0:qprd:trell:v4mv:cbp -oac mp3lame -lameopts abr:br=128 -vf scale=" + size.Width + ":" + size.Height + " -sws 9 -af resample=44100 -o \"" + flv_file + "\"";
+ m_mencoder = new Process();
+ m_mencoder.StartInfo.FileName = "\"" + AppManager.Config.PathMEncoder + "\"";
+ m_mencoder.StartInfo.Arguments = arguments;
+ m_mencoder.StartInfo.CreateNoWindow = true;
+ m_mencoder.StartInfo.UseShellExecute = false;
+ m_mencoder.StartInfo.RedirectStandardOutput = true;
+ m_mencoder.Start();
+
+ m_stdout = new Thread( new ParameterizedThreadStart( this.MEncoderOutputRead ) );
+ m_stdout.Name = "stdout_mencoder";
+ m_stdout.Start( end_frame - start_frame );
+
+ m_mencoder.WaitForExit();
+
+ if ( args.IsDeleteIntermediateRequired ) {
+ File.Delete( args.AviFile );
+ }
+
+ #endregion
+ } else if ( args.IsMp4EncodeRequired && AppManager.Config.PathFFmpeg != "" && File.Exists( AppManager.Config.PathFFmpeg ) ) {
+ #region encode mp4
+ try {
+ // ffmpeg -i teaser8000k1280_720_3.avi -r 24 -s 512x288 -refs 1 -bf 2 -flags2 dct8x8 -partitions parti8x8+partp8x8+partb8x8 -sc_threshold 50 -qpel -trell -me hex -directpred 3 -bufsize 128 -b 472k -bt 472k -mbd 2 -preme 2 -f mp4 -vcodec libx264 -an -pass 1 -passlogfile "passlog" enc.mp4
+ // ffmpeg -i teaser8000k1280_720_3.avi -r 24 -s 512x288 -refs 1 -bf 2 -flags2 dct8x8 -partitions parti8x8+partp8x8+partb8x8 -sc_threshold 50 -qpel -trell -me hex -directpred 3 -bufsize 128 -b 472k -bt 472k -mbd 2 -preme 2 -ab 64k -f mp4 -vcodec libx264 -acodec libfaac -pass 2 -passlogfile "passlog" enc.mp4
+ string mp4_file = Path.Combine( Path.GetDirectoryName( args.AviFile ), Path.GetFileNameWithoutExtension( args.AviFile ) + ".mp4" );
+ string arguments = "";
+ string work_dir = Path.Combine( Application.StartupPath, "temp" );
+ if ( !Directory.Exists( work_dir ) ) {
+ Directory.CreateDirectory( work_dir );
+ }
+
+ // first pass
+ arguments = "-i \"" + args.AviFile + "\" -refs 1 -bf 2 -flags2 dct8x8 -partitions parti8x8+partp8x8+partb8x8 -sc_threshold 40 -qpel -trell -me hex -directpred 3 -bufsize 128 -b 472k -bt 472k -mbd 2 -preme 2 -f mp4 -vcodec libx264 -an -pass 1 -passlogfile \"passlog\" -y \"" + mp4_file + "\"";
+#if DEBUG
+ Common.DebugWriteLine( "1st pass arguments=" + arguments );
+#endif
+ m_ffmpeg = new Process();
+ m_ffmpeg.StartInfo.WorkingDirectory = work_dir;
+ m_ffmpeg.StartInfo.FileName = "\"" + AppManager.Config.PathFFmpeg + "\"";
+ m_ffmpeg.StartInfo.Arguments = arguments;
+ m_ffmpeg.StartInfo.CreateNoWindow = true;
+ m_ffmpeg.StartInfo.UseShellExecute = false;
+ m_ffmpeg.StartInfo.RedirectStandardError = true;
+ m_ffmpeg.Start();
+ this.m_stdout = new Thread( new ParameterizedThreadStart( this.FFMpegOutputRead ) );
+ this.m_stdout.Name = "output_ffmpeg";
+ this.m_stdout.Start( end_frame - start_frame );
+ m_ffmpeg.WaitForExit();
+
+ // 2nd pass
+ arguments = "-i \"" + args.AviFile + "\" -refs 1 -bf 2 -flags2 dct8x8 -partitions parti8x8+partp8x8+partb8x8 -sc_threshold 40 -qpel -trell -me hex -directpred 3 -bufsize 128 -b 472k -bt 472k -mbd 2 -preme 2 -ab 64k -f mp4 -vcodec libx264 -acodec libfaac -pass 2 -passlogfile \"passlog\" -y \"" + mp4_file + "\"";
+#if DEBUG
+ Common.DebugWriteLine( "2nd pass arguments=" + arguments );
+#endif
+ m_ffmpeg = new Process();
+ m_ffmpeg.StartInfo.WorkingDirectory = work_dir;
+ m_ffmpeg.StartInfo.FileName = "\"" + AppManager.Config.PathFFmpeg + "\"";
+ m_ffmpeg.StartInfo.Arguments = arguments;
+ m_ffmpeg.StartInfo.CreateNoWindow = true;
+ m_ffmpeg.StartInfo.UseShellExecute = false;
+ m_ffmpeg.StartInfo.RedirectStandardError = true;
+ m_ffmpeg.Start();
+ this.m_stdout = new Thread( new ParameterizedThreadStart( this.FFMpegOutputRead ) );
+ this.m_stdout.Name = "output_ffmpeg";
+ this.m_stdout.Start( end_frame - start_frame );
+ m_ffmpeg.WaitForExit();
+ } catch ( Exception ex ) {
+#if DEBUG
+ Common.DebugWriteLine( ex.ToString() );
+#endif
+ }
+ #endregion
+ }
+
+ }
+
+
+ //mencoder test.avi -of lavf -lavfopts format=flv -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:ss:aiv:umv:preme=2:mv0:qprd:trell:v4mv:cbp -oac mp3lame -lameopts abr:br=128 -passlogfile pass.log -vf scale=512:384 -sws 9 -af resample=44100 -o test.flv
+#if !DEBUG
+ } catch {
+ writer.Close();
+ MessageBox.Show(
+ _( "Initialization of video compression failed.\nThis video codec may require image width in multiples of certain number." ),
+ _( "Error" ),
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation
+ );
+ }
+#endif
+ }
+
+ private void bgWorkAvi_ProgressChanged( object sender, ProgressChangedEventArgs e ) {
+ long[] stat = (long[])e.UserState;
+ this.Text = _( "AVI Progress" ) + " " + e.ProgressPercentage + "% [" + stat[0] + "/" + stat[1] + "]";
+ }
+
+ private void bgWorkAvi_RunWorkerCompleted( object sender, RunWorkerCompletedEventArgs e ) {
+ this.Invoke( new Form1_AviWritingChange( ChangeAviWriting ), new object[] { false } );
+ m_avi_cancel = false;
+ UpdateFormTitle();
+ }
+ #endregion
+
+ #region menuEdit
+ ///
+ /// 繧ュ繝」繝ウ繝舌せ閭梧勹濶イ縺ョ螟画峩
+ ///
+ ///
+ ///
+ private void menuEditBGColor_Click( object sender, EventArgs e ) {
+ colorDialog1.Color = AppManager.SaveData.CANVAS_BACKGROUND;
+ if ( colorDialog1.ShowDialog() == DialogResult.OK ) {
+ Command run = Command.GCommandChangeBackgroundColor( colorDialog1.Color );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ AppManager.Edited = true;
+ this.Invalidate();
+ }
+ }
+
+ private void menuEditAddCharacter_Click( object sender, EventArgs e ) {
+ List plugins = new List();
+ for ( int i = 0; i < AppManager.SaveData.m_plugins.Length; i++ ) {
+ if ( (AppManager.SaveData.m_plugins[i].Instance.Type & Plugin.Constants.LS_TYPE_CHARACTER) == Plugin.Constants.LS_TYPE_CHARACTER ) {
+ plugins.Add( AppManager.SaveData.m_plugins_config[i].ID );
+ }
+ }
+ using ( SelectCharacater sc = new SelectCharacater( plugins ) ) {
+ if ( sc.ShowDialog() == DialogResult.OK ) {
+ using ( TimeTable tempo = new TimeTable( "", 0, TimeTableType.vsq, null ) ) {
+ GenerateLipsyncFromVsq( tempo, sc.Character, true );
+ }
+ AppManager.Edited = true;
+ AppManager.Config.LastCharacterPath = sc.Path;
+ UpdateObjectList();
+ SetVScrollRange();
+ this.Invalidate();
+ }
+ }
+ }
+
+ private void menuEditVideoLength_Click( object sender, EventArgs e ) {
+ using ( InputBox box = new InputBox( _( "Video size configuration" ), _( "Input video length in second" ) ) ) {
+ box.rText = AppManager.SaveData.m_totalSec.ToString();
+ if ( box.ShowDialog() == DialogResult.OK ) {
+ float buff = AppManager.SaveData.m_totalSec;
+ try {
+ buff = float.Parse( box.rText );
+ } catch {
+ MessageBox.Show(
+ _( "Invalid value has been entered" ),
+ _( "Error" ),
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation
+ );
+ buff = AppManager.SaveData.m_totalSec;
+ } finally {
+ AppManager.SaveData.m_totalSec = buff;
+ }
+ //rebuildDrawing();
+ AppManager.Edited = true;
+ AppManager.SaveData.UpdateZorder();
+ SetHScrollRange();
+ this.Invalidate();
+ }
+ }
+ }
+
+ private void menuEditShiftTimeline_Click( object sender, EventArgs e ) {
+ using ( InputBox ibox = new InputBox( _( "Shift all time-tables" ), _( "Input shift time in second (you can enter minus value)" ) ) ) {
+ if ( ibox.ShowDialog() == DialogResult.OK ) {
+ float shift;
+ try {
+ shift = float.Parse( ibox.rText );
+ } catch {
+ MessageBox.Show(
+ _( "Invalid value has been entered" ),
+ _( "Error" ),
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation
+ );
+ return;
+ }
+ Command run = Command.GCommandShiftTimeTable( TimeTableType.whole, -1, shift );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ AppManager.Edited = true;
+ }
+ }
+ }
+
+ private void menuEditFrameRate_Click( object sender, EventArgs e ) {
+ using ( FormSetFrameRate dlg = new FormSetFrameRate( AppManager.SaveData.DwRate, AppManager.SaveData.DwScale ) ) {
+ if ( dlg.ShowDialog() == DialogResult.OK ) {
+ uint rate = dlg.DwRate;
+ uint scale = dlg.DwScale;
+ if ( rate <= 0 || scale <= 0 ) {
+ MessageBox.Show(
+ _( "Invalid value has been entered" ),
+ _( "Error" ),
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Exclamation
+ );
+ } else {
+#if DEBUG
+ Common.DebugWriteLine( "menuEditFrameRate_Click; rate=" + rate + "; scale=" + scale );
+#endif
+ Command run = Command.GCommandChangeFps( rate, scale );
+ AppManager.Register( AppManager.SaveData.Execute( run ) );
+ ChangeBitrate();
+ AppManager.Edited = true;
+#if DEBUG
+ Common.DebugWriteLine( "menuEditFrameRate_Click; s.DwRate=" + AppManager.SaveData.DwRate + "; s.DwScale=" + AppManager.SaveData.DwScale );
+#endif
+ }
+ }
+ }
+ }
+
+ private void menuEditUndo_Click( object sender, EventArgs e ) {
+ CommandType next = AppManager.GetNextUndoCommandType();
+ AppManager.Undo();
+ if ( next == CommandType.changeFps ) {
+ ChangeBitrate();
+ }
+ UpdateObjectList();
+ AppManager.Edited = true;
+ this.Invalidate();
+ }
+
+ private void menuEditRedo_Click( object sender, EventArgs e ) {
+ CommandType next = AppManager.GetNextRedoCommandType();
+ AppManager.Redo();
+ if ( next == CommandType.changeFps ) {
+ ChangeBitrate();
+ }
+ UpdateObjectList();
+ AppManager.Edited = true;
+ this.Invalidate();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void menuEditZOrder_Click( object sender, EventArgs e ) {
+ ZOrder zorder = new ZOrder();
+ zorder.Clear();
+ int count = 0;
+ int cur_z = -1;
+
+ #region 繝輔か繝シ繝繧剃ス懈
+
+ // 縺セ縺壹】繧ェ繝シ繝繝シ繧定ィュ螳壼庄閭ス縺ェ繧ェ繝悶ず繧ァ繧ッ繝医ョ蛟区焚繧呈焚縺医k
+ // 繝励Λ繧ー繧、繝ウ
+ count += AppManager.SaveData.m_plugins.Length;
+ bool[] b_plugins = new bool[AppManager.SaveData.m_group_plugin.Count];
+ for ( int i = 0; i < AppManager.SaveData.m_group_plugin.Count; i++ ) {
+ b_plugins[i] = false;
+ cur_z = Math.Max( cur_z, AppManager.SaveData.m_group_plugin[i].ZOrder );
+ }
+ // 繧ュ繝」繝ゥ繧ッ繧ソ
+ count += AppManager.SaveData.m_groups_character.Count;
+ bool[] b_groups_character = new bool[AppManager.SaveData.m_groups_character.Count];
+ for ( int i = 0; i < b_groups_character.Length; i++ ) {
+ b_groups_character[i] = false;
+ cur_z = Math.Max( cur_z, AppManager.SaveData.m_groups_character[i].ZOrder );
+ }
+ // 縺昴ョ莉悶ョ繧、繝。繝シ繧ク
+ count += AppManager.SaveData.m_group_another.Count;
+ bool[] b_group_another = new bool[AppManager.SaveData.m_group_another.Count];
+ for ( int i = 0; i < b_group_another.Length; i++ ) {
+ b_group_another[i] = false;
+ cur_z = Math.Max( cur_z, AppManager.SaveData.m_group_another[i].ZOrder );
+ }
+
+ //MessageBox.Show( "count=" + count );
+
+ ZorderItem[] list = new ZorderItem[count];
+ int[] eval = new int[count];
+ int[] order = new int[count];
+ int index = -1;
+ for ( int i = 0; i < AppManager.SaveData.m_plugins.Length; i++ ) {
+ index++;
+ list[index] = new ZorderItem( AppManager.SaveData.m_plugins_config[i].ID, ZorderItemType.plugin, i );
+ eval[index] = AppManager.SaveData.m_group_plugin[i].ZOrder;
+ }
+ for ( int i = 0; i < AppManager.SaveData.m_groups_character.Count; i++ ) {
+ index++;
+ list[index] = new ZorderItem( AppManager.SaveData.m_groups_character[i].Text, ZorderItemType.character, i );
+ eval[index] = AppManager.SaveData.m_groups_character[i].ZOrder;
+ }
+ for ( int i = 0; i < AppManager.SaveData.m_group_another.Count; i++ ) {
+ index++;
+ list[index] = new ZorderItem( AppManager.SaveData.m_group_another[i].Text, ZorderItemType.another, i );
+ eval[index] = AppManager.SaveData.m_group_another[i].ZOrder;
+ }
+
+ // 荳ヲ縺ケ螟峨∴
+ int change = 1;
+ ZorderItem tmp;
+ int itemp;
+ while ( change > 0 ) {
+ change = 0;
+ for ( int i = 0; i < count - 1; i++ ) {
+ if ( eval[i] > eval[i + 1] ) {
+ tmp = list[i];
+ list[i] = list[i + 1];
+ list[i + 1] = tmp;
+ itemp = eval[i];
+ eval[i] = eval[i + 1];
+ eval[i + 1] = itemp;
+ change++;
+ }
+ }
+ }
+
+ // ス壹が繝シ繝繝シ縺ョ螟ァ縺阪>繧ゅョ縺九i縲〕istBox1縺ォ逋サ骭イ
+ for ( int i = 0; i < count; i++ ) {
+ zorder.itemAdd( list[i] );
+ }
+ #endregion
+
+ //MessageBox.Show( "zorder.Count=" + zorder.Count );
+
+ if ( zorder.ShowDialog() == DialogResult.OK ) {
+
+ // 繝輔か繝シ繝縺ョ蠢懃ュ斐°繧峨】order繧貞崎ィ育ョ
+ for ( int i = 0; i < zorder.Count; i++ ) {
+ AppManager.SaveData.SetZorder( zorder[i], i + 1 );
+ }
+
+ AppManager.Edited = true;
+ AppManager.SaveData.UpdateZorder();
+ }
+ zorder.Dispose();
+ }
+
+ private void menuEditRealTime_Click( object sender, EventArgs e ) {
+ UpdateFormTitle();
+ }
+
+ private void menuEdit_DropDownOpening( object sender, EventArgs e ) {
+ menuEditUndo.Enabled = AppManager.IsUndoAvailable;
+ menuEditRedo.Enabled = AppManager.IsRedoAvailable;
+ if ( AppManager.SaveData.m_totalSec <= 0.0f ) {
+ menuEditShiftTimeline.Enabled = false;
+ menuEditAddCharacter.Enabled = false;
+ } else {
+ menuEditShiftTimeline.Enabled = true;
+ menuEditAddCharacter.Enabled = true;
+ }
+ if ( AppManager.SaveData.m_groups_character.Count == 0 ) {
+ menuEditRealTime.Enabled = false;
+ } else {
+ menuEditRealTime.Enabled = true;
+ }
+ menuEditAddCharacter.Enabled = !AppManager.Playing;
+ }
+
+ private void menuEditVideoSize_Click( object sender, EventArgs e ) {
+ sizeChange();
+ }
+
+ private void menuFileOutputAvi_Click( object sender, EventArgs e ) {
+ if ( AppManager.Playing ) {
+ StopMusic();
+ }
+ initializeFirstEntry();
+ m_is_rawmode = false;
+ ShowDialogCore();
+ }
+
+ private void menuFileOutputRawAvi_Click( object sender, EventArgs e ) {
+ if ( AppManager.Playing ) {
+ StopMusic();
+ }
+ initializeFirstEntry();
+ m_is_rawmode = true;
+ ShowDialogCore();
+ }
+ #endregion
+
+ #region xmenuFile
+ private void xmenuFileClose_Click( object sender, EventArgs e ) {
+ if ( AppManager.Edited ) {
+ //MessageBox.Show( "Form1_FormClosing" );
+ DialogResult result = requestIntention();
+ switch ( result ) {
+ case DialogResult.Yes:
+ if ( m_filePath == "" ) {
+ if ( saveFileDialog1.ShowDialog() == DialogResult.OK ) {
+ m_filePath = saveFileDialog1.FileName;
+ Save( m_filePath );
+ } else {
+ return;
+ }
+ } else {
+ Save( m_filePath );
+ }
+ break;
+ case DialogResult.Cancel:
+ return;
+ }
+ }
+ if ( m_player != null ) {
+ m_player.Stop();
+ m_player.Close();
+ }
+
+ AppManager.Edited = false;
+ m_filePath = "";
+ UpdateFormTitle();
+ ClearExistingData();
+ AppManager.ClearCommandBuffer();
+ AppManager.SaveData.UpdateZorder();
+ this.Invalidate();
+ }
+
+ private void xmenuFileOpenVsq_Click( object sender, EventArgs e ) {
+ // 譌「蟄倥ョ繝医Λ繝繧ッ縺後↑縺縺九←縺縺狗「コ隱阪
+ int count = 0;
+ count += AppManager.SaveData.m_group_vsq.Count;
+ for ( int group = 0; group < AppManager.SaveData.m_groups_character.Count; group++ ) {
+ count += AppManager.SaveData.m_groups_character[group].Count;
+ }
+ count += AppManager.SaveData.m_group_another.Count;
+ count += AppManager.SaveData.m_telop_ex2.Count;
+ if ( count > 0 ) {
+ if ( MessageBox.Show(
+ _( "This operation will overwrite all exisiting time-tables, and can NOT undo. Would you like to continue?" ) + "\n\n" + _( "( In case you want to append new track, please right-click [VSQ Tracks] to select [Read from VSQ file]. )" ),
+ _( "Confirmation" ),
+ MessageBoxButtons.OKCancel,
+ MessageBoxIcon.Question ) != DialogResult.OK ) {
+ return;
+ }
+ }
+
+ List track_name = new List