Exemplo n.º 1
0
void UIAPI uigetcursor( ORD *row, ORD *col, CURSOR_TYPE *type, int *attr )
/************************************************************************/
{

    USHORT              length;
    CHAR                CharCellPair[2];
    VIOCURSORINFO       vioCursor;

    /* read cursor position */
    VioGetCurType(&vioCursor,0);
    VioGetCurPos( &r, &c, 0 );
    *row = r;
    *col = c;
    if( vioCursor.cEnd - vioCursor.yStart > 5 ) {
        *type = C_INSERT;
    } else {
        *type = C_NORMAL;
    }
    if( !UIData->cursor_on ) {
        *type = C_OFF;
    }
    /* read character and attribute */
    length = sizeof(CharCellPair);
    VioReadCellStr( &CharCellPair[0], &length, r, c, 0);
    *attr = CharCellPair[1];
}
Exemplo n.º 2
0
void Vid_Init(int mode)
{
   OldScreenData.cb=ScreenData.cb=sizeof(ScreenData);
   VioGetMode(&OldScreenData,hvio);
   memcpy(&ScreenData,&OldScreenData,sizeof(ScreenData));
   switch (mode)
      {
      case TEXT_25:
         ScreenData.row=25;
         ScreenData.vres=400;
         break;
      case TEXT_30:
         ScreenData.row=30;
         ScreenData.vres=480;
         break;
      }
VioSetMode(&ScreenData,hvio);
VioGetMode(&ScreenData,hvio);
CELL_SIZE=ScreenData.buf_length / (ScreenData.row * ScreenData.col);
VioGetCurType(&Save,hvio);
mAcurs=&Ins[1];
Ins[0].yStart=0;
Ins[0].cEnd=ScreenData.vres/ScreenData.row;
Ins[0].cx=1;
Ins[1].yStart=ScreenData.vres/ScreenData.row-2;
Ins[1].cEnd=ScreenData.vres/ScreenData.row;
Ins[1].cx=1;
VioSetCurType(&Ins[1],hvio);
}
Exemplo n.º 3
0
static void savecursor( void )
/****************************/
{
    CHAR                CharCellPair[2];
    USHORT              length;
    VIOCURSORINFO       vioCursor;

    /* read cursor position */

    VioGetCurType(&vioCursor,0);
    VioGetCurPos(&r, &c, 0);
         OldCursorRow = r;
         OldCursorCol = c;
    if( vioCursor.cEnd - vioCursor.yStart > 5 ) {
         OldCursorType = C_INSERT;
    }
     else {
         OldCursorType = C_NORMAL;
    }
    UIData->cursor_on = (  vioCursor.attr != (USHORT) -1 );
    if( !UIData->cursor_on ) {
         OldCursorType = C_OFF;
    }
    /* read character and attribute */
    length = sizeof(CharCellPair);
    VioReadCellStr( &CharCellPair[0], &length, r, c, 0);
    OldCursorAttr = CharCellPair[1];
}
Exemplo n.º 4
0
static int hb_gt_os2_GetCursorStyle( void )
{
   int iStyle;
   VIOCURSORINFO vi;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_GetCursorStyle()" ) );

   VioGetCurType( &vi, 0 );

   if( vi.attr )
      iStyle = SC_NONE;
   else
   {
      unsigned char charheight = hb_gt_os2_GetCharHeight();

      if( vi.yStart == 0 && vi.cEnd == 0 )
         iStyle = SC_NONE;

      else if( ( vi.yStart == charheight - 1 || vi.yStart == charheight - 2 ) &&
               vi.cEnd == charheight )
         iStyle = SC_NORMAL;

      else if( vi.yStart == charheight >> 1 && vi.cEnd == charheight )
         iStyle = SC_INSERT;

      else if( vi.yStart == 0 && vi.cEnd == charheight )
         iStyle = SC_SPECIAL1;

      else if( vi.yStart == 0 && vi.cEnd == charheight >> 1 )
         iStyle = SC_SPECIAL2;

      else
Exemplo n.º 5
0
static void vm_getcursorsize(char *start, char *end)
{
    VIOCURSORINFO vi;
    VioGetCurType(&vi, 0);
    *start = vi.yStart;
    *end = vi.cEnd;
}
void main(void)
{
   VIOCURSORINFO  CursorData;

   SHORT   start;
   SHORT   end;
   short   chr;

   VioGetCurType(&CursorData, (HVIO)0);
   start = CursorData.yStart;
   end = CursorData.cEnd;

   while(chr != 27)
   {
      chr = getch();
      if(chr == 'q') start--;
      if(chr == 'a') start++;
      if(chr == 'w') end--;
      if(chr == 's') end++;
      CursorData.yStart = start;
      CursorData.cEnd = end;
      VioSetCurType(&CursorData, (HVIO)0);
      if(chr == 13)
          cprintf("start: %d\n\r  end: %d\n\r", start, end);
   }
}
void ShowCursor (BOOL hide) {

  VIOCURSORINFO viocurs;

  memset(&viocurs,0,sizeof(viocurs));
  VioGetCurType(&viocurs,0);
  viocurs.attr = (hide) ? -1 : 0;
  VioSetCurType(&viocurs,0);
}
Exemplo n.º 8
0
static void DrawCursor(int Show) {
  VIOCURSORINFO vci;

  VioGetCurType(&vci, 0);

  if (Show == 1) vci.attr = 1;
  else vci.attr = (SHORT)-1;
  VioSetCurType(&vci, 0);
}
Exemplo n.º 9
0
/*
 * NewCursor - change cursor to insert mode type
 */
void NewCursor( window_id id, cursor_type ct )
{
    int                 base,nbase;
    VIOCURSORINFO       vioCursor;

    id = id;
    VioGetCurType( &vioCursor, 0 );
    base = vioCursor.cEnd;
    nbase = (base * (int)(100 - ct.height)) / 100;
    BIOSNewCursor( (char) nbase, base - 1 );

} /* NewCursor */
Exemplo n.º 10
0
void UIAPI uioffcursor( void )
/*****************************/
{
    VIOCURSORINFO vioCursor;

    if( UIData->cursor_on ) {
        /* set cursor size */
            VioGetCurType( &vioCursor, 0 );

           vioCursor.attr   = (USHORT)-1;        //invisible

           VioSetCurType(&vioCursor,0);

        UIData->cursor_on = false;
    }
    UIData->cursor_type = C_OFF;
}
Exemplo n.º 11
0
void UIAPI uioncursor( void )
/****************************/
{
    CHAR                CharCellPair[2];
    VIOCURSORINFO       vioCursor;


    VioGetCurType( &vioCursor, 0 );
    if( UIData->cursor_type == C_INSERT ) {
        vioCursor.yStart = vioCursor.cEnd / 2;
    } else {
        vioCursor.yStart = (vioCursor.cEnd * 7) / 8;
    }
    vioCursor.cx = 1;
    vioCursor.attr = 1;

    VioSetCurType(&vioCursor, 0);


    /* set cursor position */

    VioSetCurPos( UIData->cursor_row, UIData->cursor_col, 0);

    if( UIData->cursor_attr != -2 ) {
    /* get current character and attribute */

        VioGetCurPos( &r, &c, 0 );
        length = sizeof(CharCellPair);
        VioReadCellStr(&CharCellPair[0],
                       &length,
                       UIData->cursor_row,
                       UIData->cursor_col,
                       0);

        /* write out the character and the new attribute */
        CharCellPair[1] = UIData->cursor_attr;
        VioWrtNCell((PBYTE)&CharCellPair[0],
                    24,
                    UIData->cursor_row,
                    UIData->cursor_col,
                    0);

    }
    UIData->cursor_on = true;
}
Exemplo n.º 12
0
static void vm_getcursorsize(char *start, char *end)
{
    if (_osmode == DOS_MODE)
    {
        int cstart, cend;
        vi_init();
        v_getctype(&cstart, &cend);
        *start = (char)cstart;
        *end = (char)cend;
    }
    else
    {
        VIOCURSORINFO vi;
        VioGetCurType(&vi, 0);
        *start = vi.yStart;
        *end = vi.cEnd;
    }
}
Exemplo n.º 13
0
int SLang_init_tty(int abort_char, int dum2, int dum3)
{
  VIOCURSORINFO cursorInfo, OldcursorInfo;

  (void) dum2; (void) dum3;
   if (abort_char == -1) abort_char = 3;   /* ^C */
   SLang_Abort_Char = abort_char;
   SLKeyBoard_Quit = 0;

  /*  set ^C off */
  signal (SIGINT, SIG_IGN);
  signal (SIGBREAK, SIG_IGN);

  /* set up the keyboard */

  initialKbdInfo.cb = sizeof(initialKbdInfo);
  KbdGetStatus(&initialKbdInfo, 0);
  set_kbd();

  /* open a semaphore */
  CreateSem();

  /* start a separate thread to read the keyboard */
#if defined(__BORLANDC__)
  SLos2_threadID = _beginthread (thread_code, 8096, NULL);
#else
  SLos2_threadID = _beginthread (thread_code, NULL,  8096, NULL);
#endif

   if ((int)SLos2_threadID == -1)
     {
	SLang_exit_error ("init_tty: Error starting keyboard thread.");
     }

  VioGetCurType (&OldcursorInfo, 0);
  cursorInfo.yStart = 1;
  cursorInfo.cEnd = 15;
  cursorInfo.cx = 1;
  cursorInfo.attr = 1;
  if (VioSetCurType (&cursorInfo, 0))
    VioSetCurType (&OldcursorInfo, 0);   /* reset to previous value */

  return 0;
}
Exemplo n.º 14
0
void set_cursor (int flag)
{
    static int cursor_attrib = 0;
    
    VioGetCurType (pci, hvps);
    
    if (flag == 0)
    {
        if (pci->attr == 0xFFFF) return;
        cursor_attrib = pci->attr;
        pci->attr = 0xFFFF;
        VioSetCurType (pci, hvps);
    }
    else
    {
        if (pci->attr != 0xFFFF) return;
        pci->attr = cursor_attrib;
        VioSetCurType (pci, hvps);
    }
}
Exemplo n.º 15
0
int PDC_get_cursor_mode(void)
/***********************************************************************/
{
#ifdef EMXVIDEO
   int curstart=0, curend=0;
#else
   VIOCURSORINFO cursorInfo;
#endif
   short cmode=0;

#ifdef PDCDEBUG
   if (trace_on) PDC_debug("PDC_get_cursor_mode() - called\n");
#endif

#ifdef EMXVIDEO
   v_getctype (&curstart, &curend);
   cmode = ((curstart << 8) | (curend));
#else
   VioGetCurType (&cursorInfo, 0);
/* I am not sure about this JGB */
   cmode = ((cursorInfo.yStart << 8) | (cursorInfo.cEnd));
#endif
   return(cmode);
}
void VioInit( )
{
 APIRET      rc;
 UCHAR     **cpp;
 UINT        vlen;
 UINT        row;
 VIOMODEINFO md;

 memset(&md, 0, sizeof(md) );
 md.cb = sizeof(md);

 if( VioGetMode(&md, 0) )
 {
  printf( "Vio error" );
  exit(0);
 }

 VideoRows = md.row;
 VideoCols = md.col;
 MaxPer    = VideoRows - 2 ;            /* max # of lines of Code            */
 MaxData   = VideoRows * 2 / 3;         /* max # of rows for data window     */
 MinPer    = MaxPer - MaxData;          /* min # of lines of Code            */
 ProRow    = VideoRows - 3;             /* screen row for prompt (0..N)      */
 MenuRow   = VideoRows - 3;             /* screen row for menu bar (0..N)    */
 FnameRow  = VideoRows - 2;             /* screen row for file name (0..N)   */
 HelpRow   = VideoRows - 1;             /* screen row for menu help (0..N)   */
 MsgRow    = VideoRows - 1;             /* screen row for messages (0..N)    */
 LinesPer  = MaxPer - TopLine;          /* current # of lines per screen     */
                                        /* for source                        */
 VideoMap  = vaColor;

 if( md.color == 1 )
  VideoMap = vaMono;


    rc = VioGetBuf((PULONG)&VideoPtr, (PUSHORT)&vlen, 0);
    if( rc != 0 ){
        printf( "VioGetBuf() returned %d\n", rc );
        panic(OOquit);
    }
    if( ! HiddenCursor.attr ){
        rc = VioGetCurType(&NormalCursor,0);
        if( rc != 0 ){
            printf( "VioGetCurType() returned %d\n", rc );
            panic(OOquit);  }

        /*********************************************************************/
        /* If the cursor is in insert mode when we enter here then convert   */
        /* the parms of cursorinfo into a normal mode cursor.                */
        /*********************************************************************/
        if ((NormalCursor.cEnd - NormalCursor.yStart) > 2)
          NormalCursor.yStart = NormalCursor.cEnd -
                           ((NormalCursor.cEnd - NormalCursor.yStart - 1) / 4);
        NormalCursor.yStart -= 1;                                       /*112*/
        memcpy( &InsertCursor, &NormalCursor, sizeof(InsertCursor) );   /*100*/
        InsertCursor.yStart = 0;
        memcpy( &HiddenCursor, &NormalCursor, sizeof(HiddenCursor) );   /*100*/
        HiddenCursor.attr = -1;
    }

    /*************************************************************************/
    /* - Allocate memory for screen bounds                                400*/
    /* - set the bounds to the video cols                                 400*/
    /*************************************************************************/
    BoundPtr = Talloc(VideoRows);                                   /*521 518*/
    if (BoundPtr)                                                       /*518*/
       memset(BoundPtr,VideoCols,VideoRows);                            /*518*/
    else                                                                /*518*/
    {                                                                   /*518*/
        printf( "malloc failed\n");                                     /*518*/
        panic(OOquit);                                                  /*518*/
    }                                                                   /*518*/

    VioStartOffSet = 1;
    TopLine = 1;
    MenuRow  = 0;
    LinesPer = MaxPer - TopLine;
    InitDataWinCsr();
    AccessMouse();

    HideCursor();
    ClrScr( 0, VideoRows-1, vaBptOk );
    cpp = banner;
    for( row = BANNER_ROW; *cpp; cpp++,row++ )
    {
     putrc( row, (VideoCols-strlen(*cpp)) / 2, *cpp );
    }
}
Exemplo n.º 17
0
USHORT __pascal VIOGETCURTYPE(VIOCURSORINFO * CursorInfo, const HVIO Handle)
{
  return VioGetCurType(CursorInfo, Handle);
}
Exemplo n.º 18
0
static int os2vio_init(__AA_CONST struct aa_hardware_params *p,__AA_CONST  void *none, struct aa_hardware_params *dest, void *params)
{
  static struct aa_hardware_params def=
  {NULL,
   AA_DIM_MASK | AA_REVERSE_MASK | AA_NORMAL_MASK | AA_BOLD_MASK | AA_EXTENDED,
   0, 0,
   0, 0,
   80, 32,
   0, 0};
  BYTE bCell[2];
  VIOCURSORINFO hidecur;
#ifdef __EMX__
  int idx;
  struct sigaction   sa;
#endif  
  *dest=def;
  
  /* check size or prompt for it */
  if(p->width)
    width = p->width;
  else {
    char c[255];
    width = def.recwidth;
    if(p->recwidth)
      width = p->recwidth;
    printf("Width?[%i]", width);
    gets(c);
    sscanf(c, "%i", &width);
  }
  if (p->height)
    height = p->height;
  else {
    char c[256];
    height = def.recheight;
    if (p->recheight)
      height = p->recheight;
    printf("Height?[%i]", height);
    gets(c);
    sscanf(c, "%i", &height);
  }
  if (p->maxwidth && width > p->maxwidth)
    width = p->maxwidth;
  if (p->minwidth && width < p->minwidth)
    width = p->minwidth;
  if (p->maxheight && height > p->maxheight)
    height = p->maxheight;
  if (p->minheight && height < p->minheight)
    height = p->minheight;

  /* set font for modes that we know the size for, default vga16 */
  switch(height) {
  case 50:
    p->font = &aa_font8; break;
  case 43:
    p->font = &aa_font9; break;
  case 28:
    p->font = &aa_font14; break;
  }

  RowStr = (BYTE *)malloc(2 * width * sizeof(BYTE));
  if(RowStr==NULL) return 0;

  oldMode.cb=sizeof(VIOMODEINFO);
  VioGetMode((PVIOMODEINFO) &oldMode,(HVIO) 0);
  VioGetCurType(&oldCurInfo, (HVIO)0);
  memcpy((void *) &vio_mode, (const void *) &oldMode, sizeof(VIOMODEINFO));
  /* VIO, 80x50 */
  vio_mode.fbType = 1;
  vio_mode.color = 4;
  vio_mode.col = width;
  vio_mode.row = height;
  if(width>=132)
    vio_mode.hres = 1056;
  else
    vio_mode.hres = 720;
  vio_mode.vres = 400;
  vio_mode.fmt_ID = 0;
  vio_mode.attrib = 1;

  if (VioSetMode(&vio_mode, (HVIO) 0)) return 0;

#ifdef __EMX__
  /* under EMX, catch the signals to clean up proberly */

  sa.sa_handler = breakfunc;
  sa.sa_flags   = 0;
  sigemptyset(&sa.sa_mask);
  for (idx=SIGHUP;idx<=SIGTERM;idx++)  sigaction(idx,&sa,NULL);
#endif
  
  hidecur.attr = -1;
  VioSetCurType(&hidecur, (HVIO)0);
  
  bCell[0] = 0x20;
  bCell[1] = ( WM_BLACK << 4 ) + WM_PALEGRAY;
  
  VioScrollDn(TOP_ROW,LEFT_COL,0xFFFF,0xFFFF,0xFFFF,bCell,(HVIO) 0);

#ifdef 0
  printf("minwidth=%d\nminheight=%d\n", p->minwidth, p->minheight);
  printf("maxwidth=%d\nmaxheight=%d\n", p->maxwidth, p->maxheight);
  printf("recwidth=%d\nrecheight=%d\n", p->recwidth, p->recheight);
  printf("mmwidth=%d\nmmheight=%d\n", p->mmwidth, p->mmheight);
  printf("width=%d\nheight=%d\n", p->width, p->height);
  if(p->font!=NULL) {
    printf("fontheight=%d\n", p->font->height);
    printf("fontname=%s\n", p->font->name);
    printf("fontname(short)=%s\n", p->font->shortname);
  }
  getchar();
#endif

  return 1;
}