CSite CSite::operator / (Int scale) const { assert (scale != 0); CoordI xNew = (x > 0) ? (Int) ((Double) (x / scale) + .5) : (Int) ((Double) (x / scale) - .5); CoordI yNew = (y > 0) ? (Int) ((Double) (y / scale) + .5) : (Int) ((Double) (y / scale) - .5); return CSite (xNew, yNew); }
own CVOPIntYUVBA* vopfFitToMulOfMBSize (const CVOPIntYUVBA* pvopf, const CSite* pstLeftTop) { if (!pvopf -> valid ()) return NULL; CVOPIntYUVBA* pvopfRet = new CVOPIntYUVBA (pvopf -> fAUsage ()); UInt iPln; for (iPln = Y_PLANE; iPln <= BUV_PLANE; iPln++) { if (pvopf -> fAUsage () != EIGHT_BIT) { if (iPln == A_PLANE) continue; } UInt size; CSite stOrig; if (iPln == U_PLANE || iPln == V_PLANE || iPln == BUV_PLANE) { size = MB_SIZE >> 1; if (pstLeftTop != NULL) stOrig = *pstLeftTop / 2; else stOrig = CSite (pvopf -> whereUV ().left, pvopf -> whereUV ().top); } else {
Void include (CoordI x, CoordI y) {include (CSite (x, y));}
CSite CSite::operator / (const CSite& st) const { assert (st.x != 0 && st.y != 0); return CSite (x / st.x, y / st.y); }
CSite CSite::operator * (Int scale) const { return CSite (x * scale, y * scale); }
CSite CSite::operator * (const CSite& st) const { return CSite (x * st.x, y * st.y); }
CSite CSite::operator - (const CSite& st) const { return CSite (x - st.x, y - st.y); }
CSite CSite::operator + (const CSite& st) const { return CSite (x + st.x, y + st.y); }
CSite CSite::operator % (const CSite& st) const { return CSite (x % st.x, y % st.y); }
void CAppConfig::LoadFavorites() { FILE* fi = fopen( GetConfigPath("favorites").c_str() ,"r" ); if( fi ) { char line[1024]; CSite* pSite = NULL; // BLOWFISH_CTX* bfc = NULL; while( fgets( line, 1024, fi ) ) { char* pname = strtok( line, "=\r\n" ); if( !pname ) continue; while( ' ' == *pname ) ++pname; if( pname[0]=='[' ) { pname = strtok(pname, "[]"); Favorites.push_back(CSite(pname)); pSite = &Favorites.back(); continue; } char *pval = strtok( NULL, "\r\n" ); if( !pSite || !pval ) continue; if( 0 == strcmp( pname, "URL" ) ) pSite->m_URL = pval; else if( 0 == strcmp( pname, "AutoReconnect" ) ) pSite->m_AutoReconnect = atoi(pval); else if( 0 == strcmp( pname, "AntiIdle" ) ) pSite->m_AntiIdle = atoi(pval); else if( 0 == strcmp( pname, "AntiIdleStr" ) ) pSite->m_AntiIdleStr = pval; else if( 0 == strcmp( pname, "Encoding" ) ) pSite->m_Encoding = pval; else if( 0 == strcmp( pname, "DetectDBChar" ) ) pSite->m_DetectDBChar = atoi(pval); else if( 0 == strcmp( pname, "Rows" ) ) { pSite->m_RowsPerPage = atoi(pval); if( pSite->m_RowsPerPage < 24 ) pSite->m_RowsPerPage = 24; } else if( 0 == strcmp( pname, "Cols" ) ) { pSite->m_ColsPerPage = atoi(pval); if(pSite->m_ColsPerPage < 40) pSite->m_ColsPerPage = 40; } else if( 0 == strcmp( pname, "TermType" ) ) pSite->m_TermType = pval; else if( 0 == strcmp( pname, "ESCConv" ) ) pSite->m_ESCConv = pval; else if( 0 == strcmp( pname, "Startup" ) ) pSite->m_Startup = (bool)atoi(pval); #ifdef USE_EXTERNAL else if( 0 == strcmp( pname, "UseExternalSSH" ) ) pSite->m_UseExternalSSH = (bool)atoi(pval); else if( 0 == strcmp( pname, "UseExternalTelnet" ) ) pSite->m_UseExternalTelnet = (bool)atoi(pval); #endif else if( 0 == strcmp( pname, "HorizontalCenterAlign" ) ) pSite->m_bHorizontalCenterAlign = (bool)atoi(pval); else if( 0 == strcmp( pname, "VerticalCenterAlign" ) ) pSite->m_bVerticalCenterAlign = (bool)atoi(pval); else if( 0 == strcmp( pname, "PreLoginPrompt" ) ) pSite->SetPreLoginPrompt( pval ); else if( 0 == strcmp( pname, "PreLogin" ) ) pSite->SetPreLogin( pval ); else if( 0 == strcmp( pname, "PostLogin" ) ) pSite->SetPostLogin( pval ); else if( 0 == strcmp( pname, "LoginPrompt" ) ) pSite->SetLoginPrompt( pval ); else if( 0 == strcmp( pname, "Login" ) ) pSite->SetLogin( pval ); else if( 0 == strcmp( pname, "PasswdPrompt" ) ) pSite->SetPasswdPrompt( pval ); else if( 0 == strcmp( pname, "Passwd" ) ) { if( !*pval ) continue; pSite->SetPasswd( pval ); /* if( m_IsLoggedIn ) { bfc = GetBlowfish(); char passwd_buf[17]; memset( passwd_buf, 0, sizeof(passwd_buf) ); unsigned long l = 0; unsigned long r = 0; unsigned long l2 = 0; unsigned long r2 = 0; sscanf( pval, "%X,%X,%X,%X", &l, &r, &l2, &r2 ); Blowfish_Decrypt( bfc, &l, &r ); memcpy( passwd_buf, &l, 4 ); memcpy( passwd_buf+4, &r, 4); Blowfish_Decrypt( bfc, &l2, &r2 ); memcpy( passwd_buf+8, &l2, 4 ); memcpy( passwd_buf+12, &r2, 4); pSite->SetPasswd( passwd_buf ); } else pSite->SetPasswd( pval ); */ } #ifdef USE_PROXY else if ( 0 == strcmp( pname, "ProxyType" ) ) pSite->m_ProxyType = atoi(pval); else if ( 0 == strcmp( pname, "ProxyAddr" ) ) pSite->m_ProxyAddr = pval; else if ( 0 == strcmp( pname, "ProxyPort" ) ) pSite->m_ProxyPort = pval; else if ( 0 == strcmp( pname, "ProxyUser" ) ) pSite->m_ProxyUser = pval; else if ( 0 == strcmp( pname, "ProxyPass" ) ) pSite->m_ProxyPass = pval; #endif } // ReleaseBlowfish(); fclose(fi); } }