From e79e22ef039eb0255918124f3873da1ff22588c1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 7 Sep 2004 14:50:47 +0000 Subject: add a nifty title bar git-svn-id: file:///home/lennart/svn/public/pavumeter/trunk@6 c62a5a7b-6fe3-0310-9d5a-afe6de46906b --- src/vumeter.cc | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/src/vumeter.cc b/src/vumeter.cc index cc59715..53c7ea8 100644 --- a/src/vumeter.cc +++ b/src/vumeter.cc @@ -12,7 +12,7 @@ class MainWindow : public Gtk::Window { public: - MainWindow(unsigned chan); + MainWindow(unsigned chan, const char *source_name); virtual ~MainWindow(); protected: @@ -23,9 +23,14 @@ protected: Gtk::Label *label; Gtk::ProgressBar *progress; }; - + + Gtk::VBox vbox, titleVBox; Gtk::Table table; std::vector channels; + Gtk::Label titleLabel; + Gtk::Label subtitleLabel; + Gtk::HSeparator separator; + Gtk::EventBox eventBox; float *levels; @@ -56,18 +61,42 @@ public: virtual void updateLatency(pa_usec_t l); }; -MainWindow::MainWindow(unsigned nchan) : +MainWindow::MainWindow(unsigned nchan, const char *source_name) : Gtk::Window(), table(1, 2), latency(0) { + char t[256]; + g_assert(nchan > 0); - set_border_width(12); set_title("Volume Meter"); + + add(vbox); + + Gdk::Color c("white"); + eventBox.modify_bg(Gtk::STATE_NORMAL, c); + + vbox.pack_start(eventBox, false, false); + + eventBox.add(titleVBox); + titleVBox.add(titleLabel); + titleVBox.add(subtitleLabel); + titleVBox.set_border_width(12); + titleVBox.set_spacing(6); + + titleLabel.set_markup("Polypaudio Volume Meter"); + titleLabel.set_alignment(0); + snprintf(t, sizeof(t), "Showing signal levels of source %s.", source_name); + subtitleLabel.set_markup(t); + subtitleLabel.set_alignment(0); + + vbox.pack_start(separator, false, false); + + table.set_border_width(12); table.set_row_spacings(6); table.set_col_spacings(12); - add(table); + vbox.pack_start(table, true, true); if (nchan == 2) { addChannel("Left:"); @@ -277,7 +306,7 @@ static void stream_state_callback(struct pa_stream *s, void *) { case PA_STREAM_READY: g_assert(!mainWindow); - mainWindow = new MainWindow(sample_spec.channels); + mainWindow = new MainWindow(sample_spec.channels, source_name); break; case PA_STREAM_FAILED: -- cgit