Anonymous avatar Anonymous committed 5528ecf

Fixed DesignMode in DocumentForm. Added TextureBrowser to Windows port.

Comments (0)

Files changed (9)

Classes/MyDocument.cpp

 			this->allItemsAction(L"Triangulate", gcnew Action(this, &MyDocument::triangulateSelectedCore));
 		}
 	}
+
+	uint MyDocument::textureCount()
+	{
+		return textures->count();
+	}
+
+	void MyDocument::addTexture(String ^fileName)
+	{
+		Texture *texture = new Texture();
+		texture->setName(fileName);
+		texture->setImage(gcnew Bitmap(fileName));
+		textures->addTexture(texture);
+	}
+
+	void MyDocument::removeTextureAtIndex(uint index)
+	{
+		textures->removeTextureAtIndex(index, *items);
+		setNeedsDisplayOnAllViews();
+	}
+
+	String ^MyDocument::textureNameAtIndex(uint index)
+	{
+		return textures->textureAtIndex(index)->name();
+	}
+
+	Bitmap ^MyDocument::textureImageAtIndex(uint index)
+	{
+		return textures->textureAtIndex(index)->image();
+	}
+
+	void MyDocument::setTextureAtIndex(uint index)
+	{
+		Texture *texture = textures->textureAtIndex(index);
+		Mesh2 *mesh = currentMesh();
+		if (mesh != NULL)
+		{
+			mesh->setTexture(texture);
+			setNeedsDisplayOnAllViews();
+		}
+	}
 }
 
 #elif defined(__linux__)

Classes/MyDocument.h

 		void writeModel3D(MemoryStream ^memoryStream);
 		void readWavefrontObject(String ^asciiString);
 		String ^writeWavefrontObject();
+
+		uint textureCount();
+		void addTexture(String ^fileName);
+		void removeTextureAtIndex(uint index);
+		String ^textureNameAtIndex(uint index);
+		Bitmap ^textureImageAtIndex(uint index);
+		void setTextureAtIndex(uint index);
 	};
 }
 

Classes/Texture.cpp

 		if (components == 3)
 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
 		else if (components == 4)
+		{
+#if defined (WIN32)
+			GLubyte *rgbaData = (GLubyte *)malloc(width * height * components);
+			for (int i = 0; i < width * height; i++)
+			{
+				rgbaData[i * components + 0] = data[i * components + 2];
+				rgbaData[i * components + 1] = data[i * components + 1];
+				rgbaData[i * components + 2] = data[i * components + 0];
+				rgbaData[i * components + 3] = data[i * components + 3];
+			}
+			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, rgbaData);
+			free(rgbaData);
+#else
 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
+#endif
+		}
 		else
 			throw MeshMaker::UnsupportedImageFormatException();
 	}

MeshMaker/DocumentForm.Designer.cs

         private void InitializeComponent()
         {
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DocumentForm));
-            this.frontView = new MeshMakerCppCLI.OpenGLSceneView();
+            this.frontViewPanel = new System.Windows.Forms.Panel();
             this.mainSplit = new System.Windows.Forms.SplitContainer();
             this.topSplit = new System.Windows.Forms.SplitContainer();
-            this.leftView = new MeshMakerCppCLI.OpenGLSceneView();
-            this.topView = new MeshMakerCppCLI.OpenGLSceneView();
+            this.leftViewPanel = new System.Windows.Forms.Panel();
+            this.topViewPanel = new System.Windows.Forms.Panel();
             this.bottomSplit = new System.Windows.Forms.SplitContainer();
-            this.perspectiveView = new MeshMakerCppCLI.OpenGLSceneView();
+            this.perspectiveViewPanel = new System.Windows.Forms.Panel();
             this.menuStrip1 = new System.Windows.Forms.MenuStrip();
             this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripTextBoxSelectionY = new System.Windows.Forms.ToolStripTextBox();
             this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel();
             this.toolStripTextBoxSelectionZ = new System.Windows.Forms.ToolStripTextBox();
+            this.textureBrowserToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             ((System.ComponentModel.ISupportInitialize)(this.mainSplit)).BeginInit();
             this.mainSplit.Panel1.SuspendLayout();
             this.mainSplit.Panel2.SuspendLayout();
             this.toolStripBottom.SuspendLayout();
             this.SuspendLayout();
             // 
