mirror of
https://github.com/TTimo/doom3.gpl.git
synced 2026-03-20 08:59:42 +01:00
hello world
This commit is contained in:
1022
neo/tools/comafx/CDIB.cpp
Normal file
1022
neo/tools/comafx/CDIB.cpp
Normal file
File diff suppressed because it is too large
Load Diff
121
neo/tools/comafx/CDIB.h
Normal file
121
neo/tools/comafx/CDIB.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CDIB__
|
||||
#define __CDIB__
|
||||
|
||||
// Original ColorPicker/DIB source by Rajiv Ramachandran <rrajivram@hotmail.com>
|
||||
// included with permission from the author
|
||||
|
||||
class CDIB {
|
||||
public:
|
||||
enum BitmapType {
|
||||
BMP,
|
||||
GIF,
|
||||
TIFF
|
||||
};
|
||||
CDIB( HANDLE hDib = NULL,int nBits = 8 );
|
||||
virtual ~CDIB();
|
||||
|
||||
CDIB & operator=( CDIB& dib );
|
||||
BOOL IsValid() { return ( m_pVoid && Width() && Height() ); }
|
||||
void UseGamma( float fg, BOOL bUse = TRUE );
|
||||
BOOL CreateFromHandle( HANDLE hDib, int nBits );
|
||||
BOOL Create( int width, int height, int bits = 24 );
|
||||
BOOL Create( BITMAPINFOHEADER& bmInfo );
|
||||
BOOL CopyDIB( CDIB& dib );
|
||||
BOOL OpenDIB( CString &fileName );
|
||||
BOOL SaveDIB( CString &fileName, BitmapType type );
|
||||
void ReplaceColor(unsigned char oldColor,unsigned char newColor);
|
||||
HANDLE GetDIBits(int nStartX=-1,int nStartY=-1,int nCx=-1,int nCy=-1);
|
||||
CBitmap * GetBitmap(CDC& dc);
|
||||
CBitmap * GetTempBitmap(CDC& dc);
|
||||
DWORD GetDIBSize();
|
||||
int GetPaletteSize(BITMAPINFOHEADER& bmInfo);
|
||||
int GetPaletteSize();
|
||||
int CountColors();
|
||||
int EnumColors(BYTE *colors);
|
||||
void InitDIB(COLORREF color);
|
||||
void CopyLine(int source,int dest);
|
||||
void DestroyDIB();
|
||||
void SetPalette(unsigned char *palette);
|
||||
void SetPalette(RGBQUAD *pRGB);
|
||||
COLORREF PaletteColor(int index);
|
||||
void SetPixel(int x,int y,COLORREF color);
|
||||
void SetPixel8(int x,int y,unsigned char color);
|
||||
COLORREF GetPixel(int x,int y);
|
||||
void GetPixel(UINT x,UINT y,int& pixel);
|
||||
void BitBlt(HDC hDest,int nXDest,int nYDest,int nWidth,int nHeight,int xSrc,int ySrc);
|
||||
void BitBlt(int nXDest,int nYDest,int nWidth,int nHeight,CDIB& dibSrc,int nSrcX,int nSrcY,BYTE *colors=NULL);
|
||||
void StretchBlt(HDC hDest,int nXDest,int nYDest,int nDWidth,int nDHeight,int xSrc,int ySrc,int nSWidth,int nSHeight);
|
||||
void StretchBlt(int nXDest,int nYDest,int nDWidth,int nDHeight,CDIB& dibSrc,int xSrc,int ySrc,int nSWidth,int nSHeight);
|
||||
void ExpandBlt(int nXDest,int nYDest,int xRatio,int yRatio,CDIB& dibSrc,int xSrc,int ySrc,int nSWidth,int nSHeight);
|
||||
void SetFlags(int flag) { m_nFlags = flag; }
|
||||
int Height() { return height ; }
|
||||
int Width() { return width ; }
|
||||
unsigned char *GetLinePtr(int line);
|
||||
inline int GetBitCount() { return m_pInfo->bmiHeader.biBitCount; }
|
||||
BOOL Make8Bit( CDIB &dib );
|
||||
BOOL SwitchFromOne( CDIB &dib );
|
||||
BOOL SwitchFromFour( CDIB &dib );
|
||||
BOOL SwitchFrom24( CDIB &dib );
|
||||
BOOL SwitchPalette( CDIB &dib );
|
||||
int ClosestColor(RGBQUAD *pRgb );
|
||||
LPBITMAPINFO GetBitmapInfo() { return m_pInfo; }
|
||||
static unsigned int Distance( RGBQUAD& rgb1, RGBQUAD& rgb2 );
|
||||
|
||||
protected:
|
||||
HANDLE DIBHandle();
|
||||
BOOL OpenBMP( CString &csFileName );
|
||||
BOOL OpenGIF( CString &csFileName );
|
||||
BOOL OpenTIFF( CString &csFileName );
|
||||
BOOL SaveBMP( CString &csFileName );
|
||||
BOOL SaveGIF( CString &csFileName );
|
||||
BOOL SaveTIFF( CString &csFileName );
|
||||
void CreateGammaCurve();
|
||||
void Expand( int nXDest, int nYDest, int xRatio, int yRatio, CDIB &dibSrc, int xSrc, int ySrc, int nSWidth, int nSHeight );
|
||||
|
||||
unsigned char * m_pBits;
|
||||
PBITMAPINFO m_pInfo;
|
||||
RGBQUAD * m_pRGB;
|
||||
void * m_pVoid;
|
||||
BYTE ** m_pLinePtr;
|
||||
int height;
|
||||
int bytes;
|
||||
int width;
|
||||
int m_nBits;
|
||||
int m_nFlags;
|
||||
BOOL m_bUseGamma;
|
||||
float m_fGamma;
|
||||
float m_fOldGamma;
|
||||
unsigned char Gamma[256];
|
||||
RGBQUAD CacheQuad[256];
|
||||
char CachePtr[256];
|
||||
};
|
||||
|
||||
#endif /* !__CDIB__ */
|
||||
305
neo/tools/comafx/CPathTreeCtrl.cpp
Normal file
305
neo/tools/comafx/CPathTreeCtrl.cpp
Normal file
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../../idlib/precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "CPathTreeCtrl.h"
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::CPathTreeCtrl
|
||||
================
|
||||
*/
|
||||
CPathTreeCtrl::CPathTreeCtrl() {
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::~CPathTreeCtrl
|
||||
================
|
||||
*/
|
||||
CPathTreeCtrl::~CPathTreeCtrl() {
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::PreSubclassWindow
|
||||
================
|
||||
*/
|
||||
void CPathTreeCtrl::PreSubclassWindow() {
|
||||
CTreeCtrl::PreSubclassWindow();
|
||||
EnableToolTips( TRUE );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::FindItem
|
||||
|
||||
Find the given path in the tree.
|
||||
================
|
||||
*/
|
||||
HTREEITEM CPathTreeCtrl::FindItem( const idStr &pathName ) {
|
||||
int lastSlash;
|
||||
idStr path, tmpPath, itemName;
|
||||
HTREEITEM item, parentItem;
|
||||
|
||||
parentItem = NULL;
|
||||
item = GetRootItem();
|
||||
|
||||
lastSlash = pathName.Last( '/' );
|
||||
|
||||
while( item && lastSlash > path.Length() ) {
|
||||
itemName = GetItemText( item );
|
||||
tmpPath = path + itemName;
|
||||
if ( pathName.Icmpn( tmpPath, tmpPath.Length() ) == 0 ) {
|
||||
parentItem = item;
|
||||
item = GetChildItem( item );
|
||||
path = tmpPath + "/";
|
||||
} else {
|
||||
item = GetNextSiblingItem( item );
|
||||
}
|
||||
}
|
||||
|
||||
for ( item = GetChildItem( parentItem ); item; item = GetNextSiblingItem( item ) ) {
|
||||
itemName = GetItemText( item );
|
||||
if ( pathName.Icmp( path + itemName ) == 0 ) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::InsertPathIntoTree
|
||||
|
||||
Inserts a new item going from the root down the tree only creating paths where necessary.
|
||||
This is slow and should only be used to insert single items.
|
||||
================
|
||||
*/
|
||||
HTREEITEM CPathTreeCtrl::InsertPathIntoTree( const idStr &pathName, const int id ) {
|
||||
int lastSlash;
|
||||
idStr path, tmpPath, itemName;
|
||||
HTREEITEM item, parentItem;
|
||||
|
||||
parentItem = NULL;
|
||||
item = GetRootItem();
|
||||
|
||||
lastSlash = pathName.Last( '/' );
|
||||
|
||||
while( item && lastSlash > path.Length() ) {
|
||||
itemName = GetItemText( item );
|
||||
tmpPath = path + itemName;
|
||||
if ( pathName.Icmpn( tmpPath, tmpPath.Length() ) == 0 ) {
|
||||
parentItem = item;
|
||||
item = GetChildItem( item );
|
||||
path = tmpPath + "/";
|
||||
} else {
|
||||
item = GetNextSiblingItem( item );
|
||||
}
|
||||
}
|
||||
|
||||
while( lastSlash > path.Length() ) {
|
||||
pathName.Mid( path.Length(), pathName.Length(), tmpPath );
|
||||
tmpPath.Left( tmpPath.Find( '/' ), itemName );
|
||||
parentItem = InsertItem( itemName, parentItem );
|
||||
path += itemName + "/";
|
||||
}
|
||||
|
||||
pathName.Mid( path.Length(), pathName.Length(), itemName );
|
||||
item = InsertItem( itemName, parentItem, TVI_SORT );
|
||||
SetItemData( item, id );
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::AddPathToTree
|
||||
|
||||
Adds a new item to the tree.
|
||||
Assumes new paths after the current stack path do not yet exist.
|
||||
================
|
||||
*/
|
||||
HTREEITEM CPathTreeCtrl::AddPathToTree( const idStr &pathName, const int id, idPathTreeStack &stack ) {
|
||||
int lastSlash;
|
||||
idStr itemName, tmpPath;
|
||||
HTREEITEM item;
|
||||
|
||||
lastSlash = pathName.Last( '/' );
|
||||
|
||||
while( stack.Num() > 1 ) {
|
||||
if ( pathName.Icmpn( stack.TopName(), stack.TopNameLength() ) == 0 ) {
|
||||
break;
|
||||
}
|
||||
stack.Pop();
|
||||
}
|
||||
|
||||
while( lastSlash > stack.TopNameLength() ) {
|
||||
pathName.Mid( stack.TopNameLength(), pathName.Length(), tmpPath );
|
||||
tmpPath.Left( tmpPath.Find( '/' ), itemName );
|
||||
item = InsertItem( itemName, stack.TopItem() );
|
||||
stack.Push( item, itemName );
|
||||
}
|
||||
|
||||
pathName.Mid( stack.TopNameLength(), pathName.Length(), itemName );
|
||||
item = InsertItem( itemName, stack.TopItem() );
|
||||
SetItemData( item, id );
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::SearchTree
|
||||
|
||||
Search the three using the search string.
|
||||
Adds the matched tree items to the result tree.
|
||||
Returns the number of items added to the result tree.
|
||||
================
|
||||
*/
|
||||
int CPathTreeCtrl::SearchTree( treeItemCompare_t compare, void *data, CPathTreeCtrl &result ) {
|
||||
idPathTreeStack stack, searchStack;
|
||||
HTREEITEM item, child;
|
||||
idStr name;
|
||||
int id, numItems;
|
||||
|
||||
numItems = 0;
|
||||
result.DeleteAllItems();
|
||||
stack.PushRoot( NULL );
|
||||
|
||||
item = GetRootItem();
|
||||
searchStack.PushRoot( item );
|
||||
id = 0;
|
||||
|
||||
while( searchStack.Num() > 0 ) {
|
||||
|
||||
for ( child = GetChildItem( item ); child; child = GetChildItem( child ) ) {
|
||||
searchStack.Push( item, GetItemText( item ) );
|
||||
item = child;
|
||||
}
|
||||
|
||||
name = searchStack.TopName();
|
||||
name += GetItemText( item );
|
||||
id = GetItemData( item );
|
||||
|
||||
if ( compare( data, item, name ) ) {
|
||||
result.AddPathToTree( name, id, stack );
|
||||
numItems++;
|
||||
}
|
||||
|
||||
for ( item = GetNextSiblingItem( item ); item == NULL; ) {
|
||||
item = GetNextSiblingItem( searchStack.TopItem() );
|
||||
searchStack.Pop();
|
||||
if ( searchStack.Num() <= 0 ) {
|
||||
return numItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return numItems;
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPathTreeCtrl,CTreeCtrl)
|
||||
//{{AFX_MSG_MAP(CPathTreeCtrl)
|
||||
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
|
||||
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
|
||||
ON_WM_MOUSEMOVE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::OnToolHitTest
|
||||
================
|
||||
*/
|
||||
int CPathTreeCtrl::OnToolHitTest( CPoint point, TOOLINFO * pTI ) const {
|
||||
RECT rect;
|
||||
|
||||
UINT nFlags;
|
||||
HTREEITEM hitem = HitTest( point, &nFlags );
|
||||
if( nFlags & TVHT_ONITEM ) {
|
||||
GetItemRect( hitem, &rect, TRUE );
|
||||
pTI->hwnd = m_hWnd;
|
||||
pTI->uId = (UINT)hitem;
|
||||
pTI->lpszText = LPSTR_TEXTCALLBACK;
|
||||
pTI->rect = rect;
|
||||
return pTI->uId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CPathTreeCtrl::OnToolTipText
|
||||
================
|
||||
*/
|
||||
BOOL CPathTreeCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult ) {
|
||||
// need to handle both ANSI and UNICODE versions of the message
|
||||
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
|
||||
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
|
||||
|
||||
UINT nID = pNMHDR->idFrom;
|
||||
|
||||
*pResult = 0;
|
||||
|
||||
// Do not process the message from built in tooltip
|
||||
if( nID == (UINT)m_hWnd &&
|
||||
(( pNMHDR->code == TTN_NEEDTEXTA && pTTTA->uFlags & TTF_IDISHWND ) ||
|
||||
( pNMHDR->code == TTN_NEEDTEXTW && pTTTW->uFlags & TTF_IDISHWND ) ) ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CString toolTip = "?";
|
||||
|
||||
// Get the mouse position
|
||||
const MSG* pMessage;
|
||||
CPoint pt;
|
||||
pMessage = GetCurrentMessage();
|
||||
ASSERT ( pMessage );
|
||||
pt = pMessage->pt;
|
||||
ScreenToClient( &pt );
|
||||
|
||||
// get the tree item
|
||||
UINT nFlags;
|
||||
HTREEITEM hitem = HitTest( pt, &nFlags );
|
||||
|
||||
if( nFlags & TVHT_ONITEM ) {
|
||||
// relay message to parent
|
||||
pTTTA->hdr.hwndFrom = GetSafeHwnd();
|
||||
pTTTA->hdr.idFrom = (UINT) hitem;
|
||||
if ( GetParent()->SendMessage( WM_NOTIFY, ( TTN_NEEDTEXT << 16 ) | GetDlgCtrlID(), (LPARAM)pTTTA ) == FALSE ) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE; // message was handled
|
||||
}
|
||||
93
neo/tools/comafx/CPathTreeCtrl.h
Normal file
93
neo/tools/comafx/CPathTreeCtrl.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CPATHTREECTR_H__
|
||||
#define __CPATHTREECTR_H__
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Tree Control for path names.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
class idPathTreeStack {
|
||||
public:
|
||||
idPathTreeStack( void ) { size = 0; }
|
||||
|
||||
void PushRoot( HTREEITEM root );
|
||||
void Push( HTREEITEM item, const char *name );
|
||||
void Pop( void ) { size--; }
|
||||
HTREEITEM TopItem( void ) const { return stackItem[size-1]; }
|
||||
const char * TopName( void ) const { return stackName[size-1]; }
|
||||
int TopNameLength( void ) const { return stackName[size-1].Length(); }
|
||||
int Num( void ) const { return size; }
|
||||
|
||||
private:
|
||||
int size;
|
||||
HTREEITEM stackItem[128];
|
||||
idStr stackName[128];
|
||||
};
|
||||
|
||||
ID_INLINE void idPathTreeStack::PushRoot( HTREEITEM root ) {
|
||||
assert( size == 0 );
|
||||
stackItem[size] = root;
|
||||
stackName[size] = "";
|
||||
size++;
|
||||
}
|
||||
|
||||
ID_INLINE void idPathTreeStack::Push( HTREEITEM item, const char *name ) {
|
||||
assert( size < 127 );
|
||||
stackItem[size] = item;
|
||||
stackName[size] = stackName[size-1] + name + "/";
|
||||
size++;
|
||||
}
|
||||
|
||||
typedef bool (*treeItemCompare_t)( void *data, HTREEITEM item, const char *name );
|
||||
|
||||
|
||||
class CPathTreeCtrl : public CTreeCtrl {
|
||||
public:
|
||||
CPathTreeCtrl();
|
||||
~CPathTreeCtrl();
|
||||
|
||||
HTREEITEM FindItem( const idStr &pathName );
|
||||
HTREEITEM InsertPathIntoTree( const idStr &pathName, const int id );
|
||||
HTREEITEM AddPathToTree( const idStr &pathName, const int id, idPathTreeStack &stack );
|
||||
int SearchTree( treeItemCompare_t compare, void *data, CPathTreeCtrl &result );
|
||||
|
||||
protected:
|
||||
virtual void PreSubclassWindow();
|
||||
virtual int OnToolHitTest( CPoint point, TOOLINFO * pTI ) const;
|
||||
afx_msg BOOL OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult );
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#endif /* !__CPATHTREECTR_H__ */
|
||||
1903
neo/tools/comafx/CSyntaxRichEditCtrl.cpp
Normal file
1903
neo/tools/comafx/CSyntaxRichEditCtrl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
236
neo/tools/comafx/CSyntaxRichEditCtrl.h
Normal file
236
neo/tools/comafx/CSyntaxRichEditCtrl.h
Normal file
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CSYNTAXRICHEDITCTR_H__
|
||||
#define __CSYNTAXRICHEDITCTR_H__
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Rich Edit Control with:
|
||||
|
||||
- syntax highlighting
|
||||
- braced section highlighting
|
||||
- braced section auto-indentation
|
||||
- multi-line tabs
|
||||
- keyword auto-completion
|
||||
- object member auto-completion
|
||||
- keyword tool tip
|
||||
- function parameter tool tip
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
// use #import on Vista to generate .tlh header to copy from intermediate compile directory to local directory for subsequent builds
|
||||
// rename: avoids warning C4278: 'FindText': identifier in type library 'riched20.dll' is already a macro; use the 'rename' qualifier
|
||||
// no_auto_exclude: avoids warnings
|
||||
// no_namespace: no longer using this option, which avoids variable redifinition compile errors on Vista
|
||||
//#define GENERATE_TLH
|
||||
#ifdef GENERATE_TLH
|
||||
# import "riched20.dll" raw_interfaces_only, raw_native_types, named_guids, no_auto_exclude, no_implementation, rename( "FindText", "FindShit" )
|
||||
#else
|
||||
# include "riched20.tlh"
|
||||
#endif
|
||||
|
||||
static const char * FONT_NAME = "Courier";
|
||||
static const int FONT_HEIGHT = 10;
|
||||
static const int FONT_WIDTH = 8;
|
||||
static const int TAB_SIZE = 4;
|
||||
|
||||
static const COLORREF SRE_COLOR_BLACK = RGB( 0, 0, 0 );
|
||||
static const COLORREF SRE_COLOR_WHITE = RGB( 255, 255, 255 );
|
||||
static const COLORREF SRE_COLOR_RED = RGB( 255, 0, 0 );
|
||||
static const COLORREF SRE_COLOR_GREEN = RGB( 0, 255, 0 );
|
||||
static const COLORREF SRE_COLOR_BLUE = RGB( 0, 0, 255 );
|
||||
static const COLORREF SRE_COLOR_YELLOW = RGB( 255, 255, 0 );
|
||||
static const COLORREF SRE_COLOR_MAGENTA = RGB( 255, 0, 255 );
|
||||
static const COLORREF SRE_COLOR_CYAN = RGB( 0, 255, 255 );
|
||||
static const COLORREF SRE_COLOR_ORANGE = RGB( 255, 128, 0 );
|
||||
static const COLORREF SRE_COLOR_PURPLE = RGB( 150, 0, 150 );
|
||||
static const COLORREF SRE_COLOR_PINK = RGB( 186, 102, 123 );
|
||||
static const COLORREF SRE_COLOR_GREY = RGB( 85, 85, 85 );
|
||||
static const COLORREF SRE_COLOR_BROWN = RGB( 100, 90, 20 );
|
||||
static const COLORREF SRE_COLOR_LIGHT_GREY = RGB( 170, 170, 170 );
|
||||
static const COLORREF SRE_COLOR_LIGHT_BROWN = RGB( 170, 150, 20 );
|
||||
static const COLORREF SRE_COLOR_DARK_GREEN = RGB( 0, 128, 0 );
|
||||
static const COLORREF SRE_COLOR_DARK_CYAN = RGB( 0, 150, 150 );
|
||||
static const COLORREF SRE_COLOR_DARK_YELLOW = RGB( 220, 200, 20 );
|
||||
|
||||
typedef struct {
|
||||
const char * keyWord;
|
||||
COLORREF color;
|
||||
const char * description;
|
||||
} keyWord_t;
|
||||
|
||||
typedef bool (*objectMemberCallback_t)( const char *objectName, CListBox &listBox );
|
||||
typedef bool (*toolTipCallback_t)( const char *name, CString &string );
|
||||
|
||||
|
||||
class CSyntaxRichEditCtrl : public CRichEditCtrl {
|
||||
public:
|
||||
CSyntaxRichEditCtrl( void );
|
||||
~CSyntaxRichEditCtrl( void );
|
||||
|
||||
void Init( void );
|
||||
|
||||
void SetCaseSensitive( bool caseSensitive );
|
||||
void AllowPathNames( bool allow );
|
||||
void EnableKeyWordAutoCompletion( bool enable );
|
||||
void SetKeyWords( const keyWord_t kws[] );
|
||||
bool LoadKeyWordsFromFile( const char *fileName );
|
||||
void SetObjectMemberCallback( objectMemberCallback_t callback );
|
||||
void SetFunctionParmCallback( toolTipCallback_t callback );
|
||||
void SetToolTipCallback( toolTipCallback_t callback );
|
||||
|
||||
void SetDefaultColor( const COLORREF color );
|
||||
void SetCommentColor( const COLORREF color );
|
||||
void SetStringColor( const COLORREF color, const COLORREF altColor = -1 );
|
||||
void SetLiteralColor( const COLORREF color );
|
||||
|
||||
COLORREF GetForeColor( int charIndex ) const;
|
||||
COLORREF GetBackColor( int charIndex ) const;
|
||||
|
||||
void GetCursorPos( int &line, int &column, int &character ) const;
|
||||
CHARRANGE GetVisibleRange( void ) const;
|
||||
|
||||
void GetText( idStr &text ) const;
|
||||
void GetText( idStr &text, int startCharIndex, int endCharIndex ) const;
|
||||
void SetText( const char *text );
|
||||
|
||||
void GoToLine( int line );
|
||||
bool FindNext( const char *find, bool matchCase, bool matchWholeWords, bool searchForward );
|
||||
int ReplaceAll( const char *find, const char *replace, bool matchCase, bool matchWholeWords );
|
||||
void ReplaceText( int startCharIndex, int endCharIndex, const char *replace );
|
||||
|
||||
protected:
|
||||
virtual int OnToolHitTest( CPoint point, TOOLINFO* pTI ) const;
|
||||
afx_msg BOOL OnToolTipNotify( UINT id, NMHDR *pNMHDR, LRESULT *pResult );
|
||||
afx_msg UINT OnGetDlgCode();
|
||||
afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );
|
||||
afx_msg void OnKeyDown( UINT nKey, UINT nRepCnt, UINT nFlags );
|
||||
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
|
||||
afx_msg BOOL OnMouseWheel( UINT nFlags, short zDelta, CPoint pt );
|
||||
afx_msg void OnMouseMove( UINT nFlags, CPoint point );
|
||||
afx_msg void OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar );
|
||||
afx_msg void OnSize( UINT nType, int cx, int cy );
|
||||
afx_msg void OnProtected( NMHDR *pNMHDR, LRESULT *pResult );
|
||||
afx_msg void OnChange();
|
||||
afx_msg void OnAutoCompleteListBoxChange();
|
||||
afx_msg void OnAutoCompleteListBoxDblClk();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
// settings
|
||||
CHARFORMAT2 defaultCharFormat;
|
||||
COLORREF defaultColor;
|
||||
COLORREF singleLineCommentColor;
|
||||
COLORREF multiLineCommentColor;
|
||||
COLORREF stringColor[2];
|
||||
COLORREF literalColor;
|
||||
COLORREF braceHighlightColor;
|
||||
|
||||
typedef enum {
|
||||
CT_WHITESPACE,
|
||||
CT_COMMENT,
|
||||
CT_STRING,
|
||||
CT_LITERAL,
|
||||
CT_NUMBER,
|
||||
CT_NAME,
|
||||
CT_PUNCTUATION
|
||||
} charType_t;
|
||||
|
||||
int charType[256];
|
||||
|
||||
idList<keyWord_t> keyWordsFromFile;
|
||||
const keyWord_t * keyWords;
|
||||
int * keyWordLengths;
|
||||
COLORREF * keyWordColors;
|
||||
idHashIndex keyWordHash;
|
||||
|
||||
bool caseSensitive;
|
||||
bool allowPathNames;
|
||||
bool keyWordAutoCompletion;
|
||||
|
||||
objectMemberCallback_t GetObjectMembers;
|
||||
toolTipCallback_t GetFunctionParms;
|
||||
toolTipCallback_t GetToolTip;
|
||||
|
||||
// run-time variables
|
||||
tom::ITextDocument * m_TextDoc;
|
||||
tom::ITextFont * m_DefaultFont;
|
||||
|
||||
CHARRANGE updateRange;
|
||||
bool updateSyntaxHighlighting;
|
||||
int stringColorIndex;
|
||||
int stringColorLine;
|
||||
|
||||
int autoCompleteStart;
|
||||
CListBox autoCompleteListBox;
|
||||
|
||||
int funcParmToolTipStart;
|
||||
CEdit funcParmToolTip;
|
||||
|
||||
int bracedSection[2];
|
||||
|
||||
CPoint mousePoint;
|
||||
CToolTipCtrl * keyWordToolTip;
|
||||
TCHAR * m_pchTip;
|
||||
WCHAR * m_pwchTip;
|
||||
|
||||
protected:
|
||||
void InitFont( void );
|
||||
void InitSyntaxHighlighting( void );
|
||||
void SetCharType( int first, int last, int type );
|
||||
void SetDefaultFont( int startCharIndex, int endCharIndex );
|
||||
void SetColor( int startCharIndex, int endCharIndex, COLORREF foreColor, COLORREF backColor, bool bold );
|
||||
|
||||
void FreeKeyWordsFromFile( void );
|
||||
int FindKeyWord( const char *keyWord, int length ) const;
|
||||
|
||||
void HighlightSyntax( int startCharIndex, int endCharIndex );
|
||||
void UpdateVisibleRange( void );
|
||||
|
||||
bool GetNameBeforeCurrentSelection( CString &name, int &charIndex ) const;
|
||||
bool GetNameForMousePosition( idStr &name ) const;
|
||||
|
||||
void AutoCompleteInsertText( void );
|
||||
void AutoCompleteUpdate( void );
|
||||
void AutoCompleteShow( int charIndex );
|
||||
void AutoCompleteHide( void );
|
||||
|
||||
void ToolTipShow( int charIndex, const char *string );
|
||||
void ToolTipHide( void );
|
||||
|
||||
bool BracedSectionStart( char braceStartChar, char braceEndChar );
|
||||
bool BracedSectionEnd( char braceStartChar, char braceEndChar );
|
||||
void BracedSectionAdjustEndTabs( void );
|
||||
void BracedSectionShow( void );
|
||||
void BracedSectionHide( void );
|
||||
};
|
||||
|
||||
#endif /* !__CSYNTAXRICHEDITCTR_H__ */
|
||||
1314
neo/tools/comafx/DialogColorPicker.cpp
Normal file
1314
neo/tools/comafx/DialogColorPicker.cpp
Normal file
File diff suppressed because it is too large
Load Diff
193
neo/tools/comafx/DialogColorPicker.h
Normal file
193
neo/tools/comafx/DialogColorPicker.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __DIALOGCOLORPICKER__
|
||||
#define __DIALOGCOLORPICKER__
|
||||
|
||||
// Original ColorPicker/DIB source by Rajiv Ramachandran <rrajivram@hotmail.com>
|
||||
// included with permission from the author
|
||||
|
||||
#include "CDib.h"
|
||||
|
||||
#define RADIUS 100
|
||||
#define PI 3.14159265358
|
||||
|
||||
#define RECT_WIDTH 5
|
||||
|
||||
#define TOSCALE(x) (((x)*RADIUS)/255.0)
|
||||
#define SCALETOMAX(x) (((x)*255.0)/RADIUS)
|
||||
|
||||
|
||||
#define RED 0
|
||||
#define GREEN 1
|
||||
#define BLUE 2
|
||||
|
||||
#define BAD_SLOPE 1000000.0
|
||||
|
||||
|
||||
struct HSVType;
|
||||
|
||||
struct RGBType {
|
||||
COLORREF color() { return RGB( r, g, b ); }
|
||||
HSVType toHSV();
|
||||
int r, g, b;
|
||||
};
|
||||
|
||||
struct HSVType {
|
||||
RGBType toRGB();
|
||||
int h, s, v;
|
||||
};
|
||||
|
||||
struct LineDesc {
|
||||
double x, y;
|
||||
double slope;
|
||||
double c;
|
||||
};
|
||||
|
||||
|
||||
class CDialogColorPicker : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CDialogColorPicker(COLORREF c,CWnd* pParent = NULL); // standard constructor
|
||||
~CDialogColorPicker();
|
||||
|
||||
COLORREF GetColor() { return color.color();};
|
||||
float GetOverBright() { return overBright; };
|
||||
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CDialogColorPicker)
|
||||
enum { IDD = IDD_DIALOG_COLORS };
|
||||
float m_overBright;
|
||||
//}}AFX_DATA
|
||||
|
||||
void (*UpdateParent)( float r, float g, float b, float a );
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CDialogColorPicker)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CDialogColorPicker)
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnSysColorChange();
|
||||
afx_msg void OnPaint();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnChangeEditBlue();
|
||||
afx_msg void OnChangeEditGreen();
|
||||
afx_msg void OnChangeEditHue();
|
||||
afx_msg void OnChangeEditRed();
|
||||
afx_msg void OnChangeEditSat();
|
||||
afx_msg void OnChangeEditVal();
|
||||
afx_msg void OnChangeEditOverbright();
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
afx_msg void OnBtnColor();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
void DrawFilledColor(CDC *pDC,CRect cr,COLORREF c);
|
||||
void DrawLines(CDC *pDC);
|
||||
void DrawXorRect(CDC *pDC,CRect& cr);
|
||||
void CalcSlopes();
|
||||
void CalcCuboid();
|
||||
|
||||
void CreateBrightDIB();
|
||||
void SetDIBPalette();
|
||||
void DrawMarkers(CDC *pDC);
|
||||
void TrackPoint(CPoint pt);
|
||||
void CalcRects();
|
||||
|
||||
BOOL InCircle(CPoint pt);
|
||||
BOOL InBright(CPoint pt);
|
||||
BOOL InOverBright(CPoint pt);
|
||||
|
||||
|
||||
void SetSpinVals();
|
||||
void SetEditVals();
|
||||
void DrawAll();
|
||||
|
||||
void DrawRGB(CDC *pDC);
|
||||
void DrawHSB(CDC *pDC);
|
||||
|
||||
void LoadMappedBitmap(CBitmap& bitmap,UINT nIdResource,CSize& size);
|
||||
|
||||
CBitmap m_RgbBitmap,m_HsbBitmap;
|
||||
|
||||
CDC memDC;
|
||||
CPoint m_Centre;
|
||||
CDIB m_BrightDIB;
|
||||
|
||||
int rgbWidth;
|
||||
int rgbHeight;
|
||||
int hsbWidth;
|
||||
int hsbHeight;
|
||||
|
||||
int m_nMouseIn;
|
||||
CRect m_CurrentRect,brightMark;
|
||||
CRect brightRect;
|
||||
CRect overBrightRect;
|
||||
|
||||
HSVType hsvColor;
|
||||
|
||||
RGBType color;
|
||||
RGBType m_OldColor;
|
||||
CPoint Vertex;
|
||||
CPoint Top;
|
||||
CPoint Left;
|
||||
CPoint Right;
|
||||
CRect rects[3];
|
||||
CPoint m_Cuboid[8];
|
||||
BOOL m_bInMouse;
|
||||
int nIndex;
|
||||
int RedLen;
|
||||
int GreenLen;
|
||||
int BlueLen;
|
||||
LineDesc lines[3];
|
||||
|
||||
|
||||
CRect rgbRect;
|
||||
CRect hsbRect;
|
||||
CRect OldColorRect;
|
||||
CRect NewColorRect;
|
||||
|
||||
BOOL m_bInitOver;
|
||||
BOOL m_bInDrawAll;
|
||||
|
||||
float overBright;
|
||||
};
|
||||
|
||||
bool DoNewColor( int* i1, int* i2, int* i3, float *overBright, void (*Update)( float, float, float, float ) = NULL );
|
||||
|
||||
#endif /* !__DIALOGCOLORPICKER__ */
|
||||
134
neo/tools/comafx/DialogGoToLine.cpp
Normal file
134
neo/tools/comafx/DialogGoToLine.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../../idlib/precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "../../sys/win32/rc/Common_resource.h"
|
||||
|
||||
#include "DialogGoToLine.h"
|
||||
|
||||
#ifdef ID_DEBUG_MEMORY
|
||||
#undef new
|
||||
#undef DEBUG_NEW
|
||||
#define DEBUG_NEW new
|
||||
#endif
|
||||
|
||||
|
||||
IMPLEMENT_DYNAMIC(DialogGoToLine, CDialog)
|
||||
|
||||
/*
|
||||
================
|
||||
DialogGoToLine::DialogGoToLine
|
||||
================
|
||||
*/
|
||||
DialogGoToLine::DialogGoToLine( CWnd* pParent /*=NULL*/ )
|
||||
: CDialog(DialogGoToLine::IDD, pParent)
|
||||
, firstLine(0)
|
||||
, lastLine(0)
|
||||
, line(0)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DialogGoToLine::~DialogGoToLine
|
||||
================
|
||||
*/
|
||||
DialogGoToLine::~DialogGoToLine() {
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DialogGoToLine::DoDataExchange
|
||||
================
|
||||
*/
|
||||
void DialogGoToLine::DoDataExchange(CDataExchange* pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(DialogGoToLine)
|
||||
DDX_Control( pDX, IDC_GOTOLINE_EDIT, numberEdit);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DialogGoToLine::SetRange
|
||||
================
|
||||
*/
|
||||
void DialogGoToLine::SetRange( int firstLine, int lastLine ) {
|
||||
this->firstLine = firstLine;
|
||||
this->lastLine = lastLine;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DialogGoToLine::GetLine
|
||||
================
|
||||
*/
|
||||
int DialogGoToLine::GetLine( void ) const {
|
||||
return line;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DialogGoToLine::OnInitDialog
|
||||
================
|
||||
*/
|
||||
BOOL DialogGoToLine::OnInitDialog() {
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
GetDlgItem( IDC_GOTOLINE_STATIC )->SetWindowText( va( "&Line number (%d - %d):", firstLine, lastLine ) );
|
||||
|
||||
numberEdit.SetWindowText( va( "%d", firstLine ) );
|
||||
numberEdit.SetSel( 0, -1 );
|
||||
numberEdit.SetFocus();
|
||||
|
||||
return FALSE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(DialogGoToLine, CDialog)
|
||||
ON_BN_CLICKED(IDOK, OnBnClickedOk)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// DialogGoToLine message handlers
|
||||
|
||||
/*
|
||||
================
|
||||
DialogGoToLine::OnBnClickedOk
|
||||
================
|
||||
*/
|
||||
void DialogGoToLine::OnBnClickedOk() {
|
||||
CString text;
|
||||
numberEdit.GetWindowText( text );
|
||||
line = idMath::ClampInt( firstLine, lastLine, atoi( text ) );
|
||||
OnOK();
|
||||
}
|
||||
63
neo/tools/comafx/DialogGoToLine.h
Normal file
63
neo/tools/comafx/DialogGoToLine.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __DIALOGGOTOLINE_H__
|
||||
#define __DIALOGGOTOLINE_H__
|
||||
|
||||
// DialogGoToLine dialog
|
||||
|
||||
class DialogGoToLine : public CDialog {
|
||||
|
||||
DECLARE_DYNAMIC(DialogGoToLine)
|
||||
|
||||
public:
|
||||
|
||||
DialogGoToLine( CWnd* pParent = NULL ); // standard constructor
|
||||
virtual ~DialogGoToLine();
|
||||
|
||||
enum { IDD = IDD_DIALOG_GOTOLINE };
|
||||
|
||||
void SetRange( int firstLine, int lastLine );
|
||||
int GetLine( void ) const;
|
||||
|
||||
protected:
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void DoDataExchange( CDataExchange* pDX ); // DDX/DDV support
|
||||
afx_msg void OnBnClickedOk();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
|
||||
CEdit numberEdit;
|
||||
int firstLine;
|
||||
int lastLine;
|
||||
int line;
|
||||
};
|
||||
|
||||
#endif /* !__DIALOGGOTOLINE_H__ */
|
||||
78
neo/tools/comafx/DialogName.cpp
Normal file
78
neo/tools/comafx/DialogName.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../../idlib/precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "../../sys/win32/rc/common_resource.h"
|
||||
#include "DialogName.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DialogName dialog
|
||||
|
||||
|
||||
DialogName::DialogName(const char *pName, CWnd* pParent /*=NULL*/)
|
||||
: CDialog(DialogName::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(DialogName)
|
||||
m_strName = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
m_strCaption = pName;
|
||||
}
|
||||
|
||||
|
||||
void DialogName::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(DialogName)
|
||||
DDX_Text(pDX, IDC_TOOLS_EDITNAME, m_strName);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BOOL DialogName::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
SetWindowText(m_strCaption);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(DialogName, CDialog)
|
||||
//{{AFX_MSG_MAP(DialogName)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DialogName message handlers
|
||||
|
||||
void DialogName::OnOK()
|
||||
{
|
||||
CDialog::OnOK();
|
||||
}
|
||||
76
neo/tools/comafx/DialogName.h
Normal file
76
neo/tools/comafx/DialogName.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __DIALOGNAME_H__
|
||||
#define __DIALOGNAME_H__
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// NameDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DialogName dialog
|
||||
|
||||
class DialogName : public CDialog
|
||||
{
|
||||
CString m_strCaption;
|
||||
// Construction
|
||||
public:
|
||||
DialogName(const char *pName, CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(DialogName)
|
||||
enum { IDD = IDD_NEWNAME };
|
||||
CString m_strName;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(DialogName)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(DialogName)
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void OnOK();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif /* !__DIALOGNAME_H__ */
|
||||
382
neo/tools/comafx/StdAfx.cpp
Normal file
382
neo/tools/comafx/StdAfx.cpp
Normal file
@@ -0,0 +1,382 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../../idlib/precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "../../sys/win32/win_local.h"
|
||||
|
||||
// source file that includes just the standard includes
|
||||
// Radiant.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Afx initialization.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
bool afxInitialized = false;
|
||||
|
||||
/*
|
||||
================
|
||||
InitAfx
|
||||
================
|
||||
*/
|
||||
void InitAfx( void ) {
|
||||
if ( !afxInitialized ) {
|
||||
AfxWinInit( win32.hInstance, NULL, "", SW_SHOW );
|
||||
AfxInitRichEdit();
|
||||
afxInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Tool Tips.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
================
|
||||
DefaultOnToolHitTest
|
||||
================
|
||||
*/
|
||||
int DefaultOnToolHitTest( const toolTip_t *toolTips, const CDialog *dialog, CPoint point, TOOLINFO* pTI ) {
|
||||
CWnd *wnd;
|
||||
RECT clientRect, rect;
|
||||
|
||||
dialog->GetWindowRect( &clientRect );
|
||||
point.x += clientRect.left;
|
||||
point.y += clientRect.top;
|
||||
for ( int i = 0; toolTips[i].tip; i++ ) {
|
||||
wnd = dialog->GetDlgItem( toolTips[i].id );
|
||||
if ( !( wnd->GetStyle() & WS_VISIBLE ) ) {
|
||||
continue;
|
||||
}
|
||||
wnd->GetWindowRect( &rect );
|
||||
if ( point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom ) {
|
||||
pTI->hwnd = dialog->GetSafeHwnd();
|
||||
pTI->uFlags |= TTF_IDISHWND;
|
||||
pTI->uFlags &= ~TTF_CENTERTIP;
|
||||
pTI->uId = (UINT_PTR) wnd->GetSafeHwnd();
|
||||
return pTI->uId;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
DefaultOnToolTipNotify
|
||||
================
|
||||
*/
|
||||
BOOL DefaultOnToolTipNotify( const toolTip_t *toolTips, UINT id, NMHDR *pNMHDR, LRESULT *pResult ) {
|
||||
// need to handle both ANSI and UNICODE versions of the message
|
||||
TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
|
||||
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
|
||||
|
||||
*pResult = 0;
|
||||
|
||||
UINT nID = pNMHDR->idFrom;
|
||||
if ( pTTTA->uFlags & TTF_IDISHWND ) {
|
||||
// idFrom is actually the HWND of the tool
|
||||
nID = ::GetDlgCtrlID((HWND)nID);
|
||||
}
|
||||
|
||||
int i;
|
||||
for ( i = 0; toolTips[i].tip; i++ ) {
|
||||
if ( toolTips[i].id == nID ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !toolTips[i].tip ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( pNMHDR->code == TTN_NEEDTEXTA ) {
|
||||
lstrcpyn( pTTTA->szText, toolTips[i].tip, sizeof(pTTTA->szText) );
|
||||
} else {
|
||||
_mbstowcsz( pTTTW->szText, toolTips[i].tip, sizeof(pTTTW->szText) );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Common control tools.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
================
|
||||
EditControlEnterHit
|
||||
|
||||
returns true if [Enter] was hit in the edit box
|
||||
all 'return' characters in the text are removed and a single line is maintained
|
||||
the edit control must be multi-line with auto-vscroll
|
||||
================
|
||||
*/
|
||||
bool EditControlEnterHit( CEdit *edit ) {
|
||||
CString strIn, strOut;
|
||||
if ( edit->GetLineCount() > 1 ) {
|
||||
edit->GetWindowText( strIn );
|
||||
for ( int i = 0; i < strIn.GetLength(); i++ ) {
|
||||
if ( strIn[i] >= ' ' ) {
|
||||
strOut.AppendChar( strIn[i] );
|
||||
}
|
||||
}
|
||||
edit->SetWindowText( strOut );
|
||||
edit->SetSel( 0, strOut.GetLength() );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
EditVerifyFloat
|
||||
================
|
||||
*/
|
||||
float EditVerifyFloat( CEdit *edit, bool allowNegative ) {
|
||||
|
||||
CString strIn, strOut;
|
||||
bool dot = false;
|
||||
int start, end;
|
||||
|
||||
edit->GetSel( start, end );
|
||||
edit->GetWindowText( strIn );
|
||||
for ( int i = 0; i < strIn.GetLength(); i++ ) {
|
||||
// first character may be a minus sign
|
||||
if ( allowNegative && strOut.GetLength() == 0 && strIn[i] == '-' ) {
|
||||
strOut.AppendChar( '-' );
|
||||
}
|
||||
// the string may contain one dot
|
||||
else if ( !dot && strIn[i] == '.' ) {
|
||||
strOut.AppendChar( strIn[i] );
|
||||
dot = true;
|
||||
}
|
||||
else if ( strIn[i] >= '0' && strIn[i] <= '9' ) {
|
||||
strOut.AppendChar( strIn[i] );
|
||||
}
|
||||
}
|
||||
edit->SetWindowText( strOut );
|
||||
edit->SetSel( start, end );
|
||||
|
||||
return atof(strOut.GetBuffer(0));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SpinFloatString
|
||||
================
|
||||
*/
|
||||
void SpinFloatString( CString &str, bool up ) {
|
||||
int i, dotIndex = -1, digitIndex = -1;
|
||||
|
||||
for ( i = 0; str[i]; i++ ) {
|
||||
if ( str[i] == '.' ) {
|
||||
if ( dotIndex == -1 ) {
|
||||
dotIndex = i;
|
||||
}
|
||||
}
|
||||
else if ( str[i] != '0' ) {
|
||||
if ( digitIndex == -1 ) {
|
||||
digitIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( digitIndex == -1 ) {
|
||||
str.SetString( "1" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( dotIndex != -1 ) {
|
||||
str.Delete( dotIndex, 1 );
|
||||
if ( digitIndex > dotIndex ) {
|
||||
digitIndex--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dotIndex = i;
|
||||
}
|
||||
|
||||
if ( up ) {
|
||||
if ( str[digitIndex] == '9' ) {
|
||||
str.SetAt( digitIndex, '0' );
|
||||
if ( digitIndex == 0 ) {
|
||||
str.Insert( 0, '1' );
|
||||
dotIndex++;
|
||||
}
|
||||
else {
|
||||
str.SetAt( digitIndex-1, '1' );
|
||||
}
|
||||
}
|
||||
else {
|
||||
str.SetAt( digitIndex, str[digitIndex] + 1 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( str[digitIndex] == '1' ) {
|
||||
if ( str[digitIndex+1] == '\0' ) {
|
||||
str.SetAt( digitIndex, '0' );
|
||||
str.AppendChar( '9' );
|
||||
}
|
||||
else if ( str[digitIndex+1] == '0' ) {
|
||||
str.SetAt( digitIndex, '0' );
|
||||
str.SetAt( digitIndex+1, '9' );
|
||||
}
|
||||
else {
|
||||
str.SetAt( digitIndex+1, str[digitIndex+1] - 1 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
str.SetAt( digitIndex, str[digitIndex] - 1 );
|
||||
}
|
||||
}
|
||||
if ( dotIndex < str.GetLength() ) {
|
||||
str.Insert( dotIndex, '.' );
|
||||
// remove trailing zeros
|
||||
for ( i = str.GetLength()-1; i >= 0; i-- ) {
|
||||
if ( str[i] != '0' && str[i] != '.' ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( i < str.GetLength() - 1 ) {
|
||||
str.Delete( i+1, str.GetLength() - i );
|
||||
}
|
||||
}
|
||||
for ( i = 0; str[i]; i++ ) {
|
||||
if ( str[i] == '.' ) {
|
||||
if ( i > 1 ) {
|
||||
str.Delete( 0, i-1 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ( str[i] != '0' ) {
|
||||
if ( i > 0 ) {
|
||||
str.Delete( 0, i );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
EditSpinFloat
|
||||
================
|
||||
*/
|
||||
float EditSpinFloat( CEdit *edit, bool up ) {
|
||||
CString str;
|
||||
|
||||
edit->GetWindowText( str );
|
||||
SpinFloatString( str, up );
|
||||
edit->SetWindowText( str );
|
||||
return atof( str );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SetSafeComboBoxSelection
|
||||
================
|
||||
*/
|
||||
int SetSafeComboBoxSelection( CComboBox *combo, const char *string, int skip ) {
|
||||
int index;
|
||||
|
||||
index = combo->FindString( -1, string );
|
||||
if ( index == -1 ) {
|
||||
index = 0;
|
||||
}
|
||||
if ( combo->GetCount() != 0 ) {
|
||||
if ( index == skip ) {
|
||||
index = ( skip + 1 ) % combo->GetCount();
|
||||
}
|
||||
combo->SetCurSel( index );
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
GetComboBoxSelection
|
||||
================
|
||||
*/
|
||||
int GetSafeComboBoxSelection( CComboBox *combo, CString &string, int skip ) {
|
||||
int index;
|
||||
|
||||
index = combo->GetCurSel();
|
||||
if ( index == CB_ERR ) {
|
||||
index = 0;
|
||||
}
|
||||
if ( combo->GetCount() != 0 ) {
|
||||
if ( index == skip ) {
|
||||
index = ( skip + 1 ) % combo->GetCount();
|
||||
}
|
||||
combo->GetLBText( index, string );
|
||||
}
|
||||
else {
|
||||
string = "";
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
UnsetSafeComboBoxSelection
|
||||
================
|
||||
*/
|
||||
int UnsetSafeComboBoxSelection( CComboBox *combo, CString &string ) {
|
||||
int skip, index;
|
||||
|
||||
skip = combo->FindString( -1, string );
|
||||
index = combo->GetCurSel();
|
||||
if ( index == CB_ERR ) {
|
||||
index = 0;
|
||||
}
|
||||
if ( combo->GetCount() != 0 ) {
|
||||
if ( index == skip ) {
|
||||
index = ( skip + 1 ) % combo->GetCount();
|
||||
}
|
||||
combo->SetCurSel( index );
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
66
neo/tools/comafx/StdAfx.h
Normal file
66
neo/tools/comafx/StdAfx.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __AFX_STDAFX_H__
|
||||
#define __AFX_STDAFX_H__
|
||||
|
||||
// include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
|
||||
//#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxdisp.h> // MFC OLE automation classes
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
void InitAfx( void );
|
||||
|
||||
// tool tips
|
||||
typedef struct toolTip_s {
|
||||
int id;
|
||||
char *tip;
|
||||
} toolTip_t;
|
||||
|
||||
int DefaultOnToolHitTest( const toolTip_t *toolTips, const CDialog *dialog, CPoint point, TOOLINFO* pTI );
|
||||
BOOL DefaultOnToolTipNotify( const toolTip_t *toolTips, UINT id, NMHDR *pNMHDR, LRESULT *pResult );
|
||||
|
||||
// edit control
|
||||
bool EditControlEnterHit( CEdit *edit );
|
||||
float EditVerifyFloat( CEdit *edit, bool allowNegative = true );
|
||||
float EditSpinFloat( CEdit *edit, bool up );
|
||||
|
||||
// combo box
|
||||
int SetSafeComboBoxSelection( CComboBox *combo, const char *string, int skip );
|
||||
int GetSafeComboBoxSelection( CComboBox *combo, CString &string, int skip );
|
||||
int UnsetSafeComboBoxSelection( CComboBox *combo, CString &string );
|
||||
|
||||
#endif /* !__AFX_STDAFX_H__ */
|
||||
424
neo/tools/comafx/VectorCtl.cpp
Normal file
424
neo/tools/comafx/VectorCtl.cpp
Normal file
@@ -0,0 +1,424 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#include "../../idlib/precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
|
||||
#include "VectorCtl.h"
|
||||
#include <math.h>
|
||||
|
||||
BEGIN_MESSAGE_MAP(CVectorCtl, CButton)
|
||||
//{{AFX_MSG_MAP(idGLWidget)
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_MOUSEMOVE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
CVectorCtl::CVectorCtl () :
|
||||
m_bBmpCreated (FALSE),
|
||||
m_bImageChange (TRUE),
|
||||
m_bBackgroundBitmapUsed (FALSE),
|
||||
m_clrDiffuse (DEFAULT_DIFFUSE),
|
||||
m_clrAmbient (DEFAULT_AMBIENT),
|
||||
m_clrLight (DEFAULT_LIGHT),
|
||||
m_clrBackgroundStart (DEFAULT_START_BACKGROUND_COLOR),
|
||||
m_clrBackgroundEnd (DEFAULT_END_BACKGROUND_COLOR),
|
||||
m_dSpecularExponent (DEFAULT_SPEC_EXP),
|
||||
m_bHasFocus (FALSE),
|
||||
m_bSelected (FALSE),
|
||||
m_bFrontVector (FALSE),
|
||||
m_dSensitivity (20.0),
|
||||
m_procVectorChanging (NULL),
|
||||
m_procVectorChanged (NULL)
|
||||
{
|
||||
double DefaultVec[3] = DEFAULT_VEC;
|
||||
for (int i=0; i<3; i++) {
|
||||
m_dVec[i] = DefaultVec[i];
|
||||
pCtl[i] = NULL;
|
||||
}
|
||||
|
||||
rotationQuat.Set( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
lastPress.Zero();
|
||||
radius = 0.6f;
|
||||
}
|
||||
|
||||
|
||||
CVectorCtl::~CVectorCtl ()
|
||||
{
|
||||
if (m_bBmpCreated)
|
||||
m_dcMem.SelectObject (m_pOldBitmap);
|
||||
ClearBackgroundBitmap ();
|
||||
}
|
||||
|
||||
// Owner-drawn control service function:
|
||||
void CVectorCtl::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
|
||||
{
|
||||
CDC *pDC = CDC::FromHandle (lpDrawItemStruct->hDC); // Get CDC to draw
|
||||
|
||||
if (!m_bSelected && lpDrawItemStruct->itemState & ODS_SELECTED) {
|
||||
// Just got re-selected (user starts a new mouse dragging session)
|
||||
} else if (m_bSelected && // Last state was selected
|
||||
!(lpDrawItemStruct->itemState & ODS_SELECTED) && // New state is NOT selected
|
||||
(lpDrawItemStruct->itemState & ODS_FOCUS) && // New state is still in focus
|
||||
m_procVectorChanged) // User asked for a callback
|
||||
// User has left the track-ball and asked for a callback.
|
||||
m_procVectorChanged ( rotationQuat );
|
||||
|
||||
m_bHasFocus = lpDrawItemStruct->itemState & ODS_FOCUS; // Update focus status
|
||||
m_bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; // Update selection status
|
||||
|
||||
if (!m_bBmpCreated) // 1st time
|
||||
InitBitmap (lpDrawItemStruct, pDC);
|
||||
if (m_bImageChange) { // Image has changes - recalc it!
|
||||
if (m_procVectorChanging) // User has specified a callback
|
||||
m_procVectorChanging ( rotationQuat ); // Call it!
|
||||
BuildImage (lpDrawItemStruct);
|
||||
m_bImageChange = FALSE;
|
||||
}
|
||||
pDC->BitBlt (0,0,m_iWidth, m_iHeight, &m_dcMem, 0, 0, SRCCOPY); // Update screen
|
||||
}
|
||||
|
||||
// Mouse was dragged
|
||||
void CVectorCtl::OnMouseDrag (int ixMove, int iyMove)
|
||||
{
|
||||
RotateByXandY (double(-iyMove) / m_dSensitivity,
|
||||
double(ixMove) / m_dSensitivity);
|
||||
}
|
||||
|
||||
// Recalc ball image
|
||||
void CVectorCtl::BuildImage (LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
{
|
||||
int xf, yf;
|
||||
|
||||
for (int x=0; x<m_iWidth; x++) // Scan all columns
|
||||
for (int y=0; y<m_iHeight; y++) { // Scan all rows
|
||||
xf = x-m_iXCenter; // Find distance from center
|
||||
yf = y-m_iYCenter;
|
||||
if (xf*xf + yf*yf <= m_iSqrRadius) { // Point on ball surface
|
||||
double vx = double(xf) / double(m_iRadius),
|
||||
vy = double(yf) / double(m_iRadius),
|
||||
vz = sqrt (1.0 - vx*vx - vy*vy); // Find ball's normal
|
||||
m_dcMem.SetPixelV (x,y, CalcLight (vx,vy,vz));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize a vector to unit size
|
||||
BOOL CVectorCtl::Normalize ()
|
||||
{
|
||||
double Norm = m_dVec[0] * m_dVec[0] + m_dVec[1] * m_dVec[1] + m_dVec[2] * m_dVec[2];
|
||||
|
||||
if (Norm > EPS) {
|
||||
Norm = sqrt (Norm);
|
||||
m_dVec[0] /= Norm;
|
||||
m_dVec[1] /= Norm;
|
||||
m_dVec[2] /= Norm;
|
||||
return TRUE;
|
||||
} else { // Reset to defualt vector
|
||||
double DefaultVec[3] = DEFAULT_VEC;
|
||||
for (int i=0; i<3; i++)
|
||||
m_dVec[i] = DefaultVec[i];
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate lightning effect for specific pixel on ball's surface
|
||||
COLORREF CVectorCtl::CalcLight (double dx, double dy, double dz)
|
||||
{
|
||||
double NL = dx * m_dVec[0] + dy * m_dVec[1] + dz * m_dVec[2],
|
||||
RV = 2.0 * NL,
|
||||
rx = m_dVec[0] - (dx * RV),
|
||||
ry = m_dVec[1] - (dy * RV),
|
||||
rz = m_dVec[2] - (dz * RV);
|
||||
|
||||
if (NL < 0.0) // Diffuse coefficient
|
||||
NL = 0.0;
|
||||
|
||||
RV = max (0.0, -rz);
|
||||
RV = double(pow (RV, m_dSpecularExponent));
|
||||
|
||||
int r = int ( double(GetRValue(m_clrDiffuse)) * NL + // Diffuse
|
||||
double(GetRValue(m_clrLight)) * RV + // Specular
|
||||
double(GetRValue(m_clrAmbient))), // Ambient
|
||||
|
||||
g = int ( double(GetGValue(m_clrDiffuse)) * NL + // Diffuse
|
||||
double(GetGValue(m_clrLight)) * RV + // Specular
|
||||
double(GetGValue(m_clrAmbient))), // Ambient
|
||||
|
||||
b = int ( double(GetBValue(m_clrDiffuse)) * NL + // Diffuse
|
||||
double(GetBValue(m_clrLight)) * RV + // Specular
|
||||
double(GetBValue(m_clrAmbient))); // Ambient
|
||||
|
||||
r = min (255, r); // Cutoff highlight
|
||||
g = min (255, g);
|
||||
b = min (255, b);
|
||||
return RGB(BYTE(r),BYTE(g),BYTE(b));
|
||||
}
|
||||
|
||||
|
||||
// Start memory buffer bitmap and measure it
|
||||
void CVectorCtl::InitBitmap (LPDRAWITEMSTRUCT lpDrawItemStruct, CDC *pDC)
|
||||
{
|
||||
m_iWidth = lpDrawItemStruct->rcItem.right - lpDrawItemStruct->rcItem.left;
|
||||
m_iHeight = lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top;
|
||||
m_bmpBuffer.CreateCompatibleBitmap (pDC, m_iWidth, m_iHeight);
|
||||
m_bBmpCreated = TRUE;
|
||||
m_dcMem.CreateCompatibleDC (pDC);
|
||||
m_pOldBitmap = m_dcMem.SelectObject (&m_bmpBuffer);
|
||||
SetRadius (max (min (m_iWidth, m_iHeight) - 2, 0) / 2);
|
||||
SetCenter (m_iWidth / 2, m_iHeight / 2);
|
||||
CreateBackground ();
|
||||
}
|
||||
|
||||
// Set new specular intensity
|
||||
BOOL CVectorCtl::SetSpecularExponent (double dExp)
|
||||
{
|
||||
if (dExp < 1.0 || dExp > 200.0)
|
||||
return FALSE;
|
||||
m_dSpecularExponent = dExp;
|
||||
Redraw ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Rotate our vector around the X and Y axis
|
||||
void CVectorCtl::RotateByXandY (double XRot, double YRot)
|
||||
{ // Angles are in radians
|
||||
|
||||
if (XRot == 0.0 && YRot == 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
double cx = cos(XRot),
|
||||
sx = sin(XRot),
|
||||
cy = cos(YRot),
|
||||
sy = sin(YRot),
|
||||
dx = m_dVec[0] * cy + m_dVec[1] * sx * sy + m_dVec[2] * cx * sy,
|
||||
dy = m_dVec[1] * cx - m_dVec[2] * sx,
|
||||
dz = -m_dVec[0] * sy + m_dVec[1] * sx * cy + m_dVec[2] * cx * cy;
|
||||
|
||||
if (!m_bFrontVector || dz >= 0.0) { // Vector is bounds free
|
||||
m_dVec[0] = dx;
|
||||
m_dVec[1] = dy;
|
||||
m_dVec[2] = dz;
|
||||
} else { // Otherwise, do not allow Z to be negative (light shines from behind)
|
||||
m_dVec[2] = 0.0;
|
||||
m_dVec[0] = dx;
|
||||
m_dVec[1] = dy;
|
||||
Normalize ();
|
||||
}
|
||||
Redraw ();
|
||||
}
|
||||
|
||||
|
||||
void CVectorCtl::UpdateAxisControls ()
|
||||
{
|
||||
CString cs;
|
||||
for (int i=0; i<3; i++)
|
||||
if (pCtl[i]) {
|
||||
cs.Format ("%+1.5f",m_dVec[i]);
|
||||
pCtl[i]->SetWindowText (cs);
|
||||
}
|
||||
}
|
||||
|
||||
void CVectorCtl::SetAxisControl (int nXCtl, int nYCtl, int nZCtl)
|
||||
{
|
||||
pCtl[0] = GetParent()->GetDlgItem(nXCtl);
|
||||
pCtl[1] = GetParent()->GetDlgItem(nYCtl);
|
||||
pCtl[2] = GetParent()->GetDlgItem(nZCtl);
|
||||
}
|
||||
|
||||
void CVectorCtl::SetRadius (UINT uRadius)
|
||||
{
|
||||
m_iRadius = uRadius;
|
||||
m_iSqrRadius = m_iRadius * m_iRadius;
|
||||
CreateBackground ();
|
||||
Redraw (TRUE);
|
||||
}
|
||||
|
||||
|
||||
void CVectorCtl::SetCenter (UINT uHorizPos, UINT uVertPos)
|
||||
{
|
||||
m_iXCenter = uHorizPos;
|
||||
m_iYCenter = uVertPos;
|
||||
CreateBackground ();
|
||||
Redraw (TRUE);
|
||||
}
|
||||
|
||||
|
||||
void CVectorCtl::SetAxis (double d, int nAxis)
|
||||
{
|
||||
if (fabs(d)>=1.0) {
|
||||
m_dVec[nAxis]=d > 1.0 ? 1.0 : -1.0;
|
||||
m_dVec[(nAxis+1) %3]=m_dVec[(nAxis+2) %3]=0.0;
|
||||
Redraw ();
|
||||
return;
|
||||
}
|
||||
m_dVec[nAxis] = d;
|
||||
Normalize ();
|
||||
Redraw ();
|
||||
}
|
||||
|
||||
void CVectorCtl::SetVector (double dx, double dy, double dz)
|
||||
{
|
||||
m_dVec[0] = dx;
|
||||
m_dVec[1] = dy;
|
||||
m_dVec[2] = dz;
|
||||
Normalize ();
|
||||
Redraw ();
|
||||
}
|
||||
|
||||
void CVectorCtl::SetBackgroundColor (COLORREF clrStart, COLORREF clrEnd)
|
||||
{
|
||||
ClearBackgroundBitmap ();
|
||||
m_clrBackgroundStart = clrStart;
|
||||
m_clrBackgroundEnd = clrEnd;
|
||||
CreateBackground ();
|
||||
}
|
||||
|
||||
|
||||
BOOL CVectorCtl::SetBackgroundImage (UINT uBackgroundBitmapID)
|
||||
{
|
||||
if (m_bBackgroundBitmapUsed) {
|
||||
ClearBackgroundBitmap ();
|
||||
CreateBackground ();
|
||||
}
|
||||
if (!m_bmpBack.LoadBitmap (uBackgroundBitmapID))
|
||||
return FALSE;
|
||||
m_bBackgroundBitmapUsed = TRUE;
|
||||
CreateBackground ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CVectorCtl::CreateBackground ()
|
||||
{
|
||||
if (!m_bBmpCreated)
|
||||
return; // No image yet
|
||||
if (!m_bBackgroundBitmapUsed) { // No background used - fill with gradient color
|
||||
double r = GetRValue (m_clrBackgroundStart),
|
||||
g = GetGValue (m_clrBackgroundStart),
|
||||
b = GetBValue (m_clrBackgroundStart),
|
||||
rd = double (GetRValue (m_clrBackgroundEnd) - r) / double (m_iHeight),
|
||||
gd = double (GetGValue (m_clrBackgroundEnd) - g) / double (m_iHeight),
|
||||
bd = double (GetBValue (m_clrBackgroundEnd) - b) / double (m_iHeight);
|
||||
for (int j=0; j<m_iHeight; j++) {
|
||||
for (int i=0; i<m_iWidth; i++)
|
||||
m_dcMem.SetPixelV (i,j, RGB (BYTE(r),BYTE(g),BYTE(b)));
|
||||
r+=rd; g+=gd; b+=bd;
|
||||
}
|
||||
Redraw (TRUE);
|
||||
return;
|
||||
}
|
||||
// Bitmap used : tile it in back
|
||||
CDC DCtmp;
|
||||
BITMAP tmpBitmap;
|
||||
|
||||
m_bmpBack.GetBitmap (&tmpBitmap);
|
||||
int iTmpWidth = tmpBitmap.bmWidth,
|
||||
iTmpHeight = tmpBitmap.bmHeight;
|
||||
|
||||
DCtmp.CreateCompatibleDC (&m_dcMem);
|
||||
m_pOldBitmap = DCtmp.SelectObject (&m_bmpBack);
|
||||
|
||||
for (int i=0; i<m_iWidth; i++)
|
||||
for (int j=0; j<m_iHeight; j++)
|
||||
m_dcMem.SetPixelV (i,j, DCtmp.GetPixel (i % iTmpWidth, j % iTmpHeight));
|
||||
DCtmp.SelectObject (m_pOldBitmap);
|
||||
Redraw (TRUE);
|
||||
}
|
||||
|
||||
|
||||
void CVectorCtl::ClearBackgroundBitmap ()
|
||||
{
|
||||
if (!m_bBackgroundBitmapUsed)
|
||||
return;
|
||||
m_bmpBack.DeleteObject ();
|
||||
m_bBackgroundBitmapUsed = FALSE;
|
||||
}
|
||||
|
||||
BOOL CVectorCtl::SetSensitivity (UINT uSens)
|
||||
{
|
||||
if (uSens == 0)
|
||||
return FALSE;
|
||||
m_dSensitivity = double(uSens);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CVectorCtl::Redraw (BOOL bErase) {
|
||||
m_bImageChange = TRUE;
|
||||
UpdateAxisControls();
|
||||
Invalidate (bErase);
|
||||
}
|
||||
|
||||
void CVectorCtl::OnMouseMove(UINT nFlags, CPoint point) {
|
||||
|
||||
if ( CWnd::GetCapture() != this ) {
|
||||
return;
|
||||
}
|
||||
|
||||
float curX = ( float )( 2 * point.x - 64 ) / 64;
|
||||
float curY = ( float )( 2 * point.y - 64 ) / 64;
|
||||
|
||||
idVec3 to( -curX, -curY, 0.0f );
|
||||
to.ProjectSelfOntoSphere( radius );
|
||||
lastPress.ProjectSelfOntoSphere( radius );
|
||||
|
||||
idVec3 axis;
|
||||
axis.Cross( to, lastPress );
|
||||
float len = ( lastPress - to ).Length() / ( 2.0f * radius );
|
||||
len = idMath::ClampFloat( -1.0f, 1.0f, len );
|
||||
float phi = 2.0f * asin ( len ) ;
|
||||
|
||||
axis.Normalize();
|
||||
axis *= sin( phi / 2.0f );
|
||||
idQuat rot( axis.z, axis.y, axis.x, cos( phi / 2.0f ) );
|
||||
rot.Normalize();
|
||||
|
||||
rotationQuat *= rot;
|
||||
rotationQuat.Normalize();
|
||||
|
||||
lastPress = to;
|
||||
lastPress.z = 0.0f;
|
||||
|
||||
m_dVec = rotationQuat.ToMat3()[2];
|
||||
m_dVec.Normalize();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void CVectorCtl::OnLButtonDown(UINT nFlags, CPoint point) {
|
||||
float curX = ( float )( 2 * point.x - 64 ) / 64;
|
||||
float curY = ( float )( 2 * point.y - 64 ) / 64;
|
||||
lastPress.Set( -curX, -curY, 0.0f );
|
||||
SetCapture();
|
||||
}
|
||||
|
||||
void CVectorCtl::OnLButtonUp(UINT nFlags, CPoint point) {
|
||||
ReleaseCapture();
|
||||
}
|
||||
|
||||
|
||||
225
neo/tools/comafx/VectorCtl.h
Normal file
225
neo/tools/comafx/VectorCtl.h
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code 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.
|
||||
|
||||
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* Vector control *
|
||||
* ---------------- *
|
||||
* *
|
||||
* A 3D vector MFC control derived from CButton. *
|
||||
* Features: *
|
||||
* - Real-time light rendering on a 3D ball. *
|
||||
* - Variable ball radius and position. *
|
||||
* - Supports bitmap background (tiled). *
|
||||
* - Supports vertical gradient color background (from color to color). *
|
||||
* - Variable ball color (diffuse), light color and ambient color. *
|
||||
* - Variable specular intensity. *
|
||||
* - Supports attached controls (for automatic update). *
|
||||
* - Variable mouse sensitivity. *
|
||||
* - Supports front clipping (vector will not have negative Z values). *
|
||||
* - Supports callback functions for the following events: *
|
||||
* 1. The trackball has moved (vector is changing). *
|
||||
* 2. The user dropped the trackball (released left mouse button) *
|
||||
* i.e., the vector was changed. *
|
||||
* *
|
||||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _VECTOR_CTL_H
|
||||
#define _VECTOR_CTL_H
|
||||
|
||||
// Callback pointer prototype:
|
||||
typedef void (*VectorCtlCallbackProc)( idQuat rotation );
|
||||
|
||||
// The callback should look like:
|
||||
// void CALLBACK MyCallBack (double dVecX, double dVecY, double dVecZ);
|
||||
// or
|
||||
// static void CALLBACK MyClass::MyCallBack (double dVecX, double dVecY, double dVecZ);
|
||||
|
||||
|
||||
class CVectorCtl : public CButton
|
||||
{
|
||||
|
||||
#define EPS 1.0e-6 // Epsilon
|
||||
|
||||
#define DEFAULT_VEC {0.00, 0.00, 1.00} // Default start vector
|
||||
#define DEFAULT_DIFFUSE RGB( 30, 0, 200) // Default diffuse color
|
||||
#define DEFAULT_AMBIENT RGB( 20, 20, 20) // Default ambient color
|
||||
#define DEFAULT_LIGHT RGB(200, 200, 200) // Default light color
|
||||
#define DEFAULT_START_BACKGROUND_COLOR RGB( 0, 0, 0) // Default gradient background start color
|
||||
#define DEFAULT_END_BACKGROUND_COLOR RGB(140, 0, 120) // Default gradient background end color
|
||||
#define DEFAULT_SPEC_EXP 25.0 // Default specular intensity
|
||||
#define VAL_NOT_IN_USE -50000 // Internal use
|
||||
|
||||
|
||||
public:
|
||||
CVectorCtl ();
|
||||
|
||||
virtual ~CVectorCtl ();
|
||||
|
||||
// Owner-drawn control support function
|
||||
virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );
|
||||
|
||||
// Sets / Gets diffuse (ball) color.
|
||||
void SetDiffuseColor (COLORREF clr) { m_clrDiffuse = clr; Redraw (); }
|
||||
COLORREF GetDiffuseColor () { return m_clrDiffuse; }
|
||||
|
||||
// Sets / Gets ambient (background) color.
|
||||
void SetAmbientColor (COLORREF clr) { m_clrAmbient = clr; Redraw (); }
|
||||
COLORREF GetAmbientColor () { return m_clrAmbient; }
|
||||
|
||||
// Sets / Gets light color.
|
||||
void SetLightColor (COLORREF clr) { m_clrLight = clr; Redraw (); }
|
||||
COLORREF GetLightColor () { return m_clrLight; }
|
||||
|
||||
// Sets background gradient color (from start to finish vertically)
|
||||
void SetBackgroundColor (COLORREF clrStart, COLORREF clrEnd);
|
||||
|
||||
// Sets a background bitmap (resource ID)
|
||||
BOOL SetBackgroundImage (UINT uBackgroundBitmapID);
|
||||
|
||||
// Sets / Gets specular intensity
|
||||
BOOL SetSpecularExponent (double dExp);
|
||||
double GetSpecularExponent () { return m_dSpecularExponent; }
|
||||
|
||||
// Enables auto-update of axis controls.
|
||||
// Place the control's ID and the SetWindowText function will be called
|
||||
// for each vector component to display the value in the control.
|
||||
void SetAxisControl (int nXCtl, int nYCtl, int nZCtl);
|
||||
|
||||
// Sets / Gets ball radius (in pixels)
|
||||
void SetRadius (UINT uRadius);
|
||||
UINT GetRadius () { return UINT(m_iRadius); }
|
||||
|
||||
// Sets / Gets ball position (in pixels)
|
||||
void SetCenter (UINT uHorizPos, UINT uVertPos);
|
||||
UINT GetHorizCenter () { return UINT(m_iXCenter); }
|
||||
UINT GetVertCenter () { return UINT(m_iYCenter); }
|
||||
|
||||
// Sets / Gets vector components
|
||||
void SetX (double dx) { SetAxis (dx, 0); }
|
||||
double GetX() { return m_dVec[0]; }
|
||||
void SetY (double dy) { SetAxis (dy, 1); }
|
||||
double GetY() { return m_dVec[1]; }
|
||||
void SetZ (double dz) { SetAxis (dz, 2); }
|
||||
double GetZ() { return m_dVec[2]; }
|
||||
void SetVector (double dx, double dy, double dz);
|
||||
void SetidAxis( const idMat3 &mat ) {
|
||||
rotationMatrix = mat;
|
||||
rotationQuat = mat.ToQuat();
|
||||
m_dVec = mat[2];
|
||||
}
|
||||
|
||||
// Sets / Gets mouse sensitivity
|
||||
BOOL SetSensitivity (UINT uSens);
|
||||
UINT GetSensitivity () { return UINT(m_dSensitivity); }
|
||||
|
||||
// Bounds / Unbounds vector to front (positive Z) only
|
||||
void ClipToFront (BOOL bEnable) { m_bFrontVector = bEnable; }
|
||||
|
||||
// Set user-defined callback function to call whenever the vector has changed.
|
||||
// Set to NULL to disable callback.
|
||||
void SetVectorChangingCallback (VectorCtlCallbackProc proc)
|
||||
{ m_procVectorChanging = proc; }
|
||||
|
||||
// Set user-defined callback function to call whenever the vector has finished
|
||||
// changing (user dropped track-ball).
|
||||
// Set to NULL to disable callback.
|
||||
void SetVectorChangedCallback (VectorCtlCallbackProc proc)
|
||||
{ m_procVectorChanged = proc; }
|
||||
|
||||
private:
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
|
||||
// Mouse is being dragged
|
||||
void OnMouseDrag (int , int);
|
||||
// Create and measure off-screen buffer
|
||||
void InitBitmap (LPDRAWITEMSTRUCT lpDrawItemStruct, CDC *pDC);
|
||||
// Build image to BitBlt
|
||||
void BuildImage (LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||
// Free resources of background (non-ball) bitmap
|
||||
void ClearBackgroundBitmap ();
|
||||
// Normalize vector
|
||||
BOOL Normalize ();
|
||||
// Calculate lightning effect for a pixel on the ball
|
||||
COLORREF CalcLight (double dx, double dy, double dz);
|
||||
// Rotate our vector by X and Y angles
|
||||
void RotateByXandY (double XRot, double YRot);
|
||||
// Create background image resource
|
||||
void CreateBackground ();
|
||||
// Force redraw of entire image
|
||||
void Redraw (BOOL bErase = FALSE);
|
||||
// Update user-defined vector components controls
|
||||
void UpdateAxisControls ();
|
||||
// Sets a specific vector component to a specific value
|
||||
void SetAxis (double d, int nAxis);
|
||||
|
||||
CBitmap m_bmpBuffer, // Buffer bitmap for BitBlt
|
||||
m_bmpBack; // Background image bitmap
|
||||
CDC m_dcMem; // Memory DC
|
||||
BOOL m_bBmpCreated, // Was the bitmap created ?
|
||||
m_bBackgroundBitmapUsed,// Are we using a background bitmap ?
|
||||
m_bImageChange, // Has the image changed ?
|
||||
m_bFrontVector, // Is the vector constrained to be facing front (positive Z) ?
|
||||
m_bHasFocus, // Does the control have the focus ?
|
||||
m_bSelected; // Is the control selected ?
|
||||
int m_iWidth, // Region width
|
||||
m_iHeight, // Region height
|
||||
m_iRadius, // Ball radius
|
||||
m_iSqrRadius, // Ball radius to the power of two
|
||||
m_iXCenter, // X center point
|
||||
m_iYCenter; // Y center point
|
||||
CBitmap *m_pOldBitmap; // Previously selected bitmap
|
||||
COLORREF m_clrDiffuse, // Ball diffusion color (self color)
|
||||
m_clrAmbient, // Ambient (background) color
|
||||
m_clrLight, // Color of light
|
||||
m_clrBackgroundStart, // Background color gradient start
|
||||
m_clrBackgroundEnd; // Background color gradient end
|
||||
CWnd *pCtl[3]; // Pointers to axis display controls
|
||||
double m_dSpecularExponent, // Specularity effect intensity
|
||||
m_dSensitivity; // The bigger the number the less sensitive the mouse gets
|
||||
// Valid ranges are 1..MAX_UINT
|
||||
idVec3 m_dVec; // Vector components
|
||||
idMat3 rotationMatrix; //
|
||||
idQuat rotationQuat;
|
||||
idQuat previousQuat;
|
||||
idVec3 lastPress;
|
||||
float radius;
|
||||
|
||||
|
||||
VectorCtlCallbackProc m_procVectorChanging,
|
||||
m_procVectorChanged;
|
||||
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
865
neo/tools/comafx/riched20.tlh
Normal file
865
neo/tools/comafx/riched20.tlh
Normal file
@@ -0,0 +1,865 @@
|
||||
// Created by Microsoft (R) C/C++ Compiler Version 14.00.50727.762 (d29fdb1b).
|
||||
//
|
||||
// c:\alienbrainwork\rage\build\win32\debug\intermediate\tools\riched20.tlh
|
||||
//
|
||||
// C++ source equivalent of Win32 type library riched20.dll
|
||||
// compiler-generated file created 06/14/07 at 10:58:45 - DO NOT EDIT!
|
||||
|
||||
#pragma once
|
||||
#pragma pack(push, 8)
|
||||
|
||||
#include <comdef.h>
|
||||
|
||||
namespace tom {
|
||||
|
||||
//
|
||||
// Forward references and typedefs
|
||||
//
|
||||
|
||||
struct __declspec(uuid("8cc497c9-a1df-11ce-8098-00aa0047be5d"))
|
||||
/* LIBID */ __tom;
|
||||
enum __MIDL___MIDL_itf_tom_0000_0001;
|
||||
struct __declspec(uuid("8cc497c0-a1df-11ce-8098-00aa0047be5d"))
|
||||
/* dual interface */ ITextDocument;
|
||||
struct __declspec(uuid("8cc497c1-a1df-11ce-8098-00aa0047be5d"))
|
||||
/* dual interface */ ITextSelection;
|
||||
struct __declspec(uuid("8cc497c2-a1df-11ce-8098-00aa0047be5d"))
|
||||
/* dual interface */ ITextRange;
|
||||
struct __declspec(uuid("8cc497c3-a1df-11ce-8098-00aa0047be5d"))
|
||||
/* dual interface */ ITextFont;
|
||||
struct __declspec(uuid("8cc497c4-a1df-11ce-8098-00aa0047be5d"))
|
||||
/* dual interface */ ITextPara;
|
||||
struct __declspec(uuid("8cc497c5-a1df-11ce-8098-00aa0047be5d"))
|
||||
/* dual interface */ ITextStoryRanges;
|
||||
struct __declspec(uuid("01c25500-4268-11d1-883a-3c8b00c10000"))
|
||||
/* dual interface */ ITextDocument2;
|
||||
struct __declspec(uuid("a3787420-4267-11d1-883a-3c8b00c10000"))
|
||||
/* interface */ ITextMsgFilter;
|
||||
struct _RemotableHandle;
|
||||
union __MIDL_IWinTypes_0009;
|
||||
typedef enum __MIDL___MIDL_itf_tom_0000_0001 tomConstants;
|
||||
typedef struct _RemotableHandle * wireHWND;
|
||||
typedef unsigned long UINT_PTR;
|
||||
typedef long LONG_PTR;
|
||||
|
||||
//
|
||||
// Smart pointer typedef declarations
|
||||
//
|
||||
|
||||
_COM_SMARTPTR_TYPEDEF(ITextFont, __uuidof(ITextFont));
|
||||
_COM_SMARTPTR_TYPEDEF(ITextPara, __uuidof(ITextPara));
|
||||
_COM_SMARTPTR_TYPEDEF(ITextRange, __uuidof(ITextRange));
|
||||
_COM_SMARTPTR_TYPEDEF(ITextSelection, __uuidof(ITextSelection));
|
||||
_COM_SMARTPTR_TYPEDEF(ITextStoryRanges, __uuidof(ITextStoryRanges));
|
||||
_COM_SMARTPTR_TYPEDEF(ITextDocument, __uuidof(ITextDocument));
|
||||
_COM_SMARTPTR_TYPEDEF(ITextDocument2, __uuidof(ITextDocument2));
|
||||
_COM_SMARTPTR_TYPEDEF(ITextMsgFilter, __uuidof(ITextMsgFilter));
|
||||
|
||||
//
|
||||
// Type library items
|
||||
//
|
||||
|
||||
enum __MIDL___MIDL_itf_tom_0000_0001
|
||||
{
|
||||
tomFalse = 0,
|
||||
tomTrue = -1,
|
||||
tomUndefined = -9999999,
|
||||
tomToggle = -9999998,
|
||||
tomAutoColor = -9999997,
|
||||
tomDefault = -9999996,
|
||||
tomSuspend = -9999995,
|
||||
tomResume = -9999994,
|
||||
tomApplyNow = 0,
|
||||
tomApplyLater = 1,
|
||||
tomTrackParms = 2,
|
||||
tomCacheParms = 3,
|
||||
tomBackward = -1073741823,
|
||||
tomForward = 1073741823,
|
||||
tomMove = 0,
|
||||
tomExtend = 1,
|
||||
tomNoSelection = 0,
|
||||
tomSelectionIP = 1,
|
||||
tomSelectionNormal = 2,
|
||||
tomSelectionFrame = 3,
|
||||
tomSelectionColumn = 4,
|
||||
tomSelectionRow = 5,
|
||||
tomSelectionBlock = 6,
|
||||
tomSelectionInlineShape = 7,
|
||||
tomSelectionShape = 8,
|
||||
tomSelStartActive = 1,
|
||||
tomSelAtEOL = 2,
|
||||
tomSelOvertype = 4,
|
||||
tomSelActive = 8,
|
||||
tomSelReplace = 16,
|
||||
tomEnd = 0,
|
||||
tomStart = 32,
|
||||
tomCollapseEnd = 0,
|
||||
tomCollapseStart = 1,
|
||||
tomClientCoord = 256,
|
||||
tomNone = 0,
|
||||
tomSingle = 1,
|
||||
tomWords = 2,
|
||||
tomDouble = 3,
|
||||
tomDotted = 4,
|
||||
tomDash = 5,
|
||||
tomDashDot = 6,
|
||||
tomDashDotDot = 7,
|
||||
tomWave = 8,
|
||||
tomThick = 9,
|
||||
tomHair = 10,
|
||||
tomLineSpaceSingle = 0,
|
||||
tomLineSpace1pt5 = 1,
|
||||
tomLineSpaceDouble = 2,
|
||||
tomLineSpaceAtLeast = 3,
|
||||
tomLineSpaceExactly = 4,
|
||||
tomLineSpaceMultiple = 5,
|
||||
tomAlignLeft = 0,
|
||||
tomAlignCenter = 1,
|
||||
tomAlignRight = 2,
|
||||
tomAlignJustify = 3,
|
||||
tomAlignDecimal = 3,
|
||||
tomAlignBar = 4,
|
||||
tomAlignInterWord = 3,
|
||||
tomAlignInterLetter = 4,
|
||||
tomAlignScaled = 5,
|
||||
tomAlignGlyphs = 6,
|
||||
tomAlignSnapGrid = 7,
|
||||
tomSpaces = 0,
|
||||
tomDots = 1,
|
||||
tomDashes = 2,
|
||||
tomLines = 3,
|
||||
tomThickLines = 4,
|
||||
tomEquals = 5,
|
||||
tomTabBack = -3,
|
||||
tomTabNext = -2,
|
||||
tomTabHere = -1,
|
||||
tomListNone = 0,
|
||||
tomListBullet = 1,
|
||||
tomListNumberAsArabic = 2,
|
||||
tomListNumberAsLCLetter = 3,
|
||||
tomListNumberAsUCLetter = 4,
|
||||
tomListNumberAsLCRoman = 5,
|
||||
tomListNumberAsUCRoman = 6,
|
||||
tomListNumberAsSequence = 7,
|
||||
tomListParentheses = 65536,
|
||||
tomListPeriod = 131072,
|
||||
tomListPlain = 196608,
|
||||
tomCharacter = 1,
|
||||
tomWord = 2,
|
||||
tomSentence = 3,
|
||||
tomParagraph = 4,
|
||||
tomLine = 5,
|
||||
tomStory = 6,
|
||||
tomScreen = 7,
|
||||
tomSection = 8,
|
||||
tomColumn = 9,
|
||||
tomRow = 10,
|
||||
tomWindow = 11,
|
||||
tomCell = 12,
|
||||
tomCharFormat = 13,
|
||||
tomParaFormat = 14,
|
||||
tomTable = 15,
|
||||
tomObject = 16,
|
||||
tomMatchWord = 2,
|
||||
tomMatchCase = 4,
|
||||
tomMatchPattern = 8,
|
||||
tomUnknownStory = 0,
|
||||
tomMainTextStory = 1,
|
||||
tomFootnotesStory = 2,
|
||||
tomEndnotesStory = 3,
|
||||
tomCommentsStory = 4,
|
||||
tomTextFrameStory = 5,
|
||||
tomEvenPagesHeaderStory = 6,
|
||||
tomPrimaryHeaderStory = 7,
|
||||
tomEvenPagesFooterStory = 8,
|
||||
tomPrimaryFooterStory = 9,
|
||||
tomFirstPageHeaderStory = 10,
|
||||
tomFirstPageFooterStory = 11,
|
||||
tomNoAnimation = 0,
|
||||
tomLasVegasLights = 1,
|
||||
tomBlinkingBackground = 2,
|
||||
tomSparkleText = 3,
|
||||
tomMarchingBlackAnts = 4,
|
||||
tomMarchingRedAnts = 5,
|
||||
tomShimmer = 6,
|
||||
tomWipeDown = 7,
|
||||
tomWipeRight = 8,
|
||||
tomAnimationMax = 8,
|
||||
tomLowerCase = 0,
|
||||
tomUpperCase = 1,
|
||||
tomTitleCase = 2,
|
||||
tomSentenceCase = 4,
|
||||
tomToggleCase = 5,
|
||||
tomReadOnly = 256,
|
||||
tomShareDenyRead = 512,
|
||||
tomShareDenyWrite = 1024,
|
||||
tomPasteFile = 4096,
|
||||
tomCreateNew = 16,
|
||||
tomCreateAlways = 32,
|
||||
tomOpenExisting = 48,
|
||||
tomOpenAlways = 64,
|
||||
tomTruncateExisting = 80,
|
||||
tomRTF = 1,
|
||||
tomText = 2,
|
||||
tomHTML = 3,
|
||||
tomWordDocument = 4,
|
||||
tomBold = -2147483647,
|
||||
tomItalic = -2147483646,
|
||||
tomUnderline = -2147483644,
|
||||
tomStrikeout = -2147483640,
|
||||
tomProtected = -2147483632,
|
||||
tomLink = -2147483616,
|
||||
tomSmallCaps = -2147483584,
|
||||
tomAllCaps = -2147483520,
|
||||
tomHidden = -2147483392,
|
||||
tomOutline = -2147483136,
|
||||
tomShadow = -2147482624,
|
||||
tomEmboss = -2147481600,
|
||||
tomImprint = -2147479552,
|
||||
tomDisabled = -2147475456,
|
||||
tomRevised = -2147467264,
|
||||
tomNormalCaret = 0,
|
||||
tomKoreanBlockCaret = 1,
|
||||
tomIncludeInset = 1,
|
||||
tomIgnoreCurrentFont = 0,
|
||||
tomMatchFontCharset = 1,
|
||||
tomMatchFontSignature = 2,
|
||||
tomCharset = 0x80000000,
|
||||
tomRE10Mode = 1,
|
||||
tomNoIME = 524288,
|
||||
tomSelfIME = 262144
|
||||
};
|
||||
|
||||
struct __declspec(uuid("8cc497c3-a1df-11ce-8098-00aa0047be5d"))
|
||||
ITextFont : IDispatch
|
||||
{
|
||||
//
|
||||
// Raw methods provided by interface
|
||||
//
|
||||
|
||||
virtual HRESULT __stdcall get_Duplicate (
|
||||
/*[out,retval]*/ struct ITextFont * * ppFont ) = 0;
|
||||
virtual HRESULT __stdcall put_Duplicate (
|
||||
/*[in]*/ struct ITextFont * ppFont ) = 0;
|
||||
virtual HRESULT __stdcall CanChange (
|
||||
/*[out,retval]*/ long * pB ) = 0;
|
||||
virtual HRESULT __stdcall IsEqual (
|
||||
/*[in]*/ struct ITextFont * pFont,
|
||||
/*[out,retval]*/ long * pB ) = 0;
|
||||
virtual HRESULT __stdcall Reset (
|
||||
/*[in]*/ long Value ) = 0;
|
||||
virtual HRESULT __stdcall get_Style (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Style (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_AllCaps (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_AllCaps (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Animation (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Animation (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_BackColor (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_BackColor (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Bold (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Bold (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Emboss (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Emboss (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_ForeColor (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_ForeColor (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Hidden (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Hidden (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Engrave (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Engrave (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Italic (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Italic (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Kerning (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Kerning (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_LanguageID (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_LanguageID (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Name (
|
||||
/*[out,retval]*/ BSTR * pbstr ) = 0;
|
||||
virtual HRESULT __stdcall put_Name (
|
||||
/*[in]*/ BSTR pbstr ) = 0;
|
||||
virtual HRESULT __stdcall get_Outline (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Outline (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Position (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Position (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Protected (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Protected (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Shadow (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Shadow (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Size (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Size (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_SmallCaps (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_SmallCaps (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Spacing (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Spacing (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_StrikeThrough (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_StrikeThrough (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Subscript (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Subscript (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Superscript (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Superscript (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Underline (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Underline (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Weight (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Weight (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
};
|
||||
|
||||
struct __declspec(uuid("8cc497c4-a1df-11ce-8098-00aa0047be5d"))
|
||||
ITextPara : IDispatch
|
||||
{
|
||||
//
|
||||
// Raw methods provided by interface
|
||||
//
|
||||
|
||||
virtual HRESULT __stdcall get_Duplicate (
|
||||
/*[out,retval]*/ struct ITextPara * * ppPara ) = 0;
|
||||
virtual HRESULT __stdcall put_Duplicate (
|
||||
/*[in]*/ struct ITextPara * ppPara ) = 0;
|
||||
virtual HRESULT __stdcall CanChange (
|
||||
/*[out,retval]*/ long * pB ) = 0;
|
||||
virtual HRESULT __stdcall IsEqual (
|
||||
/*[in]*/ struct ITextPara * pPara,
|
||||
/*[out,retval]*/ long * pB ) = 0;
|
||||
virtual HRESULT __stdcall Reset (
|
||||
/*[in]*/ long Value ) = 0;
|
||||
virtual HRESULT __stdcall get_Style (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Style (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Alignment (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Alignment (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_Hyphenation (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Hyphenation (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_FirstLineIndent (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_KeepTogether (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_KeepTogether (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_KeepWithNext (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_KeepWithNext (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_LeftIndent (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_LineSpacing (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_LineSpacingRule (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_ListAlignment (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_ListAlignment (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_ListLevelIndex (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_ListLevelIndex (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_ListStart (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_ListStart (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_ListTab (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_ListTab (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_ListType (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_ListType (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_NoLineNumber (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_NoLineNumber (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_PageBreakBefore (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_PageBreakBefore (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_RightIndent (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_RightIndent (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall SetIndents (
|
||||
/*[in]*/ float StartIndent,
|
||||
/*[in]*/ float LeftIndent,
|
||||
/*[in]*/ float RightIndent ) = 0;
|
||||
virtual HRESULT __stdcall SetLineSpacing (
|
||||
/*[in]*/ long LineSpacingRule,
|
||||
/*[in]*/ float LineSpacing ) = 0;
|
||||
virtual HRESULT __stdcall get_SpaceAfter (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_SpaceAfter (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_SpaceBefore (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_SpaceBefore (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_WidowControl (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_WidowControl (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_TabCount (
|
||||
/*[out,retval]*/ long * pCount ) = 0;
|
||||
virtual HRESULT __stdcall AddTab (
|
||||
/*[in]*/ float tbPos,
|
||||
/*[in]*/ long tbAlign,
|
||||
/*[in]*/ long tbLeader ) = 0;
|
||||
virtual HRESULT __stdcall ClearAllTabs ( ) = 0;
|
||||
virtual HRESULT __stdcall DeleteTab (
|
||||
/*[in]*/ float tbPos ) = 0;
|
||||
virtual HRESULT __stdcall GetTab (
|
||||
/*[in]*/ long iTab,
|
||||
/*[out]*/ float * ptbPos,
|
||||
/*[out]*/ long * ptbAlign,
|
||||
/*[out]*/ long * ptbLeader ) = 0;
|
||||
};
|
||||
|
||||
struct __declspec(uuid("8cc497c2-a1df-11ce-8098-00aa0047be5d"))
|
||||
ITextRange : IDispatch
|
||||
{
|
||||
//
|
||||
// Raw methods provided by interface
|
||||
//
|
||||
|
||||
virtual HRESULT __stdcall get_Text (
|
||||
/*[out,retval]*/ BSTR * pbstr ) = 0;
|
||||
virtual HRESULT __stdcall put_Text (
|
||||
/*[in]*/ BSTR pbstr ) = 0;
|
||||
virtual HRESULT __stdcall get_Char (
|
||||
/*[out,retval]*/ long * pch ) = 0;
|
||||
virtual HRESULT __stdcall put_Char (
|
||||
/*[in]*/ long pch ) = 0;
|
||||
virtual HRESULT __stdcall get_Duplicate (
|
||||
/*[out,retval]*/ struct ITextRange * * ppRange ) = 0;
|
||||
virtual HRESULT __stdcall get_FormattedText (
|
||||
/*[out,retval]*/ struct ITextRange * * ppRange ) = 0;
|
||||
virtual HRESULT __stdcall put_FormattedText (
|
||||
/*[in]*/ struct ITextRange * ppRange ) = 0;
|
||||
virtual HRESULT __stdcall get_Start (
|
||||
/*[out,retval]*/ long * pcpFirst ) = 0;
|
||||
virtual HRESULT __stdcall put_Start (
|
||||
/*[in]*/ long pcpFirst ) = 0;
|
||||
virtual HRESULT __stdcall get_End (
|
||||
/*[out,retval]*/ long * pcpLim ) = 0;
|
||||
virtual HRESULT __stdcall put_End (
|
||||
/*[in]*/ long pcpLim ) = 0;
|
||||
virtual HRESULT __stdcall get_Font (
|
||||
/*[out,retval]*/ struct ITextFont * * pFont ) = 0;
|
||||
virtual HRESULT __stdcall put_Font (
|
||||
/*[in]*/ struct ITextFont * pFont ) = 0;
|
||||
virtual HRESULT __stdcall get_Para (
|
||||
/*[out,retval]*/ struct ITextPara * * pPara ) = 0;
|
||||
virtual HRESULT __stdcall put_Para (
|
||||
/*[in]*/ struct ITextPara * pPara ) = 0;
|
||||
virtual HRESULT __stdcall get_StoryLength (
|
||||
/*[out,retval]*/ long * pcch ) = 0;
|
||||
virtual HRESULT __stdcall get_StoryType (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall Collapse (
|
||||
/*[in]*/ long bStart ) = 0;
|
||||
virtual HRESULT __stdcall Expand (
|
||||
/*[in]*/ long Unit,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall GetIndex (
|
||||
/*[in]*/ long Unit,
|
||||
/*[out,retval]*/ long * pIndex ) = 0;
|
||||
virtual HRESULT __stdcall SetIndex (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Index,
|
||||
/*[in]*/ long Extend ) = 0;
|
||||
virtual HRESULT __stdcall SetRange (
|
||||
/*[in]*/ long cpActive,
|
||||
/*[in]*/ long cpOther ) = 0;
|
||||
virtual HRESULT __stdcall InRange (
|
||||
/*[in]*/ struct ITextRange * pRange,
|
||||
/*[out,retval]*/ long * pB ) = 0;
|
||||
virtual HRESULT __stdcall InStory (
|
||||
/*[in]*/ struct ITextRange * pRange,
|
||||
/*[out,retval]*/ long * pB ) = 0;
|
||||
virtual HRESULT __stdcall IsEqual (
|
||||
/*[in]*/ struct ITextRange * pRange,
|
||||
/*[out,retval]*/ long * pB ) = 0;
|
||||
virtual HRESULT __stdcall Select ( ) = 0;
|
||||
virtual HRESULT __stdcall StartOf (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Extend,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall EndOf (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Extend,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall Move (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveStart (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveEnd (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveWhile (
|
||||
/*[in]*/ VARIANT * Cset,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveStartWhile (
|
||||
/*[in]*/ VARIANT * Cset,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveEndWhile (
|
||||
/*[in]*/ VARIANT * Cset,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveUntil (
|
||||
/*[in]*/ VARIANT * Cset,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveStartUntil (
|
||||
/*[in]*/ VARIANT * Cset,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveEndUntil (
|
||||
/*[in]*/ VARIANT * Cset,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall FindShit (
|
||||
/*[in]*/ BSTR bstr,
|
||||
/*[in]*/ long cch,
|
||||
/*[in]*/ long Flags,
|
||||
/*[out,retval]*/ long * pLength ) = 0;
|
||||
virtual HRESULT __stdcall FindTextStart (
|
||||
/*[in]*/ BSTR bstr,
|
||||
/*[in]*/ long cch,
|
||||
/*[in]*/ long Flags,
|
||||
/*[out,retval]*/ long * pLength ) = 0;
|
||||
virtual HRESULT __stdcall FindTextEnd (
|
||||
/*[in]*/ BSTR bstr,
|
||||
/*[in]*/ long cch,
|
||||
/*[in]*/ long Flags,
|
||||
/*[out,retval]*/ long * pLength ) = 0;
|
||||
virtual HRESULT __stdcall Delete (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall Cut (
|
||||
/*[out]*/ VARIANT * pVar ) = 0;
|
||||
virtual HRESULT __stdcall Copy (
|
||||
/*[out]*/ VARIANT * pVar ) = 0;
|
||||
virtual HRESULT __stdcall Paste (
|
||||
/*[in]*/ VARIANT * pVar,
|
||||
/*[in]*/ long Format ) = 0;
|
||||
virtual HRESULT __stdcall CanPaste (
|
||||
/*[in]*/ VARIANT * pVar,
|
||||
/*[in]*/ long Format,
|
||||
/*[out,retval]*/ long * pB ) = 0;
|
||||
virtual HRESULT __stdcall CanEdit (
|
||||
/*[out,retval]*/ long * pbCanEdit ) = 0;
|
||||
virtual HRESULT __stdcall ChangeCase (
|
||||
/*[in]*/ long Type ) = 0;
|
||||
virtual HRESULT __stdcall GetPoint (
|
||||
/*[in]*/ long Type,
|
||||
/*[out]*/ long * px,
|
||||
/*[out]*/ long * py ) = 0;
|
||||
virtual HRESULT __stdcall SetPoint (
|
||||
/*[in]*/ long x,
|
||||
/*[in]*/ long y,
|
||||
/*[in]*/ long Type,
|
||||
/*[in]*/ long Extend ) = 0;
|
||||
virtual HRESULT __stdcall ScrollIntoView (
|
||||
/*[in]*/ long Value ) = 0;
|
||||
virtual HRESULT __stdcall GetEmbeddedObject (
|
||||
/*[out,retval]*/ IUnknown * * ppv ) = 0;
|
||||
};
|
||||
|
||||
struct __declspec(uuid("8cc497c1-a1df-11ce-8098-00aa0047be5d"))
|
||||
ITextSelection : ITextRange
|
||||
{
|
||||
//
|
||||
// Raw methods provided by interface
|
||||
//
|
||||
|
||||
virtual HRESULT __stdcall get_Flags (
|
||||
/*[out,retval]*/ long * pFlags ) = 0;
|
||||
virtual HRESULT __stdcall put_Flags (
|
||||
/*[in]*/ long pFlags ) = 0;
|
||||
virtual HRESULT __stdcall get_Type (
|
||||
/*[out,retval]*/ long * pType ) = 0;
|
||||
virtual HRESULT __stdcall MoveLeft (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Count,
|
||||
/*[in]*/ long Extend,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveRight (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Count,
|
||||
/*[in]*/ long Extend,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveUp (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Count,
|
||||
/*[in]*/ long Extend,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall MoveDown (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Count,
|
||||
/*[in]*/ long Extend,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall HomeKey (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Extend,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall EndKey (
|
||||
/*[in]*/ long Unit,
|
||||
/*[in]*/ long Extend,
|
||||
/*[out,retval]*/ long * pDelta ) = 0;
|
||||
virtual HRESULT __stdcall TypeText (
|
||||
/*[in]*/ BSTR bstr ) = 0;
|
||||
};
|
||||
|
||||
struct __declspec(uuid("8cc497c5-a1df-11ce-8098-00aa0047be5d"))
|
||||
ITextStoryRanges : IDispatch
|
||||
{
|
||||
//
|
||||
// Raw methods provided by interface
|
||||
//
|
||||
|
||||
virtual HRESULT __stdcall _NewEnum (
|
||||
/*[out,retval]*/ IUnknown * * ppunkEnum ) = 0;
|
||||
virtual HRESULT __stdcall Item (
|
||||
/*[in]*/ long Index,
|
||||
/*[out,retval]*/ struct ITextRange * * ppRange ) = 0;
|
||||
virtual HRESULT __stdcall get_Count (
|
||||
/*[out,retval]*/ long * pCount ) = 0;
|
||||
};
|
||||
|
||||
struct __declspec(uuid("8cc497c0-a1df-11ce-8098-00aa0047be5d"))
|
||||
ITextDocument : IDispatch
|
||||
{
|
||||
//
|
||||
// Raw methods provided by interface
|
||||
//
|
||||
|
||||
virtual HRESULT __stdcall get_Name (
|
||||
/*[out,retval]*/ BSTR * pName ) = 0;
|
||||
virtual HRESULT __stdcall get_Selection (
|
||||
/*[out,retval]*/ struct ITextSelection * * ppSel ) = 0;
|
||||
virtual HRESULT __stdcall get_StoryCount (
|
||||
/*[out,retval]*/ long * pCount ) = 0;
|
||||
virtual HRESULT __stdcall get_StoryRanges (
|
||||
/*[out,retval]*/ struct ITextStoryRanges * * ppStories ) = 0;
|
||||
virtual HRESULT __stdcall get_Saved (
|
||||
/*[out,retval]*/ long * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_Saved (
|
||||
/*[in]*/ long pValue ) = 0;
|
||||
virtual HRESULT __stdcall get_DefaultTabStop (
|
||||
/*[out,retval]*/ float * pValue ) = 0;
|
||||
virtual HRESULT __stdcall put_DefaultTabStop (
|
||||
/*[in]*/ float pValue ) = 0;
|
||||
virtual HRESULT __stdcall New ( ) = 0;
|
||||
virtual HRESULT __stdcall Open (
|
||||
/*[in]*/ VARIANT * pVar,
|
||||
/*[in]*/ long Flags,
|
||||
/*[in]*/ long CodePage ) = 0;
|
||||
virtual HRESULT __stdcall Save (
|
||||
/*[in]*/ VARIANT * pVar,
|
||||
/*[in]*/ long Flags,
|
||||
/*[in]*/ long CodePage ) = 0;
|
||||
virtual HRESULT __stdcall Freeze (
|
||||
/*[out,retval]*/ long * pCount ) = 0;
|
||||
virtual HRESULT __stdcall Unfreeze (
|
||||
/*[out,retval]*/ long * pCount ) = 0;
|
||||
virtual HRESULT __stdcall BeginEditCollection ( ) = 0;
|
||||
virtual HRESULT __stdcall EndEditCollection ( ) = 0;
|
||||
virtual HRESULT __stdcall Undo (
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * prop ) = 0;
|
||||
virtual HRESULT __stdcall Redo (
|
||||
/*[in]*/ long Count,
|
||||
/*[out,retval]*/ long * prop ) = 0;
|
||||
virtual HRESULT __stdcall Range (
|
||||
/*[in]*/ long cp1,
|
||||
/*[in]*/ long cp2,
|
||||
/*[out,retval]*/ struct ITextRange * * ppRange ) = 0;
|
||||
virtual HRESULT __stdcall RangeFromPoint (
|
||||
/*[in]*/ long x,
|
||||
/*[in]*/ long y,
|
||||
/*[out,retval]*/ struct ITextRange * * ppRange ) = 0;
|
||||
};
|
||||
|
||||
struct __declspec(uuid("01c25500-4268-11d1-883a-3c8b00c10000"))
|
||||
ITextDocument2 : ITextDocument
|
||||
{
|
||||
//
|
||||
// Raw methods provided by interface
|
||||
//
|
||||
|
||||
virtual HRESULT __stdcall AttachMsgFilter (
|
||||
/*[in]*/ IUnknown * pFilter ) = 0;
|
||||
virtual HRESULT __stdcall SetEffectColor (
|
||||
/*[in]*/ long Index,
|
||||
/*[in]*/ unsigned long cr ) = 0;
|
||||
virtual HRESULT __stdcall GetEffectColor (
|
||||
/*[in]*/ long Index,
|
||||
/*[out]*/ unsigned long * pcr ) = 0;
|
||||
virtual HRESULT __stdcall get_CaretType (
|
||||
/*[out,retval]*/ long * pCaretType ) = 0;
|
||||
virtual HRESULT __stdcall put_CaretType (
|
||||
/*[in]*/ long pCaretType ) = 0;
|
||||
virtual HRESULT __stdcall GetImmContext (
|
||||
/*[out,retval]*/ long * pContext ) = 0;
|
||||
virtual HRESULT __stdcall ReleaseImmContext (
|
||||
/*[in]*/ long Context ) = 0;
|
||||
virtual HRESULT __stdcall GetPreferredFont (
|
||||
/*[in]*/ long cp,
|
||||
/*[in]*/ long CodePage,
|
||||
/*[in]*/ long Option,
|
||||
/*[in]*/ long curCodepage,
|
||||
/*[in]*/ long curFontSize,
|
||||
/*[out]*/ BSTR * pbstr,
|
||||
/*[out]*/ long * pPitchAndFamily,
|
||||
/*[out]*/ long * pNewFontSize ) = 0;
|
||||
virtual HRESULT __stdcall get_NotificationMode (
|
||||
/*[out,retval]*/ long * pMode ) = 0;
|
||||
virtual HRESULT __stdcall put_NotificationMode (
|
||||
/*[in]*/ long pMode ) = 0;
|
||||
virtual HRESULT __stdcall GetClientRect (
|
||||
/*[in]*/ long Type,
|
||||
/*[out]*/ long * pLeft,
|
||||
/*[out]*/ long * pTop,
|
||||
/*[out]*/ long * pRight,
|
||||
/*[out]*/ long * pBottom ) = 0;
|
||||
virtual HRESULT __stdcall get_SelectionEx (
|
||||
/*[out,retval]*/ struct ITextSelection * * ppSel ) = 0;
|
||||
virtual HRESULT __stdcall GetWindow (
|
||||
/*[out]*/ long * phWnd ) = 0;
|
||||
virtual HRESULT __stdcall GetFEFlags (
|
||||
/*[out]*/ long * pFlags ) = 0;
|
||||
virtual HRESULT __stdcall UpdateWindow ( ) = 0;
|
||||
virtual HRESULT __stdcall CheckTextLimit (
|
||||
long cch,
|
||||
long * pcch ) = 0;
|
||||
virtual HRESULT __stdcall IMEInProgress (
|
||||
long Mode ) = 0;
|
||||
virtual HRESULT __stdcall SysBeep ( ) = 0;
|
||||
virtual HRESULT __stdcall Update (
|
||||
/*[in]*/ long Mode ) = 0;
|
||||
virtual HRESULT __stdcall Notify (
|
||||
/*[in]*/ long Notify ) = 0;
|
||||
};
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
union __MIDL_IWinTypes_0009
|
||||
{
|
||||
long hInproc;
|
||||
long hRemote;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
struct _RemotableHandle
|
||||
{
|
||||
long fContext;
|
||||
union __MIDL_IWinTypes_0009 u;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
struct __declspec(uuid("a3787420-4267-11d1-883a-3c8b00c10000"))
|
||||
ITextMsgFilter : IUnknown
|
||||
{
|
||||
//
|
||||
// Raw methods provided by interface
|
||||
//
|
||||
|
||||
virtual HRESULT __stdcall AttachDocument (
|
||||
/*[in]*/ wireHWND hwnd,
|
||||
/*[in]*/ struct ITextDocument2 * pTextDoc ) = 0;
|
||||
virtual HRESULT __stdcall HandleMessage (
|
||||
/*[in,out]*/ unsigned int * pmsg,
|
||||
/*[in,out]*/ UINT_PTR * pwparam,
|
||||
/*[in,out]*/ LONG_PTR * plparam,
|
||||
/*[out]*/ LONG_PTR * plres ) = 0;
|
||||
virtual HRESULT __stdcall AttachMsgFilter (
|
||||
/*[in]*/ struct ITextMsgFilter * pMsgFilter ) = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// Named GUID constants initializations
|
||||
//
|
||||
|
||||
extern "C" const GUID __declspec(selectany) LIBID_tom =
|
||||
{0x8cc497c9,0xa1df,0x11ce,{0x80,0x98,0x00,0xaa,0x00,0x47,0xbe,0x5d}};
|
||||
extern "C" const GUID __declspec(selectany) IID_ITextFont =
|
||||
{0x8cc497c3,0xa1df,0x11ce,{0x80,0x98,0x00,0xaa,0x00,0x47,0xbe,0x5d}};
|
||||
extern "C" const GUID __declspec(selectany) IID_ITextPara =
|
||||
{0x8cc497c4,0xa1df,0x11ce,{0x80,0x98,0x00,0xaa,0x00,0x47,0xbe,0x5d}};
|
||||
extern "C" const GUID __declspec(selectany) IID_ITextRange =
|
||||
{0x8cc497c2,0xa1df,0x11ce,{0x80,0x98,0x00,0xaa,0x00,0x47,0xbe,0x5d}};
|
||||
extern "C" const GUID __declspec(selectany) IID_ITextSelection =
|
||||
{0x8cc497c1,0xa1df,0x11ce,{0x80,0x98,0x00,0xaa,0x00,0x47,0xbe,0x5d}};
|
||||
extern "C" const GUID __declspec(selectany) IID_ITextStoryRanges =
|
||||
{0x8cc497c5,0xa1df,0x11ce,{0x80,0x98,0x00,0xaa,0x00,0x47,0xbe,0x5d}};
|
||||
extern "C" const GUID __declspec(selectany) IID_ITextDocument =
|
||||
{0x8cc497c0,0xa1df,0x11ce,{0x80,0x98,0x00,0xaa,0x00,0x47,0xbe,0x5d}};
|
||||
extern "C" const GUID __declspec(selectany) IID_ITextDocument2 =
|
||||
{0x01c25500,0x4268,0x11d1,{0x88,0x3a,0x3c,0x8b,0x00,0xc1,0x00,0x00}};
|
||||
extern "C" const GUID __declspec(selectany) IID_ITextMsgFilter =
|
||||
{0xa3787420,0x4267,0x11d1,{0x88,0x3a,0x3c,0x8b,0x00,0xc1,0x00,0x00}};
|
||||
|
||||
} // namespace tom
|
||||
|
||||
#pragma pack(pop)
|
||||
Reference in New Issue
Block a user