void LayerTree::object_changed(const std::string &key, const grt::ValueRef &value, mforms::TreeNodeRef node) {
  FigureNode *fn = dynamic_cast<FigureNode *>(node->get_data());

  if (key == "name")
    node->set_string(0, fn->object->name());
  else if (key == "layer") {
    model_FigureRef figure(model_FigureRef::cast_from(fn->object));
    if (figure->layer() != value) {
      fn->conn.disconnect();
      node->remove_from_parent();

      if (figure->layer() == _diagram->rootLayer()) {
        int insertion_point = 0;
        // find the last node that's not a layer
        for (int c = count(); insertion_point < c; ++insertion_point) {
          mforms::TreeNodeRef n = node_at_row(insertion_point);
          FigureNode *nn = dynamic_cast<FigureNode *>(n->get_data());
          if (!nn)
            continue;
          if (nn->is_layer)
            break;
        }
        add_figure_node(mforms::TreeNodeRef(), figure, insertion_point);
      } else {
        mforms::TreeNodeRef layer_node = node_with_tag(figure->layer().id());

        add_figure_node(layer_node, figure);
      }
    }
  }
}
void DBSearchFilterPanel::cell_edited(mforms::TreeNodeRef node, int column, const std::string& value) {
  if ((_filter_tree.count() > 1) && (value == ""))
    node->remove_from_parent();

  if (column == 0) {
    node->set_string(0, value);
    if (_filter_tree.row_for_node(node) + 1 == _filter_tree.count())
      _filter_tree.add_node()->set_string(0, "Schema.Table.Column");
  }
}
Пример #3
0
 void set_cell_value(mforms::TreeNodeRef node, int column, const std::string &value)
 {
   size_t offset = _offset + _tree.row_for_node(node) * 16 + (column-1);
   
   if (offset < _owner->length())
   {
     int i;
     if (sscanf(value.c_str(), "%x", &i) != 1)
       return;
     if (i < 0 || i > 255)
       return;
     node->set_string(column, base::strfmt("%02x", i));
     
     *(unsigned char*)(_owner->data() + offset) = i;
     _owner->notify_edit();
   }
 }