コード例 #1
0
ファイル: WindowSnap.cs プロジェクト: peca-dev/PeerstPlayer
        //-------------------------------------------------------------
        // 概要:コンストラクタ
        //-------------------------------------------------------------
        public WindowSnap(System.Windows.Forms.Form form, PecaPlayerControl pecaPlayer)
        {
            this.form = form;
            this.pecaPlayer = pecaPlayer;

            // サブクラスウィンドウの設定
            AssignHandle(form.Handle);
        }
コード例 #2
0
		//-------------------------------------------------------------
		// 概要:コンストラクタ
		//-------------------------------------------------------------
		public AspectRateKeepWindow(Form form, PecaPlayerControl pecaPlayer)
		{
			this.form = form;
			this.pecaPlayer = pecaPlayer;

			// サブクラスウィンドウの設定
			AssignHandle(form.Handle);
		}
コード例 #3
0
        //-------------------------------------------------------------
        // 概要:コンストラクタ
        //-------------------------------------------------------------
        public WindowSnap(System.Windows.Forms.Form form, PecaPlayerControl pecaPlayer)
        {
            this.form       = form;
            this.pecaPlayer = pecaPlayer;

            // サブクラスウィンドウの設定
            AssignHandle(form.Handle);
        }
コード例 #4
0
        //-------------------------------------------------------------
        // 概要:コンストラクタ
        //-------------------------------------------------------------
        public AspectRateKeepWindow(Form form, PecaPlayerControl pecaPlayer)
        {
            this.form       = form;
            this.pecaPlayer = pecaPlayer;

            // サブクラスウィンドウの設定
            AssignHandle(form.Handle);
        }
コード例 #5
0
        //-------------------------------------------------------------
        // 概要:コンストラクタ
        //-------------------------------------------------------------
        public WindowSnap(GlowForm form, PecaPlayerControl pecaPlayer)
        {
            this.form       = form;
            this.pecaPlayer = pecaPlayer;

            isGlowForm = form.GlowVisible();

            // サブクラスウィンドウの設定
            AssignHandle(form.Handle);
        }
コード例 #6
0
ファイル: WindowSnap.cs プロジェクト: shinji3/PeerstPlayer
		//-------------------------------------------------------------
		// 概要:コンストラクタ
		//-------------------------------------------------------------
		public WindowSnap(GlowForm form, PecaPlayerControl pecaPlayer)
		{
			this.form = form;
			this.pecaPlayer = pecaPlayer;

			isGlowForm = form.GlowVisible();

			// サブクラスウィンドウの設定
			AssignHandle(form.Handle);
		}
コード例 #7
0
		public ScreenshotCommand(PecaPlayerControl pecaPlayer)
		{
			this.pecaPlayer = pecaPlayer;

			worker.DoWork += (sender, args) =>
			{
				// コンテキストメニューから呼ばれた時用に少し待機する
				Thread.Sleep(50);
				pecaPlayer.Invoke((MethodInvoker)(() =>
				{
					// // SSのディレクトリが存在していなければ作る
					if (!Directory.Exists(PlayerSettings.ScreenshotFolder))
					{
						Directory.CreateDirectory(PlayerSettings.ScreenshotFolder);
					}
					var fileName = Format(PlayerSettings.ScreenshotFormat, pecaPlayer.ChannelInfo);
					// 書式にディレクトリが含まれているかもしれないので確認しておく
					if (!Directory.Exists(PlayerSettings.ScreenshotFolder + Path.GetDirectoryName(fileName)))
					{
						Directory.CreateDirectory(PlayerSettings.ScreenshotFolder + Path.GetDirectoryName(fileName));
					}

					// SS撮影
					using (var image = new Bitmap(pecaPlayer.Width, pecaPlayer.Height, PixelFormat.Format24bppRgb))
					using (var graphics = Graphics.FromImage(image))
					{
						var location = pecaPlayer.Location;
						var screenPoint = pecaPlayer.PointToScreen(location);
						graphics.CopyFromScreen(screenPoint.X, screenPoint.Y, 0, 0, image.Size);

						var format = GetImageFormat(PlayerSettings.ScreenshotExtension);
						var name = string.Format("{0}/{1}.{2}",
							PlayerSettings.ScreenshotFolder, fileName, format.ToString().ToLower());
						try
						{
							image.Save(name, format);
						}
						catch (ExternalException)
						{
							MessageBox.Show(pecaPlayer, "スクリーンショットの保存に失敗しました。\n" +
								"保存フォルダが間違っている、既にファイルが開かれている、\n" +
								"ドライブの空き容量が無い可能性があります。",
								"ERROR!",
								MessageBoxButtons.OK, MessageBoxIcon.Error);
						}
					}
				}));
			};
		}
