Page 2 of 2

Re: [1.3.b69] CSS and Chat

Posted: Sat Jun 19, 2010 6:21 pm
by Ghiolekk
Nice looking stuff, maybe I'll create some automated macros for my treasure.

Re: [1.3.b69] CSS and Chat

Posted: Tue Jun 29, 2010 10:57 pm
by biodude
Azhrei wrote: The first element that appears in the chat panel which is NOT valid inside the <head> is probably what triggers the Java code to switch from the head to the body. And once switched, you can't get back. :(
Not from what I can tell, although macro output does get ... altered ... considerably on the way to chat. For example, a macro containing this:

Code: Select all

<link rel="stylesheet" type="text/css" href="styles.css@[R: getMacroLocation()]"> <!-- Custom stylesheet.  "@this" will not work -->

<!-----===== OnCampaignLoad =====----->
<b>HTML START</b>
<p>paragraph <em>of text</em>.</p>
Produces chat output like this in html (even if it is the first thing that runs):
Chat output

Code: Select all

<html>
  <head>
    <style type="text/css">
      <!--
        body { font-family: sans-serif; font-size: 12pt }
        div { margin-bottom: 5px }
        span.roll { background-color: #efefef; background-attachment: scroll; background-repeat: repeat }
        span.trustedprefix { background-color: #D8E9F6; background-repeat: repeat; background-attachment: scroll; color: #000000 }
      -->
    </style>
    
  </head>
  <body id="body">
    

    <div>
      <table cellpadding="0">
        <tr>
          <td style="padding-right: 5px" valign="top" width="40">
            <img src="asset://1f5ffdc593cfe553ae7ade46afd1174c-40">
            
          </td>
          <td style="margin-right: 5px" valign="top">
            Lib:style:
          </td>
          <td valign="top">
            
          </td>
        </tr>
        <!-- Custom stylesheet.  "@this" will not work -->
        <!-----===== OnCampaignLoad =====------>
        

        <tr>
          <td>
            HTML START

            <p rel="stylesheet" type="text/css" href="styles.css@Lib:style">
              paragraph <em>of text</em>.
            </p>
          </td>
        </tr>
      </table>
    </div>
  </body>
</html>
From what I can tell, when 'onCampaignLoad' macros are loaded, there is absolutely no output to chat. The output above was generated by clicking on the 'onCampaignLoad' macro manually.

Next, notice in the html how the macro output was not simply 'dumped' to the chat?
  • The <b> tags around the first line of actual text are missing
  • The <link> tag is missing, but the comments are still there (between rows of the formatting in chat?) :?
  • the attributes of the link tag in the first line have been added to the <p> tag later on. :shock:
So, no go on the "sneak a stylesheet in during chat load" idea :(
Azhrei wrote:Some day we'll have an entry in the Campaign Properties where the GM can provide a URI to a global stylesheet. But don't hold your breath.
I would actually consider this an accessibility issue. The current preferences allow you to change the size of the font, but not the font face, or colours. Or all other manner of things CSS is designed for.
What about a text box in the "Accessibility" tab of the application preferences where a user could write/paste a personal stylesheet, which is loaded in the header of the chat html?

I don't know anything about the technicalities of how the chat is rendered, I'm just thinking from a user perspective. But, I can see it being a choice between loading all the CSS once at the beginning, or trying to re-draw the entire chat panel () with new CSS rules.
What about a compromise whereby the chat html & CSS is re-loaded when it is cleared (/clr), including a custom statsheet?

Re: [1.3.b69] CSS and Chat

Posted: Tue Jun 29, 2010 11:56 pm
by Azhrei
biodude wrote:I don't know anything about the technicalities of how the chat is rendered,
Well, I'm no expert but I know a little about it. And from what I've seen, the Stylesheet object would need to be applied to each Document object after it's created. That means anywhere in the code that pops up an HTMLPane (and hence instantiates a Document object), anywhere that has HTML inside a label or button or checkbox or dropdown list, or anywhere else that HTML is rendered would need to have the Stylesheet object assigned to it. And that's a whole boatload of code we're talking about changing!
I'm just thinking from a user perspective.
The UI is not a problem. There are lots of ways to answer the question of how to get the CSS into the program in the first place -- that's a piece of cake. It's what has to be done with it once it's in there that's a problem. :(

We really need a better HTML rendering engine, but that's been discussed before as well. I weighed in on that discussion as did Craig, jfrazierjr, and Phergus (IIRC). It's a pretty old thread now; perhaps 8 months or so...?

Re: [1.3.b69] CSS and Chat

Posted: Wed Jun 30, 2010 8:31 am
by jfrazierjr
Azhrei wrote:We really need a better HTML rendering engine, but that's been discussed before as well. I weighed in on that discussion as did Craig, jfrazierjr, and Phergus (IIRC). It's a pretty old thread now; perhaps 8 months or so...?
Yea, and as noted in that thread, "better" still does not mean compliant with the current html/css standards by any stretch, so it's not a be all, end all solution. Plain and simple java is just behind the times in ways to support current html standards... which is probably why browsers are not written in java very often.

Re: [1.3.b69] CSS and Chat

Posted: Wed Jun 30, 2010 2:59 pm
by jfrazierjr
I just noticed JRex in a search. It is based on the Mozilla renderer.... The page had no specific information about HTML/CSS support, but I would expect that it would work fairly well since it's based on the Mozilla renderer(which I can't remember the name of now and don't have the time to look up ATM).

They have not tested on Mac, so that might be an issue... perhaps someone with a Mac can run their webstart demo???

Re: [1.3.b69] CSS and Chat

Posted: Wed Jun 30, 2010 7:14 pm
by Azhrei
You're thinking of Gecko?

Apple has done a lot of work on WebKit but it's written in C++, IIRC. Still, might be interesting to add a JNI that provides access to it from Java. It's super fast, very standards compliant, and open source (although I don't know what the license details look like).

If I get a chance I'll take a look at that demo at some point...

Re: [1.3.b69] CSS and Chat

Posted: Tue Nov 29, 2016 9:16 pm
by Irrlicht
This thread is ancient, but I feel like renewing the request for using stylesheets inside macros' output to chat.
It would be very helpful and pleasant.

Also, a general upgrade of HTML and CSS wouldn't be bad, since certain tags/options still can't be used in MapTool, and they'd help much into formatting output.

Re: [1.3.b69] CSS and Chat

Posted: Tue Nov 29, 2016 10:43 pm
by JamzTheMan
Moving to JavaFX should open that up for us. It's a plan, just a, "ug, ok who's redoing all the UI for us?" thing. It's usually an all or nothing thing (although you can mix swing and FX components, they operate on different threads so you have to mind your p's and q's...)

We should then be able to use HTML5 and all that... And of course, while updating the UI there may be a lot of new components we can toss in to add functionality, add in multiple chats, separate logs from chats, etc...

Only thing we need is time. Anyone have some surplus to throw at us? :)