QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: wutz on June 29, 2019, 06:12:57 pm

Title: select code
Post by: wutz on June 29, 2019, 06:12:57 pm
When I click on the 'select code' on a discussion page, then paste into my open QB64 V1.3 editor, I get the line numbers displayed in the code box and extra lines between every QB statement.  It did not used to work like this.  Do I have a some setting wrong.  I'm on Win10, but still using Internet Explorer 11 if that makes a difference.

Thanks
Title: Re: select code
Post by: TempodiBasic on June 29, 2019, 06:28:38 pm
Hi wutz
if you don't want to see number of line at left of code you can use this
View-->LineNumbers-->Hide line number

like in this screenshot
  [ This attachment cannot be displayed inline in 'Print Page' view ]  

if you have done all well, you will not see the numbers of line at left of code now.

Title: Re: select code
Post by: bplus on June 29, 2019, 08:15:34 pm
When I click on the 'select code' on a discussion page, then paste into my open QB64 V1.3 editor, I get the line numbers displayed in the code box and extra lines between every QB statement.  It did not used to work like this.  Do I have a some setting wrong.  I'm on Win10, but still using Internet Explorer 11 if that makes a difference.

Thanks

Yes, browser makes a difference. I remember having that problem and had to run code through a filter, I posted code at FreeBasic Forum some years ago.

Found it!
https://www.freebasic.net/forum/viewtopic.php?f=7&t=25785&p=234002#p234002
Title: Re: select code
Post by: FellippeHeitor on June 29, 2019, 09:29:07 pm
Quote
but still using Internet Explorer 11 if that makes a difference.

That’s it.
Title: Re: select code
Post by: TempodiBasic on June 30, 2019, 08:41:47 am
Using Microsoft Edge on this link
/forum/index_topic_14864-0/]http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index_topic_14864-0/ (http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there) I got "à" for each tab character used for identation of code in QB64 1.3 but as you can see pasting the select code in this Reply box in Opera doesn't reply the issue!

