Example #1
0
DlgDownload::DlgDownload(){
  add_button (Gtk::Stock::OK,     Gtk::RESPONSE_OK);
  add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  signal_response().connect(
      sigc::hide(sigc::mem_fun(this, &DlgDownload::hide_all)));

  cb_w   = manage(new Gtk::CheckButton("Waypoints"));
  cb_a   = manage(new Gtk::CheckButton("Active log"));
  cb_o   = manage(new Gtk::CheckButton("Saved tracks"));
  Gtk::VButtonBox * bbox =  manage(new Gtk::VButtonBox);
  bbox->add(*cb_w);
  bbox->add(*cb_a);
  bbox->add(*cb_o);
  Gtk::Frame * frame =
    manage(new Gtk::Frame("Select data to be downloaded:"));
  frame->add(*bbox);

  Gtk::Label * l_dev =
    manage(new Gtk::Label("GPS device:", Gtk::ALIGN_RIGHT));
  e_dev = manage(new Gtk::Entry);

  cb_off = manage(new Gtk::CheckButton("Turn off device after download"));

  Gtk::Table * table = manage(new Gtk::Table(2,3));
  table->attach(*frame,  0,2, 0,1, Gtk::FILL, Gtk::SHRINK, 3,3);
  table->attach(*l_dev,  0,1, 1,2, Gtk::SHRINK, Gtk::SHRINK, 3,3);
  table->attach(*e_dev,  1,2, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 3,3);
  table->attach(*cb_off, 0,2, 2,3, Gtk::FILL, Gtk::SHRINK, 3,3);

  get_vbox()->add(*table);
}
Example #2
0
bool VRGuiBits::toggleFullscreen(GdkEventKey* k) {
    if (k->keyval != 65480) return false;
    static bool fs = false;
    fs = !fs;

    Gtk::Window* win; VRGuiBuilder()->get_widget("window1", win);
    Gtk::Separator* hs1; VRGuiBuilder()->get_widget("hseparator1", hs1);
    Gtk::Table* tab; VRGuiBuilder()->get_widget("table20", tab);
    Gtk::Notebook* nb1; VRGuiBuilder()->get_widget("notebook1", nb1);
    Gtk::Box* hb1; VRGuiBuilder()->get_widget("hbox1", hb1);

    if (fs) {
        win->fullscreen();
        nb1->hide();
        hb1->hide();
        tab->hide();
        hs1->hide();
        gtk_widget_hide(term_box);
    } else {
        win->unfullscreen();
        win->show_all();
    }

    return true;
}
Example #3
0
PreviewHolder::PreviewHolder() :
    VBox(),
    PreviewFillable(),
    _scroller(0),
    _insides(0),
    _prefCols(0),
    _updatesFrozen(false),
    _anchor(SP_ANCHOR_CENTER),
    _baseSize(PREVIEW_SIZE_SMALL),
    _ratio(100),
    _view(VIEW_TYPE_LIST),
    _wrap(false),
    _border(BORDER_NONE)
{
    _scroller = manage(new Gtk::ScrolledWindow());
    _insides = manage(new Gtk::Table( 1, 2 ));
    _insides->set_col_spacings( 8 );

    // Add a container with the scroller and a spacer
    Gtk::Table* spaceHolder = manage( new Gtk::Table(1, 2) );
    _scroller->add( *_insides );
    spaceHolder->attach( *_scroller, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );

    pack_start(*spaceHolder, Gtk::PACK_EXPAND_WIDGET);
}
Example #4
0
Gtk::Widget* CodeView::add_scrolled_window()
{
    Gtk::Table* table = new Gtk::Table(2, 2, false);
    table->attach(*this, 0, 1, 0, 1);

    Gtk::VScrollbar* sb =
        manage(new Gtk::VScrollbar(*get_vadjustment()));
    table->attach(*sb, 1, 2, 0, 1, Gtk_FLAG(FILL));

    return table;
}
Example_AffineController::Example_AffineController()
{
  set_title("Selector Example");
  set_border_width(10);

  Gtk::Table* table = Gtk::manage( new Gtk::Table() );

  // Create the selector
  m_AffineController = Papyrus::AffineController::create();
  m_AffineController->add( m_Viewport.canvas() );

  m_Viewport.canvas()->set_size( 300, 200 );

  // Create some shapes to add to the group
  Papyrus::Rectangle::pointer rectangle = Papyrus::example_rectangle( );
  Papyrus::Circle::pointer circle = Papyrus::example_circle( );
  Papyrus::Arc::pointer arc = Papyrus::example_arc( );
  Papyrus::Circle::pointer center_dot = Papyrus::Circle::create( 2.0, Papyrus::RGBA(0.0, 0.0, 0.0) );

  // Add the shapes to the group
  m_Viewport.canvas()->add( rectangle );
  m_Viewport.canvas()->add( circle );
  m_Viewport.canvas()->add( arc );
  m_Viewport.canvas()->add( center_dot );

  // Translate the shapes so they don't necessarily overlap
  rectangle->set_xywh(0, -60, 50, 30);
  circle->translate(40, 20);
  circle->set_radius(25);
  arc->translate(0, 20);

  table->attach( m_Viewport, 0, 3, 0, 1 );

  // Put Gtk labels and spin buttons for the various matrix effects in the table
  Gtk::Label* label;
  Gtk::Button* reset;
  for ( unsigned i=0; i < SCALES; i++ )
  {
    label = Gtk::manage( new Gtk::Label( label_string[i], Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER ) );
    table->attach( *label, 0, 1, i+1, i+2, Gtk::FILL );
    reset = Gtk::manage( new Gtk::Button("Reset") );
    reset->signal_clicked().connect( sigc::bind(sigc::mem_fun(*this, &Example_AffineController::on_reset), (Scale)i));
    table->attach( *reset, 2, 3, i+1, i+2, Gtk::SHRINK, Gtk::SHRINK );
    m_scale[i] = Gtk::manage( new Gtk::HScale(adjustments[i][0], adjustments[i][1], adjustments[i][2] ) );
    m_scale[i]->set_value( adjustments[i][3] );
    m_scale[i]->signal_value_changed().connect( sigc::bind( sigc::mem_fun(*this, &Example_AffineController::on_scale_changed), (Scale)i ));
    table->attach( *(m_scale[i]), 1, 2, i+1, i+2 );
  }

  this->add( *table );

  show_all();
}
Example #6
0
void ApplicationWizard::add_row(Gtk::Table& table, int row,
                                const Glib::RefPtr<Gtk::SizeGroup>& size_group,
                                const Glib::ustring& label_text,
                                Gtk::Widget& entry, Gtk::Button* btn)
{
    Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(label_text, true));
    pLabel->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_BOTTOM);

    table.attach(*pLabel, 0, 1, row, row + 1, Gtk::FILL, Gtk::AttachOptions(0));
    table.attach(entry, 1, 2, row, row + 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(0));
    if(btn)
        table.attach(*btn, 2, 3, row, row + 1, Gtk::SHRINK, Gtk::AttachOptions(0));
}
Gtk::Widget *FileSystemSyncServiceAddin::create_preferences_control(EventHandler requiredPrefChanged)
{
  Gtk::Table *table = new Gtk::Table(1, 2, false);
  table->set_row_spacings(5);
  table->set_col_spacings(10);

  // Read settings out of gconf
  std::string syncPath;
  if(get_config_settings(syncPath) == false) {
    syncPath = "";
  }

  Gtk::Label *l = new Gtk::Label(_("_Folder Path:"), true);
  l->property_xalign() = 1;
  table->attach(*l, 0, 1, 0, 1,
                Gtk::FILL,
                Gtk::EXPAND | Gtk::FILL,
                0, 0);

  m_path_button = new Gtk::FileChooserButton(_("Select Synchronization Folder..."),
    Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
  m_path_button->signal_current_folder_changed().connect(requiredPrefChanged);
  l->set_mnemonic_widget(*m_path_button);
  m_path_button->set_filename(syncPath);

  table->attach(*m_path_button, 1, 2, 0, 1,
                Gtk::EXPAND | Gtk::FILL,
                Gtk::EXPAND | Gtk::FILL,
                0, 0);

  table->set_hexpand(true);
  table->set_vexpand(false);
  table->show_all();
  return table;
}
Example #8
0
void PrefPage::appendNamedWidget(const std::string& name, Gtk::Widget& widget)
{
	Gtk::Table* table = Gtk::manage(new Gtk::Table(1, 3, true));

	table->set_col_spacings(4);
	table->set_row_spacings(0);

	table->attach(*Gtk::manage(new gtkutil::LeftAlignedLabel(name)),
				  0, 1, 0, 1,
				  Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(0));

	table->attach(widget, 1, 3, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(0));

	_vbox->pack_start(*table, false, false, 0);
}
Example #9
0
		ZoomControl(MainWindow *mw) : Gtk::Frame("Zoom control"), _mw(mw) {
			mode = RE_AX;
			set_border_width(10);
			tbl = Gtk::manage(new Gtk::Table(2,4));
			Gtk::RadioButton *b;
#define RADIO(LABEL,X1,Y1,MODE) do {							\
	b = Gtk::manage(new Gtk::RadioButton(grp, LABEL));			\
	tbl->attach(*b, X1, X1+1, Y1, Y1+1);						\
	b->signal_toggled().connect(sigc::bind<Gtk::ToggleButton*, mode_t>(	\
				sigc::mem_fun(*this, &ZoomControl::do_toggle), 	\
				b, MODE));										\
} while(0)

			RADIO("Real (x) axis length", 0, 0, RE_AX);
			RADIO("Imag (y) axis length", 1, 0, IM_AX);
			RADIO("Real (x) pixel size", 0, 1, RE_PIX);
			RADIO("Imag (y) pixel size", 1, 1, IM_PIX);
			RADIO("Zoom factor", 0, 2, ZOOM);

			field = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
			field->set_activates_default(true);
			tbl->attach(*field, 0, 2, 3, 4);

			add(*tbl);
		}
