Exemplo n.º 1
0
static void
show_lowersubwin(int dore, WINDOW *tsubwin)
{
	int lines, cols;

	if (dore || COLS != xcols || LINES != xlines) {
		show_mainwin(1);
		if (!fullscreen) {
			if (LINES < 25)
				lines = LINES - 4 - 3;
			else
				lines = 25 - 4 - 3;
			if (COLS < 82)
				cols = COLS - 3 - 3;
			else
				cols = 80 - 3 - 3;
		} else {
			lines = LINES - 2 - 4 - 3;
			cols = COLS - 2 - 3 - 3;
		}
		wresize(tsubwin, lines, cols);
		mvderwin(tsubwin, 4, 3);
	}
	wrefresh(tsubwin);
}
Exemplo n.º 2
0
/*
 * test mvderwin().
 */
static bool
move_subwin(WINDOW *win)
{
    WINDOW *parent = parent_of(win);
    bool result = FALSE;

    if (parent != 0) {
	bool top = (parent == stdscr);
	if (!top) {
	    int min_col = top ? COL_MIN : 0;
	    int max_col = top ? COL_MAX : getmaxx(parent);
	    int min_line = top ? LINE_MIN : 0;
	    int max_line = top ? LINE_MAX : getmaxy(parent);
	    PAIR *tmp;

	    head_line("Select new position for subwindow");

	    if ((tmp = selectcell(parent,
				  min_line, min_col,
				  max_line, max_col)) != 0) {
		int y0, x0;
		getbegyx(parent, y0, x0);
		if (mvderwin(win, y0 + tmp->y, x0 + tmp->x) != ERR) {
		    refresh_all(win);
		    doupdate();
		    result = TRUE;
		}
	    }
	}
    }
    return result;
}
Exemplo n.º 3
0
/*---------------------------------------------------------------------------
|   Facility      :  libnmenu  
|   Function      :  void _nc_Show_Menu(const MENU *menu)
|   
|   Description   :  Update the window that is associated with the menu
|
|   Return Values :  -
+--------------------------------------------------------------------------*/
void _nc_Show_Menu(const MENU *menu)
{
  WINDOW *win;
  int maxy, maxx;
  
  assert(menu);
  if ( (menu->status & _POSTED) && !(menu->status & _IN_DRIVER) )
    {
      /* adjust the internal subwindow to start on the current top */
      assert(menu->sub);
      mvderwin(menu->sub,menu->spc_rows * menu->toprow,0);
      win = Get_Menu_Window(menu);
      
      maxy = getmaxy(win);
      maxx = getmaxx(win);	 
      
      if (menu->height < maxy) 
	maxy = menu->height;
      if (menu->width < maxx) 
	maxx = menu->width;
      
      copywin(menu->sub,win,0,0,0,0,maxy-1,maxx-1,0);
      pos_menu_cursor(menu);
    }	
}	
Exemplo n.º 4
0
void frame::set_position(const point& position) {
	CONS_ASSERT(handle, "inavlid handle");
	if(mvderwin(handle.get(), position.y, position.x)==ERR) {
		std::ostringstream oss;
		oss << "Unable to move frame to: " << position;
		throw CONS_MAKE_EXCEPTION(oss.str());
	}
	touchwin(handle.get());
}
Exemplo n.º 5
0
void
ide::Window::move(int x,int y)
{
	_left = x;
	_top  = y;
	
	if(_hidden==true)
		return;
	
	hide();
	
	if(_owner==FULLSCREEN) {	
		if(_bwin!=NULL) {
			mvwin(_bwin,y,x);
			int err=mvderwin(_win,1,1);
			//wprintw(_win,"%d",err);
			touchwin(_bwin);
			wrefresh(_win);
		}
		else {
			mvwin(_win,y,x);
			//wrefresh(_win);
		}
	}
	else {
		if(_bwin!=NULL) {
			mvderwin(_bwin,y,x);
			//wrefresh(_bwin);
		}
		else {
			mvderwin(_win,y,x);
			//wrefresh(_win);
		}
	}
	show();
}
Exemplo n.º 6
0
void
_show(MENU *m)
{
	int r, c;
	WINDOW *us;

	if (Posted(m) || Indriver(m)) {
		(void) mvderwin(Sub(m), Top(m), 0);
		us = US(m);
		getmaxyx(us, r, c);
		r = min(Height(m), r);
		c = min(Width(m), c);
		(void) copywin(Sub(m), us, 0, 0, 0, 0, r-1, c-1, FALSE);
		_position_cursor(m);
	}
}
Exemplo n.º 7
0
/*
 * test mvderwin().
 */
