Exemple #1
0
        /// <summary>
        /// Updates the point sizes to match that of the PDF exporter
        /// </summary>
        /// <param name="zLayout"></param>
        private void ConfigurePointSizes(ProjectLayout zLayout)
        {
            int nWidth  = zLayout.width;
            int nHeight = zLayout.height;

            switch (zLayout.exportRotation)
            {
            case 90:
            case -90:
                nWidth  = zLayout.height;
                nHeight = zLayout.width;
                break;
            }

            double dPointsPerInchWidth       = (double)m_zCurrentPage.Width / (double)m_zCurrentPage.Width.Inch;
            double dInchesWidthPerLayoutItem = (double)nWidth / (double)zLayout.dpi;

            m_dLayoutPointWidth = dInchesWidthPerLayoutItem * dPointsPerInchWidth;

            double dPointsPerInchHeight       = (double)m_zCurrentPage.Height / (double)m_zCurrentPage.Height.Inch;
            double dInchesHeightPerLayoutItem = (double)nHeight / (double)zLayout.dpi;

            m_dLayoutPointHeight = dInchesHeightPerLayoutItem * dPointsPerInchHeight;

            m_dBufferX = ((double)zLayout.buffer / (double)zLayout.dpi) * dPointsPerInchWidth;
            m_dBufferY = ((double)zLayout.buffer / (double)zLayout.dpi) * dPointsPerInchHeight;
        }
Exemple #2
0
 public void FireLayoutSelectRequested(ProjectLayout zLayout)
 {
     if (null != LayoutSelectRequested)
     {
         LayoutSelectRequested(this, new LayoutEventArgs(zLayout));
     }
 }
Exemple #3
0
        private void addLayoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const string NAME   = "name";
            const string WIDTH  = "width";
            const string HEIGHT = "height";
            const string DPI    = "dpi";

            var zQuery = new QueryPanelDialog("New Layout", 450, false);

            zQuery.SetIcon(Resources.CardMakerIcon);
            zQuery.AddTextBox("Name", "New Layout", false, NAME);
            zQuery.AddNumericBox("Width", 300, 1, Int32.MaxValue, WIDTH);
            zQuery.AddNumericBox("Height", 300, 1, Int32.MaxValue, HEIGHT);
            zQuery.AddNumericBox("DPI", 300, 100, 9600, DPI);
            if (DialogResult.OK == zQuery.ShowDialog(this))
            {
                var zLayout = new ProjectLayout(zQuery.GetString(NAME))
                {
                    width  = (int)zQuery.GetDecimal(WIDTH),
                    height = (int)zQuery.GetDecimal(HEIGHT),
                    dpi    = (int)zQuery.GetDecimal(DPI)
                };
                ProjectManager.Instance.AddLayout(zLayout);
                ProjectManager.Instance.FireProjectUpdated(true);
            }
        }
        /// <summary>
        /// Updates the point sizes to match that of the PDF exporter
        /// </summary>
        /// <param name="zLayout"></param>
        /// <param name="rectCrop"></param>
        private void ConfigurePointSizes(ProjectLayout zLayout, Rectangle rectCrop)
        {
            var nWidth  = rectCrop.Width == 0 ? zLayout.width : rectCrop.Width;
            var nHeight = rectCrop.Height == 0 ? zLayout.height : rectCrop.Height;

            switch (zLayout.exportRotation)
            {
            case 90:
            case -90:
                var nTempWidth  = nWidth;
                var nTempHeight = nHeight;
                nWidth  = nTempHeight;
                nHeight = nTempWidth;
                break;
            }

            var dPointsPerInchWidth       = (double)m_zCurrentPage.Width / (double)m_zCurrentPage.Width.Inch;
            var dInchesWidthPerLayoutItem = (double)nWidth / (double)zLayout.dpi;

            m_zExportData.LayoutPointWidth = dInchesWidthPerLayoutItem * dPointsPerInchWidth;

            var dPointsPerInchHeight       = (double)m_zCurrentPage.Height / (double)m_zCurrentPage.Height.Inch;
            var dInchesHeightPerLayoutItem = (double)nHeight / (double)zLayout.dpi;

            m_zExportData.LayoutPointHeight = dInchesHeightPerLayoutItem * dPointsPerInchHeight;

            m_zExportData.BufferX = ((double)zLayout.buffer / (double)zLayout.dpi) * dPointsPerInchWidth;
            m_zExportData.BufferY = ((double)zLayout.buffer / (double)zLayout.dpi) * dPointsPerInchHeight;
        }
