コード例 #1
0
ファイル: filterbar.cpp プロジェクト: kjradv/Isotoxin
/*virtual*/ void gui_filterbar_c::created()
{
    set_theme_rect(CONSTASTR("filter"), false);

    filtereditheight = gui->theme().conf().get_int(CONSTASTR("filtereditheight"), 25);

    if (prf().get_options().is(UIOPT_SHOW_SEARCH_BAR))
    {
        gui_textfield_c &e = (MAKE_CHILD<gui_textfield_c>(getrid(), L"", MAX_PATH, 0, false) << (gui_textedit_c::TEXTCHECKFUNC)DELEGATE(this, update_filter));
        edit = &e;
        e.set_placeholder(TOOLTIP(TTT("Search", 277)), get_default_text_color(COL_PLACEHOLDER));
        e.register_kbd_callback(DELEGATE(this, cancel_filter), SSK_ESC, false);
    }
    if (prf().get_options().is(UIOPT_TAGFILETR_BAR))
    {
        fill_tags();
    }

    search_in_messages = prf().is_loaded() && prf().get_options().is(MSGOP_FULL_SEARCH);

    if (!is_all())
        refresh_list();

    __super::created();
}
コード例 #2
0
ファイル: maps-osm.c プロジェクト: GNOME/gnome-maps
static MapsOSMNode *
parse_node (const xmlNodePtr node, GError **error)
{
  const char *id_string;
  guint64 id;
  const char *changeset_string;
  guint64 changeset;
  const char *version_string;
  guint version;
  const char *lat_string;
  double lat;
  const char *lon_string;
  double lon;
  
  GHashTable *tags;
  GHashTable *attributes;

  MapsOSMNode *result;

  attributes = parse_attributes (node);

  id_string = g_hash_table_lookup (attributes, "id");
  changeset_string = g_hash_table_lookup (attributes, "changeset");
  version_string = g_hash_table_lookup (attributes, "version");
  lat_string = g_hash_table_lookup (attributes, "lat");
  lon_string = g_hash_table_lookup (attributes, "lon");

  if (!id_string || !changeset_string || !version_string
      || !lat_string || !lon_string)
    {
      *error = g_error_new_literal (MAPS_OSM_ERROR, 0,
                                    _("Missing required attributes"));
      g_hash_table_destroy (attributes);
      return NULL;
    }

  id = g_ascii_strtoull (id_string, NULL, 10);
  changeset = g_ascii_strtoull (changeset_string, NULL, 10);
  version = g_ascii_strtoull (version_string, NULL, 10);
  lon = g_ascii_strtod (lon_string, NULL);
  lat = g_ascii_strtod (lat_string, NULL);

  g_hash_table_destroy (attributes);

  result = maps_osm_node_new (id, version, changeset, lon, lat);

  tags = parse_tags (node->children);
  fill_tags (MAPS_OSMOBJECT (result), tags);

  g_hash_table_destroy (tags);

  return result;
}
コード例 #3
0
ファイル: maps-osm.c プロジェクト: GNOME/gnome-maps
static MapsOSMRelation *
parse_relation (const xmlNodePtr relation, GError **error)
{
  GHashTable *attributes;
  GHashTable *tags;
  GList *member_list;

  const char *id_string;
  guint64 id;
  const char *changeset_string;
  guint64 changeset;
  const char *version_string;
  guint version;
  
  MapsOSMRelation *result;

  attributes = parse_attributes (relation);
  id_string = g_hash_table_lookup (attributes, "id");
  changeset_string = g_hash_table_lookup (attributes, "changeset");
  version_string = g_hash_table_lookup (attributes, "version");

  if (!id_string || !changeset_string || !version_string)
    {
      *error = g_error_new_literal (MAPS_OSM_ERROR, 0,
                                    _("Missing required attributes"));
      g_hash_table_destroy (attributes);
      return NULL;
    }

  g_hash_table_destroy (attributes);

  id = g_ascii_strtoull (id_string, NULL, 10);
  changeset = g_ascii_strtoull (changeset_string, NULL, 10);
  version = g_ascii_strtoull (version_string, NULL, 10);

  result = maps_osm_relation_new (id, version, changeset);

  tags = parse_tags (relation->children);
  fill_tags (MAPS_OSMOBJECT (result), tags);
  g_hash_table_destroy (tags);

  member_list = parse_members (relation->children);
  fill_members (result, member_list);
  g_list_free_full (member_list, (GDestroyNotify) g_hash_table_destroy);

  return result;
}
コード例 #4
0
ファイル: maps-osm.c プロジェクト: GNOME/gnome-maps
static MapsOSMWay *
parse_way (const xmlNodePtr way, GError **error)
{
  GHashTable *attributes;
  GHashTable *tags;
  GArray *node_refs;
  MapsOSMWay *result;

  const char *id_string;
  guint64 id;
  const char *changeset_string;
  guint64 changeset;
  const char *version_string;
  guint version;

  attributes = parse_attributes (way);

  id_string = g_hash_table_lookup (attributes, "id");
  changeset_string = g_hash_table_lookup (attributes, "changeset");
  version_string = g_hash_table_lookup (attributes, "version");

  if (!id_string || !changeset_string || !version_string)
    {
      g_warning ("Missing required attributes\n");
      g_hash_table_destroy (attributes);
      return NULL;
    }

  g_hash_table_destroy (attributes);

  id = g_ascii_strtoull (id_string, NULL, 10);
  changeset = g_ascii_strtoull (changeset_string, NULL, 10);
  version = g_ascii_strtoull (version_string, NULL, 10);

  result = maps_osm_way_new (id, version, changeset);

  tags = parse_tags (way->children);
  fill_tags (MAPS_OSMOBJECT (result), tags);
  g_hash_table_destroy (tags);

  node_refs = parse_node_refs (way->children);
  fill_node_ref_list (result, node_refs);
  g_array_free (node_refs, TRUE);

  return result;
}
コード例 #5
0
ファイル: area_anim.cpp プロジェクト: freeors/War-Of-Kingdom
void fill_anims(const config& cfg)
{
	if (!instance) {
		// normally instance must not NULL. but now editor.exe, kingdomd.exe
		return;
	}

	fill_tags();
	instance->clear_anims();

	utils::string_map symbols;
	std::stringstream ss;

	std::set<int> constructed;

	symbols["child"] = tintegrate::generate_format("animation", "yellow");
	BOOST_FOREACH (const config &anim, cfg.child_range("animation")) {
		const std::string& app = anim["app"].str();

		if (!app.empty() && app != game_config::app) {
			continue;
		}

		const std::string& id = anim["id"].str();
		VALIDATE(!id.empty(), vgettext2("[$child] child, $child must has id attribute!", symbols));

		symbols["id"] = tintegrate::generate_format(id, "red");

		const config& sub = anim.child("anim");
		VALIDATE(sub, vgettext2("[$child] child, $child must has [anim] child!", symbols));

		bool area = sub["area_mode"].to_bool();
		bool tpl = !area && anim["template"].to_bool();

		int at = NONE;
		if (area || !tpl) {
			at = find(id);
			VALIDATE(at != NONE, vgettext2("[$child] child, WML defined $id, but cannot find corresponding code id!", symbols));
			VALIDATE(constructed.find(at) == constructed.end(), vgettext2("[$child] child, $id is defined repeatly!", symbols));
			constructed.insert(at);
		}

		instance->fill_anim(at, id, area, tpl, sub);
	}
}