Exemple #1
0
void OutputGLCanvas::_drawTestSignal(QPainter* painter)
{
  const QRect& geo = geometry();
  painter->setPen(MM::CONTROL_COLOR);
  int rect_size = 10;
  QColor color_0(191, 191, 191);
  QColor color_1(128, 128, 128);
  QBrush brush_0(color_0);
  QBrush brush_1(color_1);

  painter->setPen(Qt::NoPen);

  // Draw checkerboard pattern.
  for (int x = geo.x(); x < geo.width(); x += rect_size)
  {
    for (int y = geo.y(); y < geo.height(); y += rect_size)
    {
      if (((x + y) % 20) == 0)
      {
        painter->setBrush(brush_0);
      } else {
        painter->setBrush(brush_1);
      }
      painter->drawRect(x, y, rect_size, rect_size);
    }
  }

  // Draw the actual brush.
  painter->fillRect(geo, this->_brush_test_signal);
}
void Triangulation::color_stripes_3()
{

    unsigned int N = triangles_.size();
    colors_.clear();
    colors_.reserve(N);

    QColor color;
    QColor color_1(55, 215, 55);
    QColor color_2(30, 130, 30);
    integer_coordinates xy;
    unsigned int i;
    for (i=0; i<N; i++)
    {
        xy = tiling_coordinates_[triangles_[i][0]];
        color = ((xy.first + xy.second/2)%2 == 0) ? color_1 : color_2;
        colors_.push_back(color);
    }
    return;
}
void Triangulation::color_stripes_1()
{

    unsigned int N = triangles_.size();
    colors_.clear();
    colors_.reserve(N);

    QColor color;
    QColor color_1(138, 43, 226);
    QColor color_2(51, 204, 255);
    integer_coordinates xy;
    unsigned int i;
    for (i=0; i<N; i++)
    {
        xy = tiling_coordinates_[triangles_[i][0]];
        color = (xy.second%2 == 0) ? color_1 : color_2;
        colors_.push_back(color);
    }
    return;
}
void Triangulation::color_squares_2()
{

    unsigned int N = triangles_.size();
    colors_.clear();
    colors_.reserve(N);

    QColor color;
    QColor color_1(198, 226, 255);
    QColor color_2(67, 110, 238);
    integer_coordinates xy, xy_0, xy_1;
    unsigned int i;
    for (i=0; i<N; i++)
    {
        xy_0 = tiling_coordinates_[triangles_[i][0]];
        xy_1 = tiling_coordinates_[triangles_[i][1]];
        xy = (xy_0.second == xy_1.second) ? xy_1 : xy_0;
        color = ( ((xy.first +3*((xy.second+1)/2))/2 - xy.second/2)%2 == 0 ) ? color_1 : color_2;
        colors_.push_back(color);
    }
    return;
}
void Triangulation::color_stripes_2()
{

    unsigned int N = triangles_.size();
    colors_.clear();
    colors_.reserve(N);

    QColor color;
    QColor color_1(255, 130, 0);
    QColor color_2(255, 210, 10);
    integer_coordinates xy_0, xy_1, xy;
    unsigned int i;
    for (i=0; i<N; i++)
    {
        xy_0 = tiling_coordinates_[triangles_[i][0]];
        xy_1 = tiling_coordinates_[triangles_[i][1]];
        xy = xy_0.second == xy_1.second? xy_1 : xy_0;
        color = ((xy.first + (xy.second+1)/2)%2==0) ? color_1 : color_2;
        colors_.push_back(color);
    }
    return;
}
PopupMenu::PopupMenu(QWidget * parent)
    : Inherited(parent)
{
    QAction * a;
    QMenu * m;
    QActionGroup * g;
    addSeparator();
    a = new QAction(tr("Lock window position"), this);
    a->setCheckable(true);
    addAction(a);
    lock_pos = a;
    a = new QAction(tr("Keep window always on top"), this);
    a->setCheckable(true);
    addAction(a);
    window_ontop = a;
    connect(a, SIGNAL(triggered()), parent, SLOT(menu_ontop()));
    addSeparator();

    m = addMenu("Hours mode");
    g = new QActionGroup(this);
    a = new QAction(tr("12-hours mode (from 1 to 12)"), this);
    a->setCheckable(true);
    g->addAction(a);
    m->addAction(a);
    hours_mode_actions[0] = a;
    connect(a, SIGNAL(triggered()), this, SLOT(hours_mode()));
    a = new QAction(tr("12-hours mode and PM/AM indication"), this);
    a->setCheckable(true);
    g->addAction(a);
    m->addAction(a);
    hours_mode_actions[1] = a;
    connect(a, SIGNAL(triggered()), this, SLOT(hours_mode()));
    a = new QAction(tr("24-hours mode (from 0 to 23)"), this);
    a->setCheckable(true);
    g->addAction(a);
    m->addAction(a);
    hours_mode_actions[2] = a;
    connect(a, SIGNAL(triggered()), this, SLOT(hours_mode()));

    connect(this, SIGNAL(update_hours_mode()), parent, SLOT(menu_hours_mode()));

    m = addMenu("ToolTip");
    a = new QAction(tr("Time"), this);
    a->setCheckable(true);
    m->addAction(a);
    tooltip_time_action = a;
    a = new QAction(tr("Unix time"), this);
    a->setCheckable(true);
    m->addAction(a);
    tooltip_unixtime_action = a;
    m->addSeparator();
    g = new QActionGroup(this);
    a = new QAction(tr("Dec"), this);
    a->setCheckable(true);
    g->addAction(a);
    m->addAction(a);
    tooltip_dec_action = a;
    a = new QAction(tr("Hex"), this);
    a->setCheckable(true);
    g->addAction(a);
    m->addAction(a);
    tooltip_hex_action = a;
    m->addSeparator();
    a = new QAction(tr("Set font"), this);
    m->addAction(a);
    connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_font()));
    a = new QAction(tr("Set text color"), this);
    m->addAction(a);
    connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_fg()));
    a = new QAction(tr("Set background color"), this);
    m->addAction(a);
    connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_bg()));

    addSeparator();
    a = new QAction(tr("Color of \"0\" indicator"), this);
    addAction(a);
    connect(a, SIGNAL(triggered()), this, SLOT(color_0()));
    a = new QAction(tr("Color of \"1\" indicator"), this);
    addAction(a);
    connect(a, SIGNAL(triggered()), this, SLOT(color_1()));
    a = new QAction(tr("Restore original colors"), this);
    addAction(a);
    connect(a, SIGNAL(triggered()), parent, SLOT(menu_oem_colors()));
    addSeparator();
    a = new QAction(tr("Save current settings as default"), this);
    addAction(a);
    connect(a, SIGNAL(triggered()), parent, SLOT(menu_save_setings()));
    addSeparator();
    a = new QAction(tr("About"), this);
    connect(a, SIGNAL(triggered()), parent, SLOT(menu_about()));
    addAction(a);
    a = new QAction(tr("About Qt"), this);
    connect(a, SIGNAL(triggered()), parent, SLOT(menu_about_qt()));
    addAction(a);
    addSeparator();
    a = new QAction(tr("Quit"), this);
    addAction(a);
    connect(a, SIGNAL(triggered()), parent, SIGNAL(menu_quit()));
    connect(this, SIGNAL(set_color(int)), parent, SLOT(menu_color(int)));
}
Exemple #7
0
void network_generator::write_output(){
	for(int k=0;k<channel_layer;k++){
		BasicExcel xls;

		 // create sheet 1 and get the associated BasicExcelWorksheet pointer
		xls.New(1);
		BasicExcelWorksheet* sheet = xls.GetWorksheet(0);

		XLSFormatManager fmt_mgr(xls);


		 // Create a table containing an header row in bold and four rows below.

		ExcelFont font_bold;
		font_bold._weight = FW_BOLD; // 700

		CellFormat fmt_bold(fmt_mgr);
		fmt_bold.set_font(font_bold);

		ExcelFont font_red_bold;
		font_red_bold._weight = FW_BOLD;
		font_red_bold._color_index = EGA_BLACK;
		CellFormat color_1(fmt_mgr, font_red_bold);
		color_1.set_color1(COLOR1_PAT_SOLID);
		color_1.set_color2(MAKE_COLOR2(29,0));
		CellFormat color_2(fmt_mgr, font_red_bold);
		color_2.set_color1(COLOR1_PAT_SOLID);
		color_2.set_color2(MAKE_COLOR2(16,0));
		for (int i=0;i<101;i++){
			for(int j=0;j<101;j++){
				BasicExcelCell* cell = sheet->Cell(i, j);
				
				if(i%2 == 0 && j%2 == 0){
					cell->SetFormat(color_2);
					sheet->Cell(i, j)->Set(-1);
				}
				else{
					cell->SetFormat(color_1);
					sheet->Cell(i, j)->Set(liquid_network[k][i][j]);
				}
			}
		}
		for (int i=0;i<101;i++){
			sheet->SetColWidth(i,950);
		}
		
		char layernum = k+48;
		string test_case_num = "0";
		test_case_num += char(chip.case_num+48);
		string output_name="";
		output_name += "cada030_problemA_testcase";
		output_name += test_case_num;
		if(channel_layer > 1){
			output_name += "_channellayer";
			output_name += layernum;
		}
		output_name += ".xls";
		xls.SaveAs(&output_name[0]);	
	}
	
}