public synchronized void paint(ZLPaintContext context) {
      final ColorProfile cProfile = myViewOptions.getColorProfile();
      context.clear(cProfile.FooterNGBackgroundOption.getValue());

      final BookModel model = myReader.Model;
      if (model == null) {
        return;
      }

      final ZLColor textColor = cProfile.FooterNGForegroundOption.getValue();
      final ZLColor readColor = cProfile.FooterNGForegroundOption.getValue();
      final ZLColor unreadColor = cProfile.FooterNGForegroundUnreadOption.getValue();

      final int left = getLeftMargin();
      final int right = context.getWidth() - getRightMargin();
      final int height = getHeight();
      final int lineWidth = height <= 12 ? 1 : 2;
      final int charHeight = setFont(context, height, height > 12);

      final PagePosition pagePosition = FBView.this.pagePosition();

      // draw info text
      final String infoString = buildInfoString(pagePosition, "  ");
      final int infoWidth = context.getStringWidth(infoString);
      context.setTextColor(textColor);
      context.drawString(right - infoWidth, (height + charHeight + 1) / 2, infoString);

      // draw gauge
      final int gaugeRight = right - (infoWidth == 0 ? 0 : infoWidth + 10);
      final int gaugeInternalRight =
          left
              + (int) (1.0 * (gaugeRight - left) * pagePosition.Current / pagePosition.Total + 0.5);
      final int v = height / 2;

      context.setLineWidth(lineWidth);
      context.setLineColor(readColor);
      context.drawLine(left, v, gaugeInternalRight, v);
      if (gaugeInternalRight < gaugeRight) {
        context.setLineColor(unreadColor);
        context.drawLine(gaugeInternalRight + 1, v, gaugeRight, v);
      }

      // draw labels
      final FooterOptions footerOptions = myViewOptions.getFooterOptions();
      if (footerOptions.ShowTOCMarks.getValue()) {
        final TreeSet<Integer> labels = new TreeSet<Integer>();
        labels.add(left);
        labels.add(gaugeRight);
        updateTOCMarks(model, footerOptions.MaxTOCMarks.getValue());
        final int fullLength = sizeOfFullText();
        for (TOCTree tocItem : myTOCMarks) {
          TOCTree.Reference reference = tocItem.getReference();
          if (reference != null) {
            final int refCoord = sizeOfTextBeforeParagraph(reference.ParagraphIndex);
            labels.add(left + (int) (1.0 * (gaugeRight - left) * refCoord / fullLength + 0.5));
          }
        }
        for (int l : labels) {
          context.setLineColor(l <= gaugeInternalRight ? readColor : unreadColor);
          context.drawLine(l, v + 3, l, v - lineWidth - 2);
        }
      }
    }
    public synchronized void paint(ZLPaintContext context) {
      final ZLFile wallpaper = getWallpaperFile();
      if (wallpaper != null) {
        context.clear(wallpaper, getFillMode());
      } else {
        context.clear(getBackgroundColor());
      }

      final BookModel model = myReader.Model;
      if (model == null) {
        return;
      }

      // final ZLColor bgColor = getBackgroundColor();
      // TODO: separate color option for footer color
      final ZLColor fgColor = getTextColor(ZLTextHyperlink.NO_LINK);
      final ZLColor fillColor = myViewOptions.getColorProfile().FooterFillOption.getValue();

      final int left = getLeftMargin();
      final int right = context.getWidth() - getRightMargin();
      final int height = getHeight();
      final int lineWidth = height <= 10 ? 1 : 2;
      final int delta = height <= 10 ? 0 : 1;
      setFont(context, height, height > 10);

      final PagePosition pagePosition = FBView.this.pagePosition();

      // draw info text
      final String infoString = buildInfoString(pagePosition, " ");
      final int infoWidth = context.getStringWidth(infoString);
      context.setTextColor(fgColor);
      context.drawString(right - infoWidth, height - delta, infoString);

      // draw gauge
      final int gaugeRight = right - (infoWidth == 0 ? 0 : infoWidth + 10);
      final int gaugeWidth = gaugeRight - left - 2 * lineWidth;

      context.setLineColor(fgColor);
      context.setLineWidth(lineWidth);
      context.drawLine(left, lineWidth, left, height - lineWidth);
      context.drawLine(left, height - lineWidth, gaugeRight, height - lineWidth);
      context.drawLine(gaugeRight, height - lineWidth, gaugeRight, lineWidth);
      context.drawLine(gaugeRight, lineWidth, left, lineWidth);

      final int gaugeInternalRight =
          left + lineWidth + (int) (1.0 * gaugeWidth * pagePosition.Current / pagePosition.Total);

      context.setFillColor(fillColor);
      context.fillRectangle(left + 1, height - 2 * lineWidth, gaugeInternalRight, lineWidth + 1);

      final FooterOptions footerOptions = myViewOptions.getFooterOptions();
      if (footerOptions.ShowTOCMarks.getValue()) {
        updateTOCMarks(model, footerOptions.MaxTOCMarks.getValue());
        final int fullLength = sizeOfFullText();
        for (TOCTree tocItem : myTOCMarks) {
          TOCTree.Reference reference = tocItem.getReference();
          if (reference != null) {
            final int refCoord = sizeOfTextBeforeParagraph(reference.ParagraphIndex);
            final int xCoord =
                left + 2 * lineWidth + (int) (1.0 * gaugeWidth * refCoord / fullLength);
            context.drawLine(xCoord, height - lineWidth, xCoord, lineWidth);
          }
        }
      }
    }