FStatusBar and FMenuBar use now the always-on-top window option

This commit is contained in:
Markus Gans 2016-10-02 21:26:25 +02:00
parent 9ccc5a4f27
commit 1231b9f65d
15 changed files with 173 additions and 276 deletions

View File

@ -1,3 +1,7 @@
2016-10-02 Markus Gans <guru.mail@muenster.de>
* FStatusBar and FMenuBar use now the always-on-top
window option
2016-10-01 Markus Gans <guru.mail@muenster.de> 2016-10-01 Markus Gans <guru.mail@muenster.de>
* Add an always-on-top mode for window objects * Add an always-on-top mode for window objects
* New FToolTip widget to show assisted information * New FToolTip widget to show assisted information

View File

@ -154,7 +154,7 @@ Class digramm
│ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------: │ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------:
└┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ : └┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ :
:1:1:1 : : │ ┌────────────┐ : *┌─────────┐ :1:1:1 : : │ ┌────────────┐ : *┌─────────┐
: : └----------: : ├────┤ FScrollbar │ ├---┤ FString │ : : └---------- : ├────┤ FScrollbar │ ├---┤ FString │
: :1 : : │ └────────────┘ : └─────────┘ : :1 : : │ └────────────┘ : └─────────┘
:┌┴──────────┐ : : │ ┌───────────┐1 : :┌┴──────────┐ : : │ ┌───────────┐1 :
:│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------: :│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------:
@ -169,13 +169,16 @@ Class digramm
: : │ ┌─────────────┐1 : : : │ ┌─────────────┐1 :
: : ┌───┴─────┐ ┌─────────┐ ┌──┤ FFileDialog ├----: : : ┌───┴─────┐ ┌─────────┐ ┌──┤ FFileDialog ├----:
: : │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ : : : │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ :
: : └───┬─────┘ └────┬────┘ │ ┌─────────────┐1 : : : └──┬──┬───┘ └────┬────┘ │ ┌─────────────┐1 :
: : ▲ 1: └──┤ FMessageBox ├----: : : ▲ ▲ 1: └──┤ FMessageBox ├----:
: : │ : └─────────────┘ : : : │ │ : └─────────────┘ :
: : │ └------------------------------: : : │ │ └------------------------------:
: : │ │ ┌──────────┐ :
: : │ └──────┤ FToolTip │ :
: : │ └──────────┘ :
: : └───────────────┐ ┌──────────┐ : : : └───────────────┐ ┌──────────┐ :
: : │ ┌───┤ FMenuBar │ : : : │ ┌───┤ FMenuBar │ :
: : ┌───────────┐ └─────┤ └──────────┘ : : : ┌───────────┐ └─────┤ └──────────┘ :
: : │ FMenuList │◄──────────┤ ┌───────┐ : : : │ FMenuList │◄──────────┤ ┌───────┐ :
: : └────┬──────┘ └───┤ FMenu │◄──┐ : : : └────┬──────┘ └───┤ FMenu │◄──┐ :
: : : └───────┘ │ : : : : └───────┘ │ :
@ -191,7 +194,7 @@ Class digramm
: : └---------------------------------------┘ : : : └---------------------------------------┘ :
: └---------------------------------------------------┘ : └---------------------------------------------------┘
: *┌────────┐ : *┌────────┐
:---┤ FPoint │ ---┤ FPoint │
: └────────┘ : └────────┘
: *┌───────┐ : *┌───────┐
└---┤ FRect │ └---┤ FRect │

View File

@ -781,7 +781,13 @@ bool FApplication::processDialogSwitchAccelerator()
if ( s > 0 && s >= n ) if ( s > 0 && s >= n )
{ {
// unset the move/size mode // unset the move/size mode
if ( move_size_widget )
{
FWidget* w = move_size_widget;
move_size_widget = 0; move_size_widget = 0;
w->redraw();
}
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget); FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
sendEvent (dialog_list->at(n-1), &a_ev); sendEvent (dialog_list->at(n-1), &a_ev);
return true; return true;
@ -812,7 +818,13 @@ bool FApplication::processAccelerator (FWidget*& widget)
if ( iter->key == key ) if ( iter->key == key )
{ {
// unset the move/size mode // unset the move/size mode
if ( move_size_widget )
{
FWidget* w = move_size_widget;
move_size_widget = 0; move_size_widget = 0;
w->redraw();
}
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget); FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
sendEvent (iter->object, &a_ev); sendEvent (iter->object, &a_ev);
accpt = a_ev.isAccepted(); accpt = a_ev.isAccepted();

View File

@ -73,16 +73,7 @@ FDialog::~FDialog() // destructor
restoreVTerm (t_geometry); restoreVTerm (t_geometry);
} }
if ( vwin != 0 ) removeArea (vwin);
{
if ( vwin->changes != 0 )
delete[] vwin->changes;
if ( vwin->text != 0 )
delete[] vwin->text;
delete vwin;
}
if ( isModal() ) if ( isModal() )
unsetModal(); unsetModal();
@ -105,10 +96,8 @@ void FDialog::init()
createArea (vwin); createArea (vwin);
addDialog(this); addDialog(this);
addWindow(this); addWindow(this);
alwaysOnTop();
setActiveWindow(this); setActiveWindow(this);
setTransparentShadow(); setTransparentShadow();
setForegroundColor (wc.dialog_fg); setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg); setBackgroundColor (wc.dialog_bg);

View File

@ -108,7 +108,6 @@ void FMenu::init(FWidget* parent)
setGeometry (1, 1, 10, 2, false); // initialize geometry values setGeometry (1, 1, 10, 2, false); // initialize geometry values
setTransparentShadow(); setTransparentShadow();
addWindow(this); addWindow(this);
alwaysOnTop();
hide(); hide();
setForegroundColor (wc.menu_active_fg); setForegroundColor (wc.menu_active_fg);

View File

@ -22,18 +22,9 @@ FMenuBar::FMenuBar(FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FMenuBar::~FMenuBar() FMenuBar::~FMenuBar()
{ {
if ( vmenubar != 0 ) delWindow(this);
{ removeArea (vwin);
if ( vmenubar->changes != 0 ) setMenuBar(0);
delete[] vmenubar->changes;
if ( vmenubar->text != 0 )
delete[] vmenubar->text;
delete vmenubar;
}
vmenubar = 0;
} }
@ -45,10 +36,11 @@ void FMenuBar::init()
int w = r->getWidth(); int w = r->getWidth();
// initialize geometry values // initialize geometry values
setGeometry (1, 1, w, 1, false); setGeometry (1, 1, w, 1, false);
createArea (vmenubar); createArea (vwin);
vmenubar->visible = true; setAlwaysOnTop();
ignorePadding(); addWindow(this);
setMenuBar(this); setMenuBar(this);
ignorePadding();
if ( getRootWidget() ) if ( getRootWidget() )
getRootWidget()->setTopPadding(1, true); getRootWidget()->setTopPadding(1, true);
@ -376,7 +368,7 @@ void FMenuBar::drawItems()
if ( x < screenWidth ) if ( x < screenWidth )
{ {
x++; x++;
print (vmenubar, ' '); print (' ');
} }
txt = (*iter)->getText(); txt = (*iter)->getText();
@ -421,7 +413,7 @@ void FMenuBar::drawItems()
if ( ! is_noUnderline ) if ( ! is_noUnderline )
setUnderline(); setUnderline();
print (vmenubar, item_text[z]); print (item_text[z]);
if ( ! is_noUnderline ) if ( ! is_noUnderline )
unsetUnderline(); unsetUnderline();
@ -429,7 +421,7 @@ void FMenuBar::drawItems()
setColor(); setColor();
} }
else else
print (vmenubar, item_text[z]); print (item_text[z]);
} }
if ( x > screenWidth+1 ) if ( x > screenWidth+1 )
@ -437,19 +429,19 @@ void FMenuBar::drawItems()
if ( startpos < screenWidth ) if ( startpos < screenWidth )
{ {
printPos (screenWidth - 1, 1); printPos (screenWidth - 1, 1);
print (vmenubar, ".."); print ("..");
} }
else if ( startpos-1 <= screenWidth ) else if ( startpos-1 <= screenWidth )
{ {
printPos (screenWidth, 1); printPos (screenWidth, 1);
print (vmenubar, ' '); print (' ');
} }
} }
if ( x < screenWidth ) if ( x < screenWidth )
{ {
x++; x++;
print (vmenubar, ' '); print (' ');
} }
setColor (wc.menu_active_fg, wc.menu_active_bg); setColor (wc.menu_active_fg, wc.menu_active_bg);
@ -462,7 +454,7 @@ void FMenuBar::drawItems()
} }
for (; x <= screenWidth; x++) for (; x <= screenWidth; x++)
print (vmenubar, ' '); print (' ');
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);
@ -924,7 +916,7 @@ void FMenuBar::hide()
memset(blank, ' ', uLong(screenWidth)); memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0'; blank[screenWidth] = '\0';
printPos (1,1); printPos (1,1);
print (vmenubar, blank); print (blank);
delete[] blank; delete[] blank;
} }

