virtual bool get_description(t_uint32 p_index,pfc::string_base & p_out)
   {
      switch ( p_index )
      {
      case CMD_NOTITLE:
         p_out.set_string( "Hide the main window title bar" );
         return true;

      case CMD_SAVE_1:
      case CMD_SAVE_2:
      case CMD_SAVE_3:
      case CMD_SAVE_4:
      case CMD_SAVE_5:
         {
            p_out.set_string( "save current screen location to a slot" );
            return true;
         }
         break;
      case CMD_REST_1:
      case CMD_REST_2:
      case CMD_REST_3:
      case CMD_REST_4:
      case CMD_REST_5:
         {
            p_out.set_string( "restore screen location from a slot" );
            return true;
         }
         break;
      case CMD_SCRIPT1:
      case CMD_SCRIPT2:
         p_out.set_string( "Change the layout and size" );
         return true;
      }
      return false;
   }
Esempio n. 2
0
void wsh_panel_vars::get_default_script_code(pfc::string_base & out)
{
	out.reset();
	puResource pures = uLoadResource(core_api::get_my_instance(), uMAKEINTRESOURCE(IDR_SCRIPT), "SCRIPT");

	if (pures)
		out.set_string(reinterpret_cast<const char *>(pures->GetPointer()), pures->GetSize());
}
Esempio n. 3
0
void urlEncodeAppendRaw(pfc::string_base & out, const char * in, t_size inSize) {
	for(t_size walk = 0; walk < inSize; ++walk) {
		const char c = in[walk];
		if (c == ' ') out.add_byte('+');
		else if (pfc::char_is_ascii_alphanumeric(c) || c == '_') out.add_byte(c);
		else out << "%" << pfc::format_hex((t_uint8)c, 2);
	}
}
Esempio n. 4
0
	void insert(const char * src,unsigned idx,pfc::string_base & out)
	{
		out.reset();
		out.add_string(src,idx);
		out.add_string("&");
		out.add_string(src+idx);
		used.add_char(uCharLower(src[idx]));
	}
Esempio n. 5
0
static void path_pack_string(pfc::string_base & out,const char * src)
{
	out.add_char('|');
	out << strlen(src);
	out.add_char('|');
	out << src;
	out.add_char('|');
}
Esempio n. 6
0
void urlEncodeAppend(pfc::string_base & out, const char * in) {
	for(;;) {
		const char c = *(in++);
		if (c == 0) break;
		else if (c == ' ') out.add_byte('+');
		else if (pfc::char_is_ascii_alphanumeric(c) || c == '_') out.add_byte(c);
		else out << "%" << pfc::format_hex((t_uint8)c, 2);
	}
}
Esempio n. 7
0
void stream_reader::read_string_raw(pfc::string_base & p_out,abort_callback & p_abort) {
	enum {delta = 256};
	char buffer[delta];
	p_out.reset();
	for(;;) {
		t_size delta_done;
		delta_done = read(buffer,delta,p_abort);
		p_out.add_string(buffer,delta_done);
		if (delta_done < delta) break;
	}
}
Esempio n. 8
0
	virtual bool get_mask(unsigned idx, pfc::string_base & out)
	{
		if (idx > 0) return false;
		out.reset();
		for (int n = 0; n < 14; n++)
		{
			if (n) out.add_byte(';');
			out << "*." << extensions[n];
		}
		return true;
	}
Esempio n. 9
0
bool archive_impl::get_display_path(const char * path,pfc::string_base & out)
{
	pfc::string8 archive,file;
	if (g_parse_unpack_path(path,archive,file))
	{
		g_get_display_path(archive,out);
		out.add_string("|");
		out.add_string(file);
		return true;
	}
	else return false;
}
	void chars_to_lower( const char* p_src , pfc::string_base& p_out )
	{
		p_out.reset();
		const char* p = p_src;
		for (;*p;)
		{
			unsigned test;
			t_size delta = pfc::utf8_decode_char(p,test);
			if( delta == 0 || test == 0 ) break;
			p_out.add_char(pfc::charLower(test));
			p+=delta;
		}
	}
