Example #1
0
        public void Draw(WidgetDrawArgs args)
        {
            if (args.Sample)
            {
                return;
            }
            if (_props.SourceMonitor <= 0)
            {
                return;
            }
            if (_props.DestinationMonitor <= 0)
            {
                return;
            }

            var screens = new ScreenList();

            if (_props.SourceMonitor > screens.Count)
            {
                return;
            }

            // Capture the source bitmap
            var srcScreen = screens[_props.SourceMonitor - 1];

            using (var srcBmp = new Bitmap(srcScreen.Bounds.Width, srcScreen.Bounds.Height))
                using (var g = Graphics.FromImage(srcBmp))
                {
                    g.CopyFromScreen(srcScreen.Bounds.Left, srcScreen.Bounds.Top, 0, 0, srcScreen.Bounds.Size);
                    args.Graphics.DrawImage(srcBmp, args.Bounds.Left, args.Bounds.Top, args.Bounds.Width, args.Bounds.Height);
                }
        }
        private void UpdateLayout()
        {
            var clientRect = ClientRectangle;

            clientRect.Inflate(-2, -2);
            if (clientRect.Width <= 0 || clientRect.Height <= 0)
            {
                return;
            }

            var screens = new ScreenList();

            var totalBounds = (RectangleF)GetTotalScreenArea(screens);

            if (totalBounds.Width <= 0 || totalBounds.Height <= 0)
            {
                return;
            }
            var scaledBounds = totalBounds.ScaleRectWidth(clientRect.Width);

            if (scaledBounds.Height > clientRect.Height)
            {
                scaledBounds = scaledBounds.ScaleRectHeight(clientRect.Height);
            }
            scaledBounds = scaledBounds.CenterInside(clientRect);

            _displayScale  = scaledBounds.Width / totalBounds.Width;
            _displayOffset = new PointF(scaledBounds.Left, scaledBounds.Top);

            foreach (var widget in _widgets)
            {
                widget.DesignBounds = ScreenToScaledClient(widget.Bounds);
            }
        }
Example #3
0
 protected override void OnInitialized()
 {
     Debuger.PrintLn("Initialising ScreenList");
     //just temp screnlist
     screenList       = ScreenListService.GetGilBTScreenList();
     lng.LangChanged += StateHasChanged;
 }
Example #4
0
            /// <summary>
            /// Returns a new ROM image containing the ROM resulting from the build process, or null if there are fatal errors.
            /// </summary>
            /// <returns></returns>
            public MetroidRom BuildRom()
            {
                if (_built)
                {
                    throw new InvalidOperationException("Can not call BuildRom more than once.");
                }
                _built = true;

                sourceRom.SerializeAllData();

                this.source = sourceRom.data;
                byte[] output = new byte[source.Length];

                Array.Copy(source, output, source.Length);
                this.outputRom  = new MetroidRom(new MemoryStream(output));
                this.screenList = new ScreenList(outputRom);

                CopyScreenASM();
                Assemble();

                if (FatalError)
                {
                    return(null);
                }
                return(outputRom);
            }
Example #5
0
 protected override void BuildScreenList()
 {
     screenList = new ScreenList(this, 0,
                                 new FalseFirstScreen(1),
                                 new ComputeScreen(1)
                                 );
 }
Example #6
0
    public override void OnFrame(Controller controller)
    {
        Frame currentFrame = controller.Frame();

        currentTime = currentFrame.Timestamp;
        changeTime  = currentTime - prevTime;
        if (changeTime > 5000)
        {
            Hand        hand          = currentFrame.Hands[0];
            FingerList  fingers       = hand.Fingers;
            Pointable   pointable     = currentFrame.Pointables[0];
            Leap.Screen screen        = controller.LocatedScreens.ClosestScreenHit(pointable);
            Frame       prevFrame     = controller.Frame(10);
            Hand        prevhand      = prevFrame.Hands[0];
            FingerList  prevfingers   = prevhand.Fingers;
            Pointable   prevpointable = prevFrame.Pointables[0];
            ScreenList  screenList    = controller.LocatedScreens;
            Leap.Screen prevscreen    = screenList.ClosestScreenHit(prevpointable);

            if (!fingers.IsEmpty)
            {
                float prevwidth  = prevscreen.Intersect(prevpointable, true, 1.0F).x *prevscreen.WidthPixels;
                float prevheight = prevscreen.Intersect(prevpointable, true, 1.0F).y *prevscreen.HeightPixels;
                float width      = screen.Intersect(pointable, true, 1.0F).x *screen.WidthPixels;
                float height     = screen.Intersect(pointable, true, 1.0F).y *screen.HeightPixels;
                float tranX      = currentFrame.Translation(prevFrame).x;
                float tranY      = currentFrame.Translation(prevFrame).y;
                int   fwidth     = (int)((width * 0.2) + (prevwidth * (1.0 - 0.2)));
                int   fheight    = (int)((height * 0.2) + (prevheight * (1.0 - 0.2)));
                fheight = screen.HeightPixels - fheight;
                if (fingers.Count == 2 || fingers.Count == 3)
                {
                    if (changeTime > 5000)
                    {
                        if (fingers.Count == 2)
                        {
                            mouse_event(0x0002 | 0x0004, 0, fwidth, fheight, 0);
                        }
                        else
                        {
                            mouse_event(0x0008 | 0x0010, 0, fwidth, fheight, 0);
                        }

                        Console.Write("Clicked At " + fwidth + " " + fheight);
                    }
                }
                else
                {
                    if (fingers.Count == 1)
                    {
                        Console.Write("TipPosition: " + fingers[0].TipPosition + " Width: " + width + " height: " + height + " tranX: " + tranX + " tranY: " + tranY + "\n");
                        SetCursorPos(fwidth, fheight);
                    }
                }
            }
            prevTime = currentTime;
        }
    }
Example #7
0
        protected async override Task OnInitializedAsync()
        {
            Debuger.PrintLn("async Initialising ScreenList");
            screenList = await ScreenListService.GetGilBTScreenListAsync();
            await fillScreenListWithComunes(screenList);

            listaDoWyswietlania = screenList.Screens;
            user = await GetLoggedUser();
        }
Example #8
0
        public Rectangle GetPreferredBounds(ScreenList screens)
        {
            var mon = _props.DestinationMonitor;

            if (mon > 0 && (mon - 1) < screens.Count)
            {
                return(screens[mon - 1].Bounds);
            }

            return(screens.Last().Bounds);
        }
Example #9
0
 public void AddScreen(Screen screen)
 {
     if (CurrentIndex < ScreenList.Count - 1 && !CompareScreen(screen, ScreenList[CurrentIndex + 1]) &&
         ScreenList.Count - (CurrentIndex + 1) > 0)
     {
         ScreenList.RemoveRange(CurrentIndex + 1, ScreenList.Count - (CurrentIndex + 1));
     }
     ScreenList.Add(screen);
     CurrentIndex++;
     UpdateNavigationButton();
 }
Example #10
0
        public void OnBoundsChanged(WidgetBoundsChangedArgs args)
        {
            if (!args.Final)
            {
                return;
            }

            var screens = new ScreenList();

            if (_props.DestinationMonitor > screens.Count)
            {
                return;
            }
            args.Bounds = screens[_props.DestinationMonitor - 1].Bounds;
        }
        private RectangleF GetTotalScreenArea(ScreenList screens)
        {
            float width = 0.0f, height = 0.0f;

            foreach (var screen in screens)
            {
                if ((float)screen.Bounds.Right > width)
                {
                    width = (float)screen.Bounds.Right;
                }
                if ((float)screen.Bounds.Bottom > height)
                {
                    height = (float)screen.Bounds.Bottom;
                }
            }
            return(new RectangleF(0.0f, 0.0f, width, height));
        }
Example #12
0
        async Task <ScreenList> fillScreenListWithComunes(ScreenList sl)
        {
            List <Gmina> listaWszystkichGminEver = await gs.GetGminaListAsync();

            foreach (Screen s in sl.Screens)
            {
                if (s.IdGminy != 0)
                {
                    Gmina gm = listaWszystkichGminEver.FirstOrDefault(x => x.Id == s.IdGminy);
                    if (gm != null)
                    {
                        s.gmina = gm;
                    }
                }
            }
            return(sl);
        }
        private void WidgetLayoutControl_Paint(object sender, PaintEventArgs e)
        {
            try
            {
                var g = e.Graphics;
                g.FillRectangle(SystemBrushes.Window, e.ClipRectangle);

                var matrix = new System.Drawing.Drawing2D.Matrix();
                matrix.Translate(_displayOffset.X, _displayOffset.Y);
                matrix.Scale(_displayScale, _displayScale);
                g.Transform = matrix;

                var screenList = new ScreenList();

                foreach (var screen in screenList)
                {
                    using (var brush = GraphicsUtil.CreateRadialGradientBrush(screen.Bounds, Color.Blue, Color.Navy))
                    {
                        g.FillRectangle(brush, screen.Bounds);
                    }
                }

                foreach (var widget in _widgets)
                {
                    var args = new WidgetDrawArgs(widget.Config, widget.Bounds, g, null, true);
                    g.SetClip(widget.Bounds);
                    widget.Draw(args);
                    g.ResetClip();
                }

                foreach (var screen in screenList)
                {
                    g.DrawRectangle(SystemPens.ControlDarkDark, screen.Bounds);
                }

                g.Transform = new System.Drawing.Drawing2D.Matrix();
                DrawSelectedWidgetBorder(g);
            }
            catch (Exception ex)
            {
                this.ShowError(ex);
            }
        }