Example #10
0
Example_Scaler::Example_Scaler()
{
  Gtk::HBox* hbox;
  Gtk::VBox* vbox;

  set_title("Scaler Example");

  m_Scaler = Papyrus::Scaler::create( );
  m_Viewport.add_controller( m_Scaler );

  m_Viewport.set_size_request( 300, 200 );

  // Create some shapes to add to the group
  Papyrus::Arc::pointer arc = Papyrus::example_arc( );

  // Add the shapes to the group
  m_Viewport.canvas()->add( arc );
  m_Scaler->add( arc );

  vbox = Gtk::manage( new Gtk::VBox() );
  vbox->pack_start( m_Viewport );
  vbox->pack_start( *Gtk::manage( new Gtk::HSeparator() ) );

  Gtk::Table* table;

  table = Gtk::manage( new Gtk::Table() );
  m_side_buttons[0].set_label("Top");
  m_side_buttons[1].set_label("Right");
  m_side_buttons[2].set_label("Bottom");
  m_side_buttons[3].set_label("Left");
  table->attach( m_side_buttons[0], 1, 2, 0, 1 );
  table->attach( m_side_buttons[1], 2, 3, 1, 2 );
  table->attach( m_side_buttons[2], 1, 2, 2, 3 );
  table->attach( m_side_buttons[3], 0, 1, 1, 2 );
  for ( int i=0; i < 4; i++ )
  {
    m_side_buttons[i].set_active(true);
    m_side_buttons[i].signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &Example_Scaler::on_button_toggled), i ) );
  }

  vbox->pack_start( *table );

  this->add( *vbox );

  show_all();
}
Example #11
0
				NewDialog(Gtk::Window *parent):
					Gtk::Dialog(_("New project"), *this, true),
					xmlmode(_("Read image names in _XML Altos"), true),
					filemode(_("Match images and XML Altos _filenames"), true),
					xmlpath(_("Path to the XML Alto files"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER),
					imgpath(_("Path to the images"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER),
					showimgpath(_("_Images are in a different folder"), true),
					imgpathlab(_("Images path"))
				{
					add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
					okbut = add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
					okbut->set_sensitive(false);
					std::vector<int> altbut;
					altbut.push_back(Gtk::RESPONSE_ACCEPT);
					altbut.push_back(Gtk::RESPONSE_CANCEL);
					set_alternative_button_order_from_array(altbut);	
					set_default_response(Gtk::RESPONSE_ACCEPT);

					Gtk::Table *tab = Gtk::manage(new Gtk::Table(6, 2));
					get_vbox()->pack_start(*tab, true, true);
					tab->attach(*Gtk::manage(new Gtk::Label(_("Project name"))), 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
					tab->attach(projectname, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					projectname.signal_changed().connect(sigc::mem_fun(this, &NewDialog::on_name_changed));
					projectname.set_activates_default(true);
					Gtk::RadioButton::Group g;
					xmlmode.set_group(g);
					tab->attach(xmlmode, 0, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					filemode.set_group(g);
					tab->attach(filemode, 0, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					xmlmode.set_active(false);
					xmlmode.signal_toggled().connect(sigc::mem_fun(this, &NewDialog::on_mode_changed));
					tab->attach(*Gtk::manage(new Gtk::Label(_("XML Altos path"))), 0, 1, 3, 4, Gtk::FILL, Gtk::FILL);
					tab->attach(xmlpath, 1, 2, 3, 4, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					xmlpath.signal_current_folder_changed().connect(sigc::mem_fun(this, &NewDialog::on_xml_folder_changed));
					tab->attach(showimgpath, 0, 2, 4, 5, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
					showimgpath.set_active(false);
					showimgpath.signal_toggled().connect(sigc::mem_fun(this, &NewDialog::on_show_img_path));
					show_all();
					tab->attach(imgpathlab, 0, 1, 5, 6, Gtk::FILL, Gtk::FILL);
					tab->attach(imgpath, 1, 2, 5, 6, Gtk::FILL|Gtk::EXPAND, Gtk::FILL);
				}
void PanelRecords::cargarVentana() {
	Gtk::Table* tabla = manage(new Gtk::Table(records.size(), 3, true));
	tabla->set_row_spacings(10);
	unsigned int contador = 0;
	list< pair<string, int> >::iterator iterador = records.begin();
	while (contador < records.size()) {
		std::stringstream ss;
		ss << (contador+1);
		Gtk::Label* etiquetaNumero = manage(new Gtk::Label(ss.str()));
		tabla->attach(*etiquetaNumero, 0, 1, contador, contador+1);
		Gtk::Label* etiquetaNombre = manage(new Gtk::Label(iterador->first));
		tabla->attach(*etiquetaNombre, 1, 2, contador, contador+1);
		std::stringstream ss_dos;
		ss_dos << iterador->second;
		Gtk::Label* etiquetaPuntaje = manage(new Gtk::Label(ss_dos.str()));
		tabla->attach(*etiquetaPuntaje, 2, 3, contador, contador+1);
		++iterador;
		++contador;
	}
	ventana->add(*tabla);
}
Gtk::Widget *WebDavSyncServiceAddin::create_preferences_control(EventHandler requiredPrefChanged)
{
  Gtk::Table *table = new Gtk::Table(3, 2, false);
  table->set_row_spacings(5);
  table->set_col_spacings(10);

  // Read settings out of gconf
  Glib::ustring url, username, password;
  get_config_settings(url, username, password);

  m_url_entry = new Gtk::Entry();
  m_url_entry->set_text(url);
  m_url_entry->signal_changed().connect(requiredPrefChanged);
  add_row(table, m_url_entry, _("_URL:"), 0);

  m_username_entry = new Gtk::Entry();
  m_username_entry->set_text(username);
  m_username_entry->signal_changed().connect(requiredPrefChanged);
  add_row(table, m_username_entry, _("User_name:"), 1);

  m_password_entry = new Gtk::Entry();
  m_password_entry->set_text(password);
  m_password_entry->set_visibility(false);
  m_password_entry->signal_changed().connect(requiredPrefChanged);
  add_row(table, m_password_entry, _("_Password:"), 2);

  table->set_hexpand(true);
  table->set_vexpand(false);
  table->show_all();
  return table;
}
Example #14
0
ParamsDialog::ParamsDialog(MainWindow *_mw) : Gtk::Dialog("Parameters", *_mw, true),
	mw(_mw)
{
	add_button(Gtk::Stock::CANCEL, Gtk::ResponseType::RESPONSE_CANCEL);
	add_button(Gtk::Stock::OK, Gtk::ResponseType::RESPONSE_OK);

	Gtk::Box* box = get_vbox();
	Gtk::Table *tbl = Gtk::manage(new Gtk::Table(3,2));

	f_c_re = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_re->set_activates_default(true);
	f_c_im = Gtk::manage(new Util::HandyEntry<Fractal::Value>());
	f_c_im->set_activates_default(true);

	zc = Gtk::manage(new ZoomControl(mw));

	Gtk::Label* label;

	label = Gtk::manage(new Gtk::Label("Centre Real (x) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 0, 1);
	tbl->attach(*f_c_re, 1, 2, 0, 1);

	label = Gtk::manage(new Gtk::Label("Centre Imaginary (y) "));
	label->set_alignment(1, 0.5);
	tbl->attach(*label, 0, 1, 1, 2);
	tbl->attach(*f_c_im, 1, 2, 1, 2);

	tbl->attach(*zc, 0, 2, 2, 3);

	box->pack_start(*tbl);
	set_default_response(Gtk::ResponseType::RESPONSE_OK);
}
Example #15
0
DirectoriesConfigDialog::DirectoriesConfigDialog(Config::Section * _poConfig) :
  Gtk::Dialog(_("Directories config"), true, true),
  m_poConfig(_poConfig)
{
  Gtk::Table * poTable = Gtk::manage( new Gtk::Table(G_N_ELEMENTS(m_astDirs), 2, false));
  poTable->set_border_width(5);
  poTable->set_spacings(5);

  for (guint i = 0; i < G_N_ELEMENTS(m_astDirs); i++)
  {
    Gtk::Label * poLabel = Gtk::manage( new Gtk::Label(gettext(m_astDirs[i].m_csLabel), Gtk::ALIGN_RIGHT) );
    m_poButtons[i] = Gtk::manage( new Gtk::FileChooserButton(Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER) );
    m_poButtons[i]->set_current_folder(m_poConfig->sGetKey(m_astDirs[i].m_csKey));

    poTable->attach(* poLabel, 0, 1, i, i + 1);
    poTable->attach(* m_poButtons[i], 1, 2, i, i + 1);
  }

  add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
  get_vbox()->pack_start(* poTable);
  show_all_children();
}
Example #16
0
studio::Dock_Info::Dock_Info()
:Dock_CanvasSpecific("info",_("Info"),Gtk::StockID("synfig-info"))
{
	set_use_scrolled(false);

	Gtk::Table *table = manage(new Gtk::Table);

	//pos labels
	table->attach(*manage(new Gtk::Label(_("X: "))),0,1,0,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	table->attach(*manage(new Gtk::Label(_("Y: "))),0,1,2,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);

	//pos
	table->attach(x,1,2,0,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	table->attach(y,1,2,2,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);

	//separator
	table->attach(*manage(new Gtk::VSeparator),2,3,0,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);

	//color label
	table->attach(*manage(new Gtk::Label(_("R: "))),3,4,0,1,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	table->attach(*manage(new Gtk::Label(_("G: "))),3,4,1,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	table->attach(*manage(new Gtk::Label(_("B: "))),3,4,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	table->attach(*manage(new Gtk::Label(_("A: "))),3,4,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);

	//color
	table->attach(r,4,5,0,1,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	table->attach(g,4,5,1,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	table->attach(b,4,5,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	table->attach(a,4,5,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);

	table->attach(*manage(new Gtk::Label),0,5,4,5);

	table->show_all();

	add(*table);
}
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));
}
Example #18
0
void
StateBrush_Context::refresh_tool_options()
{
	brush_buttons.clear();
	App::dialog_tool_options->clear();
	App::dialog_tool_options->set_local_name(_("Brush Tool"));
	App::dialog_tool_options->set_name("brush");

	// create container
	Gtk::Table *table = Gtk::manage(new Gtk::Table(1, 2, false));

	// create options
	table->attach(eraser_checkbox, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);

	// create brushes container widget
	int cols = 4;
	Gtk::Table *brushes_table = Gtk::manage(new Gtk::Table(1, cols));

	// load brushes
	// scan directories
	std::set<String> files;
	for(std::set<String>::const_iterator i = paths.begin(); i != paths.end(); ++i)
		scan_directory(*i, 1, files);

	// load files
	int col = 0; int row = 0;
	Gtk::ToggleButton *first_button = NULL;
	Gtk::IconSize iconsize = Gtk::ICON_SIZE_LARGE_TOOLBAR;
	for(std::set<String>::const_iterator i = files.begin(); i != files.end(); ++i)
	{
		if (!brush_buttons.count(*i) && filename_extension(*i) == ".myb")
		{
			const String &brush_file = *i;
			const String icon_file = filename_sans_extension(brush_file) + "_prev.png";
			if (files.count(icon_file))
			{
				// create button
				Gtk::ToggleButton *button = brush_buttons[*i] = Gtk::manage(new Gtk::ToggleButton());
				Glib::RefPtr<Gdk::Pixbuf> pixbuf, pixbuf_scaled;
				pixbuf = Gdk::Pixbuf::create_from_file(icon_file);
				pixbuf_scaled = pixbuf->scale_simple(48, 48, Gdk::INTERP_BILINEAR);
				button->set_image(*Gtk::manage(new Gtk::Image(pixbuf_scaled)));
				button->set_relief(Gtk::RELIEF_NONE);
				button->signal_toggled().connect(
					sigc::bind(sigc::mem_fun(*this, &StateBrush_Context::select_brush), button, brush_file) );
				if (first_button == NULL) first_button = button;

				if (col >= cols)
				{
					// add row
					col = 0;
					++row;
					brushes_table->resize(row + 1, cols);
				}

				// add button
				brushes_table->attach(*button, col, col+1, row, row+1);
				++col;
			}
		}
	}
	Gtk::ScrolledWindow *brushes_scroll = Gtk::manage(new Gtk::ScrolledWindow());
	brushes_scroll->add(*brushes_table);
	table->attach(*brushes_scroll, 0, 1, 1, 2);

	table->show_all();
	App::dialog_tool_options->add(*table);

	// select first brush
	if (first_button != NULL) first_button->set_active(true);
}
Gtk::Widget& DifficultyEditor::createEditingWidgets()
{
	_editorPane = Gtk::manage(new Gtk::VBox(false, 6));
	_editorPane->set_border_width(12);

	// The "Settings" label
	Gtk::Label* settingsLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(std::string("<b>") + _("Setting") + "</b>"));
	_editorPane->pack_start(*settingsLabel, false, false, 0);

	// The table aligning the editing widgets
	Gtk::Table* table = Gtk::manage(new Gtk::Table(3, 2, false));
    table->set_col_spacings(12);
    table->set_row_spacings(6);

	_editorPane->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*table, 18, 1.0)), false, false, 0);

	// ===== CLASSNAME ======

	Gtk::Label* classNameLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Classname:")));

	// Add classname widget
	_classCombo = Gtk::manage(new Gtk::ComboBoxEntry(
		ClassNameStore::Instance().getModel(),
		ClassNameStore::Instance().getColumns().classname
	));

	// Add completion functionality to the combobox entry
	Glib::RefPtr<Gtk::EntryCompletion> completion = Gtk::EntryCompletion::create();
	completion->set_model(ClassNameStore::Instance().getModel());
	completion->set_text_column(ClassNameStore::Instance().getColumns().classname);

	_classCombo->get_entry()->set_completion(completion);

	table->attach(*classNameLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*_classCombo, 1, 2, 0, 1);

	// ===== SPAWNARG ======
	_spawnArgEntry = Gtk::manage(new Gtk::Entry);
	Gtk::Label* spawnArgLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Spawnarg:")));

	table->attach(*spawnArgLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*_spawnArgEntry, 1, 2, 1, 2);

	// ===== ARGUMENT ======
	_argumentEntry = Gtk::manage(new Gtk::Entry);
	Gtk::Label* argumentLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Argument:")));

	// The appType chooser
	_appTypeCombo = Gtk::manage(new Gtk::ComboBox(difficulty::Setting::getAppTypeStore()));
	_appTypeCombo->signal_changed().connect(sigc::mem_fun(*this, &DifficultyEditor::onAppTypeChange));

	// Add the cellrenderer for the apptype text
	Gtk::CellRendererText* appTypeRenderer = Gtk::manage(new Gtk::CellRendererText);

	_appTypeCombo->pack_start(*appTypeRenderer, false);
	_appTypeCombo->add_attribute(appTypeRenderer->property_text(), difficulty::Setting::getTreeModelColumns().name);

	// Pack the argument entry and the appType dropdown field together
	Gtk::HBox* argHBox = Gtk::manage(new Gtk::HBox(false, 6));
	argHBox->pack_start(*_argumentEntry, true, true, 0);
	argHBox->pack_start(*_appTypeCombo, false, false, 0);

	table->attach(*argumentLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*argHBox, 1, 2, 2, 3);

	// Save button
	Gtk::HBox* buttonHbox = Gtk::manage(new Gtk::HBox(false, 6));

	_saveSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::SAVE));
	_saveSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingSave));

	buttonHbox->pack_start(*_saveSettingButton, false, false, 0);
	_editorPane->pack_start(*Gtk::manage(new gtkutil::RightAlignment(*buttonHbox)), false, false, 0);

	// The "note" text
	_noteText = Gtk::manage(new Gtk::Label);
	_noteText->set_line_wrap(true);
	_editorPane->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*_noteText)), false, false, 6);

	return *_editorPane;
}
ModelGeneratorCreationDialog::ModelGeneratorCreationDialog(
    openfluid::core::CoreRepository& CoreRepos,
    openfluid::machine::ModelInstance* ModelInstance) :
  mp_CoreRepos(&CoreRepos), mp_ModelInstance(ModelInstance)
{
  mp_VarNameEntry = Gtk::manage(new Gtk::Entry());
  mp_VarNameEntry->set_activates_default(true);
  mp_VarNameEntry->signal_changed().connect(sigc::mem_fun(*this,
      &ModelGeneratorCreationDialog::onVarNameEntryChanged));

  mp_ClassCombo = Gtk::manage(new Gtk::ComboBoxText());

  Gtk::RadioButton::Group RadioGrp;

  mp_ScalarRadio = Gtk::manage(
      new Gtk::RadioButton(RadioGrp, _("Double Value")));
  mp_VectorRadio = Gtk::manage(new Gtk::RadioButton(RadioGrp,
      _("Vector Value:") + std::string(" ")));

  mp_VarSizeSpin = Gtk::manage(new Gtk::SpinButton());
  mp_VarSizeSpin->set_numeric(true);
  mp_VarSizeSpin->set_increments(1, 1);
  mp_VarSizeSpin->set_range(2.0, 9.0);
  mp_VarSizeSpin->set_activates_default(true);

  Gtk::Table* GenInfoTable = Gtk::manage(new Gtk::Table());
  GenInfoTable->set_row_spacings(10);
  GenInfoTable->set_col_spacings(3);
  GenInfoTable->attach(
      *Gtk::manage(new Gtk::Label(_("Variable name"), 1, 0.5)), 0, 1, 0, 1,
      Gtk::FILL, Gtk::SHRINK);
  GenInfoTable->attach(*mp_VarNameEntry, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
  GenInfoTable->attach(*Gtk::manage(new Gtk::Label(_("Unit class"), 1, 0.5)),
      0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK);
  GenInfoTable->attach(*mp_ClassCombo, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK);

  Gtk::HBox* VectorBox = Gtk::manage(new Gtk::HBox());
  VectorBox->pack_start(*mp_VectorRadio, Gtk::PACK_SHRINK);
  VectorBox->pack_start(*Gtk::manage(new Gtk::Label(_("Size"))),
      Gtk::PACK_SHRINK);
  VectorBox->pack_start(*mp_VarSizeSpin, Gtk::PACK_SHRINK);

  mp_Dialog = new Gtk::Dialog(_("Generator creation"));

  mp_InfoBarLabel = Gtk::manage(new Gtk::Label(""));

  mp_InfoBar = Gtk::manage(new Gtk::InfoBar());
  mp_InfoBar->set_message_type(Gtk::MESSAGE_WARNING);
  ((Gtk::Container*) mp_InfoBar->get_content_area())->add(*mp_InfoBarLabel);

  mp_Dialog->get_vbox()->pack_start(*mp_InfoBar, Gtk::PACK_SHRINK);
  mp_Dialog->get_vbox()->pack_start(*GenInfoTable, Gtk::PACK_SHRINK, 10);
  mp_Dialog->get_vbox()->pack_start(*mp_ScalarRadio, Gtk::PACK_SHRINK);
  mp_Dialog->get_vbox()->pack_start(*VectorBox, Gtk::PACK_SHRINK, 10);

  mp_Dialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  mp_Dialog->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

  mp_Dialog->set_default_response(Gtk::RESPONSE_OK);

  mp_Dialog->show_all_children();

}
Example #21
0
         limitDialog::limitDialog(const char * _szUploadLabel, const char * _szDownloadLabel, const char * _szParam3Label, const char * _szParam4Label)
            : Gtk::Dialog(GPD->sGUI_CLIENT() + " " + GPD->sFULLVERSION() + " / Limit", true /* modal */, true /* use_separator aka set_has_separator() */ ),
              limit_interval(5),
              limit_selected(false),
              selected_upload_disable(false),
              selected_download_disable(false),
              selected_param3_disable(false),
              selected_param4_disable(false),
              uploadCombo(0),
              downloadCombo(0),
              param3Spin(0),
              param4Spin(0),
              selected_upload_limit(-1),
              selected_download_limit(-1)
         {
            Gtk::Label *uploadLabel   = Gtk::manage(new class Gtk::Label( _szUploadLabel ? _szUploadLabel : "Upload" ));
            Gtk::Label *downloadLabel = Gtk::manage(new class Gtk::Label( _szDownloadLabel ? _szDownloadLabel : "Download" ));
            uploadCombo               = Gtk::manage(new class Gtk::ComboBoxText());
            downloadCombo             = Gtk::manage(new class Gtk::ComboBoxText());

            Gtk::Label *seedPercentLabel = Gtk::manage(new class Gtk::Label( _szParam3Label ? _szParam3Label : "Seed %" ));
            Gtk::Label *seedTimeLabel    = Gtk::manage(new class Gtk::Label( _szParam4Label ? _szParam4Label : "Seed Time" ));

            Gtk::Adjustment *seedPercentAdjustment = Gtk::manage(new class Gtk::Adjustment(1, 0, 100, 1, 10, 10));
            param3Spin = Gtk::manage(new class Gtk::SpinButton(*seedPercentAdjustment, 1, 0));

            Gtk::Adjustment *seedTimeAdjustment = Gtk::manage(new class Gtk::Adjustment(1, 0, 100, 1, 10, 10));
            param4Spin    = Gtk::manage(new class Gtk::SpinButton(*seedTimeAdjustment, 1, 0));

            Gtk::Table *settingsTable = Gtk::manage(new class Gtk::Table(4, 2, false));
            Gtk::VBox *limitVbox      = Gtk::manage(new class Gtk::VBox(false, 10));

            uploadLabel->set_alignment(0,0.5);
            uploadLabel->set_padding(5,0);
            uploadLabel->set_justify(Gtk::JUSTIFY_LEFT);
            uploadLabel->set_line_wrap(false);
            uploadLabel->set_use_markup(false);
            uploadLabel->set_selectable(false);

            downloadLabel->set_alignment(0,0.5);
            downloadLabel->set_padding(5,0);
            downloadLabel->set_justify(Gtk::JUSTIFY_LEFT);
            downloadLabel->set_line_wrap(false);
            downloadLabel->set_use_markup(false);
            downloadLabel->set_selectable(false);

            seedPercentLabel->set_alignment(0,0.5);
            seedPercentLabel->set_padding(5,0);
            seedPercentLabel->set_justify(Gtk::JUSTIFY_LEFT);
            seedPercentLabel->set_line_wrap(false);
            seedPercentLabel->set_use_markup(false);
            seedPercentLabel->set_selectable(false);

            seedTimeLabel->set_alignment(0,0.5);
            seedTimeLabel->set_padding(5,0);
            seedTimeLabel->set_justify(Gtk::JUSTIFY_LEFT);
            seedTimeLabel->set_line_wrap(false);
            seedTimeLabel->set_use_markup(false);
            seedTimeLabel->set_selectable(false);

            param3Spin->set_flags(Gtk::CAN_FOCUS);
            param3Spin->set_update_policy(Gtk::UPDATE_ALWAYS);
            param3Spin->set_numeric(false);
            param3Spin->set_digits(0);
            param3Spin->set_wrap(false);
            param3Spin->set_range(0, MaxParam3Value);

            param4Spin->set_flags(Gtk::CAN_FOCUS);
            param4Spin->set_update_policy(Gtk::UPDATE_ALWAYS);
            param4Spin->set_numeric(false);
            param4Spin->set_digits(0);
            param4Spin->set_wrap(false);
            param4Spin->set_range(0, MaxParam4Value);

            uploadCombo->append_text("disable");
            downloadCombo->append_text("disable");

            for (t_int i=limit_interval; i<=200; i+=limit_interval)
               {
                  using namespace btg::core;
                  std::string s = convertToString<int>(i) + " KiB/sec";
                  uploadCombo->append_text(s);
                  downloadCombo->append_text(s);
               }

            uploadCombo->set_active(0);
            downloadCombo->set_active(0);

            settingsTable->set_border_width(10);
            settingsTable->set_row_spacings(20);
            settingsTable->set_col_spacings(5);

            /* */
            settingsTable->attach(*uploadLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*downloadLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*seedPercentLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*seedTimeLabel, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            settingsTable->attach(*param3Spin, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*param4Spin,    1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            settingsTable->attach(*uploadCombo, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*downloadCombo, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            limitVbox->pack_start(*settingsTable, Gtk::PACK_SHRINK, 0);

            property_window_position().set_value(Gtk::WIN_POS_CENTER);
            set_resizable(true);
            property_destroy_with_parent().set_value(false);

            get_vbox()->pack_start(*limitVbox);

            set_default_size(300, 200);

            // Create buttons and connect their signals.
            add_button("Set", 1);
            add_button("Cancel", 2);
            signal_response().connect(sigc::mem_fun(*this, &limitDialog::on_button_pressed));
            
            show_all(); // flag all inner elements as visible
            hide(); // hide toplevel window
         }
Example #22
0
SignalsDialog::SignalsDialog(Debugger& debugger)
    : DialogBox(btn_ok_cancel, "Signal Handling")
    , debugger_(debugger)
{
    Gtk::Table* table = manage(new Gtk::Table(2, 3));
    get_vbox()->add(*table);

    for (int i = 0; i != 3; ++i)
    {
        Gtk::Label* label = manage(new Gtk::Label(titles[i], .0));
        // label->set_justify(Gtk_FLAG(JUSTIFY_LEFT));
        // label->set_usize(100, -1);
        table->attach(*label, i, i + 1, 0, 1,
            Gtk_FLAG(ATTACH_NONE), Gtk_FLAG(ATTACH_NONE));
    }

    Gtk::ScrolledWindow* sw = manage(new Gtk::ScrolledWindow());
    table->attach(*sw, 0, 3, 1, 2);

    table = manage(new Gtk::Table(_NSIG - 1, 3, true));
    Gtk_set_size(table, 300, -1);

    Gtk_add_with_viewport(sw, *table);
    Gtk_set_size(sw, 360, 300);

    sw->set_policy(Gtk_FLAG(POLICY_AUTOMATIC), Gtk_FLAG(POLICY_AUTOMATIC));

    for (int i = 1; i != _NSIG; ++i)
    {
        ostringstream os;

        os << setw(2) << i << "  " << sig_name(i);

        // --- label with signal's name
        Gtk::Label* label = manage(new Gtk::Label(os.str(), .0, .5));
        label->set_justify(Gtk_FLAG(JUSTIFY_LEFT));

        table->attach(*label, 0, 1, i - 1, i,
            Gtk_FLAG(FILL), Gtk_FLAG(ATTACH_NONE));

        // --- "Pass" button
        Gtk::CheckButton* btn = manage(new Gtk::CheckButton("Pass", .0));
        pass_.push_back(btn);

        if (debugger_.signal_policy(i)->pass())
        {
            btn->set_active(true);
        }
        table->attach(*btn, 1, 2, i - 1, i,
            Gtk_FLAG(EXPAND), Gtk_FLAG(ATTACH_NONE));

        // --- "Stop" button
        btn = manage(new Gtk::CheckButton("Stop", .0));
        stop_.push_back(btn);

        if (debugger_.signal_policy(i)->stop())
        {
            btn->set_active(true);
        }
        table->attach(*btn, 2, 3, i - 1, i,
            Gtk_FLAG(EXPAND), Gtk_FLAG(ATTACH_NONE));
    }

    assert(pass_.size() == stop_.size());
    assert(pass_.size() == _NSIG - 1);

    get_button_box()->set_layout(Gtk_FLAG(BUTTONBOX_END));
}
Example #23
0
         preferencesDialog::preferencesDialog(int const _min_port, int const _max_port)
            : portrange_begin(0),
              beginPortRangeSpinbuttonAdj(0),
              portrange_end(0),
              endPortRangeSpinbuttonAdj(0),
              workPathEntry(0),
              outputPathEntry(0),
              leechModeCheckbutton(0),
              min_port(_max_port), max_port(_min_port),
              workPath(),
              outputPath(),
              leechmode(false),
              portrange_begin_intial_value(0),
              portrange_end_intial_value(0),
              workPath_initial_value(""),
              outputPath_initial_value(""),
              leechmode_initial_value(false),
              portrange_begin_signal(),
              portrange_end_signal(),
              save_btn_pressed(false)
         {
            Gtk::Label* workLabel      = Gtk::manage(new class Gtk::Label("Working directory"));
            Gtk::Label* outputLabel    = Gtk::manage(new class Gtk::Label("Output directory"));
            Gtk::Label* portRangeLabel = Gtk::manage(new class Gtk::Label("Port range"));
            Gtk::Label* leechModeLabel = Gtk::manage(new class Gtk::Label("Leech mode"));
            outputPathEntry            = Gtk::manage(new class Gtk::Entry());

            workPathEntry              = Gtk::manage(new class Gtk::Entry());

            leechModeCheckbutton       = Gtk::manage(new class Gtk::CheckButton("enabled"));
            Gtk::Table* settingsTable  = Gtk::manage(new class Gtk::Table(2, 2, false));

            // Ports:
            Gtk::Table* portTable       = Gtk::manage(new class Gtk::Table(2, 2, false));;
            Gtk::Label* beginPortLabel  = Gtk::manage(new class Gtk::Label("Begin Port"));
            Gtk::Label* endPortLabel    = Gtk::manage(new class Gtk::Label("End Port"));
            beginPortRangeSpinbuttonAdj = Gtk::manage(new class Gtk::Adjustment(_min_port, _min_port, _max_port, 1, 100, 10));
            portrange_begin             = Gtk::manage(new class Gtk::SpinButton(*beginPortRangeSpinbuttonAdj, 1, 0));
            endPortRangeSpinbuttonAdj   = Gtk::manage(new class Gtk::Adjustment(_min_port, _min_port, _max_port, 1, 100, 10));
            portrange_end               = Gtk::manage(new class Gtk::SpinButton(*endPortRangeSpinbuttonAdj, 1, 0));

            beginPortLabel->set_alignment(0,0.5);
            beginPortLabel->set_padding(5,5);
            beginPortLabel->set_justify(Gtk::JUSTIFY_LEFT);
            beginPortLabel->set_line_wrap(false);
            beginPortLabel->set_use_markup(false);
            beginPortLabel->set_selectable(false);

            endPortLabel->set_alignment(0,0.5);
            endPortLabel->set_padding(5,5);
            endPortLabel->set_justify(Gtk::JUSTIFY_LEFT);
            endPortLabel->set_line_wrap(false);
            endPortLabel->set_use_markup(false);
            endPortLabel->set_selectable(false);

            portrange_end->set_flags(Gtk::CAN_FOCUS);
            portrange_end->set_update_policy(Gtk::UPDATE_ALWAYS);
            portrange_end->set_numeric(false);
            portrange_end->set_digits(0);
            portrange_end->set_wrap(false);
            portrange_end->set_flags(Gtk::CAN_FOCUS);
            portrange_end->set_update_policy(Gtk::UPDATE_ALWAYS);
            portrange_end->set_numeric(true);
            portrange_end->set_digits(0);
            portrange_end->set_wrap(false);

            portrange_begin->set_flags(Gtk::CAN_FOCUS);
            portrange_begin->set_update_policy(Gtk::UPDATE_ALWAYS);
            portrange_begin->set_numeric(false);
            portrange_begin->set_digits(0);
            portrange_begin->set_wrap(false);
            portrange_begin->set_flags(Gtk::CAN_FOCUS);
            portrange_begin->set_update_policy(Gtk::UPDATE_ALWAYS);
            portrange_begin->set_numeric(true);
            portrange_begin->set_digits(0);
            portrange_begin->set_wrap(false);

            portTable->set_border_width(10);
            portTable->set_row_spacings(5);
            portTable->set_col_spacings(5);
            portTable->attach(*beginPortLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            portTable->attach(*endPortLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            portTable->attach(*portrange_end, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            portTable->attach(*portrange_begin, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            beginPortLabel->show();
            endPortLabel->show();
            portrange_begin->show();
            portrange_end->show();
            portTable->show();

            Gtk::VBox *preferencesVbox = Gtk::manage(new class Gtk::VBox(false, 10));

            outputLabel->set_alignment(0,0.5);
            outputLabel->set_padding(5,0);
            outputLabel->set_justify(Gtk::JUSTIFY_LEFT);
            outputLabel->set_line_wrap(false);
            outputLabel->set_use_markup(false);
            outputLabel->set_selectable(false);

            workLabel->set_alignment(0,0.5);
            workLabel->set_padding(5,0);
            workLabel->set_justify(Gtk::JUSTIFY_LEFT);
            workLabel->set_line_wrap(false);
            workLabel->set_use_markup(false);
            workLabel->set_selectable(false);



            portRangeLabel->set_alignment(0,0.5);
            portRangeLabel->set_padding(5,0);
            portRangeLabel->set_justify(Gtk::JUSTIFY_LEFT);
            portRangeLabel->set_line_wrap(false);
            portRangeLabel->set_use_markup(false);
            portRangeLabel->set_selectable(false);

            leechModeLabel->set_alignment(0,0.5);
            leechModeLabel->set_padding(5,0);
            leechModeLabel->set_justify(Gtk::JUSTIFY_LEFT);
            leechModeLabel->set_line_wrap(false);
            leechModeLabel->set_use_markup(false);
            leechModeLabel->set_selectable(false);

            Gtk::HBox* pathHbox     = Gtk::manage(new class Gtk::HBox(false, 10));
            Gtk::HBox* workPathHbox = Gtk::manage(new class Gtk::HBox(false, 10));

            outputPathEntry->set_flags(Gtk::CAN_FOCUS);
            outputPathEntry->set_visibility(true);
            outputPathEntry->set_editable(false);
            outputPathEntry->set_max_length(0);
            outputPathEntry->set_text("");
            outputPathEntry->set_has_frame(true);
            outputPathEntry->set_activates_default(false);

            workPathEntry->set_flags(Gtk::CAN_FOCUS);
            workPathEntry->set_visibility(true);
            workPathEntry->set_editable(false);
            workPathEntry->set_max_length(0);
            workPathEntry->set_text("");
            workPathEntry->set_has_frame(true);
            workPathEntry->set_activates_default(false);

            Gtk::Button* pathButton = Gtk::manage(new class Gtk::Button("Change Path"));
            Gtk::Button* workPathButton = Gtk::manage(new class Gtk::Button("Change Path"));

            pathHbox->pack_start(*outputPathEntry);
            pathHbox->pack_start(*pathButton, Gtk::PACK_SHRINK, 0);

            workPathHbox->pack_start(*workPathEntry);
            workPathHbox->pack_start(*workPathButton, Gtk::PACK_SHRINK, 0);

            leechModeCheckbutton->set_flags(Gtk::CAN_FOCUS);
            leechModeCheckbutton->set_relief(Gtk::RELIEF_NORMAL);
            leechModeCheckbutton->set_mode(true);
            leechModeCheckbutton->set_active(false);

            settingsTable->set_border_width(10);
            settingsTable->set_row_spacings(20);
            settingsTable->set_col_spacings(5);

            // left rigth top bottom

            /*
              table1->attach(*label1, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*label2, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*label3, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*label4, 0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*entry1, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*entry2, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*entry3, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
              table1->attach(*entry4, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            */

            settingsTable->attach(*workLabel,            0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*outputLabel,          0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*portRangeLabel,       0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*leechModeLabel,       0, 1, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*workPathHbox,         1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*pathHbox,             1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
            settingsTable->attach(*portTable,            1, 2, 2, 3, Gtk::FILL, Gtk::FILL, 0, 0);
            settingsTable->attach(*leechModeCheckbutton, 1, 2, 3, 4, Gtk::FILL, Gtk::AttachOptions(), 0, 0);

            preferencesVbox->pack_start(*settingsTable, Gtk::PACK_SHRINK, 0);

            set_title( GPD->sGUI_CLIENT() + " " + GPD->sFULLVERSION() + " / Preferences" );
            set_modal(true);
            property_window_position().set_value(Gtk::WIN_POS_CENTER);
            set_resizable(true);
            property_destroy_with_parent().set_value(false);
            set_has_separator(true);

            get_vbox()->pack_start(*preferencesVbox);

            set_default_size(300, 200);

            outputLabel->show();
            workLabel->show();
            portRangeLabel->show();
            leechModeLabel->show();
            outputPathEntry->show();
            pathButton->show();
            pathHbox->show();

            workPathEntry->show();
            workPathButton->show();
            workPathHbox->show();

            leechModeCheckbutton->show();
            settingsTable->show();

            preferencesVbox->show();

            // Create buttons and connect their signals.
            add_button("Save", 1);
            add_button("Cancel", 2);

            signal_response().connect(sigc::mem_fun(*this, &preferencesDialog::on_dialog_button_pressed));

            pathButton->signal_clicked().connect(sigc::mem_fun(*this, &preferencesDialog::on_path_select_button_pressed));

            workPathButton->signal_clicked().connect(sigc::mem_fun(*this, &preferencesDialog::on_work_path_select_button_pressed));

            get_vbox()->show();
         }
Example #24
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();
}
Example #25
0
  cGtkmmMainWindow::cGtkmmMainWindow(int argc, char** argv) :
    updateChecker(*this),
    notifyMainThread(*this),
    pMenuPopup(nullptr),
    comboBoxFolder(true),
    statusBar("0 photos"),
    photoBrowser(*this)
  {
    settings.Load();

    set_title(BUILD_APPLICATION_NAME);
    set_size_request(400, 400);
    set_default_size(800, 800);

    // Restore the window size
    size_t width = 800;
    size_t height = 800;
    settings.GetMainWindowSize(width, height);
    resize(width, height);

    if (settings.IsMainWindowMaximised()) maximize();

    // Set icon list
    std::vector<Glib::RefPtr<Gdk::Pixbuf> > icons;
    icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_16x16.png"));
    icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_32x32.png"));
    icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_48x48.png"));
    icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_64x64.png"));
    icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_128x128.png"));
    icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_256x256.png"));
    // GTK complains if we pass icons larger than 256x256
    //icons.push_back(Gdk::Pixbuf::create_from_file("data/icons/application_512x512.png"));
    set_icon_list(icons);

    // Menu and toolbar

    // void Gtk::Application::set_app_menu(const Glib::RefPtr< Gio::MenuModel > &  app_menu)
    // Sets or unsets the application menu for application.
    // The application menu is a single menu containing items that typically impact the application as a whole, rather than acting on a specific window or document. For example, you would expect to see "Preferences" or "Quit" in an application menu, but not "Save" or "Print".
    // If supported, the application menu will be rendered by the desktop environment.
    // You might call this method in your Application::property_startup() signal handler.
    // Use the base ActionMap interface to add actions, to respond to the user selecting these menu items.
    // Since gtkmm 3.4:


    // Create actions for menus and toolbars
    m_refActionGroup = Gtk::ActionGroup::create();

    // File menu
    m_refActionGroup->add(Gtk::Action::create("FileMenu", "File"));
    m_refActionGroup->add(Gtk::Action::create("FileAddFiles", "Add Files"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileBrowseFiles));
    m_refActionGroup->add(Gtk::Action::create("FileAddFolder", "Add Folder"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileBrowseFolder));
    m_refActionGroup->add(Gtk::Action::create("FileAddFilesFromPicturesFolder", "Add Files From Pictures Folder"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionAddFilesFromPicturesFolder));
    m_refActionGroup->add(Gtk::Action::create("FileImportFolder", "Import Folder From Removable Media"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileImportFolder));
    //m_refActionGroup->add(Gtk::Action::create("FileRemove", "Remove"),
    //        sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionRemoveTrack));
    //m_refActionGroup->add(Gtk::Action::create("FileMoveToFolderMenu", "Move to Folder"));
    //m_refActionGroup->add(Gtk::Action::create("FileMoveToFolderBrowse", "Browse..."),
    //        sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToFolderBrowse));
    //m_refActionGroup->add(Gtk::Action::create("FileMoveToRubbishBin", "Move to the Rubbish Bin"),
    //        sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToRubbishBin));
    //m_refActionGroup->add(Gtk::Action::create("FileShowInFileManager", "Show in the File Manager"),
    //        sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackShowInFileManager));
    //m_refActionGroup->add(Gtk::Action::create("FileProperties", "Properties"),
    //        sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackProperties));
    m_refActionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuFileQuit));

    // Edit menu
    m_refActionGroup->add(Gtk::Action::create("EditMenu", "Edit"));
    //Edit Tags -> edits each track separately
    //Batch Edit Tags -> edits all tracks at the same time
    m_refActionGroup->add(Gtk::Action::create("EditPreferences", Gtk::Stock::PREFERENCES),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuEditPreferences));

    // Playback menu
    m_refActionGroup->add(Gtk::Action::create("PlaybackMenu", "Playback"));
    //m_refActionGroup->add(Gtk::Action::create("PlaybackPrevious", Gtk::Stock::MEDIA_PREVIOUS),
    //        sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackPreviousClicked));
    //pPlayPauseAction = Gtk::ToggleAction::create("PlaybackPlayPause", Gtk::Stock::MEDIA_PLAY, "Play/Pause");
    //m_refActionGroup->add(pPlayPauseAction, sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackPlayPauseMenuToggled));
    //m_refActionGroup->add(Gtk::Action::create("PlaybackNext", Gtk::Stock::MEDIA_NEXT),
    //        sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackNextClicked));
    //m_refActionGroup->add(Gtk::Action::create("JumpToPlaying", "Jump to Playing"),
    //        Gtk::AccelKey("<control>J"),
    //        sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionJumpToPlaying));
    //pRepeatAction = Gtk::ToggleAction::create("PlaybackRepeatToggle", Gtk::Stock::GOTO_TOP, "Repeat");
    //m_refActionGroup->add(pRepeatAction, sigc::mem_fun(*this, &cGtkmmMainWindow::OnPlaybackRepeatMenuToggled));

    // Help menu
    m_refActionGroup->add( Gtk::Action::create("HelpMenu", "Help") );
    m_refActionGroup->add( Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnMenuHelpAbout) );

    m_refUIManager = Gtk::UIManager::create();
    m_refUIManager->insert_action_group(m_refActionGroup);

    add_accel_group(m_refUIManager->get_accel_group());

    // Layout the actions in a menubar and toolbar
    {
      Glib::ustring ui_info =
        "<ui>"
        "  <menubar name='MenuBar'>"
        "    <menu action='FileMenu'>"
        "      <menuitem action='FileAddFiles'/>"
        "      <menuitem action='FileAddFolder'/>"
        "      <menuitem action='FileAddFilesFromPicturesFolder'/>"
        "      <menuitem action='FileImportFolder'/>"
        //"      <menuitem action='FileRemove'/>"
        //"      <menu action='FileMoveToFolderMenu'>"
        //"        <menuitem action='FileMoveToFolderBrowse'/>"
        //"      </menu>"
        //"      <menuitem action='FileMoveToRubbishBin'/>"
        //"      <menuitem action='FileShowInFileManager'/>"
        //"      <menuitem action='FileProperties'/>"
        //"      <separator/>"
        "      <menuitem action='FileQuit'/>"
        "    </menu>"
        "    <menu action='EditMenu'>"
        "      <menuitem action='EditPreferences'/>"
        "    </menu>"
        "    <menu action='PlaybackMenu'>"
        //"      <menuitem action='PlaybackPrevious'/>"
        //"      <menuitem action='PlaybackPlayPause'/>"
        //"      <menuitem action='PlaybackNext'/>"
        //"      <menuitem action='JumpToPlaying'/>"
        //"      <separator/>"
        //"      <menuitem action='PlaybackRepeatToggle'/>"
        "    </menu>"
        "    <menu action='HelpMenu'>"
        "      <menuitem action='HelpAbout'/>"
        "    </menu>"
        "  </menubar>"
        "  <toolbar name='ToolBar'>"
        //"    <toolitem action='PlaybackPrevious'/>"
        //"    <toolitem action='PlaybackPlayPause'/>"
        //"    <toolitem action='PlaybackNext'/>"
        //"    <toolitem action='PlaybackRepeatToggle'/>"
        "  </toolbar>"
        "</ui>";

      try {
        m_refUIManager->add_ui_from_string(ui_info);
      }
      catch(const Glib::Error& ex) {
        std::cerr<<"building menus failed: "<<ex.what();
      }
    }

    // Get the menubar and toolbar widgets, and add them to a container widget
    Gtk::Widget* pMenubar = m_refUIManager->get_widget("/MenuBar");
    if (pMenubar != nullptr) boxMainWindow.pack_start(*pMenubar, Gtk::PACK_SHRINK);


    // Photo browser right click menu
    Glib::RefPtr<Gtk::ActionGroup> popupActionGroupRef;


    // Right click menu
    popupActionGroupRef = Gtk::ActionGroup::create();

    // File|New sub menu:
    // These menu actions would normally already exist for a main menu, because a context menu should
    // not normally contain menu items that are only available via a context menu.
    popupActionGroupRef->add(Gtk::Action::create("ContextMenu", "Context Menu"));

    popupActionGroupRef->add(Gtk::Action::create("ContextAddFiles", "Add Files"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFiles));

    popupActionGroupRef->add(Gtk::Action::create("ContextAddFolder", "Add Folder"),
            Gtk::AccelKey("<control>P"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFolder));

    popupActionGroupRef->add(Gtk::Action::create("ContextRemove", "Remove"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionRemovePhoto));

    //Edit Tags -> edits each track separately
    //Batch Edit Tags -> edits all tracks at the same time

    /*/popupActionGroupRef->add(Gtk::Action::create("ContextMoveToFolderMenu", "Move to Folder"));

    popupActionGroupRef->add(Gtk::Action::create("ContextTrackMoveToFolderBrowse", "Browse..."),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToFolderBrowse));

    popupActionGroupRef->add(Gtk::Action::create("ContextTrackMoveToRubbishBin", "Move to the Rubbish Bin"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackMoveToRubbishBin));

    popupActionGroupRef->add(Gtk::Action::create("ContextShowInFileManager", "Show in the File Manager"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackShowInFileManager));

    popupActionGroupRef->add(Gtk::Action::create("ContextProperties", "Properties"),
            sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionTrackProperties));*/

    popupUIManagerRef = Gtk::UIManager::create();
    popupUIManagerRef->insert_action_group(popupActionGroupRef);

    add_accel_group(popupUIManagerRef->get_accel_group());

    // Layout the actions in our popup menu
    {
      Glib::ustring ui_info =
        "<ui>"
        "  <popup name='PopupMenu'>"
        "    <menuitem action='ContextAddFiles'/>"
        "    <menuitem action='ContextAddFolder'/>"
        "    <menuitem action='ContextRemove'/>"
        /*"    <menu action='ContextMoveToFolderMenu'>"
        "      <menuitem action='ContextTrackMoveToFolderBrowse'/>"
        "    </menu>"
        "    <menuitem action='ContextTrackMoveToRubbishBin'/>"
        "    <menuitem action='ContextShowInFileManager'/>"
        "    <menuitem action='ContextProperties'/>"*/
        "  </popup>"
        "</ui>";

      try
      {
        popupUIManagerRef->add_ui_from_string(ui_info);
      }
      catch(const Glib::Error& ex)
      {
        std::cerr<<"building menus failed: "<<ex.what();
      }
    }

    // Get the menu
    pMenuPopup = dynamic_cast<Gtk::Menu*>(popupUIManagerRef->get_widget("/PopupMenu"));
    if (pMenuPopup == nullptr) g_warning("Popup menu not found");
    assert(pMenuPopup != nullptr);


    // In gtkmm 3 set_orientation is not supported so we create our own toolbar out of plain old buttons
    //Gtk::Toolbar* pToolbar = dynamic_cast<Gtk::Toolbar*>(m_refUIManager->get_widget("/ToolBar"));
    //if (pToolbar != nullptr) {
    //  pToolbar->property_orientation() = Gtk::ORIENTATION_VERTICAL;
    //  //pToolbar->set_orientation(Gtk::ORIENTATION_VERTICAL);
    //  pToolbar->set_toolbar_style(Gtk::TOOLBAR_ICONS);
    //  boxToolbar.pack_start(*pToolbar);
    //}

    buttonAddFiles.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFiles));
    buttonAddFolder.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionBrowseFolder));

    boxToolbar.pack_start(buttonFolderUp, Gtk::PACK_SHRINK);
    boxToolbar.pack_start(buttonFolderShowInFileManager, Gtk::PACK_SHRINK);
    boxToolbar.pack_start(buttonAddFiles, Gtk::PACK_SHRINK);
    boxToolbar.pack_start(buttonAddFolder, Gtk::PACK_SHRINK);

    boxToolbar.pack_start(*Gtk::manage(new Gtk::Separator()), Gtk::PACK_SHRINK);


    // Controls
    comboBoxFolder.get_entry()->signal_changed().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionChangeFolder));
    buttonFolderUp.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionFolderUp));
    buttonFolderUp.set_tooltip_text("Move up");
    buttonFolderShowInFileManager.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionFolderShowInFileManager));
    buttonFolderShowInFileManager.set_tooltip_text("Show folder in file manager");

    buttonStopLoading.signal_clicked().connect(sigc::mem_fun(*this, &cGtkmmMainWindow::OnActionStopLoading));

    photoBrowser.Init(argc, argv);

    boxControls.pack_start(comboBoxFolder, Gtk::PACK_SHRINK);
    boxControls.pack_start(photoBrowser.GetWidget(), Gtk::PACK_EXPAND_WIDGET);

    boxControlsAndToolbar.pack_start(boxControls, Gtk::PACK_EXPAND_WIDGET);
    boxControlsAndToolbar.pack_start(boxToolbar, Gtk::PACK_SHRINK);

    // Hide the stop button until we start loading some files
    buttonStopLoading.hide();

    boxStatusBar.pack_start(statusBar, Gtk::PACK_SHRINK);
    boxStatusBar.pack_start(buttonStopLoading, Gtk::PACK_SHRINK);
    //... show progress bar indeterminate when we are loading any files or playlists

    boxMainWindow.pack_start(boxControlsAndToolbar, Gtk::PACK_EXPAND_WIDGET);
    boxMainWindow.pack_start(boxStatusBar, Gtk::PACK_SHRINK);

    // Add the box layout to the main window
    add(boxMainWindow);


    {
      // Get a typical selection colour for the selections on our photo browser
      Gtk::Table table;
      Glib::RefPtr<Gtk::StyleContext> pStyleContext = table.get_style_context();
      ASSERT(pStyleContext);

      const Gdk::RGBA colour = pStyleContext->get_background_color(Gtk::STATE_FLAG_SELECTED);
      const spitfire::math::cColour colourSelected(colour.get_red(), colour.get_green(), colour.get_blue(), colour.get_alpha());
      photoBrowser.SetSelectionColour(colourSelected);
    }


    // Register our icon theme and update our icons
    iconTheme.RegisterThemeChangedListener(*this);

    UpdateIcons();

    ApplySettings();

    show_all_children();

    // Start the update checker now that we have finished doing the serious work
    updateChecker.Run();

    notifyMainThread.Create();
  }
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);
}
Example #27
0
void DocumentProperties::setupFields (Glib::ustring const &docType)
{
	Gtk::VBox *metadataBox;
  xml_->get_widget ("MetadataBox", metadataBox);
	if (metadataBox->children().size()) {
		metadataBox->children().erase(metadataBox->children().begin());
	}

	DocumentType type = typeManager_.getType (docType);

	int const nRows = type.requiredFields_.size() + type.optionalFields_.size();
	Gtk::Table *metadataTable = new Gtk::Table (nRows, 4, false);
	metadataTable->set_col_spacings (6);
	metadataTable->set_row_spacings (6);

	fieldEntries_.clear ();

	Gtk::Label *typeLabel = Gtk::manage (new Gtk::Label (_("_Type:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true));
	
	if (typecombochanged_)
		typecombochanged_.disconnect();

	typeCombo_ = Gtk::manage (new Gtk::ComboBox);
	typeCombo_->set_model(typecombostore_);
	typeCombo_->pack_start(typelabelcol_, true);
	typeCombo_->pack_start(typebibtexnamecol_, false);

	typeLabel->set_mnemonic_widget (*typeCombo_);
	metadataTable->attach (*typeLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
	metadataTable->attach (*typeCombo_, 1, 4, 0, 1, Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);

	typecombostore_->clear();
	for (DocumentTypeManager::TypesMap::iterator it = typeManager_.getTypes().begin();
			it != typeManager_.getTypes().end();
			++it) {

		Gtk::TreeModel::Row row = *(typecombostore_->append());
		row[typelabelcol_] = (*it).second.displayName_;
		row[typebibtexnamecol_] = (*it).second.bibtexName_;
	}

	typecombochanged_ = typeCombo_->signal_changed().connect (
			sigc::mem_fun (*this, &DocumentProperties::onTypeChanged));

	int row = 1;
	for (
	     std::vector<DocumentField>::iterator it = type.requiredFields_.begin();
	     it != type.requiredFields_.end();
	     ++it) {

		if (it->shortField_)
			continue;

		Gtk::Label *label = Gtk::manage (new Gtk::Label (it->displayName_ + ":", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
		Gtk::Entry *entry = Gtk::manage (new Gtk::Entry ());

		/* [bert] Minor change to actually implement and register
		 * a callback for changes to the DOI field. This is a bit
		 * ugly here since it assumes we know whether DOI is 
		 * required or not.
		 */
		if (it->internalName_ == "doi") {
		  entry->signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::onDoiEntryChanged));
		}

		fieldEntries_[it->internalName_] = entry;

		metadataTable->attach (*label, 0, 1, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK | Gtk::FILL, 0, 0);
		metadataTable->attach (*entry, 1, 4, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
		++row;
	}
	for (
	     std::vector<DocumentField>::iterator it = type.optionalFields_.begin();
	     it != type.optionalFields_.end();
	     ++it) {

		if (it->shortField_)
			continue;

		Gtk::Label *label = Gtk::manage (new Gtk::Label (it->displayName_ + ":", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
		Gtk::Entry *entry = Gtk::manage (new Gtk::Entry ());

		fieldEntries_[it->internalName_] = entry;

		metadataTable->attach (*label, 0, 1, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK | Gtk::FILL, 0, 0);
		metadataTable->attach (*entry, 1, 4, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
		++row;
	}

	int col = 0;
	for (
	     std::vector<DocumentField>::iterator it = type.requiredFields_.begin();
	     it != type.requiredFields_.end();
	     ++it) {

		if (!it->shortField_)
			continue;

		Gtk::Label *label = Gtk::manage (new Gtk::Label (it->displayName_ + ":", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
		Gtk::Entry *entry = Gtk::manage (new Gtk::Entry ());

		fieldEntries_[it->internalName_] = entry;

		metadataTable->attach (*label, 0 + col * 2, 1 + col * 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK | Gtk::FILL, 0, 0);
		metadataTable->attach (*entry, 1 + col * 2, 2 + col * 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
		++col;
		if (col > 1) {
			++row;
			col = 0;
		}
	}
	for (
	     std::vector<DocumentField>::iterator it = type.optionalFields_.begin();
	     it != type.optionalFields_.end();
	     ++it) {

		if (!it->shortField_)
			continue;

		Gtk::Label *label = Gtk::manage (new Gtk::Label (it->displayName_ + ":", Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
		Gtk::Entry *entry = Gtk::manage (new Gtk::Entry ());

		fieldEntries_[it->internalName_] = entry;

		metadataTable->attach (*label, 0 + col * 2, 1 + col * 2, row, row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK | Gtk::FILL, 0, 0);
		metadataTable->attach (*entry, 1 + col * 2, 2 + col * 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK | Gtk::FILL, 0, 0);
		++col;
		if (col > 1) {
			++row;
			col = 0;
		}
	}

	metadataBox->pack_start (*metadataTable);
	metadataBox->show_all ();
}
MEItemInfoWidget::MEItemInfoWidget()
    : MEAbstractItemInfoWidget("General")
{
   Gtk::Table* table = manage(new Gtk::Table(5, 2));

   // Item type
   Gtk::Label* label = manage(new Gtk::Label("Item type"));
   label->set_alignment(XALIGN, YALIGN);
   table->attach(*label, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
   m_itemTypeVal = manage(new Gtk::Entry());
   table->attach(*m_itemTypeVal, 1, 2, 0, 1, 
                 Gtk::EXPAND | Gtk::FILL, 
                 Gtk::FILL);

   // ID
   label = manage(new Gtk::Label("Item ID"));
   label->set_alignment(XALIGN, YALIGN);
   table->attach(*label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
   m_itemIDVal = manage(new Gtk::Entry());
   table->attach(*m_itemIDVal, 1, 2, 1, 2, 
                 Gtk::EXPAND | Gtk::FILL, 
                 Gtk::FILL);


   /* Groups
   */
   label = manage(new Gtk::Label("Groups"));
   label->set_alignment(XALIGN, YALIGN);
   //table->attach(*label, 0, 1, 3, 4, FIXED_OPT, FIXED_OPT);
     
   // Create scrolled window and add viewer
   Gtk::ScrolledWindow* scrolledWin = manage(new Gtk::ScrolledWindow());
   scrolledWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrolledWin->set_shadow_type(Gtk::SHADOW_OUT);
   scrolledWin->add(m_treeViewGroups);
   table->attach(*scrolledWin, 1, 2, 3, 4, 
                 Gtk::EXPAND | Gtk::FILL, 
                 Gtk::EXPAND | Gtk::FILL);

   // Create ListStore and add to treeViewer.
   m_listStoreGroups = Gtk::ListStore::create(m_columnsGroups);
   m_treeViewGroups.set_model(m_listStoreGroups);

   // Create selection object
   m_selectionGroups = m_treeViewGroups.get_selection();

   // Add columns to the treeviewer
   m_treeViewGroups.append_column("Pos", m_columnsGroups.m_pos);
   m_treeViewGroups.append_column("ID", m_columnsGroups.m_ID);
   m_treeViewGroups.append_column("Type", m_columnsGroups.m_type);
   m_treeViewGroups.append_column("Name", m_columnsGroups.m_name);

   // Set column widths
   m_treeViewGroups.get_column(0)->set_min_width(30);
   m_treeViewGroups.get_column(1)->set_min_width(60);
   m_treeViewGroups.get_column(2)->set_min_width(60);
   m_treeViewGroups.get_column(3)->set_min_width(60);

   // Add a button to be able to select group
   Gtk::Box* tmpBox1 = manage(new Gtk::VBox());
   tmpBox1->pack_start(*label);
   Gtk::Button* tmpButton1=manage(new Gtk::Button("Select"));
   tmpBox1->pack_start(*tmpButton1, false, false);
   tmpButton1->signal_clicked().connect(
         sigc::mem_fun(*this, &MEItemInfoWidget::groupClicked));
   table->attach(*tmpBox1, 0, 1, 3, 4, 
                 Gtk::FILL, 
                 Gtk::FILL | Gtk::EXPAND);

   m_listStoreGroups = Gtk::ListStore::create(m_columnsGroups);
   m_treeViewGroups.set_model(m_listStoreGroups);

   /* Names
   */

   // Label
   label = manage(new Gtk::Label("Names"));
   label->set_alignment(XALIGN, YALIGN);

#ifdef MAP_EDITABLE   
   // Add a button to be able to edit the names of this item
   Gtk::Box* tmpBox = manage(new Gtk::VBox());
   tmpBox->pack_start(*label);
   Gtk::Button* tmpButton=manage(new Gtk::Button("Edit"));
   //tmpButton->set_usize(20,12);
   tmpBox->pack_start(*tmpButton, false, false);
   tmpButton->signal_clicked().connect(
         sigc::mem_fun(*this, &MEItemInfoWidget::editNamePressed));
   table->attach(*tmpBox, 0, 1, 4, 5, 
                 Gtk::FILL, 
                 Gtk::FILL | Gtk::EXPAND);
#else
   table->attach(*label, 0, 1, 4, 5, 
                 Gtk::FILL, 
                 Gtk::FILL | Gtk::EXPAND);
#endif // MAP_EDITABLE
   
   // Create scrollwindow and add viewer
   scrolledWin = manage(new Gtk::ScrolledWindow());
   scrolledWin->set_shadow_type(Gtk::SHADOW_OUT);
   scrolledWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrolledWin->add(m_treeViewNames);
   table->attach(*scrolledWin, 1, 2, 4, 5, Gtk::FILL, Gtk::FILL);   

   // Create ListStore and add to TreeViewer 
   m_listStoreNames = Gtk::ListStore::create(m_ColumnsNames);
   m_treeViewNames.set_model(m_listStoreNames);

   // Create selection object
   m_selectionNames = m_treeViewNames.get_selection();

   // Add columns to TreeViewer
   m_treeViewNames.append_column("Names", m_ColumnsNames.m_name);
   m_treeViewNames.set_headers_visible(false);

   //m_itemIDVal->set_state(GTK_STATE_INSENSITIVE);
   m_itemIDVal->set_editable(false);
   //m_itemTypeVal->set_state(GTK_STATE_INSENSITIVE);
   m_itemTypeVal->set_editable(false);
#ifdef MAP_EDITABLE
   m_selectionNames->set_mode(Gtk::SELECTION_SINGLE);
#else
   m_selectionNames->set_mode(Gtk::SELECTION_NONE);
#endif

   
   // Add the table to this frame
   add(*table);
}
MEStreetSegmentItemInfoWidget::MEStreetSegmentItemInfoWidget()
    : MEAbstractItemInfoWidget("SSI")
{
    // Table with 3 rows and 2 columns
    Gtk::Table* table = manage(new Gtk::Table(3, 2));

    Gtk::Label* label = NULL;
    Gtk::Box* box = NULL;
    Gtk::Adjustment* adj = NULL;

    // Road class + road condition
    box = manage(new Gtk::HBox());
    label = manage(new Gtk::Label("Road class"));
    label->set_alignment(XALIGN, YALIGN);
    box->pack_start(*label, true, true);
    m_roadClassVal = manage(new Gtk::Entry());
    m_roadClassVal->set_size_request(100, 18);
    box->pack_start(*m_roadClassVal, true, true);
    label = manage(new Gtk::Label("Road cond"));
    label->set_alignment(XALIGN, YALIGN);
    box->pack_start(*label, true, true);
    m_roadConditionVal = manage(new Gtk::Entry());
    m_roadConditionVal->set_size_request(100, 18);
    box->pack_start(*m_roadConditionVal, true, true);
    table->attach(*box, 0, 2, 0, 1,
                  Gtk::FILL | Gtk::EXPAND, Gtk::FILL);

    // House numbers
    label = manage(new Gtk::Label("Nbr L/R: type"));
    label->set_alignment(XALIGN, YALIGN);
    // Not sure if parameters correspond to old AttachOptions.
    //table->attach(*label, 0, 1, 1, 2, FIXED_OPT, FIXED_OPT);
    table->attach(*label, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
    box = manage(new Gtk::HBox());

    adj = manage(new Gtk::Adjustment(0, 0, MAX_UINT16));
    m_houseNumberValLS = manage(new Gtk::SpinButton(*adj));
    m_houseNumberValLS->set_numeric(true);
    m_houseNumberValLS->set_size_request(60, 18);
    box->pack_start(*m_houseNumberValLS, true, true);

    label = manage(new Gtk::Label("-"));
    box->pack_start(*label, false, false);

    adj = manage(new Gtk::Adjustment(0, 0, MAX_UINT16));
    m_houseNumberValLE = manage(new Gtk::SpinButton(*adj));
    m_houseNumberValLE->set_numeric(true);
    m_houseNumberValLE->set_size_request(60, 18);
    box->pack_start(*m_houseNumberValLE);

    label = manage(new Gtk::Label(" / "));
    box->pack_start(*label, false, false);

    adj = manage(new Gtk::Adjustment(0, 0, MAX_UINT16));
    m_houseNumberValRS = manage(new Gtk::SpinButton(*adj));
    m_houseNumberValRS->set_numeric(true);
    m_houseNumberValRS->set_size_request(60, 18);
    box->pack_start(*m_houseNumberValRS);

    label = manage(new Gtk::Label("-"));
    box->pack_start(*label, false, false);

    adj = manage(new Gtk::Adjustment(0, 0, MAX_UINT16));
    m_houseNumberValRE = manage(new Gtk::SpinButton(*adj));
    m_houseNumberValRE->set_numeric(true);
    m_houseNumberValRE->set_size_request(60, 18);
    box->pack_start(*m_houseNumberValRE);

    label = manage(new Gtk::Label(":"));
    box->pack_start(*label, true, true);
    // Housenumber-type
    Gtk::Combo* tmpCombo = manage(new Gtk::Combo());
    m_houseNumberTypeVal = tmpCombo->get_entry();
    list<string> houseNbrTypeList;
    for (unsigned int i=0; i<5; i++) {  // Please change to < "invalidStreetNumberType"
        char tmpStr[8];
        sprintf(tmpStr, "%u", i);
        houseNbrTypeList.push_back(tmpStr);
    }
    tmpCombo->set_popdown_strings(houseNbrTypeList);
    tmpCombo->set_size_request(40,18);
    box->pack_start(*tmpCombo);

    table->attach(*box, 1, 2, 1, 2, Gtk::EXPAND, Gtk::FILL);

    // Street segment item attributes
    box = manage(new Gtk::HBox());
    // Ramp?
    m_rampVal = manage(new Gtk::CheckButton("ramp"));
    label = dynamic_cast<Gtk::Label*>(m_rampVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_rampVal);
    // Roundabout
    m_roundaboutVal = manage(new Gtk::CheckButton("roundabout"));
    label = dynamic_cast<Gtk::Label*>(m_roundaboutVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_roundaboutVal);
    // Roundaboutish
    m_roundaboutishVal = manage(new Gtk::CheckButton("rb_ish"));
    label = dynamic_cast<Gtk::Label*>(m_roundaboutishVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_roundaboutishVal);
    // Multi dig
    m_multidigVal = manage(new Gtk::CheckButton("multi dig"));
    label = dynamic_cast<Gtk::Label*>(m_multidigVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_multidigVal);
    // Controlled access
    m_controlledAccessVal = manage(new Gtk::CheckButton("ctrl acc"));
    label = dynamic_cast<Gtk::Label*>(m_controlledAccessVal->get_child());
    if(label != NULL)
        label->set_alignment(XALIGN, 0.5);
    box->pack_start(*m_controlledAccessVal);
    table->attach(*box, 0, 2, 2, 3,
                  Gtk::FILL | Gtk::EXPAND, Gtk::FILL);

    // Set editable
    m_roadClassVal->set_state(Gtk::STATE_INSENSITIVE);
    m_roadConditionVal->set_state(Gtk::STATE_INSENSITIVE);
#ifdef MAP_EDITABLE
    m_houseNumberValLS->set_state(Gtk::STATE_NORMAL);
    m_houseNumberValLE->set_state(Gtk::STATE_NORMAL);
    m_houseNumberValRS->set_state(Gtk::STATE_NORMAL);
    m_houseNumberValRE->set_state(Gtk::STATE_NORMAL);
    m_houseNumberTypeVal->set_state(Gtk::STATE_NORMAL);
    m_rampVal->set_state(Gtk::STATE_NORMAL);
    m_roundaboutVal->set_state(Gtk::STATE_NORMAL);
    m_roundaboutishVal->set_state(Gtk::STATE_NORMAL);
    m_multidigVal->set_state(Gtk::STATE_NORMAL);
#else
    m_houseNumberValLS->set_state(Gtk::STATE_INSENSITIVE);
    m_houseNumberValLE->set_state(Gtk::STATE_INSENSITIVE);
    m_houseNumberValRS->set_state(Gtk::STATE_INSENSITIVE);
    m_houseNumberValRE->set_state(Gtk::STATE_INSENSITIVE);
    m_houseNumberTypeVal->set_state(Gtk::STATE_INSENSITIVE);
    m_rampVal->set_state(Gtk::STATE_INSENSITIVE);
    m_roundaboutVal->set_state(Gtk::STATE_INSENSITIVE);
    m_roundaboutishVal->set_state(Gtk::STATE_INSENSITIVE);
    m_multidigVal->set_state(Gtk::STATE_INSENSITIVE);
    m_controlledAccessVal->set_state(Gtk::STATE_INSENSITIVE);
#endif

    // Add the table to this frame
    add(*table);
}
Example #30
0
void setTableSensitivity(string table, bool b) {
    Gtk::Table* tab;
    VRGuiBuilder()->get_widget(table, tab);
    tab->set_sensitive(b);
}