View File

@ -158,18 +158,7 @@ FStatusBar::FStatusBar(FWidget* parent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FStatusBar::~FStatusBar() FStatusBar::~FStatusBar()
{ {
if ( vstatusbar != 0 ) delWindow(this);
{
if ( vstatusbar->changes != 0 )
delete[] vstatusbar->changes;
if ( vstatusbar->text != 0 )
delete[] vstatusbar->text;
delete vstatusbar;
}
vstatusbar = 0;
// delete all keys // delete all keys
if ( ! keylist.empty() ) if ( ! keylist.empty() )
@ -184,6 +173,8 @@ FStatusBar::~FStatusBar()
iter = keylist.erase(iter); iter = keylist.erase(iter);
} }
} }
removeArea (vwin);
setStatusBar(0); setStatusBar(0);
} }
@ -197,14 +188,13 @@ void FStatusBar::init()
int h = r->getHeight(); int h = r->getHeight();
// initialize geometry values // initialize geometry values
setGeometry (1, h, w, 1, false); setGeometry (1, h, w, 1, false);
createArea (vstatusbar); createArea (vwin);
vstatusbar->visible = true; setAlwaysOnTop();
addWindow(this);
setStatusBar(this);
ignorePadding(); ignorePadding();
mouse_down = false; mouse_down = false;
setStatusBar(this);
if ( getRootWidget() ) if ( getRootWidget() )
getRootWidget()->setBottomPadding(1, true); getRootWidget()->setBottomPadding(1, true);
@ -226,9 +216,6 @@ void FStatusBar::drawKeys()
std::vector<FStatusKey*>::const_iterator iter, end; std::vector<FStatusKey*>::const_iterator iter, end;
int screenWidth; int screenWidth;
if ( ! vstatusbar )
return;
screenWidth = getColumnNumber(); screenWidth = getColumnNumber();
x = 1; x = 1;
@ -262,27 +249,26 @@ void FStatusBar::drawKeys()
setColor ( wc.statusbar_active_hotkey_fg setColor ( wc.statusbar_active_hotkey_fg
, wc.statusbar_active_hotkey_bg ); , wc.statusbar_active_hotkey_bg );
x++; x++;
print (vstatusbar, ' '); print (' ');
x += kname_len; x += kname_len;
print (vstatusbar, getKeyName((*iter)->getKey())); print (getKeyName((*iter)->getKey()));
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg); setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
x++; x++;
print (vstatusbar, '-'); print ('-');
txt_length = int((*iter)->getText().getLength()); txt_length = int((*iter)->getText().getLength());
x += txt_length; x += txt_length;
if ( x <= screenWidth ) if ( x <= screenWidth )
{ {
print (vstatusbar, (*iter)->getText()); print ((*iter)->getText());
x++; x++;
print (vstatusbar, fc::RightHalfBlock); // ▌ print (fc::RightHalfBlock); // ▌
} }
else else
{ {
print ( vstatusbar print ( (*iter)->getText()
, (*iter)->getText()
.left(uInt(txt_length+screenWidth-x-1)) ); .left(uInt(txt_length+screenWidth-x-1)) );
print (vstatusbar, ".."); print ("..");
} }
if ( isMonochron() ) if ( isMonochron() )
@ -295,23 +281,22 @@ void FStatusBar::drawKeys()
// not active // not active
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg); setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
x++; x++;
print (vstatusbar, ' '); print (' ');
x += kname_len; x += kname_len;
print (vstatusbar, getKeyName((*iter)->getKey())); print (getKeyName((*iter)->getKey()));
setColor (wc.statusbar_fg, wc.statusbar_bg); setColor (wc.statusbar_fg, wc.statusbar_bg);
x++; x++;
print (vstatusbar, '-'); print ('-');
txt_length = int((*iter)->getText().getLength()); txt_length = int((*iter)->getText().getLength());
x += txt_length; x += txt_length;
if ( x-1 <= screenWidth ) if ( x-1 <= screenWidth )
print (vstatusbar, (*iter)->getText()); print ((*iter)->getText());
else else
{ {
print ( vstatusbar print ( (*iter)->getText()
, (*iter)->getText()
.left(uInt(txt_length+screenWidth-x-1)) ); .left(uInt(txt_length+screenWidth-x-1)) );
print ( vstatusbar, ".." ); print ("..");
} }
if ( iter+1 != keylist.end() if ( iter+1 != keylist.end()
@ -325,7 +310,7 @@ void FStatusBar::drawKeys()
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg); setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
x++; x++;
print (vstatusbar, fc::LeftHalfBlock); // ▐ print (fc::LeftHalfBlock); // ▐
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
@ -335,7 +320,7 @@ void FStatusBar::drawKeys()
// not the last element // not the last element
setColor (wc.statusbar_separator_fg, wc.statusbar_bg); setColor (wc.statusbar_separator_fg, wc.statusbar_bg);
x++; x++;
print (vstatusbar, fc::BoxDrawingsVertical); // │ print (fc::BoxDrawingsVertical); // │
} }
} }
} }
@ -344,7 +329,7 @@ void FStatusBar::drawKeys()
setColor (wc.statusbar_fg, wc.statusbar_bg); setColor (wc.statusbar_fg, wc.statusbar_bg);
for (; x <= screenWidth; x++) for (; x <= screenWidth; x++)
print (vstatusbar, ' '); print (' ');
} }
++iter; ++iter;
} }
@ -377,7 +362,7 @@ void FStatusBar::hide()
memset(blank, ' ', uLong(screenWidth)); memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0'; blank[screenWidth] = '\0';
printPos (1, 1); printPos (1, 1);
print (vstatusbar, blank); print (blank);
delete[] blank; delete[] blank;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -578,7 +563,7 @@ void FStatusBar::drawMessage()
int termWidth, space_offset; int termWidth, space_offset;
bool isLastActiveFocus, hasKeys; bool isLastActiveFocus, hasKeys;
if ( ! (isVisible() && vstatusbar) ) if ( ! (isVisible() ) )
return; return;
if ( x < 0 || x_msg < 0 ) if ( x < 0 || x_msg < 0 )
@ -615,32 +600,31 @@ void FStatusBar::drawMessage()
if ( ! isLastActiveFocus ) if ( ! isLastActiveFocus )
{ {
x++; x++;
print (vstatusbar, ' '); print (' ');
} }
if ( hasKeys ) if ( hasKeys )
{ {
x += 2; x += 2;
print (vstatusbar, fc::BoxDrawingsVertical); // │ print (fc::BoxDrawingsVertical); // │
print (vstatusbar, ' '); print (' ');
} }
int msg_length = int(getMessage().getLength()); int msg_length = int(getMessage().getLength());
x += msg_length; x += msg_length;
if ( x-1 <= termWidth ) if ( x-1 <= termWidth )
print (vstatusbar, getMessage()); print (getMessage());
else else
{ {
print ( vstatusbar print ( getMessage().left(uInt(msg_length+termWidth-x-1)) );
, getMessage().left(uInt(msg_length+termWidth-x-1)) ); print ("..");
print (vstatusbar, "..");
} }
} }
} }
for (int i=x; i <= termWidth; i++) for (int i=x; i <= termWidth; i++)
print (vstatusbar, ' '); print (' ');
if ( isMonochron() ) if ( isMonochron() )
setReverse(false); setReverse(false);

