Author |
Topic |
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 07 2014 : 10:20:03 AM
|
Consider:
if (lnI == 0 || (lnI < 200 && (tnFontSize + lnI) < (tnFontSize * 3) && lrc.bottom < tnHeight && lrc.right < tnWidth))
It's hard to read. Consider drawing the same with vertical guides on the trigger items which cause a new layer. This would appear as a popup, or following a keystroke pressed when in the middle of something that's highlighted with brace matching:
if (lnI == 0 || (lnI < 200 && (tnFontSize + lnI) < (tnFontSize * 3) && lrc.bottom < tnHeight && lrc.right < tnWidth))
||
== ( )
lnI 0 | && && && |
| < | < | < | < |
lnI 200 | ( ) ( ) | lrc.bottom tnHeight | lrc.right tnWidth
| + | | * |
|tnFontSize lnI| |tnFontSize 3|
I would be willing to provide the logic for this to VA as I'm adding it to my own debugger as part of a "Bool View" feature which, when enabled, continually parses the editor's caret position and shows in a separate window or popup this type of display if it is available. I can also completely draw the item for the popup and return an HBITMAP which is a DIBSection that can be displayed by VA if necessary.
|
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 07 2014 : 10:28:11 AM
|
Does VA already tokenize each line? If so that would make it far easier and faster to implement in VA. :-) |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Jan 09 2014 : 1:40:53 PM
|
Personally this is why I split any complex if statement across more than one line, so I can group and structure it, to make it more clear what is happening.
Have you turned on VA's highlight matching brackets?
http://docs.wholetomato.com/default.asp?W182
this helps a lot in situations like this, especially if you have set the highlighted matching brackets to a fairly clear and obvious colour. |
zen is the art of being at one with the two'ness |
|
|
Dusan
Whole Tomato Software
Slovakia
177 Posts |
Posted - Jan 09 2014 : 1:51:52 PM
|
I would write it as follows:
if
(
lnI == 0
||
(
lnI < 200
&&
(tnFontSize + lnI) < (tnFontSize * 3)
&&
lrc.bottom < tnHeight
&&
lrc.right < tnWidth
)
)
{
}
And it is absolutely clear, what it does :) even without comment |
|
|
foxmuldr
Tomato Guru
USA
412 Posts |
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 09 2014 : 4:41:27 PM
|
quote: Originally posted by DusanDusan
I would write it as follows [snip] And it is absolutely clear, what it does :) even without comment
Yes. But that requires the code be written that way. I'm looking for the GUI to enhance my developer experience. As I've mentioned before, I have dyslexia. It is difficult for me to read through source code like my example in certain cases. This type of "Bool View" view would allow code that's made like that to be visualized without reformatting it to consume multiple source code lines and lots of vertical screen space.
It's no biggie. I am introducing it into my own editor. It would be nice to have it in Visual Studio as well... but that's just a desire, not a need.
|
|
|
Dusan
Whole Tomato Software
Slovakia
177 Posts |
Posted - Jan 10 2014 : 01:29:03 AM
|
Why do not you create your own addin?
|
|
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 10 2014 : 08:35:41 AM
|
I offered to do that above, "I would be willing to provide the logic for this to VA ... I can also completely draw the item for the popup and return an HBITMAP which is a DIBSection that can be displayed by VA if necessary."
|
Edited by - foxmuldr on Jan 10 2014 08:37:14 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Jan 11 2014 : 3:45:16 PM
|
I have certainly seen some very complex and hard to read if statements, so your idea does make sense. Personally I am actually finding your vertical presentation harder to read, not easier to read.
The word wrapped if statement seems a lot clearer to me personally. You are right, when working with existing code reformatting the if statements so they are easier to read does not work very well.
Is the word wrapped version also fairly clear and easy to read for you? I am wondering if this would make more sense in general to our users. |
zen is the art of being at one with the two'ness |
|
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 11 2014 : 4:23:37 PM
|
It's hard to envision in a text format. The actual format uses colors and is interactive. No biggie. The word-wrapped form is easy to read. I would not use it because takes up too much vertical space, and it removes direct alignment with the original statement when written out horizontally. |
|
|
Dusan
Whole Tomato Software
Slovakia
177 Posts |
Posted - Jan 12 2014 : 08:51:01 AM
|
quote: Originally posted by foxmuldr
It's hard to envision in a text format. The actual format uses colors and is interactive. No biggie. The word-wrapped form is easy to read. I would not use it because takes up too much vertical space, and it removes direct alignment with the original statement when written out horizontally.
Could you please post processed picture of your if statement? I am really interrested in result, since my friend is also dislexic, so I'll ask him if it could help more than word wrapped code. If so, I would once perhaps not have to split my if statements for him :) But as far as I can say now, he always preffered word wrapped code. |
|
|
foxmuldr
Tomato Guru
USA
412 Posts |
Posted - Jan 13 2014 : 09:13:15 AM
|
Yes. Will do. Give me a bit of time. |
|
|
jay.carlton
Ketchup Master
USA
65 Posts |
Posted - Feb 21 2014 : 4:02:17 PM
|
That sounds like a really interesting project. I like the idea of dynamically generating representations of logical statements from code or plain text into other forms. I tend to agree that it sounds like a useful addin in its own right. |
|
|
|
Topic |
|