SketchUcation Plugin Store

 

 

[plugin] Ruby Code Editor - UPDATED to v3.0 3/4/2013

[plugin] Ruby Code Editor - UPDATED to v3.0 3/4/2013

Postby alexschreyer » Tue Feb 23, 2010 4:40 pm

Hi All,

Please see my other forum post for details and all updates:

http://sketchucation.com/forums/viewtopic.php?f=323&t=25800

Cheers,
Alex
Last edited by alexschreyer on Tue Mar 05, 2013 4:38 pm, edited 2 times in total.
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby driven » Tue Feb 23, 2010 5:59 pm

tried to leave this at your site,but not sure it worked??

Hi Alex,

I've been using v1 quite a lot , teaching myself ruby on a Mac and I put together a list of slight oddities to post, however I'll now check them against the new version before bothering you, keep up the good work, every bit helps, even the oddities...

john
driven
Top SketchUcator
 
Posts: 1459
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby driven » Tue Feb 23, 2010 6:51 pm

Hi Alex,

possibly a quick fix required,

I always get the open link format on restart even after setting options

WebConsole show's _modal on the Mac, this doesn't ... (or whatever I should call not vanishing behind SU)

I may have modified WC, can't remember, I'll reload a clean one and check...

I can't see where I might modify this or the last version

john
driven
Top SketchUcator
 
Posts: 1459
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Tue Feb 23, 2010 7:11 pm

driven wrote:I always get the open link format on restart even after setting options


Not sure what you mean by this. I have to admit that I haven't tried either version on a mac yet. I'll do that soon but in the meantime keep any bugs coming my way...

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby driven » Tue Feb 23, 2010 7:46 pm

I have to right click to get to the drop down box, then click load link

I always get this page on when selecting RCE
Please, register (free) to access all the attachments on the forums.
driven
Top SketchUcator
 
Posts: 1459
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Tue Feb 23, 2010 7:59 pm

driven wrote:I have to right click to get to the drop down box, then click load link


Yuck! That is indeed a glitch. It is only happening in Safari/Chrome. So for now that's a problem only for mac users. I'll fix that later today. Thanks for letting me know.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby Dan Rathbun » Wed Feb 24, 2010 3:33 pm

Dang... Alex we are supposed to use the same original thread, and post the plugin in the first message. Then when updated, you replace the file attachment there in the first message.
(But in your case, you'd update the link to the download.. same difference.)

As the thread 'starter' you can can change the Topic to reflect '[UPDATE]' and release version. etc.

That way..
(1) there is not a separate thread for each new release.
(2) Since I posted in the original thread, I expected (when an update came,) to see the thread pop to the top of the 'Your Posts' page (which is kind of my 'homepage' at SCF, how I enter the site.)

{Maybe ThomThom can stitch the 2 threads together if you agree.]
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4146
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Wed Feb 24, 2010 5:07 pm

@Dan: I can do that the next time. I did put a note on the last thread mentioning that there is an update available at the same address. And the last thread went a little off-topic after a while, so I thought this would keep things clean.

The main download location is still my website, so at least there are no old versions floating around.

Cheers, Alex

P.S. WebKit doesn't seem to want to save cookies from a local page somehow, so I might have to do a local preference storage (as suggested before) after all...
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby Dan Rathbun » Wed Feb 24, 2010 5:48 pm

alexschreyer wrote:@Dan: I can do that the next time.

OK. no problem... I've posted here so this thread popped to the top, when you posted.
alexschreyer wrote:WebKit doesn't seem to want to save cookies from a local page somehow, so I might have to do a local preference storage (as suggested before) after all...

Well I've already done the work.. let me have a look at as_rubyeditor.rb, and I'll get back to ya' today or tomarrow.
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4146
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby Dan Rathbun » Wed Feb 24, 2010 6:12 pm

as ruby code editor ver 1.1
MSIE ver 7.0.5730.11

Errors:
(1) ui.html - Line 113 - invalid argument
<a class="button" onClick="u();" ... >
removed ";" and error went away
<a class="button" onClick="u()" ... >

.. but then (after reloading page,)
(2) ui.js - Line 165 - Char 3 - Object doesn't support this property or method
[seems that line wants to load stylesheet(s)]

... the page looks exactly like driven posted for the Mac. (but with MS fonts)
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4146
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Wed Feb 24, 2010 11:55 pm

Just a quick update:

- I fixed the cookie issue. Apparently I needed a path to save the cookies. Although Chrome won't save local file cookies, Safari will do that. So we're okay with all preferences and saving them locally.

- I fixed the reference browser back button issue. Now in Safari only the iframe gets navigated.

I'll upload a new version with those fixes later today.

The remaining issue is that the function that inserts text at the cursor (tab key and snippets) works fine in IE but not in FF/Safari. I'll look into that. Then I'll also finally try this out on a mac.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby driven » Thu Feb 25, 2010 12:09 am

Excellent ....
driven
Top SketchUcator
 
Posts: 1459
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby Dan Rathbun » Thu Feb 25, 2010 5:02 pm

alexschreyer wrote:The remaining issue is ...

Actually I see a few (in as_rubyeditor.rb)

(1) You removed the module wrapper around the dialog class !!!
This is a no-no. ONLY Ruby Baseclasses (like Integer, String, Module, Class .. etc.,) should be defined at the TOP_LEVEL, in the Objectspace. The lightweight version I'm working on (update to Jim's) will be double wrapped, something like:
SUutil::Ruby::WebConsole

(2) down ~line 181
# Callback to undo the last code execution
add_action_callback("undo") do |d, p|
(a) Just want to stress (seeing your code comment,) that Undo is a Sketchup function, not a Ruby function. It only undoes changes to the model. It does not undo ruby statements. For instance, if you define a method, run it, and click undo; The method is still defined in Ruby (whether right or wrong.) The same holds true for variables, constants, object instances, etc.
(b) I consider using 'p' as a varname dangerous because of method Object.p (and try to avoid single char varnames; usually put a number like t1, t2 for time vars, or x1,y1 for coords, etc.
Jim had a weird bug in a previous version that had to do with the use of 'd' as a varname, see:Sketchup Developer's Google Group post: "What is so special about d?"
* For WebDialog callbacks I've settled on a personal standard |dlg,arg|

(3) Instancing.
(a) The way it's written now (ie the way Jim had it,) the object constructor is within the menu item block, and creates a new instance each time the menu (or toolbar button,) is clicked.
When the .close method is called, it's only the OS window object (and it's instances of the webpage, CSS and Js that are destroyed,) along with any text in the HTML controls.
But the Ruby UI::WebDialog instance object still exists, and can be reshown. When this happens, Sketchup Ruby reloads the webpage assigned to it. Anyway think about that for a future revision.
(b) I think I will limit my version to two (2) instances and greyout the "new" menu item after that. (A user can only 'cut & paste' between two windows at a time.) I'm also going to dynamically add links to the menu as the instances are created, so those instances can be reused, rather than waste memory.
(c) This brings up the problem of Preference control. Which window will be (or should be,) allowed to update the settings? It takes a bit of thought, as I wish to have each instance save it's own size and position, and likely for the Mac, whether individually they will be 'always on top' or can go behind other windows, including SU.
_
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4146
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Thu Feb 25, 2010 6:21 pm

Hi Dan, Thanks for those points. My comments:

1) I believe I kept that as it was but I'll add that.

2) I see this code editor more for people that use it for geometry creation in SU rather than for the Ruby programmer (although they should find it useful, too). So the undo option is meant for undoing the SU action. Also, if you compare my code to Jim's, you see that I like verbose and commented code - I find it helpful for myself and for whoever uses it next. So I also prefer longer variable names.

3) Until there is a multi-file version of the editor, the multi-instance option is actually useful. Question: On close, can I destroy an instance like "UI::WebDialog = nil". Good point about the instance preferences. Haven't thought about that yet.

I am still fighting with Browser issues. I thought using jQuery would eliminate those. So cookies that save in Safari don't do so in IE.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Fri Feb 26, 2010 5:49 am

I just uploaded a newer version (1.1.1) that should fix some of the Safari issues. Now the page should at least load without complaint and the editor is usable. Some of the quirks I found:

