void ScreenSetTime::MenuUp( const InputEventPlus &input )
{
	ChangeSelection( -1 );
}
void ScreenSetTime::MenuDown( const InputEventPlus &input )
{
	ChangeSelection( +1 );
}
示例#3
0
// If an arrow key is pressed, then move the selection
void CColorPopup::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
    int row = GetRow(m_nCurrentSel),
        col = GetColumn(m_nCurrentSel);

    if (nChar == VK_DOWN) 
    {
        if (row == DEFAULT_BOX_VALUE) 
            row = col = 0; 
        else if (row == CUSTOM_BOX_VALUE)
        {
            if (m_strDefaultText.GetLength())
                row = col = DEFAULT_BOX_VALUE;
            else
                row = col = 0;
        }
        else
        {
            row++;
            if (GetIndex(row,col) < 0)
            {
                if (m_strCustomText.GetLength())
                    row = col = CUSTOM_BOX_VALUE;
                else if (m_strDefaultText.GetLength())
                    row = col = DEFAULT_BOX_VALUE;
                else
                    row = col = 0;
            }
        }
        ChangeSelection(GetIndex(row, col));
    }

    if (nChar == VK_UP) 
    {
        if (row == DEFAULT_BOX_VALUE)
        {
            if (m_strCustomText.GetLength())
                row = col = CUSTOM_BOX_VALUE;
            else
           { 
                row = GetRow(m_nNumColors-1); 
                col = GetColumn(m_nNumColors-1); 
            }
        }
        else if (row == CUSTOM_BOX_VALUE)
        { 
            row = GetRow(m_nNumColors-1); 
            col = GetColumn(m_nNumColors-1); 
        }
        else if (row > 0) row--;
        else /* row == 0 */
        {
            if (m_strDefaultText.GetLength())
                row = col = DEFAULT_BOX_VALUE;
            else if (m_strCustomText.GetLength())
                row = col = CUSTOM_BOX_VALUE;
            else
            { 
                row = GetRow(m_nNumColors-1); 
                col = GetColumn(m_nNumColors-1); 
            }
        }
        ChangeSelection(GetIndex(row, col));
    }

    if (nChar == VK_RIGHT) 
    {
        if (row == DEFAULT_BOX_VALUE) 
            row = col = 0; 
        else if (row == CUSTOM_BOX_VALUE)
        {
            if (m_strDefaultText.GetLength())
                row = col = DEFAULT_BOX_VALUE;
            else
                row = col = 0;
        }
        else if (col < m_nNumColumns-1) 
            col++;
        else 
        { 
            col = 0; row++;
        }

        if (GetIndex(row,col) == INVALID_COLOR)
        {
            if (m_strCustomText.GetLength())
                row = col = CUSTOM_BOX_VALUE;
            else if (m_strDefaultText.GetLength())
                row = col = DEFAULT_BOX_VALUE;
            else
                row = col = 0;
        }

        ChangeSelection(GetIndex(row, col));
    }

    if (nChar == VK_LEFT) 
    {
        if (row == DEFAULT_BOX_VALUE)
        {
            if (m_strCustomText.GetLength())
                row = col = CUSTOM_BOX_VALUE;
            else
           { 
                row = GetRow(m_nNumColors-1); 
                col = GetColumn(m_nNumColors-1); 
            }
        }
        else if (row == CUSTOM_BOX_VALUE)
        { 
            row = GetRow(m_nNumColors-1); 
            col = GetColumn(m_nNumColors-1); 
        }
        else if (col > 0) col--;
        else /* col == 0 */
        {
            if (row > 0) { row--; col = m_nNumColumns-1; }
            else 
            {
                if (m_strDefaultText.GetLength())
                    row = col = DEFAULT_BOX_VALUE;
                else if (m_strCustomText.GetLength())
                    row = col = CUSTOM_BOX_VALUE;
                else
                { 
                    row = GetRow(m_nNumColors-1); 
                    col = GetColumn(m_nNumColors-1); 
                }
            }
        }
        ChangeSelection(GetIndex(row, col));
    }

    if (nChar == VK_ESCAPE) 
    {
        m_crColor = m_crInitialColor;
        EndSelection(CPN_SELENDCANCEL);
        return;
    }

    if (nChar == VK_RETURN || nChar == VK_SPACE)
    {
        EndSelection(CPN_SELENDOK);
        return;
    }

    CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}
示例#4
0
/*******************************************************************************
  Function Name  : OnKeyDown
  Input(s)       : nChar - Key Code, nRepCnt - Repeat Count,
                   nFlags - Ctrl and Alt key status
  Output         : -
  Functionality  : This function moves the selection if arrow keys are pressed
  Member of      : CColourPopup
  Author(s)      : Raja N
  Date Created   : 09/12/2004
  Modifications  : 
*******************************************************************************/
void CColourPopup::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
    int row = GetRow(m_nCurrentSel),
        col = GetColumn(m_nCurrentSel);
    // Move Selection
    if (nChar == VK_DOWN) 
    {
        // Wrap to top
        if (row == DEFAULT_BOX_VALUE)
        {
            row = col = 0;
        }
        else if (row == CUSTOM_BOX_VALUE)
        {
            if ( m_strDefaultText.GetLength() > 0 )
            {
                row = col = DEFAULT_BOX_VALUE;
            }
            else
            {
                row = col = 0;
            }
        }
        else
        {
            // Increment row count
            row++;
            if ( GetIndex(row,col) < 0)
            {
                if (m_strCustomText.GetLength() > 0)
                {
                    row = col = CUSTOM_BOX_VALUE;
                }
                else if (m_strDefaultText.GetLength() > 0)
                {
                    row = col = DEFAULT_BOX_VALUE;
                }
                else
                {
                    row = col = 0;
                }
            }
        }
        // Update Selection
        ChangeSelection(GetIndex(row, col));
    }
    // Move One cell Up
    if (nChar == VK_UP) 
    {
        if (row == DEFAULT_BOX_VALUE)
        {
            if (m_strCustomText.GetLength() > 0)
            {
                row = col = CUSTOM_BOX_VALUE;
            }
            else
            { 
                row = GetRow(m_nNumColours-1); 
                col = GetColumn(m_nNumColours-1); 
            }
        }
        else if (row == CUSTOM_BOX_VALUE)
        { 
            row = GetRow(m_nNumColours-1); 
            col = GetColumn(m_nNumColours-1); 
        }
        else if (row > 0)
        {
            row--;
        }
        else
        {
            if (m_strDefaultText.GetLength() > 0)
            {
                row = col = DEFAULT_BOX_VALUE;
            }
            else if( m_strCustomText.GetLength() > 0)
            {
                row = col = CUSTOM_BOX_VALUE;
            }
            else
            { 
                row = GetRow(m_nNumColours-1); 
                col = GetColumn(m_nNumColours-1); 
            }
        }
        // Update Selection
        ChangeSelection(GetIndex(row, col));
    }
    // Move One Cell Right
    if (nChar == VK_RIGHT) 
    {
        if (row == DEFAULT_BOX_VALUE)
        {
            row = col = 0;
        }
        else if (row == CUSTOM_BOX_VALUE)
        {
            if (m_strDefaultText.GetLength())
            {
                row = col = DEFAULT_BOX_VALUE;
            }
            else
            {
                row = col = 0;
            }
        }
        else if (col < m_nNumColumns - 1)
        {
            col++;
        }
        else 
        {
            // Move to Col 0 of next row
            col = 0;
            row++;
        }

        if (GetIndex(row,col) == INVALID_COLOUR)
        {
            if (m_strCustomText.GetLength() > 0)
            {
                row = col = CUSTOM_BOX_VALUE;
            }
            else if ( m_strDefaultText.GetLength() > 0)
            {
                row = col = DEFAULT_BOX_VALUE;
            }
            else
            {
                row = col = 0;
            }
        }
        // Update Selection
        ChangeSelection(GetIndex(row, col));
    }
    // Move one cell left
    if (nChar == VK_LEFT) 
    {
        if (row == DEFAULT_BOX_VALUE)
        {
            if (m_strCustomText.GetLength() > 0)
            {
                row = col = CUSTOM_BOX_VALUE;
            }
            else
            {
                row = GetRow(m_nNumColours-1); 
                col = GetColumn(m_nNumColours-1); 
            }
        }
        else if (row == CUSTOM_BOX_VALUE)
        { 
            row = GetRow(m_nNumColours-1); 
            col = GetColumn(m_nNumColours-1); 
        }
        else if (col > 0)
        {
            col--;
        }
        else  // col == 0
        {
            if (row > 0)
            { 
                row--;
                col = m_nNumColumns - 1;
            }
            else 
            {
                if (m_strDefaultText.GetLength() > 0)
                {
                    row = col = DEFAULT_BOX_VALUE;
                }
                else if (m_strCustomText.GetLength() > 0)
                {
                    row = col = CUSTOM_BOX_VALUE;
                }
                else
                { 
                    row = GetRow(m_nNumColours-1); 
                    col = GetColumn(m_nNumColours-1); 
                }
            }
        }
        // Update Selection
        ChangeSelection(GetIndex(row, col));
    }
    // Hide This dialog on press of escape key
    if (nChar == VK_ESCAPE) 
    {
        // Restore initial color
        m_crColour = m_crInitialColour;
        // Close the session
        EndSelection(WM_CPN_SELENDCANCEL);
        return;
    }
    // On Press of enter or space select the selection and close this
    // dialog
    if (nChar == VK_RETURN || nChar == VK_SPACE)
    {
        EndSelection(WM_CPN_SELENDOK);
        return;
    }
    // Else call default procedure
    CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}
示例#5
0
NS_IMETHODIMP nsXULTreeAccessible::RemoveChildFromSelection(PRInt32 aIndex)
{
  PRBool isSelected;
  return ChangeSelection(aIndex, eSelection_Remove, &isSelected);
}
示例#6
0
NS_IMETHODIMP nsXULTreeAccessible::IsChildSelected(PRInt32 aIndex, PRBool *_retval)
{
  return ChangeSelection(aIndex, eSelection_GetState, _retval);
}
示例#7
0
afx_msg void
MFCSequenceEditor::OnMouseMove(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();

	Time	at_time;
	short	at_channel;
//	at_channel = Pix2Channel(point.y);

	if (bounds.PtInRect(point)) {
		if (!mouse_captured) {
//			SetCapture();
			mouse_captured = true;
		}
		// check cursor matches current tool
	} else if (bounds.PtInRect(point)) {
		if (mouse_captured) {
//			ReleaseCapture();
			mouse_captured = false;
		}
		// revert cursor to standard arrow
	}

	switch (mouse_action) {
		case QUA_MOUSE_ACTION_MOVE_INSTANCE: {
//			if (mouse_instance) {
//				Instance	*inst = mouse_instance->instance;
//				if (inst) {
//					Pix2Time(point.x-mouse_move_inst_offset.x, at_time);
//					Time	last_time;
//					Pix2Time(last_mouse_point.x-mouse_move_inst_offset.x, last_time);
//					short	last_channel = Pix2Channel(last_mouse_point.y);
//					if (last_time != at_time || last_channel != at_channel) {
//						quaLink->MoveInstance(inst->sym, at_channel, &at_time, NULL);
//					}
//				}
//			}
			break;
		}
		case QUA_MOUSE_ACTION_REGION_SELECT: {
			BRect	r(min(mouse_click.x,point.x),min(mouse_click.y,point.y),max(mouse_click.x,point.x),max(mouse_click.y,point.y));
			ChangeSelection(r);
			break;
		}
		case QUA_MOUSE_ACTION_SIZE_INSTANCE: {
//			if (mouse_instance) {
//				Instance	*inst = mouse_instance->instance;
//				if (inst) {
//					Pix2Time(point.x-mouse_move_inst_offset.x, at_time);
//					Time	last_time;
//					Pix2Time(last_mouse_point.x-mouse_move_inst_offset.x, last_time);
//					if (last_time != at_time) {
//						quaLink->MoveInstance(inst->sym, -1, NULL, &at_time);
//					}
//				}
//			}
			break;
		}
	}

	last_mouse_point = point;
}
示例#8
0
NS_IMETHODIMP nsXULTreeAccessible::AddChildToSelection(PRInt32 aIndex)
{
  PRBool isSelected;
  return ChangeSelection(aIndex, eSelection_Add, &isSelected);
}
/*
 * VectorListBoxSelected
 */
void VectorPanel::VectorListBoxSelected(wxCommandEvent& event)
{
	wxArrayInt selections;
	VectorListBox->GetSelections(selections);
	ChangeSelection(selections);
}
示例#10
0
afx_msg void
MFCArrangeView::OnLButtonDown(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();
	last_mouse_point = mouse_click = point;

	short	at_channel;
	at_channel = Pix2Channel(point.y);
	Time	at_time;
	Pix2Time(point.x, at_time);

//	int		bar, barbeat, beattick;
//	at_time.GetBBQValue(bar, barbeat, beattick);
//	fprintf(stderr, "left button down: on point %d %d, channel %d, ticks %d t %d:%d.%d\n", point.x, point.y, at_channel, at_time.ticks, bar, barbeat, beattick);
	std::cerr << "left mouse button down at " << at_time.StringValue() << " flags " << nFlags << endl;

	switch (currentTool) {
		case ID_ARTOOL_POINT: {
			DeselectAll();
			short	hitType;
			void	*hitIt=NULL;
			;
			if ((mouse_instance = InstanceViewAtPoint(mouse_click))!=NULL) {
				mouse_action = QUA_MOUSE_ACTION_MOVE_INSTANCE;
				mouse_move_inst_offset.x = mouse_click.x - mouse_instance->bounds.left;
				mouse_move_inst_offset.y = mouse_click.y;
				mouse_instance->Select(true);
			}
			if ((mouse_item = ItemViewAtPoint(mouse_click, nFlags, hitType, hitIt))!=NULL) {
				if (hitIt) {
//					mouse_sub_item = (StreamItem *)hitIt;
				}
				switch (mouse_item->type) {
					case MFCEditorItemView::CLIP: {
						MFCClipItemView	*siv = (MFCClipItemView *)mouse_item;
						if (hitType == 1) { 	// top edge of an interior item point
							mouse_action = QUA_MOUSE_ACTION_MOVE_EVENT;
							mouse_move_item_offset.x = mouse_click.x;
							mouse_move_item_offset.y = mouse_click.y;
							mouse_item->Select(true);
						} else if (hitType == 2) { // side edge of an interior item point
							mouse_action = QUA_MOUSE_ACTION_SIZE_EVENT;
							mouse_move_item_offset.x = mouse_click.x;
							mouse_move_item_offset.y = mouse_click.y;
							mouse_item->Select(true);
						}
						break;
					}

				}
			}
			break;
		}
		case ID_ARTOOL_SLICE: {
			break;
		}
		case ID_ARTOOL_RGSELECT: {
			fprintf(stderr, "region select\n");
			mouse_action = QUA_MOUSE_ACTION_REGION_SELECT;
			BRect	r(min(mouse_click.x,point.x),min(mouse_click.y,point.y),max(mouse_click.x,point.x),max(mouse_click.y,point.y));
			ChangeSelection(r);
			break;
		}
		case ID_ARTOOL_DRAW: {
			mouse_instance = InstanceViewAtPoint(mouse_click);
			if (mouse_instance) {
				mouse_action = QUA_MOUSE_ACTION_SIZE_INSTANCE;
				mouse_move_inst_offset.x = mouse_instance->bounds.left;
				mouse_move_inst_offset.y = mouse_click.y;
				Instance	*inst = mouse_instance->instance;
				if (inst) {
					Pix2Time(point.x-mouse_move_inst_offset.x, at_time);
					quaLink->MoveInstance(inst->sym, -1, inst->startTime, at_time);
				}
			}
			break;
		}
	}
}
示例#11
0
afx_msg void
MFCArrangeView::OnMouseMove(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();

	Time	at_time;
	short	at_channel;
	at_channel = Pix2Channel(point.y);

//	std::cerr << "MFCArrangeView:OnMouseMove() " << at_time.StringValue() << " flags " << nFlags << endl;

	if (bounds.PtInRect(point)) {
		if (!mouse_captured) {
			SetCapture();
			mouse_captured = true;
			switch (currentTool) {
				case ID_ARTOOL_POINT: {
					originalCursor = ::SetCursor(pointCursor);
					break;
				}
				case ID_ARTOOL_SLICE: {
					originalCursor = ::SetCursor(sliceCursor);
					break;
				}
				case ID_ARTOOL_DRAW: {
					originalCursor = ::SetCursor(drawCursor);
					break;
				}
				case ID_ARTOOL_RGSELECT: {
					originalCursor = ::SetCursor(regionCursor);
					break;
				}
			}
		}
	} else if (!bounds.PtInRect(point)) {
		if (mouse_captured) {
			ReleaseCapture();
			mouse_captured = false;
			if (originalCursor != NULL) {
				::SetCursor(originalCursor);
				originalCursor = NULL;
			}
		}
	}

	switch (mouse_action) {
		case QUA_MOUSE_ACTION_MOVE_INSTANCE: {
			if (mouse_instance) {
				std::cerr << "mouse move, move instance " << at_time.StringValue() << " flags " << nFlags << endl;
				Instance	*inst = mouse_instance->instance;
				if (inst) {
					Pix2Time(point.x-mouse_move_inst_offset.x, at_time);
					Time	last_time;
					Pix2Time(last_mouse_point.x-mouse_move_inst_offset.x, last_time);
					short	last_channel = Pix2Channel(last_mouse_point.y);
					if (last_time != at_time || last_channel != at_channel) {
						quaLink->MoveInstance(inst->sym, at_channel, at_time, inst->duration);
					}
				}
			}
			break;
		}
		case QUA_MOUSE_ACTION_REGION_SELECT: {
			BRect	r(min(mouse_click.x,point.x),min(mouse_click.y,point.y),max(mouse_click.x,point.x),max(mouse_click.y,point.y));
			ChangeSelection(r);
			break;
		}
		case QUA_MOUSE_ACTION_SIZE_INSTANCE: {
			if (mouse_instance) {
				Instance	*inst = mouse_instance->instance;
				if (inst) {
					Pix2Time(point.x-mouse_move_inst_offset.x, at_time);
					Time	last_time;
					Pix2Time(last_mouse_point.x-mouse_move_inst_offset.x, last_time);
					if (last_time != at_time) {
						quaLink->MoveInstance(inst->sym, -1, inst->startTime, at_time);
					}
				}
			}
			break;
		}
		case QUA_MOUSE_ACTION_MOVE_EVENT: {
			if (mouse_item) {
				switch (mouse_item->type) {
					case MFCEditorItemView::DISCRETE: {
						break;
					}
					case MFCEditorItemView::LIST: {
						break;
					}
					case MFCEditorItemView::CLIP: {
						MFCClipItemView	*siv = (MFCClipItemView *)mouse_item;
						Pix2Time(point.x, at_time);
						siv->SetClipStartTime(at_time);
						break;
					}
				}
			}
			break;
		}
		case QUA_MOUSE_ACTION_SIZE_EVENT: {
			if (mouse_item) {
				switch (mouse_item->type) {
					case MFCEditorItemView::DISCRETE: {
						break;
					}
					case MFCEditorItemView::LIST: {
						break;
					}
					case MFCEditorItemView::CLIP: {
						MFCClipItemView	*siv = (MFCClipItemView *)mouse_item;
						Pix2Time(point.x, at_time);
						siv->SetClipEndTime(at_time);
						break;
					}
				}
			}
			break;
		}
	}

	last_mouse_point = point;
}
示例#12
0
static int TXT_TableKeyPress(TXT_UNCAST_ARG(table), int key)
{
    TXT_CAST_ARG(txt_table_t, table);
    int selected;
    int rows;

    rows = TableRows(table);

    // Send to the currently selected widget first

    selected = table->selected_y * table->columns + table->selected_x;

    if (selected >= 0 && selected < table->num_widgets)
    {
        if (IsActualWidget(table->widgets[selected])
         && TXT_SelectableWidget(table->widgets[selected])
         && TXT_WidgetKeyPress(table->widgets[selected], key))
        {
            return 1;
        }
    }

    if (key == KEY_TAB)
    {
        int dir;
        int i;

        dir = TXT_GetModifierState(TXT_MOD_SHIFT) ? -1 : 1;

        // Cycle through all widgets until we find one that can be selected.
        for (i = table->selected_y * table->columns + table->selected_x + dir;
             i >= 0 && i < table->num_widgets;
             i += dir)
        {
            if (IsActualWidget(table->widgets[i])
             && TXT_SelectableWidget(table->widgets[i]))
            {
                ChangeSelection(table, i % table->columns, i / table->columns);
                return 1;
            }
        }

        return 0;
    }

    if (key == KEY_DOWNARROW)
    {
        int new_x, new_y;

        // Move cursor down to the next selectable widget

        for (new_y = table->selected_y + 1; new_y < rows; ++new_y)
        {
            new_x = FindSelectableColumn(table, new_y, table->selected_x);

            if (new_x >= 0)
            {
                // Found a selectable widget in this column!

                ChangeSelection(table, new_x, new_y);

                return 1;
            }
        }
    }

    if (key == KEY_UPARROW)
    {
        int new_x, new_y;

        // Move cursor up to the next selectable widget

        for (new_y = table->selected_y - 1; new_y >= 0; --new_y)
        {
            new_x = FindSelectableColumn(table, new_y, table->selected_x);

            if (new_x >= 0)
            {
                // Found a selectable widget in this column!

                ChangeSelection(table, new_x, new_y);

                return 1;
            }
        }
    }

    if (key == KEY_LEFTARROW)
    {
        int new_x;

        // Move cursor left

        for (new_x = table->selected_x - 1; new_x >= 0; --new_x)
        {
            if (SelectableCell(table, new_x, table->selected_y))
            {
                // Found a selectable widget!

                ChangeSelection(table, new_x, table->selected_y);

                return 1;
            }
        }
    }

    if (key == KEY_RIGHTARROW)
    {
        int new_x;

        // Move cursor left

        for (new_x = table->selected_x + 1; new_x < table->columns; ++new_x)
        {
            if (SelectableCell(table, new_x, table->selected_y))
            {
                // Found a selectable widget!

                ChangeSelection(table, new_x, table->selected_y);

                return 1;
            }
        }
    }

    return 0;
}
示例#13
0
int TXT_PageTable(TXT_UNCAST_ARG(table), int pagex, int pagey)
{
    TXT_CAST_ARG(txt_table_t, table);
    unsigned int *column_widths;
    unsigned int *row_heights;
    int rows;
    int changed = 0;

    rows = TableRows(table);

    row_heights = malloc(sizeof(int) * rows);
    column_widths = malloc(sizeof(int) * table->columns);

    CalcRowColSizes(table, row_heights, column_widths);

    if (pagex)
    {
        // @todo Jump selection to the left or right as needed
    }

    if (pagey)
    {
        int new_x, new_y;
        int distance = 0;
        int dir;

        // What direction are we moving?

        if (pagey > 0)
        {
            dir = 1;
        }
        else
        {
            dir = -1;
        }

        // Move the cursor until the desired distance is reached.

        new_y = table->selected_y;

        while (new_y >= 0 && new_y < rows)
        {
            // We are about to travel a distance equal to the height of the row
            // we are about to leave.

            distance += row_heights[new_y];

            // *Now* increment the loop.

            new_y += dir;

            new_x = FindSelectableColumn(table, new_y, table->selected_x);

            if (new_x >= 0)
            {
                // Found a selectable widget in this column!
                // Select it anyway in case we don't find something better.

                ChangeSelection(table, new_x, new_y);
                changed = 1;

                // ...but is it far enough away?

                if (distance >= abs(pagey))
                {
                    break;
                }
            }
        }
    }

    free(row_heights);
    free(column_widths);

    return changed;
}