Skip to content

Commit

Permalink
adding gel and gio
Browse files Browse the repository at this point in the history
  • Loading branch information
mleku committed Dec 24, 2024
1 parent 5ef6fea commit e5a35fd
Show file tree
Hide file tree
Showing 600 changed files with 107,852 additions and 320 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ node_modules/**
!*.png
!*.ttf
!*.sfd
!*.frag
!*.vert
!*.m
!*.gz
!*.java

# ...even if they are in subdirectories
!*/
6 changes: 3 additions & 3 deletions gel/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"realy.lol/atomic"
"golang.org/x/exp/shiny/materialdesign/icons"

l "realy.lol/gel/gio/layout"
"realy.lol/gel/gio/text"
"realy.lol/gel/gio/unit"
l "realy.lol/gio/layout"
"realy.lol/gio/text"
"realy.lol/gio/unit"
)

// App defines an application with a header, sidebar/menu, right side button bar, changeable body page widget and
Expand Down
2 changes: 1 addition & 1 deletion gel/bool.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gel

import (
l "realy.lol/gel/gio/layout"
l "realy.lol/gio/layout"
)

type BoolHook func(b bool)
Expand Down
20 changes: 10 additions & 10 deletions gel/border.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package gel

import (
"image/color"
"realy.lol/gel/gio/f32"
l "realy.lol/gel/gio/layout"
"realy.lol/gel/gio/op/clip"
"realy.lol/gel/gio/op/paint"
"realy.lol/gel/gio/unit"

"realy.lol/gio/f32"
l "realy.lol/gio/layout"
"realy.lol/gio/op/clip"
"realy.lol/gio/op/paint"
"realy.lol/gio/unit"
)

// Border lays out a widget and draws a border inside it.
Expand Down Expand Up @@ -53,22 +53,22 @@ func (b *Border) Embed(w l.Widget) *Border {
func (b *Border) Fn(gtx l.Context) l.Dimensions {
dims := b.w(gtx)
sz := l.FPt(dims.Size)

rr := float32(gtx.Px(b.cornerRadius))
width := float32(gtx.Px(b.width))
sz.X -= width
sz.Y -= width

r := f32.Rectangle{Max: sz}
r = r.Add(f32.Point{X: width * 0.5, Y: width * 0.5})

paint.FillShape(gtx.Ops,
b.color,
clip.Stroke{
Path: clip.UniformRRect(r, rr).Path(gtx.Ops),
Style: clip.StrokeStyle{Width: width},
}.Op(),
)

return dims
}
14 changes: 7 additions & 7 deletions gel/button.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"math"
"strings"

"realy.lol/gel/gio/f32"
l "realy.lol/gel/gio/layout"
"realy.lol/gel/gio/op"
"realy.lol/gel/gio/op/clip"
"realy.lol/gel/gio/op/paint"
"realy.lol/gel/gio/text"
"realy.lol/gel/gio/unit"
"realy.lol/gio/f32"
l "realy.lol/gio/layout"
"realy.lol/gio/op"
"realy.lol/gio/op/clip"
"realy.lol/gio/op/paint"
"realy.lol/gio/text"
"realy.lol/gio/unit"

"realy.lol/gel/f32color"
)
Expand Down
12 changes: 6 additions & 6 deletions gel/buttonlayout.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package gel

import (
"image/color"
"realy.lol/gel/gio/f32"
l "realy.lol/gel/gio/layout"
"realy.lol/gel/gio/op/clip"
"realy.lol/gel/gio/unit"

"realy.lol/gio/f32"
l "realy.lol/gio/layout"
"realy.lol/gio/op/clip"
"realy.lol/gio/unit"

"realy.lol/gel/f32color"
)

Expand Down
2 changes: 1 addition & 1 deletion gel/card.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gel

import l "realy.lol/gel/gio/layout"
import l "realy.lol/gio/layout"

func (w *Window) Card(background string, embed l.Widget,
) func(gtx l.Context) l.Dimensions {
Expand Down
10 changes: 5 additions & 5 deletions gel/checkable.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package gel
import (
"image"

"realy.lol/gel/gio/io/pointer"
l "realy.lol/gel/gio/layout"
"realy.lol/gel/gio/op/paint"
"realy.lol/gel/gio/text"
"realy.lol/gel/gio/unit"
"realy.lol/gio/io/pointer"
l "realy.lol/gio/layout"
"realy.lol/gio/op/paint"
"realy.lol/gio/text"
"realy.lol/gio/unit"
"golang.org/x/exp/shiny/materialdesign/icons"
)

Expand Down
2 changes: 1 addition & 1 deletion gel/checkbox.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gel

import (
l "realy.lol/gel/gio/layout"
l "realy.lol/gio/layout"
)

// CheckBox creates a checkbox with a text label
Expand Down
12 changes: 6 additions & 6 deletions gel/clickable.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"image"
"time"

"realy.lol/gel/gio/f32"
"realy.lol/gel/gio/gesture"
"realy.lol/gel/gio/io/key"
"realy.lol/gel/gio/io/pointer"
l "realy.lol/gel/gio/layout"
"realy.lol/gel/gio/op"
"realy.lol/gio/f32"
"realy.lol/gio/gesture"
"realy.lol/gio/io/key"
"realy.lol/gio/io/pointer"
l "realy.lol/gio/layout"
"realy.lol/gio/op"
)

type clickEvents struct {
Expand Down
2 changes: 1 addition & 1 deletion gel/cmd/clipboard/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"realy.lol/qu"

l "realy.lol/gel/gio/layout"
l "realy.lol/gio/layout"

"realy.lol/gel"
"realy.lol/gel/clipboard"
Expand Down
2 changes: 1 addition & 1 deletion gel/cmd/hello/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
l "realy.lol/gel/gio/layout"
l "realy.lol/gio/layout"
"realy.lol/qu"

"realy.lol/gel"
Expand Down
2 changes: 1 addition & 1 deletion gel/cmd/iconchooser/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"sort"

l "realy.lol/gel/gio/layout"
l "realy.lol/gio/layout"
"github.com/atotto/clipboard"
"realy.lol/interrupt"
"realy.lol/qu"
Expand Down
4 changes: 2 additions & 2 deletions gel/column.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gel

import (
l "realy.lol/gel/gio/layout"
l "realy.lol/gio/layout"
)

type ColumnRow struct {
Expand All @@ -23,7 +23,7 @@ type Column struct {
func (w *Window) Column(rows Rows, font string, scale float32, color string,
background string) *Column {
return &Column{Window: w, rows: rows, font: font, scale: scale,
color: color,
color: color,
background: background, list: w.List()}
}

Expand Down
10 changes: 5 additions & 5 deletions gel/dialog/_dialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"image"
"image/color"

"realy.lol/gel/gio/io/pointer"
l "realy.lol/gel/gio/layout"
"realy.lol/gel/gio/op"
"realy.lol/gel/gio/op/paint"
"realy.lol/gel/gio/unit"
"realy.lol/gio/io/pointer"
l "realy.lol/gio/layout"
"realy.lol/gio/op"
"realy.lol/gio/op/paint"
"realy.lol/gio/unit"

"github.com/p9c/p9/pkg/gui"
)
Expand Down
12 changes: 6 additions & 6 deletions gel/dialog/example/_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"log"
"os"

"realy.lol/gel/gio/app"
"realy.lol/gel/gio/io/system"
"realy.lol/gel/gio/layout"
"realy.lol/gel/gio/op"
"realy.lol/gel/gio/op/paint"
"realy.lol/gel/gio/unit"
"realy.lol/gio/app"
"realy.lol/gio/io/system"
"realy.lol/gio/layout"
"realy.lol/gio/op"
"realy.lol/gio/op/paint"
"realy.lol/gio/unit"

"github.com/p9c/p9/pkg/gui"
"github.com/p9c/p9/pkg/gui/dialog"
Expand Down
16 changes: 10 additions & 6 deletions gel/dimensionlist.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package gel

import (
l "realy.lol/gel/gio/layout"
"realy.lol/gel/gio/op"
l "realy.lol/gio/layout"
"realy.lol/gio/op"
)

type DimensionList []l.Dimensions
Expand All @@ -15,15 +15,17 @@ func (d DimensionList) GetTotal(axis l.Axis) (total int) {
}

// PositionToCoordinate converts a list position to absolute coordinate
func (d DimensionList) PositionToCoordinate(position Position, axis l.Axis) (coordinate int) {
func (d DimensionList) PositionToCoordinate(position Position,
axis l.Axis) (coordinate int) {
for i := 0; i < position.First; i++ {
coordinate += axisMain(axis, d[i].Size)
}
return coordinate + position.Offset
}

// CoordinateToPosition converts an absolute coordinate to a list position
func (d DimensionList) CoordinateToPosition(coordinate int, axis l.Axis) (position Position) {
func (d DimensionList) CoordinateToPosition(coordinate int,
axis l.Axis) (position Position) {
cursor := 0
if coordinate < 0 {
coordinate = 0
Expand Down Expand Up @@ -56,7 +58,8 @@ func (d DimensionList) CoordinateToPosition(coordinate int, axis l.Axis) (positi
}

// GetDimensionList returns a dimensionlist based on the given listelement
func GetDimensionList(gtx l.Context, length int, listElement ListElement) (dims DimensionList) {
func GetDimensionList(gtx l.Context, length int,
listElement ListElement) (dims DimensionList) {
// gather the dimensions of the list elements
for i := 0; i < length; i++ {
child := op.Record(gtx.Ops)
Expand All @@ -74,7 +77,8 @@ func GetDimension(gtx l.Context, w l.Widget) (dim l.Dimensions) {
return
}

func (d DimensionList) GetSizes(position Position, axis l.Axis) (total, before int) {
func (d DimensionList) GetSizes(position Position,
axis l.Axis) (total, before int) {
for i := range d {
inc := axisMain(axis, d[i].Size)
total += inc
Expand Down
2 changes: 1 addition & 1 deletion gel/direction.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gel

import l "realy.lol/gel/gio/layout"
import l "realy.lol/gio/layout"

type Direction struct {
l.Direction
Expand Down
Loading

0 comments on commit e5a35fd

Please sign in to comment.