mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-06-20 13:19:23 +00:00
Compare commits
2 Commits
master
...
mode-butto
| Author | SHA1 | Date | |
|---|---|---|---|
| dfd4554a11 | |||
| 1b98297881 |
@@ -428,6 +428,7 @@ const struct prefs vars[] =
|
|||||||
{"gui_lagometer", P_OFFINT (hex_gui_lagometer), TYPE_INT},
|
{"gui_lagometer", P_OFFINT (hex_gui_lagometer), TYPE_INT},
|
||||||
{"gui_lang", P_OFFINT (hex_gui_lang), TYPE_INT},
|
{"gui_lang", P_OFFINT (hex_gui_lang), TYPE_INT},
|
||||||
{"gui_mode_buttons", P_OFFINT (hex_gui_mode_buttons), TYPE_BOOL},
|
{"gui_mode_buttons", P_OFFINT (hex_gui_mode_buttons), TYPE_BOOL},
|
||||||
|
{"gui_mode_buttons_inline", P_OFFINT (hex_gui_mode_buttons_inline), TYPE_BOOL},
|
||||||
{"gui_pane_divider_position", P_OFFINT (hex_gui_pane_divider_position), TYPE_INT},
|
{"gui_pane_divider_position", P_OFFINT (hex_gui_pane_divider_position), TYPE_INT},
|
||||||
{"gui_pane_left_size", P_OFFINT (hex_gui_pane_left_size), TYPE_INT},
|
{"gui_pane_left_size", P_OFFINT (hex_gui_pane_left_size), TYPE_INT},
|
||||||
{"gui_pane_right_size", P_OFFINT (hex_gui_pane_right_size), TYPE_INT},
|
{"gui_pane_right_size", P_OFFINT (hex_gui_pane_right_size), TYPE_INT},
|
||||||
@@ -458,6 +459,7 @@ const struct prefs vars[] =
|
|||||||
{"gui_tab_utils", P_OFFINT (hex_gui_tab_utils), TYPE_BOOL},
|
{"gui_tab_utils", P_OFFINT (hex_gui_tab_utils), TYPE_BOOL},
|
||||||
{"gui_throttlemeter", P_OFFINT (hex_gui_throttlemeter), TYPE_INT},
|
{"gui_throttlemeter", P_OFFINT (hex_gui_throttlemeter), TYPE_INT},
|
||||||
{"gui_topicbar", P_OFFINT (hex_gui_topicbar), TYPE_BOOL},
|
{"gui_topicbar", P_OFFINT (hex_gui_topicbar), TYPE_BOOL},
|
||||||
|
{"gui_topicbar_multiline", P_OFFINT (hex_gui_topicbar_multiline), TYPE_BOOL},
|
||||||
{"gui_transparency", P_OFFINT (hex_gui_transparency), TYPE_INT},
|
{"gui_transparency", P_OFFINT (hex_gui_transparency), TYPE_INT},
|
||||||
{"gui_tray", P_OFFINT (hex_gui_tray), TYPE_BOOL},
|
{"gui_tray", P_OFFINT (hex_gui_tray), TYPE_BOOL},
|
||||||
{"gui_tray_away", P_OFFINT (hex_gui_tray_away), TYPE_BOOL},
|
{"gui_tray_away", P_OFFINT (hex_gui_tray_away), TYPE_BOOL},
|
||||||
@@ -791,6 +793,7 @@ load_default_config(void)
|
|||||||
prefs.hex_gui_tab_scrollchans = 1;
|
prefs.hex_gui_tab_scrollchans = 1;
|
||||||
prefs.hex_gui_mouse_scroll_speed = 10;
|
prefs.hex_gui_mouse_scroll_speed = 10;
|
||||||
prefs.hex_gui_topicbar = 1;
|
prefs.hex_gui_topicbar = 1;
|
||||||
|
prefs.hex_gui_topicbar_multiline = 1;
|
||||||
prefs.hex_gui_transparency = 255;
|
prefs.hex_gui_transparency = 255;
|
||||||
prefs.hex_gui_tray = 1;
|
prefs.hex_gui_tray = 1;
|
||||||
prefs.hex_gui_tray_blink = 1;
|
prefs.hex_gui_tray_blink = 1;
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ struct zoitechatprefs
|
|||||||
unsigned int hex_gui_input_style;
|
unsigned int hex_gui_input_style;
|
||||||
unsigned int hex_gui_join_dialog;
|
unsigned int hex_gui_join_dialog;
|
||||||
unsigned int hex_gui_mode_buttons;
|
unsigned int hex_gui_mode_buttons;
|
||||||
|
unsigned int hex_gui_mode_buttons_inline;
|
||||||
unsigned int hex_gui_quit_dialog;
|
unsigned int hex_gui_quit_dialog;
|
||||||
/* unsigned int hex_gui_single; */
|
/* unsigned int hex_gui_single; */
|
||||||
unsigned int hex_gui_slist_fav;
|
unsigned int hex_gui_slist_fav;
|
||||||
@@ -148,6 +149,7 @@ struct zoitechatprefs
|
|||||||
unsigned int hex_gui_tab_sort;
|
unsigned int hex_gui_tab_sort;
|
||||||
unsigned int hex_gui_tab_utils;
|
unsigned int hex_gui_tab_utils;
|
||||||
unsigned int hex_gui_topicbar;
|
unsigned int hex_gui_topicbar;
|
||||||
|
unsigned int hex_gui_topicbar_multiline;
|
||||||
unsigned int hex_gui_tray;
|
unsigned int hex_gui_tray;
|
||||||
unsigned int hex_gui_tray_away;
|
unsigned int hex_gui_tray_away;
|
||||||
unsigned int hex_gui_tray_blink;
|
unsigned int hex_gui_tray_blink;
|
||||||
|
|||||||
@@ -812,18 +812,19 @@ fe_set_topic (session *sess, char *topic, char *stripped_topic)
|
|||||||
{
|
{
|
||||||
if (!sess->gui->is_tab || sess == current_tab)
|
if (!sess->gui->is_tab || sess == current_tab)
|
||||||
{
|
{
|
||||||
|
GtkTextBuffer *topic_buffer;
|
||||||
|
GtkTextIter start;
|
||||||
|
|
||||||
|
topic_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry));
|
||||||
if (prefs.hex_text_stripcolor_topic)
|
if (prefs.hex_text_stripcolor_topic)
|
||||||
{
|
gtk_text_buffer_set_text (topic_buffer, stripped_topic, -1);
|
||||||
gtk_text_buffer_set_text (
|
|
||||||
gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry)),
|
|
||||||
stripped_topic, -1);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
gtk_text_buffer_set_text (topic_buffer, topic, -1);
|
||||||
gtk_text_buffer_set_text (
|
|
||||||
gtk_text_view_get_buffer (GTK_TEXT_VIEW (sess->gui->topic_entry)),
|
gtk_text_buffer_get_start_iter (topic_buffer, &start);
|
||||||
topic, -1);
|
gtk_text_buffer_place_cursor (topic_buffer, &start);
|
||||||
}
|
gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (sess->gui->topic_entry),
|
||||||
|
&start, 0.0, FALSE, 0.0, 0.0);
|
||||||
mg_set_topic_tip (sess);
|
mg_set_topic_tip (sess);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -3042,7 +3042,7 @@ mg_create_chanmodebuttons (session_gui *gui, GtkWidget *box)
|
|||||||
gui->key_entry = gtk_entry_new ();
|
gui->key_entry = gtk_entry_new ();
|
||||||
gtk_widget_set_name (gui->key_entry, "zoitechat-inputbox");
|
gtk_widget_set_name (gui->key_entry, "zoitechat-inputbox");
|
||||||
gtk_entry_set_max_length (GTK_ENTRY (gui->key_entry), 23);
|
gtk_entry_set_max_length (GTK_ENTRY (gui->key_entry), 23);
|
||||||
gtk_widget_set_size_request (gui->key_entry, 115, 11);
|
gtk_widget_set_size_request (gui->key_entry, 58, 11);
|
||||||
gtk_box_pack_start (GTK_BOX (box), gui->key_entry, 0, 0, 0);
|
gtk_box_pack_start (GTK_BOX (box), gui->key_entry, 0, 0, 0);
|
||||||
mg_apply_emoji_fallback_widget (gui->key_entry);
|
mg_apply_emoji_fallback_widget (gui->key_entry);
|
||||||
mg_apply_compact_mode_css (gui->key_entry);
|
mg_apply_compact_mode_css (gui->key_entry);
|
||||||
@@ -3059,7 +3059,8 @@ mg_create_chanmodebuttons (session_gui *gui, GtkWidget *box)
|
|||||||
gui->limit_entry = gtk_entry_new ();
|
gui->limit_entry = gtk_entry_new ();
|
||||||
gtk_widget_set_name (gui->limit_entry, "zoitechat-inputbox");
|
gtk_widget_set_name (gui->limit_entry, "zoitechat-inputbox");
|
||||||
gtk_entry_set_max_length (GTK_ENTRY (gui->limit_entry), 10);
|
gtk_entry_set_max_length (GTK_ENTRY (gui->limit_entry), 10);
|
||||||
gtk_widget_set_size_request (gui->limit_entry, 30, 11);
|
gtk_entry_set_width_chars (GTK_ENTRY (gui->limit_entry), 5);
|
||||||
|
gtk_widget_set_size_request (gui->limit_entry, 45, 11);
|
||||||
gtk_box_pack_start (GTK_BOX (box), gui->limit_entry, 0, 0, 0);
|
gtk_box_pack_start (GTK_BOX (box), gui->limit_entry, 0, 0, 0);
|
||||||
mg_apply_emoji_fallback_widget (gui->limit_entry);
|
mg_apply_emoji_fallback_widget (gui->limit_entry);
|
||||||
mg_apply_compact_mode_css (gui->limit_entry);
|
mg_apply_compact_mode_css (gui->limit_entry);
|
||||||
@@ -3193,8 +3194,11 @@ mg_topicbar_update_height (GtkWidget *topic)
|
|||||||
width -= margin_left + margin_right;
|
width -= margin_left + margin_right;
|
||||||
if (width < 1)
|
if (width < 1)
|
||||||
width = 1;
|
width = 1;
|
||||||
pango_layout_set_width (layout, width * PANGO_SCALE);
|
if (prefs.hex_gui_topicbar_multiline && !prefs.hex_gui_mode_buttons_inline)
|
||||||
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
|
{
|
||||||
|
pango_layout_set_width (layout, width * PANGO_SCALE);
|
||||||
|
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
|
||||||
|
}
|
||||||
|
|
||||||
context = gtk_widget_get_pango_context (topic);
|
context = gtk_widget_get_pango_context (topic);
|
||||||
metrics = pango_context_get_metrics (context,
|
metrics = pango_context_get_metrics (context,
|
||||||
@@ -3206,7 +3210,8 @@ mg_topicbar_update_height (GtkWidget *topic)
|
|||||||
if (line_height <= 0)
|
if (line_height <= 0)
|
||||||
line_height = 16;
|
line_height = 16;
|
||||||
|
|
||||||
line_count = pango_layout_get_line_count (layout);
|
line_count = prefs.hex_gui_topicbar_multiline && !prefs.hex_gui_mode_buttons_inline ?
|
||||||
|
pango_layout_get_line_count (layout) : 1;
|
||||||
if (line_count <= 0)
|
if (line_count <= 0)
|
||||||
line_count = 1;
|
line_count = 1;
|
||||||
|
|
||||||
@@ -3328,7 +3333,7 @@ mg_apply_session_font_prefs (session_gui *gui)
|
|||||||
static void
|
static void
|
||||||
mg_create_topicbar (session *sess, GtkWidget *box)
|
mg_create_topicbar (session *sess, GtkWidget *box)
|
||||||
{
|
{
|
||||||
GtkWidget *vbox, *hbox, *mode_hbox, *topic, *bbox;
|
GtkWidget *vbox, *hbox, *mode_hbox, *topic, *topic_scroll, *bbox;
|
||||||
session_gui *gui = sess->gui;
|
session_gui *gui = sess->gui;
|
||||||
|
|
||||||
gui->topic_bar = vbox = mg_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
gui->topic_bar = vbox = mg_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 0);
|
||||||
@@ -3342,7 +3347,9 @@ mg_create_topicbar (session *sess, GtkWidget *box)
|
|||||||
|
|
||||||
gui->topic_entry = topic = gtk_text_view_new ();
|
gui->topic_entry = topic = gtk_text_view_new ();
|
||||||
gtk_widget_set_name (topic, "zoitechat-topicbox");
|
gtk_widget_set_name (topic, "zoitechat-topicbox");
|
||||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (topic), GTK_WRAP_WORD_CHAR);
|
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (topic),
|
||||||
|
prefs.hex_gui_topicbar_multiline && !prefs.hex_gui_mode_buttons_inline ?
|
||||||
|
GTK_WRAP_WORD_CHAR : GTK_WRAP_NONE);
|
||||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (topic), 4);
|
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (topic), 4);
|
||||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (topic), 4);
|
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (topic), 4);
|
||||||
gtk_text_view_set_top_margin (GTK_TEXT_VIEW (topic), 4);
|
gtk_text_view_set_top_margin (GTK_TEXT_VIEW (topic), 4);
|
||||||
@@ -3355,8 +3362,17 @@ mg_create_topicbar (session *sess, GtkWidget *box)
|
|||||||
G_CALLBACK (mg_topicbar_buffer_changed_cb), topic);
|
G_CALLBACK (mg_topicbar_buffer_changed_cb), topic);
|
||||||
g_signal_connect (G_OBJECT (topic), "size-allocate",
|
g_signal_connect (G_OBJECT (topic), "size-allocate",
|
||||||
G_CALLBACK (mg_topicbar_size_allocate_cb), NULL);
|
G_CALLBACK (mg_topicbar_size_allocate_cb), NULL);
|
||||||
|
topic_scroll = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_widget_set_hexpand (topic_scroll, TRUE);
|
||||||
|
gtk_widget_set_size_request (topic_scroll, 1, -1);
|
||||||
|
gtk_widget_set_size_request (topic, 1, -1);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (topic_scroll),
|
||||||
|
GTK_POLICY_EXTERNAL, GTK_POLICY_NEVER);
|
||||||
|
gtk_scrolled_window_set_propagate_natural_width (GTK_SCROLLED_WINDOW (topic_scroll), FALSE);
|
||||||
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (topic_scroll), GTK_SHADOW_NONE);
|
||||||
|
gtk_container_add (GTK_CONTAINER (topic_scroll), topic);
|
||||||
mg_topicbar_update_height (topic);
|
mg_topicbar_update_height (topic);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), topic, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), topic_scroll, TRUE, TRUE, 0);
|
||||||
gtk_widget_add_events (topic, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
gtk_widget_add_events (topic, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||||
GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
||||||
g_signal_connect (G_OBJECT (topic), "key-press-event",
|
g_signal_connect (G_OBJECT (topic), "key-press-event",
|
||||||
@@ -3373,9 +3389,13 @@ mg_create_topicbar (session *sess, GtkWidget *box)
|
|||||||
mg_create_dialogbuttons (bbox);
|
mg_create_dialogbuttons (bbox);
|
||||||
|
|
||||||
mode_hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
mode_hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), mode_hbox, 0, 0, 0);
|
if (prefs.hex_gui_mode_buttons_inline)
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox), mode_hbox, 0, 0, 0);
|
||||||
|
else
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), mode_hbox, 0, 0, 0);
|
||||||
|
|
||||||
gui->topicbutton_box = bbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
gui->topicbutton_box = bbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||||
|
gtk_widget_set_valign (bbox, GTK_ALIGN_CENTER);
|
||||||
gtk_box_pack_end (GTK_BOX (mode_hbox), bbox, 0, 0, 0);
|
gtk_box_pack_end (GTK_BOX (mode_hbox), bbox, 0, 0, 0);
|
||||||
mg_create_chanmodebuttons (gui, bbox);
|
mg_create_chanmodebuttons (gui, bbox);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ static gboolean color_change;
|
|||||||
static struct zoitechatprefs setup_prefs;
|
static struct zoitechatprefs setup_prefs;
|
||||||
static GtkWidget *cancel_button;
|
static GtkWidget *cancel_button;
|
||||||
static GtkWidget *font_dialog = NULL;
|
static GtkWidget *font_dialog = NULL;
|
||||||
|
static GtkWidget *setup_topicbar_multiline_toggle = NULL;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -185,6 +186,10 @@ static const setting appearance_settings[] =
|
|||||||
{ST_TOGGLR, N_("Show number of users"), P_OFFINTNL(hex_gui_win_ucount),0,0,0},
|
{ST_TOGGLR, N_("Show number of users"), P_OFFINTNL(hex_gui_win_ucount),0,0,0},
|
||||||
{ST_TOGGLE, N_("Show nickname"), P_OFFINTNL(hex_gui_win_nick),0,0,0},
|
{ST_TOGGLE, N_("Show nickname"), P_OFFINTNL(hex_gui_win_nick),0,0,0},
|
||||||
|
|
||||||
|
{ST_HEADER, N_("Topic Bar"),0,0,0},
|
||||||
|
{ST_TOGGLE, N_("Place mode buttons beside the topic"), P_OFFINTNL(hex_gui_mode_buttons_inline), 0, 0, 0},
|
||||||
|
{ST_TOGGLE, N_("Allow multi-line topics"), P_OFFINTNL(hex_gui_topicbar_multiline), 0, 0, 0},
|
||||||
|
|
||||||
{ST_END, 0, 0, 0, 0, 0}
|
{ST_END, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -833,6 +838,16 @@ setup_toggle_sensitive_cb (GtkToggleButton *but, GtkWidget *wid)
|
|||||||
gtk_widget_set_sensitive (wid, gtk_toggle_button_get_active (but));
|
gtk_widget_set_sensitive (wid, gtk_toggle_button_get_active (but));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_topicbar_inline_toggled_cb (GtkToggleButton *but, gpointer userdata)
|
||||||
|
{
|
||||||
|
(void) userdata;
|
||||||
|
|
||||||
|
if (setup_topicbar_multiline_toggle)
|
||||||
|
gtk_widget_set_sensitive (setup_topicbar_multiline_toggle,
|
||||||
|
!gtk_toggle_button_get_active (but));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_create_toggleR (GtkWidget *tab, int row, const setting *set)
|
setup_create_toggleR (GtkWidget *tab, int row, const setting *set)
|
||||||
{
|
{
|
||||||
@@ -859,6 +874,14 @@ setup_create_toggleL (GtkWidget *tab, int row, const setting *set)
|
|||||||
setup_get_int (&setup_prefs, set));
|
setup_get_int (&setup_prefs, set));
|
||||||
g_signal_connect (G_OBJECT (wid), "toggled",
|
g_signal_connect (G_OBJECT (wid), "toggled",
|
||||||
G_CALLBACK (setup_toggle_cb), (gpointer)set);
|
G_CALLBACK (setup_toggle_cb), (gpointer)set);
|
||||||
|
if (set->offset == STRUCT_OFFSET_INT (struct zoitechatprefs, hex_gui_mode_buttons_inline))
|
||||||
|
g_signal_connect (G_OBJECT (wid), "toggled",
|
||||||
|
G_CALLBACK (setup_topicbar_inline_toggled_cb), NULL);
|
||||||
|
if (set->offset == STRUCT_OFFSET_INT (struct zoitechatprefs, hex_gui_topicbar_multiline))
|
||||||
|
{
|
||||||
|
setup_topicbar_multiline_toggle = wid;
|
||||||
|
gtk_widget_set_sensitive (wid, !setup_prefs.hex_gui_mode_buttons_inline);
|
||||||
|
}
|
||||||
if (set->tooltip)
|
if (set->tooltip)
|
||||||
gtk_widget_set_tooltip_text (wid, _(set->tooltip));
|
gtk_widget_set_tooltip_text (wid, _(set->tooltip));
|
||||||
setup_table_attach (tab, wid, 2, row==6 ? 6 : 4, row, row + 1, FALSE, FALSE,
|
setup_table_attach (tab, wid, 2, row==6 ? 6 : 4, row, row + 1, FALSE, FALSE,
|
||||||
@@ -2286,6 +2309,8 @@ setup_apply (struct zoitechatprefs *pr)
|
|||||||
noapply = TRUE;
|
noapply = TRUE;
|
||||||
if (DIFF (hex_gui_lagometer))
|
if (DIFF (hex_gui_lagometer))
|
||||||
noapply = TRUE;
|
noapply = TRUE;
|
||||||
|
if (DIFF (hex_gui_mode_buttons_inline))
|
||||||
|
noapply = TRUE;
|
||||||
if (DIFF (hex_gui_tab_icons))
|
if (DIFF (hex_gui_tab_icons))
|
||||||
noapply = TRUE;
|
noapply = TRUE;
|
||||||
if (DIFF (hex_gui_tab_closebuttons))
|
if (DIFF (hex_gui_tab_closebuttons))
|
||||||
@@ -2300,6 +2325,8 @@ setup_apply (struct zoitechatprefs *pr)
|
|||||||
noapply = TRUE;
|
noapply = TRUE;
|
||||||
if (DIFF (hex_gui_throttlemeter))
|
if (DIFF (hex_gui_throttlemeter))
|
||||||
noapply = TRUE;
|
noapply = TRUE;
|
||||||
|
if (DIFF (hex_gui_topicbar_multiline))
|
||||||
|
noapply = TRUE;
|
||||||
if (DIFF (hex_gui_ulist_count))
|
if (DIFF (hex_gui_ulist_count))
|
||||||
noapply = TRUE;
|
noapply = TRUE;
|
||||||
if (DIFF (hex_gui_ulist_icons))
|
if (DIFF (hex_gui_ulist_icons))
|
||||||
|
|||||||
Reference in New Issue
Block a user