[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dragging of ruler markers

From: Benhur Stein
Subject: dragging of ruler markers
Date: Thu, 24 Oct 2002 22:49:59 -0200
User-agent: Internet Messaging Program (IMP) 3.0


Attached are some diffs that implement dragging of ruler markers.
It can be tested with Ink.app, going to Text>Toggle ruler, typing
some text with tabs and dragging markers around.

What is in the diffs:

NSParagraphStyle.m: correct the comparision of NSTextTabs.

NSScrollView.m: add a call to setNeedsDisplay at the end of -tile

NSRulerMarker.h: correct a mispelling in a method name 
                 (makerLocation -> markerLocation)

NSTextView.m: correction of same mispelling
              in -rulerView:didAddMarker: create a new NSTextTab corresponding
              to the marker.
              in -rulerView:handleMouseDown: ask rulerview to track a new
              marker, instead of simply adding a new marker

NSRulerView.m: remove some unused macros
               some new private methods _verifyReservedThicknessForMarkers,
               _rulerRect, _markersRect, _markerAtPoint:
               implemented -trackMarker:withMouseEvent:
               in -mouseDown: track marker if click was on marker, or
               asks client to handle if click was on ruler area.
               many changes in the drawing of hash marks and labels,
               to simplify code a bit and to correct the drawing of
               labels partially off ruler.

NSRulerMarker.m: implementation of -trackMouse:adding: (huge method!)
                 some corrections in coordinate calculations.

Some bugs:
It doesn't work well for unflipped views (because NSView cached -isFlipped);
a workaround is to define a subclass of NSRulerView that returns NO in

imageOrigin is not correctly set in the Text system (tab marks are a bit off

When the cursor is at the beginning of a line (before the first char), the
displayed ruler is that of the precedent line.
When clicking after the last line of text (in the space where there is no
more text), the cursor should move to the end of last line (at least that
is what Openstep used to do).

When the ruler are first shown, the markers do not show up. Moving the cursor
makes them appear.

I've put some ugly code when tracking mouse, because there are way too many 
events (I take the mouse position from outside the event stream and ignore
the event if the position has not changed). Maybe there could be something
like this in the code that receives the events from the X server.

Those are the ones I can remember now.. There are surely more.


Attachment: diffs.tgz
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]