[sword-svn] r3282 - in branches/sword-1-7-x: . examples/tasks src/modules
greg.hellings at crosswire.org
greg.hellings at crosswire.org
Tue Dec 2 23:09:07 MST 2014
Author: greg.hellings
Date: 2014-12-02 23:09:06 -0700 (Tue, 02 Dec 2014)
New Revision: 3282
Modified:
branches/sword-1-7-x/
branches/sword-1-7-x/examples/tasks/parallelbibles.cpp
branches/sword-1-7-x/src/modules/swmodule.cpp
Log:
Merged r3242
Property changes on: branches/sword-1-7-x
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155,3190-3192,3198-3199,3202-3203,3225,3230,3232-3234,3236,3238-3239
+ /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155,3190-3192,3198-3199,3202-3203,3225,3230,3232-3234,3236,3238-3239,3242
Modified: branches/sword-1-7-x/examples/tasks/parallelbibles.cpp
===================================================================
--- branches/sword-1-7-x/examples/tasks/parallelbibles.cpp 2014-12-03 06:07:22 UTC (rev 3281)
+++ branches/sword-1-7-x/examples/tasks/parallelbibles.cpp 2014-12-03 06:09:06 UTC (rev 3282)
@@ -33,13 +33,19 @@
using namespace sword;
using namespace std;
+const bool o = 1;
void parallelDisplay(vector<SWModule *>modules, const char *key) {
+ //cout << "Start key:" << key;
+
// We'll use the first module's key as our master key to position all other modules.
VerseKey *master = (VerseKey *)modules[0]->createKey();
master->setText(key);
+
+ //cout << "\t key:" << master->getText();
+
int curVerse = master->getVerse();
int curChapter = master->getChapter();
int curBook = master->getBook();
@@ -49,15 +55,66 @@
&& !master->popError();
(*master)++) {
- cout << "<tr class=\"" << (master->getVerse() == curVerse ? "currentverse":"verse") << "\">";
+ if(o) cout << "<tr class=\"" << (master->getVerse() == curVerse ? "currentverse":"verse") << "\">";
+
for (vector<SWModule *>::iterator module = modules.begin(); module != modules.end(); ++module) {
+ //cout << "\n\n====================\nfromKey" << master->getOSISRef();
+
(*module)->setKey(master);
+ VerseKey slave((*module)->getKey());
+
+ //cout << "setKey" << (*module)->getName() << slave.getBookName() << slave.getRangeText() << slave.getShortText();
+
+ if(o) cout << "<td>" << "<span class=\"versenum\">";
+
+ //cout << "[" << (int)slave.getBook() << " " << (int)master->getBook() << " " << (int)slave.getTestament() << " " << (int)master->getTestament() << "]";
+
+
if (!(*module)->popError()) {
- cout << "<td>" << "<span class=\"versenum\">" << master->getVerse() << "</span> ";
- cout << (*module)->renderText() << "</td>";
+
+ if(strcmp(slave.getBookName(), master->getBookName())) {
+ if(o) cout << slave.getShortText();
+ }
+ else if(slave.getChapter() != master->getChapter()) {
+ if(o) cout << slave.getChapter() << ":" << slave.getVerse();
+ }
+ else {
+ if(o) cout << slave.getVerse();
+ }
+
+ if(slave.isBoundSet()) {
+ if(o) cout << "-";
+ if(slave.getUpperBound().getBook() != slave.getLowerBound().getBook()) {
+ if(o) cout << slave.getUpperBound().getShortText();
+ }
+ else if(slave.getUpperBound().getChapter() != slave.getLowerBound().getChapter()) {
+ if(o) cout << slave.getUpperBound().getChapter() << ":" << slave.getUpperBound().getVerse();
+ }
+ else {
+ if(o) cout << slave.getUpperBound().getVerse();
+ }
+ }
+
+ if(o) cout << "</span> ";
+
+
+ if(slave.isBoundSet()) {
+ VerseKey temp(slave);
+ for(int i = slave.getLowerBound().getIndex(); i <= slave.getUpperBound().getIndex(); ++i) {
+ if(i > 0) if(o) cout << " ";
+ temp.setIndex(i);
+ (*module)->setKey(temp);
+ if(o) cout << (*module)->renderText();
+ }
+ }
+ else {
+ if(o) cout << (*module)->renderText();
+ }
+
+ if(o) cout << "</td>";
}
}
- cout << "</tr>";
+ if(o) cout << "</tr>";
}
delete master;
}
@@ -171,9 +228,9 @@
modules.push_back(bible);
}
- outputHeader(modules, argv[argc-1]);
+ if(o) outputHeader(modules, argv[argc-1]);
parallelDisplay(modules, argv[argc-1]);
- outputFooter(modules);
+ if(o) outputFooter(modules);
return 0;
}
Modified: branches/sword-1-7-x/src/modules/swmodule.cpp
===================================================================
--- branches/sword-1-7-x/src/modules/swmodule.cpp 2014-12-03 06:07:22 UTC (rev 3281)
+++ branches/sword-1-7-x/src/modules/swmodule.cpp 2014-12-03 06:09:06 UTC (rev 3282)
@@ -295,7 +295,7 @@
if (oldKey)
delete oldKey;
- return 0;
+ return error = key->popError();
}
More information about the sword-cvs
mailing list