Scrollbar added in general configuration menu
This commit is contained in:
parent
f0d4409151
commit
2e798df3cb
@ -1,3 +1,6 @@
|
|||||||
|
19 Apr 2008:
|
||||||
|
Scrollbar added in general configuration menu
|
||||||
|
|
||||||
18 Apr 2008:
|
18 Apr 2008:
|
||||||
Generic functions to handle scrolling windows created
|
Generic functions to handle scrolling windows created
|
||||||
|
|
||||||
|
166
src/custom.c
166
src/custom.c
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: custom.c,v 1.20 2008/04/12 21:14:03 culot Exp $ */
|
/* $calcurse: custom.c,v 1.21 2008/04/19 09:22:14 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -702,89 +702,95 @@ custom_color_theme_name (char *theme_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Prints the general options. */
|
/* Prints the general options. */
|
||||||
static void
|
static int
|
||||||
custom_print_general_options (WINDOW *optwin, conf_t *conf)
|
print_general_options (WINDOW *win, conf_t *conf)
|
||||||
{
|
{
|
||||||
int x_pos, y_pos;
|
const int XPOS = 1;
|
||||||
char *option1 = _("auto_save = ");
|
const int YOFF = 3;
|
||||||
char *option2 = _("confirm_quit = ");
|
int y;
|
||||||
char *option3 = _("confirm_delete = ");
|
char *opt1 = _("auto_save = ");
|
||||||
char *option4 = _("skip_system_dialogs = ");
|
char *opt2 = _("confirm_quit = ");
|
||||||
char *option5 = _("skip_progress_bar = ");
|
char *opt3 = _("confirm_delete = ");
|
||||||
char *option6 = _("week_begins_on_monday = ");
|
char *opt4 = _("skip_system_dialogs = ");
|
||||||
char *option7 = _("output_datefmt = ");
|
char *opt5 = _("skip_progress_bar = ");
|
||||||
char *option8 = _("input_datefmt = ");
|
char *opt6 = _("week_begins_on_monday = ");
|
||||||
|
char *opt7 = _("output_datefmt = ");
|
||||||
|
char *opt8 = _("input_datefmt = ");
|
||||||
|
|
||||||
x_pos = 3;
|
y = 0;
|
||||||
y_pos = 3;
|
mvwprintw (win, y, XPOS, "[1] %s ", opt1);
|
||||||
|
print_option_incolor (win, conf->auto_save, y, XPOS + 4 + strlen (opt1));
|
||||||
mvwprintw (optwin, y_pos, x_pos, "[1] %s ", option1);
|
mvwprintw (win, y + 1, XPOS,
|
||||||
print_option_incolor (optwin, conf->auto_save, y_pos,
|
|
||||||
x_pos + 4 + strlen (option1));
|
|
||||||
mvwprintw (optwin, y_pos + 1, x_pos,
|
|
||||||
_("(if set to YES, automatic save is done when quitting)"));
|
_("(if set to YES, automatic save is done when quitting)"));
|
||||||
|
y += YOFF;
|
||||||
mvwprintw (optwin, y_pos + 3, x_pos, "[2] %s ", option2);
|
mvwprintw (win, y, XPOS, "[2] %s ", opt2);
|
||||||
print_option_incolor (optwin, conf->confirm_quit, y_pos + 3,
|
print_option_incolor (win, conf->confirm_quit, y, XPOS + 4 + strlen (opt2));
|
||||||
x_pos + 4 + strlen (option2));
|
mvwprintw (win, y + 1, XPOS,
|
||||||
mvwprintw (optwin, y_pos + 4, x_pos,
|
|
||||||
_("(if set to YES, confirmation is required before quitting)"));
|
_("(if set to YES, confirmation is required before quitting)"));
|
||||||
|
y += YOFF;
|
||||||
mvwprintw (optwin, y_pos + 6, x_pos, "[3] %s ", option3);
|
mvwprintw (win, y, XPOS, "[3] %s ", opt3);
|
||||||
print_option_incolor (optwin, conf->confirm_delete, y_pos + 6,
|
print_option_incolor (win, conf->confirm_delete, y, XPOS + 4 + strlen (opt3));
|
||||||
x_pos + 4 + strlen (option3));
|
mvwprintw (win, y + 1, XPOS,
|
||||||
mvwprintw (optwin, y_pos + 7, x_pos,
|
|
||||||
_("(if set to YES, confirmation is required "
|
_("(if set to YES, confirmation is required "
|
||||||
"before deleting an event)"));
|
"before deleting an event)"));
|
||||||
|
y += YOFF;
|
||||||
mvwprintw (optwin, y_pos + 9, x_pos, "[4] %s ", option4);
|
mvwprintw (win, y, XPOS, "[4] %s ", opt4);
|
||||||
print_option_incolor (optwin, conf->skip_system_dialogs, y_pos + 9,
|
print_option_incolor (win, conf->skip_system_dialogs, y,
|
||||||
x_pos + 4 + strlen (option4));
|
XPOS + 4 + strlen (opt4));
|
||||||
mvwprintw (optwin, y_pos + 10, x_pos,
|
mvwprintw (win, y + 1, XPOS,
|
||||||
_("(if set to YES, messages about loaded "
|
_("(if set to YES, messages about loaded "
|
||||||
"and saved data will not be displayed)"));
|
"and saved data will not be displayed)"));
|
||||||
|
y += YOFF;
|
||||||
mvwprintw (optwin, y_pos + 12, x_pos, "[5] %s ", option5);
|
mvwprintw (win, y, XPOS, "[5] %s ", opt5);
|
||||||
print_option_incolor (optwin, conf->skip_progress_bar, y_pos + 12,
|
print_option_incolor (win, conf->skip_progress_bar, y,
|
||||||
x_pos + 4 + strlen (option5));
|
XPOS + 4 + strlen (opt5));
|
||||||
mvwprintw (optwin, y_pos + 13, x_pos,
|
mvwprintw (win, y + 1, XPOS,
|
||||||
_("(if set to YES, progress bar will not be displayed "
|
_("(if set to YES, progress bar will not be displayed "
|
||||||
"when saving data)"));
|
"when saving data)"));
|
||||||
|
y += YOFF;
|
||||||
mvwprintw (optwin, y_pos + 15, x_pos, "[6] %s ", option6);
|
mvwprintw (win, y, XPOS, "[6] %s ", opt6);
|
||||||
print_option_incolor (optwin, calendar_week_begins_on_monday (), y_pos + 15,
|
print_option_incolor (win, calendar_week_begins_on_monday (), y,
|
||||||
x_pos + 4 + strlen (option6));
|
XPOS + 4 + strlen (opt6));
|
||||||
mvwprintw (optwin, y_pos + 16, x_pos,
|
mvwprintw (win, y + 1, XPOS,
|
||||||
_("(if set to YES, monday is the first day of the week, "
|
_("(if set to YES, monday is the first day of the week, "
|
||||||
"else it is sunday)"));
|
"else it is sunday)"));
|
||||||
|
y += YOFF;
|
||||||
mvwprintw (optwin, y_pos + 18, x_pos, "[7] %s ", option7);
|
mvwprintw (win, y, XPOS, "[7] %s ", opt7);
|
||||||
custom_apply_attr (optwin, ATTR_HIGHEST);
|
custom_apply_attr (win, ATTR_HIGHEST);
|
||||||
mvwprintw (optwin, y_pos + 18, x_pos + 4 + strlen (option7), "%s",
|
mvwprintw (win, y, XPOS + 4 + strlen (opt7), "%s", conf->output_datefmt);
|
||||||
conf->output_datefmt);
|
custom_remove_attr (win, ATTR_HIGHEST);
|
||||||
custom_remove_attr (optwin, ATTR_HIGHEST);
|
mvwprintw (win, y + 1, XPOS,
|
||||||
mvwprintw (optwin, y_pos + 19, x_pos,
|
|
||||||
_("(Format of the date to be displayed in non-interactive mode)"));
|
_("(Format of the date to be displayed in non-interactive mode)"));
|
||||||
|
y += YOFF;
|
||||||
|
mvwprintw (win, y, XPOS, "[8] %s ", opt8);
|
||||||
|
custom_apply_attr (win, ATTR_HIGHEST);
|
||||||
|
mvwprintw (win, y, XPOS + 4 + strlen (opt8), "%d", conf->input_datefmt);
|
||||||
|
custom_remove_attr (win, ATTR_HIGHEST);
|
||||||
|
mvwprintw (win, y + 1, XPOS, _("(Format to be used when entering a date: "));
|
||||||
|
mvwprintw (win, y + 2, XPOS, _(" 1-mm/dd/yyyy, 2-dd/mm/yyyy, 3-yyyy/mm/dd)"));
|
||||||
|
|
||||||
mvwprintw (optwin, y_pos + 21, x_pos, "[8] %s ", option8);
|
return (y + 3);
|
||||||
custom_apply_attr (optwin, ATTR_HIGHEST);
|
}
|
||||||
mvwprintw (optwin, y_pos + 21, x_pos + 4 + strlen (option7), "%d",
|
|
||||||
conf->input_datefmt);
|
|
||||||
custom_remove_attr (optwin, ATTR_HIGHEST);
|
|
||||||
mvwprintw (optwin, y_pos + 22, x_pos,
|
|
||||||
_("(Format to be used when entering a date: "
|
|
||||||
"1-mm/dd/yyyy, 2-dd/mm/yyyy, 3-yyyy/mm/dd)"));
|
|
||||||
|
|
||||||
wmove (win[STA].p, 1, 0);
|
static void
|
||||||
wnoutrefresh (optwin);
|
general_conf_set_scrsize (scrollwin_t *sw)
|
||||||
doupdate ();
|
{
|
||||||
|
sw->win.x = 0;
|
||||||
|
sw->win.y = 0;
|
||||||
|
sw->win.h = (notify_bar ()) ? row - 3 : row - 2;
|
||||||
|
sw->win.w = col;
|
||||||
|
|
||||||
|
sw->pad.x = 1;
|
||||||
|
sw->pad.y = 3;
|
||||||
|
sw->pad.h = BUFSIZ;
|
||||||
|
sw->pad.w = col - 2 * sw->pad.x - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* General configuration. */
|
/* General configuration. */
|
||||||
void
|
void
|
||||||
custom_general_config (conf_t *conf)
|
custom_general_config (conf_t *conf)
|
||||||
{
|
{
|
||||||
window_t conf_win;
|
scrollwin_t cwin;
|
||||||
char *number_str =
|
char *number_str =
|
||||||
_("Enter an option number to change its value [Q to quit] ");
|
_("Enter an option number to change its value [Q to quit] ");
|
||||||
char *output_datefmt_str =
|
char *output_datefmt_str =
|
||||||
@ -792,24 +798,29 @@ custom_general_config (conf_t *conf)
|
|||||||
char *input_datefmt_str =
|
char *input_datefmt_str =
|
||||||
_("Enter the date format (1-mm/dd/yyyy, 2-dd/mm/yyyy, 3-yyyy/mm/dd) ");
|
_("Enter the date format (1-mm/dd/yyyy, 2-dd/mm/yyyy, 3-yyyy/mm/dd) ");
|
||||||
int ch;
|
int ch;
|
||||||
char label[BUFSIZ];
|
|
||||||
char *buf = (char *) malloc (BUFSIZ);
|
char *buf = (char *) malloc (BUFSIZ);
|
||||||
|
|
||||||
clear ();
|
clear ();
|
||||||
snprintf (label, BUFSIZ, _("CalCurse %s | general options"), VERSION);
|
general_conf_set_scrsize (&cwin);
|
||||||
custom_confwin_init (&conf_win, label);
|
snprintf (cwin.label, BUFSIZ, _("CalCurse %s | general options"), VERSION);
|
||||||
|
wins_scrollwin_init (&cwin);
|
||||||
|
wins_show (cwin.win.p, cwin.label);
|
||||||
status_mesg (number_str, "");
|
status_mesg (number_str, "");
|
||||||
custom_print_general_options (conf_win.p, conf);
|
cwin.total_lines = print_general_options (cwin.pad.p, conf);
|
||||||
|
wins_scrollwin_display (&cwin);
|
||||||
|
|
||||||
while ((ch = wgetch (win[STA].p)) != 'q')
|
while ((ch = wgetch (win[STA].p)) != 'q')
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
case KEY_RESIZE:
|
case KEY_RESIZE:
|
||||||
endwin ();
|
wins_get_config ();
|
||||||
refresh ();
|
wins_reset ();
|
||||||
curs_set (0);
|
wins_scrollwin_delete (&cwin);
|
||||||
delwin (conf_win.p);
|
wins_scrollwin_init (&cwin);
|
||||||
custom_confwin_init (&conf_win, label);
|
general_conf_set_scrsize (&cwin);
|
||||||
|
wins_show (cwin.win.p, cwin.label);
|
||||||
|
cwin.first_visible_line = 0;
|
||||||
delwin (win[STA].p);
|
delwin (win[STA].p);
|
||||||
win[STA].p = newwin (win[STA].h, win[STA].w, win[STA].y,
|
win[STA].p = newwin (win[STA].h, win[STA].w, win[STA].y,
|
||||||
win[STA].x);
|
win[STA].x);
|
||||||
@ -821,6 +832,12 @@ custom_general_config (conf_t *conf)
|
|||||||
notify_update_bar ();
|
notify_update_bar ();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CTRL ('n'):
|
||||||
|
wins_scrollwin_down (&cwin);
|
||||||
|
break;
|
||||||
|
case CTRL ('p'):
|
||||||
|
wins_scrollwin_up (&cwin);
|
||||||
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
conf->auto_save = !conf->auto_save;
|
conf->auto_save = !conf->auto_save;
|
||||||
break;
|
break;
|
||||||
@ -861,8 +878,9 @@ custom_general_config (conf_t *conf)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
status_mesg (number_str, "");
|
status_mesg (number_str, "");
|
||||||
custom_print_general_options (conf_win.p, conf);
|
cwin.total_lines = print_general_options (cwin.pad.p, conf);
|
||||||
|
wins_scrollwin_display (&cwin);
|
||||||
}
|
}
|
||||||
free (buf);
|
free (buf);
|
||||||
delwin (conf_win.p);
|
wins_scrollwin_delete (&cwin);
|
||||||
}
|
}
|
||||||
|
11
src/help.c
11
src/help.c
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: help.c,v 1.23 2008/04/18 17:53:31 culot Exp $ */
|
/* $calcurse: help.c,v 1.24 2008/04/19 09:22:14 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -576,7 +576,7 @@ help_screen (void)
|
|||||||
/* Display the help screen related to user input. */
|
/* Display the help screen related to user input. */
|
||||||
while (ch != 'q')
|
while (ch != 'q')
|
||||||
{
|
{
|
||||||
erase_window_part (hwin.win.p, 1, TITLELINES, col - 2,
|
erase_window_part (hwin.win.p, 1, hwin.pad.y, col - 2,
|
||||||
hwin.win.h - 2);
|
hwin.win.h - 2);
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
@ -588,14 +588,11 @@ help_screen (void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CTRL ('n'):
|
case CTRL ('n'):
|
||||||
if (hwin.total_lines
|
wins_scrollwin_down (&hwin);
|
||||||
> (hwin.first_visible_line + hwin.win.h - hwin.pad.x))
|
|
||||||
hwin.first_visible_line++;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CTRL ('p'):
|
case CTRL ('p'):
|
||||||
if (hwin.first_visible_line > 0)
|
wins_scrollwin_up (&hwin);
|
||||||
hwin.first_visible_line--;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
19
src/wins.c
19
src/wins.c
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: wins.c,v 1.14 2008/04/18 17:53:31 culot Exp $ */
|
/* $calcurse: wins.c,v 1.15 2008/04/19 09:22:14 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -145,7 +145,7 @@ wins_scrollwin_delete (scrollwin_t *sw)
|
|||||||
void
|
void
|
||||||
wins_scrollwin_display (scrollwin_t *sw)
|
wins_scrollwin_display (scrollwin_t *sw)
|
||||||
{
|
{
|
||||||
const int visible_lines = sw->win.h - sw->pad.x;
|
const int visible_lines = sw->win.h - sw->pad.y - 1;
|
||||||
|
|
||||||
if (sw->total_lines > visible_lines)
|
if (sw->total_lines > visible_lines)
|
||||||
{
|
{
|
||||||
@ -166,6 +166,21 @@ wins_scrollwin_display (scrollwin_t *sw)
|
|||||||
doupdate ();
|
doupdate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wins_scrollwin_up (scrollwin_t *sw)
|
||||||
|
{
|
||||||
|
if (sw->first_visible_line > 0)
|
||||||
|
sw->first_visible_line--;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wins_scrollwin_down (scrollwin_t *sw)
|
||||||
|
{
|
||||||
|
if (sw->total_lines
|
||||||
|
> (sw->first_visible_line + sw->win.h - sw->pad.y - 1))
|
||||||
|
sw->first_visible_line++;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete the existing windows and recreate them with their new
|
* Delete the existing windows and recreate them with their new
|
||||||
* size and placement.
|
* size and placement.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: wins.h,v 1.8 2008/04/18 17:53:31 culot Exp $ */
|
/* $calcurse: wins.h,v 1.9 2008/04/19 09:22:14 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -72,6 +72,8 @@ void wins_init (void);
|
|||||||
void wins_scrollwin_init (scrollwin_t *);
|
void wins_scrollwin_init (scrollwin_t *);
|
||||||
void wins_scrollwin_delete (scrollwin_t *);
|
void wins_scrollwin_delete (scrollwin_t *);
|
||||||
void wins_scrollwin_display (scrollwin_t *);
|
void wins_scrollwin_display (scrollwin_t *);
|
||||||
|
void wins_scrollwin_up (scrollwin_t *);
|
||||||
|
void wins_scrollwin_down (scrollwin_t *);
|
||||||
void wins_reinit (void);
|
void wins_reinit (void);
|
||||||
void wins_show (WINDOW *, char *);
|
void wins_show (WINDOW *, char *);
|
||||||
void wins_get_config (void);
|
void wins_get_config (void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user