* Added Keymap::operator=().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29824 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -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
|
int32
|
||||||
Keymap::_Offset(uint32 keyCode, uint32 modifiers, uint32* _table)
|
Keymap::_Offset(uint32 keyCode, uint32 modifiers, uint32* _table)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ public:
|
|||||||
const key_map& Map() const { return fKeys; }
|
const key_map& Map() const { return fKeys; }
|
||||||
key_map& Map() { return fKeys; }
|
key_map& Map() { return fKeys; }
|
||||||
|
|
||||||
|
Keymap& operator=(const Keymap& other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 _Offset(uint32 keyCode, uint32 modifiers,
|
int32 _Offset(uint32 keyCode, uint32 modifiers,
|
||||||
uint32* _table = NULL);
|
uint32* _table = NULL);
|
||||||
@@ -63,4 +65,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //KEYMAP_H
|
#endif // KEYMAP_H
|
||||||
|
|||||||
@@ -95,8 +95,6 @@ KeymapWindow::KeymapWindow()
|
|||||||
|
|
||||||
_UpdateButtons();
|
_UpdateButtons();
|
||||||
|
|
||||||
fCurrentMap.SetTarget(this, new BMessage(kMsgKeymapUpdated));
|
|
||||||
|
|
||||||
// Make sure the user keymap directory exists
|
// Make sure the user keymap directory exists
|
||||||
BPath path;
|
BPath path;
|
||||||
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
||||||
@@ -150,8 +148,9 @@ KeymapWindow::KeymapWindow()
|
|||||||
= static_cast<KeymapListItem*>(fUserListView->FirstItem());
|
= static_cast<KeymapListItem*>(fUserListView->FirstItem());
|
||||||
|
|
||||||
fCurrentMap.Load(current->EntryRef());
|
fCurrentMap.Load(current->EntryRef());
|
||||||
fPreviousMap.Load(current->EntryRef());
|
fPreviousMap = fCurrentMap;
|
||||||
fAppliedMap.Load(current->EntryRef());
|
fAppliedMap = fCurrentMap;
|
||||||
|
fCurrentMap.SetTarget(this, new BMessage(kMsgKeymapUpdated));
|
||||||
|
|
||||||
_UpdateShortcutButton();
|
_UpdateShortcutButton();
|
||||||
|
|
||||||
@@ -506,10 +505,9 @@ KeymapWindow::_RevertKeymap()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fPreviousMap.Use();
|
fPreviousMap.Use();
|
||||||
fAppliedMap.Load(ref);
|
|
||||||
|
|
||||||
// TODO: add = operator
|
|
||||||
fCurrentMap.Load(ref);
|
fCurrentMap.Load(ref);
|
||||||
|
fAppliedMap = fCurrentMap;
|
||||||
|
|
||||||
fKeyboardLayoutView->SetKeymap(&fCurrentMap);
|
fKeyboardLayoutView->SetKeymap(&fCurrentMap);
|
||||||
|
|
||||||
fCurrentMapName = _GetActiveKeymapName();
|
fCurrentMapName = _GetActiveKeymapName();
|
||||||
|
|||||||
Reference in New Issue
Block a user