示例#1
0
        private void ToolStripMenuItem_RemoveKeyframe_Click(object sender, EventArgs e)
        {
            int inIndex = (int)this.numericUpDown_NowFlame.Value;

            if (inIndex <= 0)
            {
                return;                 //0フレーム目のキーフレームは消せない
            }
            ClsDatOption clOption = ClsSystem.GetOptionFromSelectLineNo();

            if (clOption == null)
            {
                return;
            }

            //以下、キーフレーム存在チェック処理
            bool isExist = clOption.IsExistKeyFrame(inIndex);

            if (!isExist)
            {
                return;
            }

            //以下、キーフレーム削除処理
            clOption.RemoveKeyFrame(inIndex);

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
示例#2
0
        /// <summary>
        /// 行番号からオプションを取得する
        /// </summary>
        /// <param name="inLineNo">行番号</param>
        /// <returns>行番号のオプション</returns>
        public static ClsDatOption GetOptionFromLineNo(int inLineNo)
        {
            ClsDatItem clItem = ClsSystem.GetItemFromLineNo(inLineNo);

            if (clItem == null)
            {
                return(null);
            }

            ClsDatOption clOption = null;
            bool         isExist;

            if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
            {
                ClsDatElem clElem = clItem as ClsDatElem;
                if (clElem == null)
                {
                    return(null);
                }

                isExist = clElem.mDicOption.ContainsKey(EnmTypeOption.DISPLAY);
                if (!isExist)
                {
                    return(null);
                }

                clOption = clElem.mDicOption[EnmTypeOption.DISPLAY];
            }
            else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
            {
                clOption = clItem as ClsDatOption;
            }

            return(clOption);
        }
示例#3
0
        /// <summary>
        /// 行番号からエレメントを取得する
        /// その行がオプションの場合は、その親のエレメントを取得する
        /// </summary>
        /// <param name="inLineNo">行番号</param>
        /// <returns>行番号のエレメント</returns>
        public static ClsDatElem GetElemFromLineNo(int inLineNo)
        {
            if (inLineNo < 0)
            {
                return(null);
            }

            ClsDatItem clItem = ClsSystem.GetItemFromLineNo(inLineNo);

            if (clItem == null)
            {
                return(null);
            }

            if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
            {
                ClsDatElem clElem = clItem as ClsDatElem;
                return(clElem);
            }
            else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
            {
                ClsDatOption clOption = clItem as ClsDatOption;
                ClsDatElem   clElem   = clOption.mElemParent;
                return(clElem);
            }

            return(null);
        }
示例#4
0
        /// <summary>
        /// エレメント情報変更処理
        /// </summary>
        /// <param name="clElem">変更対象となるエレメント</param>
        /// <param name="enTypeOption">オプションタイプ</param>
        /// <param name="inSelectFrameNo">フレーム番号</param>
        /// <param name="isExistKeyFrame">キーフレーム存在フラグ</param>
        /// <param name="isEnable1">有効フラグ1</param>
        /// <param name="isEnable2">有効フラグ2</param>
        /// <param name="clTween1">トゥイーン1</param>
        /// <param name="clTween2">トゥイーン2</param>
        /// <param name="clValue1">値1</param>
        /// <param name="clValue2">値2</param>
        private void ChangeElem(ClsDatElem clElem, EnmTypeOption enTypeOption, int inSelectFrameNo, bool isExistKeyFrame, bool isEnable1, bool isEnable2, ClsDatTween clTween1, ClsDatTween clTween2, object clValue1, object clValue2)
        {
            ClsDatOption clOption = null;

            if (inSelectFrameNo == 0)
            {
                clElem.SetOption(enTypeOption, isEnable1, isEnable2, clTween1, clTween2, clValue1, clValue2);
            }
            else
            {
                bool isExist = clElem.IsExistOption(enTypeOption);
                if (isExist)
                {
                    clOption = clElem.GetOption(enTypeOption);
                }
                else
                {
                    clValue1 = ClsParam.GetDefaultValue1(enTypeOption);
                    clValue2 = ClsParam.GetDefaultValue2(enTypeOption);
                    clElem.SetOption(enTypeOption, isEnable1, isEnable2, clTween1, clTween2, clValue1, clValue2);
                    clOption = clElem.GetOption(enTypeOption);
                }

                if (isExistKeyFrame)
                {
                    clOption.SetKeyFrame(inSelectFrameNo, isEnable1, isEnable2, clTween1, clTween2, clValue1, clValue2);  //追加または更新
                }
                else
                {
                    clOption.RemoveKeyFrame(inSelectFrameNo);
                }
            }
        }
示例#5
0
        /// <summary>
        /// 行番号割り振り処理
        /// </summary>
        /// <param name="clMotion">モーション管理クラス</param>
        public void RefreshLineNo(ClsDatMotion clMotion)
        {
            //以下、表示しなくてはいけない種別かどうかチェックする処理
            bool isDraw = ClsDatOption.IsDraw(this.mTypeOption);

            if (isDraw)
            {
                //以下、行番号設定
                this.mLineNo = clMotion.mWorkLineNo;
                clMotion.mWorkLineNo++;
            }
        }
示例#6
0
        /// <summary>
        /// 選択中のオプションを取得する処理
        /// </summary>
        /// <returns>選択中のオプション</returns>
        public static ClsDatOption GetOptionFromSelectLineNo()
        {
            int inLineNo = ClsSystem.GetSelectLineNo();

            if (inLineNo < 0)
            {
                return(null);
            }

            ClsDatOption clOption = ClsSystem.GetOptionFromLineNo(inLineNo);

            return(clOption);
        }
示例#7
0
        /// <summary>
        /// エレメントのコントロール描画処理
        /// </summary>
        /// <param name="g">描画管理クラス</param>
        /// <param name="inSelectLineNo">選択中のライン番号</param>
        /// <param name="inWidth">描画先の幅</param>
        /// <param name="inHeight">描画先の高さ</param>
        /// <param name="clFont">フォント管理クラス</param>
        public void DrawControl(Graphics g, int inSelectLineNo, int inWidth, int inHeight, Font clFont)
        {
            //以下、表示しなくてはいけない種別かどうかチェックする処理
            bool isDraw = ClsDatOption.IsDraw(this.mTypeOption);

            if (!isDraw)
            {
                return;
            }

            //以下、横ライン描画処理
            int inY = FormControl.CELL_HEIGHT;

            //g.DrawLine(Pens.Black, 0, inY, inWidth, inY);

            //以下、背景を塗る処理
            if (inSelectLineNo == this.mLineNo)
            {
                //選択中Elementsの背景強調
                SolidBrush sb = new SolidBrush(Color.DarkGreen);
                g.FillRectangle(sb, 0, this.mLineNo * FormControl.CELL_HEIGHT, inWidth, FormControl.CELL_HEIGHT);
            }
            else
            {
                if (this.mLineNo % 2 == 0)
                {
                    SolidBrush sb = new SolidBrush(Color.Black);
                    g.FillRectangle(sb, 0, this.mLineNo * FormControl.CELL_HEIGHT, inWidth, FormControl.CELL_HEIGHT);
                }
                else
                {
                    SolidBrush sb = new SolidBrush(Color.FromArgb(0xFF, 20, 20, 30));
                    g.FillRectangle(sb, 0, this.mLineNo * FormControl.CELL_HEIGHT, inWidth, FormControl.CELL_HEIGHT);
                }
            }

            //以下、名前描画処理
            string clName = ClsTool.CnvTypeOption2Name(this.mTypeOption);

            if (!string.IsNullOrEmpty(clName))
            {
                string clBlank = this.GetTabBlank();
                g.DrawString(clBlank + clName, clFont, Brushes.White, 69, this.mLineNo * FormControl.CELL_HEIGHT + 2);
            }
        }
示例#8
0
        /// <summary>
        /// 選択中のキーフレームを取得する処理
        /// </summary>
        /// <returns>選択中のキーフレーム</returns>
        private static ClsDatKeyFrame GetKeyFrameFromSelectFrame()
        {
            ClsDatItem clItem = ClsSystem.GetItemFromSelectLineNo();

            if (clItem == null)
            {
                return(null);
            }

            //以下、エレメント設定
            ClsDatElem   clElem   = null;
            ClsDatOption clOption = null;

            if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
            {
                clElem   = clItem as ClsDatElem;
                clOption = clElem.mDicOption[EnmTypeOption.DISPLAY];
            }
            else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
            {
                clOption = clItem as ClsDatOption;
                clElem   = clOption.mElemParent;
            }

            if (clOption == null)
            {
                return(null);
            }

            int inIndex = ClsSystem.GetSelectFrameNo();

            if (inIndex != 0)
            {
                bool isExist = clOption.IsExistKeyFrame(inIndex);
                if (!isExist)
                {
                    return(null);
                }
            }

            //以下、キーフレーム取得処理
            ClsDatKeyFrame clKeyFrame = clOption.GetKeyFrame(inIndex);

            return(clKeyFrame);
        }
示例#9
0
        private void contextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            bool isRemoveElementEnable = false;
            bool isAddOptionEnable     = false;
            bool isRemoveOptionEnable  = false;

            int inLineNo = ClsSystem.GetSelectLineNo();

            if (inLineNo >= 0)
            {
                ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo);
                if (clItem != null)
                {
                    isRemoveElementEnable = true;
                    isAddOptionEnable     = true;
                }

                ClsDatOption clOption = ClsSystem.GetOptionFromLineNo(inLineNo);
                if (clOption != null)
                {
                    bool isRemoveOK = clOption.IsRemoveOK();
                    if (isRemoveOK)
                    {
                        isRemoveOptionEnable = true;
                    }
                }
            }

            this.ToolStripMenuItem_RemoveElement.Enabled = isRemoveElementEnable;
            this.ToolStripMenuItem_AddOption.Enabled     = isAddOptionEnable;
            this.ToolStripMenuItem_RemoveOption.Enabled  = isRemoveOptionEnable;
        }
