From 5cb7b77f4eef5f07689016d981f43c43a68b7409 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 15 Jan 2017 19:48:27 +0100 Subject: [PATCH] Virtual window gets a preprocessing handler --- ChangeLog | 4 ++ build.sh | 4 +- src/fapp.cpp | 8 ++-- src/fdialog.cpp | 2 +- src/flistbox.cpp | 4 +- src/fmenu.cpp | 16 +++---- src/fmenubar.cpp | 20 ++++----- src/fscrollbar.cpp | 2 +- src/fscrollview.cpp | 46 +++++++++++++------ src/fstatusbar.cpp | 4 +- src/fterm.cpp | 6 +-- src/ftextview.cpp | 1 + src/fvterm.cpp | 107 +++++++++++++++++++++++++++----------------- src/fvterm.h | 44 +++++++++++------- src/fwidget.cpp | 9 ++-- src/fwindow.cpp | 20 ++++----- test/ui.cpp | 11 +++++ 17 files changed, 191 insertions(+), 117 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a272d6d..5e65163d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-01-15 Markus Gans + * Virtual window gets a preprocessing handler. This allows + a preprocessing method to be called before the vterm is updated. + 2017-01-07 Markus Gans * Add scrollTo and scrollBy methods to FScrollView diff --git a/build.sh b/build.sh index 9dd7f9ae..269871a3 100755 --- a/build.sh +++ b/build.sh @@ -8,8 +8,8 @@ case "$1" in ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic" ;; - "--fulldebug"|"fulldebug") - ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy" + "--/fulldebug"|"fulldebug") + ./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -fstack-protector -Wstrict-aliasing -Wstrict-aliasing=3 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy" ;; "--profile"|"profile") diff --git a/src/fapp.cpp b/src/fapp.cpp index f6664c1f..2f38eb54 100644 --- a/src/fapp.cpp +++ b/src/fapp.cpp @@ -359,10 +359,10 @@ void FApplication::cmd_options () FString encoding(optarg); encoding = encoding.toUpper(); - if ( encoding.includes("UTF8") - || encoding.includes("VT100") - || encoding.includes("PC") - || encoding.includes("ASCII") ) + if ( encoding.includes("UTF8") + || encoding.includes("VT100") + || encoding.includes("PC") + || encoding.includes("ASCII") ) { setEncoding(encoding.c_str()); } diff --git a/src/fdialog.cpp b/src/fdialog.cpp index f0a7ca33..cbf51a41 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -201,7 +201,7 @@ void FDialog::setPos (int x, int y, bool) height = getHeight(); // Avoid to move widget completely outside the terminal - if ( x+width <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() ) + if ( x+width <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() ) return; if ( isZoomed() ) diff --git a/src/flistbox.cpp b/src/flistbox.cpp index d733abaf..0b917059 100644 --- a/src/flistbox.cpp +++ b/src/flistbox.cpp @@ -996,8 +996,8 @@ void FListBox::onTimer (FTimerEvent*) } // handle multiple selections - if ( drag_scroll == FListBox::scrollUpSelect - || drag_scroll == FListBox::scrollDownSelect ) + if ( drag_scroll == FListBox::scrollUpSelect + || drag_scroll == FListBox::scrollDownSelect ) { if ( isMultiSelection() && current_before != current ) { diff --git a/src/fmenu.cpp b/src/fmenu.cpp index f6fb1224..d48f9896 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -1045,10 +1045,10 @@ bool FMenu::selectNextItem() next_element = item_list.begin(); next = static_cast(*next_element); } - while ( ! next->isEnabled() - || ! next->acceptFocus() - || ! next->isVisible() - || next->isSeparator() ); + while ( ! next->isEnabled() + || ! next->acceptFocus() + || ! next->isVisible() + || next->isSeparator() ); if ( next == *iter ) return false; @@ -1097,10 +1097,10 @@ bool FMenu::selectPrevItem() --prev_element; prev = static_cast(*prev_element); } - while ( ! prev->isEnabled() - || ! prev->acceptFocus() - || ! prev->isVisible() - || prev->isSeparator() ); + while ( ! prev->isEnabled() + || ! prev->acceptFocus() + || ! prev->isVisible() + || prev->isSeparator() ); if ( prev == *iter ) return false; diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index bc7c02a9..85d81a6d 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -97,8 +97,8 @@ void FMenuBar::onKeyPress (FKeyEvent* ev) redraw(); drop_down = true; } - else if ( ev->key() == fc::Fkey_return - || ev->key() == fc::Fkey_enter ) + else if ( ev->key() == fc::Fkey_return + || ev->key() == fc::Fkey_enter ) { unselectItem(); redraw(); @@ -345,9 +345,9 @@ void FMenuBar::onMouseMove (FMouseEvent* ev) x1 = (*iter)->getX(); x2 = (*iter)->getX() + (*iter)->getWidth(); - if ( mouse_x >= x1 - && mouse_x < x2 - && mouse_y == 1 ) + if ( mouse_x >= x1 + && mouse_x < x2 + && mouse_y == 1 ) { // Mouse pointer over item if ( (*iter)->isEnabled() && ! (*iter)->isSelected() ) @@ -382,9 +382,9 @@ void FMenuBar::onMouseMove (FMouseEvent* ev) } else { - if ( mouse_over_menubar - && (*iter)->isEnabled() - && (*iter)->isSelected() ) + if ( mouse_over_menubar + && (*iter)->isEnabled() + && (*iter)->isSelected() ) { // Unselect selected item without mouse focus (*iter)->unsetSelected(); @@ -401,8 +401,8 @@ void FMenuBar::onMouseMove (FMouseEvent* ev) FMenu* menu = getSelectedItem()->getMenu(); const FRect& menu_geometry = menu->getTermGeometry(); - if ( menu->getCount() > 0 - && menu_geometry.contains(ev->getTermPos()) ) + if ( menu->getCount() > 0 + && menu_geometry.contains(ev->getTermPos()) ) { FMouseEvent* _ev; const FPoint& t = ev->getTermPos(); diff --git a/src/fscrollbar.cpp b/src/fscrollbar.cpp index 4daa2e94..72bac9e1 100644 --- a/src/fscrollbar.cpp +++ b/src/fscrollbar.cpp @@ -633,7 +633,7 @@ FScrollbar::sType FScrollbar::getClickedScrollType (int x, int y) { stype = FScrollbar::scrollPageForward; // after slider } - else if ( y == getHeight() ) + else if ( y == getHeight() ) { stype = FScrollbar::scrollStepForward; // increment button } diff --git a/src/fscrollview.cpp b/src/fscrollview.cpp index 96c55d93..a89414ad 100644 --- a/src/fscrollview.cpp +++ b/src/fscrollview.cpp @@ -50,6 +50,10 @@ void FScrollView::setScrollWidth (int width) FPoint no_shadow(0,0); scroll_size.setWidth (width); resizeArea (scroll_size, no_shadow, viewport); + setPreprocessingHandler + ( + _PREPROC_HANDLER (this, &FScrollView::copy2area) + ); child_print_area = viewport; } @@ -73,6 +77,10 @@ void FScrollView::setScrollHeight (int height) FPoint no_shadow(0,0); scroll_size.setHeight (height); resizeArea (scroll_size, no_shadow, viewport); + setPreprocessingHandler + ( + _PREPROC_HANDLER (this, &FScrollView::copy2area) + ); child_print_area = viewport; } @@ -99,6 +107,10 @@ void FScrollView::setScrollSize (int width, int height) FPoint no_shadow(0,0); scroll_size.setSize (width, height); resizeArea (scroll_size, no_shadow, viewport); + setPreprocessingHandler + ( + _PREPROC_HANDLER (this, &FScrollView::copy2area) + ); child_print_area = viewport; } @@ -124,8 +136,8 @@ void FScrollView::setX (int x, bool adjust) if ( viewport ) { - viewport->x_offset = scroll_size.getX(); - viewport->y_offset = scroll_size.getY(); + viewport->offset_top = scroll_size.getX(); + viewport->offset_left = scroll_size.getY(); } } } @@ -141,8 +153,8 @@ void FScrollView::setY (int y, bool adjust) if ( viewport ) { - viewport->x_offset = scroll_size.getX(); - viewport->y_offset = scroll_size.getY(); + viewport->offset_top = scroll_size.getX(); + viewport->offset_left = scroll_size.getY(); } } } @@ -158,8 +170,8 @@ void FScrollView::setPos (int x, int y, bool adjust) { if ( viewport ) { - viewport->x_offset = scroll_size.getX(); - viewport->y_offset = scroll_size.getY(); + viewport->offset_top = scroll_size.getX(); + viewport->offset_left = scroll_size.getY(); } } } @@ -210,8 +222,8 @@ void FScrollView::setGeometry (int x, int y, int w, int h, bool adjust) } else if ( ! adjust && viewport ) { - viewport->x_offset = scroll_size.getX(); - viewport->y_offset = scroll_size.getY(); + viewport->offset_top = scroll_size.getX(); + viewport->offset_left = scroll_size.getY(); } } @@ -303,7 +315,7 @@ void FScrollView::draw() if ( FWidget* p = getParentWidget() ) setColor (p->getForegroundColor(), p->getBackgroundColor()); else - setColor (wc.dialog_fg, wc.dialog_bg); + setColor(); if ( isNewFont() ) drawBorder (1, 1, getWidth() - 1, getHeight()); @@ -496,8 +508,8 @@ void FScrollView::adjustSize() if ( viewport ) { - viewport->x_offset = scroll_size.getX(); - viewport->y_offset = scroll_size.getY(); + viewport->offset_top = scroll_size.getX(); + viewport->offset_left = scroll_size.getY(); } hbar->setMaximum (getScrollWidth() - getClientWidth()); @@ -536,8 +548,8 @@ void FScrollView::copy2area() if ( ! viewport->has_changes ) return; - ax = getTermX() - print_area->x_offset; - ay = getTermY() - print_area->y_offset; + ax = getTermX() - print_area->offset_top; + ay = getTermY() - print_area->offset_left; dx = scroll_offset.getX(); dy = scroll_offset.getY(); y_end = getClientHeight(); @@ -567,6 +579,9 @@ void FScrollView::copy2area() //---------------------------------------------------------------------- void FScrollView::init() { + setForegroundColor (wc.dialog_fg); + setBackgroundColor (wc.dialog_bg); + vbar = new FScrollbar(fc::vertical, this); vbar->setMinimum(0); vbar->setValue(0); @@ -582,6 +597,7 @@ void FScrollView::init() "change-value", _METHOD_CALLBACK (this, &FScrollView::cb_VBarChange) ); + hbar->addCallback ( "change-value", @@ -597,6 +613,10 @@ void FScrollView::init() FPoint no_shadow(0,0); scroll_size.setRect (1, 1, getClientWidth(), getClientHeight()); createArea (scroll_size, no_shadow, viewport); + setPreprocessingHandler + ( + _PREPROC_HANDLER (this, &FScrollView::copy2area) + ); if ( viewport ) child_print_area = viewport; diff --git a/src/fstatusbar.cpp b/src/fstatusbar.cpp index e196299a..94d69f63 100644 --- a/src/fstatusbar.cpp +++ b/src/fstatusbar.cpp @@ -250,8 +250,8 @@ void FStatusBar::drawMessage() if ( hasKeys ) { std::vector::const_iterator iter = key_list.end(); - isLastActiveFocus = bool( (*(iter-1))->isActivated() - || (*(iter-1))->hasMouseFocus() ); + isLastActiveFocus = bool ( (*(iter-1))->isActivated() + || (*(iter-1))->hasMouseFocus() ); } else isLastActiveFocus = false; diff --git a/src/fterm.cpp b/src/fterm.cpp index 7a24b24c..b2b3c4c2 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -1236,9 +1236,9 @@ void FTerm::setPalette (short index, int r, int g, int b) else if ( linux_terminal ) { /* // direct vga-register set - if ( r>=0 && r<256 - && g>=0 && g<256 - && b>=0 && b<256 ) + if ( r>=0 && r<256 + && g>=0 && g<256 + && b>=0 && b<256 ) { map.d[index].red = r; map.d[index].green = g; diff --git a/src/ftextview.cpp b/src/ftextview.cpp index 258ba596..259601c3 100644 --- a/src/ftextview.cpp +++ b/src/ftextview.cpp @@ -617,6 +617,7 @@ void FTextView::init() "change-value", _METHOD_CALLBACK (this, &FTextView::cb_VBarChange) ); + hbar->addCallback ( "change-value", diff --git a/src/fvterm.cpp b/src/fvterm.cpp index d2967817..858b320f 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -64,8 +64,8 @@ FPoint FVTerm::getPrintCursor() term_area* win = getPrintArea(); if ( win ) - return FPoint ( win->x_offset + win->cursor_x - , win->y_offset + win->cursor_y ); + return FPoint ( win->offset_top + win->cursor_x + , win->offset_left + win->cursor_y ); return FPoint(0,0); } @@ -150,8 +150,22 @@ void FVTerm::setPrintCursor (register int x, register int y) if ( win ) { - win->cursor_x = x - win->x_offset; - win->cursor_y = y - win->y_offset; + win->cursor_x = x - win->offset_top; + win->cursor_y = y - win->offset_left; + } +} + +//---------------------------------------------------------------------- +void FVTerm::setPreprocessingHandler ( FVTerm* instance + , FPreprocessingHandler handler ) +{ + if ( ! print_area ) + FVTerm::getPrintArea(); + + if ( print_area ) + { + print_area->pre_proc_instance = instance; + print_area->pre_proc = handler; } } @@ -668,7 +682,7 @@ void FVTerm::createArea ( const FRect& r } //---------------------------------------------------------------------- -void FVTerm::createArea ( int x_offset, int y_offset +void FVTerm::createArea ( int offset_top, int offset_left , int width, int height , int rsw, int bsh , term_area*& area ) @@ -677,8 +691,8 @@ void FVTerm::createArea ( int x_offset, int y_offset area = new term_area; - area->x_offset = 0; - area->y_offset = 0; + area->offset_top = 0; + area->offset_left = 0; area->width = -1; area->height = -1; area->right_shadow = 0; @@ -693,8 +707,10 @@ void FVTerm::createArea ( int x_offset, int y_offset area->text = 0; area->visible = false; area->widget = static_cast(this); + area->pre_proc_instance = 0; + area->pre_proc = 0; - resizeArea (x_offset, y_offset, width, height, rsw, bsh, area); + resizeArea (offset_top, offset_left, width, height, rsw, bsh, area); } //---------------------------------------------------------------------- @@ -712,7 +728,7 @@ void FVTerm::resizeArea ( const FRect& r } //---------------------------------------------------------------------- -void FVTerm::resizeArea ( int x_offset, int y_offset +void FVTerm::resizeArea ( int offset_top, int offset_left , int width, int height , int rsw, int bsh , term_area* area ) @@ -747,8 +763,8 @@ void FVTerm::resizeArea ( int x_offset, int y_offset else return; - area->x_offset = x_offset; - area->y_offset = y_offset; + area->offset_top = offset_top; + area->offset_left = offset_left; area->width = width; area->height = height; area->right_shadow = rsw; @@ -875,8 +891,8 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h) if ( ! win->visible ) continue; - int win_x = win->x_offset; - int win_y = win->y_offset; + int win_x = win->offset_top; + int win_y = win->offset_left; FRect geometry ( win_x , win_y , win->width + win->right_shadow @@ -974,8 +990,8 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y if ( ! win->visible ) continue; - int win_x = win->x_offset; - int win_y = win->y_offset; + int win_x = win->offset_top; + int win_y = win->offset_left; FRect geometry ( win_x , win_y , win->width + win->right_shadow @@ -1041,6 +1057,13 @@ void FVTerm::updateVTerm() updateVTerm(win); win->has_changes = false; } + else if ( win->pre_proc_instance + && win->pre_proc_instance->child_print_area + && win->pre_proc_instance->child_print_area->has_changes ) + { + updateVTerm(win); + win->pre_proc_instance->child_print_area->has_changes = false; + } } } @@ -1059,8 +1082,12 @@ void FVTerm::updateVTerm (term_area* area) if ( ! area->visible ) return; - ax = area->x_offset; - ay = area->y_offset; + // Call preprocessing handler + if ( area->pre_proc_instance && area->pre_proc ) + (area->pre_proc_instance->*area->pre_proc)(); + + ax = area->offset_top; + ay = area->offset_left; aw = area->width; ah = area->height; rsh = area->right_shadow; @@ -1237,8 +1264,8 @@ bool FVTerm::updateVTermCursor (term_area* area) { int cx, cy, ax, ay, x, y; // area offset - ax = area->x_offset; - ay = area->y_offset; + ax = area->offset_top; + ay = area->offset_left; // area cursor position cx = area->input_cursor_x; cy = area->input_cursor_y; @@ -1365,8 +1392,8 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area) if ( ! area ) return; - dx = x - area->x_offset + 1; - dy = y - area->y_offset + 1; + dx = x - area->offset_top + 1; + dy = y - area->offset_left + 1; if ( x < 0 || y < 0 ) return; @@ -1810,8 +1837,8 @@ FVTerm::char_data FVTerm::getCharacter ( character_type char_type if ( ! win->visible ) continue; - int win_x = win->x_offset; - int win_y = win->y_offset; + int win_x = win->offset_top; + int win_y = win->offset_left; FRect geometry ( win_x , win_y , win->width + win->right_shadow @@ -1897,25 +1924,25 @@ void FVTerm::processTerminalUpdate() // Retains terminal updates if there are unprocessed inputs static const int max_skip = 8; - if ( terminal_update_pending ) + if ( ! terminal_update_pending ) + return; + + if ( ! unprocessedInput() ) { - if ( ! unprocessedInput() ) - { - updateTerminal(); - terminal_update_pending = false; - skipped_terminal_update = 0; - } - else if ( skipped_terminal_update > max_skip ) - { - force_terminal_update = true; - updateTerminal(); - force_terminal_update = false; - terminal_update_pending = false; - skipped_terminal_update = 0; - } - else - skipped_terminal_update++; + updateTerminal(); + terminal_update_pending = false; + skipped_terminal_update = 0; } + else if ( skipped_terminal_update > max_skip ) + { + force_terminal_update = true; + updateTerminal(); + force_terminal_update = false; + terminal_update_pending = false; + skipped_terminal_update = 0; + } + else + skipped_terminal_update++; } //---------------------------------------------------------------------- diff --git a/src/fvterm.h b/src/fvterm.h index 48a972e2..68f1696c 100644 --- a/src/fvterm.h +++ b/src/fvterm.h @@ -29,10 +29,14 @@ #include "fterm.h" #include // std::stringstream +// Preprocessing handler macro +#define _PREPROC_HANDLER(i,h) \ + reinterpret_cast((i)) \ + , reinterpret_cast((h)) + // class forward declaration class FWidget; - //---------------------------------------------------------------------- // class FVTerm //---------------------------------------------------------------------- @@ -46,29 +50,32 @@ class FVTerm : public FObject, public FTerm // Typedefs and Enumeration typedef struct { - uInt xmin; - uInt xmax; - uInt trans_count; + uInt xmin; // X-position with the first change + uInt xmax; // X-position with the last change + uInt trans_count; // Number of transparent characters } line_changes; typedef FOptiAttr::char_data char_data; + typedef void (FVTerm::*FPreprocessingHandler)(); typedef struct { - int x_offset; - int y_offset; - int width; - int height; - int right_shadow; - int bottom_shadow; - int cursor_x; - int cursor_y; - int input_cursor_x; - int input_cursor_y; - int input_cursor_visible; - FWidget* widget; + int offset_top; // Distance from top of the terminal + int offset_left; // Distance from left terminal side + int width; // Window width + int height; // Window height + int right_shadow; // Right window shadow + int bottom_shadow; // Bottom window shadow + int cursor_x; // X-position for the next write operation + int cursor_y; // Y-position for the next write operation + int input_cursor_x; // X-position input cursor + int input_cursor_y; // Y-position input cursor + FWidget* widget; // Widget that owns this term_area + FVTerm* pre_proc_instance; + FPreprocessingHandler pre_proc; line_changes* changes; - char_data* text; + char_data* text; // Text data for the output + bool input_cursor_visible; bool has_changes; bool visible; } term_area; @@ -170,6 +177,9 @@ class FVTerm : public FObject, public FTerm static bool setInheritBackground(); static bool unsetInheritBackground(); + void setPreprocessingHandler ( FVTerm* + , FPreprocessingHandler ); + // Inquiries static bool isCursorHidden(); static bool isBold(); diff --git a/src/fwidget.cpp b/src/fwidget.cpp index 2d15554d..c429a3ae 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -879,8 +879,9 @@ void FWidget::delCallback (FWidget* cb_instance) inline void FWidget::delCallbacks() { // delete all callbacks from this widget + member_callback_objects.clear(); // member function pointer - callback_objects.clear(); // function pointer + callback_objects.clear(); // function pointer } //---------------------------------------------------------------------- @@ -1828,7 +1829,7 @@ bool FWidget::focusNextChild() next_element = children.begin(); next = static_cast(*next_element); - } while ( ! next->isEnabled() + } while ( ! next->isEnabled() || ! next->acceptFocus() || ! next->isVisible() || next->isWindowWidget() ); @@ -1901,7 +1902,7 @@ bool FWidget::focusPrevChild() --prev_element; prev = static_cast(*prev_element); - } while ( ! prev->isEnabled() + } while ( ! prev->isEnabled() || ! prev->acceptFocus() || ! prev->isVisible() || prev->isWindowWidget() ); @@ -2141,7 +2142,7 @@ void FWidget::init() char* cursor_off_str = disableCursor(); - if ( cursor_off_str && std::strlen(cursor_off_str ) > 0 ) + if ( cursor_off_str && std::strlen(cursor_off_str) > 0 ) hideable = true; else hideable = false; diff --git a/src/fwindow.cpp b/src/fwindow.cpp index 85b602bd..661748f5 100644 --- a/src/fwindow.cpp +++ b/src/fwindow.cpp @@ -307,7 +307,7 @@ void FWindow::setX (int x, bool adjust) FWidget::setX (x, adjust); if ( vwin ) - vwin->x_offset = getTermX() - 1; + vwin->offset_top = getTermX() - 1; } //---------------------------------------------------------------------- @@ -319,7 +319,7 @@ void FWindow::setY (int y, bool adjust) FWidget::setY (y, adjust); if ( vwin ) - vwin->y_offset = getTermY() - 1; + vwin->offset_left = getTermY() - 1; } //---------------------------------------------------------------------- @@ -332,8 +332,8 @@ void FWindow::setPos (int x, int y, bool adjust) if ( vwin ) { - vwin->x_offset = getTermX() - 1; - vwin->y_offset = getTermY() - 1; + vwin->offset_top = getTermX() - 1; + vwin->offset_left = getTermY() - 1; } } @@ -405,10 +405,10 @@ void FWindow::setGeometry (int x, int y, int w, int h, bool adjust) else { if ( getX() != old_x ) - vwin->x_offset = getTermX() - 1; + vwin->offset_top = getTermX() - 1; if ( getY() != old_y ) - vwin->y_offset = getTermY() - 1; + vwin->offset_left = getTermY() - 1; } } @@ -419,8 +419,8 @@ void FWindow::move (int dx, int dy) if ( vwin ) { - vwin->x_offset = getTermX() - 1; - vwin->y_offset = getTermY() - 1; + vwin->offset_top = getTermX() - 1; + vwin->offset_left = getTermY() - 1; } } @@ -787,10 +787,10 @@ void FWindow::adjustSize() else if ( vwin ) { if ( getX() != old_x ) - vwin->x_offset = getTermX() - 1; + vwin->offset_top = getTermX() - 1; if ( getY() != old_y ) - vwin->y_offset = getTermY() - 1; + vwin->offset_left = getTermY() - 1; } } diff --git a/test/ui.cpp b/test/ui.cpp index 64799924..a50b1701 100644 --- a/test/ui.cpp +++ b/test/ui.cpp @@ -351,58 +351,69 @@ MyDialog::MyDialog (FWidget* parent) "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_view) ); + Quit->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_exitApp) ); + Cut->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_cutClipboard) ); + Copy->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_copyClipboard) ); + Paste->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_pasteClipboard) ); + Clear->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_clearInput) ); + Env->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_terminfo) ); + Drive->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_drives) ); + Help->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_about) ); + File1->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_view), dynamic_cast(File1) ); + File2->addCallback ( "clicked", _METHOD_CALLBACK (this, &MyDialog::cb_view), dynamic_cast(File2) ); + File3->addCallback ( "clicked",