Added time, size and level setting types. Breaks some settings - I'll add

automatic converter to these settings later. Meanwhile you CVS users can
fix your config files yourself :)

Time settings allow using "days", "hours", "minutes", "seconds" and
"milliseconds" or several of their abbreviations. For example "5d 4h
5msecs".

Size settings allow using "gbytes", "mbytes", "kbytes" and "bytes" or their
abbrevations. For example "5MB".

Level settings are currently handled pretty much the way they were before.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3080 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-12-28 17:54:13 +00:00 committed by cras
commit bd6fe052bc
35 changed files with 526 additions and 186 deletions

View file

@ -30,7 +30,7 @@
#include "gui-windows.h"
int mirc_colors[] = { 15, 0, 1, 2, 12, 4, 5, 6, 14, 10, 3, 11, 9, 13, 8, 7 };
static int scrollback_lines, scrollback_hours, scrollback_burst_remove;
static int scrollback_lines, scrollback_time, scrollback_burst_remove;
static int last_fg, last_bg, last_flags;
static int next_xpos, next_ypos;
@ -120,7 +120,7 @@ static void remove_old_lines(TEXT_BUFFER_VIEW_REC *view)
LINE_REC *line;
time_t old_time;
old_time = time(NULL)-(scrollback_hours*3600)+1;
old_time = time(NULL)-scrollback_time+1;
if (view->buffer->lines_count >=
scrollback_lines+scrollback_burst_remove) {
/* remove lines by line count */
@ -130,7 +130,7 @@ static void remove_old_lines(TEXT_BUFFER_VIEW_REC *view)
scrollback_lines == 0) {
/* too new line, don't remove yet - also
if scrollback_lines is 0, we want to check
only scrollback_hours setting. */
only scrollback_time setting. */
break;
}
textbuffer_view_remove_line(view, line);
@ -302,7 +302,7 @@ static void sig_gui_printtext_finished(WINDOW_REC *window)
static void read_settings(void)
{
scrollback_lines = settings_get_int("scrollback_lines");
scrollback_hours = settings_get_int("scrollback_hours");
scrollback_time = settings_get_time("scrollback_time")/1000;
scrollback_burst_remove = settings_get_int("scrollback_burst_remove");
}
@ -314,7 +314,7 @@ void gui_printtext_init(void)
(GCompareFunc) g_str_equal);
settings_add_int("history", "scrollback_lines", 500);
settings_add_int("history", "scrollback_hours", 24);
settings_add_time("history", "scrollback_time", "day");
settings_add_int("history", "scrollback_burst_remove", 10);
signal_add("gui print text", (SIGNAL_FUNC) sig_gui_print_text);

View file

@ -290,15 +290,16 @@ static void item_lag(SBAR_ITEM_REC *item, int get_size_only)
int lag, lag_unknown;
server = active_win == NULL ? NULL : active_win->active_server;
lag = get_lag(server, &lag_unknown)/10;
lag = get_lag(server, &lag_unknown);
if (lag <= 0 || lag < settings_get_int("lag_min_show")) {
if (lag <= 0 || lag < settings_get_time("lag_min_show")) {
/* don't print the lag item */
if (get_size_only)
item->min_size = item->max_size = 0;
return;
}
lag /= 10;
last_lag = lag;
last_lag_unknown = lag_unknown;
@ -321,8 +322,10 @@ static void lag_check_update(void)
server = active_win == NULL ? NULL : active_win->active_server;
lag = get_lag(server, &lag_unknown)/10;
if (lag < settings_get_int("lag_min_show"))
lag = 0;
if (lag < settings_get_time("lag_min_show"))
lag = 0;
else
lag /= 10;
if (lag != last_lag || (lag > 0 && lag_unknown != last_lag_unknown))
statusbar_items_redraw("lag");
@ -372,7 +375,7 @@ static void read_settings(void)
void statusbar_items_init(void)
{
settings_add_int("misc", "lag_min_show", 100);
settings_add_time("misc", "lag_min_show", "100msec");
settings_add_bool("lookandfeel", "actlist_moves", FALSE);
statusbar_item_register("window", NULL, item_window_active);

View file

@ -137,6 +137,8 @@ static void text_chunk_line_free(TEXT_BUFFER_REC *buffer, LINE_REC *line)
break;
text = tmp-1;
} else if (*text == LINE_CMD_INDENT_FUNC) {
text += sizeof(int (*) ());
}
}
}