mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-18 16:49:18 +03:00
add default system colour handlers to each frontend
svn path=/trunk/netsurf/; revision=11530
This commit is contained in:
parent
42f89d4e0b
commit
fbb1139214
@ -59,7 +59,7 @@ S_AMIGA := compat.c gui.c tree.c history.c hotlist.c schedule.c \
|
||||
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
|
||||
cookies.c context_menu.c clipboard.c save_complete.c \
|
||||
fetch_mailto.c search.c history_local.c download.c iff_dr2d.c \
|
||||
sslcert.c gui_options.c print.c theme.c drag.c icon.c \
|
||||
sslcert.c gui_options.c print.c theme.c drag.c icon.c system_colour.c \
|
||||
stringview/stringview.c stringview/urlhistory.c
|
||||
S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
|
||||
|
||||
|
284
amiga/system_colour.c
Normal file
284
amiga/system_colour.c
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ActiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ActiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&option_sys_colour_AppWorkspace,
|
||||
NULL
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&option_sys_colour_Background,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ButtonFace,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ButtonHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&option_sys_colour_ButtonShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ButtonText,
|
||||
NULL
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_CaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_GrayText,
|
||||
NULL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&option_sys_colour_Highlight,
|
||||
NULL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_HighlightText,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_InactiveCaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_InfoBackground,
|
||||
NULL
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_InfoText,
|
||||
NULL
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Menu,
|
||||
NULL
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_MenuText,
|
||||
NULL
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Scrollbar,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&option_sys_colour_ThreeDDarkShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ThreeDFace,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ThreeDHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&option_sys_colour_ThreeDLightShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&option_sys_colour_ThreeDShadow,
|
||||
NULL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Window,
|
||||
NULL
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowFrame,
|
||||
NULL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowText,
|
||||
NULL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#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].colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
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(char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strncasecmp(name,
|
||||
colour_list[ccount].name,
|
||||
colour_list[ccount].length) == 0) {
|
||||
ret = colour_list[ccount].colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *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) {
|
||||
*colour = colour_list[ccount].colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
@ -40,7 +40,7 @@ S_ATARI := gui.c findfile.c filetype.c misc.c bitmap.c schedule.c \
|
||||
plot.c plot/plotter.c plot/plotter_vdi.c plot/eddi.s \
|
||||
plot/font_vdi.c plot/font_freetype.c \
|
||||
browser_win.c toolbar.c statusbar.c browser.c \
|
||||
global_evnt.c
|
||||
global_evnt.c system_colour.c
|
||||
S_ATARI := $(addprefix atari/,$(S_ATARI))
|
||||
|
||||
|
||||
|
284
atari/system_colour.c
Normal file
284
atari/system_colour.c
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ActiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ActiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&option_sys_colour_AppWorkspace,
|
||||
NULL
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&option_sys_colour_Background,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ButtonFace,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ButtonHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&option_sys_colour_ButtonShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ButtonText,
|
||||
NULL
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_CaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_GrayText,
|
||||
NULL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&option_sys_colour_Highlight,
|
||||
NULL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_HighlightText,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_InactiveCaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_InfoBackground,
|
||||
NULL
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_InfoText,
|
||||
NULL
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Menu,
|
||||
NULL
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_MenuText,
|
||||
NULL
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Scrollbar,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&option_sys_colour_ThreeDDarkShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ThreeDFace,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ThreeDHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&option_sys_colour_ThreeDLightShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&option_sys_colour_ThreeDShadow,
|
||||
NULL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Window,
|
||||
NULL
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowFrame,
|
||||
NULL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowText,
|
||||
NULL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#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].colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
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(char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strncasecmp(name,
|
||||
colour_list[ccount].name,
|
||||
colour_list[ccount].length) == 0) {
|
||||
ret = colour_list[ccount].colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *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) {
|
||||
*colour = colour_list[ccount].colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
@ -89,7 +89,7 @@ S_BEOS := beos_about.cpp beos_bitmap.cpp beos_fetch_rsrc.cpp \
|
||||
beos_options.cpp beos_plotters.cpp beos_save_complete.cpp \
|
||||
beos_scaffolding.cpp beos_search.cpp beos_schedule.cpp \
|
||||
beos_thumbnail.cpp beos_treeview.cpp beos_throbber.cpp \
|
||||
beos_window.cpp
|
||||
beos_window.cpp system_colour.cpp
|
||||
S_BEOS := $(addprefix beos/,$(S_BEOS))
|
||||
RDEF_BEOS := beos_res.rdef
|
||||
RDEF_BEOS := $(addprefix beos/,$(RDEF_BEOS))
|
||||
|
284
beos/system_colour.cpp
Normal file
284
beos/system_colour.cpp
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ActiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ActiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&option_sys_colour_AppWorkspace,
|
||||
NULL
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&option_sys_colour_Background,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ButtonFace,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ButtonHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&option_sys_colour_ButtonShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ButtonText,
|
||||
NULL
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_CaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_GrayText,
|
||||
NULL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&option_sys_colour_Highlight,
|
||||
NULL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_HighlightText,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_InactiveCaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_InfoBackground,
|
||||
NULL
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_InfoText,
|
||||
NULL
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Menu,
|
||||
NULL
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_MenuText,
|
||||
NULL
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Scrollbar,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&option_sys_colour_ThreeDDarkShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ThreeDFace,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ThreeDHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&option_sys_colour_ThreeDLightShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&option_sys_colour_ThreeDShadow,
|
||||
NULL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Window,
|
||||
NULL
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowFrame,
|
||||
NULL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowText,
|
||||
NULL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#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].colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
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(char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strncasecmp(name,
|
||||
colour_list[ccount].name,
|
||||
colour_list[ccount].length) == 0) {
|
||||
ret = colour_list[ccount].colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *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) {
|
||||
*colour = colour_list[ccount].colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
@ -54,7 +54,7 @@ endif
|
||||
ifneq ($(UNIVERSAL),)
|
||||
UNIVERSAL_FLAGS := $(foreach arch,$(UNIVERSAL),-arch $(arch) )
|
||||
CFLAGS += $(UNIVERSAL_FLAGS)
|
||||
LDFLAGS += $(UNIVERSAL_FLAGS)
|
||||
LDFLAGS += $(UNIVERSAL_FLAGS)
|
||||
CXXFLAGS += $(UNIVERSAL_FLAGS)
|
||||
endif
|
||||
|
||||
@ -86,7 +86,8 @@ S_COCOA := \
|
||||
thumbnail.m \
|
||||
url.m \
|
||||
utf8.m \
|
||||
utils.m
|
||||
utils.m \
|
||||
system_colour.m
|
||||
|
||||
S_TABBAR := \
|
||||
NSBezierPath_AMShading.m \
|
||||
|
284
cocoa/system_colour.m
Normal file
284
cocoa/system_colour.m
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#import "utils/utils.h"
|
||||
#import "utils/log.h"
|
||||
#import "desktop/gui.h"
|
||||
#import "desktop/options.h"
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ActiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ActiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&option_sys_colour_AppWorkspace,
|
||||
NULL
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&option_sys_colour_Background,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ButtonFace,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ButtonHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&option_sys_colour_ButtonShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ButtonText,
|
||||
NULL
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_CaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_GrayText,
|
||||
NULL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&option_sys_colour_Highlight,
|
||||
NULL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_HighlightText,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_InactiveCaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_InfoBackground,
|
||||
NULL
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_InfoText,
|
||||
NULL
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Menu,
|
||||
NULL
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_MenuText,
|
||||
NULL
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Scrollbar,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&option_sys_colour_ThreeDDarkShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ThreeDFace,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ThreeDHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&option_sys_colour_ThreeDLightShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&option_sys_colour_ThreeDShadow,
|
||||
NULL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Window,
|
||||
NULL
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowFrame,
|
||||
NULL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowText,
|
||||
NULL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#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].colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
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(char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strncasecmp(name,
|
||||
colour_list[ccount].name,
|
||||
colour_list[ccount].length) == 0) {
|
||||
ret = colour_list[ccount].colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *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) {
|
||||
*colour = colour_list[ccount].colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
@ -118,7 +118,7 @@ nserror nscss_create_css_data(struct content_css_data *c,
|
||||
params.resolve_pw = NULL;
|
||||
params.import = NULL;
|
||||
params.import_pw = NULL;
|
||||
params.color = NULL;
|
||||
params.color = gui_system_colour;
|
||||
params.color_pw = NULL;
|
||||
|
||||
error = css_stylesheet_create(¶ms, ns_realloc, NULL, &c->sheet);
|
||||
@ -460,7 +460,7 @@ css_error nscss_import_complete(struct content_css_data *c,
|
||||
params.resolve_pw = NULL;
|
||||
params.import = NULL;
|
||||
params.import_pw = NULL;
|
||||
params.color = NULL;
|
||||
params.color = gui_system_colour;
|
||||
params.color_pw = NULL;
|
||||
|
||||
error = css_stylesheet_create(¶ms,
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "css/internal.h"
|
||||
#include "css/select.h"
|
||||
#include "css/utils.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
#include "utils/log.h"
|
||||
#include "utils/url.h"
|
||||
@ -148,7 +149,7 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len,
|
||||
params.resolve_pw = NULL;
|
||||
params.import = NULL;
|
||||
params.import_pw = NULL;
|
||||
params.color = NULL;
|
||||
params.color = gui_system_colour;
|
||||
params.color_pw = NULL;
|
||||
|
||||
error = css_stylesheet_create(¶ms, alloc, pw, &sheet);
|
||||
|
@ -56,6 +56,10 @@ typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET,
|
||||
GUI_POINTER_PROGRESS } gui_pointer_shape;
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
#include <libcss/libcss.h>
|
||||
|
||||
#include "utils/config.h"
|
||||
#include "content/content.h"
|
||||
#include "content/hlcache.h"
|
||||
@ -141,4 +145,13 @@ void gui_cert_verify(const char *url, const struct ssl_cert_info *certs,
|
||||
unsigned long num, nserror (*cb)(bool proceed, void *pw),
|
||||
void *cbpw);
|
||||
|
||||
/** css callback to obtain named system colours from a frontend. */
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *color);
|
||||
|
||||
/** Obtain a named system colour from a frontend. */
|
||||
colour gui_system_colour_char(char *name);
|
||||
|
||||
bool gui_system_colour_init(void);
|
||||
void gui_system_colour_finalize(void);
|
||||
|
||||
#endif
|
||||
|
@ -152,6 +152,9 @@ nserror netsurf_init(int *pargc,
|
||||
|
||||
llcache_initialise(netsurf_llcache_query_handler, NULL);
|
||||
|
||||
/* Initialize system colours */
|
||||
gui_system_colour_init();
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
@ -177,20 +180,31 @@ void netsurf_exit(void)
|
||||
{
|
||||
LOG(("Closing GUI"));
|
||||
gui_quit();
|
||||
|
||||
LOG(("Closing search and related resources"));
|
||||
search_web_cleanup();
|
||||
|
||||
LOG(("Finalising high-level cache"));
|
||||
hlcache_finalise();
|
||||
|
||||
LOG(("Finalising low-level cache"));
|
||||
llcache_finalise();
|
||||
|
||||
LOG(("Closing fetches"));
|
||||
fetch_quit();
|
||||
|
||||
LOG(("Closing utf8"));
|
||||
utf8_finalise();
|
||||
|
||||
LOG(("Destroying URLdb"));
|
||||
urldb_destroy();
|
||||
|
||||
LOG(("Destroying System colours"));
|
||||
gui_system_colour_finalize();
|
||||
|
||||
LOG(("Remaining lwc strings:"));
|
||||
lwc_iterate_strings(netsurf_lwc_iterator, NULL);
|
||||
|
||||
LOG(("Exited successfully"));
|
||||
}
|
||||
|
||||
|
@ -193,6 +193,37 @@ colour option_gui_colour_bg_1 = 0xFFCCBB; /** Background (bbggrr) */
|
||||
colour option_gui_colour_fg_1 = 0x000000; /** Foreground (bbggrr) */
|
||||
colour option_gui_colour_fg_2 = 0xFFFBF8; /** Foreground selected (bbggrr) */
|
||||
|
||||
/* system colours */
|
||||
colour option_sys_colour_ActiveBorder = 0x00000000;
|
||||
colour option_sys_colour_ActiveCaption = 0x00000000;
|
||||
colour option_sys_colour_AppWorkspace = 0x00000000;
|
||||
colour option_sys_colour_Background = 0x00000000;
|
||||
colour option_sys_colour_ButtonFace = 0x00000000;
|
||||
colour option_sys_colour_ButtonHighlight = 0x00000000;
|
||||
colour option_sys_colour_ButtonShadow = 0x00000000;
|
||||
colour option_sys_colour_ButtonText = 0x00000000;
|
||||
colour option_sys_colour_CaptionText = 0x0000000;
|
||||
colour option_sys_colour_GrayText = 0x00000000;
|
||||
colour option_sys_colour_Highlight = 0x00000000;
|
||||
colour option_sys_colour_HighlightText = 0x00000000;
|
||||
colour option_sys_colour_InactiveBorder = 0x00000000;
|
||||
colour option_sys_colour_InactiveCaption = 0x00000000;
|
||||
colour option_sys_colour_InactiveCaptionText = 0x00000000;
|
||||
colour option_sys_colour_InfoBackground = 0x00000000;
|
||||
colour option_sys_colour_InfoText = 0x00000000;
|
||||
colour option_sys_colour_Menu = 0x00000000;
|
||||
colour option_sys_colour_MenuText = 0x0000000;
|
||||
colour option_sys_colour_Scrollbar = 0x0000000;
|
||||
colour option_sys_colour_ThreeDDarkShadow = 0x000000;
|
||||
colour option_sys_colour_ThreeDFace = 0x000000;
|
||||
colour option_sys_colour_ThreeDHighlight = 0x000000;
|
||||
colour option_sys_colour_ThreeDLightShadow = 0x000000;
|
||||
colour option_sys_colour_ThreeDShadow = 0x000000;
|
||||
colour option_sys_colour_Window = 0x000000;
|
||||
colour option_sys_colour_WindowFrame = 0x000000;
|
||||
colour option_sys_colour_WindowText = 0x000000;
|
||||
|
||||
|
||||
EXTRA_OPTION_DEFINE
|
||||
|
||||
|
||||
@ -276,6 +307,36 @@ struct {
|
||||
{ "gui_colour_fg_1", OPTION_COLOUR, &option_gui_colour_fg_1},
|
||||
{ "gui_colour_fg_2", OPTION_COLOUR, &option_gui_colour_fg_2},
|
||||
|
||||
/* System colours */
|
||||
{ "sys_colour_ActiveBorder",OPTION_COLOUR,&option_sys_colour_ActiveBorder },
|
||||
{ "sys_colour_ActiveCaption",OPTION_COLOUR,&option_sys_colour_ActiveCaption },
|
||||
{ "sys_colour_AppWorkspace",OPTION_COLOUR,&option_sys_colour_AppWorkspace },
|
||||
{ "sys_colour_Background",OPTION_COLOUR,&option_sys_colour_Background },
|
||||
{ "sys_colour_ButtonFace",OPTION_COLOUR,&option_sys_colour_ButtonFace },
|
||||
{ "sys_colour_ButtonHighlight",OPTION_COLOUR,&option_sys_colour_ButtonHighlight },
|
||||
{ "sys_colour_ButtonShadow",OPTION_COLOUR,&option_sys_colour_ButtonShadow },
|
||||
{ "sys_colour_ButtonText",OPTION_COLOUR,&option_sys_colour_ButtonText },
|
||||
{ "sys_colour_CaptionText",OPTION_COLOUR,&option_sys_colour_CaptionText },
|
||||
{ "sys_colour_GrayText",OPTION_COLOUR,&option_sys_colour_GrayText },
|
||||
{ "sys_colour_Highlight",OPTION_COLOUR,&option_sys_colour_Highlight },
|
||||
{ "sys_colour_HighlightText",OPTION_COLOUR,&option_sys_colour_HighlightText },
|
||||
{ "sys_colour_InactiveBorder",OPTION_COLOUR,&option_sys_colour_InactiveBorder },
|
||||
{ "sys_colour_InactiveCaption",OPTION_COLOUR,&option_sys_colour_InactiveCaption },
|
||||
{ "sys_colour_InactiveCaptionText",OPTION_COLOUR,&option_sys_colour_InactiveCaptionText },
|
||||
{ "sys_colour_InfoBackground",OPTION_COLOUR,&option_sys_colour_InfoBackground },
|
||||
{ "sys_colour_InfoText",OPTION_COLOUR,&option_sys_colour_InfoText },
|
||||
{ "sys_colour_Menu",OPTION_COLOUR,&option_sys_colour_Menu },
|
||||
{ "sys_colour_MenuText",OPTION_COLOUR,&option_sys_colour_MenuText },
|
||||
{ "sys_colour_Scrollbar",OPTION_COLOUR,&option_sys_colour_Scrollbar },
|
||||
{ "sys_colour_ThreeDDarkShadow",OPTION_COLOUR,&option_sys_colour_ThreeDDarkShadow },
|
||||
{ "sys_colour_ThreeDFace",OPTION_COLOUR,&option_sys_colour_ThreeDFace },
|
||||
{ "sys_colour_ThreeDHighlight",OPTION_COLOUR,&option_sys_colour_ThreeDHighlight },
|
||||
{ "sys_colour_ThreeDLightShadow",OPTION_COLOUR,&option_sys_colour_ThreeDLightShadow },
|
||||
{ "sys_colour_ThreeDShadow",OPTION_COLOUR,&option_sys_colour_ThreeDShadow },
|
||||
{ "sys_colour_Window",OPTION_COLOUR,&option_sys_colour_Window },
|
||||
{ "sys_colour_WindowFrame",OPTION_COLOUR,&option_sys_colour_WindowFrame },
|
||||
{ "sys_colour_WindowText",OPTION_COLOUR,&option_sys_colour_WindowText },
|
||||
|
||||
EXTRA_OPTION_TABLE
|
||||
};
|
||||
|
||||
|
@ -113,6 +113,35 @@ extern colour option_gui_colour_bg_1;
|
||||
extern colour option_gui_colour_fg_1;
|
||||
extern colour option_gui_colour_fg_2;
|
||||
|
||||
extern colour option_sys_colour_ActiveBorder;
|
||||
extern colour option_sys_colour_ActiveCaption;
|
||||
extern colour option_sys_colour_AppWorkspace;
|
||||
extern colour option_sys_colour_Background;
|
||||
extern colour option_sys_colour_ButtonFace;
|
||||
extern colour option_sys_colour_ButtonHighlight;
|
||||
extern colour option_sys_colour_ButtonShadow;
|
||||
extern colour option_sys_colour_ButtonText;
|
||||
extern colour option_sys_colour_CaptionText;
|
||||
extern colour option_sys_colour_GrayText;
|
||||
extern colour option_sys_colour_Highlight;
|
||||
extern colour option_sys_colour_HighlightText;
|
||||
extern colour option_sys_colour_InactiveBorder;
|
||||
extern colour option_sys_colour_InactiveCaption;
|
||||
extern colour option_sys_colour_InactiveCaptionText;
|
||||
extern colour option_sys_colour_InfoBackground;
|
||||
extern colour option_sys_colour_InfoText;
|
||||
extern colour option_sys_colour_Menu;
|
||||
extern colour option_sys_colour_MenuText;
|
||||
extern colour option_sys_colour_Scrollbar;
|
||||
extern colour option_sys_colour_ThreeDDarkShadow;
|
||||
extern colour option_sys_colour_ThreeDFace;
|
||||
extern colour option_sys_colour_ThreeDHighlight;
|
||||
extern colour option_sys_colour_ThreeDLightShadow;
|
||||
extern colour option_sys_colour_ThreeDShadow;
|
||||
extern colour option_sys_colour_Window;
|
||||
extern colour option_sys_colour_WindowFrame;
|
||||
extern colour option_sys_colour_WindowText;
|
||||
|
||||
|
||||
void options_read(const char *path);
|
||||
void options_write(const char *path);
|
||||
|
@ -134,7 +134,7 @@ $(eval $(foreach V,$(filter FB_IMAGE_%,$(.VARIABLES)),$(call convert_image,$($(V
|
||||
# S_FRAMEBUFFER are sources purely for the framebuffer build
|
||||
S_FRAMEBUFFER := gui.c framebuffer.c tree.c save.c schedule.c \
|
||||
thumbnail.c misc.c bitmap.c filetype.c login.c findfile.c \
|
||||
localhistory.c
|
||||
localhistory.c system_colour.c
|
||||
|
||||
S_FRAMEBUFFER_FBTK := fbtk.c event.c fill.c bitmap.c user.c window.c \
|
||||
text.c scroll.c osk.c
|
||||
|
284
framebuffer/system_colour.c
Normal file
284
framebuffer/system_colour.c
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ActiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ActiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&option_sys_colour_AppWorkspace,
|
||||
NULL
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&option_sys_colour_Background,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ButtonFace,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ButtonHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&option_sys_colour_ButtonShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ButtonText,
|
||||
NULL
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_CaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_GrayText,
|
||||
NULL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&option_sys_colour_Highlight,
|
||||
NULL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_HighlightText,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_InactiveCaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_InfoBackground,
|
||||
NULL
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_InfoText,
|
||||
NULL
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Menu,
|
||||
NULL
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_MenuText,
|
||||
NULL
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Scrollbar,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&option_sys_colour_ThreeDDarkShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ThreeDFace,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ThreeDHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&option_sys_colour_ThreeDLightShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&option_sys_colour_ThreeDShadow,
|
||||
NULL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Window,
|
||||
NULL
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowFrame,
|
||||
NULL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowText,
|
||||
NULL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#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].colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
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(char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strncasecmp(name,
|
||||
colour_list[ccount].name,
|
||||
colour_list[ccount].length) == 0) {
|
||||
ret = colour_list[ccount].colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *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) {
|
||||
*colour = colour_list[ccount].colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
@ -61,7 +61,7 @@ S_GTK := font_pango.c bitmap.c gui.c schedule.c thumbnail.c plotters.c \
|
||||
treeview.c scaffolding.c completion.c login.c throbber.c \
|
||||
selection.c history.c window.c filetype.c download.c menu.c \
|
||||
print.c save.c search.c tabs.c theme.c toolbar.c \
|
||||
sexy_icon_entry.c compat.c cookies.c hotlist.c \
|
||||
sexy_icon_entry.c compat.c cookies.c hotlist.c system_colour.c \
|
||||
$(addprefix dialogs/,options.c about.c source.c)
|
||||
S_GTK := $(addprefix gtk/,$(S_GTK)) $(addprefix utils/,container.c)
|
||||
# code in utils/container.ch is non-universal it seems
|
||||
|
@ -598,7 +598,6 @@ int main(int argc, char** argv)
|
||||
|
||||
netsurf_exit();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
284
gtk/system_colour.c
Normal file
284
gtk/system_colour.c
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ActiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ActiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&option_sys_colour_AppWorkspace,
|
||||
NULL
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&option_sys_colour_Background,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ButtonFace,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ButtonHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&option_sys_colour_ButtonShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ButtonText,
|
||||
NULL
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_CaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_GrayText,
|
||||
NULL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&option_sys_colour_Highlight,
|
||||
NULL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_HighlightText,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_InactiveCaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_InfoBackground,
|
||||
NULL
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_InfoText,
|
||||
NULL
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Menu,
|
||||
NULL
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_MenuText,
|
||||
NULL
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Scrollbar,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&option_sys_colour_ThreeDDarkShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ThreeDFace,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ThreeDHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&option_sys_colour_ThreeDLightShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&option_sys_colour_ThreeDShadow,
|
||||
NULL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Window,
|
||||
NULL
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowFrame,
|
||||
NULL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowText,
|
||||
NULL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#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].colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
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(char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strncasecmp(name,
|
||||
colour_list[ccount].name,
|
||||
colour_list[ccount].length) == 0) {
|
||||
ret = colour_list[ccount].colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *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) {
|
||||
*colour = colour_list[ccount].colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
@ -73,8 +73,8 @@ S_RISCOS := 401login.c artworks.c assert.c awrender.s bitmap.c buffer.c \
|
||||
schedule.c search.c searchweb.c sprite.c sslcert.c \
|
||||
textarea.c textselection.c theme.c theme_install.c thumbnail.c \
|
||||
treeview.c ucstables.c uri.c url_complete.c url_protocol.c \
|
||||
url_suggest.c wimp.c wimp_event.c window.c gui/progress_bar.c \
|
||||
gui/status_bar.c \
|
||||
url_suggest.c wimp.c wimp_event.c window.c system_colour.c \
|
||||
gui/progress_bar.c gui/status_bar.c \
|
||||
$(addprefix configure/,con_cache.c con_connect.c con_content.c \
|
||||
con_fonts.c con_home.c con_image.c con_inter.c con_language.c \
|
||||
con_memory.c con_secure.c con_theme.c)
|
||||
|
284
riscos/system_colour.c
Normal file
284
riscos/system_colour.c
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ActiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ActiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&option_sys_colour_AppWorkspace,
|
||||
NULL
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&option_sys_colour_Background,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ButtonFace,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ButtonHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&option_sys_colour_ButtonShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ButtonText,
|
||||
NULL
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_CaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_GrayText,
|
||||
NULL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&option_sys_colour_Highlight,
|
||||
NULL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_HighlightText,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_InactiveCaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_InfoBackground,
|
||||
NULL
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_InfoText,
|
||||
NULL
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Menu,
|
||||
NULL
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_MenuText,
|
||||
NULL
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Scrollbar,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&option_sys_colour_ThreeDDarkShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ThreeDFace,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ThreeDHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&option_sys_colour_ThreeDLightShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&option_sys_colour_ThreeDShadow,
|
||||
NULL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Window,
|
||||
NULL
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowFrame,
|
||||
NULL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowText,
|
||||
NULL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#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].colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
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(char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strncasecmp(name,
|
||||
colour_list[ccount].name,
|
||||
colour_list[ccount].length) == 0) {
|
||||
ret = colour_list[ccount].colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *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) {
|
||||
*colour = colour_list[ccount].colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
@ -48,7 +48,7 @@ S_RESOURCES := windows_resource.o
|
||||
# S_WINDOWS are sources purely for the windows build
|
||||
S_WINDOWS := about.c bitmap.c download.c filetype.c findfile.c font.c \
|
||||
gui.c localhistory.c login.c misc.c plot.c prefs.c schedule.c \
|
||||
thumbnail.c tree.c windbg.c
|
||||
thumbnail.c tree.c windbg.c system_colour.c
|
||||
S_WINDOWS := $(addprefix windows/,$(S_WINDOWS))
|
||||
|
||||
SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_WINDOWS) $(S_RESOURCES)
|
||||
|
284
windows/system_colour.c
Normal file
284
windows/system_colour.c
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "utils/log.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/options.h"
|
||||
|
||||
struct gui_system_colour_ctx {
|
||||
const char *name;
|
||||
int length;
|
||||
css_color colour;
|
||||
colour *option_colour;
|
||||
lwc_string *lwcstr;
|
||||
};
|
||||
|
||||
static struct gui_system_colour_ctx colour_list[] = {
|
||||
{
|
||||
"ActiveBorder",
|
||||
SLEN("ActiveBorder"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ActiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"ActiveCaption",
|
||||
SLEN("ActiveCaption"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ActiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"AppWorkspace",
|
||||
SLEN("AppWorkspace"),
|
||||
0xffeeeeee,
|
||||
&option_sys_colour_AppWorkspace,
|
||||
NULL
|
||||
}, {
|
||||
"Background",
|
||||
SLEN("Background"),
|
||||
0xff0000aa,
|
||||
&option_sys_colour_Background,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonFace",
|
||||
SLEN("ButtonFace"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ButtonFace,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonHighlight",
|
||||
SLEN("ButtonHighlight"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ButtonHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonShadow",
|
||||
SLEN("ButtonShadow"),
|
||||
0xffbbbbbb,
|
||||
&option_sys_colour_ButtonShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ButtonText",
|
||||
SLEN("ButtonText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_ButtonText,
|
||||
NULL
|
||||
}, {
|
||||
"CaptionText",
|
||||
SLEN("CaptionText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_CaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"GrayText",
|
||||
SLEN("GrayText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_GrayText,
|
||||
NULL
|
||||
}, {
|
||||
"Highlight",
|
||||
SLEN("Highlight"),
|
||||
0xff0000ee,
|
||||
&option_sys_colour_Highlight,
|
||||
NULL
|
||||
}, {
|
||||
"HighlightText",
|
||||
SLEN("HighlightText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_HighlightText,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveBorder",
|
||||
SLEN("InactiveBorder"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveBorder,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaption",
|
||||
SLEN("InactiveCaption"),
|
||||
0xffffffff,
|
||||
&option_sys_colour_InactiveCaption,
|
||||
NULL
|
||||
}, {
|
||||
"InactiveCaptionText",
|
||||
SLEN("InactiveCaptionText"),
|
||||
0xffcccccc,
|
||||
&option_sys_colour_InactiveCaptionText,
|
||||
NULL
|
||||
}, {
|
||||
"InfoBackground",
|
||||
SLEN("InfoBackground"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_InfoBackground,
|
||||
NULL
|
||||
}, {
|
||||
"InfoText",
|
||||
SLEN("InfoText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_InfoText,
|
||||
NULL
|
||||
}, {
|
||||
"Menu",
|
||||
SLEN("Menu"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Menu,
|
||||
NULL
|
||||
}, {
|
||||
"MenuText",
|
||||
SLEN("MenuText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_MenuText,
|
||||
NULL
|
||||
}, {
|
||||
"Scrollbar",
|
||||
SLEN("Scrollbar"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Scrollbar,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDDarkShadow",
|
||||
SLEN("ThreeDDarkShadow"),
|
||||
0xff555555,
|
||||
&option_sys_colour_ThreeDDarkShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDFace",
|
||||
SLEN("ThreeDFace"),
|
||||
0xffdddddd,
|
||||
&option_sys_colour_ThreeDFace,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDHighlight",
|
||||
SLEN("ThreeDHighlight"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_ThreeDHighlight,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDLightShadow",
|
||||
SLEN("ThreeDLightShadow"),
|
||||
0xff999999,
|
||||
&option_sys_colour_ThreeDLightShadow,
|
||||
NULL
|
||||
}, {
|
||||
"ThreeDShadow",
|
||||
SLEN("ThreeDShadow"),
|
||||
0xff777777,
|
||||
&option_sys_colour_ThreeDShadow,
|
||||
NULL
|
||||
}, {
|
||||
"Window",
|
||||
SLEN("Window"),
|
||||
0xffaaaaaa,
|
||||
&option_sys_colour_Window,
|
||||
NULL
|
||||
}, {
|
||||
"WindowFrame",
|
||||
SLEN("WindowFrame"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowFrame,
|
||||
NULL
|
||||
}, {
|
||||
|
||||
"WindowText",
|
||||
SLEN("WindowText"),
|
||||
0xff000000,
|
||||
&option_sys_colour_WindowText,
|
||||
NULL
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#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].colour = *(colour_list[ccount].option_colour);
|
||||
}
|
||||
}
|
||||
|
||||
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(char *name)
|
||||
{
|
||||
colour ret = 0xff00000;
|
||||
unsigned int ccount;
|
||||
|
||||
for (ccount = 0; ccount < colour_list_len; ccount++) {
|
||||
if (strncasecmp(name,
|
||||
colour_list[ccount].name,
|
||||
colour_list[ccount].length) == 0) {
|
||||
ret = colour_list[ccount].colour;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
css_error gui_system_colour(void *pw, lwc_string *name, css_color *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) {
|
||||
*colour = colour_list[ccount].colour;
|
||||
return CSS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CSS_INVALID;
|
||||
}
|
Loading…
Reference in New Issue
Block a user