static bool
move_derwin(WINDOW *win)
{
    WINDOW *parent = parent_of(win);
    bool result = FALSE;

    if (parent != 0) {
	bool top = (parent == stdscr);
	int min_col = top ? COL_MIN : 0;
	int max_col = top ? COL_MAX : getmaxx(parent);
	int min_line = top ? LINE_MIN : 0;
	int max_line = top ? LINE_MAX : getmaxy(parent);
	PAIR *tmp;
	bool more;

	show_derwin(win);
	while ((tmp = selectcell(parent,
				 win,
				 min_line, min_col,
				 max_line, max_col,
				 TRUE,
				 &more)) != 0) {
	    if (mvderwin(win, tmp->y, tmp->x) != ERR) {
		refresh_all(win);
		doupdate();
		repaint_one(win);
		doupdate();
		result = TRUE;
		show_derwin(win);
	    } else {
		flash();
	    }
	    if (!more)
		break;
	}
    }
    head_line("done");
    return result;
}
Exemplo n.º 8
0
EIF_INTEGER c_ecurses_mvderwin (EIF_POINTER w, EIF_INTEGER par_y, EIF_INTEGER par_x)
{
    return mvderwin( ((WINDOW *) w) , (int) par_y,(int) par_x) ;
};
Exemplo n.º 9
0
mvwin(WINDOW *win, int by, int bx)
{
    T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx));

    if (!win || (win->_flags & _ISPAD))
	returnCode(ERR);

    /*
     * mvwin() should only modify the indices.  See test/demo_menus.c and
     * test/movewindow.c for examples.
     */
#if 0
    /* Copying subwindows is allowed, but it is expensive... */
    if (win->_flags & _SUBWIN) {
	int err = ERR;
	WINDOW *parent = win->_parent;
	if (parent) {		/* Now comes the complicated and costly part, you should really
				 * try to avoid to move subwindows. Because a subwindow shares
				 * the text buffers with its parent, one can't do a simple
				 * memmove of the text buffers. One has to create a copy, then
				 * to relocate the subwindow and then to do a copy.
				 */
	    if ((by - parent->_begy == win->_pary) &&
		(bx - parent->_begx == win->_parx))
		err = OK;	/* we don't actually move */
	    else {
		WINDOW *clone = dupwin(win);
		if (clone) {
		    /* now we have the clone, so relocate win */

		    werase(win);	/* Erase the original place     */
		    /* fill with parents background */
		    wbkgrnd(win, CHREF(parent->_nc_bkgd));
		    wsyncup(win);	/* Tell the parent(s)           */

		    err = mvderwin(win,
				   by - parent->_begy,
				   bx - parent->_begx);
		    if (err != ERR) {
			err = copywin(clone, win,
				      0, 0, 0, 0, win->_maxy, win->_maxx, 0);
			if (ERR != err)
			    wsyncup(win);
		    }
		    if (ERR == delwin(clone))
			err = ERR;
		}
	    }
	}
	returnCode(err);
    }
#endif

    if (by + win->_maxy > screen_lines - 1
	|| bx + win->_maxx > screen_columns - 1
	|| by < 0
	|| bx < 0)
	returnCode(ERR);

    /*
     * Whether or not the window is moved, touch the window's contents so
     * that a following call to 'wrefresh()' will paint the window at the
     * new location.  This ensures that if the caller has refreshed another
     * window at the same location, that this one will be displayed.
     */
    win->_begy = by;
    win->_begx = bx;
    returnCode(touchwin(win));
}
Exemplo n.º 10
0
void MoveDerWin(CWidget *widget, int x, int y)
{
    Check(mvderwin(widget->GetWin(), y, x), "mvderwin");
}