Esempio n. 11
0
void playlist_view_cache::get_display_name(unsigned playlist, unsigned idx, int col, pfc::string_base & out)
{	
	playlist_cache * p_cache = get_item(playlist);
	if (idx >= 0 && idx < p_cache->get_count())
	{
		if (!p_cache->get_item(idx))
		{
			if (!update_item(playlist, idx)) {out.set_string("Error"); return;}
		}
		p_cache->get_item(idx)->get_item(col)->get_display(out); return;
	}
	out.set_string("Internal error - invalid playlist entry!");
}
Esempio n. 12
0
void titleformat_compiler::remove_color_marks(const char * src,pfc::string_base & out)//helper
{
	out.reset();
	while(*src)
	{
		if (*src==3)
		{
			src++;
			while(*src && *src!=3) src++;
			if (*src==3) src++;
		}
		else out.add_byte(*src++);
	}
}
Esempio n. 13
0
	void mainpath_from_guid(const GUID & p_guid, const GUID & p_subguid, pfc::string_base & p_out, bool b_short)
	{
		p_out.reset();
		service_enum_t<mainmenu_commands> e;
		service_ptr_t<mainmenu_commands> ptr;

		unsigned p_service_item_index;
		while (e.next(ptr))
		{
			service_ptr_t<mainmenu_commands_v2> ptr_v2;
			ptr->service_query_t(ptr_v2);
			unsigned p_service_item_count = ptr->get_command_count();
			for (p_service_item_index = 0; p_service_item_index < p_service_item_count; p_service_item_index++)
			{
				if (p_guid == ptr->get_command(p_service_item_index))
				{
					pfc::string8 name;
					ptr->get_name(p_service_item_index, name);
					if (p_subguid != pfc::guid_null && ptr_v2.is_valid() && ptr_v2->is_command_dynamic(p_service_item_index))
					{
						pfc::string8 name_sub;
						mainmenu_node::ptr ptr_node = ptr_v2->dynamic_instantiate(p_service_item_index);
						mainmenunode_subguid_to_path(ptr_node, p_subguid, name_sub, true);
						name << "/" << name_sub;
					}
					if (!b_short)
					{
						pfc::list_t<pfc::string8> levels;
						GUID parent = ptr->get_parent();
						while (parent != pfc::guid_null)
						{
							pfc::string8 parentname;
							if (maingroupname_from_guid(GUID(parent), parentname, parent))
								levels.insert_item(parentname, 0);
						}
						unsigned i, count = levels.get_count();
						for (i = 0; i<count; i++)
						{
							p_out.add_string(levels[i]);
							p_out.add_byte('/');

						}
					}
					p_out.add_string(name);
				}

			}
		}
	}
bool file_info::meta_format(const char * p_name,pfc::string_base & p_out, const char * separator) const {
    p_out.reset();
    t_size index = meta_find(p_name);
    if (index == pfc_infinite) return false;
    meta_format_entry(index, p_out, separator);
    return true;
}
Esempio n. 15
0
bool menu_helpers::context_get_description(const GUID& p_guid,pfc::string_base & out) {
	service_ptr_t<contextmenu_item> ptr; t_uint32 index;
	if (!menu_item_resolver::g_resolve_context_command(p_guid, ptr, index)) return false;
	bool rv = ptr->get_item_description(index, out);
	if (!rv) out.reset();
	return rv;
}
	void remove_chars( const char* p_src , pfc::string_base& p_out , const char* p_char)
	{
		const char* p  = p_char;
		pfc::string8 temp(p_src);
		const char* p2 = temp.get_ptr();
		for (;*p;)
		{
			unsigned test;
			t_size delta = pfc::utf8_decode_char(p,test);
			if(delta == 0 || test == 0)break;
			for (;*p2;)
			{
				unsigned test2;
				t_size delta2 = pfc::utf8_decode_char(p2,test2);
				if(delta2 == 0 || test2 == 0)break;
				if( test == test2 ){
					temp.remove_chars(p2-temp.get_ptr(),delta2);
				}
				else{
					p2 += delta2;
				}
			}
			p2 = temp.get_ptr();
			p += delta;
		}
		p_out.set_string(temp);
	}
Esempio n. 17
0
void toolbar_extension::button::get_name(pfc::string_base & p_out) //config
{
	p_out.reset();
	if (m_type == TYPE_BUTTON)
	{
		p_out = "[Button] ";
		pfc::string8 temp;
		if (uie::custom_button::g_button_get_name(m_guid, temp))
		{
			p_out += temp;
		}
	}
	else if (m_type == TYPE_SEPARATOR)
		p_out = "[Separator]";
	else if (m_type == TYPE_MENU_ITEM_MAIN)
	{
		pfc::string8 temp;
		p_out = "[Main menu item] ";
		menu_helpers::mainpath_from_guid(m_guid, m_subcommand, temp);
		p_out += temp;
	}
	else
	{
		pfc::string8 temp;
		menu_helpers::contextpath_from_guid(m_guid, m_subcommand, temp);
		p_out = "[Shortcut menu item] ";
		p_out += temp;
	}
}
Esempio n. 18
0
	bool maingroupname_from_guid(const GUID & p_guid, pfc::string_base & p_out, GUID & parentout)
	{
		p_out.reset();
		parentout = pfc::guid_null;
		{
			service_enum_t<mainmenu_group> e;
			service_ptr_t<mainmenu_group> ptr;
			service_ptr_t<mainmenu_group_popup> ptrp;

			//unsigned p_service_item_index;
			while (e.next(ptr))
			{
				{
					if (ptr->get_guid() == p_guid)
					{
						parentout = ptr->get_parent();
						if (ptr->service_query_t(ptrp))
						{
							ptrp->get_display_string(p_out);
							return true;
						}
						return false;
					}

				}
			}
		}
		return false;
	}
Esempio n. 19
0
	virtual bool
	context_get_display(
		unsigned int			index,
		metadb_handle_list_cref	tracks,
		pfc::string_base&		out,
		unsigned int&			/*displayflags*/,
		const GUID&				/*caller*/
	)
	{
		switch(index)
		{
			case Items::ReplaceWithBestVersion:
			{
				out = "Replace with best version of track";

				if(tracks.get_count() > 1)
				{
					out.add_string("s");
				}

				return true;
			}

			default:
			{
				// Nothing wants to customise the display of the item; let the regular name be displayed.
				get_item_name(index, out);
				return true;
			}
		}
	}
