Small fixes

This commit is contained in:
Markus Gans 2020-12-05 23:54:40 +01:00
parent c4b799d98f
commit 47cb79a7f0
13 changed files with 44 additions and 105 deletions

View File

@ -161,12 +161,12 @@ class Treeview final : public finalcut::FDialog
struct TreeItem; // forward declaration struct TreeItem; // forward declaration
// Methods // Methods
auto initAfrica() -> std::initializer_list<TreeItem> const; auto initAfrica() const -> std::initializer_list<TreeItem>;
auto initAsia() -> std::initializer_list<TreeItem> const; auto initAsia() const -> std::initializer_list<TreeItem>;
auto initEurope() -> std::initializer_list<TreeItem> const; auto initEurope() const -> std::initializer_list<TreeItem>;
auto initNorthAmerica() -> std::initializer_list<TreeItem> const; auto initNorthAmerica() const -> std::initializer_list<TreeItem>;
auto initSouthAmerica() -> std::initializer_list<TreeItem> const; auto initSouthAmerica() const -> std::initializer_list<TreeItem>;
auto initOceania() -> std::initializer_list<TreeItem> const; auto initOceania() const -> std::initializer_list<TreeItem>;
void adjustSize() override; void adjustSize() override;
// Event handler // Event handler
@ -275,7 +275,7 @@ Treeview::Treeview (finalcut::FWidget* parent)
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
auto Treeview::initAfrica() -> std::initializer_list<Treeview::TreeItem> const auto Treeview::initAfrica() const -> std::initializer_list<Treeview::TreeItem>
{ {
static const auto list = std::initializer_list<Treeview::TreeItem> static const auto list = std::initializer_list<Treeview::TreeItem>
{ {
@ -306,7 +306,7 @@ auto Treeview::initAfrica() -> std::initializer_list<Treeview::TreeItem> const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
auto Treeview::initAsia() -> std::initializer_list<Treeview::TreeItem> const auto Treeview::initAsia() const -> std::initializer_list<Treeview::TreeItem>
{ {
static const auto list = std::initializer_list<Treeview::TreeItem> static const auto list = std::initializer_list<Treeview::TreeItem>
{ {
@ -334,7 +334,7 @@ auto Treeview::initAsia() -> std::initializer_list<Treeview::TreeItem> const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
auto Treeview::initEurope() -> std::initializer_list<Treeview::TreeItem> const auto Treeview::initEurope() const -> std::initializer_list<Treeview::TreeItem>
{ {
static const auto list = std::initializer_list<Treeview::TreeItem> static const auto list = std::initializer_list<Treeview::TreeItem>
{ {
@ -362,7 +362,7 @@ auto Treeview::initEurope() -> std::initializer_list<Treeview::TreeItem> const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
auto Treeview::initNorthAmerica() -> std::initializer_list<Treeview::TreeItem> const auto Treeview::initNorthAmerica() const -> std::initializer_list<Treeview::TreeItem>
{ {
static const auto list = std::initializer_list<Treeview::TreeItem> static const auto list = std::initializer_list<Treeview::TreeItem>
{ {
@ -379,7 +379,7 @@ auto Treeview::initNorthAmerica() -> std::initializer_list<Treeview::TreeItem> c
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
auto Treeview::initSouthAmerica() -> std::initializer_list<Treeview::TreeItem> const auto Treeview::initSouthAmerica() const -> std::initializer_list<Treeview::TreeItem>
{ {
static const auto list = std::initializer_list<Treeview::TreeItem> static const auto list = std::initializer_list<Treeview::TreeItem>
{ {
@ -398,7 +398,7 @@ auto Treeview::initSouthAmerica() -> std::initializer_list<Treeview::TreeItem> c
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
auto Treeview::initOceania() -> std::initializer_list<Treeview::TreeItem> const auto Treeview::initOceania() const -> std::initializer_list<Treeview::TreeItem>
{ {
static const auto list = std::initializer_list<Treeview::TreeItem> static const auto list = std::initializer_list<Treeview::TreeItem>
{ {

View File

@ -161,7 +161,7 @@ std::array<std::array<uInt, fc::NUM_OF_ENCODINGS>, 115> character =
* (2) Only supported in use with newfont * (2) Only supported in use with newfont
*/ */
constexpr std::array<std::array<int, 2>, 39> vt100_key_to_utf8 = constexpr std::array<std::array<int, 2>, 39> dec_special_graphics =
{{ {{
{{fc::vt100_key_rarrow , fc::BlackRightPointingPointer}}, // ► {{fc::vt100_key_rarrow , fc::BlackRightPointingPointer}}, // ►
{{fc::vt100_key_larrow , fc::BlackLeftPointingPointer}}, // ◄ {{fc::vt100_key_larrow , fc::BlackLeftPointingPointer}}, // ◄

View File

@ -102,16 +102,6 @@ FFileDialog::FFileDialog (FWidget* parent)
init(); init();
} }
//----------------------------------------------------------------------
FFileDialog::FFileDialog (const FFileDialog& fdlg)
: FDialog{fdlg.getParentWidget()}
{
if ( fdlg.directory )
setPath(fdlg.directory);
init();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FFileDialog::FFileDialog ( const FString& dirname FFileDialog::FFileDialog ( const FString& dirname
, const FString& filter , const FString& filter
@ -135,33 +125,6 @@ FFileDialog::~FFileDialog() // destructor
// public methods of FFileDialog // public methods of FFileDialog
//----------------------------------------------------------------------
FFileDialog& FFileDialog::operator = (const FFileDialog& fdlg)
{
if ( &fdlg == this )
{
return *this;
}
else
{
clear();
if ( fdlg.getParentWidget() )
fdlg.getParentWidget()->addChild (this);
directory = fdlg.directory;
filter_pattern = fdlg.filter_pattern;
dlg_type = fdlg.dlg_type;
show_hidden = fdlg.show_hidden;
if ( directory )
setPath(directory);
init();
return *this;
}
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FString FFileDialog::getSelectedFile() const FString FFileDialog::getSelectedFile() const
{ {

View File

@ -77,36 +77,6 @@ FMessageBox::~FMessageBox() noexcept = default; // destructor
// public methods of FMessageBox // public methods of FMessageBox
//----------------------------------------------------------------------
FMessageBox& FMessageBox::operator = (const FMessageBox& mbox)
{
if ( &mbox == this )
{
return *this;
}
else
{
if ( mbox.getParentWidget() )
mbox.getParentWidget()->addChild (this);
setTitlebarText (mbox.getTitlebarText());
headline_text = mbox.headline_text;
text = mbox.text;
text_components = mbox.text_components;
max_line_width = mbox.max_line_width;
center_text = mbox.center_text;
emphasis_color = mbox.emphasis_color;
num_buttons = mbox.num_buttons;
text_num_lines = mbox.text_num_lines;
button_digit[0] = mbox.button_digit[0];
button_digit[1] = mbox.button_digit[1];
button_digit[2] = mbox.button_digit[2];
init();
return *this;
}
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FMessageBox::setHeadline (const FString& headline) void FMessageBox::setHeadline (const FString& headline)
{ {

View File

@ -1287,18 +1287,14 @@ void FTerm::init_alt_charset()
} }
} }
enum Column : int
{
vt100_key = 0,
utf8_char = 1
};
// Update array 'character' with discovered VT100 pairs // Update array 'character' with discovered VT100 pairs
for (auto&& pair : fc::vt100_key_to_utf8) for (auto&& pair : fc::dec_special_graphics)
{ {
const auto keyChar = uChar(pair[vt100_key]); const auto vt100 = std::size_t(fc::DECSpecialGraphics::vt100);
const auto utf8 = std::size_t(fc::DECSpecialGraphics::utf8);
const auto keyChar = uChar(pair[vt100]);
const auto altChar = uChar(vt100_alt_char[keyChar]); const auto altChar = uChar(vt100_alt_char[keyChar]);
const auto utf8char = uInt(pair[utf8_char]); const auto utf8char = uInt(pair[utf8]);
const auto p = std::find_if ( fc::character.begin() const auto p = std::find_if ( fc::character.begin()
, fc::character.end() , fc::character.end()
, [&utf8char] (std::array<uInt, 4> entry) , [&utf8char] (std::array<uInt, 4> entry)

View File

@ -815,7 +815,7 @@ void FTermLinux::writeAttributeController (uChar index, uChar data) const
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline uChar FTermLinux::getAttributeMode() inline uChar FTermLinux::getAttributeMode() const
{ {
// Gets the attribute mode value from the vga attribute controller // Gets the attribute mode value from the vga attribute controller
static constexpr uChar attrib_mode = 0x10; static constexpr uChar attrib_mode = 0x10;
@ -823,7 +823,7 @@ inline uChar FTermLinux::getAttributeMode()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FTermLinux::setAttributeMode (uChar data) inline void FTermLinux::setAttributeMode (uChar data) const
{ {
// Sets the attribute mode value from the vga attribute controller // Sets the attribute mode value from the vga attribute controller
static constexpr uChar attrib_mode = 0x10; static constexpr uChar attrib_mode = 0x10;

View File

@ -307,7 +307,7 @@ void FVTerm::addPreprocessingHandler ( const FVTerm* instance
{ {
delPreprocessingHandler (instance); delPreprocessingHandler (instance);
auto obj = make_unique<FVTermPreprocessing> \ auto obj = make_unique<FVTermPreprocessing> \
(instance, std::forward<FPreprocessingFunction>(function)); (instance, std::move(function));
print_area->preproc_list.emplace_back(std::move(obj)); print_area->preproc_list.emplace_back(std::move(obj));
} }
} }

View File

@ -92,6 +92,13 @@ enum encoding
UNKNOWN UNKNOWN
}; };
// vt100 <-> utf-8
enum class DECSpecialGraphics : std::size_t
{
vt100 = 0, // First column
utf8 = 1 // Second column
};
// VT100 line graphic keys // VT100 line graphic keys
enum vt100_keys : char enum vt100_keys : char
{ {

View File

@ -55,8 +55,7 @@ class FWidget;
struct FCallbackData struct FCallbackData
{ {
// Constructor // Constructor
FCallbackData() FCallbackData() = default;
{ }
template <typename FuncPtr> template <typename FuncPtr>
FCallbackData (const FString& s, FWidget* i, FuncPtr m, const FCall& c) FCallbackData (const FString& s, FWidget* i, FuncPtr m, const FCall& c)

View File

@ -39,7 +39,7 @@ namespace fc
{ {
extern std::array<std::array<uInt, fc::NUM_OF_ENCODINGS>, 115> character; extern std::array<std::array<uInt, fc::NUM_OF_ENCODINGS>, 115> character;
extern const std::array<std::array<int, 2>, 39> vt100_key_to_utf8; extern const std::array<std::array<int, 2>, 39> dec_special_graphics;
extern const std::array<std::array<wchar_t, 2>, 256> cp437_ucs; extern const std::array<std::array<wchar_t, 2>, 256> cp437_ucs;
extern const std::array<std::array<wchar_t, 2>, 227> halfwidth_fullwidth; extern const std::array<std::array<wchar_t, 2>, 227> halfwidth_fullwidth;

View File

@ -96,17 +96,20 @@ class FFileDialog : public FDialog
// Constructors // Constructors
explicit FFileDialog (FWidget* = nullptr); explicit FFileDialog (FWidget* = nullptr);
FFileDialog (const FFileDialog&); // copy constructor
FFileDialog ( const FString& FFileDialog ( const FString&
, const FString& , const FString&
, DialogType = DialogType::Open , DialogType = DialogType::Open
, FWidget* = nullptr ); , FWidget* = nullptr );
// Disable copy constructor
FFileDialog (const FFileDialog&) = delete;
// Destructor // Destructor
~FFileDialog() override; ~FFileDialog() override;
// copy assignment operator (=) // Disable copy assignment operator (=)
FFileDialog& operator = (const FFileDialog&); FFileDialog& operator = (const FFileDialog&) = delete;
// Accessors // Accessors
FString getClassName() const override; FString getClassName() const override;

View File

@ -95,7 +95,8 @@ class FMessageBox : public FDialog
// Constructors // Constructors
explicit FMessageBox (FWidget* = nullptr); explicit FMessageBox (FWidget* = nullptr);
FMessageBox (const FMessageBox&) = default; // copy constructor // Disable copy constructor
FMessageBox (const FMessageBox&) = delete;
FMessageBox ( const FString&, const FString& FMessageBox ( const FString&, const FString&
, ButtonType, ButtonType, ButtonType , ButtonType, ButtonType, ButtonType
@ -104,8 +105,8 @@ class FMessageBox : public FDialog
// Destructor // Destructor
~FMessageBox() noexcept override; ~FMessageBox() noexcept override;
// copy assignment operator (=) // Disable copy assignment operator (=)
FMessageBox& operator = (const FMessageBox&); FMessageBox& operator = (const FMessageBox&) = delete;
// Accessor // Accessor
FString getClassName() const override; FString getClassName() const override;
@ -151,6 +152,7 @@ class FMessageBox : public FDialog
// Using-declaration // Using-declaration
using FButtons = std::array<std::unique_ptr<FButton>, MAX_BUTTONS>; using FButtons = std::array<std::unique_ptr<FButton>, MAX_BUTTONS>;
using FButtonsDigit = std::array<ButtonType, MAX_BUTTONS>;
// Methods // Methods
void init(); void init();
@ -165,12 +167,11 @@ class FMessageBox : public FDialog
FString headline_text{}; FString headline_text{};
FString text{}; FString text{};
FStringList text_components{}; FStringList text_components{};
FButtons button{}; FButtons button{};
std::size_t max_line_width{0}; std::size_t max_line_width{0};
FColor emphasis_color{getColorTheme()->dialog_emphasis_fg}; FColor emphasis_color{getColorTheme()->dialog_emphasis_fg};
ButtonType result_code{ButtonType::Reject}; ButtonType result_code{ButtonType::Reject};
ButtonType button_digit[MAX_BUTTONS]{ButtonType::Reject}; FButtonsDigit button_digit{ButtonType::Reject};
std::size_t num_buttons{0}; std::size_t num_buttons{0};
std::size_t text_num_lines{0}; std::size_t text_num_lines{0};
bool center_text{false}; bool center_text{false};

View File

@ -156,8 +156,8 @@ class FTermLinux final
uInt16 getInputStatusRegisterOne() const; uInt16 getInputStatusRegisterOne() const;
uChar readAttributeController (uChar) const; uChar readAttributeController (uChar) const;
void writeAttributeController (uChar, uChar) const; void writeAttributeController (uChar, uChar) const;
uChar getAttributeMode(); uChar getAttributeMode() const;
void setAttributeMode (uChar); void setAttributeMode (uChar) const;
int setBlinkAsIntensity (bool); int setBlinkAsIntensity (bool);
bool has9BitCharacters(); bool has9BitCharacters();
void getVGAPalette(); void getVGAPalette();