Author Topic: Export as HTML, RTF, ...  (Read 44407 times)

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Export as HTML, RTF, ...
« on: October 13, 2005, 02:04:43 am »
I've been considering to write a plugin to export the current opened file in Code::Blocks with highlighted syntax to HTML, RTF and maybe some other formats, just like Dev-C++ and SciTE do.

I've spent a lot of time trying to get all I need to extract the information from the wxScintilla component and Code::Blocks itself so I can get the colors and style.

ATM I've only needed to add a GetColorSet() method to get m_pTheme from cbEditor and it seems to be the only decent way to get what I need, and the only thing I'd really need to be added in the SDK (I hope).

Any complaints, ideas, support, ...?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Export as HTML, RTF, ...
« Reply #1 on: October 13, 2005, 09:46:55 am »
No problem for me, after RC2 of course.
Be patient!
This bug will be fixed soon...

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Export as HTML, RTF, ...
« Reply #2 on: October 16, 2005, 03:51:44 am »
It seems like that will be really the only needed change in the SDK to get the plugin working.

I've made a few tests, played a bit with some stuff and everything else I'll need is in there.

mandrav: Would you really mind to add that function before RC2 is released? It won't change any behavior of it.

Code
EditorColorSet* cbEditor::GetColorSet()
{
  return m_pTheme;
}

EDIT: Yeah, forgot why: the idea is to get it done maybe, just maybe, before RC2 is released or at least have RC2 ready for it.
« Last Edit: October 16, 2005, 03:53:35 am by Ceniza »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Export as HTML, RTF, ...
« Reply #3 on: October 16, 2005, 10:23:58 am »
Done :)
Be patient!
This bug will be fixed soon...

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Export as HTML, RTF, ...
« Reply #4 on: October 16, 2005, 07:15:23 pm »
Done :)

Oh, great!

I just finished the first version of it.

It currently exports HTML and seems to be working fine. I still need to add some more things to get it more "real" (WYSIWYG).

A sample file is here

mandrav: would you mind to add this to contrib?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Export as HTML, RTF, ...
« Reply #5 on: October 17, 2005, 11:46:09 am »
Quote
mandrav: would you mind to add this to contrib?

Done.
I hope you don't mind, I converted it to cbPlugin and now creates a "File->Export to HTML" menu item. ;)
Btw, very nice work  8)
Be patient!
This bug will be fixed soon...

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Export as HTML, RTF, ...
« Reply #6 on: October 17, 2005, 06:33:37 pm »
Quote
mandrav: would you mind to add this to contrib?

Done.
I hope you don't mind, I converted it to cbPlugin and now creates a "File->Export to HTML" menu item. ;)
Btw, very nice work 8)

Heh, in the first tests I was doing something similar (adding it in the File menu) but then decided to make it more... er... plugin-like.

Having it in the File menu will make it consistent 'cause there's where ppl can find it in both SciTE and Dev-C++, so I don't really mind the change.

Last night I was checking some other minor things so it'll also export the font (name and size). This should be ready today.

I just hope you didn't forget to give me access to the plugin in CVS, oh, and still have access to the other two :P

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Export as HTML, RTF, ...
« Reply #7 on: October 17, 2005, 06:44:43 pm »
Quote
I just hope you didn't forget to give me access to the plugin in CVS, oh, and still have access to the other two

I hope I haven't ;)
Be patient!
This bug will be fixed soon...

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Export as HTML, RTF, ...
« Reply #8 on: October 17, 2005, 09:14:28 pm »
I just committed the latest changes and CVS didn't complain :)

Changes include:

* Current font type and size exported to the HTML file.
* Background colors also exported.
* Applied my coding style to mandrav's changes :)
* Removed the unnecessary checking mandrav pointed out (because of the new way to execute).
* Probably a few bugs introduced in the code :P

Offline squizzz

  • Almost regular
  • **
  • Posts: 132
Re: Export as HTML, RTF, ...
« Reply #9 on: October 17, 2005, 09:29:20 pm »
Quote from: Ceniza
HTML, RTF and maybe some other formats
Others, like Open Document Format for example? :)
this space is for rent

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Export as HTML, RTF, ...
« Reply #10 on: October 17, 2005, 10:19:20 pm »
Quote from: squizzz
Others, like Open Document Format for example? :)

I'mn't any familiar with that format, but yeah, it could be part of other formats.

I'll consider it :)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Export as HTML, RTF, ...
« Reply #11 on: October 17, 2005, 10:42:46 pm »
OpenDocument format is the format used by OpenOffice, KOffice and other OpenSource word processors. There was quite a political stir when the state of Massachusetts rejected the Microsoft format in govt. offices for an open document format to avoid vendor lock-in. The OpenDocument format is XML based, and currently is proposed to be an ISO standard.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Export as HTML, RTF, ...
« Reply #12 on: October 18, 2005, 04:21:52 am »
I just tried converting a RTF file (generated with Dev-C++) to ODT and it's too bloated.

I think the ODT format will have to wait some time until I get enough information to generate it in a simple, non-bloated, way.

I hope to get the RTF format soon though.

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Export as HTML, RTF, ...
« Reply #13 on: October 18, 2005, 10:10:36 am »
I think the ODT format will have to wait some time until I get enough information to generate it in a simple, non-bloated, way.

I haven't looked at the details myself, but the information is probably available somewhere on this site.

Offline squizzz

  • Almost regular
  • **
  • Posts: 132
Re: Export as HTML, RTF, ...
« Reply #14 on: October 18, 2005, 11:49:02 am »
I think the ODT format will have to wait some time until I get enough information to generate it in a simple, non-bloated, way.
I'm afraid that everything XML-based is bloated by default. The good thing is that it usually compresses very well (*.odt uses zip compression I think).

There was quite a political stir when the state of Massachusetts rejected the Microsoft format in govt. offices for an open document format to avoid vendor lock-in.
Yeah, that's when I've heard of this and decided to switch. (btw. OOo 2.0 itself is good enough reason to switch :P )

Anyway, great thanks for the plugin. :D
this space is for rent