Fix #237 add none style to separator style

This commit is contained in:
Dave Davenport 2015-09-30 09:09:34 +02:00
parent aea2458575
commit 2d167e21d7
3 changed files with 29 additions and 27 deletions

View File

@ -33,14 +33,14 @@ typedef struct
typedef enum
{
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
} TextboxFlags;
typedef enum

View File

@ -873,29 +873,31 @@ static void menu_update ( MenuState *state )
( ( pixel & 0x000000FF ) >> 0 ) / 256.0,
( ( pixel & 0xFF000000 ) >> 24 ) / 256.0
);
if ( strcmp ( config.separator_style, "dash" ) == 0 ) {
const double dashes[1] = { 4 };
cairo_set_dash ( d, dashes, 1, 0.0 );
}
cairo_move_to ( d, 0, state->line_height + ( config.padding ) * 1 + config.line_margin + 1 );
cairo_line_to ( d, state->w, state->line_height + ( config.padding ) * 1 + config.line_margin + 1 );
cairo_stroke ( d );
if ( state->message_tb ) {
cairo_move_to ( d, 0, state->top_offset - ( config.line_margin ) - 1 );
cairo_line_to ( d, state->w, state->top_offset - ( config.line_margin ) - 1 );
if ( strcmp ( config.separator_style, "none" ) ) {
if ( strcmp ( config.separator_style, "dash" ) == 0 ) {
const double dashes[1] = { 4 };
cairo_set_dash ( d, dashes, 1, 0.0 );
}
cairo_move_to ( d, 0, state->line_height + ( config.padding ) * 1 + config.line_margin + 1 );
cairo_line_to ( d, state->w, state->line_height + ( config.padding ) * 1 + config.line_margin + 1 );
cairo_stroke ( d );
}
if ( state->message_tb ) {
cairo_move_to ( d, 0, state->top_offset - ( config.line_margin ) - 1 );
cairo_line_to ( d, state->w, state->top_offset - ( config.line_margin ) - 1 );
cairo_stroke ( d );
}
if ( config.sidebar_mode == TRUE ) {
cairo_move_to ( d, 0, state->h - state->line_height - ( config.padding ) * 1 - 1 - config.line_margin );
cairo_line_to ( d, state->w, state->h - state->line_height - ( config.padding ) * 1 - 1 - config.line_margin );
cairo_stroke ( d );
}
}
if ( config.sidebar_mode == TRUE ) {
cairo_move_to ( d, 0, state->h - state->line_height - ( config.padding ) * 1 - 1 - config.line_margin );
cairo_line_to ( d, state->w, state->h - state->line_height - ( config.padding ) * 1 - 1 - config.line_margin );
cairo_stroke ( d );
for ( unsigned int j = 0; j < num_switchers; j++ ) {
textbox_draw ( switchers[j].tb, d );
}
}
state->update = FALSE;
// Draw to actual window.

View File

@ -666,7 +666,7 @@ void textbox_setup ( Display *display )
void textbox_cleanup ( void )
{
printf("cleanup\n");
printf ( "cleanup\n" );
if ( p_context ) {
g_object_unref ( p_context );
p_context = NULL;
@ -701,8 +701,8 @@ double textbox_get_estimated_char_width ( void )
{
PangoFontDescription *pfd = pango_font_description_from_string ( config.menu_font );
// Get width
PangoFontMetrics *metric = pango_context_get_metrics ( p_context, pfd, NULL );
int width = pango_font_metrics_get_approximate_char_width ( metric );
PangoFontMetrics *metric = pango_context_get_metrics ( p_context, pfd, NULL );
int width = pango_font_metrics_get_approximate_char_width ( metric );
pango_font_metrics_unref ( metric );
pango_font_description_free ( pfd );