Add a transparent example program + improve transparent shadow
This commit is contained in:
parent
f870506194
commit
7d0cf3383e
|
@ -31,6 +31,7 @@ test/watch
|
|||
test/menu
|
||||
test/windows
|
||||
test/term-attributes
|
||||
test/transparent
|
||||
test/input-dialog
|
||||
test/mandelbrot
|
||||
test/keyboard
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2016-08-21 Markus Gans <guru.mail@muenster.de>
|
||||
* Improved transparent shadow background
|
||||
* Add "transparent" example to demonstrate transparency
|
||||
|
||||
2016-08-20 Markus Gans <guru.mail@muenster.de>
|
||||
* Switch back to the own dialog when you closing a dialog menu
|
||||
* switchToPrevWindow() is looking for another window
|
||||
|
|
17
src/fapp.cpp
17
src/fapp.cpp
|
@ -54,7 +54,7 @@ FApplication::FApplication (int& _argc, char**& _argv)
|
|||
&& "FApplication: There should be only one application object" );
|
||||
rootObj = this;
|
||||
|
||||
if ( ! _argc || ! _argv )
|
||||
if ( ! (_argc && _argv) )
|
||||
{
|
||||
static char* empty = const_cast<char*>("");
|
||||
_argc = 0;
|
||||
|
@ -466,7 +466,7 @@ int FApplication::modifierKeyCorrection (int& key_id)
|
|||
getModifierKey();
|
||||
modifier_key& m = mod_key;
|
||||
|
||||
if ( ! m.shift && ! m.ctrl && ! m.alt )
|
||||
if ( ! (m.shift || m.ctrl || m.alt) )
|
||||
{
|
||||
return key_id;
|
||||
}
|
||||
|
@ -1752,15 +1752,18 @@ void FApplication::setMainWidget (FWidget* widget)
|
|||
//----------------------------------------------------------------------
|
||||
int FApplication::exec() // run
|
||||
{
|
||||
FWidget* focus_widget;
|
||||
quit_now = false;
|
||||
quit_code = 0;
|
||||
|
||||
// set the cursor to the focus widget
|
||||
if ( getFocusWidget()
|
||||
&& getFocusWidget()->isVisible()
|
||||
&& getFocusWidget()->hasVisibleCursor() )
|
||||
focus_widget = getFocusWidget();
|
||||
|
||||
if ( focus_widget
|
||||
&& focus_widget->isVisible()
|
||||
&& focus_widget->hasVisibleCursor() )
|
||||
{
|
||||
getFocusWidget()->setCursor();
|
||||
focus_widget->setCursor();
|
||||
showCursor();
|
||||
flush_out();
|
||||
}
|
||||
|
@ -1779,7 +1782,7 @@ int FApplication::enter_loop() // event loop
|
|||
old_app_exit_loop = app_exit_loop;
|
||||
app_exit_loop = false;
|
||||
|
||||
while ( ! quit_now && ! app_exit_loop )
|
||||
while ( ! (quit_now || app_exit_loop) )
|
||||
processNextEvent();
|
||||
|
||||
app_exit_loop = old_app_exit_loop;
|
||||
|
|
|
@ -134,6 +134,7 @@ void FButton::draw()
|
|||
register wchar_t* dest;
|
||||
wchar_t* ButtonText;
|
||||
FString txt;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
int active_focus;
|
||||
int d, i, j, x, mono_offset, margin;
|
||||
int length, hotkeypos, hotkey_offset, space;
|
||||
|
@ -173,8 +174,10 @@ void FButton::draw()
|
|||
clearFlatBorder();
|
||||
|
||||
clearShadow();
|
||||
setColor ( getParentWidget()->getForegroundColor()
|
||||
, getParentWidget()->getBackgroundColor() );
|
||||
|
||||
if ( parent_widget )
|
||||
setColor ( parent_widget->getForegroundColor()
|
||||
, parent_widget->getBackgroundColor() );
|
||||
|
||||
for (int y=1; y <= height; y++)
|
||||
{
|
||||
|
@ -243,7 +246,9 @@ void FButton::draw()
|
|||
}
|
||||
else if ( ! isMonochron() )
|
||||
{
|
||||
setColor (button_bg, getParentWidget()->getBackgroundColor());
|
||||
if ( parent_widget )
|
||||
setColor (button_bg, parent_widget->getBackgroundColor());
|
||||
|
||||
gotoxy (xpos+xmin-1+d, ypos+ymin-1);
|
||||
|
||||
for (int y=1; y <= height; y++)
|
||||
|
@ -265,8 +270,9 @@ void FButton::draw()
|
|||
&& (is_Flat || ! hasShadow() || isMonochron()) )
|
||||
{
|
||||
// clear the right █ from button down
|
||||
setColor ( getParentWidget()->getForegroundColor()
|
||||
, getParentWidget()->getBackgroundColor() );
|
||||
if ( parent_widget )
|
||||
setColor ( parent_widget->getForegroundColor()
|
||||
, parent_widget->getBackgroundColor() );
|
||||
|
||||
for (int y=1; y <= height; y++)
|
||||
{
|
||||
|
@ -365,8 +371,10 @@ void FButton::draw()
|
|||
|
||||
if ( is_NonFlatShadow && ! button_down )
|
||||
{
|
||||
setColor ( getParentWidget()->getForegroundColor()
|
||||
, getParentWidget()->getBackgroundColor() );
|
||||
if ( parent_widget )
|
||||
setColor ( parent_widget->getForegroundColor()
|
||||
, parent_widget->getBackgroundColor() );
|
||||
|
||||
print(' '); // restore background after button down
|
||||
drawShadow();
|
||||
}
|
||||
|
@ -488,10 +496,20 @@ void FButton::hide()
|
|||
int s, f, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
FWidget::hide();
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
bg = getParentWidget()->getBackgroundColor();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
fg = parent_widget->getForegroundColor();
|
||||
bg = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = wc.dialog_fg;
|
||||
bg = wc.dialog_bg;
|
||||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
s = hasShadow() ? 1 : 0;
|
||||
f = isFlat() ? 1 : 0;
|
||||
|
|
|
@ -102,7 +102,10 @@ void FButtonGroup::directFocus()
|
|||
if ( focused_widget )
|
||||
focused_widget->redraw();
|
||||
|
||||
getFocusWidget()->redraw();
|
||||
focused_widget = getFocusWidget();
|
||||
|
||||
if ( focused_widget )
|
||||
focused_widget->redraw();
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -122,7 +125,10 @@ void FButtonGroup::directFocus()
|
|||
if ( focused_widget )
|
||||
focused_widget->redraw();
|
||||
|
||||
getFocusWidget()->redraw();
|
||||
focused_widget = getFocusWidget();
|
||||
|
||||
if ( focused_widget )
|
||||
focused_widget->redraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,6 +289,7 @@ void FButtonGroup::hide()
|
|||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget::hide();
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
if ( ! buttonlist.empty() )
|
||||
{
|
||||
|
@ -297,10 +304,18 @@ void FButtonGroup::hide()
|
|||
}
|
||||
}
|
||||
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
bg = getParentWidget()->getBackgroundColor();
|
||||
setColor (fg, bg);
|
||||
if ( parent_widget )
|
||||
{
|
||||
fg = parent_widget->getForegroundColor();
|
||||
bg = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = wc.dialog_fg;
|
||||
bg = wc.dialog_bg;
|
||||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
size = width;
|
||||
blank = new char[size+1];
|
||||
memset(blank, ' ', uLong(size));
|
||||
|
@ -318,7 +333,7 @@ void FButtonGroup::hide()
|
|||
//----------------------------------------------------------------------
|
||||
void FButtonGroup::insert (FToggleButton* button)
|
||||
{
|
||||
if ( button->group() )
|
||||
if ( button && button->group() )
|
||||
button->group()->remove(button);
|
||||
|
||||
// setChecked the first FRadioButton
|
||||
|
@ -533,6 +548,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
|||
if ( prev_element )
|
||||
prev_element->redraw();
|
||||
|
||||
if ( getFocusWidget() )
|
||||
getFocusWidget()->redraw();
|
||||
}
|
||||
else if ( in_ev->getFocusType() == fc::FocusPreviousWidget )
|
||||
|
@ -544,6 +560,7 @@ void FButtonGroup::onFocusIn (FFocusEvent* in_ev)
|
|||
if ( prev_element )
|
||||
prev_element->redraw();
|
||||
|
||||
if ( getFocusWidget() )
|
||||
getFocusWidget()->redraw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ void FDialog::drawBorder()
|
|||
{
|
||||
short fg;
|
||||
|
||||
if ( ! isRootWidget() )
|
||||
if ( ! isRootWidget() && getParentWidget() )
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
else
|
||||
fg = wc.term_fg;
|
||||
|
@ -306,7 +306,10 @@ void FDialog::leaveMenu()
|
|||
dialog_menu->hide();
|
||||
activateWindow();
|
||||
raiseWindow();
|
||||
|
||||
if ( getWindowFocusWidget() )
|
||||
getWindowFocusWidget()->setFocus();
|
||||
|
||||
redraw();
|
||||
|
||||
if ( statusBar() )
|
||||
|
@ -752,7 +755,7 @@ void FDialog::onMouseDoubleClick (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FDialog::onAccel (FAccelEvent*)
|
||||
{
|
||||
if ( ! isHiddenWindow() && ! isActiveWindow() )
|
||||
if ( ! (isHiddenWindow() || isActiveWindow()) )
|
||||
{
|
||||
bool has_raised = raiseWindow();
|
||||
activateDialog();
|
||||
|
@ -771,12 +774,13 @@ void FDialog::onWindowActive (FEvent*)
|
|||
drawTitleBar();
|
||||
|
||||
if ( ! FWidget::getFocusWidget() )
|
||||
{
|
||||
if ( getWindowFocusWidget()
|
||||
&& getWindowFocusWidget()->isVisible()
|
||||
&& getWindowFocusWidget()->isShown() )
|
||||
{
|
||||
FWidget* win_focus_widget = getWindowFocusWidget();
|
||||
|
||||
if ( win_focus_widget
|
||||
&& win_focus_widget->isVisible()
|
||||
&& win_focus_widget->isShown() )
|
||||
{
|
||||
win_focus_widget->setFocus();
|
||||
win_focus_widget->redraw();
|
||||
}
|
||||
|
@ -808,7 +812,7 @@ void FDialog::onWindowRaised (FEvent*)
|
|||
{
|
||||
widgetList::const_iterator iter, end;
|
||||
|
||||
if ( ! isVisible() || ! isShown() )
|
||||
if ( ! (isVisible() && isShown()) )
|
||||
return;
|
||||
|
||||
putArea (getGlobalPos(), vwin);
|
||||
|
@ -869,12 +873,14 @@ void FDialog::show()
|
|||
FWindow::show();
|
||||
|
||||
// set the cursor to the focus widget
|
||||
if ( FWidget::getFocusWidget()
|
||||
&& FWidget::getFocusWidget()->isVisible()
|
||||
&& FWidget::getFocusWidget()->hasVisibleCursor()
|
||||
&& FWidget::getFocusWidget()->isCursorInside() )
|
||||
FWidget* focus_widget = FWidget::getFocusWidget();
|
||||
|
||||
if ( focus_widget
|
||||
&& focus_widget->isVisible()
|
||||
&& focus_widget->hasVisibleCursor()
|
||||
&& focus_widget->isCursorInside() )
|
||||
{
|
||||
FWidget::getFocusWidget()->setCursor();
|
||||
focus_widget->setCursor();
|
||||
showCursor();
|
||||
flush_out();
|
||||
}
|
||||
|
@ -1003,14 +1009,15 @@ void FDialog::move (int x, int y)
|
|||
FWidget::adjustSize();
|
||||
|
||||
// set the cursor to the focus widget
|
||||
if ( FWidget::getFocusWidget()
|
||||
&& FWidget::getFocusWidget()->isVisible()
|
||||
&& FWidget::getFocusWidget()->hasVisibleCursor() )
|
||||
FWidget* focus_widget = FWidget::getFocusWidget();
|
||||
if ( focus_widget
|
||||
&& focus_widget->isVisible()
|
||||
&& focus_widget->hasVisibleCursor() )
|
||||
{
|
||||
FPoint cursor_pos = FWidget::getFocusWidget()->getCursorPos();
|
||||
FPoint cursor_pos = focus_widget->getCursorPos();
|
||||
cursor_pos -= FPoint(dx,dy);
|
||||
|
||||
if ( ! FWidget::getFocusWidget()->setCursorPos(cursor_pos) )
|
||||
if ( ! focus_widget->setCursorPos(cursor_pos) )
|
||||
hideCursor();
|
||||
}
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ FFileDialog::~FFileDialog() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::init()
|
||||
{
|
||||
FWidget* parent_widget;
|
||||
int x, y;
|
||||
height = 15;
|
||||
width = 42;
|
||||
|
@ -115,8 +116,15 @@ void FFileDialog::init()
|
|||
if ( width < 20 )
|
||||
width = 20;
|
||||
|
||||
x = 1 + int((getParentWidget()->getWidth()-width)/2);
|
||||
y = 1 + int((getParentWidget()->getHeight()-height)/3);
|
||||
parent_widget = getParentWidget();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
x = 1 + int((parent_widget->getWidth()-width)/2);
|
||||
y = 1 + int((parent_widget->getHeight()-height)/3);
|
||||
}
|
||||
else
|
||||
x = y = 1;
|
||||
|
||||
if ( dlg_type == FFileDialog::Save )
|
||||
FDialog::setText("Save file");
|
||||
|
@ -461,10 +469,21 @@ void FFileDialog::cb_processShowHidden (FWidget*, void*)
|
|||
//----------------------------------------------------------------------
|
||||
void FFileDialog::adjustSize()
|
||||
{
|
||||
int X, Y;
|
||||
int max_height = getRootWidget()->getClientHeight();
|
||||
int max_width = getRootWidget()->getClientWidth();
|
||||
int h = max_height - 6;
|
||||
int h, X, Y, max_width, max_height;
|
||||
FWidget* root_widget = getRootWidget();
|
||||
|
||||
if ( root_widget )
|
||||
{
|
||||
max_width = root_widget->getClientWidth();
|
||||
max_height = root_widget->getClientHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
max_width = 80;
|
||||
max_height = 24;
|
||||
}
|
||||
|
||||
h = max_height - 6;
|
||||
|
||||
if ( h < 15 ) // minimum
|
||||
h = 15;
|
||||
|
@ -499,7 +518,10 @@ FFileDialog& FFileDialog::operator = (const FFileDialog& fdlg)
|
|||
delete filebrowser;
|
||||
delete filename;
|
||||
clear();
|
||||
|
||||
if ( fdlg.getParentWidget() )
|
||||
fdlg.getParentWidget()->addChild (this);
|
||||
|
||||
directory = fdlg.directory;
|
||||
filter_pattern = fdlg.filter_pattern;
|
||||
dlg_type = fdlg.dlg_type;
|
||||
|
|
|
@ -55,12 +55,23 @@ FLabel::~FLabel() // destructor
|
|||
//----------------------------------------------------------------------
|
||||
void FLabel::init()
|
||||
{
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
if ( isEnabled() )
|
||||
flags |= fc::active;
|
||||
|
||||
unsetFocusable();
|
||||
foregroundColor = getParentWidget()->getForegroundColor();
|
||||
backgroundColor = getParentWidget()->getBackgroundColor();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
foregroundColor = parent_widget->getForegroundColor();
|
||||
backgroundColor = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
foregroundColor = wc.dialog_fg;
|
||||
backgroundColor = wc.dialog_bg;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -327,10 +338,21 @@ void FLabel::hide()
|
|||
{
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
bg = getParentWidget()->getBackgroundColor();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
fg = parent_widget->getForegroundColor();
|
||||
bg = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = wc.dialog_fg;
|
||||
bg = wc.dialog_bg;
|
||||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
blank = new char[width+1];
|
||||
memset(blank, ' ', uLong(width));
|
||||
|
@ -345,7 +367,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
|||
if ( ev->getButton() != fc::LeftButton )
|
||||
return;
|
||||
|
||||
if ( ! isEnabled() || ! accel_widget )
|
||||
if ( ! (isEnabled() && accel_widget) )
|
||||
return;
|
||||
|
||||
if ( ! accel_widget->hasFocus() )
|
||||
|
@ -372,7 +394,7 @@ void FLabel::onMouseDown (FMouseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
void FLabel::onAccel (FAccelEvent* ev)
|
||||
{
|
||||
if ( ! isEnabled() || ! accel_widget )
|
||||
if ( ! (isEnabled() && accel_widget) )
|
||||
return;
|
||||
|
||||
if ( ! accel_widget->hasFocus() )
|
||||
|
|
|
@ -289,10 +289,21 @@ void FLineEdit::hide()
|
|||
int s, size, lable_Length;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
bg = getParentWidget()->getBackgroundColor();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
fg = parent_widget->getForegroundColor();
|
||||
bg = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = wc.dialog_fg;
|
||||
bg = wc.dialog_bg;
|
||||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
s = hasShadow() ? 1 : 0;
|
||||
size = width + s;
|
||||
|
|
|
@ -585,10 +585,21 @@ void FListBox::hide()
|
|||
int n, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
bg = getParentWidget()->getBackgroundColor();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
fg = parent_widget->getForegroundColor();
|
||||
bg = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = wc.dialog_fg;
|
||||
bg = wc.dialog_bg;
|
||||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
n = isNewFont() ? 1 : 0;
|
||||
size = width + n;
|
||||
|
@ -1018,8 +1029,10 @@ void FListBox::onMouseDown (FMouseEvent* ev)
|
|||
FFocusEvent out (fc::FocusOut_Event);
|
||||
FApplication::queueEvent(focused_widget, &out);
|
||||
setFocus();
|
||||
|
||||
if ( focused_widget )
|
||||
focused_widget->redraw();
|
||||
|
||||
if ( statusBar() )
|
||||
statusBar()->drawMessage();
|
||||
}
|
||||
|
|
|
@ -998,7 +998,10 @@ void FMenu::onKeyPress (FKeyEvent* ev)
|
|||
FMenu* smenu = reinterpret_cast<FMenu*>(getSuperMenu());
|
||||
hideSubMenus();
|
||||
hide();
|
||||
|
||||
if ( smenu->getSelectedItem() )
|
||||
smenu->getSelectedItem()->setFocus();
|
||||
|
||||
smenu->redraw();
|
||||
|
||||
if ( statusBar() )
|
||||
|
@ -1034,7 +1037,10 @@ void FMenu::onKeyPress (FKeyEvent* ev)
|
|||
if ( isSubMenu() )
|
||||
{
|
||||
FMenu* smenu = reinterpret_cast<FMenu*>(getSuperMenu());
|
||||
|
||||
if ( smenu->getSelectedItem() )
|
||||
smenu->getSelectedItem()->setFocus();
|
||||
|
||||
smenu->redraw();
|
||||
}
|
||||
else
|
||||
|
@ -1045,7 +1051,7 @@ void FMenu::onKeyPress (FKeyEvent* ev)
|
|||
if ( statusBar() )
|
||||
statusBar()->clearMessage();
|
||||
|
||||
if ( ! super || ! isWindowsMenu(super) )
|
||||
if ( ! (super && isWindowsMenu(super)) )
|
||||
switchToPrevWindow();
|
||||
}
|
||||
|
||||
|
@ -1088,7 +1094,10 @@ void FMenu::onMouseDown (FMouseEvent* ev)
|
|||
open_sub_menu->hideSubMenus();
|
||||
open_sub_menu->hide();
|
||||
open_sub_menu = 0;
|
||||
|
||||
if ( getSelectedItem() )
|
||||
getSelectedItem()->setFocus();
|
||||
|
||||
redraw();
|
||||
|
||||
if ( statusBar() )
|
||||
|
@ -1150,8 +1159,10 @@ void FMenu::onMouseDown (FMouseEvent* ev)
|
|||
raiseWindow (open_sub_menu);
|
||||
open_sub_menu->redraw();
|
||||
sel_item->setFocus();
|
||||
|
||||
if ( statusBar() )
|
||||
statusBar()->drawMessage();
|
||||
|
||||
updateTerminal();
|
||||
flush_out();
|
||||
}
|
||||
|
@ -1504,12 +1515,14 @@ void FMenu::show()
|
|||
FWindow::show();
|
||||
|
||||
// set the cursor to the focus widget
|
||||
if ( FWidget::getFocusWidget()
|
||||
&& FWidget::getFocusWidget()->isVisible()
|
||||
&& FWidget::getFocusWidget()->hasVisibleCursor()
|
||||
&& FWidget::getFocusWidget()->isCursorInside() )
|
||||
FWidget* focus_widget = FWidget::getFocusWidget();
|
||||
|
||||
if ( focus_widget
|
||||
&& focus_widget->isVisible()
|
||||
&& focus_widget->hasVisibleCursor()
|
||||
&& focus_widget->isCursorInside() )
|
||||
{
|
||||
FWidget::getFocusWidget()->setCursor();
|
||||
focus_widget->setCursor();
|
||||
showCursor();
|
||||
flush_out();
|
||||
}
|
||||
|
|
|
@ -50,7 +50,10 @@ void FMenuBar::init()
|
|||
// initialize geometry values
|
||||
setGeometry (1, 1, getColumnNumber(), 1, false);
|
||||
setMenuBar(this);
|
||||
|
||||
if ( getRootWidget() )
|
||||
getRootWidget()->setTopPadding(1, true);
|
||||
|
||||
addAccelerator (fc::Fkey_f10);
|
||||
addAccelerator (fc::Fckey_space);
|
||||
foregroundColor = wc.menu_active_fg;
|
||||
|
|
|
@ -681,6 +681,8 @@ void FMenuItem::onAccel (FAccelEvent* ev)
|
|||
FApplication::queueEvent(focused_widget, &out);
|
||||
menu->unselectItem();
|
||||
menu->selectFirstItem();
|
||||
|
||||
if ( menu->getSelectedItem() )
|
||||
menu->getSelectedItem()->setFocus();
|
||||
|
||||
if ( focused_widget )
|
||||
|
|
|
@ -194,6 +194,7 @@ void FMessageBox::msg_dimension()
|
|||
{
|
||||
int x, y, w, h;
|
||||
int headline_height = 0;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
text_split = text.split("\n");
|
||||
text_num_lines = uInt(text_split.size());
|
||||
text_components = &text_split[0];
|
||||
|
@ -216,8 +217,14 @@ void FMessageBox::msg_dimension()
|
|||
if ( w < 20 )
|
||||
w = 20;
|
||||
|
||||
x = 1 + int((getParentWidget()->getWidth()-w)/2);
|
||||
y = 1 + int((getParentWidget()->getHeight()-h)/3);
|
||||
if ( parent_widget )
|
||||
{
|
||||
x = 1 + int((parent_widget->getWidth()-w)/2);
|
||||
y = 1 + int((parent_widget->getHeight()-h)/3);
|
||||
}
|
||||
else
|
||||
x = y = 1;
|
||||
|
||||
setGeometry (x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -313,8 +320,10 @@ void FMessageBox::adjustButtons()
|
|||
|
||||
if ( btn_width >= width-4 )
|
||||
{
|
||||
int max_width;
|
||||
FWidget* root_widget = getRootWidget();
|
||||
setWidth(btn_width + 5);
|
||||
int max_width = getRootWidget()->getClientWidth();
|
||||
max_width = ( root_widget ) ? root_widget->getClientWidth() : 80;
|
||||
setX (int((max_width-width) / 2));
|
||||
}
|
||||
|
||||
|
@ -345,8 +354,19 @@ void FMessageBox::cb_processClick (FWidget*, void* data_ptr)
|
|||
void FMessageBox::adjustSize()
|
||||
{
|
||||
int X, Y, max_width, max_height;
|
||||
max_height = getRootWidget()->getClientHeight();
|
||||
max_width = getRootWidget()->getClientWidth();
|
||||
FWidget* root_widget = getRootWidget();
|
||||
|
||||
if ( root_widget )
|
||||
{
|
||||
max_width = root_widget->getClientWidth();
|
||||
max_height = root_widget->getClientHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
max_width = 80;
|
||||
max_height = 24;
|
||||
}
|
||||
|
||||
X = 1 + int((max_width-width)/2);
|
||||
Y = 1 + int((max_height-height)/3);
|
||||
setPos(X, Y, false);
|
||||
|
@ -369,6 +389,7 @@ FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
|
|||
delete button_digit[1];
|
||||
delete button_digit[0];
|
||||
|
||||
if ( mbox.getParentWidget() )
|
||||
mbox.getParentWidget()->addChild (this);
|
||||
|
||||
headline_text = mbox.headline_text;
|
||||
|
|
|
@ -202,7 +202,7 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
|
|||
char* sp = F_set_color_pair.cap;
|
||||
short fg, bg;
|
||||
|
||||
if ( monochron || ! term || ! next )
|
||||
if ( monochron || ! (term && next) )
|
||||
return;
|
||||
|
||||
fg = next->fg_color;
|
||||
|
@ -399,7 +399,7 @@ bool FOptiAttr::caused_reset_attributes (char*& cap, uChar test)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FOptiAttr::detectSwitchOn (char_data*& term, char_data*& next)
|
||||
{
|
||||
if ( ! term || ! next )
|
||||
if ( ! (term && next) )
|
||||
return;
|
||||
|
||||
on.bold = ! term->bold && next->bold;
|
||||
|
@ -420,7 +420,7 @@ inline void FOptiAttr::detectSwitchOn (char_data*& term, char_data*& next)
|
|||
//----------------------------------------------------------------------
|
||||
inline void FOptiAttr::detectSwitchOff (char_data*& term, char_data*& next)
|
||||
{
|
||||
if ( ! term || ! next )
|
||||
if ( ! (term && next) )
|
||||
return;
|
||||
|
||||
off.bold = term->bold && ! next->bold;
|
||||
|
@ -1330,7 +1330,7 @@ char* FOptiAttr::change_attribute (char_data*& term, char_data*& next)
|
|||
fake_reverse = false;
|
||||
attr_buf[0] = '\0';
|
||||
|
||||
if ( ! term || ! next )
|
||||
if ( ! (term && next) )
|
||||
return attr_buf;
|
||||
|
||||
prevent_no_color_video_attributes (next);
|
||||
|
|
|
@ -25,8 +25,13 @@ FProgressbar::~FProgressbar()
|
|||
//----------------------------------------------------------------------
|
||||
void FProgressbar::drawPercentage()
|
||||
{
|
||||
setColor ( getParentWidget()->getForegroundColor()
|
||||
, getParentWidget()->getBackgroundColor() );
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
if ( parent_widget )
|
||||
setColor ( parent_widget->getForegroundColor()
|
||||
, parent_widget->getBackgroundColor() );
|
||||
else
|
||||
setColor ( wc.dialog_fg, wc.dialog_bg );
|
||||
|
||||
if ( isMonochron() )
|
||||
setReverse(true);
|
||||
|
@ -71,12 +76,15 @@ void FProgressbar::drawBar()
|
|||
print (fc::MediumShade);
|
||||
}
|
||||
|
||||
if ( getParentWidget() )
|
||||
{
|
||||
if ( round(length) >= 1)
|
||||
setColor ( wc.progressbar_fg
|
||||
, getParentWidget()->getBackgroundColor() );
|
||||
else
|
||||
setColor ( wc.progressbar_bg
|
||||
, getParentWidget()->getBackgroundColor() );
|
||||
}
|
||||
|
||||
if ( ! isMonochron() && getMaxColor() >= 16 )
|
||||
{
|
||||
|
@ -169,10 +177,21 @@ void FProgressbar::hide()
|
|||
int s, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
bg = getParentWidget()->getBackgroundColor();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
fg = parent_widget->getForegroundColor();
|
||||
bg = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = wc.dialog_fg;
|
||||
bg = wc.dialog_bg;
|
||||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
s = hasShadow() ? 1 : 0;
|
||||
size = width + s;
|
||||
|
|
|
@ -77,6 +77,8 @@ void FStatusKey::init (FWidget* parent)
|
|||
, const_cast<char*>("FStatusBar") ) == 0 )
|
||||
{
|
||||
setStatusbar( static_cast<FStatusBar*>(parent) );
|
||||
|
||||
if ( statusbar() )
|
||||
statusbar()->insert(this);
|
||||
}
|
||||
}
|
||||
|
@ -93,10 +95,15 @@ void FStatusKey::onAccel (FAccelEvent* ev)
|
|||
if ( ! isActivated() )
|
||||
{
|
||||
setActive();
|
||||
|
||||
if ( statusbar() )
|
||||
statusbar()->redraw();
|
||||
|
||||
ev->accept();
|
||||
// unset after get back from callback
|
||||
unsetActive();
|
||||
|
||||
if ( statusbar() )
|
||||
statusbar()->redraw();
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +203,10 @@ void FStatusBar::init()
|
|||
// initialize geometry values
|
||||
setGeometry (1, ypos, getColumnNumber(), 1, false);
|
||||
setStatusBar(this);
|
||||
|
||||
if ( getRootWidget() )
|
||||
getRootWidget()->setBottomPadding(1, true);
|
||||
|
||||
foregroundColor = wc.statusbar_fg;
|
||||
backgroundColor = wc.statusbar_bg;
|
||||
unsetFocusable();
|
||||
|
@ -217,11 +227,15 @@ void FStatusBar::drawKeys()
|
|||
{
|
||||
std::vector<FStatusKey*>::const_iterator iter, end;
|
||||
int screenWidth, lastLine;
|
||||
x = 1;
|
||||
|
||||
if ( ! vstatusbar )
|
||||
return;
|
||||
|
||||
screenWidth = getColumnNumber();
|
||||
lastLine = getLineNumber();
|
||||
width = screenWidth;
|
||||
ypos = lastLine;
|
||||
x = 1;
|
||||
|
||||
if ( keylist.empty() )
|
||||
{
|
||||
|
@ -577,7 +591,7 @@ void FStatusBar::drawMessage()
|
|||
int termWidth, lastLine, space_offset;
|
||||
bool isLastActiveFocus, hasKeys;
|
||||
|
||||
if ( ! isVisible() )
|
||||
if ( ! (isVisible() && vstatusbar) )
|
||||
return;
|
||||
|
||||
if ( x < 0 || x_msg < 0 )
|
||||
|
|
|
@ -1225,7 +1225,7 @@ FString FString::ltrim() const
|
|||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return s;
|
||||
|
||||
p = s.string;
|
||||
|
@ -1244,7 +1244,7 @@ FString FString::rtrim() const
|
|||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return s;
|
||||
|
||||
p = s.string;
|
||||
|
@ -1264,7 +1264,7 @@ FString FString::rtrim() const
|
|||
FString FString::trim() const
|
||||
{
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return (*this);
|
||||
|
||||
FString s(ltrim());
|
||||
|
@ -1278,7 +1278,7 @@ FString FString::left(uInt len) const
|
|||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return s;
|
||||
|
||||
if ( len > length )
|
||||
|
@ -1296,7 +1296,7 @@ FString FString::right(uInt len) const
|
|||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return s;
|
||||
|
||||
if ( len > length )
|
||||
|
@ -1315,7 +1315,7 @@ FString FString::mid(uInt pos, uInt len) const
|
|||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return s;
|
||||
|
||||
if ( pos == 0 )
|
||||
|
@ -1342,7 +1342,7 @@ std::vector<FString> FString::split (const FString& delimiter)
|
|||
std::vector<FString> stringList;
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return stringList;
|
||||
|
||||
rest = 0;
|
||||
|
@ -1545,7 +1545,7 @@ bool FString::operator < (const FString& s) const
|
|||
if ( ! string && s.string )
|
||||
return true;
|
||||
|
||||
if ( ! string && ! s.string )
|
||||
if ( ! (string || s.string) )
|
||||
return false;
|
||||
|
||||
return (wcscmp(string, s.string) < 0);
|
||||
|
@ -1605,7 +1605,7 @@ bool FString::operator <= (const FString& s) const
|
|||
if ( ! string && s.string )
|
||||
return true;
|
||||
|
||||
if ( ! string && ! s.string )
|
||||
if ( ! (string || s.string) )
|
||||
return true;
|
||||
|
||||
return (wcscmp(string, s.string) <= 0);
|
||||
|
@ -1662,7 +1662,7 @@ bool FString::operator == (const FString& s) const
|
|||
if ( (string && ! s.string ) || (! string && s.string) )
|
||||
return false;
|
||||
|
||||
if ( ! string && ! s.string )
|
||||
if ( ! (string || s.string) )
|
||||
return true;
|
||||
|
||||
return (wcscmp(string, s.string) == 0);
|
||||
|
@ -1719,7 +1719,7 @@ bool FString::operator != (const FString& s) const
|
|||
if ( (string && ! s.string ) || (! string && s.string) )
|
||||
return true;
|
||||
|
||||
if ( ! string && ! s.string )
|
||||
if ( ! (string || s.string) )
|
||||
return false;
|
||||
|
||||
return (wcscmp(string, s.string) != 0);
|
||||
|
@ -1779,7 +1779,7 @@ bool FString::operator >= (const FString& s) const
|
|||
if ( ! string && s.string )
|
||||
return false;
|
||||
|
||||
if ( ! string && ! s.string )
|
||||
if ( ! (string || s.string) )
|
||||
return true;
|
||||
|
||||
return (wcscmp(string, s.string) >= 0);
|
||||
|
@ -1839,7 +1839,7 @@ bool FString::operator > (const FString& s) const
|
|||
if ( ! string && s.string )
|
||||
return false;
|
||||
|
||||
if ( ! string && ! s.string )
|
||||
if ( ! (string || s.string) )
|
||||
return false;
|
||||
|
||||
return (wcscmp(string, s.string) > 0);
|
||||
|
@ -1935,7 +1935,7 @@ FString FString::replace (const FString& from, const FString& to)
|
|||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return s;
|
||||
|
||||
if ( from.isNull() || to.isNull() )
|
||||
|
@ -2219,7 +2219,7 @@ FString FString::replace (const wchar_t from, const FString& to)
|
|||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return s;
|
||||
|
||||
if ( to.isNull() )
|
||||
|
@ -2337,7 +2337,7 @@ FString FString::replace (const char from, const char to)
|
|||
FString s(string);
|
||||
|
||||
// handle NULL and empty string
|
||||
if ( ! string || ! *string )
|
||||
if ( ! (string && *string) )
|
||||
return s;
|
||||
|
||||
p = s.string;
|
||||
|
|
|
@ -1900,7 +1900,7 @@ void FTerm::init()
|
|||
if ( ! gnome_terminal )
|
||||
setXTermCursorColor("rgb:ffff/ffff/ffff");
|
||||
|
||||
if ( ! mintty_terminal && ! rxvt_terminal && ! screen_terminal )
|
||||
if ( ! (mintty_terminal || rxvt_terminal || screen_terminal) )
|
||||
{
|
||||
// mintty and rxvt can't reset these settings
|
||||
setXTermBackground("rgb:8080/a4a4/ecec");
|
||||
|
@ -2025,7 +2025,7 @@ void FTerm::finish()
|
|||
resetXTermHighlightBackground();
|
||||
setXTermCursorStyle(fc::steady_block);
|
||||
|
||||
if ( max_color >= 16 && ! kde_konsole && ! tera_terminal )
|
||||
if ( max_color >= 16 && ! (kde_konsole || tera_terminal) )
|
||||
{
|
||||
// reset screen settings
|
||||
setPalette (fc::Cyan, 0x18, 0xb2, 0xb2);
|
||||
|
@ -2431,15 +2431,16 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FTerm::isCovered (int x, int y, FTerm::term_area* area) const
|
||||
FTerm::covered_state FTerm::isCovered (int x, int y, FTerm::term_area* area) const
|
||||
{
|
||||
bool covered, found;
|
||||
bool found;
|
||||
FTerm::covered_state is_covered;
|
||||
FWidget* w;
|
||||
|
||||
if ( ! area )
|
||||
return false;
|
||||
return non_covered;
|
||||
|
||||
covered = false;
|
||||
is_covered = non_covered;
|
||||
found = bool(area == vdesktop);
|
||||
x++;
|
||||
y++;
|
||||
|
@ -2468,9 +2469,13 @@ bool FTerm::isCovered (int x, int y, FTerm::term_area* area) const
|
|||
int line_len = win->width + win->right_shadow;
|
||||
tmp = &win->text[(y-win_y-1) * line_len + (x-win_x-1)];
|
||||
|
||||
if ( ! tmp->transparent )
|
||||
if ( tmp->trans_shadow )
|
||||
{
|
||||
covered = true;
|
||||
is_covered = half_covered;
|
||||
}
|
||||
else if ( ! tmp->transparent )
|
||||
{
|
||||
is_covered = fully_covered;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2493,7 +2498,7 @@ bool FTerm::isCovered (int x, int y, FTerm::term_area* area) const
|
|||
if ( area != vmenubar && menubar
|
||||
&& menubar->getGeometryGlobal().contains(x,y) )
|
||||
{
|
||||
covered = true;
|
||||
is_covered = fully_covered;
|
||||
}
|
||||
|
||||
// statusbar is always on top
|
||||
|
@ -2507,10 +2512,10 @@ bool FTerm::isCovered (int x, int y, FTerm::term_area* area) const
|
|||
if ( area != vstatusbar && statusbar
|
||||
&& statusbar->getGeometryGlobal().contains(x,y) )
|
||||
{
|
||||
covered = true;
|
||||
is_covered = fully_covered;
|
||||
}
|
||||
|
||||
return covered;
|
||||
return is_covered;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2573,6 +2578,7 @@ void FTerm::updateVTerm (FTerm::term_area* area)
|
|||
for (register int x=line_xmin; x <= line_xmax; x++) // column loop
|
||||
{
|
||||
int gx, gy, line_len;
|
||||
FTerm::covered_state is_covered;
|
||||
gx = ax + x; // global position
|
||||
gy = ay + y;
|
||||
|
||||
|
@ -2582,10 +2588,21 @@ void FTerm::updateVTerm (FTerm::term_area* area)
|
|||
line_len = aw + rsh;
|
||||
ac = &area->text[y * line_len + x];
|
||||
tc = &vterm->text[gy * vterm->width + gx - ol];
|
||||
is_covered = isCovered(gx-ol, gy, area); // get covered state
|
||||
|
||||
if ( ! isCovered(gx-ol, gy, area) )
|
||||
if ( is_covered != fully_covered )
|
||||
{
|
||||
if ( ac->transparent ) // transparent
|
||||
if ( is_covered == half_covered )
|
||||
{
|
||||
// add the overlapping color to this character
|
||||
FOptiAttr::char_data ch, oc;
|
||||
memcpy (&ch, ac, sizeof(FOptiAttr::char_data));
|
||||
oc = getOverlappedCharacter (gx+1, gy+1, area->widget);
|
||||
ch.fg_color = oc.fg_color;
|
||||
ch.bg_color = oc.bg_color;
|
||||
memcpy (tc, &ch, sizeof(FOptiAttr::char_data));
|
||||
}
|
||||
else if ( ac->transparent ) // transparent
|
||||
{
|
||||
// restore one character on vterm
|
||||
FOptiAttr::char_data ch;
|
||||
|
@ -2831,8 +2848,12 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
FOptiAttr::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
|
||||
FOptiAttr::char_data FTerm::getCharacter ( int char_type
|
||||
, int x
|
||||
, int y
|
||||
, FTerm* obj )
|
||||
{
|
||||
// get the overlapped or the covered character for a position
|
||||
int xx,yy;
|
||||
FOptiAttr::char_data* cc; // covered character
|
||||
FOptiAttr::char_data s_ch; // shadow character
|
||||
|
@ -2867,7 +2888,14 @@ FOptiAttr::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
|
|||
|
||||
while ( iter != end )
|
||||
{
|
||||
if ( obj && *iter != obj && layer >= FWindow::getWindowLayer(*iter) )
|
||||
bool significant_char;
|
||||
|
||||
if ( char_type == covered_character )
|
||||
significant_char = bool(layer >= FWindow::getWindowLayer(*iter));
|
||||
else
|
||||
significant_char = bool(layer < FWindow::getWindowLayer(*iter));
|
||||
|
||||
if ( obj && *iter != obj && significant_char )
|
||||
{
|
||||
term_area* win = (*iter)->getVWin();
|
||||
const FRect& geometry = (*iter)->getGeometryGlobalShadow();
|
||||
|
@ -2899,7 +2927,7 @@ FOptiAttr::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if ( char_type == covered_character )
|
||||
break;
|
||||
|
||||
++iter;
|
||||
|
@ -2909,7 +2937,6 @@ FOptiAttr::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
|
|||
return *cc;
|
||||
}
|
||||
|
||||
|
||||
// public methods of FTerm
|
||||
//----------------------------------------------------------------------
|
||||
bool FTerm::setVGAFont()
|
||||
|
@ -3038,7 +3065,7 @@ bool FTerm::setOldFont()
|
|||
{
|
||||
bool retval;
|
||||
|
||||
if ( ! NewFont && ! VGAFont )
|
||||
if ( ! (NewFont || VGAFont) )
|
||||
return false;
|
||||
|
||||
retval = \
|
||||
|
@ -3437,7 +3464,7 @@ FString FTerm::getXTermTitle()
|
|||
void FTerm::setXTermCursorStyle (fc::xterm_cursor_style style)
|
||||
{
|
||||
// Set the xterm cursor style
|
||||
if ( (xterm || mintty_terminal) && ! gnome_terminal && ! kde_konsole )
|
||||
if ( (xterm || mintty_terminal) && ! (gnome_terminal || kde_konsole) )
|
||||
{
|
||||
putstringf (CSI "%d q", style);
|
||||
fflush(stdout);
|
||||
|
|
42
src/fterm.h
42
src/fterm.h
|
@ -199,6 +199,19 @@ class FTerm
|
|||
uChar : 4; // padding bits
|
||||
} mod_key;
|
||||
|
||||
enum covered_state
|
||||
{
|
||||
non_covered,
|
||||
half_covered,
|
||||
fully_covered
|
||||
};
|
||||
|
||||
enum character_type
|
||||
{
|
||||
overlapped_character,
|
||||
covered_character
|
||||
};
|
||||
|
||||
protected:
|
||||
static bool NewFont;
|
||||
static bool VGAFont;
|
||||
|
@ -276,8 +289,8 @@ class FTerm
|
|||
void resizeArea (FTerm::term_area*);
|
||||
void restoreVTerm (const FRect&);
|
||||
void restoreVTerm (int, int, int, int);
|
||||
bool isCovered (const FPoint&, FTerm::term_area*) const;
|
||||
bool isCovered (int, int, FTerm::term_area*) const;
|
||||
FTerm::covered_state isCovered (const FPoint&, FTerm::term_area*) const;
|
||||
FTerm::covered_state isCovered (int, int, FTerm::term_area*) const;
|
||||
void updateVTerm (FTerm::term_area*);
|
||||
void updateVTerm (bool);
|
||||
void getArea (const FPoint&, FTerm::term_area*);
|
||||
|
@ -286,8 +299,12 @@ class FTerm
|
|||
void getArea (int, int, int, int, FTerm::term_area*);
|
||||
void putArea (const FPoint&, FTerm::term_area*);
|
||||
void putArea (int, int, FTerm::term_area*);
|
||||
FOptiAttr::char_data getCharacter (int, const FPoint&, FTerm*);
|
||||
FOptiAttr::char_data getCharacter (int, int, int, FTerm*);
|
||||
FOptiAttr::char_data getCoveredCharacter (const FPoint&, FTerm*);
|
||||
FOptiAttr::char_data getCoveredCharacter (int, int, FTerm*);
|
||||
FOptiAttr::char_data getOverlappedCharacter (const FPoint&, FTerm*);
|
||||
FOptiAttr::char_data getOverlappedCharacter (int, int, FTerm*);
|
||||
|
||||
public:
|
||||
FTerm (); // constructor
|
||||
|
@ -438,7 +455,8 @@ class FTerm
|
|||
|
||||
// FTerm inline functions
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FTerm::isCovered(const FPoint& pos, FTerm::term_area* area) const
|
||||
inline FTerm::covered_state FTerm::isCovered ( const FPoint& pos
|
||||
, FTerm::term_area* area) const
|
||||
{ return isCovered (pos.getX(), pos.getY(), area); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -455,9 +473,25 @@ inline void FTerm::getArea (const FRect& box, FTerm::term_area* area)
|
|||
, area );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FOptiAttr::char_data FTerm::getCharacter (int type, const FPoint& pos, FTerm* obj)
|
||||
{ return getCharacter (type, pos.getX(), pos.getY(), obj); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FOptiAttr::char_data FTerm::getCoveredCharacter (int x, int y, FTerm* obj)
|
||||
{ return getCharacter (covered_character, x, y, obj); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FOptiAttr::char_data FTerm::getCoveredCharacter (const FPoint& pos, FTerm* obj)
|
||||
{ return getCoveredCharacter (pos.getX(), pos.getY(), obj); }
|
||||
{ return getCharacter (covered_character, pos.getX(), pos.getY(), obj); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FOptiAttr::char_data FTerm::getOverlappedCharacter (int x, int y, FTerm* obj)
|
||||
{ return getCharacter (overlapped_character, x, y, obj); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline FOptiAttr::char_data FTerm::getOverlappedCharacter (const FPoint& pos, FTerm* obj)
|
||||
{ return getCharacter (overlapped_character, pos.getX(), pos.getY(), obj); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline const char* FTerm::getClassName() const
|
||||
|
|
|
@ -205,10 +205,21 @@ void FTextView::hide()
|
|||
int n, size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
bg = getParentWidget()->getBackgroundColor();
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
fg = parent_widget->getForegroundColor();
|
||||
bg = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = wc.dialog_fg;
|
||||
bg = wc.dialog_bg;
|
||||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
n = isNewFont() ? 1 : 0;
|
||||
size = width + n;
|
||||
|
|
|
@ -28,6 +28,8 @@ FToggleButton::FToggleButton(FWidget* parent)
|
|||
, const_cast<char*>("FButtonGroup") ) == 0 )
|
||||
{
|
||||
setGroup( static_cast<FButtonGroup*>(parent) );
|
||||
|
||||
if ( group() )
|
||||
group()->insert(this); // insert into button group
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +51,8 @@ FToggleButton::FToggleButton (const FString& txt, FWidget* parent)
|
|||
, const_cast<char*>("FButtonGroup") ) == 0 )
|
||||
{
|
||||
setGroup( static_cast<FButtonGroup*>(parent) );
|
||||
|
||||
if ( group() )
|
||||
group()->insert( this ); // insert into button group
|
||||
}
|
||||
}
|
||||
|
@ -361,12 +365,22 @@ void FToggleButton::hide()
|
|||
int size;
|
||||
short fg, bg;
|
||||
char* blank;
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
FWidget::hide();
|
||||
fg = getParentWidget()->getForegroundColor();
|
||||
bg = getParentWidget()->getBackgroundColor();
|
||||
setColor (fg, bg);
|
||||
|
||||
if ( parent_widget )
|
||||
{
|
||||
fg = parent_widget->getForegroundColor();
|
||||
bg = parent_widget->getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
fg = wc.dialog_fg;
|
||||
bg = wc.dialog_bg;
|
||||
}
|
||||
|
||||
setColor (fg, bg);
|
||||
size = width;
|
||||
blank = new char[size+1];
|
||||
memset(blank, ' ', uLong(size));
|
||||
|
|
|
@ -413,6 +413,8 @@ void FWidget::adjustSize()
|
|||
{
|
||||
if ( ! isRootWidget() )
|
||||
{
|
||||
FWidget* parent_widget = getParentWidget();
|
||||
|
||||
if ( isWindow() )
|
||||
{
|
||||
xmin = rootObject->client_xmin;
|
||||
|
@ -420,21 +422,21 @@ void FWidget::adjustSize()
|
|||
xmax = rootObject->client_xmax;
|
||||
ymax = rootObject->client_ymax;
|
||||
}
|
||||
else if ( ignore_padding )
|
||||
else if ( ignore_padding && parent_widget )
|
||||
{
|
||||
xmin = getParentWidget()->xpos + getParentWidget()->xmin - 1;
|
||||
ymin = getParentWidget()->ypos + getParentWidget()->ymin - 1;
|
||||
xmax = getParentWidget()->xpos + getParentWidget()->xmin - 2
|
||||
+ getParentWidget()->width;
|
||||
ymax = getParentWidget()->ypos + getParentWidget()->ymin - 2
|
||||
+ getParentWidget()->height;
|
||||
xmin = parent_widget->xpos + parent_widget->xmin - 1;
|
||||
ymin = parent_widget->ypos + parent_widget->ymin - 1;
|
||||
xmax = parent_widget->xpos + parent_widget->xmin - 2
|
||||
+ parent_widget->width;
|
||||
ymax = parent_widget->ypos + parent_widget->ymin - 2
|
||||
+ parent_widget->height;
|
||||
}
|
||||
else
|
||||
else if ( parent_widget )
|
||||
{
|
||||
xmin = getParentWidget()->client_xmin;
|
||||
ymin = getParentWidget()->client_ymin;
|
||||
xmax = getParentWidget()->client_xmax;
|
||||
ymax = getParentWidget()->client_ymax;
|
||||
xmin = parent_widget->client_xmin;
|
||||
ymin = parent_widget->client_ymin;
|
||||
xmax = parent_widget->client_xmax;
|
||||
ymax = parent_widget->client_ymax;
|
||||
}
|
||||
|
||||
xpos = widgetSize.getX();
|
||||
|
@ -759,6 +761,9 @@ void FWidget::onClose (FCloseEvent* ev)
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::focusNextChild()
|
||||
{
|
||||
if ( isDialog() )
|
||||
return false;
|
||||
|
||||
if ( hasParent() )
|
||||
{
|
||||
FWidget* parent = static_cast<FWidget*>(getParent());
|
||||
|
@ -829,6 +834,9 @@ bool FWidget::focusNextChild()
|
|||
//----------------------------------------------------------------------
|
||||
bool FWidget::focusPrevChild()
|
||||
{
|
||||
if ( isDialog() )
|
||||
return false;
|
||||
|
||||
if ( hasParent() )
|
||||
{
|
||||
FWidget* parent = static_cast<FWidget*>(getParent());
|
||||
|
@ -1379,7 +1387,7 @@ void FWidget::show()
|
|||
if ( ! visible )
|
||||
return;
|
||||
|
||||
if ( getMainWidget() == this && ! NewFont && ! VGAFont )
|
||||
if ( getMainWidget() == this && ! (NewFont || VGAFont) )
|
||||
init_consoleCharMap();
|
||||
|
||||
if ( ! show_root_widget )
|
||||
|
@ -1432,7 +1440,9 @@ void FWidget::hide()
|
|||
&& FWidget::getFocusWidget() == this
|
||||
&& ! focusPrevChild() )
|
||||
{
|
||||
if ( FWidget::getFocusWidget() )
|
||||
FWidget::getFocusWidget()->unsetFocus();
|
||||
|
||||
FWidget::setFocusWidget(getParentWidget());
|
||||
}
|
||||
|
||||
|
@ -1561,7 +1571,7 @@ bool FWidget::setFocus (bool on)
|
|||
{
|
||||
int focusable_children = numOfFocusableChildren();
|
||||
|
||||
if ( FWidget::getFocusWidget() != 0 )
|
||||
if ( FWidget::getFocusWidget() )
|
||||
FWidget::getFocusWidget()->unsetFocus();
|
||||
|
||||
if ( (!isDialog() && focusable_children == 0)
|
||||
|
@ -2001,7 +2011,7 @@ void FWidget::drawShadow()
|
|||
if ( isMonochron() && ! trans_shadow )
|
||||
return;
|
||||
|
||||
if ( (Encoding == fc::VT100 && ! trans_shadow && ! isTeraTerm() )
|
||||
if ( (Encoding == fc::VT100 && ! (trans_shadow || isTeraTerm()) )
|
||||
|| (Encoding == fc::ASCII && ! trans_shadow) )
|
||||
{
|
||||
clearShadow();
|
||||
|
|
|
@ -454,7 +454,7 @@ bool FWindow::activatePrevWindow()
|
|||
// activate the previous window
|
||||
FWindow* w = previous_widget;
|
||||
|
||||
if ( w && ! w->isHiddenWindow() && ! w->isActiveWindow() )
|
||||
if ( w && ! (w->isHiddenWindow() || w->isActiveWindow()) )
|
||||
{
|
||||
setActiveWindow(w);
|
||||
return true;
|
||||
|
|
|
@ -14,6 +14,7 @@ noinst_PROGRAMS = \
|
|||
calculator \
|
||||
watch \
|
||||
term-attributes \
|
||||
transparent \
|
||||
keyboard \
|
||||
timer \
|
||||
windows \
|
||||
|
@ -28,6 +29,7 @@ mandelbrot_SOURCES = mandelbrot.cpp
|
|||
calculator_SOURCES = calculator.cpp
|
||||
watch_SOURCES = watch.cpp
|
||||
term_attributes_SOURCES = term-attributes.cpp
|
||||
transparent_SOURCES = transparent.cpp
|
||||
keyboard_SOURCES = keyboard.cpp
|
||||
timer_SOURCES = timer.cpp
|
||||
windows_SOURCES = windows.cpp
|
||||
|
|
|
@ -85,8 +85,8 @@ host_triplet = @host@
|
|||
noinst_PROGRAMS = hello$(EXEEXT) dialog$(EXEEXT) input-dialog$(EXEEXT) \
|
||||
string-operations$(EXEEXT) mandelbrot$(EXEEXT) \
|
||||
calculator$(EXEEXT) watch$(EXEEXT) term-attributes$(EXEEXT) \
|
||||
keyboard$(EXEEXT) timer$(EXEEXT) windows$(EXEEXT) \
|
||||
menu$(EXEEXT) ui$(EXEEXT)
|
||||
transparent$(EXEEXT) keyboard$(EXEEXT) timer$(EXEEXT) \
|
||||
windows$(EXEEXT) menu$(EXEEXT) ui$(EXEEXT)
|
||||
subdir = test
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||
$(top_srcdir)/depcomp
|
||||
|
@ -136,6 +136,9 @@ term_attributes_LDADD = $(LDADD)
|
|||
am_timer_OBJECTS = timer.$(OBJEXT)
|
||||
timer_OBJECTS = $(am_timer_OBJECTS)
|
||||
timer_LDADD = $(LDADD)
|
||||
am_transparent_OBJECTS = transparent.$(OBJEXT)
|
||||
transparent_OBJECTS = $(am_transparent_OBJECTS)
|
||||
transparent_LDADD = $(LDADD)
|
||||
am_ui_OBJECTS = ui.$(OBJEXT)
|
||||
ui_OBJECTS = $(am_ui_OBJECTS)
|
||||
ui_LDADD = $(LDADD)
|
||||
|
@ -183,14 +186,14 @@ SOURCES = $(calculator_SOURCES) $(dialog_SOURCES) $(hello_SOURCES) \
|
|||
$(input_dialog_SOURCES) $(keyboard_SOURCES) \
|
||||
$(mandelbrot_SOURCES) $(menu_SOURCES) \
|
||||
$(string_operations_SOURCES) $(term_attributes_SOURCES) \
|
||||
$(timer_SOURCES) $(ui_SOURCES) $(watch_SOURCES) \
|
||||
$(windows_SOURCES)
|
||||
$(timer_SOURCES) $(transparent_SOURCES) $(ui_SOURCES) \
|
||||
$(watch_SOURCES) $(windows_SOURCES)
|
||||
DIST_SOURCES = $(calculator_SOURCES) $(dialog_SOURCES) \
|
||||
$(hello_SOURCES) $(input_dialog_SOURCES) $(keyboard_SOURCES) \
|
||||
$(mandelbrot_SOURCES) $(menu_SOURCES) \
|
||||
$(string_operations_SOURCES) $(term_attributes_SOURCES) \
|
||||
$(timer_SOURCES) $(ui_SOURCES) $(watch_SOURCES) \
|
||||
$(windows_SOURCES)
|
||||
$(timer_SOURCES) $(transparent_SOURCES) $(ui_SOURCES) \
|
||||
$(watch_SOURCES) $(windows_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
|
@ -347,6 +350,7 @@ mandelbrot_SOURCES = mandelbrot.cpp
|
|||
calculator_SOURCES = calculator.cpp
|
||||
watch_SOURCES = watch.cpp
|
||||
term_attributes_SOURCES = term-attributes.cpp
|
||||
transparent_SOURCES = transparent.cpp
|
||||
keyboard_SOURCES = keyboard.cpp
|
||||
timer_SOURCES = timer.cpp
|
||||
windows_SOURCES = windows.cpp
|
||||
|
@ -436,6 +440,10 @@ timer$(EXEEXT): $(timer_OBJECTS) $(timer_DEPENDENCIES) $(EXTRA_timer_DEPENDENCIE
|
|||
@rm -f timer$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(timer_OBJECTS) $(timer_LDADD) $(LIBS)
|
||||
|
||||
transparent$(EXEEXT): $(transparent_OBJECTS) $(transparent_DEPENDENCIES) $(EXTRA_transparent_DEPENDENCIES)
|
||||
@rm -f transparent$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(transparent_OBJECTS) $(transparent_LDADD) $(LIBS)
|
||||
|
||||
ui$(EXEEXT): $(ui_OBJECTS) $(ui_DEPENDENCIES) $(EXTRA_ui_DEPENDENCIES)
|
||||
@rm -f ui$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(ui_OBJECTS) $(ui_LDADD) $(LIBS)
|
||||
|
@ -464,6 +472,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-operations.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/term-attributes.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transparent.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ui.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/watch.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows.Po@am__quote@
|
||||
|
|
Loading…
Reference in New Issue