It is currently Thu Oct 01, 2020 2:28 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Mon May 18, 2020 12:25 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Sep 22, 2009 10:41 pm
Posts: 543
You can note this code line :
Code:
SetClipboardText("%FILE %CURSOR")
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 ! :D


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Mon May 18, 2020 1:14 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 601
Location: Hell
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 ;)

_________________
Link dead?
Change h3x0r.ath.cx into hex0rs.coderbu.de and all will be fine.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Mon May 18, 2020 2:44 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Sep 22, 2009 10:41 pm
Posts: 543
@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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Mon May 18, 2020 4:51 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 601
Location: Hell
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

_________________
Link dead?
Change h3x0r.ath.cx into hex0rs.coderbu.de and all will be fine.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Mon May 18, 2020 7:07 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8143
Location: Fort Nelson, BC, Canada
IDE tool functionality added today. Working on zoom now. (wishing I had srod's head for math)

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Mon May 18, 2020 10:29 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2549
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...


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Mon May 18, 2020 10:30 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8143
Location: Fort Nelson, BC, Canada
Quote:
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?

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Tue May 19, 2020 5:07 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Sep 22, 2009 10:41 pm
Posts: 543
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:
Procedure ZoomNewX(*X.Double, ZoomCenterX.D, ZoomCoefficient.D)

*X\D - ZoomCenterX
*X\D * ZoomCoefficient
*X\D + ZoomCenterX

EndProcedure


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Tue May 19, 2020 6:27 am 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2549
Here are some lines for demonstrating a simple zoom function (mouse wheel only, no problem to add shortcuts and buttons...)

Code:
; 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


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Tue May 19, 2020 5:59 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Jan 05, 2010 10:35 am
Posts: 108
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


Last edited by kernadec on Mon Jun 08, 2020 8:49 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Wed May 20, 2020 2:47 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Sep 22, 2009 10:41 pm
Posts: 543
Small remark : I completely forgot this documentation page.

I apologize their author which made a good help.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 22, 2020 2:34 pm 
Offline
User
User

Joined: Fri Aug 16, 2013 2:52 pm
Posts: 70
netmaestro wrote:
Vector Curve Designer (RAD Tool)


Thank you so much for this awesome tool - comes in handy! :)

_________________
This signature was removed by [removed] for your own safety.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Fri May 22, 2020 10:58 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8143
Location: Fort Nelson, BC, Canada
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.

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Sat May 23, 2020 7:18 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1780
Location: Uttoxeter, UK
@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. :D


Code:
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

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: Vector Curve Designer (RAD Tool)
PostPosted: Sat May 23, 2020 9:57 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8143
Location: Fort Nelson, BC, Canada
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!

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: hrcoder and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye