Small code improvements

This commit is contained in:
Markus Gans 2016-07-23 20:56:20 +02:00
parent 8b0ac17b63
commit 4cccc6527b
3 changed files with 21 additions and 22 deletions

View File

@ -434,7 +434,7 @@ void FApplication::processKeyboardEvent()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FApplication::modifierKeyCorrection (int& key) int FApplication::modifierKeyCorrection (int& key_id)
{ {
// get the current modifier key state // get the current modifier key state
getModifierKey(); getModifierKey();
@ -442,11 +442,11 @@ int FApplication::modifierKeyCorrection (int& key)
if ( ! m.shift && ! m.ctrl && ! m.alt ) if ( ! m.shift && ! m.ctrl && ! m.alt )
{ {
return key; return key_id;
} }
else if ( m.shift && ! m.ctrl && ! m.alt ) else if ( m.shift && ! m.ctrl && ! m.alt )
{ {
switch ( key ) switch ( key_id )
{ {
case fc::Fkey_up: case fc::Fkey_up:
return fc::Fkey_sr; // Shift+Up return fc::Fkey_sr; // Shift+Up
@ -479,12 +479,12 @@ int FApplication::modifierKeyCorrection (int& key)
return fc::Fkey_snext; // Shift+PgDn return fc::Fkey_snext; // Shift+PgDn
default: default:
return key; return key_id;
} }
} }
else if ( ! m.shift && m.ctrl && ! m.alt ) else if ( ! m.shift && m.ctrl && ! m.alt )
{ {
switch ( key ) switch ( key_id )
{ {
case fc::Fkey_up: case fc::Fkey_up:
return fc::Fckey_up; // Ctrl+Up return fc::Fckey_up; // Ctrl+Up
@ -517,12 +517,12 @@ int FApplication::modifierKeyCorrection (int& key)
return fc::Fckey_npage; // Ctrl+PgDn return fc::Fckey_npage; // Ctrl+PgDn
default: default:
return key; return key_id;
} }
} }
else if ( ! m.shift && ! m.ctrl && m.alt ) else if ( ! m.shift && ! m.ctrl && m.alt )
{ {
switch ( key ) switch ( key_id )
{ {
case fc::Fkey_up: case fc::Fkey_up:
return fc::Fmkey_up; // Meta+Up return fc::Fmkey_up; // Meta+Up
@ -555,12 +555,12 @@ int FApplication::modifierKeyCorrection (int& key)
return fc::Fmkey_npage; // Meta+PgDn return fc::Fmkey_npage; // Meta+PgDn
default: default:
return key; return key_id;
} }
} }
else if ( m.shift && m.ctrl && ! m.alt ) else if ( m.shift && m.ctrl && ! m.alt )
{ {
switch ( key ) switch ( key_id )
{ {
case fc::Fkey_up: case fc::Fkey_up:
return fc::Fckey_sup; // Shift+Ctrl+Up return fc::Fckey_sup; // Shift+Ctrl+Up
@ -593,12 +593,12 @@ int FApplication::modifierKeyCorrection (int& key)
return fc::Fckey_snpage; // Shift+Ctrl+PgDn return fc::Fckey_snpage; // Shift+Ctrl+PgDn
default: default:
return key; return key_id;
} }
} }
else if ( m.shift && ! m.ctrl && m.alt ) else if ( m.shift && ! m.ctrl && m.alt )
{ {
switch ( key ) switch ( key_id )
{ {
case fc::Fkey_up: case fc::Fkey_up:
return fc::Fmkey_sup; // Shift+Meta+Up return fc::Fmkey_sup; // Shift+Meta+Up
@ -631,12 +631,12 @@ int FApplication::modifierKeyCorrection (int& key)
return fc::Fmkey_snpage; // Shift+Meta+PgDn return fc::Fmkey_snpage; // Shift+Meta+PgDn
default: default:
return key; return key_id;
} }
} }
else if ( ! m.shift && m.ctrl && m.alt ) else if ( ! m.shift && m.ctrl && m.alt )
{ {
switch ( key ) switch ( key_id )
{ {
case fc::Fkey_up: case fc::Fkey_up:
return fc::Fcmkey_up; // Ctrl+Meta+Up return fc::Fcmkey_up; // Ctrl+Meta+Up
@ -669,12 +669,12 @@ int FApplication::modifierKeyCorrection (int& key)
return fc::Fcmkey_npage; // Ctrl+Meta+PgDn return fc::Fcmkey_npage; // Ctrl+Meta+PgDn
default: default:
return key; return key_id;
} }
} }
else if ( m.shift && m.ctrl && m.alt ) else if ( m.shift && m.ctrl && m.alt )
{ {
switch ( key ) switch ( key_id )
{ {
case fc::Fkey_up: case fc::Fkey_up:
return fc::Fcmkey_sup; // Shift+Ctrl+Meta+Up return fc::Fcmkey_sup; // Shift+Ctrl+Meta+Up
@ -707,11 +707,11 @@ int FApplication::modifierKeyCorrection (int& key)
return fc::Fcmkey_snpage; // Shift+Ctrl+Meta+PgDn return fc::Fcmkey_snpage; // Shift+Ctrl+Meta+PgDn
default: default:
return key; return key_id;
} }
} }
return key; return key_id;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -719,8 +719,8 @@ void FApplication::processDialogSwitchAccelerator()
{ {
if ( key >= fc::Fmkey_1 && key <= fc::Fmkey_9 ) if ( key >= fc::Fmkey_1 && key <= fc::Fmkey_9 )
{ {
int n = key - fc::Fmkey_0; uLong n = uLong(key - fc::Fmkey_0);
int s = dialog_list->size(); uLong s = dialog_list->size();
if ( s > 0 && s >= n ) if ( s > 0 && s >= n )
{ {

View File

@ -807,7 +807,6 @@ void FDialog::onAccel (FAccelEvent*)
if ( ! this->isHiddenWindow() && ! this->isActiveWindow() ) if ( ! this->isHiddenWindow() && ! this->isActiveWindow() )
{ {
FWindow::setActiveWindow(this); FWindow::setActiveWindow(this);
FWidget* focus_widget = this->getFocusWidget();
FWindow::raiseWindow (this); FWindow::raiseWindow (this);
if ( focus_widget ) if ( focus_widget )
@ -1101,7 +1100,7 @@ void FDialog::setGeometry (int x, int y, int w, int h, bool adjust)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget* FDialog::getFocusWidget() const FWidget* FDialog::getFocusWidget() const
{ {
return static_cast<FWidget*>(focus_widget); return focus_widget;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -267,7 +267,7 @@ void FMenuItem::createDialogList (FMenu* winmenu)
if ( win ) if ( win )
{ {
int n = std::distance(begin, iter); int n = int(std::distance(begin, iter));
FString win_title = win->getText(); FString win_title = win->getText();
FMenuItem* win_item = new FMenuItem (win_title, winmenu); FMenuItem* win_item = new FMenuItem (win_title, winmenu);