コード例 #1
0
ファイル: AssetLister.cs プロジェクト: zparr/ATF
        private void RightPaneAddItem(IResource resource)
        {
            if (m_thumbnailControl.Visible)
            {
                m_requestedThumbs.Add(resource);
                m_thumbnailService.ResolveThumbnail(resource);
                string assetPath     = resource.GetPathName();
                string assetFileName = Path.GetFileName(assetPath);
                Icon   shellIcon     = FileIconUtil.GetFileIcon(assetFileName, FileIconUtil.IconSize.Large, false);
                Bitmap tempThumbnail = shellIcon.ToBitmap();

                ThumbnailControlItem item = GetItem(resource);
                if (item == null)
                {
                    item = NewItem(resource, tempThumbnail);
                    m_thumbnailControl.Items.Add(item);
                }
                else
                {
                    item.Image = tempThumbnail;
                }
            }
            else if (m_listView.Visible)
            {
                string assetPath = resource.Uri.OriginalString;
                string indicator = null;
                if (m_sourceControlService != null)
                {
                    SourceControlStatus status = m_sourceControlService.GetStatus(resource.Uri);
                    indicator = SetSourceControlIndicator(resource.Uri, status);
                }
                string path = resource.GetPathName();
            }
        }
コード例 #2
0
        // Returns the Uri tag of the item at the specified point in the specified control,
        // or null if none found
        private Uri GetClickedItemUri(Control control, Point point)
        {
            Uri resourceUri = null;
            ThumbnailControl thumbnailControl = control as ThumbnailControl;

            if (thumbnailControl != null)
            {
                ThumbnailControlItem item = thumbnailControl.PickThumbnail(point);
                if (item != null)
                {
                    resourceUri = GetUriFromTag(item.Tag);
                }
            }
            else
            {
                ListView fileListView = control as ListView;
                if ((fileListView != null) && (fileListView.SelectedItems.Count > 0))
                {
                    ListViewItem item = fileListView.SelectedItems[0];
                    if (item != null)
                    {
                        resourceUri = GetUriFromTag(item.Tag);
                    }
                }
            }

            return(resourceUri);
        }
コード例 #3
0
ファイル: AssetLister.cs プロジェクト: zparr/ATF
        private void ThumbnailManager_ThumbnailReady(object sender, ThumbnailReadyEventArgs e)
        {
            // get rid of temporary thumbnail
            IResource asset = e.Resource;

            if (m_requestedThumbs.Contains(asset))
            {
                // Make sure that asset is still valid
                //DomCollection assetCollection = asset.InternalObject.Collection;
                //if (assetCollection != null &&
                //    assetCollection.Repository != null)
                {
                    ThumbnailControlItem item = GetItem(asset);
                    if (item == null)
                    {
                        item = NewItem(asset, e.Image);
                        m_thumbnailControl.Items.Add(item);
                    }
                    else
                    {
                        item.Image = e.Image;
                    }
                }

                m_requestedThumbs.Remove(asset);
            }
        }
コード例 #4
0
ファイル: AssetLister.cs プロジェクト: zparr/ATF
        private IResource SelectedAsset(Control control, Point point)
        {
            IResource        asset            = null;
            ThumbnailControl thumbnailControl = control as ThumbnailControl;

            if (thumbnailControl != null)
            {
                ThumbnailControlItem item = thumbnailControl.PickThumbnail(point);
                if (item != null)
                {
                    asset = item.Tag as IResource;
                }
            }
            else
            {
                ListView fileListView = control as ListView;
                if ((fileListView != null) && (fileListView.SelectedItems.Count > 0))
                {
                    ListViewItem listItem = fileListView.SelectedItems[0];
                    asset = listItem.Tag as IResource;
                }
            }

            return(asset);
        }
コード例 #5
0
        private ThumbnailControlItem NewItem(Uri resourceUri, Image image)
        {
            ThumbnailControlItem item = new ThumbnailControlItem(image);

            item.Tag = resourceUri;

            item.Name        = Path.GetFileName(resourceUri.LocalPath);
            item.Description = resourceUri.LocalPath;

            return(item);
        }
