Beispiel #1
0
void cOsdMenu::PageDown(void)
{
  int oldCurrent = current;
  int oldFirst = first;
  current += displayMenuItems;
  first += displayMenuItems;
  int last = Count() - 1;
  if (current > last)
     current = last;
  if (first + displayMenuItems > last)
     first = max(0, last - displayMenuItems + 1);
  int tmpCurrent = current;
  while (!SelectableItem(tmpCurrent) && ++tmpCurrent <= last)
        ;
  if (tmpCurrent > last) {
     tmpCurrent = current;
     while (--tmpCurrent >= 0 && !SelectableItem(tmpCurrent))
           ;
     }
  current = tmpCurrent > 0 ? tmpCurrent : -1;
  if (current >= 0) {
     if (current < first)
        first = current;
     else if (current - first >= displayMenuItems)
        first = current - displayMenuItems + 1;
     }
  if (current != oldCurrent || first != oldFirst) {
     Display();
     DisplayCurrent(true);
     }
  else if (Setup.MenuScrollWrap)
     CursorDown();
}
Beispiel #2
0
/*
 * Move the cursor to the first column of the n-th next line.
 */
void
CursorNextLine(TScreen *screen, int count)
{
	CursorDown(screen, count < 1 ? 1 : count);
	CarriageReturn(screen);
	do_xevents();
}
Beispiel #3
0
void DrawBox( int up_left_row, int up_left_col,
              int num_rows,    int num_cols ) {

  MoveCursor( up_left_row, up_left_col) ;
  UpLeftCorner() ;
  DrawHorizontal (num_cols - 2) ;
  UpRightCorner() ;
  CursorToLeft(1) ;
  CursorDown(1) ;
  DrawVertical (num_rows - 2) ;
  MoveCursor (up_left_row, up_left_col ) ;
  CursorDown(1) ;
  DrawVertical( num_rows - 2 ) ;
  LowerLeftCorner() ;
  DrawHorizontal( num_cols - 2 ) ;
  LowerRightCorner() ;
}
Beispiel #4
0
/*
 * Move the cursor to the first column of the n-th next line.
 */
void
CursorNextLine(XtermWidget xw, int count)
{
    TScreen *screen = TScreenOf(xw);

    CursorDown(screen, count < 1 ? 1 : count);
    CarriageReturn(xw);
    do_xevents();
}
Beispiel #5
0
/*
 * Moves cursor down amount lines, scrolls if necessary.
 * Won't leave scrolling region. No carriage return.
 */
void
xtermIndex(register TScreen *screen, register int amount)
{
	register int j;

	/*
	 * indexing when below scrolling region is cursor down.
	 * if cursor high enough, no scrolling necessary.
	 */
	if (screen->cur_row > screen->bot_marg
	 || screen->cur_row + amount <= screen->bot_marg) {
		CursorDown(screen, amount);
		return;
	}

	CursorDown(screen, j = screen->bot_marg - screen->cur_row);
	xtermScroll(screen, amount - j);
}
Beispiel #6
0
void TraceWindow::OnKeyDown(u32 p_vk, bool p_ctrl, bool p_shift) {
  switch (p_vk) {
  case VK_RETURN:
    if (m_sel >= 0 && m_sel < GetAllLine()) {
      if (m_category == kCat_CallStack) {
        g_dbg->code_window()->AutoJumpModule(g_dbg->callstack(m_sel)->jva());
        g_dbg->code_window()->SelectAddress(g_dbg->callstack(m_sel)->jva());
      } else if (m_category == kCat_JumpLog) {
        g_dbg->code_window()->AutoJumpModule(g_dbg->jumplog(m_sel)->va());
        g_dbg->code_window()->SelectAddress(g_dbg->jumplog(m_sel)->va());
      }
    }
    break;
  case VK_UP:    CursorUp(1); break;
  case VK_PRIOR:  CursorUp(GetPageLine()); break;    // PageUp
  case VK_DOWN:  CursorDown(1); break;
  case VK_NEXT:  CursorDown(GetPageLine()); break;  // PageDown
  }
}
Beispiel #7
0
void DrawVertical( int numrows ) {
  int row ;
  SpecialCharacterSetOn();
  for (row = 1 ; row <= numrows ; row++) {
    cout << 'x' ;
    CursorToLeft(1) ;
    CursorDown(1) ;
  }
  SpecialCharacterSetOff() ;
}
Beispiel #8
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;
}
Beispiel #9
0
/*
 * Moves cursor down amount lines, scrolls if necessary.
 * Won't leave scrolling region. No carriage return.
 */
void
xtermIndex(XtermWidget xw, int amount)
{
    TScreen *screen = TScreenOf(xw);
    int j;

    /*
     * indexing when below scrolling region is cursor down.
     * if cursor high enough, no scrolling necessary.
     */
    if (screen->cur_row > screen->bot_marg
	|| screen->cur_row + amount <= screen->bot_marg
	|| (IsLeftRightMode(xw)
	    && !ScrnIsColInMargins(screen, screen->cur_col))) {
	CursorDown(screen, amount);
    } else {
	CursorDown(screen, j = screen->bot_marg - screen->cur_row);
	xtermScroll(xw, amount - j);
    }
}
Beispiel #10
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;
}
Beispiel #11
0
void CScreenDevice::NewLine (void)
{
	CarriageReturn ();
	CursorDown ();
}
Beispiel #12
0
void CScreenDevice::Write (char chChar)
{
	switch (m_nState)
	{
	case ScreenStateStart:
		switch (chChar)
		{
		case '\b':
			CursorLeft ();
			break;

		case '\t':
			Tabulator ();
			break;

		case '\n':
			NewLine ();
			break;

		case '\r':
			CarriageReturn ();
			break;

		case '\x1b':
			m_nState = ScreenStateEscape;
			break;

		default:
			DisplayChar (chChar);
			break;
		}
		break;

	case ScreenStateEscape:
		switch (chChar)
		{
		case 'M':
			ReverseScroll ();
			m_nState = ScreenStateStart;
			break;

		case '[':
			m_nState = ScreenStateBracket;
			break;

		default:
			m_nState = ScreenStateStart;
			break;
		}
		break;

	case ScreenStateBracket:
		switch (chChar)
		{
		case '?':
			m_nState = ScreenStateQuestionMark;
			break;

		case 'A':
			CursorUp ();
			m_nState = ScreenStateStart;
			break;

		case 'B':
			CursorDown ();
			m_nState = ScreenStateStart;
			break;

		case 'C':
			CursorRight ();
			m_nState = ScreenStateStart;
			break;

		case 'H':
			CursorHome ();
			m_nState = ScreenStateStart;
			break;

		case 'J':
			ClearDisplayEnd ();
			m_nState = ScreenStateStart;
			break;

		case 'K':
			ClearLineEnd ();
			m_nState = ScreenStateStart;
			break;

		case 'L':
			InsertLines (1);
			m_nState = ScreenStateStart;
			break;

		case 'M':
			DeleteLines (1);
			m_nState = ScreenStateStart;
			break;

		case 'P':
			DeleteChars (1);
			m_nState = ScreenStateStart;
			break;

		default:
			if ('0' <= chChar && chChar <= '9')
			{
				m_nParam1 = chChar - '0';
				m_nState = ScreenStateNumber1;
			}
			else
			{
				m_nState = ScreenStateStart;
			}
			break;
		}
		break;

	case ScreenStateNumber1:
		switch (chChar)
		{
		case ';':
			m_nState = ScreenStateSemicolon;
			break;

		case 'L':
			InsertLines (m_nParam1);
			m_nState = ScreenStateStart;
			break;

		case 'M':
			DeleteLines (m_nParam1);
			m_nState = ScreenStateStart;
			break;

		case 'P':
			DeleteChars (m_nParam1);
			m_nState = ScreenStateStart;
			break;

		case 'X':
			EraseChars (m_nParam1);
			m_nState = ScreenStateStart;
			break;

		case 'h':
		case 'l':
			if (m_nParam1 == 4)
			{
				InsertMode (chChar == 'h');
			}
			m_nState = ScreenStateStart;
			break;
			
		case 'm':
			SetStandoutMode (m_nParam1);
			m_nState = ScreenStateStart;
			break;

		default:
			if ('0' <= chChar && chChar <= '9')
			{
				m_nParam1 *= 10;
				m_nParam1 += chChar - '0';

				if (m_nParam1 > 99)
				{
					m_nState = ScreenStateStart;
				}
			}
			else
			{
				m_nState = ScreenStateStart;
			}
			break;
		}
		break;

	case ScreenStateSemicolon:
		if ('0' <= chChar && chChar <= '9')
		{
			m_nParam2 = chChar - '0';
			m_nState = ScreenStateNumber2;
		}
		else
		{
			m_nState = ScreenStateStart;
		}
		break;

	case ScreenStateQuestionMark:
		if ('0' <= chChar && chChar <= '9')
		{
			m_nParam1 = chChar - '0';
			m_nState = ScreenStateNumber3;
		}
		else
		{
			m_nState = ScreenStateStart;
		}
		break;

	case ScreenStateNumber2:
		switch (chChar)
		{
		case 'H':
			CursorMove (m_nParam1, m_nParam2);
			m_nState = ScreenStateStart;
			break;

		case 'r':
			SetScrollRegion (m_nParam1, m_nParam2);
			m_nState = ScreenStateStart;
			break;

		default:
			if ('0' <= chChar && chChar <= '9')
			{
				m_nParam2 *= 10;
				m_nParam2 += chChar - '0';

				if (m_nParam2 > 199)
				{
					m_nState = ScreenStateStart;
				}
			}
			else
			{
				m_nState = ScreenStateStart;
			}
			break;
		}
		break;

	case ScreenStateNumber3:
		switch (chChar)
		{
		case 'h':
		case 'l':
			if (m_nParam1 == 25)
			{
				SetCursorMode (chChar == 'h');
			}
			m_nState = ScreenStateStart;
			break;

		default:
			if ('0' <= chChar && chChar <= '9')
			{
				m_nParam1 *= 10;
				m_nParam1 += chChar - '0';

				if (m_nParam1 > 99)
				{
					m_nState = ScreenStateStart;
				}
			}
			else
			{
				m_nState = ScreenStateStart;
			}
			break;
		}
		break;

	default:
		m_nState = ScreenStateStart;
		break;
	}
}
Beispiel #13
0
MoveCursor (x, y) {
    if (x != CursorX || y != CursorY || !CursorVisible) {
	register struct SplitWindow *w = RootWindow[CursorDisplayNumber];
	CursorDown ();
	CursorX = x;
	CursorY = y;
	{
	    struct display *d = &displays[CursorDisplayNumber];

	    x += d->screen.left;
	    y += d->screen.top;
	}
	if (MovingBar)
	    LastCursorDrawn = MovingBar -> SplitHorizontally ? HorizontalCursor : VerticalCursor;
	else
	    if (Reshapee)
		LastCursorDrawn = Reshapee_x < 0 ? UpperLeftCursor : LowerRightCursor;
	    else
		if (MenuActive) {
		    LastCursorDrawn = RightFingerCursor;
		    MenuActive = 1;
		}
		else {
		    while (w && w -> t.type == SplitWindowType) {
			register    diff = w -> SplitValue - (w -> SplitHorizontally ? y : x);
			if (diff < -BorderWidth)
			    w = w -> bottom;
			else
			    if (diff >= BorderWidth)
				w = w -> top;
			    else
				break;
		    }
		    CursorWindow = W;
		    if (w == 0)
			LastCursorDrawn = 0;
		    else if (w -> t.type == SplitWindowType)
				if (w -> SplitHorizontally)
				    LastCursorDrawn = HorizontalCursor;
				else
				    LastCursorDrawn = VerticalCursor;
			 else {
			     register struct WindowRegion *r;
			     register area = 999999;
			     if (CursorWindow != WindowInFocus && FocusFollowsCursor)
				SetInputFocus (W);
			     LastCursorDrawn = W -> Cursor;
			     if (W -> MaxRegion >= 0)
			     for (r = &W -> regions[W -> MaxRegion];
					r >= W -> regions; r--) {
				struct icon *Cursor;
				if (x >= r -> region.left
				 && y >= r -> region.top
				 && area > r -> area
				 && (Cursor = W -> regions[r->linked].Cursor)
				 && x < r -> region.left + r -> region.width
				 && y < r -> region.top + r -> region.height) {
				     LastCursorDrawn = Cursor;
				     area = r -> area;
				 }
 			    }			
			 }
		}
	DrawCursor ();
	CursorVisible = 1;
    }
}