Splitting the FString example into sub-functions
This commit is contained in:
parent
0864055cab
commit
d8759ff51d
|
@ -1,6 +1,8 @@
|
|||
exclude:
|
||||
- /fonts/newfont.h
|
||||
- /fonts/vgafont.h
|
||||
- /ltmain.sh
|
||||
component_depth: 1
|
||||
component_depth: 3
|
||||
languages:
|
||||
- cpp
|
||||
- script
|
||||
|
|
|
@ -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>
|
||||
* Improved command line paramenter handling
|
||||
* New command line paramenter --no-terminal-detection
|
||||
|
|
|
@ -31,12 +31,14 @@
|
|||
#include <final/final.h>
|
||||
|
||||
|
||||
int main (int, char**)
|
||||
void init()
|
||||
{
|
||||
printf ("----------------[ terminal ]-------------------\n");
|
||||
std::cout << "----------------[ terminal ]-------------------"
|
||||
<< std::endl;
|
||||
|
||||
// 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") )
|
||||
{
|
||||
|
@ -44,21 +46,32 @@ int main (int, char**)
|
|||
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::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void inputStreamExample()
|
||||
{
|
||||
// Test: input stream (operator >>)
|
||||
FString in;
|
||||
std::cout << " Input: ";
|
||||
std::cin >> in;
|
||||
std::cout << " instream >> " << in << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void outputStreamExample()
|
||||
{
|
||||
// Test: output stream (operator <<)
|
||||
const FString& out = L"A test string for 0 \x20ac";
|
||||
std::cout << " outstream << " << out << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void streamingIntoFStringExample()
|
||||
{
|
||||
// Test: Streaming into a FString (operator <<)...
|
||||
|
||||
// ...from FStrings
|
||||
|
@ -120,7 +133,11 @@ int main (int, char**)
|
|||
FString streamer12;
|
||||
streamer12 << float(0.22222222);
|
||||
std::cout << " stream in: " << streamer12 << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void streamingFromFStringExample()
|
||||
{
|
||||
// Test: Streaming from a FString (operator >>)...
|
||||
|
||||
// ...to FStrings
|
||||
|
@ -214,10 +231,19 @@ int main (int, char**)
|
|||
{
|
||||
std::cerr << "Arithmetic error: " << ex.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void CStringOutputExample()
|
||||
{
|
||||
// Test: c-string output
|
||||
const FString& out = L"A test string for 0 \x20ac";
|
||||
printf (" c_str: \"%s\"\n", out.c_str());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void copyIntoFString()
|
||||
{
|
||||
// Test: copy a c++ string
|
||||
const FString& cpp_str( std::string("c++ String") );
|
||||
std::cout << " cpp_str: \"" << cpp_str << "\"" << std::endl;
|
||||
|
@ -229,12 +255,20 @@ int main (int, char**)
|
|||
// Test: copy a wide character
|
||||
const FString wch(L'w');
|
||||
std::cout << " wchar_t: '" << wch << "'" << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void utf8StringOutputExample()
|
||||
{
|
||||
// Test: utf-8 string
|
||||
const FString& len = "длина́";
|
||||
std::cout << " length: \"" << len << "\" has "
|
||||
<< len.getLength() << " characters" << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void letterCaseExample()
|
||||
{
|
||||
// Test: convert uppercase letter to lowercase
|
||||
const FString& lower = FString(L"InPut").toLower();
|
||||
std::wcout << L" toLower: " << lower << std::endl;
|
||||
|
@ -242,7 +276,11 @@ int main (int, char**)
|
|||
// Test: convert lowercase letter to uppercase
|
||||
const FString& upper = FString("inPut").toUpper();
|
||||
std::cout << " toUpper: " << upper << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void stringConcatenationExample()
|
||||
{
|
||||
// Test: concatenate two FStrings (operator +)
|
||||
const FString& add1 = FString("FString + ") + FString("FString");
|
||||
std::cout << " add: " << add1 << std::endl;
|
||||
|
@ -302,7 +340,11 @@ int main (int, char**)
|
|||
const FString& add13 = std::wstring(L"std::wstring")
|
||||
+ FString(" + FString");
|
||||
std::cout << " add: " << add13 << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void stringCompareExample()
|
||||
{
|
||||
// Test: compare operators ==, <=, <, >=, >, !=
|
||||
const FString& cmp = "compare";
|
||||
|
||||
|
@ -335,7 +377,11 @@ int main (int, char**)
|
|||
std::cout << " cmp: != Ok" << std::endl;
|
||||
else
|
||||
std::cout << " cmp: != Not Ok" << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void stringSplittingExample()
|
||||
{
|
||||
// Test: split a string with a delimiter and returns a vector (array)
|
||||
FString split_str = "a,b,c,d";
|
||||
std::cout << " split: \""
|
||||
|
@ -348,13 +394,21 @@ int main (int, char**)
|
|||
std::cout << " \"" << (*it) << "\"";
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void fromatStringExample()
|
||||
{
|
||||
// Test: format a string with sprintf
|
||||
FString formatStr = "";
|
||||
std::cout << " formatted: "
|
||||
<< formatStr.sprintf("sqrt(%d) = %d", 16, 4)
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void convertToNumberExample()
|
||||
{
|
||||
// Test: convert a string to a unsigned long interger
|
||||
try
|
||||
{
|
||||
|
@ -404,7 +458,11 @@ int main (int, char**)
|
|||
{
|
||||
std::cerr << "Arithmetic error: " << ex.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void convertNumberToStringExample()
|
||||
{
|
||||
// Test: convert integer and double value to a string
|
||||
FString num1, num2, num3;
|
||||
num1.setNumber(137);
|
||||
|
@ -416,7 +474,11 @@ int main (int, char**)
|
|||
<< num2 << " (signed)" << std::endl;
|
||||
std::cout << " setNumber: "
|
||||
<< num3 << " (long double)" << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void formatedNumberExample()
|
||||
{
|
||||
// Test: convert and format a integer number with thousand separator
|
||||
std::setlocale (LC_NUMERIC, "");
|
||||
FString fnum1, fnum2;
|
||||
|
@ -433,7 +495,11 @@ int main (int, char**)
|
|||
<< fnum1 << " (unsigned)" << std::endl;
|
||||
std::cout << "setFormatedNumber: "
|
||||
<< fnum2 << " (signed)" << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void trimExample()
|
||||
{
|
||||
// Test: remove whitespace from the end of a string
|
||||
const FString& trim_str = " A string \t";
|
||||
std::wcout << " rtrim: \""
|
||||
|
@ -446,9 +512,14 @@ int main (int, char**)
|
|||
// Test: remove whitespace from the beginning and end of a string
|
||||
std::cout << " trim: \""
|
||||
<< trim_str.trim() << "\"" << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void substringExample()
|
||||
{
|
||||
// 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: \""
|
||||
<< alphabet.left(11) << "\"" << std::endl;
|
||||
|
||||
|
@ -459,7 +530,11 @@ int main (int, char**)
|
|||
// Test: 11 characters from the right of the string
|
||||
std::cout << " right: \""
|
||||
<< alphabet.right(11) << "\"" << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void insertExample()
|
||||
{
|
||||
// Test: insert a string at index position 7
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void indexExample()
|
||||
{
|
||||
// Test: get character access at a specified index position
|
||||
FString index(5); // string with five characters
|
||||
index = "index";
|
||||
|
@ -488,7 +567,11 @@ int main (int, char**)
|
|||
{
|
||||
std::cerr << "Out of Range error: " << ex.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void iteratorExample()
|
||||
{
|
||||
// Test: character access with std::iterator
|
||||
const FString& stringIterator = "iterator";
|
||||
FString::iterator iter;
|
||||
|
@ -504,17 +587,29 @@ int main (int, char**)
|
|||
std::cout << " (front='" << char(stringIterator.front())
|
||||
<< "', back='" << char(stringIterator.back())
|
||||
<< "')" << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void overwriteExample()
|
||||
{
|
||||
// Test: overwrite string at position 10 with "for t"
|
||||
FString overwrite_std = "Overwrite the rest";
|
||||
std::cout << "overwrite: "
|
||||
<< overwrite_std.overwrite("for t", 10) << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void removeExample()
|
||||
{
|
||||
// Test: remove 2 characters at position 7
|
||||
FString remove_std = "A fast remove";
|
||||
std::cout << " remove: "
|
||||
<< remove_std.remove(7, 2) << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void substringIncludeExample()
|
||||
{
|
||||
// Test: includes a substring (positive test)
|
||||
FString include_std = "string";
|
||||
|
||||
|
@ -536,25 +631,78 @@ int main (int, char**)
|
|||
std::cout << " includes: \""
|
||||
<< include_std << "\" includes no \"data\" "
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void replaceExample()
|
||||
{
|
||||
// Test: find and replace a substring
|
||||
FString source_str = "computer and software";
|
||||
const FString& replace_str = source_str.replace("computer", "hard-");
|
||||
std::cout << " replace: "
|
||||
<< replace_str << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void tabToSpaceExample()
|
||||
{
|
||||
// Test: convert tabs to spaces
|
||||
const FString& tab_str = "1234\t5678";
|
||||
std::cout << " tab: "
|
||||
<< tab_str.expandTabs() << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void backspaceControlCharacterExample()
|
||||
{
|
||||
// Test: backspaces remove characters in the string
|
||||
const FString& bs_str = "t\b\bTesT\bt";
|
||||
std::cout << "backspace: "
|
||||
<< bs_str.removeBackspaces() << std::endl;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void deleteControlCharacterExample()
|
||||
{
|
||||
// Test: delete characters remove characters in the string
|
||||
const FString& del_str = "apple \177\177\177pietree";
|
||||
std::cout << " delete: "
|
||||
<< 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();
|
||||
}
|
||||
|
|
|
@ -273,7 +273,9 @@ class MyDialog : public FDialog
|
|||
|
||||
// Method
|
||||
void initMenu();
|
||||
void initMenuCallbacks();
|
||||
void initStatusBar();
|
||||
void initStatusBarCallbacks();
|
||||
void initWidgets();
|
||||
void adjustSize();
|
||||
|
||||
|
@ -298,6 +300,18 @@ class MyDialog : public FDialog
|
|||
void cb_setInput (FWidget*, data_ptr);
|
||||
|
||||
// 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;
|
||||
FListBox* myList;
|
||||
FString clipboard;
|
||||
|
@ -312,7 +326,9 @@ MyDialog::MyDialog (FWidget* parent)
|
|||
, clipboard()
|
||||
{
|
||||
initMenu(); // Initialize the program menu
|
||||
initMenuCallbacks(); // Initialize program menu callbacks
|
||||
initStatusBar(); // Initialize the status bar
|
||||
initStatusBarCallbacks(); // Initialize status bar callbacks
|
||||
initWidgets(); // Initialize the dialog widgets
|
||||
}
|
||||
|
||||
|
@ -338,11 +354,11 @@ void MyDialog::initMenu()
|
|||
Options->setDisable();
|
||||
FDialogListMenu* Window = new FDialogListMenu ("&Window", Menubar);
|
||||
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");
|
||||
|
||||
// "File" menu items
|
||||
FMenuItem* Open = new FMenuItem ("&Open...", File);
|
||||
Open = new FMenuItem ("&Open...", File);
|
||||
Open->addAccelerator (fc::Fckey_o); // Ctrl + O
|
||||
Open->setStatusbarMessage ("Locate and open a text file");
|
||||
FMenu* Recent = new FMenu ("&System files", File);
|
||||
|
@ -350,14 +366,14 @@ void MyDialog::initMenu()
|
|||
|
||||
FMenuItem* Line1 = new FMenuItem (File);
|
||||
Line1->setSeparator();
|
||||
FMenuItem* Quit = new FMenuItem ("&Quit", File);
|
||||
Quit = new FMenuItem ("&Quit", File);
|
||||
Quit->addAccelerator (fc::Fmkey_x); // Meta/Alt + X
|
||||
Quit->setStatusbarMessage ("Exit the program");
|
||||
|
||||
// "Recent" menu items
|
||||
FMenuItem* File1 = new FMenuItem ("/etc/services", Recent);
|
||||
FMenuItem* File2 = new FMenuItem ("/etc/fstab", Recent);
|
||||
FMenuItem* File3 = new FMenuItem ("/etc/passwd", Recent);
|
||||
File1 = new FMenuItem ("/etc/services", Recent);
|
||||
File2 = new FMenuItem ("/etc/fstab", Recent);
|
||||
File3 = new FMenuItem ("/etc/passwd", Recent);
|
||||
|
||||
// "Edit" menu items
|
||||
FMenuItem* Undo = new FMenuItem (fc::Fckey_z, "Undo", Edit);
|
||||
|
@ -366,23 +382,28 @@ void MyDialog::initMenu()
|
|||
Redo->setDisable();
|
||||
FMenuItem* Line2 = new FMenuItem (Edit);
|
||||
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"
|
||||
" 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");
|
||||
FMenuItem* Paste = new FMenuItem (fc::Fckey_v, "&Paste", Edit);
|
||||
Paste = new FMenuItem (fc::Fckey_v, "&Paste", Edit);
|
||||
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");
|
||||
|
||||
// "View" menu items
|
||||
FMenuItem* Env = new FMenuItem ("&Terminal...", View);
|
||||
Env = new FMenuItem ("&Terminal...", View);
|
||||
Env->setStatusbarMessage ("Informations about this terminal");
|
||||
FMenuItem* Drive = new FMenuItem ("&Drive symbols...", View);
|
||||
Drive = new FMenuItem ("&Drive symbols...", View);
|
||||
Drive->setStatusbarMessage ("Show drive symbols");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::initMenuCallbacks()
|
||||
{
|
||||
// Menu function callbacks
|
||||
|
||||
Open->addCallback
|
||||
(
|
||||
"clicked",
|
||||
|
@ -469,8 +490,13 @@ void MyDialog::initStatusBar()
|
|||
FStatusKey* key_F1 = new FStatusKey (fc::Fkey_f1, "About", statusbar);
|
||||
FStatusKey* key_F2 = new FStatusKey (fc::Fkey_f2, "View", statusbar);
|
||||
FStatusKey* key_F3 = new FStatusKey (fc::Fkey_f3, "Quit", statusbar);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void MyDialog::initStatusBarCallbacks()
|
||||
{
|
||||
// Add some function callbacks
|
||||
|
||||
key_F1->addCallback
|
||||
(
|
||||
"activate",
|
||||
|
|
|
@ -474,6 +474,8 @@ class FWidget : public FVTerm, public FObject
|
|||
void processDestroy();
|
||||
virtual void draw();
|
||||
static void setColorTheme();
|
||||
static void set8ColorTheme();
|
||||
static void set16ColorTheme();
|
||||
|
||||
// Data Members
|
||||
bool enable;
|
||||
|
|
|
@ -3833,7 +3833,8 @@ void FTerm::init_OptiMove()
|
|||
//----------------------------------------------------------------------
|
||||
void FTerm::init_OptiAttr()
|
||||
{
|
||||
// Attribute settings
|
||||
// Setting video attribute optimization
|
||||
|
||||
opti_attr->setNoColorVideo (int(FTermcap::attr_without_color));
|
||||
opti_attr->set_enter_bold_mode (TCAP(fc::t_enter_bold_mode));
|
||||
opti_attr->set_exit_bold_mode (TCAP(fc::t_exit_bold_mode));
|
||||
|
|
184
src/fwidget.cpp
184
src/fwidget.cpp
|
@ -2465,95 +2465,21 @@ void FWidget::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FWidget::setColorTheme()
|
||||
{
|
||||
wc.term_fg = fc::Black;
|
||||
wc.term_bg = fc::LightBlue;
|
||||
wc.list_fg = fc::Black;
|
||||
wc.list_bg = fc::White;
|
||||
wc.selected_list_fg = fc::Cyan;
|
||||
wc.selected_list_bg = fc::White;
|
||||
wc.dialog_fg = fc::Black;
|
||||
wc.dialog_resize_fg = fc::Cyan;
|
||||
wc.dialog_emphasis_fg = fc::Blue;
|
||||
wc.dialog_bg = fc::White;
|
||||
wc.error_box_fg = fc::White;
|
||||
wc.error_box_emphasis_fg = fc::Yellow;
|
||||
wc.error_box_bg = fc::LightRed;
|
||||
wc.tooltip_fg = fc::Black;
|
||||
wc.tooltip_bg = fc::Yellow;
|
||||
wc.shadow_fg = fc::Black;
|
||||
wc.shadow_bg = fc::LightGray; // only for transparent shadow
|
||||
wc.current_element_focus_fg = fc::White;
|
||||
wc.current_element_focus_bg = fc::Blue;
|
||||
wc.current_element_fg = fc::LightGray;
|
||||
wc.current_element_bg = fc::Blue;
|
||||
wc.current_inc_search_element_fg = fc::LightRed;
|
||||
wc.selected_current_element_focus_fg = fc::LightCyan;
|
||||
wc.selected_current_element_focus_bg = fc::Blue;
|
||||
wc.selected_current_element_fg = fc::LightBlue;
|
||||
wc.selected_current_element_bg = fc::Blue;
|
||||
wc.label_fg = fc::Black;
|
||||
wc.label_bg = fc::White;
|
||||
wc.label_inactive_fg = fc::LightGray;
|
||||
wc.label_inactive_bg = fc::White;
|
||||
wc.label_hotkey_fg = fc::Red;
|
||||
wc.label_hotkey_bg = fc::White;
|
||||
wc.label_emphasis_fg = fc::Blue;
|
||||
wc.label_ellipsis_fg = fc::DarkGray;
|
||||
wc.inputfield_active_focus_fg = fc::White;
|
||||
wc.inputfield_active_focus_bg = fc::Cyan;
|
||||
wc.inputfield_active_fg = fc::Black;
|
||||
wc.inputfield_active_bg = fc::LightGray;
|
||||
wc.inputfield_inactive_fg = fc::DarkGray;
|
||||
wc.inputfield_inactive_bg = fc::LightGray;
|
||||
wc.toggle_button_active_focus_fg = fc::White;
|
||||
wc.toggle_button_active_focus_bg = fc::Cyan;
|
||||
wc.toggle_button_active_fg = fc::Black;
|
||||
wc.toggle_button_active_bg = fc::White;
|
||||
wc.toggle_button_inactive_fg = fc::LightGray;
|
||||
wc.toggle_button_inactive_bg = fc::White;
|
||||
wc.button_active_focus_fg = fc::LightGray;
|
||||
wc.button_active_focus_bg = fc::Blue;
|
||||
wc.button_active_fg = fc::LightGray;
|
||||
wc.button_active_bg = fc::DarkGray;
|
||||
wc.button_inactive_fg = fc::DarkGray;
|
||||
wc.button_inactive_bg = fc::LightGray;
|
||||
wc.button_hotkey_fg = fc::White;
|
||||
wc.titlebar_active_fg = fc::White;
|
||||
wc.titlebar_active_bg = fc::Blue;
|
||||
wc.titlebar_inactive_fg = fc::LightGray;
|
||||
wc.titlebar_inactive_bg = fc::DarkGray;
|
||||
wc.titlebar_button_fg = fc::DarkGray;
|
||||
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::White;
|
||||
wc.menu_active_focus_bg = fc::Blue;
|
||||
wc.menu_active_fg = fc::Black;
|
||||
wc.menu_active_bg = fc::White;
|
||||
wc.menu_inactive_fg = fc::LightGray;
|
||||
wc.menu_inactive_bg = fc::White;
|
||||
wc.menu_hotkey_fg = fc::Red;
|
||||
wc.menu_hotkey_bg = fc::White;
|
||||
wc.statusbar_fg = fc::White;
|
||||
wc.statusbar_bg = fc::Blue;
|
||||
wc.statusbar_hotkey_fg = fc::LightRed;
|
||||
wc.statusbar_hotkey_bg = fc::Blue;
|
||||
wc.statusbar_separator_fg = fc::Black;
|
||||
wc.statusbar_active_fg = fc::Blue;
|
||||
wc.statusbar_active_bg = fc::White;
|
||||
wc.statusbar_active_hotkey_fg = fc::DarkGray;
|
||||
wc.statusbar_active_hotkey_bg = fc::White;
|
||||
wc.scrollbar_fg = fc::DarkGray;
|
||||
wc.scrollbar_bg = fc::LightBlue;
|
||||
wc.scrollbar_button_fg = fc::Black;
|
||||
wc.scrollbar_button_bg = fc::LightGray;
|
||||
wc.progressbar_fg = fc::DarkGray;
|
||||
wc.progressbar_bg = fc::LightBlue;
|
||||
if ( getMaxColor() < 16 ) // for 8 color mode
|
||||
{
|
||||
set8ColorTheme();
|
||||
}
|
||||
else
|
||||
{
|
||||
set16ColorTheme();
|
||||
|
||||
if ( isKdeTerminal() )
|
||||
wc.term_bg = fc::SteelBlue3;
|
||||
}
|
||||
}
|
||||
|
||||
if ( getMaxColor() < 16 ) // for 8 color mode
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::set8ColorTheme()
|
||||
{
|
||||
wc.term_fg = fc::Black;
|
||||
wc.term_bg = fc::Blue;
|
||||
|
@ -2640,4 +2566,92 @@ void FWidget::setColorTheme()
|
|||
wc.progressbar_fg = fc::Blue;
|
||||
wc.progressbar_bg = fc::LightGray;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FWidget::set16ColorTheme()
|
||||
{
|
||||
wc.term_fg = fc::Black;
|
||||
wc.term_bg = fc::LightBlue;
|
||||
wc.list_fg = fc::Black;
|
||||
wc.list_bg = fc::White;
|
||||
wc.selected_list_fg = fc::Cyan;
|
||||
wc.selected_list_bg = fc::White;
|
||||
wc.dialog_fg = fc::Black;
|
||||
wc.dialog_resize_fg = fc::Cyan;
|
||||
wc.dialog_emphasis_fg = fc::Blue;
|
||||
wc.dialog_bg = fc::White;
|
||||
wc.error_box_fg = fc::White;
|
||||
wc.error_box_emphasis_fg = fc::Yellow;
|
||||
wc.error_box_bg = fc::LightRed;
|
||||
wc.tooltip_fg = fc::Black;
|
||||
wc.tooltip_bg = fc::Yellow;
|
||||
wc.shadow_fg = fc::Black;
|
||||
wc.shadow_bg = fc::LightGray; // only for transparent shadow
|
||||
wc.current_element_focus_fg = fc::White;
|
||||
wc.current_element_focus_bg = fc::Blue;
|
||||
wc.current_element_fg = fc::LightGray;
|
||||
wc.current_element_bg = fc::Blue;
|
||||
wc.current_inc_search_element_fg = fc::LightRed;
|
||||
wc.selected_current_element_focus_fg = fc::LightCyan;
|
||||
wc.selected_current_element_focus_bg = fc::Blue;
|
||||
wc.selected_current_element_fg = fc::LightBlue;
|
||||
wc.selected_current_element_bg = fc::Blue;
|
||||
wc.label_fg = fc::Black;
|
||||
wc.label_bg = fc::White;
|
||||
wc.label_inactive_fg = fc::LightGray;
|
||||
wc.label_inactive_bg = fc::White;
|
||||
wc.label_hotkey_fg = fc::Red;
|
||||
wc.label_hotkey_bg = fc::White;
|
||||
wc.label_emphasis_fg = fc::Blue;
|
||||
wc.label_ellipsis_fg = fc::DarkGray;
|
||||
wc.inputfield_active_focus_fg = fc::White;
|
||||
wc.inputfield_active_focus_bg = fc::Cyan;
|
||||
wc.inputfield_active_fg = fc::Black;
|
||||
wc.inputfield_active_bg = fc::LightGray;
|
||||
wc.inputfield_inactive_fg = fc::DarkGray;
|
||||
wc.inputfield_inactive_bg = fc::LightGray;
|
||||
wc.toggle_button_active_focus_fg = fc::White;
|
||||
wc.toggle_button_active_focus_bg = fc::Cyan;
|
||||
wc.toggle_button_active_fg = fc::Black;
|
||||
wc.toggle_button_active_bg = fc::White;
|
||||
wc.toggle_button_inactive_fg = fc::LightGray;
|
||||
wc.toggle_button_inactive_bg = fc::White;
|
||||
wc.button_active_focus_fg = fc::LightGray;
|
||||
wc.button_active_focus_bg = fc::Blue;
|
||||
wc.button_active_fg = fc::LightGray;
|
||||
wc.button_active_bg = fc::DarkGray;
|
||||
wc.button_inactive_fg = fc::DarkGray;
|
||||
wc.button_inactive_bg = fc::LightGray;
|
||||
wc.button_hotkey_fg = fc::White;
|
||||
wc.titlebar_active_fg = fc::White;
|
||||
wc.titlebar_active_bg = fc::Blue;
|
||||
wc.titlebar_inactive_fg = fc::LightGray;
|
||||
wc.titlebar_inactive_bg = fc::DarkGray;
|
||||
wc.titlebar_button_fg = fc::DarkGray;
|
||||
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::White;
|
||||
wc.menu_active_focus_bg = fc::Blue;
|
||||
wc.menu_active_fg = fc::Black;
|
||||
wc.menu_active_bg = fc::White;
|
||||
wc.menu_inactive_fg = fc::LightGray;
|
||||
wc.menu_inactive_bg = fc::White;
|
||||
wc.menu_hotkey_fg = fc::Red;
|
||||
wc.menu_hotkey_bg = fc::White;
|
||||
wc.statusbar_fg = fc::White;
|
||||
wc.statusbar_bg = fc::Blue;
|
||||
wc.statusbar_hotkey_fg = fc::LightRed;
|
||||
wc.statusbar_hotkey_bg = fc::Blue;
|
||||
wc.statusbar_separator_fg = fc::Black;
|
||||
wc.statusbar_active_fg = fc::Blue;
|
||||
wc.statusbar_active_bg = fc::White;
|
||||
wc.statusbar_active_hotkey_fg = fc::DarkGray;
|
||||
wc.statusbar_active_hotkey_bg = fc::White;
|
||||
wc.scrollbar_fg = fc::DarkGray;
|
||||
wc.scrollbar_bg = fc::LightBlue;
|
||||
wc.scrollbar_button_fg = fc::Black;
|
||||
wc.scrollbar_button_bg = fc::LightGray;
|
||||
wc.progressbar_fg = fc::DarkGray;
|
||||
wc.progressbar_bg = fc::LightBlue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue