+2007-02-28 [wwp] 2.8.0cvs7
+
+ * src/mainwindow.c
+ * src/matcher_parser_parse.y
+ * src/prefs_common.c
+ * src/prefs_msg_colors.c
+ * src/procmsg.h
+ * src/gtk/colorlabel.c
+ * src/gtk/colorlabel.h
+ Add more customizable color labels. Cleaned up a bit
+ the color label API to avoid duplicate defines of
+ the max number of colors.
+
2007-02-27 [colin] 2.8.0cvs6
* src/mainwindow.c
( cvs diff -u -r 1.149.2.65 -r 1.149.2.66 src/inc.c; ) > 2.8.0cvs4.patchset
( cvs diff -u -r 1.5.2.53 -r 1.5.2.54 src/gtk/gtkutils.c; ) > 2.8.0cvs5.patchset
( cvs diff -u -r 1.274.2.173 -r 1.274.2.174 src/mainwindow.c; cvs diff -u -r 1.36.2.98 -r 1.36.2.99 src/common/utils.c; cvs diff -u -r 1.20.2.44 -r 1.20.2.45 src/common/utils.h; ) > 2.8.0cvs6.patchset
+( cvs diff -u -r 1.274.2.174 -r 1.274.2.175 src/mainwindow.c; cvs diff -u -r 1.25.2.24 -r 1.25.2.25 src/matcher_parser_parse.y; cvs diff -u -r 1.204.2.121 -r 1.204.2.122 src/prefs_common.c; cvs diff -u -r 1.1.2.32 -r 1.1.2.33 src/prefs_msg_colors.c; cvs diff -u -r 1.60.2.42 -r 1.60.2.43 src/procmsg.h; cvs diff -u -r 1.2.2.16 -r 1.2.2.17 src/gtk/colorlabel.c; cvs diff -u -r 1.1.4.6 -r 1.1.4.7 src/gtk/colorlabel.h; ) > 2.8.0cvs7.patchset
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=6
+EXTRA_VERSION=7
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
N_("Sky blue"),
N_("Blue"),
N_("Green"),
- N_("Brown")
+ N_("Brown"),
+ N_("Grey"),
+ N_("Light brown"),
+ N_("Dark red"),
+ N_("Dark pink"),
+ N_("Steel blue"),
+ N_("Gold"),
+ N_("Bright green"),
+ N_("Magenta")
};
static GdkColor default_colors[COLORLABELS] = {
{ 0, 0xffff, (0x99 << 8), 0x0 },
- { 0, 0xffff, 0, 0 },
+ { 0, 0xffff, 0x0, 0x0 },
{ 0, 0xffff, (0x66 << 8), 0xffff },
{ 0, 0x0, (0xcc << 8), 0xffff },
{ 0, 0x0, 0x0, 0xffff },
{ 0, 0x0, (0x99 << 8), 0x0 },
- { 0, 0x66 << 8, 0x33 << 8, 0x33 << 8 }
+ { 0, (0x66 << 8), (0x33 << 8), (0x33 << 8) },
+ { 0, (0xaa << 8), (0xaa << 8), (0xaa << 8) },
+ { 0, (0xc0 << 8), (0x72 << 8), (0x54 << 8) },
+ { 0, (0xc0 << 8), 0x0, 0x0 },
+ { 0, (0xcc << 8), (0x10 << 8), (0x74 << 8) },
+ { 0, (0x50 << 8), (0x94 << 8), (0xcd << 8) },
+ { 0, 0xffff, (0xd5 << 8), 0x0 },
+ { 0, 0x0, (0xd8 << 8), 0x0 },
+ { 0, (0xc0 << 8), (0x60 << 8), (0xc0 << 8) }
};
+
typedef enum LabelColorChangeFlags_ {
LCCF_COLOR = 1 << 0,
GdkColor color;
/* XXX: note that the label member is supposed to be dynamically
- * allocated and fffreed */
+ * allocated and freed */
gchar *label;
GtkWidget *widget;
} label_colors[NUM_MENUS][COLORLABELS] = {
{
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
{ LCCF_ALL, { 0 }, NULL, NULL },
{ LCCF_ALL, { 0 }, NULL, NULL },
{ LCCF_ALL, { 0 }, NULL, NULL },
{ LCCF_ALL, { 0 }, NULL, NULL },
{ LCCF_ALL, { 0 }, NULL, NULL }},
{
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
+ { LCCF_ALL, { 0 }, NULL, NULL },
{ LCCF_ALL, { 0 }, NULL, NULL },
{ LCCF_ALL, { 0 }, NULL, NULL },
{ LCCF_ALL, { 0 }, NULL, NULL },
gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 4);
- accel = g_strdup_printf("Ctrl+%c", '1'+color_index);
+ if (color_index < 9)
+ accel = g_strdup_printf("Ctrl+%c", '1'+color_index);
+ else
+ accel = g_strdup_printf("Shift+Ctrl+%c", '1'+color_index%9);
label = gtk_label_new(accel);
gtk_widget_show(label);
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
#include <glib.h>
#include <gtk/gtkimage.h>
-#define COLORLABELS 7
+/* max value of color label index (0..max) - see also procmsg.h */
+#define COLORLABELS 15
+
#define MAINWIN_COLORMENU 0
#define SUMMARY_COLORMENU 1
#define NUM_MENUS 2
g_object_set_data(G_OBJECT(item), "mainwin",
mainwin);
gtk_widget_show(item);
- gtk_widget_add_accelerator(item, "activate",
+ if (i < 9)
+ gtk_widget_add_accelerator(item, "activate",
mainwin->menu_factory->accel_group,
GDK_1+i, GDK_CONTROL_MASK,
GTK_ACCEL_LOCKED | GTK_ACCEL_VISIBLE);
+ else
+ gtk_widget_add_accelerator(item, "activate",
+ mainwin->menu_factory->accel_group,
+ GDK_1+i%9, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
+ GTK_ACCEL_LOCKED | GTK_ACCEL_VISIBLE);
}
gtk_widget_show(menu);
#include "matcher.h"
#include "matcher_parser.h"
#include "matcher_parser_lex.h"
-#include "procmsg.h"
-
-#define MAX_COLORLABELS (MSG_CLABEL_7 - MSG_CLABEL_NONE)
+#include "colorlabel.h"
static gint error = 0;
static gint bool_op = 0;
criteria = MATCHCRITERIA_COLORLABEL;
value = strtol($2, NULL, 10);
if (value < 0) value = 0;
- else if (value > MAX_COLORLABELS) value = MAX_COLORLABELS;
+ else if (value > COLORLABELS) value = COLORLABELS;
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
}
| MATCHER_NOT_COLORLABEL MATCHER_INTEGER
criteria = MATCHCRITERIA_NOT_COLORLABEL;
value = strtol($2, NULL, 0);
if (value < 0) value = 0;
- else if (value > MAX_COLORLABELS) value = MAX_COLORLABELS;
+ else if (value > COLORLABELS) value = COLORLABELS;
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
}
| MATCHER_IGNORE_THREAD
NULL, NULL, NULL},
{"custom_colorlabel6", N_("Green"), &prefs_common.custom_colorlabel[5].label, P_STRING,
NULL, NULL, NULL},
- {"custom_color7", "#663366", &prefs_common.custom_colorlabel[6].color, P_COLOR,
+ {"custom_color7", "#663333", &prefs_common.custom_colorlabel[6].color, P_COLOR,
NULL, NULL, NULL},
{"custom_colorlabel7", N_("Brown"), &prefs_common.custom_colorlabel[6].label, P_STRING,
NULL, NULL, NULL},
+ {"custom_color8", "#aaaaaa", &prefs_common.custom_colorlabel[7].color, P_COLOR,
+ NULL, NULL, NULL},
+ {"custom_colorlabel8", N_("Grey"), &prefs_common.custom_colorlabel[7].label, P_STRING,
+ NULL, NULL, NULL},
+ {"custom_color9", "#c07254", &prefs_common.custom_colorlabel[8].color, P_COLOR,
+ NULL, NULL, NULL},
+ {"custom_colorlabel9", N_("Light brown"), &prefs_common.custom_colorlabel[8].label, P_STRING,
+ NULL, NULL, NULL},
+ {"custom_color10", "#c00000", &prefs_common.custom_colorlabel[9].color, P_COLOR,
+ NULL, NULL, NULL},
+ {"custom_colorlabel10", N_("Dark red"), &prefs_common.custom_colorlabel[9].label, P_STRING,
+ NULL, NULL, NULL},
+ {"custom_color11", "#cc1074", &prefs_common.custom_colorlabel[10].color, P_COLOR,
+ NULL, NULL, NULL},
+ {"custom_colorlabel11", N_("Dark pink"), &prefs_common.custom_colorlabel[10].label, P_STRING,
+ NULL, NULL, NULL},
+ {"custom_color12", "#5094cd", &prefs_common.custom_colorlabel[11].color, P_COLOR,
+ NULL, NULL, NULL},
+ {"custom_colorlabel12", N_("Steel blue"), &prefs_common.custom_colorlabel[11].label, P_STRING,
+ NULL, NULL, NULL},
+ {"custom_color13", "#ffd500", &prefs_common.custom_colorlabel[12].color, P_COLOR,
+ NULL, NULL, NULL},
+ {"custom_colorlabel13", N_("Gold"), &prefs_common.custom_colorlabel[12].label, P_STRING,
+ NULL, NULL, NULL},
+ {"custom_color14", "#00d800", &prefs_common.custom_colorlabel[13].color, P_COLOR,
+ NULL, NULL, NULL},
+ {"custom_colorlabel14", N_("Bright green"), &prefs_common.custom_colorlabel[13].label, P_STRING,
+ NULL, NULL, NULL},
+ {"custom_color15", "#c060c0", &prefs_common.custom_colorlabel[14].color, P_COLOR,
+ NULL, NULL, NULL},
+ {"custom_colorlabel15", N_("Magenta"), &prefs_common.custom_colorlabel[14].label, P_STRING,
+ NULL, NULL, NULL},
/* image viewer */
{"display_image", "TRUE", &prefs_common.display_img, P_BOOL,
gtk_widget_show (vbox_custom_colors2);
gtk_box_pack_start (GTK_BOX (hbox_custom_colors), vbox_custom_colors2, FALSE, FALSE, 0);
- for (c = 0; c < 4; c++) {
+ for (c = 0; c < (COLORLABELS>>1)+(COLORLABELS&1); c++) {
/* TRANSLATORS: 'color %d' refers to the filtering/processing
rule name and should not be translated */
tooltip_btn_text = g_strdup_printf(Q_("Tooltip|Pick color for 'color %d'"), c+1);
tooltip_entry_text, NULL);
}
- for (c = 4; c < COLORLABELS; c++) {
+ for (c = (COLORLABELS>>1)+(COLORLABELS&1); c < COLORLABELS; c++) {
/* TRANSLATORS: 'color %d' refers to the filtering/processing
rule name and should not be translated */
tooltip_btn_text = g_strdup_printf(Q_("Tooltip|Pick color for 'color %d'"), c+1);
#define MSG_FORWARDED (1U << 5)
#define MSG_POSTFILTERED (1U << 14)
-#define MSG_CLABEL_SBIT (7) /* start bit of color label */
-#define MAKE_MSG_CLABEL(h, m, l) (((h) << (MSG_CLABEL_SBIT + 2)) | \
- ((m) << (MSG_CLABEL_SBIT + 1)) | \
- ((l) << (MSG_CLABEL_SBIT + 0)))
-
-#define MSG_CLABEL_NONE MAKE_MSG_CLABEL(0U, 0U, 0U)
-#define MSG_CLABEL_1 MAKE_MSG_CLABEL(0U, 0U, 1U)
-#define MSG_CLABEL_2 MAKE_MSG_CLABEL(0U, 1U, 0U)
-#define MSG_CLABEL_3 MAKE_MSG_CLABEL(0U, 1U, 1U)
-#define MSG_CLABEL_4 MAKE_MSG_CLABEL(1U, 0U, 0U)
-#define MSG_CLABEL_5 MAKE_MSG_CLABEL(1U, 0U, 1U)
-#define MSG_CLABEL_6 MAKE_MSG_CLABEL(1U, 1U, 0U)
-#define MSG_CLABEL_7 MAKE_MSG_CLABEL(1U, 1U, 1U)
-
-#define MSG_CLABEL_ORANGE MSG_CLABEL_1
-#define MSG_CLABEL_RED MSG_CLABEL_2
-#define MSG_CLABEL_PINK MSG_CLABEL_3
-#define MSG_CLABEL_SKYBLUE MSG_CLABEL_4
-#define MSG_CLABEL_BLUE MSG_CLABEL_5
-#define MSG_CLABEL_GREEN MSG_CLABEL_6
-#define MSG_CLABEL_BROWN MSG_CLABEL_7
+#define MSG_CLABEL_SBIT (6) /* start bit of color label */
+/* color labels use 4 bits: 6, 7, 8, 9; bit weight is 7<8<9<6,
+ IOW the color label value itself must be computed from MsgPermFlags
+ bits like this:
+ value = bit-7-value*2^0
+ + bit-8-value*2^1
+ + bit-9-value*2^2
+ + bit-6-value*2^3 */
+
+/* color label permflags masks */
+#define MAKE_MSG_CLABEL(x, h, m, l) (\
+ ((x) << (MSG_CLABEL_SBIT + 0)) | \
+ ((h) << (MSG_CLABEL_SBIT + 3)) | \
+ ((m) << (MSG_CLABEL_SBIT + 2)) | \
+ ((l) << (MSG_CLABEL_SBIT + 1)))
+#define MSG_CLABEL_NONE MAKE_MSG_CLABEL(0U, 0U, 0U, 0U)
+#define MSG_CLABEL_1 MAKE_MSG_CLABEL(0U, 0U, 0U, 1U)
+#define MSG_CLABEL_2 MAKE_MSG_CLABEL(0U, 0U, 1U, 0U)
+#define MSG_CLABEL_3 MAKE_MSG_CLABEL(0U, 0U, 1U, 1U)
+#define MSG_CLABEL_4 MAKE_MSG_CLABEL(0U, 1U, 0U, 0U)
+#define MSG_CLABEL_5 MAKE_MSG_CLABEL(0U, 1U, 0U, 1U)
+#define MSG_CLABEL_6 MAKE_MSG_CLABEL(0U, 1U, 1U, 0U)
+#define MSG_CLABEL_7 MAKE_MSG_CLABEL(0U, 1U, 1U, 1U)
+#define MSG_CLABEL_8 MAKE_MSG_CLABEL(1U, 0U, 0U, 0U)
+#define MSG_CLABEL_9 MAKE_MSG_CLABEL(1U, 0U, 0U, 1U)
+#define MSG_CLABEL_10 MAKE_MSG_CLABEL(1U, 0U, 1U, 0U)
+#define MSG_CLABEL_11 MAKE_MSG_CLABEL(1U, 0U, 1U, 1U)
+#define MSG_CLABEL_12 MAKE_MSG_CLABEL(1U, 1U, 0U, 0U)
+#define MSG_CLABEL_13 MAKE_MSG_CLABEL(1U, 1U, 0U, 1U)
+#define MSG_CLABEL_14 MAKE_MSG_CLABEL(1U, 1U, 1U, 0U)
+#define MSG_CLABEL_15 MAKE_MSG_CLABEL(1U, 1U, 1U, 1U)
+#define MSG_CLABEL_FLAG_MASK (MSG_CLABEL_15)
#define MSG_IGNORE_THREAD (1U << 10) /* ignore threads */
#define MSG_LOCKED (1U << 11) /* msg is locked */
typedef guint32 MsgPermFlags;
-#define MSG_CLABEL_FLAG_MASK (MSG_CLABEL_7)
-
#define MSG_MOVE (1U << 0)
#define MSG_COPY (1U << 1)
#define MSG_MOVE_DONE (1U << 15)
#define MSG_IS_FORWARDED(msg) (((msg).perm_flags & MSG_FORWARDED) != 0)
#define MSG_IS_POSTFILTERED(msg) (((msg).perm_flags & MSG_POSTFILTERED) != 0)
+/* color label decoding/encoding (permflag storage bits <-> color list index value)*/
+#define MSG_COLORLABEL_TO_FLAGS(val) (((((guint)(val)) & 7) << (MSG_CLABEL_SBIT+1)) \
+ | (((guint)(val) & 8) << (MSG_CLABEL_SBIT-3)))
+#define MSG_COLORLABEL_FROM_FLAGS(val) ((((guint)(val) >> (MSG_CLABEL_SBIT+1)) & 7 ) \
+ | (((guint)(val) >> (MSG_CLABEL_SBIT-3)) & 8))
#define MSG_GET_COLORLABEL(msg) (((msg).perm_flags & MSG_CLABEL_FLAG_MASK))
-#define MSG_GET_COLORLABEL_VALUE(msg) (MSG_GET_COLORLABEL(msg) >> MSG_CLABEL_SBIT)
-#define MSG_SET_COLORLABEL_VALUE(msg, val) \
- MSG_SET_PERM_FLAGS(msg, ((((guint)(val)) & 7) << MSG_CLABEL_SBIT))
-
-#define MSG_COLORLABEL_TO_FLAGS(val) ((((guint)(val)) & 7) << MSG_CLABEL_SBIT)
-#define MSG_COLORLABEL_FROM_FLAGS(val) (val >> MSG_CLABEL_SBIT)
+#define MSG_GET_COLORLABEL_VALUE(msg) (MSG_COLORLABEL_FROM_FLAGS(MSG_GET_COLORLABEL(msg)))
+#define MSG_SET_COLORLABEL_VALUE(msg, val) MSG_SET_PERM_FLAGS(msg, MSG_COLORLABEL_TO_FLAGS(val))
#define MSG_IS_MOVE(msg) (((msg).tmp_flags & MSG_MOVE) != 0)
#define MSG_IS_COPY(msg) (((msg).tmp_flags & MSG_COPY) != 0)