|
From: <mbe...@us...> - 2010-07-09 11:00:41
|
Revision: 829
http://scstudio.svn.sourceforge.net/scstudio/?rev=829&view=rev
Author: mbezdeka
Date: 2010-07-09 11:00:32 +0000 (Fri, 09 Jul 2010)
Log Message:
-----------
Message numbering:
- bugs fixed
- help image changed
Message snapping:
- added functionality
Modified Paths:
--------------
trunk/doc/help/frontend/pictures/message_numbering_autoenum_options.png
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
trunk/src/view/visio/addon/shapeutils.h
trunk/src/view/visio/addon/snapGlobalDlg.cpp
trunk/src/view/visio/addon/snapGlobalDlg.h
trunk/src/view/visio/addon/stdafx.h
Modified: trunk/doc/help/frontend/pictures/message_numbering_autoenum_options.png
===================================================================
(Binary files differ)
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-09 11:00:32 UTC (rev 829)
@@ -229,7 +229,7 @@
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "Enable message snapping",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
+ CONTROL "Enable message snapping",IDC_SNAP_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
END
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-09 11:00:32 UTC (rev 829)
@@ -30,6 +30,8 @@
#include "enumerationDlg.h"
#include "GlobalSettingsDlg.h"
+#include "messageSnapping.h"
+
#include <fstream>
#include "data/msc.h"
@@ -260,7 +262,8 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
- autoEnumerate(vsoShape);
+ autoEnumerate(vsoShape);
+ autoSnapping(vsoShape);
break;
case ST_COMMENT:
@@ -1442,8 +1445,6 @@
long undo_id = vsoApp->BeginUndoScope("DeleteNumbering");
- //int ID = CEnumerateUtils::getGroupCount(vsoApp);
-
//get all NUMBERED messages on the page
int numberedMessages = 0;
for(int i=1; i<=page->Shapes->Count; i++)
@@ -2132,4 +2133,17 @@
return 0;
}
+void CDocumentMonitor::autoSnapping(Visio::IVShapePtr msgShape)
+{
+ //Step 1: Check whether snapping is enabled
+ if(!CMessageSnapping::isEnabled())
+ return;
+ //Step 2: Get all instance matching criteria
+ std::vector<Visio::IVShapePtr> instShapes = CMessageSnapping::getIntersectInstances(msgShape);
+ //Step 3: Get the closest instance on the left and on the right
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst = CMessageSnapping::getClosestInstancePair(msgShape, instShapes);
+ //Step 4:Glue to them
+ CMessageSnapping::glueMsgToInstances(msgShape, closestInst.first, closestInst.second);
+}
+
// $Id$
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/document.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -25,9 +25,11 @@
#include "data/simulator.h"
#include "data/transformer.h"
#include "enums.h"
+
#include "pageutils.h"
#include "shapeutils.h"
#include "enumerateUtils.h"
+
#include "addon.h"
//! template used to create new documents
@@ -335,6 +337,10 @@
public:
Visio::IVUIObjectPtr GetMostCustomMenus();
Visio::IVUIObjectPtr GetMostCustomToolbars();
+
+
+// Message snapping
+ void autoSnapping(Visio::IVShapePtr msgShape);
};
// $Id$
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-09 11:00:32 UTC (rev 829)
@@ -78,6 +78,12 @@
{
BOOL bResult = DoDataExchange(true);
+ if(!m_index.GetWindowTextLength())
+ {
+ MessageBox(_T("Starting index is empty!"), _T("Error"), MB_OK | MB_ICONERROR);
+ return 1;
+ }
+
BSTR temp = 0;
int index;
m_index.GetWindowText(temp);
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/resource.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -103,6 +103,7 @@
#define IDC_ADDITION_GLOBAL 277
#define IDC_STARTING_INDEX_GLOBAL 278
#define IDC_CHECK1 279
+#define IDC_SNAP_ENABLED 279
// Next default values for new objects
//
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-07-09 11:00:32 UTC (rev 829)
@@ -360,6 +360,10 @@
>
</File>
<File
+ RelativePath=".\messageSnapping.cpp"
+ >
+ </File>
+ <File
RelativePath=".\numberingGlobalDlg.cpp"
>
</File>
@@ -522,6 +526,10 @@
>
</File>
</Filter>
+ <File
+ RelativePath=".\messageSnapping.h"
+ >
+ </File>
</Files>
<Globals>
<Global
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -34,6 +34,9 @@
static double GetShapeEndX(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX]->Result[""]; }
static double GetShapeBeginY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[""]; }
static double GetShapeEndY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[""]; }
+
+ static double GetShapeCellProperty(Visio::IVShapePtr shape, const _bstr_t & propertyName, const _bstr_t & units)
+ { return shape->Cells[propertyName]->Result[units]; }
static void GlueBeginToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos);
static void GlueBeginToShape(Visio::IVShapePtr what, Visio::IVShapePtr where);
Modified: trunk/src/view/visio/addon/snapGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-09 11:00:32 UTC (rev 829)
@@ -18,15 +18,42 @@
#include "stdafx.h"
#include "snapGlobalDlg.h"
+#include "errors.h"
BOOL CSnapGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
{
+ LoadRegistryData();
+
+ //Move values in variables into controls
+ DoDataExchange(FALSE);
+
return TRUE;
}
int CSnapGlobalDlg::OnApply()
{
+ //Move values in controls to variables
+ if(!DoDataExchange(TRUE))
+ return PSNRET_INVALID;
+
+ SaveRegistryData();
+
return PSNRET_NOERROR;
}
+int CSnapGlobalDlg::LoadRegistryData()
+{
+ TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Loading options from registry"));
+ m_bSnapEnabled = GetRegistry<bool>(GetRegistryFolder(), NULL, _T("SnapEnabled"), false);
+ return 0;
+}
+
+int CSnapGlobalDlg::SaveRegistryData()
+{
+ TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Saving options to registry"));
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("SnapEnabled"), m_bSnapEnabled);
+ return 0;
+}
+
+
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/snapGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -24,6 +24,9 @@
#include <atlcrack.h>
#include <atlmisc.h>
+// include macro definition for registry folder
+#include "dllmodule.h"
+
class CSnapGlobalDlg:
public CPropertyPageImpl<CSnapGlobalDlg>,
public CWinDataExchange<CSnapGlobalDlg>
@@ -31,6 +34,7 @@
public:
enum { IDD = IDD_SNAP_GLOBAL };
+protected:
BEGIN_MSG_MAP(CSnapGlobalDlg)
MSG_WM_INITDIALOG(OnInitDialog)
CHAIN_MSG_MAP(CPropertyPageImpl<CSnapGlobalDlg>)
@@ -38,10 +42,15 @@
BEGIN_DDX_MAP(CSnapGlobalDlg)
+ DDX_CHECK(IDC_SNAP_ENABLED, m_bSnapEnabled);
END_DDX_MAP()
-protected:
+ int LoadRegistryData();
+ int SaveRegistryData();
+ //Member variables
+ bool m_bSnapEnabled;
+
public:
//Message handlers
BOOL OnInitDialog(HWND hWndFocus, LPARAM lParam);
@@ -49,6 +58,9 @@
//Property page notification handlers (override method)
int OnApply();
+ //Registry folder
+ const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageSnapping"); }
+
};
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/stdafx.h
===================================================================
--- trunk/src/view/visio/addon/stdafx.h 2010-07-07 20:36:49 UTC (rev 828)
+++ trunk/src/view/visio/addon/stdafx.h 2010-07-09 11:00:32 UTC (rev 829)
@@ -42,6 +42,18 @@
#include <atlbase.h>
#include <atlapp.h>
+
+// adding common controls manifest to get XP look
+#if defined _M_IX86
+ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_IA64
+ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+ #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+
// Import the Visio type library with named GUIDs for the type library entries.
// The namespace is "Visio".
#import "Visio.tlb" named_guids
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|