RedoInk() public method

public RedoInk ( ) : void
return void
示例#1
0
        private void tiSlide_Tick(object sender, EventArgs e)
        {
            // ignore the first tick
            if (LastTickTime.Year == 1987)
            {
                LastTickTime = DateTime.Now;
                return;
            }

            int aimedleft = gpButtonsLeft;

            if (ButtonsEntering == 0)
            {
                if (Root.Snapping > 0)
                {
                    aimedleft = gpButtonsLeft + gpButtonsWidth + 5;
                }
                else if (Root.Docked)
                {
                    aimedleft = gpButtonsLeft + gpButtonsWidth - btDock.Right;
                }
                else
                {
                    aimedleft = gpButtonsLeft;
                }
            }
            else if (ButtonsEntering == -1)
            {
                aimedleft = gpButtonsLeft + gpButtonsWidth;
            }

            if (gpButtons.Left > aimedleft)
            {
                float dleft = gpButtons.Left - aimedleft;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 230;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                gpButtons.Left -= (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left < aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                gpButtons.Width         = Math.Max(gpButtonsWidth - (gpButtons.Left - gpButtonsLeft), btDock.Width);
                Root.UponButtonsUpdate |= 0x1;
            }
            else if (gpButtons.Left < aimedleft)
            {
                float dleft = aimedleft - gpButtons.Left;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                // fast exiting when not docked
                if (ButtonsEntering == -1 && !Root.Docked)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 120;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                // fast exiting when docked
                if (ButtonsEntering == -1 && dleft == 1)
                {
                    dleft = 2;
                }
                gpButtons.Left += (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left > aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                gpButtons.Width         = Math.Max(gpButtonsWidth - (gpButtons.Left - gpButtonsLeft), btDock.Width);
                Root.UponButtonsUpdate |= 0x1;
            }

            if (ButtonsEntering == -1 && gpButtons.Left == aimedleft)
            {
                tiSlide.Enabled = false;
                Root.StopInk();
                return;
            }

            if (!Root.PointerMode && !this.TopMost)
            {
                ToTopMost();
            }

            // gpPenWidth status

            if (Root.gpPenWidthVisible != gpPenWidth.Visible)
            {
                gpPenWidth.Visible = Root.gpPenWidthVisible;
            }

            // hotkeys

            const int VK_LCONTROL = 0xA2;
            const int VK_RCONTROL = 0xA3;
            short     retVal;

            if (!Root.PointerMode)
            {
                // ESC key : Exit
                retVal = GetKeyState(27);
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastESCStatus & 0x8000) == 0x0000)
                    {
                        if (Root.Snapping > 0)
                        {
                            ExitSnapping();
                        }
                        else if (Root.gpPenWidthVisible)
                        {
                            Root.gpPenWidthVisible  = false;
                            Root.UponSubPanelUpdate = true;
                        }
                        else if (Root.Snapping == 0)
                        {
                            RetreatAndExit();
                        }
                    }
                }
                LastESCStatus = retVal;
            }


            if (!Root.FingerInAction && !Root.PointerMode && Root.Snapping <= 0)
            {
                // 0 ~ 9 : Pen0 ~ Pen9
                for (int p = 0; p < 10 && p < Root.MaxPenCount; p++)
                {
                    retVal = GetKeyState('0' + p);
                    if ((retVal & 0x8000) == 0x8000)
                    {
                        SelectPen(p);
                    }
                }

                // E : Eraser
                retVal = GetKeyState('E');
                if ((retVal & 0x8000) == 0x8000)
                {
                    SelectPen(-1);
                }

                // Ctrl + Z : Undo
                retVal = GetKeyState('Z');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastZStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            Root.UndoInk();
                        }
                    }
                }
                LastZStatus = retVal;

                // Ctrl + Y : Redo
                retVal = GetKeyState('Y');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastYStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            Root.RedoInk();
                        }
                    }
                }
                LastYStatus = retVal;

                // Ctrl + P : Pointer
                retVal = GetKeyState('P');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(-2);
                    }
                }

                // Ctrl + S : Snap
                retVal = GetKeyState('S');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        btSnap_Click(null, null);
                    }
                }

                // Ctrl + D : Clear
                retVal = GetKeyState('D');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastDStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            btClear_Click(null, null);
                        }
                    }
                }
                LastDStatus = retVal;
            }

            if (Root.Snapping < 0)
            {
                Root.Snapping++;
            }
        }
示例#2
0
        private void tiSlide_Tick(object sender, EventArgs e)
        {
            // ignore the first tick
            if (LastTickTime.Year == 1987)
            {
                LastTickTime = DateTime.Now;
                return;
            }

            int primwidth  = Screen.PrimaryScreen.WorkingArea.Width;
            int primheight = Screen.PrimaryScreen.WorkingArea.Height;
            int primright  = Screen.PrimaryScreen.WorkingArea.Right;
            int primbottom = Screen.PrimaryScreen.WorkingArea.Bottom;

            int aimedleft = gpButtonsLeft;

            if (ButtonsEntering == 0)
            {
                if (Root.Snapping > 0)
                {
                    aimedleft = gpButtonsLeft + gpButtons.Width + 5;
                }
                else if (Root.Docked)
                {
                    aimedleft = gpButtonsLeft + gpButtons.Width - btDock.Right;
                }
                else
                {
                    aimedleft = gpButtonsLeft;
                }
            }
            else if (ButtonsEntering == -1)
            {
                aimedleft = gpButtonsLeft + gpButtons.Width;
            }

            if (gpButtons.Left > aimedleft)
            {
                float dleft = gpButtons.Left - aimedleft;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 230;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                gpButtons.Left -= (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left < aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                Root.UponButtonsUpdate |= 0x1;
            }
            else if (gpButtons.Left < aimedleft)
            {
                float dleft = aimedleft - gpButtons.Left;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                // fast exiting when not docked
                if (ButtonsEntering == -1 && !Root.Docked)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 120;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                // fast exiting when docked
                if (ButtonsEntering == -1 && dleft == 1)
                {
                    dleft = 2;
                }
                gpButtons.Left += (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left > aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                Root.UponButtonsUpdate |= 0x1;
            }

            if (ButtonsEntering == -1 && gpButtons.Left == aimedleft)
            {
                tiSlide.Enabled = false;
                Root.StopInk();
                return;
            }

            if (!Root.PointerMode && !this.TopMost)
            {
                ToTopMost();
            }

            // hotkeys

            const int VK_LCONTROL = 0xA2;
            const int VK_RCONTROL = 0xA3;
            short     retVal;

            if (!Root.PointerMode)
            {
                // ESC key : Exit
                retVal = GetKeyState(27);
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastESCStatus & 0x8000) == 0x0000)
                    {
                        if (Root.Snapping > 0)
                        {
                            ExitSnapping();
                        }
                        else if (Root.Snapping == 0)
                        {
                            RetreatAndExit();
                        }
                    }
                }
                LastESCStatus = retVal;
            }

            if (!Root.FingerInAction)
            {
                // Ctrl + 1 : Pen 1
                retVal = GetKeyState('1');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(1);
                    }
                }

                // Ctrl + 2 : Pen 2
                retVal = GetKeyState('2');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(2);
                    }
                }

                // Ctrl + 3 : Pen 3
                retVal = GetKeyState('3');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(3);
                    }
                }

                // Ctrl + 4 : Pen 4
                retVal = GetKeyState('4');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(4);
                    }
                }

                // Ctrl + 5 : Pen 5
                retVal = GetKeyState('5');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(5);
                    }
                }

                // Ctrl + 0 : Eraser
                retVal = GetKeyState('0');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(0);
                    }
                }
            }

            if (!Root.FingerInAction && !Root.PointerMode && Root.Snapping <= 0)
            {
                // Ctrl + Z : Undo
                retVal = GetKeyState('Z');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastZStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            Root.UndoInk();
                        }
                    }
                }
                LastZStatus = retVal;

                // Ctrl + Y : Redo
                retVal = GetKeyState('Y');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastYStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            Root.RedoInk();
                        }
                    }
                }
                LastYStatus = retVal;

                // Ctrl + P : Pointer
                retVal = GetKeyState('P');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(-1);
                    }
                }

                // Ctrl + S : Snap
                retVal = GetKeyState('S');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        btSnap_Click(null, null);
                    }
                }

                // Ctrl + D : Clear
                retVal = GetKeyState('D');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastDStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            btClear_Click(null, null);
                        }
                    }
                }
                LastDStatus = retVal;
            }

            if (Root.Snapping < 0)
            {
                Root.Snapping++;
            }
        }