Beispiel #1
0
void rmpanel(PANEL *pan)
{
    WINDOW *win = pan->win;

    del_panel(pan);
    delwin(win);
}
Beispiel #2
0
/*
 * Deallocate the memory used for the given curses form and all of the
 * widgets it contains.  Note that this only frees any data at the form's
 * userdata pointer IFF cleanup is non-zero.  Also, it does not cause the
 * screen to be refreshed - call curses_form_refresh(NULL) afterwards to
 * make the form disappear.
 */
void
curses_form_free(struct curses_form *cf)
{
	struct curses_widget *w, *t;

	w = cf->widget_head;
	while (w != NULL) {
		t = w->next;
		curses_widget_free(w);
		w = t;
	}

	if (cf->help_text != NULL) {
		free(cf->help_text);
	}

	if (cf->cleanup && cf->userdata != NULL) {
		free(cf->userdata);
	}

	if (cf->win != NULL) {
		del_panel(cf->pan);
		delwin(cf->win);
	}

	free(cf->title);
	AURA_FREE(cf, curses_form);
}
Beispiel #3
0
void tx_errbox(char *message, char *prompt, int *response)
{
    WINDOW *win;
    PANEL *panel;

    win = newwin(4, 70, (LINES - 4) / 2, (COLS - 70) / 2);
    panel = new_panel(win);

    wattrset(win, ERR_BORDER_ATTR);
    tx_colorwin(win);
    tx_box(win, ACS_VLINE, ACS_HLINE);
    wmove(win, 2, 2);
    wattrset(win, ERR_PROMPT_ATTR);
    wprintw(win, "%s", prompt);
    wattrset(win, ERR_TEXT_ATTR);
    wmove(win, 1, 2);
    wprintw(win, "%s", message);
    update_panels();
    doupdate();

    do {
        *response = wgetch(win);
        if (*response == 12)
            tx_refresh_screen();
    } while (*response == 12);

    del_panel(panel);
    delwin(win);
    update_panels();
    doupdate();
}                                
Beispiel #4
0
/**
 * Close window and free allocated ram
 */
