void create_device_name_form(void)
{
	fields[0] = new_field(1, 32, 1, 1, 0, 0);
	if (!fields[0])
		fatal_error("cannot create field");
	field_opts_off(fields[0], O_ACTIVE);
	field_opts_off(fields[0], O_EDIT);
	set_field_fore(fields[0], attr_textbox);
	set_field_back(fields[0], attr_textbox);
	set_field_buffer(fields[0], 0, _("Device name:"));

	fields[1] = new_field(1, 32, 2, 1, 0, 0);
	if (!fields[1])
		fatal_error("cannot create field");
	field_opts_off(fields[1], O_AUTOSKIP);
	field_opts_off(fields[1], O_NULLOK);
	field_opts_off(fields[1], O_STATIC);
	set_field_fore(fields[1], attr_textfield);
	set_field_back(fields[1], attr_textfield);
	set_field_buffer(fields[1], 0, mixer_device_name);

	form = new_form(fields);
	if (!form)
		fatal_error("cannot create form");

	if (!create())
		return;

	post_form(form);
}
/* fill in the modify parameters form */
static void modify_parameters_form_init(FORM *myform) {
  
char temp[9];

  sprintf(temp, "%.3f", bullet.bc);
  set_field_buffer(field_items_ptr[0], 0, temp);
  sprintf(temp, "%.3f", bullet.weight);
  set_field_buffer(field_items_ptr[1], 0, temp);
  sprintf(temp, "%.3f", wind.z);
  set_field_buffer(field_items_ptr[2], 0, temp);
  sprintf(temp, "%.3f", firearm.v0);
  set_field_buffer(field_items_ptr[3], 0, temp);
  sprintf(temp, "%.3f", firearm.height);
  set_field_buffer(field_items_ptr[4], 0, temp);
  sprintf(temp, "%.3f", firearm.zero);
  set_field_buffer(field_items_ptr[5], 0, temp);
  sprintf(temp, "%.3f", firearm.angle);
  set_field_buffer(field_items_ptr[6], 0, temp);
  sprintf(temp, "%.3f", printparam.start);
  set_field_buffer(field_items_ptr[7], 0, temp);
  sprintf(temp, "%.3f", printparam.end);
  set_field_buffer(field_items_ptr[8], 0, temp);
  sprintf(temp, "%.3f", printparam.step);
  set_field_buffer(field_items_ptr[9], 0, temp);

}
Beispiel #3
0
/* 
 * add a field to the form 
 */
void wdg_input_add(wdg_t *wo, size_t x, size_t y, const char *caption, char *buf, size_t len, size_t lines)
{
   WDG_WO_EXT(struct wdg_input_handle, ww);
   
   ww->nfields += 2;
   WDG_SAFE_REALLOC(ww->fields, ww->nfields * sizeof(FIELD *));

   /* remember the pointer to the real buffer (to be used in consolidate) */
   WDG_SAFE_REALLOC(ww->buffers, (ww->nfields/2 + 1) * sizeof(char *));
   ww->buffers[ww->nfields/2 - 1] = buf;
   ww->buffers[ww->nfields/2] = NULL;

   /* create the caption */
   ww->fields[ww->nfields - 2] = new_field(1, strlen(caption), y, x, 0, 0);
   set_field_buffer(ww->fields[ww->nfields - 2], 0, caption);
   field_opts_off(ww->fields[ww->nfields - 2], O_ACTIVE);
   set_field_fore(ww->fields[ww->nfields - 2], COLOR_PAIR(wo->focus_color));

   /* and the modifiable field */
   ww->fields[ww->nfields - 1] = new_field(lines, len, y, x + strlen(caption) + 2, 0, 0);
   set_field_back(ww->fields[ww->nfields - 1], A_UNDERLINE);
   field_opts_off(ww->fields[ww->nfields - 1], O_WRAP);
   set_field_buffer(ww->fields[ww->nfields - 1], 0, buf);
   set_field_fore(ww->fields[ww->nfields - 1], COLOR_PAIR(wo->window_color));
   
   /* null terminate the array */
   WDG_SAFE_REALLOC(ww->fields, (ww->nfields + 1) * sizeof(FIELD *));
   ww->fields[ww->nfields] = NULL;

}
Beispiel #4
0
/* calculate bc form term function */
static void calc_bc_form_init(FORM *myform) {
  
char temp[FORM_FIELD_WIDTH+1];

  snprintf(temp,FORM_FIELD_WIDTH+1, "%.3f",calc_bc_param.x0);
  set_field_buffer(field_items_ptr[0], 0, temp);
  snprintf(temp,FORM_FIELD_WIDTH+1, "%.3f",calc_bc_param.v0);
  set_field_buffer(field_items_ptr[1], 0, temp);
  snprintf(temp,FORM_FIELD_WIDTH+1, "%.3f",calc_bc_param.x1);
  set_field_buffer(field_items_ptr[2], 0, temp);
  snprintf(temp,FORM_FIELD_WIDTH+1, "%.3f",calc_bc_param.v1);
  set_field_buffer(field_items_ptr[3], 0, temp);

}
Beispiel #5
0
int
save_draw(ui_t *ui)
{
    char field_value[80];

    // Get panel information
    save_info_t *info = save_info(ui);

    // Get filter stats
    sip_stats_t stats = sip_calls_stats();

    mvwprintw(ui->win, 7, 3, "( ) all dialogs ");
    mvwprintw(ui->win, 8, 3, "( ) selected dialogs [%d]", call_group_count(info->group));
    mvwprintw(ui->win, 9, 3, "( ) filtered dialogs [%d]", stats.displayed);

    // Print 'current SIP message' field label if required
    if (info->msg != NULL)
        mvwprintw(ui->win, 10, 3, "( ) current SIP message");

    mvwprintw(ui->win, 7, 35, "( ) .pcap (SIP)");
    mvwprintw(ui->win, 8, 35, "( ) .pcap (SIP + RTP)");
    mvwprintw(ui->win, 9, 35, "( ) .txt");

    // Get filename field value.
    memset(field_value, 0, sizeof(field_value));
    strcpy(field_value, field_buffer(info->fields[FLD_SAVE_FILE], 0));
    strtrim(field_value);

    mvwprintw(ui->win, 4, 60, "     ");
    if (strstr(field_value, ".pcap")) {
        info->saveformat = (setting_enabled(SETTING_CAPTURE_RTP))? SAVE_PCAP_RTP : SAVE_PCAP;
    } else if (strstr(field_value, ".txt")) {
        info->saveformat = SAVE_TXT;
    } else {
        if (info->saveformat == SAVE_PCAP || info->saveformat == SAVE_PCAP_RTP)
            mvwprintw(ui->win, 4, 60, ".pcap");
        else
            mvwprintw(ui->win, 4, 60, ".txt ");
    }

    set_field_buffer(info->fields[FLD_SAVE_ALL], 0, (info->savemode == SAVE_ALL) ? "*" : " ");
    set_field_buffer(info->fields[FLD_SAVE_SELECTED], 0,
                     (info->savemode == SAVE_SELECTED) ? "*" : " ");
    set_field_buffer(info->fields[FLD_SAVE_DISPLAYED], 0,
                     (info->savemode == SAVE_DISPLAYED) ? "*" : " ");
    set_field_buffer(info->fields[FLD_SAVE_MESSAGE], 0,
                     (info->savemode == SAVE_MESSAGE) ? "*" : " ");
    set_field_buffer(info->fields[FLD_SAVE_PCAP], 0, (info->saveformat == SAVE_PCAP) ? "*" : " ");
    set_field_buffer(info->fields[FLD_SAVE_PCAP_RTP], 0, (info->saveformat == SAVE_PCAP_RTP) ? "*" : " ");
    set_field_buffer(info->fields[FLD_SAVE_TXT], 0, (info->saveformat == SAVE_TXT) ? "*" : " ");

    // Show disabled options with makers
    if (!setting_enabled(SETTING_CAPTURE_RTP))
        set_field_buffer(info->fields[FLD_SAVE_PCAP_RTP], 0, "-");

    set_current_field(info->form, current_field(info->form));
    form_driver(info->form, REQ_VALIDATION);

    return 0;
}
Beispiel #6
0
bool InputForm::Init()
{
  field = (FIELD **)calloc(choices*2+1, sizeof(FIELD *));
  for (int i = 0; i < choices; ++i)
  {
    field[2*i] = new_field(1, 30, 4+i*2, 2, 02, 02);
    field[2*i+1] = new_field(1, 20, 4+i*2, 30, 02, 02);
    set_field_back(field[2*i+1], A_UNDERLINE);
    field_opts_off(field[2*i+1], O_AUTOSKIP);
    set_field_buffer(field[2*i], 0, itemNames[i].c_str());
    set_field_back(field[2*i], O_EDIT);
  }
  field[choices*2] = NULL;
  form = new_form(field);
  scale_form(form, &formRows, &formCols);
  win = newwin(formRows+8, formCols+20, LINES/2-formRows/2 -6, COLS/2-10-formCols/2);
  keypad(win, TRUE);
  set_form_win(form, win);
  set_form_sub(form, derwin(win, formRows, formCols, 2, 2));
  box(win, 0, 0);
  wattron(win, COLOR_PAIR(1));
  
  mvwprintw(win, 0, formCols/2+8-title.size()/2, "%s", title.c_str());
  wattroff(win, COLOR_PAIR(1));
  post_form(form);
  panel = new_panel(win);
  switchOkCancle();
  
  update_panels();
  doupdate();
  form_driver(form, REQ_NEXT_FIELD);
  return true;
}
Beispiel #7
0
/*
 *  Creates a new field at y, and sets the field's text to str.
 *  Sets the value of pField to point to the new field.
 */
