Initial commit of Command & Conquer Renegade source code.

This commit is contained in:
LFeenanEA
2025-02-27 16:39:46 +00:00
parent 74ab8fa5e0
commit 58ed459113
4918 changed files with 1366710 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,257 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
#if !defined(AFX_COLORBAR_H__D1243F40_D4D2_11D2_8DDF_00104B6FD9E3__INCLUDED_)
#define AFX_COLORBAR_H__D1243F40_D4D2_11D2_8DDF_00104B6FD9E3__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ColorBar.h : header file
//
#ifdef WWCTRL_LIB
#define LINKAGE_SPEC __declspec (dllexport)
#else
#define LINKAGE_SPEC
#endif
/////////////////////////////////////////////////////////////////////////////
//
// Constants
//
const int MAX_COLOR_POINTS = 15;
//
// Window styles
//
#define CBRS_SUNKEN 0x00000001
#define CBRS_RAISED 0x00000002
#define CBRS_FRAME 0x00000004
#define CBRS_FRAME_MASK CBRS_FRAME | CBRS_RAISED | CBRS_SUNKEN
#define CBRS_HORZ 0x00000008
#define CBRS_VERT 0x00000010
#define CBRS_HAS_SEL 0x00000020
#define CBRS_SHOW_FRAMES 0x00000040
#define CBRS_PAINT_GRAPH 0x00000080
//
// Window messages and notifications
//
#define CBRN_MOVED_POINT 0x0001
#define CBRN_MOVING_POINT 0x0002
#define CBRN_DBLCLK_POINT 0x0003
#define CBRN_SEL_CHANGED 0x0004
#define CBRN_DEL_POINT 0x0005
#define CBRN_DELETED_POINT 0x0006
#define CBRN_INSERTED_POINT 0x0007
#define CBRM_GETCOLOR (WM_USER+101)
#define CBRM_SETCOLOR ( WM_USER+102)
//
// Point styles
//
#define POINT_VISIBLE 0x00000001
#define POINT_CAN_MOVE 0x00000002
//
// Return values for WM_NOTIFY
//
#define STOP_EVENT 0x00000077
/////////////////////////////////////////////////////////////////////////////
//
// Structures
//
// Structure used to send notifications via WM_NOTIFY
typedef struct
{
NMHDR hdr;
int key_index;
float red;
float green;
float blue;
float position;
} CBR_NMHDR;
/////////////////////////////////////////////////////////////////////////////
//
// ColorBarClass
//
class LINKAGE_SPEC ColorBarClass : public CWnd
{
// Construction
public:
ColorBarClass();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ColorBarClass)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~ColorBarClass();
// Generated message map functions
protected:
//{{AFX_MSG(ColorBarClass)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
friend LRESULT WINAPI fnColorBarProc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
public:
/////////////////////////////////////////////////////////////////////////
//
// Public methods
//
bool Insert_Point (int index, float position, float red, float green, float blue, DWORD flags = POINT_VISIBLE | POINT_CAN_MOVE);
bool Insert_Point (CPoint point, DWORD flags = POINT_VISIBLE | POINT_CAN_MOVE);
bool Modify_Point (int index, float position, float red, float green, float blue, DWORD flags = POINT_VISIBLE | POINT_CAN_MOVE);
bool Set_User_Data (int index, DWORD data);
DWORD Get_User_Data (int index);
bool Set_Graph_Percent (int index, float percent);
float Get_Graph_Percent (int index);
bool Delete_Point (int index);
void Clear_Points (void);
int Get_Point_Count (void) const { return m_iColorPoints; }
bool Get_Point (int index, float *position, float *red, float *green, float *blue);
int Marker_From_Point (CPoint point);
void Set_Selection_Pos (float pos);
float Get_Selection_Pos (void) const { return m_SelectionPos; }
void Get_Color (float position, float *red, float *green, float *blue);
void Get_Range (float &min, float &max) const { min = m_MinPos; max = m_MaxPos; }
void Set_Range (float min, float max);
void Set_Redraw (bool redraw = true);
LRESULT Send_Notification (int code, int key);
//////////////////////////////////////////////////////////////////////////
// Static members
//////////////////////////////////////////////////////////////////////////
static ColorBarClass *Get_Color_Bar (HWND window_handle) { return (ColorBarClass *)::GetProp (window_handle, "CLASSPOINTER"); }
protected:
/////////////////////////////////////////////////////////////////////////
//
// Protected data types
//
typedef struct
{
float PosPercent;
int StartPos;
int EndPos;
float StartGraphPercent;
float GraphPercentInc;
float StartRed;
float StartGreen;
float StartBlue;
float RedInc;
float GreenInc;
float BlueInc;
DWORD user_data;
int flags;
} COLOR_POINT;
/////////////////////////////////////////////////////////////////////////
//
// Protected methods
//
void Paint_DIB (void);
void Create_Bitmap (void);
void Free_Bitmap (void);
void Free_Marker_Bitmap (void);
void Paint_Bar_Horz (int x_pos, int y_pos, int width, int height, UCHAR *pbits);
void Paint_Bar_Vert (int x_pos, int y_pos, int width, int height, UCHAR *pbits);
void Update_Point_Info (void);
void Load_Key_Frame_BMP (void);
void Paint_Key_Frame (int x_pos, int y_pos);
void Paint_Screen (HDC hwnd_dc);
void Get_Selection_Rectangle (CRect &rect);
void Move_Selection (CPoint point, bool send_notify = true);
void Move_Selection (float new_pos, bool send_notify = true);
void Repaint (void);
private:
/////////////////////////////////////////////////////////////////////////
//
// Private member data
//
HBITMAP m_hBitmap;
HBITMAP m_KeyFrameDIB;
HDC m_hMemDC;
UCHAR * m_pBits;
UCHAR * m_pKeyFrameBits;
int m_iColorWidth;
int m_iColorHeight;
int m_iBMPWidth;
int m_iBMPHeight;
int m_iMarkerWidth;
int m_iMarkerHeight;
int m_iScanlineSize;
int m_iColorPoints;
float m_MinPos;
float m_MaxPos;
COLOR_POINT m_ColorPoints[MAX_COLOR_POINTS];
CRect m_ColorArea;
int m_iCurrentKey;
bool m_bMoving;
bool m_bMoved;
bool m_bRedraw;
float m_SelectionPos;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COLORBAR_H__D1243F40_D4D2_11D2_8DDF_00104B6FD9E3__INCLUDED_)

View File

