Changeset 670


Ignore:
Timestamp:
1999-10-15T12:01:24+13:00 (25 years ago)
Author:
sjboddie
Message:

changes for new browsing support

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/formattools.cpp

    r649 r670  
    2828/*
    2929   $Log$
     30   Revision 1.13  1999/10/14 23:01:24  sjboddie
     31   changes for new browsing support
     32
    3033   Revision 1.12  1999/10/10 08:14:07  sjboddie
    3134   - metadata now returns mp rather than array
     
    7982// a few function prototypes
    8083static text_t format_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
    81                  const text_t &link, const text_t &icon, const text_t &text);
     84                 const text_t &link, const text_t &icon,
     85                 const text_t &text, bool highlight);
    8286
    8387static bool parse_action (text_t::const_iterator &here, const text_t::const_iterator &end,
     
    109113void formatinfo_t::clear() {
    110114  DocumentImages = false;
    111   // note that DocumentTopPages is used in receptionist when translating
    112   // OIDs. changing the default here may require changing it there too.
    113   DocumentTopPages = true;
    114   DocumentHeading = "{Or}{[parent(Top):Title],[Title],untitled}";
    115   DocumentArrowsTop = true;
     115  DocumentTitles = true;
     116  DocumentHeading = "{Or}{[parent(Top):Title],[Title],untitled}<br>";
     117  DocumentContents = true;
    116118  DocumentArrowsBottom = true;
    117   DocumentGoTo = true;
    118119  DocumentButtons.erase (DocumentButtons.begin(), DocumentButtons.end());
    119120  DocumentButtons.push_back ("Detach");
     
    250251  else if (meta == "Text")
    251252    formatlistptr->command = comDoc;
     253
     254  else if (meta == "highlight")
     255    formatlistptr->command = comHighlight;
     256
     257  else if (meta == "/highlight")
     258    formatlistptr->command = comEndHighlight;
    252259
    253260  else {
     
    499506
    500507static text_t get_or (ResultDocInfo_t &docinfo, format_t *orptr,
    501               const text_t &link, const text_t &icon, const text_t &text) {
     508              const text_t &link, const text_t &icon,
     509              const text_t &text, bool highlight) {
    502510
    503511  text_t tmp;
    504512  while (orptr != NULL) {
    505513
    506     tmp = format_string (docinfo, orptr, link, icon, text);
     514    tmp = format_string (docinfo, orptr, link, icon, text, highlight);
    507515    if (!tmp.empty()) return tmp;
    508516
     
    514522static text_t get_if (ResultDocInfo_t &docinfo, const decision_t &decision,
    515523              format_t *ifptr, format_t *elseptr, const text_t &link,
    516               const text_t &icon, const text_t &text) {
     524              const text_t &icon, const text_t &text, bool highlight) {
    517525
    518526  // not much of a choice yet ...
     
    520528    if (get_meta (docinfo, decision.meta) != "") {
    521529      if (ifptr != NULL)
    522     return get_formatted_string (docinfo, ifptr, link, icon, text);
     530    return get_formatted_string (docinfo, ifptr, link, icon, text, highlight);
    523531    }
    524532    else {
    525533      if (elseptr != NULL)
    526     return get_formatted_string (docinfo, elseptr, link, icon, text);
     534    return get_formatted_string (docinfo, elseptr, link, icon, text, highlight);
    527535    }
    528536  }
     
    531539
    532540text_t format_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
    533               const text_t &link, const text_t &icon, const text_t &text) {
     541              const text_t &link, const text_t &icon,
     542              const text_t &text, bool highlight) {
    534543
    535544  if (formatlistptr == NULL) return "";
     
    551560  case comDoc:
    552561    return text;
     562  case comHighlight:
     563    if (highlight) return "<b>";
     564    break;
     565  case comEndHighlight:
     566    if (highlight) return "</b>";
     567    break;
    553568  case comIf:
    554569    return get_if (docinfo, formatlistptr->decision, formatlistptr->ifptr,
    555            formatlistptr->elseptr, link, icon, text);
     570           formatlistptr->elseptr, link, icon, text, highlight);
    556571  case comOr:
    557     return get_or (docinfo, formatlistptr->orptr, link, icon, text);
     572    return get_or (docinfo, formatlistptr->orptr, link, icon, text, highlight);
    558573  }
    559574  return "";
     
    568583  text_t ft;
    569584  while (formatlistptr != NULL) {
    570     ft += format_string (docinfo, formatlistptr, link, icon, text);
     585    ft += format_string (docinfo, formatlistptr, link, icon, text, false);
    571586    formatlistptr = formatlistptr->nextptr;
    572587  }
     
    583598  text_t ft;
    584599  while (formatlistptr != NULL) {
    585     ft += format_string (docinfo, formatlistptr, link, icon, text);
     600    ft += format_string (docinfo, formatlistptr, link, icon, text, false);
    586601    formatlistptr = formatlistptr->nextptr;
    587602  }
     
    598613  text_t ft;
    599614  while (formatlistptr != NULL) {
    600     ft += format_string (docinfo, formatlistptr, link, icon, text);
     615    ft += format_string (docinfo, formatlistptr, link, icon, text, false);
    601616    formatlistptr = formatlistptr->nextptr;
    602617  }
     
    610625  text_t ft;
    611626  while (formatlistptr != NULL) {
    612     ft += format_string (docinfo, formatlistptr, link, icon, text);
     627    ft += format_string (docinfo, formatlistptr, link, icon, text, false);
    613628    formatlistptr = formatlistptr->nextptr;
    614629  }
     
    616631}
    617632
    618 
    619 
     633text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
     634                 const text_t &link, const text_t &icon, bool highlight) {
     635
     636  text_t text, ft;
     637  while (formatlistptr != NULL) {
     638    ft += format_string (docinfo, formatlistptr, link, icon, text, highlight);
     639    formatlistptr = formatlistptr->nextptr;
     640  }
     641  return ft;
     642}
     643
     644text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
     645                 const text_t &link, const text_t &icon,
     646                 const text_t &text, bool highlight) {
     647
     648  text_t ft;
     649  while (formatlistptr != NULL) {
     650    ft += format_string (docinfo, formatlistptr, link, icon, text, highlight);
     651    formatlistptr = formatlistptr->nextptr;
     652  }
     653  return ft;
     654}
     655
     656
  • trunk/gsdl/src/recpt/formattools.h

    r649 r670  
    3333#include "comtypes.h"
    3434
    35 enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon, comDoc};
     35enum command_t {comIf, comOr, comMeta, comText, comLink, comEndLink, comNum, comIcon,
     36        comDoc, comHighlight, comEndHighlight};
    3637enum pcommand_t {pNone, pImmediate, pTop, pAll};
    3738enum dcommand_t {dMeta};
     
    7677
    7778  bool DocumentImages;
    78   bool DocumentTopPages;
     79  bool DocumentTitles;
    7980  text_t DocumentHeading;
    80   bool DocumentArrowsTop;
     81  bool DocumentContents;
    8182  bool DocumentArrowsBottom;
    82   bool DocumentGoTo;
    8383  text_tarray DocumentButtons;
    8484  text_t DocumentText;
     
    108108                 const text_t &link, const text_t &icon, const text_t &text);
    109109
     110text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
     111                 const text_t &link, const text_t &icon, bool highlight);
     112
     113text_t get_formatted_string (ResultDocInfo_t &docinfo, format_t *formatlistptr,
     114                 const text_t &link, const text_t &icon,
     115                 const text_t &text, bool highlight);
     116
    110117
    111118#endif
Note: See TracChangeset for help on using the changeset viewer.