コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 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;
 }
コード例 #5
0
ファイル: EditText.cs プロジェクト: henrihs/bluebrick-id-fork
 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;
 }
コード例 #6
0
ファイル: PsdBuilder.cs プロジェクト: Liangzg/iPSD2UGUI
        public static FontStyle GetFontStyle(LayerText layerText)
        {
            FontStyle style = FontStyle.Normal;

            if (layerText.FauxBold)
            {
                style |= FontStyle.Bold;
            }
            if (layerText.FauxItalic)
            {
                style |= FontStyle.Italic;
            }
            return(style);
        }
コード例 #7
0
ファイル: LayerPanel.cs プロジェクト: Shevonar/BlueBrick
        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));
        }
コード例 #8
0
        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();
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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));
        }
コード例 #11
0
ファイル: MoveText.cs プロジェクト: Shevonar/BlueBrick
 public MoveText(LayerText layer, List <Layer.LayerItem> cells, PointF move)
     : base(layer, cells, move)
 {
 }
コード例 #12
0
 public DuplicateText(LayerText layer, List<Layer.LayerItem> itemsToDuplicate, bool needToAddOffset)
     : base(itemsToDuplicate, needToAddOffset, false)
 {
     // init the layer
     mTextLayer = layer;
 }
コード例 #13
0
        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;
        }
コード例 #14
0
ファイル: AddText.cs プロジェクト: henrihs/bluebrick-id-fork
 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;
 }
コード例 #15
0
ファイル: Map.cs プロジェクト: henrihs/bluebrick-id-fork
        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();
        }
コード例 #16
0
 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);
 }
コード例 #17
0
 public RotateText(LayerText layer, List<Layer.LayerItem> texts, int rotateSteps)
     : this(layer, texts, rotateSteps, false)
 {
 }
コード例 #18
0
ファイル: MoveText.cs プロジェクト: henrihs/bluebrick-id-fork
 public MoveText(LayerText layer, List<Layer.LayerItem> cells, PointF move)
     : base(layer, cells, move)
 {
 }
コード例 #19
0
ファイル: DuplicateText.cs プロジェクト: Shevonar/BlueBrick
 public DuplicateText(LayerText layer, List <Layer.LayerItem> itemsToDuplicate, bool needToAddOffset)
     : base(itemsToDuplicate, needToAddOffset, false)
 {
     // init the layer
     mTextLayer = layer;
 }
コード例 #20
0
 public RotateText(LayerText layer, List <Layer.LayerItem> texts, int rotateSteps)
     : this(layer, texts, rotateSteps, false)
 {
 }