bool TextFormatter::EnsureVisible(CFDC& dc, FilePos pos)
{
    if (pos >= m_top && pos < m_bot)
        return false;
    FilePos ptop(pos);
    ptop.off = 0;
    if (!FormatFwd(dc, ptop))
        return true;
    while (m_top.para == pos.para && pos >= m_bot)
        if (!FormatFwd(dc))
            break;
    return true;
}
Beispiel #2
0
void DrawTriangle(QPainter *p,pigalePaint *paint)
  {TopologicalGraph G(paint->GCP);
  Prop1<Tpoint> pmin(G.Set(),PROP_POINT_MIN);
  Prop1<Tpoint> pmax(G.Set(),PROP_POINT_MAX);
  Prop<Tpoint> pleft(G.Set(tvertex()),PROP_DRAW_POINT_1);
  Prop<Tpoint> pright(G.Set(tvertex()),PROP_DRAW_POINT_2);
  Prop<Tpoint> ptop(G.Set(tvertex()),PROP_DRAW_POINT_3);
  Prop<short> vcolor(G.Set(tvertex()),PROP_COLOR);

  p->setFont(QFont("sans",Min((int)(Min(paint->xscale,paint->yscale) + .5),13)));
  for(tvertex iv = 1; iv <= G.nv();iv++)
      {paint->DrawTriangle(p,pleft[iv],pright[iv],ptop[iv],vcolor[iv]);
      Tpoint center = (pleft[iv]+pright[iv]+ptop[iv])/3.;
      paint->DrawText(p,center,iv,vcolor[iv],1);
      }

  }
int main ()
{


	int x = 4;
	int arr [2]={1,3};
	int arr2 [2][2] = { {3,4},{3,4}};
	int *p4 = &x;
	void *p5 = &x;
	
	int * p1 = &x;
	int temp;
	int * const p = &x;

	ptop();

	fun_array(arr);
	printf("the arr after calling fun_array is %d\n",arr[0]);

	
	//printf(" print the void pointer %d\n",*(p5)); cannot indirect a void pointer

	fun_arr(&arr[0]);
	printf(" the size of the arr in main fun is %d\n", sizeof(arr));
	fun_arr(arr);
	fun_arr2(arr2);
	printf("the add of p1 is %p\n", &p1);
	printf("the add of x is %p\n",&x);
	printf("the add of mem pointed by p1 or value of p1 is %p\n",p1);

	
	 fun ( p1, &p1);
	 printf("the add of mem pointed by p1 or value of p1 is %p\n",p1);
	 printf("==================\n");

	temp = (*p4)++;
	printf(" the new p4 is %d\n",*p4);

	 getchar();
	return 1;

}