Re: Transparent Images in LC

2017-04-01 Thread Rick Harrison via use-livecode
Hi Paul,

I just took one of my old transparent .png images that I used 
to use a couple of years ago and imported it as a control into an 
LC 8.1.3 stack.  It worked just fine.

I think I might have created it with “Graphic Converter” for Mac.
If you put one of your images into a “DropBox” account with
a link for me I could take a look at it for you, and see if I can
find anything wrong with it.

Rick


> On Mar 31, 2017, at 9:46 AM, Paul Dupuis via use-livecode 
>  wrote:
> 
> NOTE: I am using LC 6.7.11 for an update to a legacy app.
> 
> I was trying to import (as a control) a transparent PNG (i.e. the
> "white" parts allow whatever is underneath to show through) and instead
> of transparancy, I get the slashed background lines transparent PNG are
> often displayed with. Thinking it might be the PNG itself, I have our
> graphics person create a PNG that was transparent and shows up as
> transparent in other app, it still was not importing with the
> transparent parts transparent in LC.
> 
> Ultimately, I took the same image with the "transparent" parts as actual
> white and used the code below to create a transparency mask
> 
> command makeMask pObj
>  -- pObjs is a reference to an Image object
>  local tMaskData -- set to 0 [tranparent] for each byte in imageData
> that is white
>  get the imageData of pObj -- 4 bytes, 0,r,g,b white = 255, black = 0
>  put the number of bytes in it into X
>  repeat with i=1 to X step 4
>if i > X then exit repeat
>put byte (i+1) of it into r
>put byte (i+2) of it into g
>put byte (i+3) of it into b
>put byteToNum(r) into rV
>put byteToNum(g) into gV
>put byteToNum(b) into bV
>if rV=255 and gV=255 and bV=255 then
>  put numToByte(0) after tMaskData
>else
>  put numToByte(1) after tMaskData
>end if
>  end repeat
>  set the maskData of pObj to tMaskData
> end makeMask
> 
> Am I missing something? Is there a way to actually import an image with
> its transparency or is the only way via script control and scripting is
> the only way has anyone make a plugin tool to do this and if you have
> could you contribute the tool to the community edition and commercial
> versions so a tool to import transparent images becomes part of the main
> LiveCode distribution?
> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

tsNet docs?

2017-04-01 Thread Richard Gaskin via use-livecode
I finally got around to playing with tsNet, but I can't find docs, just 
sparse Dict entries.


I'd like to test uploading a file via SFTP and also FTPS, synchronous 
preferred in this case.


After hunting around via Google I manage to turn up this stack from a 
blog post:



But when I run a modified version of the "SFTP Upload example" button I 
get an error complaining about it being unlicensed.


I'm using Indy, and I believe synchonrous upload vis SFTP is supported 
with Indy, no?


Anyone here have a concise example of synchronous uploading via tsNet?

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Cheesed off by 32xxx

2017-04-01 Thread Scott Rossi via use-livecode
Without knowing exactly what you're trying to accomplish, one way is to display 
only a few rows of buttons beyond what will fit comfortably on a screen, and 
when scrolling takes place, "recycle" the rows around to the end (or beginning) 
with new glyphs applied.

Assuming all the characters are from a single font and you're trying to display 
glyphs in an organized fashion,  a better way might be to display all the 
glyphs in a field with extra column and row spacing to essentially form a grid. 
  This is how I display glyphs from icon fonts, which is more efficient than 
using thousands of controls on a card. 

Regards,

Scott Rossi
Creative Director
Tactile Media UX/UI Design

> On Apr 1, 2017, at 3:07 PM, Richmond Mathewson via use-livecode 
>  wrote:
> 
> What a nuisance:
> 
> There I was, merrily churning through the button titles for my Unicode 
> Reference thing
> [ http://forums.livecode.com/viewtopic.php?f=26=29069 ] which needed at 
> least 1600 buttons
> that were 23 pixels deep layered underneath each other.
> 
> What happens?
> 
> At the "Magic Number" of 32xxx I get a "this is not a number" message.
> 
> As a result I ended up restricted to 1400 buttons.
> 
> This is very bad as the Unicode glyph tables are many, and in an ideal world
> I'd like 8703 buttons. But 8703 * 23 = 200169
> 
> That would involve groupig a "stack" of buttons that was 200169 pixels high.
> 
> Would be grateful if anyone knows a way to circumvent the limitation.
> 
> Richmond.
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Cheesed off by 32xxx

2017-04-01 Thread Alex Tweedly via use-livecode
I'd create maybe 200 buttons, and change their labels, positions and 
meanings whenever the vscroll of the menu changes.


Something (very vaguely) like


on scrollHasChanged

  put the vScroll of grp "sectionMenu"  into temp

  put temp div 23 into startLine

  repeat with i = 1 to 200

put format("B%03i", i) into tName

 set the top of button tName to startLine + 23*i

set the label of button tName to line startLine + i of gAllMyLabels

 

  end repeat

end scrollHasChanged


-- Alex

On 01/04/2017 23:07, Richmond Mathewson via use-livecode wrote:

What a nuisance:

There I was, merrily churning through the button titles for my Unicode 
Reference thing
[ http://forums.livecode.com/viewtopic.php?f=26=29069 ] which needed 
at least 1600 buttons

that were 23 pixels deep layered underneath each other.

What happens?

At the "Magic Number" of 32xxx I get a "this is not a number" message.

As a result I ended up restricted to 1400 buttons.

This is very bad as the Unicode glyph tables are many, and in an ideal 
world

I'd like 8703 buttons. But 8703 * 23 = 200169

That would involve groupig a "stack" of buttons that was 200169 pixels 
high.


Would be grateful if anyone knows a way to circumvent the limitation.

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Cheesed off by 32xxx

2017-04-01 Thread Richmond Mathewson via use-livecode

What a nuisance:

There I was, merrily churning through the button titles for my Unicode 
Reference thing
[ http://forums.livecode.com/viewtopic.php?f=26=29069 ] which needed 
at least 1600 buttons

that were 23 pixels deep layered underneath each other.

What happens?

At the "Magic Number" of 32xxx I get a "this is not a number" message.

As a result I ended up restricted to 1400 buttons.

This is very bad as the Unicode glyph tables are many, and in an ideal world
I'd like 8703 buttons. But 8703 * 23 = 200169

That would involve groupig a "stack" of buttons that was 200169 pixels high.

Would be grateful if anyone knows a way to circumvent the limitation.

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Unicode Reference stack

2017-04-01 Thread Richmond Mathewson via use-livecode

Things just got better!

On 3/31/17 10:11 pm, Richmond Mathewson wrote:

Here: http://forums.livecode.com/viewtopic.php?f=26=29069

Richmond.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


within and scaleFactor

2017-04-01 Thread Dan Friedman via use-livecode
I call this a bug, would you?

If the scaleFactor of stack “myStack” is set to 2, then within(stack 
“myStack”,the screenMouseLoc) only returns true if the mouse is within the rect 
of stack “myStack” when it’s scaleFactor is set to 1.  Hope I explained that 
logically.

Mac 10.12.2, LC 9.0.0 dp 6.   Worked correctly in LC 7.

-Dan

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Line numbers for soft-wrapped styled text?

2017-04-01 Thread Mark Wieder via use-livecode

On 04/01/2017 09:42 AM, hh via use-livecode wrote:


Alex,
please think about posting this. It is certainly valuable for other use
cases.


Agreed, even though I can't use it for my particular case.

(I implemented the brilliant idea of listStyle line numbering in a test 
version of the glx2 script editor yesterday, and it worked for all my 
test cases *except* for code folding, where both the line numbering and 
breakpoint positioning failed. And since I already have a workingline 
numbering system in a separate field, I decided to stick with it at the 
expense of line wrapping. For me, code folding is a must-have, and line 
wrapping is a can-do-without.)


--
 Mark Wieder
 ahsoftw...@gmail.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Line numbers for soft-wrapped styled text?

2017-04-01 Thread hh via use-livecode
> Alex T. wrote:
> I set out to optimise the 'visibleLineNumber' function, and succeeded
> in getting it down to approx 20% of the original version, by:
> - reduce from 2 to 1 height calculations per iteration
> - convert from recursive to iterative
> - use Newton-Raphson style linear interpolation, with tweaks to avoid
> the pathological end cases
> - optimise the start values for finding the last visible line based on
> the effective field height and min allowed text size

Alex,
please think about posting this. It is certainly valuable for other use
cases.

Hermann
(This post is NOT an April 1 - joke)

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Open Stacks / Stacks in Use All Stack Files Appear in Project Browser as open

2017-04-01 Thread Sannyasin Brahmanathaswami via use-livecode
Well, I got my Android test deployment working again, but the app completely 
dies on the phone now and even if I set a break point on the preopencard of the 
init script, it will not fire in the debugger.

I note something peculiar:

If I open myApp.livecode stack: which has stack files set and is the stack we 
build the standalone from… we have a json file that is read on init that 
specifics with stacks should be put into use on initialization.

But, and this is the odd thing: after running a build, I go back to the Project 
Browser or revApplicationOverview

and, now, I see *all* the stacks that are listed in the stack files of the 
mainstack  all appear in the list.

My assumption has always been: if stacks appear in the Project Browser or 
revApplicationOver view, they must be open.

But, from the msg box:

put stacksinuse()  but the message box is now beeping at me… I cannot back 
space and I cannot even enter

put the stacksinuse

if I quit LC and reopen myApp.livecode  then I can use "put thestacksinuse" and 
see the list as expected… project browser also only show those stacks open.

Run the standalone builder…

in the msg box "put the stacksinuse && the openstacks"  and I only see 
myApp.livecode and a few rev stacks

but in the project browser *all* the stacks in my app listed in the stack files 
appear.

I worry that the reason the android standalone if failing is because the SA 
build is in fact cause all those stacks to be loaded on the phone (Nexus 5)… 
all open and in RAM… and, of course it will die because it simply overruns the 
entire memory

What is going on?


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Transparent Images in LC

2017-04-01 Thread Paul Dupuis via use-livecode
NOTE: I am using LC 6.7.11 for an update to a legacy app.

I was trying to import (as a control) a transparent PNG (i.e. the
"white" parts allow whatever is underneath to show through) and instead
of transparancy, I get the slashed background lines transparent PNG are
often displayed with. Thinking it might be the PNG itself, I have our
graphics person create a PNG that was transparent and shows up as
transparent in other app, it still was not importing with the
transparent parts transparent in LC.

Ultimately, I took the same image with the "transparent" parts as actual
white and used the code below to create a transparency mask

command makeMask pObj
  -- pObjs is a reference to an Image object
  local tMaskData -- set to 0 [tranparent] for each byte in imageData
that is white
  get the imageData of pObj -- 4 bytes, 0,r,g,b white = 255, black = 0
  put the number of bytes in it into X
  repeat with i=1 to X step 4
if i > X then exit repeat
put byte (i+1) of it into r
put byte (i+2) of it into g
put byte (i+3) of it into b
put byteToNum(r) into rV
put byteToNum(g) into gV
put byteToNum(b) into bV
if rV=255 and gV=255 and bV=255 then
  put numToByte(0) after tMaskData
else
  put numToByte(1) after tMaskData
end if
  end repeat
  set the maskData of pObj to tMaskData
end makeMask

Am I missing something? Is there a way to actually import an image with
its transparency or is the only way via script control and scripting is
the only way has anyone make a plugin tool to do this and if you have
could you contribute the tool to the community edition and commercial
versions so a tool to import transparent images becomes part of the main
LiveCode distribution?



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Debugging Session Called on Android Build But Not Set

2017-04-01 Thread Sannyasin Brahmanathaswami via use-livecode
--I have unchecked the remoteDebugger in the Standalone builder inclusions list
--There are no break point in any stacks
--Script debug mode is unchecked in the IDE menus

Why does LC prompt me if I want to run remote debugging when I test to Android?

LC9dp5


BR
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Android Build Woes on Mac

2017-04-01 Thread Sannyasin Brahmanathaswami via use-livecode
"Oh duh…"  you were right… I had deleted my settings in an attempt to see if 
some corruption there was causing other issues. For some reason LC finds the 
xCode mobile without going back to the preferences, but not the Android SDK.  
Now working again, thanks

I have it installed in a non-standard location 

/Documents/app-development/android-sdk-macosx

is there a better location that LC will find by default if we delete settings? 
or does one always need to go back to preferences?

 
Panos:

Hi Brahmanathaswami,

This probably means that LC does not find the android SDK. Go to LC
Preferences -> Mobile Support and make sure the path to android SDK is set
and valid.

Best
Panos

---
 BR wrote:

last week things were flowing well in Mac OS X Sierra w LC 9DP5

I could plug in my Nexus 5 via USB, check for Android build in the SB
settings and ti would appear in the menu as a test target and I could
deploy very fast. 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Line numbers for soft-wrapped styled text?

2017-04-01 Thread Alex Tweedly via use-livecode

Conclusion : I give up :-)


We have three 'completed' approaches to the line numbering problem:

1. Jim Lambert's use of decimal-numbered-list style within the field 
(has the limitation of not allowing the user's text to include list 
styles, and some aesthetic constraints - but if you can live with those, 
IMHO it's by far the best solution)


2. Jim's earlier version using a separate text field with only the line 
numbers available. (Still has some aesthetic constraints, and noticeably 
slower than (1) above)


3. My styled text-based version using space-below in a separate field 
(works, no restrictions afaik, but *barely* fast enough for general use 
- and certainly too slow for many uses).


And then we have another, not yet complete, solution - use Hermann's 
script  to find the limits on the line numbers which are visible, and 
then something lik emy 'spacebelow' to set just those lines - so it has 
the potential to be fast enough.


I set out to optimise the 'visibleLineNumber' function, and succeeded in 
getting it down to approx 20% of the original version, by:


 - reduce from 2 to 1 height calculations per iteration

 - convert from recursive to iterative

 - use Newton-Raphson style linear interpolation, with tweaks to avoid 
the pathological end cases


 - optimise the start values for finding the last visible line based on 
the effective field height and min allowed text size


I was just feeling good about that, and getting ready to start on the 
second half - displaying the line numbers for only those visible lines - 
when I got this email from Hermann re. the bug in formattedRect, and the 
need to use formattedHeight of  chunk instead.


formattedHeight of line N to M of fld F   has its own problems - it 
misses out the space needed for the last line if that line happens to be 
empty, and ignores spacebelow - but that can be easily avoided



function getAccurateFormattedHeight pFld, N, M

  put the formattedheight of line N to M of fld pFld into h

  if line M of fld pFld is empty then add the formattedheight of line 
M of fld pFld to h


  add the spacebelow of line M of fld pFld to h

  return h

end getAccurateFormattedHeight



Then I started testing on "hard" fields - and only then did I discover 
the real problem - formattedHeight of a chunk is just too slow. It takes 
50-100 msecs to get such a chunk from a large-ish field (30K lines, 
heavily styled, from the dictionary); so even though the number of 
iterations was down to between 7 and 12, that still represents over a 
second of elapsed time - which is just too long to be feasible.


And now that I have created this test case, it shows that solution no. 3 
above is also too slow.


So, I give up :-)

-- Alex.

On 29/03/2017 11:48, hh via use-livecode wrote:

Alex,
before you waste valuable time:
The formattedRect can NOT be used in LC 7/8/9, because of the
(2^15 div 2)-limit for coordinates is active for that.

So the algorithm works in LC 6.7.11, but the results are sadly
'extremely' wrong in LC 7/8/9:
Crossing the 'limit' with a vertical coordinate jumps to negative
values for these coordinates. No chance to repair.

Using instead the formattedHeight of line 1 to N minus the
vscroll works. But it is not exactly doable if the last line is
empty (this is not added to the formattedHeight) = your space-below
problem -- a bug, TMHO.

I found another "dirty" but fast way to get pixel-exact line
positions for any field in LC 6/7/8/9. One could perhaps use it
until the text measuring problem is solved.

One needs a field that is transparent, is not threeD and has no
border (use instead an opaque rectangle with border as background).
Then set the hgrid to true (this has no visual effect if using as
borderColor the backColor of the graphic behind the field, for
testing I set the borderColor to red).
Now make a snapshot from the field and walk through the maskData
to search all such rows in the image that have a fully opaque
line. This is unique as long as the field has left and right
margins > 0.
This search in the image is *very fast* (< 2 ms), only taking the
snapshot and getting the maskdata needs some time (around 70 ms in
sum for 414x736 pixels).

A script that works here correctly with my tests is attached below.
It needs here in LC 9 about 120 ms for 4000 lines of heavily styled
text from the dictionary in a field of iPhone6 size (414x736).
Please change/improve/optimize it, especially the search part. This
is still the 'simple' binary search.

Hermann

You need a field "TEXT" (transparent etc, see above) and a
template-num-field "n00" (see my settings below as example).
Fields for feedback: "Range", "timing1", "timing2", "info"
= [1] The field's script
on textchanged
  updateNbs2
end textchanged

on scrollbardrag
  updateNbs2
end scrollbardrag
= [2] The numbering script (100 lines)
local nn="lineNumbers",l0,t0,b0,w0,h0,sw0,v0
local rg="TEXT", fw=32 -- num-field width

on updateNbs2
  lock screen; lock messages
  put 

Re: Android Build Woes on Mac

2017-04-01 Thread panagiotis merakos via use-livecode
Hi Brahmanathaswami,

This probably means that LC does not find the android SDK. Go to LC
Preferences -> Mobile Support and make sure the path to android SDK is set
and valid.

Best
Panos

On 1 Apr 2017 06:25, "Sannyasin Brahmanathaswami via use-livecode" <
use-livecode@lists.runrev.com> wrote:

last week thinks were flow well in Mac OS X Sierra w LC 9DP5

I could plug in my Nexus 5 via USB, check for Android build in the SB
settings and ti would appear in the menu as a test target and I could
deploy very fast. in fact that was so much more convenient than iOS builds
that I didn't even both to test on iOS since for the most part if I can get
it working on Android, it always works on my iPhone 6+

But then a few days ago, nothing I can do in LC will make the phone appear
in the menu. at someone' recommendation I cd's into the Android SDK folder
and ran these commands

Brahmanathaswami-3:platform-tools Brahmanathaswami$ ./adb kill-server
* server not running *
Brahmanathaswami-3:platform-tools Brahmanathaswami$ ./adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Brahmanathaswami-3:platform-tools Brahmanathaswami$ ./adb devices
List of devices attached
06d7a4fd439cf2c5  device

so apparently, my Mac and the Android SDK see the device. But Livecode
doesn't

Think perhaps this is just a new LC IDE quirk I went ahead and tried to
build to disk..

LC tries but fails to build the Android Standalone  saying

"There was an error while saving the
standalone applications
could not compile application class."

"OK"

Any clues what is wrong? I don't think I changed anything mission critical
since it was working last week.I'm targetting 4.1 - Jelly Bean

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode