diff options
Diffstat (limited to 'readerview.cc')
-rw-r--r-- | readerview.cc | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/readerview.cc b/readerview.cc deleted file mode 100644 index aef003d..0000000 --- a/readerview.cc +++ /dev/null @@ -1,98 +0,0 @@ -#include "readerview.h" -#include "sword.h" -#include <libbible.h> -#include <gdkmm/rgba.h> - -ReaderView::ReaderView() -: text() -{ - this->sword = new Sword(); - this->conf = new struct config; - text.set_editable(false); - text.set_cursor_visible(false); - text.set_wrap_mode(Gtk::WrapMode::WRAP_WORD_CHAR); - //text.override_background_color(*(new Gdk::RGBA("#1d1f21"))); - //text.override_color(*(new Gdk::RGBA("#c5c8c6"))); - auto scroll = new Gtk::ScrolledWindow(); - scroll->add(text); - add(*scroll); - // Open the passage we had last time - string book = libbible::settingsRead("book"); - int chapter = libbible::settingsReadInt("chapter"); - if(book.empty() || chapter == 0) { - book = "Genesis"; - chapter = 1; - } - sword->getConfig(book, chapter, conf); - refresh(); -} - -ReaderView::~ReaderView() {} - -// Returns all new mods -std::vector<std::string> ReaderView::modsUpdated() { - auto oldMods = getAllVersions(); - std::sort(oldMods.begin(), oldMods.end()); - sword = new Sword(); - auto newMods = getAllVersions(); - std::sort(newMods.begin(), newMods.end()); - std::vector<std::string> justNew; - std::set_difference(newMods.begin(), newMods.end(), oldMods.begin(), oldMods.end(), std::back_inserter(justNew)); - refresh(); - return justNew; -} - -void ReaderView::refresh() { - auto textBuffer = text.get_buffer(); - libbible::settingsWrite("book", conf->book); - libbible::settingsWriteInt("chapter", conf->chapter); - sword->getConfig(conf->book, conf->chapter, conf); - // Get passage back - string passage = conf->book + " " + std::to_string(conf->chapter); - textBuffer->set_text(""); // Clear contents - //auto iter = textBuffer->get_iter_at_offset(0); - sword->fillBuffer(passage, textBuffer); -} - -void ReaderView::setChapter(int chapter) { - conf->chapter = chapter; - refresh(); -} - -int ReaderView::getChapter() { - return conf->chapter; -} - -int ReaderView::getChapterMax() { - return conf->maxChapter; -} - -void ReaderView::setBook(std::string book) { - conf->book = book; - refresh(); -} - -std::string ReaderView::getBook() { - return conf->book; -} - -std::string ReaderView::getBookFull() { - return conf->bookFull; -} - -std::vector<std::string> ReaderView::getAllBooks() { - return sword->getBooks(); -} - -void ReaderView::setVersion(std::string version) { - sword->setModule(version); - refresh(); -} - -std::string ReaderView::getVersion() { - return conf->version; -} - -std::vector<std::string> ReaderView::getAllVersions() { - return sword->getModules(); -} |