nsresult
nsSVGLength2::SetBaseValueString(const nsAString &aValueAsString,
                                 nsSVGElement *aSVGElement,
                                 PRBool aDoSetAttr)
{
  float value;
  PRUint16 unitType;
  
  nsresult rv = GetValueFromString(aValueAsString, &value, &unitType);
  if (NS_FAILED(rv)) {
    return rv;
  }
  
  mBaseVal = value;
  mIsBaseSet = PR_TRUE;
  mSpecifiedUnitType = PRUint8(unitType);
  if (!mIsAnimated) {
    mAnimVal = mBaseVal;
  }
#ifdef MOZ_SMIL
  else {
    aSVGElement->AnimationNeedsResample();
  }
#endif

  aSVGElement->DidChangeLength(mAttrEnum, aDoSetAttr);
  return NS_OK;
}
Beispiel #2
0
nsresult
nsSVGNumber2::SetBaseValueString(const nsAString &aValueAsString,
                                 nsSVGElement *aSVGElement,
                                 bool aDoSetAttr)
{
  float val;

  nsresult rv = GetValueFromString(
    aValueAsString, aSVGElement->NumberAttrAllowsPercentage(mAttrEnum), &val);

  if (NS_FAILED(rv)) {
    return rv;
  }

  mBaseVal = val;
  mIsBaseSet = PR_TRUE;
  if (!mIsAnimated) {
    mAnimVal = mBaseVal;
  }
#ifdef MOZ_SMIL
  else {
    aSVGElement->AnimationNeedsResample();
  }
#endif

  // We don't need to call DidChange* here - we're only called by
  // nsSVGElement::ParseAttribute under nsGenericElement::SetAttr,
  // which takes care of notifying.
  return NS_OK;
}
nsresult
nsSVGLength2::SetBaseValueString(const nsAString &aValueAsString,
                                 nsSVGElement *aSVGElement,
                                 PRBool aDoSetAttr)
{
  float value;
  PRUint16 unitType;
  
  nsresult rv = GetValueFromString(aValueAsString, &value, &unitType);
  if (NS_FAILED(rv)) {
    return rv;
  }
  
  mBaseVal = mAnimVal = value;
  mSpecifiedUnitType = PRUint8(unitType);
  aSVGElement->DidChangeLength(mAttrEnum, aDoSetAttr);

  return NS_OK;
}
Beispiel #4
0
nsresult
nsSVGLength2::SMILLength::ValueFromString(const nsAString& aStr,
                                 const nsISMILAnimationElement* /*aSrcElement*/,
                                 nsSMILValue& aValue) const
{
  float value;
  PRUint16 unitType;
  
  nsresult rv = GetValueFromString(aStr, &value, &unitType);
  if (NS_FAILED(rv)) {
    return rv;
  }

  nsSMILValue val(&nsSMILFloatType::sSingleton);
  val.mU.mDouble = value / mVal->GetUnitScaleFactor(mSVGElement, unitType);
  aValue = val;
  
  return NS_OK;
}
Beispiel #5
0
nsresult
nsSVGNumber2::SMILNumber::ValueFromString(const nsAString& aStr,
                                          const nsISMILAnimationElement* /*aSrcElement*/,
                                          nsSMILValue& aValue,
                                          bool& aPreventCachingOfSandwich) const
{
  float value;

  nsresult rv = GetValueFromString(
    aStr, mSVGElement->NumberAttrAllowsPercentage(mVal->mAttrEnum), &value);

  if (NS_FAILED(rv)) {
    return rv;
  }

  nsSMILValue val(&nsSMILFloatType::sSingleton);
  val.mU.mDouble = value;
  aValue = val;
  aPreventCachingOfSandwich = PR_FALSE;

  return NS_OK;
}
nsresult
nsSVGLength2::SMILLength::ValueFromString(const nsAString& aStr,
                                 const nsISMILAnimationElement* /*aSrcElement*/,
                                 nsSMILValue& aValue,
                                 PRBool& aPreventCachingOfSandwich) const
{
  float value;
  PRUint16 unitType;
  
  nsresult rv = GetValueFromString(aStr, &value, &unitType);
  if (NS_FAILED(rv)) {
    return rv;
  }

  nsSMILValue val(&nsSMILFloatType::sSingleton);
  val.mU.mDouble = value / mVal->GetUnitScaleFactor(mSVGElement, unitType);
  aValue = val;
  aPreventCachingOfSandwich =
              (unitType == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE ||
               unitType == nsIDOMSVGLength::SVG_LENGTHTYPE_EMS ||
               unitType == nsIDOMSVGLength::SVG_LENGTHTYPE_EXS);

  return NS_OK;
}
CZProfilePageDialog::CZProfilePageDialog()
    : CCard1Dialog(0x0030, "IDD_DIALOG_PROFILEPAGE")
{
    ZeroMemory(m_pAxesBuff, sizeof(m_pAxesBuff));
    ZeroMemory(m_pPaperSize, sizeof(m_pPaperSize));
    ZeroMemory(m_pColumn, sizeof(m_pColumn));
    InitConfig();
    char szTempFile[MAX_PATH];
    sprintf(szTempFile, "%s\\profilepageconfig.tmp", g_strCurrentWorkPath);
    ifstream in;
    in.open(szTempFile);
    if(in.is_open())
    {
        char szText[1024], szName[MAX_PATH], szValue[1024];
        while(1)
        {
            in.getline(szText, _countof(szText));
            if(in.fail()) break;
            if(GetValueFromString(szText, szName, szValue))
            {
                if(StrCmp(szName, "nAxesNo") == 0)
                    m_oDraw.nAxesNo = atoi(szValue);
                else if(StrCmp(szName, "fStartStat") == 0)
                    m_oDraw.fStartStat = atof(szValue);
                else if(StrCmp(szName, "fEndStat") == 0)
                    m_oDraw.fEndStat = atof(szValue);
                else if(StrCmp(szName, "bDiscLabel") == 0)
                    m_oDraw.bDiscLabel = atoi(szValue);
                else if(StrCmp(szName, "bMultiAxes") == 0)
                    m_oDraw.bMultiAxes = atoi(szValue);
                else if(StrCmp(szName, "bAuxlineDim") == 0)
                    m_oDraw.bAuxlineDim = atoi(szValue);
                else if(StrCmp(szName, "strStatPrefix") == 0)
                    StrCpyN(m_oDraw.strStatPrefix, szValue, min(_countof(m_oDraw.strStatPrefix), strlen(szValue) + 1));
                else if(StrCmp(szName, "bGrid") == 0)
                    m_oDraw.bGrid = atoi(szValue);
                else if(StrCmp(szName, "nGridWidth") == 0)
                    m_oDraw.nGridWidth = atoi(szValue);
                else if(StrCmp(szName, "nGridHeight") == 0)
                    m_oDraw.nGridHeight = atoi(szValue);
                else if(StrCmp(szName, "fXDimOffset") == 0)
                    m_oDraw.fXDimOffset = atof(szValue);
                else if(StrCmp(szName, "fYDimOffset") == 0)
                    m_oDraw.fYDimOffset = atof(szValue);
                else if(StrCmp(szName, "nMinSpan") == 0)
                    m_oDraw.nMinSpan = atoi(szValue);
                else if(StrCmp(szName, "nMianQueDim") == 0)
                    m_oDraw.nMianQueDim = atoi(szValue);
                else if(StrCmp(szName, "bPage") == 0)
                    m_oDraw.bPage = atoi(szValue);
                else if(StrCmp(szName, "nStartPageNo") == 0)
                    m_oDraw.nStartPageNo = atoi(szValue);
                else if(StrCmp(szName, "nPages") == 0)
                    m_oDraw.nPages = atoi(szValue);
                else if(StrCmp(szName, "pFrameName") == 0)
                    StrCpyN(m_oDraw.pFrameName, szValue, min(_countof(m_oDraw.pFrameName), strlen(szValue) + 1));
                else if(StrCmp(szName, "pPaperSize") == 0)
                    StrCpyN(m_oDraw.pPaperSize, szValue, min(_countof(m_oDraw.pPaperSize), strlen(szValue) + 1));
                else if(StrCmp(szName, "nRatio") == 0)
                    m_oDraw.nRatio = atoi(szValue);
                else if(StrCmp(szName, "nColumn") == 0)
                    m_oDraw.nColumn = atoi(szValue);
                else if(StrCmp(szName, "bGroundLine") == 0)
                    m_oDraw.advance.bGroundLine = atoi(szValue);
                else if(StrCmp(szName, "pGroundLinePen") == 0)
                    StrCpyN(m_oDraw.advance.pGroundLinePen, szValue, min(_countof(m_oDraw.advance.pGroundLinePen), strlen(szValue) + 1));
                else if(StrCmp(szName, "bDimGroundHeight") == 0)
                    m_oDraw.advance.bDimGroundHeight = atoi(szValue);
                else if(StrCmp(szName, "bDesignLine") == 0)
                    m_oDraw.advance.bDesignLine = atoi(szValue);
                else if(StrCmp(szName, "pDesignLinePen") == 0)
                    StrCpyN(m_oDraw.advance.pDesignLinePen, szValue, min(_countof(m_oDraw.advance.pDesignLinePen), strlen(szValue) + 1));
                else if(StrCmp(szName, "bDimDesignHeight") == 0)
                    m_oDraw.advance.bDimDesignHeight = atoi(szValue);
                else if(StrCmp(szName, "bBridge") == 0)
                    m_oDraw.advance.bBridge = atoi(szValue);
                else if(StrCmp(szName, "bTunnel") == 0)
                    m_oDraw.advance.bTunnel = atoi(szValue);
                else if(StrCmp(szName, "bQue") == 0)
                    m_oDraw.advance.bQue = atoi(szValue);
                else if(StrCmp(szName, "bGroove") == 0)
                    m_oDraw.advance.bGroove = atoi(szValue);
                else if(StrCmp(szName, "bSideDitch") == 0)
                    m_oDraw.advance.bSideDitch = atoi(szValue);
                else if(StrCmp(szName, "bRoad") == 0)
                    m_oDraw.advance.bRoad = atoi(szValue);
                else if(StrCmp(szName, "pRoadPen") == 0)
                    StrCpyN(m_oDraw.advance.pRoadPen, szValue, min(_countof(m_oDraw.advance.pRoadPen), strlen(szValue) + 1));
                else if(StrCmp(szName, "bLand") == 0)
                    m_oDraw.advance.bLand = atoi(szValue);
                else if(StrCmp(szName, "pLandPen") == 0)
                    StrCpyN(m_oDraw.advance.pLandPen, szValue, min(_countof(m_oDraw.advance.pLandPen), strlen(szValue) + 1));
                else if(StrCmp(szName, "fSteleHeight") == 0)
                    m_oDraw.advance.fSteleHeight = atof(szValue);
                else if(StrCmp(szName, "bData") == 0)
                    m_oDraw.advance.bData = atoi(szValue);
                else if(StrCmp(szName, "pDataPen") == 0)
                    StrCpyN(m_oDraw.advance.pDataPen, szValue, min(_countof(m_oDraw.advance.pDataPen), strlen(szValue) + 1));
                else if(StrCmp(szName, "nDataDimStyle") == 0)
                    m_oDraw.advance.nDataDimStyle = atoi(szValue);
                else if(StrCmp(szName, "bClearLine") == 0)
                    m_oDraw.advance.bClearLine = atoi(szValue);
                else if(StrCmp(szName, "bCutStepLine") == 0)
                    m_oDraw.advance.bCutStepLine = atoi(szValue);
                else if(StrCmp(szName, "bCrownDitch") == 0)
                    m_oDraw.advance.bCrownDitch = atoi(szValue);
                else if(StrCmp(szName, "pOutFile") == 0)
                    StrCpyN(m_pOutFile, szValue, min(_countof(m_pOutFile), strlen(szValue) + 1));
                else if(StrCmp(szName, "bDefaultOpen") == 0)
                    m_bDefaultOpen = (bool)atoi(szValue);
                }
        }
        in.close();
    }
//     HANDLE hFile = CreateFile(szTempFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
//     if(hFile != NULL)
//     {
//         unsigned long dwLength = sizeof(m_oDraw);
//         char* p = new char[dwLength];
//         ReadFile(hFile, p, dwLength, &dwLength, NULL);
//         if(dwLength == sizeof(m_oDraw))
//             memcpy(&m_oDraw, p, dwLength);
//         delete [] p;
//         CloseHandle(hFile);
//     }
}