コード例 #8
0
		//-------------------------------------------------------------
		// 概要:初期化
		//-------------------------------------------------------------
		public void Init(PlayerView playerView, PecaPlayerControl pecaPlayer, StatusBarControl statusBar)
		{
			// コマンド作成
			CreateCommand(playerView, pecaPlayer, statusBar);

			// ショートカット設定の読み込み
			try
			{
				settings = SettingSerializer.LoadSettings<ShortcutSettings>("ShortcutSettings.xml");
			}
			catch
			{
				Logger.Instance.Error("ショートカット設定ファイルの読み込みに失敗したため、デフォルト設定を読み込みます。");
				LoadDefaultSettings();
			}

			// 設定ファイルが壊れている場合
			if ((settings.EventMap == null) || (settings.GestureMap == null) || (settings.KeyMap == null))
			{
				Logger.Instance.Error("ショートカット設定ファイルが壊れているため、デフォルト設定を読み込みます。");
				LoadDefaultSettings();
			}
		}
コード例 #9
0
		//-------------------------------------------------------------
		// 概要:コマンド作成
		//-------------------------------------------------------------
		private void CreateCommand(Form form, PecaPlayerControl pecaPlayer, StatusBarControl statusBar)
		{
			commandMap = new Dictionary<Commands, ShortcutCommand>()
			{
				{	Commands.None,					new ShortcutCommand(new NullCommand(), new CommandArgs())											}, // 処理なし
				{	Commands.VolumeUp,				new ShortcutCommand(new VolumeUpCommand(pecaPlayer), new CommandArgs())								}, // 音量UP
				{	Commands.VolumeDown,			new ShortcutCommand(new VolumeDownCommand(pecaPlayer), new CommandArgs())							}, // 音量DOWN
				{	Commands.VolumeBalanceLeft,		new ShortcutCommand(new VolumeBalanceCommand(pecaPlayer), new VolumeBalanceCommandArgs(VolumeBalanceCommandArgs.BalanceLeft))	}, // 音量バランス:左
				{	Commands.VolumeBalanceMiddle,	new ShortcutCommand(new VolumeBalanceCommand(pecaPlayer), new VolumeBalanceCommandArgs(VolumeBalanceCommandArgs.BalanceMiddle))	}, // 音量バランス:中央
				{	Commands.VolumeBalanceRight,	new ShortcutCommand(new VolumeBalanceCommand(pecaPlayer), new VolumeBalanceCommandArgs(VolumeBalanceCommandArgs.BalanceRight))	}, // 音量バランス:右
				{	Commands.Mute,					new ShortcutCommand(new MuteCommand(pecaPlayer), new CommandArgs())									}, // ミュート切替
				{	Commands.WindowMinimize,		new ShortcutCommand(new WindowMinimize(form), new CommandArgs())									}, // ウィンドウを最小化
				{	Commands.WindowMaximize,		new ShortcutCommand(new WindowMaximize(form), new CommandArgs())									}, // ウィンドウを最大化
				{	Commands.MiniMute,				new ShortcutCommand(new MiniMuteCommand(form, pecaPlayer), new CommandArgs())						}, // 最小化ミュート
				{	Commands.Close,					new ShortcutCommand(new CloseCommand(form, pecaPlayer), new CommandArgs())							}, // 閉じる
				{	Commands.VisibleStatusBar,		new ShortcutCommand(new VisibleStatusBarCommand(form, statusBar), new CommandArgs())				}, // ステータスバーの表示切り替え
				{	Commands.OpenPeerstViewer,		new ShortcutCommand(new OpenPeerstViewerCommand(statusBar), new CommandArgs())						}, // PeerstViewerを開く
				{	Commands.UpdateChannelInfo,		new ShortcutCommand(new UpdateChannelInfoCommand(pecaPlayer), new CommandArgs())					}, // チャンネル情報更新
				//{	Commands.ShowNewRes,			new ShortcutCommand(new ShowNewResCommand(form, statusBar), new CommandArgs())						}, // 新着レス表示
				{	Commands.TopMost,				new ShortcutCommand(new TopMostCommand(form), new CommandArgs())									}, // 最前列表示切り替え
				{	Commands.WindowSizeUp,			new ShortcutCommand(new WindowSizeUpCommand(form, pecaPlayer), new CommandArgs())					}, // ウィンドウサイズUP
				{	Commands.WindowSizeDown,		new ShortcutCommand(new WindowSizeDownCommand(form, pecaPlayer), new CommandArgs())					}, // ウィンドウサイズDOWN
				{	Commands.DisconnectRelay,		new ShortcutCommand(new DisconnectRelayCommand(form, pecaPlayer), new CommandArgs())				}, // リレー切断
				{	Commands.Bump,					new ShortcutCommand(new BumpCommand(pecaPlayer), new CommandArgs())									}, // Bump
				{	Commands.RetryPlayer,			new ShortcutCommand(new RetryPlayerCommand(pecaPlayer), new CommandArgs())							}, // 再接続(プレイヤー)
				{	Commands.WmpMenu,				new ShortcutCommand(new WmpMenuCommand(pecaPlayer), new CommandArgs())								}, // WMPメニュー表示
				{	Commands.FitMovieSize,			new ShortcutCommand(new FitMovieSizeCommand(form, pecaPlayer), new CommandArgs())					}, // 黒枠を消す
				{	Commands.WindowSize160x120,		new ShortcutCommand(new WindowSizeCommand(form, pecaPlayer), new WindowSizeCommandArgs(160, 120))	}, // ウィンドウサイズ指定
				{	Commands.WindowSize320x240,		new ShortcutCommand(new WindowSizeCommand(form, pecaPlayer), new WindowSizeCommandArgs(320, 240))	}, // ウィンドウサイズ指定
				{	Commands.WindowSize480x360,		new ShortcutCommand(new WindowSizeCommand(form, pecaPlayer), new WindowSizeCommandArgs(480, 360))	}, // ウィンドウサイズ指定
				{	Commands.WindowSize640x480,		new ShortcutCommand(new WindowSizeCommand(form, pecaPlayer), new WindowSizeCommandArgs(640, 480))	}, // ウィンドウサイズ指定
				{	Commands.WindowSize800x600,		new ShortcutCommand(new WindowSizeCommand(form, pecaPlayer), new WindowSizeCommandArgs(800, 600))	}, // ウィンドウサイズ指定
				{	Commands.WindowScale25Per,		new ShortcutCommand(new WindowScaleCommand(form, pecaPlayer), new WindowScaleCommandArgs(0.25f))	}, // ウィンドウサイズ拡大率指定
				{	Commands.WindowScale50Per,		new ShortcutCommand(new WindowScaleCommand(form, pecaPlayer), new WindowScaleCommandArgs(0.5f))		}, // ウィンドウサイズ拡大率指定
				{	Commands.WindowScale75Per,		new ShortcutCommand(new WindowScaleCommand(form, pecaPlayer), new WindowScaleCommandArgs(0.75f))	}, // ウィンドウサイズ拡大率指定
				{	Commands.WindowScale100Per,		new ShortcutCommand(new WindowScaleCommand(form, pecaPlayer), new WindowScaleCommandArgs(1.0f))		}, // ウィンドウサイズ拡大率指定
				{	Commands.WindowScale150Per,		new ShortcutCommand(new WindowScaleCommand(form, pecaPlayer), new WindowScaleCommandArgs(1.5f))		}, // ウィンドウサイズ拡大率指定
				{	Commands.WindowScale200Per,		new ShortcutCommand(new WindowScaleCommand(form, pecaPlayer), new WindowScaleCommandArgs(2.0f))		}, // ウィンドウサイズ拡大率指定
				{	Commands.ScreenSplitWidthx5,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(5, -1))	}, // 画面分割
				{	Commands.ScreenSplitWidthx4,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(4, -1))	}, // 画面分割
				{	Commands.ScreenSplitWidthx3,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(3, -1))	}, // 画面分割
				{	Commands.ScreenSplitWidthx2,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(2, -1))	}, // 画面分割
				{	Commands.ScreenSplitWidthx1,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(1, -1))	}, // 画面分割
				{	Commands.ScreenSplitHeightx5,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(-1, 5))	}, // 画面分割
				{	Commands.ScreenSplitHeightx4,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(-1, 4))	}, // 画面分割
				{	Commands.ScreenSplitHeightx3,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(-1, 3))	}, // 画面分割
				{	Commands.ScreenSplitHeightx2,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(-1, 2))	}, // 画面分割
				{	Commands.ScreenSplitHeightx1,	new ShortcutCommand(new ScreenSplitCommand(form, pecaPlayer), new ScreenSplitCommandArgs(-1, 1))	}, // 画面分割
				{	Commands.Screenshot,			new ShortcutCommand(new ScreenshotCommand(pecaPlayer), new CommandArgs())							}, // スクリーンショット
				{	Commands.OpenScreenshotFolder,	new ShortcutCommand(new OpenScreenshotFolderCommand(), new CommandArgs())							}, // スクリーンショットフォルダを開く
			};
		}
コード例 #10
0
ファイル: MuteCommand.cs プロジェクト: shinji3/PeerstPlayer
		public MuteCommand(PecaPlayerControl pecaPlayer)
		{
			this.pecaPlayer = pecaPlayer;
		}
コード例 #11
0
		public WindowSizeDownCommand(Form form, PecaPlayerControl pecaPlayer)
		{
			this.form = form;
			this.pecaPlayer = pecaPlayer;
		}
コード例 #12
0
		public WmpMenuCommand(PecaPlayerControl pecaPlayer)
		{
			this.pecaPlayer = pecaPlayer;
		}
コード例 #13
0
		public ScreenSplitCommand(Form form, PecaPlayerControl pecaPlayer)
		{
			this.form = form;
			this.pecaPlayer = pecaPlayer;
		}
コード例 #14
0
 public DisconnectRelayCommand(Form form, PecaPlayerControl pecaPlayer)
 {
     this.form = form;
     this.pecaPlayer = pecaPlayer;
 }
コード例 #15
0
		public FitMovieSizeCommand(Form form, PecaPlayerControl pecaPlayer)
		{
			this.form = form;
			this.pecaPlayer = pecaPlayer;
		}
コード例 #16
0
ファイル: BumpCommand.cs プロジェクト: shinji3/PeerstPlayer
		public BumpCommand(PecaPlayerControl pecaPlayer)
		{
			this.pecaPlayer = pecaPlayer;
		}
コード例 #17
0
		public RetryPlayerCommand(PecaPlayerControl pecaPlayer)
		{
			this.pecaPlayer = pecaPlayer;
		}
コード例 #18
0
		public FlashMoviePlayerControl(PecaPlayerControl parent)
		{
			try
			{
				InitializeComponent();
			}
			catch (COMException)
			{
				MessageBox.Show("Flash Playerがインストールされていません。\nInternet ExplorerからFlash Playerをインストールする必要があります。",
					"ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			
			Dock = DockStyle.Fill;

			// FlashManagerの初期化
			flashManager = new FlashMoviePlayerManager(axShockwaveFlash);
			flashManager.Initialized += (sender, args) =>
			{
				flashManager.EnableGpu(PlayerSettings.Gpu);
				flashManager.EnableRtmp(PlayerSettings.Rtmp);
				flashManager.SetBufferTime(PlayerSettings.BufferTime);
				flashManager.SetBufferTimeMax(PlayerSettings.BufferTimeMax);
			};
			// ステート変更イベント
			flashManager.OpenStateChange += (sender, args) =>
			{
				if (isFirstMediaOpen)
				{
					var width = ((IMoviePlayer)this).ImageWidth;
					var height = ((IMoviePlayer)this).ImageHeight;
					axShockwaveFlash.Width = width;
					axShockwaveFlash.Height = height;
					movieStart(this, new EventArgs());
					isFirstMediaOpen = false;
				}

				// 動画切替時に、ミュートが解除されるための対応
				((IMoviePlayer)this).Mute = isMute;
				if (!isMute)
				{
					flashManager.ChangeVolume(volume);
				}
			};
			// プレイヤーからBump要求のイベント
			flashManager.RequestBump += (sender, args) => parent.Bump();
			// 再生支援を使う設定が変更されたら
			PlayerSettings.Changed += (s) =>
			{
				switch (s)
				{
				case "Gpu":
					flashManager.EnableGpu(PlayerSettings.Gpu);
					break;
				case "Rtmp":
					flashManager.EnableRtmp(PlayerSettings.Rtmp);
					break;
				case "BufferTime":
					flashManager.SetBufferTime(PlayerSettings.BufferTime);
					break;
				case "BufferTimeMax":
					flashManager.SetBufferTimeMax(PlayerSettings.BufferTimeMax);
					break;
				}
			};
			// Flashウィンドウをフックする
			FlashNativeWindow flash = new FlashNativeWindow(axShockwaveFlash);
			flash.MouseDownEvent += (sender, e) =>
			{
				mouseDownEvent(this, e);
				Focus();
			};
			flash.MouseUpEvent += (sender, e) => mouseUpEvent(this, e);
			flash.MouseMoveEvent += (sender, e) => mouseMoveEvent(this, e);
			flash.DoubleClickEvent += (sender, e) => doubleClickEvent(this, e);
			flash.KeyDownEvent += (sender, e) => keyDownEvent(this, e);
		}
コード例 #19
0
		public MiniMuteCommand(Form form, PecaPlayerControl pecaPlayer)
		{
			this.form = form;
			this.pecaPlayer = pecaPlayer;
		}
コード例 #20
0
		public UpdateChannelInfoCommand(PecaPlayerControl pecaPlayer)
		{
			this.pecaPlayer = pecaPlayer;
		}
コード例 #21
0
		public VolumeDownCommand(PecaPlayerControl pecaPlayer)
		{
			this.pecaPlayer = pecaPlayer;
		}
コード例 #22
0
		public VolumeBalanceCommand(PecaPlayerControl pecaPlayer)
		{
			this.pecaPlayer = pecaPlayer;
		}