#include <wobject/xstring.hpp>
|
#include <wobject/xwin.hpp>
|
#include <wobject/xaserver.hpp>
|
#include <wobject/xaserverarg.hpp>
|
#include <xcontrol/xtreeview.hpp>
|
#include <xcontrol/xlayersheet.hpp>
|
|
using xml = KXMLDOMDocument;
|
class export XDevEditCode : public xwin
|
{
|
public:
|
XDevEditCode(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd),mle_output(nullptr) {}
|
public:
|
static XDevEditCode* CreateInstance(void* implPtr, void* hWnd)
|
{
|
XDevEditCode* pWin = new XDevEditCode(implPtr, (HWND)hWnd);
|
return pWin;
|
}
|
private: //
|
xnode m_agentNode; //Agent Condition
|
string m_agentCond; //Agent Node
|
int SetAgent()
|
{
|
/*
|
string xfNodeAgentArea = "agentarea";
|
xnode anode = GetAgentNode(xfNodeAgentArea);
|
var xframeElement = GetElement();
|
var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
|
if(agent)
|
{
|
string s = agent.xml;
|
m_agentNode = SetAgentNodeContent (anode,s);
|
}
|
*/
|
return 1;
|
}
|
|
//½¹µã¼¤»î´¦Àíº¯Êý
|
int OnSetFocus(ref TEvent evt,int param)
|
{
|
SetAgent();
|
|
//ÖØÖù¤¾ßÌõ
|
return 1;
|
}
|
|
//ÃüÁî·¢²¼º¯Êý
|
int OnCmdDispatch(string comdid)
|
{
|
if (comdid == "xmFileSaveEx")
|
{
|
xsedit xc = this.GetControl("codecontent");
|
|
int hCursor = xutil::SetCursorWait();
|
|
string code;
|
//save tpp content
|
xc.GetContent(code);
|
this.SaveContent(code);
|
//
|
xutil::RestoreCursor(hCursor);
|
|
return 1;
|
}
|
return 0;
|
}
|
|
//ÃüÁî´¦Àíʼþ
|
int OnXCommand(ref TXCommandEvent evt,int param)
|
{
|
return OnCmdDispatch(evt.pStrID);
|
}
|
|
int OnAttachEvent()
|
{
|
//°ó¶¨¹¤¾ßÌõµã»÷ʼþ
|
AttachEvent("WM_XCOMMAND",OnXCommand);
|
//»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ
|
AttachEvent("WM_SETFOCUS",OnSetFocus);
|
}
|
|
int LoadData()
|
{
|
if (!this.GetParam()) return 1;
|
|
xwin w = GetFrameWindow();
|
xtree tv_folder = w.GetControl("DevExplorer");
|
int hItem = this.GetParam();
|
IXMLDOMElement e = tv_folder.GetItemData(hItem);
|
string caption = e.getAttribute("caption");
|
|
xsedit xc = this.GetControl("codecontent");
|
string code = this.GetData();
|
if (code == "")code == " ";
|
if (caption.find(".vl",0) >= 0 || caption.find(".vm",0) >= 0 || caption.find(".vf",0) >= 0 || caption.find("voc",0) >= 0 || caption.find("vc",0) >= 0)
|
{
|
xc.LoadContent(code,".vl");
|
}
|
else if (caption.find(".scm",0) >= 0)
|
xc.LoadContent(code,".scm");
|
else
|
xc.LoadContent(code,".cpp");
|
|
return 1;
|
}
|
|
int OnInitial()
|
{
|
SetAgent();
|
|
OnAttachEvent();
|
|
return 1;
|
}
|
|
int onload()
|
{
|
OnInitial();
|
LoadData();
|
return 1;
|
}
|
};
|