示例#1
0
 private void ログをクリップボードにコピーToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         var dialog = new ClipBoardDialog();
         dialog.Setup(this, console);
         dialog.ShowDialog();
     }
     catch (Exception)
     {
         MessageBox.Show("予期せぬエラーが発生したためクリップボードを開けません");
     }
 }
示例#2
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     //1823 INPUTMOUSEKEY Key入力全てを捕まえてERB側で処理する
     //if (console != null && console.IsWaitingPrimitiveKey)
     if (console != null && console.IsWaitingPrimitive)
     {
         return(false);
     }
     if ((keyData & Keys.KeyCode) == Keys.B && ((keyData & Keys.Modifiers) & Keys.Control) == Keys.Control)
     {
         if (WindowState != FormWindowState.Minimized)
         {
             WindowState = FormWindowState.Minimized;
             return(true);
         }
     }
     else if (((keyData & Keys.KeyCode) == Keys.C && ((keyData & Keys.Modifiers) & Keys.Control) == Keys.Control) || (keyData & Keys.KeyCode) == Keys.Insert && ((keyData & Keys.Modifiers) & Keys.Control) == Keys.Control)
     {
         if (this.richTextBox1.SelectedText == "")
         {
             ClipBoardDialog dialog = new ClipBoardDialog();
             dialog.StartPosition = FormStartPosition.CenterParent;
             dialog.Setup(this, console);
             dialog.ShowDialog();
             return(true);
         }
     }
     else if (((keyData & Keys.KeyCode) == Keys.V && ((keyData & Keys.Modifiers) & Keys.Control) == Keys.Control) || (keyData & Keys.KeyCode) == Keys.Insert && ((keyData & Keys.Modifiers) & Keys.Shift) == Keys.Shift)
     {
         if (Clipboard.GetDataObject() == null || !Clipboard.ContainsText())
         {
             return(true);
         }
         else
         {
             if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true)
             {
                 richTextBox1.Paste(DataFormats.GetFormat(DataFormats.UnicodeText));
             }
             return(true);
         }
     }
     //else if (((int)keyData == (int)Keys.Control + (int)Keys.D) && Program.DebugMode)
     //{
     //    console.OpenDebugDialog();
     //    return true;
     //}
     //else if (((int)keyData == (int)Keys.Control + (int)Keys.R) && Program.DebugMode)
     //{
     //    if ((console.DebugDialog != null) && (console.DebugDialog.Created))
     //        console.DebugDialog.UpdateData();
     //}
     else if (Config.UseKeyMacro)
     {
         int  keyCode      = (int)(keyData & Keys.KeyCode);
         bool shiftPressed = (keyData & Keys.Modifiers) == Keys.Shift;
         bool ctrlPressed  = (keyData & Keys.Modifiers) == Keys.Control;
         bool unPressed    = (int)(keyData & Keys.Modifiers) == 0;
         if (keyCode >= (int)Keys.F1 && keyCode <= (int)Keys.F12)
         {
             int macroNum = keyCode - (int)Keys.F1;
             if (shiftPressed)
             {
                 if (this.richTextBox1.Text != "")
                 {
                     KeyMacro.SetMacro(macroNum, macroGroup, this.richTextBox1.Text);
                 }
                 return(true);
             }
             else if (unPressed)
             {
                 this.richTextBox1.Text           = KeyMacro.GetMacro(macroNum, macroGroup);
                 this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
                 return(true);
             }
         }
         else if (ctrlPressed)
         {
             int newGroupNum = -1;
             if (keyCode >= (int)Keys.D0 && keyCode <= (int)Keys.D9)
             {
                 newGroupNum = keyCode - (int)Keys.D0;
             }
             else if (keyCode >= (int)Keys.NumPad0 && keyCode <= (int)Keys.NumPad9)
             {
                 newGroupNum = keyCode - (int)Keys.NumPad0;
             }
             if (newGroupNum >= 0)
             {
                 setNewMacroGroup(newGroupNum);
             }
         }
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }
示例#3
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if ((keyData & Keys.KeyCode) == Keys.B && (keyData & Keys.Modifiers & Keys.Control) == Keys.Control)
     {
         if (WindowState != FormWindowState.Minimized)
         {
             WindowState = FormWindowState.Minimized;
             return(true);
         }
     }
     else if ((keyData & Keys.KeyCode) == Keys.C && (keyData & Keys.Modifiers & Keys.Control) == Keys.Control ||
              (keyData & Keys.KeyCode) == Keys.Insert &&
              (keyData & Keys.Modifiers & Keys.Control) == Keys.Control)
     {
         if (TextBox.SelectedText == "")
         {
             var dialog = new ClipBoardDialog();
             dialog.StartPosition = FormStartPosition.CenterParent;
             dialog.Setup(this, console);
             dialog.ShowDialog();
             return(true);
         }
     }
     else if ((keyData & Keys.KeyCode) == Keys.V && (keyData & Keys.Modifiers & Keys.Control) == Keys.Control ||
              (keyData & Keys.KeyCode) == Keys.Insert && (keyData & Keys.Modifiers & Keys.Shift) == Keys.Shift)
     {
         if (Clipboard.GetDataObject() == null || !Clipboard.ContainsText())
         {
             return(true);
         }
         if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))
         {
             TextBox.Paste(DataFormats.GetFormat(DataFormats.UnicodeText));
         }
         return(true);
     }
     //else if (((int)keyData == (int)Keys.Control + (int)Keys.D) && Program.DebugMode)
     //{
     //    console.OpenDebugDialog();
     //    return true;
     //}
     //else if (((int)keyData == (int)Keys.Control + (int)Keys.R) && Program.DebugMode)
     //{
     //    if ((console.DebugDialog != null) && (console.DebugDialog.Created))
     //        console.DebugDialog.UpdateData();
     //}
     else if (Config.UseKeyMacro)
     {
         var keyCode      = (int)(keyData & Keys.KeyCode);
         var shiftPressed = (keyData & Keys.Modifiers) == Keys.Shift;
         var ctrlPressed  = (keyData & Keys.Modifiers) == Keys.Control;
         var unPressed    = (int)(keyData & Keys.Modifiers) == 0;
         if (keyCode >= (int)Keys.F1 && keyCode <= (int)Keys.F12)
         {
             var macroNum = keyCode - (int)Keys.F1;
             if (shiftPressed)
             {
                 if (TextBox.Text != "")
                 {
                     KeyMacro.SetMacro(macroNum, macroGroup, TextBox.Text);
                 }
                 return(true);
             }
             if (unPressed)
             {
                 TextBox.Text           = KeyMacro.GetMacro(macroNum, macroGroup);
                 TextBox.SelectionStart = TextBox.Text.Length;
                 return(true);
             }
         }
         else if (ctrlPressed)
         {
             var newGroupNum = -1;
             if (keyCode >= (int)Keys.D0 && keyCode <= (int)Keys.D9)
             {
                 newGroupNum = keyCode - (int)Keys.D0;
             }
             else if (keyCode >= (int)Keys.NumPad0 && keyCode <= (int)Keys.NumPad9)
             {
                 newGroupNum = keyCode - (int)Keys.NumPad0;
             }
             if (newGroupNum >= 0)
             {
                 setNewMacroGroup(newGroupNum);
             }
         }
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }