mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 05:27:00 +03:00
move beos to new options API
This commit is contained in:
parent
182b85b9ec
commit
1b4e0d11d3
@ -90,7 +90,7 @@ endif
|
||||
S_BEOS := about.cpp bitmap.cpp download.cpp fetch_rsrc.cpp filetype.cpp \
|
||||
font.cpp gui.cpp login.cpp gui_options.cpp plotters.cpp \
|
||||
scaffolding.cpp search.cpp schedule.cpp thumbnail.cpp treeview.cpp \
|
||||
throbber.cpp window.cpp system_colour.cpp
|
||||
throbber.cpp window.cpp
|
||||
S_BEOS := $(addprefix beos/,$(S_BEOS))
|
||||
|
||||
RDEF_BEOS := res.rdef
|
||||
|
123
beos/gui.cpp
123
beos/gui.cpp
@ -398,6 +398,106 @@ static void gui_init2(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if !defined(__HAIKU__) && !defined(B_BEOS_VERSION_DANO)
|
||||
/* more ui_colors, R5 only had a few defined... */
|
||||
#define B_PANEL_TEXT_COLOR ((color_which)10)
|
||||
#define B_DOCUMENT_BACKGROUND_COLOR ((color_which)11)
|
||||
#define B_DOCUMENT_TEXT_COLOR ((color_which)12)
|
||||
#define B_CONTROL_BACKGROUND_COLOR ((color_which)13)
|
||||
#define B_CONTROL_TEXT_COLOR ((color_which)14)
|
||||
#define B_CONTROL_BORDER_COLOR ((color_which)15)
|
||||
#define B_CONTROL_HIGHLIGHT_COLOR ((color_which)16)
|
||||
#define B_NAVIGATION_BASE_COLOR ((color_which)4)
|
||||
#define B_NAVIGATION_PULSE_COLOR ((color_which)17)
|
||||
#define B_SHINE_COLOR ((color_which)18)
|
||||
#define B_SHADOW_COLOR ((color_which)19)
|
||||
#define B_MENU_SELECTED_BORDER_COLOR ((color_which)9)
|
||||
#define B_TOOL_TIP_BACKGROUND_COLOR ((color_which)20)
|
||||
#define B_TOOL_TIP_TEXT_COLOR ((color_which)21)
|
||||
#define B_SUCCESS_COLOR ((color_which)100)
|
||||
#define B_FAILURE_COLOR ((color_which)101)
|
||||
#define B_MENU_SELECTED_BACKGROUND_COLOR B_MENU_SELECTION_BACKGROUND_COLOR
|
||||
#define B_RANDOM_COLOR ((color_which)0x80000000)
|
||||
#define B_MICHELANGELO_FAVORITE_COLOR ((color_which)0x80000001)
|
||||
#define B_DSANDLER_FAVORITE_SKY_COLOR ((color_which)0x80000002)
|
||||
#define B_DSANDLER_FAVORITE_INK_COLOR ((color_which)0x80000003)
|
||||
#define B_DSANDLER_FAVORITE_SHOES_COLOR ((color_which)0x80000004)
|
||||
#define B_DAVE_BROWN_FAVORITE_COLOR ((color_which)0x80000005)
|
||||
#endif
|
||||
#if defined(B_BEOS_VERSION_DANO)
|
||||
#define B_TOOL_TIP_BACKGROUND_COLOR B_TOOLTIP_BACKGROUND_COLOR
|
||||
#define B_TOOL_TIP_TEXT_COLOR B_TOOLTIP_TEXT_COLOR
|
||||
#define
|
||||
#endif
|
||||
#define NOCOL ((color_which)0)
|
||||
|
||||
/**
|
||||
* set option from pen
|
||||
*/
|
||||
static nserror
|
||||
set_colour_from_ui(struct nsoption_s *opts,
|
||||
color_which ui,
|
||||
enum nsoption_e option,
|
||||
colour def_colour)
|
||||
{
|
||||
if (ui != NOCOL) {
|
||||
rgb_color c;
|
||||
if (ui == B_DESKTOP_COLOR) {
|
||||
BScreen s;
|
||||
c = s.DesktopColor();
|
||||
} else {
|
||||
c = ui_color(ui);
|
||||
}
|
||||
|
||||
def_colour = ((((uint32_t)c.blue << 16) & 0xff0000) |
|
||||
((c.green << 8) & 0x00ff00) |
|
||||
((c.red) & 0x0000ff));
|
||||
}
|
||||
return def_colour;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set option defaults for framebuffer frontend
|
||||
*
|
||||
* @param defaults The option table to update.
|
||||
* @return error status.
|
||||
*/
|
||||
static nserror set_defaults(struct nsoption_s *defaults)
|
||||
{
|
||||
/* set system colours for beos ui */
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ActiveBorder, 0x00000000);
|
||||
set_colour_from_ui(defaults, B_WINDOW_TAB_COLOR, NSOPTION_sys_colour_ActiveCaption, 0x00dddddd);
|
||||
set_colour_from_ui(defaults, B_PANEL_BACKGROUND_COLOR, NSOPTION_sys_colour_AppWorkspace, 0x00eeeeee);
|
||||
set_colour_from_ui(defaults, B_DESKTOP_COLOR, NSOPTION_sys_colour_Background, 0x00aa0000);
|
||||
set_colour_from_ui(defaults, B_CONTROL_BACKGROUND_COLOR, NSOPTION_sys_colour_ButtonFace, 0x00aaaaaa);
|
||||
set_colour_from_ui(defaults, B_CONTROL_HIGHLIGHT_COLOR, NSOPTION_sys_colour_ButtonHighlight, 0x00cccccc);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ButtonShadow, 0x00bbbbbb);
|
||||
set_colour_from_ui(defaults, B_CONTROL_TEXT_COLOR, NSOPTION_sys_colour_ButtonText, 0x00000000);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_CaptionText, 0x00000000);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_GrayText, 0x00777777);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_Highlight, 0x00ee0000);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_HighlightText, 0x00000000);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_InactiveBorder, 0x00000000);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_InactiveCaption, 0x00ffffff);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_InactiveCaptionText, 0x00cccccc);
|
||||
set_colour_from_ui(defaults, B_TOOL_TIP_BACKGROUND_COLOR, NSOPTION_sys_colour_InfoBackground, 0x00aaaaaa);
|
||||
set_colour_from_ui(defaults, B_TOOL_TIP_TEXT_COLOR, NSOPTION_sys_colour_InfoText, 0x00000000);
|
||||
set_colour_from_ui(defaults, B_MENU_BACKGROUND_COLOR, NSOPTION_sys_colour_Menu, 0x00aaaaaa);
|
||||
set_colour_from_ui(defaults, B_MENU_ITEM_TEXT_COLOR, NSOPTION_sys_colour_MenuText, 0x00000000);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_Scrollbar, 0x00aaaaaa);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDDarkShadow, 0x00555555);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDFace, 0x00dddddd);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDHighlight, 0x00aaaaaa);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDLightShadow, 0x00999999);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_ThreeDShadow, 0x00777777);
|
||||
set_colour_from_ui(defaults, B_DOCUMENT_BACKGROUND_COLOR, NSOPTION_sys_colour_Window, 0x00aaaaaa);
|
||||
set_colour_from_ui(defaults, NOCOL, NSOPTION_sys_colour_WindowFrame, 0x00000000);
|
||||
set_colour_from_ui(defaults, B_DOCUMENT_TEXT_COLOR, NSOPTION_sys_colour_WindowText, 0x00000000);
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures output logging stream is correctly configured
|
||||
*/
|
||||
@ -412,6 +512,7 @@ static bool nslog_stream_configure(FILE *fptr)
|
||||
/** Normal entry point from OS */
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
nserror ret;
|
||||
BPath options;
|
||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &options, true) == B_OK) {
|
||||
options.Append("x-vnd.NetSurf");
|
||||
@ -430,8 +531,19 @@ int main(int argc, char** argv)
|
||||
*/
|
||||
nslog_init(nslog_stream_configure, &argc, argv);
|
||||
|
||||
/* initialise netsurf */
|
||||
netsurf_init(&argc, &argv, options.Path(), messages);
|
||||
/* user options setup */
|
||||
ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
|
||||
if (ret != NSERROR_OK) {
|
||||
die("Options failed to initialise");
|
||||
}
|
||||
nsoption_read(options.Path(), NULL);
|
||||
nsoption_commandline(&argc, argv, NULL);
|
||||
|
||||
/* common initialisation */
|
||||
ret = netsurf_init(messages);
|
||||
if (ret != NSERROR_OK) {
|
||||
die("NetSurf failed to initialise");
|
||||
}
|
||||
|
||||
gui_init(argc, argv);
|
||||
gui_init2(argc, argv);
|
||||
@ -467,13 +579,6 @@ int gui_init_replicant(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Documented in utils/nsoption.h */
|
||||
void gui_options_init_defaults(void)
|
||||
{
|
||||
/* Set defaults for absent option strings */
|
||||
}
|
||||
|
||||
|
||||
void gui_init(int argc, char** argv)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
@ -1,387 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Vincent Sanders <vince@netsurf-browser.org>
|
||||
*
|
||||
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
||||
*
|
||||
* NetSurf is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* NetSurf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* System colour handling
|
||||
*
|
||||
*/
|
||||
|
||||
#define __STDBOOL_H__ 1
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Screen.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "utils/nsoption.h"
|
||||
#include "desktop/plot_style.h"
|
||||
|
||||
}
|
||||
|
||||
#include "beos/gui.h"
|
||||
|
||||
|
||||
#if !defined(__HAIKU__) && !defined(B_BEOS_VERSION_DANO)
|
||||
/* more ui_colors, R5 only had a few defined... */
|
||||
#define B_PANEL_TEXT_COLOR ((color_which)10)
|
||||
#define B_DOCUMENT_BACKGROUND_COLOR ((color_which)11)
|
||||
#define B_DOCUMENT_TEXT_COLOR ((color_which)12)
|
||||
#define B_CONTROL_BACKGROUND_COLOR ((color_which)13)
|
||||
#define B_CONTROL_TEXT_COLOR ((color_which)14)
|
||||
#define B_CONTROL_BORDER_COLOR ((color_which)15)
|
||||
#define B_CONTROL_HIGHLIGHT_COLOR ((color_which)16)
|
||||
#define B_NAVIGATION_BASE_COLOR ((color_which)4)
|
||||
#define B_NAVIGATION_PULSE_COLOR ((color_which)17)
|
||||
#define B_SHINE_COLOR ((color_which)18)
|
||||
#define B_SHADOW_COLOR ((color_which)19)
|
||||
#define B_MENU_SELECTED_BORDER_COLOR ((color_which)9)
|
||||
#define B_TOOL_TIP_BACKGROUND_COLOR ((color_which)20)
|
||||
#define B_TOOL_TIP_TEXT_COLOR ((color_which)21)
|
||||
#define B_SUCCESS_COLOR ((color_which)100)
|
||||
#define B_FAILURE_COLOR ((color_which)101)
|
||||
#define B_MENU_SELECTED_BACKGROUND_COLOR B_MENU_SELECTION_BACKGROUND_COLOR
|
||||
#define B_RANDOM_COLOR ((color_which)0x80000000)
|
||||
#define B_MICHELANGELO_FAVORITE_COLOR ((color_which)0x80000001)
|
||||
#define B_DSANDLER_FAVORITE_SKY_COLOR ((color_which)0x80000002)
|
||||
#define B_DSANDLER_FAVORITE_INK_COLOR ((color_which)0x80000003)
|
||||
#define B_DSANDLER_FAVORITE_SHOES_COLOR ((color_which)0x80000004)
|
||||
#define B_DAVE_BROWN_FAVORITE_COLOR ((color_which)0x80000005)
|
||||
#endif
|
||||
#if defined(B_BEOS_VERSION_DANO)
|
||||
#define B_TOOL_TIP_BACKGROUND_COLOR B_TOOLTIP_BACKGROUND_COLOR
|
||||
#define B_TOOL_TIP_TEXT_COLOR B_TOOLTIP_TEXT_COLOR
|
||||
#define
|
||||
#endif
|
||||
#define NOCOL ((color_which)0)
|
||||
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color css_colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
color_which ui;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&nsoption_colour(sys_colour_ActiveBorder),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&nsoption_colour(sys_colour_ActiveCaption),
|
||||
NULL,
|
||||
B_WINDOW_TAB_COLOR
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&nsoption_colour(sys_colour_AppWorkspace),
|
||||
NULL,
|
||||
B_PANEL_BACKGROUND_COLOR
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&nsoption_colour(sys_colour_Background),
|
||||
NULL,
|
||||
B_DESKTOP_COLOR
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&nsoption_colour(sys_colour_ButtonFace),
|
||||
NULL,
|
||||
B_CONTROL_BACKGROUND_COLOR
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&nsoption_colour(sys_colour_ButtonHighlight),
|
||||
NULL,
|
||||
B_CONTROL_HIGHLIGHT_COLOR
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&nsoption_colour(sys_colour_ButtonShadow),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&nsoption_colour(sys_colour_ButtonText),
|
||||
NULL,
|
||||
B_CONTROL_TEXT_COLOR
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&nsoption_colour(sys_colour_CaptionText),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&nsoption_colour(sys_colour_GrayText),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&nsoption_colour(sys_colour_Highlight),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&nsoption_colour(sys_colour_HighlightText),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&nsoption_colour(sys_colour_InactiveBorder),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&nsoption_colour(sys_colour_InactiveCaption),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&nsoption_colour(sys_colour_InactiveCaptionText),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&nsoption_colour(sys_colour_InfoBackground),
|
||||
NULL,
|
||||
B_TOOL_TIP_BACKGROUND_COLOR
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&nsoption_colour(sys_colour_InfoText),
|
||||
NULL,
|
||||
B_TOOL_TIP_TEXT_COLOR
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&nsoption_colour(sys_colour_Menu),
|
||||
NULL,
|
||||
B_MENU_BACKGROUND_COLOR
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&nsoption_colour(sys_colour_MenuText),
|
||||
NULL,
|
||||
B_MENU_ITEM_TEXT_COLOR
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&nsoption_colour(sys_colour_Scrollbar),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&nsoption_colour(sys_colour_ThreeDDarkShadow),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&nsoption_colour(sys_colour_ThreeDFace),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&nsoption_colour(sys_colour_ThreeDHighlight),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&nsoption_colour(sys_colour_ThreeDLightShadow),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&nsoption_colour(sys_colour_ThreeDShadow),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&nsoption_colour(sys_colour_Window),
|
||||
NULL,
|
||||
B_DOCUMENT_BACKGROUND_COLOR
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&nsoption_colour(sys_colour_WindowFrame),
|
||||
NULL,
|
||||
NOCOL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&nsoption_colour(sys_colour_WindowText),
|
||||
NULL,
|
||||
B_DOCUMENT_TEXT_COLOR
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#define colour_list_len (sizeof(colour_list) / sizeof(struct gui_system_colour_ctx))
|
||||
|
||||
static struct gui_system_colour_ctx *gui_system_colour_pw = NULL;
|
||||
|
||||
|
||||
bool gui_system_colour_init(void)
|
||||
{
|
||||
unsigned int ccount;
|
||||
|
||||
if (gui_system_colour_pw != NULL)
|
||||
return false;
|
||||
|
||||
/* Intern colour strings */
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (lwc_intern_string(colour_list[ccount].name,
|
||||
colour_list[ccount].length,
|
||||
&(colour_list[ccount].lwcstr)) != lwc_error_ok) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* pull in options if set (ie not transparent) */
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (*(colour_list[ccount].option_colour) != 0) {
|
||||
colour_list[ccount].css_colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
nsbeos_update_system_ui_colors();
|
||||
|
||||
gui_system_colour_pw = colour_list;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void gui_system_colour_finalize(void)
|
||||
{
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
lwc_string_unref(colour_list[ccount].lwcstr);
|
||||
}
|
||||
}
|
||||
|
||||
colour gui_system_colour_char(const char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strcmp(name, colour_list[ccount].name) == 0) {
|
||||
ret = colour_list[ccount].css_colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *css_colour)
|
||||
{
|
||||
unsigned int ccount;
|
||||
bool match;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (lwc_string_caseless_isequal(name,
|
||||
colour_list[ccount].lwcstr,
|
||||
&match) == lwc_error_ok && match) {
|
||||
*css_colour = colour_list[ccount].css_colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
||||
|
||||
void nsbeos_update_system_ui_colors(void)
|
||||
{
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (colour_list[ccount].ui == NOCOL)
|
||||
continue;
|
||||
rgb_color c = ui_color(colour_list[ccount].ui);
|
||||
if (colour_list[ccount].ui == B_DESKTOP_COLOR) {
|
||||
BScreen s;
|
||||
c = s.DesktopColor();
|
||||
}
|
||||
|
||||
//printf("uic[%d] = ui_color(%d) %02x %02x %02x %02x\n", ccount,
|
||||
// colour_list[ccount].ui, c.red, c.green, c.blue, c.alpha);
|
||||
|
||||
colour_list[ccount].css_colour = 0xff000000
|
||||
| ((((uint32_t)c.red << 16) & 0xff0000)
|
||||
| ((c.green << 8) & 0x00ff00)
|
||||
| ((c.blue) & 0x0000ff));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user