예제 #1
0
파일: list_display.c 프로젝트: meh/screen
static int gl_Display_footer(ListData *ldata)
{
	(void)ldata; /* unused */

	centerline("[Press ctrl-l to refresh; Return to end.]", flayer->l_height - 1);
	return 1;
}
예제 #2
0
파일: www.c 프로젝트: EDAyele/ptunes
/*-----------------------------------------------------------------------------------*/
void
htmlparser_newline(void)
{
  char *wptr;
  
  if(pagey < firsty) {
    ++pagey;
    x = 0;
    return;
  }
  
  if(!loading) {
    return;
  }

  webpageptr += (WWW_CONF_WEBPAGE_WIDTH - x);
  ++y;
  x = 0;
  
  wptr = webpageptr - WWW_CONF_WEBPAGE_WIDTH;
  petsciiconv_topetscii(wptr,
			WWW_CONF_WEBPAGE_WIDTH);
#if WWW_CONF_RENDERSTATE
  if(renderstate & HTMLPARSER_RENDERSTATE_CENTER) {
    centerline(wptr);
  }
#endif /* WWW_CONF_RENDERSTATE */
  
  if(y == WWW_CONF_WEBPAGE_HEIGHT) {
    loading = 0;
    webclient_close();
  }
}
예제 #3
0
파일: ONSCRN.C 프로젝트: kytulendu/CW141
void doonscrn(register unsigned key,unsigned x,unsigned y)
{
    register int j;
    char st[4],invmsg[60];

    key &= 0xff;
    if (!isalpha(key) && !iscntrl(key))
        return;
    key &= 0x1f;
    switch(key) {
    case 'l' - 'a' + 1 :
      itoa(leftmar,st,10);
      framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+39, 6,REVERSEATTR);
      dispstrhgc("µйЌІ°“√µ—йІ°—麀铬Ј’и§Ќ≈—ЅємЈ’иаЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,REVERSEATTR);
      if (getstring(st,58-CENTER_FACTOR,5,3,2,NUMBER)) {
        j = atoi(st);
        if ((j < rightmar) && (j > 0)) {
          leftmar = j;
        }
	else {                                   /* Invalid Left Margin */
	  if (j<1)
	    strcpy(invmsg,"°—麀铬єйЌ¬°«и“ 1 !");
	  else
	    strcpy(invmsg,"°—麀铬Ѕ“°°«и“°—йє¢«“ !");
	  strcat(invmsg," °іїЎиЅгіжаЊ„иЌЈ”І“єµиЌ ...");
          blockmsg(10);
	  dispstrhgc(invmsg,25-CENTER_FACTOR,10,REVERSEATTR);
	  errorsound();
          ebioskey(0);
        }
      }
      break;
    case 'r' -'a' + 1 :
      itoa(rightmar,st,10);
      framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+39, 6, 2);
      dispstrhgc("µйЌІ°“√µ—йІ°—йє¢«“Ј’и§Ќ≈—ЅємЈ’иаЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,2);
      if (getstring(st,58-CENTER_FACTOR,5,3,2,NUMBER)) {
        j = atoi(st);
	if ((j > leftmar) && (j <= MAXRMAR)) {
          rightmar = j;
	} else {            			 /* Invalid Right Margin */
	  if (j<=leftmar)
	    strcpy(invmsg,"°—йє¢«“єйЌ¬°«и“°—麀铬 !");
	  else
	    sprintf(invmsg,"°—йє¢«“ ўІ ЎідЅиа°‘є %d !",MAXRMAR);
	  strcat(invmsg," °іїЎиЅгіжаЊ„иЌЈ”І“єµиЌ ...");
	  blockmsg(10);
	  dispstrhgc(invmsg,25-CENTER_FACTOR,10,REVERSEATTR);
	  errorsound();
          ebioskey(0);
        }
      }
      break;
    case 'i' -'a' + 1:
      itoa(x+1,st,10);
      framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+39, 6, 2);
      dispstrhgc("µйЌІ°“√µ—йІ TAB Ј’и§Ќ≈—ЅємЈ’иаЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,2);
      if (getstring(st,58-CENTER_FACTOR,5,3,2,NUMBER)) {
        j = atoi(st);
        if ((j <= MAXCOL) && (j > 0))
          tab[j - 1]=YES;
      }
      break;
    case 'n' - 'a' + 1 :
      strcpy(st,"ALL");
      framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+39, 6, 2);
      dispstrhgc("µйЌІ°“√≈Ї TAB Ј’и§Ќ≈—ЅємЈ’иаЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,2);
      if (getstring(st,58-CENTER_FACTOR,5,3,2,NUMBER)) {
        if (strcmp(st,"ALL") == 0) {
          for (j=0;j < MAXCOL;++j)
            tab[j] = NO;
        } else {
          j = atoi(st);
          if ((j <= MAXCOL) && (j > 0))
            tab[j - 1] = NO;
        }
      }
      break;
    case 'p' - 'a' + 1 :
      itoa(lineperpage,st,10);
      framebox(25-CENTER_FACTOR, 4, 25-CENTER_FACTOR+41, 6, 2);
      dispstrhgc("µйЌІ°“√µ—йІ®”є«єЇ√√Ј—іµиЌЋєй“аЈи“дЋ√и ?",25-CENTER_FACTOR+4,5,2);
      if (getstring(st,61-CENTER_FACTOR,5,3,2,NUMBER)) {
        if (atoi(st) > 0) {
          lineperpage = atoi(st);
          writepageline();
        }
      }
      break;
    case 'c' - 'a' + 1 :
        centerline(y);
        break;
    case 'x' - 'a' + 1 :
        relmargin = !relmargin;
        relmarstatus();
        break;
    }
    pagecomplete = NO;
    writestatus(x);
}
예제 #4
0
//void GraphEdge::adjust()
void GraphEdge::updateGeometry()
{
    if (!sourceNode_ || !destNode_) return;

    //sourceNode_->adjustSize();
    //destNode_->adjustSize();

    // line from center of sourceNode_ to center of destNode_
    QRectF sSBR (sourceNode_->sceneBoundingRect());
    QRectF dSBR (destNode_->sceneBoundingRect());
    QLineF centerline(sSBR.center(), dSBR.center());

    // set the source and destination points
    if(!sSBR.intersects(dSBR)) {
        QPointF po;
        if(QLineF::BoundedIntersection == centerline.intersect(QLineF(sSBR.topLeft(), sSBR.topRight()), &po)) sourcePoint = po;
        else if(QLineF::BoundedIntersection == centerline.intersect(QLineF(sSBR.bottomRight(), sSBR.topRight()), &po)) sourcePoint = po;
        else if(QLineF::BoundedIntersection == centerline.intersect(QLineF(sSBR.bottomLeft(), sSBR.bottomRight()), &po)) sourcePoint = po;
        else if(QLineF::BoundedIntersection == centerline.intersect(QLineF(sSBR.topLeft(), sSBR.bottomLeft()), &po)) sourcePoint = po;
        if(QLineF::BoundedIntersection == centerline.intersect(QLineF(dSBR.topLeft(), dSBR.topRight()), &po)) destPoint = po;
        else if(QLineF::BoundedIntersection == centerline.intersect(QLineF(dSBR.bottomRight(), dSBR.topRight()), &po)) destPoint = po;
        else if(QLineF::BoundedIntersection == centerline.intersect(QLineF(dSBR.bottomLeft(), dSBR.bottomRight()), &po)) destPoint = po;
        else if(QLineF::BoundedIntersection == centerline.intersect(QLineF(dSBR.topLeft(), dSBR.bottomLeft()), &po)) destPoint = po;
    } else {
        sourcePoint = destPoint = (sSBR.bottomLeft().y() < dSBR.bottomLeft().y()) ? sSBR.bottomLeft() : dSBR.bottomLeft();
    }
    QLineF line(sourcePoint, destPoint);
    // set label centered in the middle of the arrow
    QRectF label (label_->boundingRect());
    label.translate(line.pointAt(0.5));
    if(sourcePoint != destPoint) label.translate(-label.width()/2, -label.height()/2);

    // avoid overlapping
    bool overlapped;
    while(true) {
        overlapped = false;
        Graph *graph = reinterpret_cast<Graph *>(scene());
        if(!graph) break;
        Edges::const_iterator i = graph->edges_.constBegin();
        while (i != graph->edges_.constEnd()) {
            GraphEdge *e = i.value();
            if(e != this && e->label()->geometry().intersects(label)) {
                label.moveTo(label.x(), label.y() + 1 + e->label()->geometry().intersected(label).height());
                overlapped = true;
            }
            ++i;
        }
        // node overlapping
        Nodes::const_iterator j = graph->nodes_.constBegin();
        while (j != graph->nodes_.constEnd()) {
            GraphNode *n = j.value();
            if(n->geometry().intersects(label)) {
                label.moveTo(label.x(), label.y() + 1 + n->geometry().intersected(label).height());
                overlapped = true;
            }
            ++j;
        }

        if(!overlapped) break;
    };

    label_->setGeometry(label);
    labelRect_ = label;

    prepareGeometryChange();


    QGraphicsLayoutItem::updateGeometry();
}