Ejemplo n.º 1
0
        private void ToolStripMenuItem_Add_Click(object sender, EventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo();

            if (clElem == null)
            {
                return;
            }

            //以下、オプション追加処理
            ToolStripMenuItem clITem       = sender as ToolStripMenuItem;
            EnmTypeOption     enTypeOption = (EnmTypeOption)clITem.Tag;
            object            clValue1     = ClsParam.GetDefaultValue1(enTypeOption);
            object            clValue2     = ClsParam.GetDefaultValue2(enTypeOption);

            clElem.SetOption(enTypeOption, false, false, null, null, clValue1, clValue2);

            //以下、行番号振り直し処理
            clMotion.RefreshLineNo();

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 現在選択中のアイテムを削除する
        /// </summary>
        private void RemoveItemFromSelectLineNo()
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            int inLineNo = ClsSystem.GetSelectLineNo();

            if (inLineNo < 0)
            {
                return;
            }

            //以下、アイテム削除処理
            clMotion.RemoveItemFromLineNo(inLineNo, false, true);

            //以下、行番号振り直し処理
            clMotion.RefreshLineNo();

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Ejemplo n.º 3
0
        private void panel_Control_MouseUp(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //以下、エレメントをドロップする処理
            if (e.Button == MouseButtons.Left)
            {
                if (this.mFormDragLabel != null)
                {
                    if (!this.mFormDragLabel.IsDisposed)
                    {
                        bool isHit = false;

                        //以下、子供として登録する処理
                        ClsDatElem clElemBase = clMotion.FindElemFromMark(EnmMarkElement.IN);
                        if (clElemBase != null)
                        {
                            ClsDatElem clElem = this.mFormDragLabel.GetElem();
                            clElemBase.AddElemChild(clElem);

                            isHit = true;
                        }

                        //以下、自分の兄として登録する処理
                        clElemBase = clMotion.FindElemFromMark(EnmMarkElement.UP);
                        if (clElemBase != null)
                        {
                            ClsDatElem clElem = this.mFormDragLabel.GetElem();
                            clElemBase.AddElemBigBrother(clElem);

                            isHit = true;
                        }

                        //以下、行番号割り振り処理
                        if (isHit)
                        {
                            clMotion.RefreshLineNo();
                        }
                    }

                    this.mFormDragLabel.Close();
                    this.mFormDragLabel.Dispose();
                    this.mFormDragLabel = null;
                }

                //以下、マークをクリアする処理
                clMotion.ClearInsertMark();

                //以下、コントロール更新処理
                this.RefreshControl();
                this.panel_Control.Refresh();
                this.panel_Time.Refresh();
                this.mFormMain.Refresh();
            }
        }
Ejemplo n.º 4
0
        private void panel_Control_MouseClick(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //以下、アイテム選択処理
            int inLineNo = this.GetLineNoFromPositionY(e.Y);

            ClsSystem.SetSelectFromLineNo(inLineNo);

            ClsDatElem clElem = ClsSystem.GetElemFromLineNo(inLineNo);

            if (clElem != null)
            {
                if (inLineNo == clElem.mLineNo)
                {
                    //Click Eye
                    if (0 <= e.X && e.X < 17)
                    {
                        clElem.isDisplay = !clElem.isDisplay;
                    }

                    //Click Parent
                    if (17 <= e.X && e.X < 34)
                    {
                        if (clElem.mElem != null)
                        {
                            clElem.isParent = !clElem.isParent;
                        }
                    }

                    //Click Locked
                    if (34 <= e.X && e.X < 51)
                    {
                        clElem.isLocked = !clElem.isLocked;
                    }

                    //Attribute Open
                    if (51 <= e.X && e.X < 68)
                    {
                        clElem.isOpen = !clElem.isOpen;

                        clMotion.RefreshLineNo();    //行番号とタブを割り振る処理
                    }
                }
            }

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// オプションの情報を修正する処理
        /// </summary>
        /// <param name="clParam">パラメーター情報</param>
        public void ChangeElemFromParam(ClsParam clParam)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo();

            if (clElem == null)
            {
                return;
            }

            int inSelectFrameNo = ClsSystem.GetSelectFrameNo();

            //以下、表示設定
            object clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.DISPLAY);

            this.ChangeElem(clElem, EnmTypeOption.DISPLAY, inSelectFrameNo, clParam.mDisplayKeyFrame, false, false, null, null, clParam.mDisplay, clValue2);

            //以下、座標設定
            this.ChangeElem(clElem, EnmTypeOption.POSITION, inSelectFrameNo, clParam.mPositionKeyFrame, clParam.mPositionXTween, clParam.mPositionYTween, clParam.mTweenPositionX, clParam.mTweenPositionY, clParam.mX, clParam.mY);

            //以下、回転設定
            clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.ROTATION);
            this.ChangeElem(clElem, EnmTypeOption.ROTATION, inSelectFrameNo, clParam.mRotationKeyFrame, clParam.mRotationTween, false, clParam.mTweenRotation, null, clParam.mRZ, clValue2);

            //以下、スケール設定
            this.ChangeElem(clElem, EnmTypeOption.SCALE, inSelectFrameNo, clParam.mScaleKeyFrame, clParam.mScaleXTween, clParam.mScaleYTween, clParam.mTweenScaleX, clParam.mTweenScaleY, clParam.mSX, clParam.mSY);

            //以下、オフセット設定
            this.ChangeElem(clElem, EnmTypeOption.OFFSET, inSelectFrameNo, clParam.mOffsetKeyFrame, clParam.mOffsetXTween, clParam.mOffsetYTween, clParam.mTweenOffsetX, clParam.mTweenOffsetY, clParam.mCX, clParam.mCY);

            //以下、反転設定
            this.ChangeElem(clElem, EnmTypeOption.FLIP, inSelectFrameNo, clParam.mFlipKeyFrame, false, false, null, null, clParam.mFlipH, clParam.mFlipV);

            //以下、透明設定
            clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.TRANSPARENCY);
            this.ChangeElem(clElem, EnmTypeOption.TRANSPARENCY, inSelectFrameNo, clParam.mTransKeyFrame, clParam.mTransTween, false, clParam.mTweenTrans, null, clParam.mTrans, clValue2);

            //以下、カラー設定
            clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.COLOR);
            this.ChangeElem(clElem, EnmTypeOption.COLOR, inSelectFrameNo, clParam.mColorKeyFrame, clParam.mColorTween, false, clParam.mTweenColor, null, clParam.mColor, clValue2);

            //以下、ユーザーデータ設定
            clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.USER_DATA);
            this.ChangeElem(clElem, EnmTypeOption.USER_DATA, inSelectFrameNo, clParam.mUserDataKeyFrame, false, false, null, null, clParam.mUserData, clValue2);

            //以下、行番号を振り直す処理
            clMotion.RefreshLineNo();

            //以下、メインウィンドウ更新処理
            this.mFormMain.RefreshAll();
        }
Ejemplo n.º 6
0
        private void button_ItemDown_Click(object sender, EventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            int inLineNo = ClsSystem.GetSelectLineNo();

            if (inLineNo < 0)
            {
                return;
            }

            ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo);

            if (clItem == null)
            {
                return;
            }
            if (clItem.mTypeItem != ClsDatItem.TYPE_ITEM.ELEM)
            {
                return;
            }

            //以下、一つ下に移動する処理
            ClsDatElem clElem = clItem as ClsDatElem;

            if (clElem.mElem == null)
            {
                clMotion.MoveDown(clElem);
            }
            else
            {
                clElem.mElem.MoveElemDown(clElem);
            }

            //以下、行番号振り直し処理
            clMotion.RefreshLineNo();

            //以下、改めてアイテムを選択する処理
            ClsSystem.SetSelectFromLineNo(clItem.mLineNo);   //上記の RefreshLineNo 関数内でmLineNoが変わっているはず

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 読み込み処理
        /// </summary>
        /// <param name="clListView">モーションリストビュー</param>
        /// <param name="clFilePath">ファイルパス</param>
        public static void Load(ListView clListView, string clFilePath)
        {
            ClsSystem.mMotionSelectKey = -1;

            XmlDocument clXmlDoc = new XmlDocument();

            try
            {
                //以下、xmlファイル読み込み処理
                clXmlDoc.Load(clFilePath);

                //以下、プロジェクトファイル読み込み処理
                IEnumerator iEnum = clXmlDoc.DocumentElement.GetEnumerator();
                while (iEnum.MoveNext())
                {
                    XmlElement clXmlElem = iEnum.Current as XmlElement;

                    if ("Header".Equals(clXmlElem.Name))
                    {
                        if (!"hap".Equals(clXmlElem.InnerText))
                        {
                            throw new Exception("this is not hanim project file.");
                        }

                        ClsSystem.mHeader = clXmlElem.InnerText;
                        continue;
                    }

                    if ("Ver".Equals(clXmlElem.Name))
                    {
                        Match clMatch = Regex.Match(clXmlElem.InnerText, "^\\d+$");
                        if (!clMatch.Success)
                        {
                            throw new Exception("this is not allowed version.");
                        }

                        ClsSystem.mVer = Convert.ToInt32(clXmlElem.InnerText);
                        continue;
                    }

                    if ("Image".Equals(clXmlElem.Name))
                    {
                        ClsDatImage clDatImage = new ClsDatImage();
                        clDatImage.Load(clXmlElem);

                        ClsSystem.mDicImage.Add(clDatImage.mID, clDatImage);
                        continue;
                    }

                    if ("Motion".Equals(clXmlElem.Name))
                    {
                        ClsDatMotion clDatMotion = new ClsDatMotion(0, "");
                        clDatMotion.Load(clXmlElem);

                        ListViewItem clListViewItem = new ListViewItem(clDatMotion.mName, 2);
                        clListView.Items.Add(clListViewItem);
                        clListViewItem.Tag = ClsSystem.mDicMotion.Count;

                        clDatMotion.mItemHashCode = clListViewItem.GetHashCode();
                        clDatMotion.Restore();       //モーションの親子関連付け再構築処理
                        clDatMotion.RefreshLineNo(); //行番号などを設定する処理
                        ClsSystem.mDicMotion.Add(clDatMotion.mID, clDatMotion);
                        continue;
                    }

                    throw new Exception("this is abnormality format.");
                }

                //以下、デフォルトで選択しているモーションを設定する処理
                if (clListView.Items.Count >= 1)
                {
                    ClsSystem.mMotionSelectKey = clListView.Items[0].GetHashCode();
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }