Esempio n. 1
0
void glk_request_hyperlink_event(winid_t win)
{
    gli_strict_warning("request_hyperlink_event: hyperlinks not supported.");
}
Esempio n. 2
0
void glk_set_hyperlink(glui32 linkval)
{
    gli_strict_warning("set_hyperlink: hyperlinks not supported.");
}
Esempio n. 3
0
void glk_set_hyperlink_stream(strid_t str, glui32 linkval)
{
    gli_strict_warning("set_hyperlink_stream: hyperlinks not supported.");
}
Esempio n. 4
0
void glk_window_fill_rect(winid_t win, glui32 color, 
    glsi32 left, glsi32 top, glui32 width, glui32 height)
{
    gli_strict_warning("window_fill_rect: graphics not supported.");
}
Esempio n. 5
0
void glk_window_set_background_color(winid_t win, glui32 color)
{
    gli_strict_warning("window_set_background_color: graphics not supported.");
}
Esempio n. 6
0
void glk_window_close(window_t *win, stream_result_t *result)
{
    if (!win) {
        gli_strict_warning("window_close: invalid ref");
        return;
    }
        
    if (win == gli_rootwin || win->parent == NULL) {
        /* close the root window, which means all windows. */
        
        gli_rootwin = 0;
        
        /* begin (simpler) closation */
        
        gli_stream_fill_result(win->str, result);
        gli_window_close(win, TRUE); 
        /* redraw everything */
        gli_windows_redraw();
    }
    else {
        /* have to jigger parent */
        grect_t box;
        window_t *pairwin, *sibwin, *grandparwin, *wx;
        window_pair_t *dpairwin, *dgrandparwin, *dwx;
        int keydamage_flag;
        
        pairwin = win->parent;
        dpairwin = pairwin->data;
        if (win == dpairwin->child1) {
            sibwin = dpairwin->child2;
        }
        else if (win == dpairwin->child2) {
            sibwin = dpairwin->child1;
        }
        else {
            gli_strict_warning("window_close: window tree is corrupted");
            return;
        }
        
        box = pairwin->bbox;

        grandparwin = pairwin->parent;
        if (!grandparwin) {
            gli_rootwin = sibwin;
            sibwin->parent = NULL;
        }
        else {
            dgrandparwin = grandparwin->data;
            if (dgrandparwin->child1 == pairwin)
                dgrandparwin->child1 = sibwin;
            else
                dgrandparwin->child2 = sibwin;
            sibwin->parent = grandparwin;
        }
        
        /* Begin closation */
        
        gli_stream_fill_result(win->str, result);

        /* Close the child window (and descendants), so that key-deletion can
            crawl up the tree to the root window. */
        gli_window_close(win, TRUE); 
        
        /* This probably isn't necessary, but the child *is* gone, so just
            in case. */
        if (win == dpairwin->child1) {
            dpairwin->child1 = NULL;
        }
        else if (win == dpairwin->child2) {
            dpairwin->child2 = NULL;
        }
        
        /* Now we can delete the parent pair. */
        gli_window_close(pairwin, FALSE);

        keydamage_flag = FALSE;
        for (wx=sibwin; wx; wx=wx->parent) {
            if (wx->type == wintype_Pair) {
                window_pair_t *dwx = wx->data;
                if (dwx->keydamage) {
                    keydamage_flag = TRUE;
                    dwx->keydamage = FALSE;
                }
            }
        }
        
        if (keydamage_flag) {
            box = content_box;
            gli_window_rearrange(gli_rootwin, &box);
            gli_windows_redraw();
        }
        else {
            gli_window_rearrange(sibwin, &box);
            gli_window_redraw(sibwin);
        }
    }
}
Esempio n. 7
0
glui32 glk_schannel_play(schanid_t chan, glui32 snd)
{
    gli_strict_warning("schannel_play: invalid id.");
    return 0;
}
Esempio n. 8
0
glui32 glk_image_draw(winid_t win, glui32 image, glsi32 val1, glsi32 val2)
{
    gli_strict_warning("image_draw: graphics not supported.");
    return FALSE;
}
Esempio n. 9
0
glui32 glk_image_draw_scaled(winid_t win, glui32 image, 
    glsi32 val1, glsi32 val2, glui32 width, glui32 height)
{
    gli_strict_warning("image_draw_scaled: graphics not supported.");
    return FALSE;
}
Esempio n. 10
0
void glk_sound_load_hint(glui32 snd, glui32 flag)
{
    gli_strict_warning("schannel_sound_load_hint: invalid id.");
}
Esempio n. 11
0
static char *xgrid_alloc_selection(window_textgrid_t *cutwin, 
  sdot_t *dot, long *lenv)
{
  long len, cx;
  int jx, sx;
  char *res;
  
  if (!DOT_EXISTS(dot) || DOT_LENGTH_ZERO(dot))
    return NULL;
  
  len = (dot->endline - dot->begline + 1) * (cutwin->width + 1) + 1;
  res = malloc(len);
  if (!res)
    return NULL;
  
  cx = 0;
  
  for (jx = dot->begline; jx <= dot->endline; jx++) {
    int begchar, endchar;
    sline_t *ln = &(cutwin->linelist[jx]);
    
    if (jx == dot->begline)
      begchar = dot->begchar;
    else
      begchar = 0;
    if (jx == dot->endline)
      endchar = dot->endchar;
    else
      endchar = cutwin->width;
    
    if (endchar >= begchar) {
      int ix, ix2;
      sattr_t *attr;
      ix = begchar;
      sx = find_style_at(ln, ix, 0);
      while (ix < endchar) {
	if (sx >= 0 && sx < ln->numattr) {
	  attr = &(ln->attr[sx]);
	  ix2 = attr->end;
	}
	else { 
	  attr = NULL;
	  ix2 = cutwin->width;
	}
	if (ix2 > endchar)
	  ix2 = endchar;
	
	if (!attr || attr->blank) {
	  int ix3;
	  if (!attr || sx == ln->numattr-1) {
	    /* skip trailing blanks */
	  }
	  else {
	    for (ix3 = ix; ix3 < ix2; ix3++) {
	      res[cx] = ' ';
	      cx++;
	    }
	  }
	}
	else {
	  memcpy(res+cx, ln->text + ix, ix2 - ix);
	  cx += (ix2 - ix);
	}
	
	ix = ix2;
	sx++;
      }
      
      if (jx < dot->endline) {
	res[cx] = '\n';
	cx++;
      }
    }
  }
  
  if (cx > len) {
    gli_strict_warning("xgrid_alloc_selection: overran allocation");
  }
  
  *lenv = cx;
  return res;
}
Esempio n. 12
0
void glk_schannel_set_volume(schanid_t chan, glui32 vol)
{
    gli_strict_warning("schannel_set_volume: invalid id.");
}
Esempio n. 13
0
void glk_schannel_stop(schanid_t chan)
{
    gli_strict_warning("schannel_stop: invalid id.");
}
Esempio n. 14
0
glui32 glk_schannel_play_ext(schanid_t chan, glui32 snd, glui32 repeats,
        glui32 notify)
{
    gli_strict_warning("schannel_play_ext: invalid id.");
    return 0;
}
Esempio n. 15
0
void glk_cancel_hyperlink_event(winid_t win)
{
    gli_strict_warning("cancel_hyperlink_event: hyperlinks not supported.");
}
Esempio n. 16
0
glui32 glk_image_get_info(glui32 image, glui32 *width, glui32 *height)
{
    gli_strict_warning("image_get_info: graphics not supported.");
    return FALSE;
}
Esempio n. 17
0
winid_t glk_window_open(winid_t splitwin, glui32 method, glui32 size, 
    glui32 wintype, glui32 rock)
{
    window_t *newwin, *pairwin, *oldparent;
    window_pair_t *dpairwin;
    grect_t box;
    glui32 val;
    
    if (!gli_rootwin) {
        if (splitwin) {
            gli_strict_warning("window_open: ref must be NULL");
            return 0;
        }
        /* ignore method and size now */
        oldparent = NULL;
        
        box = content_box;
    }
    else {
    
        if (!splitwin) {
            gli_strict_warning("window_open: ref must not be NULL");
            return 0;
        }
        
        val = (method & winmethod_DivisionMask);
        if (val != winmethod_Fixed && val != winmethod_Proportional) {
            gli_strict_warning("window_open: invalid method (not fixed or proportional)");
            return 0;
        }
        
        val = (method & winmethod_DirMask);
        if (val != winmethod_Above && val != winmethod_Below 
            && val != winmethod_Left && val != winmethod_Right) {
            gli_strict_warning("window_open: invalid method (bad direction)");
            return 0;
        }

        box = splitwin->bbox;
        
        oldparent = splitwin->parent;
        if (oldparent && oldparent->type != wintype_Pair) {
            gli_strict_warning("window_open: parent window is not Pair");
            return 0;
        }
    
    }
    
    newwin = gli_new_window(wintype, rock);
    if (!newwin) {
        gli_strict_warning("window_open: unable to create window");
        return 0;
    }
    
    switch (wintype) {
        case wintype_Blank:
            newwin->data = win_blank_create(newwin);
            break;
        case wintype_TextGrid:
            newwin->data = win_textgrid_create(newwin);
            break;
        case wintype_TextBuffer:
            newwin->data = win_textbuffer_create(newwin);
            break;
        case wintype_Pair:
            gli_strict_warning("window_open: cannot open pair window directly");
            gli_delete_window(newwin);
            return 0;
        default:
            /* Unknown window type -- do not print a warning, just return 0
                to indicate that it's not possible. */
            gli_delete_window(newwin);
            return 0;
    }
    
    if (!newwin->data) {
        gli_strict_warning("window_open: unable to create window");
        return 0;
    }
    
    if (!splitwin) {
        gli_rootwin = newwin;
        gli_window_rearrange(newwin, &box);
        /* redraw everything, which is just the new first window */
        gli_windows_redraw();
    }
    else {
        /* create pairwin, with newwin as the key */
        pairwin = gli_new_window(wintype_Pair, 0);
        dpairwin = win_pair_create(pairwin, method, newwin, size);
        pairwin->data = dpairwin;
            
        dpairwin->child1 = splitwin;
        dpairwin->child2 = newwin;
        
        splitwin->parent = pairwin;
        newwin->parent = pairwin;
        pairwin->parent = oldparent;

        if (oldparent) {
            window_pair_t *dparentwin = oldparent->data;
            if (dparentwin->child1 == splitwin)
                dparentwin->child1 = pairwin;
            else
                dparentwin->child2 = pairwin;
        }
        else {
            gli_rootwin = pairwin;
        }
        
        gli_window_rearrange(pairwin, &box);
        /* redraw the new pairwin and all its contents */
        gli_window_redraw(pairwin);
    }
    
    return newwin;
}
Esempio n. 18
0
void glk_window_flow_break(winid_t win)
{
    gli_strict_warning("window_flow_break: graphics not supported.");
}
Esempio n. 19
0
void glk_window_set_arrangement(window_t *win, glui32 method, glui32 size, 
    winid_t key)
{
    window_pair_t *dwin;
    glui32 newdir;
    grect_t box;
    int newvertical, newbackward;
    
    if (!win) {
        gli_strict_warning("window_set_arrangement: invalid ref");
        return;
    }
    
    if (win->type != wintype_Pair) {
        gli_strict_warning("window_set_arrangement: not a Pair window");
        return;
    }
    
    if (key) {
        window_t *wx;
        if (key->type == wintype_Pair) {
            gli_strict_warning("window_set_arrangement: keywin cannot be a Pair");
            return;
        }
        for (wx=key; wx; wx=wx->parent) {
            if (wx == win)
                break;
        }
        if (wx == NULL) {
            gli_strict_warning("window_set_arrangement: keywin must be a descendant");
            return;
        }
    }
    
    dwin = win->data;
    box = win->bbox;
    
    newdir = method & winmethod_DirMask;
    newvertical = (newdir == winmethod_Left || newdir == winmethod_Right);
    newbackward = (newdir == winmethod_Left || newdir == winmethod_Above);
    if (!key)
        key = dwin->key;

    if ((newvertical && !dwin->vertical) || (!newvertical && dwin->vertical)) {
        if (!dwin->vertical)
            gli_strict_warning("window_set_arrangement: split must stay horizontal");
        else
            gli_strict_warning("window_set_arrangement: split must stay vertical");
        return;
    }
    
    if (key && key->type == wintype_Blank 
        && (method & winmethod_DivisionMask) == winmethod_Fixed) {
        gli_strict_warning("window_set_arrangement: a Blank window cannot have a fixed size");
        return;
    }

    if ((newbackward && !dwin->backward) || (!newbackward && dwin->backward)) {
        /* switch the children */
        window_t *tmpwin = dwin->child1;
        dwin->child1 = dwin->child2;
        dwin->child2 = tmpwin;
    }
    
    /* set up everything else */
    dwin->dir = newdir;
    dwin->division = method & winmethod_DivisionMask;
    dwin->key = key;
    dwin->size = size;
    dwin->hasborder = ((method & winmethod_BorderMask) == winmethod_Border);
    
    dwin->vertical = (dwin->dir == winmethod_Left || dwin->dir == winmethod_Right);
    dwin->backward = (dwin->dir == winmethod_Left || dwin->dir == winmethod_Above);
    
    gli_window_rearrange(win, &box);
    gli_window_redraw(win);
}
Esempio n. 20
0
glui32 glk_schannel_get_rock(schanid_t chan)
{
    gli_strict_warning("schannel_get_rock: invalid id.");
    return 0;
}