Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » Math equations in QTF
Math equations in QTF [message #20251] Thu, 05 March 2009 10:53 Go to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello all

I would like to show math equations like this in Upp (this one is just an example):
index.php?t=getfile&id=1604&private=0

What could I do?:
- Is it possible to do it using Qtf?
- Would I have to draw it in Painter?

Best regards
Koldo
  • Attachment: Formula.JPG
    (Size: 3.22KB, Downloaded 1699 times)


Best regards
Iñaki
Re: Math equations in QTF [message #20264 is a reply to message #20251] Thu, 05 March 2009 19:27 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Thu, 05 March 2009 04:53

Hello all

I would like to show math equations like this in Upp (this one is just an example):
index.php?t=getfile&id=1604&private=0

What could I do?:
- Is it possible to do it using Qtf?



No. You could embbed it IMO.

Quote:


- Would I have to draw it in Painter?

Best regards
Koldo


Well, I think the correct would be to create some sort of RichObject for this...

Mirek
Re: Math equations in QTF [message #20267 is a reply to message #20264] Fri, 06 March 2009 09:47 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello luzr

From which class should I derive this "math object"?

Best regards
Koldo


Best regards
Iñaki
Re: Math equations in QTF [message #20282 is a reply to message #20267] Fri, 06 March 2009 18:34 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Actually, the process is a little bit different.

You need to find "binary representation" (because, after all, you will need to store such object in QTF...). Then you provide a class that "draws" such binary representation.

I recommend digging around RichText/RichImage.
Re: Math equations in QTF [message #20283 is a reply to message #20282] Fri, 06 March 2009 18:37 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
UPDATE:

Tom has already created some simple expressions rendering, it should be in TDraw formula.h / .cpp, and in TCtrlLib.

Mirek
Re: Math equations in QTF [message #20292 is a reply to message #20283] Sat, 07 March 2009 00:26 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Sorry luzr

I have tried to compile TDraw and the best that I have go is this error:
error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

The more I touch the more errors I get.

To put void AppMain() or GUI_APP_MAIN is just the same.

These files use NAMESPACE_UPP instead of using namespace Upp.

Does it sound anything to you?

Best regards
Koldo


Best regards
Iñaki
Re: Math equations in QTF [message #20302 is a reply to message #20292] Sat, 07 March 2009 20:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Fri, 06 March 2009 18:26

Sorry luzr

I have tried to compile TDraw and the best that I have go is this error:
error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

The more I touch the more errors I get.

To put void AppMain() or GUI_APP_MAIN is just the same.

These files use NAMESPACE_UPP instead of using namespace Upp.

Does it sound anything to you?

Best regards
Koldo



TDraw is not the main package. It is Tom's Draw extension library.

Mirek
Re: Math equations in QTF [message #20311 is a reply to message #20302] Mon, 09 March 2009 09:44 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Sorry again luzr

If TDraw is not the main package, I do not know which is the right one.

If you think that TDraw is obsolete or outside actual Upp standards I can begin something based in QtfDrawing sample, so creating DrawingDraw, inserting it into a QtfRichObject and that in a qtf String.

Berst regards
Koldo


Best regards
Iñaki
Re: Math equations in QTF [message #20605 is a reply to message #20251] Thu, 26 March 2009 00:13 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello all

I have prepared a function to draw mathematical equations as this one:

index.php?t=getfile&id=1658&private=0

The function is:
Drawing DrawEquation(String str);

And the viewed sample call is:
Drawing drw = DrawEquation("integral(sqrt(cos(phi_ini^2)) + i^2 + 6, i = 1, 10)*dx = cos((27+x^2)^3.25)/(PI*R_0^2)");

It parses the String passed and builds the equation Drawing object considering upper and lower greek alphabet and easy subscripts and superscripts.

I think that now is not enough big to do a new enter in Bazaar for it. If somebody is interested in it I can include the code.

Now I use it to insert equations in Qtf through QtfRichObject and CreateDrawingObject. If somebody thinks about a better function interface proposals are accepted.

Best regards
Koldo

  • Attachment: Equation.JPG
    (Size: 4.59KB, Downloaded 1448 times)


Best regards
Iñaki
Re: Math equations in QTF [message #20606 is a reply to message #20605] Thu, 26 March 2009 07:41 Go to previous messageGo to next message
gridem is currently offline  gridem
Messages: 45
Registered: August 2008
Member
koldo wrote on Thu, 26 March 2009 02:13

I think that now is not enough big to do a new enter in Bazaar for it. If somebody is interested in it I can include the code.


Yes, please. I'm very interesting in it. Thank you in advance.
Re: Math equations in QTF [message #20614 is a reply to message #20606] Thu, 26 March 2009 23:44 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello gridem

Here I enclose you the package.

Now the calling function is
QtfRichObject QtfEquation(String str)
so that to get it into Qtf is as simple as
GUI_APP_MAIN
{
	String qtfText;

	QtfRichObject qtEq = QtfEquation("integral(sqrt(cos(phi_ini^2)) + i^2 + 6, i = 1, 10)*dx = cos((27+x^2)^3.25)/(PI*R_0^2)");
	
	qtfText << "[R3 This is a formula in QTF:&" << qtEq;

	PromptOK(qtfText);
}


ToDo list:
- Improve appearance mainly in Linux
- Change font size
- (Perhaps) Improve expression parser

Best regards
Koldo


Best regards
Iñaki
Re: Math equations in QTF [message #20654 is a reply to message #20614] Mon, 30 March 2009 11:39 Go to previous messageGo to next message
gridem is currently offline  gridem
Messages: 45
Registered: August 2008
Member
koldo wrote on Fri, 27 March 2009 01:44

Hello gridem

Here I enclose you the package.

Best regards
Koldo


Thank you very much! It's useful package for me.
Re: Math equations in QTF [message #20660 is a reply to message #20251] Mon, 30 March 2009 15:53 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello gridem

You are welcome. Smile
If you find any problem or any improvement oportunity please let me know.

Best regards
Koldo


Best regards
Iñaki

[Updated on: Mon, 30 March 2009 15:53]

Report message to a moderator

Re: Math equations in QTF [message #28233 is a reply to message #20660] Tue, 24 August 2010 15:03 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Hi Koldo Smile

I missed that one.... I think it would be a very useful addon to QTF and to UWord !
What about embedding an equation editor in word control ? maybe just an aditstring with the equation preview in real time ?

Ciao

Max
Re: Math equations in QTF [message #28235 is a reply to message #28233] Tue, 24 August 2010 15:54 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Massimo

Now QtfEquation only renders equations (and I have to polish it a little bit Rolling Eyes).

An equation editor is something completely different...


Best regards
Iñaki
Re: Math equations in QTF [message #28237 is a reply to message #28235] Tue, 24 August 2010 16:46 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
koldo wrote on Tue, 24 August 2010 15:54

Hello Massimo

Now QtfEquation only renders equations (and I have to polish it a little bit Rolling Eyes).

An equation editor is something completely different...


Hi Koldo,

I usually hated M$ equation editor, he version I used were very fancy to look but quite uncomfortable to use.
I think that something like your is better, it's quite simple to enter en equation as a string and looking its correctness in real time in a control.... IMHO a better way to edit equations.

Max
Re: Math equations in QTF [message #28239 is a reply to message #28237] Tue, 24 August 2010 22:13 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
mdelfede wrote on Tue, 24 August 2010 16:46

koldo wrote on Tue, 24 August 2010 15:54

Hello Massimo

Now QtfEquation only renders equations (and I have to polish it a little bit Rolling Eyes).

An equation editor is something completely different...


Hi Koldo,

I usually hated M$ equation editor, he version I used were very fancy to look but quite uncomfortable to use.
I think that something like your is better, it's quite simple to enter en equation as a string and looking its correctness in real time in a control.... IMHO a better way to edit equations.

Max


Hello Massimo

Your focus is very easy. Just subclassing RichObjectType and that is all.

See sample Reference/RichTextObject. You will like it...


Best regards
Iñaki
Re: Math equations in QTF [message #28246 is a reply to message #28239] Wed, 25 August 2010 09:14 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Thank you Koldo Smile

I'll test it on these days. Btw, I think if it works as expected I'll add to my app... Is a structural analysis app, with an UWord module too to be able to handle external stuffs, and an equation editor there would be great.

Ciao

Max
Re: Math equations in QTF [message #28260 is a reply to message #28246] Wed, 25 August 2010 11:37 Go to previous message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Massimo

I promise to do it soon. (I am stuck now with the media player Mad )


Best regards
Iñaki
Previous Topic: Report package: how to set header on first page different to other pages
Next Topic: Convert help topics in html pages
Goto Forum:
  


Current Time: Thu Mar 28 09:49:25 CET 2024

Total time taken to generate the page: 0.01432 seconds