mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-13 05:13:46 +01:00
Merge highlight-transparency into other settings
This commit is contained in:
parent
60afd2a9ed
commit
fb2b5da84b
@ -41,7 +41,7 @@ General settings
|
|||||||
(e.g.: show search results)
|
(e.g.: show search results)
|
||||||
|
|
||||||
:type: String
|
:type: String
|
||||||
:default: #9FBC00
|
:default: rgba(159,251,0,0.5)
|
||||||
|
|
||||||
.. describe:: highlight-fg
|
.. describe:: highlight-fg
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ General settings
|
|||||||
(e.g.: numbers for links)
|
(e.g.: numbers for links)
|
||||||
|
|
||||||
:type: String
|
:type: String
|
||||||
:default: #FFFFFF
|
:default: rgba(0,0,0,0.5)
|
||||||
|
|
||||||
.. describe:: highlight-active-color
|
.. describe:: highlight-active-color
|
||||||
|
|
||||||
@ -57,14 +57,7 @@ General settings
|
|||||||
element (e.g: current search result)
|
element (e.g: current search result)
|
||||||
|
|
||||||
:type: String
|
:type: String
|
||||||
:default: #00BC00
|
:default: rgba(0,188,0,0.5)
|
||||||
|
|
||||||
.. describe:: highlight-transparency
|
|
||||||
|
|
||||||
Defines the opacity of a highlighted element
|
|
||||||
|
|
||||||
:type: Float
|
|
||||||
:default: 0.5
|
|
||||||
|
|
||||||
.. describe:: page-padding
|
.. describe:: page-padding
|
||||||
|
|
||||||
|
@ -659,27 +659,21 @@ zathura
|
|||||||
(e.g: current search result)
|
(e.g: current search result)
|
||||||
|
|
||||||
* Value type: String
|
* Value type: String
|
||||||
* Default value: #00BC00
|
* Default value: rgba(0,188,0,0.5)
|
||||||
|
|
||||||
*highlight-color*
|
*highlight-color*
|
||||||
Defines the color that is used for highlighting parts of the document (e.g.:
|
Defines the color that is used for highlighting parts of the document (e.g.:
|
||||||
show search results)
|
show search results)
|
||||||
|
|
||||||
* Value type: String
|
* Value type: String
|
||||||
* Default value: #9FBC00
|
* Default value: rgba(159,251,0,0.5)
|
||||||
|
|
||||||
*highlight-fg*
|
*highlight-fg*
|
||||||
Defines the color that is used for text when highlighting parts of the
|
Defines the color that is used for text when highlighting parts of the
|
||||||
document (e.g.: number for links).
|
document (e.g.: number for links).
|
||||||
|
|
||||||
* Value type: String
|
* Value type: String
|
||||||
* Default value: #9FBC00
|
* Default value: rgba(0,0,0,0.5)
|
||||||
|
|
||||||
*highlight-transparency*
|
|
||||||
Defines the opacity of a highlighted element
|
|
||||||
|
|
||||||
* Value type: Float
|
|
||||||
* Default value: 0.5
|
|
||||||
|
|
||||||
*highlighter-modifier*
|
*highlighter-modifier*
|
||||||
Defines the modifier that needs to be pressed together with the left mouse button
|
Defines the modifier that needs to be pressed together with the left mouse button
|
||||||
|
@ -243,6 +243,7 @@ void config_load_default(zathura_t* zathura) {
|
|||||||
/* Set default mode */
|
/* Set default mode */
|
||||||
girara_mode_set(gsession, zathura->modes.normal);
|
girara_mode_set(gsession, zathura->modes.normal);
|
||||||
|
|
||||||
|
/* clang-format off */
|
||||||
/* zathura settings */
|
/* zathura settings */
|
||||||
girara_setting_add(gsession, "database", "plain", STRING, true, _("Database backend"), NULL, NULL);
|
girara_setting_add(gsession, "database", "plain", STRING, true, _("Database backend"), NULL, NULL);
|
||||||
girara_setting_add(gsession, "filemonitor", "glib", STRING, true, _("File monitor backend"), NULL, NULL);
|
girara_setting_add(gsession, "filemonitor", "glib", STRING, true, _("File monitor backend"), NULL, NULL);
|
||||||
@ -276,11 +277,11 @@ void config_load_default(zathura_t* zathura) {
|
|||||||
girara_setting_add(gsession, "recolor-darkcolor", "#FFFFFF", STRING, false, _("Recoloring (dark color)"), cb_color_change, NULL);
|
girara_setting_add(gsession, "recolor-darkcolor", "#FFFFFF", STRING, false, _("Recoloring (dark color)"), cb_color_change, NULL);
|
||||||
girara_setting_add(gsession, "recolor-lightcolor", "#000000", STRING, false, _("Recoloring (light color)"), cb_color_change, NULL);
|
girara_setting_add(gsession, "recolor-lightcolor", "#000000", STRING, false, _("Recoloring (light color)"), cb_color_change, NULL);
|
||||||
girara_setting_add(gsession, "highlight-color", NULL, STRING, false, _("Color for highlighting"), cb_color_change, NULL);
|
girara_setting_add(gsession, "highlight-color", NULL, STRING, false, _("Color for highlighting"), cb_color_change, NULL);
|
||||||
girara_setting_set(gsession, "highlight-color", "#9FBC00");
|
girara_setting_set(gsession, "highlight-color", "rgba(159,251,0,0.5)");
|
||||||
girara_setting_add(gsession, "highlight-fg", NULL, STRING, false, _("Foreground color for highlighting"), cb_color_change, NULL);
|
girara_setting_add(gsession, "highlight-fg", NULL, STRING, false, _("Foreground color for highlighting"), cb_color_change, NULL);
|
||||||
girara_setting_set(gsession, "highlight-fg", "#000000");
|
girara_setting_set(gsession, "highlight-fg", "rgba(0,0,0,0.5)");
|
||||||
girara_setting_add(gsession, "highlight-active-color", NULL, STRING, false, _("Color for highlighting (active)"), cb_color_change, NULL);
|
girara_setting_add(gsession, "highlight-active-color", NULL, STRING, false, _("Color for highlighting (active)"), cb_color_change, NULL);
|
||||||
girara_setting_set(gsession, "highlight-active-color", "#00BC00");
|
girara_setting_set(gsession, "highlight-active-color", "rgba(0,188,0,0.5)");
|
||||||
girara_setting_add(gsession, "render-loading-bg", NULL, STRING, false, _("'Loading ...' background color"), cb_color_change, NULL);
|
girara_setting_add(gsession, "render-loading-bg", NULL, STRING, false, _("'Loading ...' background color"), cb_color_change, NULL);
|
||||||
girara_setting_set(gsession, "render-loading-bg", "#FFFFFF");
|
girara_setting_set(gsession, "render-loading-bg", "#FFFFFF");
|
||||||
girara_setting_add(gsession, "render-loading-fg", NULL, STRING, false, _("'Loading ...' foreground color"), cb_color_change, NULL);
|
girara_setting_add(gsession, "render-loading-fg", NULL, STRING, false, _("'Loading ...' foreground color"), cb_color_change, NULL);
|
||||||
@ -322,8 +323,6 @@ void config_load_default(zathura_t* zathura) {
|
|||||||
girara_setting_add(gsession, "link-zoom", &bool_value, BOOLEAN, false, _("Let zoom be changed when following links"), NULL, NULL);
|
girara_setting_add(gsession, "link-zoom", &bool_value, BOOLEAN, false, _("Let zoom be changed when following links"), NULL, NULL);
|
||||||
bool_value = true;
|
bool_value = true;
|
||||||
girara_setting_add(gsession, "search-hadjust", &bool_value, BOOLEAN, false, _("Center result horizontally"), NULL, NULL);
|
girara_setting_add(gsession, "search-hadjust", &bool_value, BOOLEAN, false, _("Center result horizontally"), NULL, NULL);
|
||||||
float_value = 0.5;
|
|
||||||
girara_setting_add(gsession, "highlight-transparency", &float_value, FLOAT, false, _("Transparency for highlighting"), NULL, NULL);
|
|
||||||
bool_value = true;
|
bool_value = true;
|
||||||
girara_setting_add(gsession, "render-loading", &bool_value, BOOLEAN, false, _("Render 'Loading ...'"), NULL, NULL);
|
girara_setting_add(gsession, "render-loading", &bool_value, BOOLEAN, false, _("Render 'Loading ...'"), NULL, NULL);
|
||||||
bool_value = true;
|
bool_value = true;
|
||||||
@ -670,6 +669,7 @@ void config_load_default(zathura_t* zathura) {
|
|||||||
girara_argument_mapping_add(gsession, "width", ZATHURA_ADJUST_WIDTH);
|
girara_argument_mapping_add(gsession, "width", ZATHURA_ADJUST_WIDTH);
|
||||||
girara_argument_mapping_add(gsession, "rotate-cw", ROTATE_CW);
|
girara_argument_mapping_add(gsession, "rotate-cw", ROTATE_CW);
|
||||||
girara_argument_mapping_add(gsession, "rotate-ccw", ROTATE_CCW);
|
girara_argument_mapping_add(gsession, "rotate-ccw", ROTATE_CCW);
|
||||||
|
/* clang-format on */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -641,9 +641,6 @@ static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) {
|
|||||||
/* draw links */
|
/* draw links */
|
||||||
set_font_from_property(cairo, zathura, CAIRO_FONT_WEIGHT_BOLD);
|
set_font_from_property(cairo, zathura, CAIRO_FONT_WEIGHT_BOLD);
|
||||||
|
|
||||||
float transparency = 0.5;
|
|
||||||
girara_setting_get(zathura->ui.session, "highlight-transparency", &transparency);
|
|
||||||
|
|
||||||
if (priv->links.draw == true && priv->links.n != 0) {
|
if (priv->links.draw == true && priv->links.n != 0) {
|
||||||
unsigned int link_counter = 0;
|
unsigned int link_counter = 0;
|
||||||
for (size_t idx = 0; idx != girara_list_size(priv->links.list); ++idx) {
|
for (size_t idx = 0; idx != girara_list_size(priv->links.list); ++idx) {
|
||||||
@ -653,14 +650,14 @@ static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) {
|
|||||||
|
|
||||||
/* draw position */
|
/* draw position */
|
||||||
const GdkRGBA color = zathura->ui.colors.highlight_color;
|
const GdkRGBA color = zathura->ui.colors.highlight_color;
|
||||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, color.alpha);
|
||||||
cairo_rectangle(cairo, rectangle.x1, rectangle.y1, (rectangle.x2 - rectangle.x1),
|
cairo_rectangle(cairo, rectangle.x1, rectangle.y1, (rectangle.x2 - rectangle.x1),
|
||||||
(rectangle.y2 - rectangle.y1));
|
(rectangle.y2 - rectangle.y1));
|
||||||
cairo_fill(cairo);
|
cairo_fill(cairo);
|
||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
const GdkRGBA color_fg = zathura->ui.colors.highlight_color_fg;
|
const GdkRGBA color_fg = zathura->ui.colors.highlight_color_fg;
|
||||||
cairo_set_source_rgba(cairo, color_fg.red, color_fg.green, color_fg.blue, transparency);
|
cairo_set_source_rgba(cairo, color_fg.red, color_fg.green, color_fg.blue, color.alpha);
|
||||||
cairo_move_to(cairo, rectangle.x1 + 1, rectangle.y2 - 1);
|
cairo_move_to(cairo, rectangle.x1 + 1, rectangle.y2 - 1);
|
||||||
char* link_number = g_strdup_printf("%i", priv->links.offset + ++link_counter);
|
char* link_number = g_strdup_printf("%i", priv->links.offset + ++link_counter);
|
||||||
cairo_show_text(cairo, link_number);
|
cairo_show_text(cairo, link_number);
|
||||||
@ -721,7 +718,7 @@ static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) {
|
|||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
const GdkRGBA color_fg = zathura->ui.colors.highlight_color_fg;
|
const GdkRGBA color_fg = zathura->ui.colors.highlight_color_fg;
|
||||||
cairo_set_source_rgba(cairo, color_fg.red, color_fg.green, color_fg.blue, transparency);
|
cairo_set_source_rgba(cairo, color_fg.red, color_fg.green, color_fg.blue, color.alpha);
|
||||||
cairo_text_extents_t extents;
|
cairo_text_extents_t extents;
|
||||||
cairo_text_extents(cairo, text, &extents);
|
cairo_text_extents(cairo, text, &extents);
|
||||||
|
|
||||||
@ -743,10 +740,10 @@ static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) {
|
|||||||
/* draw position */
|
/* draw position */
|
||||||
if (idx == priv->search.current) {
|
if (idx == priv->search.current) {
|
||||||
const GdkRGBA color = zathura->ui.colors.highlight_color_active;
|
const GdkRGBA color = zathura->ui.colors.highlight_color_active;
|
||||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, color.alpha);
|
||||||
} else {
|
} else {
|
||||||
const GdkRGBA color = zathura->ui.colors.highlight_color;
|
const GdkRGBA color = zathura->ui.colors.highlight_color;
|
||||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, color.alpha);
|
||||||
}
|
}
|
||||||
cairo_rectangle(cairo, rectangle.x1, rectangle.y1, (rectangle.x2 - rectangle.x1),
|
cairo_rectangle(cairo, rectangle.x1, rectangle.y1, (rectangle.x2 - rectangle.x1),
|
||||||
(rectangle.y2 - rectangle.y1));
|
(rectangle.y2 - rectangle.y1));
|
||||||
@ -756,28 +753,24 @@ static gboolean zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo) {
|
|||||||
}
|
}
|
||||||
if (priv->selection.list != NULL && priv->selection.draw == true) {
|
if (priv->selection.list != NULL && priv->selection.draw == true) {
|
||||||
const GdkRGBA color = priv->zathura->ui.colors.highlight_color;
|
const GdkRGBA color = priv->zathura->ui.colors.highlight_color;
|
||||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, color.alpha);
|
||||||
GIRARA_LIST_FOREACH_BODY(priv->selection.list, zathura_rectangle_t*, rect,
|
GIRARA_LIST_FOREACH_BODY(
|
||||||
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, *rect);
|
priv->selection.list, zathura_rectangle_t*, rect,
|
||||||
cairo_rectangle(cairo, rectangle.x1, rectangle.y1,
|
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, *rect);
|
||||||
rectangle.x2 - rectangle.x1, rectangle.y2 - rectangle.y1);
|
cairo_rectangle(cairo, rectangle.x1, rectangle.y1, rectangle.x2 - rectangle.x1, rectangle.y2 - rectangle.y1);
|
||||||
cairo_fill(cairo);
|
cairo_fill(cairo););
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (priv->highlighter.bounds.x1 != -1
|
if (priv->highlighter.bounds.x1 != -1 && priv->highlighter.bounds.y1 != -1 && priv->highlighter.draw == true) {
|
||||||
&& priv->highlighter.bounds.y1 != -1
|
|
||||||
&& priv->highlighter.draw == true) {
|
|
||||||
const GdkRGBA color = priv->zathura->ui.colors.highlight_color;
|
const GdkRGBA color = priv->zathura->ui.colors.highlight_color;
|
||||||
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, transparency);
|
cairo_set_source_rgba(cairo, color.red, color.green, color.blue, color.alpha);
|
||||||
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, priv->highlighter.bounds);
|
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, priv->highlighter.bounds);
|
||||||
cairo_rectangle(cairo, rectangle.x1, rectangle.y1,
|
cairo_rectangle(cairo, rectangle.x1, rectangle.y1, rectangle.x2 - rectangle.x1, rectangle.y2 - rectangle.y1);
|
||||||
rectangle.x2 - rectangle.x1, rectangle.y2 - rectangle.y1);
|
|
||||||
cairo_fill(cairo);
|
cairo_fill(cairo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (smooth_reload) {
|
if (smooth_reload) {
|
||||||
girara_debug("rendering loading screen, flicker might be happening");
|
girara_debug("rendering loading screen, flicker might be happening");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set background color */
|
/* set background color */
|
||||||
if (zathura_renderer_recolor_enabled(priv->zathura->sync.render_thread) == true) {
|
if (zathura_renderer_recolor_enabled(priv->zathura->sync.render_thread) == true) {
|
||||||
|
Loading…
Reference in New Issue
Block a user