Exemplo n.º 1
0
bool Controls::run_set_estado(Glib::ustring valor){
    if (estado != valor){
        estado = valor;
        Gtk::Image *img = dynamic_cast<Gtk::Image*> (pla->get_icon_widget());
        if (estado == "playing"){
            img->set(pixbufplay);
            pla->set_tooltip_text("Pausar");}
        else{
            img->set(pixbufpause);
            pla->set_tooltip_text("Reproducir");}}
    return false;}
DbMySQLViewEditor::DbMySQLViewEditor(grt::Module *m, bec::GRTManager *grtm, const grt::BaseListRef &args)
    : PluginEditorBase(m ,grtm, args, "modules/data/editor_view.glade")
    , _be(new MySQLViewEditorBE(grtm, db_mysql_ViewRef::cast_from(args[0])))
{
  xml()->get_widget("mysql_view_editor_notebook", _editor_notebook);

  Gtk::Image *image;
  xml()->get_widget("view_editor_image", image);
  image->set(ImageCache::get_instance()->image_from_filename("db.View.editor.48x48.png", false));
  xml()->get_widget("view_editor_image2", image);
  image->set(ImageCache::get_instance()->image_from_filename("db.View.editor.48x48.png", false));

  _be->set_refresh_ui_slot(sigc::mem_fun(this, &DbMySQLViewEditor::refresh_form_data));
  
  _editor_notebook->reparent(*this);
  _editor_notebook->show();



  Gtk::VBox *ddl_win;
  xml()->get_widget("editor_placeholder", ddl_win);
  embed_code_editor(_be->get_sql_editor()->get_container(), ddl_win);
  _be->load_view_sql();

  if (!is_editing_live_object())
  {
    _privs_page     = new DbMySQLEditorPrivPage(_be);
    _editor_notebook->append_page(_privs_page->page(), "Privileges");

    Gtk::TextView *tview(0);
    xml()->get_widget("viewcomment", tview);
    tview->get_buffer()->set_text(_be->get_comment());

    tview->signal_focus_out_event().connect(sigc::bind(sigc::mem_fun(this, &DbMySQLViewEditor::comment_lost_focus), tview), false);
  }
  else
  {
    _editor_notebook->remove_page(1);
    _privs_page= NULL;
  }
    
  refresh_form_data();

  _be->reset_editor_undo_stack();

  show_all();
}
Exemplo n.º 3
0
WindowLevelToolButton::WindowLevelToolButton() {
	Gtk::HBox* hbox = manage(new Gtk::HBox);

	Gtk::Image* image = manage(new Gtk::Image);
	Glib::RefPtr<Gdk::Pixbuf> p = Aeskulap::IconFactory::load_from_file("cursor_windowlevel.png");
	if(p) {
		image->set(p);
	}
	image->show();
	//image->set_padding(6, 0);

	m_invert = manage(new Gtk::ToggleToolButton(*image));
	m_invert->set_size_request(32, 32);
	m_invert->set_tooltip(m_tooltips, gettext("Invert windowlevel"));
	m_invert->show();
	m_invert->signal_toggled().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_invert));

	Gtk::VBox* vbox = manage(new Gtk::VBox);

	vbox->pack_start(*m_invert, true, false);
	vbox->show();

	hbox->pack_start(*vbox, Gtk::PACK_SHRINK);

	vbox = manage(new Gtk::VBox);
	vbox->show();

	m_combo = manage(new Gtk::ComboBoxText);
	m_combo->set_size_request(-1, 32);
	m_combo->show();
	m_combo->signal_changed().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_changed));

	vbox->pack_start(*m_combo, true, false);

	hbox->pack_start(*vbox, Gtk::PACK_SHRINK);

	vbox = manage(new Gtk::VBox);
	vbox->show();

	image = manage(new Gtk::Image(Gtk::Stock::ADD, Gtk::ICON_SIZE_SMALL_TOOLBAR));
	image->show();

	Gtk::ToolButton* btn = manage(new Gtk::ToolButton(*image));
	btn->set_size_request(32, 32);
	btn->set_tooltip(m_tooltips, gettext("Add new windowlevel preset"));
	btn->show();
	btn->signal_clicked().connect(sigc::mem_fun(*this, &WindowLevelToolButton::on_add));

	vbox->pack_start(*btn, true, false);
	hbox->pack_start(*vbox, true,false);
	
	hbox->show();

	add(*hbox);

	update();
	m_widgetlist.insert(this);
}
 void ArtistsWidget::insertReturn() {
   Gtk::TreeModel::Row row = *(treeModel->append());
   //    row[columns.artist] = "Home";
   row[columns.isArtist] = -1;
   Gtk::Image i;
   //i.set_from_icon_name("gtk-media-pause", Gtk::IconSize::from_name("GTK_ICON_SIZE_BUTTON"));
   i.set("ui/arrowleft.png");
   row[columns.image] = i.get_pixbuf();
 }
Exemplo n.º 5
0
  void cIconTheme::LoadStockIconRotatedClockwise(const std::string& sStockIconName, Gtk::Image& image)
  {
    std::cout<<"cIconTheme::LoadStockIconRotatedClockwise"<<std::endl;

    // This doesn't seem to work
    //Gtk::StockItem item;
    //Gtk::Stock::lookup(idStockIcon, item);

    Glib::RefPtr<Gdk::Pixbuf> pixbuf = icon_theme->load_icon(sStockIconName.c_str(), 32, Gtk::ICON_LOOKUP_USE_BUILTIN);

    ASSERT(pixbuf);

    // Rotate the pixbuf and assign it to our image
    image.set(pixbuf->rotate_simple(Gdk::PixbufRotation::PIXBUF_ROTATE_CLOCKWISE));
  }
Exemplo n.º 6
0
 void make_image(Gtk::Image& image) {
   boost::lock_guard<boost::mutex> scoped_lock(predata_mutex_);
   auto pixbuf = Gdk::Pixbuf::create_from_data(
       &data_[0],
       Gdk::COLORSPACE_RGB,
       has_alpha_,
       8 /*bits per sample*/,
       dims_.width(),
       dims_.height(),
       rowstride_
     );
   image.set(pixbuf);
   boost::lock_guard<boost::mutex> scoped_lock2(barrier_mutex_);
   barrier_->wait();
 }
  void ArtistsWidget::loadArtistsSongs(std::string artist) {

    selectedArtist = artist;

    // set label of tab
    artistsLabel->set_text(selectedArtist);

    Gtk::TreeModel::Path path;
    Gtk::CellRenderer* cell;
    artistsView->get_cursor(path, cell);
    std::cout << "sel path:" << path.to_string();
    //    cell->;

    // clear treemodel
    m_actualSongs.clear();


    // start searching for artist
    MPD::Client::GetInstance()->StartSearch(1);
    MPD::Client::GetInstance()->AddSearch(MPD_TAG_ARTIST, artist);
    MPD::Client::GetInstance()->CommitSearch(m_actualSongs);

    // sort songs
    std::sort(m_actualSongs.begin(), m_actualSongs.end(), actualSongSortCond);

    artistsView->unset_model();
    treeModel->clear();

    // insert return button
    insertReturn();

    for (int i = 0; i < m_actualSongs.size(); i++) {
      Gtk::TreeModel::Row row = *(treeModel->append());
      row[columns.artist] = m_actualSongs[i]->GetTitle();
      Gtk::Image image;
      image.set("ui/icon_smaller.png");
      row[columns.image] = image.get_pixbuf();
      row[columns.isArtist] = 0;
      row[columns.song] = m_actualSongs[i];
    }


    artistsView->set_model(treeModel);
    //scroll to top
    artistScrolledWindow->get_vadjustment()->set_value(0);

  }
//------------------------------------------------------------------------------
DbMySQLRoutineGroupEditor::DbMySQLRoutineGroupEditor(grt::Module *m, bec::GRTManager *grtm, const grt::BaseListRef &args)
    : PluginEditorBase(m, grtm, args, "modules/data/editor_rg.glade")
    , _be(new MySQLRoutineGroupEditorBE(grtm, db_mysql_RoutineGroupRef::cast_from(args[0])))
    , _routines_model(model_from_string_list(std::vector<std::string>(), &_routines_columns))
{
  xml()->get_widget("mysql_rg_editor_notebook", _editor_notebook);

  Gtk::Image *image;
  xml()->get_widget("rg_image", image);
  image->set(ImageCache::get_instance()->image_from_filename("db.RoutineGroup.editor.48x48.png", false));
  
  _be->set_refresh_ui_slot(sigc::mem_fun(this, &DbMySQLRoutineGroupEditor::refresh_form_data));
  
  _editor_notebook->reparent(*this);
  _editor_notebook->show();

  bind_entry_and_be_setter("rg_name", this, &DbMySQLRoutineGroupEditor::set_group_name);
  
  Gtk::TextView* tv;
  xml()->get_widget("rg_comment", tv);
  add_text_change_timer(tv, sigc::mem_fun(this, &DbMySQLRoutineGroupEditor::set_comment));
  
  Gtk::VBox* code_win;
  xml()->get_widget("rg_code_holder", code_win);
  embed_code_editor(_be->get_sql_editor()->get_container(), code_win);
  _be->load_routines_sql();
  
  refresh_form_data();
  
  xml()->get_widget("rg_list", _rg_list);
  
  _rg_list->set_model(_routines_model);
  _rg_list->append_column("Routine", _routines_columns->item);
  _rg_list->set_headers_visible(false);
  _rg_list->signal_row_activated().connect(sigc::mem_fun(this, &DbMySQLRoutineGroupEditor::activate_row));

  // Setup DnD
  std::vector<Gtk::TargetEntry> targets;

  targets.push_back(Gtk::TargetEntry(WB_DBOBJECT_DRAG_TYPE, Gtk::TARGET_SAME_APP));
  _rg_list->drag_dest_set(targets, Gtk::DEST_DEFAULT_ALL,Gdk::ACTION_COPY);
  _rg_list->signal_drag_data_received().connect(sigc::mem_fun(this, &DbMySQLRoutineGroupEditor::on_routine_drop));
  _rg_list->signal_event().connect(sigc::mem_fun(*this, &DbMySQLRoutineGroupEditor::process_event));

  show_all();
}
Exemplo n.º 9
0
    SchemaEditor(grt::Module *m, bec::GRTManager *grtm, const grt::BaseListRef &args)
        : PluginEditorBase(m, grtm, args, "modules/data/editor_schema.glade")
        , _be(new MySQLSchemaEditorBE(grtm, db_mysql_SchemaRef::cast_from(args[0])))
    {
        xml()->get_widget("mysql_schema_editor_notebook", _editor_notebook);

        Gtk::Widget *widget;
        xml()->get_widget("base_table", widget);

        Gtk::Image *image;
        xml()->get_widget("image", image);
        image->set(ImageCache::get_instance()->image_from_filename("db.Schema.editor.48x48.png", false));

        bind_entry_and_be_setter("name_entry", this, &SchemaEditor::set_name);
        if (_be->is_editing_live_object() && _be->get_schema()->oldName() != "")
        {
            Gtk::Entry *entry;
            xml()->get_widget("name_entry", entry);
            entry->set_sensitive(false);
        }

        Gtk::Button *btn;
        xml()->get_widget("refactor_btn", btn);
        btn->set_sensitive(_be->refactor_possible());
        btn->signal_clicked().connect(sigc::mem_fun(this, &SchemaEditor::refactor_schema));

        Gtk::ComboBox *combo;
        xml()->get_widget("collation_combo", combo);
        Glib::RefPtr<Gtk::ListStore> store(Glib::RefPtr<Gtk::ListStore>::cast_dynamic(xml()->get_object("collation_store")));
        setup_combo_for_string_list(combo);
        fill_combo_from_string_list(combo, _be->get_charset_collation_list());
        add_option_combo_change_handler(combo, "CHARACTER SET - COLLATE", sigc::mem_fun(this, &SchemaEditor::set_schema_option_by_name));

        Gtk::TextView *tview;
        xml()->get_widget("text_view", tview);
        add_text_change_timer(tview, sigc::mem_fun(this, &SchemaEditor::set_comment));

        //!widget->reparent(*this);
        add(*_editor_notebook);
        _editor_notebook->show();

        show_all();

        refresh_form_data();
    }
