public RotateText(LayerText layer, List <Layer.LayerItem> texts, int rotateSteps, bool forceKeepLastCenter) { // call the common constructor float angle = MapData.Layer.CurrentRotationStep * rotateSteps; base.commonConstructor(layer, texts, angle, forceKeepLastCenter); }
public DeleteText(LayerText layer, List<Layer.LayerItem> cells) { mTextLayer = layer; mTextCellIndex = new List<int>(cells.Count); // copy the list, because the pointer may change (specially if it is the selection) mTextCells = new List<Layer.LayerItem>(cells.Count); foreach (Layer.LayerItem obj in cells) mTextCells.Add(obj); }
private List <int> mTextCellIndex = null; // this list of index is for the redo, to add each text at the same place public DeleteText(LayerText layer, List <Layer.LayerItem> cells) { mTextLayer = layer; mTextCellIndex = new List <int>(cells.Count); // copy the list, because the pointer may change (specially if it is the selection) mTextCells = new List <Layer.LayerItem>(cells.Count); foreach (Layer.LayerItem obj in cells) { mTextCells.Add(obj); } }
public EditText(LayerText layer, LayerText.TextCell cellToEdit, string newText, Font newFont, Color newColor, StringAlignment newAlignment) { mTextLayer = layer; mTextCell = cellToEdit; mOldText = cellToEdit.Text; mNewText = newText; mOldFont = cellToEdit.Font; mNewFont = newFont; mOldColor = cellToEdit.FontColor; mNewColor = newColor; mOldAlignment = cellToEdit.TextAlignment; mNewAlignment = newAlignment; }
public EditText(LayerText layer, LayerText.TextCell cellToEdit, string newText, Font newFont, Color newColor, StringAlignment newAlignment) { mTextLayer = layer; mTextCell = cellToEdit; mOldText = cellToEdit.Text; mNewText = newText; mOldFont = cellToEdit.Font; mNewFont = newFont; mOldColor = cellToEdit.FontColor; mNewColor = newColor; mOldAlignment = cellToEdit.TextAlignment; mNewAlignment = newAlignment; }
public static FontStyle GetFontStyle(LayerText layerText) { FontStyle style = FontStyle.Normal; if (layerText.FauxBold) { style |= FontStyle.Bold; } if (layerText.FauxItalic) { style |= FontStyle.Italic; } return(style); }
private void displayHullButton_Click(object sender, EventArgs e) { // take the focus anyway if we click the panel this.Focus(); // create a copy of the edited layer to hold the old data (the layer can be on any type, we just want to copy the options) LayerText oldLayerData = new LayerText(); oldLayerData.CopyOptionsFrom(mLayerReference); // create a new layer to store the new data, and reverse the display hull flag in the new data LayerText newLayerData = new LayerText(); newLayerData.CopyOptionsFrom(mLayerReference); newLayerData.DisplayHulls = !mLayerReference.DisplayHulls; // do a change option action ActionManager.Instance.doAction(new ChangeLayerOption(mLayerReference, oldLayerData, newLayerData)); }
public LayerTextInputDialogue(bool creatingNew, string defaultLayerName) { InitializeComponent(); WindowStartupLocation = WindowStartupLocation.CenterScreen; LayerName = defaultLayerName; InitialLayerName = LayerName; CreatingNew = creatingNew; if (!CreatingNew) { this.Title = "Editing layer '" + LayerName + "'"; } else { this.Title = "Creating new layer"; } LayerText.Focus(); LayerText.SelectAll(); }
public EditTextForm(LayerText.TextCell textCell) { InitializeComponent(); if (textCell != null) { // text font mEditedFont = textCell.Font; // color changeColor(textCell.FontColor); // text alignement if (textCell.TextAlignment == StringAlignment.Near) alignLeftButton_Click(null, null); else if (textCell.TextAlignment == StringAlignment.Center) alignCenterButton_Click(null, null); else alignRightButton_Click(null, null); // the text itself this.textBox.Text = textCell.Text; } else { // text font mEditedFont = Properties.Settings.Default.DefaultTextFont; // color changeColor(Properties.Settings.Default.DefaultTextColor); // text alignement alignCenterButton_Click(null, null); // the text itself this.textBox.Text = BlueBrick.Properties.Resources.TextEnterText; this.textBox.SelectAll(); } // text box font this.labelSize.Text = mEditedFont.Size.ToString(); this.textBox.Font = new Font(mEditedFont.FontFamily, FONT_SIZE_FOR_EDITION, mEditedFont.Style); }
private void buttonOk_Click(object sender, EventArgs e) { // create a copy of the edited layer to hold the old data LayerText oldLayerData = new LayerText(); oldLayerData.CopyOptionsFrom(mEditedLayer); // create a new layer to store the new data LayerText newLayerData = new LayerText(); // name and visibility newLayerData.Name = this.nameTextBox.Text; newLayerData.Visible = this.isVisibleCheckBox.Checked; //transparency newLayerData.Transparency = (int)(this.alphaNumericUpDown.Value); // hull newLayerData.DisplayHulls = this.displayHullCheckBox.Checked; newLayerData.PenToDrawHull = new Pen(mHullColor, (int)hullThicknessNumericUpDown.Value); // do a change option action ActionManager.Instance.doAction(new ChangeLayerOption(mEditedLayer, oldLayerData, newLayerData)); }
public MoveText(LayerText layer, List <Layer.LayerItem> cells, PointF move) : base(layer, cells, move) { }
public DuplicateText(LayerText layer, List<Layer.LayerItem> itemsToDuplicate, bool needToAddOffset) : base(itemsToDuplicate, needToAddOffset, false) { // init the layer mTextLayer = layer; }
private int mTextCellIndex = -1; // this index is for the redo, to add the text at the same place, start with -1 to add it at the end of the list (so on top of the other texts) public AddText(LayerText layer, string textToAdd, Font font, Color color, StringAlignment alignment, PointF position) { mTextLayer = layer; mTextCell = new LayerText.TextCell(textToAdd, font, color, alignment); mTextCell.Position = position; }
public AddText(LayerText layer, string textToAdd, Font font, Color color, StringAlignment alignment, PointF position) { mTextLayer = layer; mTextCell = new LayerText.TextCell(textToAdd, font, color, alignment); mTextCell.Position = position; }
public void ReadXml(System.Xml.XmlReader reader) { // reset the counter of modifications because we just load the map (no modification done) mNumberOfModificationSinceLastSave = 0; // version readVersionNumber(reader); // check if the BlueBrick program is not too old, that // means the user try to load a file generated with /// a earlier version of BlueBrick if (mDataVersionOfTheFileLoaded > CURRENT_DATA_VERSION) { MessageBox.Show(null, Properties.Resources.ErrorMsgProgramObsolete, Properties.Resources.ErrorMsgTitleError, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } // get the number of layer for the progressbar if (mDataVersionOfTheFileLoaded >= 3) { int nbItems = reader.ReadElementContentAsInt(); // init the progress bar with the real number of layer items (+1 for the header +1 for the link rebuilding) MainForm.Instance.resetProgressBar(nbItems + 2); } // check is there is a background color if (reader.Name.Equals("BackgroundColor")) mBackgroundColor = XmlReadWrite.readColor(reader); // data of the map mAuthor = reader.ReadElementContentAsString(); mLUG = reader.ReadElementContentAsString(); mShow = reader.ReadElementContentAsString(); reader.ReadToDescendant("Day"); int day = reader.ReadElementContentAsInt(); int month = reader.ReadElementContentAsInt(); int year = reader.ReadElementContentAsInt(); mDate = new DateTime(year, month, day); // read the comment if the version is greater than 0 if (mDataVersionOfTheFileLoaded > 0) { reader.ReadToFollowing("Comment"); mComment = reader.ReadElementContentAsString().Replace("\n", Environment.NewLine); } else { reader.ReadToFollowing("CurrentSnapGridSize"); } if (mDataVersionOfTheFileLoaded < 2) { // skip the static data of layers that before we were saving // but now I think it is stupid, since we don't have action to change that // and we don't have way to update the enabled of the buttons reader.ReadElementContentAsFloat(); // CurrentSnapGridSize reader.ReadElementContentAsBoolean(); // SnapGridEnabled reader.ReadElementContentAsFloat(); // CurrentRotationStep } // read the export data if the version is 5 or higher if (mDataVersionOfTheFileLoaded > 4) { reader.ReadToDescendant("ExportPath"); // read the relative export path and store it temporarly in the absolute path variable // the absolute path will be computed after the xml serialization is finished mExportAbsoluteFileName = reader.ReadElementContentAsString(); // read the other export info mExportFileTypeIndex = reader.ReadElementContentAsInt(); mExportArea = XmlReadWrite.readRectangleF(reader); mExportScale = reader.ReadElementContentAsFloat(); // read even more info from version 8 if (mDataVersionOfTheFileLoaded > 7) { mExportWatermark = XmlReadWrite.readBoolean(reader); mExportBrickHull = XmlReadWrite.readBoolean(reader); mExportElectricCircuit = XmlReadWrite.readBoolean(reader); mExportConnectionPoints = XmlReadWrite.readBoolean(reader); } reader.ReadEndElement(); } // selected layer int selectedLayerIndex = reader.ReadElementContentAsInt(); // step the progress bar after the read of the header MainForm.Instance.stepProgressBar(); // layers // first clear the hashtable that contains all the bricks Map.sHashtableForRulerAttachementRebuilding.Clear(); // then load all the layers bool layerFound = reader.ReadToDescendant("Layer"); while (layerFound) { // get the 'type' attribute of the layer reader.ReadAttributeValue(); string layerType = reader.GetAttribute(0); // instantiate the right layer according to the type Layer layer = null; if (layerType.Equals("grid")) layer = new LayerGrid(); else if (layerType.Equals("brick")) layer = new LayerBrick(); else if (layerType.Equals("text")) layer = new LayerText(); else if (layerType.Equals("area")) layer = new LayerArea(); else if (layerType.Equals("ruler")) layer = new LayerRuler(); // read and add the new layer if (layer != null) { layer.ReadXml(reader); mLayers.Add(layer); } // read the next layer layerFound = reader.ReadToNextSibling("Layer"); } reader.ReadEndElement(); // end of Layers // once we have finished to read all the layers thus all the items, we need to recreate all the links they have between them foreach (Layer layer in mLayers) layer.recreateLinksAfterLoading(); // then clear again the hash table to free the memory Map.sHashtableForRulerAttachementRebuilding.Clear(); // step the progress bar after the rebuilding of links MainForm.Instance.stepProgressBar(); // if the selected index is valid, reset the selected layer // use the setter in order to enable the toolbar buttons if ((selectedLayerIndex >= 0) && (selectedLayerIndex < mLayers.Count)) SelectedLayer = mLayers[selectedLayerIndex]; else SelectedLayer = null; // DO NOT READ YET THE BRICK URL LIST, BECAUSE THE BRICK DOWNLOAD FEATURE IS NOT READY if (false) { // read the url of all the parts for version 5 or later if ((mDataVersionOfTheFileLoaded > 5) && !reader.IsEmptyElement) { bool urlFound = reader.ReadToDescendant("BrickUrl"); while (urlFound) { // read the next url urlFound = reader.ReadToNextSibling("BrickUrl"); } reader.ReadEndElement(); } } // construct the watermark computeGeneralInfoWatermark(); // for old version, make disapear the progress bar, since it was just an estimation MainForm.Instance.finishProgressBar(); }
public RotateText(LayerText layer, List<Layer.LayerItem> texts, int rotateSteps, bool forceKeepLastCenter) { // call the common constructor float angle = MapData.Layer.CurrentRotationStep * rotateSteps; base.commonConstructor(layer, texts, angle, forceKeepLastCenter); }
public RotateText(LayerText layer, List<Layer.LayerItem> texts, int rotateSteps) : this(layer, texts, rotateSteps, false) { }
public MoveText(LayerText layer, List<Layer.LayerItem> cells, PointF move) : base(layer, cells, move) { }
public DuplicateText(LayerText layer, List <Layer.LayerItem> itemsToDuplicate, bool needToAddOffset) : base(itemsToDuplicate, needToAddOffset, false) { // init the layer mTextLayer = layer; }
public RotateText(LayerText layer, List <Layer.LayerItem> texts, int rotateSteps) : this(layer, texts, rotateSteps, false) { }