コード例 #6
0
ファイル: AssetLister.cs プロジェクト: zparr/ATF
        private void thumbnailControl_MouseDown(object sender, MouseEventArgs e)
        {
            Point point = new Point(e.X, e.Y);

            if (e.Button == MouseButtons.Left)
            {
                m_hitPoint = point;
            }
            else if (e.Button == MouseButtons.Right)
            {
                IResource asset = null;
                if (m_thumbnailControl.Visible)
                {
                    asset = SelectedAsset(m_thumbnailControl, point);
                }
                else
                {
                    asset = SelectedAsset(m_listView, point);
                }

                if (asset != null)
                {
                    if (m_thumbnailControl.Visible)
                    {
                        ThumbnailControlItem item = m_thumbnailControl.PickThumbnail(point);
                        Keys modifiers            = Control.ModifierKeys;
                        if ((modifiers & Keys.Control) != 0)
                        {
                            m_thumbnailControl.Selection.Toggle(item);
                        }
                        else if ((modifiers & Keys.Shift) != 0)
                        {
                            m_thumbnailControl.Selection.Add(item);
                        }
                        else
                        {
                            m_thumbnailControl.Selection.Set(item);
                        }
                        m_thumbnailControl.Invalidate();
                    }
                    IResource assetObj = asset as IResource;
                    if (assetObj != null)
                    {
                        ISelectionContext selectionContext = m_rootAssetFolder.As <ISelectionContext>();
                        selectionContext.Selection.Set(assetObj);
                    }
                }
            }
        }
コード例 #7
0
ファイル: AssetLister.cs プロジェクト: zparr/ATF
        private ThumbnailControlItem NewItem(IResource resource, Image image)
        {
            ThumbnailControlItem item = new ThumbnailControlItem(image);

            item.Tag = resource;

            item.Name        = Path.GetFileName(resource.GetPathName());
            item.Description = resource.GetPathName();

            // Set source control status
            if (m_sourceControlService != null)
            {
                SourceControlStatus status = m_sourceControlService.GetStatus(resource.Uri);
                item.Indicator = SetSourceControlIndicator(resource.Uri, status);
            }

            return(item);
        }
コード例 #8
0
ファイル: AssetLister.cs プロジェクト: zparr/ATF
        private void RefreshThumbnail(IResource asset)
        {
            m_requestedThumbs.Add(asset);
            m_thumbnailService.ResolveThumbnail(asset);
            string assetPath          = asset.GetPathName();
            string assetFileName      = Path.GetFileName(assetPath);
            Icon   shellIcon          = FileIconUtil.GetFileIcon(assetFileName, FileIconUtil.IconSize.Large, false);
            Bitmap tempThumbnail      = shellIcon.ToBitmap();
            ThumbnailControlItem item = GetItem(asset);

            if (item == null)
            {
                item = NewItem(asset, tempThumbnail);
                m_thumbnailControl.Items.Add(item);
            }
            else
            {
                item.Image = tempThumbnail;
            }
        }
コード例 #9
0
        private void ThumbnailManager_ThumbnailReady(object sender, ThumbnailReadyEventArgs e)
        {
            // get rid of temporary thumbnail
            Uri resourceUri = e.ResourceUri;

            if (m_requestedThumbs.Contains(resourceUri))
            {
                ThumbnailControlItem item = GetItem(resourceUri);
                if (item == null)
                {
                    item = NewItem(resourceUri, e.Image);
                    m_thumbnailControl.Items.Add(item);
                }
                else
                {
                    item.Image = e.Image;
                }

                m_requestedThumbs.Remove(resourceUri);
            }
        }
コード例 #10
0
ファイル: ThumbnailControl.cs プロジェクト: ldh9451/XLE
 private void EndHover()
 {
     if (m_hoverLabel != null)
     {
         m_hoverLabel.Hide();
         m_hoverLabel.Dispose();
         m_hoverLabel = null;
         m_hoverThumbnail = null;
     }
     m_hoverTimer.Stop();
 }
コード例 #11
0
ファイル: ThumbnailControl.cs プロジェクト: ldh9451/XLE
        /// <summary>
        /// Raises the MouseMove event</summary>
        /// <param name="e">Event args</param>
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.None)
            {
                ThumbnailControlItem thumbnail = PickThumbnail(new Point(e.X, e.Y));
                if (thumbnail != m_hoverThumbnail)
                {
                    m_hoverThumbnail = thumbnail;
                    m_hoverTimer.Start();
                }
            }

            if (m_multiSelecting)
            {
                m_mousePt = e.Location;
                Invalidate();
            }

            base.OnMouseMove(e);
        }