/* < terminfointerpreter_init */ void terminfointerpreter_init( cursor* theCursor) { ENTER("terminfointerpreter_init"); copyCursor(&myCursor, theCursor); copyCursor(&mySavedCursor, theCursor); /* from kernel 2.6.12 vt.c */ vc_tab_stop[0] = 0x01010100; vc_tab_stop[1] = vc_tab_stop[2] = vc_tab_stop[3] = vc_tab_stop[4] = 0x01010101; }
const Cursor& Cursor::fromType(Cursor::Type type) { switch (type) { case Cursor::Pointer: return pointerCursor(); case Cursor::Cross: return crossCursor(); case Cursor::Hand: return handCursor(); case Cursor::IBeam: return iBeamCursor(); case Cursor::Wait: return waitCursor(); case Cursor::Help: return helpCursor(); case Cursor::EastResize: return eastResizeCursor(); case Cursor::NorthResize: return northResizeCursor(); case Cursor::NorthEastResize: return northEastResizeCursor(); case Cursor::NorthWestResize: return northWestResizeCursor(); case Cursor::SouthResize: return southResizeCursor(); case Cursor::SouthEastResize: return southEastResizeCursor(); case Cursor::SouthWestResize: return southWestResizeCursor(); case Cursor::WestResize: return westResizeCursor(); case Cursor::NorthSouthResize: return northSouthResizeCursor(); case Cursor::EastWestResize: return eastWestResizeCursor(); case Cursor::NorthEastSouthWestResize: return northEastSouthWestResizeCursor(); case Cursor::NorthWestSouthEastResize: return northWestSouthEastResizeCursor(); case Cursor::ColumnResize: return columnResizeCursor(); case Cursor::RowResize: return rowResizeCursor(); case Cursor::MiddlePanning: return middlePanningCursor(); case Cursor::EastPanning: return eastPanningCursor(); case Cursor::NorthPanning: return northPanningCursor(); case Cursor::NorthEastPanning: return northEastPanningCursor(); case Cursor::NorthWestPanning: return northWestPanningCursor(); case Cursor::SouthPanning: return southPanningCursor(); case Cursor::SouthEastPanning: return southEastPanningCursor(); case Cursor::SouthWestPanning: return southWestPanningCursor(); case Cursor::WestPanning: return westPanningCursor(); case Cursor::Move: return moveCursor(); case Cursor::VerticalText: return verticalTextCursor(); case Cursor::Cell: return cellCursor(); case Cursor::ContextMenu: return contextMenuCursor(); case Cursor::Alias: return aliasCursor(); case Cursor::Progress: return progressCursor(); case Cursor::NoDrop: return noDropCursor(); case Cursor::Copy: return copyCursor(); case Cursor::None: return noneCursor(); case Cursor::NotAllowed: return notAllowedCursor(); case Cursor::ZoomIn: return zoomInCursor(); case Cursor::ZoomOut: return zoomOutCursor(); case Cursor::Grab: return grabCursor(); case Cursor::Grabbing: return grabbingCursor(); case Cursor::Custom: ASSERT_NOT_REACHED(); } return pointerCursor(); }
/* < terminfointerpreter */ void terminfointerpreter(gpointer theEntry, gpointer userData) { terminfoEntry* anEntry = (terminfoEntry*)theEntry; int aData1 = (int)(anEntry->myData1); int aData2 = (int)(anEntry->myData2); ENTER("terminfointerpreter"); DISPLAY_CAPACITY(anEntry->myCapacity); copyCursor(&(anEntry->myStartingPosition), &myCursor); switch(anEntry->myCapacity) { case CLEAR: /* myContext.myLinePortionIndex=-1; */ myCursor.myCol=0; myCursor.myLine=0; /* { /\* Erase the lines *\/ */ /* char* aOutput=NULL; */ /* struct t_cursor aFirstCursor; */ /* struct t_cursor aLastCursor; */ /* aFirstCursor.myLine=0; */ /* aFirstCursor.myCol=0; */ /* aLastCursor.myLine=myContext.myNumberOfLine - 1; */ /* aLastCursor.myCol=0; */ /* eraseLine( this, & aFirstCursor, & aLastCursor, &(myContext.myDefaultStyle), & aOutput); */ /* if (aOutput != NULL) */ /* { */ /* free(aOutput); */ /* } */ /* } */ break; case CUB1: if (myCursor.myCol!=0) { myCursor.myCol--; } break; case CUD1: myCursor.myLine++; break; case CR: myCursor.myCol=0; break; case NEL: myCursor.myLine++; myCursor.myCol=0; break; case CUF1: myCursor.myCol++; break; case CUP: myCursor.myLine = (aData1 > 0) ? aData1 - 1 : aData1; myCursor.myCol = (aData2 > 0) ? aData2 - 1 : aData2; break; case CUU: myCursor.myLine-=aData1; break; case DCH: /* delete characters (shorter line) */ /* aData1 gives the number of characters to delete */ /* deleteCharacter( this, & myContext.myCursor, aData1, theOutput); */ break; case DL: /* delete lines */ /* aData1 gives the number of lines to delete */ /* deleteLine( this, aData1, theOutput); */ break; case ECH: /* Erase characters (same line length) */ /* aData1 gives the number of characters to erase */ /* eraseCharacter( this, & myContext.myCursor, aData1, & myContext.myCursor.myStyle, theOutput); */ break; case ED: /* Clear the display after the cursor */ { /* struct t_cursor aFirstCursor; */ /* struct t_cursor aLastCursor; */ /* switch( aData1) */ /* { */ /* case 1: /\* erase from start to cursor *\/ */ /* aFirstCursor.myLine=0; */ /* aFirstCursor.myCol=0; */ /* aLastCursor.myLine = myContext.myCursor.myLine; */ /* aLastCursor.myCol = myContext.myCursor.myCol; */ /* break; */ /* case 2: /\* whole display *\/ */ /* aFirstCursor.myLine=0; */ /* aFirstCursor.myCol=0; */ /* aLastCursor.myLine=myContext.myNumberOfLine - 1; */ /* aLastCursor.myCol=myContext.myNumberOfCol - 1; */ /* break; */ /* case 0: /\* from cursor to end of display *\/ */ /* default: */ /* aFirstCursor.myLine = myContext.myCursor.myLine; */ /* aFirstCursor.myCol = myContext.myCursor.myCol; */ /* aLastCursor.myLine=myContext.myNumberOfLine - 1; */ /* aLastCursor.myCol=myContext.myNumberOfCol - 1; */ /* break; */ /* } */ /* eraseLine( this, &aFirstCursor, &aLastCursor, &(myContext.myCursor.myStyle), theOutput); */ } break; case EL: { /* struct t_cursor aFirstCursor; */ /* struct t_cursor aLastCursor; */ /* aFirstCursor.myLine = myContext.myCursor.myLine; */ /* aFirstCursor.myCol = myContext.myCursor.myCol; */ /* aLastCursor.myLine = aFirstCursor.myLine; */ /* switch( aData1) */ /* { */ /* case 1: /\* erase from start of line to cursor *\/ */ /* aLastCursor.myCol=0; */ /* break; */ /* case 2: /\* whole line *\/ */ /* aFirstCursor.myCol=0; */ /* aLastCursor.myCol=myContext.myNumberOfCol - 1; */ /* break; */ /* case 0: /\* from cursor to end of line *\/ */ /* default: */ /* aLastCursor.myCol=myContext.myNumberOfCol - 1; */ /* break; */ /* } */ /* eraseLine( this, &aFirstCursor, &aLastCursor, &(myContext.myCursor.myStyle), theOutput); */ } break; case HOME: myCursor.myCol=0; myCursor.myLine=0; break; case HPA: myCursor.myCol=aData1 - 1; break; case HT: /* from kernel 2.6.12 vt.c */ while (myCursor.myCol < 160) { myCursor.myCol++; if (vc_tab_stop[ myCursor.myCol >> 5] & (1 << (myCursor.myCol & 31))) break; } break; case ICH: /* insert n characters */ /* insertCol( this, myContext.myCursor.myCol + aData1 - 1, &(myContext.myCursor.myStyle), theOutput); */ break; case IL: /* several lines are added (the content is shifted to the bottom of the screen) */ break; case RC: myCursor.myCol=mySavedCursor.myCol; myCursor.myLine=mySavedCursor.myLine; break; case SC: mySavedCursor.myCol=myCursor.myCol; mySavedCursor.myLine=myCursor.myLine; break; case SGR: copyStyle( &(myCursor.myStyle), (style*)(anEntry->myData1)); DISPLAY_STYLE(&(myCursor.myStyle)); break; case VPA: myCursor.myLine=(aData1 > 0) ? aData1 - 1 : aData1; break; case TEXTFIELD: { GString* aString = anEntry->myData1; myCursor.myCol += strlen(aString->str); } break; default: case RMACS: case BEL: break; } SHOW3("myLine=%d, myCol=%d\n", myCursor.myLine, myCursor.myCol); }