Show Spek version in the window

This commit is contained in:
Alexander Kojevnikov 2010-07-15 12:14:00 +10:00
parent 57980a08be
commit 1c6f15bf6a

View File

@ -129,11 +129,30 @@ namespace Spek {
private void draw (Cairo.Context cr) {
double w = allocation.width;
double h = allocation.height;
int text_width, text_height;
// Clean the background.
cr.set_source_rgb (0, 0, 0);
cr.paint ();
// Spek version
cr.set_source_rgb (1, 1, 1);
var layout = cairo_create_layout (cr);
layout.set_font_description (FontDescription.from_string (
"Sans " + (9 * FONT_SCALE).to_string ()));
layout.set_width (RPAD * Pango.SCALE);
layout.set_text ("v" + Config.PACKAGE_VERSION, -1);
layout.get_pixel_size (out text_width, out text_height);
int line_height = text_height;
cr.move_to (w - (RPAD + text_width) / 2, TPAD - GAP);
cairo_show_layout_line (cr, layout.get_line (0));
layout.set_font_description (FontDescription.from_string (
"Sans Bold " + (10 * FONT_SCALE).to_string ()));
layout.set_text (Config.PACKAGE_NAME, -1);
layout.get_pixel_size (out text_width, out text_height);
cr.move_to (w - (RPAD + text_width) / 2, TPAD - 2 * GAP - line_height);
cairo_show_layout_line (cr, layout.get_line (0));
if (image != null) {
// Draw the spectrogram.
cr.translate (LPAD, h - BPAD);
@ -146,7 +165,6 @@ namespace Spek {
cr.set_source_rgb (1, 1, 1);
cr.set_line_width (1);
cr.set_antialias (Antialias.NONE);
var layout = cairo_create_layout (cr);
layout.set_font_description (FontDescription.from_string (
"Sans " + (8 * FONT_SCALE).to_string ()));
layout.set_width (-1);
@ -185,7 +203,6 @@ namespace Spek {
layout.set_ellipsize (EllipsizeMode.END);
layout.set_text (info, -1);
cairo_show_layout_line (cr, layout.get_line (0));
int text_width, text_height;
layout.get_pixel_size (out text_width, out text_height);
// File name.