Code: QB64: [Select]
  1. DIM SHARED xspacing, w, theta, amplitude, period, dx
  2. xspacing = 16
  3. theta = 0.0
  4. amplitude = 75.0
  5. period = 500.0
  6.  
  7.     y AS SINGLE
  8.     a AS SINGLE
  9.  
  10. SCREEN _NEWIMAGE(710, 400, 32)
  11. w = _WIDTH + 8
  12. dx = (_PI(2) / period) * xspacing
  13. DIM SHARED yvalues(INT(w / xspacing)) AS t
  14.  
  15. FOR i = 1 TO UBOUND(yvalues)
  16.     yvalues(i).a = yvalues(i - 1).a + 1
  17.  
  18.     CLS
  19.     calcWave
  20.     renderWave
  21.     _DISPLAY
  22.     _LIMIT 60
  23.  
  24. SUB calcWave
  25.     'http:// Increment theta (try different values for
  26.     'http:// 'angular velocity' here)
  27.     theta = theta + 0.02
  28.  
  29.     'http:// For every x value, calculate a y value with sine function
  30.     x = theta
  31.     FOR i = 0 TO UBOUND(yvalues)
  32.         yvalues(i).y = _HEIGHT / 2 + SIN(x) * amplitude
  33.         yvalues(i).a = yvalues(i).a + .1
  34.         x = x + dx
  35.     NEXT
  36.  
  37. SUB renderWave
  38.     'http:// A simple way to draw the wave with an ellipse at each location
  39.     FOR x = 0 TO UBOUND(yvalues)
  40.         c~& = hsb(yvalues(x).a MOD 360, 127, 127, 127)
  41.         CircleFill x * xspacing, height / 2 + yvalues(x).y, 50, c~&
  42.     NEXT
  43.  
  44. FUNCTION hsb~& (__H AS _FLOAT, __S AS _FLOAT, __B AS _FLOAT, A AS _FLOAT)
  45.     DIM H AS _FLOAT, S AS _FLOAT, B AS _FLOAT
  46.  
  47.     H = map(__H, 0, 255, 0, 360)
  48.     S = map(__S, 0, 255, 0, 1)
  49.     B = map(__B, 0, 255, 0, 1)
  50.  
  51.     IF S = 0 THEN
  52.         hsb~& = _RGBA32(B * 255, B * 255, B * 255, A)
  53.         EXIT FUNCTION
  54.     END IF
  55.  
  56.     DIM fmx AS _FLOAT, fmn AS _FLOAT
  57.     DIM fmd AS _FLOAT, iSextant AS INTEGER
  58.     DIM imx AS INTEGER, imd AS INTEGER, imn AS INTEGER
  59.  
  60.     IF B > .5 THEN
  61.         fmx = B - (B * S) + S
  62.         fmn = B + (B * S) - S
  63.     ELSE
  64.         fmx = B + (B * S)
  65.         fmn = B - (B * S)
  66.     END IF
  67.  
  68.     iSextant = INT(H / 60)
  69.  
  70.     IF H >= 300 THEN
  71.         H = H - 360
  72.     END IF
  73.  
  74.     H = H / 60
  75.     H = H - (2 * INT(((iSextant + 1) MOD 6) / 2))
  76.  
  77.     IF iSextant MOD 2 = 0 THEN
  78.         fmd = (H * (fmx - fmn)) + fmn
  79.     ELSE
  80.         fmd = fmn - (H * (fmx - fmn))
  81.     END IF
  82.  
  83.     imx = _ROUND(fmx * 255)
  84.     imd = _ROUND(fmd * 255)
  85.     imn = _ROUND(fmn * 255)
  86.  
  87.     SELECT CASE INT(iSextant)
  88.         CASE 1
  89.             hsb~& = _RGBA32(imd, imx, imn, A)
  90.         CASE 2
  91.             hsb~& = _RGBA32(imn, imx, imd, A)
  92.         CASE 3
  93.             hsb~& = _RGBA32(imn, imd, imx, A)
  94.         CASE 4
  95.             hsb~& = _RGBA32(imd, imn, imx, A)
  96.         CASE 5
  97.             hsb~& = _RGBA32(imx, imn, imd, A)
  98.         CASE ELSE
  99.             hsb~& = _RGBA32(imx, imd, imn, A)
  100.     END SELECT
  101.  
  102.  
  103. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
  104.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
  105.  
  106. SUB CircleFill (x AS LONG, y AS LONG, R AS LONG, C AS _UNSIGNED LONG)
  107.     x0 = R
  108.     y0 = 0
  109.     e = 0
  110.     DO WHILE y0 < x0
  111.         IF e <= 0 THEN
  112.             y0 = y0 + 1
  113.             LINE (x - x0, y + y0)-(x + x0, y + y0), C, BF
  114.             LINE (x - x0, y - y0)-(x + x0, y - y0), C, BF
  115.             e = e + 2 * y0
  116.         ELSE
  117.             LINE (x - y0, y - x0)-(x + y0, y - x0), C, BF
  118.             LINE (x - y0, y + x0)-(x + y0, y + x0), C, BF
  119.             x0 = x0 - 1
  120.             e = e - 2 * x0
  121.         END IF
  122.     LOOP
  123.     LINE (x - R, y)-(x + R, y), C, BF

PS This is the first time I do this...
open my QB64.org from Opera and while it is opened I can access and reply from Edge.  :-) It is ok with the free politic of managment of resources.

This reply comes from Opera