View File

@ -100,8 +100,6 @@ FOptiAttr* FTerm::opti_attr = 0;
FTerm::modifier_key FTerm::mod_key; FTerm::modifier_key FTerm::mod_key;
FTerm::term_area* FTerm::vterm = 0; FTerm::term_area* FTerm::vterm = 0;
FTerm::term_area* FTerm::vdesktop = 0; FTerm::term_area* FTerm::vdesktop = 0;
FTerm::term_area* FTerm::vmenubar = 0;
FTerm::term_area* FTerm::vstatusbar = 0;
FTerm::term_area* FTerm::last_area = 0; FTerm::term_area* FTerm::last_area = 0;
std::queue<int>* FTerm::output_buffer = 0; std::queue<int>* FTerm::output_buffer = 0;
std::map<uChar,uChar>* FTerm::vt100_alt_char = 0; std::map<uChar,uChar>* FTerm::vt100_alt_char = 0;
@ -134,8 +132,6 @@ FTerm::FTerm()
fd_tty = -1; fd_tty = -1;
vterm = 0; vterm = 0;
vdesktop = 0; vdesktop = 0;
vmenubar = 0;
vstatusbar = 0;
last_area = 0; last_area = 0;
x_term_pos = -1; x_term_pos = -1;
y_term_pos = -1; y_term_pos = -1;
@ -2141,33 +2137,8 @@ void FTerm::finish()
if ( xterm_font ) if ( xterm_font )
delete xterm_font; delete xterm_font;
if ( vdesktop != 0 ) removeArea (vdesktop);
{ removeArea (vterm);
if ( vdesktop->changes != 0 )
delete[] vdesktop->changes;
if ( vdesktop->text != 0 )
delete[] vdesktop->text;
delete vdesktop;
}
if ( vterm != 0 )
{
if ( vterm->changes != 0 )
{
delete[] vterm->changes;
vterm->changes = 0;
}
if ( vterm->text != 0 )
{
delete[] vterm->text;
vterm->text = 0;
}
delete vterm;
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -2265,8 +2236,10 @@ void FTerm::resizeArea (term_area* area)
{ {
if ( area->changes != 0 ) if ( area->changes != 0 )
delete[] area->changes; delete[] area->changes;
if ( area->text != 0 ) if ( area->text != 0 )
delete[] area->text; delete[] area->text;
area->changes = new line_changes[height + bsh]; area->changes = new line_changes[height + bsh];
area->text = new FOptiAttr::char_data[area_size]; area->text = new FOptiAttr::char_data[area_size];
} }
@ -2274,6 +2247,7 @@ void FTerm::resizeArea (term_area* area)
{ {
if ( area->text != 0 ) if ( area->text != 0 )
delete[] area->text; delete[] area->text;
area->text = new FOptiAttr::char_data[area_size]; area->text = new FOptiAttr::char_data[area_size];
} }
else else
@ -2313,6 +2287,29 @@ void FTerm::resizeArea (term_area* area)
std::fill_n (area->changes, height+bsh, unchanged); std::fill_n (area->changes, height+bsh, unchanged);
} }
//----------------------------------------------------------------------
void FTerm::removeArea (term_area*& area)
{
// remove the virtual window
if ( area != 0 )
{
if ( area->changes != 0 )
{
delete[] area->changes;
area->changes = 0;
}
if ( area->text != 0 )
{
delete[] area->text;
area->text = 0;
}
delete area;
area = 0;
}
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::restoreVTerm (const FRect& box) void FTerm::restoreVTerm (const FRect& box)
{ {
@ -2420,34 +2417,6 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
} }
} }
// menubar is always on top
FWidget* menubar;
menubar = reinterpret_cast<FWidget*>(FWidget::menuBar());
if ( vmenubar && menubar
&& menubar->getTermGeometry().contains(x+tx+1, y+ty+1) )
{
int bar_x = menubar->getTermX() - 1;
int bar_y = menubar->getTermY() - 1;
if ( vmenubar->visible )
sc = &vmenubar->text[(y+ty-bar_y) * vmenubar->width + (x+tx-bar_x)];
}
// statusbar is always on top
FWidget* statusbar;
statusbar = reinterpret_cast<FWidget*>(FWidget::statusBar());
if ( vstatusbar && statusbar
&& statusbar->getTermGeometry().contains(x+tx+1, y+ty+1) )
{
int bar_x = statusbar->getTermX() - 1;
int bar_y = statusbar->getTermY() - 1;
if ( vstatusbar->visible )
sc = &vstatusbar->text[(y+ty-bar_y) * vstatusbar->width + (x+tx-bar_x)];
}
memcpy (tc, sc, sizeof(FOptiAttr::char_data)); memcpy (tc, sc, sizeof(FOptiAttr::char_data));
if ( short(vterm->changes[y+ty].xmin) > x ) if ( short(vterm->changes[y+ty].xmin) > x )
@ -2516,34 +2485,6 @@ FTerm::covered_state FTerm::isCovered (int x, int y, FTerm::term_area* area) con
} }
} }
// menubar is always on top
FWidget* menubar;
if ( vmenubar )
menubar = reinterpret_cast<FWidget*>(vmenubar->widget);
else
menubar = 0;
if ( area != vmenubar && menubar
&& menubar->getTermGeometry().contains(x,y) )
{
is_covered = fully_covered;
}
// statusbar is always on top
FWidget* statusbar;
if ( vstatusbar )
statusbar = reinterpret_cast<FWidget*>(vstatusbar->widget);
else
statusbar = 0;
if ( area != vstatusbar && statusbar
&& statusbar->getTermGeometry().contains(x,y) )
{
is_covered = fully_covered;
}
return is_covered; return is_covered;
} }
@ -2813,7 +2754,7 @@ void FTerm::putArea (const FPoint& pos, FTerm::term_area* area)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::putArea (int ax, int ay, FTerm::term_area* area) void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
{ {
int aw, ah, rsh, bsh, y_end, length, ol, sbar; int aw, ah, rsh, bsh, y_end, length, ol;
FOptiAttr::char_data* tc; // terminal character FOptiAttr::char_data* tc; // terminal character
FOptiAttr::char_data* ac; // area character FOptiAttr::char_data* ac; // area character
@ -2830,7 +2771,6 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
rsh = area->right_shadow; rsh = area->right_shadow;
bsh = area->bottom_shadow; bsh = area->bottom_shadow;
ol = 0; // outside left ol = 0; // outside left
sbar = 0; // statusbar distance
if ( ax < 0 ) if ( ax < 0 )
{ {
@ -2838,11 +2778,8 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
ax = 0; ax = 0;
} }
if ( vstatusbar && vstatusbar->widget && area != vstatusbar ) if ( ay + ah + bsh > vterm->height )
sbar = 1; y_end = vterm->height - ay;
if ( ay + ah + bsh + sbar > vterm->height )
y_end = vterm->height - ay - sbar;
else else
y_end = ah + bsh; y_end = ah + bsh;

View File

@ -243,8 +243,6 @@ class FTerm
static term_area* vterm; // virtual terminal static term_area* vterm; // virtual terminal
static term_area* vdesktop; // virtual desktop static term_area* vdesktop; // virtual desktop
static term_area* vmenubar; // virtual menubar
static term_area* vstatusbar; // virtual statusbar
static term_area* last_area; // last used area static term_area* last_area; // last used area
term_area* vwin; // virtual window term_area* vwin; // virtual window
@ -292,6 +290,7 @@ class FTerm
static bool charEncodable (uInt); static bool charEncodable (uInt);
void createArea (FTerm::term_area*&); // reference to pointer void createArea (FTerm::term_area*&); // reference to pointer
void resizeArea (FTerm::term_area*); void resizeArea (FTerm::term_area*);
void removeArea (FTerm::term_area*&); // reference to pointer
void restoreVTerm (const FRect&); void restoreVTerm (const FRect&);
void restoreVTerm (int, int, int, int); void restoreVTerm (int, int, int, int);
FTerm::covered_state isCovered (const FPoint&, FTerm::term_area*) const; FTerm::covered_state isCovered (const FPoint&, FTerm::term_area*) const;

View File

@ -14,7 +14,10 @@
FToolTip::FToolTip (FWidget* parent) FToolTip::FToolTip (FWidget* parent)
: FWindow(parent) : FWindow(parent)
, text() , text()
, text_components(0)
, text_split()
, max_line_width(0) , max_line_width(0)
, text_num_lines(0)
{ {
init(); init();
} }
@ -23,7 +26,10 @@ FToolTip::FToolTip (FWidget* parent)
FToolTip::FToolTip (const FString& txt, FWidget* parent) FToolTip::FToolTip (const FString& txt, FWidget* parent)
: FWindow(parent) : FWindow(parent)
, text(txt) , text(txt)
, text_components(0)
, text_split()
, max_line_width(0) , max_line_width(0)
, text_num_lines(0)
{ {
init(); init();
} }
@ -35,10 +41,9 @@ FToolTip::~FToolTip() // destructor
if ( ! fapp->isQuit() ) if ( ! fapp->isQuit() )
{ {
FWidget* parent = getParentWidget();
FWindow* parent_win = 0; FWindow* parent_win = 0;
if ( parent ) if ( FWidget* parent = getParentWidget() )
parent_win = getWindowWidget(parent); parent_win = getWindowWidget(parent);
if ( parent_win ) if ( parent_win )
@ -55,16 +60,7 @@ FToolTip::~FToolTip() // destructor
restoreVTerm (t_geometry); restoreVTerm (t_geometry);
} }
if ( vwin != 0 ) removeArea (vwin);
{
if ( vwin->changes != 0 )
delete[] vwin->changes;
if ( vwin->text != 0 )
delete[] vwin->text;
delete vwin;
}
} }
@ -79,11 +75,8 @@ void FToolTip::init()
setMinimumSize (3, 3); setMinimumSize (3, 3);
createArea (vwin); createArea (vwin);
addWindow(this); addWindow(this);
alwaysOnTop();
setForegroundColor (wc.tooltip_fg); setForegroundColor (wc.tooltip_fg);
setBackgroundColor (wc.tooltip_bg); setBackgroundColor (wc.tooltip_bg);
calculateDimensions(); calculateDimensions();
} }

View File

@ -96,8 +96,7 @@ FWidget::~FWidget() // destructor
// unset the local window widget focus // unset the local window widget focus
if ( focus ) if ( focus )
{ {
FWindow* window = FWindow::getWindowWidget(this); if ( FWindow* window = FWindow::getWindowWidget(this) )
if ( window )
window->setWindowFocusWidget(0); window->setWindowFocusWidget(0);
} }
@ -143,7 +142,7 @@ void FWidget::init()
foreground_color = wc.term_fg; foreground_color = wc.term_fg;
background_color = wc.term_bg; background_color = wc.term_bg;
setColor (foreground_color, background_color); setColor();
clearArea(); clearArea();
accelerator_list = new Accelerators(); accelerator_list = new Accelerators();
@ -502,12 +501,6 @@ void FWidget::adjustSizeGlobal()
return; return;
} }
if ( menubar )
menubar->adjustSize();
if ( statusbar )
statusbar->adjustSize();
if ( window_list && ! window_list->empty() ) if ( window_list && ! window_list->empty() )
{ {
widgetList::const_iterator iter, end; widgetList::const_iterator iter, end;
@ -1230,6 +1223,7 @@ void FWidget::redraw()
if ( isRootWidget() ) if ( isRootWidget() )
{ {
terminal_updates = false; terminal_updates = false;
// clean desktop
setColor (wc.term_fg, wc.term_bg); setColor (wc.term_fg, wc.term_bg);
clearArea(); clearArea();
} }
@ -1283,22 +1277,6 @@ void FWidget::redraw()
++iter; ++iter;
} }
} }
if ( menubar && vmenubar )
{
int w = vmenubar->width;
int h = vmenubar->height;
std::fill_n (vmenubar->text, w * h, default_char);
menubar->redraw();
}
if ( statusbar && vstatusbar )
{
int w = vstatusbar->width;
int h = vstatusbar->height;
std::fill_n (vstatusbar->text, w * h, default_char);
statusbar->redraw();
}
} }
else else
{ {
@ -1344,23 +1322,6 @@ void FWidget::resize()
closeConsole(); closeConsole();
resizeVTerm(); resizeVTerm();
resizeArea (vdesktop); resizeArea (vdesktop);
if ( menubar )
{
menubar->setGeometry(1, 1, getWidth(), 1, false);
if ( vmenubar )
resizeArea(vmenubar);
}
if ( statusbar )
{
statusbar->setGeometry(1, getHeight(), getWidth(), 1, false);
if ( vstatusbar )
resizeArea(vstatusbar);
}
adjustSizeGlobal(); adjustSizeGlobal();
} }
else else

View File

@ -1235,6 +1235,7 @@ const wchar_t NF_Drive[5] =
fc::NF_shadow_box_right, fc::NF_shadow_box_right,
'\0' '\0'
}; };
const wchar_t NF_CD_ROM[5] = const wchar_t NF_CD_ROM[5] =
{ {
fc::NF_shadow_box_left, fc::NF_shadow_box_left,
@ -1243,6 +1244,7 @@ const wchar_t NF_CD_ROM[5] =
fc::NF_shadow_box_right, fc::NF_shadow_box_right,
'\0' '\0'
}; };
const wchar_t NF_Net_Drive[5] = const wchar_t NF_Net_Drive[5] =
{ {
fc::NF_shadow_box_left, fc::NF_shadow_box_left,
@ -1251,6 +1253,7 @@ const wchar_t NF_Net_Drive[5] =
fc::NF_shadow_box_right, fc::NF_shadow_box_right,
'\0' '\0'
}; };
const wchar_t CHECKBOX[4] = const wchar_t CHECKBOX[4] =
{ {
fc::NF_shadow_box_left, fc::NF_shadow_box_left,
@ -1258,6 +1261,7 @@ const wchar_t CHECKBOX[4] =
fc::NF_shadow_box_right, fc::NF_shadow_box_right,
'\0' '\0'
}; };
const wchar_t CHECKBOX_ON[4] = const wchar_t CHECKBOX_ON[4] =
{ {
fc::NF_shadow_box_left, fc::NF_shadow_box_left,
@ -1265,6 +1269,7 @@ const wchar_t CHECKBOX_ON[4] =
fc::NF_shadow_box_right, fc::NF_shadow_box_right,
'\0' '\0'
}; };
const wchar_t RADIO_BUTTON[4] = const wchar_t RADIO_BUTTON[4] =
{ {
fc::NF_radio_button1, fc::NF_radio_button1,
@ -1272,6 +1277,7 @@ const wchar_t RADIO_BUTTON[4] =
fc::NF_radio_button3, fc::NF_radio_button3,
'\0' '\0'
}; };
const wchar_t CHECKED_RADIO_BUTTON[4] = const wchar_t CHECKED_RADIO_BUTTON[4] =
{ {
fc::NF_radio_button1, fc::NF_radio_button1,

View File

@ -59,6 +59,27 @@ void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
} }
} }
//----------------------------------------------------------------------
void FWindow::processAlwaysOnTop()
{
// Raise all always-on-top windows
if ( always_on_top_list && ! always_on_top_list->empty() )
{
widgetList::iterator iter;
iter = always_on_top_list->begin();
while ( iter != always_on_top_list->end() )
{
delWindow (*iter);
if ( window_list )
window_list->push_back(*iter);
++iter;
}
}
}
// protected methods of FWindow // protected methods of FWindow
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -221,6 +242,8 @@ void FWindow::addWindow (FWidget* obj)
// add the window object obj to the window list // add the window object obj to the window list
if ( window_list ) if ( window_list )
window_list->push_back(obj); window_list->push_back(obj);
processAlwaysOnTop();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -367,7 +390,7 @@ bool FWindow::raiseWindow (FWidget* obj)
window_list->push_back (obj); window_list->push_back (obj);
FEvent ev(fc::WindowRaised_Event); FEvent ev(fc::WindowRaised_Event);
FApplication::sendEvent(obj, &ev); FApplication::sendEvent(obj, &ev);
alwaysOnTop(); processAlwaysOnTop();
return true; return true;
} }
@ -417,24 +440,6 @@ bool FWindow::lowerWindow (FWidget* obj)
return false; return false;
} }
//----------------------------------------------------------------------
void FWindow::alwaysOnTop()
{
// Raise all always-on-top windows
if ( always_on_top_list && ! always_on_top_list->empty() )
{
widgetList::iterator iter;
iter = always_on_top_list->begin();
while ( iter != always_on_top_list->end() )
{
delWindow (*iter);
addWindow (*iter);
++iter;
}
}
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FWindow::zoomWindow() bool FWindow::zoomWindow()
{ {
@ -565,8 +570,11 @@ void FWindow::switchToPrevWindow()
--iter; --iter;
FWindow* w = static_cast<FWindow*>(*iter); FWindow* w = static_cast<FWindow*>(*iter);
if ( w && w != active_window if ( w
&& ! (w->isHiddenWindow() || w->isActiveWindow()) ) && w != active_window
&& ! (w->isHiddenWindow() || w->isActiveWindow())
&& w != static_cast<FWindow*>(statusBar())
&& w != static_cast<FWindow*>(menuBar()) )
{ {
setActiveWindow(w); setActiveWindow(w);
break; break;
@ -599,12 +607,18 @@ bool FWindow::activatePrevWindow()
// activate the previous window // activate the previous window
FWindow* w = previous_widget; FWindow* w = previous_widget;
if ( w && ! (w->isHiddenWindow() || w->isActiveWindow()) ) if ( w )
{
if ( w->isActiveWindow() )
return true;
if ( w && ! w->isHiddenWindow() )
{ {
setActiveWindow(w); setActiveWindow(w);
return true; return true;
} }
else }
return false; return false;
} }

View File

@ -58,7 +58,8 @@ class FWindow : public FWidget
// Disable assignment operator (=) // Disable assignment operator (=)
FWindow& operator = (const FWindow&); FWindow& operator = (const FWindow&);
void deleteFromAlwaysOnTopList (FWidget*); static void deleteFromAlwaysOnTopList (FWidget*);
static void processAlwaysOnTop();
protected: protected:
// Event handlers // Event handlers
@ -96,7 +97,6 @@ class FWindow : public FWidget
bool raiseWindow (); bool raiseWindow ();
static bool lowerWindow (FWidget*); static bool lowerWindow (FWidget*);
bool lowerWindow (); bool lowerWindow ();
static void alwaysOnTop();
bool zoomWindow (); bool zoomWindow ();
bool isZoomed() const; bool isZoomed() const;
bool setWindowWidget (bool); bool setWindowWidget (bool);

View File

@ -112,6 +112,8 @@ void Transparent::onKeyPress (FKeyEvent* ev)
else else
ev->ignore(); ev->ignore();
} }
else
FDialog::onKeyPress(ev);
} }
@ -147,6 +149,8 @@ class MainWindow : public FDialog
close(); close();
ev->accept(); ev->accept();
} }
else
FDialog::onKeyPress(ev);
} }
public: public: