//------------------------------------------------------------------------------
bool ListModelWrapper::init_gtktreeiter(GtkTreeIter* it, const bec::NodeId& node) const {
  if (*_tm && it && node.is_valid()) {
    Index id(it, node);
    id.stamp(_stamp);
  }
  return it && node.is_valid();
}
//------------------------------------------------------------------------------
Index::Index(GtkTreeIter* it, const bec::NodeId& node)
      : _raw_data((char *)it)
      , _ext(0)
{
  //memset(_raw_data, 0xff, sizeof(*it));
  //*_raw_data = 0;
  reset_iter(it);

  const int depth = node.depth();

  const Mode m = (depth < MaxDepth) ? (depth == 1 ? ListNode : Internal) : External;
  mode(m);

  if (m == External)
  {
    const std::string nrepr = node.toString();
    std::pair<ExternalMap::iterator, bool> res = _ext_map.insert(nrepr);
    _ext = const_cast<std::string*>(&(*(res.first)));
    it->user_data = (void*)_ext;
  }
  else if (m == Internal)
  {
    for (int i = 0; i < depth; ++i)
      word(i, node[i]);
  }
  else if (m == ListNode)
  {
    it->user_data = (void*)(intptr_t)(node[0]);
  }
}
//------------------------------------------------------------------------------
Gtk::TreeModel::Path ListModelWrapper::get_path_vfunc(const iterator& iter) const {
  const bec::NodeId node = node_for_iter(iter);
  Gtk::TreeModel::Path path;

  if (node.is_valid()) {
    const int node_depth = node.depth();

    for (int i = 0; i < node_depth; i++)
      path.push_back(node[i]);
  }

  return path;
}
//------------------------------------------------------------------------------
Gtk::TreeModel::Path node2path(const ::bec::NodeId& node) {
  const int depth = node.depth();
  Gtk::TreeModel::Path path;

  for (int i = 0; i < depth; i++)
    path.push_back(node[i]);

  return path;
}
std::string PhysicalOverviewBE::get_node_drag_type(const bec::NodeId &node) {
  // for schema objects
  if (node.depth() > 1 && node[0] == 1)
    return WB_DBOBJECT_DRAG_TYPE;
  else if (node == SCRIPT_NODE)
    return "file";
  else if (node == NOTE_NODE)
    return "file";
  return OverviewBE::get_node_drag_type(node);
}
Exemplo n.º 6
0
bec::IconId bec::ValidationMessagesBE::get_field_icon(const bec::NodeId &node, ColumnId column, IconSize)
{
  bec::IconId icon_id = _info_icon;
  
  if (column == bec::ValidationMessagesBE::Description)
  {
    const MessageList::size_type idx = node.end();

    if (idx < _errors.size())
      icon_id = _error_icon;
    else
      icon_id = _warning_icon;
  }
  
  return icon_id;
}
Exemplo n.º 7
0
bool bec::ValidationMessagesBE::get_field(const bec::NodeId &node, ColumnId column, std::string &value)
{
  bool ret = false;
  if (column == bec::ValidationMessagesBE::Description)
  {
    const MessageList::size_type idx = node.end();
  
    if (idx < _errors.size())
      value = _errors[idx].msg;
    else
      value = _warnings[idx].msg;

    ret = true;
  }
  
  return ret;
}
//------------------------------------------------------------------------------
void TreeModelWrapper::update_root_node(const bec::NodeId& root_node) {
  _root_node_path = root_node.toString();
  _root_node_path_dot = root_node.toString() + ".";

  _stamp++;
}