Exemple #5
0
 public TestDeck()
 {
     CardLayout = new ProjectLayout()
     {
         defaultCount = 10
     };
 }
Exemple #6
0
        private void duplicateLayoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var zLayout     = (ProjectLayout)treeView.SelectedNode.Tag;
            var zLayoutCopy = new ProjectLayout(zLayout.Name + " copy");

            zLayoutCopy.DeepCopy(zLayout);
            ProjectManager.Instance.AddLayout(zLayoutCopy);
        }
Exemple #7
0
 public TestDeck(ITranslatorFactory zTranslatorFactory)
 {
     CardLayout = new ProjectLayout()
     {
         defaultCount = 10
     };
     TranslatorFactory = zTranslatorFactory;
 }
Exemple #8
0
        private void AdjustLayoutSettings(bool bCreateNew, ProjectLayout zLayout)
        {
            var zQuery = new QueryPanelDialog("Resize Layout", 450, false);

            zQuery.SetIcon(CardMakerInstance.ApplicationIcon);
            const string LAYOUT_NAME     = "layoutName";
            const string CENTER_ELEMENTS = "centerElements";
            const string WIDTH           = "width";
            const string HEIGHT          = "height";

            if (bCreateNew)
            {
                zQuery.AddTextBox("Layout Name", zLayout.Name + " copy", false, LAYOUT_NAME);
            }
            zQuery.AddNumericBox("Width", zLayout.width, 1, int.MaxValue, WIDTH);
            zQuery.AddNumericBox("Height", zLayout.height, 1, int.MaxValue, HEIGHT);
            zQuery.AddCheckBox("Center Elements", false, CENTER_ELEMENTS);

            if (DialogResult.OK == zQuery.ShowDialog(this))
            {
                var zLayoutAdjusted = bCreateNew ? new ProjectLayout(zQuery.GetString(LAYOUT_NAME)) : zLayout;

                var nOriginalWidth  = zLayout.width;
                var nOriginalHeight = zLayout.height;

                if (bCreateNew)
                {
                    zLayoutAdjusted.DeepCopy(zLayout);
                }

                zLayoutAdjusted.width  = (int)zQuery.GetDecimal(WIDTH);
                zLayoutAdjusted.height = (int)zQuery.GetDecimal(HEIGHT);

                if (zQuery.GetBool(CENTER_ELEMENTS) && null != zLayoutAdjusted.Element)
                {
                    var pointOldCenter = new Point(nOriginalWidth / 2, nOriginalHeight / 2);
                    var pointNewCenter = new Point(zLayoutAdjusted.width / 2, zLayoutAdjusted.height / 2);
                    var nXAdjust       = pointNewCenter.X - pointOldCenter.X;
                    var nYAdjust       = pointNewCenter.Y - pointOldCenter.Y;
                    foreach (var zElement in zLayoutAdjusted.Element)
                    {
                        zElement.x += nXAdjust;
                        zElement.y += nYAdjust;
                    }
                }

                UserAction.ClearUndoRedoStacks();

                if (bCreateNew)
                {
                    ProjectManager.Instance.AddLayout(zLayoutAdjusted);
                }
                else
                {
                    LayoutManager.Instance.FireLayoutUpdatedEvent(true);
                }
            }
        }
Exemple #9
0
        public void SetAndLoadLayout(ProjectLayout zLayout, bool bExporting, ProgressReporterProxy zReporterProxy)
        {
            EmptyReference = false;

            CardLayout = zLayout;

            ResetPrintCardIndex();
            ProjectLayoutReference[] zReferenceData = null;

            if (null != CardLayout.Reference)
            {
                if (CardLayout.combineReferences)
                {
                    var listReferences = new List <ProjectLayoutReference>();
                    ProjectLayoutReference zDefaultReference = null;
                    foreach (var zReference in CardLayout.Reference)
                    {
                        if (zReference.Default)
                        {
                            zDefaultReference = zReference;
                        }
                        else
                        {
                            listReferences.Add(zReference);
                        }
                    }
                    // move the default reference to the front of the set
                    if (null != zDefaultReference)
                    {
                        listReferences.Insert(0, zDefaultReference);
                    }
                    zReferenceData = listReferences.Count == 0 ? null : listReferences.ToArray();
                }
                else
                {
                    foreach (var zReference in CardLayout.Reference)
                    {
                        if (zReference.Default)
                        {
                            zReferenceData = new ProjectLayoutReference[] { zReference };
                            break;
                        }
                    }
                }
            }
            InitiateReferenceRead(zReporterProxy, zReferenceData);

            if (!bExporting)
            {
                if (CardMakerInstance.GoogleCredentialsInvalid)
                {
                    CardMakerInstance.GoogleCredentialsInvalid = false;
                    GoogleAuthManager.Instance.FireGoogleAuthCredentialsErrorEvent(
                        () => LayoutManager.Instance.InitializeActiveLayout());
                }
            }
        }
Exemple #10
0
 /// <summary>
 /// Sets the active layout and initializes it
 /// </summary>
 /// <param name="zLayout"></param>
 public void SetActiveLayout(ProjectLayout zLayout)
 {
     ActiveLayout = zLayout;
     if (null == zLayout)
     {
         ActiveDeck = null;
     }
     InitializeActiveLayout();
 }
Exemple #11
0
 /// <summary>
 /// Updates the layout controls to reflect the specified layout (without firing events)
 /// </summary>
 /// <param name="zLayout">The layout to use for specifying the settings</param>
 private void RefreshLayoutControls(ProjectLayout zLayout)
 {
     if (zLayout != null)
     {
         m_bFireLayoutChangeEvents  = false;
         numericCardSetDPI.Value    = zLayout.dpi;
         numericCardSetWidth.Value  = zLayout.width;
         numericCardSetHeight.Value = zLayout.height;
         m_bFireLayoutChangeEvents  = true;
     }
 }
Exemple #12
0
 /// <summary>
 /// Initialize the cache for each element in the ProjectLayout
 /// </summary>
 /// <param name="zLayout">The layout to initialize the cache</param>
 public static void InitializeElementCache(ProjectLayout zLayout)
 {
     // mark all fields as specified
     if (null != zLayout.Element)
     {
         foreach (var zElement in zLayout.Element)
         {
             zElement.InitializeCache();
         }
     }
 }
Exemple #13
0
        private void numericCardIndex_ValueChanged(object sender, EventArgs e)
        {
            var nTargetIndex = (int)numericCardIndex.Value - 1;

            m_nDestinationCardIndex = nTargetIndex;
            m_zLastProjectLayout    = LayoutManager.Instance.ActiveLayout;
            ChangeCardIndex(nTargetIndex);
            m_bFireLayoutChangeEvents = false;
            numericRowIndex.Value     = m_arrayIndexToRow[nTargetIndex] + 1;
            m_bFireLayoutChangeEvents = true;
        }
Exemple #14
0
 /// <summary>
 /// Initialize the cache for each element in the ProjectLayout
 /// </summary>
 /// <param name="zLayout">The layout to initialize the cache</param>
 public static void InitializeElementCache(ProjectLayout zLayout)
 {
     // mark all fields as specified
     if (null == zLayout.Element)
     {
         return;
     }
     foreach (var zElement in zLayout.Element)
     {
         zElement.InitializeTranslatedFields();
     }
 }
Exemple #15
0
        private void addCardLayoutFromTemplateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const string TEMPLATE          = "template";
            const string NAME              = "name";
            const string COUNT             = "count";
            var          listTemplateNames = new List <string>();

            LayoutTemplateManager.Instance.LayoutTemplates.ForEach(x => listTemplateNames.Add(x.ToString()));

            var zQuery = new QueryPanelDialog("Select Layout Template", 600, false);

            zQuery.SetIcon(Resources.CardMakerIcon);
            zQuery.AddTextBox("New Layout Name", "New Layout", false, NAME);
            zQuery.AddNumericBox("Number to create", 1, 1, 256, COUNT);
            var zTxtFilter        = zQuery.AddTextBox("Template Filter", string.Empty, false, TEMPLATE + NAME);
            var zListBoxTemplates = zQuery.AddListBox("Template", listTemplateNames.ToArray(), null, false, 240, TEMPLATE);

            zListBoxTemplates.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left;
            zTxtFilter.TextChanged  += (o, args) =>
            {
                var txtBox = (TextBox)o;
                zListBoxTemplates.Items.Clear();
                if (string.IsNullOrWhiteSpace(txtBox.Text))
                {
                    listTemplateNames.ForEach(zTemplate => zListBoxTemplates.Items.Add(zTemplate));
                }
                else
                {
                    listTemplateNames.Where(sTemplateName => sTemplateName.ToLower().Contains(txtBox.Text.ToLower())).ToList().ForEach(zTemplate => zListBoxTemplates.Items.Add(zTemplate));
                }
            };

            zQuery.AllowResize();
            while (DialogResult.OK == zQuery.ShowDialog(this))
            {
                var nSelectedIndex = listTemplateNames.IndexOf(zQuery.GetString(TEMPLATE));
                if (-1 == nSelectedIndex)
                {
                    MessageBox.Show("Please select a layout template");
                    continue;
                }

                ProjectLayout zSelectedLayout = LayoutTemplateManager.Instance.LayoutTemplates[nSelectedIndex].Layout;

                for (int nCount = 0; nCount < zQuery.GetDecimal(COUNT); nCount++)
                {
                    var zLayout = new ProjectLayout(zQuery.GetString(NAME));
                    zLayout.DeepCopy(zSelectedLayout);
                    ProjectManager.Instance.AddLayout(zLayout);
                }
                break;
            }
        }
        /// <summary>
        /// Adds the specified layout to the project (new data)
        /// </summary>
        /// <param name="zLayout"></param>
        public void AddLayout(ProjectLayout zLayout)
        {
            // update the Project (no null check on zProject.Layout necessary... can never have 0 layouts)
            var listLayouts = new List <ProjectLayout>(LoadedProject.Layout)
            {
                zLayout
            };

            LoadedProject.Layout = listLayouts.ToArray();
            LayoutManager.InitializeElementCache(zLayout);
            LayoutAdded?.Invoke(this, new LayoutEventArgs(zLayout, null));
            FireProjectUpdated(true);
        }
Exemple #17
0
        /// <summary>
        /// UI facing method for adding a reference node (for use from the context menu to add a new reference)
        /// </summary>
        /// <param name="tnLayout"></param>
        /// <param name="sFile"></param>
        /// <param name="bSetAsDefault"></param>
        /// <param name="zLayout"></param>
        /// <returns>The new Reference tree node or null if there is an existing reference by the same definition</returns>
        private static TreeNode AddReferenceNode(TreeNode tnLayout, string sFile, bool bSetAsDefault,
                                                 ProjectLayout zLayout)
        {
            var sProjectPath = ProjectManager.Instance.ProjectPath;
            var zReference   = new ProjectLayoutReference
            {
                Default      = bSetAsDefault,
                RelativePath = IOUtils.GetRelativePath(sProjectPath,
                                                       sFile)
            };

            return(AddReferenceNode(tnLayout, zReference, zLayout));
        }
        /// <summary>
        /// Rotates the export buffer based on the Layout exportRotation setting
        /// </summary>
        /// <param name="zBuffer"></param>
        /// <param name="zLayout"></param>
        /// <param name="postTransition"></param>
        protected void ProcessRotateExport(Bitmap zBuffer, ProjectLayout zLayout, bool postTransition)
        {
            switch (zLayout.exportRotation)
            {
            case 90:
                zBuffer.RotateFlip(postTransition ? RotateFlipType.Rotate270FlipNone : RotateFlipType.Rotate90FlipNone);
                break;

            case -90:
                zBuffer.RotateFlip(postTransition ? RotateFlipType.Rotate90FlipNone : RotateFlipType.Rotate270FlipNone);
                break;
            }
        }
Exemple #19
0
 /// <summary>
 /// Returns the layout index based on the active project
 /// </summary>
 /// <param name="zLayout"></param>
 /// <returns>The index, or -1 if not found</returns>
 public int GetLayoutIndex(ProjectLayout zLayout)
 {
     if (null != LoadedProject)
     {
         for (int nIdx = 0; nIdx < LoadedProject.Layout.Length; nIdx++)
         {
             if (LoadedProject.Layout[nIdx] == zLayout)
             {
                 return(nIdx);
             }
         }
     }
     return(-1);
 }
Exemple #20
0
        /// <summary>
        /// Adds a project layout tree node
        /// </summary>
        /// <param name="zLayout"></param>
        /// <returns></returns>
        private void AddProjectLayout(ProjectLayout zLayout)
        {
            TreeNode tnLayout = treeView.Nodes[0].Nodes.Add(zLayout.Name);

            tnLayout.Tag = zLayout;

            if (null != zLayout.Reference)
            {
                foreach (ProjectLayoutReference zReference in zLayout.Reference)
                {
                    // no need to update the layout
                    AddReferenceNode(tnLayout, zReference, null);
                }
                tnLayout.Expand();
            }
        }
Exemple #21
0
        /// <summary>
        /// Internal/Project load handling for adding a reference node.
        /// </summary>
        /// <param name="tnLayout"></param>
        /// <param name="zReference"></param>
        /// <param name="zLayout">The layout to update the references for (may be null if no update is needed - ie. project loading)</param>
        /// <returns></returns>
        private static TreeNode AddReferenceNode(TreeNode tnLayout, ProjectLayoutReference zReference,
                                                 ProjectLayout zLayout)
        {
            var sProjectPath       = ProjectManager.Instance.ProjectPath;
            var sFullReferencePath = zReference.RelativePath;

            if (!String.IsNullOrEmpty(sProjectPath))
            {
                sFullReferencePath = sProjectPath + Path.DirectorySeparatorChar + zReference.RelativePath;
            }

            if (zLayout != null && zLayout.Reference != null)
            {
                // duplicate check
                foreach (var zExistingReference in zLayout.Reference)
                {
                    if (zExistingReference.RelativePath.Equals(zReference.RelativePath,
                                                               StringComparison.CurrentCultureIgnoreCase))
                    {
                        return(null);
                    }
                }
            }

            var tnReference = new TreeNode(Path.GetFileName(sFullReferencePath))
            {
                BackColor   = zReference.Default ? DEFAULT_REFERENCE_COLOR : Color.White,
                ToolTipText = zReference.RelativePath,
                Tag         = zReference
            };

            tnLayout.Nodes.Add(tnReference);

            if (null != zLayout)
            {
                // update the ProjectLayout
                var listReferences = new List <ProjectLayoutReference>();
                if (null != zLayout.Reference)
                {
                    listReferences.AddRange(zLayout.Reference);
                }
                listReferences.Add(zReference);
                zLayout.Reference = listReferences.ToArray();
            }

            return(tnReference);
        }
