[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kafka
Subject: Re: Writing the selection code
From: Thomas <zander () xs4all ! nl>
Date: 2000-11-23 17:48:01
[Download RAW message or body]
> Hello all,
>
> Over the pas few days I have been getting to grips with DOM, and I have
> it straight, I can begin writing some of the selection methods.
>
> What we need are the following methods:
>
> - To be able to click in the view and select an object
> - To be able to click inthe view and select where to write some text
> - To be able to highlight some text
> - To be able to highlight objects
I understand that the DOM allows the editing of object via api calls,
this means selecting, changing, adding.
I would suggest a cursor object that can point to a dom object and the text
in there.
So the cursor could for example point to a specific <p> tag, character 10.
The <p> tag should be referenced, meaning that moving the <p> tag to a <td>
tag should not invalidate the cursor (I want it to remember where I was typing).
The pointer should also save a position (in pixels) for the undo mechanism.
For every undo a cursor would be saved so the cursor placement is remembered
through undo/redos. But that is pretty advanced.
Don't know if the QCursor can be used here..
Highlighting text/objects means having 2 object references, a start
object and an end object. Within these objects you could have a start/end
position.
For example:
<p>line1</p>
<hr>
<p>line2</p>
selectionStart is firstP, character 3
selectionEnd is lastP, character 5
Remember that there are only 2 <P> objects in the above example, not 4 ;)
Selecting on objects basis is the same, minus the character offsets. We just
need a way to calculate which objects are between the first and last object.
I think we need coordinates to calculate that..
Basically you have 2 objects in your doc object for text
selection and 2 objects for object selection. If you can use a <p>-type
object for this; great!
> - Update the DOM tree with what the user does. If for example we want
> to type text in it would find the node where the mouse is, take in
> keyboard input for one letter, update the DOM, move the cursor
> (keyboard) right one letter and repeat. For updating the DOM we can use
> the KHTML DOM calls, and there is also a method which returns the DOM
> node the user clicks on. This could be reimplemented.
ehh, reimplemented?? Why not just use that?
Read some of the earlier emails Schimmy wrote about this stuff.
> If anyone has suggestions on a better way, or would like to get their
> hands dirty, please speak up.
Just passing along some things, hope it helps.
--
Thomas Zander zander@earthling.net
The only thing worse than failure is the fear of trying something new
_______________________________________________
Kde-kafka mailing list
Kde-kafka@master.kde.org
http://master.kde.org/mailman/listinfo/kde-kafka
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic