bool CMultiColumnList::KeyboardProc(UINT nChar, bool bKeyDown){
	if (!bKeyDown) return false;
	if (nChar == VK_PRIOR)
		PageUp();
	else if (nChar == VK_NEXT)
		PageDown();
	else 
		return false;
	return true;
}
Exemple #2
0
eOSState cOsdMenu::ProcessKey(eKeys Key)
{
    if (subMenu) {
        eOSState state = subMenu->ProcessKey(Key);
        if (state == osBack)
            return CloseSubMenu();
        return state;
    }

    cOsdItem *item = Get(current);
    if (marked < 0 && item) {
        eOSState state = item->ProcessKey(Key);
        if (state != osUnknown) {
            DisplayCurrent(true);
            return state;
        }
    }
    switch (int(Key)) {
    case k0:
        return osUnknown;
    case k1...k9:
        return hasHotkeys ? HotKey(Key) : osUnknown;
    case kUp|k_Repeat:
    case kUp:
        CursorUp();
        break;
    case kDown|k_Repeat:
    case kDown:
        CursorDown();
        break;
    case kLeft|k_Repeat:
    case kLeft:
        PageUp();
        break;
    case kRight|k_Repeat:
    case kRight:
        PageDown();
        break;
    case kBack:
        return osBack;
    case kOk:
        if (marked >= 0) {
            SetStatus(NULL);
            if (marked != current)
                Move(marked, current);
            marked = -1;
            break;
        }
    // else run into default
    default:
        if (marked < 0)
            return osUnknown;
    }
    return osContinue;
}
Exemple #3
0
eOSState cNoepgMainMenu::ProcessKey(eKeys Key)
{
  if (Key == kGreen) {
     PageUp();
     return osUnknown;
     }
  if (Key == kYellow) {
     PageDown();
     return osUnknown;
     }
  return cMenuSetupPage::ProcessKey(Key);
}
void CSkinVerticleScrollbar::OnLButtonUp(UINT nFlags, CPoint point) 
{
	UpdateThumbPosition();
	KillTimer(1);
	ReleaseCapture();
	
	bool bInChannel = true;

	CRect clientRect;
	GetClientRect(&clientRect);
	int nHeight = clientRect.Height() - 37;
	CRect rectUpArrow(0,11,20,37);
	CRect rectDownArrow(0,nHeight,20,nHeight+26);
	CRect rectThumb(0,nThumbTop,20,nThumbTop+26);



	if(rectUpArrow.PtInRect(point) && bMouseDownArrowUp)
	{
		ScrollUp();	
		bInChannel = false;
	}

	if(rectDownArrow.PtInRect(point) && bMouseDownArrowDown)
	{
		ScrollDown();
		bInChannel = false;
	}

	if(rectThumb.PtInRect(point))
	{
		bInChannel = false;
	}

	if(bInChannel == true && !bMouseDown)
	{
		if(point.y > nThumbTop)
		{
			PageDown();
		}
		else
		{
			PageUp();
		}
	}

	bMouseDown = false;
	bDragging = false;
	bMouseDownArrowUp = false;
	bMouseDownArrowDown = false;
	
	CStatic::OnLButtonUp(nFlags, point);
}
Exemple #5
0
/*
==============
Scroll
deals with scrolling text because we don't have key repeat
==============
*/
void idConsoleLocal::Scroll( )
{
	if( lastKeyEvent == -1 || ( lastKeyEvent + 200 ) > eventLoop->Milliseconds() )
	{
		return;
	}
	// console scrolling
	if( idKeyInput::IsDown( K_PGUP ) )
	{
		PageUp();
		nextKeyEvent = CONSOLE_REPEAT;
		return;
	}
	
	if( idKeyInput::IsDown( K_PGDN ) )
	{
		PageDown();
		nextKeyEvent = CONSOLE_REPEAT;
		return;
	}
}
Exemple #6
0
eOSState cOsdMenu::HotKey(eKeys Key)
{
#ifdef USE_LIEMIEXT
  bool match = false;
  bool highlight = false;
  int  item_nr;
  int  i;

  if (Key == kNone) {
     if (lastActivity.TimedOut())
        Key = kOk;
     else
        return osContinue;
     }
  else {
     lastActivity.Set(MENUKEY_TIMEOUT);
     }
  for (cOsdItem *item = Last(); item; item = Prev(item)) {
#else
  for (cOsdItem *item = First(); item; item = Next(item)) {
#endif /* LIEMIEXT */
      const char *s = item->Text();
#ifdef USE_LIEMIEXT
      i = 0;
      item_nr = 0;
      if (s && (s = skipspace(s)) != '\0' && '0' <= s[i] && s[i] <= '9') {
         do {
            item_nr = item_nr * 10 + (s[i] - '0');
            }
         while ( !((s[++i] == '\t')||(s[i] == ' ')) && (s[i] != '\0') && ('0' <= s[i]) && (s[i] <= '9'));
         if ((Key == kOk) && (item_nr == key_nr)) {
#else
      if (s && (s = skipspace(s)) != NULL) {
         if (*s == Key - k1 + '1') {
#endif /* LIEMIEXT */
            current = item->Index();
            RefreshCurrent();
            Display();
            cRemote::Put(kOk, true);
#ifdef USE_LIEMIEXT
            key_nr = -1;
#endif /* LIEMIEXT */
            break;
            }
#ifdef USE_LIEMIEXT
         else if (Key != kOk) {
            if (!highlight && (item_nr == (Key - k0))) {
               highlight = true;
               current = item->Index();
               }
            if (!match && (key_nr == -1) && ((item_nr / 10) == (Key - k0))) {
               match = true;
               key_nr = (Key - k0);
               }
            else if (((key_nr == -1) && (item_nr == (Key - k0))) || (!match && (key_nr >= 0) && (item_nr == (10 * key_nr + Key - k0)))) {
               current = item->Index();
               cRemote::Put(kOk, true);
               key_nr = -1;
               break;
               }
            }
#endif /* LIEMIEXT */
         }
      }
#ifdef USE_LIEMIEXT
  if ((!match) && (Key != kNone)) {
     key_nr = -1;
     }
#endif /* LIEMIEXT */
#if REELVDR
  // RC: returning osContinue prevents the main menu and prob. others from automatic closing. side effects?
  //DDD("return osUnknown");
  return osUnknown;
#else
  return osContinue;
#endif
}

eOSState cOsdMenu::AddSubMenu(cOsdMenu *SubMenu)
{
  delete subMenu;
  subMenu = SubMenu;
#if REELVDR
  /* close any preview/pip channels when adding a submenu, since it does
     not belong to the submenu*/
  if(cReelBoxBase::Instance()) {
      cReelBoxBase::Instance()->StartPip(false);
      printf("\033[0;92mStop pip\033[0m\n");
  }

  // Clear ID3 tags and cover-art/thumbnails that are stored in skinreel3's
  // global variables,
  // new osd should set the necessary thumbnails and id3 infos itself.
#if 0 // thumbnails in install wizard were not shown!
  cPlugin *skinPlugin = cPluginManager::GetPlugin("skinreel3");
  if (skinPlugin) {
      skinPlugin->Service("setThumb", NULL);
      skinPlugin->Service("setId3Infos", NULL);
  }
#endif
#endif
  subMenu->Display();
  return osContinue; // convenience return value
}

eOSState cOsdMenu::CloseSubMenu()
{
  delete subMenu;
  subMenu = NULL;
  RefreshCurrent();
  Display();
  return osContinue; // convenience return value
}

#ifdef REELVDR
//#define SEPARATORS ":-\0"
#define SEPARATORS ":-"
///< take menu-title substrings befor one of this chars

eOSState cOsdMenu::DisplayHelpMenu(const char *Title)
{
  char title[128];
  // if we get Menu at first we assume Main Menu
  if (strstr(Title,tr("Main Menu")) == Title)
  {
     strncpy(title,tr("Main Menu"),128);
  }
  else
  {
     const char *sep =  SEPARATORS;
     while (*sep != '\0')
     {
        //printf (" \t\t --- sep %c   \n", *sep);
        char *s = NULL;
        strncpy(title,Title,128);
        title[127] = '\0';

        s = strchr(title,*sep);
        if (s)
        {
           *s = '\0';
           //break;
        }
     sep++;
     }
  }
  //cHelpSection *hs = HelpMenus.GetSectionByTitle(title);
  //return AddSubMenu(new cMenuHelp(hs, title));
}
#endif /* REELVDR */

eOSState cOsdMenu::ProcessKey(eKeys Key)
{
  if (subMenu) {
     eOSState state = subMenu->ProcessKey(Key);
     if (state == osBack)
        return CloseSubMenu();
     return state;
     }

  cOsdItem *item = Get(current);
  if (marked < 0 && item) {
     eOSState state = item->ProcessKey(Key);
     if (state != osUnknown) {
        DisplayCurrent(true);
        return state;
        }
     }
  switch (int(Key)) {
#ifdef USE_LIEMIEXT
    case kNone:
    case k0...k9: return hasHotkeys ? HotKey(Key) : osUnknown;
#else
    case k0:      return osUnknown;
    case k1...k9: return hasHotkeys ? HotKey(Key) : osUnknown;
#endif /* LIEMIEXT */
    case kUp|k_Repeat:
    case kUp:   CursorUp();   break;
    case kDown|k_Repeat:
    case kDown: CursorDown(); break;
    case kLeft|k_Repeat:
    case kLeft: PageUp(); break;
    case kRight|k_Repeat:
    case kRight: PageDown(); break;
    case kBack: return osBack;
#ifdef REELVDR
    case kInfo: return DisplayHelpMenu(title);
#endif /* REELVDR */
    case kOk:   if (marked >= 0) {
                   SetStatus(NULL);
                   if (marked != current)
                      Move(marked, current);
                   marked = -1;
                   break;
                   }
                // else run into default
    default: if (marked < 0)
                return osUnknown;
    }
  return osContinue;
}
void wxSymbolListCtrl::OnKeyDown(wxKeyEvent& event)
{
    // No keyboard interface for now
    event.Skip();
#if 0
    // flags for DoHandleItemClick()
    int flags = ItemClick_Kbd;

    int currentLineNow = SymbolValueToLineNumber(m_current);

    int currentLine;
    switch ( event.GetKeyCode() )
    {
        case WXK_HOME:
            currentLine = 0;
            break;

        case WXK_END:
            currentLine = GetLineCount() - 1;
            break;

        case WXK_DOWN:
            if ( currentLineNow == (int)GetLineCount() - 1 )
                return;

            currentLine = currentLineNow + 1;
            break;

        case WXK_UP:
            if ( m_current == wxNOT_FOUND )
                currentLine = GetLineCount() - 1;
            else if ( currentLineNow != 0 )
                currentLine = currentLineNow - 1;
            else // currentLineNow == 0
                return;
            break;

        case WXK_PAGEDOWN:
            PageDown();
            currentLine = GetFirstVisibleLine();
            break;

        case WXK_PAGEUP:
            if ( currentLineNow == (int)GetFirstVisibleLine() )
            {
                PageUp();
            }

            currentLine = GetFirstVisibleLine();
            break;

        case WXK_SPACE:
            // hack: pressing space should work like a mouse click rather than
            // like a keyboard arrow press, so trick DoHandleItemClick() in
            // thinking we were clicked
            flags &= ~ItemClick_Kbd;
            currentLine = currentLineNow;
            break;

#ifdef __WXMSW__
        case WXK_TAB:
            // Since we are using wxWANTS_CHARS we need to send navigation
            // events for the tabs on MSW
            {
                wxNavigationKeyEvent ne;
                ne.SetDirection(!event.ShiftDown());
                ne.SetCurrentFocus(this);
                ne.SetEventObject(this);
                GetParent()->GetEventHandler()->ProcessEvent(ne);
            }
            // fall through to default
#endif
        default:
            event.Skip();
            currentLine = 0; // just to silent the stupid compiler warnings
            wxUnusedVar(currentNow);
            return;
    }

#if 0
    if ( event.ShiftDown() )
       flags |= ItemClick_Shift;
    if ( event.ControlDown() )
        flags |= ItemClick_Ctrl;

    DoHandleItemClick(current, flags);
#endif
#endif
}
Exemple #8
0
bool CGUISpinControl::OnAction(const CAction &action)
{
  switch (action.GetID())
  {
  case REMOTE_0:
  case REMOTE_1:
  case REMOTE_2:
  case REMOTE_3:
  case REMOTE_4:
  case REMOTE_5:
  case REMOTE_6:
  case REMOTE_7:
  case REMOTE_8:
  case REMOTE_9:
    {
      if (strlen(m_szTyped) >= 3)
      {
        m_iTypedPos = 0;
        strcpy(m_szTyped, "");
      }
      int iNumber = action.GetID() - REMOTE_0;

      m_szTyped[m_iTypedPos] = iNumber + '0';
      m_iTypedPos++;
      m_szTyped[m_iTypedPos] = 0;
      int iValue;
      sscanf(m_szTyped, "%i", &iValue);
      switch (m_iType)
      {
      case SPIN_CONTROL_TYPE_INT:
        {
          if (iValue < m_iStart || iValue > m_iEnd)
          {
            m_iTypedPos = 0;
            m_szTyped[m_iTypedPos] = iNumber + '0';
            m_iTypedPos++;
            m_szTyped[m_iTypedPos] = 0;
            sscanf(m_szTyped, "%i", &iValue);
            if (iValue < m_iStart || iValue > m_iEnd)
            {
              m_iTypedPos = 0;
              strcpy(m_szTyped, "");
              return true;
            }
          }
          m_iValue = iValue;
          CGUIMessage msg(GUI_MSG_CLICKED, GetID(), GetParentID());
          SendWindowMessage(msg);
        }
        break;

      case SPIN_CONTROL_TYPE_TEXT:
        {
          if (iValue < 0 || iValue >= (int)m_vecLabels.size())
          {
            m_iTypedPos = 0;
            m_szTyped[m_iTypedPos] = iNumber + '0';
            m_iTypedPos++;
            m_szTyped[m_iTypedPos] = 0;
            sscanf(m_szTyped, "%i", &iValue);
            if (iValue < 0 || iValue >= (int)m_vecLabels.size())
            {
              m_iTypedPos = 0;
              strcpy(m_szTyped, "");
              return true;
            }
          }
          m_iValue = iValue;
          CGUIMessage msg(GUI_MSG_CLICKED, GetID(), GetParentID());
          SendWindowMessage(msg);
        }
        break;

      }
      return true;
    }
    break;
  case ACTION_PAGE_UP:
    if (!m_bReverse)
      PageDown();
    else
      PageUp();
    return true;
    break;
  case ACTION_PAGE_DOWN:
    if (!m_bReverse)
      PageUp();
    else
      PageDown();
    return true;
    break;
  case ACTION_SELECT_ITEM:
    if (m_iSelect == SPIN_BUTTON_UP)
    {
      MoveUp();
      return true;
    }
    if (m_iSelect == SPIN_BUTTON_DOWN)
    {
      MoveDown();
      return true;
    }
    break;
  }
/*  static float m_fSmoothScrollOffset = 0.0f;
  if (action.GetID() == ACTION_SCROLL_UP)
  {
    m_fSmoothScrollOffset += action.GetAmount() * action.GetAmount();
    bool handled = false;
    while (m_fSmoothScrollOffset > 0.4)
    {
      handled = true;
      m_fSmoothScrollOffset -= 0.4f;
      MoveDown();
    }
    return handled;
  }*/
  return CGUIControl::OnAction(action);
}
	void CContainerUI::DoEvent(TEventUI& event)
	{
		if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
			if( m_pParent != NULL ) m_pParent->DoEvent(event);
			else CControlUI::DoEvent(event);
			return;
		}

		if( event.Type == UIEVENT_SETFOCUS ) 
		{
			m_bFocused = true;
			return;
		}
		if( event.Type == UIEVENT_KILLFOCUS ) 
		{
			m_bFocused = false;
			return;
		}
		if( m_pVerticalScrollBar != NULL && m_pVerticalScrollBar->IsVisible() && m_pVerticalScrollBar->IsEnabled() )
		{
			if( event.Type == UIEVENT_KEYDOWN ) 
			{
				switch( event.chKey ) {
				case VK_DOWN:
					LineDown();
					return;
				case VK_UP:
					LineUp();
					return;
				case VK_NEXT:
					PageDown();
					return;
				case VK_PRIOR:
					PageUp();
					return;
				case VK_HOME:
					HomeUp();
					return;
				case VK_END:
					EndDown();
					return;
				}
			}
			else if( event.Type == UIEVENT_SCROLLWHEEL )
			{
				switch( LOWORD(event.wParam) ) {
				case SB_LINEUP:
					LineUp();
					return;
				case SB_LINEDOWN:
					LineDown();
					return;
				}
			}
		}
		if( m_pHorizontalScrollBar != NULL && m_pHorizontalScrollBar->IsVisible() && m_pHorizontalScrollBar->IsEnabled() ) {
			if( event.Type == UIEVENT_KEYDOWN ) 
			{
				switch( event.chKey ) {
				case VK_DOWN:
					LineRight();
					return;
				case VK_UP:
					LineLeft();
					return;
				case VK_NEXT:
					PageRight();
					return;
				case VK_PRIOR:
					PageLeft();
					return;
				case VK_HOME:
					HomeLeft();
					return;
				case VK_END:
					EndRight();
					return;
				}
			}
			else if( event.Type == UIEVENT_SCROLLWHEEL )
			{
				switch( LOWORD(event.wParam) ) {
				case SB_LINEUP:
					LineLeft();
					return;
				case SB_LINEDOWN:
					LineRight();
					return;
				}
			}
		}
		CControlUI::DoEvent(event);
	}
Exemple #10
0
void wxVListBox::OnKeyDown(wxKeyEvent& event)
{
    // flags for DoHandleItemClick()
    int flags = ItemClick_Kbd;

    int current;
    switch ( event.GetKeyCode() )
    {
        case WXK_HOME:
        case WXK_NUMPAD_HOME:
            current = 0;
            break;

        case WXK_END:
        case WXK_NUMPAD_END:
            current = GetRowCount() - 1;
            break;

        case WXK_DOWN:
        case WXK_NUMPAD_DOWN:
            if ( m_current == (int)GetRowCount() - 1 )
                return;

            current = m_current + 1;
            break;

        case WXK_UP:
        case WXK_NUMPAD_UP:
            if ( m_current == wxNOT_FOUND )
                current = GetRowCount() - 1;
            else if ( m_current != 0 )
                current = m_current - 1;
            else // m_current == 0
                return;
            break;

        case WXK_PAGEDOWN:
        case WXK_NUMPAD_PAGEDOWN:
            PageDown();
            current = GetVisibleBegin();
            break;

        case WXK_PAGEUP:
        case WXK_NUMPAD_PAGEUP:
            if ( m_current == (int)GetVisibleBegin() )
            {
                PageUp();
            }

            current = GetVisibleBegin();
            break;

        case WXK_SPACE:
            // hack: pressing space should work like a mouse click rather than
            // like a keyboard arrow press, so trick DoHandleItemClick() in
            // thinking we were clicked
            flags &= ~ItemClick_Kbd;
            current = m_current;
            break;

#ifdef __WXMSW__
        case WXK_TAB:
            // Since we are using wxWANTS_CHARS we need to send navigation
            // events for the tabs on MSW
            HandleAsNavigationKey(event);
            // fall through to default
#endif
        default:
            event.Skip();
            current = 0; // just to silent the stupid compiler warnings
            wxUnusedVar(current);
            return;
    }

    if ( event.ShiftDown() )
       flags |= ItemClick_Shift;
    if ( event.ControlDown() )
        flags |= ItemClick_Ctrl;

    DoHandleItemClick(current, flags);
}
void ContentBoxCtrol::OnKeyDown(wxKeyEvent& event)
{
    // flags for DoHandleItemClick()
    int flags = ItemClick_Kbd;

    int current;
    switch ( event.GetKeyCode() )
    {
        case WXK_HOME:
            current = 0;
            break;

        case WXK_END:
            current = GetRowCount() - 1;
            break;

        case WXK_DOWN:
            if ( m_current == (int)GetRowCount() - 1 )
                return;

            current = m_current + 1;
            break;

        case WXK_UP:
            if ( m_current == wxNOT_FOUND )
                current = GetRowCount() - 1;
            else if ( m_current != 0 )
                current = m_current - 1;
            else // m_current == 0
                return;
            break;

        case WXK_PAGEDOWN:
            PageDown();
            current = GetVisibleRowsBegin();
            break;

        case WXK_PAGEUP:
            if ( m_current == (int)GetVisibleRowsBegin() )
            {
                PageUp();
            }

            current = GetVisibleRowsBegin();
            break;

        case WXK_SPACE:
            // hack: pressing space should work like a mouse click rather than
            // like a keyboard arrow press, so trick DoHandleItemClick() in
            // thinking we were clicked
            flags &= ~ItemClick_Kbd;
            current = m_current;
            break;

#if (LENMUS_PLATFORM_WIN32 == 1)
        case WXK_TAB:
            // Since we are using wxWANTS_CHARS we need to send navigation
            // events for the tabs on MSW
            {
                wxNavigationKeyEvent ne;
                ne.SetDirection(!event.ShiftDown());
                ne.SetCurrentFocus(this);
                ne.SetEventObject(this);
                GetParent()->GetEventHandler()->ProcessEvent(ne);
            }
            // fall through to default
#endif
        default:
            event.Skip();      //continue processing the  event
            current = 0; // just to silent the stupid compiler warnings
            wxUnusedVar(current);
            return;
    }

    if ( event.ShiftDown() )
       flags |= ItemClick_Shift;
    if ( event.ControlDown() )
        flags |= ItemClick_Ctrl;

    DoHandleItemClick(current, flags);
}
Exemple #12
0
void ScrollBar::OnPageRight(suic::Element* pSender, suic::MouseEventArg& e)
{
    PageDown();
}
bool SampleInstrumentTable::key(unsigned long p_unicode, unsigned long p_scan_code,bool p_press,bool p_repeat,int p_modifier_mask) {
	
	if (!p_press)
		return true;
	KeyBindList kbind=KeyBind::get_bind( p_scan_code|p_modifier_mask );
	
	if (kbind==KB_MAX)
		return false;
	
	
	bool capture=false;
	switch (kbind) {
	
		case KB_PATTERN_RAISE_NOTES: {
			
			for (int i=0;i<Note::NOTES;i++) {
				if (instrument->get_note_number(i)>=Note::NOTES)
					continue;
				int new_note=instrument->get_note_number(i)+1;
				if (new_note>=Note::NOTES)
					new_note=Note::EMPTY;
				
				instrument->set_note_number(i,new_note);
			}
			
		} break;
		case KB_PATTERN_LOWER_NOTES: {
			
			for (int i=0;i<Note::NOTES;i++) {
				if (instrument->get_note_number(i)>=Note::NOTES)
					continue;
				if (instrument->get_note_number(i)==0)
					continue;
				instrument->set_note_number(i,instrument->get_note_number(i)-1);
				
			}
			
		} break;
		case KB_CURSOR_WRITE_MASK: {
			
			//for (int i=0;i<Note::NOTES;i++) {
			instrument->set_sample_number(cursor_y,sample_mask);
			MoveDown();
			//}
			
		} break;
		/*	
		case KB_CURSOR_INSERT: {

			editor->orderlist_insert();
		} break;
		case KB_CURSOR_DELETE: {

			editor->orderlist_delete();
	} break; */
		case KB_CURSOR_MOVE_UP: {

			MoveUp();
			capture=true;
		} break;
		case KB_CURSOR_MOVE_DOWN: {

			MoveDown();
			capture=true;

		} break;
		case KB_CURSOR_MOVE_LEFT: {

			if (MoveLeft())
				capture=true;

		} break;
		case KB_CURSOR_MOVE_RIGHT: {

			if (MoveRight())
				capture=true;

		} break;
		case KB_CURSOR_PAGE_UP: {

			PageUp();
			capture=true;

		} break;
		case KB_CURSOR_PAGE_DOWN: {

			PageDown();

			capture=true;
		} break;
		
		case KB_CURSOR_FIELD_CLEAR: {
			
			ClearOrder();
			
			
		} break;
		default: {
			
			
			switch (cursor_x) {
				case 0: {

					int tmpkey = editor->get_note_from_charcode(kbind);
					if (tmpkey>=0) {

						instrument->set_note_number(cursor_y,tmpkey);
						instrument->set_sample_number(cursor_y,sample_mask);

						MoveDown();
					}
				} break;
				case 1: {

					if ((p_unicode>='0') && (p_unicode<='9')) {

						int aux_numb=instrument->get_note_number(cursor_y) % 12;

						instrument->set_note_number(cursor_y,(p_unicode-'0')*12+aux_numb);
						MoveDown();
					}
				} break;
				case 2: {

					if ((p_unicode>='0') && (p_unicode<='9')) {

						int aux_numb=instrument->get_sample_number(cursor_y);
						
						if (aux_numb==Note::EMPTY) aux_numb=0;
						else aux_numb++;

						int num_right=aux_numb % 10;

						aux_numb=(p_unicode-'0')*10+num_right;

						if (aux_numb==0) aux_numb=Note::EMPTY;
						else aux_numb--;

						sample_mask=aux_numb;
						instrument->set_sample_number(cursor_y,aux_numb);
						MoveRight();
					}
				} break;
				case 3: {

					if ((p_unicode>='0') && (p_unicode<='9')) {

						int aux_numb=instrument->get_sample_number(cursor_y);
						int num_left;
						if (aux_numb==Note::EMPTY) aux_numb=0;
						else aux_numb++;

						num_left=aux_numb / 10;

						aux_numb=num_left*10+(p_unicode-'0');

						if (aux_numb==0) aux_numb=Note::EMPTY;
						else aux_numb--;

						sample_mask=aux_numb;
						instrument->set_sample_number(cursor_y,aux_numb);
						MoveLeft();
						MoveDown();
					}
				} break;
			}
		}
	}
	
	if (range)
		range->set(row_offset);
	update();
	return capture;
}
Exemple #14
0
/*
====================
KeyDownEvent

Handles history and console scrollback
====================
*/
void idConsoleLocal::KeyDownEvent( int key )
{

	// Execute F key bindings
	if( key >= K_F1 && key <= K_F12 )
	{
		idKeyInput::ExecKeyBinding( key );
		return;
	}
	
	// ctrl-L clears screen
	if( key == K_L && ( idKeyInput::IsDown( K_LCTRL ) || idKeyInput::IsDown( K_RCTRL ) ) )
	{
		Clear();
		return;
	}
	
	// enter finishes the line
	if( key == K_ENTER || key == K_KP_ENTER )
	{
	
		common->Printf( "]%s\n", consoleField.GetBuffer() );
		
		cmdSystem->BufferCommandText( CMD_EXEC_APPEND, consoleField.GetBuffer() );	// valid command
		cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "\n" );
		
		// copy line to history buffer
		
		if( consoleField.GetBuffer()[ 0 ] != '\n' && consoleField.GetBuffer()[ 0 ] != '\0' )
		{
			consoleHistory.AddToHistory( consoleField.GetBuffer() );
		}
		
		consoleField.Clear();
		consoleField.SetWidthInChars( LINE_WIDTH );
		
		const bool captureToImage = false;
		common->UpdateScreen( captureToImage );// force an update, because the command
		// may take some time
		return;
	}
	
	// command completion
	
	if( key == K_TAB )
	{
		consoleField.AutoComplete();
		return;
	}
	
	// command history (ctrl-p ctrl-n for unix style)
	
	if( ( key == K_UPARROW ) ||
			( key == K_P && ( idKeyInput::IsDown( K_LCTRL ) || idKeyInput::IsDown( K_RCTRL ) ) ) )
	{
		idStr hist = consoleHistory.RetrieveFromHistory( true );
		if( !hist.IsEmpty() )
		{
			consoleField.SetBuffer( hist );
		}
		return;
	}
	
	if( ( key == K_DOWNARROW ) ||
			( key == K_N && ( idKeyInput::IsDown( K_LCTRL ) || idKeyInput::IsDown( K_RCTRL ) ) ) )
	{
		idStr hist = consoleHistory.RetrieveFromHistory( false );
		if( !hist.IsEmpty() )
		{
			consoleField.SetBuffer( hist );
		}
		else // DG: if no more lines are in the history, show a blank line again
		{
			consoleField.Clear();
		} // DG end
		
		return;
	}
	
	// console scrolling
	if( key == K_PGUP )
	{
		PageUp();
		lastKeyEvent = eventLoop->Milliseconds();
		nextKeyEvent = CONSOLE_FIRSTREPEAT;
		return;
	}
	
	if( key == K_PGDN )
	{
		PageDown();
		lastKeyEvent = eventLoop->Milliseconds();
		nextKeyEvent = CONSOLE_FIRSTREPEAT;
		return;
	}
	
	if( key == K_MWHEELUP )
	{
		PageUp();
		return;
	}
	
	if( key == K_MWHEELDOWN )
	{
		PageDown();
		return;
	}
	
	// ctrl-home = top of console
	if( key == K_HOME && ( idKeyInput::IsDown( K_LCTRL ) || idKeyInput::IsDown( K_RCTRL ) ) )
	{
		Top();
		return;
	}
	
	// ctrl-end = bottom of console
	if( key == K_END && ( idKeyInput::IsDown( K_LCTRL ) || idKeyInput::IsDown( K_RCTRL ) ) )
	{
		Bottom();
		return;
	}
	
	// pass to the normal editline routine
	consoleField.KeyDownEvent( key );
}