|
From: <ya...@us...> - 2008-12-15 06:50:10
|
Revision: 133
http://scstudio.svn.sourceforge.net/scstudio/?rev=133&view=rev
Author: yaplik
Date: 2008-12-15 06:50:06 +0000 (Mon, 15 Dec 2008)
Log Message:
-----------
[Visio]: Simple shapes list dump
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/scstudio.vcproj
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2008-12-15 06:43:13 UTC (rev 132)
+++ trunk/src/view/visio/addon/document.cpp 2008-12-15 06:50:06 UTC (rev 133)
@@ -21,6 +21,8 @@
#include "addon.h"
#include "document.h"
+#include "data/msc.h"
+
CDocumentMonitor::CDocumentMonitor(CStudioAddon *addon, Visio::IVDocumentPtr vsoDocument)
{
m_addon = addon;
@@ -88,6 +90,31 @@
if(!m_reportVisible)
ShowReportView(vsoApp);
+ Visio::IVDocumentPtr vsoDocument = vsoApp->GetActiveDocument();
+ Visio::IVPagePtr vsoPage = vsoApp->GetActivePage();
+ Visio::IVShapesPtr vsoShapes = vsoPage->GetShapes();
+
+ long cnt = vsoShapes->GetCount();
+
+ if (cnt > 0) {
+ Visio::IVShapePtr shape;
+ std::string s;
+
+ for (long i = 1; i < cnt; i++) {
+ shape = vsoShapes->GetItem(i);
+
+ s.erase();
+ s.append("Shape: ");
+ s.append(shape->GetName());
+ s.append("/");
+ s.append(shape->GetNameU());
+
+ m_reportView->Print(s);
+ }
+ } else {
+ m_reportView->Print("No Shapes detected");
+ }
+
m_reportView->Print("\\b No error detected.\\b0");
return VAORC_SUCCESS;
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2008-12-15 06:43:13 UTC (rev 132)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2008-12-15 06:50:06 UTC (rev 133)
@@ -22,7 +22,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories=""C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
+ AdditionalIncludeDirectories="..\..\..\;"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0500;_WINDOWS;_DEBUG;_USRDLL"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2008-12-17 11:21:52
|
Revision: 134
http://scstudio.svn.sourceforge.net/scstudio/?rev=134&view=rev
Author: gotthardp
Date: 2008-12-17 11:21:46 +0000 (Wed, 17 Dec 2008)
Log Message:
-----------
Integrated with scmsc.dll.
Added framework for Visio --> msc.h conversion.
Fixed functionality when add-on is executed when no document is open.
Still missing: Stencils and document templates. More testing needed before commit.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/src/view/visio/addon/extract.cpp
trunk/src/view/visio/addon/extract.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2008-12-15 06:50:06 UTC (rev 133)
+++ trunk/src/view/visio/addon/addon.cpp 2008-12-17 11:21:46 UTC (rev 134)
@@ -37,7 +37,7 @@
#include <Addsink.cpp>
const int MIN_VISIO_VERSION = 11;
-const _bstr_t VST_FILE_NAME = _T("Flowchart (VSL).vst");
+const _bstr_t VST_FILE_NAME = _T("MSC.vtx");
CStudioAddon scstudio(_T(ADDON_NAME), IDS_ADDON_NAME);
@@ -151,24 +151,10 @@
// when no document is active
if(vsoDocument == NULL)
- {
- // open a new document based on the add-on template
- _bstr_t bstrVSTName = GetVisioModulePath();
- bstrVSTName += VST_FILE_NAME;
+ vsoDocument = vsoApp->GetDocuments()->Add(VST_FILE_NAME);
- // check if template file exists
- _tfinddata_t stFileInfo;
- TCHAR * pszVSTName = (TCHAR *)bstrVSTName;
- if (_tfindfirst(pszVSTName, &stFileInfo) == -1)
- {
- DisplayException(vsoApp,
- bstrVSTName + LoadStringResource(IDS_ERROR_FILE_NOT_EXISTS), MB_OK);
- return VAORC_FAILURE;
- }
+ RegisterPersistentEvents(vsoDocument);
- vsoDocument = vsoApp->GetDocuments()->Add(bstrVSTName);
- }
-
CDocumentMonitor *pDocumentMonitor = GetDocumentMonitor(vsoApp, vsoDocument);
return VAORC_SUCCESS;
}
@@ -192,18 +178,22 @@
{
OPT_VISIO,
OPT_EVENT,
+ OPT_EVENTID,
OPT_DOC,
OPT_PAGE,
- OPT_SHAPE
+ OPT_SHAPE,
+ OPT_SHAPEU
};
static CSimpleOpt::SOption const long_options[] =
{
{ OPT_VISIO, _T("-visio"), SO_REQ_CMB },
{ OPT_EVENT, _T("-event"), SO_REQ_CMB },
+ { OPT_EVENTID, _T("-eventid"), SO_REQ_CMB },
{ OPT_DOC, _T("-doc"), SO_REQ_CMB },
{ OPT_PAGE, _T("-page"), SO_REQ_CMB },
{ OPT_SHAPE, _T("-shape"), SO_REQ_CMB },
+ { OPT_SHAPEU, _T("-shapeu"), SO_REQ_CMB },
SO_END_OF_OPTIONS
};
@@ -248,10 +238,16 @@
}
free(cmdline);
+ RegisterPersistentEvents(vsoDocument);
+
CDocumentMonitor *pDocumentMonitor = GetDocumentMonitor(vsoApp, vsoDocument);
// execute the relevant event handler
switch(iEvent)
{
+ case 1: // DocumentCreate
+ case 2: // DocumentOpen
+ return VAORC_SUCCESS;
+
// to keep the stencil compatibility, the 1xx events must not be renumbered
case 100:
TRACE("CStudioAddon::Run() stencil event 'OnDrop'");
@@ -326,8 +322,25 @@
break;
case visEvtConnectionsAdded:
+ {
TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsAdded");
+/*
+ Visio::IVConnectsPtr vsoConnects = pSubjectObj;
+ int k = vsoConnects->Count;
+ for(int i = 1; i <= vsoConnects->Count; i++)
+ {
+ Visio::IVConnectPtr vsoConnect = vsoConnects->Item[i];
+ if(vsoConnect == NULL || vsoConnect->ToCell->Error != 0)
+ continue;
+
+ _bstr_t text = vsoConnect->ToCell->LocalName;
+ _bstr_t form = vsoConnect->ToCell->Formula;
+ double val = vsoConnect->ToCell->ResultIU;
+ vsoConnect->ToCell->Formula = text;
+ }
+*/
break;
+ }
case visEvtConnectionsDeleted:
TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsDeleted");
@@ -340,12 +353,43 @@
return NOERROR;
}
- catch (_com_error &) // catch exceptions thrown by Visio
+ catch (_com_error &err) // catch exceptions thrown by Visio
{
+ _bstr_t message = err.Description();
return E_FAIL;
}
}
+void CStudioAddon::RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument)
+{
+ Visio::IVEventPtr vsoDocumentCreateEvent = NULL;
+ Visio::IVEventPtr vsoDocumentOpenEvent = NULL;
+
+ Visio::IVEventListPtr vsoDocumentEventList = vsoDocument->EventList;
+ for(int i = 1; i <= vsoDocumentEventList->Count; i++)
+ {
+ Visio::IVEventPtr vsoEvent = vsoDocumentEventList->Item[i];
+
+ if(vsoEvent == NULL || vsoEvent->Action != visActCodeRunAddon)
+ continue;
+
+ _bstr_t aa = vsoEvent->Target;
+ if(vsoEvent != NULL && _tcscmp(vsoEvent->Target, _T(ADDON_NAME)) == 0)
+ {
+ if(vsoEvent->Event == visEvtCodeDocCreate)
+ vsoDocumentCreateEvent = vsoEvent;
+ else if(vsoEvent->Event == visEvtCodeDocOpen)
+ vsoDocumentOpenEvent = vsoEvent;
+ }
+ }
+
+ if(vsoDocumentCreateEvent == NULL)
+ vsoDocumentCreateEvent = vsoDocumentEventList->Add(visEvtCodeDocCreate, visActCodeRunAddon, ADDON_NAME, ""); // event=1
+
+ if(vsoDocumentOpenEvent == NULL)
+ vsoDocumentOpenEvent = vsoDocumentEventList->Add(visEvtCodeDocOpen, visActCodeRunAddon, ADDON_NAME, ""); // event=2
+}
+
CDocumentMonitor *CStudioAddon::GetDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
{
CDocumentMonitor *pDocumentMonitor = NULL;
@@ -396,8 +440,8 @@
vsoEvent = vsoDocumentEventList->AddAdvise(visEvtBeforeDocumentClose, varSink, _T(""), _T(""));
pDocumentMonitor->m_vsoBeforeDocumentClosedEvent = vsoEvent;
- vsoDocumentEventList->AddAdvise(visEvtConnectionsAdded, varSink, _T(""), _T(""));
- vsoDocumentEventList->AddAdvise(visEvtConnectionsDeleted, varSink, _T(""), _T(""));
+ vsoDocumentEventList->AddAdvise(visEvtConnectionsAdded, varSink, _T(""), _T("ConnectionsAdded"));
+ vsoDocumentEventList->AddAdvise(visEvtConnectionsDeleted, varSink, _T(""), _T("ConnectionsDeleted"));
// add this document to our monitored documents list
m_DocumentMonitors.insert(DocumentMonitorsMap::value_type(nID, pDocumentMonitor));
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2008-12-15 06:50:06 UTC (rev 133)
+++ trunk/src/view/visio/addon/addon.h 2008-12-17 11:21:46 UTC (rev 134)
@@ -46,6 +46,7 @@
VARIANT vMoreInfo, // [in] other info
VARIANT *pvResult); // [retval][out] return a value to Visio for query events
+ void RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument);
CDocumentMonitor *GetDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
void StopDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2008-12-15 06:50:06 UTC (rev 133)
+++ trunk/src/view/visio/addon/dllmodule.rc 2008-12-17 11:21:46 UTC (rev 134)
@@ -102,7 +102,6 @@
BEGIN
IDS_ADDON_NAME "Sequence Chart Studio"
IDS_ERROR_VISIO_VERSION "This application requires Microsoft Office Visio 2003 or later."
- IDS_ERROR_FILE_NOT_EXISTS " does not exist."
IDS_VSL_NAME "msc.vsl"
IDS_REPORT_VIEW "Verification Report"
END
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2008-12-15 06:50:06 UTC (rev 133)
+++ trunk/src/view/visio/addon/document.cpp 2008-12-17 11:21:46 UTC (rev 134)
@@ -20,6 +20,7 @@
#include "dllmodule.h"
#include "addon.h"
#include "document.h"
+#include "extract.h"
#include "data/msc.h"
@@ -90,34 +91,28 @@
if(!m_reportVisible)
ShowReportView(vsoApp);
- Visio::IVDocumentPtr vsoDocument = vsoApp->GetActiveDocument();
Visio::IVPagePtr vsoPage = vsoApp->GetActivePage();
- Visio::IVShapesPtr vsoShapes = vsoPage->GetShapes();
-
- long cnt = vsoShapes->GetCount();
- if (cnt > 0) {
- Visio::IVShapePtr shape;
- std::string s;
+ TDrawingType type = get_drawing_type(m_reportView, vsoPage);
+ if(type == DT_BMSC)
+ {
+ m_reportView->Print("Detected bMSC drawing.");
- for (long i = 1; i < cnt; i++) {
- shape = vsoShapes->GetItem(i);
-
- s.erase();
- s.append("Shape: ");
- s.append(shape->GetName());
- s.append("/");
- s.append(shape->GetNameU());
-
- m_reportView->Print(s);
- }
- } else {
- m_reportView->Print("No Shapes detected");
+ BMscPtr bmsc = extract_bmsc(m_reportView, vsoPage);
+ return VAORC_SUCCESS;
}
-
- m_reportView->Print("\\b No error detected.\\b0");
+ else if(type == DT_HMSC)
+ {
+ m_reportView->Print("Detected hMSC drawing.");
- return VAORC_SUCCESS;
+ BMscPtr hmsc = extract_hmsc(m_reportView, vsoPage);
+ return VAORC_SUCCESS;
+ }
+ else
+ {
+ m_reportView->Print("\\b This drawing is neither bMSC nor hMSC.\\b0");
+ return VAORC_FAILURE;
+ }
}
VAORC CDocumentMonitor::OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp)
Added: trunk/src/view/visio/addon/extract.cpp
===================================================================
--- trunk/src/view/visio/addon/extract.cpp (rev 0)
+++ trunk/src/view/visio/addon/extract.cpp 2008-12-17 11:21:46 UTC (rev 134)
@@ -0,0 +1,70 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "extract.h"
+
+TDrawingType get_drawing_type(CReportView *reporter, Visio::IVPagePtr vsoPage)
+{
+ return DT_UNKNOWN;
+}
+
+BMscPtr extract_bmsc(CReportView *reporter, Visio::IVPagePtr vsoPage)
+{
+ BMscPtr bmsc = new BMsc();
+
+ Visio::IVShapesPtr vsoShapes = vsoPage->GetShapes();
+
+ long cnt = vsoShapes->GetCount();
+
+ if (cnt > 0) {
+ Visio::IVShapePtr shape;
+ std::string s;
+
+ for (long i = 1; i < cnt; i++) {
+ shape = vsoShapes->GetItem(i);
+
+ s.erase();
+ s.append("Shape: ");
+ s.append(shape->GetName());
+ s.append("/");
+ s.append(shape->GetNameU());
+
+ reporter->Print(s);
+ }
+ } else {
+ reporter->Print("No Shapes detected");
+ }
+
+ reporter->Print("\\b No error detected.\\b0");
+
+ return bmsc;
+
+ return (BMsc *)NULL;
+}
+
+HMscPtr extract_hmsc(CReportView *reporter, Visio::IVPagePtr vsoPage)
+{
+ HMscPtr hmsc = new HMsc();
+
+ return hmsc;
+
+ return (HMsc *)NULL;
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/extract.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/extract.h
===================================================================
--- trunk/src/view/visio/addon/extract.h (rev 0)
+++ trunk/src/view/visio/addon/extract.h 2008-12-17 11:21:46 UTC (rev 134)
@@ -0,0 +1,38 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2008 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#pragma once
+#include "reportview.h"
+
+#include "Vaddon.h"
+#include "data/msc.h"
+
+enum TDrawingType
+{
+ DT_UNKNOWN = 0,
+ DT_BMSC,
+ DT_HMSC
+};
+
+TDrawingType get_drawing_type(CReportView *reporter, Visio::IVPagePtr vsoPage);
+
+BMscPtr extract_bmsc(CReportView *reporter, Visio::IVPagePtr vsoPage);
+
+HMscPtr extract_hmsc(CReportView *reporter, Visio::IVPagePtr vsoPage);
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/extract.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2008-12-15 06:50:06 UTC (rev 133)
+++ trunk/src/view/visio/addon/resource.h 2008-12-17 11:21:46 UTC (rev 134)
@@ -5,9 +5,8 @@
#define IDS_ADDON_NAME 100
#define IDR_SCSTUDIO 101
#define IDS_ERROR_VISIO_VERSION 101
-#define IDS_ERROR_FILE_NOT_EXISTS 102
-#define IDS_VSL_NAME 103
-#define IDS_REPORT_VIEW 104
+#define IDS_VSL_NAME 102
+#define IDS_REPORT_VIEW 103
// Next default values for new objects
//
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2008-12-15 06:50:06 UTC (rev 133)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2008-12-17 11:21:46 UTC (rev 134)
@@ -22,11 +22,12 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\;"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
+ AdditionalIncludeDirectories="..\..\..\..\src;"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0500;_WINDOWS;_DEBUG;_USRDLL"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
+ RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
@@ -37,8 +38,10 @@
Name="VCLinkerTool"
RegisterOutput="TRUE"
IgnoreImportLibrary="TRUE"
+ AdditionalDependencies="scmsc.lib"
OutputFile="$(OutDir)\$(ProjectName).vsl"
LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\..\..\$(OutDir)"
ModuleDefinitionFile=".\dllmodule.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
@@ -92,9 +95,10 @@
<Tool
Name="VCCLCompilerTool"
Optimization="2"
- AdditionalIncludeDirectories=""C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
+ AdditionalIncludeDirectories="..\..\..\..\src;"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0500;_WINDOWS;NDEBUG;_USRDLL"
RuntimeLibrary="2"
+ RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
@@ -105,8 +109,10 @@
Name="VCLinkerTool"
RegisterOutput="TRUE"
IgnoreImportLibrary="TRUE"
+ AdditionalDependencies="scmsc.lib"
OutputFile="$(OutDir)\$(ProjectName).vsl"
LinkIncremental="1"
+ AdditionalLibraryDirectories="..\..\..\..\$(OutDir)"
ModuleDefinitionFile=".\dllmodule.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
@@ -206,6 +212,12 @@
</FileConfiguration>
</File>
<File
+ RelativePath=".\extract.cpp">
+ </File>
+ <File
+ RelativePath=".\extract.h">
+ </File>
+ <File
RelativePath=".\reportview.cpp">
</File>
<File
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2008-12-20 21:09:23
|
Revision: 135
http://scstudio.svn.sourceforge.net/scstudio/?rev=135&view=rev
Author: gotthardp
Date: 2008-12-20 21:09:16 +0000 (Sat, 20 Dec 2008)
Log Message:
-----------
Fixed the connection problem; dynamic connections are no longer repositioned when an instance is resized.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2008-12-17 11:21:46 UTC (rev 134)
+++ trunk/src/view/visio/addon/addon.cpp 2008-12-20 21:09:16 UTC (rev 135)
@@ -322,25 +322,9 @@
break;
case visEvtConnectionsAdded:
- {
TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsAdded");
-/*
- Visio::IVConnectsPtr vsoConnects = pSubjectObj;
- int k = vsoConnects->Count;
- for(int i = 1; i <= vsoConnects->Count; i++)
- {
- Visio::IVConnectPtr vsoConnect = vsoConnects->Item[i];
- if(vsoConnect == NULL || vsoConnect->ToCell->Error != 0)
- continue;
-
- _bstr_t text = vsoConnect->ToCell->LocalName;
- _bstr_t form = vsoConnect->ToCell->Formula;
- double val = vsoConnect->ToCell->ResultIU;
- vsoConnect->ToCell->Formula = text;
- }
-*/
+ HandleConnectionsAdded(pSubjectObj);
break;
- }
case visEvtConnectionsDeleted:
TRACE("CStudioAddon::HandleVisioEvent() visEvtConnectionsDeleted");
@@ -360,6 +344,30 @@
}
}
+void CStudioAddon::HandleConnectionsAdded(Visio::IVConnectsPtr vsoConnects)
+{
+ // dynamic connectors are positioned on Width*X
+ // connectors must not move when an instance is begin enlarged
+
+ // walk through added connectors and modify the positioning formula
+ for(int i = 1; i <= vsoConnects->Count; i++)
+ {
+ Visio::IVConnectPtr vsoConnect = vsoConnects->Item[i]; // added connector
+ if(vsoConnect == NULL)
+ continue;
+
+ // due to a bug in Visio 2003 the vsoConnect->ToCell->Formula is invalid
+ // workaround: we process all connectors on a given instance;
+ // the connector just being added is clearly one of them
+ Visio::IVConnectsPtr fromConnects = vsoConnect->ToCell->Shape->FromConnects;
+ for(int j = 1; j <= fromConnects->Count; j++)
+ {
+ Visio::IVConnectPtr fromConnect = fromConnects->Item[j];
+ fromConnect->ToCell->Formula = fromConnect->ToCell->ResultStr[visNoCast];
+ }
+ }
+}
+
void CStudioAddon::RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument)
{
Visio::IVEventPtr vsoDocumentCreateEvent = NULL;
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2008-12-17 11:21:46 UTC (rev 134)
+++ trunk/src/view/visio/addon/addon.h 2008-12-20 21:09:16 UTC (rev 135)
@@ -46,6 +46,8 @@
VARIANT vMoreInfo, // [in] other info
VARIANT *pvResult); // [retval][out] return a value to Visio for query events
+ void HandleConnectionsAdded(Visio::IVConnectsPtr vsoConnects);
+
void RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument);
CDocumentMonitor *GetDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
void StopDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-02-02 20:35:23
|
Revision: 186
http://scstudio.svn.sourceforge.net/scstudio/?rev=186&view=rev
Author: gotthardp
Date: 2009-02-02 20:35:18 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
Fixed zoom when displaying a counter-example. Improved reporting. Getting ready for release 0.2.0.
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/visualize.cpp
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2009-02-01 22:43:49 UTC (rev 185)
+++ trunk/src/view/visio/addon/dllmodule.rc 2009-02-02 20:35:18 UTC (rev 186)
@@ -72,8 +72,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,1,6,0
- PRODUCTVERSION 0,1,6,0
+ FILEVERSION 0,2,0,0
+ PRODUCTVERSION 0,2,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x9L
@@ -90,13 +90,13 @@
BEGIN
VALUE "CompanyName", "Masaryk University Brno"
VALUE "FileDescription", "Microsoft Visio add-on for design and verification of Message Sequence Charts (MSC)."
- VALUE "FileVersion", "0.1.6"
+ VALUE "FileVersion", "0.2.0"
VALUE "InternalName", "scstudio.vsl"
VALUE "LegalCopyright", "(c) Petr Gotthard. All rights reserved."
VALUE "OriginalFilename", "scstudio.vsl"
VALUE "PrivateBuild", "$Revision$"
VALUE "ProductName", "Sequence Chart Studio"
- VALUE "ProductVersion", "0.1.6"
+ VALUE "ProductVersion", "0.2.0"
END
END
BLOCK "VarFileInfo"
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2009-02-01 22:43:49 UTC (rev 185)
+++ trunk/src/view/visio/addon/document.cpp 2009-02-02 20:35:18 UTC (rev 186)
@@ -300,13 +300,13 @@
BMscPtr result = bmsc_checker->check(bmsc, srm);
if(result != NULL)
{
- m_reportView->Print(RS_ERROR, stringize()
+ m_reportView->Print(RS_ERROR, stringize() << vsoPage->Name << ": "
<< (*cpos)->get_description() << " violated.", result);
violated_count++;
}
else
{
- m_reportView->Print(RS_NOTICE, stringize()
+ m_reportView->Print(RS_NOTICE, stringize() << vsoPage->Name << ": "
<< (*cpos)->get_description() << " satisfied.");
satisfied_count++;
}
@@ -317,13 +317,13 @@
HMscPtr result = hmsc_checker->check(hmsc, srm);
if(result != NULL)
{
- m_reportView->Print(RS_ERROR, stringize()
+ m_reportView->Print(RS_ERROR, stringize() << vsoPage->Name << ": "
<< (*cpos)->get_description() << " violated.", result);
violated_count++;
}
else
{
- m_reportView->Print(RS_NOTICE, stringize()
+ m_reportView->Print(RS_NOTICE, stringize() << vsoPage->Name << ": "
<< (*cpos)->get_description() << " satisfied.");
satisfied_count++;
}
@@ -334,7 +334,7 @@
if(satisfied_count == 0 && violated_count == 0)
{
- m_reportView->Print(RS_NOTICE, stringize()
+ m_reportView->Print(RS_NOTICE, stringize() << vsoPage->Name << ": "
<< "No verification algorithms applicable. No properties verified.");
}
@@ -342,8 +342,8 @@
}
else
{
- m_reportView->Print(RS_NOTICE,
- stringize() << "Graphical error(s) in drawing '" << vsoPage->Name << "'");
+ m_reportView->Print(RS_NOTICE, stringize() << vsoPage->Name << ": "
+ << "Graphical error(s) in drawing. No properties verified.");
return VAORC_FAILURE;
}
}
Modified: trunk/src/view/visio/addon/visualize.cpp
===================================================================
--- trunk/src/view/visio/addon/visualize.cpp 2009-02-01 22:43:49 UTC (rev 185)
+++ trunk/src/view/visio/addon/visualize.cpp 2009-02-02 20:35:18 UTC (rev 186)
@@ -63,6 +63,13 @@
if(hmsc != NULL)
visualize_hmsc(vsoPage, hmsc);
+ m_vsoApp->ActiveWindow->Page = (IDispatch *)vsoPage;
+ double left, bottom, right, top;
+ vsoPage->BoundingBox(visTypePage, &left, &bottom, &right, &top);
+ // scroll to view the drawing
+ m_vsoApp->ActiveWindow->Zoom = 1;
+ m_vsoApp->ActiveWindow->ScrollViewTo((left+right)/2.0, (top+bottom)/2.0);
+
// the last dropped shape would be selected
m_vsoApp->ActiveWindow->DeselectAll();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-02-07 15:56:57
|
Revision: 192
http://scstudio.svn.sourceforge.net/scstudio/?rev=192&view=rev
Author: gotthardp
Date: 2009-02-07 15:56:51 +0000 (Sat, 07 Feb 2009)
Log Message:
-----------
Minor enhancement: Print error report when a DLL module cannot be loaded.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/dllmodule.cpp
trunk/src/view/visio/addon/dllmodule.h
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/errors.cpp
trunk/src/view/visio/addon/errors.h
trunk/src/view/visio/addon/reportview.h
trunk/src/view/visio/addon/visualize.cpp
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2009-02-05 23:03:27 UTC (rev 191)
+++ trunk/src/view/visio/addon/addon.cpp 2009-02-07 15:56:51 UTC (rev 192)
@@ -83,7 +83,7 @@
std::basic_string<TCHAR>::size_type uiPosition;
// Get the full path including the Addon name.
- GetModuleFileName(GetModuleHandle(LoadStringResource(IDS_VSL_NAME)),
+ GetModuleFileName(GetModuleHandle(LoadStringResource(IDS_VSL_NAME).c_str()),
szPath, sizeof(szPath) / sizeof(TCHAR));
// Extract the path name of the Addon.
Modified: trunk/src/view/visio/addon/dllmodule.cpp
===================================================================
--- trunk/src/view/visio/addon/dllmodule.cpp 2009-02-05 23:03:27 UTC (rev 191)
+++ trunk/src/view/visio/addon/dllmodule.cpp 2009-02-07 15:56:51 UTC (rev 192)
@@ -37,7 +37,7 @@
ATL::CStudioDllModule _AtlModule;
-_bstr_t LoadStringResource(UINT uiID)
+std::wstring LoadStringResource(UINT uiID)
{
// Get the module instance.
HINSTANCE hInstance = ATL::_AtlBaseModule.GetModuleInstance();
@@ -45,7 +45,7 @@
TCHAR szBuffer[100];
// Load the string from the string table.
LoadString(hInstance, uiID, szBuffer, sizeof(szBuffer) / sizeof(TCHAR));
- return _bstr_t(szBuffer);
+ return szBuffer;
}
std::wstring GetVersionInfo(const LPWSTR block)
Modified: trunk/src/view/visio/addon/dllmodule.h
===================================================================
--- trunk/src/view/visio/addon/dllmodule.h 2009-02-05 23:03:27 UTC (rev 191)
+++ trunk/src/view/visio/addon/dllmodule.h 2009-02-07 15:56:51 UTC (rev 192)
@@ -19,7 +19,7 @@
#pragma once
#include <string>
-_bstr_t LoadStringResource(UINT uiID);
+std::wstring LoadStringResource(UINT uiID);
std::wstring GetVersionInfo(const LPWSTR block);
// $Id$
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2009-02-05 23:03:27 UTC (rev 191)
+++ trunk/src/view/visio/addon/document.cpp 2009-02-07 15:56:51 UTC (rev 192)
@@ -141,58 +141,67 @@
valNameLength = cchMaxValue+1;
valDataLength = cbMaxValueData+1;
- if(RegEnumValue(hSubKey, i,
+ long res = RegEnumValue(hSubKey, i,
valName,
&valNameLength,
NULL,
&dwType,
(LPBYTE)valData,
- &valDataLength) == ERROR_SUCCESS)
+ &valDataLength);
+
+ if(res != ERROR_SUCCESS)
+ continue;
+
+ // open the extension module
+ HINSTANCE module = LoadLibrary(valData);
+ if(module == NULL)
{
- // open the extension module
- HINSTANCE module = LoadLibrary(valData);
- if(module == NULL)
- continue;
+ DisplayException(m_vsoApp, basic_stringize<TCHAR>()
+ << _T("Cannot load module '") << valData << _T("'"), MB_OK | MB_ICONEXCLAMATION);
+ continue;
+ }
- FInitFormatters init_formatters = (FInitFormatters)GetProcAddress(module, "init_formatters");
- FInitCheckers init_checkers = (FInitCheckers)GetProcAddress(module, "init_checkers");
- if(init_formatters == NULL && init_checkers == NULL)
- {
- // this is not our module
- FreeLibrary(module);
- }
+ FInitFormatters init_formatters = (FInitFormatters)GetProcAddress(module, "init_formatters");
+ FInitCheckers init_checkers = (FInitCheckers)GetProcAddress(module, "init_checkers");
+ if(init_formatters == NULL && init_checkers == NULL)
+ {
+ DisplayException(m_vsoApp, basic_stringize<TCHAR>()
+ << _T("Cannot open module '") << valData << _T("'"), MB_OK | MB_ICONEXCLAMATION);
+ // this is not our module
+ FreeLibrary(module);
+ continue;
+ }
- if(init_formatters != NULL)
+ if(init_formatters != NULL)
+ {
+ Formatter **formatters = init_formatters();
+ // append new formatters to the list
+ for(Formatter **fpos = formatters; *fpos != NULL; fpos++)
{
- Formatter **formatters = init_formatters();
- // append new formatters to the list
- for(Formatter **fpos = formatters; *fpos != NULL; fpos++)
- {
- boost::shared_ptr<Formatter> formatter(*fpos);
- m_formatters.push_back(formatter);
- }
- // delete the array
- // note: the formatters are managed by the boost:shared_ptr
- delete[] formatters;
+ boost::shared_ptr<Formatter> formatter(*fpos);
+ m_formatters.push_back(formatter);
}
+ // delete the array
+ // note: the formatters are managed by the boost:shared_ptr
+ delete[] formatters;
+ }
- if(init_checkers != NULL)
+ if(init_checkers != NULL)
+ {
+ Checker **checkers = init_checkers();
+ // append new checkers to the list
+ for(Checker **fpos = checkers; *fpos != NULL; fpos++)
{
- Checker **checkers = init_checkers();
- // append new checkers to the list
- for(Checker **fpos = checkers; *fpos != NULL; fpos++)
- {
- boost::shared_ptr<Checker> checker(*fpos);
- m_checkers.push_back(checker);
- }
- // delete the array
- // note: the checkers are managed by the boost:shared_ptr
- delete[] checkers;
+ boost::shared_ptr<Checker> checker(*fpos);
+ m_checkers.push_back(checker);
}
+ // delete the array
+ // note: the checkers are managed by the boost:shared_ptr
+ delete[] checkers;
+ }
- // keep the pointer to properly unload the module
- m_open_modules.push_back(module);
- }
+ // keep the pointer to properly unload the module
+ m_open_modules.push_back(module);
}
delete[] valName;
@@ -662,7 +671,7 @@
const int defWidth = 500;
const int defHeight = 150;
- m_reportWindow = vsoWindow->Windows->Add(LoadStringResource(IDS_REPORT_VIEW),
+ m_reportWindow = vsoWindow->Windows->Add(LoadStringResource(IDS_REPORT_VIEW).c_str(),
Visio::visWSVisible | Visio::visWSAnchorLeft, Visio::visAnchorBarAddon, 1, 1, defWidth, defHeight);
LoadLibrary(CRichEditCtrl::GetLibraryName());
Modified: trunk/src/view/visio/addon/errors.cpp
===================================================================
--- trunk/src/view/visio/addon/errors.cpp 2009-02-05 23:03:27 UTC (rev 191)
+++ trunk/src/view/visio/addon/errors.cpp 2009-02-07 15:56:51 UTC (rev 192)
@@ -23,14 +23,14 @@
#include <string>
void DisplayException(Visio::IVApplicationPtr vsoApp,
- const _bstr_t& bstrMessage, UINT nFlags)
+ const std::wstring& bstrMessage, UINT nFlags)
{
if (vsoApp->GetAlertResponse() == 0)
{
- MessageBox(GetActiveWindow(), bstrMessage, LoadStringResource(IDS_ADDON_NAME), nFlags);
+ MessageBox(GetActiveWindow(), bstrMessage.c_str(), LoadStringResource(IDS_ADDON_NAME).c_str(), nFlags);
}
else
- OutputDebugString(bstrMessage);
+ OutputDebugString(bstrMessage.c_str());
}
// $Id$
Modified: trunk/src/view/visio/addon/errors.h
===================================================================
--- trunk/src/view/visio/addon/errors.h 2009-02-05 23:03:27 UTC (rev 191)
+++ trunk/src/view/visio/addon/errors.h 2009-02-07 15:56:51 UTC (rev 192)
@@ -32,6 +32,6 @@
#endif
void DisplayException(Visio::IVApplicationPtr vsoApp,
- const _bstr_t& bstrMessage, UINT nFlags);
+ const std::wstring& bstrMessage, UINT nFlags);
// $Id$
Modified: trunk/src/view/visio/addon/reportview.h
===================================================================
--- trunk/src/view/visio/addon/reportview.h 2009-02-05 23:03:27 UTC (rev 191)
+++ trunk/src/view/visio/addon/reportview.h 2009-02-07 15:56:51 UTC (rev 192)
@@ -60,25 +60,28 @@
/*!
* reporter->Print(stringize() << "string" << number);
*/
-struct stringize
+template<typename C>
+struct basic_stringize
{
- template< typename T >
- stringize & operator << (T const& t)
+ template<typename T>
+ basic_stringize<C> & operator << (T const& t)
{
m_s << t;
return *this;
}
// note: must not return reference
- operator const std::string() const
+ operator const std::basic_string<C>() const
{
return m_s.str();
}
private:
- std::stringstream m_s;
+ std::basic_stringstream<C> m_s;
};
+typedef basic_stringize<char> stringize;
+
struct shapelist
{
shapelist & operator << (Visio::IVShapePtr shape)
Modified: trunk/src/view/visio/addon/visualize.cpp
===================================================================
--- trunk/src/view/visio/addon/visualize.cpp 2009-02-05 23:03:27 UTC (rev 191)
+++ trunk/src/view/visio/addon/visualize.cpp 2009-02-07 15:56:51 UTC (rev 192)
@@ -49,7 +49,7 @@
}
catch (_com_error&)
{
- DisplayException(vsoApp, "Bad template or stencils. Visualization failed.", MB_OK);
+ DisplayException(vsoApp, _T("Bad template or stencils. Visualization failed."), MB_OK);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-03-07 10:41:58
|
Revision: 199
http://scstudio.svn.sourceforge.net/scstudio/?rev=199&view=rev
Author: gotthardp
Date: 2009-03-07 10:41:47 +0000 (Sat, 07 Mar 2009)
Log Message:
-----------
Moved full paths from the project file to facilitate build e.g. on 64b platforms.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/scstudio.vcproj
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2009-03-01 22:24:16 UTC (rev 198)
+++ trunk/src/view/visio/addon/addon.cpp 2009-03-07 10:41:47 UTC (rev 199)
@@ -29,6 +29,7 @@
// http://code.jellycan.com/simpleopt
#include <SimpleOpt.h>
+// set VISIOSDK_ROOT e.g. to "C:\Program Files\Microsoft Office\Visio11\SDK\"
// include libraries from the Microsoft Office Visio 2003 SDK
// http://www.microsoft.com/downloads/details.aspx?familyid=557120bd-b0bb-46e7-936a-b8539898d44d
extern "C"
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2009-03-01 22:24:16 UTC (rev 198)
+++ trunk/src/view/visio/addon/document.cpp 2009-03-07 10:41:47 UTC (rev 199)
@@ -29,6 +29,7 @@
// Include libraries from the Windows Template Library (WTL).
// http://wtl.sourceforge.net
+// Install WTL80 under e.g. "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\"
#include <atldlgs.h>
CDocumentMonitor::CDocumentMonitor(CStudioAddon *addon,
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2009-03-01 22:24:16 UTC (rev 198)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2009-03-07 10:41:47 UTC (rev 199)
@@ -22,7 +22,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..\..\..\src;"$(BOOSTROOT)";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
+ AdditionalIncludeDirectories="..\..\..\..\src;"$(BOOST_ROOT)";"$(VISIOSDK_ROOT)\Libraries\CPP\Include";"$(VISIOSDK_ROOT)\Libraries\CPP\Source";"$(VISIOSDK_ROOT)\Libraries\TypeLib";"$(VCInstallDir)\WTL80\include""
PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0500;_WINDOWS;_DEBUG;_USRDLL"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
@@ -49,7 +49,7 @@
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
- AdditionalIncludeDirectories=""C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib""
+ AdditionalIncludeDirectories=""$(VISIOSDK_ROOT)\Libraries\TypeLib""
MkTypLibCompatible="FALSE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
@@ -95,7 +95,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="2"
- AdditionalIncludeDirectories="..\..\..\..\src;"$(BOOSTROOT)";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Include";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\CPP\Source";"C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib";"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\WTL80\include""
+ AdditionalIncludeDirectories="..\..\..\..\src;"$(BOOST_ROOT)";"$(VISIOSDK_ROOT)\Libraries\CPP\Include";"$(VISIOSDK_ROOT)\Libraries\CPP\Source";"$(VISIOSDK_ROOT)\Libraries\TypeLib";"$(VCInstallDir)\WTL80\include""
PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0500;_WINDOWS;NDEBUG;_USRDLL"
RuntimeLibrary="2"
RuntimeTypeInfo="TRUE"
@@ -122,7 +122,7 @@
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
- AdditionalIncludeDirectories=""C:\Program Files\Microsoft Office\Visio11\SDK\Libraries\TypeLib""
+ AdditionalIncludeDirectories=""$(VISIOSDK_ROOT)\Libraries\TypeLib""
MkTypLibCompatible="FALSE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <va...@us...> - 2009-04-27 17:43:44
|
Revision: 235
http://scstudio.svn.sourceforge.net/scstudio/?rev=235&view=rev
Author: vacek
Date: 2009-04-27 17:43:39 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
Visio - Options dialog now uses vertical scrollbar.
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/optionsdlg.cpp
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2009-04-26 20:36:23 UTC (rev 234)
+++ trunk/src/view/visio/addon/dllmodule.rc 2009-04-27 17:43:39 UTC (rev 235)
@@ -48,11 +48,11 @@
DEFPUSHBUTTON "OK",IDOK,131,14,50,14
PUSHBUTTON "Cancel",IDCANCEL,131,33,50,14
LTEXT "Properties to check",IDC_STATIC,5,5,100,8
- CONTROL "",IDC_CHECKLIST,"SysListView32",LVS_LIST |
- LVS_SINGLESEL | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,5,
- 14,100,80
+ CONTROL "",IDC_CHECKLIST,"SysListView32",LVS_REPORT |
+ LVS_SINGLESEL | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER |
+ WS_BORDER | WS_TABSTOP,5,14,103,79
LTEXT "Display",IDC_STATIC,5,98,100,8
- COMBOBOX IDC_OUTPUTLEVEL,5,107,100,61,CBS_DROPDOWNLIST | CBS_SORT |
+ COMBOBOX IDC_OUTPUTLEVEL,5,107,102,61,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
END
Modified: trunk/src/view/visio/addon/optionsdlg.cpp
===================================================================
--- trunk/src/view/visio/addon/optionsdlg.cpp 2009-04-26 20:36:23 UTC (rev 234)
+++ trunk/src/view/visio/addon/optionsdlg.cpp 2009-04-27 17:43:39 UTC (rev 235)
@@ -117,6 +117,7 @@
// (2) load checker priorities
m_checklist.SetExtendedListViewStyle(LVS_EX_CHECKBOXES);
+ m_checklist.InsertColumn(0, _T("Checker"), LVCFMT_LEFT, 150);
HKEY hSubKey;
if(RegOpenKeyEx(HKEY_CURRENT_USER, _T(SCSTUDIO_REGISTRY_ROOT) _T("\\Checks"),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-11 08:00:55
|
Revision: 308
http://scstudio.svn.sourceforge.net/scstudio/?rev=308&view=rev
Author: gotthardp
Date: 2009-09-11 08:00:44 +0000 (Fri, 11 Sep 2009)
Log Message:
-----------
GetRegistryDWORD and SetRegistryDWORD moved from optionsdlg to dllmodule.
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.cpp
trunk/src/view/visio/addon/dllmodule.h
trunk/src/view/visio/addon/optionsdlg.cpp
trunk/src/view/visio/addon/optionsdlg.h
Modified: trunk/src/view/visio/addon/dllmodule.cpp
===================================================================
--- trunk/src/view/visio/addon/dllmodule.cpp 2009-09-11 07:48:48 UTC (rev 307)
+++ trunk/src/view/visio/addon/dllmodule.cpp 2009-09-11 08:00:44 UTC (rev 308)
@@ -77,6 +77,80 @@
return csRet;
}
+class RegistryValueNotFound
+{ };
+
+DWORD GetRegistryDWORD(HKEY key, const TCHAR* subkey, const TCHAR* parameter)
+{
+ HKEY hPathKey;
+ if(RegOpenKeyEx(key, subkey, 0, KEY_READ, &hPathKey) != ERROR_SUCCESS)
+ {
+ throw RegistryValueNotFound();
+ }
+
+ DWORD valueType;
+ DWORD value;
+ DWORD valueLength = sizeof(DWORD);
+
+ if(RegQueryValueEx(hPathKey, parameter,
+ NULL, &valueType, (LPBYTE)&value, &valueLength) != ERROR_SUCCESS)
+ {
+ throw RegistryValueNotFound();
+ }
+
+ RegCloseKey(hPathKey);
+ return value;
+}
+
+int SetRegistryDWORD(HKEY key, const TCHAR* subkey, const TCHAR* parameter, DWORD value)
+{
+ HKEY hPathKey;
+ if(RegCreateKeyEx(
+ key,
+ subkey,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_ALL_ACCESS,
+ NULL,
+ &hPathKey,
+ NULL) != ERROR_SUCCESS)
+ {
+ return 0;
+ }
+
+ if(RegSetValueEx(hPathKey,
+ parameter,
+ 0, // must be zero
+ REG_DWORD, // value type
+ (LPBYTE)&value, sizeof(DWORD)) != ERROR_SUCCESS)
+ {
+ return 0;
+ }
+
+ RegCloseKey(hPathKey);
+ return 1;
+}
+
+DWORD GetRegistryDWORD(const TCHAR* subkey, const TCHAR* parameter, DWORD default_value)
+{
+ try
+ {
+ return GetRegistryDWORD(HKEY_CURRENT_USER, subkey, parameter);
+ }
+ catch(RegistryValueNotFound)
+ { }
+
+ try
+ {
+ return GetRegistryDWORD(HKEY_LOCAL_MACHINE, subkey, parameter);
+ }
+ catch(RegistryValueNotFound)
+ { }
+
+ return default_value;
+}
+
#ifdef _MANAGED
#pragma managed(push, off)
#endif
Modified: trunk/src/view/visio/addon/dllmodule.h
===================================================================
--- trunk/src/view/visio/addon/dllmodule.h 2009-09-11 07:48:48 UTC (rev 307)
+++ trunk/src/view/visio/addon/dllmodule.h 2009-09-11 08:00:44 UTC (rev 308)
@@ -19,7 +19,12 @@
#pragma once
#include <string>
+#define SCSTUDIO_REGISTRY_ROOT _T("Software\\Sequence Chart Studio")
+
std::wstring LoadStringResource(UINT uiID);
std::wstring GetVersionInfo(const LPWSTR block);
+DWORD GetRegistryDWORD(const TCHAR* subkey, const TCHAR* parameter, DWORD default_value);
+int SetRegistryDWORD(HKEY key, const TCHAR* subkey, const TCHAR* parameter, DWORD value);
+
// $Id$
Modified: trunk/src/view/visio/addon/optionsdlg.cpp
===================================================================
--- trunk/src/view/visio/addon/optionsdlg.cpp 2009-09-11 07:48:48 UTC (rev 307)
+++ trunk/src/view/visio/addon/optionsdlg.cpp 2009-09-11 08:00:44 UTC (rev 308)
@@ -17,84 +17,11 @@
*/
#include "stdafx.h"
+#include "dllmodule.h"
#include "optionsdlg.h"
#include "data/prerequisite_check.h"
-class RegistryValueNotFound
-{ };
-
-DWORD GetRegistryDWORD(HKEY key, const TCHAR* subkey, const TCHAR* parameter)
-{
- HKEY hPathKey;
- if(RegOpenKeyEx(key, subkey, 0, KEY_READ, &hPathKey) != ERROR_SUCCESS)
- {
- throw RegistryValueNotFound();
- }
-
- DWORD valueType;
- DWORD value;
- DWORD valueLength = sizeof(DWORD);
-
- if(RegQueryValueEx(hPathKey, parameter,
- NULL, &valueType, (LPBYTE)&value, &valueLength) != ERROR_SUCCESS)
- {
- throw RegistryValueNotFound();
- }
-
- RegCloseKey(hPathKey);
- return value;
-}
-
-int SetRegistryDWORD(HKEY key, const TCHAR* subkey, const TCHAR* parameter, DWORD value)
-{
- HKEY hPathKey;
- if(RegCreateKeyEx(
- key,
- subkey,
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_ALL_ACCESS,
- NULL,
- &hPathKey,
- NULL) != ERROR_SUCCESS)
- {
- return 0;
- }
-
- if(RegSetValueEx(hPathKey,
- parameter,
- 0, // must be zero
- REG_DWORD, // value type
- (LPBYTE)&value, sizeof(DWORD)) != ERROR_SUCCESS)
- {
- return 0;
- }
-
- RegCloseKey(hPathKey);
- return 1;
-}
-
-DWORD GetRegistryDWORD(const TCHAR* subkey, const TCHAR* parameter, DWORD default_value)
-{
- try
- {
- return GetRegistryDWORD(HKEY_CURRENT_USER, subkey, parameter);
- }
- catch(RegistryValueNotFound)
- { }
-
- try
- {
- return GetRegistryDWORD(HKEY_LOCAL_MACHINE, subkey, parameter);
- }
- catch(RegistryValueNotFound)
- { }
-
- return default_value;
-}
-
int COptionsDlg::LoadRegistryData()
{
// (1) load the output level
Modified: trunk/src/view/visio/addon/optionsdlg.h
===================================================================
--- trunk/src/view/visio/addon/optionsdlg.h 2009-09-11 07:48:48 UTC (rev 307)
+++ trunk/src/view/visio/addon/optionsdlg.h 2009-09-11 08:00:44 UTC (rev 308)
@@ -72,10 +72,7 @@
int SaveRegistryData();
};
-#define SCSTUDIO_REGISTRY_ROOT _T("Software\\Sequence Chart Studio")
static const DWORD DEFAULT_CHECKER_PRIORITY = 0;
static const DWORD DEFAULT_OUTPUT_LEVEL = 2;
-DWORD GetRegistryDWORD(const TCHAR* subkey, const TCHAR* parameter, DWORD default_value);
-
// $Id$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2009-09-28 13:40:48
|
Revision: 385
http://scstudio.svn.sourceforge.net/scstudio/?rev=385&view=rev
Author: gotthardp
Date: 2009-09-28 13:40:41 +0000 (Mon, 28 Sep 2009)
Log Message:
-----------
Put the beautify functionality back. Call both Beautify and LayoutOptimizer.
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2009-09-28 13:18:35 UTC (rev 384)
+++ trunk/src/view/visio/addon/document.cpp 2009-09-28 13:40:41 UTC (rev 385)
@@ -27,6 +27,7 @@
#include <fstream>
#include "data/msc.h"
+#include "data/beautify.h"
#include "data/layout_optimizer.h"
// Include libraries from the Windows Template Library (WTL).
@@ -1033,21 +1034,8 @@
if(msc == NULL)
return VAORC_FAILURE;
- LayoutOptimizer beautify;
- beautify.m_instance_head_distance =
- (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("InstanceHeadDistance"), 5);
- beautify.m_successor_distance =
- (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("SuccessorDistance"), 5);
- beautify.m_send_receive_distance =
- (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("SendReceiveDistance"), 0);
-
// generate graphical layout information
- if(!beautify.process(msc))
- {
- m_reportView->Print(RS_WARNING,
- stringize() << "Optimized layout not found.");
- }
-
+ OptimizeLayout(msc);
// delete all MSC symbols, preserve ignored shapes
RemoveKnownSymbols(vsoPage);
@@ -1104,6 +1092,27 @@
m_reportVisible = false;
}
+void CDocumentMonitor::OptimizeLayout(const MscPtr& msc)
+{
+ Beautify beautify;
+ beautify.process(msc);
+
+ LayoutOptimizer optimizer;
+ optimizer.m_instance_head_distance =
+ (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("InstanceHeadDistance"), 5);
+ optimizer.m_successor_distance =
+ (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("SuccessorDistance"), 5);
+ optimizer.m_send_receive_distance =
+ (float)GetRegistryDWORD(SCSTUDIO_REGISTRY_ROOT, _T("SendReceiveDistance"), 0);
+
+ // generate graphical layout information
+ if(!optimizer.process(msc))
+ {
+ m_reportView->Print(RS_WARNING,
+ stringize() << "Optimized layout not found.");
+ }
+}
+
void CDocumentMonitor::ImportDocument(const ImportFormatterPtr& formatter, const std::string& filename)
{
std::vector<MscPtr> drawing = formatter->load_msc(filename);
@@ -1145,9 +1154,8 @@
}
}
- LayoutOptimizer beautify;
// generate graphical layout information
- beautify.process(*dpos);
+ OptimizeLayout(*dpos);
CDrawingVisualizer visualizer(m_vsoApp);
visualizer.visualize_msc(page, *dpos);
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2009-09-28 13:18:35 UTC (rev 384)
+++ trunk/src/view/visio/addon/document.h 2009-09-28 13:40:41 UTC (rev 385)
@@ -53,6 +53,7 @@
void ShowReportView();
void OnHideReportView();
+ void OptimizeLayout(const MscPtr& msc);
void ImportDocument(const ImportFormatterPtr& formatter, const std::string& filename);
void ExportActiveDocument(const ExportFormatterPtr& formatter, std::ostream& stream);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-01-13 22:34:19
|
Revision: 551
http://scstudio.svn.sourceforge.net/scstudio/?rev=551&view=rev
Author: gotthardp
Date: 2010-01-13 22:34:09 +0000 (Wed, 13 Jan 2010)
Log Message:
-----------
'Find Flow' dialog now displays only applicable drawings.
Modified Paths:
--------------
trunk/src/view/visio/addon/extract.cpp
trunk/src/view/visio/addon/extract.h
trunk/src/view/visio/addon/finddlg.cpp
trunk/src/view/visio/addon/finddlg.h
Modified: trunk/src/view/visio/addon/extract.cpp
===================================================================
--- trunk/src/view/visio/addon/extract.cpp 2010-01-11 19:10:35 UTC (rev 550)
+++ trunk/src/view/visio/addon/extract.cpp 2010-01-13 22:34:09 UTC (rev 551)
@@ -192,7 +192,7 @@
return ST_UNKNOWN;
}
-CDrawingExtractor::TDrawingType CDrawingExtractor::get_drawing_type(Visio::IVPagePtr vsoPage)
+TDrawingType get_drawing_type(Visio::IVPagePtr vsoPage)
{
Visio::IVShapesPtr vsoShapes = vsoPage->Shapes;
Modified: trunk/src/view/visio/addon/extract.h
===================================================================
--- trunk/src/view/visio/addon/extract.h 2010-01-11 19:10:35 UTC (rev 550)
+++ trunk/src/view/visio/addon/extract.h 2010-01-13 22:34:09 UTC (rev 551)
@@ -51,6 +51,16 @@
//! determine MSC symbol represented by the given shape
TShapeType get_shape_type(Visio::IVShapePtr shape);
+enum TDrawingType
+{
+ DT_UNKNOWN = 0,
+ DT_BMSC = 1,
+ DT_HMSC = 2
+};
+
+//! determine type of the drawing on the given page
+TDrawingType get_drawing_type(Visio::IVPagePtr vsoPage);
+
class CDrawingExtractor
{
public:
@@ -93,16 +103,6 @@
typedef std::map<std::wstring,MscPtr,nocase_comparator<wchar_t> > MscCacheMap;
MscCacheMap m_msc_cache;
- enum TDrawingType
- {
- DT_UNKNOWN = 0,
- DT_BMSC = 1,
- DT_HMSC = 2
- };
-
- //! determine type of the drawing on the given page
- TDrawingType get_drawing_type(Visio::IVPagePtr vsoPage);
-
//! 2D coordinates in visio internal units, having [0,0] bottom left
struct SPoint
{
Modified: trunk/src/view/visio/addon/finddlg.cpp
===================================================================
--- trunk/src/view/visio/addon/finddlg.cpp 2010-01-11 19:10:35 UTC (rev 550)
+++ trunk/src/view/visio/addon/finddlg.cpp 2010-01-13 22:34:09 UTC (rev 551)
@@ -17,6 +17,7 @@
*/
#include "stdafx.h"
+#include "extract.h"
#include "finddlg.h"
CFindDlg::CFindDlg(Visio::IVApplicationPtr vsoApp)
@@ -30,8 +31,8 @@
CenterWindow(GetParent());
DoDataExchange();
- InitializeTree(m_drawing1);
- InitializeTree(m_drawing2);
+ InitializeTree(m_drawing1, true); // pattern
+ InitializeTree(m_drawing2, false);
return bHandled = FALSE;
}
@@ -51,7 +52,7 @@
return 0;
}
-void CFindDlg::InitializeTree(CTreeViewCtrl& tree)
+void CFindDlg::InitializeTree(CTreeViewCtrl& tree, bool isPattern)
{
for(int i = 1; i <= m_vsoApp->Windows->Count; i++)
{
@@ -63,8 +64,15 @@
for(int j = 1; j <= vsoDocument->Pages->Count; j++)
{
Visio::IVPagePtr vsoPage = vsoDocument->Pages->Item[j];
- HTREEITEM pageitem = tree.InsertItem(vsoPage->Name, docitem, 0);
- tree.SetItemData(pageitem, vsoPage->ID);
+
+ TDrawingType dtype = get_drawing_type(vsoPage);
+ // check the drawing type
+ if(isPattern && dtype == DT_BMSC ||
+ !isPattern && (dtype == DT_BMSC || dtype == DT_HMSC))
+ {
+ HTREEITEM pageitem = tree.InsertItem(vsoPage->Name, docitem, 0);
+ tree.SetItemData(pageitem, vsoPage->ID);
+ }
}
tree.Expand(docitem);
Modified: trunk/src/view/visio/addon/finddlg.h
===================================================================
--- trunk/src/view/visio/addon/finddlg.h 2010-01-11 19:10:35 UTC (rev 550)
+++ trunk/src/view/visio/addon/finddlg.h 2010-01-13 22:34:09 UTC (rev 551)
@@ -56,7 +56,7 @@
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
- void InitializeTree(CTreeViewCtrl& tree);
+ void InitializeTree(CTreeViewCtrl& tree, bool isPattern);
Visio::IVPagePtr GetTreeSelection(CTreeViewCtrl& tree);
private:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-02-03 13:44:15
|
Revision: 563
http://scstudio.svn.sourceforge.net/scstudio/?rev=563&view=rev
Author: obouda
Date: 2010-02-03 13:44:07 +0000 (Wed, 03 Feb 2010)
Log Message:
-----------
Selection of all instances/messages on current page, accessible via menu Check--Drawing--Select
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/scstudio.vcproj
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-02-03 13:36:58 UTC (rev 562)
+++ trunk/src/view/visio/addon/addon.cpp 2010-02-03 13:44:07 UTC (rev 563)
@@ -284,6 +284,12 @@
case 207:
TRACE("CStudioAddon::Run() menu item 'Check--Options'");
return DisplayOptions();
+ case 208:
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Instances'");
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp);
+ case 209:
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'");
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-03 13:36:58 UTC (rev 562)
+++ trunk/src/view/visio/addon/document.cpp 2010-02-03 13:44:07 UTC (rev 563)
@@ -393,34 +393,48 @@
menuItem3->CmdNum = Visio::visCmdHierarchical;
Visio::IVMenuItemPtr menuItem31 = menuItem3->MenuItems->Add();
- menuItem31->Caption = "&Import...";
- menuItem31->AddOnName = ADDON_NAME;
- menuItem31->AddOnArgs = "/event=203";
- menuItem31->BeginGroup = true;
- // enable only if some formatters are available
- menuItem31->Enabled = m_formatters.size() > 0;
+ menuItem31->Caption = "&Select";
+ menuItem31->CmdNum = Visio::visCmdHierarchical;
+ Visio::IVMenuItemPtr menuItem311 = menuItem31->MenuItems->Add();
+ menuItem311->Caption = "All &Instances";
+ menuItem311->AddOnName = ADDON_NAME;
+ menuItem311->AddOnArgs = "/event=208";
+
+ Visio::IVMenuItemPtr menuItem312 = menuItem31->MenuItems->Add();
+ menuItem312->Caption = "All &Messages";
+ menuItem312->AddOnName = ADDON_NAME;
+ menuItem312->AddOnArgs = "/event=209";
+
Visio::IVMenuItemPtr menuItem32 = menuItem3->MenuItems->Add();
- menuItem32->Caption = "&Export...";
+ menuItem32->Caption = "&Import...";
menuItem32->AddOnName = ADDON_NAME;
- menuItem32->AddOnArgs = "/event=204";
+ menuItem32->AddOnArgs = "/event=203";
+ menuItem32->BeginGroup = true;
// enable only if some formatters are available
menuItem32->Enabled = m_formatters.size() > 0;
Visio::IVMenuItemPtr menuItem33 = menuItem3->MenuItems->Add();
- menuItem33->Caption = "&Find Flow...";
+ menuItem33->Caption = "&Export...";
menuItem33->AddOnName = ADDON_NAME;
- menuItem33->AddOnArgs = "/event=205";
- menuItem33->BeginGroup = true;
- // enable only if membership is available
- menuItem33->Enabled = m_membership != NULL;
+ menuItem33->AddOnArgs = "/event=204";
+ // enable only if some formatters are available
+ menuItem33->Enabled = m_formatters.size() > 0;
Visio::IVMenuItemPtr menuItem34 = menuItem3->MenuItems->Add();
- menuItem34->Caption = "&Repaint";
+ menuItem34->Caption = "&Find Flow...";
menuItem34->AddOnName = ADDON_NAME;
- menuItem34->AddOnArgs = "/event=206";
+ menuItem34->AddOnArgs = "/event=205";
menuItem34->BeginGroup = true;
+ // enable only if membership is available
+ menuItem34->Enabled = m_membership != NULL;
+ Visio::IVMenuItemPtr menuItem35 = menuItem3->MenuItems->Add();
+ menuItem35->Caption = "&Repaint";
+ menuItem35->AddOnName = ADDON_NAME;
+ menuItem35->AddOnArgs = "/event=206";
+ menuItem35->BeginGroup = true;
+
for(TransformerPtrList::const_iterator tpos = m_transformers.begin();
tpos != m_transformers.end(); tpos++)
{
@@ -1101,6 +1115,53 @@
return VAORC_SUCCESS;
}
+// TODO: Doxygen comment
+// for select_instances = true, selects all instances on the active page
+// for select_instances = false, selects all messages (including lost and found messages) on the active page
+void CDocumentMonitor::selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances)
+{
+ Visio::IVPagePtr page = vsoApp->ActivePage;
+ Visio::IVSelectionPtr selection =
+ page->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper);
+
+ for(int i=1; i<=page->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = page->Shapes->Item[i];
+ switch (get_shape_type(shape))
+ {
+ case ST_BMSC_INSTANCE:
+ if (select_instances)
+ selection->Select(shape, Visio::visSelect);
+ break;
+ case ST_BMSC_MESSAGE:
+ case ST_BMSC_MESSAGE_LOST:
+ case ST_BMSC_MESSAGE_FOUND:
+ if (!select_instances)
+ selection->Select(shape, Visio::visSelect);
+ break;
+ }
+ }
+
+ vsoApp->ActiveWindow->Selection = selection;
+/*
+ // TODO: do stavoveho radku
+ m_reportView->Print(RS_NOTICE,
+ stringize() << "Selected " << selection->Count << " shape(s)");
+*/
+}
+
+VAORC CDocumentMonitor::OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp)
+{
+ selectAll(vsoApp, true);
+ return VAORC_SUCCESS;
+}
+
+VAORC CDocumentMonitor::OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp)
+{
+ selectAll(vsoApp, false);
+ return VAORC_SUCCESS;
+}
+
VAORC CDocumentMonitor::OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp)
{
if(m_reportVisible)
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-02-03 13:36:58 UTC (rev 562)
+++ trunk/src/view/visio/addon/document.h 2010-02-03 13:44:07 UTC (rev 563)
@@ -53,6 +53,8 @@
VAORC OnMenuFindFlow(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuRepaint(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index);
+ VAORC OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp);
+ VAORC OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp);
void ShowReportView();
void OnHideReportView();
@@ -103,6 +105,8 @@
Visio::IVMenuItemPtr m_reportMenuItem;
CReportView *m_reportView;
ConfigProvider *m_configProvider;
+
+ void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances);
};
// $Id$
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-02-03 13:36:58 UTC (rev 562)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-02-03 13:44:07 UTC (rev 563)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="scstudio"
ProjectGUID="{0E00282C-F48B-4984-A274-5B59E1E2AD49}"
RootNamespace="scstudio"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-02-08 10:36:04
|
Revision: 578
http://scstudio.svn.sourceforge.net/scstudio/?rev=578&view=rev
Author: obouda
Date: 2010-02-08 10:35:55 +0000 (Mon, 08 Feb 2010)
Log Message:
-----------
Added 'Sequence Chart Studio' toolbar, added buttons and keyboard accelerators for selection of all instances/messages.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-02-07 16:00:27 UTC (rev 577)
+++ trunk/src/view/visio/addon/addon.cpp 2010-02-08 10:35:55 UTC (rev 578)
@@ -515,6 +515,8 @@
// being monitored for this document.
pDocumentMonitor = new CDocumentMonitor(this, vsoApp, vsoDocument);
pDocumentMonitor->InitMenu(vsoApp, vsoDocument);
+ pDocumentMonitor->InitToolbar(vsoApp, vsoDocument);
+ pDocumentMonitor->InitAccelerators(vsoApp, vsoDocument);
// register BeforeDocumentClose
vsoEvent = vsoDocumentEventList->AddAdvise(visEvtBeforeDocumentClose, varSink, _T(""), _T(""));
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-07 16:00:27 UTC (rev 577)
+++ trunk/src/view/visio/addon/document.cpp 2010-02-08 10:35:55 UTC (rev 578)
@@ -398,10 +398,93 @@
menuItem4->Caption = "&Options...";
menuItem4->AddOnName = ADDON_NAME;
menuItem4->AddOnArgs = "/event=207";
+ menuItem4->BeginGroup = true;
vsoDocument->SetCustomMenus(vsoMenus);
}
+void CDocumentMonitor::InitToolbar(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+{
+ Visio::IVUIObjectPtr vsoToolbars = NULL;
+
+ if(vsoDocument != NULL)
+ {
+ Visio::IVUIObjectPtr docToolbars = vsoDocument->CustomToolbars;
+ if(docToolbars != NULL)
+ vsoToolbars = docToolbars->Clone;
+ }
+ if(vsoToolbars == NULL)
+ {
+ Visio::IVUIObjectPtr appToolbars = vsoApp->CustomToolbars;
+ if(appToolbars != NULL)
+ vsoToolbars = appToolbars->Clone;
+ }
+ if(vsoToolbars == NULL)
+ vsoToolbars = vsoApp->GetBuiltInToolbars(0); // gets a clone
+
+ Visio::IVToolbarSetPtr toolbarSet = vsoToolbars->ToolbarSets->ItemAtID[Visio::visUIObjSetDrawing];
+ Visio::IVToolbarPtr toolbar = toolbarSet->Toolbars->Add();
+
+ toolbar->Caption = "Sequence Chart Studio";
+ // many functions are not working in OLE window: repaint, import, error display
+ // disable verification functions when opened from OLE window
+ toolbar->Enabled = !vsoDocument->InPlace;
+
+ Visio::IVToolbarItemPtr toolbarItem1 = toolbar->ToolbarItems->Add();
+ toolbarItem1->Caption = "Select All Instances";
+ toolbarItem1->AddOnName = ADDON_NAME;
+ toolbarItem1->AddOnArgs = "/event=208";
+ toolbarItem1->FaceID = visIconIXSINGLETILE;
+
+ Visio::IVToolbarItemPtr toolbarItem2 = toolbar->ToolbarItems->Add();
+ toolbarItem2->Caption = "Select All Messages";
+ toolbarItem2->AddOnName = ADDON_NAME;
+ toolbarItem2->AddOnArgs = "/event=209";
+ toolbarItem2->FaceID = visIconIXCONNPOINTS;
+
+ vsoDocument->SetCustomToolbars(vsoToolbars);
+}
+
+void CDocumentMonitor::InitAccelerators(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+{
+ Visio::IVUIObjectPtr vsoMenus = NULL;
+
+ if(vsoDocument != NULL)
+ {
+ Visio::IVUIObjectPtr docMenus = vsoDocument->CustomMenus;
+ if(docMenus != NULL)
+ vsoMenus = docMenus->Clone;
+ }
+ if(vsoMenus == NULL)
+ {
+ Visio::IVUIObjectPtr appMenus = vsoApp->CustomMenus;
+ if(appMenus != NULL)
+ vsoMenus = appMenus->Clone;
+ }
+ if(vsoMenus == NULL)
+ vsoMenus = vsoApp->BuiltInMenus; // gets a clone
+
+ Visio::IVAccelTablePtr accelTable = vsoMenus->AccelTables->ItemAtID[Visio::visUIObjSetDrawing];
+ // many functions are not working in OLE window: repaint, import, error display
+ // disable verification functions when opened from OLE window
+
+ Visio::IVAccelItemPtr accelItem1 = accelTable->AccelItems->Add();
+ accelItem1->AddOnName = ADDON_NAME;
+ accelItem1->AddOnArgs = "/event=208";
+ accelItem1->Key = 'I';
+ accelItem1->Control = true;
+ accelItem1->Alt = true;
+
+ Visio::IVAccelItemPtr accelItem2 = accelTable->AccelItems->Add();
+ accelItem2->AddOnName = ADDON_NAME;
+ accelItem2->AddOnArgs = "/event=209";
+ accelItem2->Key = 'M';
+ accelItem2->Control = true;
+ accelItem2->Alt = true;
+
+ vsoDocument->SetCustomMenus(vsoMenus);
+}
+
struct CheckExecutionStatus
{
CheckExecutionStatus()
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-02-07 16:00:27 UTC (rev 577)
+++ trunk/src/view/visio/addon/document.h 2010-02-08 10:35:55 UTC (rev 578)
@@ -43,6 +43,8 @@
VAORC OnOpenReference(int iDocumentIndex, int iPageIndex, _bstr_t sShapeU);
void InitMenu(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
+ void InitToolbar(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
+ void InitAccelerators(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
VAORC OnMenuRun(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-02-08 23:29:01
|
Revision: 579
http://scstudio.svn.sourceforge.net/scstudio/?rev=579&view=rev
Author: gotthardp
Date: 2010-02-08 23:28:51 +0000 (Mon, 08 Feb 2010)
Log Message:
-----------
Added custom toolbar icons.
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.cpp
trunk/src/view/visio/addon/dllmodule.h
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/src/view/visio/addon/icon_select_instances.ico
trunk/src/view/visio/addon/icon_select_messages.ico
Modified: trunk/src/view/visio/addon/dllmodule.cpp
===================================================================
--- trunk/src/view/visio/addon/dllmodule.cpp 2010-02-08 10:35:55 UTC (rev 578)
+++ trunk/src/view/visio/addon/dllmodule.cpp 2010-02-08 23:28:51 UTC (rev 579)
@@ -79,6 +79,17 @@
static const int _FILE_PATH_SIZE = _MAX_PATH * 4;
+std::basic_string<TCHAR> GetVisioModuleFileName()
+{
+ TCHAR szPath[_FILE_PATH_SIZE];
+
+ // get the full path including the Addon name
+ GetModuleFileName(GetModuleHandle(LoadStringResource(IDS_VSL_NAME).c_str()),
+ szPath, sizeof(szPath) / sizeof(TCHAR));
+
+ return szPath;
+}
+
std::basic_string<TCHAR> GetVisioModulePath()
{
TCHAR szPath[_FILE_PATH_SIZE];
Modified: trunk/src/view/visio/addon/dllmodule.h
===================================================================
--- trunk/src/view/visio/addon/dllmodule.h 2010-02-08 10:35:55 UTC (rev 578)
+++ trunk/src/view/visio/addon/dllmodule.h 2010-02-08 23:28:51 UTC (rev 579)
@@ -25,6 +25,7 @@
std::wstring LoadStringResource(UINT uiID);
std::wstring GetVersionInfo(const LPWSTR block);
+std::basic_string<TCHAR> GetVisioModuleFileName();
std::basic_string<TCHAR> GetVisioModulePath();
DWORD GetRegistryDWORD(const TCHAR* root, const TCHAR* path, const TCHAR* parameter, DWORD default_value);
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-02-08 10:35:55 UTC (rev 578)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-02-08 23:28:51 UTC (rev 579)
@@ -179,6 +179,16 @@
/////////////////////////////////////////////////////////////////////////////
//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON_SELECT_INSTANCES ICON "icon_select_instances.ico"
+IDI_ICON_SELECT_MESSAGES ICON "icon_select_messages.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
// String Table
//
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-08 10:35:55 UTC (rev 578)
+++ trunk/src/view/visio/addon/document.cpp 2010-02-08 23:28:51 UTC (rev 579)
@@ -430,17 +430,22 @@
// disable verification functions when opened from OLE window
toolbar->Enabled = !vsoDocument->InPlace;
+ std::basic_string<TCHAR> vslFileName = GetVisioModuleFileName();
+ std::basic_string<TCHAR> vslIconFile;
+
Visio::IVToolbarItemPtr toolbarItem1 = toolbar->ToolbarItems->Add();
toolbarItem1->Caption = "Select All Instances";
toolbarItem1->AddOnName = ADDON_NAME;
toolbarItem1->AddOnArgs = "/event=208";
- toolbarItem1->FaceID = visIconIXSINGLETILE;
+ vslIconFile = vslFileName+_T(",0");
+ toolbarItem1->IconFileName(vslIconFile.c_str());
Visio::IVToolbarItemPtr toolbarItem2 = toolbar->ToolbarItems->Add();
toolbarItem2->Caption = "Select All Messages";
toolbarItem2->AddOnName = ADDON_NAME;
toolbarItem2->AddOnArgs = "/event=209";
- toolbarItem2->FaceID = visIconIXCONNPOINTS;
+ vslIconFile = vslFileName+_T(",1");
+ toolbarItem2->IconFileName(vslIconFile.c_str());
vsoDocument->SetCustomToolbars(vsoToolbars);
}
Added: trunk/src/view/visio/addon/icon_select_instances.ico
===================================================================
(Binary files differ)
Property changes on: trunk/src/view/visio/addon/icon_select_instances.ico
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/view/visio/addon/icon_select_messages.ico
===================================================================
(Binary files differ)
Property changes on: trunk/src/view/visio/addon/icon_select_messages.ico
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-02-08 10:35:55 UTC (rev 578)
+++ trunk/src/view/visio/addon/resource.h 2010-02-08 23:28:51 UTC (rev 579)
@@ -17,12 +17,14 @@
#define IDC_OUTPUTLEVEL 207
#define IDC_DRAWING1 208
#define IDC_DRAWING2 209
+#define IDI_ICON_SELECT_INSTANCES 209
+#define IDI_ICON_SELECT_MESSAGES 210
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 207
+#define _APS_NEXT_RESOURCE_VALUE 211
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 209
#define _APS_NEXT_SYMED_VALUE 105
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-02-08 10:35:55 UTC (rev 578)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-02-08 23:28:51 UTC (rev 579)
@@ -373,6 +373,14 @@
RelativePath=".\dllmodule.rgs"
>
</File>
+ <File
+ RelativePath=".\icon_select_instances.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\icon_select_messages.ico"
+ >
+ </File>
</Filter>
<Filter
Name="Generated Files"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-02-10 15:18:43
|
Revision: 581
http://scstudio.svn.sourceforge.net/scstudio/?rev=581&view=rev
Author: obouda
Date: 2010-02-10 15:18:33 +0000 (Wed, 10 Feb 2010)
Log Message:
-----------
A minor refactoring to reduce code duplication
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-08 23:44:36 UTC (rev 580)
+++ trunk/src/view/visio/addon/document.cpp 2010-02-10 15:18:33 UTC (rev 581)
@@ -289,25 +289,41 @@
return VAORC_SUCCESS;
}
-void CDocumentMonitor::InitMenu(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+Visio::IVUIObjectPtr CDocumentMonitor::getMostCustomMenus(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
{
- Visio::IVUIObjectPtr vsoMenus = NULL;
-
if(vsoDocument != NULL)
{
Visio::IVUIObjectPtr docMenus = vsoDocument->CustomMenus;
if(docMenus != NULL)
- vsoMenus = docMenus->Clone;
+ return docMenus->Clone; // document-specific menus are defined
}
- if(vsoMenus == NULL)
+
+ Visio::IVUIObjectPtr appMenus = vsoApp->CustomMenus;
+ if(appMenus != NULL)
+ return appMenus->Clone; // application custom menus are defined
+
+ return vsoApp->BuiltInMenus; // gets a clone
+}
+
+Visio::IVUIObjectPtr CDocumentMonitor::getMostCustomToolbars(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+{
+ if(vsoDocument != NULL)
{
- Visio::IVUIObjectPtr appMenus = vsoApp->CustomMenus;
- if(appMenus != NULL)
- vsoMenus = appMenus->Clone;
+ Visio::IVUIObjectPtr docToolbars = vsoDocument->CustomToolbars;
+ if(docToolbars != NULL)
+ return docToolbars->Clone;
}
- if(vsoMenus == NULL)
- vsoMenus = vsoApp->BuiltInMenus; // gets a clone
+ Visio::IVUIObjectPtr appToolbars = vsoApp->CustomToolbars;
+ if(appToolbars != NULL)
+ return appToolbars->Clone;
+
+ return vsoApp->GetBuiltInToolbars(0);
+}
+
+void CDocumentMonitor::InitMenu(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+{
+ Visio::IVUIObjectPtr vsoMenus = getMostCustomMenus(vsoApp, vsoDocument);
Visio::IVMenuSetPtr menuSet = vsoMenus->MenuSets->ItemAtID[Visio::visUIObjSetDrawing];
Visio::IVMenuPtr menu = menuSet->Menus->AddAt(5);
@@ -412,27 +428,11 @@
void CDocumentMonitor::InitToolbar(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
{
- Visio::IVUIObjectPtr vsoToolbars = NULL;
-
- if(vsoDocument != NULL)
- {
- Visio::IVUIObjectPtr docToolbars = vsoDocument->CustomToolbars;
- if(docToolbars != NULL)
- vsoToolbars = docToolbars->Clone;
- }
- if(vsoToolbars == NULL)
- {
- Visio::IVUIObjectPtr appToolbars = vsoApp->CustomToolbars;
- if(appToolbars != NULL)
- vsoToolbars = appToolbars->Clone;
- }
- if(vsoToolbars == NULL)
- vsoToolbars = vsoApp->GetBuiltInToolbars(0); // gets a clone
-
+ Visio::IVUIObjectPtr vsoToolbars = getMostCustomToolbars(vsoApp, vsoDocument);
Visio::IVToolbarSetPtr toolbarSet = vsoToolbars->ToolbarSets->ItemAtID[Visio::visUIObjSetDrawing];
Visio::IVToolbarPtr toolbar = toolbarSet->Toolbars->Add();
- toolbar->Caption = "Sequence Chart Studio";
+ toolbar->Caption = "Sequence Chart";
// many functions are not working in OLE window: repaint, import, error display
// disable verification functions when opened from OLE window
toolbar->Enabled = !vsoDocument->InPlace;
@@ -459,26 +459,8 @@
void CDocumentMonitor::InitAccelerators(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
{
- Visio::IVUIObjectPtr vsoMenus = NULL;
-
- if(vsoDocument != NULL)
- {
- Visio::IVUIObjectPtr docMenus = vsoDocument->CustomMenus;
- if(docMenus != NULL)
- vsoMenus = docMenus->Clone;
- }
- if(vsoMenus == NULL)
- {
- Visio::IVUIObjectPtr appMenus = vsoApp->CustomMenus;
- if(appMenus != NULL)
- vsoMenus = appMenus->Clone;
- }
- if(vsoMenus == NULL)
- vsoMenus = vsoApp->BuiltInMenus; // gets a clone
-
+ Visio::IVUIObjectPtr vsoMenus = getMostCustomMenus(vsoApp, vsoDocument);
Visio::IVAccelTablePtr accelTable = vsoMenus->AccelTables->ItemAtID[Visio::visUIObjSetDrawing];
- // many functions are not working in OLE window: repaint, import, error display
- // disable verification functions when opened from OLE window
Visio::IVAccelItemPtr accelItem1 = accelTable->AccelItems->Add();
accelItem1->AddOnName = ADDON_NAME;
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-02-08 23:44:36 UTC (rev 580)
+++ trunk/src/view/visio/addon/document.h 2010-02-10 15:18:33 UTC (rev 581)
@@ -107,6 +107,8 @@
ConfigProvider *m_configProvider;
void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances);
+ Visio::IVUIObjectPtr getMostCustomMenus(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
+ Visio::IVUIObjectPtr getMostCustomToolbars(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
};
// $Id$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-02-10 23:06:02
|
Revision: 583
http://scstudio.svn.sourceforge.net/scstudio/?rev=583&view=rev
Author: gotthardp
Date: 2010-02-10 23:05:56 +0000 (Wed, 10 Feb 2010)
Log Message:
-----------
New feature: Verification report can print multiple error results. Visio reporting functions refactored.
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/icon_select_instances.ico
trunk/src/view/visio/addon/icon_select_messages.ico
trunk/src/view/visio/addon/reportview.cpp
trunk/src/view/visio/addon/reportview.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/src/view/visio/addon/reportmessage.cpp
trunk/src/view/visio/addon/reportmessage.h
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-10 20:46:58 UTC (rev 582)
+++ trunk/src/view/visio/addon/document.cpp 2010-02-10 23:05:56 UTC (rev 583)
@@ -736,7 +736,7 @@
SRChannelMapperPtr srm(new SRChannelMapper());
- MscPtr result = NULL;
+ std::list<MscPtr> result;
bool result_set = false;
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc);
@@ -756,15 +756,13 @@
try
{
- std::list<BMscPtr> lresult = bmsc_checker->check(bmsc, srm);
- BMscPtr bresult;
- if(lresult.size() > 0)
- bresult = lresult.back();
- else
- bresult = NULL;
+ std::list<BMscPtr> bresult = bmsc_checker->check(bmsc, srm);
- // note: the explicit cast is a workaround for a bug in Visual Studio .NET
- result = boost::dynamic_pointer_cast<Msc>(bresult);
+ for(std::list<BMscPtr>::const_iterator bpos = bresult.begin();
+ bpos != bresult.end(); bpos++)
+ {
+ result.push_back(boost::dynamic_pointer_cast<Msc>(*bpos));
+ }
result_set = true;
}
catch(std::exception &exc)
@@ -792,13 +790,13 @@
try
{
- std::list<HMscPtr> lresult = hmsc_checker->check(hmsc, srm);
- HMscPtr hresult;
- if(lresult.size() > 0)
- hresult = lresult.back();
- else
- hresult = NULL;
- result = boost::dynamic_pointer_cast<Msc>(hresult);
+ std::list<HMscPtr> hresult = hmsc_checker->check(hmsc, srm);
+
+ for(std::list<HMscPtr>::const_iterator hpos = hresult.begin();
+ hpos != hresult.end(); hpos++)
+ {
+ result.push_back(boost::dynamic_pointer_cast<Msc>(*hpos));
+ }
result_set = true;
}
catch(std::exception &exc)
@@ -814,7 +812,7 @@
// checker is not compatible with the drawing
status[*cpos].executed = false;
}
- else if(result != NULL)
+ else if(!result.empty())
{
// check failed
status[*cpos].executed = true;
Modified: trunk/src/view/visio/addon/icon_select_instances.ico
===================================================================
(Binary files differ)
Modified: trunk/src/view/visio/addon/icon_select_messages.ico
===================================================================
(Binary files differ)
Added: trunk/src/view/visio/addon/reportmessage.cpp
===================================================================
--- trunk/src/view/visio/addon/reportmessage.cpp (rev 0)
+++ trunk/src/view/visio/addon/reportmessage.cpp 2010-02-10 23:05:56 UTC (rev 583)
@@ -0,0 +1,38 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2010 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "document.h"
+#include "reportmessage.h"
+
+void ShapesReference::OnClick(CDocumentMonitor *monitor) const
+{
+ monitor->SelectShapes(m_shapes);
+}
+
+void DrawingReference::OnClick(CDocumentMonitor *monitor) const
+{
+ monitor->DisplayDocument(m_drawing);
+}
+
+void HelpReference::OnClick(CDocumentMonitor *monitor) const
+{
+ monitor->InvokeHelp(m_help);
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/reportmessage.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/reportmessage.h
===================================================================
--- trunk/src/view/visio/addon/reportmessage.h (rev 0)
+++ trunk/src/view/visio/addon/reportmessage.h 2010-02-10 23:05:56 UTC (rev 583)
@@ -0,0 +1,228 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2007-2010 Petr Gotthard <pet...@ce...>
+ *
+ * $Id$
+ */
+
+#pragma once
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+#include <richedit.h>
+
+#include "data/msc.h"
+#include "data/reporter.h"
+
+class CDocumentMonitor;
+
+class ReportReference
+{
+public:
+ ReportReference()
+ {
+ m_position.cpMin = 0;
+ m_position.cpMax = 0;
+ }
+
+ virtual ~ReportReference() {}
+ virtual void OnClick(CDocumentMonitor *monitor) const = 0;
+
+ bool Coincide(const CHARRANGE& range)
+ {
+ return (range.cpMin < m_position.cpMax && range.cpMax > m_position.cpMin);
+ }
+
+ CHARRANGE m_position;
+};
+
+typedef boost::shared_ptr<ReportReference> ReportReferencePtr;
+typedef std::vector<ReportReferencePtr> ReportReferencePtrList;
+
+struct shapelist
+{
+ shapelist & operator << (Visio::IVShapePtr shape)
+ {
+ _bstr_t reference = shape->UniqueID[visGetOrMakeGUID];
+ m_v.push_back(reference);
+ return *this;
+ }
+
+ // note: must not return reference
+ operator const std::vector<_bstr_t>() const
+ {
+ return m_v;
+ }
+
+private:
+ std::vector<_bstr_t> m_v;
+};
+
+struct ReportMessage
+{
+ ReportMessage()
+ : m_length(0)
+ { }
+
+ class Highlight
+ {
+ public:
+ Highlight(TReportSeverity severity)
+ : m_severity(severity)
+ { }
+
+ TReportSeverity m_severity;
+ };
+
+ ReportMessage& operator << (const Highlight &op)
+ {
+ // depending on severity, change the text style
+ switch(op.m_severity)
+ {
+ case RS_REPORT:
+ default:
+ m_text << "\\b0\\cf0 ";
+ break;
+ case RS_NOTICE:
+ m_text << "\\b ";
+ break;
+ case RS_WARNING:
+ m_text << "\\cf1 ";
+ break;
+ case RS_ERROR:
+ m_text << "\\cf1\\b ";
+ break;
+ }
+ return *this;
+ }
+
+ ReportMessage& operator << (const std::string &text)
+ {
+ m_text << text;
+ m_length += text.length();
+ return *this;
+ }
+
+ ReportMessage& operator << (const std::wstring &text)
+ {
+ for(std::wstring::const_iterator pos = text.begin();
+ pos != text.end(); pos++)
+ {
+ if(*pos < 128)
+ m_text << (char)*pos;
+ else
+ m_text << "\\u" << int(*pos) << ";";
+ }
+
+ m_length += text.length();
+ return *this;
+ }
+
+ void AppendLink(const std::string &text, const ReportReferencePtr& reference)
+ {
+ ReportReferencePtr ref = reference;
+ ref->m_position.cpMin = m_length;
+
+ m_text << text;
+ m_length += text.length();
+
+ ref->m_position.cpMax = m_length;
+ m_references.push_back(ref);
+ }
+
+ // note: must not return reference
+ std::string get_text() const
+ {
+ return m_text.str();
+ }
+
+ size_t get_length() const
+ {
+ return m_length;
+ }
+
+ const ReportReferencePtrList& get_references() const
+ {
+ return m_references;
+ }
+
+private:
+ std::stringstream m_text; // RTF text
+ size_t m_length; // length of plaintext
+
+ ReportReferencePtrList m_references;
+};
+
+class ShapesReference : public ReportReference
+{
+public:
+ ShapesReference(const std::vector<_bstr_t>& shapes)
+ : m_shapes(shapes)
+ { }
+
+ virtual void OnClick(CDocumentMonitor *monitor) const;
+ std::vector<_bstr_t> m_shapes; // shapes to select
+};
+
+class DrawingReference : public ReportReference
+{
+public:
+ DrawingReference(const MscPtr& drawing)
+ : m_drawing(drawing)
+ { }
+
+ virtual void OnClick(CDocumentMonitor *monitor) const;
+ MscPtr m_drawing; // drawing to display
+};
+
+class HelpReference : public ReportReference
+{
+public:
+ HelpReference(const std::wstring& help)
+ : m_help(help)
+ { }
+
+ virtual void OnClick(CDocumentMonitor *monitor) const;
+ std::wstring m_help; // help to display
+};
+
+class ReportLink
+{
+public:
+ ReportLink(const std::string &text, const std::vector<_bstr_t>& value)
+ : m_text(text), m_reference(new ShapesReference(value))
+ { }
+
+ ReportLink(const std::string &text, const MscPtr& value)
+ : m_text(text), m_reference(new DrawingReference(value))
+ { }
+
+ ReportLink(const std::string &text, const std::wstring& value)
+ : m_text(text), m_reference(new HelpReference(value))
+ { }
+
+ friend ReportMessage&
+ operator<<(ReportMessage& report, const ReportLink& link)
+ {
+ report.AppendLink(link.m_text, link.m_reference);
+ return report;
+ }
+
+private:
+ std::string m_text;
+ ReportReferencePtr m_reference;
+};
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/reportmessage.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/reportview.cpp
===================================================================
--- trunk/src/view/visio/addon/reportview.cpp 2010-02-10 20:46:58 UTC (rev 582)
+++ trunk/src/view/visio/addon/reportview.cpp 2010-02-10 23:05:56 UTC (rev 583)
@@ -47,7 +47,11 @@
int line = LineFromChar(ch);
TRACE("CRichList::OnLButtonDblClk() called at line " << line);
- return m_reporter->OnLineShow(line);
+ CHARRANGE range;
+ range.cpMin = LineIndex(line);
+ range.cpMax = range.cpMin+LineLength(line)-1;
+
+ return m_reporter->OnClick(range);
}
LRESULT CRichList::OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -58,14 +62,17 @@
int line = LineFromChar((ch1+ch2)/2);
TRACE("CRichList::OnHelp() called at line " << line);
- return m_reporter->OnLineHelp(line);
+ CHARRANGE range;
+ range.cpMin = LineIndex(line);
+ range.cpMax = range.cpMin+LineLength(line)-1;
+
+ return m_reporter->OnClick(range);
}
CReportView::CReportView(CDocumentMonitor *monitor)
: m_edit(this)
{
m_documentMonitor = monitor;
- memset(m_statistics, 0, sizeof(m_statistics));
}
void CReportView::Reset()
@@ -78,7 +85,6 @@
}
// reset the internal data
- memset(m_statistics, 0, sizeof(m_statistics));
m_references.clear();
}
@@ -101,35 +107,9 @@
return 0;
}
-class UNICODE_TEXT
+void SetSelection(CRichList& edit, int startChar, int endChar)
{
-public:
- UNICODE_TEXT(const std::wstring &text)
- : m_text(text)
- { }
-
- friend std::ostream&
- operator<<(std::ostream& os, const UNICODE_TEXT& value)
- {
- for(std::wstring::const_iterator pos = value.m_text.begin();
- pos != value.m_text.end(); pos++)
- {
- if(*pos < 128)
- os << char(*pos);
- else
- os << "\\u" << int(*pos) << ";";
- }
-
- return os;
- }
-
-private:
- std::wstring m_text;
-};
-
-void SetSelection(CRichList& edit, const std::pair<int,int>& pos)
-{
- edit.SetSel(pos.first, pos.second);
+ edit.SetSel(startChar, endChar);
CHARFORMAT2 cf;
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_LINK;
@@ -137,77 +117,41 @@
edit.SetSelectionCharFormat(cf);
}
-int CReportView::__Print(Reference& reference,
- TReportSeverity severity, const std::wstring& message)
+int CReportView::Print(const ReportMessage& msg)
{
// display the report view
m_documentMonitor->ShowReportView();
- static const char *rtfPrefix =
- "{\\rtf1\\ansi"
- "{\\colortbl;\\red255\\green0\\blue0;}"
- "{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\fs16";
- static const char *rtfSuffix =
- "}";
-
- m_statistics[severity]++;
-
long pos = m_edit.GetWindowTextLength();
// put caret after the last character
m_edit.SetSel(pos, pos);
- std::stringstream sstr;
- sstr << rtfPrefix;
- // depending on severity, change the text style
- switch(severity)
- {
- case RS_REPORT:
- default:
- sstr << UNICODE_TEXT(message);
- break;
- case RS_NOTICE:
- sstr << "\\b " << UNICODE_TEXT(message) << "\\b0 ";
- break;
- case RS_WARNING:
- sstr << "\\cf1 " << UNICODE_TEXT(message) << "\\cf0 ";
- break;
- case RS_ERROR:
- sstr << "\\cf1\\b " << UNICODE_TEXT(message) << "\\b0\\cf0 ";
- break;
- }
+ std::string pstr =
+ "{\\rtf1\\ansi"
+ "{\\colortbl;\\red255\\green0\\blue0;}"
+ "{\\fonttbl\\f0\\fswiss Helvetica;}\\f0\\fs16";
+ pstr += msg.get_text();
+ pstr +=
+ "\\line}";
- // determine what hyperlinks to display
- bool hasShow = !reference.shapes.empty() || reference.drawing != NULL;
- bool hasHelp = !reference.help.empty();
-
- if(hasShow)
- sstr << " [show]";
- if(hasHelp)
- sstr << " [?]";
-
- sstr << "\\line" << rtfSuffix;
-
- std::string pstr = sstr.str();
const char *cstr = pstr.c_str();
EDITSTREAM es = {(DWORD_PTR)&cstr, 0, EditStreamCallBack};
// append RTF to the list
long res = m_edit.StreamIn(SF_RTF | SFF_SELECTION, es);
- // position after the last character
- int cpos = m_edit.GetTextLengthEx(GTL_NUMCHARS)-1;
+ // position of the first character
+ int cpos = m_edit.GetTextLengthEx(GTL_NUMCHARS)-msg.get_length()-1;
- if(hasHelp)
+ for(ReportReferencePtrList::const_iterator rpos = msg.get_references().begin();
+ rpos != msg.get_references().end(); rpos++)
{
- reference.help_pos = std::make_pair<int,int>(cpos-2, cpos-1);
- SetSelection(m_edit, reference.help_pos);
- cpos -= 4; // length of " [?]"
- }
+ ReportReferencePtr ref = *rpos;
+ ref->m_position.cpMin += cpos;
+ ref->m_position.cpMax += cpos;
- if(hasShow)
- {
- reference.show_pos = std::make_pair<int,int>(cpos-5, cpos-1);
- SetSelection(m_edit, reference.show_pos);
+ SetSelection(m_edit, ref->m_position.cpMin, ref->m_position.cpMax);
+ m_references.push_back(ref);
}
m_edit.LineScroll(1);
@@ -217,51 +161,80 @@
int CReportView::Print(TReportSeverity severity, const std::wstring& message,
const std::wstring& help)
{
- Reference reference;
- reference.help = help;
+ ReportMessage msg;
+ msg << ReportMessage::Highlight(severity) << message << ReportMessage::Highlight(RS_REPORT);
- __Print(reference, severity, message);
+ if(!help.empty())
+ msg << " [" << ReportLink("?", help) << "]";
- m_references.push_back(reference);
+ Print(msg);
return 0;
}
int CReportView::Print(TReportSeverity severity, const std::wstring& message,
const std::vector<_bstr_t>& shapelist, const std::wstring& help)
{
- Reference reference;
- reference.shapes = shapelist;
- reference.help = help;
+ ReportMessage msg;
+ msg << ReportMessage::Highlight(severity) << message << ReportMessage::Highlight(RS_REPORT);
- __Print(reference, severity, message);
+ if(!shapelist.empty())
+ msg << " [" << ReportLink("show", shapelist) << "]";
- m_references.push_back(reference);
+ if(!help.empty())
+ msg << " [" << ReportLink("?", help) << "]";
+
+ Print(msg);
return 0;
}
int CReportView::Print(TReportSeverity severity, const std::wstring& message,
const MscPtr& msc, const std::wstring& help)
{
- Reference reference;
- reference.drawing = msc;
- reference.help = help;
+ ReportMessage msg;
+ msg << ReportMessage::Highlight(severity) << message << ReportMessage::Highlight(RS_REPORT);
- __Print(reference, severity, message);
+ if(msc)
+ msg << " [" << ReportLink("show", msc) << "]";
- m_references.push_back(reference);
+ if(!help.empty())
+ msg << " [" << ReportLink("?", help) << "]";
+
+ Print(msg);
return 0;
}
-int CReportView::print(TReportSeverity severity, const std::wstring& message)
+int CReportView::Print(TReportSeverity severity, const std::wstring& message,
+ const std::list<MscPtr>& msclist, const std::wstring& help)
{
- Reference reference;
+ ReportMessage msg;
+ msg << ReportMessage::Highlight(severity) << message << ReportMessage::Highlight(RS_REPORT);
- __Print(reference, severity, message);
+ if(msclist.size() > 1)
+ {
+ int i = 0;
+ msg << " show";
+ for(std::list<MscPtr>::const_iterator mpos = msclist.begin();
+ mpos != msclist.end(); mpos++)
+ {
+ msg << " [" << ReportLink(basic_stringize<char>() << ++i, *mpos) << "]";
+ }
+ }
+ else if(msclist.size() == 1)
+ msg << " [" << ReportLink("show", msclist.front()) << "]";
- m_references.push_back(reference);
+ if(!help.empty())
+ msg << " [" << ReportLink("?", help) << "]";
+
+ Print(msg);
return 0;
}
+int CReportView::print(TReportSeverity severity, const std::wstring& message)
+{
+ Print(ReportMessage() << message);
+ return 0;
+}
+
LRESULT CReportView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LRESULT lRet = DefWindowProc(uMsg, wParam, lParam);
@@ -295,52 +268,32 @@
int line = m_edit.LineFromChar(link->chrg.cpMin);
TRACE("CReportView::OnLink() called on line " << line);
- if(link->chrg.cpMin >= m_references[line].show_pos.first &&
- link->chrg.cpMax <= m_references[line].show_pos.second)
- {
- OnLineShow(line);
- }
- else if(link->chrg.cpMin >= m_references[line].help_pos.first &&
- link->chrg.cpMax <= m_references[line].help_pos.second)
- {
- OnLineHelp(line);
- }
+ OnClick(link->chrg);
}
return 0;
}
-LRESULT CReportView::OnLineShow(size_t line)
+LRESULT CReportView::OnClick(const CHARRANGE& range)
{
- // the user might have clicked beyond the last line
- if(line >= m_references.size())
- return 0;
+ for(ReportReferencePtrList::const_iterator rpos = m_references.begin();
+ rpos != m_references.end(); rpos++)
+ {
+ if((*rpos)->Coincide(range))
+ {
+ (*rpos)->OnClick(m_documentMonitor);
+ return 0;
+ }
+ }
- if(m_references[line].shapes.size() > 0)
- m_documentMonitor->SelectShapes(m_references[line].shapes);
-
- if(m_references[line].drawing != 0)
- m_documentMonitor->DisplayDocument(m_references[line].drawing);
-
return 0;
}
-LRESULT CReportView::OnLineHelp(size_t line)
-{
- if(line >= m_references.size())
- return 0;
-
- m_documentMonitor->InvokeHelp(m_references[line].help);
- return 0;
-}
-
void CReportView::OnFinalMessage(HWND hWnd)
{
TRACE("CReportView::OnFinalMessage() called");
m_references.clear();
- memset(m_statistics, 0, sizeof(m_statistics));
-
m_documentMonitor->OnHideReportView();
}
Modified: trunk/src/view/visio/addon/reportview.h
===================================================================
--- trunk/src/view/visio/addon/reportview.h 2010-02-10 20:46:58 UTC (rev 582)
+++ trunk/src/view/visio/addon/reportview.h 2010-02-10 23:05:56 UTC (rev 583)
@@ -17,6 +17,7 @@
*/
#pragma once
+#include "reportmessage.h"
#include "resource.h"
// Include libraries from the Windows Template Library (WTL).
@@ -24,13 +25,7 @@
#include <atlctrls.h>
#include <atlwin.h>
-#include <vector>
-
-#include "data/msc.h"
-#include "data/reporter.h"
-
class CReportView;
-class CDocumentMonitor;
class CRichList
: public ATL::CWindowImpl<CRichList, CRichEditCtrl>
@@ -58,25 +53,6 @@
CReportView *m_reporter;
};
-struct shapelist
-{
- shapelist & operator << (Visio::IVShapePtr shape)
- {
- _bstr_t reference = shape->UniqueID[visGetOrMakeGUID];
- m_v.push_back(reference);
- return *this;
- }
-
- // note: must not return reference
- operator const std::vector<_bstr_t>() const
- {
- return m_v;
- }
-
-private:
- std::vector<_bstr_t> m_v;
-};
-
class CReportView : public ReportPrinter,
public ATL::CWindowImpl<CReportView, ATL::CWindow, ATL::CNullTraits>
{
@@ -84,6 +60,8 @@
CReportView(CDocumentMonitor *monitor);
void Reset();
+ int Print(const ReportMessage& msg);
+
int Print(TReportSeverity severity, const std::wstring& message,
const std::wstring& help = std::wstring());
int Print(TReportSeverity severity, const std::wstring& message,
@@ -92,6 +70,9 @@
int Print(TReportSeverity severity, const std::wstring& message,
const MscPtr& msc,
const std::wstring& help = std::wstring());
+ int Print(TReportSeverity severity, const std::wstring& message,
+ const std::list<MscPtr>& msclist,
+ const std::wstring& help = std::wstring());
virtual int print(TReportSeverity severity, const std::wstring& message);
@@ -111,38 +92,15 @@
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnLink(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
+ LRESULT OnClick(const CHARRANGE& range);
- LRESULT OnLineShow(size_t line);
- LRESULT OnLineHelp(size_t line);
void OnFinalMessage(HWND hWnd);
private:
CDocumentMonitor *m_documentMonitor;
- CRichList m_edit;
- int m_statistics[__RS_LAST];
-
- struct Reference
- {
- Reference()
- {
- show_pos = std::make_pair<int,int>(0, 0);
- help_pos = std::make_pair<int,int>(0, 0);
- }
-
- std::vector<_bstr_t> shapes; // shapes to select
- MscPtr drawing; // drawing to display
- std::wstring help; // help to display
-
- std::pair<int,int> show_pos;
- std::pair<int,int> help_pos;
- };
-
- int __Print(Reference& reference, TReportSeverity severity, const std::wstring& message);
-
- typedef std::vector<Reference> ReferenceList;
- // UniqueID's of shapes referenced by lines in this report
- ReferenceList m_references;
+ CRichList m_edit; // text of the report
+ ReportReferencePtrList m_references; // hyperlinks
};
// $Id$
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-02-10 20:46:58 UTC (rev 582)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-02-10 23:05:56 UTC (rev 583)
@@ -316,6 +316,14 @@
>
</File>
<File
+ RelativePath=".\reportmessage.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\reportmessage.h"
+ >
+ </File>
+ <File
RelativePath=".\reportview.cpp"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-02-20 23:00:11
|
Revision: 609
http://scstudio.svn.sourceforge.net/scstudio/?rev=609&view=rev
Author: gotthardp
Date: 2010-02-20 23:00:01 +0000 (Sat, 20 Feb 2010)
Log Message:
-----------
Fixed the "select all" function.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/document.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-02-20 22:30:09 UTC (rev 608)
+++ trunk/src/view/visio/addon/addon.cpp 2010-02-20 23:00:01 UTC (rev 609)
@@ -290,10 +290,10 @@
case CDocumentMonitor::MENU_OPTIONS:
TRACE("CStudioAddon::Run() menu item 'Check--Options'");
return DisplayOptions();
- case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES:
+ case CDocumentMonitor::MENU_SELECT_ALL_INSTANCES:
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Instances'");
return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp);
- case CDocumentMonitor::MENU_SELECT_ALL_INSTANCES:
+ case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES:
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'");
return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp);
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-02-20 22:30:09 UTC (rev 608)
+++ trunk/src/view/visio/addon/document.h 2010-02-20 23:00:01 UTC (rev 609)
@@ -57,8 +57,8 @@
MENU_SIMULATION_STOP,
MENU_VERIFY,
MENU_OPTIONS,
- MENU_SELECT_ALL_MESSAGES,
- MENU_SELECT_ALL_INSTANCES
+ MENU_SELECT_ALL_INSTANCES,
+ MENU_SELECT_ALL_MESSAGES
};
VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-02-22 02:39:11
|
Revision: 612
http://scstudio.svn.sourceforge.net/scstudio/?rev=612&view=rev
Author: obouda
Date: 2010-02-22 02:39:03 +0000 (Mon, 22 Feb 2010)
Log Message:
-----------
Added functionality and toolbar buttons for adding all instances/messages to the current selection (as opposed to selecting all instances/messages, when the old selection is dropped)
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
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/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/src/view/visio/addon/icon_select_add_instances.ico
trunk/src/view/visio/addon/icon_select_add_messages.ico
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-02-22 00:01:01 UTC (rev 611)
+++ trunk/src/view/visio/addon/addon.cpp 2010-02-22 02:39:03 UTC (rev 612)
@@ -296,6 +296,12 @@
case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES:
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'");
return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp);
+ case CDocumentMonitor::MENU_SELECT_ADD_ALL_INSTANCES:
+ TRACE("CStudioAddon::Run() add all instances to the current selection");
+ return pDocumentMonitor->OnMenuSelectAddAllInstances(vsoApp);
+ case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES:
+ TRACE("CStudioAddon::Run() add all messages to the current selection");
+ return pDocumentMonitor->OnMenuSelectAddAllMessages(vsoApp);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-02-22 00:01:01 UTC (rev 611)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-02-22 02:39:03 UTC (rev 612)
@@ -190,6 +190,8 @@
IDI_ICON_SELECT_MESSAGES ICON "icon_select_messages.ico"
IDI_ICON_SIMULATION_START ICON "icon_simulation_start.ico"
IDI_ICON_SIMULATION_STOP ICON "icon_simulation_stop.ico"
+IDI_ICON_SELECT_ADD_INSTANCES ICON "icon_select_add_instances.ico"
+IDI_ICON_SELECT_ADD_MESSAGES ICON "icon_select_add_messages.ico"
/////////////////////////////////////////////////////////////////////////////
//
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-22 00:01:01 UTC (rev 611)
+++ trunk/src/view/visio/addon/document.cpp 2010-02-22 02:39:03 UTC (rev 612)
@@ -488,21 +488,36 @@
std::basic_string<TCHAR> vslFileName = GetVisioModuleFileName();
std::basic_string<TCHAR> vslIconFile;
- Visio::IVToolbarItemPtr toolbarItem1 = toolbar->ToolbarItems->Add();
- toolbarItem1->Caption = "Select All Instances";
- toolbarItem1->AddOnName = ADDON_NAME;
- toolbarItem1->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_INSTANCES;
+ Visio::IVToolbarItemPtr itemSelInstances = toolbar->ToolbarItems->Add();
+ itemSelInstances->Caption = "Select All Instances";
+ itemSelInstances->AddOnName = ADDON_NAME;
+ itemSelInstances->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_INSTANCES;
vslIconFile = vslFileName+_T(",2");
- toolbarItem1->IconFileName(vslIconFile.c_str());
- toolbarItem1->BeginGroup = true;
+ itemSelInstances->IconFileName(vslIconFile.c_str());
+ itemSelInstances->BeginGroup = true;
- Visio::IVToolbarItemPtr toolbarItem2 = toolbar->ToolbarItems->Add();
- toolbarItem2->Caption = "Select All Messages";
- toolbarItem2->AddOnName = ADDON_NAME;
- toolbarItem2->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_MESSAGES;
+ Visio::IVToolbarItemPtr itemSelMessages = toolbar->ToolbarItems->Add();
+ itemSelMessages->Caption = "Select All Messages";
+ itemSelMessages->AddOnName = ADDON_NAME;
+ itemSelMessages->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_MESSAGES;
vslIconFile = vslFileName+_T(",3");
- toolbarItem2->IconFileName(vslIconFile.c_str());
+ itemSelMessages->IconFileName(vslIconFile.c_str());
+ Visio::IVToolbarItemPtr itemAddInstances = toolbar->ToolbarItems->Add();
+ itemAddInstances->Caption = "Add All Instances To Selection";
+ itemAddInstances->AddOnName = ADDON_NAME;
+ itemAddInstances->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ADD_ALL_INSTANCES;
+ vslIconFile = vslFileName+_T(",6");
+ itemAddInstances->IconFileName(vslIconFile.c_str());
+
+ Visio::IVToolbarItemPtr itemAddMessages = toolbar->ToolbarItems->Add();
+ itemAddMessages->Caption = "Add All Messages To Selection";
+ itemAddMessages->AddOnName = ADDON_NAME;
+ itemAddMessages->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ADD_ALL_MESSAGES;
+ vslIconFile = vslFileName+_T(",7");
+ itemAddMessages->IconFileName(vslIconFile.c_str());
+
+
Visio::IVToolbarItemPtr itemFindFlow = toolbar->ToolbarItems->Add();
itemFindFlow->Caption = "Find Flow";
itemFindFlow->AddOnName = ADDON_NAME;
@@ -820,14 +835,22 @@
return VAORC_SUCCESS;
}
-// TODO: Doxygen comment
-// for select_instances = true, selects all instances on the active page
-// for select_instances = false, selects all messages (including lost and found messages) on the active page
-void CDocumentMonitor::selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances)
+/**
+ * Selects all instances or all messages on the active page.
+ * @param vsoApp the application to make selection in
+ * @param select_instances when true, selects all instances,
+ * when false, selects all messages (including lost and found messages)
+ * @param add_to_selection when true, adds all objects to existing selection,
+ * when false, the old selection is dropped
+ */
+void CDocumentMonitor::selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, bool add_to_selection)
{
Visio::IVPagePtr page = vsoApp->ActivePage;
- Visio::IVSelectionPtr selection =
- page->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper);
+ Visio::IVSelectionPtr selection;
+ if (add_to_selection)
+ selection = vsoApp->ActiveWindow->Selection;
+ else
+ selection = page->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper);
for(int i=1; i<=page->Shapes->Count; i++)
{
@@ -848,25 +871,32 @@
}
vsoApp->ActiveWindow->Selection = selection;
-/*
- // TODO: do stavoveho radku
- m_reportView->Print(RS_NOTICE,
- stringize() << "Selected " << selection->Count << " shape(s)");
-*/
}
VAORC CDocumentMonitor::OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp)
{
- selectAll(vsoApp, true);
+ selectAll(vsoApp, true, false);
return VAORC_SUCCESS;
}
VAORC CDocumentMonitor::OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp)
{
- selectAll(vsoApp, false);
+ selectAll(vsoApp, false, false);
return VAORC_SUCCESS;
}
+VAORC CDocumentMonitor::OnMenuSelectAddAllInstances(Visio::IVApplicationPtr vsoApp)
+{
+ selectAll(vsoApp, true, true);
+ return VAORC_SUCCESS;
+}
+
+VAORC CDocumentMonitor::OnMenuSelectAddAllMessages(Visio::IVApplicationPtr vsoApp)
+{
+ selectAll(vsoApp, false, true);
+ return VAORC_SUCCESS;
+}
+
VAORC CDocumentMonitor::OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp)
{
if(m_reportVisible)
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-02-22 00:01:01 UTC (rev 611)
+++ trunk/src/view/visio/addon/document.h 2010-02-22 02:39:03 UTC (rev 612)
@@ -58,7 +58,9 @@
MENU_VERIFY,
MENU_OPTIONS,
MENU_SELECT_ALL_INSTANCES,
- MENU_SELECT_ALL_MESSAGES
+ MENU_SELECT_ALL_MESSAGES,
+ MENU_SELECT_ADD_ALL_INSTANCES,
+ MENU_SELECT_ADD_ALL_MESSAGES
};
VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
@@ -68,6 +70,8 @@
VAORC OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index);
VAORC OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp);
+ VAORC OnMenuSelectAddAllInstances(Visio::IVApplicationPtr vsoApp);
+ VAORC OnMenuSelectAddAllMessages(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuFindFlow(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStart(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStop(Visio::IVApplicationPtr vsoApp);
@@ -156,7 +160,16 @@
Visio::IVToolbarItemPtr m_simulationStartToolbarItem;
Visio::IVToolbarItemPtr m_simulationStopToolbarItem;
- void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances);
+ /**
+ * Selects all instances or all messages on the active page.
+ * @param vsoApp the application to make selection in
+ * @param select_instances when true, selects all instances,
+ * when false, selects all messages (including lost and found messages)
+ * @param add_to_selection when true, adds all objects to existing selection,
+ * when false, the old selection is dropped
+ */
+ void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, bool add_to_selection);
+
Visio::IVUIObjectPtr getMostCustomMenus(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
Visio::IVUIObjectPtr getMostCustomToolbars(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
};
Added: trunk/src/view/visio/addon/icon_select_add_instances.ico
===================================================================
(Binary files differ)
Property changes on: trunk/src/view/visio/addon/icon_select_add_instances.ico
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/view/visio/addon/icon_select_add_messages.ico
===================================================================
(Binary files differ)
Property changes on: trunk/src/view/visio/addon/icon_select_add_messages.ico
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-02-22 00:01:01 UTC (rev 611)
+++ trunk/src/view/visio/addon/resource.h 2010-02-22 02:39:03 UTC (rev 612)
@@ -23,12 +23,14 @@
#define IDI_ICON_SELECT_MESSAGES 212
#define IDI_ICON_SIMULATION_START 213
#define IDI_ICON_SIMULATION_STOP 214
+#define IDI_ICON_SELECT_ADD_INSTANCES 216
+#define IDI_ICON_SELECT_ADD_MESSAGES 217
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 215
+#define _APS_NEXT_RESOURCE_VALUE 216
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 209
#define _APS_NEXT_SYMED_VALUE 105
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-02-22 00:01:01 UTC (rev 611)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-02-22 02:39:03 UTC (rev 612)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="scstudio"
ProjectGUID="{0E00282C-F48B-4984-A274-5B59E1E2AD49}"
RootNamespace="scstudio"
@@ -398,6 +398,14 @@
>
</File>
<File
+ RelativePath=".\icon_select_add_instances.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\icon_select_add_messages.ico"
+ >
+ </File>
+ <File
RelativePath=".\icon_select_instances.ico"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-02-28 18:02:09
|
Revision: 634
http://scstudio.svn.sourceforge.net/scstudio/?rev=634&view=rev
Author: obouda
Date: 2010-02-28 18:01:43 +0000 (Sun, 28 Feb 2010)
Log Message:
-----------
New feature: buttons selecting all instances/messages add to selection while Ctrl is held. The two buttons specific for adding were removed.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
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/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Removed Paths:
-------------
trunk/src/view/visio/addon/icon_select_add_instances.ico
trunk/src/view/visio/addon/icon_select_add_messages.ico
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-02-28 17:09:12 UTC (rev 633)
+++ trunk/src/view/visio/addon/addon.cpp 2010-02-28 18:01:43 UTC (rev 634)
@@ -296,16 +296,16 @@
return DisplayCheckOptions();
case CDocumentMonitor::MENU_SELECT_ALL_INSTANCES:
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Instances'");
- return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp);
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, false);
case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES:
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'");
- return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp);
- case CDocumentMonitor::MENU_SELECT_ADD_ALL_INSTANCES:
- TRACE("CStudioAddon::Run() add all instances to the current selection");
- return pDocumentMonitor->OnMenuSelectAddAllInstances(vsoApp);
- case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES:
- TRACE("CStudioAddon::Run() add all messages to the current selection");
- return pDocumentMonitor->OnMenuSelectAddAllMessages(vsoApp);
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, false);
+ case CDocumentMonitor::MENU_SELECT_OR_ADD_ALL_INSTANCES:
+ TRACE("CStudioAddon::Run() select or add all instances to the current selection");
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, m_ControlPressed);
+ case CDocumentMonitor::MENU_SELECT_OR_ADD_ALL_MESSAGES:
+ TRACE("CStudioAddon::Run() select or add all messages to the current selection");
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, m_ControlPressed);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
@@ -402,7 +402,17 @@
TRACE("CStudioAddon::HandleVisioEvent() visEvtMarker");
HandleMarker(pSubjectObj);
break;
+
+ case Visio::visEvtCodeKeyDown:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeKeyDown");
+ HandleKeyDown(pSubjectObj, pSourceObj);
+ break;
+ case Visio::visEvtCodeKeyUp:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeKeyUp");
+ HandleKeyUp(pSubjectObj, pSourceObj);
+ break;
+
default:
TRACE("CStudioAddon::HandleVisioEvent() unexpected event id="
<< std::ios::hex << event);
@@ -489,6 +499,18 @@
}
}
+void CStudioAddon::HandleKeyDown(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
+{
+ if (vsoKeyboardEvent->KeyButtonState & Visio::visKeyControl) {
+ m_ControlPressed = true;
+ }
+}
+
+void CStudioAddon::HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
+{
+ m_ControlPressed = false;
+}
+
void CStudioAddon::RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument)
{
Visio::IVEventPtr vsoDocumentCreateEvent = NULL;
@@ -556,11 +578,15 @@
m_vsoMarkerEvent = vsoApplicationEventList->AddAdvise(visEvtApp|visEvtMarker, varSink, _T(""), _T(""));
}
+ // register key listening
+ vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyDown, varSink, _T(""), _T("KeyDown"));
+ vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyUp, varSink, _T(""), _T("KeyUp"));
+
// Create a monitor class to keep track of this document and the Events
// being monitored for this document.
pDocumentMonitor = new CDocumentMonitor(this, vsoApp, vsoDocument);
- pDocumentMonitor->InitMenu(vsoApp, vsoDocument);
- pDocumentMonitor->InitToolbar(vsoApp, vsoDocument);
+ pDocumentMonitor->InitMenu();
+ pDocumentMonitor->InitToolbar();
// register BeforeDocumentClose
vsoEvent = vsoDocumentEventList->AddAdvise(visEvtBeforeDocumentClose, varSink, _T(""), _T(""));
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-02-28 17:09:12 UTC (rev 633)
+++ trunk/src/view/visio/addon/addon.h 2010-02-28 18:01:43 UTC (rev 634)
@@ -50,6 +50,8 @@
void HandleCellChanged(Visio::IVCellPtr vsoCell);
void HandleConnectionsAdded(Visio::IVConnectsPtr vsoConnects);
void HandleMarker(Visio::IVApplicationPtr vsoApp);
+ void HandleKeyDown(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
+ void HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
void RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument);
CDocumentMonitor *GetDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
@@ -61,6 +63,8 @@
typedef std::map<long, CDocumentMonitor*> DocumentMonitorsMap;
DocumentMonitorsMap m_DocumentMonitors;
+
+ bool m_ControlPressed;
};
// $Id$
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-02-28 17:09:12 UTC (rev 633)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-02-28 18:01:43 UTC (rev 634)
@@ -217,8 +217,6 @@
IDI_ICON_SELECT_MESSAGES ICON "icon_select_messages.ico"
IDI_ICON_SIMULATION_START ICON "icon_simulation_start.ico"
IDI_ICON_SIMULATION_STOP ICON "icon_simulation_stop.ico"
-IDI_ICON_SELECT_ADD_INSTANCES ICON "icon_select_add_instances.ico"
-IDI_ICON_SELECT_ADD_MESSAGES ICON "icon_select_add_messages.ico"
/////////////////////////////////////////////////////////////////////////////
//
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-28 17:09:12 UTC (rev 633)
+++ trunk/src/view/visio/addon/document.cpp 2010-02-28 18:01:43 UTC (rev 634)
@@ -300,41 +300,41 @@
return VAORC_SUCCESS;
}
-Visio::IVUIObjectPtr CDocumentMonitor::getMostCustomMenus(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+Visio::IVUIObjectPtr CDocumentMonitor::GetMostCustomMenus()
{
- if(vsoDocument != NULL)
+ if(m_vsoDocument != NULL)
{
- Visio::IVUIObjectPtr docMenus = vsoDocument->CustomMenus;
+ Visio::IVUIObjectPtr docMenus = m_vsoDocument->CustomMenus;
if(docMenus != NULL)
return docMenus->Clone; // document-specific menus are defined
}
- Visio::IVUIObjectPtr appMenus = vsoApp->CustomMenus;
+ Visio::IVUIObjectPtr appMenus = m_vsoApp->CustomMenus;
if(appMenus != NULL)
return appMenus->Clone; // application custom menus are defined
- return vsoApp->BuiltInMenus; // gets a clone
+ return m_vsoApp->BuiltInMenus; // gets a clone
}
-Visio::IVUIObjectPtr CDocumentMonitor::getMostCustomToolbars(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+Visio::IVUIObjectPtr CDocumentMonitor::GetMostCustomToolbars()
{
- if(vsoDocument != NULL)
+ if(m_vsoDocument != NULL)
{
- Visio::IVUIObjectPtr docToolbars = vsoDocument->CustomToolbars;
+ Visio::IVUIObjectPtr docToolbars = m_vsoDocument->CustomToolbars;
if(docToolbars != NULL)
return docToolbars->Clone;
}
- Visio::IVUIObjectPtr appToolbars = vsoApp->CustomToolbars;
+ Visio::IVUIObjectPtr appToolbars = m_vsoApp->CustomToolbars;
if(appToolbars != NULL)
return appToolbars->Clone;
- return vsoApp->GetBuiltInToolbars(0);
+ return m_vsoApp->GetBuiltInToolbars(0);
}
-void CDocumentMonitor::InitMenu(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+void CDocumentMonitor::InitMenu()
{
- Visio::IVUIObjectPtr vsoMenus = getMostCustomMenus(vsoApp, vsoDocument);
+ Visio::IVUIObjectPtr vsoMenus = GetMostCustomMenus();
// step 1: create custom menu
Visio::IVMenuSetPtr menuSet = vsoMenus->MenuSets->ItemAtID[Visio::visUIObjSetDrawing];
@@ -343,7 +343,7 @@
menu->Caption = "&Check";
// many functions are not working in OLE window: repaint, import, error display
// disable verification functions when opened from OLE window
- menu->Enabled = !vsoDocument->InPlace;
+ menu->Enabled = !m_vsoDocument->InPlace;
std::basic_string<TCHAR> vslFileName = GetVisioModuleFileName();
std::basic_string<TCHAR> vslIconFile;
@@ -476,53 +476,38 @@
accelItemSelectMessages->Control = true;
accelItemSelectMessages->Alt = true;
- vsoDocument->SetCustomMenus(vsoMenus);
+ m_vsoDocument->SetCustomMenus(vsoMenus);
}
-void CDocumentMonitor::InitToolbar(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument)
+void CDocumentMonitor::InitToolbar()
{
- Visio::IVUIObjectPtr vsoToolbars = getMostCustomToolbars(vsoApp, vsoDocument);
+ Visio::IVUIObjectPtr vsoToolbars = GetMostCustomToolbars();
Visio::IVToolbarSetPtr toolbarSet = vsoToolbars->ToolbarSets->ItemAtID[Visio::visUIObjSetDrawing];
Visio::IVToolbarPtr toolbar = toolbarSet->Toolbars->Add();
toolbar->Caption = "Sequence Chart";
// many functions are not working in OLE window: repaint, import, error display
// disable verification functions when opened from OLE window
- toolbar->Enabled = !vsoDocument->InPlace;
+ toolbar->Enabled = !m_vsoDocument->InPlace;
std::basic_string<TCHAR> vslFileName = GetVisioModuleFileName();
std::basic_string<TCHAR> vslIconFile;
- Visio::IVToolbarItemPtr itemSelInstances = toolbar->ToolbarItems->Add();
- itemSelInstances->Caption = "Select All Instances";
- itemSelInstances->AddOnName = ADDON_NAME;
- itemSelInstances->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_INSTANCES;
+ m_selInstancesMenuItem = toolbar->ToolbarItems->Add();
+ m_selInstancesMenuItem->Caption = "Select All Instances";
+ m_selInstancesMenuItem->AddOnName = ADDON_NAME;
+ m_selInstancesMenuItem->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_OR_ADD_ALL_INSTANCES;
vslIconFile = vslFileName+_T(",2");
- itemSelInstances->IconFileName(vslIconFile.c_str());
- itemSelInstances->BeginGroup = true;
+ m_selInstancesMenuItem->IconFileName(vslIconFile.c_str());
+ m_selInstancesMenuItem->BeginGroup = true;
- Visio::IVToolbarItemPtr itemSelMessages = toolbar->ToolbarItems->Add();
- itemSelMessages->Caption = "Select All Messages";
- itemSelMessages->AddOnName = ADDON_NAME;
- itemSelMessages->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_MESSAGES;
+ m_selMessagesMenuItem = toolbar->ToolbarItems->Add();
+ m_selMessagesMenuItem->Caption = "Select All Messages";
+ m_selMessagesMenuItem->AddOnName = ADDON_NAME;
+ m_selMessagesMenuItem->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_OR_ADD_ALL_MESSAGES;
vslIconFile = vslFileName+_T(",3");
- itemSelMessages->IconFileName(vslIconFile.c_str());
+ m_selMessagesMenuItem->IconFileName(vslIconFile.c_str());
- Visio::IVToolbarItemPtr itemAddInstances = toolbar->ToolbarItems->Add();
- itemAddInstances->Caption = "Add All Instances To Selection";
- itemAddInstances->AddOnName = ADDON_NAME;
- itemAddInstances->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ADD_ALL_INSTANCES;
- vslIconFile = vslFileName+_T(",6");
- itemAddInstances->IconFileName(vslIconFile.c_str());
-
- Visio::IVToolbarItemPtr itemAddMessages = toolbar->ToolbarItems->Add();
- itemAddMessages->Caption = "Add All Messages To Selection";
- itemAddMessages->AddOnName = ADDON_NAME;
- itemAddMessages->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ADD_ALL_MESSAGES;
- vslIconFile = vslFileName+_T(",7");
- itemAddMessages->IconFileName(vslIconFile.c_str());
-
-
Visio::IVToolbarItemPtr itemFindFlow = toolbar->ToolbarItems->Add();
itemFindFlow->Caption = "Find Flow";
itemFindFlow->AddOnName = ADDON_NAME;
@@ -559,7 +544,7 @@
itemVerify->IconFileName(vslIconFile.c_str());
itemVerify->BeginGroup = true;
- vsoDocument->SetCustomToolbars(vsoToolbars);
+ m_vsoDocument->SetCustomToolbars(vsoToolbars);
}
TransformerPtrList::const_iterator CDocumentMonitor::find_transformer(const std::wstring& name) const
@@ -878,30 +863,18 @@
vsoApp->ActiveWindow->Selection = selection;
}
-VAORC CDocumentMonitor::OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp)
+VAORC CDocumentMonitor::OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp, bool add)
{
- selectAll(vsoApp, true, false);
+ selectAll(vsoApp, true, add);
return VAORC_SUCCESS;
}
-VAORC CDocumentMonitor::OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp)
+VAORC CDocumentMonitor::OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp, bool add)
{
- selectAll(vsoApp, false, false);
+ selectAll(vsoApp, false, add);
return VAORC_SUCCESS;
}
-VAORC CDocumentMonitor::OnMenuSelectAddAllInstances(Visio::IVApplicationPtr vsoApp)
-{
- selectAll(vsoApp, true, true);
- return VAORC_SUCCESS;
-}
-
-VAORC CDocumentMonitor::OnMenuSelectAddAllMessages(Visio::IVApplicationPtr vsoApp)
-{
- selectAll(vsoApp, false, true);
- return VAORC_SUCCESS;
-}
-
VAORC CDocumentMonitor::OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp)
{
if(m_reportVisible)
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-02-28 17:09:12 UTC (rev 633)
+++ trunk/src/view/visio/addon/document.h 2010-02-28 18:01:43 UTC (rev 634)
@@ -43,8 +43,8 @@
VAORC OnDropShape(int iDocumentIndex, int iPageIndex, _bstr_t sShapeU);
VAORC OnOpenReference(int iDocumentIndex, int iPageIndex, _bstr_t sShapeU);
- void InitMenu(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
- void InitToolbar(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
+ void InitMenu();
+ void InitToolbar();
enum MenuItems
{
@@ -60,8 +60,8 @@
MENU_CHECK_OPTIONS,
MENU_SELECT_ALL_INSTANCES,
MENU_SELECT_ALL_MESSAGES,
- MENU_SELECT_ADD_ALL_INSTANCES,
- MENU_SELECT_ADD_ALL_MESSAGES
+ MENU_SELECT_OR_ADD_ALL_INSTANCES,
+ MENU_SELECT_OR_ADD_ALL_MESSAGES,
};
VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
@@ -69,10 +69,8 @@
VAORC OnMenuExport(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuRepaint(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index);
- VAORC OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp);
- VAORC OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp);
- VAORC OnMenuSelectAddAllInstances(Visio::IVApplicationPtr vsoApp);
- VAORC OnMenuSelectAddAllMessages(Visio::IVApplicationPtr vsoApp);
+ VAORC OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp, bool add);
+ VAORC OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp, bool add);
VAORC OnMenuFindFlow(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStart(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStop(Visio::IVApplicationPtr vsoApp);
@@ -160,6 +158,9 @@
Visio::IVToolbarItemPtr m_simulationStartToolbarItem;
Visio::IVToolbarItemPtr m_simulationStopToolbarItem;
+ Visio::IVToolbarItemPtr m_selInstancesMenuItem;
+ Visio::IVToolbarItemPtr m_selMessagesMenuItem;
+
/**
* Selects all instances or all messages on the active page.
* @param vsoApp the application to make selection in
@@ -170,8 +171,8 @@
*/
void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, bool add_to_selection);
- Visio::IVUIObjectPtr getMostCustomMenus(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
- Visio::IVUIObjectPtr getMostCustomToolbars(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
+ Visio::IVUIObjectPtr GetMostCustomMenus();
+ Visio::IVUIObjectPtr GetMostCustomToolbars();
};
// $Id$
Deleted: trunk/src/view/visio/addon/icon_select_add_instances.ico
===================================================================
(Binary files differ)
Deleted: trunk/src/view/visio/addon/icon_select_add_messages.ico
===================================================================
(Binary files differ)
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-02-28 17:09:12 UTC (rev 633)
+++ trunk/src/view/visio/addon/resource.h 2010-02-28 18:01:43 UTC (rev 634)
@@ -23,8 +23,6 @@
#define IDI_ICON_SELECT_MESSAGES 212
#define IDI_ICON_SIMULATION_START 213
#define IDI_ICON_SIMULATION_STOP 214
-#define IDI_ICON_SELECT_ADD_INSTANCES 215
-#define IDI_ICON_SELECT_ADD_MESSAGES 216
#define IDC_SIM_MESSAGE_DELAY 218
#define IDC_SIM_BIN_WIDTH 219
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-02-28 17:09:12 UTC (rev 633)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-02-28 18:01:43 UTC (rev 634)
@@ -406,14 +406,6 @@
>
</File>
<File
- RelativePath=".\icon_select_add_instances.ico"
- >
- </File>
- <File
- RelativePath=".\icon_select_add_messages.ico"
- >
- </File>
- <File
RelativePath=".\icon_select_instances.ico"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-02-28 18:33:00
|
Revision: 636
http://scstudio.svn.sourceforge.net/scstudio/?rev=636&view=rev
Author: obouda
Date: 2010-02-28 18:32:50 +0000 (Sun, 28 Feb 2010)
Log Message:
-----------
The same feature as in r634 with Shift.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-02-28 18:07:48 UTC (rev 635)
+++ trunk/src/view/visio/addon/addon.cpp 2010-02-28 18:32:50 UTC (rev 636)
@@ -55,6 +55,8 @@
: VAddon(VAO_AOATTS_ISACTION | VAO_AOATTS_HASABOUT, VAO_ENABLEALWAYS, 0, 0, pName, uIDLocalName)
{
m_pIAddonSink = NULL;
+ m_ControlPressed = false;
+ m_ShiftPressed = false;
};
VAORC CStudioAddon::About(LPVAOV2LSTRUCT pV2L)
@@ -302,10 +304,10 @@
return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, false);
case CDocumentMonitor::MENU_SELECT_OR_ADD_ALL_INSTANCES:
TRACE("CStudioAddon::Run() select or add all instances to the current selection");
- return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, m_ControlPressed);
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, m_ControlPressed || m_ShiftPressed);
case CDocumentMonitor::MENU_SELECT_OR_ADD_ALL_MESSAGES:
TRACE("CStudioAddon::Run() select or add all messages to the current selection");
- return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, m_ControlPressed);
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, m_ControlPressed || m_ShiftPressed);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
@@ -504,11 +506,15 @@
if (vsoKeyboardEvent->KeyButtonState & Visio::visKeyControl) {
m_ControlPressed = true;
}
+ if (vsoKeyboardEvent->KeyButtonState & Visio::visKeyShift) {
+ m_ShiftPressed = true;
+ }
}
void CStudioAddon::HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
{
m_ControlPressed = false;
+ m_ShiftPressed = false;
}
void CStudioAddon::RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument)
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-02-28 18:07:48 UTC (rev 635)
+++ trunk/src/view/visio/addon/addon.h 2010-02-28 18:32:50 UTC (rev 636)
@@ -65,6 +65,7 @@
DocumentMonitorsMap m_DocumentMonitors;
bool m_ControlPressed;
+ bool m_ShiftPressed;
};
// $Id$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-02-28 21:23:36
|
Revision: 637
http://scstudio.svn.sourceforge.net/scstudio/?rev=637&view=rev
Author: obouda
Date: 2010-02-28 21:23:21 +0000 (Sun, 28 Feb 2010)
Log Message:
-----------
Improved feature from r634 - now the selection buttons change while pressing Ctrl/Shift.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
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/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/src/view/visio/addon/icon_select_add_instances.ico
trunk/src/view/visio/addon/icon_select_add_messages.ico
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-02-28 18:32:50 UTC (rev 636)
+++ trunk/src/view/visio/addon/addon.cpp 2010-02-28 21:23:21 UTC (rev 637)
@@ -302,12 +302,12 @@
case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES:
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'");
return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, false);
- case CDocumentMonitor::MENU_SELECT_OR_ADD_ALL_INSTANCES:
- TRACE("CStudioAddon::Run() select or add all instances to the current selection");
- return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, m_ControlPressed || m_ShiftPressed);
- case CDocumentMonitor::MENU_SELECT_OR_ADD_ALL_MESSAGES:
- TRACE("CStudioAddon::Run() select or add all messages to the current selection");
- return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, m_ControlPressed || m_ShiftPressed);
+ case CDocumentMonitor::MENU_SELECT_ADD_ALL_INSTANCES:
+ TRACE("CStudioAddon::Run() add all instances to the current selection");
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, true);
+ case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES:
+ TRACE("CStudioAddon::Run() add all messages to the current selection");
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, true);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
@@ -503,6 +503,10 @@
void CStudioAddon::HandleKeyDown(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
{
+ if (!m_ControlPressed && !m_ShiftPressed) {
+ GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItemsToAdd(true);
+ }
+
if (vsoKeyboardEvent->KeyButtonState & Visio::visKeyControl) {
m_ControlPressed = true;
}
@@ -513,6 +517,9 @@
void CStudioAddon::HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
{
+ if (m_ControlPressed || m_ShiftPressed) {
+ GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItemsToAdd(false);
+ }
m_ControlPressed = false;
m_ShiftPressed = false;
}
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-02-28 18:32:50 UTC (rev 636)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-02-28 21:23:21 UTC (rev 637)
@@ -217,6 +217,8 @@
IDI_ICON_SELECT_MESSAGES ICON "icon_select_messages.ico"
IDI_ICON_SIMULATION_START ICON "icon_simulation_start.ico"
IDI_ICON_SIMULATION_STOP ICON "icon_simulation_stop.ico"
+IDI_ICON_SELECT_ADD_INSTANCES ICON "icon_select_add_instances.ico"
+IDI_ICON_SELECT_ADD_MESSAGES ICON "icon_select_add_messages.ico"
/////////////////////////////////////////////////////////////////////////////
//
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-28 18:32:50 UTC (rev 636)
+++ trunk/src/view/visio/addon/document.cpp 2010-02-28 21:23:21 UTC (rev 637)
@@ -483,32 +483,49 @@
{
Visio::IVUIObjectPtr vsoToolbars = GetMostCustomToolbars();
Visio::IVToolbarSetPtr toolbarSet = vsoToolbars->ToolbarSets->ItemAtID[Visio::visUIObjSetDrawing];
- Visio::IVToolbarPtr toolbar = toolbarSet->Toolbars->Add();
+ m_toolbar = toolbarSet->Toolbars->Add();
- toolbar->Caption = "Sequence Chart";
+ m_toolbar->Caption = "Sequence Chart";
// many functions are not working in OLE window: repaint, import, error display
// disable verification functions when opened from OLE window
- toolbar->Enabled = !m_vsoDocument->InPlace;
+ m_toolbar->Enabled = !m_vsoDocument->InPlace;
std::basic_string<TCHAR> vslFileName = GetVisioModuleFileName();
std::basic_string<TCHAR> vslIconFile;
- m_selInstancesMenuItem = toolbar->ToolbarItems->Add();
- m_selInstancesMenuItem->Caption = "Select All Instances";
- m_selInstancesMenuItem->AddOnName = ADDON_NAME;
- m_selInstancesMenuItem->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_OR_ADD_ALL_INSTANCES;
+ m_selInstancesToolbarItem = m_toolbar->ToolbarItems->Add();
+ m_selInstancesToolbarItem->Caption = "Select All Instances";
+ m_selInstancesToolbarItem->AddOnName = ADDON_NAME;
+ m_selInstancesToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_INSTANCES;
vslIconFile = vslFileName+_T(",2");
- m_selInstancesMenuItem->IconFileName(vslIconFile.c_str());
- m_selInstancesMenuItem->BeginGroup = true;
+ m_selInstancesToolbarItem->IconFileName(vslIconFile.c_str());
+ m_selInstancesToolbarItem->BeginGroup = true;
- m_selMessagesMenuItem = toolbar->ToolbarItems->Add();
- m_selMessagesMenuItem->Caption = "Select All Messages";
- m_selMessagesMenuItem->AddOnName = ADDON_NAME;
- m_selMessagesMenuItem->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_OR_ADD_ALL_MESSAGES;
+ m_selMessagesToolbarItem = m_toolbar->ToolbarItems->Add();
+ m_selMessagesToolbarItem->Caption = "Select All Messages";
+ m_selMessagesToolbarItem->AddOnName = ADDON_NAME;
+ m_selMessagesToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_MESSAGES;
vslIconFile = vslFileName+_T(",3");
- m_selMessagesMenuItem->IconFileName(vslIconFile.c_str());
+ m_selMessagesToolbarItem->IconFileName(vslIconFile.c_str());
- Visio::IVToolbarItemPtr itemFindFlow = toolbar->ToolbarItems->Add();
+ m_selAddInstancesToolbarItem = m_toolbar->ToolbarItems->Add();
+ m_selAddInstancesToolbarItem->Caption = "Add All Instances To Selection";
+ m_selAddInstancesToolbarItem->AddOnName = ADDON_NAME;
+ m_selAddInstancesToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ADD_ALL_INSTANCES;
+ vslIconFile = vslFileName+_T(",6");
+ m_selAddInstancesToolbarItem->IconFileName(vslIconFile.c_str());
+ m_selAddInstancesToolbarItem->Visible = false;
+
+ m_selAddMessagesToolbarItem = m_toolbar->ToolbarItems->Add();
+ m_selAddMessagesToolbarItem->Caption = "Add All Messages To Selection";
+ m_selAddMessagesToolbarItem->AddOnName = ADDON_NAME;
+ m_selAddMessagesToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ADD_ALL_MESSAGES;
+ vslIconFile = vslFileName+_T(",7");
+ m_selAddMessagesToolbarItem->IconFileName(vslIconFile.c_str());
+ m_selAddMessagesToolbarItem->Visible = false;
+
+
+ Visio::IVToolbarItemPtr itemFindFlow = m_toolbar->ToolbarItems->Add();
itemFindFlow->Caption = "Find Flow";
itemFindFlow->AddOnName = ADDON_NAME;
itemFindFlow->AddOnArgs = stringize() << L"/event=" << MENU_FIND_FLOW;
@@ -517,7 +534,7 @@
vslIconFile = vslFileName+_T(",1");
itemFindFlow->IconFileName(vslIconFile.c_str());
- m_simulationStartToolbarItem = toolbar->ToolbarItems->Add();
+ m_simulationStartToolbarItem = m_toolbar->ToolbarItems->Add();
m_simulationStartToolbarItem->Caption = "Start Simulation";
m_simulationStartToolbarItem->AddOnName = ADDON_NAME;
m_simulationStartToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_SIMULATION_START;
@@ -526,7 +543,7 @@
vslIconFile = vslFileName+_T(",4");
m_simulationStartToolbarItem->IconFileName(vslIconFile.c_str());
- m_simulationStopToolbarItem = toolbar->ToolbarItems->Add();
+ m_simulationStopToolbarItem = m_toolbar->ToolbarItems->Add();
m_simulationStopToolbarItem->Caption = "Stop Simulation";
m_simulationStopToolbarItem->AddOnName = ADDON_NAME;
m_simulationStopToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_SIMULATION_STOP;
@@ -536,7 +553,7 @@
vslIconFile = vslFileName+_T(",5");
m_simulationStopToolbarItem->IconFileName(vslIconFile.c_str());
- Visio::IVToolbarItemPtr itemVerify = toolbar->ToolbarItems->Add();
+ Visio::IVToolbarItemPtr itemVerify = m_toolbar->ToolbarItems->Add();
itemVerify->Caption = "Verify";
itemVerify->AddOnName = ADDON_NAME;
itemVerify->AddOnArgs = stringize() << L"/event=" << MENU_VERIFY;
@@ -547,6 +564,16 @@
m_vsoDocument->SetCustomToolbars(vsoToolbars);
}
+void CDocumentMonitor::ToggleToolbarItemsToAdd(bool add)
+{
+ m_selInstancesToolbarItem->Visible = !add;
+ m_selMessagesToolbarItem->Visible = !add;
+ m_selAddInstancesToolbarItem->Visible = add;
+ m_selAddMessagesToolbarItem->Visible = add;
+
+ m_vsoDocument->CustomToolbars->UpdateUI();
+}
+
TransformerPtrList::const_iterator CDocumentMonitor::find_transformer(const std::wstring& name) const
{
for(TransformerPtrList::const_iterator cpos = m_transformers.begin();
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-02-28 18:32:50 UTC (rev 636)
+++ trunk/src/view/visio/addon/document.h 2010-02-28 21:23:21 UTC (rev 637)
@@ -60,8 +60,8 @@
MENU_CHECK_OPTIONS,
MENU_SELECT_ALL_INSTANCES,
MENU_SELECT_ALL_MESSAGES,
- MENU_SELECT_OR_ADD_ALL_INSTANCES,
- MENU_SELECT_OR_ADD_ALL_MESSAGES,
+ MENU_SELECT_ADD_ALL_INSTANCES,
+ MENU_SELECT_ADD_ALL_MESSAGES,
};
VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
@@ -94,6 +94,8 @@
void OnSimulationResult();
void OnSimulationError();
+ void ToggleToolbarItemsToAdd(bool add);
+
// event objects for this document
Visio::IVEventPtr m_vsoPageAddedEvent;
Visio::IVEventPtr m_vsoBeforeDocumentClosedEvent;
@@ -153,13 +155,17 @@
CReportView *m_reportView;
ConfigProvider *m_configProvider;
+ Visio::IVToolbarPtr m_toolbar;
+
Visio::IVMenuItemPtr m_simulationStartMenuItem;
Visio::IVMenuItemPtr m_simulationStopMenuItem;
Visio::IVToolbarItemPtr m_simulationStartToolbarItem;
Visio::IVToolbarItemPtr m_simulationStopToolbarItem;
- Visio::IVToolbarItemPtr m_selInstancesMenuItem;
- Visio::IVToolbarItemPtr m_selMessagesMenuItem;
+ Visio::IVToolbarItemPtr m_selInstancesToolbarItem;
+ Visio::IVToolbarItemPtr m_selMessagesToolbarItem;
+ Visio::IVToolbarItemPtr m_selAddInstancesToolbarItem;
+ Visio::IVToolbarItemPtr m_selAddMessagesToolbarItem;
/**
* Selects all instances or all messages on the active page.
Added: trunk/src/view/visio/addon/icon_select_add_instances.ico
===================================================================
(Binary files differ)
Property changes on: trunk/src/view/visio/addon/icon_select_add_instances.ico
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/view/visio/addon/icon_select_add_messages.ico
===================================================================
(Binary files differ)
Property changes on: trunk/src/view/visio/addon/icon_select_add_messages.ico
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-02-28 18:32:50 UTC (rev 636)
+++ trunk/src/view/visio/addon/resource.h 2010-02-28 21:23:21 UTC (rev 637)
@@ -24,13 +24,15 @@
#define IDI_ICON_SIMULATION_START 213
#define IDI_ICON_SIMULATION_STOP 214
#define IDC_SIM_MESSAGE_DELAY 218
+#define IDI_ICON_SELECT_ADD_INSTANCES 218
#define IDC_SIM_BIN_WIDTH 219
+#define IDI_ICON_SELECT_ADD_MESSAGES 219
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 217
+#define _APS_NEXT_RESOURCE_VALUE 220
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 220
#define _APS_NEXT_SYMED_VALUE 105
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-02-28 18:32:50 UTC (rev 636)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-02-28 21:23:21 UTC (rev 637)
@@ -406,6 +406,14 @@
>
</File>
<File
+ RelativePath=".\icon_select_add_instances.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\icon_select_add_messages.ico"
+ >
+ </File>
+ <File
RelativePath=".\icon_select_instances.ico"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-02-28 22:12:27
|
Revision: 638
http://scstudio.svn.sourceforge.net/scstudio/?rev=638&view=rev
Author: gotthardp
Date: 2010-02-28 22:12:17 +0000 (Sun, 28 Feb 2010)
Log Message:
-----------
Prettier icons.
Modified Paths:
--------------
trunk/src/view/visio/addon/icon_select_add_instances.ico
trunk/src/view/visio/addon/icon_select_add_messages.ico
Modified: trunk/src/view/visio/addon/icon_select_add_instances.ico
===================================================================
(Binary files differ)
Modified: trunk/src/view/visio/addon/icon_select_add_messages.ico
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-03-01 13:37:45
|
Revision: 639
http://scstudio.svn.sourceforge.net/scstudio/?rev=639&view=rev
Author: obouda
Date: 2010-03-01 13:37:38 +0000 (Mon, 01 Mar 2010)
Log Message:
-----------
New feature: Instances field - GUI only for the moment
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
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/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
trunk/src/view/visio/addon/stdafx.h
Added Paths:
-----------
trunk/src/view/visio/addon/instancesfielddlg.cpp
trunk/src/view/visio/addon/instancesfielddlg.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-02-28 22:12:17 UTC (rev 638)
+++ trunk/src/view/visio/addon/addon.cpp 2010-03-01 13:37:38 UTC (rev 639)
@@ -22,6 +22,7 @@
#include "aboutdlg.h"
#include "SimulatorDlg.h"
#include "optionsdlg.h"
+#include "instancesfielddlg.h"
#include "document.h"
#include "extract.h"
#include "errors.h"
@@ -308,6 +309,15 @@
case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES:
TRACE("CStudioAddon::Run() add all messages to the current selection");
return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, true);
+ case CDocumentMonitor::MENU_INSTANCES_FIELD:
+ {
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Instances Field'");
+ VAORC result = DisplayInstancesFieldDialog();
+ if (result != VAORC_SUCCESS)
+ return result;
+ else
+ return pDocumentMonitor->OnMenuInstancesField(vsoApp);
+ }
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
@@ -366,6 +376,15 @@
return VAORC_SUCCESS;
}
+VAORC CStudioAddon::DisplayInstancesFieldDialog()
+{
+ TRACE("CStudioAddon::DisplayInstancesFieldDialog() called");
+ CInstancesFieldDlg dlg;
+
+ dlg.DoModal();
+ return VAORC_SUCCESS;
+}
+
HRESULT CStudioAddon::HandleVisioEvent(
IUnknown *ipSink, short nEventCode, IDispatch *pSourceObj, long nEventID,
long nEventSeqNum, IDispatch *pSubjectObj, VARIANT vMoreInfo, VARIANT *pvResult)
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-02-28 22:12:17 UTC (rev 638)
+++ trunk/src/view/visio/addon/addon.h 2010-03-01 13:37:38 UTC (rev 639)
@@ -36,6 +36,7 @@
VAORC DisplaySimulatorOptions();
VAORC DisplayCheckOptions();
+ VAORC DisplayInstancesFieldDialog();
virtual HRESULT HandleVisioEvent(
IUnknown *ipSink, // [in] ipSink [assert]
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-02-28 22:12:17 UTC (rev 638)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-03-01 13:37:38 UTC (rev 639)
@@ -23,6 +23,22 @@
/////////////////////////////////////////////////////////////////////////////
//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON_CHECK ICON "icon_check.ico"
+IDI_ICON_FIND_FLOW ICON "icon_findflow.ico"
+IDI_ICON_SELECT_INSTANCES ICON "icon_select_instances.ico"
+IDI_ICON_SELECT_MESSAGES ICON "icon_select_messages.ico"
+IDI_ICON_SIMULATION_START ICON "icon_simulation_start.ico"
+IDI_ICON_SIMULATION_STOP ICON "icon_simulation_stop.ico"
+IDI_ICON_SELECT_ADD_INSTANCES ICON "icon_select_add_instances.ico"
+IDI_ICON_SELECT_ADD_MESSAGES ICON "icon_select_add_messages.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
// Dialog
//
@@ -80,7 +96,27 @@
CONTROL "",IDC_DRAWING2,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,110,14,100,92
END
+IDD_INSTANCES_FIELD_OPTIONS DIALOGEX 0, 0, 186, 114
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Instances Field Options"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,131,5,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,131,25,50,14
+ LTEXT "Number of instances:",IDC_STATIC,5,5,70,12,SS_CENTERIMAGE
+ EDITTEXT IDC_IF_INSTANCES_CNT,80,5,40,14,ES_AUTOHSCROLL
+ LTEXT "Margins on the side:",IDC_IF_LBL1,12,55,70,12,SS_CENTERIMAGE
+ EDITTEXT IDC_IF_MARGIN_SIDE,87,55,40,14,ES_AUTOHSCROLL
+ LTEXT "Top margin:",IDC_IF_LBL2,12,73,70,12,SS_CENTERIMAGE
+ EDITTEXT IDC_IF_MARGIN_TOP,87,73,40,14,ES_AUTOHSCROLL
+ LTEXT "Instances height:",IDC_IF_LBL3,12,90,70,12,SS_CENTERIMAGE
+ EDITTEXT IDC_IF_INSTANCES_HEIGHT,87,90,40,14,ES_AUTOHSCROLL
+ GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,42,176,68
+ PUSHBUTTON "+",IDC_OPTIONS_SWITCH_BTN,5,41,10,10
+ LTEXT " Appearance options ",IDC_OPTIONS_SWITCH_LBL,19,41,69,8
+END
+
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
@@ -185,6 +221,14 @@
TOPMARGIN, 5
BOTTOMMARGIN, 106
END
+
+ IDD_INSTANCES_FIELD_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 181
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 109
+ END
END
#endif // APSTUDIO_INVOKED
@@ -206,22 +250,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_ICON_CHECK ICON "icon_check.ico"
-IDI_ICON_FIND_FLOW ICON "icon_findflow.ico"
-IDI_ICON_SELECT_INSTANCES ICON "icon_select_instances.ico"
-IDI_ICON_SELECT_MESSAGES ICON "icon_select_messages.ico"
-IDI_ICON_SIMULATION_START ICON "icon_simulation_start.ico"
-IDI_ICON_SIMULATION_STOP ICON "icon_simulation_stop.ico"
-IDI_ICON_SELECT_ADD_INSTANCES ICON "icon_select_add_instances.ico"
-IDI_ICON_SELECT_ADD_MESSAGES ICON "icon_select_add_messages.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
// String Table
//
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-02-28 22:12:17 UTC (rev 638)
+++ trunk/src/view/visio/addon/document.cpp 2010-03-01 13:37:38 UTC (rev 639)
@@ -381,6 +381,12 @@
vslIconFile = vslFileName+_T(",3");
itemSelectMessages->IconFileName(vslIconFile.c_str());
+ Visio::IVMenuItemPtr itemInstancesField = itemDrawing->MenuItems->Add();
+ itemInstancesField->Caption = "Instances &Field";
+ itemInstancesField->AddOnName = ADDON_NAME;
+ itemInstancesField->AddOnArgs = stringize() << L"/event=" << MENU_INSTANCES_FIELD;
+ itemInstancesField->BeginGroup = true;
+
Visio::IVMenuItemPtr itemImport = itemDrawing->MenuItems->Add();
itemImport->Caption = "&Import...";
itemImport->AddOnName = ADDON_NAME;
@@ -476,6 +482,12 @@
accelItemSelectMessages->Control = true;
accelItemSelectMessages->Alt = true;
+ Visio::IVAccelItemPtr accelItemInstancesField = accelTable->AccelItems->Add();
+ accelItemInstancesField->CmdNum = itemInstancesField->CmdNum;
+ accelItemInstancesField->Key = 'F';
+ accelItemInstancesField->Control = true;
+ accelItemInstancesField->Alt = true;
+
m_vsoDocument->SetCustomMenus(vsoMenus);
}
@@ -913,6 +925,57 @@
return VAORC_SUCCESS;
}
+VAORC CDocumentMonitor::OnMenuInstancesField(Visio::IVApplicationPtr vsoApp)
+{
+ Visio::IVPagePtr vsoPage = vsoApp->GetActivePage();
+ //vsoPage->InsertObject("Instance", visInsertAsControl);
+
+ // FIXME: draw instances field according to params set in the dialog
+ /*
+ Visio::IVPagePtr vsoPage = vsoApp->GetActivePage();
+ //double page_height = align5(shape->ContainingPage->PageSheet->CellsSRC[visSectionObject][visRowPage][visPageHeight]->Result[visMillimeters]);
+ double page_width = vsoPage->PageSheet->CellsSRC[visSectionObject][visRowPage][visPageWidth]->Result[visMillimeters];
+ long scope_id = m_vsoApp->BeginUndoScope("Instances Field") + page_width;
+ // temporary mappers Visio shape-id --> msc.h
+ //std::map<long,InstancePtr> instances;
+ //MscMessageMap messages;
+ //TimeRelationEventMap time_relations;
+ int instcnt = 0;
+ // first walk through all shapes: create objects
+ for(int i = 1; i <= vsoPage->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = vsoPage->Shapes->Item[i];
+
+ TShapeType type = get_shape_type(shape);
+ if(type == ST_BMSC_INSTANCE)
+ {
+ instcnt++;
+ //instances[shape->ID] = new_instance_ptr(shape);
+ }
+ }
+
+ if(instcnt < 2)
+ {
+ MessageBox(GetActiveWindow(),
+ _T("This page contains less than 2 instances.\n"),
+ _T("Less than 2 instances"), MB_ICONERROR);
+ m_vsoApp->EndUndoScope(scope_id, false);
+ return VAORC_FAILURE;
+ }
+
+ Visio::IVDocumentPtr bmsc_stencil = vsoApp->Documents->Item[BMSC_STENCIL_NAME];
+ Visio::IVMasterPtr instance_master = bmsc_stencil->Masters->Item["Line Instance"];
+ Visio::IVMasterPtr message_master = bmsc_stencil->Masters->Item["Message (Right)"];
+ Visio::IVShapePtr m1 = vsoPage->Drop(message_master, 0, 0);
+ Visio::IVShapePtr m2 = vsoPage->Drop(message_master, 3, 0);
+ m1->Text = "INVITE 1";
+ m2->Text = "INVITE 2";
+
+ m_vsoApp->EndUndoScope(scope_id, true);
+ */
+ return VAORC_SUCCESS;
+}
+
void CDocumentMonitor::ShowReportView()
{
if(m_reportVisible)
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-02-28 22:12:17 UTC (rev 638)
+++ trunk/src/view/visio/addon/document.h 2010-03-01 13:37:38 UTC (rev 639)
@@ -62,6 +62,7 @@
MENU_SELECT_ALL_MESSAGES,
MENU_SELECT_ADD_ALL_INSTANCES,
MENU_SELECT_ADD_ALL_MESSAGES,
+ MENU_INSTANCES_FIELD,
};
VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
@@ -75,6 +76,7 @@
VAORC OnMenuSimulationStart(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStop(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuVerify(Visio::IVApplicationPtr vsoApp);
+ VAORC OnMenuInstancesField(Visio::IVApplicationPtr vsoApp);
void ShowReportView();
void OnHideReportView();
Added: trunk/src/view/visio/addon/instancesfielddlg.cpp
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.cpp (rev 0)
+++ trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-03-01 13:37:38 UTC (rev 639)
@@ -0,0 +1,108 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Ondrej Bouda <xb...@fi...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "dllmodule.h"
+#include "instancesfielddlg.h"
+
+LRESULT CInstancesFieldDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ CenterWindow(GetParent());
+
+ LoadRegistryData();
+ DoDataExchange(false);
+
+ SetOptionsVisibility(m_optionsVisible);
+
+ m_instancesCntEdit.SetSel(0, -1);
+
+ return bHandled = FALSE;
+}
+
+LRESULT CInstancesFieldDlg::OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ if(wID == IDOK)
+ {
+ DoDataExchange(TRUE);
+ SaveRegistryData();
+ }
+
+ EndDialog(wID);
+ return 0;
+}
+
+LRESULT CInstancesFieldDlg::OnOptionsSwitch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ m_optionsVisible = !m_optionsVisible;
+ SetOptionsVisibility(m_optionsVisible);
+ return 0;
+}
+
+void CInstancesFieldDlg::SetOptionsVisibility(bool visible)
+{
+ m_optionsSwitchBtn.SetWindowText((visible ? _T("-") : _T("+")));
+
+ CWindow window = m_optionsGroupBox.GetParent();
+ RECT windowRect;
+ window.GetWindowRect(&windowRect);
+ windowRect.bottom = windowRect.top + (visible ? 210 : 116);
+ window.SetWindowPos(0, &windowRect, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_DRAWFRAME);
+
+ RECT groupRect;
+ m_optionsGroupBox.GetWindowRect(&groupRect);
+ m_optionsGroupBox.ScreenToClient(&groupRect);
+ // note: relative to the dialog window
+ groupRect.top = 67;
+ groupRect.bottom = groupRect.top + (visible ? 110 : 8);
+ groupRect.left = 8;
+ groupRect.right = 272;
+ m_optionsGroupBox.SetWindowPos(0, &groupRect, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_DRAWFRAME);
+
+ for (int i=0; i<ARRAY_SIZE(m_optionEdits); i++) {
+ m_optionEdits[i].ShowWindow(visible);
+ }
+ for (int i=0; i<ARRAY_SIZE(m_optionLabels); i++) {
+ m_optionLabels[i].ShowWindow(visible);
+ }
+
+ m_instancesCntEdit.SetFocus();
+}
+
+int CInstancesFieldDlg::LoadRegistryData()
+{
+ m_instances_cnt = GetRegistry(GetRegistryFolder(), NULL, _T("InstancesCnt"), DEFAULT_IF_INSTANCES_CNT);
+ m_margin_side = GetRegistry(GetRegistryFolder(), NULL, _T("MarginSide"), DEFAULT_IF_MARGIN_SIDE);
+ m_margin_top = GetRegistry(GetRegistryFolder(), NULL, _T("MarginTop"), DEFAULT_IF_MARGIN_TOP);
+ m_instances_height = GetRegistry(GetRegistryFolder(), NULL, _T("InstancesHeight"), DEFAULT_IF_INSTANCES_HEIGHT);
+ m_optionsVisible = GetRegistry(GetRegistryFolder(), NULL, _T("OptionsVisible"), DEFAULT_IF_OPTIONS_VISIBLE);
+
+ return 0;
+}
+
+int CInstancesFieldDlg::SaveRegistryData()
+{
+ SetRegistry<int> (HKEY_CURRENT_USER, GetRegistryFolder(), _T("InstancesCnt"), m_instances_cnt);
+ SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("MarginSide"), m_margin_side);
+ SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("MarginTop"), m_margin_top);
+ SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("InstancesHeight"), m_instances_height);
+ SetRegistry<bool> (HKEY_CURRENT_USER, GetRegistryFolder(), _T("OptionsVisible"), m_optionsVisible);
+
+ return 0;
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/instancesfielddlg.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/instancesfielddlg.h
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.h (rev 0)
+++ trunk/src/view/visio/addon/instancesfielddlg.h 2010-03-01 13:37:38 UTC (rev 639)
@@ -0,0 +1,95 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2010 Ondrej Bouda <xb...@fi...>
+ *
+ * $Id$
+ */
+
+#pragma once
+
+// Include libraries from the Windows Template Library (WTL).
+// http://wtl.sourceforge.net
+#include <atldlgs.h>
+#include <atlctrls.h>
+#include <atlddx.h>
+
+class CInstancesFieldDlg
+ : public ATL::CDialogImpl<CInstancesFieldDlg>, public CWinDataExchange<CInstancesFieldDlg>
+{
+public:
+ enum { IDD = IDD_INSTANCES_FIELD_OPTIONS };
+ int m_instances_cnt;
+ float m_margin_side;
+ float m_margin_top;
+ float m_instances_height;
+
+ const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\InstancesField"); }
+
+protected:
+BEGIN_DDX_MAP(CInstancesFieldDlg)
+ DDX_INT_RANGE(IDC_IF_INSTANCES_CNT, m_instances_cnt, 1, 1000)
+ DDX_FLOAT(IDC_IF_MARGIN_SIDE, m_margin_side)
+ DDX_FLOAT(IDC_IF_MARGIN_TOP, m_margin_top)
+ DDX_FLOAT(IDC_IF_INSTANCES_HEIGHT, m_instances_height)
+
+ DDX_CONTROL_HANDLE(IDC_IF_INSTANCES_CNT, m_instancesCntEdit);
+ DDX_CONTROL_HANDLE(IDC_OPTIONS_SWITCH_BTN, m_optionsSwitchBtn)
+ DDX_CONTROL_HANDLE(IDC_OPTIONS_GROUP_BOX, m_optionsGroupBox)
+ DDX_CONTROL_HANDLE(IDC_IF_MARGIN_SIDE, m_optionEdits[0])
+ DDX_CONTROL_HANDLE(IDC_IF_MARGIN_TOP, m_optionEdits[1])
+ DDX_CONTROL_HANDLE(IDC_IF_INSTANCES_HEIGHT, m_optionEdits[2])
+ DDX_CONTROL_HANDLE(IDC_IF_LBL1, m_optionLabels[0])
+ DDX_CONTROL_HANDLE(IDC_IF_LBL2, m_optionLabels[1])
+ DDX_CONTROL_HANDLE(IDC_IF_LBL3, m_optionLabels[2])
+END_DDX_MAP()
+
+BEGIN_MSG_MAP(CInstancesFieldDlg)
+ MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
+ COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
+ COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
+ COMMAND_ID_HANDLER(IDC_OPTIONS_SWITCH_BTN, OnOptionsSwitch)
+ // FIXME: would like to make the label switch the options as well, but the following does not work:
+ //COMMAND_ID_HANDLER(IDC_OPTIONS_SWITCH_LBL, OnOptionsSwitch)
+END_MSG_MAP()
+
+// Handler prototypes:
+// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
+
+ LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+ LRESULT OnOptionsSwitch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+
+ int LoadRegistryData();
+ int SaveRegistryData();
+
+ void SetOptionsVisibility(bool visible);
+
+ bool m_optionsVisible;
+ CButton m_optionsSwitchBtn;
+
+ CEdit m_instancesCntEdit;
+ CStatic m_optionsGroupBox;
+ CEdit m_optionEdits[3];
+ CStatic m_optionLabels[3];
+};
+
+static const int DEFAULT_IF_INSTANCES_CNT = 1;
+static const float DEFAULT_IF_MARGIN_SIDE = 1.0f;
+static const float DEFAULT_IF_MARGIN_TOP = 1.0f;
+static const float DEFAULT_IF_INSTANCES_HEIGHT = 2.0f;
+static const bool DEFAULT_IF_OPTIONS_VISIBLE = false;
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/instancesfielddlg.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-02-28 22:12:17 UTC (rev 638)
+++ trunk/src/view/visio/addon/resource.h 2010-03-01 13:37:38 UTC (rev 639)
@@ -14,6 +14,7 @@
#define IDC_CHECKLIST 206
#define IDD_SIMULATOR_OPTIONS 206
#define IDC_OUTPUTLEVEL 207
+#define IDD_INSTANCES_FIELD_OPTIONS 207
#define IDC_DRAWING1 208
#define IDC_CHANNELTYPE 208
#define IDC_DRAWING2 209
@@ -27,6 +28,16 @@
#define IDI_ICON_SELECT_ADD_INSTANCES 218
#define IDC_SIM_BIN_WIDTH 219
#define IDI_ICON_SELECT_ADD_MESSAGES 219
+#define IDC_IF_INSTANCES_CNT 220
+#define IDC_IF_MARGIN_SIDE 221
+#define IDC_IF_MARGIN_TOP 222
+#define IDC_IF_INSTANCES_HEIGHT 223
+#define IDC_OPTIONS_SWITCH_BTN 226
+#define IDC_OPTIONS_SWITCH_LBL 227
+#define IDC_OPTIONS_GROUP_BOX 228
+#define IDC_IF_LBL1 229
+#define IDC_IF_LBL2 230
+#define IDC_IF_LBL3 231
// Next default values for new objects
//
@@ -34,7 +45,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 220
#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 220
+#define _APS_NEXT_CONTROL_VALUE 232
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-02-28 22:12:17 UTC (rev 638)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-03-01 13:37:38 UTC (rev 639)
@@ -316,6 +316,14 @@
>
</File>
<File
+ RelativePath=".\instancesfielddlg.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\instancesfielddlg.h"
+ >
+ </File>
+ <File
RelativePath=".\optionsdlg.cpp"
>
</File>
Modified: trunk/src/view/visio/addon/stdafx.h
===================================================================
--- trunk/src/view/visio/addon/stdafx.h 2010-02-28 22:12:17 UTC (rev 638)
+++ trunk/src/view/visio/addon/stdafx.h 2010-03-01 13:37:38 UTC (rev 639)
@@ -65,4 +65,7 @@
#endif // EXCEL_FOUND
+
+#define ARRAY_SIZE(a) (int)(sizeof(a)/sizeof(a[0]))
+
// $Id$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-03-02 21:02:00
|
Revision: 650
http://scstudio.svn.sourceforge.net/scstudio/?rev=650&view=rev
Author: obouda
Date: 2010-03-02 21:01:40 +0000 (Tue, 02 Mar 2010)
Log Message:
-----------
Fixed switching of toolbar buttons with Ctrl/Shift.
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-03-02 19:43:06 UTC (rev 649)
+++ trunk/src/view/visio/addon/addon.cpp 2010-03-02 21:01:40 UTC (rev 650)
@@ -56,8 +56,7 @@
: VAddon(VAO_AOATTS_ISACTION | VAO_AOATTS_HASABOUT, VAO_ENABLEALWAYS, 0, 0, pName, uIDLocalName)
{
m_pIAddonSink = NULL;
- m_ControlPressed = false;
- m_ShiftPressed = false;
+ m_keyButtonState = 0;
};
VAORC CStudioAddon::About(LPVAOV2LSTRUCT pV2L)
@@ -522,25 +521,26 @@
void CStudioAddon::HandleKeyDown(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
{
- if (!m_ControlPressed && !m_ShiftPressed) {
- GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItemsToAdd(true);
- }
+ long oldState = m_keyButtonState;
+ m_keyButtonState = vsoKeyboardEvent->KeyButtonState;
- if (vsoKeyboardEvent->KeyButtonState & Visio::visKeyControl) {
- m_ControlPressed = true;
+ long modifiers = visKeyControl | visKeyShift;
+
+ if (!(oldState & modifiers) && (m_keyButtonState & modifiers)) {
+ GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItems(true);
}
- if (vsoKeyboardEvent->KeyButtonState & Visio::visKeyShift) {
- m_ShiftPressed = true;
- }
}
void CStudioAddon::HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
{
- if (m_ControlPressed || m_ShiftPressed) {
- GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItemsToAdd(false);
+ long oldState = m_keyButtonState;
+ m_keyButtonState = vsoKeyboardEvent->KeyButtonState;
+
+ long modifiers = visKeyControl | visKeyShift;
+
+ if ((oldState & modifiers) && !(m_keyButtonState & modifiers)) {
+ GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItems(false);
}
- m_ControlPressed = false;
- m_ShiftPressed = false;
}
void CStudioAddon::RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument)
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-03-02 19:43:06 UTC (rev 649)
+++ trunk/src/view/visio/addon/addon.h 2010-03-02 21:01:40 UTC (rev 650)
@@ -65,8 +65,7 @@
typedef std::map<long, CDocumentMonitor*> DocumentMonitorsMap;
DocumentMonitorsMap m_DocumentMonitors;
- bool m_ControlPressed;
- bool m_ShiftPressed;
+ long m_keyButtonState;
};
// $Id$
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-03-02 19:43:06 UTC (rev 649)
+++ trunk/src/view/visio/addon/document.cpp 2010-03-02 21:01:40 UTC (rev 650)
@@ -576,12 +576,12 @@
m_vsoDocument->SetCustomToolbars(vsoToolbars);
}
-void CDocumentMonitor::ToggleToolbarItemsToAdd(bool add)
+void CDocumentMonitor::ToggleToolbarItems(bool modifiersPressed)
{
- m_selInstancesToolbarItem->Visible = !add;
- m_selMessagesToolbarItem->Visible = !add;
- m_selAddInstancesToolbarItem->Visible = add;
- m_selAddMessagesToolbarItem->Visible = add;
+ m_selInstancesToolbarItem->Visible = !modifiersPressed;
+ m_selMessagesToolbarItem->Visible = !modifiersPressed;
+ m_selAddInstancesToolbarItem->Visible = modifiersPressed;
+ m_selAddMessagesToolbarItem->Visible = modifiersPressed;
m_vsoDocument->CustomToolbars->UpdateUI();
}
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-03-02 19:43:06 UTC (rev 649)
+++ trunk/src/view/visio/addon/document.h 2010-03-02 21:01:40 UTC (rev 650)
@@ -96,7 +96,7 @@
void OnSimulationResult();
void OnSimulationError();
- void ToggleToolbarItemsToAdd(bool add);
+ void ToggleToolbarItems(bool modifiersPressed);
// event objects for this document
Visio::IVEventPtr m_vsoPageAddedEvent;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-03-15 13:25:35
|
Revision: 700
http://scstudio.svn.sourceforge.net/scstudio/?rev=700&view=rev
Author: obouda
Date: 2010-03-15 13:25:25 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------
New feature: instances field drawing (Menu--Check--Drawing--Instances Field)
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
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/instancesfielddlg.cpp
trunk/src/view/visio/addon/instancesfielddlg.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/visualize.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/addon.cpp 2010-03-15 13:25:25 UTC (rev 700)
@@ -309,14 +309,8 @@
TRACE("CStudioAddon::Run() add all messages to the current selection");
return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, true);
case CDocumentMonitor::MENU_INSTANCES_FIELD:
- {
- TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Instances Field'");
- VAORC result = DisplayInstancesFieldDialog();
- if (result != VAORC_SUCCESS)
- return result;
- else
- return pDocumentMonitor->OnMenuInstancesField(vsoApp);
- }
+ TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Instances Field'");
+ return DoInstancesField(pDocumentMonitor, vsoApp);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
@@ -375,13 +369,27 @@
return VAORC_SUCCESS;
}
-VAORC CStudioAddon::DisplayInstancesFieldDialog()
+VAORC CStudioAddon::DoInstancesField(CDocumentMonitor* documentMonitor, Visio::IVApplicationPtr vsoApp)
{
- TRACE("CStudioAddon::DisplayInstancesFieldDialog() called");
+ TRACE("CStudioAddon::DoInstancesField() called");
CInstancesFieldDlg dlg;
-
- dlg.DoModal();
- return VAORC_SUCCESS;
+ if (!dlg.DoModal()) return VAORC_SUCCESS;
+
+ if (!documentMonitor->IsEmpty(vsoApp))
+ {
+ int res = MessageBox(GetActiveWindow(),
+ _T("Current page is not empty.\n\nDraw the instances anyway?\n"),
+ _T("The page is not empty"),
+ MB_OKCANCEL | MB_ICONWARNING
+ );
+ if (res != IDOK) return VAORC_SUCCESS;
+ }
+
+ return documentMonitor->DrawInstancesField(
+ vsoApp, dlg.m_instances_cnt,
+ (dlg.m_use_const_spacing ? dlg.m_spacing : 0.0f),
+ dlg.m_margin_left, dlg.m_margin_top, dlg.m_margin_right
+ );
}
HRESULT CStudioAddon::HandleVisioEvent(
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/addon.h 2010-03-15 13:25:25 UTC (rev 700)
@@ -36,7 +36,7 @@
VAORC DisplaySimulatorOptions();
VAORC DisplayCheckOptions();
- VAORC DisplayInstancesFieldDialog();
+ VAORC DoInstancesField(CDocumentMonitor* documentMonitor, Visio::IVApplicationPtr vsoApp);
virtual HRESULT HandleVisioEvent(
IUnknown *ipSink, // [in] ipSink [assert]
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-03-15 13:25:25 UTC (rev 700)
@@ -96,7 +96,7 @@
CONTROL "",IDC_DRAWING2,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,110,14,100,92
END
-IDD_INSTANCES_FIELD_OPTIONS DIALOGEX 0, 0, 186, 114
+IDD_INSTANCES_FIELD_OPTIONS DIALOGEX 0, 0, 186, 137
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Instances Field Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -105,15 +105,20 @@
PUSHBUTTON "Cancel",IDCANCEL,131,25,50,14
LTEXT "Number of instances:",IDC_STATIC,5,5,70,12,SS_CENTERIMAGE
EDITTEXT IDC_IF_INSTANCES_CNT,80,5,40,14,ES_AUTOHSCROLL
- LTEXT "Margins on the side:",IDC_IF_LBL1,12,55,70,12,SS_CENTERIMAGE
- EDITTEXT IDC_IF_MARGIN_SIDE,87,55,40,14,ES_AUTOHSCROLL
- LTEXT "Top margin:",IDC_IF_LBL2,12,73,70,12,SS_CENTERIMAGE
- EDITTEXT IDC_IF_MARGIN_TOP,87,73,40,14,ES_AUTOHSCROLL
- LTEXT "Instances height:",IDC_IF_LBL3,12,90,70,12,SS_CENTERIMAGE
- EDITTEXT IDC_IF_INSTANCES_HEIGHT,87,90,40,14,ES_AUTOHSCROLL
- GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,42,176,68
+ GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,42,176,90
PUSHBUTTON "+",IDC_OPTIONS_SWITCH_BTN,5,41,10,10
- LTEXT " Appearance options ",IDC_OPTIONS_SWITCH_LBL,19,41,69,8
+ LTEXT " Options ",IDC_OPTIONS_SWITCH_LBL,19,41,30,8
+ CONTROL "Use constant spacing between instances",IDC_IF_SPACING_SWITCH,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,57,146,10
+ EDITTEXT IDC_IF_SPACING,69,69,40,14,ES_AUTOHSCROLL
+ LTEXT "Spacing [mm]:",IDC_IF_LBL1,19,71,46,8
+ LTEXT "Margins [mm]",IDC_IF_LBL2,10,87,44,8
+ LTEXT "Left:",IDC_IF_LBL3,19,99,16,8
+ EDITTEXT IDC_IF_MARGIN_LEFT,48,97,40,14,ES_AUTOHSCROLL
+ LTEXT "Right:",IDC_IF_LBL4,100,99,30,8
+ EDITTEXT IDC_IF_MARGIN_RIGHT,130,97,40,14,ES_AUTOHSCROLL
+ LTEXT "Top:",IDC_IF_LBL5,19,115,16,8
+ EDITTEXT IDC_IF_MARGIN_TOP,48,113,40,14,ES_AUTOHSCROLL
END
@@ -226,8 +231,18 @@
BEGIN
LEFTMARGIN, 5
RIGHTMARGIN, 181
+ VERTGUIDE, 10
+ VERTGUIDE, 19
+ VERTGUIDE, 48
+ VERTGUIDE, 100
+ VERTGUIDE, 130
TOPMARGIN, 5
- BOTTOMMARGIN, 109
+ BOTTOMMARGIN, 132
+ HORZGUIDE, 76
+ HORZGUIDE, 107
+ HORZGUIDE, 111
+ HORZGUIDE, 123
+ HORZGUIDE, 127
END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/document.cpp 2010-03-15 13:25:25 UTC (rev 700)
@@ -586,6 +586,108 @@
m_vsoDocument->CustomToolbars->UpdateUI();
}
+VAORC CDocumentMonitor::DrawInstancesField(Visio::IVApplicationPtr vsoApp, int instancesCnt, Coordinate spacing, Coordinate marginLeft, Coordinate marginTop, Coordinate marginRight)
+{
+ TRACE("CDocumentMonitor::DrawInstancesField() Drawing instances field");
+
+ if (instancesCnt < 0 || spacing < 0 || marginLeft < 0 || marginTop < 0 || marginRight < 0)
+ {
+ TRACE("CDocumentMonitor::DrawInstancesField() Bad arguments (some are negative)");
+ return VAORC_FAILURE;
+ }
+
+ Visio::IVPagePtr vsoPage = vsoApp->GetActivePage();
+ int oldShapesCount = vsoPage->Shapes->Count;
+ CDrawingVisualizer visualizer(m_vsoApp);
+
+ // compute dynamic spacing
+ if (spacing == 0.0f && instancesCnt > 1)
+ {
+ Coordinate pageWidth = vsoPage->PageSheet->CellsSRC[visSectionObject][visRowPage][visPageWidth]->Result[visMillimeters];
+ spacing = (pageWidth - marginRight - marginLeft) / (instancesCnt - 1);
+ }
+
+ // build a bmsc according to the parameters
+ BMscPtr bmsc(new BMsc);
+
+ for (int i=0; i<instancesCnt; i++)
+ {
+ Coordinate x = marginLeft + i*spacing;
+ Coordinate height = 30;
+ Coordinate width = 10;
+
+ InstancePtr inst(new Instance(_T("NAME")));
+ inst->set_line_begin(MscPoint(x, marginTop));
+ inst->set_line_end(MscPoint(x, marginTop + height));
+ inst->set_width(width);
+
+ bmsc->add_instance(inst);
+ }
+
+ /* FIXME: crashes, we will make visualize_bmsc public in the meantime
+ std::vector<MscPtr> msc;
+ msc.push_back(bmsc);
+ visualizer.visualize_msc(vsoPage, msc);
+ */
+ visualizer.visualize_bmsc(vsoPage, bmsc);
+
+ // select the newly created instances
+ Visio::IVSelectionPtr selection = vsoPage->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper);
+ for(int i=oldShapesCount+1; i<=vsoPage->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = vsoPage->Shapes->Item[i];
+ if (get_shape_type(shape) == ST_BMSC_INSTANCE)
+ selection->Select(shape, Visio::visSelect);
+ }
+ vsoApp->ActiveWindow->Selection = selection;
+
+
+
+ /*
+ Visio::IVPagePtr vsoPage = vsoApp->GetActivePage();
+ //double page_height = align5(shape->ContainingPage->PageSheet->CellsSRC[visSectionObject][visRowPage][visPageHeight]->Result[visMillimeters]);
+ double page_width = vsoPage->PageSheet->CellsSRC[visSectionObject][visRowPage][visPageWidth]->Result[visMillimeters];
+ long scope_id = m_vsoApp->BeginUndoScope("Instances Field") + page_width;
+ // temporary mappers Visio shape-id --> msc.h
+ //std::map<long,InstancePtr> instances;
+ //MscMessageMap messages;
+ //TimeRelationEventMap time_relations;
+ int instcnt = 0;
+ // first walk through all shapes: create objects
+ for(int i = 1; i <= vsoPage->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = vsoPage->Shapes->Item[i];
+
+ TShapeType type = get_shape_type(shape);
+ if(type == ST_BMSC_INSTANCE)
+ {
+ instcnt++;
+ //instances[shape->ID] = new_instance_ptr(shape);
+ }
+ }
+
+ if(instcnt < 2)
+ {
+ MessageBox(GetActiveWindow(),
+ _T("This page contains less than 2 instances.\n"),
+ _T("Less than 2 instances"), MB_ICONERROR);
+ m_vsoApp->EndUndoScope(scope_id, false);
+ return VAORC_FAILURE;
+ }
+
+ Visio::IVDocumentPtr bmsc_stencil = vsoApp->Documents->Item[BMSC_STENCIL_NAME];
+ Visio::IVMasterPtr instance_master = bmsc_stencil->Masters->Item["Line Instance"];
+ Visio::IVMasterPtr message_master = bmsc_stencil->Masters->Item["Message (Right)"];
+ Visio::IVShapePtr m1 = vsoPage->Drop(message_master, 0, 0);
+ Visio::IVShapePtr m2 = vsoPage->Drop(message_master, 3, 0);
+ m1->Text = "INVITE 1";
+ m2->Text = "INVITE 2";
+
+ m_vsoApp->EndUndoScope(scope_id, true);
+ */
+ return VAORC_SUCCESS;
+}
+
TransformerPtrList::const_iterator CDocumentMonitor::find_transformer(const std::wstring& name) const
{
for(TransformerPtrList::const_iterator cpos = m_transformers.begin();
@@ -864,14 +966,11 @@
return VAORC_SUCCESS;
}
-/**
- * Selects all instances or all messages on the active page.
- * @param vsoApp the application to make selection in
- * @param select_instances when true, selects all instances,
- * when false, selects all messages (including lost and found messages)
- * @param add_to_selection when true, adds all objects to existing selection,
- * when false, the old selection is dropped
- */
+bool CDocumentMonitor::IsEmpty(Visio::IVApplicationPtr vsoApp)
+{
+ return (vsoApp->ActivePage->Shapes->Count == 0);
+}
+
void CDocumentMonitor::selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, bool add_to_selection)
{
Visio::IVPagePtr page = vsoApp->ActivePage;
@@ -925,57 +1024,6 @@
return VAORC_SUCCESS;
}
-VAORC CDocumentMonitor::OnMenuInstancesField(Visio::IVApplicationPtr vsoApp)
-{
- Visio::IVPagePtr vsoPage = vsoApp->GetActivePage();
- //vsoPage->InsertObject("Instance", visInsertAsControl);
-
- // FIXME: draw instances field according to params set in the dialog
- /*
- Visio::IVPagePtr vsoPage = vsoApp->GetActivePage();
- //double page_height = align5(shape->ContainingPage->PageSheet->CellsSRC[visSectionObject][visRowPage][visPageHeight]->Result[visMillimeters]);
- double page_width = vsoPage->PageSheet->CellsSRC[visSectionObject][visRowPage][visPageWidth]->Result[visMillimeters];
- long scope_id = m_vsoApp->BeginUndoScope("Instances Field") + page_width;
- // temporary mappers Visio shape-id --> msc.h
- //std::map<long,InstancePtr> instances;
- //MscMessageMap messages;
- //TimeRelationEventMap time_relations;
- int instcnt = 0;
- // first walk through all shapes: create objects
- for(int i = 1; i <= vsoPage->Shapes->Count; i++)
- {
- Visio::IVShapePtr shape = vsoPage->Shapes->Item[i];
-
- TShapeType type = get_shape_type(shape);
- if(type == ST_BMSC_INSTANCE)
- {
- instcnt++;
- //instances[shape->ID] = new_instance_ptr(shape);
- }
- }
-
- if(instcnt < 2)
- {
- MessageBox(GetActiveWindow(),
- _T("This page contains less than 2 instances.\n"),
- _T("Less than 2 instances"), MB_ICONERROR);
- m_vsoApp->EndUndoScope(scope_id, false);
- return VAORC_FAILURE;
- }
-
- Visio::IVDocumentPtr bmsc_stencil = vsoApp->Documents->Item[BMSC_STENCIL_NAME];
- Visio::IVMasterPtr instance_master = bmsc_stencil->Masters->Item["Line Instance"];
- Visio::IVMasterPtr message_master = bmsc_stencil->Masters->Item["Message (Right)"];
- Visio::IVShapePtr m1 = vsoPage->Drop(message_master, 0, 0);
- Visio::IVShapePtr m2 = vsoPage->Drop(message_master, 3, 0);
- m1->Text = "INVITE 1";
- m2->Text = "INVITE 2";
-
- m_vsoApp->EndUndoScope(scope_id, true);
- */
- return VAORC_SUCCESS;
-}
-
void CDocumentMonitor::ShowReportView()
{
if(m_reportVisible)
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/document.h 2010-03-15 13:25:25 UTC (rev 700)
@@ -76,7 +76,6 @@
VAORC OnMenuSimulationStart(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStop(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuVerify(Visio::IVApplicationPtr vsoApp);
- VAORC OnMenuInstancesField(Visio::IVApplicationPtr vsoApp);
void ShowReportView();
void OnHideReportView();
@@ -96,8 +95,27 @@
void OnSimulationResult();
void OnSimulationError();
+ /**
+ * Tells whether the active document page is empty.
+ * @param vsoApp the application for which to tell the result
+ * @return true when the active document page is empty, false if not
+ */
+ bool IsEmpty(Visio::IVApplicationPtr vsoApp);
+
void ToggleToolbarItems(bool modifiersPressed);
+ /**
+ * Draws a field of instances on the current page.
+ * @param vsoApp the monitored application where to draw
+ * @param instancesCnt number of instances to draw
+ * @param spacing constant spacing between instances; 0 for dynamic
+ * @param marginLeft left margin - horizontal offset where to start
+ * @param marginTop top margin - vertical offset where to start
+ * @param marginRight right margin; used only if spacing=0
+ * @return result: VAORC_SUCCESS or VAORC_FAILURE
+ */
+ VAORC DrawInstancesField(Visio::IVApplicationPtr vsoApp, int instancesCnt, Coordinate spacing, Coordinate marginLeft, Coordinate marginTop, Coordinate marginRight);
+
// event objects for this document
Visio::IVEventPtr m_vsoPageAddedEvent;
Visio::IVEventPtr m_vsoBeforeDocumentClosedEvent;
Modified: trunk/src/view/visio/addon/instancesfielddlg.cpp
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-03-15 13:25:25 UTC (rev 700)
@@ -19,6 +19,7 @@
#include "stdafx.h"
#include "dllmodule.h"
#include "instancesfielddlg.h"
+#include "errors.h"
LRESULT CInstancesFieldDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
@@ -28,21 +29,24 @@
DoDataExchange(false);
SetOptionsVisibility(m_optionsVisible);
+ m_spacingSwitchBtn.SetCheck(m_use_const_spacing ? BST_CHECKED : BST_UNCHECKED);
+ m_spacingEdit.EnableWindow(m_use_const_spacing);
+ m_marginRightEdit.EnableWindow(!m_use_const_spacing);
m_instancesCntEdit.SetSel(0, -1);
- return bHandled = FALSE;
+ return bHandled = false;
}
LRESULT CInstancesFieldDlg::OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
if(wID == IDOK)
{
- DoDataExchange(TRUE);
+ DoDataExchange(true);
SaveRegistryData();
}
- EndDialog(wID);
+ EndDialog((wID == IDOK));
return 0;
}
@@ -53,6 +57,15 @@
return 0;
}
+LRESULT CInstancesFieldDlg::OnSpacingSwitch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ bool checked = (m_spacingSwitchBtn.GetCheck() == BST_CHECKED);
+ m_use_const_spacing = checked;
+ m_spacingEdit.EnableWindow(m_use_const_spacing);
+ m_marginRightEdit.EnableWindow(!m_use_const_spacing);
+ return 0;
+}
+
void CInstancesFieldDlg::SetOptionsVisibility(bool visible)
{
m_optionsSwitchBtn.SetWindowText((visible ? _T("-") : _T("+")));
@@ -60,46 +73,51 @@
CWindow window = m_optionsGroupBox.GetParent();
RECT windowRect;
window.GetWindowRect(&windowRect);
- windowRect.bottom = windowRect.top + (visible ? 210 : 116);
+ windowRect.bottom = windowRect.top + (visible ? 250 : 116);
window.SetWindowPos(0, &windowRect, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_DRAWFRAME);
RECT groupRect;
m_optionsGroupBox.GetWindowRect(&groupRect);
m_optionsGroupBox.ScreenToClient(&groupRect);
- // note: relative to the dialog window
+ // NOTE: relative to the dialog window
groupRect.top = 67;
- groupRect.bottom = groupRect.top + (visible ? 110 : 8);
+ groupRect.bottom = groupRect.top + (visible ? 150 : 8);
groupRect.left = 8;
groupRect.right = 272;
m_optionsGroupBox.SetWindowPos(0, &groupRect, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_DRAWFRAME);
- for (int i=0; i<ARRAY_SIZE(m_optionEdits); i++) {
- m_optionEdits[i].ShowWindow(visible);
+ m_spacingSwitchBtn.ShowWindow(visible);
+ m_spacingEdit.ShowWindow(visible);
+ for (int i=0; i<ARRAY_SIZE(m_optionItems); i++) {
+ m_optionItems[i].ShowWindow(visible);
}
- for (int i=0; i<ARRAY_SIZE(m_optionLabels); i++) {
- m_optionLabels[i].ShowWindow(visible);
- }
m_instancesCntEdit.SetFocus();
}
int CInstancesFieldDlg::LoadRegistryData()
{
- m_instances_cnt = GetRegistry(GetRegistryFolder(), NULL, _T("InstancesCnt"), DEFAULT_IF_INSTANCES_CNT);
- m_margin_side = GetRegistry(GetRegistryFolder(), NULL, _T("MarginSide"), DEFAULT_IF_MARGIN_SIDE);
- m_margin_top = GetRegistry(GetRegistryFolder(), NULL, _T("MarginTop"), DEFAULT_IF_MARGIN_TOP);
- m_instances_height = GetRegistry(GetRegistryFolder(), NULL, _T("InstancesHeight"), DEFAULT_IF_INSTANCES_HEIGHT);
- m_optionsVisible = GetRegistry(GetRegistryFolder(), NULL, _T("OptionsVisible"), DEFAULT_IF_OPTIONS_VISIBLE);
+ TRACE("CInstancesFieldDlg::LoadRegistryData() loading options from registry");
+ m_instances_cnt = GetRegistry<int> (GetRegistryFolder(), NULL, _T("InstancesCnt"), DEFAULT_IF_INSTANCES_CNT);
+ m_use_const_spacing = GetRegistry<bool> (GetRegistryFolder(), NULL, _T("SpacingSwitch"), DEFAULT_IF_SPACING_SWITCH);
+ m_spacing = GetRegistry<float>(GetRegistryFolder(), NULL, _T("Spacing"), DEFAULT_IF_SPACING);
+ m_margin_left = GetRegistry<float>(GetRegistryFolder(), NULL, _T("MarginLeft"), DEFAULT_IF_MARGIN_LEFT);
+ m_margin_right = GetRegistry<float>(GetRegistryFolder(), NULL, _T("MarginRight"), DEFAULT_IF_MARGIN_RIGHT);
+ m_margin_top = GetRegistry<float>(GetRegistryFolder(), NULL, _T("MarginTop"), DEFAULT_IF_MARGIN_TOP);
+ m_optionsVisible = GetRegistry<bool> (GetRegistryFolder(), NULL, _T("OptionsVisible"), DEFAULT_IF_OPTIONS_VISIBLE);
return 0;
}
int CInstancesFieldDlg::SaveRegistryData()
{
- SetRegistry<int> (HKEY_CURRENT_USER, GetRegistryFolder(), _T("InstancesCnt"), m_instances_cnt);
- SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("MarginSide"), m_margin_side);
- SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("MarginTop"), m_margin_top);
- SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("InstancesHeight"), m_instances_height);
+ TRACE("CInstancesFieldDlg::SaveRegistryData() saving options to registry");
+ SetRegistry<int> (HKEY_CURRENT_USER, GetRegistryFolder(), _T("InstancesCnt"), m_instances_cnt);
+ SetRegistry<bool> (HKEY_CURRENT_USER, GetRegistryFolder(), _T("SpacingSwitch"), m_use_const_spacing);
+ SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("Spacing"), m_spacing);
+ SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("MarginLeft"), m_margin_left);
+ SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("MarginRight"), m_margin_right);
+ SetRegistry<float>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("MarginTop"), m_margin_top);
SetRegistry<bool> (HKEY_CURRENT_USER, GetRegistryFolder(), _T("OptionsVisible"), m_optionsVisible);
return 0;
Modified: trunk/src/view/visio/addon/instancesfielddlg.h
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.h 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/instancesfielddlg.h 2010-03-15 13:25:25 UTC (rev 700)
@@ -23,6 +23,7 @@
#include <atldlgs.h>
#include <atlctrls.h>
#include <atlddx.h>
+#include <atlwinx.h>
class CInstancesFieldDlg
: public ATL::CDialogImpl<CInstancesFieldDlg>, public CWinDataExchange<CInstancesFieldDlg>
@@ -30,28 +31,36 @@
public:
enum { IDD = IDD_INSTANCES_FIELD_OPTIONS };
int m_instances_cnt;
- float m_margin_side;
+ bool m_use_const_spacing;
+ float m_spacing;
+ float m_margin_left;
+ float m_margin_right;
float m_margin_top;
- float m_instances_height;
const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\InstancesField"); }
protected:
BEGIN_DDX_MAP(CInstancesFieldDlg)
DDX_INT_RANGE(IDC_IF_INSTANCES_CNT, m_instances_cnt, 1, 1000)
- DDX_FLOAT(IDC_IF_MARGIN_SIDE, m_margin_side)
+ DDX_FLOAT(IDC_IF_SPACING, m_spacing)
+ DDX_FLOAT(IDC_IF_MARGIN_LEFT, m_margin_left)
+ DDX_FLOAT(IDC_IF_MARGIN_RIGHT, m_margin_right)
DDX_FLOAT(IDC_IF_MARGIN_TOP, m_margin_top)
- DDX_FLOAT(IDC_IF_INSTANCES_HEIGHT, m_instances_height)
- DDX_CONTROL_HANDLE(IDC_IF_INSTANCES_CNT, m_instancesCntEdit);
+ DDX_CONTROL_HANDLE(IDC_IF_INSTANCES_CNT, m_instancesCntEdit)
DDX_CONTROL_HANDLE(IDC_OPTIONS_SWITCH_BTN, m_optionsSwitchBtn)
DDX_CONTROL_HANDLE(IDC_OPTIONS_GROUP_BOX, m_optionsGroupBox)
- DDX_CONTROL_HANDLE(IDC_IF_MARGIN_SIDE, m_optionEdits[0])
- DDX_CONTROL_HANDLE(IDC_IF_MARGIN_TOP, m_optionEdits[1])
- DDX_CONTROL_HANDLE(IDC_IF_INSTANCES_HEIGHT, m_optionEdits[2])
- DDX_CONTROL_HANDLE(IDC_IF_LBL1, m_optionLabels[0])
- DDX_CONTROL_HANDLE(IDC_IF_LBL2, m_optionLabels[1])
- DDX_CONTROL_HANDLE(IDC_IF_LBL3, m_optionLabels[2])
+ DDX_CONTROL_HANDLE(IDC_IF_SPACING_SWITCH, m_spacingSwitchBtn)
+ DDX_CONTROL_HANDLE(IDC_IF_SPACING, m_spacingEdit)
+ DDX_CONTROL_HANDLE(IDC_IF_MARGIN_RIGHT, m_marginRightEdit)
+ DDX_CONTROL_HANDLE(IDC_IF_MARGIN_LEFT, m_optionItems[0])
+ DDX_CONTROL_HANDLE(IDC_IF_MARGIN_LEFT, m_optionItems[1])
+ DDX_CONTROL_HANDLE(IDC_IF_MARGIN_TOP, m_optionItems[2])
+ DDX_CONTROL_HANDLE(IDC_IF_LBL1, m_optionItems[3])
+ DDX_CONTROL_HANDLE(IDC_IF_LBL2, m_optionItems[4])
+ DDX_CONTROL_HANDLE(IDC_IF_LBL3, m_optionItems[5])
+ DDX_CONTROL_HANDLE(IDC_IF_LBL4, m_optionItems[6])
+ DDX_CONTROL_HANDLE(IDC_IF_LBL5, m_optionItems[7])
END_DDX_MAP()
BEGIN_MSG_MAP(CInstancesFieldDlg)
@@ -59,6 +68,7 @@
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
COMMAND_ID_HANDLER(IDC_OPTIONS_SWITCH_BTN, OnOptionsSwitch)
+ COMMAND_ID_HANDLER(IDC_IF_SPACING_SWITCH, OnSpacingSwitch)
// FIXME: would like to make the label switch the options as well, but the following does not work:
//COMMAND_ID_HANDLER(IDC_OPTIONS_SWITCH_LBL, OnOptionsSwitch)
END_MSG_MAP()
@@ -71,6 +81,7 @@
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnOptionsSwitch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+ LRESULT OnSpacingSwitch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
int LoadRegistryData();
int SaveRegistryData();
@@ -79,17 +90,22 @@
bool m_optionsVisible;
CButton m_optionsSwitchBtn;
+ CButton m_spacingSwitchBtn;
CEdit m_instancesCntEdit;
+ CEdit m_spacingEdit;
+ CEdit m_marginRightEdit;
CStatic m_optionsGroupBox;
- CEdit m_optionEdits[3];
- CStatic m_optionLabels[3];
+
+ ATL::CWindow m_optionItems[8];
};
-static const int DEFAULT_IF_INSTANCES_CNT = 1;
-static const float DEFAULT_IF_MARGIN_SIDE = 1.0f;
-static const float DEFAULT_IF_MARGIN_TOP = 1.0f;
-static const float DEFAULT_IF_INSTANCES_HEIGHT = 2.0f;
+static const int DEFAULT_IF_INSTANCES_CNT = 2;
+static const int DEFAULT_IF_SPACING_SWITCH = true;
+static const float DEFAULT_IF_SPACING = 30.0f;
+static const float DEFAULT_IF_MARGIN_LEFT = 20.0f;
+static const float DEFAULT_IF_MARGIN_RIGHT = 20.0f;
+static const float DEFAULT_IF_MARGIN_TOP = 20.0f;
static const bool DEFAULT_IF_OPTIONS_VISIBLE = false;
// $Id$
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/resource.h 2010-03-15 13:25:25 UTC (rev 700)
@@ -38,6 +38,12 @@
#define IDC_IF_LBL1 229
#define IDC_IF_LBL2 230
#define IDC_IF_LBL3 231
+#define IDC_IF_SPACING_SWITCH 232
+#define IDC_IF_SPACING 233
+#define IDC_IF_MARGIN_LEFT 236
+#define IDC_IF_MARGIN_RIGHT 237
+#define IDC_IF_LBL4 239
+#define IDC_IF_LBL5 240
// Next default values for new objects
//
@@ -45,7 +51,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 220
#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 232
+#define _APS_NEXT_CONTROL_VALUE 241
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
Modified: trunk/src/view/visio/addon/visualize.h
===================================================================
--- trunk/src/view/visio/addon/visualize.h 2010-03-14 23:34:18 UTC (rev 699)
+++ trunk/src/view/visio/addon/visualize.h 2010-03-15 13:25:25 UTC (rev 700)
@@ -92,7 +92,10 @@
// note: insertion to m_printing must not invalidate iterators
std::list<MscPtr> m_printing;
+// FIXME: changed to public
+public:
void visualize_bmsc(Visio::IVPagePtr vsoPage, const BMscPtr& bmsc);
+protected:
typedef std::map<HMscNodePtr,Visio::IVShapePtr> NodePtrMap;
Visio::IVShapePtr drop_hmsc_node(Visio::IVPagePtr vsoPage, NodePtrMap& nodes, HMscNodePtr node);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-04-10 23:23:49
|
Revision: 716
http://scstudio.svn.sourceforge.net/scstudio/?rev=716&view=rev
Author: obouda
Date: 2010-04-10 23:23:43 +0000 (Sat, 10 Apr 2010)
Log Message:
-----------
Add Instances function: added check whether the starting point is on the drawing area
Modified Paths:
--------------
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/instancesfielddlg.cpp
trunk/src/view/visio/addon/instancesfielddlg.h
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-04-10 22:50:23 UTC (rev 715)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-04-10 23:23:43 UTC (rev 716)
@@ -120,11 +120,6 @@
PUSHBUTTON "Default values",IDC_DEFAULT_BTN,131,88,58,14
LTEXT "x:",IDC_STATIC,64,40,9,12,SS_CENTERIMAGE
LTEXT "y:",IDC_STATIC,64,54,9,12,SS_CENTERIMAGE
- LTEXT "",IDC_UNITS_LBL1,126,23,14,12,SS_CENTERIMAGE
- LTEXT "",IDC_UNITS_LBL2,126,40,14,12,SS_CENTERIMAGE
- LTEXT "",IDC_UNITS_LBL3,126,54,14,12,SS_CENTERIMAGE
- LTEXT "",IDC_UNITS_LBL4,107,88,14,12,SS_CENTERIMAGE
- LTEXT "",IDC_UNITS_LBL5,107,103,14,12,SS_CENTERIMAGE
END
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-04-10 22:50:23 UTC (rev 715)
+++ trunk/src/view/visio/addon/document.cpp 2010-04-10 23:23:43 UTC (rev 716)
@@ -590,12 +590,23 @@
{
TRACE("CDocumentMonitor::DrawInstancesField() Drawing instances field");
- if (instancesCnt < 0 || instanceLength < 0 || instanceWidth < 0 || startX < 0 || startY < 0)
+ if (instancesCnt < 0 || instanceLength < 0 || instanceWidth < 0)
{
- TRACE("CDocumentMonitor::DrawInstancesField() Bad arguments (some are negative)");
+ TRACE("CDocumentMonitor::DrawInstancesField() Bad arguments (negative or out of drawing area)");
return VAORC_FAILURE;
}
+ float pageWidth = static_cast<float>(CPageUtils::GetPageWidth(vsoApp->ActivePage));
+ float pageHeight = static_cast<float>(CPageUtils::GetPageHeight(vsoApp->ActivePage));
+
+ if (startX < 0 || startY < 0 || startX > pageWidth || startY > pageHeight)
+ {
+ MessageBox(GetActiveWindow(),
+ _T("Start point is out of drawing area."), _T("Add Instances Error"),
+ MB_OK | MB_ICONEXCLAMATION);
+ return VAORC_FAILURE;
+ }
+
Visio::IVPagePtr vsoPage = vsoApp->ActivePage;
int oldShapesCount = vsoPage->Shapes->Count;
CDrawingVisualizer visualizer(m_vsoApp);
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-04-10 22:50:23 UTC (rev 715)
+++ trunk/src/view/visio/addon/document.h 2010-04-10 23:23:43 UTC (rev 716)
@@ -23,6 +23,7 @@
#include "data/searcher.h"
#include "data/simulator.h"
#include "data/transformer.h"
+#include "pageutils.h"
//! template used to create new documents
static const _bstr_t VST_FILE_NAME = _T("MSC.vtx");
Modified: trunk/src/view/visio/addon/instancesfielddlg.cpp
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-04-10 22:50:23 UTC (rev 715)
+++ trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-04-10 23:23:43 UTC (rev 716)
@@ -34,19 +34,6 @@
m_pageWidth = static_cast<float>(CPageUtils::GetPageWidth(page));
m_pageHeight = static_cast<float>(CPageUtils::GetPageHeight(page));
-
- /* FIXME: type the units in the form
- // type the units in the form
- Visio::IVShapePtr sheet = page->PageSheet;
- Visio::IVCellPtr pageWidthCell = sheet->CellsSRC[visSectionObject][visRowPage][visPageWidth];
- m_pageUnits = static_cast<VisUnitCodes>(pageWidthCell->Units);
-
- for (int i=0; i<ARRAYSIZE(m_unitsLabels); i++) {
- // FIXME: change the units in the form
- //m_unitsLabels[i].SetWindowText(CDocumentMonitor::VisioUnitToString(m_pageUnits));
- //m_unitsLabels[i].SetWindowText(_T("blah"));
- }
- */
}
void CInstancesFieldDlg::OnDataValidateError(UINT nCtrlID, BOOL bSave, _XData& data)
@@ -177,10 +164,6 @@
m_spacingEdit.ShowWindow(visible);
m_defaultValuesBtn.ShowWindow(visible);
- for (int i=3; i<ARRAYSIZE(m_unitsLabels); i++) {
- m_unitsLabels[i].ShowWindow(visible);
- }
-
if (visible) {
if (m_use_const_spacing) {
m_spacingRdo.SetFocus();
Modified: trunk/src/view/visio/addon/instancesfielddlg.h
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.h 2010-04-10 22:50:23 UTC (rev 715)
+++ trunk/src/view/visio/addon/instancesfielddlg.h 2010-04-10 23:23:43 UTC (rev 716)
@@ -71,11 +71,6 @@
DDX_CONTROL_HANDLE(IDC_DEFAULT_BTN, m_defaultValuesBtn)
DDX_CONTROL_HANDLE(IDC_IF_TOTAL_WIDTH, m_totalWidthEdit)
DDX_CONTROL_HANDLE(IDC_IF_SPACING, m_spacingEdit)
- DDX_CONTROL_HANDLE(IDC_UNITS_LBL1, m_unitsLabels[0])
- DDX_CONTROL_HANDLE(IDC_UNITS_LBL2, m_unitsLabels[1])
- DDX_CONTROL_HANDLE(IDC_UNITS_LBL3, m_unitsLabels[2])
- DDX_CONTROL_HANDLE(IDC_UNITS_LBL4, m_unitsLabels[3])
- DDX_CONTROL_HANDLE(IDC_UNITS_LBL5, m_unitsLabels[4])
END_DDX_MAP()
BEGIN_MSG_MAP(CInstancesFieldDlg)
@@ -120,7 +115,6 @@
CEdit m_instancesCntEdit;
CEdit m_totalWidthEdit;
CEdit m_spacingEdit;
- CStatic m_unitsLabels[5];
};
static const int DEFAULT_IF_INSTANCES_CNT = 2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|