Bibletime – a bible study tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

centrydisplay.cpp 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*********
  2. *
  3. * This file is part of BibleTime's source code, http://www.bibletime.info/.
  4. *
  5. * Copyright 1999-2006 by the BibleTime developers.
  6. * The BibleTime source code is licensed under the GNU General Public License version 2.0.
  7. *
  8. **********/
  9. //BibleTime includes
  10. #include "centrydisplay.h"
  11. #include "cswordkey.h"
  12. #include "cswordversekey.h"
  13. #include "cswordbookmoduleinfo.h"
  14. #include "creferencemanager.h"
  15. #include "cdisplaytemplatemgr.h"
  16. #include "cdisplayrendering.h"
  17. #include "frontend/cbtconfig.h"
  18. #include "util/scoped_resource.h"
  19. //Qt includes
  20. #include <tqapplication.h>
  21. #include <tqregexp.h>
  22. using namespace Rendering;
  23. /** Returns the rendered text using the modules in the list and using the key parameter.
  24. * The displayoptions and filter options are used, too.
  25. */
  26. const TQString CEntryDisplay::text( const ListCSwordModuleInfo& modules, const TQString& keyName, const CSwordBackend::DisplayOptions displayOptions, const CSwordBackend::FilterOptions filterOptions ) {
  27. CDisplayRendering render(displayOptions, filterOptions);
  28. //no highlighted key and no extra key link in the text
  29. CTextRendering::KeyTreeItem::Settings normal_settings(false, CTextRendering::KeyTreeItem::Settings::CompleteShort);
  30. CSwordModuleInfo* module = modules.first();
  31. TQString result;
  32. //in Bibles and Commentaries we need to check if 0:0 and X:0 contain something
  33. if (module->type() == CSwordModuleInfo::Bible || module->type() == CSwordModuleInfo::Commentary) {
  34. ((VerseKey*)(module->module()->getKey()))->Headings(1); //HACK: enable headings for VerseKeys
  35. CSwordVerseKey k1(module);
  36. k1.Headings(1);
  37. k1.key(keyName);
  38. // don't print the key
  39. CTextRendering::KeyTreeItem::Settings preverse_settings(false, CTextRendering::KeyTreeItem::Settings::NoKey);
  40. if (k1.Verse() == 1){ //X:1, prepend X:0
  41. if (k1.Chapter() == 1){ //1:1, also prepend 0:0 before that
  42. k1.Chapter(0);
  43. k1.Verse(0);
  44. if ( k1.rawText().length() > 0 ) result.append( render.renderSingleKey(k1.key(), modules, preverse_settings ) );
  45. k1.Chapter(1);
  46. }
  47. k1.Verse(0);
  48. if ( k1.rawText().length() > 0 ) result.append( render.renderSingleKey(k1.key(), modules, preverse_settings ) );
  49. }
  50. }
  51. return result.append( render.renderSingleKey(keyName, modules, normal_settings) );
  52. }