FadingNavigationWidget::FadingNavigationWidget(QGraphicsWidget* parent) : QObject()
{
    this->parent = parent;
    parent->installEventFilter(this);
    parent->setAcceptHoverEvents(true);
    initFrame();
}
Beispiel #2
0
void MyTuioServer::send_blobs(std::vector<cBlob>& blobs, std::vector<Area>& areas, cv::Rect& roi){

	currentTime = TuioTime::getSessionTime();
	initFrame(currentTime);

	cBlob *pb;
	Area *pa;
//	printf("Area size: %i\n", areas.size());
	float lx,ly;
	for (int i = 0; i < blobs.size(); i++) {
		pb = &blobs[i];
		pa = &areas[pb->areaid-1];
		switch( pb->event ){
			case BLOB_UP:
				{
					printf("Remove cursor\n");
					//assert( pb->cursor != NULL );
					if( pb->cursor == NULL ) break;
					removeTuioCursor(pb->cursor);
				}
				break;
			case BLOB_DOWN:
				{
					//assert( pb->cursor == NULL );
					localCoords(pb,pa,&roi,&lx,&ly);
					if( pb->cursor == NULL ){
						pb->cursor = addTuioCursor(lx,ly,tuioSessionId(pb));
						printf("Add cursor %i \n", (int)tuioSessionId(pb));
					}else{
						updateTuioCursor(pb->cursor,lx,ly);
					}
				}
				break;
			case BLOB_MOVE:
			default:
				{
					localCoords(pb,pa,&roi,&lx,&ly);
					//assert( pb->cursor != NULL );
					if( pb->cursor == NULL ){
						pb->cursor = addTuioCursor(lx,ly,tuioSessionId(pb));
					}else{
						printf("Move cursor %i to %f %f \n", (int)tuioSessionId(pb),lx,ly );
						updateTuioCursor(pb->cursor,lx,ly);
					}
				}
				break;
		}
	}
	//processEvents();
	stopUntouchedMovingCursors();//?
	commitFrame();

/*
	if (cursor->getTuioTime()==currentTime) return;
	tuioServer->updateTuioCursor(cursor,x,y);
			cursor = tuioServer->addTuioCursor(x,y);
		tuioServer->removeTuioCursor(cursor);
	std::list<TuioCursor*> cursorList = tuioServer->getTuioCursors();
	*/
}
Beispiel #3
0
void Vigasoco::mainLoop()
{
	// start async game logic
	_asyncThread->start();

	// main sync loop
	while (true){
		// call template method to process any platform specific events
		if (!processEvents()){
			// if we've received the quit message, exit

			return;
		}

		// waits if necessary before processing this interrupt
		_timingHandler->waitThisInterrupt();

		bool processVideo = _timingHandler->processVideoThisInterrupt();
		bool processLogic = _timingHandler->processLogicThisInterrupt();

		// if we have to process game logic
		if (processLogic){
			// execute sync game logic
			_driver->runSync();
		}

		// if we have to process video
		if (processVideo){
			// calls template method to notify of the start of a frame
			initFrame();

			// process inputs
			_inputHandler->process();

			// change core state if necessary
			processCoreInputs();

			bool skipVideo = _timingHandler->skipVideoThisInterrupt();

			if (!skipVideo){
				// render game screen
				_driver->render(_drawPlugin);
				_driver->showGameLogic(_drawPlugin);
			}

			showFPS(skipVideo);

			if (!skipVideo){
				// render game screen to our screen
				_drawPlugin->render(_timingHandler->isThrottling());
			}

			// call template method to notify the end of a frame
			endFrame();
		}

		// end this interrupt processing
		_timingHandler->endThisInterrupt();
	}
}
Beispiel #4
0
QT_BEGIN_NAMESPACE

/*!
    \class Q3ProgressBar
    \brief The Q3ProgressBar widget provides a horizontal progress bar.

    \compat

    A progress bar is used to give the user an indication of the
    progress of an operation and to reassure them that the application
    is still running.

    The progress bar uses the concept of \e steps; you give it the
    total number of steps and the number of steps completed so far and
    it will display the percentage of steps that have been completed.
    You can specify the total number of steps in the constructor or
    later with setTotalSteps(). The current number of steps is set
    with setProgress(). The progress bar can be rewound to the
    beginning with reset().

    If the total is given as 0 the progress bar shows a busy indicator
    instead of a percentage of steps. This is useful, for example,
    when using QFtp or QHttp to download items when they are unable to
    determine the size of the item being downloaded.

    \sa QProgressDialog

    \inlineimage qprogbar-m.png Screenshot in Motif style
    \inlineimage qprogbar-w.png Screenshot in Windows style

    \sa QProgressDialog
*/


/*! \obsolete
    Constructs a progress bar.

    The total number of steps is set to 100 by default.

    The \a parent, \a name and widget flags, \a f, are passed on to
    the QFrame::QFrame() constructor.

    \sa setTotalSteps()
*/

Q3ProgressBar::Q3ProgressBar(QWidget *parent, const char *name, Qt::WindowFlags f)
    : QFrame(parent, f),
      total_steps(100),
      progress_val(-1),
      percentage(-1),
      center_indicator(true),
      percentage_visible(true),
      d(0)
{
    setObjectName(QLatin1String(name));
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    initFrame();
}
Beispiel #5
0
void runEmulator(chip8* chip) {

    SDL_Event event;

    initFrame();
    for(;;) {
        runChip(chip);
    }
}
Beispiel #6
0
Frame::Frame(vk::AbstractCamera* cam, const cv::Mat& img, double timestamp) :
    id_(frame_counter_++),
    timestamp_(timestamp),
    cam_(cam),
    key_pts_(5),
    is_keyframe_(false),
    v_kf_(NULL)
{
    initFrame(img);
}
Beispiel #7
0
QProgressBar::QProgressBar( QWidget *parent, const char *name, WFlags f )
    : QFrame( parent, name, f ),
      total_steps( 100 ),
      progress_val( -1 ),
      percentage( -1 ),
      center_indicator( TRUE ),
      auto_indicator( TRUE ),
      d( 0 )
{
    setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
    initFrame();
}
Beispiel #8
0
bool StoreLayer::init()
{
	if (!Layer::init())
	{
		return false;
	}

	initFrame();
	initMenu();
	initTitle();
	return true;
}
Beispiel #9
0
Q3ProgressBar::Q3ProgressBar(int totalSteps, QWidget *parent, Qt::WindowFlags f)
    : QFrame(parent, f),
      total_steps(totalSteps),
      progress_val(-1),
      percentage(-1),
      center_indicator(true),
      percentage_visible(true),
      d(0)
{
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    initFrame();
}
Beispiel #10
0
void
disconnect(int	dst){
	FRAME	frame = initFrame(DL_DISCONNECT, dst, "DISCONNECT");
	size_t	length = sizeof(FRAME);

	CHECK(CNET_write_direct(dst, (FRAME *)&frame, &length));
	#ifdef DEBUG
	printf("sent disconnect frame to the associated AP %d\n", dst);
	#endif

	associated	=	false;
}
DeviceDetailViewFrame::DeviceDetailViewFrame(QWidget* content,QWidget *parent) :
        QWidget(parent),
        m_logoLabel(0),
        m_frameTitleLabel(0),
        m_contentWidget(content),
        m_frameContainer(0)
{
    prepareUi();
    initFrame();
    applyStyle();

}
Beispiel #12
0
/**
* @brief transmit a frame
*
* @param kind
* @param dst
* @param msg
* @param rxsignal
*/
void 
transmit(KIND kind, int dst, char *msg, double rxsignal)
{
	FRAME	frame	=	initFrame(kind, dst, msg);
	size_t	length	=	sizeof(FRAME);
	int		link	=	1;

	frame.rxsignal	=	rxsignal;

	CHECK(CNET_write_physical_reliable(link, (FRAME *)&frame, &length));
	printf("transmitting a %s frame to ap %d\n", msg, dst);
}
QProgressBar::QProgressBar( int totalSteps,
			    QWidget *parent, const char *name, WFlags f )
    : QFrame( parent, name, f | WNoAutoErase ),
      total_steps( totalSteps ),
      progress_val( -1 ),
      percentage( -1 ),
      center_indicator( TRUE ),
      auto_indicator( TRUE ),
      percentage_visible( TRUE ),
      d( 0 )
{
    setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
    initFrame();
}
Beispiel #14
0
gboolean
drawing_area_expose_event_handler(GtkWidget *widget) {
    if (expose == noExpose) {
        expose = firstExpose;
        g_timeout_add(100, (GSourceFunc) drawing_area_redraw_on_allocate,
                widget);
    }
    if (expose == secondExposeOnwards) {
        setFrameAttribute(widget->allocation.width, widget->allocation.height,
                horizontalLines, verticalLines, &startX, &startY, &lineLength,
                &pointRadius);
        if (!frameInitializeFlag) {
            initFrame(horizontalLines, verticalLines, startX, startY, lineLength,
                    head);
            frameInitializeFlag = true;
        } else
            updateFrame(horizontalLines, verticalLines, startX, startY,
                lineLength, head);
        plotFrame(widget, head, horizontalLines, verticalLines, pointRadius);
    }

    return TRUE;
}
Beispiel #15
0
/*!
    \reimp
*/
void Q3ProgressBar::changeEvent(QEvent *ev)
{
    if(ev->type() == QEvent::StyleChange)
        initFrame();
    QFrame::changeEvent(ev);
}
Beispiel #16
0
Frame::Frame(FrameType type, vector<string> parsedLine, vector<int> metadata)
{
    this->type = type;
	this->metadata = metadata;
    initFrame(parsedLine);
}
/*!
    \reimp
*/
void QProgressBar::styleChange( QStyle& old )
{
    initFrame();
    QFrame::styleChange( old );
}
Beispiel #18
0
void ShortAxisFitting::optimize(const alglib::real_1d_array& x, double& func, void* ptr) {
	struct ShortAxisOptimizationInput* input = static_cast<struct ShortAxisOptimizationInput*>(ptr);
	Cmiss_field_module_id field_module = (input->field_module);
	std::vector<Cmiss_node_id>& cmiss_nodes(*(input->cmiss_nodes));
	std::vector<double>& targetDeltas(*(input->targetDeltas));
	Cmiss_field_id coordinate = (input->coordinates_rc);
	Cmiss_field_cache_id cache = (input->cache);
	double* initialSegmentLengths = input->initialSegmentLengths;
	int* saxNodes = input->saxNodes;
	int numberOfModelFrames = input->numberOfModelFrames;
	int NUMBER_OF_SEGMENTS = input->NUMBER_OF_SEGMENTS;
	int NUMBER_OF_SAX_NODES = input->NUMBER_OF_SAX_NODES;
	double** result = input->result; //This is expected to be preallocated for heap efficiency
	int* endoNodeIds = input->endoNodesIds;
	const int NUMBER_OF_ENDO_NODES = 48; //Ignore the apex
	int ctr = 0;
	double coord[3];
	int frame = input->frame;
	std::vector<Point3D>& resetCoord(input->initEndoCoordinates->at(frame));
	std::vector<Point3D>& initFrame(*input->initFrame);

	setThetaDelta(input, x);

	//Compute the theta error
	double thetaError = 0.0;
	//for (int frame = 0; frame < numberOfModelFrames; frame++)
	{
		double time = ((double) frame) / ((double) numberOfModelFrames);
		if (frame == (numberOfModelFrames - 1))
		{
			time = 1.0;
		}
		Cmiss_field_cache_set_time(cache, time);
		std::vector<Point3D> sax;
		Point3D sax_centroid(0, 0, 0);
		for (int seg = 0; seg < NUMBER_OF_SAX_NODES; seg++)
		{
			Cmiss_field_cache_set_node(cache, cmiss_nodes[saxNodes[seg]]);
			Cmiss_field_evaluate_real(coordinate, cache, 3, coord);
			Point3D start(coord);
			sax.push_back(start);
			sax_centroid += start;
		}
		sax_centroid = sax_centroid * (1.0 / NUMBER_OF_SAX_NODES);
		double avg = 0.0;
		for (int seg = 0; seg < NUMBER_OF_SAX_NODES; seg++)
		{
			Vector3D trans = sax[seg] - sax_centroid;
			double denom = trans.x- initFrame[seg].x;
			double nuem  = trans.z- initFrame[seg].z;
			double ltheta = atan2(nuem, denom);
			if(fabs(denom)<1.0e-6 && fabs(nuem)<1.0e-6){
					ltheta = 0.0;
			}
			avg += ltheta;
		}
		avg /=NUMBER_OF_SAX_NODES;
		thetaError +=fabs(avg-targetDeltas[frame]);
		input->thetaError = avg;
	}


	//Compute the segment error
	getSegmentLengths(input);
	double segmentMatchError = input->segmentMatchError;
	func = segmentMatchError + thetaError;
	if(segmentMatchError>2.0)
		func = 1.0e+30;
	input->totalError = func;
	//Reset coordinates to original
	{
		Cmiss_field_module_begin_change(field_module);

		{
			double time = ((double) frame) / ((double) numberOfModelFrames);
			if (frame == (numberOfModelFrames - 1))
			{
				time = 1.0;
			}
			Cmiss_field_cache_set_time(cache, time);
			for (int nc = 0; nc < NUMBER_OF_ENDO_NODES; nc++)
			{
				coord[0] = resetCoord[nc].x;
				coord[1] = resetCoord[nc].y;
				coord[2] = resetCoord[nc].z;
				Cmiss_field_cache_set_node(cache, cmiss_nodes[endoNodeIds[nc] - 1]);
				Cmiss_field_assign_real(coordinate, cache, 3, coord);
			}
		}
		Cmiss_field_module_end_change(field_module);
	}
}
Beispiel #19
0
pupilGui::pupilGui()
{
    initFrame("Left Eye");
    initFrame("Right Eye");
}
Beispiel #20
0
void Input::poll() {
    // Process events
    initFrame();
    sf::Event Event;


    while (App->GetEvent(Event))
    {
        // Close window : exit
        if (Event.Type == sf::Event::Closed)
            inputQuit = true;

        if (ui_event(Event))
            continue;

        if (Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Escape)
            ui_togglePause();

        if (!ui_menuOpen()) {
            if (Event.Type == sf::Event::KeyPressed) {
                if(Event.Key.Code == inputs[INPUT_JUMP].key)
                    inputJump = true;
                if (Event.Key.Code == inputs[INPUT_SHOOT].key)
                    inputShoot = true;
                if (Event.Key.Code == inputs[INPUT_CROUCH].key)
                    inputCrouch = true;
            } else if(Event.Type == sf::Event::JoyButtonPressed
                      && Event.JoyButton.JoystickId == 0) {
                if(Event.JoyButton.Button == 0) {
                    inputShoot = true;
                } else if(Event.JoyButton.Button == 1) {
                    inputJump = true;
                }
            } else if(Event.Type == sf::Event::KeyReleased) {
                if(Event.Key.Code == inputs[INPUT_JUMP].key)
                    inputStopJump = true;
            } else if (Event.Type == sf::Event::JoyButtonReleased
                       && Event.JoyButton.JoystickId == 0) {
                if(Event.JoyButton.Button == 1) {
                    inputStopJump = true;
                }
            }
        }
        /*
        if(Event.Type == sf::Event::JoyButtonPressed) {
        	cout << "Button: " << Event.JoyButton.JoystickId <<
        		": " << Event.JoyButton.Button << "\n";
        }
        */
    }

    if (!ui_menuOpen()) {
        const sf::Input& appInput = App->GetInput();

        if(appInput.IsKeyDown(inputs[INPUT_LEFT].key) && !appInput.IsKeyDown(inputs[INPUT_RIGHT].key)) {
            inputDirection = Facing::Left;
        } else if(appInput.IsKeyDown(inputs[INPUT_RIGHT].key)) {
            inputDirection = Facing::Right;
        }

        float xAxis = appInput.GetJoystickAxis(0, sf::Joy::AxisX);
        float yAxis = appInput.GetJoystickAxis(0, sf::Joy::AxisY);

        if(xAxis > 50)
            inputDirection = Facing::Right;
        else if(xAxis < -50)
            inputDirection = Facing::Left;

        if(yAxis > 50)
            inputCrouch = true;


        if(appInput.IsKeyDown(inputs[INPUT_CROUCH].key)) {
            inputCrouch = true;
        }

        if(appInput.IsJoystickButtonDown(0, 0)) {
            inputShoot = true;
        }

        if(appInput.IsJoystickButtonDown(0, 1)) {
            inputCrouch = true;
        }
    }
}
Beispiel #21
0
Picture::Picture( )
{
	itsSamplesY = itsSamplesCb = itsSamplesCr = itsReconCb = itsReconCr = itsReconY = nullptr;
	initFrame( );
}
Beispiel #22
0
bool QVideoEncoder::createFile(QString fileName,unsigned width,unsigned height,unsigned bitrate,unsigned gop,unsigned fps)
{
   // If we had an open video, close it.
   close();

   Width=width;
   Height=height;
   Gop=gop;
   Bitrate=bitrate;

   if(!isSizeValid())
   {
      printf("Invalid size\n");
      return false;
   }

   pOutputFormat = ffmpeg::av_guess_format(nullptr, fileName.toStdString().c_str(), nullptr);
   if (!pOutputFormat) {
      printf("Could not deduce output format from file extension: using MPEG.\n");
      pOutputFormat = ffmpeg::av_guess_format("mpeg", nullptr, nullptr);
   }

   pFormatCtx=ffmpeg::avformat_alloc_context();
   if(!pFormatCtx)
   {
      printf("Error allocating format context\n");
      return false;
   }
   pFormatCtx->oformat = pOutputFormat;
   snprintf(pFormatCtx->filename, sizeof(pFormatCtx->filename), "%s", fileName.toStdString().c_str());


   // Add the video stream

   pVideoStream = avformat_new_stream(pFormatCtx,0);
   if(!pVideoStream )
   {
      printf("Could not allocate stream\n");
      return false;
   }


   pCodecCtx=pVideoStream->codec;
   pCodecCtx->codec_id = pOutputFormat->video_codec;
   pCodecCtx->codec_type = ffmpeg::AVMEDIA_TYPE_VIDEO;

   pCodecCtx->bit_rate = Bitrate;
   pCodecCtx->width = getWidth();
   pCodecCtx->height = getHeight();
   pCodecCtx->time_base.den = fps;
   pCodecCtx->time_base.num = 1;
   pCodecCtx->gop_size = Gop;
   pCodecCtx->pix_fmt = ffmpeg::PIX_FMT_YUV420P;


   //avcodec_thread_init(pCodecCtx, 10);
   pCodecCtx->thread_count= 10;

   //if (c->codec_id == CODEC_ID_MPEG2VIDEO)
   //{
      //c->max_b_frames = 2;  // just for testing, we also add B frames
   //}

   // some formats want stream headers to be separate
   if(pFormatCtx->oformat->flags & AVFMT_GLOBALHEADER)
      pCodecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;


   av_dump_format(pFormatCtx, 0, fileName.toStdString().c_str(), 1);

   // open_video
   // find the video encoder
   pCodec = avcodec_find_encoder(pCodecCtx->codec_id);
   if (!pCodec)
   {
      printf("codec not found\n");
      return false;
   }
   // open the codec
   if (avcodec_open2(pCodecCtx, pCodec, nullptr) < 0)
   {
      printf("could not open codec\n");
      return false;
   }

   // Allocate memory for output
   if(!initOutputBuf())
   {
      printf("Can't allocate memory for output bitstream\n");
      return false;
   }

   // Allocate the YUV frame
   if(!initFrame())
   {
      printf("Can't init frame\n");
      return false;
   }

   if (avio_open(&pFormatCtx->pb, fileName.toStdString().c_str(), AVIO_FLAG_WRITE) < 0)
   {
      printf( "Could not open '%s'\n", fileName.toStdString().c_str());
      return false;
   }

   avformat_write_header(pFormatCtx, nullptr);



   ok=true;

   return true;
}
Beispiel #23
0
bool QVideoEncoder::open(QString* errorString/*=0*/)
{
	if (m_isOpen)
	{
		//the stream is already opened!
		return false;
	}

	if (!isSizeValid())
	{
		if (errorString)
			*errorString = "Invalid video size";
		return false;
	}

	//Initialize libavcodec, and register all codecs and formats
	av_register_all();

	// find the output format
	avformat_alloc_output_context2(&m_ff->formatContext, NULL, NULL, qPrintable(m_filename));
	if (!m_ff->formatContext)
	{
		if (errorString)
			*errorString = "Could not deduce output format from file extension: using MPEG";
		
		avformat_alloc_output_context2(&m_ff->formatContext, NULL, "mpeg", qPrintable(m_filename));
		if (!m_ff->formatContext)
		{
			if (errorString)
				*errorString = "Codec not found";
			return false;
		}
	}

	// get the codec
	AVCodecID codec_id = m_ff->formatContext->oformat->video_codec;
	//codec_id = AV_CODEC_ID_MPEG1VIDEO;
	//codec_id = AV_CODEC_ID_H264;
	AVCodec *pCodec = avcodec_find_encoder(codec_id);
	if (!pCodec)
	{
		if (errorString)
			*errorString = "Could not load the codec";
		return false;
	}
	m_ff->codecContext = avcodec_alloc_context3(pCodec);

	/* put sample parameters */
	m_ff->codecContext->bit_rate = m_bitrate;
	/* resolution must be a multiple of two */
	m_ff->codecContext->width = m_width;
	m_ff->codecContext->height = m_height;
	/* frames per second */
	m_ff->codecContext->time_base.num = 1;
	m_ff->codecContext->time_base.den = m_fps;
	m_ff->codecContext->gop_size = m_gop;
	m_ff->codecContext->max_b_frames = 1;
	m_ff->codecContext->pix_fmt = AV_PIX_FMT_YUV420P;

	//DGM: doesn't really change anything. We only get different warnings if we enabled this :(
	//m_ff->codecContext->rc_buffer_size = m_bitrate * 2;
	//m_ff->codecContext->rc_max_rate = m_bitrate;

	if (codec_id == AV_CODEC_ID_H264)
	{
		av_opt_set(m_ff->codecContext->priv_data, "preset", "slow", 0);
	}
	else if (codec_id == AV_CODEC_ID_MPEG1VIDEO)
	{
		/* Needed to avoid using macroblocks in which some coeffs overflow.
		* This does not happen with normal video, it just happens here as
		* the motion of the chroma plane does not match the luma plane. */
		m_ff->codecContext->mb_decision = 2;
	}

	//some formats want stream headers to be separate
	if (m_ff->formatContext->oformat->flags & AVFMT_GLOBALHEADER)
	{
		m_ff->codecContext->flags |= CODEC_FLAG_GLOBAL_HEADER;
	}

	// Add the video stream
	m_ff->videoStream = avformat_new_stream(m_ff->formatContext, pCodec);
	if (!m_ff->videoStream )
	{
		if (errorString)
			*errorString = "Failed to allocate the output stream";
		return false;
	}
	m_ff->videoStream->id = m_ff->formatContext->nb_streams-1;
	m_ff->videoStream->codec = m_ff->codecContext;
	m_ff->videoStream->time_base.num = 1;
	m_ff->videoStream->time_base.den = m_fps;

	//av_dump_format(m_ff->formatContext, 0, fileName.toStdString().c_str(), 1);

	// open the codec
	if (avcodec_open2(m_ff->codecContext, pCodec, 0) < 0)
	{
		if (errorString)
			*errorString = "Could not open the codec";
		return false;
	}

	// Allocate the YUV frame
	if (!initFrame())
	{
		if (errorString)
			*errorString = "Could not init the internal frame";
		return false;
	}

	if (avio_open(&m_ff->formatContext->pb, qPrintable(m_filename), AVIO_FLAG_WRITE) < 0)
	{
		if (errorString)
			*errorString = QString("Could not open '%1'").arg(m_filename);
		return false;
	}

	int	err = avformat_write_header(m_ff->formatContext, NULL);
	
	if ( err != 0 )
	{
		if (errorString)
			*errorString = QString("Could not write header for '%1'").arg(m_filename);
		return false;
	}

	m_isOpen = true;

	return true;
}
Beispiel #24
0
Input::Input() {
    initFrame();
}
Beispiel #25
0
void TestWindow::MakeTermSettings()
{
	BView* settings = 0;
	BView* root = 0;
	BWindow* win = 0;
	
	try {
		// Pick some arbitrary initial frame for the window.
		BRect initFrame(0,0,100,100);
		
		// Create our three objects: the settings view, the top-level view
		// in the window, and the window itself.
		settings = GetTermSettings(BMessenger(), BMessage());
		root = new BView(initFrame, "root", B_FOLLOW_ALL, B_WILL_DRAW);
		win = new BWindow(initFrame, "Terminal Settings",
							B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
							B_ASYNCHRONOUS_CONTROLS);
		
		// Set the background color of the root view and add it to the window.
		root->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
		win->AddChild(root);
		
		// Set the size and position of the settings view -- inset a little
		// from the root -- and add it.
		float fw = be_plain_font->StringWidth("W");
		font_height fhs;
		be_plain_font->GetHeight(&fhs);
		float fh = fhs.ascent+fhs.descent+fhs.leading;
		
		settings->MoveTo(fw, fh);
		settings->ResizeTo(initFrame.right-fw*2, initFrame.bottom-fh*2);
		root->AddChild(settings);
		
		win->Run();
		mTermWin = win;
		mTermSet = settings;
		
		if( root ) {
			// Send a message to the view with our current global settings.
			// If the view is an ArpRootView, it will get the message and
			// know what to do with it.
			const BMessage* curGlobs = this->root->Globals()->GlobalValues();
			if( curGlobs ) {
				BMessage globals(*curGlobs);
				globals.what = ARP_PREF_MSG;
				BMessage ret;
				mTermSet.SendMessage(&globals, &ret);
			}
		}
		
		// Get preferred size of settings view, and make final window dimensions
		// from this.
		float width=0, height=0;
		settings->GetPreferredSize(&width, &height);
		width += fw*2;
		height += fh*2;
		
		float minw=0,minh=0,maxw=0,maxh=0;
		win->GetSizeLimits(&minw,&maxw,&minh,&maxh);
		win->SetSizeLimits(width,maxw,height,maxh);
		
		BRect frm = Frame();
		win->ResizeTo(width, height);
		BRect cfrm = Frame();
		win->MoveTo( frm.left
					+ (frm.Width()-cfrm.Width())/2,
				 	frm.top
				 	+ (frm.Height()-cfrm.Height())/2);
		
		win->Show();
		mTermWin = win;
		mTermSet = settings;
	} catch(...) {
		delete settings;
		delete root;
		delete win;
	}
}