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(); }
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(); }
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(); }
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(); }
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(); } }
private void LabelEditor_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult != DialogResult.OK) { DiscardChanges(); LivePreview.Update(); } }
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(); }
private void DrawingModeCombo_SelectedIndexChanged(object sender, EventArgs e) { if (!editorReady) { return; } Target.drawingType = (ImageObject.DrawingTypes)drawingModeCombo.SelectedIndex; LivePreview.Update(); }
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(); }
private void Alignment_OnClick(object sender, EventArgs e) { if (LivePreview.currentObject == null) { return; } LivePreview.currentObject.Alignment = (uint)((Control)sender).Tag; ShowAlignment(); LivePreview.Update(); UpdateObjectPosition(); }
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(); }
private void ShowRotation() { int angle = 0; if (Target.IsVertical) { angle += 90; } if (Target.IsTurned180) { angle += 180; } lab_angle.Text = $"{angle} °"; LivePreview.Update(); }
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(); }
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(); }
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(); }
private void tbDashPattern_OnSafeTextChange(object sender, string safeValue) { Target.DashPattern = safeValue; LivePreview.Update(); }
private void lineLength_OnSafeTextChange(object sender, string safeValue) { Target.Length = lineLength.GetFloatValue(); LivePreview.Update(); }
private void FontList_SelectedIndexChanged(object sender, EventArgs e) { Target.FontID = ((FontListEntry)fontList.SelectedItem).FontID; LivePreview.Update(); }
private void LineThickness_ValueChanged(object sender, EventArgs e) { Target.Thickness = (byte)Funcs.Max(lineThickness.Value, 1); LivePreview.Update(); }
private void FontSize_ValueChanged(object sender, EventArgs e) { Target.FontSize = (byte)fontSize.Value; LivePreview.Update(); }