コード例 #1
0
JBoolean
CBPTPrinter::EndUserPrintSetup
	(
	const JBroadcaster::Message&	message,
	JBoolean*						changed
	)
{
	assert( itsCBPrintSetupDialog != NULL );

	const JBoolean ok = JXPTPrinter::EndUserPrintSetup(message, changed);
	if (ok)
		{
		*changed = JI2B(*changed ||
			itsCBPrintSetupDialog->ShouldPrintHeader() != itsPrintHeaderFlag);

		itsPrintHeaderFlag = itsCBPrintSetupDialog->ShouldPrintHeader();
		if (GetPageHeight() <= GetHeaderLineCount())
			{
			SetPageHeight(GetHeaderLineCount() + 1);
			*changed = kJTrue;
			}
		}

	itsCBPrintSetupDialog = NULL;
	return ok;
}
コード例 #2
0
void
CBPTPrinter::ReadPrefs
	(
	istream& input
	)
{
	JFileVersion vers;
	input >> vers;
	if (vers == 0)
		{
		JString printCmd;
		JSize pageHeight;
		input >> printCmd >> pageHeight;
		JIgnoreUntil(input, '\1');

		SetPrintCmd(printCmd);
		SetPageHeight(pageHeight);
		}
コード例 #3
0
ファイル: pagecommands.c プロジェクト: ArcScofield/Amaya
/*----------------------------------------------------------------------
   KillAbsBoxAboveLimit tue tous les paves contenus dans le            
   pave pointe' par pP et qui sont au-dessus de la limite. 
  ----------------------------------------------------------------------*/
void KillAbsBoxAboveLimit (PtrAbstractBox pP, int limit, int viewNb,
			   PtrDocument pDoc, PtrAbstractBox *RedispAbsBox)
{
  int               haut, y, NCar;

  pP = pP->AbFirstEnclosed;
  while (pP != NULL)
    {
      /* on ignore les paves deja morts */
      if (!pP->AbDead)
	if (pP->AbElement->ElTypeNumber != PageBreak + 1)
	  /* demande au Mediateur la position et la hauteur du pave */
	  {
	    SetPageHeight (pP, &haut, &y, &NCar);
	    if (y < limit)
	      {
	      /* le haut du pave est au-dessus de la limite */
	      /* on ne tue pas les paves qui contiennent une marque de page */
	      if (y + haut <= limit && !pP->AbOnPageBreak)
		{
		if (pP->AbPresentationBox)
		  /* Tue les paves de presentation */
		  {
		    SetDeadAbsBox (pP);
		    ApplyRefAbsBoxSupp (pP, RedispAbsBox, pDoc);
		  }
		else
		  DestroyAbsBoxesView (pP->AbElement, pDoc, FALSE, viewNb);
		}
	      else
		/* le pave est traverse par la limite */
		KillAbsBoxAboveLimit (pP, limit, viewNb, pDoc, RedispAbsBox);
	      }
	  }
      pP = pP->AbNext;
    }
}
コード例 #4
0
ファイル: toolkit.cpp プロジェクト: UIKit0/verovio
bool Toolkit::ParseOptions( const std::string &json_options ) {
#ifdef USE_EMSCRIPTEN

    jsonxx::Object json;

    // Read JSON options
    if (!json.parse(json_options)) {
        LogError( "Can not parse JSON string." );
        return false;
    }

    if (json.has<jsonxx::String>("inputFormat"))
        SetFormat( json.get<jsonxx::String>("inputFormat") );

    if (json.has<jsonxx::Number>("scale"))
        SetScale( json.get<jsonxx::Number>("scale") );

    if (json.has<jsonxx::Number>("border"))
        SetBorder( json.get<jsonxx::Number>("border") );

    if (json.has<jsonxx::String>("font"))
        SetFont(json.get<jsonxx::String>("font"));

    if (json.has<jsonxx::Number>("pageWidth"))
        SetPageWidth( json.get<jsonxx::Number>("pageWidth") );

    if (json.has<jsonxx::Number>("pageHeight"))
        SetPageHeight( json.get<jsonxx::Number>("pageHeight") );

    if (json.has<jsonxx::Number>("spacingStaff"))
        SetSpacingStaff( json.get<jsonxx::Number>("spacingStaff") );

    if (json.has<jsonxx::Number>("spacingSystem"))
        SetSpacingSystem( json.get<jsonxx::Number>("spacingSystem") );

    if (json.has<jsonxx::String>("rdgXPathQuery"))
        SetRdgXPathQuery( json.get<jsonxx::String>("rdgXPathQuery") );

    // Parse the various flags
    // Note: it seems that there is a bug with jsonxx and emscripten
    // Boolean value false do not parse properly. We have to use Number instead

    if (json.has<jsonxx::Number>("noLayout"))
        SetNoLayout(json.get<jsonxx::Number>("noLayout"));

    if (json.has<jsonxx::Number>("ignoreLayout"))
        SetIgnoreLayout(json.get<jsonxx::Number>("ignoreLayout"));

    if (json.has<jsonxx::Number>("adjustPageHeight"))
        SetAdjustPageHeight(json.get<jsonxx::Number>("adjustPageHeight"));

    if (json.has<jsonxx::Number>("noJustification"))
        SetNoJustification(json.get<jsonxx::Number>("noJustification"));

    if (json.has<jsonxx::Number>("showBoundingBoxes"))
        SetShowBoundingBoxes(json.get<jsonxx::Number>("showBoundingBoxes"));

    return true;

#else
    // The non js version of the app should not use this function.
    return false;
#endif
}
コード例 #5
0
ファイル: pagecommands.c プロジェクト: ArcScofield/Amaya
/*----------------------------------------------------------------------
   KillAbsBoxBeforePage detruit tous les paves qui precedent le filet  
   marquant la frontiere de page qui est a l'interieur du pave Marque
   de Page pointe' par pPage sauf ceux qui appartiennent au BoTable
   englobant pPage.
   Retourne vrai si l'image restante est plus petite qu'une page.
  ----------------------------------------------------------------------*/
ThotBool KillAbsBoxBeforePage (PtrAbstractBox pPage, int frame,
			       PtrDocument pDoc, int viewNb, int *clipOrg)
{
  PtrAbstractBox    pAb, RedispAbsBox, rootAbsBox;
  PtrAbstractBox    pGather, pNext, pPageLine;
  int               h, yTop, NbCar, yRef;
  ThotBool          stop, ret;

  *clipOrg = 0;
  /* is there an enclosing table? */
  pGather = GetEnclosingGather (pPage);
  /* remove page footer boxes (above the page break line) within this page element */
  pAb = pPage->AbFirstEnclosed;
  stop = FALSE;
  do
    if (pAb == NULL)
      stop = TRUE;
    else if (!pAb->AbPresentationBox)
      /* the page break line is not a presentation box, all others are */
      /* presentation boxes */
      {
	stop = TRUE;
	/* get the new page break line position */
	pPageLine = pAb;
	SetPageHeight (pAb, &h, &yRef, &NbCar);
      }
    else
      {
	SetDeadAbsBox (pAb);
	pAb = pAb->AbNext;
      }
  while (!stop);

  /* remove all abstract boxes above the page element or gather element
     that includes the page */
  if (pGather)
    pAb = pGather;
  else
    pAb = pPage;
  while (pAb)
    {
      while (pAb->AbPrevious)
	{
	  pAb = pAb->AbPrevious;
	  /* avoid to kill abstract boxes linked to the current gather */
	  if (pGather == NULL || pGather->AbElement != pAb->AbElement)
	    {
	      if (pAb->AbPresentationBox)
		{
		  /* Kill all presentation abstract boxes */
		  SetDeadAbsBox (pAb);
		  ApplyRefAbsBoxSupp (pAb, &RedispAbsBox, pDoc);
		}
	      else if (!pAb->AbOnPageBreak && !pAb->AbAfterPageBreak)
		DestroyAbsBoxesView (pAb->AbElement, pDoc, FALSE, viewNb);
	      else
		{
		  /* clear previous indicators */
		  pAb->AbOnPageBreak = FALSE;
		  pAb->AbAfterPageBreak = FALSE;
		}
	    }
	  else
	    {
	      /* clear previous indicators */
	      pAb->AbOnPageBreak = FALSE;
	      pAb->AbAfterPageBreak = FALSE;
	    }
	}
      pAb = pAb->AbEnclosing;
      /* set AbOnPageBreak to all enclosing abstract boxes of the page element */
      if (pAb)
	pAb->AbOnPageBreak = TRUE;
    }

  /* check whether abstract boxes after the page element or the gather element
     are displayed above the page break line */
  if (pGather)
    pAb = pGather;
  else
    pAb = pPage;
  while (pAb)
    {
      pNext = pAb->AbNext;
      while (pNext)
	{
	  /* avoid to kill abstract boxes linked to the current gather */
	  if (pGather == NULL || pGather->AbElement != pNext->AbElement)
	    {
	      if (!pNext->AbDead)
		{
		  /* get the new page break line position */
		  SetPageHeight (pNext, &h, &yTop, &NbCar);
		  if (yTop < yRef)
		    {
		      if (yTop + h <= yRef && !pNext->AbOnPageBreak)
			{
			  /* the top of that box is above the page break */
			  if (pNext->AbPresentationBox)
			    {
			      /* Kill all presentation abstract boxes */
			      SetDeadAbsBox (pNext);
			      ApplyRefAbsBoxSupp (pNext, &RedispAbsBox, pDoc);
			    }
			  else
			    DestroyAbsBoxesView (pNext->AbElement, pDoc, FALSE, viewNb);
			}
		      else
			{
			  /* the page break line crosses that box */
			  KillAbsBoxAboveLimit (pNext, yRef, viewNb, pDoc, &RedispAbsBox);
			  /* clear previous indicators */
			  //pNext->AbOnPageBreak = FALSE;
			  pNext->AbAfterPageBreak = FALSE;
			}
		    }
		  else
		    {
		      /* clear previous indicators */
		      pNext->AbOnPageBreak = FALSE;
		      pNext->AbAfterPageBreak = FALSE;
		    }
		}
	    }
	  else
	    {
	      /* clear previous indicators */
	      pNext->AbOnPageBreak = FALSE;
	      pNext->AbAfterPageBreak = FALSE;
	    }
	    
	  pNext = pNext->AbNext;
	}
      pAb = pAb->AbEnclosing;
    }
  /* take killed abstract boxes into account in the Concrete Image */
  RealPageHeight = 0;
  rootAbsBox = ViewFrameTable[frame - 1].FrAbstractBox;
  ret = ChangeConcreteImage (frame, &RealPageHeight, rootAbsBox);
  /* free killed abstract boxes */
  FreeDeadAbstractBoxes (rootAbsBox, frame);
  SetPageHeight (pPage, &h, clipOrg, &NbCar);
  /* compute AbOnPageBreak and AbAfterPageBreak according to the new situation */
  RealPageHeight = PageHeight + *clipOrg;
  ret = ChangeConcreteImage (frame, &RealPageHeight, rootAbsBox);
  return ret;
}