Ejemplo n.º 1
0
        /// <summary>
        /// Sets <c><see cref="_current"/></c> when a <c>RadioButton</c> fires
        /// <c>CheckedChanged</c>.
        /// </summary>
        /// <param name="sender">
        /// <list type="bullet">
        /// <item><c><see cref="rb_Clipboard"/></c></item>
        /// <item><c><see cref="rb_RowsBuffer"/></c></item>
        /// <item><c><see cref="rb_ColBuffer"/></c></item>
        /// <item><c><see cref="rb_CellsBuffer"/></c></item>
        /// </list></param>
        /// <param name="e"></param>
        void checkedchanged(object sender, EventArgs e)
        {
            if ((sender as RadioButton).Checked)
            {
                if (sender == rb_Clipboard)
                {
                    _current      = Current.Clipboard;
                    rtb_Clip.Text = ClipboardService.GetText();
                }
                else if (sender == rb_RowsBuffer)
                {
                    _current = Current.RowsBuffer;
                    SetRowsBufferText();
                }
                else if (sender == rb_ColBuffer)
                {
                    _current = Current.ColBuffer;
                    SetColBufferText();
                }
                else                 // sender == rb_CellsBuffer
                {
                    _current = Current.CellsBuffer;
                    SetCellsBufferText();
                }

                rtb_Clip.ReadOnly = sender != rb_Clipboard;

                bu_Get.Enabled     =
                    bu_Set.Enabled = sender == rb_Clipboard;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Handles <c>Click</c> on the Set button.
 /// </summary>
 /// <param name="sender"><c><see cref="bu_Set"/></c></param>
 /// <param name="e"></param>
 void click_Set(object sender, EventArgs e)
 {
     if (rb_Clipboard.Checked)
     {
         ClipboardService.SetText(rtb_Clip.Text.Replace("\n", Environment.NewLine));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Handles <c>Click</c> on the Get button.
 /// </summary>
 /// <param name="sender">
 /// <list type="bullet">
 /// <item><c><see cref="bu_Get"/></c></item>
 /// <item><c><see cref="Yata"/>.it_ClipExport</c></item>
 /// <item><c>null</c></item>
 /// </list></param>
 /// <param name="e"></param>
 /// <remarks>Invoked by
 /// <list type="bullet">
 /// <item>Get button</item>
 /// <item><c><see cref="Yata"/>.clipclick_ExportCopy()</c></item>
 /// <item><c><see cref="Infobox"/>.OnKeyDown()</c></item>
 /// </list></remarks>
 internal void click_Get(object sender, EventArgs e)
 {
     if (rb_Clipboard.Checked)
     {
         rtb_Clip.Text = ClipboardService.GetText();
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets the current Windows Clipboard text each time this
 /// <c>ClipboardEditor's</c> <c>Activated</c> event fires iff
 /// <c><see cref="rb_Clipboard"/></c> is currently checked.
 /// </summary>
 /// <param name="e"></param>
 protected override void OnActivated(EventArgs e)
 {
     if (_inited && rb_Clipboard.Checked)
     {
         rtb_Clip.Text = ClipboardService.GetText();
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Imports the current contents of the Windows clipboard to
        /// <c><see cref="_copyr"/></c> and enables
        /// <c><see cref="it_PasteRange"/></c> and
        /// <c><see cref="it_ClipExport"/></c>.
        /// </summary>
        /// <param name="sender"><c><see cref="it_ClipImport"/></c></param>
        /// <param name="e"></param>
        void clipclick_ImportCopy(object sender, EventArgs e)
        {
            _copyr.Clear();

            string clip = ClipboardService.GetText();

            if (clip.Length != 0)
            {
                string[] lines = clip.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                string   line;

                for (int i = 0; i != lines.Length; ++i)
                {
                    if ((line = lines[i].Trim()).Length != 0)
                    {
                        string[] fields = YataGrid.ParseTableRow(line);
                        _copyr.Add(fields);
                    }
                }

                if (_fclip != null)
                {
                    _fclip.SetRowsBufferText();
                }

                it_PasteRange.Enabled = Table != null && !Table.Readonly;
                it_ClipExport.Enabled = true;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Outputs the current contents of <c><see cref="_copyr"/></c> to the
        /// Windows clipboard.
        /// </summary>
        /// <param name="sender"><c><see cref="it_ClipExport"/></c></param>
        /// <param name="e"></param>
        void clipclick_ExportCopy(object sender, EventArgs e)
        {
            string clip = String.Empty;

            for (int i = 0; i != _copyr.Count; ++i)
            {
                for (int j = 0; j != _copyr[i].Length; ++j)
                {
                    if (j != 0)
                    {
                        clip += gs.Space;
                    }
                    clip += _copyr[i][j];
                }

                if (i != _copyr.Count - 1)
                {
                    clip += Environment.NewLine;
                }
            }
            ClipboardService.SetText(clip);

            if (_fclip != null)
            {
                _fclip.click_Get(sender, e);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Copies the text of <c><see cref="rt_Copyable"/></c> to the Windows
 /// Clipboard iff <c>rt_Copyable</c> is not focused.
 /// </summary>
 /// <param name="e"></param>
 /// <remarks>Requires <c>KeyPreview</c> <c>true</c>.</remarks>
 protected override void OnKeyDown(KeyEventArgs e)
 {
     if (e.KeyData == (Keys.Control | Keys.C) &&
         pa_Copyable != null &&
         !rt_Copyable.Focused)
     {
         e.SuppressKeyPress = true;
         ClipboardService.SetText(rt_Copyable.Text);
     }
     else
     {
         base.OnKeyDown(e);
     }
 }