XU32 XDomSetvar::Connect(XEVENTDATA *pData) { XString8 strName=FindAttrib(XEAB::NAME,""); if(strName.IsEmpty()) return XRNONE; XString8 strValue=FindAttrib(XEAB::VALUE); XSortString8::SSetValue(pData->strValues,strName,strValue); pData->nData=(XU32)this; return XRSETVAR; }
bool FindAttrib( const char *xml, const char *name, int &i, const char *pend ){ CharBuf cb; if( !FindAttrib( xml, name, cb, pend ) ) return false; if( cb[0]=='0' && tolower(cb[1])=='x' ) sscanf( cb, "%x", &i ); else sscanf( cb.Str(), "%d", &i ); return true; }
XU32 XDomA::Connect(XEVENTDATA *pData) { XString8 strURL=FindAttrib(XEAB::HREF,(XPCTSTR)XNULL); XU32 s=XRNONE; if(!strURL.IsEmpty()) { s|=XRCONNECT; Translate(pData->strValues,strURL); pData->SetURL(strURL);//URL.SetURL(strURL); } s|=XDomNode::Handle(XDO_CONNECT,(XU32)pData,0); //if(m_nID==XDOM_A) s|=XR return s;//XRCONNECT; }
void XDomTable::LayeroutCells(DRAWCONTEXT*pDraw,CELLDATA*pData) { //if(!pData->bReturn) //pDraw->PADDING=1; //pDraw->SPACING=1; LAYEROUTDATA margin; CELLDATA data; data.Reset(pData->cur.x,pData->cur.y,XTRUE); PreLayerout(pDraw,&data,&margin); //XU8 bCollapse=pDraw->bCollapse; pDraw->bCollapse=FindAttrib(XEAB::BORDER_COLLAPSE,0); data.pData=XNULL; XU8 bInline=IsFingerInline(); XRect rt=pDraw->win; InitMargin(pDraw,&data,&margin,m_nPosX,m_nPosY,m_nWidth,m_nHeight,XTRUE); if(m_nWidth>0&&m_nWidth==pDraw->win.Width()&&m_bFinal) { //bSet=XTRUE; data.max.cx=m_nWidth; data.max.cy=m_nHeight; data.nMin=m_nMin; } else { //m_nWin=pDraw->win.Width(); LayeroutTable(pDraw,data); m_rows.DataFrom(data.rowws); m_nMin=data.nMin; } XSize size(m_nWidth,m_nHeight); SetMargin(&margin,m_nWidth,m_nHeight,size); //SetMargin(&margin,m_nWidth,m_nHeight,size); pDraw->win=rt; // XU8 bInline=IsFingerInline(); if(!bInline) m_bReturn=NewRowIfMust(pDraw,pData,m_nWidth); SetRowSize(pDraw,pData,size,data.nMin,XTRUE); if(!bInline) NewRow(0,pDraw,pData,pDraw->IND); //pDraw->bCollapse= EndLayerout(pDraw,pData); //pDraw->win=rect; }
XU32 XDomTable::Paint(DRAWCONTEXT *pDraw) { //XString8 str=FindAttrib(XEAB::ID,""); //if(str=="last") // int a=0; if(m_nWidth<=0) return 0; if(m_nPosX>=pDraw->paint.right|| m_nPosX+m_nWidth<=pDraw->paint.left|| m_nPosY>=pDraw->paint.bottom|| m_nPosY+m_nHeight<=pDraw->paint.top) return 0; XU32 ss=PrePaint(pDraw); XRect rect(m_nPosX,m_nPosY,m_nPosX+m_nWidth,m_nPosY+m_nHeight); int bd=FindAttrib(XEAB::BORDER,0); XU8 nType=FindAttrib(XEAB::FRAME,XEnumFrame::BOX); XU8 bCollapse=pDraw->bCollapse; pDraw->bCollapse=FindAttrib(XEAB::BORDER_COLLAPSE,0); int nr=pDraw->SPACING; pDraw->SPACING=XMAX(FindAttrib(XEAB::CELLSPACING,1),0); XU8 d=pDraw->TABBORDER; pDraw->TABBORDER=bd; XRect ar=XRect(rect.left,rect.top,rect.right,rect.bottom); PaintBack(pDraw,ar,XTRUE); XU32 s=HandleChild(XDO_PAINT_TABLE,(XU32)pDraw,0); pDraw->bCollapse=bCollapse; pDraw->TABBORDER=d; if(nType==XEF::VOID_X) bd=0; if(bd>0) { XGraphics*pg=pDraw->pDraw; //pDraw->Save(); XColor cc(pDraw->DCBACK); XColor dc(cc); dc.Dark(60); cc.Dark(30); int bx=m_nPosX,by=m_nPosY; int ex=m_nPosX+m_nWidth-1,ey=m_nPosY+m_nHeight-1; for(int i=0;i<bd;i++) { pg->SetColor(cc); switch(nType) { case XEF::BOX: case XEF::ABOVE: case XEF::BORDER: case XEF::HSIDES: pg->DrawLine(bx,by,ex,by); break; } switch(nType) { case XEF::BORDER: case XEF::BOX: case XEF::VSIDES: case XEF::LHS: pg->DrawLine(bx,by,bx,ey); break; } pg->SetColor(dc); switch(nType) { case XEF::BORDER: case XEF::BOX: case XEF::VSIDES: case XEF::RHS: pg->DrawLine(ex,by,ex,ey); break; } switch(nType) { case XEF::BORDER: case XEF::BOX: case XEF::HSIDES: case XEF::BELOW: pg->DrawLine(bx,ey,ex,ey); break; } cc.Bright(3); dc.Bright(3); bx++; by++; ex--; ey--; } //cc.Dark(20); /*pDraw->pDraw->DrawFrame( XRect(m_nPosX,m_nPosY,m_nPosX+m_nWidth,m_nPosY+m_nHeight), cc,bd,XTRUE);*/ // pDraw->Restore(); } pDraw->SPACING=nr; PaintBorder(pDraw,ar); EndPaint(pDraw); //if(bSave) // pDraw->Restore(); return s; }
XU32 XDomTD::LayeroutPre(DRAWCONTEXT*pDraw,CELLDATA*pData) { XINT i; SpanCol(pData); //LAYEROUTDATA margin; //PreLayerout(pDraw,pData,margin); // if(pDraw->SETWIDTH==-84) // int a=0; int w=FindAttrib(XEAB::WIDTH,0); int cspan=XMAX(FindAttrib(XEAB::COLSPAN,1),1); int rspan=XMAX(FindAttrib(XEAB::ROWSPAN,1),1); /*if(w==0) { if(m_childs.GetSize()>0) pData->setCols.Add(0); } */ //else if(w) { for(i=pData->setCols.GetSize();i<pData->nCol;i++) pData->setCols.Add(0); for(i=0;i<cspan;i++) { XU16 id=pData->nCol+i; if(id>=pData->setCols.GetSize()) { pData->setCols.Add(w/(cspan-i)); w-=w/(cspan-i); } else if(i+1<cspan) { if(w>0) { if(pData->setCols[id]>=0) w=XMAX(w-pData->setCols[id],0); else w-=w/(cspan-i); } else { if(pData->setCols[id]<0) w=XMIN(w-pData->setCols[id],0); else w-=w/(cspan-i); } } else { if(w>0) { if(pData->setCols[id]<w) pData->setCols[id]=w; } else if(pData->setCols[id]>w) pData->setCols[id]=w; } } } // else if(m_childs.GetSize()>0) pData->nCol+=cspan; if(rspan>1) { pData->spans.Add(rspan); pData->spans.Add(pData->nCol); pData->spans.Add(0); pData->spans.Add(0); pData->spans.Add(cspan); } //EndLayerout(pDraw,pData); return 0; }
void XDomTable::LayeroutTable(DRAWCONTEXT *pDraw, CELLDATA &data) { XU32 i; int bd=FindAttrib(XEAB::BORDER,0); int cp=pDraw->SPACING;//XMAX(FindAttrib(XEAB::CELLSPACING,1),0); int wd=pDraw->SETWIDTH;//FindAttrib(XEAB::WIDTH,0); //if(wd==900) // int a=0; //int wmm=wd; if(wd<0) wd=-pDraw->win.Width()*wd/100; //if(wd==660) // int a=0; XRect win=pDraw->win; int cs=pDraw->SPACING;//XMAX(FindAttrib(XEAB::CELLPADDING,1),0);//cellspacing XU8 nType=FindAttrib(XEAB::FRAME,XEnumFrame::BOX); //if(nType==XEF::VOID_X) bd=0; //XU8 nPad=pDraw->PADDING; //XU8 nSpa=pDraw->SPACING; //if(bd) cs++; { pDraw->SPACING=cp; if(bd) pDraw->SPACING+=2; pDraw->PADDING=cs; } if(wd>0) { wd-=(bd<<1)+cp; pDraw->win.left+=bd; pDraw->win.right=pDraw->win.left+wd; } else { pDraw->win.left+=bd; pDraw->win.right-=bd+cp; } XPoint pt(pDraw->win.left,pDraw->win.top); //if(0) { HandleChild(XDO_LAYEROUT_TABPRE,(XU32)pDraw,(XU32)&data); XU32 nc=data.setCols.GetSize(); data.Reset(pt.x,pt.y,XFALSE); if(nc>0) { int pw=0,ww=pDraw->win.Width(),nsc=0,nfc=0; int tw=ww,ssw=0; for(i=0;i<nc;i++) { if(data.setCols[i]>0) { nfc++; tw-=data.setCols[i]; ssw+=data.setCols[i]; } else if(data.setCols[i]<0) pw+=data.setCols[i]; else nsc++; } //if((nsc+nfc)<=0&&pw>-100&&pw<0) //{ //ww=ww*-100/pw; //} tw=tw*(100+pw)/100; if(pw!=0&&nsc>1) tw=tw/nsc; if(tw<=0) tw=ww/nc; if(nsc+nfc>0) pw=-100; //if(nsc<=0&&pw>-100) // ww=ww*100/pw; for(i=0;i<nc;i++) { if(data.setCols[i]>0) { if(ssw>wd) { data.setCols[i]=data.setCols[i]*wd/ssw; //XVar var(XEAB::WIDTH,data.setCols[i]); } continue; } else if(data.setCols[i]<0) { data.setCols[i]=data.setCols[i]*ww/pw; } else data.setCols[i]=tw; } } //data.tabs.InsertAt(0,(XU8)0,data.fixCols.GetSize()); } //else pDraw->win.right--; //XString8 str=FindAttrib(XEAB::ID,""); //if(str=="100") // int a=0; //else if(m_nWidth>0) pDraw->win.right=pDraw->win.left+wd; HandleChild(XDO_LAYEROUT_TABS,(XU32)pDraw,(XU32)&data); MoreRowSpan(&data); data.max.cx=0; //data.max.cy-=my; data.nMin=0; int nFixed=0; for(i=0;i<data.cols.GetSize();i++) { if(data.tabs[i]) nFixed+=data.fixCols[i]; else nFixed+=data.nMin; data.nMin+=data.cols[i]; data.max.cx+=data.fixCols[i]; } //if(data.max.cx==905) // int a=0; int mx=pDraw->win.Width(); int nMin=data.nMin; XBOOL bReset=XFALSE; if(data.max.cx<wd) { bReset=XTRUE; int nTotal=0,nLeft=wd,nLast=wd; for(i=0;i<data.tabs.GetSize();i++) { if(data.tabs[i]) //continue; nLeft-=data.fixCols[i]; else nTotal+=data.fixCols[i]; } if(nTotal==0) { for(i=0;i<data.tabs.GetSize();i++) { if(i+1==data.fixCols.GetSize()) data.fixCols[i]=nLast; else { if(data.max.cx<=0) data.fixCols[i]=wd/data.tabs.GetSize(); else data.fixCols[i]=data.fixCols[i]*wd/data.max.cx; nLast-=data.fixCols[i]; } } } else { for(i=0;i<data.tabs.GetSize();i++) { if(i+1==data.fixCols.GetSize()) data.fixCols[i]=nLast; else { if(!data.tabs[i]) //continue; data.fixCols[i]=data.fixCols[i]*nLeft/nTotal; nLast-=data.fixCols[i]; } } } //if(wmm>0) data.max.cx=wd; //else // data.max.cx= } else if(data.max.cx>mx)//&&m_bNoChild) { /*if(nFixed<mx) { int nLeft=mx-nFixed; for(i=0;i<data.cols.GetSize();i++) { if(data.tabs[i]) continue; int dd=XMAX(data.fixCols[i]-data.cols[i],0); data.fixCols[i]=data.cols[i]+nLeft*dd/(data.max.cx-nFixed); } data.max.cx=mx; } else*/ if(data.nMin<mx) { int nLeft=mx-data.nMin; for(i=0;i<data.cols.GetSize();i++) { int dd=XMAX(data.fixCols[i]-data.cols[i],0); data.fixCols[i]=data.cols[i]+nLeft*dd/(data.max.cx-data.nMin); } data.max.cx=mx; } else { for(i=0;i<data.cols.GetSize();i++) data.fixCols[i]=data.cols[i]; data.max.cx=data.nMin; } bReset=XTRUE; } //if(bReset) { int maxx=data.max.cx; data.Reset(pt.x,pt.y,XFALSE); //data.rowws.RemoveAll(XFALSE); //data.cols.RemoveAll(XFALSE); //data.fixCols.RemoveAll(XFALSE); data.bFinal=XTRUE; for(i=0;i<data.rowws.GetSize();i++) data.rowws[i]=0; HandleChild(XDO_LAYEROUT_TABS,(XU32)pDraw,(XU32)&data); MoreRowSpan(&data); data.max.cx=maxx; //data.max.cy-=my; data.nMin=nMin; } int ds=(bd<<1)+cp; //if(bd>0) { //bd--; data.max.cx+=ds;//bd<<1; //data.max.cy+=ds;//bd<<1; data.nMin+=ds;//bd<<1; } m_nHeight=ds; for(i=0;i<data.rowws.GetSize();i++) m_nHeight+=data.rowws[i]; int sh=pDraw->SETHEIGHT;//FindAttrib(XEAB::HEIGHT,0); /*if(m_nHeight<sh) { for(i=0;i<data.rowws.GetSize();i++) { if(m_nHeight>0) data.rowws[i]=data.rowws[i]*sh/m_nHeight; else data.rowws[i]=sh/data.rowws.GetSize(); } } &*/ m_nHeight=XMAX(m_nHeight,sh); // pDraw->win=rt; m_nMin=data.nMin; m_nWidth=data.max.cx; //m_nHeight=data.max.cy; //pDraw->PADDING=nPad; //pDraw->SPACING=nSpa; pDraw->win=win; }
void XDomTable::LayeroutCell(DRAWCONTEXT*pDraw,CELLDATA*pData) { if(m_nWidth<=0) return; int aw=pDraw->ALIGNW; pDraw->ALIGNW=XEA::LEFT; LAYEROUTDATA margin; CELLDATA data; data.Reset(pData->cur.x,pData->cur.y,XTRUE); PreLayerout(pDraw,&data,&margin); data.pData=XNULL; pDraw->bCollapse=FindAttrib(XEAB::BORDER_COLLAPSE,0); //if(!pData->bReturn) //if(m_bReturn) XU8 bInline=IsFingerInline(); //if(pDraw->SETWIDTH==-92) // int a=0; if(!bInline)//&&m_bReturn) { AlignRow(pDraw,pData); NewRowMust(pDraw,pData,m_bReturn); } //else m_nPosX=pData->cur.x;//+margin.nMargin[BORDERDATA::LEFT]; m_nPosY=pData->cur.y;//+margin.nMargin[BORDERDATA::TOP]; int bd=FindAttrib(XEAB::BORDER,0); int cs=pDraw->PADDING;//XMAX(FindAttrib(XEAB::CELLPADDING,1),0); int cp=pDraw->SPACING;//XMAX(FindAttrib(XEAB::CELLSPACING,1),0); /*int bdx=margin.nMargin[BORDERDATA::LEFT]+ margin.nPadding[BORDERDATA::LEFT]+ margin.nBorderWidth[BORDERDATA::LEFT]; int bdy=margin.nMargin[BORDERDATA::RIGHT]+ margin.nPadding[BORDERDATA::RIGHT]+ margin.nBorderWidth[BORDERDATA::RIGHT];*/ XU8 bCollapse=FindAttrib(XEAB::BORDER_COLLAPSE,0); if(bCollapse) bd+=2; //XU8 nType=FindAttrib(XEAB::FRAME,XEnumFrame::BOX); //if(nType==XEF::VOID_X) bd=0; // XRect rt=pDraw->win; //if(bd>0) { pDraw->win.left=m_nPosX+bd; pDraw->win.right=m_nPosX+m_nWidth-(bd+cs); } //else pDraw->win.right--; //if(m_bFinal&&m_nWidth==pDraw->win.Width()) data.rowws.DataFrom(m_rows); data.Reset(pData->cur.x+bd,pData->cur.y+bd,XFALSE); //if(margin.nBorderWidth[0]&&m_nPosX==3) // int a=0; InitMargin(pDraw,&data,&margin,m_nPosX,m_nPosY,m_nWidth,m_nHeight,XTRUE); m_nPosX-=bd; m_nPosY-=bd; HandleChild(XDO_LAYEROUT_TAB,(XU32)pDraw,(XU32)&data); XSize size(m_nWidth,m_nHeight); SetMargin(&margin,m_nWidth,m_nHeight,size); m_rows.DataFrom(data.rowws); // pDraw->PADDING=nPad; // pDraw->SPACING=nSpa; pDraw->win=rt; // pData->alignw=aw; //data.max.cx-=pData->cur.x; //data.max.cy-=pData->cur.y; EndLayerout(pDraw,pData); pDraw->ALIGNW=aw; SetRowSize(pDraw,pData,size,data.nMin,XFALSE); NewRow(0,pDraw,pData,pDraw->IND); //pDraw->win=rect; }
bool bmt::XML::LoadXML (void) { wchar_t wszXML [1024]; std::wstring documents_dir = BMT_GetDocumentsDir (); // // Windows 10 File Permission Fixes // // Normalize the directory as a whole wsprintf (wszXML, L"%s\\WB Games\\Batman Arkham Knight", documents_dir.c_str ()); BMT_SetNormalFileAttribs (wszXML); wsprintf (wszXML, L"%s\\WB Games\\Batman Arkham Knight\\GFXSettings.BatmanArkhamKnight.xml", documents_dir.c_str ()); // Normalize file ownership and attributes (Win10 fix) BMT_SetNormalFileAttribs (wszXML); FILE* fXML; errno_t ret = _wfopen_s (&fXML, wszXML, L"r,ccs=UTF-16LE"); if (ret != 0) { BMT_MessageBox (L"Unable to locate GFXSettings.BatmanArkhamKnight.XML.\n\n " L"This file is created when the game starts, try running the " L"game once.\n", L"Missing XML File", MB_OK | MB_ICONERROR); return false; } fseek (fXML, 0, SEEK_END); DWORD dwLen = ftell (fXML); rewind (fXML); wchar_t* xml = new wchar_t [dwLen + 1]; fread (xml, 1, dwLen, fXML); int last_brace = 0; // XML parser doesn't like the TM symbol, so get it the hell out of there! for (unsigned int i = 0; i < dwLen; i++) { if (xml [i] == L'™') xml [i] = L' '; if (xml [i] == L'>') last_brace = i; } xml [last_brace + 1] = 0; bmak_xml.parse <0> (xml); fclose (fXML); bmak_root = bmak_xml.first_node (); if (bmak_root == NULL) { BMT_MessageBox (L"GFXSettings.BatmanArkhamKnight.xml appears to be corrupt, please delete it and re-load the game\n", L"Corrupt XML File", MB_OK | MB_ICONHAND); return false; } bmak_application = bmak_root->first_node (); bmak_gamesettings = FindNode (bmak_root, L"GAMESETTINGS"); xml_attribute <wchar_t>* install_path_attrib = FindAttrib (FindNode (bmak_application, L"INSTALLPATH"), L"Value"); if (install_path_attrib != NULL) { install_path = install_path_attrib->value (); } xml_attribute <wchar_t>* exec_cmd_attrib = FindAttrib (FindNode (bmak_application, L"EXECCMD"), L"Value"); if (exec_cmd_attrib != NULL && install_path_attrib != NULL) { executable = install_path_attrib->value () + std::wstring (exec_cmd_attrib->value ()) + std::wstring (L".exe"); } return true; }