LYX_OPTION(WALL "Enable all warnings" OFF MSVC)
LYX_OPTION(DISABLE_PCH "Disable precompiled headers" ON ALL)
LYX_OPTION(MERGE_FILES "Merge source files into one compilation unit" OFF ALL)
-LYX_OPTION(MERGE_REBUILD "Rebuild generated files from merged files build" OFF ALL)
LYX_OPTION(DEBUG_GLIBC "Enable libstdc++ debug mode" OFF GCC)
LYX_OPTION(DEBUG_GLIBC_PEDANTIC "Enable libstdc++pedantic debug mode" OFF GCC)
LYX_OPTION(STDLIB_DEBUG "Use debug stdlib" OFF GCC)
endif()
endif()
- if (LYX_MERGE_REBUILD)
- #message(STATUS "Merge files build: rebuilding generated files")
+ if (merge_rebuild)
set(_rebuild_file_const 1)
set(_rebuild_file_touched 1)
endif()
#include "support/lstrings.h"
#include "support/os.h"
#include "support/Systemcall.h"
-#include "support/textutils.h"
#include <algorithm>
{
if (name_.empty())
return false;
- return isDigitASCII(name_[name_.length() - 1]);
+ return isdigit(name_[name_.length() - 1]);
}
return speller_change_number > speller_state_.currentChangeNumber();
}
- bool ignoreWord(docstring const & word) const ;
-
void setMisspelled(pos_type from, pos_type to, SpellChecker::Result state)
{
pos_type textsize = owner_->size();
char_type const c = d->text_[pos];
// We want to pass the ' and escape chars to the spellchecker
static docstring const quote = from_utf8(lyxrc.spellchecker_esc_chars + '\'');
- return (!isLetterChar(c) && !isDigitASCII(c) && !contains(quote, c))
+ return (!isLetterChar(c) && !isDigit(c) && !contains(quote, c))
|| pos == size();
}
if (Inset const * inset = getInset(pos))
return inset->isChar();
char_type const c = d->text_[pos];
- return !isLetterChar(c) && !isDigitASCII(c) && !lyx::isSpace(c);
+ return !isLetterChar(c) && !isDigit(c) && !lyx::isSpace(c);
}
}
-bool Paragraph::Private::ignoreWord(docstring const & word) const
-{
- // Ignore words with digits
- // FIXME: make this customizable
- // (note that some checkers ignore words with digits by default)
- docstring::const_iterator cit = word.begin();
- docstring::const_iterator const end = word.end();
- for (; cit != end; ++cit) {
- if (isNumber((*cit)))
- return true;
- }
- return false;
-}
-
-
SpellChecker::Result Paragraph::spellCheck(pos_type & from, pos_type & to,
WordLangTuple & wl, docstring_list & suggestions,
bool do_suggestion, bool check_learned) const
return result;
if (needsSpellCheck() || check_learned) {
- if (!d->ignoreWord(word)) {
+ // Ignore words with digits
+ // FIXME: make this customizable
+ // (note that some checkers ignore words with digits by default)
+ if (!hasDigit(word)) {
bool const trailing_dot = to < size() && d->text_[to] == '.';
result = speller->check(wl);
if (SpellChecker::misspelled(result) && trailing_dot) {
static docstring const number_seperators = from_ascii(".,:");
if (cur.current_font.fontInfo().number() == FONT_ON) {
- if (!isDigitASCII(c) && !contains(number_operators, c) &&
+ if (!isDigit(c) && !contains(number_operators, c) &&
!(contains(number_seperators, c) &&
cur.pos() != 0 &&
cur.pos() != cur.lastpos() &&
tm.displayFont(pit, cur.pos() - 1).fontInfo().number() == FONT_ON)
)
number(cur); // Set current_font.number to OFF
- } else if (isDigitASCII(c) &&
+ } else if (isDigit(c) &&
cur.real_current_font.isVisibleRightToLeft()) {
number(cur); // Set current_font.number to ON
#if (QT_VERSION >= 0x040400)
connect(&d.autosave_watcher_, SIGNAL(finished()), this,
- SLOT(autoSaveThreadFinished()));
+ SLOT(processingThreadFinished()));
connect(&d.processing_thread_watcher_, SIGNAL(finished()), this,
SLOT(processingThreadFinished()));
}
-void GuiView::processingThreadFinished(bool show_errors)
+void GuiView::processingThreadFinished()
{
QFutureWatcher<docstring> const * watcher =
static_cast<QFutureWatcher<docstring> const *>(sender());
message(watcher->result());
updateToolbars();
- if (show_errors) {
- errors(d.last_export_format);
- }
+ errors(d.last_export_format);
d.processing_cursor_timer_.stop();
restoreCursorShapes();
d.indicates_processing_ = false;
}
-void GuiView::processingThreadFinished()
-{
- processingThreadFinished(true);
-}
-
-void GuiView::autoSaveThreadFinished()
-{
- processingThreadFinished(false);
-}
-
#else
void GuiView::setCursorShapes(Qt::CursorShape)
}
-void GuiView::processingThreadFinished(bool)
-{
-}
-
-
void GuiView::processingThreadFinished()
{
}
-
-
-void GuiView::autoSaveThreadFinished()
-{
-}
#endif
/// For completion of autosave or export threads.
void processingThreadStarted();
- void processingThreadFinished(bool show_errors);
void processingThreadFinished();
- void autoSaveThreadFinished();
void indicateProcessing();
/// must be called in GUI thread
return false;
// check for field type
- if (isDigitASCII(ch)) {
+ if (isDigit(ch)) {
// read integer value
do {
val += ch;
ifs.get(ch);
- } while (ifs && isDigitASCII(ch));
+ } while (ifs && isDigit(ch));
if (!ifs)
return false;
else {
bool has_special_char = false;
for (size_t i = 0; i < value.size(); ++i)
- if (!isAlnumASCII(value[i])) {
+ if (!isAlphaASCII(value[i]) && !isDigit(value[i])) {
has_special_char = true;
break;
}
bool isNumpunct(lyx::char_type const c) const
{
/// Only account for the standard numpunct "C" locale facet.
- return c == '-' || c == '+'
- || c == 'x' || c == 'X'
- || isHexChar(c);
+ return c < 0x80 && (c == '-' || c == '+' || isdigit(c)
+ || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')
+ || c == 'x' || c == 'X');
}
template <typename ValueType>
}
-bool isNumber(char_type c)
+bool isDigit(char_type c)
{
if (!is_utf16(c))
- // assume that no non-utf16 character is a numeral
+ // assume that no non-utf16 character is a digit
// c outside the UCS4 range is catched as well
return false;
- return ucs4_to_qchar(c).isNumber();
+ return ucs4_to_qchar(c).isDigit();
}
bool isAlnumASCII(char_type c)
{
- return isAlphaASCII(c) || isDigitASCII(c);
+ return ('0' <= c && c <= '9')
+ || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
}
string::const_iterator end = tmpstr.end();
for (; cit != end; ++cit)
- if (!isDigitASCII(*cit))
+ if (!isdigit((*cit)))
return false;
return true;
string::const_iterator cit = tmpstr.begin();
string::const_iterator end = tmpstr.end();
for (; cit != end; ++cit)
- if (!isDigitASCII(*cit))
+ if (!isdigit((*cit)))
return false;
return true;
++cit;
string::const_iterator end = tmpstr.end();
for (; cit != end; ++cit) {
- if (!isDigitASCII(*cit) && *cit != '.')
+ if (!isdigit(*cit) && *cit != '.')
return false;
if ('.' == (*cit)) {
if (found_dot)
}
-bool hasDigitASCII(docstring const & str)
+bool hasDigit(docstring const & str)
{
+ if (str.empty())
+ return false;
+
docstring::const_iterator cit = str.begin();
docstring::const_iterator const end = str.end();
- for (; cit != end; ++cit)
- if (isDigitASCII(*cit))
+ for (; cit != end; ++cit) {
+ if (*cit == ' ')
+ continue;
+ if (isdigit((*cit)))
return true;
+ }
return false;
}
bool isStrDbl(std::string const & str);
/// does the string contain a digit?
-bool hasDigitASCII(docstring const & str);
+bool hasDigit(docstring const & str);
bool isHex(docstring const & str);
/// return true if a unicode char is a space.
bool isSpace(char_type c);
-/// return true if a unicode char is a numeral.
-bool isNumber(char_type c);
+/// return true if a unicode char is a digit.
+bool isDigit(char_type c);
/// return whether \p c is a digit in the ASCII range
bool isDigitASCII(char_type c);