Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I7: Custom Glulx styles in status line

8 views
Skip to first unread message

mwigdahl

unread,
Nov 23, 2009, 10:29:00 AM11/23/09
to
There doesn't seem to be an obvious way to inject custom styles into
the status line in vanilla I7. Does anyone know of a way this can be
done, or am I going to need to bite the bullet and learn I6 and glk to
achieve this?

Matt

Erik Temple

unread,
Nov 23, 2009, 11:04:42 AM11/23/09
to

What exactly are you trying to do? I submitted an extension back in
June that allows you to change the background color of the status
window (among other things, including removing the status line
completely and controlling when it opens and closes). It hasn't been
posted to the extensions library yet, unfortunately. I could post a
link later today if that covers your needs. It probably doesn't,
though...

I don't remember the details, but it may be that most styles for the
status window are hard-coded into the library. I'll take a look this
afternoon if you don't hear back from anyone before then.

--Erik

P.S. I think that I posted a link to the extension on raif soon after
writing it, but can't find it using google group's search.

mwigdahl

unread,
Nov 23, 2009, 12:07:43 PM11/23/09
to

What I'm trying to do is to display text in the status line or in a
status-line-like window with the standard dark grey background and
with different foreground colors. Ideally the effect would be like
what Eric Eve's Exit Lister extension produces under the Z-machine.

I originally tried to accomplish this through creating a one-line
Glulx text-buffer window below the status line, which worked fine but
doesn't look quite right and causes rendering anomalies in Git and
Glulxe. I've tried to use a text-grid window in the same manner
(delving a bit into I6), and this renders fine in Git, but I seem to
either get a white background with colored text or a colored
background with white text, depending on my text-reversal settings; I
don't seem to have the magic formula to decouple the white from the
text, if that's even possible.

Here's a sample of the code I'm using to do this (using Flexible
Windows as a base):

***

The exits-window is a g-window.
The exits-window is spawned by the main-window.
The position of the exits-window is g-placeabove.
The scale method of the exits-window is g-fixed-size.
The measurement of the exits-window is 1.
The type of the exits-window is g-text-grid.
The exits-window has back-colour g-black.

Last when play begins (this is the create exits-window rule):
choose a row with style name of special-style-2 in the Table of User
Styles;
now the boldness entry is regular-weight;
now the fixed width entry is fixed-width-font;
now the glulx color entry is g-white;
choose a row with style name of special-style-1 in the Table of User
Styles;
now the boldness entry is bold-weight;
now the fixed width entry is fixed-width-font;
now the glulx color entry is g-red;
initialize user styles grid-style; [much like Emily Short's Glulx
Text Effects extension call, just applies to text-grid windows...]
unset-reverse; [from Jon Ingold's Flexible Windows extension -- turns
off text reversal]
open up the exits-window;
consider the drawing rule of the exits-window;

mwigdahl

unread,
Nov 23, 2009, 2:29:33 PM11/23/09
to
On Nov 23, 11:07 am, mwigdahl <m...@wigdahl.net> wrote:
> On Nov 23, 10:04 am, Erik Temple <ek.tem...@gmail.com> wrote:
>
>
>
> > On Nov 23, 9:29 am, mwigdahl <m...@wigdahl.net> wrote:
>
<snip>

OK, after poking around a little I think I've found a good way to do
this. I've got the window generated and the text behaving as I want,
but the last step is to synchronize my custom window's color with the
status line's color.

I implemented the following to do this, and it works great in the I7
Windows IDE and in the latest Filfre, but seems to crash the Git that
comes bundled with Gargoyle for Windows. If I comment out the I6
inclusions and just have the set action return some random number, the
status line gets set to the corresponding color in Git just fine.

Am I doing something obviously funky here, or is it possible this is a
bug in Git?

***

[interrogating the status line about its color]

To set (n - a number) to be the status line mimic color:
(- {n} = GetStatusLineColor(); -).

Include
(-

[ GetStatusLineColor col;
col = 0;

if (gg_statuswin)
glk_style_measure(gg_statuswin, style_normal, stylehint_backcolor,
col);

return col;
];

-)

