Exemplo n.º 1
0
        private void FontStyle_OnClick(object sender, EventArgs e)
        {
            switch (((Button)sender).Tag.ToString().ToUpper())
            {
            case "R":
                Target.FontStyle = 0;
                break;

            case "B":
                Target.FontStyle ^= (int)FontStyle.Bold;
                break;

            case "I":
                Target.FontStyle ^= (int)FontStyle.Italic;
                break;

            case "U":
                Target.FontStyle ^= (int)FontStyle.Underline;
                break;

            case "S":
                Target.FontStyle ^= (int)FontStyle.Strikeout;
                break;
            }

            ShowFontStyle();
            LivePreview.Update();
        }
Exemplo n.º 2
0
        private void Flags_OnClick(object sender, EventArgs e)
        {
            switch (((Button)sender).Text.ToUpper())
            {
            case "1":
                Target.LabelFlags ^= (int)LabelObject.ItemFlags.F1;
                break;

            case "2":
                Target.LabelFlags ^= (int)LabelObject.ItemFlags.F2;
                break;

            case "3":
                Target.LabelFlags ^= (int)LabelObject.ItemFlags.F3;
                break;

            case "4":
                Target.LabelFlags ^= (int)LabelObject.ItemFlags.F4;
                break;

            case "5":
                Target.LabelFlags ^= (int)LabelObject.ItemFlags.F5;
                break;
            }

            ShowFlags();
            LivePreview.Update();
        }
Exemplo n.º 3
0
        private void LoadParameters()
        {
            LivePreview.SuspendUpdates();

            Target.SaveFlags();

            tb_name.Text = Target.Name;
            tb_name.Tag  = Target.Name;

            tb_key.Text = Target.Key;
            tb_key.Tag  = Target.Key;

            LoadColor();
            lab_color.Tag = Target.TextColor;

            fontSize.Value = Target.FontSize;
            fontSize.Tag   = Target.FontSize;

            LoadFontList();
            fontList.Tag = Target.FontID;

            ShowFontStyle();
            pan_FontStyle.Tag = Target.FontStyle;

            ShowRotation();
            LoadTextTable();

            LivePreview.ResumeUpdates();
        }
Exemplo n.º 4
0
        private void ShowRotation()
        {
            int angle = 0;

            if (Target.IsVertical)
            {
                angle += 90;
            }
            if (Target.IsTurned180)
            {
                angle += 180;
            }

            lab_angle.Text = $"{angle} °";

            if (!Target.IsVertical)
            {
                lab_size.Text = $"{imageFrame.BackgroundImage.Width}x{imageFrame.BackgroundImage.Height}";
                aspectRatio   = (float)imageFrame.BackgroundImage.Width / (float)imageFrame.BackgroundImage.Height;
            }
            else
            {
                lab_size.Text = $"{imageFrame.BackgroundImage.Height}x{imageFrame.BackgroundImage.Width}";
                aspectRatio   = (float)imageFrame.BackgroundImage.Height / (float)imageFrame.BackgroundImage.Width;
            }


            LivePreview.Update();
        }
Exemplo n.º 5
0
        /*
         * private void LineLength_MouseWheel(object sender, MouseEventArgs e)
         * {
         *  lineLength.Text =
         *      Funcs.Clamp((Funcs.ToInt(lineLength.Text) + 4 * Funcs.Force(Funcs.ToInt(e.Delta))),
         *                  1, Config.MaxLineSize).ToString();
         * }
         */

        private void LoadParameters()
        {
            LivePreview.SuspendUpdates();

            Target.SaveFlags();

            tb_name.Text = this.Target.Name;
            tb_name.Tag  = this.Target.Name;

            tb_key.Text = this.Target.Key;
            tb_key.Tag  = this.Target.Key;

            LoadColor();
            lab_color.Tag = Target.LineColor;

            radioHorizontal.Checked = !Target.IsVertical;
            radioVertical.Checked   = Target.IsVertical;

            SetLineRanges();
            lineLength.Text = Target.Length.ToString();
            lineLength.Tag  = Target.Length;

            lineThickness.Value = Target.Thickness;
            lineThickness.Tag   = Target.Thickness;

            tbDashPattern.Text = Target.DashPattern;
            tbDashPattern.Tag  = Target.DashPattern;

            ShowSizeMode();

            LivePreview.ResumeUpdates();
        }
Exemplo n.º 6
0
        private void Lab_size_Click(object sender, EventArgs e)
        {
            bool tempLinkStat = cb_link.Checked;

            LivePreview.SuspendUpdates();

            // Disable Link Temporarily
            cb_link.Checked = false;

            if (!Target.IsVertical)
            {
                tb_width.Text  = imageFrame.BackgroundImage.Width.ToString();
                tb_height.Text = imageFrame.BackgroundImage.Height.ToString();
            }
            else
            {
                tb_width.Text  = imageFrame.BackgroundImage.Height.ToString();
                tb_height.Text = imageFrame.BackgroundImage.Width.ToString();
            }

            cb_link.Checked = tempLinkStat;

            LivePreview.ResumeUpdates();
            LivePreview.Update();
        }
Exemplo n.º 7
0
        private void Canvas_DoubleClick(object sender, EventArgs e)
        {
            LivePreview.Select(this);
            EditObject();

            //LivePreview.currentObject = null;
        }
Exemplo n.º 8
0
        private void TextTable_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (textTable.SelectedCells.Count > 0)
            {
                string langCode = textTable[grid_lang.Index, e.RowIndex].Value.ToString();

                StringEditor stringEditor = new StringEditor("Insert the text to display - " + langCode);

                stringEditor.textBox.Text =
                    textTable[grid_content.Index, e.RowIndex].Value.ToString();

                if (stringEditor.ShowDialog() == DialogResult.OK)
                {
                    if (stringEditor.textBox.Text.Length == 0)
                    {
                        Funcs.Error("The label text must be at least 1 character long !");
                    }
                    else
                    {
                        Target.ContentTable[langCode] = stringEditor.textBox.Text;
                    }
                }

                textTable[grid_content.Index, e.RowIndex].Value = Target.ContentTable[langCode];
                LivePreview.Update();
            }
        }
Exemplo n.º 9
0
 private void LabelEditor_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (DialogResult != DialogResult.OK)
     {
         DiscardChanges();
         LivePreview.Update();
     }
 }
Exemplo n.º 10
0
        private void Canvas_MouseDown(object sender, MouseEventArgs e)
        {
            isMouseDown = true;
            LivePreview.Select(this);

            mouseLastLocation = e.Location;
            Holder.Cursor     = Config.OnMovingObject;
        }
Exemplo n.º 11
0
        private void LoadColor()
        {
            tb_color_r.Text = Target.LineColor.R.ToString();
            tb_color_g.Text = Target.LineColor.G.ToString();
            tb_color_b.Text = Target.LineColor.B.ToString();

            lab_color.BackColor = Target.LineColor;
            LivePreview.Update();
        }
Exemplo n.º 12
0
        private void DrawingModeCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!editorReady)
            {
                return;
            }

            Target.drawingType = (ImageObject.DrawingTypes)drawingModeCombo.SelectedIndex;

            LivePreview.Update();
        }
Exemplo n.º 13
0
        private void Orientation_CheckedChanged(object sender, EventArgs e)
        {
            // Filter only one change and discard this other
            if (((RadioButton)sender).Checked)
            {
                return;
            }

            Target.IsVertical = radioVertical.Checked;
            LivePreview.Update();
        }
Exemplo n.º 14
0
        public void DeleteObject()
        {
            if (LivePreview.currentObject == null)
            {
                return;
            }

            thePaper.Controls.Remove(LivePreview.currentObject.Holder);
            Objects.DeleteObject(LivePreview.currentObject);

            LivePreview.UnSelect();
            PopulateObjectList();
        }
Exemplo n.º 15
0
        private void Alignment_OnClick(object sender, EventArgs e)
        {
            if (LivePreview.currentObject == null)
            {
                return;
            }

            LivePreview.currentObject.Alignment = (uint)((Control)sender).Tag;

            ShowAlignment();
            LivePreview.Update();
            UpdateObjectPosition();
        }
Exemplo n.º 16
0
        public void AddObjectToPaper(DocumentObject obj)
        {
            if (obj == null)
            {
                return;
            }

            thePaper.Controls.Add(obj.Holder);
            //LivePreview.currentObject = obj;
            LivePreview.Select(obj);

            // Populate object table after adding object
            PopulateObjectList();
        }
