private void PopulateControls(List <InfosThumbnail> _infosThumbQueue)
        {
            // Unqueue bitmaps and populate the controls
            for (int i = _infosThumbQueue.Count - 1; i >= 0; i--)
            {
                // Double check.
                if (m_iLastFilled + 1 < m_Panel.Controls.Count)
                {
                    m_iLastFilled++;
                    ThumbListViewItem tlvi = m_Panel.Controls[m_iLastFilled] as ThumbListViewItem;
                    if (tlvi != null)
                    {
                        if (_infosThumbQueue[i] != null)
                        {
                            if (_infosThumbQueue[i].Thumbnails.Count > 0)
                            {
                                tlvi.Thumbnails = _infosThumbQueue[i].Thumbnails;
                                if (_infosThumbQueue[i].IsImage)
                                {
                                    tlvi.IsImage  = true;
                                    tlvi.Duration = "0";
                                }
                                else
                                {
                                    tlvi.Duration = TimeHelper.MillisecondsToTimecode((double)_infosThumbQueue[i].iDurationMilliseconds, false, true);
                                }

                                tlvi.ImageSize = (Size)_infosThumbQueue[i].imageSize;
                                tlvi.HasKva    = _infosThumbQueue[i].HasKva;
                            }
                            else
                            {
                                tlvi.DisplayAsError();
                            }
                        }
                        else
                        {
                            tlvi.DisplayAsError();
                        }

                        // Issue: We computed the .top coord of the thumb when the panel wasn't moving.
                        // If we are scrolling, the .top of the panel is moving,
                        // so the thumbnails will be activated at the wrong spot.
                        if (m_Panel.AutoScrollPosition.Y != 0)
                        {
                            tlvi.Top = tlvi.Top + m_Panel.AutoScrollPosition.Y;
                        }

                        m_Panel.Controls[m_iLastFilled].Visible = true;
                    }

                    _infosThumbQueue.RemoveAt(i);
                }
            }
            m_Panel.Invalidate();
        }
Exemple #2
0
        private void ThumbListViewItem_LaunchVideo(object sender, EventArgs e)
        {
            CancelEditMode();
            ThumbListViewItem tlvi = sender as ThumbListViewItem;

            if (tlvi != null && !tlvi.ErrorImage)
            {
                m_ScreenManagerUIContainer.DropLoadMovie(tlvi.FileName, -1);
            }
        }
Exemple #3
0
        private void CancelEditMode()
        {
            m_bEditMode = false;

            // Browse all thumbs and make sure they are all in normal mode.
            for (int i = 0; i < splitResizeBar.Panel2.Controls.Count; i++)
            {
                ThumbListViewItem tlvi = splitResizeBar.Panel2.Controls[i] as ThumbListViewItem;
                if (tlvi != null)
                {
                    tlvi.CancelEditMode();
                }
            }
        }
Exemple #4
0
        private void Panel2MouseDown(object sender, MouseEventArgs e)
        {
            // Clicked nowhere.

            // 1. Deselect all videos.
            if (m_SelectedVideo != null)
            {
                m_SelectedVideo.SetUnselected();
                m_SelectedVideo = null;
            }

            // 2. Toggle off edit mode.
            CancelEditMode();
        }
Exemple #5
0
        private void SetupPlaceHolders(List <String> _fileNames)
        {
            //-----------------------------------------------------------
            // Creates a list of thumb boxes to hold this folder's thumbs
            // They will be turned visible only when
            // they are loaded with their respective thumbnail.
            //-----------------------------------------------------------

            log.Debug("Organizing placeholders.");

            CleanupThumbnails();

            if (_fileNames.Count > 0)
            {
                ToggleButtonsVisibility(true);

                int iColumnWidth = (splitResizeBar.Panel2.Width - m_iLeftMargin - m_iRightMargin) / m_iCurrentSize;

                m_iHorzSpacing = iColumnWidth / 20;
                m_iVertSpacing = m_iHorzSpacing;

                for (int i = 0; i < _fileNames.Count; i++)
                {
                    ThumbListViewItem tlvi = new ThumbListViewItem();

                    tlvi.FileName       = _fileNames[i];
                    tlvi.Tag            = i;
                    tlvi.ToolTipHandler = toolTip1;
                    tlvi.SetSize(iColumnWidth - m_iHorzSpacing);
                    tlvi.Location         = new Point(0, 0);
                    tlvi.LaunchVideo     += new ThumbListViewItem.LaunchVideoHandler(ThumbListViewItem_LaunchVideo);
                    tlvi.VideoSelected   += new ThumbListViewItem.VideoSelectedHandler(ThumbListViewItem_VideoSelected);
                    tlvi.FileNameEditing += new ThumbListViewItem.FileNameEditingHandler(ThumbListViewItem_FileNameEditing);

                    // Organize
                    int iRow = i / m_iCurrentSize;
                    int iCol = i - (iRow * m_iCurrentSize);
                    tlvi.Location = new Point(m_iLeftMargin + (iCol * (tlvi.Size.Width + m_iHorzSpacing)), m_iTopMargin + (iRow * (tlvi.Size.Height + m_iVertSpacing)));

                    tlvi.Visible = false;
                    splitResizeBar.Panel2.Controls.Add(tlvi);
                }
            }
            else
            {
                ToggleButtonsVisibility(false);
            }

            log.Debug("Placeholders organized.");
        }
