void SearchOptions::deserializeSettings(const QString allOptions)
{
  setMatchEntireString();
  setMatchAsString();
  setCaseSensitive(false);
  setBackwards(false);
  setAllColumns(false);
  setWrap(false);
  setIsReplace(false);
  setIsReplaceAll(false);
  QStringList list = allOptions.split(",");
  for (int i=0; i<list.count(); ++i) {
    QString s = list.at(i);
    if (s.compare("MatchEntireString", Qt::CaseInsensitive) == 0) {
      setMatchEntireString();
    } else if (s.compare("Contains", Qt::CaseInsensitive) == 0) {
      setContains();
    } else if (s.compare("StartsWith", Qt::CaseInsensitive) == 0) {
      setStartsWith();
    } else if (s.compare("EndsWith", Qt::CaseInsensitive) == 0) {
      setEndsWith();
    } else if (s.compare("AsString", Qt::CaseInsensitive) == 0) {
      setMatchAsString();
    } else if (s.compare("RegExp", Qt::CaseInsensitive) == 0) {
      setRegularExpression();
    } else if (s.compare("Wildcard", Qt::CaseInsensitive) == 0) {
      setWildCard();
    } else if (s.compare("CaseSensitive", Qt::CaseInsensitive) == 0) {
      setCaseSensitive();
    } else if (s.compare("CaseInSensitive", Qt::CaseInsensitive) == 0) {
      setCaseSensitive(false);
    } else if (s.compare("Wrap", Qt::CaseInsensitive) == 0) {
      setWrap(true);
    } else if (s.compare("NoWrap", Qt::CaseInsensitive) == 0) {
      setWrap(false);
    } else if (s.compare("Backward", Qt::CaseInsensitive) == 0) {
      setBackwards(true);
    } else if (s.compare("Forward", Qt::CaseInsensitive) == 0) {
      setBackwards(false);
    } else if (s.compare("AllColumns", Qt::CaseInsensitive) == 0) {
      setAllColumns(true);
    } else if (s.compare("OneColumn", Qt::CaseInsensitive) == 0) {
      setAllColumns(false);
    } else if (s.compare("Replace", Qt::CaseInsensitive) == 0) {
      setIsReplace(true);
    } else if (s.compare("ReplaceAll", Qt::CaseInsensitive) == 0) {
      setIsReplaceAll(true);
    }
  }
}
Exemple #2
0
gTextArea::gTextArea(gContainer *parent) : gControl(parent)
{
	g_typ = Type_gTextArea;
	_align_normal = false;
	
	have_cursor = true;
	_undo_stack = NULL;
	_redo_stack = NULL;
	_not_undoable_action = 0;
	_undo_in_progress = false;
	
	onChange = 0;
	onCursor = 0;

	textview = gtk_text_view_new();
	realizeScrolledWindow(textview);

	setColorBase();

	//g_signal_connect_after(G_OBJECT(textview), "motion-notify-event", G_CALLBACK(cb_motion_notify_event), (gpointer)this);
	g_signal_connect(G_OBJECT(textview), "key-press-event", G_CALLBACK(cb_keypress), (gpointer)this);
	
	_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
	g_signal_connect_after(G_OBJECT(_buffer), "changed", G_CALLBACK(cb_changed), (gpointer)this);
	g_signal_connect_after(G_OBJECT(_buffer), "mark-set", G_CALLBACK(cb_mark_set), (gpointer)this);
	g_signal_connect(G_OBJECT(_buffer), "insert-text", G_CALLBACK(cb_insert_text), (gpointer)this);
	g_signal_connect(G_OBJECT(_buffer), "delete-range", G_CALLBACK(cb_delete_range), (gpointer)this);

	/*gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview), 2);
	gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview), 2);*/

	setBorder(true);
	setWrap(false);
}
Exemple #3
0
	bool Image::loadVolatileNPOT()
	{
		glGenTextures(1,(GLuint*)&texture);
		bindTexture(texture);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

		glTexImage2D(GL_TEXTURE_2D,
			0,
			GL_RGBA8,
			(GLsizei)width,
			(GLsizei)height,
			0,
			GL_RGBA,
			GL_UNSIGNED_BYTE,
			data->getData());

		setFilter(settings.filter);
		setWrap(settings.wrap);

		return true;
	}
