Changeset 1378 for trunk/src


Ignore:
Timestamp:
Oct 20, 1999, 6:27:01 PM (26 years ago)
Author:
cbratschi
Message:

Odin.ini color management support

Location:
trunk/src/user32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/initterm.cpp

    r1376 r1378  
    1 /* $Id: initterm.cpp,v 1.11 1999-10-20 13:46:25 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.12 1999-10-20 16:27:00 cbratschi Exp $ */
    22
    33/*
     
    4040#include "heapshared.h"
    4141#include "win32wdesktop.h"
     42#include "syscolor.h"
    4243
    4344/*-------------------------------------------------------------------*/
     
    8283         CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    8384
    84          if(RegisterLxDll(hModule, 0, 0) == FALSE)
    85                 return 0UL;
     85         if(RegisterLxDll(hModule, 0, 0) == FALSE)
     86                return 0UL;
    8687
    8788         /*******************************************************************/
     
    101102         InitSpyQueue();
    102103
    103          if(InitializeSharedHeap() == FALSE)
    104                 return 0UL;
     104         if(InitializeSharedHeap() == FALSE)
     105                return 0UL;
    105106
    106107         //SvL: Init win32 PM classes
     
    113114         RegisterSystemClasses(hModule);
    114115
    115         //SvL: Create Desktop Window
    116         if(CreateWin32Desktop() == FALSE) {
     116        //SvL: Create Desktop Window
     117        if(CreateWin32Desktop() == FALSE) {
    117118                return 0UL;
    118         }
     119        }
    119120
    120121         break;
    121122      case 1 :
    122         UnregisterLxDll(hModule);
     123        UnregisterLxDll(hModule);
    123124         break;
    124125      default  :
     
    141142{
    142143   dprintf(("user32 exit\n"));
     144   SYSCOLOR_Save();
    143145   DestroyDesktopWindow();
    144146   UnregisterSystemClasses();
  • trunk/src/user32/scroll.cpp

    r1348 r1378  
    1 /* $Id: scroll.cpp,v 1.11 1999-10-18 10:54:03 sandervl Exp $ */
     1/* $Id: scroll.cpp,v 1.12 1999-10-20 16:27:00 cbratschi Exp $ */
    22/*
    33 * Scrollbar control
     
    703703        return;
    704704    }
    705     if(nBar == SB_VERT) 
    706     {
    707         hwndScroll = Win32BaseWindow::OS2ToWin32Handle(window->getVertScrollHandle());
    708     }
    709     else 
     705    if(nBar == SB_VERT)
     706    {
     707        hwndScroll = Win32BaseWindow::OS2ToWin32Handle(window->getVertScrollHandle());
     708    }
     709    else
    710710    if(nBar == SB_HORZ)
    711711    {
    712         hwndScroll = Win32BaseWindow::OS2ToWin32Handle(window->getHorzScrollHandle());
     712        hwndScroll = Win32BaseWindow::OS2ToWin32Handle(window->getHorzScrollHandle());
    713713    }
    714714    else hwndScroll = hwnd;
    715715
    716716    if(hwndScroll == 0)
    717         return;
     717        return;
    718718
    719719    hdc = GetDCEx( hwndScroll, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW));
     
    11511151            CONV_POINT16TO32( (POINT16 *)&lParam, &pt );
    11521152            SCROLL_HandleScrollEvent( hwnd, SB_HORZ, message, pt );
    1153             if(message == WM_MOUSEMOVE) {
    1154                 return 1; //SvL: Let PM change the mouse cursor to the default
    1155             }
     1153            if(message == WM_MOUSEMOVE) {
     1154                return 1; //SvL: Let PM change the mouse cursor to the default
     1155            }
    11561156        }
    11571157        break;
     
    12291229            CONV_POINT16TO32( (POINT16 *)&lParam, &pt );
    12301230            SCROLL_HandleScrollEvent( hwnd, SB_VERT, message, pt );
    1231             if(message == WM_MOUSEMOVE) {
    1232                 return 1; //SvL: Let PM change the mouse cursor to the default
    1233             }
     1231            if(message == WM_MOUSEMOVE) {
     1232                return 1; //SvL: Let PM change the mouse cursor to the default
     1233            }
    12341234        }
    12351235        break;
  • trunk/src/user32/syscolor.cpp

    r1210 r1378  
    1 /* $Id: syscolor.cpp,v 1.9 1999-10-09 11:03:23 sandervl Exp $ */
     1/* $Id: syscolor.cpp,v 1.10 1999-10-20 16:27:01 cbratschi Exp $ */
    22
    33/*
     
    2121#include "user32.h"
    2222#include "syscolor.h"
     23#include "options.h"
    2324
    2425//SvL: Open32 colors are much better than those in the table below
     
    2627
    2728#define NUM_SYS_COLORS     (COLOR_GRADIENTINACTIVECAPTION+1)
     29
     30BOOL USEWINCOLORS = PROFILE_GetOdinIniBool(ODINCOLORS,"UseWinColors",FALSE);
    2831
    2932/* Win98 colors */
     
    5962  RGB(0,0,255),     //COLOR_HOTLIGHT
    6063  RGB(16,136,208),  //COLOR_GRADIENTACTIVECAPTION
    61   RGB(16,136,208)        //COLOR_GRADIENTINACTIVECAPTION
     64  RGB(16,136,208)   //COLOR_GRADIENTINACTIVECAPTION
     65};
     66
     67static char* ColorNames[NUM_SYS_COLORS] =
     68{
     69  "SCROLLBAR",
     70  "COLOR_BACKGROUND",
     71  "ACTIVECAPTION",
     72  "INACTIVECAPTION",
     73  "MENU",
     74  "WINDOW",
     75  "WINDOWFRAME",
     76  "MENUTEXT",
     77  "WINDOWTEXT",
     78  "CAPTIONTEXT",
     79  "ACTIVEBORDER",
     80  "INACTIVEBORDER",
     81  "APPWORKSPACE",
     82  "HIGHLIGHT",
     83  "HIGHLIGHTTEXT",
     84  "BTNFACE",
     85  "BTNSHADOW",
     86  "GRAYTEXT",
     87  "BTNTEXT",
     88  "INACTIVECAPTIONTEXT",
     89  "BTNHIGHLIGHT",
     90  "3DDKSHADOW",
     91  "3DLIGHT",
     92  "INFOTEXT",
     93  "INFOBK",
     94  "ALTERNATEBTNFACE",
     95  "COLOR_HOTLIGHT",
     96  "GRADIENTACTIVECAPTION",
     97  "GRADIENTINACTIVECAPTION"
    6298};
    6399
     
    84120void SYSCOLOR_Load(void)
    85121{
    86 /* CB: load colors from Odin ini file
    87     int i, r, g, b;
    88     const char * const *p;
    89     char buffer[100];
    90 
    91     for (i = 0, p = DefSysColors; i < NUM_SYS_COLORS; i++, p += 2)
    92     {
    93         if (sscanf(p[1], " %d %d %d", &r, &g, &b ) != 3) r = g = b = 0;
    94         SYSCOLOR_SetColor( i, RGB(r,g,b) );
    95     }
    96 */
    97 
     122  int i, r, g, b;
     123  const char * const *p;
     124  char buffer[100];
     125
     126  if (PROFILE_GetOdinIniBool(ODINCOLORS,"SaveColors",FALSE))
     127  {
     128    for (i = 0,p = ColorNames; i < NUM_SYS_COLORS; i++, p++)
     129    {
     130      if (PROFILE_GetOdinIniString(ODINCOLORS,(LPCSTR)*p,"",buffer,sizeof(buffer)))
     131      {
     132        if (sscanf(buffer,"%d %d %d",&r,&g,&b) == 3) SysColors[i] = RGB(r,g,b);
     133      }
     134    }
     135  }
    98136}
    99137//******************************************************************************
     
    101139void SYSCOLOR_Save(void)
    102140{
    103   //CB: todo
     141  INT x;
     142  const char * const *p;
     143  char buffer[100];
     144
     145  if (!fColorInit) return;
     146
     147  if (PROFILE_GetOdinIniBool(ODINCOLORS,"SaveColors",FALSE))
     148  {
     149    for (x = 0,p = ColorNames;x < NUM_SYS_COLORS;x++,p++)
     150    {
     151      INT color = SysColors[x];
     152
     153      sprintf(buffer,"%d %d %d",color & 0xFF,(color & 0xFF00) >> 8,(color & 0xFF0000) >> 16);
     154      PROFILE_SetOdinIniString(ODINCOLORS,(LPCSTR)*p,(LPCSTR)buffer);
     155    }
     156  }
    104157}
    105158//******************************************************************************
     
    110163
    111164  SYSCOLOR_Load();
    112   for (x = 0;x < NUM_SYS_COLORS;x++) {
    113         if(x < NUM_OPEN32_SYSCOLORS)
    114                 SYSCOLOR_SetColor(x,O32_GetSysColor(x));
    115         else    SYSCOLOR_SetColor(x,SysColors[x]);
     165  if (USEWINCOLORS)
     166    for (x = 0;x < NUM_SYS_COLORS;x++) SYSCOLOR_SetColor(x,SysColors[x]);
     167  else
     168    for (x = 0;x < NUM_SYS_COLORS;x++) {
     169        if(x < NUM_OPEN32_SYSCOLORS)
     170                SYSCOLOR_SetColor(x,O32_GetSysColor(x));
     171        else    SYSCOLOR_SetColor(x,SysColors[x]);
    116172  }
    117173}
     
    126182  }
    127183
    128   if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
    129   {
    130         if(nIndex < NUM_OPEN32_SYSCOLORS)
    131                 return O32_GetSysColor(nIndex);
    132         else    return SysColors[nIndex];
     184  if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
     185  {
     186    if (USEWINCOLORS) return SysColors[nIndex];
     187    else
     188        if(nIndex < NUM_OPEN32_SYSCOLORS)
     189                return O32_GetSysColor(nIndex);
     190        else    return SysColors[nIndex];
    133191  }
    134192  else return 0;
     
    150208    WriteLog("OS2SetSysColors\n");
    151209#endif
    152    
     210
    153211    O32_SetSysColors(nChanges, lpSysColor, lpColorValues);
    154212
  • trunk/src/user32/syscolor.h

    r1138 r1378  
    1 /* $Id: syscolor.h,v 1.5 1999-10-05 16:02:53 cbratschi Exp $ */
     1/* $Id: syscolor.h,v 1.6 1999-10-20 16:27:01 cbratschi Exp $ */
    22
    33/*
     
    3535
    3636extern void SYSCOLOR_Init(void);
     37extern void SYSCOLOR_Save(void);
    3738
    3839#endif  /* __WINE_SYSCOLOR_H */
Note: See TracChangeset for help on using the changeset viewer.