Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
EditWindow Class Reference

#include <EditWindow.h>

Public Member Functions

 EditWindow (void)
 
 ~EditWindow (void)
 
void init (UnsignedInt clientWidth, UnsignedInt clientHeight)
 initialize the edit window singleton
 
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
 
void mouseEvent (UnsignedInt windowsMessage, WPARAM wParam, LPARAM lParam)
 mouse event has occurred, button up/down, move etc.
 
void getPopupMenuClickPos (ICoord2D *pos)
 get popup menu click loc
 
void openPopupMenu (Int x, Int y)
 open floating popup right click menu
 
void drawLine (Int startX, Int startY, Int endX, Int endY, Real lineWidth, UnsignedInt lineColor)
 draw a line on the display in screen coordinates
 
void drawOpenRect (Int startX, Int startY, Int width, Int height, Real lineWidth, UnsignedInt lineColor)
 draw a rect border on the display in pixel coordinates with the specified color
 
void drawFillRect (Int startX, Int startY, Int width, Int height, UnsignedInt color)
 draw a filled rect on the display in pixel coords with the specified color
 
void drawImage (const Image *image, Int startX, Int startY, Int endX, Int endY, Color color=0xFFFFFFFF)
 draw an image fit within the screen coordinates
 
void setClipRegion (IRegion2D *region)
 image clipping support
 
Bool isClippingEnabled (void)
 
void enableClipping (Bool onoff)
 

Protected Member Functions

void registerEditWindowClass (void)
 register class with OS
 
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
 
void handleResizeAvailable (Int mouseX, Int mouseY)
 if mouse is close to selected window allow resize
 
Bool inCornerTolerance (ICoord2D *dest, ICoord2D *source, Int tolerance)
 
Bool inLineTolerance (ICoord2D *dest, ICoord2D *lineStart, ICoord2D *lineEnd, Int tolerance)
 

Static Protected Member Functions

static LRESULT CALLBACK editProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 callback from windows, NOTE that it's static and has no this pointer
 

Protected Attributes

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.
 
WW3DAssetManagerm_assetManager
 asset manager for WW3D
 
Render2DClassm_2DRender
 our 2D renderer
 
ICoord2D m_popupMenuClickPos
 position where popup menu was created at
 
GameWindowm_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.
 
GameWindowm_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
 

Static Protected Attributes

static Bool m_classRegistered = FALSE
 TRUE when we've register with OS.
 
static char * m_className = "EditWindowClass"
 name for windows class
 

Detailed Description

The edit window singleton definition, this is where we create and interact with GUI controls for this tool

Definition at line 73 of file EditWindow.h.

Constructor & Destructor Documentation

◆ EditWindow()

EditWindow::EditWindow ( void )

Definition at line 348 of file EditWindow.cpp.

◆ ~EditWindow()

EditWindow::~EditWindow ( void )

Definition at line 399 of file EditWindow.cpp.

Member Function Documentation

◆ draw()

void EditWindow::draw ( void )

draw the edit window

Draw the edit window

Definition at line 1470 of file EditWindow.cpp.

◆ drawFillRect()

void EditWindow::drawFillRect ( Int startX,
Int startY,
Int width,
Int height,
UnsignedInt color )

draw a filled rect on the display in pixel coords with the specified color

draw a filled rect on the display in pixel coords with the specified color

Definition at line 1612 of file EditWindow.cpp.

◆ drawGrid()

void EditWindow::drawGrid ( void )
protected

draw the grid

Draw the grid

Definition at line 1414 of file EditWindow.cpp.

◆ drawHiddenOutlines()

void EditWindow::drawHiddenOutlines ( GameWindow * windowList,
Color c )
protected

Draw an outline for a window that is hidden so we can still work with it in the editor

Definition at line 1152 of file EditWindow.cpp.

◆ drawImage()

void EditWindow::drawImage ( const Image * image,
Int startX,
Int startY,
Int endX,
Int endY,
Color color = 0xFFFFFFFF )

draw an image fit within the screen coordinates

draw an image fit within the screen coordinates

Definition at line 1631 of file EditWindow.cpp.

◆ drawLine()

void EditWindow::drawLine ( Int startX,
Int startY,
Int endX,
Int endY,
Real lineWidth,
UnsignedInt lineColor )

draw a line on the display in screen coordinates

draw a line on the display in pixel coordinates with the specified color

Definition at line 1575 of file EditWindow.cpp.

◆ drawOpenRect()

void EditWindow::drawOpenRect ( Int startX,
Int startY,
Int width,
Int height,
Real lineWidth,
UnsignedInt lineColor )

draw a rect border on the display in pixel coordinates with the specified color

draw a rect border on the display in pixel coordinates with the specified color

