Mon Nov 22 13:58:56 1993 David Metcalfe <david@prism.demon.co.uk> * [windows/scroll.c] Preliminary implementations of ScrollWindow, ScrollDC and ScrollWindowEx. Nov 21, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] Optimization of redraw during 'Add' or 'Insert'. * [controls/scroll.c] Optimization of WM_PAINT during 'thumbtracking'. * [controls/button.c] Add of beta implement of 'BS_OWNERDRAW' * [controls/static.c] Style 'SS_ICON' new supported. * [misc/message.c] Begin of implemantation of MB_XXX styles. * [loader/resource.c] Function LoadIcon() : now prepare transparency Bitmap mask. Function LoadCursor() : now prepare a 'X pixmapcursor'. New function SetCursor() : not finished. New function ShowCursor() : not finished. New function AccessResource() : stub. * [obj/dib.c] Function DrawIcon(): deugging phase of icon transparency mask. * [loader/library.c] new file for news functions LoadLibrary() & FreeLibrary(). * [sysres.dll] Resources only 16bits DLL for System Resources, icons, etc... Sun Nov 14 14:39:06 1993 julliard@di.epfl.ch (Alexandre Julliard) * [include/dialog.h] [windows/dialog.c] Simplified dialog template parsing. Implemented DialogBoxIndirect(). * [windows/win.c] Fixed bug in CreateWindow() when aborting window creation. Modified UpdateWindow() to only update visible windows. Implemented IsWindow(). Nov 14, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] Listbox control window : new messages. * [controls/combo.c] Combo box control window : new messages. * [misc/message.c] Moved stub MessageBox() to this new file. Implemented of a callback, now MessageBox show a window. * [loader/resource.c] New function DestroyIcon() New function DestroyCursor() Filled stub LoadIcon() Filled stub LoadCursor() Bug fixed in FindResourceByName() : missing lseek(). * [obj/dib.c] New function DrawIcon() * [windows/win.c] New function CloseWindow() New function OpenIcon() New function IsIconic() New Function FindWindow() Sun Nov 14 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de) * [loader/selector.c] Wrote AllocCStoDSAlias() and AllocDStoCSAlias() Sun Nov 14 08:27:19 1993 Bob Amstadt (bob at amscons) * [loader/selector.c] Wrote AllocSelector() and PrestoChangoSelector(). YUK! Sat Nov 13 13:56:42 1993 Bob Amstadt (bob at amscons) * [loader/resource.c] Wrote FindResource(), LoadResource(), LockResource(), and FreeResource() * [include/segmem.h] [loader/selector.c] [loader/signal.h] Changed selector allocation method. Sun Nov 10 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de) * [if1632/callback.c if1632/call.S if1632/user.spec] added Catch (KERNEL.55) and Throw (KERNEL.56) Nov 7, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/scroll.c] Scroll bar control window Bug resolved : Painting message before scroll visible. * [controls/listbox.c] Listbox control window Destroy cleanup. * [controls/combo.c] Combo box control window Destroy cleanup. * [controls/button.c] GetCheck Message now return is state. * [windows/win.c] New function IsWindowVisible()
153 lines
3.5 KiB
C
153 lines
3.5 KiB
C
/*
|
|
* Color functions
|
|
*
|
|
* Copyright 1993 Alexandre Julliard
|
|
*/
|
|
|
|
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|
|
|
#include <stdlib.h>
|
|
#include <X11/Xlib.h>
|
|
|
|
#include "windows.h"
|
|
|
|
extern Display * XT_display;
|
|
extern Screen * XT_screen;
|
|
|
|
|
|
/*
|
|
* We try to use a private color map if possible, because Windows programs
|
|
* assume that palette(0) == Black and palette(max-1) == White.
|
|
*/
|
|
#undef USE_PRIVATE_MAP
|
|
|
|
Colormap COLOR_WinColormap = 0;
|
|
|
|
|
|
/* System colors */
|
|
|
|
static const char * SysColors[] =
|
|
{
|
|
/* Low pixel values (0..7) */
|
|
|
|
"black", "red4", "green4", "yellow4",
|
|
"blue4", "magenta4", "cyan4", "gray50",
|
|
|
|
/* High pixel values (max-7..max) */
|
|
|
|
"gray75", "red", "green", "yellow",
|
|
"blue", "magenta", "cyan", "white"
|
|
};
|
|
|
|
#define NB_SYS_COLORS (sizeof(SysColors) / sizeof(SysColors[0]))
|
|
|
|
|
|
/***********************************************************************
|
|
* COLOR_FillDefaultMap
|
|
*
|
|
* Try to allocate colors from default screen map (used when we
|
|
* don't want to or can't use a private map).
|
|
*/
|
|
static int COLOR_FillDefaultMap()
|
|
{
|
|
XColor color;
|
|
int i, total = 0;
|
|
|
|
for (i = 0; i < NB_SYS_COLORS; i++)
|
|
{
|
|
if (XParseColor( XT_display, DefaultColormapOfScreen( XT_screen ),
|
|
SysColors[i], &color ))
|
|
{
|
|
if (XAllocColor( XT_display, DefaultColormapOfScreen( XT_screen ),
|
|
&color ))
|
|
total++;
|
|
}
|
|
}
|
|
return total;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* COLOR_BuildMap
|
|
*
|
|
* Fill the private colormap.
|
|
*/
|
|
#ifdef USE_PRIVATE_MAP
|
|
|
|
static BOOL COLOR_BuildMap( Colormap map, int depth, int size )
|
|
{
|
|
XColor color;
|
|
int i;
|
|
|
|
/* Fill the whole map with a range of colors */
|
|
|
|
if ((1 << depth) > NB_SYS_COLORS)
|
|
{
|
|
int red_incr, green_incr, blue_incr;
|
|
int r, g, b;
|
|
|
|
blue_incr = 0x10000 >> (depth / 3);
|
|
red_incr = 0x10000 >> ((depth + 1) / 3);
|
|
green_incr = 0x10000 >> ((depth + 2) / 3);
|
|
|
|
for (i = 0, r = red_incr - 1; r < 0x10000; r += red_incr)
|
|
for (g = green_incr - 1; g < 0x10000; g += green_incr)
|
|
for (b = blue_incr - 1; b < 0x10000; b += blue_incr)
|
|
{
|
|
if (i >= size) break;
|
|
color.pixel = i++;
|
|
color.red = r;
|
|
color.green = g;
|
|
color.blue = b;
|
|
XStoreColor( XT_display, map, &color );
|
|
}
|
|
}
|
|
|
|
/* Store the system palette colors */
|
|
|
|
for (i = 0; i < NB_SYS_COLORS; i++)
|
|
{
|
|
if (!XParseColor( XT_display, map, SysColors[i], &color ))
|
|
color.red = color.green = color.blue = color.flags = 0;
|
|
if (i < NB_SYS_COLORS/2) color.pixel = i;
|
|
else color.pixel = (1 << depth) - NB_SYS_COLORS + i;
|
|
if (color.pixel < size) XStoreColor( XT_display, map, &color );
|
|
}
|
|
return TRUE;
|
|
}
|
|
#endif /* USE_PRIVATE_MAP */
|
|
|
|
/***********************************************************************
|
|
* COLOR_Init
|
|
*/
|
|
BOOL COLOR_Init()
|
|
{
|
|
Visual * visual = DefaultVisual( XT_display, DefaultScreen(XT_display) );
|
|
|
|
switch(visual->class)
|
|
{
|
|
case GrayScale:
|
|
case PseudoColor:
|
|
case DirectColor:
|
|
|
|
#ifdef USE_PRIVATE_MAP
|
|
COLOR_WinColormap = XCreateColormap( XT_display,
|
|
DefaultRootWindow(XT_display),
|
|
visual, AllocAll );
|
|
if (COLOR_WinColormap)
|
|
COLOR_BuildMap(COLOR_WinColormap,
|
|
DefaultDepth(XT_display, DefaultScreen(XT_display)),
|
|
visual->map_entries );
|
|
else COLOR_FillDefaultMap();
|
|
break;
|
|
#endif /* USE_PRIVATE_MAP */
|
|
|
|
case StaticGray:
|
|
case StaticColor:
|
|
case TrueColor:
|
|
COLOR_FillDefaultMap();
|
|
COLOR_WinColormap = DefaultColormapOfScreen( XT_screen );
|
|
break;
|
|
}
|
|
return TRUE;
|
|
}
|