예제 #1
0
        public void Paste()
        {
            if (!CanPaste)
            {
                return;
            }

            string content = PlatformExtensions.GetClipboardText();

            // Important: filter valid characters
            if (content != null)
            {
                content = new string (content.Where(IsInputChar).ToArray());
            }

            if (!String.IsNullOrEmpty(content))
            {
                SetUndoInsert(content);
                if (SelLength > 0)
                {
                    DeleteSelection();
                }
                SelLength = 0;
                RowManager.InsertRange(PlatformExtensions.GetClipboardText());
                EnsureCurrentRowVisible();
                ResetSelection();
                Modified = true;
                Invalidate();
            }
        }
예제 #2
0
 public void Copy()
 {
     if (!CanCopy)
     {
         return;
     }
     PlatformExtensions.SetClipboardText(SelectedText);
     Modified = true;
 }
예제 #3
0
 public void InitCopyButton()
 {
     CopyButton        = ImagePanelContainer.AddChild(new Button("copy", "Copy", (char)FontAwesomeIcons.fa_copy, ColorContexts.Default));
     CopyButton.Dock   = Docking.Bottom;
     CopyButton.Margin = new Padding(6, 0, 6, 6);
     CopyButton.Click += delegate {
         PlatformExtensions.SetClipboardText(Message);
     };
 }
예제 #4
0
        public void Copy()
        {
            if (!CanCopy)
            {
                return;
            }
            string content = RowManager.GetCharRange(SelStart, SelLength);

            PlatformExtensions.SetClipboardText(content);
            Modified = true;
        }
예제 #5
0
        // *** ISupportsClipboard Implementationn ***

        // ToDo:

        public void Cut()
        {
            if (!CanCut)
            {
                return;
            }
            this.SetUndoDelete(CursorPosition, 0);
            PlatformExtensions.SetClipboardText(SelectedText);
            Text = Text.Remove(SelStart, SelLength);
            ResetSelection();
            Modified = true;
            Invalidate();
        }
예제 #6
0
        // *** Clipboard ***

        public void Cut()
        {
            if (!CanCut)
            {
                return;
            }

            int pos = RowManager.AbsCursorPosition;

            this.SetUndoDelete(pos, 0);

            string content = RowManager.GetCharRange(SelStart, SelLength);

            DeleteSelection();
            PlatformExtensions.SetClipboardText(content);
            ResetSelection();
            Invalidate();
        }
예제 #7
0
        public void SetCursor(IGUIContext ctx, string name)
        {
            if (String.IsNullOrEmpty(name) || name == Cursors.Default.ToString())
            {
                ctx.GlWindow.Cursor = MouseCursor.Default;
            }
            else
            {
                MouseCursor cursor;
                if (DictCursors.TryGetValue(name, out cursor))
                {
                    ctx.GlWindow.Cursor = cursor;
                }
                else
                {
                    DictCursors.LogWarning("Cursor not found: {0}", name);
                }
            }

            // Workaround for Windows..
            PlatformExtensions.RefreshCursor();
        }
예제 #8
0
        public void Paste()
        {
            if (!CanPaste)
            {
                return;
            }
            string content = PlatformExtensions.GetClipboardText();

            // Important: filter valid characters
            if (content != null)
            {
                content = new string (content.Where(IsInputChar).ToArray());
            }

            if (!String.IsNullOrEmpty(content))
            {
                SetUndoInsert(content);
                if (SelLength > 0)
                {
                    DeleteSelection();
                }
                SelLength = 0;
                if (Text == null || (CursorPosition >= Text.Length))
                {
                    Text += content;
                }
                else
                {
                    Text = Text.Insert(CursorPosition.Clamp(0, Text.Length - 1), content);
                }

                CursorPosition += content.Length;
                ResetSelection();
                EnsureCursorVisible();
                Modified = true;
                Invalidate();
            }
        }