Corrected swapped top and left offset variables in the class FVTerm
This commit is contained in:
parent
34961037f8
commit
bd06df8987
|
@ -1,3 +1,7 @@
|
|||
2017-02-24 Markus Gans <guru.mail@muenster.de>
|
||||
* Corrected swapped top and left offset variables
|
||||
in the class FVTerm
|
||||
|
||||
2017-02-24 Markus Gans <guru.mail@muenster.de>
|
||||
* FListBox gets the option to save a data pointer for
|
||||
every FListBoxItem element
|
||||
|
|
|
@ -21,6 +21,14 @@ FListBoxItem::FListBoxItem()
|
|||
, selected(false)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FListBoxItem::FListBoxItem (const FListBoxItem& item)
|
||||
: text(item.text)
|
||||
, data_pointer(item.data_pointer)
|
||||
, brackets(item.brackets)
|
||||
, selected(item.selected)
|
||||
{ }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FListBoxItem::FListBoxItem (FString& txt, FWidget::data_ptr data)
|
||||
: text(txt)
|
||||
|
@ -49,6 +57,24 @@ FListBoxItem::FListBoxItem (const char* txt, FWidget::data_ptr data)
|
|||
FListBoxItem::~FListBoxItem()
|
||||
{ }
|
||||
|
||||
// public methods of FListBoxItem
|
||||
//----------------------------------------------------------------------
|
||||
FListBoxItem& FListBoxItem::operator = (const FListBoxItem& item)
|
||||
{
|
||||
if ( &item == this )
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
else
|
||||
{
|
||||
text = item.text;
|
||||
data_pointer = item.data_pointer;
|
||||
brackets = item.brackets;
|
||||
selected = item.selected;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class FListBox
|
||||
|
@ -56,7 +82,7 @@ FListBoxItem::~FListBoxItem()
|
|||
|
||||
// constructor and destructor
|
||||
//----------------------------------------------------------------------
|
||||
FListBox::FListBox(FWidget* parent)
|
||||
FListBox::FListBox (FWidget* parent)
|
||||
: FWidget(parent)
|
||||
, data()
|
||||
, vbar(0)
|
||||
|
@ -92,7 +118,7 @@ FListBox::~FListBox() // destructor
|
|||
|
||||
// public methods of FListBox
|
||||
//----------------------------------------------------------------------
|
||||
void FListBox::setCurrentItem(int index)
|
||||
void FListBox::setCurrentItem (int index)
|
||||
{
|
||||
int element_count;
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ class FListBoxItem
|
|||
public:
|
||||
// Constructors
|
||||
FListBoxItem ();
|
||||
FListBoxItem (const FListBoxItem&); // copy constructor
|
||||
explicit FListBoxItem (FString&, FWidget::data_ptr = 0);
|
||||
explicit FListBoxItem (const std::string&, FWidget::data_ptr = 0);
|
||||
explicit FListBoxItem (const char*, FWidget::data_ptr = 0);
|
||||
|
@ -54,6 +55,9 @@ class FListBoxItem
|
|||
// Destructor
|
||||
virtual ~FListBoxItem();
|
||||
|
||||
// Assignment operator (=)
|
||||
FListBoxItem& operator = (const FListBoxItem&);
|
||||
|
||||
// Accessors
|
||||
virtual FString getText() const;
|
||||
virtual FWidget::data_ptr getData() const;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#ifndef _FOBJECT_H
|
||||
#define _FOBJECT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/time.h> // need for gettimeofday
|
||||
#include <cstdlib>
|
||||
#include <list>
|
||||
|
@ -24,16 +25,16 @@
|
|||
typedef unsigned char uChar;
|
||||
typedef unsigned int uInt;
|
||||
typedef unsigned long uLong;
|
||||
typedef unsigned char uInt8;
|
||||
typedef unsigned short uInt16;
|
||||
typedef unsigned int uInt32;
|
||||
typedef u_int64_t uInt64;
|
||||
typedef uint8_t uInt8;
|
||||
typedef uint16_t uInt16;
|
||||
typedef uint32_t uInt32;
|
||||
typedef uint64_t uInt64;
|
||||
|
||||
typedef signed int sInt;
|
||||
typedef signed long sLong;
|
||||
typedef signed char sInt8;
|
||||
typedef signed short sInt16;
|
||||
typedef signed int sInt32;
|
||||
typedef int8_t sInt8;
|
||||
typedef int16_t sInt16;
|
||||
typedef int32_t sInt32;
|
||||
typedef int64_t sInt64;
|
||||
|
||||
typedef long double lDouble;
|
||||
|
|
|
@ -143,8 +143,8 @@ void FScrollView::setX (int x, bool adjust)
|
|||
|
||||
if ( viewport )
|
||||
{
|
||||
viewport->offset_top = scroll_geometry.getX();
|
||||
viewport->offset_left = scroll_geometry.getY();
|
||||
viewport->offset_left = scroll_geometry.getX();
|
||||
viewport->offset_top = scroll_geometry.getY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ void FScrollView::setY (int y, bool adjust)
|
|||
|
||||
if ( viewport )
|
||||
{
|
||||
viewport->offset_top = scroll_geometry.getX();
|
||||
viewport->offset_left = scroll_geometry.getY();
|
||||
viewport->offset_left = scroll_geometry.getX();
|
||||
viewport->offset_top = scroll_geometry.getY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ void FScrollView::setPos (int x, int y, bool adjust)
|
|||
{
|
||||
if ( viewport )
|
||||
{
|
||||
viewport->offset_top = scroll_geometry.getX();
|
||||
viewport->offset_left = scroll_geometry.getY();
|
||||
viewport->offset_left = scroll_geometry.getX();
|
||||
viewport->offset_top = scroll_geometry.getY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,8 +235,8 @@ void FScrollView::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
}
|
||||
else if ( ! adjust && viewport )
|
||||
{
|
||||
viewport->offset_top = scroll_geometry.getX();
|
||||
viewport->offset_left = scroll_geometry.getY();
|
||||
viewport->offset_left = scroll_geometry.getX();
|
||||
viewport->offset_top = scroll_geometry.getY();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -662,8 +662,8 @@ void FScrollView::adjustSize()
|
|||
|
||||
if ( viewport )
|
||||
{
|
||||
viewport->offset_top = scroll_geometry.getX();
|
||||
viewport->offset_left = scroll_geometry.getY();
|
||||
viewport->offset_left = scroll_geometry.getX();
|
||||
viewport->offset_top = scroll_geometry.getY();
|
||||
}
|
||||
|
||||
hbar->setMaximum (getScrollWidth() - getViewportWidth());
|
||||
|
@ -701,8 +701,8 @@ void FScrollView::copy2area()
|
|||
if ( ! viewport->has_changes )
|
||||
return;
|
||||
|
||||
ax = getTermX() - print_area->offset_top;
|
||||
ay = getTermY() - print_area->offset_left;
|
||||
ax = getTermX() - print_area->offset_left;
|
||||
ay = getTermY() - print_area->offset_top;
|
||||
dx = viewport_geometry.getX();
|
||||
dy = viewport_geometry.getY();
|
||||
y_end = getViewportHeight();
|
||||
|
|
|
@ -37,16 +37,16 @@
|
|||
typedef unsigned char uChar;
|
||||
typedef unsigned int uInt;
|
||||
typedef unsigned long uLong;
|
||||
typedef unsigned char uInt8;
|
||||
typedef unsigned short uInt16;
|
||||
typedef unsigned int uInt32;
|
||||
typedef u_int64_t uInt64;
|
||||
typedef uint8_t uInt8;
|
||||
typedef uint16_t uInt16;
|
||||
typedef uint32_t uInt32;
|
||||
typedef uint64_t uInt64;
|
||||
|
||||
typedef signed int sInt;
|
||||
typedef signed long sLong;
|
||||
typedef signed char sInt8;
|
||||
typedef signed short sInt16;
|
||||
typedef signed int sInt32;
|
||||
typedef int8_t sInt8;
|
||||
typedef int16_t sInt16;
|
||||
typedef int32_t sInt32;
|
||||
typedef int64_t sInt64;
|
||||
|
||||
typedef long double lDouble;
|
||||
|
|
|
@ -64,8 +64,8 @@ FPoint FVTerm::getPrintCursor()
|
|||
term_area* win = getPrintArea();
|
||||
|
||||
if ( win )
|
||||
return FPoint ( win->offset_top + win->cursor_x
|
||||
, win->offset_left + win->cursor_y );
|
||||
return FPoint ( win->offset_left + win->cursor_x
|
||||
, win->offset_top + win->cursor_y );
|
||||
|
||||
return FPoint(0,0);
|
||||
}
|
||||
|
@ -150,8 +150,8 @@ void FVTerm::setPrintCursor (register int x, register int y)
|
|||
|
||||
if ( win )
|
||||
{
|
||||
win->cursor_x = x - win->offset_top;
|
||||
win->cursor_y = y - win->offset_left;
|
||||
win->cursor_x = x - win->offset_left;
|
||||
win->cursor_y = y - win->offset_top;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -704,7 +704,7 @@ void FVTerm::createArea ( const FRect& r
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::createArea ( int offset_top, int offset_left
|
||||
void FVTerm::createArea ( int offset_left, int offset_top
|
||||
, int width, int height
|
||||
, int rsw, int bsh
|
||||
, term_area*& area )
|
||||
|
@ -713,7 +713,7 @@ void FVTerm::createArea ( int offset_top, int offset_left
|
|||
|
||||
area = new term_area;
|
||||
area->widget = static_cast<FWidget*>(this);
|
||||
resizeArea (offset_top, offset_left, width, height, rsw, bsh, area);
|
||||
resizeArea (offset_left, offset_top, width, height, rsw, bsh, area);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -731,13 +731,12 @@ void FVTerm::resizeArea ( const FRect& r
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FVTerm::resizeArea ( int offset_top, int offset_left
|
||||
void FVTerm::resizeArea ( int offset_left, int offset_top
|
||||
, int width, int height
|
||||
, int rsw, int bsh
|
||||
, term_area* area )
|
||||
{
|
||||
assert ( offset_top >= 0 );
|
||||
assert ( offset_left >= 0 );
|
||||
assert ( width > 0 );
|
||||
assert ( height > 0 );
|
||||
assert ( rsw >= 0 );
|
||||
|
@ -772,8 +771,8 @@ void FVTerm::resizeArea ( int offset_top, int offset_left
|
|||
else
|
||||
return;
|
||||
|
||||
area->offset_top = offset_top;
|
||||
area->offset_left = offset_left;
|
||||
area->offset_top = offset_top;
|
||||
area->width = width;
|
||||
area->height = height;
|
||||
area->right_shadow = rsw;
|
||||
|
@ -901,8 +900,8 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
|
|||
if ( ! win->visible )
|
||||
continue;
|
||||
|
||||
int win_x = win->offset_top;
|
||||
int win_y = win->offset_left;
|
||||
int win_x = win->offset_left;
|
||||
int win_y = win->offset_top;
|
||||
FRect geometry ( win_x
|
||||
, win_y
|
||||
, win->width + win->right_shadow
|
||||
|
@ -1000,8 +999,8 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
|||
if ( ! win->visible )
|
||||
continue;
|
||||
|
||||
int win_x = win->offset_top;
|
||||
int win_y = win->offset_left;
|
||||
int win_x = win->offset_left;
|
||||
int win_y = win->offset_top;
|
||||
FRect geometry ( win_x
|
||||
, win_y
|
||||
, win->width + win->right_shadow
|
||||
|
@ -1120,8 +1119,8 @@ void FVTerm::updateVTerm (term_area* area)
|
|||
}
|
||||
}
|
||||
|
||||
ax = area->offset_top;
|
||||
ay = area->offset_left;
|
||||
ax = area->offset_left;
|
||||
ay = area->offset_top;
|
||||
aw = area->width;
|
||||
ah = area->height;
|
||||
rsh = area->right_shadow;
|
||||
|
@ -1298,8 +1297,8 @@ bool FVTerm::updateVTermCursor (term_area* area)
|
|||
{
|
||||
int cx, cy, ax, ay, x, y;
|
||||
// area offset
|
||||
ax = area->offset_top;
|
||||
ay = area->offset_left;
|
||||
ax = area->offset_left;
|
||||
ay = area->offset_top;
|
||||
// area cursor position
|
||||
cx = area->input_cursor_x;
|
||||
cy = area->input_cursor_y;
|
||||
|
@ -1426,8 +1425,8 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
|
|||
if ( ! area )
|
||||
return;
|
||||
|
||||
dx = x - area->offset_top + 1;
|
||||
dy = y - area->offset_left + 1;
|
||||
dx = x - area->offset_left + 1;
|
||||
dy = y - area->offset_top + 1;
|
||||
|
||||
if ( x < 0 || y < 0 )
|
||||
return;
|
||||
|
@ -1871,8 +1870,8 @@ FVTerm::char_data FVTerm::getCharacter ( character_type char_type
|
|||
if ( ! win->visible )
|
||||
continue;
|
||||
|
||||
int win_x = win->offset_top;
|
||||
int win_y = win->offset_left;
|
||||
int win_x = win->offset_left;
|
||||
int win_y = win->offset_top;
|
||||
FRect geometry ( win_x
|
||||
, win_y
|
||||
, win->width + win->right_shadow
|
||||
|
|
84
src/fvterm.h
84
src/fvterm.h
|
@ -66,48 +66,56 @@ class FVTerm : public FObject, public FTerm
|
|||
|
||||
typedef std::vector<vterm_preprocessing> FPreprocessing;
|
||||
|
||||
// define virtual terminal character properties
|
||||
struct term_area
|
||||
{
|
||||
term_area()
|
||||
: offset_top (0)
|
||||
, offset_left (0)
|
||||
, width (-1)
|
||||
, height (-1)
|
||||
, right_shadow (0)
|
||||
, bottom_shadow (0)
|
||||
, cursor_x (0)
|
||||
, cursor_y (0)
|
||||
, input_cursor_x (-1)
|
||||
, input_cursor_y (-1)
|
||||
, widget()
|
||||
, preprocessing_call()
|
||||
, changes (0)
|
||||
, text (0)
|
||||
, input_cursor_visible (false)
|
||||
, has_changes (false)
|
||||
, visible (false)
|
||||
{ }
|
||||
public:
|
||||
term_area()
|
||||
: offset_left (0)
|
||||
, offset_top (0)
|
||||
, width (-1)
|
||||
, height (-1)
|
||||
, right_shadow (0)
|
||||
, bottom_shadow (0)
|
||||
, cursor_x (0)
|
||||
, cursor_y (0)
|
||||
, input_cursor_x (-1)
|
||||
, input_cursor_y (-1)
|
||||
, widget()
|
||||
, preprocessing_call()
|
||||
, changes (0)
|
||||
, text (0)
|
||||
, input_cursor_visible (false)
|
||||
, has_changes (false)
|
||||
, visible (false)
|
||||
{ }
|
||||
|
||||
~term_area()
|
||||
{ }
|
||||
~term_area()
|
||||
{ }
|
||||
|
||||
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
|
||||
FPreprocessing preprocessing_call;
|
||||
line_changes* changes;
|
||||
char_data* text; // Text data for the output
|
||||
bool input_cursor_visible;
|
||||
bool has_changes;
|
||||
bool visible;
|
||||
int offset_left; // Distance from left terminal side
|
||||
int offset_top; // Distance from top of the terminal
|
||||
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
|
||||
FPreprocessing preprocessing_call;
|
||||
line_changes* changes;
|
||||
char_data* text; // Text data for the output
|
||||
bool input_cursor_visible;
|
||||
bool has_changes;
|
||||
bool visible;
|
||||
|
||||
private:
|
||||
// Disable copy constructor
|
||||
term_area (const term_area&);
|
||||
// Disable assignment operator (=)
|
||||
term_area& operator = (const term_area&);
|
||||
};
|
||||
|
||||
enum covered_state
|
||||
|
|
|
@ -308,7 +308,7 @@ void FWindow::setX (int x, bool adjust)
|
|||
FWidget::setX (x, adjust);
|
||||
|
||||
if ( isVirtualWindow() )
|
||||
vwin->offset_top = getTermX() - 1;
|
||||
vwin->offset_left = getTermX() - 1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -320,7 +320,7 @@ void FWindow::setY (int y, bool adjust)
|
|||
FWidget::setY (y, adjust);
|
||||
|
||||
if ( isVirtualWindow() )
|
||||
vwin->offset_left = getTermY() - 1;
|
||||
vwin->offset_top = getTermY() - 1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -333,8 +333,8 @@ void FWindow::setPos (int x, int y, bool adjust)
|
|||
|
||||
if ( isVirtualWindow() )
|
||||
{
|
||||
vwin->offset_top = getTermX() - 1;
|
||||
vwin->offset_left = getTermY() - 1;
|
||||
vwin->offset_left = getTermX() - 1;
|
||||
vwin->offset_top = getTermY() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,10 +406,10 @@ void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
|||
else
|
||||
{
|
||||
if ( getX() != old_x )
|
||||
vwin->offset_top = getTermX() - 1;
|
||||
vwin->offset_left = getTermX() - 1;
|
||||
|
||||
if ( getY() != old_y )
|
||||
vwin->offset_left = getTermY() - 1;
|
||||
vwin->offset_top = getTermY() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,8 +420,8 @@ void FWindow::move (int dx, int dy)
|
|||
|
||||
if ( isVirtualWindow() )
|
||||
{
|
||||
vwin->offset_top = getTermX() - 1;
|
||||
vwin->offset_left = getTermY() - 1;
|
||||
vwin->offset_left = getTermX() - 1;
|
||||
vwin->offset_top = getTermY() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -788,10 +788,10 @@ void FWindow::adjustSize()
|
|||
else if ( isVirtualWindow() )
|
||||
{
|
||||
if ( getX() != old_x )
|
||||
vwin->offset_top = getTermX() - 1;
|
||||
vwin->offset_left = getTermX() - 1;
|
||||
|
||||
if ( getY() != old_y )
|
||||
vwin->offset_left = getTermY() - 1;
|
||||
vwin->offset_top = getTermY() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue