mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Removed all beep handling from text printing. If you want to beep just
send "beep" signal. /LAST -clear crashed if window contained only lastlog lines. Some other minor cleanups. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1312 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
88094fa9f2
commit
fcd8810b6c
@ -141,7 +141,7 @@ static void cmd_cat(const char *data)
|
|||||||
/* SYNTAX: BEEP */
|
/* SYNTAX: BEEP */
|
||||||
static void cmd_beep(void)
|
static void cmd_beep(void)
|
||||||
{
|
{
|
||||||
printbeep();
|
signal_emit("beep", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_stop(void)
|
static void sig_stop(void)
|
||||||
|
@ -540,7 +540,7 @@ static char *get_ansi_color(THEME_REC *theme, char *str,
|
|||||||
/* reset colors back to default */
|
/* reset colors back to default */
|
||||||
fg = theme->default_color;
|
fg = theme->default_color;
|
||||||
bg = -1;
|
bg = -1;
|
||||||
flags &= ~(PRINTFLAG_BEEP|PRINTFLAG_INDENT);
|
flags &= ~PRINTFLAG_INDENT;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
/* hilight */
|
/* hilight */
|
||||||
@ -734,17 +734,17 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
|
|||||||
if (type == 7) {
|
if (type == 7) {
|
||||||
/* bell */
|
/* bell */
|
||||||
if (settings_get_bool("bell_beeps"))
|
if (settings_get_bool("bell_beeps"))
|
||||||
flags |= PRINTFLAG_BEEP;
|
signal_emit("beep", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*str != '\0' || (flags & PRINTFLAG_BEEP)) {
|
if (*str != '\0') {
|
||||||
/* send the text to gui handler */
|
/* send the text to gui handler */
|
||||||
signal_emit_id(signal_gui_print_text, 6, dest->window,
|
signal_emit_id(signal_gui_print_text, 6, dest->window,
|
||||||
GINT_TO_POINTER(fgcolor),
|
GINT_TO_POINTER(fgcolor),
|
||||||
GINT_TO_POINTER(bgcolor),
|
GINT_TO_POINTER(bgcolor),
|
||||||
GINT_TO_POINTER(flags), str,
|
GINT_TO_POINTER(flags), str,
|
||||||
dest->level);
|
dest->level);
|
||||||
flags &= ~(PRINTFLAG_BEEP | PRINTFLAG_INDENT);
|
flags &= ~PRINTFLAG_INDENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == '\n')
|
if (type == '\n')
|
||||||
@ -812,7 +812,6 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
|
|||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
/* remove all styling */
|
/* remove all styling */
|
||||||
flags &= PRINTFLAG_BEEP;
|
|
||||||
fgcolor = bgcolor = -1;
|
fgcolor = bgcolor = -1;
|
||||||
break;
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
|
@ -7,11 +7,10 @@
|
|||||||
#define PRINTFLAG_BOLD 0x01
|
#define PRINTFLAG_BOLD 0x01
|
||||||
#define PRINTFLAG_REVERSE 0x02
|
#define PRINTFLAG_REVERSE 0x02
|
||||||
#define PRINTFLAG_UNDERLINE 0x04
|
#define PRINTFLAG_UNDERLINE 0x04
|
||||||
#define PRINTFLAG_BEEP 0x08
|
#define PRINTFLAG_BLINK 0x08
|
||||||
#define PRINTFLAG_BLINK 0x10
|
#define PRINTFLAG_MIRC_COLOR 0x10
|
||||||
#define PRINTFLAG_MIRC_COLOR 0x20
|
#define PRINTFLAG_INDENT 0x20
|
||||||
#define PRINTFLAG_INDENT 0x40
|
#define PRINTFLAG_NEWLINE 0x40
|
||||||
#define PRINTFLAG_NEWLINE 0x80
|
|
||||||
|
|
||||||
#define MAX_FORMAT_PARAMS 10
|
#define MAX_FORMAT_PARAMS 10
|
||||||
#define DEFAULT_FORMAT_ARGLIST_SIZE 200
|
#define DEFAULT_FORMAT_ARGLIST_SIZE 200
|
||||||
|
@ -45,12 +45,6 @@ static int sending_print_starting;
|
|||||||
|
|
||||||
static void print_line(TEXT_DEST_REC *dest, const char *text);
|
static void print_line(TEXT_DEST_REC *dest, const char *text);
|
||||||
|
|
||||||
void printbeep(void)
|
|
||||||
{
|
|
||||||
signal_emit_id(signal_gui_print_text, 6, active_win, NULL, NULL,
|
|
||||||
GINT_TO_POINTER(PRINTFLAG_BEEP), "", MSGLEVEL_NEVER);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void printformat_module_dest(const char *module, TEXT_DEST_REC *dest,
|
static void printformat_module_dest(const char *module, TEXT_DEST_REC *dest,
|
||||||
int formatnum, va_list va)
|
int formatnum, va_list va)
|
||||||
{
|
{
|
||||||
@ -367,7 +361,7 @@ static void msg_beep_check(SERVER_REC *server, int level)
|
|||||||
if (level != 0 && (level & MSGLEVEL_NOHILIGHT) == 0 &&
|
if (level != 0 && (level & MSGLEVEL_NOHILIGHT) == 0 &&
|
||||||
(beep_msg_level & level) &&
|
(beep_msg_level & level) &&
|
||||||
(beep_when_away || (server != NULL && !server->usermode_away))) {
|
(beep_when_away || (server != NULL && !server->usermode_away))) {
|
||||||
printbeep();
|
signal_emit("beep", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ void printtext(void *server, const char *target, int level, const char *text, ..
|
|||||||
void printtext_string(void *server, const char *target, int level, const char *text);
|
void printtext_string(void *server, const char *target, int level, const char *text);
|
||||||
void printtext_window(WINDOW_REC *window, int level, const char *text, ...);
|
void printtext_window(WINDOW_REC *window, int level, const char *text, ...);
|
||||||
void printtext_multiline(void *server, const char *target, int level, const char *format, const char *text);
|
void printtext_multiline(void *server, const char *target, int level, const char *format, const char *text);
|
||||||
void printbeep(void);
|
|
||||||
|
|
||||||
/* only GUI should call these - used for printing text to somewhere else
|
/* only GUI should call these - used for printing text to somewhere else
|
||||||
than windows */
|
than windows */
|
||||||
|
@ -184,6 +184,12 @@ void gui_window_line_remove(WINDOW_REC *window, LINE_REC *line, int redraw)
|
|||||||
|
|
||||||
gui = WINDOW_GUI(window);
|
gui = WINDOW_GUI(window);
|
||||||
|
|
||||||
|
if (gui->lines->next == NULL) {
|
||||||
|
/* last line in window */
|
||||||
|
gui_window_clear(window);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
screenchange = g_list_find(gui->startline, line) != NULL;
|
screenchange = g_list_find(gui->startline, line) != NULL;
|
||||||
if (screenchange) gui->ypos -= gui_window_get_linecount(gui, line);
|
if (screenchange) gui->ypos -= gui_window_get_linecount(gui, line);
|
||||||
|
|
||||||
@ -363,8 +369,6 @@ static void line_add_colors(GUI_WINDOW_REC *gui, int fg, int bg, int flags)
|
|||||||
buffer[pos++] = 0;
|
buffer[pos++] = 0;
|
||||||
buffer[pos++] = LINE_CMD_INDENT;
|
buffer[pos++] = LINE_CMD_INDENT;
|
||||||
}
|
}
|
||||||
if (flags & PRINTFLAG_BEEP)
|
|
||||||
signal_emit("beep", 0);
|
|
||||||
|
|
||||||
linebuf_add(gui, (char *) buffer, pos);
|
linebuf_add(gui, (char *) buffer, pos);
|
||||||
|
|
||||||
|
@ -270,7 +270,8 @@ static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui,
|
|||||||
LINE_CACHE_REC *rec;
|
LINE_CACHE_REC *rec;
|
||||||
LINE_CACHE_SUB_REC *sub;
|
LINE_CACHE_SUB_REC *sub;
|
||||||
GSList *lines;
|
GSList *lines;
|
||||||
unsigned char *ptr, *last_space_ptr;
|
unsigned char cmd;
|
||||||
|
char *ptr, *last_space_ptr;
|
||||||
int xpos, pos, indent_pos, last_space, last_color, color;
|
int xpos, pos, indent_pos, last_space, last_color, color;
|
||||||
|
|
||||||
g_return_val_if_fail(line->text != NULL, NULL);
|
g_return_val_if_fail(line->text != NULL, NULL);
|
||||||
@ -282,25 +283,28 @@ static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui,
|
|||||||
last_space = last_color = 0; last_space_ptr = NULL; sub = NULL;
|
last_space = last_color = 0; last_space_ptr = NULL; sub = NULL;
|
||||||
|
|
||||||
rec->count = 1; lines = NULL;
|
rec->count = 1; lines = NULL;
|
||||||
for (ptr = (unsigned char *) line->text;;) {
|
for (ptr = line->text;;) {
|
||||||
if (*ptr == '\0') {
|
if (*ptr == '\0') {
|
||||||
/* command */
|
/* command */
|
||||||
ptr++;
|
ptr++;
|
||||||
if (*ptr == LINE_CMD_EOL || *ptr == LINE_CMD_FORMAT)
|
cmd = *ptr;
|
||||||
|
ptr++;
|
||||||
|
|
||||||
|
if (cmd == LINE_CMD_EOL || cmd == LINE_CMD_FORMAT)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*ptr == LINE_CMD_CONTINUE) {
|
if (cmd == LINE_CMD_CONTINUE) {
|
||||||
unsigned char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
memcpy(&tmp, ptr+1, sizeof(char *));
|
memcpy(&tmp, ptr, sizeof(char *));
|
||||||
ptr = tmp;
|
ptr = tmp;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*ptr & 0x80) == 0) {
|
if ((cmd & 0x80) == 0) {
|
||||||
/* set color */
|
/* set color */
|
||||||
color = (color & ATTR_UNDERLINE) | *ptr;
|
color = (color & ATTR_UNDERLINE) | cmd;
|
||||||
} else switch (*ptr) {
|
} else switch (cmd) {
|
||||||
case LINE_CMD_UNDERLINE:
|
case LINE_CMD_UNDERLINE:
|
||||||
color ^= ATTR_UNDERLINE;
|
color ^= ATTR_UNDERLINE;
|
||||||
break;
|
break;
|
||||||
@ -320,8 +324,6 @@ static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui,
|
|||||||
if (xpos < COLS-5) indent_pos = xpos;
|
if (xpos < COLS-5) indent_pos = xpos;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +349,7 @@ static LINE_CACHE_REC *gui_window_line_cache(GUI_WINDOW_REC *gui,
|
|||||||
sub->continues = TRUE;
|
sub->continues = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub->start = (char *) ptr;
|
sub->start = ptr;
|
||||||
sub->indent = xpos;
|
sub->indent = xpos;
|
||||||
sub->color = color;
|
sub->color = color;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user