コード例 #1
0
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);
      }
    }
  }
}
コード例 #2
0
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");
  }
}