(filename, filedata string)
| 13489 | } |
| 13490 | |
| 13491 | func layoutContractEditor(filename, filedata string) fyne.CanvasObject { |
| 13492 | session.Domain = "app.sc.editor" |
| 13493 | |
| 13494 | frame := &iframe{} |
| 13495 | |
| 13496 | rectBox := canvas.NewRectangle(color.Transparent) |
| 13497 | rectBox.SetMinSize(fyne.NewSize(ui.MaxWidth*0.9, ui.MaxHeight*0.35)) |
| 13498 | |
| 13499 | rectWidth100 := canvas.NewRectangle(color.Transparent) |
| 13500 | rectWidth100.SetMinSize(fyne.NewSize(ui.Width*0.99, 10)) |
| 13501 | |
| 13502 | rectWidth90 := canvas.NewRectangle(color.Transparent) |
| 13503 | rectWidth90.SetMinSize(fyne.NewSize(ui.Width*0.9, 10)) |
| 13504 | |
| 13505 | rectSpacer := canvas.NewRectangle(color.Transparent) |
| 13506 | rectSpacer.SetMinSize(fyne.NewSize(6, 5)) |
| 13507 | |
| 13508 | rectCode := canvas.NewRectangle(color.Transparent) |
| 13509 | rectCode.SetMinSize(fyne.NewSize(ui.MaxWidth*0.9, ui.MaxHeight*0.35)) |
| 13510 | |
| 13511 | heading := canvas.NewText("C O N T R A C T E D I T O R", colors.Green) |
| 13512 | heading.TextSize = 16 |
| 13513 | heading.Alignment = fyne.TextAlignCenter |
| 13514 | heading.TextStyle = fyne.TextStyle{Bold: true} |
| 13515 | |
| 13516 | labelHeaders := canvas.NewText(" HEADERS", colors.Gray) |
| 13517 | labelHeaders.TextSize = 14 |
| 13518 | labelHeaders.Alignment = fyne.TextAlignLeading |
| 13519 | labelHeaders.TextStyle = fyne.TextStyle{Bold: true} |
| 13520 | |
| 13521 | labelCode := canvas.NewText(" CODE (DVM-BASIC)", colors.Gray) |
| 13522 | labelCode.TextSize = 14 |
| 13523 | labelCode.Alignment = fyne.TextAlignLeading |
| 13524 | labelCode.TextStyle = fyne.TextStyle{Bold: true} |
| 13525 | |
| 13526 | labelCodeSize := canvas.NewText("(0.0KB) ", colors.Green) |
| 13527 | labelCodeSize.TextSize = 12 |
| 13528 | labelCodeSize.Alignment = fyne.TextAlignTrailing |
| 13529 | |
| 13530 | errorText := canvas.NewText(" ", colors.Green) |
| 13531 | errorText.TextSize = 12 |
| 13532 | errorText.Alignment = fyne.TextAlignCenter |
| 13533 | |
| 13534 | var nameHdr, iconURLHdr, descrHdr string |
| 13535 | nameHdr = filename |
| 13536 | |
| 13537 | // Get headers from contract code initialize func |
| 13538 | if filedata != "" { |
| 13539 | contract, _, err := dvm.ParseSmartContract(filedata) |
| 13540 | if err == nil { |
| 13541 | for n, f := range contract.Functions { |
| 13542 | if n == "InitializePrivate" || n == "Initialize" { |
| 13543 | for _, line := range f.Lines { |
| 13544 | if len(line) < 6 { |
| 13545 | // Line is to short to be a STORE |
| 13546 | continue |
| 13547 | } |
| 13548 |
no test coverage detected