Skip to content

Commit

Permalink
update widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkwork committed Jun 28, 2024
1 parent 3d321b0 commit 8bdcd10
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
3 changes: 2 additions & 1 deletion libhyperdbg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"github.com/stretchr/testify/assert"
)

// go test -run ^\QTestSdk\E$
func TestSdk(t *testing.T) {
t.Skip("github ci windows not support vt-x nested virtualization")
// t.Skip("github ci windows not support vt-x nested virtualization")
mylog.Call(func() {
assert.True(t, VmxSupportDetection())
mylog.Trace("InstallVmmDriver", InstallVmmDriver())
Expand Down
57 changes: 43 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package main

import (
"time"

"github.com/ddkwork/golibrary/mylog"

"github.com/ddkwork/app"
"github.com/ddkwork/app/widget"
"github.com/richardwilkes/unison"
"github.com/richardwilkes/unison/enums/align"
"github.com/richardwilkes/unison/enums/side"
)

func main() {
Expand Down Expand Up @@ -34,23 +39,47 @@ func testLayoutCpu() {
toolBar := widget.NewToolBar(t.Elems()...)
content.AddChild(toolBar)

//dock := unison.NewDock()
//dock.AsPanel().SetLayoutData(&unison.FlexLayoutData{
// HSpan: 1,
// VSpan: 1,
// HAlign: align.Fill,
// VAlign: align.Fill,
// HGrab: true,
// VGrab: true,
//})

fileName := "hyperdbg-cli.exe"
asm := LayoutDisassemblyTable(fileName)
leftTab := widget.NewTab("cpu with fast call", "todo fast call layout", true, asm)
//content.AddChild(leftTab)
//return

mylog.Todo("NewTab has some bug")

left := widget.NewTab("cpu with fast call", "todo fast call layout", true, asm)
right := widget.NewTab("reg", "todo reg", true, widget.NewButton("todo reg"))

dock := unison.NewDock()
dock.AsPanel().SetLayoutData(&unison.FlexLayoutData{
HSpan: 1,
VSpan: 1,
HAlign: align.Fill,
VAlign: align.Fill,
HGrab: true,
VGrab: true,
})
display := unison.PrimaryDisplay()
r := display.Usable.Size
pos := float32(0)

dock.DockTo(left, nil, side.Left)
// LeftContainer := widget.NewDockContainer(left)
LeftContainer := unison.Ancestor[*unison.DockContainer](left)
dock.DockTo(right, LeftContainer, side.Right)
RightContainer := widget.NewDockContainer(right)
scale := float32(0.3)
pos = (r.Width/(display.ScaleX*1000)/2 + scale) * 1000
RightContainer.Stack(right, -1)
dock.RootDockLayout().SetDividerPosition(pos)
unison.InvokeTaskAfter(func() { dock.RootDockLayout().SetDividerPosition(pos) }, time.Millisecond)

LeftContainer.SetCurrentDockable(left) // left not work
RightContainer.SetCurrentDockable(right) // right not work
content.AddChild(dock)

return
// content.AddChild(left)
// return
TopHSplit := widget.NewHSplit(
leftTab,
left,
widget.NewTab("reg", "todo reg", true, widget.NewButton("todo reg")),
0.3)
// content.AddChild(asm)
Expand Down
4 changes: 2 additions & 2 deletions ux.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func Run() {
switch filepath.Ext(files[0]) {
case ".exe", ".dll", ".sys":
mylog.Trace("dropped file", files[0])
pages.pe.SetContent(LayoutPeView(files[0])) // right action is remove all children
pages.cpu.SetContent(LayoutCpu(files[0])) // todo test parent panel is dock or cpu tab page
// pages.pe.SetContent(LayoutPeView(files[0])) // right action is remove all children
// pages.cpu.SetContent(LayoutCpu(files[0])) // todo test parent panel is dock or cpu tab page
default:
mylog.Check("not support file type")
}
Expand Down

0 comments on commit 8bdcd10

Please sign in to comment.