Code: Select all
SetClipboardText("%FILE %CURSOR")
Note too that my grammar is ever so surprising...
And I did not work a lot for the design...
Apologize !
Code: Select all
SetClipboardText("%FILE %CURSOR")
You could also use this and let the tool install itself.Olliv wrote:Here is the all-in-one 'HowTo' procedure to compile and install a new tool...
Would use translate coordinates, then you won't have to change a lot of things...netmaestro wrote:IDE tool functionality added today. Working on zoom now. (wishing I had srod's head for math)
I don't know that one, could you post a short sample snippet?Would use translate coordinates, then you won't have to change a lot of things...
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) :NetMaestro wrote:I don't know that one, could you post a short sample snippet?
Code: Select all
Procedure ZoomNewX(*X.Double, ZoomCenterX.D, ZoomCoefficient.D)
*X\D - ZoomCenterX
*X\D * ZoomCoefficient
*X\D + ZoomCenterX
EndProcedure
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
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