Community
Participate
Working Groups
Bugzilla – Bug 172018
[painting][preferences] configurable alpha level for whitespace character rendering
Last modified: 2010-10-26 07:53:12 EDT
Follow-up to bug 22712 comment 73: >It looks like this is currently specified by "gc.setAlpha(100);" at line 138 in >my patched InvisibleCharacterPainter.java (against 3.3M3). I could see this >fitting quite well on the preference page, right next to the "Show whitespace >characters" checkbox, just like the "print margin column" and "hyperlink style >navigation key modifier" textboxes. In contract to Mark's original comment, I personally think it should be a bit lighter than 100 by default.
I was actually attempting to work on a patch for this. Adding another property and removing the hard-code is easy. Presenting it as an option on the GUI is the difficult part... For one, the "General / Editors / Text Editors" preferences page is already filling up. That, and it's not currently scrollable, such that resizing the window can easily cause options to apparently disappear. I had considered adding an "alpha" box below "Show whitespace characters", just as "Print margin column" is currently below "Show print margin". I'm also scared of using text boxes to accept a numeric example. The validators that are currently being used to display invalid input at the top of the dialog are cool, but easily fooled. For example, enter "2a" into "Displayed tab width". This will correctly display an error. Enter "200a" into "Undo history size" - another correct error. Change "200a" back to "200". All errors are "gone", even though "2a" is still incorrect. The page even will "Apply" or "OK" without any warnings or errors. Also, can we reasonably expect all Eclipse users to also be familiar with alpha channels? I'm thinking a slider would be better than a text box, which would restrict properly restrict the input to a number within the valid range. Even better would be to have a paired slider / text box such that the numeric value can still be viewed/entered directly - with proper checks to only accept numeric values, etc. Such a dialog could also display a sample of the selected value. I've been waiting for visible whitespace character support in Eclipse for a long time. One of my biggest annoyances while working in code is inconsistent formatting - tabs vs. spaces, etc. This is a feature that I normally leave on, but depending upon the type of file / type of coding I'm working on, I may want the whitespace characters a little more or less visible - and may want to change it quite often. And as Markus stated, I think they're a little dark by default (though this effect is definitely dependent upon the display and other color settings being used.) I'm thinking it'd be cool to have an "alpha selection dialog" openable from the preferences page, and displayable as a drop-down from the toolbar icon. Just dreaming... :-) Just some thoughts!
What you mention regarding the error state not updating correctly is just a bug. Can you please file this against Platform Text? Thanks.
(Posted bug 172031 to address comment #2.)
*** Bug 172076 has been marked as a duplicate of this bug. ***
Is the alpha level enough or would we also want to set the color?
> Is the alpha level enough or would we also want to set the color? I don't care too much. But adding an entry to the "Appearance color options" list on the preference page would give full flexibility and also avoid more widgets on the page. The "System Default" for "Whitespace color" then be based on the Foreground color (with a light alpha).
The problem is that we cannot extend the 'Colors and Fonts' preference page i.e. we'd need to separate alpha and color.
To fight with overbloated Text Editors pref page (provided transparency pref patch adds one extra row) one could split it into two tabs: "General" and "Appearance". Current situation would result in 8 rows + appearance color option for Appearance" and 5 rows for "General". But tab itself takes one row so not very huge benefit :) PS. Should I move my patch from "DUPLICATE" bug 172076 to here?
(In reply to comment #7) I would add the setting to the color list on the Text Editor preference page. I would just add it as another color setting (no explicit alpha). Only the default setting would use an (implicit) alpha level of the current foreground color.
The best solution is to 1. add it to the "Appearance color options" list 2. add an alpha entry field to the right which is only visible when the whitespace color list item is selected Markus, I would not abuse the "system default" as there isn't such a color in the system. >PS. Should I move my patch from "DUPLICATE" bug 172076 to here? No, as I assume an improved patch will be attached here ;-)
*** Bug 238117 has been marked as a duplicate of this bug. ***
I'm very much looking forward to this feature.
I'm too waiting for this feature. To save space in the preferences, why not use a percentage selector: "Whitespace characters: [0%-100%] visible" where [0%-100%] is a control that allows values from 0% (do not render any whitespaces) to 100% (like it is now) in some reasonable steps. I'm thinking of a drop-down or something. This would replace the seperate checkbox to enable the rendering of whitespaces.
*** Bug 262916 has been marked as a duplicate of this bug. ***
Couldn't "Visible Whitespace" just be added to the Colors & Fonts list, in the "Basic" category? *any* solution would be preferable to waiting another two years :). Has anyone ported the Ahtik patch to 3.4/3.5? (http://ahtik.com/blog/2007/01/30/new-feature-whitespace-coloralpha-blending-transparency/ )
Ahti, would you be willing to tweak your feature according to comment 10 and attach a patch here?
Dani, thanks for the reminder! I'll put it to my TODO list and make it happen at one point asap.
Hi, what is the status on this feature? I would like to dim down the contrast on whitespace characters now, does an alternative solution exist? :-)
I'm also interested if there is a current patch to allow a more tolerable whitespace character color in Eclipse.
Hi all, It would be great to have the possibility to choose foreground and background color to use for whitespace characters. It's very difficult to recognize them now. :) And yes, I think users don't care so much where that options will be placed.
Now that we have the Show Whitespace Characters dialog, we could just add a text field there to configure the alpha level. Add something like "(0 is transparent and 255 is opaque)" to the label. Alpha level is currently hardcoded in WhitespaceCharacterPainter#handleDrawRequest(..) and needs a new preference property.
(In reply to comment #21) > Now that we have the Show Whitespace Characters dialog, we could just add a > text field there to configure the alpha level. Add something like > "(0 is transparent and 255 is opaque)" to the label. Agree, a single text field should do the job.
Created attachment 181188 [details] fix
(In reply to comment #0) > In contract to Mark's original comment, I personally think it should be a bit > lighter than 100 by default. I think a default of 80 would be better (though the patch still has the default as 100)
(In reply to comment #24) > I think a default of 80 would be better (though the patch still has the default > as 100) yes, I agree. 80 would be better as default value. -- Andrea
Looks good and works. Some issues I found: You can't just delete an API method, even if it was added recently. Mark it @deprecated with a comment that it will go away right after M3. There's a problem in the two actions in case the store is null: the painting will not work (this is not just a bug with the new setting) ==> suggest to use the old constructor in case the store is 'null' See http://en.wikipedia.org/wiki/Alpha_compositing ==> alpha value (not alpha level) Dialog: - remove "Configure ". - entry field should be smaller (leave space for 4 or 5 digits). Change the default to 80.
Created attachment 181284 [details] fix (In reply to comment #26) > Looks good and works. Some issues I found: > > You can't just delete an API method, even if it was added recently. Mark it > @deprecated with a comment that it will go away right after M3. hmm.. it was added in M3, anyway deprecated it for now. > There's a problem in the two actions in case the store is null: the painting > will not work (this is not just a bug with the new setting) > ==> suggest to use the old constructor in case the store is 'null' Because the store is null, we do not know if the whitespace characters were turned on or not. Hence we disable the painter which is also the default preference. Or am I missing something?
> Because the store is null, we do not know if the whitespace characters were > turned on or not. Hence we disable the painter which is also the default > preference. Or am I missing something? Yes, the action can be used/run without a store. Please prepare a new patch.
Created attachment 181286 [details] fix
Looks good. Please add a mnemonic to: TextEditorDefaultsPreferencePage_transparencyLevel=Transparency level (0 is transparent and 255 is opaque):
Created attachment 181289 [details] last fix + mnemonic Dani, please commit this to HEAD.
(In reply to comment #31) > Created an attachment (id=181289) [details] [diff] > last fix + mnemonic > > Dani, please commit this to HEAD. Done.
Verified in I20101025-1800.