Erik Temple

unread,
Nov 23, 2009, 4:57:08 PM11/23/09
to
On Mon, 23 Nov 2009 13:29:33 -0600, mwigdahl <ma...@wigdahl.net> wrote:

> On Nov 23, 11:07 am, mwigdahl <m...@wigdahl.net> wrote:
>> On Nov 23, 10:04 am, Erik Temple <ek.tem...@gmail.com> wrote:
>>
>>
>>
>> > On Nov 23, 9:29 am, mwigdahl <m...@wigdahl.net> wrote:
>>
> <snip>
>
> OK, after poking around a little I think I've found a good way to do
> this.

Cool. Your OP seemed to indicate that you wanted to do this in a single
text-grid window, rather than two side by side windows. If that is still
your goal, I think there are two things you could do to make this happen.
(Either of these would also be an option if you can't solve the bug).

(1) Stop the library from setting the reverse-style hint, then revamp your
custom text-grid style hint settings to target the status window
specifically, or

(2) Implement whatever you're using the status window to do in your custom
window and just don't use the status window at all.

The extension I referred to in my response can do the first part of #1,
and you could easily write wrappers (looks like you have already) for the
stylehints, directing them to the status window rather than your custom
window. Flexible Windows can do most or all of #2.

Here's a link to the status window control extension I mentioned:

http://dl.dropbox.com/u/947038/Glulx%20Status%20Window%20Control.i7x

This only implements one stylehint, the background color, but others could
implemented in the same way (or as you seem to have done, by creating a
parallel structure to what Glulx Text Effects does for text-buffer
windows).


> I've got the window generated and the text behaving as I want,
> but the last step is to synchronize my custom window's color with the
> status line's color.
>

> Am I doing something obviously funky here, or is it possible this is a
> bug in Git?
> ***
> [interrogating the status line about its color]
> To set (n - a number) to be the status line mimic color:
> (- {n} = GetStatusLineColor(); -).
> Include
> (-
> [ GetStatusLineColor col;
> col = 0;
> if (gg_statuswin)
> glk_style_measure(gg_statuswin, style_normal, stylehint_backcolor,
> col);
> return col;
> ];
> -)

I'm not *sure* what the cause of the bug is, but I think that you are not
using "col" correctly to return results; I believe the result is returned
from glk_style_measure as a pointer to an address rather than a single
value. See if this works:


[ GetStatusLineColor ;


if (gg_statuswin)
glk_style_measure(gg_statuswin, style_normal, stylehint_backcolor,

gg_arguments);
return (gg_arguments-->0);
];


Another thing you could try is setting the color as a decide phrase plus
variable assignment instead (this form seems more natural to me):

To decide what number is the status line mimic color:
(- GetStatusLineColor(); -).

Set the background color to the status line mimic color.

I'm not sure this will make any difference, but if it doesn't, you'll know
to look at the internals of the I6 routine rather than the I7 wrapper.

Good luck!

--Erik

mwigdahl

unread,
Nov 23, 2009, 5:37:04 PM11/23/09
to
On Nov 23, 3:57 pm, "Erik Temple" <ek.tem...@gmail.com> wrote:

Bingo, Erik! Changing the return value to dereference from
gg_arguments did the trick! I had already shifted to the "to decide
which number" formulation as you suggested, which is indeed a cleaner
formulation. Now works correctly in the IDE, on Git 1.2.4, Glulxe
0.4.4, and the latest Filfre. Thanks a whole lot for your help!

Matt

Eliuk Blau

unread,
Nov 26, 2009, 1:09:00 AM11/26/09
to
On 23 nov, 18:57, "Erik Temple" <ek.tem...@gmail.com> wrote:
>                 (- GetStatusLineColor(); -).
>
>         Set the background color to the status line mimic color.
>
> I'm not sure this will make any difference, but if it doesn't, you'll know  
> to look at the internals of the I6 routine rather than the I7 wrapper.
>
> Good luck!
>
> --Erik

GetStatusLineColor() -> glk_style_measure()

Hey Erik! =D Nice trick!

0 new messages