-            // frontView
+            // frontViewPanel
             // 
-            this.frontView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
-            this.frontView.CurrentCameraMode = CameraMode.Perspective;
-            this.frontView.Delegate = null;
-            this.frontView.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.frontView.Location = new System.Drawing.Point(0, 0);
-            this.frontView.Name = "frontView";
-            this.frontView.SharedContextView = null;
-            this.frontView.Size = new System.Drawing.Size(395, 165);
-            this.frontView.TabIndex = 0;
+            this.frontViewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.frontViewPanel.Location = new System.Drawing.Point(0, 0);
+            this.frontViewPanel.Name = "frontViewPanel";
+            this.frontViewPanel.Size = new System.Drawing.Size(431, 229);
+            this.frontViewPanel.TabIndex = 0;
             // 
             // mainSplit
             // 
             // mainSplit.Panel2
             // 
             this.mainSplit.Panel2.Controls.Add(this.bottomSplit);
-            this.mainSplit.Size = new System.Drawing.Size(843, 400);
-            this.mainSplit.SplitterDistance = 231;
+            this.mainSplit.Size = new System.Drawing.Size(862, 461);
+            this.mainSplit.SplitterDistance = 228;
             this.mainSplit.TabIndex = 1;
             // 
             // topSplit
             // 
             // topSplit.Panel1
             // 
-            this.topSplit.Panel1.Controls.Add(this.leftView);
+            this.topSplit.Panel1.Controls.Add(this.leftViewPanel);
             // 
             // topSplit.Panel2
             // 
-            this.topSplit.Panel2.Controls.Add(this.topView);
-            this.topSplit.Size = new System.Drawing.Size(843, 231);
-            this.topSplit.SplitterDistance = 395;
+            this.topSplit.Panel2.Controls.Add(this.topViewPanel);
+            this.topSplit.Size = new System.Drawing.Size(862, 228);
+            this.topSplit.SplitterDistance = 431;
             this.topSplit.TabIndex = 2;
             this.topSplit.SplitterMoving += new System.Windows.Forms.SplitterCancelEventHandler(this.topSplit_SplitterMoving);
             this.topSplit.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.topSplit_SplitterMoved);
             // 
-            // leftView
-            // 
-            this.leftView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
-            this.leftView.CurrentCameraMode = CameraMode.Perspective;
-            this.leftView.Delegate = null;
-            this.leftView.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.leftView.Location = new System.Drawing.Point(0, 0);
-            this.leftView.Name = "leftView";
-            this.leftView.SharedContextView = null;
-            this.leftView.Size = new System.Drawing.Size(395, 231);
-            this.leftView.TabIndex = 0;
-            // 
-            // topView
-            // 
-            this.topView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
-            this.topView.CurrentCameraMode = CameraMode.Perspective;
-            this.topView.Delegate = null;
-            this.topView.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.topView.Location = new System.Drawing.Point(0, 0);
-            this.topView.Name = "topView";
-            this.topView.SharedContextView = null;
-            this.topView.Size = new System.Drawing.Size(444, 231);
-            this.topView.TabIndex = 0;
+            // leftViewPanel
+            // 
+            this.leftViewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.leftViewPanel.Location = new System.Drawing.Point(0, 0);
+            this.leftViewPanel.Name = "leftViewPanel";
+            this.leftViewPanel.Size = new System.Drawing.Size(431, 228);
+            this.leftViewPanel.TabIndex = 0;
+            // 
+            // topViewPanel
+            // 
+            this.topViewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.topViewPanel.Location = new System.Drawing.Point(0, 0);
+            this.topViewPanel.Name = "topViewPanel";
+            this.topViewPanel.Size = new System.Drawing.Size(427, 228);
+            this.topViewPanel.TabIndex = 0;
             // 
             // bottomSplit
             // 
             // 
             // bottomSplit.Panel1
             // 
-            this.bottomSplit.Panel1.Controls.Add(this.frontView);
+            this.bottomSplit.Panel1.Controls.Add(this.frontViewPanel);
             // 
             // bottomSplit.Panel2
             // 
-            this.bottomSplit.Panel2.Controls.Add(this.perspectiveView);
-            this.bottomSplit.Size = new System.Drawing.Size(843, 165);
-            this.bottomSplit.SplitterDistance = 395;
+            this.bottomSplit.Panel2.Controls.Add(this.perspectiveViewPanel);
+            this.bottomSplit.Size = new System.Drawing.Size(862, 229);
+            this.bottomSplit.SplitterDistance = 431;
             this.bottomSplit.TabIndex = 2;
             this.bottomSplit.SplitterMoving += new System.Windows.Forms.SplitterCancelEventHandler(this.bottomSplit_SplitterMoving);
             this.bottomSplit.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.bottomSplit_SplitterMoved);
             // 
-            // perspectiveView
+            // perspectiveViewPanel
             // 
-            this.perspectiveView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
-            this.perspectiveView.CurrentCameraMode = CameraMode.Perspective;
-            this.perspectiveView.Delegate = null;
-            this.perspectiveView.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.perspectiveView.Location = new System.Drawing.Point(0, 0);
-            this.perspectiveView.Name = "perspectiveView";
-            this.perspectiveView.SharedContextView = null;
-            this.perspectiveView.Size = new System.Drawing.Size(444, 165);
-            this.perspectiveView.TabIndex = 0;
+            this.perspectiveViewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.perspectiveViewPanel.Location = new System.Drawing.Point(0, 0);
+            this.perspectiveViewPanel.Name = "perspectiveViewPanel";
+            this.perspectiveViewPanel.Size = new System.Drawing.Size(427, 229);
+            this.perspectiveViewPanel.TabIndex = 0;
             // 
             // menuStrip1
             // 
             this.viewToolStripMenuItem});
             this.menuStrip1.Location = new System.Drawing.Point(0, 0);
             this.menuStrip1.Name = "menuStrip1";
-            this.menuStrip1.Size = new System.Drawing.Size(843, 24);
+            this.menuStrip1.Size = new System.Drawing.Size(862, 24);
             this.menuStrip1.TabIndex = 2;
             this.menuStrip1.Text = "menuStrip1";
             // 
             // planeToolStripMenuItem
             // 
             this.planeToolStripMenuItem.Name = "planeToolStripMenuItem";
-            this.planeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.planeToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
             this.planeToolStripMenuItem.Text = "Plane";
             this.planeToolStripMenuItem.Click += new System.EventHandler(this.addItem);
             // 
             // cubeToolStripMenuItem
             // 
             this.cubeToolStripMenuItem.Name = "cubeToolStripMenuItem";
-            this.cubeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.cubeToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
             this.cubeToolStripMenuItem.Text = "Cube";
             this.cubeToolStripMenuItem.Click += new System.EventHandler(this.addItem);
             // 
             // cylinderToolStripMenuItem
             // 
             this.cylinderToolStripMenuItem.Name = "cylinderToolStripMenuItem";
-            this.cylinderToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.cylinderToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
             this.cylinderToolStripMenuItem.Text = "Cylinder";
             this.cylinderToolStripMenuItem.Click += new System.EventHandler(this.addItem);
             // 
             // sphereToolStripMenuItem
             // 
             this.sphereToolStripMenuItem.Name = "sphereToolStripMenuItem";
-            this.sphereToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.sphereToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
             this.sphereToolStripMenuItem.Text = "Sphere";
             this.sphereToolStripMenuItem.Click += new System.EventHandler(this.addItem);
             // 
             // icosahedronToolStripMenuItem
             // 
             this.icosahedronToolStripMenuItem.Name = "icosahedronToolStripMenuItem";
-            this.icosahedronToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+            this.icosahedronToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
             this.icosahedronToolStripMenuItem.Text = "Icosahedron";
             this.icosahedronToolStripMenuItem.Click += new System.EventHandler(this.addItem);
             // 
             // viewToolStripMenuItem
             // 
             this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.toggleOneViewFourViewsToolStripMenuItem});
