[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
TextMorph>>onBlinkCursor leads you to Paragraph (of course since it deals
with the display)
"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)
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 , and the
> Pango-Cairo binding , 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?
>  http://developer.gnome.org/pango/stable/pango-Layout-Objects.html
>  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
> >> 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
> >> me very acquainted with the emergency evaluator. It "worked", but only
> >> 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
> >> 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
> >> 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:
> >> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev