Bug 59320 - Split windows in editor to view the same file
Summary: Split windows in editor to view the same file
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: UI: IDEAl (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 65575 80794 85466 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-06-04 09:53 UTC by Michael Plagge
Modified: 2007-03-19 10:35 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Ability to see different files simultaneously on same Kdevelop editing area. (215.61 KB, image/png)
2005-04-01 12:35 UTC, Jordi Blasi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Plagge 2003-06-04 09:53:17 UTC
Version:            (using KDE KDE 3.1)
Installed from:    RedHat RPMs

I would like to see the possibilty to watch two source files at the same time. (i.e. no need for changing the window content by the tab bar). This is a feature the normal kate editor provides ("split vertical" and "split horizontal") , and since you use this editor as a plugin i hope it's perhaps possible to realise this in gideon. Also it would be nice to use the spell check capabilities of kate (since i need it as you can see from this text :-) )
Comment 1 Jon Smirl 2003-06-25 04:15:18 UTC
I'll second the desire for split screens. Especially useful for diffs too.  I
can achieve this manually by opening the other file in another editor and
rearranging the main windows.

diffs with kompare is supposed to be integrated as a part, but I haven't been
able to figure out how to get a split screen display out of it.
Comment 2 Peter Antonius 2003-08-15 18:52:03 UTC
It would be very nice to have this feature, especially if it can be possible to have the 
same file open in two windown. It can be a great help when dealig with large source 
files. 
Comment 3 Andreas Koepfle 2003-10-06 01:31:00 UTC
*** Bug 65575 has been marked as a duplicate of this bug. ***
Comment 4 Amilcar do Carmo Lucas 2003-10-08 20:34:23 UTC
> diffs with kompare is supposed to be integrated as a part, but I haven't 
been  
> able to figure out how to get a split screen display out of it.  
Well rigth click with the mouse in the diff output view and you'll get a menu 
where you can select Kompare.  
  
  
  
Comment 5 Martin Köbele 2003-11-19 15:41:39 UTC
yes please!!!!!
Comment 6 Hamish Rodda 2003-11-28 13:05:11 UTC
This bug can be looked at two ways.

One way is that the screen should have an arbitrary number of panes that can contain whichever files at whichever positions the user wants.  This can be achieved already with KParts (indeed Kate achieves this through embedding multiple kateparts), and it is not the place of katepart to provide this, instead this should be re-assigned to the respective UI components inside kdevelop.  This has the advantage of giving you the function for every text editor.

The other way of looking at this is providing a synchronised multi-column editing mode for a single file in a single buffer.  This would be the job of the text editor, and indeed Kate has an open wish for this, so if you want it, vote for it... bug 67943 (I'm looking at this as a possibility for kde 3.3 / 4.0).

So, either way you look at this, it's either not katepart's problem, or it is and this is a dupe :)

I'd suggest reassigning this to IDEAL mode and any other modes where it is relevant...

Cheers,
Hamish.
Comment 7 Hamish Rodda 2003-11-28 13:30:37 UTC
Oops, kate achieves the first of my two interpretations by embedding multiple views, not parts.  Still, the first part of this bug is not katepart's problem, as it is implemented already (available through KTextEditor's interfaces), so the conclusion (not katepart's problem) still stands.
Comment 8 Michael Plagge 2003-11-28 17:11:22 UTC
Hi Hamish Rodda

you are right that this bug/wish is not a kate problem. Since yesterday i used
a new version of kdevelop (the first one after the first beta) and with this version it is possible to view an arbitrary number of files except for the IDEAL mode. If i remember right, this was not possible with previous versions. So you are right with your suggestion to reassign this bug to IDEAL mode, but i don't know how to do this :-(

Perhaps anyone else can do this

Cheers,

michael  
Comment 9 Amilcar do Carmo Lucas 2003-11-28 17:25:30 UTC
One more for IDEAl
Comment 10 Amilcar do Carmo Lucas 2003-11-28 17:34:22 UTC
If you use the childframe mode you'll get the desired behaviour.
Regarding the spell-check it's a duplicate of some other bug.
Closing as fixed
Comment 11 Martin Köbele 2003-11-28 18:25:53 UTC
you could also use xemacs, another reason to close that bug.....

what is that?

Martin
Comment 12 Amilcar do Carmo Lucas 2003-11-28 18:38:52 UTC
Martin Koebele please follow the instructions on:
http://www.kdevelop.org/index.html?filename=branches_compiling.html
to get the latest KDevelop from CVS.

Then do:
Settings -> MDI mode -> Childframe mode.
Comment 13 Amilcar do Carmo Lucas 2003-11-28 19:33:42 UTC
OK, I think I fianly understand this one.
The wish is to have the file view tab splited verticaly or horizontaly showing the SAME file in both views.

This wish is valid for ALL editors and for ALL GUI modes.

This wish is _not_ about showing two different files in the same editor view tab, because that doesn't make sense and I'm sure that that would violate a couple of GUI guidelines.

If you need to see two diferent files side by side, then just use the childframe view temporarily, it only takes 1 second to switch.
Comment 14 Jens Dagerbo 2003-11-28 19:50:33 UTC
/me points everyone to

http://developer.kde.org/documentation/library/cvs-api/kdevelop/html/FutureTasks.html

-> "implement multiple-views per document"

It's been in there for awhile now.. :)
Comment 15 John Birch 2003-11-28 20:56:27 UTC
Amilcar (comment #13)

I disagree :-)

It does makes sense to see two _different_ files on the same tab and I really don't want to switch modes to do that (however long it takes).

And why stop at just two files...
Comment 16 Amilcar do Carmo Lucas 2003-11-28 21:05:45 UTC
Well the point is that you see two files then, two tabs need to be active to give you visual feedback of which files are opened.

This means that you would also need two (or more) tab rows (or columns).

IMHO that would make the interface too complicated!
Comment 17 Amand Tihon 2004-03-07 23:26:39 UTC
Ok, what about yet another mode, like in Kate : without tabs, but with a list of open files ? 
This is, at least for me, the easiest way of managing project files, combined with the project/directory view. The list is much more readable than the tabs, and its order can be "last opened, last in list", or alphabetical. 

I don't know if it would be easy to implement though.
Comment 18 Jens Dagerbo 2004-03-07 23:50:39 UTC
In answer to commmen #17, a FileList plugin is in HEAD right now, which implements a Kate-like list of open files. Optional hiding of the tabbar is coming...
Comment 19 Martin Köbele 2004-03-08 00:52:34 UTC
to be honest, I still really suggest to have kate's splitting within kdevelop.

(arbitrarily) splitted windows and tabbs are not necessarily a contradiction.
again a screenie as an example how xemacs does it:
http://www.mkoebele.de/screenies/tabbedandsplitted.png
Comment 20 Marcin Kasperski 2004-03-31 13:00:53 UTC
One more vote. Recently I decided to try kdevelop and - although fairly excited  with a lot of its features - abandoned it after 15 minutes due to the lack of this very feature.

An ability to see simultaneously two parts of the same long file seems to me to be absolutely crucial for the programmers editor. There are plenty of use-cases, I'll name just two:
- while writing complicated destructor that's really nice to see the body of related constructor, while writing inline functions that's really nice to see the members declarations, ...
- while editing something somewhere deep I need to add some helper function at the end of the file, add some include on the top etc - then I want to split the window, stay with the focus where I was and go to do what I need in the second pane, then easily return to the main task

Similarly, it is also crucial to be able to see some other related file while editing. For example, while implementing some class that's nice to see its header file somewhere nearby, while operating on complex data structure it's nice to see the structure definition, ...

It's worth noting that it is hard to find any programmers editor without this feature - in fact I searched for it in kdevelop for almost half an hour, being sure that it must exist somewhere, maybe incorrectly placed in menus/toolbars...

. An ability to see some related file too
Comment 21 Marcin Kasperski 2004-03-31 13:06:21 UTC
I just found that the standalone kate editor has this feature perfectly implemented (there is horizontal and vertical split, one can view same or different files in each pane). So ... just take this from kate and add to kdevelop too...
Comment 22 Jens Dagerbo 2004-05-30 16:18:58 UTC
*** Bug 80794 has been marked as a duplicate of this bug. ***
Comment 23 Amilcar do Carmo Lucas 2004-07-19 20:03:51 UTC
*** Bug 85466 has been marked as a duplicate of this bug. ***
Comment 24 Jake 2005-01-24 23:58:12 UTC
Just another vote for this bug, I believe everybody has said everything I was going to say, but I like the way kate does it, and wish I could do this in KDevelop. I sometimes wind up using just kate for writing small code because of the split features. Thanks to all who make KDE/KDevelop what it is.
Comment 25 Jordi Blasi 2005-04-01 10:35:26 UTC
More votes for this very important one. 
The very bare necessities are clearly explained in comment #20 which I vote for.

To summarize:

1.- An ability to see simultaneously two parts of the same file (split views, multiple-views per document).

2.- An ability to see some related (different) files simultaneously on same Kdevelop editing area. 
Same as Childframe GUI mode do but with no need to switch GUI mode (quite a long task to achive, so useless).
IDEAl is "Single Edit View Interface", Childframe is "Multiple Edit Views Interface". Then IDEAl should not exist as a different GUI since it is a subset of Childframe GUI mode. IDEAl mode is what you get when being in Childframe you maximize a File (here maximize means occupy all kdevelop's editing workspace) and that you get it _on_the_fly_. When you minimize that file you are back to "Multiple Edit Views Interface" for current opened files _on_the_fly_ (here _on_the_fly_ means with a single mouse click). Right now to switch modes you have: Settings -> Configure Kdevelop... -> User Interface -> Childframe window mode -> Quit Kdevelop -> Restart Kdevelop, which is exasperating.
Comment 26 Becheru Petru-Ioan 2005-04-01 11:11:42 UTC
http://www.mkoebele.de/screenies/tabbedandsplitted.png shows exactly what i want ! But it would be useful to have vertical and orizontal splitting
Comment 27 Jordi Blasi 2005-04-01 12:35:18 UTC
Created attachment 10468 [details]
Ability to see different files simultaneously on same Kdevelop editing area.

It is also essential to see related (different) files simultaneously on same
Kdevelop editing area. 

This is already supported in Kdevelop's Childframe mode GUI but the issue is to
switch between IDEAl <=> Childframe _on_the_fly_ as explained in comment #25.
Comment 28 Becheru Petru-Ioan 2005-04-01 14:05:58 UTC
I want to view more than 1 file in a tab,a tab should represent o group of files and for those files in the tab i want to be able to set the view mode(vertical split,orizontal split,n rows and m colons{n*m==no. of files in the grup; vertical split <=> no. rows and 1 colon})
Comment 29 Luke Tucker 2005-09-01 18:12:47 UTC
I too would love to see a split view. I feel lost without it.

It is currently very difficult to compare code in 2/3 places in different files (or the same file for that matter). I am so used to the vim :sp feature that I feel like this is a big hole in the software.



Comment 30 Ross Collins 2005-09-13 11:39:01 UTC
In addition I'd like to see two files at once in a split vertical view in IDEAl mode, where the left-hand pane contains tabs of my header files, and the right-hand pane contains tabs of my source files... even better selecting a header file tab in the left-hand pane should also update the right-hand pane to reveal the corresponding source code. The functionality for this kind of linking between source and header file already exists with the "Switch Header/Implementation" option.

I remember seeing similar behaviour in an IDE years and years ago... not sure which one (may have even been an old version of Kdevelop ;-) ).
Comment 31 Pupeno 2005-10-06 23:10:15 UTC
Personally, I would like to see the same two options that are available in Kate on Kdevelop:
- Split vertically
- Split horizontally
Other advanced usages of spliting micht be possible, but they may as well be controversial. Kate's way is simple, it is already implemented.
Personally, I use splitting a lot to see two parts of the same file.
Comment 32 Amilcar do Carmo Lucas 2006-05-24 00:59:42 UTC
This reached 484 votes :) but it is now implemented in KDevelop 3.4
Comment 33 Jens Dagerbo 2006-05-24 01:12:20 UTC
Actually, it isn't. Multiple views of the same file is still not supported, only a split viewspace showing several different files.
Comment 34 Wolfram R. Sieber 2007-01-21 01:38:48 UTC
Completed votes to a whole 500. Feature request is open since mid-2003. Now, it's 2007. When will it be implemented?
Comment 35 Andreas Pakulat 2007-01-21 01:42:09 UTC
When somebody does it in kdevelop4. It won't happen in 3.4, but its planned to have this in 4.
Comment 36 Alexander Dymo 2007-03-18 21:43:50 UTC
SVN commit 643941 by dymo:

