[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ktexteditor-devel
Subject:    Yzis and KTextEditor API
From:       Philippe Fremy <phil () freehackers ! org>
Date:       2007-06-04 17:19:32
Message-ID: 466449A4.1050204 () freehackers ! org
[Download RAW message or body]


	Hi,

I am still browsing through KDE + KWrite + Kate sources, so what I am
saying may be inaccurate.

The kte design is done in a master-slave relationship. The master is the
kpart host, the slave is the kpart component. The kpart host can create
new documents, new views, delete documents, delete views, change the
active views and more. The slave is not supposed to do much but to
answer "Yes, my Master".

Yzis looks like a jedi rebel from the Master point of view, because it
wants to do more than being a slave. It wants to:
- create views
- delete views
- change the active views
- create document
- delete document
- change the file being associated with a document
- change the document being associated with a view

The current KTE api is not very open for all these actions being
initiated from the slave.

And in fact, some KTE containers can not support these actions. KWrite
can only manage one view and one document and that's it.

To be a bit more concrete, let's go with an example of why yzis likes to
do all this: in kdesdk, there is a vim script which allows you, when you
press ,h to switch between .h and .cpp of the same file. Very practical,
I use it 10 times an hour minimum when I program.

When I open only a .h file and I press ,h , vi will:
- look if there is an existing document containing the .cpp file
- if not, create a new document for that file
- then, it can either switch the document of the current view to the new
document (2 docs, one view) or create a new view with the new document
and set this view as active (2 docs, 2 views)
- if I press ,h again , depending on where I landed, vi will either
switch the current document of the current view (2 docs, 1 view) or
switch the active view (2 docs, 2 views).

This is something quite useful. I could very well imagine a similar
functionality in kate, being binded to some function key by an external
plugin or script.

So, how to make this nice script work with kte ?

For working with KWrite, I think there is no choice but to define a
slave mode for Yzis. In this slave-mode, Yzis would not take any
initiative and would warn the user when he tries to, that he should use
the host app to do the action (create new view, ...) . This would be
kind of level 0 kte embedding.

Now, I don't want Yzis to remain in slavery, I want it to defeat the
emperor in the end and create a new world with his father [ Kate ? Isn't
that his mother ? And vim is the father ? ]

For the following actions:
- change the active views
- create document
- delete document
- change the file being associated with a document
- change the document being associated with a view

I believe we can find an API that can make this possible. The KPart host
would have to declare itself as being able to understand those actions.
The mechanism is to be defined. This is the level 1 kte embedding.

Now for:
- create views
- delete views

This is clearly trickier. I think that konqueror must be doing something
like this, no ? How do they manage tab browsing ? Is it khtml that
includes tabs with multiple documents, or konqueror the host, that
creates multiple tab, each hosting one khtml view ?

So, what do you kte guys think ?

	cheers,

	Philippe






_______________________________________________
KTextEditor-Devel mailing list
KTextEditor-Devel@kde.org
https://mail.kde.org/mailman/listinfo/ktexteditor-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic