Scrollable float number label / slider

I am going to start today with a ratio text box that operates like the ratio boxes in e.g. FM8.

The implementation should be something like the normal Slider, except that the amount the value changes per pixel will be only dependent on where the drag 'n' drop started.

How can I implement this in its own project, and then incorporate it in my synth project without copy pasting?

You mean how do you make it reusable?  

I run two separate source code respositories, one for my shared library and one for each project.  

I checkout the shared library into a folder called corelib under each project using git submodule.  

Then I just include the relevant files from corelib into each JUCE project I start. 

There's probably a better way of doing it - but that works well enough for me.