Area Design Puzzles
From KDevelop
Contents |
[edit] Puzzle 1
Given:
- 2 views (view1.1 and view1.2) for the same document1 are displayed in area1 in mainwindow1
- mainwindow1 is switching area to area2
- area2 has 3 views (view2.1, view2.2 and view2.3) for document1
Question:
- what views shall reuse widgets?
Solution:
[edit] Puzzle2
Given:
- mainwindow1 has area set to area1
- two views for different documents are displayed: view1 for doc1 and view2 for doc2
- mainwindow1 switches to area2
- area2 has view3 for doc1 and view4 for doc2
- now view3 reuses the widget of view1 and view4 - of view2
- mainwindow2 is created and its area set to area1
- area1 is not copied because it is not shown anywhere (mainwindow1 is in area2 atm)
Question:
- what shall happen to widgets for view1 and view2 (in area1)?
- remember that they are shared between area1 and area2 and already shown in mainwindow1
Solution:
[edit] IRC discussion summary
[04:00] <adymo|mac> teatime: ok, so let me sum up: [04:01] <adymo|mac> 1) by default we create new mainwindows for new areas [04:01] <teatime> adymo|mac: btw, I run kdevdesigner and kdevassistant seperately anyway.. ;) [04:01] <adymo|mac> 2) we allow the user to enable area switching (without reuse) [04:02] <adymo|mac> 3) we make switching to close everything in an area before switch [04:02] <adymo|mac> teatime: right? [04:03] <teatime> yeah.. I think so.. [04:03] * teatime ponders 3) again [04:03] <adymo|mac> 3) will make area switch expensive [04:04] <adymo|mac> and will break the usual code-debug workflow much [04:04] <teatime> yeah.. and I'm not sure why we want that [04:04] <adymo|mac> so let's think of : [04:04] <teatime> if I want perspective 2 AND want to get rid of 1.. why don't I create a new mainwindow with 2 and close 1? [04:05] <teatime> is the perspective shift now suddenly a convenience way to do this? [04:05] <adymo|mac> 3b) letting the area hide on switching [04:06] <adymo|mac> teatime: but when you want that? [04:06] <teatime> that == 3b? [04:06] <adymo|mac> teatime: usually you want to retain what you had (like 100 code editor windows) [04:06] <teatime> yeah [04:06] * adymo|mac misunderstood probably [04:07] * teatime too [04:08] <teatime> what I meant was that the expensive 3 suggestion sounded equivalent to creating a new mainwindow and closing the first [04:08] <adymo|mac> ah, right
[edit] IRC discussion log
[02:54] <teatime> adymo|mac: but if we don't reuse the widgets.. what then if I have (and I do) 100 files open and switch perspective? [02:54] <teatime> destroy 100 views + their documents and recreate them?? [02:55] <adymo|mac> teatime: yeah, all that glory :) [02:55] <apol> teatime: I'll have to make it crash, but I can remember several times thinking "what happened?" without knowing what was happened [02:55] <adymo|mac> teatime: but documents will not be destroyed, only widgets for views [02:55] <adymo|mac> teatime: stop [02:55] <adymo|mac> teatime: widgets will not be destroyed too [02:55] <adymo|mac> teatime: they will be hidden and reparented to 0 [02:56] <adymo|mac> teatime: at least current implementation does that [02:56] <teatime> adymo|mac: and if they are 1doc-1view kinda parts? create another 100 part instances? [02:57] <adymo|mac> teatime: creation should be on-demand.... i doubt you'll have enough place on screen to show all 100 ;) [02:57] <adymo|mac> teatime: still creation will happen only on the first area switch [02:57] <teatime> adymo|mac: documentmanager->openDocuments() [02:57] <teatime> that sure ought to return the docs that are supposedly open [02:57] <adymo|mac> subsequent switches (even in another mainwindows) will not recreate widgets [02:57] <aseigo> adymo|mac: so, is it ok if i extended kdevplugin for the time being with an iconLoader() accessor? [02:58] <adymo|mac> aseigo: yeah, that would be perfectly enough [02:58] <aseigo> adymo|mac: great. i'll do that today then ... [02:59] <adymo|mac> teatime: but opened doc != shown doc [02:59] <teatime> adymo|mac: I lost you on that last one.. "will not recreate widgets"? [02:59] <adymo|mac> teatime: each view stores the pointer to the widget [03:00] * aseigo waves [03:00] <-- aseigo has left this channel. [03:00] <teatime> adymo|mac: granted, but again.. if they are of the 1doc-1view variety, having a documents means having a view (even if it's not visible) [03:00] <adymo|mac> teatime: so if a view was shown on the screen in some area in some mainwindow, it will keep the same widget [03:00] <teatime> oh [03:00] <teatime> I thought this was about reusing widgets.. [03:00] * teatime reads the puzzle again [03:01] <adymo|mac> teatime: no, i'm describing usual behavior [03:01] <adymo|mac> teatime: but puzzle is indeed about reuse [03:01] <teatime> and as you can see, I'm stuck in worst-case-scenario :) [03:01] <adymo|mac> teatime: regular operation: 1view-1widget [03:02] <adymo|mac> teatime: operation with reuse Nviews->1widget [03:03] <apaku> Sorry, I have no idea what exactly you two try to solve :( [03:03] <adymo|mac> teatime: btw let's rename your "1doc-1view" to "1part-1widget" to not confuse documents, views, widgets and parts [03:03] <teatime> ok [03:03] <teatime> apaku: perspective shift, basically [03:03] <adymo|mac> when i say doc and view i mean sublime::document and sublime::view [03:04] <teatime> gotcha [03:04] <-- apol has left this server (Remote closed the connection). [03:04] <apaku> teatime: well, I'm not that blind, but I don't know the API that adymo currently has and thus I don't see the problems you 2 see. [03:04] <apaku> teatime: plus the movie's still running in the background, so no music and I am really bad at thinking without some loud music in my ears ;) [03:05] <teatime> hehe [03:05] <adymo|mac> lol [03:05] <apaku> But the movie is done in 10 minutes, then I'll look at solving your puzzle's. [03:05] * apaku is good at traditional puzzle's :) [03:05] <teatime> I'm really bad at thinking with crap commercial radio at microvolume in the background [03:06] * teatime is aware of that from work [03:06] <adymo|mac> apaku: to make yourself familiar, take a look at what happens to views in eclipse when you switch perspectives and create new eclipse mainwindows [03:06] <adymo|mac> then take a look at my example app [03:06] <teatime> nothing is as distracting and frustrating as trying to hear something you don't want to listen to.. [03:07] <apaku> teatime: lol. When working at IBM we were 5 people in one office and nearly everybody had headphones :) [03:07] <-- dario_ has left this server (Read error: 113 (No route to host)). [03:07] <adymo|mac> teatime: are there alive people that do not use headphones? ;) [03:07] <apaku> adymo|mac: I have worked eclipse for the better part of the afternoon and evening. I don't want to see that thing again ;) [03:07] <teatime> adymo|mac: the phone rings too often.. ;) [03:08] <adymo|mac> hehe [03:08] <adymo|mac> ok, back to our thing [03:08] <teatime> adymo|mac: anyway.. as I understand puzzle 1 then.. area1 needs two widgets and area2 needs 3, correct? [03:09] <teatime> and it's all the same document and the same part [03:09] <adymo|mac> yes, and the question is which widgets to reuse and where? [03:09] <adymo|mac> teatime: the same document (and you can imagine the same kate part) [03:09] <teatime> right [03:11] <teatime> adymo|mac: crap :( [03:11] <teatime> I see no way out [03:11] <adymo|mac> lol [03:11] <adymo|mac> teatime: now you understand why i took a long break today ;) [03:11] <teatime> if we merrily create another view, then the obvious question is: what happens when we change back? [03:12] <teatime> do we destroy one? and which one? [03:12] <adymo|mac> teatime: s/destroy/hide [03:12] <adymo|mac> but which one is a good question [03:12] <teatime> well.. just hiding is also an issue.. sooner or later we have hundreds of these buggers [03:13] <teatime> or maybe I'm stretching it a bit ;) [03:14] <adymo|mac> teatime: in any case i don't see a way to not confuse the user [03:14] <teatime> right [03:14] <adymo|mac> teatime: on a first (forward) switch the question is not reuse, but mostly placement [03:15] <adymo|mac> teatime: but on the backwards switch the question is indeed which 2 of 3 will remain [03:16] <teatime> adymo|mac: btw, a hidden widget on area2 when we're in area1.. will mean that even when we've closed all visible traces (all widgets on area1) of a file, the part won't unload [03:17] <adymo|mac> teatime: currently yes [03:17] <teatime> .. with all the confusion we can expect from that [03:17] <adymo|mac> teatime: but that's another story, much easier [03:17] <adymo|mac> imho of course [03:18] <teatime> is it, really? what if in area1 we then decide to look at this file again? create a new view, or reuse the one hidden on area2? [03:18] <adymo|mac> teatime: currently reuse [03:19] <adymo|mac> teatime: you will create a new view and view will reuse the widget [03:19] <teatime> then again, close it. then switch to area2. now we expect to see it again, but is it still loaded? [03:20] <adymo|mac> teatime: if you remove the view, but a widget will be used by another view, a widget will not be destroyed [03:20] <adymo|mac> (i'm not sure it works now this way though) [03:22] * adymo|mac really starts thinking of enforcing 1mainwindow -> 1area design [03:23] <teatime> adymo|mac: meaning what? no cloning? :) [03:23] * teatime reads puzzle2 [03:23] <apaku> adymo|mac: Speaking of eclipse: I had ghost views today with eclipse. Moving 2 toolwindows around they "vanished" from current perspective and showed up in another perspective. But I couldn't remove them there, I first had to restart eclipse... [03:24] <apaku> Me is shutting down dvd player now... [03:24] <adymo|mac> teatime: no, no reusing and no switching ;) [03:24] * teatime suspects apaku is trying to say something ;) [03:25] <apaku> $BRAIN slowly goes to working temperature ;) [03:25] <teatime> adymo|mac: but multiple mainwindows.. or? [03:25] <adymo|mac> teatime: yeah, that would enforce multiple mainwindows [03:26] <teatime> I can't really say I immediately disagree.. :) [03:26] <adymo|mac> me too, but let's see if we can find solutions to those puzzles [03:26] <teatime> perspective shifts in eclipse always feel fidgety, somehow [03:26] <adymo|mac> teatime: those two are the problems of "reuse" mostly, not switching [03:28] <teatime> ok.. for multiple mainwindows, puzzle1 has no choice.. it's another widget instance (and possibly another part instance) [03:28] <adymo|mac> yep [03:28] <teatime> that felt easier :) [03:28] <adymo|mac> a lot easier i must say [03:31] <teatime> adymo|mac: "view3 and view4 now reuse the same widgets" - that's a confusing way of putting it [03:31] <teatime> you mean view3 reuses the widget of view1 and view4 reuses the widget of view2, right? [03:32] * adymo|mac corrects [03:33] <teatime> adymo|mac: I guess puzzle2 is reduced significantly if we stay with 1mainwidow-1area [03:34] <teatime> but areas are still meant to be cloneable, right? [03:34] <teatime> so two mainwindows can display the same thing.. or? [03:35] <adymo|mac> teatime: #2 is not that hard to solve even with switching and reuse [03:35] <adymo|mac> teatime: it's just f..ks up the whole architecture [03:35] <teatime> heh [03:35] <teatime> and if we remove switching? does that help? [03:35] <adymo|mac> teatime: but without reuse a simple cloning would do the job [03:36] <teatime> right [03:36] <adymo|mac> teatime: switching does gets in the way stil [03:37] <-- jstaniek has left this server (Read error: 54 (Connection reset by peer)). [03:37] <adymo|mac> teatime: imagine you'll show area1 in mainwindow1 and switch to area2. then you show area1 in mainwindow2 [03:37] <adymo|mac> now when you switch back to area1 in mainwindow1 you'll get a clone [03:37] <adymo|mac> which is sorta confusing [03:37] <teatime> aye [03:38] <adymo|mac> alternative way would be to clone area1 immediatelly which is less confusing [03:39] <teatime> sounds like likely unneeded overhead though [03:39] <teatime> since that'd only be necessary if a second mainwindow was created [03:40] <adymo|mac> teatime: well, the second mainwindow can show a clone from the beginning [03:41] <adymo|mac> teatime: still, switching does not impose as many troubles as reuse [03:41] <teatime> adymo|mac: I haven't really thought about this when I've used it, but it's my impression that eclipse only has one set of editors [03:42] <teatime> so maybe that's simply reused, and the toolviews are recreated? [03:42] <teatime> since the editors is what you are likely to have a large number of, and toolview relatively few, that should keep the resource usage down [03:43] <teatime> adymo|mac: of course, we want to do better ;) [03:43] <adymo|mac> teatime: eclipse 1) does have the only one set of views 2) does not allow two similar toolviews to be shown in one mainwindow [03:43] <adymo|mac> teatime: thus solving the core of "reuse" problem [03:44] <teatime> does it have multiple mainwindows? [03:44] <teatime> I dont think I've seen that from the IDE [03:44] <adymo|mac> teatime: when you have only 1 view in old area and 1 view in new area you don't have puzzle1 [03:45] <teatime> true [03:45] <adymo|mac> teatime: you can create the new mainwindow in eclipse, and it will "clone" the perspective [03:45] <adymo|mac> where "clone" is not exactly equal to "clone" in sublime [03:46] <apaku> adymo|mac: though I still don't follow you two and thus I may be misunderstanding you: Eclipse does allow for 2 similar toolviews in the same perspective. You can have as many console views as you want, for example. [03:47] <adymo|mac> teatime: but the point is that we do want to have different set of views for different areas (remember xcode like debugging) [03:47] * teatime wishes he had run xcode [03:48] <teatime> apaku: so what happens when you shift perspective? [03:48] <apaku> adymo|mac: Of course when I try it now, it doesn't allow that :( [03:48] <teatime> heh [03:48] <adymo|mac> apaku: but those consoles show the same thing? [03:49] <apaku> And actually I think that was the problem this afternoon, somehow I managed to move a Server view from Debug to Java perspective and then could only close 1 of them (java already had 1) there. [03:49] <adymo|mac> teatime: when you have 3 consoles in "java" and switch to "debug" you get only one remained [03:49] <apaku> Also when creating new views in debug perspective they were actually put into java perspective. [03:50] <-- milliams has left this server (Read error: 104 (Connection reset by peer)). [03:50] <teatime> that sounds like a bug [03:50] <apaku> adymo|mac: Right, and that is a feature special to the console view I think. None of the other views has this. [03:50] * teatime is more and more leaning towards topwindows [03:51] * adymo|mac was about to say that too :) [03:51] <apaku> I should know more about views and perspectives, since I had to fight with them some time back when he wrote an RCP app.... [03:52] <teatime> adymo|mac: good thing mattr isn't here.. ;) [03:52] <adymo|mac> i start to think that perspectives idea is "broken by design" [03:52] <teatime> yeah.. take a really simple example: open 1 file. switch perspective. is the file open? [03:52] <teatime> the programmer says "yes", does the user? [03:53] <apaku> BTW: eric3 and eric4 have a kind of mini-perspective implementation [03:53] <teatime> adymo|mac: it's certainly "confusing by design" [03:53] <adymo|mac> teatime: yep [03:54] <adymo|mac> teatime: that's why i fawor multiple mainwindows idea [03:54] <apaku> They offer 2 perspective's with a configurable amount of widgets. In eric3 the positions of the widgets were fixed in eric4 due to QDockWidgets they can be moved around I think. [03:54] <adymo|mac> *favor [03:54] <teatime> I'm leery of a design that lets me forget I have a shitload of stuff open in another perspective, just sucking resources [03:54] --> shnee has joined this channel (n=CurtyD13@cpe-24-26-131-198.columbus.res.rr.com). [03:55] <teatime> adymo|mac: right. everything open is visible [03:55] <adymo|mac> teatime: multiplemainwindows-only operation will solve this problem [03:55] <adymo|mac> exactly [03:55] <teatime> that's a HUGE usability improvement [03:55] <adymo|mac> teatime: now i understand why xcode looks like it does - tons of toplevel windows :) [03:55] * teatime is starting to too [03:56] <adymo|mac> teatime: you won't end up opening 100 files in xcode :) [03:56] <teatime> adymo|mac: umm.. I hope I don't get a new mainwindow for every file? :) [03:56] <adymo|mac> teatime: no, we don't want to copy xcode too :) [03:57] <teatime> no, that'd blow.. jeez