// Get a specific aspect of the file version resource (see above) CString CFileVersionInfo::GetVersionInfo(int nIndex) const { // First check if object data and index range are valid // **************************************************** if ((nIndex < SFI_FIRST) || (nIndex > SFI_LAST) || (!m_pVersionInfo) ) return CString(_T("")); CString strRes, strFmt; LPVOID lpInfo; UINT nLen; // Create a search string for the VerQueryValue function // (See SDK documentation for details) // ***************************************************** strFmt.Format(m_lpszFmtStringFileInfo, GetLanguageId(), GetCharSet(), m_lpszStringFileInfos[nIndex] ); // Get the requested version information string // ******************************************** if (::VerQueryValue(m_pVersionInfo, strFmt.GetBuffer(_MAX_PATH), &lpInfo, &nLen) ) strRes = (const TCHAR*) lpInfo; return strRes; } // GetVersionInfo
// Determine, if a specific aspect of the file version info is present BOOL CFileVersionInfo::IsVersionInfoAvailable(int nIndex) const { // First check if object data and index range are valid // **************************************************** if ((nIndex < SFI_FIRST) || (nIndex > SFI_LAST) || (!m_pVersionInfo) ) return FALSE; CString strRes, strFmt; LPVOID lpInfo; UINT nLen; // Create a search string for the VerQueryValue function // (See SDK documentation for details) // ***************************************************** strFmt.Format(m_lpszFmtStringFileInfo, GetLanguageId(), GetCharSet(), m_lpszStringFileInfos[nIndex] ); // See if requested version information string can be found // ******************************************************** return ::VerQueryValue(m_pVersionInfo, strFmt.GetBuffer(_MAX_PATH), &lpInfo, &nLen ); } // IsVersionInfoAvailable
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 {
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); }
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); }
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); }
// Note: pointers stop being valid if object destroyed EXC_TYPE CAttachInfo::GetInfo (RFC822ATTACHINFO& ai) const { memset(&ai, 0, (sizeof ai)); ai.m_lpszName = GetName(); ai.m_fIsVirtualName = m_fIsVirtualName; ai.m_attEnc = m_attEnc; ai.m_lpszCharSet = GetCharSet(); ai.m_lpszDesc = m_lpszDesc; ai.m_lpszID = m_lpszID; ai.m_lpszSubType = m_lpszSubType; ai.m_lpszType = m_lpszType; ai.m_ulDuration = m_ulDuration; ai.m_ulSize = m_ulSize; ai.m_pDispProps = &m_CDispProps; ai.m_pCTypeProps = &m_CTypeProps; return EOK; }
// get name of charset of version info block (98/NT5 or higher) CString CFileVersionInfo::GetCharSetName() const { // CPINFOEX struct and ::GetCPInfoEx API not available in older // versions of Windows ... // ************************************************************ #ifdef _WIN98_OR_WIN2K_ // Check Win version (must be at least 98/NT5) // The GetCPInfoEx API is not supported in versions before these. // ************************************************************** OSVERSIONINFO osvi; BOOL bWinVerOK; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx (&osvi); bWinVerOK = (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && ((osvi.dwMajorVersion > 4) || ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0)) ); if (!bWinVerOK) bWinVerOK = ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5)); if (!bWinVerOK) return CString(_T("")); // get information about code page // ******************************* CPINFOEX info; if (::GetCPInfoEx(GetCharSet(), 0, &info)) return CString(info.CodePageName); #endif // _WIN98_OR_WIN2K_ return CString(_T("")); } // GetCharSetName
FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) return TRUE; CPWL_Wnd::OnChar(nChar, nFlag); // FILTER switch (nChar) { case 0x0A: case 0x1B: return FALSE; default: break; } FX_BOOL bCtrl = IsCTRLpressed(nFlag); FX_BOOL bAlt = IsALTpressed(nFlag); FX_BOOL bShift = IsSHIFTpressed(nFlag); uint16_t word = nChar; if (bCtrl && !bAlt) { switch (nChar) { case 'C' - 'A' + 1: CopyText(); return TRUE; case 'V' - 'A' + 1: PasteText(); return TRUE; case 'X' - 'A' + 1: CutText(); return TRUE; case 'A' - 'A' + 1: SelectAll(); return TRUE; case 'Z' - 'A' + 1: if (bShift) Redo(); else Undo(); return TRUE; default: if (nChar < 32) return FALSE; } } if (IsReadOnly()) return TRUE; if (m_pEdit->IsSelected() && word == FWL_VKEY_Back) word = FWL_VKEY_Unknown; Clear(); switch (word) { case FWL_VKEY_Back: Backspace(); break; case FWL_VKEY_Return: InsertReturn(); break; case FWL_VKEY_Unknown: break; default: InsertWord(word, GetCharSet()); break; } return TRUE; }