|
From: <xb...@us...> - 2014-01-16 21:35:03
|
Revision: 1881
http://sourceforge.net/p/scstudio/code/1881
Author: xborza
Date: 2014-01-16 21:35:00 +0000 (Thu, 16 Jan 2014)
Log Message:
-----------
Duplicate and drop shape into mouse position feature + HELP updated (added Keyboard accelerators section)
Modified Paths:
--------------
trunk/doc/help/frontend/shortcuts.body.htm
trunk/doc/help/menu.htm
trunk/doc/help/menui.htm
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
Modified: trunk/doc/help/frontend/shortcuts.body.htm
===================================================================
--- trunk/doc/help/frontend/shortcuts.body.htm 2014-01-11 21:04:52 UTC (rev 1880)
+++ trunk/doc/help/frontend/shortcuts.body.htm 2014-01-16 21:35:00 UTC (rev 1881)
@@ -56,6 +56,14 @@
<a href="message_numbering.html">Delete message numbering</a>
</td>
</tr>
+ <tr>
+ <td>
+ <code>Ctrl+Alt+X</code>
+ </td>
+ <td>
+ Duplicate and drop selected shape into mouse position
+ </td>
+ </tr>
</table>
</div>
</body>
Modified: trunk/doc/help/menu.htm
===================================================================
--- trunk/doc/help/menu.htm 2014-01-11 21:04:52 UTC (rev 1880)
+++ trunk/doc/help/menu.htm 2014-01-16 21:35:00 UTC (rev 1881)
@@ -24,6 +24,9 @@
<li>
<a href="frontend/settings.html">Options</a>
</li>
+ <li>
+ <a href="frontend/shortcuts.html">Keyboard accelerators</a>
+ </li>
</ul>
</li>
<li>
Modified: trunk/doc/help/menui.htm
===================================================================
--- trunk/doc/help/menui.htm 2014-01-11 21:04:52 UTC (rev 1880)
+++ trunk/doc/help/menui.htm 2014-01-16 21:35:00 UTC (rev 1881)
@@ -24,6 +24,9 @@
<li>
<a href="../frontend/settings.html">Options</a>
</li>
+ <li>
+ <a href="../frontend/shortcuts.html">Keyboard accelerators</a>
+ </li>
</ul>
</li>
<li>
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2014-01-11 21:04:52 UTC (rev 1880)
+++ trunk/src/view/visio/addon/addon.cpp 2014-01-16 21:35:00 UTC (rev 1881)
@@ -392,6 +392,11 @@
TRACE("CStudioAddon::Run() disable message enumeration");
return pDocumentMonitor->OnMenuDisableMessageEnumeration(vsoApp);
+ //case 3xx events - shortcuts events
+ case CDocumentMonitor::SHORT_DROP_INST:
+ TRACE("CStudioAddon::Run() SHORT DROP INSTANCE");
+ return pDocumentMonitor->OnShortcutDropInstace(vsoApp);
+
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
return VAORC_FAILURE;
@@ -1215,6 +1220,7 @@
// being monitored for this document.
pDocumentMonitor = new CDocumentMonitor(this, vsoApp, vsoDocument);
pDocumentMonitor->InitMenu();
+ pDocumentMonitor->InitShortcuts();
pDocumentMonitor->InitToolbar();
// register BeforeDocumentClose
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2014-01-11 21:04:52 UTC (rev 1880)
+++ trunk/src/view/visio/addon/document.cpp 2014-01-16 21:35:00 UTC (rev 1881)
@@ -410,6 +410,22 @@
return m_vsoApp->GetBuiltInToolbars(0);
}
+void CDocumentMonitor::InitShortcuts()
+{
+ //create accelerators
+ Visio::IVUIObjectPtr vsoMenus = m_vsoDocument->GetCustomMenus();
+ Visio::IVAccelTablePtr accelTable = vsoMenus->AccelTables->ItemAtID[Visio::visUIObjSetDrawing];
+
+ //Select Instances
+ Visio::IVAccelItemPtr accelItemSelectInstances = accelTable->AccelItems->Add();
+ //accelItemSelectInstances->CmdNum = SHORT_SELECT_INST;
+ accelItemSelectInstances->Key = 'X';
+ accelItemSelectInstances->Control = true;
+ accelItemSelectInstances->Alt = true;
+ accelItemSelectInstances->AddOnArgs = stringize() << L"/event=" << SHORT_DROP_INST;
+ accelItemSelectInstances->AddOnName = ADDON_NAME;
+}
+
void CDocumentMonitor::InitMenu()
{
Visio::IVUIObjectPtr vsoMenus = GetMostCustomMenus();
@@ -1297,6 +1313,66 @@
vsoApp->ActiveWindow->Selection = selection;
}
+VAORC CDocumentMonitor::OnShortcutDropInstace(Visio::IVApplicationPtr vsoApp)
+{
+ //get selected shape
+ int count = vsoApp->ActiveWindow->Selection->Count;
+ if(count != 1)
+ {
+ MessageBox(GetActiveWindow(),
+ _T("To use duplicate-&-drop feature, you must choose exactly one shape on active page."),
+ _T("Error"), MB_OK | MB_ICONEXCLAMATION);
+ return VAORC_FAILURE;
+ }
+ //Visio::IVShapePtr shape = vsoApp->ActiveWindow->Selection->Item[1];
+ Visio::IVShapePtr shape = vsoApp->ActiveWindow->Selection->Item[1];
+ //get mouse position
+ double xPos = 0;
+ double yPos = 0;
+
+ // need to conver units?
+ xPos = m_addon->GetMousePosX();
+ yPos = m_addon->GetMousePosY();
+ //drop the master identic to selected shape
+ Visio::IVPagePtr vsoPage = vsoApp->ActivePage;
+ CDrawingVisualizer visualizer(vsoApp);
+ TShapeType shape_type = get_shape_type(shape);
+ Visio::IVMasterPtr master = visualizer.find_master(shape_type);
+ //drop
+ Visio::IVShapePtr new_shape = vsoPage->Drop(master,xPos,yPos);
+ // check if shape is message, if it is LEFT MESSAGE then swith the direction
+ if(isMessageShape(shape) && CShapeUtils::getMsgDirection(shape) == MSG_RIGHT)
+ {
+ std::vector<_bstr_t> formulas;
+ long scopeId = vsoApp->BeginUndoScope("Flip direction");
+ vsoApp->EventsEnabled = false;
+ //flip message direction
+ for(int i = 0; i < 4; i++)
+ formulas.push_back(new_shape->GetCellsSRC(visSectionObject, visRowXForm1D, i)->FormulaU);
+ try {
+ for(int i = 0; i < 2; i++)
+ {
+ new_shape->GetCellsSRC(visSectionObject, visRowXForm1D, i)->FormulaU = formulas.at(i+2);
+ new_shape->GetCellsSRC(visSectionObject, visRowXForm1D, i+2)->FormulaU = formulas.at(i);
+ }
+ }
+ catch(_com_error err){
+ MessageBox(GetActiveWindow(), L"Exception occurred", L"", MB_OK);
+ }
+ formulas.clear();
+ //Flip lost and found messages
+ if(shape_type == ST_BMSC_MESSAGE_FOUND || shape_type == ST_BMSC_MESSAGE_LOST)
+ {
+ CMessageJump::changeMsgType(new_shape, (TShapeType)((shape_type == 3) ? 2 : 3));
+ CMessageSnapping::resnap(new_shape, vsoApp->ActivePage->Shapes, 0.0001);
+ }
+ vsoApp->EventsEnabled = true;
+ vsoApp->EndUndoScope(scopeId, true);
+ }
+
+ return VAORC_SUCCESS;
+}
+
VAORC CDocumentMonitor::OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp, SelectionType selType)
{
selectAll(vsoApp, true, selType);
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2014-01-11 21:04:52 UTC (rev 1880)
+++ trunk/src/view/visio/addon/document.h 2014-01-16 21:35:00 UTC (rev 1881)
@@ -58,6 +58,7 @@
VAORC OnOpenReference(int iDocumentIndex, int iPageIndex, _bstr_t sShapeU);
void InitMenu();
+ void InitShortcuts();
void InitToolbar();
enum MenuItems
@@ -95,6 +96,11 @@
MENU_THIN_LINES,
};
+ enum ShortCutItems
+ {
+ SHORT_DROP_INST = 401
+ };
+
VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuImport(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuExport(Visio::IVApplicationPtr vsoApp);
@@ -116,6 +122,9 @@
VAORC OnMenuFlipMessageDirection(Visio::IVApplicationPtr vsoApp);
VAORC OnHelp();
+ //shortcuts for dropping shapes
+ VAORC OnShortcutDropInstace(Visio::IVApplicationPtr vsoApp);
+
void ShowReportView();
void OnHideReportView();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|