Beispiel #1
0
        private void SelectInstruction(IInstruction op)
        {
            InstructionWidget widget = m_InstructionWidgets[op];

            m_SelectedOps.Add(widget);
            widget.Selected = true;
            widget.Refresh();
        }
Beispiel #2
0
        private void OnInstructionClick(InstructionWidget w, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (Form.ModifierKeys == Keys.Control)
                {
                    // ctrl+click: toggle state of one widget
                    w.Selected = !w.Selected;
                    w.Refresh();
                    if (w.Selected)
                    {
                        m_SelectedOps.Add(w);
                    }
                    else
                    {
                        m_SelectedOps.Remove(w);
                    }
                }
                else if (Form.ModifierKeys == Keys.Shift && m_LastClicked != null)
                {
                    // shift+click: select everything between last clicked widget
                    //  and current widget

                    int i     = m_InstructionIndexMap[m_LastClicked.Instruction];
                    int j     = m_InstructionIndexMap[w.Instruction];
                    int first = Math.Min(i, j);
                    int last  = Math.Max(i, j);
                    for (int x = first; x <= last; x++)
                    {
                        SelectInstruction(m_Ops[x]);
                    }
                }
                else
                {
                    // unmodified click.  Select only the clicked widget
                    ClearSelectedInstructions();
                    SelectInstruction(w.Instruction);
                }

                m_LastClicked = w;
            }
            else if (e.Button == MouseButtons.Right)
            {
                // de-select everything on a right click
                ClearSelectedInstructions();
            }
        }
Beispiel #3
0
        private void OnInstructionClick( InstructionWidget w, MouseEventArgs e )
        {
            if (e.Button == MouseButtons.Left)
            {
                if (Form.ModifierKeys == Keys.Control)
                {
                    // ctrl+click: toggle state of one widget
                    w.Selected = !w.Selected;
                    w.Refresh();
                    if (w.Selected)
                        m_SelectedOps.Add(w);
                    else
                        m_SelectedOps.Remove(w);
                }
                else if( Form.ModifierKeys == Keys.Shift && m_LastClicked != null )
                {
                    // shift+click: select everything between last clicked widget
                    //  and current widget

                    int i = m_InstructionIndexMap[m_LastClicked.Instruction];
                    int j = m_InstructionIndexMap[w.Instruction];
                    int first = Math.Min(i, j);
                    int last = Math.Max(i, j);
                    for (int x = first; x <= last; x++)
                        SelectInstruction(m_Ops[x]);
                }
                else
                {
                    // unmodified click.  Select only the clicked widget
                    ClearSelectedInstructions();
                    SelectInstruction(w.Instruction);
                }

                m_LastClicked = w;
            }
            else if (e.Button == MouseButtons.Right)
            {
                // de-select everything on a right click
                ClearSelectedInstructions();
            }
        }