Ejemplo n.º 1
0
void zeichneachsex(int c,tic *tics,int ntic,int beschrifte,int textsize,
                   char *label, int xmin, int xmax, int y,int dir)
{
    int i,len,posx,posy;
    double gr;

    len=xmax-xmin;
    mydrawline(c,xmin,y,xmax,y);
    for (i=0; i<ntic; i++)
    {
        posx=xmin+tics[i].pos*len;
        if (tics[i].name!=NULL)
        {
            gr=1*len/50;
            if (beschrifte)
            {
                posy=y+3*dir*gr;
                mytext(c,posx,posy,tics[i].name,1);
            }
        }
        else gr=0.5*len/50;
        posy=y-dir*gr;
        mydrawline(c,posx,y,posx,posy);
    }
    if (beschrifte) mytext(c,xmin+len/2,y+dir*4*len/50+2*len/50,label,1);
}
Ejemplo n.º 2
0
void zeichneachsey(int c,tic *tics,int ntic,int beschrifte,int textsize,
                   char *label, int ymin, int ymax, int x,int dir)
{
    int i,len,posx,posy;
    double gr;

    len=ymax-ymin;
    mydrawline(c,x,ymin,x,ymax);
    for (i=0; i<ntic; i++)
    {
        posy=ymin+tics[i].pos*len;
        if (tics[i].name!=NULL)
        {
            gr=1*len/50;
            if (beschrifte)
            {
                posx=x+dir*gr;
                if (dir<0) mytext(c,posx,posy,tics[i].name,0);
                else mytext(c,posx,posy,tics[i].name,2);
            }
        }
        else gr=0.5*len/50;
        posx=x-dir*gr;
        mydrawline(c,x,posy,posx,posy);
    }
    if (beschrifte) mytext(c,x+dir*6*len/50,ymin+9*len/10,label,1);
}
Ejemplo n.º 3
0
void CheckValidateReferences::check(const ustring & text)
// Do the actual check of one verse.
{
  // Bail out if the verse is empty.
  if (text.empty())
    return;

  // Extract the references and check them all.
  ReferencesScanner refscanner(language, book, text);
  for (unsigned int i = 0; i < references.size(); i++) {

    // Check whether the reference fits within the limits of the versification system.
    bool reference_fits = true;
    unsigned int highest_chapter = 0;
    vector < unsigned int >chapters = versification_get_chapters(versification, refscanner.references[i].book_get());
    if (!chapters.empty())
      highest_chapter = chapters[chapters.size() - 1];
    if (refscanner.references[i].chapter_get() > highest_chapter)
      reference_fits = false;
    unsigned int last_verse = convert_to_int(versification_get_last_verse(versification, 
									  refscanner.references[i].book_get(),
									  refscanner.references[i].chapter_get()));
    unsigned int this_verse = convert_to_int(refscanner.references[i].verse_get());
    if (this_verse > last_verse)
      reference_fits = false;
    if (!reference_fits) {
      message(refscanner.references[i].human_readable(language) + _(" does not fit in the versification system"));
    }
    // Check whether the reference exists in the project.
    if (reference_fits) {
      ustring versetext = project_retrieve_verse(myproject, refscanner.references[i]);
      if (versetext.empty()) {
        message(refscanner.references[i].human_readable(language) + _(" contains no text"));
      }
    }
  }

  // Look for chapter/verse pairs by pattern, and check on these.
  ustring mytext(text);
  while (mytext.length() > 5) {
    if (text_starts_chapter_verse(mytext)) {
      // This text starts a chapter/verse string.
      // Look for the dot or colon.
      size_t position = mytext.find_first_of(".:");
      if (position != string::npos) {
        unsigned int mychapter = convert_to_int(mytext.substr(0, position));
        mytext.erase(0, ++position);
        ustring myverse = number_in_string(mytext);
        mytext.erase(0, myverse.length());
        bool referencefound = false;
        for (unsigned int i = 0; i < references.size(); i++) {
          if (refscanner.references[i].chapter_get() == mychapter)
            if (refscanner.references[i].verse_get() == myverse)
              referencefound = true;
        }
        if (!referencefound) {
          message(_("Unrecognized chapter ") + convert_to_string(mychapter) + _(" and verse ") + myverse);
        }
      }
      mytext.erase(0, 3);
    } else {
      // No chapter/verse string: erase one character and try again.
      mytext.erase(0, 1);
    }
  }
}