The Final Cut can now also be compiled under Cygwin

This commit is contained in:
Markus Gans 2018-01-21 16:21:41 +01:00
parent 91023e3a76
commit ec63b0039e
14 changed files with 474 additions and 335 deletions

View File

@ -1,3 +1,12 @@
2017-01-21 Markus Gans <guru.mail@muenster.de>
* The Final Cut can now also be compiled under Cygwin
* Fixed bug in FScrollView::scrollTo
* Refactoring FStatusBar::drawKeys
* Refactoring FListView::drawListLine
2017-01-17 Markus Gans <guru.mail@muenster.de>
* Small array optimizations in the examples
2017-01-14 Markus Gans <guru.mail@muenster.de>
* Mouse functions are now in a separate class

View File

@ -23,6 +23,7 @@
* NetBSD
* OpenBSD
* macOS
* Cygwin
* Solaris
The Final Cut

View File

@ -47,6 +47,14 @@ class Menu : public FDialog
Menu& operator = (const Menu&);
// Methods
void createFileMenuItems (FMenu*);
void createEditMenuItems (FMenu*);
void createChoiceMenuItems (FMenu*);
void createColorMenuItems (FMenu*);
void createStyleMenuItems (FMenu*);
void createBorderMenuItems (FMenu*);
void createBorderColorMenuItems (FMenu*);
void createBorderStyleMenuItems (FMenu*);
void defaultCallback (FMenuList*);
void adjustSize();
@ -62,10 +70,10 @@ class Menu : public FDialog
Menu::Menu (FWidget* parent)
: FDialog(parent)
{
// menu bar
// Menu bar
FMenuBar* Menubar = new FMenuBar (this);
// menu bar items
// Menu bar items
FMenu* File = new FMenu ("&File", Menubar);
File->setStatusbarMessage ("File management commands");
FMenu* Edit = new FMenu ("&Edit", Menubar);
@ -77,118 +85,14 @@ Menu::Menu (FWidget* parent)
FMenuItem* Help = new FMenuItem ("&Help", Menubar);
Help->setStatusbarMessage ("Show version and copyright information");
// "File" menu items
FMenuItem* New = new FMenuItem ("&New", File);
New->addAccelerator (fc::Fckey_n); // Ctrl + N
New->setStatusbarMessage ("Create a new file");
FMenuItem* Open = new FMenuItem ("&Open...", File);
Open->addAccelerator (fc::Fckey_o); // Ctrl + O
Open->setStatusbarMessage ("Locate and open a text file");
FMenuItem* Save = new FMenuItem ("&Save", File);
Save->addAccelerator (fc::Fckey_s); // Ctrl + S
Save->setStatusbarMessage ("Save the file");
FMenuItem* SaveAs = new FMenuItem ("&Save as...", File);
SaveAs->setStatusbarMessage ("Save the current file under a different name");
FMenuItem* Close = new FMenuItem ("&Close", File);
Close->addAccelerator (fc::Fckey_w); // Ctrl + W
Close->setStatusbarMessage ("Close the current file");
FMenuItem* Line1 = new FMenuItem (File);
Line1->setSeparator();
FMenuItem* Print = new FMenuItem ("&Print", File);
Print->addAccelerator (fc::Fckey_p); // Ctrl + P
Print->setStatusbarMessage ("Print the current file");
FMenuItem* Line2 = new FMenuItem (File);
Line2->setSeparator();
FMenuItem* Quit = new FMenuItem ("&Quit", File);
Quit->addAccelerator (fc::Fmkey_x); // Meta/Alt + X
Quit->setStatusbarMessage ("Exit the program");
// "Edit" menu items
FMenuItem* Undo = new FMenuItem (fc::Fckey_z, "&Undo", Edit);
Undo->setStatusbarMessage ("Undo the previous operation");
FMenuItem* Redo = new FMenuItem (fc::Fckey_y, "&Redo", Edit);
Redo->setDisable();
FMenuItem* Line3 = new FMenuItem (Edit);
Line3->setSeparator();
FMenuItem* Cut = new FMenuItem (fc::Fckey_x, "Cu&t", Edit);
Cut->setStatusbarMessage ( "Remove the input text "
"and put it in the clipboard" );
FMenuItem* Copy = new FMenuItem (fc::Fckey_c, "&Copy", Edit);
Copy->setStatusbarMessage ("Copy the input text into the clipboad");
FMenuItem* Paste = new FMenuItem (fc::Fckey_v, "&Paste", Edit);
Paste->setStatusbarMessage ("Insert text form clipboard");
FMenuItem* Line4 = new FMenuItem (Edit);
Line4->setSeparator();
FMenuItem* Search = new FMenuItem (fc::Fckey_f, "&Search", Edit);
Search->setStatusbarMessage ("Search for text");
FMenuItem* Next = new FMenuItem (fc::Fkey_f3, "Search &next", Edit);
Next->setStatusbarMessage ("Repeat the last search command");
FMenuItem* Line5 = new FMenuItem (Edit);
Line5->setSeparator();
FMenuItem* SelectAll = new FMenuItem (fc::Fckey_a, "Select &all", Edit);
SelectAll->setStatusbarMessage ("Select the whole text");
// "Choice" menu items
FMenu* Color = new FMenu ("&Color", Choice);
Color->setStatusbarMessage ("Choose a color");
FMenu* Style = new FMenu ("&Style", Choice);
Style->setStatusbarMessage ("Choose a Style");
FMenu* Border = new FMenu ("&Border", Choice);
Border->setStatusbarMessage ("Choose Border");
// "Color" menu items
FRadioMenuItem* Color1 = new FRadioMenuItem ("Red", Color);
Color1->setStatusbarMessage ("Set text red");
FRadioMenuItem* Color2 = new FRadioMenuItem ("Green", Color);
Color2->setStatusbarMessage ("Set text green");
FRadioMenuItem* Color3 = new FRadioMenuItem ("Yellow", Color);
Color3->setStatusbarMessage ("Set text yellow");
FRadioMenuItem* Color4 = new FRadioMenuItem ("Brue", Color);
Color4->setStatusbarMessage ("Set text brue");
FRadioMenuItem* Color5 = new FRadioMenuItem ("Black", Color);
Color5->setStatusbarMessage ("Set text black");
Color5->setChecked();
// "Style" menu items
FCheckMenuItem* Bold = new FCheckMenuItem ("Bold", Style);
Bold->setStatusbarMessage ("Set text bold");
FCheckMenuItem* Italic = new FCheckMenuItem ("Italic", Style);
Italic->setStatusbarMessage ("Set text italic");
// "Border" menu items
FMenu* BColor = new FMenu ("&Color", Border);
BColor->setStatusbarMessage ("Choose the border color");
FMenu* BStyle = new FMenu ("&Style", Border);
BStyle->setStatusbarMessage ("Choose the border Style");
// "BColor" menu items
FRadioMenuItem* BColor1 = new FRadioMenuItem ("Red", BColor);
BColor1->setStatusbarMessage ("Set red border");
FRadioMenuItem* BColor2 = new FRadioMenuItem ("Blue", BColor);
BColor2->setStatusbarMessage ("Set blue border");
// "BStyle" menu items
FString line(13, wchar_t(fc::BoxDrawingsHorizontal));
FRadioMenuItem* BStyle1 = new FRadioMenuItem (line, BStyle);
BStyle1->setChecked();
BStyle1->setStatusbarMessage ("Set border 1");
FRadioMenuItem* BStyle2 = new FRadioMenuItem ("-------------", BStyle);
BStyle2->setStatusbarMessage ("Set border 2");
FRadioMenuItem* BStyle3 = new FRadioMenuItem ("- - - - - - -", BStyle);
BStyle3->setStatusbarMessage ("Set border 3");
FRadioMenuItem* BStyle4 = new FRadioMenuItem ("- - - - -", BStyle);
BStyle4->setStatusbarMessage ("Set border 4");
// Menu items
createFileMenuItems (File);
createEditMenuItems (Edit);
createChoiceMenuItems (Choice);
// Add default menu item callback
defaultCallback (Menubar);
// Add quit menu item callback
Quit->addCallback
(
"clicked",
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
);
// Statusbar at the bottom
FStatusBar* statusbar = new FStatusBar (this);
statusbar->setMessage("Status bar message");
@ -215,6 +119,154 @@ Menu::Menu (FWidget* parent)
Menu::~Menu()
{ }
//----------------------------------------------------------------------
void Menu::createFileMenuItems (FMenu* File)
{
// "File" menu items
FMenuItem* New = new FMenuItem ("&New", File);
New->addAccelerator (fc::Fckey_n); // Ctrl + N
New->setStatusbarMessage ("Create a new file");
FMenuItem* Open = new FMenuItem ("&Open...", File);
Open->addAccelerator (fc::Fckey_o); // Ctrl + O
Open->setStatusbarMessage ("Locate and open a text file");
FMenuItem* Save = new FMenuItem ("&Save", File);
Save->addAccelerator (fc::Fckey_s); // Ctrl + S
Save->setStatusbarMessage ("Save the file");
FMenuItem* SaveAs = new FMenuItem ("&Save as...", File);
SaveAs->setStatusbarMessage ("Save the current file under a different name");
FMenuItem* Close = new FMenuItem ("&Close", File);
Close->addAccelerator (fc::Fckey_w); // Ctrl + W
Close->setStatusbarMessage ("Close the current file");
FMenuItem* Line1 = new FMenuItem (File);
Line1->setSeparator();
FMenuItem* Print = new FMenuItem ("&Print", File);
Print->addAccelerator (fc::Fckey_p); // Ctrl + P
Print->setStatusbarMessage ("Print the current file");
FMenuItem* Line2 = new FMenuItem (File);
Line2->setSeparator();
FMenuItem* Quit = new FMenuItem ("&Quit", File);
Quit->addAccelerator (fc::Fmkey_x); // Meta/Alt + X
Quit->setStatusbarMessage ("Exit the program");
// Add quit menu item callback
Quit->addCallback
(
"clicked",
F_METHOD_CALLBACK (this, &FApplication::cb_exitApp)
);
}
//----------------------------------------------------------------------
void Menu::createEditMenuItems (FMenu* Edit)
{
// "Edit" menu items
FMenuItem* Undo = new FMenuItem (fc::Fckey_z, "&Undo", Edit);
Undo->setStatusbarMessage ("Undo the previous operation");
FMenuItem* Redo = new FMenuItem (fc::Fckey_y, "&Redo", Edit);
Redo->setDisable();
FMenuItem* Line3 = new FMenuItem (Edit);
Line3->setSeparator();
FMenuItem* Cut = new FMenuItem (fc::Fckey_x, "Cu&t", Edit);
Cut->setStatusbarMessage ( "Remove the input text "
"and put it in the clipboard" );
FMenuItem* Copy = new FMenuItem (fc::Fckey_c, "&Copy", Edit);
Copy->setStatusbarMessage ("Copy the input text into the clipboad");
FMenuItem* Paste = new FMenuItem (fc::Fckey_v, "&Paste", Edit);
Paste->setStatusbarMessage ("Insert text form clipboard");
FMenuItem* Line4 = new FMenuItem (Edit);
Line4->setSeparator();
FMenuItem* Search = new FMenuItem (fc::Fckey_f, "&Search", Edit);
Search->setStatusbarMessage ("Search for text");
FMenuItem* Next = new FMenuItem (fc::Fkey_f3, "Search &next", Edit);
Next->setStatusbarMessage ("Repeat the last search command");
FMenuItem* Line5 = new FMenuItem (Edit);
Line5->setSeparator();
FMenuItem* SelectAll = new FMenuItem (fc::Fckey_a, "Select &all", Edit);
SelectAll->setStatusbarMessage ("Select the whole text");
}
//----------------------------------------------------------------------
void Menu::createChoiceMenuItems (FMenu* Choice)
{
// "Choice" menu items
FMenu* Color = new FMenu ("&Color", Choice);
Color->setStatusbarMessage ("Choose a color");
FMenu* Style = new FMenu ("&Style", Choice);
Style->setStatusbarMessage ("Choose a Style");
FMenu* Border = new FMenu ("&Border", Choice);
Border->setStatusbarMessage ("Choose Border");
createColorMenuItems (Color);
createStyleMenuItems (Style);
createBorderMenuItems (Border);
}
//----------------------------------------------------------------------
void Menu::createColorMenuItems (FMenu* Color)
{
// "Color" menu items
FRadioMenuItem* Color1 = new FRadioMenuItem ("Red", Color);
Color1->setStatusbarMessage ("Set text red");
FRadioMenuItem* Color2 = new FRadioMenuItem ("Green", Color);
Color2->setStatusbarMessage ("Set text green");
FRadioMenuItem* Color3 = new FRadioMenuItem ("Yellow", Color);
Color3->setStatusbarMessage ("Set text yellow");
FRadioMenuItem* Color4 = new FRadioMenuItem ("Brue", Color);
Color4->setStatusbarMessage ("Set text brue");
FRadioMenuItem* Color5 = new FRadioMenuItem ("Black", Color);
Color5->setStatusbarMessage ("Set text black");
Color5->setChecked();
}
//----------------------------------------------------------------------
void Menu::createStyleMenuItems (FMenu* Style)
{
// "Style" menu items
FCheckMenuItem* Bold = new FCheckMenuItem ("Bold", Style);
Bold->setStatusbarMessage ("Set text bold");
FCheckMenuItem* Italic = new FCheckMenuItem ("Italic", Style);
Italic->setStatusbarMessage ("Set text italic");
}
//----------------------------------------------------------------------
void Menu::createBorderMenuItems (FMenu* Border)
{
// "Border" menu items
FMenu* BColor = new FMenu ("&Color", Border);
BColor->setStatusbarMessage ("Choose the border color");
FMenu* BStyle = new FMenu ("&Style", Border);
BStyle->setStatusbarMessage ("Choose the border Style");
createBorderColorMenuItems (BColor);
createBorderStyleMenuItems (BStyle);
}
//----------------------------------------------------------------------
void Menu::createBorderColorMenuItems (FMenu* BColor)
{
// "BColor" menu items
FRadioMenuItem* BColor1 = new FRadioMenuItem ("Red", BColor);
BColor1->setStatusbarMessage ("Set red border");
FRadioMenuItem* BColor2 = new FRadioMenuItem ("Blue", BColor);
BColor2->setStatusbarMessage ("Set blue border");
}
//----------------------------------------------------------------------
void Menu::createBorderStyleMenuItems (FMenu* BStyle)
{
// "BStyle" menu items
FString line(13, wchar_t(fc::BoxDrawingsHorizontal));
FRadioMenuItem* BStyle1 = new FRadioMenuItem (line, BStyle);
BStyle1->setChecked();
BStyle1->setStatusbarMessage ("Set border 1");
FRadioMenuItem* BStyle2 = new FRadioMenuItem ("-------------", BStyle);
BStyle2->setStatusbarMessage ("Set border 2");
FRadioMenuItem* BStyle3 = new FRadioMenuItem ("- - - - - - -", BStyle);
BStyle3->setStatusbarMessage ("Set border 3");
FRadioMenuItem* BStyle4 = new FRadioMenuItem ("- - - - -", BStyle);
BStyle4->setStatusbarMessage ("Set border 4");
}
//----------------------------------------------------------------------
void Menu::defaultCallback (FMenuList* mb)
{

View File

@ -178,6 +178,7 @@ class FDialog : public FWindow
// Methods
void init();
void initDialogMenu();
virtual void drawBorder();
void drawTitleBar();
void drawBarButton();

View File

@ -321,6 +321,8 @@ class FListView : public FWidget
void drawColumnLabels();
void drawList();
void drawListLine (const FListViewItem*, bool, bool);
void setLineAttributes (bool, bool);
FString getLinePrefix (const FListViewItem*, uInt);
void updateDrawing (bool, bool);
void recalculateHorizontalBar (int);
void recalculateVerticalBar (int);

View File

@ -247,11 +247,15 @@ class FStatusBar : public FWindow
void init();
void draw();
void drawKeys();
void drawKey (keyList::const_iterator);
void drawActiveKey (keyList::const_iterator);
// Data Members
keyList key_list;
FString text;
bool mouse_down;
int screenWidth;
int keyname_len;
int x;
int x_msg;
};

View File

@ -477,6 +477,8 @@ class FWidget : public FVTerm, public FObject
void KeyDownEvent (FKeyEvent*);
void processDestroy();
virtual void draw();
void drawTransparentShadow (int, int, int, int);
void drawBlockShadow (int, int, int, int);
static void setColorTheme();
static void set8ColorTheme();
static void set16ColorTheme();

View File

@ -929,6 +929,14 @@ void FDialog::init()
}
// Add the dialog menu
initDialogMenu();
}
//----------------------------------------------------------------------
void FDialog::initDialogMenu()
{
// Create the dialog Menu (access via Shift-F10 or Ctrl-^)
try
{
dialog_menu = new FMenu ("-", this);

View File

@ -1523,64 +1523,13 @@ void FListView::drawListLine ( const FListViewItem* item
{
uInt indent = item->getDepth() << 1; // indent = 2 * depth
setColor (wc.list_fg, wc.list_bg);
// Set line color and attributes
setLineAttributes (is_current, is_focus);
if ( is_current )
{
if ( is_focus && getMaxColor() < 16 )
setBold();
// Print the entry
FString line = getLinePrefix (item, indent);
if ( isMonochron() )
unsetBold();
if ( is_focus )
{
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
}
else
setColor ( wc.current_element_fg
, wc.current_element_bg );
if ( isMonochron() )
setReverse(false);
}
else
{
if ( isMonochron() )
setReverse(true);
else if ( is_focus && getMaxColor() < 16 )
unsetBold();
}
// print the entry
FString line;
if ( tree_view )
{
if ( indent > 0 )
line = FString(indent, L' ');
if ( item->expandable )
{
if ( item->is_expand )
{
line += wchar_t(fc::BlackDownPointingTriangle); // ▼
line += L' ';
}
else
{
line += wchar_t(fc::BlackRightPointingPointer); // ►
line += L' ';
}
}
else
line += L" ";
}
else
line = L" ";
// print columns
// Print columns
if ( ! item->column_list.empty() )
{
for (uInt i = 0; i < item->column_list.size(); )
@ -1643,6 +1592,74 @@ void FListView::drawListLine ( const FListViewItem* item
print (' ');
}
//----------------------------------------------------------------------
inline void FListView::setLineAttributes ( bool is_current
, bool is_focus )
{
setColor (wc.list_fg, wc.list_bg);
if ( is_current )
{
if ( is_focus && getMaxColor() < 16 )
setBold();
if ( isMonochron() )
unsetBold();
if ( is_focus )
{
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
}
else
setColor ( wc.current_element_fg
, wc.current_element_bg );
if ( isMonochron() )
setReverse(false);
}
else
{
if ( isMonochron() )
setReverse(true);
else if ( is_focus && getMaxColor() < 16 )
unsetBold();
}
}
//----------------------------------------------------------------------
inline FString FListView::getLinePrefix ( const FListViewItem* item
, uInt indent )
{
FString line = "";
if ( tree_view )
{
if ( indent > 0 )
line = FString(indent, L' ');
if ( item->expandable )
{
if ( item->is_expand )
{
line += wchar_t(fc::BlackDownPointingTriangle); // ▼
line += L' ';
}
else
{
line += wchar_t(fc::BlackRightPointingPointer); // ►
line += L' ';
}
}
else
line += L" ";
}
else
line = L" ";
return line;
}
//----------------------------------------------------------------------
void FListView::updateDrawing (bool draw_vbar, bool draw_hbar)
{

View File

@ -1234,18 +1234,21 @@ void FMouseControl::clearEvent()
}
//----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM
void FMouseControl::setStdinNo (int file_descriptor)
{
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse )
gpm_mouse->setStdinNo(file_descriptor);
#endif
}
#else
void FMouseControl::setStdinNo (int)
{ }
#endif
//----------------------------------------------------------------------
void FMouseControl::setMaxWidth (short x_max)
@ -1565,19 +1568,23 @@ void FMouseControl::processEvent (struct timeval* time)
}
//----------------------------------------------------------------------
#ifdef F_HAVE_LIBGPM
bool FMouseControl::getGpmKeyPressed (bool pending)
#else
bool FMouseControl::getGpmKeyPressed (bool)
#endif
{
if ( mouse_protocol.empty() )
return false;
#ifdef F_HAVE_LIBGPM
FMouse* mouse = mouse_protocol[FMouse::gpm];
FMouseGPM* gpm_mouse = static_cast<FMouseGPM*>(mouse);
if ( gpm_mouse )
return gpm_mouse->getGpmKeyPressed(pending);
#endif
return false;

View File

@ -369,8 +369,8 @@ void FScrollView::scrollTo (int x, int y)
if ( changeX )
{
viewport_geometry.setWidth(save_width);
setTopPadding (1 - yoffset);
setBottomPadding (1 - (yoffset_end - yoffset));
setLeftPadding (1 - xoffset);
setRightPadding (1 - (xoffset_end - xoffset) + nf_offset);
if ( update_scrollbar )
{
@ -382,8 +382,8 @@ void FScrollView::scrollTo (int x, int y)
if ( changeY )
{
viewport_geometry.setHeight(save_height);
setLeftPadding (1 - xoffset);
setRightPadding (1 - (xoffset_end - xoffset) + nf_offset);
setTopPadding (1 - yoffset);
setBottomPadding (1 - (yoffset_end - yoffset));
if ( update_scrollbar )
{

View File

@ -134,6 +134,8 @@ FStatusBar::FStatusBar(FWidget* parent)
, key_list()
, text("")
, mouse_down()
, screenWidth(80)
, keyname_len(0)
, x(-1)
, x_msg(-1)
{
@ -578,8 +580,7 @@ void FStatusBar::draw()
//----------------------------------------------------------------------
void FStatusBar::drawKeys()
{
std::vector<FStatusKey*>::const_iterator iter, last;
int screenWidth;
keyList::const_iterator iter, last;
screenWidth = getDesktopWidth();
x = 1;
@ -600,101 +601,14 @@ void FStatusBar::drawKeys()
while ( iter != last )
{
int kname_len = int(getKeyName((*iter)->getKey()).getLength());
keyname_len = int(getKeyName((*iter)->getKey()).getLength());
if ( x + kname_len + 2 < screenWidth )
if ( x + keyname_len + 2 < screenWidth )
{
if ( (*iter)->isActivated() || (*iter)->hasMouseFocus() )
{
int txt_length;
if ( isMonochron() )
setReverse(false);
setColor ( wc.statusbar_active_hotkey_fg
, wc.statusbar_active_hotkey_bg );
x++;
print (' ');
x += kname_len;
print (getKeyName((*iter)->getKey()));
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
x++;
print ('-');
txt_length = int((*iter)->getText().getLength());
x += txt_length;
if ( x <= screenWidth )
{
print ((*iter)->getText());
x++;
print (fc::RightHalfBlock); // ▌
}
else
{
// Print ellipsis
print ( (*iter)->getText()
.left(uInt(txt_length + screenWidth - x - 1)) );
print ("..");
}
if ( isMonochron() )
setReverse(true);
}
drawActiveKey (iter);
else
{
int txt_length;
// not active
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
x++;
print (' ');
x += kname_len;
print (getKeyName((*iter)->getKey()));
setColor (wc.statusbar_fg, wc.statusbar_bg);
x++;
print ('-');
txt_length = int((*iter)->getText().getLength());
x += txt_length;
if ( x - 1 <= screenWidth )
print ((*iter)->getText());
else
{
// Print ellipsis
print ( (*iter)->getText()
.left(uInt(txt_length + screenWidth - x - 1)) );
print ("..");
}
if ( iter + 1 != key_list.end()
&& ( (*(iter + 1))->isActivated() || (*(iter + 1))->hasMouseFocus() )
&& x + int(getKeyName((*(iter + 1))->getKey()).getLength()) + 3
< screenWidth )
{
// next element is active
if ( isMonochron() )
setReverse(false);
if ( no_half_block_character )
print (' ');
else
{
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
print (fc::LeftHalfBlock); // ▐
}
x++;
if ( isMonochron() )
setReverse(true);
}
else if ( iter + 1 != key_list.end() && x < screenWidth )
{
// not the last element
setColor (wc.statusbar_separator_fg, wc.statusbar_bg);
x++;
print (fc::BoxDrawingsVertical); // │
}
}
drawKey (iter);
}
else
{
@ -703,10 +617,114 @@ void FStatusBar::drawKeys()
for (; x <= screenWidth; x++)
print (' ');
}
++iter;
}
if ( isMonochron() )
setReverse(false);
x_msg = x;
}
//----------------------------------------------------------------------
void FStatusBar::drawKey (keyList::const_iterator iter)
{
// Draw not active key
int txt_length;
FStatusKey* item = *iter;
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
x++;
print (' ');
x += keyname_len;
print (getKeyName(item->getKey()));
setColor (wc.statusbar_fg, wc.statusbar_bg);
x++;
print ('-');
txt_length = int(item->getText().getLength());
x += txt_length;
if ( x - 1 <= screenWidth )
print (item->getText());
else
{
// Print ellipsis
print ( item->getText()
.left(uInt(txt_length + screenWidth - x - 1)) );
print ("..");
}
if ( iter + 1 != key_list.end()
&& ( (*(iter + 1))->isActivated() || (*(iter + 1))->hasMouseFocus() )
&& x + int(getKeyName((*(iter + 1))->getKey()).getLength()) + 3
< screenWidth )
{
// Next element is active
if ( isMonochron() )
setReverse(false);
if ( no_half_block_character )
print (' ');
else
{
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
print (fc::LeftHalfBlock); // ▐
}
x++;
if ( isMonochron() )
setReverse(true);
}
else if ( iter + 1 != key_list.end() && x < screenWidth )
{
// Not the last element
setColor (wc.statusbar_separator_fg, wc.statusbar_bg);
x++;
print (fc::BoxDrawingsVertical); // │
}
}
//----------------------------------------------------------------------
void FStatusBar::drawActiveKey (keyList::const_iterator iter)
{
// Draw active key
int txt_length;
FStatusKey* item = *iter;
if ( isMonochron() )
setReverse(false);
setColor ( wc.statusbar_active_hotkey_fg
, wc.statusbar_active_hotkey_bg );
x++;
print (' ');
x += keyname_len;
print (getKeyName(item->getKey()));
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
x++;
print ('-');
txt_length = int(item->getText().getLength());
x += txt_length;
if ( x <= screenWidth )
{
print (item->getText());
x++;
print (fc::RightHalfBlock); // ▌
}
else
{
// Print ellipsis
print ( item->getText()
.left(uInt(txt_length + screenWidth - x - 1)) );
print ("..");
}
if ( isMonochron() )
setReverse(true);
}

View File

@ -1505,7 +1505,11 @@ const FString FTerm::getSecDA()
struct timeval tv;
// Get the secondary device attributes
#if defined(__CYGWIN__)
puts (SECDA);
#else
putstring (SECDA);
#endif
std::fflush(stdout);
FD_ZERO(&ifds);

View File

@ -1426,77 +1426,12 @@ void FWidget::drawShadow()
if ( trans_shadow )
{
// transparent shadow
setPrintPos (x2 + 1, y1);
setTransparent();
print (" ");
unsetTransparent();
setColor (wc.shadow_bg, wc.shadow_fg);
setTransShadow();
for (int i = 1; i < getHeight(); i++)
{
setPrintPos (x2 + 1, y1 + i);
print (" ");
}
unsetTransShadow();
setPrintPos (x1, y2 + 1);
setTransparent();
print (" ");
unsetTransparent();
setColor (wc.shadow_bg, wc.shadow_fg);
setTransShadow();
for (int i = 2; i <= getWidth() + 1; i++)
print (' ');
unsetTransShadow();
if ( isMonochron() )
setReverse(false);
drawTransparentShadow (x1, y1, x2, y2);
}
else
{
// non-transparent shadow
int block;
if ( no_shadow_character )
return;
setPrintPos (x2 + 1, y1);
if ( isWindowWidget() )
{
setColor (wc.shadow_fg, wc.shadow_bg);
setInheritBackground(); // current background color will be ignored
}
else if ( FWidget* p = getParentWidget() )
setColor (wc.shadow_fg, p->getBackgroundColor());
block = fc::FullBlock; // █
print (fc::LowerHalfBlock); // ▄
if ( isWindowWidget() )
unsetInheritBackground();
for (int i = 1; i < getHeight(); i++)
{
setPrintPos (x2 + 1, y1 + i);
print (block); // █
}
setPrintPos (x1 + 1, y2 + 1);
if ( isWindowWidget() )
setInheritBackground();
for (int i = 1; i <= getWidth(); i++)
print (fc::UpperHalfBlock); // ▀
if ( isWindowWidget() )
unsetInheritBackground();
drawBlockShadow (x1, y1, x2, y2);
}
}
@ -2469,6 +2404,85 @@ void FWidget::KeyDownEvent (FKeyEvent* kev)
void FWidget::draw()
{ }
//----------------------------------------------------------------------
void FWidget::drawTransparentShadow (int x1, int y1, int x2, int y2)
{
// transparent shadow
setPrintPos (x2 + 1, y1);
setTransparent();
print (" ");
unsetTransparent();
setColor (wc.shadow_bg, wc.shadow_fg);
setTransShadow();
for (int i = 1; i < getHeight(); i++)
{
setPrintPos (x2 + 1, y1 + i);
print (" ");
}
unsetTransShadow();
setPrintPos (x1, y2 + 1);
setTransparent();
print (" ");
unsetTransparent();
setColor (wc.shadow_bg, wc.shadow_fg);
setTransShadow();
for (int i = 2; i <= getWidth() + 1; i++)
print (' ');
unsetTransShadow();
if ( isMonochron() )
setReverse(false);
}
//----------------------------------------------------------------------
void FWidget::drawBlockShadow (int x1, int y1, int x2, int y2)
{
// non-transparent shadow
int block;
if ( no_shadow_character )
return;
setPrintPos (x2 + 1, y1);
if ( isWindowWidget() )
{
setColor (wc.shadow_fg, wc.shadow_bg);
setInheritBackground(); // current background color will be ignored
}
else if ( FWidget* p = getParentWidget() )
setColor (wc.shadow_fg, p->getBackgroundColor());
block = fc::FullBlock; // █
print (fc::LowerHalfBlock); // ▄
if ( isWindowWidget() )
unsetInheritBackground();
for (int i = 1; i < getHeight(); i++)
{
setPrintPos (x2 + 1, y1 + i);
print (block); // █
}
setPrintPos (x1 + 1, y2 + 1);
if ( isWindowWidget() )
setInheritBackground();
for (int i = 1; i <= getWidth(); i++)
print (fc::UpperHalfBlock); // ▀
if ( isWindowWidget() )
unsetInheritBackground();
}
//----------------------------------------------------------------------
void FWidget::setColorTheme()
{