예제 #1
0
/**
 Borra todos los datos de un formulario al cambiar de pagina.
 @param bloc, GtkNotebookPage.
 @param guint, pag contiene el numero de pagina.
 */
void Preferencias::borraDatosForm(GtkNotebookPage* bloc,guint pag)
{
	Gdk::Color col;
	Glib::RefPtr<Gtk::TextBuffer> buf;
	Gtk::TreeModel::iterator it;
	
	col.set_rgb(0,0,0);
	
	clasesG->set_text("");
	nomClasesG->set_text("");
	buf = descripClasesG->get_buffer();
	buf->set_text("");
	//claseLinea.set_active_text("");

	estadosG->set_text("");
	nomEstadosG->set_text("");
	buf = descripEstadosG->get_buffer();
	buf->set_text("");
	colorEstadosG->set_color(col);

	separPuntosGPD->set_value(0);
	numColumnsG->set_value(0);
	numFilasG->set_value(0);

	colorEstadosG->set_sensitive(false);
	claseLinea->set_sensitive(false);
	
	iter = it;
}
예제 #2
0
ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) :
  m_iFilterScale(1),
  m_vFilter2x(NULL),
  m_vFilterIB(NULL),
  m_puiPixels(NULL),
  m_puiDelta(NULL),
  m_iScaledWidth(_iWidth),
  m_iScaledHeight(_iHeight),
  m_bEnableRender(true),
  m_bShowCursor(true)
{
  g_assert(_iWidth >= 1 && _iHeight >= 1 && _iScale >= 1);

  m_iWidth  = _iWidth;
  m_iHeight = _iHeight;
  m_iScale  = _iScale;

  set_events(Gdk::EXPOSURE_MASK
             | Gdk::POINTER_MOTION_MASK
             | Gdk::ENTER_NOTIFY_MASK
             | Gdk::LEAVE_NOTIFY_MASK);

  char aiEmptyData[8];
  memset(aiEmptyData, 0, sizeof(aiEmptyData));
  Glib::RefPtr<Gdk::Bitmap> poSource = Gdk::Bitmap::create(aiEmptyData, 8, 8);
  Glib::RefPtr<Gdk::Bitmap> poMask = Gdk::Bitmap::create(aiEmptyData, 8, 8);
  Gdk::Color oFg;
  Gdk::Color oBg;
  oFg.set_rgb(0, 0, 0);
  oBg.set_rgb(0, 0, 0);

  m_poEmptyCursor = new Gdk::Cursor(poSource, poMask, oFg, oBg, 0, 0);
}
예제 #3
0
VCAExpAudioGUI::VCAExpAudioGUI(const std::string& URI)
{
	EventBox *p_background = manage(new EventBox());
	Gdk::Color* color = new  Gdk::Color();
	color->set_rgb(7710, 8738, 9252);
	p_background->modify_bg(Gtk::STATE_NORMAL, *color);



	VBox *p_mainWidget = manage(new VBox(false, 5));



	Frame *p_gainFrame = manage(new Frame("Gain"));
	//p_gainFrame->set_shadow_type(Gtk::SHADOW_NONE);
	HBox *p_gainBox = manage(new HBox(true));

	slot<void> p_slotGain1 = compose(bind<0>(mem_fun(*this, &VCAExpAudioGUI::write_control), p_gain1), mem_fun(*this,  &VCAExpAudioGUI::get_gain1));
	m_dialGain1 = new LabeledDial("Gain Offset", p_slotGain1, p_gain1, 0, 1, NORMAL, 0.01, 2);
	p_gainBox->pack_start(*m_dialGain1);

	slot<void> p_slotGain2 = compose(bind<0>(mem_fun(*this, &VCAExpAudioGUI::write_control), p_gain2), mem_fun(*this,  &VCAExpAudioGUI::get_gain2));
	m_dialGain2 = new LabeledDial("2nd Gain Boost", p_slotGain2, p_gain2, 0, 1, NORMAL, 0.01, 2);
	p_gainBox->pack_start(*m_dialGain2);

	p_gainFrame->add(*p_gainBox);
	p_mainWidget->pack_start(*p_gainFrame);



	Frame *p_inFrame = manage(new Frame("In"));
	//p_gainFrame->set_shadow_type(Gtk::SHADOW_NONE);
	HBox *p_volumeBox = manage(new HBox(true));

	slot<void> p_slotIn1 = compose(bind<0>(mem_fun(*this, &VCAExpAudioGUI::write_control), p_in1), mem_fun(*this,  &VCAExpAudioGUI::get_in1));
	m_dialIn1 = new LabeledDial("In 1", p_slotIn1, p_in1, 0, 2, NORMAL, 0.01, 2);
	p_volumeBox->pack_start(*m_dialIn1);

	slot<void> p_slotIn2 = compose(bind<0>(mem_fun(*this, &VCAExpAudioGUI::write_control), p_in2), mem_fun(*this,  &VCAExpAudioGUI::get_in2));
	m_dialIn2 = new LabeledDial("In 2", p_slotIn2, p_in2, 0, 2, NORMAL, 0.01, 2);
	p_volumeBox->pack_start(*m_dialIn2);

	p_inFrame->add(*p_volumeBox);
	p_mainWidget->pack_start(*p_inFrame);



	slot<void> p_slotOutputLevel = compose(bind<0>(mem_fun(*this, &VCAExpAudioGUI::write_control), p_outputLevel), mem_fun(*this,  &VCAExpAudioGUI::get_outputLevel));
	m_dialOutputLevel = new LabeledDial("Output Level", p_slotOutputLevel, p_outputLevel, 0, 2, NORMAL, 0.01, 2);
	p_mainWidget->pack_start(*m_dialOutputLevel);



	p_mainWidget->set_size_request(150, 300);

	p_background->add(*p_mainWidget);
	add(*p_background);

	Gtk::manage(p_mainWidget);
}
예제 #4
0
void Gobby::TextTabLabel::update_dots()
{
	if (m_changed_by.empty())
	{
		m_dots.hide();
	}
	else
	{
		Glib::ustring markup;
		for(UserWatcherList::iterator iter = m_changed_by.begin();
		    iter != m_changed_by.end(); ++iter)
		{
			double hue = inf_text_user_get_hue(iter->get_user());

			Gdk::Color c;
			c.set_hsv(360.0 * hue, 0.6, 0.6);

			// We are using the C API here since
			// gdk_color_to_string is available since GTK 2.12,
			// but Gdk::Color::to_string only since gtkmm 2.14,
			// and we want to require nothing more recent than
			// 2.12 for now. See also bug #447.
			gchar* color_str = gdk_color_to_string(c.gobj());
			Glib::ustring cpp_color_str(color_str);
			g_free(color_str);

			markup += "<span color=\"" + cpp_color_str + "\">" +
			          m_dot_char + "</span>";
		}
		m_dots.set_markup(markup);
		m_dots.show();
	}
}
예제 #5
0
void GraphicalItem::setColor(const Gdk::Color& color,
    const Cairo::RefPtr<Cairo::Context>& context)
{
        context->set_source_rgb(color.get_red_p(),
        color.get_green_p(),
        color.get_blue_p());
}
예제 #6
0
/// Converts a k3d::color to a Gdk::Color
const Gdk::Color convert(const k3d::color& RHS)
{
	Gdk::Color result;
	result.set_rgb_p(RHS.red, RHS.green, RHS.blue);

	return result;
}
예제 #7
0
AnalogMemoryGUI::AnalogMemoryGUI(const std::string& URI)
{
	EventBox *p_background = manage (new EventBox());
	Gdk::Color* color = new  Gdk::Color();
	color->set_rgb(7710, 8738, 9252);
	p_background->modify_bg(Gtk::STATE_NORMAL, *color);

	VBox *p_mainWidget = manage(new VBox(false));

	MyBox *p_writeAddressingModeBox = manage (new MyBox("Write Addressing Mode", Gtk::Orientation::ORIENTATION_VERTICAL));

	m_comboWriteAddressForm = manage (new ComboBoxText());
	m_comboWriteAddressForm->append_text("Direct (no fill)");
	m_comboWriteAddressForm->append_text("Linear up only, no fill");
	m_comboWriteAddressForm->append_text("Linear up only, fill");
	m_comboWriteAddressForm->append_text("Linear down only, no fill");
	m_comboWriteAddressForm->append_text("Linear down only, fill");
	m_comboWriteAddressForm->append_text("Reflected");
	m_comboWriteAddressForm->signal_changed().connect(compose(bind<0> (mem_fun(*this, &AnalogMemoryGUI::write_control), p_write_addressing_mode), mem_fun(*m_comboWriteAddressForm, &ComboBoxText::get_active_row_number)));

	p_writeAddressingModeBox->pack_start(*m_comboWriteAddressForm);
	p_mainWidget->pack_start(*p_writeAddressingModeBox);

	p_mainWidget->pack_start(*(m_dialN				= CreateDial("N (for 2^N memory cells)",	p_n,			NORMAL, 1)));
	p_mainWidget->pack_start(*(m_dialWriteThresh	= CreateDial("Write Threshold",				p_write_tresh,	NORMAL, 0.01)));

	p_background->add(*p_mainWidget);

	add(*p_background);

	Gtk::manage(p_background);
}
void ActivityDrawingArea::setSourceRGB(Cairo::RefPtr<Cairo::Context> cr, const Gdk::Color & col) {
	double r = col.get_red_p();
	double g = col.get_green_p();
	double b = col.get_blue_p();
	//std::cout<<"ActivityDrawingArea::setSourceRGB: "<<"("<<r<<","<<g<<","<<b<<")"<<std::endl;

	cr->set_source_rgb(r, g, b);
}
예제 #9
0
void setColorChooserColor(string drawable, OSG::Color3f col) {
    Gdk::Color c;
    c.set_rgb_p(col[0], col[1], col[2]);

    Glib::RefPtr<Gtk::DrawingArea> darea;
    darea = Glib::RefPtr<Gtk::DrawingArea>::cast_static(VRGuiBuilder()->get_object(drawable.c_str()));
    darea->modify_bg(Gtk::STATE_NORMAL, c);
}
예제 #10
0
// Gdk::Color -> 16進数表記の文字列
std::string MISC::color_to_str( const Gdk::Color& color )
{
    // R,G,Bを取得
    int l_rgb[3];
    l_rgb[0] = color.get_red();
    l_rgb[1] = color.get_green();
    l_rgb[2] = color.get_blue();

    return color_to_str( l_rgb );
}
예제 #11
0
Gdk::Color WidgetExpanderBase::getARandColor()
{
  Gdk::Color RandColor;

  RandColor.set_rgb(Glib::Rand().get_int_range(0, 65535),
      Glib::Rand().get_int_range(0, 65535),
      Glib::Rand().get_int_range(0, 65535));

  return RandColor;
}
예제 #12
0
void WidgetExpanderBase::onWidgetExpanderBaseChanged()
{
  Gdk::Color CurrentColor = mp_ColorButton->get_color();

  double CurrentAlpha = mp_OpacityHScale->get_value() / 100;

  int CurrentWidth = mp_WidthSpinButton->get_value();

  m_signal_WidgetExpanderBaseChanged.emit(CurrentWidth,
      CurrentColor.get_red_p(), CurrentColor.get_green_p(),
      CurrentColor.get_blue_p(), CurrentAlpha, mp_ShowIDCheckBox->get_active()/*, mp_CheckButtonGraph->get_active()*/);
}
예제 #13
0
static Gdk::Color
color_darken(Gdk::Color x, float amount)
{
	double   red = x.get_red_p()   * amount;
	double green = x.get_green_p() * amount;
	double  blue = x.get_blue_p()  * amount;

	x.set_rgb_p(  red > 1 ? 1 : red,
				green > 1 ? 1 : green,
				 blue > 1 ? 1 : blue);

	return x;
}
BeatRepeaterMonoGUI::BeatRepeaterMonoGUI(const std::string& URI)
{
    EventBox *p_background = manage (new EventBox());
    Gdk::Color* color = new  Gdk::Color();
    color->set_rgb(7710, 8738, 9252);
    p_background->modify_bg(Gtk::STATE_NORMAL, *color);


    VBox *p_mainWidget = manage (new VBox(false));


    MyBox *p_beatBox = manage (new MyBox("Beat", Gtk::Orientation::ORIENTATION_VERTICAL));
    HBox *p_beatDials = manage(new HBox(false));

    m_dialTempo = new LabeledDial("Tempo", p_tempo, 40, 320, NORMAL, 1, 0);
    m_dialTempo->signal_value_changed().connect(compose(bind<0>(mem_fun(*this, &BeatRepeaterMonoGUI::write_control), p_tempo), mem_fun(*m_dialTempo,  &LabeledDial::get_value)));
    p_beatDials->pack_start(*m_dialTempo, Gtk::PACK_EXPAND_PADDING, 0);

    m_dialBeatSize = new LabeledDial("Beat Size", p_beatSize, 0.0078125, 128, MULTIPLIER, 0.0078125, 7);
    m_dialBeatSize->signal_value_changed().connect(compose(bind<0>(mem_fun(*this, &BeatRepeaterMonoGUI::write_control), p_beatSize), mem_fun(*m_dialBeatSize,  &LabeledDial::get_value)));
    p_beatDials->pack_start(*m_dialBeatSize, Gtk::PACK_EXPAND_PADDING, 0);

    p_beatBox->pack_start(*p_beatDials);

    Alignment* p_align = new Alignment(0.5, 0.5, 0, 0);
    m_checkReverse = manage(new CheckButton("Reverse"));
    m_checkReverse->signal_toggled().connect(compose(bind<0>(mem_fun(*this, &BeatRepeaterMonoGUI::write_control), p_reverse), mem_fun(*m_checkReverse, &CheckButton::get_active)));
    p_align->add(*m_checkReverse);
    p_beatBox->pack_start(*p_align);

    p_mainWidget->pack_start(*p_beatBox);


    MyBox *p_envelopeFrame = manage(new MyBox("Envelope", Gtk::Orientation::ORIENTATION_HORIZONTAL));

    m_dialAttack = new LabeledDial("Attack", p_attack, 3, 25, NORMAL, 1, 0);
    m_dialAttack->signal_value_changed().connect(compose(bind<0>(mem_fun(*this, &BeatRepeaterMonoGUI::write_control), p_attack), mem_fun(*m_dialAttack,  &LabeledDial::get_value)));
    p_envelopeFrame->pack_start(*m_dialAttack);

    m_dialRelease = new LabeledDial("Release", p_release, 3, 25, NORMAL, 1, 0);
    m_dialRelease->signal_value_changed().connect(compose(bind<0>(mem_fun(*this, &BeatRepeaterMonoGUI::write_control), p_release), mem_fun(*m_dialRelease,  &LabeledDial::get_value)));
    p_envelopeFrame->pack_start(*m_dialRelease);

    p_mainWidget->pack_start(*p_envelopeFrame);


    p_background->add(*p_mainWidget);
    add(*p_background);

    Gtk::manage(p_mainWidget);
}
예제 #15
0
LfoTempoGUI::LfoTempoGUI(const std::string& URI)
{
	EventBox *p_background = manage (new EventBox());
	Gdk::Color* color = new  Gdk::Color();
	color->set_rgb(7710, 8738, 9252);
	p_background->modify_bg(Gtk::STATE_NORMAL, *color);

	VBox *p_mainWidget = manage (new VBox(false, 5));

	Label *p_labelWaveForm = manage (new Label("Wave Form"));
	p_mainWidget->pack_start(*p_labelWaveForm);

	m_comboWaveForm = manage (new ComboBoxText());
	m_comboWaveForm->append_text("Sine");
	m_comboWaveForm->append_text("Triangle");
	m_comboWaveForm->append_text("Sawtooth Up");
	m_comboWaveForm->append_text("Sawtooth Down");
	m_comboWaveForm->append_text("Rectangle");
	m_comboWaveForm->append_text("S & H");

	slot<void> p_slotWaveForm = compose(bind<0> (mem_fun(*this, &LfoTempoGUI::write_control), p_waveForm), mem_fun(*m_comboWaveForm, &ComboBoxText::get_active_row_number));
	m_comboWaveForm->signal_changed().connect(p_slotWaveForm);

	p_mainWidget->pack_start(*m_comboWaveForm);

	Frame *p_freqFrame = manage(new Frame("Tempo"));

	HBox *p_freqBox = manage(new HBox(true));

	slot<void> p_slotTempo = compose(bind<0>(mem_fun(*this, &LfoTempoGUI::write_control), p_tempo), mem_fun(*this, &LfoTempoGUI::get_tempo));
	m_dialTempo = new LabeledDial("Tempo", p_slotTempo, p_tempo, 1, 320, NORMAL, 1, 0);
	p_freqBox->pack_start(*m_dialTempo);

	slot<void> p_slotTempoMultiplier = compose(bind<0>(mem_fun(*this, &LfoTempoGUI::write_control), p_tempoMultiplier), mem_fun(*this, &LfoTempoGUI::get_tempoMultiplier));
	m_dialTempoMultiplier = new LabeledDial("Tempo Multiplier", p_slotTempoMultiplier, p_tempoMultiplier, 0.0078125, 32, DIVIDER, 1, 7);
	p_freqBox->pack_start(*m_dialTempoMultiplier);

	p_freqFrame->add(*p_freqBox);
	p_mainWidget->pack_start(*p_freqFrame);

	slot<void> p_slotPhi0 = compose(bind<0> (mem_fun(*this, &LfoTempoGUI::write_control), p_phi0), mem_fun(*this, &LfoTempoGUI::get_phi0));
	m_dialPhi0 = new LabeledDial("Phi0", p_slotPhi0, p_phi0, 0, 6.28, NORMAL, 0.01, 2);
	p_mainWidget->pack_start(*m_dialPhi0);

	p_mainWidget->set_size_request(160, 260);

	p_background->add(*p_mainWidget);
	add(*p_background);

	Gtk::manage(p_mainWidget);
}
예제 #16
0
bool
RedBlueLevelSelector::redraw(GdkEventExpose */*bleh*/)
{
	//!Check if the window we want draw is ready
	Glib::RefPtr<Gdk::Window> window = get_window();
	if(!window) return true;

	const int w(get_width()),h(get_height());

	Gdk::Color color;

	Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(window));

	int i;

	// Draw the gradient
	for(i=0;i<w;i++)
	{
		float red_blue(((float(i)/float(w)+0.5f)-1.0f)/2.0f+1.0f);
		float blue_red(2.0f-(red_blue));
		if(red_blue>1.0f)red_blue=1.0f;
		if(blue_red>1.0f)blue_red=1.0f;

		color.set_rgb(
			round_to_int(min(red_blue,1.0f)*65535),
			round_to_int(sqrt(min(red_blue,blue_red))*65535),
			round_to_int(min(blue_red,1.0f)*65535)
		);

		gc->set_rgb_fg_color(color);
		window->draw_rectangle(gc, true, i, 0, 1, h);
	}

	// Draw a frame
	gc->set_rgb_fg_color(Gdk::Color("#000000"));
	window->draw_rectangle(gc, false, 0, 0, w-1, h-1);

	// Draw the position of the current value
	i=(int)(((level-1.0f)*2.0f+1.0f-0.5f)*w+0.5);
	gc->set_rgb_fg_color(Gdk::Color("#00ff00"));
	window->draw_rectangle(gc, true, i, 1, 1, h-1);

	// Print out the value
	Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_pango_context()));
	layout->set_text(etl::strprintf("%0.02f",level));
	layout->set_alignment(Pango::ALIGN_CENTER);
	gc->set_rgb_fg_color(Gdk::Color("#a00000"));
	window->draw_layout(gc, w/2, 4, layout);

	return true;
}
예제 #17
0
void Widget_ColorEdit::setHVSColor(synfig::Color color)
{
	Gdk::Color gtkColor;
	float r = hvs_gamma.r_F32_to_F32(CLIP_VALUE(color.get_r(),0.0,1.0));
	float g = hvs_gamma.g_F32_to_F32(CLIP_VALUE(color.get_g(),0.0,1.0));
	float b = hvs_gamma.b_F32_to_F32(CLIP_VALUE(color.get_b(),0.0,1.0));
	gtkColor.set_red((unsigned short)(r * USHRT_MAX));
	gtkColor.set_green((unsigned short)(g * USHRT_MAX));
	gtkColor.set_blue((unsigned short)(b * USHRT_MAX));
	colorHVSChanged = true;
	hvsColorWidget->set_previous_color (gtkColor); //We can't use it there, cause color changes in realtime.
	hvsColorWidget->set_current_color (gtkColor);
	colorHVSChanged = false;
}
예제 #18
0
HaasGUI::HaasGUI(const std::string& URI)
{
	EventBox *p_background = manage (new EventBox());
	Gdk::Color* color = new  Gdk::Color();
	color->set_rgb(7710, 8738, 9252);
	p_background->modify_bg(Gtk::STATE_NORMAL, *color);

	HBox *p_mainWidget = manage (new HBox(true));

	p_mainWidget->pack_start(*(m_dialDelay = CreateDial("Delay (ms)", p_delay, NORMAL, 1)));
	p_mainWidget->pack_start(*(m_dialMix = CreateDial("Dry/Wet (%)", p_dry_wet, NORMAL, 1)));

	p_background->add(*p_mainWidget);
	add(*p_background);

	Gtk::manage(p_background);
}
예제 #19
0
RindModulatorCVGUI::RindModulatorCVGUI(const std::string& URI)
{
	EventBox *p_background = manage (new EventBox());
	Gdk::Color* color = new  Gdk::Color();
	color->set_rgb(7710, 8738, 9252);
	p_background->modify_bg(Gtk::STATE_NORMAL, *color);

	slot<void> p_slotGain = compose(bind<0>(mem_fun(*this, &RindModulatorCVGUI::write_control), p_gain), mem_fun(*this,  &RindModulatorCVGUI::get_gain));
	m_dialGain = new LabeledDial("Gain", p_slotGain, p_gain, -10, 10, NORMAL, 0.01, 2);
	p_background->add(*m_dialGain);

	p_background->set_size_request(100, 80);

	add(*p_background);

	Gtk::manage(p_background);
}
예제 #20
0
void
Widget_ColorEdit::on_color_changed()
{ 
	//Spike! Gtk::ColorSelection emits this signal when I use 
	//set_current_color(...). It calls recursion. Used a flag to fix it.
	if (!colorHVSChanged)
	{
		Gdk::Color newColor = hvsColorWidget->get_current_color();
		float r = hvs_gamma_in.r_F32_to_F32((float)newColor.get_red() / USHRT_MAX);
		float g = hvs_gamma_in.g_F32_to_F32((float)newColor.get_green() / USHRT_MAX);
		float b = hvs_gamma_in.b_F32_to_F32((float)newColor.get_blue() / USHRT_MAX);
		const synfig::Color synfigColor(r, g, b);
		set_value(synfigColor);
		colorHVSChanged = true; //I reset the flag in setHVSColor(..)
		on_value_changed();
	}
}
예제 #21
0
/**
 Rellena los datos en el formulario correspondientes a la clase o el estado
 seleccionado por el usuario.
 */
