Example #1
0
void error_dlg(const std::exception& e) {
  UnicodeString msg;
  msg.add(far_get_msg(MSG_PLUGIN_NAME)).add('\n');
  UnicodeString err_msg = word_wrap(oem_to_unicode(e.what()), get_msg_width());
  if (err_msg.size() != 0) msg.add(err_msg).add('\n');
  msg.add_fmt(L"v.%u.%u.%u.%u"PLUGIN_TYPE, g_version.major, g_version.minor, g_version.patch, g_version.revision);
  far_message(c_error_dialog_guid, msg, 0, FMSG_WARNING | FMSG_MB_OK);
}
Example #2
0
void error_dlg(CustomError& e) {
  UnicodeString msg;
  msg.add(far_get_msg(MSG_PLUGIN_NAME)).add('\n');
  if (e.object().size() != 0) msg.add(fit_str(e.object(), get_msg_width())).add('\n');
  if (e.message().size() != 0) msg.add(word_wrap(e.message(), get_msg_width())).add('\n');
  msg.add_fmt(L"%S:%u v.%u.%u.%u.%u"PLUGIN_TYPE, &extract_file_name(oem_to_unicode(e.file)), e.line, g_version.major, g_version.minor, g_version.patch, g_version.revision);
  far_message(c_error_dialog_guid, msg, 0, FMSG_WARNING | FMSG_MB_OK);
}
Example #3
0
static int Font_GetTextChar ( const char *text, int pos, int *nextPos )
{
	int ch;
	unsigned int len;
	EFontTextEncoding encoding = cur_pFont->encoding;

	if ( encoding == UTF8 )
	{
		ch = DecodeUTF8 ( &text[pos], &len );

		if ( ch == -1 ) len = 1;
	}
	else if ( encoding == UTF16 )
	{
		ch = DecodeUTF16 ( &text[pos], &len );

		if ( ch == -1 ) len = 2;
	}
	else
	{
		len = 1;
		ch = ( unsigned char ) text[pos];

		if ( ch >= 0x80 ) //oem
		{
			U16 oemcode;
			int ch2 = ( unsigned char ) text[pos + 1];
			len = 2;
			oemcode = ( ( U16 ) ch << 8 ) + ch2;
			ch = oem_to_unicode ( oemcode ); //oem to unicode
		}
	}

	if ( nextPos ) *nextPos = pos + len;

	return ch;
}
Example #4
0
UnicodeString oem_to_unicode(const AnsiString& oem_str) {
  UnicodeString u_str;
  oem_to_unicode(u_str, oem_str);
  return u_str;
}