void ListBox::createField(FIELD **pField, int y, std::string str) {
    *pField = new_field(1, getWidth() - 2, y, 0, 0, 0);
    set_field_buffer(*pField, 0, str.data());
    set_field_back(*pField, A_NORMAL);
    field_opts_off(*pField, O_AUTOSKIP);
    field_opts_on(*pField, O_BLANK);
}
Beispiel #8
0
/*---------------------------------------------------------------------------
|   Facility      :  libnform  
|   Function      :  static bool Check_Integer_Field(
|                                                    FIELD * field,
|                                                    const void * argp)
|   
|   Description   :  Validate buffer content to be a valid integer value
|
|   Return Values :  TRUE  - field is valid
|                    FALSE - field is invalid
+--------------------------------------------------------------------------*/
static bool Check_Integer_Field(FIELD * field, const void * argp)
{
  const integerARG *argi = (const integerARG *)argp;
  long low          = argi->low;
  long high         = argi->high;
  int prec          = argi->precision;
  unsigned char *bp = (unsigned char *)field_buffer(field,0);
  char *s           = (char *)bp;
  long val;
  char buf[100];

  while( *bp && *bp==' ') bp++;
  if (*bp)
    {
      if (*bp=='-') bp++;
      while (*bp)
	{
	  if (!isdigit(*bp)) break;
	  bp++;
	}
      while(*bp && *bp==' ') bp++;
      if (*bp=='\0')
	{
	  val = atol(s);
	  if (low<high)
	    {
	      if (val<low || val>high) return FALSE;
	    }
	  sprintf(buf,"%.*ld",(prec>0?prec:0),val);
	  set_field_buffer(field,0,buf);
	  return TRUE;
	}
    }
  return FALSE;
}
Beispiel #9
0
/*---------------------------------------------------------------------------
|   Facility      :  libnform  
|   Function      :  static bool Previous_Enum(
|                                          FIELD * field,
|                                          const void * argp)
|   
|   Description   :  Check for the previous enumeration value
|
|   Return Values :  TRUE  - previous value found and loaded
|                    FALSE - no previous value loaded
+--------------------------------------------------------------------------*/
static bool
Previous_Enum(FIELD *field, const void *argp)
{
  const enumARG *args = (const enumARG *)argp;
  int cnt = args->count;
  char **kwds = &args->kwds[cnt - 1];
  bool ccase = args->checkcase;
  unsigned char *bp = (unsigned char *)field_buffer(field, 0);

  if (kwds)
    {
      while (cnt--)
	{
	  if (Compare((unsigned char *)(*kwds--), bp, ccase) == EXACT)
	    break;
	}

      if (cnt <= 0)
	kwds = &args->kwds[args->count - 1];

      if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT))
	{
	  set_field_buffer(field, 0, *kwds);
	  return TRUE;
	}
    }
  return FALSE;
}
Beispiel #10
0
void AddProjectForm::eventhandle(NEvent* ev) 	//обработчик событий
{
    if ( ev->done )
	return;
    NMouseEvent* mevent = (NMouseEvent*)ev;
    if ( ev->type == NEvent::evMOUSE)
    {
	NForm::eventhandle(ev); //предок
    }
    if ( ev->type == NEvent::evKB )
    {
	ev->done = true;
        switch(ev->keycode)
	{
	    case KEY_ENTER:
	    case '\n': //ENTER
	    {
		form_driver(frm, REQ_NEXT_FIELD); //костыль чтобы текущее поле не потеряло значение
		char* email = strlowcase(rtrim(field_buffer(fields[emailfield],0)));
		char* passw = rtrim(field_buffer(fields[passwfield],0));
		kLogPrintf("AddProjectForm OK name=[%s] url=[%s] email=[%s]\n passw=[%s]\n", projname.c_str(), projurl.c_str(), email, passw);
		if (srv!=NULL)
		{
		    std::string errmsg;
		    bool success = true;
		    if (!userexist) //если аккаунта еще нет то создаем
		    {
			char* username = strlowcase(rtrim(field_buffer(fields[usernamefield],0)));
			char* teamname = rtrim(field_buffer(fields[teamfield],0));
			success = srv->createaccount(projurl.c_str(),email,passw, username, teamname, errmsg);
		    }
		    if (success)
			success = srv->projectattach(projurl.c_str(), projname.c_str(), email, passw, errmsg); //подключить проект
		    if (success)
			putevent(new TuiEvent(evADDPROJECT)); //создаем событие чтобы закрыть форму
		    else
		    {
			//СООБЩЕНИЕ ОБ ОШИБКЕ
			errmsg = " Error: " + errmsg;
			set_field_buffer(fields[errmsgfield], 0, errmsg.c_str());
			field_opts_on(fields[errmsgfield], O_VISIBLE); //делаем видимой строку ошибки
			this->refresh();
		    }
		}
		break;
	    }
	    case 27:
		putevent(new TuiEvent(evADDPROJECT)); //код закрытия окна
		break;
	    default:
		kLogPrintf("AddProjectForm::KEYCODE=%d\n", ev->keycode);
		ev->done = false;
		NForm::eventhandle(ev); //предок
		break;
	} //switch
    }
}
Beispiel #11
0
static FIELD *
make_label(int frow, int fcol, NCURSES_CONST char *label)
{
    FIELD *f = new_field(1, (int) strlen(label), frow, fcol, 0, 0);

    if (f) {
	set_field_buffer(f, 0, label);
	set_field_opts(f, (int) ((unsigned) field_opts(f) & ~O_ACTIVE));
    }
    return (f);
}
Beispiel #12
0
/*
 * Create a field and fill the buffer with the string representation of val.
 * This field can be visited by the cursor, it also dynamicaly resize (in buffer
 * length).
 * @param longest_key_len What is the longest length of a label field, this
 *	information is used to place the field on the x axis
 * @param val The json object representation to print in the field buffer
 */
static FIELD* render_field(int longest_key_len, struct json_object *val)
{
	FIELD *result;

	result = new_field(1, 30, cur_y, longest_key_len, 0, 0);

	if (result) {
		field_opts_off(result, O_AUTOSKIP);
		field_opts_off(result, O_STATIC);
		set_field_buffer(result, 0, json_object_get_string(val));
	}

	return result;
}
Beispiel #13
0
/*
 * Create a field and fill the buffer with label_str. This field cannot be
 * modified nor visited by the cursor.
 * @param longest_key_len What is the longest length of a label field, this
 *	information is used to place the field on the x axis
 * @param label_str The string to fill the label buffer with
 */
static FIELD* render_label(int longest_key_len, const char *label_str)
{
	FIELD *result;

	result = new_field(1, longest_key_len-4, cur_y, cur_x, 0, 0);

	if (result) {
		field_opts_on(result, O_VISIBLE);
		field_opts_off(result, O_EDIT);
		field_opts_off(result, O_ACTIVE);
		set_field_buffer(result, 0, label_str);
	}

	return result;
}
/*
 * Check the contents of the field buffer are a valid Ipv6 address only.
 */
static int
ipv6_check_field(FIELD *field, char *args)
{
	char cleaned[NI_MAXHOST];
	struct addrinfo hints, *res;
	const int niflags = NI_NUMERICHOST;

	if (args == NULL)
		return FALSE;
	
	memset(&hints, 0, sizeof(hints));
	hints.ai_family = AF_INET6;
	hints.ai_socktype = SOCK_DGRAM;	/* dummy */
	hints.ai_flags = AI_NUMERICHOST;

	if (getaddrinfo(args, "0", &hints, &res) != 0) {
		  /* no it is not an IPv6 address */
		return FALSE;
	}
	
	if (res->ai_next) {
		  /* somehow the address resolved to multiple
		   *  addresses - strange
		   */
		freeaddrinfo(res);
		return FALSE;
	}

	if (getnameinfo(res->ai_addr, res->ai_addrlen, cleaned,
			(socklen_t) sizeof(cleaned), NULL, 0, niflags) != 0) {
		freeaddrinfo(res);
		return FALSE;
	}

	freeaddrinfo(res);

	  /*
	   * now we are sure host is an IPv6 address literal, and "cleaned"
	   * has the uniformly-formatted IPv6 address literal.  Re-set the
	   * field buffer to be the reformatted IPv6 address
	   */
	set_field_buffer(field, 0, cleaned);

	return TRUE;		
}
Beispiel #15
0
/*
 * Define each field with an extra one, for reflecting "actual" text.
 */