Exemplo n.º 10
0
 virtual void do_refresh_form_data()
 {    
   Gtk::Entry *entry;
   int w, h;
   _be.get_size(w, h);
   _xml->get_widget("width_entry", entry);
   entry->set_text(strfmt("%i", w));
   _xml->get_widget("height_entry", entry);
   entry->set_text(strfmt("%i", h));
   
   Gtk::CheckButton *check;
   _xml->get_widget("aspect_check", check);
   check->set_active(_be.get_keep_aspect_ratio());
 
   Glib::RefPtr<Gdk::Pixbuf> pixbuf(Gdk::Pixbuf::create_from_file(_be.get_attached_image_path()));
   if (pixbuf)
     _image->set(pixbuf);  
   else
     g_message("ImageEditorFE: can not set image from %s[%s]", _be.get_filename().c_str(), _be.get_attached_image_path().c_str());    
 }
Exemplo n.º 11
0
bool refresh_captcha() {
	///Refresh the CAPTCHA in the post section
	
	string s1 = getRemoteFile("http://www.google.com/recaptcha/api/challenge?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc");
	
	std::ifstream t(s1.c_str());
	string s2;
	t.seekg(0, ios::end);
	s2.reserve(t.tellg());
	t.seekg(0, ios::beg);
	s2.assign((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
	
	//Google tries to be clever and make the script JSONP, so we need to remove all of the JavaScript stuff
	boost::regex jsonp1("var RecaptchaState = ");
	string s3 = boost::regex_replace(s2, jsonp1, "");
	
	boost::regex jsonp2("^\\s*([a-zA-Z0-9_]*)\\s:");
	string s4 = boost::regex_replace(s3, jsonp2, "\"$1\":");
	
	boost::regex jsonp3("^document.write\\(.*$");
	string s5 = boost::regex_replace(s4, jsonp3, "");
	
	boost::regex jsonp4(";");
	string s6 = boost::regex_replace(s5, jsonp4, "");
	
	boost::regex jsonp5("'");
	string s7 = boost::regex_replace(s6, jsonp5, "\"");
	
	Json::Value root;   // will contain the root value after parsing.
	Json::Reader reader;
	bool parsingSuccessful = reader.parse(s7, root);
	
	Gtk::Image *captcha = 0;
	builder->get_widget("image7", captcha);

	captcha->set(getRemoteFile("http://www.google.com/recaptcha/api/image?c="+root["challenge"].asString()));
	CHALLENGE = root["challenge"].asString();
	
	return true;
}
//------------------------------------------------------------------------------
void DbMySQLTableEditor::toggle_header_part()
{
  Gtk::Button *hide_button = 0;
  xml()->get_widget("hide_button", hide_button);

  Gtk::Image *image = 0;
  xml()->get_widget("table_editor_image", image);
  const bool make_image_small = image->get_data("is_large");
  image->set(ImageCache::get_instance()->image_from_filename(make_image_small ? "db.Table.editor.24x24.png" : "db.Table.editor.48x48.png", false));
  image->set_data("is_large", (void*)(!make_image_small));

  Gtk::VBox* image_box = dynamic_cast<Gtk::VBox*>(hide_button->get_image());
  if (image_box)
  {
    const std::vector<Gtk::Widget*> images = image_box->get_children();
    for (int i = ((int)images.size()) - 1; i >= 0; --i)
    {
      if (images[i]->is_visible())
        images[i]->hide();
      else
        images[i]->show();
    }

    const char* const names[] = {"collation_label", "collation_combo", "engine_label", "engine_combo", "comment_box"};
    const int names_size = sizeof(names) / sizeof(const char**);
    for (int i = 0; i < names_size; ++i)
    {
      Gtk::Widget* w = 0;
      xml()->get_widget(names[i], w);
      if (w)
      {
        if (w->is_visible())
          w->hide();
        else
          w->show();
      }
    }
  }
}
Exemplo n.º 13
0
 void cIconTheme::LoadStockIcon(const std::string& sStockIconName, Gtk::Image& image)
 {
   std::cout<<"cIconTheme::LoadStockIcon"<<std::endl;
   image.set(icon_theme->load_icon(sStockIconName.c_str(), 32, Gtk::ICON_LOOKUP_USE_BUILTIN));
 }
Exemplo n.º 14
0
About::About()
{
	set_transient_for((Gtk::Window&)(*App::main_window));
#ifdef HAVE_GTK_ABOUTDIALOG_SET_PROGRAM_NAME
	set_program_name(PACKAGE_NAME);
#else
	set_name(PACKAGE_NAME);
#endif
	set_version(VERSION);
	set_comments(_("2D vector animation studio"));

	set_url_hook(sigc::mem_fun(*this, &About::on_link_clicked));
	set_website("http://synfig.org/");
	set_website_label(_("Visit the Synfig website"));

	set_copyright(_("Copyright 2001-2013\nRobert B. Quattlebaum Jr.,\nAdrian Bentley and Synfig contributors"));
	Glib::ustring license =
		"This program is free software; you can redistribute it and/or modify "
		"it under the terms of the GNU General Public License as published by "
		"the Free Software Foundation; either version 2 of the License, or "
		"(at your option) any later version.\n\n"

		"This program is distributed in the hope that it will be useful, "
		"but WITHOUT ANY WARRANTY; without even the implied warranty of "
		"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
		"GNU General Public License for more details.\n\n"

		"You should have received a copy of the GNU General Public License along "
		"with this program; if not, write to the Free Software Foundation, Inc., "
		"51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or visit: http://www.gnu.org/";
	set_license(license);
#ifdef HAVE_GTK_ABOUTDIALOG_SET_WRAP_LICENSE
	set_wrap_license(true);
#endif

	std::vector<Glib::ustring> authors;
	authors.push_back(_("Original developers:"));
	authors.push_back("");
	authors.push_back("Robert B. Quattlebaum Jr (darco)");
	authors.push_back("Adrian Bentley");
	authors.push_back("");
	authors.push_back(_("Contributors:"));
	authors.push_back("");
	authors.push_back("Adrian Winchell (SnapSilverlight)");
	authors.push_back("Andreas Jochens");
	authors.push_back("Brendon Higgins");
	authors.push_back("Carlos López González (genete)");
	authors.push_back("Carlos A. Sosa Navarro");
	authors.push_back("Chris Moore (dooglus)");
	authors.push_back("Chris Norman (pixelgeek)");
	authors.push_back("Cyril Brulebois (KiBi)");
	authors.push_back("Daniel Fort");
	authors.push_back("Daniel Hornung (rubikcube)");
	authors.push_back("David Roden (Bombe)");
	authors.push_back("Dmitriy Pomerantsev (Atrus)");
	authors.push_back("Douglas Lau");
	authors.push_back("Gerald Young (Yoyobuae)");
	authors.push_back("Gerco Ballintijn");
	authors.push_back("IL'dar AKHmetgaleev (AkhIL)");
	authors.push_back("Ivan Mahonin");
	authors.push_back("Jerome Blanchi (d.j.a.y.)");
	authors.push_back("Konstantin Dmitriev (zelgadis)");
	authors.push_back("Luka Pravica");
	authors.push_back("Nikita Kitaev (nikitakit)");
	authors.push_back("Martin Michlmayr (tbm)");
	authors.push_back("Miguel Gea Milvaques (xerakko)");
	authors.push_back("Paul Wise (pabs)");
	authors.push_back("Ralf Corsepius");
	authors.push_back("Ray Frederikson");
	authors.push_back("Timo Paulssen (timonator)");
	authors.push_back("Yu Chen (jcome)");
	authors.push_back("Yue Shi Lai");
	set_authors(authors);

	std::vector<Glib::ustring> artists;
	artists.push_back("Aurore D (rore)");
	artists.push_back("Bertrand Grégoire (berteh)");
	artists.push_back("Carl-Christian Gehl (Razputin)");
	artists.push_back("Carlos López González (genete)");
	artists.push_back("Chris Norman (pixelgeek)");
	artists.push_back("Daniel Hornung (rubikcube)");
	artists.push_back("David Rylander (rylleman)");
	artists.push_back("Franco Iacomella (Yaco)");
	artists.push_back("Gerald Young (Yoyobuae)");
	artists.push_back("Henrique Lopes Barone");
	artists.push_back("Konstantin Dmitriev (zelgadis)");
	artists.push_back("Madeleine Crubellier (mad0)");
	artists.push_back("Nikolai Mamashev (solkap)");
	artists.push_back("Robert B. Quattlebaum Jr. (darco)");
	artists.push_back("Thimotee Guiet (satrip)");
	artists.push_back("Yu Chen (jcome)");
	set_artists(artists);

	// TRANSLATORS: change this to your name, separate multiple names with \n
	set_translator_credits(_("translator-credits"));

	std::string imagepath;
#ifdef WIN32
	imagepath=App::get_base_path()+ETL_DIRECTORY_SEPARATOR+IMAGE_DIR;
#else
	imagepath=IMAGE_DIR;
#endif
	char* synfig_root=getenv("SYNFIG_ROOT");
	if(synfig_root) {
		imagepath=synfig_root;
		imagepath+=ETL_DIRECTORY_SEPARATOR;
		imagepath+="share";
		imagepath+=ETL_DIRECTORY_SEPARATOR;
		imagepath+="pixmaps";
	}
	imagepath+=ETL_DIRECTORY_SEPARATOR;

	Gtk::Image *Logo = manage(new class Gtk::Image());
	Logo->set(imagepath+"synfig_icon."IMAGE_EXT);
	set_logo(Logo->get_pixbuf());

#ifdef SHOW_EXTRA_INFO

	string extra_info = get_comments() + "\n";

	#ifdef DEVEL_VERSION
		extra_info += strprintf(_("\nDevelopment version:\n%s\n"),DEVEL_VERSION);
	#endif

	extra_info += "\n";

	extra_info += strprintf(_("Built on %s" /* at %s */ "\n"), __DATE__ /* , __TIME__ */ );

	extra_info += "\n";

	extra_info += strprintf(_("Built with:\n"), ETL_VERSION);
	extra_info += strprintf(_("ETL %s\n"), ETL_VERSION);
	extra_info += strprintf(_("Synfig API %s\n"), stringify(SYNFIG_VERSION));
	extra_info += strprintf(_("Synfig library %d\n"), SYNFIG_LIBRARY_VERSION);
	extra_info += strprintf(_("GTK+ %d.%d.%d\n"), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
	#ifdef __GNUC__
		extra_info += strprintf(_("GNU G++ %d.%d.%d\n"),__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__);
	#endif

	extra_info += "\n";

	extra_info += strprintf(_("Using:\n"), synfig::get_version());
	extra_info += strprintf(_("Synfig %s\n"), synfig::get_version());
	extra_info += strprintf(_("GTK+ %d.%d.%d"),gtk_major_version,gtk_minor_version,gtk_micro_version);

	#ifdef _DEBUG
		extra_info += "\n\nDEBUG BUILD";
	#endif

	set_comments(extra_info);

#endif

	// Hide the dialog when you click close
	signal_response().connect(sigc::mem_fun(*this, &About::close));
}
Exemplo n.º 15
0
 /**
  * Sets a new image from a stock-id for this button.
  * @param stock_id The stock_id of the image.
  * @param icon_size The size of the image to show.
  */
 void
 setStockID (Gtk::StockID const& stock_id
            ,const Gtk::IconSize icon_size = Gtk::ICON_SIZE_LARGE_TOOLBAR)
   {
     image_.set (stock_id, icon_size);
   }