增加打包图形化配置 v1.0.0

This commit is contained in:
杨红岩 2023-02-11 23:49:21 +08:00
parent 8584910fc4
commit 999e3245de
9 changed files with 22 additions and 55 deletions

View File

@ -21,10 +21,9 @@ func (m *IDEForm) CreateButton() *IDEButton {
com.Component.SetOnMouseDown(com.IDEComponent.mouseDown)
com.Component.SetOnMouseUp(com.IDEComponent.mouseUp)
com.component = com.Component
com.componentType = ctButton
m.addComponent(com.IDEComponent)
com.name = fmt.Sprintf("Button%d", com.Id)
com.componentType = ctButton
com.Component.SetCaption(com.name)
com.createAfter()
return com
}

View File

@ -57,12 +57,6 @@ func (m *IDEComponent) mouseMove(sender lcl.IObject, shift types.TShiftState, x,
if tmpWidth <= minW || tmpHeight <= minH {
return
}
//m.borderPanel.SetTop(tmpY - border/2)
//m.componentParentPanel.SetTop(tmpY)
//m.borderPanel.SetHeight(tmpHeight + border)
//m.componentParentPanel.SetHeight(tmpHeight)
//m.borderPanel.SetWidth(tmpWidth + border)
//m.componentParentPanel.SetWidth(tmpWidth)
m.borderPanel.SetBounds(borderRect.Left, tmpY-border/2, tmpWidth+border, tmpHeight+border)
m.componentParentPanel.SetBounds(componentParentRect.Left, tmpY, tmpWidth, tmpHeight)
case HTBOTTOMRIGHT:
@ -71,10 +65,6 @@ func (m *IDEComponent) mouseMove(sender lcl.IObject, shift types.TShiftState, x,
if tmpWidth <= minW || tmpHeight <= minH {
return
}
//m.borderPanel.SetWidth(tmpWidth + border)
//m.componentParentPanel.SetWidth(tmpWidth)
//m.borderPanel.SetHeight(tmpHeight + border)
//m.componentParentPanel.SetHeight(tmpHeight)
m.borderPanel.SetBounds(borderRect.Left, borderRect.Top, tmpWidth+border, tmpHeight+border)
m.componentParentPanel.SetBounds(componentParentRect.Left, componentParentRect.Top, tmpWidth, tmpHeight)
case HTTOPLEFT:
@ -85,14 +75,6 @@ func (m *IDEComponent) mouseMove(sender lcl.IObject, shift types.TShiftState, x,
if tmpWidth <= minW || tmpHeight <= minH {
return
}
//m.borderPanel.SetLeft(tmpX - border/2)
//m.borderPanel.SetWidth(tmpWidth + border)
//m.componentParentPanel.SetLeft(tmpX)
//m.componentParentPanel.SetWidth(tmpWidth)
//m.borderPanel.SetTop(tmpY - border/2)
//m.borderPanel.SetHeight(tmpHeight + border)
//m.componentParentPanel.SetTop(tmpY)
//m.componentParentPanel.SetHeight(tmpHeight)
m.borderPanel.SetBounds(tmpX-border/2, tmpY-border/2, tmpWidth+border, tmpHeight+border)
m.componentParentPanel.SetBounds(tmpX, tmpY, tmpWidth, tmpHeight)
case HTBOTTOMLEFT:
@ -102,9 +84,6 @@ func (m *IDEComponent) mouseMove(sender lcl.IObject, shift types.TShiftState, x,
if tmpWidth <= minW || tmpHeight <= minH {
return
}
//m.borderPanel.SetLeft(tmpX - border/2)
//m.borderPanel.SetWidth(tmpWidth + border)
//m.borderPanel.SetHeight(tmpHeight + border)
m.componentParentPanel.SetLeft(tmpX)
m.componentParentPanel.SetWidth(tmpWidth)
m.componentParentPanel.SetHeight(tmpHeight)
@ -112,27 +91,14 @@ func (m *IDEComponent) mouseMove(sender lcl.IObject, shift types.TShiftState, x,
m.borderPanel.SetBounds(tmpX-border/2, borderRect.Top, tmpWidth+border, tmpHeight+border)
m.componentParentPanel.SetBounds(tmpX, componentParentRect.Top, tmpWidth, tmpHeight)
}
//rect := m.componentParentPanel.BoundsRect()
//fx, fy, fw, fh = rect.Left, rect.Top, rect.Width(), rect.Height()
//Ide.formsSyncSize(m.Id)
//m.refreshAnchorsPoint()
return
} else if m.isComponentArea && m.componentType != ctForm { // mouse down component area > move
m.isDClick = false
tmpY := componentParentRect.Top + (y - m.dy)
tmpX := componentParentRect.Left + (x - m.dx)
//m.borderPanel.SetLeft(tmpX - border/2)
//m.borderPanel.SetTop(tmpY - border/2)
//m.componentParentPanel.SetTop(tmpY)
//m.componentParentPanel.SetLeft(tmpX)
m.borderPanel.SetBounds(tmpX-border/2, tmpY-border/2, borderRect.Width(), borderRect.Height())
m.componentParentPanel.SetBounds(tmpX, tmpY, componentParentRect.Width(), componentParentRect.Height())
//rect := m.componentParentPanel.BoundsRect()
//fx, fy, fw, fh = rect.Left, rect.Top, rect.Width(), rect.Height()
//Ide.formsSyncSize(m.Id)
//m.refreshAnchorsPoint()
return
}
}

View File

@ -21,11 +21,9 @@ func (m *IDEForm) CreateEdit() *IDEEdit {
com.Component.SetOnMouseDown(com.IDEComponent.mouseDown)
com.Component.SetOnMouseUp(com.IDEComponent.mouseUp)
com.component = com.Component
m.addComponent(com.IDEComponent)
com.componentType = ctLabel
m.addComponent(com.IDEComponent)
com.name = fmt.Sprintf("Edit%d", com.Id)
com.componentParentPanel.SetCaption(com.name)
//com.createAnchor(m.componentParentPanel)
com.createAfter()
return com
}

View File

@ -21,10 +21,9 @@ func (m *IDEForm) CreateImage() *IDEImage {
com.Component.SetOnMouseDown(com.IDEComponent.mouseDown)
com.Component.SetOnMouseUp(com.IDEComponent.mouseUp)
com.component = com.Component
com.componentType = ctImage
m.addComponent(com.IDEComponent)
com.name = fmt.Sprintf("Image%d", com.Id)
com.componentType = ctImage
com.createAfter()
//com.createAnchor(m.componentParentPanel)
return com
}

View File

@ -13,7 +13,7 @@ type IDELabel struct {
func (m *IDEForm) CreateLabel() *IDELabel {
com := &IDELabel{}
com.IDEComponent = m.newIDEComponentContainer(true, 50, 50, 170, 50)
com.IDEComponent = m.newIDEComponentContainer(false, 50, 50, 100, 24)
com.Component = lcl.NewLabel(com.IDEComponent.componentParentPanel)
com.Component.SetParent(com.IDEComponent.componentParentPanel)
com.Component.SetAlign(types.AlClient)
@ -21,10 +21,10 @@ func (m *IDEForm) CreateLabel() *IDELabel {
com.Component.SetOnMouseDown(com.IDEComponent.mouseDown)
com.Component.SetOnMouseUp(com.IDEComponent.mouseUp)
com.component = com.Component
m.addComponent(com.IDEComponent)
com.componentType = ctLabel
m.addComponent(com.IDEComponent)
com.name = fmt.Sprintf("Label%d", com.Id)
com.createAfter()
//com.createAnchor(m.componentParentPanel)
com.isResize = false
return com
}

View File

@ -3,24 +3,27 @@ package ide
import (
"fmt"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/types"
)
type IDEOpenDialog struct {
*IDEComponent
openDialog *lcl.TOpenDialog
Component *lcl.TOpenDialog
Component *lcl.TImage
}
func (m *IDEForm) CreateDialogOpen() *IDEOpenDialog {
com := &IDEOpenDialog{}
com.IDEComponent = m.newIDEComponentContainer(true, 50, 50, 28, 28)
com.Component = lcl.NewOpenDialog(com.IDEComponent.componentParentPanel)
com.Component = lcl.NewImage(com.IDEComponent.componentParentPanel)
com.Component.SetParent(com.IDEComponent.componentParentPanel)
com.Component.SetAlign(types.AlClient)
com.Component.SetOnMouseMove(com.IDEComponent.mouseMove)
com.Component.SetOnMouseDown(com.IDEComponent.mouseDown)
com.Component.SetOnMouseUp(com.IDEComponent.mouseUp)
com.component = com.Component
m.addComponent(com.IDEComponent)
com.componentType = ctOpenDialog
m.addComponent(com.IDEComponent)
com.name = fmt.Sprintf("DialogOpen%d", com.Id)
com.componentParentPanel.SetCaption(com.name)
//com.createAnchor(m.componentParentPanel)
com.createAfter()
return com
}

View File

@ -20,6 +20,7 @@ type IDEComponent struct {
componentType componentType
isBorder, isDown, isComponentArea bool
isDClick bool
isResize bool
clickTime time.Time
borderHT int32
ox, oy, ow, oh int32
@ -105,7 +106,7 @@ func (m *IDEComponent) newAnchorPoint(owner lcl.IWinControl, ht int32) *lcl.TPan
point.SetCursor(types.CrDefault)
}
//m.mouseMove(sender, shift, x, y)
if m.isDown {
if m.isDown && m.isResize {
var (
x, y = x - m.anchor.dx, y - m.anchor.dy
rect = m.componentParentPanel.BoundsRect()

View File

@ -42,6 +42,7 @@ func (m *IDEForm) componentFrees(control lcl.IComponent) {
func (m *IDEForm) newIDEComponentContainer(useBorder bool, left, top, width, height int32) *IDEComponent {
ideComponent := &IDEComponent{}
ideComponent.isResize = true
ideComponent.borderPanel = lcl.NewPanel(m.componentParentPanel)
ideComponent.borderPanel.SetParent(m.componentParentPanel)
ideComponent.borderPanel.SetDoubleBuffered(true)

View File

@ -26,7 +26,7 @@ const (
borderRange int32 = 8
borderMargin = 4
border = borderMargin / 2
pointW = 10
pointW = 6
pointWC = pointW / 2
minW, minH = 24, 8
)
@ -202,10 +202,10 @@ func (m *IDE) initTopMainMenu() {
action.SetOnExecute(func(sender lcl.IObject) {
form := m.CreateForm()
//form.CreateDialogOpen()
form.CreateEdit()
//form.CreateEdit()
form.CreateImage()
form.CreateLabel()
form.CreateButton()
//form.CreateLabel()
//form.CreateButton()
})
m.topToolButton = lcl.NewToolButton(m)