CStdStringW FacadeDocumentProviderImpl::GetDefaultSaveExtensionFromFormatString(const CStdStringW& sAvailableFormats, long lIndex)
{
	if(sAvailableFormats.IsEmpty())
		return _T("wdf");

	int iStartPos = -1;
	int lSkip = (lIndex-1)*2;
	for (int i=0; i<lSkip; i++)
	{
		iStartPos = sAvailableFormats.Find(_T('|'),iStartPos);
	}

	int iFirstDelimeterPos = sAvailableFormats.Find(_T('|'), iStartPos);
	if (iFirstDelimeterPos == iStartPos+1) // we've hit the "||" at the end ...
		iFirstDelimeterPos = sAvailableFormats.Find(_T('|')); // go back to default
	int iNextDelimeterPos = sAvailableFormats.Find(_T('|'),iFirstDelimeterPos);

	CStdStringW sExt = sAvailableFormats.Mid(iFirstDelimeterPos + 1 ,iNextDelimeterPos - iFirstDelimeterPos - 1  );

	int iPeriodPos = sExt.Find(_T('.'));
	sExt = sExt.Mid(iPeriodPos + 1, sExt.length() - iPeriodPos );

	return sExt;

}
Ejemplo n.º 2
0
// BidiTransform is used to handle RTL text flipping in the string
void CGUITextLayout::BidiTransform(vector<CGUIString> &lines, bool forceLTRReadingOrder)
{
  for (unsigned int i=0; i<lines.size(); i++)
  {
    CGUIString &line = lines[i];

    // reserve enough space in the flipped text
    vecText flippedText;
    flippedText.reserve(line.m_text.size());

    character_t sectionStyle = 0xffff0000; // impossible to achieve
    CStdStringW sectionText;
    for (vecText::iterator it = line.m_text.begin(); it != line.m_text.end(); ++it)
    {
      character_t style = *it & 0xffff0000;
      if (style != sectionStyle)
      {
        if (!sectionText.IsEmpty())
        { // style has changed, bidi flip text
          CStdStringW sectionFlipped = BidiFlip(sectionText, forceLTRReadingOrder);
          for (unsigned int j = 0; j < sectionFlipped.size(); j++)
            flippedText.push_back(sectionStyle | sectionFlipped[j]);
        }
        sectionStyle = style;
        sectionText.clear();
      }
      sectionText.push_back( (wchar_t)(*it & 0xffff) );
    }

    // handle the last section
    if (!sectionText.IsEmpty())
    {
      CStdStringW sectionFlipped = BidiFlip(sectionText, forceLTRReadingOrder);
      for (unsigned int j = 0; j < sectionFlipped.size(); j++)
        flippedText.push_back(sectionStyle | sectionFlipped[j]);
    }

    // replace the original line with the proccessed one
    lines[i] = CGUIString(flippedText.begin(), flippedText.end(), line.m_carriageReturn);
  }
}
Ejemplo n.º 3
0
void CGUIDialogKeyboardGeneric::InputText(const CStdString& aTextString)
{
  CStdStringW newStr;
  g_charsetConverter.utf8ToW(aTextString, newStr);
  if (!newStr.IsEmpty())
  {
    m_strEditing.Empty();
    m_iEditingOffset = 0;
    m_strEdit.Insert(GetCursorPos(), newStr);
    UpdateLabel();
    MoveCursor(newStr.size());
  }
}
Ejemplo n.º 4
0
HRESULT DMSHelper::GetLatestVersion(CStdStringW sDocID, CStdStringW& sLatestVersionID)
{
	LOG_WS_FUNCTION_SCOPE_MSG(sDocID);

	sLatestVersionID = GetVersionListCache()->GetLatestVersion(sDocID);
	if(!sLatestVersionID.IsEmpty())
		return S_OK;

	GetAllVersionsFromDMSAndCache(sDocID);

	sLatestVersionID = GetVersionListCache()->GetLatestVersion(sDocID);

	return S_OK;
}
Ejemplo n.º 5
0
void CGUIEditControl::ProcessText(unsigned int currentTime)
{
  if (m_smsTimer.GetElapsedMilliseconds() > smsDelay)
    UpdateText();

  if (m_bInvalidated)
  {
    m_label.SetMaxRect(m_posX, m_posY, m_width, m_height);
    m_label.SetText(m_info.GetLabel(GetParentID()));
    RecalcLabelPosition();
  }

  bool changed = false;

  m_clipRect.x1 = m_label.GetRenderRect().x1;
  m_clipRect.x2 = m_clipRect.x1 + m_label.GetMaxWidth();
  m_clipRect.y1 = m_posY;
  m_clipRect.y2 = m_posY + m_height;

  // start by rendering the normal text
  float leftTextWidth = m_label.GetRenderRect().Width();
  if (leftTextWidth > 0)
  {
    // render the text on the left
    changed |= m_label.SetColor(GetTextColor());
    changed |= m_label.Process(currentTime);

    m_clipRect.x1 += leftTextWidth + spaceWidth;
  }

  if (g_graphicsContext.SetClipRegion(m_clipRect.x1, m_clipRect.y1, m_clipRect.Width(), m_clipRect.Height()))
  {
    uint32_t align = m_label.GetLabelInfo().align & XBFONT_CENTER_Y; // start aligned left
    if (m_label2.GetTextWidth() < m_clipRect.Width())
    { // align text as our text fits
      if (leftTextWidth > 0)
      { // right align as we have 2 labels
        align |= XBFONT_RIGHT;
      }
      else
      { // align by whatever the skinner requests
        align |= (m_label2.GetLabelInfo().align & 3);
      }
    }
    CStdStringW text = GetDisplayedText();
    // add the cursor if we're focused
    if (HasFocus() && m_inputType != INPUT_TYPE_READONLY)
    {
      CStdStringW col;
      if ((m_focusCounter % 64) > 32)
        col = L"|";
      else
        col = L"[COLOR 00FFFFFF]|[/COLOR]";
      text.Insert(m_cursorPos, col);
    }

    changed |= m_label2.SetMaxRect(m_clipRect.x1 + m_textOffset, m_posY, m_clipRect.Width() - m_textOffset, m_height);
    if (text.IsEmpty())
      changed |= m_label2.SetText(m_hintInfo.GetLabel(GetParentID()));
    else
      changed |= m_label2.SetTextW(text);
    changed |= m_label2.SetAlign(align);
    changed |= m_label2.SetColor(GetTextColor());
    changed |= m_label2.SetOverflow(CGUILabel::OVER_FLOW_CLIP);
    changed |= m_label2.Process(currentTime);
    g_graphicsContext.RestoreClipRegion();
  }
  if (changed)
    MarkDirtyRegion();
}