Esempio n. 20
0
void toolbar_extension::button::get_display_text(pfc::string_base & p_out) //display
{
	p_out.reset();
	if (m_use_custom_text)
		p_out = m_text;
	else
		get_short_name(p_out);
}
void CDialogPref::uGetItemText(int nItem, int nSubItem, pfc::string_base & out)
{
    enum { BUFFER_LEN = 1024 };
    TCHAR buffer[BUFFER_LEN];

    m_props.GetItemText(nItem, nSubItem, buffer, BUFFER_LEN);
    out.set_string(pfc::stringcvt::string_utf8_from_os(buffer));
}
Esempio n. 22
0
static void fix_ampersand(const char * src,pfc::string_base & out)
{
	unsigned ptr = 0;
	while(src[ptr])
	{
		if (src[ptr]=='&')
		{
			out.add_string("&&");
			ptr++;
			while(src[ptr]=='&')
			{
				out.add_string("&&");
				ptr++;
			}
		}
		else out.add_byte(src[ptr++]);
	}
}
Esempio n. 23
0
void ui_extension::menu_hook_impl::fix_ampersand(const char * src,pfc::string_base & out)
{
	unsigned ptr = 0;
	while(src[ptr])
	{
		if (src[ptr]=='&')
		{
			out.add_string("&&");
			ptr++;
			while(src[ptr]=='&')
			{
				out.add_string("&&");
				ptr++;
			}
		}
		else out.add_byte(src[ptr++]);
	}
}
Esempio n. 24
0
bool metadb_handle::format_title_legacy(titleformat_hook * p_hook,pfc::string_base & p_out,const char * p_spec,titleformat_text_filter * p_filter)
{
	service_ptr_t<titleformat_object> script;
	if (static_api_ptr_t<titleformat_compiler>()->compile(script,p_spec)) {
		return format_title(p_hook,p_out,script,p_filter);
	} else {
		p_out.reset();
		return false;
	}
}
void file_info::meta_format_entry(t_size index, pfc::string_base & out, const char * separator) const {
    out.reset();
    t_size val, count = meta_enum_value_count(index);
    PFC_ASSERT( count > 0);
    for(val=0; val<count; val++)
    {
        if (val > 0) out += separator;
        out += meta_enum_value(index,val);
    }
}
Esempio n. 26
0
void foobar2000_io::generate_temp_location_for_file(pfc::string_base & p_out, const char * p_origpath,const char * p_extension,const char * p_magic) {
	hasher_md5_result hash;
	{
		static_api_ptr_t<hasher_md5> hasher;
		hasher_md5_state state;
		hasher->initialize(state);
		hasher->process(state,p_origpath,strlen(p_origpath));
		hasher->process(state,p_extension,strlen(p_extension));
		hasher->process(state,p_magic,strlen(p_magic));
		hash = hasher->get_result(state);
	}

	p_out = p_origpath;
	p_out.truncate(p_out.scan_filename());
	p_out += "temp-";
	p_out += pfc::format_hexdump(hash.m_data,sizeof(hash.m_data),"");
	p_out += ".";
	p_out += p_extension;
}
Esempio n. 27
0
void pfc::winPrefixPath(pfc::string_base & out, const char * p_path) {
	const char * prepend_header = "\\\\?\\";
	const char * prepend_header_net = "\\\\?\\UNC\\";
	if (pfc::strcmp_partial( p_path, prepend_header ) == 0) { out = p_path; return; }
	out.reset();
	if (pfc::strcmp_partial(p_path,"\\\\") != 0) {
		out << prepend_header << p_path;
	} else {
		out << prepend_header_net << (p_path+2);
	}
};
Esempio n. 28
0
	bool __contextpath_from_guid_recur(contextmenu_item_node * p_node, const GUID & p_subcommand, pfc::string_base & p_out, bool b_short, bool b_root)
	{
		if (p_node)
		{
			if (p_node->get_type() == contextmenu_item_node::TYPE_POPUP)
			{
				pfc::string8 subname, temp = p_out;
				unsigned dummy;
				p_node->get_display_data(subname, dummy, metadb_handle_list(), contextmenu_item::caller_keyboard_shortcut_list);
				if (temp.get_length() && temp.get_ptr()[temp.get_length() - 1] != '/')
					temp.add_byte('/');
				temp << subname;
				unsigned child, child_count = p_node->get_children_count();
				for (child = 0; child<child_count; child++)
				{
					contextmenu_item_node * p_child = p_node->get_child(child);
					if (__contextpath_from_guid_recur(p_child, p_subcommand, temp, b_short, false))
					{
						p_out = temp;
						return true;
					}
				}
			}
			else if (p_node->get_type() == contextmenu_item_node::TYPE_COMMAND && !b_root)
			{
				if (p_node->get_guid() == p_subcommand)
				{
					pfc::string8 subname;
					unsigned dummy;
					p_node->get_display_data(subname, dummy, metadb_handle_list(), contextmenu_item::caller_keyboard_shortcut_list);
					if (!b_short)
						p_out.add_byte('/');
					else
						p_out.reset();
					p_out.add_string(subname);
					return true;
				}
			}
		}
		return false;
	}
Esempio n. 29
0
void toolbar_extension::button::get_short_name(pfc::string_base & p_out) //tooltip
{
	p_out.reset();
	if (m_type == TYPE_BUTTON)
		uie::custom_button::g_button_get_name(m_guid, p_out);
	else if (m_type == TYPE_SEPARATOR)
		p_out = "Separator";
	else if (m_type == TYPE_MENU_ITEM_MAIN)
		menu_helpers::mainpath_from_guid(m_guid, m_subcommand, p_out, true);
	else
		menu_helpers::contextpath_from_guid(m_guid, m_subcommand, p_out, true);
}
Esempio n. 30
0
void double_to_string(double blah, pfc::string_base & p_out, int points = 10, bool ms = true)
{
	int decimal, sign;
	pfc::array_t<char> buffer;
	buffer.set_size(_CVTBUFSIZE);
	buffer.fill_null();
	_fcvt_s(buffer.get_ptr(), buffer.get_size(), blah*(ms ? 1000.0 : 1.0), points, &decimal, &sign);
	const char * ptr = buffer.get_ptr();
	if (decimal <= 0)
	{
		p_out.add_string("0.",2);
		while (decimal) 
		{
			p_out.add_byte('0');
			decimal ++;
		}
		p_out.add_string(ptr, pfc_infinite);
	}
	else
	{
		p_out.add_string(ptr, decimal);
		p_out.add_string(".",1);
		ptr += decimal;
		p_out.add_string(ptr,pfc_infinite);
	}
}