static FIELD *
make_field(int frow, int fcol, int rows, int cols)
{
    FIELD *f = new_field(rows, cols, frow, fcol, o_value, 1);

    if (f) {
	FieldAttrs *ptr;

	set_field_back(f, A_UNDERLINE);
	/*
	 * If -j and -d options are combined, -j loses.  It is documented in
	 * "Character User Interface Programming", page 12-15 that setting
	 * O_STATIC off makes the form library ignore justification.
	 */
	set_field_just(f, j_value);
	if (d_option) {
	    if (has_colors()) {
		set_field_fore(f, (chtype) COLOR_PAIR(2));
		set_field_back(f, A_UNDERLINE | COLOR_PAIR(3));
	    } else {
		set_field_fore(f, A_BOLD);
	    }
	    /*
	     * The field_opts_off() call dumps core with Solaris curses,
	     * but that is a known bug in Solaris' form library -TD
	     */
	    field_opts_off(f, O_STATIC);
	    set_max_field(f, m_value);
	}

	/*
	 * The userptr is used in edit_field.c's inactive_field().
	 */
	ptr = (FieldAttrs *) field_userptr(f);
	if (ptr == 0) {
	    ptr = typeCalloc(FieldAttrs, 1);
	    ptr->background = field_back(f);
	}
	set_field_userptr(f, (void *) ptr);
	if (t_value)
	    set_field_buffer(f, 0, t_value);
    }
    return (f);
}
Beispiel #16
0
/*---------------------------------------------------------------------------
|   Facility      :  libnform  
|   Function      :  static bool Check_Enum_Field(
|                                      FIELD * field,
|                                      const void  * argp)
|   
|   Description   :  Validate buffer content to be a valid enumeration value
|
|   Return Values :  TRUE  - field is valid
|                    FALSE - field is invalid
+--------------------------------------------------------------------------*/
static bool
Check_Enum_Field(FIELD *field, const void *argp)
{
  char **kwds = ((const enumARG *)argp)->kwds;
  bool ccase = ((const enumARG *)argp)->checkcase;
  bool unique = ((const enumARG *)argp)->checkunique;
  unsigned char *bp = (unsigned char *)field_buffer(field, 0);
  char *s, *t, *p;
  int res;

  while (kwds && (s = (*kwds++)))
    {
      if ((res = Compare((unsigned char *)s, bp, ccase)) != NOMATCH)
	{
	  p = t = s;		/* t is at least a partial match */
	  if ((unique && res != EXACT))
	    {
	      while (kwds && (p = *kwds++))
		{
		  if ((res = Compare((unsigned char *)p, bp, ccase)) != NOMATCH)
		    {
		      if (res == EXACT)
			{
			  t = p;
			  break;
			}
		      else
			t = (char *)0;
		    }
		}
	    }
	  if (t)
	    {
	      set_field_buffer(field, 0, t);
	      return TRUE;
	    }
	  if (!p)
	    break;
	}
    }
  return FALSE;
}
Beispiel #17
0
bool ListBox::handleKeyPress(int key) {
    if (key == KEY_UP) {
        //Move up a field
        selectField(REQ_PREV_FIELD);
        m_curRow = (m_curRow == 0) ? m_numRows - 1 : m_curRow - 1;
        return true;
    } else if (key == KEY_DOWN || key == 9) { //Tab key
        //Move down a field
        selectField(REQ_NEXT_FIELD);
        m_curRow = (m_curRow == m_numRows - 1) ? 0 : m_curRow + 1;
        return true;
    } else if (key == KEY_BACKSPACE || key == 127) {
        //Delete prev. char
//        form_driver(m_pForm, REQ_DEL_PREV);
        return true;
    } else if (key == 330) { //Delete key TODO: Fix this
        //Delete next char
//        form_driver(m_pForm, REQ_DEL_PREV);
        return true;
    } else {
        FIELD *pField = current_field(m_pForm);
        if (field_userptr(pField) != 0) {
#ifdef DEBUG
            dout << "Create new row" << std::endl;
#endif
            addRow("");
            if (key == CuTAES::KEY_ENT) {
                //Clear field
                set_field_buffer(pField, 0, "");
                return true;
            }
        }
        //Send key to form driver
        form_driver(m_pForm, key);
    }
    wrefresh(m_pPanel->getWindow());
    return false;
}
Beispiel #18
0
static int
fcheck_num(FIELD *f, char *arg)
{
	NUMERIC *	n = (NUMERIC *) arg;
	double		vmin = n -> vmin;
	double		vmax = n -> vmax;
	int		prec = n -> prec;
	char *		x = field_buffer(f, 0);
	char		buf[80];

	while (*x && *x == ' ')
		++x;
	if (*x) {
		char * t = x;

		if (*x == '-')
			++x;
		while (*x && isdigit(*x))
			++x;
		if (*x == '.') {
			++x;
			while (*x && isdigit(*x))
				++x;
		}
		while (*x && *x == ' ')
			++x;
		if (! *x) {
			double v = atof(t);

			if (vmin >= vmax || (v >= vmin && v <= vmax)) {
				(void) sprintf(buf, "%.*f", prec, v);
				(void) set_field_buffer(f, 0, buf);
				return (TRUE);
			}
		}
	}
	return (FALSE);
}
Beispiel #19
0
void clear_fields(FIELD *fields[], size_t start, size_t end) {
  for ( size_t i = start; i <= end; i++ )
    set_field_buffer( fields[i], 0, "" );
  return;
}
Beispiel #20
0
/*---------------------------------------------------------------------------
|   Facility      :  libnform
|   Function      :  static bool Check_This_Field(FIELD * field,
|                                                 const void * argp)
|
|   Description   :  Validate buffer content to be a valid numeric value
|
|   Return Values :  TRUE  - field is valid
|                    FALSE - field is invalid
+--------------------------------------------------------------------------*/
static bool
Check_This_Field(FIELD *field, const void *argp)
{
  const thisARG *argn = (const thisARG *)argp;
  double low = argn->low;
  double high = argn->high;
  int prec = argn->precision;
  unsigned char *bp = (unsigned char *)field_buffer(field, 0);
  char *s = (char *)bp;
  double val = 0.0;
  struct lconv *L = argn->L;
  char buf[64];
  bool result = FALSE;

  while (*bp && *bp == ' ')
    bp++;
  if (*bp)
    {
      if (*bp == '-' || *bp == '+')
	bp++;
#if USE_WIDEC_SUPPORT
      if (*bp)
	{
	  bool blank = FALSE;
	  int state = 0;
	  int len;
	  int n;
	  wchar_t *list = _nc_Widen_String((char *)bp, &len);

	  if (list != 0)
	    {
	      result = TRUE;
	      for (n = 0; n < len; ++n)
		{
		  if (blank)
		    {
		      if (list[n] != ' ')
			{
			  result = FALSE;
			  break;
			}
		    }
		  else if (list[n] == ' ')
		    {
		      blank = TRUE;
		    }
		  else if (isDecimalPoint(list[n]))
		    {
		      if (++state > 1)
			{
			  result = FALSE;
			  break;
			}
		    }
		  else if (!isDigit(list[n]))
		    {
		      result = FALSE;
		      break;
		    }
		}
	      free(list);
	    }
	}
#else
      while (*bp)
	{
	  if (!isdigit(UChar(*bp)))
	    break;
	  bp++;
	}
      if (isDecimalPoint(*bp))
	{
	  bp++;
	  while (*bp)
	    {
	      if (!isdigit(UChar(*bp)))
		break;
	      bp++;
	    }
	}
      while (*bp && *bp == ' ')
	bp++;
      result = (*bp == '\0');
#endif
      if (result)
	{
	  val = atof(s);
	  if (low < high)
	    {
	      if (val < low || val > high)
		result = FALSE;
	    }
	  if (result)
	    {
	      sprintf(buf, "%.*f", (prec > 0 ? prec : 0), val);
	      set_field_buffer(field, 0, buf);
	    }
	}
    }
  return (result);
}
Beispiel #21
0
int kullanici_onayla()
{
	FIELD *field[3];
	FORM  *my_form;
	int ch;

	touchwin(ana_win);
	wrefresh(ana_win);
			
	init_pair(1, COLOR_WHITE, COLOR_BLUE);
	init_pair(2, COLOR_WHITE, COLOR_BLUE);
		
/*calisma yili 4 karakter*/
	field[0] = new_field(1, 10, 18, 42, 0, 0);
/*firma 2 karakter*/
	field[1] = new_field(1, 10, 20, 42, 0, 0);
	field[2] = NULL;

	set_field_fore(field[0], COLOR_PAIR(1));
	set_field_fore(field[1], COLOR_PAIR(1));
/*geri plan rengi olsun*/
	set_field_back(field[0], COLOR_PAIR(2));
	set_field_back(field[1], COLOR_PAIR(2));
/*
	set_field_type(field[0], TYPE_INTEGER);
	set_field_type(field[1], TYPE_INTEGER);
*/
	field_opts_off(field[0], O_AUTOSKIP); 
	field_opts_off(field[1], O_AUTOSKIP); 

/*sifre alani olan ikinci field password biçiminde olmali/
	field_opts_off(field[1], O_PUBLIC);

	/*geri plan rengi olmasin*/
/*	set_field_back(field[0], A_UNDERLINE); 
	set_field_back(field[1], A_UNDERLINE); 
*/
	my_form = new_form(field);
	post_form(my_form);
	refresh();
	
	set_current_field(my_form, field[0]); 

	mvprintw(18, 25, _("User name :") );
	mvprintw(20, 25, _("Password  :"******"This application under GPL license.") );
attroff(A_BLINK);
attroff(A_BOLD);

attron(A_BOLD);
mvprintw(LINES-3, 5, _("F2-> Begin                                               ESC-> Cancel") );
mvprintw(18, 5, _("F5-> Settings") );
attroff(A_BOLD);

mvprintw(7,3, _("                               Acik                          "));
mvprintw(8,3,"  _|              _|                _|                                  ");
mvprintw(9,3,"         _|_|_|   _|     _|_|     _|_|_|_|   _|_|_|  _|_|       _|_|    ");
mvprintw(10,3,"  _|   _|_|       _|   _|_|_|_|     _|       _|    _|    _|   _|_|_|_|  ");
mvprintw(11,3,"  _|       _|_|   _|   _|           _|       _|    _|    _|   _|        ");
mvprintw(12,3,"  _|   _|_|_|     _|     _|_|_|       _|_|   _|    _|    _|     _|_|_|  ");
refresh();
    while((ch = getch()) )
	{	switch(ch)
		{	
		case 8: /*KEY_BACKSPACE hatali kod vermekte 8 dogru olandir konsolda 8 xterm key_backspace*/
    		form_driver(my_form, REQ_PREV_CHAR);
			form_driver(my_form, REQ_DEL_CHAR);
			break;
		case KEY_BACKSPACE: 
    		form_driver(my_form, REQ_PREV_CHAR);
			form_driver(my_form, REQ_DEL_CHAR);
			break;		
		case 9: /*TAB tusuna basýlmasý durumunda sonraki field konumlan*/
			form_driver(my_form, REQ_NEXT_FIELD);
			form_driver(my_form, REQ_END_LINE);
			break;		
		case 10: /*ENTER tuþuna basýlmasý durumunda sonraki feild gececek*/
			form_driver(my_form, REQ_NEXT_FIELD);
			form_driver(my_form, REQ_END_LINE);
			break;		
		case KEY_DC:	/*del tusu*/		
    		form_driver(my_form,REQ_DEL_CHAR);
			break;			
		case KEY_HOME:
			form_driver(my_form,REQ_BEG_LINE);
			break;						
		case KEY_END:
			form_driver(my_form,REQ_END_LINE);
			break;
		case KEY_DOWN:
			form_driver(my_form, REQ_NEXT_FIELD);
			form_driver(my_form, REQ_END_LINE);
			break;
		case KEY_UP:
			form_driver(my_form, REQ_PREV_FIELD);
			form_driver(my_form, REQ_END_LINE);
			break;
		case KEY_LEFT:
    			form_driver(my_form,REQ_LEFT_CHAR);
			break;
		case KEY_RIGHT:
    			form_driver(my_form,REQ_RIGHT_CHAR);
			break;
		case 27: /*esc durumunda*/
				unpost_form(my_form);
				free_form(my_form);
				free_field(field[0]);
				free_field(field[1]); 
				endwin();
				exit(0);	
				break;
		
		case KEY_F(5): 	/*ayarlara gecis*/
				ayarlar();
				
				unpost_form(my_form);
				free_form(my_form);
				free_field(field[0]);
				free_field(field[1]);
				
				endwin();
		
				exit (0);
				break;
				case KEY_F(2): 	/*f2 durumunda*/
				form_driver(my_form, REQ_PREV_FIELD);
				strcpy(query, "select kullanici, sifre, haklar from kullanicilar");
		
				if ( pgsql_sorgula(query) ==1 ) { mesaj(sql_sorgulama_hatasi); return 1;}
	
				for (i=0;i<pgsql_row_miktar;i++)
					{						
					sprintf(kullanici,"%s", pgsql_kayit_field() );
					sprintf(sifre,"%s", pgsql_kayit_field() );
					sprintf(haklar,"%s", pgsql_kayit_field() );

					if ( strcmp(g_strstrip(field_buffer(field[0],0)), kullanici) ==NULL )
						{
						if  ( (sifre_kripto_coz( g_strstrip(field_buffer(field[1],0)) , sifre) == 0) || (strcmp(g_strstrip(field_buffer(field[1],0)), sifre) == NULL ) )
							{
							//kullanýcý root ise haklar full olmalý 
							//databaseden degistirme ihtimali olabilir								
							if ( strstr( kullanici, "root") ) 
							{sprintf(haklar,"%s", "1111111111111111111111111111111111111111111111111111111111111111");}
												
							beep();
						
							unpost_form(my_form);
							free_form(my_form);
							free_field(field[0]);
							free_field(field[1]);
							touchwin(ana_win);
							wrefresh(ana_win);							
															
							return;
								
							}
							else
							{							
							set_field_buffer(field[0],0," ");
							set_field_buffer(field[1],0," ");
							refresh();	
							//beep sesi							
							beep();
							
							}
						}
					}
			
													
				break;
			
			default:
				form_driver(my_form, ch);
				break;

		}
	}

return 0;
/*son*/
}
Beispiel #22
0
/*---------------------------------------------------------------------------
|   Facility      :  libnform  
|   Function      :  static bool Check_This_Field(
|                                                 FIELD * field,
|                                                 const void * argp)
|   
|   Description   :  Validate buffer content to be a valid integer value
|
|   Return Values :  TRUE  - field is valid
|                    FALSE - field is invalid
+--------------------------------------------------------------------------*/
static bool
Check_This_Field(FIELD *field, const void *argp)
{
  const thisARG *argi = (const thisARG *)argp;
  long low = argi->low;
  long high = argi->high;
  int prec = argi->precision;
  unsigned char *bp = (unsigned char *)field_buffer(field, 0);
  char *s = (char *)bp;
  long val;
  char buf[100];
  bool result = FALSE;

  while (*bp && *bp == ' ')
    bp++;
  if (*bp)
    {
      if (*bp == '-')
	bp++;
#if USE_WIDEC_SUPPORT
      if (*bp)
	{
	  bool blank = FALSE;
	  int len;
	  int n;
	  wchar_t *list = _nc_Widen_String((char *)bp, &len);

	  if (list != 0)
	    {
	      result = TRUE;
	      for (n = 0; n < len; ++n)
		{
		  if (blank)
		    {
		      if (list[n] != ' ')
			{
			  result = FALSE;
			  break;
			}
		    }
		  else if (list[n] == ' ')
		    {
		      blank = TRUE;
		    }
		  else if (!isDigit(list[n]))
		    {
		      result = FALSE;
		      break;
		    }
		}
	      free(list);
	    }
	}
#else
      while (*bp)
	{
	  if (!isdigit(UChar(*bp)))
	    break;
	  bp++;
	}
      while (*bp && *bp == ' ')
	bp++;
      result = (*bp == '\0');
#endif
      if (result)
	{
	  val = atol(s);
	  if (low < high)
	    {
	      if (val < low || val > high)
		result = FALSE;
	    }
	  if (result)
	    {
	      snprintf(buf, sizeof(buf), "%.*ld", (prec > 0 ? prec : 0), val);
	      set_field_buffer(field, 0, buf);
	    }
	}
    }
  return (result);
}
/*
 * Create and initialize a new popup. popup_btn_action *must* be filled before
 * this call.
 * @param rows The number of rows for win_body
 * @param cols The number of lines for win_body
 * @param posy Position of the top left corner on the y axis
 * @param posx Position of the top left corner on the x axis
 * @param requests An array of strings to put in the form. This can be null:
 *	only the title and the buttons will be present.
 * @param title A string to print in the popup.
 */
