MATLAB ZPRINT CODE
Having thus completed the bulk of the hard detective/inductive work, I now had to contend with several other obstacles before the code could be released to the public: % See within the code: setElementStyle(docElement,'CW_BG_Color'.)
MATLAB ZPRINT UPDATE
% Now update the space character's style to 'CW_BG_Color' % it will also affect existing rendered strsĬom.('CW_BG_Color',cwBgColor) % This way, if the CW bg color changes (via File/Preferences), % Store the CW background color as a special color pref XCmdWndView = cw.getComponent(0).getViewport.getComponent(0) % Now update the space character's style to 'CW_BG_Color' % See within the code: setElementStyle(docElement,'CW_BG_Color'.) setColorPref ( 'CW_BG_Color',cwBgColor ) % Store the CW background color as a special color pref % This way, if the CW bg color changes (via File/Preferences), % it will also affect existing rendered strsĬom. % Get a handle to the Command Window component The hard part was to come up with this idea – implementation was then relatively easy: I then had an idea to simply hide the underline by setting the character style to the CW’s background color. I could however set its URL target to null () to prevent the mouse cursor to change when hovering over the space character, but cannot remove the underline. How can we ensure the color uniqueness for multiple colors? The answer was to simply use the integer RGB values of the requested color, something like ‘’.īut we still have the hyperlinked (underlined) space before our text – how do we get rid of it? I tried to set the relevant LinkStartTokens entry to -1 but could not: unlike SyntaxTokens which are modifiable Java objects, LinkStartTokens is an immutable numeric vector. So we can now set any style color (and underline it by enclosing the text in a non-target-url hyperlink), as long as we define a style name for it using tColorPref. I now played the hunch and changed the CW text element’s style name from ‘Colors_M_Strings’ to ‘yair’ and luckily the new green color took effect! But when I prepended a simple hyperlink space character I got what I wanted – I could now modify the subsequent text to any of the predefined syntax highlighting colors/styles.īut is it possible to use any user-defined colors, not just the predefined syntax highlighting colors? I then remembered my reported finding from the first post about CW colors that ‘Colors_M_Strings’ and friends are simply preference color objects that can be set using code like: I tried to fprintf(2,text) to set the red (error) style, but this did not help. I played a hunch and modified the style of a specific text segment and lo-and-behold, its CW color changed! Unfortunately, I found out that I can’t just fprintf(text) and then modify its style – for some unknown reason Matlab first needs to place the relevant segment in a “styled” mode (or something like this).
MATLAB ZPRINT HOW TO
In earlier posts I showed how to modify the Command Window (CW) text and background color, and a very limited method of displaying red (error) and blue (hyperlinked) CW messages.