public void NewLine()
        {
            LogExtreme("NewLine()");

            CursorState.CurrentRow++;

            if (CursorState.ScrollBottom == -1 && CursorState.CurrentRow >= VisibleRows)
            {
                LogController("Scroll all (before:" + TopRow.ToString() + ",after:" + (TopRow + 1).ToString() + ")");
                TopRow++;
                CursorState.CurrentRow--;
            }
            else if (CursorState.ScrollBottom >= 0 && CursorState.CurrentRow > CursorState.ScrollBottom)
            {
                LogController("Scroll region");

                if (Buffer.Count > (CursorState.ScrollBottom + TopRow))
                {
                    Buffer.Insert(CursorState.ScrollBottom + TopRow + 1, new TerminalLine());
                }

                Buffer.RemoveAt(CursorState.ScrollTop + TopRow);

                CursorState.CurrentRow--;
            }

            ChangeCount++;
        }
예제 #2
0
        private void _createTableColumn(int columnNimber)
        {
            Polyline row1   = _gride.CalculateRectagle(0, columnNimber);
            Vector3d vector = _gride.VerticalVector.Normalize().Negate();

            Matrix3d mat = Matrix3d.Displacement(vector.MultiplyBy(_gride.VerticalStep));

            row1.TransformBy(mat);

            mat = Matrix3d.Displacement(vector.MultiplyBy(_gride.VerticalStep * 0.1));
            row1.TransformBy(mat);

            mat = Matrix3d.Displacement(vector.Negate().MultiplyBy(_gride.VerticalStep - _tableRowHeight));

            row1.ReplaceVertexAt(0, row1.GetPoint3dAt(0).TransformBy(mat));
            row1.ReplaceVertexAt(3, row1.GetPoint3dAt(3).TransformBy(mat));
            row1.ReplaceVertexAt(4, row1.GetPoint3dAt(4).TransformBy(mat));

            mat = Matrix3d.Displacement(vector.MultiplyBy(_tableRowHeight));

            Polyline row2 = (Polyline)row1.GetTransformedCopy(mat);

            TopRow.Add(new TableField(row1.ConvertToRectangle().Value, "", _tableTextHeight));
            BottomRow.Add(new TableField(row2.ConvertToRectangle().Value, "", _tableTextHeight));
        }
예제 #3
0
        private void BuildWidgets()
        {
            Background = AddChild(new Background(Sprites.MenuBackground));
            Body       = AddChild(new Widget());
            TopRow     = Body.AddChild(new Widget());
            ToggleBag  = Body.AddChild(new WrapBag(MaxItemColumns * Game1.tileSize));

            NextButton          = TopRow.AddChild(new SpriteButton(Sprites.RightArrow));
            PrevButton          = TopRow.AddChild(new SpriteButton(Sprites.LeftArrow));
            NextButton.OnPress += () => CycleCategory(1);
            PrevButton.OnPress += () => CycleCategory(-1);

            SelectAllButton           = TopRow.AddChild(new LabeledCheckbox("All"));
            SelectAllButton.OnChange += OnToggleSelectAll;

            CloseButton          = AddChild(new SpriteButton(Sprites.ExitButton));
            CloseButton.OnPress += () => OnClose?.Invoke();

            CategoryLabel = TopRow.AddChild(new Label("", Color.Black, HeaderFont));
        }
예제 #4
0
        public void CreateTeble(int columnCount)
        {
            for (int i = 0; i < columnCount; i++)
            {
                _createTableColumn(i);
            }

            Polyline firstTopColumn = TopRow[0].Bounds.ConvertToPolyline();
            Matrix3d mat            = Matrix3d.Displacement(TopRow[0].Bounds.GetLowertHorizontalVector().Negate());

            firstTopColumn.TransformBy(mat);
            //TopRow.Insert(0, new TableField(firstTopColumn.ConvertToRectangle().Value, "(+) Насыпь"));

            Matrix3d disp = Matrix3d.Displacement(TopRow[0].Bounds.GetLowertHorizontalVector().Negate().Normalize().MultiplyBy(_firstColumnWidth - TopRow[0].Bounds.GetLowertHorizontalVector().Length));

            firstTopColumn.ReplaceVertexAt(0, firstTopColumn.GetPoint3dAt(0).TransformBy(disp));
            firstTopColumn.ReplaceVertexAt(1, firstTopColumn.GetPoint3dAt(1).TransformBy(disp));
            firstTopColumn.ReplaceVertexAt(4, firstTopColumn.GetPoint3dAt(4).TransformBy(disp));

            PreTopRow.Add(new TableField(firstTopColumn.ConvertToRectangle().Value, "Насыпь(+)", _tableTextHeight));

            Polyline firstBottomColumn = BottomRow[0].Bounds.ConvertToPolyline();

            firstBottomColumn.TransformBy(mat);
            firstBottomColumn.ReplaceVertexAt(0, firstBottomColumn.GetPoint3dAt(0).TransformBy(disp));
            firstBottomColumn.ReplaceVertexAt(1, firstBottomColumn.GetPoint3dAt(1).TransformBy(disp));
            firstBottomColumn.ReplaceVertexAt(4, firstBottomColumn.GetPoint3dAt(4).TransformBy(disp));

            //BottomRow.Insert(0, new TableField(firsrBottomColumn.ConvertToRectangle().Value, "(-) Выемка"));
            PreBottomRow.Add(new TableField(firstBottomColumn.ConvertToRectangle().Value, "Выемка(-)", _tableTextHeight));


            disp = Matrix3d.Displacement((firstTopColumn.GetPoint3dAt(0) - firstTopColumn.GetPoint3dAt(3)).Normalize().MultiplyBy(_preOrPostColumnWidth));
            Point3d     lowerRight  = firstBottomColumn.GetPoint3dAt(0);
            Point3d     upperRight  = firstTopColumn.GetPoint3dAt(1);
            Point3d     lowerLeft   = lowerRight.TransformBy(disp);
            Point3d     upperLeft   = upperRight.TransformBy(disp);
            Rectangle3d firstColumn = new Rectangle3d(upperLeft, upperRight, lowerLeft, lowerRight);

            PreTopRow.Add(new TableField(firstColumn, "Итого, м3", _tableTextHeight * 0.8, Math.PI / 2d));


            mat = Matrix3d.Displacement(TopRow.Last().Bounds.GetLowertHorizontalVector());
            mat = mat.PreMultiplyBy(Matrix3d.Displacement(TopRow.Last().Bounds.GetLowertHorizontalVector().Normalize().MultiplyBy(_preOrPostColumnWidth)));
            Polyline ammountTopColumn = (Polyline)TopRow.Last().Bounds.ConvertToPolyline().GetTransformedCopy(mat);

            disp = Matrix3d.Displacement(TopRow.Last().Bounds.GetLowertHorizontalVector().Normalize().MultiplyBy(_firstColumnWidth - TopRow.Last().Bounds.GetLowertHorizontalVector().Length));
            ammountTopColumn.ReplaceVertexAt(2, ammountTopColumn.GetPoint3dAt(2).TransformBy(disp));
            ammountTopColumn.ReplaceVertexAt(3, ammountTopColumn.GetPoint3dAt(3).TransformBy(disp));

            Polyline ammountBottomColumn = (Polyline)BottomRow.Last().Bounds.ConvertToPolyline().GetTransformedCopy(mat);

            ammountBottomColumn.ReplaceVertexAt(2, ammountBottomColumn.GetPoint3dAt(2).TransformBy(disp));
            ammountBottomColumn.ReplaceVertexAt(3, ammountBottomColumn.GetPoint3dAt(3).TransformBy(disp));

            AmountTopRow.Add(new TableField(ammountTopColumn.ConvertToRectangle().Value, "", _tableTextHeight));
            AmountBottomRow.Add(new TableField(ammountBottomColumn.ConvertToRectangle().Value, "", _tableTextHeight));

            mat        = Matrix3d.Displacement(TopRow.Last().Bounds.GetLowertHorizontalVector().Negate().Normalize().MultiplyBy(_preOrPostColumnWidth));
            lowerRight = ammountBottomColumn.GetPoint3dAt(0);
            upperRight = ammountTopColumn.GetPoint3dAt(1);
            lowerLeft  = lowerRight.TransformBy(mat);
            upperLeft  = upperRight.TransformBy(mat);
            Rectangle3d ammountColumn = new Rectangle3d(upperLeft, upperRight, lowerLeft, lowerRight);

            AmountTopRow.Add(new TableField(ammountColumn, "Всего, м3", _tableTextHeight * 0.8, Math.PI / 2));
        }