Esempio n. 1
0
 private ResourcePreview UI_CreateThumbnail(ThumbnailStrip strip)
 {
     var prev = new ResourcePreview(m_Core, m_Output);
     prev.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
     prev.MouseClick += thumbsLayout_MouseClick;
     prev.MouseDoubleClick += thumbsLayout_MouseDoubleClick;
     prev.Visible = false;
     strip.AddThumbnail(prev);
     return prev;
 }
Esempio n. 2
0
        private void InitResourcePreview(ResourcePreview prev, ResourceId id, FormatComponentType typeHint, bool force, Following follow, string bindName, string slotName)
        {
            if (id != ResourceId.Null || force)
            {
                FetchTexture tex = null;
                foreach (var t in m_Core.CurTextures)
                    if (t.ID == id)
                        tex = t;

                FetchBuffer buf = null;
                foreach (var b in m_Core.CurBuffers)
                    if (b.ID == id)
                        buf = b;

                if (tex != null)
                {
                    string fullname = bindName;
                    if (tex.customName)
                    {
                        if (fullname.Length > 0)
                            fullname += " = ";
                        fullname += tex.name;
                    }
                    if (fullname.Length == 0)
                        fullname = tex.name;

                    prev.Init(fullname, tex.width, tex.height, tex.depth, tex.mips);
                    IntPtr handle = prev.ThumbnailHandle;
                    m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
                    {
                        m_Output.AddThumbnail(handle, id, typeHint);
                    });
                }
                else if (buf != null)
                {
                    string fullname = bindName;
                    if (buf.customName)
                    {
                        if (fullname.Length > 0)
                            fullname += " = ";
                        fullname += buf.name;
                    }
                    if (fullname.Length == 0)
                        fullname = buf.name;

                    prev.Init(fullname, buf.length, 0, 0, 1);
                    IntPtr handle = prev.ThumbnailHandle;
                    m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
                    {
                        m_Output.AddThumbnail(handle, ResourceId.Null, FormatComponentType.None);
                    });
                }
                else
                {
                    prev.Init();
                    IntPtr handle = prev.ThumbnailHandle;
                    m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
                    {
                        m_Output.AddThumbnail(handle, ResourceId.Null, FormatComponentType.None);
                    });
                }

                prev.Tag = follow;
                prev.SlotName = slotName;
                prev.Visible = true;
                prev.Selected = (m_Following == follow);
            }
            else if (m_Following == follow)
            {
                FetchTexture tex = null;

                if(id != ResourceId.Null)
                    foreach (var t in m_Core.CurTextures)
                        if (t.ID == id)
                            tex = t;

                IntPtr handle = prev.ThumbnailHandle;
                if (id == ResourceId.Null || tex == null)
                    prev.Init();
                else
                    prev.Init("Unused", tex.width, tex.height, tex.depth, tex.mips);
                prev.Selected = true;
                m_Core.Renderer.BeginInvoke((ReplayRenderer rep) =>
                {
                    m_Output.AddThumbnail(handle, ResourceId.Null, FormatComponentType.None);
                });
            }
            else
            {
                prev.Init();
                prev.Visible = false;
            }
        }
Esempio n. 3
0
 public void AddThumbnail(ResourcePreview r)
 {
     panel.Controls.Add(r);
     m_Thumbnails.Add(r);
 }
Esempio n. 4
0
        private void UI_CreateThumbnails()
        {
            if (rtPanel.Thumbnails.Length > 0 || texPanel.Thumbnails.Length > 0) return;

            rtPanel.SuspendLayout();
            texPanel.SuspendLayout();

            for (int i = 0; i < 128; i++)
            {
                var prev = new ResourcePreview(m_Core, m_Output);
                prev.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
                prev.SlotName = i.ToString();
                prev.MouseClick += thumbsLayout_MouseClick;
                prev.MouseDoubleClick += thumbsLayout_MouseDoubleClick;
                rtPanel.AddThumbnail(prev);

                if(i == 0)
                    prev.Selected = true;
            }

            {
                var prev = new ResourcePreview(m_Core, m_Output);
                prev.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
                prev.SlotName = "D";
                prev.MouseClick += thumbsLayout_MouseClick;
                prev.MouseDoubleClick += thumbsLayout_MouseDoubleClick;
                rtPanel.AddThumbnail(prev);
            }

            for (int i = 0; i < 128; i++)
            {
                var prev = new ResourcePreview(m_Core, m_Output);
                prev.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
                prev.SlotName = i.ToString();
                prev.MouseClick += thumbsLayout_MouseClick;
                prev.MouseDoubleClick += thumbsLayout_MouseDoubleClick;
                texPanel.AddThumbnail(prev);
            }

            foreach (var c in rtPanel.Thumbnails)
                c.Visible = false;

            foreach (var c in texPanel.Thumbnails)
                c.Visible = false;

            rtPanel.ResumeLayout();
            texPanel.ResumeLayout();
        }
Esempio n. 5
0
 public void AddThumbnail(ResourcePreview r)
 {
     panel.Controls.Add(r);
     m_Thumbnails.Add(r);
 }