NoteEditor(grt::Module *m, const grt::BaseListRef &args)
    : PluginEditorBase(m, args), _be(workbench_model_NoteFigureRef::cast_from(args[0])) {
    set_border_width(8);

    _xml = Gtk::Builder::create_from_file(bec::GRTManager::get()->get_data_file_path("modules/data/editor_note.glade"));

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

    Gtk::Image *image;
    _xml->get_widget("image", image);

    // image->set(grtm->get_data_file_path(""));

    Gtk::Entry *entry;
    _xml->get_widget("name_entry", entry);

    add_entry_change_timer(entry, sigc::mem_fun(this, &NoteEditor::set_name));

    Gtk::TextView *tview;
    _xml->get_widget("text_view", tview);

    add_text_change_timer(tview, sigc::mem_fun(_be, &NoteEditorBE::set_text));

    widget->reparent(*this);

    show_all();

    refresh_form_data();
  }
//------------------------------------------------------------------------------
void DbMySQLTableEditor::create_table_page()
{
  // Connect Table tab widgets
  bind_entry_and_be_setter("table_name", this, &DbMySQLTableEditor::set_table_name);

  Gtk::ComboBox* combo = 0;
  xml()->get_widget("engine_combo", combo);
  setup_combo_for_string_list(combo);
  fill_combo_from_string_list(combo, _be->get_engines_list());
  add_option_combo_change_handler(combo, "ENGINE", sigc::mem_fun(this, &DbMySQLTableEditor::set_table_option_by_name));

  combo = 0;
  xml()->get_widget("collation_combo", combo);
  setup_combo_for_string_list(combo);

  std::vector<std::string> collations(_be->get_charset_collation_list());
  collations.insert(collations.begin(), "*Default*");
  fill_combo_from_string_list(combo, collations);
  add_option_combo_change_handler(combo, "CHARACTER SET - COLLATE", sigc::mem_fun(this, &DbMySQLTableEditor::set_table_option_by_name));

  Gtk::TextView *tview = 0;
  xml()->get_widget("table_comments", tview);

  add_text_change_timer(tview, sigc::mem_fun(this, &DbMySQLTableEditor::set_comment));

}
//------------------------------------------------------------------------------
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();
}
Ejemplo n.º 4
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();
    }