freettcn::CType::CValue::CValue(const std::shared_ptr<const TciType> &type, const Tstring &encoding, const Tstring &encodingVariant): _type(type) { if(encoding.empty() || encoding == type->getTypeEncoding()) _encoding.reset(new Tstring(encoding)); if(encodingVariant.empty() || encodingVariant == type->getTypeEncodingVariant()) _encoding.reset(new Tstring(encodingVariant)); }
void CAdvancedPage::PopulateList() { // Populate the controls in the dialogue box based on the relevent parameters for(int ii = 0; ii<sizeof(menutable)/sizeof(menuentry); ii++) { if(m_pAppSettings->GetBoolParameter(menutable[ii].paramNum)) { SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_SETCHECK, BST_CHECKED, 0); } else { SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_SETCHECK, BST_UNCHECKED, 0); } } switch(m_pAppSettings->GetLongParameter(APP_LP_STYLE)) { case APP_STYLE_TRAD: SendMessage(GetDlgItem(m_hwnd, IDC_STYLE_STANDALONE), BM_SETCHECK, BST_CHECKED, 0); break; case APP_STYLE_COMPOSE: SendMessage(GetDlgItem(m_hwnd, IDC_STYLE_COMPOSITION), BM_SETCHECK, BST_CHECKED, 0); break; case APP_STYLE_DIRECT: SendMessage(GetDlgItem(m_hwnd, IDC_STYLE_DIRECT), BM_SETCHECK, BST_CHECKED, 0); break; case APP_STYLE_FULLSCREEN: SendMessage(GetDlgItem(m_hwnd, IDC_STYLE_FULL), BM_SETCHECK, BST_CHECKED, 0); break; } HWND ListBox = GetDlgItem(m_hwnd, IDC_CONTROLBOXES); auto CurrentControlBox = m_pAppSettings->GetStringParameter(SP_CONTROL_BOX_ID); // Add each string to list box and index each one bool SelectionSet = false; for (auto i = 0; i < m_ControlBoxItems.size(); i++) { Tstring Item; WinUTF8::UTF8string_to_wstring(m_ControlBoxItems[i], Item); if (Item.empty()) Item = L"<default>"; LRESULT Index = SendMessage(ListBox, LB_ADDSTRING, 0, (LPARAM)Item.c_str()); SendMessage(ListBox, LB_SETITEMDATA, Index, (LPARAM)i); if (m_ControlBoxItems[i] == CurrentControlBox) { SendMessage(ListBox, LB_SETCURSEL, Index, 0); SelectionSet = true; } } if (SelectionSet == false) { SendMessage(ListBox, LB_SETCURSEL, 0, 0); LRESULT CurrentIndex = SendMessage(ListBox, LB_GETITEMDATA, 0, 0); } CWindow fileEncodingCb = GetDlgItem(m_hwnd, IDC_FILE_ENCODING); fileEncodingCb.SendMessage(CB_ADDSTRING, 0, (LPARAM)L"Windows Locale Encoding"); fileEncodingCb.SendMessage(CB_ADDSTRING, 0, (LPARAM)L"UTF-8"); fileEncodingCb.SendMessage(CB_ADDSTRING, 0, (LPARAM)L"Unicode little endian / UTF-16 LE"); fileEncodingCb.SendMessage(CB_ADDSTRING, 0, (LPARAM)L"Unicode big endian / UTF-16 BE"); switch (m_pAppSettings->GetLongParameter(APP_LP_FILE_ENCODING)) { case Opts::UTF8: fileEncodingCb.SendMessage(CB_SETCURSEL, 1, 0); break; case Opts::UTF16LE: fileEncodingCb.SendMessage(CB_SETCURSEL, 2, 0); break; case Opts::UTF16BE: fileEncodingCb.SendMessage(CB_SETCURSEL, 3, 0); break; default: fileEncodingCb.SendMessage(CB_SETCURSEL, 0, 0); break; } }