Пример #1
0
        public void handleCommonMouseDown(Object sender, MouseEventArgs e)
        {
            if (AppManager.getEditMode() != EditMode.NONE)
            {
                return;
            }
            DraggableBButton btn = (DraggableBButton)sender;

            if (mMainWindow != null)
            {
                mMainWindow.BringToFront();
            }

            IconDynamicsHandle handle = btn.getHandle();
            VsqEvent           item   = new VsqEvent();

            item.Clock   = 0;
            item.ID.Note = 60;
            item.ID.type = VsqIDType.Aicon;
            item.ID.IconDynamicsHandle = (IconDynamicsHandle)handle.clone();
            int length = handle.getLength();

            if (length <= 0)
            {
                length = 1;
            }
            item.ID.setLength(length);
            AppManager.mAddingEvent = item;

            btn.DoDragDrop(handle, System.Windows.Forms.DragDropEffects.All);
        }
Пример #2
0
        private void init()
        {
            foreach (var handle in VocaloSysUtil.dynamicsConfigIterator(SynthesizerType.VOCALOID1))
            {
                string           icon_id = handle.IconID;
                DraggableBButton btn     = new DraggableBButton();
                btn.Name = icon_id;
                btn.setHandle(handle);
                string buttonIconPath = handle.getButtonImageFullPath();

                bool setimg = System.IO.File.Exists(buttonIconPath);
                if (setimg)
                {
                    btn.Image = System.Drawing.Image.FromStream(new System.IO.FileStream(buttonIconPath, System.IO.FileMode.Open, System.IO.FileAccess.Read));
                }
                else
                {
                    System.Drawing.Image img = null;
                    string str     = "";
                    string caption = handle.IDS;
                    if (caption.Equals("cresc_1"))
                    {
                        img = Properties.Resources.cresc1;
                    }
                    else if (caption.Equals("cresc_2"))
                    {
                        img = Properties.Resources.cresc2;
                    }
                    else if (caption.Equals("cresc_3"))
                    {
                        img = Properties.Resources.cresc3;
                    }
                    else if (caption.Equals("cresc_4"))
                    {
                        img = Properties.Resources.cresc4;
                    }
                    else if (caption.Equals("cresc_5"))
                    {
                        img = Properties.Resources.cresc5;
                    }
                    else if (caption.Equals("dim_1"))
                    {
                        img = Properties.Resources.dim1;
                    }
                    else if (caption.Equals("dim_2"))
                    {
                        img = Properties.Resources.dim2;
                    }
                    else if (caption.Equals("dim_3"))
                    {
                        img = Properties.Resources.dim3;
                    }
                    else if (caption.Equals("dim_4"))
                    {
                        img = Properties.Resources.dim4;
                    }
                    else if (caption.Equals("dim_5"))
                    {
                        img = Properties.Resources.dim5;
                    }
                    else if (caption.Equals("Dynaff11"))
                    {
                        str = "fff";
                    }
                    else if (caption.Equals("Dynaff12"))
                    {
                        str = "ff";
                    }
                    else if (caption.Equals("Dynaff13"))
                    {
                        str = "f";
                    }
                    else if (caption.Equals("Dynaff21"))
                    {
                        str = "mf";
                    }
                    else if (caption.Equals("Dynaff22"))
                    {
                        str = "mp";
                    }
                    else if (caption.Equals("Dynaff31"))
                    {
                        str = "p";
                    }
                    else if (caption.Equals("Dynaff32"))
                    {
                        str = "pp";
                    }
                    else if (caption.Equals("Dynaff33"))
                    {
                        str = "ppp";
                    }
                    if (img != null)
                    {
                        btn.Image = img;
                    }
                    else
                    {
                        btn.Text = str;
                    }
                }
                btn.MouseDown += new MouseEventHandler(handleCommonMouseDown);
                btn.Size       = new System.Drawing.Size(buttonWidth, buttonWidth);
                int iw = 0;
                int ih = 0;
                if (icon_id.StartsWith(IconDynamicsHandle.ICONID_HEAD_DYNAFF))
                {
                    // dynaff
                    dynaffButtons.Add(btn);
                    ih = 0;
                    iw = dynaffButtons.Count - 1;
                }
                else if (icon_id.StartsWith(IconDynamicsHandle.ICONID_HEAD_CRESCEND))
                {
                    // crescend
                    crescendButtons.Add(btn);
                    ih = 1;
                    iw = crescendButtons.Count - 1;
                }
                else if (icon_id.StartsWith(IconDynamicsHandle.ICONID_HEAD_DECRESCEND))
                {
                    // decrescend
                    decrescendButtons.Add(btn);
                    ih = 2;
                    iw = decrescendButtons.Count - 1;
                }
                else
                {
                    continue;
                }
                btn.Location = new System.Drawing.Point(iw * buttonWidth, ih * buttonWidth);
                this.Controls.Add(btn);
                btn.BringToFront();
            }

            // ウィンドウのサイズを固定化する
            int height = 0;
            int width  = 0;

            if (dynaffButtons.Count > 0)
            {
                height += buttonWidth;
            }
            width = Math.Max(width, buttonWidth * dynaffButtons.Count);
            if (crescendButtons.Count > 0)
            {
                height += buttonWidth;
            }
            width = Math.Max(width, buttonWidth * crescendButtons.Count);
            if (decrescendButtons.Count > 0)
            {
                height += buttonWidth;
            }
            width           = Math.Max(width, buttonWidth * decrescendButtons.Count);
            this.ClientSize = new System.Drawing.Size(width, height);
            var size = this.Size;

            this.MaximumSize = new System.Drawing.Size(size.Width, size.Height);
            this.MinimumSize = new System.Drawing.Size(size.Width, size.Height);
        }