Virtual windows can now store their own offset information
This commit is contained in:
parent
d9e5aac828
commit
17b59cf50d
|
@ -1,3 +1,7 @@
|
||||||
|
2016-10-14 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Virtual windows can now store their own offset information
|
||||||
|
* Correct implementation of the move() method
|
||||||
|
|
||||||
2016-10-13 Markus Gans <guru.mail@muenster.de>
|
2016-10-13 Markus Gans <guru.mail@muenster.de>
|
||||||
* Reduces in the code the number of friend classes
|
* Reduces in the code the number of friend classes
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class FApplication : public FWidget
|
||||||
char x11_mouse[4];
|
char x11_mouse[4];
|
||||||
char sgr_mouse[13];
|
char sgr_mouse[13];
|
||||||
char urxvt_mouse[13];
|
char urxvt_mouse[13];
|
||||||
|
|
||||||
|
|
||||||
#ifdef F_HAVE_LIBGPM
|
#ifdef F_HAVE_LIBGPM
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ void FDialog::init()
|
||||||
accelerator_list = new Accelerators();
|
accelerator_list = new Accelerators();
|
||||||
// Add the dialog menu
|
// Add the dialog menu
|
||||||
dialog_menu = new FMenu ("-", this);
|
dialog_menu = new FMenu ("-", this);
|
||||||
dialog_menu->move (getX(), getY()+1);
|
dialog_menu->setPos (getX(), getY()+1);
|
||||||
dgl_menuitem = dialog_menu->getItem();
|
dgl_menuitem = dialog_menu->getItem();
|
||||||
|
|
||||||
if ( dgl_menuitem )
|
if ( dgl_menuitem )
|
||||||
|
@ -154,7 +154,8 @@ void FDialog::drawBorder()
|
||||||
int y1 = 2;
|
int y1 = 2;
|
||||||
int y2 = 1 + getHeight() - 1;
|
int y2 = 1 + getHeight() - 1;
|
||||||
|
|
||||||
if ( (getMoveSizeWidget() || ! resize_click_pos.isNull()) && ! isZoomed() )
|
if ( (getMoveSizeWidget() == this || ! resize_click_pos.isNull())
|
||||||
|
&& ! isZoomed() )
|
||||||
setColor (wc.dialog_resize_fg, getBackgroundColor());
|
setColor (wc.dialog_resize_fg, getBackgroundColor());
|
||||||
else
|
else
|
||||||
setColor();
|
setColor();
|
||||||
|
@ -392,7 +393,7 @@ void FDialog::openMenu()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setOpenMenu(dialog_menu);
|
setOpenMenu(dialog_menu);
|
||||||
dialog_menu->move (getX(), getY()+1);
|
dialog_menu->setPos (getX(), getY()+1);
|
||||||
dialog_menu->setVisible();
|
dialog_menu->setVisible();
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
dialog_menu->show();
|
dialog_menu->show();
|
||||||
|
@ -445,6 +446,7 @@ void FDialog::cb_move (FWidget*, void*)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setMoveSizeWidget(this);
|
setMoveSizeWidget(this);
|
||||||
|
drawBorder();
|
||||||
save_geometry = getGeometry();
|
save_geometry = getGeometry();
|
||||||
tooltip = new FToolTip(this);
|
tooltip = new FToolTip(this);
|
||||||
|
|
||||||
|
@ -620,22 +622,22 @@ void FDialog::onKeyPress (FKeyEvent* ev)
|
||||||
switch ( ev->key() )
|
switch ( ev->key() )
|
||||||
{
|
{
|
||||||
case fc::Fkey_up:
|
case fc::Fkey_up:
|
||||||
move (getX(), getY() - 1);
|
move (0, -1);
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_down:
|
case fc::Fkey_down:
|
||||||
move (getX(), getY() + 1);
|
move (0, 1);
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_left:
|
case fc::Fkey_left:
|
||||||
move (getX() - 1, getY());
|
move (-1, 0);
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
move (getX() + 1, getY());
|
move (1, 0);
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -695,7 +697,7 @@ void FDialog::onKeyPress (FKeyEvent* ev)
|
||||||
delete tooltip;
|
delete tooltip;
|
||||||
|
|
||||||
tooltip = 0;
|
tooltip = 0;
|
||||||
move (save_geometry.getPos());
|
setPos (save_geometry.getPos());
|
||||||
|
|
||||||
if ( isResizeable() )
|
if ( isResizeable() )
|
||||||
setSize (save_geometry.getWidth(), save_geometry.getHeight());
|
setSize (save_geometry.getWidth(), save_geometry.getHeight());
|
||||||
|
@ -859,9 +861,8 @@ void FDialog::onMouseUp (FMouseEvent* ev)
|
||||||
&& titlebar_x < getTermX() + getWidth()
|
&& titlebar_x < getTermX() + getWidth()
|
||||||
&& titlebar_y == getTermY() )
|
&& titlebar_y == getTermY() )
|
||||||
{
|
{
|
||||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
|
||||||
FPoint deltaPos = ev->getTermPos() - titlebar_click_pos;
|
FPoint deltaPos = ev->getTermPos() - titlebar_click_pos;
|
||||||
move (currentPos + deltaPos);
|
move (deltaPos);
|
||||||
titlebar_click_pos = ev->getTermPos();
|
titlebar_click_pos = ev->getTermPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,9 +954,8 @@ void FDialog::onMouseMove (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( ! titlebar_click_pos.isNull() )
|
if ( ! titlebar_click_pos.isNull() )
|
||||||
{
|
{
|
||||||
FPoint currentPos(getGeometry().getX(), getGeometry().getY());
|
|
||||||
FPoint deltaPos = ev->getTermPos() - titlebar_click_pos;
|
FPoint deltaPos = ev->getTermPos() - titlebar_click_pos;
|
||||||
move (currentPos + deltaPos);
|
move (deltaPos);
|
||||||
titlebar_click_pos = ev->getTermPos();
|
titlebar_click_pos = ev->getTermPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,13 +1218,7 @@ int FDialog::exec()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::move (const FPoint& pos)
|
void FDialog::setPos (int x, int y, bool)
|
||||||
{
|
|
||||||
move ( pos.getX(), pos.getY() );
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FDialog::move (int x, int y)
|
|
||||||
{
|
{
|
||||||
int dx, dy, old_x, old_y, rsw, bsh, width, height;
|
int dx, dy, old_x, old_y, rsw, bsh, width, height;
|
||||||
FRect old_geometry;
|
FRect old_geometry;
|
||||||
|
@ -1252,8 +1246,7 @@ void FDialog::move (int x, int y)
|
||||||
old_geometry = getTermGeometryWithShadow();
|
old_geometry = getTermGeometryWithShadow();
|
||||||
|
|
||||||
// move to the new position
|
// move to the new position
|
||||||
FWidget::move(x,y);
|
FWindow::setPos(x, y, false);
|
||||||
setPos(x, y, false);
|
|
||||||
putArea (getTermPos(), vwin);
|
putArea (getTermPos(), vwin);
|
||||||
|
|
||||||
// restoring the non-covered terminal areas
|
// restoring the non-covered terminal areas
|
||||||
|
@ -1311,7 +1304,7 @@ void FDialog::move (int x, int y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FWidget::adjustSize();
|
FWindow::adjustSize();
|
||||||
|
|
||||||
// set the cursor to the focus widget
|
// set the cursor to the focus widget
|
||||||
FWidget* focus_widget = FWidget::getFocusWidget();
|
FWidget* focus_widget = FWidget::getFocusWidget();
|
||||||
|
@ -1326,6 +1319,12 @@ void FDialog::move (int x, int y)
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FDialog::move (int dx, int dy)
|
||||||
|
{
|
||||||
|
setPos (getX() + dx, getY() + dy);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FDialog::setSize (int w, int h, bool adjust)
|
void FDialog::setSize (int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,8 +127,12 @@ class FDialog : public FWindow
|
||||||
void show();
|
void show();
|
||||||
void hide();
|
void hide();
|
||||||
int exec();
|
int exec();
|
||||||
void move (const FPoint&);
|
void setPos (int, int, bool = true);
|
||||||
|
// make every setPos from FWindow available
|
||||||
|
using FWindow::setPos;
|
||||||
void move (int, int);
|
void move (int, int);
|
||||||
|
// make every move from FWindow available
|
||||||
|
using FWindow::move;
|
||||||
void setSize (int, int, bool = true);
|
void setSize (int, int, bool = true);
|
||||||
|
|
||||||
bool setFocus (bool);
|
bool setFocus (bool);
|
||||||
|
|
|
@ -967,7 +967,7 @@ class fc
|
||||||
CurlyBrackets = 3, // { }
|
CurlyBrackets = 3, // { }
|
||||||
AngleBrackets = 4 // < >
|
AngleBrackets = 4 // < >
|
||||||
};
|
};
|
||||||
|
|
||||||
enum termcaps
|
enum termcaps
|
||||||
{
|
{
|
||||||
t_bell,
|
t_bell,
|
||||||
|
|
|
@ -199,7 +199,7 @@ void FMenu::adjustItems()
|
||||||
menu_Y = (*iter)->getTermY() - 2;
|
menu_Y = (*iter)->getTermY() - 2;
|
||||||
|
|
||||||
// set sub-menu position
|
// set sub-menu position
|
||||||
menu->move (menu_X, menu_Y);
|
menu->setPos (menu_X, menu_Y);
|
||||||
|
|
||||||
// call sub-menu adjustItems()
|
// call sub-menu adjustItems()
|
||||||
if ( menu->count() > 0 )
|
if ( menu->count() > 0 )
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// └─────┬─────┘
|
// └─────┬─────┘
|
||||||
// │
|
// │
|
||||||
// ▕▔▔▔▔▔▔▔▔▏
|
// ▕▔▔▔▔▔▔▔▔▏
|
||||||
// ▕ FVTerm ▏
|
// ▕ FVTerm ▏
|
||||||
// ▕▁▁▁▁▁▁▁▁▏ *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
// ▕▁▁▁▁▁▁▁▁▏ *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
|
||||||
// ▲ ┌ - -▕ FRadioMenuItem ▏
|
// ▲ ┌ - -▕ FRadioMenuItem ▏
|
||||||
// │ : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
// │ : ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
|
||||||
|
|
|
@ -477,7 +477,7 @@ void FMenuBar::adjustItems()
|
||||||
FMenu* menu = (*iter)->getMenu();
|
FMenu* menu = (*iter)->getMenu();
|
||||||
|
|
||||||
// set menu position
|
// set menu position
|
||||||
menu->move (menu->adjustX(item_X), item_Y);
|
menu->setPos (menu->adjustX(item_X), item_Y);
|
||||||
|
|
||||||
// call menu adjustItems()
|
// call menu adjustItems()
|
||||||
menu->adjustItems();
|
menu->adjustItems();
|
||||||
|
|
|
@ -2068,13 +2068,13 @@ void FTerm::finish()
|
||||||
|
|
||||||
if ( mouse )
|
if ( mouse )
|
||||||
delete mouse;
|
delete mouse;
|
||||||
|
|
||||||
if ( term )
|
if ( term )
|
||||||
delete term;
|
delete term;
|
||||||
|
|
||||||
if ( opti_attr )
|
if ( opti_attr )
|
||||||
delete opti_attr;
|
delete opti_attr;
|
||||||
|
|
||||||
if ( opti_move )
|
if ( opti_move )
|
||||||
delete opti_move;
|
delete opti_move;
|
||||||
}
|
}
|
||||||
|
@ -2490,7 +2490,7 @@ char* FTerm::enableCursor()
|
||||||
char* FTerm::disableCursor()
|
char* FTerm::disableCursor()
|
||||||
{
|
{
|
||||||
char*& vi = tcap[fc::t_cursor_invisible].string;
|
char*& vi = tcap[fc::t_cursor_invisible].string;
|
||||||
|
|
||||||
if ( vi )
|
if ( vi )
|
||||||
return vi;
|
return vi;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <sys/io.h> // <asm/io.h> is deprecated, use <sys/io.h> instead
|
#include <sys/io.h> // <asm/io.h> is deprecated, use <sys/io.h> instead
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/kd.h>
|
#include <sys/kd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
|
|
|
@ -53,7 +53,7 @@ class FTermcap
|
||||||
{
|
{
|
||||||
return tcap;
|
return tcap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTermcapMap (tcap_map* t)
|
void setTermcapMap (tcap_map* t)
|
||||||
{
|
{
|
||||||
tcap = t;
|
tcap = t;
|
||||||
|
|
184
src/fvterm.cpp
184
src/fvterm.cpp
|
@ -42,7 +42,7 @@ FVTerm::FVTerm (FVTerm* parent)
|
||||||
{
|
{
|
||||||
terminal_update_complete = false;
|
terminal_update_complete = false;
|
||||||
vterm_updates = true;
|
vterm_updates = true;
|
||||||
|
|
||||||
if ( ! parent )
|
if ( ! parent )
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -103,7 +103,7 @@ void FVTerm::init()
|
||||||
tcap = FTermcap().getTermcapMap();
|
tcap = FTermcap().getTermcapMap();
|
||||||
|
|
||||||
// create virtual terminal
|
// create virtual terminal
|
||||||
FRect term_geometry (1, 1, getColumnNumber(), getLineNumber());
|
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
||||||
createVTerm (term_geometry);
|
createVTerm (term_geometry);
|
||||||
|
|
||||||
// create virtual desktop area
|
// create virtual desktop area
|
||||||
|
@ -168,7 +168,9 @@ void FVTerm::createArea ( const FRect& r
|
||||||
, const FPoint& p
|
, const FPoint& p
|
||||||
, FVTerm::term_area*& area )
|
, FVTerm::term_area*& area )
|
||||||
{
|
{
|
||||||
createArea ( r.getWidth()
|
createArea ( r.getX()
|
||||||
|
, r.getY()
|
||||||
|
, r.getWidth()
|
||||||
, r.getHeight()
|
, r.getHeight()
|
||||||
, p.getX()
|
, p.getX()
|
||||||
, p.getY()
|
, p.getY()
|
||||||
|
@ -176,26 +178,29 @@ void FVTerm::createArea ( const FRect& r
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FVTerm::createArea ( int width, int height
|
void FVTerm::createArea ( int x_offset, int y_offset
|
||||||
|
, int width, int height
|
||||||
, int rsw, int bsh
|
, int rsw, int bsh
|
||||||
, term_area*& area )
|
, term_area*& area )
|
||||||
{
|
{
|
||||||
// initialize virtual window
|
// initialize virtual window
|
||||||
area = new term_area;
|
area = new term_area;
|
||||||
|
|
||||||
|
area->x_offset = 0;
|
||||||
|
area->y_offset = 0;
|
||||||
area->width = -1;
|
area->width = -1;
|
||||||
area->height = -1;
|
area->height = -1;
|
||||||
area->right_shadow = 0;
|
area->right_shadow = 0;
|
||||||
area->bottom_shadow = 0;
|
area->bottom_shadow = 0;
|
||||||
area->input_cursor_x = -1;;
|
area->input_cursor_x = -1;
|
||||||
area->input_cursor_y = -1;;
|
area->input_cursor_y = -1;
|
||||||
area->input_cursor_visible = false;
|
area->input_cursor_visible = false;
|
||||||
area->changes = 0;
|
area->changes = 0;
|
||||||
area->text = 0;
|
area->text = 0;
|
||||||
area->visible = false;
|
area->visible = false;
|
||||||
area->widget = static_cast<FWidget*>(this);
|
area->widget = static_cast<FWidget*>(this);
|
||||||
|
|
||||||
resizeArea (width, height, rsw, bsh, area);
|
resizeArea (x_offset, y_offset, width, height, rsw, bsh, area);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -203,7 +208,9 @@ void FVTerm::resizeArea ( const FRect& r
|
||||||
, const FPoint& p
|
, const FPoint& p
|
||||||
, FVTerm::term_area* area )
|
, FVTerm::term_area* area )
|
||||||
{
|
{
|
||||||
resizeArea ( r.getWidth()
|
resizeArea ( r.getX()
|
||||||
|
, r.getY()
|
||||||
|
, r.getWidth()
|
||||||
, r.getHeight()
|
, r.getHeight()
|
||||||
, p.getX()
|
, p.getX()
|
||||||
, p.getY()
|
, p.getY()
|
||||||
|
@ -211,7 +218,8 @@ void FVTerm::resizeArea ( const FRect& r
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FVTerm::resizeArea ( int width, int height
|
void FVTerm::resizeArea ( int x_offset, int y_offset
|
||||||
|
, int width, int height
|
||||||
, int rsw, int bsh
|
, int rsw, int bsh
|
||||||
, term_area* area )
|
, term_area* area )
|
||||||
{
|
{
|
||||||
|
@ -245,6 +253,8 @@ void FVTerm::resizeArea ( int width, int height
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
area->x_offset = x_offset;
|
||||||
|
area->y_offset = y_offset;
|
||||||
area->width = width;
|
area->width = width;
|
||||||
area->height = height;
|
area->height = height;
|
||||||
area->right_shadow = rsw;
|
area->right_shadow = rsw;
|
||||||
|
@ -362,14 +372,17 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
term_area* win = (*iter)->getVWin();
|
term_area* win = (*iter)->getVWin();
|
||||||
const FRect& geometry = (*iter)->getTermGeometryWithShadow();
|
int win_x = win->x_offset;
|
||||||
|
int win_y = win->y_offset;
|
||||||
|
FRect geometry ( win_x
|
||||||
|
, win_y
|
||||||
|
, win->width + win->right_shadow
|
||||||
|
, win->height + win->bottom_shadow );
|
||||||
|
|
||||||
// window visible and contains current character
|
// window visible and contains current character
|
||||||
if ( win && win->visible && geometry.contains(tx+x+1, ty+y+1) )
|
if ( win && win->visible && geometry.contains(tx+x, ty+y) )
|
||||||
{
|
{
|
||||||
FOptiAttr::char_data* tmp;
|
FOptiAttr::char_data* tmp;
|
||||||
int win_x = (*iter)->getTermX() - 1;
|
|
||||||
int win_y = (*iter)->getTermY() - 1;
|
|
||||||
int line_len = win->width + win->right_shadow;
|
int line_len = win->width + win->right_shadow;
|
||||||
tmp = &win->text[(ty+y-win_y) * line_len + (tx+x-win_x)];
|
tmp = &win->text[(ty+y-win_y) * line_len + (tx+x-win_x)];
|
||||||
|
|
||||||
|
@ -440,8 +453,6 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
||||||
|
|
||||||
is_covered = non_covered;
|
is_covered = non_covered;
|
||||||
found = bool(area == vdesktop);
|
found = bool(area == vdesktop);
|
||||||
x++;
|
|
||||||
y++;
|
|
||||||
|
|
||||||
w = static_cast<FWidget*>(area->widget);
|
w = static_cast<FWidget*>(area->widget);
|
||||||
|
|
||||||
|
@ -454,18 +465,20 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
term_area* win = (*iter)->getVWin();
|
term_area* win = (*iter)->getVWin();
|
||||||
const FRect& geometry = (*iter)->getTermGeometryWithShadow();
|
int win_x = win->x_offset;
|
||||||
|
int win_y = win->y_offset;
|
||||||
|
FRect geometry ( win_x
|
||||||
|
, win_y
|
||||||
|
, win->width + win->right_shadow
|
||||||
|
, win->height + win->bottom_shadow );
|
||||||
|
|
||||||
if ( win && found
|
if ( win && found
|
||||||
&& (*iter)->isVisible()
|
&& win->visible
|
||||||
&& (*iter)->isShown()
|
|
||||||
&& geometry.contains(x,y) )
|
&& geometry.contains(x,y) )
|
||||||
{
|
{
|
||||||
FOptiAttr::char_data* tmp;
|
FOptiAttr::char_data* tmp;
|
||||||
int win_x = (*iter)->getTermX() - 1;
|
|
||||||
int win_y = (*iter)->getTermY() - 1;
|
|
||||||
int line_len = win->width + win->right_shadow;
|
int line_len = win->width + win->right_shadow;
|
||||||
tmp = &win->text[(y-win_y-1) * line_len + (x-win_x-1)];
|
tmp = &win->text[(y-win_y) * line_len + (x-win_x)];
|
||||||
|
|
||||||
if ( tmp->trans_shadow )
|
if ( tmp->trans_shadow )
|
||||||
{
|
{
|
||||||
|
@ -517,8 +530,8 @@ void FVTerm::updateVTerm (FVTerm::term_area* area)
|
||||||
if ( ! area->visible )
|
if ( ! area->visible )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ax = area->widget->getTermX() - 1;
|
ax = area->x_offset;
|
||||||
ay = area->widget->getTermY() - 1;
|
ay = area->y_offset;
|
||||||
aw = area->width;
|
aw = area->width;
|
||||||
ah = area->height;
|
ah = area->height;
|
||||||
rsh = area->right_shadow;
|
rsh = area->right_shadow;
|
||||||
|
@ -674,18 +687,18 @@ bool FVTerm::updateVTermCursor (FVTerm::term_area* area)
|
||||||
if ( area->input_cursor_visible )
|
if ( area->input_cursor_visible )
|
||||||
{
|
{
|
||||||
int cx, cy, ax, ay, x, y;
|
int cx, cy, ax, ay, x, y;
|
||||||
// cursor position
|
// area offset
|
||||||
cx = area->input_cursor_x;
|
|
||||||
cy = area->input_cursor_y;
|
|
||||||
// widget position
|
|
||||||
ax = area->widget->getTermX() - 1;
|
ax = area->widget->getTermX() - 1;
|
||||||
ay = area->widget->getTermY() - 1;
|
ay = area->widget->getTermY() - 1;
|
||||||
// area position
|
// area cursor position
|
||||||
|
cx = area->input_cursor_x;
|
||||||
|
cy = area->input_cursor_y;
|
||||||
|
// terminal position
|
||||||
x = ax + cx;
|
x = ax + cx;
|
||||||
y = ay + cy;
|
y = ay + cy;
|
||||||
|
|
||||||
if ( isInsideArea(cx, cy, area)
|
if ( isInsideArea(cx, cy, area)
|
||||||
&& isInsideTerminal(x+1, y+1)
|
&& 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;
|
||||||
|
@ -1113,7 +1126,7 @@ void FVTerm::clearArea (FVTerm::term_area* area)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FOptiAttr::char_data FVTerm::getCharacter ( int type
|
FOptiAttr::char_data FVTerm::getCharacter ( character_type type
|
||||||
, const FPoint& pos
|
, const FPoint& pos
|
||||||
, FVTerm* obj )
|
, FVTerm* obj )
|
||||||
{
|
{
|
||||||
|
@ -1121,7 +1134,7 @@ FOptiAttr::char_data FVTerm::getCharacter ( int type
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FOptiAttr::char_data FVTerm::getCharacter ( int char_type
|
FOptiAttr::char_data FVTerm::getCharacter ( character_type char_type
|
||||||
, int x
|
, int x
|
||||||
, int y
|
, int y
|
||||||
, FVTerm* obj )
|
, FVTerm* obj )
|
||||||
|
@ -1175,14 +1188,17 @@ FOptiAttr::char_data FVTerm::getCharacter ( int char_type
|
||||||
if ( obj && *iter != obj && significant_char )
|
if ( obj && *iter != obj && significant_char )
|
||||||
{
|
{
|
||||||
term_area* win = (*iter)->getVWin();
|
term_area* win = (*iter)->getVWin();
|
||||||
const FRect& geometry = (*iter)->getTermGeometryWithShadow();
|
int win_x = win->x_offset;
|
||||||
|
int win_y = win->y_offset;
|
||||||
|
FRect geometry ( win_x
|
||||||
|
, win_y
|
||||||
|
, win->width + win->right_shadow
|
||||||
|
, win->height + win->bottom_shadow );
|
||||||
|
|
||||||
// window visible and contains current character
|
// window visible and contains current character
|
||||||
if ( win && win->visible && geometry.contains(x+1,y+1) )
|
if ( win && win->visible && geometry.contains(x,y) )
|
||||||
{
|
{
|
||||||
FOptiAttr::char_data* tmp;
|
FOptiAttr::char_data* tmp;
|
||||||
int win_x = (*iter)->getTermX() - 1;
|
|
||||||
int win_y = (*iter)->getTermY() - 1;
|
|
||||||
int line_len = win->width + win->right_shadow;
|
int line_len = win->width + win->right_shadow;
|
||||||
tmp = &win->text[(y-win_y) * line_len + (x-win_x)];
|
tmp = &win->text[(y-win_y) * line_len + (x-win_x)];
|
||||||
|
|
||||||
|
@ -1290,7 +1306,7 @@ void FVTerm::setTermXY (register int x, register int y)
|
||||||
|
|
||||||
term_x = term_pos->getX();
|
term_x = term_pos->getX();
|
||||||
term_y = term_pos->getY();
|
term_y = term_pos->getY();
|
||||||
|
|
||||||
move_str = moveCursor (term_x, term_y, x, y);
|
move_str = moveCursor (term_x, term_y, x, y);
|
||||||
|
|
||||||
if ( move_str )
|
if ( move_str )
|
||||||
|
@ -1345,7 +1361,7 @@ void FVTerm::createVTerm (const FRect& r)
|
||||||
void FVTerm::createVTerm (int width, int height)
|
void FVTerm::createVTerm (int width, int height)
|
||||||
{
|
{
|
||||||
// initialize virtual terminal
|
// initialize virtual terminal
|
||||||
createArea (width, height, 0, 0, vterm);
|
createArea (0, 0, width, height, 0, 0, vterm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1358,7 +1374,7 @@ void FVTerm::resizeVTerm (const FRect& r)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FVTerm::resizeVTerm (int width, int height)
|
void FVTerm::resizeVTerm (int width, int height)
|
||||||
{
|
{
|
||||||
resizeArea (width, height, 0, 0, vterm);
|
resizeArea (0, 0, width, height, 0, 0, vterm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1472,7 +1488,7 @@ bool FVTerm::updateTerminalCursor()
|
||||||
int x = vterm->input_cursor_x;
|
int x = vterm->input_cursor_x;
|
||||||
int y = vterm->input_cursor_y;
|
int y = vterm->input_cursor_y;
|
||||||
|
|
||||||
if ( isInsideTerminal(x+1, y+1) )
|
if ( isInsideTerminal(x, y) )
|
||||||
{
|
{
|
||||||
setTermXY (x,y);
|
setTermXY (x,y);
|
||||||
showCursor();
|
showCursor();
|
||||||
|
@ -1515,7 +1531,7 @@ void FVTerm::processTerminalUpdate()
|
||||||
bool FVTerm::isInsideTerminal (int x, int y)
|
bool FVTerm::isInsideTerminal (int x, int y)
|
||||||
{
|
{
|
||||||
// Check whether the coordinates are within the virtual terminal
|
// Check whether the coordinates are within the virtual terminal
|
||||||
FRect term_geometry (1, 1, getColumnNumber(), getLineNumber());
|
FRect term_geometry (0, 0, getColumnNumber(), getLineNumber());
|
||||||
|
|
||||||
if ( term_geometry.contains(x,y) )
|
if ( term_geometry.contains(x,y) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -1642,17 +1658,13 @@ int FVTerm::print (FVTerm::term_area* area, const std::string& s)
|
||||||
int FVTerm::print (FString& s)
|
int FVTerm::print (FString& s)
|
||||||
{
|
{
|
||||||
assert ( ! s.isNull() );
|
assert ( ! s.isNull() );
|
||||||
term_area* area;
|
term_area* area = getPrintArea();
|
||||||
FWidget* w;
|
|
||||||
w = static_cast<FWidget*>(this);
|
|
||||||
area = w->getPrintArea();
|
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
{
|
{
|
||||||
FWidget* root = w->getRootWidget();
|
if ( vdesktop )
|
||||||
area = vdesktop;
|
area = vdesktop;
|
||||||
|
else
|
||||||
if ( ! root )
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1666,23 +1678,23 @@ int FVTerm::print (FVTerm::term_area* area, FString& s)
|
||||||
register int len = 0;
|
register int len = 0;
|
||||||
const wchar_t* p;
|
const wchar_t* p;
|
||||||
uInt tabstop = getTabstop();
|
uInt tabstop = getTabstop();
|
||||||
FWidget* window;
|
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
window = area->widget;
|
|
||||||
|
|
||||||
if ( ! window )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
p = s.wc_str();
|
p = s.wc_str();
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
{
|
{
|
||||||
while ( *p )
|
while ( *p )
|
||||||
{
|
{
|
||||||
int rsh, bsh;
|
int x_offset, y_offset, width, height, rsh, bsh;
|
||||||
|
x_offset = area->x_offset;
|
||||||
|
y_offset = area->y_offset;
|
||||||
|
width = area->width;
|
||||||
|
height = area->height;
|
||||||
|
rsh = area->right_shadow;
|
||||||
|
bsh = area->bottom_shadow;
|
||||||
|
|
||||||
switch ( *p )
|
switch ( *p )
|
||||||
{
|
{
|
||||||
|
@ -1711,8 +1723,8 @@ int FVTerm::print (FVTerm::term_area* area, FString& s)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
short x = short(cursor->getX());
|
short x = short(cursor->getX() - 1);
|
||||||
short y = short(cursor->getY());
|
short y = short(cursor->getY() - 1);
|
||||||
|
|
||||||
FOptiAttr::char_data nc; // next character
|
FOptiAttr::char_data nc; // next character
|
||||||
nc.code = *p;
|
nc.code = *p;
|
||||||
|
@ -1735,8 +1747,8 @@ int FVTerm::print (FVTerm::term_area* area, FString& s)
|
||||||
nc.trans_shadow = next_attribute.trans_shadow;
|
nc.trans_shadow = next_attribute.trans_shadow;
|
||||||
nc.inherit_bg = next_attribute.inherit_bg;
|
nc.inherit_bg = next_attribute.inherit_bg;
|
||||||
|
|
||||||
int ax = x - window->getTermX();
|
int ax = x - x_offset;
|
||||||
int ay = y - window->getTermY();
|
int ay = y - y_offset;
|
||||||
|
|
||||||
if ( area
|
if ( area
|
||||||
&& ax >= 0 && ay >= 0
|
&& ax >= 0 && ay >= 0
|
||||||
|
@ -1779,17 +1791,13 @@ int FVTerm::print (FVTerm::term_area* area, FString& s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rsh = area->right_shadow;
|
if ( cursor->x_ref() > x_offset + width + rsh )
|
||||||
bsh = area->bottom_shadow;
|
|
||||||
const FRect& area_geometry = window->getTermGeometry();
|
|
||||||
|
|
||||||
if ( cursor->x_ref() > area_geometry.getX2()+rsh )
|
|
||||||
{
|
{
|
||||||
cursor->x_ref() = short(window->getTermX());
|
cursor->x_ref() = short(x_offset + 1);
|
||||||
cursor->y_ref()++;
|
cursor->y_ref()++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cursor->y_ref() > area_geometry.getY2()+bsh )
|
if ( cursor->y_ref() > y_offset + height + bsh )
|
||||||
{
|
{
|
||||||
cursor->y_ref()--;
|
cursor->y_ref()--;
|
||||||
break;
|
break;
|
||||||
|
@ -1808,17 +1816,13 @@ int FVTerm::print (FVTerm::term_area* area, FString& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FVTerm::print (register int c)
|
int FVTerm::print (register int c)
|
||||||
{
|
{
|
||||||
term_area* area;
|
term_area* area = getPrintArea();
|
||||||
FWidget* w;
|
|
||||||
w = static_cast<FWidget*>(this);
|
|
||||||
area = w->getPrintArea();
|
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
{
|
{
|
||||||
FWidget* root = w->getRootWidget();
|
if ( vdesktop )
|
||||||
area = vdesktop;
|
area = vdesktop;
|
||||||
|
else
|
||||||
if ( ! root )
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1829,13 +1833,19 @@ int FVTerm::print (register int c)
|
||||||
int FVTerm::print (FVTerm::term_area* area, register int c)
|
int FVTerm::print (FVTerm::term_area* area, register int c)
|
||||||
{
|
{
|
||||||
FOptiAttr::char_data nc; // next character
|
FOptiAttr::char_data nc; // next character
|
||||||
FWidget* window;
|
int x_offset, y_offset, width, height, rsh, bsh, ax, ay;
|
||||||
int rsh, bsh, ax, ay;
|
|
||||||
short x, y;
|
short x, y;
|
||||||
|
|
||||||
if ( ! area )
|
if ( ! area )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
x_offset = area->x_offset;
|
||||||
|
y_offset = area->y_offset;
|
||||||
|
width = area->width;
|
||||||
|
height = area->height;
|
||||||
|
rsh = area->right_shadow;
|
||||||
|
bsh = area->bottom_shadow;
|
||||||
|
|
||||||
nc.code = c;
|
nc.code = c;
|
||||||
nc.fg_color = next_attribute.fg_color;
|
nc.fg_color = next_attribute.fg_color;
|
||||||
nc.bg_color = next_attribute.bg_color;
|
nc.bg_color = next_attribute.bg_color;
|
||||||
|
@ -1856,15 +1866,10 @@ int FVTerm::print (FVTerm::term_area* area, register int c)
|
||||||
nc.trans_shadow = next_attribute.trans_shadow;
|
nc.trans_shadow = next_attribute.trans_shadow;
|
||||||
nc.inherit_bg = next_attribute.inherit_bg;
|
nc.inherit_bg = next_attribute.inherit_bg;
|
||||||
|
|
||||||
x = short(cursor->getX());
|
x = short(cursor->getX() - 1);
|
||||||
y = short(cursor->getY());
|
y = short(cursor->getY() - 1);
|
||||||
window = area->widget;
|
ax = x - x_offset;
|
||||||
|
ay = y - y_offset;
|
||||||
if ( ! window )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
ax = x - window->getTermX();
|
|
||||||
ay = y - window->getTermY();
|
|
||||||
|
|
||||||
if ( ax >= 0 && ay >= 0
|
if ( ax >= 0 && ay >= 0
|
||||||
&& ax < area->width + area->right_shadow
|
&& ax < area->width + area->right_shadow
|
||||||
|
@ -1904,17 +1909,14 @@ int FVTerm::print (FVTerm::term_area* area, register int c)
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor->x_ref()++;
|
cursor->x_ref()++;
|
||||||
rsh = area->right_shadow;
|
|
||||||
bsh = area->bottom_shadow;
|
|
||||||
const FRect& area_geometry = window->getTermGeometry();
|
|
||||||
|
|
||||||
if ( cursor->x_ref() > area_geometry.getX2()+rsh )
|
if ( cursor->x_ref() > x_offset + width + rsh )
|
||||||
{
|
{
|
||||||
cursor->x_ref() = short(window->getTermX());
|
cursor->x_ref() = short(x_offset + 1);
|
||||||
cursor->y_ref()++;
|
cursor->y_ref()++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cursor->y_ref() > area_geometry.getY2()+bsh )
|
if ( cursor->y_ref() > y_offset + height + bsh )
|
||||||
{
|
{
|
||||||
cursor->y_ref()--;
|
cursor->y_ref()--;
|
||||||
updateVTerm (area);
|
updateVTerm (area);
|
||||||
|
|
10
src/fvterm.h
10
src/fvterm.h
|
@ -84,6 +84,8 @@ class FVTerm : public FObject, public FTerm
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
int x_offset;
|
||||||
|
int y_offset;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int right_shadow;
|
int right_shadow;
|
||||||
|
@ -106,9 +108,9 @@ class FVTerm : public FObject, public FTerm
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createArea (const FRect&, const FPoint&, FVTerm::term_area*&);
|
void createArea (const FRect&, const FPoint&, FVTerm::term_area*&);
|
||||||
void createArea (int, int, int, int, FVTerm::term_area*&);
|
void createArea (int, int, int, int, int, int, FVTerm::term_area*&);
|
||||||
static void resizeArea (const FRect&, const FPoint&, FVTerm::term_area*);
|
static void resizeArea (const FRect&, const FPoint&, FVTerm::term_area*);
|
||||||
static void resizeArea (int, int, int, int, FVTerm::term_area*);
|
static void resizeArea (int, int, int, int, int, int, FVTerm::term_area*);
|
||||||
static void removeArea (FVTerm::term_area*&);
|
static void removeArea (FVTerm::term_area*&);
|
||||||
static void restoreVTerm (const FRect&);
|
static void restoreVTerm (const FRect&);
|
||||||
static void restoreVTerm (int, int, int, int);
|
static void restoreVTerm (int, int, int, int);
|
||||||
|
@ -129,8 +131,8 @@ class FVTerm : public FObject, public FTerm
|
||||||
static void scrollAreaForward (FVTerm::term_area*);
|
static void scrollAreaForward (FVTerm::term_area*);
|
||||||
static void scrollAreaReverse (FVTerm::term_area*);
|
static void scrollAreaReverse (FVTerm::term_area*);
|
||||||
static void clearArea (FVTerm::term_area*);
|
static void clearArea (FVTerm::term_area*);
|
||||||
static FOptiAttr::char_data getCharacter (int, const FPoint&, FVTerm*);
|
static FOptiAttr::char_data getCharacter (character_type, const FPoint&, FVTerm*);
|
||||||
static FOptiAttr::char_data getCharacter (int, int, int, FVTerm*);
|
static FOptiAttr::char_data getCharacter (character_type, int, int, FVTerm*);
|
||||||
static FOptiAttr::char_data getCoveredCharacter (const FPoint&, FVTerm*);
|
static FOptiAttr::char_data getCoveredCharacter (const FPoint&, FVTerm*);
|
||||||
static FOptiAttr::char_data getCoveredCharacter (int, int, FVTerm*);
|
static FOptiAttr::char_data getCoveredCharacter (int, int, FVTerm*);
|
||||||
static FOptiAttr::char_data getOverlappedCharacter (const FPoint&, FVTerm*);
|
static FOptiAttr::char_data getOverlappedCharacter (const FPoint&, FVTerm*);
|
||||||
|
|
|
@ -1293,7 +1293,9 @@ void FWidget::resize()
|
||||||
if ( isRootWidget() )
|
if ( isRootWidget() )
|
||||||
{
|
{
|
||||||
detectTermSize();
|
detectTermSize();
|
||||||
const FRect& term_geometry = getGeometry();
|
FRect term_geometry = getTermGeometry();
|
||||||
|
term_geometry.move(-1,-1);
|
||||||
|
|
||||||
resizeVTerm (term_geometry);
|
resizeVTerm (term_geometry);
|
||||||
resizeArea (term_geometry, getShadow(), vdesktop);
|
resizeArea (term_geometry, getShadow(), vdesktop);
|
||||||
adjustSizeGlobal();
|
adjustSizeGlobal();
|
||||||
|
@ -1584,17 +1586,10 @@ void FWidget::setPos (int x, int y, bool adjust)
|
||||||
|
|
||||||
if ( y < 1 )
|
if ( y < 1 )
|
||||||
y = 1;
|
y = 1;
|
||||||
|
}
|
||||||
|
|
||||||
wsize.setX(x);
|
wsize.setPos(x,y);
|
||||||
wsize.setY(y);
|
adjust_wsize.setPos(x,y);
|
||||||
adjust_wsize.setX(x);
|
|
||||||
adjust_wsize.setY(y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wsize.setPos(x,y);
|
|
||||||
adjust_wsize.setPos(x,y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( adjust )
|
if ( adjust )
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
@ -1863,17 +1858,10 @@ void FWidget::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::move (int x, int y)
|
void FWidget::move (int dx, int dy)
|
||||||
{
|
{
|
||||||
if ( adjust_wsize.getX() == x && adjust_wsize.getY() == y )
|
wsize.move(dx,dy);
|
||||||
return;
|
adjust_wsize.move(dx,dy);
|
||||||
|
|
||||||
// Avoid to move widget completely outside the terminal
|
|
||||||
if ( x+getWidth() <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wsize.setPos(x,y);
|
|
||||||
adjust_wsize.setPos(x,y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -475,8 +475,8 @@ class FWidget : public FVTerm
|
||||||
void setColor();
|
void setColor();
|
||||||
// make every setColor from FVTerm available
|
// make every setColor from FVTerm available
|
||||||
using FVTerm::setColor;
|
using FVTerm::setColor;
|
||||||
void setX (int, bool = true);
|
virtual void setX (int, bool = true);
|
||||||
void setY (int, bool = true);
|
virtual void setY (int, bool = true);
|
||||||
virtual void setPos (const FPoint&, bool = true);
|
virtual void setPos (const FPoint&, bool = true);
|
||||||
virtual void setPos (int, int, bool = true);
|
virtual void setPos (int, int, bool = true);
|
||||||
virtual void setWidth (int, bool = true);
|
virtual void setWidth (int, bool = true);
|
||||||
|
|
129
src/fwindow.cpp
129
src/fwindow.cpp
|
@ -24,7 +24,9 @@ FWindow::FWindow(FWidget* parent)
|
||||||
, normalGeometry()
|
, normalGeometry()
|
||||||
{
|
{
|
||||||
setWindowWidget();
|
setWindowWidget();
|
||||||
createArea (getGeometry(), getShadow(), vwin);
|
FRect geometry = getTermGeometry();
|
||||||
|
geometry.move(-1,-1);
|
||||||
|
createArea (geometry, getShadow(), vwin);
|
||||||
addWindow (this);
|
addWindow (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,10 +146,20 @@ void FWindow::onWindowLowered (FEvent*)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::adjustSize()
|
void FWindow::adjustSize()
|
||||||
{
|
{
|
||||||
|
int old_x = getX();
|
||||||
|
int old_y = getY();
|
||||||
FWidget::adjustSize();
|
FWidget::adjustSize();
|
||||||
|
|
||||||
if ( zoomed )
|
if ( zoomed )
|
||||||
setGeometry (1, 1, getMaxWidth(), getMaxHeight(), false);
|
setGeometry (1, 1, getMaxWidth(), getMaxHeight(), false);
|
||||||
|
else if ( vwin )
|
||||||
|
{
|
||||||
|
if ( getX() != old_x )
|
||||||
|
vwin->x_offset = getTermX() - 1;
|
||||||
|
|
||||||
|
if ( getY() != old_y )
|
||||||
|
vwin->y_offset = getTermY() - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,10 +212,8 @@ void FWindow::drawBorder()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::show()
|
void FWindow::show()
|
||||||
{
|
{
|
||||||
term_area* area = getVWin();
|
if ( vwin )
|
||||||
|
vwin->visible = true;
|
||||||
if ( area )
|
|
||||||
area->visible = true;
|
|
||||||
|
|
||||||
FWidget::show();
|
FWidget::show();
|
||||||
}
|
}
|
||||||
|
@ -211,14 +221,48 @@ void FWindow::show()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::hide()
|
void FWindow::hide()
|
||||||
{
|
{
|
||||||
term_area* area = getVWin();
|
if ( vwin )
|
||||||
|
vwin->visible = false;
|
||||||
if ( area )
|
|
||||||
area->visible = false;
|
|
||||||
|
|
||||||
FWidget::hide();
|
FWidget::hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWindow::setX (int x, bool adjust)
|
||||||
|
{
|
||||||
|
FWidget::setX (x, adjust);
|
||||||
|
|
||||||
|
if ( vwin )
|
||||||
|
vwin->x_offset = getTermX() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWindow::setY (int y, bool adjust)
|
||||||
|
{
|
||||||
|
if ( y < 1 )
|
||||||
|
y = 1;
|
||||||
|
|
||||||
|
FWidget::setY (y, adjust);
|
||||||
|
|
||||||
|
if ( vwin )
|
||||||
|
vwin->y_offset = getTermY() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWindow::setPos (int x, int y, bool adjust)
|
||||||
|
{
|
||||||
|
if ( y < 1 )
|
||||||
|
y = 1;
|
||||||
|
|
||||||
|
FWidget::setPos (x, y, adjust);
|
||||||
|
|
||||||
|
if ( vwin )
|
||||||
|
{
|
||||||
|
vwin->x_offset = getTermX() - 1;
|
||||||
|
vwin->y_offset = getTermY() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::setWidth (int w, bool adjust)
|
void FWindow::setWidth (int w, bool adjust)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +270,11 @@ void FWindow::setWidth (int w, bool adjust)
|
||||||
FWidget::setWidth (w, adjust);
|
FWidget::setWidth (w, adjust);
|
||||||
|
|
||||||
if ( vwin && getWidth() != old_width )
|
if ( vwin && getWidth() != old_width )
|
||||||
resizeArea (getGeometry(), getShadow(), vwin);
|
{
|
||||||
|
FRect geometry = getTermGeometry();
|
||||||
|
geometry.move(-1,-1);
|
||||||
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -236,7 +284,11 @@ void FWindow::setHeight (int h, bool adjust)
|
||||||
FWidget::setHeight (h, adjust);
|
FWidget::setHeight (h, adjust);
|
||||||
|
|
||||||
if ( vwin && getHeight() != old_height )
|
if ( vwin && getHeight() != old_height )
|
||||||
resizeArea (getGeometry(), getShadow(), vwin);
|
{
|
||||||
|
FRect geometry = getTermGeometry();
|
||||||
|
geometry.move(-1,-1);
|
||||||
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -247,18 +299,55 @@ void FWindow::setSize (int w, int h, bool adjust)
|
||||||
FWidget::setSize (w, h, adjust);
|
FWidget::setSize (w, h, adjust);
|
||||||
|
|
||||||
if ( vwin && (getWidth() != old_width || getHeight() != old_height) )
|
if ( vwin && (getWidth() != old_width || getHeight() != old_height) )
|
||||||
resizeArea (getGeometry(), getShadow(), vwin);
|
{
|
||||||
|
FRect geometry = getTermGeometry();
|
||||||
|
geometry.move(-1,-1);
|
||||||
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
void FWindow::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
|
int old_x = getX();
|
||||||
|
int old_y = getY();
|
||||||
int old_width = getWidth();
|
int old_width = getWidth();
|
||||||
int old_height = getHeight();
|
int old_height = getHeight();
|
||||||
|
|
||||||
|
if ( y < 1 )
|
||||||
|
y = 1;
|
||||||
|
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
|
|
||||||
if ( vwin && (getWidth() != old_width || getHeight() != old_height) )
|
if ( vwin )
|
||||||
resizeArea (getGeometry(), getShadow(), vwin);
|
{
|
||||||
|
if ( getWidth() != old_width || getHeight() != old_height )
|
||||||
|
{
|
||||||
|
FRect geometry = getTermGeometry();
|
||||||
|
geometry.move(-1,-1);
|
||||||
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( getX() != old_x )
|
||||||
|
vwin->x_offset = getTermX() - 1;
|
||||||
|
|
||||||
|
if ( getY() != old_y )
|
||||||
|
vwin->y_offset = getTermY() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWindow::move (int dx, int dy)
|
||||||
|
{
|
||||||
|
FWidget::move (dx,dy);
|
||||||
|
|
||||||
|
if ( vwin )
|
||||||
|
{
|
||||||
|
vwin->x_offset = getTermX() - 1;
|
||||||
|
vwin->y_offset = getTermY() - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -699,10 +788,8 @@ bool FWindow::activateWindow (bool on)
|
||||||
bool FWindow::isWindowHidden() const
|
bool FWindow::isWindowHidden() const
|
||||||
{
|
{
|
||||||
// returns the window hidden state
|
// returns the window hidden state
|
||||||
term_area* area = getVWin();
|
if ( vwin )
|
||||||
|
return ! vwin->visible;
|
||||||
if ( area )
|
|
||||||
return ! area->visible;
|
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -770,7 +857,11 @@ void FWindow::setShadowSize (int right, int bottom)
|
||||||
new_bottom = getShadow().getY();
|
new_bottom = getShadow().getY();
|
||||||
|
|
||||||
if ( vwin && (new_right != old_right || new_bottom != old_bottom) )
|
if ( vwin && (new_right != old_right || new_bottom != old_bottom) )
|
||||||
resizeArea (getGeometry(), getShadow(), vwin);
|
{
|
||||||
|
FRect geometry = getTermGeometry();
|
||||||
|
geometry.move(-1,-1);
|
||||||
|
resizeArea (geometry, getShadow(), vwin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -88,12 +88,20 @@ class FWindow : public FWidget
|
||||||
virtual void drawBorder();
|
virtual void drawBorder();
|
||||||
virtual void show();
|
virtual void show();
|
||||||
virtual void hide();
|
virtual void hide();
|
||||||
|
virtual void setX (int, bool = true);
|
||||||
|
virtual void setY (int, bool = true);
|
||||||
|
virtual void setPos (int, int, bool = true);
|
||||||
|
// make every setPos from FWidget available
|
||||||
|
using FWidget::setPos;
|
||||||
virtual void setWidth (int, bool = true);
|
virtual void setWidth (int, bool = true);
|
||||||
virtual void setHeight (int, bool = true);
|
virtual void setHeight (int, bool = true);
|
||||||
virtual void setSize (int, int, bool = true);
|
virtual void setSize (int, int, bool = true);
|
||||||
// make every setGeometry from FWidget available
|
// make every setGeometry from FWidget available
|
||||||
using FWidget::setGeometry;
|
using FWidget::setGeometry;
|
||||||
void setGeometry (int, int, int, int, bool = true);
|
void setGeometry (int, int, int, int, bool = true);
|
||||||
|
virtual void move (int, int);
|
||||||
|
// make every move from FWidget available
|
||||||
|
using FWidget::move;
|
||||||
static FWindow* getWindowWidgetAt (const FPoint&);
|
static FWindow* getWindowWidgetAt (const FPoint&);
|
||||||
static FWindow* getWindowWidgetAt (int, int);
|
static FWindow* getWindowWidgetAt (int, int);
|
||||||
static void addWindow (FWidget*);
|
static void addWindow (FWidget*);
|
||||||
|
|
|
@ -539,7 +539,7 @@ void Window::adjustSize()
|
||||||
if ( Y < 2)
|
if ( Y < 2)
|
||||||
Y = 2;
|
Y = 2;
|
||||||
|
|
||||||
move (X, Y);
|
setPos (X, Y);
|
||||||
iter = begin = windows.begin();
|
iter = begin = windows.begin();
|
||||||
|
|
||||||
while ( iter != windows.end() )
|
while ( iter != windows.end() )
|
||||||
|
@ -550,7 +550,7 @@ void Window::adjustSize()
|
||||||
n = int(std::distance(begin, iter));
|
n = int(std::distance(begin, iter));
|
||||||
x = dx + 5 + (n%3)*25 + int(n/3)*3;
|
x = dx + 5 + (n%3)*25 + int(n/3)*3;
|
||||||
y = dy + 11 + int(n/3)*3;
|
y = dy + 11 + int(n/3)*3;
|
||||||
(*iter)->dgl->move (x, y);
|
(*iter)->dgl->setPos (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
|
|
Loading…
Reference in New Issue