New Method setInsertCursorStyle()

This commit is contained in:
Markus Gans 2017-04-05 22:25:20 +02:00
parent 6b5f033b7b
commit 7f134ccada
5 changed files with 46 additions and 54 deletions

View File

@ -2,6 +2,8 @@
* Replace non-printable characters for Tera Term and
Cygwin terminal directly at start-up. Special cases
in the code are no longer necessary.
* New Method setInsertCursorStyle() to change the appearance
of a cursor
2017-04-02 Markus Gans <guru.mail@muenster.de>
* Remap the meta key to left alt key at runtime

View File

@ -50,14 +50,7 @@ FLineEdit::FLineEdit (const FString& txt, FWidget* parent)
FLineEdit::~FLineEdit() // destructor
{
if ( ! insert_mode )
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
}
setInsertCursorStyle();
}
@ -314,23 +307,9 @@ void FLineEdit::onKeyPress (FKeyEvent* ev)
insert_mode = not insert_mode;
if ( insert_mode )
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
}
setInsertCursorStyle();
else
{
setXTermCursorStyle(fc::steady_block);
setKDECursor(fc::BlockCursor);
setConsoleCursor(fc::full_block_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:eeee/0000/0000");
}
unsetInsertCursorStyle();
ev->accept();
break;
@ -593,34 +572,16 @@ void FLineEdit::onAccel (FAccelEvent* ev)
void FLineEdit::onHide (FHideEvent*)
{
if ( ! insert_mode )
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
}
setInsertCursorStyle();
}
//----------------------------------------------------------------------
void FLineEdit::onFocusIn (FFocusEvent*)
{
if ( insert_mode )
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
}
setInsertCursorStyle();
else
{
setXTermCursorStyle(fc::steady_block);
setKDECursor(fc::BlockCursor);
setConsoleCursor(fc::full_block_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:0000/0000/0000");
}
unsetInsertCursorStyle();
if ( getStatusBar() )
{
@ -640,14 +601,7 @@ void FLineEdit::onFocusOut (FFocusEvent*)
}
if ( ! insert_mode )
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
}
setInsertCursorStyle();
}

View File

@ -703,6 +703,29 @@ bool FVTerm::isChildPrintArea() const
return false;
}
//----------------------------------------------------------------------
void FVTerm::setInsertCursorStyle (bool on)
{
if ( on )
{
setXTermCursorStyle(fc::blinking_underline);
setKDECursor(fc::UnderlineCursor);
setConsoleCursor(fc::underscore_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:ffff/ffff/ffff");
}
else
{
setXTermCursorStyle(fc::steady_block);
setKDECursor(fc::BlockCursor);
setConsoleCursor(fc::full_block_cursor, isCursorHidden());
if ( isUrxvtTerminal() )
setXTermCursorColor("rgb:eeee/0000/0000");
}
}
//----------------------------------------------------------------------
void FVTerm::createArea ( const FRect& r
, const FPoint& p

View File

@ -286,6 +286,11 @@ class FVTerm : public FObject, public FTerm
bool isChildPrintArea() const;
bool isVirtualWindow() const;
// Mutator
static void setInsertCursorStyle (bool on);
static void setInsertCursorStyle();
static void unsetInsertCursorStyle();
// Methods
void createArea ( const FRect&
, const FPoint&
@ -760,6 +765,14 @@ inline bool FVTerm::hasChildPrintArea() const
inline bool FVTerm::isVirtualWindow() const
{ return vwin; }
//----------------------------------------------------------------------
inline void FVTerm::setInsertCursorStyle()
{ setInsertCursorStyle(true); }
//----------------------------------------------------------------------
inline void FVTerm::unsetInsertCursorStyle()
{ setInsertCursorStyle(false); }
//----------------------------------------------------------------------
inline void FVTerm::setPrintArea (term_area* area)
{ print_area = area; }

View File

@ -112,7 +112,7 @@ int main (int argc, char* argv[])
tcapString ( "| The SecDA String"
, terminal->getSecDAString().c_str() );
std::cout << "'------------------- debug -------------------\r\n";
std::cout << "`------------------- debug -------------------\r\n";
#endif
std::cout << "\r\n[Booleans]\r\n";