Improved code alignment

This commit is contained in:
Markus Gans 2017-11-26 22:37:18 +01:00
parent 6ef36ac7f7
commit 6be608ba57
31 changed files with 444 additions and 441 deletions

View File

@ -1,6 +1,8 @@
2017-11-26 Markus Gans <guru.mail@muenster.de> 2017-11-26 Markus Gans <guru.mail@muenster.de>
* Better code readability by splitting FOptiMove::moveCursor * Better code readability by splitting FOptiMove::moveCursor
into sub-functions into sub-functions
* Improved alignment of the code by changing the indentation
in Boolean expressions
2017-11-25 Markus Gans <guru.mail@muenster.de> 2017-11-25 Markus Gans <guru.mail@muenster.de>
* Splitting quirks in serperate methods * Splitting quirks in serperate methods

View File

@ -687,7 +687,7 @@ void Calc::cb_buttonClicked (FWidget*, data_ptr data)
else else
// Test if (x / 180) != 0 and x / 90 == 0 // Test if (x / 180) != 0 and x / 90 == 0
if ( std::fabs(std::fmod(*x, 180.0L)) > LDBL_EPSILON if ( std::fabs(std::fmod(*x, 180.0L)) > LDBL_EPSILON
&& std::fabs(std::fmod(*x, 90.0L)) < LDBL_EPSILON ) && std::fabs(std::fmod(*x, 90.0L)) < LDBL_EPSILON )
error = true; error = true;
else if ( std::fabs(std::fmod(*x, 180.0L)) < LDBL_EPSILON ) // x / 180 == 0 else if ( std::fabs(std::fmod(*x, 180.0L)) < LDBL_EPSILON ) // x / 180 == 0
*x = 0.0L; *x = 0.0L;
@ -987,8 +987,8 @@ void Calc::cb_buttonClicked (FWidget*, data_ptr data)
{ {
// remove trailing zeros // remove trailing zeros
while ( ! input.includes(L'e') while ( ! input.includes(L'e')
&& input.includes(L'.') && input.includes(L'.')
&& input.back() == L'0' ) && input.back() == L'0' )
input = input.left(input.getLength() - 1); input = input.left(input.getLength() - 1);
} }
} }

View File

@ -223,11 +223,11 @@ void Menu::defaultCallback (FMenuList* mb)
FMenuItem* item = mb->getItem(int(i)); FMenuItem* item = mb->getItem(int(i));
if ( item if ( item
&& item->isEnabled() && item->isEnabled()
&& item->acceptFocus() && item->acceptFocus()
&& item->isVisible() && item->isVisible()
&& ! item->isSeparator() && ! item->isSeparator()
&& item->getText() != "&Quit" ) && item->getText() != "&Quit" )
{ {
// Add the callback function // Add the callback function
item->addCallback item->addCallback

View File

@ -494,9 +494,9 @@ void Window::cb_next (FWidget*, data_ptr)
next = static_cast<FDialog*>(*next_element); next = static_cast<FDialog*>(*next_element);
} while ( ! next->isEnabled() } while ( ! next->isEnabled()
|| ! next->acceptFocus() || ! next->acceptFocus()
|| ! next->isVisible() || ! next->isVisible()
|| ! next->isWindowWidget() ); || ! next->isWindowWidget() );
activateWindow(next); activateWindow(next);
break; break;
@ -520,7 +520,7 @@ void Window::cb_previous (FWidget*, data_ptr)
--iter; --iter;
if ( (*iter)->isDialogWidget() if ( (*iter)->isDialogWidget()
&& static_cast<FWindow*>(*iter)->isWindowActive() ) && static_cast<FWindow*>(*iter)->isWindowActive() )
{ {
FDialog* prev; FDialog* prev;
widgetList::const_iterator prev_element; widgetList::const_iterator prev_element;
@ -534,9 +534,9 @@ void Window::cb_previous (FWidget*, data_ptr)
--prev_element; --prev_element;
prev = static_cast<FDialog*>(*prev_element); prev = static_cast<FDialog*>(*prev_element);
} while ( ! prev->isEnabled() } while ( ! prev->isEnabled()
|| ! prev->acceptFocus() || ! prev->acceptFocus()
|| ! prev->isVisible() || ! prev->isVisible()
|| ! prev->isWindowWidget() ); || ! prev->isWindowWidget() );
activateWindow(prev); activateWindow(prev);
break; break;

View File

@ -298,9 +298,9 @@ class FOptiAttr
inline bool operator == ( const FOptiAttr::char_data& lhs, inline bool operator == ( const FOptiAttr::char_data& lhs,
const FOptiAttr::char_data& rhs ) const FOptiAttr::char_data& rhs )
{ {
return lhs.code == rhs.code return lhs.code == rhs.code
&& lhs.fg_color == rhs.fg_color && lhs.fg_color == rhs.fg_color
&& lhs.bg_color == rhs.bg_color && lhs.bg_color == rhs.bg_color
&& lhs.attr.byte[0] == rhs.attr.byte[0] && lhs.attr.byte[0] == rhs.attr.byte[0]
&& lhs.attr.byte[1] == rhs.attr.byte[1]; && lhs.attr.byte[1] == rhs.attr.byte[1];
} }

View File

@ -77,7 +77,7 @@ FApplication::FApplication ( const int& _argc
, new_mouse_position() , new_mouse_position()
{ {
assert ( ! rootObj assert ( ! rootObj
&& "FApplication: There should be only one application object" ); && "FApplication: There should be only one application object" );
rootObj = this; rootObj = this;
if ( ! (_argc && _argv) ) if ( ! (_argc && _argv) )
@ -204,8 +204,8 @@ bool FApplication::sendEvent ( const FObject* receiver
// block events for widgets in non modal windows // block events for widgets in non modal windows
if ( window if ( window
&& (window->getFlags() & fc::modal) == 0 && (window->getFlags() & fc::modal) == 0
&& ! window->isMenuWidget() ) && ! window->isMenuWidget() )
{ {
switch ( event->type() ) switch ( event->type() )
{ {
@ -230,8 +230,8 @@ bool FApplication::sendEvent ( const FObject* receiver
// Throw away mouse events for disabled widgets // Throw away mouse events for disabled widgets
if ( event->type() >= fc::MouseDown_Event if ( event->type() >= fc::MouseDown_Event
&& event->type() <= fc::MouseMove_Event && event->type() <= fc::MouseMove_Event
&& ! widget->isEnabled() ) && ! widget->isEnabled() )
return false; return false;
// For access to a protected base class member // For access to a protected base class member
@ -313,7 +313,7 @@ bool FApplication::removeQueuedEvent (const FObject* receiver)
FWidget* FApplication::processParameters (const int& argc, char* argv[]) FWidget* FApplication::processParameters (const int& argc, char* argv[])
{ {
if ( argc > 0 && argv[1] && ( std::strcmp(argv[1], "--help") == 0 if ( argc > 0 && argv[1] && ( std::strcmp(argv[1], "--help") == 0
|| std::strcmp(argv[1], "-h") == 0 ) ) || std::strcmp(argv[1], "-h") == 0 ) )
{ {
showParameterUsage(); showParameterUsage();
} }
@ -615,8 +615,8 @@ void FApplication::processKeyboardEvent()
// read the rest from the fifo buffer // read the rest from the fifo buffer
while ( ! widget->isKeyTimeout(&time_keypressed, key_timeout) while ( ! widget->isKeyTimeout(&time_keypressed, key_timeout)
&& fifo_offset > 0 && fifo_offset > 0
&& key != NEED_MORE_DATA ) && key != NEED_MORE_DATA )
{ {
key = FTerm::parseKeyString(fifo_buf, fifo_buf_size, &time_keypressed); key = FTerm::parseKeyString(fifo_buf, fifo_buf_size, &time_keypressed);
@ -726,8 +726,8 @@ void FApplication::processKeyboardEvent()
sendEvent (widget, &k_press_ev); sendEvent (widget, &k_press_ev);
if ( ! open_menu if ( ! open_menu
&& ! k_press_ev.isAccepted() && ! k_press_ev.isAccepted()
&& ! k_down_ev.isAccepted() ) && ! k_down_ev.isAccepted() )
{ {
// switch to a specific dialog with Meta + 1..9 // switch to a specific dialog with Meta + 1..9
bool accpt = processDialogSwitchAccelerator(); bool accpt = processDialogSwitchAccelerator();
@ -769,10 +769,10 @@ void FApplication::processKeyboardEvent()
// special case: Esc key // special case: Esc key
if ( fifo_in_use if ( fifo_in_use
&& fifo_offset == 1 && fifo_offset == 1
&& fifo_buf[0] == 0x1b && fifo_buf[0] == 0x1b
&& fifo_buf[1] == 0x00 && fifo_buf[1] == 0x00
&& isKeyTimeout(&time_keypressed, key_timeout) ) && isKeyTimeout(&time_keypressed, key_timeout) )
{ {
FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape); FKeyEvent k_press_ev (fc::KeyPress_Event, fc::Fkey_escape);
sendEvent (widget, &k_press_ev); sendEvent (widget, &k_press_ev);
@ -1095,8 +1095,8 @@ bool FApplication::processAccelerator (const FWidget*& widget)
bool accpt = false; bool accpt = false;
if ( widget if ( widget
&& widget->accelerator_list && widget->accelerator_list
&& ! widget->accelerator_list->empty() ) && ! widget->accelerator_list->empty() )
{ {
FWidget::Accelerators::const_iterator iter, last; FWidget::Accelerators::const_iterator iter, last;
iter = widget->accelerator_list->begin(); iter = widget->accelerator_list->begin();
@ -1161,8 +1161,8 @@ void FApplication::getX11ButtonState (int button)
case button1_pressed: case button1_pressed:
case button1_pressed_move: case button1_pressed_move:
if ( mouse_position == new_mouse_position if ( mouse_position == new_mouse_position
&& x11_button_state == all_buttons_released && x11_button_state == all_buttons_released
&& ! isKeyTimeout(&time_mousepressed, dblclick_interval) ) && ! isKeyTimeout(&time_mousepressed, dblclick_interval) )
{ {
time_mousepressed.tv_sec = 0; time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0; time_mousepressed.tv_usec = 0;
@ -1269,8 +1269,8 @@ bool FApplication::parseX11Mouse()
b_state.control_button = Pressed; b_state.control_button = Pressed;
if ( (x11_mouse[0] & button_mask) >= button1_pressed_move if ( (x11_mouse[0] & button_mask) >= button1_pressed_move
&& (x11_mouse[0] & button_mask) <= button3_pressed_move && (x11_mouse[0] & button_mask) <= button3_pressed_move
&& mouse_position != *zero_point ) && mouse_position != *zero_point )
{ {
b_state.mouse_moved = true; b_state.mouse_moved = true;
} }
@ -1278,10 +1278,10 @@ bool FApplication::parseX11Mouse()
getX11ButtonState (x11_mouse[0] & button_mask); getX11ButtonState (x11_mouse[0] & button_mask);
if ( uChar(x11_mouse[1]) == mouse_position.getX() + 0x20 if ( uChar(x11_mouse[1]) == mouse_position.getX() + 0x20
&& uChar(x11_mouse[2]) == mouse_position.getY() + 0x20 && uChar(x11_mouse[2]) == mouse_position.getY() + 0x20
&& b_state.wheel_up != Pressed && b_state.wheel_up != Pressed
&& b_state.wheel_down != Pressed && b_state.wheel_down != Pressed
&& uChar(x11_mouse[0]) == x11_button_state ) && uChar(x11_mouse[0]) == x11_button_state )
{ {
return false; return false;
} }
@ -1364,8 +1364,8 @@ bool FApplication::parseSGRMouse()
b_state.control_button = Pressed; b_state.control_button = Pressed;
if ( (button & button_mask) >= button1_move if ( (button & button_mask) >= button1_move
&& (button & button_mask) <= button3_move && (button & button_mask) <= button3_move
&& mouse_position != *zero_point ) && mouse_position != *zero_point )
{ {
b_state.mouse_moved = true; b_state.mouse_moved = true;
} }
@ -1377,8 +1377,8 @@ bool FApplication::parseSGRMouse()
case button1: case button1:
case button1_move: case button1_move:
if ( mouse_position == new_mouse_position if ( mouse_position == new_mouse_position
&& (((x11_button_state & 0x80) >> 2) + 'M') == released && (((x11_button_state & 0x80) >> 2) + 'M') == released
&& ! isKeyTimeout(&time_mousepressed, dblclick_interval) ) && ! isKeyTimeout(&time_mousepressed, dblclick_interval) )
{ {
time_mousepressed.tv_sec = 0; time_mousepressed.tv_sec = 0;
time_mousepressed.tv_usec = 0; time_mousepressed.tv_usec = 0;
@ -1446,9 +1446,9 @@ bool FApplication::parseSGRMouse()
} }
if ( mouse_position == new_mouse_position if ( mouse_position == new_mouse_position
&& b_state.wheel_up != Pressed && b_state.wheel_up != Pressed
&& b_state.wheel_down != Pressed && b_state.wheel_down != Pressed
&& x11_button_state == uChar(((*p & 0x20) << 2) + button) ) && x11_button_state == uChar(((*p & 0x20) << 2) + button) )
{ {
return false; return false;
} }
@ -1562,8 +1562,8 @@ bool FApplication::parseUrxvtMouse()
b_state.control_button = Pressed; b_state.control_button = Pressed;
if ( (button & button_mask) >= button1_pressed_move if ( (button & button_mask) >= button1_pressed_move
&& (button & button_mask) <= button3_pressed_move && (button & button_mask) <= button3_pressed_move
&& mouse_position != *zero_point ) && mouse_position != *zero_point )
{ {
b_state.mouse_moved = true; b_state.mouse_moved = true;
} }
@ -1571,9 +1571,9 @@ bool FApplication::parseUrxvtMouse()
getX11ButtonState (button & button_mask); getX11ButtonState (button & button_mask);
if ( mouse_position == new_mouse_position if ( mouse_position == new_mouse_position
&& b_state.wheel_up != Pressed && b_state.wheel_up != Pressed
&& b_state.wheel_down != Pressed && b_state.wheel_down != Pressed
&& x11_button_state == uChar(button) ) && x11_button_state == uChar(button) )
{ {
return false; return false;
} }
@ -1678,16 +1678,16 @@ void FApplication::processMouseEvent()
#ifdef F_HAVE_LIBGPM #ifdef F_HAVE_LIBGPM
if ( ! gpmMouseEvent if ( ! gpmMouseEvent
&& x11_mouse[0] == '\0' && x11_mouse[0] == '\0'
&& sgr_mouse[0] == '\0' && sgr_mouse[0] == '\0'
&& urxvt_mouse[0] == '\0' ) && urxvt_mouse[0] == '\0' )
{ {
return; return;
} }
#else #else
if ( x11_mouse[0] == '\0' if ( x11_mouse[0] == '\0'
&& sgr_mouse[0] == '\0' && sgr_mouse[0] == '\0'
&& urxvt_mouse[0] == '\0' ) && urxvt_mouse[0] == '\0' )
{ {
return; return;
} }
@ -1713,12 +1713,12 @@ void FApplication::processMouseEvent()
const FPoint& mouse_position = getMousePos(); const FPoint& mouse_position = getMousePos();
if ( ! clicked_widget if ( ! clicked_widget
&& ( b_state.left_button == Pressed && ( b_state.left_button == Pressed
|| b_state.left_button == DoubleClick || b_state.left_button == DoubleClick
|| b_state.right_button == Pressed || b_state.right_button == Pressed
|| b_state.middle_button == Pressed || b_state.middle_button == Pressed
|| b_state.wheel_up == Pressed || b_state.wheel_up == Pressed
|| b_state.wheel_down == Pressed ) ) || b_state.wheel_down == Pressed ) )
{ {
// determine the window object on the current click position // determine the window object on the current click position
FWidget* window = FWindow::getWindowWidgetAt (mouse_position); FWidget* window = FWindow::getWindowWidgetAt (mouse_position);
@ -1773,8 +1773,8 @@ void FApplication::processMouseEvent()
// unselected menu bar item // unselected menu bar item
if ( ! open_menu && getMenuBar() if ( ! open_menu && getMenuBar()
&& getMenuBar()->hasSelectedItem() && getMenuBar()->hasSelectedItem()
&& ! b_state.mouse_moved ) && ! b_state.mouse_moved )
{ {
if ( ! getMenuBar()->getTermGeometry().contains(mouse_position) ) if ( ! getMenuBar()->getTermGeometry().contains(mouse_position) )
{ {
@ -1868,7 +1868,7 @@ void FApplication::processMouseEvent()
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.right_button != Pressed if ( b_state.right_button != Pressed
&& b_state.middle_button != Pressed ) && b_state.middle_button != Pressed )
clicked_widget = 0; clicked_widget = 0;
sendEvent (released_widget, &m_up_ev); sendEvent (released_widget, &m_up_ev);
@ -1891,7 +1891,7 @@ void FApplication::processMouseEvent()
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.left_button != Pressed if ( b_state.left_button != Pressed
&& b_state.middle_button != Pressed ) && b_state.middle_button != Pressed )
clicked_widget = 0; clicked_widget = 0;
sendEvent (released_widget, &m_up_ev); sendEvent (released_widget, &m_up_ev);
@ -1918,7 +1918,7 @@ void FApplication::processMouseEvent()
FWidget* released_widget = clicked_widget; FWidget* released_widget = clicked_widget;
if ( b_state.right_button != Pressed if ( b_state.right_button != Pressed
&& b_state.left_button != Pressed ) && b_state.left_button != Pressed )
{ {
clicked_widget = 0; clicked_widget = 0;
} }
@ -1993,8 +1993,8 @@ int FApplication::processTimerEvent()
while ( iter != last ) while ( iter != last )
{ {
if ( ! (*iter).id if ( ! (*iter).id
|| ! (*iter).object || ! (*iter).object
|| currentTime < (*iter).timeout ) // no timer expired || currentTime < (*iter).timeout ) // no timer expired
break; break;
(*iter).timeout += (*iter).interval; (*iter).timeout += (*iter).interval;

View File

@ -206,8 +206,8 @@ bool FButton::setFlat (bool on)
bool FButton::setShadow (bool on) bool FButton::setShadow (bool on)
{ {
if ( on if ( on
&& term_encoding != fc::VT100 && term_encoding != fc::VT100
&& term_encoding != fc::ASCII ) && term_encoding != fc::ASCII )
{ {
flags |= fc::shadow; flags |= fc::shadow;
setShadowSize(1,1); setShadowSize(1,1);
@ -650,8 +650,8 @@ void FButton::draw()
drawFlatBorder(); drawFlatBorder();
if ( ! button_down if ( ! button_down
&& ! isNewFont() && ! isNewFont()
&& (is_Flat || ! hasShadow() || isMonochron()) ) && (is_Flat || ! hasShadow() || isMonochron()) )
{ {
// clear the right █ from button down // clear the right █ from button down
if ( parent_widget ) if ( parent_widget )

View File

@ -425,8 +425,8 @@ void FButtonGroup::cb_buttonToggled (FWidget* widget, data_ptr)
FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter); FToggleButton* toggle_button = static_cast<FToggleButton*>(*iter);
if ( toggle_button != button if ( toggle_button != button
&& toggle_button->isChecked() && toggle_button->isChecked()
&& isRadioButton(toggle_button) ) && isRadioButton(toggle_button) )
{ {
toggle_button->unsetChecked(); toggle_button->unsetChecked();

View File

@ -290,8 +290,8 @@ void FDialog::setPos (int x, int y, bool)
FWidget* focus_widget = FWidget::getFocusWidget(); FWidget* focus_widget = FWidget::getFocusWidget();
if ( focus_widget if ( focus_widget
&& focus_widget->isVisible() && focus_widget->isVisible()
&& focus_widget->hasVisibleCursor() ) && focus_widget->hasVisibleCursor() )
{ {
FPoint cursor_pos = focus_widget->getCursorPos(); FPoint cursor_pos = focus_widget->getCursorPos();
focus_widget->setCursorPos(cursor_pos); focus_widget->setCursorPos(cursor_pos);
@ -372,8 +372,8 @@ void FDialog::setSize (int w, int h, bool adjust)
// set the cursor to the focus widget // set the cursor to the focus widget
FWidget* focus_widget = FWidget::getFocusWidget(); FWidget* focus_widget = FWidget::getFocusWidget();
if ( focus_widget if ( focus_widget
&& focus_widget->isVisible() && focus_widget->isVisible()
&& focus_widget->hasVisibleCursor() ) && focus_widget->hasVisibleCursor() )
{ {
FPoint cursor_pos = focus_widget->getCursorPos(); FPoint cursor_pos = focus_widget->getCursorPos();
focus_widget->setCursorPos(cursor_pos); focus_widget->setCursorPos(cursor_pos);
@ -426,8 +426,8 @@ void FDialog::onKeyPress (FKeyEvent* ev)
updateTerminal(); updateTerminal();
} }
if ( ev->key() == fc::Fckey_caret // Ctrl+^ (Ctrl+6) if ( ev->key() == fc::Fckey_caret // Ctrl+^ (Ctrl+6)
|| ev->key() == fc::Fkey_f22 ) // Shift+F10 || ev->key() == fc::Fkey_f22 ) // Shift+F10
{ {
ev->accept(); ev->accept();
// open the titlebar menu // open the titlebar menu
@ -534,7 +534,7 @@ void FDialog::onKeyPress (FKeyEvent* ev)
return; return;
if ( ev->key() == fc::Fkey_escape if ( ev->key() == fc::Fkey_escape
|| ev->key() == fc::Fkey_escape_mintty ) || ev->key() == fc::Fkey_escape_mintty )
{ {
ev->accept(); ev->accept();
@ -596,9 +596,9 @@ void FDialog::onMouseDown (FMouseEvent* ev)
// click on the lower right resize corner // click on the lower right resize corner
if ( isResizeable() if ( isResizeable()
&& ( (mouse_x == getWidth() && mouse_y == getHeight()) && ( (mouse_x == getWidth() && mouse_y == getHeight())
|| (mouse_x == getWidth() - 1 && mouse_y == getHeight()) || (mouse_x == getWidth() - 1 && mouse_y == getHeight())
|| (mouse_x == getWidth() && mouse_y == getHeight() - 1) ) ) || (mouse_x == getWidth() && mouse_y == getHeight() - 1) ) )
{ {
resize_click_pos = ev->getTermPos(); resize_click_pos = ev->getTermPos();
FPoint lower_right_pos = getTermGeometry().getLowerRightPos(); FPoint lower_right_pos = getTermGeometry().getLowerRightPos();
@ -676,9 +676,9 @@ void FDialog::onMouseUp (FMouseEvent* ev)
, titlebar_y = titlebar_click_pos.getY(); , titlebar_y = titlebar_click_pos.getY();
if ( ! titlebar_click_pos.isNull() if ( ! titlebar_click_pos.isNull()
&& titlebar_x > getTermX() + 3 && titlebar_x > getTermX() + 3
&& titlebar_x < getTermX() + getWidth() && titlebar_x < getTermX() + getWidth()
&& titlebar_y == getTermY() ) && titlebar_y == getTermY() )
{ {
FPoint deltaPos = ev->getTermPos() - titlebar_click_pos; FPoint deltaPos = ev->getTermPos() - titlebar_click_pos;
move (deltaPos); move (deltaPos);
@ -687,16 +687,16 @@ void FDialog::onMouseUp (FMouseEvent* ev)
// click on titlebar menu button // click on titlebar menu button
if ( mouse_x < 4 if ( mouse_x < 4
&& mouse_y == 1 && mouse_y == 1
&& dialog_menu->isVisible() && dialog_menu->isVisible()
&& ! dialog_menu->hasSelectedItem() ) && ! dialog_menu->hasSelectedItem() )
{ {
// Sets focus to the first item // Sets focus to the first item
selectFirstMenuItem(); selectFirstMenuItem();
} }
else if ( mouse_x > getWidth() - zoom_btn else if ( mouse_x > getWidth() - zoom_btn
&& mouse_y == 1 && mouse_y == 1
&& zoom_button_pressed ) && zoom_button_pressed )
{ {
// zoom to maximum or restore the window size // zoom to maximum or restore the window size
zoomWindow(); zoomWindow();
@ -784,7 +784,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
const FRect& menu_geometry = dialog_menu->getTermGeometry(); const FRect& menu_geometry = dialog_menu->getTermGeometry();
if ( dialog_menu->getCount() > 0 if ( dialog_menu->getCount() > 0
&& menu_geometry.contains(ev->getTermPos()) ) && menu_geometry.contains(ev->getTermPos()) )
{ {
const FPoint& g = ev->getTermPos(); const FPoint& g = ev->getTermPos();
const FPoint& p = dialog_menu->termToWidgetPos(g); const FPoint& p = dialog_menu->termToWidgetPos(g);
@ -815,7 +815,7 @@ void FDialog::onMouseMove (FMouseEvent* ev)
// resize the dialog // resize the dialog
if ( isResizeable() && ! resize_click_pos.isNull() if ( isResizeable() && ! resize_click_pos.isNull()
&& ev->getTermPos() != getTermGeometry().getLowerRightPos() ) && ev->getTermPos() != getTermGeometry().getLowerRightPos() )
{ {
FWidget* r = getRootWidget(); FWidget* r = getRootWidget();
resize_click_pos = ev->getTermPos(); resize_click_pos = ev->getTermPos();
@ -896,9 +896,9 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
close(); close();
} }
else if ( isResizeable() else if ( isResizeable()
&& mouse_x >= 4 && mouse_x >= 4
&& mouse_x <= getWidth() - zoom_btn && mouse_x <= getWidth() - zoom_btn
&& mouse_y == 1 ) && mouse_y == 1 )
{ {
// double click on titlebar // double click on titlebar
zoomWindow(); // window zoom/unzoom zoomWindow(); // window zoom/unzoom
@ -932,8 +932,8 @@ void FDialog::onWindowActive (FEvent*)
FWidget* win_focus = getWindowFocusWidget(); FWidget* win_focus = getWindowFocusWidget();
if ( win_focus if ( win_focus
&& win_focus->isVisible() && win_focus->isVisible()
&& win_focus->isShown() ) && win_focus->isShown() )
{ {
win_focus->setFocus(); win_focus->setFocus();
win_focus->redraw(); win_focus->redraw();
@ -1189,7 +1189,7 @@ void FDialog::drawBorder()
, y2 = 1 + getHeight() - 1; , y2 = 1 + getHeight() - 1;
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull() ) if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull() )
&& ! isZoomed() ) && ! isZoomed() )
setColor (wc.dialog_resize_fg, getBackgroundColor()); setColor (wc.dialog_resize_fg, getBackgroundColor());
else else
setColor(); setColor();

View File

@ -281,15 +281,15 @@ int FFileDialog::readDir()
continue; continue;
if ( ! show_hidden if ( ! show_hidden
&& next->d_name[0] == '.' && next->d_name[0] == '.'
&& next->d_name[1] != '\0' && next->d_name[1] != '\0'
&& next->d_name[1] != '.' ) && next->d_name[1] != '.' )
{ {
continue; continue;
} }
if ( dir[0] == '/' && dir[1] == '\0' if ( dir[0] == '/' && dir[1] == '\0'
&& std::strcmp(next->d_name, "..") == 0 ) && std::strcmp(next->d_name, "..") == 0 )
continue; continue;
dir_entry entry; dir_entry entry;
@ -775,7 +775,7 @@ const FString FFileDialog::getHomeDir()
void FFileDialog::cb_processActivate (FWidget*, data_ptr) void FFileDialog::cb_processActivate (FWidget*, data_ptr)
{ {
if ( filename->getText().includes('*') if ( filename->getText().includes('*')
|| filename->getText().includes('?') ) || filename->getText().includes('?') )
{ {
setFilter(filename->getText()); setFilter(filename->getText());
readDir(); readDir();
@ -788,8 +788,8 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
filebrowser->redraw(); filebrowser->redraw();
} }
else if ( filename->getText().trim() == FString("..") else if ( filename->getText().trim() == FString("..")
|| filename->getText().includes('/') || filename->getText().includes('/')
|| filename->getText().includes('~') ) || filename->getText().includes('~') )
{ {
changeDir(filename->getText().trim()); changeDir(filename->getText().trim());
} }
@ -807,8 +807,8 @@ void FFileDialog::cb_processActivate (FWidget*, data_ptr)
while ( iter != last ) while ( iter != last )
{ {
if ( (*iter).name && input && ! input.isNull() if ( (*iter).name && input && ! input.isNull()
&& std::strcmp((*iter).name, input) == 0 && std::strcmp((*iter).name, input) == 0
&& (*iter).type == DT_DIR ) && (*iter).type == DT_DIR )
{ {
found = true; found = true;
changeDir(input); changeDir(input);

View File

@ -180,8 +180,8 @@ void FLabel::setAccelWidget (FWidget* widget)
void FLabel::setAlignment (fc::text_alignment align) void FLabel::setAlignment (fc::text_alignment align)
{ {
if ( align != fc::alignLeft if ( align != fc::alignLeft
&& align != fc::alignCenter && align != fc::alignCenter
&& align != fc::alignRight ) && align != fc::alignRight )
alignment = fc::alignLeft; alignment = fc::alignLeft;
else else
alignment = align; alignment = align;
@ -513,11 +513,12 @@ void FLabel::printLine ( wchar_t*& line
if ( ! std::iswprint(wint_t(line[z])) ) if ( ! std::iswprint(wint_t(line[z])) )
{ {
if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2 if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2
|| int(line[z]) > fc::NF_check_mark ) ) || int(line[z]) > fc::NF_check_mark ) )
{ {
line[z] = L' '; line[z] = L' ';
} }
} }
if ( (z == hotkeypos) && isActive ) if ( (z == hotkeypos) && isActive )
{ {
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg); setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);

View File

@ -234,8 +234,8 @@ bool FLineEdit::setFocus (bool on)
bool FLineEdit::setShadow (bool on) bool FLineEdit::setShadow (bool on)
{ {
if ( on if ( on
&& term_encoding != fc::VT100 && term_encoding != fc::VT100
&& term_encoding != fc::ASCII ) && term_encoding != fc::ASCII )
{ {
flags |= fc::shadow; flags |= fc::shadow;
setShadowSize(1,1); setShadowSize(1,1);
@ -364,7 +364,7 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
cursor_pos = len; cursor_pos = len;
if ( cursor_pos - text_offset >= getWidth() - 2 if ( cursor_pos - text_offset >= getWidth() - 2
&& text_offset <= len - getWidth() + 1 ) && text_offset <= len - getWidth() + 1 )
text_offset++; text_offset++;
ev->accept(); ev->accept();
@ -473,8 +473,8 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
// end of switch // end of switch
if ( ev->isAccepted() if ( ev->isAccepted()
&& key != fc::Fkey_return && key != fc::Fkey_return
&& key != fc::Fkey_enter ) && key != fc::Fkey_enter )
{ {
drawInputField(); drawInputField();
updateTerminal(); updateTerminal();
@ -730,7 +730,7 @@ void FLineEdit::adjustLabel()
label_length--; label_length--;
assert ( label_orientation == label_above assert ( label_orientation == label_above
|| label_orientation == label_left ); || label_orientation == label_left );
switch ( label_orientation ) switch ( label_orientation )
{ {

View File

@ -580,8 +580,8 @@ void FListBox::onKeyPress (FKeyEvent* ev)
while ( iter != itemlist.end() ) while ( iter != itemlist.end() )
{ {
if ( ! inc_found if ( ! inc_found
&& inc_search.toLower() && inc_search.toLower()
== iter->getText().left(inc_len + 1).toLower() ) == iter->getText().left(inc_len + 1).toLower() )
{ {
setCurrentItem(iter); setCurrentItem(iter);
inc_found = true; inc_found = true;
@ -671,8 +671,8 @@ void FListBox::onKeyPress (FKeyEvent* ev)
while ( iter != itemlist.end() ) while ( iter != itemlist.end() )
{ {
if ( ! inc_found if ( ! inc_found
&& inc_search.toLower() && inc_search.toLower()
== iter->getText().left(inc_len).toLower() ) == iter->getText().left(inc_len).toLower() )
{ {
setCurrentItem(iter); setCurrentItem(iter);
inc_found = true; inc_found = true;
@ -734,7 +734,7 @@ void FListBox::onMouseDown (FMouseEvent* ev)
, mouse_y; , mouse_y;
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::RightButton ) && ev->getButton() != fc::RightButton )
{ {
return; return;
} }
@ -761,7 +761,7 @@ void FListBox::onMouseDown (FMouseEvent* ev)
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
current = yoffset + mouse_y - 1; current = yoffset + mouse_y - 1;
@ -819,7 +819,7 @@ void FListBox::onMouseUp (FMouseEvent* ev)
int mouse_y = ev->getY(); int mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
processChanged(); processChanged();
@ -838,7 +838,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
, mouse_y; , mouse_y;
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::RightButton ) && ev->getButton() != fc::RightButton )
{ {
return; return;
} }
@ -852,7 +852,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
current = yoffset + mouse_y - 1; current = yoffset + mouse_y - 1;
@ -863,8 +863,8 @@ void FListBox::onMouseMove (FMouseEvent* ev)
// handle multiple selections // handle multiple selections
if ( ev->getButton() == fc::RightButton if ( ev->getButton() == fc::RightButton
&& isMultiSelection() && isMultiSelection()
&& current_before != current ) && current_before != current )
{ {
int from, to; int from, to;
@ -912,7 +912,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
{ {
// drag up // drag up
if ( drag_scroll != fc::noScroll if ( drag_scroll != fc::noScroll
&& scroll_distance < getClientHeight() ) && scroll_distance < getClientHeight() )
scroll_distance++; scroll_distance++;
if ( ! scroll_timer && current > 1 ) if ( ! scroll_timer && current > 1 )
@ -936,7 +936,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
{ {
// drag down // drag down
if ( drag_scroll != fc::noScroll if ( drag_scroll != fc::noScroll
&& scroll_distance < getClientHeight() ) && scroll_distance < getClientHeight() )
scroll_distance++; scroll_distance++;
if ( ! scroll_timer && current < int(getCount()) ) if ( ! scroll_timer && current < int(getCount()) )
@ -978,7 +978,7 @@ void FListBox::onMouseDoubleClick (FMouseEvent* ev)
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
if ( yoffset + mouse_y - 1 > int(getCount()) ) if ( yoffset + mouse_y - 1 > int(getCount()) )
return; return;
@ -1047,7 +1047,7 @@ void FListBox::onTimer (FTimerEvent*)
// handle multiple selections // handle multiple selections
if ( drag_scroll == fc::scrollUpSelect if ( drag_scroll == fc::scrollUpSelect
|| drag_scroll == fc::scrollDownSelect ) || drag_scroll == fc::scrollDownSelect )
{ {
if ( isMultiSelection() && current_before != current ) if ( isMultiSelection() && current_before != current )
{ {
@ -1419,8 +1419,8 @@ void FListBox::drawList()
num = getCount(); num = getCount();
if ( last_yoffset >= 0 if ( last_yoffset >= 0
&& last_yoffset == yoffset && last_yoffset == yoffset
&& last_current != current ) && last_current != current )
{ {
// speed up: redraw only the changed rows // speed up: redraw only the changed rows
uInt last_pos = uInt(current - yoffset) - 1; uInt last_pos = uInt(current - yoffset) - 1;
@ -1584,7 +1584,7 @@ void FListBox::drawList()
full_length = int(getString(iter).getLength()); full_length = int(getString(iter).getLength());
if ( b + i < uInt(getWidth() - nf_offset - 4 ) if ( b + i < uInt(getWidth() - nf_offset - 4 )
&& xoffset <= full_length + 1 ) && xoffset <= full_length + 1 )
{ {
if ( serach_mark && i == inc_len ) if ( serach_mark && i == inc_len )
setColor ( wc.current_element_focus_fg setColor ( wc.current_element_focus_fg
@ -1812,7 +1812,7 @@ void FListBox::cb_VBarChange (FWidget*, data_ptr)
drawList(); drawList();
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollPageForward ) && scrollType <= FScrollbar::scrollPageForward )
{ {
vbar->setValue (yoffset); vbar->setValue (yoffset);
@ -1913,7 +1913,7 @@ void FListBox::cb_HBarChange (FWidget*, data_ptr)
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown ) && scrollType <= FScrollbar::scrollWheelDown )
{ {
hbar->setValue (xoffset); hbar->setValue (xoffset);

View File

@ -100,8 +100,8 @@ FListViewItem::~FListViewItem() // destructor
FString FListViewItem::getText (int column) const FString FListViewItem::getText (int column) const
{ {
if ( column < 1 if ( column < 1
|| column_list.empty() || column_list.empty()
|| column > int(column_list.size()) ) || column > int(column_list.size()) )
return *fc::empty_string; return *fc::empty_string;
column--; // Convert column position to address offset (index) column--; // Convert column position to address offset (index)
@ -126,8 +126,8 @@ uInt FListViewItem::getDepth() const
void FListViewItem::setText (int column, const FString& text) void FListViewItem::setText (int column, const FString& text)
{ {
if ( column < 1 if ( column < 1
|| column_list.empty() || column_list.empty()
|| column > int(column_list.size()) ) || column > int(column_list.size()) )
return; return;
FObject* parent = getParent(); FObject* parent = getParent();
@ -916,7 +916,7 @@ void FListView::onMouseDown (FMouseEvent* ev)
, mouse_y = ev->getY(); , mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
int new_pos = first_visible_line.getPosition() + mouse_y - 2; int new_pos = first_visible_line.getPosition() + mouse_y - 2;
@ -938,7 +938,7 @@ void FListView::onMouseDown (FMouseEvent* ev)
vbar->setValue (first_visible_line.getPosition()); vbar->setValue (first_visible_line.getPosition());
if ( vbar->isVisible() if ( vbar->isVisible()
&& first_line_position_before != first_visible_line.getPosition() ) && first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); updateTerminal();
@ -963,7 +963,7 @@ void FListView::onMouseUp (FMouseEvent* ev)
int mouse_y = ev->getY(); int mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
if ( tree_view ) if ( tree_view )
{ {
@ -1004,7 +1004,7 @@ void FListView::onMouseMove (FMouseEvent* ev)
, mouse_y = ev->getY(); , mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
int new_pos = first_visible_line.getPosition() + mouse_y - 2; int new_pos = first_visible_line.getPosition() + mouse_y - 2;
@ -1017,7 +1017,7 @@ void FListView::onMouseMove (FMouseEvent* ev)
vbar->setValue (first_visible_line.getPosition()); vbar->setValue (first_visible_line.getPosition());
if ( vbar->isVisible() if ( vbar->isVisible()
&& first_line_position_before != first_visible_line.getPosition() ) && first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); updateTerminal();
@ -1029,7 +1029,7 @@ void FListView::onMouseMove (FMouseEvent* ev)
{ {
// drag up // drag up
if ( drag_scroll != fc::noScroll if ( drag_scroll != fc::noScroll
&& scroll_distance < getClientHeight() ) && scroll_distance < getClientHeight() )
scroll_distance++; scroll_distance++;
if ( ! scroll_timer && current_iter.getPosition() > 0 ) if ( ! scroll_timer && current_iter.getPosition() > 0 )
@ -1053,7 +1053,7 @@ void FListView::onMouseMove (FMouseEvent* ev)
{ {
// drag down // drag down
if ( drag_scroll != fc::noScroll if ( drag_scroll != fc::noScroll
&& scroll_distance < getClientHeight() ) && scroll_distance < getClientHeight() )
scroll_distance++; scroll_distance++;
if ( ! scroll_timer && current_iter.getPosition() <= int(getCount()) ) if ( ! scroll_timer && current_iter.getPosition() <= int(getCount()) )
@ -1095,7 +1095,7 @@ void FListView::onMouseDoubleClick (FMouseEvent* ev)
mouse_y = ev->getY(); mouse_y = ev->getY();
if ( mouse_x > 1 && mouse_x < getWidth() if ( mouse_x > 1 && mouse_x < getWidth()
&& mouse_y > 1 && mouse_y < getHeight() ) && mouse_y > 1 && mouse_y < getHeight() )
{ {
if ( first_visible_line.getPosition() + mouse_y - 1 > int(getCount()) ) if ( first_visible_line.getPosition() + mouse_y - 1 > int(getCount()) )
return; return;
@ -1164,7 +1164,8 @@ void FListView::onTimer (FTimerEvent*)
vbar->setValue (first_visible_line.getPosition()); vbar->setValue (first_visible_line.getPosition());
if ( vbar->isVisible() && first_line_position_before != first_visible_line.getPosition() ) if ( vbar->isVisible()
&& first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); updateTerminal();
@ -1496,9 +1497,9 @@ void FListView::drawColumnLabels()
uInt txt_length; uInt txt_length;
if ( header.empty() if ( header.empty()
|| getHeight() <= 2 || getHeight() <= 2
|| getWidth() <= 4 || getWidth() <= 4
|| max_line_width < 1 ) || max_line_width < 1 )
return; return;
iter = header.begin(); iter = header.begin();
@ -1825,7 +1826,7 @@ void FListView::stepForward()
void FListView::stepBackward() void FListView::stepBackward()
{ {
if ( current_iter == first_visible_line if ( current_iter == first_visible_line
&& current_iter != itemlist.begin() ) && current_iter != itemlist.begin() )
{ {
--first_visible_line; --first_visible_line;
--last_visible_line; --last_visible_line;
@ -2007,12 +2008,12 @@ void FListView::cb_VBarChange (FWidget*, data_ptr)
drawList(); drawList();
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollPageForward ) && scrollType <= FScrollbar::scrollPageForward )
{ {
vbar->setValue (first_visible_line.getPosition()); vbar->setValue (first_visible_line.getPosition());
if ( vbar->isVisible() if ( vbar->isVisible()
&& first_line_position_before != first_visible_line.getPosition() ) && first_line_position_before != first_visible_line.getPosition() )
vbar->drawBar(); vbar->drawBar();
updateTerminal(); updateTerminal();
@ -2098,7 +2099,7 @@ void FListView::cb_HBarChange (FWidget*, data_ptr)
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown ) && scrollType <= FScrollbar::scrollWheelDown )
{ {
hbar->setValue (xoffset); hbar->setValue (xoffset);

View File

@ -331,16 +331,16 @@ void FMenu::onMouseDown (FMouseEvent* ev)
, mouse_y = mouse_pos.getY(); , mouse_y = mouse_pos.getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x < x2 && mouse_x < x2
&& mouse_y == y ) && mouse_y == y )
{ {
// Mouse pointer over item // Mouse pointer over item
if ( hasSelectedItem() ) if ( hasSelectedItem() )
{ {
FMenuItem* sel_item = getSelectedItem(); FMenuItem* sel_item = getSelectedItem();
if ( sel_item if ( sel_item
&& sel_item->hasMenu() && sel_item->hasMenu()
&& sel_item->getMenu() == open_sub_menu ) && sel_item->getMenu() == open_sub_menu )
{ {
if ( sel_item != *iter ) if ( sel_item != *iter )
hideSubMenus(); hideSubMenus();
@ -438,8 +438,8 @@ void FMenu::onMouseUp (FMouseEvent* ev)
int mouse_y = mouse_pos.getY(); int mouse_y = mouse_pos.getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x < x2 && mouse_x < x2
&& mouse_y == y ) && mouse_y == y )
{ {
// Mouse pointer over item // Mouse pointer over item
if ( (*iter)->hasMenu() ) if ( (*iter)->hasMenu() )
@ -532,8 +532,8 @@ void FMenu::onMouseMove (FMouseEvent* ev)
} }
if ( getMenuBar() if ( getMenuBar()
&& isMenuBar(getMenuBar()) && isMenuBar(getMenuBar())
&& getMenuBar()->getTermGeometry().contains(ev->getTermPos()) ) && getMenuBar()->getTermGeometry().contains(ev->getTermPos()) )
{ {
mouse_over_menubar = true; mouse_over_menubar = true;
} }
@ -547,12 +547,12 @@ void FMenu::onMouseMove (FMouseEvent* ev)
, mouse_y = mouse_pos.getY(); , mouse_y = mouse_pos.getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x < x2 && mouse_x < x2
&& mouse_y == y ) && mouse_y == y )
{ {
if ( (*iter)->isEnabled() if ( (*iter)->isEnabled()
&& ! (*iter)->isSelected() && ! (*iter)->isSelected()
&& ! (*iter)->isSeparator() ) && ! (*iter)->isSeparator() )
{ {
// Mouse pointer over item // Mouse pointer over item
FWidget* focused_widget = getFocusWidget(); FWidget* focused_widget = getFocusWidget();
@ -585,9 +585,9 @@ void FMenu::onMouseMove (FMouseEvent* ev)
else else
{ {
if ( mouse_over_menu if ( mouse_over_menu
&& (*iter)->isEnabled() && (*iter)->isEnabled()
&& (*iter)->isSelected() && (*iter)->isSelected()
&& ! mouse_over_submenu ) && ! mouse_over_submenu )
{ {
// Unselect selected item without mouse focus // Unselect selected item without mouse focus
(*iter)->unsetSelected(); (*iter)->unsetSelected();
@ -743,8 +743,8 @@ void FMenu::cb_menuitem_toggled (FWidget* widget, data_ptr)
while ( iter != last ) while ( iter != last )
{ {
if ( (*iter) != menuitem if ( (*iter) != menuitem
&& (*iter)->isChecked() && (*iter)->isChecked()
&& isRadioMenuItem(*iter) ) && isRadioMenuItem(*iter) )
{ {
(*iter)->unsetChecked(); (*iter)->unsetChecked();
} }
@ -1067,10 +1067,10 @@ bool FMenu::selectNextItem()
next_element = item_list.begin(); next_element = item_list.begin();
next = static_cast<FMenuItem*>(*next_element); next = static_cast<FMenuItem*>(*next_element);
} }
while ( ! next->isEnabled() while ( ! next->isEnabled()
|| ! next->acceptFocus() || ! next->acceptFocus()
|| ! next->isVisible() || ! next->isVisible()
|| next->isSeparator() ); || next->isSeparator() );
if ( next == *iter ) if ( next == *iter )
return false; return false;
@ -1119,10 +1119,10 @@ bool FMenu::selectPrevItem()
--prev_element; --prev_element;
prev = static_cast<FMenuItem*>(*prev_element); prev = static_cast<FMenuItem*>(*prev_element);
} }
while ( ! prev->isEnabled() while ( ! prev->isEnabled()
|| ! prev->acceptFocus() || ! prev->acceptFocus()
|| ! prev->isVisible() || ! prev->isVisible()
|| prev->isSeparator() ); || prev->isSeparator() );
if ( prev == *iter ) if ( prev == *iter )
return false; return false;
@ -1406,9 +1406,9 @@ void FMenu::drawItems()
if ( ! std::iswprint(wint_t(item_text[z])) ) if ( ! std::iswprint(wint_t(item_text[z])) )
{ {
if ( ! isNewFont() if ( ! isNewFont()
&& ( int(item_text[z]) < fc::NF_rev_left_arrow2 && ( int(item_text[z]) < fc::NF_rev_left_arrow2
|| int(item_text[z]) > fc::NF_check_mark ) || int(item_text[z]) > fc::NF_check_mark )
&& ! charEncodable(uInt(item_text[z])) ) && ! charEncodable(uInt(item_text[z])) )
{ {
item_text[z] = L' '; item_text[z] = L' ';
} }

View File

@ -129,7 +129,7 @@ void FMenuBar::onKeyPress (FKeyEvent* ev)
drop_down = true; drop_down = true;
} }
else if ( ev->key() == fc::Fkey_return else if ( ev->key() == fc::Fkey_return
|| ev->key() == fc::Fkey_enter ) || ev->key() == fc::Fkey_enter )
{ {
unselectItem(); unselectItem();
redraw(); redraw();
@ -377,8 +377,8 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
x2 = (*iter)->getX() + (*iter)->getWidth(); x2 = (*iter)->getX() + (*iter)->getWidth();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x < x2 && mouse_x < x2
&& mouse_y == 1 ) && mouse_y == 1 )
{ {
// Mouse pointer over item // Mouse pointer over item
if ( (*iter)->isEnabled() && ! (*iter)->isSelected() ) if ( (*iter)->isEnabled() && ! (*iter)->isSelected() )
@ -414,8 +414,8 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
else else
{ {
if ( mouse_over_menubar if ( mouse_over_menubar
&& (*iter)->isEnabled() && (*iter)->isEnabled()
&& (*iter)->isSelected() ) && (*iter)->isSelected() )
{ {
// Unselect selected item without mouse focus // Unselect selected item without mouse focus
(*iter)->unsetSelected(); (*iter)->unsetSelected();
@ -433,7 +433,7 @@ void FMenuBar::onMouseMove (FMouseEvent* ev)
const FRect& menu_geometry = menu->getTermGeometry(); const FRect& menu_geometry = menu->getTermGeometry();
if ( menu->getCount() > 0 if ( menu->getCount() > 0
&& menu_geometry.contains(ev->getTermPos()) ) && menu_geometry.contains(ev->getTermPos()) )
{ {
const FPoint& t = ev->getTermPos(); const FPoint& t = ev->getTermPos();
const FPoint& p = menu->termToWidgetPos(t); const FPoint& p = menu->termToWidgetPos(t);
@ -572,9 +572,9 @@ bool FMenuBar::selectNextItem()
next = static_cast<FMenuItem*>(*next_element); next = static_cast<FMenuItem*>(*next_element);
} while ( ! next->isEnabled() } while ( ! next->isEnabled()
|| ! next->acceptFocus() || ! next->acceptFocus()
|| ! next->isVisible() || ! next->isVisible()
|| next->isSeparator() ); || next->isSeparator() );
if ( next == *iter ) if ( next == *iter )
return false; return false;
@ -639,9 +639,9 @@ bool FMenuBar::selectPrevItem()
prev = static_cast<FMenuItem*>(*prev_element); prev = static_cast<FMenuItem*>(*prev_element);
} }
while ( ! prev->isEnabled() while ( ! prev->isEnabled()
|| ! prev->acceptFocus() || ! prev->acceptFocus()
|| ! prev->isVisible() || ! prev->isVisible()
|| prev->isSeparator() ); || prev->isSeparator() );
if ( prev == *iter ) if ( prev == *iter )
return false; return false;
@ -879,8 +879,8 @@ void FMenuBar::drawItems()
if ( ! std::iswprint(wint_t(item_text[z])) ) if ( ! std::iswprint(wint_t(item_text[z])) )
{ {
if ( ! isNewFont() if ( ! isNewFont()
&& ( int(item_text[z]) < fc::NF_rev_left_arrow2 && ( int(item_text[z]) < fc::NF_rev_left_arrow2
|| int(item_text[z]) > fc::NF_check_mark ) ) || int(item_text[z]) > fc::NF_check_mark ) )
{ {
item_text[z] = L' '; item_text[z] = L' ';
} }

View File

@ -248,8 +248,8 @@ void FMenuItem::delAccelerator (FWidget* obj)
FWidget* root = getRootWidget(); FWidget* root = getRootWidget();
if ( root if ( root
&& root->accelerator_list && root->accelerator_list
&& ! root->accelerator_list->empty() ) && ! root->accelerator_list->empty() )
{ {
FWidget::Accelerators::iterator iter; FWidget::Accelerators::iterator iter;
iter = root->accelerator_list->begin(); iter = root->accelerator_list->begin();

View File

@ -1184,8 +1184,8 @@ inline bool FOptiAttr::colorChange (char_data*& term, char_data*& next)
if ( term && next ) if ( term && next )
{ {
return bool ( fake_reverse return bool ( fake_reverse
|| term->fg_color != next->fg_color || term->fg_color != next->fg_color
|| term->bg_color != next->bg_color ); || term->bg_color != next->bg_color );
} }
return false; return false;
@ -1320,7 +1320,7 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
if ( ansi_default_color ) if ( ansi_default_color )
{ {
if ( fg == Default && term->fg_color != Default if ( fg == Default && term->fg_color != Default
&& bg == Default && term->bg_color != Default ) && bg == Default && term->bg_color != Default )
{ {
setTermDefaultColor(term); setTermDefaultColor(term);
} }
@ -1369,21 +1369,21 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
short ansi_bg = vga2ansi(bg); short ansi_bg = vga2ansi(bg);
if ( term->fg_color != fg if ( term->fg_color != fg
&& (color_str = tparm(AF, ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0)) ) && (color_str = tparm(AF, ansi_fg, 0, 0, 0, 0, 0, 0, 0, 0)) )
append_sequence (color_str); append_sequence (color_str);
if ( term->bg_color != bg if ( term->bg_color != bg
&& (color_str = tparm(AB, ansi_bg, 0, 0, 0, 0, 0, 0, 0, 0)) ) && (color_str = tparm(AB, ansi_bg, 0, 0, 0, 0, 0, 0, 0, 0)) )
append_sequence (color_str); append_sequence (color_str);
} }
else if ( Sf && Sb ) else if ( Sf && Sb )
{ {
if ( term->fg_color != fg if ( term->fg_color != fg
&& (color_str = tparm(Sf, fg, 0, 0, 0, 0, 0, 0, 0, 0)) ) && (color_str = tparm(Sf, fg, 0, 0, 0, 0, 0, 0, 0, 0)) )
append_sequence (color_str); append_sequence (color_str);
if ( term->bg_color != bg if ( term->bg_color != bg
&& (color_str = tparm(Sb, bg, 0, 0, 0, 0, 0, 0, 0, 0)) ) && (color_str = tparm(Sb, bg, 0, 0, 0, 0, 0, 0, 0, 0)) )
append_sequence (color_str); append_sequence (color_str);
} }
else if ( sp ) else if ( sp )

View File

@ -495,8 +495,8 @@ char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
if ( isMethod0Faster(move_time, xnew, ynew) ) if ( isMethod0Faster(move_time, xnew, ynew) )
{ {
if ( xold < 0 if ( xold < 0
|| yold < 0 || yold < 0
|| isWideMove (xold, yold, xnew, ynew) ) || isWideMove (xold, yold, xnew, ynew) )
{ {
return ( move_time < LONG_DURATION ) ? move_buf : 0; return ( move_time < LONG_DURATION ) ? move_buf : 0;
} }
@ -878,9 +878,9 @@ inline bool FOptiMove::isWideMove ( int xold, int yold
, int xnew, int ynew ) , int xnew, int ynew )
{ {
return bool ( xnew > MOVE_LIMIT return bool ( xnew > MOVE_LIMIT
&& xnew < screen_width - 1 - MOVE_LIMIT && xnew < screen_width - 1 - MOVE_LIMIT
&& std::abs(xnew - xold) + std::abs(ynew - yold) && std::abs(xnew - xold) + std::abs(ynew - yold)
> MOVE_LIMIT ); > MOVE_LIMIT );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -938,7 +938,7 @@ inline bool FOptiMove::isMethod2Faster ( int& move_time
int new_time = relativeMove (null_ptr, 0, yold, xnew, ynew); int new_time = relativeMove (null_ptr, 0, yold, xnew, ynew);
if ( new_time < LONG_DURATION if ( new_time < LONG_DURATION
&& F_carriage_return.duration + new_time < move_time ) && F_carriage_return.duration + new_time < move_time )
{ {
move_time = F_carriage_return.duration + new_time; move_time = F_carriage_return.duration + new_time;
return true; return true;
@ -961,7 +961,7 @@ inline bool FOptiMove::isMethod3Faster ( int& move_time
int new_time = relativeMove (null_ptr, 0, 0, xnew, ynew); int new_time = relativeMove (null_ptr, 0, 0, xnew, ynew);
if ( new_time < LONG_DURATION if ( new_time < LONG_DURATION
&& F_cursor_home.duration + new_time < move_time ) && F_cursor_home.duration + new_time < move_time )
{ {
move_time = F_cursor_home.duration + new_time; move_time = F_cursor_home.duration + new_time;
return true; return true;
@ -985,7 +985,7 @@ inline bool FOptiMove::isMethod4Faster ( int& move_time
, xnew, ynew ); , xnew, ynew );
if ( new_time < LONG_DURATION if ( new_time < LONG_DURATION
&& F_cursor_to_ll.duration + new_time < move_time ) && F_cursor_to_ll.duration + new_time < move_time )
{ {
move_time = F_cursor_to_ll.duration + new_time; move_time = F_cursor_to_ll.duration + new_time;
return true; return true;
@ -1002,9 +1002,9 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
{ {
// Test method 5: left margin for wrap to right-hand side // Test method 5: left margin for wrap to right-hand side
if ( automatic_left_margin if ( automatic_left_margin
&& ! eat_nl_glitch && ! eat_nl_glitch
&& yold > 0 && yold > 0
&& F_cursor_left.cap ) && F_cursor_left.cap )
{ {
char null_result[sizeof(move_buf)]; char null_result[sizeof(move_buf)];
char* null_ptr = null_result; char* null_ptr = null_result;
@ -1013,9 +1013,9 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
, xnew, ynew ); , xnew, ynew );
if ( new_time < LONG_DURATION if ( new_time < LONG_DURATION
&& F_carriage_return.cap && F_carriage_return.cap
&& F_carriage_return.duration && F_carriage_return.duration
+ F_cursor_left.duration + new_time < move_time ) + F_cursor_left.duration + new_time < move_time )
{ {
move_time = F_carriage_return.duration move_time = F_carriage_return.duration
+ F_cursor_left.duration + new_time; + F_cursor_left.duration + new_time;

View File

@ -79,8 +79,8 @@ void FProgressbar::setGeometry (int x, int y, int w, int h, bool adjust)
bool FProgressbar::setShadow (bool on) bool FProgressbar::setShadow (bool on)
{ {
if ( on if ( on
&& term_encoding != fc::VT100 && term_encoding != fc::VT100
&& term_encoding != fc::ASCII ) && term_encoding != fc::ASCII )
{ {
flags |= fc::shadow; flags |= fc::shadow;
setShadowSize(1,1); setShadowSize(1,1);
@ -219,8 +219,7 @@ void FProgressbar::drawBar()
if ( percentage > 0.0f && trunc(length) < bar_length ) if ( percentage > 0.0f && trunc(length) < bar_length )
{ {
if ( round(length) > trunc(length) if ( round(length) > trunc(length) || getMaxColor() < 16 )
|| getMaxColor() < 16 )
{ {
if ( isMonochron() ) if ( isMonochron() )
{ {

View File

@ -203,7 +203,7 @@ bool FRect::contains (const FRect& r) const
bool FRect::overlap (const FRect &r) const bool FRect::overlap (const FRect &r) const
{ {
return ( std::max(X1, r.X1) <= std::min(X2, r.X2) return ( std::max(X1, r.X1) <= std::min(X2, r.X2)
&& std::max(Y1, r.Y1) <= std::min(Y2, r.Y2) ); && std::max(Y1, r.Y1) <= std::min(Y2, r.Y2) );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -416,7 +416,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
int mouse_x, mouse_y; int mouse_x, mouse_y;
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
if ( min == max ) if ( min == max )
@ -439,7 +439,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
{ {
if ( mouse_y > slider_pos + 1 if ( mouse_y > slider_pos + 1
&& mouse_y <= slider_pos + slider_length + 1 ) && mouse_y <= slider_pos + slider_length + 1 )
slider_click_pos = mouse_y; // on slider slider_click_pos = mouse_y; // on slider
} }
else // horizontal else // horizontal
@ -447,13 +447,13 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
if ( isNewFont() ) if ( isNewFont() )
{ {
if ( mouse_x > slider_pos + 2 if ( mouse_x > slider_pos + 2
&& mouse_x <= slider_pos + slider_length + 2 ) && mouse_x <= slider_pos + slider_length + 2 )
slider_click_pos = mouse_x; // on slider slider_click_pos = mouse_x; // on slider
} }
else else
{ {
if ( mouse_x > slider_pos + 1 if ( mouse_x > slider_pos + 1
&& mouse_x <= slider_pos + slider_length + 1 ) && mouse_x <= slider_pos + slider_length + 1 )
slider_click_pos = mouse_x; // on slider slider_click_pos = mouse_x; // on slider
} }
} }
@ -463,7 +463,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
} }
if ( scroll_type == FScrollbar::scrollPageBackward if ( scroll_type == FScrollbar::scrollPageBackward
|| scroll_type == FScrollbar::scrollPageForward ) || scroll_type == FScrollbar::scrollPageForward )
{ {
if ( bar_orientation == fc::vertical ) if ( bar_orientation == fc::vertical )
slider_click_stop_pos = mouse_y - 2; slider_click_stop_pos = mouse_y - 2;
@ -477,7 +477,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
slider_click_stop_pos = -1; slider_click_stop_pos = -1;
if ( scroll_type >= FScrollbar::scrollStepBackward if ( scroll_type >= FScrollbar::scrollStepBackward
&& scroll_type <= FScrollbar::scrollPageForward ) && scroll_type <= FScrollbar::scrollPageForward )
{ {
processScroll(); processScroll();
threshold_reached = false; threshold_reached = false;
@ -489,7 +489,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
void FScrollbar::onMouseUp (FMouseEvent* ev) void FScrollbar::onMouseUp (FMouseEvent* ev)
{ {
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
slider_click_pos = -1; slider_click_pos = -1;
@ -507,7 +507,7 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
int mouse_x, mouse_y, new_scroll_type; int mouse_x, mouse_y, new_scroll_type;
if ( ev->getButton() != fc::LeftButton if ( ev->getButton() != fc::LeftButton
&& ev->getButton() != fc::MiddleButton ) && ev->getButton() != fc::MiddleButton )
return; return;
mouse_x = ev->getX(); mouse_x = ev->getX();
@ -551,7 +551,7 @@ void FScrollbar::onMouseMove (FMouseEvent* ev)
} }
if ( mouse_x < 1 || mouse_x > getWidth() if ( mouse_x < 1 || mouse_x > getWidth()
|| mouse_y < 1 || mouse_y > getHeight() ) || mouse_y < 1 || mouse_y > getHeight() )
{ {
delOwnTimer(); delOwnTimer();
} }
@ -599,13 +599,13 @@ void FScrollbar::onTimer (FTimerEvent*)
} }
if ( ( scroll_type == FScrollbar::scrollPageBackward if ( ( scroll_type == FScrollbar::scrollPageBackward
&& slider_pos < slider_click_stop_pos ) && slider_pos < slider_click_stop_pos )
|| ( scroll_type == FScrollbar::scrollPageForward || ( scroll_type == FScrollbar::scrollPageForward
&& slider_pos + slider_length > slider_click_stop_pos ) ) && slider_pos + slider_length > slider_click_stop_pos ) )
{ {
// Scroll to the end // Scroll to the end
if ( scroll_type == FScrollbar::scrollPageForward if ( scroll_type == FScrollbar::scrollPageForward
&& slider_pos + slider_length > slider_click_stop_pos ) && slider_pos + slider_length > slider_click_stop_pos )
{ {
setValue(max); setValue(max);
processScroll(); processScroll();
@ -724,7 +724,7 @@ void FScrollbar::processMiddleButton (int x, int y)
if ( y >1 && y < getHeight() ) if ( y >1 && y < getHeight() )
{ {
new_val = int( round ( double(max - min) * (y - 2.0 - (slider_length/2)) new_val = int( round ( double(max - min) * (y - 2.0 - (slider_length/2))
/ double(bar_length - slider_length) ) ); / double(bar_length - slider_length) ) );
} }
else else
return; return;
@ -736,7 +736,7 @@ void FScrollbar::processMiddleButton (int x, int y)
if ( x > 1 + nf && x < getWidth() - nf ) if ( x > 1 + nf && x < getWidth() - nf )
{ {
new_val = int( round ( double(max - min) * (x - 2.0 - nf - (slider_length/2)) new_val = int( round ( double(max - min) * (x - 2.0 - nf - (slider_length/2))
/ double(bar_length - slider_length) ) ); / double(bar_length - slider_length) ) );
} }
else else
return; return;

View File

@ -240,7 +240,7 @@ void FScrollView::setSize (int w, int h, bool adjust)
calculateScrollbarPos(); calculateScrollbarPos();
if ( getScrollWidth() < getViewportWidth() if ( getScrollWidth() < getViewportWidth()
|| getScrollHeight() < getViewportHeight() ) || getScrollHeight() < getViewportHeight() )
setScrollSize (getViewportWidth(), getViewportHeight()); setScrollSize (getViewportWidth(), getViewportHeight());
} }
@ -257,7 +257,7 @@ void FScrollView::setGeometry (int x, int y, int w, int h, bool adjust)
calculateScrollbarPos(); calculateScrollbarPos();
if ( getScrollWidth() < getViewportWidth() if ( getScrollWidth() < getViewportWidth()
|| getScrollHeight() < getViewportHeight() ) || getScrollHeight() < getViewportHeight() )
{ {
setScrollSize (getViewportWidth(), getViewportHeight()); setScrollSize (getViewportWidth(), getViewportHeight());
} }
@ -486,7 +486,7 @@ void FScrollView::onKeyPress (FKeyEvent* ev)
bool hasChanges = false; bool hasChanges = false;
if ( isVisible() && viewport if ( isVisible() && viewport
&& (xoffset_before != xoffset || yoffset_before != yoffset) ) && (xoffset_before != xoffset || yoffset_before != yoffset) )
{ {
viewport_geometry.setWidth(save_width); viewport_geometry.setWidth(save_width);
viewport_geometry.setHeight(save_height); viewport_geometry.setHeight(save_height);
@ -933,7 +933,7 @@ void FScrollView::setViewportCursor()
print_area->input_cursor_y = window_cursor_pos.getY(); print_area->input_cursor_y = window_cursor_pos.getY();
if ( viewport->input_cursor_visible if ( viewport->input_cursor_visible
&& viewport_geometry.contains(cursor_pos) ) && viewport_geometry.contains(cursor_pos) )
print_area->input_cursor_visible = true; print_area->input_cursor_visible = true;
else else
print_area->input_cursor_visible = false; print_area->input_cursor_visible = false;
@ -1033,8 +1033,8 @@ void FScrollView::cb_VBarChange (FWidget*, data_ptr)
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown && scrollType <= FScrollbar::scrollWheelDown
&& hasChanges ) && hasChanges )
{ {
vbar->setValue (yoffset); vbar->setValue (yoffset);
drawVBar(); drawVBar();
@ -1138,8 +1138,8 @@ void FScrollView::cb_HBarChange (FWidget*, data_ptr)
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown && scrollType <= FScrollbar::scrollWheelDown
&& hasChanges ) && hasChanges )
{ {
hbar->setValue (xoffset); hbar->setValue (xoffset);
drawHBar(); drawHBar();

View File

@ -243,7 +243,7 @@ void FStatusBar::drawMessage()
{ {
std::vector<FStatusKey*>::const_iterator iter = key_list.end(); std::vector<FStatusKey*>::const_iterator iter = key_list.end();
isLastActiveFocus = bool ( (*(iter - 1))->isActivated() isLastActiveFocus = bool ( (*(iter - 1))->isActivated()
|| (*(iter - 1))->hasMouseFocus() ); || (*(iter - 1))->hasMouseFocus() );
} }
else else
isLastActiveFocus = false; isLastActiveFocus = false;
@ -404,9 +404,9 @@ void FStatusBar::onMouseDown (FMouseEvent* ev)
, mouse_y = ev->getY(); , mouse_y = ev->getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x <= x2 && mouse_x <= x2
&& mouse_y == 1 && mouse_y == 1
&& ! (*iter)->hasMouseFocus() ) && ! (*iter)->hasMouseFocus() )
{ {
(*iter)->setMouseFocus(); (*iter)->setMouseFocus();
redraw(); redraw();
@ -494,8 +494,8 @@ void FStatusBar::onMouseMove (FMouseEvent* ev)
, mouse_y = ev->getY(); , mouse_y = ev->getY();
if ( mouse_x >= x1 if ( mouse_x >= x1
&& mouse_x <= x2 && mouse_x <= x2
&& mouse_y == 1 ) && mouse_y == 1 )
{ {
if ( ! (*iter)->hasMouseFocus() ) if ( ! (*iter)->hasMouseFocus() )
{ {
@ -663,9 +663,9 @@ void FStatusBar::drawKeys()
} }
if ( iter + 1 != key_list.end() if ( iter + 1 != key_list.end()
&& ( (*(iter + 1))->isActivated() || (*(iter + 1))->hasMouseFocus() ) && ( (*(iter + 1))->isActivated() || (*(iter + 1))->hasMouseFocus() )
&& x + int(getKeyName((*(iter + 1))->getKey()).getLength()) + 3 && x + int(getKeyName((*(iter + 1))->getKey()).getLength()) + 3
< screenWidth ) < screenWidth )
{ {
// next element is active // next element is active
if ( isMonochron() ) if ( isMonochron() )

View File

@ -918,7 +918,7 @@ long FString::toLong() const
register uChar d = uChar((*p) - L'0'); register uChar d = uChar((*p) - L'0');
if ( num > tenth_limit if ( num > tenth_limit
|| (num == tenth_limit && d > tenth_limit_digit) ) || (num == tenth_limit && d > tenth_limit_digit) )
{ {
throw std::overflow_error ("overflow"); throw std::overflow_error ("overflow");
} }
@ -967,7 +967,7 @@ uLong FString::toULong() const
register uChar d = uChar((*p) - L'0'); register uChar d = uChar((*p) - L'0');
if ( num > tenth_limit if ( num > tenth_limit
|| (num == tenth_limit && d > tenth_limit_digit) ) || (num == tenth_limit && d > tenth_limit_digit) )
{ {
throw std::overflow_error ("overflow"); throw std::overflow_error ("overflow");
} }

View File

@ -472,13 +472,13 @@ int FTerm::parseKeyString ( char buffer[]
// SGR mouse tracking // SGR mouse tracking
if ( buffer[1] == '[' && buffer[2] == '<' && buf_len >= 9 if ( buffer[1] == '[' && buffer[2] == '<' && buf_len >= 9
&& (buffer[buf_len - 1] == 'M' || buffer[buf_len - 1] == 'm') ) && (buffer[buf_len - 1] == 'M' || buffer[buf_len - 1] == 'm') )
return fc::Fkey_extended_mouse; return fc::Fkey_extended_mouse;
// urxvt mouse tracking // urxvt mouse tracking
if ( buffer[1] == '[' && buffer[2] >= '1' && buffer[2] <= '9' if ( buffer[1] == '[' && buffer[2] >= '1' && buffer[2] <= '9'
&& buffer[3] >= '0' && buffer[3] <= '9' && buf_len >= 9 && buffer[3] >= '0' && buffer[3] <= '9' && buf_len >= 9
&& buffer[buf_len - 1] == 'M' ) && buffer[buf_len - 1] == 'M' )
return fc::Fkey_urxvt_mouse; return fc::Fkey_urxvt_mouse;
// look for termcap keys // look for termcap keys
@ -511,8 +511,8 @@ int FTerm::parseKeyString ( char buffer[]
if ( std::strncmp(kmeta, buffer, uInt(len)) == 0 ) // found if ( std::strncmp(kmeta, buffer, uInt(len)) == 0 ) // found
{ {
if ( len == 2 && ( buffer[1] == 'O' if ( len == 2 && ( buffer[1] == 'O'
|| buffer[1] == '[' || buffer[1] == '['
|| buffer[1] == ']' ) ) || buffer[1] == ']' ) )
{ {
if ( ! isKeyTimeout(time_keypressed, key_timeout) ) if ( ! isKeyTimeout(time_keypressed, key_timeout) )
return NEED_MORE_DATA; return NEED_MORE_DATA;
@ -586,11 +586,11 @@ bool FTerm::setVGAFont()
return VGAFont; return VGAFont;
if ( gnome_terminal if ( gnome_terminal
|| kde_konsole || kde_konsole
|| putty_terminal || putty_terminal
|| tera_terminal || tera_terminal
|| cygwin_terminal || cygwin_terminal
|| mintty_terminal ) || mintty_terminal )
return false; return false;
VGAFont = true; VGAFont = true;
@ -658,15 +658,15 @@ bool FTerm::setNewFont()
return true; return true;
if ( gnome_terminal if ( gnome_terminal
|| kde_konsole || kde_konsole
|| putty_terminal || putty_terminal
|| tera_terminal || tera_terminal
|| cygwin_terminal || cygwin_terminal
|| mintty_terminal ) || mintty_terminal )
return false; return false;
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
NewFont = true; NewFont = true;
// Set font in xterm to 8x16graph // Set font in xterm to 8x16graph
@ -735,7 +735,7 @@ bool FTerm::setOldFont()
VGAFont = false; VGAFont = false;
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
if ( xterm_font && xterm_font->getLength() > 2 ) if ( xterm_font && xterm_font->getLength() > 2 )
{ {
@ -1066,8 +1066,8 @@ void FTerm::setXTermTitle (const FString& title)
{ {
// Set the xterm title // Set the xterm title
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| mintty_terminal || putty_terminal || mintty_terminal || putty_terminal
|| FTermcap::osc_support ) || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "0;%s" BEL, title.c_str()); putstringf (OSC "0;%s" BEL, title.c_str());
@ -1081,8 +1081,8 @@ void FTerm::setXTermForeground (const FString& fg)
{ {
// Set the VT100 text foreground color // Set the VT100 text foreground color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| mintty_terminal || mlterm_terminal || mintty_terminal || mlterm_terminal
|| FTermcap::osc_support ) || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "10;%s" BEL, fg.c_str()); putstringf (OSC "10;%s" BEL, fg.c_str());
@ -1096,8 +1096,8 @@ void FTerm::setXTermBackground (const FString& bg)
{ {
// Set the VT100 text background color // Set the VT100 text background color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| mintty_terminal || mlterm_terminal || mintty_terminal || mlterm_terminal
|| FTermcap::osc_support ) || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "11;%s" BEL, bg.c_str()); putstringf (OSC "11;%s" BEL, bg.c_str());
@ -1111,8 +1111,8 @@ void FTerm::setXTermCursorColor (const FString& cc)
{ {
// Set the text cursor color // Set the text cursor color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| mintty_terminal || urxvt_terminal || mintty_terminal || urxvt_terminal
|| FTermcap::osc_support ) || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "12;%s" BEL, cc.c_str()); putstringf (OSC "12;%s" BEL, cc.c_str());
@ -1126,7 +1126,7 @@ void FTerm::setXTermMouseForeground (const FString& mfg)
{ {
// Set the mouse foreground color // Set the mouse foreground color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "13;%s" BEL, mfg.c_str()); putstringf (OSC "13;%s" BEL, mfg.c_str());
@ -1153,7 +1153,7 @@ void FTerm::setXTermHighlightBackground (const FString& hbg)
{ {
// Set the highlight background color // Set the highlight background color
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "17;%s" BEL, hbg.c_str()); putstringf (OSC "17;%s" BEL, hbg.c_str());
@ -1175,7 +1175,7 @@ void FTerm::setXTermDefaults()
setXTermCursorColor("rgb:ffff/ffff/ffff"); setXTermCursorColor("rgb:ffff/ffff/ffff");
if ( xterm_default_colors if ( xterm_default_colors
&& ! (mintty_terminal || rxvt_terminal || screen_terminal) ) && ! (mintty_terminal || rxvt_terminal || screen_terminal) )
{ {
// mintty and rxvt can't reset these settings // mintty and rxvt can't reset these settings
setXTermBackground("rgb:8080/a4a4/ecec"); setXTermBackground("rgb:8080/a4a4/ecec");
@ -1295,7 +1295,7 @@ void FTerm::resetXTermHighlightBackground()
return; return;
if ( xterm_terminal || screen_terminal if ( xterm_terminal || screen_terminal
|| urxvt_terminal || FTermcap::osc_support ) || urxvt_terminal || FTermcap::osc_support )
{ {
oscPrefix(); oscPrefix();
putstringf (OSC "117" BEL); putstringf (OSC "117" BEL);
@ -1393,8 +1393,8 @@ void FTerm::setPalette (short index, int r, int g, int b)
{ {
/* // direct vga-register set /* // direct vga-register set
if ( r>=0 && r<256 if ( r>=0 && r<256
&& g>=0 && g<256 && g>=0 && g<256
&& b>=0 && b<256 ) && b>=0 && b<256 )
{ {
map.d[index].red = r; map.d[index].red = r;
map.d[index].green = g; map.d[index].green = g;
@ -1458,9 +1458,9 @@ void FTerm::setEncoding (fc::encoding enc)
term_encoding = enc; term_encoding = enc;
assert ( term_encoding == fc::UTF8 assert ( term_encoding == fc::UTF8
|| term_encoding == fc::VT100 || term_encoding == fc::VT100
|| term_encoding == fc::PC || term_encoding == fc::PC
|| term_encoding == fc::ASCII ); || term_encoding == fc::ASCII );
// set the new Fputchar function pointer // set the new Fputchar function pointer
switch ( term_encoding ) switch ( term_encoding )
@ -1740,8 +1740,8 @@ void FTerm::initLinuxConsoleCharMap()
c3 = fc::FullBlock; c3 = fc::FullBlock;
if ( charEncode(c1, fc::PC) == charEncode(c1, fc::ASCII) if ( charEncode(c1, fc::PC) == charEncode(c1, fc::ASCII)
|| charEncode(c2, fc::PC) == charEncode(c2, fc::ASCII) || charEncode(c2, fc::PC) == charEncode(c2, fc::ASCII)
|| charEncode(c3, fc::PC) == charEncode(c3, fc::ASCII) ) || charEncode(c3, fc::PC) == charEncode(c3, fc::ASCII) )
{ {
no_shadow_character = true; no_shadow_character = true;
} }
@ -1750,7 +1750,7 @@ void FTerm::initLinuxConsoleCharMap()
c5 = fc::LeftHalfBlock; c5 = fc::LeftHalfBlock;
if ( charEncode(c4, fc::PC) == charEncode(c4, fc::ASCII) if ( charEncode(c4, fc::PC) == charEncode(c4, fc::ASCII)
|| charEncode(c5, fc::PC) == charEncode(c5, fc::ASCII) ) || charEncode(c5, fc::PC) == charEncode(c5, fc::ASCII) )
{ {
no_half_block_character = true; no_half_block_character = true;
} }
@ -1923,8 +1923,8 @@ int FTerm::isLinuxConsole()
char arg = 0; char arg = 0;
// get keyboard type an compare // get keyboard type an compare
return ( isatty (fd_tty) return ( isatty (fd_tty)
&& ioctl(fd_tty, KDGKBTYPE, &arg) == 0 && ioctl(fd_tty, KDGKBTYPE, &arg) == 0
&& ((arg == KB_101) || (arg == KB_84)) ); && ((arg == KB_101) || (arg == KB_84)) );
} }
#endif #endif
@ -2081,7 +2081,7 @@ int FTerm::getFramebuffer_bpp ()
} }
if ( ! ioctl(fd, FBIOGET_VSCREENINFO, &fb_var) if ( ! ioctl(fd, FBIOGET_VSCREENINFO, &fb_var)
&& ! ioctl(fd, FBIOGET_FSCREENINFO, &fb_fix) ) && ! ioctl(fd, FBIOGET_FSCREENINFO, &fb_fix) )
{ {
::close(fd); ::close(fd);
return int(fb_var.bits_per_pixel); return int(fb_var.bits_per_pixel);
@ -2713,9 +2713,9 @@ void FTerm::detectTerminal()
new_termtype = determineMaxColor(new_termtype); new_termtype = determineMaxColor(new_termtype);
if ( cygwin_terminal if ( cygwin_terminal
|| putty_terminal || putty_terminal
|| tera_terminal || tera_terminal
|| rxvt_terminal ) || rxvt_terminal )
{ {
FTermcap::max_color = 16; FTermcap::max_color = 16;
} }
@ -2730,7 +2730,7 @@ void FTerm::detectTerminal()
// Test if the terminal is a xterm // Test if the terminal is a xterm
if ( std::strncmp(termtype, const_cast<char*>("xterm"), 5) == 0 if ( std::strncmp(termtype, const_cast<char*>("xterm"), 5) == 0
|| std::strncmp(termtype, const_cast<char*>("Eterm"), 5) == 0 ) || std::strncmp(termtype, const_cast<char*>("Eterm"), 5) == 0 )
{ {
xterm_terminal = true; xterm_terminal = true;
@ -2771,7 +2771,7 @@ void FTerm::termtypeAnalysis()
// Linux console // Linux console
if ( std::strncmp(termtype, const_cast<char*>("linux"), 5) == 0 if ( std::strncmp(termtype, const_cast<char*>("linux"), 5) == 0
|| std::strncmp(termtype, const_cast<char*>("con"), 3) == 0 ) || std::strncmp(termtype, const_cast<char*>("con"), 3) == 0 )
linux_terminal = true; linux_terminal = true;
else else
linux_terminal = false; linux_terminal = false;
@ -2841,8 +2841,8 @@ char* FTerm::init_256colorTerminal()
} }
if ( std::strncmp(termtype, "rxvt", 4) != 0 if ( std::strncmp(termtype, "rxvt", 4) != 0
&& s1 && s1
&& std::strncmp(s1, "rxvt-xpm", 8) == 0 ) && std::strncmp(s1, "rxvt-xpm", 8) == 0 )
{ {
new_termtype = const_cast<char*>("rxvt-256color"); new_termtype = const_cast<char*>("rxvt-256color");
rxvt_terminal = true; rxvt_terminal = true;
@ -2885,11 +2885,11 @@ char* FTerm::determineMaxColor (char*& current_termtype)
char* new_termtype = current_termtype; char* new_termtype = current_termtype;
if ( ! color256 if ( ! color256
&& ! cygwin_terminal && ! cygwin_terminal
&& ! tera_terminal && ! tera_terminal
&& ! linux_terminal && ! linux_terminal
&& ! netbsd_terminal && ! netbsd_terminal
&& ! getXTermColorName(0).isEmpty() ) && ! getXTermColorName(0).isEmpty() )
{ {
if ( ! getXTermColorName(256).isEmpty() ) if ( ! getXTermColorName(256).isEmpty() )
{ {
@ -3098,7 +3098,7 @@ char* FTerm::parseSecDA (char*& current_termtype)
force_vt100 = true; // this rxvt terminal support on utf-8 force_vt100 = true; // this rxvt terminal support on utf-8
if ( std::strncmp(termtype, "rxvt-", 5) != 0 if ( std::strncmp(termtype, "rxvt-", 5) != 0
&& std::strncmp(termtype, "rxvt-cygwin-native", 18) == 0 ) && std::strncmp(termtype, "rxvt-cygwin-native", 18) == 0 )
new_termtype = const_cast<char*>("rxvt-16color"); new_termtype = const_cast<char*>("rxvt-16color");
break; break;
@ -3270,9 +3270,9 @@ void FTerm::init_cygwin_charmap()
for (int i = 0; i <= lastCharItem; i++ ) for (int i = 0; i <= lastCharItem; i++ )
{ {
if ( character[i][fc::UTF8] == fc::BlackUpPointingTriangle // ▲ if ( character[i][fc::UTF8] == fc::BlackUpPointingTriangle // ▲
|| character[i][fc::UTF8] == fc::BlackDownPointingTriangle // ▼ || character[i][fc::UTF8] == fc::BlackDownPointingTriangle // ▼
|| character[i][fc::UTF8] == fc::SquareRoot ) // SquareRoot √ || character[i][fc::UTF8] == fc::SquareRoot ) // SquareRoot √
character[i][fc::PC] = character[i][fc::ASCII]; character[i][fc::PC] = character[i][fc::ASCII];
} }
} }
@ -3823,7 +3823,7 @@ void FTerm::init_termcaps_general_quirks()
// Test for standard ECMA-48 (ANSI X3.64) terminal // Test for standard ECMA-48 (ANSI X3.64) terminal
if ( TCAP(fc::t_exit_underline_mode) if ( TCAP(fc::t_exit_underline_mode)
&& std::strncmp(TCAP(fc::t_exit_underline_mode), CSI "24m", 5) == 0 ) && std::strncmp(TCAP(fc::t_exit_underline_mode), CSI "24m", 5) == 0 )
{ {
// Seems to be a ECMA-48 (ANSI X3.64) compatible terminal // Seems to be a ECMA-48 (ANSI X3.64) compatible terminal
TCAP(fc::t_enter_dbl_underline_mode) = \ TCAP(fc::t_enter_dbl_underline_mode) = \
@ -3897,8 +3897,8 @@ void FTerm::init_termcaps_keys (char*& buffer)
char* key_up_string = tgetstr(const_cast<char*>("ku"), &buffer); char* key_up_string = tgetstr(const_cast<char*>("ku"), &buffer);
if ( (key_up_string && (std::strcmp(key_up_string, CSI "A") == 0)) if ( (key_up_string && (std::strcmp(key_up_string, CSI "A") == 0))
|| ( TCAP(fc::t_cursor_up) || ( TCAP(fc::t_cursor_up)
&& (std::strcmp(TCAP(fc::t_cursor_up), CSI "A") == 0) ) ) && (std::strcmp(TCAP(fc::t_cursor_up), CSI "A") == 0) ) )
{ {
for (int i = 0; Fkey[i].tname[0] != 0; i++) for (int i = 0; Fkey[i].tname[0] != 0; i++)
{ {
@ -4087,7 +4087,7 @@ void FTerm::init_encoding()
(*encoding_set)["ASCII"] = fc::ASCII; (*encoding_set)["ASCII"] = fc::ASCII;
if ( isatty(stdout_no) if ( isatty(stdout_no)
&& ! std::strcmp(nl_langinfo(CODESET), "UTF-8") ) && ! std::strcmp(nl_langinfo(CODESET), "UTF-8") )
{ {
utf8_console = true; utf8_console = true;
term_encoding = fc::UTF8; term_encoding = fc::UTF8;
@ -4097,8 +4097,8 @@ void FTerm::init_encoding()
setUTF8(true); setUTF8(true);
} }
else if ( isatty(stdout_no) else if ( isatty(stdout_no)
&& (std::strlen(termtype) > 0) && (std::strlen(termtype) > 0)
&& (TCAP(fc::t_exit_alt_charset_mode) != 0) ) && (TCAP(fc::t_exit_alt_charset_mode) != 0) )
{ {
vt100_console = true; vt100_console = true;
term_encoding = fc::VT100; term_encoding = fc::VT100;
@ -4114,10 +4114,10 @@ void FTerm::init_encoding()
init_pc_charset(); init_pc_charset();
if ( linux_terminal if ( linux_terminal
|| cygwin_terminal || cygwin_terminal
|| NewFont || NewFont
|| (putty_terminal && ! utf8_state) || (putty_terminal && ! utf8_state)
|| (tera_terminal && ! utf8_state) ) || (tera_terminal && ! utf8_state) )
{ {
pc_charset_console = true; pc_charset_console = true;
term_encoding = fc::PC; term_encoding = fc::PC;
@ -4155,9 +4155,9 @@ void FTerm::init_encoding()
void FTerm::redefineColorPalette() void FTerm::redefineColorPalette()
{ {
if ( ! cygwin_terminal if ( ! cygwin_terminal
&& ! kde_konsole && ! kde_konsole
&& ! tera_terminal && ! tera_terminal
&& ! ansi_terminal ) && ! ansi_terminal )
{ {
resetColorMap(); resetColorMap();
saveColorMap(); saveColorMap();

View File

@ -452,8 +452,8 @@ void FTextView::onMouseDown (FMouseEvent* ev)
dialog = static_cast<FDialog*>(parent); dialog = static_cast<FDialog*>(parent);
if ( parent->isDialogWidget() if ( parent->isDialogWidget()
&& dialog->isResizeable() && dialog->isResizeable()
&& ! dialog->isZoomed() ) && ! dialog->isZoomed() )
{ {
int b = ev->getButton(); int b = ev->getButton();
const FPoint& tp = ev->getTermPos(); const FPoint& tp = ev->getTermPos();
@ -716,12 +716,12 @@ void FTextView::draw()
setReverse(true); setReverse(true);
if ( parent if ( parent
&& parent->isDialogWidget() && parent->isDialogWidget()
&& isPaddingIgnored() && isPaddingIgnored()
&& getGeometry() == FRect ( 1 && getGeometry() == FRect ( 1
, 2 , 2
, parent->getWidth() , parent->getWidth()
, parent->getHeight() - 1) ) , parent->getHeight() - 1) )
{ {
is_text_dialog = true; is_text_dialog = true;
} }
@ -795,7 +795,7 @@ void FTextView::drawText()
// only printable and 1 column per character // only printable and 1 column per character
if ( ( (utf8 && std::iswprint(wint_t(ch))) if ( ( (utf8 && std::iswprint(wint_t(ch)))
|| (!utf8 && ch < 256 && std::isprint(ch)) ) || (!utf8 && ch < 256 && std::isprint(ch)) )
&& wcwidth(ch) == 1 ) && wcwidth(ch) == 1 )
{ {
print (ch); print (ch);
@ -898,7 +898,7 @@ void FTextView::cb_VBarChange (FWidget*, data_ptr)
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollPageForward ) && scrollType <= FScrollbar::scrollPageForward )
{ {
vbar->setValue (yoffset); vbar->setValue (yoffset);
@ -996,7 +996,7 @@ void FTextView::cb_HBarChange (FWidget*, data_ptr)
} }
if ( scrollType >= FScrollbar::scrollStepBackward if ( scrollType >= FScrollbar::scrollStepBackward
&& scrollType <= FScrollbar::scrollWheelDown ) && scrollType <= FScrollbar::scrollWheelDown )
{ {
hbar->setValue (xoffset); hbar->setValue (xoffset);

View File

@ -398,14 +398,14 @@ void FToggleButton::onFocusOut (FFocusEvent* out_ev)
redraw(); redraw();
} }
else if ( this == getGroup()->getLastButton() else if ( this == getGroup()->getLastButton()
&& out_ev->getFocusType() == fc::FocusNextWidget ) && out_ev->getFocusType() == fc::FocusNextWidget )
{ {
out_ev->ignore(); out_ev->ignore();
getGroup()->focusNextChild(); getGroup()->focusNextChild();
redraw(); redraw();
} }
else if ( this == getGroup()->getFirstButton() else if ( this == getGroup()->getFirstButton()
&& out_ev->getFocusType() == fc::FocusPreviousWidget ) && out_ev->getFocusType() == fc::FocusPreviousWidget )
{ {
out_ev->ignore(); out_ev->ignore();
getGroup()->focusPrevChild(); getGroup()->focusPrevChild();

View File

@ -244,7 +244,7 @@ void FVTerm::updateTerminal()
// Updates pending changes to the terminal // Updates pending changes to the terminal
if ( stop_terminal_updates if ( stop_terminal_updates
|| static_cast<FApplication*>(init_object)->isQuit() ) || static_cast<FApplication*>(init_object)->isQuit() )
return; return;
if ( ! force_terminal_update ) if ( ! force_terminal_update )
@ -638,9 +638,9 @@ int FVTerm::print (term_area* area, char_data& term_char)
ay = area->cursor_y - 1; ay = area->cursor_y - 1;
if ( area->cursor_x > 0 if ( area->cursor_x > 0
&& area->cursor_y > 0 && area->cursor_y > 0
&& ax < area->width + area->right_shadow && ax < area->width + area->right_shadow
&& ay < area->height + area->bottom_shadow ) && ay < area->height + area->bottom_shadow )
{ {
char_data* ac; // area character char_data* ac; // area character
int line_len = area->width + area->right_shadow; int line_len = area->width + area->right_shadow;
@ -648,17 +648,17 @@ int FVTerm::print (term_area* area, char_data& term_char)
if ( *ac != nc ) // compare with an overloaded operator if ( *ac != nc ) // compare with an overloaded operator
{ {
if ( ( ! ac->attr.bit.transparent && nc.attr.bit.transparent ) if ( ( ! ac->attr.bit.transparent && nc.attr.bit.transparent )
|| ( ! ac->attr.bit.trans_shadow && nc.attr.bit.trans_shadow ) || ( ! ac->attr.bit.trans_shadow && nc.attr.bit.trans_shadow )
|| ( ! ac->attr.bit.inherit_bg && nc.attr.bit.inherit_bg ) ) || ( ! ac->attr.bit.inherit_bg && nc.attr.bit.inherit_bg ) )
{ {
// add one transparent character form line // add one transparent character form line
area->changes[ay].trans_count++; area->changes[ay].trans_count++;
} }
if ( ( ac->attr.bit.transparent && ! nc.attr.bit.transparent ) if ( ( ac->attr.bit.transparent && ! nc.attr.bit.transparent )
|| ( ac->attr.bit.trans_shadow && ! nc.attr.bit.trans_shadow ) || ( ac->attr.bit.trans_shadow && ! nc.attr.bit.trans_shadow )
|| ( ac->attr.bit.inherit_bg && ! nc.attr.bit.inherit_bg ) ) || ( ac->attr.bit.inherit_bg && ! nc.attr.bit.inherit_bg ) )
{ {
// remove one transparent character from line // remove one transparent character from line
area->changes[ay].trans_count--; area->changes[ay].trans_count--;
@ -830,9 +830,9 @@ void FVTerm::resizeArea ( int offset_left, int offset_top
return; return;
if ( width == area->width if ( width == area->width
&& height == area->height && height == area->height
&& rsw == area->right_shadow && rsw == area->right_shadow
&& bsh == area->bottom_shadow ) && bsh == area->bottom_shadow )
{ {
if ( offset_left != area->offset_left ) if ( offset_left != area->offset_left )
area->offset_left = offset_left; area->offset_left = offset_left;
@ -1023,11 +1023,11 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
s_ch.attr.bit.standout = false; s_ch.attr.bit.standout = false;
if ( s_ch.code == fc::LowerHalfBlock if ( s_ch.code == fc::LowerHalfBlock
|| s_ch.code == fc::UpperHalfBlock || s_ch.code == fc::UpperHalfBlock
|| s_ch.code == fc::LeftHalfBlock || s_ch.code == fc::LeftHalfBlock
|| s_ch.code == fc::RightHalfBlock || s_ch.code == fc::RightHalfBlock
|| s_ch.code == fc::MediumShade || s_ch.code == fc::MediumShade
|| s_ch.code == fc::FullBlock ) || s_ch.code == fc::FullBlock )
s_ch.code = ' '; s_ch.code = ' ';
sc = &s_ch; sc = &s_ch;
@ -1172,7 +1172,7 @@ void FVTerm::updateVTerm()
while ( iter2 != end2 ) while ( iter2 != end2 )
{ {
if ( iter2->instance->child_print_area if ( iter2->instance->child_print_area
&& iter2->instance->child_print_area->has_changes ) && iter2->instance->child_print_area->has_changes )
{ {
updateVTerm(win); updateVTerm(win);
iter2->instance->child_print_area->has_changes = false; iter2->instance->child_print_area->has_changes = false;
@ -1284,11 +1284,11 @@ void FVTerm::updateVTerm (term_area* area)
ch.attr.bit.standout = false; ch.attr.bit.standout = false;
if ( ch.code == fc::LowerHalfBlock if ( ch.code == fc::LowerHalfBlock
|| ch.code == fc::UpperHalfBlock || ch.code == fc::UpperHalfBlock
|| ch.code == fc::LeftHalfBlock || ch.code == fc::LeftHalfBlock
|| ch.code == fc::RightHalfBlock || ch.code == fc::RightHalfBlock
|| ch.code == fc::MediumShade || ch.code == fc::MediumShade
|| ch.code == fc::FullBlock ) || ch.code == fc::FullBlock )
ch.code = ' '; ch.code = ' ';
ch.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == ch); ch.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == ch);
@ -1315,11 +1315,11 @@ void FVTerm::updateVTerm (term_area* area)
ch.attr.bit.standout = false; ch.attr.bit.standout = false;
if ( ch.code == fc::LowerHalfBlock if ( ch.code == fc::LowerHalfBlock
|| ch.code == fc::UpperHalfBlock || ch.code == fc::UpperHalfBlock
|| ch.code == fc::LeftHalfBlock || ch.code == fc::LeftHalfBlock
|| ch.code == fc::RightHalfBlock || ch.code == fc::RightHalfBlock
|| ch.code == fc::MediumShade || ch.code == fc::MediumShade
|| ch.code == fc::FullBlock ) || ch.code == fc::FullBlock )
ch.code = ' '; ch.code = ' ';
ch.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == ch); ch.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == ch);
@ -1402,8 +1402,8 @@ bool FVTerm::updateVTermCursor (term_area* area)
y = ay + cy; y = ay + cy;
if ( isInsideArea(cx, cy, area) if ( isInsideArea(cx, cy, area)
&& isInsideTerminal(x, y) && isInsideTerminal(x, y)
&& isCovered(x, y, area) == non_covered ) && isCovered(x, y, area) == non_covered )
{ {
vterm->input_cursor_x = x; vterm->input_cursor_x = x;
vterm->input_cursor_y = y; vterm->input_cursor_y = y;
@ -1651,11 +1651,11 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
ch.attr.bit.standout = false; ch.attr.bit.standout = false;
if ( ch.code == fc::LowerHalfBlock if ( ch.code == fc::LowerHalfBlock
|| ch.code == fc::UpperHalfBlock || ch.code == fc::UpperHalfBlock
|| ch.code == fc::LeftHalfBlock || ch.code == fc::LeftHalfBlock
|| ch.code == fc::RightHalfBlock || ch.code == fc::RightHalfBlock
|| ch.code == fc::MediumShade || ch.code == fc::MediumShade
|| ch.code == fc::FullBlock ) || ch.code == fc::FullBlock )
ch.code = ' '; ch.code = ' ';
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(char_data));
@ -1878,8 +1878,8 @@ void FVTerm::clearArea (term_area* area, int fillchar)
area->changes[i].xmax = w - 1; area->changes[i].xmax = w - 1;
if ( nc.attr.bit.transparent if ( nc.attr.bit.transparent
|| nc.attr.bit.trans_shadow || nc.attr.bit.trans_shadow
|| nc.attr.bit.inherit_bg ) || nc.attr.bit.inherit_bg )
area->changes[i].trans_count = w; area->changes[i].trans_count = w;
else if ( area->right_shadow != 0 ) else if ( area->right_shadow != 0 )
area->changes[i].trans_count = uInt(area->right_shadow); area->changes[i].trans_count = uInt(area->right_shadow);
@ -2210,7 +2210,7 @@ bool FVTerm::clearTerm (int fillchar)
appendAttributes(next); appendAttributes(next);
if ( ! ( (cl || cd || cb) && (normal || ut) ) if ( ! ( (cl || cd || cb) && (normal || ut) )
|| fillchar != ' ' ) || fillchar != ' ' )
{ {
return false; return false;
} }
@ -2282,8 +2282,8 @@ void FVTerm::updateTerminalLine (uInt y)
} }
if ( beginning_whitespace == uInt(vt->width) - xmin if ( beginning_whitespace == uInt(vt->width) - xmin
&& (ut || normal) && (ut || normal)
&& clr_eol_length < int(beginning_whitespace) ) && clr_eol_length < int(beginning_whitespace) )
is_eol_clean = true; is_eol_clean = true;
} }
@ -2306,8 +2306,8 @@ void FVTerm::updateTerminalLine (uInt y)
} }
if ( leading_whitespace > xmin if ( leading_whitespace > xmin
&& (ut || normal) && (ut || normal)
&& clr_bol_length < int(leading_whitespace) ) && clr_bol_length < int(leading_whitespace) )
{ {
draw_leading_ws = true; draw_leading_ws = true;
xmin = leading_whitespace - 1; xmin = leading_whitespace - 1;
@ -2331,8 +2331,8 @@ void FVTerm::updateTerminalLine (uInt y)
} }
if ( tailing_whitespace > uInt(vt->width) - xmax if ( tailing_whitespace > uInt(vt->width) - xmax
&& (ut || normal) && (ut || normal)
&& clr_bol_length < int(tailing_whitespace) ) && clr_bol_length < int(tailing_whitespace) )
{ {
draw_tailing_ws = true; draw_tailing_ws = true;
xmax = uInt(vt->width) - tailing_whitespace; xmax = uInt(vt->width) - tailing_whitespace;
@ -2414,7 +2414,7 @@ void FVTerm::updateTerminalLine (uInt y)
uInt start_pos = x; uInt start_pos = x;
if ( whitespace > uInt(erase_ch_length) + uInt(cursor_addres_lengths) if ( whitespace > uInt(erase_ch_length) + uInt(cursor_addres_lengths)
&& (ut || normal) ) && (ut || normal) )
{ {
appendAttributes (print_char); appendAttributes (print_char);
appendOutputBuffer (tparm(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0)); appendOutputBuffer (tparm(ec, whitespace, 0, 0, 0, 0, 0, 0, 0, 0));
@ -2461,7 +2461,7 @@ void FVTerm::updateTerminalLine (uInt y)
uInt start_pos = x; uInt start_pos = x;
if ( repetitions > uInt(repeat_char_length) if ( repetitions > uInt(repeat_char_length)
&& print_char->code < 128 ) && print_char->code < 128 )
{ {
newFontChanges (print_char); newFontChanges (print_char);
charsetChanges (print_char); charsetChanges (print_char);
@ -2661,7 +2661,7 @@ inline void FVTerm::appendCharacter (char_data*& next_char)
int term_height = vterm->height - 1; int term_height = vterm->height - 1;
if ( term_pos->getX() == term_width if ( term_pos->getX() == term_width
&& term_pos->getY() == term_height ) && term_pos->getY() == term_height )
appendLowerRight (next_char); appendLowerRight (next_char);
else else
appendChar (next_char); appendChar (next_char);

View File

@ -91,7 +91,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
if ( ! parent ) if ( ! parent )
{ {
assert ( ! rootObject assert ( ! rootObject
&& "FTerm: There should be only one root object" ); && "FTerm: There should be only one root object" );
rootObject = this; rootObject = this;
show_root_widget = 0; show_root_widget = 0;
@ -292,9 +292,9 @@ FPoint FWidget::getPrintPos()
std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side) std::vector<bool>& FWidget::doubleFlatLine_ref (fc::sides side)
{ {
assert ( side == fc::top assert ( side == fc::top
|| side == fc::right || side == fc::right
|| side == fc::bottom || side == fc::bottom
|| side == fc::left ); || side == fc::left );
switch ( side ) switch ( side )
{ {
@ -390,7 +390,7 @@ bool FWidget::setFocus (bool on)
last_focus->unsetFocus(); last_focus->unsetFocus();
if ( (!isDialogWidget() && focusable_children == 0) if ( (!isDialogWidget() && focusable_children == 0)
|| (isDialogWidget() && focusable_children == 1) ) || (isDialogWidget() && focusable_children == 1) )
{ {
FWidget::setFocusWidget(this); FWidget::setFocusWidget(this);
} }
@ -458,7 +458,7 @@ void FWidget::setY (int y, bool adjust)
void FWidget::setPos (int x, int y, bool adjust) void FWidget::setPos (int x, int y, bool adjust)
{ {
if ( getX() == x && wsize.getX() == x if ( getX() == x && wsize.getX() == x
&& getY() == y && wsize.getY() == y ) && getY() == y && wsize.getY() == y )
{ {
return; return;
} }
@ -532,7 +532,7 @@ void FWidget::setSize (int width, int height, bool adjust)
height = std::max (height, size_hints.min_height); height = std::max (height, size_hints.min_height);
if ( getWidth() == width && wsize.getWidth() == width if ( getWidth() == width && wsize.getWidth() == width
&& getHeight() == height && wsize.getHeight() == height ) && getHeight() == height && wsize.getHeight() == height )
return; return;
if ( width < 1 ) if ( width < 1 )
@ -777,9 +777,9 @@ void FWidget::setDoubleFlatLine (fc::sides side, bool bit)
uLong length; uLong length;
assert ( side == fc::top assert ( side == fc::top
|| side == fc::right || side == fc::right
|| side == fc::bottom || side == fc::bottom
|| side == fc::left ); || side == fc::left );
switch ( side ) switch ( side )
{ {
@ -811,9 +811,9 @@ void FWidget::setDoubleFlatLine (fc::sides side, int pos, bool bit)
uLong length, index; uLong length, index;
assert ( side == fc::top assert ( side == fc::top
|| side == fc::right || side == fc::right
|| side == fc::bottom || side == fc::bottom
|| side == fc::left ); || side == fc::left );
assert ( pos >= 1 ); assert ( pos >= 1 );
@ -875,9 +875,9 @@ FWidget* FWidget::childWidgetAt (FWidget* p, int x, int y)
FWidget* widget = static_cast<FWidget*>(*iter); FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() if ( widget->isEnabled()
&& widget->isVisible() && widget->isVisible()
&& ! widget->isWindowWidget() && ! widget->isWindowWidget()
&& widget->getTermGeometry().contains(x, y) ) && widget->getTermGeometry().contains(x, y) )
{ {
FWidget* child = childWidgetAt(widget, x, y); FWidget* child = childWidgetAt(widget, x, y);
return ( child != 0 ) ? child : widget; return ( child != 0 ) ? child : widget;
@ -1079,8 +1079,8 @@ void FWidget::delAccelerator (FWidget* obj)
widget = getRootWidget(); widget = getRootWidget();
if ( widget if ( widget
&& widget->accelerator_list && widget->accelerator_list
&& ! widget->accelerator_list->empty() ) && ! widget->accelerator_list->empty() )
{ {
FWidget::Accelerators::iterator iter; FWidget::Accelerators::iterator iter;
iter = widget->accelerator_list->begin(); iter = widget->accelerator_list->begin();
@ -1282,8 +1282,8 @@ void FWidget::hide()
shown = false; shown = false;
if ( ! isDialogWidget() if ( ! isDialogWidget()
&& FWidget::getFocusWidget() == this && FWidget::getFocusWidget() == this
&& ! focusPrevChild() ) && ! focusPrevChild() )
{ {
if ( FWidget::getFocusWidget() ) if ( FWidget::getFocusWidget() )
FWidget::getFocusWidget()->unsetFocus(); FWidget::getFocusWidget()->unsetFocus();
@ -1318,8 +1318,8 @@ bool FWidget::focusFirstChild()
FWidget* widget = static_cast<FWidget*>(*iter); FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() if ( widget->isEnabled()
&& widget->acceptFocus() && widget->acceptFocus()
&& ! widget->isMenuWidget() ) && ! widget->isMenuWidget() )
{ {
widget->setFocus(); widget->setFocus();
@ -1361,8 +1361,8 @@ bool FWidget::focusLastChild()
FWidget* widget = static_cast<FWidget*>(*iter); FWidget* widget = static_cast<FWidget*>(*iter);
if ( widget->isEnabled() if ( widget->isEnabled()
&& widget->acceptFocus() && widget->acceptFocus()
&& ! widget->isMenuWidget() ) && ! widget->isMenuWidget() )
{ {
widget->setFocus(); widget->setFocus();
@ -1412,7 +1412,7 @@ void FWidget::drawShadow()
return; return;
if ( (term_encoding == fc::VT100 && ! trans_shadow) if ( (term_encoding == fc::VT100 && ! trans_shadow)
|| (term_encoding == fc::ASCII && ! trans_shadow) ) || (term_encoding == fc::ASCII && ! trans_shadow) )
{ {
clearShadow(); clearShadow();
return; return;
@ -1817,8 +1817,8 @@ bool FWidget::isChildPrintArea() const
FWidget* p_obj = static_cast<FWidget*>(getParent()); FWidget* p_obj = static_cast<FWidget*>(getParent());
if ( p_obj if ( p_obj
&& p_obj->child_print_area && p_obj->child_print_area
&& p_obj->child_print_area == print_area ) && p_obj->child_print_area == print_area )
return true; return true;
else else
return false; return false;
@ -1974,10 +1974,10 @@ bool FWidget::focusNextChild()
next = static_cast<FWidget*>(*next_element); next = static_cast<FWidget*>(*next_element);
} while ( ! next } while ( ! next
|| ! next->isEnabled() || ! next->isEnabled()
|| ! next->acceptFocus() || ! next->acceptFocus()
|| ! next->isVisible() || ! next->isVisible()
|| next->isWindowWidget() ); || next->isWindowWidget() );
FFocusEvent out (fc::FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
out.setFocusType(fc::FocusNextWidget); out.setFocusType(fc::FocusNextWidget);
@ -2066,10 +2066,10 @@ bool FWidget::focusPrevChild()
--prev_element; --prev_element;
prev = static_cast<FWidget*>(*prev_element); prev = static_cast<FWidget*>(*prev_element);
} while ( ! prev } while ( ! prev
|| ! prev->isEnabled() || ! prev->isEnabled()
|| ! prev->acceptFocus() || ! prev->acceptFocus()
|| ! prev->isVisible() || ! prev->isVisible()
|| prev->isWindowWidget() ); || prev->isWindowWidget() );
FFocusEvent out (fc::FocusOut_Event); FFocusEvent out (fc::FocusOut_Event);
out.setFocusType(fc::FocusPreviousWidget); out.setFocusType(fc::FocusPreviousWidget);
@ -2142,10 +2142,10 @@ bool FWidget::event (FEvent* ev)
if ( ! kev->isAccepted() ) if ( ! kev->isAccepted() )
{ {
if ( kev->key() == fc::Fkey_right if ( kev->key() == fc::Fkey_right
|| kev->key() == fc::Fkey_down ) || kev->key() == fc::Fkey_down )
accpt_focus = focusNextChild(); accpt_focus = focusNextChild();
else if ( kev->key() == fc::Fkey_left else if ( kev->key() == fc::Fkey_left
|| kev->key() == fc::Fkey_up ) || kev->key() == fc::Fkey_up )
accpt_focus = focusPrevChild(); accpt_focus = focusPrevChild();
if ( accpt_focus ) if ( accpt_focus )

View File

@ -404,7 +404,7 @@ void FWindow::setSize (int w, int h, bool adjust)
FWidget::setSize (w, h, adjust); FWidget::setSize (w, h, adjust);
if ( isVirtualWindow() if ( isVirtualWindow()
&& (getWidth() != old_width || getHeight() != old_height) ) && (getWidth() != old_width || getHeight() != old_height) )
{ {
FRect geometry = getTermGeometry(); FRect geometry = getTermGeometry();
geometry.move(-1, -1); geometry.move(-1, -1);
@ -476,7 +476,7 @@ FWindow* FWindow::getWindowWidgetAt (int x, int y)
FWindow* w = static_cast<FWindow*>(*iter); FWindow* w = static_cast<FWindow*>(*iter);
if ( ! w->isWindowHidden() if ( ! w->isWindowHidden()
&& w->getTermGeometry().contains(x, y) ) && w->getTermGeometry().contains(x, y) )
return w; return w;
} }
} }
@ -627,7 +627,7 @@ bool FWindow::raiseWindow (FWidget* obj)
return false; return false;
if ( (window_list->back()->getFlags() & fc::modal) != 0 if ( (window_list->back()->getFlags() & fc::modal) != 0
&& ! obj->isMenuWidget() ) && ! obj->isMenuWidget() )
return false; return false;
iter = window_list->begin(); iter = window_list->begin();
@ -737,10 +737,10 @@ void FWindow::switchToPrevWindow()
FWindow* w = static_cast<FWindow*>(*iter); FWindow* w = static_cast<FWindow*>(*iter);
if ( w if ( w
&& w != active_window && w != active_window
&& ! (w->isWindowHidden() || w->isWindowActive()) && ! (w->isWindowHidden() || w->isWindowActive())
&& w != static_cast<FWindow*>(getStatusBar()) && w != static_cast<FWindow*>(getStatusBar())
&& w != static_cast<FWindow*>(getMenuBar()) ) && w != static_cast<FWindow*>(getMenuBar()) )
{ {
setActiveWindow(w); setActiveWindow(w);
break; break;
@ -800,7 +800,7 @@ void FWindow::setShadowSize (int right, int bottom)
, new_bottom = getShadow().getY(); , new_bottom = getShadow().getY();
if ( isVirtualWindow() if ( isVirtualWindow()
&& (new_right != old_right || new_bottom != old_bottom) ) && (new_right != old_right || new_bottom != old_bottom) )
{ {
FRect geometry = getTermGeometry(); FRect geometry = getTermGeometry();
geometry.move(-1, -1); geometry.move(-1, -1);