Author Topic: DrawTextEXT - DrawHTMLCODE and DrawBBCODE  (Read 1472 times)

fearless

  • Member
  • ***
  • Posts: 469
    • LetTheLightIn
DrawTextEXT - DrawHTMLCODE and DrawBBCODE
« on: August 26, 2018, 04:36:54 AM »
I done some work in porting over, adapting and adding to DrawHTML code from Ukkie9: https://www.codeproject.com/Articles/7936/DrawHTML

Added a few more tags and made the color and list stacks local to the DrawHTMLCODE functions. The stack functions where made for future use that if the functions are used in more than one custom control for example, each control will have its own stack and not a global one as in the original article and code. And for adapting it to x64 code later on.

I plan to rejig what I have done currently to add it into the ModernUI stuff, most likely the ModernUI_Text control, but maybe others, havent decided that exactly yet. A lot of the variables and stacks would be stored as properties (internal to the control or external) once i made the conversion.

Also similarly a DrawBBCODE function will handle bbcode tags - but thats work in progress.

One tag, the hyperlink one <a href="url">title</a> is incomplete in the DrawHTMLCODE function, it just displays the title in blue color and underlined. Ive yet to decide how to handle this, although I have some todo notes in the code regarding using a control placed where the text would be (and not drawing the text underneath), and i was also playing around with an invisible window (doesnt paint itself, but responds to mousemove and clicks etc) in another test project that rests over the url link title text and is in effect transparent, but the cursor changes to hand etc. But might as well do the whole thing instead of an invisible window.

Anyhow the initial release and demo is available on github: https://github.com/mrfearless/DrawTextEXT



Colors and fonts for quote and code/pre tags can be changed. I just put some stuff together for testing mainly. Im sure that there is probably edge cases where something doesnt show correctly or renders on the wrong line or suchlike. Anyhow hopefully its useful for someone else as well.
« Last Edit: August 27, 2018, 09:05:58 AM by fearless »
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

My Github  Twitter

fearless

  • Member
  • ***
  • Posts: 469
    • LetTheLightIn
Re: DrawTextEXT - DrawHTMLCODE and DrawBBCODE
« Reply #1 on: August 27, 2018, 09:05:38 AM »
Initial version of DrawBBCODE is now included. Tests for lists and listitems hasn't been done yet, but the rest seems to work ok.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

My Github  Twitter

fearless

  • Member
  • ***
  • Posts: 469
    • LetTheLightIn
Re: DrawTextEXT - DrawHTMLCODE and DrawBBCODE
« Reply #2 on: September 01, 2018, 02:55:31 AM »
Have most of the tags I wanted to support in the code now and done some more testing with both functions, along with hyperlinks <a> for html and url (surrounded by square brackets) for bbcode. And the hyperlinks work with internal ids, so you can specify a url with #112 and it will pass that id (converted from string to integer) to the parent via WM_COMMAND.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

My Github  Twitter

Biterider

  • Member
  • ***
  • Posts: 392
  • ObjAsm32 + ObjAsm64 = ObjAsm
    • ObjAsm
Re: DrawTextEXT - DrawHTMLCODE and DrawBBCODE
« Reply #3 on: September 01, 2018, 03:46:35 PM »
Brilliant! Excellent work  :t


Biterider

fearless

  • Member
  • ***
  • Posts: 469
    • LetTheLightIn
Re: DrawTextEXT - DrawHTMLCODE and DrawBBCODE
« Reply #4 on: September 01, 2018, 07:19:02 PM »
Thanks.

The hyperlink tags where the most awkward to add in, had to create a custom control for them that and add small combined regions for each of them that sits over the text displayed, so that the mouseover, cursor changes to hand etc would work. Might be a better way of doing it, and initially I couldnt think of any way to do it inside the routines, but lying in bed trying to sleep one night I came up with the current solution.


fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

My Github  Twitter

jj2007

  • Member
  • *****
  • Posts: 9794
  • Assembler is fun ;-)
    • MasmBasic
Re: DrawTextEXT - DrawHTMLCODE and DrawBBCODE
« Reply #5 on: September 01, 2018, 08:04:49 PM »
Remarkable project, fearless :t

fearless

  • Member
  • ***
  • Posts: 469
    • LetTheLightIn
Re: DrawTextEXT - DrawHTMLCODE and DrawBBCODE
« Reply #6 on: September 01, 2018, 09:01:04 PM »
Thanks JJ,
I hope to add in this to my ModernUI_Text control - along with wide unicode support and possibly the UTF8 stuff as well (based on info from the other threads about that stuff recently)
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

My Github  Twitter