remove unused xml.go
add missing imports add font struct to cell add imgtext func to cell add colorDialogs to songEdit.qml
This commit is contained in:
parent
b4737bf4f8
commit
fa6213472f
13
imagick.go
13
imagick.go
@ -2,6 +2,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
"bytes"
|
"bytes"
|
||||||
"image"
|
"image"
|
||||||
"log"
|
"log"
|
||||||
@ -69,7 +70,7 @@ func resizeImage(mw *imagick.MagickWand, newWidth, newHeight int, keepSpecSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//getImage() from imagick to image.RGBA
|
//getImage() from imagick to image.RGBA
|
||||||
func (cl cell) getImage(width, height int) (img *image.RGBA) {
|
func (cl *cell) getImage(width, height int) (img *image.RGBA) {
|
||||||
mw := cl.img.GetImage()
|
mw := cl.img.GetImage()
|
||||||
if (width == 0) || (height == 0) {
|
if (width == 0) || (height == 0) {
|
||||||
width = int(mw.GetImageWidth())
|
width = int(mw.GetImageWidth())
|
||||||
@ -88,10 +89,8 @@ func (cl cell) getImage(width, height int) (img *image.RGBA) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text effect 1 - shadow effect using MagickShadowImage
|
// adding text to image copied from example
|
||||||
func textEffect1() {
|
func (cl *cell) imgtext() {
|
||||||
imagick.Initialize()
|
|
||||||
defer imagick.Terminate()
|
|
||||||
mw := imagick.NewMagickWand()
|
mw := imagick.NewMagickWand()
|
||||||
defer mw.Destroy()
|
defer mw.Destroy()
|
||||||
dw := imagick.NewDrawingWand()
|
dw := imagick.NewDrawingWand()
|
||||||
@ -117,7 +116,7 @@ func textEffect1() {
|
|||||||
dw.SetTextAntialias(true)
|
dw.SetTextAntialias(true)
|
||||||
|
|
||||||
// Now draw the text
|
// Now draw the text
|
||||||
dw.Annotation(25, 65, "Magick")
|
dw.Annotation(25, 65, cl.text)
|
||||||
|
|
||||||
// Draw the image on to the mw
|
// Draw the image on to the mw
|
||||||
mw.DrawImage(dw)
|
mw.DrawImage(dw)
|
||||||
@ -155,7 +154,7 @@ func findfonts() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
}
|
}
|
||||||
fontlst = strings.Seperate(out.String(), "\n")
|
fontlst = strings.Split(out.String(), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func round(a float64) int {
|
func round(a float64) int {
|
||||||
|
14
main.go
14
main.go
@ -3,6 +3,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"image/color"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@ -21,6 +22,13 @@ type cell struct {
|
|||||||
qmlimg qml.Object
|
qmlimg qml.Object
|
||||||
qmlcell qml.Object
|
qmlcell qml.Object
|
||||||
index int
|
index int
|
||||||
|
font struct {
|
||||||
|
name string
|
||||||
|
size int
|
||||||
|
color color.RGBA
|
||||||
|
outline float32
|
||||||
|
outlineColor color.RGBA
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type slide []*cell
|
type slide []*cell
|
||||||
|
|
||||||
@ -56,7 +64,7 @@ func run() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
edtQml, err = engine.LoadFile(path + "/qml/tst.qml")
|
edtQml, err = engine.LoadFile(path + "/qml/songEdit.qml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -127,7 +135,7 @@ func (sl *slide) add( /*cl *cell*/ ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//(cell) remove() should destroy everything
|
//(cell) remove() should destroy everything for this cell
|
||||||
func (cl *cell) remove() {
|
func (cl *cell) remove() {
|
||||||
cl.text = ""
|
cl.text = ""
|
||||||
cl.qmlimg.Destroy()
|
cl.qmlimg.Destroy()
|
||||||
@ -144,7 +152,7 @@ func (sl *slide) remove(i int) {
|
|||||||
*sl, (*sl)[len((*sl))-1] = append((*sl)[:i], (*sl)[i+1:]...), nil
|
*sl, (*sl)[len((*sl))-1] = append((*sl)[:i], (*sl)[i+1:]...), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//Toggle lazy wanted a func for it
|
//Toggle, lazy wanted a func for it
|
||||||
func (bl *Bool) Toggle() {
|
func (bl *Bool) Toggle() {
|
||||||
if *bl == false {
|
if *bl == false {
|
||||||
*bl = true
|
*bl = true
|
||||||
|
@ -7,6 +7,20 @@ ApplicationWindow {
|
|||||||
minimumHeight: 480
|
minimumHeight: 480
|
||||||
minimumWidth: 640
|
minimumWidth: 640
|
||||||
|
|
||||||
|
ColorDialog {
|
||||||
|
id: textClrDialog
|
||||||
|
//objectname: "textClrDialog"
|
||||||
|
title: "Please choose a color for the text"
|
||||||
|
showAlphaChannel: true
|
||||||
|
}
|
||||||
|
|
||||||
|
ColorDialog {
|
||||||
|
id: outlineClrDialog
|
||||||
|
//objectname: "outlineClrDialog"
|
||||||
|
title: "Please choose a color for the text"
|
||||||
|
showAlphaChannel: true
|
||||||
|
}
|
||||||
|
|
||||||
menuBar: MenuBar {
|
menuBar: MenuBar {
|
||||||
Menu {
|
Menu {
|
||||||
title: "&File"
|
title: "&File"
|
||||||
@ -34,7 +48,7 @@ ApplicationWindow {
|
|||||||
Menu {
|
Menu {
|
||||||
title: "&Help"
|
title: "&Help"
|
||||||
MenuItem {
|
MenuItem {
|
||||||
action: aboutAction
|
//action: aboutAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,17 +247,18 @@ ApplicationWindow {
|
|||||||
objectName: "imgPicker"
|
objectName: "imgPicker"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TextEdit {
|
TextArea {
|
||||||
id: textEdit1
|
id: textEdit1
|
||||||
width: 80
|
width: 80
|
||||||
height: 20
|
height: 20
|
||||||
text: qsTr("Text Edit")
|
text: qsTr("Text Edit")
|
||||||
textFormat: Text.AutoText
|
textFormat: Text.AutoText
|
||||||
cursorVisible: true
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
|
selectByKeyboard: true
|
||||||
|
selectByMouse: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
60
xml.go
60
xml.go
@ -1,60 +0,0 @@
|
|||||||
// PresentationApp project xml.go
|
|
||||||
package main
|
|
||||||
|
|
||||||
type _ struct {
|
|
||||||
Song struct {
|
|
||||||
Version string `xml:"version,attr"`
|
|
||||||
CreatedIn string `xml:"createdIn,attr"`
|
|
||||||
ModifiedIn string `xml:"modifiedIn,attr"`
|
|
||||||
ModifiedDate string `xml:"modifiedDate,attr"`
|
|
||||||
Properties struct {
|
|
||||||
Copyright string `xml:"copyright,omitempty"`
|
|
||||||
CcliNo string `xml:"ccliNo,omitempty"`
|
|
||||||
Released string `xml:"released,omitempty"`
|
|
||||||
Transposition string `xml:"transposition,omitempty"`
|
|
||||||
Key string `xml:"key,omitempty"`
|
|
||||||
Variant string `xml:"variant,omitempty"`
|
|
||||||
Publisher string `xml:"publisher,omitempty"`
|
|
||||||
Version string `xml:"version,omitempty"`
|
|
||||||
Keywords string `xml:"keywords,omitempty"`
|
|
||||||
VerseOrder string `xml:"verseOrder"`
|
|
||||||
Comments []string `xml:"comments,omitempty"`
|
|
||||||
|
|
||||||
Title []struct {
|
|
||||||
Original string `xml:"original,attr,omitempty"`
|
|
||||||
Lang string `xml:"lang,attr,omitempty"`
|
|
||||||
} `xml:"titles>title"`
|
|
||||||
|
|
||||||
Author []struct {
|
|
||||||
Type string `xml:"type,attr,omitempty"`
|
|
||||||
Lang string `xml:"lang,attr,omitempty"`
|
|
||||||
} `xml:"authors>author,omitempty"`
|
|
||||||
|
|
||||||
Tempo struct {
|
|
||||||
Type string `xml:"type,attr,omitempty"`
|
|
||||||
Value string `xml:",innerxml"`
|
|
||||||
} `xml:"tempo,omitempty"`
|
|
||||||
|
|
||||||
Songbook []struct {
|
|
||||||
Name string `xml:"name,attr"`
|
|
||||||
Entry string `xml:"entry,attr,omitempty"`
|
|
||||||
} `xml:"songbooks>songbook,omitempty"`
|
|
||||||
|
|
||||||
Theme []struct {
|
|
||||||
Lang string `xml:"lang,attr,omitempty"`
|
|
||||||
Value string `xml:",innerxml"`
|
|
||||||
} `xml:"themes>theme"`
|
|
||||||
} `xml:"properties"`
|
|
||||||
|
|
||||||
Verse []struct {
|
|
||||||
Lang string `xml:"lang,attr,omitempty"`
|
|
||||||
Transliteration string `xml:"translit,attr,omitempty"`
|
|
||||||
Name string `xml:"name,attr"`
|
|
||||||
Lines []struct {
|
|
||||||
Part string `xml:"part,attr"`
|
|
||||||
Value string `xml:",innerxml"`
|
|
||||||
} `xml:"lines"`
|
|
||||||
Comments []string `xml:"comments,omitempty"`
|
|
||||||
} `xml:"lyrics>verse"`
|
|
||||||
} `xml:"song"`
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user