New type FKey for key inputs

This commit is contained in:
Markus Gans 2018-11-21 20:07:08 +01:00
parent 167b7c97bc
commit 1f64843fb6
36 changed files with 562 additions and 553 deletions

View File

@ -1,3 +1,6 @@
2018-11-21 Markus Gans <guru.mail@muenster.de>
* New type FKey for key inputs
2018-11-18 Markus Gans <guru.mail@muenster.de> 2018-11-18 Markus Gans <guru.mail@muenster.de>
* The FListViewItem class now provides checkable list view items * The FListViewItem class now provides checkable list view items
* Adding the checklist example to demonstrate the checkable FListViewItems * Adding the checklist example to demonstrate the checkable FListViewItems

View File

@ -90,7 +90,7 @@ void Button::setChecked (bool on)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Button::onKeyPress (finalcut::FKeyEvent* ev) void Button::onKeyPress (finalcut::FKeyEvent* ev)
{ {
int key = ev->key(); FKey key = ev->key();
// catch the enter key // catch the enter key
if ( key == finalcut::fc::Fkey_return if ( key == finalcut::fc::Fkey_return
@ -1007,8 +1007,8 @@ void Calc::calcInfixOperator()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Calc::onKeyPress (finalcut::FKeyEvent* ev) void Calc::onKeyPress (finalcut::FKeyEvent* ev)
{ {
int len = int(input.getLength()); std::size_t len = input.getLength();
int key = ev->key(); FKey key = ev->key();
switch ( key ) switch ( key )
{ {

View File

@ -53,7 +53,7 @@ Keyboard::Keyboard (finalcut::FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Keyboard::onKeyPress (finalcut::FKeyEvent* ev) void Keyboard::onKeyPress (finalcut::FKeyEvent* ev)
{ {
int key_id = ev->key(); FKey key_id = ev->key();
bool is_last_line = false; bool is_last_line = false;
if ( getPrintPos().getY() == int(getDesktopHeight()) ) if ( getPrintPos().getY() == int(getDesktopHeight()) )

View File

@ -685,9 +685,9 @@ bool FApplication::processDialogSwitchAccelerator()
if ( keyboard->getKey() >= fc::Fmkey_1 if ( keyboard->getKey() >= fc::Fmkey_1
&& keyboard->getKey() <= fc::Fmkey_9 ) && keyboard->getKey() <= fc::Fmkey_9 )
{ {
int key = keyboard->getKey(); FKey key = keyboard->getKey();
uLong n = uLong(key - fc::Fmkey_0); std::size_t n = key - fc::Fmkey_0;
uLong s = dialog_list->size(); std::size_t s = dialog_list->size();
if ( s > 0 && s >= n ) if ( s > 0 && s >= n )
{ {

View File

@ -292,12 +292,10 @@ void FButton::hide()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButton::onKeyPress (FKeyEvent* ev) void FButton::onKeyPress (FKeyEvent* ev)
{ {
int key;
if ( ! isEnabled() ) if ( ! isEnabled() )
return; return;
key = ev->key(); FKey key = ev->key();
switch ( key ) switch ( key )
{ {
@ -480,16 +478,16 @@ uChar FButton::getHotkey()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButton::setHotkeyAccelerator() void FButton::setHotkeyAccelerator()
{ {
int hotkey = getHotkey(); uChar hotkey = getHotkey();
if ( hotkey ) if ( hotkey )
{ {
if ( std::isalpha(hotkey) || std::isdigit(hotkey) ) if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{ {
addAccelerator (std::tolower(hotkey)); addAccelerator (FKey(std::tolower(hotkey)));
addAccelerator (std::toupper(hotkey)); addAccelerator (FKey(std::toupper(hotkey)));
// Meta + hotkey // Meta + hotkey
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey)); addAccelerator (fc::Fmkey_meta + FKey(std::tolower(hotkey)));
} }
else else
addAccelerator (getHotkey()); addAccelerator (getHotkey());

View File

@ -454,16 +454,16 @@ uChar FButtonGroup::getHotkey()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FButtonGroup::setHotkeyAccelerator() void FButtonGroup::setHotkeyAccelerator()
{ {
int hotkey = getHotkey(); uChar hotkey = getHotkey();
if ( hotkey ) if ( hotkey )
{ {
if ( std::isalpha(hotkey) || std::isdigit(hotkey) ) if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{ {
addAccelerator (std::tolower(hotkey)); addAccelerator (FKey(std::tolower(hotkey)));
addAccelerator (std::toupper(hotkey)); addAccelerator (FKey(std::toupper(hotkey)));
// Meta + hotkey // Meta + hotkey
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey)); addAccelerator (fc::Fmkey_meta + FKey(std::tolower(hotkey)));
} }
else else
addAccelerator (getHotkey()); addAccelerator (getHotkey());

View File

@ -3,7 +3,7 @@
* * * *
* This file is part of the Final Cut widget toolkit * * This file is part of the Final Cut widget toolkit *
* * * *
* Copyright 2014-2017 Markus Gans * * Copyright 2014-2018 Markus Gans *
* * * *
* The Final Cut is free software; you can redistribute it and/or * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * modify it under the terms of the GNU Lesser General Public License *
@ -48,7 +48,7 @@ int FEvent::type() const
// class FKeyEvent // class FKeyEvent
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FKeyEvent::FKeyEvent (int ev_type, int key_num) // constructor FKeyEvent::FKeyEvent (int ev_type, FKey key_num) // constructor
: FEvent(ev_type) : FEvent(ev_type)
, k(key_num) , k(key_num)
, accpt(false) , accpt(false)
@ -59,7 +59,7 @@ FKeyEvent::~FKeyEvent() // destructor
{ } { }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FKeyEvent::key() const FKey FKeyEvent::key() const
{ return k; } { return k; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -231,7 +231,7 @@ void FFileDialog::onKeyPress (FKeyEvent* ev)
if ( ! filebrowser.hasFocus() ) if ( ! filebrowser.hasFocus() )
return; return;
int key = ev->key(); FKey key = ev->key();
switch ( key ) switch ( key )
{ {

View File

@ -107,7 +107,7 @@ void FKeyboard::fetchKeyCode()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FString FKeyboard::getKeyName (int keynum) const FString FKeyboard::getKeyName (FKey keynum)
{ {
for (int i = 0; fc::FkeyName[i].string[0] != 0; i++) for (int i = 0; fc::FkeyName[i].string[0] != 0; i++)
if ( fc::FkeyName[i].num && fc::FkeyName[i].num == keynum ) if ( fc::FkeyName[i].num && fc::FkeyName[i].num == keynum )
@ -197,12 +197,12 @@ void FKeyboard::escapeKeyHandling()
// private methods of FKeyboard // private methods of FKeyboard
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FKeyboard::getMouseProtocolKey() inline FKey FKeyboard::getMouseProtocolKey()
{ {
// Looking for mouse string in the key buffer // Looking for mouse string in the key buffer
if ( ! mouse_support ) if ( ! mouse_support )
return -1; return NOT_SET;
std::size_t buf_len = std::strlen(fifo_buf); std::size_t buf_len = std::strlen(fifo_buf);
@ -221,18 +221,18 @@ inline int FKeyboard::getMouseProtocolKey()
&& fifo_buf[buf_len - 1] == 'M' ) && fifo_buf[buf_len - 1] == 'M' )
return fc::Fkey_urxvt_mouse; return fc::Fkey_urxvt_mouse;
return -1; return NOT_SET;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FKeyboard::getTermcapKey() inline FKey FKeyboard::getTermcapKey()
{ {
// Looking for termcap key strings in the buffer // Looking for termcap key strings in the buffer
assert ( FIFO_BUF_SIZE > 0 ); assert ( FIFO_BUF_SIZE > 0 );
if ( ! key_map ) if ( ! key_map )
return -1; return NOT_SET;
for (int i = 0; key_map[i].tname[0] != 0; i++) for (int i = 0; key_map[i].tname[0] != 0; i++)
{ {
@ -254,11 +254,11 @@ inline int FKeyboard::getTermcapKey()
} }
} }
return -1; return NOT_SET;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FKeyboard::getMetaKey() inline FKey FKeyboard::getMetaKey()
{ {
// Looking for meta key strings in the buffer // Looking for meta key strings in the buffer
@ -278,7 +278,7 @@ inline int FKeyboard::getMetaKey()
|| fifo_buf[1] == ']' ) ) || fifo_buf[1] == ']' ) )
{ {
if ( ! isKeypressTimeout() ) if ( ! isKeypressTimeout() )
return NEED_MORE_DATA; return fc::need_more_data;
} }
for (n = len; n < FIFO_BUF_SIZE; n++) // Remove founded entry for (n = len; n < FIFO_BUF_SIZE; n++) // Remove founded entry
@ -292,18 +292,18 @@ inline int FKeyboard::getMetaKey()
} }
} }
return -1; return NOT_SET;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FKeyboard::getSingleKey() inline FKey FKeyboard::getSingleKey()
{ {
// Looking for single key code in the buffer // Looking for single key code in the buffer
uChar firstchar = uChar(fifo_buf[0]); uChar firstchar = uChar(fifo_buf[0]);
std::size_t n; std::size_t n;
std::size_t len = 1; std::size_t len = 1;
int keycode; FKey keycode;
// Look for a utf-8 character // Look for a utf-8 character
if ( utf8_input && (firstchar & 0xc0) == 0xc0 ) if ( utf8_input && (firstchar & 0xc0) == 0xc0 )
@ -336,7 +336,7 @@ inline int FKeyboard::getSingleKey()
if ( keycode == 0 ) // Ctrl+Space or Ctrl+@ if ( keycode == 0 ) // Ctrl+Space or Ctrl+@
keycode = fc::Fckey_space; keycode = fc::Fckey_space;
return int(keycode == 127 ? fc::Fkey_backspace : keycode); return FKey(keycode == 127 ? fc::Fkey_backspace : keycode);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -370,16 +370,16 @@ bool FKeyboard::isKeypressTimeout()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FKeyboard::UTF8decode (const char utf8[]) FKey FKeyboard::UTF8decode (const char utf8[])
{ {
int ucs = 0; FKey ucs = 0; // Universal coded character
const int max = 4; const int max = 4;
int len = int(std::strlen(utf8)); std::size_t len = std::strlen(utf8);
if ( len > max ) if ( len > max )
len = max; len = max;
for (int i = 0; i < len; ++i) for (std::size_t i = 0; i < len; ++i)
{ {
uChar ch = uChar(utf8[i]); uChar ch = uChar(utf8[i]);
@ -411,7 +411,7 @@ int FKeyboard::UTF8decode (const char utf8[])
else else
{ {
// error // error
ucs = EOF; ucs = NOT_SET;
} }
} }
@ -450,12 +450,12 @@ void FKeyboard::parseKeyBuffer()
// Read the rest from the fifo buffer // Read the rest from the fifo buffer
while ( ! isKeypressTimeout() while ( ! isKeypressTimeout()
&& fifo_offset > 0 && fifo_offset > 0
&& key != NEED_MORE_DATA ) && key != fc::need_more_data )
{ {
key = parseKeyString(); key = parseKeyString();
key = keyCorrection(key); key = keyCorrection(key);
if ( key != NEED_MORE_DATA ) if ( key != fc::need_more_data )
keyPressed(); keyPressed();
fifo_offset = int(std::strlen(fifo_buf)); fifo_offset = int(std::strlen(fifo_buf));
@ -477,38 +477,38 @@ void FKeyboard::parseKeyBuffer()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FKeyboard::parseKeyString() FKey FKeyboard::parseKeyString()
{ {
uChar firstchar = uChar(fifo_buf[0]); uChar firstchar = uChar(fifo_buf[0]);
if ( firstchar == ESC[0] ) if ( firstchar == ESC[0] )
{ {
int keycode = getMouseProtocolKey(); FKey keycode = getMouseProtocolKey();
if ( keycode != -1 ) if ( keycode != NOT_SET )
return keycode; return keycode;
keycode = getTermcapKey(); keycode = getTermcapKey();
if ( keycode != -1 ) if ( keycode != NOT_SET )
return keycode; return keycode;
keycode = getMetaKey(); keycode = getMetaKey();
if ( keycode != -1 ) if ( keycode != NOT_SET )
return keycode; return keycode;
if ( ! isKeypressTimeout() ) if ( ! isKeypressTimeout() )
return NEED_MORE_DATA; return fc::need_more_data;
} }
return getSingleKey(); return getSingleKey();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FKeyboard::keyCorrection (const int& keycode) FKey FKeyboard::keyCorrection (const FKey& keycode)
{ {
int key_correction; FKey key_correction;
#if defined(__linux__) #if defined(__linux__)
if ( linux ) if ( linux )

View File

@ -440,10 +440,10 @@ void FLabel::setHotkeyAccelerator()
{ {
if ( std::isalpha(hotkey) || std::isdigit(hotkey) ) if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{ {
addAccelerator (std::tolower(hotkey)); addAccelerator (FKey(std::tolower(hotkey)));
addAccelerator (std::toupper(hotkey)); addAccelerator (FKey(std::toupper(hotkey)));
// Meta + hotkey // Meta + hotkey
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey)); addAccelerator (fc::Fmkey_meta + FKey(std::tolower(hotkey)));
} }
else else
addAccelerator (getHotkey()); addAccelerator (getHotkey());

View File

@ -330,7 +330,7 @@ void FLineEdit::clear()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FLineEdit::onKeyPress (FKeyEvent* ev) void FLineEdit::onKeyPress (FKeyEvent* ev)
{ {
int key = ev->key(); FKey key = ev->key();
switch ( key ) switch ( key )
{ {
@ -869,7 +869,7 @@ inline void FLineEdit::keyEnter()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FLineEdit::keyInput (int key) inline bool FLineEdit::keyInput (FKey key)
{ {
if ( key >= 0x20 && key <= 0x10fff ) if ( key >= 0x20 && key <= 0x10fff )
{ {

View File

@ -402,9 +402,9 @@ void FListBox::clear()
void FListBox::onKeyPress (FKeyEvent* ev) void FListBox::onKeyPress (FKeyEvent* ev)
{ {
std::size_t current_before = current; std::size_t current_before = current;
int xoffset_before = xoffset int xoffset_before = xoffset;
, yoffset_before = yoffset int yoffset_before = yoffset;
, key = ev->key(); FKey key = ev->key();
switch ( key ) switch ( key )
{ {
@ -1825,7 +1825,7 @@ inline bool FListBox::keyBackspace()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FListBox::keyIncSearchInput (int key) inline bool FListBox::keyIncSearchInput (FKey key)
{ {
if ( key <= 0x20 || key > 0x10fff ) if ( key <= 0x20 || key > 0x10fff )
return false; return false;

View File

@ -959,8 +959,8 @@ void FListView::onKeyPress (FKeyEvent* ev)
int position_before = current_iter.getPosition() int position_before = current_iter.getPosition()
, xoffset_before = xoffset , xoffset_before = xoffset
, first_line_position_before = first_visible_line.getPosition() , first_line_position_before = first_visible_line.getPosition()
, pagesize = int(getClientHeight()) - 1 , pagesize = int(getClientHeight()) - 1;
, key = ev->key(); FKey key = ev->key();
clicked_expander_pos.setPoint(-1, -1); clicked_expander_pos.setPoint(-1, -1);
switch ( key ) switch ( key )

View File

@ -491,7 +491,7 @@ void FMenu::calculateDimensions()
while ( iter != last ) while ( iter != last )
{ {
std::size_t item_width = (*iter)->getTextLength() + 2; std::size_t item_width = (*iter)->getTextLength() + 2;
int accel_key = (*iter)->accel_key; FKey accel_key = (*iter)->accel_key;
bool has_menu = (*iter)->hasMenu(); bool has_menu = (*iter)->hasMenu();
if ( has_menu ) if ( has_menu )
@ -1171,12 +1171,13 @@ bool FMenu::hotkeyMenu (FKeyEvent* ev)
if ( (*iter)->hasHotkey() ) if ( (*iter)->hasHotkey() )
{ {
bool found = false; bool found = false;
int hotkey = (*iter)->getHotkey(); uChar hotkey = (*iter)->getHotkey();
int key = ev->key(); FKey key = ev->key();
if ( std::isalpha(hotkey) || std::isdigit(hotkey) ) if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{ {
if ( std::tolower(hotkey) == key || std::toupper(hotkey) == key ) if ( FKey(std::tolower(hotkey)) == key
|| FKey(std::toupper(hotkey)) == key )
found = true; found = true;
} }
else if ( hotkey == key ) else if ( hotkey == key )
@ -1316,7 +1317,7 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
menuText txtdata; menuText txtdata;
std::size_t txt_length = txt.getLength(); std::size_t txt_length = txt.getLength();
std::size_t to_char = txt_length; std::size_t to_char = txt_length;
int accel_key = menuitem->accel_key; FKey accel_key = menuitem->accel_key;
bool is_enabled = menuitem->isEnabled(); bool is_enabled = menuitem->isEnabled();
bool is_selected = menuitem->isSelected(); bool is_selected = menuitem->isSelected();
@ -1469,7 +1470,7 @@ inline void FMenu::drawSubMenuIndicator (std::size_t& startpos)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FMenu::drawAcceleratorKey (std::size_t& startpos, int accel_key) inline void FMenu::drawAcceleratorKey (std::size_t& startpos, FKey accel_key)
{ {
FString accel_name (getKeyName(accel_key)); FString accel_name (getKeyName(accel_key));
std::size_t c = ( has_checkable_items ) ? 1 : 0; std::size_t c = ( has_checkable_items ) ? 1 : 0;

View File

@ -426,10 +426,10 @@ bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
{ {
if ( (*iter)->isEnabled() ) if ( (*iter)->isEnabled() )
{ {
int hotkey = (*iter)->getHotkey(); uChar hotkey = (*iter)->getHotkey();
int key = ev->key(); FKey key = ev->key();
if ( fc::Fmkey_meta + std::tolower(hotkey) == key ) if ( fc::Fmkey_meta + FKey(std::tolower(hotkey)) == key )
{ {
FMenuItem* sel_item = getSelectedItem(); FMenuItem* sel_item = getSelectedItem();

View File

@ -77,7 +77,7 @@ FMenuItem::FMenuItem (const FString& txt, FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuItem::FMenuItem (int k, const FString& txt, FWidget* parent) FMenuItem::FMenuItem (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, text(txt) , text(txt)
, selected(false) , selected(false)
@ -127,7 +127,8 @@ bool FMenuItem::setEnable (bool on)
if ( super && isMenuBar(super) ) if ( super && isMenuBar(super) )
{ {
// Meta + hotkey // Meta + hotkey
super->addAccelerator (fc::Fmkey_meta + std::tolower(hotkey), this); super->addAccelerator ( fc::Fmkey_meta + FKey(std::tolower(hotkey))
, this );
} }
} }
else else
@ -231,8 +232,7 @@ void FMenuItem::setText (const FString& txt)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenuItem::addAccelerator (FKey key, FWidget* obj)
void FMenuItem::addAccelerator (int key, FWidget* obj)
{ {
FWidget* root = getRootWidget(); FWidget* root = getRootWidget();
accelerator accel = { key, obj }; accelerator accel = { key, obj };
@ -596,7 +596,7 @@ void FMenuItem::init (FWidget* parent)
setSuperMenu (parent); setSuperMenu (parent);
if ( accel_key ) if ( accel_key )
addAccelerator (accel_key); addAccelerator (accel_key);
FMenuList* menu_list = getFMenuList(*parent); FMenuList* menu_list = getFMenuList(*parent);
@ -610,7 +610,7 @@ void FMenuItem::init (FWidget* parent)
menubar_ptr->calculateDimensions(); menubar_ptr->calculateDimensions();
if ( hotkey ) // Meta + hotkey if ( hotkey ) // Meta + hotkey
menubar_ptr->addAccelerator ( fc::Fmkey_meta + std::tolower(hotkey) menubar_ptr->addAccelerator ( fc::Fmkey_meta + FKey(std::tolower(hotkey))
, this ); , this );
addCallback // for this element addCallback // for this element
@ -681,7 +681,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
if ( win ) if ( win )
{ {
FMenuItem* win_item; FMenuItem* win_item;
int n = int(std::distance(first, iter)); uInt32 n = uInt32(std::distance(first, iter));
// get the dialog title // get the dialog title
const FString& name = win->getText(); const FString& name = win->getText();

View File

@ -45,7 +45,7 @@ FStatusKey::FStatusKey(FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStatusKey::FStatusKey (int k, const FString& txt, FWidget* parent) FStatusKey::FStatusKey (FKey k, const FString& txt, FWidget* parent)
: FWidget(parent) : FWidget(parent)
, key(k) , key(k)
, text(txt) , text(txt)

View File

@ -108,7 +108,7 @@ std::size_t FTerm::getColumnNumber()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
const FString FTerm::getKeyName (int keynum) const FString FTerm::getKeyName (FKey keynum)
{ {
return keyboard->getKeyName (keynum); return keyboard->getKeyName (keynum);
} }

View File

@ -436,7 +436,7 @@ char* FTermLinux::restoreCursorStyle()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::modifierKeyCorrection (const int& key_id) FKey FTermLinux::modifierKeyCorrection (const FKey& key_id)
{ {
// Get the current modifier key state // Get the current modifier key state
modifier_key& m = getModifierKey(); modifier_key& m = getModifierKey();
@ -910,7 +910,7 @@ bool FTermLinux::resetVGAPalette()
#endif // defined(__x86_64__) || defined(__i386) || defined(__arm__) #endif // defined(__x86_64__) || defined(__i386) || defined(__arm__)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::shiftKeyCorrection (const int& key_id) FKey FTermLinux::shiftKeyCorrection (const FKey& key_id)
{ {
switch ( key_id ) switch ( key_id )
{ {
@ -950,7 +950,7 @@ int FTermLinux::shiftKeyCorrection (const int& key_id)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::ctrlKeyCorrection (const int& key_id) FKey FTermLinux::ctrlKeyCorrection (const FKey& key_id)
{ {
switch ( key_id ) switch ( key_id )
{ {
@ -990,7 +990,7 @@ int FTermLinux::ctrlKeyCorrection (const int& key_id)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::altKeyCorrection (const int& key_id) FKey FTermLinux::altKeyCorrection (const FKey& key_id)
{ {
switch ( key_id ) switch ( key_id )
{ {
@ -1030,7 +1030,7 @@ int FTermLinux::altKeyCorrection (const int& key_id)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::shiftCtrlKeyCorrection (const int& key_id) FKey FTermLinux::shiftCtrlKeyCorrection (const FKey& key_id)
{ {
switch ( key_id ) switch ( key_id )
{ {
@ -1070,7 +1070,7 @@ int FTermLinux::shiftCtrlKeyCorrection (const int& key_id)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::shiftAltKeyCorrection (const int& key_id) FKey FTermLinux::shiftAltKeyCorrection (const FKey& key_id)
{ {
switch ( key_id ) switch ( key_id )
{ {
@ -1110,7 +1110,7 @@ int FTermLinux::shiftAltKeyCorrection (const int& key_id)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::ctrlAltKeyCorrection (const int& key_id) FKey FTermLinux::ctrlAltKeyCorrection (const FKey& key_id)
{ {
switch ( key_id ) switch ( key_id )
{ {
@ -1150,7 +1150,7 @@ int FTermLinux::ctrlAltKeyCorrection (const int& key_id)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FTermLinux::shiftCtrlAltKeyCorrection (const int& key_id) FKey FTermLinux::shiftCtrlAltKeyCorrection (const FKey& key_id)
{ {
switch ( key_id ) switch ( key_id )
{ {

View File

@ -428,16 +428,16 @@ uChar FToggleButton::getHotkey()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToggleButton::setHotkeyAccelerator() void FToggleButton::setHotkeyAccelerator()
{ {
int hotkey = getHotkey(); uChar hotkey = getHotkey();
if ( hotkey ) if ( hotkey )
{ {
if ( std::isalpha(hotkey) || std::isdigit(hotkey) ) if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
{ {
addAccelerator (std::tolower(hotkey)); addAccelerator (FKey(std::tolower(hotkey)));
addAccelerator (std::toupper(hotkey)); addAccelerator (FKey(std::toupper(hotkey)));
// Meta + hotkey // Meta + hotkey
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey)); addAccelerator (fc::Fmkey_meta + FKey(std::tolower(hotkey)));
} }
else else
addAccelerator (getHotkey()); addAccelerator (getHotkey());
@ -530,12 +530,10 @@ void FToggleButton::processToggle()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FToggleButton::onKeyPress (FKeyEvent* ev) void FToggleButton::onKeyPress (FKeyEvent* ev)
{ {
int key;
if ( ! isEnabled() ) if ( ! isEnabled() )
return; return;
key = ev->key(); FKey key = ev->key();
switch ( key ) switch ( key )
{ {
@ -619,8 +617,8 @@ void FToggleButton::init()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
std::size_t FToggleButton::getHotkeyPos ( wchar_t src[] std::size_t FToggleButton::getHotkeyPos ( wchar_t src[]
, wchar_t dest[] , wchar_t dest[]
, std::size_t length ) , std::size_t length )
{ {
// find hotkey position in string // find hotkey position in string
// + generate a new string without the '&'-sign // + generate a new string without the '&'-sign

View File

@ -970,7 +970,7 @@ void FWidget::emitCallback (const FString& emit_signal)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::addAccelerator (int key, FWidget* obj) void FWidget::addAccelerator (FKey key, FWidget* obj)
{ {
FWidget* widget = FWindow::getWindowWidget(obj); FWidget* widget = FWindow::getWindowWidget(obj);
accelerator accel = { key, obj }; accelerator accel = { key, obj };

View File

@ -239,414 +239,415 @@ enum SpecialCharacter
// keyboard - single keys // keyboard - single keys
enum keys enum keys
{ {
Fckey_a = 0x0000001, // control-a Fckey_a = 0x00000001, // control-a
Fckey_b = 0x0000002, // control-b Fckey_b = 0x00000002, // control-b
Fckey_c = 0x0000003, // control-c Fckey_c = 0x00000003, // control-c
Fckey_d = 0x0000004, // control-d Fckey_d = 0x00000004, // control-d
Fckey_e = 0x0000005, // control-e Fckey_e = 0x00000005, // control-e
Fckey_f = 0x0000006, // control-f Fckey_f = 0x00000006, // control-f
Fckey_g = 0x0000007, // control-g Fckey_g = 0x00000007, // control-g
Fkey_erase = 0x0000008, // control-h Fkey_erase = 0x00000008, // control-h
Fkey_tab = 0x0000009, // control-i Fkey_tab = 0x00000009, // control-i
Fckey_j = 0x000000a, // control-j Fckey_j = 0x0000000a, // control-j
Fckey_h = 0x000000b, // control-k Fckey_h = 0x0000000b, // control-k
Fckey_l = 0x000000c, // control-l Fckey_l = 0x0000000c, // control-l
Fkey_return = 0x000000d, // control-m Fkey_return = 0x0000000d, // control-m
Fckey_n = 0x000000e, // control-n Fckey_n = 0x0000000e, // control-n
Fckey_o = 0x000000f, // control-o Fckey_o = 0x0000000f, // control-o
Fckey_p = 0x0000010, // control-p Fckey_p = 0x00000010, // control-p
Fckey_q = 0x0000011, // control-q Fckey_q = 0x00000011, // control-q
Fckey_r = 0x0000012, // control-r Fckey_r = 0x00000012, // control-r
Fckey_s = 0x0000013, // control-s Fckey_s = 0x00000013, // control-s
Fckey_t = 0x0000014, // control-t Fckey_t = 0x00000014, // control-t
Fckey_u = 0x0000015, // control-u Fckey_u = 0x00000015, // control-u
Fckey_v = 0x0000016, // control-v Fckey_v = 0x00000016, // control-v
Fckey_w = 0x0000017, // control-w Fckey_w = 0x00000017, // control-w
Fckey_x = 0x0000018, // control-x Fckey_x = 0x00000018, // control-x
Fckey_y = 0x0000019, // control-y Fckey_y = 0x00000019, // control-y
Fckey_z = 0x000001a, // control-t Fckey_z = 0x0000001a, // control-t
Fkey_escape = 0x000001b, // control-[ Fkey_escape = 0x0000001b, // control-[
Fckey_backslash = 0x000001c, // control-'\' Fckey_backslash = 0x0000001c, // control-'\'
Fckey_right_square_bracket = 0x000001d, // control-] Fckey_right_square_bracket = 0x0000001d, // control-]
Fckey_caret = 0x000001e, // control-^ Fckey_caret = 0x0000001e, // control-^
Fckey_underscore = 0x000001f, // control-_ Fckey_underscore = 0x0000001f, // control-_
Fkey_space = 0x0000020, // space Fkey_space = 0x00000020, // space
Fkey_exclamation_mark = 0x0000021, // ! Fkey_exclamation_mark = 0x00000021, // !
Fkey_quotation_mark = 0x0000022, // " Fkey_quotation_mark = 0x00000022, // "
Fkey_number_sign = 0x0000023, // # Fkey_number_sign = 0x00000023, // #
Fkey_dollar_sign = 0x0000024, // $ Fkey_dollar_sign = 0x00000024, // $
Fkey_percent_sign = 0x0000025, // % Fkey_percent_sign = 0x00000025, // %
Fkey_ampersand = 0x0000026, // & Fkey_ampersand = 0x00000026, // &
Fkey_apostrophe = 0x0000027, // ' Fkey_apostrophe = 0x00000027, // '
Fkey_left_parentheses = 0x0000028, // ( Fkey_left_parentheses = 0x00000028, // (
Fkey_right_parentheses = 0x0000029, // ) Fkey_right_parentheses = 0x00000029, // )
Fkey_asterisk = 0x000002a, // * Fkey_asterisk = 0x0000002a, // *
Fkey_plus_sign = 0x000002b, // + Fkey_plus_sign = 0x0000002b, // +
Fkey_comma = 0x000002c, // , Fkey_comma = 0x0000002c, // ,
Fkey_minus_sign = 0x000002d, // - Fkey_minus_sign = 0x0000002d, // -
Fkey_full_stop = 0x000002e, // . Fkey_full_stop = 0x0000002e, // .
Fkey_slash = 0x000002f, // / Fkey_slash = 0x0000002f, // /
Fckey_space = 0x1000020, // control-space Fckey_space = 0x01000020, // control-space
Fkey_backspace = 0x1000100, Fkey_backspace = 0x01000100,
Fkey_catab = 0x1000101, Fkey_catab = 0x01000101,
Fkey_clear = 0x1000102, Fkey_clear = 0x01000102,
Fkey_ctab = 0x1000103, Fkey_ctab = 0x01000103,
Fkey_dc = 0x1000104, Fkey_dc = 0x01000104,
Fkey_dl = 0x1000105, Fkey_dl = 0x01000105,
Fkey_down = 0x1000106, Fkey_down = 0x01000106,
Fkey_eic = 0x1000107, Fkey_eic = 0x01000107,
Fkey_eol = 0x1000108, Fkey_eol = 0x01000108,
Fkey_eos = 0x1000109, Fkey_eos = 0x01000109,
Fkey_f0 = 0x100010a, Fkey_f0 = 0x0100010a,
Fkey_f1 = 0x100010b, Fkey_f1 = 0x0100010b,
Fkey_f2 = 0x100010c, Fkey_f2 = 0x0100010c,
Fkey_f3 = 0x100010d, Fkey_f3 = 0x0100010d,
Fkey_f4 = 0x100010e, Fkey_f4 = 0x0100010e,
Fkey_f5 = 0x100010f, Fkey_f5 = 0x0100010f,
Fkey_f6 = 0x1000110, Fkey_f6 = 0x01000110,
Fkey_f7 = 0x1000111, Fkey_f7 = 0x01000111,
Fkey_f8 = 0x1000112, Fkey_f8 = 0x01000112,
Fkey_f9 = 0x1000113, Fkey_f9 = 0x01000113,
Fkey_f10 = 0x1000114, Fkey_f10 = 0x01000114,
Fkey_home = 0x1000115, Fkey_home = 0x01000115,
Fkey_ic = 0x1000116, // insert key Fkey_ic = 0x01000116, // insert key
Fkey_il = 0x1000117, Fkey_il = 0x01000117,
Fkey_left = 0x1000118, Fkey_left = 0x01000118,
Fkey_ll = 0x1000119, Fkey_ll = 0x01000119,
Fkey_npage = 0x100011a, Fkey_npage = 0x0100011a,
Fkey_ppage = 0x100011b, Fkey_ppage = 0x0100011b,
Fkey_right = 0x100011c, Fkey_right = 0x0100011c,
Fkey_sf = 0x100011d, Fkey_sf = 0x0100011d,
Fkey_sr = 0x100011e, Fkey_sr = 0x0100011e,
Fkey_stab = 0x100011f, Fkey_stab = 0x0100011f,
Fkey_up = 0x1000120, Fkey_up = 0x01000120,
Fkey_a1 = 0x1000121, Fkey_a1 = 0x01000121,
Fkey_a3 = 0x1000122, Fkey_a3 = 0x01000122,
Fkey_b2 = 0x1000123, Fkey_b2 = 0x01000123,
Fkey_c1 = 0x1000124, Fkey_c1 = 0x01000124,
Fkey_c3 = 0x1000125, Fkey_c3 = 0x01000125,
Fkey_btab = 0x1000126, Fkey_btab = 0x01000126,
Fkey_beg = 0x1000127, Fkey_beg = 0x01000127,
Fkey_cancel = 0x1000128, Fkey_cancel = 0x01000128,
Fkey_close = 0x1000129, Fkey_close = 0x01000129,
Fkey_command = 0x100012a, Fkey_command = 0x0100012a,
Fkey_copy = 0x100012b, Fkey_copy = 0x0100012b,
Fkey_create = 0x100012c, Fkey_create = 0x0100012c,
Fkey_end = 0x100012d, Fkey_end = 0x0100012d,
Fkey_enter = 0x100012e, Fkey_enter = 0x0100012e,
Fkey_exit = 0x100012f, Fkey_exit = 0x0100012f,
Fkey_find = 0x1000130, Fkey_find = 0x01000130,
Fkey_help = 0x1000131, Fkey_help = 0x01000131,
Fkey_mark = 0x1000132, Fkey_mark = 0x01000132,
Fkey_message = 0x1000133, Fkey_message = 0x01000133,
Fkey_move = 0x1000134, Fkey_move = 0x01000134,
Fkey_next = 0x1000135, Fkey_next = 0x01000135,
Fkey_open = 0x1000136, Fkey_open = 0x01000136,
Fkey_options = 0x1000137, Fkey_options = 0x01000137,
Fkey_previous = 0x1000138, Fkey_previous = 0x01000138,
Fkey_print = 0x1000139, Fkey_print = 0x01000139,
Fkey_redo = 0x100013a, Fkey_redo = 0x0100013a,
Fkey_reference = 0x100013b, Fkey_reference = 0x0100013b,
Fkey_refresh = 0x100013c, Fkey_refresh = 0x0100013c,
Fkey_replace = 0x100013d, Fkey_replace = 0x0100013d,
Fkey_restart = 0x100013e, Fkey_restart = 0x0100013e,
Fkey_resume = 0x100013f, Fkey_resume = 0x0100013f,
Fkey_save = 0x1000140, Fkey_save = 0x01000140,
Fkey_suspend = 0x1000141, Fkey_suspend = 0x01000141,
Fkey_undo = 0x1000142, Fkey_undo = 0x01000142,
Fkey_sbeg = 0x1000143, Fkey_sbeg = 0x01000143,
Fkey_scancel = 0x1000144, Fkey_scancel = 0x01000144,
Fkey_scommand = 0x1000145, Fkey_scommand = 0x01000145,
Fkey_scopy = 0x1000146, Fkey_scopy = 0x01000146,
Fkey_screate = 0x1000147, Fkey_screate = 0x01000147,
Fkey_sdc = 0x1000148, Fkey_sdc = 0x01000148,
Fkey_sdl = 0x1000149, Fkey_sdl = 0x01000149,
Fkey_select = 0x100014a, Fkey_select = 0x0100014a,
Fkey_send = 0x100014b, Fkey_send = 0x0100014b,
Fkey_seol = 0x100014c, Fkey_seol = 0x0100014c,
Fkey_sexit = 0x100014d, Fkey_sexit = 0x0100014d,
Fkey_sfind = 0x100014e, Fkey_sfind = 0x0100014e,
Fkey_shelp = 0x100014f, Fkey_shelp = 0x0100014f,
Fkey_shome = 0x1000150, Fkey_shome = 0x01000150,
Fkey_sic = 0x1000151, Fkey_sic = 0x01000151,
Fkey_sleft = 0x1000152, Fkey_sleft = 0x01000152,
Fkey_smessage = 0x1000153, Fkey_smessage = 0x01000153,
Fkey_smove = 0x1000154, Fkey_smove = 0x01000154,
Fkey_snext = 0x1000155, Fkey_snext = 0x01000155,
Fkey_soptions = 0x1000156, Fkey_soptions = 0x01000156,
Fkey_sprevious = 0x1000157, Fkey_sprevious = 0x01000157,
Fkey_sprint = 0x1000158, Fkey_sprint = 0x01000158,
Fkey_sredo = 0x1000159, Fkey_sredo = 0x01000159,
Fkey_sreplace = 0x100015a, Fkey_sreplace = 0x0100015a,
Fkey_sright = 0x100015b, Fkey_sright = 0x0100015b,
Fkey_srsume = 0x100015c, Fkey_srsume = 0x0100015c,
Fkey_ssave = 0x100015d, Fkey_ssave = 0x0100015d,
Fkey_ssuspend = 0x100015e, Fkey_ssuspend = 0x0100015e,
Fkey_sundo = 0x100015f, Fkey_sundo = 0x0100015f,
Fkey_f11 = 0x1000160, Fkey_f11 = 0x01000160,
Fkey_f12 = 0x1000161, Fkey_f12 = 0x01000161,
Fkey_f13 = 0x1000162, Fkey_f13 = 0x01000162,
Fkey_f14 = 0x1000163, Fkey_f14 = 0x01000163,
Fkey_f15 = 0x1000164, Fkey_f15 = 0x01000164,
Fkey_f16 = 0x1000165, Fkey_f16 = 0x01000165,
Fkey_f17 = 0x1000166, Fkey_f17 = 0x01000166,
Fkey_f18 = 0x1000167, Fkey_f18 = 0x01000167,
Fkey_f19 = 0x1000168, Fkey_f19 = 0x01000168,
Fkey_f20 = 0x1000169, Fkey_f20 = 0x01000169,
Fkey_f21 = 0x100016a, Fkey_f21 = 0x0100016a,
Fkey_f22 = 0x100016b, Fkey_f22 = 0x0100016b,
Fkey_f23 = 0x100016c, Fkey_f23 = 0x0100016c,
Fkey_f24 = 0x100016d, Fkey_f24 = 0x0100016d,
Fkey_f25 = 0x100016e, Fkey_f25 = 0x0100016e,
Fkey_f26 = 0x100016f, Fkey_f26 = 0x0100016f,
Fkey_f27 = 0x1000170, Fkey_f27 = 0x01000170,
Fkey_f28 = 0x1000171, Fkey_f28 = 0x01000171,
Fkey_f29 = 0x1000172, Fkey_f29 = 0x01000172,
Fkey_f30 = 0x1000173, Fkey_f30 = 0x01000173,
Fkey_f31 = 0x1000174, Fkey_f31 = 0x01000174,
Fkey_f32 = 0x1000175, Fkey_f32 = 0x01000175,
Fkey_f33 = 0x1000176, Fkey_f33 = 0x01000176,
Fkey_f34 = 0x1000177, Fkey_f34 = 0x01000177,
Fkey_f35 = 0x1000178, Fkey_f35 = 0x01000178,
Fkey_f36 = 0x1000179, Fkey_f36 = 0x01000179,
Fkey_f37 = 0x100017a, Fkey_f37 = 0x0100017a,
Fkey_f38 = 0x100017b, Fkey_f38 = 0x0100017b,
Fkey_f39 = 0x100017c, Fkey_f39 = 0x0100017c,
Fkey_f40 = 0x100017d, Fkey_f40 = 0x0100017d,
Fkey_f41 = 0x100017e, Fkey_f41 = 0x0100017e,
Fkey_f42 = 0x100017f, Fkey_f42 = 0x0100017f,
Fkey_f43 = 0x1000180, Fkey_f43 = 0x01000180,
Fkey_f44 = 0x1000181, Fkey_f44 = 0x01000181,
Fkey_f45 = 0x1000182, Fkey_f45 = 0x01000182,
Fkey_f46 = 0x1000183, Fkey_f46 = 0x01000183,
Fkey_f47 = 0x1000184, Fkey_f47 = 0x01000184,
Fkey_f48 = 0x1000185, Fkey_f48 = 0x01000185,
Fkey_f49 = 0x1000186, Fkey_f49 = 0x01000186,
Fkey_f50 = 0x1000187, Fkey_f50 = 0x01000187,
Fkey_f51 = 0x1000188, Fkey_f51 = 0x01000188,
Fkey_f52 = 0x1000189, Fkey_f52 = 0x01000189,
Fkey_f53 = 0x100018a, Fkey_f53 = 0x0100018a,
Fkey_f54 = 0x100018b, Fkey_f54 = 0x0100018b,
Fkey_f55 = 0x100018c, Fkey_f55 = 0x0100018c,
Fkey_f56 = 0x100018d, Fkey_f56 = 0x0100018d,
Fkey_f57 = 0x100018e, Fkey_f57 = 0x0100018e,
Fkey_f58 = 0x100018f, Fkey_f58 = 0x0100018f,
Fkey_f59 = 0x1000190, Fkey_f59 = 0x01000190,
Fkey_f60 = 0x1000191, Fkey_f60 = 0x01000191,
Fkey_f61 = 0x1000192, Fkey_f61 = 0x01000192,
Fkey_f62 = 0x1000193, Fkey_f62 = 0x01000193,
Fkey_f63 = 0x1000194 Fkey_f63 = 0x01000194,
need_more_data = 0x80000000
}; };
// Keyboard - modifier key combinations // Keyboard - modifier key combinations
enum metakeys enum metakeys
{ {
Fmkey_ic = 0x1500100, // M-insert Fmkey_ic = 0x01500100, // M-insert
Fmkey_dc = 0x1500101, // M-delete Fmkey_dc = 0x01500101, // M-delete
Fmkey_home = 0x1500102, // M-home Fmkey_home = 0x01500102, // M-home
Fmkey_end = 0x1500103, // M-end Fmkey_end = 0x01500103, // M-end
Fmkey_ppage = 0x1500104, // M-prev-page Fmkey_ppage = 0x01500104, // M-prev-page
Fmkey_npage = 0x1500105, // M-next-page Fmkey_npage = 0x01500105, // M-next-page
Fmkey_f1 = 0x1500106, // M-f1 Fmkey_f1 = 0x01500106, // M-f1
Fmkey_f2 = 0x1500107, // M-f2 Fmkey_f2 = 0x01500107, // M-f2
Fmkey_f3 = 0x1500108, // M-f3 Fmkey_f3 = 0x01500108, // M-f3
Fmkey_f4 = 0x1500109, // M-f4 Fmkey_f4 = 0x01500109, // M-f4
Fmkey_f5 = 0x150010a, // M-f5 Fmkey_f5 = 0x0150010a, // M-f5
Fmkey_f6 = 0x150010b, // M-F6 Fmkey_f6 = 0x0150010b, // M-F6
Fmkey_f7 = 0x150010c, // M-f7 Fmkey_f7 = 0x0150010c, // M-f7
Fmkey_f8 = 0x150010d, // M-f8 Fmkey_f8 = 0x0150010d, // M-f8
Fmkey_f9 = 0x150010e, // M-f9 Fmkey_f9 = 0x0150010e, // M-f9
Fmkey_f10 = 0x150010f, // M-f10 Fmkey_f10 = 0x0150010f, // M-f10
Fmkey_f11 = 0x1500110, // M-f11 Fmkey_f11 = 0x01500110, // M-f11
Fmkey_f12 = 0x1500111, // M-f12 Fmkey_f12 = 0x01500111, // M-f12
Fmkey_up = 0x1500112, // M-up Fmkey_up = 0x01500112, // M-up
Fmkey_down = 0x1500113, // M-down Fmkey_down = 0x01500113, // M-down
Fmkey_right = 0x1500114, // M-right Fmkey_right = 0x01500114, // M-right
Fmkey_left = 0x1500115, // M-left Fmkey_left = 0x01500115, // M-left
Fmkey_sic = 0x1500116, // shifted M-Insert Fmkey_sic = 0x01500116, // shifted M-Insert
Fmkey_sdc = 0x1500117, // shifted M-Delete Fmkey_sdc = 0x01500117, // shifted M-Delete
Fmkey_shome = 0x1500118, // shifted M-Home Fmkey_shome = 0x01500118, // shifted M-Home
Fmkey_send = 0x1500119, // shifted M-End Fmkey_send = 0x01500119, // shifted M-End
Fmkey_sppage = 0x150011a, // shifted M-Page_Up Fmkey_sppage = 0x0150011a, // shifted M-Page_Up
Fmkey_snpage = 0x150011b, // shifted M-Page_Down Fmkey_snpage = 0x0150011b, // shifted M-Page_Down
Fmkey_sf1 = 0x150011c, // shifted M-F1 Fmkey_sf1 = 0x0150011c, // shifted M-F1
Fmkey_sf2 = 0x150011d, // shifted M-F2 Fmkey_sf2 = 0x0150011d, // shifted M-F2
Fmkey_sf3 = 0x150011e, // shifted M-F3 Fmkey_sf3 = 0x0150011e, // shifted M-F3
Fmkey_sf4 = 0x150011f, // shifted M-F4 Fmkey_sf4 = 0x0150011f, // shifted M-F4
Fmkey_sf5 = 0x1500120, // shifted M-F5 Fmkey_sf5 = 0x01500120, // shifted M-F5
Fmkey_sf6 = 0x1500121, // shifted M-F6 Fmkey_sf6 = 0x01500121, // shifted M-F6
Fmkey_sf7 = 0x1500122, // shifted M-F7 Fmkey_sf7 = 0x01500122, // shifted M-F7
Fmkey_sf8 = 0x1500123, // shifted M-F8 Fmkey_sf8 = 0x01500123, // shifted M-F8
Fmkey_sf9 = 0x1500124, // shifted M-F9 Fmkey_sf9 = 0x01500124, // shifted M-F9
Fmkey_sf10 = 0x1500125, // shifted M-F10 Fmkey_sf10 = 0x01500125, // shifted M-F10
Fmkey_sf11 = 0x1500126, // shifted M-F11 Fmkey_sf11 = 0x01500126, // shifted M-F11
Fmkey_sf12 = 0x1500127, // shifted M-F12 Fmkey_sf12 = 0x01500127, // shifted M-F12
Fmkey_sup = 0x1500128, // shifted M-Up Fmkey_sup = 0x01500128, // shifted M-Up
Fmkey_sdown = 0x1500129, // shifted M-Down Fmkey_sdown = 0x01500129, // shifted M-Down
Fmkey_sright = 0x150012a, // shifted M-Right Fmkey_sright = 0x0150012a, // shifted M-Right
Fmkey_sleft = 0x150012b, // shifted M-Left Fmkey_sleft = 0x0150012b, // shifted M-Left
Fckey_ic = 0x150012c, // control-Insert Fckey_ic = 0x0150012c, // control-Insert
Fckey_dc = 0x150012d, // control-Delete Fckey_dc = 0x0150012d, // control-Delete
Fckey_home = 0x150012e, // control-Home Fckey_home = 0x0150012e, // control-Home
Fckey_end = 0x150012f, // control-End Fckey_end = 0x0150012f, // control-End
Fckey_ppage = 0x1500130, // control-Page_Up Fckey_ppage = 0x01500130, // control-Page_Up
Fckey_npage = 0x1500131, // control-Page_Down Fckey_npage = 0x01500131, // control-Page_Down
Fckey_up = 0x1500132, // control-Up Fckey_up = 0x01500132, // control-Up
Fckey_down = 0x1500133, // control-Down Fckey_down = 0x01500133, // control-Down
Fckey_right = 0x1500134, // control-Right Fckey_right = 0x01500134, // control-Right
Fckey_left = 0x1500135, // control-Left Fckey_left = 0x01500135, // control-Left
Fckey_sic = 0x1500136, // shifted control-M-Insert Fckey_sic = 0x01500136, // shifted control-M-Insert
Fckey_sdc = 0x1500137, // shifted control-M-Delete Fckey_sdc = 0x01500137, // shifted control-M-Delete
Fckey_shome = 0x1500138, // shifted control-M-Home Fckey_shome = 0x01500138, // shifted control-M-Home
Fckey_send = 0x1500139, // shifted control-M-End Fckey_send = 0x01500139, // shifted control-M-End
Fckey_sppage = 0x150013a, // shifted control-M-Page_Up Fckey_sppage = 0x0150013a, // shifted control-M-Page_Up
Fckey_snpage = 0x150013b, // shifted control-M-Page_Down Fckey_snpage = 0x0150013b, // shifted control-M-Page_Down
Fckey_sup = 0x150013c, // shifted control-M-Up Fckey_sup = 0x0150013c, // shifted control-M-Up
Fckey_sdown = 0x150013d, // shifted control-M-Down Fckey_sdown = 0x0150013d, // shifted control-M-Down
Fckey_sright = 0x150013e, // shifted control-M-Right Fckey_sright = 0x0150013e, // shifted control-M-Right
Fckey_sleft = 0x150013f, // shifted control-M-Left Fckey_sleft = 0x0150013f, // shifted control-M-Left
Fcmkey_ic = 0x1500140, // control-M-Insert Fcmkey_ic = 0x01500140, // control-M-Insert
Fcmkey_dc = 0x1500141, // control-M-Delete Fcmkey_dc = 0x01500141, // control-M-Delete
Fcmkey_home = 0x1500142, // control-M-Home Fcmkey_home = 0x01500142, // control-M-Home
Fcmkey_end = 0x1500143, // control-M-End Fcmkey_end = 0x01500143, // control-M-End
Fcmkey_ppage = 0x1500144, // control-M-Page_Up Fcmkey_ppage = 0x01500144, // control-M-Page_Up
Fcmkey_npage = 0x1500145, // control-M-Page_Down Fcmkey_npage = 0x01500145, // control-M-Page_Down
Fcmkey_up = 0x1500146, // control-M-Up Fcmkey_up = 0x01500146, // control-M-Up
Fcmkey_down = 0x1500147, // control-M-Down Fcmkey_down = 0x01500147, // control-M-Down
Fcmkey_right = 0x1500148, // control-M-Right Fcmkey_right = 0x01500148, // control-M-Right
Fcmkey_left = 0x1500149, // control-M-Left Fcmkey_left = 0x01500149, // control-M-Left
Fcmkey_sic = 0x150014a, // shifted control-M-Insert Fcmkey_sic = 0x0150014a, // shifted control-M-Insert
Fcmkey_sdc = 0x150014b, // shifted control-M-Delete Fcmkey_sdc = 0x0150014b, // shifted control-M-Delete
Fcmkey_shome = 0x150014c, // shifted control-M-Home Fcmkey_shome = 0x0150014c, // shifted control-M-Home
Fcmkey_send = 0x150014d, // shifted control-M-End Fcmkey_send = 0x0150014d, // shifted control-M-End
Fcmkey_sppage = 0x150014e, // shifted control-M-Page_Up Fcmkey_sppage = 0x0150014e, // shifted control-M-Page_Up
Fcmkey_snpage = 0x150014f, // shifted control-M-Page_Down Fcmkey_snpage = 0x0150014f, // shifted control-M-Page_Down
Fcmkey_sf1 = 0x1500150, // shifted control-M-F1 Fcmkey_sf1 = 0x01500150, // shifted control-M-F1
Fcmkey_sf2 = 0x1500151, // shifted control-M-F2 Fcmkey_sf2 = 0x01500151, // shifted control-M-F2
Fcmkey_sf3 = 0x1500152, // shifted control-M-F3 Fcmkey_sf3 = 0x01500152, // shifted control-M-F3
Fcmkey_sf4 = 0x1500153, // shifted control-M-F4 Fcmkey_sf4 = 0x01500153, // shifted control-M-F4
Fcmkey_sf5 = 0x1500154, // shifted control-M-F5 Fcmkey_sf5 = 0x01500154, // shifted control-M-F5
Fcmkey_sf6 = 0x1500155, // shifted control-M-F6 Fcmkey_sf6 = 0x01500155, // shifted control-M-F6
Fcmkey_sf7 = 0x1500156, // shifted control-M-F7 Fcmkey_sf7 = 0x01500156, // shifted control-M-F7
Fcmkey_sf8 = 0x1500157, // shifted control-M-F8 Fcmkey_sf8 = 0x01500157, // shifted control-M-F8
Fcmkey_sf9 = 0x1500158, // shifted control-M-F9 Fcmkey_sf9 = 0x01500158, // shifted control-M-F9
Fcmkey_sf10 = 0x1500159, // shifted control-M-F10 Fcmkey_sf10 = 0x01500159, // shifted control-M-F10
Fcmkey_sf11 = 0x150015a, // shifted control-M-F11 Fcmkey_sf11 = 0x0150015a, // shifted control-M-F11
Fcmkey_sf12 = 0x150015b, // shifted control-M-F12 Fcmkey_sf12 = 0x0150015b, // shifted control-M-F12
Fcmkey_sup = 0x150015c, // shifted control-M-Up Fcmkey_sup = 0x0150015c, // shifted control-M-Up
Fcmkey_sdown = 0x150015d, // shifted control-M-Down Fcmkey_sdown = 0x0150015d, // shifted control-M-Down
Fcmkey_sright = 0x150015e, // shifted control-M-Right Fcmkey_sright = 0x0150015e, // shifted control-M-Right
Fcmkey_sleft = 0x150015f, // shifted control-M-Left Fcmkey_sleft = 0x0150015f, // shifted control-M-Left
Fkey_menu = 0x1600000, // menu Fkey_menu = 0x01600000, // menu
Fkey_smenu = 0x1600001, // shifted menu Fkey_smenu = 0x01600001, // shifted menu
Fckey_menu = 0x1600002, // control-menu Fckey_menu = 0x01600002, // control-menu
Fckey_smenu = 0x1600003, // shifted control-menu Fckey_smenu = 0x01600003, // shifted control-menu
Fmkey_menu = 0x1600004, // M-menu Fmkey_menu = 0x01600004, // M-menu
Fmkey_smenu = 0x1600005, // shifted M-menu Fmkey_smenu = 0x01600005, // shifted M-menu
Fcmkey_menu = 0x1600006, // control-M-menu Fcmkey_menu = 0x01600006, // control-M-menu
Fcmkey_smenu = 0x1600007, // shifted control-M-menu Fcmkey_smenu = 0x01600007, // shifted control-M-menu
Fkey_escape_mintty = 0x200001b, // mintty Esc Fkey_escape_mintty = 0x0200001b, // mintty Esc
Fkey_mouse = 0x2000020, // xterm mouse Fkey_mouse = 0x02000020, // xterm mouse
Fkey_extended_mouse = 0x2000021, // SGR extended mouse Fkey_extended_mouse = 0x02000021, // SGR extended mouse
Fkey_urxvt_mouse = 0x2000022, // urxvt mouse extension Fkey_urxvt_mouse = 0x02000022, // urxvt mouse extension
Fmkey_meta = 0x20000e0, // meta key offset Fmkey_meta = 0x020000e0, // meta key offset
Fmkey_tab = 0x20000e9, // M-tab Fmkey_tab = 0x020000e9, // M-tab
Fmkey_enter = 0x20000ea, // M-enter Fmkey_enter = 0x020000ea, // M-enter
Fmkey_space = 0x2000100, // M-' ' Fmkey_space = 0x02000100, // M-' '
Fmkey_bang = 0x2000101, // M-! Fmkey_bang = 0x02000101, // M-!
Fmkey_quotes = 0x2000102, // M-" Fmkey_quotes = 0x02000102, // M-"
Fmkey_hash = 0x2000103, // M-# Fmkey_hash = 0x02000103, // M-#
Fmkey_dollar = 0x2000104, // M-$ Fmkey_dollar = 0x02000104, // M-$
Fmkey_percent = 0x2000105, // M-% Fmkey_percent = 0x02000105, // M-%
Fmkey_ampersand = 0x2000106, // M-& Fmkey_ampersand = 0x02000106, // M-&
Fmkey_apostrophe = 0x2000107, // M-' Fmkey_apostrophe = 0x02000107, // M-'
Fmkey_left_parenthesis = 0x2000108, // M-( Fmkey_left_parenthesis = 0x02000108, // M-(
Fmkey_right_parenthesis = 0x2000109, // M-) Fmkey_right_parenthesis = 0x02000109, // M-)
Fmkey_asterisk = 0x200010a, // M-* Fmkey_asterisk = 0x0200010a, // M-*
Fmkey_plus = 0x200010b, // M-+ Fmkey_plus = 0x0200010b, // M-+
Fmkey_comma = 0x200010c, // M-, Fmkey_comma = 0x0200010c, // M-,
Fmkey_minus = 0x200010d, // M-'-' Fmkey_minus = 0x0200010d, // M-'-'
Fmkey_full_stop = 0x200010e, // M-. Fmkey_full_stop = 0x0200010e, // M-.
Fmkey_slash = 0x200010f, // M-/ Fmkey_slash = 0x0200010f, // M-/
Fmkey_0 = 0x2000110, // M-0 Fmkey_0 = 0x02000110, // M-0
Fmkey_1 = 0x2000111, // M-1 Fmkey_1 = 0x02000111, // M-1
Fmkey_2 = 0x2000112, // M-2 Fmkey_2 = 0x02000112, // M-2
Fmkey_3 = 0x2000113, // M-3 Fmkey_3 = 0x02000113, // M-3
Fmkey_4 = 0x2000114, // M-4 Fmkey_4 = 0x02000114, // M-4
Fmkey_5 = 0x2000115, // M-5 Fmkey_5 = 0x02000115, // M-5
Fmkey_6 = 0x2000116, // M-6 Fmkey_6 = 0x02000116, // M-6
Fmkey_7 = 0x2000117, // M-7 Fmkey_7 = 0x02000117, // M-7
Fmkey_8 = 0x2000118, // M-8 Fmkey_8 = 0x02000118, // M-8
Fmkey_9 = 0x2000119, // M-9 Fmkey_9 = 0x02000119, // M-9
Fmkey_colon = 0x200011a, // M-: Fmkey_colon = 0x0200011a, // M-:
Fmkey_semicolon = 0x200011b, // M-; Fmkey_semicolon = 0x0200011b, // M-;
Fmkey_less_than = 0x200011c, // M-< Fmkey_less_than = 0x0200011c, // M-<
Fmkey_equals = 0x200011d, // M-= Fmkey_equals = 0x0200011d, // M-=
Fmkey_greater_than = 0x200011e, // M-> Fmkey_greater_than = 0x0200011e, // M->
Fmkey_question_mark = 0x200011f, // M-? Fmkey_question_mark = 0x0200011f, // M-?
Fmkey_at = 0x2000120, // M-@ Fmkey_at = 0x02000120, // M-@
Fmkey_A = 0x2000121, // M-A Fmkey_A = 0x02000121, // M-A
Fmkey_B = 0x2000122, // M-B Fmkey_B = 0x02000122, // M-B
Fmkey_C = 0x2000123, // M-C Fmkey_C = 0x02000123, // M-C
Fmkey_D = 0x2000124, // M-D Fmkey_D = 0x02000124, // M-D
Fmkey_E = 0x2000125, // M-E Fmkey_E = 0x02000125, // M-E
Fmkey_F = 0x2000126, // M-F Fmkey_F = 0x02000126, // M-F
Fmkey_G = 0x2000127, // M-G Fmkey_G = 0x02000127, // M-G
Fmkey_H = 0x2000128, // M-H Fmkey_H = 0x02000128, // M-H
Fmkey_I = 0x2000129, // M-I Fmkey_I = 0x02000129, // M-I
Fmkey_J = 0x200012a, // M-J Fmkey_J = 0x0200012a, // M-J
Fmkey_K = 0x200012b, // M-K Fmkey_K = 0x0200012b, // M-K
Fmkey_L = 0x200012c, // M-L Fmkey_L = 0x0200012c, // M-L
Fmkey_M = 0x200012d, // M-M Fmkey_M = 0x0200012d, // M-M
Fmkey_N = 0x200012e, // M-N Fmkey_N = 0x0200012e, // M-N
Fmkey_O = 0x200012f, // M-O Fmkey_O = 0x0200012f, // M-O
Fmkey_P = 0x2000130, // M-P Fmkey_P = 0x02000130, // M-P
Fmkey_Q = 0x2000131, // M-Q Fmkey_Q = 0x02000131, // M-Q
Fmkey_R = 0x2000132, // M-R Fmkey_R = 0x02000132, // M-R
Fmkey_S = 0x2000133, // M-S Fmkey_S = 0x02000133, // M-S
Fmkey_T = 0x2000134, // M-T Fmkey_T = 0x02000134, // M-T
Fmkey_U = 0x2000135, // M-U Fmkey_U = 0x02000135, // M-U
Fmkey_V = 0x2000136, // M-V Fmkey_V = 0x02000136, // M-V
Fmkey_W = 0x2000137, // M-W Fmkey_W = 0x02000137, // M-W
Fmkey_X = 0x2000138, // M-X Fmkey_X = 0x02000138, // M-X
Fmkey_Y = 0x2000139, // M-Y Fmkey_Y = 0x02000139, // M-Y
Fmkey_Z = 0x200013a, // M-Z Fmkey_Z = 0x0200013a, // M-Z
Fmkey_left_square_bracket = 0x200013b, // M-[ Fmkey_left_square_bracket = 0x0200013b, // M-[
Fmkey_backslash = 0x200013c, // M-'\' Fmkey_backslash = 0x0200013c, // M-'\'
Fmkey_right_square_bracket = 0x200013d, // M-] Fmkey_right_square_bracket = 0x0200013d, // M-]
Fmkey_caret = 0x200013e, // M-^ Fmkey_caret = 0x0200013e, // M-^
Fmkey_underscore = 0x200013f, // M-_ Fmkey_underscore = 0x0200013f, // M-_
Fmkey_grave_accent = 0x2000140, // M-` Fmkey_grave_accent = 0x02000140, // M-`
Fmkey_a = 0x2000141, // M-a Fmkey_a = 0x02000141, // M-a
Fmkey_b = 0x2000142, // M-b Fmkey_b = 0x02000142, // M-b
Fmkey_c = 0x2000143, // M-c Fmkey_c = 0x02000143, // M-c
Fmkey_d = 0x2000144, // M-d Fmkey_d = 0x02000144, // M-d
Fmkey_e = 0x2000145, // M-e Fmkey_e = 0x02000145, // M-e
Fmkey_f = 0x2000146, // M-f Fmkey_f = 0x02000146, // M-f
Fmkey_g = 0x2000147, // M-g Fmkey_g = 0x02000147, // M-g
Fmkey_h = 0x2000148, // M-h Fmkey_h = 0x02000148, // M-h
Fmkey_i = 0x2000149, // M-i Fmkey_i = 0x02000149, // M-i
Fmkey_j = 0x200014a, // M-j Fmkey_j = 0x0200014a, // M-j
Fmkey_k = 0x200014b, // M-k Fmkey_k = 0x0200014b, // M-k
Fmkey_l = 0x200014c, // M-l Fmkey_l = 0x0200014c, // M-l
Fmkey_m = 0x200014d, // M-m Fmkey_m = 0x0200014d, // M-m
Fmkey_n = 0x200014e, // M-n Fmkey_n = 0x0200014e, // M-n
Fmkey_o = 0x200014f, // M-o Fmkey_o = 0x0200014f, // M-o
Fmkey_p = 0x2000150, // M-p Fmkey_p = 0x02000150, // M-p
Fmkey_q = 0x2000151, // M-q Fmkey_q = 0x02000151, // M-q
Fmkey_r = 0x2000152, // M-r Fmkey_r = 0x02000152, // M-r
Fmkey_s = 0x2000153, // M-s Fmkey_s = 0x02000153, // M-s
Fmkey_t = 0x2000154, // M-t Fmkey_t = 0x02000154, // M-t
Fmkey_u = 0x2000155, // M-u Fmkey_u = 0x02000155, // M-u
Fmkey_v = 0x2000156, // M-v Fmkey_v = 0x02000156, // M-v
Fmkey_w = 0x2000157, // M-w Fmkey_w = 0x02000157, // M-w
Fmkey_x = 0x2000158, // M-x Fmkey_x = 0x02000158, // M-x
Fmkey_y = 0x2000159, // M-y Fmkey_y = 0x02000159, // M-y
Fmkey_z = 0x200015a, // M-z Fmkey_z = 0x0200015a, // M-z
Fmkey_left_curly_bracket = 0x200015b, // M-{ Fmkey_left_curly_bracket = 0x0200015b, // M-{
Fmkey_vertical_bar = 0x200015c, // M-| Fmkey_vertical_bar = 0x0200015c, // M-|
Fmkey_right_curly_bracket = 0x200015d, // M-} Fmkey_right_curly_bracket = 0x0200015d, // M-}
Fmkey_tilde = 0x200015e // M-~ Fmkey_tilde = 0x0200015e // M-~
}; };
// Console color names // Console color names

View File

@ -113,16 +113,16 @@ class FEvent // event base class
class FKeyEvent : public FEvent // keyboard event class FKeyEvent : public FEvent // keyboard event
{ {
public: public:
FKeyEvent (int, int); FKeyEvent (int, FKey);
~FKeyEvent(); ~FKeyEvent();
int key() const; FKey key() const;
bool isAccepted() const; bool isAccepted() const;
void accept(); void accept();
void ignore(); void ignore();
protected: protected:
int k; FKey k;
bool accpt; bool accpt;
}; };

View File

@ -97,8 +97,8 @@ class FKeyboard
// Accessors // Accessors
virtual const char* getClassName() const; virtual const char* getClassName() const;
int getKey(); FKey getKey();
const FString getKeyName (int); const FString getKeyName (FKey);
keybuffer& getKeyBuffer(); keybuffer& getKeyBuffer();
timeval* getKeyPressedTime(); timeval* getKeyPressedTime();
@ -131,8 +131,8 @@ class FKeyboard
private: private:
// Constants // Constants
static const int NEED_MORE_DATA = -1;
static const std::size_t READ_BUF_SIZE = 1024; static const std::size_t READ_BUF_SIZE = 1024;
static const FKey NOT_SET = static_cast<FKey>(-1);
// Disable copy constructor // Disable copy constructor
FKeyboard (const FKeyboard&); FKeyboard (const FKeyboard&);
@ -141,10 +141,10 @@ class FKeyboard
FKeyboard& operator = (const FKeyboard&); FKeyboard& operator = (const FKeyboard&);
// Accessors // Accessors
int getMouseProtocolKey(); FKey getMouseProtocolKey();
int getTermcapKey(); FKey getTermcapKey();
int getMetaKey(); FKey getMetaKey();
int getSingleKey(); FKey getSingleKey();
// Mutators // Mutators
bool setNonBlockingInput (bool); bool setNonBlockingInput (bool);
@ -155,18 +155,18 @@ class FKeyboard
static bool isKeypressTimeout(); static bool isKeypressTimeout();
// Methods // Methods
int UTF8decode (const char[]); FKey UTF8decode (const char[]);
ssize_t readKey(); ssize_t readKey();
void parseKeyBuffer(); void parseKeyBuffer();
int parseKeyString(); FKey parseKeyString();
int keyCorrection (const int&); FKey keyCorrection (const FKey&);
void substringKeyHandling(); void substringKeyHandling();
void keyPressed(); void keyPressed();
void keyReleased(); void keyReleased();
void escapeKeyPressed(); void escapeKeyPressed();
// Data Members // Data Members
int key; FKey key;
char read_buf[READ_BUF_SIZE]; char read_buf[READ_BUF_SIZE];
char fifo_buf[FIFO_BUF_SIZE]; char fifo_buf[FIFO_BUF_SIZE];
int fifo_offset; int fifo_offset;
@ -197,7 +197,7 @@ inline const char* FKeyboard::getClassName() const
{ return "FKeyboard"; } { return "FKeyboard"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FKeyboard::getKey() inline FKey FKeyboard::getKey()
{ return key; } { return key; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -165,7 +165,7 @@ class FLineEdit : public FWidget
void keyBackspace(); void keyBackspace();
void keyInsert(); void keyInsert();
void keyEnter(); void keyEnter();
bool keyInput (int); bool keyInput (FKey);
void processActivate(); void processActivate();
void processChanged(); void processChanged();

View File

@ -285,7 +285,7 @@ class FListBox : public FWidget
bool keySpace(); bool keySpace();
bool keyInsert(); bool keyInsert();
bool keyBackspace(); bool keyBackspace();
bool keyIncSearchInput (int); bool keyIncSearchInput (FKey);
void processClick(); void processClick();
void processSelect(); void processSelect();
void processChanged(); void processChanged();

View File

@ -210,7 +210,7 @@ class FMenu : public FWindow, public FMenuList
void drawCheckMarkPrefix (FMenuItem*); void drawCheckMarkPrefix (FMenuItem*);
void drawMenuText (menuText&); void drawMenuText (menuText&);
void drawSubMenuIndicator (std::size_t&); void drawSubMenuIndicator (std::size_t&);
void drawAcceleratorKey (std::size_t&, int); void drawAcceleratorKey (std::size_t&, FKey);
void drawTrailingSpaces (std::size_t); void drawTrailingSpaces (std::size_t);
void setLineAttributes (FMenuItem*, int); void setLineAttributes (FMenuItem*, int);
void setCursorToHotkeyPosition (FMenuItem*); void setCursorToHotkeyPosition (FMenuItem*);

View File

@ -84,14 +84,14 @@ class FMenuItem : public FWidget
// Constructor // Constructor
explicit FMenuItem (FWidget* = 0); explicit FMenuItem (FWidget* = 0);
explicit FMenuItem (const FString&, FWidget* = 0); explicit FMenuItem (const FString&, FWidget* = 0);
FMenuItem (int, const FString&, FWidget* = 0); FMenuItem (FKey, const FString&, FWidget* = 0);
// Destructor // Destructor
virtual ~FMenuItem(); virtual ~FMenuItem();
// Accessors // Accessors
const char* getClassName() const; const char* getClassName() const;
int getHotkey() const; uChar getHotkey() const;
FMenu* getMenu() const; FMenu* getMenu() const;
std::size_t getTextLength() const; std::size_t getTextLength() const;
FString getText() const; FString getText() const;
@ -118,7 +118,7 @@ class FMenuItem : public FWidget
bool hasMenu() const; bool hasMenu() const;
// Methods // Methods
virtual void addAccelerator (int, FWidget*); virtual void addAccelerator (FKey, FWidget*);
virtual void delAccelerator (FWidget*); virtual void delAccelerator (FWidget*);
void openMenu(); void openMenu();
@ -153,8 +153,8 @@ class FMenuItem : public FWidget
bool radio_button; bool radio_button;
bool dialog_index; bool dialog_index;
std::size_t text_length; std::size_t text_length;
int hotkey; uChar hotkey;
int accel_key; FKey accel_key;
FMenu* menu; FMenu* menu;
FWidget* super_menu; FWidget* super_menu;
FDialog* associated_window; FDialog* associated_window;
@ -199,7 +199,7 @@ inline const char* FMenuItem::getClassName() const
{ return "FMenuItem"; } { return "FMenuItem"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FMenuItem::getHotkey() const inline uChar FMenuItem::getHotkey() const
{ return hotkey; } { return hotkey; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -81,18 +81,18 @@ class FStatusKey : public FWidget
public: public:
// Constructors // Constructors
explicit FStatusKey (FWidget* = 0); explicit FStatusKey (FWidget* = 0);
FStatusKey (int, const FString&, FWidget* = 0); FStatusKey (FKey, const FString&, FWidget* = 0);
// Destructor // Destructor
virtual ~FStatusKey(); virtual ~FStatusKey();
// Accessors // Accessors
virtual const char* getClassName() const; virtual const char* getClassName() const;
virtual int getKey() const; virtual FKey getKey() const;
virtual FString getText() const; virtual FString getText() const;
// Mutators // Mutators
void setKey (int); void setKey (FKey);
void setText (const FString&); void setText (const FString&);
void setActive(); void setActive();
void unsetActive(); void unsetActive();
@ -124,7 +124,7 @@ class FStatusKey : public FWidget
friend class FStatusBar; friend class FStatusBar;
// Data Members // Data Members
int key; FKey key;
FString text; FString text;
bool active; bool active;
bool mouse_focus; bool mouse_focus;
@ -139,7 +139,7 @@ inline const char* FStatusKey::getClassName() const
{ return "FStatusKey"; } { return "FStatusKey"; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline int FStatusKey::getKey() const inline FKey FStatusKey::getKey() const
{ return key; } { return key; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -147,7 +147,7 @@ inline FString FStatusKey::getText() const
{ return text; } { return text; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FStatusKey::setKey (int k) inline void FStatusKey::setKey (FKey k)
{ key = k; } { key = k; }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -171,7 +171,7 @@ class FTerm
static FMouseControl* getMouseControl(); static FMouseControl* getMouseControl();
static std::size_t getLineNumber(); static std::size_t getLineNumber();
static std::size_t getColumnNumber(); static std::size_t getColumnNumber();
static const FString getKeyName (int); static const FString getKeyName (FKey);
static FOptiMove* getFOptiMove(); static FOptiMove* getFOptiMove();
static int getTTYFileDescriptor(); static int getTTYFileDescriptor();

View File

@ -66,6 +66,13 @@ class FTermDebugData
void setFTermData (FTermData*); void setFTermData (FTermData*);
private: private:
// Disable copy constructor
FTermDebugData (const FTermDebugData&);
// Disable assignment operator (=)
FTermDebugData& operator = (const FTermDebugData&);
// Data Members
FTermDetection* term_detection; FTermDetection* term_detection;
FTermData* data; FTermData* data;
}; };

View File

@ -105,7 +105,7 @@ class FTermLinux
static void setBeep (int, int); static void setBeep (int, int);
static void resetBeep(); static void resetBeep();
static char* restoreCursorStyle(); static char* restoreCursorStyle();
static int modifierKeyCorrection (const int&); static FKey modifierKeyCorrection (const FKey&);
private: private:
// Typedef // Typedef
@ -159,13 +159,13 @@ class FTermLinux
static bool saveVGAPalette(); static bool saveVGAPalette();
static bool resetVGAPalette(); static bool resetVGAPalette();
#endif // defined(__x86_64__) || defined(__i386) || defined(__arm__) #endif // defined(__x86_64__) || defined(__i386) || defined(__arm__)
static int shiftKeyCorrection (const int&); static FKey shiftKeyCorrection (const FKey&);
static int ctrlKeyCorrection (const int&); static FKey ctrlKeyCorrection (const FKey&);
static int altKeyCorrection (const int&); static FKey altKeyCorrection (const FKey&);
static int shiftCtrlKeyCorrection (const int&); static FKey shiftCtrlKeyCorrection (const FKey&);
static int shiftAltKeyCorrection (const int&); static FKey shiftAltKeyCorrection (const FKey&);
static int ctrlAltKeyCorrection (const int&); static FKey ctrlAltKeyCorrection (const FKey&);
static int shiftCtrlAltKeyCorrection (const int&); static FKey shiftCtrlAltKeyCorrection (const FKey&);
// Data Members // Data Members
#if defined(__linux__) #if defined(__linux__)

View File

@ -56,6 +56,7 @@ typedef int64_t sInt64;
typedef long double lDouble; typedef long double lDouble;
typedef uInt16 FColor; typedef uInt16 FColor;
typedef uInt32 FKey;
} // namespace } // namespace
@ -93,7 +94,7 @@ namespace fc
#pragma pack(1) #pragma pack(1)
typedef struct typedef struct
{ {
int num; FKey num;
char* string; char* string;
char tname[4]; char tname[4];
} }
@ -101,14 +102,14 @@ fkeymap;
typedef struct typedef struct
{ {
int num; FKey num;
char string[8]; char string[8];
} }
fmetakeymap; fmetakeymap;
typedef struct typedef struct
{ {
int num; FKey num;
char string[25]; char string[25];
} }
keyname; keyname;

View File

@ -138,7 +138,7 @@ class FVTerm
static int getTabstop(); static int getTabstop();
static fc::encoding getEncoding(); static fc::encoding getEncoding();
static std::string getEncodingString(); static std::string getEncodingString();
static const FString getKeyName (int); static const FString getKeyName (FKey);
static char* getTermType(); static char* getTermType();
static char* getTermFileName(); static char* getTermFileName();
FTerm& getFTerm(); FTerm& getFTerm();
@ -637,7 +637,7 @@ inline std::string FVTerm::getEncodingString()
{ return FTerm::getEncodingString(); } { return FTerm::getEncodingString(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FString FVTerm::getKeyName (int keynum) inline const FString FVTerm::getKeyName (FKey keynum)
{ return FTerm::getKeyName(keynum); } { return FTerm::getKeyName(keynum); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -132,7 +132,7 @@ class FWidget : public FVTerm, public FObject
struct accelerator struct accelerator
{ {
int key; FKey key;
FWidget* object; FWidget* object;
}; };
@ -310,8 +310,8 @@ class FWidget : public FVTerm, public FObject
void delCallback (FWidget*); void delCallback (FWidget*);
void delCallbacks(); void delCallbacks();
void emitCallback (const FString&); void emitCallback (const FString&);
void addAccelerator (int); void addAccelerator (FKey);
virtual void addAccelerator (int, FWidget*); virtual void addAccelerator (FKey, FWidget*);
void delAccelerator (); void delAccelerator ();
virtual void delAccelerator (FWidget*); virtual void delAccelerator (FWidget*);
virtual void redraw(); virtual void redraw();
@ -932,7 +932,7 @@ inline void FWidget::clearStatusbarMessage()
{ statusbar_message.clear(); } { statusbar_message.clear(); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FWidget::addAccelerator (int key) inline void FWidget::addAccelerator (FKey key)
{ addAccelerator (key, this); } { addAccelerator (key, this); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -275,9 +275,9 @@ class FKeyboardTest : public CPPUNIT_NS::TestFixture
void escapeKeyPressed(); void escapeKeyPressed();
// Data Members // Data Members
int key_pressed; FKey key_pressed;
int key_released; FKey key_released;
int number_of_keys; int number_of_keys;
finalcut::FKeyboard* keyboard; finalcut::FKeyboard* keyboard;
}; };
#pragma pack(pop) #pragma pack(pop)
@ -2754,10 +2754,10 @@ void FKeyboardTest::utf8Test()
CPPUNIT_ASSERT ( key_pressed == 0x0040 ); CPPUNIT_ASSERT ( key_pressed == 0x0040 );
// Invalid UTF-8 // Invalid UTF-8
key_pressed = -5; key_pressed = 0xffffffff;
input("\377"); input("\377");
processInput(); processInput();
CPPUNIT_ASSERT ( key_pressed == -5 ); CPPUNIT_ASSERT ( key_pressed == 0xffffffff );
// Without UTF-8 support // Without UTF-8 support
keyboard->disableUTF8(); keyboard->disableUTF8();