Libpango and sample text editor app

I am playing with the sample text editor app from the ruby/gtk2 site
which you can find here:
http://ruby-gnome2.sourceforge.jp/hiki.cgi?Simple+Text+Editor

Im a beginner to ruby (6 months) and a beginning to ruby/gtk2 (1
month) so be kind

This app uses a glade xml layout. Within that xml layout is a widget
class GtkTextView called ‘textview’. Which has several properties
below it. What im looking for is to be able to control the text within
that textview using libpango, Preferably using the libpango markup
language. i.e. i want to open files like
/usr/share/doc/libpango1-ruby/examples/sample.txt and have them
displayed correctly within that textview window using
http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup

i have played around in on_open_file() within the text editor. I can
grab the plain text and the attributes for my text using
Pango.parse_markup() correctly but I cant display it correctly.

Any ideas on how i can achieve this?

Thanks!

Chris

I started down the same path that you are, but had problems related to
glade. I decided to not use glade. I had a terrible time with the GTK
hierarchy and trying to find out what was what. I ended up by creating
a widget, EditView, that wraps the different related GTK classes. I
have not included everything in these classes, but I’m adding the things
that I need as I need them. I’m attaching it, along with a program that
demonstrates its use. HTH


This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

Hi Alan,

Nice work. I’ve been doing something very similar
indeed. Maybe everyone who looks at the TextView and
the TextBuffer thinks that there has got to be an
easier way.

Once you’ve figured them out it’s a very powerful
interface but getting to that point is frustrating.
There are actually lots of things in Gtk like that.

I’ve been thinking about a ‘sugar’ library for
RubyGnome, like the sugar for wxruby or the old EzGtk.

Only EzGtk is too much, so how about less of a wrapper
for the entire library and more like a set of
extension methods for each widget (like the text-only
combobox interface). Making the default case easier,
without hiding the rich interface.

I suspect that wrapping RubyGnome has come up a lot on
the list over the last few years, but there doesn’t
seem to be a simple set of helpful extension methods
around. Want to start one?

best,
Dan


Hi Chris,

Thanks for your encouragement.

EditView is still in active development.� Since I
wrote to you, I’vemade it into a widget.� (I don’t
think that the file I gave you reallyqualifies as a
widget.)� I’ve been struggling with events, so
anythingI give you probably has some code that doesn’t
work.� I’m specificallyreferring to
current_line_length.� I called it from
asignal_connect(key_release_event) and
asignal_connect(button_release_event).� The reason
was that� my user islimited on how long each line
can be and wants feedback on how long herline is as
she adds characters.� This function worked for that
purpose,but somehow began a text selection that I
don’t want and can’t turnoff.� It also disabled
buttons in the same window by intercepting theclick on
the button.� I’m trying another approach that is not
aselegant, but may be easier to implement.� (What I
think I need is to beable to add functionality to
these events, without overriding thecurrent
functionality.)

Suggestion.� If it lacks some facility that you
need, let me know.� Imay have added it or I may be
able to add it easily.� I have a thirdfile that is a
textual cut and paste from the documentation.� As
youcan see, when I take a method from the underlying
classes, I copy thedocumentation into the RDoc format,
so that (1) I’ll be able togenerate complete
documentation for EditView and (2) I’ll be able toadd
notes and examples to documentation that I regard as
inadequate.�Any method that doesn’t exist in the
underlying classes, such as "find"references only
methods that I have brought into EditView.� This
way,no one need shuffle through many pages to figure
out what’s going on.

The listings are long enough that the catch the
attention of thislist’s moderator.� I’m not certain
of the best way to give you updatedlistings.�
Perhaps someone can clue me in.� (I also don’t know
if thereare others who can benefit from this effort.)

Chris Rohlf wrote:
Alan,I appreciate your reply :)Im gonna check out your
code, it may be just what im looking for. Illlink you
to any changes I publishChrisOn 10/14/07, Alan L.
[email protected] wrote:

I started down the same path that you are, but had
problems related toglade. I decided to not use glade.
I had a terrible time with the GTKhierarchy and
trying to find out what was what. I ended up by
creatinga widget, EditView, that wraps the different
related GTK classes. Ihave not included everything in
these classes, but I’m adding the thingsthat I need as
I need them. I’m attaching it, along with a program
thatdemonstrates its use. HTHChris Rohlf wrote:

I am playing with the sample text editor app from the
ruby/gtk2 sitewhich you can find
here:http://ruby-gnome2.sourceforge.jp/hiki.cgi?Simple+Text+EditorIm
a beginner to ruby (6 months) and a beginning to
ruby/gtk2 (1month) so be kindThis app uses a glade xml
layout. Within that xml layout is a widgetclass
GtkTextView called ‘textview’. Which has several
propertiesbelow it. What im looking for is to be able
to control the text withinthat textview using
libpango, Preferably using the libpango
markuplanguage. i.e. i want to open files
like/usr/share/doc/libpango1-ruby/examples/sample.txt
and have themdisplayed correctly within that textview
window
usinghttp://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markupi
have played around in on_open_file() within the text
editor. I cangrab the plain text and the attributes
for my text usingPango.parse_markup() correctly but I
cant display it correctly.Any ideas on how i can
achieve
this?Thanks!Chris-------------------------------------------------------------------------This
SF.net email is sponsored by: Splunk Inc.Still
grepping through log files to find problems? Stop.Now
Search log events and configuration files using AJAX
and a browser.Download your FREE copy of Splunk now >>
http://get.splunk.com/_______________________________________________ruby-gnome2-devel-en
mailing
[email protected]://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en

-------------------------------------------------------------------------This
SF.net email is sponsored by: Splunk Inc.Still
grepping through log files to find problems? Stop.Now
Search log events and configuration files using AJAX
and a browser.Download your FREE copy of Splunk now >>
http://get.splunk.com/_______________________________________________ruby-gnome2-devel-en
mailing
[email protected]://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en


This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?
Stop.
Now Search log events and configuration files using
AJAX and a browser.
Download your FREE copy of Splunk now >>
http://get.splunk.com/>


ruby-gnome2-devel-en mailing list
[email protected]

https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs