diff options
Diffstat (limited to 'src/rhlibrary')
-rw-r--r-- | src/rhlibrary/player_widget.go | 16 | ||||
-rw-r--r-- | src/rhlibrary/vumeter_widget.go | 55 |
2 files changed, 42 insertions, 29 deletions
diff --git a/src/rhlibrary/player_widget.go b/src/rhlibrary/player_widget.go index 8dfbebe..fcaaeab 100644 --- a/src/rhlibrary/player_widget.go +++ b/src/rhlibrary/player_widget.go @@ -48,7 +48,7 @@ func addPlayPauseButton(box *gtk.Box, p *player.PlayerChan) (err error) { if pauseIcon, err = gtk.ImageNewFromIconName("media-playback-pause", gtk.ICON_SIZE_LARGE_TOOLBAR); err != nil { return } - btn.SetSizeRequest(32, 32) + btn.SetSizeRequest(42, 42) btn.SetImage(playIcon) btn.SetSensitive(false) @@ -84,7 +84,7 @@ func addStopButton(box *gtk.Box, p *player.PlayerChan) (err error) { if btn, err = gtk.ButtonNewFromIconName("media-playback-stop", gtk.ICON_SIZE_LARGE_TOOLBAR); err != nil { return } - btn.SetSizeRequest(32, 32) + btn.SetSizeRequest(42, 42) btn.SetSensitive(false) btn.Connect("clicked", func(_ *gtk.Button) { @@ -134,13 +134,7 @@ func addMeter(grid *gtk.Grid, p *player.PlayerChan) error { return err } - var box *gtk.Box - if box, err = gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 2); err != nil { - return err - } - box.PackStart(widget, false, false, 2) - - grid.Attach(box, 2, 1, 1, 1) + grid.Attach(widget, 2, 1, 1, 1) return nil } @@ -217,7 +211,7 @@ func addPlayTime(grid *gtk.Grid, p *player.PlayerChan) (err error) { return true }, nil) - btn.SetSizeRequest(128, 32) + btn.SetSizeRequest(128, 42) btn.SetRelief(gtk.RELIEF_NONE) btn.SetFocusOnClick(false) btn.SetLabel(getPlayTimeString(duration, pos, countdown)) @@ -231,7 +225,7 @@ func addPlayTime(grid *gtk.Grid, p *player.PlayerChan) (err error) { if cp, err = gtk.CssProviderNew(); err != nil { return } - if err = cp.LoadFromData(".button { border: 1px solid; border-color: #a1a1a1; font-weight: bold; font-size: 11pt; }"); err != nil { + if err = cp.LoadFromData(".button { border: 1px solid; border-color: #a1a1a1; font-weight: bold; font-size: 14px; }"); err != nil { return } var sc *gtk.StyleContext diff --git a/src/rhlibrary/vumeter_widget.go b/src/rhlibrary/vumeter_widget.go index f6bda94..3cbb452 100644 --- a/src/rhlibrary/vumeter_widget.go +++ b/src/rhlibrary/vumeter_widget.go @@ -64,6 +64,9 @@ func getMeterBarCSS() (*gtk.CssProvider, error) { border-radius: 0; background-image: unset; } +.level-bar.fill-block { + border-color: #323232 +} .level-bar.fill-block.level-green { border-color: #006600; background-image: linear-gradient(to bottom, #36B736, #006600); @@ -109,6 +112,7 @@ func (lvl *vuMeterLevel) setLevel(valdb float64) { } type vuMeter struct { + label *gtk.Label green *gtk.LevelBar orange *gtk.LevelBar red *gtk.LevelBar @@ -121,6 +125,8 @@ func createMeterBar(segments float64) (bar *gtk.LevelBar, err error) { bar.SetMode(gtk.LEVEL_BAR_MODE_DISCRETE) bar.RemoveOffsetValue(gtk.LEVEL_BAR_OFFSET_LOW) bar.RemoveOffsetValue(gtk.LEVEL_BAR_OFFSET_HIGH) + bar.SetHExpand(false) + bar.SetVExpand(false) var sc *gtk.StyleContext if sc, err = bar.GetStyleContext(); err != nil { @@ -135,8 +141,24 @@ func createMeterBar(segments float64) (bar *gtk.LevelBar, err error) { return } -func newVUMeter() (meter *vuMeter, err error) { +func newVUMeter(ch string) (meter *vuMeter, err error) { meter = &vuMeter{} + if meter.label, err = gtk.LabelNew(ch); err != nil { + return + } + var cp *gtk.CssProvider + if cp, err = gtk.CssProviderNew(); err != nil { + return nil, err + } + if err = cp.LoadFromData(".label { color: #a2a2a2; padding: 0px 2px 0px 0px; font-size: 4.5px; font-variant: small-caps; font-weight: bold; }"); err != nil { + return nil, err + } + var sc *gtk.StyleContext + if sc, err = meter.label.GetStyleContext(); err != nil { + return nil, err + } + sc.AddProvider(cp, 600) // TOOD: hardcoded value + if meter.green, err = createMeterBar(meterSegmentsGreen); err != nil { return } @@ -180,13 +202,13 @@ func addVUMeterGrid(frame *gtk.Frame, p *player.PlayerChan) (err error) { if grid, err = gtk.GridNew(); err != nil { return } - grid.SetRowSpacing(3) + grid.SetRowSpacing(2) var left, right *vuMeter - if left, err = newVUMeter(); err != nil { + if left, err = newVUMeter("L"); err != nil { return } - if right, err = newVUMeter(); err != nil { + if right, err = newVUMeter("R"); err != nil { return } @@ -195,12 +217,15 @@ func addVUMeterGrid(frame *gtk.Frame, p *player.PlayerChan) (err error) { return true }, nil) - grid.Attach(left.green, 1, 1, 1, 1) - grid.Attach(left.orange, 2, 1, 1, 1) - grid.Attach(left.red, 3, 1, 1, 1) - grid.Attach(right.green, 1, 2, 1, 1) - grid.Attach(right.orange, 2, 2, 1, 1) - grid.Attach(right.red, 3, 2, 1, 1) + grid.Attach(left.label, 1, 1, 1, 1) + grid.Attach(left.green, 2, 1, 1, 1) + grid.Attach(left.orange, 3, 1, 1, 1) + grid.Attach(left.red, 4, 1, 1, 1) + + grid.Attach(right.label, 1, 2, 1, 1) + grid.Attach(right.green, 2, 2, 1, 1) + grid.Attach(right.orange, 3, 2, 1, 1) + grid.Attach(right.red, 4, 2, 1, 1) grid.SetRowHomogeneous(true) @@ -218,7 +243,7 @@ func getVUMeterWidget(p *player.PlayerChan) (gtk.IWidget, error) { if cp, err = gtk.CssProviderNew(); err != nil { return nil, err } - if err = cp.LoadFromData(".frame { padding: 3px; }"); err != nil { + if err = cp.LoadFromData(".frame { background-color: #2a2a2a; border: 1px solid; border-color: #a1a1a1; border-radius: 5px; padding: 11px; }"); err != nil { return nil, err } var sc *gtk.StyleContext @@ -231,11 +256,5 @@ func getVUMeterWidget(p *player.PlayerChan) (gtk.IWidget, error) { return nil, err } - var box *gtk.Box - if box, err = gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 7); err != nil { - return nil, err - } - box.PackStart(frame, false, false, 3) - - return box, nil + return frame, nil } |