예제 #1
0
        private void bnLimits_Click(object sender, EventArgs e)
        {
            int       idx   = listBox1.SelectedIndex;
            ClipEntry pClip = null;

            if (idx != -1)
            {
                pClip = m_pPlayer.GetClipByIndex(idx);
            }

            if (pClip != null)
            {
                // duration, limits dlg -- set clip limits (in seconds)
                long lDur = ((pClip.NativeDuration() + UNITS - 1) / UNITS);
                long tStart, tStop;
                pClip.GetLimits(out tStart, out tStop);
                long lStart = ((tStart + UNITS - 1) / UNITS);
                long lStop  = -1;
                if (tStop != 0)
                {
                    lStop = ((tStop + UNITS - 1) / UNITS);
                }

                fmLimits dlg = new fmLimits((pClip.Duration() + UNITS - 1) / UNITS);
                dlg.tbStart.Text = lStart.ToString();
                dlg.tbStop.Text  = lStop.ToString();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    long tStart2 = int.Parse(dlg.tbStart.Text) * UNITS;
                    long tStop2  = pClip.NativeDuration();
                    if (int.Parse(dlg.tbStop.Text) > 0)
                    {
                        tStop2 = int.Parse(dlg.tbStop.Text) * UNITS;
                    }
                    m_pPlayer.SetClipLimits(pClip, tStart2, tStop2);

                    string sDesc = string.Format("{0} [{1}..{2}]", pClip.Name(), tStart2 / UNITS, tStop2 / UNITS);

                    int n = listBox1.SelectedIndex;

                    listBox1.Items.RemoveAt(n);
                    listBox1.Items.Insert(n, sDesc);
                }
            }
        }
예제 #2
0
        private void bnClickedAdd_Click(object sender, EventArgs e)
        {
            openFileDialog1.CheckFileExists = true;
            openFileDialog1.ReadOnlyChecked = true;

            if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
            {
                ClipEntry pClip;
                int       hr = m_pPlayer.AddClip(openFileDialog1.FileName, out pClip);
                if (hr < 0)
                {
                    MessageBox.Show("Cannot add clip: format not support", "Incompatible Clip");
                    return;
                }

                // duration, limits dlg -- set clip limits (in seconds)
                string sDesc;

                fmLimits dlg = new fmLimits((pClip.Duration() + UNITS - 1) / UNITS);
                dlg.tbStart.Text = "0";
                dlg.tbStop.Text  = "";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    long tStart = int.Parse(dlg.tbStart.Text) * UNITS;
                    long tStop  = pClip.Duration();
                    if (dlg.tbStop.Text.Length > 0 && int.Parse(dlg.tbStop.Text) > 0)
                    {
                        tStop = int.Parse(dlg.tbStop.Text) * UNITS;
                    }
                    m_pPlayer.SetClipLimits(pClip, tStart, tStop);

                    // append range to clip description text
                    sDesc = string.Format("{0} [{1}..{2}]", pClip.Name(), tStart / UNITS, tStop / UNITS);
                    int it = listBox1.Items.Add(sDesc);
                    listBox1.SelectedIndex = it;
                }
            }
        }
예제 #3
0
        private void bnClickedAdd_Click(object sender, EventArgs e)
        {
            openFileDialog1.CheckFileExists = true;
            openFileDialog1.ReadOnlyChecked = true;

            if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
            {
                ClipEntry pClip;
                int hr = m_pPlayer.AddClip(openFileDialog1.FileName, out pClip);
                if (hr < 0)
                {
                    MessageBox.Show("Cannot add clip: format not support", "Incompatible Clip");
                    return;
                }

                // duration, limits dlg -- set clip limits (in seconds)
                string sDesc;

                fmLimits dlg = new fmLimits((pClip.Duration() + UNITS - 1) / UNITS);
                dlg.tbStart.Text = "0";
                dlg.tbStop.Text = "";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    long tStart = int.Parse(dlg.tbStart.Text) * UNITS;
                    long tStop = pClip.Duration();
                    if (dlg.tbStop.Text.Length > 0 && int.Parse(dlg.tbStop.Text) > 0)
                    {
                        tStop = int.Parse(dlg.tbStop.Text) * UNITS;
                    }
                    m_pPlayer.SetClipLimits(pClip, tStart, tStop);

                    // append range to clip description text
                    sDesc = string.Format("{0} [{1}..{2}]", pClip.Name(), tStart / UNITS, tStop / UNITS);
                    int it = listBox1.Items.Add(sDesc);
                    listBox1.SelectedIndex = it;
                }
            }
        }
예제 #4
0
        private void bnLimits_Click(object sender, EventArgs e)
        {
            int idx = listBox1.SelectedIndex;
            ClipEntry pClip = null;
            if (idx != -1)
            {
                pClip = m_pPlayer.GetClipByIndex(idx);
            }

            if (pClip != null)
            {
                // duration, limits dlg -- set clip limits (in seconds)
                long lDur = ((pClip.NativeDuration() + UNITS - 1) / UNITS);
                long tStart, tStop;
                pClip.GetLimits(out tStart, out tStop);
                long lStart = ((tStart + UNITS - 1) / UNITS);
                long lStop = -1;
                if (tStop != 0)
                {
                    lStop = ((tStop + UNITS - 1) / UNITS);

                }

                fmLimits dlg = new fmLimits((pClip.Duration() + UNITS - 1) / UNITS);
                dlg.tbStart.Text = lStart.ToString();
                dlg.tbStop.Text = lStop.ToString();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    long tStart2 = int.Parse(dlg.tbStart.Text) * UNITS;
                    long tStop2 = pClip.NativeDuration();
                    if (int.Parse(dlg.tbStop.Text) > 0)
                    {
                        tStop2 = int.Parse(dlg.tbStop.Text) * UNITS;
                    }
                    m_pPlayer.SetClipLimits(pClip, tStart2, tStop2);

                    string sDesc = string.Format("{0} [{1}..{2}]", pClip.Name(), tStart2 / UNITS, tStop2 / UNITS);

                    int n = listBox1.SelectedIndex;

                    listBox1.Items.RemoveAt(n);
                    listBox1.Items.Insert(n, sDesc);
                }
            }
        }