[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KTextEditor interfaces
From: Cullmann Christoph <crossfire () babylon2k ! de>
Date: 2001-03-22 12:49:32
[Download RAW message or body]
Hi,
why do you want to kick the viewList from the document ?
That will make things more complicating in my eyes.
I like the current implementation (only too limited).
Why we don't start with the current stuff and just add the needed features ?
cu
Christoph
Am Donnerstag, 22. März 2001 01:37 schrieb John Firebaugh:
> Okay, here are some revisions to the KTextEditor interface. It's obviously
> not complete, but I think it is a lot closer to what we need than the
> current interface is. I took a lot of the methods from Java's Document and
> JTextComponent classes, replacing events/eventListeners with signals and
> slots. Java also abstracts the Caret into its own class, which might be a
> good thing to do here.
>
> How close is this interface being sufficient for apps like KWrite, Kant,
> KMail, KDevelop to use?
>
> Other things to think about: how should implementations provide their
> actions? Should all actions be installed by default, or do we need to give
> the embedding application fine-grained control over which actions it wants
> use? Can we provide a generic Document implementation so that
> KantPart/KVim/KEmacs would only need to implement the view?
>
> class View : public QWidget, public KXMLGUIClient {
> Q_OBJECT
>
> public:
> /**
> * Create a view that will display the document data. You can create as
> many
> * views as you like. When the user modifies data in one view then all
> other
> * views will be updated as well.
> */
> View( Document * document, QWidget * parent, const char * name = 0 );
> virtual ~View();
>
> virtual void setDocument( Document * doc );
> virtual Document * document() const;
>
> virtual int caretPosition() = 0;
> virtual int selectionStart() = 0;
> virtual int selectionEnd() = 0;
>
> virtual QPoint modelToView( int offset ) = 0;
> virtual int viewToModel( QPoint point ) = 0;
>
> /* Convenience methods */
> virtual void selectAll();
> virtual QString selectedText();
> virtual QString text();
> virtual QString text( int offset, int length );
> virtual void setText( QString text );
> virtual void replaceSelection( QString text );
>
> public slots:
> virtual void copy() = 0;
> virtual void cut() = 0;
> virtual void paste() = 0;
> virtual void select( int offset, int length ) = 0;
> virtual void setCaretPosition( int offset ) = 0;
> virtual void moveCaretPosition( int offset ) = 0;
>
> signals:
> void caretUpdate( int dot, int mark );
>
> }
>
> class Document : public KParts::ReadWritePart {
> Q_OBJECT
>
> public:
> Document( QObject * parent = 0, const char * name = 0 );
> virtual ~Document();
>
> /**
> * Create a view that will display the document data. You can create as
> many
> * views as you like. When the user modifies data in one view then all
> other
> * views will be updated as well.
> */
> virtual View * createView( QWidget * parent, const char * name = 0 ) = 0;
>
> /**
> * @return true if this document has not loaded a url and has not been
> modified
> */
> virtual bool isInInitialState() { return url().isEmpty() && !isModified()
> };
> /* bool isModified(); */ // inherited from ReadWritePart
>
> /**
> * @return the number of characters in the document.
> */
> virtual int length() const = 0;
>
> /**
> * Add @param s into the document at @param offset.
> */
> virtual void insert( const QString & s, int offset ) = 0;
>
> /**
> * Remove @param length characters from the document starting at @param
> offset.
> */
> virtual void remove( int offset, int length ) = 0;
>
> /**
> * @return the complete document as a single QString
> */
> virtual QString text() const = 0;
>
> /**
> * @return a string containing @param length characters starting at
> @param * offset.
> */
> virtual QString text( int offset, int length ) const = 0;
>
> signals:
> void changed();
> void deleted( int offset, int length );
> void insterted( QString text, int offset );
> void undoableEditHappened( );
>
> protected:
> /* virtual bool openFile() = 0; */ // inherited from ReadOnlyPart
> /* virtual bool saveFile() = 0; */ // inherited from ReadWritePart
>
> }
>
> >> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<
--
| | / / - get an edge in editing -
| | / / »»»» GET KANT ««««
| |/ / a fast and capable multiple document,
| \ multiple view text editor for KDE
| |\ \
| | \ \ http://devel-home.kde.org/~kant
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic