Update previews on preference change (#9507)

Normally the theBufferList().updatePreviews(); statement would go inside
of PrefDisplay::applyRC. However, that would not work well because
Buffer::updatePreviews() calls loader() which conditions on
(lyxrc.preview == LyXRC::PREVIEW_OFF) but the new RC has not been set at
this point.
This commit is contained in:
Scott Kostyshak 2015-04-19 02:30:28 -04:00
parent cf4f79f884
commit 390ae05444
3 changed files with 13 additions and 0 deletions

View File

@ -344,6 +344,15 @@ void BufferList::recordCurrentAuthor(Author const & author)
} }
void BufferList::updatePreviews()
{
BufferStorage::iterator it = bstore.begin();
BufferStorage::iterator end = bstore.end();
for (; it != end; ++it)
(*it)->updatePreviews();
}
int BufferList::bufferNum(FileName const & fname) const int BufferList::bufferNum(FileName const & fname) const
{ {
FileNameList const buffers(fileNames()); FileNameList const buffers(fileNames());

View File

@ -115,6 +115,8 @@ public:
//@{ //@{
/// reset current author for all buffers /// reset current author for all buffers
void recordCurrentAuthor(Author const & author); void recordCurrentAuthor(Author const & author);
/// update previews for all buffers, e.g. for Prefs update
void updatePreviews();
/// Call changed() on all buffers, internal or not /// Call changed() on all buffers, internal or not
void changed(bool update_metrics) const; void changed(bool update_metrics) const;
/// emergency save for all buffers /// emergency save for all buffers

View File

@ -3456,6 +3456,8 @@ void GuiPreferences::dispatchParams()
update_screen_font_ = false; update_screen_font_ = false;
} }
theBufferList().updatePreviews();
// The Save button has been pressed // The Save button has been pressed
if (isClosing()) if (isClosing())
dispatch(FuncRequest(LFUN_PREFERENCES_SAVE)); dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));