1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-04 00:25:42 +02:00

New gtk features

This commit is contained in:
Sebastien Helleu
2003-10-13 21:51:34 +00:00
parent ecd92ae24d
commit 13716a5228
12 changed files with 464 additions and 522 deletions
+2 -1
View File
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
Features
--------
* IRC chat client with multi-server connection
* many GUI (curses, text, Gtk, QT) (1)
* many GUI (curses, Gtk, QT) (1)
* small, fast and very light
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
* compliant with RFC 1459,2810,2811,2812,2813
* developed from scratch (not based on any other IRC client, except for look ;)
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
* 100% GPL & free
+22 -7
View File
@@ -1041,7 +1041,7 @@ gui_switch_to_window (t_gui_window *window)
another_window = 0;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->win_title)
if (ptr_win->is_displayed)
{
/* TODO: manage splitted windows */
another_window = 1;
@@ -1055,6 +1055,7 @@ gui_switch_to_window (t_gui_window *window)
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
break;
}
}
@@ -1115,6 +1116,7 @@ gui_switch_to_window (t_gui_window *window)
/* change current window to the new window */
gui_current_window = window;
window->is_displayed = 1;
window->unread_data = 0;
}
@@ -1229,6 +1231,20 @@ gui_curses_resize_handler ()
}
}
/*
* gui_window_init_subwindows: init subwindows for a WeeChat window
*/
void
gui_window_init_subwindows (t_gui_window *window)
{
window->win_title = NULL;
window->win_chat = NULL;
window->win_nick = NULL;
window->win_status = NULL;
window->win_input = NULL;
}
/*
* gui_init_colors: init GUI colors
*/
@@ -1348,7 +1364,7 @@ gui_init ()
gui_init_colors ();
/* create windows */
/* create a new window */
gui_current_window = gui_window_new (NULL, NULL /*0, 0, COLS, LINES*/);
signal (SIGWINCH, gui_curses_resize_handler);
@@ -1507,11 +1523,10 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
gui_add_message (window, type, color, pos+1);
pos = strchr (pos+1, '\n');
if (pos)
if (pos[1] == '\0')
pos = NULL;
gui_add_message (window, type, color, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
wrefresh (window->win_chat);
+89 -134
View File
File diff suppressed because it is too large Load Diff
+88 -90
View File
File diff suppressed because it is too large Load Diff
+28 -26
View File
@@ -76,6 +76,13 @@
#define WIN_IS_CHANNEL(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_CHANNEL))
#define WIN_IS_PRIVATE(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_PRIVATE))
#ifdef WEE_CURSES
#define WIN_HAS_NICKLIST(window) (window->win_nick)
#endif
#ifdef WEE_GTK
#define WIN_HAS_NICKLIST(window) (window->textbuffer_nicklist)
#endif
#define MSG_TYPE_TIME 0
#define MSG_TYPE_NICK 1
#define MSG_TYPE_INFO 2
@@ -123,6 +130,8 @@ typedef struct t_gui_window t_gui_window;
struct t_gui_window
{
int is_displayed; /* = 1 if window is displayed */
/* server/channel */
void *server; /* window's server */
void *channel; /* window's channel */
@@ -152,11 +161,11 @@ struct t_gui_window
WINDOW *win_input; /* input window */
#endif
#ifdef WEE_GTK
GtkWidget *win_title; /* title window */
GtkWidget *win_chat; /* chat window (exemple: channel) */
GtkWidget *win_nick; /* nick window */
GtkWidget *win_status; /* status window */
GtkWidget *win_input; /* input window */
GtkWidget *textview_chat; /* textview widget for chat */
GtkTextBuffer *textbuffer_chat; /* textbuffer widget for chat */
GtkTextTag *texttag_chat; /* texttag widget for chat */
GtkWidget *textview_nicklist; /* textview widget for nicklist */
GtkTextBuffer *textbuffer_nicklist; /* textbuffer widget for nicklist */
#endif
#ifdef WEE_QT
/* TODO: declare Qt window */
@@ -198,12 +207,22 @@ extern t_gui_window *gui_current_window;
/* prototypes */
/* GUI independent functions */
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/); /* TODO: add coordinates and size */
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_optimize_input_buffer_size (t_gui_window *);
extern void gui_delete_previous_word ();
extern void gui_move_previous_word ();
extern void gui_move_next_word ();
extern void gui_buffer_insert_string (char *, int);
/* GUI dependant functions */
extern int gui_assign_color (int *, char *);
extern int gui_get_color_by_name (char *);
extern char *gui_get_color_by_value (int);
extern void gui_calculate_pos_size (t_gui_window *);
extern void gui_draw_window_title (t_gui_window *);
extern void gui_redraw_window_title (t_gui_window *);
extern void gui_draw_window_chat (t_gui_window *);
@@ -215,34 +234,17 @@ extern void gui_redraw_window_status (t_gui_window *);
extern void gui_draw_window_input (t_gui_window *);
extern void gui_redraw_window_input (t_gui_window *);
extern void gui_redraw_window (t_gui_window *);
extern t_gui_window *gui_window_new (void *, void *);
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern void gui_switch_to_window (t_gui_window *);
extern void gui_switch_to_previous_window ();
extern void gui_switch_to_next_window ();
extern void gui_move_page_up ();
extern void gui_move_page_down ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_init_colors ();
extern void gui_init ();
/* TODO: add coordinates and size */
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/);
extern void gui_window_free (t_gui_window *);
extern void gui_end ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
extern void gui_optimize_input_buffer_size (t_gui_window *);
extern void gui_delete_previous_word ();
extern void gui_move_previous_word ();
extern void gui_move_next_word ();
extern void gui_buffer_insert_string (char *, int);
extern void gui_main_loop ();
#endif /* gui.h */
+3 -3
View File
@@ -501,7 +501,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
COLOR_WIN_CHAT_NICK,
"%s\n",
arguments);
if (ptr_channel->window->win_nick)
if (WIN_HAS_NICKLIST(ptr_channel->window))
gui_redraw_window_nick (ptr_channel->window);
}
}
@@ -692,7 +692,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
gui_printf (ptr_channel->window, "\n");
/* redraw nick list if this is current window */
if (ptr_channel->window->win_nick)
if (WIN_HAS_NICKLIST(ptr_channel->window))
gui_redraw_window_nick (ptr_channel->window);
}
}
@@ -978,7 +978,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_DARK, ")\n");
if ((ptr_channel->window == gui_current_window) &&
(ptr_channel->window->win_nick))
(WIN_HAS_NICKLIST(ptr_channel->window)))
gui_redraw_window_nick (ptr_channel->window);
}
}
+2 -1
View File
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
Features
--------
* IRC chat client with multi-server connection
* many GUI (curses, text, Gtk, QT) (1)
* many GUI (curses, Gtk, QT) (1)
* small, fast and very light
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
* compliant with RFC 1459,2810,2811,2812,2813
* developed from scratch (not based on any other IRC client, except for look ;)
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
* 100% GPL & free
+22 -7
View File
@@ -1041,7 +1041,7 @@ gui_switch_to_window (t_gui_window *window)
another_window = 0;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->win_title)
if (ptr_win->is_displayed)
{
/* TODO: manage splitted windows */
another_window = 1;
@@ -1055,6 +1055,7 @@ gui_switch_to_window (t_gui_window *window)
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
break;
}
}
@@ -1115,6 +1116,7 @@ gui_switch_to_window (t_gui_window *window)
/* change current window to the new window */
gui_current_window = window;
window->is_displayed = 1;
window->unread_data = 0;
}
@@ -1229,6 +1231,20 @@ gui_curses_resize_handler ()
}
}
/*
* gui_window_init_subwindows: init subwindows for a WeeChat window
*/
void
gui_window_init_subwindows (t_gui_window *window)
{
window->win_title = NULL;
window->win_chat = NULL;
window->win_nick = NULL;
window->win_status = NULL;
window->win_input = NULL;
}
/*
* gui_init_colors: init GUI colors
*/
@@ -1348,7 +1364,7 @@ gui_init ()
gui_init_colors ();
/* create windows */
/* create a new window */
gui_current_window = gui_window_new (NULL, NULL /*0, 0, COLS, LINES*/);
signal (SIGWINCH, gui_curses_resize_handler);
@@ -1507,11 +1523,10 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
gui_add_message (window, type, color, pos+1);
pos = strchr (pos+1, '\n');
if (pos)
if (pos[1] == '\0')
pos = NULL;
gui_add_message (window, type, color, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
wrefresh (window->win_chat);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+28 -26
View File
@@ -76,6 +76,13 @@
#define WIN_IS_CHANNEL(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_CHANNEL))
#define WIN_IS_PRIVATE(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_PRIVATE))
#ifdef WEE_CURSES
#define WIN_HAS_NICKLIST(window) (window->win_nick)
#endif
#ifdef WEE_GTK
#define WIN_HAS_NICKLIST(window) (window->textbuffer_nicklist)
#endif
#define MSG_TYPE_TIME 0
#define MSG_TYPE_NICK 1
#define MSG_TYPE_INFO 2
@@ -123,6 +130,8 @@ typedef struct t_gui_window t_gui_window;
struct t_gui_window
{
int is_displayed; /* = 1 if window is displayed */
/* server/channel */
void *server; /* window's server */
void *channel; /* window's channel */
@@ -152,11 +161,11 @@ struct t_gui_window
WINDOW *win_input; /* input window */
#endif
#ifdef WEE_GTK
GtkWidget *win_title; /* title window */
GtkWidget *win_chat; /* chat window (exemple: channel) */
GtkWidget *win_nick; /* nick window */
GtkWidget *win_status; /* status window */
GtkWidget *win_input; /* input window */
GtkWidget *textview_chat; /* textview widget for chat */
GtkTextBuffer *textbuffer_chat; /* textbuffer widget for chat */
GtkTextTag *texttag_chat; /* texttag widget for chat */
GtkWidget *textview_nicklist; /* textview widget for nicklist */
GtkTextBuffer *textbuffer_nicklist; /* textbuffer widget for nicklist */
#endif
#ifdef WEE_QT
/* TODO: declare Qt window */
@@ -198,12 +207,22 @@ extern t_gui_window *gui_current_window;
/* prototypes */
/* GUI independent functions */
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/); /* TODO: add coordinates and size */
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_optimize_input_buffer_size (t_gui_window *);
extern void gui_delete_previous_word ();
extern void gui_move_previous_word ();
extern void gui_move_next_word ();
extern void gui_buffer_insert_string (char *, int);
/* GUI dependant functions */
extern int gui_assign_color (int *, char *);
extern int gui_get_color_by_name (char *);
extern char *gui_get_color_by_value (int);
extern void gui_calculate_pos_size (t_gui_window *);
extern void gui_draw_window_title (t_gui_window *);
extern void gui_redraw_window_title (t_gui_window *);
extern void gui_draw_window_chat (t_gui_window *);
@@ -215,34 +234,17 @@ extern void gui_redraw_window_status (t_gui_window *);
extern void gui_draw_window_input (t_gui_window *);
extern void gui_redraw_window_input (t_gui_window *);
extern void gui_redraw_window (t_gui_window *);
extern t_gui_window *gui_window_new (void *, void *);
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern void gui_switch_to_window (t_gui_window *);
extern void gui_switch_to_previous_window ();
extern void gui_switch_to_next_window ();
extern void gui_move_page_up ();
extern void gui_move_page_down ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_init_colors ();
extern void gui_init ();
/* TODO: add coordinates and size */
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/);
extern void gui_window_free (t_gui_window *);
extern void gui_end ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
extern void gui_optimize_input_buffer_size (t_gui_window *);
extern void gui_delete_previous_word ();
extern void gui_move_previous_word ();
extern void gui_move_next_word ();
extern void gui_buffer_insert_string (char *, int);
extern void gui_main_loop ();
#endif /* gui.h */
+3 -3
View File
@@ -501,7 +501,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
COLOR_WIN_CHAT_NICK,
"%s\n",
arguments);
if (ptr_channel->window->win_nick)
if (WIN_HAS_NICKLIST(ptr_channel->window))
gui_redraw_window_nick (ptr_channel->window);
}
}
@@ -692,7 +692,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
gui_printf (ptr_channel->window, "\n");
/* redraw nick list if this is current window */
if (ptr_channel->window->win_nick)
if (WIN_HAS_NICKLIST(ptr_channel->window))
gui_redraw_window_nick (ptr_channel->window);
}
}
@@ -978,7 +978,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_DARK, ")\n");
if ((ptr_channel->window == gui_current_window) &&
(ptr_channel->window->win_nick))
(WIN_HAS_NICKLIST(ptr_channel->window)))
gui_redraw_window_nick (ptr_channel->window);
}
}