Cannot make SE colorization stick

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Cannot make SE colorization stick

Post by dunbarx » Thu Jan 25, 2018 11:45 pm

Hi.

I opened the script of stack "revnewScriptEditor" and found the handler:

"seColorizationLoadScheme"

I change the RGB in the "singleComment" line, apply, and try, from msg, to call "seColorizationInit" as instructed in the handler comments. But I get the error, "Can't find stack". This stack is the only one "open".

I also cannot save that stack. From msg, same error, and I get no option to save when right-clicking that stack in the Project Browser. Now I know this is an IDE stack and is very shy.

I hate the green/bold comment color in the default SE text selection. Can someone tell me how to be a power user in LC?

Craig Newman

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Cannot make SE colorization stick

Post by richmond62 » Thu Jan 25, 2018 11:49 pm

the green/bold comment color
Screen Shot 2018-01-26 at 12.47.18 am.png
Screen Shot 2018-01-26 at 12.47.18 am.png (15.2 KiB) Viewed 7904 times
Screen Shot 2018-01-26 at 12.48.45 am.png
Screen Shot 2018-01-26 at 12.48.45 am.png (15.23 KiB) Viewed 7904 times
I must be missing something.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot make SE colorization stick

Post by dunbarx » Fri Jan 26, 2018 12:11 am

Richmond.

No, it is I that am missing something.

I can change the handler, I just cannot make it stick. The comment in the handler of interest says:
...To apply the newly loaded scheme, call seColorizationInit after the scheme has been loaded.
I see no means to invoke the command as per those instructions, or save the stack by right-clicking in the Project Browser, as per the recommendation of Paul in the thread "Control over script editor color syntax".

I am on a Mac. You are on Linux, I think. Does that matter?

Craig

AndyP
Posts: 615
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Cannot make SE colorization stick

Post by AndyP » Fri Jan 26, 2018 8:20 am

The files are in the Mac bundle and you normally do not have permission to write to them.
Try this...make backup copies of any files you are going to alter so that you can reinstate if required.

Right click on your copy of Livecode and choose "show content" then navigate the path and right click on the files and choose "Information"
There change your permissions to read write.
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Cannot make SE colorization stick

Post by richmond62 » Fri Jan 26, 2018 11:35 am

I am on a Mac. You are on Linux, I think.
I'm Bi-well-never-mind: those pictures were taken on a Mac :)

Ah, got it: I'm a "Cross Platformer".
ps.jpg
ps.jpg (5.63 KiB) Viewed 7857 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot make SE colorization stick

Post by dunbarx » Fri Jan 26, 2018 3:42 pm

Try this...make backup copies of any files you are going to alter...
Now I know I am not getting this.

Nothing to do with files. I am trying to change the colorization of the Script Editor, in the same way one can change the textSize in the LC preferences.

Globally. The thread I mentioned seems to say this can be done.

Craig

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Cannot make SE colorization stick

Post by shaosean » Fri Jan 26, 2018 3:59 pm

There's another thread where I posted an old plugin that allows you to create your own theme(s) for the Script Editor. Code is all available and is in the public domain, so take what you want. It works by intercepting the IDE methods, no modifications of the IDE. I'm going to be adding in the missing features (saving themes, etc)

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot make SE colorization stick

Post by bogs » Fri Jan 26, 2018 5:33 pm

Craig, forgive my density, I realize that this will be kind of a pain, but could you pop a link to the directions you are following to get to the point of calling the init your getting stuck at?

Thanks.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot make SE colorization stick

Post by dunbarx » Fri Jan 26, 2018 5:43 pm

@ Sean. I will try to find that thread. Thanks.

@ Bogs.

It is a handler in the script of stack "revseutilities" likely a substack of stack ""revNewScriotEditor", currently at line 700:
# Parameters
# pScheme : the name of the colorization scheme to load
# pPreferencesArray : reference to the preferences array to set the scheme on.
# Description
# Places the appropriate settings for the specified colorization scheme into
# the sPrefs array. To apply the newly loaded scheme, call seColorizationInit
# after the scheme has been loaded.
command seColorizationLoadScheme pScheme, @pPreferencesArray
switch pScheme
case "default"
put "group commands bold 127,127,0" & return & \
"group properties none 0,127,127" & return & \
"group functions none 127,0,127" & return & \
"class error none 255,0,0" & return & \
"class singlecomment bold 0,127,0" & return & \
"class multicomment italic 0,127,0" & return & \
"class identifier none 0,0,0" & return & \
"class literal none 0,0,127" & return & \
"class number none 0,0,127" & return & \
"class keyword none 127,0,127" & return & \
"class operator none 0,0,0" & return & \
"class continuation none 0,0,0" & return & \
"keyword command bold 0,0,0" & return & \
"keyword private bold 0,0,0" & return & \
"keyword on bold 0,0,0" & return & \
"keyword end bold 0,0,0" & return & \
"keyword if bold 0,0,0" & return & \
"keyword then bold 0,0,0" & return & \
"keyword else bold 0,0,0" & return & \
"keyword function bold 0,0,0" & return & \
"keyword setprop bold 0,0,0" & return & \
"keyword getprop bold 0,0,0" & return & \
"keyword repeat bold 0,0,0" & return & \
"keyword switch bold 0,0,0" & return & \
"keyword try bold 0,0,0" & return & \
"keyword catch bold 0,0,0" & return & \
"keyword case bold 0,0,0" & return & \
"keyword default bold 0,0,0" & return & \
"keyword finally bold 0,0,0" & return & \
"keyword next bold 0,0,0" & return & \
"keyword exit bold 0,0,0" & return into pPreferencesArray["colorization,config"]
break

case "revolution classic"
put "group commands none 0,0,255" & return & \
"group properties none 255,0,0" & return & \
"group functions none 248,128,23" & return & \
"group structures none 152,5,23" & return & \
"class error none 0,0,0" & return & \
"class singlecomment none 104,34,139" & return & \
"class multicomment none 104,34,139" & return & \
"class identifier none 0,0,0" & return & \
"class literal none 0,0,0" & return & \
"class number none 0,0,0" & return & \
"class keyword none 0,0,0" & return & \
"class operator none 0,0,0" & return & \
"keyword on none 152,5,23" & return & \
"keyword command none 152,5,23" & return & \
"keyword private none 152,5,23" & return & \
"keyword end none 152,5,23" & return & \
"keyword if none 152,5,23" & return & \
"keyword then none 152,5,23" & return & \
"keyword else none 152,5,23" & return & \
"keyword function none 0,0,255" & return & \
"keyword setprop none 152,5,23" & return & \
"keyword getprop none 152,5,23" & return & \
"keyword repeat none 152,5,23" & return & \
"keyword switch none 152,5,23" & return & \
"keyword try none 152,5,23" & return & \
"keyword catch none 152,5,23" & return & \
"keyword case none 152,5,23" & return & \
"keyword default none 152,5,23" & return & \
"keyword finally none 152,5,23" into pPreferencesArray["colorization,config"]
break

case "no colorization"
put "group commands none 0,0,0" & return & \
"group properties none 0,0,0" & return & \
"group functions none 0,0,0" & return & \
"class error none 0,0,0" & return & \
"class singlecomment none 0,0,0" & return & \
"class multicomment none 0,0,0" & return & \
"class identifier none 0,0,0" & return & \
"class literal none 0,0,0" & return & \
"class number none 0,0,0" & return & \
"class keyword none 0,0,0" & return & \
"class operator none 0,0,0" & return & \
"keyword on none 0,0,0" & return & \
"keyword end none 0,0,0" & return & \
"keyword if none 0,0,0" & return & \
"keyword then none 0,0,0" & return & \
"keyword else none 0,0,0" & return & \
"keyword function none 0,0,0" & return & \
"keyword setprop none 0,0,0" & return & \
"keyword getprop none 0,0,0" & return & \
"keyword repeat none 0,0,0" & return & \
"keyword switch none 0,0,0" & return & \
"keyword try none 0,0,0" & return & \
"keyword catch none 0,0,0" & return & \
"keyword case none 0,0,0" & return & \
"keyword default none 0,0,0" & return & \
"keyword finally none 0,0,0" into pPreferencesArray["colorization,config"]
break
end switch
end seColorizationLoadScheme

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot make SE colorization stick

Post by bogs » Fri Jan 26, 2018 8:06 pm

Good, this is something I planned to poke around in next week, but I'll start poking around in it this weekend instead. Any particular color you want, or just any color other than green? bold ? italic, etc?

Also, if I remember rightly, you've moved to 8.x right?

Thanks.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot make SE colorization stick

Post by dunbarx » Fri Jan 26, 2018 8:57 pm

Bogs.

I can modify the handler. I just cannot save the changes. That is what I am asking for guidance.

And while you are at it, what do you think "multiComment" is?

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot make SE colorization stick

Post by bogs » Fri Jan 26, 2018 9:08 pm

Well, I am pretty sure Craig is in 8 or later, but figured I'd start closer to the bottom of the list.

In 6.x, the code to modify is in the stack "revNewScriptEditor", below you can see where I commented out the line for single comment (I changed 'none' to 'italic', and then later 'bold')
Image
After doing the change in the script editor, I hit [ctrl + s] to save it back to the stack. I closed the editor, then re-opened it, and the changes *stuck* -
Image
I then closed the IDE and re-opened it, the change there is permanent as well.

Once the change is made, no other calls to any init were needed, just closing / re-opening the editor seems to suffice.

I believe 7.x works the same way, so I am going to go crack open 8.x to see if it is any different.

While I was typing this, Craig posted and caught me in the middle :wink:
Mind you, doing this in 6.x, saving was as easy as (on linux) ctrl + s, I think command + s on mac, while the editor was open making the correction.

multiComment is when you are using the /* this is a comment over several lines */ comment. By default, it is in italic instead of bold. I myself prefer bold, but I can see some wanting the desire to separate different comments from each other, and that system does work well for that.

*Edit for the 8.x test -
Well, it pretty much worked the same as the others, on linux. I'll go to my mac vm to see if there is any difference there due to the way mac is setup, as mentioned above.
Image
Comment on a regular project after closing / re- opening the IDE -
Image
Image

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot make SE colorization stick

Post by bogs » Fri Jan 26, 2018 9:58 pm

Since everything seems to work the same way, I fired up the mac image I have (10.6.6). I only popped open 7.x, but I'm pretty sure the resolution will work regardless short of 9.

Following the previous steps, I did indeed hit the problem Craig hit, even though it said it 'saved' here, it did not apparently save it. The problem is with permissions on mac, you by default don't have the permission you need to write to the app folders as someone mentioned above. In this case, to be (less) safe, I changed the permissions on both the folders and the file itself, which allowed it to be saved through.

IF anyone else does this, I would suggest setting the permissions back whenever your done, it is a good safety thing. If your nuts like I am, ignore that completely at your own risk.

I am pretty sure only the file itself needs the changed permission (navigate to 'revScriptEditor.rev' -> get info -> permissions on the bottom, change from read only to read/write), but like I said, I like to write where I want to, I changed them all just because.
Image
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot make SE colorization stick

Post by dunbarx » Fri Jan 26, 2018 11:09 pm

Bogs.

Well, I get the permissions thing.

But I have had the permissions open to the Applications folder forever, it seems. I may just lock that.

I have several copies of file "revScriptEditor.rev" on my machine, but they are all in v3 and v4 folders. I have no files named "revNewScriptEditor" at all, at least not visible with spotlight or the normal find command. So I cannot explicitly change the permissions to those files, because I cannot find them.

So I guess I am not a power user in the sense of knowing how to find and deconstruct the bundled files with which LC is packaged.

Bogs knows his stuff, but is not really a Mac user. I can "apply" the changes to the handler. But after that, I see no way to save those changes to the stack. If I close LC, I get no dialog asking if I want to save the changes to the stack "revNewScriptEditor". And I cannot seem to do it from the Project browser.

I know it is an IDE stack, and is therefore resistant to normal finagling. But I am certainly missing a step, or rather an understanding, of just how to pull this off.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot make SE colorization stick

Post by bogs » Fri Jan 26, 2018 11:30 pm

Downloading Lc 8.x now, then I'll do a step by step on exactly what you'll need to give the permission to. In that one, the files you need to target are different than 7.x, and I believe it uses a behavior stack to boot, so we'll see how much of an issue it is :wink:

You are right, though, I certainly am not a Mac power user by default, not since the Mac +, and even then it was just something *new* for me to play with heh, but I'll try to get you better directions this time round (waiting on the download to finish).
Image

Post Reply

Return to “Talking LiveCode”