- It doesn't seem to be possible to access an iframe's browser history in Safari. Therefore I had to remove the Back/Forward buttons when the editor gets used on a mac.

- Cookies are handled differently in all browsers. So preference storing works fine in Windows, but may not work on the mac. Next step is to use a local storage for that.

- I couldn't get caret positioning working 100% in Safari. Text and tab insertion works fine but the caret jumps around afterwards.

Everything should work as expected in Windows, though. I can't believe that this time IE works fine and Safari is acting up.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby Dan Rathbun » Fri Feb 26, 2010 9:01 am

alexschreyer wrote:2) ... So the undo option is meant for undoing the SU action. ...
OK just so you know, and hopefully the users will also.

I thought of a scenario: What if a user wishes to actually experient themselves with the undo API feature, writing the .start_operation, .commit_operation calls into the snippet editor? What would happen in ruby with double nested operations? Perhaps a checkbox next to the UNDO button to turn on|off the editor's Undo calls, ie(as_rubyeditor.rb):
line 74: Sketchup.active_model.start_operation "RubyEditor" if @undo_is_on
line 82: Sketchup.active_model.abort_operation if @undo_is_on
line 84: Sketchup.active_model.commit_operation if @undo_is_on

alexschreyer wrote:3) Until there is a multi-file version of the editor, the multi-instance option is actually useful. Question: On close, can I destroy an instance like "UI::WebDialog = nil".
Agreed, and actually even with a multi-file version (if you don't have a split screen feature,) then allowing two instances can satisfy those who'd want a split screen feature, (ie: 'cut & pasting' between two windows.) But we need to control instancing, and limit it (with a default limit, which might be overridden by the user.) I'm using a class variable: @@max_num
Garbage Collection. You would not set the class to nil. You are suppossed to be able to set the instance to nil and then call GC.start, but I've never witnessed GC disposing of the instance variable. It just sits around with a nil value (at least it's not taking up much space.) So ..
dlg=Namespace::RubyEditor.new( arglist )
#.. set it up.. show it .. use it .. close it
dlg=nil
GC.start

Anyway... in this case: we first must use a symbol to hold a reference to each instance. In editor code (line 205) in the add menu item command block you have (as Jim did,): "RubyEditor.new" which is not storing a reference to the instance, even though the object.new method always returns a reference to the newly created instance of the object class (which is the third main task of the new method in ruby.)
I'm using an Array class variable: @@instances=[]
and when I construct the instance, I push it's reference into the array:
if @@instances.size < @@max_num
__num = @@instances.size+1
__if dlgi = WebConsole.new(num) # non-nil if success
____@@instances.push( dlgi )
____# add menu link for instance
__end
end

The num var is used both to insert into instance menu text (similar to an editor's untitled(1), untitled(2) captions,) and is passed to new, so the instance itself can know which one it is (it's position in the class array var @@instances,) and to append as text onto the instance's Preferences Key suffix.
All that if block, above is wrapped within a UI::Command class instance @@cmd
__
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4146
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1.1 UPDATE

Postby Dan Rathbun » Fri Feb 26, 2010 3:07 pm

BY the way... you announced a ver 1.1.1, but...

The Revision block at the top of as_rubyeditor.rb says version: 1.2
(The extension registration/loader script says version: 1.1.1)

The thread topic (title of the first post,) still says version 1.1
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4146
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Fri Feb 26, 2010 3:55 pm

Dan Rathbun wrote:The Revision block at the top of as_rubyeditor.rb says version: 1.2


I keep missing those little details... Thanks!

Dan Rathbun wrote:Perhaps a checkbox next to the UNDO button


Great idea. I'll put this into the preferences section, though.

Dan Rathbun wrote:Garbage Collection


Thanks for the detailed explanation. I'll look at it.

But zooming out a little: It seems to me that we could maybe work more effectively on this if it were a collaborative project. I haven't worked with Github or similar systems before, but from what I understand it is made for stuff like this. Would you (and anyone else interested, of course) want to move this to a collaborative project?

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alz » Fri Feb 26, 2010 6:14 pm

Wow -- very nice and helpful plugin! I almost wish I could run it outside of SketchUp :P

Have you thought about adding syntax highlighting? Something to pop out basic Ruby keywords and SketchUp-specific keywords?
alz
 
Posts: 123
Joined: Mon Mar 17, 2008 2:40 pm

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Fri Feb 26, 2010 7:06 pm

alz wrote:Have you thought about adding syntax highlighting?


I actually had it in there at the beginning. Unfortunately (since it uses Javascript), I found that it would get very slow with moderately sized files. But I agree it would be nice.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby chrisjk » Fri Feb 26, 2010 7:19 pm

alexschreyer wrote:
alz wrote:Have you thought about adding syntax highlighting?


I actually had it in there at the beginning. Unfortunately (since it uses Javascript), I found that it would get very slow with moderately sized files. But I agree it would be nice.

Cheers,
Alex


I am way out of my depth here not knowing any ruby or javascript but could you not use the same functionality provided by the browser that is used to highlight words in say a google search?
Chris
chrisjk
 
Posts: 278
Joined: Fri Dec 05, 2008 8:16 am
Location: Keston, England
Name: Chris Knight

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby alexschreyer » Fri Feb 26, 2010 8:28 pm

chrisjk wrote:could you not use the same functionality provided by the browser that is used to highlight words in say a google search?


Although I can find words easily in a textarea (the editor field), I can't highlight it unless I use a custom html-formatted component. In any case, there needs to be some code that runs on every keypress that scans the entire document and formats words. For longer documents that becomes quite slow.

I looked at this editor:
http://ajaxian.com/archives/editarea-ri ... ode-editor

It is pretty neat but I figured, considering the performance issues, that once someone wants highlighting, they'll switch to Notepad++ or other external editors anyways.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.1 UPDATE

Postby driven » Fri Feb 26, 2010 8:51 pm

Hi Alex,

you are more than likely aware of dCode, it does seem to be abandoned, I have posed questions about it before without response, but it does seem to have some useful features the are already tuned to SU. http://www.errorinitus.de./sketchup/dcode/help/1.0_RC1/index_en.html

I was looking at doing something with it myself but it's all way out of my league... and maybe it's crap...

happy to test and comment though

the latest RCE is working quite nicely on both my Mac's, thank you

john
driven
Top SketchUcator
 
Posts: 1459
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [plugin] Ruby Code Editor - 1.2 UPDATE

Postby alexschreyer » Wed Apr 13, 2011 4:31 am

Just updated to version 2.0. Download in the same location as before.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.2 UPDATE

Postby driven » Wed Apr 13, 2011 1:36 pm

hi Alex,

looking good, but there's a parsing issue with complex saved files.

this may just be a mac thing, but, I could always do it with previous versions.

if you edit as_rubyeditor.rb in 'itself' and then 'save' on SU restart it fails to load 'it' due to this happening.



# Encode backward slashes and single quotes in Ruby
Code: Select all
234          text.gsub!('\\', "<84JSed>")
235          text.gsub!('\'', "<25SKxw>")   


becomes
Code: Select all
234         text.gsub!('\\', "\")
235         text.gsub!('\'', "'")


and also
Code: Select all
245          dlg.execute_script("tmp = tmp.replace(/<84JSed>/g,'\\\\')")
246          dlg.execute_script("tmp = tmp.replace(/<25SKxw>/g,'\\'')")


becomes
Code: Select all
245         dlg.execute_script("tmp = tmp.replace(/\/g,'\\\\')")
246         dlg.execute_script("tmp = tmp.replace(/'/g,'\\'')")


The 'new' file then fails on restart with SU error messages

it also adds a return after 'end' at 403, but I don't think that will cause problems.

All I was doing, was changing to show_modal, which works fine when done in external editor.

Code: Select all
362         show_modal do


I'll see if there are any other Mac issues (or solutions) over the next few days and let you know.

john
driven
Top SketchUcator
 
Posts: 1459
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [plugin] Ruby Code Editor - 1.2 UPDATE

Postby alexschreyer » Wed Apr 13, 2011 2:09 pm

driven wrote:there's a parsing issue with complex saved files.


Hi John,

It should just be the plugin file. I needed to put the "encoding dance" in there so that those symbols load correctly. That's why I chose something like "<84JSed>" - the chance that another file uses these letters is pretty slim (except for the plugin file, of course).

Edit the plugin file itself in another editor and it should work fine. Use my editor for any other files.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.2 UPDATE

Postby driven » Wed Apr 13, 2011 10:51 pm

hi Alex,

I had sorted out the editor, edit, and later realised the parsing only effected 'itself'.

I've been digging out all my Mac code editor 'theme' tweeks and some may interest you, I think there's an IE9 versions of these for example

Code: Select all
.CodeMirror{   background:transparent; color:inherit; border:none; cursor:text;}
.CodeMirror-gutter{ background-color:transparent; opacity:.5;}
.CodeMirror-cursor{z-index:10;  position:absolute;  visibility:hidden;  border-left:2px solid #lime !important;  color:transparent;  background-color:transparent;}
.CodeMirror-lines pre:nth-child(odd){background: rgba(255,255,255,0.1); }
.CodeMirror-lines pre:nth-child(N):hover{background: rgba(255,0,0,0.2); }

these are in addition or overwrite what you've already got.
I'm also porting a version of my ace theme 'blendin' but I'll need to enable a few more codeMirror functions as I go...

couple of jquery-ui things don't work and it through me trying to get the line scrolling to work because you use pt instead of px for fonts [px=pt/.75] and it frond upon a bit to use for screen media... The scrolling line were working with pt, but I've swopped pt's to px's or em's for personal convenience.
Ruby Code Editor2.png


oh, the line only appear if there's code.
john
Please, register (free) to access all the attachments on the forums.
driven
Top SketchUcator
 
Posts: 1459
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [plugin] Ruby Code Editor - 1.2 UPDATE

Postby alexschreyer » Thu Apr 14, 2011 3:03 am

John, thanks for looking at this so closely. I wanted to put line highlighting in there but didn't get to finishing it. I'll check it out later. Thanks for the CSS suggestions.

In the past I found that text could be defined in pt as long as line-height is defined in px (to make line coloring work). I might switch to px at some point - I usually like that better for my web pages.

I was thinking about putting the code on Github - I am very happy if others can help out here (or create their own fork). Should I pursue this? I actually haven't used GIT before.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: [plugin] Ruby Code Editor - 1.2 UPDATE

Postby driven » Thu Apr 14, 2011 3:22 am

Yes, git seems relatively straight forward, although I've only started using it recently for ace and cloud9 cloning.

For a slow start you then get a free cloud9 account, upload a trunk from git, and maybe we could do some interactive editing?

I really liked codeMirror, but couldn't sort out the ruby bits for SU and was thinking of asking for your help with either it or ace, when you anounced this.

I'll happily jump back to CM as it's so much simpler (after cloud and ace) although I've been running those off my localhost, rather than from inside 'plugin folder' and there's lots of plusses in that.

I'm really a Mac man, and most my tweaking is html5 and css3 and a little js, so IE input would be limited.

john
driven
Top SketchUcator
 
Posts: 1459
Joined: Fri May 01, 2009 11:50 pm
Name: John
Operating system: Mac
SketchUp version: 2013
License type: Pro
SketchUp use: engineering and mechanical design
Level of SketchUp: Intermediate

Re: [plugin] Ruby Code Editor - 1.2 UPDATE

Postby alexschreyer » Thu Apr 14, 2011 3:30 am

Great! Would be perfect to have you help work on this because I am mainly developing in Windows and the Mac side is the last thing I look at.

I am away at a conference for a week but we can get this started after Easter.

Cheers,
Alex
Author of "Architectural Design with SketchUp":
http://sketchupfordesign.com/
User avatar
alexschreyer
 
Posts: 137
Joined: Mon Jan 28, 2008 6:58 am
Location: Amherst, MA, USA
Name: Alexander Schreyer
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Vertex Tools for SketchUp. Take control over each vertex with this vertex editor for SketchUp.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012

Next

Return to Plugins

Who is online

Users browsing this forum: cdauscher, ekadarma, g_wilson, jhenn, jonedvard, kanastas, Kiv and 8 guests