Splitting the FString example into sub-functions

This commit is contained in:
Markus Gans 2017-11-19 19:47:24 +01:00
parent 0864055cab
commit d8759ff51d
7 changed files with 311 additions and 114 deletions

View File

@ -1,6 +1,8 @@
exclude: exclude:
- /fonts/newfont.h
- /fonts/vgafont.h
- /ltmain.sh - /ltmain.sh
component_depth: 1 component_depth: 3
languages: languages:
- cpp - cpp
- script - script

View File

@ -1,3 +1,7 @@
2017-11-19 Markus Gans <guru.mail@muenster.de>
* Splitting the FString example into sub-functions to make
the code more comprehensible
2017-11-18 Markus Gans <guru.mail@muenster.de> 2017-11-18 Markus Gans <guru.mail@muenster.de>
* Improved command line paramenter handling * Improved command line paramenter handling
* New command line paramenter --no-terminal-detection * New command line paramenter --no-terminal-detection

View File

@ -31,12 +31,14 @@
#include <final/final.h> #include <final/final.h>
int main (int, char**) void init()
{ {
printf ("----------------[ terminal ]-------------------\n"); std::cout << "----------------[ terminal ]-------------------"
<< std::endl;
// init current locale // init current locale
printf (" Locale: %s\n", std::setlocale(LC_CTYPE, "") ); std::cout << " Locale: " << std::setlocale(LC_CTYPE, "")
<< std::endl;
if ( isatty(1) && ! std::strcmp(nl_langinfo(CODESET), "ANSI_X3.4-1968") ) if ( isatty(1) && ! std::strcmp(nl_langinfo(CODESET), "ANSI_X3.4-1968") )
{ {
@ -44,21 +46,32 @@ int main (int, char**)
std::setlocale(LC_ALL, "C"); std::setlocale(LC_ALL, "C");
} }
printf (" Codeset: %s\n", nl_langinfo(CODESET)); std::cout << " Codeset: " << nl_langinfo(CODESET) << std::endl;
std::cout << "--------------[ FString test ]-----------------" std::cout << "--------------[ FString test ]-----------------"
<< std::endl; << std::endl;
}
//----------------------------------------------------------------------
void inputStreamExample()
{
// Test: input stream (operator >>) // Test: input stream (operator >>)
FString in; FString in;
std::cout << " Input: "; std::cout << " Input: ";
std::cin >> in; std::cin >> in;
std::cout << " instream >> " << in << std::endl; std::cout << " instream >> " << in << std::endl;
}
//----------------------------------------------------------------------
void outputStreamExample()
{
// Test: output stream (operator <<) // Test: output stream (operator <<)
const FString& out = L"A test string for 0 \x20ac"; const FString& out = L"A test string for 0 \x20ac";
std::cout << " outstream << " << out << std::endl; std::cout << " outstream << " << out << std::endl;
}
//----------------------------------------------------------------------
void streamingIntoFStringExample()
{
// Test: Streaming into a FString (operator <<)... // Test: Streaming into a FString (operator <<)...
// ...from FStrings // ...from FStrings
@ -120,7 +133,11 @@ int main (int, char**)
FString streamer12; FString streamer12;
streamer12 << float(0.22222222); streamer12 << float(0.22222222);
std::cout << " stream in: " << streamer12 << std::endl; std::cout << " stream in: " << streamer12 << std::endl;
}
//----------------------------------------------------------------------
void streamingFromFStringExample()
{
// Test: Streaming from a FString (operator >>)... // Test: Streaming from a FString (operator >>)...
// ...to FStrings // ...to FStrings
@ -214,10 +231,19 @@ int main (int, char**)
{ {
std::cerr << "Arithmetic error: " << ex.what() << std::endl; std::cerr << "Arithmetic error: " << ex.what() << std::endl;
} }
}
//----------------------------------------------------------------------
void CStringOutputExample()
{
// Test: c-string output // Test: c-string output
const FString& out = L"A test string for 0 \x20ac";
printf (" c_str: \"%s\"\n", out.c_str()); printf (" c_str: \"%s\"\n", out.c_str());
}
//----------------------------------------------------------------------
void copyIntoFString()
{
// Test: copy a c++ string // Test: copy a c++ string
const FString& cpp_str( std::string("c++ String") ); const FString& cpp_str( std::string("c++ String") );
std::cout << " cpp_str: \"" << cpp_str << "\"" << std::endl; std::cout << " cpp_str: \"" << cpp_str << "\"" << std::endl;
@ -229,12 +255,20 @@ int main (int, char**)
// Test: copy a wide character // Test: copy a wide character
const FString wch(L'w'); const FString wch(L'w');
std::cout << " wchar_t: '" << wch << "'" << std::endl; std::cout << " wchar_t: '" << wch << "'" << std::endl;
}
//----------------------------------------------------------------------
void utf8StringOutputExample()
{
// Test: utf-8 string // Test: utf-8 string
const FString& len = "длина́"; const FString& len = "длина́";
std::cout << " length: \"" << len << "\" has " std::cout << " length: \"" << len << "\" has "
<< len.getLength() << " characters" << std::endl; << len.getLength() << " characters" << std::endl;
}
//----------------------------------------------------------------------
void letterCaseExample()
{
// Test: convert uppercase letter to lowercase // Test: convert uppercase letter to lowercase
const FString& lower = FString(L"InPut").toLower(); const FString& lower = FString(L"InPut").toLower();
std::wcout << L" toLower: " << lower << std::endl; std::wcout << L" toLower: " << lower << std::endl;
@ -242,7 +276,11 @@ int main (int, char**)
// Test: convert lowercase letter to uppercase // Test: convert lowercase letter to uppercase
const FString& upper = FString("inPut").toUpper(); const FString& upper = FString("inPut").toUpper();
std::cout << " toUpper: " << upper << std::endl; std::cout << " toUpper: " << upper << std::endl;
}
//----------------------------------------------------------------------
void stringConcatenationExample()
{
// Test: concatenate two FStrings (operator +) // Test: concatenate two FStrings (operator +)
const FString& add1 = FString("FString + ") + FString("FString"); const FString& add1 = FString("FString + ") + FString("FString");
std::cout << " add: " << add1 << std::endl; std::cout << " add: " << add1 << std::endl;
@ -302,7 +340,11 @@ int main (int, char**)
const FString& add13 = std::wstring(L"std::wstring") const FString& add13 = std::wstring(L"std::wstring")
+ FString(" + FString"); + FString(" + FString");
std::cout << " add: " << add13 << std::endl; std::cout << " add: " << add13 << std::endl;
}
//----------------------------------------------------------------------
void stringCompareExample()
{
// Test: compare operators ==, <=, <, >=, >, != // Test: compare operators ==, <=, <, >=, >, !=
const FString& cmp = "compare"; const FString& cmp = "compare";
@ -335,7 +377,11 @@ int main (int, char**)
std::cout << " cmp: != Ok" << std::endl; std::cout << " cmp: != Ok" << std::endl;
else else
std::cout << " cmp: != Not Ok" << std::endl; std::cout << " cmp: != Not Ok" << std::endl;
}
//----------------------------------------------------------------------
void stringSplittingExample()
{
// Test: split a string with a delimiter and returns a vector (array) // Test: split a string with a delimiter and returns a vector (array)
FString split_str = "a,b,c,d"; FString split_str = "a,b,c,d";
std::cout << " split: \"" std::cout << " split: \""
@ -348,13 +394,21 @@ int main (int, char**)
std::cout << " \"" << (*it) << "\""; std::cout << " \"" << (*it) << "\"";
std::cout << std::endl; std::cout << std::endl;
}
//----------------------------------------------------------------------
void fromatStringExample()
{
// Test: format a string with sprintf // Test: format a string with sprintf
FString formatStr = ""; FString formatStr = "";
std::cout << " formatted: " std::cout << " formatted: "
<< formatStr.sprintf("sqrt(%d) = %d", 16, 4) << formatStr.sprintf("sqrt(%d) = %d", 16, 4)
<< std::endl; << std::endl;
}
//----------------------------------------------------------------------
void convertToNumberExample()
{
// Test: convert a string to a unsigned long interger // Test: convert a string to a unsigned long interger
try try
{ {
@ -404,7 +458,11 @@ int main (int, char**)
{ {
std::cerr << "Arithmetic error: " << ex.what() << std::endl; std::cerr << "Arithmetic error: " << ex.what() << std::endl;
} }
}
//----------------------------------------------------------------------
void convertNumberToStringExample()
{
// Test: convert integer and double value to a string // Test: convert integer and double value to a string
FString num1, num2, num3; FString num1, num2, num3;
num1.setNumber(137); num1.setNumber(137);
@ -416,7 +474,11 @@ int main (int, char**)
<< num2 << " (signed)" << std::endl; << num2 << " (signed)" << std::endl;
std::cout << " setNumber: " std::cout << " setNumber: "
<< num3 << " (long double)" << std::endl; << num3 << " (long double)" << std::endl;
}
//----------------------------------------------------------------------
void formatedNumberExample()
{
// Test: convert and format a integer number with thousand separator // Test: convert and format a integer number with thousand separator
std::setlocale (LC_NUMERIC, ""); std::setlocale (LC_NUMERIC, "");
FString fnum1, fnum2; FString fnum1, fnum2;
@ -433,7 +495,11 @@ int main (int, char**)
<< fnum1 << " (unsigned)" << std::endl; << fnum1 << " (unsigned)" << std::endl;
std::cout << "setFormatedNumber: " std::cout << "setFormatedNumber: "
<< fnum2 << " (signed)" << std::endl; << fnum2 << " (signed)" << std::endl;
}
//----------------------------------------------------------------------
void trimExample()
{
// Test: remove whitespace from the end of a string // Test: remove whitespace from the end of a string
const FString& trim_str = " A string \t"; const FString& trim_str = " A string \t";
std::wcout << " rtrim: \"" std::wcout << " rtrim: \""
@ -446,9 +512,14 @@ int main (int, char**)
// Test: remove whitespace from the beginning and end of a string // Test: remove whitespace from the beginning and end of a string
std::cout << " trim: \"" std::cout << " trim: \""
<< trim_str.trim() << "\"" << std::endl; << trim_str.trim() << "\"" << std::endl;
}
//----------------------------------------------------------------------
void substringExample()
{
// Test: 11 characters from the left of the string // Test: 11 characters from the left of the string
const FString& alphabet = "a b c d e f g h i j k l m n o p q r s t u v w x y z"; const FString& alphabet = "a b c d e f g h i j k l m "
"n o p q r s t u v w x y z";
std::cout << " left: \"" std::cout << " left: \""
<< alphabet.left(11) << "\"" << std::endl; << alphabet.left(11) << "\"" << std::endl;
@ -459,7 +530,11 @@ int main (int, char**)
// Test: 11 characters from the right of the string // Test: 11 characters from the right of the string
std::cout << " right: \"" std::cout << " right: \""
<< alphabet.right(11) << "\"" << std::endl; << alphabet.right(11) << "\"" << std::endl;
}
//----------------------------------------------------------------------
void insertExample()
{
// Test: insert a string at index position 7 // Test: insert a string at index position 7
FString insert_str = "I am a string"; FString insert_str = "I am a string";
@ -472,7 +547,11 @@ int main (int, char**)
{ {
std::cerr << "Out of Range error: " << ex.what() << std::endl; std::cerr << "Out of Range error: " << ex.what() << std::endl;
} }
}
//----------------------------------------------------------------------
void indexExample()
{
// Test: get character access at a specified index position // Test: get character access at a specified index position
FString index(5); // string with five characters FString index(5); // string with five characters
index = "index"; index = "index";
@ -488,7 +567,11 @@ int main (int, char**)
{ {
std::cerr << "Out of Range error: " << ex.what() << std::endl; std::cerr << "Out of Range error: " << ex.what() << std::endl;
} }
}
//----------------------------------------------------------------------
void iteratorExample()
{
// Test: character access with std::iterator // Test: character access with std::iterator
const FString& stringIterator = "iterator"; const FString& stringIterator = "iterator";
FString::iterator iter; FString::iterator iter;
@ -504,17 +587,29 @@ int main (int, char**)
std::cout << " (front='" << char(stringIterator.front()) std::cout << " (front='" << char(stringIterator.front())
<< "', back='" << char(stringIterator.back()) << "', back='" << char(stringIterator.back())
<< "')" << std::endl; << "')" << std::endl;
}
//----------------------------------------------------------------------
void overwriteExample()
{
// Test: overwrite string at position 10 with "for t" // Test: overwrite string at position 10 with "for t"
FString overwrite_std = "Overwrite the rest"; FString overwrite_std = "Overwrite the rest";
std::cout << "overwrite: " std::cout << "overwrite: "
<< overwrite_std.overwrite("for t", 10) << std::endl; << overwrite_std.overwrite("for t", 10) << std::endl;
}
//----------------------------------------------------------------------
void removeExample()
{
// Test: remove 2 characters at position 7 // Test: remove 2 characters at position 7
FString remove_std = "A fast remove"; FString remove_std = "A fast remove";
std::cout << " remove: " std::cout << " remove: "
<< remove_std.remove(7, 2) << std::endl; << remove_std.remove(7, 2) << std::endl;
}
//----------------------------------------------------------------------
void substringIncludeExample()
{
// Test: includes a substring (positive test) // Test: includes a substring (positive test)
FString include_std = "string"; FString include_std = "string";
@ -536,25 +631,78 @@ int main (int, char**)
std::cout << " includes: \"" std::cout << " includes: \""
<< include_std << "\" includes no \"data\" " << include_std << "\" includes no \"data\" "
<< std::endl; << std::endl;
}
//----------------------------------------------------------------------
void replaceExample()
{
// Test: find and replace a substring // Test: find and replace a substring
FString source_str = "computer and software"; FString source_str = "computer and software";
const FString& replace_str = source_str.replace("computer", "hard-"); const FString& replace_str = source_str.replace("computer", "hard-");
std::cout << " replace: " std::cout << " replace: "
<< replace_str << std::endl; << replace_str << std::endl;
}
//----------------------------------------------------------------------
void tabToSpaceExample()
{
// Test: convert tabs to spaces // Test: convert tabs to spaces
const FString& tab_str = "1234\t5678"; const FString& tab_str = "1234\t5678";
std::cout << " tab: " std::cout << " tab: "
<< tab_str.expandTabs() << std::endl; << tab_str.expandTabs() << std::endl;
}
//----------------------------------------------------------------------
void backspaceControlCharacterExample()
{
// Test: backspaces remove characters in the string // Test: backspaces remove characters in the string
const FString& bs_str = "t\b\bTesT\bt"; const FString& bs_str = "t\b\bTesT\bt";
std::cout << "backspace: " std::cout << "backspace: "
<< bs_str.removeBackspaces() << std::endl; << bs_str.removeBackspaces() << std::endl;
}
//----------------------------------------------------------------------
void deleteControlCharacterExample()
{
// Test: delete characters remove characters in the string // Test: delete characters remove characters in the string
const FString& del_str = "apple \177\177\177pietree"; const FString& del_str = "apple \177\177\177pietree";
std::cout << " delete: " std::cout << " delete: "
<< del_str.removeDel() << std::endl; << del_str.removeDel() << std::endl;
} }
//----------------------------------------------------------------------
// main part
//----------------------------------------------------------------------
int main (int, char**)
{
init();
// Some FString examples
inputStreamExample();
outputStreamExample();
streamingIntoFStringExample();
streamingFromFStringExample();
CStringOutputExample();
copyIntoFString();
utf8StringOutputExample();
letterCaseExample();
stringConcatenationExample();
stringCompareExample();
stringSplittingExample();
fromatStringExample();
convertToNumberExample();
convertNumberToStringExample();
formatedNumberExample();
trimExample();
substringExample();
insertExample();
indexExample();
iteratorExample();
overwriteExample();
removeExample();
substringIncludeExample();
replaceExample();
tabToSpaceExample();
backspaceControlCharacterExample();
deleteControlCharacterExample();
}

View File

@ -273,7 +273,9 @@ class MyDialog : public FDialog
// Method // Method
void initMenu(); void initMenu();
void initMenuCallbacks();
void initStatusBar(); void initStatusBar();
void initStatusBarCallbacks();
void initWidgets(); void initWidgets();
void adjustSize(); void adjustSize();
@ -298,6 +300,18 @@ class MyDialog : public FDialog
void cb_setInput (FWidget*, data_ptr); void cb_setInput (FWidget*, data_ptr);
// Data Members // Data Members
FMenuItem* Open;
FMenuItem* Quit;
FMenuItem* File1;
FMenuItem* File2;
FMenuItem* File3;
FMenuItem* Cut;
FMenuItem* Copy;
FMenuItem* Paste;
FMenuItem* Clear;
FMenuItem* Env;
FMenuItem* Drive;
FMenuItem* Help;
FLineEdit* myLineEdit; FLineEdit* myLineEdit;
FListBox* myList; FListBox* myList;
FString clipboard; FString clipboard;
@ -311,9 +325,11 @@ MyDialog::MyDialog (FWidget* parent)
, myList() , myList()
, clipboard() , clipboard()
{ {
initMenu(); // Initialize the program menu initMenu(); // Initialize the program menu
initStatusBar(); // Initialize the status bar initMenuCallbacks(); // Initialize program menu callbacks
initWidgets(); // Initialize the dialog widgets initStatusBar(); // Initialize the status bar
initStatusBarCallbacks(); // Initialize status bar callbacks
initWidgets(); // Initialize the dialog widgets
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -338,11 +354,11 @@ void MyDialog::initMenu()
Options->setDisable(); Options->setDisable();
FDialogListMenu* Window = new FDialogListMenu ("&Window", Menubar); FDialogListMenu* Window = new FDialogListMenu ("&Window", Menubar);
Window->setStatusbarMessage ("List of all the active dialogs"); Window->setStatusbarMessage ("List of all the active dialogs");
FMenuItem* Help = new FMenuItem ("&Help", Menubar); Help = new FMenuItem ("&Help", Menubar);
Help->setStatusbarMessage ("Show version and copyright information"); Help->setStatusbarMessage ("Show version and copyright information");
// "File" menu items // "File" menu items
FMenuItem* Open = new FMenuItem ("&Open...", File); Open = new FMenuItem ("&Open...", File);
Open->addAccelerator (fc::Fckey_o); // Ctrl + O Open->addAccelerator (fc::Fckey_o); // Ctrl + O
Open->setStatusbarMessage ("Locate and open a text file"); Open->setStatusbarMessage ("Locate and open a text file");
FMenu* Recent = new FMenu ("&System files", File); FMenu* Recent = new FMenu ("&System files", File);
@ -350,14 +366,14 @@ void MyDialog::initMenu()
FMenuItem* Line1 = new FMenuItem (File); FMenuItem* Line1 = new FMenuItem (File);
Line1->setSeparator(); Line1->setSeparator();
FMenuItem* Quit = new FMenuItem ("&Quit", File); Quit = new FMenuItem ("&Quit", File);
Quit->addAccelerator (fc::Fmkey_x); // Meta/Alt + X Quit->addAccelerator (fc::Fmkey_x); // Meta/Alt + X
Quit->setStatusbarMessage ("Exit the program"); Quit->setStatusbarMessage ("Exit the program");
// "Recent" menu items // "Recent" menu items
FMenuItem* File1 = new FMenuItem ("/etc/services", Recent); File1 = new FMenuItem ("/etc/services", Recent);
FMenuItem* File2 = new FMenuItem ("/etc/fstab", Recent); File2 = new FMenuItem ("/etc/fstab", Recent);
FMenuItem* File3 = new FMenuItem ("/etc/passwd", Recent); File3 = new FMenuItem ("/etc/passwd", Recent);
// "Edit" menu items // "Edit" menu items
FMenuItem* Undo = new FMenuItem (fc::Fckey_z, "Undo", Edit); FMenuItem* Undo = new FMenuItem (fc::Fckey_z, "Undo", Edit);
@ -366,23 +382,28 @@ void MyDialog::initMenu()
Redo->setDisable(); Redo->setDisable();
FMenuItem* Line2 = new FMenuItem (Edit); FMenuItem* Line2 = new FMenuItem (Edit);
Line2->setSeparator(); Line2->setSeparator();
FMenuItem* Cut = new FMenuItem (fc::Fckey_x, "Cu&t", Edit); Cut = new FMenuItem (fc::Fckey_x, "Cu&t", Edit);
Cut->setStatusbarMessage ( "Remove the input text" Cut->setStatusbarMessage ( "Remove the input text"
" and put it in the clipboard" ); " and put it in the clipboard" );
FMenuItem* Copy = new FMenuItem (fc::Fckey_c, "&Copy", Edit); Copy= new FMenuItem (fc::Fckey_c, "&Copy", Edit);
Copy->setStatusbarMessage ("Copy the input text into the clipboad"); Copy->setStatusbarMessage ("Copy the input text into the clipboad");
FMenuItem* Paste = new FMenuItem (fc::Fckey_v, "&Paste", Edit); Paste = new FMenuItem (fc::Fckey_v, "&Paste", Edit);
Paste->setStatusbarMessage ("Insert text form clipboard"); Paste->setStatusbarMessage ("Insert text form clipboard");
FMenuItem* Clear = new FMenuItem (fc::Fkey_dc, "C&lear", Edit); Clear = new FMenuItem (fc::Fkey_dc, "C&lear", Edit);
Clear->setStatusbarMessage ("Delete input text"); Clear->setStatusbarMessage ("Delete input text");
// "View" menu items // "View" menu items
FMenuItem* Env = new FMenuItem ("&Terminal...", View); Env = new FMenuItem ("&Terminal...", View);
Env->setStatusbarMessage ("Informations about this terminal"); Env->setStatusbarMessage ("Informations about this terminal");
FMenuItem* Drive = new FMenuItem ("&Drive symbols...", View); Drive = new FMenuItem ("&Drive symbols...", View);
Drive->setStatusbarMessage ("Show drive symbols"); Drive->setStatusbarMessage ("Show drive symbols");
}
//----------------------------------------------------------------------
void MyDialog::initMenuCallbacks()
{
// Menu function callbacks // Menu function callbacks
Open->addCallback Open->addCallback
( (
"clicked", "clicked",
@ -469,8 +490,13 @@ void MyDialog::initStatusBar()
FStatusKey* key_F1 = new FStatusKey (fc::Fkey_f1, "About", statusbar); FStatusKey* key_F1 = new FStatusKey (fc::Fkey_f1, "About", statusbar);
FStatusKey* key_F2 = new FStatusKey (fc::Fkey_f2, "View", statusbar); FStatusKey* key_F2 = new FStatusKey (fc::Fkey_f2, "View", statusbar);
FStatusKey* key_F3 = new FStatusKey (fc::Fkey_f3, "Quit", statusbar); FStatusKey* key_F3 = new FStatusKey (fc::Fkey_f3, "Quit", statusbar);
}
//----------------------------------------------------------------------
void MyDialog::initStatusBarCallbacks()
{
// Add some function callbacks // Add some function callbacks
key_F1->addCallback key_F1->addCallback
( (
"activate", "activate",

View File

@ -474,6 +474,8 @@ class FWidget : public FVTerm, public FObject
void processDestroy(); void processDestroy();
virtual void draw(); virtual void draw();
static void setColorTheme(); static void setColorTheme();
static void set8ColorTheme();
static void set16ColorTheme();
// Data Members // Data Members
bool enable; bool enable;

View File

@ -3833,7 +3833,8 @@ void FTerm::init_OptiMove()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FTerm::init_OptiAttr() void FTerm::init_OptiAttr()
{ {
// Attribute settings // Setting video attribute optimization
opti_attr->setNoColorVideo (int(FTermcap::attr_without_color)); opti_attr->setNoColorVideo (int(FTermcap::attr_without_color));
opti_attr->set_enter_bold_mode (TCAP(fc::t_enter_bold_mode)); opti_attr->set_enter_bold_mode (TCAP(fc::t_enter_bold_mode));
opti_attr->set_exit_bold_mode (TCAP(fc::t_exit_bold_mode)); opti_attr->set_exit_bold_mode (TCAP(fc::t_exit_bold_mode));

View File

@ -2464,6 +2464,111 @@ void FWidget::draw()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FWidget::setColorTheme() void FWidget::setColorTheme()
{
if ( getMaxColor() < 16 ) // for 8 color mode
{
set8ColorTheme();
}
else
{
set16ColorTheme();
if ( isKdeTerminal() )
wc.term_bg = fc::SteelBlue3;
}
}
//----------------------------------------------------------------------
void FWidget::set8ColorTheme()
{
wc.term_fg = fc::Black;
wc.term_bg = fc::Blue;
wc.list_fg = fc::Black;
wc.list_bg = fc::LightGray;
wc.selected_list_fg = fc::Blue;
wc.selected_list_bg = fc::LightGray;
wc.dialog_fg = fc::Black;
wc.dialog_resize_fg = fc::Red;
wc.dialog_emphasis_fg = fc::Blue;
wc.dialog_bg = fc::LightGray;
wc.error_box_fg = fc::Black;
wc.error_box_emphasis_fg = fc::Red;
wc.error_box_bg = fc::LightGray;
wc.tooltip_fg = fc::LightGray;
wc.tooltip_bg = fc::Cyan;
wc.shadow_fg = fc::Black;
wc.shadow_bg = fc::LightGray; // only for transparent shadow
wc.current_element_focus_fg = fc::LightGray;
wc.current_element_focus_bg = fc::Red;
wc.current_element_fg = fc::LightGray;
wc.current_element_bg = fc::Blue;
wc.current_inc_search_element_fg = fc::Brown;
wc.selected_current_element_focus_fg = fc::Blue;
wc.selected_current_element_focus_bg = fc::Red;
wc.selected_current_element_fg = fc::Cyan;
wc.selected_current_element_bg = fc::Blue;
wc.label_fg = fc::Black;
wc.label_bg = fc::LightGray;
wc.label_inactive_fg = fc::Cyan;
wc.label_inactive_bg = fc::LightGray;
wc.label_hotkey_fg = fc::Red;
wc.label_hotkey_bg = fc::LightGray;
wc.label_emphasis_fg = fc::Blue;
wc.label_ellipsis_fg = fc::Black;
wc.inputfield_active_focus_fg = fc::LightGray;
wc.inputfield_active_focus_bg = fc::Blue;
wc.inputfield_active_fg = fc::Black;
wc.inputfield_active_bg = fc::Cyan;
wc.inputfield_inactive_fg = fc::Black;
wc.inputfield_inactive_bg = fc::LightGray;
wc.toggle_button_active_focus_fg = fc::LightGray;
wc.toggle_button_active_focus_bg = fc::Red;
wc.toggle_button_active_fg = fc::Black;
wc.toggle_button_active_bg = fc::LightGray;
wc.toggle_button_inactive_fg = fc::Cyan;
wc.toggle_button_inactive_bg = fc::LightGray;
wc.button_active_focus_fg = fc::LightGray;
wc.button_active_focus_bg = fc::Red;
wc.button_active_fg = fc::LightGray;
wc.button_active_bg = fc::Blue;
wc.button_inactive_fg = fc::Black;
wc.button_inactive_bg = fc::Blue;
wc.button_hotkey_fg = fc::LightGray;
wc.titlebar_active_fg = fc::LightGray;
wc.titlebar_active_bg = fc::Red;
wc.titlebar_inactive_fg = fc::Black;
wc.titlebar_inactive_bg = fc::LightGray;
wc.titlebar_button_fg = fc::Black;
wc.titlebar_button_bg = fc::LightGray;
wc.titlebar_button_focus_fg = fc::LightGray;
wc.titlebar_button_focus_bg = fc::Black;
wc.menu_active_focus_fg = fc::LightGray;
wc.menu_active_focus_bg = fc::Blue;
wc.menu_active_fg = fc::Black;
wc.menu_active_bg = fc::LightGray;
wc.menu_inactive_fg = fc::Cyan;
wc.menu_inactive_bg = fc::LightGray;
wc.menu_hotkey_fg = fc::Red;
wc.menu_hotkey_bg = fc::LightGray;
wc.statusbar_fg = fc::Black;
wc.statusbar_bg = fc::LightGray;
wc.statusbar_hotkey_fg = fc::Red;
wc.statusbar_hotkey_bg = fc::LightGray;
wc.statusbar_separator_fg = fc::Black;
wc.statusbar_active_fg = fc::LightGray;
wc.statusbar_active_bg = fc::Black;
wc.statusbar_active_hotkey_fg = fc::Red;
wc.statusbar_active_hotkey_bg = fc::Black;
wc.scrollbar_fg = fc::Black;
wc.scrollbar_bg = fc::LightGray;
wc.scrollbar_button_fg = fc::Black;
wc.scrollbar_button_bg = fc::LightGray;
wc.progressbar_fg = fc::Blue;
wc.progressbar_bg = fc::LightGray;
}
//----------------------------------------------------------------------
void FWidget::set16ColorTheme()
{ {
wc.term_fg = fc::Black; wc.term_fg = fc::Black;
wc.term_bg = fc::LightBlue; wc.term_bg = fc::LightBlue;
@ -2549,95 +2654,4 @@ void FWidget::setColorTheme()
wc.scrollbar_button_bg = fc::LightGray; wc.scrollbar_button_bg = fc::LightGray;
wc.progressbar_fg = fc::DarkGray; wc.progressbar_fg = fc::DarkGray;
wc.progressbar_bg = fc::LightBlue; wc.progressbar_bg = fc::LightBlue;
if ( isKdeTerminal() )
wc.term_bg = fc::SteelBlue3;
if ( getMaxColor() < 16 ) // for 8 color mode
{
wc.term_fg = fc::Black;
wc.term_bg = fc::Blue;
wc.list_fg = fc::Black;
wc.list_bg = fc::LightGray;
wc.selected_list_fg = fc::Blue;
wc.selected_list_bg = fc::LightGray;
wc.dialog_fg = fc::Black;
wc.dialog_resize_fg = fc::Red;
wc.dialog_emphasis_fg = fc::Blue;
wc.dialog_bg = fc::LightGray;
wc.error_box_fg = fc::Black;
wc.error_box_emphasis_fg = fc::Red;
wc.error_box_bg = fc::LightGray;
wc.tooltip_fg = fc::LightGray;
wc.tooltip_bg = fc::Cyan;
wc.shadow_fg = fc::Black;
wc.shadow_bg = fc::LightGray; // only for transparent shadow
wc.current_element_focus_fg = fc::LightGray;
wc.current_element_focus_bg = fc::Red;
wc.current_element_fg = fc::LightGray;
wc.current_element_bg = fc::Blue;
wc.current_inc_search_element_fg = fc::Brown;
wc.selected_current_element_focus_fg = fc::Blue;
wc.selected_current_element_focus_bg = fc::Red;
wc.selected_current_element_fg = fc::Cyan;
wc.selected_current_element_bg = fc::Blue;
wc.label_fg = fc::Black;
wc.label_bg = fc::LightGray;
wc.label_inactive_fg = fc::Cyan;
wc.label_inactive_bg = fc::LightGray;
wc.label_hotkey_fg = fc::Red;
wc.label_hotkey_bg = fc::LightGray;
wc.label_emphasis_fg = fc::Blue;
wc.label_ellipsis_fg = fc::Black;
wc.inputfield_active_focus_fg = fc::LightGray;
wc.inputfield_active_focus_bg = fc::Blue;
wc.inputfield_active_fg = fc::Black;
wc.inputfield_active_bg = fc::Cyan;
wc.inputfield_inactive_fg = fc::Black;
wc.inputfield_inactive_bg = fc::LightGray;
wc.toggle_button_active_focus_fg = fc::LightGray;
wc.toggle_button_active_focus_bg = fc::Red;
wc.toggle_button_active_fg = fc::Black;
wc.toggle_button_active_bg = fc::LightGray;
wc.toggle_button_inactive_fg = fc::Cyan;
wc.toggle_button_inactive_bg = fc::LightGray;
wc.button_active_focus_fg = fc::LightGray;
wc.button_active_focus_bg = fc::Red;
wc.button_active_fg = fc::LightGray;
wc.button_active_bg = fc::Blue;
wc.button_inactive_fg = fc::Black;
wc.button_inactive_bg = fc::Blue;
wc.button_hotkey_fg = fc::LightGray;
wc.titlebar_active_fg = fc::LightGray;
wc.titlebar_active_bg = fc::Red;
wc.titlebar_inactive_fg = fc::Black;
wc.titlebar_inactive_bg = fc::LightGray;
wc.titlebar_button_fg = fc::Black;
wc.titlebar_button_bg = fc::LightGray;
wc.titlebar_button_focus_fg = fc::LightGray;
wc.titlebar_button_focus_bg = fc::Black;
wc.menu_active_focus_fg = fc::LightGray;
wc.menu_active_focus_bg = fc::Blue;
wc.menu_active_fg = fc::Black;
wc.menu_active_bg = fc::LightGray;
wc.menu_inactive_fg = fc::Cyan;
wc.menu_inactive_bg = fc::LightGray;
wc.menu_hotkey_fg = fc::Red;
wc.menu_hotkey_bg = fc::LightGray;
wc.statusbar_fg = fc::Black;
wc.statusbar_bg = fc::LightGray;
wc.statusbar_hotkey_fg = fc::Red;
wc.statusbar_hotkey_bg = fc::LightGray;
wc.statusbar_separator_fg = fc::Black;
wc.statusbar_active_fg = fc::LightGray;
wc.statusbar_active_bg = fc::Black;
wc.statusbar_active_hotkey_fg = fc::Red;
wc.statusbar_active_hotkey_bg = fc::Black;
wc.scrollbar_fg = fc::Black;
wc.scrollbar_bg = fc::LightGray;
wc.scrollbar_button_fg = fc::Black;
wc.scrollbar_button_bg = fc::LightGray;
wc.progressbar_fg = fc::Blue;
wc.progressbar_bg = fc::LightGray;
}
} }