[ENHANCEMENT] Add hex column in Ascii Insert Panel.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1160 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 2013-12-21 12:05:47 +00:00
parent 0e36da7399
commit 6358717760
5 changed files with 18 additions and 11 deletions

View File

@ -836,6 +836,7 @@
<AsciiInsertion>
<PanelTitle name="¦r¤¸¦Cªí"/>
<ColumnVal name="¼Æ­È"/>
<ColumnHex name="十六進位碼"/>
<ColumnChar name="¦r¤¸"/>
</AsciiInsertion>
<DocumentMap>

View File

@ -834,6 +834,7 @@
<AsciiInsertion>
<PanelTitle name="ASCII Insertion Panel"/>
<ColumnVal name="Value"/>
<ColumnHex name="Hex"/>
<ColumnChar name="Character"/>
</AsciiInsertion>
<DocumentMap>

View File

@ -834,6 +834,7 @@
<AsciiInsertion>
<PanelTitle name="ASCII Insertion Panel"/>
<ColumnVal name="Value"/>
<ColumnHex name="Hex"/>
<ColumnChar name="Character"/>
</AsciiInsertion>
<DocumentMap>

View File

@ -858,6 +858,7 @@
<AsciiInsertion>
<PanelTitle name="Panneau des caractères ASCII"/>
<ColumnVal name="Valeur"/>
<ColumnHex name="Hexa"/>
<ColumnChar name="Caractère"/>
</AsciiInsertion>
<DocumentMap>

View File

@ -74,15 +74,20 @@ void ListView::init(HINSTANCE hInst, HWND parent)
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string valStr = pNativeSpeaker->getAttrNameStr(TEXT("Value"), "AsciiInsertion", "ColumnVal");
generic_string hexStr = pNativeSpeaker->getAttrNameStr(TEXT("Hex"), "AsciiInsertion", "ColumnHex");
generic_string charStr = pNativeSpeaker->getAttrNameStr(TEXT("Character"), "AsciiInsertion", "ColumnChar");
lvColumn.cx = 45;
lvColumn.pszText = (TCHAR *)valStr.c_str();
ListView_InsertColumn(_hSelf, 0, &lvColumn);
lvColumn.cx = 45;
lvColumn.pszText = (TCHAR *)hexStr.c_str();
ListView_InsertColumn(_hSelf, 1, &lvColumn);
lvColumn.cx = 70;
lvColumn.pszText = (TCHAR *)charStr.c_str();
ListView_InsertColumn(_hSelf, 1, &lvColumn);
ListView_InsertColumn(_hSelf, 2, &lvColumn);
}
void ListView::resetValues(int codepage)
@ -172,20 +177,14 @@ generic_string ListView::getAscii(unsigned char value)
default:
{
TCHAR charStr[10];
#ifdef UNICODE
char ascii[2];
ascii[0] = value;
ascii[1] = '\0';
MultiByteToWideChar(_codepage, 0, ascii, -1, charStr, sizeof(charStr));
#else
charStr[0] = (unsigned char)value;
charStr[1] = '\0';
#endif
return charStr;
}
}
//return TEXT("");
}
void ListView::setValues(int codepage)
@ -196,15 +195,19 @@ void ListView::setValues(int codepage)
{
LVITEM item;
item.mask = LVIF_TEXT;
TCHAR num[8];
generic_sprintf(num, TEXT("%d"), i);
item.pszText = num;
TCHAR dec[8];
TCHAR hex[8];
generic_sprintf(dec, TEXT("%d"), i);
generic_sprintf(hex, TEXT("%02X"), i);
item.pszText = dec;
item.iItem = i;
item.iSubItem = 0;
ListView_InsertItem(_hSelf, &item);
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)hex);
generic_string s = getAscii((unsigned char)i);
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)s.c_str());
ListView_SetItemText(_hSelf, i, 2, (LPTSTR)s.c_str());
}
}