Page 4 of 7
Re: Vector Curve Designer (RAD Tool)
Posted: Mon May 18, 2020 12:25 pm
by Olliv
You can note this code line :
This is specific tl this subject. There are more options available, and I did not make a request to include them...
Note too that my grammar is ever so surprising...
And I did not work a lot for the design...
Apologize !

Re: Vector Curve Designer (RAD Tool)
Posted: Mon May 18, 2020 1:14 pm
by HeX0R
Olliv wrote:Here is the all-in-one 'HowTo' procedure to compile and install a new tool...
You could also use
this and let the tool install itself.
With the help of
this, you don't even need to add the source to it

Re: Vector Curve Designer (RAD Tool)
Posted: Mon May 18, 2020 2:44 pm
by Olliv
@HeXor
Excellent way I understand. It's different when we are beginners...
This does not remove permanent problems, that the installing of a new tool can reserve : in example, there is no map about the shortcuts already used.
Re: Vector Curve Designer (RAD Tool)
Posted: Mon May 18, 2020 4:51 pm
by HeX0R
The include checks the existing shortcuts, and in case the wished shortcut is already in use, it will open a requester and let the user decide.
But that's enough about it, back to topic
Re: Vector Curve Designer (RAD Tool)
Posted: Mon May 18, 2020 7:07 pm
by netmaestro
IDE tool functionality added today. Working on zoom now. (wishing I had srod's head for math)
Re: Vector Curve Designer (RAD Tool)
Posted: Mon May 18, 2020 10:29 pm
by Michael Vogel
netmaestro wrote:IDE tool functionality added today. Working on zoom now. (wishing I had srod's head for math)
Would use translate coordinates, then you won't have to change a lot of things...
Re: Vector Curve Designer (RAD Tool)
Posted: Mon May 18, 2020 10:30 pm
by netmaestro
Would use translate coordinates, then you won't have to change a lot of things...
I don't know that one, could you post a short sample snippet?
Re: Vector Curve Designer (RAD Tool)
Posted: Tue May 19, 2020 5:07 am
by Olliv
NetMaestro wrote:I don't know that one, could you post a short sample snippet?
Maybe a good way consists to you in building the zoom tool, and add a temporary zoom button. I say this because I can imagine three ways to execute a
positive zoom (equ to go to front) :
1) classical : all the points go away from the central point of the draw. Coefficient is fixed.
2) from a point : all the points go away from the a specific point choosen in the draw. Coefficient is fixed
3) from a rectangular form : all the points go away from the central point of a rectangular selection. Coefficient is depending the size of the rectangle.
I do not imagine other zoom types, but I think it exists others types.
Code: Select all
Procedure ZoomNewX(*X.Double, ZoomCenterX.D, ZoomCoefficient.D)
*X\D - ZoomCenterX
*X\D * ZoomCoefficient
*X\D + ZoomCenterX
EndProcedure
Re: Vector Curve Designer (RAD Tool)
Posted: Tue May 19, 2020 6:27 am
by Michael Vogel
Here are some lines for demonstrating a simple zoom function (mouse wheel only, no problem to add shortcuts and buttons...)
Code: Select all
; Define
Enumeration
#Win
#WinCanvas
#WinScrollarea
#KeyZoomIn
#KeyZoomOut
#KeyScrollUp
#KeyScrollDown
#KeyScrollLeft
#KeyScrollRight
EndEnumeration
#WinMinX=320
#WinMinY=200
#WinMaxX=1600
#WinMaxY=1000
#PB_EventType_MouseWheel_Up= 1
#PB_EventType_MouseWheel_Down= -1
Enumeration
#NoShiftAndControl
#ShiftOnly
#ControlOnly
#ShiftAndControl
EndEnumeration
Structure WinType
X.i; Bildgröße
Y.i
SX.i; Canvasgröße
SY.i
ZX.i; Zoomgröße
ZY.i;
Zoom.i;
EndStructure
Global Win.WinType
Macro ShiftKey()
((GetKeyState_(#VK_SHIFT)&128)>>7)
EndMacro
Macro ControlKey()
((GetKeyState_(#VK_CONTROL)&128)>>7)
EndMacro
; EndDefine
Procedure WinTrack()
Debug "-"
With Win
\SY=WindowHeight(#Win)
\SX=WindowWidth(#Win)
\ZX=\SX*\Zoom
\ZY=\SY*\Zoom
ResizeGadget(#WinScrollarea,#PB_Ignore,#PB_Ignore,\SX,\SY)
ResizeGadget(#WinCanvas,#PB_Ignore,#PB_Ignore,\ZX,\ZY)
SetGadgetAttribute(#WinScrollarea,#PB_ScrollArea_InnerWidth,\ZX)
SetGadgetAttribute(#WinScrollarea,#PB_ScrollArea_InnerHeight,\ZY)
EndWith
EndProcedure
Procedure WinDraw()
With Win
StartVectorDrawing(CanvasVectorOutput(#WinCanvas))
VectorSourceColor($ffffffff)
FillVectorOutput()
ScaleCoordinates(\Zoom,\Zoom)
MovePathCursor(50,50)
AddPathLine(350,50)
AddPathLine(250,175)
ClosePath()
VectorSourceColor($ffc0F0F0)
FillPath(#PB_Path_Preserve)
VectorSourceColor($ff802020)
StrokePath(3)
StopVectorDrawing()
EndWith
EndProcedure
With Win
\SX=400
\SY=200
\Zoom=1
\ZX=400
\ZY=200
OpenWindow(#Win,16,10,\SX,\SY,"",#PB_Window_SizeGadget|#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ScrollAreaGadget(#WinScrollarea,0,0,\SX,\SY,\SX,\SY,1,#PB_ScrollArea_Flat)
CanvasGadget(#WinCanvas,0,0,\SX,\SY,#PB_Canvas_Keyboard)
WindowBounds(#Win,#WinMinX,#WinMinY,#WinMaxX,#WinMaxY)
BindEvent(#PB_Event_SizeWindow,@WinTrack())
WinDraw()
SetActiveGadget(#WinCanvas)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget,#PB_Event_Menu
Select EventGadget()
Case #WinCanvas
Select EventType()
Case #PB_EventType_MouseMove
Case #PB_EventType_MouseEnter
;
Case #PB_EventType_MouseLeave
;
Case #PB_EventType_LeftClick
;
Case #PB_EventType_RightClick
;
Case #PB_EventType_MouseWheel
Select GetGadgetAttribute(#WinCanvas,#PB_Canvas_WheelDelta)
Case #PB_EventType_MouseWheel_Down
Select ShiftKey()+ControlKey()<<1
Case #NoShiftAndControl
PostEvent(#PB_Event_Gadget,#Win,#KeyZoomOut)
Case #ShiftOnly
PostEvent(#PB_Event_Gadget,#Win,#KeyScrollLeft)
Case #ControlOnly
PostEvent(#PB_Event_Gadget,#Win,#KeyScrollDown)
Case #ShiftAndControl
;
EndSelect
;
Case #PB_EventType_MouseWheel_Up
Select ShiftKey()+ControlKey()<<1
Case #NoShiftAndControl
PostEvent(#PB_Event_Gadget,#Win,#KeyZoomIn)
Case #ShiftOnly
PostEvent(#PB_Event_Gadget,#Win,#KeyScrollRight)
Case #ControlOnly
PostEvent(#PB_Event_Gadget,#Win,#KeyScrollUp)
Case #ShiftAndControl
;
EndSelect
EndSelect
EndSelect
Case #KeyZoomIn
If Win\Zoom<10
Win\Zoom+1
WinTrack()
WinDraw()
EndIf
Case #KeyZoomOut
If Win\Zoom>1
Win\Zoom-1
WinTrack()
WinDraw()
EndIf
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndWith
Re: Vector Curve Designer (RAD Tool)
Posted: Tue May 19, 2020 5:59 pm
by kernadec
Hello netmaestro & Michael Vogel
Thank you for sharing
to zoom any 4 point figure can be this idea
as a solution with this geometric method.
Cordialement
https://jmp.sh/URILrLk
Re: Vector Curve Designer (RAD Tool)
Posted: Wed May 20, 2020 2:47 pm
by Olliv
Small remark : I completely forgot this
documentation page.
I apologize their author which made a good help.
Posted: Fri May 22, 2020 2:34 pm
by Karellen
netmaestro wrote:Vector Curve Designer (RAD Tool)
Thank you so much for this awesome tool - comes in handy!

Re: Vector Curve Designer (RAD Tool)
Posted: Fri May 22, 2020 10:58 pm
by netmaestro
Zoom feature is implemented today for doing tiny work, this is enough features for now so if no serious bugs are reported in a few days the project will be at beta 1.0. Code in first post is updated to most recent.
For those interested in this project, if you find any bugs please report them so we can have a solid tool when it's done.
Re: Vector Curve Designer (RAD Tool)
Posted: Sat May 23, 2020 7:18 pm
by davido
@
netmaestro,
I note that you designed this tool for PCs.
It has now stopped working on Macs due to the code appended below.
If I remove this code it appears to work for me.
I find this incredible program so useful that I am happy to loose some functionality to be able to use it.
I have always found creating curves, except circles and eclipses, in Vector Graphics to be nigh on impossible.
Your code makes it
so simple! Thank you.
Code: Select all
Procedure InsertHandler()
scintilla.i = Val(GetEnvironmentVariable("PB_Tool_Scintilla"))
If scintilla
*textBuffer = MakeScintillaText(#CRLF$+"; Code inserted by Vector Curve Designer" +
#CRLF$+GetGadgetText(gadget_output)+#CRLF$ +
"; End of Curve Designer Code"+#CRLF$)
SendMessage_(scintilla, #EM_REPLACESEL, 0, *textBuffer)
Else
MessageRequester("Notice:","Scintilla editor not found!"+#CRLF$+#CRLF$ +
"Invoke Curve Designer tool from the PureBasic IDE for this feature.")
EndIf
EndProcedure
Re: Vector Curve Designer (RAD Tool)
Posted: Sat May 23, 2020 9:57 pm
by netmaestro
I didn't even notice I was breaking cross-platform with that, but there it is right there, an API call. I've surrounded all relevant code parts with CompilerIf directives so the button and procedure only show on Windows for now but I'll ask if anyone can show how to do it on Mac and Linux so all can have the functionality. Thanks for the heads-up!