* Added IBM Laptop international keyboard layout.
* Added LEDs to the 105-key internal one. * Always choose the variable with the longest matching name instead of the first. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29711 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4acbaafd89
commit
c31467186f
@ -93,6 +93,13 @@ KeyboardLayout::DefaultKeySize()
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
KeyboardLayout::IndexForModifier(int32 modifier)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
KeyboardLayout::Load(const char* path)
|
||||
{
|
||||
@ -137,6 +144,7 @@ KeyboardLayout::Load(const char* path)
|
||||
void
|
||||
KeyboardLayout::_SetDefault()
|
||||
{
|
||||
#if 1
|
||||
static const char* kDefaultLayout104 = "name = Generic 104-key\n"
|
||||
// Size shortcuts
|
||||
"default-size = 10,10\n"
|
||||
@ -157,18 +165,23 @@ KeyboardLayout::_SetDefault()
|
||||
" 15,10:-; :+3; d$f:+1 ]\n"
|
||||
"[ 0,60; d$g:0x5c; d$g:0x66; d$g:0x5d; 59,10:+1; d$g:+1; d$g:0x67+1; "
|
||||
"d$g:0x60; $b:-; d:+3; $b:-; $c:+1; :+1 ]\n";
|
||||
|
||||
_InitFrom(kDefaultLayout104);
|
||||
#endif
|
||||
#if 0
|
||||
static const char* kDefaultLayout105 = "name = 105 Keys International\n"
|
||||
static const char* kDefaultLayout105 =
|
||||
"name = Generic 105-key International\n"
|
||||
// Size shortcuts
|
||||
"default-size = 10,10\n"
|
||||
"$b = 5,10\n"
|
||||
"$c = 20,10\n"
|
||||
"$d = 15,10\n"
|
||||
"$e = l15,20,13\n"
|
||||
"$e = l15,20,9\n"
|
||||
"$f = 10,20\n"
|
||||
"$g = 13,10\n"
|
||||
// Key rows
|
||||
"[ 0,0; d:0x01; :-; :+4; $b:-; d:+4; $b:-; :+4; $b:-; d:+3 ]\n"
|
||||
"[ 0,0; d:0x01; :-; :+4; $b:-; d:+4; $b:-; :+4; $b:-; d:+3; $b:-; "
|
||||
"$g:led-num; $g:led-caps; $g:led-scroll ]\n"
|
||||
"[ 0,20; :+13; d$c:+; $b:-; d:+3; $b:-; d:+4 ]\n"
|
||||
"[ 0,30; d$d:0x26; :+12; d$e:0x47; $b:-; d:0x34-0x36; $b:-; :+3; "
|
||||
"d$f:+1 ]\n"
|
||||
@ -177,9 +190,38 @@ KeyboardLayout::_SetDefault()
|
||||
" 15,10:-; :+3; d$f:+1 ]\n"
|
||||
"[ 0,60; d$g:0x5c; d$g:0x66; d$g:0x5d; 59,10:+1; d$g:+1; d$g:0x67+1; "
|
||||
"d$g:0x60; $b:-; d:+3; $b:-; $c:+1; :+1 ]\n";
|
||||
#endif
|
||||
|
||||
_InitFrom(kDefaultLayout104);
|
||||
_InitFrom(kDefaultLayout105);
|
||||
#endif
|
||||
#if 0
|
||||
static const char* kIBMLaptop = "name = IBM Laptop International\n"
|
||||
// Size shortcuts
|
||||
"default-size = 18,18\n"
|
||||
"$s = 17,10\n"
|
||||
"$gap = 6,10\n"
|
||||
"$sgap = 5,10\n"
|
||||
"$backspace = 38,18\n"
|
||||
"$tab = 28,18\n"
|
||||
"$caps = 32,18\n"
|
||||
"$enter = l28,36,22\n"
|
||||
"$l-shift-ctrl = 23,18\n"
|
||||
"$r-shift = 51,18\n"
|
||||
"$option = 13,18\n"
|
||||
"$space = 95,18\n"
|
||||
// Key rows
|
||||
"[ 0,0; $s:0x01; 148,10:-; $s:0x0e+2; $sgap:-; $s:0x1f+2; ]\n"
|
||||
"[ 0,10; $s:0x02+3; $gap:-; $s:+4; $gap:-; $s:+4; $sgap:-; "
|
||||
"$s:0x34+2; ]\n"
|
||||
"[ 0,20; :0x11+12; $backspace:+1 ]\n"
|
||||
"[ 0,38; $tab:+1; :+12; $enter:0x47; ]\n"
|
||||
"[ 0,56; $caps:0x3b; :+11; :0x33 ]\n"
|
||||
"[ 0,74; $l-shift-ctrl:0x4b; :0x69; :0x4c+9; $r-shift:+1 ]\n"
|
||||
"[ 0,92; :0x99; $l-shift-ctrl:0x5c; $option:0x66; :0x5d; $space:+1; "
|
||||
":+1; :0x67; :0x60; $s:0x9a; $s:0x57; $s:0x9b ]\n"
|
||||
"[ 221,102; $s:0x61+2; ]\n";
|
||||
|
||||
_InitFrom(kIBMLaptop);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -568,21 +610,27 @@ KeyboardLayout::_SubstituteVariables(BString& term, VariableMap& variables,
|
||||
int32 index = term.FindFirst('$');
|
||||
if (index < 0)
|
||||
break;
|
||||
|
||||
|
||||
// find variable name
|
||||
|
||||
|
||||
VariableMap::iterator iterator = variables.begin();
|
||||
VariableMap::iterator best = variables.end();
|
||||
int32 bestLength = 0;
|
||||
|
||||
for (; iterator != variables.end(); iterator++) {
|
||||
const BString& name = iterator->first;
|
||||
if (!name.Compare(&term[index], name.Length())) {
|
||||
// got one, replace it
|
||||
term.Remove(index, name.Length());
|
||||
term.Insert(iterator->second.String(), index);
|
||||
break;
|
||||
if (!name.Compare(&term[index], name.Length())
|
||||
&& name.Length() > bestLength) {
|
||||
best = iterator;
|
||||
bestLength = name.Length();
|
||||
}
|
||||
}
|
||||
|
||||
if (iterator == variables.end()) {
|
||||
if (best != variables.end()) {
|
||||
// got one, replace it
|
||||
term.Remove(index, bestLength);
|
||||
term.Insert(best->second.String(), index);
|
||||
} else {
|
||||
// variable has not been found
|
||||
unknown = &term[index];
|
||||
int32 length = 1;
|
||||
|
@ -52,10 +52,9 @@ public:
|
||||
|
||||
BRect Bounds();
|
||||
BSize DefaultKeySize();
|
||||
int32 IndexForModifier(int32 modifier);
|
||||
|
||||
status_t Load(const char* path);
|
||||
|
||||
int32 IndexForModifier(int32 modifier);
|
||||
|
||||
private:
|
||||
enum parse_mode {
|
||||
|
Loading…
Reference in New Issue
Block a user