summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-05-18 07:59:37 +0200
committerDave Davenport <qball@gmpclient.org>2017-05-18 07:59:37 +0200
commit72afc7b0399834bc2b6c3a45f761b548f47b3cab (patch)
treeae1eb158807ee04553d359d948f7b0a060c09030
parentbcea55c398c9f9a77aeb045d264c67fee3bfba09 (diff)
Add strikethrough highlight method.
-rw-r--r--configure.ac4
-rw-r--r--doc/rofi-theme-manpage.markdown1
-rw-r--r--doc/rofi-theme.51
-rw-r--r--include/theme.h2
-rw-r--r--lexer/theme-lexer.l54
-rw-r--r--lexer/theme-parser.y10
-rw-r--r--source/helper.c6
-rw-r--r--source/theme.c3
8 files changed, 51 insertions, 30 deletions
diff --git a/configure.ac b/configure.ac
index a77ce00e..0445e422 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,6 +101,7 @@ AC_CHECK_FUNC([fcntl],, AC_MSG_ERROR("Could not find fcntl"))
AC_CHECK_FUNC([setlocale],,AC_MSG_ERROR("Could not find setlocale"))
AC_CHECK_FUNC([atexit],, AC_MSG_ERROR("Could not find atexit in c library"))
AC_CHECK_FUNC([glob],, AC_MSG_ERROR("Could not find glob in c library"))
+AC_CHECK_FUNC([toupper],, AC_MSG_ERROR("Could not find toupper in c library"))
AC_CHECK_HEADER([math.h],, AC_MSG_ERROR("Could not find math.h header file"))
AC_SEARCH_LIBS([floor],[m],, AC_MSG_ERROR("Could not find floor in math library"))
@@ -122,6 +123,9 @@ PKG_CHECK_MODULES([pango], [pango pangocairo])
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 ])
+dnl ---------------------------------------------------------------------
+dnl check - Unit testing.
+dnl ---------------------------------------------------------------------
AC_ARG_ENABLE([check], AS_HELP_STRING([--disable-check], [Build with checks using check library (default: enabled)]))
AS_IF([test "x${enable_check}" != "xno"], [ PKG_CHECK_MODULES([check],[check >= 0.11.0], [HAVE_CHECK=1]) ])
diff --git a/doc/rofi-theme-manpage.markdown b/doc/rofi-theme-manpage.markdown
index 313978db..27bec018 100644
--- a/doc/rofi-theme-manpage.markdown
+++ b/doc/rofi-theme-manpage.markdown
@@ -282,6 +282,7 @@ For example:
```
background: #FF0000;
foreground: rgba(0,0,1, 0.5);
+text: SeaGreen;
```
## Text style
diff --git a/doc/rofi-theme.5 b/doc/rofi-theme.5
index 5036f07b..a13702a6 100644
--- a/doc/rofi-theme.5
+++ b/doc/rofi-theme.5
@@ -429,6 +429,7 @@ For example:
background: #FF0000;
foreground: rgba(0,0,1, 0\.5);
+text: SeaGreen;
.
.fi
.
diff --git a/include/theme.h b/include/theme.h
index 16d03c1d..e6ca825f 100644
--- a/include/theme.h
+++ b/include/theme.h
@@ -42,6 +42,8 @@ typedef enum
HL_BOLD = 1,
/** underline */
HL_UNDERLINE = 2,
+ /** strikethrough */
+ HL_STRIKETHROUGH = 16,
/** italic */
HL_ITALIC = 4,
/** color */
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l
index 36fbccab..cf85a0fb 100644
--- a/lexer/theme-lexer.l
+++ b/lexer/theme-lexer.l
@@ -184,10 +184,11 @@ EAST "east"
WEST "west"
/* Line Style */
-NONE "none"
-BOLD "bold"
-UNDERLINE "underline"
-ITALIC "italic"
+NONE "none"
+BOLD "bold"
+UNDERLINE "underline"
+ITALIC "italic"
+STRIKETHROUGH "strikethrough"
/* ANGLES */
@@ -439,31 +440,32 @@ if ( queue == NULL ){
return T_COLOR;
}
/* Color schemes */
-<PROPERTIES>{RGBA} { return T_COL_RGBA; }
-<PROPERTIES>{HSL} { return T_COL_HSL; }
-<PROPERTIES>{HWB} { return T_COL_HWB; }
-<PROPERTIES>{CMYK} { return T_COL_CMYK; }
+<PROPERTIES>{RGBA} { return T_COL_RGBA; }
+<PROPERTIES>{HSL} { return T_COL_HSL; }
+<PROPERTIES>{HWB} { return T_COL_HWB; }
+<PROPERTIES>{CMYK} { return T_COL_CMYK; }
/* Fluff */
-<PROPERTIES>{S_T_PARENT_LEFT} { return T_PARENT_LEFT; }
-<PROPERTIES>{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT;}
-<PROPERTIES>{COMMA} { return T_COMMA; }
-<PROPERTIES>{FORWARD_SLASH} { return T_FORWARD_SLASH; }
+<PROPERTIES>{S_T_PARENT_LEFT} { return T_PARENT_LEFT; }
+<PROPERTIES>{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT; }
+<PROPERTIES>{COMMA} { return T_COMMA; }
+<PROPERTIES>{FORWARD_SLASH} { return T_FORWARD_SLASH; }
/* Position */
-<PROPERTIES>{CENTER} { return T_POS_CENTER; }
-<PROPERTIES>{EAST} { return T_POS_EAST; }
-<PROPERTIES>{WEST} { return T_POS_WEST; }
-<PROPERTIES>{SOUTH} { return T_POS_SOUTH; }
-<PROPERTIES>{NORTH} { return T_POS_NORTH; }
+<PROPERTIES>{CENTER} { return T_POS_CENTER; }
+<PROPERTIES>{EAST} { return T_POS_EAST; }
+<PROPERTIES>{WEST} { return T_POS_WEST; }
+<PROPERTIES>{SOUTH} { return T_POS_SOUTH; }
+<PROPERTIES>{NORTH} { return T_POS_NORTH; }
/* Highlight style */
-<PROPERTIES>{NONE} { return T_NONE; }
-<PROPERTIES>{BOLD} { return T_BOLD; }
-<PROPERTIES>{ITALIC} { return T_ITALIC; }
-<PROPERTIES>{UNDERLINE} { return T_UNDERLINE; }
-
-<PROPERTIES>{ANGLE_DEG} { return T_ANGLE_DEG; }
-<PROPERTIES>{ANGLE_RAD} { return T_ANGLE_RAD; }
-<PROPERTIES>{ANGLE_GRAD} { return T_ANGLE_GRAD; }
-<PROPERTIES>{ANGLE_TURN} { return T_ANGLE_TURN; }
+<PROPERTIES>{NONE} { return T_NONE; }
+<PROPERTIES>{BOLD} { return T_BOLD; }
+<PROPERTIES>{ITALIC} { return T_ITALIC; }
+<PROPERTIES>{UNDERLINE} { return T_UNDERLINE; }
+<PROPERTIES>{STRIKETHROUGH} { return T_STRIKETHROUGH; }
+
+<PROPERTIES>{ANGLE_DEG} { return T_ANGLE_DEG; }
+<PROPERTIES>{ANGLE_RAD} { return T_ANGLE_RAD; }
+<PROPERTIES>{ANGLE_GRAD} { return T_ANGLE_GRAD; }
+<PROPERTIES>{ANGLE_TURN} { return T_ANGLE_TURN; }
<PROPERTIES>{COLOR_TRANSPARENT} {
return T_COLOR_TRANSPARENT;
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y
index 816bbd7c..e721b346 100644
--- a/lexer/theme-parser.y
+++ b/lexer/theme-parser.y
@@ -173,6 +173,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b)
%token T_BOLD "Bold"
%token T_ITALIC "Italic"
%token T_UNDERLINE "Underline"
+%token T_STRIKETHROUGH "Strikethrough"
%token T_DASH "Dash"
%token T_SOLID "Solid"
@@ -394,10 +395,11 @@ t_property_highlight_styles
;
/** Single style. */
t_property_highlight_style
-: T_NONE { $$ = HL_NONE; }
-| T_BOLD { $$ = HL_BOLD; }
-| T_UNDERLINE { $$ = HL_UNDERLINE; }
-| T_ITALIC { $$ = HL_ITALIC; }
+: T_NONE { $$ = HL_NONE; }
+| T_BOLD { $$ = HL_BOLD; }
+| T_UNDERLINE { $$ = HL_UNDERLINE; }
+| T_STRIKETHROUGH { $$ = HL_STRIKETHROUGH; }
+| T_ITALIC { $$ = HL_ITALIC; }
;
/** Distance. */
diff --git a/source/helper.c b/source/helper.c
index d31a4e20..e14a5e68 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -423,6 +423,12 @@ PangoAttrList *helper_token_match_get_pango_attr ( ThemeHighlight th, GRegex **t
pa->end_index = end;
pango_attr_list_insert ( retv, pa );
}
+ if ( th.style & HL_STRIKETHROUGH ) {
+ PangoAttribute *pa = pango_attr_strikethrough_new ( TRUE );
+ pa->start_index = start;
+ pa->end_index = end;
+ pango_attr_list_insert ( retv, pa );
+ }
if ( th.style & HL_ITALIC ) {
PangoAttribute *pa = pango_attr_style_new ( PANGO_STYLE_ITALIC );
pa->start_index = start;
diff --git a/source/theme.c b/source/theme.c
index 03f3e859..601738ea 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -169,6 +169,9 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
if ( p->value.highlight.style & HL_UNDERLINE ) {
printf ( "underline " );
}
+ if ( p->value.highlight.style & HL_STRIKETHROUGH ) {
+ printf ( "strikethrough " );
+ }
if ( p->value.highlight.style & HL_ITALIC ) {
printf ( "italic " );
}