c.sexchat/src/fe-gtk/fe-gtk.h

218 lines
6.3 KiB
C
Raw Normal View History

/* HexChat
* Copyright (C) 1998-2010 Peter Zelezny.
* Copyright (C) 2009-2013 Berke Viktor.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
2013-04-01 01:02:03 +02:00
#ifndef HEXCHAT_FE_GTK_H
#define HEXCHAT_FE_GTK_H
#ifdef WIN32
#include "../../config-win32.h"
#else
2011-02-24 04:14:30 +01:00
#include "../../config.h"
#endif
2011-02-24 04:14:30 +01:00
2012-07-11 22:41:15 +02:00
#define DISPLAY_NAME "HexChat"
2011-02-24 04:14:30 +01:00
#ifndef WIN32
#include <sys/types.h>
#include <regex.h>
#endif
#if defined(ENABLE_NLS) && !defined(_)
# include <libintl.h>
# define _(x) gettext(x)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#endif
#if !defined(ENABLE_NLS) && defined(_)
# undef _
# define N_(String) (String)
# define _(x) (x)
#endif
#include <gtk/gtk.h>
Redesign the Ban List window. Closes Issues #303, #342, #427 This is a combination of 18 commits. The first commit's message is: Here is the initial banlist branch of RichardHitt/hexchat. Changed files are only src/fe-gtk/{banlist.c,fe-gtk.h}. This version works and contains my first efforts at selective sensitization of radio buttons and control buttons. From this point I intend to undertake a stepwise redesign. Step 1 will be to make the existing banlist code work for multiple simultaneous banlist windows (for different channels, obviously). It will be a hackathon with the only goal of getting it working. Step 2 will be the objectization and alpha-stage tidying-up of all the terrible looking stuff I will have done in Step 1. This is the 2nd commit message: Here's the post-Step-1 commit. It works for multiple banlist windows. Note particularly what I've done to banlist.h. Note that for many functions in banlist.c the argument is now a banlist_info *, rather than a session *. Note in banlist.c the initialization of array modes[] which contains driving information for the checkboxes. Of course those checkboxes aren't yet implemented. Maybe in Step 2 I will change to checkboxes from radio buttons; but definitely I will change to letting modes[] drive processing. This is the 3rd commit message: Converted to checkboxes. Much additional work. Note that the infrastructure for Auto-invite is not yet present in the hexchat tree. I'm nearly done with banlist, I think! This is the 4th commit message: Fleshed out 'invite'. Tagged masks uniformly, e.g. (b) (e) (I). General cleanup, nearly at the point of beta quality. This is the 5th commit message: Added fourth mode type: quiet. Did lots and lots of cleanup. Beta-ready? This is the 6th commit message: Get the banlist timestamps properly sortable. This is the 7th commit message: Redesign the supports_foo() routines. Now they're responsible for setting the flags in ->capable, ->readable, ->writeable. This is the 8th commit message: Deleted a couple of RBH comments. This is the 9th commit message: Now the ESC key will close the banlist window. This is the 10th commit message: Fix the fe-text occurrence of fe_add_ban_list(). This is the 11th commit message: Fixed also fe_ban_list_end() and removed fe_is_banwindow(). This is the 12th commit message: Use old-style initialization for array of structures modes[] This is the 13th commit message: Oops, incomplete regression of modes[] initialization. This fixes. This is the 14th commit message: Fixed strptime buy implementing a special version here. Fixed column width concerns by setting resizable and autosize. This is the 15th commit message: Get rid of testing line. This is the 16th commit message: Changed to gtkutil_destroy_on_esc () This is the 17th commit message: Remove no-longer-used functnion This is the 18th commit message: Minor cleanups to banlist.c, banlist.h Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. Author: RichardHitt <rbh00@netcom.com> Committer: Richard Hitt <rbh00@f17.rbh00.pacbell.net> Not currently on any branch. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: src/common/fe.h modified: src/common/hexchat.h modified: src/common/inbound.c modified: src/common/modes.c modified: src/common/proto-irc.c modified: src/common/server.c modified: src/fe-gtk/banlist.c modified: src/fe-gtk/banlist.h modified: src/fe-gtk/fe-gtk.c modified: src/fe-gtk/fe-gtk.h modified: src/fe-gtk/maingui.c modified: src/fe-text/fe-text.c
2013-03-05 09:13:51 +01:00
#include "banlist.h"
2011-02-24 04:14:30 +01:00
#undef gtk_signal_connect
#define gtk_signal_connect g_signal_connect
#define flag_t flag_wid[0]
#define flag_n flag_wid[1]
#define flag_s flag_wid[2]
#define flag_i flag_wid[3]
#define flag_p flag_wid[4]
#define flag_m flag_wid[5]
#define flag_l flag_wid[6]
#define flag_k flag_wid[7]
#define flag_b flag_wid[8]
#define NUM_FLAG_WIDS 9
struct server_gui
{
GtkWidget *rawlog_window;
GtkWidget *rawlog_textlist;
/* join dialog */
GtkWidget *joind_win;
GtkWidget *joind_entry;
GtkWidget *joind_radio1;
GtkWidget *joind_radio2;
GtkWidget *joind_check;
/* chanlist variables */
GtkWidget *chanlist_wild; /* GtkEntry */
GtkWidget *chanlist_window;
GtkWidget *chanlist_list;
GtkWidget *chanlist_label;
GtkWidget *chanlist_min_spin; /* minusers GtkSpinButton */
GtkWidget *chanlist_refresh; /* buttons */
GtkWidget *chanlist_join;
GtkWidget *chanlist_savelist;
GtkWidget *chanlist_search;
GSList *chanlist_data_stored_rows; /* stored list so it can be resorted */
GSList *chanlist_pending_rows;
gint chanlist_tag;
gint chanlist_flash_tag;
gboolean chanlist_match_wants_channel; /* match in channel name */
gboolean chanlist_match_wants_topic; /* match in topic */
#ifndef WIN32
regex_t chanlist_match_regex; /* compiled regular expression here */
unsigned int have_regex;
#endif
guint chanlist_users_found_count; /* users total for all channels */
guint chanlist_users_shown_count; /* users total for displayed channels */
guint chanlist_channels_found_count; /* channel total for /LIST operation */
guint chanlist_channels_shown_count; /* total number of displayed
channels */
int chanlist_maxusers;
int chanlist_minusers;
int chanlist_minusers_downloaded; /* used by LIST IRC command */
int chanlist_search_type; /* 0=simple 1=pattern/wildcard 2=regexp */
gboolean chanlist_caption_is_stale;
};
/* this struct is persistant even when delinking/relinking */
typedef struct restore_gui
{
Redesign the Ban List window. Closes Issues #303, #342, #427 This is a combination of 18 commits. The first commit's message is: Here is the initial banlist branch of RichardHitt/hexchat. Changed files are only src/fe-gtk/{banlist.c,fe-gtk.h}. This version works and contains my first efforts at selective sensitization of radio buttons and control buttons. From this point I intend to undertake a stepwise redesign. Step 1 will be to make the existing banlist code work for multiple simultaneous banlist windows (for different channels, obviously). It will be a hackathon with the only goal of getting it working. Step 2 will be the objectization and alpha-stage tidying-up of all the terrible looking stuff I will have done in Step 1. This is the 2nd commit message: Here's the post-Step-1 commit. It works for multiple banlist windows. Note particularly what I've done to banlist.h. Note that for many functions in banlist.c the argument is now a banlist_info *, rather than a session *. Note in banlist.c the initialization of array modes[] which contains driving information for the checkboxes. Of course those checkboxes aren't yet implemented. Maybe in Step 2 I will change to checkboxes from radio buttons; but definitely I will change to letting modes[] drive processing. This is the 3rd commit message: Converted to checkboxes. Much additional work. Note that the infrastructure for Auto-invite is not yet present in the hexchat tree. I'm nearly done with banlist, I think! This is the 4th commit message: Fleshed out 'invite'. Tagged masks uniformly, e.g. (b) (e) (I). General cleanup, nearly at the point of beta quality. This is the 5th commit message: Added fourth mode type: quiet. Did lots and lots of cleanup. Beta-ready? This is the 6th commit message: Get the banlist timestamps properly sortable. This is the 7th commit message: Redesign the supports_foo() routines. Now they're responsible for setting the flags in ->capable, ->readable, ->writeable. This is the 8th commit message: Deleted a couple of RBH comments. This is the 9th commit message: Now the ESC key will close the banlist window. This is the 10th commit message: Fix the fe-text occurrence of fe_add_ban_list(). This is the 11th commit message: Fixed also fe_ban_list_end() and removed fe_is_banwindow(). This is the 12th commit message: Use old-style initialization for array of structures modes[] This is the 13th commit message: Oops, incomplete regression of modes[] initialization. This fixes. This is the 14th commit message: Fixed strptime buy implementing a special version here. Fixed column width concerns by setting resizable and autosize. This is the 15th commit message: Get rid of testing line. This is the 16th commit message: Changed to gtkutil_destroy_on_esc () This is the 17th commit message: Remove no-longer-used functnion This is the 18th commit message: Minor cleanups to banlist.c, banlist.h Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. Author: RichardHitt <rbh00@netcom.com> Committer: Richard Hitt <rbh00@f17.rbh00.pacbell.net> Not currently on any branch. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: src/common/fe.h modified: src/common/hexchat.h modified: src/common/inbound.c modified: src/common/modes.c modified: src/common/proto-irc.c modified: src/common/server.c modified: src/fe-gtk/banlist.c modified: src/fe-gtk/banlist.h modified: src/fe-gtk/fe-gtk.c modified: src/fe-gtk/fe-gtk.h modified: src/fe-gtk/maingui.c modified: src/fe-text/fe-text.c
2013-03-05 09:13:51 +01:00
banlist_info *banlist;
2011-02-24 04:14:30 +01:00
void *tab; /* (chan *) */
/* information stored when this tab isn't front-most */
void *user_model; /* for filling the GtkTreeView */
void *buffer; /* xtext_Buffer */
char *input_text; /* input text buffer (while not-front tab) */
char *topic_text; /* topic GtkEntry buffer */
char *key_text;
char *limit_text;
gfloat old_ul_value; /* old userlist value (for adj) */
gfloat lag_value; /* lag-o-meter */
char *lag_text; /* lag-o-meter text */
char *lag_tip; /* lag-o-meter tooltip */
gfloat queue_value; /* outbound queue meter */
char *queue_text; /* outbound queue text */
char *queue_tip; /* outbound queue tooltip */
short flag_wid_state[NUM_FLAG_WIDS];
unsigned int c_graph:1; /* connecting graph, is there one? */
} restore_gui;
typedef struct session_gui
{
GtkWidget
*xtext,
*vscrollbar,
*window, /* toplevel */
*topic_entry,
*note_book,
*main_table,
*user_tree, /* GtkTreeView */
*user_box, /* userlist box */
*button_box_parent,
*button_box, /* userlist buttons' box */
*dialogbutton_box,
*topicbutton_box,
*meter_box, /* all the meters inside this */
*lagometer,
*laginfo,
*throttlemeter,
*throttleinfo,
*topic_bar,
*hpane_left,
*hpane_right,
*vpane_left,
*vpane_right,
*menu,
*bar, /* connecting progress bar */
*nick_box, /* contains label to the left of input_box */
*nick_label,
*op_xpm, /* icon to the left of nickname */
*namelistinfo, /* label above userlist */
*input_box,
*flag_wid[NUM_FLAG_WIDS], /* channelmode buttons */
*limit_entry, /* +l */
*key_entry; /* +k */
2013-07-25 02:47:01 +02:00
GtkWidget *shbox, *shentry; /* search bar hbox */
gulong search_changed_signal; /* hook for search change event so blanking the box doesn't suck */
2011-02-24 04:14:30 +01:00
#define MENU_ID_NUM 12
GtkWidget *menu_item[MENU_ID_NUM+1]; /* some items we may change state of */
void *chanview; /* chanview.h */
int bartag; /*connecting progressbar timeout */
int pane_left_size; /*last position of the pane*/
int pane_right_size;
guint16 is_tab; /* is tab or toplevel? */
guint16 ul_hidden; /* userlist hidden? */
} session_gui;
extern GdkPixmap *channelwin_pix;
extern GdkPixmap *dialogwin_pix;
#ifdef USE_GTKSPELL
char *SPELL_ENTRY_GET_TEXT (GtkWidget *entry);
#define SPELL_ENTRY_SET_TEXT(e,txt) gtk_text_buffer_set_text (gtk_text_view_get_buffer(GTK_TEXT_VIEW(e)),txt,-1);
#define SPELL_ENTRY_SET_EDITABLE(e,v) gtk_text_view_set_editable(GTK_TEXT_VIEW(e), v)
int SPELL_ENTRY_GET_POS (GtkWidget *entry);
void SPELL_ENTRY_SET_POS (GtkWidget *entry, int pos);
void SPELL_ENTRY_INSERT (GtkWidget *entry, const char *text, int len, int *pos);
#else
#define SPELL_ENTRY_GET_TEXT(e) (GTK_ENTRY(e)->text)
#define SPELL_ENTRY_SET_TEXT(e,txt) gtk_entry_set_text(GTK_ENTRY(e),txt)
#define SPELL_ENTRY_SET_EDITABLE(e,v) gtk_editable_set_editable(GTK_EDITABLE(e),v)
#define SPELL_ENTRY_GET_POS(e) gtk_editable_get_position(GTK_EDITABLE(e))
#define SPELL_ENTRY_SET_POS(e,p) gtk_editable_set_position(GTK_EDITABLE(e),p);
#define SPELL_ENTRY_INSERT(e,t,l,p) gtk_editable_insert_text(GTK_EDITABLE(e),t,l,p)
#endif
2013-04-01 01:02:03 +02:00
#endif