feat(tracker): add menu button for Paste

Closes #26
This commit is contained in:
vsariola 2021-02-15 19:30:18 +02:00
parent 712a4c927b
commit a470452e99
2 changed files with 12 additions and 0 deletions

View File

@ -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),
)
}

View File

@ -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),