void
JXFontCharSetMenu::SelectDefaultCharSet()
{
	JString charSet;
	if (!JXGetCharacterSetName(&charSet) ||
		!SetCharSet(charSet))
		{
		SetCharSet("iso8859-1");
		}
}
void
JXFontCharSetMenu::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if ((sender == itsFontNameMenu && message.Is(JXFontNameMenu::kNameChanged)) ||
		(sender == itsFontSizeMenu && message.Is(JXFontSizeMenu::kSizeChanged)))
		{
		itsBroadcastChangeFlag = kJFalse;
		const JString charSet  = GetCharSet();
		const JString fontName = itsFontNameMenu->GetFontName();
		BuildMenu(fontName, itsFontSizeMenu->GetFontSize());
		SetCharSet(charSet);
		itsBroadcastChangeFlag = kJTrue;
		}

	else if (sender == this && message.Is(JXMenu::kNeedsUpdate))
		{
		itsBroadcastChangeFlag = kJFalse;
		Broadcast(CharSetNeedsUpdate());
		CheckItem(itsCurrIndex);
		itsBroadcastChangeFlag = kJTrue;
		}
	else if (sender == this && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast(const JXMenu::ItemSelected*, &message);
		assert( selection != NULL );
		ChooseCharSet(selection->GetIndex());
		}

	else
		{
Esempio n. 3
0
void CPWL_Edit::OnKillFocus() {
  ShowVScrollBar(false);
  m_pEdit->SelectNone();
  SetCaret(false, CFX_PointF(), CFX_PointF());
  SetCharSet(FXFONT_ANSI_CHARSET);
  m_bFocus = false;
}
Esempio n. 4
0
void CIniFile::SetValue(const DESC_KEY key, const CString& value, const bool isQuot)
{
	CString v;
	if(isQuot)	v = Util::Text::UnQuot(value);
	else		v = value;
	switch(key){
		case DESC_KEY_SHIOLINK2_CHARSET:			SetCharSet(v); return;
		case DESC_KEY_SHIOLINK2_LINK_TYPE:			SetLinkType(v); return;
		case DESC_KEY_SHIOLINK2_ACTIVE_CODE_GUID:	SetActiveCodeGUID(v); return;
	}
}
Esempio n. 5
0
void CNumberEdit::Prepare()
{
	if( m_nType == ntDouble )
	{
		struct lconv	*pConv = localeconv();
		CString				charSet( _T("1234567890") );

		if( m_dMin < 0.0 || m_dMax < 0.0 )
			charSet+= _T('-');

		SetCharSet( charSet + pConv->decimal_point );
	}
	else
	{
		CString	charSet( _T("1234567890") );
		if( m_lMin < 0 || m_lMax < 0 )
			charSet+= _T('-');

		SetCharSet( charSet );
	}
}
Esempio n. 6
0
bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) {
  if (m_bMouseDown)
    return true;

  bool bRC = true;
  bool bExit = false;

  if (!IsCTRLpressed(nFlag)) {
    if (m_pFillerNotify) {
      CFX_WideString swChange;

      int nSelStart = 0;
      int nSelEnd = 0;
      GetSel(nSelStart, nSelEnd);

      switch (nChar) {
        case FWL_VKEY_Back:
          if (nSelStart == nSelEnd)
            nSelStart = nSelEnd - 1;
          break;
        case FWL_VKEY_Return:
          break;
        default:
          swChange += nChar;
          break;
      }

      CFX_WideString strChangeEx;
      m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange,
                                         strChangeEx, nSelStart, nSelEnd, true,
                                         bRC, bExit, nFlag);
    }
  }

  if (!bRC)
    return true;
  if (bExit)
    return false;

  if (IPVT_FontMap* pFontMap = GetFontMap()) {
    int32_t nOldCharSet = GetCharSet();
    int32_t nNewCharSet =
        pFontMap->CharSetFromUnicode(nChar, FXFONT_DEFAULT_CHARSET);
    if (nOldCharSet != nNewCharSet) {
      SetCharSet(nNewCharSet);
    }
  }

  return CPWL_EditCtrl::OnChar(nChar, nFlag);
}
Esempio n. 7
0
FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) {
  if (m_bMouseDown)
    return TRUE;

  FX_BOOL bRC = TRUE;
  FX_BOOL bExit = FALSE;

  if (!IsCTRLpressed(nFlag)) {
    if (m_pFillerNotify) {
      CFX_WideString swChange;

      int nSelStart = 0;
      int nSelEnd = 0;
      GetSel(nSelStart, nSelEnd);

      switch (nChar) {
        case FWL_VKEY_Back:
          if (nSelStart == nSelEnd)
            nSelStart = nSelEnd - 1;
          break;
        case FWL_VKEY_Return:
          break;
        default:
          swChange += nChar;
          break;
      }

      CFX_WideString strChangeEx;
      m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange,
                                         strChangeEx, nSelStart, nSelEnd, TRUE,
                                         bRC, bExit, nFlag);
    }
  }

  if (!bRC)
    return TRUE;
  if (bExit)
    return FALSE;

  if (IFX_Edit_FontMap* pFontMap = GetFontMap()) {
    int32_t nOldCharSet = GetCharSet();
    int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET);
    if (nOldCharSet != nNewCharSet) {
      SetCharSet(nNewCharSet);
    }
  }

  return CPWL_EditCtrl::OnChar(nChar, nFlag);
}
Esempio n. 8
0
void CPWL_Edit::OnKillFocus() {
  ShowVScrollBar(FALSE);

  m_pEdit->SelectNone();
  SetCaret(FALSE, CPDF_Point(0.0f, 0.0f), CPDF_Point(0.0f, 0.0f));

  SetCharSet(0);

  if (!IsReadOnly()) {
    if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler())
      pFocusHandler->OnKillFocus(this);
  }

  m_bFocus = FALSE;
}
void
JXFontCharSetMenu::SetFont
	(
	const JCharacter*	name,
	const JSize			size
	)
{
	JString fontName, charSet;
	JFontManager::ExtractCharacterSet(name, &fontName, &charSet);
	if (charSet.IsEmpty())
		{
		charSet = GetCharSet();
		}
	BuildMenu(name, size);
	SetCharSet(charSet);
}
Esempio n. 10
0
void
JXFontCharSetMenu::BuildMenu
	(
	const JCharacter*	fontName,
	const JSize			fontSize
	)
{
	RemoveAllItems();

	JPtrArray<JString> charSetList(JPtrArrayT::kDeleteAll);
	if (!(GetFontManager())->GetFontCharSets(fontName, fontSize, &charSetList))
		{
		itsCurrIndex = 0;
		itsCharSet.Clear();
		StopListening(this);
		return;
		}

	const JSize count = charSetList.GetElementCount();
	JString id;
	for (JIndex i=1; i<=count; i++)
		{
		const JString* charSet = charSetList.NthElement(i);
		id                     = *charSet + "::JX";
		AppendItem(*charSet, kJTrue, kJTrue, NULL, NULL, id);
		}

	SetUpdateAction(kDisableNone);

	itsCurrIndex = 1;
	itsCharSet   = *(charSetList.FirstElement());

	StopListening(this);
	JString name, charSet;
	if (JFontManager::ExtractCharacterSet(fontName, &name, &charSet))
		{
		SetCharSet(charSet);
		}
	else
		{
		SelectDefaultCharSet();
		}
	ListenTo(this);
}
Esempio n. 11
0
EXC_TYPE CAttachInfo::SetInfo (LPCTSTR					lpszName,
										 const UINT32			ulSize,	// may be zero
										 LPCTSTR					lpszPath, // may be NULL/empty
										 LPCTSTR					lpszType,
										 LPCTSTR					lpszSubType,
										 LPCTSTR					lpszCharSet,	// may be NULL/empty
										 const RFC822ENCCASE	attEnc,
										 LPCTSTR					lpszDesc,
										 LPCTSTR					lpszID)
{
	Cleanup();

	EXC_TYPE	exc=EOK;
	if (EOK == exc)
		exc = SetName(lpszName, FALSE);

	if (EOK == exc)
		exc = SetPath(lpszPath);

	if (EOK == exc)
		exc = SetContentType(lpszType, lpszSubType);

	if (EOK == exc)
		exc = SetCharSet(lpszCharSet);

	if (EOK == exc)
		exc = SetEncoding(attEnc);

	if (EOK == exc)
		exc = SetDescription(lpszDesc);

	if (EOK == exc)
		exc = SetID(lpszID);

	if (exc != EOK)
		Cleanup();
	else
		m_ulSize = ulSize;

	return exc;
}
Esempio n. 12
0
CFormatEdit::CFormatEdit( LPCTSTR lpszCharSet /*= NULL*/ )
: CEdit()
{
	SetCharSet( lpszCharSet );
}