void closeWindow(struct panelw *p)
{
        wborder(p->win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
	delwin(p->win);
        del_panel(p->panel);
        refresh();
}
Beispiel #5
0
static void close_panel(PANEL *p)
{
	if (p) {
		del_panel(p);
		p = NULL;
	}
}
static VALUE rbncurs_c_del_panel(VALUE rb_panel) {
    VALUE panels_hash   = rb_iv_get(mPanel, "@panels_hash");
    PANEL* panel       = get_panel(rb_panel);
    VALUE panel_adress  = INT2NUM((long)(panel));
    rb_funcall(panels_hash, rb_intern("delete"), 1, panel_adress);
    rb_iv_set(rb_panel, "@destroyed", Qtrue);
    return INT2NUM(del_panel(panel));
}
Beispiel #7
0
void destroy_ui(ui_t *ui) {
  // chat panel and window
  del_panel(CHAT);
  delwin(ui->screen);
  ui_history_destroy(&chat_history);
  // log panel and window
  del_panel(LOG);
  delwin(ui->log);
  ui_history_destroy(&log_history);
  // alert panel and window
  del_panel(ALERT);
  delwin(ui->alert);
  // prompt window
  delwin(ui->prompt);

  endwin();
  free(ui);
}
Beispiel #8
0
/*
  window.__gc
  destroy the window

  Stack:
  1: the instance table
  2: the accessed key
*/
int		lui_destroy_window(lua_State *L)
{
    PANEL		*p;
    WINDOW	*w;

    p = check_window(L, 1);
    w = panel_window(p);
    del_panel(p);
    delwin(w);
    return 0;
}
Beispiel #9
0
void mydelwin(NEWWIN *win)
{
	if (win)
	{
		if (win -> pwin && ERR == del_panel(win -> pwin))
			error_exit(TRUE, "del_panel() failed\n");

		if (win -> win && ERR == delwin(win -> win))
			error_exit(TRUE, "delwin() failed\n");
	}
}
Beispiel #10
0
//--------------------------------------------------------------------
void ConWindow::close()
{
    if (pan) {
        del_panel(pan);
        pan = NULL;
    }

    if (win) {
        delwin(win);
        win = NULL;
    }
} // end ConWindow::close
Beispiel #11
0
CWidget::~CWidget()
{
	SafeDelete(_fwdDataSelect);

	del_panel(_panel);
	delwin(_window);

	_window = 0;
	_panel = 0;

	SafeDelete(_layout);
}
Beispiel #12
0
void panel_stack_rm(PANEL *panel) {
	WINDOW *win;
	
	if( (win = panel_window(panel) ) == NULL ) 
		err_exit(0, "could not get window from panel");

	if( del_panel(panel) == ERR ) 
		err_exit(0, "could not delete panel");
	
	if( delwin(win) == ERR )
		err_exit(0, "could not delete window");

}
static int value_list_free(struct value_list *vl)
{
	if (vl->panel) {
		del_panel(vl->panel);
	}
	if (vl->sub) {
		delwin(vl->sub);
	}
	if (vl->window) {
		delwin(vl->window);
	}

	return 0;
}
Beispiel #14
0
static void settimeout(time_t *value, const char *units, int allow_zero,
		       int *aborted)
{
	WINDOW *dlgwin;
	PANEL *dlgpanel;
	struct FIELDLIST field;
	time_t tmval = 0;

	dlgwin = newwin(7, 40, (LINES - 7) / 2, (COLS - 40) / 4);
	dlgpanel = new_panel(dlgwin);

	wattrset(dlgwin, DLGBOXATTR);
	tx_colorwin(dlgwin);
	tx_box(dlgwin, ACS_VLINE, ACS_HLINE);

	wattrset(dlgwin, DLGTEXTATTR);
	wmove(dlgwin, 2, 2);
	wprintw(dlgwin, "Enter value in %s", units);
	wmove(dlgwin, 5, 2);
	stdkeyhelp(dlgwin);

	tx_initfields(&field, 1, 10, (LINES - 7) / 2 + 3, (COLS - 40) / 4 + 2,
		      DLGTEXTATTR, FIELDATTR);
	tx_addfield(&field, 3, 0, 0, "");

	do {
		tx_fillfields(&field, aborted);

		if (!(*aborted)) {
			unsigned int tm;

			tmval = 0;
			int ret = strtoul_ui(field.list->buf, 10, &tm);
			if ((ret == -1) || (!allow_zero && (tm == 0)))
				tui_error(ANYKEY_MSG, "Invalid timeout value");
			else
				tmval = tm;
		}
	} while (((!allow_zero) && (tmval == 0)) && (!(*aborted)));

	if (!(*aborted))
		*value = tmval;

	del_panel(dlgpanel);
	delwin(dlgwin);

	tx_destroyfields(&field);
	update_panels();
	doupdate();
}
Beispiel #15
0
void
call_raw_destroy(PANEL *panel)
{
    call_raw_info_t *info;

    if ((info = call_raw_info(panel))) {
        // Delete panel windows
        delwin(info->pad);
        sng_free(info);
    }
    // Delete panel window
    delwin(panel_window(panel));
    // Delete panel
    del_panel(panel);
}
Beispiel #16
0
static void
my_remove_panel(PANEL ** pans, int which)
{
    if (pans[which] != 0) {
	PANEL *pan = pans[which];
	WINDOW *win = panel_window(pan);
	char *user = (char *) panel_userptr(pan);

	free(user);
	del_panel(pan);
	delwin(win);

	pans[which] = 0;
    }
}
Beispiel #17
0
void about(void)
{
	WINDOW *win;
	PANEL *panel;
	int ch;

	win = newwin(18, 62, (LINES - 17) / 2, (COLS - 62) / 2);

	panel = new_panel(win);

	tx_stdwinset(win);
	wtimeout(win, -1);
	wattrset(win, BOXATTR);
	tx_colorwin(win);
	tx_box(win, ACS_VLINE, ACS_HLINE);
	wattrset(win, STDATTR);
	mvwprintw(win, 1, 2, IPTRAF_NAME);
	mvwprintw(win, 2, 2, "An IP Network Statistics Utility");
	mvwprintw(win, 3, 2, "Version %s", IPTRAF_VERSION);
	mvwprintw(win, 5, 2, "Written by Gerard Paul Java");
	mvwprintw(win, 6, 2, "Copyright (c) Gerard Paul Java 1997-2004");
	mvwprintw(win, 8, 2, "This program is open-source software released");
	mvwprintw(win, 9, 2, "under the terms of the GNU General Public");
	mvwprintw(win, 10, 2, "Public License Version 2 or any later version.");
	mvwprintw(win, 11, 2, "See the included LICENSE file for details.");
	mvwprintw(win, 13, 2,
		  "IPv6 support by Markus Ullmann <*****@*****.**>");
	mvwprintw(win, 14, 2,
		  "inspired by 2.7.0 diff by Guy Martin <*****@*****.**>");

	wattrset(win, HIGHATTR);

	mvwprintw(win, 16, 2, ANYKEY_MSG);

	update_panels();
	doupdate();

	do {
		ch = wgetch(win);
		if (ch == 12)
			tx_refresh_screen();
	} while (ch == 12);

	del_panel(panel);
	delwin(win);
	update_panels();
	doupdate();
}
Beispiel #18
0
void
curses_bar_free(struct curses_bar *b)
{
	if (b != NULL) {
		if (b->pan != NULL) {
			del_panel(b->pan);
			if (b->win != NULL) {
				delwin(b->win);
			}
		}
		AURA_FREE(b, curses_bar);
	}

	update_panels();
	doupdate();
}
Beispiel #19
0
void tx_destroyfields(struct FIELDLIST *list)
{
	struct FIELD *ptmp = list->list;

	/* break the circular list */
	if (ptmp != NULL)
		ptmp->prevfield->nextfield = NULL;

	while (ptmp != NULL) {
		struct FIELD *pnext = ptmp->nextfield;

		free(ptmp);
		ptmp = pnext;
	}

	del_panel(list->fieldpanel);
	delwin(list->fieldwin);
}
Beispiel #20
0
int display_network_locked(WINDOW *mainw,struct panel_state *ps){
	memset(ps,0,sizeof(*ps));
	if(new_display_panel(mainw,ps,NETWORKROWS,0,L"press 'n' to dismiss display")){
		goto err;
	}
	update_network_details(panel_window(ps->p));
	return OK;

err:
	if(ps->p){
		WINDOW *psw = panel_window(ps->p);

		hide_panel(ps->p);
		del_panel(ps->p);
		delwin(psw);
	}
	memset(ps,0,sizeof(*ps));
	return ERR;
}
Beispiel #21
0
void Screen::notice(const char* msg)
{
  const char* dismiss="Press spacebar to dismiss";
  int greater=strlen(msg)>strlen(dismiss) ? strlen(msg) : strlen(dismiss);
  int ycoord= screenHeight>1 ? screenHeight/2-2 : 0;
  int xcoord=screenWidth>greater ? screenWidth/2-greater/2-1 : 0;
  WINDOW* dialog=newwin(4,greater+2,ycoord,xcoord);
  PANEL* dialog_panel=new_panel(dialog);
    box(dialog,0,0);
  mvwprintw(dialog,1,1+(greater-strlen(msg))/2,msg);
  mvwprintw(dialog,2,1+(greater-strlen(dismiss))/2,dismiss);
  panelRefresh();
  do;
    while(getch()!=' ');
  del_panel(dialog_panel);
  delwin(dialog);
  panelRefresh();

}
Beispiel #22
0
int display_bridging_locked(WINDOW *mainw,struct panel_state *ps){
	memset(ps,0,sizeof(*ps));
	if(new_display_panel(mainw,ps,BRIDGEROWS,0,L"press 'b' to dismiss display")){
		goto err;
	}
	//update_bridge_details(panel_window(ps->p));
	return OK;

err:
	if(ps->p){
		WINDOW *psw = panel_window(ps->p);

		hide_panel(ps->p);
		del_panel(ps->p);
		delwin(psw);
	}
	memset(ps,0,sizeof(*ps));
	return ERR;
}
Beispiel #23
0
int vuumuurconf_print_warning(const char *title, char *fmt, ...)
{
    va_list ap;
    char long_str[512] = "";

    WINDOW *err_win = NULL, *print_err_win = NULL;
    PANEL *my_panels[1];
    int height = 8, width, startx, starty, max_height, max_width;

    va_start(ap, fmt);
    vsnprintf(long_str, sizeof(long_str), fmt, ap);
    va_end(ap);

    getmaxyx(stdscr, max_height, max_width);
    width = (int)StrLen(long_str) + 15;
    if (width > max_width) {
        width = max_width - 10;
    }
    starty = (max_height - height) / 2;
    startx = (max_width - width) / 2;
    err_win = create_newwin(
            height, width, starty, startx, title, vccnf.color_win);
    assert(err_win);
    print_err_win = newwin(height - 4, width - 6, starty + 2, startx + 3);
    assert(print_err_win);
    wbkgd(print_err_win, vccnf.color_win);
    my_panels[0] = new_panel(err_win);
    keypad(err_win, TRUE);
    wprintw(print_err_win, "%s: %s", gettext("Warning"), long_str);
    mvwprintw(err_win, height - 2, 2, gettext("Press any key to continue..."));
    update_panels();
    doupdate();

    (void)wgetch(print_err_win);

    del_panel(my_panels[0]);
    destroy_win(print_err_win);
    destroy_win(err_win);
    update_panels();
    doupdate();
    return (0);
}
Beispiel #24
0
void destroy_statistic(struct statistic *s) {
    struct statistic_destructor *dtor, *dtornext;


    for(dtor = s->destructors; dtor; ) {
	dtornext = dtor->next;
	dtor->destructor(s, dtor->ptr);
	free(dtor);
	dtor = dtornext;
    }

    werase(s->window);
    del_panel(s->panel);
    delwin(s->window);
       
    if(s->header)
	free(s->header);

    free(s);    
}
Beispiel #25
0
static int
trafvol_section_destroy(void)
{
    size_t  i = 0;

    // Un post form and free the memory
    unpost_form(TrafVolSection.form);
    free_form(TrafVolSection.form);

    for(i = 0; i < TrafVolSection.n_fields; i++)
    {
        free_field(TrafVolSection.fields[i]);
    }
    free(TrafVolSection.fields);

    del_panel(TrafVolSection.panel[0]);
    destroy_win(TrafVolSection.win);

    return(0);
}
Beispiel #26
0
/**
 * Hides a specific message box
 */
void hide_message_box_win(WINDOW **win, PANEL **pan)
{
  char msg[500];
  wclear(*win);
  if (*pan != NULL) {
    sprintf(msg, "deleting *pan at %p\n", *pan);
    write_to_log(msg);
    del_panel(*pan);
    *pan = NULL;
    update_panels();
  }
  wrefresh(*win);
  if (*win != NULL) {
    sprintf(msg, "deleting *win at %p\n", *win);
    write_to_log(msg);
    delwin(*win);
    *win = NULL;
    /* doupdate(); */
  }
  refresh();
}
Beispiel #27
0
void destroyfields(struct FIELDLIST *list)
{
    struct FIELD *ptmp;
    struct FIELD *pnext;

    list->list->prevfield->nextfield = NULL;
    ptmp = list->list;
    pnext = list->list->nextfield;

    do {
	free(ptmp);

	ptmp = pnext;
	if (pnext != NULL) {
	    pnext = pnext->nextfield;
	}
    } while (ptmp != NULL);

    del_panel(list->fieldpanel);
    delwin(list->fieldwin);
}
Beispiel #28
0
/**
 * dest should have enough space (at least len) to hold the string.
 */
void get_text_string_from_centered_panel(char const *const prompt, char *dest, int len)
{
  WINDOW *panel_win;
  PANEL *the_panel;
  int panel_height=6,panel_width;
  /* char *dest = malloc(100); */

  int promptlen = strlen(prompt);
  panel_width = MAX(30, promptlen+5);

  /* Create the window to hold the panel */
  panel_win = newwin(panel_height,
                     panel_width,
                     (LINES-panel_height)/2,
                     (COLS-panel_width)/2);
  box(panel_win, 0, 0);
  print_in_middle(panel_win, 1,
          0, panel_width,
          prompt, COLOR_PAIR(6));
  wattron(panel_win, COLOR_PAIR(5));
  mvwhline(panel_win, 3, 2, ' ', panel_width-4);
  curs_set(1); // make cursor visible
  echo();
  mvwgetnstr(panel_win, 3, 2, dest, len);
  noecho();
  curs_set(0); // make cursor invisible
  wattroff(panel_win, COLOR_PAIR(5));
  
  /* create the panel from our window */
  the_panel = new_panel(panel_win);
  top_panel(the_panel);
  update_panels();
  doupdate();

  del_panel(the_panel);
  update_panels();
  delwin(panel_win);
  doupdate();
}
Beispiel #29
0
void
column_select_destroy(PANEL *panel)
{
    int i;
    column_select_info_t *info = column_select_info(panel);

    // Remove menu and items
    unpost_menu(info->menu);
    free_menu(info->menu);
    for (i = 0; i < SIP_ATTR_COUNT; i++)
        free_item(info->items[i]);

    // Remove form and fields
    unpost_form(info->form);
    free_form(info->form);
    for (i = 0; i < FLD_COLUMNS_COUNT; i++)
        free_field(info->fields[i]);

    // Remove panel window and custom info
    delwin(panel_window(panel));
    del_panel(panel);
    sng_free(info);

}
Beispiel #30
0
void destroymenu(struct MENU *menu)
{
    struct ITEM *tnode;
    struct ITEM *tnextnode;

    if (menu->itemlist != NULL) {
	tnode = menu->itemlist;
	tnextnode = menu->itemlist->next;

	tnode->prev->next = NULL;

	while (tnode != NULL) {
	    free(tnode);
	    tnode = tnextnode;

	    if (tnextnode != NULL)
		tnextnode = tnextnode->next;
	}
    }
    del_panel(menu->menupanel);
    delwin(menu->menuwin);
    update_panels();
    doupdate();
}