void popup_new(int rows, int cols, int posy, int posx, char **requests,
		char *title)
{
	int i, cury = 0, curx = 1, tmp, nb_buttons, nb_fields;
	WINDOW *inner;

	win_body = newwin(rows, cols, posy, posx);
	assert(win_body != NULL && popup_btn_action != NULL);
	box(win_body, 0, 0);

	for (nb_buttons = 0; popup_btn_action[nb_buttons]; nb_buttons++);

	popup_items = malloc(sizeof(ITEM *) * (nb_buttons+1));
	assert(popup_items != NULL);
	assert(popup_btn_action != NULL);

	for (i = 0; popup_btn_action[i]; i++) {
		popup_items[i] = new_item(popup_btn_action[i]->key, "");
		assert(popup_items[i] != NULL);
	}

	popup_items[i] = NULL;
	popup_menu = new_menu(popup_items);
	win_menu = derwin(win_body, 3, cols-2, rows-4, 1);
	assert(popup_menu != NULL && win_menu != NULL);
	box(win_menu, 0, 0);
	set_menu_win(popup_menu, win_menu);
	set_menu_format(popup_menu, 1, nb_buttons);
	tmp = popup_menu->fcols * (popup_menu->namelen + popup_menu->spc_rows);
	tmp--;
	inner = derwin(win_menu, 1, tmp, 1, (cols-3-tmp)/2);
	assert(inner != NULL);
	set_menu_sub(popup_menu, inner);
	set_menu_mark(popup_menu, "");
	assert(post_menu(popup_menu) == E_OK);

	mvwprintw(win_body, 1, 2, "%s", title);

	for (nb_fields = 0; requests && requests[nb_fields]; nb_fields++);

	if (nb_fields == 0) {
		popup_fields = NULL;
		popup_form = NULL;
		is_on_button = true;
		return;
	}

	popup_fields = malloc(sizeof(FIELD *) * (nb_fields+1));
	assert(popup_fields != NULL);

	for (i = 0; i < nb_fields && requests[i]; i++) {

		if (i % 2 == 1) {
			popup_fields[i] = new_field(1, 41, cury, curx, 0, 0);
			assert(popup_fields[i] != NULL);
			set_field_buffer(popup_fields[i], 0, strdup(requests[i]));
			cury = cury+1;
			curx = 1;
			field_opts_on(popup_fields[i], O_ACTIVE);
			field_opts_on(popup_fields[i], O_EDIT);
			field_opts_off(popup_fields[i], O_STATIC);
			set_field_back(popup_fields[i], A_UNDERLINE); 
		} else {
			popup_fields[i] = new_field(1, 45, cury, curx, 0, 0);
			assert(popup_fields[i] != NULL);
			set_field_buffer(popup_fields[i], 0, strdup(requests[i]));
			curx = strlen(requests[i]) + 2;
			field_opts_off(popup_fields[i], O_ACTIVE);
			field_opts_off(popup_fields[i], O_EDIT);
		}
	}

	popup_fields[i] = NULL;
	popup_form = new_form(popup_fields);
	assert(popup_form != NULL);
	win_form = derwin(win_body, rows-6, cols-2, 1, 1);
	assert(popup_form != NULL && win_form != NULL);
	assert(set_form_win(popup_form, win_form) == E_OK);

	int diff_rows = popup_form->cols - win_form->_maxx-2;

	/*
	 * There isn't enough rows for the form so we resize win_body and
	 * win_form to fit the form.
	 * This resize isn't needed for the lines (as there is always fery few
	 * of them).
	 */
	if (diff_rows > 0) {
		wresize(win_body, win_body->_maxy, win_body->_maxx + diff_rows);
		wresize(win_form, win_form->_maxy, win_form->_maxx - 2 + diff_rows);
	}

	inner = derwin(win_form, win_form->_maxy-2, win_form->_maxx, 2, 0);
	assert(inner != NULL);
	set_form_sub(popup_form, inner);

	assert(post_form(popup_form) == E_OK);
	is_on_button = false;
	set_menu_fore(popup_menu, A_NORMAL); // "hide" the button
	pos_form_cursor(popup_form);
}
int
edit_field(FORM * form, int *result)
{
    int ch = wgetch(form_win(form));
    int status;
    FIELD *before;
    unsigned n;
    char lengths[80];
    int length;
    char *buffer;
    int before_row;
    int before_col;
    int before_off = offset_in_field(form);

    form_getyx(form, before_row, before_col);
    before = current_field(form);
    set_field_back(before, A_NORMAL);
    if (ch <= KEY_MAX) {
	set_field_back(before, A_REVERSE);
    } else if (ch <= MAX_FORM_COMMAND) {
	inactive_field(before);
    }

    *result = ch;
    for (n = 0; n < SIZEOF(commands); ++n) {
	if (commands[n].code == ch) {
	    *result = commands[n].result;
	    break;
	}
    }

    status = form_driver(form, *result);

    if (status == E_OK) {
	bool modified = TRUE;

	length = 0;
	if ((buffer = field_buffer(before, 1)) != 0)
	    length = atoi(buffer);
	if (length < before_off)
	    length = before_off;
	switch (*result) {
	case REQ_CLR_EOF:
	    length = before_off;
	    break;
	case REQ_CLR_EOL:
	    if (before_row + 1 == before->rows)
		length = before_off;
	    break;
	case REQ_CLR_FIELD:
	    length = 0;
	    break;
	case REQ_DEL_CHAR:
	    if (length > before_off)
		--length;
	    break;
	case REQ_DEL_PREV:
	    if (length > 0) {
		if (before_col > 0) {
		    --length;
		} else if (before_row > 0) {
		    length -= before->cols + before_col;
		}
	    }
	    break;
	case REQ_NEW_LINE:
	    length += before->cols;
	    break;
#if 0
	    /* FIXME: finish these */
	case REQ_DEL_LINE:	/* delete line */
	case REQ_DEL_WORD:	/* delete word at cursor */
	case REQ_INS_CHAR:	/* insert blank char at cursor */
	case REQ_INS_LINE:	/* insert blank line at cursor */
	case REQ_INS_MODE:	/* begin insert mode */
	case REQ_OVL_MODE:	/* begin overlay mode */
#endif
	    /* ignore all of the motion commands */
	case REQ_SCR_BCHAR:	/* FALLTHRU */
	case REQ_SCR_BHPAGE:	/* FALLTHRU */
	case REQ_SCR_BLINE:	/* FALLTHRU */
	case REQ_SCR_BPAGE:	/* FALLTHRU */
	case REQ_SCR_FCHAR:	/* FALLTHRU */
	case REQ_SCR_FHPAGE:	/* FALLTHRU */
	case REQ_SCR_FLINE:	/* FALLTHRU */
	case REQ_SCR_FPAGE:	/* FALLTHRU */
	case REQ_SCR_HBHALF:	/* FALLTHRU */
	case REQ_SCR_HBLINE:	/* FALLTHRU */
	case REQ_SCR_HFHALF:	/* FALLTHRU */
	case REQ_SCR_HFLINE:	/* FALLTHRU */
	case REQ_BEG_FIELD:	/* FALLTHRU */
	case REQ_BEG_LINE:	/* FALLTHRU */
	case REQ_DOWN_CHAR:	/* FALLTHRU */
	case REQ_DOWN_FIELD:	/* FALLTHRU */
	case REQ_END_FIELD:	/* FALLTHRU */
	case REQ_END_LINE:	/* FALLTHRU */
	case REQ_FIRST_FIELD:	/* FALLTHRU */
	case REQ_FIRST_PAGE:	/* FALLTHRU */
	case REQ_LAST_FIELD:	/* FALLTHRU */
	case REQ_LAST_PAGE:	/* FALLTHRU */
	case REQ_LEFT_CHAR:	/* FALLTHRU */
	case REQ_LEFT_FIELD:	/* FALLTHRU */
	case REQ_NEXT_CHAR:	/* FALLTHRU */
	case REQ_NEXT_CHOICE:	/* FALLTHRU */
	case REQ_NEXT_FIELD:	/* FALLTHRU */
	case REQ_NEXT_LINE:	/* FALLTHRU */
	case REQ_NEXT_PAGE:	/* FALLTHRU */
	case REQ_NEXT_WORD:	/* FALLTHRU */
	case REQ_PREV_CHAR:	/* FALLTHRU */
	case REQ_PREV_CHOICE:	/* FALLTHRU */
	case REQ_PREV_FIELD:	/* FALLTHRU */
	case REQ_PREV_LINE:	/* FALLTHRU */
	case REQ_PREV_PAGE:	/* FALLTHRU */
	case REQ_PREV_WORD:	/* FALLTHRU */
	case REQ_RIGHT_CHAR:	/* FALLTHRU */
	case REQ_RIGHT_FIELD:	/* FALLTHRU */
	case REQ_SFIRST_FIELD:	/* FALLTHRU */
	case REQ_SLAST_FIELD:	/* FALLTHRU */
	case REQ_SNEXT_FIELD:	/* FALLTHRU */
	case REQ_SPREV_FIELD:	/* FALLTHRU */
	case REQ_UP_CHAR:	/* FALLTHRU */
	case REQ_UP_FIELD:	/* FALLTHRU */
	case REQ_VALIDATION:	/* FALLTHRU */
	    modified = FALSE;
	    break;

	default:
	    modified = FALSE;
	    if (ch >= MIN_FORM_COMMAND) {
		beep();
	    } else if (isprint(ch)) {
		modified = TRUE;
	    }
	    break;
	}

	/*
	 * If we do not force a re-validation, then field_buffer 0 will
	 * be lagging by one character.
	 */
	if (modified && form_driver(form, REQ_VALIDATION) == E_OK && *result
	    < MIN_FORM_COMMAND)
	    ++length;

	sprintf(lengths, "%d", length);
	set_field_buffer(before, 1, lengths);
    }

    if (current_field(form) != before)
	inactive_field(before);
    return status;
}
Beispiel #25
0
static void brsh_clear_input(void)
{
    form_driver(frm_input, REQ_VALIDATION);
    set_field_buffer(fld_input, 0, "");
}
Beispiel #26
0
void viewEditTeamProperties(FootBallGame::TeamNumber teamNumber) {
  const char *fieldBuffer;
  const ITEM *currentItem;
  const char *itemName;
  ITEM **items;

  const int window_nlines = 10,
            window_ncols  = 90;
  
  char *choices[] = {
    "Ok",
    "Cancel",
  };

  for(;;) {
    // Create new window.
    WINDOW *window = newwin(window_nlines, 
                            window_ncols, 
                            headerWindow_begin_y + headerWindow_nlines + 1,
                            0);
    // Set new window options.
    keypad(window, TRUE);
  
    // Team the team
    FootBallTeam *team = game.getFootBallTeam(teamNumber);

    // Create the form fields
    FIELD *field[2];
    field[0] = new_field(1, 20, 2, 22, 0, 0);
    field[1] = NULL;
  
    // Set feild options 
    set_field_back(field[0], A_UNDERLINE);
    field_opts_off(field[0], O_AUTOSKIP);
    set_field_type(field[0], TYPE_REGEXP, "^[A-Za-z ]*$");
    if (team) {
      String teamName = team->getTeamName();
      set_field_buffer(field[0], 0, teamName.c_str());
    }
    
    // Create the form
    FORM *form = new_form(field);

    // Attach the form to the window
    set_form_win(form, window);
    set_form_sub(form, derwin(window, 4, 90, 0, 0));

    // Setup the menu
    int nChoices = ARRAY_SIZE(choices)+1;
    items = new ITEM* [nChoices];
    for (int i = 0; i < nChoices-1; i++)
      items[i] = new_item(choices[i], NULL);
    items[nChoices-1] = NULL;
  
    // Create the menu
    MENU *menu = new_menu(items);
    // Menu options
    set_menu_format(menu, 1, 2);
    set_menu_mark(menu, NULL);
    // Attach the menu to the window
    set_menu_win(menu, window);
    set_menu_sub(menu, derwin(window, 1, 20, 4, 17));

    // Make window and menu visible;
    post_form(form);
    post_menu(menu);
    mvwprintw(window, 0, 10, "Team Properties: ");
    mvwprintw(window, 2, 10, "Team Name: ");
    wrefresh(window);
    refresh();
    
    // Start user interaction loop.
    int c;
    // The restart variable is used to tell the function to rebuild the
    // menu by starting at the top of the for(;;) loop above.
    bool restart = false;
    while (!restart && (c = wgetch(window))) {
      switch(c) {
        case KEY_DOWN:
        case 0x09:
          // Go to next field
          form_driver(form, REQ_NEXT_FIELD);
          // GO to the end of the presend buffer
          // Leaves nicely at the last character
          form_driver(form, REQ_END_LINE);
          break;
        case KEY_UP:
          // Go to previous field
          form_driver(form, REQ_PREV_FIELD);
          form_driver(form, REQ_END_LINE);
          break;
        case 0x7F:
          form_driver(form, REQ_DEL_PREV);
          break;
        case KEY_LEFT:
          menu_driver(menu, REQ_LEFT_ITEM);
          break;
        case KEY_RIGHT:
          menu_driver(menu, REQ_RIGHT_ITEM);
          break;
        case 10: // Enter
          // When the user hits enter determine the currently selected
          // item and do nessary actions. 
          currentItem = current_item(menu);
          itemName = item_name(currentItem);
          if (strcmp(itemName, choices[0]) == 0) {
            form_driver(form, REQ_VALIDATION);
            fieldBuffer = field_buffer(field[0], 0);
            if (fieldBuffer != NULL && strcmp(fieldBuffer, "") != 0) {
              if (team == NULL) {
                team = new FootBallTeam;
                game.setFootBallTeam(teamNumber, team);
              }
              team->setTeamName(fieldBuffer);
            }
          }
          // Delete allocated data
          delwin(window);
          unpost_form(form); 
          free_form(form); 
          unpost_menu(menu); 
          free_menu(menu); 
          for (unsigned i = 0; i < ARRAY_SIZE(field); i++) 
            free_field(field[i]); 
          for (int i = 0; i < nChoices-1; i++) 
            free_item(items[i]); 
          delete[] items;
          return;
        default:
          // If this is a normal character, it gets printed.
          form_driver(form, c);
          break;
      }
    }
  }
}
Beispiel #27
0
void actions_dataentry_scr(const char *curr_path, const char *case_num) {
  const size_t n_fields = 4;
  const size_t starty = 6;
  const size_t startx = 25;
  FIELD *field[n_fields];
  FORM *my_form;
  Action_t record;
  int width[] = {  MAX_ACT_DATE - 1, MAX_ACT_TYPE, MAX_ACT_NOTE - 200 };
  int height[] = { 1, 1, 4 };
 
  for ( size_t i = 0; i < n_fields - 1; ++i )
    field[i] = new_field(height[i], width[i], starty + i * 2, startx, 0, 0);
  field[n_fields - 1] = NULL;

  set_field_back( field[0], A_UNDERLINE  );
  field_opts_off( field[0], O_AUTOSKIP   );
  set_field_back( field[1], A_UNDERLINE  );
  field_opts_off( field[1], O_AUTOSKIP   );
  set_field_back( field[2], A_UNDERLINE  );
  field_opts_off( field[2], O_AUTOSKIP   );
  field_opts_off( field[2], O_STATIC     );
  set_max_field(  field[2], MAX_ACT_NOTE );

  my_form = new_form(field);
  post_form(my_form);
  refresh();

  int note_count = MAX_ACT_NOTE;
  char note_msg[4];
  char date_str[MAX_ACT_DATE];
  get_curr_date( date_str );
  mvprintw( 0, 0,   curr_path );
  mvprintw( 4, 10,  "Case Number:   %s", case_num );
  mvprintw( 6, 10,  "Entry Date:    " );
  mvprintw( 8, 10,  "Type:          " );
  mvprintw( 10, 10, "Note:          " );
  mvprintw( 15, 77, "%d", note_count );
  mvprintw( 16, 10, "(F2) = Add | (ESC) = Previous Screen" );
  set_visible_fields( field, 1, 3 );
  size_t actions_count = actions_list( case_num );
  move( 6, 25 );
  set_field_buffer( field[0], 0, date_str );
  set_current_field( my_form, field[0] );

  record.id = 0;
  int ch;

  do {
 
    ch = getch();

    switch ( ch ) {
      case KEY_UP:
        form_driver(my_form, REQ_PREV_FIELD);
        form_driver(my_form, REQ_END_LINE);
        break;
      case KEY_LEFT:
        form_driver(my_form, REQ_LEFT_CHAR);
        break;
      case KEY_RIGHT:
        form_driver(my_form, REQ_RIGHT_CHAR);
        break;
      case KEY_BACKSPACE:
        {
          FIELD * curr_fld = current_field( my_form );

          if ( curr_fld == field[2] ) {
            snprintf( note_msg, 4, "%d", ++note_count );
            display_msg( 15, 77, my_form, curr_fld, note_msg );
          }
        }
        form_driver(my_form, REQ_PREV_CHAR);
        form_driver(my_form, REQ_DEL_CHAR);
        break;
     case DEL:
        {
          FIELD * curr_fld = current_field( my_form );

          if ( curr_fld == field[2] ) {
            snprintf( note_msg, 4, "%d", ++note_count );
            display_msg( 15, 77, my_form, curr_fld, note_msg );
          }
        }
        form_driver( my_form, REQ_DEL_CHAR );
        break;
      case ENTER:
        form_driver( my_form, REQ_NEXT_FIELD );
        form_driver( my_form, REQ_END_LINE );
        break;
      case KEY_F(1):
        {
          FIELD * curr_fld = current_field( my_form );

          if ( curr_fld == field[1] ) {
            if ( query_select_all_codes_from_action_types()  ) {
              clear_line(18, 10);
              mvprintw( 18, 10, db_get_error_msg() );
            } else {
              const Code_t const * code_ptr;
              size_t count = 0;
              
              mvprintw( 8, 75, "Type Options:" );
              while ( ( code_ptr = get_code_from_result() ) != NULL )      
                mvprintw( 9 + count++, 81, "[%d] %s", code_ptr->code, code_ptr->desc );
              free_code_result();

              int row, col;
              get_cursor_pos( curr_fld, &row, &col );
              move( row, col );
              set_current_field( my_form, curr_fld );
            }
          }
        }
        break;
      case KEY_F(2):
        {
          clear_line( 18, 10 );
          strncpy( record.case_num, case_num, MAX_CANUM );
          strncpy( record.entry_date, compress_str( field_buffer(field[0], 0) ), MAX_ACT_DATE );
          record.type = atoi( compress_str( field_buffer(field[1], 0) ) );
          strncpy( record.note, field_buffer(field[2], 0), MAX_ACT_NOTE );
          
          if ( is_empty_str( record.note, MAX_ACT_NOTE ) ) {
            mvprintw( 18, 10, "[!] Action must at least have a note." ); 
            move( 10, 25 );
            set_current_field( my_form, field[2] );
            break;
          }

          if ( query_add_action( &record ) ) {
            mvprintw( 18, 10, db_get_error_msg() );
          } else {
            clear_fields( field, 0, 2 );
            actions_count++;
            print_action( &record, actions_count );
            note_count = MAX_ACT_NOTE;
            mvprintw( 15, 77, "%d", note_count );
          }
          move( 6, 25 );
          set_current_field( my_form, field[0] );
        }
        break;
      default:
        {
          FIELD * curr_fld = current_field( my_form );

          if ( ch == '\'' )
            break;
          if ( curr_fld == field[1] ) {
            if ( !isdigit( ch ) )
              break;
          } else if ( curr_fld == field[2] ) {
            snprintf( note_msg, 4, "%d", --note_count );
            display_msg( 15, 77, my_form, curr_fld, note_msg );
          }
        }
        form_driver( my_form, ch );
        break;
    }
  } while ( ch != ESC );

  unpost_form( my_form );
  free_form( my_form );
  for ( size_t i = 0; i < n_fields - 1; ++i )
    free_field( field[i] );
  return;
}
Beispiel #28
0
void summons_dataentry_scr(const char *curr_path, const char *case_num) {
  const size_t n_fields = 6;
  const size_t starty = 6;
  const size_t startx = 25;
  FIELD *field[n_fields];
  FORM *my_form;
  Summon_t record;
  int width[] = {  MAX_SUMM_NAME, MAX_SUMM_STATUS, MAX_SUMM_REASON,  
                   MAX_SUMM_CITY, MAX_SUMM_DATE
                };
 
  for ( size_t i = 0; i < n_fields - 1; ++i )
    field[i] = new_field(1, width[i], starty + i * 2, startx, 0, 0);
  field[n_fields - 1] = NULL;
  
  set_field_back( field[0], A_UNDERLINE );
  field_opts_off( field[0], O_AUTOSKIP  );
  set_field_back( field[1], A_UNDERLINE );
  field_opts_on(  field[1], O_BLANK     );
  field_opts_off( field[1], O_AUTOSKIP  );
  set_field_back( field[2], A_UNDERLINE );
  field_opts_off( field[2], O_AUTOSKIP  );
  field_opts_on(  field[2], O_BLANK     );
  set_field_back( field[3], A_UNDERLINE );
  field_opts_off( field[3], O_AUTOSKIP  );
  field_opts_on(  field[3], O_BLANK     );
  set_field_back( field[4], A_UNDERLINE );
  field_opts_off( field[4], O_AUTOSKIP  );

  my_form = new_form(field);
  post_form(my_form);
  refresh();
 
  mvprintw( 0, 0,   curr_path );
  mvprintw( 4, 10,  "Case Number:   %s", case_num );
  mvprintw( 6, 10,  "Person:        " );
  mvprintw( 8, 10,  "Status:        " );
  mvprintw( 10, 10, "Reason:        " );
  mvprintw( 12, 10, "City:          " );
  mvprintw( 14, 10, "Date Summoned: " );
  mvprintw( 16, 10, "(F1) = Options | (F2) = Update | (F3) = Delete | (F5) = List | (ESC) = Main Menu" );
  set_visible_fields( field, 1, 5 );
  move( 6, 25 );
  set_current_field( my_form, field[0] );
 
  record.id = 0;
  int ch;
  do {
    ch = getch();
   
    switch ( ch ) {
      case KEY_UP:
        form_driver(my_form, REQ_PREV_FIELD);
        form_driver(my_form, REQ_END_LINE);
        break;
      case KEY_LEFT:
        form_driver(my_form, REQ_LEFT_CHAR);
        break;
      case KEY_RIGHT:
        form_driver(my_form, REQ_RIGHT_CHAR);
        break;
      case KEY_BACKSPACE:
        form_driver(my_form, REQ_PREV_CHAR);
        form_driver(my_form, REQ_DEL_CHAR);
        break;
      case ENTER:
        form_driver( my_form, REQ_NEXT_FIELD );
        if ( current_field( my_form ) == field[0] )
          form_driver( my_form, REQ_END_LINE );
        break;
      case KEY_F(1):
        clear_lines( 20, 40 );
        {
          FIELD * curr_fld = current_field( my_form );
          size_t error = 0;
          size_t in_target_fld = 0;
          char fld_name[7];     

          if ( curr_fld == field[1] ) {
            error = query_select_all_codes_from_summon_status();
            in_target_fld = 1;
            strncpy( fld_name, "Status", 7 );
          } else if ( curr_fld == field[2] ) {
            error = query_select_all_codes_from_summon_reasons();
            in_target_fld = 1;
            strncpy( fld_name, "Reason", 7 );
          } else if ( curr_fld == field[3] ) {
            if ( query_select_all_codes_from_city_rates() ) {
              clear_line(20, 10);
              mvprintw( 20, 10, db_get_error_msg() );
              move( 12, 25 );
              set_current_field( my_form, curr_fld );
            } else {
              const SCode_t const * scode_ptr;
              size_t count = 0;
              size_t column = 10;

              mvprintw( 20, 5, "Cities:" );
              while ( ( scode_ptr = get_scode_from_result() ) != NULL ) {
                mvprintw( 21 + count++, column, "[%s] %s", scode_ptr->code, scode_ptr->name );
                if ( count == 30 ) {
                  column += 20;
                  count = 0;
                }
              }
              free_scode_result();
            }
          }
          if ( !error && in_target_fld ) {
            const Code_t const * code_ptr;
            size_t count = 0;

            mvprintw( 20, 5, "%s Options:", fld_name );
            while ( ( code_ptr = get_code_from_result() ) != NULL )          
              mvprintw( 21 + count++, 10, "[%d] %s", code_ptr->code, code_ptr->desc );
            free_code_result();
          }
          int row, col;
          get_cursor_pos( curr_fld, &row, &col );
          move( row, col );
          set_current_field( my_form, curr_fld );
        }
        break;
      case KEY_F(2):
        clear_lines( 20, 40 );

        char person_name[MAX_SUMM_NAME];
        strncpy( person_name, field_buffer(field[0], 0), MAX_SUMM_NAME );
         
        if ( is_empty_str( person_name, MAX_SUMM_NAME ) ) {
          mvprintw( 20, 10, "[!] Summon must at least have the person's name." ); 
          move( 6, 25 );
          set_current_field( my_form, field[0] );
          break;
        }
        strncpy( record.case_num, case_num, MAX_CANUM );
        strncpy( record.name, field_buffer(field[0], 0), MAX_SUMM_NAME );
        record.status = atoi( compress_str( field_buffer(field[1], 0) ) );
        record.reason = atoi( compress_str( field_buffer(field[2], 0) ) );
        strncpy( record.city_code, compress_str( field_buffer(field[3], 0) ), MAX_SUMM_CITY );
        strncpy( record.summon_date, compress_str( field_buffer(field[4], 0) ), MAX_SUMM_DATE );
        if ( query_update_summon( &record ) ) {
          mvprintw( 20, 10, db_get_error_msg() );
          move( 6, 25 );
          set_current_field( my_form, field[0] );
        } else {
          clear_fields( field, 0, 4 );
          mvprintw( 20, 10, "[!] Summon has been updated." );
          move( 6, 25 );
          set_current_field( my_form, field[0] );
          record.id = 0;
        }
        break;
      case KEY_F(3):
        clear_lines( 20, 40 );
        if ( record.id > 0 ) {
          mvprintw( 20, 10, "[?] Delete summon '%u' ? [Y/n]", record.id );
          int ch = toupper( getch() );
          if ( ch == 'Y' ) {
            if ( query_delete_summon( record.id ) ) {
              mvprintw( 20, 10, db_get_error_msg() );
            } else {
              clear_fields( field, 0, 4 );    
              mvprintw( 20, 10, "[!] Summon '%u' has been deleted.", record.id );
              move( 6, 25 );
              set_current_field( my_form, field[0] );
              record.id = 0;
            }
          }
        }
        break;
      case KEY_F(5):
        clear_lines( 20, 40 );
        if ( query_select_all_from_summons_for( case_num ) ) {
          mvprintw( 20, 10, db_get_error_msg() );
        } else {
          Summon_t *summ_ptr;
          Summon_t *summons[MAX_SUMM_SET];
          size_t count = 0;

          while ( ( summ_ptr = get_summon_from_result() ) != NULL ) {           
            summons[count] = summ_ptr;
            count++;
          }
          if ( count ) {
            size_t selection;
            char code_buff[4];

            summons_list_scr( summons, count, &selection );
            if ( selection > 0 ) {
              summ_ptr = summons[selection - 1];
              record.id = summ_ptr->id;
              set_field_buffer( field[0], 0, summ_ptr->name );
              snprintf( code_buff, 4, "%d", summ_ptr->status );
              set_field_buffer( field[1], 0, code_buff );
              snprintf( code_buff, 4, "%d", summ_ptr->reason );
              set_field_buffer( field[2], 0, code_buff );
              set_field_buffer( field[3], 0, summ_ptr->city_code );
               set_field_buffer( field[4], 0, summ_ptr->summon_date );
            }
            free_summon_result();
          } else {
            mvprintw( 20, 10, "[!] Case %s has no summons.", case_num );
          }
        }
        set_current_field( my_form, field[0] );
        move( 6, 25 );
        break;
      default:
        {
          FIELD * curr_fld = current_field( my_form );
          if ( ch == '\'' )
            break;

          if ( curr_fld == field[1] || curr_fld == field[2] ) {
            if ( !isdigit( ch ) )
              break;
          } else if ( curr_fld == field[3] ) {
            if ( !isalpha( ch ) )
              break;
            else
              ch = toupper( ch );
          }
          form_driver( my_form, ch );
          break;
        } 
    }
  } while ( ch != ESC );

  unpost_form( my_form );
  free_form( my_form );
  for ( size_t i = 0; i < n_fields - 1; ++i )
    free_field( field[i] );
  return;
}
Beispiel #29
0
void cases_menu(const char *curr_path) {
  const char *screen_title = "Cases";
  const size_t n_fields = 7;
  const size_t starty = 4;
  const size_t startx = 25;
  FIELD *field[n_fields];
  FORM *my_form;
  int width[] = { MAX_CANUM, MAX_CINUM, 
                  MAX_PHYADD, MAX_POSADD, 
                  MAX_STATUS, MAX_DELDATE 
                };
  
  initscr();
  curs_set(1);
  cbreak();
  clear();
  noecho();
  keypad(stdscr, TRUE);

  for (size_t i = 0; i < n_fields - 1; ++i) {
    field[i] = new_field(1, width[i], starty + i * 2, startx, 0, 0);
  }
  field[n_fields - 1] = NULL;

  set_field_back(field[0], A_UNDERLINE);
  field_opts_off(field[0], O_AUTOSKIP);
  field_opts_on(field[0], O_BLANK);
  set_field_back(field[1], A_UNDERLINE);
  field_opts_off(field[1], O_AUTOSKIP);
  set_field_back(field[2], A_UNDERLINE);
  field_opts_off(field[2], O_AUTOSKIP);
  set_field_back(field[3], A_UNDERLINE);
  field_opts_off(field[3], O_AUTOSKIP);
  set_field_back(field[4], A_UNDERLINE);
  field_opts_off(field[4], O_AUTOSKIP);
  set_field_back(field[5], A_UNDERLINE);
  field_opts_off(field[5], O_AUTOSKIP);

  my_form = new_form(field);
  post_form(my_form);
  refresh();

  mvprintw(0, 0, menu_path(curr_path, screen_title));
  mvprintw(4, 10,   "Case Num:      ");
  mvprintw(6, 10,   "Civil Num:     ");
  mvprintw(8, 10,   "Physical Add:  ");
  mvprintw(10, 10,  "Postal Add:    ");
  mvprintw(12, 10,  "Status:        ");
  mvprintw(14, 10,  "Delivery Date: ");
  mvprintw(16, 10,  "(F1) = Options | (F2) = Update | (F3) = Delete | (F4) = Exit");
  move(4, 25);
  refresh();

  int ch;
  do {
    ch = getch();
    switch(ch) {
      case KEY_UP:
        form_driver(my_form, REQ_PREV_FIELD);
        form_driver(my_form, REQ_END_LINE);
        break;
      case KEY_LEFT:
        form_driver(my_form, REQ_LEFT_CHAR);
        break;
      case KEY_RIGHT:
        form_driver(my_form, REQ_RIGHT_CHAR);
        break;
      case ENTER:
        form_driver( my_form, REQ_NEXT_FIELD );
        form_driver( my_form, REQ_END_LINE );
        if (field_status(field[0])) {
          size_t count = 0;
          char case_num[MAX_CANUM];

          clear_line( 20, 10 );
          strcpy( case_num, compress_str(field_buffer(field[0], 0) ) );
          if ( query_select_count_from_case_for(case_num, &count) ) {
            mvprintw( 20, 10, db_get_error_msg() );
            move( 4, 25 );
          } else {
            if ( count ) {
              //call routine to fill in fields
              Case_t record;
              if ( query_select_all_from_case_for(case_num, &record) ) {
                mvprintw( 20, 10, db_get_error_msg() );
                move( 4, 25 );
              } else {
                char status_buff[4];

                set_field_buffer( field[1], 0, record.civil );
                set_field_buffer( field[2], 0, record.physical_add );
                set_field_buffer( field[3], 0, record.postal_add );
                snprintf( status_buff, 4, "%d", record.status );
                set_field_buffer( field[4], 0, status_buff );
                set_field_buffer( field[5], 0, record.delivery_date );
              }
            } else {            
              clear_fields( field, 1, 5 );    
              mvprintw( 20, 10, "[!] Case %s does not exist.", case_num );
              move( 6, 25 );
              set_current_field( my_form, field[0] );
            }
          }
          set_field_status( field[0], 0 );
        }
        break;
      case KEY_BACKSPACE:
        form_driver(my_form, REQ_PREV_CHAR);
        form_driver(my_form, REQ_DEL_CHAR);
        break;
      case ESC:
        {
          FIELD * curr_field = current_field( my_form );
          int row, col;
          get_cursor_pos( curr_field, &row, &col );
          clear_lines( 20, 40 );
          move( row, col );
          set_current_field( my_form, curr_field );
        }
        break;
      case KEY_F(1):
        if ( current_field( my_form ) == field[4] ) {
          clear_lines( 20, 30 );
          if ( query_select_all_codes_from_case_status() ) {
            mvprintw( 20, 10, db_get_error_msg() );
          } else {
            const Code_t const * code_ptr;
            size_t count = 0;

            mvprintw( 20, 5, "Status Options:" );
            while ( ( code_ptr = get_code_from_result() ) != NULL ) {           
              mvprintw( 21 + count, 10, "[%d] %s", code_ptr->code, code_ptr->desc );
              count++;
            }
            free_code_result();
            move( 12, 25 );
            set_current_field( my_form, field[4] );
          }  
        } 
        break;
      case KEY_F(2):
      {
        size_t count = 0;
        char case_num[MAX_CANUM];
        
        clear_lines( 20, 30 );
        strncpy( case_num, compress_str(field_buffer(field[0], 0) ), MAX_CANUM );
        if ( query_select_count_from_case_for( case_num, &count ) ) {
          mvprintw( 20, 10, db_get_error_msg() );
        } else {
          Case_t record;
          strncpy( record.number, compress_str(field_buffer(field[0], 0)), MAX_CANUM );
          strncpy( record.civil, compress_str(field_buffer(field[1], 0)), MAX_CINUM );
          strncpy( record.physical_add, field_buffer(field[2], 0), MAX_PHYADD );
          strncpy( record.postal_add, field_buffer(field[3], 0), MAX_POSADD );
          record.status = atoi( compress_str(field_buffer(field[4], 0)) );
          strncpy( record.delivery_date, compress_str(field_buffer(field[5], 0)), MAX_DELDATE );
          if ( count ) {
            // update existing record
            if ( query_update_case( &record ) == 0 ) {
              mvprintw( 20, 10, "[!] Case has been updated." );
            } else {
              mvprintw( 20, 10, db_get_error_msg() );
            }
          } else {
            // create new record
            if ( query_create_new_case( &record ) == 0 ) {
              mvprintw (20, 10, "[!] Case has been created successfully." );
            } else {
              mvprintw( 20, 10, db_get_error_msg() );
            }
          }
        }
        move(4, 25);
        set_current_field( my_form, field[0] );
       }
       break;
      case KEY_F(3):
        {
          size_t count = 0;
          char case_num[MAX_CANUM];

          clear_lines(20, 30);
          strncpy(case_num, compress_str(field_buffer(field[0], 0) ), MAX_CANUM);
          if ( strlen(case_num) ) {
            if ( query_select_count_from_case_for(case_num, &count) ) {
              mvprintw( 20, 10, db_get_error_msg() );
            } else {
              if (count) {
                mvprintw(20, 10, "[?] Delete case '%s' ? [Y/n]", case_num);
                int ch = toupper(getch());
                if (ch == 'Y') {
                  if ( query_delete_case(case_num) ) {
                    mvprintw( 20, 10, db_get_error_msg() );
                  } else {
                    clear_fields(field, 0, 5);    
                    mvprintw(20, 10, "[!] Case '%s' has been deleted.");
                  }
                }
              } else {
                mvprintw(20, 10, "[!] Case '%s' does not exist.", case_num);
              }
            }
          } else {
            mvprintw(20, 10, "[!] Must enter a valid Case Number to be deleted.");
          }
        }
        move(4, 25);
        set_current_field(my_form, field[0]);
        break;
      case DEL:
        form_driver(my_form, REQ_DEL_CHAR);
        break;
      default:
        {
          FIELD * curr_fld = current_field( my_form );

          if ( ch == '\'' )
            break;
          if ( curr_fld == field[4] ) {
            if ( !isdigit( ch ) )
              break;
          }
        }
        form_driver(my_form, ch);
        break;
    } 
  } while( ch != KEY_F(4) ); 

  unpost_form(my_form);
  free_form(my_form);
  for (size_t i = 0; i < n_fields -1; ++i) {
    free_field(field[i]);
  }
  endwin();
  return;
}
Beispiel #30
0
void
column_select_create(ui_t *ui)
{
    int attr_id, column;
    MENU *menu;
    column_select_info_t *info;

    // Cerate a new indow for the panel and form
    ui_panel_create(ui, 20, 60);

    // Initialize Filter panel specific data
    info = sng_malloc(sizeof(column_select_info_t));

    // Store it into panel userptr
    set_panel_userptr(ui->panel, (void*) info);

    // Initialize the fields
    info->fields[FLD_COLUMNS_ACCEPT] = new_field(1, 10, ui->height - 2, 13, 0, 0);
    info->fields[FLD_COLUMNS_SAVE]   = new_field(1, 10, ui->height - 2, 25, 0, 0);
    info->fields[FLD_COLUMNS_CANCEL] = new_field(1, 10, ui->height - 2, 37, 0, 0);
    info->fields[FLD_COLUMNS_COUNT] = NULL;

    // Field Labels
    set_field_buffer(info->fields[FLD_COLUMNS_ACCEPT], 0, "[ Accept ]");
    set_field_buffer(info->fields[FLD_COLUMNS_SAVE],   0, "[  Save  ]");
    set_field_buffer(info->fields[FLD_COLUMNS_CANCEL], 0, "[ Cancel ]");

    // Create the form and post it
    info->form = new_form(info->fields);
    set_form_sub(info->form, ui->win);
    post_form(info->form);

    // Create a subwin for the menu area
    info->menu_win = derwin(ui->win, 10, ui->width - 2, 7, 0);

    // Initialize one field for each attribute
    for (attr_id = 0; attr_id < SIP_ATTR_COUNT; attr_id++) {
        // Create a new field for this column
        info->items[attr_id] = new_item("[ ]", sip_attr_get_description(attr_id));
        set_item_userptr(info->items[attr_id], (void*) sip_attr_get_name(attr_id));
    }
    info->items[SIP_ATTR_COUNT] = NULL;

    // Create the columns menu and post it
    info->menu = menu = new_menu(info->items);

    // Set current enabled fields
    // FIXME Stealing Call list columns :/
    call_list_info_t *list_info = call_list_info(ui_find_by_type(PANEL_CALL_LIST));

    // Enable current enabled fields and move them to the top
    for (column = 0; column < list_info->columncnt; column++) {
        const char *attr = list_info->columns[column].attr;
        for (attr_id = 0; attr_id < item_count(menu); attr_id++) {
            if (!strcmp(item_userptr(info->items[attr_id]), attr)) {
                column_select_toggle_item(ui, info->items[attr_id]);
                column_select_move_item(ui, info->items[attr_id], column);
                break;
            }
        }
    }

    // Set main window and sub window
    set_menu_win(menu, ui->win);
    set_menu_sub(menu, derwin(ui->win, 10, ui->width - 5, 7, 2));
    set_menu_format(menu, 10, 1);
    set_menu_mark(menu, "");
    set_menu_fore(menu, COLOR_PAIR(CP_DEF_ON_BLUE));
    menu_opts_off(menu, O_ONEVALUE);
    post_menu(menu);

    // Draw a scrollbar to the right
    info->scroll = ui_set_scrollbar(info->menu_win, SB_VERTICAL, SB_RIGHT);
    info->scroll.max = item_count(menu) - 1;
    ui_scrollbar_draw(info->scroll);

    // Set the window title and boxes
    mvwprintw(ui->win, 1, ui->width / 2 - 14, "Call List columns selection");
    wattron(ui->win, COLOR_PAIR(CP_BLUE_ON_DEF));
    title_foot_box(ui->panel);
    mvwhline(ui->win, 6, 1, ACS_HLINE, ui->width - 1);
    mvwaddch(ui->win, 6, 0, ACS_LTEE);
    mvwaddch(ui->win, 6, ui->width - 1, ACS_RTEE);
    wattroff(ui->win, COLOR_PAIR(CP_BLUE_ON_DEF));

    // Some brief explanation abotu what window shows
    wattron(ui->win, COLOR_PAIR(CP_CYAN_ON_DEF));
    mvwprintw(ui->win, 3, 2, "This windows show the list of columns displayed on Call");
    mvwprintw(ui->win, 4, 2, "List. You can enable/disable using Space Bar and reorder");
    mvwprintw(ui->win, 5, 2, "them using + and - keys.");
    wattroff(ui->win, COLOR_PAIR(CP_CYAN_ON_DEF));

    info->form_active = 0;
}