input cursor is now controlled by the vterm
This commit is contained in:
parent
a2d69f5e7b
commit
605194b69e
|
@ -1,3 +1,6 @@
|
||||||
|
2016-10-02 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* The input cursor is now controlled by the virtual terminal
|
||||||
|
|
||||||
2016-10-02 Markus Gans <guru.mail@muenster.de>
|
2016-10-02 Markus Gans <guru.mail@muenster.de>
|
||||||
* FStatusBar and FMenuBar use now the always-on-top
|
* FStatusBar and FMenuBar use now the always-on-top
|
||||||
window option
|
window option
|
||||||
|
|
52
src/fapp.cpp
52
src/fapp.cpp
|
@ -101,7 +101,7 @@ void FApplication::init()
|
||||||
std::fill_n (sgr_mouse, sizeof(sgr_mouse), '\0');
|
std::fill_n (sgr_mouse, sizeof(sgr_mouse), '\0');
|
||||||
std::fill_n (urxvt_mouse, sizeof(urxvt_mouse), '\0');
|
std::fill_n (urxvt_mouse, sizeof(urxvt_mouse), '\0');
|
||||||
// init bit field with 0
|
// init bit field with 0
|
||||||
memset(&b_state, 0x00, sizeof(b_state));
|
std::memset(&b_state, 0x00, sizeof(b_state));
|
||||||
// interpret the command line options
|
// interpret the command line options
|
||||||
cmd_options();
|
cmd_options();
|
||||||
}
|
}
|
||||||
|
@ -110,10 +110,10 @@ void FApplication::init()
|
||||||
void FApplication::setExitMessage (std::string message)
|
void FApplication::setExitMessage (std::string message)
|
||||||
{
|
{
|
||||||
quit_now = true;
|
quit_now = true;
|
||||||
snprintf ( FTerm::exit_message
|
std::snprintf ( FTerm::exit_message
|
||||||
, sizeof(FTerm::exit_message)
|
, sizeof(FTerm::exit_message)
|
||||||
, "%s"
|
, "%s"
|
||||||
,message.c_str() );
|
, message.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -141,7 +141,7 @@ void FApplication::cmd_options ()
|
||||||
|
|
||||||
if ( c == 0 )
|
if ( c == 0 )
|
||||||
{
|
{
|
||||||
if ( strcmp(long_options[idx].name, "encoding") == 0 )
|
if ( std::strcmp(long_options[idx].name, "encoding") == 0 )
|
||||||
{
|
{
|
||||||
FString encoding(optarg);
|
FString encoding(optarg);
|
||||||
encoding = encoding.toUpper();
|
encoding = encoding.toUpper();
|
||||||
|
@ -158,10 +158,10 @@ void FApplication::cmd_options ()
|
||||||
+ std::string(encoding.c_str()) );
|
+ std::string(encoding.c_str()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strcmp(long_options[idx].name, "no-optimize-cursor") == 0 )
|
if ( std::strcmp(long_options[idx].name, "no-optimize-cursor") == 0 )
|
||||||
setCursorOptimisation (false);
|
setCursorOptimisation (false);
|
||||||
|
|
||||||
if ( strcmp(long_options[idx].name, "vgafont") == 0 )
|
if ( std::strcmp(long_options[idx].name, "vgafont") == 0 )
|
||||||
{
|
{
|
||||||
bool ret = setVGAFont();
|
bool ret = setVGAFont();
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ void FApplication::cmd_options ()
|
||||||
setExitMessage ("VGAfont is not supported by this terminal");
|
setExitMessage ("VGAfont is not supported by this terminal");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strcmp(long_options[idx].name, "newfont") == 0 )
|
if ( std::strcmp(long_options[idx].name, "newfont") == 0 )
|
||||||
{
|
{
|
||||||
bool ret = setNewFont();
|
bool ret = setNewFont();
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ void FApplication::processKeyboardEvent()
|
||||||
case fc::Fkey_extended_mouse:
|
case fc::Fkey_extended_mouse:
|
||||||
{
|
{
|
||||||
int n = 3;
|
int n = 3;
|
||||||
int len = int(strlen(fifo_buf));
|
int len = int(std::strlen(fifo_buf));
|
||||||
|
|
||||||
while ( n < len && n < fifo_buf_size )
|
while ( n < len && n < fifo_buf_size )
|
||||||
{
|
{
|
||||||
|
@ -395,7 +395,7 @@ void FApplication::processKeyboardEvent()
|
||||||
case fc::Fkey_urxvt_mouse:
|
case fc::Fkey_urxvt_mouse:
|
||||||
{
|
{
|
||||||
int n = 2;
|
int n = 2;
|
||||||
int len = int(strlen(fifo_buf));
|
int len = int(std::strlen(fifo_buf));
|
||||||
|
|
||||||
while ( n < len && n < fifo_buf_size )
|
while ( n < len && n < fifo_buf_size )
|
||||||
{
|
{
|
||||||
|
@ -435,10 +435,8 @@ void FApplication::processKeyboardEvent()
|
||||||
&& ! k_press_ev.isAccepted()
|
&& ! k_press_ev.isAccepted()
|
||||||
&& ! k_down_ev.isAccepted() )
|
&& ! k_down_ev.isAccepted() )
|
||||||
{
|
{
|
||||||
bool accpt = false;
|
|
||||||
// switch to a specific dialog with Meta + 1..9
|
// switch to a specific dialog with Meta + 1..9
|
||||||
if ( ! accpt )
|
bool accpt = processDialogSwitchAccelerator();
|
||||||
accpt = processDialogSwitchAccelerator();
|
|
||||||
|
|
||||||
// windows keyboard accelerator
|
// windows keyboard accelerator
|
||||||
if ( ! accpt )
|
if ( ! accpt )
|
||||||
|
@ -455,7 +453,7 @@ void FApplication::processKeyboardEvent()
|
||||||
FWidget* root_widget = getRootWidget();
|
FWidget* root_widget = getRootWidget();
|
||||||
|
|
||||||
if ( root_widget )
|
if ( root_widget )
|
||||||
accpt = processAccelerator (root_widget);
|
processAccelerator (root_widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -464,7 +462,7 @@ void FApplication::processKeyboardEvent()
|
||||||
} // end of switch
|
} // end of switch
|
||||||
}
|
}
|
||||||
|
|
||||||
fifo_offset = int(strlen(fifo_buf));
|
fifo_offset = int(std::strlen(fifo_buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
// send key up event
|
// send key up event
|
||||||
|
@ -963,7 +961,7 @@ bool FApplication::parseX11Mouse()
|
||||||
y = uChar(x11_mouse[2] - 0x20);
|
y = uChar(x11_mouse[2] - 0x20);
|
||||||
new_mouse_position.setPoint(x,y);
|
new_mouse_position.setPoint(x,y);
|
||||||
// fill bit field with 0
|
// fill bit field with 0
|
||||||
memset(&b_state, 0x00, sizeof(b_state));
|
std::memset(&b_state, 0x00, sizeof(b_state));
|
||||||
|
|
||||||
if ( (x11_mouse[0] & key_shift) == key_shift )
|
if ( (x11_mouse[0] & key_shift) == key_shift )
|
||||||
b_state.shift_button = Pressed;
|
b_state.shift_button = Pressed;
|
||||||
|
@ -1056,7 +1054,7 @@ bool FApplication::parseSGRMouse()
|
||||||
|
|
||||||
new_mouse_position.setPoint(x,y);
|
new_mouse_position.setPoint(x,y);
|
||||||
// fill bit field with 0
|
// fill bit field with 0
|
||||||
memset(&b_state, 0x00, sizeof(b_state));
|
std::memset(&b_state, 0x00, sizeof(b_state));
|
||||||
|
|
||||||
if ( (button & key_shift) == key_shift )
|
if ( (button & key_shift) == key_shift )
|
||||||
b_state.shift_button = Pressed;
|
b_state.shift_button = Pressed;
|
||||||
|
@ -1253,7 +1251,7 @@ bool FApplication::parseUrxvtMouse()
|
||||||
|
|
||||||
new_mouse_position.setPoint(x,y);
|
new_mouse_position.setPoint(x,y);
|
||||||
// fill bit field with 0
|
// fill bit field with 0
|
||||||
memset(&b_state, 0x00, sizeof(b_state));
|
std::memset(&b_state, 0x00, sizeof(b_state));
|
||||||
|
|
||||||
if ( (button & key_shift) == key_shift )
|
if ( (button & key_shift) == key_shift )
|
||||||
b_state.shift_button = Pressed;
|
b_state.shift_button = Pressed;
|
||||||
|
@ -1292,7 +1290,7 @@ bool FApplication::parseUrxvtMouse()
|
||||||
bool FApplication::processGpmEvent()
|
bool FApplication::processGpmEvent()
|
||||||
{
|
{
|
||||||
// fill bit field with 0
|
// fill bit field with 0
|
||||||
memset(&b_state, 0x00, sizeof(b_state));
|
std::memset(&b_state, 0x00, sizeof(b_state));
|
||||||
|
|
||||||
if ( Gpm_GetEvent(&gpm_ev) == 1 )
|
if ( Gpm_GetEvent(&gpm_ev) == 1 )
|
||||||
{
|
{
|
||||||
|
@ -1786,12 +1784,12 @@ bool FApplication::processNextEvent()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FApplication::print_cmd_Options ()
|
void FApplication::print_cmd_Options ()
|
||||||
{
|
{
|
||||||
::printf("\nFinalCut Options:\n"
|
std::printf ( "\nFinalCut Options:\n"
|
||||||
" --encoding <name> Sets the character encoding mode\n"
|
" --encoding <name> Sets the character encoding mode\n"
|
||||||
" {UTF8, VT100, PC, ASCII}\n"
|
" {UTF8, VT100, PC, ASCII}\n"
|
||||||
" --no-optimized-cursor No cursor optimisation\n"
|
" --no-optimized-cursor No cursor optimisation\n"
|
||||||
" --vgafont Set the standard vga 8x16 font\n"
|
" --vgafont Set the standard vga 8x16 font\n"
|
||||||
" --newfont Enables the graphical font\n");
|
" --newfont Enables the graphical font\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1806,26 +1804,12 @@ void FApplication::setMainWidget (FWidget* widget)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int FApplication::exec() // run
|
int FApplication::exec() // run
|
||||||
{
|
{
|
||||||
FWidget* widget;
|
|
||||||
|
|
||||||
if ( quit_now )
|
if ( quit_now )
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
quit_now = false;
|
quit_now = false;
|
||||||
quit_code = 0;
|
quit_code = 0;
|
||||||
|
|
||||||
// set the cursor to the focus widget
|
|
||||||
widget = getFocusWidget();
|
|
||||||
|
|
||||||
if ( widget
|
|
||||||
&& widget->isVisible()
|
|
||||||
&& widget->hasVisibleCursor() )
|
|
||||||
{
|
|
||||||
widget->setCursor();
|
|
||||||
showCursor();
|
|
||||||
flush_out();
|
|
||||||
}
|
|
||||||
|
|
||||||
enter_loop();
|
enter_loop();
|
||||||
return quit_code;
|
return quit_code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,12 +104,12 @@ void FButton::setHotkeyAccelerator()
|
||||||
|
|
||||||
if ( hotkey )
|
if ( hotkey )
|
||||||
{
|
{
|
||||||
if ( isalpha(hotkey) || isdigit(hotkey) )
|
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
|
||||||
{
|
{
|
||||||
addAccelerator (tolower(hotkey));
|
addAccelerator (std::tolower(hotkey));
|
||||||
addAccelerator (toupper(hotkey));
|
addAccelerator (std::toupper(hotkey));
|
||||||
// Meta + hotkey
|
// Meta + hotkey
|
||||||
addAccelerator (fc::Fmkey_meta + tolower(hotkey));
|
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addAccelerator (getHotkey());
|
addAccelerator (getHotkey());
|
||||||
|
@ -137,7 +137,7 @@ void FButton::draw()
|
||||||
FString txt;
|
FString txt;
|
||||||
FWidget* parent_widget = getParentWidget();
|
FWidget* parent_widget = getParentWidget();
|
||||||
int active_focus;
|
int active_focus;
|
||||||
int d, i, j, x, mono_offset, margin;
|
int d, i, j, x, mono_offset, mono_1st_char, margin;
|
||||||
int length, hotkeypos, hotkey_offset, space;
|
int length, hotkeypos, hotkey_offset, space;
|
||||||
bool is_ActiveFocus, is_Active, is_Focus, is_Flat;
|
bool is_ActiveFocus, is_Active, is_Focus, is_Flat;
|
||||||
bool is_NonFlatShadow, is_NoUnderline;
|
bool is_NonFlatShadow, is_NoUnderline;
|
||||||
|
@ -199,10 +199,14 @@ void FButton::draw()
|
||||||
txt = "<" + txt + ">";
|
txt = "<" + txt + ">";
|
||||||
length = int(txt.getLength());
|
length = int(txt.getLength());
|
||||||
src = const_cast<wchar_t*>(txt.wc_str());
|
src = const_cast<wchar_t*>(txt.wc_str());
|
||||||
|
mono_1st_char = 1;
|
||||||
mono_offset = 2;
|
mono_offset = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
mono_1st_char = 0;
|
||||||
mono_offset = 0;
|
mono_offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
|
@ -292,7 +296,7 @@ void FButton::draw()
|
||||||
i = getWidth() - length - 1;
|
i = getWidth() - length - 1;
|
||||||
i = int(i / 2);
|
i = int(i / 2);
|
||||||
|
|
||||||
if ( getHeight() > 1 )
|
if ( getHeight() >= 2 )
|
||||||
j = int((getHeight()-1) / 2);
|
j = int((getHeight()-1) / 2);
|
||||||
else
|
else
|
||||||
j=0;
|
j=0;
|
||||||
|
@ -304,7 +308,7 @@ void FButton::draw()
|
||||||
print (space); // █
|
print (space); // █
|
||||||
|
|
||||||
if ( hotkeypos == -1 )
|
if ( hotkeypos == -1 )
|
||||||
setCursorPos (1+margin+i, 1+j ); // first character
|
setCursorPos (1+margin+i+mono_1st_char, 1+j ); // first character
|
||||||
else
|
else
|
||||||
setCursorPos (1+margin+i+hotkeypos, 1+j ); // hotkey
|
setCursorPos (1+margin+i+hotkeypos, 1+j ); // hotkey
|
||||||
|
|
||||||
|
@ -345,7 +349,7 @@ void FButton::draw()
|
||||||
for (x=i+length; x < getWidth()-1; x++)
|
for (x=i+length; x < getWidth()-1; x++)
|
||||||
print (space); // █
|
print (space); // █
|
||||||
|
|
||||||
if ( getHeight() > 1 )
|
if ( getHeight() >= 2 )
|
||||||
{
|
{
|
||||||
for (i=0; i < j; i++)
|
for (i=0; i < j; i++)
|
||||||
{
|
{
|
||||||
|
@ -516,7 +520,7 @@ void FButton::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
std::memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < getHeight()+s+(f << 1); y++)
|
for (int y=0; y < getHeight()+s+(f << 1); y++)
|
||||||
|
|
|
@ -73,7 +73,7 @@ bool FButtonGroup::isRadioButton(FToggleButton* button) const
|
||||||
if ( ! button )
|
if ( ! button )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return bool ( strcmp ( button->getClassName()
|
return bool ( std::strcmp ( button->getClassName()
|
||||||
, const_cast<char*>("FRadioButton") ) == 0 );
|
, const_cast<char*>("FRadioButton") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,12 +197,12 @@ void FButtonGroup::setHotkeyAccelerator()
|
||||||
|
|
||||||
if ( hotkey )
|
if ( hotkey )
|
||||||
{
|
{
|
||||||
if ( isalpha(hotkey) || isdigit(hotkey) )
|
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
|
||||||
{
|
{
|
||||||
addAccelerator (tolower(hotkey));
|
addAccelerator (std::tolower(hotkey));
|
||||||
addAccelerator (toupper(hotkey));
|
addAccelerator (std::toupper(hotkey));
|
||||||
// Meta + hotkey
|
// Meta + hotkey
|
||||||
addAccelerator (fc::Fmkey_meta + tolower(hotkey));
|
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addAccelerator (getHotkey());
|
addAccelerator (getHotkey());
|
||||||
|
@ -325,7 +325,7 @@ void FButtonGroup::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
std::memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < getHeight(); y++)
|
for (int y=0; y < getHeight(); y++)
|
||||||
|
|
|
@ -172,7 +172,7 @@ void FDialog::drawBorder()
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
{
|
{
|
||||||
for (int y=y1; y <= y2; y++)
|
for (int y=y1; y < y2; y++)
|
||||||
{
|
{
|
||||||
printPos (x1, y);
|
printPos (x1, y);
|
||||||
// border left ⎸
|
// border left ⎸
|
||||||
|
@ -457,7 +457,6 @@ void FDialog::cb_move (FWidget*, void*)
|
||||||
|
|
||||||
setMoveSizeWidget(this);
|
setMoveSizeWidget(this);
|
||||||
save_geometry = getGeometry();
|
save_geometry = getGeometry();
|
||||||
redraw();
|
|
||||||
tooltip = new FToolTip(this);
|
tooltip = new FToolTip(this);
|
||||||
|
|
||||||
if ( isResizeable() )
|
if ( isResizeable() )
|
||||||
|
@ -571,6 +570,7 @@ void FDialog::draw()
|
||||||
clearArea();
|
clearArea();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
drawTitleBar();
|
drawTitleBar();
|
||||||
|
setCursorPos(2, getHeight() - 1);
|
||||||
|
|
||||||
if ( (flags & fc::shadow) != 0 )
|
if ( (flags & fc::shadow) != 0 )
|
||||||
drawDialogShadow();
|
drawDialogShadow();
|
||||||
|
@ -626,25 +626,21 @@ void FDialog::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
case fc::Fkey_up:
|
case fc::Fkey_up:
|
||||||
move (getX(), getY() - 1);
|
move (getX(), getY() - 1);
|
||||||
redraw();
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_down:
|
case fc::Fkey_down:
|
||||||
move (getX(), getY() + 1);
|
move (getX(), getY() + 1);
|
||||||
redraw();
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_left:
|
case fc::Fkey_left:
|
||||||
move (getX() - 1, getY());
|
move (getX() - 1, getY());
|
||||||
redraw();
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case fc::Fkey_right:
|
case fc::Fkey_right:
|
||||||
move (getX() + 1, getY());
|
move (getX() + 1, getY());
|
||||||
redraw();
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1192,19 +1188,6 @@ void FDialog::show()
|
||||||
|
|
||||||
FWindow::show();
|
FWindow::show();
|
||||||
|
|
||||||
// set the cursor to the focus widget
|
|
||||||
FWidget* focus_widget = FWidget::getFocusWidget();
|
|
||||||
|
|
||||||
if ( focus_widget
|
|
||||||
&& focus_widget->isVisible()
|
|
||||||
&& focus_widget->hasVisibleCursor()
|
|
||||||
&& focus_widget->isCursorInside() )
|
|
||||||
{
|
|
||||||
focus_widget->setCursor();
|
|
||||||
showCursor();
|
|
||||||
flush_out();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isModal() )
|
if ( isModal() )
|
||||||
{
|
{
|
||||||
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
FApplication* fapp = static_cast<FApplication*>(getRootWidget());
|
||||||
|
@ -1254,7 +1237,7 @@ void FDialog::move (int x, int y)
|
||||||
height = getHeight();
|
height = getHeight();
|
||||||
|
|
||||||
// Avoid to move widget completely outside the terminal
|
// Avoid to move widget completely outside the terminal
|
||||||
if ( x+width-1 < 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
|
if ( x+width <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( isZoomed() )
|
if ( isZoomed() )
|
||||||
|
@ -1289,20 +1272,20 @@ void FDialog::move (int x, int y)
|
||||||
if ( dy > 0 )
|
if ( dy > 0 )
|
||||||
restoreVTerm (old_x+width+rsw-dx, old_y, dx, getHeight()+bsh-dy);
|
restoreVTerm (old_x+width+rsw-dx, old_y, dx, getHeight()+bsh-dy);
|
||||||
else
|
else
|
||||||
restoreVTerm (old_x+width+rsw-dx, old_y+abs(dy), dx, height+bsh-abs(dy));
|
restoreVTerm (old_x+width+rsw-dx, old_y+std::abs(dy), dx, height+bsh-std::abs(dy));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( dy > 0 )
|
if ( dy > 0 )
|
||||||
restoreVTerm (old_x, old_y, abs(dx), height+bsh-dy);
|
restoreVTerm (old_x, old_y, std::abs(dx), height+bsh-dy);
|
||||||
else
|
else
|
||||||
restoreVTerm (old_x, old_y+abs(dy), abs(dx), height+bsh-abs(dy));
|
restoreVTerm (old_x, old_y+std::abs(dy), std::abs(dx), height+bsh-std::abs(dy));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( dy > 0 )
|
if ( dy > 0 )
|
||||||
restoreVTerm (old_x, old_y+height+bsh-dy, width+rsw, dy);
|
restoreVTerm (old_x, old_y+height+bsh-dy, width+rsw, dy);
|
||||||
else
|
else
|
||||||
restoreVTerm (old_x, old_y, width+rsw, abs(dy));
|
restoreVTerm (old_x, old_y, width+rsw, std::abs(dy));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1338,9 +1321,7 @@ void FDialog::move (int x, int y)
|
||||||
&& focus_widget->hasVisibleCursor() )
|
&& focus_widget->hasVisibleCursor() )
|
||||||
{
|
{
|
||||||
FPoint cursor_pos = focus_widget->getCursorPos();
|
FPoint cursor_pos = focus_widget->getCursorPos();
|
||||||
|
focus_widget->setCursorPos(cursor_pos);
|
||||||
if ( ! focus_widget->setCursorPos(cursor_pos) )
|
|
||||||
hideCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
|
@ -1416,9 +1397,7 @@ void FDialog::setSize (int w, int h, bool adjust)
|
||||||
&& focus_widget->hasVisibleCursor() )
|
&& focus_widget->hasVisibleCursor() )
|
||||||
{
|
{
|
||||||
FPoint cursor_pos = focus_widget->getCursorPos();
|
FPoint cursor_pos = focus_widget->getCursorPos();
|
||||||
|
focus_widget->setCursorPos(cursor_pos);
|
||||||
if ( ! focus_widget->setCursorPos(cursor_pos) )
|
|
||||||
hideCursor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,10 +218,10 @@ inline bool FFileDialog::pattern_match ( const char* pattern
|
||||||
{
|
{
|
||||||
search[0] = '.';
|
search[0] = '.';
|
||||||
search[1] = '\0';
|
search[1] = '\0';
|
||||||
strncat(search, pattern, sizeof(search) - strlen(search) - 1);
|
std::strncat(search, pattern, sizeof(search) - std::strlen(search) - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strncpy(search, pattern, sizeof(search) - 1);
|
std::strncpy(search, pattern, sizeof(search) - 1);
|
||||||
|
|
||||||
if ( fnmatch (search, fname, FNM_PERIOD) == 0 )
|
if ( fnmatch (search, fname, FNM_PERIOD) == 0 )
|
||||||
return true;
|
return true;
|
||||||
|
@ -243,7 +243,7 @@ void FFileDialog::clear()
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
free ((*iter).name);
|
std::free ((*iter).name);
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ int FFileDialog::numOfDirs()
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
if ( (*iter).type == DT_DIR && strcmp((*iter).name, ".") != 0 )
|
if ( (*iter).type == DT_DIR && std::strcmp((*iter).name, ".") != 0 )
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -313,7 +313,7 @@ int FFileDialog::changeDir (const FString& dirname)
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
if ( strcmp((*iter).name, baseName) == 0 )
|
if ( std::strcmp((*iter).name, baseName) == 0 )
|
||||||
{
|
{
|
||||||
filebrowser->setCurrentItem(i);
|
filebrowser->setCurrentItem(i);
|
||||||
filename->setText(FString(baseName) + '/');
|
filename->setText(FString(baseName) + '/');
|
||||||
|
@ -391,7 +391,7 @@ void FFileDialog::cb_processActivate (FWidget*, void*)
|
||||||
|
|
||||||
while ( iter != end )
|
while ( iter != end )
|
||||||
{
|
{
|
||||||
if ( strcmp((*iter).name, input) == 0 && (*iter).type == DT_DIR )
|
if ( std::strcmp((*iter).name, input) == 0 && (*iter).type == DT_DIR )
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
changeDir(input);
|
changeDir(input);
|
||||||
|
@ -644,7 +644,7 @@ int FFileDialog::readDir()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( dir[0] == '/' && dir[1] == '\0' && strcmp(next->d_name, "..") == 0 )
|
if ( dir[0] == '/' && dir[1] == '\0' && std::strcmp(next->d_name, "..") == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dir_entry entry;
|
dir_entry entry;
|
||||||
|
@ -655,8 +655,8 @@ int FFileDialog::readDir()
|
||||||
{
|
{
|
||||||
char resolved_path[MAXPATHLEN] = {};
|
char resolved_path[MAXPATHLEN] = {};
|
||||||
char symLink[MAXPATHLEN] = {};
|
char symLink[MAXPATHLEN] = {};
|
||||||
strncpy(symLink, dir, sizeof(symLink) - 1);
|
std::strncpy (symLink, dir, sizeof(symLink) - 1);
|
||||||
strncat(symLink, next->d_name, sizeof(symLink) - strlen(symLink) - 1);
|
std::strncat (symLink, next->d_name, sizeof(symLink) - std::strlen(symLink) - 1);
|
||||||
|
|
||||||
if ( realpath(symLink, resolved_path) != 0 ) // follow link
|
if ( realpath(symLink, resolved_path) != 0 ) // follow link
|
||||||
{
|
{
|
||||||
|
@ -675,7 +675,7 @@ int FFileDialog::readDir()
|
||||||
else if ( pattern_match(filter, entry.name) )
|
else if ( pattern_match(filter, entry.name) )
|
||||||
dir_entries.push_back (entry);
|
dir_entries.push_back (entry);
|
||||||
else
|
else
|
||||||
free(entry.name);
|
std::free(entry.name);
|
||||||
}
|
}
|
||||||
else if (errno != 0)
|
else if (errno != 0)
|
||||||
{
|
{
|
||||||
|
@ -695,7 +695,7 @@ int FFileDialog::readDir()
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strcmp((*dir_entries.begin()).name, "..") == 0 )
|
if ( std::strcmp((*dir_entries.begin()).name, "..") == 0 )
|
||||||
start=1;
|
start=1;
|
||||||
else
|
else
|
||||||
start=0;
|
start=0;
|
||||||
|
|
|
@ -130,12 +130,12 @@ void FLabel::setHotkeyAccelerator()
|
||||||
|
|
||||||
if ( hotkey )
|
if ( hotkey )
|
||||||
{
|
{
|
||||||
if ( isalpha(hotkey) || isdigit(hotkey) )
|
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
|
||||||
{
|
{
|
||||||
addAccelerator (tolower(hotkey));
|
addAccelerator (std::tolower(hotkey));
|
||||||
addAccelerator (toupper(hotkey));
|
addAccelerator (std::toupper(hotkey));
|
||||||
// Meta + hotkey
|
// Meta + hotkey
|
||||||
addAccelerator (fc::Fmkey_meta + tolower(hotkey));
|
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addAccelerator (getHotkey());
|
addAccelerator (getHotkey());
|
||||||
|
@ -193,7 +193,7 @@ void FLabel::printLine ( wchar_t*& line
|
||||||
|
|
||||||
for (int z=0; z < to_char; z++)
|
for (int z=0; z < to_char; z++)
|
||||||
{
|
{
|
||||||
if ( ! iswprint(wint_t(line[z])) )
|
if ( ! std::iswprint(wint_t(line[z])) )
|
||||||
{
|
{
|
||||||
if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2
|
if ( ! isNewFont() && ( int(line[z]) < fc::NF_rev_left_arrow2
|
||||||
|| int(line[z]) > fc::NF_check_mark ) )
|
|| int(line[z]) > fc::NF_check_mark ) )
|
||||||
|
@ -266,7 +266,7 @@ void FLabel::draw()
|
||||||
|
|
||||||
hotkeypos = -1;
|
hotkeypos = -1;
|
||||||
|
|
||||||
if ( multiline && getHeight() > 1 )
|
if ( multiline && getHeight() >= 2 )
|
||||||
{
|
{
|
||||||
uInt y = 0;
|
uInt y = 0;
|
||||||
uInt text_lines = uInt(multiline_text.size());
|
uInt text_lines = uInt(multiline_text.size());
|
||||||
|
@ -282,7 +282,7 @@ void FLabel::draw()
|
||||||
if ( ! hotkey_printed )
|
if ( ! hotkey_printed )
|
||||||
hotkeypos = getHotkeyPos(src, dest, length);
|
hotkeypos = getHotkeyPos(src, dest, length);
|
||||||
else
|
else
|
||||||
wcsncpy(dest, src, length);
|
std::wcsncpy(dest, src, length);
|
||||||
|
|
||||||
printPos (1, 1+int(y));
|
printPos (1, 1+int(y));
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ void FLabel::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
std::memset(blank, ' ', uLong(size));
|
||||||
blank[getWidth()] = '\0';
|
blank[getWidth()] = '\0';
|
||||||
printPos (1,1);
|
printPos (1,1);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
|
|
@ -58,9 +58,6 @@ FLineEdit::~FLineEdit() // destructor
|
||||||
if ( isUrxvtTerminal() )
|
if ( isUrxvtTerminal() )
|
||||||
setXTermCursorColor("rgb:ffff/ffff/ffff");
|
setXTermCursorColor("rgb:ffff/ffff/ffff");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasFocus() )
|
|
||||||
hideCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private methods of FLineEdit
|
// private methods of FLineEdit
|
||||||
|
@ -221,15 +218,10 @@ void FLineEdit::drawInputField()
|
||||||
if ( isShadow )
|
if ( isShadow )
|
||||||
drawShadow ();
|
drawShadow ();
|
||||||
|
|
||||||
updateVTerm(true);
|
|
||||||
|
|
||||||
// set the cursor to the first pos.
|
// set the cursor to the first pos.
|
||||||
setCursorPos (2+cursor_pos-text_offset, 1);
|
setCursorPos (2+cursor_pos-text_offset, 1);
|
||||||
|
|
||||||
if ( isCursorInside() && hasFocus() && isHiddenCursor() )
|
updateVTerm(true);
|
||||||
showCursor();
|
|
||||||
else if ( ! isHiddenCursor() )
|
|
||||||
hideCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -313,7 +305,7 @@ void FLineEdit::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
std::memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < getHeight()+s; y++)
|
for (int y=0; y < getHeight()+s; y++)
|
||||||
|
@ -781,17 +773,11 @@ void FLineEdit::onHide (FHideEvent*)
|
||||||
if ( isUrxvtTerminal() )
|
if ( isUrxvtTerminal() )
|
||||||
setXTermCursorColor("rgb:ffff/ffff/ffff");
|
setXTermCursorColor("rgb:ffff/ffff/ffff");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasFocus() )
|
|
||||||
hideCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FLineEdit::onFocusIn (FFocusEvent*)
|
void FLineEdit::onFocusIn (FFocusEvent*)
|
||||||
{
|
{
|
||||||
if ( isCursorInside() )
|
|
||||||
showCursor();
|
|
||||||
|
|
||||||
if ( insert_mode )
|
if ( insert_mode )
|
||||||
{
|
{
|
||||||
setXTermCursorStyle(fc::blinking_underline);
|
setXTermCursorStyle(fc::blinking_underline);
|
||||||
|
@ -835,8 +821,6 @@ void FLineEdit::onFocusOut (FFocusEvent*)
|
||||||
if ( isUrxvtTerminal() )
|
if ( isUrxvtTerminal() )
|
||||||
setXTermCursorColor("rgb:ffff/ffff/ffff");
|
setXTermCursorColor("rgb:ffff/ffff/ffff");
|
||||||
}
|
}
|
||||||
|
|
||||||
hideCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -141,7 +141,7 @@ void FListBox::draw()
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
if ( isNewFont() )
|
if ( isNewFont() )
|
||||||
drawBorder (1, getWidth() - 1, 1, getHeight());
|
drawBorder (1, 1, getWidth() - 1, getHeight());
|
||||||
else
|
else
|
||||||
drawBorder();
|
drawBorder();
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ void FListBox::drawList()
|
||||||
uInt start, end, inc_len;
|
uInt start, end, inc_len;
|
||||||
bool isFocus;
|
bool isFocus;
|
||||||
|
|
||||||
if ( data.empty() || getHeight() < 4 || getWidth() < 5 )
|
if ( data.empty() || getHeight() <= 2 || getWidth() <= 4 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isFocus = ((flags & fc::focus) != 0);
|
isFocus = ((flags & fc::focus) != 0);
|
||||||
|
@ -466,12 +466,6 @@ void FListBox::drawList()
|
||||||
|
|
||||||
unsetBold();
|
unsetBold();
|
||||||
updateVTerm(true);
|
updateVTerm(true);
|
||||||
updateTerminal();
|
|
||||||
flush_out();
|
|
||||||
|
|
||||||
if ( hasFocus() )
|
|
||||||
setCursor();
|
|
||||||
|
|
||||||
last_yoffset = yoffset;
|
last_yoffset = yoffset;
|
||||||
last_current = current;
|
last_current = current;
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,21 +255,21 @@ bool FMenu::isWindowsMenu (FWidget* w) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::isMenuBar (FWidget* w) const
|
bool FMenu::isMenuBar (FWidget* w) const
|
||||||
{
|
{
|
||||||
return bool ( strcmp ( w->getClassName()
|
return bool ( std::strcmp ( w->getClassName()
|
||||||
, const_cast<char*>("FMenuBar") ) == 0 );
|
, const_cast<char*>("FMenuBar") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::isMenu (FWidget* w) const
|
bool FMenu::isMenu (FWidget* w) const
|
||||||
{
|
{
|
||||||
return bool ( strcmp ( w->getClassName()
|
return bool ( std::strcmp ( w->getClassName()
|
||||||
, const_cast<char*>("FMenu") ) == 0 );
|
, const_cast<char*>("FMenu") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FMenu::isRadioMenuItem (FWidget* w) const
|
bool FMenu::isRadioMenuItem (FWidget* w) const
|
||||||
{
|
{
|
||||||
return bool ( strcmp ( w->getClassName()
|
return bool ( std::strcmp ( w->getClassName()
|
||||||
, const_cast<char*>("FRadioMenuItem") ) == 0 );
|
, const_cast<char*>("FRadioMenuItem") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,9 +516,9 @@ bool FMenu::hotkeyMenu (FKeyEvent*& ev)
|
||||||
int hotkey = (*iter)->getHotkey();
|
int hotkey = (*iter)->getHotkey();
|
||||||
int key = ev->key();
|
int key = ev->key();
|
||||||
|
|
||||||
if ( isalpha(hotkey) || isdigit(hotkey) )
|
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
|
||||||
{
|
{
|
||||||
if ( tolower(hotkey) == key || toupper(hotkey) == key )
|
if ( std::tolower(hotkey) == key || std::toupper(hotkey) == key )
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else if ( hotkey == key )
|
else if ( hotkey == key )
|
||||||
|
@ -594,7 +594,7 @@ void FMenu::draw()
|
||||||
clearArea();
|
clearArea();
|
||||||
drawBorder();
|
drawBorder();
|
||||||
drawItems();
|
drawItems();
|
||||||
drawMenuShadow();
|
drawShadow();
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
@ -602,57 +602,6 @@ void FMenu::draw()
|
||||||
updateVTerm(true);
|
updateVTerm(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FMenu::drawBorder()
|
|
||||||
{
|
|
||||||
if ( isNewFont() )
|
|
||||||
{
|
|
||||||
int x1 = 1;
|
|
||||||
int x2 = 1 + getWidth() - 1;
|
|
||||||
int y1 = 1;
|
|
||||||
int y2 = 1 + getHeight() - 1;
|
|
||||||
|
|
||||||
printPos (x1, y1);
|
|
||||||
print (fc::NF_border_corner_upper_left); // ⎡
|
|
||||||
|
|
||||||
for (int x=x1+1; x < x2; x++)
|
|
||||||
print (fc::NF_border_line_upper); // ¯
|
|
||||||
|
|
||||||
print (fc::NF_rev_border_corner_upper_right); // ⎤
|
|
||||||
|
|
||||||
for (int y=y1+1; y <= y2; y++)
|
|
||||||
{
|
|
||||||
printPos (x1, y);
|
|
||||||
// border left ⎸
|
|
||||||
print (fc::NF_border_line_left);
|
|
||||||
printPos (x2, y);
|
|
||||||
// border right⎹
|
|
||||||
print (fc::NF_rev_border_line_right);
|
|
||||||
}
|
|
||||||
|
|
||||||
printPos (x1, y2);
|
|
||||||
// lower left corner border ⎣
|
|
||||||
print (fc::NF_border_corner_lower_left);
|
|
||||||
|
|
||||||
for (int x=1; x < getWidth()-1; x++) // low line _
|
|
||||||
print (fc::NF_border_line_bottom);
|
|
||||||
|
|
||||||
printPos (x2, y2);
|
|
||||||
// lower right corner border ⎦
|
|
||||||
print (fc::NF_rev_border_corner_lower_right);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FWidget::drawBorder();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FMenu::drawMenuShadow()
|
|
||||||
{
|
|
||||||
drawShadow();
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FMenu::drawItems()
|
void FMenu::drawItems()
|
||||||
{
|
{
|
||||||
|
@ -770,13 +719,25 @@ void FMenu::drawItems()
|
||||||
|
|
||||||
if ( hotkeypos == -1 )
|
if ( hotkeypos == -1 )
|
||||||
{
|
{
|
||||||
|
// set cursor to the first character
|
||||||
if ( is_selected )
|
if ( is_selected )
|
||||||
setCursorPos (1, 2 + y); // first character
|
{
|
||||||
|
if ( is_checkable )
|
||||||
|
(*iter)->setCursorPos (3, 1);
|
||||||
|
else
|
||||||
|
(*iter)->setCursorPos (2, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( is_selected )
|
if ( is_selected )
|
||||||
setCursorPos (1 + hotkeypos, 2 + y); // hotkey
|
{
|
||||||
|
// set cursor to the hotkey position
|
||||||
|
if ( is_checkable )
|
||||||
|
(*iter)->setCursorPos (3 + hotkeypos, 1);
|
||||||
|
else
|
||||||
|
(*iter)->setCursorPos (2 + hotkeypos, 1);
|
||||||
|
}
|
||||||
|
|
||||||
txt_length--;
|
txt_length--;
|
||||||
to_char--;
|
to_char--;
|
||||||
|
@ -784,7 +745,7 @@ void FMenu::drawItems()
|
||||||
|
|
||||||
for (int z=0; z < to_char; z++)
|
for (int z=0; z < to_char; z++)
|
||||||
{
|
{
|
||||||
if ( ! iswprint(wint_t(item_text[z])) )
|
if ( ! std::iswprint(wint_t(item_text[z])) )
|
||||||
{
|
{
|
||||||
if ( ! isNewFont()
|
if ( ! isNewFont()
|
||||||
&& ( int(item_text[z]) < fc::NF_rev_left_arrow2
|
&& ( int(item_text[z]) < fc::NF_rev_left_arrow2
|
||||||
|
@ -854,9 +815,6 @@ void FMenu::drawItems()
|
||||||
++iter;
|
++iter;
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasFocus() )
|
|
||||||
setCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1464,19 +1422,6 @@ void FMenu::show()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FWindow::show();
|
FWindow::show();
|
||||||
|
|
||||||
// set the cursor to the focus widget
|
|
||||||
FWidget* focus_widget = FWidget::getFocusWidget();
|
|
||||||
|
|
||||||
if ( focus_widget
|
|
||||||
&& focus_widget->isVisible()
|
|
||||||
&& focus_widget->hasVisibleCursor()
|
|
||||||
&& focus_widget->isCursorInside() )
|
|
||||||
{
|
|
||||||
focus_widget->setCursor();
|
|
||||||
showCursor();
|
|
||||||
flush_out();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -82,10 +82,6 @@ class FMenu : public FWindow, public FMenuList
|
||||||
bool hotkeyMenu (FKeyEvent*&);
|
bool hotkeyMenu (FKeyEvent*&);
|
||||||
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
|
int getHotkeyPos (wchar_t*&, wchar_t*&, uInt);
|
||||||
void draw();
|
void draw();
|
||||||
// make every drawBorder from FWidget available
|
|
||||||
using FWidget::drawBorder;
|
|
||||||
virtual void drawBorder();
|
|
||||||
void drawMenuShadow();
|
|
||||||
void drawItems();
|
void drawItems();
|
||||||
void drawSeparator(int);
|
void drawSeparator(int);
|
||||||
void processActivate();
|
void processActivate();
|
||||||
|
|
|
@ -227,7 +227,7 @@ bool FMenuBar::hotkeyMenu (FKeyEvent*& ev)
|
||||||
int hotkey = (*iter)->getHotkey();
|
int hotkey = (*iter)->getHotkey();
|
||||||
int key = ev->key();
|
int key = ev->key();
|
||||||
|
|
||||||
if ( fc::Fmkey_meta + tolower(hotkey) == key )
|
if ( fc::Fmkey_meta + std::tolower(hotkey) == key )
|
||||||
{
|
{
|
||||||
FMenuItem* sel_item = getSelectedItem();
|
FMenuItem* sel_item = getSelectedItem();
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ void FMenuBar::drawItems()
|
||||||
if ( startpos > screenWidth-z )
|
if ( startpos > screenWidth-z )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( ! iswprint(wint_t(item_text[z])) )
|
if ( ! std::iswprint(wint_t(item_text[z])) )
|
||||||
{
|
{
|
||||||
if ( ! isNewFont() && ( int(item_text[z]) < fc::NF_rev_left_arrow2
|
if ( ! isNewFont() && ( int(item_text[z]) < fc::NF_rev_left_arrow2
|
||||||
|| int(item_text[z]) > fc::NF_check_mark ) )
|
|| int(item_text[z]) > fc::NF_check_mark ) )
|
||||||
|
@ -913,7 +913,7 @@ void FMenuBar::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[screenWidth+1];
|
blank = new char[screenWidth+1];
|
||||||
memset(blank, ' ', uLong(screenWidth));
|
std::memset(blank, ' ', uLong(screenWidth));
|
||||||
blank[screenWidth] = '\0';
|
blank[screenWidth] = '\0';
|
||||||
printPos (1,1);
|
printPos (1,1);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
|
|
@ -199,7 +199,7 @@ void FMenuItem::init (FWidget* parent)
|
||||||
menubar_ptr->calculateDimensions();
|
menubar_ptr->calculateDimensions();
|
||||||
|
|
||||||
if ( hotkey ) // Meta + hotkey
|
if ( hotkey ) // Meta + hotkey
|
||||||
menubar_ptr->addAccelerator (fc::Fmkey_meta + tolower(hotkey), this);
|
menubar_ptr->addAccelerator (fc::Fmkey_meta + std::tolower(hotkey), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->addCallback
|
this->addCallback
|
||||||
|
@ -357,7 +357,7 @@ bool FMenuItem::isMenuBar (FWidget* w) const
|
||||||
if ( ! w )
|
if ( ! w )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return bool( strcmp ( w->getClassName()
|
return bool( std::strcmp ( w->getClassName()
|
||||||
, const_cast<char*>("FMenuBar") ) == 0 );
|
, const_cast<char*>("FMenuBar") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,9 +367,9 @@ bool FMenuItem::isMenu (FWidget* w) const
|
||||||
if ( ! w )
|
if ( ! w )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool m1 = ( strcmp ( w->getClassName()
|
bool m1 = ( std::strcmp ( w->getClassName()
|
||||||
, const_cast<char*>("FMenu") ) == 0 );
|
, const_cast<char*>("FMenu") ) == 0 );
|
||||||
bool m2 = ( strcmp ( w->getClassName()
|
bool m2 = ( std::strcmp ( w->getClassName()
|
||||||
, const_cast<char*>("FDialogListMenu") ) == 0 );
|
, const_cast<char*>("FDialogListMenu") ) == 0 );
|
||||||
return bool( m1 || m2 );
|
return bool( m1 || m2 );
|
||||||
}
|
}
|
||||||
|
@ -752,7 +752,7 @@ bool FMenuItem::setEnable (bool on)
|
||||||
if ( super && isMenuBar(super) )
|
if ( super && isMenuBar(super) )
|
||||||
{
|
{
|
||||||
// Meta + hotkey
|
// Meta + hotkey
|
||||||
super->addAccelerator (fc::Fmkey_meta + tolower(hotkey), this);
|
super->addAccelerator (fc::Fmkey_meta + std::tolower(hotkey), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Provides: class FOptiAttr
|
// Provides: class FOptiAttr
|
||||||
|
|
||||||
#include "foptiattr.h"
|
#include "foptiattr.h"
|
||||||
#include "string.h"
|
#include <cstring>
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class FOptiAttr
|
// class FOptiAttr
|
||||||
|
@ -228,7 +228,7 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
|
||||||
char* sgr_49;
|
char* sgr_49;
|
||||||
char* op = F_orig_pair.cap;
|
char* op = F_orig_pair.cap;
|
||||||
|
|
||||||
if ( op && strncmp (op, CSI "39;49;25m", 11) == 0 )
|
if ( op && std::strncmp (op, CSI "39;49;25m", 11) == 0 )
|
||||||
sgr_49 = const_cast<char*>(CSI "49;25m");
|
sgr_49 = const_cast<char*>(CSI "49;25m");
|
||||||
else
|
else
|
||||||
sgr_49 = const_cast<char*>(CSI "49m");
|
sgr_49 = const_cast<char*>(CSI "49m");
|
||||||
|
@ -377,19 +377,19 @@ bool FOptiAttr::caused_reset_attributes (char*& cap, uChar test)
|
||||||
|
|
||||||
if ( cap )
|
if ( cap )
|
||||||
{
|
{
|
||||||
if ( (test & test_ansi_reset) && strncmp (cap, CSI "m", 3) == 0 )
|
if ( (test & test_ansi_reset) && std::strncmp (cap, CSI "m", 3) == 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( (test & test_adm3_reset) && strncmp (cap, ESC "G0", 3) == 0 )
|
if ( (test & test_adm3_reset) && std::strncmp (cap, ESC "G0", 3) == 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( (test & same_like_ue) && ue && strcmp (cap, ue) == 0 )
|
if ( (test & same_like_ue) && ue && std::strcmp (cap, ue) == 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( (test & same_like_se) && se && strcmp (cap, se) == 0 )
|
if ( (test & same_like_se) && se && std::strcmp (cap, se) == 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( (test & same_like_me) && me && strcmp (cap, me) == 0 )
|
if ( (test & same_like_me) && me && std::strcmp (cap, me) == 0 )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ inline bool FOptiAttr::append_sequence (char*& seq)
|
||||||
{
|
{
|
||||||
if ( seq )
|
if ( seq )
|
||||||
{
|
{
|
||||||
strncat (attr_ptr, seq, sizeof(attr_buf) - strlen(attr_ptr) - 1 );
|
std::strncat (attr_ptr, seq, sizeof(attr_buf) - std::strlen(attr_ptr) - 1 );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -469,7 +469,7 @@ inline bool FOptiAttr::replace_sequence (char*& seq)
|
||||||
{
|
{
|
||||||
if ( seq )
|
if ( seq )
|
||||||
{
|
{
|
||||||
strncpy (attr_ptr, seq, sizeof(attr_buf) - 1);
|
std::strncpy (attr_ptr, seq, sizeof(attr_buf) - 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -479,7 +479,7 @@ inline bool FOptiAttr::replace_sequence (char*& seq)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FOptiAttr::setTermBold (char_data*& term)
|
inline bool FOptiAttr::setTermBold (char_data*& term)
|
||||||
{
|
{
|
||||||
if ( append_sequence(F_enter_bold_mode.cap) )
|
if ( term && append_sequence(F_enter_bold_mode.cap) )
|
||||||
return (term->bold = true);
|
return (term->bold = true);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -562,7 +562,7 @@ inline bool FOptiAttr::unsetTermItalic (char_data*& term)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline bool FOptiAttr::setTermUnderline (char_data*& term)
|
inline bool FOptiAttr::setTermUnderline (char_data*& term)
|
||||||
{
|
{
|
||||||
if ( append_sequence(F_enter_underline_mode.cap) )
|
if ( term && append_sequence(F_enter_underline_mode.cap) )
|
||||||
return (term->underline = true);
|
return (term->underline = true);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
@ -1530,7 +1530,7 @@ char* FOptiAttr::change_attribute (char_data*& term, char_data*& next)
|
||||||
setTermDoubleUnderline(term);
|
setTermDoubleUnderline(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fake_reverse )
|
if ( term && fake_reverse )
|
||||||
term->reverse = true;
|
term->reverse = true;
|
||||||
|
|
||||||
return attr_buf;
|
return attr_buf;
|
||||||
|
|
|
@ -77,17 +77,17 @@ int FOptiMove::capDuration (char*& cap, int affcnt)
|
||||||
for (p=cap; *p; p++)
|
for (p=cap; *p; p++)
|
||||||
{
|
{
|
||||||
// check for delay with padding character
|
// check for delay with padding character
|
||||||
if ( p[0] == '$' && p[1] == '<' && strchr(p, '>') )
|
if ( p[0] == '$' && p[1] == '<' && std::strchr(p, '>') )
|
||||||
{
|
{
|
||||||
float num=0;
|
float num=0;
|
||||||
|
|
||||||
for (p += 2; *p != '>'; p++)
|
for (p += 2; *p != '>'; p++)
|
||||||
{
|
{
|
||||||
if ( isdigit(uChar(*p)) )
|
if ( std::isdigit(uChar(*p)) )
|
||||||
num = num * 10 + float(*p - '0');
|
num = num * 10 + float(*p - '0');
|
||||||
else if ( *p == '*' )
|
else if ( *p == '*' )
|
||||||
num *= float(affcnt);
|
num *= float(affcnt);
|
||||||
else if ( *p == '.' && *++p != '>' && isdigit(uChar(*p)) )
|
else if ( *p == '.' && *++p != '>' && std::isdigit(uChar(*p)) )
|
||||||
num += float((*p - '0') / 10.0);
|
num += float((*p - '0') / 10.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ void FOptiMove::set_cursor_home (char*& cap)
|
||||||
{
|
{
|
||||||
F_cursor_home.cap = cap;
|
F_cursor_home.cap = cap;
|
||||||
F_cursor_home.duration = capDuration (cap, 0);
|
F_cursor_home.duration = capDuration (cap, 0);
|
||||||
F_cursor_home.length = int(strlen(cap));
|
F_cursor_home.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ void FOptiMove::set_cursor_to_ll (char*& cap)
|
||||||
{
|
{
|
||||||
F_cursor_to_ll.cap = cap;
|
F_cursor_to_ll.cap = cap;
|
||||||
F_cursor_to_ll.duration = capDuration (cap, 0);
|
F_cursor_to_ll.duration = capDuration (cap, 0);
|
||||||
F_cursor_to_ll.length = int(strlen(cap));
|
F_cursor_to_ll.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ void FOptiMove::set_carriage_return (char*& cap)
|
||||||
{
|
{
|
||||||
F_carriage_return.cap = cap;
|
F_carriage_return.cap = cap;
|
||||||
F_carriage_return.duration = capDuration (cap, 0);
|
F_carriage_return.duration = capDuration (cap, 0);
|
||||||
F_carriage_return.length = int(strlen(cap));
|
F_carriage_return.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ void FOptiMove::set_tabular (char*& cap)
|
||||||
{
|
{
|
||||||
F_tab.cap = cap;
|
F_tab.cap = cap;
|
||||||
F_tab.duration = capDuration (cap, 0);
|
F_tab.duration = capDuration (cap, 0);
|
||||||
F_tab.length = int(strlen(cap));
|
F_tab.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ void FOptiMove::set_back_tab (char*& cap)
|
||||||
{
|
{
|
||||||
F_back_tab.cap = cap;
|
F_back_tab.cap = cap;
|
||||||
F_back_tab.duration = capDuration (cap, 0);
|
F_back_tab.duration = capDuration (cap, 0);
|
||||||
F_back_tab.length = int(strlen(cap));
|
F_back_tab.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ void FOptiMove::set_cursor_up (char*& cap)
|
||||||
{
|
{
|
||||||
F_cursor_up.cap = cap;
|
F_cursor_up.cap = cap;
|
||||||
F_cursor_up.duration = capDuration (cap, 0);
|
F_cursor_up.duration = capDuration (cap, 0);
|
||||||
F_cursor_up.length = int(strlen(cap));
|
F_cursor_up.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void FOptiMove::set_cursor_down (char*& cap)
|
||||||
{
|
{
|
||||||
F_cursor_down.cap = cap;
|
F_cursor_down.cap = cap;
|
||||||
F_cursor_down.duration = capDuration (cap, 0);
|
F_cursor_down.duration = capDuration (cap, 0);
|
||||||
F_cursor_down.length = int(strlen(cap));
|
F_cursor_down.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void FOptiMove::set_cursor_left (char*& cap)
|
||||||
{
|
{
|
||||||
F_cursor_left.cap = cap;
|
F_cursor_left.cap = cap;
|
||||||
F_cursor_left.duration = capDuration (cap, 0);
|
F_cursor_left.duration = capDuration (cap, 0);
|
||||||
F_cursor_left.length = int(strlen(cap));
|
F_cursor_left.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ void FOptiMove::set_cursor_right (char*& cap)
|
||||||
{
|
{
|
||||||
F_cursor_right.cap = cap;
|
F_cursor_right.cap = cap;
|
||||||
F_cursor_right.duration = capDuration (cap, 0);
|
F_cursor_right.duration = capDuration (cap, 0);
|
||||||
F_cursor_right.length = int(strlen(cap));
|
F_cursor_right.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ void FOptiMove::set_cursor_address (char*& cap)
|
||||||
char* temp = tgoto(cap, 23, 23);
|
char* temp = tgoto(cap, 23, 23);
|
||||||
F_cursor_address.cap = cap;
|
F_cursor_address.cap = cap;
|
||||||
F_cursor_address.duration = capDuration (temp, 1);
|
F_cursor_address.duration = capDuration (temp, 1);
|
||||||
F_cursor_address.length = int(strlen(cap));
|
F_cursor_address.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ void FOptiMove::set_column_address (char*& cap)
|
||||||
char* temp = tparm(cap, 23);
|
char* temp = tparm(cap, 23);
|
||||||
F_column_address.cap = cap;
|
F_column_address.cap = cap;
|
||||||
F_column_address.duration = capDuration (temp, 1);
|
F_column_address.duration = capDuration (temp, 1);
|
||||||
F_column_address.length = int(strlen(cap));
|
F_column_address.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ void FOptiMove::set_row_address (char*& cap)
|
||||||
char* temp = tparm(cap, 23);
|
char* temp = tparm(cap, 23);
|
||||||
F_row_address.cap = cap;
|
F_row_address.cap = cap;
|
||||||
F_row_address.duration = capDuration (temp, 1);
|
F_row_address.duration = capDuration (temp, 1);
|
||||||
F_row_address.length = int(strlen(cap));
|
F_row_address.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ void FOptiMove::set_parm_up_cursor (char*& cap)
|
||||||
char* temp = tparm(cap, 23);
|
char* temp = tparm(cap, 23);
|
||||||
F_parm_up_cursor.cap = cap;
|
F_parm_up_cursor.cap = cap;
|
||||||
F_parm_up_cursor.duration = capDuration (temp, 1);
|
F_parm_up_cursor.duration = capDuration (temp, 1);
|
||||||
F_parm_up_cursor.length = int(strlen(cap));
|
F_parm_up_cursor.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void FOptiMove::set_parm_down_cursor (char*& cap)
|
||||||
char* temp = tparm(cap, 23);
|
char* temp = tparm(cap, 23);
|
||||||
F_parm_down_cursor.cap = cap;
|
F_parm_down_cursor.cap = cap;
|
||||||
F_parm_down_cursor.duration = capDuration (temp, 1);
|
F_parm_down_cursor.duration = capDuration (temp, 1);
|
||||||
F_parm_down_cursor.length = int(strlen(cap));
|
F_parm_down_cursor.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void FOptiMove::set_parm_left_cursor (char*& cap)
|
||||||
char* temp = tparm(cap, 23);
|
char* temp = tparm(cap, 23);
|
||||||
F_parm_left_cursor.cap = cap;
|
F_parm_left_cursor.cap = cap;
|
||||||
F_parm_left_cursor.duration = capDuration (temp, 1);
|
F_parm_left_cursor.duration = capDuration (temp, 1);
|
||||||
F_parm_left_cursor.length = int(strlen(cap));
|
F_parm_left_cursor.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ void FOptiMove::set_parm_right_cursor (char*& cap)
|
||||||
char* temp = tparm(cap, 23);
|
char* temp = tparm(cap, 23);
|
||||||
F_parm_right_cursor.cap = cap;
|
F_parm_right_cursor.cap = cap;
|
||||||
F_parm_right_cursor.duration = capDuration (temp, 1);
|
F_parm_right_cursor.duration = capDuration (temp, 1);
|
||||||
F_parm_right_cursor.length = int(strlen(cap));
|
F_parm_right_cursor.length = int(std::strlen(cap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,8 +320,8 @@ int FOptiMove::repeatedAppend (capability& o, int count, char* dst)
|
||||||
register size_t dst_len;
|
register size_t dst_len;
|
||||||
register int total;
|
register int total;
|
||||||
|
|
||||||
src_len = strlen(o.cap);
|
src_len = std::strlen(o.cap);
|
||||||
dst_len = ( dst != 0 ) ? strlen(dst) : 0;
|
dst_len = ( dst != 0 ) ? std::strlen(dst) : 0;
|
||||||
total = 0;
|
total = 0;
|
||||||
|
|
||||||
if ( (dst_len + uInt(count) * src_len) < sizeof(move_buf)-1 )
|
if ( (dst_len + uInt(count) * src_len) < sizeof(move_buf)-1 )
|
||||||
|
@ -334,7 +334,7 @@ int FOptiMove::repeatedAppend (capability& o, int count, char* dst)
|
||||||
|
|
||||||
while ( count-- > 0 )
|
while ( count-- > 0 )
|
||||||
{
|
{
|
||||||
strcpy (dst, o.cap);
|
std::strcpy (dst, o.cap);
|
||||||
dst += src_len;
|
dst += src_len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
if ( F_row_address.cap )
|
if ( F_row_address.cap )
|
||||||
{
|
{
|
||||||
if ( move )
|
if ( move )
|
||||||
strcpy (move, tparm(F_row_address.cap, to_y));
|
std::strcpy (move, tparm(F_row_address.cap, to_y));
|
||||||
|
|
||||||
vtime = F_row_address.duration;
|
vtime = F_row_address.duration;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
if ( F_parm_down_cursor.cap && F_parm_down_cursor.duration < vtime )
|
if ( F_parm_down_cursor.cap && F_parm_down_cursor.duration < vtime )
|
||||||
{
|
{
|
||||||
if ( move )
|
if ( move )
|
||||||
strcpy (move, tparm(F_parm_down_cursor.cap, num));
|
std::strcpy (move, tparm(F_parm_down_cursor.cap, num));
|
||||||
|
|
||||||
vtime = F_parm_down_cursor.duration;
|
vtime = F_parm_down_cursor.duration;
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
if ( F_parm_up_cursor.cap && F_parm_up_cursor.duration < vtime )
|
if ( F_parm_up_cursor.cap && F_parm_up_cursor.duration < vtime )
|
||||||
{
|
{
|
||||||
if ( move )
|
if ( move )
|
||||||
strcpy (move, tparm(F_parm_up_cursor.cap, num));
|
std::strcpy (move, tparm(F_parm_up_cursor.cap, num));
|
||||||
|
|
||||||
vtime = F_parm_up_cursor.duration;
|
vtime = F_parm_up_cursor.duration;
|
||||||
}
|
}
|
||||||
|
@ -422,9 +422,9 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
|
|
||||||
if ( F_column_address.cap )
|
if ( F_column_address.cap )
|
||||||
{
|
{
|
||||||
strncat ( hmove
|
std::strncat ( hmove
|
||||||
, tparm(F_column_address.cap, to_x)
|
, tparm(F_column_address.cap, to_x)
|
||||||
, sizeof(hmove) - strlen(hmove) - 1 );
|
, sizeof(hmove) - std::strlen(hmove) - 1 );
|
||||||
htime = F_column_address.duration;
|
htime = F_column_address.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,9 +434,9 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
|
|
||||||
if ( F_parm_right_cursor.cap && F_parm_right_cursor.duration < htime )
|
if ( F_parm_right_cursor.cap && F_parm_right_cursor.duration < htime )
|
||||||
{
|
{
|
||||||
strncat ( hmove
|
std::strncat ( hmove
|
||||||
, tparm(F_parm_right_cursor.cap, num)
|
, tparm(F_parm_right_cursor.cap, num)
|
||||||
, sizeof(hmove) - strlen(hmove) - 1 );
|
, sizeof(hmove) - std::strlen(hmove) - 1 );
|
||||||
htime = F_parm_right_cursor.duration;
|
htime = F_parm_right_cursor.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
|
|
||||||
if ( htime_r < htime )
|
if ( htime_r < htime )
|
||||||
{
|
{
|
||||||
strcpy (hmove, str);
|
std::strcpy (hmove, str);
|
||||||
htime = htime_r;
|
htime = htime_r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,9 +484,9 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
|
|
||||||
if ( F_parm_left_cursor.cap && F_parm_left_cursor.duration < htime )
|
if ( F_parm_left_cursor.cap && F_parm_left_cursor.duration < htime )
|
||||||
{
|
{
|
||||||
strncat ( hmove
|
std::strncat ( hmove
|
||||||
, tparm(F_parm_left_cursor.cap, num)
|
, tparm(F_parm_left_cursor.cap, num)
|
||||||
, sizeof(hmove) - strlen(hmove) - 1 );
|
, sizeof(hmove) - std::strlen(hmove) - 1 );
|
||||||
htime = F_parm_left_cursor.duration;
|
htime = F_parm_left_cursor.duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
|
|
||||||
if ( htime_l < htime )
|
if ( htime_l < htime )
|
||||||
{
|
{
|
||||||
strcpy (hmove, str);
|
std::strcpy (hmove, str);
|
||||||
htime = htime_l;
|
htime = htime_l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +537,7 @@ int FOptiMove::relativeMove ( char*& move
|
||||||
if ( *move )
|
if ( *move )
|
||||||
strcat (move, hmove);
|
strcat (move, hmove);
|
||||||
else
|
else
|
||||||
strcpy (move, hmove);
|
std::strcpy (move, hmove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ inline bool FOptiMove::isWideMove ( int xold, int yold
|
||||||
{
|
{
|
||||||
return bool ( (xnew > MOVE_LIMIT)
|
return bool ( (xnew > MOVE_LIMIT)
|
||||||
&& (xnew < screen_width - 1 - MOVE_LIMIT)
|
&& (xnew < screen_width - 1 - MOVE_LIMIT)
|
||||||
&& (abs(xnew-xold) + abs(ynew-yold) > MOVE_LIMIT) );
|
&& (std::abs(xnew-xold) + std::abs(ynew-yold) > MOVE_LIMIT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -577,7 +577,7 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
||||||
if ( move_xy )
|
if ( move_xy )
|
||||||
{
|
{
|
||||||
method = 0;
|
method = 0;
|
||||||
strncpy (move_ptr, move_xy, sizeof(move_buf) - 1);
|
std::strncpy (move_ptr, move_xy, sizeof(move_buf) - 1);
|
||||||
move_time = F_cursor_address.duration;
|
move_time = F_cursor_address.duration;
|
||||||
|
|
||||||
if ( xold < 0
|
if ( xold < 0
|
||||||
|
@ -670,20 +670,20 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
||||||
case 2:
|
case 2:
|
||||||
if ( F_carriage_return.cap )
|
if ( F_carriage_return.cap )
|
||||||
{
|
{
|
||||||
strncpy (move_ptr, F_carriage_return.cap, sizeof(move_buf) - 1);
|
std::strncpy (move_ptr, F_carriage_return.cap, sizeof(move_buf) - 1);
|
||||||
move_ptr += F_carriage_return.length;
|
move_ptr += F_carriage_return.length;
|
||||||
relativeMove (move_ptr, 0, yold, xnew, ynew);
|
relativeMove (move_ptr, 0, yold, xnew, ynew);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
strncpy (move_ptr, F_cursor_home.cap, sizeof(move_buf) - 1);
|
std::strncpy (move_ptr, F_cursor_home.cap, sizeof(move_buf) - 1);
|
||||||
move_ptr += F_cursor_home.length;
|
move_ptr += F_cursor_home.length;
|
||||||
relativeMove (move_ptr, 0, 0, xnew, ynew);
|
relativeMove (move_ptr, 0, 0, xnew, ynew);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
strncpy (move_ptr, F_cursor_to_ll.cap, sizeof(move_buf) - 1);
|
std::strncpy (move_ptr, F_cursor_to_ll.cap, sizeof(move_buf) - 1);
|
||||||
move_ptr += F_cursor_to_ll.length;
|
move_ptr += F_cursor_to_ll.length;
|
||||||
relativeMove (move_ptr, 0, screen_height-1, xnew, ynew);
|
relativeMove (move_ptr, 0, screen_height-1, xnew, ynew);
|
||||||
break;
|
break;
|
||||||
|
@ -692,14 +692,14 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
||||||
move_buf[0] = '\0';
|
move_buf[0] = '\0';
|
||||||
|
|
||||||
if ( xold >= 0 )
|
if ( xold >= 0 )
|
||||||
strncat ( move_ptr
|
std::strncat ( move_ptr
|
||||||
, F_carriage_return.cap
|
, F_carriage_return.cap
|
||||||
, sizeof(move_buf) - strlen(move_ptr) - 1 );
|
, sizeof(move_buf) - std::strlen(move_ptr) - 1 );
|
||||||
|
|
||||||
strncat ( move_ptr
|
std::strncat ( move_ptr
|
||||||
, F_cursor_left.cap
|
, F_cursor_left.cap
|
||||||
, sizeof(move_buf) - strlen(move_ptr) - 1 );
|
, sizeof(move_buf) - std::strlen(move_ptr) - 1 );
|
||||||
move_ptr += strlen(move_buf);
|
move_ptr += std::strlen(move_buf);
|
||||||
relativeMove (move_ptr, screen_width-1, yold-1, xnew, ynew);
|
relativeMove (move_ptr, screen_width-1, yold-1, xnew, ynew);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -717,22 +717,22 @@ char* FOptiMove::cursor_move (int xold, int yold, int xnew, int ynew)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FOptiMove::printDurations()
|
void FOptiMove::printDurations()
|
||||||
{
|
{
|
||||||
::printf (" speed: %d baud\n", baudrate);
|
std::printf (" speed: %d baud\n", baudrate);
|
||||||
::printf (" char_duration: %d ms\n", char_duration);
|
std::printf (" char_duration: %d ms\n", char_duration);
|
||||||
::printf (" cursor_home: %d ms\n", F_cursor_home.duration);
|
std::printf (" cursor_home: %d ms\n", F_cursor_home.duration);
|
||||||
::printf (" cursor_to_ll: %d ms\n", F_cursor_to_ll.duration);
|
std::printf (" cursor_to_ll: %d ms\n", F_cursor_to_ll.duration);
|
||||||
::printf (" carriage_return: %d ms\n", F_carriage_return.duration);
|
std::printf (" carriage_return: %d ms\n", F_carriage_return.duration);
|
||||||
::printf (" tab: %d ms\n", F_tab.duration);
|
std::printf (" tab: %d ms\n", F_tab.duration);
|
||||||
::printf (" back_tab: %d ms\n", F_back_tab.duration);
|
std::printf (" back_tab: %d ms\n", F_back_tab.duration);
|
||||||
::printf (" cursor_up: %d ms\n", F_cursor_up.duration);
|
std::printf (" cursor_up: %d ms\n", F_cursor_up.duration);
|
||||||
::printf (" cursor_down: %d ms\n", F_cursor_down.duration);
|
std::printf (" cursor_down: %d ms\n", F_cursor_down.duration);
|
||||||
::printf (" cursor_left: %d ms\n", F_cursor_left.duration);
|
std::printf (" cursor_left: %d ms\n", F_cursor_left.duration);
|
||||||
::printf (" cursor_right: %d ms\n", F_cursor_right.duration);
|
std::printf (" cursor_right: %d ms\n", F_cursor_right.duration);
|
||||||
::printf (" cursor_address: %d ms\n", F_cursor_address.duration);
|
std::printf (" cursor_address: %d ms\n", F_cursor_address.duration);
|
||||||
::printf (" column_address: %d ms\n", F_column_address.duration);
|
std::printf (" column_address: %d ms\n", F_column_address.duration);
|
||||||
::printf (" row_address: %d ms\n", F_row_address.duration);
|
std::printf (" row_address: %d ms\n", F_row_address.duration);
|
||||||
::printf (" parm_up_cursor: %d ms\n", F_parm_up_cursor.duration);
|
std::printf (" parm_up_cursor: %d ms\n", F_parm_up_cursor.duration);
|
||||||
::printf (" parm_down_cursor: %d ms\n", F_parm_down_cursor.duration);
|
std::printf (" parm_down_cursor: %d ms\n", F_parm_down_cursor.duration);
|
||||||
::printf (" parm_left_cursor: %d ms\n", F_parm_left_cursor.duration);
|
std::printf (" parm_left_cursor: %d ms\n", F_parm_left_cursor.duration);
|
||||||
::printf ("parm_right_cursor: %d ms\n", F_parm_right_cursor.duration);
|
std::printf ("parm_right_cursor: %d ms\n", F_parm_right_cursor.duration);
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ void FProgressbar::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
std::memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < getHeight()+s; y++)
|
for (int y=0; y < getHeight()+s; y++)
|
||||||
|
|
|
@ -160,11 +160,11 @@ inline FPoint FRect::getLowerRightPos() const
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FRect::getWidth() const
|
inline int FRect::getWidth() const
|
||||||
{ return X2 - X1 + 1; }
|
{ return short(X2 - X1 + 1); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline int FRect::getHeight() const
|
inline int FRect::getHeight() const
|
||||||
{ return Y2 - Y1 + 1; }
|
{ return short(Y2 - Y1 + 1); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline short& FRect::x1_ref()
|
inline short& FRect::x1_ref()
|
||||||
|
|
|
@ -73,7 +73,7 @@ void FStatusKey::init (FWidget* parent)
|
||||||
{
|
{
|
||||||
setGeometry (1,1,1,1);
|
setGeometry (1,1,1,1);
|
||||||
|
|
||||||
if ( parent && strcmp ( parent->getClassName()
|
if ( parent && std::strcmp ( parent->getClassName()
|
||||||
, const_cast<char*>("FStatusBar") ) == 0 )
|
, const_cast<char*>("FStatusBar") ) == 0 )
|
||||||
{
|
{
|
||||||
setStatusbar( static_cast<FStatusBar*>(parent) );
|
setStatusbar( static_cast<FStatusBar*>(parent) );
|
||||||
|
@ -359,7 +359,7 @@ void FStatusBar::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[screenWidth+1];
|
blank = new char[screenWidth+1];
|
||||||
memset(blank, ' ', uLong(screenWidth));
|
std::memset(blank, ' ', uLong(screenWidth));
|
||||||
blank[screenWidth] = '\0';
|
blank[screenWidth] = '\0';
|
||||||
printPos (1, 1);
|
printPos (1, 1);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -733,7 +733,4 @@ void FStatusBar::cb_statuskey_activated (FWidget* widget, void*)
|
||||||
|
|
||||||
if ( isVisible() && isShown() )
|
if ( isVisible() && isShown() )
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
if ( ! isHiddenCursor() )
|
|
||||||
hideCursor();
|
|
||||||
}
|
}
|
||||||
|
|
130
src/fstring.cpp
130
src/fstring.cpp
|
@ -222,7 +222,7 @@ inline void FString::initLength (uInt len)
|
||||||
length = len;
|
length = len;
|
||||||
bufsize = FWDBUFFER + len + 1;
|
bufsize = FWDBUFFER + len + 1;
|
||||||
string = new wchar_t[bufsize]();
|
string = new wchar_t[bufsize]();
|
||||||
wmemset(string, L'\0', bufsize);
|
std::wmemset (string, L'\0', bufsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ inline void FString::_replace (const wchar_t* s)
|
||||||
if ( string )
|
if ( string )
|
||||||
delete[](string);
|
delete[](string);
|
||||||
|
|
||||||
length = uInt(wcslen(s));
|
length = uInt(std::wcslen(s));
|
||||||
bufsize = FWDBUFFER + length + 1;
|
bufsize = FWDBUFFER + length + 1;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -250,7 +250,7 @@ inline void FString::_replace (const wchar_t* s)
|
||||||
<< e.what() << std::endl;
|
<< e.what() << std::endl;
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
wcscpy (string, s);
|
std::wcscpy (string, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -272,7 +272,7 @@ inline void FString::_insert (uInt pos, uInt len, const wchar_t* s)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscpy (string, s);
|
std::wcscpy (string, s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -392,18 +392,18 @@ inline char* FString::wc_to_c_str (const wchar_t* s) const
|
||||||
if ( c_string )
|
if ( c_string )
|
||||||
delete[](c_string);
|
delete[](c_string);
|
||||||
|
|
||||||
size = int(wcslen(s)) + 1;
|
size = int(std::wcslen(s)) + 1;
|
||||||
dest_size = size * int(CHAR_SIZE);
|
dest_size = size * int(CHAR_SIZE);
|
||||||
src = s;
|
src = s;
|
||||||
mbstate_t state;
|
std::mbstate_t state;
|
||||||
memset (&state, '\0', sizeof(mbstate_t));
|
std::memset (&state, '\0', sizeof(mbstate_t));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
c_string = new char[dest_size]();
|
c_string = new char[dest_size]();
|
||||||
|
|
||||||
// pre-initialiaze the whole string with '\0'
|
// pre-initialiaze the whole string with '\0'
|
||||||
memset (c_string, '\0', size_t(dest_size));
|
std::memset (c_string, '\0', size_t(dest_size));
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +411,7 @@ inline char* FString::wc_to_c_str (const wchar_t* s) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mblength = int(wcsrtombs (c_string, &src, uLong(dest_size), &state));
|
mblength = int(std::wcsrtombs (c_string, &src, uLong(dest_size), &state));
|
||||||
|
|
||||||
if ( mblength == -1 && errno != EILSEQ )
|
if ( mblength == -1 && errno != EILSEQ )
|
||||||
{
|
{
|
||||||
|
@ -447,17 +447,17 @@ inline wchar_t* FString::c_to_wc_str (const char* s) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size = int(strlen(s)) + 1;
|
size = int(std::strlen(s)) + 1;
|
||||||
dest_size = size * int(CHAR_SIZE);
|
dest_size = size * int(CHAR_SIZE);
|
||||||
src = s;
|
src = s;
|
||||||
mbstate_t state;
|
std::mbstate_t state;
|
||||||
memset (&state, '\0', sizeof(mbstate_t));
|
std::memset (&state, '\0', sizeof(mbstate_t));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dest = new wchar_t[size]();
|
dest = new wchar_t[size]();
|
||||||
// pre-initialiaze the whole string with '\0'
|
// pre-initialiaze the whole string with '\0'
|
||||||
wmemset (dest, L'\0', size_t(size));
|
std::wmemset (dest, L'\0', size_t(size));
|
||||||
}
|
}
|
||||||
catch (const std::bad_alloc& ex)
|
catch (const std::bad_alloc& ex)
|
||||||
{
|
{
|
||||||
|
@ -465,7 +465,7 @@ inline wchar_t* FString::c_to_wc_str (const char* s) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wclength = int(mbsrtowcs (dest, &src, uLong(dest_size), &state));
|
wclength = int(std::mbsrtowcs (dest, &src, uLong(dest_size), &state));
|
||||||
|
|
||||||
if ( wclength == -1 )
|
if ( wclength == -1 )
|
||||||
{
|
{
|
||||||
|
@ -501,12 +501,12 @@ inline wchar_t* FString::extractToken ( wchar_t** rest
|
||||||
if ( ! *token )
|
if ( ! *token )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*rest = wcspbrk(token, delim);
|
*rest = std::wcspbrk(token, delim);
|
||||||
|
|
||||||
if ( *rest )
|
if ( *rest )
|
||||||
*(*rest)++ = '\0';
|
*(*rest)++ = '\0';
|
||||||
else
|
else
|
||||||
*rest = token + wcslen(token);
|
*rest = token + std::wcslen(token);
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ const FString& FString::operator += (const std::wstring& s)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString& FString::operator += (const wchar_t* s)
|
const FString& FString::operator += (const wchar_t* s)
|
||||||
{
|
{
|
||||||
_insert (length, uInt(wcslen(s)), s);
|
_insert (length, uInt(std::wcslen(s)), s);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ const FString& FString::operator += (const char* s)
|
||||||
|
|
||||||
if ( wc_string )
|
if ( wc_string )
|
||||||
{
|
{
|
||||||
_insert (length, uInt(strlen(s)), wc_string);
|
_insert (length, uInt(std::strlen(s)), wc_string);
|
||||||
delete[] wc_string;
|
delete[] wc_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +731,7 @@ const FString FString::operator + (const std::wstring& s)
|
||||||
const FString FString::operator + (const wchar_t* s)
|
const FString FString::operator + (const wchar_t* s)
|
||||||
{
|
{
|
||||||
FString tmp(string);
|
FString tmp(string);
|
||||||
tmp._insert (length, uInt(wcslen(s)), s);
|
tmp._insert (length, uInt(std::wcslen(s)), s);
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ const FString FString::operator + (const std::string& s)
|
||||||
if ( ! wc_string )
|
if ( ! wc_string )
|
||||||
return (tmp);
|
return (tmp);
|
||||||
|
|
||||||
tmp._insert (length, uInt(wcslen(wc_string)), wc_string);
|
tmp._insert (length, uInt(std::wcslen(wc_string)), wc_string);
|
||||||
delete[] wc_string;
|
delete[] wc_string;
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
@ -758,7 +758,7 @@ const FString FString::operator + (const char* s)
|
||||||
if ( ! wc_string )
|
if ( ! wc_string )
|
||||||
return (tmp);
|
return (tmp);
|
||||||
|
|
||||||
tmp._insert (length, uInt(wcslen(wc_string)), wc_string);
|
tmp._insert (length, uInt(std::wcslen(wc_string)), wc_string);
|
||||||
delete[] wc_string;
|
delete[] wc_string;
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
@ -789,8 +789,8 @@ const FString FString::operator + (const char c)
|
||||||
const FString operator + (const FString& s1, const FString& s2)
|
const FString operator + (const FString& s1, const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp(s1);
|
||||||
tmp._insert ( uInt(wcslen(s1.wc_str()))
|
tmp._insert ( uInt(std::wcslen(s1.wc_str()))
|
||||||
, uInt(wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
@ -799,7 +799,7 @@ const FString operator + (const FString& s1, const FString& s2)
|
||||||
const FString operator + (const FString& s, const wchar_t c)
|
const FString operator + (const FString& s, const wchar_t c)
|
||||||
{
|
{
|
||||||
FString tmp(s);
|
FString tmp(s);
|
||||||
tmp._insert ( uInt(wcslen(s.wc_str())), 1, &c);
|
tmp._insert ( uInt(std::wcslen(s.wc_str())), 1, &c);
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,8 +807,8 @@ const FString operator + (const FString& s, const wchar_t c)
|
||||||
const FString operator + (const std::wstring& s1, const FString& s2)
|
const FString operator + (const std::wstring& s1, const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp(s1);
|
||||||
tmp._insert ( uInt(wcslen(s1.c_str()))
|
tmp._insert ( uInt(std::wcslen(s1.c_str()))
|
||||||
, uInt(wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
@ -817,8 +817,8 @@ const FString operator + (const std::wstring& s1, const FString& s2)
|
||||||
const FString operator + (const wchar_t* s1, const FString& s2)
|
const FString operator + (const wchar_t* s1, const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp(s1);
|
||||||
tmp._insert ( uInt(wcslen(s1))
|
tmp._insert ( uInt(std::wcslen(s1))
|
||||||
, uInt(wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
@ -828,7 +828,7 @@ const FString operator + (const std::string& s1, const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp(s1);
|
||||||
tmp._insert ( tmp.getLength()
|
tmp._insert ( tmp.getLength()
|
||||||
, uInt(wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
@ -838,7 +838,7 @@ const FString operator + (const char* s1, const FString& s2)
|
||||||
{
|
{
|
||||||
FString tmp(s1);
|
FString tmp(s1);
|
||||||
tmp._insert ( tmp.getLength()
|
tmp._insert ( tmp.getLength()
|
||||||
, uInt(wcslen(s2.wc_str()))
|
, uInt(std::wcslen(s2.wc_str()))
|
||||||
, s2.wc_str() );
|
, s2.wc_str() );
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
@ -847,7 +847,7 @@ const FString operator + (const char* s1, const FString& s2)
|
||||||
const FString operator + (const wchar_t c, const FString& s)
|
const FString operator + (const wchar_t c, const FString& s)
|
||||||
{
|
{
|
||||||
FString tmp(c);
|
FString tmp(c);
|
||||||
tmp._insert (1, uInt(wcslen(s.wc_str())), s.wc_str());
|
tmp._insert (1, uInt(std::wcslen(s.wc_str())), s.wc_str());
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,7 +855,7 @@ const FString operator + (const wchar_t c, const FString& s)
|
||||||
const FString operator + (const char c, const FString& s)
|
const FString operator + (const char c, const FString& s)
|
||||||
{
|
{
|
||||||
FString tmp(c);
|
FString tmp(c);
|
||||||
tmp._insert (1, uInt(wcslen(s.wc_str())), s.wc_str());
|
tmp._insert (1, uInt(std::wcslen(s.wc_str())), s.wc_str());
|
||||||
return (tmp);
|
return (tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ FString& FString::sprintf (const wchar_t* format, ...)
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
vswprintf (buffer, buf_size, format, args);
|
std::vswprintf (buffer, buf_size, format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
_replace (buffer);
|
_replace (buffer);
|
||||||
|
@ -938,14 +938,14 @@ FString& FString::sprintf (const char* format, ...)
|
||||||
|
|
||||||
buffer = buf;
|
buffer = buf;
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
len = vsnprintf (buffer, sizeof(buf), format, args);
|
len = std::vsnprintf (buffer, sizeof(buf), format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
if ( len >= int(sizeof(buf)) )
|
if ( len >= int(sizeof(buf)) )
|
||||||
{
|
{
|
||||||
buffer = new char[len+1]();
|
buffer = new char[len+1]();
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
vsnprintf (buffer, uLong(len+1), format, args);
|
std::vsnprintf (buffer, uLong(len+1), format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,7 +1004,7 @@ FString FString::toLower() const
|
||||||
{
|
{
|
||||||
while ( *p )
|
while ( *p )
|
||||||
{
|
{
|
||||||
*p = wchar_t(towlower(uInt(*p)));
|
*p = wchar_t(std::towlower(uInt(*p)));
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1023,7 @@ FString FString::toUpper() const
|
||||||
{
|
{
|
||||||
while ( *p )
|
while ( *p )
|
||||||
{
|
{
|
||||||
*p = wchar_t(towupper(uInt(*p)));
|
*p = wchar_t(std::towupper(uInt(*p)));
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1111,7 +1111,7 @@ long FString::toLong() const
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( isdigit(*p) )
|
while ( std::isdigit(*p) )
|
||||||
{
|
{
|
||||||
register uChar d = uChar((*p) - L'0');
|
register uChar d = uChar((*p) - L'0');
|
||||||
|
|
||||||
|
@ -1125,7 +1125,7 @@ long FString::toLong() const
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( *p != L'\0' && ! isdigit(*p) )
|
if ( *p != L'\0' && ! std::isdigit(*p) )
|
||||||
throw std::invalid_argument ("no valid number");
|
throw std::invalid_argument ("no valid number");
|
||||||
|
|
||||||
return num;
|
return num;
|
||||||
|
@ -1157,7 +1157,7 @@ uLong FString::toULong() const
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( isdigit(*p) )
|
while ( std::isdigit(*p) )
|
||||||
{
|
{
|
||||||
register uChar d = uChar((*p) - L'0');
|
register uChar d = uChar((*p) - L'0');
|
||||||
|
|
||||||
|
@ -1171,7 +1171,7 @@ uLong FString::toULong() const
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( *p != L'\0' && ! isdigit(*p) )
|
if ( *p != L'\0' && ! std::isdigit(*p) )
|
||||||
throw std::invalid_argument ("no valid number");
|
throw std::invalid_argument ("no valid number");
|
||||||
|
|
||||||
return num;
|
return num;
|
||||||
|
@ -1201,7 +1201,7 @@ double FString::toDouble() const
|
||||||
if ( ! *string )
|
if ( ! *string )
|
||||||
throw std::invalid_argument ("empty value");
|
throw std::invalid_argument ("empty value");
|
||||||
|
|
||||||
ret = wcstod(string, &p);
|
ret = std::wcstod(string, &p);
|
||||||
|
|
||||||
if ( p != 0 && *p != '\0' )
|
if ( p != 0 && *p != '\0' )
|
||||||
throw std::invalid_argument ("no valid floating point value");
|
throw std::invalid_argument ("no valid floating point value");
|
||||||
|
@ -1211,7 +1211,7 @@ double FString::toDouble() const
|
||||||
if ( ret >= HUGE_VAL || ret <= -HUGE_VAL )
|
if ( ret >= HUGE_VAL || ret <= -HUGE_VAL )
|
||||||
throw std::overflow_error ("overflow");
|
throw std::overflow_error ("overflow");
|
||||||
|
|
||||||
if ( fabs(ret) < DBL_EPSILON ) // ret == 0.0l
|
if ( std::fabs(ret) < DBL_EPSILON ) // ret == 0.0l
|
||||||
throw std::underflow_error ("underflow");
|
throw std::underflow_error ("underflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1230,7 +1230,7 @@ FString FString::ltrim() const
|
||||||
|
|
||||||
p = s.string;
|
p = s.string;
|
||||||
|
|
||||||
while ( iswspace(uInt(*p)) )
|
while ( std::iswspace(uInt(*p)) )
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
return FString(p);
|
return FString(p);
|
||||||
|
@ -1250,9 +1250,9 @@ FString FString::rtrim() const
|
||||||
p = s.string;
|
p = s.string;
|
||||||
last = p + length;
|
last = p + length;
|
||||||
|
|
||||||
while ( iswspace(uInt(*--last)) && last > p );
|
while ( std::iswspace(uInt(*--last)) && last > p );
|
||||||
|
|
||||||
if ( last == p && iswspace(uInt(*last)) )
|
if ( last == p && std::iswspace(uInt(*last)) )
|
||||||
s.clear();
|
s.clear();
|
||||||
else
|
else
|
||||||
*(last+1) = '\0';
|
*(last+1) = '\0';
|
||||||
|
@ -1580,7 +1580,7 @@ bool FString::operator < (const FString& s) const
|
||||||
if ( ! (string || s.string) )
|
if ( ! (string || s.string) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (wcscmp(string, s.string) < 0);
|
return (std::wcscmp(string, s.string) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1640,7 +1640,7 @@ bool FString::operator <= (const FString& s) const
|
||||||
if ( ! (string || s.string) )
|
if ( ! (string || s.string) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return (wcscmp(string, s.string) <= 0);
|
return (std::wcscmp(string, s.string) <= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1697,7 +1697,7 @@ bool FString::operator == (const FString& s) const
|
||||||
if ( ! (string || s.string) )
|
if ( ! (string || s.string) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return (wcscmp(string, s.string) == 0);
|
return (std::wcscmp(string, s.string) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1754,7 +1754,7 @@ bool FString::operator != (const FString& s) const
|
||||||
if ( ! (string || s.string) )
|
if ( ! (string || s.string) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (wcscmp(string, s.string) != 0);
|
return (std::wcscmp(string, s.string) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1814,7 +1814,7 @@ bool FString::operator >= (const FString& s) const
|
||||||
if ( ! (string || s.string) )
|
if ( ! (string || s.string) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return (wcscmp(string, s.string) >= 0);
|
return (std::wcscmp(string, s.string) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1874,7 +1874,7 @@ bool FString::operator > (const FString& s) const
|
||||||
if ( ! (string || s.string) )
|
if ( ! (string || s.string) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (wcscmp(string, s.string) > 0);
|
return (std::wcscmp(string, s.string) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1937,7 +1937,7 @@ const FString& FString::insert (const wchar_t* s, uInt pos)
|
||||||
if ( pos >= length )
|
if ( pos >= length )
|
||||||
throw std::out_of_range("");
|
throw std::out_of_range("");
|
||||||
|
|
||||||
_insert (pos, uInt(wcslen(s)), s);
|
_insert (pos, uInt(std::wcslen(s)), s);
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1980,7 +1980,7 @@ FString FString::replace (const FString& from, const FString& to)
|
||||||
|
|
||||||
while ( *p )
|
while ( *p )
|
||||||
{
|
{
|
||||||
if ( wcsncmp(p, from.string, from_length) == 0 )
|
if ( std::wcsncmp(p, from.string, from_length) == 0 )
|
||||||
{
|
{
|
||||||
s._remove(pos, from_length);
|
s._remove(pos, from_length);
|
||||||
s._insert(pos, to_length, to.string);
|
s._insert(pos, to_length, to.string);
|
||||||
|
@ -2409,7 +2409,7 @@ FString FString::replaceControlCodes() const
|
||||||
{
|
{
|
||||||
*p = L' ';
|
*p = L' ';
|
||||||
}
|
}
|
||||||
else if ( ! iswprint(wint_t(*p)) )
|
else if ( ! std::iswprint(wint_t(*p)) )
|
||||||
*p = L' ';
|
*p = L' ';
|
||||||
|
|
||||||
p++;
|
p++;
|
||||||
|
@ -2518,11 +2518,11 @@ const FString& FString::overwrite (const FString& s, uInt pos)
|
||||||
{
|
{
|
||||||
if (length >= (pos + s.length))
|
if (length >= (pos + s.length))
|
||||||
{
|
{
|
||||||
wcsncpy(string + pos, s.string, s.length);
|
std::wcsncpy (string + pos, s.string, s.length);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcsncpy (string + pos, s.string, length - pos);
|
std::wcsncpy (string + pos, s.string, length - pos);
|
||||||
_insert (length, pos + s.length - length, s.string + length - pos);
|
_insert (length, pos + s.length - length, s.string + length - pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2532,15 +2532,15 @@ const FString& FString::overwrite (const FString& s, uInt pos)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const FString& FString::overwrite (const wchar_t* s, uInt pos)
|
const FString& FString::overwrite (const wchar_t* s, uInt pos)
|
||||||
{
|
{
|
||||||
uInt len = uInt(wcslen(s));
|
uInt len = uInt(std::wcslen(s));
|
||||||
|
|
||||||
if (length >= (pos+len) )
|
if (length >= (pos+len) )
|
||||||
{
|
{
|
||||||
wcsncpy (string + pos, s, len);
|
std::wcsncpy (string + pos, s, len);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcsncpy (string + pos, s, length - pos);
|
std::wcsncpy (string + pos, s, length - pos);
|
||||||
_insert (length, pos + len - length, s + length - pos);
|
_insert (length, pos + len - length, s + length - pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2570,13 +2570,13 @@ const FString& FString::remove (uInt pos, uInt len)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FString::includes (const FString& s)
|
bool FString::includes (const FString& s)
|
||||||
{
|
{
|
||||||
return (wcsstr(string, s.string) != 0);
|
return (std::wcsstr(string, s.string) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FString::includes (const wchar_t* s)
|
bool FString::includes (const wchar_t* s)
|
||||||
{
|
{
|
||||||
return (wcsstr(string, s) != 0);
|
return (std::wcsstr(string, s) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -2588,7 +2588,7 @@ bool FString::includes (const char* s)
|
||||||
if ( ! wc_string )
|
if ( ! wc_string )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ret = bool(wcsstr(string, wc_string) != 0);
|
ret = bool(std::wcsstr(string, wc_string) != 0);
|
||||||
delete[] wc_string;
|
delete[] wc_string;
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
@ -2599,7 +2599,7 @@ bool FString::includes (const wchar_t c)
|
||||||
wchar_t s[2];
|
wchar_t s[2];
|
||||||
s[0] = c;
|
s[0] = c;
|
||||||
s[1] = L'\0';
|
s[1] = L'\0';
|
||||||
return (wcsstr(string, s) != 0);
|
return (std::wcsstr(string, s) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -2608,5 +2608,5 @@ bool FString::includes (const char c)
|
||||||
wchar_t s[2];
|
wchar_t s[2];
|
||||||
s[0] = wchar_t(c & 0xff);
|
s[0] = wchar_t(c & 0xff);
|
||||||
s[1] = L'\0';
|
s[1] = L'\0';
|
||||||
return (wcsstr(string, s) != 0);
|
return (std::wcsstr(string, s) != 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ void FSwitch::drawCheckButton()
|
||||||
{
|
{
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
{
|
{
|
||||||
wcsncpy ( on, L" <On>", 6);
|
std::wcsncpy ( on, L" <On>", 6);
|
||||||
setBold(true);
|
setBold(true);
|
||||||
}
|
}
|
||||||
else if ( getMaxColor() < 16 )
|
else if ( getMaxColor() < 16 )
|
||||||
|
@ -113,7 +113,7 @@ void FSwitch::drawCheckButton()
|
||||||
{
|
{
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
{
|
{
|
||||||
wcsncpy ( off, L"<Off>", 6);
|
std::wcsncpy ( off, L"<Off>", 6);
|
||||||
setBold(true);
|
setBold(true);
|
||||||
}
|
}
|
||||||
else if ( getMaxColor() < 16 )
|
else if ( getMaxColor() < 16 )
|
||||||
|
|
655
src/fterm.cpp
655
src/fterm.cpp
File diff suppressed because it is too large
Load Diff
39
src/fterm.h
39
src/fterm.h
|
@ -88,6 +88,9 @@
|
||||||
// parseKeyString return value
|
// parseKeyString return value
|
||||||
#define NEED_MORE_DATA -1
|
#define NEED_MORE_DATA -1
|
||||||
|
|
||||||
|
// Buffer size for character output on the terminal
|
||||||
|
#define TERMINAL_OUTPUT_BUFFER_SIZE 32768
|
||||||
|
|
||||||
// class forward declaration
|
// class forward declaration
|
||||||
class FWidget;
|
class FWidget;
|
||||||
|
|
||||||
|
@ -151,17 +154,16 @@ class FTerm
|
||||||
static char* locale_name;
|
static char* locale_name;
|
||||||
static char* locale_xterm;
|
static char* locale_xterm;
|
||||||
static uChar x11_button_state;
|
static uChar x11_button_state;
|
||||||
static FRect* term;
|
static FRect* term; // current terminal geometry
|
||||||
static FPoint* mouse;
|
static FPoint* term_pos; // terminal cursor position
|
||||||
static FPoint* cursor;
|
static FPoint* mouse; // mouse click position
|
||||||
|
static FPoint* cursor; // virtual print cursor
|
||||||
static int stdin_status_flags;
|
static int stdin_status_flags;
|
||||||
static int stdin_no;
|
static int stdin_no;
|
||||||
static int stdout_no;
|
static int stdout_no;
|
||||||
static int max_color;
|
static int max_color;
|
||||||
static int fd_tty;
|
static int fd_tty;
|
||||||
static uInt baudrate;
|
static uInt baudrate;
|
||||||
static int x_term_pos;
|
|
||||||
static int y_term_pos;
|
|
||||||
static bool resize_term;
|
static bool resize_term;
|
||||||
static char exit_message[8192];
|
static char exit_message[8192];
|
||||||
|
|
||||||
|
@ -235,6 +237,9 @@ class FTerm
|
||||||
int height;
|
int height;
|
||||||
int right_shadow;
|
int right_shadow;
|
||||||
int bottom_shadow;
|
int bottom_shadow;
|
||||||
|
int input_cursor_x;
|
||||||
|
int input_cursor_y;
|
||||||
|
int input_cursor_visible;
|
||||||
FWidget* widget;
|
FWidget* widget;
|
||||||
line_changes* changes;
|
line_changes* changes;
|
||||||
FOptiAttr::char_data* text;
|
FOptiAttr::char_data* text;
|
||||||
|
@ -244,6 +249,7 @@ 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* last_area; // last used area
|
static term_area* last_area; // last used area
|
||||||
|
static term_area* active_area; // active area
|
||||||
term_area* vwin; // virtual window
|
term_area* vwin; // virtual window
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -293,10 +299,14 @@ class FTerm
|
||||||
void removeArea (FTerm::term_area*&); // reference to pointer
|
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;
|
static FTerm::covered_state isCovered (const FPoint&, FTerm::term_area*);
|
||||||
FTerm::covered_state isCovered (int, int, FTerm::term_area*) const;
|
static FTerm::covered_state isCovered (int, int, FTerm::term_area*);
|
||||||
void updateVTerm (FTerm::term_area*);
|
|
||||||
void updateVTerm (bool);
|
void updateVTerm (bool);
|
||||||
|
void updateVTerm (FTerm::term_area*);
|
||||||
|
static bool updateVTermCursor (FTerm::term_area*);
|
||||||
|
static bool isInsideArea (int, int, FTerm::term_area*);
|
||||||
|
void setAreaCursor (const FPoint&, bool, FTerm::term_area*);
|
||||||
|
void setAreaCursor (int, int, bool, FTerm::term_area*);
|
||||||
void getArea (const FPoint&, FTerm::term_area*);
|
void getArea (const FPoint&, FTerm::term_area*);
|
||||||
void getArea (int, int, FTerm::term_area*);
|
void getArea (int, int, FTerm::term_area*);
|
||||||
void getArea (const FRect&, FTerm::term_area*);
|
void getArea (const FRect&, FTerm::term_area*);
|
||||||
|
@ -348,8 +358,10 @@ class FTerm
|
||||||
void createVTerm();
|
void createVTerm();
|
||||||
static void resizeVTerm();
|
static void resizeVTerm();
|
||||||
static void putVTerm();
|
static void putVTerm();
|
||||||
static void updateTerminal();
|
|
||||||
static void updateTerminal (bool);
|
static void updateTerminal (bool);
|
||||||
|
static void updateTerminal();
|
||||||
|
static bool updateTerminalCursor();
|
||||||
|
static bool isInsideTerminal (int, int);
|
||||||
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
static void setKDECursor (fc::kdeKonsoleCursorShape);
|
||||||
static FString getXTermFont();
|
static FString getXTermFont();
|
||||||
static FString getXTermTitle();
|
static FString getXTermTitle();
|
||||||
|
@ -393,7 +405,6 @@ class FTerm
|
||||||
static bool hideCursor();
|
static bool hideCursor();
|
||||||
static bool showCursor();
|
static bool showCursor();
|
||||||
static bool isHiddenCursor();
|
static bool isHiddenCursor();
|
||||||
bool isCursorInside();
|
|
||||||
|
|
||||||
static void setEncoding (std::string);
|
static void setEncoding (std::string);
|
||||||
static std::string getEncoding();
|
static std::string getEncoding();
|
||||||
|
@ -466,9 +477,15 @@ class FTerm
|
||||||
// FTerm inline functions
|
// FTerm inline functions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FTerm::covered_state FTerm::isCovered ( const FPoint& pos
|
inline FTerm::covered_state FTerm::isCovered ( const FPoint& pos
|
||||||
, FTerm::term_area* area) const
|
, FTerm::term_area* area)
|
||||||
{ return isCovered (pos.getX(), pos.getY(), area); }
|
{ return isCovered (pos.getX(), pos.getY(), area); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FTerm::setAreaCursor ( const FPoint& pos
|
||||||
|
, bool visible
|
||||||
|
, FTerm::term_area* area)
|
||||||
|
{ setAreaCursor (pos.getX(), pos.getY(), visible, area); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FTerm::getArea (const FPoint& pos, FTerm::term_area* area)
|
inline void FTerm::getArea (const FPoint& pos, FTerm::term_area* area)
|
||||||
{ return getArea (pos.getX(), pos.getY(), area); }
|
{ return getArea (pos.getX(), pos.getY(), area); }
|
||||||
|
|
|
@ -126,7 +126,7 @@ void FTextView::drawText()
|
||||||
{
|
{
|
||||||
uInt start, end;
|
uInt start, end;
|
||||||
|
|
||||||
if ( data.empty() || getHeight() < 4 || getWidth() < 5 )
|
if ( data.empty() || getHeight() <= 2 || getWidth() <= 2 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
start = 0;
|
start = 0;
|
||||||
|
@ -158,8 +158,8 @@ void FTextView::drawText()
|
||||||
bool utf8 = (Encoding == fc::UTF8) ? true : false;
|
bool utf8 = (Encoding == fc::UTF8) ? true : false;
|
||||||
|
|
||||||
// only printable and 1 column per character
|
// only printable and 1 column per character
|
||||||
if ( ( (utf8 && iswprint(wint_t(ch)))
|
if ( ( (utf8 && std::iswprint(wint_t(ch)))
|
||||||
|| (!utf8 && ch < 256 && isprint(ch)) )
|
|| (!utf8 && ch < 256 && std::isprint(ch)) )
|
||||||
&& wcwidth(ch) == 1 )
|
&& wcwidth(ch) == 1 )
|
||||||
{
|
{
|
||||||
print (ch);
|
print (ch);
|
||||||
|
@ -194,7 +194,7 @@ void FTextView::adjustSize()
|
||||||
int last_line = int(getRows());
|
int last_line = int(getRows());
|
||||||
int max_width = int(maxLineWidth);
|
int max_width = int(maxLineWidth);
|
||||||
|
|
||||||
if ( xoffset > max_width - width - nf_offset - 1 )
|
if ( xoffset >= max_width - width - nf_offset )
|
||||||
xoffset = max_width - width - nf_offset - 1;
|
xoffset = max_width - width - nf_offset - 1;
|
||||||
|
|
||||||
if ( xoffset < 0 )
|
if ( xoffset < 0 )
|
||||||
|
@ -262,7 +262,7 @@ void FTextView::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
std::memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < getHeight(); y++)
|
for (int y=0; y < getHeight(); y++)
|
||||||
|
@ -916,7 +916,7 @@ void FTextView::clear()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
std::memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
|
|
||||||
for (int y=0; y < getHeight() + nf_offset - 2; y++)
|
for (int y=0; y < getHeight() + nf_offset - 2; y++)
|
||||||
|
|
|
@ -24,7 +24,7 @@ FToggleButton::FToggleButton(FWidget* parent)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if ( parent && strcmp ( parent->getClassName()
|
if ( parent && std::strcmp ( parent->getClassName()
|
||||||
, const_cast<char*>("FButtonGroup") ) == 0 )
|
, const_cast<char*>("FButtonGroup") ) == 0 )
|
||||||
{
|
{
|
||||||
setGroup( static_cast<FButtonGroup*>(parent) );
|
setGroup( static_cast<FButtonGroup*>(parent) );
|
||||||
|
@ -47,7 +47,7 @@ FToggleButton::FToggleButton (const FString& txt, FWidget* parent)
|
||||||
init();
|
init();
|
||||||
setText(txt);
|
setText(txt);
|
||||||
|
|
||||||
if ( parent && strcmp ( parent->getClassName()
|
if ( parent && std::strcmp ( parent->getClassName()
|
||||||
, const_cast<char*>("FButtonGroup") ) == 0 )
|
, const_cast<char*>("FButtonGroup") ) == 0 )
|
||||||
{
|
{
|
||||||
setGroup( static_cast<FButtonGroup*>(parent) );
|
setGroup( static_cast<FButtonGroup*>(parent) );
|
||||||
|
@ -64,9 +64,6 @@ FToggleButton::~FToggleButton() // destructor
|
||||||
|
|
||||||
if ( group() )
|
if ( group() )
|
||||||
group()->remove(this);
|
group()->remove(this);
|
||||||
|
|
||||||
if ( hasFocus() )
|
|
||||||
hideCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,12 +139,12 @@ void FToggleButton::setHotkeyAccelerator()
|
||||||
|
|
||||||
if ( hotkey )
|
if ( hotkey )
|
||||||
{
|
{
|
||||||
if ( isalpha(hotkey) || isdigit(hotkey) )
|
if ( std::isalpha(hotkey) || std::isdigit(hotkey) )
|
||||||
{
|
{
|
||||||
addAccelerator (tolower(hotkey));
|
addAccelerator (std::tolower(hotkey));
|
||||||
addAccelerator (toupper(hotkey));
|
addAccelerator (std::toupper(hotkey));
|
||||||
// Meta + hotkey
|
// Meta + hotkey
|
||||||
addAccelerator (fc::Fmkey_meta + tolower(hotkey));
|
addAccelerator (fc::Fmkey_meta + std::tolower(hotkey));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addAccelerator (getHotkey());
|
addAccelerator (getHotkey());
|
||||||
|
@ -175,17 +172,7 @@ void FToggleButton::draw()
|
||||||
|
|
||||||
// set the cursor to the button
|
// set the cursor to the button
|
||||||
if ( isRadioButton() || isCheckboxButton() )
|
if ( isRadioButton() || isCheckboxButton() )
|
||||||
{
|
|
||||||
setCursorPos (2, 1);
|
setCursorPos (2, 1);
|
||||||
|
|
||||||
if ( isCursorInside() && hasFocus() )
|
|
||||||
{
|
|
||||||
if ( isHiddenCursor() )
|
|
||||||
showCursor();
|
|
||||||
}
|
|
||||||
else if ( ! isHiddenCursor() )
|
|
||||||
hideCursor();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -289,14 +276,14 @@ FButtonGroup* FToggleButton::group() const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FToggleButton::isRadioButton() const
|
bool FToggleButton::isRadioButton() const
|
||||||
{
|
{
|
||||||
return ( strcmp ( getClassName()
|
return ( std::strcmp ( getClassName()
|
||||||
, const_cast<char*>("FRadioButton") ) == 0 );
|
, const_cast<char*>("FRadioButton") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FToggleButton::isCheckboxButton() const
|
bool FToggleButton::isCheckboxButton() const
|
||||||
{
|
{
|
||||||
return ( strcmp ( getClassName()
|
return ( std::strcmp ( getClassName()
|
||||||
, const_cast<char*>("FCheckBox") ) == 0 );
|
, const_cast<char*>("FCheckBox") ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +374,7 @@ void FToggleButton::hide()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
blank = new char[size+1];
|
blank = new char[size+1];
|
||||||
memset(blank, ' ', uLong(size));
|
std::memset(blank, ' ', uLong(size));
|
||||||
blank[size] = '\0';
|
blank[size] = '\0';
|
||||||
printPos (1, 1);
|
printPos (1, 1);
|
||||||
print (blank);
|
print (blank);
|
||||||
|
@ -465,9 +452,6 @@ bool FToggleButton::setFocus (bool on)
|
||||||
setForegroundColor (wc.toggle_button_active_focus_fg);
|
setForegroundColor (wc.toggle_button_active_focus_fg);
|
||||||
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
setBackgroundColor (wc.toggle_button_active_focus_bg);
|
||||||
|
|
||||||
if ( isCursorInside() && (isRadioButton() || isCheckboxButton()) )
|
|
||||||
showCursor();
|
|
||||||
|
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
{
|
{
|
||||||
FString msg = getStatusbarMessage();
|
FString msg = getStatusbarMessage();
|
||||||
|
@ -486,7 +470,6 @@ bool FToggleButton::setFocus (bool on)
|
||||||
{
|
{
|
||||||
setForegroundColor (wc.toggle_button_active_fg);
|
setForegroundColor (wc.toggle_button_active_fg);
|
||||||
setBackgroundColor (wc.toggle_button_active_bg);
|
setBackgroundColor (wc.toggle_button_active_bg);
|
||||||
hideCursor();
|
|
||||||
|
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
statusBar()->clearMessage();
|
statusBar()->clearMessage();
|
||||||
|
@ -593,19 +576,9 @@ void FToggleButton::onAccel (FAccelEvent* ev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
void FToggleButton::onHide (FHideEvent*)
|
|
||||||
{
|
|
||||||
if ( hasFocus() )
|
|
||||||
hideCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FToggleButton::onFocusIn (FFocusEvent*)
|
void FToggleButton::onFocusIn (FFocusEvent*)
|
||||||
{
|
{
|
||||||
if ( isCursorInside() && (isRadioButton() || isCheckboxButton()) )
|
|
||||||
showCursor();
|
|
||||||
|
|
||||||
if ( statusBar() )
|
if ( statusBar() )
|
||||||
statusBar()->drawMessage();
|
statusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
|
@ -619,8 +592,6 @@ void FToggleButton::onFocusOut (FFocusEvent* out_ev)
|
||||||
statusBar()->drawMessage();
|
statusBar()->drawMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideCursor();
|
|
||||||
|
|
||||||
if ( group() )
|
if ( group() )
|
||||||
{
|
{
|
||||||
if ( ! focus_inside_group && isRadioButton() )
|
if ( ! focus_inside_group && isRadioButton() )
|
||||||
|
|
|
@ -87,7 +87,6 @@ class FToggleButton : public FWidget
|
||||||
void onMouseDown (FMouseEvent*);
|
void onMouseDown (FMouseEvent*);
|
||||||
void onMouseUp (FMouseEvent*);
|
void onMouseUp (FMouseEvent*);
|
||||||
void onAccel (FAccelEvent*);
|
void onAccel (FAccelEvent*);
|
||||||
void onHide (FHideEvent*);
|
|
||||||
void onFocusIn (FFocusEvent*);
|
void onFocusIn (FFocusEvent*);
|
||||||
void onFocusOut (FFocusEvent*);
|
void onFocusOut (FFocusEvent*);
|
||||||
|
|
||||||
|
|
|
@ -373,11 +373,11 @@ FTerm::term_area* FWidget::getPrintArea()
|
||||||
return print_area;
|
return print_area;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FWidget* area_widget = FWindow::getWindowWidget(this);
|
FWidget* window = FWindow::getWindowWidget(this);
|
||||||
|
|
||||||
if ( area_widget )
|
if ( window )
|
||||||
{
|
{
|
||||||
term_area* area = area_widget->getVWin();
|
term_area* area = window->getVWin();
|
||||||
|
|
||||||
if ( area )
|
if ( area )
|
||||||
{
|
{
|
||||||
|
@ -449,7 +449,7 @@ void FWidget::adjustSize()
|
||||||
if ( getWidth() < size_hints.min_width )
|
if ( getWidth() < size_hints.min_width )
|
||||||
adjust_wsize.setWidth(size_hints.min_width);
|
adjust_wsize.setWidth(size_hints.min_width);
|
||||||
|
|
||||||
if ( getWidth() < 1 )
|
if ( getWidth() <= 0 )
|
||||||
adjust_wsize.setWidth(1);
|
adjust_wsize.setWidth(1);
|
||||||
|
|
||||||
// reduce the height if not enough space
|
// reduce the height if not enough space
|
||||||
|
@ -459,7 +459,7 @@ void FWidget::adjustSize()
|
||||||
if ( getHeight() < size_hints.min_height )
|
if ( getHeight() < size_hints.min_height )
|
||||||
adjust_wsize.setWidth(size_hints.min_height);
|
adjust_wsize.setWidth(size_hints.min_height);
|
||||||
|
|
||||||
if ( getHeight() < 1 )
|
if ( getHeight() <= 0 )
|
||||||
adjust_wsize.setHeight(1);
|
adjust_wsize.setHeight(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,10 +852,12 @@ bool FWidget::focusPrevChild()
|
||||||
{
|
{
|
||||||
if ( prev == this )
|
if ( prev == this )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
prev->setFocus();
|
prev->setFocus();
|
||||||
FFocusEvent in (fc::FocusIn_Event);
|
FFocusEvent in (fc::FocusIn_Event);
|
||||||
in.setFocusType(fc::FocusPreviousWidget);
|
in.setFocusType(fc::FocusPreviousWidget);
|
||||||
FApplication::sendEvent(prev, &in);
|
FApplication::sendEvent(prev, &in);
|
||||||
|
|
||||||
if ( in.isAccepted() )
|
if ( in.isAccepted() )
|
||||||
{
|
{
|
||||||
this->draw();
|
this->draw();
|
||||||
|
@ -1908,36 +1910,35 @@ void FWidget::move (int x, int y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Avoid to move widget completely outside the terminal
|
// Avoid to move widget completely outside the terminal
|
||||||
if ( x+getWidth()-1 < 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
|
if ( x+getWidth() <= 1 || x > getMaxWidth() || y < 1 || y > getMaxHeight() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wsize.setPos(x,y);
|
wsize.setPos(x,y);
|
||||||
adjust_wsize.setPos(x,y);
|
adjust_wsize.setPos(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
bool FWidget::setCursor()
|
|
||||||
{
|
|
||||||
FPoint* wcursor = &widget_cursor_position;
|
|
||||||
|
|
||||||
if ( isCursorInside() )
|
|
||||||
{
|
|
||||||
setTermXY ( getTermX() + wcursor->getX() - 2
|
|
||||||
, getTermY() + wcursor->getY() - 2 );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool FWidget::setCursorPos (register int x, register int y)
|
bool FWidget::setCursorPos (register int x, register int y)
|
||||||
{
|
{
|
||||||
widget_cursor_position.setPoint(x,y);
|
widget_cursor_position.setPoint(x,y);
|
||||||
|
|
||||||
if ( isCursorInside() )
|
if ( (flags & fc::focus) != 0 && ! isWindowWidget() )
|
||||||
|
{
|
||||||
|
FWidget* window = FWindow::getWindowWidget(this);
|
||||||
|
|
||||||
|
if ( window )
|
||||||
|
{
|
||||||
|
if ( term_area* area = window->getVWin() )
|
||||||
|
{
|
||||||
|
setAreaCursor ( getTermX() - window->getTermX() + x
|
||||||
|
, getTermY() - window->getTermY() + y
|
||||||
|
, visible_cursor
|
||||||
|
, area );
|
||||||
return true;
|
return true;
|
||||||
else
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2070,7 +2071,7 @@ void FWidget::clearShadow()
|
||||||
else if ( FWidget* p = getParentWidget() )
|
else if ( FWidget* p = getParentWidget() )
|
||||||
setColor (wc.shadow_fg, p->getBackgroundColor());
|
setColor (wc.shadow_fg, p->getBackgroundColor());
|
||||||
|
|
||||||
if ( x2 < offset.getX2() + 1 )
|
if ( x2 <= offset.getX2() )
|
||||||
{
|
{
|
||||||
for (int i=0; i < getHeight(); i++)
|
for (int i=0; i < getHeight(); i++)
|
||||||
{
|
{
|
||||||
|
@ -2079,7 +2080,7 @@ void FWidget::clearShadow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( y2 < offset.getY2() + 1 )
|
if ( y2 <= offset.getY2() )
|
||||||
{
|
{
|
||||||
printPos (x1+1, y2+1);
|
printPos (x1+1, y2+1);
|
||||||
|
|
||||||
|
|
|
@ -419,11 +419,13 @@ class FWidget : public FObject, public FTerm
|
||||||
virtual bool setDisable();
|
virtual bool setDisable();
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
|
|
||||||
|
// input cursor visibility for the widget
|
||||||
virtual bool setVisibleCursor(bool);
|
virtual bool setVisibleCursor(bool);
|
||||||
virtual bool setVisibleCursor();
|
virtual bool setVisibleCursor();
|
||||||
virtual bool unsetVisibleCursor();
|
virtual bool unsetVisibleCursor();
|
||||||
bool hasVisibleCursor() const;
|
bool hasVisibleCursor() const;
|
||||||
|
|
||||||
|
// widget focusing
|
||||||
virtual bool focusFirstChild();
|
virtual bool focusFirstChild();
|
||||||
virtual bool focusLastChild();
|
virtual bool focusLastChild();
|
||||||
virtual bool setFocus (bool);
|
virtual bool setFocus (bool);
|
||||||
|
@ -434,13 +436,17 @@ class FWidget : public FObject, public FTerm
|
||||||
void setFocusable();
|
void setFocusable();
|
||||||
void unsetFocusable();
|
void unsetFocusable();
|
||||||
|
|
||||||
|
// ignore padding from the parent widget
|
||||||
bool ignorePadding (bool);
|
bool ignorePadding (bool);
|
||||||
bool ignorePadding();
|
bool ignorePadding();
|
||||||
bool acceptPadding();
|
bool acceptPadding();
|
||||||
bool isPaddingIgnored();
|
bool isPaddingIgnored();
|
||||||
|
|
||||||
|
// get the primary widget colors
|
||||||
short getForegroundColor() const;
|
short getForegroundColor() const;
|
||||||
short getBackgroundColor() const;
|
short getBackgroundColor() const;
|
||||||
|
|
||||||
|
// positioning
|
||||||
int getX() const;
|
int getX() const;
|
||||||
int getY() const;
|
int getY() const;
|
||||||
const FPoint getPos() const;
|
const FPoint getPos() const;
|
||||||
|
@ -493,7 +499,6 @@ class FWidget : public FObject, public FTerm
|
||||||
virtual void move (int, int);
|
virtual void move (int, int);
|
||||||
int getFlags() const;
|
int getFlags() const;
|
||||||
|
|
||||||
bool setCursor();
|
|
||||||
FPoint getCursorPos();
|
FPoint getCursorPos();
|
||||||
bool setCursorPos (const FPoint&);
|
bool setCursorPos (const FPoint&);
|
||||||
bool setCursorPos (register int, register int);
|
bool setCursorPos (register int, register int);
|
||||||
|
|
|
@ -137,6 +137,51 @@ void FWindow::adjustSize()
|
||||||
|
|
||||||
|
|
||||||
// public methods of FWindow
|
// public methods of FWindow
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWindow::drawBorder()
|
||||||
|
{
|
||||||
|
if ( isNewFont() )
|
||||||
|
{
|
||||||
|
int x1 = 1;
|
||||||
|
int x2 = 1 + getWidth() - 1;
|
||||||
|
int y1 = 1;
|
||||||
|
int y2 = 1 + getHeight() - 1;
|
||||||
|
|
||||||
|
printPos (x1, y1);
|
||||||
|
print (fc::NF_border_corner_upper_left); // ⎡
|
||||||
|
|
||||||
|
for (int x=x1+1; x < x2; x++)
|
||||||
|
print (fc::NF_border_line_upper); // ¯
|
||||||
|
|
||||||
|
print (fc::NF_rev_border_corner_upper_right); // ⎤
|
||||||
|
|
||||||
|
for (int y=y1+1; y < y2; y++)
|
||||||
|
{
|
||||||
|
printPos (x1, y);
|
||||||
|
// border left ⎸
|
||||||
|
print (fc::NF_border_line_left);
|
||||||
|
printPos (x2, y);
|
||||||
|
// border right⎹
|
||||||
|
print (fc::NF_rev_border_line_right);
|
||||||
|
}
|
||||||
|
|
||||||
|
printPos (x1, y2);
|
||||||
|
// lower left corner border ⎣
|
||||||
|
print (fc::NF_border_corner_lower_left);
|
||||||
|
|
||||||
|
for (int x=2; x < getWidth(); x++) // low line _
|
||||||
|
print (fc::NF_border_line_bottom);
|
||||||
|
|
||||||
|
printPos (x2, y2);
|
||||||
|
// lower right corner border ⎦
|
||||||
|
print (fc::NF_rev_border_corner_lower_right);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FWidget::drawBorder();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWindow::show()
|
void FWindow::show()
|
||||||
{
|
{
|
||||||
|
@ -627,7 +672,10 @@ bool FWindow::activateWindow (bool on)
|
||||||
{
|
{
|
||||||
// activate/deactivate this window
|
// activate/deactivate this window
|
||||||
if ( on )
|
if ( on )
|
||||||
|
{
|
||||||
FApplication::active_window = this;
|
FApplication::active_window = this;
|
||||||
|
active_area = getVWin();
|
||||||
|
}
|
||||||
|
|
||||||
return window_active = (on) ? true : false;
|
return window_active = (on) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,9 @@ class FWindow : public FWidget
|
||||||
~FWindow ();
|
~FWindow ();
|
||||||
|
|
||||||
const char* getClassName() const;
|
const char* getClassName() const;
|
||||||
|
// make every drawBorder from FWidget available
|
||||||
|
using FWidget::drawBorder;
|
||||||
|
virtual void drawBorder();
|
||||||
virtual void show();
|
virtual void show();
|
||||||
virtual void hide();
|
virtual void hide();
|
||||||
virtual void setWidth (int, bool = true);
|
virtual void setWidth (int, bool = true);
|
||||||
|
|
|
@ -235,7 +235,7 @@ Calc::Calc (FWidget* parent)
|
||||||
L"&="
|
L"&="
|
||||||
};
|
};
|
||||||
|
|
||||||
setlocale(LC_NUMERIC, "C");
|
std::setlocale(LC_NUMERIC, "C");
|
||||||
setText ("calculator");
|
setText ("calculator");
|
||||||
setGeometry (19, 6, 37, 18);
|
setGeometry (19, 6, 37, 18);
|
||||||
addAccelerator('q'); // press 'q' to quit
|
addAccelerator('q'); // press 'q' to quit
|
||||||
|
@ -425,7 +425,7 @@ bool Calc::isOperatorKey(int key)
|
||||||
void Calc::setDisplay (lDouble d)
|
void Calc::setDisplay (lDouble d)
|
||||||
{
|
{
|
||||||
char buffer[33];
|
char buffer[33];
|
||||||
snprintf (buffer, sizeof(buffer), "%32.11Lg", d);
|
std::snprintf (buffer, sizeof(buffer), "%32.11Lg", d);
|
||||||
input = buffer;
|
input = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,10 +450,10 @@ void Calc::calcInfixOperator()
|
||||||
switch ( infix_operator )
|
switch ( infix_operator )
|
||||||
{
|
{
|
||||||
case '*':
|
case '*':
|
||||||
if ( fabs(a) > LDBL_EPSILON ) // a != 0.0L
|
if ( std::fabs(a) > LDBL_EPSILON ) // a != 0.0L
|
||||||
{
|
{
|
||||||
// ln(a * b) = ln(a) + ln(b)
|
// ln(a * b) = ln(a) + ln(b)
|
||||||
if ( log(abs(a)) + log(abs(b)) <= log(LDBL_MAX) )
|
if ( std::log(std::abs(a)) + std::log(std::abs(b)) <= std::log(LDBL_MAX) )
|
||||||
a *= b;
|
a *= b;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -463,16 +463,16 @@ void Calc::calcInfixOperator()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
if ( fabs(b) > LDBL_EPSILON ) // b != 0.0L
|
if ( std::fabs(b) > LDBL_EPSILON ) // b != 0.0L
|
||||||
a /= b;
|
a /= b;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '+':
|
case '+':
|
||||||
if ( fabs(a) > LDBL_EPSILON ) // a != 0.0L
|
if ( std::fabs(a) > LDBL_EPSILON ) // a != 0.0L
|
||||||
{
|
{
|
||||||
if ( log(abs(a)) + log(abs(1 + b/a)) <= log(LDBL_MAX) )
|
if ( std::log(std::abs(a)) + std::log(std::abs(1 + b/a)) <= std::log(LDBL_MAX) )
|
||||||
a += b;
|
a += b;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -482,9 +482,9 @@ void Calc::calcInfixOperator()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
if ( fabs(b) > LDBL_EPSILON ) // b != 0.0L
|
if ( std::fabs(b) > LDBL_EPSILON ) // b != 0.0L
|
||||||
{
|
{
|
||||||
if ( log(abs(a)) + log(abs(1 - b/a)) <= log(LDBL_MAX) )
|
if ( std::log(std::abs(a)) + std::log(std::abs(1 - b/a)) <= std::log(LDBL_MAX) )
|
||||||
a -= b;
|
a -= b;
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -494,7 +494,7 @@ void Calc::calcInfixOperator()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '^':
|
case '^':
|
||||||
a = pow(a, b);
|
a = std::pow(a, b);
|
||||||
|
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -523,7 +523,7 @@ void Calc::onKeyPress (FKeyEvent* ev)
|
||||||
else
|
else
|
||||||
input = input.left(input.getLength() - 1);
|
input = input.left(input.getLength() - 1);
|
||||||
|
|
||||||
a = atof(input.c_str());
|
a = std::atof(input.c_str());
|
||||||
drawDispay();
|
drawDispay();
|
||||||
updateTerminal();
|
updateTerminal();
|
||||||
}
|
}
|
||||||
|
@ -541,6 +541,7 @@ void Calc::onKeyPress (FKeyEvent* ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
FDialog::onKeyPress(ev);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -586,7 +587,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
{
|
{
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
{
|
{
|
||||||
*x = log(*x + sqrt((*x) * (*x) + 1));
|
*x = std::log(*x + std::sqrt((*x) * (*x) + 1));
|
||||||
|
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -595,16 +596,16 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*x = sinh(*x);
|
*x = std::sinh(*x);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
*x = asin(*x) * 180.0L/PI;
|
*x = std::asin(*x) * 180.0L/PI;
|
||||||
else if ( fabs(fmod(*x,180.0L)) < LDBL_EPSILON ) // x/180 = 0
|
else if ( std::fabs(std::fmod(*x,180.0L)) < LDBL_EPSILON ) // x/180 = 0
|
||||||
*x = 0.0L;
|
*x = 0.0L;
|
||||||
else
|
else
|
||||||
*x = sin(*x * PI/180.0L);
|
*x = std::sin(*x * PI/180.0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( errno == EDOM )
|
if ( errno == EDOM )
|
||||||
|
@ -622,7 +623,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
{
|
{
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
{
|
{
|
||||||
*x = log(*x + sqrt((*x) * (*x) - 1));
|
*x = std::log(*x + std::sqrt((*x) * (*x) - 1));
|
||||||
|
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -631,16 +632,16 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*x = cosh(*x);
|
*x = std::cosh(*x);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
*x = acos(*x) * 180.0L/PI;
|
*x = std::acos(*x) * 180.0L/PI;
|
||||||
else if ( fabs(fmod(*x - 90.0L,180.0L)) < LDBL_EPSILON ) // (x - 90)/180 == 0
|
else if ( std::fabs(std::fmod(*x - 90.0L,180.0L)) < LDBL_EPSILON ) // (x - 90)/180 == 0
|
||||||
*x = 0.0L;
|
*x = 0.0L;
|
||||||
else
|
else
|
||||||
*x = cos(*x * PI/180.0L);
|
*x = std::cos(*x * PI/180.0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( errno == EDOM )
|
if ( errno == EDOM )
|
||||||
|
@ -659,7 +660,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
if ( *x < 1 )
|
if ( *x < 1 )
|
||||||
{
|
{
|
||||||
*x = 0.5L * log((1+(*x))/(1-(*x)));
|
*x = 0.5L * std::log((1+(*x))/(1-(*x)));
|
||||||
|
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -667,21 +668,21 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
else
|
else
|
||||||
error = true;
|
error = true;
|
||||||
else
|
else
|
||||||
*x = tanh(*x);
|
*x = std::tanh(*x);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( arcus_mode )
|
if ( arcus_mode )
|
||||||
*x = atan(*x) * 180.0L/PI;
|
*x = std::atan(*x) * 180.0L/PI;
|
||||||
else
|
else
|
||||||
// Test if (x/180) != 0 and x/90 == 0
|
// Test if (x/180) != 0 and x/90 == 0
|
||||||
if ( fabs(fmod(*x,180.0L)) > LDBL_EPSILON
|
if ( std::fabs(std::fmod(*x,180.0L)) > LDBL_EPSILON
|
||||||
&& fabs(fmod(*x,90.0L)) < LDBL_EPSILON )
|
&& std::fabs(std::fmod(*x,90.0L)) < LDBL_EPSILON )
|
||||||
error = true;
|
error = true;
|
||||||
else if ( fabs(fmod(*x,180.0L)) < LDBL_EPSILON ) // x/180 == 0
|
else if ( std::fabs(std::fmod(*x,180.0L)) < LDBL_EPSILON ) // x/180 == 0
|
||||||
*x = 0.0L;
|
*x = 0.0L;
|
||||||
else
|
else
|
||||||
*x = tan(*x * PI/180.0L);
|
*x = std::tan(*x * PI/180.0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( errno == EDOM )
|
if ( errno == EDOM )
|
||||||
|
@ -695,7 +696,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Reciprocal: // 1/x
|
case Reciprocal: // 1/x
|
||||||
if ( fabs(*x) < LDBL_EPSILON ) // x == 0
|
if ( std::fabs(*x) < LDBL_EPSILON ) // x == 0
|
||||||
error = true;
|
error = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -717,7 +718,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Natural_logarithm: // ln
|
case Natural_logarithm: // ln
|
||||||
*x = log(*x);
|
*x = std::log(*x);
|
||||||
|
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -726,7 +727,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Powers_of_e: // eˣ
|
case Powers_of_e: // eˣ
|
||||||
*x = exp(*x);
|
*x = std::exp(*x);
|
||||||
|
|
||||||
if ( errno == ERANGE )
|
if ( errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -743,7 +744,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Square_root: // sqrt
|
case Square_root: // sqrt
|
||||||
*x = sqrt(*x);
|
*x = std::sqrt(*x);
|
||||||
|
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -760,7 +761,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common_logarithm: // lg
|
case Common_logarithm: // lg
|
||||||
*x = log10(*x);
|
*x = std::log10(*x);
|
||||||
|
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -769,7 +770,7 @@ void Calc::cb_buttonClicked (FWidget*, void* data_ptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Powers_of_ten: // 10ˣ
|
case Powers_of_ten: // 10ˣ
|
||||||
*x = pow(10,*x);
|
*x = std::pow(10,*x);
|
||||||
|
|
||||||
if ( errno == EDOM || errno == ERANGE )
|
if ( errno == EDOM || errno == ERANGE )
|
||||||
error = true;
|
error = true;
|
||||||
|
|
|
@ -34,7 +34,7 @@ keyboard::keyboard (FWidget* parent)
|
||||||
void keyboard::onKeyPress (FKeyEvent* ev)
|
void keyboard::onKeyPress (FKeyEvent* ev)
|
||||||
{
|
{
|
||||||
int key_id = ev->key();
|
int key_id = ev->key();
|
||||||
::printf("Key %s (id %d)\n\r", getKeyName(key_id).c_str(), key_id);
|
std::printf("Key %s (id %d)\n\r", getKeyName(key_id).c_str(), key_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -58,16 +58,17 @@ void Mandelbrot::draw()
|
||||||
|
|
||||||
xoffset = 2;
|
xoffset = 2;
|
||||||
yoffset = 2;
|
yoffset = 2;
|
||||||
|
current_line = 0;
|
||||||
Cols = getClientWidth();
|
Cols = getClientWidth();
|
||||||
Lines = getClientHeight();
|
Lines = getClientHeight();
|
||||||
current_line = 1;
|
|
||||||
|
|
||||||
dX = (x_max - x_min) / (Cols - 1);
|
dX = (x_max - x_min) / (Cols - 1);
|
||||||
dY = (y_max - y_min) / Lines;
|
dY = (y_max - y_min) / Lines;
|
||||||
|
|
||||||
for (y0=y_min; y0 < y_max && current_line <= Lines; y0+=dY)
|
for (y0=y_min; y0 < y_max && current_line < Lines; y0+=dY)
|
||||||
{
|
{
|
||||||
printPos (xoffset, yoffset+current_line);
|
current_line++;
|
||||||
|
printPos (xoffset, yoffset + current_line);
|
||||||
|
|
||||||
for (x0=x_min; x0 < x_max; x0+=dX)
|
for (x0=x_min; x0 < x_max; x0+=dX)
|
||||||
{
|
{
|
||||||
|
@ -90,8 +91,6 @@ void Mandelbrot::draw()
|
||||||
|
|
||||||
print(' ');
|
print(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
current_line++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateVTerm(true);
|
updateVTerm(true);
|
||||||
|
|
|
@ -276,14 +276,14 @@ void Menu::adjustSize()
|
||||||
|
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if ( argv[1] && ( strcmp(argv[1], "--help") == 0
|
if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0
|
||||||
|| strcmp(argv[1], "-h") == 0 ) )
|
|| std::strcmp(argv[1], "-h") == 0 ) )
|
||||||
{
|
{
|
||||||
std::cout << "Generic options:" << std::endl
|
std::cout << "Generic options:" << std::endl
|
||||||
<< " -h, --help "
|
<< " -h, --help "
|
||||||
<< "Display this help and exit" << std::endl;
|
<< "Display this help and exit" << std::endl;
|
||||||
FApplication::print_cmd_Options();
|
FApplication::print_cmd_Options();
|
||||||
exit(EXIT_SUCCESS);
|
std::exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
FApplication app (argc, argv);
|
FApplication app (argc, argv);
|
||||||
|
|
|
@ -14,12 +14,12 @@ int main (int, char**)
|
||||||
printf ("----------------[ terminal ]-------------------\n");
|
printf ("----------------[ terminal ]-------------------\n");
|
||||||
|
|
||||||
// init current locale
|
// init current locale
|
||||||
printf (" Locale: %s\n", setlocale(LC_CTYPE, "") );
|
printf (" Locale: %s\n", std::setlocale(LC_CTYPE, "") );
|
||||||
|
|
||||||
if ( isatty(1) && ! strcmp(nl_langinfo(CODESET), "ANSI_X3.4-1968") )
|
if ( isatty(1) && ! std::strcmp(nl_langinfo(CODESET), "ANSI_X3.4-1968") )
|
||||||
{
|
{
|
||||||
// locale C -> switch from 7bit ascii -> latin1
|
// locale C -> switch from 7bit ascii -> latin1
|
||||||
setlocale(LC_ALL, "en_US");
|
std::setlocale(LC_ALL, "en_US");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf (" Codeset: %s\n", nl_langinfo(CODESET));
|
printf (" Codeset: %s\n", nl_langinfo(CODESET));
|
||||||
|
@ -155,7 +155,7 @@ int main (int, char**)
|
||||||
std::cerr << "Arithmetic error: " << ex.what() << std::endl;
|
std::cerr << "Arithmetic error: " << ex.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
setlocale(LC_NUMERIC, "C");
|
std::setlocale(LC_NUMERIC, "C");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -185,7 +185,7 @@ int main (int, char**)
|
||||||
std::cout << " setNumber: "
|
std::cout << " setNumber: "
|
||||||
<< num3 << " (long double)" << std::endl;
|
<< num3 << " (long double)" << std::endl;
|
||||||
|
|
||||||
setlocale (LC_NUMERIC, "");
|
std::setlocale (LC_NUMERIC, "");
|
||||||
FString fnum1, fnum2;
|
FString fnum1, fnum2;
|
||||||
#if defined(__LP64__) || defined(_LP64)
|
#if defined(__LP64__) || defined(_LP64)
|
||||||
// 64-bit architecture
|
// 64-bit architecture
|
||||||
|
|
|
@ -39,7 +39,7 @@ timer::timer (FWidget* parent)
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void timer::onTimer (FTimerEvent* ev)
|
void timer::onTimer (FTimerEvent* ev)
|
||||||
{
|
{
|
||||||
::printf("timer event, id %d\n\r", ev->timerId() );
|
std::printf("timer event, id %d\n\r", ev->timerId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -267,14 +267,14 @@ void MainWindow::onTimer (FTimerEvent*)
|
||||||
|
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if ( argv[1] && ( strcmp(argv[1], "--help") == 0
|
if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0
|
||||||
|| strcmp(argv[1], "-h") == 0 ) )
|
|| std::strcmp(argv[1], "-h") == 0 ) )
|
||||||
{
|
{
|
||||||
std::cout << "Generic options:" << std::endl
|
std::cout << "Generic options:" << std::endl
|
||||||
<< " -h, --help "
|
<< " -h, --help "
|
||||||
<< "Display this help and exit" << std::endl;
|
<< "Display this help and exit" << std::endl;
|
||||||
FApplication::print_cmd_Options();
|
FApplication::print_cmd_Options();
|
||||||
exit(EXIT_SUCCESS);
|
std::exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
FApplication app (argc, argv);
|
FApplication app (argc, argv);
|
||||||
|
|
|
@ -895,14 +895,14 @@ int main (int argc, char* argv[])
|
||||||
FString ver = F_VERSION; // library version
|
FString ver = F_VERSION; // library version
|
||||||
FString title = "The FINAL CUT " + ver + " (C) 2016 by Markus Gans";
|
FString title = "The FINAL CUT " + ver + " (C) 2016 by Markus Gans";
|
||||||
|
|
||||||
if ( argv[1] && ( strcmp(argv[1], "--help") == 0
|
if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0
|
||||||
|| strcmp(argv[1], "-h") == 0 ) )
|
|| std::strcmp(argv[1], "-h") == 0 ) )
|
||||||
{
|
{
|
||||||
std::cout << "Generic options:" << std::endl
|
std::cout << "Generic options:" << std::endl
|
||||||
<< " -h, --help "
|
<< " -h, --help "
|
||||||
<< "Display this help and exit" << std::endl;
|
<< "Display this help and exit" << std::endl;
|
||||||
FApplication::print_cmd_Options();
|
FApplication::print_cmd_Options();
|
||||||
exit(EXIT_SUCCESS);
|
std::exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
FApplication app(argc, argv);
|
FApplication app(argc, argv);
|
||||||
|
|
|
@ -117,11 +117,11 @@ watch::~watch()
|
||||||
void watch::printTime()
|
void watch::printTime()
|
||||||
{
|
{
|
||||||
FString str;
|
FString str;
|
||||||
struct tm* now;
|
std::tm* now;
|
||||||
time_t t;
|
std::time_t t;
|
||||||
|
|
||||||
t = time(0); // get current time
|
t = std::time(0); // get current time
|
||||||
now = localtime(&t);
|
now = std::localtime(&t);
|
||||||
|
|
||||||
if ( sec )
|
if ( sec )
|
||||||
str.sprintf("%02d:%02d:%02d", now->tm_hour, now->tm_min, now->tm_sec);
|
str.sprintf("%02d:%02d:%02d", now->tm_hour, now->tm_min, now->tm_sec);
|
||||||
|
|
|
@ -565,14 +565,14 @@ void Window::adjustSize()
|
||||||
|
|
||||||
int main (int argc, char* argv[])
|
int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if ( argv[1] && ( strcmp(argv[1], "--help") == 0
|
if ( argv[1] && ( std::strcmp(argv[1], "--help") == 0
|
||||||
|| strcmp(argv[1], "-h") == 0 ) )
|
|| std::strcmp(argv[1], "-h") == 0 ) )
|
||||||
{
|
{
|
||||||
std::cout << "Generic options:" << std::endl
|
std::cout << "Generic options:" << std::endl
|
||||||
<< " -h, --help "
|
<< " -h, --help "
|
||||||
<< "Display this help and exit" << std::endl;
|
<< "Display this help and exit" << std::endl;
|
||||||
FApplication::print_cmd_Options();
|
FApplication::print_cmd_Options();
|
||||||
exit(EXIT_SUCCESS);
|
std::exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
FApplication app (argc, argv);
|
FApplication app (argc, argv);
|
||||||
|
|
Loading…
Reference in New Issue