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:
lordwelch 2016-04-29 10:17:48 -07:00
parent b4737bf4f8
commit fa6213472f
4 changed files with 35 additions and 73 deletions

View File

@ -2,6 +2,7 @@
package main
import (
"strings"
"bytes"
"image"
"log"
@ -69,7 +70,7 @@ func resizeImage(mw *imagick.MagickWand, newWidth, newHeight int, keepSpecSize,
}
//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()
if (width == 0) || (height == 0) {
width = int(mw.GetImageWidth())
@ -88,10 +89,8 @@ func (cl cell) getImage(width, height int) (img *image.RGBA) {
return
}
// Text effect 1 - shadow effect using MagickShadowImage
func textEffect1() {
imagick.Initialize()
defer imagick.Terminate()
// adding text to image copied from example
func (cl *cell) imgtext() {
mw := imagick.NewMagickWand()
defer mw.Destroy()
dw := imagick.NewDrawingWand()
@ -117,7 +116,7 @@ func textEffect1() {
dw.SetTextAntialias(true)
// Now draw the text
dw.Annotation(25, 65, "Magick")
dw.Annotation(25, 65, cl.text)
// Draw the image on to the mw
mw.DrawImage(dw)
@ -155,7 +154,7 @@ func findfonts() {
if err != nil {
log.Print(err)
}
fontlst = strings.Seperate(out.String(), "\n")
fontlst = strings.Split(out.String(), "\n")
}
func round(a float64) int {

14
main.go
View File

@ -3,6 +3,7 @@ package main
import (
"fmt"
"image/color"
"os"
"path/filepath"
@ -21,6 +22,13 @@ type cell struct {
qmlimg qml.Object
qmlcell qml.Object
index int
font struct {
name string
size int
color color.RGBA
outline float32
outlineColor color.RGBA
}
}
type slide []*cell
@ -56,7 +64,7 @@ func run() error {
return err
}
edtQml, err = engine.LoadFile(path + "/qml/tst.qml")
edtQml, err = engine.LoadFile(path + "/qml/songEdit.qml")
if err != nil {
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() {
cl.text = ""
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
}
//Toggle lazy wanted a func for it
//Toggle, lazy wanted a func for it
func (bl *Bool) Toggle() {
if *bl == false {
*bl = true

View File

@ -7,6 +7,20 @@ ApplicationWindow {
minimumHeight: 480
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 {
Menu {
title: "&File"
@ -34,7 +48,7 @@ ApplicationWindow {
Menu {
title: "&Help"
MenuItem {
action: aboutAction
//action: aboutAction
}
}
}
@ -233,17 +247,18 @@ ApplicationWindow {
objectName: "imgPicker"
}
}
TextEdit {
TextArea {
id: textEdit1
width: 80
height: 20
text: qsTr("Text Edit")
textFormat: Text.AutoText
cursorVisible: true
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
font.pixelSize: 12
selectByKeyboard: true
selectByMouse: true
}
}
}

60
xml.go
View File

@ -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"`
}