Merge branch 'master' of git://github.com/haiku/haiku
This commit is contained in:
@@ -34,39 +34,39 @@ public:
|
||||
|
||||
menu_layout Layout() const;
|
||||
|
||||
void ItemMarked(BMenuItem *item);
|
||||
void CacheFontInfo();
|
||||
void ItemMarked(BMenuItem *item);
|
||||
void CacheFontInfo();
|
||||
|
||||
float FontHeight() const;
|
||||
float Ascent() const;
|
||||
BRect Padding() const;
|
||||
void GetItemMargins(float *, float *, float *, float *) const;
|
||||
float FontHeight() const;
|
||||
float Ascent() const;
|
||||
BRect Padding() const;
|
||||
void GetItemMargins(float *, float *, float *, float *) const;
|
||||
|
||||
static bool IsAltCommandKey();
|
||||
|
||||
int State(BMenuItem **item = NULL) const;
|
||||
int State(BMenuItem **item = NULL) const;
|
||||
|
||||
void Install(BWindow *window);
|
||||
void Uninstall();
|
||||
void SetSuper(BMenu *menu);
|
||||
void SetSuperItem(BMenuItem *item);
|
||||
void InvokeItem(BMenuItem *item, bool now = false);
|
||||
void QuitTracking(bool thisMenuOnly = true);
|
||||
void Install(BWindow *window);
|
||||
void Uninstall();
|
||||
void SetSuper(BMenu *menu);
|
||||
void SetSuperItem(BMenuItem *item);
|
||||
void InvokeItem(BMenuItem *item, bool now = false);
|
||||
void QuitTracking(bool thisMenuOnly = true);
|
||||
|
||||
static status_t CreateBitmaps();
|
||||
static void DeleteBitmaps();
|
||||
|
||||
static const BBitmap *MenuItemCommand();
|
||||
static const BBitmap *MenuItemControl();
|
||||
static const BBitmap *MenuItemOption();
|
||||
static const BBitmap *MenuItemShift();
|
||||
static const BBitmap *MenuItemShift();
|
||||
static const BBitmap *MenuItemControl();
|
||||
static const BBitmap *MenuItemOption();
|
||||
static const BBitmap *MenuItemCommand();
|
||||
static const BBitmap *MenuItemMenu();
|
||||
private:
|
||||
BMenu *fMenu;
|
||||
BMenu *fMenu;
|
||||
|
||||
static BBitmap *sMenuItemAlt;
|
||||
static BBitmap *sMenuItemShift;
|
||||
static BBitmap *sMenuItemControl;
|
||||
static BBitmap *sMenuItemOption;
|
||||
static BBitmap *sMenuItemShift;
|
||||
static BBitmap *sMenuItemAlt;
|
||||
static BBitmap *sMenuItemMenu;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -39,6 +39,53 @@ UTF8NextCharLen(const char *text)
|
||||
}
|
||||
|
||||
|
||||
static inline uint32
|
||||
UTF8NextCharLen(const char *bytes, size_t length)
|
||||
{
|
||||
if (bytes == NULL || length == 0 || bytes[0] == 0)
|
||||
return 0;
|
||||
|
||||
if ((bytes[0] & 0x80) == 0) {
|
||||
// A single ASCII char - or so...
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (IsInsideGlyph(bytes[0])) {
|
||||
// Not a proper multibyte start.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// We already know that we have the upper two bits set due to the above
|
||||
// two checks.
|
||||
uint8 mask = 0x20;
|
||||
size_t bytesExpected = 2;
|
||||
while ((bytes[0] & mask) != 0) {
|
||||
if (mask == 0x02) {
|
||||
// Seven byte char - invalid.
|
||||
return 0;
|
||||
}
|
||||
|
||||
bytesExpected++;
|
||||
mask >>= 1;
|
||||
}
|
||||
|
||||
// There would need to be more bytes to satisfy the char.
|
||||
if (bytesExpected > length)
|
||||
return 0;
|
||||
|
||||
// We already know the first byte is fine, check the rest.
|
||||
for (size_t i = 1; i < bytesExpected; i++) {
|
||||
if (!IsInsideGlyph(bytes[i])) {
|
||||
// The sequence is incomplete.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Puh, everything's fine.
|
||||
return bytesExpected;
|
||||
}
|
||||
|
||||
|
||||
static inline uint32
|
||||
UTF8PreviousCharLen(const char *text, const char *limit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user