Source code of Windows XP (NT5)
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.

53 lines
1.6 KiB

  1. // height.c
  2. // We have to include a bunch of junk to use the XRC in our hack for
  3. // free input. Because of the is we need tsunamip.h instead of
  4. // tsunami.h
  5. //#include "tsunami.h"
  6. #include "tsunamip.h"
  7. VOID PUBLIC GetBoxinfo(BOXINFO * boxinfo, int iBox, LPGUIDE lpguide, HRC hrc)
  8. {
  9. // Test for free guide.
  10. if (lpguide->cHorzBox == 0) {
  11. XRC *pXRC = (XRC *)hrc;
  12. int realBase, realHeight;
  13. //// No guide, compute a quick hack to guess at what we want.
  14. //// We use the size of the box that was precomputed for us.
  15. //// But we have to figure out where to place it.
  16. // We have to fake up an absolute baseline. First we find the
  17. // base and height of this cell.
  18. realBase = pXRC->ppQueue[iBox]->rect.bottom;
  19. realHeight = realBase - pXRC->ppQueue[iBox]->rect.top;
  20. // Now center the ink in computed box size. E.g. add half the
  21. // difference in heights to the baseline.
  22. boxinfo->baseline = realBase + (lpguide->cyBox - realHeight)/2;
  23. // Everything else can be computed from the numbers we now have.
  24. boxinfo->size = lpguide->cyBox;
  25. boxinfo->xheight = boxinfo->size / 2;
  26. boxinfo->midline = boxinfo->baseline - boxinfo->xheight;
  27. } else {
  28. //
  29. // The size of the writing area is computed first.
  30. //
  31. if (lpguide->cyBase == 0)
  32. boxinfo->size = lpguide->cyBox;
  33. else
  34. boxinfo->size = lpguide->cyBase;
  35. if (lpguide->cyMid == 0)
  36. boxinfo->xheight = boxinfo->size / 2;
  37. else
  38. boxinfo->xheight = lpguide->cyMid;
  39. boxinfo->baseline = boxinfo->size + lpguide->yOrigin + (iBox / lpguide->cHorzBox) * lpguide->cyBox;
  40. boxinfo->midline = boxinfo->baseline - boxinfo->xheight;
  41. }
  42. }