Definition at line 1592 of file EditWindow.cpp.

◆ drawSeeThruOutlines()

void EditWindow::drawSeeThruOutlines ( GameWindow * windowList,
Color c )
protected

Draw an outline for a window that is see thru so we can still work with it in the editor

Definition at line 1116 of file EditWindow.cpp.

◆ drawUIFeedback()

void EditWindow::drawUIFeedback ( void )
protected

draw UI visual feedback

Draw any visual feedback to the user about selection boxes or windows that are selected, draggin windows etc

Definition at line 1203 of file EditWindow.cpp.

◆ editProc()

LRESULT CALLBACK EditWindow::editProc ( HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam )
staticprotected

callback from windows, NOTE that it's static and has no this pointer

Window procedure for the edit window

Definition at line 90 of file EditWindow.cpp.

◆ enableClipping()

void EditWindow::enableClipping ( Bool onoff)
inline

Definition at line 129 of file EditWindow.h.

◆ getBackgroundColor()

RGBColorReal EditWindow::getBackgroundColor ( void )

return the background color

Get the background color for the edit window

Definition at line 1731 of file EditWindow.cpp.

◆ getDragMoveDest()

ICoord2D EditWindow::getDragMoveDest ( void )
inline

for keyboard moving

Definition at line 199 of file EditWindow.h.

◆ getDragMoveOrigin()

ICoord2D EditWindow::getDragMoveOrigin ( void )
inline

for keybord moving

Definition at line 200 of file EditWindow.h.

◆ getPopupMenuClickPos()

void EditWindow::getPopupMenuClickPos ( ICoord2D * pos)
inline

get popup menu click loc

Definition at line 196 of file EditWindow.h.

◆ getSize()

void EditWindow::getSize ( ICoord2D * size)
inline

get width and height for edit window

Definition at line 195 of file EditWindow.h.

◆ getWindowHandle()

HWND EditWindow::getWindowHandle ( void )
inline

get window handle

Definition at line 194 of file EditWindow.h.

◆ handleResizeAvailable()

void EditWindow::handleResizeAvailable ( Int mouseX,
Int mouseY )
protected

if mouse is close to selected window allow resize

Given the mouse position, if it is close enough to a corner of a SINGLE selected window then we change the icon to the appropriate resize icon. If the mouse is not moved from this position then the next left click will allow for a resize of the window

Definition at line 993 of file EditWindow.cpp.

◆ inCornerTolerance()

Bool EditWindow::inCornerTolerance ( ICoord2D * dest,
ICoord2D * source,
Int tolerance )
protected

If the 'dest' point is within 'tolerance' distance to the 'source' point this returns TRUE

Todo
we should write PointInRegion() stuff again like it was in Nox

Definition at line 928 of file EditWindow.cpp.

◆ init()

void EditWindow::init ( UnsignedInt clientWidth,
UnsignedInt clientHeight )

initialize the edit window singleton

Initialize the edit window

< this makes text look good :)

Definition at line 410 of file EditWindow.cpp.

◆ inLineTolerance()

Bool EditWindow::inLineTolerance ( ICoord2D * dest,
ICoord2D * lineStart,
ICoord2D * lineEnd,
Int tolerance )
protected

If the 'dest' point is within the region defined around the line with th specified tolerance return TRUE

Definition at line 960 of file EditWindow.cpp.

◆ isClippingEnabled()

Bool EditWindow::isClippingEnabled ( void )
inline

Definition at line 128 of file EditWindow.h.

◆ mouseEvent()

void EditWindow::mouseEvent ( UnsignedInt windowsMessage,
WPARAM wParam,
LPARAM lParam )

mouse event has occurred, button up/down, move etc.

A mouse event has occurred from our window procedure

Definition at line 552 of file EditWindow.cpp.

◆ notifyWindowDeleted()

void EditWindow::notifyWindowDeleted ( GameWindow * window)

window has been deleted

A window has been deleted from the editor and the editor is now notifying the edit window about it in case anything must be cleaned up

Definition at line 1753 of file EditWindow.cpp.

◆ openPopupMenu()

void EditWindow::openPopupMenu ( Int x,
Int y )

open floating popup right click menu

Open the new control menu that comes up when the user right clicks in the workspace to create new controls

Definition at line 1528 of file EditWindow.cpp.

◆ registerEditWindowClass()

void EditWindow::registerEditWindowClass ( void )
protected

register class with OS

Register a class with the windows OS for an edit window

Definition at line 313 of file EditWindow.cpp.

◆ setBackgroundColor()

void EditWindow::setBackgroundColor ( RGBColorReal color)

set background color

Set the background color for the edit window

Definition at line 1741 of file EditWindow.cpp.

◆ setClipRegion()

void EditWindow::setClipRegion ( IRegion2D * region)
inline

image clipping support

Definition at line 127 of file EditWindow.h.

◆ setDragMoveDest()

void EditWindow::setDragMoveDest ( ICoord2D * pos)
inline

for drag moving

Definition at line 197 of file EditWindow.h.

◆ setDragMoveOrigin()

void EditWindow::setDragMoveOrigin ( ICoord2D * pos)
inline

for drag moving

Definition at line 198 of file EditWindow.h.

◆ setSize()

void EditWindow::setSize ( ICoord2D * size)

set width and height for edit window

The edit window should now be logically consider this size

Definition at line 1500 of file EditWindow.cpp.

◆ shutdown()

void EditWindow::shutdown ( void )

free all data

Shutdown edit window

Definition at line 493 of file EditWindow.cpp.

◆ updatePulse()

void EditWindow::updatePulse ( void )

pulse message from timer

Update pulse from timer message

Definition at line 526 of file EditWindow.cpp.

Member Data Documentation

◆ m_2DRender

Render2DClass* EditWindow::m_2DRender
protected

our 2D renderer

Definition at line 170 of file EditWindow.h.

◆ m_assetManager

WW3DAssetManager* EditWindow::m_assetManager
protected

asset manager for WW3D

Definition at line 169 of file EditWindow.h.

◆ m_backgroundColor

RGBColorReal EditWindow::m_backgroundColor
protected

the background color

Definition at line 166 of file EditWindow.h.

◆ m_bitDepth

UnsignedByte EditWindow::m_bitDepth
protected

bit depth for edit window

Definition at line 161 of file EditWindow.h.

◆ m_className

char * EditWindow::m_className = "EditWindowClass"
staticprotected

name for windows class

edit window class name

Definition at line 158 of file EditWindow.h.

◆ m_classRegistered

Bool EditWindow::m_classRegistered = FALSE
staticprotected

TRUE when we've register with OS.

class registered flag

Definition at line 157 of file EditWindow.h.

◆ m_clipRegion

IRegion2D EditWindow::m_clipRegion
protected

the clipping region for images

Definition at line 186 of file EditWindow.h.

◆ m_dragMoveDest

ICoord2D EditWindow::m_dragMoveDest
protected

destination for drag move

Definition at line 176 of file EditWindow.h.

◆ m_dragMoveOrigin

ICoord2D EditWindow::m_dragMoveOrigin
protected

mouse click position to start drag move

Definition at line 175 of file EditWindow.h.

◆ m_dragSelecting

Bool EditWindow::m_dragSelecting
protected

TRUE when drawing a selection box.

Definition at line 178 of file EditWindow.h.

◆ m_editWindowHWnd

HWND EditWindow::m_editWindowHWnd
protected

edit window handle

Definition at line 162 of file EditWindow.h.

◆ m_isClippedEnabled

Bool EditWindow::m_isClippedEnabled
protected

used by 2D drawing operations to define clip re

Definition at line 187 of file EditWindow.h.

◆ m_pickedWindow

GameWindow* EditWindow::m_pickedWindow
protected

picked window from mouse click editing

Definition at line 173 of file EditWindow.h.

◆ m_popupMenuClickPos

ICoord2D EditWindow::m_popupMenuClickPos
protected

position where popup menu was created at

Definition at line 172 of file EditWindow.h.

◆ m_pulse

Int EditWindow::m_pulse
protected

for visual feedback that looks cool!

Definition at line 164 of file EditWindow.h.

◆ m_resizeDest

ICoord2D EditWindow::m_resizeDest
protected

mouse pos when dragging around to resize

Definition at line 184 of file EditWindow.h.

◆ m_resizeOrigin

ICoord2D EditWindow::m_resizeOrigin
protected

mouse clicked down here to drag resize

Definition at line 183 of file EditWindow.h.

◆ m_resizingWindow

Bool EditWindow::m_resizingWindow
protected

TRUE when drag resizing a window.

Definition at line 181 of file EditWindow.h.

◆ m_selectRegion

IRegion2D EditWindow::m_selectRegion
protected

region for selection box

Definition at line 179 of file EditWindow.h.

◆ m_size

ICoord2D EditWindow::m_size
protected

width and height of edit window

Definition at line 160 of file EditWindow.h.

◆ m_w3dInitialized

Bool EditWindow::m_w3dInitialized
protected

TRUE once W3D is up.

Definition at line 168 of file EditWindow.h.

◆ m_windowToResize

GameWindow* EditWindow::m_windowToResize
protected

the window to resize

Definition at line 182 of file EditWindow.h.


The documentation for this class was generated from the following files: