Exemple #1
0
void drawThickLine(int op)
{
	int b, sx, sy, ex, ey, px, py;
	int c=cur_color;
	int x1=-1,y1=-1,x2=-1,y2=-1;
	setdrawmode(XOR_MODE);
	getmousepos(&b,&sx,&sy);
	set_color(15-c);
	ex = px = sx; ey = py = sy;
    if(b==1)
    hidemouseptr();
	while(b==1)
	{
	getmousepos(&b, &ex, &ey);
	if(px != ex || py != ey)
	{
		thickline(sx, sy, px, py,op);
		thickline(sx, sy, ex, ey,op);
		px = ex; py = ey;
		x1=sx;y1=sy;
		x2=ex;y2=ey;
	}
	}
	set_color(c);
	setdrawmode(COPY_MODE);
	thickline(x1, y1, x2, y2,op);
	showmouseptr();
}
void TableFormat::writeWholeTable(
  std::ostream& out,
  const std::string& header,
  const Array<std::string>& columnNames,
  const Array<TableColumn>& columns
  ) const
{

  /* compute the total width */
  int pgWidth = 0;
  for (Array<TableColumn>::size_type i=0; i<columnNames.size(); i++)
  {
    int cw = defaultColumnWidth();
    if (columnWidths_.size() != 0) cw = columnWidths_[i];
    pgWidth += cw;
  }
  setPageWidth(std::max(pageWidth_, pgWidth));
  
  /* write the header */
  out << thickline() << std::endl;
  out << std::endl;
  int numBlanks = (pageWidth_ - header.length())/2;
  out << blanks(numBlanks) << header << std::endl;
  out << std::endl;

  /* write the column titles */
  for (Array<std::string>::size_type i=0; i<columnNames.size(); i++)
  {
    int cw = defaultColumnWidth();
    if (columnWidths_.size() != 0) cw = columnWidths_[i];

    out << std::left << std::setw(cw) << columnNames[i];
  }
  out << std::endl;

  /* ensure that all columns have the same number of rows */
  int numRows = columns[0].numRows();
  for (Array<TableColumn>::size_type i=1; i<columns.size(); i++)
  {
    TEUCHOS_ASSERT_EQUALITY(columns[i].numRows(), numRows);
  }
  
  /* write the table data */
  for (int i=0; i<numRows; i++)
  {
    if (i % lineInterval_ == 0)
      out << std::left << thinline() << std::endl;   
    writeRow(out, i, columns);
  }
  
  /* write the footer */
  out << thickline() << std::endl;

}
Exemple #3
0
 void thickcross(V2d cen,int s,float wid,CT c) {
   thickline(cen+V2d(s,s),cen-V2d(s,s),c,wid);
   thickline(cen+V2d(-s,s),cen-V2d(-s,s),c,wid);
 }
Exemple #4
0
void	do_page(const month_grid& m, bool left_half, bool right_half)
{
	s_ps->black();
	s_ps->font("Arial", 10);
//	s_ps->rectangle(X0, X0 + WIDTH, Y0, Y0 + HEIGHT);
	set_box(X0, RIGHT, Y0, TOP);
	thinline();
	show_box();

	// Line down the middle.
	vrule(X0 + WIDTH / 2);

	float	column_width = WIDTH / 8;

	// Top row: day names.
	float	top_row_height = 20;

	// Title.
	if (right_half)
	{
		// Right column; title & notes.
		float	x = X0 + WIDTH - column_width;
		vrule(x);
		s_ps->printf(x + 10, s_y1 - 20, m.m_month_name);
		s_ps->printf(x + 10, s_y1 - 40, "%d", m.m_year);
	}
	if (left_half)
	{
		// Mini-title, for double-checking book layout.
		s_ps->printf(X0 + WIDTH / 2 - 90, s_y0 + 3, "%s %d", m.m_month_name, m.m_year);
	}

	for (int i = 0; i < 7; i++)
	{
		if (left_half == false && i < 4) continue;
		if (right_half == false && i >= 4) continue;

		static const char*	day_name[7] = { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" };
		float	x = X0 + column_width * i;
		set_box(x, x + column_width, TOP - top_row_height, TOP);
		s_ps->gray(0.75f);
		fill_box();
		s_ps->black();
		show_box();

		s_ps->font("Arial", 8);
		s_ps->printf(x + 5, TOP - top_row_height + 3, day_name[i]);
	}

	float	row_height = (HEIGHT - top_row_height) / ROWS;

	// Days.
	for (int row = 0; row < ROWS; row++)
	{
		for (int col = 0; col < COLS; col++)
		{
			if (left_half == false && col < 4) continue;
			if (right_half == false && col >= 4) continue;

			int	day_number = m.m_day_number[row][col];
			if (day_number == 0)
			{
				// Not a day.
				continue;
			}

			// Show this day.
			float	x = X0 + column_width * col;
			float	y = Y0 + row_height * (ROWS - 1 - row);
			set_box(x, x + column_width, y, y + row_height);
			thickline();
			show_box();

			// Show lines.
			static const int	LINES = 8;
			float	line_height = row_height / LINES;
			for (int line = 0; line < LINES; line++)
			{
				thinline();
				hrule(y + line_height * line);
			}

			// Show the day number.
			s_ps->printf(s_x1 - 11, s_y0 + 3, "%2d", day_number);
		}
	}
}