1112 lines
32 KiB
C++
1112 lines
32 KiB
C++
// CPACWDlg.cpp : implementation file
|
|
///////////////////////////////////////
|
|
#include "StdAfx.h"
|
|
|
|
#include "EDACDgWa.hpp"
|
|
|
|
#include "_AInterf.hpp"
|
|
#include "EDACVwMS.hpp"
|
|
#include "EDACFmMn.hpp"
|
|
#include "EDACDatW.hpp"
|
|
#include "EDACCnst.hpp"
|
|
#include "EDACActr.hpp"
|
|
#include "EDACDgQu.hpp"
|
|
#include "EDACVwAc.hpp"
|
|
#include "help_def.h"
|
|
|
|
//External Modules
|
|
#include "IncTUT.h"
|
|
//End of External Modules
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
#define C_SPACING 5
|
|
#define C_WATCH_ADD_MARGIN 3
|
|
#define C_WATCH_Y_ADD_MARGIN 2
|
|
#define C_WATCH_TITLE_MARGIN 2
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// EdActors_WatchDialog dialog
|
|
|
|
BEGIN_MESSAGE_MAP(EdActors_WatchDialog, CDialog)
|
|
//{{AFX_MSG_MAP(EdActors_WatchDialog)
|
|
ON_WM_SIZE()
|
|
ON_NOTIFY(LVN_COLUMNCLICK, IDC_LIST_VALUES, OnColumnclickListValues)
|
|
ON_NOTIFY(LVN_KEYDOWN, IDC_LIST_VALUES, OnKeydownListValues)
|
|
ON_NOTIFY(NM_DBLCLK, IDC_LIST_VALUES, OnDblclkListValues)
|
|
ON_NOTIFY(TVN_KEYDOWN, IDC_TREE_ACTORS, OnKeydownTreeActors)
|
|
ON_NOTIFY(NM_DBLCLK, IDC_TREE_ACTORS, OnDblclkTreeActors)
|
|
ON_WM_HELPINFO()
|
|
ON_WM_PAINT()
|
|
ON_WM_NCRBUTTONDOWN()
|
|
ON_COMMAND(ID_WATCH_LIST, OnWatchList)
|
|
ON_COMMAND(ID_WATCH_TREE, OnWatchTree)
|
|
ON_WM_NCACTIVATE()
|
|
ON_WM_NCLBUTTONDOWN()
|
|
ON_WM_DESTROY()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
//**************************************************************************
|
|
EdActors_WatchDialog::EdActors_WatchDialog(CWnd* pParent /*=NULL*/)
|
|
: CDialog(EdActors_WatchDialog::IDD, &g_oBaseFrame)
|
|
{
|
|
//{{AFX_DATA_INIT(EdActors_WatchDialog)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
|
|
Create(EdActors_WatchDialog::IDD, pParent);
|
|
|
|
m_bIsVisible = FALSE;
|
|
m_bTreeMode = TRUE;
|
|
}
|
|
|
|
//**************************************************************************
|
|
EdActors_WatchDialog::~EdActors_WatchDialog()
|
|
{
|
|
POSITION pos = m_clWatchDataList.GetHeadPosition();
|
|
while ( pos != NULL )
|
|
delete (m_clWatchDataList.GetNext(pos));
|
|
}
|
|
|
|
//**************************************************************************
|
|
BOOL EdActors_WatchDialog::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
//Moves the window according to loaded preferences (or default values)
|
|
CRect crWindowRect;
|
|
crWindowRect.top = g_pclInterface->m_clDocument.m_ulWatchPosTop;
|
|
crWindowRect.bottom = g_pclInterface->m_clDocument.m_ulWatchPosBottom;
|
|
crWindowRect.left = g_pclInterface->m_clDocument.m_ulWatchPosLeft;
|
|
crWindowRect.right = g_pclInterface->m_clDocument.m_ulWatchPosRight;
|
|
MoveWindow(crWindowRect);
|
|
|
|
//Creates a font for Caption Bar
|
|
m_clFont.CreateFont(GetSystemMetrics( SM_CYCAPTION ) - 2*C_WATCH_TITLE_MARGIN,
|
|
0,0,0,FW_BOLD,FALSE,FALSE,FALSE,DEFAULT_CHARSET,
|
|
OUT_STRING_PRECIS,CLIP_CHARACTER_PRECIS,DEFAULT_QUALITY,
|
|
DEFAULT_PITCH,"Arial");
|
|
|
|
//Prepares List Control
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
|
|
LV_COLUMN lvcolumn;
|
|
|
|
lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
|
|
lvcolumn.fmt = LVCFMT_CENTER;
|
|
lvcolumn.pszText = "Actor";
|
|
lvcolumn.iSubItem = 0;
|
|
lvcolumn.cx =(crWindowRect.Width() - 4*C_SPACING)/3;
|
|
pclListCtrl->InsertColumn(0, &lvcolumn);
|
|
|
|
lvcolumn.pszText = "Field";
|
|
lvcolumn.iSubItem = 1;
|
|
pclListCtrl->InsertColumn(1, &lvcolumn);
|
|
|
|
lvcolumn.pszText = "Value";
|
|
lvcolumn.iSubItem = 2;
|
|
pclListCtrl->InsertColumn(2, &lvcolumn);
|
|
|
|
//Prepares Tree Control
|
|
//...
|
|
|
|
if ( m_bTreeMode )
|
|
m_fn_pclGetListCtrl()->ShowWindow(SW_HIDE);
|
|
else
|
|
m_fn_pclGetTreeCtrl()->ShowWindow(SW_HIDE);
|
|
|
|
//////////////
|
|
//////////////
|
|
//Registers for TUT Module
|
|
TUT_M_vGetTutDll();
|
|
|
|
TUT_M_vRegisterControlID(IDC_LIST_VALUES, "OAc_WatchWindow_ListControl", TUT_e_ListCtrl);
|
|
TUT_M_vRegisterControlID(IDC_TREE_ACTORS, "OAc_WatchWindow_TreeControl", TUT_e_TreeCtrl);
|
|
|
|
//End of Registers for TUT Module
|
|
//////////////
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
|
|
//*********************************************************************************
|
|
void EdActors_WatchDialog::OnDestroy()
|
|
{
|
|
//////////////
|
|
//////////////
|
|
//UnRegisters for TUT Module
|
|
TUT_M_vGetTutDll();
|
|
|
|
TUT_M_vUnregisterControlID(IDC_LIST_VALUES);
|
|
TUT_M_vUnregisterControlID(IDC_TREE_ACTORS);
|
|
|
|
//End of UnRegisters for TUT Module
|
|
//////////////
|
|
|
|
CDialog::OnDestroy();
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// EdActors_WatchDialog message handlers
|
|
|
|
///////////////////////
|
|
// Common functions //
|
|
///////////////////////
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::m_fn_vAddValue(CTL_Editor_Data *pclData)
|
|
{
|
|
//Creates a new data
|
|
EdActors_WatchData *pclNewData = new EdActors_WatchData(pclData);
|
|
m_clWatchDataList.AddTail(pclNewData);
|
|
|
|
pclData->m_bIsInWatch = TRUE;
|
|
|
|
////////////////////////////////
|
|
//Adds it in the Tree ctrl
|
|
CTreeCtrl *pclTreeCtrl = m_fn_pclGetTreeCtrl();
|
|
|
|
//Looks if this actor already has an entry
|
|
BOOL bFound = FALSE;
|
|
HTREEITEM hTreeItem = pclTreeCtrl->GetNextItem(NULL, TVGN_ROOT);
|
|
|
|
while ( (hTreeItem != NULL) && (!bFound) )
|
|
{
|
|
bFound = ( pclTreeCtrl->GetItemText(hTreeItem) == pclNewData->m_fn_csGetActorName());
|
|
|
|
if ( !bFound )
|
|
hTreeItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_NEXT);
|
|
}
|
|
|
|
CString csValueString = pclNewData->m_fn_csGetFieldName() + " = " + pclNewData->m_fn_csGetDataValue();
|
|
if ( !bFound )
|
|
hTreeItem = pclTreeCtrl->InsertItem(LPCTSTR(pclNewData->m_fn_csGetActorName()));
|
|
|
|
HTREEITEM hTreeSubItem = pclTreeCtrl->InsertItem(LPCTSTR(csValueString), hTreeItem);
|
|
pclTreeCtrl->SetItemData(hTreeSubItem, DWORD(pclNewData));
|
|
|
|
//Develops the Actor
|
|
pclTreeCtrl->Expand(hTreeItem, TVE_EXPAND);
|
|
|
|
///////////////////////////////////////
|
|
//Adds it in the list ctrl
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
|
|
short wNewIndex = pclListCtrl->GetItemCount();
|
|
|
|
LV_ITEM lvitem;
|
|
lvitem.mask = LVIF_TEXT | LVIF_STATE;
|
|
lvitem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
|
|
lvitem.state = LVIS_FOCUSED;
|
|
lvitem.iItem = wNewIndex;
|
|
lvitem.iSubItem = 0;
|
|
lvitem.pszText = (char *)LPCTSTR(pclNewData->m_fn_csGetActorName());
|
|
pclListCtrl->InsertItem(&lvitem);
|
|
|
|
lvitem.iSubItem = 1;
|
|
lvitem.mask = LVIF_TEXT /*| LVIF_STATE*/;
|
|
lvitem.pszText = (char *)LPCTSTR(pclNewData->m_fn_csGetFieldName());
|
|
pclListCtrl->SetItem(&lvitem);
|
|
|
|
lvitem.iSubItem = 2;
|
|
lvitem.pszText = (char *)LPCTSTR(pclNewData->m_fn_csGetDataValue());
|
|
pclListCtrl->SetItem(&lvitem);
|
|
|
|
pclListCtrl->SetItemData(wNewIndex, (DWORD)pclNewData);
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::m_fn_vRemoveValue(CTL_Editor_Data *pclData)
|
|
{
|
|
if ( IsWindow(m_hWnd) )
|
|
{
|
|
//////////////////////////////////////
|
|
//Removes from in the Tree ctrl
|
|
CTreeCtrl *pclTreeCtrl = m_fn_pclGetTreeCtrl();
|
|
|
|
BOOL bActorFound = FALSE;
|
|
BOOL bSubItemFound = FALSE;
|
|
HTREEITEM hTreeItem = pclTreeCtrl->GetNextItem(NULL, TVGN_ROOT);
|
|
HTREEITEM hTreeSubItem;
|
|
EdActors_WatchData *pclWatchData;
|
|
|
|
while ( (hTreeItem != NULL) && (!bActorFound) && (!bSubItemFound))
|
|
{
|
|
bActorFound = ( pclTreeCtrl->GetItemText(hTreeItem) == OAC_fn_pclGetParentActorOfData(pclData)->m_fn_csGetActorName() );
|
|
|
|
if ( bActorFound )
|
|
{
|
|
//Looks in sub items if they are selected
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
while ( (hTreeSubItem != NULL) && (!bSubItemFound) )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)pclTreeCtrl->GetItemData(hTreeSubItem);
|
|
bSubItemFound = ( pclWatchData->m_pclData == pclData );
|
|
|
|
if ( !bSubItemFound )
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeSubItem, TVGN_NEXT);
|
|
}
|
|
}
|
|
|
|
if ( !bActorFound )
|
|
hTreeItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_NEXT);
|
|
}
|
|
|
|
if ( bSubItemFound )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclTreeCtrl->GetItemData(hTreeSubItem));
|
|
//Deletes from tree
|
|
pclTreeCtrl->DeleteItem(hTreeSubItem);
|
|
|
|
//Looks if there is at least one more SubItem
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
if ( hTreeSubItem == NULL )
|
|
pclTreeCtrl->DeleteItem(hTreeItem);
|
|
}
|
|
|
|
////////////////////////////////
|
|
//Removes from the List ctrl
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
BOOL bFound = FALSE;
|
|
long c_lI;
|
|
for (c_lI = 0; (c_lI < pclListCtrl->GetItemCount()) && !bFound; c_lI++)
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclListCtrl->GetItemData(c_lI));
|
|
bFound = ( pclWatchData->m_pclData == pclData );
|
|
}
|
|
|
|
//Deletes from CList
|
|
if (bFound)
|
|
{
|
|
pclListCtrl->DeleteItem(--c_lI);
|
|
m_clWatchDataList.RemoveAt(m_clWatchDataList.Find(pclWatchData));
|
|
|
|
pclWatchData->m_pclData->m_bIsInWatch = FALSE;
|
|
|
|
delete pclWatchData;
|
|
}
|
|
}
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::m_fn_vUpdateValue(CTL_Editor_Data *pclData)
|
|
{
|
|
//Updates only the control currently used
|
|
//When change of mode : update for all datas
|
|
if ( m_bTreeMode )
|
|
{
|
|
//Updates value in the Tree ctrl
|
|
CTreeCtrl *pclTreeCtrl = m_fn_pclGetTreeCtrl();
|
|
|
|
BOOL bActorFound = FALSE;
|
|
BOOL bSubItemFound = FALSE;
|
|
HTREEITEM hTreeItem = pclTreeCtrl->GetNextItem(NULL, TVGN_ROOT);
|
|
HTREEITEM hTreeSubItem;
|
|
EdActors_WatchData *pclWatchData;
|
|
|
|
while ( (hTreeItem != NULL) && (!bActorFound) && (!bSubItemFound))
|
|
{
|
|
bActorFound = ( pclTreeCtrl->GetItemText(hTreeItem) == OAC_fn_pclGetParentActorOfData(pclData)->m_fn_csGetActorName() );
|
|
|
|
if ( bActorFound )
|
|
{
|
|
//Looks in sub items if they are selected
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
while ( (hTreeSubItem != NULL) && (!bSubItemFound) )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)pclTreeCtrl->GetItemData(hTreeSubItem);
|
|
bSubItemFound = ( pclWatchData->m_pclData == pclData );
|
|
|
|
if ( !bSubItemFound )
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeSubItem, TVGN_NEXT);
|
|
}
|
|
}
|
|
|
|
if ( !bActorFound )
|
|
hTreeItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_NEXT);
|
|
}
|
|
|
|
if ( bSubItemFound )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclTreeCtrl->GetItemData(hTreeSubItem));
|
|
CString csValueString = pclWatchData->m_fn_csGetFieldName() + " = " + pclWatchData->m_fn_csGetDataValue();
|
|
pclTreeCtrl->SetItemText(hTreeSubItem, LPCTSTR(csValueString));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
BOOL bFound = FALSE;
|
|
EdActors_WatchData *pclWatchData;
|
|
long c_lI;
|
|
for (c_lI = 0; (c_lI < pclListCtrl->GetItemCount()) && !bFound; c_lI++)
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclListCtrl->GetItemData(c_lI));
|
|
bFound = ( pclWatchData->m_pclData == pclData );
|
|
}
|
|
|
|
if (bFound)
|
|
pclListCtrl->SetItemText(--c_lI, 2, pclWatchData->m_fn_csGetDataValue());
|
|
}
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::m_fn_vUpdateAllDatas()
|
|
{
|
|
if ( m_bTreeMode )
|
|
{
|
|
//Adds it in the Tree ctrl
|
|
CTreeCtrl *pclTreeCtrl = m_fn_pclGetTreeCtrl();
|
|
|
|
HTREEITEM hTreeItem = pclTreeCtrl->GetNextItem(NULL, TVGN_ROOT);
|
|
HTREEITEM hTreeSubItem;
|
|
EdActors_WatchData *pclWatchData;
|
|
CString csValueString;
|
|
|
|
while ( hTreeItem != NULL )
|
|
{
|
|
//Updates all sub items
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
while ( hTreeSubItem != NULL )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)pclTreeCtrl->GetItemData(hTreeSubItem);
|
|
|
|
if ( pclWatchData->m_pclData->m_bDataHasChanged )
|
|
{
|
|
csValueString = pclWatchData->m_fn_csGetFieldName()
|
|
+ " = "
|
|
+ pclWatchData->m_fn_csGetDataValue();
|
|
pclTreeCtrl->SetItemText(hTreeSubItem, LPCTSTR(csValueString));
|
|
}
|
|
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeSubItem, TVGN_NEXT);
|
|
}
|
|
|
|
hTreeItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_NEXT);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
|
|
long c_lI;
|
|
EdActors_WatchData *pclWatchData;
|
|
for (c_lI = 0; c_lI < pclListCtrl->GetItemCount(); c_lI++)
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclListCtrl->GetItemData(c_lI));
|
|
|
|
if ( pclWatchData->m_pclData->m_bDataHasChanged )
|
|
pclListCtrl->SetItemText(c_lI, 2, pclWatchData->m_fn_csGetDataValue());
|
|
}
|
|
}
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::m_fn_vLookForModifiedDatas()
|
|
{
|
|
// EdActors_EditorActor *pclActor = g_pclInterface->m_clDocument.m_pclSelectedActor;
|
|
|
|
POSITION pos = m_clWatchDataList.GetHeadPosition();
|
|
while ( pos != NULL )
|
|
{
|
|
EdActors_WatchData *pclCurrentWData = m_clWatchDataList.GetNext(pos);
|
|
// if ( pclActor != NULL )
|
|
// {
|
|
// if ( pclActor->m_fn_cDoesActorOwnData(pclCurrentWData->m_pclData) != -1 )
|
|
// pclCurrentWData->m_pclData->m_fn_vLookIfDataHasBeenModified();
|
|
// }
|
|
// else
|
|
pclCurrentWData->m_pclData->m_fn_vLookIfDataHasBeenModified();
|
|
}
|
|
}
|
|
|
|
//**************************************************************************
|
|
//BOOL EdActors_WatchDialog::m_pub_fn_bIsActive()
|
|
//{
|
|
// return m_bIsActive;
|
|
//}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
CDialog::OnSize(nType, cx, cy);
|
|
|
|
CRect crClientRect;
|
|
GetClientRect(crClientRect);
|
|
crClientRect.OffsetRect(C_SPACING, C_SPACING);
|
|
crClientRect.right = crClientRect.left + cx - 2*C_SPACING;
|
|
crClientRect.bottom = crClientRect.top + cy - 2*C_SPACING;
|
|
|
|
if ( GetDlgItem(IDC_TREE_ACTORS) != NULL )
|
|
GetDlgItem(IDC_TREE_ACTORS)->MoveWindow(crClientRect);
|
|
|
|
if ( GetDlgItem(IDC_LIST_VALUES) != NULL )
|
|
GetDlgItem(IDC_LIST_VALUES)->MoveWindow(crClientRect);
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
|
|
{
|
|
if ( nHitTest == HTCAPTION )
|
|
{
|
|
if ( m_bTreeMode )
|
|
{
|
|
CTreeCtrl *pclTreeCtrl = m_fn_pclGetTreeCtrl();
|
|
UINT uiCount = pclTreeCtrl->GetCount();
|
|
CRect crRect;
|
|
pclTreeCtrl->GetItemRect( pclTreeCtrl->GetNextItem(NULL, TVGN_ROOT),
|
|
&crRect,
|
|
FALSE );
|
|
|
|
//Sets new control Width
|
|
CRect crControlRect;
|
|
pclTreeCtrl->GetClientRect(crControlRect);
|
|
crControlRect.bottom = crControlRect.top + (crRect.Height() + 1)* uiCount;
|
|
pclTreeCtrl->MoveWindow(crControlRect);
|
|
|
|
//Sets new Window's Width
|
|
CRect crWindowRect;
|
|
GetWindowRect(crWindowRect);
|
|
CRect crClientRect;
|
|
GetClientRect(crClientRect);
|
|
crWindowRect.InflateRect( 0,
|
|
0,
|
|
0/*crControlRect.right - crClientRect.right + C_SPACING*/,
|
|
crControlRect.bottom - crClientRect.bottom + C_SPACING);
|
|
MoveWindow(crWindowRect);
|
|
}
|
|
else
|
|
{
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
|
|
if ( pclListCtrl->GetItemCount() > 0 )
|
|
{
|
|
short wMaxWidth1 = 0;
|
|
short wMaxWidth2 = 0;
|
|
short wMaxWidth3 = 0;
|
|
short wTotalHeight = 0;
|
|
|
|
//Searches max Widthes
|
|
CString csCurrentString;
|
|
CClientDC dc(this);
|
|
long c_lI;
|
|
for (c_lI = 0; c_lI < pclListCtrl->GetItemCount(); c_lI++)
|
|
{
|
|
csCurrentString = pclListCtrl->GetItemText(c_lI, 0);
|
|
wMaxWidth1 = max(wMaxWidth1, dc.GetTextExtent(csCurrentString).cx + 2);
|
|
// wMaxWidth1 = max(wMaxWidth1, pclListCtrl->GetStringWidth(LPCTSTR(csCurrentString)));
|
|
|
|
csCurrentString = pclListCtrl->GetItemText(c_lI, 1);
|
|
wMaxWidth2 = max(wMaxWidth2, dc.GetTextExtent(csCurrentString).cx + 2);
|
|
// wMaxWidth2 = max(wMaxWidth2, pclListCtrl->GetStringWidth(LPCTSTR(csCurrentString)));
|
|
|
|
csCurrentString = pclListCtrl->GetItemText(c_lI, 2);
|
|
wMaxWidth3 = max(wMaxWidth3, dc.GetTextExtent(csCurrentString).cx + 2);
|
|
// wMaxWidth3 = max(wMaxWidth3, pclListCtrl->GetStringWidth(LPCTSTR(csCurrentString)));
|
|
|
|
wTotalHeight += dc.GetTextExtent(csCurrentString).cy + C_WATCH_Y_ADD_MARGIN;
|
|
}
|
|
|
|
//Sets new Columns Width
|
|
wMaxWidth1 += C_WATCH_ADD_MARGIN;
|
|
wMaxWidth2 += C_WATCH_ADD_MARGIN;
|
|
wMaxWidth3 += C_WATCH_ADD_MARGIN;
|
|
pclListCtrl->SetColumnWidth(0, wMaxWidth1);
|
|
pclListCtrl->SetColumnWidth(1, wMaxWidth2);
|
|
pclListCtrl->SetColumnWidth(2, wMaxWidth3);
|
|
|
|
//Sets new control Width
|
|
CRect crControlRect(C_SPACING,
|
|
C_SPACING,
|
|
C_SPACING + wMaxWidth1 + wMaxWidth2 + wMaxWidth3 + 6,
|
|
C_SPACING + wTotalHeight);
|
|
pclListCtrl->MoveWindow(crControlRect);
|
|
|
|
//Sets new Window's Width
|
|
CRect crWindowRect;
|
|
GetWindowRect(crWindowRect);
|
|
CRect crClientRect;
|
|
GetClientRect(crClientRect);
|
|
crWindowRect.InflateRect( 0,
|
|
0,
|
|
crControlRect.right - crClientRect.right + C_SPACING,
|
|
crControlRect.bottom - crClientRect.bottom + C_SPACING);
|
|
MoveWindow(crWindowRect);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnNcRButtonDown( UINT nHitTest, CPoint point )
|
|
{
|
|
if ( nHitTest == HTCAPTION )
|
|
{
|
|
//Loads menu
|
|
CMenu clMenu;
|
|
clMenu.LoadMenu(IDR_MENU_CONTEXT);
|
|
|
|
//gets submenu
|
|
CMenu *pclSubMenu = clMenu.GetSubMenu(1);
|
|
|
|
//Checks the right entry
|
|
if ( m_bTreeMode )
|
|
pclSubMenu->CheckMenuItem(1, MF_BYPOSITION | MF_CHECKED);
|
|
else
|
|
pclSubMenu->CheckMenuItem(0, MF_BYPOSITION | MF_CHECKED);
|
|
|
|
CPoint crPoint;
|
|
GetCursorPos(&crPoint);
|
|
|
|
//////////////
|
|
//////////////
|
|
//Registers for TUT Module
|
|
TUT_M_vGetTutDll();
|
|
|
|
TUT_M_vRegisterMenu(m_hWnd, pclSubMenu->m_hMenu, crPoint.x, crPoint.y);
|
|
|
|
//End of Registers for TUT Module
|
|
//////////////
|
|
|
|
pclSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_LEFTBUTTON, crPoint.x, crPoint.y, this);
|
|
|
|
pclSubMenu->DestroyMenu();
|
|
clMenu.DestroyMenu();
|
|
}
|
|
}
|
|
|
|
//**************************************************************************
|
|
//To avoid "Enter" & "Escape" responses
|
|
void EdActors_WatchDialog::OnOK()
|
|
{
|
|
}
|
|
|
|
//**************************************************************************
|
|
//To avoid "Enter" & "Escape" responses
|
|
void EdActors_WatchDialog::OnCancel()
|
|
{
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::m_fn_vRefreshWatch()
|
|
{
|
|
//Simulates modification for all datas
|
|
POSITION pos = m_clWatchDataList.GetHeadPosition();
|
|
while ( pos != NULL )
|
|
m_clWatchDataList.GetNext(pos)->m_pclData->m_bDataHasChanged = TRUE;
|
|
|
|
m_fn_vUpdateAllDatas();
|
|
|
|
if ( m_bTreeMode )
|
|
{
|
|
m_fn_pclGetListCtrl()->ShowWindow(SW_HIDE);
|
|
m_fn_pclGetTreeCtrl()->ShowWindow(SW_SHOW);
|
|
}
|
|
else
|
|
{
|
|
m_fn_pclGetListCtrl()->ShowWindow(SW_SHOW);
|
|
m_fn_pclGetTreeCtrl()->ShowWindow(SW_HIDE);
|
|
}
|
|
}
|
|
|
|
//**************************************************************************
|
|
BOOL EdActors_WatchDialog::OnHelpInfo(HELPINFO* pHelpInfo)
|
|
{
|
|
DWORD lHelpId = IDH_WATCH;
|
|
UINT uiCommand = HELP_CONTEXT;
|
|
//If necessary, searches for the window under mouse
|
|
if ( !(g_pclInterface->m_clDocument.m_bMustDisplayHelpOnActiveView) )
|
|
{
|
|
CWnd *pclWindow = WindowFromPoint(pHelpInfo->MousePos);
|
|
|
|
if ( pclWindow == (CWnd *)g_pclInterface->m_clDocument.m_pclActorsView )
|
|
lHelpId = IDH_ACTORS_VIEW;
|
|
else if ( pclWindow == (CWnd *)g_pclInterface->m_clDocument.m_pclMiniStrucView )
|
|
lHelpId = IDH_MS_VIEW;
|
|
else if ( pclWindow == (CWnd *)g_pclInterface->m_pclWatchWindow )
|
|
lHelpId = IDH_WATCH;
|
|
else
|
|
{
|
|
lHelpId = 0;
|
|
uiCommand = HELP_FINDER;
|
|
}
|
|
}
|
|
|
|
::WinHelp( m_hWnd,
|
|
LPCTSTR(g_pclInterface->m_clDocument.m_csHelpFileNameAndPath),
|
|
uiCommand,
|
|
lHelpId);
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
///////////////////////////
|
|
// ListCtrl functions //
|
|
///////////////////////////
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnKeydownListValues(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
LV_KEYDOWN* pLVKeyDow = (LV_KEYDOWN*)pNMHDR;
|
|
|
|
if ( pLVKeyDow->wVKey == 46 ) //"Suppr" was pressed
|
|
{
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
EdActors_WatchData *pclWatchData;
|
|
long c_lI;
|
|
for (c_lI = 0; c_lI < pclListCtrl->GetItemCount(); c_lI ++)
|
|
{
|
|
if ( pclListCtrl->GetItemState(c_lI, LVIS_SELECTED) & LVIS_SELECTED )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclListCtrl->GetItemData(c_lI));
|
|
|
|
if ( g_pclInterface->m_clDocument.m_bMustConfirmWatchSuppression )
|
|
{
|
|
CString csMessage = "Do you really want to remove field '" + pclWatchData->m_fn_csGetFieldName()
|
|
+ "'\nof Actor '" + pclWatchData->m_fn_csGetActorName()
|
|
+ "'\nfrom the Watch Window ?";
|
|
EdActors_QuestionDialog dial(&g_oBaseFrame, csMessage);
|
|
if ( dial.DoModal() == IDYES )
|
|
{
|
|
m_fn_vRemoveValue(pclWatchData->m_pclData);
|
|
|
|
//Updates display in the editor
|
|
g_pclInterface->m_clDocument.m_pclMiniStrucView->InvalidateRect(NULL);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_fn_vRemoveValue(pclWatchData->m_pclData);
|
|
|
|
//Updates display in the editor
|
|
g_pclInterface->m_clDocument.m_pclMiniStrucView->InvalidateRect(NULL);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnDblclkListValues(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
EdActors_WatchData *pclWatchData;
|
|
long c_lI;
|
|
for (c_lI = 0; c_lI < pclListCtrl->GetItemCount(); c_lI ++)
|
|
{
|
|
if ( pclListCtrl->GetItemState(c_lI, LVIS_SELECTED) & LVIS_SELECTED )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclListCtrl->GetItemData(c_lI));
|
|
|
|
g_pclInterface->m_clDocument.m_fn_vShowData(OAC_fn_pclGetParentActorOfData(pclWatchData->m_pclData),
|
|
pclWatchData->m_pclData);
|
|
}
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnColumnclickListValues(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
|
|
char iSubItem = pNMListView->iSubItem;
|
|
|
|
CListCtrl *pclListCtrl = m_fn_pclGetListCtrl();
|
|
pclListCtrl->SortItems(&CompareFunc, iSubItem);
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
//**************************************************************************
|
|
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
|
{
|
|
int iReturnValue = 0;
|
|
|
|
EdActors_WatchData *pclData1 = (EdActors_WatchData *)lParam1;
|
|
EdActors_WatchData *pclData2 = (EdActors_WatchData *)lParam2;
|
|
|
|
switch ( lParamSort )
|
|
{
|
|
case 0:
|
|
if (pclData1->m_fn_csGetActorName() < pclData2->m_fn_csGetActorName())
|
|
iReturnValue = -1;
|
|
else if (pclData1->m_fn_csGetActorName() > pclData2->m_fn_csGetActorName())
|
|
iReturnValue = 1;
|
|
else
|
|
iReturnValue = 0;
|
|
break;
|
|
|
|
case 1:
|
|
if (pclData1->m_fn_csGetFieldName() < pclData2->m_fn_csGetFieldName())
|
|
iReturnValue = -1;
|
|
else if (pclData1->m_fn_csGetFieldName() > pclData2->m_fn_csGetFieldName())
|
|
iReturnValue = 1;
|
|
else
|
|
iReturnValue = 0;
|
|
break;
|
|
|
|
case 2:
|
|
if (pclData1->m_fn_csGetDataValue() < pclData2->m_fn_csGetDataValue())
|
|
iReturnValue = -1;
|
|
else if (pclData1->m_fn_csGetDataValue() > pclData2->m_fn_csGetDataValue())
|
|
iReturnValue = 1;
|
|
else
|
|
iReturnValue = 0;
|
|
break;
|
|
}
|
|
|
|
return iReturnValue;
|
|
}
|
|
|
|
//**************************************************************************
|
|
CListCtrl *EdActors_WatchDialog::m_fn_pclGetListCtrl()
|
|
{
|
|
return ((CListCtrl *)GetDlgItem(IDC_LIST_VALUES));
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnWatchList()
|
|
{
|
|
m_bTreeMode = FALSE;
|
|
m_fn_vRefreshWatch();
|
|
}
|
|
|
|
///////////////////////////
|
|
// TreeView functions //
|
|
///////////////////////////
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnWatchTree()
|
|
{
|
|
m_bTreeMode = TRUE;
|
|
m_fn_vRefreshWatch();
|
|
}
|
|
|
|
//**************************************************************************
|
|
CTreeCtrl *EdActors_WatchDialog::m_fn_pclGetTreeCtrl()
|
|
{
|
|
return ((CTreeCtrl *)GetDlgItem(IDC_TREE_ACTORS));
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnKeydownTreeActors(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*)pNMHDR;
|
|
|
|
if ( pTVKeyDown->wVKey == 46 ) //"Suppr" was pressed
|
|
{
|
|
CTreeCtrl *pclTreeCtrl = m_fn_pclGetTreeCtrl();
|
|
|
|
BOOL bActorFound = FALSE;
|
|
BOOL bSubItemFound = FALSE;
|
|
HTREEITEM hTreeItem = pclTreeCtrl->GetNextItem(NULL, TVGN_ROOT);
|
|
HTREEITEM hTreeSubItem;
|
|
|
|
while ( (hTreeItem != NULL) && (!bActorFound) && (!bSubItemFound) )
|
|
{
|
|
bActorFound = ( (pclTreeCtrl->GetItemState(hTreeItem, TVIS_SELECTED) & TVIS_SELECTED) != 0 );
|
|
|
|
if ( !bActorFound )
|
|
{
|
|
//Looks in sub items if they are selected
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
while ( (hTreeSubItem != NULL) && (!bSubItemFound) )
|
|
{
|
|
bSubItemFound = ( (pclTreeCtrl->GetItemState(hTreeSubItem, TVIS_SELECTED) & TVIS_SELECTED) != 0 );
|
|
|
|
if ( !bSubItemFound )
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeSubItem, TVGN_NEXT);
|
|
}
|
|
|
|
if ( !bSubItemFound )
|
|
hTreeItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_NEXT);
|
|
}
|
|
}
|
|
|
|
//If an actor's name was selected, deletes all fields from this actor
|
|
// from the Watch Window
|
|
EdActors_WatchData *pclWatchData;
|
|
|
|
if ( bActorFound )
|
|
{
|
|
BOOL bMustContinue = TRUE;
|
|
|
|
if ( g_pclInterface->m_clDocument.m_bMustConfirmWatchSuppression )
|
|
{
|
|
CString csMessage = "Do you really want to\nremove all fields of Actor '"
|
|
+ pclTreeCtrl->GetItemText(hTreeItem)
|
|
+ "'\nfrom the Watch Window ?";
|
|
EdActors_QuestionDialog dial(&g_oBaseFrame, csMessage);
|
|
bMustContinue = dial.DoModal() == IDYES;
|
|
}
|
|
|
|
if ( bMustContinue )
|
|
{
|
|
//Deletes sub items' data
|
|
HTREEITEM hTreeNextSubItem;
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
while ( hTreeSubItem != NULL )
|
|
{
|
|
hTreeNextSubItem = pclTreeCtrl->GetNextItem(hTreeSubItem, TVGN_NEXT);;
|
|
|
|
pclWatchData = (EdActors_WatchData *)(pclTreeCtrl->GetItemData(hTreeSubItem));
|
|
m_fn_vRemoveValue(pclWatchData->m_pclData);
|
|
|
|
hTreeSubItem = hTreeNextSubItem;
|
|
}
|
|
|
|
//Updates display in the editor
|
|
g_pclInterface->m_clDocument.m_pclMiniStrucView->InvalidateRect(NULL);
|
|
}
|
|
}
|
|
//else deletes the only selected field
|
|
else
|
|
{
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
bSubItemFound = FALSE;
|
|
while ( (hTreeSubItem != NULL) && (!bSubItemFound) )
|
|
{
|
|
bSubItemFound = ( (pclTreeCtrl->GetItemState(hTreeSubItem, TVIS_SELECTED) & TVIS_SELECTED) != 0 );
|
|
|
|
if ( !bSubItemFound )
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeSubItem, TVGN_NEXT);
|
|
}
|
|
|
|
if ( bSubItemFound )
|
|
{
|
|
BOOL bMustContinue = TRUE;
|
|
|
|
if ( g_pclInterface->m_clDocument.m_bMustConfirmWatchSuppression )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclTreeCtrl->GetItemData(hTreeSubItem));
|
|
CString csMessage = "Do you really want to remove field '" + pclWatchData->m_fn_csGetFieldName()
|
|
+ "'\nof Actor '" + pclWatchData->m_fn_csGetActorName()
|
|
+ "'\nfrom the Watch Window ?";
|
|
EdActors_QuestionDialog dial(&g_oBaseFrame, csMessage);
|
|
|
|
bMustContinue = ( dial.DoModal() == IDYES );
|
|
}
|
|
|
|
if ( bMustContinue )
|
|
{
|
|
pclWatchData = (EdActors_WatchData *)(pclTreeCtrl->GetItemData(hTreeSubItem));
|
|
|
|
//Deletes from tree
|
|
m_fn_vRemoveValue(pclWatchData->m_pclData);
|
|
|
|
//Looks if there is at least one more SubItem
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
if ( hTreeSubItem == NULL )
|
|
pclTreeCtrl->DeleteItem(hTreeItem);
|
|
|
|
//Updates display in the editor
|
|
g_pclInterface->m_clDocument.m_pclMiniStrucView->InvalidateRect(NULL);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Updates display in the editor
|
|
g_pclInterface->m_clDocument.m_pclMiniStrucView->InvalidateRect(NULL);
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnDblclkTreeActors(NMHDR* pNMHDR, LRESULT* pResult)
|
|
{
|
|
//Looks for the selected field
|
|
CTreeCtrl *pclTreeCtrl = m_fn_pclGetTreeCtrl();
|
|
|
|
BOOL bActorFound = FALSE;
|
|
BOOL bSubItemFound = FALSE;
|
|
HTREEITEM hTreeItem = pclTreeCtrl->GetNextItem(NULL, TVGN_ROOT);
|
|
HTREEITEM hTreeSubItem;
|
|
|
|
while ( (hTreeItem != NULL) && (!bActorFound) && (!bSubItemFound))
|
|
{
|
|
bActorFound = ( (pclTreeCtrl->GetItemState(hTreeItem, TVIS_SELECTED) & TVIS_SELECTED)!= 0 );
|
|
|
|
if ( !bActorFound )
|
|
{
|
|
//Looks in sub items if they are selected
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
while ( (hTreeSubItem != NULL) && (!bSubItemFound) )
|
|
{
|
|
bSubItemFound = ( (pclTreeCtrl->GetItemState(hTreeSubItem, TVIS_SELECTED) & TVIS_SELECTED)!= 0 );
|
|
|
|
if ( !bSubItemFound )
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeSubItem, TVGN_NEXT);
|
|
}
|
|
|
|
if ( !bSubItemFound )
|
|
hTreeItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_NEXT);
|
|
}
|
|
}
|
|
|
|
//If the selected line was one of a field (and not an Actor)
|
|
if ( !bActorFound )
|
|
{
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeItem, TVGN_CHILD);
|
|
bSubItemFound = FALSE;
|
|
while ( (hTreeSubItem != NULL) && (!bSubItemFound) )
|
|
{
|
|
bSubItemFound = ( (pclTreeCtrl->GetItemState(hTreeSubItem, TVIS_SELECTED) & TVIS_SELECTED) != 0 );
|
|
|
|
if ( !bSubItemFound )
|
|
hTreeSubItem = pclTreeCtrl->GetNextItem(hTreeSubItem, TVGN_NEXT);
|
|
}
|
|
|
|
if ( bSubItemFound )
|
|
{
|
|
EdActors_WatchData *pclWatchData = (EdActors_WatchData *)(pclTreeCtrl->GetItemData(hTreeSubItem));
|
|
|
|
g_pclInterface->m_clDocument.m_fn_vShowData(OAC_fn_pclGetParentActorOfData(pclWatchData->m_pclData),
|
|
pclWatchData->m_pclData);
|
|
}
|
|
}
|
|
|
|
*pResult = 0;
|
|
}
|
|
|
|
//**************************************************************************
|
|
/*BOOL EdActors_WatchDialog::OnNcCreate(LPCREATESTRUCT lpCreateStruct)
|
|
{
|
|
HWND hWnd = lpCreateStruct->hwndParent;
|
|
CWnd *pclWnd;
|
|
pclWnd = pclWnd->FromHandle(hWnd);
|
|
|
|
return TRUE;
|
|
} */
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnNcLButtonDown(UINT uint, CPoint point)
|
|
{
|
|
CPoint cpLocalPoint = point;
|
|
ScreenToClient(&cpLocalPoint);
|
|
|
|
if ( m_crHideButtonRect.PtInRect(cpLocalPoint) )
|
|
{
|
|
g_pclInterface->m_clDocument.m_pclActorsView->OnButtonWatch();
|
|
((CButton *)g_pclInterface->m_clDocument.m_pclActorsView->GetDlgItem(IDC_CHECK_WATCH))->SetCheck(FALSE);
|
|
}
|
|
else
|
|
CDialog::OnNcLButtonUp(uint, point);
|
|
}
|
|
|
|
//**************************************************************************
|
|
BOOL EdActors_WatchDialog::OnNcActivate(BOOL bActive)
|
|
{
|
|
m_bIsActive = bActive;
|
|
m_fn_vDrawCaptionBar();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::OnPaint()
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
|
|
m_fn_vDrawCaptionBar();
|
|
|
|
// Do not call CDialog::OnPaint() for painting messages
|
|
}
|
|
|
|
//**************************************************************************
|
|
void EdActors_WatchDialog::m_fn_vDrawCaptionBar()
|
|
{
|
|
CDC *pdc = GetWindowDC();
|
|
CRect crWindowRect;
|
|
GetWindowRect(crWindowRect);
|
|
ScreenToClient(crWindowRect);
|
|
|
|
CRect crCaptionBarRect;
|
|
long lx = GetSystemMetrics( SM_CXFRAME );
|
|
long ly = GetSystemMetrics( SM_CYFRAME );
|
|
|
|
crCaptionBarRect.left = lx;
|
|
crCaptionBarRect.top = ly;
|
|
crCaptionBarRect.right = crWindowRect.right - 20;
|
|
crCaptionBarRect.bottom = ly + GetSystemMetrics( SM_CYCAPTION );
|
|
|
|
COLORREF colref;
|
|
CRect crLocalRect(crCaptionBarRect);
|
|
crLocalRect.right = crLocalRect.left + 1;
|
|
long c_lI;
|
|
BYTE cCol;
|
|
for (c_lI = 0; c_lI < crCaptionBarRect.right; c_lI ++)
|
|
{
|
|
if ( m_bIsActive )
|
|
colref = RGB(0,0,(c_lI * 256)/crCaptionBarRect.right);
|
|
else
|
|
{
|
|
cCol = (unsigned char)((c_lI * 223)/crCaptionBarRect.right);
|
|
colref = RGB(cCol, cCol, cCol);
|
|
}
|
|
|
|
pdc->FillSolidRect(crLocalRect, colref);
|
|
|
|
crLocalRect.left = crCaptionBarRect.left + c_lI;
|
|
crLocalRect.right = crLocalRect.left + 1;
|
|
}
|
|
|
|
crLocalRect.top -= 1;
|
|
crLocalRect.left = crCaptionBarRect.left + c_lI - 1;
|
|
crLocalRect.right = crWindowRect.right;
|
|
COLORREF colrefBG = pdc->GetPixel(2,2);
|
|
pdc->FillSolidRect(crLocalRect, colrefBG);
|
|
|
|
pdc->SelectObject(m_clFont);
|
|
//pdc->SelectObject(GetFont());
|
|
|
|
pdc->SetBkMode(TRANSPARENT);
|
|
if ( m_bIsActive )
|
|
pdc->SetTextColor(RGB(255, 64, 128));
|
|
else
|
|
pdc->SetTextColor(RGB(223, 223, 223));
|
|
|
|
crCaptionBarRect.top += C_WATCH_TITLE_MARGIN;
|
|
pdc->DrawText("Actors Editor - Watch Window", -1, crCaptionBarRect, DT_CENTER);
|
|
crCaptionBarRect.top -= C_WATCH_TITLE_MARGIN;
|
|
|
|
//Simulates Hide Button
|
|
CDC memDC;
|
|
memDC.CreateCompatibleDC(pdc);
|
|
|
|
CBitmap cBitmap;
|
|
cBitmap.LoadBitmap(IDB_BITMAP_HIDE_BUTTON);
|
|
memDC.SelectObject(cBitmap);
|
|
|
|
long lXDest = crCaptionBarRect.right + 5;
|
|
long lYDest = ly + 1;
|
|
|
|
pdc->BitBlt(lXDest,
|
|
lYDest,
|
|
16,
|
|
16,
|
|
&memDC,
|
|
0,
|
|
0,
|
|
SRCCOPY);
|
|
|
|
GetWindowRect(crWindowRect);
|
|
CRect crClientRect;
|
|
GetClientRect(crClientRect);
|
|
|
|
m_crHideButtonRect.top = lYDest - (crWindowRect.Height() - crClientRect.Height()) + 5;
|
|
m_crHideButtonRect.left = lXDest - 4;
|
|
m_crHideButtonRect.right = m_crHideButtonRect.left + 16;
|
|
m_crHideButtonRect.bottom = m_crHideButtonRect.top + 16;
|
|
}
|