|
They checked out just fine on my system. If you are using XP, either clear your IE cache or save the zip files to disk and then open.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Yes, when i clear the IE cache, all is clear now.
Thank you very much!
|
|
|
|
|
this is looks like quick sample, not a serious job. The content of the window is blinking and there is no keyboard input. No drag-drop feature. MFC only.
|
|
|
|
|
Which system do you use? I can't reproduce this behaviour...
tbw
|
|
|
|
|
win2000, sp3, ie6
i guess flickering doesn't depends on system settings. keyboard input present, but it is extremely uncomfortable. I didn't want to say that it is bad, i just say it is unfinished work (may be for internal use only). Note, that not all users use mouse input - in your sample there is no way to create formula with keyboard only (may be i miss something?)
|
|
|
|
|
Alex Mol wrote:
may be i miss something?)
No! it is really not working correctly as it should. I gave 5 points for a good start, there is still a lot of works to do.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
(in German)
Sehr gute Arbeit, besser hätte man es kaum machen können
Achja, Grüße aus Oberhausen
Gruß
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
It is unpleasant to be the one who breaks the chain of "Hey man, great work... congrats!" but I just tried to select the Sum sign in the given sample and it had this unexpected behavior: when you hover the mouse on it no focus appears, while if you move the mouse a little bit on the right, just under the argument the focus appears.
I tried to find the cause, but it's just too hard to do at a first sight. But it should be quite easy for you, it doesn't seem a serious one!
Btw, great article!
Paolo
------
Why spend 2 minutes doing it by hand when you can spend all night plus most of the following day writing a system to do it for you? - (Chris Maunder)
|
|
|
|
|
Hi Paolo,
you're right. The behaviour of the sum-, integral-, and the productnode is not as it should be. As I mentioned in the article the implemenation of the node-entities is just an example ...
To fix that wrong behaviour you just have to override the method
virtual CNode* GetNodeFromPoint(CDC* pDC, CRect& rect, CPoint point); in the class-declaration of CSumNode (and also the CProdNode and CIntegralNode )
The implementation of the overridden methods looks like this:
CNode* CSumNode::GetNodeFromPoint(CDC* pDC, CRect& rect, CPoint point)
{
CRect contentRect(0,0,0,0);
CRect leftRect(0,0,0,0);
CRect rightRect(0,0,0,0);
CNode* pNode=NULL;
if(m_pLeftChild)
leftRect=m_pLeftChild->GetRect(pDC);
contentRect=GetContentRect(pDC);
if(m_pRightChild)
rightRect=m_pRightChild->GetRect(pDC);
TransformRects(rect, leftRect, rightRect, contentRect);
if(rightRect.PtInRect(point))
if(m_pRightChild)
{
pNode=m_pRightChild->GetNodeFromPoint(pDC, rightRect, point);
rect=rightRect;
return pNode;
}
if(contentRect.PtInRect(point))
{
rect=contentRect;
return this;
}
if(leftRect.PtInRect(point))
if(m_pLeftChild)
{
pNode=m_pLeftChild->GetNodeFromPoint(pDC, leftRect, point);
rect=leftRect;
return pNode;
}
return this;
}
The only difference is tree-traversal-algorithm. It has changed form postorder to inorder. Thats it...
thank you for the hint...
tbw
|
|
|
|
|
I applied the changes and now it works great!
The sum sign is still detected when cursor is below the argument, but the important thing is it gets detected when the cursor is over it.
So what about and intermediate class that just implements the different tree-traversal algorithm? CNodeInOrder or something like that...
Since you could have many operators that require that change, this could save many code repetitions.
Paolo
------
Why spend 2 minutes doing it by hand when you can spend all night plus most of the following day writing a system to do it for you? - (Chris Maunder)
|
|
|
|
|
Hi Paolo,
I thought about your suggestion, and when I looked into the code, I realized that CRangeNode is the evil guy, who makes the trouble. Therefore I think it's better to fix the CRangeNode .
Modify the original GetNodeFromPoint method in the following manner.
// return the node of a given point (mouse coordinate)
CNode* CNode::GetNodeFromPoint(CDC* pDC, CRect& rect, CPoint point)
{
CRect contentRect(0,0,0,0);
CRect leftRect(0,0,0,0);
CRect rightRect(0,0,0,0);
CNode* pNode=NULL;
if(m_pLeftChild)
leftRect=m_pLeftChild->GetRect(pDC);
contentRect=GetContentRect(pDC);
if(m_pRightChild)
rightRect=m_pRightChild->GetRect(pDC);
TransformRects(rect, leftRect, rightRect, contentRect);
if(leftRect.PtInRect(point))
if(m_pLeftChild)
{
pNode=m_pLeftChild->GetNodeFromPoint(pDC, leftRect, point);
rect=leftRect;
if(pNode)
return pNode;
}
if(rightRect.PtInRect(point))
if(m_pRightChild)
{
pNode=m_pRightChild->GetNodeFromPoint(pDC, rightRect, point);
rect=rightRect;
if(pNode)
return pNode;
}
if(contentRect.PtInRect(point))
{
rect=contentRect;
return this;
}
return this;
}
the only difference are the conditions if(pNode) before the return pNode; lines.
In the next step override the GetNodeFromPoint only for the CRangeNode in the following way:
CNode* CRangeNode::GetNodeFromPoint(CDC* pDC, CRect& rect, CPoint point)
{
CRect contentRect(0,0,0,0);
CRect leftRect(0,0,0,0);
CRect rightRect(0,0,0,0);
CNode* pNode=NULL;
if(m_pLeftChild)
leftRect=m_pLeftChild->GetRect(pDC);
contentRect=GetContentRect(pDC);
if(m_pRightChild)
rightRect=m_pRightChild->GetRect(pDC);
TransformRects(rect, leftRect, rightRect, contentRect);
if(rightRect.PtInRect(point))
if(m_pRightChild)
{
pNode=m_pRightChild->GetNodeFromPoint(pDC, rightRect, point);
rect=rightRect;
return pNode;
}
if(leftRect.PtInRect(point))
if(m_pLeftChild)
{
pNode=m_pLeftChild->GetNodeFromPoint(pDC, leftRect, point);
rect=leftRect;
return pNode;
}
return NULL;
}
The modified lines are commented. This solution should work for all nodes that work with CRangeNode as a child and leaves the class-hierarchy untouched....
tbw
|
|
|
|
|
I was thinking of doing this a while ago, but I'm not really a graphics person. I'd get bogged down in trying to make it look ok
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
|
few suggestions:
- make editing more intuitive, this is a big plus
- have exporting as vector graphics (WMF maybe?)
- have zooming, etc.
- customizable space between various expressions (e.g. x^2.. the 2 is too far away from the x)
- multiple binary relations in one equation (for example: if x = y then a = b... x = y --> a = b)
i was planning on making a revolutionary thing like this... seems like i wont need to anymore
good job!
Roman Nurik
|
|
|
|
|
Hi Roman,
thanx for your suggestions,
to export into WMF just add the following method into CBinTree :
BOOL CBinTree::WriteWMF(CString strFile)
{
CDC DC;
CDC* pDC = NULL;
CMetaFileDC MetaDC;
HENHMETAFILE hEnhMetaFile;
DC.CreateCompatibleDC(NULL);
CRect rectMeta(0,0,0,0);
CRect rect=GetRect(&DC);
rectMeta.right = MulDiv(rect.Width()*100, DC.GetDeviceCaps(HORZSIZE),
DC.GetDeviceCaps(HORZRES));
rectMeta.bottom = MulDiv(rect.Height()*100, DC.GetDeviceCaps(VERTSIZE),
DC.GetDeviceCaps(VERTRES));
MetaDC.CreateEnhanced(&DC, NULL, rectMeta, _T("Formula\0Image\0\0"));
MetaDC.SetAttribDC(DC.m_hDC);
MetaDC.SetMapMode(MM_TEXT);
pDC = &MetaDC;
CBrush brush;
brush.CreateSysColorBrush(COLOR_WINDOW);
pDC->FillRect(rect, &brush);
brush.DeleteObject();
DrawTree(pDC, rect);
hEnhMetaFile=MetaDC.CloseEnhanced();
BOOL bRet = FALSE;
HENHMETAFILE hMetaCopy = ::CopyEnhMetaFile(hEnhMetaFile, strFile);
if (hMetaCopy)
{
bRet = TRUE;
DeleteEnhMetaFile(hMetaCopy);
}
DeleteEnhMetaFile(hEnhMetaFile);
return bRet;
}
Then you can choose one of the export-methods. I will collect the suggestions and put them into an update soon...
tbw
|
|
|
|
|
However, after reading WREY's post I need a drink. Chaulk up another 5.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
First off, very nice. Second, thank you for donating it to the community; obviously, you put a lot of effort into it. It will make my engineering calculator much, much better looking..
And finally, a criticism: Even though this is a UI control, it might have made sense to create abstractions of operators and operands. The first thing I wanted to do with my snazzy function was evaluate it. I was dissapointed to find no good place to hook-in evaluation code. Are you familiar with Ian Ollmann's Parser/Evaluator?
|
|
|
|
|
Something like this is what Einstein was referring to when he said, "Credibility lies in simplicity." (To which someone added, "And elegance too," which prompted Einstein to reply in his usual witty and jovial manner, "Elegance are for tailors.")
Of course Einstein was too modest a person to reveal how complicated the "simplicity" of his work really was.
Such is the appearance of this person's work when you run the sample, and likewise when you look at his code: It is elegant, yet looks so simple. However, upon closer examination you will find it is anything but "simple". Still, you can't help from noticing how clean his coding technique is, and how concise is the logic behind his work. Yes, there are areas of complication in it also, but that is expected when you are writing any editor (moreso an editor of this kind).
Something else to observe: The seamless use of other people's work (they being other CodeProject members), brought together in one cohesive form presenting itself as a single work, underscoring another thread in this elegant tapestry of "simplicity".
On a different wavelength, let me say what this person has done, is just plain hard work, and much has to be said for him to be sharing it with us!! A big "thank you" is very much in order!!
Well done!! and looking forward for more like this in the future!!
William
Fortes in fide et opere!
|
|
|
|
|
why don't import/export it in MathML? It's a definitive standard nowadays
great job, anyway!
is this a sig?
|
|
|
|
|
you're definitly right. Currently the constructors of the nodeentities set the CString members m_strCodeFormat and m_strKeyWord statically. It's the same for typed nodes with the CStringArrays m_straKeyWords and m_straCodeFormats .
In general this initialization should be dynamic for example via .ini-File. However, by incrementing LT_COUNT in the node.h, introducing the new #define LT_MATHML 1 and setting up the mentioned member-variables the export-code should work without modifying the algorithm. Import is a little more tricky, I think (import-method working with XML-Parser)
tbw
|
|
|
|
|
I can know do my math homework on the computer and just print out equations (yes I realize it is probably more time consuming this way but its more fun).
-BestSnowman
|
|
|
|
|
so you did not know VTI (Virtual TI) from rusty wagner ...?
it is an excelent emulator of all the recent Texas-Instruments calculators, and especialy works very well for TI-89/92/92+...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
5/5 well done, you've definitely hit a niche article section.
To iterate is human, to recurse is devine.
|
|
|
|
|
...I was just the other night thinking of a project to waste some time on, and an idea like this came up, since I'm currently reading maths. Now I can waste time on something else!
|
|
|
|
|