Example #1
0
FileDialog::FileDialog() {
	
	VBoxContainer *vbc = memnew( VBoxContainer );
	add_child(vbc);
	set_child_rect(vbc);

	mode=MODE_SAVE_FILE;
	set_title("Save a File");
	
	dir = memnew(LineEdit);
	HBoxContainer *pathhb = memnew( HBoxContainer );
	pathhb->add_child(dir);
	dir->set_h_size_flags(SIZE_EXPAND_FILL);

	drives = memnew( OptionButton );
	pathhb->add_child(drives);
	drives->connect("item_selected",this,"_select_drive");

	makedir = memnew( Button );
	makedir->set_text("Create Folder");
	makedir->connect("pressed",this,"_make_dir");
	pathhb->add_child(makedir);
	
	vbc->add_margin_child("Path:",pathhb);
	
	tree = memnew(Tree);
	tree->set_hide_root(true);
	vbc->add_margin_child("Directories & Files:",tree,true);
	
	file = memnew(LineEdit);
	//add_child(file);
	vbc->add_margin_child("File:",file);
	

	filter = memnew( OptionButton );
	//add_child(filter);
	vbc->add_margin_child("Filter:",filter);
	filter->set_clip_text(true);//too many extensions overflow it

	dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	access=ACCESS_RESOURCES;
	_update_drives();

	
	connect("confirmed", this,"_action_pressed");
	//cancel->connect("pressed", this,"_cancel_pressed");
	tree->connect("cell_selected", this,"_tree_selected",varray(),CONNECT_DEFERRED);
	tree->connect("item_activated", this,"_tree_db_selected",varray());
	dir->connect("text_entered", this,"_dir_entered");
	file->connect("text_entered", this,"_file_entered");
	filter->connect("item_selected", this,"_filter_selected");

	
	confirm_save = memnew( ConfirmationDialog );
	confirm_save->set_as_toplevel(true);
	add_child(confirm_save);

	
	confirm_save->connect("confirmed", this,"_save_confirm_pressed");

	makedialog = memnew( ConfirmationDialog );
	makedialog->set_title("Create Folder");
	VBoxContainer *makevb= memnew( VBoxContainer );
	makedialog->add_child(makevb);
	makedialog->set_child_rect(makevb);
	makedirname = memnew( LineEdit );
	makevb->add_margin_child("Name:",makedirname);
	add_child(makedialog);
	makedialog->register_text_enter(makedirname);
	makedialog->connect("confirmed",this,"_make_dir_confirm");
	mkdirerr = memnew( AcceptDialog );
	mkdirerr->set_text("Could not create folder.");
	add_child(mkdirerr);


	//update_file_list();
	update_filters();
	update_dir();

	set_hide_on_ok(false);
	vbox=vbc;


	invalidated=true;
	if (register_func)
		register_func(this);
	
}
	EditorTranslationImportDialog(EditorTranslationImportPlugin *p_plugin) {

		plugin=p_plugin;


		set_title("Import Translation");

		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);



		VBoxContainer *csvb = memnew( VBoxContainer );

		HBoxContainer *hbc = memnew( HBoxContainer );
		csvb->add_child(hbc);
		vbc->add_margin_child("Source CSV:",csvb);

		import_path = memnew( LineEdit );
		import_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(import_path);
		ignore_first = memnew( CheckButton );
		ignore_first->set_text("Ignore First Row");
		csvb->add_child(ignore_first);

		Button * import_choose = memnew( Button );
		import_choose->set_text(" .. ");
		hbc->add_child(import_choose);

		import_choose->connect("pressed", this,"_browse");

		VBoxContainer *tcomp = memnew( VBoxContainer);
		hbc = memnew( HBoxContainer );
		tcomp->add_child(hbc);
		vbc->add_margin_child("Target Path:",tcomp);

		save_path = memnew( LineEdit );
		save_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(save_path);

		Button * save_choose = memnew( Button );
		save_choose->set_text(" .. ");
		hbc->add_child(save_choose);

		save_choose->connect("pressed", this,"_browse_target");

		compress = memnew( CheckButton);
		compress->set_pressed(true);
		compress->set_text("Compress");
		tcomp->add_child(compress);

		add_to_project = memnew( CheckButton);
		add_to_project->set_pressed(true);
		add_to_project->set_text("Add to Project (engine.cfg)");
		tcomp->add_child(add_to_project);

		file_select = memnew(EditorFileDialog);
		file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
		add_child(file_select);
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
		file_select->connect("file_selected", this,"_choose_file");
		file_select->add_filter("*.csv ; Translation CSV");
		save_select = memnew(	EditorDirDialog );
		add_child(save_select);

	//	save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
		save_select->connect("dir_selected", this,"_choose_save_dir");

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text("Import");


		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text("Accept");
	//	error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);

		columns = memnew( Tree );
		vbc->add_margin_child("Import Languages:",columns,true);
	}
Example #3
0
File: xml.cpp Project: 2202877/acl
xml_node& xml_node::add_child(xml_node& child, bool return_child /* = false */)
{
	return add_child(&child, return_child);
}
Example #4
0
FindInFilesDialog::FindInFilesDialog() {

	set_custom_minimum_size(Size2(400, 190));
	set_resizable(true);
	set_title(TTR("Find in files"));

	VBoxContainer *vbc = memnew(VBoxContainer);
	vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
	add_child(vbc);

	GridContainer *gc = memnew(GridContainer);
	gc->set_columns(2);
	vbc->add_child(gc);

	Label *find_label = memnew(Label);
	find_label->set_text(TTR("Find: "));
	gc->add_child(find_label);

	_search_text_line_edit = memnew(LineEdit);
	_search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
	_search_text_line_edit->connect("text_changed", this, "_on_search_text_modified");
	_search_text_line_edit->connect("text_entered", this, "_on_search_text_entered");
	gc->add_child(_search_text_line_edit);

	{
		Control *placeholder = memnew(Control);
		gc->add_child(placeholder);
	}

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		_whole_words_checkbox = memnew(CheckBox);
		_whole_words_checkbox->set_text(TTR("Whole words"));
		_whole_words_checkbox->set_pressed(true);
		hbc->add_child(_whole_words_checkbox);

		_match_case_checkbox = memnew(CheckBox);
		_match_case_checkbox->set_text(TTR("Match case"));
		_match_case_checkbox->set_pressed(true);
		hbc->add_child(_match_case_checkbox);

		gc->add_child(hbc);
	}

	Label *folder_label = memnew(Label);
	folder_label->set_text(TTR("Folder: "));
	gc->add_child(folder_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Label *prefix_label = memnew(Label);
		prefix_label->set_text(ROOT_PREFIX);
		hbc->add_child(prefix_label);

		_folder_line_edit = memnew(LineEdit);
		_folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(_folder_line_edit);

		Button *folder_button = memnew(Button);
		folder_button->set_text("...");
		folder_button->connect("pressed", this, "_on_folder_button_pressed");
		hbc->add_child(folder_button);

		_folder_dialog = memnew(FileDialog);
		_folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
		_folder_dialog->connect("dir_selected", this, "_on_folder_selected");
		add_child(_folder_dialog);

		gc->add_child(hbc);
	}

	Label *filter_label = memnew(Label);
	filter_label->set_text(TTR("Filter: "));
	gc->add_child(filter_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Vector<String> exts;
		exts.push_back("gd");
		exts.push_back("cs");

		for (int i = 0; i < exts.size(); ++i) {
			CheckBox *cb = memnew(CheckBox);
			cb->set_text(exts[i]);
			cb->set_pressed(true);
			hbc->add_child(cb);
			_filters.push_back(cb);
		}

		gc->add_child(hbc);
	}

	{
		Control *placeholder = memnew(Control);
		placeholder->set_custom_minimum_size(Size2(0, EDSCALE * 16));
		vbc->add_child(placeholder);
	}

	{
		HBoxContainer *hbc = memnew(HBoxContainer);
		hbc->set_alignment(HBoxContainer::ALIGN_CENTER);

		_find_button = memnew(Button);
		_find_button->set_text(TTR("Find..."));
		_find_button->connect("pressed", this, "_on_find_button_pressed");
		_find_button->set_disabled(true);
		hbc->add_child(_find_button);

		{
			Control *placeholder = memnew(Control);
			placeholder->set_custom_minimum_size(Size2(EDSCALE * 16, 0));
			hbc->add_child(placeholder);
		}

		_replace_button = memnew(Button);
		_replace_button->set_text(TTR("Replace..."));
		_replace_button->connect("pressed", this, "_on_replace_button_pressed");
		_replace_button->set_disabled(true);
		hbc->add_child(_replace_button);

		{
			Control *placeholder = memnew(Control);
			placeholder->set_custom_minimum_size(Size2(EDSCALE * 16, 0));
			hbc->add_child(placeholder);
		}

		Button *cancel_button = memnew(Button);
		cancel_button->set_text(TTR("Cancel"));
		cancel_button->connect("pressed", this, "hide");
		hbc->add_child(cancel_button);

		vbc->add_child(hbc);
	}
}
EditorAutoloadSettings::EditorAutoloadSettings() {

	autoload_changed = "autoload_changed";

	updating_autoload = false;
	selected_autoload = "";

	HBoxContainer *hbc = memnew(HBoxContainer);
	add_child(hbc);

	VBoxContainer *vbc_path = memnew(VBoxContainer);
	vbc_path->set_h_size_flags(SIZE_EXPAND_FILL);

	autoload_add_path = memnew(EditorLineEditFileChooser);
	autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL);

	autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE);
	autoload_add_path->get_file_dialog()->connect("file_selected", this, "_autoload_file_callback");

	vbc_path->add_margin_child(TTR("Path:"), autoload_add_path);
	hbc->add_child(vbc_path);

	VBoxContainer *vbc_name = memnew(VBoxContainer);
	vbc_name->set_h_size_flags(SIZE_EXPAND_FILL);

	HBoxContainer *hbc_name = memnew(HBoxContainer);

	autoload_add_name = memnew(LineEdit);
	autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL);
	hbc_name->add_child(autoload_add_name);

	Button *add_autoload = memnew(Button);
	add_autoload->set_text(TTR("Add"));
	hbc_name->add_child(add_autoload);
	add_autoload->connect("pressed", this, "_autoload_add");

	vbc_name->add_margin_child(TTR("Node Name:"), hbc_name);
	hbc->add_child(vbc_name);

	tree = memnew(Tree);
	tree->set_hide_root(true);
	tree->set_select_mode(Tree::SELECT_MULTI);
	tree->set_allow_reselect(true);

	tree->set_drag_forwarding(this);

	tree->set_columns(4);
	tree->set_column_titles_visible(true);

	tree->set_column_title(0, TTR("Name"));
	tree->set_column_expand(0, true);
	tree->set_column_min_width(0, 100);

	tree->set_column_title(1, TTR("Path"));
	tree->set_column_expand(1, true);
	tree->set_column_min_width(1, 100);

	tree->set_column_title(2, TTR("Singleton"));
	tree->set_column_expand(2, false);
	tree->set_column_min_width(2, 80);

	tree->set_column_expand(3, false);
	tree->set_column_min_width(3, 80);

	tree->connect("cell_selected", this, "_autoload_selected");
	tree->connect("item_edited", this, "_autoload_edited");
	tree->connect("button_pressed", this, "_autoload_button_pressed");

	add_margin_child(TTR("List:"), tree, true);
}
Example #6
0
json_node& json_node::add_array_bool(bool value, bool return_child /* = false */)
{
	return add_child(json_->create_array_bool(value), return_child);
}
Example #7
0
json_node& json_node::add_child(const char* tag, json_node& node,
	bool return_child /* = false */)
{
	return add_child(tag, &node, return_child);
}
Example #8
0
File: blocks.c Project: gcgft/cmark
static void S_process_line(cmark_parser *parser, const unsigned char *buffer,
                           bufsize_t bytes) {
  cmark_node *last_matched_container;
  bufsize_t matched = 0;
  int lev = 0;
  int i;
  cmark_list *data = NULL;
  bool all_matched = true;
  cmark_node *container;
  bool indented;
  cmark_chunk input;
  bool maybe_lazy;

  if (parser->options & CMARK_OPT_VALIDATE_UTF8) {
    cmark_utf8proc_check(parser->curline, buffer, bytes);
  } else {
    cmark_strbuf_put(parser->curline, buffer, bytes);
  }
  // ensure line ends with a newline:
  if (bytes == 0 || !S_is_line_end_char(parser->curline->ptr[bytes - 1])) {
    cmark_strbuf_putc(parser->curline, '\n');
  }
  parser->offset = 0;
  parser->column = 0;
  parser->blank = false;

  input.data = parser->curline->ptr;
  input.len = parser->curline->size;

  // container starts at the document root.
  container = parser->root;

  parser->line_number++;

  // for each containing node, try to parse the associated line start.
  // bail out on failure:  container will point to the last matching node.

  while (container->last_child && container->last_child->open) {
    container = container->last_child;

    S_find_first_nonspace(parser, &input);

    if (container->type == CMARK_NODE_BLOCK_QUOTE) {
      matched =
          parser->indent <= 3 && peek_at(&input, parser->first_nonspace) == '>';
      if (matched) {
        S_advance_offset(parser, &input, parser->indent + 1, true);
        if (peek_at(&input, parser->offset) == ' ')
          parser->offset++;
      } else {
        all_matched = false;
      }

    } else if (container->type == CMARK_NODE_ITEM) {
      if (parser->indent >=
          container->as.list.marker_offset + container->as.list.padding) {
        S_advance_offset(parser, &input, container->as.list.marker_offset +
                                             container->as.list.padding,
                         true);
      } else if (parser->blank && container->first_child != NULL) {
        // if container->first_child is NULL, then the opening line
        // of the list item was blank after the list marker; in this
        // case, we are done with the list item.
        S_advance_offset(parser, &input,
                         parser->first_nonspace - parser->offset, false);
      } else {
        all_matched = false;
      }

    } else if (container->type == CMARK_NODE_CODE_BLOCK) {

      if (!container->as.code.fenced) { // indented
        if (parser->indent >= CODE_INDENT) {
          S_advance_offset(parser, &input, CODE_INDENT, true);
        } else if (parser->blank) {
          S_advance_offset(parser, &input,
                           parser->first_nonspace - parser->offset, false);
        } else {
          all_matched = false;
        }
      } else { // fenced
        matched = 0;
        if (parser->indent <= 3 && (peek_at(&input, parser->first_nonspace) ==
                                    container->as.code.fence_char)) {
          matched = scan_close_code_fence(&input, parser->first_nonspace);
        }
        if (matched >= container->as.code.fence_length) {
          // closing fence - and since we're at
          // the end of a line, we can return:
          all_matched = false;
          S_advance_offset(parser, &input, matched, false);
          parser->current = finalize(parser, container);
          goto finished;
        } else {
          // skip opt. spaces of fence parser->offset
          i = container->as.code.fence_offset;
          while (i > 0 && peek_at(&input, parser->offset) == ' ') {
            S_advance_offset(parser, &input, 1, false);
            i--;
          }
        }
      }
    } else if (container->type == CMARK_NODE_HEADING) {

      // a heading can never contain more than one line
      all_matched = false;

    } else if (container->type == CMARK_NODE_HTML_BLOCK) {

      switch (container->as.html_block_type) {
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
        // these types of blocks can accept blanks
        break;
      case 6:
      case 7:
        if (parser->blank) {
          all_matched = false;
        }
        break;
      default:
        fprintf(stderr, "Error (%s:%d): Unknown HTML block type %d\n", __FILE__,
                __LINE__, container->as.html_block_type);
        exit(1);
      }

    } else if (container->type == CMARK_NODE_PARAGRAPH) {

      if (parser->blank) {
        all_matched = false;
      }
    }

    if (!all_matched) {
      container = container->parent; // back up to last matching node
      break;
    }
  }

  last_matched_container = container;

  // check to see if we've hit 2nd blank line, break out of list:
  if (parser->blank && container->last_line_blank) {
    break_out_of_lists(parser, &container);
  }

  maybe_lazy = parser->current->type == CMARK_NODE_PARAGRAPH;
  // try new container starts:
  while (container->type != CMARK_NODE_CODE_BLOCK &&
         container->type != CMARK_NODE_HTML_BLOCK) {

    S_find_first_nonspace(parser, &input);
    indented = parser->indent >= CODE_INDENT;

    if (!indented && peek_at(&input, parser->first_nonspace) == '>') {

      S_advance_offset(parser, &input,
                       parser->first_nonspace + 1 - parser->offset, false);
      // optional following character
      if (peek_at(&input, parser->offset) == ' ')
        S_advance_offset(parser, &input, 1, false);
      container = add_child(parser, container, CMARK_NODE_BLOCK_QUOTE,
                            parser->offset + 1);

    } else if (!indented && (matched = scan_atx_heading_start(
                                 &input, parser->first_nonspace))) {

      S_advance_offset(parser, &input,
                       parser->first_nonspace + matched - parser->offset,
                       false);
      container =
          add_child(parser, container, CMARK_NODE_HEADING, parser->offset + 1);

      bufsize_t hashpos =
          cmark_chunk_strchr(&input, '#', parser->first_nonspace);
      int level = 0;

      while (peek_at(&input, hashpos) == '#') {
        level++;
        hashpos++;
      }
      container->as.heading.level = level;
      container->as.heading.setext = false;

    } else if (!indented && (matched = scan_open_code_fence(
                                 &input, parser->first_nonspace))) {

      container = add_child(parser, container, CMARK_NODE_CODE_BLOCK,
                            parser->first_nonspace + 1);
      container->as.code.fenced = true;
      container->as.code.fence_char = peek_at(&input, parser->first_nonspace);
      container->as.code.fence_length = matched;
      container->as.code.fence_offset =
          (int8_t)(parser->first_nonspace - parser->offset);
      container->as.code.info = cmark_chunk_literal("");
      S_advance_offset(parser, &input,
                       parser->first_nonspace + matched - parser->offset,
                       false);

    } else if (!indented && ((matched = scan_html_block_start(
                                  &input, parser->first_nonspace)) ||
                             (container->type != CMARK_NODE_PARAGRAPH &&
                              (matched = scan_html_block_start_7(
                                   &input, parser->first_nonspace))))) {

      container = add_child(parser, container, CMARK_NODE_HTML_BLOCK,
                            parser->first_nonspace + 1);
      container->as.html_block_type = matched;
      // note, we don't adjust parser->offset because the tag is part of the
      // text

    } else if (!indented && container->type == CMARK_NODE_PARAGRAPH &&
               (lev =
                    scan_setext_heading_line(&input, parser->first_nonspace))) {

      container->type = CMARK_NODE_HEADING;
      container->as.heading.level = lev;
      container->as.heading.setext = true;
      S_advance_offset(parser, &input, input.len - 1 - parser->offset, false);

    } else if (!indented &&
               !(container->type == CMARK_NODE_PARAGRAPH && !all_matched) &&
               (matched =
                    scan_thematic_break(&input, parser->first_nonspace))) {

      // it's only now that we know the line is not part of a setext heading:
      container = add_child(parser, container, CMARK_NODE_THEMATIC_BREAK,
                            parser->first_nonspace + 1);
      S_advance_offset(parser, &input, input.len - 1 - parser->offset, false);

    } else if ((matched =
                    parse_list_marker(&input, parser->first_nonspace, &data)) &&
               (!indented || container->type == CMARK_NODE_LIST)) {
      // Note that we can have new list items starting with >= 4
      // spaces indent, as long as the list container is still open.

      // compute padding:
      S_advance_offset(parser, &input,
                       parser->first_nonspace + matched - parser->offset,
                       false);
      i = 0;
      while (i <= 5 && peek_at(&input, parser->offset + i) == ' ') {
        i++;
      }
      // i = number of spaces after marker, up to 5
      if (i >= 5 || i < 1 ||
          S_is_line_end_char(peek_at(&input, parser->offset))) {
        data->padding = matched + 1;
        if (i > 0) {
          S_advance_offset(parser, &input, 1, false);
        }
      } else {
        data->padding = matched + i;
        S_advance_offset(parser, &input, i, true);
      }

      // check container; if it's a list, see if this list item
      // can continue the list; otherwise, create a list container.

      data->marker_offset = parser->indent;

      if (container->type != CMARK_NODE_LIST ||
          !lists_match(&container->as.list, data)) {
        container = add_child(parser, container, CMARK_NODE_LIST,
                              parser->first_nonspace + 1);

        memcpy(&container->as.list, data, sizeof(*data));
      }

      // add the list item
      container = add_child(parser, container, CMARK_NODE_ITEM,
                            parser->first_nonspace + 1);
      /* TODO: static */
      memcpy(&container->as.list, data, sizeof(*data));
      free(data);

    } else if (indented && !maybe_lazy && !parser->blank) {
      S_advance_offset(parser, &input, CODE_INDENT, true);
      container = add_child(parser, container, CMARK_NODE_CODE_BLOCK,
                            parser->offset + 1);
      container->as.code.fenced = false;
      container->as.code.fence_char = 0;
      container->as.code.fence_length = 0;
      container->as.code.fence_offset = 0;
      container->as.code.info = cmark_chunk_literal("");

    } else {
      break;
    }

    if (accepts_lines(container->type)) {
      // if it's a line container, it can't contain other containers
      break;
    }
    maybe_lazy = false;
  }

  // what remains at parser->offset is a text line.  add the text to the
  // appropriate container.

  S_find_first_nonspace(parser, &input);

  if (parser->blank && container->last_child) {
    container->last_child->last_line_blank = true;
  }

  // block quote lines are never blank as they start with >
  // and we don't count blanks in fenced code for purposes of tight/loose
  // lists or breaking out of lists.  we also don't set last_line_blank
  // on an empty list item.
  container->last_line_blank =
      (parser->blank && container->type != CMARK_NODE_BLOCK_QUOTE &&
       container->type != CMARK_NODE_HEADING &&
       container->type != CMARK_NODE_THEMATIC_BREAK &&
       !(container->type == CMARK_NODE_CODE_BLOCK &&
         container->as.code.fenced) &&
       !(container->type == CMARK_NODE_ITEM && container->first_child == NULL &&
         container->start_line == parser->line_number));

  cmark_node *cont = container;
  while (cont->parent) {
    cont->parent->last_line_blank = false;
    cont = cont->parent;
  }

  if (parser->current != last_matched_container &&
      container == last_matched_container && !parser->blank &&
      parser->current->type == CMARK_NODE_PARAGRAPH &&
      cmark_strbuf_len(&parser->current->string_content) > 0) {

    add_line(parser->current, &input, parser->offset);

  } else { // not a lazy continuation

    // finalize any blocks that were not matched and set cur to container:
    while (parser->current != last_matched_container) {
      parser->current = finalize(parser, parser->current);
      assert(parser->current != NULL);
    }

    if (container->type == CMARK_NODE_CODE_BLOCK) {

      add_line(container, &input, parser->offset);

    } else if (container->type == CMARK_NODE_HTML_BLOCK) {

      add_line(container, &input, parser->offset);

      int matches_end_condition;
      switch (container->as.html_block_type) {
      case 1:
        // </script>, </style>, </pre>
        matches_end_condition =
            scan_html_block_end_1(&input, parser->first_nonspace);
        break;
      case 2:
        // -->
        matches_end_condition =
            scan_html_block_end_2(&input, parser->first_nonspace);
        break;
      case 3:
        // ?>
        matches_end_condition =
            scan_html_block_end_3(&input, parser->first_nonspace);
        break;
      case 4:
        // >
        matches_end_condition =
            scan_html_block_end_4(&input, parser->first_nonspace);
        break;
      case 5:
        // ]]>
        matches_end_condition =
            scan_html_block_end_5(&input, parser->first_nonspace);
        break;
      default:
        matches_end_condition = 0;
        break;
      }

      if (matches_end_condition) {
        container = finalize(parser, container);
        assert(parser->current != NULL);
      }

    } else if (parser->blank) {

      // ??? do nothing

    } else if (accepts_lines(container->type)) {

      if (container->type == CMARK_NODE_HEADING &&
          container->as.heading.setext == false) {
        chop_trailing_hashtags(&input);
      }
      add_line(container, &input, parser->first_nonspace);

    } else {
      // create paragraph container for line
      container = add_child(parser, container, CMARK_NODE_PARAGRAPH,
                            parser->first_nonspace + 1);
      add_line(container, &input, parser->first_nonspace);
    }

    parser->current = container;
  }
finished:
  parser->last_line_length = input.len;
  if (parser->last_line_length &&
      input.data[parser->last_line_length - 1] == '\n')
    parser->last_line_length -= 1;
  if (parser->last_line_length &&
      input.data[parser->last_line_length - 1] == '\r')
    parser->last_line_length -= 1;

  cmark_strbuf_clear(parser->curline);
}
AnimationTreeEditor::AnimationTreeEditor() {

	set_focus_mode(FOCUS_ALL);

	PopupMenu *p;
	List<PropertyInfo> defaults;

	add_menu = memnew( MenuButton );
	//add_menu->set_
	add_menu->set_pos( Point2( 0,0) );
	add_menu->set_size( Point2( 25,15) );
	add_child( add_menu );

	p=add_menu->get_popup();
	p->add_item("Animation Node",AnimationTreePlayer::NODE_ANIMATION);
	p->add_item("OneShot Node",AnimationTreePlayer::NODE_ONESHOT);
	p->add_item("Mix Node",AnimationTreePlayer::NODE_MIX);
	p->add_item("Blend2 Node",AnimationTreePlayer::NODE_BLEND2);
	p->add_item("Blend3 Node",AnimationTreePlayer::NODE_BLEND3);
	p->add_item("Blend4 Node",AnimationTreePlayer::NODE_BLEND4);
	p->add_item("TimeScale Node",AnimationTreePlayer::NODE_TIMESCALE);
	p->add_item("TimeSeek Node",AnimationTreePlayer::NODE_TIMESEEK);
	p->add_item("Transition Node",AnimationTreePlayer::NODE_TRANSITION);
	p->add_separator();
	p->add_item("Import Animations...", MENU_IMPORT_ANIMATIONS); // wtf
	p->add_separator();
	p->add_item("Clear",MENU_GRAPH_CLEAR);

	p->connect("item_pressed", this,"_add_menu_item");

	play_button = memnew(Button);
	play_button->set_pos(Point2(25,0));
	play_button->set_size(Point2(25,15));
	add_child(play_button);
	play_button->set_toggle_mode(true);
	play_button->connect("pressed", this,"_play_toggled");





	last_x=50;
	last_y=50;

	property_editor = memnew( CustomPropertyEditor );
	add_child(property_editor);
	property_editor->connect("variant_changed", this,"_edit_dialog_animation_changed");
	 property_editor->connect("resource_edit_request", this, "_edit_dialog_edit_animation");

	h_scroll = memnew( HScrollBar );
	v_scroll = memnew( VScrollBar );

	add_child(h_scroll);
	add_child(v_scroll);

	h_scroll->connect("value_changed", this,"_scroll_moved");
	v_scroll->connect("value_changed", this,"_scroll_moved");

	node_popup= memnew(PopupMenu );
	add_child(node_popup);
	node_popup->set_as_toplevel(true);

	master_anim_popup = memnew( PopupMenu );
	add_child(master_anim_popup);
	master_anim_popup->connect("item_pressed",this,"_master_anim_menu_item");


	node_popup->connect("item_pressed", this,"_node_menu_item");

	updating_edit=false;

	edit_dialog = memnew( PopupPanel );
//	edit_dialog->get_ok()->hide();
//	edit_dialog->get_cancel()->hide();
	add_child(edit_dialog);

	edit_option = memnew( OptionButton );
	edit_option->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	edit_option->set_margin(MARGIN_RIGHT, 10);
	edit_dialog->add_child(edit_option);
	edit_option->connect("item_selected", this,"_edit_dialog_changedf");
	edit_option->hide();


	for(int i=0;i<2;i++) {
		edit_scroll[i] = memnew ( HSlider );
		edit_scroll[i]->set_anchor( MARGIN_RIGHT, ANCHOR_END );
		edit_scroll[i]->set_margin(MARGIN_RIGHT, 10);
		edit_dialog->add_child(edit_scroll[i]);
		edit_scroll[i]->hide();
		edit_scroll[i]->connect("value_changed", this,"_edit_dialog_changedf");
	}
	for(int i=0;i<4;i++) {
		edit_line[i] = memnew ( LineEdit );
		edit_line[i]->set_anchor( MARGIN_RIGHT, ANCHOR_END );
		edit_line[i]->set_margin(MARGIN_RIGHT, 10);
		edit_dialog->add_child(edit_line[i]);
		edit_line[i]->hide();
		edit_line[i]->connect("text_changed", this,"_edit_dialog_changeds");
		edit_line[i]->connect("text_entered", this,"_edit_dialog_changede");
		edit_label[i] = memnew ( Label );
		edit_dialog->add_child(edit_label[i]);
		edit_label[i]->hide();
	}

	edit_button = memnew( Button );
	edit_button->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	edit_button->set_margin(MARGIN_RIGHT, 10);
	edit_dialog->add_child(edit_button);
	edit_button->hide();;
	edit_button->connect("pressed", this,"_edit_oneshot_start");

	edit_check = memnew( CheckButton );
	edit_check->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	edit_check->set_margin(MARGIN_RIGHT, 10);
	edit_dialog->add_child(edit_check);
	edit_check->hide();;
	edit_check->connect("pressed", this,"_edit_dialog_changed");

	file_dialog = memnew( EditorFileDialog );
	file_dialog->set_enable_multiple_selection(true);
	file_dialog->set_current_dir(Globals::get_singleton()->get_resource_path());
	add_child(file_dialog);
	 file_dialog->connect("file_selected", this, "_file_dialog_selected");

	filter_dialog = memnew( AcceptDialog );
	filter_dialog->set_title("Edit Node Filters");
	add_child(filter_dialog);

	filter = memnew( Tree );
	filter_dialog->add_child(filter);
	filter_dialog->set_child_rect(filter);
	filter->connect("item_edited",this,"_filter_edited");

	filter_button = memnew( Button );
	filter_button->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	filter_button->set_margin(MARGIN_RIGHT, 10);
	edit_dialog->add_child(filter_button);
	filter_button->hide();;
	filter_button->set_text("Filters..");
	filter_button->connect("pressed", this,"_edit_filters");

}
Example #10
0
//---------------------------------------------------------------------------------------
ImoObj* Linker::add_child_to_model(ImoObj* pParent, ImoObj* pChild, int ldpChildType)
{
    //If the object (or its content, for DTOs) is added to the model it must return NULL.
    //Othewise, it must return the received object. This behaviour is necessary to
    //simplify unit tests of LdpAnalyser

    m_ldpChildType = ldpChildType;
    m_pParent = pParent;

    switch(pChild->get_obj_type())
    {
        case k_imo_bezier_info:
            return add_bezier(static_cast<ImoBezierInfo*>(pChild));

        case k_imo_content:
            return add_content(static_cast<ImoContent*>(pChild));

        case k_imo_cursor_info:
            return add_cursor(static_cast<ImoCursorInfo*>(pChild));

        case k_imo_font_style_dto:
            return add_font_style(static_cast<ImoFontStyleDto*>(pChild));

        case k_imo_instrument:
            return add_instrument(static_cast<ImoInstrument*>(pChild));

        case k_imo_instr_group:
            return add_instruments_group(static_cast<ImoInstrGroup*>(pChild));

        case k_imo_listitem:
            return add_listitem(static_cast<ImoListItem*>(pChild));

        case k_imo_midi_info:
            return add_midi_info(static_cast<ImoMidiInfo*>(pChild));

        case k_imo_music_data:
            return add_child(k_imo_instrument, pChild);

        case k_imo_option:
            return add_option(static_cast<ImoOptionInfo*>(pChild));

        case k_imo_page_info:
            return add_page_info(static_cast<ImoPageInfo*>(pChild));

        case k_imo_param_info:
            return add_param_info(static_cast<ImoParamInfo*>(pChild));

        case k_imo_score_text:
            return add_text(static_cast<ImoScoreText*>(pChild));

        case k_imo_score_title:
            return add_title(static_cast<ImoScoreTitle*>(pChild));

        case k_imo_staff_info:
            return add_staff_info(static_cast<ImoStaffInfo*>(pChild));

        case k_imo_styles:
            return add_child(k_imo_document, pChild);

        case k_imo_system_info:
            return add_system_info(static_cast<ImoSystemInfo*>(pChild));

        case k_imo_style:
            return add_style(static_cast<ImoStyle*>(pChild));

        case k_imo_table_row:
        {
            if (m_pParent)
            {
                if (m_pParent->is_table_head())
                    return add_child(k_imo_table_head, pChild);
                else if (m_pParent->is_table_body())
                    return add_child(k_imo_table_body, pChild);
                else
                    return pChild;
            }
            else
                return pChild;
        }

        case k_imo_table_head:
        case k_imo_table_body:
        {
            if (m_pParent && m_pParent->is_table())
                return add_child(k_imo_table, pChild);
            else
                return pChild;
        }

        default:
            if (pChild->is_block_level_obj())
                return add_block_level_item(static_cast<ImoBlockLevelObj*>(pChild));
            else if (pChild->is_inline_level_obj())
                return add_inline_level_item(static_cast<ImoInlineLevelObj*>(pChild));
            else if (pChild->is_staffobj())
                return add_staffobj(static_cast<ImoStaffObj*>(pChild));
            else if (pChild->is_relobj())
                return add_relation(static_cast<ImoRelObj*>(pChild));
            else if (pChild->is_auxobj())
                return add_attachment(static_cast<ImoAuxObj*>(pChild));
            else
                return pChild;
    }
}
AnimationNodeBlendTreeEditor::AnimationNodeBlendTreeEditor() {

	singleton = this;
	updating = false;

	graph = memnew(GraphEdit);
	add_child(graph);
	graph->add_valid_right_disconnect_type(0);
	graph->add_valid_left_disconnect_type(0);
	graph->set_v_size_flags(SIZE_EXPAND_FILL);
	graph->connect("connection_request", this, "_connection_request", varray(), CONNECT_DEFERRED);
	graph->connect("disconnection_request", this, "_disconnection_request", varray(), CONNECT_DEFERRED);
	graph->connect("node_selected", this, "_node_selected");
	graph->connect("scroll_offset_changed", this, "_scroll_changed");

	VSeparator *vs = memnew(VSeparator);
	graph->get_zoom_hbox()->add_child(vs);
	graph->get_zoom_hbox()->move_child(vs, 0);

	add_node = memnew(MenuButton);
	graph->get_zoom_hbox()->add_child(add_node);
	add_node->set_text(TTR("Add Node.."));
	graph->get_zoom_hbox()->move_child(add_node, 0);
	add_node->get_popup()->connect("index_pressed", this, "_add_node");

	goto_parent = memnew(Button);
	graph->get_zoom_hbox()->add_child(goto_parent);
	graph->get_zoom_hbox()->move_child(goto_parent, 0);
	goto_parent->hide();
	goto_parent->connect("pressed", this, "_open_parent");

	add_options.push_back(AddOption("Animation", "AnimationNodeAnimation"));
	add_options.push_back(AddOption("OneShot", "AnimationNodeOneShot"));
	add_options.push_back(AddOption("Add2", "AnimationNodeAdd2"));
	add_options.push_back(AddOption("Add3", "AnimationNodeAdd3"));
	add_options.push_back(AddOption("Blend2", "AnimationNodeBlend2"));
	add_options.push_back(AddOption("Blend3", "AnimationNodeBlend3"));
	add_options.push_back(AddOption("Seek", "AnimationNodeTimeSeek"));
	add_options.push_back(AddOption("TimeScale", "AnimationNodeTimeScale"));
	add_options.push_back(AddOption("Transition", "AnimationNodeTransition"));
	add_options.push_back(AddOption("BlendTree", "AnimationNodeBlendTree"));
	add_options.push_back(AddOption("BlendSpace1D", "AnimationNodeBlendSpace1D"));
	add_options.push_back(AddOption("BlendSpace2D", "AnimationNodeBlendSpace2D"));
	add_options.push_back(AddOption("StateMachine", "AnimationNodeStateMachine"));
	_update_options_menu();

	error_panel = memnew(PanelContainer);
	add_child(error_panel);
	error_label = memnew(Label);
	error_panel->add_child(error_label);
	error_label->set_text("eh");

	filter_dialog = memnew(AcceptDialog);
	add_child(filter_dialog);
	filter_dialog->set_title(TTR("Edit Filtered Tracks:"));

	VBoxContainer *filter_vbox = memnew(VBoxContainer);
	filter_dialog->add_child(filter_vbox);

	filter_enabled = memnew(CheckBox);
	filter_enabled->set_text(TTR("Enable filtering"));
	filter_enabled->connect("pressed", this, "_filter_toggled");
	filter_vbox->add_child(filter_enabled);

	filters = memnew(Tree);
	filter_vbox->add_child(filters);
	filters->set_v_size_flags(SIZE_EXPAND_FILL);
	filters->set_hide_root(true);
	filters->connect("item_edited", this, "_filter_edited");

	undo_redo = EditorNode::get_singleton()->get_undo_redo();
}
	EditorSampleImportDialog(EditorSampleImportPlugin *p_plugin) {

		plugin=p_plugin;


		set_title(TTR("Import Audio Samples"));

		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);


		HBoxContainer *hbc = memnew( HBoxContainer );
		vbc->add_margin_child(TTR("Source Sample(s):"),hbc);

		import_path = memnew( LineEdit );
		import_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(import_path);

		Button * import_choose = memnew( Button );
		import_choose->set_text(" .. ");
		hbc->add_child(import_choose);

		import_choose->connect("pressed", this,"_browse");

		hbc = memnew( HBoxContainer );
		vbc->add_margin_child(TTR("Target Path:"),hbc);

		save_path = memnew( LineEdit );
		save_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(save_path);

		Button * save_choose = memnew( Button );
		save_choose->set_text(" .. ");
		hbc->add_child(save_choose);

		save_choose->connect("pressed", this,"_browse_target");

		file_select = memnew(EditorFileDialog);
		file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
		add_child(file_select);
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES);
		file_select->connect("files_selected", this,"_choose_files");
		file_select->add_filter("*.wav ; MS Waveform");
		save_select = memnew(	EditorDirDialog );
		add_child(save_select);

	//	save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
		save_select->connect("dir_selected", this,"_choose_save_dir");

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text(TTR("Import"));


		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text(TTR("Accept"));
	//	error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);
		options = memnew( _EditorSampleImportOptions );

		option_editor = memnew( PropertyEditor );
		option_editor->hide_top_label();
		vbc->add_margin_child(TTR("Options:"),option_editor,true);
	}
Example #13
0
WindowVariables::WindowVariables(Level& l)
:
    Window       (LEMSCR_X/2 - this_xl/2,
                  LEMSCR_Y/2 - this_yl/2 - 30,
                   this_xl, this_yl, Language::win_var_title),
    author       (160,  40, 300,   l.author),
    name_german  (160,  70, 300,   l.name_german),
    name_english (160, 100, 300,   l.name_english),

    initial      (160, 130, 180, 3, 1, 999,   l.initial,  true),
    required     (160, 160, 180, 3, 1, 999,   l.required, true),
    spawnint_slow(180, 190, 140, 2, Level::spawnint_min,
                                    Level::spawnint_max,  l.spawnint_slow),
    spawnint_fast(180, 220, 140, 2, Level::spawnint_min,
                                    Level::spawnint_max,  l.spawnint_fast),
    seconds      (160, 250, 180, 5, 0, 30*60, l.seconds,  true),

    ok           (360, this_yl - 70, 100, 20),
    cancel       (360, this_yl - 40, 100, 20),

    desc_author  (20, author.get_y(), Language::win_var_author),
    desc_german  (20, name_german.get_y(), Language::win_var_name_german),
    desc_english (20, name_english.get_y(), Language::win_var_name_english),
    desc_initial (20, initial.get_y(), Language::win_var_initial),
    desc_required(20, required.get_y(), Language::win_var_required),
    desc_spawnint_slow(20, spawnint_slow.get_y(),
                            Language::win_var_spawnint_slow),
    desc_spawnint_fast(20, spawnint_fast.get_y(),
                            Language::win_var_spawnint_fast),
    desc_clock   (20, seconds.get_y(), Language::win_var_clock)
{
    level = &l;

    ok     .set_hotkey(useR->key_me_okay);
    cancel .set_hotkey(useR->key_me_exit);
    ok     .set_text  (Language::ok);
    cancel .set_text  (Language::cancel);

    seconds.set_format_time();
    seconds.set_step_big(60);
    seconds.set_step_med(10);
    seconds.set_step_sml( 1);

    add_child(author);
    add_child(name_german);
    add_child(name_english);
    add_child(initial);
    add_child(required);
    add_child(spawnint_slow);
    add_child(spawnint_fast);
    add_child(seconds);
    add_child(ok);
    add_child(cancel);

    add_child(desc_author);
    add_child(desc_german);
    add_child(desc_english);
    add_child(desc_initial);
    add_child(desc_required);
    add_child(desc_spawnint_slow);
    add_child(desc_spawnint_fast);
    add_child(desc_clock);
}
Example #14
0
ProjectExportDialog::ProjectExportDialog() {

	set_title(TTR("Export"));
	set_resizable(true);

	VBoxContainer *main_vb = memnew(VBoxContainer);
	add_child(main_vb);
	HBoxContainer *hbox = memnew(HBoxContainer);
	main_vb->add_child(hbox);
	hbox->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *preset_vb = memnew(VBoxContainer);
	preset_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbox->add_child(preset_vb);

	HBoxContainer *preset_hb = memnew(HBoxContainer);
	preset_hb->add_child(memnew(Label(TTR("Presets"))));
	preset_hb->add_spacer();
	preset_vb->add_child(preset_hb);

	add_preset = memnew(MenuButton);
	add_preset->set_text(TTR("Add..."));
	add_preset->get_popup()->connect("index_pressed", this, "_add_preset");
	preset_hb->add_child(add_preset);
	MarginContainer *mc = memnew(MarginContainer);
	preset_vb->add_child(mc);
	mc->set_v_size_flags(SIZE_EXPAND_FILL);
	presets = memnew(ItemList);
	presets->set_drag_forwarding(this);
	mc->add_child(presets);
	presets->connect("item_selected", this, "_edit_preset");
	duplicate_preset = memnew(ToolButton);
	preset_hb->add_child(duplicate_preset);
	duplicate_preset->connect("pressed", this, "_duplicate_preset");
	delete_preset = memnew(ToolButton);
	preset_hb->add_child(delete_preset);
	delete_preset->connect("pressed", this, "_delete_preset");

	VBoxContainer *settings_vb = memnew(VBoxContainer);
	settings_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbox->add_child(settings_vb);

	name = memnew(LineEdit);
	settings_vb->add_margin_child(TTR("Name:"), name);
	name->connect("text_changed", this, "_name_changed");
	runnable = memnew(CheckButton);
	runnable->set_text(TTR("Runnable"));
	runnable->connect("pressed", this, "_runnable_pressed");
	settings_vb->add_child(runnable);

	sections = memnew(TabContainer);
	sections->set_tab_align(TabContainer::ALIGN_LEFT);
	settings_vb->add_child(sections);
	sections->set_v_size_flags(SIZE_EXPAND_FILL);

	parameters = memnew(EditorInspector);
	sections->add_child(parameters);
	parameters->set_name(TTR("Options"));
	parameters->set_v_size_flags(SIZE_EXPAND_FILL);
	parameters->connect("property_edited", this, "_update_parameters");

	VBoxContainer *resources_vb = memnew(VBoxContainer);
	sections->add_child(resources_vb);
	resources_vb->set_name(TTR("Resources"));

	export_filter = memnew(OptionButton);
	export_filter->add_item(TTR("Export all resources in the project"));
	export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
	export_filter->add_item(TTR("Export selected resources (and dependencies)"));
	resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
	export_filter->connect("item_selected", this, "_export_type_changed");

	include_label = memnew(Label);
	include_label->set_text(TTR("Resources to export:"));
	resources_vb->add_child(include_label);
	include_margin = memnew(MarginContainer);
	include_margin->set_v_size_flags(SIZE_EXPAND_FILL);
	resources_vb->add_child(include_margin);

	include_files = memnew(Tree);
	include_margin->add_child(include_files);
	include_files->connect("item_edited", this, "_tree_changed");

	include_filters = memnew(LineEdit);
	resources_vb->add_margin_child(TTR("Filters to export non-resource files (comma separated, e.g: *.json, *.txt)"), include_filters);
	include_filters->connect("text_changed", this, "_filter_changed");

	exclude_filters = memnew(LineEdit);
	resources_vb->add_margin_child(TTR("Filters to exclude files from project (comma separated, e.g: *.json, *.txt)"), exclude_filters);
	exclude_filters->connect("text_changed", this, "_filter_changed");

	VBoxContainer *patch_vb = memnew(VBoxContainer);
	sections->add_child(patch_vb);
	patch_vb->set_name(TTR("Patches"));

	patches = memnew(Tree);
	patch_vb->add_child(patches);
	patches->set_v_size_flags(SIZE_EXPAND_FILL);
	patches->set_hide_root(true);
	patches->connect("button_pressed", this, "_patch_button_pressed");
	patches->connect("item_edited", this, "_patch_edited");
	patches->set_drag_forwarding(this);
	patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);

	HBoxContainer *patches_hb = memnew(HBoxContainer);
	patch_vb->add_child(patches_hb);
	patches_hb->add_spacer();
	patch_export = memnew(Button);
	patch_export->set_text(TTR("Make Patch"));
	patches_hb->add_child(patch_export);
	patches_hb->add_spacer();

	patch_dialog = memnew(FileDialog);
	patch_dialog->add_filter("*.pck ; Pack File");
	patch_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
	patch_dialog->connect("file_selected", this, "_patch_selected");
	add_child(patch_dialog);

	patch_erase = memnew(ConfirmationDialog);
	patch_erase->get_ok()->set_text(TTR("Delete"));
	patch_erase->connect("confirmed", this, "_patch_deleted");
	add_child(patch_erase);

	VBoxContainer *feature_vb = memnew(VBoxContainer);
	feature_vb->set_name(TTR("Features"));
	custom_features = memnew(LineEdit);
	custom_features->connect("text_changed", this, "_custom_features_changed");
	feature_vb->add_margin_child(TTR("Custom (comma-separated):"), custom_features);
	Panel *features_panel = memnew(Panel);
	custom_feature_display = memnew(RichTextLabel);
	features_panel->add_child(custom_feature_display);
	custom_feature_display->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 10 * EDSCALE);
	custom_feature_display->set_v_size_flags(SIZE_EXPAND_FILL);
	feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true);
	sections->add_child(feature_vb);

	sections->connect("tab_changed", this, "_tab_changed");

	//disable by default
	name->set_editable(false);
	runnable->set_disabled(true);
	duplicate_preset->set_disabled(true);
	delete_preset->set_disabled(true);
	sections->hide();
	parameters->edit(NULL);

	delete_confirm = memnew(ConfirmationDialog);
	add_child(delete_confirm);
	delete_confirm->get_ok()->set_text(TTR("Delete"));
	delete_confirm->connect("confirmed", this, "_delete_preset_confirm");

	updating = false;

	get_cancel()->set_text(TTR("Close"));
	get_ok()->set_text(TTR("Export PCK/Zip"));
	export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
	export_button->connect("pressed", this, "_export_project");
	// Disable initially before we select a valid preset
	export_button->set_disabled(true);

	export_pck_zip = memnew(FileDialog);
	export_pck_zip->add_filter("*.zip ; ZIP File");
	export_pck_zip->add_filter("*.pck ; Godot Game Pack");
	export_pck_zip->set_access(FileDialog::ACCESS_FILESYSTEM);
	export_pck_zip->set_mode(FileDialog::MODE_SAVE_FILE);
	add_child(export_pck_zip);
	export_pck_zip->connect("file_selected", this, "_export_pck_zip_selected");

	export_error = memnew(Label);
	main_vb->add_child(export_error);
	export_error->hide();
	export_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));

	export_templates_error = memnew(HBoxContainer);
	main_vb->add_child(export_templates_error);
	export_templates_error->hide();

	Label *export_error2 = memnew(Label);
	export_templates_error->add_child(export_error2);
	export_error2->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
	export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " ");

	error_dialog = memnew(AcceptDialog);
	error_dialog->set_title("Error");
	error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted:") + " ");
	main_vb->add_child(error_dialog);
	error_dialog->hide();

	LinkButton *download_templates = memnew(LinkButton);
	download_templates->set_text(TTR("Manage Export Templates"));
	download_templates->set_v_size_flags(SIZE_SHRINK_CENTER);
	export_templates_error->add_child(download_templates);
	download_templates->connect("pressed", this, "_open_export_template_manager");

	export_project = memnew(FileDialog);
	export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
	add_child(export_project);
	export_project->connect("file_selected", this, "_export_project_to_path");
	export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path");

	export_debug = memnew(CheckButton);
	export_debug->set_text(TTR("Export With Debug"));
	export_debug->set_pressed(true);
	export_project->get_vbox()->add_child(export_debug);

	export_pck_zip_debug = memnew(CheckButton);
	export_pck_zip_debug->set_text(TTR("Export With Debug"));
	export_pck_zip_debug->set_pressed(true);
	export_pck_zip->get_vbox()->add_child(export_pck_zip_debug);

	set_hide_on_ok(false);

	editor_icons = "EditorIcons";

	default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", "");
	// If no default set, use project name
	if (default_filename == "") {
		// If no project name defined, use a sane default
		default_filename = ProjectSettings::get_singleton()->get("application/config/name");
		if (default_filename == "") {
			default_filename = "UnnamedProject";
		}
	}
}
Example #15
0
json_node& json_node::add_array_text(const char* text, bool return_child /* = false */)
{
	return add_child(json_->create_array_text(text), return_child);
}
Example #16
0
EditorSettingsDialog::EditorSettingsDialog() {

	set_title(TTR("Editor Settings"));

	tabs = memnew( TabContainer );
	add_child(tabs);
	set_child_rect(tabs);

	VBoxContainer *vbc = memnew( VBoxContainer );
	tabs->add_child(vbc);
	vbc->set_name(TTR("General"));

	HBoxContainer *hbc = memnew( HBoxContainer );
	hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(hbc);

	Label *l = memnew( Label );
	l->set_text(TTR("Search:")+" ");
	hbc->add_child(l);

	search_box = memnew( LineEdit );
	search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbc->add_child(search_box);

	clear_button = memnew( ToolButton );
	hbc->add_child(clear_button);
	clear_button->connect("pressed",this,"_clear_search_box");

	property_editor = memnew( SectionedPropertyEditor );
	//property_editor->hide_top_label();
	property_editor->get_property_editor()->set_use_filter(true);
	property_editor->get_property_editor()->register_text_enter(search_box);
	property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(property_editor);
	property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");

	vbc = memnew( VBoxContainer );
	tabs->add_child(vbc);
	vbc->set_name(TTR("Shortcuts"));

	hbc = memnew( HBoxContainer );
	hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(hbc);

	l = memnew( Label );
	l->set_text(TTR("Search:")+" ");
	hbc->add_child(l);

	shortcut_search_box = memnew( LineEdit );
	shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbc->add_child(shortcut_search_box);
	shortcut_search_box->connect("text_changed", this, "_filter_shortcuts");

	shortcut_clear_button = memnew( ToolButton );
	hbc->add_child(shortcut_clear_button);
	shortcut_clear_button->connect("pressed",this,"_clear_shortcut_search_box");

	shortcuts = memnew( Tree );
	vbc->add_margin_child("Shortcut List:",shortcuts,true);
	shortcuts->set_columns(2);
	shortcuts->set_hide_root(true);
	//shortcuts->set_hide_folding(true);
	shortcuts->set_column_titles_visible(true);
	shortcuts->set_column_title(0,"Name");
	shortcuts->set_column_title(1,"Binding");
	shortcuts->connect("button_pressed",this,"_shortcut_button_pressed");

	press_a_key = memnew( ConfirmationDialog );
	press_a_key->set_focus_mode(FOCUS_ALL);
	add_child(press_a_key);

	l = memnew( Label );
	l->set_text(TTR("Press a Key.."));
	l->set_area_as_parent_rect();
	l->set_align(Label::ALIGN_CENTER);
	l->set_margin(MARGIN_TOP,20);
	l->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,30);
	press_a_key_label=l;
	press_a_key->add_child(l);
	press_a_key->connect("input_event",this,"_wait_for_key");
	press_a_key->connect("confirmed",this,"_press_a_key_confirm");
	//Button *load = memnew( Button );

	//load->set_text("Load..");
	//hbc->add_child(load);


	//get_ok()->set_text("Apply");
	set_hide_on_ok(true);
	//get_cancel()->set_text("Close");

	timer = memnew( Timer );
	timer->set_wait_time(1.5);
	timer->connect("timeout",this,"_settings_save");
	timer->set_one_shot(true);
	add_child(timer);
	EditorSettings::get_singleton()->connect("settings_changed",this,"_settings_changed");
	get_ok()->set_text(TTR("Close"));

	updating=false;

}
Example #17
0
json_node& json_node::add_array_number(acl_int64 value, bool return_child /* = false */)
{
	return add_child(json_->create_array_number(value), return_child);
}
Example #18
0
int test_is_monophyletic()
{
	const char *test_name = __func__;

	struct rnode *node_a = create_rnode("a", NULL);
	struct rnode *node_b = create_rnode("b", NULL);
	struct rnode *node_c = create_rnode("c", NULL);
	struct rnode *node_d = create_rnode("", NULL);
	struct rnode *node_e = create_rnode("", NULL);
	struct rnode *node_f = create_rnode("", NULL);
	struct llist *descendants = create_llist();
	enum monophyly result;

	/* (a,(b,c)); */
	add_child(node_d, node_b);
	add_child(node_d, node_c);
	add_child(node_e, node_a);
	add_child(node_e, node_d);

	append_element(descendants, node_c);

	// TODO: test w/ empty list

	result = is_monophyletic(descendants, node_c);
	if (MONOPH_TRUE != result) {
		printf ("%s: c should be monophyletic in (c)\n", test_name);
		return 1;
	}

	result = is_monophyletic(descendants, node_d);
	if (MONOPH_FALSE != result) {
		printf ("%s: c should NOT be monophyletic in (c,b)\n",
				test_name);
		return 1;
	}

	append_element(descendants, node_b);
	result = is_monophyletic(descendants, node_d);
	if (MONOPH_TRUE != result) {
		printf ("%s: c,b should be monophyletic in (c,b)\n",
				test_name);
		return 1;
	}

	append_element(descendants, node_a);
	result = is_monophyletic(descendants, node_d);
	if (MONOPH_FALSE != result) {
		printf ("%s: a,c,b should NOT be monophyletic in (c,b)\n",
				test_name);
		return 1;
	}

	result = is_monophyletic(descendants, node_e);
	if (MONOPH_TRUE != result) {
		printf ("%s: a,c,b should be monophyletic in (a,(c,b))\n",
				test_name);
		return 1;
	}

	append_element(descendants, node_f);
	result = is_monophyletic(descendants, node_e);
	if (MONOPH_FALSE != result) {
		printf ("%s: a,c,b,f should NOT be monophyletic in (c,b)\n",
				test_name);
		return 1;
	}
	
	printf("%s ok.\n", test_name);
	return 0;
}
Example #19
0
json_node& json_node::add_child(const char* tag, json_node* node,
	bool return_child /* = false */)
{
	return add_child(json_->create_node(tag, node), return_child);
}
Example #20
0
json_node& json_node::add_child(json_node& child,
	bool return_child /* = false */)
{
	return add_child(&child, return_child);
}
Example #21
0
FindReplaceDialog::FindReplaceDialog() {

	set_self_opacity(0.6);

	VBoxContainer *vb = memnew( VBoxContainer );
	add_child(vb);
	set_child_rect(vb);


	search_text = memnew( LineEdit );
	vb->add_margin_child("Search",search_text);
	search_text->connect("text_entered", this,"_search_text_entered");
	search_text->set_self_opacity(0.7);



	replace_label = memnew( Label);
	replace_label->set_text("Replace By");
	vb->add_child(replace_label);
	replace_mc= memnew( MarginContainer);
	vb->add_child(replace_mc);

	replace_text = memnew( LineEdit );
	replace_text->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	replace_text->set_begin( Point2(15,132) );
	replace_text->set_end( Point2(15,135) );
	replace_text->set_self_opacity(0.7);
	replace_mc->add_child(replace_text);


	replace_text->connect("text_entered", this,"_replace_text_entered");



	MarginContainer *opt_mg = memnew( MarginContainer );
	vb->add_child(opt_mg);
	VBoxContainer *svb = memnew( VBoxContainer);
	opt_mg->add_child(svb);

	svb ->add_child(memnew(Label));

	whole_words = memnew( CheckButton );
	whole_words->set_text("Whole Words");
	svb->add_child(whole_words);

	case_sensitive = memnew( CheckButton );
	case_sensitive->set_text("Case Sensitive");
	svb->add_child(case_sensitive);

	backwards = memnew( CheckButton );
	backwards->set_text("Backwards");
	svb->add_child(backwards);

	opt_mg = memnew( MarginContainer );
	vb->add_child(opt_mg);
	VBoxContainer *rvb = memnew( VBoxContainer);
	opt_mg->add_child(rvb);
	replace_vb=rvb;
//	rvb ->add_child(memnew(HSeparator));
	rvb ->add_child(memnew(Label));

	prompt = memnew( CheckButton );
	prompt->set_text("Prompt On Replace");
	rvb->add_child(prompt);
	prompt->connect("pressed", this,"_prompt_changed");

	selection_only = memnew( CheckButton );
	selection_only->set_text("Selection Only");
	rvb->add_child(selection_only);


	int margin = get_constant("margin","Dialogs");
	int button_margin = get_constant("button_margin","Dialogs");

	skip = memnew( Button );
	skip->set_anchor( MARGIN_LEFT, ANCHOR_END );
	skip->set_anchor( MARGIN_TOP, ANCHOR_END );
	skip->set_anchor( MARGIN_RIGHT, ANCHOR_END );
	skip->set_anchor( MARGIN_BOTTOM, ANCHOR_END );
	skip->set_begin( Point2( 70, button_margin ) );
	skip->set_end( Point2(  10, margin ) );
	skip->set_text("Skip");
	add_child(skip);
	skip->connect("pressed", this,"_skip_pressed");


	error_label = memnew( Label );
	error_label->set_align(Label::ALIGN_CENTER);
	error_label->add_color_override("font_color",Color(1,0.4,0.3));
	error_label->add_color_override("font_color_shadow",Color(0,0,0,0.2));
	error_label->add_constant_override("shadow_as_outline",1);

	vb->add_child(error_label);

	set_hide_on_ok(false);

}
Example #22
0
json_node& json_node::add_array(bool return_child /* = false */)
{
	return add_child(json_->create_array(), return_child);
}
Example #23
0
FindInFilesPanel::FindInFilesPanel() {

	_finder = memnew(FindInFiles);
	_finder->connect(FindInFiles::SIGNAL_RESULT_FOUND, this, "_on_result_found");
	_finder->connect(FindInFiles::SIGNAL_FINISHED, this, "_on_finished");
	add_child(_finder);

	VBoxContainer *vbc = memnew(VBoxContainer);
	vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
	vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
	vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
	vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
	add_child(vbc);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Label *find_label = memnew(Label);
		find_label->set_text(TTR("Find: "));
		hbc->add_child(find_label);

		_search_text_label = memnew(Label);
		_search_text_label->add_font_override("font", get_font("source", "EditorFonts"));
		hbc->add_child(_search_text_label);

		_progress_bar = memnew(ProgressBar);
		_progress_bar->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(_progress_bar);
		set_progress_visible(false);

		_status_label = memnew(Label);
		hbc->add_child(_status_label);

		_cancel_button = memnew(Button);
		_cancel_button->set_text(TTR("Cancel"));
		_cancel_button->connect("pressed", this, "_on_cancel_button_clicked");
		_cancel_button->set_disabled(true);
		hbc->add_child(_cancel_button);

		vbc->add_child(hbc);
	}

	// In the future, this should be replaced by a more specific list container,
	// which can highlight text regions and change opacity for enabled/disabled states
	_results_display = memnew(ItemList);
	_results_display->add_font_override("font", get_font("source", "EditorFonts"));
	_results_display->set_v_size_flags(SIZE_EXPAND_FILL);
	_results_display->connect("item_selected", this, "_on_result_selected");
	vbc->add_child(_results_display);

	{
		_replace_container = memnew(HBoxContainer);

		Label *replace_label = memnew(Label);
		replace_label->set_text(TTR("Replace: "));
		_replace_container->add_child(replace_label);

		_replace_line_edit = memnew(LineEdit);
		_replace_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
		_replace_line_edit->connect("text_changed", this, "_on_replace_text_changed");
		_replace_container->add_child(_replace_line_edit);

		_replace_all_button = memnew(Button);
		_replace_all_button->set_text(TTR("Replace all (no undo)"));
		_replace_all_button->connect("pressed", this, "_on_replace_all_clicked");
		_replace_container->add_child(_replace_all_button);

		_replace_container->hide();

		vbc->add_child(_replace_container);
	}
}
Example #24
0
json_node& json_node::add_child(bool as_array /* = false */,
	bool return_child /* = false */)
{
	return add_child(json_->create_node(as_array), return_child);
}
Example #25
0
EditorLog::EditorLog() {

	VBoxContainer *vb = memnew( VBoxContainer);
	add_child(vb);
	vb->set_v_size_flags(SIZE_EXPAND_FILL);

	HBoxContainer *hb = memnew( HBoxContainer );
	vb->add_child(hb);
	title = memnew( Label );
	title->set_text(" Output:");
	title->set_h_size_flags(SIZE_EXPAND_FILL);
	hb->add_child(title);


	button = memnew( ToolButton );
	button->set_text_align(Button::ALIGN_LEFT);
	button->connect("pressed",this,"_flip_request");
	button->set_focus_mode(FOCUS_NONE);
	button->set_clip_text(true);
	button->set_tooltip("Open/Close output panel.");

	//pd = memnew( PaneDrag );
	//hb->add_child(pd);
	//pd->connect("dragged",this,"_dragged");
	//pd->set_default_cursor_shape(Control::CURSOR_MOVE);

	tb = memnew( TextureButton );
	hb->add_child(tb);
	tb->connect("pressed",this,"_close_request");


	ec = memnew( Control);
	vb->add_child(ec);
	ec->set_custom_minimum_size(Size2(0,100));
	ec->set_v_size_flags(SIZE_EXPAND_FILL);


	PanelContainer *pc = memnew( PanelContainer );
	pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
	ec->add_child(pc);
	pc->set_area_as_parent_rect();

	log = memnew( RichTextLabel );
	log->set_scroll_follow(true);
	log->set_selection_enabled(true);
	log->set_focus_mode(FOCUS_CLICK);
	pc->add_child(log);
	add_message(VERSION_FULL_NAME" (c) 2008-2015 Juan Linietsky, Ariel Manzur.");
	//log->add_text("Initialization Complete.\n"); //because it looks cool.
	add_style_override("panel",get_stylebox("panelf","Panel"));

	eh.errfunc=_error_handler;
	eh.userdata=this;
	add_error_handler(&eh);

	current=Thread::get_caller_ID();

	EditorNode::get_undo_redo()->set_commit_notify_callback(_undo_redo_cbk,this);

	hide();

}
Example #26
0
json_node& json_node::add_number(const char* tag, acl_int64 value,
	bool return_child /* = false */)
{
	return add_child(json_->create_node(tag, value), return_child);
}
Path2DEditor::Path2DEditor(EditorNode *p_editor) {

	canvas_item_editor=NULL;
	editor=p_editor;
	undo_redo = editor->get_undo_redo();

	mode=MODE_EDIT;

	action=ACTION_NONE;
#if 0
	options = memnew( MenuButton );
	add_child(options);
	options->set_area_as_parent_rect();
	options->set_text("Polygon");
	//options->get_popup()->add_item("Parse BBCODE",PARSE_BBCODE);
	options->get_popup()->connect("item_pressed", this,"_menu_option");
#endif

	base_hb = memnew( HBoxContainer );
	CanvasItemEditor::get_singleton()->add_control_to_menu_panel(base_hb);

	sep = memnew( VSeparator);
	base_hb->add_child(sep);
	curve_edit = memnew( ToolButton );
	curve_edit->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveEdit","EditorIcons"));
	curve_edit->set_toggle_mode(true);
	curve_edit->set_focus_mode(Control::FOCUS_NONE);
	curve_edit->set_tooltip("Select Points\nShift+Drag: Select Control Points\n"+keycode_get_string(KEY_MASK_CMD)+"Click: Add Point\nRight Click: Delete Point.");
	curve_edit->connect("pressed",this,"_mode_selected",varray(MODE_EDIT));
	base_hb->add_child(curve_edit);
	curve_edit_curve = memnew( ToolButton );
	curve_edit_curve->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveCurve","EditorIcons"));
	curve_edit_curve->set_toggle_mode(true);
	curve_edit_curve->set_focus_mode(Control::FOCUS_NONE);
	curve_edit_curve->set_tooltip("Select Control Points (Shift+Drag)");
	curve_edit_curve->connect("pressed",this,"_mode_selected",varray(MODE_EDIT_CURVE));
	base_hb->add_child(curve_edit_curve);
	curve_create = memnew( ToolButton );
	curve_create->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveCreate","EditorIcons"));
	curve_create->set_toggle_mode(true);
	curve_create->set_focus_mode(Control::FOCUS_NONE);
	curve_create->set_tooltip("Add Point (in empty space)\nSplit Segment (in curve).");
	curve_create->connect("pressed",this,"_mode_selected",varray(MODE_CREATE));
	base_hb->add_child(curve_create);
	curve_del = memnew( ToolButton );
	curve_del->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveDelete","EditorIcons"));
	curve_del->set_toggle_mode(true);
	curve_del->set_focus_mode(Control::FOCUS_NONE);
	curve_del->set_tooltip("Delete Point.");
	curve_del->connect("pressed",this,"_mode_selected",varray(MODE_DELETE));
	base_hb->add_child(curve_del);
	curve_close = memnew( ToolButton );
	curve_close->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveClose","EditorIcons"));
	curve_close->set_focus_mode(Control::FOCUS_NONE);
	curve_close->set_tooltip("Close Curve");
	curve_close->connect("pressed",this,"_mode_selected",varray(ACTION_CLOSE));
	base_hb->add_child(curve_close);
	base_hb->hide();



	curve_edit->set_pressed(true);


}
Example #28
0
json_node& json_node::add_bool(const char* tag, bool value,
	bool return_child /* = false */)
{
	return add_child(json_->create_node(tag, value), return_child);
}
Example #29
0
File: xml.cpp Project: 2202877/acl
xml_node& xml_node::add_child(const char* tag, bool return_child /* = false */,
	const char* str /* = NULL */)
{
	return add_child(xml_->create_node(tag, str), return_child);
}
	EditorFontImportDialog(EditorFontImportPlugin *p_plugin) {
		plugin=p_plugin;
		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);
		HBoxContainer *hbc = memnew( HBoxContainer);
		vbc->add_child(hbc);
		VBoxContainer *vbl = memnew( VBoxContainer );
		hbc->add_child(vbl);
		hbc->set_v_size_flags(SIZE_EXPAND_FILL);
		vbl->set_h_size_flags(SIZE_EXPAND_FILL);
		VBoxContainer *vbr = memnew( VBoxContainer );
		hbc->add_child(vbr);
		vbr->set_h_size_flags(SIZE_EXPAND_FILL);

		source = memnew( LineEditFileChooser );
		source->get_file_dialog()->set_access(FileDialog::ACCESS_FILESYSTEM);
		source->get_file_dialog()->set_mode(FileDialog::MODE_OPEN_FILE);
		source->get_file_dialog()->add_filter("*.ttf;TrueType");
		source->get_file_dialog()->add_filter("*.otf;OpenType");
		source->get_line_edit()->connect("text_entered",this,"_src_changed");

		vbl->add_margin_child("Source Font:",source);
		font_size = memnew( SpinBox );
		vbl->add_margin_child("Source Font Size:",font_size);
		font_size->set_min(3);
		font_size->set_max(256);
		font_size->set_val(16);
		font_size->connect("value_changed",this,"_font_size_changed");
		dest = memnew( LineEditFileChooser );
		//
		List<String> fl;
		Ref<Font> font= memnew(Font);
		dest->get_file_dialog()->add_filter("*.fnt ; Font" );
		//ResourceSaver::get_recognized_extensions(font,&fl);
		//for(List<String>::Element *E=fl.front();E;E=E->next()) {
		//	dest->get_file_dialog()->add_filter("*."+E->get());
		//}

		vbl->add_margin_child("Dest Resource:",dest);
		HBoxContainer *testhb = memnew( HBoxContainer );
		test_string = memnew( LineEdit );
		test_string->set_text("The quick brown fox jumps over the lazy dog.");
		test_string->set_h_size_flags(SIZE_EXPAND_FILL);
		test_string->set_stretch_ratio(5);

		testhb->add_child(test_string);
		test_color = memnew( ColorPickerButton );
		test_color->set_color(get_color("font_color","Label"));
		test_color->set_h_size_flags(SIZE_EXPAND_FILL);
		test_color->set_stretch_ratio(1);
		test_color->connect("color_changed",this,"_update_text3");
		testhb->add_child(test_color);

		vbl->add_spacer();
		vbl->add_margin_child("Test: ",testhb);
		HBoxContainer *upd_hb = memnew( HBoxContainer );
//		vbl->add_child(upd_hb);
		upd_hb->add_spacer();
		Button *update = memnew( Button);
		upd_hb->add_child(update);
		update->set_text("Update");
		update->connect("pressed",this,"_update");

		options = memnew( _EditorFontImportOptions );
		prop_edit = memnew( PropertyEditor() );
		vbr->add_margin_child("Options:",prop_edit,true);
		options->connect("changed",this,"_prop_changed");

		prop_edit->hide_top_label();

		Panel *panel = memnew( Panel );
		vbc->add_child(panel);
		test_label = memnew( Label );
		test_label->set_autowrap(true);
		panel->add_child(test_label);
		test_label->set_area_as_parent_rect();
		panel->set_v_size_flags(SIZE_EXPAND_FILL);
		test_string->connect("text_changed",this,"_update_text2");
		set_title("Font Import");
		timer = memnew( Timer );
		add_child(timer);
		timer->connect("timeout",this,"_update");
		timer->set_wait_time(0.4);
		timer->set_one_shot(true);

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text("Import");

		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text("Accept");
		set_hide_on_ok(false);


	}