Title: Re: select code
Post by: TempodiBasic on June 30, 2019, 08:42:55 am
and this second reply comes from Edge, as you can see pasting in two different browser there is no issue about tab identation.
Code: QB64: [Select]
  1. DIM SHARED xspacing, w, theta, amplitude, period, dx
  2. xspacing = 16
  3. theta = 0.0
  4. amplitude = 75.0
  5. period = 500.0
  6.  
  7.     y AS SINGLE
  8.     a AS SINGLE
  9.  
  10. SCREEN _NEWIMAGE(710, 400, 32)
  11. w = _WIDTH + 8
  12. dx = (_PI(2) / period) * xspacing
  13. DIM SHARED yvalues(INT(w / xspacing)) AS t
  14.  
  15. FOR i = 1 TO UBOUND(yvalues)
  16.     yvalues(i).a = yvalues(i - 1).a + 1
  17.  
  18.     CLS
  19.     calcWave
  20.     renderWave
  21.     _DISPLAY
  22.     _LIMIT 60
  23.  
  24. SUB calcWave
  25.     'http:// Increment theta (try different values for
  26.     'http:// 'angular velocity' here)
  27.     theta = theta + 0.02
  28.  
  29.     'http:// For every x value, calculate a y value with sine function
  30.     x = theta
  31.     FOR i = 0 TO UBOUND(yvalues)
  32.         yvalues(i).y = _HEIGHT / 2 + SIN(x) * amplitude
  33.         yvalues(i).a = yvalues(i).a + .1
  34.         x = x + dx
  35.     NEXT
  36.  
  37. SUB renderWave
  38.     'http:// A simple way to draw the wave with an ellipse at each location
  39.     FOR x = 0 TO UBOUND(yvalues)
  40.         c~& = hsb(yvalues(x).a MOD 360, 127, 127, 127)
  41.         CircleFill x * xspacing, height / 2 + yvalues(x).y, 50, c~&
  42.     NEXT
  43.  
  44. FUNCTION hsb~& (__H AS _FLOAT, __S AS _FLOAT, __B AS _FLOAT, A AS _FLOAT)
  45.     DIM H AS _FLOAT, S AS _FLOAT, B AS _FLOAT
  46.  
  47.     H = map(__H, 0, 255, 0, 360)
  48.     S = map(__S, 0, 255, 0, 1)
  49.     B = map(__B, 0, 255, 0, 1)
  50.  
  51.     IF S = 0 THEN
  52.         hsb~& = _RGBA32(B * 255, B * 255, B * 255, A)
  53.         EXIT FUNCTION
  54.     END IF
  55.  
  56.     DIM fmx AS _FLOAT, fmn AS _FLOAT
  57.     DIM fmd AS _FLOAT, iSextant AS INTEGER
  58.     DIM imx AS INTEGER, imd AS INTEGER, imn AS INTEGER
  59.  
  60.     IF B > .5 THEN
  61.         fmx = B - (B * S) + S
  62.         fmn = B + (B * S) - S
  63.     ELSE
  64.         fmx = B + (B * S)
  65.         fmn = B - (B * S)
  66.     END IF
  67.  
  68.     iSextant = INT(H / 60)
  69.  
  70.     IF H >= 300 THEN
  71.         H = H - 360
  72.     END IF
  73.  
  74.     H = H / 60
  75.     H = H - (2 * INT(((iSextant + 1) MOD 6) / 2))
  76.  
  77.     IF iSextant MOD 2 = 0 THEN
  78.         fmd = (H * (fmx - fmn)) + fmn
  79.     ELSE
  80.         fmd = fmn - (H * (fmx - fmn))
  81.     END IF
  82.  
  83.     imx = _ROUND(fmx * 255)
  84.     imd = _ROUND(fmd * 255)
  85.     imn = _ROUND(fmn * 255)
  86.  
  87.     SELECT CASE INT(iSextant)
  88.         CASE 1
  89.             hsb~& = _RGBA32(imd, imx, imn, A)
  90.         CASE 2
  91.             hsb~& = _RGBA32(imn, imx, imd, A)
  92.         CASE 3
  93.             hsb~& = _RGBA32(imn, imd, imx, A)
  94.         CASE 4
  95.             hsb~& = _RGBA32(imd, imn, imx, A)
  96.         CASE 5
  97.             hsb~& = _RGBA32(imx, imn, imd, A)
  98.         CASE ELSE
  99.             hsb~& = _RGBA32(imx, imd, imn, A)
  100.     END SELECT
  101.  
  102.  
  103. FUNCTION map! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!)
  104.     map! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange!
  105.  
  106. SUB CircleFill (x AS LONG, y AS LONG, R AS LONG, C AS _UNSIGNED LONG)
  107.     x0 = R
  108.     y0 = 0
  109.     e = 0
  110.     DO WHILE y0 < x0
  111.         IF e <= 0 THEN
  112.             y0 = y0 + 1
  113.             LINE (x - x0, y + y0)-(x + x0, y + y0), C, BF
  114.             LINE (x - x0, y - y0)-(x + x0, y - y0), C, BF
  115.             e = e + 2 * y0
  116.         ELSE
  117.             LINE (x - y0, y - x0)-(x + y0, y - x0), C, BF
  118.             LINE (x - y0, y + x0)-(x + y0, y + x0), C, BF
  119.             x0 = x0 - 1
  120.             e = e - 2 * x0
  121.         END IF
  122.     LOOP
  123.     LINE (x - R, y)-(x + R, y), C, BF
Title: Re: select code
Post by: TempodiBasic on June 30, 2019, 08:54:34 am
so this is your issue
  [ This attachment cannot be displayed inline in 'Print Page' view ]  

sorry this is my overlapped issue
  [ This attachment cannot be displayed inline in 'Print Page' view ]  

However I solve using Opera, but you can safely use other browsers like Mozilla Firefox, Chrome, Safary etc etc etc
Title: Re: select code
Post by: wutz on June 30, 2019, 09:16:05 am
Thanks to all for your feedback.
I suspected something like Explorer 11 was the problem - guess I'll load Chrome or something as I tried Edge when I went to Win10, but just didn't like it.
Thanks, again.