using ControlLibrary; using System; using System.Data; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Windows.Forms; using Data.BusinessService; using ChildForms; using Make3UI; using Projects; namespace Make3Test { public partial class frmCoolForm : XCoolForm { Project _projectObj; Layer _layerObj; Treko.Treko _trekoObj; private frmChildSequrity childSequrity; private FrmChildTreko3D childTreko3D; private frmChildTreko childTreko; private frmChildColorProfile childColorProfile; private TrekoControl trekoControl1; private Treko3DControl treko3DControl1; private IProjectService projectService; private ILayerService layerService; private XmlThemeLoader xtl = new XmlThemeLoader(); //private List _items = new List(); private List _layers = new List(); public frmCoolForm() : base() { InitializeComponent(); this.projectService = new ProjectService(); this.layerService = new LayerService(); InitializeMenuRecentProjects(); this.projectControl.OnOkClicked += projectControl_OkClicked; this.projectControl.OnDeleteClicked += projectControl_DeleteClicked; //this.colorProfileControl.OnOkClicked += colorProfileControl_OkClicked; } private void frmCoolForm_Load(object sender, EventArgs e) { //this.TitleBar.TitleBarBackImage = Make3Test.Properties.Resources.predator_256x256; this.MenuIcon = Make3Test.Properties.Resources.alien_vs_predator_3_48x48.GetThumbnailImage(24, 24, null, IntPtr.Zero); this.TitleBar.TitleBarCaption = "Make3"; this.TitleBar.TitleBarType = XTitleBar.XTitleBarType.Rectangular; this.LeftSideBar.LeftSideBarType = XLeftSideBar.XLeftSideBarType.Angular; //this.IconHolder.HolderButtons.Add(new XCoolForm.XTitleBarIconHolder.XHolderButton(Make3Test.Properties.Resources.disc_predator_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero), "Blue Winter")); //this.IconHolder.HolderButtons.Add(new XCoolForm.XTitleBarIconHolder.XHolderButton(Make3Test.Properties.Resources.alien_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero), "Dark System")); //this.IconHolder.HolderButtons.Add(new XCoolForm.XTitleBarIconHolder.XHolderButton(Make3Test.Properties.Resources.alien_egg_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero), "Animal Kingdom")); //this.IconHolder.HolderButtons.Add(new XCoolForm.XTitleBarIconHolder.XHolderButton(Make3Test.Properties.Resources.predator_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero), "Valentine")); //this.IconHolder.HolderButtons[0].FrameBackImage = Make3Test.Properties.Resources.disc_predator_48x48; //this.IconHolder.HolderButtons[1].FrameBackImage = Make3Test.Properties.Resources.alien_48x48; //this.IconHolder.HolderButtons[2].FrameBackImage = Make3Test.Properties.Resources.alien_egg_48x48; //this.IconHolder.HolderButtons[3].FrameBackImage = Make3Test.Properties.Resources.predator_48x48; this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(60)); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(200, "Hologram size 10x15 mm")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, "1024x768")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(150, "88..255 gray range")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, "2 layers")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, "Save path")); this.StatusBar.EllipticalGlow = false; if (_projectObj != null) RefreshLayersBar(); this.XCoolFormHolderButtonClick += new XCoolFormHolderButtonClickHandler(frmCoolForm_XCoolFormHolderButtonClick); xtl.ThemeForm = this; MainFormInstance.MainFormInstanceSet = this; } public Project ProjectObj { get { return _projectObj; } set { _projectObj = value; } } public Layer LayerObj { get { return _layerObj; } set { _layerObj = value; } } public Treko.Treko TrekoObj { get { return _trekoObj; } set { _trekoObj = value; } } #region helpers /// /// Method to show general error message on any system level exception /// private void ShowErrorMessage(Exception ex) { MessageBox.Show( ex.Message, "Exception!", //Resources.System_Error_Message_Title, MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion private void InitializeMenuRecentProjects() { try { DataTable data = this.projectService.GetAllProjects(); DataRow[] drowpar = data.Select(); // ("ParentID=" + 0); ToolStripItem[] toolStripItems = new ToolStripItem[drowpar.Length]; int i = 0; foreach (DataRow dr in drowpar) { toolStripItems[i] = new ToolStripMenuItem(dr["Id"].ToString() + " " + dr["ProjectName"].ToString()); toolStripItems[i].Click += new System.EventHandler(this.OnUpdateProjectClick); i++; } this.recentProjectsMenuItem.DropDownItems.Clear(); this.recentProjectsMenuItem.DropDownItems.AddRange(toolStripItems); } catch (Exception ex) { this.ShowErrorMessage(ex); } ////ToolStripItem[] toolStripItems = new ToolStripItem[2]; //ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem("testProject1"); ////toolStripMenuItem.Alignment = ToolStripItemAlignment.Left; ////toolStripMenuItem.TextAlign = ContentAlignment.MiddleLeft; //toolStripItems[0] = toolStripMenuItem; //toolStripMenuItem = new ToolStripMenuItem("testProject2"); ////toolStripMenuItem.Alignment = ToolStripItemAlignment.Left; ////toolStripMenuItem.TextAlign = ContentAlignment.MiddleLeft; //toolStripItems[1] = toolStripMenuItem; //this.recentProjectsMenuItem.DropDownItems.AddRange(toolStripItems); ////this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); ////this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); ////this.recentProjectsMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ////this.toolStripMenuItem1, ////this.toolStripMenuItem2}); //// //// toolStripMenuItem1 //// //this.toolStripMenuItem1.Name = "toolStripMenuItem1"; //this.toolStripMenuItem1.Size = new System.Drawing.Size(136, 22); //this.toolStripMenuItem1.Text = "testProject1"; //this.toolStripMenuItem1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; //// //// toolStripMenuItem2 //// //this.toolStripMenuItem2.Name = "toolStripMenuItem2"; //this.toolStripMenuItem2.Size = new System.Drawing.Size(136, 22); //this.toolStripMenuItem2.Text = "testProject2"; //this.toolStripMenuItem2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; } public ProjectControl projectControl { get { Control[] cnt = this.Controls.Find("newProjectControl1", true); return (ProjectControl)cnt[0]; } } //public ColorProfileControl colorProfileControl //{ // get // { // Control[] cnt = this.Controls.Find("newProjectControl1", true); // return (ColorProfileControl)cnt[0]; // } //} private void RefreshLayersBar() { flowLayoutPanel1.Controls.Clear(); Size s = new Size(flowLayoutPanel1.Width, 68); LayerControl pgb; if (_projectObj.Layers != null && _projectObj.Layers.Count > 0) { foreach (Layer layer in _projectObj.Layers) { pgb = new LayerControl(); pgb.Padding = new Padding(5); pgb.LayerName = layer.LayerName; pgb.StatusBarColor = 0; pgb.Size = s; pgb.Anchor = AnchorStyles.Left | AnchorStyles.Right; this._layers.Add(pgb); this.flowLayoutPanel1.Controls.Add(pgb); } } ////XCoolForm.TrekoDialog trekoDialog; ////TrekoControl trekoControl; //pgb = new LayerControl(); //pgb.Padding = new Padding(5); //pgb.LayerName = "Layer Name 1"; ////pgb.MainText = "47x100x5400 - 20/100"; ////pgb.FillDegree = 20; ////pgb.RightText = "1"; ////pgb.StatusText = "Raw"; ////pgb.StatusBarColor = 0; //pgb.StatusBarColor = 0; //pgb.Size = s; //pgb.Anchor = AnchorStyles.Left | AnchorStyles.Right; //this._layers.Add(pgb); //this.flowLayoutPanel1.Controls.Add(pgb); //pgb = new LayerControl(); //pgb.Padding = new Padding(5); //pgb.LayerName = "Layer Name 21"; ////pgb.MainText = "47x100x5400 - 20/100"; ////pgb.FillDegree = 20; ////pgb.RightText = "1"; ////pgb.StatusText = "Raw"; ////pgb.StatusBarColor = 0; //pgb.StatusBarColor = 1; //pgb.Size = s; //pgb.Anchor = AnchorStyles.Left | AnchorStyles.Right; //this._layers.Add(pgb); //this.flowLayoutPanel1.Controls.Add(pgb); } private void openSplitterPanel() { Control[] cnt = this.Controls.Find("splitContainer1", true); SplitContainer splitContainer = (SplitContainer)cnt[0]; if (splitContainer.Panel1Collapsed == true) { splitContainer.Panel1Collapsed = false; } splitContainer.SplitterDistance = 260; } private void closeSplitterPanel() { Control[] cnt = this.Controls.Find("splitContainer1", true); SplitContainer splitContainer = (SplitContainer)cnt[0]; splitContainer.SplitterDistance = 630; //if (splitContainer.Panel1Collapsed == false) // splitContainer.Panel1Collapsed = true; } private void DisposeControl(UserControl control) { if (control != null) { Type type = control.GetType(); if (type.Name == "TrekoControl") { this.trekoControl1.Dispose(); this.trekoControl1 = null; } else if (type.Name == "Treko3DControl") { this.treko3DControl1.Dispose(); this.treko3DControl1 = null; } } } public override void ShowTrekoDialog() { //FlowLayoutPanel flp = this.flowLayoutPanel1; //SplitterPanel splitterPanel = (SplitterPanel)flp.Parent.Parent; //SplitContainer splitContainer = (SplitContainer)splitterPanel.Parent; // // trekoControl1 // if (this.trekoControl1 == null) { DisposeControl(treko3DControl1); this.trekoControl1 = new TrekoControl(); this.trekoControl1.Dock = System.Windows.Forms.DockStyle.Left; this.trekoControl1.Location = new System.Drawing.Point(0, 0); this.trekoControl1.Name = "trekoControl1"; this.trekoControl1.Size = new System.Drawing.Size(355, 599); this.trekoControl1.TabIndex = 10; this.trekoControl1.OnOkClicked += childTreko_OkClicked; this.trekoControl1.OnPreviewClicked += childTreko_PreviewClicked; this.trekoControl1.OnColorProfileClicked += childColorProfileClicked; this.trekoControl1.ProjectObj = _projectObj; this.trekoControl1.LayerObj = _layerObj; this.panel1.Controls.Add(this.trekoControl1); openSplitterPanel(); } else { closeSplitterPanel(); DisposeControl(trekoControl1); } if (this.projectControl != null && this.projectControl.Visible == true) this.projectControl.Visible = false; //Control[] cnt = this.Controls.Find("splitContainer1", true); //SplitContainer splitContainer = (SplitContainer)cnt[0]; //if (splitContainer.Panel1Collapsed == true) // splitContainer.Panel1Collapsed = false; //else // splitContainer.Panel1Collapsed = true; } void childColorProfileClicked(object sender, EventArgs e) { if (childColorProfile == null || childColorProfile.IsDisposed) { childColorProfile = new frmChildColorProfile(); childColorProfile.FormClosed += new FormClosedEventHandler(Child_FormClosed); childColorProfile.Location = new Point(Location.X, Location.Y + Height + 20); } childColorProfile.ColorProfileControl.ObjSender = sender; // Sender - TrekoControl, Treko3DControl childColorProfile.Show(); } void childTreko_PreviewClicked(object sender, EventArgs e) { Treko.Treko trekoObj = trekoControl1.trekoObj; Project projectObj = projectControl.Project; if (childTreko == null || childTreko.IsDisposed) { childTreko = new frmChildTreko(); childTreko.FormClosed += new FormClosedEventHandler(Child_FormClosed); childTreko.Location = new Point(Location.X, Location.Y + Height + 20); } childTreko.Show(); //childTreko.OutDirName = trekoControl1.OutDirName; //childTreko.HologramWidth = trekoControl1.HologramWidth; //childTreko.HologramHeight = trekoControl1.HologramHeight; //childTreko.FrameWidth = trekoControl1.FrameWidth; //childTreko.FrameHeight = trekoControl1.FrameHeight; //childTreko.FrameWidthPix = trekoControl1.FrameWidthPix; //childTreko.FrameHeightPix = trekoControl1.FrameHeightPix; childTreko.GenerateAndSaveStrips(trekoObj, projectObj); childTreko.DrawImage(); } void childTreko_OkClicked(object sender, EventArgs e) { //int i = 0; Treko.Treko trekoObj = trekoControl1.trekoObj; Project projectObj = projectControl.Project; //treko3DControl1.txtSourceFilePath.Text; if (childTreko == null || childTreko.IsDisposed) { childTreko = new frmChildTreko(); childTreko.FormClosed += new FormClosedEventHandler(Child_FormClosed); childTreko.Location = new Point(Location.X, Location.Y + Height + 20); } //childTreko.Show(); !!!! childTreko.TrekoObj = trekoObj; //, treko3DControl1.RakurseFiles); childTreko.ProjectObj = projectObj; //childTreko.OutDirName = trekoControl1.OutDirName; //childTreko.HologramWidth = trekoControl1.HologramWidth; //childTreko.HologramHeight = trekoControl1.HologramHeight; //childTreko.FrameWidth = trekoControl1.FrameWidth; //childTreko.FrameHeight = trekoControl1.FrameHeight; //childTreko.FrameWidthPix = trekoControl1.FrameWidthPix; //childTreko.FrameHeightPix = trekoControl1.FrameHeightPix; childTreko.GenerateAndSaveStrips(trekoObj, projectObj); // Create Layer and add to Project //LayerModel lm = new LayerModel(); // Layer layer = new Layer(lm); //childTreko.GenerateFrames(); // !!!! //childTreko.SaveFramesToFiles(); //childTreko.GenerateIniFile(); } void childTreko3D_PreviewClicked(object sender, EventArgs e) { //int i = 0; Treko3D.Treko3D tr3DObj = treko3DControl1.treko3DObj; if (childTreko3D == null || childTreko3D.IsDisposed) { childTreko3D = new FrmChildTreko3D(); childTreko3D.FormClosed += new FormClosedEventHandler(Child_FormClosed); childTreko3D.Location = new Point(Location.X, Location.Y + Height + 20); } childTreko3D.Show(); //childTreko3D.OutDirName = treko3DControl1.OutDirName; //childTreko3D.HologramWidth = treko3DControl1.HologramWidth; //childTreko3D.HologramHeight = treko3DControl1.HologramHeight; //childTreko3D.FrameWidth = treko3DControl1.FrameWidth; //childTreko3D.FrameHeight = treko3DControl1.FrameHeight; //childTreko3D.FrameWidthPix = treko3DControl1.FrameWidthPix; //childTreko3D.FrameHeightPix = treko3DControl1.FrameHeightPix; //childTreko3D.GenerateAndSaveStrips(tr3DObj); //, treko3DControl1.RakurseFiles); childTreko3D.DrawImage(); } void childTreko3D_OkClicked(object sender, EventArgs e) { //int i = 0; Treko3D.Treko3D tr3DObj = treko3DControl1.treko3DObj; if (childTreko3D == null || childTreko3D.IsDisposed) { childTreko3D = new FrmChildTreko3D(); childTreko3D.FormClosed += new FormClosedEventHandler(Child_FormClosed); childTreko3D.Location = new Point(Location.X, Location.Y + Height + 20); } //childTreko3D.Show(); //childTreko3D.OutDirName = treko3DControl1.OutDirName; //childTreko3D.HologramWidth = treko3DControl1.HologramWidth; //childTreko3D.HologramHeight = treko3DControl1.HologramHeight; //childTreko3D.FrameWidth = treko3DControl1.FrameWidth; //childTreko3D.FrameHeight = treko3DControl1.FrameHeight; //childTreko3D.FrameWidthPix = treko3DControl1.FrameWidthPix; //childTreko3D.FrameHeightPix = treko3DControl1.FrameHeightPix; //childTreko3D.GenerateAndSaveStrips(tr3DObj); //, treko3DControl1.RakurseFiles); // Create Layer and add to Project //childTreko3D.GenerateFrames(); //childTreko3D.SaveFramesToFiles(); //childTreko3D.GenerateIniFile(); } public override void ShowTreko3DDialog() { if (this.treko3DControl1 == null) { DisposeControl(trekoControl1); this.treko3DControl1 = new Treko3DControl(); this.treko3DControl1.Dock = System.Windows.Forms.DockStyle.Left; this.treko3DControl1.Location = new System.Drawing.Point(0, 0); this.treko3DControl1.Name = "treko3DControl1"; this.treko3DControl1.Size = new System.Drawing.Size(355, 599); this.treko3DControl1.TabIndex = 10; this.treko3DControl1.OnOkClicked += childTreko3D_OkClicked; this.treko3DControl1.OnPreviewClicked += childTreko3D_PreviewClicked; this.panel1.Controls.Add(this.treko3DControl1); openSplitterPanel(); } else { closeSplitterPanel(); DisposeControl(treko3DControl1); } if (this.projectControl != null && this.projectControl.Visible == true) this.projectControl.Visible = false; //Control[] cnt = this.Controls.Find("splitContainer1", true); //SplitContainer splitContainer = (SplitContainer)cnt[0]; //if (splitContainer.Panel1Collapsed == true) // splitContainer.Panel1Collapsed = false; //else // splitContainer.Panel1Collapsed = true; } //private void addLevelProgressBars() //{ // Size s = new Size(flowLayoutPanel1.Width, 50); // Make3UI.LevelProgressBar pgb; // Make3UI.TrekoDialog trekoDialog; // TrekoControl trekoControl; // pgb = new Make3UI.LevelProgressBar(); // pgb.Padding = new Padding(5); // pgb.LeftText = "1"; // pgb.MainText = "47x100x5400 - 20/100"; // pgb.FillDegree = 20; // pgb.RightText = "1"; // pgb.StatusText = "Raw"; // pgb.StatusBarColor = 0; // pgb.Size = s; // pgb.Anchor = AnchorStyles.Left | AnchorStyles.Right; // this._items.Add(pgb); // this.flowLayoutPanel1.Controls.Add(pgb); // pgb = new Make3UI.LevelProgressBar(); // pgb.Padding = new Padding(5); // pgb.LeftText = "5"; // pgb.MainText = "47x200x4700 - 100/100"; // pgb.FillDegree = 100; // pgb.RightText = "5"; // pgb.Size = s; // this._items.Add(pgb); // this.flowLayoutPanel1.Controls.Add(pgb); // pgb = new Make3UI.LevelProgressBar(); // pgb.Padding = new Padding(5); // pgb.LeftText = "3"; // pgb.MainText = "22x100x2700 - 85/100"; // pgb.FillDegree = 85; // pgb.RightText = "3"; // pgb.StatusText = "Dry"; // pgb.StatusBarColor = 2; // pgb.Size = s; // this._items.Add(pgb); // this.flowLayoutPanel1.Controls.Add(pgb); // //trekoDialog = new XCoolForm.TrekoDialog(); // //trekoDialog.Padding = new Padding(5); // //trekoDialog.LeftText = "4"; // //trekoDialog.MainText = "47x200x4700 - 95/100"; // //trekoDialog.FillDegree = 95; // //trekoDialog.RightText = "4"; // //trekoDialog.StatusText = "Dry inactive"; // //trekoDialog.StatusBarColor = 3; // //trekoDialog.Size = s; // ////this._items.Add(trekoDialog); // //this.flowLayoutPanel2.Controls.Add(trekoDialog); // //trekoControl = new TrekoControl(); // //this.flowLayoutPanel2.Controls.Add(trekoControl); // //trekoControl.Dock = DockStyle.Fill; // //trekoControl.BorderStyle = BorderStyle.FixedSingle; //} private void frmCoolForm_XCoolFormHolderButtonClick(Make3UI.XCoolForm.XCoolFormHolderButtonClickArgs e) { switch (e.ButtonIndex) { case 0: this.TitleBar.TitleBarBackImage = Make3Test.Properties.Resources.candy_cane; this.TitleBar.TitleBarCaption = "Blue Winter Theme"; this.TitleBar.TitleBarFill = Make3UI.XTitleBar.XTitleBarFill.AdvancedRendering; this.TitleBar.TitleBarType = Make3UI.XTitleBar.XTitleBarType.Rounded; this.TitleBar.TitleBarButtons[2].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.FullFill; this.TitleBar.TitleBarButtons[1].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.FullFill; this.TitleBar.TitleBarButtons[0].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.FullFill; this.IconHolder.HolderButtons[0].ButtonImage = Make3Test.Properties.Resources.xmas_tree.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[1].ButtonImage = Make3Test.Properties.Resources.xmas_decoration_green.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[2].ButtonImage = Make3Test.Properties.Resources.xmas_decoration_red_.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[3].ButtonImage = Make3Test.Properties.Resources.snowman.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[0].FrameBackImage = Make3Test.Properties.Resources.xmas_tree; this.IconHolder.HolderButtons[1].FrameBackImage = Make3Test.Properties.Resources.xmas_decoration_green; this.IconHolder.HolderButtons[2].FrameBackImage = Make3Test.Properties.Resources.xmas_decoration_red_; this.IconHolder.HolderButtons[3].FrameBackImage = Make3Test.Properties.Resources.snowmansmall; this.MenuIcon = Make3Test.Properties.Resources.Snowman1.GetThumbnailImage(30, 30, null, IntPtr.Zero); this.StatusBar.BarBackImage = Make3Test.Properties.Resources.snowman.GetThumbnailImage(80, 80, null, IntPtr.Zero); ; this.StatusBar.BarImageAlign = Make3UI.XStatusBar.XStatusBarBackImageAlign.Right; this.StatusBar.BarItems[1].BarItemText = "Snow level: 0.5 m"; xtl.ApplyTheme(Path.Combine(Environment.CurrentDirectory, @"..\..\Themes\BlueWinterTheme.xml")); break; case 1: this.Border.BorderStyle = Make3UI.X3DBorderPrimitive.XBorderStyle.Flat; this.TitleBar.TitleBarType = Make3UI.XTitleBar.XTitleBarType.Rectangular; this.TitleBar.TitleBarCaption = "Make-III"; this.TitleBar.TitleBarFill = Make3UI.XTitleBar.XTitleBarFill.AdvancedRendering; //this.TitleBar.TitleBarFill = XCoolForm.XTitleBar.XTitleBarFill.LinearRendering; this.TitleBar.TitleBarButtons[2].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.UpperGlow; this.TitleBar.TitleBarButtons[1].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.UpperGlow; this.TitleBar.TitleBarButtons[0].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.UpperGlow; this.LeftSideBar.LeftSideBarType = Make3UI.XLeftSideBar.XLeftSideBarType.Angular; this.LeftSideBar.LeftSideBarFill = Make3UI.XLeftSideBar.XLeftSideBarFill.AdvancedRendering; this.IconHolder.HolderButtons[3].ButtonImage = Make3Test.Properties.Resources.Quake_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[2].ButtonImage = Make3Test.Properties.Resources.Quake_III_Arena_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[1].ButtonImage = Make3Test.Properties.Resources.Quake_IV_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[0].ButtonImage = Make3Test.Properties.Resources.Quake_II_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[3].FrameBackImage = Make3Test.Properties.Resources.Quake_48x48; this.IconHolder.HolderButtons[2].FrameBackImage = Make3Test.Properties.Resources.Quake_III_Arena_48x48; this.IconHolder.HolderButtons[1].FrameBackImage = Make3Test.Properties.Resources.Quake_IV_48x48; this.IconHolder.HolderButtons[0].FrameBackImage = Make3Test.Properties.Resources.Quake_II_48x48; //this.LSBIconHolder.HolderButtons[3].ButtonImage = Make3Test.Properties.Resources.Quake_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); //this.LSBIconHolder.HolderButtons[2].ButtonImage = Make3Test.Properties.Resources.Quake_III_Arena_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); //this.LSBIconHolder.HolderButtons[1].ButtonImage = Make3Test.Properties.Resources.Quake_IV_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); //this.LSBIconHolder.HolderButtons[0].ButtonImage = Make3Test.Properties.Resources.Quake_II_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); //this.LSBIconHolder.HolderButtons[3].FrameBackImage = Make3Test.Properties.Resources.Quake_48x48; //this.LSBIconHolder.HolderButtons[2].FrameBackImage = Make3Test.Properties.Resources.Quake_III_Arena_48x48; //this.LSBIconHolder.HolderButtons[1].FrameBackImage = Make3Test.Properties.Resources.Quake_IV_48x48; //this.LSBIconHolder.HolderButtons[0].FrameBackImage = Make3Test.Properties.Resources.Quake_II_48x48; //this.MenuIcon = Make3Test.Properties.Resources.GDI_256x256.GetThumbnailImage(30, 25, null, IntPtr.Zero); //this.TitleBar.TitleBarBackImage = Make3Test.Properties.Resources.Quake_IV; //this.StatusBar.BarBackImage = Make3Test.Properties.Resources.Quake_256x256; this.StatusBar.BarImageAlign = Make3UI.XStatusBar.XStatusBarBackImageAlign.Left; //this.StatusBar.BarItems[1].BarItemText = "Date: 12/12/2045"; //xtl.ApplyTheme(Path.Combine(Environment.CurrentDirectory, @"..\..\Themes\DarkSystemTheme.xml")); xtl.ApplyTheme(Path.Combine(Environment.CurrentDirectory, @"..\..\Themes\BlackTheme.xml")); break; case 2: this.Border.BorderStyle = Make3UI.X3DBorderPrimitive.XBorderStyle.Flat; this.TitleBar.TitleBarBackImage = Make3Test.Properties.Resources.Mammooth_1; this.TitleBar.TitleBarCaption = "Animal Kingdom Theme"; this.TitleBar.TitleBarButtons[2].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.None; this.TitleBar.TitleBarButtons[1].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.None; this.TitleBar.TitleBarButtons[0].ButtonFillMode = Make3UI.XTitleBarButton.XButtonFillMode.None; this.TitleBar.TitleBarType = Make3UI.XTitleBar.XTitleBarType.Angular; this.MenuIcon = Make3Test.Properties.Resources.Mammooth_128x128.GetThumbnailImage(30, 30, null, IntPtr.Zero); this.StatusBar.EllipticalGlow = false; this.TitleBar.TitleBarFill = Make3UI.XTitleBar.XTitleBarFill.UpperGlow; this.StatusBar.BarBackImage = Make3Test.Properties.Resources.Funshine_Bear_1; this.StatusBar.BarImageAlign = Make3UI.XStatusBar.XStatusBarBackImageAlign.Left; this.StatusBar.BarItems[1].BarItemText = "Place: Madagascar"; this.StatusBar.BarItems[1].ItemTextAlign = StringAlignment.Center; this.IconHolder.HolderButtons[0].ButtonImage = Make3Test.Properties.Resources.cow_32.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[1].ButtonImage = Make3Test.Properties.Resources.bird_32.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[2].ButtonImage = Make3Test.Properties.Resources.panda_32.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[3].ButtonImage = Make3Test.Properties.Resources.penguine_32.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[0].FrameBackImage = Make3Test.Properties.Resources.cow_32; this.IconHolder.HolderButtons[1].FrameBackImage = Make3Test.Properties.Resources.bird_32; this.IconHolder.HolderButtons[2].FrameBackImage = Make3Test.Properties.Resources.panda_32; this.IconHolder.HolderButtons[3].FrameBackImage = Make3Test.Properties.Resources.penguine_32; xtl.ApplyTheme(Path.Combine(Environment.CurrentDirectory, @"..\..\Themes\AnimalKingdomTheme.xml")); break; case 3: this.Border.BorderStyle = Make3UI.X3DBorderPrimitive.XBorderStyle.X3D; this.TitleBar.TitleBarType = Make3UI.XTitleBar.XTitleBarType.Rectangular; this.TitleBar.TitleBarCaption = "Valentine Theme"; this.TitleBar.TitleBarFill = Make3UI.XTitleBar.XTitleBarFill.LinearRendering; this.TitleBar.TitleBarBackImage = Make3Test.Properties.Resources.heart_valentine_128x128; this.StatusBar.EllipticalGlow = false; this.StatusBar.BarBackImage = Make3Test.Properties.Resources.paisley_6_48x48; this.StatusBar.BarImageAlign = Make3UI.XStatusBar.XStatusBarBackImageAlign.Center; this.StatusBar.BarItems[1].BarItemText = "Hearts left: 4"; this.MenuIcon = Make3Test.Properties.Resources.purple_flower_48x48.GetThumbnailImage(30, 30, null, IntPtr.Zero); this.IconHolder.HolderButtons[0].ButtonImage = Make3Test.Properties.Resources.butterfly_pink_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[1].ButtonImage = Make3Test.Properties.Resources.butterfly_purple_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[2].ButtonImage = Make3Test.Properties.Resources.lotus_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[3].ButtonImage = Make3Test.Properties.Resources.symbol_48x48.GetThumbnailImage(20, 20, null, IntPtr.Zero); this.IconHolder.HolderButtons[0].FrameBackImage = Make3Test.Properties.Resources.butterfly_pink_48x48; this.IconHolder.HolderButtons[1].FrameBackImage = Make3Test.Properties.Resources.butterfly_purple_48x48; this.IconHolder.HolderButtons[2].FrameBackImage = Make3Test.Properties.Resources.lotus_48x48; this.IconHolder.HolderButtons[3].FrameBackImage = Make3Test.Properties.Resources.symbol_48x48; xtl.ApplyTheme(Path.Combine(Environment.CurrentDirectory, @"..\..\Themes\ValentineTheme.xml")); break; } } private static Pen _dashedPen = new Pen(Color.DarkRed, 1); private void splitContainer_Paint(object sender, PaintEventArgs e) { SplitContainer s = sender as SplitContainer; if (s != null) { _dashedPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; int gripLineWidth = 9; // Fill Splitter rectangle e.Graphics.FillRectangle(SystemBrushes.ControlDark, s.SplitterRectangle.X, s.SplitterDistance, s.SplitterRectangle.Width, s.SplitterWidth); // Draw Single Line Border on Top and Bottom e.Graphics.DrawLine(Pens.LightSlateGray, s.SplitterRectangle.X, s.SplitterDistance, s.SplitterRectangle.Width, s.SplitterDistance); e.Graphics.DrawLine(Pens.LightSlateGray, s.SplitterRectangle.X, s.SplitterDistance + s.SplitterWidth - 1, s.SplitterRectangle.Width, s.SplitterDistance + s.SplitterWidth - 1); // Draw gripper dots in center e.Graphics.DrawLine(_dashedPen, ((s.SplitterRectangle.Width / 2) - (gripLineWidth / 2)), s.SplitterDistance + s.SplitterWidth / 2, ((s.SplitterRectangle.Width / 2) + (gripLineWidth / 2)), s.SplitterDistance + s.SplitterWidth / 2); } } private void flowLayoutPanel1_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.All; } private void flowLayoutPanel1_DragDrop(object sender, DragEventArgs e) { ControlLibrary.LayerControl data = (ControlLibrary.LayerControl)e.Data.GetData(typeof(ControlLibrary.LayerControl)); FlowLayoutPanel _destination = (FlowLayoutPanel)sender; FlowLayoutPanel _source = (FlowLayoutPanel)data.Parent; if (_source != _destination) { // Add control to panel _destination.Controls.Add(data); data.Size = new Size(_destination.Width, 50); // Reorder Point p = _destination.PointToClient(new Point(e.X, e.Y)); var item = _destination.GetChildAtPoint(p); int index = _destination.Controls.GetChildIndex(item, false); _destination.Controls.SetChildIndex(data, index); // Invalidate to paint! _destination.Invalidate(); _source.Invalidate(); } else { // Just add the control to the new panel. // No need to remove from the other panel, this changes the Control.Parent property. Point p = _destination.PointToClient(new Point(e.X, e.Y)); var item = _destination.GetChildAtPoint(p); int index = _destination.Controls.GetChildIndex(item, false); _destination.Controls.SetChildIndex(data, index); _destination.Invalidate(); } } #region menu events private void OnNewProjectClick(object sender, EventArgs e) { closeSplitterPanel(); projectControl.Caption = "New Project"; projectControl.EditMode = false; projectControl.ProjectName = ""; projectControl.OutPath = ""; projectControl.HologramWidth = "30"; projectControl.HologramHeight = "30"; //projectControl.ResolutionX = 1024; !!!! //projectControl.ResolutionY = 768; projectControl.GrayLow = 50; projectControl.GrayHigh = 255; projectControl.Visible = true; ClearBarsInfo(); //MessageBox.Show("New Project menu item clicked"); //var itemText = (sender as ToolStripMenuItem).Text; //MessageBox.Show(itemText); } private void OnUpdateProjectClick(object sender, EventArgs e) { closeSplitterPanel(); projectControl.Caption = "Update Project"; projectControl.EditMode = true; string itemText = (sender as ToolStripMenuItem).Text; string[] words = itemText.Split('(',')'); string[] words1 = words[0].Split(' '); int projectId = int.Parse(words1[0]); string projectName = words1[1]; if (words1.Length > 3) { for (int i = 1; i < words1.Length; i++) { projectName += words1[i]; } } projectControl.LoadProject(projectId); _projectObj = projectControl.Project; RefreshBarsInfo(projectControl.Project); RefreshLayersBar(); projectControl.Visible = true; } private void projectControl_OkClicked(object sender, EventArgs e) { projectControl.Visible = true; RefreshBarsInfo(projectControl.Project); RefreshLayersBar(); projectControl.Visible = false; } private void projectControl_DeleteClicked(object sender, EventArgs e) { projectControl.Visible = false; RefreshBarsInfo(projectControl.Project); RefreshLayersBar(); projectControl.Visible = false; } private void OnSequrityClick(object sender, EventArgs e) { if (childSequrity == null) { childSequrity = new frmChildSequrity(); childSequrity.FormClosed += new FormClosedEventHandler(Child_FormClosed); childSequrity.Location = new Point(Location.X, Location.Y + Height + 20); } childSequrity.Show(); //child.MergeImagesVertically(StripFiles, resultFilePath, nFileStart, nFileEnd); } private void OnExitClick(object sender, EventArgs e) { Application.Exit(); } void Child_FormClosed(object sender, FormClosedEventArgs e) { childSequrity = null; childTreko3D = null; childTreko = null; //Close(); } #endregion #region Helpers public int GetCountOfLayers(int projectId) { int nLayers= this.projectService.GetCountOfLayers(projectId); return nLayers; } private void ClearBarsInfo() { // Default values int HologramWidth = 30; int HologramHeight = 30; int ResolutionX = 1024; int ResolutionY = 768; int GrayRangeLow = 50; int GrayRangeHigh = 255; this.TitleBar.TitleBarCaption = "Make3"; string HologramSize = Convert.ToInt16(HologramWidth).ToString() + "x" + Convert.ToInt16(HologramHeight).ToString(); string HologramResolution = ResolutionX.ToString() + "x" + ResolutionY.ToString(); string grayRange = GrayRangeLow + ".." + GrayRangeHigh; int nLayers = 0; // GetCountOfLayers(project.ProjectId); this.StatusBar.BarItems.Clear(); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(60)); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(200, "Hologram size " + HologramSize + " mm")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, HologramResolution)); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(150, grayRange + " gray range")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, nLayers.ToString() + " layers")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, "Save path")); this.Invalidate(); } private void RefreshBarsInfo(Project project) { this.TitleBar.TitleBarCaption = "Make3 - " + project.ProjectName; string HologramSize = Convert.ToInt16(project.HologramWidth).ToString() + "x" + Convert.ToInt16(project.HologramHeight).ToString(); string HologramResolution = project.ResolutionX.ToString() + "x" + project.ResolutionY.ToString(); string grayRange = project.GrayRangeLow + ".." + project.GrayRangeHigh; int nLayers = GetCountOfLayers(project.ProjectId); this.StatusBar.BarItems.Clear(); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(60)); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(200, "Hologram size " + HologramSize + " mm")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, HologramResolution)); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(150, grayRange + " gray range")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, nLayers.ToString() + " layers")); this.StatusBar.BarItems.Add(new XStatusBar.XBarItem(80, "Save path")); //this.projectService = new ProjectService(); InitializeMenuRecentProjects(); this.Invalidate(); } #endregion } }