+            this.toggleOneViewFourViewsToolStripMenuItem,
+            this.textureBrowserToolStripMenuItem});
             this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
             this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
             this.viewToolStripMenuItem.Text = "View";
             this.toolStripButtonSubdivide});
             this.toolStripTop.Location = new System.Drawing.Point(0, 24);
             this.toolStripTop.Name = "toolStripTop";
-            this.toolStripTop.Size = new System.Drawing.Size(843, 54);
+            this.toolStripTop.Size = new System.Drawing.Size(862, 54);
             this.toolStripTop.TabIndex = 3;
             this.toolStripTop.Text = "toolStrip1";
             // 
             this.toolStripTextBoxSelectionY,
             this.toolStripLabel3,
             this.toolStripTextBoxSelectionZ});
-            this.toolStripBottom.Location = new System.Drawing.Point(0, 478);
+            this.toolStripBottom.Location = new System.Drawing.Point(0, 539);
             this.toolStripBottom.Name = "toolStripBottom";
-            this.toolStripBottom.Size = new System.Drawing.Size(843, 25);
+            this.toolStripBottom.Size = new System.Drawing.Size(862, 25);
             this.toolStripBottom.TabIndex = 4;
             this.toolStripBottom.Text = "toolStrip2";
             // 
             this.toolStripTextBoxSelectionZ.Leave += new System.EventHandler(this.selectionLeave);
             this.toolStripTextBoxSelectionZ.KeyDown += new System.Windows.Forms.KeyEventHandler(this.selectionKeyDown);
             // 
+            // textureBrowserToolStripMenuItem
+            // 
+            this.textureBrowserToolStripMenuItem.Name = "textureBrowserToolStripMenuItem";
+            this.textureBrowserToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B)));
+            this.textureBrowserToolStripMenuItem.Size = new System.Drawing.Size(264, 22);
+            this.textureBrowserToolStripMenuItem.Text = "Texture Browser";
+            this.textureBrowserToolStripMenuItem.Click += new System.EventHandler(this.textureBrowserToolStripMenuItem_Click);
+            // 
             // DocumentForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(843, 503);
+            this.ClientSize = new System.Drawing.Size(862, 564);
             this.Controls.Add(this.mainSplit);
             this.Controls.Add(this.toolStripBottom);
             this.Controls.Add(this.toolStripTop);
 
         #endregion
 
-        private MeshMakerCppCLI.OpenGLSceneView frontView;
+        private System.Windows.Forms.Panel frontViewPanel;
+        private System.Windows.Forms.Panel leftViewPanel;
+        private System.Windows.Forms.Panel topViewPanel;
+        private System.Windows.Forms.Panel perspectiveViewPanel;
+        
         private System.Windows.Forms.SplitContainer mainSplit;
         private System.Windows.Forms.SplitContainer topSplit;
-        private MeshMakerCppCLI.OpenGLSceneView leftView;
-        private MeshMakerCppCLI.OpenGLSceneView topView;
         private System.Windows.Forms.SplitContainer bottomSplit;
-        private MeshMakerCppCLI.OpenGLSceneView perspectiveView;
         private System.Windows.Forms.MenuStrip menuStrip1;
         private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
         private System.Windows.Forms.ToolStrip toolStripTop;
         private System.Windows.Forms.ToolStripLabel toolStripLabel5;
         private System.Windows.Forms.ToolStripButton toolStripButtonColor;
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
+        private System.Windows.Forms.ToolStripMenuItem textureBrowserToolStripMenuItem;
     }
 }
 

MeshMaker/DocumentForm.cs

 {
     public partial class DocumentForm : Form, IDocumentDelegate
     {
+        OpenGLSceneView frontView;
+        OpenGLSceneView leftView;
+        OpenGLSceneView topView;
+        OpenGLSceneView perspectiveView;
+
         MyDocument document;
         ToolStripButton[] manipulatorButtons;
 
+        TextureBrowser textureBrowser;
+        
         public DocumentForm()
         {
             InitializeComponent();
-            perspectiveView.SharedContextView = leftView;
-            topView.SharedContextView = leftView;
-            frontView.SharedContextView = leftView;
             this.Load += new EventHandler(DocumentForm_Load);
             this.FormClosing += new FormClosingEventHandler(DocumentForm_FormClosing);
         }
 
-        void DocumentForm_FormClosing(object sender, FormClosingEventArgs e)
-        {
-            if (document != null &&  document.DocumentUndoManager != null && document.DocumentUndoManager.CanUndo)
-            {
-                var result = MessageBox.Show(
-                    "Document contains unsaved changes." + Environment.NewLine +
-                    "Do you want to save them before closing application?", 
-                    Application.ProductName,
-                    MessageBoxButtons.YesNoCancel);
-
-                switch (result)
-                {
-                    case DialogResult.Yes:
-                        this.saveToolStripMenuItem_Click(this, EventArgs.Empty);
-                        break;
-                    case DialogResult.No:
-                        break;
-                    case DialogResult.Cancel:
-                    default:
-                        e.Cancel = true;
-                        return;
-                }
-
-            }
-            Process.GetCurrentProcess().Kill();
-        }
-
         void DocumentForm_Load(object sender, EventArgs e)
         {
             if (Tools.SafeDesignMode)
                 return;
 
+            frontView = new OpenGLSceneView() { Dock = DockStyle.Fill };
+            leftView = new OpenGLSceneView() { Dock = DockStyle.Fill };
+            topView = new OpenGLSceneView() { Dock = DockStyle.Fill };
+            perspectiveView = new OpenGLSceneView() { Dock = DockStyle.Fill };
+
+            perspectiveView.SharedContextView = frontView;
+            topView.SharedContextView = frontView;
+            leftView.SharedContextView = frontView;
+
+            frontViewPanel.Controls.Add(frontView);
+            leftViewPanel.Controls.Add(leftView);
+            topViewPanel.Controls.Add(topView);
+            perspectiveViewPanel.Controls.Add(perspectiveView);
+            
             toolStripButtonAddCube.Tag = MeshType.Cube;
             toolStripButtonAddCylinder.Tag = MeshType.Cylinder;
             toolStripButtonAddIcosahedron.Tag = MeshType.Icosahedron;
             toolStripComboBoxViewMode.SelectedIndexChanged += new EventHandler(toolStripComboBoxViewMode_SelectedIndexChanged);
         }
 
+        void DocumentForm_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            if (document != null &&  document.DocumentUndoManager != null && document.DocumentUndoManager.CanUndo)
+            {
+                var result = MessageBox.Show(
+                    "Document contains unsaved changes." + Environment.NewLine +
+                    "Do you want to save them before closing application?", 
+                    Application.ProductName,
+                    MessageBoxButtons.YesNoCancel);
+
+                switch (result)
+                {
+                    case DialogResult.Yes:
+                        this.saveToolStripMenuItem_Click(this, EventArgs.Empty);
+                        break;
+                    case DialogResult.No:
+                        break;
+                    case DialogResult.Cancel:
+                    default:
+                        e.Cancel = true;
+                        return;
+                }
+
+            }
+            Process.GetCurrentProcess().Kill();
+        }        
+
         private void CreateDocument()
         {
             if (document != null)
                 }
             }
         }
+
+        private void textureBrowserToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            if (textureBrowser == null || textureBrowser.IsDisposed)
+                textureBrowser = new TextureBrowser(document);
+            
+            if (!textureBrowser.Visible)
+                textureBrowser.Show();
+        }
     }
 }

MeshMaker/MeshMaker.csproj

     </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="TextureBrowser.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="TextureBrowser.Designer.cs">
+      <DependentUpon>TextureBrowser.cs</DependentUpon>
+    </Compile>
     <EmbeddedResource Include="AddItemWithStepsForm.resx">
       <DependentUpon>AddItemWithStepsForm.cs</DependentUpon>
     </EmbeddedResource>
       <DependentUpon>Resources.resx</DependentUpon>
       <DesignTime>True</DesignTime>
     </Compile>
+    <EmbeddedResource Include="TextureBrowser.resx">
+      <DependentUpon>TextureBrowser.cs</DependentUpon>
+    </EmbeddedResource>
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>

MeshMaker/TextureBrowser.Designer.cs

+namespace MeshMaker
+{
+    partial class TextureBrowser
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TextureBrowser));
+            this.listBoxTextures = new System.Windows.Forms.ListBox();
+            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+            this.toolStripButtonAdd = new System.Windows.Forms.ToolStripButton();
+            this.toolStripButtonRemove = new System.Windows.Forms.ToolStripButton();
+            this.toolStripButtonSet = new System.Windows.Forms.ToolStripButton();
+            this.pictureBoxTexture = new System.Windows.Forms.PictureBox();
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+            this.splitContainer1.Panel1.SuspendLayout();
+            this.splitContainer1.Panel2.SuspendLayout();
+            this.splitContainer1.SuspendLayout();
+            this.toolStrip1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxTexture)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // listBoxTextures
+            // 
+            this.listBoxTextures.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.listBoxTextures.FormattingEnabled = true;
+            this.listBoxTextures.Location = new System.Drawing.Point(0, 0);
+            this.listBoxTextures.Name = "listBoxTextures";
+            this.listBoxTextures.Size = new System.Drawing.Size(221, 541);
+            this.listBoxTextures.TabIndex = 0;
+            this.listBoxTextures.SelectedIndexChanged += new System.EventHandler(this.listBoxTextures_SelectedIndexChanged);
+            // 
+            // splitContainer1
+            // 
+            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+            this.splitContainer1.Name = "splitContainer1";
+            // 
+            // splitContainer1.Panel1
+            // 
+            this.splitContainer1.Panel1.Controls.Add(this.listBoxTextures);
+            this.splitContainer1.Panel1.Controls.Add(this.toolStrip1);
+            // 
+            // splitContainer1.Panel2
+            // 
+            this.splitContainer1.Panel2.Controls.Add(this.pictureBoxTexture);
+            this.splitContainer1.Size = new System.Drawing.Size(861, 566);
+            this.splitContainer1.SplitterDistance = 221;
+            this.splitContainer1.TabIndex = 1;
+            // 
+            // toolStrip1
+            // 
+            this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
+            this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.toolStripButtonAdd,
+            this.toolStripButtonRemove,
+            this.toolStripButtonSet});
+            this.toolStrip1.Location = new System.Drawing.Point(0, 541);
+            this.toolStrip1.Name = "toolStrip1";
+            this.toolStrip1.Size = new System.Drawing.Size(221, 25);
+            this.toolStrip1.TabIndex = 2;
+            this.toolStrip1.Text = "toolStrip1";
+            // 
+            // toolStripButtonAdd
+            // 
+            this.toolStripButtonAdd.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+            this.toolStripButtonAdd.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonAdd.Image")));
+            this.toolStripButtonAdd.ImageTransparentColor = System.Drawing.Color.Magenta;
+            this.toolStripButtonAdd.Name = "toolStripButtonAdd";
+            this.toolStripButtonAdd.Size = new System.Drawing.Size(33, 22);
+            this.toolStripButtonAdd.Text = "Add";
+            this.toolStripButtonAdd.Click += new System.EventHandler(this.toolStripButtonAdd_Click);
+            // 
+            // toolStripButtonRemove
+            // 
+            this.toolStripButtonRemove.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+            this.toolStripButtonRemove.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonRemove.Image")));
+            this.toolStripButtonRemove.ImageTransparentColor = System.Drawing.Color.Magenta;
+            this.toolStripButtonRemove.Name = "toolStripButtonRemove";
+            this.toolStripButtonRemove.Size = new System.Drawing.Size(54, 22);
+            this.toolStripButtonRemove.Text = "Remove";
+            this.toolStripButtonRemove.Click += new System.EventHandler(this.toolStripButtonRemove_Click);
+            // 
+            // toolStripButtonSet
+            // 
+            this.toolStripButtonSet.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+            this.toolStripButtonSet.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonSet.Image")));
+            this.toolStripButtonSet.ImageTransparentColor = System.Drawing.Color.Magenta;
+            this.toolStripButtonSet.Name = "toolStripButtonSet";
+            this.toolStripButtonSet.Size = new System.Drawing.Size(27, 22);
+            this.toolStripButtonSet.Text = "Set";
+            this.toolStripButtonSet.Click += new System.EventHandler(this.toolStripButtonSet_Click);
+            // 
+            // pictureBoxTexture
+            // 
+            this.pictureBoxTexture.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.pictureBoxTexture.Location = new System.Drawing.Point(0, 0);
+            this.pictureBoxTexture.Name = "pictureBoxTexture";
+            this.pictureBoxTexture.Size = new System.Drawing.Size(636, 566);
+            this.pictureBoxTexture.TabIndex = 0;
+            this.pictureBoxTexture.TabStop = false;
+            // 
+            // TextureBrowser
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(861, 566);
+            this.Controls.Add(this.splitContainer1);
+            this.Name = "TextureBrowser";
+            this.Text = "Texture Browser";
+            this.splitContainer1.Panel1.ResumeLayout(false);
+            this.splitContainer1.Panel1.PerformLayout();
+            this.splitContainer1.Panel2.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+            this.splitContainer1.ResumeLayout(false);
+            this.toolStrip1.ResumeLayout(false);
+            this.toolStrip1.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBoxTexture)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.ListBox listBoxTextures;
+        private System.Windows.Forms.SplitContainer splitContainer1;
+        private System.Windows.Forms.ToolStrip toolStrip1;
+        private System.Windows.Forms.ToolStripButton toolStripButtonAdd;
+        private System.Windows.Forms.ToolStripButton toolStripButtonRemove;
+        private System.Windows.Forms.ToolStripButton toolStripButtonSet;
+        private System.Windows.Forms.PictureBox pictureBoxTexture;
+    }
+}

