Hello everybody, Lately I've tried to use OSWindow to display some "system morphs" in external windows. I thought it could be handy mainly for people working on multiple displays so they could open a debuguer in a display while seeing the results in another one for example or many other cases.
I've developped a prototype and if you are interested you can find it by loading OSWindow + OSWindow-SDL2-Canvases : Gofer it smalltalkhubUser: 'Pharo' project: 'OSWindow'; package: 'OSWindow-Core'; package: 'OSWindow-SDL2'; package: 'OSWindow-SDL2-Canvases'; load. Inside there is only support for Nautilus, Playground and Transcript. To launch them you can evaluate the following commands: Nautilus openInOSWindowOnPackage: nil. GTPlayground openInOSWindow. ThreadSafeTranscript openInOSWindow. They are not really functionnal because I only implemented some things here and there. What you can probably use are : - The little boxes on the topleft. - Shortcuts but there is probably a bug so you can only use "alt" on Linux. - Right click menus only in Nautilus and in the three top panes. - The printIt popper Morph in the Playground should work too. - There is some persistence but only when you "save and quit". If you save and then quit without saving the windows won't persist. If you want to try it feel free to try eveything you want but keep in mind that : - It is very buggued (especially the menus) - It is probably unstable so try it in a dedicated image :p - Many things are not doable and will result in weird behaviours or bugs - The code is probably very bad - I've coded it on Linux and the last time I tried it on windows it didn't work well at all so it probably won't work on windows. I don't know for mac. That being said, I am willing to start again and to do it properly "for real" but for Bloc instead of Morphic and this is the reason of this mail. As I am very new to all this and very unexperimented, I'd like to have your insight about some things and maybe a bit of help too :p First, to start on a solid basis I need to find the best possible architecture / pattern to develop it. The first requirements I can think of are the following : - The user must be able to chose if he wants to open these Morphs in the world or in external windows. - It should not be too difficult for him to open them in external windows (a button or an option or a shortcut, I don't really know but it is not really cool to evaluate a command line). - It needs to be robust and evolutive. It means that, for example, if Nautilus was to change it should still be able to be opened in an external window without much trouble. If a whole new tool was to be added into Pharo it should be able to be opened in an external window without much trouble too. - If possible I'd like not to have to modify any Bloc code. If it is not possible then as little as possible. - These windows should be persistent but maybe not exactly like morphs. It could be a button that the user needs to press in the window to toggle the persistence on and off (a bit like in the world menu to stick it to the world if you see what I mean). So do you have any idea how I could structure the code to meet these requirements ? One idea was to use the strategy pattern to change between the world and an external window. But what could be the best way to "plug" this code to Bloc ? Maybe we could create some sort of a virtual "Bloc-Space" that would be dedicated to open all the OSWindow Morphs ? In my opinion the OSWindow is just another possible container to display the Morphs so it should not interfere with their underlaying mechanisms. If you look a bit at my prototype code, I took many shortcuts to take decisions based of some window events but I think it is plain bad. The events should just be relayed to the Morphs and the Morphs (their controller) should be responsible for taking a decision and controling the window. All in all, if you have any idea to help me do something clean it would be much appreciated (It will still be intern-code though but maybe I can make it not THAT bad :p) Thanks a lot, Matthieu