Exemplo n.º 17
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Project.OpenProject();

            UpdateFormTitle();
            PopulateObjectList();

            LivePreview.UnSelect();

            // Add all the controls to the paper panel
            foreach (DocumentObject docObj in Objects.objectList)
            {
                thePaper.Controls.Add(docObj.Holder);
            }
        }
Exemplo n.º 18
0
        private void ResourceComboList_SelectedIndexChanged(object sender, EventArgs e)
        {
            imageFrame.BackgroundImage       = DocMaker.Properties.Resources.none;
            imageFrame.BackgroundImageLayout = ImageLayout.Center;

            if (resourceComboList.SelectedItem == null)
            {
                return;
            }

            int resID = resourceComboList.SelectedIndex;

            if (resID != 0)
            {
                Bitmap img = Resources.resourceBitmap[resID];

                if (img.Width > imageFrame.Width || img.Height > imageFrame.Height)
                {
                    imageFrame.BackgroundImageLayout = ImageLayout.Zoom;
                }
                else
                {
                    imageFrame.BackgroundImageLayout = ImageLayout.Center;
                }

                imageFrame.BackgroundImage = img;
            }

            // To recalculate size and aspect ratio
            ShowRotation();

            if (!editorReady)
            {
                return;
            }

            Target.ResourceID = (string)resourceComboList.SelectedItem;
            UpdateCanvasImage();

            //if(tb_width.Text.Equals("") || tb_height.Text.Equals(""))
            //{
            //    tb_width.Text = Target.Canvas.BackgroundImage.Size.Width.ToString();
            //    tb_height.Text = Target.Canvas.BackgroundImage.Size.Height.ToString();
            //}

            LivePreview.Update();
        }
Exemplo n.º 19
0
        private void LayersTable_SelectionChanged(object sender, EventArgs e)
        {
            if (isPopulating || ignoreSelectionChange)
            {
                return;
            }

            if (layersTable.SelectedCells.Count <= 0)
            {
                LivePreview.UnSelect();
            }
            else
            {
                int index = layersTable.SelectedCells[0].RowIndex;
                LivePreview.Select((DocumentObject)layersTable[layer_object.Index, index].Value);
            }
        }
Exemplo n.º 20
0
        private void ShowRotation()
        {
            int angle = 0;

            if (Target.IsVertical)
            {
                angle += 90;
            }
            if (Target.IsTurned180)
            {
                angle += 180;
            }

            lab_angle.Text = $"{angle} °";

            LivePreview.Update();
        }
Exemplo n.º 21
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Initialize a new project
            Project.NewProject();
            UpdateFormTitle();

            // Set application title

            // Resize the paper
            ResizePaper();

            // Populate object list
            PopulateObjectList();

            // Reset zooms
            LoadZoomList();

            // Update even if not object is selected to reset properties
            LivePreview.UnSelect();
        }
Exemplo n.º 22
0
        private void SizeMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Check if value changed !
            if (Target.SizeInPercent == sizeMode.SelectedItem.Equals("%"))
            {
                return;
            }

            // Set the option
            Target.SizeInPercent = sizeMode.SelectedItem.Equals("%");
            SetLineRanges();

            // Mode Changed so we will calculate size from object size
            if (Target.SizeInPercent)
            {
                // Previously the size was in pixels
                if (Target.IsVertical)
                {
                    lineLength.Text = ((Target.Length / Paper.Height) * 100f).ToString();
                }
                else
                {
                    lineLength.Text = ((Target.Length / Paper.Width) * 100f).ToString();
                }
            }
            else
            {
                // Previously the size was in percentage
                if (Target.IsVertical)
                {
                    lineLength.Text = ((int)(Paper.Height * Target.Length / 100f)).ToString();
                }
                else
                {
                    lineLength.Text = ((int)(Paper.Width * Target.Length / 100f)).ToString();
                }
            }

            LivePreview.Update();
        }
Exemplo n.º 23
0
        private void LoadParameters()
        {
            LivePreview.SuspendUpdates();

            Target.SaveFlags();

            tb_name.Text = Target.Name;
            tb_name.Tag  = Target.Name;

            tb_key.Text = Target.Key;
            tb_key.Tag  = Target.Key;

            SetSizeRanges();

            tb_width.Text = Target.Width.ToString();
            tb_width.Tag  = Target.Width;

            tb_height.Text = Target.Height.ToString();
            tb_height.Tag  = Target.Height;

            cb_link.Checked = Target.LinkedSize;

            resourceComboList.Tag           = Target.ResourceID;
            resourceComboList.DataSource    = Resources.resourceList;
            resourceComboList.SelectedIndex = Resources.resourceList.IndexOf(Target.ResourceID);

            drawingModeCombo.DataSource    = Enum.GetNames(typeof(ImageObject.DrawingTypes));
            drawingModeCombo.SelectedIndex = (int)Target.drawingType;
            drawingModeCombo.Tag           = Target.drawingType;

            //EmployeeType empType = (EmployeeType)Enum.Parse(typeof(EmployeeType), ddl.SelectedValue);

            ShowSizeMode();
            ShowRotation();

            editorReady = true;
            LivePreview.ResumeUpdates();
        }
Exemplo n.º 24
0
        private void tb_height_OnSafeTextChange(object sender, string safeValue)
        {
            if (!editorReady || IsLinkUpdate)
            {
                IsLinkUpdate = false;
                return;
            }

            Target.Height = tb_height.GetFloatValue();

            if (Target.LinkedSize)
            {
                Target.Width  = tb_height.GetFloatValue() * aspectRatio;
                tb_width.Text = Target.SizeInPercent ? Target.Width.ToString() : ((int)Target.Width).ToString();

                if (!tb_width.Text.Equals(Target.Width))
                {
                    //IsLinkUpdate = true;
                }
            }

            LivePreview.Update();
        }
Exemplo n.º 25
0
        private void SizeMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Check if value changed !
            if (Target.SizeInPercent == sizeMode.SelectedItem.Equals("%"))
            {
                return;
            }

            // Set the option
            Target.SizeInPercent = sizeMode.SelectedItem.Equals("%");
            SetSizeRanges();

            // Mode Changed so we will calculate size from object size
            if (Target.SizeInPercent)
            {
                // Set the width and skip height if size in linked since it will be auto generated
                tb_width.Text = (Target.Width * 100f / Paper.Width).ToString();

                if (!Target.LinkedSize)
                {
                    tb_height.Text = (Target.Height * 100f / Paper.Height).ToString();
                }
            }
            else
            {
                // Previously the size was in percentage
                tb_width.Text = ((int)(Paper.Width * Target.Width / 100f)).ToString();

                if (!Target.LinkedSize)
                {
                    tb_height.Text = ((int)(Paper.Height * Target.Height / 100f)).ToString();
                }
            }

            LivePreview.Update();
        }
Exemplo n.º 26
0
        public static void InitializeComponents()
        {
            // Empty the temp folder for the new project files
            Resources.EmptyTempFolder();

            // Clear paper from the controls
            LivePreview.paperReference.Controls.Clear();

            if (colorDialog != null)
            {
                colorDialog.Dispose();
            }

            colorDialog          = new ColorDialog();
            colorDialog.FullOpen = true;

            Paper.Initialize();
            Fonts.Initialize();

            Languages.Initialize();
            Objects.Initialize();

            LivePreview.UnSelect();
        }
Exemplo n.º 27
0
 private void tbDashPattern_OnSafeTextChange(object sender, string safeValue)
 {
     Target.DashPattern = safeValue;
     LivePreview.Update();
 }
Exemplo n.º 28
0
 private void lineLength_OnSafeTextChange(object sender, string safeValue)
 {
     Target.Length = lineLength.GetFloatValue();
     LivePreview.Update();
 }
Exemplo n.º 29
0
 private void LineThickness_ValueChanged(object sender, EventArgs e)
 {
     Target.Thickness = (byte)Funcs.Max(lineThickness.Value, 1);
     LivePreview.Update();
 }
Exemplo n.º 30
0
 private void FontList_SelectedIndexChanged(object sender, EventArgs e)
 {
     Target.FontID = ((FontListEntry)fontList.SelectedItem).FontID;
     LivePreview.Update();
 }