From 4f26d55e01f9424ba5660cb27076eafba4c88b21 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 19 Feb 2022 10:54:35 -0500 Subject: Reorganized sources --- readerview.cc | 98 ----------------------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 readerview.cc (limited to 'readerview.cc') 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 -#include - -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 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 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 ReaderView::getAllBooks() { - return sword->getBooks(); -} - -void ReaderView::setVersion(std::string version) { - sword->setModule(version); - refresh(); -} - -std::string ReaderView::getVersion() { - return conf->version; -} - -std::vector ReaderView::getAllVersions() { - return sword->getModules(); -} -- cgit v1.2.3