Initial commit of Command & Conquer Generals and Command & Conquer Generals Zero Hour source code.
This commit is contained in:
parent
2e338c00cb
commit
3d0ee53a05
6072 changed files with 2283311 additions and 0 deletions
301
Generals/Code/Tools/GUIEdit/GUIEdit.dsp
Normal file
301
Generals/Code/Tools/GUIEdit/GUIEdit.dsp
Normal file
|
@ -0,0 +1,301 @@
|
|||
# Microsoft Developer Studio Project File - Name="GUIEdit" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=GUIEdit - 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 "GUIEdit.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 "GUIEdit.mak" CFG="GUIEdit - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "GUIEdit - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "GUIEdit - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "GUIEdit - Win32 Internal" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName "GUIEdit"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "GUIEdit - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# 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 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /G6 /MD /W3 /WX /GX /O2 /Ob2 /I ".\Include" /I ".\Resource" /I "..\..\Libraries\Include" /I "..\..\GameEngine\Include" /I "..\..\GameEngineDevice\Include" /I "..\..\Libraries\Source\WWVegas" /I "..\..\Libraries\Source\WWVegas\WWLib" /I "..\..\Libraries\Source\WWVegas\WWMath" /I "..\..\Libraries\Source\WWVegas\WWDebug" /I "..\..\Libraries\Source\WWVegas\WWSaveLoad" /I "..\..\Libraries\Source\WWVegas\WW3D2" /D "_WINDOWS" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_RELEASE" /YX"stdafx.h" /FD /c
|
||||
# SUBTRACT CPP /Fr
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 Benchmark.lib WW3D2.lib WWDebug.lib WWLib.lib WWUtil.lib WWMath.lib GameEngine.lib GameEngineDevice.lib wsock32.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib vfw32.lib winmm.lib dsound.lib comctl32.lib imm32.lib /nologo /subsystem:windows /pdb:"..\..\..\Run\GUIEdit.pdb" /map:"..\..\..\Run\GUIEdit.map" /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\..\..\Run\GUIEdit.exe" /libpath:"..\..\GameEngine\Lib" /libpath:"..\..\GameEngineDevice\Lib" /libpath:"..\..\Libraries\Lib" /libpath:"..\..\GameEngine"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "GUIEdit - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# 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 /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /G6 /MDd /W3 /WX /Gm /GX /ZI /Od /I ".\Include" /I ".\Resource" /I "..\..\Libraries\Include" /I "..\..\GameEngine\Include" /I "..\..\GameEngineDevice\Include" /I "..\..\Libraries\Source\WWVegas" /I "..\..\Libraries\Source\WWVegas\WWLib" /I "..\..\Libraries\Source\WWVegas\WWMath" /I "..\..\Libraries\Source\WWVegas\WWDebug" /I "..\..\Libraries\Source\WWVegas\WWSaveLoad" /I "..\..\Libraries\Source\WWVegas\WW3D2" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# SUBTRACT CPP /Fr
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
|
||||
# ADD LINK32 BenchmarkD.lib WW3D2Debug.lib WWDebugDebug.lib WWUtilDebug.lib WWLibDebug.lib WWMathDebug.lib GameEngineDebug.lib GameEngineDeviceDebug.lib wsock32.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib vfw32.lib winmm.lib dsound.lib comctl32.lib imm32.lib /nologo /subsystem:windows /pdb:"..\..\..\Run\GUIEditD.pdb" /map:"..\..\..\Run\GUIEditD.map" /debug /machine:I386 /nodefaultlib:"libcd" /out:"..\..\..\Run\GUIEditD.exe" /libpath:"..\..\GameEngine\Lib" /libpath:"..\..\GameEngineDevice\Lib" /libpath:"..\..\Libraries\Lib" /libpath:"..\..\GameEngine"
|
||||
|
||||
!ELSEIF "$(CFG)" == "GUIEdit - Win32 Internal"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Internal"
|
||||
# PROP BASE Intermediate_Dir "Internal"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Internal"
|
||||
# PROP Intermediate_Dir "Internal"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /I ".\Include" /I ".\Resource" /I "..\..\Libraries\Include" /I "..\..\GameEngine\Include" /I "..\..\GameEngineDevice\Include" /I "..\..\Libraries\Source\WWVegas" /I "..\..\Libraries\Source\WWVegas\WWLib" /I "..\..\Libraries\Source\WWVegas\WWMath" /I "..\..\Libraries\Source\WWVegas\WWDebug" /I "..\..\Libraries\Source\WWVegas\WWSaveLoad" /I "..\..\Libraries\Source\WWVegas\WW3D2" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /G6 /MD /W3 /WX /GX /O2 /I ".\Include" /I ".\Resource" /I "..\..\Libraries\Include" /I "..\..\GameEngine\Include" /I "..\..\GameEngineDevice\Include" /I "..\..\Libraries\Source\WWVegas" /I "..\..\Libraries\Source\WWVegas\WWLib" /I "..\..\Libraries\Source\WWVegas\WWMath" /I "..\..\Libraries\Source\WWVegas\WWDebug" /I "..\..\Libraries\Source\WWVegas\WWSaveLoad" /I "..\..\Libraries\Source\WWVegas\WW3D2" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_INTERNAL" /YX"stdafx.h" /FD /c
|
||||
# SUBTRACT CPP /Fr
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 WW3D2.lib WWDebug.lib WWLib.lib WWUtil.lib WWMath.lib GameEngine.lib GameEngineDevice.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib vfw32.lib winmm.lib dsound.lib comctl32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /out:"..\..\..\Run\GUIEdit.exe" /libpath:"..\..\GameEngine\Lib" /libpath:"..\..\GameEngineDevice\Lib" /libpath:"..\..\Libraries\Lib" /libpath:"..\..\GameEngine"
|
||||
# ADD LINK32 Benchmark.lib WW3D2Internal.lib WWDebugInternal.lib WWLibInternal.lib WWUtilInternal.lib WWMathInternal.lib GameEngineInternal.lib GameEngineDeviceInternal.lib wsock32.lib dxguid.lib dinput8.lib d3dx8.lib d3d8.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib vfw32.lib winmm.lib dsound.lib comctl32.lib imm32.lib wininet.lib /nologo /subsystem:windows /pdb:"..\..\..\Run\GUIEditI.pdb" /map:"..\..\..\Run\GUIEditI.map" /debug /machine:I386 /nodefaultlib:"libc.lib" /out:"..\..\..\Run\GUIEditI.exe" /libpath:"..\..\GameEngine\Lib" /libpath:"..\..\GameEngineDevice\Lib" /libpath:"..\..\Libraries\Lib" /libpath:"..\..\GameEngine"
|
||||
# SUBTRACT LINK32 /pdb:none /incremental:yes
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "GUIEdit - Win32 Release"
|
||||
# Name "GUIEdit - Win32 Debug"
|
||||
# Name "GUIEdit - Win32 Internal"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Group "Dialog Procedures"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\CallbackEditor.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\CheckBoxProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\ColorDialog.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\ComboBoxProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\GenericProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\GridSettings.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\ListboxProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\NewLayoutDialog.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\ProgressBarProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\PushButtonProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\RadioButtonProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\SliderProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\StaticTextProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\TabControlProperties.cpp"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=".\Source\Dialog Procedures\TextEntryProperties.cpp"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\EditWindow.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\GUIEdit.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\GUIEditDisplay.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\GUIEditWindowManager.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\HierarchyView.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\LayoutScheme.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\Properties.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\Save.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\WinMain.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\DialogProc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\EditWindow.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\GUIEdit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\GUIEditColor.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\GUIEditDisplay.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\GUIEditWindowManager.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\HierarchyView.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\LayoutScheme.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\Properties.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\WinMain.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource\cursor1.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource\GUIEdit.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource\GUIEdit.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource\icon1.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource\small.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
74
Generals/Code/Tools/GUIEdit/Include/DialogProc.h
Normal file
74
Generals/Code/Tools/GUIEdit/Include/DialogProc.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: DialogProc.h /////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: DialogProc.h
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: Header for dialog procedures so we can easily have them
|
||||
// all in one place.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __DIALOGPROC_H_
|
||||
#define __DIALOGPROC_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam );
|
||||
extern BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam );
|
||||
extern BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam );
|
||||
|
||||
#endif // __DIALOGPROC_H_
|
||||
|
208
Generals/Code/Tools/GUIEdit/Include/EditWindow.h
Normal file
208
Generals/Code/Tools/GUIEdit/Include/EditWindow.h
Normal file
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: EditWindow.h /////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: RTS3
|
||||
//
|
||||
// File name: EditWindow.h
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: Main edit window for the GUI editing tool
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __EDITWINDOW_H_
|
||||
#define __EDITWINDOW_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEditColor.h"
|
||||
#include "Lib/BaseType.h"
|
||||
#include "GameClient/Image.h"
|
||||
#include "GameClient/GameWindow.h"
|
||||
#include "WW3D2/AssetMgr.h"
|
||||
#include "WW3D2/Render2D.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// EditWindow -----------------------------------------------------------------
|
||||
/** The edit window singleton definition, this is where we create and
|
||||
* interact with GUI controls for this tool */
|
||||
//-----------------------------------------------------------------------------
|
||||
class EditWindow
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
EditWindow( void );
|
||||
~EditWindow( void );
|
||||
|
||||
/// initialize the edit window singleton
|
||||
void init( UnsignedInt clientWidth, UnsignedInt clientHeight );
|
||||
void shutdown( void ); ///< free all data
|
||||
void draw( void ); ///< draw the edit window
|
||||
|
||||
void updatePulse( void ); ///< pulse message from timer
|
||||
|
||||
HWND getWindowHandle( void ); ///< get window handle
|
||||
void setSize( ICoord2D *size ); ///< set width and height for edit window
|
||||
void getSize( ICoord2D *size ); ///< get width and height for edit window
|
||||
|
||||
RGBColorReal getBackgroundColor( void ); ///< return the background color
|
||||
void setBackgroundColor( RGBColorReal color ); ///< set background color
|
||||
|
||||
void setDragMoveOrigin( ICoord2D *pos ); ///< for drag moving
|
||||
void setDragMoveDest( ICoord2D *pos ); ///< for drag moving
|
||||
ICoord2D getDragMoveOrigin( void ); ///< for keybord moving
|
||||
ICoord2D getDragMoveDest( void ); ///< for keyboard moving
|
||||
|
||||
void notifyWindowDeleted( GameWindow *window ); ///< window has been deleted
|
||||
|
||||
/// mouse event has occurred, button up/down, move etc.
|
||||
void mouseEvent( UnsignedInt windowsMessage, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
void getPopupMenuClickPos( ICoord2D *pos ); ///< get popup menu click loc
|
||||
void openPopupMenu( Int x, Int y ); ///< open floating popup right click menu
|
||||
|
||||
// **************************************************************************
|
||||
|
||||
/// draw a line on the display in screen coordinates
|
||||
void drawLine( Int startX, Int startY, Int endX, Int endY,
|
||||
Real lineWidth, UnsignedInt lineColor );
|
||||
|
||||
/// draw a rect border on the display in pixel coordinates with the specified color
|
||||
void drawOpenRect( Int startX, Int startY, Int width, Int height,
|
||||
Real lineWidth, UnsignedInt lineColor );
|
||||
|
||||
/// draw a filled rect on the display in pixel coords with the specified color
|
||||
void drawFillRect( Int startX, Int startY, Int width, Int height,
|
||||
UnsignedInt color );
|
||||
|
||||
/// draw an image fit within the screen coordinates
|
||||
void drawImage( const Image *image, Int startX, Int startY,
|
||||
Int endX, Int endY, Color color = 0xFFFFFFFF );
|
||||
|
||||
/// image clipping support
|
||||
void setClipRegion( IRegion2D *region ) {m_clipRegion = *region; m_isClippedEnabled = TRUE;}
|
||||
Bool isClippingEnabled( void ) { return m_isClippedEnabled; }
|
||||
void enableClipping( Bool onoff ) { m_isClippedEnabled = onoff; }
|
||||
|
||||
protected:
|
||||
|
||||
void registerEditWindowClass( void ); ///< register class with OS
|
||||
|
||||
/// callback from windows, NOTE that it's static and has no this pointer
|
||||
static LRESULT CALLBACK editProc( HWND hWnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam );
|
||||
|
||||
void drawGrid( void ); ///< draw the grid
|
||||
void drawSeeThruOutlines( GameWindow *windowList, Color c );
|
||||
void drawHiddenOutlines( GameWindow *windowList, Color c );
|
||||
void drawUIFeedback( void ); ///< draw UI visual feedback
|
||||
|
||||
/// if mouse is close to selected window allow resize
|
||||
void handleResizeAvailable( Int mouseX, Int mouseY );
|
||||
|
||||
//
|
||||
// these methods check to see if the mouse is close enough to the
|
||||
// given geometry region (usually for resizing controls)
|
||||
//
|
||||
Bool inCornerTolerance( ICoord2D *dest, ICoord2D *source, Int tolerance );
|
||||
Bool inLineTolerance( ICoord2D *dest, ICoord2D *lineStart, ICoord2D *lineEnd,
|
||||
Int tolerance );
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
static Bool m_classRegistered; ///< TRUE when we've register with OS
|
||||
static char *m_className; ///< name for windows class
|
||||
|
||||
ICoord2D m_size; ///< width and height of edit window
|
||||
UnsignedByte m_bitDepth; ///< bit depth for edit window
|
||||
HWND m_editWindowHWnd; ///< edit window handle
|
||||
|
||||
Int m_pulse; ///< for visual feedback that looks cool!
|
||||
|
||||
RGBColorReal m_backgroundColor; ///< the background color
|
||||
|
||||
Bool m_w3dInitialized; ///< TRUE once W3D is up
|
||||
WW3DAssetManager *m_assetManager; ///< asset manager for WW3D
|
||||
Render2DClass *m_2DRender; ///< our 2D renderer
|
||||
|
||||
ICoord2D m_popupMenuClickPos; ///< position where popup menu was created at
|
||||
GameWindow *m_pickedWindow; ///< picked window from mouse click editing
|
||||
|
||||
ICoord2D m_dragMoveOrigin; ///< mouse click position to start drag move
|
||||
ICoord2D m_dragMoveDest; ///< destination for drag move
|
||||
|
||||
Bool m_dragSelecting; ///< TRUE when drawing a selection box
|
||||
IRegion2D m_selectRegion; ///< region for selection box
|
||||
|
||||
Bool m_resizingWindow; ///< TRUE when drag resizing a window
|
||||
GameWindow *m_windowToResize; ///< the window to resize
|
||||
ICoord2D m_resizeOrigin; ///< mouse clicked down here to drag resize
|
||||
ICoord2D m_resizeDest; ///< mouse pos when dragging around to resize
|
||||
|
||||
IRegion2D m_clipRegion; ///< the clipping region for images
|
||||
Bool m_isClippedEnabled; ///<used by 2D drawing operations to define clip re
|
||||
|
||||
}; // end EditWindow
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
inline HWND EditWindow::getWindowHandle( void ) { return m_editWindowHWnd; }
|
||||
inline void EditWindow::getSize( ICoord2D *size ) { *size = m_size; }
|
||||
inline void EditWindow::getPopupMenuClickPos( ICoord2D *pos ) { *pos = m_popupMenuClickPos; }
|
||||
inline void EditWindow::setDragMoveDest( ICoord2D *pos ) { if( pos ) m_dragMoveDest = *pos; }
|
||||
inline void EditWindow::setDragMoveOrigin( ICoord2D *pos ) { if( pos ) m_dragMoveOrigin = *pos; }
|
||||
inline ICoord2D EditWindow::getDragMoveDest( void ) { return m_dragMoveDest; }
|
||||
inline ICoord2D EditWindow::getDragMoveOrigin( void ) { return m_dragMoveOrigin; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern EditWindow *TheEditWindow; ///< edit window singleton extern
|
||||
|
||||
#endif // __EDITWINDOW_H_
|
||||
|
383
Generals/Code/Tools/GUIEdit/Include/GUIEdit.h
Normal file
383
Generals/Code/Tools/GUIEdit/Include/GUIEdit.h
Normal file
|
@ -0,0 +1,383 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: GUIEdit.h ////////////////////////////////////////////////////////////////////////////////
|
||||
// Created: Colin Day, July 2001
|
||||
// Desc: GUI Edit and window layout entry point
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __GUIEDIT_H_
|
||||
#define __GUIEDIT_H_
|
||||
|
||||
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "GameClient/GameWindow.h"
|
||||
#include "GameClient/WindowLayout.h"
|
||||
#include "GameClient/GameWindowManager.h"
|
||||
#include "GUIEditColor.h"
|
||||
#include "Common/AsciiString.h"
|
||||
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////////////////////////
|
||||
#define GUIEDIT_CONFIG_FILENAME "GUIEdit.cfg"
|
||||
#define GUIEDIT_FONT_FILENAME "GUIEFont.txt"
|
||||
#define GUIEDIT_NONE_STRING "[None]"
|
||||
|
||||
#define STATUS_BAR_ID 1
|
||||
#define TOOLBAR_ID 2
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/** Edit mode states for editor */
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
typedef enum
|
||||
{
|
||||
|
||||
MODE_UNDEFINED = 0, ///< undefined mode
|
||||
MODE_EDIT, ///< normal edit mode
|
||||
MODE_TEST_RUN, ///< test input like ingame
|
||||
MODE_DRAG_MOVE, ///< moving windows with the mouse
|
||||
MODE_RESIZE_TOP_LEFT, ///< resize dragging top left corner
|
||||
MODE_RESIZE_TOP_RIGHT, ///< resize dragging top right cornder
|
||||
MODE_RESIZE_BOTTOM_RIGHT, ///< resize dragging bottom right corner
|
||||
MODE_RESIZE_BOTTOM_LEFT, ///< resize dragging bottom left corner
|
||||
MODE_RESIZE_TOP, ///< resize dragging top horizontal
|
||||
MODE_RESIZE_RIGHT, ///< resize dragging right vertical
|
||||
MODE_RESIZE_BOTTOM, ///< resize dragging bottom horizontal
|
||||
MODE_RESIZE_LEFT, ///< resize dragging left vertical
|
||||
MODE_KEYBOARD_MOVE, ///< moving windows with the Keyboard
|
||||
|
||||
MODE_NUM_MODES ///< keep this last!
|
||||
|
||||
} EditMode;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/** The status bar is this many pieces and we can access them this way */
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
typedef enum
|
||||
{
|
||||
|
||||
STATUS_MODE = 0,
|
||||
STATUS_PART2, /// change to meaningful name when decided what goes here
|
||||
STATUS_PART3, /// change to meaningful name when decided what goes here
|
||||
STATUS_PART4, /// change to meaningful name when decided what goes here
|
||||
STATUS_MOUSE_COORDS,
|
||||
|
||||
STATUS_NUM_PARTS ///< keep this last!
|
||||
|
||||
} StatusPart;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/** Types of pointing cursors */
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
typedef enum
|
||||
{
|
||||
CURSOR_NORMAL,
|
||||
CURSOR_MOVE,
|
||||
CURSOR_SIZE_NESW,
|
||||
CURSOR_SIZE_NS,
|
||||
CURSOR_SIZE_NWSE,
|
||||
CURSOR_SIZE_WE,
|
||||
CURSOR_WAIT,
|
||||
|
||||
CURSOR_NUM_CURSORS // keep last
|
||||
|
||||
} CursorType;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/** These entrys make up the selection list of windows */
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
struct WindowSelectionEntry
|
||||
{
|
||||
|
||||
GameWindow *window; ///< the window
|
||||
WindowSelectionEntry *next;
|
||||
WindowSelectionEntry *prev;
|
||||
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/** Framework for GUI editor data */
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
class GUIEdit
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
GUIEdit( void );
|
||||
~GUIEdit( void );
|
||||
|
||||
void init( void ); ///< initialize data
|
||||
void shutdown( void ); ///< shutdown all our data
|
||||
void update( void ); ///< process the universe
|
||||
|
||||
Bool readConfigFile( char *filename ); ///< read the configuration file
|
||||
Bool writeConfigFile( char *filename ); ///< write the configuration file
|
||||
|
||||
void readFontFile( char *filename ); ///< read file with available font definitions
|
||||
void writeFontFile( char *filename ); ///< write all loaded fonts to a file
|
||||
|
||||
char *getSaveFilename( void );
|
||||
char *getSavePathAndFilename( void );
|
||||
void setSaveFile( char *fullPathAndFilename ); ///< set filename to use for saving
|
||||
|
||||
HWND getWindowHandle( void ); ///< get window handle
|
||||
HINSTANCE getInstance( void ); ///< get application instance
|
||||
HWND getStatusBarWindowHandle( void ); ///< get status bar HWND
|
||||
void createStatusBar( void ); ///< create status bar
|
||||
void statusMessage( StatusPart part, char *message ); ///< set status bar textl
|
||||
void createToolbar( void ); ///< create the toolbar
|
||||
void setCursor( CursorType type ); ///< set cursor
|
||||
|
||||
void setPropertyTarget( GameWindow *window ); ///< set window for property editing
|
||||
GameWindow *getPropertyTarget( void ); ///< get window editing properties
|
||||
|
||||
void loadGUIEditFontLibrary( FontLibrary *library ); ///< fonts available in the editor
|
||||
|
||||
Bool isNameDuplicate( GameWindow *root, GameWindow *ignore, AsciiString name );
|
||||
|
||||
EditMode getMode( void ); ///< return the current mode
|
||||
void setMode( EditMode mode ); ///< set the new mode
|
||||
|
||||
void setUnsaved( Bool unsaved ); ///< set unsaved flag to FALSE or TRUE
|
||||
Bool newLayout( void ); ///< reset editor for new layout
|
||||
|
||||
// grid settings
|
||||
void setGridResolution( Int res );
|
||||
Int getGridResolution( void );
|
||||
void setGridVisible( Bool visible );
|
||||
Bool isGridVisible( void );
|
||||
void setGridSnap( Bool on );
|
||||
Bool isGridSnapOn( void );
|
||||
void setGridColor( RGBColorInt *color );
|
||||
RGBColorInt *getGridColor( void );
|
||||
void gridSnapLocation( ICoord2D *source, ICoord2D *snapped );
|
||||
|
||||
// display options for hidden/see thru windows
|
||||
void setShowHiddenOutlines( Bool show );
|
||||
Bool getShowHiddenOutlines( void );
|
||||
void setShowSeeThruOutlines( Bool show );
|
||||
Bool getShowSeeThruOutlines( void );
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// manipulating windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Bool windowIsGadget( GameWindow *window ); ///< is the window a gadget
|
||||
|
||||
// selection help ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
WindowSelectionEntry *getSelectList( void ); ///< get the selected list head
|
||||
GameWindow *getFirstSelected( void ); ///< get first selected window
|
||||
void moveWindowTo( GameWindow *window, Int x, Int y ); ///< move window
|
||||
Bool isWindowSelected( GameWindow *window ); ///< is window selected
|
||||
void selectWindow( GameWindow *window ); ///< add to selection list
|
||||
void unSelectWindow( GameWindow *window ); ///< remove from selection list
|
||||
void clearSelections( void ); ///< clear selection list
|
||||
Int selectionCount( void ); ///< return # of selected windows
|
||||
void deleteSelected( void ); ///< delete selected windows
|
||||
void bringSelectedToTop( void ); ///< bring selected windows to top
|
||||
/// select the windows that are FULLY in the region specified
|
||||
void selectWindowsInRegion( IRegion2D *region );
|
||||
|
||||
// resizing/moving help ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
void dragMoveSelectedWindows( ICoord2D *dragOrigin, ICoord2D *dragDest ); ///< move windows via drag move
|
||||
/// given a position to move a window to, keep it onscreen and inside parent
|
||||
void computeSafeLocation( GameWindow *window, Int x, Int y,
|
||||
Int *safeX, Int *safeY );
|
||||
/// given position and size to move a window to, keep it inside parent and on screen
|
||||
void computeSafeSizeLocation( GameWindow *window,
|
||||
Int newX, Int newY,
|
||||
Int newWidth, Int newHeight,
|
||||
Int *safeX, Int *safeY,
|
||||
Int *safeWidth, Int *safeHeight );
|
||||
/// compute new size of window using drag-resize logic
|
||||
void computeResizeLocation( EditMode resizeMode,
|
||||
GameWindow *window,
|
||||
ICoord2D *resizeOrigin,
|
||||
ICoord2D *resizeDest,
|
||||
ICoord2D *resultLoc,
|
||||
ICoord2D *resultSize );
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// creating new windows and controls ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/** this is called after a window is added to the editor, the window may
|
||||
contain children so this might be recursively called from inside */
|
||||
void notifyNewWindow( GameWindow *window );
|
||||
|
||||
GameWindow *getWindowAtPos( Int x, Int y ); ///< get topmost window at pos
|
||||
|
||||
void deleteAllWindows( void ); ///< delete all windows in the editor
|
||||
void removeWindowCleanup( GameWindow *window ); ///< to cleanup before delete
|
||||
void deleteWindow( GameWindow *window ); ///< delete a game window
|
||||
|
||||
/** when creating child windows we don't want them to exist outside the
|
||||
parent so we use this to clip them to the the parent size and locations */
|
||||
void clipCreationParamsToParent( GameWindow *parent,
|
||||
Int *x, Int *y, Int *width, Int *height );
|
||||
|
||||
GameWindow *newWindow( UnsignedInt windowStyle,
|
||||
GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newUserWindow( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newPushButton( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newCheckBox( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newRadioButton( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newTabControl( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newHorizontalSlider( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newVerticalSlider( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newProgressBar( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newListbox( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newTextEntry( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newStaticText( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
GameWindow *newComboBox( GameWindow *parent,
|
||||
Int x, Int y,
|
||||
Int width, Int height );
|
||||
|
||||
// menu options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Bool menuNew( void ); ///< start a new layout process
|
||||
Bool menuOpen( void ); ///< hit open on menu
|
||||
void stripNameDecorations( GameWindow *root ); ///< after a load
|
||||
void revertDefaultCallbacks( GameWindow *root ); ///< after a load
|
||||
Bool menuSave( void ); ///< hit save on menu
|
||||
Bool menuSaveAs( void ); ///< hit save as on menu
|
||||
Bool menuExit( void ); ///< exit application
|
||||
Bool menuCopy( void ); ///< copy selected windows into copy buffer
|
||||
Bool menuPaste( void ); ///< paste contents of copy buffer
|
||||
Bool menuCut( void ); ///< cut selected windows into copy buffer
|
||||
void checkMenuItem( Int item );
|
||||
void unCheckMenuItem( Int item );
|
||||
|
||||
// global layout functions callbacks ------------------------------------------------------------
|
||||
void setLayoutInit( AsciiString init ); ///< set layout init function name
|
||||
void setLayoutUpdate( AsciiString update ); ///< set layout update function name
|
||||
void setLayoutShutdown( AsciiString shutdown ); ///< set layout shutdown function name
|
||||
AsciiString getLayoutInit( void ); ///< get layout init function name
|
||||
AsciiString getLayoutUpdate( void ); ///< get layout update function name
|
||||
AsciiString getLayoutShutdown( void ); ///< get layout shutdown function name
|
||||
|
||||
protected:
|
||||
|
||||
char *saveAsDialog( void ); ///< save as standard browser
|
||||
char *openDialog( void ); ///< open standard browser
|
||||
|
||||
void validateNames( GameWindow *root, char *filename, Bool *valid );
|
||||
void updateRadioScreenIdentifiers( GameWindow *window, Int screenID );
|
||||
Bool saveData( char *filePathAndFilename, char *filename ); ///< save data to file in filePath
|
||||
|
||||
Bool validateParentForCreate( GameWindow *parent ); ///< validate parent OK
|
||||
|
||||
/// normalize a region so that lo and hi are really lo and hi
|
||||
void normalizeRegion( IRegion2D *region );
|
||||
|
||||
/// find selection entry associated with this window
|
||||
WindowSelectionEntry *findSelectionEntry( GameWindow *window );
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
HINSTANCE m_appInst; ///< main application hInstance
|
||||
HWND m_appHWnd; ///< main application hWnd
|
||||
HWND m_statusBarHWnd; ///< status bar window handle
|
||||
HWND m_toolbarHWnd; ///< toolbar window handle
|
||||
|
||||
EditMode m_mode; ///< the current editor "mode"
|
||||
Bool m_unsaved; ///< TRUE when contents are unsaved
|
||||
|
||||
char m_savePathAndFilename[ _MAX_PATH ]; ///< full path and filename to file
|
||||
char m_saveFilename[ _MAX_PATH ]; ///< filename only with extension
|
||||
|
||||
WindowSelectionEntry *m_selectList; ///< list of "selected" windows
|
||||
GameWindow *m_propertyTarget; ///< the window to edit properties on
|
||||
|
||||
Bool m_gridVisible; ///< TRUE when grid is visible
|
||||
Int m_gridResolution; ///< pixels between the grid marks
|
||||
Bool m_snapToGrid; ///< TRUE when it's on
|
||||
RGBColorInt m_gridColor; ///< the grid draw color
|
||||
|
||||
Bool m_showHiddenOutlines; ///< show outlines around hidden windows
|
||||
Bool m_showSeeThruOutlines; ///< show outliens around see-thru windows
|
||||
|
||||
AsciiString m_layoutInitString; ///< layout initi function name
|
||||
AsciiString m_layoutUpdateString; ///< layout update function name
|
||||
AsciiString m_layoutShutdownString;///< layout shutdown function name
|
||||
|
||||
}; // end GUIEdit
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////////////////////////
|
||||
inline HWND GUIEdit::getWindowHandle( void ) { return m_appHWnd; }
|
||||
inline HINSTANCE GUIEdit::getInstance( void ) { return m_appInst; }
|
||||
inline HWND GUIEdit::getStatusBarWindowHandle( void ) { return m_statusBarHWnd; }
|
||||
inline EditMode GUIEdit::getMode( void ) { return m_mode; }
|
||||
inline void GUIEdit::setPropertyTarget( GameWindow *window ) { m_propertyTarget = window; }
|
||||
inline GameWindow *GUIEdit::getPropertyTarget( void ) { return m_propertyTarget; }
|
||||
inline char *GUIEdit::getSaveFilename( void ) { return m_saveFilename; }
|
||||
inline char *GUIEdit::getSavePathAndFilename( void ) { return m_savePathAndFilename; }
|
||||
inline void GUIEdit::setGridResolution( Int res ) { m_gridResolution = res; }
|
||||
inline Int GUIEdit::getGridResolution( void ) { return m_gridResolution; }
|
||||
inline void GUIEdit::setGridVisible( Bool visible ) { m_gridVisible = visible; }
|
||||
inline Bool GUIEdit::isGridVisible( void ) { return m_gridVisible; }
|
||||
inline void GUIEdit::setGridSnap( Bool on ) { m_snapToGrid = on; }
|
||||
inline Bool GUIEdit::isGridSnapOn( void ) { return m_snapToGrid; }
|
||||
inline void GUIEdit::setGridColor( RGBColorInt *color ) { m_gridColor = *color; }
|
||||
inline RGBColorInt *GUIEdit::getGridColor( void ) { return &m_gridColor; }
|
||||
inline Bool GUIEdit::getShowHiddenOutlines( void ) { return m_showHiddenOutlines; }
|
||||
inline Bool GUIEdit::getShowSeeThruOutlines( void ) { return m_showSeeThruOutlines; }
|
||||
inline void GUIEdit::setLayoutInit( AsciiString init ) { m_layoutInitString = init; }
|
||||
inline void GUIEdit::setLayoutUpdate( AsciiString update ) { m_layoutUpdateString = update; }
|
||||
inline void GUIEdit::setLayoutShutdown( AsciiString shutdown ) { m_layoutShutdownString = shutdown; }
|
||||
inline AsciiString GUIEdit::getLayoutInit( void ) { return m_layoutInitString; }
|
||||
inline AsciiString GUIEdit::getLayoutUpdate( void ) { return m_layoutUpdateString; }
|
||||
inline AsciiString GUIEdit::getLayoutShutdown( void ) { return m_layoutShutdownString; }
|
||||
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
|
||||
extern GUIEdit *TheEditor; ///< editor application singleton
|
||||
|
||||
#endif // __GUIEDIT_H_
|
||||
|
101
Generals/Code/Tools/GUIEdit/Include/GUIEditColor.h
Normal file
101
Generals/Code/Tools/GUIEdit/Include/GUIEditColor.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: GUIEditColor.h ///////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: GUIEditColor.h
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: Color structures for the editor
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __GUIEDITCOLOR_H_
|
||||
#define __GUIEDITCOLOR_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// RGBColorInt ----------------------------------------------------------------
|
||||
/** Integer color representation */
|
||||
//-----------------------------------------------------------------------------
|
||||
struct RGBColorInt
|
||||
{
|
||||
Int red;
|
||||
Int green;
|
||||
Int blue;
|
||||
Int alpha;
|
||||
}; // end RGBColorInt
|
||||
|
||||
// RGBColorReal ---------------------------------------------------------------
|
||||
/** Colors using 0.0 to 1.0 reals */
|
||||
//-----------------------------------------------------------------------------
|
||||
struct RGBColorReal
|
||||
{
|
||||
Real red;
|
||||
Real green;
|
||||
Real blue;
|
||||
Real alpha;
|
||||
}; // end RGBColorReal
|
||||
|
||||
// HSVColorReal ---------------------------------------------------------------
|
||||
/** Colors using hue, saturation, value using 0.0 to 1.0 reals */
|
||||
//-----------------------------------------------------------------------------
|
||||
struct HSVColorReal
|
||||
{
|
||||
Real hue;
|
||||
Real saturation;
|
||||
Real value;
|
||||
Real alpha;
|
||||
}; // end HSVReal
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
extern RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha,
|
||||
Int mouseX = 0, Int mouseY = 0 );
|
||||
|
||||
#endif // __GUIEDITCOLOR_H_
|
||||
|
140
Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h
Normal file
140
Generals/Code/Tools/GUIEdit/Include/GUIEditDisplay.h
Normal file
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: GUIEditDisplay.h /////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: RTS3
|
||||
//
|
||||
// File name: GUIEditDisplay.h
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: Display implementation for the GUI edit tool
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __GUIEDITDISPLAY_H_
|
||||
#define __GUIEDITDISPLAY_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GameClient/Display.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
class VideoBuffer;
|
||||
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
|
||||
// GUIEditDisplay -------------------------------------------------------------
|
||||
/** Stripped down display for the GUI tool editor */
|
||||
//-----------------------------------------------------------------------------
|
||||
class GUIEditDisplay : public Display
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
GUIEditDisplay( void );
|
||||
virtual ~GUIEditDisplay( void );
|
||||
|
||||
virtual void draw( void ) { };
|
||||
|
||||
/// draw a line on the display in pixel coordinates with the specified color
|
||||
virtual void drawLine( Int startX, Int startY, Int endX, Int endY,
|
||||
Real lineWidth, UnsignedInt lineColor );
|
||||
virtual void drawLine( Int startX, Int startY, Int endX, Int endY,
|
||||
Real lineWidth, UnsignedInt lineColor1, UnsignedInt lineColor2 ) { }
|
||||
/// draw a rect border on the display in pixel coordinates with the specified color
|
||||
virtual void drawOpenRect( Int startX, Int startY, Int width, Int height,
|
||||
Real lineWidth, UnsignedInt lineColor );
|
||||
/// draw a filled rect on the display in pixel coords with the specified color
|
||||
virtual void drawFillRect( Int startX, Int startY, Int width, Int height,
|
||||
UnsignedInt color );
|
||||
|
||||
/// Draw a percentage of a rectange, much like a clock
|
||||
virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { }
|
||||
virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) { }
|
||||
|
||||
/// draw an image fit within the screen coordinates
|
||||
virtual void drawImage( const Image *image, Int startX, Int startY,
|
||||
Int endX, Int endY, Color color = 0xFFFFFFFF, DrawImageMode mode=DRAW_IMAGE_ALPHA);
|
||||
/// image clipping support
|
||||
virtual void setClipRegion( IRegion2D *region );
|
||||
virtual Bool isClippingEnabled( void );
|
||||
virtual void enableClipping( Bool onoff );
|
||||
|
||||
// These are stub functions to allow compilation:
|
||||
|
||||
/// Create a video buffer that can be used for this display
|
||||
virtual VideoBuffer* createVideoBuffer( void ) { return NULL; }
|
||||
|
||||
/// draw a video buffer fit within the screen coordinates
|
||||
virtual void drawVideoBuffer( VideoBuffer *buffer, Int startX, Int startY,
|
||||
Int endX, Int endY ) { }
|
||||
virtual void takeScreenShot(void){ }
|
||||
virtual void toggleMovieCapture(void) {}
|
||||
|
||||
// methods that we need to stub
|
||||
virtual void setTimeOfDay( TimeOfDay tod ) {}
|
||||
virtual void createLightPulse( const Coord3D *pos, const RGBColor *color, Real innerRadius, Real attenuationWidth,
|
||||
UnsignedInt increaseFrameTime, UnsignedInt decayFrameTime ) {}
|
||||
virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting) {}
|
||||
void setBorderShroudLevel(UnsignedByte level){}
|
||||
virtual void clearShroud() {}
|
||||
virtual void preloadModelAssets( AsciiString model ) {}
|
||||
virtual void preloadTextureAssets( AsciiString texture ) {}
|
||||
virtual void toggleLetterBox(void) {}
|
||||
virtual void enableLetterBox(Bool enable) {}
|
||||
#if defined(_DEBUG) || defined(_INTERNAL)
|
||||
virtual void dumpModelAssets(const char *path) {}
|
||||
#endif
|
||||
virtual void doSmartAssetPurgeAndPreload(const char* usageFileName) {}
|
||||
#if defined(_DEBUG) || defined(_INTERNAL)
|
||||
virtual void dumpAssetUsage(const char* mapname) {}
|
||||
#endif
|
||||
|
||||
virtual Real getAverageFPS(void) { return 0; }
|
||||
virtual Int getLastFrameDrawCalls( void ) { return 0; }
|
||||
|
||||
protected:
|
||||
|
||||
}; // end GUIEditDisplay
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // __GUIEDITDISPLAY_H_
|
||||
|
119
Generals/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h
Normal file
119
Generals/Code/Tools/GUIEdit/Include/GUIEditWindowManager.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: GUIEditWindowManager.h ///////////////////////////////////////////////////////////////////
|
||||
// Created: Colin Day, July 2001
|
||||
// Desc: Window manager for the GUI edit tool, we want this up
|
||||
// fast and to look like what we use in the game so we're going
|
||||
// to use the WW3D window manager, and just override the
|
||||
// drawing functions to draw lines and images to the
|
||||
// display. We will also be adding our own functionality
|
||||
// here for editing and interacting with the GUI windows.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __GUIEDITWINDOWMANAGER_H_
|
||||
#define __GUIEDITWINDOWMANAGER_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "W3DDevice/GameClient/W3DGameWindowManager.h"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/** GUI edit interface for window manager */
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
class GUIEditWindowManager : public W3DGameWindowManager
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
GUIEditWindowManager( void );
|
||||
virtual ~GUIEditWindowManager( void );
|
||||
|
||||
virtual void init( void ); ///< initialize system
|
||||
|
||||
virtual Int winDestroy( GameWindow *window ); ///< destroy this window
|
||||
/// create a new window by setting up parameters and callbacks
|
||||
virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status,
|
||||
Int x, Int y, Int width, Int height,
|
||||
GameWinSystemFunc system,
|
||||
WinInstanceData *instData = NULL );
|
||||
|
||||
// **************************************************************************
|
||||
// GUIEdit specific methods *************************************************
|
||||
// **************************************************************************
|
||||
|
||||
/** unlink the window to move and place it ahead of the target window
|
||||
in the master chain or the child chain */
|
||||
void moveAheadOf( GameWindow *windowToMove, GameWindow *aheadOf );
|
||||
/// make target a child of the parent
|
||||
void makeChildOf( GameWindow *target, GameWindow *parent );
|
||||
|
||||
void validateClipboardNames( GameWindow *root ); ///< ensure unique names
|
||||
void incrementName( GameWindow *window ); ///< make a new unique name
|
||||
void resetClipboard( void ); ///< reset the clipboard to empty
|
||||
Bool isClipboardEmpty( void ); ///< is the clipboard empty
|
||||
void duplicateSelected( GameWindow *root ); ///< dupe the selected windows into the clipboard
|
||||
void copySelectedToClipboard( void ); ///< copy selected windows to clipboard
|
||||
void cutSelectedToClipboard( void ); ///< cut selected windows to clipboard
|
||||
void pasteClipboard( void ); ///< paste the contents of the clipboard
|
||||
|
||||
GameWindow *getClipboardList( void ); ///< get the clipboard list
|
||||
GameWindow *getClipboardDupeList( void ); ///< get clipboard dupe list
|
||||
|
||||
protected:
|
||||
|
||||
/** validate window is part of the clipboard at the top level */
|
||||
Bool isWindowInClipboard( GameWindow *window, GameWindow **list );
|
||||
void linkToClipboard( GameWindow *window, GameWindow **list ); ///< add window to clipboard
|
||||
void unlinkFromClipboard( GameWindow *window, GameWindow **list ); ///< remove window from clipboard
|
||||
|
||||
/** remove selected children from the select list that have a parent
|
||||
also in the select list */
|
||||
void removeSupervisedChildSelections( void );
|
||||
/** selected windows that are children will cut loose their parents
|
||||
and become adults (their parent will be NULL, otherwise the screen) */
|
||||
// void orphanSelectedChildren( void );
|
||||
|
||||
/// dupe a window and its children
|
||||
GameWindow *duplicateWindow( GameWindow *source, GameWindow *parent );
|
||||
void createClipboardDuplicate( void ); ///< duplicate the clipboard on the dup list
|
||||
|
||||
GameWindow *m_clipboard; ///< list of windows in the clipboard
|
||||
GameWindow *m_clipboardDup; ///< list duplicate of the clipboard used for pasting
|
||||
|
||||
Int m_copySpacing; ///< keeps multiple pastes from being on top of each other
|
||||
Int m_numCopiesPasted; ///< keeps multiple pastes from being on top of each other
|
||||
|
||||
};
|
||||
|
||||
// INLINE /////////////////////////////////////////////////////////////////////////////////////////
|
||||
inline GameWindow *GUIEditWindowManager::getClipboardList( void ) { return m_clipboard; }
|
||||
inline GameWindow *GUIEditWindowManager::getClipboardDupeList( void ) { return m_clipboardDup; }
|
||||
|
||||
// EXTERN /////////////////////////////////////////////////////////////////////////////////////////
|
||||
extern GUIEditWindowManager *TheGUIEditWindowManager; ///< editor use only
|
||||
|
||||
#endif // __GUIEDITWINDOWMANAGER_H_
|
||||
|
157
Generals/Code/Tools/GUIEdit/Include/HierarchyView.h
Normal file
157
Generals/Code/Tools/GUIEdit/Include/HierarchyView.h
Normal file
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: HierarchyView.h //////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: HierarchyView.h
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: Manipulation the widows heirarchy through the tree
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __HIERARCHYVIEW_H_
|
||||
#define __HIERARCHYVIEW_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Lib/BaseType.h"
|
||||
#include "GameClient/GameWindow.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// HierarchyOption ------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef enum
|
||||
{
|
||||
|
||||
HIERARCHY_ADD_AT_TOP,
|
||||
HIERARCHY_ADD_AT_BOTTOM,
|
||||
|
||||
} HierarchyOption;
|
||||
|
||||
// HierarchyView --------------------------------------------------------------
|
||||
/** This view allows users to manipulate the windows hierarchy using
|
||||
* a tree view control */
|
||||
//-----------------------------------------------------------------------------
|
||||
class HierarchyView
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
HierarchyView( void );
|
||||
~HierarchyView( void );
|
||||
|
||||
void init( void );
|
||||
void reset( void );
|
||||
void shutdown( void );
|
||||
|
||||
char *getWindowTreeName( GameWindow *window );
|
||||
void addWindow( GameWindow *window, HierarchyOption option ); ///< add a window to the view
|
||||
void removeWindow( GameWindow *window ); ///< remove window from tree
|
||||
void bringWindowToTop( GameWindow *window ); ///< bring window to top of parent list
|
||||
void updateWindowName( GameWindow *window ); ///< update tree entry based on name
|
||||
void selectWindow( GameWindow *window ); ///< select window
|
||||
|
||||
HWND getTreeHandle( void ); ///< get the tree control handle
|
||||
HWND getHierarchyHandle( void ); ///< get window handle for the whole dialog
|
||||
|
||||
void setDialogPos( ICoord2D *pos );
|
||||
void getDialogPos( ICoord2D *pos );
|
||||
void setDialogSize( ICoord2D *size );
|
||||
void getDialogSize( ICoord2D *size );
|
||||
|
||||
void setDragWindow( GameWindow *window );
|
||||
void setDragTarget( GameWindow *window );
|
||||
GameWindow *getDragWindow( void );
|
||||
GameWindow *getDragTarget( void );
|
||||
void moveWindowAheadOf( GameWindow *window, GameWindow *aheadOf ); ///< move hierarchy representation
|
||||
void moveWindowChildOf( GameWindow *window, GameWindow *parent ); ///< move hierarchy representation
|
||||
|
||||
Bool validateDragDropOperation( GameWindow *source, GameWindow *target );
|
||||
|
||||
void setPopupTarget( GameWindow *window ); ///< set target for popup menu
|
||||
GameWindow *getPopupTarget( void ); ///< get the popup target window
|
||||
|
||||
HTREEITEM treePointToItem( Int x, Int y ); ///< translate mouse pos to item location
|
||||
GameWindow *getWindowFromItem( HTREEITEM treeItem ); ///< get game window from user data in the tree item
|
||||
|
||||
protected:
|
||||
|
||||
static LRESULT CALLBACK dialogProc( HWND hWndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam );
|
||||
|
||||
void addWindowToTree( GameWindow *window, HTREEITEM treeParent,
|
||||
HierarchyOption option, Bool addChildren,
|
||||
Bool addSiblings ); ///< workhorse for addWindow()
|
||||
HTREEITEM findItemEntry( HTREEITEM node, GameWindow *window ); ///< workhorse for findTreeEntry
|
||||
HTREEITEM findTreeEntry( GameWindow *window ); ///< return entry if in tree
|
||||
|
||||
HWND m_dialog; ///< window handle for our control dialog
|
||||
HWND m_tree; ///< window handle for the tree control
|
||||
|
||||
GameWindow *m_dragWindow; ///< for drag drop operations
|
||||
GameWindow *m_dragTarget; ///< target for drag and drop operations while mouse is moving
|
||||
GameWindow *m_popupTarget; ///< the target for right mouse popup menus
|
||||
|
||||
}; // end HierarchyView
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
inline HWND HierarchyView::getTreeHandle( void ) { return m_tree; }
|
||||
inline HWND HierarchyView::getHierarchyHandle( void ) { return m_dialog; }
|
||||
inline void HierarchyView::setDragWindow( GameWindow *window ) { m_dragWindow = window; }
|
||||
inline void HierarchyView::setDragTarget( GameWindow *window ) { m_dragTarget = window; }
|
||||
inline GameWindow *HierarchyView::getDragWindow( void ) { return m_dragWindow; }
|
||||
inline GameWindow *HierarchyView::getDragTarget( void ) { return m_dragTarget; }
|
||||
inline void HierarchyView::setPopupTarget( GameWindow *window ) { m_popupTarget = window; }
|
||||
inline GameWindow *HierarchyView::getPopupTarget( void ) { return m_popupTarget; }
|
||||
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
extern HierarchyView *TheHierarchyView; ///< singleton for our view
|
||||
|
||||
#endif // __CONTROLPALETTE_H_
|
||||
|
152
Generals/Code/Tools/GUIEdit/Include/LayoutScheme.h
Normal file
152
Generals/Code/Tools/GUIEdit/Include/LayoutScheme.h
Normal file
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: LayoutScheme.h ///////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: LayoutScheme.h
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Layout scheme editing and loading
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __LAYOUTSCHEME_H_
|
||||
#define __LAYOUTSCHEME_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Lib/BaseType.h"
|
||||
#include "Properties.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// LayoutScheme ---------------------------------------------------------------
|
||||
/** The layout scheme provides a place for default look of newly
|
||||
* created controls and windows */
|
||||
//-----------------------------------------------------------------------------
|
||||
class LayoutScheme
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
LayoutScheme();
|
||||
~LayoutScheme();
|
||||
|
||||
void init( void );
|
||||
|
||||
void openDialog( void ); ///< open the scheme info and editing dialog
|
||||
|
||||
char *getSchemeFilename( void ); ///< get the scheme filename
|
||||
void setSchemeFilename( char *filename ); ///< set the scheme filename
|
||||
|
||||
Bool saveScheme( char *filename ); ///< save the current scheme to file
|
||||
Bool loadScheme( char *filename ); ///< load the scheme file
|
||||
|
||||
ImageAndColorInfo *getImageAndColor( StateIdentifier id );
|
||||
void storeImageAndColor( StateIdentifier id, const Image *image,
|
||||
Color color, Color borderColor );
|
||||
|
||||
void setFont( GameFont *font );
|
||||
GameFont *getFont( void );
|
||||
|
||||
Color getEnabledTextColor( void );
|
||||
Color getEnabledTextBorderColor( void );
|
||||
Color getDisabledTextColor( void );
|
||||
Color getDisabledTextBorderColor( void );
|
||||
Color getHiliteTextColor( void );
|
||||
Color getHiliteTextBorderColor( void );
|
||||
void setEnabledTextColor( Color c );
|
||||
void setEnabledTextBorderColor( Color c );
|
||||
void setDisabledTextColor( Color c );
|
||||
void setDisabledTextBorderColor( Color c );
|
||||
void setHiliteTextColor( Color c );
|
||||
void setHiliteTextBorderColor( Color c );
|
||||
|
||||
/** apply the image and color info stored in the state identifer tables
|
||||
used for "property editing" to all appropriate windows currently
|
||||
loaded in the editor */
|
||||
void applyPropertyTablesToWindow( GameWindow *root );
|
||||
|
||||
protected:
|
||||
|
||||
ImageAndColorInfo *findEntry( StateIdentifier id );
|
||||
|
||||
char m_schemeFilename[ _MAX_PATH ]; ///< filename
|
||||
|
||||
ImageAndColorInfo m_imageAndColorTable[ NUM_STATE_IDENTIFIERS ]; // the color and image info
|
||||
TextDrawData m_enabledText; ///< default text colors
|
||||
TextDrawData m_disabledText; ///< default text colors
|
||||
TextDrawData m_hiliteText; ///< default text colors
|
||||
|
||||
GameFont *m_font; ///< default font
|
||||
|
||||
}; // end LayoutScheme
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
inline char *LayoutScheme::getSchemeFilename( void ) { return m_schemeFilename; }
|
||||
inline void LayoutScheme::setSchemeFilename( char *filename ) { strcpy( m_schemeFilename, filename ); }
|
||||
inline Color LayoutScheme::getEnabledTextColor( void ) { return m_enabledText.color; }
|
||||
inline Color LayoutScheme::getEnabledTextBorderColor( void ) { return m_enabledText.borderColor; }
|
||||
inline Color LayoutScheme::getDisabledTextColor( void ) { return m_disabledText.color; }
|
||||
inline Color LayoutScheme::getDisabledTextBorderColor( void ) { return m_disabledText.borderColor; }
|
||||
inline Color LayoutScheme::getHiliteTextColor( void ) { return m_hiliteText.color; }
|
||||
inline Color LayoutScheme::getHiliteTextBorderColor( void ) { return m_hiliteText.borderColor; }
|
||||
inline void LayoutScheme::setEnabledTextColor( Color c ) { m_enabledText.color = c; }
|
||||
inline void LayoutScheme::setEnabledTextBorderColor( Color c ) { m_enabledText.borderColor = c; }
|
||||
inline void LayoutScheme::setDisabledTextColor( Color c ) { m_disabledText.color = c; }
|
||||
inline void LayoutScheme::setDisabledTextBorderColor( Color c ) { m_disabledText.borderColor = c; }
|
||||
inline void LayoutScheme::setHiliteTextColor( Color c ) { m_hiliteText.color = c; }
|
||||
inline void LayoutScheme::setHiliteTextBorderColor( Color c ) { m_hiliteText.borderColor = c; }
|
||||
inline void LayoutScheme::setFont( GameFont *font ) { m_font = font; }
|
||||
inline GameFont *LayoutScheme::getFont( void ) { return m_font; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern LayoutScheme *TheDefaultScheme;
|
||||
|
||||
#endif // end __LAYOUTSCHEME_H_
|
||||
|
429
Generals/Code/Tools/GUIEdit/Include/Properties.h
Normal file
429
Generals/Code/Tools/GUIEdit/Include/Properties.h
Normal file
|
@ -0,0 +1,429 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: Properties.h /////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: Properties.h
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Header for bringing up property dialogs for windows and
|
||||
// window gadgets.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __PROPERTIES_H_
|
||||
#define __PROPERTIES_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GameClient/GameWindow.h"
|
||||
#include "GUIEditColor.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ColorControl ---------------------------------------------------------------
|
||||
/** This makes it easier for us to associate colors with dialog
|
||||
* control ID's for purposes of custom color buttons */
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ColorControl
|
||||
{
|
||||
|
||||
UnsignedInt controlID; ///< controlID from resource file
|
||||
RGBColorInt color; ///< the color for this controlID
|
||||
|
||||
};
|
||||
|
||||
// StateIdentifiers -----------------------------------------------------------
|
||||
/** These state identifiers link to image and color info entries */
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef enum
|
||||
{
|
||||
|
||||
IDENTIFIER_INVALID = 0, // keep this 0 and keep it first
|
||||
|
||||
FIRST_VALID_IDENTIFIER = 1,
|
||||
|
||||
BUTTON_ENABLED = FIRST_VALID_IDENTIFIER,
|
||||
BUTTON_ENABLED_PUSHED,
|
||||
BUTTON_DISABLED,
|
||||
BUTTON_DISABLED_PUSHED,
|
||||
BUTTON_HILITE,
|
||||
BUTTON_HILITE_PUSHED,
|
||||
|
||||
RADIO_ENABLED,
|
||||
RADIO_ENABLED_UNCHECKED_BOX,
|
||||
RADIO_ENABLED_CHECKED_BOX,
|
||||
RADIO_DISABLED,
|
||||
RADIO_DISABLED_UNCHECKED_BOX,
|
||||
RADIO_DISABLED_CHECKED_BOX,
|
||||
RADIO_HILITE,
|
||||
RADIO_HILITE_UNCHECKED_BOX,
|
||||
RADIO_HILITE_CHECKED_BOX,
|
||||
|
||||
CHECK_BOX_ENABLED,
|
||||
CHECK_BOX_ENABLED_UNCHECKED_BOX,
|
||||
CHECK_BOX_ENABLED_CHECKED_BOX,
|
||||
CHECK_BOX_DISABLED,
|
||||
CHECK_BOX_DISABLED_UNCHECKED_BOX,
|
||||
CHECK_BOX_DISABLED_CHECKED_BOX,
|
||||
CHECK_BOX_HILITE,
|
||||
CHECK_BOX_HILITE_UNCHECKED_BOX,
|
||||
CHECK_BOX_HILITE_CHECKED_BOX,
|
||||
|
||||
COMBOBOX_ENABLED,
|
||||
COMBOBOX_ENABLED_SELECTED_ITEM_LEFT,
|
||||
COMBOBOX_ENABLED_SELECTED_ITEM_RIGHT,
|
||||
COMBOBOX_ENABLED_SELECTED_ITEM_CENTER,
|
||||
COMBOBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER,
|
||||
COMBOBOX_DISABLED,
|
||||
COMBOBOX_DISABLED_SELECTED_ITEM_LEFT,
|
||||
COMBOBOX_DISABLED_SELECTED_ITEM_RIGHT,
|
||||
COMBOBOX_DISABLED_SELECTED_ITEM_CENTER,
|
||||
COMBOBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER,
|
||||
COMBOBOX_HILITE,
|
||||
COMBOBOX_HILITE_SELECTED_ITEM_LEFT,
|
||||
COMBOBOX_HILITE_SELECTED_ITEM_RIGHT,
|
||||
COMBOBOX_HILITE_SELECTED_ITEM_CENTER,
|
||||
COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER,
|
||||
COMBOBOX_DROP_DOWN_BUTTON_ENABLED,
|
||||
COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED,
|
||||
COMBOBOX_DROP_DOWN_BUTTON_DISABLED,
|
||||
COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED,
|
||||
COMBOBOX_DROP_DOWN_BUTTON_HILITE,
|
||||
COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED,
|
||||
COMBOBOX_EDIT_BOX_ENABLED_LEFT,
|
||||
COMBOBOX_EDIT_BOX_ENABLED_RIGHT,
|
||||
COMBOBOX_EDIT_BOX_ENABLED_CENTER,
|
||||
COMBOBOX_EDIT_BOX_ENABLED_SMALL_CENTER,
|
||||
COMBOBOX_EDIT_BOX_DISABLED_LEFT,
|
||||
COMBOBOX_EDIT_BOX_DISABLED_RIGHT,
|
||||
COMBOBOX_EDIT_BOX_DISABLED_CENTER,
|
||||
COMBOBOX_EDIT_BOX_DISABLED_SMALL_CENTER,
|
||||
COMBOBOX_EDIT_BOX_HILITE_LEFT,
|
||||
COMBOBOX_EDIT_BOX_HILITE_RIGHT,
|
||||
COMBOBOX_EDIT_BOX_HILITE_CENTER,
|
||||
COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER,
|
||||
COMBOBOX_LISTBOX_ENABLED,
|
||||
COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT,
|
||||
COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_RIGHT,
|
||||
COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_CENTER,
|
||||
COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER,
|
||||
COMBOBOX_LISTBOX_DISABLED,
|
||||
COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT,
|
||||
COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_RIGHT,
|
||||
COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_CENTER,
|
||||
COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER,
|
||||
COMBOBOX_LISTBOX_HILITE,
|
||||
COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT,
|
||||
COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_RIGHT,
|
||||
COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_CENTER,
|
||||
COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER,
|
||||
COMBOBOX_LISTBOX_UP_BUTTON_ENABLED,
|
||||
COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED,
|
||||
COMBOBOX_LISTBOX_UP_BUTTON_DISABLED,
|
||||
COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED,
|
||||
COMBOBOX_LISTBOX_UP_BUTTON_HILITE,
|
||||
COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED,
|
||||
COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED,
|
||||
COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED,
|
||||
COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED,
|
||||
COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED,
|
||||
COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE,
|
||||
COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED,
|
||||
COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP,
|
||||
COMBOBOX_LISTBOX_SLIDER_ENABLED_BOTTOM,
|
||||
COMBOBOX_LISTBOX_SLIDER_ENABLED_CENTER,
|
||||
COMBOBOX_LISTBOX_SLIDER_ENABLED_SMALL_CENTER,
|
||||
COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP,
|
||||
COMBOBOX_LISTBOX_SLIDER_DISABLED_BOTTOM,
|
||||
COMBOBOX_LISTBOX_SLIDER_DISABLED_CENTER,
|
||||
COMBOBOX_LISTBOX_SLIDER_DISABLED_SMALL_CENTER,
|
||||
COMBOBOX_LISTBOX_SLIDER_HILITE_TOP,
|
||||
COMBOBOX_LISTBOX_SLIDER_HILITE_BOTTOM,
|
||||
COMBOBOX_LISTBOX_SLIDER_HILITE_CENTER,
|
||||
COMBOBOX_LISTBOX_SLIDER_HILITE_SMALL_CENTER,
|
||||
COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED,
|
||||
COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED,
|
||||
COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED,
|
||||
COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED,
|
||||
COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE,
|
||||
COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED,
|
||||
|
||||
VSLIDER_ENABLED_TOP,
|
||||
VSLIDER_ENABLED_BOTTOM,
|
||||
VSLIDER_ENABLED_CENTER,
|
||||
VSLIDER_ENABLED_SMALL_CENTER,
|
||||
VSLIDER_DISABLED_TOP,
|
||||
VSLIDER_DISABLED_BOTTOM,
|
||||
VSLIDER_DISABLED_CENTER,
|
||||
VSLIDER_DISABLED_SMALL_CENTER,
|
||||
VSLIDER_HILITE_TOP,
|
||||
VSLIDER_HILITE_BOTTOM,
|
||||
VSLIDER_HILITE_CENTER,
|
||||
VSLIDER_HILITE_SMALL_CENTER,
|
||||
VSLIDER_THUMB_ENABLED,
|
||||
VSLIDER_THUMB_ENABLED_PUSHED,
|
||||
VSLIDER_THUMB_DISABLED,
|
||||
VSLIDER_THUMB_DISABLED_PUSHED,
|
||||
VSLIDER_THUMB_HILITE,
|
||||
VSLIDER_THUMB_HILITE_PUSHED,
|
||||
|
||||
HSLIDER_ENABLED_LEFT,
|
||||
HSLIDER_ENABLED_RIGHT,
|
||||
HSLIDER_ENABLED_CENTER,
|
||||
HSLIDER_ENABLED_SMALL_CENTER,
|
||||
HSLIDER_DISABLED_LEFT,
|
||||
HSLIDER_DISABLED_RIGHT,
|
||||
HSLIDER_DISABLED_CENTER,
|
||||
HSLIDER_DISABLED_SMALL_CENTER,
|
||||
HSLIDER_HILITE_LEFT,
|
||||
HSLIDER_HILITE_RIGHT,
|
||||
HSLIDER_HILITE_CENTER,
|
||||
HSLIDER_HILITE_SMALL_CENTER,
|
||||
HSLIDER_THUMB_ENABLED,
|
||||
HSLIDER_THUMB_ENABLED_PUSHED,
|
||||
HSLIDER_THUMB_DISABLED,
|
||||
HSLIDER_THUMB_DISABLED_PUSHED,
|
||||
HSLIDER_THUMB_HILITE,
|
||||
HSLIDER_THUMB_HILITE_PUSHED,
|
||||
|
||||
LISTBOX_ENABLED,
|
||||
LISTBOX_ENABLED_SELECTED_ITEM_LEFT,
|
||||
LISTBOX_ENABLED_SELECTED_ITEM_RIGHT,
|
||||
LISTBOX_ENABLED_SELECTED_ITEM_CENTER,
|
||||
LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER,
|
||||
LISTBOX_DISABLED,
|
||||
LISTBOX_DISABLED_SELECTED_ITEM_LEFT,
|
||||
LISTBOX_DISABLED_SELECTED_ITEM_RIGHT,
|
||||
LISTBOX_DISABLED_SELECTED_ITEM_CENTER,
|
||||
LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER,
|
||||
LISTBOX_HILITE,
|
||||
LISTBOX_HILITE_SELECTED_ITEM_LEFT,
|
||||
LISTBOX_HILITE_SELECTED_ITEM_RIGHT,
|
||||
LISTBOX_HILITE_SELECTED_ITEM_CENTER,
|
||||
LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER,
|
||||
LISTBOX_UP_BUTTON_ENABLED,
|
||||
LISTBOX_UP_BUTTON_ENABLED_PUSHED,
|
||||
LISTBOX_UP_BUTTON_DISABLED,
|
||||
LISTBOX_UP_BUTTON_DISABLED_PUSHED,
|
||||
LISTBOX_UP_BUTTON_HILITE,
|
||||
LISTBOX_UP_BUTTON_HILITE_PUSHED,
|
||||
LISTBOX_DOWN_BUTTON_ENABLED,
|
||||
LISTBOX_DOWN_BUTTON_ENABLED_PUSHED,
|
||||
LISTBOX_DOWN_BUTTON_DISABLED,
|
||||
LISTBOX_DOWN_BUTTON_DISABLED_PUSHED,
|
||||
LISTBOX_DOWN_BUTTON_HILITE,
|
||||
LISTBOX_DOWN_BUTTON_HILITE_PUSHED,
|
||||
LISTBOX_SLIDER_ENABLED_TOP,
|
||||
LISTBOX_SLIDER_ENABLED_BOTTOM,
|
||||
LISTBOX_SLIDER_ENABLED_CENTER,
|
||||
LISTBOX_SLIDER_ENABLED_SMALL_CENTER,
|
||||
LISTBOX_SLIDER_DISABLED_TOP,
|
||||
LISTBOX_SLIDER_DISABLED_BOTTOM,
|
||||
LISTBOX_SLIDER_DISABLED_CENTER,
|
||||
LISTBOX_SLIDER_DISABLED_SMALL_CENTER,
|
||||
LISTBOX_SLIDER_HILITE_TOP,
|
||||
LISTBOX_SLIDER_HILITE_BOTTOM,
|
||||
LISTBOX_SLIDER_HILITE_CENTER,
|
||||
LISTBOX_SLIDER_HILITE_SMALL_CENTER,
|
||||
LISTBOX_SLIDER_THUMB_ENABLED,
|
||||
LISTBOX_SLIDER_THUMB_ENABLED_PUSHED,
|
||||
LISTBOX_SLIDER_THUMB_DISABLED,
|
||||
LISTBOX_SLIDER_THUMB_DISABLED_PUSHED,
|
||||
LISTBOX_SLIDER_THUMB_HILITE,
|
||||
LISTBOX_SLIDER_THUMB_HILITE_PUSHED,
|
||||
|
||||
PROGRESS_BAR_ENABLED_LEFT,
|
||||
PROGRESS_BAR_ENABLED_RIGHT,
|
||||
PROGRESS_BAR_ENABLED_CENTER,
|
||||
PROGRESS_BAR_ENABLED_SMALL_CENTER,
|
||||
PROGRESS_BAR_ENABLED_BAR_LEFT,
|
||||
PROGRESS_BAR_ENABLED_BAR_RIGHT,
|
||||
PROGRESS_BAR_ENABLED_BAR_CENTER,
|
||||
PROGRESS_BAR_ENABLED_BAR_SMALL_CENTER,
|
||||
PROGRESS_BAR_DISABLED_LEFT,
|
||||
PROGRESS_BAR_DISABLED_RIGHT,
|
||||
PROGRESS_BAR_DISABLED_CENTER,
|
||||
PROGRESS_BAR_DISABLED_SMALL_CENTER,
|
||||
PROGRESS_BAR_DISABLED_BAR_LEFT,
|
||||
PROGRESS_BAR_DISABLED_BAR_RIGHT,
|
||||
PROGRESS_BAR_DISABLED_BAR_CENTER,
|
||||
PROGRESS_BAR_DISABLED_BAR_SMALL_CENTER,
|
||||
PROGRESS_BAR_HILITE_LEFT,
|
||||
PROGRESS_BAR_HILITE_RIGHT,
|
||||
PROGRESS_BAR_HILITE_CENTER,
|
||||
PROGRESS_BAR_HILITE_SMALL_CENTER,
|
||||
PROGRESS_BAR_HILITE_BAR_LEFT,
|
||||
PROGRESS_BAR_HILITE_BAR_RIGHT,
|
||||
PROGRESS_BAR_HILITE_BAR_CENTER,
|
||||
PROGRESS_BAR_HILITE_BAR_SMALL_CENTER,
|
||||
|
||||
STATIC_TEXT_ENABLED,
|
||||
STATIC_TEXT_DISABLED,
|
||||
STATIC_TEXT_HILITE,
|
||||
|
||||
TEXT_ENTRY_ENABLED_LEFT,
|
||||
TEXT_ENTRY_ENABLED_RIGHT,
|
||||
TEXT_ENTRY_ENABLED_CENTER,
|
||||
TEXT_ENTRY_ENABLED_SMALL_CENTER,
|
||||
TEXT_ENTRY_DISABLED_LEFT,
|
||||
TEXT_ENTRY_DISABLED_RIGHT,
|
||||
TEXT_ENTRY_DISABLED_CENTER,
|
||||
TEXT_ENTRY_DISABLED_SMALL_CENTER,
|
||||
TEXT_ENTRY_HILITE_LEFT,
|
||||
TEXT_ENTRY_HILITE_RIGHT,
|
||||
TEXT_ENTRY_HILITE_CENTER,
|
||||
TEXT_ENTRY_HILITE_SMALL_CENTER,
|
||||
|
||||
TC_TAB_0_ENABLED,
|
||||
TC_TAB_0_DISABLED,
|
||||
TC_TAB_0_HILITE,
|
||||
TC_TAB_1_ENABLED,
|
||||
TC_TAB_1_DISABLED,
|
||||
TC_TAB_1_HILITE,
|
||||
TC_TAB_2_ENABLED,
|
||||
TC_TAB_2_DISABLED,
|
||||
TC_TAB_2_HILITE,
|
||||
TC_TAB_3_ENABLED,
|
||||
TC_TAB_3_DISABLED,
|
||||
TC_TAB_3_HILITE,
|
||||
TC_TAB_4_ENABLED,
|
||||
TC_TAB_4_DISABLED,
|
||||
TC_TAB_4_HILITE,
|
||||
TC_TAB_5_ENABLED,
|
||||
TC_TAB_5_DISABLED,
|
||||
TC_TAB_5_HILITE,
|
||||
TC_TAB_6_ENABLED,
|
||||
TC_TAB_6_DISABLED,
|
||||
TC_TAB_6_HILITE,
|
||||
TC_TAB_7_ENABLED,
|
||||
TC_TAB_7_DISABLED,
|
||||
TC_TAB_7_HILITE,
|
||||
TAB_CONTROL_ENABLED,
|
||||
TAB_CONTROL_DISABLED,
|
||||
TAB_CONTROL_HILITE,
|
||||
|
||||
GENERIC_ENABLED,
|
||||
GENERIC_DISABLED,
|
||||
GENERIC_HILITE,
|
||||
|
||||
NUM_STATE_IDENTIFIERS // keep this last
|
||||
|
||||
} StateIdentifier;
|
||||
|
||||
// ImageAndColorInfo ----------------------------------------------------------
|
||||
/** This is a place for us to store image and color information for
|
||||
* all the various states for each of the controls, it makes it easier
|
||||
* for us cause we can just put and get queries in this table and
|
||||
* work with only one set of dialog controls on all the property
|
||||
* dialog windows */
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ImageAndColorInfo
|
||||
{
|
||||
|
||||
UnsignedInt windowType; ///< this entry applies to these kind of windows
|
||||
StateIdentifier stateID; ///< state identifier
|
||||
char *stateName; ///< string state name that this affects
|
||||
const Image *image; ///< the image for this entry
|
||||
Color color; ///< color for this entry
|
||||
Color borderColor; ///< border color for this entry
|
||||
|
||||
};
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern void InitPropertiesDialog( GameWindow *window, Int x, Int y );
|
||||
|
||||
extern HWND InitPushButtonPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitRadioButtonPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitCheckBoxPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitListboxPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitComboBoxPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitProgressBarPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitTabControlPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitStaticTextPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitTextEntryPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitSliderPropertiesDialog( GameWindow *window );
|
||||
extern HWND InitUserWinPropertiesDialog( GameWindow *window );
|
||||
|
||||
// these functions help us in managing the dialog "engine"
|
||||
extern Bool HandleCommonDialogMessages( HWND hWndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam,
|
||||
Int *returnCode );
|
||||
extern void CommonDialogInitialize( GameWindow *window, HWND dialog );
|
||||
extern void LoadImageListComboBox( HWND comboBox );
|
||||
extern void LoadHeaderTemplateListComboBox( HWND comboBox, AsciiString selected );
|
||||
extern const Image *ComboBoxSelectionToImage( HWND comboBox );
|
||||
extern RGBColorInt *GetControlColor( UnsignedInt controlID );
|
||||
extern void SetControlColor( UnsignedInt controlID, Color color );
|
||||
extern void PositionWindowOnScreen( HWND window, Int x, Int y );
|
||||
extern Bool SaveCommonDialogProperties( HWND dialog, GameWindow *window );
|
||||
extern void LoadStateCombo( UnsignedInt style, HWND comboBox );
|
||||
extern void LoadTextStateCombo( HWND comboBox,
|
||||
Color enabled, Color enabledBorder,
|
||||
Color disabled, Color disabledBorder,
|
||||
Color hilite, Color hiliteBorder );
|
||||
extern void InitCallbackCombos( HWND dialog, GameWindow *window );
|
||||
extern void SaveCallbacks( GameWindow *window, HWND dialog );
|
||||
|
||||
extern ImageAndColorInfo *GetStateInfo( StateIdentifier id );
|
||||
extern ImageAndColorInfo *GetCurrentStateInfo( HWND dialog );
|
||||
void SwitchToState( StateIdentifier id, HWND dialog );
|
||||
extern void StoreImageAndColor( StateIdentifier id, const Image *image,
|
||||
Color color, Color borderColor );
|
||||
extern void StoreColor( StateIdentifier id, Color color, Color borderColor );
|
||||
extern void LoadFontCombo( HWND comboBox, GameFont *currFont );
|
||||
extern GameFont *GetSelectedFontFromCombo( HWND combo );
|
||||
|
||||
extern Color GetPropsEnabledTextColor( void );
|
||||
extern Color GetPropsEnabledTextBorderColor( void );
|
||||
extern Color GetPropsDisabledTextColor( void );
|
||||
extern Color GetPropsDisabledTextBorderColor( void );
|
||||
extern Color GetPropsHiliteTextColor( void );
|
||||
extern Color GetPropsHiliteTextBorderColor( void );
|
||||
|
||||
#endif // __PROPERTIES_H_
|
||||
|
70
Generals/Code/Tools/GUIEdit/Include/WinMain.h
Normal file
70
Generals/Code/Tools/GUIEdit/Include/WinMain.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: WinMain.h ////////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: RTS3
|
||||
//
|
||||
// File name: WinMain.h
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: WinMain header for GUIEdit
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WINMAIN_H_
|
||||
#define __WINMAIN_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Win32Device/GameClient/Win32Mouse.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
#define TIMER_EDIT_WINDOW_PULSE 1
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
extern HWND ApplicationHWnd; ///< application main window handle
|
||||
extern HINSTANCE ApplicationHInstance; ///< application main instance handle
|
||||
extern Win32Mouse *TheWin32Mouse; ///< the mouse for win processing
|
||||
|
||||
#endif // __WINMAIN_H_
|
||||
|
BIN
Generals/Code/Tools/GUIEdit/Resource/GUIEdit.ico
Normal file
BIN
Generals/Code/Tools/GUIEdit/Resource/GUIEdit.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
1441
Generals/Code/Tools/GUIEdit/Resource/GUIEdit.rc
Normal file
1441
Generals/Code/Tools/GUIEdit/Resource/GUIEdit.rc
Normal file
File diff suppressed because it is too large
Load diff
205
Generals/Code/Tools/GUIEdit/Resource/resource.h
Normal file
205
Generals/Code/Tools/GUIEdit/Resource/resource.h
Normal file
|
@ -0,0 +1,205 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by GUIEdit.rc
|
||||
//
|
||||
#define IDC_MYICON 2
|
||||
#define IDOK2 3
|
||||
#define IDCANCEL2 4
|
||||
#define IDD_GUIEDIT_DIALOG 102
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDS_APP_TITLE 103
|
||||
#define ABOUT_DIALOG 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDS_HELLO 106
|
||||
#define IDI_GUIEDIT 107
|
||||
#define GUIEDIT_LARGE_ICON 107
|
||||
#define IDI_SMALL 108
|
||||
#define GUIEDIT_SMALL_ICON 108
|
||||
#define IDC_GUIEDIT 109
|
||||
#define GUIEDIT_MENU 109
|
||||
#define GUIEDIT_ACCELERATORS 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define HIERARCHY_DIALOG 131
|
||||
#define NEW_LAYOUT_DIALOG 132
|
||||
#define POPUP_MENU 133
|
||||
#define GENERIC_PROPERTIES_DIALOG 135
|
||||
#define COLOR_SELECT_DIALOG 136
|
||||
#define PUSH_BUTTON_PROPERTIES_DIALOG 137
|
||||
#define RADIO_BUTTON_PROPERTIES_DIALOG 138
|
||||
#define CHECK_BOX_PROPERTIES_DIALOG 139
|
||||
#define SLIDER_PROPERTIES_DIALOG 140
|
||||
#define LISTBOX_PROPERTIES_DIALOG 141
|
||||
#define PROGRESS_BAR_PROPERTIES_DIALOG 143
|
||||
#define STATIC_TEXT_PROPERTIES_DIALOG 144
|
||||
#define TEXT_ENTRY_PROPERTIES_DIALOG 145
|
||||
#define GRID_SETTINGS_DIALOG 147
|
||||
#define HIERARCHY_POPUP_MENU 149
|
||||
#define LAYOUT_SCHEME_DIALOG 150
|
||||
#define HIERARCHY_DRAG_DROP_MENU 151
|
||||
#define CALLBACK_EDITOR_DIALOG 152
|
||||
#define TAB_CONTROL_PROPERTIES_DIALOG 153
|
||||
#define COMBO_BOX_PROPERTIES_DIALOG 154
|
||||
#define CHECK_SEE_THRU 1004
|
||||
#define CHECK_DRAGABLE 1005
|
||||
#define CHECK_ENABLED 1006
|
||||
#define CHECK_HIDDEN 1007
|
||||
#define CHECK_NO_INPUT 1008
|
||||
#define CHECK_NO_FOCUS 1009
|
||||
#define CHECK_BORDER 1010
|
||||
#define COMBO_ENABLED_IMAGE 1011
|
||||
#define CHECK_CHECK_LIKE 1011
|
||||
#define BUTTON_ENABLED_COLOR 1012
|
||||
#define CHECK_WRAP_CENTERED3 1012
|
||||
#define BUTTON_ENABLED_BORDER_COLOR 1013
|
||||
#define CHECK_IMAGE 1014
|
||||
#define BUTTON_TEXT_COLOR 1015
|
||||
#define BUTTON_TEXT_BORDER_COLOR 1016
|
||||
#define COMBO_DISABLED_IMAGE 1017
|
||||
#define BUTTON_DISABLED_COLOR 1018
|
||||
#define BUTTON_DISABLED_BORDER_COLOR 1019
|
||||
#define COMBO_HILITE_IMAGE 1020
|
||||
#define BUTTON_HILITE_COLOR 1021
|
||||
#define BUTTON_HILITE_BORDER_COLOR 1022
|
||||
#define CHECK_WRAP_CENTERED2 1023
|
||||
#define CHECK_IMAGE2 1024
|
||||
#define COMBO_STATE 1026
|
||||
#define BUTTON_COLOR 1027
|
||||
#define BUTTON_BORDER_COLOR 1028
|
||||
#define COMBO_IMAGE 1029
|
||||
#define COMBO_TEXT_STATE 1030
|
||||
#define CHECK_AUTO_SCROLL 1031
|
||||
#define CHECK_AUTO_PURGE 1032
|
||||
#define CHECK_HAS_SCROLLBAR 1033
|
||||
#define CHECK_MULTI_SELECT 1034
|
||||
#define CHECK_FORCE_SELECT 1035
|
||||
#define CHECK_IS_EDITABLE 1036
|
||||
#define CHECK_NO_WORDWRAP 1036
|
||||
#define EDIT_MAX_ITEMS 1037
|
||||
#define EDIT_SLIDER_MIN 1038
|
||||
#define EDIT_SLIDER_MAX 1039
|
||||
#define BUTTON_CENTERED 1041
|
||||
#define CHECK_SECRET_TEXT 1042
|
||||
#define RADIO_LETTERS_AND_NUMBERS 1043
|
||||
#define EDIT_MAX_CHARS 1044
|
||||
#define RADIO_NUMBERS 1045
|
||||
#define TAB_HEIGHT 1045
|
||||
#define TAB_COUNT 1046
|
||||
#define BORDER_WIDTH 1047
|
||||
#define RADIO_ANY_TEXT 1048
|
||||
#define ACTIVE_TAB 1048
|
||||
#define CHECK_ASCII_TEXT 1049
|
||||
#define EDIT_NAME 1050
|
||||
#define EDIT_RESOLUTION 1051
|
||||
#define CHECK_LETTERS_AND_NUMBERS 1051
|
||||
#define RADIO_DOTS 1052
|
||||
#define RADIO_LINES 1053
|
||||
#define CHECK_VISIBLE 1054
|
||||
#define CHECK_SNAP_TO_GRID 1055
|
||||
#define STATIC_NAME_MAX 1056
|
||||
#define COMBO_FONT 1057
|
||||
#define EDIT_TEXT_LABEL 1058
|
||||
#define TREE_HIERARCHY 1059
|
||||
#define EDIT_TOOLTIP_TEXT 1059
|
||||
#define COMBO_HEADER2 1060
|
||||
#define COMBO_GROUP 1061
|
||||
#define BUTTON_SUBCONTROL_COLOR 1064
|
||||
#define BUTTON_LOAD 1065
|
||||
#define BUTTON_SAVE 1066
|
||||
#define STATIC_CURRENT_SCHEME 1067
|
||||
#define BUTTON_APPLY_SCHEME 1070
|
||||
#define COMBO_SYSTEM 1071
|
||||
#define LIST_WINDOWS 1072
|
||||
#define STATIC_WINDOW 1073
|
||||
#define COMBO_INIT 1074
|
||||
#define CENTER_JUSTIFY 1075
|
||||
#define COMBO_INPUT 1076
|
||||
#define LEFT_SIDE 1077
|
||||
#define COMBO_SHUTDOWN 1078
|
||||
#define TOP_SIDE 1079
|
||||
#define BOTTOM_SIDE 1080
|
||||
#define TAB_WIDTH 1081
|
||||
#define DISABLE_TAB_0 1083
|
||||
#define DISABLE_TAB_1 1084
|
||||
#define DISABLE_TAB_2 1085
|
||||
#define DISABLE_TAB_3 1086
|
||||
#define DISABLE_TAB_4 1087
|
||||
#define DISABLE_TAB_5 1088
|
||||
#define DISABLE_TAB_6 1089
|
||||
#define DISABLE_TAB_7 1090
|
||||
#define SCROLL_COLOR1 1136
|
||||
#define SCROLL_COLOR2 1137
|
||||
#define SCROLL_COLOR3 1138
|
||||
#define LABEL_COLOR3 1139
|
||||
#define LABEL_COLOR2 1140
|
||||
#define LABEL_COLOR1 1141
|
||||
#define LABEL_ALPHA 1142
|
||||
#define SCROLL_ALPHA 1143
|
||||
#define BUTTON_RGB_HSV 1164
|
||||
#define BUTTON_COLORBAR1 1165
|
||||
#define BUTTON_PREVIEW 1167
|
||||
#define BUTTON_COLORBAR2 1168
|
||||
#define BUTTON_COLORBAR3 1169
|
||||
#define CHECK_RIGHT_CLICK 1170
|
||||
#define CHECK_WRAP_CENTERED 1171
|
||||
#define EDIT_NUM_COLUMNS 1172
|
||||
#define BUTTON_CLEAR_GROUP 1173
|
||||
#define EDIT_COLUMN_PERCENT 1174
|
||||
#define LEFT_JUSTIFY 1175
|
||||
#define COMBO_TOOLTIP 1176
|
||||
#define RIGHT_JUSTIFY 1177
|
||||
#define COMBO_DRAW 1178
|
||||
#define RIGHT_SIDE 1179
|
||||
#define COMBO_UPDATE 1180
|
||||
#define EDIT_MAX_ITEMS_DISPLAYED 1181
|
||||
#define EDIT_TOOLTIP_DELAY 1182
|
||||
#define COMBO_HEADER 1183
|
||||
#define CHECK_SCROLL_IF_AT_END 1184
|
||||
#define MENU_ABOUT 32771
|
||||
#define POPUP_MENU_NEW_WINDOW 32776
|
||||
#define POPUP_MENU_NEW_PUSH_BUTTON 32777
|
||||
#define POPUP_MENU_NEW_RADIO_BUTTON 32778
|
||||
#define POPUP_MENU_NEW_CHECK_BOX 32779
|
||||
#define POPUP_MENU_NEW_LISTBOX 32780
|
||||
#define POPUP_MENU_NEW_HORIZONTAL_SLIDER 32781
|
||||
#define POPUP_MENU_NEW_VERTICAL_SLIDER 32782
|
||||
#define POPUP_MENU_NEW_TEXT_ENTRY 32783
|
||||
#define POPUP_MENU_NEW_STATIC_TEXT 32784
|
||||
#define POPUP_MENU_PROPERTIES 32785
|
||||
#define POPUP_MENU_NEW_PROGRESS_BAR 32786
|
||||
#define POPUP_MENU_DELETE 32789
|
||||
#define POPUP_MENU_BRING_TO_TOP 32790
|
||||
#define MENU_BACKGROUND_COLOR 32791
|
||||
#define MENU_NEW 32792
|
||||
#define MENU_OPEN 32793
|
||||
#define MENU_SAVE 32794
|
||||
#define MENU_SAVEAS 32795
|
||||
#define MENU_EXIT 32796
|
||||
#define MENU_GRID_SETTINGS 32797
|
||||
#define MENU_TEST_MODE 32798
|
||||
#define MENU_COPY 32799
|
||||
#define MENU_CUT 32800
|
||||
#define MENU_PASTE 32801
|
||||
#define HIERARCHY_POPUP_MOVE 32802
|
||||
#define HIERARCHY_POPUP_DELETE 32803
|
||||
#define HIERARCHY_POPUP_PROPERTIES 32804
|
||||
#define MENU_SHOW_HIDDEN_OUTLINES 32805
|
||||
#define MENU_SHOW_SEE_THRU_OUTLINES 32806
|
||||
#define MENU_SCHEME 32807
|
||||
#define MENU_HIERARCHY_MOVE_HERE 32808
|
||||
#define HIERARCHY_MAKE_CHILD_HERE 32809
|
||||
#define MENU_CALLBACKS 32810
|
||||
#define POPUP_MENU_NEW_TAB_CONTROL 32811
|
||||
#define POPUP_MENU_NEW_COMBO_BOX 32812
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 155
|
||||
#define _APS_NEXT_COMMAND_VALUE 32813
|
||||
#define _APS_NEXT_CONTROL_VALUE 1185
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
BIN
Generals/Code/Tools/GUIEdit/Resource/small.ico
Normal file
BIN
Generals/Code/Tools/GUIEdit/Resource/small.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
|
@ -0,0 +1,390 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: CallbackEditor.cpp ///////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: CallbackEditor.cpp
|
||||
//
|
||||
// Created: Colin Day, Sepember 2001
|
||||
//
|
||||
// Desc: A handy dandy little dialog to just edit the callbacks for
|
||||
// user windows ... a super convient luxury at a bargain price!
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Common/Debug.h"
|
||||
#include "Common/FunctionLexicon.h"
|
||||
#include "GameClient/Gadget.h"
|
||||
#include "GameClient/GameWindowManager.h"
|
||||
#include "GUIEdit.h"
|
||||
#include "Resource.h"
|
||||
#include "Properties.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static char *noNameWindowString = "Un-named Window";
|
||||
static GameWindow *currentWindow = NULL; ///< current window we're editing
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SaveCallbacks ==============================================================
|
||||
/** save the current callbacks for the selected window */
|
||||
void SaveCallbacks( GameWindow *window, HWND dialog )
|
||||
{
|
||||
|
||||
// sanity
|
||||
if( window == NULL || dialog == NULL )
|
||||
return;
|
||||
|
||||
// get edit data for window
|
||||
GameWindowEditData *editData = window->winGetEditData();
|
||||
DEBUG_ASSERTCRASH( editData, ("No edit data for window saving callbacks!\n") );
|
||||
|
||||
// get the currently selected item from each of the combos and save
|
||||
Int index;
|
||||
char buffer[ 256 ];
|
||||
|
||||
// system
|
||||
index = SendDlgItemMessage( dialog, COMBO_SYSTEM, CB_GETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( dialog, COMBO_SYSTEM, CB_GETLBTEXT, index, (LPARAM)buffer );
|
||||
editData->systemCallbackString = buffer;
|
||||
|
||||
// input
|
||||
index = SendDlgItemMessage( dialog, COMBO_INPUT, CB_GETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( dialog, COMBO_INPUT, CB_GETLBTEXT, index, (LPARAM)buffer );
|
||||
editData->inputCallbackString = buffer;
|
||||
|
||||
// tooltip
|
||||
index = SendDlgItemMessage( dialog, COMBO_TOOLTIP, CB_GETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( dialog, COMBO_TOOLTIP, CB_GETLBTEXT, index, (LPARAM)buffer );
|
||||
editData->tooltipCallbackString = buffer;
|
||||
|
||||
// draw
|
||||
index = SendDlgItemMessage( dialog, COMBO_DRAW, CB_GETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( dialog, COMBO_DRAW, CB_GETLBTEXT, index, (LPARAM)buffer );
|
||||
editData->drawCallbackString = buffer;
|
||||
|
||||
// if there was a window we have a change
|
||||
if( window )
|
||||
TheEditor->setUnsaved( TRUE );
|
||||
|
||||
} // end SaveCallbacks
|
||||
|
||||
// setCurrentWindow ===========================================================
|
||||
/** Set the window passed in as the active window for editing */
|
||||
//=============================================================================
|
||||
static void setCurrentWindow( GameWindow *window, HWND dialog )
|
||||
{
|
||||
GameWindowEditData *editData = NULL;
|
||||
|
||||
// get edit data from window if present
|
||||
if( window )
|
||||
editData = window->winGetEditData();
|
||||
|
||||
// save window
|
||||
currentWindow = window;
|
||||
|
||||
// sanity
|
||||
if( dialog == NULL )
|
||||
return;
|
||||
|
||||
// enable the callback combo boxes
|
||||
EnableWindow( GetDlgItem( dialog, COMBO_SYSTEM ), TRUE );
|
||||
EnableWindow( GetDlgItem( dialog, COMBO_INPUT ), TRUE );
|
||||
EnableWindow( GetDlgItem( dialog, COMBO_TOOLTIP ), TRUE );
|
||||
EnableWindow( GetDlgItem( dialog, COMBO_DRAW ), TRUE );
|
||||
|
||||
//
|
||||
// select the assigned callbacks, if no callback is assigned
|
||||
// in a slot then we select the "none string" for the combo box
|
||||
//
|
||||
AsciiString name;
|
||||
|
||||
// system
|
||||
if( editData )
|
||||
name = editData->systemCallbackString;
|
||||
if( name.isEmpty() )
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
SendDlgItemMessage( dialog, COMBO_SYSTEM,
|
||||
CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
// input
|
||||
name = NULL;
|
||||
if( editData )
|
||||
name = editData->inputCallbackString;
|
||||
if( name.isEmpty() )
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
SendDlgItemMessage( dialog, COMBO_INPUT,
|
||||
CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
// tooltip
|
||||
name = NULL;
|
||||
if( editData )
|
||||
name = editData->tooltipCallbackString;
|
||||
if( name.isEmpty() )
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
SendDlgItemMessage( dialog, COMBO_TOOLTIP,
|
||||
CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
// draw
|
||||
name = NULL;
|
||||
if( editData )
|
||||
name = editData->drawCallbackString;
|
||||
if( name.isEmpty() )
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
SendDlgItemMessage( dialog, COMBO_DRAW,
|
||||
CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
//
|
||||
// set the name of the window in the static control above
|
||||
// the callback editor boxes
|
||||
//
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
if( window )
|
||||
{
|
||||
WinInstanceData *instData = window->winGetInstanceData();
|
||||
|
||||
if( !instData->m_decoratedNameString.isEmpty() )
|
||||
name = instData->m_decoratedNameString;
|
||||
else
|
||||
name = noNameWindowString;
|
||||
|
||||
} // end if
|
||||
SetWindowText( GetDlgItem( dialog, STATIC_WINDOW ), name.str() );
|
||||
|
||||
} // end setCurrentWindow
|
||||
|
||||
// loadUserWindows ============================================================
|
||||
/** Given the window list passed in, load the list box passed with the
|
||||
* names of USER windows found in the hierarchy. */
|
||||
//=============================================================================
|
||||
static void loadUserWindows( HWND listbox, GameWindow *root )
|
||||
{
|
||||
|
||||
// end recursion
|
||||
if( root == NULL )
|
||||
return;
|
||||
|
||||
// is this a candidate
|
||||
if( TheEditor->windowIsGadget( root ) == FALSE )
|
||||
{
|
||||
WinInstanceData *instData = root->winGetInstanceData();
|
||||
Int index;
|
||||
|
||||
AsciiString name;
|
||||
//
|
||||
// add name to the listbox, if there is no name we can only put
|
||||
// an unnamed label in there
|
||||
//
|
||||
if( !instData->m_decoratedNameString.isEmpty() )
|
||||
name = instData->m_decoratedNameString;
|
||||
else
|
||||
name = noNameWindowString;
|
||||
index = SendMessage( listbox, LB_ADDSTRING, 0, (LPARAM)name.str() );
|
||||
|
||||
// add data pointer to the window at the index just added
|
||||
SendMessage( listbox, LB_SETITEMDATA, index, (LPARAM)root );
|
||||
|
||||
// check the children
|
||||
loadUserWindows( listbox, root->winGetChild() );
|
||||
|
||||
} // end if
|
||||
|
||||
// check the rest of the list
|
||||
loadUserWindows( listbox, root->winGetNext() );
|
||||
|
||||
} // end loadUserWindows
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/** save the layout callbacks */
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
static void saveLayoutCallbacks( HWND dialog )
|
||||
{
|
||||
char buffer[ MAX_LAYOUT_FUNC_LEN ];
|
||||
Int sel;
|
||||
|
||||
// layout init
|
||||
sel = SendDlgItemMessage( dialog, COMBO_INIT, CB_GETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( dialog, COMBO_INIT, CB_GETLBTEXT, sel, (LPARAM)buffer );
|
||||
TheEditor->setLayoutInit( AsciiString(buffer) );
|
||||
|
||||
// layout update
|
||||
sel = SendDlgItemMessage( dialog, COMBO_UPDATE, CB_GETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( dialog, COMBO_UPDATE, CB_GETLBTEXT, sel, (LPARAM)buffer );
|
||||
TheEditor->setLayoutUpdate( AsciiString(buffer) );
|
||||
|
||||
// layout shutdown
|
||||
sel = SendDlgItemMessage( dialog, COMBO_SHUTDOWN, CB_GETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( dialog, COMBO_SHUTDOWN, CB_GETLBTEXT, sel, (LPARAM)buffer );
|
||||
TheEditor->setLayoutShutdown( AsciiString(buffer) );
|
||||
|
||||
} // end saveLayoutCallbacks
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CallbackEditorDialogProc ===================================================
|
||||
/** Dialog procedure for grid settings dialog */
|
||||
//=============================================================================
|
||||
BOOL CALLBACK CallbackEditorDialogProc( HWND hWndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
|
||||
// load the combos with the callbacks
|
||||
InitCallbackCombos( hWndDialog, NULL );
|
||||
|
||||
// select the none string at the top index in each combo
|
||||
SendDlgItemMessage( hWndDialog, COMBO_SYSTEM, CB_SETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( hWndDialog, COMBO_INPUT, CB_SETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( hWndDialog, COMBO_TOOLTIP, CB_SETCURSEL, 0, 0 );
|
||||
SendDlgItemMessage( hWndDialog, COMBO_DRAW, CB_SETCURSEL, 0, 0 );
|
||||
|
||||
// load the listbox with all the USER windows in the edit window
|
||||
loadUserWindows( GetDlgItem( hWndDialog, LIST_WINDOWS ),
|
||||
TheWindowManager->winGetWindowList() );
|
||||
|
||||
// no current window
|
||||
setCurrentWindow( NULL, hWndDialog );
|
||||
|
||||
return TRUE;
|
||||
|
||||
} // end init dialog
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
Int notifyCode = HIWORD( wParam ); // notification code
|
||||
// Int controlID = LOWORD( wParam ); // control ID
|
||||
HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( LOWORD( wParam ) )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case LIST_WINDOWS:
|
||||
{
|
||||
|
||||
switch( notifyCode )
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
case LBN_SELCHANGE:
|
||||
{
|
||||
Int selected;
|
||||
GameWindow *win;
|
||||
|
||||
// get the current selection of the window list
|
||||
selected = SendMessage( hWndControl, LB_GETCURSEL, 0, 0 );
|
||||
|
||||
// get the window of the selected listbox item
|
||||
win = (GameWindow *)SendMessage( hWndControl, LB_GETITEMDATA,
|
||||
selected, 0 );
|
||||
|
||||
|
||||
// sanity
|
||||
DEBUG_ASSERTCRASH( win, ("NULL window set in listbox item data") );
|
||||
|
||||
// save the callbacks for the curent window selected
|
||||
SaveCallbacks( currentWindow, hWndDialog );
|
||||
|
||||
// set the current window to the new selection
|
||||
setCurrentWindow( win, hWndDialog );
|
||||
|
||||
break;
|
||||
|
||||
} // end case selection change
|
||||
|
||||
} // end switch
|
||||
|
||||
break;
|
||||
|
||||
} // end window listbox
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
|
||||
// save callbacks, set current window to empty and end dialog
|
||||
SaveCallbacks( currentWindow, hWndDialog );
|
||||
setCurrentWindow( NULL, hWndDialog );
|
||||
|
||||
// save the layout callbacks
|
||||
saveLayoutCallbacks( hWndDialog );
|
||||
|
||||
// end dialog
|
||||
EndDialog( hWndDialog, TRUE );
|
||||
|
||||
break;
|
||||
|
||||
} // end ok
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end CallbackEditorDialogProc
|
||||
|
||||
|
|
@ -0,0 +1,290 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: CheckBoxProperties.cpp ///////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: CheckBoxProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Check box properties
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetCheckBox.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// checkBoxPropertiesCallback =================================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK checkBoxPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( CHECK_BOX_ENABLED );
|
||||
GadgetCheckBoxSetEnabledImage( window, info->image );
|
||||
GadgetCheckBoxSetEnabledColor( window, info->color );
|
||||
GadgetCheckBoxSetEnabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( CHECK_BOX_ENABLED_UNCHECKED_BOX );
|
||||
GadgetCheckBoxSetEnabledUncheckedBoxImage( window, info->image );
|
||||
GadgetCheckBoxSetEnabledUncheckedBoxColor( window, info->color );
|
||||
GadgetCheckBoxSetEnabledUncheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( CHECK_BOX_ENABLED_CHECKED_BOX );
|
||||
GadgetCheckBoxSetEnabledCheckedBoxImage( window, info->image );
|
||||
GadgetCheckBoxSetEnabledCheckedBoxColor( window, info->color );
|
||||
GadgetCheckBoxSetEnabledCheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( CHECK_BOX_DISABLED );
|
||||
GadgetCheckBoxSetDisabledImage( window, info->image );
|
||||
GadgetCheckBoxSetDisabledColor( window, info->color );
|
||||
GadgetCheckBoxSetDisabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( CHECK_BOX_DISABLED_UNCHECKED_BOX );
|
||||
GadgetCheckBoxSetDisabledUncheckedBoxImage( window, info->image );
|
||||
GadgetCheckBoxSetDisabledUncheckedBoxColor( window, info->color );
|
||||
GadgetCheckBoxSetDisabledUncheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( CHECK_BOX_DISABLED_CHECKED_BOX );
|
||||
GadgetCheckBoxSetDisabledCheckedBoxImage( window, info->image );
|
||||
GadgetCheckBoxSetDisabledCheckedBoxColor( window, info->color );
|
||||
GadgetCheckBoxSetDisabledCheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( CHECK_BOX_HILITE );
|
||||
GadgetCheckBoxSetHiliteImage( window, info->image );
|
||||
GadgetCheckBoxSetHiliteColor( window, info->color );
|
||||
GadgetCheckBoxSetHiliteBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( CHECK_BOX_HILITE_UNCHECKED_BOX );
|
||||
GadgetCheckBoxSetHiliteUncheckedBoxImage( window, info->image );
|
||||
GadgetCheckBoxSetHiliteUncheckedBoxColor( window, info->color );
|
||||
GadgetCheckBoxSetHiliteUncheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( CHECK_BOX_HILITE_CHECKED_BOX );
|
||||
GadgetCheckBoxSetHiliteCheckedBoxImage( window, info->image );
|
||||
GadgetCheckBoxSetHiliteCheckedBoxColor( window, info->color );
|
||||
GadgetCheckBoxSetHiliteCheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end checkBoxPropertiesCallback
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitCheckBoxPropertiesDialog ===============================================
|
||||
/** Bring up the check box properties dialog */
|
||||
//=============================================================================
|
||||
HWND InitCheckBoxPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)CHECK_BOX_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)checkBoxPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this putton
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetCheckBoxGetEnabledImage( window );
|
||||
color = GadgetCheckBoxGetEnabledColor( window );
|
||||
borderColor = GadgetCheckBoxGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetCheckBoxGetEnabledUncheckedBoxImage( window );
|
||||
color = GadgetCheckBoxGetEnabledUncheckedBoxColor( window );
|
||||
borderColor = GadgetCheckBoxGetEnabledUncheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_ENABLED_UNCHECKED_BOX, image, color, borderColor );
|
||||
|
||||
image = GadgetCheckBoxGetEnabledCheckedBoxImage( window );
|
||||
color = GadgetCheckBoxGetEnabledCheckedBoxColor( window );
|
||||
borderColor = GadgetCheckBoxGetEnabledCheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_ENABLED_CHECKED_BOX, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetCheckBoxGetDisabledImage( window );
|
||||
color = GadgetCheckBoxGetDisabledColor( window );
|
||||
borderColor = GadgetCheckBoxGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetCheckBoxGetDisabledUncheckedBoxImage( window );
|
||||
color = GadgetCheckBoxGetDisabledUncheckedBoxColor( window );
|
||||
borderColor = GadgetCheckBoxGetDisabledUncheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_DISABLED_UNCHECKED_BOX, image, color, borderColor );
|
||||
|
||||
image = GadgetCheckBoxGetDisabledCheckedBoxImage( window );
|
||||
color = GadgetCheckBoxGetDisabledCheckedBoxColor( window );
|
||||
borderColor = GadgetCheckBoxGetDisabledCheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_DISABLED_CHECKED_BOX, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetCheckBoxGetHiliteImage( window );
|
||||
color = GadgetCheckBoxGetHiliteColor( window );
|
||||
borderColor = GadgetCheckBoxGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetCheckBoxGetHiliteUncheckedBoxImage( window );
|
||||
color = GadgetCheckBoxGetHiliteUncheckedBoxColor( window );
|
||||
borderColor = GadgetCheckBoxGetHiliteUncheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_HILITE_UNCHECKED_BOX, image, color, borderColor );
|
||||
|
||||
image = GadgetCheckBoxGetHiliteCheckedBoxImage( window );
|
||||
color = GadgetCheckBoxGetHiliteCheckedBoxColor( window );
|
||||
borderColor = GadgetCheckBoxGetHiliteCheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( CHECK_BOX_HILITE_CHECKED_BOX, image, color, borderColor );
|
||||
|
||||
// select the button enabled state for display
|
||||
SwitchToState( CHECK_BOX_ENABLED, dialog );
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitCheckBoxPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,916 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: ColorDialog.cpp //////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: ColorDialog.cpp
|
||||
//
|
||||
// Created: Colin Day, March 1999
|
||||
// Colin Day, July 2001
|
||||
//
|
||||
// Desc: Color picker dialog
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Resource.h"
|
||||
#include "GUIEditColor.h"
|
||||
#include "Properties.h"
|
||||
#include "Common/Debug.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
#define MODE_RGB 0
|
||||
#define MODE_HSV 1
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static RGBColorInt selectedColor; // picked color
|
||||
static Int mode = MODE_HSV; // color selection mode
|
||||
static ICoord2D displayPos; // where to open window
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// rgbToHSV ===================================================================
|
||||
// Converts the RGB colors passed in to HSV values
|
||||
// RGB colors ranges from 0 - 1
|
||||
// hue ranges from 0 - 360
|
||||
// saturation and value ranges from 0 - 1
|
||||
// ============================================================================
|
||||
HSVColorReal rgbToHSV( RGBColorReal rgbColor )
|
||||
{
|
||||
Real max, min; // max and min of rgb
|
||||
Real red, green, blue; // rgb alias
|
||||
Real hue, saturation, value; // hsv alias
|
||||
HSVColorReal hsvColor;
|
||||
|
||||
red = rgbColor.red;
|
||||
green = rgbColor.green;
|
||||
blue = rgbColor.blue;
|
||||
|
||||
// find the max and min of the rgb triplet
|
||||
max = red;
|
||||
if (green > max)
|
||||
max = green;
|
||||
if (blue > max)
|
||||
max = blue;
|
||||
|
||||
min = red;
|
||||
if (green < red)
|
||||
min = green;
|
||||
if (blue < min)
|
||||
min = blue;
|
||||
|
||||
// set the value
|
||||
value = max;
|
||||
|
||||
// calculate saturation
|
||||
if (max != 0)
|
||||
saturation = (max - min) / max;
|
||||
else
|
||||
saturation = 0; // saturation is 0 if all RGB are 0
|
||||
|
||||
// calculate hue
|
||||
if (saturation == 0) {
|
||||
hue = 0; // hue is really undefined
|
||||
} // end if
|
||||
else { // chromatic case, determine hue
|
||||
Real delta = max - min;
|
||||
|
||||
if (red == max)
|
||||
hue = (green - blue) / delta; // color between yellow and magenta
|
||||
else if (green == max)
|
||||
hue = 2 + (blue - red) / delta; // color between cyan and yellow
|
||||
else if (blue == max)
|
||||
hue = 4 + (red - green) / delta; // color between magenta and cyan
|
||||
|
||||
hue = hue * 60; // convert hue to degrees
|
||||
if (hue < 0)
|
||||
hue += 360; // make sure hue is non negative
|
||||
|
||||
} // end else, chromatic case, determine hue
|
||||
|
||||
// set and return an HSVColor
|
||||
hsvColor.hue = hue;
|
||||
hsvColor.saturation = saturation;
|
||||
hsvColor.value = value;
|
||||
|
||||
// values aren't very nice to lets make them at least 1 ... isn't not
|
||||
// technically correct but it works nicer for light color dialog
|
||||
if (hsvColor.hue == 0.0f)
|
||||
hsvColor.hue = 1.0f;
|
||||
if (hsvColor.saturation == 0.0f)
|
||||
hsvColor.saturation += 0.01f;
|
||||
if (hsvColor.value == 0.0f)
|
||||
hsvColor.value += 0.01f;
|
||||
|
||||
// copy over alpha
|
||||
hsvColor.alpha = rgbColor.alpha;
|
||||
|
||||
return hsvColor;
|
||||
|
||||
} // end rgbToHSV
|
||||
|
||||
// hsvToRGB ===================================================================
|
||||
// Converts the HSV colors passed in to RGB values
|
||||
// RGB colors ranges from 0 - 1
|
||||
// hue ranges from 0 - 360
|
||||
// saturation and value ranges from 0 - 1
|
||||
// ============================================================================
|
||||
RGBColorReal hsvToRGB( HSVColorReal hsvColor )
|
||||
{
|
||||
Int i;
|
||||
Real f, p, q, t;
|
||||
Real red, green, blue; // rgb alias
|
||||
Real hue, saturation, value; // hsv alias
|
||||
RGBColorReal rgbColor;
|
||||
|
||||
hue = hsvColor.hue;
|
||||
saturation = hsvColor.saturation;
|
||||
value = hsvColor.value;
|
||||
|
||||
if( saturation == 0.0f )
|
||||
{
|
||||
// the colors is on the black and white center line
|
||||
if( hue == 0.0f )
|
||||
{ // achromatic color ... there is no hue
|
||||
red = green = blue = value;
|
||||
} // end if, achromatic color .. there is no hue
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(( "HSVToRGB error, hue should be undefined" ));
|
||||
} // end else
|
||||
|
||||
} // end if
|
||||
else
|
||||
{
|
||||
|
||||
if( hue == 360.0f )
|
||||
hue = 0.0f;
|
||||
hue = hue / 60.0f; // h is now in [0, 6)
|
||||
i = REAL_TO_INT_FLOOR(hue); // largest int <= h
|
||||
f = hue - (Real) i; // f is the fractional part of h
|
||||
p = value * (1.0f - saturation);
|
||||
q = value * (1.0f - (saturation * f));
|
||||
t = value * (1.0f - (saturation * (1.0f - f)));
|
||||
switch (i) {
|
||||
case 0:
|
||||
red = value;
|
||||
green = t;
|
||||
blue = p;
|
||||
break;
|
||||
case 1:
|
||||
red = q;
|
||||
green = value;
|
||||
blue = p;
|
||||
break;
|
||||
case 2:
|
||||
red = p;
|
||||
green = value;
|
||||
blue = t;
|
||||
break;
|
||||
case 3:
|
||||
red = p;
|
||||
green = q;
|
||||
blue = value;
|
||||
break;
|
||||
case 4:
|
||||
red = t;
|
||||
green = p;
|
||||
blue = value;
|
||||
break;
|
||||
case 5:
|
||||
red = value;
|
||||
green = p;
|
||||
blue = q;
|
||||
break;
|
||||
} // end switch (i)
|
||||
|
||||
} // end else, chromatic case
|
||||
|
||||
// store and return and RGB color
|
||||
rgbColor.red = red;
|
||||
rgbColor.green = green;
|
||||
rgbColor.blue = blue;
|
||||
rgbColor.alpha = hsvColor.alpha;
|
||||
|
||||
return rgbColor;
|
||||
|
||||
} // end hsvToRGB
|
||||
|
||||
// FORWARD DECLARATIONS ///////////////////////////////////////////////////////
|
||||
BOOL CALLBACK SelectColorDlgProc( HWND hWnd, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam );
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SelectColor ================================================================
|
||||
/** Bring up the color selection requestor.
|
||||
*
|
||||
* Returns:
|
||||
* Pointer to selected color
|
||||
* NULL for canceled request
|
||||
*/
|
||||
// ============================================================================
|
||||
RGBColorInt *SelectColor( Int red, Int green, Int blue, Int alpha,
|
||||
Int mouseX, Int mouseY )
|
||||
{
|
||||
|
||||
selectedColor.red = red;
|
||||
selectedColor.green = green;
|
||||
selectedColor.blue = blue;
|
||||
selectedColor.alpha = alpha;
|
||||
|
||||
displayPos.x = mouseX;
|
||||
displayPos.y = mouseY;
|
||||
|
||||
if( DialogBox( TheEditor->getInstance(), (LPCTSTR)COLOR_SELECT_DIALOG,
|
||||
TheEditor->getWindowHandle(), SelectColorDlgProc ) )
|
||||
return &selectedColor;
|
||||
else
|
||||
return NULL;
|
||||
|
||||
} // end SelectColor
|
||||
|
||||
// SelectColorDlgProc =========================================================
|
||||
/** Dialog procedure for color selector dialog */
|
||||
// ============================================================================
|
||||
BOOL CALLBACK SelectColorDlgProc( HWND hWndDlg, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
static HWND hWndScrollColor1; // red / hue
|
||||
static HWND hWndScrollColor2; // green / saturation
|
||||
static HWND hWndScrollColor3; // blue / value
|
||||
static HWND hWndScrollAlpha; // alpha scrollbar
|
||||
static HWND hWndColorBar1; // red / hue
|
||||
static HWND hWndColorBar2; // green / saturation
|
||||
static HWND hWndColorBar3; // blue / value
|
||||
static HWND hWndPreview;
|
||||
|
||||
switch (uMsg) {
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
|
||||
// save some window handles for later comparing during processing
|
||||
hWndScrollColor1 = GetDlgItem( hWndDlg, SCROLL_COLOR1 );
|
||||
hWndScrollColor2 = GetDlgItem( hWndDlg, SCROLL_COLOR2 );
|
||||
hWndScrollColor3 = GetDlgItem( hWndDlg, SCROLL_COLOR3 );
|
||||
hWndScrollAlpha = GetDlgItem( hWndDlg, SCROLL_ALPHA );
|
||||
hWndColorBar1 = GetDlgItem( hWndDlg, BUTTON_COLORBAR1 );
|
||||
hWndColorBar2 = GetDlgItem( hWndDlg, BUTTON_COLORBAR2 );
|
||||
hWndColorBar3 = GetDlgItem( hWndDlg, BUTTON_COLORBAR3 );
|
||||
hWndPreview = GetDlgItem (hWndDlg, BUTTON_PREVIEW);
|
||||
|
||||
// init the scroll bars and labels to the current color
|
||||
if (mode == MODE_HSV)
|
||||
{
|
||||
RGBColorReal rgbColor;
|
||||
HSVColorReal hsvColor;
|
||||
|
||||
rgbColor.red = (Real) selectedColor.red / 255.0f;
|
||||
rgbColor.green = (Real) selectedColor.green / 255.0f;
|
||||
rgbColor.blue = (Real) selectedColor.blue / 255.0f;
|
||||
rgbColor.alpha = (Real) selectedColor.alpha;
|
||||
hsvColor = rgbToHSV (rgbColor);
|
||||
hsvColor.saturation *= 100.0f;
|
||||
hsvColor.value *= 100.0f;
|
||||
|
||||
// init the HSV and intensity scroll bar extents
|
||||
SendMessage( hWndScrollColor1, SBM_SETRANGE, 1, 360 );
|
||||
SendMessage( hWndScrollColor2, SBM_SETRANGE, 1, 100 );
|
||||
SendMessage( hWndScrollColor3, SBM_SETRANGE, 1, 100 );
|
||||
SendMessage( hWndScrollAlpha, SBM_SETRANGE, 0, 255 );
|
||||
|
||||
// set the scroll bars and labels
|
||||
SetScrollPos (hWndScrollColor1, SB_CTL, (Int) hsvColor.hue, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR1,
|
||||
(Int) hsvColor.hue, FALSE);
|
||||
SetScrollPos (hWndScrollColor2, SB_CTL, (Int) hsvColor.saturation, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR2,
|
||||
(Int) hsvColor.saturation, FALSE);
|
||||
SetScrollPos (hWndScrollColor3, SB_CTL, (Int) hsvColor.value, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR3,
|
||||
(Int) hsvColor.value, FALSE);
|
||||
SetScrollPos (hWndScrollAlpha, SB_CTL, (Int) hsvColor.alpha, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_ALPHA,
|
||||
(Int) hsvColor.alpha, FALSE);
|
||||
|
||||
} // end if
|
||||
else
|
||||
{
|
||||
|
||||
// init the RGB and intensity scroll bar extents
|
||||
SendMessage( hWndScrollColor1, SBM_SETRANGE, 1, 255 );
|
||||
SendMessage( hWndScrollColor2, SBM_SETRANGE, 1, 255 );
|
||||
SendMessage( hWndScrollColor3, SBM_SETRANGE, 1, 255 );
|
||||
SendMessage( hWndScrollAlpha, SBM_SETRANGE, 0, 255 );
|
||||
SetScrollPos (hWndScrollColor1, SB_CTL, selectedColor.red, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR1,
|
||||
selectedColor.red, FALSE);
|
||||
SetScrollPos (hWndScrollColor2, SB_CTL, selectedColor.green, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR2,
|
||||
selectedColor.green, FALSE);
|
||||
SetScrollPos (hWndScrollColor3, SB_CTL, selectedColor.blue, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR3,
|
||||
selectedColor.blue, FALSE);
|
||||
SetScrollPos (hWndScrollAlpha, SB_CTL, selectedColor.alpha, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_ALPHA,
|
||||
selectedColor.alpha, FALSE);
|
||||
|
||||
} // end else
|
||||
|
||||
//
|
||||
// move the window to the display position, but keep the whole
|
||||
// window on the screen
|
||||
//
|
||||
PositionWindowOnScreen( hWndDlg, displayPos.x, displayPos.y );
|
||||
|
||||
return TRUE;
|
||||
|
||||
} // end case WM_INITDIALOG
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_DRAWITEM: {
|
||||
UINT idCtl = (UINT) wParam; // control identifier
|
||||
LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT) lParam; // item drawing
|
||||
HWND hWndControl;
|
||||
RECT rect;
|
||||
ICoord2D center;
|
||||
Int radius;
|
||||
|
||||
// Get the area we have to draw in
|
||||
hWndControl = GetDlgItem (hWndDlg, idCtl);
|
||||
GetClientRect (hWndControl, &rect);
|
||||
center.x = (rect.right - rect.left) / 2;
|
||||
center.y = (rect.bottom - rect.top) / 2;
|
||||
|
||||
// record radius we have to work with
|
||||
radius = (rect.right - rect.left) / 2;
|
||||
|
||||
switch (idCtl) {
|
||||
|
||||
case BUTTON_PREVIEW: {
|
||||
RGBColorReal rgbColor;
|
||||
HSVColorReal hsvColor;
|
||||
HBRUSH hBrushOld, hBrushNew;
|
||||
|
||||
if (mode == MODE_RGB) {
|
||||
rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1,
|
||||
NULL, FALSE);
|
||||
rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2,
|
||||
NULL, FALSE);
|
||||
rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3,
|
||||
NULL, FALSE);
|
||||
} // end if
|
||||
else {
|
||||
hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1,
|
||||
NULL, FALSE);
|
||||
hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2,
|
||||
NULL, FALSE);
|
||||
hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3,
|
||||
NULL, FALSE);
|
||||
// convert to ranges 0 - 1 for RGB conversion
|
||||
hsvColor.saturation /= 100.0f;
|
||||
hsvColor.value /= 100.0f;
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
// convert RGB ranges to 0 - 255
|
||||
rgbColor.red *= 255;
|
||||
rgbColor.green *= 255;
|
||||
rgbColor.blue *= 255;
|
||||
} // end else
|
||||
|
||||
// create a new brush and select it into DC
|
||||
hBrushNew = CreateSolidBrush (RGB ((BYTE) rgbColor.red,
|
||||
(BYTE) rgbColor.green,
|
||||
(BYTE) rgbColor.blue));
|
||||
hBrushOld = (HBRUSH)SelectObject( lpdis->hDC, hBrushNew );
|
||||
|
||||
// draw the rectangle
|
||||
Rectangle (lpdis->hDC, rect.left, rect.top,
|
||||
rect.right, rect.bottom);
|
||||
|
||||
// put the old brush back and delete the new one
|
||||
SelectObject (lpdis->hDC, hBrushOld);
|
||||
DeleteObject (hBrushNew);
|
||||
|
||||
// validate this new area
|
||||
ValidateRect (hWndControl, NULL);
|
||||
|
||||
break;
|
||||
|
||||
} // end case BUTTON_PREVIEW
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Draw the bar of either HUE or RED next to the scroll bar
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_COLORBAR1: {
|
||||
Real step;
|
||||
Int x, y;
|
||||
RGBColorReal rgbColor;
|
||||
HSVColorReal hsvColor;
|
||||
|
||||
// compute how big of a red increment for each line as we step
|
||||
// down the bar
|
||||
if (mode == MODE_HSV)
|
||||
step = 360.0f / (Real) (rect.right - rect.left);
|
||||
else
|
||||
step = 255.0f / (Real) (rect.right - rect.left);
|
||||
|
||||
// compute the first color, create pen for it, and save the
|
||||
// original pen
|
||||
if (mode == MODE_HSV) {
|
||||
hsvColor.hue = 1;
|
||||
hsvColor.saturation = 1;
|
||||
hsvColor.value = 1;
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
rgbColor.red *= 255.0f;
|
||||
rgbColor.green *= 255.0f;
|
||||
rgbColor.blue *= 255.0f;
|
||||
} // end if
|
||||
else {
|
||||
rgbColor.red = 0;
|
||||
rgbColor.green = 0;
|
||||
rgbColor.blue = 0;
|
||||
} // end else
|
||||
|
||||
// loop through each horizontal line available in the bar drawing
|
||||
// the correct color there
|
||||
for (x = 0; x < (rect.right - rect.left) - 1; x++) {
|
||||
|
||||
// draw a horizontal row of pixels with this color
|
||||
for (y = 0; y < rect.bottom; y++)
|
||||
SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red,
|
||||
(BYTE) rgbColor.green,
|
||||
(BYTE) rgbColor.blue));
|
||||
|
||||
// increment the color, create new pen, and delete old pen
|
||||
if (mode == MODE_HSV) {
|
||||
hsvColor.hue += step;
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
rgbColor.red *= 255;
|
||||
rgbColor.green *= 255;
|
||||
rgbColor.blue *= 255;
|
||||
} // end if
|
||||
else {
|
||||
rgbColor.red += step;
|
||||
} // end else
|
||||
|
||||
} // end for i
|
||||
|
||||
break;
|
||||
|
||||
} // end case BUTTON_COLORBAR1
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Draw the bar of either SATURATION or GREEN next to the scroll bar
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_COLORBAR2: {
|
||||
Real step;
|
||||
Int x, y;
|
||||
RGBColorReal rgbColor;
|
||||
HSVColorReal hsvColor;
|
||||
|
||||
// compute how big of a increment for each line as we step
|
||||
// down the bar
|
||||
if (mode == MODE_HSV)
|
||||
step = 1.0f / (Real) (rect.right - rect.left);
|
||||
else
|
||||
step = 255.0f / (Real) (rect.right - rect.left);
|
||||
|
||||
// compute the first color, create pen for it, and save the
|
||||
// original pen
|
||||
if (mode == MODE_HSV) {
|
||||
hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1,
|
||||
NULL, FALSE);
|
||||
hsvColor.saturation = 1.0f / 100.0f;
|
||||
hsvColor.value = 1;
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
rgbColor.red *= 255;
|
||||
rgbColor.green *= 255;
|
||||
rgbColor.blue *= 255;
|
||||
} // end if
|
||||
else {
|
||||
rgbColor.red = 0;
|
||||
rgbColor.green = 0;
|
||||
rgbColor.blue = 0;
|
||||
} // end else
|
||||
|
||||
// loop through each horizontal line available in the bar drawing
|
||||
// the correct color there
|
||||
for (x = 0; x < (rect.right - rect.left) - 1; x++) {
|
||||
|
||||
// draw a horizontal row of pixels with this color
|
||||
for (y = 0; y < rect.bottom; y++)
|
||||
SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red,
|
||||
(BYTE) rgbColor.green,
|
||||
(BYTE) rgbColor.blue));
|
||||
|
||||
// increment the color, create new pen, and delete old pen
|
||||
if (mode == MODE_HSV) {
|
||||
hsvColor.saturation += step;
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
rgbColor.red *= 255;
|
||||
rgbColor.green *= 255;
|
||||
rgbColor.blue *= 255;
|
||||
} // end if
|
||||
else {
|
||||
rgbColor.green += step;
|
||||
} // end else
|
||||
|
||||
} // end for i
|
||||
|
||||
break;
|
||||
|
||||
} // end case BUTTON_COLORBAR2
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Draw the bar of either VALUE or BLUE next to the scroll bar
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_COLORBAR3: {
|
||||
Real step;
|
||||
Int x, y;
|
||||
RGBColorReal rgbColor;
|
||||
HSVColorReal hsvColor;
|
||||
|
||||
// compute how big of a increment for each line as we step
|
||||
// down the bar
|
||||
if (mode == MODE_HSV)
|
||||
step = 1.0f / (Real) (rect.right - rect.left);
|
||||
else
|
||||
step = 255.0f / (Real) (rect.right - rect.left);
|
||||
|
||||
// compute the first color, create pen for it, and save the
|
||||
// original pen
|
||||
if (mode == MODE_HSV) {
|
||||
hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1,
|
||||
NULL, FALSE);
|
||||
hsvColor.saturation =
|
||||
(Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE) / 100.0f;
|
||||
hsvColor.value = 1.0f / 100.0f;
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
rgbColor.red *= 255.0f;
|
||||
rgbColor.green *= 255.0f;
|
||||
rgbColor.blue *= 255.0f;
|
||||
} // end if
|
||||
else {
|
||||
rgbColor.red = 0;
|
||||
rgbColor.green = 0;
|
||||
rgbColor.blue = 0;
|
||||
} // end else
|
||||
|
||||
// loop through each horizontal line available in the bar drawing
|
||||
// the correct color there
|
||||
for (x = 0; x < (rect.right - rect.left) - 1; x++) {
|
||||
|
||||
// draw a horizontal row of pixels with this color
|
||||
for (y = 0; y < rect.bottom; y++)
|
||||
SetPixel (lpdis->hDC, x, y, RGB ((BYTE) rgbColor.red,
|
||||
(BYTE) rgbColor.green,
|
||||
(BYTE) rgbColor.blue));
|
||||
|
||||
// increment the color, create new pen, and delete old pen
|
||||
if (mode == MODE_HSV) {
|
||||
hsvColor.value += step;
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
rgbColor.red *= 255;
|
||||
rgbColor.green *= 255;
|
||||
rgbColor.blue *= 255;
|
||||
} // end if
|
||||
else {
|
||||
rgbColor.blue += step;
|
||||
} // end else
|
||||
|
||||
} // end for i
|
||||
|
||||
break;
|
||||
|
||||
} // end case BUTTON_COLORBAR3
|
||||
|
||||
} // end switch
|
||||
|
||||
return TRUE;
|
||||
|
||||
} // end case WM_DRAWITEM
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// horizontal scrolling on the color bars
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_HSCROLL:
|
||||
{
|
||||
Int nScrollCode = (Int) LOWORD (wParam); // scroll bar value
|
||||
Short nPos = (Short) HIWORD (wParam); // for thumbtrack only
|
||||
HWND hWndScroll = (HWND) lParam; // handle of scroll bar
|
||||
Int labelID; // identifier of the text label for this scroll bar
|
||||
Int thumbPos; // current thumb position
|
||||
Int minPos, maxPos; // max and min of this scrollbar
|
||||
|
||||
// get the thumb position for the scrollbar
|
||||
thumbPos = GetScrollPos (hWndScroll, SB_CTL);
|
||||
|
||||
// find out which scroll bar we're talking about and set the correct
|
||||
// labelID for that control
|
||||
if (hWndScroll == hWndScrollColor1)
|
||||
labelID = LABEL_COLOR1;
|
||||
else if (hWndScroll == hWndScrollColor2)
|
||||
labelID = LABEL_COLOR2;
|
||||
else if (hWndScroll == hWndScrollColor3)
|
||||
labelID = LABEL_COLOR3;
|
||||
else if( hWndScroll == hWndScrollAlpha )
|
||||
labelID = LABEL_ALPHA;
|
||||
|
||||
// find the max and min extents for this scroll bar
|
||||
SendMessage (hWndScroll, SBM_GETRANGE, (WPARAM) &minPos, (LPARAM) &maxPos);
|
||||
|
||||
switch (nScrollCode) {
|
||||
case SB_LINELEFT: {
|
||||
if (thumbPos > minPos)
|
||||
thumbPos--;
|
||||
break;
|
||||
} // end case SB_LINELEFT
|
||||
case SB_PAGELEFT: {
|
||||
if (thumbPos - 45 >= minPos)
|
||||
thumbPos -= 45;
|
||||
else
|
||||
thumbPos = minPos;
|
||||
break;
|
||||
} // end case SB_PAGELEFT
|
||||
case SB_LINERIGHT: {
|
||||
if (thumbPos < maxPos)
|
||||
thumbPos++;
|
||||
break;
|
||||
} // end case SB_LINERIGHT
|
||||
case SB_PAGERIGHT: {
|
||||
if (thumbPos + 45 < maxPos)
|
||||
thumbPos += 45;
|
||||
else
|
||||
thumbPos = maxPos;
|
||||
break;
|
||||
} // end case SB_PAGERIGHT
|
||||
case SB_THUMBTRACK: {
|
||||
thumbPos = nPos;
|
||||
break;
|
||||
} // end case SB_THUBTRACK
|
||||
default: {
|
||||
return 0;
|
||||
} // end default
|
||||
} // end switch nScrollCode
|
||||
|
||||
// set the new scrollbar position and the text with it
|
||||
SendMessage (hWndScroll, SBM_SETPOS, (WPARAM) thumbPos, (LPARAM) TRUE);
|
||||
SetDlgItemInt (hWndDlg, labelID, thumbPos, FALSE);
|
||||
|
||||
// if this was a color scroll bar, save the color change in
|
||||
// the appropriate color bead
|
||||
if (hWndScroll == hWndScrollColor1 ||
|
||||
hWndScroll == hWndScrollColor2 ||
|
||||
hWndScroll == hWndScrollColor3 ||
|
||||
hWndScroll == hWndScrollAlpha )
|
||||
{
|
||||
|
||||
RGBColorReal rgbColor;
|
||||
HSVColorReal hsvColor;
|
||||
|
||||
if (mode == MODE_RGB) {
|
||||
rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1,
|
||||
NULL, FALSE);
|
||||
rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2,
|
||||
NULL, FALSE);
|
||||
rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3,
|
||||
NULL, FALSE);
|
||||
rgbColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA,
|
||||
NULL, FALSE );
|
||||
|
||||
} // end if
|
||||
else {
|
||||
hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1,
|
||||
NULL, FALSE);
|
||||
hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2,
|
||||
NULL, FALSE);
|
||||
hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3,
|
||||
NULL, FALSE);
|
||||
hsvColor.alpha = (Real) GetDlgItemInt( hWndDlg, LABEL_ALPHA,
|
||||
NULL, FALSE );
|
||||
|
||||
// convert to ranges 0 - 1 for RGB conversion
|
||||
hsvColor.saturation /= 100.0f;
|
||||
hsvColor.value /= 100.0f;
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
// convert RGB ranges to 0 - 255
|
||||
rgbColor.red *= 255;
|
||||
rgbColor.green *= 255;
|
||||
rgbColor.blue *= 255;
|
||||
} // end else
|
||||
|
||||
// store the color
|
||||
selectedColor.red = (Int) rgbColor.red;
|
||||
selectedColor.green = (Int) rgbColor.green;
|
||||
selectedColor.blue = (Int) rgbColor.blue;
|
||||
selectedColor.alpha = (Int) rgbColor.alpha;
|
||||
|
||||
// force update of preview box
|
||||
// invalidate the preview box to force an update of its color
|
||||
InvalidateRect( hWndPreview, NULL, FALSE);
|
||||
UpdateWindow (hWndPreview);
|
||||
|
||||
// force updates of the colorbars
|
||||
InvalidateRect (hWndColorBar1, NULL, FALSE);
|
||||
InvalidateRect (hWndColorBar2, NULL, FALSE);
|
||||
InvalidateRect (hWndColorBar3, NULL, FALSE);
|
||||
UpdateWindow (hWndColorBar1);
|
||||
UpdateWindow (hWndColorBar2);
|
||||
UpdateWindow (hWndColorBar3);
|
||||
|
||||
} // end if, color bar scroll message
|
||||
|
||||
return 0;
|
||||
|
||||
} // end case WM_HSCROLL
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND: {
|
||||
// Int wNotifyCode = HIWORD(wParam); // notification code
|
||||
Int wID = LOWORD(wParam); // id of control
|
||||
// HWND hWndControl = (HWND) lParam; // handle of control
|
||||
|
||||
switch (wID) {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// color ok
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK: {
|
||||
|
||||
EndDialog( hWndDlg, TRUE ); // color selected
|
||||
break;
|
||||
|
||||
} // end case IDOK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL: {
|
||||
|
||||
EndDialog( hWndDlg, FALSE ); // selection cancelled
|
||||
break;
|
||||
|
||||
} // end case IDCANCEL
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Change from RGB mode to HSV mode and vice versa
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_RGB_HSV: {
|
||||
HWND hWndScroll;
|
||||
RGBColorReal rgbColor;
|
||||
HSVColorReal hsvColor;
|
||||
|
||||
if (mode == MODE_RGB) { // switch to HSV
|
||||
rgbColor.red = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE);
|
||||
rgbColor.green = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE);
|
||||
rgbColor.blue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, NULL, FALSE);
|
||||
|
||||
// convert rgb to range 0 - 1
|
||||
rgbColor.red /= 255.0f;
|
||||
rgbColor.green /= 255.0f;
|
||||
rgbColor.blue /= 255.0f;
|
||||
// convert the RGB to HSV
|
||||
hsvColor = rgbToHSV (rgbColor);
|
||||
// turn saturation and value to 0 - 100 ranges
|
||||
hsvColor.saturation *= 100.0f;
|
||||
hsvColor.value *= 100.0f;
|
||||
|
||||
// change the scrollbar extents and positions
|
||||
hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR1);
|
||||
SetScrollRange (hWndScroll, SB_CTL, 1, 360, FALSE);
|
||||
SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.hue, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR1, (Int) hsvColor.hue, FALSE);
|
||||
|
||||
hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR2);
|
||||
SetScrollRange (hWndScroll, SB_CTL, 1, 100, FALSE);
|
||||
SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.saturation, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR2, (Int) hsvColor.saturation, FALSE);
|
||||
|
||||
hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR3);
|
||||
SetScrollRange (hWndScroll, SB_CTL, 1, 100, FALSE);
|
||||
SetScrollPos (hWndScroll, SB_CTL, (Int) hsvColor.value, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR3, (Int) hsvColor.value, FALSE);
|
||||
|
||||
mode = MODE_HSV;
|
||||
|
||||
// change the text for the button
|
||||
SetWindowText (GetDlgItem (hWndDlg, BUTTON_RGB_HSV),
|
||||
"Switch to RGB");
|
||||
|
||||
} // end if, switch to HSV
|
||||
else { // switch to RGB
|
||||
hsvColor.hue = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR1, NULL, FALSE);
|
||||
hsvColor.saturation = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR2, NULL, FALSE);
|
||||
hsvColor.value = (Real) GetDlgItemInt (hWndDlg, LABEL_COLOR3, NULL, FALSE);
|
||||
|
||||
// convert saturation and value to range 0 - 1
|
||||
hsvColor.saturation /= 100.0f;
|
||||
hsvColor.value /= 100.0f;
|
||||
// convert the HSV to RGB
|
||||
rgbColor = hsvToRGB (hsvColor);
|
||||
// turn the rgb into 0 - 255 range
|
||||
rgbColor.red *= 255.0f;
|
||||
rgbColor.green *= 255.0f;
|
||||
rgbColor.blue *= 255.0f;
|
||||
|
||||
// change the scrollbar extents and positions
|
||||
hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR1);
|
||||
SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE);
|
||||
SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.red, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR1, (Int) rgbColor.red, FALSE);
|
||||
|
||||
hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR2);
|
||||
SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE);
|
||||
SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.green, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR2, (Int) rgbColor.green, FALSE);
|
||||
|
||||
hWndScroll = GetDlgItem (hWndDlg, SCROLL_COLOR3);
|
||||
SetScrollRange (hWndScroll, SB_CTL, 1, 255, FALSE);
|
||||
SetScrollPos (hWndScroll, SB_CTL, (Int) rgbColor.blue, TRUE);
|
||||
SetDlgItemInt (hWndDlg, LABEL_COLOR3, (Int) rgbColor.blue, FALSE);
|
||||
|
||||
// change the text for the button
|
||||
SetWindowText (GetDlgItem (hWndDlg, BUTTON_RGB_HSV),
|
||||
"Switch to HSV");
|
||||
|
||||
mode = MODE_RGB;
|
||||
|
||||
} // end else, switch to RGB
|
||||
|
||||
// invalidate all the vertical color bars so they are redrawn
|
||||
InvalidateRect (hWndColorBar1, NULL, TRUE);
|
||||
InvalidateRect (hWndColorBar2, NULL, TRUE);
|
||||
InvalidateRect (hWndColorBar3, NULL, TRUE);
|
||||
|
||||
} // end case BUTTON_RGB_HSV
|
||||
|
||||
} // end switch (LOWORD (wParam))
|
||||
|
||||
return 0;
|
||||
|
||||
} // end case WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Only hide the window on a close rather than destroy it since it will
|
||||
// probably be needed again.
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
ShowWindow(hWndDlg, SW_HIDE);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return 0; // for all messages that are not processed
|
||||
|
||||
} // end of switch (uMsg)
|
||||
|
||||
} // End of SelectColor
|
|
@ -0,0 +1,983 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: ComboBoxProperties.cpp ////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: ComboBoxProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: ComboBox properties dialog
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "LayoutScheme.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetComboBox.h"
|
||||
#include "GameClient/GadgetListBox.h"
|
||||
#include "GameClient/GadgetSlider.h"
|
||||
#include "GameClient/GadgetPushButton.h"
|
||||
#include "GameClient/GadgetTextEntry.h"
|
||||
#include "GameClient/GameWindowManager.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// comboBoxPropertiesCallback ==================================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK comboBoxPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_SUBCONTROL_COLOR:
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
//
|
||||
// using the current colors in the base of the comboBox, assign a
|
||||
// reasonable color scheme to all the sub control components
|
||||
//
|
||||
info = GetStateInfo( COMBOBOX_ENABLED );
|
||||
StoreColor( COMBOBOX_LISTBOX_ENABLED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_DROP_DOWN_BUTTON_ENABLED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_UP_BUTTON_ENABLED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT );
|
||||
StoreColor( COMBOBOX_EDIT_BOX_ENABLED_LEFT, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_DISABLED );
|
||||
StoreColor( COMBOBOX_DROP_DOWN_BUTTON_DISABLED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_DISABLED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_UP_BUTTON_DISABLED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_DISABLED_SELECTED_ITEM_LEFT );
|
||||
StoreColor( COMBOBOX_EDIT_BOX_DISABLED_LEFT, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_HILITE );
|
||||
StoreColor( COMBOBOX_DROP_DOWN_BUTTON_HILITE, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_HILITE, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_UP_BUTTON_HILITE, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_HILITE_TOP, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_HILITE_SELECTED_ITEM_LEFT );
|
||||
StoreColor( COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_EDIT_BOX_HILITE_LEFT, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, info->color, info->borderColor );
|
||||
|
||||
break;
|
||||
|
||||
} // end case subcontrol color
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_ENABLED );
|
||||
GadgetComboBoxSetEnabledImage( window, info->image );
|
||||
GadgetComboBoxSetEnabledColor( window, info->color );
|
||||
GadgetComboBoxSetEnabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_ENABLED_SELECTED_ITEM_LEFT );
|
||||
GadgetComboBoxSetEnabledSelectedItemImageLeft( window, info->image );
|
||||
GadgetComboBoxSetEnabledSelectedItemColor( window, info->color );
|
||||
GadgetComboBoxSetEnabledSelectedItemBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_ENABLED_SELECTED_ITEM_RIGHT );
|
||||
GadgetComboBoxSetEnabledSelectedItemImageRight( window, info->image );
|
||||
info = GetStateInfo( COMBOBOX_ENABLED_SELECTED_ITEM_CENTER );
|
||||
GadgetComboBoxSetEnabledSelectedItemImageCenter( window, info->image );
|
||||
info = GetStateInfo( COMBOBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetComboBoxSetEnabledSelectedItemImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_DISABLED );
|
||||
GadgetComboBoxSetDisabledImage( window, info->image );
|
||||
GadgetComboBoxSetDisabledColor( window, info->color );
|
||||
GadgetComboBoxSetDisabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_DISABLED_SELECTED_ITEM_LEFT );
|
||||
GadgetComboBoxSetDisabledSelectedItemImageLeft( window, info->image );
|
||||
GadgetComboBoxSetDisabledSelectedItemColor( window, info->color );
|
||||
GadgetComboBoxSetDisabledSelectedItemBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_DISABLED_SELECTED_ITEM_RIGHT );
|
||||
GadgetComboBoxSetDisabledSelectedItemImageRight( window, info->image );
|
||||
info = GetStateInfo( COMBOBOX_DISABLED_SELECTED_ITEM_CENTER );
|
||||
GadgetComboBoxSetDisabledSelectedItemImageCenter( window, info->image );
|
||||
info = GetStateInfo( COMBOBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetComboBoxSetDisabledSelectedItemImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_HILITE );
|
||||
GadgetComboBoxSetHiliteImage( window, info->image );
|
||||
GadgetComboBoxSetHiliteColor( window, info->color );
|
||||
GadgetComboBoxSetHiliteBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_HILITE_SELECTED_ITEM_LEFT );
|
||||
GadgetComboBoxSetHiliteSelectedItemImageLeft( window, info->image );
|
||||
GadgetComboBoxSetHiliteSelectedItemColor( window, info->color );
|
||||
GadgetComboBoxSetHiliteSelectedItemBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_HILITE_SELECTED_ITEM_RIGHT );
|
||||
GadgetComboBoxSetHiliteSelectedItemImageRight( window, info->image );
|
||||
info = GetStateInfo( COMBOBOX_HILITE_SELECTED_ITEM_CENTER );
|
||||
GadgetComboBoxSetHiliteSelectedItemImageCenter( window, info->image );
|
||||
info = GetStateInfo( COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetComboBoxSetHiliteSelectedItemImageSmallCenter( window, info->image );
|
||||
|
||||
GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton( window );
|
||||
if (dropDownButton)
|
||||
{
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_DROP_DOWN_BUTTON_ENABLED );
|
||||
GadgetButtonSetEnabledImage( dropDownButton, info->image );
|
||||
GadgetButtonSetEnabledColor( dropDownButton, info->color );
|
||||
GadgetButtonSetEnabledBorderColor( dropDownButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED );
|
||||
GadgetButtonSetEnabledSelectedImage( dropDownButton, info->image );
|
||||
GadgetButtonSetEnabledSelectedColor( dropDownButton, info->color );
|
||||
GadgetButtonSetEnabledSelectedBorderColor( dropDownButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_DROP_DOWN_BUTTON_DISABLED );
|
||||
GadgetButtonSetDisabledImage( dropDownButton, info->image );
|
||||
GadgetButtonSetDisabledColor( dropDownButton, info->color );
|
||||
GadgetButtonSetDisabledBorderColor( dropDownButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED );
|
||||
GadgetButtonSetDisabledSelectedImage( dropDownButton, info->image );
|
||||
GadgetButtonSetDisabledSelectedColor( dropDownButton, info->color );
|
||||
GadgetButtonSetDisabledSelectedBorderColor( dropDownButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_DROP_DOWN_BUTTON_HILITE );
|
||||
GadgetButtonSetHiliteImage( dropDownButton, info->image );
|
||||
GadgetButtonSetHiliteColor( dropDownButton, info->color );
|
||||
GadgetButtonSetHiliteBorderColor( dropDownButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED );
|
||||
GadgetButtonSetHiliteSelectedImage( dropDownButton, info->image );
|
||||
GadgetButtonSetHiliteSelectedColor( dropDownButton, info->color );
|
||||
GadgetButtonSetHiliteSelectedBorderColor( dropDownButton, info->borderColor );
|
||||
}
|
||||
|
||||
GameWindow *editBox = GadgetComboBoxGetEditBox( window );
|
||||
if (editBox)
|
||||
{
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_ENABLED_LEFT );
|
||||
GadgetTextEntrySetEnabledImageLeft( editBox, info->image );
|
||||
GadgetTextEntrySetEnabledColor( editBox, info->color );
|
||||
GadgetTextEntrySetEnabledBorderColor( editBox, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_ENABLED_RIGHT );
|
||||
GadgetTextEntrySetEnabledImageRight( editBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_ENABLED_CENTER );
|
||||
GadgetTextEntrySetEnabledImageCenter( editBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_ENABLED_SMALL_CENTER );
|
||||
GadgetTextEntrySetEnabledImageSmallCenter( editBox, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_DISABLED_LEFT );
|
||||
GadgetTextEntrySetDisabledImageLeft( editBox, info->image );
|
||||
GadgetTextEntrySetDisabledColor( editBox, info->color );
|
||||
GadgetTextEntrySetDisabledBorderColor( editBox, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_DISABLED_RIGHT );
|
||||
GadgetTextEntrySetDisabledImageRight( editBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_DISABLED_CENTER );
|
||||
GadgetTextEntrySetDisabledImageCenter( editBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_DISABLED_SMALL_CENTER );
|
||||
GadgetTextEntrySetDisabledImageSmallCenter( editBox, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_HILITE_LEFT );
|
||||
GadgetTextEntrySetHiliteImageLeft( editBox, info->image );
|
||||
GadgetTextEntrySetHiliteColor( editBox, info->color );
|
||||
GadgetTextEntrySetHiliteBorderColor( editBox, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_HILITE_RIGHT );
|
||||
GadgetTextEntrySetHiliteImageRight( editBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_HILITE_CENTER );
|
||||
GadgetTextEntrySetHiliteImageCenter( editBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER );
|
||||
GadgetTextEntrySetHiliteImageSmallCenter( editBox, info->image );
|
||||
|
||||
}
|
||||
|
||||
GameWindow *listBox = GadgetComboBoxGetListBox( window );
|
||||
if (listBox)
|
||||
{
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_ENABLED );
|
||||
GadgetListBoxSetEnabledImage( listBox, info->image );
|
||||
GadgetListBoxSetEnabledColor( listBox, info->color );
|
||||
GadgetListBoxSetEnabledBorderColor( listBox, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT );
|
||||
GadgetListBoxSetEnabledSelectedItemImageLeft( listBox, info->image );
|
||||
GadgetListBoxSetEnabledSelectedItemColor( listBox, info->color );
|
||||
GadgetListBoxSetEnabledSelectedItemBorderColor( listBox, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_RIGHT );
|
||||
GadgetListBoxSetEnabledSelectedItemImageRight( listBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_CENTER );
|
||||
GadgetListBoxSetEnabledSelectedItemImageCenter( listBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetListBoxSetEnabledSelectedItemImageSmallCenter( listBox, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DISABLED );
|
||||
GadgetListBoxSetDisabledImage( listBox, info->image );
|
||||
GadgetListBoxSetDisabledColor( listBox, info->color );
|
||||
GadgetListBoxSetDisabledBorderColor( listBox, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT );
|
||||
GadgetListBoxSetDisabledSelectedItemImageLeft( listBox, info->image );
|
||||
GadgetListBoxSetDisabledSelectedItemColor( listBox, info->color );
|
||||
GadgetListBoxSetDisabledSelectedItemBorderColor( listBox, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_RIGHT );
|
||||
GadgetListBoxSetDisabledSelectedItemImageRight( listBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_CENTER );
|
||||
GadgetListBoxSetDisabledSelectedItemImageCenter( listBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetListBoxSetDisabledSelectedItemImageSmallCenter( listBox, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_HILITE );
|
||||
GadgetListBoxSetHiliteImage( listBox, info->image );
|
||||
GadgetListBoxSetHiliteColor( listBox, info->color );
|
||||
GadgetListBoxSetHiliteBorderColor( listBox, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT );
|
||||
GadgetListBoxSetHiliteSelectedItemImageLeft( listBox, info->image );
|
||||
GadgetListBoxSetHiliteSelectedItemColor( listBox, info->color );
|
||||
GadgetListBoxSetHiliteSelectedItemBorderColor( listBox, info->borderColor );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_RIGHT );
|
||||
GadgetListBoxSetHiliteSelectedItemImageRight( listBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_CENTER );
|
||||
GadgetListBoxSetHiliteSelectedItemImageCenter( listBox, info->image );
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetListBoxSetHiliteSelectedItemImageSmallCenter( listBox, info->image );
|
||||
|
||||
// up button
|
||||
GameWindow *upButton = GadgetListBoxGetUpButton( listBox );
|
||||
if( upButton )
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_UP_BUTTON_ENABLED );
|
||||
GadgetButtonSetEnabledImage( upButton, info->image );
|
||||
GadgetButtonSetEnabledColor( upButton, info->color );
|
||||
GadgetButtonSetEnabledBorderColor( upButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED );
|
||||
GadgetButtonSetEnabledSelectedImage( upButton, info->image );
|
||||
GadgetButtonSetEnabledSelectedColor( upButton, info->color );
|
||||
GadgetButtonSetEnabledSelectedBorderColor( upButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_UP_BUTTON_DISABLED );
|
||||
GadgetButtonSetDisabledImage( upButton, info->image );
|
||||
GadgetButtonSetDisabledColor( upButton, info->color );
|
||||
GadgetButtonSetDisabledBorderColor( upButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED );
|
||||
GadgetButtonSetDisabledSelectedImage( upButton, info->image );
|
||||
GadgetButtonSetDisabledSelectedColor( upButton, info->color );
|
||||
GadgetButtonSetDisabledSelectedBorderColor( upButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_UP_BUTTON_HILITE );
|
||||
GadgetButtonSetHiliteImage( upButton, info->image );
|
||||
GadgetButtonSetHiliteColor( upButton, info->color );
|
||||
GadgetButtonSetHiliteBorderColor( upButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED );
|
||||
GadgetButtonSetHiliteSelectedImage( upButton, info->image );
|
||||
GadgetButtonSetHiliteSelectedColor( upButton, info->color );
|
||||
GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
// down button
|
||||
GameWindow *downButton = GadgetListBoxGetDownButton( listBox );
|
||||
if( downButton )
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED );
|
||||
GadgetButtonSetEnabledImage( downButton, info->image );
|
||||
GadgetButtonSetEnabledColor( downButton, info->color );
|
||||
GadgetButtonSetEnabledBorderColor( downButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED );
|
||||
GadgetButtonSetEnabledSelectedImage( downButton, info->image );
|
||||
GadgetButtonSetEnabledSelectedColor( downButton, info->color );
|
||||
GadgetButtonSetEnabledSelectedBorderColor( downButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED );
|
||||
GadgetButtonSetDisabledImage( downButton, info->image );
|
||||
GadgetButtonSetDisabledColor( downButton, info->color );
|
||||
GadgetButtonSetDisabledBorderColor( downButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED );
|
||||
GadgetButtonSetDisabledSelectedImage( downButton, info->image );
|
||||
GadgetButtonSetDisabledSelectedColor( downButton, info->color );
|
||||
GadgetButtonSetDisabledSelectedBorderColor( downButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE );
|
||||
GadgetButtonSetHiliteImage( downButton, info->image );
|
||||
GadgetButtonSetHiliteColor( downButton, info->color );
|
||||
GadgetButtonSetHiliteBorderColor( downButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED );
|
||||
GadgetButtonSetHiliteSelectedImage( downButton, info->image );
|
||||
GadgetButtonSetHiliteSelectedColor( downButton, info->color );
|
||||
GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
// slider
|
||||
GameWindow *slider = GadgetListBoxGetSlider( listBox );
|
||||
if( slider )
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP );
|
||||
GadgetSliderSetEnabledImageTop( slider, info->image );
|
||||
GadgetSliderSetEnabledColor( slider, info->color );
|
||||
GadgetSliderSetEnabledBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_ENABLED_BOTTOM );
|
||||
GadgetSliderSetEnabledImageBottom( slider, info->image );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_ENABLED_CENTER );
|
||||
GadgetSliderSetEnabledImageCenter( slider, info->image );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_ENABLED_SMALL_CENTER );
|
||||
GadgetSliderSetEnabledImageSmallCenter( slider, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP );
|
||||
GadgetSliderSetDisabledImageTop( slider, info->image );
|
||||
GadgetSliderSetDisabledColor( slider, info->color );
|
||||
GadgetSliderSetDisabledBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_DISABLED_BOTTOM );
|
||||
GadgetSliderSetDisabledImageBottom( slider, info->image );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_DISABLED_CENTER );
|
||||
GadgetSliderSetDisabledImageCenter( slider, info->image );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_DISABLED_SMALL_CENTER );
|
||||
GadgetSliderSetDisabledImageSmallCenter( slider, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_HILITE_TOP );
|
||||
GadgetSliderSetHiliteImageTop( slider, info->image );
|
||||
GadgetSliderSetHiliteColor( slider, info->color );
|
||||
GadgetSliderSetHiliteBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_HILITE_BOTTOM );
|
||||
GadgetSliderSetHiliteImageBottom( slider, info->image );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_HILITE_CENTER );
|
||||
GadgetSliderSetHiliteImageCenter( slider, info->image );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_HILITE_SMALL_CENTER );
|
||||
GadgetSliderSetHiliteImageSmallCenter( slider, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED );
|
||||
GadgetSliderSetEnabledThumbImage( slider, info->image );
|
||||
GadgetSliderSetEnabledThumbColor( slider, info->color );
|
||||
GadgetSliderSetEnabledThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED );
|
||||
GadgetSliderSetEnabledSelectedThumbImage( slider, info->image );
|
||||
GadgetSliderSetEnabledSelectedThumbColor( slider, info->color );
|
||||
GadgetSliderSetEnabledSelectedThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED );
|
||||
GadgetSliderSetDisabledThumbImage( slider, info->image );
|
||||
GadgetSliderSetDisabledThumbColor( slider, info->color );
|
||||
GadgetSliderSetDisabledThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED );
|
||||
GadgetSliderSetDisabledSelectedThumbImage( slider, info->image );
|
||||
GadgetSliderSetDisabledSelectedThumbColor( slider, info->color );
|
||||
GadgetSliderSetDisabledSelectedThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE );
|
||||
GadgetSliderSetHiliteThumbImage( slider, info->image );
|
||||
GadgetSliderSetHiliteThumbColor( slider, info->color );
|
||||
GadgetSliderSetHiliteThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED );
|
||||
GadgetSliderSetHiliteSelectedThumbImage( slider, info->image );
|
||||
GadgetSliderSetHiliteSelectedThumbColor( slider, info->color );
|
||||
GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
} // end if
|
||||
} // end if (listBox)
|
||||
// save specific list data
|
||||
ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData();
|
||||
|
||||
GadgetComboBoxSetIsEditable(window, IsDlgButtonChecked( hWndDialog, CHECK_IS_EDITABLE ));
|
||||
GadgetComboBoxSetAsciiOnly(window, IsDlgButtonChecked( hWndDialog, CHECK_ASCII_TEXT ));
|
||||
GadgetComboBoxSetLettersAndNumbersOnly(window, IsDlgButtonChecked( hWndDialog, CHECK_LETTERS_AND_NUMBERS ));
|
||||
|
||||
// change in the size of the comboBox
|
||||
Int newMaxChars = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, NULL, FALSE );
|
||||
if( newMaxChars != comboData->maxChars)
|
||||
GadgetComboBoxSetMaxChars( window, newMaxChars );
|
||||
|
||||
Int newMaxDisplay = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS_DISPLAYED, NULL, FALSE );
|
||||
if( newMaxDisplay != comboData->maxDisplay )
|
||||
GadgetComboBoxSetMaxDisplay( window, newMaxDisplay );
|
||||
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end comboBoxPropertiesCallback
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitComboBoxPropertiesDialog ================================================
|
||||
/** Bring up the comboBox properties window */
|
||||
//=============================================================================
|
||||
HWND InitComboBoxPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)COMBO_BOX_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)comboBoxPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this combo Box
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetComboBoxGetEnabledImage( window );
|
||||
color = GadgetComboBoxGetEnabledColor( window );
|
||||
borderColor = GadgetComboBoxGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( COMBOBOX_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetComboBoxGetEnabledSelectedItemImageLeft( window );
|
||||
color = GadgetComboBoxGetEnabledSelectedItemColor( window );
|
||||
borderColor = GadgetComboBoxGetEnabledSelectedItemBorderColor( window );
|
||||
StoreImageAndColor( COMBOBOX_ENABLED_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetComboBoxGetEnabledSelectedItemImageRight( window );
|
||||
StoreImageAndColor( COMBOBOX_ENABLED_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetComboBoxGetEnabledSelectedItemImageCenter( window );
|
||||
StoreImageAndColor( COMBOBOX_ENABLED_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetComboBoxGetEnabledSelectedItemImageSmallCenter( window );
|
||||
StoreImageAndColor( COMBOBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetComboBoxGetDisabledImage( window );
|
||||
color = GadgetComboBoxGetDisabledColor( window );
|
||||
borderColor = GadgetComboBoxGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( COMBOBOX_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetComboBoxGetDisabledSelectedItemImageLeft( window );
|
||||
color = GadgetComboBoxGetDisabledSelectedItemColor( window );
|
||||
borderColor = GadgetComboBoxGetDisabledSelectedItemBorderColor( window );
|
||||
StoreImageAndColor( COMBOBOX_DISABLED_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetComboBoxGetDisabledSelectedItemImageRight( window );
|
||||
StoreImageAndColor( COMBOBOX_DISABLED_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetComboBoxGetDisabledSelectedItemImageCenter( window );
|
||||
StoreImageAndColor( COMBOBOX_DISABLED_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetComboBoxGetDisabledSelectedItemImageSmallCenter( window );
|
||||
StoreImageAndColor( COMBOBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetComboBoxGetHiliteImage( window );
|
||||
color = GadgetComboBoxGetHiliteColor( window );
|
||||
borderColor = GadgetComboBoxGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( COMBOBOX_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetComboBoxGetHiliteSelectedItemImageLeft( window );
|
||||
color = GadgetComboBoxGetHiliteSelectedItemColor( window );
|
||||
borderColor = GadgetComboBoxGetHiliteSelectedItemBorderColor( window );
|
||||
StoreImageAndColor( COMBOBOX_HILITE_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetComboBoxGetHiliteSelectedItemImageRight( window );
|
||||
StoreImageAndColor( COMBOBOX_HILITE_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetComboBoxGetHiliteSelectedItemImageCenter( window );
|
||||
StoreImageAndColor( COMBOBOX_HILITE_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetComboBoxGetHiliteSelectedItemImageSmallCenter( window );
|
||||
StoreImageAndColor( COMBOBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
GameWindow *listBox = GadgetComboBoxGetListBox( window );
|
||||
if (listBox)
|
||||
{
|
||||
image = GadgetListBoxGetEnabledSelectedItemImageLeft( listBox );
|
||||
color = GadgetListBoxGetEnabledSelectedItemColor( listBox );
|
||||
borderColor = GadgetListBoxGetEnabledSelectedItemBorderColor( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetListBoxGetEnabledSelectedItemImageRight( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetEnabledSelectedItemImageCenter( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetEnabledSelectedItemImageSmallCenter( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetListBoxGetDisabledImage( listBox );
|
||||
color = GadgetListBoxGetDisabledColor( listBox );
|
||||
borderColor = GadgetListBoxGetDisabledBorderColor( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetListBoxGetDisabledSelectedItemImageLeft( listBox );
|
||||
color = GadgetListBoxGetDisabledSelectedItemColor( listBox );
|
||||
borderColor = GadgetListBoxGetDisabledSelectedItemBorderColor( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetListBoxGetDisabledSelectedItemImageRight( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetDisabledSelectedItemImageCenter( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetDisabledSelectedItemImageSmallCenter( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetListBoxGetHiliteImage( listBox );
|
||||
color = GadgetListBoxGetHiliteColor( listBox );
|
||||
borderColor = GadgetListBoxGetHiliteBorderColor( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetListBoxGetHiliteSelectedItemImageLeft( listBox );
|
||||
color = GadgetListBoxGetHiliteSelectedItemColor( listBox );
|
||||
borderColor = GadgetListBoxGetHiliteSelectedItemBorderColor( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetListBoxGetHiliteSelectedItemImageRight( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetHiliteSelectedItemImageCenter( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetHiliteSelectedItemImageSmallCenter( listBox );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
GameWindow *upButton = GadgetListBoxGetUpButton( listBox );
|
||||
if( upButton )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetEnabledImage( upButton );
|
||||
color = GadgetButtonGetEnabledColor( upButton );
|
||||
borderColor = GadgetButtonGetEnabledBorderColor( upButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_UP_BUTTON_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetEnabledSelectedImage( upButton );
|
||||
color = GadgetButtonGetEnabledSelectedColor( upButton );
|
||||
borderColor = GadgetButtonGetEnabledSelectedBorderColor( upButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_UP_BUTTON_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetDisabledImage( upButton );
|
||||
color = GadgetButtonGetDisabledColor( upButton );
|
||||
borderColor = GadgetButtonGetDisabledBorderColor( upButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_UP_BUTTON_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetDisabledSelectedImage( upButton );
|
||||
color = GadgetButtonGetDisabledSelectedColor( upButton );
|
||||
borderColor = GadgetButtonGetDisabledSelectedBorderColor( upButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_UP_BUTTON_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetHiliteImage( upButton );
|
||||
color = GadgetButtonGetHiliteColor( upButton );
|
||||
borderColor = GadgetButtonGetHiliteBorderColor( upButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_UP_BUTTON_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetHiliteSelectedImage( upButton );
|
||||
color = GadgetButtonGetHiliteSelectedColor( upButton );
|
||||
borderColor = GadgetButtonGetHiliteSelectedBorderColor( upButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_UP_BUTTON_HILITE_PUSHED, image, color, borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
GameWindow *downButton = GadgetListBoxGetDownButton( listBox );
|
||||
if( downButton )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetEnabledImage( downButton );
|
||||
color = GadgetButtonGetEnabledColor( downButton );
|
||||
borderColor = GadgetButtonGetEnabledBorderColor( downButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetEnabledSelectedImage( downButton );
|
||||
color = GadgetButtonGetEnabledSelectedColor( downButton );
|
||||
borderColor = GadgetButtonGetEnabledSelectedBorderColor( downButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetDisabledImage( downButton );
|
||||
color = GadgetButtonGetDisabledColor( downButton );
|
||||
borderColor = GadgetButtonGetDisabledBorderColor( downButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetDisabledSelectedImage( downButton );
|
||||
color = GadgetButtonGetDisabledSelectedColor( downButton );
|
||||
borderColor = GadgetButtonGetDisabledSelectedBorderColor( downButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetHiliteImage( downButton );
|
||||
color = GadgetButtonGetHiliteColor( downButton );
|
||||
borderColor = GadgetButtonGetHiliteBorderColor( downButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetHiliteSelectedImage( downButton );
|
||||
color = GadgetButtonGetHiliteSelectedColor( downButton );
|
||||
borderColor = GadgetButtonGetHiliteSelectedBorderColor( downButton );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_DOWN_BUTTON_HILITE_PUSHED, image, color, borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
GameWindow *slider = GadgetListBoxGetSlider( listBox );
|
||||
if( slider )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetEnabledImageTop( slider );
|
||||
color = GadgetSliderGetEnabledColor( slider );
|
||||
borderColor = GadgetSliderGetEnabledBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_ENABLED_TOP, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledImageBottom( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_ENABLED_BOTTOM, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledImageCenter( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_ENABLED_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledImageSmallCenter( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_ENABLED_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetDisabledImageTop( slider );
|
||||
color = GadgetSliderGetDisabledColor( slider );
|
||||
borderColor = GadgetSliderGetDisabledBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_DISABLED_TOP, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledImageBottom( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_DISABLED_BOTTOM, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledImageCenter( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_DISABLED_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledImageSmallCenter( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_DISABLED_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetHiliteImageTop( slider );
|
||||
color = GadgetSliderGetHiliteColor( slider );
|
||||
borderColor = GadgetSliderGetHiliteBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_HILITE_TOP, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteImageBottom( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_HILITE_BOTTOM, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteImageCenter( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_HILITE_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteImageSmallCenter( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_HILITE_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetEnabledThumbImage( slider );
|
||||
color = GadgetSliderGetEnabledThumbColor( slider );
|
||||
borderColor = GadgetSliderGetEnabledThumbBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledSelectedThumbImage( slider );
|
||||
color = GadgetSliderGetEnabledSelectedThumbColor( slider );
|
||||
borderColor = GadgetSliderGetEnabledSelectedThumbBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetDisabledThumbImage( slider );
|
||||
color = GadgetSliderGetDisabledThumbColor( slider );
|
||||
borderColor = GadgetSliderGetDisabledThumbBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledSelectedThumbImage( slider );
|
||||
color = GadgetSliderGetDisabledSelectedThumbColor( slider );
|
||||
borderColor = GadgetSliderGetDisabledSelectedThumbBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetHiliteThumbImage( slider );
|
||||
color = GadgetSliderGetHiliteThumbColor( slider );
|
||||
borderColor = GadgetSliderGetHiliteThumbBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteSelectedThumbImage( slider );
|
||||
color = GadgetSliderGetHiliteSelectedThumbColor( slider );
|
||||
borderColor = GadgetSliderGetHiliteSelectedThumbBorderColor( slider );
|
||||
StoreImageAndColor( COMBOBOX_LISTBOX_SLIDER_THUMB_HILITE_PUSHED, image, color, borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton( window );
|
||||
if ( dropDownButton )
|
||||
{
|
||||
image = GadgetButtonGetEnabledImage( dropDownButton );
|
||||
color = GadgetButtonGetEnabledColor( dropDownButton );
|
||||
borderColor = GadgetButtonGetEnabledBorderColor( dropDownButton );
|
||||
StoreImageAndColor( COMBOBOX_DROP_DOWN_BUTTON_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetEnabledSelectedImage(dropDownButton );
|
||||
color = GadgetButtonGetEnabledSelectedColor( dropDownButton );
|
||||
borderColor = GadgetButtonGetEnabledSelectedBorderColor( dropDownButton );
|
||||
StoreImageAndColor( COMBOBOX_DROP_DOWN_BUTTON_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetDisabledImage( dropDownButton );
|
||||
color = GadgetButtonGetDisabledColor( dropDownButton );
|
||||
borderColor = GadgetButtonGetDisabledBorderColor( dropDownButton );
|
||||
StoreImageAndColor( COMBOBOX_DROP_DOWN_BUTTON_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetDisabledSelectedImage( dropDownButton );
|
||||
color = GadgetButtonGetDisabledSelectedColor( dropDownButton );
|
||||
borderColor = GadgetButtonGetDisabledSelectedBorderColor( dropDownButton );
|
||||
StoreImageAndColor( COMBOBOX_DROP_DOWN_BUTTON_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetHiliteImage( dropDownButton );
|
||||
color = GadgetButtonGetHiliteColor( dropDownButton );
|
||||
borderColor = GadgetButtonGetHiliteBorderColor( dropDownButton );
|
||||
StoreImageAndColor( COMBOBOX_DROP_DOWN_BUTTON_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetHiliteSelectedImage( dropDownButton );
|
||||
color = GadgetButtonGetHiliteSelectedColor( dropDownButton );
|
||||
borderColor = GadgetButtonGetHiliteSelectedBorderColor( dropDownButton );
|
||||
StoreImageAndColor( COMBOBOX_DROP_DOWN_BUTTON_HILITE_PUSHED, image, color, borderColor );
|
||||
}
|
||||
GameWindow * editBox = GadgetComboBoxGetEditBox( window );
|
||||
if ( editBox )
|
||||
{
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetTextEntryGetEnabledImageLeft( editBox );
|
||||
color = GadgetTextEntryGetEnabledColor( editBox );
|
||||
borderColor = GadgetTextEntryGetEnabledBorderColor( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_ENABLED_LEFT, image, color, borderColor );
|
||||
image = GadgetTextEntryGetEnabledImageRight( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_ENABLED_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetEnabledImageCenter( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_ENABLED_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetEnabledImageSmallCenter( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_ENABLED_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetTextEntryGetDisabledImageLeft( editBox );
|
||||
color = GadgetTextEntryGetDisabledColor( editBox );
|
||||
borderColor = GadgetTextEntryGetDisabledBorderColor( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_DISABLED_LEFT, image, color, borderColor );
|
||||
image = GadgetTextEntryGetDisabledImageRight( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_DISABLED_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetDisabledImageCenter( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_DISABLED_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetDisabledImageSmallCenter( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_DISABLED_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetTextEntryGetHiliteImageLeft( editBox );
|
||||
color = GadgetTextEntryGetHiliteColor( editBox );
|
||||
borderColor = GadgetTextEntryGetHiliteBorderColor( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_HILITE_LEFT, image, color, borderColor );
|
||||
image = GadgetTextEntryGetHiliteImageRight( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_HILITE_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetHiliteImageCenter( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_HILITE_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetHiliteImageSmallCenter( editBox );
|
||||
StoreImageAndColor( COMBOBOX_EDIT_BOX_HILITE_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// init comboBox specific property section
|
||||
ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData();
|
||||
|
||||
SetDlgItemInt(dialog, EDIT_MAX_CHARS, comboData->maxChars, true);
|
||||
SetDlgItemInt(dialog, EDIT_MAX_ITEMS_DISPLAYED, comboData->maxDisplay,true );
|
||||
CheckDlgButton( dialog, CHECK_IS_EDITABLE, comboData->isEditable);
|
||||
CheckDlgButton( dialog, CHECK_ASCII_TEXT ,comboData->asciiOnly);
|
||||
CheckDlgButton( dialog, CHECK_LETTERS_AND_NUMBERS, comboData->lettersAndNumbersOnly);
|
||||
|
||||
// select the button enabled state for display
|
||||
SwitchToState( COMBOBOX_ENABLED, dialog );
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitComboBoxPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,485 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: GenericProperties.cpp ////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: GenericProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Properties dialog for generic windows
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Common/Debug.h"
|
||||
#include "Common/FunctionLexicon.h"
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "EditWindow.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// genericPropertiesCallback ==================================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK genericPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
UINT controlID = (UINT)wParam; // control identifier
|
||||
LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing
|
||||
RGBColorInt *color = GetControlColor( controlID );
|
||||
|
||||
// we only care about color button controls
|
||||
if( color )
|
||||
{
|
||||
HBRUSH hBrushNew, hBrushOld;
|
||||
RECT rect;
|
||||
HWND hWndControl = GetDlgItem( hWndDialog, controlID );
|
||||
|
||||
// if this control is disabled just let windows handle drawing
|
||||
if( IsWindowEnabled( hWndControl ) == FALSE )
|
||||
return FALSE;
|
||||
|
||||
// Get the area we have to draw in
|
||||
GetClientRect( hWndControl, &rect );
|
||||
|
||||
// create a new brush and select it into DC
|
||||
hBrushNew = CreateSolidBrush (RGB ((BYTE)color->red,
|
||||
(BYTE)color->green,
|
||||
(BYTE)color->blue));
|
||||
hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew );
|
||||
|
||||
// draw the rectangle
|
||||
Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom );
|
||||
|
||||
// put the old brush back and delete the new one
|
||||
SelectObject( drawItem->hDC, hBrushOld );
|
||||
DeleteObject( hBrushNew );
|
||||
|
||||
// validate this new area
|
||||
ValidateRect( hWndControl, NULL );
|
||||
|
||||
// we have taken care of it
|
||||
return TRUE;
|
||||
|
||||
} // end if
|
||||
|
||||
return FALSE;
|
||||
|
||||
} // end draw item
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_ENABLED_COLOR:
|
||||
case BUTTON_ENABLED_BORDER_COLOR:
|
||||
case BUTTON_DISABLED_COLOR:
|
||||
case BUTTON_DISABLED_BORDER_COLOR:
|
||||
case BUTTON_HILITE_COLOR:
|
||||
case BUTTON_HILITE_BORDER_COLOR:
|
||||
{
|
||||
RGBColorInt *currColor = GetControlColor( controlID );
|
||||
|
||||
// bring up color selector for this color control at the mouse
|
||||
if( currColor )
|
||||
{
|
||||
RGBColorInt *newColor;
|
||||
POINT mouse;
|
||||
|
||||
GetCursorPos( &mouse );
|
||||
newColor = SelectColor( currColor->red, currColor->green,
|
||||
currColor->blue, currColor->alpha,
|
||||
mouse.x, mouse.y );
|
||||
|
||||
if( newColor )
|
||||
{
|
||||
Color newGameColor = GameMakeColor( newColor->red,
|
||||
newColor->green,
|
||||
newColor->blue,
|
||||
newColor->alpha );
|
||||
SetControlColor( controlID, newGameColor );
|
||||
InvalidateRect( hWndControl, NULL, TRUE );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
break;
|
||||
|
||||
} // end color buttons
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
const Image *image;
|
||||
RGBColorInt *rgbColor;
|
||||
Color color;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save callbacks
|
||||
SaveCallbacks( window, hWndDialog );
|
||||
|
||||
// save the enabled colors/images
|
||||
image = ComboBoxSelectionToImage( GetDlgItem( hWndDialog, COMBO_ENABLED_IMAGE ) );
|
||||
window->winSetEnabledImage( 0, image );
|
||||
rgbColor = GetControlColor( BUTTON_ENABLED_COLOR );
|
||||
color = GameMakeColor( rgbColor->red, rgbColor->green, rgbColor->blue, rgbColor->alpha );
|
||||
window->winSetEnabledColor( 0, color );
|
||||
rgbColor = GetControlColor( BUTTON_ENABLED_BORDER_COLOR );
|
||||
color = GameMakeColor( rgbColor->red, rgbColor->green, rgbColor->blue, rgbColor->alpha );
|
||||
window->winSetEnabledBorderColor( 0, color );
|
||||
|
||||
// save the disabled colors/images
|
||||
image = ComboBoxSelectionToImage( GetDlgItem( hWndDialog, COMBO_DISABLED_IMAGE ) );
|
||||
window->winSetDisabledImage( 0, image );
|
||||
rgbColor = GetControlColor( BUTTON_DISABLED_COLOR );
|
||||
color = GameMakeColor( rgbColor->red, rgbColor->green, rgbColor->blue, rgbColor->alpha );
|
||||
window->winSetDisabledColor( 0, color );
|
||||
rgbColor = GetControlColor( BUTTON_DISABLED_BORDER_COLOR );
|
||||
color = GameMakeColor( rgbColor->red, rgbColor->green, rgbColor->blue, rgbColor->alpha );
|
||||
window->winSetDisabledBorderColor( 0, color );
|
||||
|
||||
// save the hilite colors/images
|
||||
image = ComboBoxSelectionToImage( GetDlgItem( hWndDialog, COMBO_HILITE_IMAGE ) );
|
||||
window->winSetHiliteImage( 0, image );
|
||||
rgbColor = GetControlColor( BUTTON_HILITE_COLOR );
|
||||
color = GameMakeColor( rgbColor->red, rgbColor->green, rgbColor->blue, rgbColor->alpha );
|
||||
window->winSetHiliteColor( 0, color );
|
||||
rgbColor = GetControlColor( BUTTON_HILITE_BORDER_COLOR );
|
||||
color = GameMakeColor( rgbColor->red, rgbColor->green, rgbColor->blue, rgbColor->alpha );
|
||||
window->winSetHiliteBorderColor( 0, color );
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end genericPropertiesCallback
|
||||
|
||||
// InitCallbackCombos =========================================================
|
||||
/** load the callbacks combo boxes with the functions that the user cal
|
||||
* select to attach to this window */
|
||||
//=============================================================================
|
||||
void InitCallbackCombos( HWND dialog, GameWindow *window )
|
||||
{
|
||||
HWND combo;
|
||||
FunctionLexicon::TableEntry *entry;
|
||||
GameWindowEditData *editData = NULL;
|
||||
AsciiString name;
|
||||
|
||||
// get edit data from window
|
||||
if( window )
|
||||
editData = window->winGetEditData();
|
||||
|
||||
// load the system combo ----------------------------------------------------
|
||||
combo = GetDlgItem( dialog, COMBO_SYSTEM );
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_GAME_WIN_SYSTEM );
|
||||
while( entry && entry ->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
} // end while
|
||||
SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING );
|
||||
|
||||
// select the current function of the window in the combo if present
|
||||
name.clear();
|
||||
if( editData )
|
||||
name = editData->systemCallbackString;
|
||||
if( name.isEmpty() )
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
// load the input combo -----------------------------------------------------
|
||||
combo = GetDlgItem( dialog, COMBO_INPUT );
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_GAME_WIN_INPUT );
|
||||
while( entry && entry ->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
} // end while
|
||||
SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING );
|
||||
|
||||
// select the current function of the window in the combo if present
|
||||
name.clear();
|
||||
if( editData )
|
||||
name = editData->inputCallbackString;
|
||||
if( name.isEmpty() )
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
// load the tooltip combo ---------------------------------------------------
|
||||
combo = GetDlgItem( dialog, COMBO_TOOLTIP );
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_GAME_WIN_TOOLTIP );
|
||||
while( entry && entry ->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
} // end while
|
||||
SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING );
|
||||
|
||||
// select the current function of the window in the combo if present
|
||||
name.clear();
|
||||
if( editData )
|
||||
name = editData->tooltipCallbackString;
|
||||
if( name.isEmpty() )
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
// load the draw combo ------------------------------------------------------
|
||||
combo = GetDlgItem( dialog, COMBO_DRAW );
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_GAME_WIN_DRAW );
|
||||
while( entry && entry ->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
} // end while
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_GAME_WIN_DEVICEDRAW );
|
||||
while( entry && entry ->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
} // end while
|
||||
SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING );
|
||||
|
||||
// select the current function of the window in the combo if present
|
||||
name.clear();
|
||||
if( editData )
|
||||
name = editData->drawCallbackString;
|
||||
if( name.isEmpty() )
|
||||
name = GUIEDIT_NONE_STRING;
|
||||
SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
//=================================================================================================
|
||||
// callbacks for the layout itself
|
||||
//=================================================================================================
|
||||
|
||||
// init combo
|
||||
combo = GetDlgItem( dialog, COMBO_INIT );
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_WIN_LAYOUT_INIT );
|
||||
while( entry && entry->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
}
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_WIN_LAYOUT_DEVICEINIT );
|
||||
while( entry && entry->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
}
|
||||
SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING );
|
||||
name = TheEditor->getLayoutInit();
|
||||
SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
// update combo
|
||||
combo = GetDlgItem( dialog, COMBO_UPDATE );
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_WIN_LAYOUT_UPDATE );
|
||||
while( entry && entry->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
}
|
||||
SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING );
|
||||
name = TheEditor->getLayoutUpdate();
|
||||
SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
// shutdown combo
|
||||
combo = GetDlgItem( dialog, COMBO_SHUTDOWN );
|
||||
entry = TheFunctionLexicon->getTable( FunctionLexicon::TABLE_WIN_LAYOUT_SHUTDOWN );
|
||||
while( entry && entry->key != NAMEKEY_INVALID )
|
||||
{
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)entry->name );
|
||||
entry++;
|
||||
}
|
||||
SendMessage( combo, CB_INSERTSTRING, 0, (LPARAM)GUIEDIT_NONE_STRING );
|
||||
name = TheEditor->getLayoutShutdown();
|
||||
SendMessage( combo, CB_SELECTSTRING, -1, (LPARAM)name.str() );
|
||||
|
||||
} // end InitCallbackCombos
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitUserWinPropertiesDialog ================================================
|
||||
/** Initialize the generic properties dialog for windows */
|
||||
//=============================================================================
|
||||
HWND InitUserWinPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)GENERIC_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)genericPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
// fill out the image combo boxes
|
||||
LoadImageListComboBox( GetDlgItem( dialog, COMBO_ENABLED_IMAGE ) );
|
||||
LoadImageListComboBox( GetDlgItem( dialog, COMBO_DISABLED_IMAGE ) );
|
||||
LoadImageListComboBox( GetDlgItem( dialog, COMBO_HILITE_IMAGE ) );
|
||||
|
||||
// select any images in the combo boxes
|
||||
const Image *image;
|
||||
|
||||
image = window->winGetEnabledImage( 0 );
|
||||
if( image )
|
||||
SendDlgItemMessage( dialog, COMBO_ENABLED_IMAGE, CB_SELECTSTRING,
|
||||
-1, (LPARAM)image->getName().str() );
|
||||
image = window->winGetDisabledImage( 0 );
|
||||
if( image )
|
||||
SendDlgItemMessage( dialog, COMBO_DISABLED_IMAGE, CB_SELECTSTRING,
|
||||
-1, (LPARAM)image->getName().str() );
|
||||
image = window->winGetHiliteImage( 0 );
|
||||
if( image )
|
||||
SendDlgItemMessage( dialog, COMBO_HILITE_IMAGE, CB_SELECTSTRING,
|
||||
-1, (LPARAM)image->getName().str() );
|
||||
|
||||
// initialize the color buttons
|
||||
SetControlColor( BUTTON_ENABLED_COLOR, window->winGetEnabledColor( 0 ) );
|
||||
SetControlColor( BUTTON_ENABLED_BORDER_COLOR, window->winGetEnabledBorderColor( 0 ) );
|
||||
SetControlColor( BUTTON_DISABLED_COLOR, window->winGetDisabledColor( 0 ) );
|
||||
SetControlColor( BUTTON_DISABLED_BORDER_COLOR, window->winGetDisabledBorderColor( 0 ) );
|
||||
SetControlColor( BUTTON_HILITE_COLOR, window->winGetHiliteColor( 0 ) );
|
||||
SetControlColor( BUTTON_HILITE_BORDER_COLOR, window->winGetHiliteBorderColor( 0 ) );
|
||||
|
||||
// load the combo boxes with the callbacks the user can use
|
||||
InitCallbackCombos( dialog, window );
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitUserWinPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: GridSettings.cpp /////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: GridSettings.cpp
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: New layout dialog procedure
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Lib/BaseType.h"
|
||||
#include "Resource.h"
|
||||
#include "EditWindow.h"
|
||||
#include "GUIEdit.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static RGBColorInt gridColor = { 0 };
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// initGridSettings ===========================================================
|
||||
/** Initialize the dialog values */
|
||||
//=============================================================================
|
||||
static void initGridSettings( HWND hWndDialog )
|
||||
{
|
||||
|
||||
// set resolution
|
||||
SetDlgItemInt( hWndDialog, EDIT_RESOLUTION,
|
||||
TheEditor->getGridResolution(), FALSE );
|
||||
|
||||
// check box for on/off
|
||||
if( TheEditor->isGridVisible() == TRUE )
|
||||
CheckDlgButton( hWndDialog, CHECK_VISIBLE, BST_CHECKED );
|
||||
|
||||
// check box for grid snap on/off
|
||||
if( TheEditor->isGridSnapOn() == TRUE )
|
||||
CheckDlgButton( hWndDialog, CHECK_SNAP_TO_GRID, BST_CHECKED );
|
||||
|
||||
// style
|
||||
CheckDlgButton( hWndDialog, RADIO_LINES, BST_CHECKED );
|
||||
|
||||
// color
|
||||
RGBColorInt *color = TheEditor->getGridColor();
|
||||
gridColor = *color;
|
||||
|
||||
} // end initGridSettings
|
||||
|
||||
// GridSettingsDialogProc =====================================================
|
||||
/** Dialog procedure for grid settings dialog */
|
||||
//=============================================================================
|
||||
BOOL CALLBACK GridSettingsDialogProc( HWND hWndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
|
||||
// initialize the values for the the dialog
|
||||
initGridSettings( hWndDialog );
|
||||
return TRUE;
|
||||
|
||||
} // end init dialog
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
UINT controlID = (UINT)wParam; // control identifier
|
||||
LPDRAWITEMSTRUCT drawItem = (LPDRAWITEMSTRUCT)lParam; // item drawing
|
||||
RGBColorInt *color = &gridColor;
|
||||
|
||||
// we only care about color button controls
|
||||
if( color )
|
||||
{
|
||||
HBRUSH hBrushNew, hBrushOld;
|
||||
RECT rect;
|
||||
HWND hWndControl = GetDlgItem( hWndDialog, controlID );
|
||||
|
||||
// if this control is disabled just let windows handle drawing
|
||||
if( IsWindowEnabled( hWndControl ) == FALSE )
|
||||
return FALSE;
|
||||
|
||||
// Get the area we have to draw in
|
||||
GetClientRect( hWndControl, &rect );
|
||||
|
||||
// create a new brush and select it into DC
|
||||
hBrushNew = CreateSolidBrush (RGB ((BYTE)color->red,
|
||||
(BYTE)color->green,
|
||||
(BYTE)color->blue));
|
||||
hBrushOld = (HBRUSH)SelectObject( drawItem->hDC, hBrushNew );
|
||||
|
||||
// draw the rectangle
|
||||
Rectangle( drawItem->hDC, rect.left, rect.top, rect.right, rect.bottom );
|
||||
|
||||
// put the old brush back and delete the new one
|
||||
SelectObject( drawItem->hDC, hBrushOld );
|
||||
DeleteObject( hBrushNew );
|
||||
|
||||
// validate this new area
|
||||
ValidateRect( hWndControl, NULL );
|
||||
|
||||
// we have taken care of it
|
||||
return TRUE;
|
||||
|
||||
} // end if
|
||||
|
||||
return FALSE;
|
||||
|
||||
} // end draw item
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
// Int controlID = LOWORD( wParam ); // control ID
|
||||
HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( LOWORD( wParam ) )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_COLOR:
|
||||
{
|
||||
RGBColorInt *currColor = &gridColor;
|
||||
|
||||
// bring up color selector for this color control at the mouse
|
||||
if( currColor )
|
||||
{
|
||||
RGBColorInt *newColor;
|
||||
POINT mouse;
|
||||
|
||||
GetCursorPos( &mouse );
|
||||
newColor = SelectColor( currColor->red, currColor->green,
|
||||
currColor->blue, currColor->alpha,
|
||||
mouse.x, mouse.y );
|
||||
|
||||
if( newColor )
|
||||
{
|
||||
|
||||
gridColor = *newColor;
|
||||
InvalidateRect( hWndControl, NULL, TRUE );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
break;
|
||||
|
||||
} // end color buttons
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
Int value;
|
||||
|
||||
// get the pixels between marks
|
||||
value = GetDlgItemInt( hWndDialog, EDIT_RESOLUTION, NULL, FALSE );
|
||||
TheEditor->setGridResolution( value );
|
||||
|
||||
// get grid on/off flag
|
||||
value = IsDlgButtonChecked( hWndDialog, CHECK_VISIBLE );
|
||||
TheEditor->setGridVisible( value );
|
||||
|
||||
// get snap on/off flag
|
||||
value = IsDlgButtonChecked( hWndDialog, CHECK_SNAP_TO_GRID );
|
||||
TheEditor->setGridSnap( value );
|
||||
|
||||
// grid color
|
||||
TheEditor->setGridColor( &gridColor );
|
||||
|
||||
// end this dialog
|
||||
EndDialog( hWndDialog, TRUE );
|
||||
|
||||
break;
|
||||
|
||||
} // end ok
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
EndDialog( hWndDialog, FALSE );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
EndDialog( hWndDialog, FALSE );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end GridSettingsDialogProc
|
||||
|
|
@ -0,0 +1,972 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: ListboxProperties.cpp ////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: ListboxProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Listbox properties dialog
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "LayoutScheme.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetListBox.h"
|
||||
#include "GameClient/GadgetPushButton.h"
|
||||
#include "Gameclient/GadgetSlider.h"
|
||||
#include "GameClient/GameWindowManager.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// addScrollbar ===============================================================
|
||||
/** Add a scrollbar to a listbox window that doesn't have one */
|
||||
//=============================================================================
|
||||
static void addScrollbar( GameWindow *listbox )
|
||||
{
|
||||
|
||||
// create scrollbar stuffs
|
||||
GadgetListboxCreateScrollbar( listbox );
|
||||
|
||||
//
|
||||
// get the colors for the listbox and reset them to recolor the
|
||||
// newly created scrollbar parts
|
||||
//
|
||||
Color enabled = GadgetListBoxGetEnabledColor( listbox );
|
||||
Color enabledBorder = GadgetListBoxGetEnabledBorderColor( listbox );
|
||||
Color enabledSelectedItem = GadgetListBoxGetEnabledSelectedItemColor( listbox );
|
||||
Color enabledSelectedItemBorder = GadgetListBoxGetEnabledSelectedItemBorderColor( listbox );
|
||||
|
||||
Color disabled = GadgetListBoxGetDisabledColor( listbox );
|
||||
Color disabledBorder = GadgetListBoxGetDisabledBorderColor( listbox );
|
||||
Color disabledSelectedItem = GadgetListBoxGetDisabledSelectedItemColor( listbox );
|
||||
Color disabledSelectedItemBorder = GadgetListBoxGetDisabledSelectedItemBorderColor( listbox );
|
||||
|
||||
Color hilite = GadgetListBoxGetHiliteColor( listbox );
|
||||
Color hiliteBorder = GadgetListBoxGetHiliteBorderColor( listbox );
|
||||
Color hiliteSelectedItem = GadgetListBoxGetHiliteSelectedItemColor( listbox );
|
||||
Color hiliteSelectedItemBorder = GadgetListBoxGetHiliteSelectedItemBorderColor( listbox );
|
||||
|
||||
GadgetListBoxSetColors( listbox,
|
||||
enabled,
|
||||
enabledBorder,
|
||||
enabledSelectedItem,
|
||||
enabledSelectedItemBorder,
|
||||
disabled,
|
||||
disabledBorder,
|
||||
disabledSelectedItem,
|
||||
disabledSelectedItemBorder,
|
||||
hilite,
|
||||
hiliteBorder,
|
||||
hiliteSelectedItem,
|
||||
hiliteSelectedItemBorder );
|
||||
|
||||
//
|
||||
// now that colors are assigned based on the colors of the listbox
|
||||
// itself, assign the default listbox scroll images
|
||||
//
|
||||
ImageAndColorInfo *info;
|
||||
GameWindow *upButton = GadgetListBoxGetUpButton( listbox );
|
||||
if( upButton )
|
||||
{
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_UP_BUTTON_ENABLED );
|
||||
GadgetButtonSetEnabledImage( upButton, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_UP_BUTTON_ENABLED_PUSHED );
|
||||
GadgetButtonSetEnabledSelectedImage( upButton, info->image );
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_UP_BUTTON_DISABLED );
|
||||
GadgetButtonSetDisabledImage( upButton, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_UP_BUTTON_DISABLED_PUSHED );
|
||||
GadgetButtonSetDisabledSelectedImage( upButton, info->image );
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_UP_BUTTON_HILITE );
|
||||
GadgetButtonSetHiliteImage( upButton, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_UP_BUTTON_HILITE_PUSHED );
|
||||
GadgetButtonSetHiliteSelectedImage( upButton, info->image );
|
||||
|
||||
} // end if
|
||||
|
||||
GameWindow *downButton = GadgetListBoxGetDownButton( listbox );
|
||||
if( downButton )
|
||||
{
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_DOWN_BUTTON_ENABLED );
|
||||
GadgetButtonSetEnabledImage( downButton, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_DOWN_BUTTON_ENABLED_PUSHED );
|
||||
GadgetButtonSetEnabledSelectedImage( downButton, info->image );
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_DOWN_BUTTON_DISABLED );
|
||||
GadgetButtonSetDisabledImage( downButton, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_DOWN_BUTTON_DISABLED_PUSHED );
|
||||
GadgetButtonSetDisabledSelectedImage( downButton, info->image );
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_DOWN_BUTTON_HILITE );
|
||||
GadgetButtonSetHiliteImage( downButton, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_DOWN_BUTTON_HILITE_PUSHED );
|
||||
GadgetButtonSetHiliteSelectedImage( downButton, info->image );
|
||||
|
||||
} // end if
|
||||
|
||||
GameWindow *slider = GadgetListBoxGetSlider( listbox );
|
||||
if( slider )
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_ENABLED_TOP );
|
||||
GadgetSliderSetEnabledImageTop( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_ENABLED_BOTTOM );
|
||||
GadgetSliderSetEnabledImageBottom( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_ENABLED_CENTER );
|
||||
GadgetSliderSetEnabledImageCenter( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_ENABLED_SMALL_CENTER );
|
||||
GadgetSliderSetEnabledImageSmallCenter( slider, info->image );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_DISABLED_TOP );
|
||||
GadgetSliderSetDisabledImageTop( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_DISABLED_BOTTOM );
|
||||
GadgetSliderSetDisabledImageBottom( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_DISABLED_CENTER );
|
||||
GadgetSliderSetDisabledImageCenter( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_DISABLED_SMALL_CENTER );
|
||||
GadgetSliderSetDisabledImageSmallCenter( slider, info->image );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_HILITE_TOP );
|
||||
GadgetSliderSetHiliteImageTop( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_HILITE_BOTTOM );
|
||||
GadgetSliderSetHiliteImageBottom( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_HILITE_CENTER );
|
||||
GadgetSliderSetHiliteImageCenter( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_HILITE_SMALL_CENTER );
|
||||
GadgetSliderSetHiliteImageSmallCenter( slider, info->image );
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_THUMB_ENABLED );
|
||||
GadgetSliderSetEnabledThumbImage( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_THUMB_ENABLED_PUSHED );
|
||||
GadgetSliderSetEnabledSelectedThumbImage( slider, info->image );
|
||||
GadgetSliderSetEnabledSelectedThumbColor( slider, info->color );
|
||||
GadgetSliderSetEnabledSelectedThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_THUMB_DISABLED );
|
||||
GadgetSliderSetDisabledThumbImage( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_THUMB_DISABLED_PUSHED );
|
||||
GadgetSliderSetDisabledSelectedThumbImage( slider, info->image );
|
||||
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_THUMB_HILITE );
|
||||
GadgetSliderSetHiliteThumbImage( slider, info->image );
|
||||
info = TheDefaultScheme->getImageAndColor( LISTBOX_SLIDER_THUMB_HILITE_PUSHED );
|
||||
GadgetSliderSetHiliteSelectedThumbImage( slider, info->image );
|
||||
|
||||
} // end if, slider
|
||||
|
||||
} // end addScrollbar
|
||||
|
||||
// removeScrollbar ============================================================
|
||||
/** Remove all scrollbar constructs froma listbox that has it already */
|
||||
//=============================================================================
|
||||
static void removeScrollbar( GameWindow *listbox )
|
||||
{
|
||||
ListboxData *listData = (ListboxData *)listbox->winGetUserData();
|
||||
|
||||
// delete the up button
|
||||
TheWindowManager->winDestroy( listData->upButton );
|
||||
listData->upButton = NULL;
|
||||
|
||||
// delete down button
|
||||
TheWindowManager->winDestroy( listData->downButton );
|
||||
listData->downButton = NULL;
|
||||
|
||||
// delete the slider
|
||||
TheWindowManager->winDestroy( listData->slider );
|
||||
listData->slider = NULL;
|
||||
|
||||
// remove the scrollbar flag from the listbox data
|
||||
listData->scrollBar = FALSE;
|
||||
|
||||
} // end removeScrollbar
|
||||
|
||||
// resizeMaxItems =============================================================
|
||||
/** Change the max items that a listbox can accomodate */
|
||||
//=============================================================================
|
||||
static void resizeMaxItems( GameWindow *listbox, UnsignedInt newMaxItems )
|
||||
{
|
||||
// ListboxData *listData = (ListboxData *)listbox->winGetUserData();
|
||||
|
||||
|
||||
|
||||
} // end resizeMaxItems
|
||||
|
||||
// listboxPropertiesCallback ==================================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK listboxPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_SUBCONTROL_COLOR:
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
//
|
||||
// using the current colors in the base of the listbox, assign a
|
||||
// reasonable color scheme to all the sub control components
|
||||
//
|
||||
info = GetStateInfo( LISTBOX_ENABLED );
|
||||
StoreColor( LISTBOX_UP_BUTTON_ENABLED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_DOWN_BUTTON_ENABLED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_ENABLED_TOP, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_THUMB_ENABLED, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_ENABLED_SELECTED_ITEM_LEFT );
|
||||
StoreColor( LISTBOX_UP_BUTTON_ENABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_DISABLED );
|
||||
StoreColor( LISTBOX_UP_BUTTON_DISABLED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_DOWN_BUTTON_DISABLED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_DISABLED_TOP, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_THUMB_DISABLED, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_DISABLED_SELECTED_ITEM_LEFT );
|
||||
StoreColor( LISTBOX_UP_BUTTON_DISABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_HILITE );
|
||||
StoreColor( LISTBOX_UP_BUTTON_HILITE, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_DOWN_BUTTON_HILITE, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_HILITE_TOP, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_THUMB_HILITE, info->color, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_HILITE_SELECTED_ITEM_LEFT );
|
||||
StoreColor( LISTBOX_UP_BUTTON_HILITE_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_DOWN_BUTTON_HILITE_PUSHED, info->color, info->borderColor );
|
||||
StoreColor( LISTBOX_SLIDER_THUMB_HILITE_PUSHED, info->color, info->borderColor );
|
||||
|
||||
break;
|
||||
|
||||
} // end case subcontrol color
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_ENABLED );
|
||||
GadgetListBoxSetEnabledImage( window, info->image );
|
||||
GadgetListBoxSetEnabledColor( window, info->color );
|
||||
GadgetListBoxSetEnabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_ENABLED_SELECTED_ITEM_LEFT );
|
||||
GadgetListBoxSetEnabledSelectedItemImageLeft( window, info->image );
|
||||
GadgetListBoxSetEnabledSelectedItemColor( window, info->color );
|
||||
GadgetListBoxSetEnabledSelectedItemBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( LISTBOX_ENABLED_SELECTED_ITEM_RIGHT );
|
||||
GadgetListBoxSetEnabledSelectedItemImageRight( window, info->image );
|
||||
info = GetStateInfo( LISTBOX_ENABLED_SELECTED_ITEM_CENTER );
|
||||
GadgetListBoxSetEnabledSelectedItemImageCenter( window, info->image );
|
||||
info = GetStateInfo( LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetListBoxSetEnabledSelectedItemImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_DISABLED );
|
||||
GadgetListBoxSetDisabledImage( window, info->image );
|
||||
GadgetListBoxSetDisabledColor( window, info->color );
|
||||
GadgetListBoxSetDisabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_DISABLED_SELECTED_ITEM_LEFT );
|
||||
GadgetListBoxSetDisabledSelectedItemImageLeft( window, info->image );
|
||||
GadgetListBoxSetDisabledSelectedItemColor( window, info->color );
|
||||
GadgetListBoxSetDisabledSelectedItemBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( LISTBOX_DISABLED_SELECTED_ITEM_RIGHT );
|
||||
GadgetListBoxSetDisabledSelectedItemImageRight( window, info->image );
|
||||
info = GetStateInfo( LISTBOX_DISABLED_SELECTED_ITEM_CENTER );
|
||||
GadgetListBoxSetDisabledSelectedItemImageCenter( window, info->image );
|
||||
info = GetStateInfo( LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetListBoxSetDisabledSelectedItemImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_HILITE );
|
||||
GadgetListBoxSetHiliteImage( window, info->image );
|
||||
GadgetListBoxSetHiliteColor( window, info->color );
|
||||
GadgetListBoxSetHiliteBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_HILITE_SELECTED_ITEM_LEFT );
|
||||
GadgetListBoxSetHiliteSelectedItemImageLeft( window, info->image );
|
||||
GadgetListBoxSetHiliteSelectedItemColor( window, info->color );
|
||||
GadgetListBoxSetHiliteSelectedItemBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( LISTBOX_HILITE_SELECTED_ITEM_RIGHT );
|
||||
GadgetListBoxSetHiliteSelectedItemImageRight( window, info->image );
|
||||
info = GetStateInfo( LISTBOX_HILITE_SELECTED_ITEM_CENTER );
|
||||
GadgetListBoxSetHiliteSelectedItemImageCenter( window, info->image );
|
||||
info = GetStateInfo( LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER );
|
||||
GadgetListBoxSetHiliteSelectedItemImageSmallCenter( window, info->image );
|
||||
|
||||
// up button
|
||||
GameWindow *upButton = GadgetListBoxGetUpButton( window );
|
||||
if( upButton )
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_UP_BUTTON_ENABLED );
|
||||
GadgetButtonSetEnabledImage( upButton, info->image );
|
||||
GadgetButtonSetEnabledColor( upButton, info->color );
|
||||
GadgetButtonSetEnabledBorderColor( upButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_UP_BUTTON_ENABLED_PUSHED );
|
||||
GadgetButtonSetEnabledSelectedImage( upButton, info->image );
|
||||
GadgetButtonSetEnabledSelectedColor( upButton, info->color );
|
||||
GadgetButtonSetEnabledSelectedBorderColor( upButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_UP_BUTTON_DISABLED );
|
||||
GadgetButtonSetDisabledImage( upButton, info->image );
|
||||
GadgetButtonSetDisabledColor( upButton, info->color );
|
||||
GadgetButtonSetDisabledBorderColor( upButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_UP_BUTTON_DISABLED_PUSHED );
|
||||
GadgetButtonSetDisabledSelectedImage( upButton, info->image );
|
||||
GadgetButtonSetDisabledSelectedColor( upButton, info->color );
|
||||
GadgetButtonSetDisabledSelectedBorderColor( upButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_UP_BUTTON_HILITE );
|
||||
GadgetButtonSetHiliteImage( upButton, info->image );
|
||||
GadgetButtonSetHiliteColor( upButton, info->color );
|
||||
GadgetButtonSetHiliteBorderColor( upButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_UP_BUTTON_HILITE_PUSHED );
|
||||
GadgetButtonSetHiliteSelectedImage( upButton, info->image );
|
||||
GadgetButtonSetHiliteSelectedColor( upButton, info->color );
|
||||
GadgetButtonSetHiliteSelectedBorderColor( upButton, info->borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
// down button
|
||||
GameWindow *downButton = GadgetListBoxGetDownButton( window );
|
||||
if( downButton )
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_DOWN_BUTTON_ENABLED );
|
||||
GadgetButtonSetEnabledImage( downButton, info->image );
|
||||
GadgetButtonSetEnabledColor( downButton, info->color );
|
||||
GadgetButtonSetEnabledBorderColor( downButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_DOWN_BUTTON_ENABLED_PUSHED );
|
||||
GadgetButtonSetEnabledSelectedImage( downButton, info->image );
|
||||
GadgetButtonSetEnabledSelectedColor( downButton, info->color );
|
||||
GadgetButtonSetEnabledSelectedBorderColor( downButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_DOWN_BUTTON_DISABLED );
|
||||
GadgetButtonSetDisabledImage( downButton, info->image );
|
||||
GadgetButtonSetDisabledColor( downButton, info->color );
|
||||
GadgetButtonSetDisabledBorderColor( downButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_DOWN_BUTTON_DISABLED_PUSHED );
|
||||
GadgetButtonSetDisabledSelectedImage( downButton, info->image );
|
||||
GadgetButtonSetDisabledSelectedColor( downButton, info->color );
|
||||
GadgetButtonSetDisabledSelectedBorderColor( downButton, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_DOWN_BUTTON_HILITE );
|
||||
GadgetButtonSetHiliteImage( downButton, info->image );
|
||||
GadgetButtonSetHiliteColor( downButton, info->color );
|
||||
GadgetButtonSetHiliteBorderColor( downButton, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_DOWN_BUTTON_HILITE_PUSHED );
|
||||
GadgetButtonSetHiliteSelectedImage( downButton, info->image );
|
||||
GadgetButtonSetHiliteSelectedColor( downButton, info->color );
|
||||
GadgetButtonSetHiliteSelectedBorderColor( downButton, info->borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
// slider
|
||||
GameWindow *slider = GadgetListBoxGetSlider( window );
|
||||
if( slider )
|
||||
{
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_SLIDER_ENABLED_TOP );
|
||||
GadgetSliderSetEnabledImageTop( slider, info->image );
|
||||
GadgetSliderSetEnabledColor( slider, info->color );
|
||||
GadgetSliderSetEnabledBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_ENABLED_BOTTOM );
|
||||
GadgetSliderSetEnabledImageBottom( slider, info->image );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_ENABLED_CENTER );
|
||||
GadgetSliderSetEnabledImageCenter( slider, info->image );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_ENABLED_SMALL_CENTER );
|
||||
GadgetSliderSetEnabledImageSmallCenter( slider, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_DISABLED_TOP );
|
||||
GadgetSliderSetDisabledImageTop( slider, info->image );
|
||||
GadgetSliderSetDisabledColor( slider, info->color );
|
||||
GadgetSliderSetDisabledBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_DISABLED_BOTTOM );
|
||||
GadgetSliderSetDisabledImageBottom( slider, info->image );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_DISABLED_CENTER );
|
||||
GadgetSliderSetDisabledImageCenter( slider, info->image );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_DISABLED_SMALL_CENTER );
|
||||
GadgetSliderSetDisabledImageSmallCenter( slider, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_HILITE_TOP );
|
||||
GadgetSliderSetHiliteImageTop( slider, info->image );
|
||||
GadgetSliderSetHiliteColor( slider, info->color );
|
||||
GadgetSliderSetHiliteBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_HILITE_BOTTOM );
|
||||
GadgetSliderSetHiliteImageBottom( slider, info->image );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_HILITE_CENTER );
|
||||
GadgetSliderSetHiliteImageCenter( slider, info->image );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_HILITE_SMALL_CENTER );
|
||||
GadgetSliderSetHiliteImageSmallCenter( slider, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_SLIDER_THUMB_ENABLED );
|
||||
GadgetSliderSetEnabledThumbImage( slider, info->image );
|
||||
GadgetSliderSetEnabledThumbColor( slider, info->color );
|
||||
GadgetSliderSetEnabledThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_THUMB_ENABLED_PUSHED );
|
||||
GadgetSliderSetEnabledSelectedThumbImage( slider, info->image );
|
||||
GadgetSliderSetEnabledSelectedThumbColor( slider, info->color );
|
||||
GadgetSliderSetEnabledSelectedThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_SLIDER_THUMB_DISABLED );
|
||||
GadgetSliderSetDisabledThumbImage( slider, info->image );
|
||||
GadgetSliderSetDisabledThumbColor( slider, info->color );
|
||||
GadgetSliderSetDisabledThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_THUMB_DISABLED_PUSHED );
|
||||
GadgetSliderSetDisabledSelectedThumbImage( slider, info->image );
|
||||
GadgetSliderSetDisabledSelectedThumbColor( slider, info->color );
|
||||
GadgetSliderSetDisabledSelectedThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( LISTBOX_SLIDER_THUMB_HILITE );
|
||||
GadgetSliderSetHiliteThumbImage( slider, info->image );
|
||||
GadgetSliderSetHiliteThumbColor( slider, info->color );
|
||||
GadgetSliderSetHiliteThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
info = GetStateInfo( LISTBOX_SLIDER_THUMB_HILITE_PUSHED );
|
||||
GadgetSliderSetHiliteSelectedThumbImage( slider, info->image );
|
||||
GadgetSliderSetHiliteSelectedThumbColor( slider, info->color );
|
||||
GadgetSliderSetHiliteSelectedThumbBorderColor( slider, info->borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
// save specific list data
|
||||
ListboxData *listData = (ListboxData *)window->winGetUserData();
|
||||
|
||||
listData->forceSelect = IsDlgButtonChecked( hWndDialog, CHECK_FORCE_SELECT );
|
||||
listData->autoScroll = IsDlgButtonChecked( hWndDialog, CHECK_AUTO_SCROLL );
|
||||
listData->scrollIfAtEnd = IsDlgButtonChecked( hWndDialog, CHECK_SCROLL_IF_AT_END );
|
||||
listData->autoPurge = IsDlgButtonChecked( hWndDialog, CHECK_AUTO_PURGE );
|
||||
|
||||
// addition or subtraction of a scroll bar
|
||||
Bool wantScrollBar = IsDlgButtonChecked( hWndDialog, CHECK_HAS_SCROLLBAR );
|
||||
if( wantScrollBar == TRUE && listData->scrollBar == FALSE )
|
||||
addScrollbar( window );
|
||||
else if( wantScrollBar == FALSE && listData->scrollBar == TRUE )
|
||||
removeScrollbar( window );
|
||||
|
||||
// change in the size of the listbox
|
||||
Int newMaxItems = GetDlgItemInt( hWndDialog, EDIT_MAX_ITEMS, NULL, FALSE );
|
||||
if( newMaxItems != listData->listLength )
|
||||
GadgetListBoxSetListLength( window, newMaxItems );
|
||||
|
||||
// multi-select
|
||||
Bool wantMultiSelect = IsDlgButtonChecked( hWndDialog, CHECK_MULTI_SELECT );
|
||||
if( wantMultiSelect == TRUE && listData->multiSelect == FALSE )
|
||||
GadgetListBoxAddMultiSelect( window );
|
||||
else if( wantMultiSelect == FALSE && listData->multiSelect == TRUE )
|
||||
GadgetListBoxRemoveMultiSelect( window );
|
||||
|
||||
|
||||
// Wordwrap
|
||||
UnsignedInt bit = WIN_STATUS_ONE_LINE;
|
||||
window->winClearStatus( bit );
|
||||
if( IsDlgButtonChecked( hWndDialog, CHECK_NO_WORDWRAP ) )
|
||||
window->winSetStatus( bit );
|
||||
|
||||
// Multi-column
|
||||
Int newColumns = GetDlgItemInt( hWndDialog, EDIT_NUM_COLUMNS,NULL,FALSE);
|
||||
|
||||
if(newColumns > 1)
|
||||
{
|
||||
char *percentages = new char[60];
|
||||
char *token;
|
||||
GetDlgItemText(hWndDialog,EDIT_COLUMN_PERCENT,percentages,200);
|
||||
if(strlen(percentages) == 0)
|
||||
{
|
||||
MessageBox(NULL,"You have specified a column amount greater then 1, please enter the same about of percentages","whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL);
|
||||
break;
|
||||
}
|
||||
|
||||
Int *newPercentages = new Int[newColumns];
|
||||
Int i = 0;
|
||||
Int total = 0;
|
||||
token = strtok( percentages, "," );
|
||||
while( token != NULL )
|
||||
{
|
||||
newPercentages[i] = atoi(token);
|
||||
total += newPercentages[i];
|
||||
token = strtok( NULL, "," );
|
||||
i++;
|
||||
if(i > newColumns && token)
|
||||
{
|
||||
Char *whoopsMsg = new char[250];
|
||||
sprintf(whoopsMsg,"You have Specified %d columns but I have read in more then that for the percentages, please double check your data", newColumns);
|
||||
MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL);
|
||||
return 0;
|
||||
}
|
||||
else if( i < newColumns && !token )
|
||||
{
|
||||
Char *whoopsMsg = new char[250];
|
||||
sprintf(whoopsMsg,"You have Specified %d columns but I have read in only %d for the percentages, please double check your data", newColumns, i );
|
||||
MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL);
|
||||
return 0;
|
||||
}
|
||||
else if((total > 100 ) || (total < 100 && !token ))
|
||||
{
|
||||
Char *whoopsMsg = new char[250];
|
||||
sprintf(whoopsMsg,"Please Double check to make sure your percentages add up to 100.", newColumns, i - 1);
|
||||
MessageBox(NULL, whoopsMsg,"Whoops",MB_OK | MB_ICONSTOP | MB_APPLMODAL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
listData->columnWidthPercentage = newPercentages;
|
||||
}
|
||||
listData->columns = newColumns;
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end listboxPropertiesCallback
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitListboxPropertiesDialog ================================================
|
||||
/** Bring up the listbox properties window */
|
||||
//=============================================================================
|
||||
HWND InitListboxPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)LISTBOX_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)listboxPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this putton
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetListBoxGetEnabledImage( window );
|
||||
color = GadgetListBoxGetEnabledColor( window );
|
||||
borderColor = GadgetListBoxGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( LISTBOX_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetListBoxGetEnabledSelectedItemImageLeft( window );
|
||||
color = GadgetListBoxGetEnabledSelectedItemColor( window );
|
||||
borderColor = GadgetListBoxGetEnabledSelectedItemBorderColor( window );
|
||||
StoreImageAndColor( LISTBOX_ENABLED_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetListBoxGetEnabledSelectedItemImageRight( window );
|
||||
StoreImageAndColor( LISTBOX_ENABLED_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetEnabledSelectedItemImageCenter( window );
|
||||
StoreImageAndColor( LISTBOX_ENABLED_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetEnabledSelectedItemImageSmallCenter( window );
|
||||
StoreImageAndColor( LISTBOX_ENABLED_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetListBoxGetDisabledImage( window );
|
||||
color = GadgetListBoxGetDisabledColor( window );
|
||||
borderColor = GadgetListBoxGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( LISTBOX_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetListBoxGetDisabledSelectedItemImageLeft( window );
|
||||
color = GadgetListBoxGetDisabledSelectedItemColor( window );
|
||||
borderColor = GadgetListBoxGetDisabledSelectedItemBorderColor( window );
|
||||
StoreImageAndColor( LISTBOX_DISABLED_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetListBoxGetDisabledSelectedItemImageRight( window );
|
||||
StoreImageAndColor( LISTBOX_DISABLED_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetDisabledSelectedItemImageCenter( window );
|
||||
StoreImageAndColor( LISTBOX_DISABLED_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetDisabledSelectedItemImageSmallCenter( window );
|
||||
StoreImageAndColor( LISTBOX_DISABLED_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetListBoxGetHiliteImage( window );
|
||||
color = GadgetListBoxGetHiliteColor( window );
|
||||
borderColor = GadgetListBoxGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( LISTBOX_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetListBoxGetHiliteSelectedItemImageLeft( window );
|
||||
color = GadgetListBoxGetHiliteSelectedItemColor( window );
|
||||
borderColor = GadgetListBoxGetHiliteSelectedItemBorderColor( window );
|
||||
StoreImageAndColor( LISTBOX_HILITE_SELECTED_ITEM_LEFT, image, color, borderColor );
|
||||
image = GadgetListBoxGetHiliteSelectedItemImageRight( window );
|
||||
StoreImageAndColor( LISTBOX_HILITE_SELECTED_ITEM_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetHiliteSelectedItemImageCenter( window );
|
||||
StoreImageAndColor( LISTBOX_HILITE_SELECTED_ITEM_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetListBoxGetHiliteSelectedItemImageSmallCenter( window );
|
||||
StoreImageAndColor( LISTBOX_HILITE_SELECTED_ITEM_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
GameWindow *upButton = GadgetListBoxGetUpButton( window );
|
||||
if( upButton )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetEnabledImage( upButton );
|
||||
color = GadgetButtonGetEnabledColor( upButton );
|
||||
borderColor = GadgetButtonGetEnabledBorderColor( upButton );
|
||||
StoreImageAndColor( LISTBOX_UP_BUTTON_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetEnabledSelectedImage( upButton );
|
||||
color = GadgetButtonGetEnabledSelectedColor( upButton );
|
||||
borderColor = GadgetButtonGetEnabledSelectedBorderColor( upButton );
|
||||
StoreImageAndColor( LISTBOX_UP_BUTTON_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetDisabledImage( upButton );
|
||||
color = GadgetButtonGetDisabledColor( upButton );
|
||||
borderColor = GadgetButtonGetDisabledBorderColor( upButton );
|
||||
StoreImageAndColor( LISTBOX_UP_BUTTON_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetDisabledSelectedImage( upButton );
|
||||
color = GadgetButtonGetDisabledSelectedColor( upButton );
|
||||
borderColor = GadgetButtonGetDisabledSelectedBorderColor( upButton );
|
||||
StoreImageAndColor( LISTBOX_UP_BUTTON_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetHiliteImage( upButton );
|
||||
color = GadgetButtonGetHiliteColor( upButton );
|
||||
borderColor = GadgetButtonGetHiliteBorderColor( upButton );
|
||||
StoreImageAndColor( LISTBOX_UP_BUTTON_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetHiliteSelectedImage( upButton );
|
||||
color = GadgetButtonGetHiliteSelectedColor( upButton );
|
||||
borderColor = GadgetButtonGetHiliteSelectedBorderColor( upButton );
|
||||
StoreImageAndColor( LISTBOX_UP_BUTTON_HILITE_PUSHED, image, color, borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
GameWindow *downButton = GadgetListBoxGetDownButton( window );
|
||||
if( downButton )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetEnabledImage( downButton );
|
||||
color = GadgetButtonGetEnabledColor( downButton );
|
||||
borderColor = GadgetButtonGetEnabledBorderColor( downButton );
|
||||
StoreImageAndColor( LISTBOX_DOWN_BUTTON_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetEnabledSelectedImage( downButton );
|
||||
color = GadgetButtonGetEnabledSelectedColor( downButton );
|
||||
borderColor = GadgetButtonGetEnabledSelectedBorderColor( downButton );
|
||||
StoreImageAndColor( LISTBOX_DOWN_BUTTON_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetDisabledImage( downButton );
|
||||
color = GadgetButtonGetDisabledColor( downButton );
|
||||
borderColor = GadgetButtonGetDisabledBorderColor( downButton );
|
||||
StoreImageAndColor( LISTBOX_DOWN_BUTTON_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetDisabledSelectedImage( downButton );
|
||||
color = GadgetButtonGetDisabledSelectedColor( downButton );
|
||||
borderColor = GadgetButtonGetDisabledSelectedBorderColor( downButton );
|
||||
StoreImageAndColor( LISTBOX_DOWN_BUTTON_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
image = GadgetButtonGetHiliteImage( downButton );
|
||||
color = GadgetButtonGetHiliteColor( downButton );
|
||||
borderColor = GadgetButtonGetHiliteBorderColor( downButton );
|
||||
StoreImageAndColor( LISTBOX_DOWN_BUTTON_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetHiliteSelectedImage( downButton );
|
||||
color = GadgetButtonGetHiliteSelectedColor( downButton );
|
||||
borderColor = GadgetButtonGetHiliteSelectedBorderColor( downButton );
|
||||
StoreImageAndColor( LISTBOX_DOWN_BUTTON_HILITE_PUSHED, image, color, borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
GameWindow *slider = GadgetListBoxGetSlider( window );
|
||||
if( slider )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetEnabledImageTop( slider );
|
||||
color = GadgetSliderGetEnabledColor( slider );
|
||||
borderColor = GadgetSliderGetEnabledBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_ENABLED_TOP, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledImageBottom( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_ENABLED_BOTTOM, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledImageCenter( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_ENABLED_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledImageSmallCenter( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_ENABLED_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetDisabledImageTop( slider );
|
||||
color = GadgetSliderGetDisabledColor( slider );
|
||||
borderColor = GadgetSliderGetDisabledBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_DISABLED_TOP, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledImageBottom( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_DISABLED_BOTTOM, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledImageCenter( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_DISABLED_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledImageSmallCenter( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_DISABLED_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetHiliteImageTop( slider );
|
||||
color = GadgetSliderGetHiliteColor( slider );
|
||||
borderColor = GadgetSliderGetHiliteBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_HILITE_TOP, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteImageBottom( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_HILITE_BOTTOM, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteImageCenter( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_HILITE_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteImageSmallCenter( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_HILITE_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetEnabledThumbImage( slider );
|
||||
color = GadgetSliderGetEnabledThumbColor( slider );
|
||||
borderColor = GadgetSliderGetEnabledThumbBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_THUMB_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledSelectedThumbImage( slider );
|
||||
color = GadgetSliderGetEnabledSelectedThumbColor( slider );
|
||||
borderColor = GadgetSliderGetEnabledSelectedThumbBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_THUMB_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetDisabledThumbImage( slider );
|
||||
color = GadgetSliderGetDisabledThumbColor( slider );
|
||||
borderColor = GadgetSliderGetDisabledThumbBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_THUMB_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledSelectedThumbImage( slider );
|
||||
color = GadgetSliderGetDisabledSelectedThumbColor( slider );
|
||||
borderColor = GadgetSliderGetDisabledSelectedThumbBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_THUMB_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetHiliteThumbImage( slider );
|
||||
color = GadgetSliderGetHiliteThumbColor( slider );
|
||||
borderColor = GadgetSliderGetHiliteThumbBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_THUMB_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteSelectedThumbImage( slider );
|
||||
color = GadgetSliderGetHiliteSelectedThumbColor( slider );
|
||||
borderColor = GadgetSliderGetHiliteSelectedThumbBorderColor( slider );
|
||||
StoreImageAndColor( LISTBOX_SLIDER_THUMB_HILITE_PUSHED, image, color, borderColor );
|
||||
|
||||
} // end if
|
||||
|
||||
// init listbox specific property section
|
||||
ListboxData *listData = (ListboxData *)window->winGetUserData();
|
||||
|
||||
CheckDlgButton( dialog, CHECK_HAS_SCROLLBAR, listData->scrollBar );
|
||||
CheckDlgButton( dialog, CHECK_MULTI_SELECT, listData->multiSelect );
|
||||
CheckDlgButton( dialog, CHECK_FORCE_SELECT, listData->forceSelect );
|
||||
CheckDlgButton( dialog, CHECK_AUTO_SCROLL, listData->autoScroll );
|
||||
CheckDlgButton( dialog, CHECK_SCROLL_IF_AT_END, listData->scrollIfAtEnd );
|
||||
CheckDlgButton( dialog, CHECK_AUTO_PURGE, listData->autoPurge );
|
||||
SetDlgItemInt( dialog, EDIT_MAX_ITEMS, listData->listLength, FALSE );
|
||||
SetDlgItemInt( dialog, EDIT_NUM_COLUMNS, listData->columns, FALSE );
|
||||
if(listData->columns > 1)
|
||||
{
|
||||
char *percentages = new char[60];
|
||||
char *tempStr = new char[60];
|
||||
sprintf(percentages,"%d",listData->columnWidthPercentage[0]);
|
||||
for(Int i = 1; i < listData->columns; i++ )
|
||||
{
|
||||
strcat(percentages,",");
|
||||
strcat(percentages,itoa(listData->columnWidthPercentage[i],tempStr,10));
|
||||
}
|
||||
SetDlgItemText(dialog,EDIT_COLUMN_PERCENT,percentages);
|
||||
|
||||
}
|
||||
// WordWrap Check Box
|
||||
if( BitTest( window->winGetStatus(), WIN_STATUS_ONE_LINE ) )
|
||||
CheckDlgButton( dialog, CHECK_NO_WORDWRAP, BST_CHECKED );
|
||||
|
||||
|
||||
// select the button enabled state for display
|
||||
SwitchToState( LISTBOX_ENABLED, dialog );
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitListboxPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: NewLayoutDialog.cpp //////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: NewLayoutDialog.cpp
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: New layout dialog procedure
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <windows.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Lib/BaseType.h"
|
||||
#include "Resource.h"
|
||||
#include "EditWindow.h"
|
||||
#include "GUIEdit.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// initNewLayoutDialog ========================================================
|
||||
/** The new layout dialog is being shown, initialize anything we need to */
|
||||
//=============================================================================
|
||||
static void initNewLayoutDialog( HWND hWndDialog )
|
||||
{
|
||||
|
||||
// set default keyboard focus
|
||||
SetFocus( GetDlgItem( hWndDialog, IDOK ) );
|
||||
|
||||
} // end initNewLayoutDialog
|
||||
|
||||
// NewLayoutDialogProc ========================================================
|
||||
/** Dialog procedure for the new layout dialog when starting an entire
|
||||
* new layout in the editor */
|
||||
//=============================================================================
|
||||
LRESULT CALLBACK NewLayoutDialogProc( HWND hWndDialog, UINT message,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
|
||||
// initialize the values for the the dialog
|
||||
initNewLayoutDialog( hWndDialog );
|
||||
return FALSE;
|
||||
|
||||
} // end init dialog
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
|
||||
switch( LOWORD( wParam ) )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
|
||||
// reset the editor
|
||||
TheEditor->newLayout();
|
||||
|
||||
// end this dialog
|
||||
EndDialog( hWndDialog, TRUE );
|
||||
|
||||
break;
|
||||
|
||||
} // end ok
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
EndDialog( hWndDialog, FALSE );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
EndDialog( hWndDialog, FALSE );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end NewLayoutDialogProc
|
||||
|
|
@ -0,0 +1,333 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: ProgressBarProperties.cpp ////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: ProgressBarProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Progress bar properties
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetProgressBar.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// progressBarPropertiesCallback ==============================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK progressBarPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( PROGRESS_BAR_ENABLED_LEFT );
|
||||
GadgetProgressBarSetEnabledImageLeft( window, info->image );
|
||||
GadgetProgressBarSetEnabledColor( window, info->color );
|
||||
GadgetProgressBarSetEnabledBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( PROGRESS_BAR_ENABLED_RIGHT );
|
||||
GadgetProgressBarSetEnabledImageRight( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_ENABLED_CENTER );
|
||||
GadgetProgressBarSetEnabledImageCenter( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_ENABLED_SMALL_CENTER );
|
||||
GadgetProgressBarSetEnabledImageSmallCenter( window, info->image );
|
||||
|
||||
info = GetStateInfo( PROGRESS_BAR_ENABLED_BAR_LEFT );
|
||||
GadgetProgressBarSetEnabledBarImageLeft( window, info->image );
|
||||
GadgetProgressBarSetEnabledBarColor( window, info->color );
|
||||
GadgetProgressBarSetEnabledBarBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( PROGRESS_BAR_ENABLED_BAR_RIGHT );
|
||||
GadgetProgressBarSetEnabledBarImageRight( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_ENABLED_BAR_CENTER );
|
||||
GadgetProgressBarSetEnabledBarImageCenter( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_ENABLED_BAR_SMALL_CENTER );
|
||||
GadgetProgressBarSetEnabledBarImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( PROGRESS_BAR_DISABLED_LEFT );
|
||||
GadgetProgressBarSetDisabledImageLeft( window, info->image );
|
||||
GadgetProgressBarSetDisabledColor( window, info->color );
|
||||
GadgetProgressBarSetDisabledBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( PROGRESS_BAR_DISABLED_RIGHT );
|
||||
GadgetProgressBarSetDisabledImageRight( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_DISABLED_CENTER );
|
||||
GadgetProgressBarSetDisabledImageCenter( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_DISABLED_SMALL_CENTER );
|
||||
GadgetProgressBarSetDisabledImageSmallCenter( window, info->image );
|
||||
|
||||
info = GetStateInfo( PROGRESS_BAR_DISABLED_BAR_LEFT );
|
||||
GadgetProgressBarSetDisabledBarImageLeft( window, info->image );
|
||||
GadgetProgressBarSetDisabledBarColor( window, info->color );
|
||||
GadgetProgressBarSetDisabledBarBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( PROGRESS_BAR_DISABLED_BAR_RIGHT );
|
||||
GadgetProgressBarSetDisabledBarImageRight( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_DISABLED_BAR_CENTER );
|
||||
GadgetProgressBarSetDisabledBarImageCenter( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_DISABLED_BAR_SMALL_CENTER );
|
||||
GadgetProgressBarSetDisabledBarImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( PROGRESS_BAR_HILITE_LEFT );
|
||||
GadgetProgressBarSetHiliteImageLeft( window, info->image );
|
||||
GadgetProgressBarSetHiliteColor( window, info->color );
|
||||
GadgetProgressBarSetHiliteBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( PROGRESS_BAR_HILITE_RIGHT );
|
||||
GadgetProgressBarSetHiliteImageRight( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_HILITE_CENTER );
|
||||
GadgetProgressBarSetHiliteImageCenter( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_HILITE_SMALL_CENTER );
|
||||
GadgetProgressBarSetHiliteImageSmallCenter( window, info->image );
|
||||
|
||||
info = GetStateInfo( PROGRESS_BAR_HILITE_BAR_LEFT );
|
||||
GadgetProgressBarSetHiliteBarImageLeft( window, info->image );
|
||||
GadgetProgressBarSetHiliteBarColor( window, info->color );
|
||||
GadgetProgressBarSetHiliteBarBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( PROGRESS_BAR_HILITE_BAR_RIGHT );
|
||||
GadgetProgressBarSetHiliteBarImageRight( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_HILITE_BAR_CENTER );
|
||||
GadgetProgressBarSetHiliteBarImageCenter( window, info->image );
|
||||
info = GetStateInfo( PROGRESS_BAR_HILITE_BAR_SMALL_CENTER );
|
||||
GadgetProgressBarSetHiliteBarImageSmallCenter( window, info->image );
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end progressBarPropertiesCallback
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitProgressBarPropertiesDialog ============================================
|
||||
/** Bring up the progress bar properties dialog */
|
||||
//=============================================================================
|
||||
HWND InitProgressBarPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)PROGRESS_BAR_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)progressBarPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this putton
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetProgressBarGetEnabledImageLeft( window );
|
||||
color = GadgetProgressBarGetEnabledColor( window );
|
||||
borderColor = GadgetProgressBarGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_ENABLED_LEFT, image, color, borderColor );
|
||||
image = GadgetProgressBarGetEnabledImageRight( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_ENABLED_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetEnabledImageCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_ENABLED_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetEnabledImageSmallCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_ENABLED_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
image = GadgetProgressBarGetEnabledBarImageLeft( window );
|
||||
color = GadgetProgressBarGetEnabledBarColor( window );
|
||||
borderColor = GadgetProgressBarGetEnabledBarBorderColor( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_ENABLED_BAR_LEFT, image, color, borderColor );
|
||||
image = GadgetProgressBarGetEnabledBarImageRight( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_ENABLED_BAR_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetEnabledBarImageCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_ENABLED_BAR_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetEnabledBarImageSmallCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_ENABLED_BAR_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetProgressBarGetDisabledImageLeft( window );
|
||||
color = GadgetProgressBarGetDisabledColor( window );
|
||||
borderColor = GadgetProgressBarGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_DISABLED_LEFT, image, color, borderColor );
|
||||
image = GadgetProgressBarGetDisabledImageRight( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_DISABLED_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetDisabledImageCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_DISABLED_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetDisabledImageSmallCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_DISABLED_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
image = GadgetProgressBarGetDisabledBarImageLeft( window );
|
||||
color = GadgetProgressBarGetDisabledBarColor( window );
|
||||
borderColor = GadgetProgressBarGetDisabledBarBorderColor( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_DISABLED_BAR_LEFT, image, color, borderColor );
|
||||
image = GadgetProgressBarGetDisabledBarImageRight( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_DISABLED_BAR_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetDisabledBarImageCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_DISABLED_BAR_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetDisabledBarImageSmallCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_DISABLED_BAR_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetProgressBarGetHiliteImageLeft( window );
|
||||
color = GadgetProgressBarGetHiliteColor( window );
|
||||
borderColor = GadgetProgressBarGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_HILITE_LEFT, image, color, borderColor );
|
||||
image = GadgetProgressBarGetHiliteImageRight( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_HILITE_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetHiliteImageCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_HILITE_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetHiliteImageSmallCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_HILITE_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
image = GadgetProgressBarGetHiliteBarImageLeft( window );
|
||||
color = GadgetProgressBarGetHiliteBarColor( window );
|
||||
borderColor = GadgetProgressBarGetHiliteBarBorderColor( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_HILITE_BAR_LEFT, image, color, borderColor );
|
||||
image = GadgetProgressBarGetHiliteBarImageRight( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_HILITE_BAR_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetHiliteBarImageCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_HILITE_BAR_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetProgressBarGetHiliteBarImageSmallCenter( window );
|
||||
StoreImageAndColor( PROGRESS_BAR_HILITE_BAR_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// select the button enabled state for display
|
||||
SwitchToState( PROGRESS_BAR_ENABLED_LEFT, dialog );
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitProgressBarPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: PushButtonProperties.cpp /////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: PushButtonProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Push button properties
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetPushButton.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// pushButtonPropertiesCallback ===============================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK pushButtonPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( BUTTON_ENABLED );
|
||||
GadgetButtonSetEnabledImage( window, info->image );
|
||||
GadgetButtonSetEnabledColor( window, info->color );
|
||||
GadgetButtonSetEnabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( BUTTON_ENABLED_PUSHED );
|
||||
GadgetButtonSetEnabledSelectedImage( window, info->image );
|
||||
GadgetButtonSetEnabledSelectedColor( window, info->color );
|
||||
GadgetButtonSetEnabledSelectedBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( BUTTON_DISABLED );
|
||||
GadgetButtonSetDisabledImage( window, info->image );
|
||||
GadgetButtonSetDisabledColor( window, info->color );
|
||||
GadgetButtonSetDisabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( BUTTON_DISABLED_PUSHED );
|
||||
GadgetButtonSetDisabledSelectedImage( window, info->image );
|
||||
GadgetButtonSetDisabledSelectedColor( window, info->color );
|
||||
GadgetButtonSetDisabledSelectedBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( BUTTON_HILITE );
|
||||
GadgetButtonSetHiliteImage( window, info->image );
|
||||
GadgetButtonSetHiliteColor( window, info->color );
|
||||
GadgetButtonSetHiliteBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( BUTTON_HILITE_PUSHED );
|
||||
GadgetButtonSetHiliteSelectedImage( window, info->image );
|
||||
GadgetButtonSetHiliteSelectedColor( window, info->color );
|
||||
GadgetButtonSetHiliteSelectedBorderColor( window, info->borderColor );
|
||||
|
||||
UnsignedInt bit;
|
||||
bit = WIN_STATUS_RIGHT_CLICK;
|
||||
window->winClearStatus( bit );
|
||||
if( IsDlgButtonChecked( hWndDialog, CHECK_RIGHT_CLICK ) )
|
||||
window->winSetStatus( bit );
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end pushButtonPropertiesCallback
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitPushButtonPropertiesDialog =============================================
|
||||
/** Bring up the push button properties dialog */
|
||||
//=============================================================================
|
||||
HWND InitPushButtonPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)PUSH_BUTTON_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)pushButtonPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this putton
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
image = GadgetButtonGetEnabledImage( window );
|
||||
color = GadgetButtonGetEnabledColor( window );
|
||||
borderColor = GadgetButtonGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( BUTTON_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetEnabledSelectedImage( window );
|
||||
color = GadgetButtonGetEnabledSelectedColor( window );
|
||||
borderColor = GadgetButtonGetEnabledSelectedBorderColor( window );
|
||||
StoreImageAndColor( BUTTON_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetDisabledImage( window );
|
||||
color = GadgetButtonGetDisabledColor( window );
|
||||
borderColor = GadgetButtonGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( BUTTON_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetDisabledSelectedImage( window );
|
||||
color = GadgetButtonGetDisabledSelectedColor( window );
|
||||
borderColor = GadgetButtonGetDisabledSelectedBorderColor( window );
|
||||
StoreImageAndColor( BUTTON_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetHiliteImage( window );
|
||||
color = GadgetButtonGetHiliteColor( window );
|
||||
borderColor = GadgetButtonGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( BUTTON_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetButtonGetHiliteSelectedImage( window );
|
||||
color = GadgetButtonGetHiliteSelectedColor( window );
|
||||
borderColor = GadgetButtonGetHiliteSelectedBorderColor( window );
|
||||
StoreImageAndColor( BUTTON_HILITE_PUSHED, image, color, borderColor );
|
||||
|
||||
// select the button enabled state for display
|
||||
SwitchToState( BUTTON_ENABLED, dialog );
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
if( BitTest( window->winGetStatus(), WIN_STATUS_RIGHT_CLICK ) )
|
||||
CheckDlgButton( dialog, CHECK_RIGHT_CLICK, BST_CHECKED );
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitPushButtonPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,361 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: RadioButtonProperties.cpp ////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: RadioButtonProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Radio button properties
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Common/NameKeyGenerator.h"
|
||||
#include "GameClient/GameWindowManager.h"
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetRadioButton.h"
|
||||
#include "GameClient/Gadget.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// radioButtonPropertiesCallback ==============================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK radioButtonPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_CLEAR_GROUP:
|
||||
{
|
||||
|
||||
SetDlgItemInt( hWndDialog, COMBO_GROUP, 0, FALSE );
|
||||
break;
|
||||
|
||||
} // end clear group
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( RADIO_ENABLED );
|
||||
GadgetRadioSetEnabledImage( window, info->image );
|
||||
GadgetRadioSetEnabledColor( window, info->color );
|
||||
GadgetRadioSetEnabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( RADIO_ENABLED_UNCHECKED_BOX );
|
||||
GadgetRadioSetEnabledUncheckedBoxImage( window, info->image );
|
||||
GadgetRadioSetEnabledUncheckedBoxColor( window, info->color );
|
||||
GadgetRadioSetEnabledUncheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( RADIO_ENABLED_CHECKED_BOX );
|
||||
GadgetRadioSetEnabledCheckedBoxImage( window, info->image );
|
||||
GadgetRadioSetEnabledCheckedBoxColor( window, info->color );
|
||||
GadgetRadioSetEnabledCheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( RADIO_DISABLED );
|
||||
GadgetRadioSetDisabledImage( window, info->image );
|
||||
GadgetRadioSetDisabledColor( window, info->color );
|
||||
GadgetRadioSetDisabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( RADIO_DISABLED_UNCHECKED_BOX );
|
||||
GadgetRadioSetDisabledUncheckedBoxImage( window, info->image );
|
||||
GadgetRadioSetDisabledUncheckedBoxColor( window, info->color );
|
||||
GadgetRadioSetDisabledUncheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( RADIO_DISABLED_CHECKED_BOX );
|
||||
GadgetRadioSetDisabledCheckedBoxImage( window, info->image );
|
||||
GadgetRadioSetDisabledCheckedBoxColor( window, info->color );
|
||||
GadgetRadioSetDisabledCheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( RADIO_HILITE );
|
||||
GadgetRadioSetHiliteImage( window, info->image );
|
||||
GadgetRadioSetHiliteColor( window, info->color );
|
||||
GadgetRadioSetHiliteBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( RADIO_HILITE_UNCHECKED_BOX );
|
||||
GadgetRadioSetHiliteUncheckedBoxImage( window, info->image );
|
||||
GadgetRadioSetHiliteUncheckedBoxColor( window, info->color );
|
||||
GadgetRadioSetHiliteUncheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( RADIO_HILITE_CHECKED_BOX );
|
||||
GadgetRadioSetHiliteCheckedBoxImage( window, info->image );
|
||||
GadgetRadioSetHiliteCheckedBoxColor( window, info->color );
|
||||
GadgetRadioSetHiliteCheckedBoxBorderColor( window, info->borderColor );
|
||||
|
||||
// save group
|
||||
Int group = GetDlgItemInt( hWndDialog, COMBO_GROUP, NULL, FALSE );
|
||||
Int screen = TheNameKeyGenerator->nameToKey( AsciiString(TheEditor->getSaveFilename()) );
|
||||
GadgetRadioSetGroup( window, group, screen );
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end radioButtonPropertiesCallback
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// loadExistingGroupsCombo ====================================================
|
||||
/** fill the group combo box with all the other groups in the screen */
|
||||
//=============================================================================
|
||||
static void loadExistingGroupsCombo( HWND combo, GameWindow *window )
|
||||
{
|
||||
|
||||
// sanity
|
||||
if( combo == NULL )
|
||||
return;
|
||||
|
||||
// end of recursion
|
||||
if( window == NULL )
|
||||
return;
|
||||
|
||||
// if this is a radio button get the group
|
||||
if( BitTest( window->winGetStyle(), GWS_RADIO_BUTTON ) )
|
||||
{
|
||||
RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData();
|
||||
char buffer[ 64 ];
|
||||
|
||||
// convert to string
|
||||
sprintf( buffer, "%d", radioData->group );
|
||||
|
||||
// only add it not already there
|
||||
if( SendMessage( combo, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer ) == CB_ERR )
|
||||
SendMessage( combo, CB_ADDSTRING, 0, (LPARAM)buffer );
|
||||
|
||||
} // end if
|
||||
|
||||
// search our children
|
||||
GameWindow *child;
|
||||
for( child = window->winGetChild(); child; child = child->winGetNext() )
|
||||
loadExistingGroupsCombo( combo, child );
|
||||
|
||||
// search the next in line
|
||||
loadExistingGroupsCombo( combo, window->winGetNext() );
|
||||
|
||||
} // end loadExistingGroupsCombo
|
||||
|
||||
// InitRadioButtonPropertiesDialog ============================================
|
||||
/** Bring up the radio button properties dialog */
|
||||
//=============================================================================
|
||||
HWND InitRadioButtonPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)RADIO_BUTTON_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)radioButtonPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this putton
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetRadioGetEnabledImage( window );
|
||||
color = GadgetRadioGetEnabledColor( window );
|
||||
borderColor = GadgetRadioGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( RADIO_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetRadioGetEnabledUncheckedBoxImage( window );
|
||||
color = GadgetRadioGetEnabledUncheckedBoxColor( window );
|
||||
borderColor = GadgetRadioGetEnabledUncheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( RADIO_ENABLED_UNCHECKED_BOX, image, color, borderColor );
|
||||
|
||||
image = GadgetRadioGetEnabledCheckedBoxImage( window );
|
||||
color = GadgetRadioGetEnabledCheckedBoxColor( window );
|
||||
borderColor = GadgetRadioGetEnabledCheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( RADIO_ENABLED_CHECKED_BOX, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetRadioGetDisabledImage( window );
|
||||
color = GadgetRadioGetDisabledColor( window );
|
||||
borderColor = GadgetRadioGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( RADIO_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetRadioGetDisabledUncheckedBoxImage( window );
|
||||
color = GadgetRadioGetDisabledUncheckedBoxColor( window );
|
||||
borderColor = GadgetRadioGetDisabledUncheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( RADIO_DISABLED_UNCHECKED_BOX, image, color, borderColor );
|
||||
|
||||
image = GadgetRadioGetDisabledCheckedBoxImage( window );
|
||||
color = GadgetRadioGetDisabledCheckedBoxColor( window );
|
||||
borderColor = GadgetRadioGetDisabledCheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( RADIO_DISABLED_CHECKED_BOX, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetRadioGetHiliteImage( window );
|
||||
color = GadgetRadioGetHiliteColor( window );
|
||||
borderColor = GadgetRadioGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( RADIO_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetRadioGetHiliteUncheckedBoxImage( window );
|
||||
color = GadgetRadioGetHiliteUncheckedBoxColor( window );
|
||||
borderColor = GadgetRadioGetHiliteUncheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( RADIO_HILITE_UNCHECKED_BOX, image, color, borderColor );
|
||||
|
||||
image = GadgetRadioGetHiliteCheckedBoxImage( window );
|
||||
color = GadgetRadioGetHiliteCheckedBoxColor( window );
|
||||
borderColor = GadgetRadioGetHiliteCheckedBoxBorderColor( window );
|
||||
StoreImageAndColor( RADIO_HILITE_CHECKED_BOX, image, color, borderColor );
|
||||
|
||||
// radio data
|
||||
RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData();
|
||||
|
||||
// fill the group combo box with all the other groups in the screen
|
||||
loadExistingGroupsCombo( GetDlgItem( dialog, COMBO_GROUP ),
|
||||
TheWindowManager->winGetWindowList() );
|
||||
|
||||
// set the group for this radio button
|
||||
SetDlgItemInt( dialog, COMBO_GROUP, radioData->group, FALSE );
|
||||
|
||||
// select the button enabled state for display
|
||||
SwitchToState( RADIO_ENABLED, dialog );
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitRadioButtonPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,484 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: SliderProperties.cpp /////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: SliderProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Slider properties
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetSlider.h"
|
||||
#include "GameClient/Gadget.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// sliderPropertiesCallback ===================================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK sliderPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_SUBCONTROL_COLOR:
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
Bool vert = FALSE;
|
||||
|
||||
if( window )
|
||||
vert = BitTest( window->winGetStyle(), GWS_VERT_SLIDER );
|
||||
|
||||
//
|
||||
// using the current colors in the base of the slider, assign a
|
||||
// reasonable color scheme to all the sub control components
|
||||
//
|
||||
if( vert )
|
||||
{
|
||||
|
||||
info = GetStateInfo( VSLIDER_ENABLED_TOP );
|
||||
StoreColor( VSLIDER_THUMB_ENABLED, info->color, info->borderColor );
|
||||
StoreColor( VSLIDER_THUMB_ENABLED_PUSHED, info->borderColor, info->color );
|
||||
|
||||
info = GetStateInfo( VSLIDER_DISABLED_TOP );
|
||||
StoreColor( VSLIDER_THUMB_DISABLED, info->color, info->borderColor );
|
||||
StoreColor( VSLIDER_THUMB_DISABLED_PUSHED, info->borderColor, info->color );
|
||||
|
||||
info = GetStateInfo( VSLIDER_HILITE_TOP );
|
||||
StoreColor( VSLIDER_THUMB_HILITE, info->color, info->borderColor );
|
||||
StoreColor( VSLIDER_THUMB_HILITE_PUSHED, info->borderColor, info->color );
|
||||
|
||||
} // end if, vertical slider
|
||||
else
|
||||
{
|
||||
|
||||
info = GetStateInfo( HSLIDER_ENABLED_LEFT );
|
||||
StoreColor( HSLIDER_THUMB_ENABLED, info->color, info->borderColor );
|
||||
StoreColor( HSLIDER_THUMB_ENABLED_PUSHED, info->borderColor, info->color );
|
||||
|
||||
info = GetStateInfo( HSLIDER_DISABLED_LEFT );
|
||||
StoreColor( HSLIDER_THUMB_DISABLED, info->color, info->borderColor );
|
||||
StoreColor( HSLIDER_THUMB_DISABLED_PUSHED, info->borderColor, info->color );
|
||||
|
||||
info = GetStateInfo( HSLIDER_HILITE_LEFT );
|
||||
StoreColor( HSLIDER_THUMB_HILITE, info->color, info->borderColor );
|
||||
StoreColor( HSLIDER_THUMB_HILITE_PUSHED, info->borderColor, info->color );
|
||||
|
||||
} // end else horizontal slider
|
||||
|
||||
break;
|
||||
|
||||
} // end case subcontrol color
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
Bool vert = BitTest( window->winGetStyle(), GWS_VERT_SLIDER );
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
if( vert )
|
||||
{
|
||||
info = GetStateInfo( VSLIDER_ENABLED_TOP );
|
||||
GadgetSliderSetEnabledImageTop( window, info->image );
|
||||
GadgetSliderSetEnabledColor( window, info->color );
|
||||
GadgetSliderSetEnabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( VSLIDER_ENABLED_BOTTOM );
|
||||
GadgetSliderSetEnabledImageBottom( window, info->image );
|
||||
} // end if
|
||||
else
|
||||
{
|
||||
info = GetStateInfo( HSLIDER_ENABLED_LEFT );
|
||||
GadgetSliderSetEnabledImageLeft( window, info->image );
|
||||
GadgetSliderSetEnabledColor( window, info->color );
|
||||
GadgetSliderSetEnabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( HSLIDER_ENABLED_RIGHT );
|
||||
GadgetSliderSetEnabledImageRight( window, info->image );
|
||||
} // end else
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_ENABLED_CENTER : HSLIDER_ENABLED_CENTER );
|
||||
GadgetSliderSetEnabledImageCenter( window, info->image );
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_ENABLED_SMALL_CENTER : HSLIDER_ENABLED_SMALL_CENTER );
|
||||
GadgetSliderSetEnabledImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
if( vert )
|
||||
{
|
||||
info = GetStateInfo( VSLIDER_DISABLED_TOP );
|
||||
GadgetSliderSetDisabledImageTop( window, info->image );
|
||||
GadgetSliderSetDisabledColor( window, info->color );
|
||||
GadgetSliderSetDisabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( VSLIDER_DISABLED_BOTTOM );
|
||||
GadgetSliderSetDisabledImageBottom( window, info->image );
|
||||
} // end if
|
||||
else
|
||||
{
|
||||
info = GetStateInfo( HSLIDER_DISABLED_LEFT );
|
||||
GadgetSliderSetDisabledImageLeft( window, info->image );
|
||||
GadgetSliderSetDisabledColor( window, info->color );
|
||||
GadgetSliderSetDisabledBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( HSLIDER_DISABLED_RIGHT );
|
||||
GadgetSliderSetDisabledImageRight( window, info->image );
|
||||
} // end else
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_DISABLED_CENTER : HSLIDER_DISABLED_CENTER );
|
||||
GadgetSliderSetDisabledImageCenter( window, info->image );
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_DISABLED_SMALL_CENTER : HSLIDER_DISABLED_SMALL_CENTER );
|
||||
GadgetSliderSetDisabledImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
if( vert )
|
||||
{
|
||||
info = GetStateInfo( VSLIDER_HILITE_TOP );
|
||||
GadgetSliderSetHiliteImageTop( window, info->image );
|
||||
GadgetSliderSetHiliteColor( window, info->color );
|
||||
GadgetSliderSetHiliteBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( VSLIDER_HILITE_BOTTOM );
|
||||
GadgetSliderSetHiliteImageBottom( window, info->image );
|
||||
} // end if
|
||||
else
|
||||
{
|
||||
info = GetStateInfo( HSLIDER_HILITE_LEFT );
|
||||
GadgetSliderSetHiliteImageLeft( window, info->image );
|
||||
GadgetSliderSetHiliteColor( window, info->color );
|
||||
GadgetSliderSetHiliteBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( HSLIDER_HILITE_RIGHT );
|
||||
GadgetSliderSetHiliteImageRight( window, info->image );
|
||||
} // end else
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_HILITE_CENTER : HSLIDER_HILITE_CENTER );
|
||||
GadgetSliderSetHiliteImageCenter( window, info->image );
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_HILITE_SMALL_CENTER : HSLIDER_HILITE_SMALL_CENTER );
|
||||
GadgetSliderSetHiliteImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( vert ? VSLIDER_THUMB_ENABLED : HSLIDER_THUMB_ENABLED );
|
||||
GadgetSliderSetEnabledThumbImage( window, info->image );
|
||||
GadgetSliderSetEnabledThumbColor( window, info->color );
|
||||
GadgetSliderSetEnabledThumbBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_THUMB_ENABLED_PUSHED : HSLIDER_THUMB_ENABLED_PUSHED );
|
||||
GadgetSliderSetEnabledSelectedThumbImage( window, info->image );
|
||||
GadgetSliderSetEnabledSelectedThumbColor( window, info->color );
|
||||
GadgetSliderSetEnabledSelectedThumbBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( vert ? VSLIDER_THUMB_DISABLED : HSLIDER_THUMB_DISABLED );
|
||||
GadgetSliderSetDisabledThumbImage( window, info->image );
|
||||
GadgetSliderSetDisabledThumbColor( window, info->color );
|
||||
GadgetSliderSetDisabledThumbBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_THUMB_DISABLED_PUSHED : HSLIDER_THUMB_DISABLED_PUSHED );
|
||||
GadgetSliderSetDisabledSelectedThumbImage( window, info->image );
|
||||
GadgetSliderSetDisabledSelectedThumbColor( window, info->color );
|
||||
GadgetSliderSetDisabledSelectedThumbBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( vert ? VSLIDER_THUMB_HILITE : HSLIDER_THUMB_HILITE );
|
||||
GadgetSliderSetHiliteThumbImage( window, info->image );
|
||||
GadgetSliderSetHiliteThumbColor( window, info->color );
|
||||
GadgetSliderSetHiliteThumbBorderColor( window, info->borderColor );
|
||||
|
||||
info = GetStateInfo( vert ? VSLIDER_THUMB_HILITE_PUSHED : HSLIDER_THUMB_HILITE_PUSHED );
|
||||
GadgetSliderSetHiliteSelectedThumbImage( window, info->image );
|
||||
GadgetSliderSetHiliteSelectedThumbColor( window, info->color );
|
||||
GadgetSliderSetHiliteSelectedThumbBorderColor( window, info->borderColor );
|
||||
|
||||
// slider data
|
||||
SliderData *sliderData = (SliderData *)window->winGetUserData();
|
||||
|
||||
sliderData->minVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MIN, NULL, FALSE );
|
||||
sliderData->maxVal = GetDlgItemInt( hWndDialog, EDIT_SLIDER_MAX, NULL, FALSE );
|
||||
|
||||
// sanity
|
||||
if( sliderData->minVal > sliderData->maxVal )
|
||||
{
|
||||
Int temp = sliderData->minVal;
|
||||
sliderData->minVal = sliderData->maxVal;
|
||||
sliderData->maxVal = temp;
|
||||
|
||||
MessageBox( NULL, "Slider min greated than max, the values were swapped",
|
||||
"Warning", MB_OK | MB_ICONINFORMATION );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end sliderPropertiesCallback
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitSliderPropertiesDialog =================================================
|
||||
/** Slider properties dialog */
|
||||
//=============================================================================
|
||||
HWND InitSliderPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)SLIDER_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)sliderPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// init values
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
Bool vert = BitTest( window->winGetStyle(), GWS_VERT_SLIDER );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
if( vert )
|
||||
image = GadgetSliderGetEnabledImageTop( window );
|
||||
else
|
||||
image = GadgetSliderGetEnabledImageLeft( window );
|
||||
color = GadgetSliderGetEnabledColor( window );
|
||||
borderColor = GadgetSliderGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_ENABLED_TOP : HSLIDER_ENABLED_LEFT, image, color, borderColor );
|
||||
|
||||
if( vert )
|
||||
image = GadgetSliderGetEnabledImageBottom( window );
|
||||
else
|
||||
image = GadgetSliderGetEnabledImageRight( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_ENABLED_BOTTOM : HSLIDER_ENABLED_RIGHT, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledImageCenter( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_ENABLED_CENTER : HSLIDER_ENABLED_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledImageSmallCenter( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_ENABLED_SMALL_CENTER : HSLIDER_ENABLED_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
if( vert )
|
||||
image = GadgetSliderGetDisabledImageTop( window );
|
||||
else
|
||||
image = GadgetSliderGetDisabledImageLeft( window );
|
||||
color = GadgetSliderGetDisabledColor( window );
|
||||
borderColor = GadgetSliderGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_DISABLED_TOP : HSLIDER_DISABLED_LEFT, image, color, borderColor );
|
||||
|
||||
if( vert )
|
||||
image = GadgetSliderGetDisabledImageBottom( window );
|
||||
else
|
||||
image = GadgetSliderGetDisabledImageRight( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_DISABLED_BOTTOM : HSLIDER_DISABLED_RIGHT, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledImageCenter( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_DISABLED_CENTER : HSLIDER_DISABLED_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledImageSmallCenter( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_DISABLED_SMALL_CENTER : HSLIDER_DISABLED_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
if( vert )
|
||||
image = GadgetSliderGetHiliteImageTop( window );
|
||||
else
|
||||
image = GadgetSliderGetHiliteImageLeft( window );
|
||||
color = GadgetSliderGetHiliteColor( window );
|
||||
borderColor = GadgetSliderGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_HILITE_TOP : HSLIDER_HILITE_LEFT, image, color, borderColor );
|
||||
|
||||
if( vert )
|
||||
image = GadgetSliderGetHiliteImageBottom( window );
|
||||
else
|
||||
image = GadgetSliderGetHiliteImageRight( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_HILITE_BOTTOM : HSLIDER_HILITE_RIGHT, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteImageCenter( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_HILITE_CENTER : HSLIDER_HILITE_CENTER, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteImageSmallCenter( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_HILITE_SMALL_CENTER : HSLIDER_HILITE_SMALL_CENTER, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetEnabledThumbImage( window );
|
||||
color = GadgetSliderGetEnabledThumbColor( window );
|
||||
borderColor = GadgetSliderGetEnabledThumbBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_THUMB_ENABLED : HSLIDER_THUMB_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetEnabledSelectedThumbImage( window );
|
||||
color = GadgetSliderGetEnabledSelectedThumbColor( window );
|
||||
borderColor = GadgetSliderGetEnabledSelectedThumbBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_THUMB_ENABLED_PUSHED : HSLIDER_THUMB_ENABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetDisabledThumbImage( window );
|
||||
color = GadgetSliderGetDisabledThumbColor( window );
|
||||
borderColor = GadgetSliderGetDisabledThumbBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_THUMB_DISABLED : HSLIDER_THUMB_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetDisabledSelectedThumbImage( window );
|
||||
color = GadgetSliderGetDisabledSelectedThumbColor( window );
|
||||
borderColor = GadgetSliderGetDisabledSelectedThumbBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_THUMB_DISABLED_PUSHED : HSLIDER_THUMB_DISABLED_PUSHED, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetSliderGetHiliteThumbImage( window );
|
||||
color = GadgetSliderGetHiliteThumbColor( window );
|
||||
borderColor = GadgetSliderGetHiliteThumbBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_THUMB_HILITE : HSLIDER_THUMB_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetSliderGetHiliteSelectedThumbImage( window );
|
||||
color = GadgetSliderGetHiliteSelectedThumbColor( window );
|
||||
borderColor = GadgetSliderGetHiliteSelectedThumbBorderColor( window );
|
||||
StoreImageAndColor( vert ? VSLIDER_THUMB_HILITE_PUSHED : HSLIDER_THUMB_HILITE_PUSHED, image, color, borderColor );
|
||||
|
||||
// slider data
|
||||
SliderData *sliderData = (SliderData *)window->winGetUserData();
|
||||
|
||||
SetDlgItemInt( dialog, EDIT_SLIDER_MIN, sliderData->minVal, FALSE );
|
||||
SetDlgItemInt( dialog, EDIT_SLIDER_MAX, sliderData->maxVal, FALSE );
|
||||
|
||||
// select the enabled state for display
|
||||
SwitchToState( vert ? VSLIDER_ENABLED_TOP : HSLIDER_ENABLED_LEFT, dialog );
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitSliderPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: StaticTextProperties.cpp /////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: StaticTextSliderProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Static text properties
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetStaticText.h"
|
||||
#include "GameClient/Gadget.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static Bool currCentered = FALSE;
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// staticTextPropertiesCallback ===============================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK staticTextPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case BUTTON_CENTERED:
|
||||
{
|
||||
|
||||
currCentered = 1 - currCentered;
|
||||
if( currCentered == TRUE )
|
||||
SetDlgItemText( hWndDialog, BUTTON_CENTERED, "Yes" );
|
||||
else
|
||||
SetDlgItemText( hWndDialog, BUTTON_CENTERED, "No" );
|
||||
break;
|
||||
|
||||
} // end centered
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( STATIC_TEXT_ENABLED );
|
||||
GadgetStaticTextSetEnabledImage( window, info->image );
|
||||
GadgetStaticTextSetEnabledColor( window, info->color );
|
||||
GadgetStaticTextSetEnabledBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( STATIC_TEXT_DISABLED );
|
||||
GadgetStaticTextSetDisabledImage( window, info->image );
|
||||
GadgetStaticTextSetDisabledColor( window, info->color );
|
||||
GadgetStaticTextSetDisabledBorderColor( window, info->borderColor );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( STATIC_TEXT_HILITE );
|
||||
GadgetStaticTextSetHiliteImage( window, info->image );
|
||||
GadgetStaticTextSetHiliteColor( window, info->color );
|
||||
GadgetStaticTextSetHiliteBorderColor( window, info->borderColor );
|
||||
|
||||
// text data
|
||||
TextData *textData = (TextData *)window->winGetUserData();
|
||||
textData->centered = currCentered;
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end staticTextPropertiesCallback
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitStaticTextPropertiesDialog =============================================
|
||||
/** Bring up the static text properties dialog */
|
||||
//=============================================================================
|
||||
HWND InitStaticTextPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)STATIC_TEXT_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)staticTextPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this putton
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetStaticTextGetEnabledImage( window );
|
||||
color = GadgetStaticTextGetEnabledColor( window );
|
||||
borderColor = GadgetStaticTextGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( STATIC_TEXT_ENABLED, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetStaticTextGetDisabledImage( window );
|
||||
color = GadgetStaticTextGetDisabledColor( window );
|
||||
borderColor = GadgetStaticTextGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( STATIC_TEXT_DISABLED, image, color, borderColor );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetStaticTextGetHiliteImage( window );
|
||||
color = GadgetStaticTextGetHiliteColor( window );
|
||||
borderColor = GadgetStaticTextGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( STATIC_TEXT_HILITE, image, color, borderColor );
|
||||
|
||||
// text data
|
||||
TextData *textData = (TextData *)window->winGetUserData();
|
||||
|
||||
if( textData->centered )
|
||||
SetDlgItemText( dialog, BUTTON_CENTERED, "Yes" );
|
||||
else
|
||||
SetDlgItemText( dialog, BUTTON_CENTERED, "No" );
|
||||
currCentered = textData->centered;
|
||||
|
||||
// select the button enabled state for display
|
||||
SwitchToState( STATIC_TEXT_ENABLED, dialog );
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitStaticTextPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,622 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: C:\projects\RTS\code\Tools\GUIEdit\Source\Dialog Procedures\TabControlProperties.cpp
|
||||
//
|
||||
// Created: Graham Smallwood, November 2001
|
||||
//
|
||||
// Desc: Tab Control properties
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Common/NameKeyGenerator.h"
|
||||
#include "GameClient/GameWindowManager.h"
|
||||
#include "GUIEdit.h"
|
||||
#include "HierarchyView.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetTabControl.h"
|
||||
#include "GameClient/Gadget.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///< Pane names are derived off the Tab Control's name.
|
||||
static void GadgetTabControlUpdatePaneNames( GameWindow *tabControl )
|
||||
{
|
||||
TabControlData *tabData = (TabControlData *)tabControl->winGetUserData();
|
||||
WinInstanceData *controlInstData = tabControl->winGetInstanceData();
|
||||
|
||||
for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ )
|
||||
{
|
||||
WinInstanceData *paneInstData = tabData->subPanes[paneIndex]->winGetInstanceData();
|
||||
|
||||
char buffer[128];//legal limit is 64, which will be checked at save.
|
||||
sprintf( buffer, "%s Pane %d", controlInstData->m_decoratedNameString.str() ,paneIndex );
|
||||
paneInstData->m_decoratedNameString = buffer;
|
||||
if( TheHierarchyView )
|
||||
TheHierarchyView->updateWindowName( tabData->subPanes[paneIndex] );
|
||||
}
|
||||
}
|
||||
|
||||
// radioButtonPropertiesCallback ==============================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK tabControlPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *tabControl = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( tabControl )
|
||||
{
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, tabControl ) == FALSE )
|
||||
break;
|
||||
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
info = GetStateInfo( TC_TAB_0_ENABLED );
|
||||
GadgetTabControlSetEnabledImageTabZero( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorTabZero( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorTabZero( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_1_ENABLED );
|
||||
GadgetTabControlSetEnabledImageTabOne( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorTabOne( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorTabOne( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_2_ENABLED );
|
||||
GadgetTabControlSetEnabledImageTabTwo( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorTabTwo( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorTabTwo( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_3_ENABLED );
|
||||
GadgetTabControlSetEnabledImageTabThree( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorTabThree( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorTabThree( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_4_ENABLED );
|
||||
GadgetTabControlSetEnabledImageTabFour( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorTabFour( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorTabFour( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_5_ENABLED );
|
||||
GadgetTabControlSetEnabledImageTabFive( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorTabFive( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorTabFive( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_6_ENABLED );
|
||||
GadgetTabControlSetEnabledImageTabSix( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorTabSix( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorTabSix( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_7_ENABLED );
|
||||
GadgetTabControlSetEnabledImageTabSeven( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorTabSeven( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorTabSeven( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TAB_CONTROL_ENABLED );
|
||||
GadgetTabControlSetEnabledImageBackground( tabControl, info->image );
|
||||
GadgetTabControlSetEnabledColorBackground( tabControl, info->color );
|
||||
GadgetTabControlSetEnabledBorderColorBackground( tabControl, info->borderColor );
|
||||
|
||||
|
||||
|
||||
info = GetStateInfo( TC_TAB_0_DISABLED );
|
||||
GadgetTabControlSetDisabledImageTabZero( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorTabZero( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorTabZero( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_1_DISABLED );
|
||||
GadgetTabControlSetDisabledImageTabOne( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorTabOne( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorTabOne( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_2_DISABLED );
|
||||
GadgetTabControlSetDisabledImageTabTwo( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorTabTwo( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorTabTwo( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_3_DISABLED );
|
||||
GadgetTabControlSetDisabledImageTabThree( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorTabThree( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorTabThree( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_4_DISABLED );
|
||||
GadgetTabControlSetDisabledImageTabFour( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorTabFour( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorTabFour( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_5_DISABLED );
|
||||
GadgetTabControlSetDisabledImageTabFive( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorTabFive( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorTabFive( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_6_DISABLED );
|
||||
GadgetTabControlSetDisabledImageTabSix( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorTabSix( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorTabSix( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_7_DISABLED );
|
||||
GadgetTabControlSetDisabledImageTabSeven( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorTabSeven( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorTabSeven( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TAB_CONTROL_DISABLED );
|
||||
GadgetTabControlSetDisabledImageBackground( tabControl, info->image );
|
||||
GadgetTabControlSetDisabledColorBackground( tabControl, info->color );
|
||||
GadgetTabControlSetDisabledBorderColorBackground( tabControl, info->borderColor );
|
||||
|
||||
|
||||
|
||||
|
||||
info = GetStateInfo( TC_TAB_0_HILITE );
|
||||
GadgetTabControlSetHiliteImageTabZero( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorTabZero( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorTabZero( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_1_HILITE );
|
||||
GadgetTabControlSetHiliteImageTabOne( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorTabOne( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorTabOne( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_2_HILITE );
|
||||
GadgetTabControlSetHiliteImageTabTwo( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorTabTwo( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorTabTwo( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_3_HILITE );
|
||||
GadgetTabControlSetHiliteImageTabThree( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorTabThree( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorTabThree( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_4_HILITE );
|
||||
GadgetTabControlSetHiliteImageTabFour( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorTabFour( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorTabFour( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_5_HILITE );
|
||||
GadgetTabControlSetHiliteImageTabFive( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorTabFive( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorTabFive( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_6_HILITE );
|
||||
GadgetTabControlSetHiliteImageTabSix( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorTabSix( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorTabSix( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TC_TAB_7_HILITE );
|
||||
GadgetTabControlSetHiliteImageTabSeven( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorTabSeven( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorTabSeven( tabControl, info->borderColor );
|
||||
|
||||
info = GetStateInfo( TAB_CONTROL_HILITE );
|
||||
GadgetTabControlSetHiliteImageBackground( tabControl, info->image );
|
||||
GadgetTabControlSetHiliteColorBackground( tabControl, info->color );
|
||||
GadgetTabControlSetHiliteBorderColorBackground( tabControl, info->borderColor );
|
||||
|
||||
|
||||
TabControlData *tabData = (TabControlData *)tabControl->winGetUserData();
|
||||
|
||||
tabData->tabWidth = GetDlgItemInt( hWndDialog, TAB_WIDTH, NULL, FALSE );
|
||||
tabData->tabHeight = GetDlgItemInt(hWndDialog, TAB_HEIGHT, NULL, FALSE );
|
||||
tabData->tabCount = GetDlgItemInt(hWndDialog, TAB_COUNT, NULL, FALSE );
|
||||
tabData->paneBorder = GetDlgItemInt(hWndDialog, BORDER_WIDTH, NULL, FALSE );
|
||||
tabData->activeTab = GetDlgItemInt(hWndDialog, ACTIVE_TAB, NULL, FALSE );
|
||||
|
||||
if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_0 ) )
|
||||
tabData->subPaneDisabled[0] = TRUE;
|
||||
else
|
||||
tabData->subPaneDisabled[0] = FALSE;
|
||||
if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_1 ) )
|
||||
tabData->subPaneDisabled[1] = TRUE;
|
||||
else
|
||||
tabData->subPaneDisabled[1] = FALSE;
|
||||
if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_2 ) )
|
||||
tabData->subPaneDisabled[2] = TRUE;
|
||||
else
|
||||
tabData->subPaneDisabled[2] = FALSE;
|
||||
if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_3 ) )
|
||||
tabData->subPaneDisabled[3] = TRUE;
|
||||
else
|
||||
tabData->subPaneDisabled[3] = FALSE;
|
||||
if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_4 ) )
|
||||
tabData->subPaneDisabled[4] = TRUE;
|
||||
else
|
||||
tabData->subPaneDisabled[4] = FALSE;
|
||||
if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_5 ) )
|
||||
tabData->subPaneDisabled[5] = TRUE;
|
||||
else
|
||||
tabData->subPaneDisabled[5] = FALSE;
|
||||
if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_6 ) )
|
||||
tabData->subPaneDisabled[6] = TRUE;
|
||||
else
|
||||
tabData->subPaneDisabled[6] = FALSE;
|
||||
if( IsDlgButtonChecked( hWndDialog, DISABLE_TAB_7 ) )
|
||||
tabData->subPaneDisabled[7] = TRUE;
|
||||
else
|
||||
tabData->subPaneDisabled[7] = FALSE;
|
||||
|
||||
if( IsDlgButtonChecked( hWndDialog, LEFT_JUSTIFY) )
|
||||
tabData->tabOrientation = TP_TOPLEFT;
|
||||
else if( IsDlgButtonChecked( hWndDialog, CENTER_JUSTIFY ) )
|
||||
tabData->tabOrientation = TP_CENTER;
|
||||
else if( IsDlgButtonChecked( hWndDialog, RIGHT_JUSTIFY ) )
|
||||
tabData->tabOrientation = TP_BOTTOMRIGHT;
|
||||
|
||||
if( IsDlgButtonChecked( hWndDialog, TOP_SIDE ) )
|
||||
tabData->tabEdge = TP_TOP_SIDE;
|
||||
else if( IsDlgButtonChecked( hWndDialog, RIGHT_SIDE ) )
|
||||
tabData->tabEdge = TP_RIGHT_SIDE;
|
||||
else if( IsDlgButtonChecked( hWndDialog, LEFT_SIDE ) )
|
||||
tabData->tabEdge = TP_LEFT_SIDE;
|
||||
else if( IsDlgButtonChecked( hWndDialog, BOTTOM_SIDE ) )
|
||||
tabData->tabEdge = TP_BOTTOM_SIDE;
|
||||
|
||||
//safeties
|
||||
tabData->tabCount = max( tabData->tabCount, 1 );
|
||||
tabData->tabCount = min( tabData->tabCount, NUM_TAB_PANES );
|
||||
|
||||
GadgetTabControlComputeTabRegion( tabControl );
|
||||
GadgetTabControlResizeSubPanes( tabControl );
|
||||
GadgetTabControlShowSubPane( tabControl, tabData->activeTab );
|
||||
GadgetTabControlUpdatePaneNames( tabControl );
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end tabControlPropertiesCallback
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitTabControlPropertiesDialog ============================================
|
||||
/** Bring up the tab control properties dialog */
|
||||
//=============================================================================
|
||||
HWND InitTabControlPropertiesDialog( GameWindow *tabControl )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)TAB_CONTROL_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)tabControlPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( tabControl, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this button
|
||||
//
|
||||
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
image = GadgetTabControlGetEnabledImageTabZero( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorTabZero( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorTabZero( tabControl );
|
||||
StoreImageAndColor( TC_TAB_0_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetEnabledImageTabOne( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorTabOne( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorTabOne( tabControl );
|
||||
StoreImageAndColor( TC_TAB_1_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetEnabledImageTabTwo( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorTabTwo( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorTabTwo( tabControl );
|
||||
StoreImageAndColor( TC_TAB_2_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetEnabledImageTabThree( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorTabThree( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorTabThree( tabControl );
|
||||
StoreImageAndColor( TC_TAB_3_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetEnabledImageTabFour( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorTabFour( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorTabFour( tabControl );
|
||||
StoreImageAndColor( TC_TAB_4_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetEnabledImageTabFive( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorTabFive( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorTabFive( tabControl );
|
||||
StoreImageAndColor( TC_TAB_5_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetEnabledImageTabSix( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorTabSix( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorTabSix( tabControl );
|
||||
StoreImageAndColor( TC_TAB_6_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetEnabledImageTabSeven( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorTabSeven( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorTabSeven( tabControl );
|
||||
StoreImageAndColor( TC_TAB_7_ENABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetEnabledImageBackground( tabControl );
|
||||
color = GadgetTabControlGetEnabledColorBackground( tabControl );
|
||||
borderColor = GadgetTabControlGetEnabledBorderColorBackground( tabControl );
|
||||
StoreImageAndColor( TAB_CONTROL_ENABLED, image, color, borderColor );
|
||||
|
||||
|
||||
|
||||
image = GadgetTabControlGetDisabledImageTabZero( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorTabZero( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorTabZero( tabControl );
|
||||
StoreImageAndColor( TC_TAB_0_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetDisabledImageTabOne( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorTabOne( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorTabOne( tabControl );
|
||||
StoreImageAndColor( TC_TAB_1_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetDisabledImageTabTwo( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorTabTwo( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorTabTwo( tabControl );
|
||||
StoreImageAndColor( TC_TAB_2_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetDisabledImageTabThree( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorTabThree( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorTabThree( tabControl );
|
||||
StoreImageAndColor( TC_TAB_3_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetDisabledImageTabFour( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorTabFour( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorTabFour( tabControl );
|
||||
StoreImageAndColor( TC_TAB_4_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetDisabledImageTabFive( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorTabFive( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorTabFive( tabControl );
|
||||
StoreImageAndColor( TC_TAB_5_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetDisabledImageTabSix( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorTabSix( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorTabSix( tabControl );
|
||||
StoreImageAndColor( TC_TAB_6_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetDisabledImageTabSeven( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorTabSeven( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorTabSeven( tabControl );
|
||||
StoreImageAndColor( TC_TAB_7_DISABLED, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetDisabledImageBackground( tabControl );
|
||||
color = GadgetTabControlGetDisabledColorBackground( tabControl );
|
||||
borderColor = GadgetTabControlGetDisabledBorderColorBackground( tabControl );
|
||||
StoreImageAndColor( TAB_CONTROL_DISABLED, image, color, borderColor );
|
||||
|
||||
|
||||
|
||||
image = GadgetTabControlGetHiliteImageTabZero( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorTabZero( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorTabZero( tabControl );
|
||||
StoreImageAndColor( TC_TAB_0_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetHiliteImageTabOne( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorTabOne( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorTabOne( tabControl );
|
||||
StoreImageAndColor( TC_TAB_1_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetHiliteImageTabTwo( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorTabTwo( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorTabTwo( tabControl );
|
||||
StoreImageAndColor( TC_TAB_2_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetHiliteImageTabThree( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorTabThree( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorTabThree( tabControl );
|
||||
StoreImageAndColor( TC_TAB_3_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetHiliteImageTabFour( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorTabFour( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorTabFour( tabControl );
|
||||
StoreImageAndColor( TC_TAB_4_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetHiliteImageTabFive( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorTabFive( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorTabFive( tabControl );
|
||||
StoreImageAndColor( TC_TAB_5_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetHiliteImageTabSix( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorTabSix( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorTabSix( tabControl );
|
||||
StoreImageAndColor( TC_TAB_6_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetHiliteImageTabSeven( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorTabSeven( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorTabSeven( tabControl );
|
||||
StoreImageAndColor( TC_TAB_7_HILITE, image, color, borderColor );
|
||||
|
||||
image = GadgetTabControlGetHiliteImageBackground( tabControl );
|
||||
color = GadgetTabControlGetHiliteColorBackground( tabControl );
|
||||
borderColor = GadgetTabControlGetHiliteBorderColorBackground( tabControl );
|
||||
StoreImageAndColor( TAB_CONTROL_HILITE, image, color, borderColor );
|
||||
|
||||
|
||||
// tab data
|
||||
TabControlData *tabData = (TabControlData *)tabControl->winGetUserData();
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
SetDlgItemInt(dialog, TAB_WIDTH, tabData->tabWidth, FALSE);
|
||||
SetDlgItemInt(dialog, TAB_HEIGHT, tabData->tabHeight, FALSE);
|
||||
SetDlgItemInt(dialog, TAB_COUNT, tabData->tabCount, FALSE);
|
||||
SetDlgItemInt(dialog, BORDER_WIDTH, tabData->paneBorder, FALSE);
|
||||
SetDlgItemInt(dialog, ACTIVE_TAB, tabData->activeTab, FALSE);
|
||||
|
||||
if( tabData->subPaneDisabled[0] )
|
||||
CheckDlgButton( dialog, DISABLE_TAB_0, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, DISABLE_TAB_0, BST_UNCHECKED );
|
||||
if( tabData->subPaneDisabled[1] )
|
||||
CheckDlgButton( dialog, DISABLE_TAB_1, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, DISABLE_TAB_1, BST_UNCHECKED );
|
||||
if( tabData->subPaneDisabled[2] )
|
||||
CheckDlgButton( dialog, DISABLE_TAB_2, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, DISABLE_TAB_2, BST_UNCHECKED );
|
||||
if( tabData->subPaneDisabled[3] )
|
||||
CheckDlgButton( dialog, DISABLE_TAB_3, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, DISABLE_TAB_3, BST_UNCHECKED );
|
||||
if( tabData->subPaneDisabled[4] )
|
||||
CheckDlgButton( dialog, DISABLE_TAB_4, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, DISABLE_TAB_4, BST_UNCHECKED );
|
||||
if( tabData->subPaneDisabled[5] )
|
||||
CheckDlgButton( dialog, DISABLE_TAB_5, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, DISABLE_TAB_5, BST_UNCHECKED );
|
||||
if( tabData->subPaneDisabled[6] )
|
||||
CheckDlgButton( dialog, DISABLE_TAB_6, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, DISABLE_TAB_6, BST_UNCHECKED );
|
||||
if( tabData->subPaneDisabled[7] )
|
||||
CheckDlgButton( dialog, DISABLE_TAB_7, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, DISABLE_TAB_7, BST_UNCHECKED );
|
||||
|
||||
if( tabData->tabOrientation == TP_TOPLEFT )
|
||||
CheckDlgButton( dialog, LEFT_JUSTIFY, BST_CHECKED );
|
||||
else if( tabData->tabOrientation == TP_CENTER )
|
||||
CheckDlgButton( dialog, CENTER_JUSTIFY, BST_CHECKED );
|
||||
else if( tabData->tabOrientation == TP_BOTTOMRIGHT )
|
||||
CheckDlgButton( dialog, RIGHT_JUSTIFY, BST_CHECKED );
|
||||
|
||||
if( tabData->tabEdge == TP_TOP_SIDE )
|
||||
CheckDlgButton( dialog, TOP_SIDE, BST_CHECKED );
|
||||
else if( tabData->tabEdge == TP_RIGHT_SIDE )
|
||||
CheckDlgButton( dialog, RIGHT_SIDE, BST_CHECKED );
|
||||
else if( tabData->tabEdge == TP_LEFT_SIDE )
|
||||
CheckDlgButton( dialog, LEFT_SIDE, BST_CHECKED );
|
||||
else if( tabData->tabEdge == TP_BOTTOM_SIDE )
|
||||
CheckDlgButton( dialog, BOTTOM_SIDE, BST_CHECKED );
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitTabControlPropertiesDialog
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,310 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: TextEntryProperties.cpp //////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: GUIEdit
|
||||
//
|
||||
// File name: TextEntryProperties.cpp
|
||||
//
|
||||
// Created: Colin Day, August 2001
|
||||
//
|
||||
// Desc: Text entry properties
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEdit.h"
|
||||
#include "Properties.h"
|
||||
#include "Resource.h"
|
||||
#include "GameClient/GadgetTextEntry.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// textEntryPropertiesCallback ================================================
|
||||
/** Dialog callback for properties */
|
||||
//=============================================================================
|
||||
static LRESULT CALLBACK textEntryPropertiesCallback( HWND hWndDialog,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
Int returnCode;
|
||||
|
||||
//
|
||||
// handle any common messages between all property dialogs cause they
|
||||
// are designed to have controls doing the same functionality
|
||||
// and names
|
||||
//
|
||||
if( HandleCommonDialogMessages( hWndDialog, message,
|
||||
wParam, lParam, &returnCode ) == TRUE )
|
||||
return returnCode;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
// Int notifyCode = HIWORD( wParam ); // notification code
|
||||
Int controlID = LOWORD( wParam ); // control ID
|
||||
// HWND hWndControl = (HWND)lParam; // control window handle
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDOK:
|
||||
{
|
||||
GameWindow *window = TheEditor->getPropertyTarget();
|
||||
|
||||
// sanity
|
||||
if( window )
|
||||
{
|
||||
ImageAndColorInfo *info;
|
||||
|
||||
// save the common properties
|
||||
if( SaveCommonDialogProperties( hWndDialog, window ) == FALSE )
|
||||
break;
|
||||
|
||||
// save the image and color data
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( TEXT_ENTRY_ENABLED_LEFT );
|
||||
GadgetTextEntrySetEnabledImageLeft( window, info->image );
|
||||
GadgetTextEntrySetEnabledColor( window, info->color );
|
||||
GadgetTextEntrySetEnabledBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( TEXT_ENTRY_ENABLED_RIGHT );
|
||||
GadgetTextEntrySetEnabledImageRight( window, info->image );
|
||||
info = GetStateInfo( TEXT_ENTRY_ENABLED_CENTER );
|
||||
GadgetTextEntrySetEnabledImageCenter( window, info->image );
|
||||
info = GetStateInfo( TEXT_ENTRY_ENABLED_SMALL_CENTER );
|
||||
GadgetTextEntrySetEnabledImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( TEXT_ENTRY_DISABLED_LEFT );
|
||||
GadgetTextEntrySetDisabledImageLeft( window, info->image );
|
||||
GadgetTextEntrySetDisabledColor( window, info->color );
|
||||
GadgetTextEntrySetDisabledBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( TEXT_ENTRY_DISABLED_RIGHT );
|
||||
GadgetTextEntrySetDisabledImageRight( window, info->image );
|
||||
info = GetStateInfo( TEXT_ENTRY_DISABLED_CENTER );
|
||||
GadgetTextEntrySetDisabledImageCenter( window, info->image );
|
||||
info = GetStateInfo( TEXT_ENTRY_DISABLED_SMALL_CENTER );
|
||||
GadgetTextEntrySetDisabledImageSmallCenter( window, info->image );
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
info = GetStateInfo( TEXT_ENTRY_HILITE_LEFT );
|
||||
GadgetTextEntrySetHiliteImageLeft( window, info->image );
|
||||
GadgetTextEntrySetHiliteColor( window, info->color );
|
||||
GadgetTextEntrySetHiliteBorderColor( window, info->borderColor );
|
||||
info = GetStateInfo( TEXT_ENTRY_HILITE_RIGHT );
|
||||
GadgetTextEntrySetHiliteImageRight( window, info->image );
|
||||
info = GetStateInfo( TEXT_ENTRY_HILITE_CENTER );
|
||||
GadgetTextEntrySetHiliteImageCenter( window, info->image );
|
||||
info = GetStateInfo( TEXT_ENTRY_HILITE_SMALL_CENTER );
|
||||
GadgetTextEntrySetHiliteImageSmallCenter( window, info->image );
|
||||
|
||||
// text entry props
|
||||
EntryData *entryData = (EntryData *)window->winGetUserData();
|
||||
|
||||
entryData->maxTextLen = GetDlgItemInt( hWndDialog, EDIT_MAX_CHARS, NULL, TRUE );
|
||||
entryData->secretText = IsDlgButtonChecked( hWndDialog, CHECK_SECRET_TEXT );
|
||||
entryData->aSCIIOnly = IsDlgButtonChecked( hWndDialog, CHECK_ASCII_TEXT );
|
||||
if( IsDlgButtonChecked( hWndDialog, RADIO_LETTERS_AND_NUMBERS ) )
|
||||
{
|
||||
|
||||
entryData->alphaNumericalOnly = TRUE;
|
||||
entryData->numericalOnly = FALSE;
|
||||
|
||||
} // end if
|
||||
else if( IsDlgButtonChecked( hWndDialog, RADIO_NUMBERS ) )
|
||||
{
|
||||
|
||||
entryData->alphaNumericalOnly = FALSE;
|
||||
entryData->numericalOnly = TRUE;
|
||||
|
||||
} // end else if
|
||||
else
|
||||
{
|
||||
|
||||
entryData->alphaNumericalOnly = FALSE;
|
||||
entryData->numericalOnly = FALSE;
|
||||
|
||||
} // end else
|
||||
|
||||
} // end if
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end OK
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case IDCANCEL:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
break;
|
||||
|
||||
} // end cancel
|
||||
|
||||
} // end switch( LOWORD( wParam ) )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end of WM_COMMAND
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
DestroyWindow( hWndDialog );
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
return 0;
|
||||
|
||||
} // end of switch
|
||||
|
||||
} // end textEntryPropertiesCallback
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// InitTextEntryPropertiesDialog ==============================================
|
||||
/** Bring up the text entry properties dialog */
|
||||
//=============================================================================
|
||||
HWND InitTextEntryPropertiesDialog( GameWindow *window )
|
||||
{
|
||||
HWND dialog;
|
||||
|
||||
// create the dialog box
|
||||
dialog = CreateDialog( TheEditor->getInstance(),
|
||||
(LPCTSTR)TEXT_ENTRY_PROPERTIES_DIALOG,
|
||||
TheEditor->getWindowHandle(),
|
||||
(DLGPROC)textEntryPropertiesCallback );
|
||||
if( dialog == NULL )
|
||||
return NULL;
|
||||
|
||||
// do the common initialization
|
||||
CommonDialogInitialize( window, dialog );
|
||||
|
||||
//
|
||||
// store in the image and color table the values for this putton
|
||||
//
|
||||
const Image *image;
|
||||
Color color, borderColor;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetTextEntryGetEnabledImageLeft( window );
|
||||
color = GadgetTextEntryGetEnabledColor( window );
|
||||
borderColor = GadgetTextEntryGetEnabledBorderColor( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_ENABLED_LEFT, image, color, borderColor );
|
||||
image = GadgetTextEntryGetEnabledImageRight( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_ENABLED_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetEnabledImageCenter( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_ENABLED_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetEnabledImageSmallCenter( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_ENABLED_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetTextEntryGetDisabledImageLeft( window );
|
||||
color = GadgetTextEntryGetDisabledColor( window );
|
||||
borderColor = GadgetTextEntryGetDisabledBorderColor( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_DISABLED_LEFT, image, color, borderColor );
|
||||
image = GadgetTextEntryGetDisabledImageRight( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_DISABLED_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetDisabledImageCenter( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_DISABLED_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetDisabledImageSmallCenter( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_DISABLED_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
image = GadgetTextEntryGetHiliteImageLeft( window );
|
||||
color = GadgetTextEntryGetHiliteColor( window );
|
||||
borderColor = GadgetTextEntryGetHiliteBorderColor( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_HILITE_LEFT, image, color, borderColor );
|
||||
image = GadgetTextEntryGetHiliteImageRight( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_HILITE_RIGHT, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetHiliteImageCenter( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_HILITE_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
image = GadgetTextEntryGetHiliteImageSmallCenter( window );
|
||||
StoreImageAndColor( TEXT_ENTRY_HILITE_SMALL_CENTER, image, WIN_COLOR_UNDEFINED, WIN_COLOR_UNDEFINED );
|
||||
|
||||
// fill out text entry properties
|
||||
EntryData *entryData = (EntryData *)window->winGetUserData();
|
||||
|
||||
SetDlgItemInt( dialog, EDIT_MAX_CHARS, entryData->maxTextLen, TRUE );
|
||||
if( entryData->secretText )
|
||||
CheckDlgButton( dialog, CHECK_SECRET_TEXT, BST_CHECKED );
|
||||
if( entryData->aSCIIOnly )
|
||||
CheckDlgButton( dialog, CHECK_ASCII_TEXT, BST_CHECKED );
|
||||
if( entryData->numericalOnly )
|
||||
CheckDlgButton( dialog, RADIO_NUMBERS, BST_CHECKED );
|
||||
else if( entryData->alphaNumericalOnly )
|
||||
CheckDlgButton( dialog, RADIO_LETTERS_AND_NUMBERS, BST_CHECKED );
|
||||
else
|
||||
CheckDlgButton( dialog, RADIO_ANY_TEXT, BST_CHECKED );
|
||||
|
||||
// select the button enabled state for display
|
||||
SwitchToState( TEXT_ENTRY_ENABLED_LEFT, dialog );
|
||||
|
||||
//
|
||||
// initialize the dialog with values from the window
|
||||
//
|
||||
|
||||
return dialog;
|
||||
|
||||
} // end InitTextEntryPropertiesDialog
|
||||
|
||||
|
||||
|
1767
Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp
Normal file
1767
Generals/Code/Tools/GUIEdit/Source/EditWindow.cpp
Normal file
File diff suppressed because it is too large
Load diff
4687
Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp
Normal file
4687
Generals/Code/Tools/GUIEdit/Source/GUIEdit.cpp
Normal file
File diff suppressed because it is too large
Load diff
165
Generals/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp
Normal file
165
Generals/Code/Tools/GUIEdit/Source/GUIEditDisplay.cpp
Normal file
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: .cpp /////////////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: RTS3
|
||||
//
|
||||
// File name: .cpp
|
||||
//
|
||||
// Created:
|
||||
//
|
||||
// Desc:
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <stdlib.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GUIEditDisplay.h"
|
||||
#include "EditWindow.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// GUIEditDisplay::GUIEditDisplay =============================================
|
||||
/** */
|
||||
//=============================================================================
|
||||
GUIEditDisplay::GUIEditDisplay( void )
|
||||
{
|
||||
|
||||
} // end GUIEditDisplay
|
||||
|
||||
// GUIEditDisplay::~GUIEditDisplay ============================================
|
||||
/** */
|
||||
//=============================================================================
|
||||
GUIEditDisplay::~GUIEditDisplay( void )
|
||||
{
|
||||
|
||||
} // end ~GUIEditDisplay
|
||||
|
||||
// GUIEditDisplay::drawLine ===================================================
|
||||
/** draw a line on the display in pixel coordinates with the specified color */
|
||||
//=============================================================================
|
||||
void GUIEditDisplay::drawLine( Int startX, Int startY,
|
||||
Int endX, Int endY,
|
||||
Real lineWidth, UnsignedInt lineColor )
|
||||
{
|
||||
|
||||
TheEditWindow->drawLine( startX, startY, endX, endY, lineWidth, lineColor );
|
||||
|
||||
} // end drawLIne
|
||||
|
||||
// GUIEditDisplay::drawOpenRect ===============================================
|
||||
/** draw a rect border on the display in pixel coordinates with the
|
||||
* specified color */
|
||||
//=============================================================================
|
||||
void GUIEditDisplay::drawOpenRect( Int startX, Int startY,
|
||||
Int width, Int height,
|
||||
Real lineWidth, UnsignedInt lineColor )
|
||||
{
|
||||
|
||||
TheEditWindow->drawOpenRect( startX, startY, width, height,
|
||||
lineWidth, lineColor );
|
||||
|
||||
} // end drawOpenRect
|
||||
|
||||
// GUIEditDisplay::drawFillRect ===============================================
|
||||
/** draw a filled rect on the display in pixel coords with the
|
||||
* specified color */
|
||||
//=============================================================================
|
||||
void GUIEditDisplay::drawFillRect( Int startX, Int startY,
|
||||
Int width, Int height,
|
||||
UnsignedInt color )
|
||||
{
|
||||
|
||||
TheEditWindow->drawFillRect( startX, startY,
|
||||
width, height,
|
||||
color );
|
||||
|
||||
} // end drawFillRect
|
||||
|
||||
// GUIEditDisplay::drawImage ==================================================
|
||||
/** draw an image fit within the screen coordinates */
|
||||
//=============================================================================
|
||||
void GUIEditDisplay::drawImage( const Image *image,
|
||||
Int startX, Int startY,
|
||||
Int endX, Int endY,
|
||||
Color color, DrawImageMode mode )
|
||||
{
|
||||
|
||||
TheEditWindow->drawImage( image,
|
||||
startX, startY,
|
||||
endX, endY,
|
||||
color );
|
||||
|
||||
|
||||
} // end drawImage
|
||||
|
||||
// GUIEditDisplay::setClipRegion ==============================================
|
||||
/** sets clipping rectangle for 2D drawing operations */
|
||||
//=============================================================================
|
||||
void GUIEditDisplay::setClipRegion( IRegion2D *region )
|
||||
{
|
||||
TheEditWindow->setClipRegion(region);
|
||||
}
|
||||
|
||||
// GUIEditDisplay::isClippingEnabled ==============================================
|
||||
/** returns current state of 2D image clipping */
|
||||
//=============================================================================
|
||||
Bool GUIEditDisplay::isClippingEnabled( void )
|
||||
{
|
||||
return TheEditWindow->isClippingEnabled();
|
||||
}
|
||||
|
||||
// GUIEditDisplay::isClippingEnabled ==============================================
|
||||
/** returns current state of 2D image clipping */
|
||||
//=============================================================================
|
||||
void GUIEditDisplay::enableClipping( Bool onoff )
|
||||
{
|
||||
TheEditWindow->enableClipping(onoff);
|
||||
}
|
1617
Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp
Normal file
1617
Generals/Code/Tools/GUIEdit/Source/GUIEditWindowManager.cpp
Normal file
File diff suppressed because it is too large
Load diff
1294
Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp
Normal file
1294
Generals/Code/Tools/GUIEdit/Source/HierarchyView.cpp
Normal file
File diff suppressed because it is too large
Load diff
2434
Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp
Normal file
2434
Generals/Code/Tools/GUIEdit/Source/LayoutScheme.cpp
Normal file
File diff suppressed because it is too large
Load diff
1763
Generals/Code/Tools/GUIEdit/Source/Properties.cpp
Normal file
1763
Generals/Code/Tools/GUIEdit/Source/Properties.cpp
Normal file
File diff suppressed because it is too large
Load diff
1284
Generals/Code/Tools/GUIEdit/Source/Save.cpp
Normal file
1284
Generals/Code/Tools/GUIEdit/Source/Save.cpp
Normal file
File diff suppressed because it is too large
Load diff
795
Generals/Code/Tools/GUIEdit/Source/WinMain.cpp
Normal file
795
Generals/Code/Tools/GUIEdit/Source/WinMain.cpp
Normal file
|
@ -0,0 +1,795 @@
|
|||
/*
|
||||
** Command & Conquer Generals(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) 2001-2003 Electronic Arts Inc. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// FILE: WinMain.cpp //////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: RTS3
|
||||
//
|
||||
// File name: GUIEdit.cpp
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: GUI Edit and window layout entry point
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "Common/Debug.h"
|
||||
#include "Common/GameMemory.h"
|
||||
#include "Common/GameEngine.h"
|
||||
#include "GameClient/GameWindowManager.h"
|
||||
#include "Win32Device/GameClient/Win32Mouse.h"
|
||||
#include "Resource.h"
|
||||
#include "Lib/BaseType.h"
|
||||
#include "GUIEdit.h"
|
||||
#include "EditWindow.h"
|
||||
#include "DialogProc.h"
|
||||
#include "LayoutScheme.h"
|
||||
|
||||
// DEFINES ////////////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE TYPES //////////////////////////////////////////////////////////////
|
||||
|
||||
// PRIVATE DATA ///////////////////////////////////////////////////////////////
|
||||
static char *szWindowClass = "GUIEdit";
|
||||
|
||||
// PUBLIC DATA ////////////////////////////////////////////////////////////////
|
||||
HINSTANCE ApplicationHInstance; ///< main application instance
|
||||
HWND ApplicationHWnd; ///< main application HWnd
|
||||
Win32Mouse *TheWin32Mouse = NULL; ///< for Win32 mouse
|
||||
char *gAppPrefix = "ge_"; /// So GuiEdit can have a different debug log file name if we need it
|
||||
|
||||
const Char *g_strFile = "data\\Generals.str";
|
||||
const Char *g_csfFile = "data\\%s\\Generals.csf";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK AboutCallback(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// initInstance ===============================================================
|
||||
//
|
||||
// FUNCTION: initInstance(HANDLE, int)
|
||||
//
|
||||
// PURPOSE: Saves instance handle and creates main window
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// In this function, we save the instance handle in a global variable and
|
||||
// create and display the main program window.
|
||||
//
|
||||
//=============================================================================
|
||||
static BOOL initInstance( HINSTANCE hInstance, int nCmdShow )
|
||||
{
|
||||
|
||||
// store application instance
|
||||
ApplicationHInstance = hInstance;
|
||||
|
||||
// create app window and keep handle
|
||||
ApplicationHWnd = CreateWindowEx( 0, // extended style
|
||||
szWindowClass, // window class name
|
||||
"GUIEdit", // window name
|
||||
WS_OVERLAPPEDWINDOW, // window styles
|
||||
0, // x position
|
||||
0, // y position
|
||||
GetSystemMetrics( SM_CXSCREEN ), // width
|
||||
GetSystemMetrics( SM_CYSCREEN ), // height
|
||||
NULL, // parent
|
||||
NULL, // menu
|
||||
ApplicationHInstance, // instance
|
||||
NULL ); // creation data
|
||||
|
||||
if( ApplicationHWnd == NULL )
|
||||
return FALSE;
|
||||
|
||||
// display the window
|
||||
ShowWindow( ApplicationHWnd, SW_MAXIMIZE );
|
||||
UpdateWindow( ApplicationHWnd );
|
||||
|
||||
return TRUE;
|
||||
|
||||
} // end initInstance
|
||||
|
||||
// registerClass ==============================================================
|
||||
//
|
||||
// FUNCTION: registerClass()
|
||||
//
|
||||
// PURPOSE: Registers the window class.
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// This function and its usage is only necessary if you want this code
|
||||
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
|
||||
// function that was added to Windows 95. It is important to call this function
|
||||
// so that the application will get 'well formed' small icons associated
|
||||
// with it.
|
||||
//
|
||||
//=============================================================================
|
||||
static ATOM registerClass(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSEX wcex;
|
||||
|
||||
wcex.cbSize = sizeof( WNDCLASSEX );
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)GUIEDIT_LARGE_ICON);
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
|
||||
wcex.lpszMenuName = (LPCSTR)GUIEDIT_MENU;
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)GUIEDIT_SMALL_ICON);
|
||||
|
||||
return RegisterClassEx( &wcex );
|
||||
|
||||
} // registerClass
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// WinMain ====================================================================
|
||||
/** Entry point for application */
|
||||
//=============================================================================
|
||||
Int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
Int returnValue;
|
||||
HACCEL hAccelTable;
|
||||
Bool quit = FALSE;
|
||||
|
||||
/// @todo remove this force set of working directory later
|
||||
Char buffer[ _MAX_PATH ];
|
||||
GetModuleFileName( NULL, buffer, sizeof( buffer ) );
|
||||
Char *pEnd = buffer + strlen( buffer );
|
||||
while( pEnd != buffer )
|
||||
{
|
||||
if( *pEnd == '\\' )
|
||||
{
|
||||
*pEnd = 0;
|
||||
break;
|
||||
}
|
||||
pEnd--;
|
||||
}
|
||||
::SetCurrentDirectory(buffer);
|
||||
|
||||
// start the log
|
||||
DEBUG_INIT(DEBUG_FLAGS_DEFAULT);
|
||||
initMemoryManager();
|
||||
|
||||
// register a class for our window with the OS
|
||||
registerClass( hInstance );
|
||||
|
||||
// Perform application initialization:
|
||||
if( !initInstance( hInstance, nCmdShow ) )
|
||||
return FALSE;
|
||||
|
||||
// load accellerator table
|
||||
hAccelTable = LoadAccelerators( hInstance, (LPCTSTR)GUIEDIT_ACCELERATORS );
|
||||
|
||||
// initialize the common controls
|
||||
INITCOMMONCONTROLSEX controls;
|
||||
controls.dwSize = sizeof( controls );
|
||||
controls.dwICC = ICC_BAR_CLASSES;
|
||||
InitCommonControlsEx( &controls );
|
||||
|
||||
// initialize GUIEdit data
|
||||
TheEditor = new GUIEdit;
|
||||
if( TheEditor == NULL )
|
||||
return FALSE;
|
||||
TheEditor->init();
|
||||
|
||||
//
|
||||
// see if we have any messages to process, a NULL window handle tells the
|
||||
// OS to look at the main window associated with the calling thread, us!
|
||||
//
|
||||
while( quit == FALSE )
|
||||
{
|
||||
|
||||
// is there is message ready for us?
|
||||
if( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
|
||||
{
|
||||
|
||||
// process ALL messages waiting
|
||||
while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
|
||||
{
|
||||
|
||||
// get the message
|
||||
returnValue = GetMessage( &msg, NULL, 0, 0 );
|
||||
|
||||
// check for quitting
|
||||
if( returnValue == 0 )
|
||||
quit = TRUE;
|
||||
|
||||
// translate accelerator messages
|
||||
if( !TranslateAccelerator( msg.hwnd, hAccelTable, &msg ) )
|
||||
{
|
||||
|
||||
// translate and dispatch the message
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessage( &msg );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end while
|
||||
|
||||
} // end if
|
||||
else
|
||||
{
|
||||
|
||||
// udpate our universe
|
||||
TheEditor->update();
|
||||
Sleep(1);
|
||||
|
||||
} // end else
|
||||
|
||||
} // end while
|
||||
|
||||
// shutdown GUIEdit data
|
||||
delete TheEditor;
|
||||
TheEditor = NULL;
|
||||
|
||||
// close the log
|
||||
shutdownMemoryManager();
|
||||
DEBUG_SHUTDOWN();
|
||||
|
||||
return msg.wParam;
|
||||
|
||||
} // end WinMain
|
||||
|
||||
// WndProc ====================================================================
|
||||
//
|
||||
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
|
||||
//
|
||||
// PURPOSE: Processes messages for the main window.
|
||||
//
|
||||
// WM_COMMAND - process the application menu
|
||||
// WM_PAINT - Paint the main window
|
||||
// WM_DESTROY - post a quit message and return
|
||||
//
|
||||
//=============================================================================
|
||||
LRESULT CALLBACK WndProc( HWND hWnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
|
||||
switch( message )
|
||||
{
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
|
||||
// keep focus in our app
|
||||
if( GetFocus() != hWnd )
|
||||
SetFocus( hWnd );
|
||||
return 0;
|
||||
|
||||
} // end move mouse
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_COMMAND:
|
||||
{
|
||||
Int controlID = LOWORD( wParam );
|
||||
// Int nofifyCode = HIWORD( wParam );
|
||||
// HWND hWndControl = (HWND)lParam;
|
||||
|
||||
switch( controlID )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_EXIT:
|
||||
TheEditor->menuExit();
|
||||
break;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
case MENU_NEW:
|
||||
TheEditor->menuNew();
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_OPEN:
|
||||
TheEditor->menuOpen();
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_SAVE:
|
||||
TheEditor->menuSave();
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_SAVEAS:
|
||||
TheEditor->menuSaveAs();
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_COPY:
|
||||
TheEditor->menuCopy();
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_CUT:
|
||||
TheEditor->menuCut();
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_PASTE:
|
||||
TheEditor->menuPaste();
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_CALLBACKS:
|
||||
DialogBox( TheEditor->getInstance(), (LPCTSTR)CALLBACK_EDITOR_DIALOG,
|
||||
TheEditor->getWindowHandle(), CallbackEditorDialogProc );
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_GRID_SETTINGS:
|
||||
DialogBox( TheEditor->getInstance(), (LPCTSTR)GRID_SETTINGS_DIALOG,
|
||||
TheEditor->getWindowHandle(), GridSettingsDialogProc );
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_SHOW_HIDDEN_OUTLINES:
|
||||
TheEditor->setShowHiddenOutlines( !TheEditor->getShowHiddenOutlines() );
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_SHOW_SEE_THRU_OUTLINES:
|
||||
TheEditor->setShowSeeThruOutlines( !TheEditor->getShowSeeThruOutlines() );
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_TEST_MODE:
|
||||
|
||||
// switch to test mode or edit mode
|
||||
if( TheEditor)
|
||||
{
|
||||
EditMode mode = TheEditor->getMode();
|
||||
|
||||
if( mode != MODE_TEST_RUN )
|
||||
TheEditor->setMode( MODE_TEST_RUN );
|
||||
else
|
||||
TheEditor->setMode( MODE_EDIT );
|
||||
|
||||
} // end if
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_BACKGROUND_COLOR:
|
||||
|
||||
if( TheEditWindow )
|
||||
{
|
||||
RGBColorReal color = TheEditWindow->getBackgroundColor();
|
||||
RGBColorInt *newColor;
|
||||
POINT mouse;
|
||||
|
||||
// get mouse point
|
||||
GetCursorPos( &mouse );
|
||||
|
||||
// select a new color
|
||||
newColor = SelectColor( (Int)(255.0f * color.red),
|
||||
(Int)(255.0f * color.green),
|
||||
(Int)(255.0f * color.blue),
|
||||
(Int)(255.0f * color.alpha),
|
||||
mouse.x, mouse.y );
|
||||
if( newColor )
|
||||
{
|
||||
|
||||
color.red = (Real)newColor->red / 255.0f;
|
||||
color.green = (Real)newColor->green / 255.0f;
|
||||
color.blue = (Real)newColor->blue / 255.0f;
|
||||
color.alpha = (Real)newColor->alpha / 255.0f;
|
||||
TheEditWindow->setBackgroundColor( color );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
break;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_SCHEME:
|
||||
{
|
||||
|
||||
// open the default scheme information
|
||||
if( TheDefaultScheme )
|
||||
TheDefaultScheme->openDialog();
|
||||
break;
|
||||
|
||||
} // end scheme
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case MENU_ABOUT:
|
||||
{
|
||||
|
||||
DialogBox( ApplicationHInstance, (LPCTSTR)ABOUT_DIALOG,
|
||||
hWnd, (DLGPROC)AboutCallback );
|
||||
break;
|
||||
|
||||
} // end about
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
default:
|
||||
{
|
||||
|
||||
return DefWindowProc( hWnd, message, wParam, lParam );
|
||||
|
||||
} // end default
|
||||
|
||||
} // end switch( controlID )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end command
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_CLOSE:
|
||||
{
|
||||
|
||||
// close gets initiated from the 'x' in the top right of the window
|
||||
TheEditor->menuExit();
|
||||
return 0;
|
||||
|
||||
} // end close
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_KEYDOWN:
|
||||
{
|
||||
Int virtualKey = wParam;
|
||||
// Int keyData = lParam;
|
||||
Bool controlDown = BitTest( GetKeyState( VK_CONTROL ), 0x1000 );
|
||||
|
||||
switch( virtualKey )
|
||||
{
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case VK_ESCAPE:
|
||||
{
|
||||
|
||||
// unselect all windows
|
||||
if( TheEditor )
|
||||
if(TheEditor->getMode() == MODE_KEYBOARD_MOVE)
|
||||
TheEditor->setMode( MODE_EDIT );
|
||||
else
|
||||
TheEditor->clearSelections();
|
||||
break;
|
||||
|
||||
} // end escape
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case VK_DELETE:
|
||||
{
|
||||
|
||||
// delete all selected windows
|
||||
if( TheEditor )
|
||||
TheEditor->deleteSelected();
|
||||
break;
|
||||
|
||||
} // end delete
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case VK_LEFT:
|
||||
{
|
||||
|
||||
// delete all selected windows
|
||||
if( TheEditor && TheEditWindow)
|
||||
{
|
||||
if(TheEditor->getMode() == MODE_EDIT)
|
||||
{
|
||||
|
||||
if(TheEditor->selectionCount() <= 0 )
|
||||
break;
|
||||
ICoord2D zero;
|
||||
zero.x = zero.y = 0;
|
||||
TheEditWindow->setDragMoveOrigin(&zero);
|
||||
TheEditWindow->setDragMoveDest(&zero);
|
||||
|
||||
TheEditor->setMode(MODE_KEYBOARD_MOVE);
|
||||
}
|
||||
if(TheEditor->getMode() == MODE_KEYBOARD_MOVE)
|
||||
{
|
||||
ICoord2D temp;
|
||||
|
||||
temp = TheEditWindow->getDragMoveDest();
|
||||
if(!controlDown && TheEditor->isGridSnapOn())
|
||||
{
|
||||
temp.x -= TheEditor->getGridResolution();
|
||||
TheEditor->gridSnapLocation(&temp,&temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.x--;
|
||||
}
|
||||
TheEditWindow->setDragMoveDest(&temp);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
} // end Left
|
||||
// --------------------------------------------------------------------
|
||||
case VK_RIGHT:
|
||||
{
|
||||
|
||||
// delete all selected windows
|
||||
if( TheEditor && TheEditWindow)
|
||||
{
|
||||
if(TheEditor->getMode() == MODE_EDIT)
|
||||
{
|
||||
|
||||
if(TheEditor->selectionCount() <= 0 )
|
||||
break;
|
||||
ICoord2D zero;
|
||||
zero.x = zero.y = 0;
|
||||
TheEditWindow->setDragMoveOrigin(&zero);
|
||||
TheEditWindow->setDragMoveDest(&zero);
|
||||
|
||||
TheEditor->setMode(MODE_KEYBOARD_MOVE);
|
||||
}
|
||||
if(TheEditor->getMode() == MODE_KEYBOARD_MOVE)
|
||||
{
|
||||
ICoord2D temp;
|
||||
|
||||
temp = TheEditWindow->getDragMoveDest();
|
||||
if(!controlDown && TheEditor->isGridSnapOn())
|
||||
{
|
||||
temp.x += TheEditor->getGridResolution();
|
||||
TheEditor->gridSnapLocation(&temp,&temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.x++;
|
||||
}
|
||||
TheEditWindow->setDragMoveDest(&temp);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
} // end RIGHT
|
||||
// --------------------------------------------------------------------
|
||||
case VK_UP:
|
||||
{
|
||||
|
||||
// delete all selected windows
|
||||
if( TheEditor && TheEditWindow)
|
||||
{
|
||||
if(TheEditor->getMode() == MODE_EDIT)
|
||||
{
|
||||
|
||||
if(TheEditor->selectionCount() <= 0 )
|
||||
break;
|
||||
ICoord2D zero;
|
||||
zero.x = zero.y = 0;
|
||||
TheEditWindow->setDragMoveOrigin(&zero);
|
||||
TheEditWindow->setDragMoveDest(&zero);
|
||||
|
||||
TheEditor->setMode(MODE_KEYBOARD_MOVE);
|
||||
}
|
||||
if(TheEditor->getMode() == MODE_KEYBOARD_MOVE)
|
||||
{
|
||||
ICoord2D temp;
|
||||
|
||||
temp = TheEditWindow->getDragMoveDest();
|
||||
|
||||
if(!controlDown && TheEditor->isGridSnapOn())
|
||||
{
|
||||
temp.y -= TheEditor->getGridResolution();
|
||||
TheEditor->gridSnapLocation(&temp,&temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.y--;
|
||||
}
|
||||
TheEditWindow->setDragMoveDest(&temp);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
} // end Up
|
||||
// --------------------------------------------------------------------
|
||||
case VK_DOWN:
|
||||
{
|
||||
|
||||
// delete all selected windows
|
||||
if( TheEditor && TheEditWindow)
|
||||
{
|
||||
if(TheEditor->getMode() == MODE_EDIT)
|
||||
{
|
||||
|
||||
if(TheEditor->selectionCount() <= 0 )
|
||||
break;
|
||||
ICoord2D zero;
|
||||
zero.x = zero.y = 0;
|
||||
TheEditWindow->setDragMoveOrigin(&zero);
|
||||
TheEditWindow->setDragMoveDest(&zero);
|
||||
|
||||
TheEditor->setMode(MODE_KEYBOARD_MOVE);
|
||||
}
|
||||
if(TheEditor->getMode() == MODE_KEYBOARD_MOVE)
|
||||
{
|
||||
ICoord2D temp;
|
||||
|
||||
temp = TheEditWindow->getDragMoveDest();
|
||||
if(!controlDown && TheEditor->isGridSnapOn())
|
||||
{
|
||||
temp.y += TheEditor->getGridResolution();
|
||||
TheEditor->gridSnapLocation(&temp,&temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.y++;
|
||||
}
|
||||
TheEditWindow->setDragMoveDest(&temp);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
} // end Down
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
case VK_RETURN:
|
||||
{
|
||||
if( TheEditor && TheEditWindow && TheEditor->getMode() == MODE_KEYBOARD_MOVE )
|
||||
{
|
||||
ICoord2D tempOrigin, tempDest;
|
||||
tempDest = TheEditWindow->getDragMoveDest();
|
||||
tempOrigin = TheEditWindow->getDragMoveOrigin();
|
||||
|
||||
// move the windows
|
||||
TheEditor->dragMoveSelectedWindows( &tempOrigin, &tempDest );
|
||||
|
||||
// go back to normal mode
|
||||
TheEditor->setMode( MODE_EDIT );
|
||||
}
|
||||
break;
|
||||
}// end Enter
|
||||
|
||||
} // end switch( virtualKey )
|
||||
|
||||
return 0;
|
||||
|
||||
} // end key down
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_SIZE:
|
||||
{
|
||||
Int width = LOWORD( lParam );
|
||||
Int height = HIWORD( lParam );
|
||||
|
||||
// resize status bar
|
||||
if( TheEditor )
|
||||
{
|
||||
HWND statusBar = TheEditor->getStatusBarWindowHandle();
|
||||
|
||||
if( statusBar )
|
||||
{
|
||||
RECT rect;
|
||||
Int barX, barY;
|
||||
Int barWidth, barHeight;
|
||||
|
||||
// keep status window height the same
|
||||
GetWindowRect( statusBar, &rect );
|
||||
barWidth = width;
|
||||
barHeight = rect.bottom - rect.top;
|
||||
|
||||
barX = 0;
|
||||
barY = height - barHeight;
|
||||
MoveWindow( statusBar, barX, barY, barWidth, barHeight, TRUE );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
return 0;
|
||||
|
||||
} // end size
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
|
||||
} // end paint
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
case WM_DESTROY:
|
||||
{
|
||||
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
} // end destroy
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
default:
|
||||
{
|
||||
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
} // end default
|
||||
|
||||
} // end switch( message )
|
||||
|
||||
return DefWindowProc( hWnd, message, wParam, lParam );
|
||||
|
||||
} // end WndProc
|
||||
|
||||
// AboutCallback ==============================================================
|
||||
/** Mesage handler for about box. */
|
||||
//=============================================================================
|
||||
LRESULT CALLBACK AboutCallback( HWND hDlg, UINT message,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
} // end AboutCallback
|
||||
|
Reference in a new issue