wxString wxPdfFontDataTrueTypeUnicode::ConvertGlyph(wxUint32 glyph, const wxPdfEncoding* encoding, wxPdfSortedArrayInt* usedGlyphs, wxPdfChar2GlyphMap* subsetGlyphs) const { wxUnusedVar(encoding); wxUnusedVar(subsetGlyphs); wxString t = wxEmptyString; if (m_gw != NULL && glyph < m_gw->size()) { bool doSubsetting = usedGlyphs != NULL; if (doSubsetting) { if (usedGlyphs->Index(glyph) == wxNOT_FOUND) { usedGlyphs->Add(glyph); } } #if wxCHECK_VERSION(2,9,0) t.Append(wxUniChar(glyph)); #else t.Append(wxChar(glyph)); #endif } else { #if wxCHECK_VERSION(2,9,0) t.Append(wxUniChar(0)); #else t.Append(wxChar(0)); #endif } return t; }
void MakeLowerAscii(wxString& str) { for (size_t i = 0; i < str.Len(); i++) { wxChar c = str.GetChar(i); if (c >= 'A' && c <= 'Z') { c += 32; str.SetChar(i, wxUniChar(c)); } else if (c == 0x130 || c == 0x131) { c = 'i'; str.SetChar(i, wxUniChar(c)); } } }
static void DrawButton(const std::vector<unsigned int>& bitmasks, unsigned int buttons, unsigned int n, wxGraphicsContext* gc, ControlGroupBox* g, unsigned int row, const wxGraphicsMatrix& null_matrix) { if (buttons & bitmasks[(row * 8) + n]) { gc->SetBrush(*wxRED_BRUSH); } else { unsigned char amt = 255 - g->control_group->controls[(row * 8) + n]->control_ref->State() * 128; gc->SetBrush(wxBrush(wxColour(amt, amt, amt))); } gc->DrawRectangle(n * 12, (row == 0) ? 0 : (row * 11), 14, 12); // text const std::string name = g->control_group->controls[(row * 8) + n]->name; // Matrix transformation needs to be disabled so we don't draw scaled/zoomed text. wxGraphicsMatrix old_matrix = gc->GetTransform(); gc->SetTransform(null_matrix); // bit of hax so ZL, ZR show up as L, R gc->DrawText(wxUniChar((name[1] && name[1] < 'a') ? name[1] : name[0]), (n * 12 + 2) * g->m_scale, (1 + (row == 0 ? 0 : row * 11)) * g->m_scale); gc->SetTransform(old_matrix); }
wxString wxPdfFontDataTrueTypeUnicode::ConvertCID2GID(const wxString& s, const wxPdfEncoding* encoding, wxPdfSortedArrayInt* usedGlyphs, wxPdfChar2GlyphMap* subsetGlyphs) const { wxUnusedVar(encoding); wxUnusedVar(subsetGlyphs); bool doSubsetting = usedGlyphs != NULL; wxString t; wxPdfChar2GlyphMap::const_iterator charIter; wxUint32 glyph; wxString::const_iterator ch; for (ch = s.begin(); ch != s.end(); ++ch) { charIter = m_gn->find(*ch); if (charIter != m_gn->end()) { glyph = charIter->second; if (doSubsetting) { if (usedGlyphs->Index(glyph) == wxNOT_FOUND) { usedGlyphs->Add(glyph); } } #if wxCHECK_VERSION(2,9,0) t.Append(wxUniChar(glyph)); #else t.Append(wxChar(glyph)); #endif } else { #if wxCHECK_VERSION(2,9,0) t.Append(wxUniChar(0)); #else t.Append(wxChar(0)); #endif } } return t; }
// // Test both 'creation' methods wxAnyTestCase::wxAnyTestCase() : m_anySignedChar1((signed char)15), m_anySignedShort1((signed short)15), m_anySignedInt1((signed int)15), m_anySignedLong1((signed long)15), #ifdef wxLongLong_t m_anySignedLongLong1((wxLongLong_t)15), #endif m_anyUnsignedChar1((unsigned char)15), m_anyUnsignedShort1((unsigned short)15), m_anyUnsignedInt1((unsigned int)15), m_anyUnsignedLong1((unsigned long)15), #ifdef wxLongLong_t m_anyUnsignedLongLong1((wxULongLong_t)15), #endif m_anyStringString1(wxString("abc")), m_anyCharString1("abc"), m_anyWcharString1(L"abc"), m_anyBool1(true), m_anyFloatDouble1(TEST_FLOAT_CONST), m_anyDoubleDouble1(TEST_DOUBLE_CONST), m_anyWxObjectPtr1(dummyWxObjectPointer), m_anyVoidPtr1(dummyVoidPointer), m_anyDateTime1(wxDateTime::Now()) { m_testDateTime = wxDateTime::Now(); m_anySignedChar2 = (signed char)15; m_anySignedShort2 = (signed short)15; m_anySignedInt2 = (signed int)15; m_anySignedLong2 = (signed long)15; #ifdef wxLongLong_t m_anySignedLongLong2 = (wxLongLong_t)15; #endif m_anyUnsignedChar2 = (unsigned char)15; m_anyUnsignedShort2 = (unsigned short)15; m_anyUnsignedInt2 = (unsigned int)15; m_anyUnsignedLong2 = (unsigned long)15; #ifdef wxLongLong_t m_anyUnsignedLongLong2 = (wxULongLong_t)15; #endif m_anyStringString2 = wxString("abc"); m_anyCharString2 = "abc"; m_anyWcharString2 = L"abc"; m_anyBool2 = true; m_anyFloatDouble2 = TEST_FLOAT_CONST; m_anyDoubleDouble2 = TEST_DOUBLE_CONST; m_anyDateTime2 = m_testDateTime; m_anyUniChar1 = wxUniChar('A'); m_anyWxObjectPtr2 = dummyWxObjectPointer; m_anyVoidPtr2 = dummyVoidPointer; }
void CEditLanguageDialog::OnEnumTextUpdate( wxCommandEvent& /*event*/ ) { wxString tmpNowStr; tmpNowStr = m_pTextEnum->GetValue(); size_t uStrLen = _tcslen(_T("eL_")); if (tmpNowStr.Left(uStrLen) != wxT("eL_")) { wxString tmpStr = _T("eL_"); if (tmpNowStr.size() < uStrLen) { m_pTextEnum->SetValue(tmpStr); } else if (tmpNowStr.AfterFirst(wxUniChar('_')) != wxT("")) { m_pTextEnum->SetValue(tmpStr + tmpNowStr.AfterFirst(wxUniChar('_'))); } else { m_pTextEnum->SetValue(m_tmpBeforeStr); } m_pTextEnum->SetInsertionPointEnd(); } m_tmpBeforeStr = m_pTextEnum->GetValue(); }
bool ExportCommand::Apply(CommandExecutionContext context) { wxString mode = GetString(wxT("Mode")); wxString filename = GetString(wxT("Filename")); long numChannels = GetLong(wxT("Channels")); bool selection = mode.IsSameAs(wxT("Selection")); double t0, t1; if (selection) { t0 = context.GetProject()->mViewInfo.selectedRegion.t0(); t1 = context.GetProject()->mViewInfo.selectedRegion.t1(); } else { t0 = 0.0; t1 = context.GetProject()->GetTracks()->GetEndTime(); } // Find the extension and check it's valid int splitAt = filename.Find(wxUniChar('.'), true); if (splitAt < 0) { Error(wxT("Export filename must have an extension!")); return false; } wxString extension = filename.Mid(splitAt+1).MakeUpper(); Exporter exporter; bool exportSuccess = exporter.Process(context.GetProject(), std::max(0L, numChannels), extension, filename, selection, t0, t1); if (exportSuccess) { Status(wxString::Format(wxT("Exported to %s format: %s"), extension, filename)); return true; } Error(wxString::Format(wxT("Could not export to %s format!"), extension)); return false; }
wxString wxPdfFontDetails::CreateSubsetPrefix() const { wxString prefix = wxT("WXP"); int k; int code = m_index; for (k = 0; k < 3; k++) { #if wxCHECK_VERSION(2,9,0) prefix += wxUniChar(wxT('A' + (code % 26))); #else prefix += wxChar(wxT('A' + (code % 26))); #endif code /= 26; } prefix += wxT("+"); return prefix; }
wxString wxPdfFontDataCore::ConvertCID2GID(const wxString& s, const wxPdfEncoding* encoding, wxPdfSortedArrayInt* usedGlyphs, wxPdfChar2GlyphMap* subsetGlyphs) const { // No conversion from cid to gid wxUnusedVar(usedGlyphs); wxUnusedVar(subsetGlyphs); #if wxUSE_UNICODE const wxPdfChar2GlyphMap* convMap = FindEncodingMap(encoding); wxString t; if (convMap != NULL) { wxPdfChar2GlyphMap::const_iterator charIter; wxString::const_iterator ch; for (ch = s.begin(); ch != s.end(); ++ch) { charIter = (*convMap).find(*ch); if (charIter != (*convMap).end()) { #if wxCHECK_VERSION(2,9,0) t.Append(wxUniChar(charIter->second)); #else t.Append(wxChar(charIter->second)); #endif } else { t += wxT("?"); } } } else { t = s; } return t; #else // Return unchanged string in ANSI build wxUnusedVar(encoding); return s; #endif }
void UniCharTestCase::CharCompareIntl() { wxUniChar a(CYRILLIC_SMALL_LETTER_YU); wxUniChar b(ARABIC_LETTER_NOON); CPPUNIT_ASSERT( a == a ); CPPUNIT_ASSERT( a == CYRILLIC_SMALL_LETTER_YU ); CPPUNIT_ASSERT( a == wxUniChar(CYRILLIC_SMALL_LETTER_YU) ); CPPUNIT_ASSERT( a != b ); CPPUNIT_ASSERT( a != ARABIC_LETTER_NOON ); CPPUNIT_ASSERT( a != wxUniChar(ARABIC_LETTER_NOON) ); CPPUNIT_ASSERT( a < b ); CPPUNIT_ASSERT( a < ARABIC_LETTER_NOON ); CPPUNIT_ASSERT( a < wxUniChar(ARABIC_LETTER_NOON) ); CPPUNIT_ASSERT( a <= b ); CPPUNIT_ASSERT( a <= ARABIC_LETTER_NOON ); CPPUNIT_ASSERT( a <= wxUniChar(ARABIC_LETTER_NOON) ); CPPUNIT_ASSERT( a <= a ); CPPUNIT_ASSERT( a <= CYRILLIC_SMALL_LETTER_YU ); CPPUNIT_ASSERT( a <= wxUniChar(CYRILLIC_SMALL_LETTER_YU) ); CPPUNIT_ASSERT( b > a ); CPPUNIT_ASSERT( b > CYRILLIC_SMALL_LETTER_YU ); CPPUNIT_ASSERT( b > wxUniChar(CYRILLIC_SMALL_LETTER_YU) ); CPPUNIT_ASSERT( b >= a ); CPPUNIT_ASSERT( b >= CYRILLIC_SMALL_LETTER_YU ); CPPUNIT_ASSERT( b >= wxUniChar(CYRILLIC_SMALL_LETTER_YU) ); CPPUNIT_ASSERT( b >= b ); CPPUNIT_ASSERT( b >= ARABIC_LETTER_NOON ); CPPUNIT_ASSERT( b >= wxUniChar(ARABIC_LETTER_NOON) ); CPPUNIT_ASSERT( b - a == 504 ); CPPUNIT_ASSERT( a - b == -504 ); }
bool Decrypt(const wxString &sText, wxString &sDecryptText) { sDecryptText.Clear(); const wxString sPass(PASSWD); size_t pos(0); for(size_t i = 0; i < sText.Len(); i += 4) { if(pos == sPass.Len()) pos = 0; wxString sHex = sText[i]; sHex += sText[i + 1]; char SymbolHi = wxHexToDec(sHex); sHex = sText[i + 2]; sHex += sText[i + 3]; char SymbolLo = wxHexToDec(sHex); wxUint32 Symbol = (SymbolHi << 8) + SymbolLo; wxUint32 val2 = sPass[pos].GetValue(); Symbol = Symbol ^ val2; sDecryptText += wxUniChar(Symbol); pos++; } return true; }
void UsrGlblMgrEditDialog::Sanitise(wxString& s) { s.Trim().Trim(true); if (s.IsEmpty()) { s = _T("[?empty?]"); return; } for (unsigned int i = 0; i < s.length(); ++i) #if wxCHECK_VERSION(3, 0, 0) s[i] = wxIsalnum(s.GetChar(i)) ? s.GetChar(i) : wxUniChar('_'); #else s[i] = wxIsalnum(s.GetChar(i)) ? s.GetChar(i) : _T('_'); #endif if (s.GetChar(0) == _T('_')) s.Prepend(_T("set")); if (s.GetChar(0) >= _T('0') && s.GetChar(0) <= _T('9')) s.Prepend(_T("set_")); }
void SmartIndentCpp::DoBraceCompletion(cbStyledTextCtrl* control, const wxChar& ch)const { int pos = control->GetCurrentPos(); int style = control->GetStyleAt(pos); // match preprocessor commands if ( (ch == _T('\n')) || ( (control->GetEOLMode() == wxSCI_EOL_CR) && (ch == _T('\r')) ) ) { wxRegEx ppIf(wxT("^[ \t]*#[ \t]*if")); wxRegEx ppElse(wxT("^[ \t]*#[ \t]*el")); wxRegEx ppEnd(wxT("^[ \t]*#[ \t]*endif")); wxRegEx pp(wxT("^([ \t]*#[ \t]*)[a-z]*([ \t]+([a-zA-Z0-9_]+)|())")); // generic match to extract parts const int ppLine = control->GetCurrentLine() - 1; if (ppIf.Matches(control->GetLine(ppLine)) || ppElse.Matches(control->GetLine(ppLine))) { int depth = 1; for (int i = ppLine + 1; i < control->GetLineCount(); ++i) { if (control->GetLine(i).Find(wxT('#')) != wxNOT_FOUND) // limit testing due to performance cost { if (ppIf.Matches(control->GetLine(i))) // ignore else's, elif's, ... ++depth; else if (ppEnd.Matches(control->GetLine(i))) --depth; } if (depth == 0) break; } if (depth > 0) { wxString endIf = wxT("endif"); if (pp.Matches(control->GetLine(ppLine))) { endIf.Prepend(pp.GetMatch(control->GetLine(ppLine), 1)); if (!pp.GetMatch(control->GetLine(ppLine), 3).IsEmpty()) endIf.Append(wxT(" // ") + pp.GetMatch(control->GetLine(ppLine), 3)); } else endIf.Prepend(wxT("#")); control->InsertText(pos, GetEOLStr(control->GetEOLMode()) + endIf); return; } } } if ( control->IsComment(style) || control->IsPreprocessor(style) ) return; if (ch == _T('\'') || ch == _T('"')) { if ( (control->GetCharAt(pos) == ch) && (control->GetCharAt(pos - 2) != _T('\\')) ) { control->DeleteBack(); control->GotoPos(pos); } else { const wxChar left = control->GetCharAt(pos - 2); const wxChar right = control->GetCharAt(pos); if ( control->IsCharacter(style) || control->IsString(style) || left == _T('\\') || ( (left > _T(' ')) && (left != _T('(')) && (left != _T('=')) ) || ( (right > _T(' ')) && (right != _T(')')) ) ) { return; } control->AddText(ch); control->GotoPos(pos); } return; } if ( control->IsCharacter(style) || control->IsString(style) ) return; const wxString leftBrace(_T("([{")); const wxString rightBrace(_T(")]}")); int index = leftBrace.Find(ch); const wxString unWant(_T(");\n\r\t\b ")); const wxChar nextChar = control->GetCharAt(pos); #if wxCHECK_VERSION(2, 9, 0) if ((index != wxNOT_FOUND) && ((unWant.Find(wxUniChar(nextChar)) != wxNOT_FOUND) || (pos == control->GetLength()))) #else if ((index != wxNOT_FOUND) && ((unWant.Find(nextChar) != wxNOT_FOUND) || (pos == control->GetLength()))) #endif { control->AddText(rightBrace.GetChar(index)); control->GotoPos(pos); if (ch == _T('{')) { const int curLine = control->GetCurrentLine(); int keyLine = curLine; wxString text; do { int keyPos = control->GetLineIndentPosition(keyLine); int start = control->WordStartPosition(keyPos, true); int end = control->WordEndPosition(keyPos, true); text = control->GetTextRange(start, end); } while ( (text.IsEmpty() || text == _T("public") || text == _T("protected") || text == _T("private")) && (text != _T("namespace")) && (--keyLine >= 0) ); if (text == _T("class") || text == _T("struct") || text == _T("enum") || text == _T("union")) control->InsertText(control->GetLineEndPosition(curLine), _T(";")); const wxRegEx reg(_T("^[ \t]*{}[ \t]*")); if (reg.Matches(control->GetCurLine())) { control->NewLine(); control->GotoPos(pos); control->NewLine(); return; } } } else { index = rightBrace.Find(ch); if (index != wxNOT_FOUND) { if (control->GetCharAt(pos) == ch) { control->DeleteBack(); control->GotoPos(pos); return; } } } }
bool CheckString(CatalogItemPtr item, const wxString& source, const wxString& translation) override { const UChar32 s_last = source.Last(); const UChar32 t_last = translation.Last(); const bool s_punct = u_ispunct(s_last); const bool t_punct = u_ispunct(t_last); if (u_getIntPropertyValue(s_last, UCHAR_BIDI_PAIRED_BRACKET_TYPE) == U_BPT_CLOSE || u_getIntPropertyValue(t_last, UCHAR_BIDI_PAIRED_BRACKET_TYPE) == U_BPT_CLOSE) { // too many reordering related false positives for brackets // e.g. "your {site} account" -> "váš účet na {site}" if ((wchar_t)u_getBidiPairedBracket(s_last) != (wchar_t)source[0]) { return false; } else { // OTOH, it's desirable to check strings fully enclosed in brackets like "(unsaved)" if (source.find_first_of((wchar_t)s_last, 1) != source.size() - 1) { // it's more complicated, possibly something like "your {foo} on {bar}" return false; } } } if (u_hasBinaryProperty(s_last, UCHAR_QUOTATION_MARK) || (!s_punct && u_hasBinaryProperty(t_last, UCHAR_QUOTATION_MARK))) { // quoted fragments can move around, e.g., so ignore quotes in reporting: // >> Invalid value for ‘{fieldName}’ field // >> Valor inválido para el campo ‘{fieldName}’ // TODO: count quote characters to check if used correctly in translation; don't check position return false; } if (s_punct && !t_punct) { item->SetIssue(CatalogItem::Issue::Warning, wxString::Format(_(L"The translation should end with “%s”."), wxString(wxUniChar(s_last)))); return true; } else if (!s_punct && t_punct) { item->SetIssue(CatalogItem::Issue::Warning, wxString::Format(_(L"The translation should not end with “%s”."), wxString(wxUniChar(t_last)))); return true; } else if (s_punct && t_punct && s_last != t_last) { if (t_last == L'…' && source.EndsWith("...")) { // as a special case, allow translating ... (3 dots) as … (ellipsis) } else if (u_hasBinaryProperty(s_last, UCHAR_QUOTATION_MARK) && u_hasBinaryProperty(t_last, UCHAR_QUOTATION_MARK)) { // don't check for correct quotes for now, accept any quotations marks as equal } else if (IsEquivalent(s_last, t_last)) { // some characters are mostly equivalent and we shouldn't warn about them } else { item->SetIssue(CatalogItem::Issue::Warning, wxString::Format(_(L"The translation ends with “%s”, but the source text ends with “%s”."), wxString(wxUniChar(t_last)), wxString(wxUniChar(s_last)))); return true; } } return false; }
void UniCharTestCase::CharCompare() { wxUniChar a('a'); wxUniChar b('b'); CPPUNIT_ASSERT( a == a ); CPPUNIT_ASSERT( a == 'a' ); CPPUNIT_ASSERT( a == wxT('a') ); CPPUNIT_ASSERT( a == wxUniChar('a') ); CPPUNIT_ASSERT( a == wxUniChar(wxT('a')) ); CPPUNIT_ASSERT( a != b ); CPPUNIT_ASSERT( a != 'b' ); CPPUNIT_ASSERT( a != wxT('b') ); CPPUNIT_ASSERT( a != wxUniChar('b') ); CPPUNIT_ASSERT( a != wxUniChar(wxT('b')) ); CPPUNIT_ASSERT( a < b ); CPPUNIT_ASSERT( a < 'b' ); CPPUNIT_ASSERT( a < wxT('b') ); CPPUNIT_ASSERT( a < wxUniChar('b') ); CPPUNIT_ASSERT( a < wxUniChar(wxT('b')) ); CPPUNIT_ASSERT( a <= b ); CPPUNIT_ASSERT( a <= 'b' ); CPPUNIT_ASSERT( a <= wxT('b') ); CPPUNIT_ASSERT( a <= wxUniChar('b') ); CPPUNIT_ASSERT( a <= wxUniChar(wxT('b')) ); CPPUNIT_ASSERT( a <= a ); CPPUNIT_ASSERT( a <= 'a' ); CPPUNIT_ASSERT( a <= wxT('a') ); CPPUNIT_ASSERT( a <= wxUniChar('a') ); CPPUNIT_ASSERT( a <= wxUniChar(wxT('a')) ); CPPUNIT_ASSERT( b > a ); CPPUNIT_ASSERT( b > 'a' ); CPPUNIT_ASSERT( b > wxT('a') ); CPPUNIT_ASSERT( b > wxUniChar('a') ); CPPUNIT_ASSERT( b > wxUniChar(wxT('a')) ); CPPUNIT_ASSERT( b >= a ); CPPUNIT_ASSERT( b >= 'a' ); CPPUNIT_ASSERT( b >= wxT('a') ); CPPUNIT_ASSERT( b >= wxUniChar('a') ); CPPUNIT_ASSERT( b >= wxUniChar(wxT('a')) ); CPPUNIT_ASSERT( b >= b ); CPPUNIT_ASSERT( b >= 'b' ); CPPUNIT_ASSERT( b >= wxT('b') ); CPPUNIT_ASSERT( b >= wxUniChar('b') ); CPPUNIT_ASSERT( b >= wxUniChar(wxT('b')) ); CPPUNIT_ASSERT( b - a == 1 ); CPPUNIT_ASSERT( a - b == -1 ); }
void GetWordBoundaries(wxString const& text, IntPairVector &results, int start, int end) { int depth = 0; bool in_draw_mode = false; if (end < 0) end = text.size(); // Delimiters const wxUniChar delims[] = { 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x003a, 0x003b, 0x003d, 0x003f, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 0x00aa, 0x00ab, 0x00b0, 0x00b6, 0x00b7, 0x00ba, 0x00bb, 0x00bf, 0x02dc, 0x0e3f, 0x2010, 0x2013, 0x2014, 0x2015, 0x2018, 0x2019, 0x201c, 0x201d, 0x2020, 0x2021, 0x2022, 0x2025, 0x2026, 0x2026, 0x2030, 0x2031, 0x2032, 0x203b, 0x203b, 0x203d, 0x2042, 0x2044, 0x20a6, 0x20a9, 0x20aa, 0x20ac, 0x20ad, 0x2116, 0x2234, 0x2235, 0x2420, 0x2422, 0x2423, 0x2506, 0x25ca, 0x2605, 0x261e, 0x2e2e, 0x3000, 0x3001, 0x3002, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d, 0x300e, 0x300f, 0x3010, 0x3011, 0x3014, 0x3015, 0x3016, 0x3017, 0x3018, 0x3019, 0x301a, 0x301b, 0x301c, 0x3030, 0x303d, 0x30fb, 0xff0a, 0xff5b, 0xff5d, 0xff5e }; for (int i = start; i < end + 1; ++i) { // Current character wxUniChar cur = i < end ? text[i] : wxUniChar('.'); // Increase depth if (cur == '{') { depth++; if (depth == 1 && start != i && !in_draw_mode) results.push_back(std::make_pair(start, i)); } // Decrease depth else if (cur == '}') { depth--; start = i + 1; } else if (depth > 0) { // Check for draw mode if (cur == '\\' && i + 1 < end && text[i + 1] == 'p') { i += 2; // Eat leading zeros while (i < end && text[i] == '0') ++i; in_draw_mode = i < end && text[i] >= '0' && text[i] <= '9'; if (!in_draw_mode) --i; } } else if (!in_draw_mode) { // Check if it is \n or \N if (cur == '\\' && i < end-1 && (text[i+1] == 'N' || text[i+1] == 'n' || text[i+1] == 'h')) { if (start != i) results.push_back(std::make_pair(start, i)); start = i + 2; i++; } // Check for standard delimiters else if (std::binary_search(delims, delims + sizeof(delims) / sizeof(delims[0]), cur)) { if (start != i) results.push_back(std::make_pair(start, i)); start = i + 1; } } } }
wxExSTCShell::wxExSTCShell( wxWindow* parent, const wxString& prompt, const wxString& command_end, bool echo, int commands_save_in_config, const wxString& lexer, long menu_flags, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxExSTC( parent, wxEmptyString, STC_WIN_NO_INDICATOR, wxEmptyString, // title menu_flags, id, pos, size, style) , m_Command(wxEmptyString) , m_CommandEnd((command_end == wxEmptyString ? GetEOL(): command_end)) , m_CommandStartPosition(0) , m_Echo(echo) // take a char that is not likely to appear inside commands , m_CommandsInConfigDelimiter(wxUniChar(0x03)) , m_CommandsSaveInConfig(commands_save_in_config) , m_Prompt(prompt) , m_Handler(parent) , m_Enabled(true) { // Override defaults from config. SetEdgeMode(wxSTC_EDGE_NONE); ResetMargins(false); // do not reset divider margin SetName("SHELL"); // Start with a prompt. Prompt(); if (m_CommandsSaveInConfig > 0) { // Get all previous commands. wxStringTokenizer tkz(wxConfigBase::Get()->Read("Shell"), m_CommandsInConfigDelimiter); while (tkz.HasMoreTokens()) { const wxString val = tkz.GetNextToken(); m_Commands.push_front(val); } } // Take care that m_CommandsIterator is valid. m_CommandsIterator = m_Commands.end(); EnableShell(true); SetLexer(lexer); }