| | |
| | | #include <wobject/xaserverarg.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | #include <xcontrol/xsedit.hpp> |
| | | #include "XDevEditPage.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class export XDevEditCode : public xwin |
| | | class export XDevEditCode : public XDevEditPage |
| | | { |
| | | public: |
| | | XDevEditCode(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd),mle_output(nullptr) {} |
| | | XDevEditCode(void* implPtr, HWND hWnd) :XDevEditPage(implPtr, hWnd){} |
| | | public: |
| | | static XDevEditCode* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | |
| | | } |
| | | private: // |
| | | xnode m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | xstring m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | { |
| | | /* |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | var agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | xstring s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | */ |
| | |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | |
| | |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == "xmFileSaveEx") |
| | | if (comdid == L"xmFileSaveEx") |
| | | { |
| | | xsedit xc = this.GetControl("codecontent"); |
| | | xsedit xc = GetControl(L"codecontent"); |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | |
| | | string code; |
| | | xstring code; |
| | | //save tpp content |
| | | xc.GetContent(code); |
| | | this.SaveContent(code); |
| | | SaveContent(code); |
| | | // |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | int OnXCommand(TEvent* evt,LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND",(FEvent)&XDevEditCode::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&XDevEditCode::OnSetFocus); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int LoadData() |
| | | { |
| | | if (!this.GetParam()) return 1; |
| | | if (!GetWinParam()) 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"); |
| | | xtreeview tv_folder = w.GetControl(L"DevExplorer"); |
| | | HTREEITEM hItem = (HTREEITEM)GetWinParam(); |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | xstring caption = e.getAttribute(L"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) |
| | | xsedit xc = GetControl(L"codecontent"); |
| | | xstring code = GetData(); |
| | | if (code == L"")code == L" "; |
| | | if (caption.find(L".vl",0) >= 0 || caption.find(L".vm",0) >= 0 || caption.find(L".vf",0) >= 0 || caption.find(L"voc",0) >= 0 || caption.find(L"vc",0) >= 0) |
| | | { |
| | | xc.LoadContent(code,".vl"); |
| | | xc.LoadContent(code,L".vl"); |
| | | } |
| | | else if (caption.find(".scm",0) >= 0) |
| | | xc.LoadContent(code,".scm"); |
| | | else if (caption.find(L".scm",0) >= 0) |
| | | xc.LoadContent(code,L".scm"); |
| | | else |
| | | xc.LoadContent(code,".cpp"); |
| | | xc.LoadContent(code,L".cpp"); |
| | | |
| | | return 1; |
| | | } |