void Preferencias::seleccionaEstado()
{
	Glib::RefPtr<Gtk::TreeSelection> filaSeleccionada;
	Gtk::TreeModel::iterator it;
	string etiquetaClase;
	Glib::RefPtr<Gtk::TextBuffer> buf;
	Gdk::Color col;
	int i;

	iter = it;
	i = 0;
	
	filaSeleccionada = treeviewEstadosG->get_selection();
	
	iter = filaSeleccionada->get_selected();
	
	if(iter)
	{
		int numCopClaseEst = copiaEstadoCelula.size();
		
		Gtk::TreeModel::Row row = *iter;

		etiquetaClase = row[columModel.nomCol];

		while(i < numCopClaseEst && etiquetaClase != copiaEstadoCelula[i].getEtiquetaClasificacion())
		{
			i++;
		}	
			
		if(etiquetaClase == copiaEstadoCelula[i].getEtiquetaClasificacion())
		{
			col.set_rgb(copiaEstadoCelula[i].getColorEstadoR(),
									  copiaEstadoCelula[i].getColorEstadoG(),
									  copiaEstadoCelula[i].getColorEstadoB());
			indiceClassEstado = i;

			estadosG->set_text(copiaEstadoCelula[i].getEtiquetaClasificacion());
			nomEstadosG->set_text(copiaEstadoCelula[i].getNombreClasificacion());
			buf = descripEstadosG->get_buffer();
			buf->set_text(copiaEstadoCelula[i].getDescripcionClasificacion());
			colorEstadosG->set_sensitive(true);
			colorEstadosG->set_color(col);
		}
	}
}
예제 #22
0
    static std::string convert(const Gdk::Color& color)
    {
        std::string str = color.to_string();
        if (not str.empty()) {
            str.assign(str, 1, std::string::npos);
        }

        return str;
    }
예제 #23
0
파일: settings.cpp 프로젝트: Tyndi/3dprint
void Settings::get_colour_from_gui (Builder &builder, int i)
{
  const char *glade_name = colour_selectors[i].glade_name;
  vmml::Vector4f *dest =
      (vmml::Vector4f *)PTR_OFFSET(this, colour_selectors[i].member_offset);
  Gdk::Color c;
  Gtk::ColorButton *w = NULL;
  builder->get_widget (glade_name, w);
  if (!w) return;

  c = w->get_color();
  dest->r = c.get_red_p();
  dest->g = c.get_green_p();
  dest->b = c.get_blue_p();
  dest->a = (float) (w->get_alpha()) / 65535.0;

  m_signal_visual_settings_changed.emit();
}
예제 #24
0
bool
BlackLevelSelector::redraw(GdkEventExpose */*bleh*/)
{
	//!Check if the window we want draw is ready
	Glib::RefPtr<Gdk::Window> window = get_window();
	if(!window) return true;

	const int w(get_width()),h(get_height());

	Gdk::Color color;

	Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(window));

	int i;

	// Draw the gradient
	for(i=0;i<w;i++)
	{
		color.set_rgb(i*65536/w,i*65536/w,i*65536/w);

		gc->set_rgb_fg_color(color);
		window->draw_rectangle(gc, true, i, 0, 1, h);
	}

	// Draw a frame
	gc->set_rgb_fg_color(Gdk::Color("#000000"));
	window->draw_rectangle(gc, false, 0, 0, w-1, h-1);

	// Draw the position of the current value
	i=(int)(level*w+0.5);
	gc->set_rgb_fg_color(Gdk::Color("#ff0000"));
	window->draw_rectangle(gc, true, i, 1, 1, h-1);

	// Print out the value
	Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_pango_context()));
	layout->set_text(etl::strprintf("%0.01f%%",level*100.0f));
	layout->set_alignment(Pango::ALIGN_CENTER);
	gc->set_rgb_fg_color(Gdk::Color("#a00000"));
	window->draw_layout(gc, w/2, 4, layout);

	return true;
}
예제 #25
0
void
DoTextWidget()
{
    InitGtkmm();

    Gtk::Window win;
    TextWidget t_wdg;

    Gdk::Color white;
    white.set_rgb(0x0, 0x0, 0xffff);

    win.set_title("TextWidget");

    t_wdg.modify_bg(Gtk::STATE_NORMAL, white);

    win.set_default_size(300, 300);
    win.add(t_wdg);

    RunWindow(win);
}
예제 #26
0
  void 
  RLight::guiUpdate()
  {
    try { _intensity = boost::lexical_cast<float>(_intensityEntry->get_text()); } catch (...) {}
    try { _attenuation = boost::lexical_cast<float>(_attenuationEntry->get_text()); } catch (...) {}
    try { _specularExponent = boost::lexical_cast<float>(_specularExponentEntry->get_text()); } catch (...) {}
    try { _specularFactor = boost::lexical_cast<float>(_specularFactorEntry->get_text()); } catch (...) {}

    Gdk::Color color = _lightColor->get_color();
    _color[0] = GLfloat(color.get_red()) / G_MAXUSHORT;
    _color[1] = GLfloat(color.get_green()) / G_MAXUSHORT;
    _color[2] = GLfloat(color.get_blue()) / G_MAXUSHORT;

    try {
      magnet::math::Vector vec;
      vec[0] = boost::lexical_cast<float>(_positionXEntry->get_text());
      vec[1] = boost::lexical_cast<float>(_positionYEntry->get_text());
      vec[2] = boost::lexical_cast<float>(_positionZEntry->get_text());
      setEyeLocationObjSpace(vec);
    } catch (...) {}
  }
예제 #27
0
/*
 ==================================
 AdvancedOptionsWindow::on_backgroundcolor_changed

 Sets the background colour for profile and the overview.
 ==================================
 */
void AdvancedOptionsWindow::on_backgroundcolor_changed()
{
   Gdk::Color c = backgroundcolorbutton->get_color();
   float red = (float) c.get_red() / 65535.0;
   float green = (float) c.get_green() / 65535.0;
   float blue = (float) c.get_blue() / 65535.0;
   float alpha = (float) backgroundcolorbutton->get_alpha() / 65535.0;
   tdo->set_background_colour(red, green, blue, alpha);
   prof->set_background_colour(red, green, blue, alpha);
   
   if(tdo->get_realized())
   {
      tdo->update_background_colour();
      tdo->drawviewable(1);
   }
   if(prof->get_realized())
   {
      prof->update_background_colour();
      prof->drawviewable(1);
   }
}
예제 #28
0
HysteresisGUI::HysteresisGUI(const std::string& URI)
{
	EventBox *p_background = manage (new EventBox());
	Gdk::Color* color = new  Gdk::Color();
	color->set_rgb(7710, 8738, 9252);
	p_background->modify_bg(Gtk::STATE_NORMAL, *color);

	VBox *p_mainWidget = manage (new VBox(false));

	p_mainWidget->pack_start(*(m_dialCenter		= CreateDial("Center",		p_center,		NORMAL, 0.01)));
	p_mainWidget->pack_start(*(m_dialOverlap	= CreateDial("Overlap",		p_overlap,		NORMAL, 0.01)));

	p_mainWidget->pack_start(*(m_dialLowSlope	= CreateDial("Low Slope",	p_lowSlope,		NORMAL, 0.01)));
	//p_mainWidget->pack_start(*(m_dialLowOffset	= CreateDial("Low Offset",	p_lowOffset,	NORMAL, 0.01)));

	p_mainWidget->pack_start(*(m_dialHighSlope	= CreateDial("High Slope",	p_highSlope,	NORMAL, 0.01)));
	//p_mainWidget->pack_start(*(m_dialHighOffset	= CreateDial("High Offset", p_highOffset,	NORMAL, 0.01)));

	p_background->add(*p_mainWidget);
	add(*p_background);

	Gtk::manage(p_mainWidget);
}
void ConnectionActivityDrawingArea::drawBar(const double x, const double y, const int overlay_count,
		const Gdk::Color & colour) {
	Glib::RefPtr < Gdk::Window > window = get_window();
	Cairo::RefPtr < Cairo::Context > cr = window->create_cairo_context();
	cr->save();
	Gtk::Allocation allocation = get_allocation();
	const int width = allocation.get_width();
	const int height = allocation.get_height();

	cr->set_line_width(2.0);
	//  std::cout<<"ActivityDrawingArea::drawPoints: colour: "<<"("<<main_colour[0]<<","<<main_colour[1]<<","<< main_colour[2] <<std::endl;
	double r = colour.get_red_p();
	double g = colour.get_green_p();
	double b = colour.get_blue_p();
	double step = 0.1;
	//std::cout<<"ActivityDrawingArea::setSourceRGB: "<<"("<<r<<","<<g<<","<<b<<")"<<std::endl;
	for (int i = overlay_count; i > 0; i--) {
		if (r < 1) {
			r += step;
		} else if (g < 1) {
			g += step;
		} else if (b < 1) {
			b += step;
		}
	}
	cr->set_source_rgb(r, g, b);

	double scalex = width / connection->getActivityTimer()->getStartingDelay();

	//scale the drawing in x and y
	cr->move_to(x * scalex, height / 2);
	cr->line_to(x * scalex, y);
	//std::cout << "ConnectionActivityDrawingArea::drawBar: " << "(" << x * scalex << ", " << height / 2 << ")"
	//		<< std::endl;
	cr->stroke();
	cr->restore();
}
예제 #30
0
Noise2CVGUI::Noise2CVGUI(const std::string& URI)
{
	EventBox *p_background = manage (new EventBox());
	Gdk::Color* color = new  Gdk::Color();
	color->set_rgb(7710, 8738, 9252);
	p_background->modify_bg(Gtk::STATE_NORMAL, *color);

	VBox *p_mainWidget = manage (new VBox(false, 5));

	Label *p_labelWaveForm = manage (new Label("Noise Type"));
	p_mainWidget->pack_start(*p_labelWaveForm);

	m_comboNoiseForm = manage (new ComboBoxText());
	m_comboNoiseForm->append_text("White");
	m_comboNoiseForm->append_text("Random");
	m_comboNoiseForm->append_text("Pink");

	slot<void> p_slotNoiseForm = compose(bind<0> (mem_fun(*this, &Noise2CVGUI::write_control), p_noiseType), mem_fun(*m_comboNoiseForm, &ComboBoxText::get_active_row_number));
	m_comboNoiseForm->signal_changed().connect(p_slotNoiseForm);

	p_mainWidget->pack_start(*m_comboNoiseForm);

	slot<void> p_slotRandomRate = compose(bind<0>(mem_fun(*this, &Noise2CVGUI::write_control), p_rate), mem_fun(*this,  &Noise2CVGUI::get_randomRate));
	m_dialRandomRate = new LabeledDial("Random Rate", p_slotRandomRate, p_rate, 0, 10, NORMAL, 0.01, 2);
	p_mainWidget->pack_start(*m_dialRandomRate);

	slot<void> p_slotRandomLevel = compose(bind<0>(mem_fun(*this, &Noise2CVGUI::write_control), p_level), mem_fun(*this, &Noise2CVGUI::get_randomLevel));
	m_dialRandomLevel = new LabeledDial("Random Level", p_slotRandomLevel, p_level, 0, 1, LOG, 0.0001, 4);
	p_mainWidget->pack_start(*m_dialRandomLevel);

	p_mainWidget->set_size_request(150, 200);

	p_background->add(*p_mainWidget);
	add(*p_background);

	Gtk::manage(p_mainWidget);
}