for i =1,8 do
WindowCreate(tostring(i), 0,0, GetInfo(281)/3,GetInfo(280)/3, i+3, 0, 0x1a0000 * i) ;
WindowRectOp(i, 1, 10,10, -10,-10, 0, 0 ) ;
WindowShow(i)
end
The Window at #9 behaves as if there's no window in the #10 (SW corner) position.
Also,
for i =1,8 do
local pos = 5 ;
if i > 2 then pos = 7 end
WindowCreate(tostring(i), 0,0, GetInfo(281)/3,GetInfo(280)/5, pos, 0, 0x1a0000 * i) ;
WindowRectOp(i, 1, 10,10, -10,-10, 0, 0 ) ;
WindowShow(i)
end
The Window in the #5 position is centered along the remaining portion of the X-axis (shared by windows at 4,5 or 6), and Windows at #7 are centered along the Y-axis, but #5 is overlapped.
Quick question tho, how does a fix in case 10 affect how cases 5 and 7 share the space normally occupied by case 6? I don't see how it would affect the second code sample. :(
Then download "JojoDiff - diff utility for binary files" from:
http://jojodiff.sourceforge.net/
Then using a command window apply the patch as follows (ie. in your MUSHclient directory, and assuming you put jpatch-w32.exe there or somewhere in your path):
That will apply the patch to your existing MUSHclient.exe (the 4.37 version) - just the .exe not the installer - and give you a new file which is version 4.38 with the patch applied.
Note this may be an interim version of 4.38 - so far it only has this one fix in it.
Well, technically that is not a bug, it is by design. :-)
When I was doing the centering code my mind melt a bit trying to work out what was multiple simultaneous equations. I was aware that you might technically set up a situation like you have, where the centering top-bottom collided with the centering left-right (as in your example).
In your example, what would you consider the "correct" behaviour? If there isn't room for the left-right windows, which should take precedence? The up-down ones or the left-right ones? Whatever you answer, someone else may consider a different answer to be correct.
I simplified my calculations somewhat by considering the various cases independently - basically the left-right windows are centered between the corners (if any), and the up-down ones between their corners. It becomes recursive and somewhat difficult to predict if you the reconsider the results based on whether, as a result of centering up-down, the left-right ones have to be recalculated (or vice-versa).
You can make the code "fail" in various ways, for example, if you have various windows centered top-down, and then resize horizontally to be very small (ie. a long thin window in the Y direction) then the windows will overlap.
If anyone can look at my C++ code and suggest a better algorithm, that would fairly universally be considered correct, then they are welcome to suggest it. Already the relevant function (Calculate_MiniWindow_Rectangles) is fairly complex.
The fallback position for you is to go for "absolute positioning" and come up with an algorithm to position the various windows that satisifies your criteria, for this particular case. That is why I left absolute positioning in as an option to fall back on.