Exemple #4
0
bool Texture::load(const std::string &filePath) {
	//load image
	sf::Image image;
	if (!image.loadFromFile(filePath)) {
		std::cout << "#ERROR " << filePath << " didn't load" << std::endl;
		return false;
	}
	size = vec2i(image.getSize().x,image.getSize().y);
	
	//get handle
	GLuint tex_handle;
	glGenTextures(1, &tex_handle);
	handle = tex_handle;
	
	//bind handle and set to image
	bind();
	glTexImage2D(
				GL_TEXTURE_2D, 0, GL_RGBA,
				image.getSize().x, image.getSize().y,
				0,
				GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr()
				);
	setFilter(GL_NEAREST);
	setWrap(GL_REPEAT);
	return true;
}
 TextBox::TextBox(shared_ptr<Style> style)
 :
 Shape(style),
 fontSize(0),
 wrap(false),
 lineHeight(0),
 lineHeightFactor(0),
 overflowX(false),
 overflowY(false),
 offsetX(0),
 offsetY(0),
 textColor(style->textColor),
 fill(style->fill),
 updateWrapRequest(false),
 updateWidthRequest(false),
 updateHeightRequest(false),
 updateLineHeightRequest(false)
 {
     setFont(style->font);
     setFontSize(style->fontSize);
     setWrap(style->wrap);
     setTextAlign(style->textAlignX, style->textAlignY);
     
     if (style->lineHeight > 0)
     {
         setLineHeight(style->lineHeight);
     }
     else if (style->lineHeightFactor > 0)
     {
         setLineHeightFactor(style->lineHeightFactor);
     }
 }
Exemple #6
0
void Texture::createCubeMapTexture() {
	// Bind the texture
	glBindTexture(GL_TEXTURE_CUBE_MAP, _textureID);

	// Edge wrap mode
	setWrap(GL_TEXTURE_CUBE_MAP, GL_REPEAT, GL_REPEAT);

	// Pixel row alignment
	setAlign();

	// Filter method
	setFilter(GL_TEXTURE_CUBE_MAP);

	// Mip map parameters
	setMipMaps(GL_TEXTURE_CUBE_MAP);

	assert(_image->getLayerCount() == 6);

	static const GLenum faceTarget[6] = {
		GL_TEXTURE_CUBE_MAP_POSITIVE_X,
		GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
		GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
		GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
		GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
		GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
	};

	// Texture image data
	for (size_t i = 0; i < _image->getLayerCount(); i++)
		for (size_t j = 0; j < _image->getMipMapCount(); j++)
			setMipMapData(faceTarget[i], i, j);
}
NoiseTexture2D::NoiseTexture2D( unsigned int pixelSize ) 
{
    _pixelSize = pixelSize;
    _image = new osg::Image();
        
    buildImage();
    
    setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
    setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
    
    setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::MIRROR );
    setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::MIRROR ); 
    
    setBorderWidth( 0 );
    
    setInternalFormat( GL_LUMINANCE32F_ARB );
}
	bool Framebuffer::loadVolatile()
	{
		status = strategy->createFBO(fbo, depthbuffer, img, width, height);
		if (status != GL_FRAMEBUFFER_COMPLETE_OES)
			return false;

		setFilter(settings.filter);
		setWrap(settings.wrap);
		return true;
	}
void gTexture::initialize()
{
    mTexId = 0;
    glGenTextures(1, &mTexId);
	
	mTexSlot = GL_TEXTURE0;
	
    setFilter(GL_LINEAR, GL_LINEAR);
    setWrap(GL_REPEAT, GL_REPEAT);
}
void SearchOptions::setToDefault()
{
  setContains();
  setMatchAsString();
  setCaseSensitive(false);
  setWrap(true);
  setBackwards(false);
  setAllColumns(false);
  m_isReplace = false;
  setIsReplaceAll(false);
}
Exemple #11
0
	bool Canvas::loadVolatile()
	{
		status = strategy->createFBO(fbo, depth_stencil, img, width, height);
		if (status != GL_FRAMEBUFFER_COMPLETE)
			return false;

		setFilter(settings.filter);
		setWrap(settings.wrap);
		Color c;
		c.r = c.g = c.b = c.a = 0;
		clear(c);
		return true;
	}
osg::Camera* createHUD(osg::Image* bgImage)
{
    // create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD
    osg::Camera* camera = new osg::Camera;

    // set the projection matrix
    camera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1.0f, 1.0f, 0));
    // set the view matrix
    camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
    camera->setViewMatrix(osg::Matrix::identity());

    // only clear the depth buffer
    camera->setClearMask(GL_DEPTH_BUFFER_BIT);

    // draw subgraph after main camera view.
    camera->setRenderOrder(osg::Camera::NESTED_RENDER);

    // we don't want the camera to grab event focus from the viewers main camera(s).
    camera->setAllowEventFocus(false);



    // add to this camera a subgraph to render
    {

        osg::Geode* geode = new osg::Geode();

        // turn lighting off for the text and disable depth test to ensure it's always ontop.
        osg::StateSet* stateset = geode->getOrCreateStateSet();
        stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);

        {
            auto texturedQuad = osg::createTexturedQuadGeometry(
                osg::Vec3(0.f, 0.f, 0.f), 
                osg::Vec3(1.0f, 0.f, 0.f),
                osg::Vec3(0.f, 1.0f, 0.f),
                bgImage->s(), 
                bgImage->t());
            auto textureRect = new osg::TextureRectangle(bgImage);
            textureRect->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
            textureRect->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
            textureRect->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
            texturedQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0, textureRect, osg::StateAttribute::ON);
            texturedQuad->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
            geode->addDrawable(texturedQuad);
        }
        camera->addChild(geode);
    }

    return camera;
}
ciMsaFluidSolver& ciMsaFluidSolver::setup(int NX, int NY)
{
	setDeltaT();
	setFadeSpeed();
	setSolverIterations();
	enableVorticityConfinement(false);
	setWrap( false, false );
	
	//maa
	viscocity =  FLUID_DEFAULT_VISC;
	colorDiffusion = FLUID_DEFAULT_COLOR_DIFFUSION;
	
	return setSize( NX, NY);
}
Exemple #14
0
bool Image::loadVolatilePOT()
{
	glGenTextures(1,(GLuint *)&texture);
	bindTexture(texture);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

	float p2width = next_p2(width);
	float p2height = next_p2(height);
	float s = width/p2width;
	float t = height/p2height;

	vertices[1].t = t;
	vertices[2].t = t;
	vertices[2].s = s;
	vertices[3].s = s;

	glTexImage2D(GL_TEXTURE_2D,
				 0,
				 GL_RGBA8,
				 (GLsizei)p2width,
				 (GLsizei)p2height,
				 0,
				 GL_RGBA,
				 GL_UNSIGNED_BYTE,
				 0);

	glTexSubImage2D(GL_TEXTURE_2D,
					0,
					0,
					0,
					(GLsizei)width,
					(GLsizei)height,
					GL_RGBA,
					GL_UNSIGNED_BYTE,
					data->getData());

	setMipmapSharpness(mipmapsharpness);
	setFilter(filter);
	setWrap(wrap);

	return true;
}
void Texture::Create(const void *pixels,bool mipmaps){
	//Alocate space for texture in GPU and return handler
	glGenTextures(1, &m_texture);
	//bind the texture for use
	Bind();
	//Texture wraping
	GLint clamp = m_clamp ? GL_CLAMP_TO_EDGE : GL_REPEAT;
	setWrap(clamp);
	//Texture filtering
	setFiltering(mipmaps ? GL_NEAREST_MIPMAP_LINEAR : m_filter);

	if (mipmaps)
		glTexParameteri(GL_TEXTURE_2D,GL_GENERATE_MIPMAP,GL_TRUE);

	glTexImage2D(GL_TEXTURE_2D, 0, m_iternalFormat, m_width, m_height, 0, m_format, m_type, pixels);
	
}
ofxMSAFluidSolver& ofxMSAFluidSolver::setup(int NX, int NY)
{
	ofLog(OF_LOG_VERBOSE, "ofxMSAFluidSolver::init( " + ofToString(NX) + ", " + ofToString(NY) + " )");
	
	doDensity = true;
	doProject = true;
	
	setDeltaT();
	setFadeSpeed();
	setSolverIterations();
	enableVorticityConfinement(false);
	setWrap( false, false );
	
	//maa
	viscocity =  FLUID_DEFAULT_VISC;
	colorDiffusion = FLUID_DEFAULT_COLOR_DIFFUSION;
	
	return setSize( NX, NY);
}
Exemple #17
0
void Texture::create2DTexture() {
	// Bind the texture
	glBindTexture(GL_TEXTURE_2D, _textureID);

	// Edge wrap mode
	setWrap(GL_TEXTURE_2D, GL_REPEAT, GL_REPEAT);

	// Pixel row alignment
	setAlign();

	// Filter method
	setFilter(GL_TEXTURE_2D);

	// Mip map parameters
	setMipMaps(GL_TEXTURE_2D);

	// Texture image data
	for (size_t i = 0; i < _image->getMipMapCount(); i++)
		setMipMapData(GL_TEXTURE_2D, 0, i);
}
void SearchOptions::setMatchFlags(const Qt::MatchFlags flags)
{
  if ((flags & Qt::MatchWildcard) == Qt::MatchWildcard) {
      setWildCard();
  } else if ((flags & Qt::MatchRegExp) == Qt::MatchRegExp) {
      setRegularExpression();
  } else {
    setMatchAsString();
  }

  if ((flags & Qt::MatchEndsWith) == Qt::MatchEndsWith) {
      setEndsWith();
  } else if ((flags & Qt::MatchStartsWith) == Qt::MatchStartsWith) {
    setStartsWith();
  } else if ((flags & Qt::MatchContains) == Qt::MatchContains) {
    setContains();
  } else {
    setMatchEntireString();
  }

  setCaseSensitive((flags & Qt::MatchCaseSensitive) == Qt::MatchCaseSensitive);
  setWrap((flags & Qt::MatchWrap) == Qt::MatchWrap);
}
EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
    : QObject(0, name )
{
    m_teWid = new TEWidget( parent, "TerminalMain");
	// use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
	// use setWrapAt(80) for normal console with scrollbar
	setWrap(prof.readNumEntry("Wrap", 80) ? 0 : 80);
    m_teWid->setMinimumSize(150, 70 );
    m_script = 0;
    m_log = 0;
    parent->resize( m_teWid->calcSize(80, 24 ) );
    m_teEmu = new TEmuVt102(m_teWid );

    connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ),
            this, SIGNAL(changeSize(int,int) ) );
    connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ),
            this, SLOT(recvEmulation(const char*,int) ) );
    m_teEmu->setConnect( true );
    m_teEmu->setHistory( TRUE );
    load( prof );



}
void Sampler::setWrap(GLint wrap_)
{
    setWrap(wrap_, wrap_, wrap_);
}
osg::Camera* createHUD(osg::Image* bgImage)
{
    // create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD
    osg::Camera* camera = new osg::Camera;

    // set the projection matrix
    camera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1.0f, 1.0f, 0));
    // set the view matrix
    camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
    camera->setViewMatrix(osg::Matrix::identity());

    // only clear the depth buffer
    camera->setClearMask(GL_DEPTH_BUFFER_BIT);

    // draw subgraph after main camera view.
    camera->setRenderOrder(osg::Camera::NESTED_RENDER);

    // we don't want the camera to grab event focus from the viewers main camera(s).
    camera->setAllowEventFocus(false);



    // add to this camera a subgraph to render
    {

        osg::Geode* geode = new osg::Geode();

        // turn lighting off for the text and disable depth test to ensure it's always ontop.
        osg::StateSet* stateset = geode->getOrCreateStateSet();
        stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);

        {
            auto texturedQuad = osg::createTexturedQuadGeometry(
                osg::Vec3(0.f, 0.f, 0.f), 
                osg::Vec3(1.0f, 0.f, 0.f),
                osg::Vec3(0.f, 1.0f, 0.f),
                bgImage->s(), 
                bgImage->t());
            auto textureRect = new osg::TextureRectangle(bgImage);
            textureRect->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
            textureRect->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
            textureRect->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
            texturedQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0, textureRect, osg::StateAttribute::ON);
            texturedQuad->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
            geode->addDrawable(texturedQuad);
        } 


        {/*
            osg::BoundingBox bb;
            for(unsigned int i=0;i<geode->getNumDrawables();++i)
            {
                bb.expandBy(geode->getDrawable(i)->getBoundingBox());
            }

            osg::Geometry* geom = new osg::Geometry;

            osg::Vec3Array* vertices = new osg::Vec3Array;
            float depth = bb.zMin()-0.1;
            vertices->push_back(osg::Vec3(bb.xMin(),bb.yMax(),depth));
            vertices->push_back(osg::Vec3(bb.xMin(),bb.yMin(),depth));
            vertices->push_back(osg::Vec3(bb.xMax(),bb.yMin(),depth));
            vertices->push_back(osg::Vec3(bb.xMax(),bb.yMax(),depth));
            geom->setVertexArray(vertices);

            osg::Vec3Array* normals = new osg::Vec3Array;
            normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
            geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
            
            osg::Vec4Array* colors = new osg::Vec4Array;
            colors->push_back(osg::Vec4(1.0f,1.0,0.8f,0.2f));
            geom->setColorArray(colors, osg::Array::BIND_OVERALL);
            
            geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));

            osg::StateSet* stateset = geom->getOrCreateStateSet();
            stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
            //stateset->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON);
            stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);

            geode->addDrawable(geom);*/
        }

        camera->addChild(geode);
    }

    return camera;
}