void StringsFill (void) { ROOT *pRoot; int iMax; int i; int y; Bool CorrectHist=FALSE; for (;;) { # ifdef SE_DEBUG if (SE_DebugGraphicsLevel >= 4) BlockHystogramShow (pCurrentBlock); # endif iMax = 0; for (i = 0; i < pCurrentBlock -> nHystColumns; i++) { if (pCurrentBlock -> pHystogram [i] > pCurrentBlock -> pHystogram [iMax]) { iMax = i; } } if (pCurrentBlock -> pHystogram [iMax] == 0) break; y = pCurrentBlock -> Rect.yTop + iMax; StringNewDescriptor (); for (CorrectHist=FALSE,pRoot = pCurrentBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext) { if (pRoot -> bType & ROOT_USED) continue; //if (IS_LAYOUT_DUST (*pRoot) || pRoot -> nHeight <= 4) //if (IS_LAYOUT_DUST (*pRoot) && pRoot->nUserNum!=IS_IN_TABLE) if (IS_LAYOUT_DUST (*pRoot)) continue; if (pRoot -> yRow <= y && pRoot -> yRow + pRoot -> nHeight >= y) { StringAddLetter1 (pRoot - pRoots); pRoot -> bType |= ROOT_USED; BlockHystogramDiscountRoot (pCurrentBlock, pRoot); CorrectHist=TRUE; } } if( !CorrectHist ) // Oleg & Pit : зацикливание UPIC31 break; StringCalculateParameters (&String); # ifdef SE_DEBUG if (SE_DebugGraphicsLevel >= 4) LT_GraphicsCurrentStringOutput ("Current string"); # endif StringSortLetters (&String); StringAddToList (); nCurrentFillingRoots += String.nLetters; progress_set_percent (nCurrentFillingRoots * 100 / nRoots); } }
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 (); }
gpointer tag_reader_main (TagReader *self) { while (self->priv->run) { QueueEntry *entry; if (self->priv->p) { if (g_async_queue_length (self->priv->job_queue) == 0) { shell_remove_progress (self->priv->shell, self->priv->p); g_object_unref (self->priv->p); self->priv->p = NULL; self->priv->total = 0; self->priv->done = 0; } else { gchar *new_str = g_strdup_printf ("%d of %d", self->priv->done, self->priv->total); progress_set_text (self->priv->p, new_str); progress_set_percent (self->priv->p, (gdouble) self->priv->done / (gdouble) self->priv->total); g_free (new_str); } } entry = g_async_queue_pop (self->priv->job_queue); if (!entry || !self->priv->run) continue; if (!self->priv->p) { self->priv->p = progress_new ("Importing..."); shell_add_progress (self->priv->shell, self->priv->p); gchar *new_str = g_strdup_printf ("%d of %d", self->priv->done, self->priv->total); progress_set_text (self->priv->p, new_str); progress_set_percent (self->priv->p, (gdouble) self->priv->done / (gdouble) self->priv->total); g_free (new_str); } gboolean has_video; gchar **kvs = tag_reader_get_tags (self, entry->location, &has_video); if (kvs) { if (entry->mtype) { shell_move_to (self->priv->shell, kvs, entry->mtype); } else { if (has_video) { shell_move_to (self->priv->shell, kvs, "Movies"); } else { shell_move_to (self->priv->shell, kvs, "Music"); } } g_strfreev (kvs); kvs = NULL; } if (entry->location) { g_free (entry->location); } if (entry->mtype) { g_free (entry->mtype); } g_free (entry); self->priv->done++; } }