Fix logbook selection colour

* Use fl_contrast to adjust the foreground colour of the selected row
* Make cosmetic change to logbook window title
pull/2/head
Stelios Bounanos 2008-12-18 05:25:21 +00:00
rodzic 8e1ef5a7ff
commit e767b68a8c
2 zmienionych plików z 23 dodań i 15 usunięć

Wyświetl plik

@ -32,7 +32,9 @@ void start_logbook ()
logbook_filename = progdefaults.logbookfilename; logbook_filename = progdefaults.logbookfilename;
adifFile.readFile (logbook_filename.c_str(), &qsodb); adifFile.readFile (logbook_filename.c_str(), &qsodb);
dlgLogbook->copy_label(fl_filename_name(logbook_filename.c_str())); string label = "Logbook - ";
label.append(fl_filename_name(logbook_filename.c_str()));
dlgLogbook->copy_label(label.c_str());
loadBrowser(); loadBrowser();
qsodb.isdirty(0); qsodb.isdirty(0);

Wyświetl plik

@ -109,16 +109,20 @@ void Table::drawRow(int row, char *rowData[], int x, int y) {
// Draw background box. // Draw background box.
if (row != selected) { if (row != selected) {
Fl_Color bg; Fl_Color bg;
if (!withGrid && row % 2 == 0) { // different bg for consecutive rows if (!withGrid && row % 2 == 0) // different bg for consecutive rows
bg = color();
else {
bg = fl_color_average(color(), FL_BLACK, .9); bg = fl_color_average(color(), FL_BLACK, .9);
if (fl_contrast(bg, FL_BLACK) == FL_WHITE) // widget has very dark text bg if (fl_contrast(bg, FL_BLACK) == FL_WHITE) // widget has very dark text bg
bg = fl_color_average(color(), FL_WHITE, .9); bg = fl_color_average(color(), FL_WHITE, .9);
} }
else
bg = color();
fl_rectf(iX, y, tableWidth - hScroll->value(), rowHeight, bg); fl_rectf(iX, y, tableWidth - hScroll->value(), rowHeight, bg);
fl_color(FL_FOREGROUND_COLOR);
} }
else if (Fl::focus() == this) { else {
if (Fl::focus() == this) {
fl_rectf(iX, y, tableWidth - hScroll->value(), rowHeight, selection_color()); fl_rectf(iX, y, tableWidth - hScroll->value(), rowHeight, selection_color());
fl_color(FL_FOREGROUND_COLOR); fl_color(FL_FOREGROUND_COLOR);
@ -130,7 +134,9 @@ void Table::drawRow(int row, char *rowData[], int x, int y) {
else else
fl_rectf(iX, y, tableWidth - hScroll->value(), rowHeight, selection_color()); fl_rectf(iX, y, tableWidth - hScroll->value(), rowHeight, selection_color());
fl_color(FL_FOREGROUND_COLOR); fl_color(fl_contrast(FL_FOREGROUND_COLOR, selection_color()));
}
// Get color from highlighter. // Get color from highlighter.
Fl_Color color; Fl_Color color;