Esempio n. 1
0
void deleteWindow (cc708_service_decoder *decoder, int window)
{
  if (window==decoder->current_window)
  {
    // If the current window is deleted, then the decoder's current window ID
    // is unknown and must be reinitialized with either the SetCurrentWindow
    // or DefineWindow command.
    decoder->current_window=-1;
  }
  //! @todo Do the actual deletion (remove from display if needed, etc), mark as
  // not defined, etc
  if (decoder->windows[window].is_defined)
  {
    clearWindowText(&decoder->windows[window]);
  }
  decoder->windows[window].is_defined=0;
}
Esempio n. 2
0
void clearWindow (cc708_service_decoder *decoder, int window)
{
  if (decoder->windows[window].is_defined)
    clearWindowText(&decoder->windows[window]);
}
Esempio n. 3
0
void handle_708_DFx_DefineWindow (cc708_service_decoder *decoder, int window, unsigned char *data)
{
  if (decoder->windows[window].is_defined &&
      memcmp (decoder->windows[window].commands, data+1, 6)==0)
  {
    return;
  }
  decoder->windows[window].number=window;
  int priority = (data[1]  ) & 0x7;
  int col_lock = (data[1]>>3) & 0x1;
  int row_lock = (data[1]>>4) & 0x1;
  int visible  = (data[1]>>5) & 0x1;
  int anchor_vertical = data[2] & 0x7f;
  int relative_pos = (data[2]>>7);
  int anchor_horizontal = data[3];
  int row_count = data[4] & 0xf;
  int anchor_point = data[4]>>4;
  int col_count = data[5] & 0x3f;
  int pen_style = data[6] & 0x7;
  int win_style = (data[6]>>3) & 0x7;
  col_count++; // These increments seems to be needed but no documentation
  row_count++; // backs it up

  if (anchor_vertical > I708_SCREENGRID_ROWS)
    anchor_vertical = I708_SCREENGRID_ROWS;

  decoder->windows[window].priority=priority;
  decoder->windows[window].col_lock=col_lock;
  decoder->windows[window].row_lock=row_lock;
  decoder->windows[window].visible=visible;
  decoder->windows[window].anchor_vertical=anchor_vertical;
  decoder->windows[window].relative_pos=relative_pos;
  decoder->windows[window].anchor_horizontal=anchor_horizontal;
  decoder->windows[window].row_count=row_count;
  decoder->windows[window].anchor_point=anchor_point;
  decoder->windows[window].col_count=col_count;
  decoder->windows[window].pen_style=pen_style;
  decoder->windows[window].win_style=win_style;
  if (!decoder->windows[window].is_defined)
  {
    // If the window is being created, all character positions in the window
    // are set to the fill color...
    //! @todo COLORS
    // ...and the pen location is set to (0,0)
    decoder->windows[window].pen_column=0;
    decoder->windows[window].pen_row=0;
    if (!decoder->windows[window].memory_reserved)
    {
      for (int i=0;i<=I708_MAX_ROWS;i++)
      {
        decoder->windows[window].rows[i]=(unsigned char *) malloc (I708_MAX_COLUMNS+1);
        if (decoder->windows[window].rows[i]==NULL) // Great
        {
          decoder->windows[window].is_defined=0;
          decoder->current_window=-1;
          for (int j=0;j<i;j++)
            free (decoder->windows[window].rows[j]);
          return; //! @todo Warn somehow
        }
      }
      decoder->windows[window].memory_reserved=1;
    }
    decoder->windows[window].is_defined=1;
    memset(&decoder->windows[window].attribs, 0, sizeof(e708Window_attribs));
    clearWindowText (&decoder->windows[window]);
  }

  // ...also makes the defined windows the current window (setCurrentWindow)
  handle_708_CWx_SetCurrentWindow (decoder, window);
  memcpy (decoder->windows[window].commands, data+1, 6);
}
Esempio n. 4
0
File: 708.cpp Progetto: MrMdR/julapy
void handle_708_DFx_DefineWindow (cc708_service_decoder *decoder, int window, unsigned char *data)
{
    printf ("    Entry in handle_708_DFx_DefineWindow, window [%d], attributes: \n", window);
    if (decoder->windows[window].is_defined &&
        memcmp (decoder->windows[window].commands, data+1, 6)==0)
    {
        // When a decoder receives a DefineWindow command for an existing window, the
        // command is to be ignored if the command parameters are unchanged from the
        // previous window definition.
        printf ("       Repeated window definition, ignored.\n");
        return;
    }
    decoder->windows[window].number=window;
    int priority = (data[1]  ) & 0x7;
    int col_lock = (data[1]>>3) & 0x1;
    int row_lock = (data[1]>>4) & 0x1;
    int visible  = (data[1]>>5) & 0x1;
    int anchor_vertical = data[2] & 0x7f;
    int relative_pos = (data[2]>>7);
    int anchor_horizontal = data[3];
    int row_count = data[4] & 0xf;
    int anchor_point = data[4]>>4;
    int col_count = data[5] & 0x3f;    
    int pen_style = data[6] & 0x7;
    int win_style = (data[6]>>3) & 0x7;
    printf ("                   Priority: [%d]        Column lock: [%3s]      Row lock: [%3s]\n",
        priority, col_lock?"Yes": "No", row_lock?"Yes": "No");
    printf ("                    Visible: [%3s]  Anchor vertical: [%2d]   Relative pos: [%s]\n",
        visible?"Yes": "No", anchor_vertical, relative_pos?"Yes": "No");
    printf ("          Anchor horizontal: [%3d]        Row count: [%2d]+1  Anchor point: [%d]\n",
        anchor_horizontal, row_count, anchor_point);
    printf ("               Column count: [%2d]1      Pen style: [%d]      Win style: [%d]\n",
        col_count, pen_style, win_style);
    col_count++; // These increments seems to be needed but no documentation
    row_count++; // backs it up
    decoder->windows[window].priority=priority;
    decoder->windows[window].col_lock=col_lock;
    decoder->windows[window].row_lock=row_lock;
    decoder->windows[window].visible=visible;
    decoder->windows[window].anchor_vertical=anchor_vertical;
    decoder->windows[window].relative_pos=relative_pos;
    decoder->windows[window].anchor_horizontal=anchor_horizontal;
    decoder->windows[window].row_count=row_count;
    decoder->windows[window].anchor_point=anchor_point;
    decoder->windows[window].col_count=col_count;
    decoder->windows[window].pen_style=pen_style;
    decoder->windows[window].win_style=win_style;
    if (!decoder->windows[window].is_defined)
    {
        // If the window is being created, all character positions in the window
        // are set to the fill color...
        // TODO: COLORS
        // ...and the pen location is set to (0,0)        
        decoder->windows[window].pen_column=0;
        decoder->windows[window].pen_row=0;
        if (!decoder->windows[window].memory_reserved)
        {
            for (int i=0;i<=I708_MAX_ROWS;i++)
            {
                decoder->windows[window].rows[i]=(unsigned char *) malloc (I708_MAX_COLUMNS+1);
                if (decoder->windows[window].rows[i]==NULL) // Great
                {
                    decoder->windows[window].is_defined=0; 
                    decoder->current_window=-1;
                    for (int j=0;j<i;j++)                
                        free (decoder->windows[window].rows[j]);
                    return; // TODO: Warn somehow
                }
            }        
            decoder->windows[window].memory_reserved=1;
        }
        decoder->windows[window].is_defined=1;
        clearWindowText (&decoder->windows[window]);
    }
    else
    {
        // Specs unclear here: Do we need to delete the text in the existing window?
        // We do this because one of the sample files demands it.
       //  clearWindowText (&decoder->windows[window]);
    }    
    // ...also makes the defined windows the current window (setCurrentWindow)
    handle_708_CWx_SetCurrentWindow (decoder, window);
    memcpy (decoder->windows[window].commands, data+1, 6);
}