Cleanup fe_getPixelFromRGB(). Move it to xfe/colors.c and rename it to

fe_GetPixelFromRGBString().
This commit is contained in:
ramiro%netscape.com 1998-09-08 14:01:20 +00:00
parent 5f90408924
commit 51fe1f7a8f
4 changed files with 30 additions and 28 deletions

View File

@ -1085,6 +1085,26 @@ fe_GetPixel (MWContext *context, int r, int g, int b)
return fe_get_shared_pixel (context, r, g, b, CELL_TRANSIENT);
}
PRBool
fe_GetPixelFromRGBString(MWContext * context,
const char * color_string,
Pixel * pixel_out)
{
uint8 red, green, blue;
PRBool bColorsFound = LO_ParseRGB((char *) color_string,
&red, &green, &blue);
PR_ASSERT( pixel_out != NULL );
if (bColorsFound)
{
*pixel_out = fe_GetPixel(context, red, green, blue);
}
return (bColorsFound);
}
/* Get a color that will be allocated for the life of the app */
Pixel
fe_GetPermanentPixel (MWContext *context, int r, int g, int b)

View File

@ -36,11 +36,6 @@
extern "C" RDF_NCVocab gNavCenter;
extern "C"
{
extern PRBool fe_getPixelFromRGB(MWContext *, char * rgbString, Pixel * pixel);
};
#ifdef DEBUG_slamm
#define D(x) x
#else
@ -249,7 +244,7 @@ XFE_RDFChromeTreeView::setHTTitlebarProperties(HT_View view, Widget titleBar)
HT_GetTemplateData(HT_TopNode(view), gNavCenter->titleBarFGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
gotit = fe_GetPixelFromRGBString(getContext(), (char *) data, &pixel);
if (gotit)
XtSetArg(av[ac], XmNforeground, pixel); ac++;
}
@ -260,7 +255,7 @@ XFE_RDFChromeTreeView::setHTTitlebarProperties(HT_View view, Widget titleBar)
HT_GetTemplateData(HT_TopNode(view), gNavCenter->titleBarBGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
gotit = fe_GetPixelFromRGBString(getContext(), (char *) data, &pixel);
if (gotit)
XtSetArg(av[ac], XmNbackground, pixel); ac++;
}

View File

@ -57,7 +57,6 @@ extern int XP_BKMKS_LESS_THAN_ONE_HOUR_AGO;
extern "C"
{
extern PRBool fe_getPixelFromRGB(MWContext *, char * rgbString, Pixel * pixel);
extern void treeview_bg_image_cb(XtPointer clientData);
};
@ -980,7 +979,7 @@ XFE_RDFTreeView::setHTTreeViewProperties( HT_View view)
HT_GetTemplateData(HT_TopNode(view), gNavCenter->viewBGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
gotit = fe_GetPixelFromRGBString(getContext(), (char *) data, &pixel);
if (gotit) {
XtSetArg(av[ac], XmNbackground, pixel); ac++;
}
@ -991,7 +990,7 @@ XFE_RDFTreeView::setHTTreeViewProperties( HT_View view)
HT_GetTemplateData(HT_TopNode(view), gNavCenter->viewFGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
gotit = fe_GetPixelFromRGBString(getContext(), (char *) data, &pixel);
if (gotit) {
XtSetArg(av[ac], XmNforeground, pixel); ac++;
}
@ -1033,7 +1032,7 @@ XFE_RDFTreeView::setHTTreeViewProperties( HT_View view)
HT_GetTemplateData(HT_TopNode(view), gNavCenter->selectionFGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
gotit = fe_GetPixelFromRGBString(getContext(), (char *) data, &pixel);
if (gotit) {
XtSetArg(av[ac], XmNselectForeground, pixel); ac++;
}
@ -1043,7 +1042,7 @@ XFE_RDFTreeView::setHTTreeViewProperties( HT_View view)
HT_GetTemplateData(HT_TopNode(view), gNavCenter->selectionBGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
gotit = fe_GetPixelFromRGBString(getContext(), (char *) data, &pixel);
if (gotit) {
XtSetArg(av[ac], XmNselectBackground, pixel); ac++;
}
@ -1055,7 +1054,7 @@ XFE_RDFTreeView::setHTTreeViewProperties( HT_View view)
HT_GetTemplateData(HT_TopNode(view), gNavCenter->treeConnectionFGColor, HT_COLUMN_STRING, &data);
if (data)
{
gotit = fe_getPixelFromRGB(getContext(), (char *) data, &pixel);
gotit = fe_GetPixelFromRGBString(getContext(), (char *) data, &pixel);
if (gotit) {
XtSetArg(av[ac], XmNconnectingLineColor, pixel); ac++;
}
@ -1160,21 +1159,6 @@ HT_GetTemplateData(HT_TopNode(view), gNavCenter->sortColumnBGColor, HT_COLUMN_S
}
extern "C"
{
/* This s'd go to a utility file */
PRBool
fe_getPixelFromRGB(MWContext * context, char * color, Pixel *pixel)
{
uint8 red, green, blue;
PRBool bColorsFound = LO_ParseRGB(color, &red, &green, &blue);
if (bColorsFound)
*pixel = fe_GetPixel(context, red, green, blue);
return (bColorsFound);
}
};
extern "C" {
void

View File

@ -325,6 +325,9 @@ extern void fe_GetMargin(MWContext*, int32 *marginw_ptr, int32 *marginh_ptr);
extern Pixel fe_GetPermanentPixel (MWContext *context, int r, int g, int b);
extern Pixel fe_GetPixel (MWContext *context, int r, int g, int b);
extern PRBool fe_GetPixelFromRGBString(MWContext * context,
const char * color_string,
Pixel * pixel_out);
extern Pixel fe_GetImagePixel (MWContext *context, int r, int g, int b);
extern void fe_QueryColor (MWContext *context, XColor *color);
extern Colormap fe_MakeNewColormap (MWContext *new_context,