Exemplo n.º 1
0
Gtk::Widget *
Widget_RendDesc::create_other_tab()
{
	Gtk::Alignment *paddedPanel = manage(new Gtk::Alignment(0, 0, 1, 1));
	paddedPanel->set_padding(12, 12, 12, 12);

	Gtk::Box *panelBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12));
	panelBox->set_homogeneous(false);
	paddedPanel->add(*panelBox);

	Gtk::Frame *lockFrame = manage(new Gtk::Frame(_("Locks and Links")));
	lockFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) lockFrame->get_label_widget())->set_markup(_("<b>Locks and Links</b>"));
	panelBox->pack_start(*lockFrame, Gtk::PACK_SHRINK);

	Gtk::Alignment *lockPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	lockPadding->set_padding(6, 0, 24, 0);
	lockFrame->add(*lockPadding);

	Gtk::Grid *lockGrid = manage(new Gtk::Grid());
	lockGrid->set_row_spacing(6);
	lockGrid->set_column_spacing(12);
	lockPadding->add(*lockGrid);

	lockGrid->attach(*toggle_im_width,		0, 0, 1, 1);
	toggle_im_width->set_hexpand(true);
	lockGrid->attach(*toggle_im_height,		1, 0, 1, 1);
	toggle_im_height->set_hexpand(true);
	lockGrid->attach(*toggle_im_aspect,		2, 0, 1, 1);
	toggle_im_aspect->set_hexpand(true);
	lockGrid->attach(*toggle_im_span,		3, 0, 1, 1);
	toggle_im_span->set_hexpand(true);

	lockGrid->attach(*toggle_px_width,		0, 1, 1, 1);
	lockGrid->attach(*toggle_px_height,		1, 1, 1, 1);
	lockGrid->attach(*toggle_px_aspect,		2, 1, 1, 1);

	Gtk::Frame *focusFrame = manage(new Gtk::Frame(_("Focus Point")));
	focusFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) focusFrame->get_label_widget())->set_markup(_("<b>Focus Point</b>"));
	panelBox->pack_start(*focusFrame, Gtk::PACK_SHRINK);

	Gtk::Alignment *focusPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	focusPadding->set_padding(6, 0, 24, 0);
	focusFrame->add(*focusPadding);

	Gtk::Box *focusBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 12));
	focusPadding->add(*focusBox);

	Gtk::Label *focusLabel = manage(new Gtk::Label(_("_Focus Point"), 0, 0.5, true));
	focusLabel->set_mnemonic_widget(*entry_focus);
	focusBox->pack_start(*focusLabel, Gtk::PACK_SHRINK);
	focusBox->pack_start(*entry_focus, Gtk::PACK_EXPAND_WIDGET);

	paddedPanel->show_all();
	return paddedPanel;
}
Exemplo n.º 2
0
Gtk::Widget *
Widget_RendDesc::create_time_tab()
{
	Gtk::Alignment *paddedPanel = manage(new Gtk::Alignment(0, 0, 1, 1));
	paddedPanel->set_padding(12, 12, 12, 12);

	Gtk::Box *panelBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12));  // for future widgets
	panelBox->set_homogeneous(false);
	paddedPanel->add(*panelBox);

	time_frame = manage(new Gtk::Frame(_("Time Settings")));
	time_frame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) time_frame->get_label_widget())->set_markup(_("<b>Time Settings</b>"));
	panelBox->pack_start(*time_frame, Gtk::PACK_SHRINK);

	Gtk::Alignment *timeFramePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	timeFramePadding->set_padding(6, 0, 24, 0);
	time_frame->add(*timeFramePadding);

	Gtk::Grid *timeFrameGrid = manage(new Gtk::Grid());
	timeFramePadding->add(*timeFrameGrid);
	timeFrameGrid->set_row_spacing(6);
	timeFrameGrid->set_column_spacing(250);

	Gtk::Label *timeFPSLabel = manage(new Gtk::Label(_("_Frames per second"), 0, 0.5, true));
	timeFPSLabel->set_mnemonic_widget(*entry_fps);
	timeFrameGrid->attach(*timeFPSLabel, 0, 0, 1, 1);
	entry_fps->set_hexpand(true);
	timeFrameGrid->attach(*entry_fps, 1, 0, 1, 1);

	Gtk::Label *timeStartLabel = manage(new Gtk::Label(_("_Start Time"), 0, 0.5, true));
	timeStartLabel->set_mnemonic_widget(*entry_start_time);
	timeFrameGrid->attach(*timeStartLabel, 0, 1, 1, 1);
	timeFrameGrid->attach(*entry_start_time, 1, 1, 1, 1);

	Gtk::Label *timeEndLabel = manage(new Gtk::Label(_("_End Time"), 0, 0.5, true));
	timeEndLabel->set_mnemonic_widget(*entry_end_time);
	timeFrameGrid->attach(*timeEndLabel, 0, 2, 1, 1);
	timeFrameGrid->attach(*entry_end_time, 1, 2, 1, 1);

	Gtk::Label *timeDurationLabel = manage(new Gtk::Label(_("_Duration"), 0, 0.5, true));
	timeDurationLabel->set_mnemonic_widget(*entry_duration);
	timeFrameGrid->attach(*timeDurationLabel, 0, 3, 1, 1);
	timeFrameGrid->attach(*entry_duration, 1, 3, 1, 1);

	paddedPanel->show_all();
	return paddedPanel;
}
studio::Dialog_SoundSelect::Dialog_SoundSelect(Gtk::Window &parent, etl::handle<synfigapp::CanvasInterface> ci)
:Dialog(_("Sound Select"), parent),
canvas_interface(ci)
{
	Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	dialogPadding->set_padding(12, 12, 12, 12);
	get_vbox()->pack_start(*dialogPadding, false, false, 0);

	Gtk::Frame *soundFrame = manage(new Gtk::Frame(_("Sound Parameters")));
	((Gtk::Label *) soundFrame->get_label_widget())->set_markup(_("<b>Sound Parameters</b>"));
	soundFrame->set_shadow_type(Gtk::SHADOW_NONE);
	dialogPadding->add(*soundFrame);

	Gtk::Alignment *framePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	framePadding->set_padding(6, 0, 24, 0);
	soundFrame->add(*framePadding);

	Gtk::Label *fileLabel = manage(new Gtk::Label(_("_Sound File"), true));
	fileLabel->set_alignment(0, 0.5);
	fileLabel->set_mnemonic_widget(soundfile);
	Gtk::Label *offsetLabel = manage(new Gtk::Label(_("Time _Offset"), true));
	offsetLabel->set_alignment(0, 0.5);
	offsetLabel->set_mnemonic_widget(offset);

	Gtk::Table *table = manage(new Gtk::Table(2, 2, false));
	table->set_row_spacings(6);
	table->set_col_spacings(12);
	framePadding->add(*table);

	table->attach(*fileLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
	table->attach(soundfile, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
	table->attach(*offsetLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
	table->attach(offset, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);

	okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-ok")));
	add_action_widget(*okbutton, 0);

	get_vbox()->show_all();

	offset.set_value(0);

	okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_SoundSelect::on_ok));
}
Exemplo n.º 4
0
Gtk::Widget* PreferencesPanel::createSubBoxAlignement(Gtk::Widget* InnerWidget)
{
  Gtk::Alignment* Align = Gtk::manage(new Gtk::Alignment());

  Align->set_padding(10, 20, 20, 0);

  Align->add(*InnerWidget);

  Align->set_visible(true);

  return Align;
}
Exemplo n.º 5
0
	OptionalFieldEditor()
	:	m_box( false, 12 ),
		m_clear( Gtk::Stock::CLEAR )
	{
		Gtk::Alignment	* alignment = Gtk::manage( new Gtk::Alignment(0.5, 1.0, 1.0, 0.0) );

		m_box.add( m_widget );
		m_box.pack_end( *alignment, Gtk::PACK_SHRINK );

		alignment->add( m_clear );

		m_clear.signal_clicked().connect( sigc::mem_fun(&m_widget, &Widget::clear) );
	}
Exemplo n.º 6
0
void PrefPage::appendCombo(const std::string& name,
                           const std::string& registryKey,
                           const ComboBoxValueList& valueList,
                           bool storeValueNotIndex)
{
	Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 0.0, 0.0));

    // Create a new combo box of the correct type
    using boost::shared_ptr;
    using namespace gtkutil;

	Gtk::ComboBoxText* combo = Gtk::manage(new Gtk::ComboBoxText);

    // Add all the string values to the combo box
    for (ComboBoxValueList::const_iterator i = valueList.begin();
         i != valueList.end();
         ++i)
    {
		combo->append_text(*i);
    }

	if (storeValueNotIndex)
	{
        // There is no property_active_text() apparently, so we have to connect
        // manually
        combo->set_active_text(_registryBuffer.get(registryKey));

        combo->property_active().signal_changed().connect(
            sigc::bind(
				sigc::ptr_fun(setRegBufferValueFromActiveText), combo, registryKey, sigc::ref(_registryBuffer)
            )
        );

		_resetValuesSignal.connect(
			sigc::bind(sigc::ptr_fun(setActiveTextFromRegValue), combo, registryKey)
		);
	}
	else
	{
        registry::bindPropertyToBufferedKey(combo->property_active(), registryKey, _registryBuffer, _resetValuesSignal);
	}

    // Add it to the container
    alignment->add(*combo);

	// Add the widget to the dialog row
	appendNamedWidget(name, *alignment);
}
Exemplo n.º 7
0
Gtk::Widget* PrefPage::appendEntry(const std::string& name, const std::string& registryKey)
{
	Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 0.0, 0.0));
	alignment->show();

	Gtk::Entry* entry = Gtk::manage(new Gtk::Entry);
	entry->set_width_chars(static_cast<gint>(std::max(GlobalRegistry().get(registryKey).size(), std::size_t(30))));

	alignment->add(*entry);

	// Connect the registry key to the newly created input field
    registry::bindPropertyToBufferedKey(entry->property_text(), registryKey, _registryBuffer, _resetValuesSignal);

	appendNamedWidget(name, *alignment);

	return entry;
}
Exemplo n.º 8
0
	Change_rate_limit_dialog::Change_rate_limit_dialog(Gtk::Window& parent, Traffic_type traffic_type)
	:
		m::gtk::Dialog(parent),
		traffic_type(traffic_type)
	{
		std::string title = this->traffic_type == DOWNLOAD ? _("Set download rate limit") : _("Set upload rate limit");

		this->set_title(title);
		this->set_resizable(false);

		if(!parent.is_visible())
			this->set_position(Gtk::WIN_POS_CENTER);

		Gtk::VBox* main_vbox = Gtk::manage(new Gtk::VBox(false, m::gtk::VBOX_SPACING));
		main_vbox->set_border_width(m::gtk::BOX_BORDER_WIDTH);
		this->get_vbox()->pack_start(*main_vbox, false, false);

		m::gtk::vbox::add_header(*main_vbox, title, true);

		Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.5, 0.5, 0, 0));
		main_vbox->pack_start(*alignment, false, false);

		Gtk::HBox* main_hbox = Gtk::manage(new Gtk::HBox(false, m::gtk::HBOX_SPACING));
		alignment->add(*main_hbox);

		this->rate_limit_button = Gtk::manage(new Gtk::SpinButton);
			this->rate_limit_button->set_range(-1, INT_MAX);
			this->rate_limit_button->set_increments(1, 100);

			this->rate_limit_button->signal_activate().connect(sigc::mem_fun(
				*this, &Change_rate_limit_dialog::on_rate_limit_button_activate_callback
			));
		main_hbox->pack_start(*this->rate_limit_button, false, false);

		Gtk::Label* label = Gtk::manage(new Gtk::Label(_("KB/s")));
		main_hbox->pack_start(*label, false, false);

		// Добавляем кнопки
		this->get_action_area()->property_layout_style() = Gtk::BUTTONBOX_CENTER;
		this->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
		this->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
		this->set_default_response(Gtk::RESPONSE_OK);

		this->show_all_children();
	}
NewFromTemplate::NewFromTemplate()
    : _create_template_button(_("Create from template"))
{
    set_title(_("New From Template"));
    resize(400, 400);
    
    get_vbox()->pack_start(_main_widget);
   
    Gtk::Alignment *align;
    align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0));
    get_vbox()->pack_end(*align, Gtk::PACK_SHRINK);
    align->set_padding(0, 0, 0, 15);
    align->add(_create_template_button);
    
    _create_template_button.signal_clicked().connect(
    sigc::mem_fun(*this, &NewFromTemplate::_createFromTemplate));
   
    show_all();
}
Exemplo n.º 10
0
Gtk::Widget* PrefPage::appendSpinner(const std::string& name, const std::string& registryKey,
                                   double lower, double upper, int fraction)
{
	// Load the initial value (maybe unnecessary, as the value is loaded upon dialog show)
	float value = registry::getValue<float>(registryKey);

	Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 0.0, 0.0));
	alignment->show();

	Gtk::SpinButton* spin = createSpinner(value, lower, upper, fraction);
	alignment->add(*spin);

	// Connect the registry key to the newly created input field
	registry::bindPropertyToBufferedKey(spin->property_value(), registryKey, _registryBuffer, _resetValuesSignal);

	appendNamedWidget(name, *alignment);

	return spin;
}
Exemplo n.º 11
0
void
PropertiesWindow::add_property(const Raul::URI& uri, const Atom& value)
{
	World* world = _app->world();

	const unsigned n_rows = _table->property_n_rows() + 1;
	_table->property_n_rows() = n_rows;

	// Column 0: Property
	LilvNode* prop = lilv_new_uri(world->lilv_world(), uri.c_str());
	Glib::ustring lab_text = RDFS::label(world, prop);
	if (lab_text.empty()) {
		lab_text = world->rdf_world()->prefixes().qualify(uri);
	}
	lab_text = Glib::ustring("<a href=\"") + uri + "\">"
		+ lab_text + "</a>";
	Gtk::Label* lab = manage(new Gtk::Label(lab_text, 1.0, 0.5));
	lab->set_use_markup(true);
	_table->attach(*lab, 0, 1, n_rows, n_rows + 1,
	               Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK);
	lilv_node_free(prop);

	// Column 1: Value
	Gtk::Alignment*   align      = manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0));
	Gtk::CheckButton* present    = manage(new Gtk::CheckButton());
	Gtk::Widget*      val_widget = create_value_widget(uri, value);
	present->set_active(true);
	if (val_widget) {
		align->add(*val_widget);
	}
	_table->attach(*align, 1, 2, n_rows, n_rows + 1,
	               Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK);
	_table->attach(*present, 2, 3, n_rows, n_rows + 1,
	               Gtk::FILL, Gtk::SHRINK);
	_records.insert(make_pair(uri, Record(value, align, n_rows, present)));
}
Exemplo n.º 12
0
void PrefPage::appendSlider(const std::string& name, const std::string& registryKey, bool drawValue,
                            double value, double lower, double upper, double step_increment, double page_increment, double page_size)
{
	// Create a new adjustment with the boundaries <lower> and <upper> and all the increments
	Gtk::Adjustment* adj = Gtk::manage(new Gtk::Adjustment(value, lower, upper, step_increment, page_increment, page_size));

	// Connect the registry key to this adjustment
    registry::bindPropertyToBufferedKey(adj->property_value(), registryKey, _registryBuffer, _resetValuesSignal);

	// scale
	Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0));
	alignment->show();

	Gtk::HScale* scale = Gtk::manage(new Gtk::HScale(*adj));
	scale->set_value_pos(Gtk::POS_LEFT);
	scale->show();

	alignment->add(*scale);

	scale->set_draw_value(drawValue);
	scale->set_digits((step_increment < 1.0f) ? 2 : 0);

	appendNamedWidget(name, *alignment);
}
Exemplo n.º 13
0
TemplateWidget::TemplateWidget()
    : _more_info_button(_("More info"))
    , _short_description_label(" ")
    , _template_name_label(_("no template selected"))
    , _effect_prefs(NULL)
{
    pack_start(_template_name_label, Gtk::PACK_SHRINK, 10);
    pack_start(_preview_box, Gtk::PACK_SHRINK, 0);
    
    _preview_box.pack_start(_preview_image, Gtk::PACK_EXPAND_PADDING, 15);
    _preview_box.pack_start(_preview_render, Gtk::PACK_EXPAND_PADDING, 10);
    
    _short_description_label.set_line_wrap(true);

    Gtk::Alignment *align;
    align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0));
    pack_end(*align, Gtk::PACK_SHRINK);
    align->add(_more_info_button);
    
    pack_end(_short_description_label, Gtk::PACK_SHRINK, 5);
    
    _more_info_button.signal_clicked().connect(
    sigc::mem_fun(*this, &TemplateWidget::_displayTemplateDetails));
}
Exemplo n.º 14
0
RenderSettings::RenderSettings(Gtk::Window& parent, etl::handle<synfigapp::CanvasInterface> canvas_interface):
	Gtk::Dialog(_("Render Settings"),parent,false,true),
	canvas_interface_(canvas_interface),
	adjustment_quality(3,0,9),
	entry_quality(adjustment_quality,1,0),
	adjustment_antialias(1,1,31),
	entry_antialias(adjustment_antialias,1,0),
	toggle_single_frame(_("Render _current frame only"), true),
	tparam("mpeg4",200)
{
	tparam.sequence_separator=App::sequence_separator;
	widget_rend_desc.show();
	widget_rend_desc.signal_changed().connect(sigc::mem_fun(*this,&studio::RenderSettings::on_rend_desc_changed));
	widget_rend_desc.set_rend_desc(canvas_interface_->get_canvas()->rend_desc());

	canvas_interface->signal_rend_desc_changed().connect(sigc::mem_fun(*this,&RenderSettings::on_rend_desc_changed));

	menu_target=manage(new class Gtk::Menu());

	menu_target->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Auto"),
			sigc::bind(sigc::mem_fun(*this,&RenderSettings::set_target),String())
		));

	synfig::Target::Book::iterator iter;
	synfig::Target::Book book(synfig::Target::book());

	for(iter=book.begin();iter!=book.end();iter++)
	{
		menu_target->items().push_back(Gtk::Menu_Helpers::MenuElem(iter->first,
			sigc::bind(sigc::mem_fun(*this,&RenderSettings::set_target),iter->first)
		));
	}
	optionmenu_target.set_menu(*menu_target);

	optionmenu_target.set_history(0);

	Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	dialogPadding->set_padding(12, 12, 12, 12);
	get_vbox()->pack_start(*dialogPadding, false, false, 0);

	Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
	dialogPadding->add(*dialogBox);

	Gtk::Button *choose_button(manage(new class Gtk::Button(Gtk::StockID(_("Choose...")))));
	choose_button->show();
	choose_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::RenderSettings::on_choose_pressed));

	tparam_button=manage(new class Gtk::Button(Gtk::StockID(_("Parameters..."))));
	tparam_button->show();
	tparam_button->set_sensitive(false);
	tparam_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::RenderSettings::on_targetparam_pressed));

	Gtk::Frame *target_frame=manage(new Gtk::Frame(_("Target")));
	target_frame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) target_frame->get_label_widget())->set_markup(_("<b>Target</b>"));
	dialogBox->pack_start(*target_frame);
	Gtk::Alignment *targetPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	targetPadding->set_padding(6, 0, 24, 0);
	target_frame->add(*targetPadding);

	Gtk::Table *target_table = manage(new Gtk::Table(2, 3, false));
	target_table->set_row_spacings(6);
	target_table->set_col_spacings(12);
	targetPadding->add(*target_table);

	Gtk::Label *filenameLabel = manage(new Gtk::Label(_("_Filename"), true));
	filenameLabel->set_alignment(0, 0.5);
	filenameLabel->set_mnemonic_widget(entry_filename);
	target_table->attach(*filenameLabel, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	target_table->attach(entry_filename, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	target_table->attach(*choose_button, 2, 3, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);

	Gtk::Label *targetLabel = manage(new Gtk::Label(_("_Target"), true));
	targetLabel->set_alignment(0, 0.5);
	targetLabel->set_mnemonic_widget(optionmenu_target);
	target_table->attach(*targetLabel, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	target_table->attach(optionmenu_target, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	target_table->attach(*tparam_button, 2, 3, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);

	toggle_single_frame.signal_toggled().connect(sigc::mem_fun(*this, &studio::RenderSettings::on_single_frame_toggle));

	Gtk::Frame *settings_frame=manage(new Gtk::Frame(_("Settings")));
	settings_frame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) settings_frame->get_label_widget())->set_markup(_("<b>Settings</b>"));
	dialogBox->pack_start(*settings_frame);

	Gtk::Alignment *settingsPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	settingsPadding->set_padding(6, 0, 24, 0);
	settings_frame->add(*settingsPadding);

	Gtk::Table *settings_table=manage(new Gtk::Table(2,2,false));
	settings_table->set_row_spacings(6);
	settings_table->set_col_spacings(12);
	settingsPadding->add(*settings_table);

	Gtk::Label *qualityLabel = manage(new Gtk::Label(_("_Quality"), true));
	qualityLabel->set_alignment(0, 0.5);
	qualityLabel->set_mnemonic_widget(entry_quality);
	settings_table->attach(*qualityLabel, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	settings_table->attach(entry_quality, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);

	Gtk::Label *antiAliasLabel = manage(new Gtk::Label(_("_Anti-Aliasing"), true));
	antiAliasLabel->set_alignment(0, 0.5);
	antiAliasLabel->set_mnemonic_widget(entry_antialias);
	settings_table->attach(*antiAliasLabel, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	settings_table->attach(entry_antialias, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);

	toggle_single_frame.set_alignment(0, 0.5);
	settings_table->attach(toggle_single_frame, 0, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);

	dialogBox->pack_start(widget_rend_desc);


	Gtk::Button *render_button(manage(new class Gtk::Button(Gtk::StockID(_("Render")))));
	render_button->show();
	add_action_widget(*render_button,1);
	render_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::RenderSettings::on_render_pressed));

	Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-cancel"))));
	cancel_button->show();
	add_action_widget(*cancel_button,0);
	cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::RenderSettings::on_cancel_pressed));

	//set_default_response(1);

	set_title(_("Render Settings")+String(" - ")+canvas_interface_->get_canvas()->get_name());

	toggle_single_frame.set_active(false);
	widget_rend_desc.enable_time_section();

	set_entry_filename();

	get_vbox()->show_all();
}
Exemplo n.º 15
0
WidgetExpanderBase::WidgetExpanderBase() :
  WidgetExpander()
{
  mp_ColorButton = Gtk::manage(new Gtk::ColorButton(getARandColor()));

  mp_WidthSpinButton = Gtk::manage(new Gtk::SpinButton());
  mp_WidthSpinButton->set_range(1, 100);
  mp_WidthSpinButton->set_increments(1, 10);
  mp_WidthSpinButton->set_numeric(true);
  mp_WidthSpinButton->set_value(1);

  mp_OpacityHScale = Gtk::manage(new Gtk::HScale(0, 101, 1));
  mp_OpacityHScale->set_value_pos(Gtk::POS_LEFT);
  mp_OpacityHScale->set_value(100);
  mp_OpacityHScale->set_update_policy(Gtk::UPDATE_DELAYED);

  mp_ShowIDCheckBox = Gtk::manage(new Gtk::CheckButton(_("Show units IDs")));
  //  mp_CheckButtonGraph = Gtk::manage(new Gtk::CheckButton(_("show graph")));

  Gtk::HBox* ColorButtonBox = Gtk::manage(new Gtk::HBox());
  ColorButtonBox->pack_start(*mp_ColorButton, Gtk::PACK_SHRINK);

  Gtk::HBox* WidthSpinButtonBox = Gtk::manage(new Gtk::HBox());
  WidthSpinButtonBox->pack_start(*mp_WidthSpinButton, Gtk::PACK_SHRINK);

  Gtk::Table* mp_MainTable = Gtk::manage(new Gtk::Table());
  mp_MainTable->set_col_spacings(5);
  mp_MainTable->attach(*Gtk::manage(new Gtk::Label(_("Color:"), 0, 0.5)), 0, 1,
      0, 1, Gtk::FILL, Gtk::SHRINK);
  mp_MainTable->attach(*Gtk::manage(new Gtk::Label(_("Width:"), 0, 0.5)), 0, 1,
      1, 2, Gtk::FILL, Gtk::SHRINK);
  mp_MainTable->attach(*Gtk::manage(new Gtk::Label(_("Opacity:"), 0, 0.5)), 0,
      1, 2, 3, Gtk::FILL, Gtk::SHRINK);
  mp_MainTable->attach(*ColorButtonBox, 1, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
  mp_MainTable->attach(*WidthSpinButtonBox, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK);
  mp_MainTable->attach(*mp_OpacityHScale, 1, 2, 2, 3, Gtk::FILL | Gtk::EXPAND,
      Gtk::SHRINK);
  mp_MainTable->attach(*mp_ShowIDCheckBox, 0, 2, 3, 4, Gtk::FILL, Gtk::SHRINK);
  //  mp_MainTable->attach(*mp_CheckButtonGraph, 0, 2, 4, 5, Gtk::FILL, Gtk::SHRINK);

  Gtk::Alignment* MainTableAlign = Gtk::manage(new Gtk::Alignment());
  MainTableAlign->set_padding(10, 20, 20, 0);
  MainTableAlign->add(*mp_MainTable);

  mp_MainExpander->set_label(_("Style"));
  mp_MainExpander->add(*MainTableAlign);
  mp_MainExpander->show_all_children();

  //******************Signal connexion*********************

  mp_ColorButton->signal_color_set().connect(sigc::mem_fun(*this,
      &WidgetExpanderBase::onWidgetExpanderBaseChanged));
  mp_WidthSpinButton->signal_value_changed().connect(sigc::mem_fun(*this,
      &WidgetExpanderBase::onWidgetExpanderBaseChanged));
  mp_OpacityHScale->signal_value_changed().connect(sigc::mem_fun(*this,
      &WidgetExpanderBase::onWidgetExpanderBaseChanged));
  mp_ShowIDCheckBox->signal_toggled().connect(sigc::mem_fun(*this,
      &WidgetExpanderBase::onWidgetExpanderBaseChanged));
  //  mp_CheckButtonGraph->signal_toggled().connect(
  //      sigc::mem_fun(*this, &WidgetExpanderBase::onWidgetExpanderBaseChanged));
}
Exemplo n.º 16
0
Widget_Waypoint::Widget_Waypoint(etl::handle<synfig::Canvas> canvas):
	Gtk::Alignment(0, 0, 1, 1),
	waypoint(synfig::ValueBase(),0),
	adj_tension(Gtk::Adjustment::create(0.0,-20,20,0.1,1)),
	adj_continuity(Gtk::Adjustment::create(0.0,-20,20,0.1,1)),
	adj_bias(Gtk::Adjustment::create(0.0,-20,20,0.1,1)),
	adj_temporal_tension(Gtk::Adjustment::create(0.0,-20,20,0.1,1))
{
	value_widget=manage(new Widget_ValueBase());
	value_widget->set_canvas(canvas);
	value_widget->show();

	value_node_label=manage(new Gtk::Label(_("(Non-static value)")));


	time_widget=manage(new Widget_Time());
	time_widget->set_fps(canvas->rend_desc().get_frame_rate());

	before_options=manage(new class Widget_Enum());
	before_options->show();
	before_options->set_param_desc(
		ParamDesc("interpolation")
			.set_hint("enum")
			.add_enum_value(INTERPOLATION_CLAMPED,"clamped",_("Clamped"))
			.add_enum_value(INTERPOLATION_TCB,"auto",_("TCB"))
			.add_enum_value(INTERPOLATION_CONSTANT,"constant",_("Constant"))
			.add_enum_value(INTERPOLATION_HALT,"ease",_("Ease In/Out"))
			.add_enum_value(INTERPOLATION_LINEAR,"linear",_("Linear"))
	);
	before_options->set_icon(0, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_clamped"),Gtk::ICON_SIZE_MENU));
	before_options->set_icon(1, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_tcb"),Gtk::ICON_SIZE_MENU));
	before_options->set_icon(2, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_const"),Gtk::ICON_SIZE_MENU));
	before_options->set_icon(3, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_ease"),Gtk::ICON_SIZE_MENU));
	before_options->set_icon(4, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_linear"),Gtk::ICON_SIZE_MENU));

	after_options=manage(new class Widget_Enum());
	after_options->show();
	after_options->set_param_desc(
		ParamDesc("interpolation")
			.set_hint("enum")
			.add_enum_value(INTERPOLATION_CLAMPED,"clamped",_("Clamped"))
			.add_enum_value(INTERPOLATION_TCB,"auto",_("TCB"))
			.add_enum_value(INTERPOLATION_CONSTANT,"constant",_("Constant"))
			.add_enum_value(INTERPOLATION_HALT,"ease",_("Ease In/Out"))
			.add_enum_value(INTERPOLATION_LINEAR,"linear",_("Linear"))
	);
	after_options->set_icon(0, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_clamped"),Gtk::ICON_SIZE_MENU));
	after_options->set_icon(1, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_tcb"),Gtk::ICON_SIZE_MENU));
	after_options->set_icon(2, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_const"),Gtk::ICON_SIZE_MENU));
	after_options->set_icon(3, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_ease"),Gtk::ICON_SIZE_MENU));
	after_options->set_icon(4, Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-interpolation_type_linear"),Gtk::ICON_SIZE_MENU));

	spin_tension=manage(new class Gtk::SpinButton(adj_tension,0.1,3));
	spin_tension->show();
	spin_continuity=manage(new class Gtk::SpinButton(adj_continuity,0.1,3));
	spin_continuity->show();
	spin_bias=manage(new class Gtk::SpinButton(adj_bias,0.1,3));
	spin_bias->show();
	spin_temporal_tension=manage(new class Gtk::SpinButton(adj_temporal_tension,0.1,3));
	spin_temporal_tension->show();

	set_padding(12, 12, 12, 12);

	Gtk::VBox *widgetBox = manage(new Gtk::VBox(false, 12));
	add(*widgetBox);

	Gtk::Frame *waypointFrame = manage(new Gtk::Frame(_("Waypoint")));
	waypointFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) waypointFrame->get_label_widget())->set_markup(_("<b>Waypoint</b>"));
	widgetBox->pack_start(*waypointFrame, false, false, 0);

	Gtk::Alignment *waypointPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	waypointPadding->set_padding(6, 0, 24, 0);
	waypointFrame->add(*waypointPadding);

	Gtk::Table *waypointTable = manage(new Gtk::Table(2, 2, false));
	waypointTable->set_row_spacings(6);
	waypointTable->set_col_spacings(12);
	waypointPadding->add(*waypointTable);

	Gtk::Label *waypointValueLabel = manage(new Gtk::Label(_("_Value"), true));
	waypointValueLabel->set_alignment(0, 0.5);
	waypointValueLabel->set_mnemonic_widget(*value_widget);
	waypointTable->attach(*waypointValueLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	waypointTable->attach(*value_widget, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	waypointTable->attach(*value_node_label, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *waypointTimeLabel = manage(new Gtk::Label(_("_Time"), true));
	waypointTimeLabel->set_alignment(0, 0.5);
	waypointTimeLabel->set_mnemonic_widget(*time_widget);
	waypointTable->attach(*waypointTimeLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	waypointTable->attach(*time_widget, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Frame *interpolationFrame = manage(new Gtk::Frame(_("Interpolation")));
	interpolationFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) interpolationFrame->get_label_widget())->set_markup(_("<b>Interpolation</b>"));
	widgetBox->pack_start(*interpolationFrame, false, false, 0);

	Gtk::Alignment *interpolationPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	interpolationPadding->set_padding(6, 0, 24, 0);
	interpolationFrame->add(*interpolationPadding);

	Gtk::Table *interpolationTable = manage(new Gtk::Table(2, 2, false));
	interpolationTable->set_row_spacings(6);
	interpolationTable->set_col_spacings(12);
	interpolationPadding->add(*interpolationTable);

	Gtk::Label *interpolationInLabel = manage(new Gtk::Label(_("_In Interpolation"), true));
	interpolationInLabel->set_alignment(0, 0.5);
	interpolationInLabel->set_mnemonic_widget(*before_options);
	interpolationTable->attach(*interpolationInLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	interpolationTable->attach(*before_options, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *interpolationOutLabel = manage(new Gtk::Label(_("_Out Interpolation"), true));
	interpolationOutLabel->set_alignment(0, 0.5);
	interpolationOutLabel->set_mnemonic_widget(*after_options);
	interpolationTable->attach(*interpolationOutLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	interpolationTable->attach(*after_options, 1, 2, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Frame *tcbFrame = manage(new Gtk::Frame(_("TCB Parameters")));
	tcbFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) tcbFrame->get_label_widget())->set_markup(_("<b>TCB Parameter</b>"));
	widgetBox->pack_start(*tcbFrame, false, false, 0);

	Gtk::Alignment *tcbPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	tcbPadding->set_padding(6, 0, 24, 0);
	tcbFrame->add(*tcbPadding);

	Gtk::Table *tcbTable = manage(new Gtk::Table(4, 2, false));
	tcbTable->set_row_spacings(6);
	tcbTable->set_col_spacings(12);
	tcbPadding->add(*tcbTable);

	Gtk::Label *tensionLabel = manage(new Gtk::Label(_("T_ension"), true));
	tensionLabel->set_alignment(0, 0.5);
	tensionLabel->set_mnemonic_widget(*spin_tension);
	spin_tension->set_alignment(1);
	tcbTable->attach(*tensionLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	tcbTable->attach(*spin_tension, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *continuityLabel = manage(new Gtk::Label(_("_Continuity"), true));
	continuityLabel->set_alignment(0, 0.5);
	continuityLabel->set_mnemonic_widget(*spin_continuity);
	spin_continuity->set_alignment(1);
	tcbTable->attach(*continuityLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	tcbTable->attach(*spin_continuity, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *biasLabel = manage(new Gtk::Label(_("_Bias"), true));
	biasLabel->set_alignment(0, 0.5);
	biasLabel->set_mnemonic_widget(*spin_bias);
	spin_bias->set_alignment(1);
	tcbTable->attach(*biasLabel, 0, 1, 2, 3, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	tcbTable->attach(*spin_bias, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *temporalTensionLabel = manage(new Gtk::Label(_("Te_mporal Tension"), true));
	temporalTensionLabel->set_alignment(0, 0.5);
	temporalTensionLabel->set_mnemonic_widget(*spin_temporal_tension);
	spin_temporal_tension->set_alignment(1);
	tcbTable->attach(*temporalTensionLabel, 0, 1, 3, 4, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	tcbTable->attach(*spin_temporal_tension, 1, 2, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	show_all();
	hide();
	set_canvas(canvas);
}
Exemplo n.º 17
0
CanvasProperties::CanvasProperties(Gtk::Window& parent,etl::handle<synfigapp::CanvasInterface> canvas_interface):
	Gtk::Dialog(_("Canvas Properties"),parent,false,true),
	canvas_interface_(canvas_interface)
{
	widget_rend_desc.show();
	widget_rend_desc.signal_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::on_rend_desc_changed));

	Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	dialogPadding->set_padding(12, 12, 12, 12);
	get_vbox()->pack_start(*dialogPadding, false, false, 0);

	Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
	dialogPadding->add(*dialogBox);

	Gtk::Frame *info_frame=manage(new Gtk::Frame(_("Canvas Info")));
	info_frame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) info_frame->get_label_widget())->set_markup(_("<b>Canvas Info</b>"));
	dialogBox->pack_start(*info_frame, false, false, 0);

	Gtk::Alignment *infoPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	infoPadding->set_padding(6, 0, 24, 0);
	info_frame->add(*infoPadding);

	Gtk::Table *info_table=manage(new Gtk::Table(2,2,false));
	info_table->set_row_spacings(6);
	info_table->set_col_spacings(12);
	infoPadding->add(*info_table);

	// The root canvas doesn't have an ID, so don't
	// display it if this is a root canvas.
	if(!canvas_interface_->get_canvas()->is_root())
	{
		Gtk::Label *idLabel = manage(new Gtk::Label(_("_ID"), true));
		idLabel->set_alignment(0, 0.5);
		idLabel->set_mnemonic_widget(entry_id);
		info_table->attach(*idLabel, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
		info_table->attach(entry_id, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	}
	Gtk::Label *nameLabel = manage(new Gtk::Label(_("_Name"), true));
	nameLabel->set_alignment(0, 0.5);
	nameLabel->set_mnemonic_widget(entry_name);
	Gtk::Label *descriptionLabel = manage(new Gtk::Label(_("_Description"), true));
	descriptionLabel->set_alignment(0, 0.5);
	descriptionLabel->set_mnemonic_widget(entry_description);
	info_table->attach(*nameLabel, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	info_table->attach(*descriptionLabel, 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	info_table->attach(entry_name, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
	info_table->attach(entry_description, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);

	dialogBox->pack_start(widget_rend_desc, false, false, 0);

	canvas_interface_->signal_rend_desc_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh));
	canvas_interface_->signal_id_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh));

	Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
	ok_button->show();
	add_action_widget(*ok_button,2);
	ok_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_ok_pressed));

	Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
	apply_button->show();
	add_action_widget(*apply_button,1);
	apply_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_apply_pressed));

	Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close"))));
	cancel_button->show();
	add_action_widget(*cancel_button,0);
	cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_cancel_pressed));

	//set_default_response(1);

	get_vbox()->show_all();
	refresh();

	update_title();
}
Exemplo n.º 18
0
Main_window::Main_window(const Main_window_settings& settings)
:
	m::gtk::Window("", settings.window, 800, 600, 0),
	gui(new Gui)
{
	Client_settings& client_settings = get_client_settings();
	Main_window_settings& main_window_settings = client_settings.gui.main_window;

	// Заголовок окна -->
		this->gui->orig_window_title = APP_NAME;

		if(get_application().get_config_dir_path() != get_default_config_dir_path())
			this->gui->orig_window_title = " (" + get_application().get_config_dir_path() + ")";

		Gtk::Window::set_title(this->gui->orig_window_title);
	// Заголовок окна <--

	// Трей
	show_tray_icon(client_settings.gui.show_tray_icon);

	// Меню -->
		this->gui->ui_manager = Gtk::UIManager::create();
		Glib::RefPtr<Gtk::ActionGroup> action_group = Gtk::ActionGroup::create();


		action_group->add(
			app_icons::create_action("app", app_icons::ICON_APP, APP_NAME),
			sigc::mem_fun(*this, &Main_window::on_tray_activated)
		);


		action_group->add(Gtk::Action::create("file", _("_File")));
		action_group->add(
			Gtk::Action::create("create", Gtk::Stock::NEW, _("_Create")),
			sigc::mem_fun(*this, &Main_window::on_create_callback)
		);
		action_group->add(
			Gtk::Action::create("open", Gtk::Stock::OPEN, _("_Open a torrent")),
			sigc::mem_fun(*this, &Main_window::on_open_callback)
		);
		action_group->add(
			Gtk::Action::create("open_magnet", Gtk::Stock::JUMP_TO, _("_Open a magnet link")),
			sigc::mem_fun(*this, &Main_window::on_open_magnet_callback)
		);
		action_group->add(
			Gtk::Action::create("quit", Gtk::Stock::QUIT, _("_Quit")),
			sigc::mem_fun(get_application(), &Application::close
		));


		action_group->add(Gtk::Action::create("edit", _("_Edit")));
		action_group->add(
			app_icons::create_action("statistics", app_icons::ICON_STATISTICS, _("_Statistics")),
			sigc::mem_fun(*this, &Main_window::on_show_statistics_callback)
		);
		action_group->add(
			Gtk::Action::create("preferences", Gtk::Stock::PREFERENCES, _("_Preferences")),
			sigc::mem_fun(*this, &Main_window::on_show_settings_window_callback)
		);


		action_group->add(Gtk::Action::create("view", _("_View")));

		// Toolbar -->
			action_group->add(Gtk::Action::create("toolbar", _("_Toolbar")));

			this->gui->menu_show_toolbar_action = Gtk::ToggleAction::create(
				"toolbar/show", _Q("'Show ...' toggle|_Show"), "",
				get_client_settings().gui.show_toolbar
			);
			action_group->add(
				this->gui->menu_show_toolbar_action,
				sigc::mem_fun(*this, &Main_window::on_show_toolbar_toggled_callback)
			);

			// Стиль панели инструментов -->
			{
				Gtk::RadioButtonGroup radio_group;
				std::map< m::gtk::toolbar::Style, Glib::RefPtr<Gtk::RadioAction> > toolbar_style_buttons;

				action_group->add(Gtk::Action::create("toolbar/style", _("Toolbar _style")));

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::DEFAULT] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/default", _("_Desktop default")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::DEFAULT
					)
				);

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::ICONS] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/icons", _("_Icons")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::ICONS
					)
				);

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::TEXT] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/text", _("_Text")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::TEXT
					)
				);

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::BOTH] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/both", _("_Both")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::BOTH
					)
				);

				action_group->add(
					toolbar_style_buttons[m::gtk::toolbar::BOTH_HORIZ] = Gtk::RadioAction::create(
						radio_group, "toolbar/style/both_horiz", _("Both _horizontal")
					),
					sigc::bind<m::gtk::toolbar::Style>(
						sigc::mem_fun(*this, &Main_window::change_toolbar_style),
						m::gtk::toolbar::BOTH_HORIZ
					)
				);

				toolbar_style_buttons[get_client_settings().gui.toolbar_style]->set_active();
			}
			// Стиль панели инструментов <--
		// Toolbar <--

		// Categories <--
		{
			Glib::RefPtr<Gtk::ToggleAction> action;

			action_group->add(Gtk::Action::create("categories", _("_Categories")));

			action = Gtk::ToggleAction::create(
				"categories/show", _Q("'Show ...' toggle|_Show"), "",
				get_client_settings().gui.main_window.torrents_viewport.categories_view->visible
			);
			action_group->add(
				action,
				sigc::bind< Glib::RefPtr<Gtk::ToggleAction> >(
					sigc::mem_fun(*this->gui, &Main_window::Gui::on_show_categories_toggle_cb), action)
			);

			action = Gtk::ToggleAction::create(
				"categories/show_names", _("Show _names"), "",
				get_client_settings().gui.main_window.torrents_viewport.categories_view->show_names
			);
			action_group->add(
				action,
				sigc::bind< Glib::RefPtr<Gtk::ToggleAction> >(
					sigc::mem_fun(*this->gui, &Main_window::Gui::on_show_categories_names_toggle_cb), action)
			);

			action = Gtk::ToggleAction::create(
				"categories/show_counters", _("Show _counters"), "",
				get_client_settings().gui.main_window.torrents_viewport.categories_view->show_counters
			);
			action_group->add(
				action,
				sigc::bind< Glib::RefPtr<Gtk::ToggleAction> >(
					sigc::mem_fun(*this->gui, &Main_window::Gui::on_show_categories_counters_toggle_cb), action)
			);
		}
		// Categories <--

		// Torrents -->
			action_group->add(Gtk::Action::create("torrents", _("_Torrents")));


			action_group->add(Gtk::Action::create("resume", Gtk::Stock::MEDIA_PLAY, _("_Resume")));
			action_group->add(
				app_icons::create_action("resume/all", app_icons::ICON_DOWNLOAD_AND_UPLOAD, _("_All")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_resume_torrents_callback),
					ALL
				)
			);
			action_group->add(
				app_icons::create_action("resume/downloads", app_icons::ICON_DOWNLOAD, _("_Downloads")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_resume_torrents_callback),
					DOWNLOADS
				)
			);
			action_group->add(
				app_icons::create_action("resume/uploads", app_icons::ICON_UPLOAD, _("_Uploads")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_resume_torrents_callback),
					UPLOADS
				)
			);


			action_group->add(Gtk::Action::create("pause", Gtk::Stock::MEDIA_PAUSE, _("_Pause")));
			action_group->add(
				app_icons::create_action("pause/all", app_icons::ICON_DOWNLOAD_AND_UPLOAD, _("_All")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_pause_torrents_callback),
					ALL
				)
			);
			action_group->add(
				app_icons::create_action("pause/downloads", app_icons::ICON_DOWNLOAD, _("_Downloads")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_pause_torrents_callback),
					DOWNLOADS
				)
			);
			action_group->add(
				app_icons::create_action("pause/uploads", app_icons::ICON_UPLOAD, _("_Uploads")),
				sigc::bind<Torrents_group>(
					sigc::mem_fun(*this, &Main_window::on_pause_torrents_callback),
					UPLOADS
				)
			);


			// Temporary -->
				gui->resume_temporary = Gtk::Action::create(
					"resume_temporary", Gtk::Stock::MEDIA_PLAY, _("R_esume temporary"));
				action_group->add(gui->resume_temporary);

				action_group->add(
					app_icons::create_action("resume_temporary/all", app_icons::ICON_DOWNLOAD_AND_UPLOAD, _("_All")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_RESUME, ALL )
					)
				);
				action_group->add(
					app_icons::create_action("resume_temporary/downloads", app_icons::ICON_DOWNLOAD, _("_Downloads")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_RESUME, DOWNLOADS )
					)
				);
				action_group->add(
					app_icons::create_action("resume_temporary/uploads", app_icons::ICON_UPLOAD, _("_Uploads")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_RESUME, UPLOADS )
					)
				);


				gui->pause_temporary = Gtk::Action::create(
					"pause_temporary", Gtk::Stock::MEDIA_PAUSE, _("P_ause temporary"));
				action_group->add(gui->pause_temporary);

				action_group->add(
					app_icons::create_action("pause_temporary/all", app_icons::ICON_DOWNLOAD_AND_UPLOAD, _("_All")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_PAUSE, ALL )
					)
				);
				action_group->add(
					app_icons::create_action("pause_temporary/downloads", app_icons::ICON_DOWNLOAD, _("_Downloads")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_PAUSE, DOWNLOADS )
					)
				);
				action_group->add(
					app_icons::create_action("pause_temporary/uploads", app_icons::ICON_UPLOAD, _("_Uploads")),
					sigc::bind< std::pair<Temporary_action,Torrents_group> >(
						sigc::mem_fun(*this, &Main_window::on_temporary_process_torrents_cb),
						std::pair<Temporary_action,Torrents_group>( TEMPORARY_ACTION_PAUSE, UPLOADS )
					)
				);

				gui->complete_temporary_action = Gtk::Action::create(
					"complete_temporary_action", Gtk::Stock::APPLY, _("C_omplete pending temporary action"));
				action_group->add(
					gui->complete_temporary_action,
					sigc::bind<bool>( sigc::mem_fun(*this, &Main_window::on_interrupt_temporary_action_cb), true )
				);

				gui->cancel_temporary_action = Gtk::Action::create(
					"cancel_temporary_action", Gtk::Stock::STOP, _("_Cancel pending temporary action"));
				action_group->add(
					gui->cancel_temporary_action,
					sigc::bind<bool>( sigc::mem_fun(*this, &Main_window::on_interrupt_temporary_action_cb), false )
				);
			// Temporary <--
		// Torrents <--


		action_group->add(
			app_icons::create_action("set_upload_rate_limit", app_icons::ICON_UPLOAD, _("Set _upload rate limit")),
			sigc::bind<Traffic_type>(
				sigc::mem_fun(*this, &Main_window::on_change_rate_limit_callback),
				UPLOAD
			)
		);
		action_group->add(
			app_icons::create_action("set_download_rate_limit",
				app_icons::ICON_DOWNLOAD, _("Set _download rate limit")),
			sigc::bind<Traffic_type>(
				sigc::mem_fun(*this, &Main_window::on_change_rate_limit_callback),
				DOWNLOAD
			)
		);


		action_group->add(Gtk::Action::create("help", _("_Help")));
		action_group->add(
			Gtk::Action::create("about", Gtk::Stock::ABOUT, _("_About")),
			sigc::mem_fun(*this, &Main_window::on_show_about_dialog_callback)
		);

		this->gui->ui_manager->insert_action_group(action_group);

		Glib::ustring ui_info =
			"<ui>"
			"	<menubar name='menu_bar'>"

			"		<menu action='file'>"
			"			<menuitem action='create'/>"
			"			<menuitem action='open'/>"
			"			<menuitem action='open_magnet'/>"
			"			<menuitem action='quit'/>"
			"		</menu>"

			"		<menu action='edit'>"
			"			<menuitem action='statistics'/>"
			"			<menuitem action='preferences'/>"
			"		</menu>"

			"		<menu action='view'>"
			"			<menu action='toolbar'>"
			"				<menuitem action='toolbar/show'/>"
			"				<menu action='toolbar/style'>"
			"					<menuitem action='toolbar/style/default'/>"
			"					<menuitem action='toolbar/style/icons'/>"
			"					<menuitem action='toolbar/style/text'/>"
			"					<menuitem action='toolbar/style/both'/>"
			"					<menuitem action='toolbar/style/both_horiz'/>"
			"				</menu>"
			"			</menu>"
			"			<menu action='categories'>"
			"				<menuitem action='categories/show'/>"
			"				<menuitem action='categories/show_names'/>"
			"				<menuitem action='categories/show_counters'/>"
			"			</menu>"
			"		</menu>"

			"		<menu action='torrents'>"

			"			<menu action='resume'>"
			"				<menuitem action='resume/all'/>"
			"				<menuitem action='resume/uploads'/>"
			"				<menuitem action='resume/downloads'/>"
			"			</menu>"
			"			<menu action='pause'>"
			"				<menuitem action='pause/all'/>"
			"				<menuitem action='pause/uploads'/>"
			"				<menuitem action='pause/downloads'/>"
			"			</menu>"

			"			<separator/>"

			"			<menu action='resume_temporary'>"
			"				<menuitem action='resume_temporary/all'/>"
			"				<menuitem action='resume_temporary/uploads'/>"
			"				<menuitem action='resume_temporary/downloads'/>"
			"			</menu>"
			"			<menu action='pause_temporary'>"
			"				<menuitem action='pause_temporary/all'/>"
			"				<menuitem action='pause_temporary/uploads'/>"
			"				<menuitem action='pause_temporary/downloads'/>"
			"			</menu>"
			"			<menuitem action='complete_temporary_action'/>"
			"			<menuitem action='cancel_temporary_action'/>"

			"		</menu>"

			"		<menu action='help'>"
			"			<menuitem action='about'/>"
			"		</menu>"

			"	</menubar>"


			"	<popup name='appindicator'>"
			"		<menuitem action='app'/>"

			"		<separator/>"

			"		<menuitem action='open'/>"
			"		<menuitem action='open_magnet'/>"

			"		<separator/>"

			"		<menu action='resume'>"
			"			<menuitem action='resume/all'/>"
			"			<menuitem action='resume/uploads'/>"
			"			<menuitem action='resume/downloads'/>"
			"		</menu>"
			"		<menu action='pause'>"
			"			<menuitem action='pause/all'/>"
			"			<menuitem action='pause/uploads'/>"
			"			<menuitem action='pause/downloads'/>"
			"		</menu>"

			"		<separator/>"

			"		<menu action='resume_temporary'>"
			"			<menuitem action='resume_temporary/all'/>"
			"			<menuitem action='resume_temporary/uploads'/>"
			"			<menuitem action='resume_temporary/downloads'/>"
			"		</menu>"
			"		<menu action='pause_temporary'>"
			"			<menuitem action='pause_temporary/all'/>"
			"			<menuitem action='pause_temporary/uploads'/>"
			"			<menuitem action='pause_temporary/downloads'/>"
			"		</menu>"
			"		<menuitem action='complete_temporary_action'/>"
			"		<menuitem action='cancel_temporary_action'/>"

			"		<separator/>"

			"		<menuitem action='set_upload_rate_limit'/>"
			"		<menuitem action='set_download_rate_limit'/>"

			"		<separator/>"

			"		<menuitem action='quit'/>"
			"	</popup>"


			"	<popup name='tray_popup_menu'>"
			"		<menuitem action='open'/>"
			"		<menuitem action='open_magnet'/>"

			"		<separator/>"

			"		<menu action='resume'>"
			"			<menuitem action='resume/all'/>"
			"			<menuitem action='resume/uploads'/>"
			"			<menuitem action='resume/downloads'/>"
			"		</menu>"
			"		<menu action='pause'>"
			"			<menuitem action='pause/all'/>"
			"			<menuitem action='pause/uploads'/>"
			"			<menuitem action='pause/downloads'/>"
			"		</menu>"

			"		<separator/>"

			"		<menu action='resume_temporary'>"
			"			<menuitem action='resume_temporary/all'/>"
			"			<menuitem action='resume_temporary/uploads'/>"
			"			<menuitem action='resume_temporary/downloads'/>"
			"		</menu>"
			"		<menu action='pause_temporary'>"
			"			<menuitem action='pause_temporary/all'/>"
			"			<menuitem action='pause_temporary/uploads'/>"
			"			<menuitem action='pause_temporary/downloads'/>"
			"		</menu>"
			"		<menuitem action='complete_temporary_action'/>"
			"		<menuitem action='cancel_temporary_action'/>"

			"		<separator/>"

			"		<menuitem action='set_upload_rate_limit'/>"
			"		<menuitem action='set_download_rate_limit'/>"

			"		<separator/>"

			"		<menuitem action='quit'/>"
			"	</popup>"

			"</ui>";

		this->gui->ui_manager->add_ui_from_string(ui_info);
		this->add_accel_group(this->gui->ui_manager->get_accel_group());
	// Меню <--


	Gtk::VBox* main_vbox = Gtk::manage(new Gtk::VBox());
	this->add(*main_vbox);

	// Панель меню -->
		Gtk::Widget* menu_bar = this->gui->ui_manager->get_widget("/menu_bar");
		main_vbox->pack_start(*menu_bar, false, true);
	// Панель меню <--

	// Панель инструментов
	main_vbox->pack_start(this->gui->toolbar, false, false);

	// Список торрентов -->
		this->gui->torrents_viewport = Gtk::manage(new Torrents_viewport(main_window_settings.torrents_viewport));
		main_vbox->pack_start(*this->gui->torrents_viewport, true, true);

		// Настройки отдельных виджетов
		this->gui->torrents_viewport->get_log_view().set_max_lines(client_settings.gui.max_log_lines);
	// Список торрентов <--

	// status bar -->
	{
		Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment());
		alignment->property_top_padding() = m::gtk::VBOX_SPACING / 2;
		main_vbox->pack_start(*alignment, false, false);

		alignment->add(this->gui->status_bar);
		this->gui->status_bar.push("");
	}
	// status bar <--

	// AppIndicator -->
	#if HAVE_APP_INDICATOR
	{
		app_indicator_set_menu(this->gui->appindicator, GTK_MENU(
			gtk_ui_manager_get_widget(this->gui->ui_manager->gobj(), "/ui/appindicator")));

		g_signal_connect(G_OBJECT(this->gui->appindicator), APP_INDICATOR_SIGNAL_CONNECTION_CHANGED,
			G_CALLBACK(&Main_window::on_appindicator_connection_changed), this);
	}
	#endif
	// AppIndicator <--


	// Панель инструментов -->
	{
		// Заполнять ее лучше в самом конце, когда уже созданы все необходимые
		// виджеты.

		Gtk::ToolButton* button;


		button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::NEW));
		button->set_label(_("Create"));
		button->set_tooltip_text(_("Create a new torrent"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_create_callback)
		);

		button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::OPEN));
		button->set_label(_("Open"));
		button->set_tooltip_text(_("Open a torrent"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_open_callback)
		);


		button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::JUMP_TO));
		button->set_label(_("Magnet link"));
		button->set_tooltip_text(_("Open a magnet link"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_open_magnet_callback)
		);


		this->gui->toolbar.append(
			*Gtk::manage(new Gtk::SeparatorToolItem())
		);


		button = this->gui->toolbar_resume_button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::MEDIA_PLAY));
		button->set_label(_("Resume"));
		button->set_tooltip_text(_("Resume torrent(s)"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::bind<Torrent_process_action>(
				sigc::mem_fun(*this->gui->torrents_viewport, &Torrents_viewport::process_torrents),
				RESUME
			)
		);

		button = this->gui->toolbar_pause_button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::MEDIA_PAUSE));
		button->set_label(_("Pause"));
		button->set_tooltip_text(_("Pause torrent(s)"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::bind<Torrent_process_action>(
				sigc::mem_fun(*this->gui->torrents_viewport, &Torrents_viewport::process_torrents),
				PAUSE
			)
		);

		button = this->gui->toolbar_remove_button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::REMOVE));
		button->set_label(_("Remove"));
		button->set_tooltip_text(_("Remove torrent(s)"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::bind<Torrent_process_action>(
				sigc::mem_fun(*this->gui->torrents_viewport, &Torrents_viewport::process_torrents),
				REMOVE
			)
		);


		this->gui->toolbar.append(
			*Gtk::manage(new Gtk::SeparatorToolItem())
		);


		button = Gtk::manage(new Gtk::ToolButton());
		button->set_label(_("Statistics"));
		app_icons::set_for_tool_button(*button, app_icons::ICON_STATISTICS);
		button->set_tooltip_text(_("Statistics"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_show_statistics_callback)
		);

		button = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::PREFERENCES));
		button->set_label(_("Preferences"));
		button->set_tooltip_text(_("Preferences"));
		button->set_is_important();
		this->gui->toolbar.append(
			*button,
			sigc::mem_fun(*this, &Main_window::on_show_settings_window_callback)
		);


		this->gui->toolbar.show_all_children();
		if(get_client_settings().gui.show_toolbar)
			this->gui->toolbar.show();

		this->gui->toolbar.set_no_show_all();
	}
	// Панель инструментов <--


	// Устанавливаем интервал обновления GUI
	this->set_gui_update_interval(client_settings.gui.update_interval);

	// Обновление доступных в данный момент кнопок -->
		this->on_torrent_process_actions_changed_callback(0);

		gui->torrent_process_actions_changed_connection =
			this->gui->torrents_viewport->signal_torrent_process_actions_changed().connect(
				sigc::mem_fun(*this, &Main_window::on_torrent_process_actions_changed_callback)
			);
	// Обновление доступных в данный момент кнопок <--

	// Автоматическое сохранение настроек
	gui->autosave_settings_connection = Glib::signal_timeout().connect(
		sigc::mem_fun(*this, &Main_window::on_save_settings_timeout), SAVE_SETTINGS_INTERVAL
	);

	// Обработчик сигнала на изменение состояния окна
	this->signal_window_state_event().connect(sigc::mem_fun(
		*this, &Main_window::on_window_state_changed_callback
	));

	// Закрытие окна
	this->signal_delete_event().connect(sigc::mem_fun(*this, &Main_window::on_close_callback));

	if(client_settings.gui.show_tray_icon && client_settings.gui.hide_app_to_tray_at_startup)
		this->show_all_children();
	else
		this->show_all();

	// В gtkmm 2.16.0 (Ubuntu 9.04) есть небольшая бага, из-за которой
	// this->show_all() отображает даже элементы меню, для которых была
	// выполнена Gtk::Action::set_visible(false).
	// Поэтому скрываем элементы меню в самый последний момент.
	COMPATIBILITY
	gui->complete_temporary_action->set_visible(true);
	gui->cancel_temporary_action->set_visible(true);
}
Exemplo n.º 19
0
Gtk::Widget *
Widget_RendDesc::create_image_tab()
{
	Gtk::Alignment *paddedPanel = manage(new Gtk::Alignment(0, 0, 1, 1));
	paddedPanel->set_padding(12, 12, 12, 12);

	Gtk::Box *panelBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 12));
	panelBox->set_homogeneous(false);
	paddedPanel->add(*panelBox);

	Gtk::Frame *imageSizeFrame = manage(new Gtk::Frame(_("Image Size")));
	imageSizeFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) imageSizeFrame->get_label_widget())->set_markup(_("<b>Image Size</b>"));
//	panelBox->pack_start(*imageSizeFrame, false, false, 0);
	panelBox->pack_start(*imageSizeFrame, Gtk::PACK_SHRINK);

	Gtk::Alignment *tableSizePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	tableSizePadding->set_padding(6, 0, 24, 0);
	Gtk::Grid *imageSizeGrid = manage(new Gtk::Grid());

	tableSizePadding->add(*imageSizeGrid);
	imageSizeFrame->add(*tableSizePadding);

	Gtk::Label *size_width_label = manage(new Gtk::Label(_("_Width"), 0, 0.5, true));
	size_width_label->set_mnemonic_widget(*entry_width);

	Gtk::Label *size_height_label = manage(new Gtk::Label(_("_Height"), 0, 0.5, true));
	size_height_label->set_mnemonic_widget(*entry_height);

	Gtk::Label *size_xres_label = manage(new Gtk::Label(_("_XRes"), 0, 0.5, true));
	size_xres_label->set_mnemonic_widget(*entry_xres);

	Gtk::Label *size_yres_label = manage(new Gtk::Label(_("_YRes"), 0, 0.5, true));
	size_yres_label->set_mnemonic_widget(*entry_yres);

	Gtk::Label *size_physwidth_label = manage(new Gtk::Label(_("_Physical Width"), 0, 0.5, true));
	size_physwidth_label->set_mnemonic_widget(*entry_phy_width);

	Gtk::Label *size_physheight_label = manage(new Gtk::Label(_("Phy_sical Height"), 0, 0.5, true));
	size_physheight_label->set_mnemonic_widget(*entry_phy_height);

	imageSizeGrid->set_row_spacing(6);

	imageSizeGrid->attach(*size_width_label, 		0, 0, 1, 1);
	imageSizeGrid->attach(*size_height_label, 		0, 1, 1, 1);
	entry_width->set_hexpand(true);
	entry_height->set_hexpand(true);
	imageSizeGrid->attach(*entry_width, 			1, 0, 1, 1);
	imageSizeGrid->attach(*entry_height, 			1, 1, 1, 1);
	toggle_wh_ratio->set_margin_right(6);
	imageSizeGrid->attach(*toggle_wh_ratio, 		2, 0, 1, 2);

	imageSizeGrid->attach(*size_xres_label, 		3, 0, 1, 1);
	imageSizeGrid->attach(*size_yres_label, 		3, 1, 1, 1);
	entry_xres->set_hexpand(true);
	entry_yres->set_hexpand(true);
	imageSizeGrid->attach(*entry_xres, 				4, 0, 1, 1);
	imageSizeGrid->attach(*entry_yres, 				4, 1, 1, 1);
	toggle_res_ratio->set_margin_right(6);
	imageSizeGrid->attach(*toggle_res_ratio,		5, 0, 1, 2);

	imageSizeGrid->attach(*size_physwidth_label,	6, 0, 1, 1);
	imageSizeGrid->attach(*size_physheight_label,	6, 1, 1, 1);
	entry_phy_width->set_hexpand(true);
	entry_phy_height->set_hexpand(true);
	imageSizeGrid->attach(*entry_phy_width,			7, 0, 1, 1);
	imageSizeGrid->attach(*entry_phy_height,		7, 1, 1, 1);

	imageSizeGrid->attach(*pixel_ratio_label,		0, 3, 3, 1);

	Gtk::Frame *imageAreaFrame = manage(new Gtk::Frame(_("Image Area")));
	imageAreaFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) imageAreaFrame->get_label_widget())->set_markup(_("<b>Image Area</b>"));
	//panelBox->pack_start(*imageAreaFrame, false, false, 0);
	panelBox->pack_start(*imageAreaFrame, Gtk::PACK_SHRINK);

	Gtk::Alignment *imageAreaPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	imageAreaPadding->set_padding(6, 0, 24, 0);
	imageAreaFrame->add(*imageAreaPadding);

	Gtk::Box *imageAreaBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,12));
	Gtk::Box *imageAreaTlbrLabelBox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL,6));
	Gtk::Box *imageAreaTlbrBox = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL,6));
	Gtk::Box *imageAreaSpanBox = manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL,6));
	imageAreaPadding->add(*imageAreaBox);

	Gtk::Label *imageAreaTopLeftLabel = manage(new Gtk::Label(_("_Top Left"), 0, 0.5, true));
	imageAreaTopLeftLabel->set_mnemonic_widget(*entry_tl);

	Gtk::Label *imageAreaBottomRightLabel = manage(new Gtk::Label(_("_Bottom Right"), 0, 0.5, true));
	imageAreaBottomRightLabel->set_mnemonic_widget(*entry_br);

	Gtk::Label *size_span = manage(new Gtk::Label(_("I_mage Span"), 0, 0.5, true));
	size_span->set_mnemonic_widget(*entry_span);

	imageAreaTlbrLabelBox->pack_start(*imageAreaTopLeftLabel);
	imageAreaTlbrLabelBox->pack_start(*imageAreaBottomRightLabel);
	imageAreaTlbrBox->pack_start(*entry_tl);
	imageAreaTlbrBox->pack_start(*entry_br);

	imageAreaSpanBox->pack_start(*size_span);
	imageAreaSpanBox->pack_start(*entry_span);

	imageAreaBox->pack_start(*imageAreaTlbrLabelBox);
	imageAreaBox->pack_start(*imageAreaTlbrBox);
	imageAreaBox->pack_start(*imageAreaSpanBox);

	paddedPanel->show_all();
	return paddedPanel;
}
Exemplo n.º 20
0
//dialog_previewoptions stuff
Dialog_PreviewOptions::Dialog_PreviewOptions()
:Dialog(_("Preview Options")),
adj_zoom(Gtk::Adjustment::create(0.5,0.1,5.0,0.1,0.2)),
adj_fps(Gtk::Adjustment::create(12,1,120,1,5)),
check_overbegin(_("_Begin time"),false),
check_overend(_("_End time"),false),
settings(this,"prevoptions")
{
	//framerate = 15.0f;
	//zoom = 0.2f;

	//set the fps of the time widgets
	Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	dialogPadding->set_padding(12, 12, 12, 12);
	get_vbox()->add(*dialogPadding);

	Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
	dialogPadding->add(*dialogBox);

	Gtk::Frame *generalFrame = manage(new Gtk::Frame(_("General settings")));
	generalFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) generalFrame->get_label_widget())->set_markup(_("<b>General settings</b>"));
	dialogBox->pack_start(*generalFrame, false, false, 0);

	Gtk::Alignment *generalPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	generalPadding->set_padding(6, 0, 24, 0);
	generalFrame->add(*generalPadding);

	Gtk::Table *generalTable = manage(new Gtk::Table(2, 2, false));
	generalTable->set_row_spacings(6);
	generalTable->set_col_spacings(12);
	generalPadding->add(*generalTable);

	Gtk::Label *zoomLabel = manage(new Gtk::Label(_("_Quality")));
	zoomLabel->set_alignment(0, 0.5);
	zoomLabel->set_use_underline(TRUE);
	Gtk::SpinButton *zoomSpinner = manage(new Gtk::SpinButton(adj_zoom, 0.1, 2));
	zoomLabel->set_mnemonic_widget(*zoomSpinner);
	zoomSpinner->set_alignment(1);
	generalTable->attach(*zoomLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	generalTable->attach(*zoomSpinner, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *fpsLabel = manage(new Gtk::Label(_("_FPS")));
	fpsLabel->set_alignment(0, 0.5);
	fpsLabel->set_use_underline(TRUE);
	Gtk::SpinButton *fpsSpinner = manage(new Gtk::SpinButton(adj_fps, 1, 1));
	fpsLabel->set_mnemonic_widget(*fpsSpinner);
	fpsSpinner->set_alignment(1);
	generalTable->attach(*fpsLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	generalTable->attach(*fpsSpinner, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Frame *timeFrame = manage(new Gtk::Frame(_("Time settings")));
	timeFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) timeFrame->get_label_widget())->set_markup(_("<b>Time settings</b>"));
	dialogBox->pack_start(*timeFrame, false, false, 0);

	Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	timePadding->set_padding(6, 0, 24, 0);
	timeFrame->add(*timePadding);

	Gtk::Table *timeTable = manage(new Gtk::Table(2, 2, false));
	timeTable->set_row_spacings(6);
	timeTable->set_col_spacings(12);
	timePadding->add(*timeTable);

	check_overbegin.set_alignment(0, 0.5);
	check_overbegin.set_use_underline(TRUE);
	check_overend.set_alignment(0, 0.5);
	check_overend.set_use_underline(TRUE);
	time_begin.set_alignment(1);
	time_end.set_alignment(1);
	timeTable->attach(check_overbegin, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(time_begin, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(check_overend, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(time_end, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	check_overbegin.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overbegin_toggle));
	check_overend.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overend_toggle));

	Gtk::Button *cancelButton = manage(new Gtk::Button(Gtk::StockID("gtk-cancel")));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_PreviewOptions::on_cancel_pressed));
	add_action_widget(*cancelButton, 1);
	cancelButton->show();

	Gtk::Button *okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-go-forward")));
	okbutton->set_label(_("Preview"));
	okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_ok_pressed));
	add_action_widget(*okbutton, 0);
	okbutton->show();

	time_begin.set_sensitive(false);
	time_end.set_sensitive(false);
	show_all();
}