Skip to content

Commit

Permalink
Fix spelling
Browse files Browse the repository at this point in the history
(...and a couple of grammar issues)
  • Loading branch information
asmaloney committed Nov 25, 2022
1 parent 67102e6 commit a5ea4f1
Show file tree
Hide file tree
Showing 27 changed files with 70 additions and 67 deletions.
6 changes: 3 additions & 3 deletions Alignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
type AlignmentType byte

const (
// AlignLeft is here just for clearity.
// AlignLeft is here just for clarity.
// if set, no action is taken so don't use it.
AlignLeft AlignmentType = iota
// AlignCenter centers widget.
Expand Down Expand Up @@ -119,7 +119,7 @@ func (a *AlignmentSetter) Build() {
}

a.layout.Range(func(item Widget) {
// if item is inil, just skip it
// if item is nil, just skip it
if item == nil {
return
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func (a *AlignmentSetter) Build() {
//
// This function is just a workaround used in giu.
//
// NOTE: user-definied widgets, which contains more than one
// NOTE: user-defined widgets, which contains more than one
// giu widget will be processed incorrectly (only width of the last built
// widget will be processed)
//
Expand Down
2 changes: 1 addition & 1 deletion Canvas.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type DrawFlags int
// draw flags enum:.
const (
DrawFlagsNone DrawFlags = 0
// PathStroke(), AddPolyline(): specify that shape should be closed (portant: this is always == 1 for legacy reason).
// PathStroke(), AddPolyline(): specify that shape should be closed (note: this is always == 1 for legacy reasons).
DrawFlagsClosed DrawFlags = 1 << 0
// AddRect(), AddRectFilled(), PathRect(): enable rounding top-left corner only (when rounding > 0.0f, we default to all corners).
// Was 0x01.
Expand Down
10 changes: 5 additions & 5 deletions ClickableWidgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func Button(label string) *ButtonWidget {
}
}

// Buttonf creates button with formated label
// Buttonf creates button with formatted label
// NOTE: works like fmt.Sprintf (see `go doc fmt`).
func Buttonf(format string, args ...any) *ButtonWidget {
return Button(fmt.Sprintf(format, args...))
Expand Down Expand Up @@ -121,7 +121,7 @@ func SmallButton(id string) *SmallButtonWidget {
}
}

// SmallButtonf allows to set formated label for small button.
// SmallButtonf allows to set formatted label for small button.
// It calls SmallButton(fmt.Sprintf(label, args...)).
func SmallButtonf(format string, args ...any) *SmallButtonWidget {
return SmallButton(fmt.Sprintf(format, args...))
Expand Down Expand Up @@ -202,7 +202,7 @@ type ImageButtonWidget struct {
onClick func()
}

// ImageButton constructs image buton widget.
// ImageButton constructs image button widget.
func ImageButton(texture *Texture) *ImageButtonWidget {
return &ImageButtonWidget{
texture: texture,
Expand Down Expand Up @@ -384,7 +384,7 @@ type RadioButtonWidget struct {
onChange func()
}

// RadioButton creates a radio buton.
// RadioButton creates a radio button.
func RadioButton(text string, active bool) *RadioButtonWidget {
return &RadioButtonWidget{
text: GenAutoID(text),
Expand Down Expand Up @@ -432,7 +432,7 @@ func Selectable(label string) *SelectableWidget {
}
}

// Selectablef creates a selectable widget with formated label.
// Selectablef creates a selectable widget with formatted label.
func Selectablef(format string, args ...any) *SelectableWidget {
return Selectable(fmt.Sprintf(format, args...))
}
Expand Down
2 changes: 1 addition & 1 deletion CodeEditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (ce *CodeEditorWidget) ID(id string) *CodeEditorWidget {
return ce
}

// ShowWhitespaces sets if whitespaces are shown in code editor.
// ShowWhitespaces sets if whitespace is shown in code editor.
func (ce *CodeEditorWidget) ShowWhitespaces(s bool) *CodeEditorWidget {
ce.getState().editor.SetShowWhitespaces(s)
return ce
Expand Down
4 changes: 2 additions & 2 deletions Context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ func Test_invalidState(t *testing.T) {
ctx.cleanState()

assert.NotNil(t, GetState[teststate](ctx, state2ID),
"altought state has been accessed during the frame, it has ben deleted by invalidAllState/cleanState")
"although state has been accessed during the frame, it has ben deleted by invalidAllState/cleanState")
assert.Nil(t, GetState[teststate](ctx, state1ID),
"altought state hasn't been accessed during the frame, it hasn't ben deleted by invalidAllState/cleanState")
"although state hasn't been accessed during the frame, it hasn't ben deleted by invalidAllState/cleanState")
}

func Test_GetWidgetIndex(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion Events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package giu

import "github.com/AllenDang/imgui-go"

// MouseButton represents imgui.MoseButton.
// MouseButton represents imgui.MouseButton.
type MouseButton int

// mouse buttons.
Expand Down
2 changes: 1 addition & 1 deletion Flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ const (
ColorEditFlagsAlphaPreview ColorEditFlags = imgui.ColorEditFlagsAlphaPreview
// ColorEditFlagsAlphaPreviewHalf displays half opaque / half checkerboard, instead of opaque.
ColorEditFlagsAlphaPreviewHalf ColorEditFlags = imgui.ColorEditFlagsAlphaPreviewHalf
// ColorEditFlagsHDR = (WIP) surrently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use
// ColorEditFlagsHDR = (WIP) currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use
// ImGuiColorEditFlags_Float flag as well).
ColorEditFlagsHDR ColorEditFlags = imgui.ColorEditFlagsHDR
// ColorEditFlagsRGB sets the format as RGB.
Expand Down
2 changes: 1 addition & 1 deletion FontAtlasProsessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func (a *FontAtlas) rebuildFontAtlas() {
ranges := imgui.NewGlyphRanges()
builder := imgui.NewFontGlyphRangesBuilder()

// Because we pre-regestered numbers, so default string map's length should greater then 11.
// Because we pre-registered numbers, so default string map's length should greater then 11.
if sb.Len() > len(preRegisterString) {
builder.AddText(sb.String())
} else {
Expand Down
8 changes: 4 additions & 4 deletions ImageWidgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ type imageState struct {
// Dispose cleans imageState (implements Disposable interface).
func (is *imageState) Dispose() {
is.texture = nil
// Cancel ongoing image downloaidng
// Cancel ongoing image downloading
if is.loading && is.cancel != nil {
is.cancel()
}
}

var _ Widget = &ImageWithRgbaWidget{}

// ImageWithRgbaWidget wrapps ImageWidget.
// ImageWithRgbaWidget wraps ImageWidget.
// It is more useful because it doesn't make you to care about
// imgui textures. You can just pass golang-native image.Image and
// display it in giu.
Expand Down Expand Up @@ -312,8 +312,8 @@ func (i *ImageWithURLWidget) Build() {
SetState(&Context, i.id, imgState)

// Prevent multiple invocation to download image.
downloadContext, cancalFunc := ctx.WithCancel(ctx.Background())
SetState(&Context, i.id, &imageState{loading: true, cancel: cancalFunc})
downloadContext, cancelFunc := ctx.WithCancel(ctx.Background())
SetState(&Context, i.id, &imageState{loading: true, cancel: cancelFunc})

errorFn := func(err error) {
SetState(&Context, i.id, &imageState{failure: true})
Expand Down
8 changes: 4 additions & 4 deletions InputHandler.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package giu

// input menager is used to register a keyboard shortcuts in an app.
// input manager is used to register a keyboard shortcuts in an app.

// Shortcut represents a keyboard shortcut.
type Shortcut struct {
Expand All @@ -18,7 +18,7 @@ type WindowShortcut struct {
Callback func()
}

// ShortcutType represens a type of shortcut (global or local).
// ShortcutType represents a type of shortcut (global or local).
type ShortcutType bool

const (
Expand All @@ -32,11 +32,11 @@ const (
type InputHandlerHandleCallback func(Key, Modifier, Action)

// InputHandler is an interface which needs to be implemented
// by user-definied input handlers.
// by user-defined input handlers.
type InputHandler interface {
// RegisterKeyboardShortcuts adds a specified shortcuts into input handler
RegisterKeyboardShortcuts(...Shortcut)
// UnregisterKeyboardShortcuts removes iwndow shourtcuts from input handler
// UnregisterKeyboardShortcuts removes window shortcuts from input handler
UnregisterWindowShortcuts()
// Handle handles a shortcut
Handle(Key, Modifier, Action)
Expand Down
22 changes: 11 additions & 11 deletions InputHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func Test_InputHandle_RegisterKeyboardShortcuts(t *testing.T) {
isGlobal ShortcutType
cb func()
}{
{"global shourtcut", Key(1), Modifier(2), ShortcutType(true), func() {}},
{"window shourtcut", Key(9), Modifier(3), ShortcutType(false), func() {}},
{"global shortcut", Key(1), Modifier(2), ShortcutType(true), func() {}},
{"window shortcut", Key(9), Modifier(3), ShortcutType(false), func() {}},
}

for _, tt := range tests {
Expand All @@ -44,14 +44,14 @@ func Test_InputHandle_RegisterKeyboardShortcuts(t *testing.T) {
a.True(exist, "shortcut wasn't registered in input manager")
if tt.isGlobal {
// TODO: figure out why it doesn't work
// a.Equal(shortcut.global, tt.cb, "worng shortcut set in input manager")
a.NotNil(shortcut.global, "worng shortcut set in input manager")
a.Nil(shortcut.window, "worng shortcut set in input manager")
// a.Equal(shortcut.global, tt.cb, "wrong shortcut set in input manager")
a.NotNil(shortcut.global, "wrong shortcut set in input manager")
a.Nil(shortcut.window, "wrong shortcut set in input manager")
} else {
// TODO: figure out why it doesn't work
// a.Equal(shortcut.window, tt.cb, "worng shortcut set in input manager")
a.NotNil(shortcut.window, "worng shortcut set in input manager")
a.Nil(shortcut.global, "worng shortcut set in input manager")
// a.Equal(shortcut.window, tt.cb, "wrong shortcut set in input manager")
a.NotNil(shortcut.window, "wrong shortcut set in input manager")
a.Nil(shortcut.global, "wrong shortcut set in input manager")
}
})
}
Expand Down Expand Up @@ -90,9 +90,9 @@ func Test_InputHandler_Handle(t *testing.T) {
a.False(shortcut1, "Shortcut 1 was handled, but shouldn't.")
a.False(shortcut2, "Shortcut 2 was handled, but shouldn't.")
i.Handle(Key(5), Modifier(0), Press)
a.True(shortcut1, "Shortcut 1 was not handled, but shouldn be.")
a.True(shortcut1, "Shortcut 1 was not handled, but should be.")
a.False(shortcut2, "Shortcut 2 was handled, but shouldn't.")
i.Handle(Key(8), Modifier(2), Press)
a.True(shortcut1, "Shortcut 1 was not handled, but shouldn be.")
a.True(shortcut2, "Shortcut 2 was not handled, but shouldn be.")
a.True(shortcut1, "Shortcut 1 was not handled, but should be.")
a.True(shortcut2, "Shortcut 2 was not handled, but should be.")
}
2 changes: 1 addition & 1 deletion Layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Splitable interface {
Range(func(w Widget))
}

// Range ranges ofer the Layout, calling rangeFunc
// Range ranges over the Layout, calling rangeFunc
// on each loop iteration.
func (l Layout) Range(rangeFunc func(Widget)) {
for _, w := range l {
Expand Down
2 changes: 1 addition & 1 deletion ListClipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
var _ Widget = &ListClipperWrapper{}

// ListClipperWrapper is a ImGuiListClipper implementation.
// it can be used to diplay a large, vertical list of items and
// it can be used to display a large, vertical list of items and
// avoid rendering them.
type ListClipperWrapper struct {
layout Layout
Expand Down
6 changes: 3 additions & 3 deletions MasterWindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"gopkg.in/eapache/queue.v1"
)

// MasterWindowFlags wrapps imgui.GLFWWindowFlags.
// MasterWindowFlags wraps imgui.GLFWWindowFlags.
type MasterWindowFlags imgui.GLFWWindowFlags

// master window flags.
Expand Down Expand Up @@ -294,7 +294,7 @@ func (w *MasterWindow) SetCloseCallback(cb func() bool) {
w.platform.SetCloseCallback(cb)
}

// SetDropCallback sets callback when file was droppend into the window.
// SetDropCallback sets callback when file was dropped into the window.
func (w *MasterWindow) SetDropCallback(cb func([]string)) {
w.platform.SetDropCallback(cb)
}
Expand Down Expand Up @@ -372,7 +372,7 @@ func (w *MasterWindow) SetTitle(title string) {
w.platform.SetTitle(title)
}

// Close will savely close the master window.
// Close will safely close the master window.
func (w *MasterWindow) Close() {
w.SetShouldClose(true)
}
Expand Down
4 changes: 2 additions & 2 deletions MemoryEditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ func MemoryEditor() *MemoryEditorWidget {
}
}

// Contents sets editor's conents.
// Contents sets editor's contents.
func (me *MemoryEditorWidget) Contents(contents []byte) *MemoryEditorWidget {
me.contents = contents
return me
}

// Build implements widget inetrface.
// Build implements widget interface.
func (me *MemoryEditorWidget) Build() {
me.getState().editor.DrawContents(me.contents)
}
Expand Down
2 changes: 1 addition & 1 deletion Msgbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package giu
import "fmt"

// DialogResult represents dialog result
// dialog resullt is bool. if OK/Yes it is true, else (Cancel/No) - false.
// dialog result is bool. if OK/Yes it is true, else (Cancel/No) - false.
type DialogResult bool

// dialog results.
Expand Down
2 changes: 1 addition & 1 deletion Popups.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func Popup(name string) *PopupWidget {
}
}

// Flags sets pupup's flags.
// Flags sets popup's flags.
func (p *PopupWidget) Flags(flags WindowFlags) *PopupWidget {
p.flags = flags
return p
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A rapid cross-platform GUI framework for Go based on [Dear ImGui](https://github
Any contribution (features, widgets, tutorials, documents, etc...) is appreciated!

## Sponsor

(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If you are using giu, please consider reaching out.)

Businesses: support continued development and maintenance via invoiced technical support, maintenance, sponsoring contracts:
Expand Down Expand Up @@ -148,11 +149,12 @@ sudo apt install libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-d
```

on Red Hat based distributions:

```bash
sudo dnf install libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel libGL-devel libXxf86vm-devel
```

you may also need to install C/C++ compiller (like g++) if it isn't already installed. Follow go compilator prompts.
you may also need to install C/C++ compiler (like g++) if it isn't already installed. Follow go compiler prompts.

Then, a simple `go build` will work.

Expand Down Expand Up @@ -185,6 +187,7 @@ go build -ldflags "-s -w -H=windowsgui -extldflags=-static" .
1. Install mingw-64.

on Mac:

```sh
brew install mingw-w64
```
Expand Down
6 changes: 3 additions & 3 deletions SliderWidgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *SliderIntWidget) Label(label string) *SliderIntWidget {
return s
}

// Labelf sets formated label.
// Labelf sets formatted label.
func (s *SliderIntWidget) Labelf(format string, args ...any) *SliderIntWidget {
return s.Label(fmt.Sprintf(format, args...))
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func (vs *VSliderIntWidget) Label(label string) *VSliderIntWidget {
return vs
}

// Labelf sets formated label.
// Labelf sets formatted label.
func (vs *VSliderIntWidget) Labelf(format string, args ...any) *VSliderIntWidget {
return vs.Label(fmt.Sprintf(format, args...))
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func (sf *SliderFloatWidget) Label(label string) *SliderFloatWidget {
return sf
}

// Labelf sets formated label.
// Labelf sets formatted label.
func (sf *SliderFloatWidget) Labelf(format string, args ...any) *SliderFloatWidget {
return sf.Label(fmt.Sprintf(format, args...))
}
Expand Down
4 changes: 2 additions & 2 deletions SplitLayout.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (s *splitLayoutState) Dispose() {
// noop
}

// SplitLayoutWidget creates two childs with a line between them.
// SplitLayoutWidget creates two children with a line between them.
// This line can be moved by the user to adjust child sizes.
type SplitLayoutWidget struct {
id string
Expand All @@ -54,7 +54,7 @@ func SplitLayout(direction SplitDirection, sashPos *float32, layout1, layout2 Wi
}
}

// Border sets if childs should have borders.
// Border sets if children should have borders.
func (s *SplitLayoutWidget) Border(b bool) *SplitLayoutWidget {
s.border = b
return s
Expand Down
4 changes: 2 additions & 2 deletions StackWidget.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func (s *StackWidget) Build() {
visiblePos := GetCursorScreenPos()

// build visible layout
// NOTE: it is important to build the visiblely showed layout before
// building another ones, because the interactive layout widgets
// NOTE: it is important to build the visible layout before
// building other ones, because the interactive layout widgets
// (e.g. buttons) should be rendered on top of `stack`
layouts := s.layouts

Expand Down
Loading

0 comments on commit a5ea4f1

Please sign in to comment.