[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : phil
Repository : xara
Revision : 717
Date : Mon Mar 27 14:57:21 BST 2006
Changed paths:
M /Trunk/XaraLX/tools/blnktool.cpp
M /Trunk/XaraLX/tools/blnktool.h
Updated Blank Tool template source code
Diff:
Index: Trunk/XaraLX/tools/blnktool.h
===================================================================
--- Trunk/XaraLX/tools/blnktool.h (revision 716)
+++ Trunk/XaraLX/tools/blnktool.h (revision 717)
@@ -141,27 +141,28 @@
BOOL GetStatusLineText(String_256* ptext, Spread* pSpread, DocCoord DocPos, ClickModifiers ClickMods);
// Some useful static functions
- static BlankInfoBarOp* GetBlankInfoBarOp() { return pBlankInfoBarOp; }
- static BOOL IsCurrentTool() { return CurrentTool; }
+ static BlankInfoBarOp* GetBlankInfoBarOp() { return s_pBlankInfoBarOp; }
+ static BOOL IsCurrentTool() { return s_bCurrentTool; }
private:
void DisplayStatusBarHelp(DocCoord DocPos, Spread* pSpread, ClickModifiers ClickMods);
void GetCurrentStatusText(String_256* ptext, Spread* pSpread, DocCoord DocPos, ClickModifiers ClickMods);
- BOOL CreateCursors(); // Create your tool's cursors in this func
- void DestroyCursors(); // Destroy your tool's cursors in this func
+ BOOL CreateCursors(); // Create your tool's cursors in this func
+ void DestroyCursors(); // Destroy your tool's cursors in this func
- static BOOL CurrentTool; // Can be useful to keep a "is my tool currenmt?" flag
- static BlankInfoBarOp* pBlankInfoBarOp; // Ptr to your tool's infobar
+ static BOOL s_bCurrentTool; // Can be useful to keep a "is my tool currenmt?" flag
+ static BlankInfoBarOp* s_pBlankInfoBarOp; // Ptr to your tool's infobar
- Cursor* pcNormalBlankCursor; // Your standard cursor to use when your tool becomes active
- Cursor* pcCurrentCursor; // The cursor your tool is currently displaying
- INT32 CurrentCursorID; // ID of the current cursor you're displaying
+ Cursor* m_pcNormalBlankCursor; // Your standard cursor to use when your tool becomes active
+ Cursor* m_pcCurrentCursor; // The cursor your tool is currently displaying
+ INT32 m_CurrentCursorID; // ID of the current cursor you're displaying
+
// Standard tool static vars
- static char* FamilyName; // The Tools Family Name
- static char* ToolName; // The Tool Name
- static char* Purpose; // What the tool is for
- static char* Author; // Who wrote it
+ static LPTSTR FamilyName; // The Tools Family Name
+ static LPTSTR ToolName; // The Tool Name
+ static LPTSTR Purpose; // What the tool is for
+ static LPTSTR Author; // Who wrote it
};
@@ -185,28 +186,17 @@
{
CC_DECLARE_DYNCREATE( BlankInfoBarOp )
public:
- BlankInfoBarOp() {}; // Dummy default constructor for DYNCREATE
+ BlankInfoBarOp(BlankTool* pTool=NULL)
+ {
+ m_pBlankTool = pTool;
+ DlgResID = _R(IDD_BLANKTOOLBAR);
+ }
MsgResult Message(Msg* Msg); // All messages to the info bar come through here
+
+private:
+ BlankTool* m_pBlankTool;
};
-/********************************************************************************************
-
-> class BlankInfoBarOpCreate : public BarCreate
-
- Author: Mark_Neves (Xara Group Ltd) <camelotdev@xxxxxxxx>
- Created: 3/10/94
- Purpose: Class for creating BlankInfoBarOps.
- Derived classes of BarCreate are used by DialogBarOp::ReadBarsFromFile()
-
-********************************************************************************************/
-
-class BlankInfoBarOpCreate : public BarCreate
-{
-public:
- DialogBarOp* Create() { return (new BlankInfoBarOp); }
-};
-
-
#endif // INC_BLANKTOOL
Index: Trunk/XaraLX/tools/blnktool.cpp
===================================================================
--- Trunk/XaraLX/tools/blnktool.cpp (revision 716)
+++ Trunk/XaraLX/tools/blnktool.cpp (revision 717)
@@ -121,14 +121,14 @@
#define new CAM_DEBUG_NEW
// These are still char* while we wait for resource technology to be developed for modules
-char* BlankTool::FamilyName = "Blank Tools";
-char* BlankTool::ToolName = "Blank Tool";
-char* BlankTool::Purpose = "Blank manipulation";
-char* BlankTool::Author = "Buster Gonad";
+LPTSTR BlankTool::FamilyName = _T("Blank Tools");
+LPTSTR BlankTool::ToolName = _T("Blank Tool");
+LPTSTR BlankTool::Purpose = _T("Blank manipulation");
+LPTSTR BlankTool::Author = _T("Buster");
// Init those other useful static vars
-BOOL BlankTool::CurrentTool = FALSE;
-BlankInfoBarOp* BlankTool::pBlankInfoBarOp = NULL;
+BOOL BlankTool::s_bCurrentTool = FALSE;
+BlankInfoBarOp* BlankTool::s_pBlankInfoBarOp = NULL;
/********************************************************************************************
@@ -144,7 +144,8 @@
BlankTool::BlankTool()
{
- pcCurrentCursor = NULL;
+ m_pcCurrentCursor = NULL;
+ m_pcNormalBlankCursor = NULL;
}
/********************************************************************************************
@@ -185,27 +186,8 @@
// after the infobar is successfully read and created.
if (ok)
{
- CCResTextFile file; // Resource File
- BlankInfoBarOpCreate BarCreate; // Object that creates BlankInfoBarOp objects
-
- ok = file.open(_R(IDM_BLANK_BAR), _R(IDT_INFO_BAR_RES)); // Open resource
- if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate); // Read and create info bar
- if (ok) file.close(); // Close resource
-
- ENSURE(ok,"Unable to load blankbar.ini from resource
");
-
- if (ok)
- {
- // Info bar now exists. Now get a pointer to it
- String_32 str = String_32("Blank info bar");
- DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
-
- ok = (pDialogBarOp != NULL);
- if (ok) ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(BlankInfoBarOp));
- if (ok) pBlankInfoBarOp = (BlankInfoBarOp*)pDialogBarOp;
-
- ENSURE(ok,"Error finding the blank tool info bar");
- }
+ s_pBlankInfoBarOp = new BlankInfoBarOp(this);
+ ERROR2IF(s_pBlankInfoBarOp==NULL, FALSE, "Can't create Blank tool Infobar");
}
return (ok);
@@ -228,10 +210,10 @@
********************************************************************************************/
-void BlankTool::Describe(void *InfoPtr)
+void BlankTool::Describe(void* InfoPtr)
{
// Cast structure into the latest one we understand.
- ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
+ ToolInfo_v1* Info = (ToolInfo_v1*) InfoPtr;
Info->InfoVersion = 1;
@@ -271,28 +253,28 @@
if (isSelected)
{
if (!CreateCursors()) return;
- CurrentCursorID = CursorStack::GPush(pcNormalBlankCursor, FALSE); // Push cursor but don't display now
- pcCurrentCursor = pcNormalBlankCursor;
+ m_CurrentCursorID = CursorStack::GPush(m_pcNormalBlankCursor, FALSE); // Push cursor but don't display now
+ m_pcCurrentCursor = m_pcNormalBlankCursor;
// This tool is now the current one
- CurrentTool = TRUE;
+ s_bCurrentTool = TRUE;
// Create and display the tool's info bar
- pBlankInfoBarOp->Create();
+ s_pBlankInfoBarOp->Create();
}
else
{
// Deselection - destroy the tool's cursors, if they exist.
- if (pcCurrentCursor != NULL)
+ if (m_pcCurrentCursor != NULL)
{
- CursorStack::GPop(CurrentCursorID);
- pcCurrentCursor = NULL;
- CurrentCursorID = 0;
+ CursorStack::GPop(m_CurrentCursorID);
+ m_pcCurrentCursor = NULL;
+ m_CurrentCursorID = 0;
}
DestroyCursors();
// Remove the info bar from view by deleting the actual underlying window
- pBlankInfoBarOp->Delete();
+ s_pBlankInfoBarOp->Delete();
// ensure any tool object blobs are removed.
BlobManager* BlobMgr = GetApplication()->GetBlobManager();
@@ -304,7 +286,7 @@
}
// No longer the current tool
- CurrentTool = FALSE;
+ s_bCurrentTool = FALSE;
}
}
@@ -325,9 +307,9 @@
BOOL BlankTool::CreateCursors()
{
// This tool has just been selected. Create the cursors.
- pcNormalBlankCursor = new Cursor(this, _R(IDC_BLANKTOOLCURSOR));
+ m_pcNormalBlankCursor = new Cursor(this, _R(IDCSR_BLANKTOOLDEFAULT));
- if ( pcNormalBlankCursor==NULL || !pcNormalBlankCursor->IsValid())
+ if ( m_pcNormalBlankCursor==NULL || !m_pcNormalBlankCursor->IsValid())
{
DestroyCursors();
return FALSE;
@@ -352,7 +334,7 @@
void BlankTool::DestroyCursors()
{
- if (pcNormalBlankCursor != NULL) delete pcNormalBlankCursor;
+ if (m_pcNormalBlankCursor != NULL) delete m_pcNormalBlankCursor;
}
/********************************************************************************************
@@ -458,7 +440,7 @@
void BlankTool::DisplayStatusBarHelp(DocCoord DocPos, Spread* pSpread, ClickModifiers ClickMods)
{
- String_256 StatusMsg("");
+ String_256 StatusMsg(_T(""));
// Get a string from the underlying help function and display it.
GetCurrentStatusText(&StatusMsg, pSpread, DocPos, ClickMods);
Xara