From a470452e99a0e57a889d8d4d8c307d687a81d850 Mon Sep 17 00:00:00 2001 From: vsariola <5684185+vsariola@users.noreply.github.com> Date: Mon, 15 Feb 2021 19:30:18 +0200 Subject: [PATCH] feat(tracker): add menu button for Paste Closes #26 --- tracker/songpanel.go | 10 ++++++++++ tracker/tracker.go | 2 ++ 2 files changed, 12 insertions(+) diff --git a/tracker/songpanel.go b/tracker/songpanel.go index ad82587..a52afcb 100644 --- a/tracker/songpanel.go +++ b/tracker/songpanel.go @@ -49,6 +49,10 @@ func (t *Tracker) layoutSongButtons(gtx C) D { } } + for t.PasteBtn.Clicked() { + clipboard.ReadOp{Tag: t.PasteBtn}.Add(gtx.Ops) + } + newBtnStyle := material.IconButton(t.Theme, t.NewSongFileBtn, widgetForIcon(icons.ContentClear)) newBtnStyle.Background = transparent newBtnStyle.Inset = layout.UniformInset(unit.Dp(6)) @@ -64,11 +68,17 @@ func (t *Tracker) layoutSongButtons(gtx C) D { copySongBtnStyle.Inset = layout.UniformInset(unit.Dp(6)) copySongBtnStyle.Color = primaryColor + pasteBtnStyle := material.IconButton(t.Theme, t.PasteBtn, widgetForIcon(icons.ContentContentPaste)) + pasteBtnStyle.Background = transparent + pasteBtnStyle.Inset = layout.UniformInset(unit.Dp(6)) + pasteBtnStyle.Color = primaryColor + menuContents := func(gtx C) D { return layout.Flex{Axis: layout.Vertical}.Layout(gtx, layout.Rigid(newBtnStyle.Layout), layout.Rigid(loadBtnStyle.Layout), layout.Rigid(copySongBtnStyle.Layout), + layout.Rigid(pasteBtnStyle.Layout), ) } diff --git a/tracker/tracker.go b/tracker/tracker.go index 541fb24..83ba733 100644 --- a/tracker/tracker.go +++ b/tracker/tracker.go @@ -54,6 +54,7 @@ type Tracker struct { InstrumentNameEditor *widget.Editor NewTrackBtn *widget.Clickable CopySongBtn *widget.Clickable + PasteBtn *widget.Clickable NewInstrumentBtn *widget.Clickable DeleteInstrumentBtn *widget.Clickable LoadSongFileBtn *widget.Clickable @@ -670,6 +671,7 @@ func New(audioContext sointu.AudioContext, synthService sointu.SynthService) *Tr DeleteInstrumentBtn: new(widget.Clickable), NewSongFileBtn: new(widget.Clickable), CopySongBtn: new(widget.Clickable), + PasteBtn: new(widget.Clickable), FileMenuBtn: new(widget.Clickable), LoadSongFileBtn: new(widget.Clickable), SaveSongFileBtn: new(widget.Clickable),