[Pharo-project] Customizing the Caret of a PluggableTextMorph

phil at highoctane.be phil at highoctane.be
Fri Jul 20 06:37:13 EDT 2012


I wouldn't do that for basic morphs as it would make Cairo necessary and
then make completely ununderstandable what happens for laying out text for
someone who wants to understand it (which is an important aspect of an open
smalltalk image).

TextMorph>>onBlinkCursor leads you to Paragraph (of course since it deals
with the display)

onBlinkCursor
"Blink the cursor"
 | para |
para := self paragraph ifNil:[^nil].
Time millisecondClockValue < self blinkStart ifTrue:[
 "don't blink yet"
^para showCaret: para focused.
].
 para showCaret: para showCaret not.
para caretRect ifNotNil:[:r| self invalidRect: r].

so, para>>focused if where to look (but it is only a variable change so,
you'll need to track the usage)

Phil

2012/7/20 Fernando Olivero <fernando.olivero at usi.ch>

> Hi Sean, you can take a look at Athens-PangoCairo (in squeaksource).
>
> Using NativeBoost, i'm using the Pango layout library [1], and the
> Pango-Cairo binding [2],  to avoid laying out text using the outdated
> (and messy) stuff in the image.
>
> Check out the classes: ParagraphDescription & AthensPangoCairoParagraph.
>
> I'm using them as the basis for the TextShape,LabelShape, and
> EditableTextShape in Shapes / Gaucho ( using TextEditor,
> SingleLineEditor ).
>
> Maybe somebody can do the same for Morphic? use Pango to layout the
> text, and code a new TextMorph on top of it?
>
> Fernando
>
> [1] http://developer.gnome.org/pango/stable/pango-Layout-Objects.html
> [2] http://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html
> On Wed, Jul 18, 2012 at 7:28 AM, Stéphane Ducasse
> <stephane.ducasse at inria.fr> wrote:
> >
> > On Jul 16, 2012, at 9:38 PM, Sean P. DeNigris wrote:
> >
> >> For VimPharo, I want to have a different cursor depending on whether a
> tool
> >> is in insert or normal mode.
> >>
> >> I tried a handful of ways, but they all failed or worked
> >> partially/inconsistently. Here's some of them:
> >> * add the state to the paragraph, but the entire paragraph gets replaced
> >> during the life of the tool, so the state gets lost
> >> * add the state to the editor, but the situation is the same
> >> * add the state to PluggableTextMorph, override and access it from
> >> TextMorphForEditView>>updateFromParagraph. This was an extreme PITA and
> got
> >> me very acquainted with the emergency evaluator. It "worked", but only
> after
> >> using the arrows a bit.
> >>
> >> Does anyone have any idea where I might hook in?
> >>
> >> <rant>I find the whole text system very confusing. What the heck does a
> >> paragraph know about insertion points?? A view has one paragraph object,
> >> even if there are several paragraphs (as understood by the rest of
> humanity
> >> as a block of text with breaks between the adjoining ones. Editors and
> >> Paragraphs are thrown out and replaced on a whim. I'm finding it very
> hard
> >> to understand and modify</rant>
> >
> > I got burned by that when I worked on my botanics env….
> > it was terrible.
> >
> >>
> >> Thanks,
> >> Sean
> >>
> >> --
> >> View this message in context:
> http://forum.world.st/Customizing-the-Caret-of-a-PluggableTextMorph-tp4640245.html
> >> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
> >>
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20120720/99566530/attachment-0001.html>


More information about the Pharo-dev mailing list