[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Miniwindows
. . -> [Subject]  Can't move miniwindow

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Can't move miniwindow
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Thu 20 Aug 2009 07:05 AM (UTC)  quote  ]
Message
Quote:

I can't move my miniwindow. No matter what I put in the left and top properties, it does not move.


Functionality to move miniwindows was introduced in MUSHclient 4.40, and the module described in the thread below simplifies this somewhat, so you can add "drag to move" capability with only a few lines of code:

http://www.gammon.com.au/forum/?id=9594

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Mon 25 Aug 2008 12:58 AM (UTC)  quote  ]
Message
Quote:

... but does MUSH support PNG files?


Version 4.36 will read PNG files, however it is currently discarding the alpha information.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Fri 01 Aug 2008 11:49 AM (UTC)  quote  ]
Message
cheers Nick
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Fri 01 Aug 2008 01:04 AM (UTC)  quote  ]
Message
There is no default font - when drawing you have to specify a font ID, and thus making some sort of default would mean inventing a default font ID as well. This line of code will do it for you:


WindowFont (win, "f", GetAlphaOption ("output_font_name"), GetOption ("output_font_height"))


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Thu 31 Jul 2008 04:23 PM (UTC)  quote  ]
Message
Quick question Nick (or anyone) - if we do not specify a text size and font for a miniwindow, will the size and font used in the output window be the default for the miniwindows? If not, can it be set that way?
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Wed 30 Jul 2008 03:45 PM (UTC)  quote  ]
Message
Hmm. I would have thought there where hardware/windows support functions you could use to blit transparency... This shouldn't be complicated, since the means to do it is available already in most OSes. Mind you, the feature *is* limited, at least in one application I use, which has it, to Windows 2000 and higher, and may have the same issue (requiring DirectX) as the new sound feature.

Also, note, if you add png, you need to be careful you are using, and using correctly, the official libraries for them. A lot of applications get this wrong and end up screwing up transparency support, or otherwise introducing annoyances in how it works (including nearly 100% of them which completely mangle Gamma correction, when that data is stored in the file). In general, you can tell if the later is working by how it adjusts the colors. Bad implementations tend to.. well, get it wrong.. This usually means that if you had an image with red, green, blue and yellow, where, well, its hard to describe, but the test file is constructed so you have four outer boxes, and four inner boxes, and on a gamma that "works right", the 5 inner boxes are "corrected" down to 50% color. On wrong implementations, it corrects all the middle boxes, but also the outer yellow, so that, instead of having 8 colors, you have 7. Most of these buggy versions are not fixed in **anything**, when/if gamma is supported at all. :(

Same glitch happens in gray too:

http://entropymine.com/jason/testbed/alphagamma/

Firefox 3.0 gets this wrong, and its usually better than most of the applications out there are getting it right.

Frankly, as sad as it is, your probably better off ignoring the gamma feature in libpng, since no one seems to "ever" make it work right. Well, except for a few graphics applications, and, at one point, even Photoshop screwed it up.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Wed 30 Jul 2008 05:29 AM (UTC)  quote  ]
Message
I don't support PNG right now, it would need a loader that handles it. Probably not a huge deal, but right now you can use Irfanview to convert a JPG, GIF or PNG to a BMP in about 2 seconds.

For the non-rectangular concept, I already support transparency. If enabled, the colour in pixel position 0,0 is the transparency colour (after all you have 16,777,216 colours to play with, so losing one isn't going to be a big deal).



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Tue 29 Jul 2008 10:55 PM (UTC)  quote  ]
Message
It is easier to draw things that have complete transparency than things that are in between. To draw something completely transparent, you just don't draw it. :-) So a .png with an alpha channel that is binary (0% or 100%) things should be (relatively) easy. It gets complicated (for the reasons Nick mentioned) when you need to blend two images together from different pixel buffers.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Tue 29 Jul 2008 10:52 PM (UTC)  quote  ]
Message
Well, the idea was that it could have some non-rectangular forms. Think of the image of a half-unrolled scroll as background, with the actual mudcontent sliding behind it when it happens to overlap.

Maybe it would need two drawing styles for drawing PNGs then, then. ^_^ One to draw transparently while only regarding the current miniwindow, while the other would also take into account actual mud output.

But I'm not too sure on the implementation details, so yeah... >_>
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Tue 29 Jul 2008 10:06 PM (UTC)  quote  ]
Message
Drawing a translucent PNG onto a miniwindow shouldn't be expensive as long as you're not trying to draw it on top of something other than the background. Still, if the miniwindow is constructed as a pixel buffer, and then blitted in one go, it should be ok to draw on top of stuff already there -- where "there" is the miniwindow, not the main window behind it. Since that would use a different drawing buffer, retrieving pixels from it would be expensive, as Nick said.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Tue 29 Jul 2008 09:59 PM (UTC)  quote  ]
Message
Could always add a new global preference "Support alpha-blended drawing routines" or something, which would enable the more elaborate kind of drawing.

Which reminds me.. I haven't put too much attention into miniwindows yet, but does MUSH support PNG files? I'd love to use some PNG images with alphachannels (full and partial transparency) for my miniwindows. Of course it would only support such drawing with the above option on, but I think it could make an awesome addition.
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Tue 29 Jul 2008 09:20 PM (UTC)  quote  ]

Amended on Tue 29 Jul 2008 09:22 PM (UTC) by Nick Gammon

Message
I'm taking a look at transparency, however I should point out that semi-transparent windows with text showing through other text involves quite a large processing overhead.

To simply copy an opaque window to the output area you can "blit" the pixels across, which is a single operating system call, and designed to be fast.

To have semi-transparent text, you need to pull in the existing text, go through pixel by pixel to reduce it to (say) 50%, then merge the new text on top of it, then put it all back.

For example, for a 400 x 400 pixel window, that is 400 x 400 x 3 bytes (RGB) that need to be processed, in other words 480,000 bytes - half a megabyte almost. To process 480,000 bytes every time a line arrives from the MUD might be regarded as a bit of an overhead.

On a fast PC, and a smallish window, this will probably work. But if you have a half a screenful of chats, on top of other text, and you try that, next I will be fielding complaints that MUSHclient is "too slow ever since you added that transparent window stuff".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Tue 29 Jul 2008 06:52 PM (UTC)  quote  ]
Message
Hmm. Yeah. You have a point Nick. Even partial is going to be an issue with transparency. Mind, if/when you provide some means to display images in these, then a number of things, like the map, could be redone with that. In my case, its not likely a problem, because I have enough screen space to make the mushclient window full screen, then tack the minis to the right edge. However, since I can't "lock" the main window, I can't prevent accidentally sizing that to the full width, and messing myself up. :p Its still nice to have transparency, since it may be usable later, and some cases it may be usable now, the point isn't to make it 100% readable, necessarily, just possible to see what is behind it.

For example, in the case of click through, someone could set it to be 100% transparent when the mouse is "over" the window, and 80% opaque when not hovering over it. This would let them see it well enough to know what is there, while also letting them select text, or quickly "hide" the window, without well... actually hiding it, or closing it.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Tue 29 Jul 2008 07:07 AM (UTC)  quote  ]
Message
You can do the following with miniwindows:


  • Put them absolutely wherever you want, by specifying an absolute coordinate.

  • Hide them altogether if they aren't wanted right now, however still update them in the background (eg. an inventory that is updating, but you are in a fight and don't want to see it)

  • Dock them to any of the 4 corners, or the 4 sides, or the middle, in which case they automatically track the window as you resize it.

  • If docked to the middle of a side, you can have multiple ones as they shift around to make room for newcomers.

  • You need to know its height and width, true, but you should know that. In some of the plugins I have been writing (like a quest tracker) I cache the items I need to display first - which I need to do anyway to avoid flicker. Then when all is received I know 2 things - 1) the number of items, which gives me the height, and 2) the maximum width of all the items, which gives me the window width.



So yes, I think you can do it with a minimum amount of fuss. I have released about 5 plugins so far that demonstrate the general idea, and I reworked all of those from ones that used dummy windows or notepad windows, with not a heap of effort.

However the end result looks much better.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Demonsurfer   USA  (256 posts)  [Biography] bio
Date Tue 29 Jul 2008 01:36 AM (UTC)  quote  ]

Amended on Tue 29 Jul 2008 01:51 AM (UTC) by Demonsurfer

Message
Let me start by saying I have not had an opportunity to play with this yet, and probably wont for a least a few weeks due to a busy schedule. Having said that,

AWESOME, THANKS NICK!!!!

I've been badgering for a multicolor status window for years!

Going on what I've read here, the main thing I'd like is full user control of where the miniwindows sit and what dimensions the miniwindows have, at least as an option. Perhaps this is currently do-able via script (much the same way as I open several notepad windows now and position them alongside my world window, which I use for tells, spell status, and various other bits of info), however I got the impression from this thread that the position is entirely automated and I have liitle control where the miniwindow appears, which to me just doesn't sound right.

The miniwindow create/move/resize info page ( http://www.gammon.com.au/mushclient/mw_creation.htm ) seems to say we can only choose which corner of the output window the miniwindow sits (or else centers at the right, top, left, or bottom side of the output window)..

Actually I might be wrong here.. I CAN specify the 'internal' dimensions of the miniwindow itself, so as long as the miniwindow itself is positioned in one of those 8 primary positions, I should be ok..

For example, when I open a world right now, I run a script 'world_open':

sub world_open
   MoveMainWindow 0, 0, 1050, 995
   world.SendToNotepad "STATUS", "status window generated.."
   NotepadFont "STATUS", "WhiteRabbit", 9, 0, 0
   NotepadColour "STATUS", "#FAEBD7", "#000000"
   MoveNotepadWindow "STATUS", 705, 0, 333, 675
   world.SendToNotepad "COMMS", "communications window generated.."
   NotepadFont "COMMS", "Verdana", 8, 0, 0
   NotepadColour "COMMS", "#FAEBD7", "#000000"
   MoveNotepadWindow "COMMS", 705, 675, 333, 245
   MoveWorldWindow 0, 0, 705, 920
   AddTimer "resize_my_world", 0, 0, 0.5, "MoveWorldWindow 0, 0, 705, 920", 5 + 32, ""
   SetTimerOption "resize_my_world", "send_to", 12
   world.ReplaceNotepad "STATUS",""
   world.ReplaceNotepad "COMMS",""
end sub

This resizes MUSHclient itself, creates the 2 notepad windows to the right of my output window which combined equal the full height of the output window, and repositions the output window if for some reason I had previously had it manually resized.. (there's some additional code there that is there for other reasons).

So I guess I just need to add the width of the notepad windows above onto my existing output window, then create miniwindows, one positioned top right, one positioned bottom right, with the internal dimensions that can be easily calculated taken from the above script..

Correct?
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


8,495 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]