Exemple #22
0
        public void SetAndLoadLayout(ProjectLayout zLayout, bool bExporting, ProgressReporterProxy zReporterProxy)
        {
            EmptyReference = false;

            CardLayout = zLayout;

            ResetPrintCardIndex();
            ProjectLayoutReference[] zReferenceData = null;

            if (null != CardLayout.Reference)
            {
                if (CardLayout.combineReferences)
                {
                    var listReferences = new List <ProjectLayoutReference>();
                    ProjectLayoutReference zDefaultReference = null;
                    foreach (var zReference in CardLayout.Reference)
                    {
                        if (zReference.Default)
                        {
                            zDefaultReference = zReference;
                        }
                        else
                        {
                            listReferences.Add(zReference);
                        }
                    }
                    // move the default reference to the front of the set
                    if (null != zDefaultReference)
                    {
                        listReferences.Insert(0, zDefaultReference);
                    }
                    zReferenceData = listReferences.Count == 0 ? null : listReferences.ToArray();
                }
                else
                {
                    foreach (var zReference in CardLayout.Reference)
                    {
                        if (zReference.Default)
                        {
                            zReferenceData = new ProjectLayoutReference[] { zReference };
                            break;
                        }
                    }
                }
            }
            new DeckReader(this, zReporterProxy).InitiateReferenceRead(zReferenceData, bExporting);
        }
Exemple #23
0
        private void defineAsTemplateLayoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const string NAME = "name";
            //const string COPY_REFS = "copy_refs";
            var zQuery = new QueryPanelDialog("Template Name", 450, 80, false);

            zQuery.SetIcon(Resources.CardMakerIcon);
            zQuery.AddTextBox("Name", "New Template", false, NAME);
            // TODO: is there really a case where the refs should be copied?
            //zQuery.AddCheckBox("Copy References", false, COPY_REFS);
            if (DialogResult.OK == zQuery.ShowDialog(this))
            {
                var zLayout = new ProjectLayout();
                zLayout.DeepCopy((ProjectLayout)treeView.SelectedNode.Tag, /*zQuery.GetBool(COPY_REFS)*/ false);
                var zTemplate = new LayoutTemplate(zQuery.GetString(NAME), zLayout);
                if (LayoutTemplateManager.Instance.SaveLayoutTemplate(CardMakerInstance.StartupPath, zTemplate))
                {
                    LayoutTemplateManager.Instance.LayoutTemplates.Add(zTemplate);
                }
            }
        }
        public void Create_should_return_properly_initialized_layout()
        {
            const int projectRowIndex = 15;
            var       inputEpics      = new EpicMetadata[150];
            var       designer        = new Mock <ILayoutDesigner>();
            var       laidOutEpics    = new[]
            {
                new[] { CreateMeta("A"), CreateMeta("B") },
                new[] { CreateMeta("C") },
                new[] { CreateMeta("D") }
            };

            designer.Setup(d => d.Layout(inputEpics)).Returns(laidOutEpics);

            var layout = ProjectLayout.Create("foo", inputEpics, projectRowIndex, designer.Object);

            layout.Name.ShouldBe("foo");
            layout.ProjectRowIndex.ShouldBe(projectRowIndex);
            layout.LastRowIndex.ShouldBe(projectRowIndex + laidOutEpics.Length);
            layout.Epics.Select(e => $"{e.RowIndex}{e.Meta.Epic.Id}").ShouldBe(new[] { "16A", "16B", "17C", "18D" });
            layout.Epics.Select(e => e.Meta).ShouldBe(laidOutEpics.SelectMany(r => r));
        }
Exemple #25
0
        private void addCardLayoutFromTemplateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const string TEMPLATE  = "template";
            const string NAME      = "name";
            const string COUNT     = "count";
            var          listItems = new List <string>();

            LayoutTemplateManager.Instance.LayoutTemplates.ForEach(x => listItems.Add(x.ToString()));

            var zQuery = new QueryPanelDialog("Select Layout Template", 450, false);

            zQuery.SetIcon(Resources.CardMakerIcon);
            zQuery.AddTextBox("New Layout Name", "New Layout", false, NAME);
            zQuery.AddNumericBox("Number to create", 1, 1, 256, COUNT);
            zQuery.AddListBox("Template", listItems.ToArray(), null, false, 120, TEMPLATE);
            zQuery.AllowResize();
            while (DialogResult.OK == zQuery.ShowDialog(this))
            {
                int nSelectedIndex = zQuery.GetIndex(TEMPLATE);
                if (-1 == nSelectedIndex)
                {
                    MessageBox.Show("Please select a layout template");
                    continue;
                }

                ProjectLayout zSelectedLayout = LayoutTemplateManager.Instance.LayoutTemplates[nSelectedIndex].Layout;

                for (int nCount = 0; nCount < zQuery.GetDecimal(COUNT); nCount++)
                {
                    var zLayout = new ProjectLayout(zQuery.GetString(NAME));
                    zLayout.DeepCopy(zSelectedLayout);
                    ProjectManager.Instance.AddLayout(zLayout);
                }
                break;
            }
        }
Exemple #26
0
 public LayoutEventArgs(ProjectLayout zLayout, Deck zDeck, bool bDataChange)
 {
     Layout     = zLayout;
     Deck       = zDeck;
     DataChange = bDataChange;
 }
 public LayoutTemplate(string sName, ProjectLayout layout)
 {
     Layout = new ProjectLayout(sName);
     Layout.DeepCopy(layout);
 }
Exemple #28
0
 public LayoutEventArgs(ProjectLayout zLayout, Deck zDeck)
     : this(zLayout, zDeck, false)
 {
 }
Exemple #29
0
 public LayoutEventArgs(ProjectLayout zLayout)
     : this(zLayout, null, false)
 {
 }
Exemple #30
0
        /// <summary>
        /// Configures the controls to match the Layout settings
        /// </summary>
        /// <param name="zLayout"></param>
        private void UpdateLayoutInfo(ProjectLayout zLayout)
        {
            if (null != zLayout)
            {
                // don't trigger any events (this is just setup)
                m_bFireLayoutChangeEvents = false;

                // get the destination index before changing the controls
                // (the value is lost when the controls are adjusted)
                int nDestinationCardIndex = m_nDestinationCardIndex;

                // configure the UI based on the newly loaded item
                numericCardSetBuffer.Value     = zLayout.buffer;
                numericCardSetWidth.Value      = zLayout.width;
                numericCardSetHeight.Value     = zLayout.height;
                numericCardSetDPI.Value        = zLayout.dpi;
                checkCardSetDrawBorder.Checked = zLayout.drawBorder;
                checkLoadAllReferences.Checked = zLayout.combineReferences;
                SetupCardIndices(LayoutManager.Instance.ActiveDeck.CardCount);
                groupBoxCardCount.Enabled = true;
                groupBoxCardSet.Enabled   = true;

                // update the list of elements
                listViewElements.Items.Clear();
                m_dictionaryItems.Clear();
                if (null != zLayout.Element)
                {
                    foreach (ProjectLayoutElement zElement in zLayout.Element)
                    {
                        ListViewItem zLvi = CreateListViewItem(zElement);
                        UpdateListViewItemText(zLvi, zElement);
                        listViewElements.Items.Add(zLvi);
                    }
                    if (0 < listViewElements.Items.Count)
                    {
                        listViewElements.Items[0].Selected = true;
                    }
                }
                else
                {
                    ElementManager.Instance.FireElementSelectedEvent(null);
                }
                m_bFireLayoutChangeEvents = true;

                // these adjustments will trigger the events necessary to adjust to the given index
                if (LayoutManager.Instance.ActiveLayout == m_zLastProjectLayout && -1 != nDestinationCardIndex &&
                    LayoutManager.Instance.ActiveDeck.CardCount > nDestinationCardIndex)
                {
                    numericCardIndex.Value = nDestinationCardIndex + 1;
                }
                else
                {
                    numericCardIndex.Value = 1;
                }
                // just in case the value is considered unchanged, fire off the event
                ChangeCardIndex((int)numericCardIndex.Value - 1);
            }
            else
            {
                groupBoxCardCount.Enabled = false;
                groupBoxCardSet.Enabled   = false;
            }
        }
Exemple #31
0
 public LayoutTemplate(string sName, ProjectLayout layout)
 {
     Layout = new ProjectLayout(sName);
     Layout.DeepCopy(layout);
 }