Commit Graph

229 Commits

Author SHA1 Message Date
sfraser%netscape.com
a84dcaa401 Call the new presshell->SetCaretEnabled() call to show the caret when editing. 1999-04-02 00:01:31 +00:00
buster%netscape.com
7462debe8b needed to include "nsCoord.h" in mixed case, not "nscoord" 1999-04-01 19:26:27 +00:00
buster%netscape.com
990f624122 initial checkin. 1999-04-01 18:40:35 +00:00
buster%netscape.com
52bb18a74f As a reminder, we decided to do this based strictly content. Some support for style-based text properties is written, but not used
anywhere any more.

* Cleaned up split and join undo/redo.
* Added TypeInState, a data struct that remembers things about text properties for collapsed selections, so you can type
* Ctrl-B with an insertion point and the next character will be bold.
* Added all the logic to handle inline vs. block elements when setting text properties.
* Added some support for italic and underline as well.  Adding these things is pretty easy now.  Ctrl-B, Ctrl-I, Ctrl-U for testing bold, italic, underline.
* Added all the logic to make sure we only add style tags where they're needed, so you should never get the same style tag nested within itself, except as needed for block elements.
* Added methods for testing a node to see if a particular style is set.  This isn't 100% done yet, but with very little work we could have toolbar buttons that respond to selection changed notification that show the state of bold, italic, underline, etc. in real time.  Supports tri-state:  whole selection is bold, some of selection is bold, none of selection is bold, ...
* Fully undoable and redoable.
* Added some debug printfs to transactions and editors.  all controlled by a gNoisy static in each module.  helps me track down undo/redo problems.  if the output bugs people enough, I'll shut it off and re-enable it in my local tree.

Noticably missing:  make un-bold, make un-italic, etc.  This is coming soon.
1999-04-01 17:58:07 +00:00
rods%netscape.com
6eb99d23f2 Fixed up new ifdef'ed clipboard support 1999-04-01 14:28:13 +00:00
kin%netscape.com
a886d08255 Initial checkin of file. 1999-03-31 19:26:55 +00:00
kin%netscape.com
78383c59cf Initial checkin of files. 1999-03-31 19:25:05 +00:00
akkana%netscape.com
cf7607381c Editor: Add Insert Link and Image 1999-03-29 22:01:26 +00:00
jfrancis%netscape.com
22ec10b544 don't drop tab keys 1999-03-29 08:02:50 +00:00
jfrancis%netscape.com
0db3d1ee04 seperating out html edit rules from text edit rules 1999-03-29 08:02:05 +00:00
jfrancis%netscape.com
c7f3ede1e6 First Checked In. 1999-03-29 06:21:01 +00:00
joki%netscape.com
e39e13cf18 Changing api uses in editor, rdf, and xpfe to match DOM2 api name/param changes. 1999-03-28 22:27:38 +00:00
rods%netscape.com
00af88c97a Minor changes to call to new clipboard 1999-03-26 15:49:28 +00:00
mcafee%netscape.com
2813616d59 Renamed GetTransferable() to GetData() 1999-03-25 23:39:03 +00:00
mcafee%netscape.com
dd87f3c4fb initializing a variable to zero. 1999-03-24 09:08:24 +00:00
mcafee%netscape.com
f75b5055fd Checking for null references on clipboard, trans (gtk/unix). 1999-03-24 01:43:46 +00:00
rods%netscape.com
cb5eefe915 Added code for switching over Clipboard support to new classes
At the moment the are ifdef'ed out
1999-03-23 15:45:58 +00:00
akkana%netscape.com
5850dbaca8 Add hard-coded alt-I for testing insert html 1999-03-22 22:10:29 +00:00
jfrancis%netscape.com
1d6d98a5e5 bug 4057: fix is in layout; here I'm removing the old workaround code 1999-03-22 09:04:06 +00:00
tague%netscape.com
6e19645586 Added support for basic Japanese input on Win32 1999-03-19 23:36:20 +00:00
buster%netscape.com
af5243998a split and join now properly remember which content gets deleted, and which content remains in the tree
split and join now properly set selection to the remaining node, at the proper offset.
fixes bugs 3910 3881, with approval from chofmann
1999-03-17 20:56:10 +00:00
buster%netscape.com
a6b14ae03b I fixed the content twiddling part of bug 3778. Mike has a fix for the display part of it in his tree, but determined the risk didn't
justify the benefit.  This is partly true because he and I would have had to integrate tonight before checking in, which we thought
presented some additional risk.  In any event, this bug is fixed for all cases except when the user hits enter at the end of the
document.  That is the only case in text editing when the selection will not render correctly.

Some related problems got fixed as a side benefit of my code changes.  I filed bug 3896.
1999-03-17 06:13:46 +00:00
buster%netscape.com
53b3380a59 fixed join.
made a special case for typing with BR as the selection (as after an InsertBreak.)
made DEL and BACKSPACE at the beginning and end of a text node
fixes bugs 3742 and 3756 (with permission from choff and gkostello)
1999-03-16 16:38:09 +00:00
buster%netscape.com
6ce58013c8 added WillUndo, DidUndo, WillRedo, DidRedo and some supporting code so
the text edit rule object can maintain it's own state more efficiently and correctly.
1999-03-15 05:08:30 +00:00
buster%netscape.com
d5932338f7 added PlaceholderTxn. This is an aggregate transaction that sits on the undo stack
and merges in subsequent transactions indiscriminately until it's told to stop.
It also gives the last transaction in its child list a chance to merge the
next transaction.
All this is in support of complex transactions that result in text insertion
being able to collapse into a single undoable event.
Also improved tracking of bogus content node used when document is empty.
1999-03-15 00:57:32 +00:00
rods%netscape.com
61cfe9a3d0 Added DragListener for Drag & Drop (it's not turned on) 1999-03-14 04:45:00 +00:00
buster%netscape.com
4f91976666 added checks for DOM Key event returning 0x0 key code. If we get 0, we bail. 1999-03-14 04:12:21 +00:00
kostello%netscape.com
ce8451f01d Add HACKForceRedraw() to force a redraw until the drawing
problems are solved in Gecko
1999-03-14 00:31:35 +00:00
buster%netscape.com
458de90002 InsertBreak now works at the beginning of a line. Plus a trivial bug fix. 1999-03-13 05:31:22 +00:00
buster%netscape.com
bd6cb52f35 added delegate code for InsertText (WillInsertText, DidInsertText)
which calls generic WillInsert, DidInsert to test for magic bogus
content and does the right thing.
You now can't delete magic content with user gestures, and when you
insert anything the magic kludgy   is deleted first.
1999-03-13 04:53:21 +00:00
sfraser%netscape.com
895b199ee2 Throw the switch so we now pay attention to the charCode in the key event. 1999-03-12 05:28:22 +00:00
buster%netscape.com
b615bb95b3 deleting the last editable object in a document now causes a bogus placeholder <P>&nbsp;</P> to be added to the document. This node has the
attribute MOZ_EDITOR_BOGUS_NODE set to TRUE.  this solves the problem of when you do a SelectAll then a DEL, you don't have a cursor
or any way to set selection in the document. You do still have the problem that the nbsp is pretty narrow and the frame containing it is hard to hit
with the mouse.  We really need the "set selection to frame nearest the mouse down point" operation.

the intent is for all inserts to look for this node, and if found delete it before the insert.  likewise, all deletes will be no-ops if this node is found.
1999-03-12 02:28:24 +00:00
buster%netscape.com
9450d290ae fixed a small bug. mRefNode may be nsnull. 1999-03-12 02:27:48 +00:00
sfraser%netscape.com
452e7019bf Fix the key handling, and fix my macro for the charCode stuff 1999-03-11 19:34:28 +00:00
sfraser%netscape.com
0ca9df8689 Add SelectAll() 1999-03-11 19:33:37 +00:00
sfraser%netscape.com
beb4a09d21 Adapted key listener to get char code directly from event, rather than trying to do a key code conversion (#ifdeffed out until char code is there on all platforms). 1999-03-11 06:42:09 +00:00
akkana%netscape.com
a293292ac6 Change the reference to the global selection mgr to fix windows build 1999-03-11 00:08:10 +00:00
akkana%netscape.com
174aeed3d2 Comment out debug prints 1999-03-10 22:50:51 +00:00
akkana%netscape.com
57638ea34c Implement editor cut/copy/paste 1999-03-10 22:46:15 +00:00
akkana%netscape.com
cac34c12b2 Fix Solaris build problems -- thanks to braddr & bruce @ puremagic.com 1999-03-10 22:41:18 +00:00
sfraser%netscape.com
697f88d422 Add Cut, Copy and Paste to editor interfaces and classes, with a stub implemenatioon in nsEditor. 1999-03-10 21:29:41 +00:00
kin%netscape.com
806301a0b5 Changed all occurences of NS_TRANSACTION_MANAGER_FACTORY_CID
and kCTransactionManagerFactoryCID to NS_TRANSACTIONMANAGER_CID
and kCTransactionManagerCID.
1999-03-10 21:27:02 +00:00
sfraser%netscape.com
339921715b Add static to remove warning 1999-03-10 21:26:33 +00:00
buster%netscape.com
80388f4d9e first cut at rules delegate for text editor, will change drastically in the next week or two 1999-03-10 19:53:26 +00:00
buster%netscape.com
7ddbcd287f creation of text nodes now supported 1999-03-10 19:51:55 +00:00
buster%netscape.com
cfcffb6aff mNewNode is a DOM Node, not a DOM Element 1999-03-10 19:51:07 +00:00
buster%netscape.com
70eb4bfeed small fix of an off-by-one error in an assertion 1999-03-10 19:50:17 +00:00
buster%netscape.com
efe5fd63d6 SelectAll wired to Ctrl-A. 1999-03-10 19:49:43 +00:00
buster%netscape.com
8aba8ecce7 small interface change to InsertBreak 1999-03-10 19:49:18 +00:00
buster%netscape.com
7b37b68fb8 Implemented SelectAll.
Added nsEditor::DoInitialInsert() for doing first insert into an empty document.  Try typing into <html><body></body></html>
Added some smarts to DeleteSelectionAndCreateNode() so it only splits the selected node when appropriate (when the selection is not at offset 0 or max)

CreateElementTxn now creates text nodes as well as DOM elements
1999-03-10 19:48:13 +00:00
cmanske%netscape.com
714238a1d4 2nd try to get it right in get editor factory method 1999-03-09 23:06:16 +00:00
cmanske%netscape.com
a4506026a7 Fixed editor registration and startup problems 1999-03-09 22:52:24 +00:00
jfrancis%netscape.com
56e205b725 catching up with nsComponentManager and getting rid of cout usage 1999-03-09 20:11:27 +00:00
jfrancis%netscape.com
1436944874 including header 1999-03-09 20:04:59 +00:00
jfrancis%netscape.com
22623a9d12 integrated with content iterator 1999-03-09 19:22:48 +00:00
warren%netscape.com
44568143d6 Backed out the nsService template stuff. 1999-03-09 11:49:41 +00:00
warren%netscape.com
4b2d56fbaa nsRepository -> nsIComponentManager changes. 1999-03-09 09:44:27 +00:00
cmanske%netscape.com
f2098f2965 Fixed editor classes to do autoregistration correctly and moved target directory to bin/components 1999-03-08 22:46:33 +00:00
sfraser%netscape.com
9922f25147 Modified OutputText and OutputHTML methods to pass out nsStrings instead of nsIOutputStreams. Also fixed return values, and commented out line termination conversion in Mac outoutput. 1999-03-06 20:32:48 +00:00
cmanske%netscape.com
072ec2c507 Changed editor classes to inherited model. Fixed lots of destructor warnings. 1999-03-05 21:05:35 +00:00
scc%netscape.com
2ec0a397ea rename |IID()| --> |GetIID()| 1999-03-03 19:48:57 +00:00
mjudge%netscape.com
6497120c24 fixes for selection code, batching at correct point 1999-03-03 01:51:59 +00:00
scc%netscape.com
b81fb21272 fixed for nsCOMPtr: no construction or assignment from raw COM interface pointers 1999-03-02 22:27:46 +00:00
buster%netscape.com
5333e448a3 implemented GetTextProperty -- only works for bold and italic now,
trivial to add more properties
finished first cut at SetTextProperty.  This triggers lots of crashes in
range/selection code where we're holding onto a stale frame pointer (at
least, that's my best guess.)
synched with Charlie's change-o-rama
added an assert in DeleteTextTxn::Init() checking aNumCharsToDelete vs.
0
  NS_ASSERTION(0!=aNumCharsToDelete, "bad arg, numCharsToDelete");
if the number of chars to delete is 0, we shouldn't be creating a
transaction at all.  I had never seen this condition arise before
Charlie's checkin, I don't know if he introduced it or if it was a
latent bug I just never tripped over before.
1999-03-02 07:52:41 +00:00
cmanske%netscape.com
e415eb79b4 Implemented nsHTMLEditor. Changed prototypes to be use NS_IMETHOD and NS_IMETHODIMP. Started table editing transactions 1999-03-02 05:30:53 +00:00
cmanske%netscape.com
e8f419ec92 New files for nsHTMLEditor and table editing transactions (not working yet) 1999-03-01 19:54:47 +00:00
ebina%netscape.com
1b377a9c65 Changing RegisterFactory to use the new API. 1999-02-26 15:59:52 +00:00
warren%netscape.com
44cae3cd3f Changes for RDF component registration using nsRepository. Also changed args to NSGetFactory and friends. 1999-02-26 10:17:14 +00:00
mcafee%netscape.com
a35c96fc59 readding my fix that buster whomped. 1999-02-26 03:46:08 +00:00
buster%netscape.com
a5569c07c6 minor bug fixes 1999-02-25 16:09:18 +00:00
mcafee%netscape.com
1f14ae886e Solaris needs newline at end of file 1999-02-25 03:34:39 +00:00
buster%netscape.com
c05dfef653 added InsertElementTxn
added nsEditProperty
beginning of implementation for SetTextProperties.  Currently, it only works if the selection is entirely within a single text node.  Currently only
supports bold and italic (mapped to ctrl-b and ctrl-i for testing purposes.)
changed a bunch of interfaces to make things easier, like CreateElement now returns (as an out-param) the element created.
1999-02-24 17:24:37 +00:00
warren%netscape.com
01dd4f0ed6 Cleaned up nsICollection and nsIEnumerator. Broke out nsIBidirectionalEnumerator. Added ISupportsArray enumerator. Cleaned nsISupportsArray. 1999-02-23 08:10:24 +00:00
buster%netscape.com
c7e7fd1131 caught up to new ScrollIntoView changes.
most transactions now properly set selection after modifying content, for Do, Undo, Redo.
lots of cleanup and minor bug fixes.
1999-02-22 15:53:31 +00:00
mjudge%netscape.com
8ea394c9ee depricating the ScrollIntoView call. dont need it. the selection modification assures us of scrolling to view after batching. 1999-02-21 03:48:52 +00:00
buster%netscape.com
8efe480686 beginning work on ScrollToFrame 1999-02-20 21:29:27 +00:00
mjudge%netscape.com
b3cb7695a5 adding batching for selection. 1999-02-19 23:41:49 +00:00
brade%netscape.com
fea14bd750 move local variable into comment block to reduce warnings on Macintosh compiler 1999-02-19 16:11:23 +00:00
brade%netscape.com
e44af60f86 remove unused local variable to reduce warnings on Macintosh compiler 1999-02-19 16:09:37 +00:00
mcafee%netscape.com
40e8ad043a Solaris: adding do_QueryInterface() wrappers to finish scc's nsCOMPtr carpool. a=scc 1999-02-19 11:30:31 +00:00
mcafee%netscape.com
0d9d97bf4f Adding do_QueryInterface() wrapper for Solaris, this is the other part of scc's nsCOMPtr carpool 1999-02-18 23:18:56 +00:00
mcafee%netscape.com
5b9af87290 Solaris needs newline at end of file. 1999-02-18 23:09:08 +00:00
buster%netscape.com
d968e97e64 work in progress 1999-02-18 23:01:06 +00:00
mcafee%netscape.com
cbff9a4021 Adding newline at end of file for Solaris/CC 1999-02-18 12:14:59 +00:00
buster%netscape.com
1b73ea36a7 Highlights:
updated to new nsCOMPtr usage
nsTextEditor::InsertBreak() implemented
  splits the text node at the caret (deletes any extended selection to force a collapsed selection.)
  inserts a <BR> which I assume we'll convert to a CR when we write to a text stream.
  undo and redo work, except for the bug noted below

More stuff:
interface cleanup
strategic debugging code added
delete selection txn sets the collapses the selection...this is just a placeholder, but I needed it for undo/redo of InsertBreak.
join and split now work for text nodes as well as interior nodes
1999-02-17 19:42:29 +00:00
buster%netscape.com
750156a8dd private interface for editor, used for common editing operations that
we don't want to expose publically.
1999-02-17 18:34:41 +00:00
danm%netscape.com
fec8319485 fixing compilation problems with new nsCOMPtr. part of the carpool. 1999-02-17 06:18:11 +00:00
mjudge%netscape.com
0f60b22018 new modifications to nsCOMPtr to explicitly change to QueryInterface 1999-02-17 01:59:56 +00:00
buster%netscape.com
3c0989c25b minor fixes and lots of comments 1999-02-15 18:25:30 +00:00
buster%netscape.com
1cd1a05857 merges text insertions again, based on new aggregate insert txn 1999-02-15 18:24:58 +00:00
sfraser%netscape.com
d5c6142412 Cause the caret to become visible in the presentation shell when instantiating an editor. 1999-02-13 04:48:09 +00:00
buster%netscape.com
0febfca71d changed deleteSelection back to not use the range 1999-02-12 19:36:18 +00:00
buster%netscape.com
16de5238df changed DeleteSelection back to using nsIDOMRange directly. 1999-02-12 18:09:38 +00:00
kipp%netscape.com
36c243cdc0 COMized nsIPresShell and nsIPresContext 1999-02-12 17:45:58 +00:00
buster%netscape.com
1ceedf5abc * the viewer test app now instantiates an nsITextEditor via nsRepository for "Editor mode"
* the TxnMgr is invoked by the editor via nsRepository
* editor.h|cpp have been renamed nsEditor.h|cpp for consistency
* editorInterfaces.h|cpp have been renamed nsEditorEventListeners.c|hpp
* added nsITextEditor.h, nsTextEditor.h|cpp.  The text editor is a placeholder for the rules unique to text
editing.  It invokes the nsIEditor to do core editing operations.
* reworked nsIEditor and related interfaces as per emerging design.
* nsEditor::BeginTransaction and EndTransaction call nsTransactionManager::BeginBatch and EndBatch.
1999-02-12 17:18:58 +00:00
akkana%netscape.com
7982a421d6 Rename nsISelection to nsIFrameSelection 1999-02-11 23:12:28 +00:00
akkana%netscape.com
eb4fd64caa Implement a new interface, nsIDOMSelection, intended to become the
external interface for selection (to be IDL-ified later).

Fix some editor bugs:
- Advance the cursor on text insert (so text is inserted in the right order)
- Make DeleteSelection in the editor call the actual selection
- Make DeleteSelection update the frames' notion of the selection
1999-01-29 18:57:56 +00:00
buster%netscape.com
666e4a3c97 fixed some UMR's due to mRefCnt being uninitialized. This fixes some memory leaks. 1999-01-28 19:45:23 +00:00
buster%netscape.com
e1f0594680 put in crude support for aggregating type-ins across selection changes.
this needs to get beefed up to handle offsets within elements, which we'll
do as soon as selection is set properly following an insertion.
1999-01-28 19:00:14 +00:00
buster%netscape.com
a0bfc18e76 fixed a minor problem with merging type-in transactions. 1999-01-28 17:19:24 +00:00
buster%netscape.com
1d6de2d02b changed nsIEditor to enable undo separately from Init
work in progress API changes to nsIEditor and nsEditor
1999-01-28 06:02:53 +00:00
buster%netscape.com
e480bffcab better delete now that selection offsets are real. 1999-01-22 19:44:46 +00:00
buster%netscape.com
77666fcdba fixed debug asserts to allow for offset=count, since offsets represent
the slots between content.
1999-01-22 19:06:27 +00:00
buster%netscape.com
d93ebdb1ac made GetIsTransient return false by default, so most transactions don't need to implement GetIsTransient
made delete and backspace do the right thing (testing hacks removed)
1999-01-22 15:40:31 +00:00
mjudge%netscape.com
465aa03ac7 fixing build bustages 1999-01-22 03:50:22 +00:00
mjudge%netscape.com
4a482f84e3 fixing build bustage 1999-01-22 03:18:51 +00:00
akkana%netscape.com
97da5a3bf6 Try a different form of casting to keep both Linux and the Mac happy 1999-01-21 21:10:12 +00:00
buster%netscape.com
ea44dd04c7 factored editor so a request (public) is separate from building the txn for that request (private)
added some debug code to transactions
1999-01-21 19:44:26 +00:00
akkana%netscape.com
0e04d56d20 Fix nsCOMPtr casting build bustage 1999-01-21 19:31:57 +00:00
buster%netscape.com
1bf76fe187 bug fixes to delete range, plus some debugging printf's 1999-01-21 02:29:52 +00:00
buster%netscape.com
c544a4698b * added TransactionFactory. Editor no longer allocates its own transactions. This gives us an oppurtunity for a recycler.
* added DeleteSelection to editor.  Doesn't work very well yet because selection is giving me random offsets into text content.
* lots of work in the various transactions.
1999-01-21 01:51:09 +00:00
sfraser%netscape.com
f0793df5ed Reinstate buster's changes, with a fix for the nsCOMPtr problem. 1999-01-15 00:03:41 +00:00
buster%netscape.com
4ccd89d7ff backed out Merge functionality because it doesn't compile on Mac. 1999-01-14 21:52:08 +00:00
buster%netscape.com
50d5211732 added DeleteElementTxn and DeleteRangeTxn, and added merging of text insertions.
added some better error checking on all transactions.
1999-01-14 18:02:45 +00:00
pinkerton%netscape.com
efe4568aec fixes for SetDOMAttribute --> SetAttribute change. 1999-01-12 18:20:58 +00:00
buster%netscape.com
397587a596 shuffled around the responsibilities of core editing objects.
The key listener is now mostly a mapper of key events to editor actions.  Soon, this should be 100% true.
The editor builds transactions that are themselves intelligent. The editor makes very few DOM calls itself.
It relies on the transactions to do most of the actual editing.
1999-01-11 22:47:23 +00:00
buster%netscape.com
7476d737ae implemented joinNode. expect this and similar methods to move into editor.cpp 1999-01-11 19:06:37 +00:00
mcmullen%netscape.com
6387ba06a1 Remove illegal TextTxn:: within TextTxn class (this is illegal in C++ unless you have a nested class with the same name). This fixes Macintosh build bustage. 1999-01-09 02:41:35 +00:00
buster%netscape.com
9c4d3b3849 better code factoring, so split and join base methods can be reused 1999-01-09 00:24:48 +00:00
buster%netscape.com
d18aa37ef9 SplitElementTxn implementation. Do only.
test with Control-S.
1999-01-08 22:16:22 +00:00
buster%netscape.com
196f38742c fixed an uninitialized pointer problem
ctrl-ins appends an HR to the BODY
1999-01-08 01:41:34 +00:00
buster%netscape.com
27b37e6ffc implemented do and undo for CreateElement
the test is INS key, it adds an HR
1999-01-08 01:30:53 +00:00
buster%netscape.com
6c3a16ef91 create element transaction WIP 1999-01-07 22:36:23 +00:00
buster%netscape.com
f328d2f2b1 use base class Redo 1999-01-07 17:57:57 +00:00
buster%netscape.com
f42a6d7a60 make Redo call Do by default 1999-01-07 17:57:16 +00:00
buster%netscape.com
7e8794628f Delete Text Transaction initial implementation 1999-01-07 17:56:20 +00:00
buster%netscape.com
4435c98060 support for inserting text 1999-01-07 01:02:32 +00:00
buster%netscape.com
8c25fcb097 support for removing attributes 1999-01-07 01:02:16 +00:00
buster%netscape.com
d2d19db4f0 ChangedAttributeTxn implementation
base class EditTxn implementation
1999-01-06 20:30:13 +00:00