In creating vector drawings, I find it's easiest to design images to hardcoded sizes. This way you can make small (or large) adjustments to the size and location of components efficiently. It's really a lot of trial and error. Once you've created your masterpiece at the base size and you're happy with it, next job is to make it scalable. So if your image is 600x600 you'll want to change all your hardcoded numbers to percentages of 600. So 150 needs changed to 0.2500*size for example. This is beyond tedious working with a calculator and changing the numbers individually. That's where this tool comes in. Select a group of numbers, hit your keyboard shortcut and it all transforms instantly. All you have to do is put the following comment on the very first line of your code: ; 600,size where 600 represents your base size and 'size' is the name of the var you have set to it. Once you've done the conversion your image is now scalable to any size. Anyway the code is simple, here it is for Windows:
Code:
; 640,sz
;///////////////////////////////////////////////////
;
; Size converter IDE external tool
;
; Usage: Compile this code and install as an IDE
; external tool with keyboard shortcut
; activation. (I used CTRL-P)
;
; Place a commented line at the top of your
; source in this format: ; size,var
;
; Example top line: ; 640,sz
;
; select numbers or groups of numbers from
; your code and hit your shortcut
;
; 320,55,19,420 gets instantly changed to:
;
; 0.5000*sz,0.0859*sz,0.0297*sz,0.6563*sz
;
; I actually used the tool for this demo,
; note the comment in the first line
;
; Spaces will get trimmed out, so just modify
; this code if you don't want that.
;
;///////////////////////////////////////////////////
*size = AllocateMemory(34)
HandleIDESci = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
SendMessage_(HandleIDESci, #WM_GETTEXT, 32, *size)
a$ = PeekS(*size)
a$ = Left(a$, FindString(a$, #CR$)-1)
a$ = RemoveString(a$, ";")
a$ = RemoveString(a$," ")
size$ = StringField(a$, 1, ",")
var$ = StringField(a$, 2, ",")
a.d = ValD(size$)
SendMessage_(HandleIDESci, #WM_COPY,0,0)
b$ = GetClipboardText()
j=CountString(b$,",")
For i = 1 To j+1
num.d = ValD(Trim(StringField(b$,i,",")))
num$+StrD(num/a,4)+"*"+var$ :If i<j+1:num$+",":EndIf
Next
SetClipboardText(num$)
SendMessage_(HandleIDESci, #WM_PASTE,0,0)