Notes on Bugid 3153835

Functionality -- Overview

This bugid adds three set values to xchat: They are booleans, defaulting to 1, 0, and 0. The defaults give the traditional xchat behavior.

Functional Details

text_auto_copy_text influences how text selected from a text buffer is copied to the clipboards.
text_auto_copy_stamp causes the timestamp always to be selected with lines of text.
text_auto_copy_color causes color attributes always to be copied with selected lines of text.

Details of text_auto_copy_text:

Two clipboards exist, the so-called PRIMARY and CLIPBOARD clipboards. Xchat traditionally has copied selected text to both clipboards upon selection. Other programs copy only to the PRIMARY clipboard on selection and further to the CLIPBOARD clipboard on explicit instruction (Clicking a "Copy" dropdown menu, for instance, or using a keyboard shortcut).

When text_auto_copy_text is set to 0, xchat changes to this latter behavior. On selection, xchat copies the selected text only to the PRIMARY clipboard. The user may hit Control-Shift-C to copy text to the CLIPBOARD clipboard. Also, the Windows menu, and the Windows context submenu, adds an item, "Copy Selection", that is active when a buffer has a selection, and the user may click this item.

We chose Control-Shift-C as the keyboard shortcut for text-buffer selections because Control-C, without the Shift key, is already used for copying input-line selections.

Details of text_auto_copy_stamp:

When selecting text, xchat has examined the SHIFT key to decide whether to add timestamp to each selected line. With text_auto_copy_stamp set to 1, xchat always adds timestamp to a selected line, and does not check the SHIFT key.

Details of text_auto_copy_color:

When selecting text, xchat has examined the CONTROL key to decide whether to include color and other emphasis marks with each selected line. With text_auto_copy_color, it does this always and ignores the CONTROL key.

Patch Overview

Here sitteth the patch overview.

The bulk of the changes are in xtext.c's selection code, to test the set values and operate accordingly. The three new set value names are added to the preferences and text_auto_copy_text is defaulted to 1. The values correspond to global ints autocopy_text, autocopy_stamp, and autocopy_color. The Settings -> Preferences menu adds a section "Auto-Copy Behavior" with checkboxes for these items.

A guint32 is added to struct xtext_buffer, named clip_own_time. Functions are added to xtext.c:

to allow dynamic showing and hiding and sensitization of "Copy Selection" in the Windows menus. Also for this reason the MENU_ID items are moved to their own header file menu_id.h and MENU_ID_COPY_SELECTION is added to them. Be sure to do "svn add src/fe-gtk/menu_id.h" for this file!

Patch Details

Here sitteth the patch details.
Here is the patch's md5sum:
14ecd1da42d086d19e5b78341a3e53c7  xchat-autocopy-v4.patch
Here is the patch's diffstat:
 common/cfgfiles.c |    4 ++
 common/xchat.h    |    3 +
 fe-gtk/fe-gtk.h   |    2 -
 fe-gtk/maingui.c  |    7 +++
 fe-gtk/menu.c     |   28 +++++++++++++--
 fe-gtk/menu.h     |   17 ---------
 fe-gtk/menu_id.h  |   18 ++++++++++
 fe-gtk/setup.c    |   13 +++++++
 fe-gtk/xtext.c    |   97 ++++++++++++++++++++++++++++++++++++++++++++++++------
 fe-gtk/xtext.h    |    4 ++
 10 files changed, 163 insertions(+), 30 deletions(-)
Here are the patches, hunk-by-hunk: