PBI - translate TextEdit to MacRuby
A friend of mine asked:
What word processor do you use on the Mac? I'd like to find an open-source, lightweight rich text editor (not OpenOffice... too big). Any suggestions?
His question made me think of a nifty project. TextEdit is one of the canonical example programs in the Mac OS X Developer Tools. It's not all that big, really: $ cd /Developer/Examples/AppKit/TextEdit/ $ wc -l *.h 5 Controller.h 124 Document.h 26 DocumentController.h 11 DocumentPropertiesPanelController.h 23 DocumentWindowController.h 49 EncodingManager.h 11 LinePanelController.h 23 MultiplePageView.h 100 Preferences.h 11 PrintPanelAccessoryController.h 14 ScalingScrollView.h 16 TextEditErrors.h 413 total $ wc -l *.m 140 Controller.m 1110 Document.m 269 DocumentController.m 133 DocumentPropertiesPanelController.m 702 DocumentWindowController.m 5 Edit_main.m 344 EncodingManager.m 162 LinePanelController.m 209 MultiplePageView.m 418 Preferences.m 87 PrintPanelAccessoryController.m 201 ScalingScrollView.m 3780 total The usual claim is that Ruby is several times smaller than C, C++, etc. Let's assume that a factor of four is typical. This would let TextEdit be recapitulated in 1000 LOC of Ruby. It would run about as fast (most of the work is done in the Apple frameworks) and it would be easily extensible in Ruby. In fact, it could use user- or site-specific "libraries" stored in initialization files. Does anyone else find this notion interesting? -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm@cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development
Hi Rich, (Sorry for the late reply, I was on vacation.) On Jan 18, 2009, at 1:17 PM, Rich Morin wrote:
A friend of mine asked:
What word processor do you use on the Mac? I'd like to find an open-source, lightweight rich text editor (not OpenOffice... too big). Any suggestions?
His question made me think of a nifty project. TextEdit is one of the canonical example programs in the Mac OS X Developer Tools. It's not all that big, really:
$ cd /Developer/Examples/AppKit/TextEdit/
$ wc -l *.h 5 Controller.h 124 Document.h 26 DocumentController.h 11 DocumentPropertiesPanelController.h 23 DocumentWindowController.h 49 EncodingManager.h 11 LinePanelController.h 23 MultiplePageView.h 100 Preferences.h 11 PrintPanelAccessoryController.h 14 ScalingScrollView.h 16 TextEditErrors.h 413 total
$ wc -l *.m 140 Controller.m 1110 Document.m 269 DocumentController.m 133 DocumentPropertiesPanelController.m 702 DocumentWindowController.m 5 Edit_main.m 344 EncodingManager.m 162 LinePanelController.m 209 MultiplePageView.m 418 Preferences.m 87 PrintPanelAccessoryController.m 201 ScalingScrollView.m 3780 total
The usual claim is that Ruby is several times smaller than C, C++, etc. Let's assume that a factor of four is typical. This would let TextEdit be recapitulated in 1000 LOC of Ruby. It would run about as fast (most of the work is done in the Apple frameworks) and it would be easily extensible in Ruby. In fact, it could use user- or site-specific "libraries" stored in initialization files.
Does anyone else find this notion interesting?
I think this is a valuable effort, if someone is willing to do it. It would be a nice sample code. Laurent
participants (2)
-
Laurent Sansonetti
-
Rich Morin