예제 #1
0
        private void BorderAction()
        {
            BorderEditorDialog editor = new BorderEditorDialog(Border);

            if (DialogResult.OK == editor.ShowDialog())
            {
                if (null != Border && !Border.Equals(editor.Border))
                {
                    Border = editor.Border;
                    editor.Border.OwnerElement = this as IElement;
                    this.BorderName            = editor.Border.Name;
                    ExternData data = new ExternData("BorderName", editor.Border.Name);

                    int index = -1;
                    if (null != this.ExternDatas)
                    {
                        for (int i = 0; i < this.ExternDatas.Count; i++)
                        {
                            if (data.Equals(this.ExternDatas[i]))
                            {
                                this.ExternDatas[i] = data;
                                index = i;
                                break;
                            }
                        }
                        if (index == -1)
                        {
                            this.ExternDatas.Add(data);
                        }
                    }
                    NotifyDesignSurfaceChange();
                }
            }
        }
예제 #2
0
 private void changeBorder(Border toChange)
 {
     if (!toChange.Equals(currentBorder))
     {
         currentBorder.BorderBrush = new SolidColorBrush(ColorDef.SceneButtonBorderNormal);
         currentBorder             = toChange;
         currentBorder.BorderBrush = new SolidColorBrush(ColorDef.SceneButtonBorderSelected);
     }
 }
예제 #3
0
        /// <summary>
        /// Determines if two cells have identical settings.
        /// </summary>
        /// <param name="cell">Cell to compare with.</param>
        /// <returns><b>true</b> if cells are equal.</returns>
        public bool Equals(TableCell cell)
        {
            // do not override exising Equals method. It is used to compare elements in a list,
            // and will cause problems in the designer.
            return(cell != null &&
                   Fill.Equals(cell.Fill) &&
                   TextFill.Equals(cell.TextFill) &&
                   HorzAlign == cell.HorzAlign &&
                   VertAlign == cell.VertAlign &&
                   Border.Equals(cell.Border) &&
                   Font.Equals(cell.Font) &&
                   Formats.Equals(cell.Formats) &&
                   Highlight.Equals(cell.Highlight) &&
                   Restrictions == cell.Restrictions &&
                   Hyperlink.Equals(cell.Hyperlink) &&
                   Padding == cell.Padding &&
                   AllowExpressions == cell.AllowExpressions &&
                   Brackets == cell.Brackets &&
                   HideZeros == cell.HideZeros &&
                   HideValue == cell.HideValue &&
                   Angle == cell.Angle &&
                   RightToLeft == cell.RightToLeft &&
                   WordWrap == cell.WordWrap &&
                   Underlines == cell.Underlines &&
                   Trimming == cell.Trimming &&
                   FontWidthRatio == cell.FontWidthRatio &&
                   FirstTabOffset == cell.FirstTabOffset &&
                   ParagraphOffset == cell.ParagraphOffset &&
                   TabWidth == cell.TabWidth &&
                   Clip == cell.Clip &&
                   Wysiwyg == cell.Wysiwyg &&
                   LineHeight == cell.LineHeight &&
                   Style == cell.Style &&
                   EvenStyle == cell.EvenStyle &&
                   HoverStyle == cell.HoverStyle &&
                   HasHtmlTags == cell.HasHtmlTags &&
                   NullValue == cell.NullValue &&
                   ProcessAt == cell.ProcessAt &&
                   Printable == cell.Printable &&
                   Exportable == cell.Exportable &&
                   CellDuplicates == cell.CellDuplicates &&
                   // events
                   BeforePrintEvent == cell.BeforePrintEvent &&
                   AfterPrintEvent == cell.AfterPrintEvent &&
                   AfterDataEvent == cell.AfterDataEvent
                   &&
                   Cursor == cell.Cursor &&
                   ClickEvent == cell.ClickEvent &&
                   MouseDownEvent == cell.MouseDownEvent &&
                   MouseMoveEvent == cell.MouseMoveEvent &&
                   MouseUpEvent == cell.MouseUpEvent &&
                   MouseEnterEvent == cell.MouseEnterEvent &&
                   MouseLeaveEvent == cell.MouseLeaveEvent

                   );
        }
예제 #4
0
파일: XLStyle.cs 프로젝트: zxcvas/ClosedXML
 public bool Equals(IXLStyle other)
 {
     return
         (Font.Equals(other.Font) &&
          Fill.Equals(other.Fill) &&
          Border.Equals(other.Border) &&
          NumberFormat.Equals(other.NumberFormat) &&
          Alignment.Equals(other.Alignment) &&
          Protection.Equals(other.Protection)
         );
 }
예제 #5
0
 private bool IsItemOfCurrentShape(Border item)
 {
     foreach (var itemOfCurrentShape in Items)
     {
         if (item.Equals(itemOfCurrentShape))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #6
0
 private void method_27(int A_0, int A_1, Border A_2, CellAlign A_3, SprmCode A_4)
 {
     if ((A_2 != null) && !A_2.IsDefault)
     {
         this.class345_0.method_5(A_4);
         int num = 3 + Class355.smethod_7(A_4 == SprmCode.TSetBrc);
         this.class345_0.Write((byte)num);
         this.class345_0.Write((byte)A_0);
         this.class345_0.Write((byte)A_1);
         this.class345_0.Write((byte)A_3);
         Class355.smethod_6(A_2.Equals(new Border()) ? null : A_2, this.class345_0, false, A_4 == SprmCode.TSetBrc);
     }
 }
예제 #7
0
        protected internal override TableBorders DrawVerticalBorder(int i, float startY, float x1, PdfCanvas canvas
                                                                    , IList <float> heights)
        {
            IList <Border> borders = GetVerticalBorder(i);
            float          y1      = startY;
            float          y2      = y1;

            if (!heights.IsEmpty())
            {
                y2 = y1 - (float)heights[0];
            }
            int j;

            for (j = 1; j < heights.Count; j++)
            {
                Border prevBorder = borders[startRow - largeTableIndexOffset + j - 1];
                Border curBorder  = borders[startRow - largeTableIndexOffset + j];
                if (prevBorder != null)
                {
                    if (!prevBorder.Equals(curBorder))
                    {
                        prevBorder.DrawCellBorder(canvas, x1, y1, x1, y2, Border.Side.NONE);
                        y1 = y2;
                    }
                }
                else
                {
                    y1 -= (float)heights[j - 1];
                    y2  = y1;
                }
                if (curBorder != null)
                {
                    y2 -= (float)heights[j];
                }
            }
            if (borders.Count == 0)
            {
                return(this);
            }
            Border lastBorder = borders[startRow - largeTableIndexOffset + j - 1];

            if (lastBorder != null)
            {
                lastBorder.DrawCellBorder(canvas, x1, y1, x1, y2, Border.Side.NONE);
            }
            return(this);
        }
예제 #8
0
        /// <summary>
        /// 设置对象边框
        /// </summary>
        /// <param name="border"></param>
        private void SetBorderThickness(Border border)
        {
            foreach (var item in canvasMain.Children)
            {
                Border element = item as Border;

                if (element.Equals(border))
                {
                    border.BorderThickness = new Thickness(1);
                    border.BorderBrush     = Brushes.DodgerBlue;
                }
                else
                {
                    element.BorderThickness = new Thickness(0);
                }
            }
        }
예제 #9
0
        private void CheckParameters()
        {
            bool interfaceSpecsIsCorrect = InterfaceSpecs.Count > 0;
            bool borderIsCorrect         = Border.Equals(WEST) ||
                                           Border.Equals(EAST) ||
                                           Border.Equals(SOUTH) ||
                                           Border.Equals(NORTH);

            bool instanceNameIsCorrect = !string.IsNullOrEmpty(InstanceName);
            bool signalPrefixIsCorrect = !string.IsNullOrEmpty(SignalPrefix);
            bool filenameIsCorrect     = !string.IsNullOrEmpty(FileName);

            if (!interfaceSpecsIsCorrect || !borderIsCorrect || !instanceNameIsCorrect || !signalPrefixIsCorrect || !filenameIsCorrect)
            {
                throw new ArgumentException("Unexpected format in one of the parameters.");
            }
        }
예제 #10
0
        private void IconBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (!IsMouseLeftButtonDown)
            {
                return;
            }

            Border iconBorder = sender as Border;

            if (iconBorder.Equals(cancelSearchIconBorder) && HasText)
            {
                this.Text = string.Empty;
            }

            if (HasText && SearchMode == SearchMode.Regular)
            {
                RaiseSearchEvent();
            }

            IsMouseLeftButtonDown = false;
        }
예제 #11
0
        // endregion
        // region draw
        protected internal override TableBorders DrawHorizontalBorder(int i, float startX, float y1, PdfCanvas canvas
                                                                      , float[] countedColumnWidth)
        {
            IList <Border> borders = GetHorizontalBorder(startRow + /*- largeTableIndexOffset*/ i);
            float          x1      = startX;
            float          x2      = x1 + countedColumnWidth[0];

            if (i == 0)
            {
                Border firstBorder = GetFirstVerticalBorder()[startRow - largeTableIndexOffset];
                if (firstBorder != null)
                {
                    x1 -= firstBorder.GetWidth() / 2;
                }
            }
            else
            {
                if (i == finishRow - startRow + 1)
                {
                    Border firstBorder = GetFirstVerticalBorder()[startRow - largeTableIndexOffset + finishRow - startRow + 1
                                                                  - 1];
                    if (firstBorder != null)
                    {
                        x1 -= firstBorder.GetWidth() / 2;
                    }
                }
            }
            int j;

            for (j = 1; j < borders.Count; j++)
            {
                Border prevBorder = borders[j - 1];
                Border curBorder  = borders[j];
                if (prevBorder != null)
                {
                    if (!prevBorder.Equals(curBorder))
                    {
                        prevBorder.DrawCellBorder(canvas, x1, y1, x2, y1, Border.Side.NONE);
                        x1 = x2;
                    }
                }
                else
                {
                    x1 += countedColumnWidth[j - 1];
                    x2  = x1;
                }
                if (curBorder != null)
                {
                    x2 += countedColumnWidth[j];
                }
            }
            Border lastBorder = borders.Count > j - 1 ? borders[j - 1] : null;

            if (lastBorder != null)
            {
                if (i == 0)
                {
                    if (GetVerticalBorder(j)[startRow - largeTableIndexOffset + i] != null)
                    {
                        x2 += GetVerticalBorder(j)[startRow - largeTableIndexOffset + i].GetWidth() / 2;
                    }
                }
                else
                {
                    if (i == finishRow - startRow + 1 && GetVerticalBorder(j).Count > startRow - largeTableIndexOffset + i - 1 &&
                        GetVerticalBorder(j)[startRow - largeTableIndexOffset + i - 1] != null)
                    {
                        x2 += GetVerticalBorder(j)[startRow - largeTableIndexOffset + i - 1].GetWidth() / 2;
                    }
                }
                lastBorder.DrawCellBorder(canvas, x1, y1, x2, y1, Border.Side.NONE);
            }
            return(this);
        }
예제 #12
0
 public bool Equals(XlsxStyle other)
 {
     return(other != null && Font.Equals(other.Font) && Fill.Equals(other.Fill) && Border.Equals(other.Border) && NumberFormat.Equals(other.NumberFormat) &&
            Alignment == other.Alignment);
 }
        static void RepaintNodeShapes(Canvas nodeCanvas)
        {
            Border nodeCanvasBorder = (Border)nodeCanvas.Parent;

            RemoveNodeShapes(nodeCanvas);
            NodeCanvasData ncDInst = GetCanvasNodeData(nodeCanvas);
            Node           node    = ncDInst.node;

            Border rectBorder = new Border()
            {
                CornerRadius = new CornerRadius(2), BorderThickness = new Thickness(1), BorderBrush = System.Windows.Media.Brushes.Black
            };

            System.Windows.Shapes.Rectangle heirsPivotRect = new System.Windows.Shapes.Rectangle()
            {
                Stroke = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.IndianRed), Width = 25, Height = 25
            };
            Canvas.SetLeft(rectBorder, Canvas.GetLeft(nodeCanvasBorder) + .5f * nodeCanvasBorder.ActualWidth - 12.5f);
            Canvas.SetTop(rectBorder, Canvas.GetTop(nodeCanvasBorder) + nodeCanvasBorder.ActualHeight);
            heirsPivotRect.MouseEnter           += new MouseEventHandler(canvasRedRect_MouseEnter);
            heirsPivotRect.MouseLeave           += new MouseEventHandler(canvasRedRect_MouseLeave);
            heirsPivotRect.MouseLeftButtonDown  += new MouseButtonEventHandler(canvasRedRect_LeftMouseDown);
            heirsPivotRect.MouseRightButtonDown += new MouseButtonEventHandler(canvasRedRect_RightMouseDown);
            rectBorder.Child = heirsPivotRect;
            workspaceCanvas.Children.Add(rectBorder);
            Canvas.SetZIndex(rectBorder, 10000);
            ncDInst.heirsPivot = heirsPivotRect;

            Ellipse parentPivotEllipse = new Ellipse()
            {
                Stroke = new SolidColorBrush(Colors.Black), Fill = new SolidColorBrush(Colors.CadetBlue), Width = 25, Height = 25
            };

            Canvas.SetLeft(parentPivotEllipse, Canvas.GetLeft(nodeCanvasBorder) + .5f * nodeCanvas.Width - 12.5f);
            Canvas.SetTop(parentPivotEllipse, Canvas.GetTop(nodeCanvasBorder) - 25);
            workspaceCanvas.Children.Add(parentPivotEllipse);
            Canvas.SetZIndex(parentPivotEllipse, 20000);
            ncDInst.parentPivot = parentPivotEllipse;

            if (node.heirs != null && node.heirs.Count > 0)
            {
                List <Canvas> heirsCanvases = new List <Canvas>();
                foreach (Heir heir in node.heirs)
                {
                    heirsCanvases.Add(curNodesOnLayout.Where(el => el.Value.node.Equals(heir.heirNode)).ToArray()[0].Key);
                }
                for (int i = 0; i < heirsCanvases.Count; i++)
                {
                    Border   heirCanvBorder = (Border)heirsCanvases[i].Parent;
                    Polyline newPLine;
                    PointF   p0, p1, p2, p3;
                    p1 = new PointF((float)(Canvas.GetLeft(nodeCanvasBorder) + .5f * nodeCanvasBorder.ActualWidth), (float)(Canvas.GetTop(nodeCanvasBorder) + nodeCanvasBorder.ActualHeight + ncDInst.heirsPivot.ActualHeight * .5f));
                    p2 = new PointF((float)(Canvas.GetLeft(heirCanvBorder) + .5f * (heirCanvBorder).ActualWidth), (float)(Canvas.GetTop(heirCanvBorder) - GetCanvasNodeData(heirsCanvases[i]).parentPivot.ActualHeight * .5f));
                    if (!nodeCanvasBorder.Equals(heirCanvBorder))
                    {
                        p0       = new PointF(p1.X, (float)Canvas.GetTop(nodeCanvasBorder));
                        p3       = new PointF(p2.X, (float)(Canvas.GetTop(heirCanvBorder) + (heirCanvBorder).ActualHeight));
                        newPLine = RelationsDrawer.ConstructPolyline(p0, p1, p2, p3);
                    }
                    else
                    {
                        p0       = new PointF(p1.X, p1.Y - 100f);
                        p3       = new PointF(p2.X, p2.Y + 100f);
                        newPLine = RelationsDrawer.ConstructPolyline(p0, p1, p2, p3, true);
                    }

                    int midIndex = (int)(newPLine.Points.Count * .5f);

                    AddArrowsToPolyline(newPLine);

                    newPLine.MouseEnter += new MouseEventHandler(relation_MouseEnter);
                    newPLine.MouseLeave += new MouseEventHandler(relation_MouseLeave);
                    System.Windows.Point textBlockPos = newPLine.Points.ToArray()[midIndex];

                    Border tmpBorder = (Border)GetBranchTextBlock(nodeCanvas, heirsCanvases[i]).Parent;
                    Canvas.SetLeft(tmpBorder, textBlockPos.X - tmpBorder.ActualWidth * .5f);
                    Canvas.SetTop(tmpBorder, textBlockPos.Y);

                    ncDInst.relations.Add(newPLine);
                    workspaceCanvas.Children.Add(newPLine);
                    Canvas.SetZIndex(newPLine, 0);
                }
            }
        }
예제 #14
0
        protected override void DoCommandAction()
        {
            CheckParameters();

            List <Tile> backupSelection = TileSelectionManager.Instance.GetSelectedTiles().ToList();

            bool append = Append;

            foreach (string spec in InterfaceSpecs)
            {
                List <TileKey> intTiles = new List <TileKey>();

                // filter interconnect tiles from selection
                foreach (Tile t in TileSelectionManager.Instance.GetSelectedTiles().Where(
                             tile => IdentifierManager.Instance.IsMatch(tile.Location, IdentifierManager.RegexTypes.Interconnect)))
                {
                    intTiles.Add(t.TileKey);
                }

                int indexOffset = 0;

                string[] split = spec.Split(':');

                string direction  = split[INDEX_DIRECTION];
                string signalName = split[INDEX_SIGNAL_NAME];

                string[] sLengths = split[INDEX_LENGTH].Split('-');
                int[]    lengths  = Array.ConvertAll(sLengths, s => int.Parse(s));

                foreach (int length in lengths)
                {
                    IEnumerable <IGrouping <int, TileKey> > clusters = null;

                    if (Border.Equals(WEST) || Border.Equals(EAST))
                    {
                        clusters =
                            from key in intTiles
                            group key by key.X into cluster
                            select cluster;
                    }
                    else if (Border.Equals(NORTH) || Border.Equals(SOUTH))
                    {
                        clusters =
                            from key in intTiles
                            group key by key.Y into cluster
                            select cluster;
                    }
                    else
                    {
                        throw new ArgumentException("Unexpected format in parameter InterfaceSpecs.");
                    }

                    if (Border.Equals(NORTH) || Border.Equals(WEST))
                    {
                        clusters = clusters.OrderBy(c => c.Key).Take(length);
                    }
                    else if (Border.Equals(EAST) || Border.Equals(SOUTH))
                    {
                        clusters = clusters.OrderByDescending(c => c.Key).Take(length);
                    }

                    List <Tile> interfaceTiles = new List <Tile>();

                    foreach (IGrouping <int, TileKey> group in clusters)
                    {
                        foreach (TileKey key in group)
                        {
                            interfaceTiles.Add(FPGA.FPGA.Instance.GetTile(key));
                        }
                    }

                    TileSelectionManager.Instance.ClearSelection();

                    // select interface tiles
                    foreach (Tile t in interfaceTiles)
                    {
                        TileSelectionManager.Instance.AddToSelection(t.TileKey, false);
                    }

                    PrintPartitionPinConstraintsForSelection command = new PrintPartitionPinConstraintsForSelection();
                    command.Mode              = MODE_ROW_WISE;
                    command.Horizontal        = HORIZONTAL_LEFT_TO_RIGHT;
                    command.Vertical          = VERTICAL_TOP_DOWN;
                    command.CardinalDirection = GetCardinalDirection(Border, direction);
                    command.Length            = length;
                    command.IndexOffset       = indexOffset;
                    command.PortKind          = GetPortKind(direction);
                    command.NumberOfSignals   = NumberOfSignals;
                    command.FileName          = FileName;
                    command.InstanceName      = InstanceName;
                    command.SignalName        = $"{SignalPrefix}_{signalName}";
                    command.PreventBlocking   = PreventWiresFromBlocking;
                    command.Append            = append;
                    command.CreateBackupFile  = CreateBackupFile;
                    CommandExecuter.Instance.Execute(command);

                    // restore selection
                    TileSelectionManager.Instance.ClearSelection();

                    foreach (Tile t in backupSelection)
                    {
                        TileSelectionManager.Instance.AddToSelection(t.TileKey, false);
                    }

                    indexOffset += interfaceTiles.Count * PrintPartitionPinConstraintsForTile.SIGNALS_PER_TILE;

                    append = true;
                }
            }
        }
예제 #15
0
    int IComparer.Compare(object A_0, object A_1)
    {
        Class127 class2  = (Class127)A_0;
        Class127 class3  = (Class127)A_1;
        Border   border  = (Border)class2.method_3();
        Border   border2 = (Border)class3.method_3();
        int      num     = (((class2.method_1() * 0x3e8) + (class2.method_0() * 100)) + (((border == null) ? 1 : 0) * 10)) + class2.method_2();
        int      num2    = (((class3.method_1() * 0x3e8) + (class3.method_0() * 100)) + ((border2.Equals(new Border()) ? 1 : 0) * 10)) + class3.method_2();

        return(num - num2);
    }