Beispiel #1
0
void Shape2DRing::setDouble(const QString& prop, double value)
{
    if (prop == "xwidth")
    {
      m_xWidth = value;
      refit();
    }
    if (prop == "ywidth")
    {
      m_yWidth = value;
      refit();
    }
}
Beispiel #2
0
 bool VisObj::add_mesh(string file)
 {
     if(!load(file, mani))
         return false;
     refit();
     return true;
 }
Beispiel #3
0
static void handle_configure_request(XConfigureRequestEvent *ev)
{
	WClientWin *cwin;
	XWindowChanges wc;
	
	cwin=find_clientwin(ev->window);
	
	if(cwin==NULL){
		wc.border_width=ev->border_width;
		wc.sibling=None;
		wc.stack_mode=ev->detail;
		wc.x=ev->x;
		wc.y=ev->y;
		wc.width=ev->width;
		wc.height=ev->height;
		XConfigureWindow(wglobal.dpy, ev->window, ev->value_mask, &wc);
		return;
	}

	if((ev->value_mask&(CWWidth|CWHeight|CWBorderWidth))!=0){
		/* Transients will not get resized properly unless the
		 * wanted sizes are first set and later modified to fit
		 */
		if(ev->value_mask&CWWidth)
			cwin->geom.w=ev->width;
		if(ev->value_mask&CWHeight)
			cwin->geom.h=ev->height;
		if(ev->value_mask&CWBorderWidth)
			cwin->orig_bw=ev->border_width;
		refit(cwin, cwin->geom.w, cwin->geom.h);
	}else{
		sendconfig_clientwin(cwin);
	}
}
Beispiel #4
0
 bool VisObj::reload(string _file)
 {
     if(_file != "") file = _file;
     mani.clear();
     if(!load(file, mani))
         return false;
     refit();
     return true;
 }
Beispiel #5
0
void Shape2DRing::setShapeControlPoint(size_t i,const QPointF& pos)
{
  QPointF dp = pos - getShapeControlPoint(i);

  switch(i)
  {
  case 0: m_yWidth -= dp.y(); break;
  case 1: m_yWidth += dp.y(); break;
  case 2: m_xWidth += dp.x(); break;
  case 3: m_xWidth -= dp.x(); break;
  }
  refit();
}
Beispiel #6
0
int main(int argc, char *argv[])
{
  if (argc < 7) {
    cout << "refit [fname] [oname] [tkdbc] [toffs] [tstep] [norb]" << endl;
    exit(1);
  }

  refit(argv[1], argv[2], argv[3],
	atoi(argv[4]), atoi(argv[5]), atoi(argv[6]));
  cout << "Done" << endl;
  exit(0);
  return 0;
}
Beispiel #7
0
  void operator()() {
    /* Set up MPI */
    setup ();

    /* Set up norm */
    compute_l2_norm ();
    
#if USE_PFUNC
    task root_task;
    attribute root_attribute (false /*nested*/, false /*grouped*/);
#endif

    /* Iterate until one of the stopping conditions is triggered */
    int num_selected = 0;
    while (true) {

      /* Create a projector and execute the loop for local result */
      space_type my_space = 
        partitioner_t::create (0, N, mpi_rank, mpi_size);
      Projector projector 
        (&R,&snp_map,&materializer,&filter,block_size,M,N,K);
#if USE_PFUNC
      ProjectReduceType root_project (my_space, projector, *global_taskmgr);
      pfunc::spawn (*global_taskmgr, root_task, root_attribute, root_project);
      pfunc::wait (*global_taskmgr, root_task);
#else
      projector (my_space);
#endif

      /* Reduce globally to get the result */
      edge_type selected = find_global_max (projector.get_result ());
      X.insert (selected);
      add_to_shadow (selected);
      ++num_selected;

      /* Re-estimate the coefficients given the new information */
      refit ();

      /* Compute the residual again */
      residual ();

      /* See if we have reached termination conditions */
      if (MAX_SELECT<num_selected || EPSILON>=fro_norm()) break;
    }

    /* Clean up MPI */
    cleanup ();
  }
Beispiel #8
0
ViewProfile::ViewProfile(QGraphicsScene *scene,
                         int minimumWidth,
                         QWidget *parent) :
  QGraphicsView (scene, parent)
{
  setRenderHint (QPainter::Antialiasing);
  setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
  setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);

  setMinimumHeight (160);
  setMaximumHeight (160);
  setMinimumWidth (minimumWidth);

  createFrame ();
  refit ();
}
Beispiel #9
0
		void Shape2D::setControlPoint(size_t i, const QPointF& pos)
		{
			if (i >= getNControlPoints())
			{
				throw std::range_error("Control point index is out of range");
			}

			if (i < 4)
			{
				m_boundingRect.setVertex(i, pos);
				refit();
			}
			// else ?
			else
				setShapeControlPoint(i - NCommonCP, pos);
			resetBoundingRect();
		}
Beispiel #10
0
  /**
   * Add a single work order to the display. This uses the QUndoCommand text (if it's blank, it uses
   *   the QAction text). If there is no text, this does nothing.
   *
   * @param workOrder The work order to display the history for
   */
  void HistoryTreeWidget::addToHistory(WorkOrder *workOrder) {
    QString data = workOrder->bestText();

    connect(workOrder, SIGNAL(destroyed(QObject *)),
            this, SLOT(removeFromHistory(QObject *)));

    QStringList columnData;
    columnData.append(data);
    columnData.append("");
    columnData.append(workOrder->executionTime().toString());

    QTreeWidgetItem *newItem = new QTreeWidgetItem(columnData);
    newItem->setData(0, Qt::UserRole, qVariantFromValue(workOrder));

    // Do font for save work orders
    if (workOrder->createsCleanState()) {
      QFont saveFont = newItem->font(0);
      saveFont.setBold(true);
      saveFont.setItalic(true);
      newItem->setFont(0, saveFont);
      newItem->setForeground(0, Qt::gray);
    }

    // Do font for progress text
    QFont progressFont = newItem->font(1);
    progressFont.setItalic(true);
    newItem->setFont(1, progressFont);
    newItem->setForeground(1, Qt::gray);

    invisibleRootItem()->addChild(newItem);

    connect(workOrder, SIGNAL(statusChanged(WorkOrder *)),
            this, SLOT(updateStatus(WorkOrder *)));
    connect(workOrder, SIGNAL(creatingProgress(WorkOrder *)),
            this, SLOT(updateProgressWidgets()));
    connect(workOrder, SIGNAL(deletingProgress(WorkOrder *)),
            this, SLOT(updateProgressWidgets()));

    if (workOrder->progressBar()) {
      setItemWidget(newItem, 1, workOrder->progressBar());
    }

    scrollToItem(newItem);
    refit();
  }
Beispiel #11
0
void MainFrame::UpdateUI()
{
	wxMenuBar& menubar( *GetMenuBar() );
	wxMenuItem& pause = *menubar.FindItem( id_sys_pause );
	wxMenuItem& stop  = *menubar.FindItem( id_sys_stop );
	wxMenuItem& send_exit  = *menubar.FindItem( id_sys_send_exit );

	pause.SetText(Emu.IsRunned() ? "Pause\tCtrl + P" : Emu.IsReady() ? "Start\tCtrl + C" : "Resume\tCtrl + C");
	pause.Enable(!Emu.IsStopped());
	stop.Enable(!Emu.IsStopped());
	//send_exit.Enable(false);
	send_exit.Enable(!Emu.IsStopped() && Emu.GetCallbackManager().m_exit_callback.m_callbacks.GetCount());

	m_aui_mgr.Update();

	wxCommandEvent refit( wxEVT_COMMAND_MENU_SELECTED, id_update_dbg );
	GetEventHandler()->AddPendingEvent( refit );
}
Beispiel #12
0
void Shape2D::adjustBoundingRect(double dx1,double dy1,double dx2,double dy2)
{
  double dwidth = dx2 - dx1;
  if (dwidth <= - m_boundingRect.xSpan())
  {
    double mu = m_boundingRect.xSpan() / fabs(dwidth);
    dx1 *= mu;
    dx2 *= mu;
  }
  double dheight = dy2 - dy1;
  if (dheight <= - m_boundingRect.ySpan())
  {
    double mu = m_boundingRect.ySpan() / fabs(dheight);
    dy1 *= mu;
    dy2 *= mu;
  }
  m_boundingRect.adjust( QPointF(dx1,dy1), QPointF(dx2,dy2) );
  refit();
}
Beispiel #13
0
  /**
   * Construct a history tree widget
   *
   * @param project The project to show history for
   * @param parent The Qt-relationship parent
   */
  HistoryTreeWidget::HistoryTreeWidget(Project *project, QWidget *parent) : QTreeWidget(parent) {
    m_project = project;

    QStringList headers;
    headers.append("Operation");
    headers.append("Progress");
    headers.append("Time Executed");

    setHeaderLabels(headers);

    connect(m_project, SIGNAL(workOrderStarting(WorkOrder *)),
            this, SLOT(addToHistory(WorkOrder *)));
    connect(m_project, SIGNAL(projectLoaded(Project *)),
            this, SLOT(showHistory()));
    connect(m_project->undoStack(), SIGNAL(indexChanged(int)),
            this, SLOT(handleUndoIndexChanged(int)));

    showHistory();

    refit();
  }
Beispiel #14
0
 std::pair<BBox3f,BBox3f> BVH4MB::refit(void* geom, Base* node)
 {
   /*! merge bounds of triangles for both time steps */
   if (node->isLeaf()) 
   {
     size_t num; char* tri = node->leaf(num);
     return primTy.update2(tri,num,geom);
   }
   /*! set and propagate merged bounds for both time steps */
   else
   {
     Node* n = node->node();
     if (!n->hasBounds()) {
       for (size_t i=0; i<4; i++) {
         std::pair<BBox3f,BBox3f> bounds = refit(geom,n->child[i]);
         n->set(i,bounds.first,bounds.second);
       }
     }
     BBox3f bounds0 = merge(n->bounds0(0),n->bounds0(1),n->bounds0(2),n->bounds0(3));
     BBox3f bounds1 = merge(n->bounds1(0),n->bounds1(1),n->bounds1(2),n->bounds1(3));
     return std::pair<BBox3f,BBox3f>(bounds0,bounds1);
   }
 }
Beispiel #15
0
void Shape2D::setBoundingRect(const RectF &rect)
{
  m_boundingRect = rect;
  correctBoundingRect();
  refit();
}
Beispiel #16
0
void Shape2D::moveBy(const QPointF& dp)
{
  m_boundingRect.translate( dp );
  refit();
}
Beispiel #17
0
int main(int argc, char **argv)
{
  int player;
  char buf[1000];
  int c;

  if (argc < 2)
    Usage();
  getpath();

  openmem(0);

  player=atoi(argv[1]);
  if ((player == 0) && (*argv[1] != '0')) {
    c = *argv[1];
    if (c >= 'a' && c <= 'z')
      player = c - 'a' + 10;
    else {
      Usage();
    }
  }
  if (player >= MAXPLAYER) {
    printf("MAXPLAYER is set to %d, and you want %d?\n", 
	   MAXPLAYER, player);
    exit(1);
  }

  /* request to free slot? */
  if (argc > 2) {
    if (*argv[2] == 'F') {
      int pid;
      pid = players[player].p_process;
      players[player].p_disconnect = BADVERSION_DENIED;
      usleep(200000); /* guarantee an update will occur */
      if (players[player].p_status == PFREE) exit(0); /* slot free, he went */
      if (pid != players[player].p_process) exit(0); /* pid changed, he went */
      if (players[player].p_process > 1) { /* p_disconnect must have failed */
	if (kill(players[player].p_process, SIGTERM) == 0)
	  exit(0);
      }
      /* if we have no pid_t, or the pid_t was wrong, free slot */
      freeslot(&players[player]);
      exit(0);
    }
  }

  if (players[player].p_status != PALIVE) {
    if(players[player].p_status != POBSERV) {
      printf("Slot is not alive.\n");
      exit(1);
    }
  }

  if (argc > 2)
    switch (*argv[2]) {
    case 'T': { /* change team */
      int team;
	      
      switch (argv[2][1]) {
      case 'f': team = 1; break;
      case 'r': team = 2; break;
      case 'k': team = 4; break;
      case 'o': team = 8; break;
      default:  team = 0;
      }	    
      change_team_quietly(players[player].p_no, team, players[player].p_team);
    }
    break;
    case 'e': /* eject (GHOSTTIME applies in daemon) */
      sprintf(buf, "GOD->ALL  %s has been ejected from the game.", 
	      players[player].p_longname);		    
      players[player].p_whydead=KQUIT;
      players[player].p_explode=10;
      players[player].p_status=3;
      players[player].p_whodead=0;
      amessage(buf, 0, MALL);
      break;
    case 't': /* teleport */
      switch(argv[2][1]) {
      case 'f':
	p_x_y_set(&players[player], planets[0].pl_x, planets[0].pl_y);
	break;
      case 'r':
	p_x_y_set(&players[player], planets[10].pl_x, planets[10].pl_y);
	break;
      case 'k':
	p_x_y_set(&players[player], planets[20].pl_x, planets[20].pl_y);
	break;
      case 'o':
	p_x_y_set(&players[player], planets[30].pl_x, planets[30].pl_y);
	break;
      case 'c':
	p_x_y_set(&players[player], GWIDTH/2, GWIDTH/2);
	break;
      default:
	printf("Valid teleports: frkoc.\n");
	exit(1);
      }
      break;
    case 's': /* ship type change */
      switch (argv[2][1]) {
      case 'a': refit(&players[player], ASSAULT); break;
      case 'b': refit(&players[player], BATTLESHIP); break;
      case 'c': refit(&players[player], CRUISER); break;
      case 'd': refit(&players[player], DESTROYER); break;
      case 'g': refit(&players[player], SGALAXY); break;
      case 's': refit(&players[player], SCOUT); break;
      case 'o': refit(&players[player], STARBASE); break;
      case 'A': refit(&players[player], ATT); break;
      case 'S': 
	getship(&players[player].p_ship, SCOUT);
	players[player].p_ship.s_torpdamage = 1;
	players[player].p_ship.s_torpfuse = 8;
	players[player].p_ship.s_phaserdamage = 1;
	players[player].p_ship.s_plasmadamage = 1;
	players[player].p_ship.s_plasmaspeed = 1;
	players[player].p_ship.s_plasmaturns = 1;
	players[player].p_ship.s_maxshield = 750;
	break;
      default:
	printf("Valid ship types: abcdgsoAS.\n");
	exit(1);
	break;
      }
      players[player].p_damage = 0;
      players[player].p_shield = players[player].p_ship.s_maxshield;
      players[player].p_wtemp = 0;
      players[player].p_etemp = 0;
      players[player].p_fuel = players[player].p_ship.s_maxfuel;
      if (argv[2][1] == 'o') players[player].p_flags |= PFDOCKOK;
      break;
    case 'p':		/* puck? */
      players[player].p_ship.s_tractstr = 1;
      players[player].p_ship.s_torpdamage = -1;
      players[player].p_ship.s_plasmadamage = -1;
      players[player].p_ship.s_phaserdamage = -1;
      players[player].p_hostile = 0;
      players[player].p_swar = 0;
      players[player].p_war = 0;
      players[player].p_team = 0;	/* indep */
      players[player].p_ship.s_type = SCOUT;
      players[player].p_ship.s_mass = 200;
      players[player].p_ship.s_repair = 30000;
      break;
    case 'S':		/* super ship */
      players[player].p_ship.s_maxshield = 750;
      players[player].p_shield = 750;
      players[player].p_ship.s_maxdamage = 750;
      players[player].p_damage = 0;
      players[player].p_ship.s_maxegntemp = 5000;
      players[player].p_etemp = 0;
      break;
    case 'D':		/* demote, but not beyond ensign */
      if(players[player].p_stats.st_rank == 0)
	players[player].p_stats.st_rank++;

      --players[player].p_stats.st_rank;
      break;
    case 'P':		/* promote, but not beyond admiral */
      if( players[player].p_stats.st_rank < (NUMRANKS - 1) ) 
	++players[player].p_stats.st_rank;
      break;
    case 'k':		/* kill increment */
      if (strlen(argv[2]) > 1)
        players[player].p_kills += atoi(argv[2]+1);
      else
        players[player].p_kills += 1.0;
      break;
    case 'a':		/* army increment */
      if (strlen(argv[2]) > 1) 
	players[player].p_armies = atoi(argv[2]+1);
      else 
	players[player].p_armies += 6;
      break;
    case 'C':		/* clock surrender reset */
      teams[players[player].p_team].te_surrender = 6;
      break;
    case 'h':		/* harm */
      players[player].p_shield = 0;
      players[player].p_damage = players[player].p_ship.s_maxdamage/2;
      break;
    case 'H':           /* hack */
      {
      struct player *me = &players[player];
      /* make independent and hostile to only prior team */
      int team = players[player].p_team;
      players[player].p_hostile = team;
      players[player].p_swar = team;
      players[player].p_war = team;
      players[player].p_team = 0;
      sprintf(players[player].p_mapchars, "%c%c", 
	      teamlet[players[player].p_team], shipnos[player]);
      sprintf(players[player].p_longname, "%s (%s)", 
	      players[player].p_name, players[player].p_mapchars);
      /* cripple */
      players[player].p_shield = 0;
      players[player].p_damage = players[player].p_ship.s_maxdamage/2;
      /* raise shields */
      players[player].p_flags |= PFSHIELD;
      players[player].p_flags &= ~(PFBOMB | PFREPAIR | PFBEAMUP | PFBEAMDOWN);
      /* break tractors and decloak */
      me->p_flags &= ~(PFTRACT | PFPRESS);
      me->p_flags &= ~PFCLOAK;
      /* set speed 0 */
      me->p_desspeed = 0;
      bay_release(me);
      me->p_flags &= ~(PFREPAIR | PFBOMB | PFORBIT | PFBEAMUP | PFBEAMDOWN);
      /* make unable to act */
      players[player].p_flags |= PFTWARP;
      /* show as puck */
      players[player].p_ship.s_type = SCOUT;
      }
      break;
    case 'u':           /* raise shields */
      players[player].p_flags |= PFSHIELD;
      players[player].p_flags &= ~(PFBOMB | PFREPAIR | PFBEAMUP | PFBEAMDOWN);
      break;
    case 'd':           /* lower shields */
      players[player].p_flags &= ~(PFSHIELD);
      break;
    case 'R':		/* robot kill? */
      if (players[player].p_flags & PFROBOT) {
	players[player].p_ship.s_type = STARBASE;
	players[player].p_whydead=KPROVIDENCE;
	players[player].p_explode=10;
	players[player].p_status=3;
	players[player].p_whodead=0;
      }
      break;
    case 'L':		/* starbase loss adjust */
#ifdef LTD_STATS
#ifndef LTD_PER_RACE
      players[player].p_stats.ltd[0][LTD_SB].deaths.total--;
#endif
#else
      players[player].p_stats.st_sblosses--;
#endif
      break;
    case 'r':           /* repair ship */
      p_heal(&players[player]);
      break;
    case 'f':		/* flatten kills / armies */
      players[player].p_kills = 0;
      players[player].p_armies = 0;
      break;
    case 'n':		/* toggle carry flag */
      players[player].p_no_pick = !players[player].p_no_pick;
      sprintf(buf, "GOD->%s  %s %s pick up armies",
              team_code(players[player].p_team),
              players[player].p_longname,
              players[player].p_no_pick ?
                  "is no longer able to" : "can once again");
      amessage(buf, players[player].p_team, MTEAM);
      break;
    default:
      Usage();
    }			/* end switch */
  else {
    sprintf(buf, "GOD->ALL  %s was utterly obliterated.", 
	    players[player].p_longname);
    players[player].p_ship.s_type=STARBASE;
    players[player].p_whydead=KPROVIDENCE;
    players[player].p_explode=10;
    players[player].p_status=3;
    players[player].p_whodead=0;
    amessage(buf, 0, MALL);
  }
  return 0;
}
Beispiel #18
0
void FMSampleTextView::resizeEvent ( QResizeEvent * event )
{
	emit refit();
}
Beispiel #19
0
void ViewProfile::resizeEvent(QResizeEvent *event)
{
  refit ();

  QGraphicsView::resizeEvent (event);
}