MeshMaker/TextureBrowser.cs

+using MeshMakerCppCLI;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace MeshMaker
+{
+    public partial class TextureBrowser : Form
+    {
+        MyDocument document;
+
+        public TextureBrowser(MyDocument document)
+        {
+            InitializeComponent();
+            this.document = document;
+            this.Load += TextureBrowser_Load;
+        }
+
+        void TextureBrowser_Load(object sender, EventArgs e)
+        {
+            for (uint i = 0; i < document.textureCount(); i++)
+            {
+                listBoxTextures.Items.Add(document.textureNameAtIndex(i));
+            }
+        }
+
+        private void toolStripButtonAdd_Click(object sender, EventArgs e)
+        {
+            using (OpenFileDialog dlg = new OpenFileDialog())
+            {
+                dlg.Filter = "Image files |*.png;*.bmp;*.jpeg;*.jpg";
+                if (dlg.ShowDialog() == DialogResult.OK)
+                {
+                    document.addTexture(dlg.FileName);
+                    listBoxTextures.Items.Add(document.textureNameAtIndex(document.textureCount() - 1));
+                }
+            }
+        }
+
+        private void toolStripButtonRemove_Click(object sender, EventArgs e)
+        {
+            var index = listBoxTextures.SelectedIndex;
+
+            if (index >= 0 && index < document.textureCount())
+            {
+                document.removeTextureAtIndex((uint)index);
+                listBoxTextures.Items.RemoveAt(index);
+            }
+        }
+
+        private void toolStripButtonSet_Click(object sender, EventArgs e)
+        {
+             var index = listBoxTextures.SelectedIndex;
+
+             if (index >= 0 && index < document.textureCount())
+             {
+                 document.setTextureAtIndex((uint)index);
+             }
+        }
+
+        private void listBoxTextures_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            var index = listBoxTextures.SelectedIndex;
+
+            if (index >= 0 && index < document.textureCount())
+            {
+                var image = document.textureImageAtIndex((uint)index);
+                pictureBoxTexture.Image = (Bitmap)image.Clone();
+            }
+            else
+            {
+                pictureBoxTexture.Image = null;
+            }
+        }
+    }
+}

MeshMaker/TextureBrowser.resx

+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="toolStripButtonAdd.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI
+        ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9
+        HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN
+        rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K
+        TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx
+        oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8
+        7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI
+        xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX
+        LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd
+        KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="toolStripButtonRemove.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI
+        ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9
+        HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN
+        rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K
+        TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx
+        oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8
+        7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI
+        xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX
+        LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd
+        KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="toolStripButtonSet.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI
+        ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9
+        HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN
+        rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K
+        TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx
+        oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8
+        7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI
+        xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX
+        LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd
+        KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC
+</value>
+  </data>
+</root>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.