Code folding for sourceview

Dear all

I am writing a code editor
using ruby gtk with sourceview as the editor

is there a way to implement code folding here?

If you have already done that, it would be great if you could share
if not, some idea on how to implement this is greatly appreciated

Thank you
Regards
Hendra

Hi,

I found Gtk::TextTag.invisible, but docs says: Gets the value whether
this text is hidden. Not implemented in GTK 2.0.

What about this?
http://live.gnome.org/GtkSourceView

Can it help?
Or any other ideas? Or currently its just not possible?

Hi Hendra:

I’m writing an IDE for Ruby/Gtk myself. I’m interested in your
progress. I didn’t know that we could get sourceview to work with ruby,
but I’ve heard that they will be releasing a gem in the next release.
I’d like to see how you’re doing it. Perhaps we could show each other
our projects so we can help each other. Perhaps we could beta test for
each other too.

Let me know.
Eric

Thanks Hendra.

I’m reading some of it now. It looks good. I’m going to try to run it
when I get home.

Eric

On Tue, Nov 23, 2010 at 4:52 AM, Eric C.
[email protected]wrote:

Thanks Hendra.

I’m reading some of it now. It looks good. I’m going to try to run it
when I get home.

Dear Eric,
if you have something to ask about my code, or some news about your
project
please inform me
Thank you
Regards
Hendra

Hi Hendra:

I just got home from vacation, and successfully installed gtksourceview.
I installed your program, and it ran perfectly on the first try. Its a
really nice looking program. You did an excellent job. I really like
your code. I’m able to understand what each file does without much
trouble.

I’m going to read more of it tomorrow. My first question is, why did
you write the GUI code by hand instead of using glade?

My project is similar to yours. Mine has a code editor, and it adds
version control over the network, and a simple object save/retrieve
methods so you can serialize any object and store it to disk. Also, I’m
including a simple method to run a glade file. So, for example, if you
make a class MyClass.rb then there could be a file MyClass.glade. You
could then call the MyClass#build_glade() method to load the glade file.
I’d love your help if you’re interested. I’m in my 2nd month of Ruby,
so I’m still re-writing a lot. Andrea D. has been helping me break
in to ruby (Thanks Andrea if you see this!).

I’ll get back to you after I read more of your code.

Also, what are your plans for this program?

Eric

On Sun, Nov 21, 2010 at 1:50 PM, Eric C.
[email protected]wrote:

Eric

Hi Eric

It’s good to hear your interest
Too bad I am a bit busy right now so I must put my project on hold
But of course you can see my code
It is bad written thought
my first intention is to get it work, optimize later
so code organization is a bit messy,
but shouldn’t be very difficult to understand
since I only use basic syntax (and there Ruby helps with clean syntax)

I attached my code here
to put it on the web right now
I also hope to see yours too,
perhaps you can post it somewhere we can see
Thanks

ps.
In the code you will see folder script, look into it.
It’s part of my big plan, the FastGTK framework (temporary name)
If you ever touch Rails, you should get some of the idea
(I use some of Rails idea)

On Sat, Nov 27, 2010 at 4:47 PM, Eric C.
[email protected]wrote:

I’ll get back to you after I read more of your code.

Also, what are your plans for this program?

Glad you like it
actually, I didn’t write the code by hand.
OK, I did it by hand, but not the files on controller/base directory, I
generate them.
Remember when I told you to take a look at script directory?
There’s a code generator there.
so basically, I write those ruby code in view folder,
then generate files in controller/base based on files in view folder
using script/migrate-view.rb,
that’s what I mean when I mention my framework

The reason why I don’t use glade is… because previously I have
already
created similar
code generator for wxwidget (wxruby)
but since I got stuck with wxruby I decide to migrate the code to GTK.
It was far easier for me back then to migrate the code rather than to
learn
glade
(I migrate the code from wxwidget to gtk in less than a week)

your code to load glade seems very interesting, if you don’t mind
perhaps
you can share it? I have no experience with glade before, I think I’ll
give
it a try

For now this project is on hold because I am very busy at the moment. I
haven’t plan anything other than finishing main features. Actually I
want it
to be good enough to replace Geany (editor I used to code ruby). That’s
the
main reason why I write this app.

I don’t really understand about version control so I guess yours is
better
than mine.
But I hope you include those object browser, directory tree and split
view
in your project, because if you do, I will use your app, as long as it
is
lightweight ;D

HI Hendra:

I’ll be glad to share my project with you. However, its under heavy
development right now. I can email it to you, if you send me your
address.

I’m planning on doing a big re-write now.

You mentioned that you’re short on time, so I’m not sure if you want to
take the time to understand all of it, but I’d be happy to explain
what’s going on if you like.

I’m going to try to find the time to understand all of your program too.
I think it may take me a few sessions of reading it. I didn’t realize
that the code that I was reading was generated, so its obviously more
complex than I realized.

Yours,
Eric

On Sun, Nov 28, 2010 at 4:09 AM, Eric C.
[email protected]wrote:

what’s going on if you like.

I’m going to try to find the time to understand all of your program too.
I think it may take me a few sessions of reading it. I didn’t realize
that the code that I was reading was generated, so its obviously more
complex than I realized.

Yours,
Eric

I’ll give you some hints for understanding my code

you run app.rb
it call a file in controller directory.
file in controller folder is an inheritance of files in controller/base.
files in controller/base is generated from files in view folder.
code generation is done before hand, not at the runtime.
the code generation file is script/module-view.rb.
all files in module folder is loaded automatically, there is function to
make life easier such as alert, show_message, etc (in gtk_additional.rb)

Please send your code to my email : [email protected]
I’ll try to spare my time to see your code

Thanks Eric