- refactored KDevelop::PartDocument: splitted it into 2 classes PartDocument for generic KPart handling
  and TextDocument to work with KTextEditor::Document 
- made UiController ask PartController whether the document is text or not and load TextDocument or PartDocument respectively
- modified TextDocument to always create a KTextEditor::View of already opened part 
  (this means we will finally open multiple views for the same document)

PS: this grants the 2nd "most wanted" wish in KDevelop but I'd like to note that I've implemented this 
splitting + multiple views per document feature only for KDevelop4.

BUG: 59320


 M  +2 -2      interfaces/idocument.h  
 M  +2 -0      shell/CMakeLists.txt  
 M  +1 -1      shell/mainwindow_p.cpp  
 M  +20 -19    shell/partdocument.cpp  
 M  +13 -3     shell/partdocument.h  
 A             shell/textdocument.cpp   [License: LGPL (v2+)]
 A             shell/textdocument.h   [License: LGPL (v2+)]
 M  +8 -2      shell/uicontroller.cpp  


--- trunk/KDE/kdevelop/lib/interfaces/idocument.h #643940:643941
@@ -65,9 +65,9 @@
     virtual KMimeType::Ptr mimeType() const = 0;
 
     /**
-     * Returns the part, if this document is a KPart or 0 otherwise.
+     * Returns the part for given @p view if this document is a KPart document or 0 otherwise.
      */
-    virtual KParts::Part* part() const = 0;
+    virtual KParts::Part* partForView(QWidget *view) const = 0;
 
     /**
      * Returns the text editor, if this is a text document or 0 otherwise.
--- trunk/KDE/kdevelop/lib/shell/CMakeLists.txt #643940:643941
@@ -23,6 +23,7 @@
     project.cpp
     partcontroller.cpp
     partdocument.cpp
+    textdocument.cpp
     languagecontroller.cpp
     language.cpp
 )
@@ -46,6 +47,7 @@
     project.h
     partcontroller.h
     partdocument.h
+    textdocument.h
     languagecontroller.h
     language.h
     DESTINATION ${INCLUDE_INSTALL_DIR}/kdevelop/shell
--- trunk/KDE/kdevelop/lib/shell/mainwindow_p.cpp #643940:643941
@@ -91,7 +91,7 @@
     if (doc)
     {
         //activate part if it is not yet activated
-        KParts::Part *part = doc->partForWidget(view->widget());
+        KParts::Part *part = doc->partForView(view->widget());
         if (Core::self()->partController()->activePart() != part)
             Core::self()->partController()->setActivePart(part);
     }
--- trunk/KDE/kdevelop/lib/shell/partdocument.cpp #643940:643941
@@ -26,7 +26,7 @@
 
 struct PartDocumentPrivate {
     PartController *partController;
-    QMap<QWidget*, KParts::Part*> partForWidget;
+    QMap<QWidget*, KParts::Part*> partForView;
 };
 
 PartDocument::PartDocument(PartController *partController, Sublime::Controller *controller, const KUrl &url)
@@ -44,22 +44,27 @@
 QWidget *PartDocument::createViewWidget(QWidget *parent)
 {
     Q_UNUSED( parent );
-    KParts::Part *part;
-    if (url().isEmpty())
-        part = d->partController->createTextPart(url(), "", false);
-    else
-        part = d->partController->createTextPart(url(), "", true);
+    KParts::Part *part = d->partController->createPart(url());
     d->partController->addPart(part);
     QWidget *w = part->widget();
-    d->partForWidget[w] = part;
+    d->partForView[w] = part;
     return w;
 }
 
-KParts::Part *PartDocument::partForWidget(QWidget *w)
+KParts::Part *PartDocument::partForView(QWidget *view) const
 {
-    return d->partForWidget[w];
+    return d->partForView[view];
 }
 
+PartController *PartDocument::partController()
+{
+    return d->partController;
+}
+
+
+
+//KDevelop::IDocument implementation
+
 KUrl PartDocument::url() const
 {
     return Sublime::UrlDocument::url();
@@ -67,26 +72,21 @@
 
 KMimeType::Ptr PartDocument::mimeType() const
 {
-    return KMimeType::mimeType("text/plain");
+    return KMimeType::findByUrl(url());
 }
 
-void PartDocument::save()
-{
-}
-
 KTextEditor::Document *PartDocument::textDocument() const
 {
     return 0;
 }
 
-KParts::Part *PartDocument::part() const
+bool PartDocument::isActive() const
 {
-    return 0;
+    return false;
 }
 
-bool PartDocument::isActive() const
+void PartDocument::save()
 {
-    return false;
 }
 
 void PartDocument::close()
@@ -97,7 +97,7 @@
 {
 }
 
-IDocument::DocumentState KDevelop::PartDocument::state() const
+IDocument::DocumentState PartDocument::state() const
 {
     return Clean;
 }
@@ -105,4 +105,5 @@
 }
 
 #include "partdocument.moc"
+
 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
--- trunk/KDE/kdevelop/lib/shell/partdocument.h #643940:643941
@@ -34,7 +34,15 @@
 
 class PartController;
 
-//FIXME adymo: refactor
+/**
+The generic document which represents KParts.
+
+This document is used by shell when more specific document classes
+are incapable of loading the url.
+
+This document loads one KPart (read-only or read-write) per view
+and sets part widget to be a view widget.
+*/
 class PartDocument: public Sublime::UrlDocument, public IDocument {
     Q_OBJECT
 public:
@@ -42,11 +50,10 @@
     virtual ~PartDocument();
 
     virtual QWidget *createViewWidget(QWidget *parent = 0);
-    KParts::Part *partForWidget(QWidget *w);
+    virtual KParts::Part *partForView(QWidget *view) const;
 
     virtual KUrl url() const;
     virtual KMimeType::Ptr mimeType() const;
-    virtual KParts::Part* part() const;
     virtual KTextEditor::Document* textDocument() const;
     virtual void save();
     virtual void reload();
@@ -54,6 +61,9 @@
     virtual bool isActive() const;
     virtual DocumentState state() const;
 
+protected:
+    PartController *partController();
+
 private:
     class PartDocumentPrivate *d;
 };
--- trunk/KDE/kdevelop/lib/shell/uicontroller.cpp #643940:643941
@@ -36,6 +36,7 @@
 #include "partcontroller.h"
 #include "mainwindow.h"
 #include "partdocument.h"
+#include "textdocument.h"
 
 namespace KDevelop {
 
@@ -136,7 +137,12 @@
 
     //get a part document
     if (!d->parts.contains(url))
-        d->parts[url] = new PartDocument(d->core->partController(), this, url);
+    {
+        if (d->core->partController()->isTextType(KMimeType::findByUrl(url)))
+            d->parts[url] = new TextDocument(d->core->partController(), this, url);
+        else
+            d->parts[url] = new PartDocument(d->core->partController(), this, url);
+    }
     PartDocument *doc = d->parts[url];
 
     //find a view if there's one already opened in this area
@@ -158,7 +164,7 @@
         area->addView(partView, activeMainWindow()->activeView());
     }
     activeMainWindow()->activateView(partView);
-    d->core->partController()->setActivePart(doc->partForWidget(partView->widget()), partView->widget());
+    d->core->partController()->setActivePart(doc->partForView(partView->widget()), partView->widget());
     ///@todo adymo: activate and focus the partView
 }
 
Comment 37 Alexander Dymo 2007-03-19 00:04:46 UTC
> Feature request is open since mid-2003. Now, it's 2007. 
> When will it be implemented? 
Well, it was almost impossible to implement for KDevelop3. First obstacle was the horrible UI library (kmdi;)) which could not split views in Ideal mode. That was addressed in 3.4. And second obstacle was the internal document/part management infrastructure which was reworked only in KDevelop4.
Comment 38 Wolfram R. Sieber 2007-03-19 10:35:16 UTC
Either way: Thanks a lot! :)