コード例 #1
0
ファイル: Form_TextSamples.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_TextSamples ()
        {
            InitializeComponent ();
            mover = new Mover (this);

            string str = Auxi_Common .strElvishSong [0];
            for (int i = 1; i <= 15; i++)
            {
                if (i % 2 == 0)
                {
                    str += "\r\n";
                }
                str += Auxi_Common .strElvishSong [i];
            }
            textABC = new TextMR (this, new Point (60, ClientSize .Height / 2), strABC,
                                  new Font ("Microsoft Sans Serif", 22, FontStyle .Bold), Color .Magenta);
            textRhyme = new TextMR (this, new Point (360, ClientSize .Height / 3), str,
                                    new Font ("Times New Roman", 12, FontStyle .Italic), Color .DarkGreen);
            string strNames = Auxi_Common .strNames [0];
            for (int i = 1; i < 6; i++)
            {
                strNames += ", " + Auxi_Common .strNames [i];
            }
            textNames = new TextMR (this, new Point (300, 350), strNames, 12, Color .Blue);
            mover .Add (textABC);
            mover .Add (textRhyme);
            mover .Add (textNames);

            mover .Insert (0, btnCovers);
        }
コード例 #2
0
ファイル: Form_CircleInRotation.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_CircleInRotation ()
        {
            InitializeComponent ();
            mover = new Mover (this);

            circle = new NRCircle (Auxi_Geometry .LocationByCoefficients (ClientRectangle, 0.4, 0.4), ClientRectangle .Height / 3,
                                   new double [] { 3, 17, 8, 5, 12, 9, 2, 7, 11, 9 });
            mover .Add (circle);
            mover .Insert (0, btnCovers);

            info = new TextM (this, new Point (300, 360),
                              "Move by any inner point (L_Press)\nResize by any border point (L_Press)\nRotate by any inner point (R_Press)");
            mover .Add (info);
        }
コード例 #3
0
ファイル: Form_NNodeCovers.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_NNodeCovers ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            //Font = new Font ("TimeSpan New Roman", 14);

            circle = new NCircle (new Point (ClientSize .Width / 3, ClientSize .Height / 3), ClientSize .Height / 4, Color .Yellow);
            mover .Add (circle);
            ring = new NRing (new Point (ClientSize .Width * 2 / 3, ClientSize .Height * 2 / 3),
                              ClientSize .Height / 6, ClientSize .Height / 3, new double [] { 2, 3, 5, 7, 11 });
            mover .Add (ring);
            text = new TextMR (this, new Point (400, 30), "Move and resize objects, \r\nbut no rotation for them here");
            mover .Insert (0, text);
            mover .Insert (0, btnCovers);
        }
コード例 #4
0
ファイル: Form_Polyline.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_Polyline ()
        {
            InitializeComponent ();
            mover = new Mover (this);

            text = new TextMR (this, new Point (400, 80), info, Color .Green);  //new Font ("Times New Roman", 10), 
            center = new RotationCenter (Auxi_Geometry .Middle (ClientRectangle));
            Point [] pts = new Point [] { new Point (90, 70), new Point (190, 170), new Point (370, 20), 
                                          new Point (390, 370), new Point (80, 110), new Point (200, 320) };
            pline = new PolyLine (pts, new Pen (Color .Blue, 3), center .Point);

            mover .Add (center);
            mover .Add (pline);
            mover .Add (text);
            mover .Insert (0, btnCovers);
        }
コード例 #5
0
ファイル: Form_NodeShapes.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_NodeShapes ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            //Font = new Font ("Times New Roman", 14);

            circle = new PrimitiveCircle (new Point (150, 150), 100, Color .Blue);
            rect = new PrimitiveRectangle (new Rectangle (240, 110, 250, 140), Color .Green);
            strip = new PrimitiveStrip (new Point (100, 400), new Point (320, 300), 30, Color .Red);
            text = new TextMR (this, new Point (400, 400), strs);

            mover .Add (circle);
            mover .Add (rect);
            mover .Add (strip);
            mover .Insert (0, text);
            mover .Insert (0, btnCovers);
        }
コード例 #6
0
ファイル: Form_LinkedElements.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_LinkedElements ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            //Font = new Font ("Times New Roman", 14);

            rand = Auxi_Common .RandomByCurTime (out nSeed);
            spaces = new Spaces (Convert .ToInt32 (Auxi_Geometry .MeasureString (this, strChatPolyText [0]) .Height));

            // dfRegPoly
            string [] strs = new string [] { "Sides", "Color" };
            Size [] sizeStrs = Auxi_Geometry .RoundMeasureStrings (this, strs);
            CommentedControl ccSides = new CommentedControl (this, numericUD_RegSides, 4 + sizeStrs [0] .Width / 2, 0.5, strs [0]);
            CommentedControl ccColor = new CommentedControl (this, panelRegPolyClr, 4 + sizeStrs [1] .Width / 2, 0.5, strs [1]);
            List<ElementInsideDependentFrame> elems = new List<ElementInsideDependentFrame> ();
            elems .Add (new ElementInsideDependentFrame (ccSides));
            elems .Add (new ElementInsideDependentFrame (ccColor));
            elems .Add (new ElementInsideDependentFrame (new FramedControl (btnAddRegPoly)));
            dfRegPoly = new DependentFrame (this, elems, spaces, "Regular polygon");  

            // lrsCircle
            lrsCircle = new LinkedRectangles (new Control [] { btnCircleClr, panelCircleSample, btnAddCircle });
            sizeStrs = Auxi_Geometry .RoundMeasureStrings (this, strCircle);
            lrsCircle .Add (new Rectangle (btnCircleClr .Left, btnCircleClr .Top - (sizeStrs [0] .Height + 4),
                                           sizeStrs [0] .Width, sizeStrs [0] .Height), "Title");
            int cyT = (panelCircleSample .Top + panelCircleSample .Bottom) / 2 - sizeStrs [1] .Height / 2;
            lrsCircle .Add (new Rectangle (panelCircleSample .Right + 4, cyT, sizeStrs [1] .Width, sizeStrs [1] .Height), "ColorLabel");
            lrsCircle .Add (new Rectangle (panelCircleSample .Right, cyT, btnAddCircle .Right - panelCircleSample .Right, btnAddCircle .Top - cyT));

            InGroupRelativePosition ();
            Rectangle rc = Auxi_Geometry .FrameAroundControls (new Control [] {numericUD_ChatApexes, btnStartPolyClr, btnEndPolyClr, 
                                                                     btnChatPolyCenterClr, panelChatPolyCenterSample, btnAddChatPoly }, spaces);
            groupChatPoly = new Group (this, rc, strChatPolyText [0], MoveChatPolyGroup);

            mover .Insert (0, buttonCovers);
            dfRegPoly .IntoMover (mover, 0);
            mover .Insert (0, lrsCircle);
            mover .Insert (0, groupChatPoly);

            info = new TextM (this, new Point (210, 170),
                              "Different classes are used to add the new colored figures:\n" +
                              "   regular polygons are added via the DependentFrame class,\n" +
                              "   circles are added via the LinkedRectangles class,\n" +
                              "   chatoyant polygons are added via the Group class.\n" +
                              "All colored figures can be moved (L_Press inside) and\n" +
                              "resized (L_Press on border); chatoyant polygons can be also\n" +
                              "rotated (R_Press) and reconfigured (L_Press on apexes).\n" +
                              "L_Click any colored figure to popup it.", 
                              new Font ("Microsoft Sans Serif", 9));
            info .BackColor = Color .Yellow;
            mover .Add (info);

            iTopElemOrder = mover .Count;

            panelRegPolyClr .BackColor = clrNewRegPoly;
            panelCircleSample .BackColor = clrNewCircle;
            panelChatPolyCenterSample .BackColor = clrChatPolyCenter;
        }
コード例 #7
0
ファイル: Form_DorothyHouse.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_DorothyHouse ()
        {
            InitializeComponent ();
            //Font = new Font ("Microsoft Sans Serif", (float) 7.8);
            mover = new Mover (this);

            info = new TextMR (this, new Point (400, 40), "The house can be moved,\r\nresized, and rotated",
                                     new Font ("Times New Roman", 12, FontStyle .Bold | FontStyle .Italic), Color .Blue);
            mover .Add (info);

            house = new DorothyHouse (new Point (120, 200), 0, 80, 180, 90, 100);
            house .HouseColor = Color .Yellow;
            house .WindowColor = Color .Blue;
            house .RoofColor = Color .FromArgb (255, 128, 0);
            mover .Add (house);

            mover .Insert (0, buttonCovers);
        }
コード例 #8
0
ファイル: Form_Calculator.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_Calculator ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            mover .Clipping = Clipping .Safe;

            spaces = new Spaces (Auxi_Geometry .RoundMeasureString (this, "Text") .Height);
            DefaultView ();
            RestoreFromRegistry ();
            foreach (Control control in Controls)
            {
                mover .Add (control);
            }
            ClearValue ();
        }
コード例 #9
0
        /// <summary>
        /// Applies the LICM transformation to the given loop.
        /// </summary>
        /// <param name="builder">The parent method builder.</param>
        /// <param name="loop">The current loop.</param>
        /// <returns>True, if the transformation could be applied.</returns>
        private static bool ApplyLICM(Method.Builder builder, Loop loop)
        {
            // Initialize the current loop invariance cache
            var invariance = new LoopInvariance(loop);

            // Ensure that all blocks are in the correct order
            BasicBlockCollection <ReversePostOrder, Forwards> blocks =
                loop.ComputeOrderedBlocks(0);

            // Get the initial entry builder to move all values to
            var entry = loop.Entries[0];
            var mover = new Mover(blocks.Count);

            // Traverse all blocks in reverse post order to move all values without
            // violating any SSA properties
            foreach (var block in blocks)
            {
                if (block == entry)
                {
                    continue;
                }
                foreach (Value value in block)
                {
                    // Move out of the loop if this value is loop invariant
                    if (invariance.IsLoopInvariant(value))
                    {
                        mover.Add(value);
                    }
                }
            }

            // Move values
            var entryBuilder = builder[entry];

            foreach (var valueToMove in mover.ToMove)
            {
                // Check whether this value should be moved out of the current loop
                if (mover.ShouldBeMoved(valueToMove))
                {
                    entryBuilder.AddFromOtherBlock(valueToMove);
                }
            }

            return(mover.ToMove.Length > 0);
        }
コード例 #10
0
ファイル: Form_DataSelection.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_DataSelection ()
        {
            InitializeComponent ();
            mover = new Mover (this);

            sizeTitles = Auxi_Geometry .RoundMeasureStrings (this, titles);
            spaces = new Spaces (sizeTitles [0] .Height);

            Rectangle rc = Auxi_Geometry .FrameAroundControls (new Control [] { listYearsAll, btnSelect }, spaces);
            groupAll = new Group (this, rc, new RectRange (sizeTitles [0] .Width + 20, 180, 100, 500), titles [0], MoveAll);
            rc = Auxi_Geometry .FrameAroundControls (new Control [] { listYearsSelected, btnExclude }, spaces);
            groupSelected = new Group (this, rc, new RectRange (sizeTitles [1] .Width + 20, 180, 100, 500), titles [1], MoveSelected);
            RestoreFromRegistry ();

            mover .Add (groupAll);
            mover .Insert (0, groupSelected);
            mover .Insert (0, btnOK);

            for (int i = 1880; i <= DateTime .Now .Year; i++)
            {
                listYearsAll .Items .Add (i .ToString ());
            }
        }
コード例 #11
0
ファイル: Form_ManyMovers.cs プロジェクト: enildne/zest
        // -------------------------------------------------
        public Form_ManyMovers ()
        {
            InitializeComponent ();

            moverControls = new Mover (this);
            moverCircle = new Mover (this);
            moverSquare = new Mover (this);
            moverCirclesOnPanel = new Mover ();
            moverSquaresOnPanel = new Mover ();
            moverHouses = new Mover ();

            moverControls .Clear ();
            moverControls .Insert (0, panelCircles);    // , Resizing .NS
            moverControls .Insert (0, panelSquares);    // , Resizing .WE
            moverControls .Insert (0, panelHouses);     // , Resizing .Any
            moverControls .Insert (0, labelInfo);

            moverCircle .Clear ();
            moverSquare .Clear ();

            circles = new ColoredCircle [4] { new ColoredCircle (this, new Point (70, 60), false, size [0], clrs [0]), 
                                              new ColoredCircle (this, new Point (50, 80), false, size [1], clrs [1]), 
                                              new ColoredCircle (this, new Point (80, 110), false, size [2], clrs [2]), 
                                              new ColoredCircle (this, new Point (110, 130), false, size [3], clrs [3]) };
            foreach (ColoredCircle circle in circles)
            {
                moverCircle .Add (circle);
            }

            squares = new ColoredSquare [5] { new ColoredSquare (this, new Point (200, 50), size [0], clrs [0]),    
                                              new ColoredSquare (this, new Point (240, 70), size [1], clrs [1]),    
                                              new ColoredSquare (this, new Point (270, 90), size [2], clrs [2]),    
                                              new ColoredSquare (this, new Point (300, 120), size [3], clrs [3]),    
                                              new ColoredSquare (this, new Point (280, 150), size [4], clrs [4]) }; 
            foreach (ColoredSquare square in squares)
            {
                moverSquare .Add (square);
            }

            moverCirclesOnPanel .Clear ();
            circlesOnPanel = new ColoredCircle [4] {new ColoredCircle (this, new Point (30, 40), false, size [0], clrs [0]),       
                                                    new ColoredCircle (this, new Point (60, 65), false, size [1], clrs [1]),       
                                                    new ColoredCircle (this, new Point (90, 90), false, size [2], clrs [2]),       
                                                    new ColoredCircle (this, new Point (120, 115), false, size [3], clrs [3]) };   
            foreach (ColoredCircle circle in circlesOnPanel)
            {
                moverCirclesOnPanel .Add (circle);
            }

            moverSquaresOnPanel .Clear ();
            squaresOnPanel = new ColoredSquare [] { new ColoredSquare (this, new Point (30, 40), size [0], clrs [0]), 
                                                    new ColoredSquare (this, new Point (60, 65), size [1], clrs [1]),
                                                    new ColoredSquare (this, new Point (90, 90), size [2], clrs [2]) };
            foreach (ColoredSquare square in squaresOnPanel)
            {
                moverSquaresOnPanel .Add (square);
            }

            moverHouses .Clear ();
            Font fnt = new Font ("Times New Roman", 12, FontStyle .Bold | FontStyle .Italic);
            Rectangle rc = new Rectangle (30, 40, 80, 200);
            house4 = new SimpleHouse (4, fnt, 30, rc, new Point ((rc .Left + rc .Right) / 2, rc .Top - 30), Color .Yellow, Color .Brown);
            house4 .NumberColor = Color .White;
            
            rc = new Rectangle (160, 90, 110, 80);
            house17 = new SimpleHouse (17, fnt, 20, rc, new Point ((rc .Left + rc .Right) / 2, rc .Top - 70), Color .LightGreen, Color .Red);
            house17 .WindowColor = Color .Blue;
            moverHouses .Add (house4);
            moverHouses .Add (house17);

            //panelHouses .Set
        }