void CRT9Keyboard::setLayout( CRKeyboardLayoutRef layout ) { while ( !selector_.pop() ) ; _mainwin->getDocView()->clearSelection(); if ( !layout.isNull() ) { encoding_.set( layout->tXKeyboard->getItems() ); } if ( encoding_.length()==0 ) setDefaultLayout(); selector_.reinit(); setDirty(); }
void CRScreenKeyboard::setLayout( CRKeyboardLayoutRef layout ) { _keymap.clear(); unsigned maxcols = 0; if ( !layout.isNull() ) { for ( unsigned i=1; i<layout->vKeyboard->getItems().length(); i++ ) { lString16 s = layout->vKeyboard->get( i ); if ( !s.empty() ) _keymap.add( s ); if ( s.length() > maxcols ) maxcols = s.length(); } } _rows = _keymap.length(); _cols = maxcols<10 ? maxcols : 10; if ( _cols<=0 || _rows<=0 ) setDefaultLayout(); setDirty(); }