コード例 #1
0
  HexDataViewer(BinaryDataEditor *owner, bool read_only)
  : BinaryDataViewer(owner), _tree(mforms::TreeShowColumnLines|mforms::TreeShowRowLines|mforms::TreeFlatList), _box(true)
  {
    _offset = 0;
    _block_size = 8 * 1024;
    
    add(&_tree, true, true);
    add(&_box, false, true);

    _box.set_spacing(8);
    _box.add(&_first, false, true);
    _box.add(&_back, false, true);
    _box.add(&_next, false, true);
    _box.add(&_last, false, true);
    _box.add(&_label, true, true);
    
    _label.set_text("Viewing Range 0 to 16KB");
    _first.set_text("<< First");
    _back.set_text("< Previous");
    _next.set_text("Next >");
    _last.set_text("Last >>");
    scoped_connect(_first.signal_clicked(),boost::bind(&HexDataViewer::go, this, -2));
    scoped_connect(_back.signal_clicked(),boost::bind(&HexDataViewer::go, this, -1));
    scoped_connect(_next.signal_clicked(),boost::bind(&HexDataViewer::go, this, 1));
    scoped_connect(_last.signal_clicked(),boost::bind(&HexDataViewer::go, this, 2));
    
    _tree.add_column(mforms::StringColumnType, "Offset", 100, true);

    for (int i= 0; i < 16; i++)
      _tree.add_column(mforms::StringColumnType, base::strfmt("%X", i), 25, !read_only);
    _tree.end_columns();

    _tree.set_cell_edit_handler(boost::bind(&HexDataViewer::set_cell_value, this, _1, _2, _3));
  }
コード例 #2
0
void BinaryDataEditor::setup()
{
  set_title("Edit Data");
  set_content(&_box);
  _box.set_padding(12);
  _box.set_spacing(12);
  
  _box.add(&_tab_view, true, true);
  _box.add(&_length_text, false, true);
  _box.add(&_hbox, false, true);

  _hbox.add(&_export, false, true);
  if (!_read_only)
    _hbox.add(&_import, false, true);
  
  if (!_read_only)
    _hbox.add_end(&_save, false, true);
  _hbox.add_end(&_close, false, true);
  _hbox.set_spacing(12);
  
  _save.set_text("Apply");
  _close.set_text("Close");
  _export.set_text("Save...");
  _import.set_text("Load...");
  
  scoped_connect(_tab_view.signal_tab_changed(),boost::bind(&BinaryDataEditor::tab_changed, this));
  
  scoped_connect(_save.signal_clicked(),boost::bind(&BinaryDataEditor::save, this));
  scoped_connect(_close.signal_clicked(),boost::bind(&BinaryDataEditor::close, this));
  scoped_connect(_import.signal_clicked(),boost::bind(&BinaryDataEditor::import_value, this));
  scoped_connect(_export.signal_clicked(),boost::bind(&BinaryDataEditor::export_value, this));

  set_size(800, 500); // Golden ratio.
  center();
}
コード例 #3
0
void Wb_plugin::exec_task(bool sync)
{
  set_task_proc();

  bec::GRTTask::Ref task = bec::GRTTask::create_task(task_desc(), _grtm->get_dispatcher(), _task_proc_cb);

  scoped_connect(task->signal_message(),boost::bind(&Wb_plugin::process_task_msg, this, _1));
  scoped_connect(task->signal_failed(),boost::bind(&Wb_plugin::process_task_fail, this, _1));
  scoped_connect(task->signal_finished(),boost::bind(&Wb_plugin::process_task_finish, this, _1));

  if (sync)
    _grtm->get_dispatcher()->add_task_and_wait(task);
  else
    _grtm->get_dispatcher()->add_task(task);
}
コード例 #4
0
void Wb_plugin::exec_task(bool sync) {
  set_task_proc();

  bec::GRTTask::Ref task =
    bec::GRTTask::create_task(task_desc(), bec::GRTManager::get()->get_dispatcher(), _task_proc_cb);

  scoped_connect(task->signal_message(), std::bind(&Wb_plugin::process_task_msg, this, std::placeholders::_1));
  scoped_connect(task->signal_failed(), std::bind(&Wb_plugin::process_task_fail, this, std::placeholders::_1));
  scoped_connect(task->signal_finished(), std::bind(&Wb_plugin::process_task_finish, this, std::placeholders::_1));

  if (sync)
    bec::GRTManager::get()->get_dispatcher()->add_task_and_wait(task);
  else
    bec::GRTManager::get()->get_dispatcher()->add_task(task);
}
コード例 #5
0
DocumentPropertiesForm::DocumentPropertiesForm(wb::WBContextUI *wbui)
  : Form(NULL, mforms::FormResizable), _bottom_box(true), _text(mforms::BothScrollBars)
{
  _wbui= wbui;
  
  set_title(_("Document Properties"));
  set_name("document_properties");
  
  set_content(&_table);
  _table.set_padding(TOP_FORM_PADDING);
  _table.set_row_spacing(8);
  _table.set_column_spacing(4);
  _table.set_row_count(8);
  _table.set_column_count(2);

  add_control(_("Name:"), &_entry1);
  add_control(_("Version:"), &_entry2);
  add_control(_("Author:"), &_entry3);
  add_control(_("Project:"), &_entry4);
  add_control(_("Created:"), &_entry5);
  add_control(_("Last Changed:"), &_entry6);
  add_control(_("Description:"), &_text, true);


  _entry5.set_enabled(false);
  _entry6.set_enabled(false);
  
  _table.add(&_bottom_box, 0, 2, 7, 8, mforms::HFillFlag);
  _bottom_box.set_spacing(8);

  scoped_connect(_ok_button.signal_clicked(),boost::bind(&DocumentPropertiesForm::ok_clicked, this));
  scoped_connect(_cancel_button.signal_clicked(),boost::bind(&DocumentPropertiesForm::cancel_clicked, this));
  
  _ok_button.enable_internal_padding(true);
  _cancel_button.enable_internal_padding(true);

  _bottom_box.add_end(&_ok_button, false, true);
  _ok_button.set_text(_(" OK "));

  _bottom_box.add_end(&_cancel_button, false, true);
  _cancel_button.set_text(_("Cancel"));

  set_size(400, 400);
  
  center();
  
  pull_values();
}
コード例 #6
0
DBSearchPanel::DBSearchPanel(bec::GRTManager* grtm): Box(false),
    _progress_box(true), _results_tree(mforms::TreeAltRowColors), _update_timer(NULL), _grtm(grtm), _search_finished(true)
{
    set_spacing(8);

    _pause_button.set_text("Pause");
    scoped_connect(_pause_button.signal_clicked(), boost::bind(&DBSearchPanel::toggle_pause, this));

    _progress_box.set_spacing(4);

    _progress_label.set_text(_("Searching in server..."));
    add(&_progress_label, false, true);
    _progress_box.add(&_progress_bar, true, true);
    _progress_box.add(&_pause_button, false, true);
    add(&_progress_box, false, true);

    _results_tree.set_selection_mode(mforms::TreeSelectMultiple);
    _results_tree.add_column(mforms::StringColumnType ,"Schema", 100);
    _results_tree.add_column(mforms::StringColumnType, "Table", 100);
    _results_tree.add_column(mforms::StringColumnType, "Key", 80);
    _results_tree.add_column(mforms::StringColumnType, "Column", 100);
    _results_tree.add_column(mforms::StringColumnType, "Data", 800);
    _results_tree.end_columns();
    add(&_results_tree, true, true);

    _results_tree.set_context_menu(&_context_menu);
    _context_menu.signal_will_show()->connect(boost::bind(&DBSearchPanel::prepare_menu, this));

    _matches_label.set_text(_("Matches:"));
    add(&_matches_label, false, true);
}
コード例 #7
0
ListModelWrapper::ListModelWrapper(bec::ListModel* tm, Gtk::TreeView* treeview, const std::string& name)
  : Glib::ObjectBase(typeid(ListModelWrapper)),
    Glib::Object(),
    _treeview(treeview),
    _iconview(0),
    _context_menu(0),
    _stamp(1),
    _columns(this, treeview),
    _icon_size(bec::Icon16),
    _name(name) {
  _invalid = false;

  scoped_connect(tm->tree_changed_signal(),
                 std::bind(&::ListModelWrapper::model_changed, this, std::placeholders::_1, std::placeholders::_2));

  // keep an indirect pointer because sometimes bec::ListModel is destroyed before the wrapper
  // and in that case we don't want to keep using the dead pointer
  _tm = new bec::ListModel*();
  *_tm = tm;

  tm->add_destroy_notify_callback(_tm, &ListModelWrapper::on_bec_model_destroyed);
#ifndef NO_MENU_MANAGER
  if (_treeview)
    _treeview->signal_event().connect(sigc::mem_fun(this, &ListModelWrapper::handle_popup_event));
#endif
}
コード例 #8
0
 JsonDataViewer(BinaryDataEditor *owner, JsonParser::JsonValue &value, const std::string &encoding)
   : BinaryDataViewer(owner), _encoding(encoding)
 {
   set_spacing(8);
   _jsonView.setJson(value);
   add(&_jsonView, true, true);
   scoped_connect(_jsonView.editorDataChanged(), boost::bind(&JsonDataViewer::edited, this, _1));
 }
コード例 #9
0
bec::ValidationMessagesBE::ValidationMessagesBE()
{
  _error_icon   = IconManager::get_instance()->get_icon_id("mini_error.png");
  _warning_icon = IconManager::get_instance()->get_icon_id("mini_warning.png");
  _info_icon    = IconManager::get_instance()->get_icon_id("mini_notice.png");

  scoped_connect(bec::ValidationManager::signal_notify(),boost::bind(&bec::ValidationMessagesBE::validation_message, this, _1, _2, _3, _4));
}
コード例 #10
0
  TextDataViewer(BinaryDataEditor *owner, const std::string &encoding, bool read_only)
  : BinaryDataViewer(owner), _text(), _encoding(encoding)
  {
    if (_encoding.empty())
      _encoding = "UTF-8";
    
    add(&_message, false, true);
    add_end(&_text, true, true);
    
    _text.set_language(mforms::LanguageNone);
    _text.set_features(mforms::FeatureWrapText, true);
    _text.set_features(mforms::FeatureReadOnly, read_only);
    
    scoped_connect(_text.signal_changed(),boost::bind(&TextDataViewer::edited, this));

    _text.set_show_find_panel_callback(boost::bind(&TextDataViewer::embed_find_panel, this, _2));
  }
コード例 #11
0
void StringCheckBoxList::set_strings(const std::vector<std::string> &strings)
{
  for (std::vector<mforms::CheckBox*>::const_iterator iter= _items.begin();
       iter != _items.end(); ++iter)
    _box.remove(*iter);
  _items.clear();
  
  for (std::vector<std::string>::const_iterator iter= strings.begin();
       iter != strings.end(); ++iter)
  {
    mforms::CheckBox *cb= mforms::manage(new mforms::CheckBox());
    cb->set_text(*iter);
    cb->set_name(*iter);
    
    scoped_connect(cb->signal_clicked(),boost::bind(&StringCheckBoxList::toggled, this));

    _box.add(cb, false, false);
    _items.push_back(cb);
  }
}
コード例 #12
0
ValidationPanel::ValidationPanel()
  : Gtk::Box(Gtk::ORIENTATION_VERTICAL), _label_box(0), _label(_("<small>Validations</small>")) {
  _label.set_use_markup(true);
  _model = ListModelWrapper::create(&_be, &_tv, "ValidationModel");

  _model->model().append_string_column(bec::ValidationMessagesBE::Description, _("Description"), RO, WITH_ICON);

  _tv.set_fixed_height_mode(false);
  _tv.set_model(_model);

  add(_tv);

  show_all();

  std::vector<Gtk::CellRenderer*> cells = _tv.get_column(0)->get_cells();
  Gtk::CellRendererText* ct = dynamic_cast<Gtk::CellRendererText*>(cells[1]);
  ct->property_wrap_width() = 120;
  ct->property_wrap_mode() = Pango::WRAP_WORD;

  _tv.signal_size_allocate().connect(sigc::mem_fun(this, &ValidationPanel::size_request_slot));

  scoped_connect(_be.tree_changed_signal(), sigc::mem_fun(this, &ValidationPanel::refresh));
}