示例#10
0
        private void ToolStripMenuItem_AddKeyFrame_Click(object sender, EventArgs e)
        {
            int inIndex = (int)this.numericUpDown_NowFlame.Value;

            if (inIndex <= 0)
            {
                return;                 //0フレーム目には作成できない
            }
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            ClsDatOption clOption = ClsSystem.GetOptionFromSelectLineNo();

            if (clOption == null)
            {
                return;
            }

            //以下、キーフレーム作成・更新処理
            ClsDatElem clElem       = clOption.mElemParent;
            bool       isParentFlag = ClsParam.GetDefaultParentFlag(clElem.mElem, clOption.mTypeOption);

            //以下、現在の値を取得する処理
            object         clValue1   = clOption.GetValue1(inIndex);
            object         clValue2   = clOption.GetValue2(inIndex);
            ClsDatKeyFrame clKeyFrame = new ClsDatKeyFrame(clOption.mTypeOption, inIndex, false, false, null, null, clValue1, clValue2);

            clOption.SetKeyFrame(inIndex, false, false, null, null, clValue1, clValue2);    //存在していたら更新、存在していなかったら追加

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
示例#11
0
        /// <summary>
        /// 削除可能フラグの取得
        /// </summary>
        /// <returns>削除可能フラグ</returns>
        public bool IsRemoveOK()
        {
            bool isRemoveOK = ClsDatOption.IsRemoveOK(this.mTypeOption);

            return(isRemoveOK);
        }
示例#12
0
        /// <summary>
        /// エレメントのタイムライン描画処理
        /// </summary>
        /// <param name="g">描画管理クラス</param>
        /// <param name="inSelectLineNo">選択中のライン番号</param>
        /// <param name="inSelectFrameNo">選択中のフレーム</param>
        /// <param name="inMaxFrameNum">最大フレーム数</param>
        /// <param name="inWidth">描画先の幅</param>
        /// <param name="inHeight">描画先の高さ</param>
        public void DrawTime(Graphics g, int inSelectLineNo, int inSelectFrameNo, int inMaxFrameNum, int inWidth, int inHeight)
        {
            //以下、表示しなくてはいけない種別かどうかチェックする処理
            bool isDraw = ClsDatOption.IsDraw(this.mTypeOption);

            if (!isDraw)
            {
                return;
            }

            //以下、背景を塗る処理
            SolidBrush clBrush;
            int        inX = inSelectFrameNo * FormControl.CELL_WIDTH;
            int        inY = this.mLineNo * FormControl.CELL_HEIGHT;

            if (inSelectLineNo == this.mLineNo)
            {
                //選択中Elementsの背景強調
                clBrush = new SolidBrush(Color.DarkGreen);
                g.FillRectangle(clBrush, 0, inY, inWidth, FormControl.CELL_HEIGHT);
            }
            else
            {
                if (this.mLineNo % 2 == 0)
                {
                    clBrush = new SolidBrush(Color.Black);
                    g.FillRectangle(clBrush, 0, inY, inWidth, FormControl.CELL_HEIGHT);
                }
                else
                {
                    clBrush = new SolidBrush(Color.FromArgb(0xFF, 20, 20, 30));
                    g.FillRectangle(clBrush, 0, inY, inWidth, FormControl.CELL_HEIGHT);
                }
            }

            //以下、フレームの背景(Tweenの影響下にあるかどうか)を表示する処理
            Color      stColorTween = Color.FromArgb(128, Color.LightBlue);
            SolidBrush clBrushTween = new SolidBrush(stColorTween);
            bool       isFlag       = false;
            int        inFrameNo    = 0;

            for (inFrameNo = 0; inFrameNo < inMaxFrameNum; inFrameNo++)
            {
                //以下、キーフレームが存在するかチェックする処理
                if (inFrameNo == 0)
                {
                    isFlag = true;
                }
                else
                {
                    bool isExist = this.IsExistKeyFrame(inFrameNo);
                    if (isExist)
                    {
                        ClsDatKeyFrame clKeyFrame = this.GetKeyFrame(inFrameNo);
                        isFlag = (clKeyFrame.mTween1 != null || clKeyFrame.mTween2 != null);
                    }
                }
                if (!isFlag)
                {
                    continue;
                }

                inX = inFrameNo * FormControl.CELL_WIDTH;
                inY = this.mLineNo * FormControl.CELL_HEIGHT;
                g.FillRectangle(clBrushTween, inX, inY + 10, FormControl.CELL_WIDTH, FormControl.CELL_HEIGHT / 2 - 4);
            }

            //以下、選択中のフレーム描画処理
            inX = inSelectFrameNo * FormControl.CELL_WIDTH;
            inY = this.mLineNo * FormControl.CELL_HEIGHT;
            if (inSelectLineNo == this.mLineNo)
            {
                Color stColor = Color.FromArgb(128, Color.Green);
                clBrush = new SolidBrush(stColor);
            }
            else
            {
                Color stColor = Color.FromArgb(128, Color.DarkGreen);
                clBrush = new SolidBrush(stColor);
            }
            g.FillRectangle(clBrush, inX, inY, FormControl.CELL_WIDTH, FormControl.CELL_HEIGHT);

            //以下、境界線描画処理
            Pen clPen = new Pen(Color.Green);

            inY = this.mLineNo * FormControl.CELL_HEIGHT + FormControl.CELL_HEIGHT - 1;
            g.DrawLine(clPen, 0, inY, inWidth, inY);

            //以下、キーフレーム表示処理
            for (inFrameNo = 0; inFrameNo < inMaxFrameNum; inFrameNo++)
            {
                bool isExist = this.mDicKeyFrame.ContainsKey(inFrameNo);
                if (!isExist)
                {
                    continue;
                }

                g.DrawImage(Properties.Resources.markRed, inFrameNo * FormControl.CELL_WIDTH + 2, this.mLineNo * FormControl.CELL_HEIGHT + 1);
            }
        }
示例#13
0
        private void RefreshControl()
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            int        inSelectFrameNo = ClsSystem.GetSelectFrameNo();
            int        inMaxFrameNum   = clMotion.GetMaxFrameNum();
            int        inSelectLineNo  = ClsSystem.GetSelectLineNo();
            ClsDatItem clItem          = clMotion.GetItemFromLineNo(inSelectLineNo);

            //以下、削除ボタン有効化設定
            bool isEnable = false;

            if (clItem != null)
            {
                if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                {
                    isEnable = true;
                }
                else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
                {
                    ClsDatOption clOption = clItem as ClsDatOption;
                    isEnable = clOption.IsRemoveOK();
                }
            }
            this.button_ItemRemove.Enabled = isEnable;

            //以下、アトリビュートウィンドウ設定
            if (this.mFormMain != null)
            {
                if (this.mFormMain.mFormAttribute != null)
                {
                    ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo();
                    this.mFormMain.mFormAttribute.Init(clElem, inSelectFrameNo, inMaxFrameNum);
                }
            }

            //以下、上ボタン有効化設定
            isEnable = false;
            if (clItem != null)
            {
                ClsDatElem clElem = null;
                if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                {
                    clElem = clItem as ClsDatElem;
                    if (clElem.mElem == null)
                    {
                        isEnable = clMotion.CanMoveUp(clElem);
                    }
                    else
                    {
                        //isEnable = clElem.mElem.CanMoveUp(clElem);    //自分が長男かチェックする
                    }
                }

/*
 *              else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
 *              {
 *                  ClsDatOption clOption = clItem as ClsDatOption;
 *                  clElem = clOption.mElem;
 * //                  isEnable = clElem.CanMoveUp(clOption);
 *              }
 */
            }
            this.button_ItemUp.Enabled = isEnable;

            //以下、下ボタン有効化設定
            isEnable = false;
            if (clItem != null)
            {
                ClsDatElem clElem = null;
                if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                {
                    clElem = clItem as ClsDatElem;
                    if (clElem.mElem == null)
                    {
                        isEnable = clMotion.CanMoveDown(clElem);
                    }
                    else
                    {
                    }
                }

/*
 *              else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
 *              {
 *                  ClsDatOption clOption = clItem as ClsDatOption;
 *                  clElem = clOption.mElem;
 * //                  isEnable = clElem.CanMoveDown(clOption);
 *              }
 */
            }
            this.button_ItemDown.Enabled = isEnable;
        }
示例#14
0
        private void panel_Control_MouseMove(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //以下、エレメント移動処理
            if (e.Button == MouseButtons.Left)
            {
                bool isExist = false;
                if (this.mFormDragLabel != null)
                {
                    if (!this.mFormDragLabel.IsDisposed)
                    {
                        isExist = true;
                    }
                }

                //以下、挿入マーククリア処理
                clMotion.ClearInsertMark();

                if (isExist)
                {
                    int inSelectLineNo = ClsSystem.GetSelectLineNo();
                    int inLineNo       = this.GetLineNoFromPositionY(e.Y);
                    if (inSelectLineNo != inLineNo)
                    {
                        //以下、挿入先チェック処理
                        ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo);
                        if (clItem != null)
                        {
                            //以下、挿入先のエレメントに通知する処理
                            ClsDatElem     clElem = null;
                            EnmMarkElement enMark = EnmMarkElement.NONE;
                            if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                            {
                                clElem = clItem as ClsDatElem;

                                int  inY  = e.Y % FormControl.CELL_HEIGHT;
                                bool isUp = (inY < FormControl.CELL_HEIGHT / 2);
                                enMark = (isUp) ? EnmMarkElement.UP : EnmMarkElement.IN;
                            }
                            else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
                            {
                                ClsDatOption clOption = clItem as ClsDatOption;
                                clElem = clOption.mElemParent;
                                if (inSelectLineNo == clElem.mLineNo)
                                {
                                    clElem = null;
                                }

                                enMark = EnmMarkElement.IN;
                            }

                            if (clElem != null)
                            {
                                //以下、挿入可能な旨をエレメントに通知する処理
                                clElem.SetInsertMark(enMark);
                            }
                        }
                    }
                }
                else
                {
                    //以下、掴んでいるエレメントを別ウィンドウで表示する処理
                    int        inLineNo = ClsSystem.GetSelectLineNo();
                    ClsDatItem clItem   = clMotion.FindItemFromLineNo(inLineNo);
                    if (clItem != null)
                    {
                        int    inXDiff = (Cursor.Position.X - this.mCatchPosStart.X);
                        int    inYDiff = (Cursor.Position.Y - this.mCatchPosStart.Y);
                        double doLen   = Math.Sqrt(inXDiff * inXDiff + inYDiff * inYDiff);
                        if (doLen >= 5.0)
                        {
                            ClsDatElem clElem = clItem as ClsDatElem;
                            this.mFormDragLabel = new FormDragLabel(clElem);
                            this.mFormDragLabel.Show();
                        }
                    }
                }

                //以下、コントロール更新処理
                this.RefreshControl();
                this.panel_Control.Refresh();
                this.panel_Time.Refresh();
                this.mFormMain.Refresh();
            }
        }