Example #1
0
void BlockHystogramShow (BLOCK *pBlock)
{
    char szBuffer [128];
    HystogramAllocateBody ();
    nHystColumns = pBlock -> nHystColumns;
    nHystColumnWidth = 1;
    memcpy (pHystogram,
            pBlock -> pHystogram,
            nHystColumns * sizeof (int));
    sprintf (szBuffer, "Block %d", pBlock -> nNumber);
    LT_GraphicsHystogramOutput (szBuffer);
    HystogramFreeData ();
}
Example #2
0
void BlocksBreak (void)
{
    BLOCK *p;
    int i;
    int nRootsInNotBreakedBlocks;

    if (!HystogramAllocateBody ())
        return;

    nRootsInNotBreakedBlocks = 0;
 AGAIN:
# ifdef LT_DEBUG
    //if (LT_DebugGraphicsLevel >= 4)
	if(!LDPUMA_Skip(hBlocksBreaking))
        LT_GraphicsBlocksOutput ("Blocks while breaking: again");
# endif
    for (p = pBlocksList; p != NULL; p = p -> pNext)
    {
        if (p -> uFlags & BF_NOT_BREAK_BLOCK)
			continue;

        for (i = 0; i < nSeps; i++)
        {
            switch (pSeps [i].Type)
            {
                default:
                    break;

                case SEP_VERT:
                    //if (TryCutBlockByVerticalSeparator   (p, i))  goto AGAIN;
					if (TryCutBlockByVerticalSeparator   (p, i, TRUE))
						goto AGAIN;
                    break;

                case SEP_HORZ:
                    if (TryCutBlockByHorizontalSeparator (p, i))
						goto AGAIN;
                    break;

                case SEP_RECT:
                    if (TryCutBlockByRectangleSeparator  (p, i))
						goto AGAIN;
                    break;
            }
        }


        //if (TryCutBlockOnVertical (p,0))          goto AGAIN;
		if (TryCutBlockOnVertical (p,0, FALSE))          goto AGAIN;

        if (bOptionSpecialHorizontalCutting &&
            TrySpecialHorizontalCutting (p))    goto AGAIN;

        if (TryCutBlockOnHorizontal (p))        goto AGAIN;

        if (bOptionSmartBreaking &&
            TrySmartBreaking (p))               goto AGAIN;

        if ( bOptionBusinessCardsLayout &&
             TryCutBlockOnVertical (p,1, FALSE))       goto AGAIN;

		// Rom
		//Handle hNotWholeLine = NULL;
		//Handle hHystogramNull = NULL;

		if(LDPUMA_Skip(hNotWholeLine))
		{
			for (i = 0; i < nSeps; i++)
			{
				switch (pSeps [i].Type)
				{
                default:
                    break;

                case SEP_VERT:
					if (TryCutBlockByVerticalSeparator   (p, i, FALSE))
						goto AGAIN;
                    break;

					/*
					case SEP_HORZ:
                    if (TryCutBlockByHorizontalSeparator (p, i))  goto AGAIN;
                    break;
					*/
				}
			}
		}

		/* Rom */
		if(LDPUMA_Skip(hHystogramNull))
		{
			if (TryCutBlockOnVertical (p,0, TRUE))          goto AGAIN;
		}



        p -> uFlags |= BF_NOT_BREAK_BLOCK;
        nRootsInNotBreakedBlocks += p -> nRoots;
        progress_set_percent (nRootsInNotBreakedBlocks * 100 / nRoots);

# ifdef LT_DEBUG
        //if (LT_DebugGraphicsLevel >= 4)
		if(!LDPUMA_Skip(hBlocksBreaking))
            LT_GraphicsBlocksOutput ("Blocks while breaking: set not break");
# endif
    }

    if (bOptionWhiteStripsBreaking)
        WhiteStripsBreaking ();

    HystogramFreeData ();
}