* Added Keymap::operator=().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29824 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
321e8a6464
commit
751c91b7e1
@ -609,6 +609,29 @@ Keymap::SetKey(uint32 keyCode, uint32 modifiers, int8 deadKey,
|
||||
}
|
||||
|
||||
|
||||
Keymap&
|
||||
Keymap::operator=(const Keymap& other)
|
||||
{
|
||||
delete[] fChars;
|
||||
delete fModificationMessage;
|
||||
|
||||
fChars = new(std::nothrow) char[other.fCharsSize];
|
||||
if (fChars != NULL) {
|
||||
memcpy(fChars, other.fChars, other.fCharsSize);
|
||||
fCharsSize = other.fCharsSize;
|
||||
} else
|
||||
fCharsSize = 0;
|
||||
|
||||
memcpy(&fKeys, &other.fKeys, sizeof(key_map));
|
||||
strlcpy(fName, other.fName, sizeof(fName));
|
||||
|
||||
fTarget = other.fTarget;
|
||||
|
||||
if (other.fModificationMessage != NULL)
|
||||
fModificationMessage = new BMessage(*other.fModificationMessage);
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
Keymap::_Offset(uint32 keyCode, uint32 modifiers, uint32* _table)
|
||||
{
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
const key_map& Map() const { return fKeys; }
|
||||
key_map& Map() { return fKeys; }
|
||||
|
||||
Keymap& operator=(const Keymap& other);
|
||||
|
||||
private:
|
||||
int32 _Offset(uint32 keyCode, uint32 modifiers,
|
||||
uint32* _table = NULL);
|
||||
@ -63,4 +65,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif //KEYMAP_H
|
||||
#endif // KEYMAP_H
|
||||
|
@ -95,8 +95,6 @@ KeymapWindow::KeymapWindow()
|
||||
|
||||
_UpdateButtons();
|
||||
|
||||
fCurrentMap.SetTarget(this, new BMessage(kMsgKeymapUpdated));
|
||||
|
||||
// Make sure the user keymap directory exists
|
||||
BPath path;
|
||||
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
||||
@ -150,8 +148,9 @@ KeymapWindow::KeymapWindow()
|
||||
= static_cast<KeymapListItem*>(fUserListView->FirstItem());
|
||||
|
||||
fCurrentMap.Load(current->EntryRef());
|
||||
fPreviousMap.Load(current->EntryRef());
|
||||
fAppliedMap.Load(current->EntryRef());
|
||||
fPreviousMap = fCurrentMap;
|
||||
fAppliedMap = fCurrentMap;
|
||||
fCurrentMap.SetTarget(this, new BMessage(kMsgKeymapUpdated));
|
||||
|
||||
_UpdateShortcutButton();
|
||||
|
||||
@ -506,10 +505,9 @@ KeymapWindow::_RevertKeymap()
|
||||
}
|
||||
|
||||
fPreviousMap.Use();
|
||||
fAppliedMap.Load(ref);
|
||||
|
||||
// TODO: add = operator
|
||||
fCurrentMap.Load(ref);
|
||||
fAppliedMap = fCurrentMap;
|
||||
|
||||
fKeyboardLayoutView->SetKeymap(&fCurrentMap);
|
||||
|
||||
fCurrentMapName = _GetActiveKeymapName();
|
||||
|
Loading…
Reference in New Issue
Block a user