Exemple #6
0
        public void RefreshUICulture()
        {
            btnHideThumbView.Text = ScreenManagerLang.btnHideThumbView;

            // Refresh all thumbnails.
            for (int i = 0; i < splitResizeBar.Panel2.Controls.Count; i++)
            {
                ThumbListViewItem tlvi = splitResizeBar.Panel2.Controls[i] as ThumbListViewItem;
                if (tlvi != null)
                {
                    tlvi.RefreshUICulture();
                }
            }
        }
Exemple #7
0
        private void ThumbListViewItem_VideoSelected(object sender, EventArgs e)
        {
            CancelEditMode();
            ThumbListViewItem tlvi = sender as ThumbListViewItem;

            if (tlvi != null)
            {
                if (m_SelectedVideo != null && m_SelectedVideo != tlvi)
                {
                    m_SelectedVideo.SetUnselected();
                }

                m_SelectedVideo = tlvi;
            }
        }
Exemple #8
0
        private void OrganizeThumbnailsByColumns(int iTotalCols)
        {
            // Resize and Organize thumbs to match a given number of columns
            if (splitResizeBar.Panel2.Controls.Count > 0 && !IsLoading())
            {
                log.Debug("Reorganizing thumbnails.");

                int iColumnWidth = (splitResizeBar.Panel2.Width - m_iLeftMargin - m_iRightMargin) / iTotalCols;
                m_iHorzSpacing = iColumnWidth / 20;
                m_iVertSpacing = m_iHorzSpacing;

                // Scroll up before relocating controls.
                splitResizeBar.Panel2.ScrollControlIntoView(splitResizeBar.Panel2.Controls[0]);

                splitResizeBar.Panel2.SuspendLayout();

                for (int i = 0; i < splitResizeBar.Panel2.Controls.Count; i++)
                {
                    ThumbListViewItem tlvi = splitResizeBar.Panel2.Controls[i] as ThumbListViewItem;
                    if (tlvi != null)
                    {
                        int iRow = i / iTotalCols;
                        int iCol = i - (iRow * iTotalCols);

                        tlvi.SetSize(iColumnWidth - m_iHorzSpacing);

                        Point loc = new Point();
                        loc.X         = m_iLeftMargin + (iCol * (tlvi.Size.Width + m_iHorzSpacing));
                        loc.Y         = m_iTopMargin + (iRow * (tlvi.Size.Height + m_iVertSpacing));
                        tlvi.Location = loc;
                    }
                }

                splitResizeBar.Panel2.ResumeLayout();

                log.Debug("Thumbnails reorganized.");
            }
        }
Exemple #9
0
        public void CleanupThumbnails()
        {
            // Remove the controls and deallocate any ressources used.
            for (int iCtrl = splitResizeBar.Panel2.Controls.Count - 1; iCtrl >= 0; iCtrl--)
            {
                ThumbListViewItem tlvi = splitResizeBar.Panel2.Controls[iCtrl] as ThumbListViewItem;
                if (tlvi != null)
                {
                    Image bmp = tlvi.picBox.BackgroundImage;
                    splitResizeBar.Panel2.Controls.RemoveAt(iCtrl);

                    if (!tlvi.ErrorImage)
                    {
                        if (bmp != null)
                        {
                            bmp.Dispose();
                        }
                    }
                }
            }

            m_SelectedVideo = null;
        }