spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit 1c6f15bf6aa418342600c15a3b7b047be6f6ea75
parent 57980a08be62d3a139ef747811ff974e3b0d41e1
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Thu, 15 Jul 2010 12:14:00 +1000

Show Spek version in the window

Diffstat:
Msrc/spek-spectrogram.vala | 21+++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/spek-spectrogram.vala b/src/spek-spectrogram.vala @@ -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.