Further small code improvements

This commit is contained in:
Markus Gans 2020-04-20 01:01:20 +02:00
parent 88667f2cbb
commit 803e54d456
21 changed files with 167 additions and 162 deletions

View File

@ -74,7 +74,7 @@ class ColorChooser final : public finalcut::FWidget
ColorChooser::ColorChooser (finalcut::FWidget* parent) ColorChooser::ColorChooser (finalcut::FWidget* parent)
: FWidget(parent) : FWidget(parent)
{ {
setSize (FSize(8, 12)); FWidget::setSize (FSize(8, 12));
setFixedSize (FSize(8, 12)); setFixedSize (FSize(8, 12));
unsetFocusable(); unsetFocusable();
@ -228,7 +228,7 @@ class Brushes final : public finalcut::FWidget
Brushes::Brushes (finalcut::FWidget* parent) Brushes::Brushes (finalcut::FWidget* parent)
: FWidget(parent) : FWidget(parent)
{ {
setSize (FSize(8, 4)); FWidget::setSize (FSize(8, 4));
setFixedSize (FSize(8, 4)); setFixedSize (FSize(8, 4));
unsetFocusable(); unsetFocusable();

View File

@ -122,7 +122,7 @@ void streamingIntoFStringExample()
// ...from wide string // ...from wide string
finalcut::FString streamer3; finalcut::FString streamer3;
wchar_t* wchar_str{const_cast<wchar_t*>(L"wchar_t*")}; const wchar_t* wchar_str{const_cast<wchar_t*>(L"wchar_t*")};
streamer3 << wchar_str; streamer3 << wchar_str;
std::cout << " stream in: " << streamer3 << std::endl; std::cout << " stream in: " << streamer3 << std::endl;
@ -133,7 +133,7 @@ void streamingIntoFStringExample()
// ...from c-string // ...from c-string
finalcut::FString streamer5; finalcut::FString streamer5;
char* char_str{C_STR("char*")}; const char* char_str{C_STR("char*")};
streamer5 << char_str; streamer5 << char_str;
std::cout << " stream in: " << streamer5 << std::endl; std::cout << " stream in: " << streamer5 << std::endl;

View File

@ -238,13 +238,12 @@ class AttribDemo final : public finalcut::FWidget
void draw() override; void draw() override;
// Data member // Data member
FColor last_color; FColor last_color{FColor(getMaxColor())};
}; };
//---------------------------------------------------------------------- //----------------------------------------------------------------------
AttribDemo::AttribDemo (finalcut::FWidget* parent) AttribDemo::AttribDemo (finalcut::FWidget* parent)
: finalcut::FWidget(parent) : finalcut::FWidget(parent)
, last_color(FColor(getMaxColor()))
{ {
if ( isMonochron() ) if ( isMonochron() )
last_color = 1; last_color = 1;

View File

@ -57,9 +57,6 @@ class Transparent final : public finalcut::FDialog
// Disable copy assignment operator (=) // Disable copy assignment operator (=)
Transparent& operator = (const Transparent&) = delete; Transparent& operator = (const Transparent&) = delete;
// Mutator
void setStatusbarMessage (const finalcut::FString&) override;
private: private:
// Method // Method
void draw() override; void draw() override;
@ -78,21 +75,15 @@ Transparent::Transparent ( finalcut::FWidget* parent
, type(tt) , type(tt)
{ {
// Set statusbar text for this window // Set statusbar text for this window
setStatusbarMessage("Press Q to quit"); // Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FWidget::setStatusbarMessage("Press Q to quit");
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Transparent::~Transparent() Transparent::~Transparent()
{ } { }
//----------------------------------------------------------------------
void Transparent::setStatusbarMessage (const finalcut::FString& msg)
{
// Avoids calling a virtual function from the constructor
// (CERT, OOP50-CPP)
FWidget::setStatusbarMessage(msg);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void Transparent::draw() void Transparent::draw()
{ {

View File

@ -678,11 +678,8 @@ bool FApplication::processAccelerator (const FWidget* const& widget)
auto iter = widget->getAcceleratorList().begin(); auto iter = widget->getAcceleratorList().begin();
const auto& last = widget->getAcceleratorList().end(); const auto& last = widget->getAcceleratorList().end();
while ( iter != last ) while ( iter != last && ! quit_now && ! app_exit_loop )
{ {
if ( quit_now || app_exit_loop )
break;
if ( iter->key == keyboard->getKey() ) if ( iter->key == keyboard->getKey() )
{ {
// unset the move/size mode // unset the move/size mode

View File

@ -504,7 +504,7 @@ int FFileDialog::readDir()
while ( true ) while ( true )
{ {
errno = 0; errno = 0;
struct dirent* next = readdir(directory_stream); const struct dirent* next = readdir(directory_stream);
if ( next ) if ( next )
{ {

View File

@ -405,13 +405,12 @@ void FLabel::printLine (FString& line)
for (std::size_t z{0}; z < to_char; z++) for (std::size_t z{0}; z < to_char; z++)
{ {
if ( ! std::iswprint(std::wint_t(line[z])) ) if ( ! std::iswprint(std::wint_t(line[z]))
&& ! isNewFont()
&& ( line[z] < fc::NF_rev_left_arrow2
|| line[z] > fc::NF_check_mark ) )
{ {
if ( ! isNewFont() && ( line[z] < fc::NF_rev_left_arrow2 line[z] = L' ';
|| line[z] > fc::NF_check_mark ) )
{
line[z] = L' ';
}
} }
if ( z == hotkeypos && getFlags().active ) if ( z == hotkeypos && getFlags().active )

View File

@ -317,13 +317,13 @@ void FMenu::onMouseMove (FMouseEvent* ev)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::cb_menuitemEnabled (FWidget*, const FDataPtr) void FMenu::cb_menuitemEnabled (const FWidget*, const FDataPtr)
{ {
setEnable(); setEnable();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMenu::cb_menuitemDisabled (FWidget*, const FDataPtr) void FMenu::cb_menuitemDisabled (const FWidget*, const FDataPtr)
{ {
setDisable(); setDisable();
} }

View File

@ -294,7 +294,7 @@ void FMouse::setEvent()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FMouse::isDblclickTimeout (timeval* time) bool FMouse::isDblclickTimeout (const timeval* time)
{ {
return FObject::isTimeout (time, dblclick_interval); return FObject::isTimeout (time, dblclick_interval);
} }
@ -652,7 +652,7 @@ void FMouseX11::setMoveState (const FPoint& mouse_position, int btn)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMouseX11::setButtonState (const int btn, struct timeval* time) void FMouseX11::setButtonState (const int btn, const struct timeval* time)
{ {
// Get the x11 mouse button state // Get the x11 mouse button state
@ -1132,7 +1132,7 @@ void FMouseUrxvt::setMoveState (const FPoint& mouse_position, int btn)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMouseUrxvt::setButtonState (const int btn, struct timeval* time) void FMouseUrxvt::setButtonState (const int btn, const struct timeval* time)
{ {
// Get the urxvt mouse button state // Get the urxvt mouse button state

View File

@ -956,16 +956,16 @@ bool FOptiAttr::setTermAttributes ( FChar*& term
{ {
if ( term && F_set_attributes.cap ) if ( term && F_set_attributes.cap )
{ {
char* sgr = tparm ( F_set_attributes.cap const char* sgr = tparm ( F_set_attributes.cap
, p1 && ! fake_reverse , p1 && ! fake_reverse
, p2 , p2
, p3 && ! fake_reverse , p3 && ! fake_reverse
, p4 , p4
, p5 , p5
, p6 , p6
, p7 , p7
, p8 , p8
, p9 ); , p9 );
append_sequence (sgr); append_sequence (sgr);
resetColor(term); resetColor(term);
term->attr.bit.standout = p1; term->attr.bit.standout = p1;
@ -1458,7 +1458,7 @@ inline void FOptiAttr::change_to_default_color ( FChar*& term
} }
else if ( bg == fc::Default && term->bg_color != fc::Default ) else if ( bg == fc::Default && term->bg_color != fc::Default )
{ {
char* sgr_49; const char* sgr_49;
const auto& op = F_orig_pair.cap; const auto& op = F_orig_pair.cap;
if ( op && std::strncmp (op, CSI "39;49;25m", 11) == 0 ) if ( op && std::strncmp (op, CSI "39;49;25m", 11) == 0 )
@ -1482,7 +1482,7 @@ inline void FOptiAttr::change_to_default_color ( FChar*& term
inline void FOptiAttr::change_current_color ( const FChar* const& term inline void FOptiAttr::change_current_color ( const FChar* const& term
, FColor fg, FColor bg ) , FColor fg, FColor bg )
{ {
char* color_str{}; const char* color_str{};
const auto& AF = F_set_a_foreground.cap; const auto& AF = F_set_a_foreground.cap;
const auto& AB = F_set_a_background.cap; const auto& AB = F_set_a_background.cap;
const auto& Sf = F_set_foreground.cap; const auto& Sf = F_set_foreground.cap;

View File

@ -267,7 +267,7 @@ void FOptiMove::set_cursor_address (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tgoto(cap, 23, 23); const 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 = capDurationToLength (F_cursor_address.duration); F_cursor_address.length = capDurationToLength (F_cursor_address.duration);
@ -285,7 +285,7 @@ void FOptiMove::set_column_address (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0);
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 = capDurationToLength (F_column_address.duration); F_column_address.length = capDurationToLength (F_column_address.duration);
@ -303,7 +303,7 @@ void FOptiMove::set_row_address (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0);
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 = capDurationToLength (F_row_address.duration); F_row_address.length = capDurationToLength (F_row_address.duration);
@ -321,7 +321,7 @@ void FOptiMove::set_parm_up_cursor (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0);
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 = capDurationToLength (F_parm_up_cursor.duration); F_parm_up_cursor.length = capDurationToLength (F_parm_up_cursor.duration);
@ -339,7 +339,7 @@ void FOptiMove::set_parm_down_cursor (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0);
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 = capDurationToLength (F_parm_down_cursor.duration); F_parm_down_cursor.length = capDurationToLength (F_parm_down_cursor.duration);
@ -357,7 +357,7 @@ void FOptiMove::set_parm_left_cursor (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0);
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 = capDurationToLength (F_parm_left_cursor.duration); F_parm_left_cursor.length = capDurationToLength (F_parm_left_cursor.duration);
@ -375,7 +375,7 @@ void FOptiMove::set_parm_right_cursor (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0);
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 = capDurationToLength (F_parm_right_cursor.duration); F_parm_right_cursor.length = capDurationToLength (F_parm_right_cursor.duration);
@ -393,7 +393,7 @@ void FOptiMove::set_erase_chars (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(cap, 23, 0, 0, 0, 0, 0, 0, 0, 0);
F_erase_chars.cap = cap; F_erase_chars.cap = cap;
F_erase_chars.duration = capDuration (temp, 1); F_erase_chars.duration = capDuration (temp, 1);
F_erase_chars.length = capDurationToLength (F_erase_chars.duration); F_erase_chars.length = capDurationToLength (F_erase_chars.duration);
@ -411,7 +411,7 @@ void FOptiMove::set_repeat_char (char cap[])
{ {
if ( cap ) if ( cap )
{ {
char* temp = tparm(cap, ' ', 23, 0, 0, 0, 0, 0, 0, 0); const char* temp = tparm(cap, ' ', 23, 0, 0, 0, 0, 0, 0, 0);
F_repeat_char.cap = cap; F_repeat_char.cap = cap;
F_repeat_char.duration = capDuration (temp, 1); F_repeat_char.duration = capDuration (temp, 1);
F_repeat_char.length = capDurationToLength (F_repeat_char.duration); F_repeat_char.length = capDurationToLength (F_repeat_char.duration);

View File

@ -217,35 +217,32 @@ void FStatusBar::drawMessage()
if ( isMonochron() ) if ( isMonochron() )
setReverse(true); setReverse(true);
if ( x + space_offset + 3 < int(termWidth) ) if ( x + space_offset + 3 < int(termWidth) && text )
{ {
if ( text ) if ( ! isLastActiveFocus )
{ {
if ( ! isLastActiveFocus ) x++;
{ print (' ');
x++; }
print (' ');
}
if ( hasKeys ) if ( hasKeys )
{ {
x += 2; x += 2;
print (fc::BoxDrawingsVertical); // │ print (fc::BoxDrawingsVertical); // │
print (' '); print (' ');
} }
const auto msg_length = getColumnWidth(getMessage()); const auto msg_length = getColumnWidth(getMessage());
x += int(msg_length); x += int(msg_length);
if ( x - 1 <= int(termWidth) ) if ( x - 1 <= int(termWidth) )
print (getMessage()); print (getMessage());
else else
{ {
// Print ellipsis // Print ellipsis
const std::size_t len = msg_length + termWidth - uInt(x) - 1; const std::size_t len = msg_length + termWidth - uInt(x) - 1;
print() << getColumnSubString ( getMessage(), 1, len) print() << getColumnSubString ( getMessage(), 1, len)
<< ".."; << "..";
}
} }
} }

View File

@ -918,9 +918,7 @@ inline char* FTermDetection::secDA_Analysis_65 (char current_termtype[])
{ {
// Terminal ID 65 - DEC VT525 // Terminal ID 65 - DEC VT525
char* new_termtype = current_termtype; return secDA_Analysis_1 (current_termtype);
new_termtype = secDA_Analysis_vte(new_termtype);
return new_termtype;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -1886,7 +1886,7 @@ void FWidget::setWindowFocus (bool enable)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FWidget::FCallbackPtr FWidget::getCallbackPtr (FCallback cb_function) FWidget::FCallbackPtr FWidget::getCallbackPtr (const FCallback& cb_function)
{ {
return *cb_function.template target<FCallbackPtr>(); return *cb_function.template target<FCallbackPtr>();
} }

View File

@ -73,6 +73,7 @@ class FMenu : public FWindow, public FMenuList
public: public:
// Using-declaration // Using-declaration
using FMenuList::getItem; using FMenuList::getItem;
using FMenuList::isSelected;
// Constructor // Constructor
explicit FMenu (FWidget* = nullptr); explicit FMenu (FWidget* = nullptr);
@ -123,8 +124,8 @@ class FMenu : public FWindow, public FMenuList
void onAccel (FAccelEvent*) override; void onAccel (FAccelEvent*) override;
// Callback method // Callback method
void cb_menuitemEnabled (FWidget*, const FDataPtr); void cb_menuitemEnabled (const FWidget*, const FDataPtr);
void cb_menuitemDisabled (FWidget*, const FDataPtr); void cb_menuitemDisabled (const FWidget*, const FDataPtr);
void cb_menuitemToggled (FWidget*, const FDataPtr); void cb_menuitemToggled (FWidget*, const FDataPtr);
private: private:

View File

@ -176,7 +176,7 @@ class FMouse
void resetMousePressedTime(); void resetMousePressedTime();
// Inquiry // Inquiry
bool isDblclickTimeout (timeval*); bool isDblclickTimeout (const timeval*);
private: private:
// Data members // Data members
@ -312,7 +312,7 @@ class FMouseX11 final : public FMouse
// Methods // Methods
void setKeyState (int); void setKeyState (int);
void setMoveState (const FPoint&, int); void setMoveState (const FPoint&, int);
void setButtonState (const int, struct timeval*); void setButtonState (const int, const struct timeval*);
// Data member // Data member
char x11_mouse[MOUSE_BUF_SIZE]{'\0'}; char x11_mouse[MOUSE_BUF_SIZE]{'\0'};
@ -430,7 +430,7 @@ class FMouseUrxvt final : public FMouse
// Methods // Methods
void setKeyState (int); void setKeyState (int);
void setMoveState (const FPoint&, int); void setMoveState (const FPoint&, int);
void setButtonState (const int, struct timeval*); void setButtonState (const int, const struct timeval*);
// Data members // Data members
char urxvt_mouse[MOUSE_BUF_SIZE]{'\0'}; char urxvt_mouse[MOUSE_BUF_SIZE]{'\0'};

View File

@ -155,6 +155,9 @@ class FTermDetection final
static void detect(); static void detect();
private: private:
struct colorEnv; // forward declaration
struct secondaryDA; // forward declaration
// Methods // Methods
static void deallocation(); static void deallocation();
static void getSystemTermType(); static void getSystemTermType();
@ -205,26 +208,36 @@ class FTermDetection final
static FTermData* fterm_data; static FTermData* fterm_data;
static FSystem* fsystem; static FSystem* fsystem;
static FTerminalType terminal_type; static FTerminalType terminal_type;
static colorEnv color_env;
static struct colorEnv static secondaryDA secondary_da;
{
char* string1{nullptr};
char* string2{nullptr};
char* string3{nullptr};
char* string4{nullptr};
char* string5{nullptr};
char* string6{nullptr};
char* string7{nullptr};
} color_env;
static struct secondaryDA
{
int terminal_id_type{-1};
int terminal_id_version{-1};
int terminal_id_hardware{-1};
} secondary_da;
}; };
//----------------------------------------------------------------------
// struct FTermDetection::colorEnv
//----------------------------------------------------------------------
struct FTermDetection::colorEnv
{
char* string1{nullptr};
char* string2{nullptr};
char* string3{nullptr};
char* string4{nullptr};
char* string5{nullptr};
char* string6{nullptr};
char* string7{nullptr};
};
//----------------------------------------------------------------------
// struct FTermDetection::secondaryDA
//----------------------------------------------------------------------
struct FTermDetection::secondaryDA
{
int terminal_id_type{-1};
int terminal_id_version{-1};
int terminal_id_hardware{-1};
};
// FTermDetection inline functions // FTermDetection inline functions
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline const FString FTermDetection::getClassName() const inline const FString FTermDetection::getClassName() const

View File

@ -131,7 +131,7 @@ class FTermLinux final
uChar ctrl : 1; // 0..1 uChar ctrl : 1; // 0..1
uChar alt : 1; // 0..1 uChar alt : 1; // 0..1
uChar : 4; // padding bits uChar : 4; // padding bits
} mod_key{}; };
typedef struct typedef struct
{ {
@ -197,6 +197,7 @@ class FTermLinux final
ColorMap saved_color_map{}; ColorMap saved_color_map{};
ColorMap cmap{}; ColorMap cmap{};
int framebuffer_bpp{-1}; int framebuffer_bpp{-1};
modifier_key mod_key{};
#endif // defined(__linux__) #endif // defined(__linux__)
}; };

View File

@ -107,6 +107,36 @@ struct getPrecision
typedef std::unordered_map<wchar_t, wchar_t> charSubstitution; typedef std::unordered_map<wchar_t, wchar_t> charSubstitution;
struct FCharAttribute
{
// Attribute byte #0
uInt8 bold : 1; // bold
uInt8 dim : 1; // dim
uInt8 italic : 1; // italic
uInt8 underline : 1; // underline
uInt8 blink : 1; // blink
uInt8 reverse : 1; // reverse
uInt8 standout : 1; // standout
uInt8 invisible : 1; // invisible
// Attribute byte #1
uInt8 protect : 1; // protect mode
uInt8 crossed_out : 1; // crossed out
uInt8 dbl_underline : 1; // double underline
uInt8 alt_charset : 1; // alternate character set (vt100)
uInt8 pc_charset : 1; // pc character set (CP437)
uInt8 transparent : 1; // transparent
uInt8 color_overlay : 1; // color overlay
uInt8 inherit_background : 1; // inherit background
// Attribute byte #2
uInt8 no_changes : 1; // no changes required
uInt8 printed : 1; // is printed to VTerm
uInt8 fullwidth_padding : 1; // padding char (after a full-width char)
uInt8 char_width : 2; // number of character cells on screen
uInt8 : 3; // padding bits
// Attribute byte #3
uInt8 : 8; // padding byte
};
typedef struct typedef struct
{ {
wchar_t ch; // character code wchar_t ch; // character code
@ -116,40 +146,12 @@ typedef struct
union attribute union attribute
{ {
struct FCharAttribute bit;
{
// Attribute byte #0
uInt8 bold : 1; // bold
uInt8 dim : 1; // dim
uInt8 italic : 1; // italic
uInt8 underline : 1; // underline
uInt8 blink : 1; // blink
uInt8 reverse : 1; // reverse
uInt8 standout : 1; // standout
uInt8 invisible : 1; // invisible
// Attribute byte #1
uInt8 protect : 1; // protect mode
uInt8 crossed_out : 1; // crossed out
uInt8 dbl_underline : 1; // double underline
uInt8 alt_charset : 1; // alternate character set (vt100)
uInt8 pc_charset : 1; // pc character set (CP437)
uInt8 transparent : 1; // transparent
uInt8 color_overlay : 1; // color overlay
uInt8 inherit_background : 1; // inherit background
// Attribute byte #2
uInt8 no_changes : 1; // no changes required
uInt8 printed : 1; // is printed to VTerm
uInt8 fullwidth_padding : 1; // padding char (after a full-width char)
uInt8 char_width : 2; // number of character cells on screen
uInt8 : 3; // padding bits
// Attribute byte #3
uInt8 : 8; // padding byte
} bit;
uInt8 byte[4]; uInt8 byte[4];
} attr; } attr;
} FChar; } FChar;
namespace fc namespace fc
{ {

View File

@ -396,26 +396,6 @@ class FWidget : public FVTerm, public FObject
virtual void onClose (FCloseEvent*); virtual void onClose (FCloseEvent*);
private: private:
// Methods
void initRootWidget();
void finish();
void insufficientSpaceAdjust();
void KeyPressEvent (FKeyEvent*);
void KeyDownEvent (FKeyEvent*);
void emitWheelCallback (const FWheelEvent*);
void setWindowFocus (bool);
FCallbackPtr getCallbackPtr (FCallback);
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
void processDestroy();
virtual void draw();
void drawWindows();
void drawChildren();
static void setColorTheme();
void setStatusbarText (bool);
// Data members
FPoint widget_cursor_position{-1, -1};
struct widget_size_hints struct widget_size_hints
{ {
widget_size_hints() = default; widget_size_hints() = default;
@ -437,7 +417,7 @@ class FWidget : public FVTerm, public FObject
std::size_t min_height{0}; std::size_t min_height{0};
std::size_t max_width{INT_MAX}; std::size_t max_width{INT_MAX};
std::size_t max_height{INT_MAX}; std::size_t max_height{INT_MAX};
} size_hints{}; };
struct dbl_line_mask struct dbl_line_mask
{ {
@ -448,7 +428,7 @@ class FWidget : public FVTerm, public FObject
std::vector<bool> right{}; std::vector<bool> right{};
std::vector<bool> bottom{}; std::vector<bool> bottom{};
std::vector<bool> left{}; std::vector<bool> left{};
} double_flatline_mask{}; };
struct widget_padding struct widget_padding
{ {
@ -459,9 +439,31 @@ class FWidget : public FVTerm, public FObject
int left{0}; int left{0};
int bottom{0}; int bottom{0};
int right{0}; int right{0};
} padding{}; };
// Methods
void initRootWidget();
void finish();
void insufficientSpaceAdjust();
void KeyPressEvent (FKeyEvent*);
void KeyDownEvent (FKeyEvent*);
void emitWheelCallback (const FWheelEvent*);
void setWindowFocus (bool);
FCallbackPtr getCallbackPtr (const FCallback&);
bool changeFocus (FWidget*, FWidget*, fc::FocusTypes);
void processDestroy();
virtual void draw();
void drawWindows();
void drawChildren();
static void setColorTheme();
void setStatusbarText (bool);
// Data members
struct FWidgetFlags flags{}; struct FWidgetFlags flags{};
FPoint widget_cursor_position{-1, -1};
widget_size_hints size_hints{};
dbl_line_mask double_flatline_mask{};
widget_padding padding{};
bool ignore_padding{false}; bool ignore_padding{false};
// widget size // widget size
@ -843,7 +845,11 @@ inline bool FWidget::setDisable()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FWidget::setVisibleCursor (bool enable) inline bool FWidget::setVisibleCursor (bool enable)
{ {
flags.visible_cursor = ( enable ) ? true : (( hideable ) ? false : true); if ( enable )
flags.visible_cursor = true;
else
flags.visible_cursor = ( hideable ) ? false : true;
return flags.visible_cursor; return flags.visible_cursor;
} }

View File

@ -65,7 +65,8 @@ void SGRoptimizer::findParameter()
return; return;
std::size_t start{NOT_SET}; std::size_t start{NOT_SET};
bool esc{false}, csi{false}; bool esc{false};
bool csi{false};
// Find SGR parameter // Find SGR parameter
for (std::size_t i = 0; i < len; i++) for (std::size_t i = 0; i < len; i++)