@@ -0,0 +1,985 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
/////////////////////////////////////////////////////////////////////////////////
//
// ColorPicker.cpp : implementation file
//
//
#include "StdAfx.H"
#include "ColorPicker.H"
#include "ColorPickerDialogClass.H"
#include <Math.H>
#include "Utils.H"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern HINSTANCE _hinstance;
/////////////////////////////////////////////////////////////////////////////
//
// ColorPickerClass
//
ColorPickerClass::ColorPickerClass (void)
: m_hBitmap (NULL),
m_iWidth (0),
m_iHeight (0),
m_CurrentPoint (0, 0),
m_CurrentColor (0),
m_bSelecting (false),
m_pBits (NULL),
m_hMemDC (NULL),
m_CurrentHue (0),
CWnd ()
{
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// ~ColorPickerClass
//
ColorPickerClass::~ColorPickerClass (void)
{
if (m_hMemDC != NULL) {
::DeleteObject (m_hMemDC);
m_hMemDC = NULL;
}
Free_Bitmap ();
return ;
}
BEGIN_MESSAGE_MAP(ColorPickerClass, CWnd)
//{{AFX_MSG_MAP(ColorPickerClass)
ON_WM_PAINT()
ON_WM_CREATE()
ON_WM_SIZE()
ON_WM_ERASEBKGND()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//
// OnPaint
//
void
ColorPickerClass::OnPaint (void)
{
CPaintDC dc (this);
if (m_hMemDC != NULL) {
HBITMAP hold_bmp = (HBITMAP)::SelectObject (m_hMemDC, m_hBitmap);
CRect rect;
GetClientRect (&rect);
::BitBlt (dc, 0, 0, rect.Width (), rect.Height (), m_hMemDC, 0, 0, SRCCOPY);
::SelectObject (m_hMemDC, hold_bmp);
Paint_Marker ();
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// RegisterColorPicker
//
void
RegisterColorPicker (HINSTANCE hinst)
{
// Has the class already been registered?
WNDCLASS wndclass = { 0 };
if (::GetClassInfo (hinst, "WWCOLORPICKER", &wndclass) == FALSE) {
wndclass.style = CS_GLOBALCLASS | CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
wndclass.lpfnWndProc = fnColorPickerProc;
wndclass.hInstance = hinst;
wndclass.hbrBackground = (HBRUSH)COLOR_3DFACE + 1;
wndclass.hCursor = ::LoadCursor (NULL, IDC_ARROW);
wndclass.lpszClassName = "WWCOLORPICKER";
// Let the windows manager know about this global class
::RegisterClass (&wndclass);
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// fnColorPickerProc
//
LRESULT WINAPI
fnColorPickerProc
(
HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam
)
{
//static ColorPickerClass *pwnd = NULL;
//static bool bcreated = false;
switch (message)
{
case WM_CREATE:
{
LPCREATESTRUCT pcreate_info = (LPCREATESTRUCT)lparam;
if (pcreate_info != NULL) {
// Should we create a new class manager for this window?
ColorPickerClass *pwnd = (ColorPickerClass *)pcreate_info->lpCreateParams;
BOOL created = FALSE;
if (pwnd == NULL) {
pwnd = new ColorPickerClass;
created = TRUE;
}
// Pull some hacks to get MFC to use the message map
pwnd->Attach (hwnd);
// Let the window know its being created
pwnd->OnCreate (pcreate_info);
WNDPROC *pOldWndProc = pwnd->GetSuperWndProcAddr ();
if (pOldWndProc) {
WNDPROC pold_proc = (WNDPROC)::SetWindowLong (hwnd, GWL_WNDPROC, (DWORD)::AfxGetAfxWndProc ());
ASSERT (pold_proc != NULL);
(*pOldWndProc) = pold_proc;
}
// Store some information in the window handle
::SetProp (hwnd, "CLASSPOINTER", (HANDLE)pwnd);
::SetProp (hwnd, "CREATED", (HANDLE)created);
}
}
break;
case WM_DESTROY:
{
/*pwnd->Detach ();
WNDPROC *pOldWndProc = pwnd->GetSuperWndProcAddr ();
if (pOldWndProc) {
::SetWindowLong (hwnd, GWL_WNDPROC, (DWORD)(*pOldWndProc));
(*pOldWndProc) = NULL;
}
if (bcreated) {
delete pwnd;
pwnd = NULL;
}*/
// Get the creation information from the window handle
ColorPickerClass *pwnd = (ColorPickerClass *)::GetProp (hwnd, "CLASSPOINTER");
BOOL created = (BOOL)::GetProp (hwnd, "CREATED");
if (pwnd != NULL) {
pwnd->Detach ();
WNDPROC *pOldWndProc = pwnd->GetSuperWndProcAddr ();
if (pOldWndProc) {
::SetWindowLong (hwnd, GWL_WNDPROC, (DWORD)(*pOldWndProc));
(*pOldWndProc) = NULL;
}
if (created) {
delete pwnd;
pwnd = NULL;
}
}
}
break;
}
// Allow default processing to occur
return ::DefWindowProc (hwnd, message, wparam, lparam);
}
/////////////////////////////////////////////////////////////////////////////
//
// OnCreate
//
/////////////////////////////////////////////////////////////////////////////
int
ColorPickerClass::OnCreate (LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
m_hMemDC = ::CreateCompatibleDC (NULL);
Create_Bitmap ();
return 0;
}
/////////////////////////////////////////////////////////////////////////////
//
// Create
//
/////////////////////////////////////////////////////////////////////////////
BOOL
ColorPickerClass::Create
(
LPCTSTR /*lpszClassName*/,
LPCTSTR lpszWindowName,
DWORD dwStyle,
const RECT &rect,
CWnd *pparent_wnd,
UINT nID,
CCreateContext * /*pContext*/
)
{
// Create the window (it will force the message map and everthing)
HWND hparent_wnd = (pparent_wnd != NULL) ? pparent_wnd->m_hWnd : NULL;
HWND hwnd = ::CreateWindow ("WWCOLORPICKER",
lpszWindowName,
dwStyle,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
hparent_wnd,
(HMENU)nID,
_hinstance,//::AfxGetInstanceHandle (),
this);
// Return the true/false result code
return (hwnd != NULL);
}
/////////////////////////////////////////////////////////////////////////////
//
// Create_Bitmap
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Create_Bitmap (void)
{
// Start fresh
Free_Bitmap ();
CRect rect;
GetClientRect (&rect);
m_iWidth = rect.Width ();
m_iHeight = rect.Height ();
// Set-up the fields of the BITMAPINFOHEADER
BITMAPINFOHEADER bitmap_info;
bitmap_info.biSize = sizeof (BITMAPINFOHEADER);
bitmap_info.biWidth = m_iWidth;
bitmap_info.biHeight = -m_iHeight; // Top-down DIB uses negative height
bitmap_info.biPlanes = 1;
bitmap_info.biBitCount = 24;
bitmap_info.biCompression = BI_RGB;
bitmap_info.biSizeImage = ((m_iWidth * m_iHeight) * 3);
bitmap_info.biXPelsPerMeter = 0;
bitmap_info.biYPelsPerMeter = 0;
bitmap_info.biClrUsed = 0;
bitmap_info.biClrImportant = 0;
// Get a temporary screen DC
HDC hscreen_dc = ::GetDC (NULL);
// Create a bitmap that we can access the bits directly of
m_hBitmap = ::CreateDIBSection (hscreen_dc,
(const BITMAPINFO *)&bitmap_info,
DIB_RGB_COLORS,
(void **)&m_pBits,
NULL,
0L);
// Release our temporary screen DC
::ReleaseDC (NULL, hscreen_dc);
// Paint the color range into this bitmap
Paint_DIB (m_iWidth, m_iHeight, m_pBits);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Fill_Rect
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Fill_Rect
(
UCHAR *pbits,
const RECT &rect,
COLORREF color,
int scanline_size
)
{
UCHAR red = GetRValue (color);
UCHAR green = GetRValue (color);
UCHAR blue = GetRValue (color);
for (int irow = rect.top; irow < rect.bottom; irow ++) {
int index = irow * scanline_size;
index += (rect.left * 3);
for (int col = rect.left; col < rect.right; col ++) {
pbits[index++] = blue;
pbits[index++] = green;
pbits[index++] = red;
}
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Color_From_Point
//
/////////////////////////////////////////////////////////////////////////////
COLORREF
ColorPickerClass::Color_From_Point
(
int x,
int y
)
{
COLORREF color = RGB (0,0,0);
// x,y location inside boundaries?
if ((x >= 0) && (x < m_iWidth) &&
(y >= 0) && (y < m_iHeight)) {
// Window's bitmaps are DWORD aligned, so make sure
// we take that into account.
int alignment_offset = (m_iWidth * 3) % 4;
alignment_offset = (alignment_offset != 0) ? (4 - alignment_offset) : 0;
int scanline_size = (m_iWidth * 3) + alignment_offset;
// Read the color value straight from the BMP
int index = (scanline_size * y) + (x * 3);
int blue = m_pBits[index];
int green = m_pBits[index + 1];
int red = m_pBits[index + 2];
// Turn the individual compenents into a color
color = RGB (red, green, blue);
RECT rect;
Calc_Display_Rect (rect);
int width = rect.right-rect.left;
m_CurrentHue = ((float)x) / ((float)width);
}
// Return the color
return color;
}
/////////////////////////////////////////////////////////////////////////////
//
// Polar_To_Rect
//
/////////////////////////////////////////////////////////////////////////////
void
Polar_To_Rect (float radius, float angle, float &x, float &y)
{
x = radius * float(cos(angle));
y = radius * float(sin(angle));
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Rect_To_Polar
//
/////////////////////////////////////////////////////////////////////////////
void
Rect_To_Polar (float x, float y, float &radius, float &angle)
{
if (x == 0 && y == 0) {
radius = 0;
angle = 0;
} else {
radius = (float)::sqrt ((x * x) + (y * y));
angle = (float)::atan2 (y, x);
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// RGB_to_Hue
//
/////////////////////////////////////////////////////////////////////////////
void
RGB_to_Hue (int red_val, int green_val, int blue_val, float &hue, float &value)
{
float red_radius = (float)red_val;
float green_radius = (float)green_val;
float blue_radius = (float)blue_val;
float red_angle = 0;
float green_angle = (3.1415926535F * 2.0F) / 3.0F;
float blue_angle = (3.1415926535F * 4.0F) / 3.0F;
struct Color2D
{
float x;
float y;
};
Color2D red = { 0 };
Color2D green = { 0 };
Color2D blue = { 0 };
Color2D result = { 0 };
::Polar_To_Rect (red_radius, red_angle, red.x, red.y);
::Polar_To_Rect (green_radius, green_angle, green.x, green.y);
::Polar_To_Rect (blue_radius, blue_angle, blue.x, blue.y);
result.x = red.x + green.x + blue.x;
result.y = red.y + green.y + blue.y;
float hue_angle = 0;
float hue_radius = 0;
::Rect_To_Polar (result.x, result.y, hue_radius, hue_angle);
hue = hue_angle / (3.14159265359F * 2.0F);
if (hue < 0) {
hue += 1;
} else if (hue > 1) {
hue -= 1;
}
value = (float)::fabs (hue_radius / 255);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Point_From_Color
//
/////////////////////////////////////////////////////////////////////////////
CPoint
ColorPickerClass::Point_From_Color (COLORREF color)
{
// Window's bitmaps are DWORD aligned, so make sure
// we take that into account.
int alignment_offset = (m_iWidth * 3) % 4;
alignment_offset = (alignment_offset != 0) ? (4 - alignment_offset) : 0;
int scanline_size = (m_iWidth * 3) + alignment_offset;
int red = GetRValue (color);
int green = GetGValue (color);
int blue = GetBValue (color);
float hue = 0;
float value = 0;
RGB_to_Hue (red, green, blue, hue, value);
RECT rect;
Calc_Display_Rect (rect);
int width = rect.right-rect.left;
int height = rect.bottom-rect.top;
float whiteness = (float)min (min (red, green), blue);
float percent = whiteness / 255;
float darkness = 0;
//
// Determine what the 'darkness' of the hue should be
//
if (percent != 1) {
float start_red = (red - whiteness) / (1 - percent);
float start_green = (green - whiteness) / (1 - percent);
float start_blue = (blue - whiteness) / (1 - percent);
darkness = max (max (start_red, start_green), start_blue);
}
int x = int(width * hue);
int y = ((255 - (int)darkness) * height) / 255;
// Return the point
return CPoint (x, y);
}
/////////////////////////////////////////////////////////////////////////////
//
// Paint_DIB
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Paint_DIB
(
int width,
int height,
UCHAR *pbits
)
{
// Window's bitmaps are DWORD aligned, so make sure
// we take that into account.
int alignment_offset = (width * 3) % 4;
alignment_offset = (alignment_offset != 0) ? (4 - alignment_offset) : 0;
int scanline_size = (width * 3) + alignment_offset;
//
// Paint the border (if any)
//
CRect rect (0, 0, width, height);
LONG lstyle = ::GetWindowLong (m_hWnd, GWL_STYLE);
if (lstyle & CPS_SUNKEN) {
::Draw_Sunken_Rect (pbits, rect, scanline_size);
rect.DeflateRect (1, 1);
} else if (lstyle & CPS_RAISED) {
::Draw_Raised_Rect (pbits, rect, scanline_size);
rect.DeflateRect (1, 1);
} else if (lstyle & WS_BORDER) {
::Frame_Rect (pbits, rect, RGB (255, 255, 255), scanline_size);
rect.DeflateRect (1, 1);
}
// Recalc the width and height (it could of changed)
width = rect.Width ();
height = rect.Height ();
// Build an array of column indicies where we will switch color
// components...
int col_remainder = (width % 6);
int channel_switch_cols[6];
for (int channel = 0; channel < 6; channel ++) {
// Each column has at least X/6 pixels
channel_switch_cols[channel] = width / 6;
// Do we need to add a remainder to this col?
// (Occurs when the width isn't evenly divisible by 6)
if (col_remainder > 0) {
channel_switch_cols[channel] += 1;
col_remainder --;
}
// Add the previous column's switching index
if (channel > 0) {
channel_switch_cols[channel] += channel_switch_cols[channel - 1];
}
}
// Start with max red
float red = 255.0F;
float green = 0;
float blue = 0;
// Calculate some starting channel variables
int curr_channel = 0;
float curr_inc = (255.0F / ((float)channel_switch_cols[0]));
float *pcurr_component = &green;
//
// Paint the image
//
for (int icol = rect.left; icol < rect.right; icol ++) {
// Determine how much to 'darken' the current hue by for each row (goes to black)
float red_dec = -((float)(red) / (float)(height-1));
float green_dec = -((float)(green) / (float)(height-1));
float blue_dec = -((float)(blue) / (float)(height-1));
// Start with the normal hue color
float curr_red = red;
float curr_green = green;
float curr_blue = blue;
// Paint all pixels in this row
int bitmap_index = (icol * 3) + (rect.left * scanline_size);
for (int irow = rect.top; irow < rect.bottom; irow ++) {
// Put these values into the bitmap
pbits[bitmap_index] = UCHAR(((int)curr_blue) & 0xFF);
pbits[bitmap_index + 1] = UCHAR(((int)curr_green) & 0xFF);
pbits[bitmap_index + 2] = UCHAR(((int)curr_red) & 0xFF);
// Determine the current red, green, and blue values
curr_red = curr_red + red_dec;
curr_green = curr_green + green_dec;
curr_blue = curr_blue + blue_dec;
// Increment our offset into the bitmap
bitmap_index += scanline_size;
}
// Is it time to switch to a new color channel?
if ((icol - rect.left) == channel_switch_cols[curr_channel]) {
// Recompute values for the new channel
curr_channel ++;
curr_inc = (255.0F / ((float)(channel_switch_cols[curr_channel] - channel_switch_cols[curr_channel-1])));
// Which channel are we painting?
if (curr_channel == 1) {
pcurr_component = &red;
curr_inc = -curr_inc;
} else if (curr_channel == 2) {
pcurr_component = &blue;
} else if (curr_channel == 3) {
pcurr_component = &green;
curr_inc = -curr_inc;
} else if (curr_channel == 4) {
pcurr_component = &red;
} else if (curr_channel == 5) {
pcurr_component = &blue;
curr_inc = -curr_inc;
}
}
// Increment the current color component
(*pcurr_component) = (*pcurr_component) + curr_inc;
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Free_Bitmap
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Free_Bitmap (void)
{
if (m_hBitmap != NULL) {
::DeleteObject (m_hBitmap);
m_hBitmap = NULL;
m_pBits = NULL;
}
m_iWidth = 0;
m_iHeight = 0;
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// OnSize
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::OnSize
(
UINT nType,
int cx,
int cy
)
{
// Allow the base class to process this message
CWnd::OnSize (nType, cx, cy);
// Recreate the BMP to reflect the new window size
Create_Bitmap ();
// Determine the new point based on the current color
//m_CurrentColor = RGB (128, 222, 199);
//m_CurrentPoint = Point_From_Color (m_CurrentColor);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// OnEraseBkgnd
//
/////////////////////////////////////////////////////////////////////////////
BOOL
ColorPickerClass::OnEraseBkgnd (CDC * /*pDC*/)
{
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//
// OnLButtonDown
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::OnLButtonDown
(
UINT nFlags,
CPoint point
)
{
SetCapture ();
m_bSelecting = true;
RECT rect;
Calc_Display_Rect (rect);
ClientToScreen (&rect);
::ClipCursor (&rect);
Erase_Marker ();
m_CurrentPoint = point;
m_CurrentColor = Color_From_Point (point.x, point.y);
//
// Notify the parent window that the user double-clicked
// one of the keyframes
//
LONG id = ::GetWindowLong (m_hWnd, GWL_ID);
CP_NMHDR notify_hdr = { 0 };
notify_hdr.hdr.hwndFrom = m_hWnd;
notify_hdr.hdr.idFrom = id;
notify_hdr.hdr.code = CPN_COLORCHANGE;
notify_hdr.red = GetRValue (m_CurrentColor);
notify_hdr.green = GetGValue (m_CurrentColor);
notify_hdr.blue = GetBValue (m_CurrentColor);
notify_hdr.hue = m_CurrentHue;
::SendMessage (::GetParent (m_hWnd),
WM_NOTIFY,
id,
(LPARAM)&notify_hdr);
Paint_Marker ();
// Allow the base class to process this message
CWnd::OnLButtonDown (nFlags, point);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// OnLButtonUp
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::OnLButtonUp
(
UINT nFlags,
CPoint point
)
{
if (m_bSelecting) {
::ClipCursor (NULL);
ReleaseCapture ();
m_bSelecting = false;
}
// Allow the base class to process this message
CWnd::OnLButtonUp (nFlags, point);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// OnMouseMove
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::OnMouseMove
(
UINT nFlags,
CPoint point
)
{
if (m_bSelecting) {
Erase_Marker ();
m_CurrentPoint = point;
m_CurrentColor = Color_From_Point (point.x, point.y);
//
// Notify the parent window that the user double-clicked
// one of the keyframes
//
LONG id = ::GetWindowLong (m_hWnd, GWL_ID);
CP_NMHDR notify_hdr = { 0 };
notify_hdr.hdr.hwndFrom = m_hWnd;
notify_hdr.hdr.idFrom = id;
notify_hdr.hdr.code = CPN_COLORCHANGE;
notify_hdr.red = GetRValue (m_CurrentColor);
notify_hdr.green = GetGValue (m_CurrentColor);
notify_hdr.blue = GetBValue (m_CurrentColor);
notify_hdr.hue = m_CurrentHue;
::SendMessage (::GetParent (m_hWnd),
WM_NOTIFY,
id,
(LPARAM)&notify_hdr);
Paint_Marker ();
}
// Allow the base class to process this message
CWnd::OnMouseMove (nFlags, point);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Calc_Display_Rect
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Calc_Display_Rect (RECT &rect)
{
GetClientRect (&rect);
LONG lstyle = ::GetWindowLong (m_hWnd, GWL_STYLE);
if ((lstyle & CPS_SUNKEN) || (lstyle & CPS_RAISED) || (lstyle & WS_BORDER)) {
rect.left += 1;
rect.right -= 1;
rect.top += 1;
rect.bottom -= 1;
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Erase_Marker
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Erase_Marker (void)
{
HDC hdc = ::GetDC (m_hWnd);
if (m_hMemDC != NULL) {
HBITMAP hold_bmp = (HBITMAP)::SelectObject (m_hMemDC, m_hBitmap);
CRect rect;
GetClientRect (&rect);
::BitBlt (hdc,
m_CurrentPoint.x - 5,
m_CurrentPoint.y - 5,
11,
11,
m_hMemDC,
m_CurrentPoint.x - 5,
m_CurrentPoint.y - 5,
SRCCOPY);
::SelectObject (m_hMemDC, hold_bmp);
}
::ReleaseDC (m_hWnd, hdc);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Paint_Marker
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Paint_Marker (void)
{
HDC hdc = ::GetDC (m_hWnd);
if (m_hMemDC != NULL) {
HBITMAP hmarker_bmp = ::LoadBitmap (_hinstance, MAKEINTRESOURCE (IDB_MARKER));
HBITMAP hold_bmp = (HBITMAP)::SelectObject (m_hMemDC, hmarker_bmp);
CRect rect;
GetClientRect (&rect);
::BitBlt (hdc,
m_CurrentPoint.x - 5,
m_CurrentPoint.y - 5,
11,
11,
m_hMemDC,
0,
0,
SRCINVERT);
::SelectObject (m_hMemDC, hold_bmp);
::DeleteObject (hmarker_bmp);
}
::ReleaseDC (m_hWnd, hdc);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Select_Color
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Select_Color (int red, int green, int blue)
{
m_CurrentColor = RGB (red, green, blue);
m_CurrentPoint = Point_From_Color (m_CurrentColor);
m_CurrentColor = Color_From_Point (m_CurrentPoint.x, m_CurrentPoint.y);
// Refresh the window
InvalidateRect (NULL, FALSE);
UpdateWindow ();
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Get_Current_Color
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerClass::Get_Current_Color (int *red, int *green, int *blue)
{
(*red) = GetRValue (m_CurrentColor);
(*green) = GetGValue (m_CurrentColor);
(*blue) = GetBValue (m_CurrentColor);
return ;
}

View File

@@ -0,0 +1,166 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
#if !defined(AFX_COLORPICKER_H__C943A7EC_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)
#define AFX_COLORPICKER_H__C943A7EC_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ColorPicker.h : header file
//
#ifdef WWCTRL_LIB
#define LINKAGE_SPEC __declspec (dllexport)
#else
#define LINKAGE_SPEC
#endif
/////////////////////////////////////////////////////////////////////////////
//
// Constants
//
//
// Window styles
//
#define CPS_SUNKEN 0x00000001
#define CPS_RAISED 0x00000002
//
// Window messages and notifications
//
#define CPN_COLORCHANGE 0x0001
#define CPM_GETCOLOR (WM_USER+101)
#define CPM_SETCOLOR (WM_USER+102)
/////////////////////////////////////////////////////////////////////////////
//
// Structures
//
// Structure used to send notifications via WM_NOTIFY
typedef struct
{
NMHDR hdr;
float red;
float green;
float blue;
float hue;
} CP_NMHDR;
/////////////////////////////////////////////////////////////////////////////
//
// ColorPickerClass window
//
class LINKAGE_SPEC ColorPickerClass : public CWnd
{
// Construction
public:
ColorPickerClass();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ColorPickerClass)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~ColorPickerClass();
// Generated message map functions
protected:
//{{AFX_MSG(ColorPickerClass)
afx_msg void OnPaint();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
friend LRESULT WINAPI fnColorPickerProc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
public:
//////////////////////////////////////////////////////////////////////////
// Public members
//////////////////////////////////////////////////////////////////////////
void Select_Color (int red, int green, int blue);
void Get_Current_Color (int *red, int *green, int *blue);
//////////////////////////////////////////////////////////////////////////
// Static members
//////////////////////////////////////////////////////////////////////////
static ColorPickerClass *Get_Color_Picker (HWND window_handle) { return (ColorPickerClass *)::GetProp (window_handle, "CLASSPOINTER"); }
protected:
/////////////////////////////////////////////////////////////////////////
//
// Private member data
//
void Paint_DIB (int width, int height, UCHAR *pbits);
void Create_Bitmap (void);
void Free_Bitmap (void);
void Fill_Rect (UCHAR *pbits, const RECT &rect, COLORREF color, int scanline_size);
void Frame_Rect (UCHAR *pbits, const RECT &rect, COLORREF color, int scanline_size);
void Draw_Horz_Line (UCHAR *pbits, int x, int y, int len, COLORREF color, int scanline_size);
void Draw_Vert_Line (UCHAR *pbits, int x, int y, int len, COLORREF color, int scanline_size);
COLORREF Color_From_Point (int x, int y);
CPoint Point_From_Color (COLORREF color);
void Paint_Marker (void);
void Erase_Marker (void);
void Calc_Display_Rect (RECT &rect);
private:
/////////////////////////////////////////////////////////////////////////
//
// Private member data
//
HBITMAP m_hBitmap;
HDC m_hMemDC;
UCHAR * m_pBits;
int m_iWidth;
int m_iHeight;
CPoint m_CurrentPoint;
COLORREF m_CurrentColor;
bool m_bSelecting;
float m_CurrentHue;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COLORPICKER_H__C943A7EC_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)

View File

@@ -0,0 +1,667 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
// ColorPickerDialogClass.cpp : implementation file
//
#include "StdAfx.H"
#include "ColorPickerDialogClass.H"
#include "ColorBar.H"
#include "ColorPicker.H"
#include "WWCtrl.H"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern HINSTANCE _hinstance;
/////////////////////////////////////////////////////////////////////////////
//
// Local constants
//
/////////////////////////////////////////////////////////////////////////////
const DWORD UPDATE_COLOR_BARS = 0x00000001;
const DWORD UPDATE_WHITENESS = 0x00000002;
const DWORD UPDATE_HUE_PICKER = 0x00000004;
class MyManageStateClass
{
public:
MyManageStateClass (void)
{
m_hResHandle = ::AfxGetResourceHandle ();
::AfxSetResourceHandle (_hinstance);
}
~MyManageStateClass (void) { ::AfxSetResourceHandle (m_hResHandle); }
private:
HINSTANCE m_hResHandle;
};
#define MY_MANAGE_STATE() MyManageStateClass _xmystate;
extern "C"
{
HWND
Create_Color_Picker_Form (HWND parent, int red, int green, int blue)
{
MY_MANAGE_STATE ()
CWnd *parent_wnd = CWnd::FromHandle (parent);
ColorPickerDialogClass *dialog = new ColorPickerDialogClass (red, green, blue, parent_wnd, IDD_COLOR_FORM);
dialog->Create_Form (parent_wnd);
HINSTANCE old_handle = ::AfxGetResourceHandle ();
::AfxSetResourceHandle (_hinstance);
return dialog->m_hWnd;
}
}
extern "C"
{
BOOL
Get_Form_Color (HWND form_wnd, int *red, int *green, int *blue)
{
MY_MANAGE_STATE ()
BOOL retval = FALSE;
ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS");
if (dialog != NULL) {
(*red) = dialog->Get_Red ();
(*green) = dialog->Get_Green ();
(*blue) = dialog->Get_Blue ();
retval = TRUE;
}
return retval;
}
}
extern "C"
{
BOOL
Set_Form_Color (HWND form_wnd, int red, int green, int blue)
{
MY_MANAGE_STATE ()
BOOL retval = FALSE;
ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS");
if (dialog != NULL) {
dialog->Set_Color (red, green, blue);
retval = TRUE;
}
return retval;
}
}
extern "C"
{
BOOL
Set_Form_Original_Color (HWND form_wnd, int red, int green, int blue)
{
MY_MANAGE_STATE ()
BOOL retval = FALSE;
ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS");
if (dialog != NULL) {
dialog->Set_Original_Color (red, green, blue);
retval = TRUE;
}
return retval;
}
}
extern "C"
{
BOOL
Show_Color_Picker (int *red, int *green, int *blue)
{
MY_MANAGE_STATE ()
BOOL retval = FALSE;
ColorPickerDialogClass dialog (*red, *green, *blue);
if (dialog.DoModal () == IDOK) {
(*red) = dialog.Get_Red ();
(*green) = dialog.Get_Green ();
(*blue) = dialog.Get_Blue ();
retval = TRUE;
}
return retval;
}
}
extern "C"
{
BOOL
Set_Update_Callback (HWND form_wnd, WWCTRL_COLORCALLBACK callback, void *arg)
{
MY_MANAGE_STATE()
BOOL retval = FALSE;
ColorPickerDialogClass *dialog = (ColorPickerDialogClass *)::GetProp (form_wnd, "COLORPICKERDLGCLASS");
if (dialog != NULL) {
dialog->Set_Update_Callback(callback, arg);
retval = TRUE;
}
return retval;
}
}
/////////////////////////////////////////////////////////////////////////////
//
// ColorPickerDialogClass
//
/////////////////////////////////////////////////////////////////////////////
ColorPickerDialogClass::ColorPickerDialogClass
(
int red,
int green,
int blue,
CWnd *pParent,
UINT res_id
)
: m_OrigRed ((float)red),
m_OrigGreen ((float)green),
m_OrigBlue ((float)blue),
m_CurrentRed ((float)red),
m_CurrentGreen ((float)green),
m_CurrentBlue ((float)blue),
m_CurrentColorBar (NULL),
m_OrigColorBar (NULL),
m_RedColorBar (NULL),
m_GreenColorBar (NULL),
m_BlueColorBar (NULL),
m_WhitenessColorBar (NULL),
m_HuePicker (NULL),
m_bDeleteOnClose (false),
m_UpdateCallback(NULL),
CDialog(res_id, pParent)
{
//{{AFX_DATA_INIT(ColorPickerDialogClass)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Create_Form
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::Create_Form (CWnd *parent)
{
Create (IDD_COLOR_FORM, parent);
SetProp (m_hWnd, "COLORPICKERDLGCLASS", (HANDLE)this);
m_bDeleteOnClose = true;
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// DoDataExchange
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::DoDataExchange (CDataExchange *pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ColorPickerDialogClass)
DDX_Control(pDX, IDC_BLUE_SPIN, m_BlueSpin);
DDX_Control(pDX, IDC_GREEN_SPIN, m_GreenSpin);
DDX_Control(pDX, IDC_RED_SPIN, m_RedSpin);
//}}AFX_DATA_MAP
return ;
}
BEGIN_MESSAGE_MAP(ColorPickerDialogClass, CDialog)
//{{AFX_MSG_MAP(ColorPickerDialogClass)
ON_BN_CLICKED(IDC_RESET, OnReset)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//
// OnInitDialog
//
/////////////////////////////////////////////////////////////////////////////
BOOL
ColorPickerDialogClass::OnInitDialog (void)
{
CDialog::OnInitDialog ();
//
// Setup the spin controls
//
m_BlueSpin.SetRange (0, 255);
m_GreenSpin.SetRange (0, 255);
m_RedSpin.SetRange (0, 255);
m_BlueSpin.SetPos ((int)m_CurrentBlue);
m_GreenSpin.SetPos ((int)m_CurrentGreen);
m_RedSpin.SetPos ((int)m_CurrentRed);
//
// Get control of all the color bars on the dialog
//
m_CurrentColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_CURRENT_COLOR_BAR));
m_OrigColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_ORIG_COLOR_BAR));
m_RedColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_RED_BAR));
m_GreenColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_GREEN_BAR));
m_BlueColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_BLUE_BAR));
m_WhitenessColorBar = ColorBarClass::Get_Color_Bar (::GetDlgItem (m_hWnd, IDC_WHITENESS_BAR));
m_HuePicker = ColorPickerClass::Get_Color_Picker (::GetDlgItem (m_hWnd, IDC_HUE_PICKER));
// Setup the original color bar
m_OrigColorBar->Modify_Point (0, 0, m_OrigRed, m_OrigGreen, m_OrigBlue);
m_HuePicker->Select_Color ((int)m_OrigRed, (int)m_OrigGreen, (int)m_OrigBlue);
//m_WhitenessColorBar->Modify_Point (0, 0, m_OrigRed, m_OrigGreen, m_OrigBlue);
m_RedColorBar->Set_Range (0, 255);
m_GreenColorBar->Set_Range (0, 255);
m_BlueColorBar->Set_Range (0, 255);
m_WhitenessColorBar->Set_Range (0, 255);
m_WhitenessColorBar->Insert_Point (1, 255, 255, 255, 255);
//
// Setup the red/green/blue color bars
//
//m_RedColorBar->Insert_Point (1, 1, 255, 0, 0);
//m_GreenColorBar->Insert_Point (1, 1, 0, 255, 0);
//m_BlueColorBar->Insert_Point (1, 1, 0, 0, 255);
//
// Update the remaining color bars to reflect the initial color
//
Update_Red_Bar ();
Update_Green_Bar ();
Update_Blue_Bar ();
Update_Current_Color_Bar ();
Update_Whiteness_Bar ();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//
// Update_Red_Bar
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::Update_Red_Bar (void)
{
m_RedColorBar->Set_Selection_Pos (m_CurrentRed);
m_RedColorBar->Modify_Point (0, 0, 0, (float)m_CurrentGreen, (float)m_CurrentBlue);
m_RedColorBar->Modify_Point (1, 255, 255, (float)m_CurrentGreen, (float)m_CurrentBlue);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Update_Green_Bar
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::Update_Green_Bar (void)
{
m_GreenColorBar->Set_Selection_Pos (m_CurrentGreen);
m_GreenColorBar->Modify_Point (0, 0, m_CurrentRed, 0, m_CurrentBlue);
m_GreenColorBar->Modify_Point (1, 255, m_CurrentRed, 255, m_CurrentBlue);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Update_Blue_Bar
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::Update_Blue_Bar (void)
{
m_BlueColorBar->Set_Selection_Pos (m_CurrentBlue);
m_BlueColorBar->Modify_Point (0, 0, m_CurrentRed, m_CurrentGreen, 0);
m_BlueColorBar->Modify_Point (1, 255, m_CurrentRed, m_CurrentGreen, 255);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Update_Current_Color_Bar
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::Update_Current_Color_Bar (void)
{
m_CurrentColorBar->Modify_Point (0, 0, m_CurrentRed, m_CurrentGreen, m_CurrentBlue);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Update_Whiteness_Bar
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::Update_Whiteness_Bar (void)
{
int red = 0;
int green = 0;
int blue = 0;
m_HuePicker->Get_Current_Color (&red, &green, &blue);
//
// Given the current color, determine the 'whiteness' and update
//
float whiteness = min (m_CurrentRed, m_CurrentGreen);
whiteness = min (whiteness, m_CurrentBlue);
float percent = whiteness / 255;
m_WhitenessColorBar->Set_Selection_Pos (whiteness);
m_WhitenessColorBar->Modify_Point (0, 0, (float)red, (float)green, (float)blue);
// Can we extrapolate the starting color from the whiteness factor?
/*if (percent == 1) {
m_WhitenessColorBar->Modify_Point (0, 0, 0, 0, 0);
} else {
//
// Extrapolate the starting color
//
float start_red = (m_CurrentRed - whiteness) / (1 - percent);
float start_green = (m_CurrentGreen - whiteness) / (1 - percent);
float start_blue = (m_CurrentBlue - whiteness) / (1 - percent);
m_WhitenessColorBar->Modify_Point (0, 0, start_red, start_green, start_blue);
}*/
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// OnNotify
//
/////////////////////////////////////////////////////////////////////////////
BOOL
ColorPickerDialogClass::OnNotify
(
WPARAM wParam,
LPARAM lParam,
LRESULT *pResult
)
{
CBR_NMHDR *color_bar_hdr = (CBR_NMHDR *)lParam;
switch (color_bar_hdr->hdr.idFrom)
{
case IDC_RED_BAR:
{
if (color_bar_hdr->hdr.code == CBRN_SEL_CHANGED) {
float red = color_bar_hdr->red;
float green = m_CurrentGreen;
float blue = m_CurrentBlue;
Update_Color (red, green, blue);
}
}
break;
case IDC_GREEN_BAR:
{
if (color_bar_hdr->hdr.code == CBRN_SEL_CHANGED) {
float red = m_CurrentRed;
float green = color_bar_hdr->green;
float blue = m_CurrentBlue;
Update_Color (red, green, blue);
}
}
break;
case IDC_BLUE_BAR:
{
if (color_bar_hdr->hdr.code == CBRN_SEL_CHANGED) {
float red = m_CurrentRed;
float green = m_CurrentGreen;
float blue = color_bar_hdr->blue;
Update_Color (red, green, blue);
}
}
break;
case IDC_WHITENESS_BAR:
{
if (color_bar_hdr->hdr.code == CBRN_SEL_CHANGED) {
float red = color_bar_hdr->red;
float green = color_bar_hdr->green;
float blue = color_bar_hdr->blue;
Update_Color (red, green, blue, UPDATE_COLOR_BARS);
}
}
break;
case IDC_HUE_PICKER:
{
CP_NMHDR *picker_hdr = (CP_NMHDR *)lParam;
if (picker_hdr->hdr.code == CPN_COLORCHANGE) {
float red = picker_hdr->red;
float green = picker_hdr->green;
float blue = picker_hdr->blue;
float whiteness = m_WhitenessColorBar->Get_Selection_Pos () / 255;
red = red + ((255 - red) * whiteness);
green = green + ((255 - green) * whiteness);
blue = blue + ((255 - blue) * whiteness);
Update_Color (red, green, blue, UPDATE_COLOR_BARS | UPDATE_WHITENESS);
}
}
break;
case IDC_RED_SPIN:
case IDC_GREEN_SPIN:
case IDC_BLUE_SPIN:
{
if (color_bar_hdr->hdr.code == UDN_DELTAPOS) {
float red = (float)m_RedSpin.GetPos ();
float green = (float)m_GreenSpin.GetPos ();
float blue = (float)m_BlueSpin.GetPos ();
Update_Color (red, green, blue, UPDATE_COLOR_BARS | UPDATE_WHITENESS | UPDATE_HUE_PICKER);
}
}
break;
}
return CDialog::OnNotify (wParam, lParam, pResult);
}
/////////////////////////////////////////////////////////////////////////////
//
// Update_Color
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::Update_Color
(
float red,
float green,
float blue,
DWORD flags
)
{
/*bool update_red = m_CurrentRed != red;
bool update_green = m_CurrentGreen != green;
bool update_blue = m_CurrentBlue != blue;*/
m_CurrentRed = red;
m_CurrentGreen = green;
m_CurrentBlue = blue;
int int_blue = (int)blue;
int int_green = (int)green;
int int_red = (int)red;
if (int_blue != m_BlueSpin.GetPos ()) {
m_BlueSpin.SetPos (int_blue);
}
if (int_green != m_GreenSpin.GetPos ()) {
m_GreenSpin.SetPos (int_green);
}
if (int_red != m_RedSpin.GetPos ()) {
m_RedSpin.SetPos (int_red);
}
// Hack to get the edit controls to update in a timely fashion
::UpdateWindow (::GetDlgItem (m_hWnd, IDC_RED_EDIT));
::UpdateWindow (::GetDlgItem (m_hWnd, IDC_GREEN_EDIT));
::UpdateWindow (::GetDlgItem (m_hWnd, IDC_BLUE_EDIT));
//
// Update the red, green and blue color bars
//
if (flags & UPDATE_COLOR_BARS) {
Update_Red_Bar ();
Update_Green_Bar ();
Update_Blue_Bar ();
}
//
// Update the hue picker
//
if (flags & UPDATE_HUE_PICKER) {
m_HuePicker->Select_Color ((int)red, (int)green, (int)blue);
}
//
// Update the whiteness color bar
//
if (flags & UPDATE_WHITENESS) {
Update_Whiteness_Bar ();
}
Update_Current_Color_Bar ();
// If a callback is registered, call it.
if (m_UpdateCallback)
m_UpdateCallback((int)red, (int)green, (int)blue, m_CallArg);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Set_Original_Color
//
/////////////////////////////////////////////////////////////////////////////
void ColorPickerDialogClass::Set_Original_Color (int r, int g, int b)
{
m_OrigRed = (float)r;
m_OrigGreen = (float)g;
m_OrigBlue = (float)b;
m_OrigColorBar->Modify_Point (0, 0, m_OrigRed, m_OrigGreen, m_OrigBlue);
}
/////////////////////////////////////////////////////////////////////////////
//
// OnReset
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::OnReset (void)
{
Update_Color (m_OrigRed,
m_OrigGreen,
m_OrigBlue,
UPDATE_COLOR_BARS| UPDATE_WHITENESS | UPDATE_HUE_PICKER);
return ;
}
LRESULT ColorPickerDialogClass::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
return CDialog::WindowProc(message, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////
//
// OnCommand
//
/////////////////////////////////////////////////////////////////////////////
BOOL
ColorPickerDialogClass::OnCommand
(
WPARAM wParam,
LPARAM lParam
)
{
switch (LOWORD (wParam))
{
case IDC_RED_EDIT:
case IDC_GREEN_EDIT:
case IDC_BLUE_EDIT:
{
if (HIWORD (wParam) == EN_KILLFOCUS) {
float red = (float)GetDlgItemInt (IDC_RED_EDIT);
float green = (float)GetDlgItemInt (IDC_GREEN_EDIT);
float blue = (float)GetDlgItemInt (IDC_BLUE_EDIT);
Update_Color (red, green, blue, UPDATE_COLOR_BARS| UPDATE_WHITENESS | UPDATE_HUE_PICKER);
}
}
break;
}
return CDialog::OnCommand(wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////
//
// PostNcDestroy
//
/////////////////////////////////////////////////////////////////////////////
void
ColorPickerDialogClass::PostNcDestroy (void)
{
CDialog::PostNcDestroy();
if (m_bDeleteOnClose) {
delete this;
}
return ;
}

View File

@@ -0,0 +1,132 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
#if !defined(AFX_COLORPICKERDIALOGCLASS_H__C943A7F1_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)
#define AFX_COLORPICKERDIALOGCLASS_H__C943A7F1_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ColorPickerDialogClass.h : header file
//
#include "Resource.H"
#include "WWCtrl.H"
// Forward declarations
class ColorBarClass;
class ColorPickerClass;
/////////////////////////////////////////////////////////////////////////////
//
// ColorPickerDialogClass dialog
//
class ColorPickerDialogClass : public CDialog
{
// Construction
public:
ColorPickerDialogClass (int red, int green, int blue, CWnd* pParent = NULL, UINT res_id = ColorPickerDialogClass::IDD); // standard constructor
// Dialog Data
//{{AFX_DATA(ColorPickerDialogClass)
enum { IDD = IDD_COLOR_PICKER };
CSpinButtonCtrl m_BlueSpin;
CSpinButtonCtrl m_GreenSpin;
CSpinButtonCtrl m_RedSpin;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ColorPickerDialogClass)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
virtual void PostNcDestroy();
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(ColorPickerDialogClass)
virtual BOOL OnInitDialog();
afx_msg void OnReset();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
/////////////////////////////////////////////////////////////
// Public methods
/////////////////////////////////////////////////////////////
int Get_Red (void) const { return (int)m_CurrentRed; }
int Get_Green (void) const { return (int)m_CurrentGreen; }
int Get_Blue (void) const { return (int)m_CurrentBlue; }
void Set_Color (int r, int g, int b)
{ Update_Color((float)r, (float)g, (float)b); }
void Set_Original_Color (int r, int g, int b);
void Create_Form (CWnd *parent);
void Set_Update_Callback (WWCTRL_COLORCALLBACK callme, void *arg)
{ m_UpdateCallback = callme; m_CallArg = arg; }
protected:
/////////////////////////////////////////////////////////////
// Protected methods
/////////////////////////////////////////////////////////////
void Update_Red_Bar (void);
void Update_Green_Bar (void);
void Update_Blue_Bar (void);
void Update_Current_Color_Bar (void);
void Update_Whiteness_Bar (void);
void Update_Color (float red, float green, float blue, DWORD flags = 0xFFFFFFFF);
private:
/////////////////////////////////////////////////////////////
// Private member data
/////////////////////////////////////////////////////////////
float m_OrigRed;
float m_OrigGreen;
float m_OrigBlue;
float m_CurrentRed;
float m_CurrentGreen;
float m_CurrentBlue;
ColorBarClass * m_CurrentColorBar;
ColorBarClass * m_OrigColorBar;
ColorBarClass * m_RedColorBar;
ColorBarClass * m_GreenColorBar;
ColorBarClass * m_BlueColorBar;
ColorBarClass * m_WhitenessColorBar;
ColorPickerClass *m_HuePicker;
bool m_bDeleteOnClose;
// Callback function when color is updated.
WWCTRL_COLORCALLBACK m_UpdateCallback;
void * m_CallArg;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_COLORPICKERDIALOGCLASS_H__C943A7F1_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,24 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
// stdafx.cpp : source file that includes just the standard includes
// WWCtrl.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,59 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__C943A7E7_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)
#define AFX_STDAFX_H__C943A7E7_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE classes
#include <afxodlgs.h> // MFC OLE dialog classes
#include <afxdisp.h> // MFC OLE automation classes
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C943A7E7_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)

188
Code/Tools/WWCtrl/Utils.cpp Normal file
View File

@@ -0,0 +1,188 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
//////////////////////////////////////////////////////////////////////////////////////////
//
// Utils.cpp
//
//
#include "StdAfx.H"
#include "Utils.H"
/////////////////////////////////////////////////////////////////////////////
//
// Draw_Sunken_Rect
//
void
Draw_Sunken_Rect
(
UCHAR *pbits,
const RECT &rect,
int scanline_size
)
{
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
// Draw the 4 lines that compose the rectangle
::Draw_Vert_Line (pbits, rect.left, rect.top, height, ::GetSysColor (COLOR_3DSHADOW), scanline_size);
::Draw_Vert_Line (pbits, rect.right-1, rect.top, height, ::GetSysColor (COLOR_3DHIGHLIGHT), scanline_size);
::Draw_Horz_Line (pbits, rect.left, rect.top, width, ::GetSysColor (COLOR_3DSHADOW), scanline_size);
::Draw_Horz_Line (pbits, rect.left, rect.bottom-1, width, ::GetSysColor (COLOR_3DHIGHLIGHT), scanline_size);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Draw_Raised_Rect
//
void
Draw_Raised_Rect
(
UCHAR *pbits,
const RECT &rect,
int scanline_size
)
{
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
// Draw the 4 lines that compose the rectangle
::Draw_Vert_Line (pbits, rect.left, rect.top, height, ::GetSysColor (COLOR_3DHIGHLIGHT), scanline_size);
::Draw_Vert_Line (pbits, rect.right-1, rect.top, height, ::GetSysColor (COLOR_3DSHADOW), scanline_size);
::Draw_Horz_Line (pbits, rect.left, rect.top, width, ::GetSysColor (COLOR_3DHIGHLIGHT), scanline_size);
::Draw_Horz_Line (pbits, rect.left, rect.bottom-1, width, ::GetSysColor (COLOR_3DSHADOW), scanline_size);
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Frame_Rect
//
void
Frame_Rect
(
UCHAR *pbits,
const RECT &rect,
COLORREF color,
int scanline_size
)
{
UCHAR red = GetRValue (color);
UCHAR green = GetRValue (color);
UCHAR blue = GetRValue (color);
int index = (rect.top * scanline_size) + (rect.left * 3);
for (int col = rect.left; col < rect.right; col ++) {
pbits[index++] = blue;
pbits[index++] = green;
pbits[index++] = red;
}
index = ((rect.bottom-1) * scanline_size) + (rect.left * 3);
for (col = rect.left; col < rect.right; col ++) {
pbits[index++] = blue;
pbits[index++] = green;
pbits[index++] = red;
}
index = (rect.top * scanline_size) + (rect.left * 3);
for (int row = rect.top; row < rect.bottom; row ++) {
pbits[index] = blue;
pbits[index + 1] = green;
pbits[index + 2] = red;
index += scanline_size;
}
index = (rect.top * scanline_size) + ((rect.right-1) * 3);
for (row = rect.top; row < rect.bottom; row ++) {
pbits[index] = blue;
pbits[index + 1] = green;
pbits[index + 2] = red;
index += scanline_size;
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Draw_Vert_Line
//
void
Draw_Vert_Line
(
UCHAR *pbits,
int x,
int y,
int len,
COLORREF color,
int scanline_size
)
{
UCHAR red = GetRValue (color);
UCHAR green = GetRValue (color);
UCHAR blue = GetRValue (color);
int index = (y * scanline_size) + (x * 3);
for (int row = y; row < len; row ++) {
pbits[index] = blue;
pbits[index + 1] = green;
pbits[index + 2] = red;
index += scanline_size;
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
//
// Draw_Horz_Line
//
void
Draw_Horz_Line
(
UCHAR *pbits,
int x,
int y,
int len,
COLORREF color,
int scanline_size
)
{
UCHAR red = GetRValue (color);
UCHAR green = GetRValue (color);
UCHAR blue = GetRValue (color);
int index = (y * scanline_size) + (x * 3);
for (int col = x; col < len; col ++) {
pbits[index++] = blue;
pbits[index++] = green;
pbits[index++] = red;
}
return ;
}

40
Code/Tools/WWCtrl/Utils.h Normal file
View File

@@ -0,0 +1,40 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
//////////////////////////////////////////////////////////////////////////////////////////
//
// Utils.H
//
//
#ifndef __UTILS_H
#define __UTILS_H
/////////////////////////////////////////////////////////////////////////////
//
// Prototypes
//
void Frame_Rect (UCHAR *pbits, const RECT &rect, COLORREF color, int scanline_size);
void Draw_Vert_Line (UCHAR *pbits, int x, int y, int len, COLORREF color, int scanline_size);
void Draw_Horz_Line (UCHAR *pbits, int x, int y, int len, COLORREF color, int scanline_size);
void Draw_Sunken_Rect (UCHAR *pbits, const RECT &rect, int scanline_size);
void Draw_Raised_Rect (UCHAR *pbits, const RECT &rect, int scanline_size);
#endif //__UTILS_H

View File

@@ -0,0 +1,99 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
// WWCtrl.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include <afxdllx.h>
#include "WWCtrl.H"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//
// Declarations
//
extern void RegisterColorPicker (HINSTANCE hinst);
extern void RegisterColorBar (HINSTANCE hinst);
HINSTANCE _hinstance = NULL;
static AFX_EXTENSION_MODULE WWCtrlDLL = { NULL, NULL };
/////////////////////////////////////////////////////////////
//
// DllMain
//
/////////////////////////////////////////////////////////////
extern "C" int APIENTRY
DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
// Remove this if you use lpReserved
UNREFERENCED_PARAMETER(lpReserved);
if (dwReason == DLL_PROCESS_ATTACH)
{
TRACE0("WWCTRL.DLL Initializing!\n");
_hinstance = hInstance;
// Extension DLL one-time initialization
if (!AfxInitExtensionModule(WWCtrlDLL, hInstance))
return 0;
// Insert this DLL into the resource chain
// NOTE: If this Extension DLL is being implicitly linked to by
// an MFC Regular DLL (such as an ActiveX Control)
// instead of an MFC application, then you will want to
// remove this line from DllMain and put it in a separate
// function exported from this Extension DLL. The Regular DLL
// that uses this Extension DLL should then explicitly call that
// function to initialize this Extension DLL. Otherwise,
// the CDynLinkLibrary object will not be attached to the
// Regular DLL's resource chain, and serious problems will
// result.
RegisterColorPicker (hInstance);
RegisterColorBar (hInstance);
new CDynLinkLibrary(WWCtrlDLL);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
TRACE0("WWCTRL.DLL Terminating!\n");
// Terminate the library before destructors are called
AfxTermExtensionModule(WWCtrlDLL);
}
return 1; // ok
}
/////////////////////////////////////////////////////////////
//
// Initialize_WWCtrl
//
/////////////////////////////////////////////////////////////
__declspec (dllexport) void
Initialize_WWCtrl (void)
{
return ;
}

View File

@@ -0,0 +1,13 @@
; WWCtrl.def : Declares the module parameters for the DLL.
DESCRIPTION 'WWCtrl Windows Dynamic Link Library'
EXPORTS
; Explicit exports can go here
Show_Color_Picker @2
Get_Form_Color @3
Create_Color_Picker_Form @4
Set_Form_Color @5

View File

@@ -0,0 +1,216 @@
# Microsoft Developer Studio Project File - Name="WWCtrl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=WWCtrl - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "WWCtrl.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "WWCtrl.mak" CFG="WWCtrl - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "WWCtrl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "WWCtrl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "WWCtrl - Win32 Profile" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/G/Tools/WWCtrl", REWBAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "WWCtrl - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /D "WWCTRL_LIB" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 /nologo /subsystem:windows /dll /pdb:"..\..\..\Run\WWCtrl.pdb" /map:"..\..\..\Run\WWCtrl.map" /debug /machine:I386 /out:"..\..\..\Run\WWCtrl.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "WWCtrl - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /D "WWCTRL_LIB" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 /nologo /subsystem:windows /dll /pdb:"..\..\..\Run\WWCtrlD.pdb" /map:"..\..\..\Run\WWCtrlD.map" /debug /machine:I386 /out:"..\..\..\Run\WWCtrlD.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "WWCtrl - Win32 Profile"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Profile"
# PROP BASE Intermediate_Dir "Profile"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Profile"
# PROP Intermediate_Dir "Profile"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /D "WWCTRL_LIB" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /Zi /O2 /Ob2 /D "NDEBUG" /D "WWDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_AFXEXT" /D "WWCTRL_LIB" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /machine:I386 /out:"bin\WWCtrl.dll"
# ADD LINK32 /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\..\..\Run\WWCtrlP.pdb" /map:"..\..\..\Run\WWCtrlP.map" /debug /machine:I386 /out:"..\..\..\Run\WWCtrlP.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "WWCtrl - Win32 Release"
# Name "WWCtrl - Win32 Debug"
# Name "WWCtrl - Win32 Profile"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ColorBar.cpp
# End Source File
# Begin Source File
SOURCE=.\ColorPicker.cpp
# End Source File
# Begin Source File
SOURCE=.\ColorPickerDialogClass.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\Utils.cpp
# End Source File
# Begin Source File
SOURCE=.\WWCtrl.cpp
# End Source File
# Begin Source File
SOURCE=.\WWCtrl.def
# End Source File
# Begin Source File
SOURCE=.\WWCtrl.rc
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ColorBar.h
# End Source File
# Begin Source File
SOURCE=.\ColorPicker.h
# End Source File
# Begin Source File
SOURCE=.\ColorPickerDialogClass.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\Utils.h
# End Source File
# Begin Source File
SOURCE=.\WWCtrl.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\bitmap1.bmp
# End Source File
# Begin Source File
SOURCE=.\keyframe.bmp
# End Source File
# Begin Source File
SOURCE=.\marker.bmp
# End Source File
# Begin Source File
SOURCE=.\res\WWCtrl.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,73 @@
/*
** Command & Conquer Renegade(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program 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, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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/>.
*/
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : WWCtrl *
* *
* $Archive:: /G/Tools/WWCtrl/WWCtrl.h $*
* *
* Author:: Patrick Smith *
* *
* $Modtime:: 11/10/99 12:31p $*
* *
* $Revision:: 6 $*
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#if defined(_MSC_VER)
#pragma once
#endif
#ifndef __WWCTRL_H
#define __WWCTRL_H
#ifdef WWCTRL_LIB
#define LINKAGE_SPEC __declspec (dllexport)
#else
#define LINKAGE_SPEC
#endif
typedef void (*WWCTRL_COLORCALLBACK)(int,int,int,void*);
//////////////////////////////////////////////////////////////////////
//
// Prototypes
//
//////////////////////////////////////////////////////////////////////
extern "C"
{
LINKAGE_SPEC void Initialize_WWCtrl (void);
LINKAGE_SPEC BOOL Show_Color_Picker (int *red, int *green, int *blue);
LINKAGE_SPEC HWND Create_Color_Picker_Form (HWND parent, int red, int green, int blue);
LINKAGE_SPEC BOOL Get_Form_Color (HWND form_wnd, int *red, int *green, int *blue);
LINKAGE_SPEC BOOL Set_Form_Color (HWND form_wnd, int red, int green, int blue);
LINKAGE_SPEC BOOL Set_Form_Original_Color (HWND form_wnd, int red, int green, int blue);
LINKAGE_SPEC BOOL Set_Update_Callback (HWND form_wnd, WWCTRL_COLORCALLBACK callback, void *arg=NULL);
}
#endif //__WWCTRL_H

267
Code/Tools/WWCtrl/WWCtrl.rc Normal file
View File

@@ -0,0 +1,267 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif\r\n"
"#include ""res\\WWCtrl.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,2
PRODUCTVERSION 1,0,0,2
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "\0"
VALUE "FileDescription", "WWCtrl DLL\0"
VALUE "FileVersion", "1, 0, 0, 2\0"
VALUE "InternalName", "WWCtrl\0"
VALUE "LegalCopyright", "Copyright (C) 1999\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "WWCtrl.DLL\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "WWCtrl Dynamic Link Library\0"
VALUE "ProductVersion", "1, 0, 0, 2\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_COLOR_PICKER DIALOG DISCARDABLE 0, 0, 303, 127
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Color Picker"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "test",IDC_HUE_PICKER,"WWCOLORPICKER",WS_BORDER |
WS_TABSTOP,7,7,105,91
CONTROL "test",IDC_WHITENESS_BAR,"WWCOLORBAR",WS_TABSTOP | 0x34,
117,7,14,91
LTEXT "&Red:",IDC_STATIC,137,10,16,8
CONTROL "test",IDC_RED_BAR,"WWCOLORBAR",WS_TABSTOP | 0x29,162,9,
97,10
EDITTEXT IDC_RED_EDIT,264,7,32,14,ES_NUMBER
CONTROL "Spin1",IDC_RED_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,251,55,11,
14
LTEXT "&Green:",IDC_STATIC,137,27,22,8
CONTROL "test",IDC_GREEN_BAR,"WWCOLORBAR",WS_TABSTOP | 0x29,162,
26,97,10
EDITTEXT IDC_GREEN_EDIT,264,24,32,14,ES_NUMBER
CONTROL "Spin1",IDC_GREEN_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,264,55,11,
14
LTEXT "&Blue:",IDC_STATIC,138,45,17,8
CONTROL "test",IDC_BLUE_BAR,"WWCOLORBAR",WS_TABSTOP | 0x29,162,
43,97,10
EDITTEXT IDC_BLUE_EDIT,264,41,32,14,ES_NUMBER
CONTROL "Spin1",IDC_BLUE_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,278,55,11,
14
DEFPUSHBUTTON "OK",IDOK,57,106,50,14
PUSHBUTTON "Cancel",IDCANCEL,195,106,50,14
CONTROL "test",IDC_ORIG_COLOR_BAR,"WWCOLORBAR",WS_TABSTOP | 0xc,
155,76,55,22
PUSHBUTTON "Reset",IDC_RESET,126,106,50,14
CONTROL "test",IDC_CURRENT_COLOR_BAR,"WWCOLORBAR",WS_TABSTOP |
0xc,222,76,55,22
LTEXT "Original",IDC_STATIC,155,66,24,8
LTEXT "Current",IDC_STATIC,222,66,24,8
END
IDD_COLOR_FORM DIALOG DISCARDABLE 0, 0, 303, 109
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "test",IDC_HUE_PICKER,"WWCOLORPICKER",WS_BORDER |
WS_TABSTOP,7,7,105,91
CONTROL "test",IDC_WHITENESS_BAR,"WWCOLORBAR",WS_TABSTOP | 0x34,
117,7,14,91
LTEXT "&Red:",IDC_STATIC,137,10,16,8
CONTROL "test",IDC_RED_BAR,"WWCOLORBAR",WS_TABSTOP | 0x29,162,9,
97,10
EDITTEXT IDC_RED_EDIT,264,7,32,14,ES_NUMBER
CONTROL "Spin1",IDC_RED_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,28,95,11,
14
LTEXT "&Green:",IDC_STATIC,137,27,22,8
CONTROL "test",IDC_GREEN_BAR,"WWCOLORBAR",WS_TABSTOP | 0x29,162,
26,97,10
EDITTEXT IDC_GREEN_EDIT,264,24,32,14,ES_NUMBER
CONTROL "Spin1",IDC_GREEN_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,41,95,11,
14
LTEXT "&Blue:",IDC_STATIC,138,45,17,8
CONTROL "test",IDC_BLUE_BAR,"WWCOLORBAR",WS_TABSTOP | 0x29,162,
43,97,10
EDITTEXT IDC_BLUE_EDIT,264,41,32,14,ES_NUMBER
CONTROL "Spin1",IDC_BLUE_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,55,95,11,
14
CONTROL "test",IDC_ORIG_COLOR_BAR,"WWCOLORBAR",WS_TABSTOP | 0xc,
159,67,55,22
CONTROL "test",IDC_CURRENT_COLOR_BAR,"WWCOLORBAR",WS_TABSTOP |
0xc,225,67,55,22
LTEXT "Original",IDC_STATIC,159,58,24,8
LTEXT "Current",IDC_STATIC,225,58,24,8
PUSHBUTTON "Reset",IDC_RESET,159,91,121,12
END
IDD_FORMVIEW DIALOG DISCARDABLE 0, 0, 185, 93
STYLE WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "TODO: layout formview",IDC_STATIC,55,42,74,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_COLOR_PICKER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 296
TOPMARGIN, 7
BOTTOMMARGIN, 120
END
IDD_COLOR_FORM, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 296
TOPMARGIN, 7
BOTTOMMARGIN, 102
END
IDD_FORMVIEW, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 178
TOPMARGIN, 7
BOTTOMMARGIN, 86
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_MARKER BITMAP DISCARDABLE "marker.bmp"
IDB_KEYFRAME_V BITMAP DISCARDABLE "keyframe.bmp"
IDB_KEYFRAME_H BITMAP DISCARDABLE "bitmap1.bmp"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif
#include "res\WWCtrl.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View File

@@ -0,0 +1,13 @@
//
// WWCTRL.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,46 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by WWCtrl.rc
//
#define IDCANCEL2 3
#define IDC_RESET 3
#define IDD_FORMVIEW 101
#define IDD_COLOR_PICKER 129
#define IDB_MARKER 130
#define IDD_COLOR_FORM 130
#define IDB_KEYFRAME_V 131
#define IDB_KEYFRAME_H 132
#define IDC_CUSTOM1 1000
#define IDC_HUE_PICKER 1000
#define IDC_CUSTOM2 1001
#define IDC_WHITENESS_BAR 1001
#define IDC_CUSTOM3 1002
#define IDC_RED_BAR 1002
#define IDC_CHECK1 1003
#define IDC_GREEN_BAR 1003
#define IDC_BLUE_BAR 1004
#define IDC_EDIT1 1005
#define IDC_RED_EDIT 1005
#define IDC_EDIT2 1006
#define IDC_GREEN_EDIT 1006
#define IDC_EDIT3 1007
#define IDC_BLUE_EDIT 1007
#define IDC_SPIN1 1008
#define IDC_RED_SPIN 1008
#define IDC_SPIN2 1009
#define IDC_GREEN_SPIN 1009
#define IDC_SPIN3 1010
#define IDC_BLUE_SPIN 1010
#define IDC_ORIG_COLOR_BAR 1011
#define IDC_CURRENT_COLOR_BAR 1012
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 133
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1015
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif