Ejemplo n.º 1
0
        private void manequinTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Tag is ManequinPoint)
            {
                editShake = false;
                lastManequinNode = e.Node;
            }
            else if (e.Node.Tag is Shake)
            {
                editShake = true;
                shake = (Shake)e.Node.Tag;
            }

            Refresh(e.Node);
        }
Ejemplo n.º 2
0
        private void addShakeButton_Click(object sender, EventArgs e)
        {
            Manequin m = GetManequin(manequinTreeView.SelectedNode);

            shake = new Shake();
            drawShake = true;
        }
Ejemplo n.º 3
0
        private void manequinPictureBox_MouseUp(object sender, MouseEventArgs e)
        {
            if (drawShake)
            {
                drawShake = false;

                if (shake != null)
                {
                    shake.DestinationRelX = ((float)e.X) / manequinPictureBox.Width;
                    shake.DestinationRelY = ((float)e.Y) / manequinPictureBox.Height;

                    Manequin m = GetManequin(manequinTreeView.SelectedNode);
                    m.AddShake(shake);

                    shake = null;
                }

                Refresh(manequinTreeView.SelectedNode);
            }
            else if (editShake)
            {
                editShake = false;

                if (shake != null)
                {
                    manequinTreeView.SelectedNode.Tag = shake;

                    shake.DestinationRelX = ((float)e.X) / manequinPictureBox.Width;
                    shake.DestinationRelY = ((float)e.Y) / manequinPictureBox.Height;

                    shake = null;

                    Refresh(manequinTreeView.SelectedNode);
                }
            }
        }
Ejemplo n.º 4
0
        private void manequinPictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            if (drawShake || editShake)
            {
                if (shake == null)
                    shake = new Shake();

                shake.OriginRelX = ((float)e.X) / manequinPictureBox.Width;
                shake.OriginRelY = ((float)e.Y) / manequinPictureBox.Height;

                if (editShake)
                {
                    shake.DestinationRelX = -1;
                    shake.DestinationRelY = -1;
                }

                Refresh(manequinTreeView.SelectedNode);
            }
        }
Ejemplo n.º 5
0
        public void LoadValues(string manequinXml)
        {
            this.Manequins.Clear();

            using (DataSet ds = new DataSet())
            {
                ds.ReadXml(new StringReader(manequinXml));

                SongName = ds.Tables["SongManequin"].Rows[0]["SongName"].ToString();

                if (ds.Tables.Contains("Manequin"))
                {
                    foreach (DataRow row in ds.Tables["Manequin"].Rows)
                    {
                        Manequin m = new Manequin();
                        m.ManequinText = row[0].ToString();

                        foreach (DataRow mp in row.GetChildRows(ds.Tables["Manequin"].ChildRelations["Manequin_ManequinPart"].RelationName))
                        {
                            ManequinPoint p = m.GetPoint(mp[0].ToString());
                            p.XRel = mp["XRel"].ToString().ToDouble();
                            p.YRel = mp["YRel"].ToString().ToDouble();
                        }

                        if (ds.Tables.Contains("Shakes"))
                        {
                            foreach (DataRow shakesRow in row.GetChildRows(ds.Tables["Manequin"].ChildRelations["Manequin_Shakes"].RelationName))
                            {

                                foreach (DataRow shakeRow in shakesRow.GetChildRows(ds.Tables["Shakes"].ChildRelations["Shakes_Shake"].RelationName))
                                {
                                    Shake shake = new Shake();
                                    shake.OriginRelX = shakeRow["OrigX"].ToString().ToFloat();
                                    shake.OriginRelY = shakeRow["OrigY"].ToString().ToFloat();
                                    shake.DestinationRelX = shakeRow["DestX"].ToString().ToFloat();
                                    shake.DestinationRelY = shakeRow["DestY"].ToString().ToFloat();

                                    m.Shakes.Add(shake);
                                }
                            }
                        }

                        this.Manequins.Add(m);
                    }
                }
            }
        }
Ejemplo n.º 6
0
 internal void Delete(Shake shake)
 {
     Shakes.Remove(shake);
 }
Ejemplo n.º 7
0
        public void AddShake(Shake shake)
        {
            Shakes.Add(shake);

            TreeNode node = new TreeNode(string.Format("Skakning {0}", Shakes.Count));
            node.Tag = shake;

            shakesNode.Nodes.Add(node);
        }