void CUICustomEdit::Draw() { CUIWindow::Draw (); Fvector2 pos; GetAbsolutePos (pos); m_lines.Draw (pos.x + m_textPos.x, pos.y + m_textPos.y); if(m_bInputFocus) { //draw cursor here Fvector2 outXY; outXY.x = 0.0f; float _h = m_lines.m_pFont->CurrentHeight_(); UI()->ClientToScreenScaledHeight(_h); outXY.y = pos.y + (GetWndSize().y - _h)/2.0f; float _w_tmp; int i = m_lines.m_iCursorPos; string256 buff; strncpy (buff,m_lines.m_text.c_str(),i); buff[i] = 0; _w_tmp = m_lines.m_pFont->SizeOf_(buff); UI()->ClientToScreenScaledWidth (_w_tmp); outXY.x = pos.x + _w_tmp; _w_tmp = m_lines.m_pFont->SizeOf_("-"); UI()->ClientToScreenScaledWidth (_w_tmp); UI()->ClientToScreenScaled (outXY); m_lines.m_pFont->Out (outXY.x, outXY.y, "_"); } }
void CUICustomSpin::Draw() { CUIWindow::Draw (); Fvector2 pos; GetAbsolutePos (pos); m_pLines->Draw (pos.x + 3, pos.y); }
bool CUICustomMap::IsRectVisible(Frect r) { Frect map_visible_rect = GetClipperRect(); Fvector2 pos; GetAbsolutePos(pos); r.add(pos.x,pos.y); return !!map_visible_rect.intersected(r); }
void OUGUIObject::OnDrawBoard(DWORD dwColor) { OUPOINT ptPos1 = GetAbsolutePos(); OUPOINT ptPos2 = ptPos1 + m_ptSize; m_pHGE->Gfx_RenderLine(ptPos1.m_fX, ptPos1.m_fY, ptPos1.m_fX, ptPos2.m_fY, dwColor); m_pHGE->Gfx_RenderLine(ptPos1.m_fX, ptPos2.m_fY, ptPos2.m_fX, ptPos2.m_fY, dwColor); m_pHGE->Gfx_RenderLine(ptPos2.m_fX, ptPos2.m_fY, ptPos2.m_fX, ptPos1.m_fY, dwColor); m_pHGE->Gfx_RenderLine(ptPos2.m_fX, ptPos1.m_fY, ptPos1.m_fX, ptPos1.m_fY, dwColor); }
bool CUICustomMap::NeedShowPointer(Frect r) { Frect map_visible_rect = GetClipperRect(); map_visible_rect.shrink(5,5); Fvector2 pos; GetAbsolutePos(pos); r.add(pos.x,pos.y); return !map_visible_rect.intersected(r); }
void CUIMultiTextStatic::Draw() { Fvector2 p; GetAbsolutePos (p); for (Phrases_it it = m_vPhrases.begin(); it != m_vPhrases.end(); ++it) { it->effect.Out(it->outX + p.x, it->outY + p.y, *it->str); } inherited::Draw(); }
bool CUILevelMap::OnMouse (float x, float y, EUIMessages mouse_action) { if (inherited::OnMouse(x,y,mouse_action)) return true; if (MapWnd()->GlobalMap()->Locked()) return true; /* if (MapWnd()->m_flags.is_any(CUIMapWnd::lmZoomIn+CUIMapWnd::lmZoomOut)) return false; if (mouse_action == WINDOW_LBUTTON_DOWN) { if (MapWnd()->m_flags.test(CUIMapWnd::lmUserSpotAdd) ) MapWnd()->AddUserSpot(this); else if(fsimilar(MapWnd()->GlobalMap()->GetCurrentZoom(), MapWnd()->GlobalMap()->GetMinZoom(),EPS_L) ) MapWnd()->SetTargetMap( this, true ); return true; }; */ // Real Wolf: Колбек с позицией и названием карты при клике по самой карте. 03.08.2014. if (mouse_action == WINDOW_LBUTTON_DOWN) { Fvector2 cursor_pos = GetUICursor()->GetCursorPosition(); Fvector2 _p; GetAbsolutePos (_p); cursor_pos.sub (_p); Fvector2 p = ConvertLocalToReal(cursor_pos); Fvector pos; pos.set (p.x, 0.0f, p.y); g_actor->callback(GameObject::eUIMapClick)(pos, MapName().c_str() ); } if(mouse_action==WINDOW_MOUSE_MOVE && (FALSE==pInput->iGetAsyncBtnState(0)) ) { if( MapWnd() ) { MapWnd()->Hint (MapName()); return true; } } return false; }
void Button::m_ComputeMouseOver(void) { // Get the mouse position int mouseX = 0, mouseY = 0; SDL_GetMouseState(&mouseX, &mouseY); // If in fullscreen, or zoomed in, make mouse coordinates proportional /*XY zoom = g_renderer->GetScale(); mouseX *= zoom.x; mouseY *= zoom.y;*/ // Determine the absolute positon of the bounding box Coordinates absPos = GetAbsolutePos(); SDL_Rect absoluteBox = { absPos.x + m_boundingBox.x, absPos.y + m_boundingBox.y, m_boundingBox.w, m_boundingBox.h }; // Are they within the bounds? m_mouseIsOver = true; Directions<float> rectBounds = Directions<float>(absoluteBox); // Cases that disprove if (mouseY < rectBounds.top) { m_mouseIsOver = false; return; } if (mouseY > rectBounds.bottom) { m_mouseIsOver = false; return; } if (mouseX < rectBounds.left) { m_mouseIsOver = false; return; } if (mouseX > rectBounds.right) { m_mouseIsOver = false; return; } }
void CUICustomEdit::Draw() { Fvector2 pos, out; GetAbsolutePos (pos); CGameFont* font = TextItemControl()->m_pFont; if ( ec().need_update() || m_force_update ) { float ui_width = GetWidth(); LPCSTR cursor_str = ec().str_before_cursor(); u32 cursor_str_size = xr_strlen( cursor_str ); LPCSTR istr = cursor_str; float str_length = font->SizeOf_( istr ); UI().ClientToScreenScaledWidth( str_length ); u32 ix = 0; while ( (str_length > ui_width) && (ix < cursor_str_size) ) { istr = cursor_str + ix; str_length = font->SizeOf_( istr ); UI().ClientToScreenScaledWidth( str_length ); ++ix; } istr = cursor_str + ix; LPCSTR astr = ec().str_edit() + ix; u32 str_size = xr_strlen( ec().str_edit() ); u32 jx = 1; strncpy_s (m_out_str, sizeof(m_out_str), astr, jx); str_length = font->SizeOf_(m_out_str); UI().ClientToScreenScaledWidth(str_length); while((str_length < ui_width) && (jx < str_size-ix)) { strncpy_s (m_out_str, sizeof(m_out_str), astr, jx); str_length = font->SizeOf_(m_out_str); UI().ClientToScreenScaledWidth(str_length); ++jx; } strncpy_s (m_out_str, sizeof(m_out_str), astr, jx); TextItemControl()->SetText(m_out_str); if(TextItemControl()->IsPasswordMode()) { string256 passText; shared_str str(istr); int sz = (int)str.size(); for (int i = 0; i < sz; i++) passText[i] = '*'; passText[sz] = 0; m_dx_cur = font->SizeOf_(passText); // cursor_str } else m_dx_cur = font->SizeOf_(istr); // cursor_str m_force_update = false; } inherited::Draw(); if (m_bInputFocus) //draw cursor here { out.x = pos.x + 0.0f + TextItemControl()->m_TextOffset.x + TextItemControl()->GetIndentByAlign(); out.y = pos.y + 2.0f + TextItemControl()->m_TextOffset.y + TextItemControl()->GetVIndentByAlign(); UI().ClientToScreenScaled( out ); out.x += m_dx_cur; // cursor_str font->Out (out.x, out.y, "_"); } font->OnRender (); }
void CUICustomEdit::Draw() { VERIFY( m_pLines ); Fvector2 pos, out; GetAbsolutePos( pos ); CGameFont* font = m_pLines->m_pFont; if ( ec().need_update() || m_force_update ) { float ui_width = GetWidth(); LPCSTR cursor_str = ec().str_before_cursor(); u32 cursor_str_size = xr_strlen( cursor_str ); LPCSTR istr = cursor_str; float str_length = font->SizeOf_( istr ); UI()->ClientToScreenScaledWidth( str_length ); u32 ix = 0; while ( (str_length > ui_width) && (ix < cursor_str_size) ) { istr = cursor_str + ix; str_length = font->SizeOf_( istr ); UI()->ClientToScreenScaledWidth( str_length ); ++ix; } istr = cursor_str + ix; LPCSTR astr = ec().str_edit() + ix; u32 str_size = xr_strlen( ec().str_edit() ); u32 jx = 1; strncpy_s( m_out_str, sizeof(m_out_str), astr, jx ); str_length = font->SizeOf_( m_out_str ); UI()->ClientToScreenScaledWidth( str_length ); while ( (str_length < ui_width) && (jx < str_size-ix) ) { strncpy_s( m_out_str, sizeof(m_out_str), astr, jx ); str_length = font->SizeOf_( m_out_str ); UI()->ClientToScreenScaledWidth( str_length ); ++jx; } strncpy_s( m_out_str, sizeof(m_out_str), astr, jx ); inherited::SetText( m_out_str ); m_dx_cur = font->SizeOf_( istr ); // cursor_str m_force_update = false; } inherited::Draw(); if ( m_bInputFocus ) //draw cursor here { out.x = pos.x + 0.0f + GetTextX() + m_pLines->GetIndentByAlign(); out.y = pos.y + 2.0f + GetTextY() + m_pLines->GetVIndentByAlign(); UI()->ClientToScreenScaled( out ); out.x += m_dx_cur; // cursor_str font->Out( out.x, out.y, "_" ); } font->OnRender(); }
void CUITrackBar::UpdatePosRelativeToMouse() { float _bkf = 0.0f; int _bki = 0; if(m_b_is_float) { _bkf = m_f_val; }else { _bki = m_i_val; } float btn_width = m_pSlider->GetWidth(); float window_width = GetWidth(); //float fpos = cursor_pos.x; // Start.Real Wolf.06.11.14. Fvector2 pos; GetAbsolutePos(pos); float fpos = GetUICursor()->GetCursorPosition().x - pos.x; // Finish.Real Wolf.06.11.14. if( GetInvert() ) fpos = window_width - fpos; if (fpos < btn_width/2) fpos = btn_width/2; else if (fpos > window_width - btn_width/2) fpos = window_width - btn_width/2; float __fval; float __fmax = (m_b_is_float)?m_f_max:(float)m_i_max; float __fmin = (m_b_is_float)?m_f_min:(float)m_i_min; float __fstep = (m_b_is_float)?m_f_step:(float)m_i_step; __fval = (__fmax - __fmin)*(fpos - btn_width/2)/(window_width - btn_width)+ __fmin; float _d = (__fval-__fmin); float _v = _d/__fstep; int _vi = iFloor(_v); float _vf = __fstep*_vi; if(_d-_vf>__fstep/2.0f) _vf += __fstep; __fval = __fmin+_vf; clamp (__fval, __fmin, __fmax); if(m_b_is_float) m_f_val = __fval; else m_i_val = iFloor(__fval); bool b_ch = false; if(m_b_is_float) { b_ch = !fsimilar(_bkf, m_f_val); }else { b_ch = (_bki != m_i_val); } if(b_ch) GetMessageTarget()->SendMessage(this, BUTTON_CLICKED, NULL); UpdatePos (); }
// ---------------------------------------------------------------------------------- // SSOWebAccessible() // ---------------------------------------------------------------------------------- // SSO commun aux navigateurs implémentant l'interface IAccessible // Utilise forcément la méthode de configuration simplifiée // ---------------------------------------------------------------------------------- // [out] 0=OK, -1=pas réussi (champs non trouvés ou autre erreur) // ---------------------------------------------------------------------------------- int SSOWebAccessible(HWND w,int iAction,int iBrowser) { TRACE((TRACE_ENTER,_F_, "w=0x%08lx iAction=%d iBrowser=%d",w,iAction,iBrowser)); int rc=-1; IAccessible *pAccessible=NULL; IAccessible *pTopAccessible=NULL; IDispatch *pIDispatch=NULL; int i; T_SUIVI_ACCESSIBLE tSuivi,*ptSuivi; HRESULT hr; long lCount; VARIANT vtChild,vtState; int iId1Index; int iId2Index; int iId3Index; int iId4Index; IAccessible *pNiveau0=NULL,*pChildNiveau1=NULL, *pChildNiveau2=NULL; int iNbTry; // ISSUE#39 : important, initialisation pour que le pointer iAccessible soit à NULL sinon le release provoque plantage ! ZeroMemory(&tSuivi,sizeof(T_SUIVI_ACCESSIBLE)); // BROWSER_MAXTHON: strcpy_s(tSuivi.szClassName,sizeof(tSuivi.szClassName),"Afx:400000:2008:10011:0:0"); tSuivi.w=NULL; if (iBrowser==BROWSER_IE) { // enum des fils à la recherche de la fenêtre de rendu Web // ISSUE#70 0.95 essaie aussi avec contenu flash (à faire en 1er) // pour tester le flash : http://itmj.homelinux.org:9090/workspace/Main.html?ap=1 strcpy_s(tSuivi.szClassName,sizeof(tSuivi.szClassName),"MacromediaFlashPlayerActiveX"); EnumChildWindows(w,WebEnumChildProc,(LPARAM)&tSuivi); if (tSuivi.w!=NULL) { TRACE((TRACE_INFO,_F_,"MacromediaFlashPlayerActiveX. Visible = %d",IsWindowVisible(tSuivi.w))); } if (tSuivi.w==NULL || ((tSuivi.w!=NULL) && (!IsWindowVisible(tSuivi.w)))) // pas trouvé de flash ou trouvé flash mais non visible { strcpy_s(tSuivi.szClassName,sizeof(tSuivi.szClassName),"Internet Explorer_Server"); EnumChildWindows(w,WebEnumChildProc,(LPARAM)&tSuivi); if (tSuivi.w!=NULL) { TRACE((TRACE_INFO,_F_,"Internet Explorer_Server = %d",IsWindowVisible(tSuivi.w))); } } if (tSuivi.w==NULL) { TRACE((TRACE_ERROR,_F_,"EnumChildWindows() => pas trouve la fenetre de contenu")); goto end; } // Obtient un IAccessible hr=AccessibleObjectFromWindow(tSuivi.w,(DWORD)OBJID_CLIENT,IID_IAccessible,(void**)&pAccessible); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"AccessibleObjectFromWindow(IID_IAccessible)=0x%08lx",hr)); goto end; } } else if (iBrowser==BROWSER_CHROME) { // enum des fils à la recherche de la fenêtre de rendu Web strcpy_s(tSuivi.szClassName,sizeof(tSuivi.szClassName),"Chrome_RenderWidgetHostHWND"); // ISSUE #98 . 0.99 : pour chrome 33 ou 34+, l'énumération refonctionne (cf ISSUE#95 plus bas) mais la fenêtre // qu'on récupère ne fonctionne pas. Elle a un vtRole.lVal=0x0000000a au lieu de vtRole.lVal=0x0000000f, et 0 childs ! // La version 34 de Chrome se reconnait grace à la fenêtre de classe static qui est remontée juste avant celle // qu'on cherche, du coup si je trouve fenêtre static, je rebranche sur la recherche sans énumération // 11/01-15:53:58:470 DEBUG WebEnumChildProc Fenetre classe=Static w=0x00030618 // 11/01-15:53:58:470 DEBUG WebEnumChildProc Fenetre classe=Chrome_RenderWidgetHostHWND w=0x00080120 strcpy_s(tSuivi.szExclude,sizeof(tSuivi.szExclude),"Static"); EnumChildWindows(w,WebEnumChildProc,(LPARAM)&tSuivi); if (tSuivi.w==NULL) { // ISSUE#95 / 0.98 : pour Chome 31 ou 32+, impossible de rechercher la fenêtre fille, on est obligé de passer par IAccessible : // La fenêtre principale a 1 child de niveau 1, il faut prendre le 1er. // Le child de niveau 1 a 2 childs, il faut prendre le 2eme. // Le child de niveau 2 a 4 childs, il faut prendre le 2eme --> c'est la fenêtre de contenu web ! hr=AccessibleObjectFromWindow(w,(DWORD)OBJID_CLIENT,IID_IAccessible,(void**)&pNiveau0); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"AccessibleObjectFromWindow(IID_IAccessible)=0x%08lx",hr)); goto end; } // La fenêtre principale a 1 child de niveau 1, il faut prendre le 1er. vtChild.vt=VT_I4; vtChild.lVal=1; hr=pNiveau0->get_accChild(vtChild,&pIDispatch); TRACE((TRACE_DEBUG,_F_,"pAccessible->get_accChild(%ld)=0x%08lx",vtChild.lVal,hr)); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accChild(%ld)=0x%08lx",vtChild.lVal,hr)); goto end; } hr=pIDispatch->QueryInterface(IID_IAccessible, (void**) &pChildNiveau1); TRACE((TRACE_DEBUG,_F_,"QueryInterface(IID_IAccessible)=0x%08lx",hr)); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"QueryInterface(IID_IAccessible)=0x%08lx",hr)); goto end; } pIDispatch->Release(); pIDispatch=NULL; // Le child de niveau 1 a 2 childs, il faut prendre le 2eme. vtChild.vt=VT_I4; vtChild.lVal=2; hr=pChildNiveau1->get_accChild(vtChild,&pIDispatch); TRACE((TRACE_DEBUG,_F_,"pChildNiveau1->get_accChild(%ld)=0x%08lx",vtChild.lVal,hr)); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accChild(%ld)=0x%08lx",vtChild.lVal,hr)); goto end; } hr=pIDispatch->QueryInterface(IID_IAccessible, (void**) &pChildNiveau2); TRACE((TRACE_DEBUG,_F_,"QueryInterface(IID_IAccessible)=0x%08lx",hr)); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"QueryInterface(IID_IAccessible)=0x%08lx",hr)); goto end; } pIDispatch->Release(); pIDispatch=NULL; // Le child de niveau 2 a 4 childs, il faut prendre le 2eme. vtChild.vt=VT_I4; vtChild.lVal=2; hr=pChildNiveau2->get_accChild(vtChild,&pIDispatch); TRACE((TRACE_DEBUG,_F_,"pChildNiveau2->get_accChild(%ld)=0x%08lx",vtChild.lVal,hr)); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accChild(%ld)=0x%08lx",vtChild.lVal,hr)); goto end; } hr=pIDispatch->QueryInterface(IID_IAccessible, (void**) &pAccessible); TRACE((TRACE_DEBUG,_F_,"QueryInterface(IID_IAccessible)=0x%08lx",hr)); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"QueryInterface(IID_IAccessible)=0x%08lx",hr)); goto end; } pIDispatch->Release(); pIDispatch=NULL; } else { // Obtient un IAccessible hr=AccessibleObjectFromWindow(tSuivi.w,(DWORD)OBJID_CLIENT,IID_IAccessible,(void**)&pAccessible); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"AccessibleObjectFromWindow(IID_IAccessible)=0x%08lx",hr)); goto end; } } VARIANT vtMe,vtRole; vtMe.vt=VT_I4; vtMe.lVal=CHILDID_SELF; hr=pAccessible->get_accRole(vtMe,&vtRole); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accRole()=0x%08lx",hr)); goto end; } TRACE((TRACE_DEBUG,_F_,"get_accRole() vtRole.lVal=0x%08lx",vtRole.lVal)); } else if (iBrowser==BROWSER_FIREFOX3 || iBrowser==BROWSER_FIREFOX4) { // accNavigate permet de trouver la fenêtre de rendu web hr=AccessibleObjectFromWindow(w,(DWORD)OBJID_CLIENT,IID_IAccessible,(void**)&pTopAccessible); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"AccessibleObjectFromWindow(IID_IAccessible)=0x%08lx",hr)); goto end; } VARIANT vtStart,vtResult; vtStart.vt=VT_I4; vtStart.lVal=CHILDID_SELF; hr=pTopAccessible->accNavigate(0x1009,vtStart,&vtResult); // NAVRELATION_EMBEDS = 0x1009 pTopAccessible->Release();pTopAccessible=NULL; if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"accNavigate(NAVRELATION_EMBEDS)=0x%08lx",hr)); goto end; } TRACE((TRACE_DEBUG,_F_,"accNavigate(NAVRELATION_EMBEDS) vtEnd=%ld",vtResult.lVal)); if (vtResult.vt!=VT_DISPATCH) { TRACE((TRACE_ERROR,_F_,"accNavigate(NAVRELATION_EMBEDS) is not VT_DISPATCH")); goto end; } pIDispatch=(IDispatch*)vtResult.lVal; if (pIDispatch==NULL) { TRACE((TRACE_ERROR,_F_,"accNavigate(NAVRELATION_EMBEDS) pIDispatch=NULL")); goto end; } hr=pIDispatch->QueryInterface(IID_IAccessible, (void**)&pAccessible); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"QueryInterface(IID_IAccessible)=0x%08lx",hr)); goto end; } } // à ce stade, on a un pAccessible pour travailler, quel que soit le navigateur vtChild.vt=VT_I4; vtChild.lVal=CHILDID_SELF; VariantInit(&vtState); hr=pAccessible->get_accState(vtChild,&vtState); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accState()=0x%08lx",hr)); goto end; } TRACE((TRACE_DEBUG,_F_,"get_accState(DOCUMENT PRINCIPAL) vtState.lVal=0x%08lx",vtState.lVal)); // ISSUE#163 : plutôt que d'attendre 1 fois 5 secondes, on attend 5 fois 100ms et ensuite on continue, // ça ne semble pas être bloquant surtout que Chrome et IE ont l'air de se mettre BUSY dès qu'ils n'ont pas le focus... iNbTry=1; while ((vtState.lVal & STATE_SYSTEM_BUSY) && iNbTry < 6) { TRACE((TRACE_DEBUG,_F_,"STATE_SYSTEM_BUSY -- wait 100ms before retry #%d (max 5)",iNbTry)); Sleep(100); VariantInit(&vtState); hr=pAccessible->get_accState(vtChild,&vtState); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accState()=0x%08lx",hr)); } TRACE((TRACE_DEBUG,_F_,"get_accState(DOCUMENT PRINCIPAL) vtState.lVal=0x%08lx",vtState.lVal)); iNbTry++; } lCount=0; hr=pAccessible->get_accChildCount(&lCount); TRACE((TRACE_DEBUG,_F_,"get_accChildCount() hr=0x%08lx lCount=%ld",hr,lCount)); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accChildCount() hr=0x%08lx",hr)); goto end; } if (iBrowser==BROWSER_CHROME) // lCount=0 arrive parfois quelque fois après ouverture d'un nouvel onglet { iNbTry=0; while (lCount==0 && iNbTry<10) // ajouté en 0.93B1 : 10 essais supplémentaires au lieu d'un seul { Sleep(150); pAccessible->Release(); pAccessible=NULL; // Obtient un IAccessible hr=AccessibleObjectFromWindow(tSuivi.w,(DWORD)OBJID_CLIENT,IID_IAccessible,(void**)&pAccessible); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"AccessibleObjectFromWindow(IID_IAccessible)=0x%08lx",hr)); goto end; } hr=pAccessible->get_accChildCount(&lCount); TRACE((TRACE_DEBUG,_F_,"get_accChildCount() hr=0x%08lx lCount=%ld",hr,lCount)); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accChildCount() hr=0x%08lx",hr)); goto end; } iNbTry++; } if (lCount==0) // ça n'a toujours pas marché, on abandonne... { TRACE((TRACE_ERROR,_F_,"get_accChildCount() hr=0x%08lx",hr)); goto end; } } ZeroMemory(&tSuivi,sizeof(T_SUIVI_ACCESSIBLE)); // déplacé plus haut, mais laissé ici aussi dans le doute ça coute pas cher. tSuivi.w=w; tSuivi.iAction=iAction; tSuivi.iErreur=0; tSuivi.iLevel=0; tSuivi.iPwdIndex=-1; tSuivi.iNbPwdFound=0; tSuivi.iBrowser=iBrowser; // ISSUE#279 #ifdef TRACES_ACTIVEES DoWebAccessible("",w,pAccessible,&tSuivi); #else DoWebAccessible(w,pAccessible,&tSuivi); #endif TRACE((TRACE_INFO,_F_,"tSuivi.iErreur=%d",tSuivi.iErreur)); if (tSuivi.iErreur==0) { ptSuivi=&tSuivi; vtChild.vt=VT_I4; vtChild.lVal=CHILDID_SELF; // 0.93B1 / ISSUE#40 : avant de démarrer les saisies, il faut vérifier qu'on a trouvé tous les champs attendus // En effet, comme on ne cherche plus les champs par leurs noms, on peut provoquer des mises au premier plan intempestives // de la fenêtre du navigateur si le titre et l'URL ne permettent pas de reconnaitre la page de login de manière certaine TRACE((TRACE_INFO,_F_,"Page analysee, verification (lCount=%d ptSuivi->iTextFieldIndex=%d)",lCount,ptSuivi->iTextFieldIndex)); // 0.99B3 / ISSUE#103 : En mode configration simplifiée, la position du champ identifiant est considérée comme absolue // si le champ de mot de passe est configuré à 0 // if (*gptActions[ptSuivi->iAction].szPwdName!=0 && ptSuivi->iPwdIndex==-1) if (*gptActions[ptSuivi->iAction].szPwdName!=0 && atoi(gptActions[ptSuivi->iAction].szPwdName)!=0 && ptSuivi->iPwdIndex==-1) { TRACE((TRACE_ERROR,_F_,"Un champ mot de passe etait attendu mais n'a pas ete trouve => le SSO ne sera pas execute")); goto end; } iId1Index=GetAbsolutePos(gptActions[ptSuivi->iAction].szId1Name,gptActions[ptSuivi->iAction].szPwdName,ptSuivi->iPwdIndex,ptSuivi); iId2Index=GetAbsolutePos(gptActions[ptSuivi->iAction].szId2Name,gptActions[ptSuivi->iAction].szPwdName,ptSuivi->iPwdIndex,ptSuivi); iId3Index=GetAbsolutePos(gptActions[ptSuivi->iAction].szId3Name,gptActions[ptSuivi->iAction].szPwdName,ptSuivi->iPwdIndex,ptSuivi); iId4Index=GetAbsolutePos(gptActions[ptSuivi->iAction].szId4Name,gptActions[ptSuivi->iAction].szPwdName,ptSuivi->iPwdIndex,ptSuivi); if (iId1Index==-1 || iId2Index==-1 || iId3Index==-1 || iId4Index==-1) { TRACE((TRACE_ERROR,_F_,"Au moins un des champs n'a pas ete trouve => le SSO ne sera pas execute")); goto end; } // Vérification OK, on peut mettre la fenêtre au premier plan et démarrer les saisies TRACE((TRACE_INFO,_F_,"Verifications OK, demarrage des saisies (lCount=%d ptSuivi->iTextFieldIndex=%d)",lCount,ptSuivi->iTextFieldIndex)); SetForegroundWindow(ptSuivi->w); // ISSUE#266 : Bidouille contournement incident ouvert sur chromium : 533830 if (iBrowser==BROWSER_CHROME && gpAccessibleChromeURL!=NULL) { VARIANT vtSelf; VARIANT vtURLBarState; vtSelf.vt=VT_I4; vtSelf.lVal=CHILDID_SELF; hr=gpAccessibleChromeURL->get_accState(vtSelf,&vtURLBarState); TRACE((TRACE_DEBUG,_F_,"get_accState() vtURLBarState.lVal=0x%08lx",vtURLBarState.lVal)); if (vtURLBarState.lVal & STATE_SYSTEM_FOCUSED) { TRACE((TRACE_INFO,_F_,"BIDOUILLE BARRE URL CHROME !")); // on tabule jusqu'à mettre le focus sur champ id1 ou pwd KBSimEx(w,"[TAB]","","","","",""); int iAntiLoop=0; VARIANT vtIdOrPwdState; vtIdOrPwdState.lVal=0; while ((!(vtIdOrPwdState.lVal & STATE_SYSTEM_FOCUSED)) && iAntiLoop <10) { KBSimEx(w,"[TAB]","","","","",""); Sleep(10); if (iId1Index>=0) { hr=ptSuivi->pTextFields[iId1Index]->accSelect(SELFLAG_TAKEFOCUS,vtChild); TRACE((TRACE_DEBUG,_F_,"accSelect(id1)=0x%08lx",hr)); hr=ptSuivi->pTextFields[iId1Index]->get_accState(vtSelf,&vtIdOrPwdState); TRACE((TRACE_DEBUG,_F_,"get_accState(id1)=0x%08lx vtId1State.lVal=0x%08lx",hr,vtIdOrPwdState.lVal)); } else if (ptSuivi->iPwdIndex!=-1) { hr=ptSuivi->pTextFields[ptSuivi->iPwdIndex]->accSelect(SELFLAG_TAKEFOCUS,vtChild); TRACE((TRACE_DEBUG,_F_,"accSelect(pwd)=0x%08lx",hr)); hr=ptSuivi->pTextFields[ptSuivi->iPwdIndex]->get_accState(vtSelf,&vtIdOrPwdState); TRACE((TRACE_DEBUG,_F_,"get_accState(pwd)=0x%08lx vtId1State.lVal=0x%08lx",hr,vtIdOrPwdState.lVal)); } else // tant pis, cas à peu près impossible, on sort { break; } iAntiLoop++; } } } // fin bidouille chrome if (iId1Index>=0) PutAccValue(ptSuivi->w,ptSuivi->pTextFields[iId1Index],vtChild,gptActions[ptSuivi->iAction].szId1Value); if (iId2Index>=0) PutAccValue(ptSuivi->w,ptSuivi->pTextFields[iId2Index],vtChild,gptActions[ptSuivi->iAction].szId2Value); if (iId3Index>=0) PutAccValue(ptSuivi->w,ptSuivi->pTextFields[iId3Index],vtChild,gptActions[ptSuivi->iAction].szId3Value); if (iId4Index>=0) PutAccValue(ptSuivi->w,ptSuivi->pTextFields[iId4Index],vtChild,gptActions[ptSuivi->iAction].szId4Value); // Mdp if (ptSuivi->iPwdIndex!=-1) { // CODE A GARDER POUR BUGS OUVERTS CHEZ CHROME #75908 et #75911 /* int iAntiLoop=0; hr=ptSuivi->pTextFields[ptSuivi->iPwdIndex]->accSelect(SELFLAG_TAKEFOCUS,vtChild); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"accSelect(SELFLAG_TAKEFOCUS)=0x%08lx",hr)); } TRACE((TRACE_DEBUG,_F_,"accSelect(SELFLAG_TAKEFOCUS)=0x%08lx",hr)); VARIANT vtSelf; VARIANT vtState; vtSelf.vt=VT_I4; vtSelf.lVal=CHILDID_SELF; hr=ptSuivi->pTextFields[ptSuivi->iPwdIndex]->get_accState(vtSelf,&vtState); TRACE((TRACE_DEBUG,_F_,"get_accState() vtState.lVal=0x%08lx",vtState.lVal)); while (iAntiLoop <50) //while ((!(vtState.lVal & STATE_SYSTEM_FOCUSED)) && iAntiLoop <10) { Sleep(100); KBSimEx(w,"[TAB]","","","","",""); Sleep(100); hr=ptSuivi->pTextFields[ptSuivi->iPwdIndex]->get_accState(vtSelf,&vtState); if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"get_accState(CHILDID_SELF)=0x%08lx",hr)); } TRACE((TRACE_DEBUG,_F_,"get_accState() vtState.lVal=0x%08lx",vtState.lVal)); iAntiLoop++; } */ Sleep(100); // ISSUE#163 (et autres problèmes, notamment identifiant saisi tronqué avec le reste dans le mot de passe) hr=ptSuivi->pTextFields[ptSuivi->iPwdIndex]->accSelect(SELFLAG_TAKEFOCUS,vtChild); if (FAILED(hr)) // ISSUE#251 : en cas d'erreur du accSelect (vu UNE fois), on fait TAB à l'aveugle, ça évite de taper le mdp dans le champ id { TRACE((TRACE_ERROR,_F_,"accSelect(SELFLAG_TAKEFOCUS)=0x%08lx",hr)); // remarque : nombre de tab à faire = fonction de la position relative du champ id par rapport au champ mdp Sleep(100); for (i=0; i<abs(atoi(gptActions[ptSuivi->iAction].szId1Name));i++) { KBSimEx(w,"[TAB]","","","","",""); } Sleep(100); } if ((*gptActions[ptSuivi->iAction].szPwdEncryptedValue!=0)) { //char *pszPassword=swCryptDecryptString(gptActions[ptSuivi->iAction].szPwdEncryptedValue,ghKey1); char *pszPassword=GetDecryptedPwd(gptActions[ptSuivi->iAction].szPwdEncryptedValue); if (pszPassword!=NULL) { // 1.09B2 : essaie de faire put_accValue avant de se rabattre sur la simulation de frappe BSTR bstrValue=GetBSTRFromSZ(pszPassword); hr=S_OK; if (bstrValue!=NULL) { hr=ptSuivi->pTextFields[ptSuivi->iPwdIndex]->put_accValue(vtChild,bstrValue); TRACE((TRACE_INFO,_F_,"pAccessible->put_accValue() : hr=0x%08lx",hr)); } if (bstrValue==NULL || FAILED(hr)) { KBSim(ptSuivi->w,TRUE,100,pszPassword,TRUE); } if (bstrValue!=NULL) { SecureZeroMemory(bstrValue,SysStringByteLen(bstrValue)); SysFreeString(bstrValue); bstrValue=NULL; } SecureZeroMemory(pszPassword,strlen(pszPassword)); free(pszPassword); } } } // Validation si demandée if (*gptActions[ptSuivi->iAction].szValidateName!=0) { Sleep(100); // ISSUE#101 // KBSimEx(NULL,gptActions[ptSuivi->iAction].szValidateName,"","","","",""); // ISSUE#101 suite : on autorise aussi le mot de passe sinon c'est naze... char szDecryptedPassword[LEN_PWD+1]; // char *pszPassword=swCryptDecryptString(gptActions[ptSuivi->iAction].szPwdEncryptedValue,ghKey1); char *pszPassword=GetDecryptedPwd(gptActions[ptSuivi->iAction].szPwdEncryptedValue); if (pszPassword!=NULL) { strcpy_s(szDecryptedPassword,sizeof(szDecryptedPassword),pszPassword); SecureZeroMemory(pszPassword,strlen(pszPassword)); free(pszPassword); } else { *szDecryptedPassword=0; } KBSimEx(NULL,gptActions[ptSuivi->iAction].szValidateName, gptActions[iAction].szId1Value, gptActions[iAction].szId2Value, gptActions[iAction].szId3Value, gptActions[iAction].szId4Value,szDecryptedPassword); SecureZeroMemory(szDecryptedPassword,sizeof(szDecryptedPassword)); } guiNbWEBSSO++; } rc=0; end: for (i=0;i<MAX_TEXT_FIELDS;i++) if (tSuivi.pTextFields[i]!=NULL) tSuivi.pTextFields[i]->Release(); if (pAccessible!=NULL) pAccessible->Release(); if (pTopAccessible!=NULL) pTopAccessible->Release(); if (pIDispatch!=NULL) pIDispatch->Release(); if (pNiveau0!=NULL) pNiveau0->Release(); if (pChildNiveau1!=NULL) pChildNiveau1->Release(); if (pChildNiveau2!=NULL) pChildNiveau2->Release(); if (gpAccessibleChromeURL!=NULL) { gpAccessibleChromeURL->Release(); gpAccessibleChromeURL=NULL; } TRACE((TRACE_LEAVE,_F_, "rc=%d",rc)); return rc; }
void AnimationTimeline::DrawBoundingBox(C_Renderer& rnd) { GUIProgress::DrawBoundingBox(rnd); DrawableObject* sel2 = Game->GetMainContainer()->Selected; map<DrawableObject*, ObjectAnimations>::iterator i = objects.end(); if(sel2!=0) { i = objects.find(sel2); if(i==objects.end()) { if(sel==0) return; i = objects.find(sel); if(i==objects.end()) return; } else { sel = sel2; } } else { if(sel==0) return; i = objects.find(sel); if(i==objects.end()) return; } for(map<int, set<AnimationKey> >::iterator f = i->second.animations.begin(); f!=i->second.animations.end(); f++) { for(set<AnimationKey>::iterator f2 = f->second.begin(); f2 != f->second.end(); f2++) { RectangleF Pos = GetAbsolutePos(); Pos.left += m_Region.left; Pos.top += m_Region.top; Pos.right -= m_Region.right; Pos.bottom -= m_Region.bottom; float mul = ((float)f2->frame-GetMin())/(GetMax()-GetMin()); if(m_flags&OBJECT_Flag_PTypeVertical && m_flags&OBJECT_Flag_PTypeInv) { Pos.top = (Pos.top + (Pos.bottom - Pos.top) * (mul)) - 2; Pos.bottom = Pos.top + 4; Pos.left -= m_Region.left; Pos.right += m_Region.right; } else if(m_flags&OBJECT_Flag_PTypeVertical) { Pos.top = (Pos.top + (Pos.bottom - Pos.top) * (1-mul)) - 2; Pos.bottom = Pos.top + 4; Pos.left -= m_Region.left; Pos.right += m_Region.right; } else { Pos.left = (Pos.left + (Pos.right - Pos.left) * mul) - 2; Pos.right = Pos.left + 4; Pos.top -= m_Region.top; Pos.bottom += m_Region.bottom; } //m_progressback.Draw(&rnd, Pos, m_markercol, m_rotation, GetLayer()); rnd.DrawLine(PointF(Pos.left, Pos.top), PointF(Pos.left, Pos.bottom), m_markercol); } } }
// Gets Absolute Rectangle Rect Widget::GetAbsoluteRect (const Rect &rect) const { return rect + GetAbsolutePos( Pos(0,0) ); }