From b0b44582e8a8dd6dfba83b5a0887cb34c77908f7 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Mon, 30 Oct 2017 20:29:00 +0100 Subject: [PATCH] Fix scrollview functionality with new inheritance structure --- ChangeLog | 3 +++ include/final/fvterm.h | 4 ++-- include/final/fwidget.h | 5 ++++- src/fscrollview.cpp | 4 ++-- src/fvterm.cpp | 4 ++-- src/fwidget.cpp | 32 ++++++++++++++++++++++++++------ 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92961d9d..0964c2ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2017-10-30 Markus Gans + * Fix scrollview functionality with new inheritance structure + 2017-10-29 Markus Gans * Adaptation of the inheritance diagrams in the header files * Add a standardized cb_exitApp callback method to FApplication diff --git a/include/final/fvterm.h b/include/final/fvterm.h index 005318df..50c6324a 100644 --- a/include/final/fvterm.h +++ b/include/final/fvterm.h @@ -213,9 +213,9 @@ class FVTerm : public FTerm static void putVTerm(); static void updateTerminal (bool); static void updateTerminal(); - void addPreprocessingHandler ( FVTerm* + virtual void addPreprocessingHandler ( FVTerm* , FPreprocessingHandler ); - void delPreprocessingHandler (FVTerm*); + virtual void delPreprocessingHandler (FVTerm*); int printf (const wchar_t*, ...); int printf (const char*, ...) diff --git a/include/final/fwidget.h b/include/final/fwidget.h index 250f87af..c3954854 100644 --- a/include/final/fwidget.h +++ b/include/final/fwidget.h @@ -114,7 +114,7 @@ class FMenuBar; #pragma pack(push) #pragma pack(1) -class FWidget : public FObject, public FVTerm +class FWidget : public FVTerm, public FObject { public: // Using-declaration @@ -320,6 +320,9 @@ class FWidget : public FObject, public FVTerm // Accessor term_area* getPrintArea(); + void addPreprocessingHandler ( FVTerm* + , FPreprocessingHandler ); + void delPreprocessingHandler (FVTerm*); // Inquiry bool isChildPrintArea() const; diff --git a/src/fscrollview.cpp b/src/fscrollview.cpp index 0a8a9d9e..782f95fc 100644 --- a/src/fscrollview.cpp +++ b/src/fscrollview.cpp @@ -668,7 +668,7 @@ FVTerm::term_area* FScrollView::getPrintArea() if ( use_own_print_area || ! viewport ) { child_print_area = 0; - term_area* area = FVTerm::getPrintArea(); + term_area* area = FWidget::getPrintArea(); child_print_area = viewport; return area; } @@ -717,7 +717,7 @@ void FScrollView::copy2area() // copy viewport to area if ( ! hasPrintArea() ) - FVTerm::getPrintArea(); + FWidget::getPrintArea(); if ( ! (hasPrintArea() && viewport) ) return; diff --git a/src/fvterm.cpp b/src/fvterm.cpp index 2f09859c..a2a01f7c 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -2207,8 +2207,8 @@ void FVTerm::flush_out() void FVTerm::init() { init_object = this; - vterm = 0; - vdesktop = 0; + vterm = 0; + vdesktop = 0; try { diff --git a/src/fwidget.cpp b/src/fwidget.cpp index f2127272..4768fa76 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -53,8 +53,8 @@ bool FWidget::hideable; // constructors and destructor //---------------------------------------------------------------------- FWidget::FWidget (FWidget* parent, bool disable_alt_screen) - : FObject(parent) - , FVTerm(!parent, disable_alt_screen) + : FVTerm(bool(! parent), disable_alt_screen) + , FObject(parent) , accelerator_list(0) , flags(0) , callback_objects() @@ -1767,14 +1767,15 @@ FVTerm::term_area* FWidget::getPrintArea() return print_area; else { - FWidget* obj = this; - FWidget* p_obj = static_cast(obj->getParent()); + FWidget* obj; + FWidget* p_obj = this; - while ( ! obj->vwin && ! obj->child_print_area && p_obj ) + do { obj = p_obj; - p_obj = static_cast(p_obj->getParent()); + p_obj = static_cast(obj->getParent()); } + while ( ! obj->vwin && ! obj->child_print_area && p_obj ); if ( obj->vwin ) { @@ -1791,6 +1792,25 @@ FVTerm::term_area* FWidget::getPrintArea() return vdesktop; } +//---------------------------------------------------------------------- +void FWidget::addPreprocessingHandler ( FVTerm* instance + , FPreprocessingHandler handler ) +{ + if ( ! print_area ) + FWidget::getPrintArea(); + + FVTerm::addPreprocessingHandler (instance, handler); +} + +//---------------------------------------------------------------------- +void FWidget::delPreprocessingHandler (FVTerm* instance) +{ + if ( ! print_area ) + FWidget::getPrintArea(); + + FVTerm::delPreprocessingHandler (instance); +} + //---------------------------------------------------------------------- bool FWidget::isChildPrintArea() const {