Ticket #9744: keymap.cpp.2.patch
File keymap.cpp.2.patch, 6.6 KB (added by , 12 years ago) |
---|
-
haiku/src/preferences/keymap/Keymap.cpp
old new 1 1 /* 2 * Copyright 2004-201 1Haiku Inc. All rights reserved.2 * Copyright 2004-2013 Haiku Inc. All rights reserved. 3 3 * Distributed under the terms of the MIT License. 4 4 * 5 5 * Authors: 6 6 * Sandor Vroemisse 7 7 * Jérôme Duval 8 8 * Axel Dörfler, axeld@pinc-software.de. 9 * Hristos Maretsikos, chrisgrelec@sch.gr. 9 10 */ 10 11 11 12 … … Keymap::SetDeadKeyEnabled(uint32 keyCode 247 248 if (deadKeyIndex > 0) { 248 249 uint32* deadTables[] = { 249 250 &fKeys.acute_tables, 251 &fKeys.acutesmooth_tables, 252 &fKeys.acuterough_tables, 253 &fKeys.acutediaeresis_tables, 254 &fKeys.acutesubscript_tables, 255 &fKeys.acutesmoothsubscript_tables, 256 &fKeys.acuteroughsubscript_tables, 250 257 &fKeys.grave_tables, 258 &fKeys.gravesmooth_tables, 259 &fKeys.graverough_tables, 260 &fKeys.gravediaeresis_tables, 261 &fKeys.gravesubscript_tables, 262 &fKeys.gravesmoothsubscript_tables, 263 &fKeys.graveroughsubscript_tables, 264 &fKeys.smooth_tables, 265 &fKeys.smoothcircumflex_tables, 266 &fKeys.smoothsubscript_tables, 267 &fKeys.smoothcircumflexsubscript_tables, 268 &fKeys.rough_tables, 269 &fKeys.roughcircumflex_tables, 270 &fKeys.roughsubscript_tables, 271 &fKeys.roughcircumflexsubscript_tables, 251 272 &fKeys.circumflex_tables, 273 &fKeys.circumflexdiaeresis_tables, 274 &fKeys.circumflexsubscript_tables, 252 275 &fKeys.dieresis_tables, 253 &fKeys.tilde_tables 276 &fKeys.diaeresisaccent_tables, 277 &fKeys.tilde_tables, 278 &fKeys.accent_tables, 279 &fKeys.macron_tables, 280 &fKeys.breve_tables, 281 &fKeys.subscript_tables 254 282 }; 255 283 256 284 if (enabled) … … Keymap::SetDeadKeyEnabled(uint32 keyCode 265 293 266 294 267 295 /*! Returns the trigger character string that is currently set for the dead 268 key with the given index (which is 1.. 5).296 key with the given index (which is 1..32). 269 297 */ 270 298 void 271 299 Keymap::GetDeadKeyTrigger(dead_key_index deadKeyIndex, BString& outTrigger) 272 300 { 273 301 outTrigger = ""; 274 if (deadKeyIndex < 1 || deadKeyIndex > 5)302 if (deadKeyIndex < 1 || deadKeyIndex > 32) 275 303 return; 276 304 277 305 int32 deadOffsets[] = { 278 306 fKeys.acute_dead_key[1], 307 fKeys.acutesmooth_dead_key[1], 308 fKeys.acuterough_dead_key[1], 309 fKeys.acutediaeresis_dead_key[1], 310 fKeys.acutesubscript_dead_key[1], 311 fKeys.acutesmoothsubscript_dead_key[1], 312 fKeys.acuteroughsubscript_dead_key[1], 279 313 fKeys.grave_dead_key[1], 314 fKeys.gravesmooth_dead_key[1], 315 fKeys.graverough_dead_key[1], 316 fKeys.gravediaeresis_dead_key[1], 317 fKeys.gravesubscript_dead_key[1], 318 fKeys.gravesmoothsubscript_dead_key[1], 319 fKeys.graveroughsubscript_dead_key[1], 320 fKeys.smooth_dead_key[1], 321 fKeys.smoothcircumflex_dead_key[1], 322 fKeys.smoothsubscript_dead_key[1], 323 fKeys.smoothcircumflexsubscript_dead_key[1], 324 fKeys.rough_dead_key[1], 325 fKeys.roughcircumflex_dead_key[1], 326 fKeys.roughsubscript_dead_key[1], 327 fKeys.roughcircumflexsubscript_dead_key[1], 280 328 fKeys.circumflex_dead_key[1], 329 fKeys.circumflexdiaeresis_dead_key[1], 330 fKeys.circumflexsubscript_dead_key[1], 281 331 fKeys.dieresis_dead_key[1], 282 fKeys.tilde_dead_key[1] 332 fKeys.diaeresisaccent_dead_key[1], 333 fKeys.tilde_dead_key[1], 334 fKeys.accent_dead_key[1], 335 fKeys.macron_dead_key[1], 336 fKeys.breve_dead_key[1], 337 fKeys.subscript_dead_key[1] 283 338 }; 284 339 285 340 int32 offset = deadOffsets[deadKeyIndex - 1]; … … Keymap::GetDeadKeyTrigger(dead_key_index 295 350 296 351 297 352 /*! Sets the trigger character string that shall be used for the dead key 298 with the given index (which is 1.. 5).353 with the given index (which is 1..32). 299 354 */ 300 355 void 301 356 Keymap::SetDeadKeyTrigger(dead_key_index deadKeyIndex, const BString& trigger) 302 357 { 303 if (deadKeyIndex < 1 || deadKeyIndex > 5)358 if (deadKeyIndex < 1 || deadKeyIndex > 32) 304 359 return; 305 360 306 361 int32 deadOffsets[] = { 307 362 fKeys.acute_dead_key[1], 363 fKeys.acutesmooth_dead_key[1], 364 fKeys.acuterough_dead_key[1], 365 fKeys.acutediaeresis_dead_key[1], 366 fKeys.acutesubscript_dead_key[1], 367 fKeys.acutesmoothsubscript_dead_key[1], 368 fKeys.acuteroughsubscript_dead_key[1], 308 369 fKeys.grave_dead_key[1], 370 fKeys.gravesmooth_dead_key[1], 371 fKeys.graverough_dead_key[1], 372 fKeys.gravediaeresis_dead_key[1], 373 fKeys.gravesubscript_dead_key[1], 374 fKeys.gravesmoothsubscript_dead_key[1], 375 fKeys.graveroughsubscript_dead_key[1], 376 fKeys.smooth_dead_key[1], 377 fKeys.smoothcircumflex_dead_key[1], 378 fKeys.smoothsubscript_dead_key[1], 379 fKeys.smoothcircumflexsubscript_dead_key[1], 380 fKeys.rough_dead_key[1], 381 fKeys.roughcircumflex_dead_key[1], 382 fKeys.roughsubscript_dead_key[1], 383 fKeys.roughcircumflexsubscript_dead_key[1], 309 384 fKeys.circumflex_dead_key[1], 385 fKeys.circumflexdiaeresis_dead_key[1], 386 fKeys.circumflexsubscript_dead_key[1], 310 387 fKeys.dieresis_dead_key[1], 311 fKeys.tilde_dead_key[1] 388 fKeys.diaeresisaccent_dead_key[1], 389 fKeys.tilde_dead_key[1], 390 fKeys.accent_dead_key[1], 391 fKeys.macron_dead_key[1], 392 fKeys.breve_dead_key[1], 393 fKeys.subscript_dead_key[1] 312 394 }; 313 395 314 396 int32 offset = deadOffsets[deadKeyIndex - 1]; … … Keymap::SetDeadKeyTrigger(dead_key_index 320 402 // it is available 321 403 uint32* deadTables[] = { 322 404 &fKeys.acute_tables, 405 &fKeys.acutesmooth_tables, 406 &fKeys.acuterough_tables, 407 &fKeys.acutediaeresis_tables, 408 &fKeys.acutesubscript_tables, 409 &fKeys.acutesmoothsubscript_tables, 410 &fKeys.acuteroughsubscript_tables, 323 411 &fKeys.grave_tables, 412 &fKeys.gravesmooth_tables, 413 &fKeys.graverough_tables, 414 &fKeys.gravediaeresis_tables, 415 &fKeys.gravesubscript_tables, 416 &fKeys.gravesmoothsubscript_tables, 417 &fKeys.graveroughsubscript_tables, 418 &fKeys.smooth_tables, 419 &fKeys.smoothcircumflex_tables, 420 &fKeys.smoothsubscript_tables, 421 &fKeys.smoothcircumflexsubscript_tables, 422 &fKeys.rough_tables, 423 &fKeys.roughcircumflex_tables, 424 &fKeys.roughsubscript_tables, 425 &fKeys.roughcircumflexsubscript_tables, 324 426 &fKeys.circumflex_tables, 427 &fKeys.circumflexdiaeresis_tables, 428 &fKeys.circumflexsubscript_tables, 325 429 &fKeys.dieresis_tables, 326 &fKeys.tilde_tables 430 &fKeys.diaeresisaccent_tables, 431 &fKeys.tilde_tables, 432 &fKeys.accent_tables, 433 &fKeys.macron_tables, 434 &fKeys.breve_tables, 435 &fKeys.subscript_tables 327 436 }; 328 437 *deadTables[deadKeyIndex - 1] 329 438 = B_NORMAL_TABLE | B_SHIFT_TABLE | B_CONTROL_TABLE | B_OPTION_TABLE … … Keymap::_SetChars(int32 offset, const ch 431 540 // update offsets 432 541 int32* data = fKeys.control_map; 433 542 int32 size = sizeof(fKeys.control_map) / 4 * 9 434 + sizeof(fKeys.acute_dead_key) / 4 * 5;543 + sizeof(fKeys.acute_dead_key) / 4 * 32; 435 544 for (int32 i = 0; i < size; i++) { 436 545 if (data[i] > offset) 437 546 data[i] += diff;