Example #14
0
        static public void CopyDataToDb()
        {
            IScreenListService sls = new ScreenListMySQLService(new SqlDataAccess(null));
            //ekrany
            List <Screen> ss = ScreenList.Load();

            foreach (Screen argScreen in ss)
            {
                Debuger.PrintLn("Posting Screen {0}.", argScreen.uid);
                if (argScreen != null)
                {
                    Screen temp = sls.GetGilBTScreenAsync(argScreen.uid).Result;
                    if (temp != null)
                    {
                        Debuger.PrintLn("Already exists Uid {0}.", argScreen.uid);
                    }
                    else
                    {
                        Debuger.PrintLn("Adding screen Uid {0}.", argScreen.uid);
                        argScreen.from_led_screen = true;
                        sls.PostScreenAsync(argScreen);
                    }
                }
                else
                {
                }
            }
            //usery
            WebServiceGilBT.Services.UserMySQLService uls = new WebServiceGilBT.Services.UserMySQLService(new SqlDataAccess(null));
            foreach (WebServiceGilBT.Data.User user in UserList.users)
            {
                Console.WriteLine("adding: " + user.EmailAddress);
                if (user != null)
                {
                    WebServiceGilBT.Data.User userindb = uls.GetUserAsync(user.UserId).Result;
                    if (userindb == null)
                    {
                        uls.AddUserAsync(user).Wait();
                    }
                }
            }
        }
Example #15
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="assembledBytes"></param>
            /// <param name="patchSegments"></param>
            /// <param name="writeToImage">If true, all assembled code will be written onto the ROM image. Otherwise, ROM objects such as screen-load code will still be updated, but miscelaneous code will not be applied.</param>
            private void ApplyPatches(byte[] assembledBytes, IList <Romulus.PatchSegment> patchSegments, bool writeToImage)
            {
                for (int i = 0; i < patchSegments.Count; i++)
                {
                    var seg = patchSegments[i];
                    if (seg.PatchOffset == GeneralPatchID)
                    {
                        if (writeToImage)
                        {
                            ApplyGeneralPatch(assembledBytes, seg);
                        }
                        else
                        {
                            generalCodeFileBase = (int)this.sourceRom.Format.GeneralAsmInsertionAddress - seg.Length;
                        }
                        _generalCodeAssembledSize = seg.Length;
                    }
                    else if (ScreenList.IsScreenPatch(seg))
                    {
                        var screenEntry = screenList.GetAssociatedItem(seg);

                        var extraBytes = ((IProjectBuildScreen)screenEntry.Screen);
                        extraBytes.ExtraBytes       = assembledBytes;
                        extraBytes.ExtraBytesStart  = seg.Start;
                        extraBytes.ExtraBytesLength = seg.Length;
                    }
                    else
                    {
                        // Main file and misc patches
                        if (writeToImage)
                        {
                            if (seg.PatchOffset < 0 || seg.PatchOffset + seg.Length > outputRom.data.Length)
                            {
                                _Errors.Add(new BuildError("", 0, "Patch at offset $" + seg.PatchOffset.ToString("X") + " exceeded the ROM bounds."));
                                FatalError = true;
                                return;
                            }
                            Array.Copy(assembledBytes, seg.Start, outputRom.data, seg.PatchOffset, seg.Length);
                        }
                    }
                }
            }
Example #16
0
        protected async override Task OnInitializedAsync()
        {
            user = await GetLoggedUser();

            screenList = await ScreenListService.GetGilBTScreenListAsync();

            foreach (Screen s in screenList.Screens)
            {
                if (s.uid == Uid)
                {
                    Screen = s;
                }
            }
            if (Screen == null)
            {
                Screen              = new Screen();
                Screen.uid          = Uid;
                Screen.firmware_ver = "NULL";
                Screen.name         = "NULL";
                Screen.screen_type  = eScreenType.unknown;
            }
            lng.LangChanged += StateHasChanged;
        }
Example #17
0
        public bool ChangeBoundsSafe(Rectangle newBounds, bool dragFinished)
        {
            var screens = new ScreenList();

            if (newBounds.Width <= 0 || newBounds.Height <= 0)
            {
                return(false);
            }

            var envelope = screens.Select(s => s.Bounds).ToArray().GetEnvelope();

            if (!envelope.Contains(newBounds.TopLeft()) && !envelope.Contains(newBounds.TopRight()) &&
                !envelope.Contains(newBounds.BottomLeft()) && !envelope.Contains(newBounds.BottomRight()))
            {
                return(false);
            }

            var args = new WidgetBoundsChangedArgs(_config, newBounds, _bounds, new ScreenList(), dragFinished);

            _widget.OnBoundsChanged(args);

            _bounds = args.Bounds;
            return(true);
        }
Example #18
0
        public Rectangle GetPreferredBounds(ScreenList screens)
        {
            var prim = screens.Primary.Bounds;

            return(new Rectangle((prim.Width - k_defaultWidth) / 2 + prim.Left, (prim.Height - k_defaultHeight) / 2 + prim.Top, k_defaultWidth, k_defaultHeight));
        }
 public void Awake()
 {
     instance = this;
 }
Example #20
0
        public IQueryable <Screen> GetScreenList()
        {
            ScreenList screenList = sls.GetGilBTScreenListAsync().Result;

            return(screenList.Screens.AsQueryable());
        }
 public void Awake()
 {
     instance = this;
 }
Example #22
0
 public Rectangle GetPreferredBounds(ScreenList screens)
 {
     return(screens.Last().Bounds);
 }
Example #23
0
        public override void OnFrame(Controller controller)
        {
            //get screens
            screens = controller.CalibratedScreens;

            //calculate fps
            double fps = 1.0 * Stopwatch.Frequency / (stopWatch.ElapsedTicks - lasttime);

            lasttime = stopWatch.ElapsedTicks;

            timeaccum += 1.0 / fps;
            framesaccum++;
            if (timeaccum >= 0.5)
            {
                UpdateText(form.fps_label, "fps: " + Convert.ToString((int)(1.0 * framesaccum / timeaccum)));
                timeaccum  -= 0.5;
                framesaccum = 0;
            }

            bool  wasd = false;
            float scale, yoffset, ws, ad;
            bool  intersect;

            lock (thisLock) //get access to input data
            {
                scale     = (float)form.sens;
                yoffset   = (float)form.yoffset;
                ws        = (float)form.wsval;
                ad        = (float)form.adval;
                intersect = form.intersect;
                wasd      = form.wasd_check.Checked;
            }

            //move phase for keyboard simulation
            phase += par / fps * freq;
            if (phase > 1)
            {
                par   = -1;
                phase = 1;
            }
            if (phase < 0)
            {
                par   = 1;
                phase = 0;
            }

            Pointable point1    = null;
            bool      point1_ok = false;

            // Get the most recent frame
            Frame frame = controller.Frame();

            if (!frame.Tools.Empty)
            {
                //get the nearest tool
                int      nearest    = 0;
                double   nearestval = double.MaxValue;
                ToolList tools      = frame.Tools;
                for (int i = 0; i < tools.Count(); i++)
                {
                    if (tools[i].TipPosition.z < nearestval)
                    {
                        nearest    = i;
                        nearestval = tools[i].TipPosition.z;
                    }
                }
                point1    = tools[nearest];
                point1_ok = true;
            }
            else if (!frame.Hands.Empty)
            {
                // Get the first hand
                Hand hand = frame.Hands[0];

                // Check if the hand has any fingers
                FingerList fingers = hand.Fingers;
                if (!fingers.Empty)
                {
                    //get the finger closest to the screen (smallest z)
                    int    nearest    = 0;
                    double nearestval = double.MaxValue;
                    for (int i = 0; i < fingers.Count(); i++)
                    {
                        if (fingers[i].TipPosition.z < nearestval)
                        {
                            nearest    = i;
                            nearestval = fingers[i].TipPosition.z;
                        }
                    }
                    point1    = fingers[nearest];
                    point1_ok = true;
                }
            }

            if (point1_ok) //there is finger or tool
            {
                PointConverter pc = new PointConverter();
                Point          pt = new Point();

                //wasd not checked
                if (!wasd)
                {
                    //interset/project on screen
                    Vector intersection;
                    if (intersect)
                    {
                        intersection = screens[0].Intersect(point1, true, 4.0f / scale);
                    }
                    else
                    {
                        intersection = screens[0].Project(point1.TipPosition, true, 4.0f / scale);
                    }

                    //scale and offset screen position
                    double scx = (intersection.x - 0.5) * scale + 0.5;
                    double scy = (1 - intersection.y - 0.5) * scale + 0.5 + yoffset;
                    pt.X = (int)(scx * screens[0].WidthPixels);
                    pt.Y = (int)(scy * screens[0].HeightPixels);

                    Cursor.Position = pt;
                }
                //if wasd is checked
                else
                {
                    string str = "";

                    float x = point1.TipPosition.x;
                    float y = point1.TipPosition.y;
                    float z = point1.TipPosition.z;

                    var  hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
                    Hand hand = frame.Hands[0];

                    double xph = -hand.PalmNormal.Roll * ad * 8;                                    //steering using roll
                    double zph = (Math.Abs(hand.PalmPosition.z - 100) - ws * 200.0) / (200.0 * ws); //acceleration using z

                    //stroke or release given keys

                    if (xph > 0 && Math.Abs(xph) > phase)
                    {
                        str += "D";
                        if (!pD || Math.Abs(xph) > 1)
                        {
                            Stroke(0x20);
                        }
                        pD = true;
                    }
                    else
                    {
                        if (pD)
                        {
                            Release(0x20);
                        }
                        pD = false;
                    }
                    if (xph < 0 && Math.Abs(xph) > phase)
                    {
                        str += "A";
                        if (!pA || Math.Abs(xph) > 1)
                        {
                            Stroke(0x1E);
                        }
                        pA = true;
                    }
                    else
                    {
                        if (pA)
                        {
                            Release(0x1E);
                        }
                        pA = false;
                    }

                    if (z > 0 && zph > phase)
                    {
                        str += "S";
                        if (!pS || zph > 1)
                        {
                            Stroke(0x1F);
                        }
                        pS = true;
                    }
                    else
                    {
                        if (pS)
                        {
                            Release(0x1F);
                        }
                        pS = false;
                    }
                    if (z < 0 && zph > phase)
                    {
                        str += "W";
                        if (!pW || zph > 1)
                        {
                            Stroke(0x11);
                        }
                        pW = true;
                    }
                    else
                    {
                        if (pW)
                        {
                            Release(0x11);
                        }
                        pW = false;
                    }

                    UpdateText(form.debug_label, Convert.ToString(str));
                }
            }
            else
            {
                if (pW)
                {
                    Release(0x11);
                }
                if (pA)
                {
                    Release(0x1E);
                }
                if (pS)
                {
                    Release(0x1F);
                }
                if (pD)
                {
                    Release(0x20);
                }
                pW = false;
                pA = false;
                pS = false;
                pD = false;
            }
        }
Example #24
0
        public Rectangle GetPreferredBounds(ScreenList screens)
        {
            var rect = screens.Primary.Bounds;

            return(new Rectangle(rect.Right - 600, 100, 500, 500));
        }
Example #25
0
        public override void OnFrame(Controller controller)
        {
            //get screens
            screens = controller.CalibratedScreens;

            //calculate fps
            double fps = 1.0 * Stopwatch.Frequency / (stopWatch.ElapsedTicks - lasttime);
            lasttime = stopWatch.ElapsedTicks;

            timeaccum += 1.0 / fps;
            framesaccum++;
            if (timeaccum >= 0.5)
            {
                UpdateText(form.fps_label, "fps: " + Convert.ToString((int)(1.0 * framesaccum / timeaccum)));
                timeaccum -= 0.5;
                framesaccum = 0;
            }

            bool wasd = false;
            float scale, yoffset,ws,ad;
            bool intersect;
            lock (thisLock) //get access to input data
            {
                scale = (float)form.sens;
                yoffset = (float)form.yoffset;
                ws = (float)form.wsval;
                ad = (float)form.adval;
                intersect = form.intersect;
                wasd = form.wasd_check.Checked;
            }

            //move phase for keyboard simulation
            phase += par / fps * freq;
            if (phase > 1)
            {
                par = -1;
                phase = 1;
            }
            if (phase < 0)
            {
                par = 1;
                phase = 0;
            }

            Pointable point1 = null;
            bool point1_ok = false;

            // Get the most recent frame
            Frame frame = controller.Frame();

            if (!frame.Tools.Empty)
            {
                //get the nearest tool
                int nearest = 0;
                double nearestval = double.MaxValue;
                ToolList tools = frame.Tools;
                for (int i = 0; i < tools.Count(); i++)
                {
                    if (tools[i].TipPosition.z < nearestval)
                    {
                        nearest = i;
                        nearestval = tools[i].TipPosition.z;
                    }
                }
                point1 = tools[nearest];
                point1_ok = true;
            }
            else if (!frame.Hands.Empty)
            {
                // Get the first hand
                Hand hand = frame.Hands[0];

                // Check if the hand has any fingers
                FingerList fingers = hand.Fingers;
                if (!fingers.Empty)
                {

                    //get the finger closest to the screen (smallest z)
                    int nearest = 0;
                    double nearestval = double.MaxValue;
                    for (int i = 0; i < fingers.Count(); i++)
                    {
                        if (fingers[i].TipPosition.z < nearestval)
                        {
                            nearest = i;
                            nearestval = fingers[i].TipPosition.z;
                        }
                    }
                    point1 = fingers[nearest];
                    point1_ok = true;

                }

            }

            if (point1_ok) //there is finger or tool
            {
                PointConverter pc = new PointConverter();
                Point pt = new Point();

                //wasd not checked
                if (!wasd)
                {
                    //interset/project on screen
                    Vector intersection;
                    if (intersect)
                        intersection = screens[0].Intersect(point1, true, 4.0f / scale);
                    else
                        intersection = screens[0].Project(point1.TipPosition, true, 4.0f / scale);

                    //scale and offset screen position
                    double scx = (intersection.x - 0.5) * scale + 0.5;
                    double scy = (1 - intersection.y - 0.5) * scale + 0.5 + yoffset;
                    pt.X = (int)(scx * screens[0].WidthPixels);
                    pt.Y = (int)(scy * screens[0].HeightPixels);

                    Cursor.Position = pt;
                }
                //if wasd is checked
                else
                {
                    string str = "";

                    float x = point1.TipPosition.x;
                    float y = point1.TipPosition.y;
                    float z = point1.TipPosition.z;

                    var hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
                    Hand hand = frame.Hands[0];

                    double xph = -hand.PalmNormal.Roll*ad*8; //steering using roll
                    double zph = (Math.Abs(hand.PalmPosition.z-100) - ws * 200.0) / (200.0 * ws); //acceleration using z

                    //stroke or release given keys

                    if (xph > 0 && Math.Abs(xph) > phase)
                    {
                        str += "D";
                        if (!pD || Math.Abs(xph) > 1)
                            Stroke(0x20);
                        pD = true;
                    }
                    else
                    {
                        if (pD)
                            Release(0x20);
                        pD = false;
                    }
                    if (xph < 0 && Math.Abs(xph) > phase)
                    {
                        str += "A";
                        if (!pA || Math.Abs(xph) > 1)
                            Stroke(0x1E);
                        pA = true;
                    }
                    else
                    {
                        if (pA)
                            Release(0x1E);
                        pA = false;
                    }

                    if (z > 0 && zph > phase)
                    {
                        str += "S";
                        if (!pS || zph > 1)
                            Stroke(0x1F);
                        pS = true;
                    }
                    else
                    {
                        if (pS)
                            Release(0x1F);
                        pS = false;
                    }
                    if (z < 0 && zph > phase)
                    {
                        str += "W";
                        if (!pW || zph > 1)
                            Stroke(0x11);
                        pW = true;
                    }
                    else
                    {
                        if (pW)
                            Release(0x11);
                        pW = false;
                    }

                    UpdateText(form.debug_label, Convert.ToString(str));
                }
            }
            else
            {
                if (pW)
                    Release(0x11);
                if (pA)
                    Release(0x1E);
                if (pS)
                    Release(0x1F);
                if (pD)
                    Release(0x20);
                pW = false;
                pA = false;
                pS = false;
                pD = false;
            }
        }