mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-08 18:19:42 +00:00
#7430 add check for first document language for the spell checker and initialize the language combo accordingly on open
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38294 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ae5d64908e
commit
01a21a60b5
@ -70,6 +70,8 @@ struct SpellcheckerWidget::Private
|
|||||||
///
|
///
|
||||||
bool continueFromBeginning();
|
bool continueFromBeginning();
|
||||||
///
|
///
|
||||||
|
void setLanguage(Language const * lang);
|
||||||
|
///
|
||||||
Ui::SpellcheckerUi ui;
|
Ui::SpellcheckerUi ui;
|
||||||
///
|
///
|
||||||
SpellcheckerWidget * p;
|
SpellcheckerWidget * p;
|
||||||
@ -159,8 +161,16 @@ void SpellcheckerWidget::updateView()
|
|||||||
{
|
{
|
||||||
BufferView * bv = d->gv_->documentBufferView();
|
BufferView * bv = d->gv_->documentBufferView();
|
||||||
setEnabled(bv != 0);
|
setEnabled(bv != 0);
|
||||||
if (bv && hasFocus())
|
if (bv && hasFocus()) {
|
||||||
|
|
||||||
|
BufferView * bv = d->gv_->documentBufferView();
|
||||||
|
std::set<Language const *> languages =
|
||||||
|
bv->buffer().masterBuffer()->getLanguages();
|
||||||
|
if (!languages.empty())
|
||||||
|
d->setLanguage(*languages.begin());
|
||||||
|
|
||||||
d->check();
|
d->check();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -288,6 +298,14 @@ void SpellcheckerWidget::Private::updateSuggestions(docstring_list & words)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SpellcheckerWidget::Private::setLanguage(Language const * lang)
|
||||||
|
{
|
||||||
|
int const pos = ui.languageCO->findData(toqstr(lang->lang()));
|
||||||
|
if (pos != -1)
|
||||||
|
ui.languageCO->setCurrentIndex(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SpellcheckerWidget::Private::check()
|
void SpellcheckerWidget::Private::check()
|
||||||
{
|
{
|
||||||
BufferView * bv = gv_->documentBufferView();
|
BufferView * bv = gv_->documentBufferView();
|
||||||
@ -322,9 +340,7 @@ void SpellcheckerWidget::Private::check()
|
|||||||
// set suggestions
|
// set suggestions
|
||||||
updateSuggestions(suggestions);
|
updateSuggestions(suggestions);
|
||||||
// set language
|
// set language
|
||||||
int const pos = ui.languageCO->findData(toqstr(word_lang.lang()->lang()));
|
setLanguage(word_lang.lang());
|
||||||
if (pos != -1)
|
|
||||||
ui.languageCO->setCurrentIndex(pos);
|
|
||||||
|
|
||||||
// FIXME LFUN
|
// FIXME LFUN
|
||||||
// If we used a LFUN, dispatch would do all of this for us
|
// If we used a LFUN, dispatch would do all of this for us
|
||||||
|
Loading…
Reference in New Issue
Block a user