From 694819fad8d395876128e390fe5fdafc96d6491c Mon Sep 17 00:00:00 2001 From: Younitea Date: Wed, 8 May 2024 12:40:32 -0700 Subject: [PATCH] Edited message boxes --- Charcoal/Charcoal/Charcoal.cpp | 4 ++-- Charcoal/Charcoal/Epub.cpp | 1 - Charcoal/Charcoal/Library.cpp | 14 ++++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Charcoal/Charcoal/Charcoal.cpp b/Charcoal/Charcoal/Charcoal.cpp index a8f2d44..4033b74 100644 --- a/Charcoal/Charcoal/Charcoal.cpp +++ b/Charcoal/Charcoal/Charcoal.cpp @@ -100,7 +100,7 @@ void Charcoal::deleteBooks(const JSObject& thisobject, const JSArgs& args) } void Charcoal::grayscaleName(const JSObject& thisobject, const JSArgs& args) { - MessageBoxA(NULL, "Grayscale Books Hook", "Grayscale Books Hook", MB_OK); + MessageBoxA(NULL, "Started Grayscaling book", "Started Grayscaling book", MB_OK); // Get the first argument JSValueRef arg = args[0]; JSContextRef ctx = JSGlobalContextCreate(NULL); @@ -109,7 +109,7 @@ void Charcoal::grayscaleName(const JSObject& thisobject, const JSArgs& args) { // Call the grayscale method ebooks.grayscale(ID); - + MessageBoxA(NULL, "Finished Grayscaling book", "Finished Grayscaling book", MB_OK); return; } diff --git a/Charcoal/Charcoal/Epub.cpp b/Charcoal/Charcoal/Epub.cpp index 33b5ebf..3d4ccea 100644 --- a/Charcoal/Charcoal/Epub.cpp +++ b/Charcoal/Charcoal/Epub.cpp @@ -109,7 +109,6 @@ book Epub::add(std::string npath) } void Epub::grayscaleEpub(std::string path) { - //std::string npath = wstrtostr(path); using namespace libzippp; ZipArchive zipArchive(path); zipArchive.open(ZipArchive::Write); diff --git a/Charcoal/Charcoal/Library.cpp b/Charcoal/Charcoal/Library.cpp index e4d352b..431f96f 100644 --- a/Charcoal/Charcoal/Library.cpp +++ b/Charcoal/Charcoal/Library.cpp @@ -83,14 +83,16 @@ std::string Library::getFileExtension(const std::string& filePath) int ID = 0; std::string Library::add(PWSTR path) { - std::string f = getFileExtension(wstrtostr(path)); + std::string npath = wstrtostr(path); + std::string f = getFileExtension(npath); if (f == "epub") { Epub e; - std::string npath = wstrtostr(path); + book curr = e.add(npath); curr.ID = ID; curr.path = npath; + ++ID; collection.push_back(curr); titles.push_back(curr.title); @@ -125,11 +127,11 @@ std::vector Library::getBookTitles() { return titles; } -int Library::remove(int ID) // this actually removes the book from the library. +int Library::remove(int book_ID) // this actually removes the book from the library. { for (int i = 0; i < collection.size(); i++) { - if (collection[i].ID == ID) + if (collection[i].ID == book_ID) { collection.erase(collection.begin() + i); return 1; @@ -138,11 +140,11 @@ int Library::remove(int ID) // this actually removes the book from the library. return -1; } -int Library::grayscale(int ID) +int Library::grayscale(int book_ID) { for (int i = 0; i < collection.size(); i++) { - if (collection[i].ID == ID) + if (collection[i].ID == book_ID) { std::string path = collection[i].path; std::string f = getFileExtension((path));