|
From: <ob...@us...> - 2010-04-20 08:53:31
|
Revision: 721
http://scstudio.svn.sourceforge.net/scstudio/?rev=721&view=rev
Author: obouda
Date: 2010-04-20 08:53:24 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Messsage Sequence function - GUI almost done
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/pageutils.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
Added Paths:
-----------
trunk/src/view/visio/addon/messagesequencedlg.cpp
trunk/src/view/visio/addon/messagesequencedlg.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-04-14 21:29:03 UTC (rev 720)
+++ trunk/src/view/visio/addon/addon.cpp 2010-04-20 08:53:24 UTC (rev 721)
@@ -94,11 +94,13 @@
else
if (!SUCCEEDED(vsoApp.GetActiveObject(Visio::CLSID_Application)))
vsoApp.CreateInstance(Visio::CLSID_Application);
+
+ if (!vsoApp.GetInterfacePtr())
+ return VAORC_FAILURE;
+
+ ResetState(vsoApp);
}
- if (!vsoApp.GetInterfacePtr())
- return VAORC_FAILURE;
-
// get the major version number for Visio
int majorVersion = 0;
BSTR bstrVersion = NULL;
@@ -457,10 +459,15 @@
break;
case Visio::visEvtCodeMouseMove:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeMouseMove");
+ //TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeMouseMove");
HandleMouseMove(pSubjectObj, pSourceObj);
break;
+ case Visio::visEvtCodeWinSelChange:
+ TRACE("CStudioAddon::HandleVisioEvent() visEvtCodeWinSelChange");
+ HandleWinSelChange(pSourceObj);
+ break;
+
default:
TRACE("CStudioAddon::HandleVisioEvent() unexpected event id="
<< std::ios::hex << event);
@@ -561,6 +568,12 @@
void CStudioAddon::HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
{
+ if (vsoKeyboardEvent->KeyCode == VK_ESCAPE)
+ {
+ ResetState(vsoApp);
+ }
+
+ // buttons state
long oldState = m_keyButtonState;
m_keyButtonState = vsoKeyboardEvent->KeyButtonState;
@@ -577,6 +590,18 @@
m_mousePosY = vsoMouseEvent->y;
}
+void CStudioAddon::HandleWinSelChange(Visio::IVApplicationPtr vsoApp)
+{
+ m_oldSelections[vsoApp] = m_curSelections[vsoApp];
+ m_curSelections[vsoApp] = vsoApp->ActiveWindow->Selection;
+
+ if (GetState(vsoApp) == STATE_MESSAGE_SEQUENCE_WAITING_FOR_SEL_CHANGE)
+ {
+ CDocumentMonitor* docMon = GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument);
+ docMon->OnMenuMessageSequence(vsoApp, m_oldSelections[vsoApp]);
+ }
+}
+
void CStudioAddon::RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument)
{
Visio::IVEventPtr vsoDocumentCreateEvent = NULL;
@@ -649,6 +674,8 @@
vsoApp->EventList->AddAdvise(Visio::visEvtCodeKeyUp, varSink, _T(""), _T("KeyUp"));
vsoApp->EventList->AddAdvise(Visio::visEvtCodeMouseMove, varSink, _T(""), _T("MouseMove"));
+ vsoApp->EventList->AddAdvise(visEvtCodeWinSelChange, varSink, _T(""), _T("SelectionChanges"));
+
// Create a monitor class to keep track of this document and the Events
// being monitored for this document.
pDocumentMonitor = new CDocumentMonitor(this, vsoApp, vsoDocument);
@@ -693,4 +720,23 @@
}
}
+void CStudioAddon::SetState(Visio::IVApplicationPtr vsoApp, TAddonState state, const TCHAR* message)
+{
+ m_states[vsoApp] = state;
+ if (message != NULL) {
+ //MessageBox(GetActiveWindow(), message, _T("Status bar"), MB_OK); // FIXME: set status bar text
+ }
+}
+
+void CStudioAddon::ResetState(Visio::IVApplicationPtr vsoApp)
+{
+ m_states[vsoApp] = STATE_INIT;
+ /* // does not work:
+ CDocumentMonitor* docMon = GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument);
+ Visio::IVUIObjectPtr toolbars = docMon->GetMostCustomToolbars();
+ toolbars->StatusBars->ItemAtID[Visio::visUIObjSetDrawing]->StatusBarItems->Item[1]->Caption = _T("Wheee!");
+ */
+ //MessageBox(GetActiveWindow(), _T("Reseting status bar"), _T("Status bar"), MB_OK); // FIXME: reset status bar
+}
+
// $Id$
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-04-14 21:29:03 UTC (rev 720)
+++ trunk/src/view/visio/addon/addon.h 2010-04-20 08:53:24 UTC (rev 721)
@@ -54,11 +54,61 @@
void HandleKeyDown(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
void HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp);
void HandleMouseMove(Visio::IVMouseEventPtr vsoMouseEvent, Visio::IVApplicationPtr vsoApp);
+ void HandleWinSelChange(Visio::IVApplicationPtr vsoApp);
void RegisterPersistentEvents(Visio::IVDocumentPtr vsoDocument);
CDocumentMonitor *GetDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
void StopDocumentMonitor(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument);
+ enum TAddonState
+ {
+ STATE_INIT,
+ STATE_MESSAGE_SEQUENCE_WAITING_FOR_SEL_CHANGE,
+ };
+
+ TAddonState GetState(Visio::IVApplicationPtr vsoApp) { return m_states[vsoApp]; }
+ void SetState(Visio::IVApplicationPtr vsoApp, TAddonState state, const TCHAR* message=NULL);
+ void ResetState(Visio::IVApplicationPtr vsoApp);
+
+ /**
+ * Gets last mouse X-coordinate.
+ * Watch out! It is in units of current page.
+ * @return last X-coordinate of mouse pointer in units of current page
+ */
+ double GetMousePosX() { return m_mousePosX; }
+
+ /**
+ * Gets last mouse Y-coordinate.
+ * Watch out! It is in units of current page.
+ * @return last Y-coordinate of mouse pointer in units of current page
+ */
+ double GetMousePosY() { return m_mousePosY; }
+
+ /**
+ * Saves current mouse position for a later retrieval.
+ * @param vsoApp the app to save the position for
+ */
+ void SaveMousePos(Visio::IVApplicationPtr vsoApp) {
+ m_prevMousePosX[vsoApp] = m_mousePosX;
+ m_prevMousePosY[vsoApp] = m_mousePosY;
+ }
+
+ /**
+ * Retrieves a previously stored mouse position.
+ * It is in units of current page.
+ * @param vsoApp the app it was stored in
+ * @return previously stored X-coordinate of mouse pointer in units of current page
+ */
+ double GetPrevMousePosX(Visio::IVApplicationPtr vsoApp) { return m_prevMousePosX[vsoApp]; }
+
+ /**
+ * Retrieves a previously stored mouse position.
+ * It is in units of current page.
+ * @param vsoApp the app it was stored in
+ * @return previously stored Y-coordinate of mouse pointer in units of current page
+ */
+ double GetPrevMousePosY(Visio::IVApplicationPtr vsoApp) { return m_prevMousePosY[vsoApp]; }
+
private:
IUnknown *m_pIAddonSink;
Visio::IVEventPtr m_vsoMarkerEvent;
@@ -69,6 +119,12 @@
long m_keyButtonState;
double m_mousePosX;
double m_mousePosY;
+
+ std::map<long, TAddonState> m_states;
+ std::map<long, Visio::IVSelectionPtr> m_oldSelections;
+ std::map<long, Visio::IVSelectionPtr> m_curSelections;
+ std::map<long, double> m_prevMousePosX;
+ std::map<long, double> m_prevMousePosY;
};
// $Id$
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-04-14 21:29:03 UTC (rev 720)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-04-20 08:53:24 UTC (rev 721)
@@ -34,18 +34,18 @@
DEFPUSHBUTTON "OK",IDOK,254,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,254,25,50,14
GROUPBOX "Direction:",IDC_STATIC,7,7,241,64
- CONTROL "Left only",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,13,19,44,10
- CONTROL "Right only",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,13,31,48,10
- CONTROL "Left, Right",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,13,43,50,10
- CONTROL "Right, Left",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,13,55,50,10
+ CONTROL "Left only",IDC_MS_DIR_LEFT,"Button",BS_AUTORADIOBUTTON,13,19,44,10
+ CONTROL "Right only",IDC_MS_DIR_RIGHT,"Button",BS_AUTORADIOBUTTON,13,31,48,10
+ CONTROL "Left, Right",IDC_MS_DIR_LEFT_RIGHT,"Button",BS_AUTORADIOBUTTON,13,43,50,10
+ CONTROL "Right, Left",IDC_MS_DIR_RIGHT_LEFT,"Button",BS_AUTORADIOBUTTON,13,55,50,10
LTEXT "Left Message Captions:",IDC_STATIC,90,19,76,8
- EDITTEXT IDC_MC_LEFT_MESSAGE,171,17,67,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_MS_LEFT_MESSAGE,171,17,67,14,ES_AUTOHSCROLL
LTEXT "Right Message Captions:",IDC_STATIC,90,43,80,8
EDITTEXT IDC_MS_RIGHT_MESSAGE,171,41,67,14,ES_AUTOHSCROLL
LTEXT "Starting Y-position:",IDC_STATIC,7,78,62,8
LTEXT "Vertical space between messages:",IDC_STATIC,7,94,111,8
- EDITTEXT IDC_EDIT2,121,76,40,14,ES_AUTOHSCROLL
- EDITTEXT IDC_EDIT3,121,92,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_MS_START_POS_Y,121,76,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_MS_VERTICAL_SPACE,121,92,40,14,ES_AUTOHSCROLL
END
@@ -83,22 +83,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"
-
-/////////////////////////////////////////////////////////////////////////////
-//
// Dialog
//
@@ -183,9 +167,75 @@
END
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_CHECK_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 195
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 154
+ END
+
+ IDD_SIMULATOR_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 186
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 47
+ END
+
+ IDD_FIND_FLOW, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 270
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 106
+ END
+
+ IDD_INSTANCES_FIELD_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 196
+ VERTGUIDE, 10
+ VERTGUIDE, 19
+ VERTGUIDE, 48
+ VERTGUIDE, 64
+ VERTGUIDE, 123
+ VERTGUIDE, 130
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 122
+ HORZGUIDE, 54
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
/////////////////////////////////////////////////////////////////////////////
//
+// 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"
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
// TEXTINCLUDE
//
@@ -258,56 +308,6 @@
/////////////////////////////////////////////////////////////////////////////
//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_CHECK_OPTIONS, DIALOG
- BEGIN
- LEFTMARGIN, 5
- RIGHTMARGIN, 195
- TOPMARGIN, 5
- BOTTOMMARGIN, 154
- END
-
- IDD_SIMULATOR_OPTIONS, DIALOG
- BEGIN
- LEFTMARGIN, 5
- RIGHTMARGIN, 186
- TOPMARGIN, 5
- BOTTOMMARGIN, 47
- END
-
- IDD_FIND_FLOW, DIALOG
- BEGIN
- LEFTMARGIN, 5
- RIGHTMARGIN, 270
- TOPMARGIN, 5
- BOTTOMMARGIN, 106
- END
-
- IDD_INSTANCES_FIELD_OPTIONS, DIALOG
- BEGIN
- LEFTMARGIN, 5
- RIGHTMARGIN, 196
- VERTGUIDE, 10
- VERTGUIDE, 19
- VERTGUIDE, 48
- VERTGUIDE, 64
- VERTGUIDE, 123
- VERTGUIDE, 130
- TOPMARGIN, 5
- BOTTOMMARGIN, 122
- HORZGUIDE, 54
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
// Dialog Info
//
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-04-14 21:29:03 UTC (rev 720)
+++ trunk/src/view/visio/addon/document.cpp 2010-04-20 08:53:24 UTC (rev 721)
@@ -24,7 +24,9 @@
#include "extract.h"
#include "visualize.h"
#include "finddlg.h"
+#include "messagesequencedlg.h"
#include <fstream>
+#include "shapeutils.h"
#include "data/msc.h"
@@ -607,8 +609,8 @@
return VAORC_FAILURE;
}
- float pageWidth = static_cast<float>(CPageUtils::GetPageWidth(vsoApp->ActivePage));
- float pageHeight = static_cast<float>(CPageUtils::GetPageHeight(vsoApp->ActivePage));
+ double pageWidth = CPageUtils::GetPageWidth(vsoApp->ActivePage);
+ double pageHeight = CPageUtils::GetPageHeight(vsoApp->ActivePage);
if (startX < 0 || startY < 0 || startX > pageWidth || startY > pageHeight)
{
@@ -987,82 +989,207 @@
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> CDocumentMonitor::getInstancesPair(Visio::IVApplicationPtr vsoApp)
{
- // FIXME: does not work quite well
- Visio::IVSelectionPtr selection = /*CPageUtils::FilterSelection(*/vsoApp->ActiveWindow->Selection/*, ST_BMSC_INSTANCE)*/;
+ Visio::IVSelectionPtr selection = CPageUtils::FilterSelection(vsoApp->ActiveWindow->Selection, ST_BMSC_INSTANCE);
+ if (selection->Count == 0)
+ {
+ selection->SelectAll();
+ selection = CPageUtils::FilterSelection(selection, ST_BMSC_INSTANCE);
+ }
+
switch (selection->Count)
{
+ case 0:
+ return std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(NULL, NULL);
case 1:
- return std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(selection->Item[1], selection->Item[1]);
+ return std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(selection->Item[1], NULL);
case 2:
// NOTE: respects the order in which the items were selected
return std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(selection->Item[1], selection->Item[2]);
- case 0:
- selection->SelectAll();
default:
Visio::IVShapePtr leftmost = selection->Item[1];
Visio::IVShapePtr rightmost = selection->Item[1];
for (int i=2; i<=selection->Count; i++)
{
- if (CPageUtils::GetShapeBeginX(selection->Item[i]) < CPageUtils::GetShapeBeginX(leftmost))
- {
- leftmost = selection->Item[i];
- }
- if (CPageUtils::GetShapeBeginX(selection->Item[i]) > CPageUtils::GetShapeBeginX(rightmost))
- {
- rightmost = selection->Item[i];
- }
+ Visio::IVShapePtr item = selection->Item[i];
+
+ if (get_shape_type(item) != ST_BMSC_INSTANCE) continue;
+
+ if (item < leftmost) leftmost = item;
+ if (item > rightmost) rightmost = item;
}
return std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(leftmost, rightmost);
}
}
-std::deque<Visio::IVShapePtr> CDocumentMonitor::getInstancesInBetween(Visio::IVApplicationPtr vsoApp, Visio::IVShapePtr boundaryOne, Visio::IVShapePtr boundaryTwo, float yCoord)
+std::vector<Visio::IVShapePtr> CDocumentMonitor::getInstancesInBetween(Visio::IVApplicationPtr vsoApp, Visio::IVShapePtr boundaryOne, Visio::IVShapePtr boundaryTwo, double yCoord)
{
- std::deque<Visio::IVShapePtr> qualified;
- if (CPageUtils::GetShapeBeginX(boundaryOne) == CPageUtils::GetShapeBeginX(boundaryTwo))
+ std::vector<Visio::IVShapePtr> qualified;
+ double fromX = CShapeUtils::GetShapeBeginX(boundaryOne);
+ double toX = CShapeUtils::GetShapeBeginX(boundaryTwo);
+
+ if (fabs(fromX - toX) < EPSILON)
+ return qualified;
+ if (fabs(fromX - CShapeUtils::GetShapeEndX(boundaryOne)) > EPSILON)
+ return qualified;
+ if (fabs(toX - CShapeUtils::GetShapeEndX(boundaryTwo)) > EPSILON)
+ return qualified;
+ if (CShapeUtils::GetShapeBeginY(boundaryOne) < yCoord ||
+ CShapeUtils::GetShapeEndY(boundaryOne) > yCoord ||
+ CShapeUtils::GetShapeBeginY(boundaryTwo) < yCoord ||
+ CShapeUtils::GetShapeEndY(boundaryTwo) > yCoord)
{
+ // some boundary out of yCoord
return qualified;
}
- // TODO: implement
+ qualified.push_back(boundaryOne);
+ qualified.push_back(boundaryTwo);
+
+ Visio::IVPagePtr page = boundaryOne->ContainingPage;
+ // push back all qualifying shapes based on X-coord and Y-coord
+ for (int i=1; i <= page->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = page->Shapes->Item[i];
+
+ if (get_shape_type(shape) != ST_BMSC_INSTANCE) continue;
+
+ double bX = CShapeUtils::GetShapeBeginX(shape);
+ double eX = CShapeUtils::GetShapeEndX(shape);
+ double bY = CShapeUtils::GetShapeBeginY(shape);
+ double eY = CShapeUtils::GetShapeEndY(shape);
+
+ if (fabs(bX - eX) > EPSILON) continue; // not vertical
+ if (bY < yCoord || eY > yCoord) continue; // wrong yCoord
+
+ if ((fromX < bX && bX < toX) || (fromX > bX && bX > toX))
+ {
+ qualified.push_back(shape);
+ }
+ }
+
+ CShapeComparator comp((fromX < toX ? ORDER_DESC : ORDER_ASC));
+ std::sort(qualified.begin(), qualified.end(), comp);
return qualified;
-}
+ }
-VAORC CDocumentMonitor::OnMenuMessageSequence(Visio::IVApplicationPtr vsoApp)
+VAORC CDocumentMonitor::OnMenuMessageSequence(Visio::IVApplicationPtr vsoApp, Visio::IVSelectionPtr oldSelection)
{
+ // step 1: determine the boundary instances between which to draw message sequence
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> boundaries = getInstancesPair(vsoApp);
- if (boundaries.first == boundaries.second)
+ if (boundaries.first == NULL)
{
- // prompt to select another instance
- // TODO
- /*
MessageBox(GetActiveWindow(),
- _T("Selected just one instance"), _T("Selected"), MB_OK);
+ _T("There are no instances in the current selection or drawing."), _T("Error"), MB_OK | MB_ICONEXCLAMATION);
return VAORC_FAILURE;
- */
}
-/* DEBUG
- MessageBox(GetActiveWindow(),
- boundaries.first->Name,
- _T("Selected as first"), MB_OK
- );
- MessageBox(GetActiveWindow(),
- boundaries.second->Name,
- _T("Selected as second"), MB_OK
- );
-*/
- MessageBox(GetActiveWindow(),
- _T("Message Sequence not implemented yet"), _T("Error"), MB_OK | MB_ICONEXCLAMATION);
+
+ double initYPos = m_addon->GetMousePosY();
+
+ if (m_addon->GetState(vsoApp) == CStudioAddon::STATE_MESSAGE_SEQUENCE_WAITING_FOR_SEL_CHANGE)
+ {
+ // was waiting for selecting another instance
+ // continue only if the user selected exactly one instance both before and now
+ m_addon->ResetState(vsoApp);
+ if (boundaries.second != NULL || oldSelection->Count != 1)
+ {
+ return VAORC_FAILURE;
+ }
+ boundaries.second = boundaries.first;
+ boundaries.first = oldSelection->Item[1];
+ initYPos = m_addon->GetPrevMousePosY(vsoApp);
+ }
+ else
+ {
+ if (boundaries.second == NULL)
+ {
+ // selected just one instance, prompt to select another
+ this->m_addon->SetState(vsoApp, CStudioAddon::STATE_MESSAGE_SEQUENCE_WAITING_FOR_SEL_CHANGE,
+ _T("Select another instance to draw a message sequence to."));
+ this->m_addon->SaveMousePos(vsoApp);
+ return VAORC_SUCCESS;
+ }
+ }
+
+ // step 2: basic validation - intersect the two instances in their y-coords?
+ if (CShapeUtils::GetShapeBeginY(boundaries.first) < CShapeUtils::GetShapeEndY(boundaries.second) ||
+ CShapeUtils::GetShapeBeginY(boundaries.second) < CShapeUtils::GetShapeEndY(boundaries.first))
+ {
+ MessageBox(GetActiveWindow(),
+ _T("The instances are in wrong positions to make\na message sequence between them."),
+ _T("Error"), MB_OK | MB_ICONEXCLAMATION);
+ return VAORC_FAILURE;
+ }
+
+ // step 3: dialog
+ MsgSeqDirection origDir = (boundaries.first < boundaries.second ? MSDIR_RIGHT : MSDIR_LEFT);
+ CMessageSequenceDlg dlg(vsoApp, initYPos, origDir);
+ // TODO: during filling the dialog, mark all the instances taken into account (depends on the y-coord)
+ if (!dlg.DoModal()) return VAORC_FAILURE;
+
+ MsgSeqDirection direction = dlg.m_direction;
+ double startPosY = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_start_pos_y);
+ double verticalSpace = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_vertical_space);
+ CString leftMessage = dlg.m_left_msg_captions;
+ CString rightMessage = dlg.m_right_msg_captions;
+
+ // step 4: make an ordered list of instances being subject of message sequence drawing
+ std::pair<Visio::IVShapePtr, Visio::IVShapePtr> orderedBoundaries = std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(boundaries.first, boundaries.second);
+ if (orderedBoundaries.first > orderedBoundaries.second)
+ {
+ swap(orderedBoundaries);
+ }
+ // order the pair so that we get the right direction by iterating the resulting list
+ if (direction == MSDIR_RIGHT || direction == MSDIR_RIGHT_LEFT)
+ {
+ swap(orderedBoundaries);
+ }
+ // get the ordered list
+ std::vector<Visio::IVShapePtr> instList = getInstancesInBetween(vsoApp, orderedBoundaries.first, orderedBoundaries.second, startPosY);
+
+ if (instList.size() == 0)
+ {
+ MessageBox(GetActiveWindow(),
+ _T("No instances matching the criteria.\nMaybe the Y-start (mouse position) is wrong?"),
+ _T("Error"), MB_OK | MB_ICONEXCLAMATION);
+ return VAORC_FAILURE;
+ }
+
+ // step 5: draw the message sequence along the list
+ double yPos = startPosY;
+ std::vector<Visio::IVShapePtr>::iterator from = instList.begin();
+ std::vector<Visio::IVShapePtr>::iterator to = instList.begin();
+ ++to;
+ for ( ; to != instList.end(); ++from, ++to, yPos+=verticalSpace)
+ {
+ TRACE("Drawing from " << (*from)->Name << " to " << (*to)->Name << " at y=" << yPos);
+ DrawMessage(*from, *to, yPos, (*from < *to ? rightMessage : leftMessage));
+ }
+ if (direction == MSDIR_LEFT_RIGHT || direction == MSDIR_RIGHT_LEFT)
+ {
+ std::vector<Visio::IVShapePtr>::reverse_iterator rfrom = instList.rbegin();
+ std::vector<Visio::IVShapePtr>::reverse_iterator rto = instList.rbegin();
+ ++rto;
+ for ( ; rto != instList.rend(); ++rfrom, ++rto, yPos+=verticalSpace)
+ {
+ TRACE("Drawing from " << (*rfrom)->Name << " to " << (*rto)->Name << " at y=" << yPos);
+ DrawMessage(*rfrom, *rto, yPos, (*rfrom < *rto ? rightMessage : leftMessage));
+ }
+ }
+
return VAORC_SUCCESS;
- // TODO: validation - are the two instances chosen compatible for message sequence? (i.e. intersect in their y-coords?)
- // TODO: show an options dialog
- // TODO: during filling the dialog, mark all the instances taken into account (depends on the y-coord)
- // TODO: make a list of instances being subject of message sequence drawing
- float yCoord;
- std::deque<Visio::IVShapePtr> subjectInstances = getInstancesInBetween(vsoApp, boundaries.first, boundaries.second, yCoord);
- // TODO: draw the message sequence
}
+void CDocumentMonitor::DrawMessage(Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption)
+{
+ // DEBUG:
+ CString fromName((const char*)from->Name);
+ CString toName((const char*)to->Name);
+ CString msg;
+ msg.Format(_T("Drawing from\n%s\nto\n%s"), fromName, toName);
+ MessageBox(GetActiveWindow(), msg, _T("INFO"), MB_OK | MB_ICONINFORMATION);
+ // TODO: implement
+}
+
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-04-14 21:29:03 UTC (rev 720)
+++ trunk/src/view/visio/addon/document.h 2010-04-20 08:53:24 UTC (rev 721)
@@ -17,6 +17,7 @@
*/
#pragma once
+#include "stdafx.h"
#include "reportview.h"
#include "data/formatter.h"
#include "data/checker.h"
@@ -24,16 +25,25 @@
#include "data/simulator.h"
#include "data/transformer.h"
#include "pageutils.h"
+#include "addon.h"
//! template used to create new documents
static const _bstr_t VST_FILE_NAME = _T("MSC.vtx");
-class CStudioAddon;
-
typedef std::vector<FormatterPtr> FormatterPtrList;
typedef std::vector<CheckerPtr> CheckerPtrList;
typedef std::vector<TransformerPtr> TransformerPtrList;
+const double EPSILON = 1e-10;
+
+template <typename T1, typename T2>
+void swap(std::pair<T1,T2> &p)
+{
+ T1 t = p.first;
+ p.first = p.second;
+ p.second = t;
+}
+
class CDocumentMonitor : public SimulationListener
{
public:
@@ -76,7 +86,7 @@
VAORC OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index);
VAORC OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp, bool add); // FIXME: refactor: define enum types
VAORC OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp, bool add); // FIXME: refactor: define enum types
- VAORC OnMenuMessageSequence(Visio::IVApplicationPtr vsoApp);
+ VAORC OnMenuMessageSequence(Visio::IVApplicationPtr vsoApp, Visio::IVSelectionPtr oldSelection=NULL);
VAORC OnMenuFindFlow(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStart(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStop(Visio::IVApplicationPtr vsoApp);
@@ -224,11 +234,13 @@
* If there are no instances selected in the application, the instances returned
* are the leftmost and the rightmost of all instances on the active page.
* If there is exactly 1 instance selected, it puts it into the returned pair both at first
- * and second position.
+ * and NULL at second position.
* If there are exactly 2 instances selected, these two are returned in the order of
* their selection.
* If more than 2 instances are selected, returned are the leftmost and the rightmost
* of the selected instances.
+ * Anyway, if there are no instances available, a pair of two NULL pointers is returned,
+ * or if there is just one instance, a pair with a pointer to it and NULL is returned.
*
* @param vsoApp the application to get the instances from
* @return a pair of instances chosen using rules mentioned above
@@ -246,15 +258,32 @@
* all instances returned are ordered by the x-coords in the ascending direction; otherwise,
* they are returned in a descending order.
* In the special case both boundaries are of same x-coords, an empty list is returned.
+ * An empty list is also returned if any of the boundaries is not strictly vertical.
+ * Those other instances which would qualify to the resulting list, but are not vertical,
+ * are filtered out.
*
+ * The yCoord is an absolute coordinate (i.e. relative to the page); if any of the boundary
+ * instances do not intersect a line at yCoord, an empty list is returned.
+ *
* @param vsoApp application to get the instances in
* @param boundaryOne an instances serving as one of boundaries
* @param boundaryTwo another instance serving as a boundary
* @param yCoord height of an imaginary line which all returned instances must intersect
* @return a list of instances meeting above criteria according to boundaries and yCoord given
*/
- std::deque<Visio::IVShapePtr> getInstancesInBetween(Visio::IVApplicationPtr vsoApp, Visio::IVShapePtr boundaryOne, Visio::IVShapePtr boundaryTwo, float yCoord);
+ std::vector<Visio::IVShapePtr> getInstancesInBetween(Visio::IVApplicationPtr vsoApp, Visio::IVShapePtr boundaryOne, Visio::IVShapePtr boundaryTwo, double yCoord);
+ /**
+ * Draws a message between the given instances at yCoord.
+ *
+ * @param from from which instance
+ * @param to to which instance
+ * @param yCoord the y-coordinate at which to draw the message; relative to the page
+ * @param caption caption of the message
+ */
+ void DrawMessage(Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption);
+
+public:
Visio::IVUIObjectPtr GetMostCustomMenus();
Visio::IVUIObjectPtr GetMostCustomToolbars();
};
Modified: trunk/src/view/visio/addon/instancesfielddlg.cpp
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-04-14 21:29:03 UTC (rev 720)
+++ trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-04-20 08:53:24 UTC (rev 721)
@@ -29,11 +29,11 @@
Visio::IVPagePtr page = vsoApp->ActivePage;
// we got the mouse coordinates in the internal units
- m_mousePosX = static_cast<float>(CPageUtils::ConvertUnits(page, mousePosX, 0, visPageUnits));
- m_mousePosY = static_cast<float>(CPageUtils::ConvertUnits(page, mousePosY, 0, visPageUnits));
+ m_mousePosX = CPageUtils::ConvertUnits(page, mousePosX, 0, visPageUnits);
+ m_mousePosY = CPageUtils::ConvertUnits(page, mousePosY, 0, visPageUnits);
- m_pageWidth = static_cast<float>(CPageUtils::GetPageWidth(page));
- m_pageHeight = static_cast<float>(CPageUtils::GetPageHeight(page));
+ m_pageWidth = CPageUtils::GetPageWidth(page);
+ m_pageHeight = CPageUtils::GetPageHeight(page);
}
void CInstancesFieldDlg::OnDa...
[truncated message content] |
|
From: <ob...@us...> - 2010-04-25 16:30:17
|
Revision: 725
http://scstudio.svn.sourceforge.net/scstudio/?rev=725&view=rev
Author: obouda
Date: 2010-04-25 16:30:11 +0000 (Sun, 25 Apr 2010)
Log Message:
-----------
Message Sequence function - real drawing of messages
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/scstudio.vcproj
trunk/src/view/visio/addon/shapeutils.h
trunk/src/view/visio/addon/visualize.cpp
trunk/src/view/visio/addon/visualize.h
Added Paths:
-----------
trunk/src/view/visio/addon/shapeutils.cpp
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-04-25 14:42:25 UTC (rev 724)
+++ trunk/src/view/visio/addon/document.cpp 2010-04-25 16:30:11 UTC (rev 725)
@@ -1021,7 +1021,7 @@
}
}
-std::vector<Visio::IVShapePtr> CDocumentMonitor::getInstancesInBetween(Visio::IVApplicationPtr vsoApp, Visio::IVShapePtr boundaryOne, Visio::IVShapePtr boundaryTwo, double yCoord)
+std::vector<Visio::IVShapePtr> CDocumentMonitor::getInstancesInBetween(Visio::IVShapePtr boundaryOne, Visio::IVShapePtr boundaryTwo, double yCoord)
{
std::vector<Visio::IVShapePtr> qualified;
double fromX = CShapeUtils::GetShapeBeginX(boundaryOne);
@@ -1110,7 +1110,7 @@
}
}
- // step 2: basic validation - intersect the two instances in their y-coords?
+ // step 2: basic validation - do the two instances intersect in their y-coords?
if (CShapeUtils::GetShapeBeginY(boundaries.first) < CShapeUtils::GetShapeEndY(boundaries.second) ||
CShapeUtils::GetShapeBeginY(boundaries.second) < CShapeUtils::GetShapeEndY(boundaries.first))
{
@@ -1124,6 +1124,7 @@
MsgSeqDirection origDir = (boundaries.first < boundaries.second ? MSDIR_RIGHT : MSDIR_LEFT);
CMessageSequenceDlg dlg(vsoApp, initYPos, origDir);
// TODO: during filling the dialog, mark all the instances taken into account (depends on the y-coord)
+ // MarkShape(ivinstanceptr);
if (!dlg.DoModal()) return VAORC_FAILURE;
MsgSeqDirection direction = dlg.m_direction;
@@ -1131,10 +1132,13 @@
double verticalSpace = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_vertical_space);
CString leftMessage = dlg.m_left_msg_captions;
CString rightMessage = dlg.m_right_msg_captions;
+ if (leftMessage.GetLength() == 0) leftMessage = "NAME";
+ if (rightMessage.GetLength() == 0) rightMessage = "NAME";
// step 4: make an ordered list of instances being subject of message sequence drawing
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> orderedBoundaries = std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(boundaries.first, boundaries.second);
- if (orderedBoundaries.first > orderedBoundaries.second)
+ CShapeComparator cmp;
+ if (!cmp(orderedBoundaries.first, orderedBoundaries.second))
{
swap(orderedBoundaries);
}
@@ -1144,7 +1148,7 @@
swap(orderedBoundaries);
}
// get the ordered list
- std::vector<Visio::IVShapePtr> instList = getInstancesInBetween(vsoApp, orderedBoundaries.first, orderedBoundaries.second, startPosY);
+ std::vector<Visio::IVShapePtr> instList = getInstancesInBetween(orderedBoundaries.first, orderedBoundaries.second, startPosY);
if (instList.size() == 0)
{
@@ -1155,39 +1159,60 @@
}
// step 5: draw the message sequence along the list
+ long undoScope = vsoApp->BeginUndoScope("Message Sequence"); // FIXME: makes "New Row" undo action, would like to have "Message Sequence"
+ Visio::IVPagePtr vsoPage = vsoApp->ActivePage;
+ CDrawingVisualizer visualizer(vsoApp);
+ Visio::IVMasterPtr msgMaster = visualizer.find_master(ST_BMSC_MESSAGE);
+ Visio::IVSelectionPtr selection = vsoPage->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper);
+
double yPos = startPosY;
std::vector<Visio::IVShapePtr>::iterator from = instList.begin();
std::vector<Visio::IVShapePtr>::iterator to = instList.begin();
++to;
- for ( ; to != instList.end(); ++from, ++to, yPos+=verticalSpace)
+ const TCHAR* caption = (*from < *to ? rightMessage : leftMessage);
+ for ( ; to != instList.end(); ++from, ++to, yPos-=verticalSpace)
{
TRACE("Drawing from " << (*from)->Name << " to " << (*to)->Name << " at y=" << yPos);
- DrawMessage(*from, *to, yPos, (*from < *to ? rightMessage : leftMessage));
+ Visio::IVShapePtr msg = DrawMessage(msgMaster, *from, *to, yPos, caption);
+ selection->Select(msg, Visio::visSelect);
}
+
if (direction == MSDIR_LEFT_RIGHT || direction == MSDIR_RIGHT_LEFT)
{
std::vector<Visio::IVShapePtr>::reverse_iterator rfrom = instList.rbegin();
std::vector<Visio::IVShapePtr>::reverse_iterator rto = instList.rbegin();
++rto;
- for ( ; rto != instList.rend(); ++rfrom, ++rto, yPos+=verticalSpace)
+ const TCHAR* caption = (*rfrom < *rto ? rightMessage : leftMessage);
+ for ( ; rto != instList.rend(); ++rfrom, ++rto, yPos-=verticalSpace)
{
TRACE("Drawing from " << (*rfrom)->Name << " to " << (*rto)->Name << " at y=" << yPos);
- DrawMessage(*rfrom, *rto, yPos, (*rfrom < *rto ? rightMessage : leftMessage));
+ Visio::IVShapePtr msg = DrawMessage(msgMaster, *rfrom, *rto, yPos, caption);
+ selection->Select(msg, Visio::visSelect);
}
}
+ vsoApp->EndUndoScope(undoScope, true);
+ vsoApp->ActiveWindow->Selection = selection;
+
return VAORC_SUCCESS;
}
-void CDocumentMonitor::DrawMessage(Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption)
+Visio::IVShapePtr CDocumentMonitor::DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption)
{
- // DEBUG:
- CString fromName((const char*)from->Name);
- CString toName((const char*)to->Name);
- CString msg;
- msg.Format(_T("Drawing from\n%s\nto\n%s"), fromName, toName);
- MessageBox(GetActiveWindow(), msg, _T("INFO"), MB_OK | MB_ICONINFORMATION);
- // TODO: implement
+ Visio::IVShapePtr vsoMsg = from->Application->ActivePage->Drop(msgMaster, 0, 0);
+ vsoMsg->Text = caption;
+
+ Visio::IVCellPtr fromCell = vsoMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
+ double fromLen = CShapeUtils::GetShapeBeginY(from) - CShapeUtils::GetShapeEndY(from);
+ double fromYOffset = CShapeUtils::GetShapeBeginY(from) - yCoord;
+ fromCell->GlueToPos(from, (fromYOffset/fromLen), 0.5); // NOTE: Visio's x-axis is here in fact y, and vice versa
+
+ Visio::IVCellPtr toCell = vsoMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX];
+ double toLen = CShapeUtils::GetShapeBeginY(to) - CShapeUtils::GetShapeEndY(to);
+ double toYOffset = CShapeUtils::GetShapeBeginY(from) - yCoord;
+ toCell->GlueToPos(to, (toYOffset/toLen), 0.5); // NOTE: Visio's x-axis is here in fact y, and vice versa
+
+ return vsoMsg;
}
VAORC CDocumentMonitor::OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp)
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-04-25 14:42:25 UTC (rev 724)
+++ trunk/src/view/visio/addon/document.h 2010-04-25 16:30:11 UTC (rev 725)
@@ -265,13 +265,12 @@
* The yCoord is an absolute coordinate (i.e. relative to the page); if any of the boundary
* instances do not intersect a line at yCoord, an empty list is returned.
*
- * @param vsoApp application to get the instances in
* @param boundaryOne an instances serving as one of boundaries
* @param boundaryTwo another instance serving as a boundary
* @param yCoord height of an imaginary line which all returned instances must intersect
* @return a list of instances meeting above criteria according to boundaries and yCoord given
*/
- std::vector<Visio::IVShapePtr> getInstancesInBetween(Visio::IVApplicationPtr vsoApp, Visio::IVShapePtr boundaryOne, Visio::IVShapePtr boundaryTwo, double yCoord);
+ std::vector<Visio::IVShapePtr> getInstancesInBetween(Visio::IVShapePtr boundaryOne, Visio::IVShapePtr boundaryTwo, double yCoord);
/**
* Draws a message between the given instances at yCoord.
@@ -280,8 +279,9 @@
* @param to to which instance
* @param yCoord the y-coordinate at which to draw the message; relative to the page
* @param caption caption of the message
+ * @return pointer to the message shape drawn
*/
- void DrawMessage(Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption);
+ Visio::IVShapePtr DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption);
public:
Visio::IVUIObjectPtr GetMostCustomMenus();
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-04-25 14:42:25 UTC (rev 724)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-04-25 16:30:11 UTC (rev 725)
@@ -368,6 +368,10 @@
>
</File>
<File
+ RelativePath=".\shapeutils.cpp"
+ >
+ </File>
+ <File
RelativePath=".\shapeutils.h"
>
</File>
Added: trunk/src/view/visio/addon/shapeutils.cpp
===================================================================
--- trunk/src/view/visio/addon/shapeutils.cpp (rev 0)
+++ trunk/src/view/visio/addon/shapeutils.cpp 2010-04-25 16:30:11 UTC (rev 725)
@@ -0,0 +1,60 @@
+/*
+ * 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 <ond...@wh...>
+ *
+ * $Id$
+ */
+#include "shapeutils.h"
+
+void CShapeUtils::GlueBeginToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos)
+{
+ double height = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
+ double width = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormWidth]->Result[visMillimeters];
+
+ Visio::IVCellPtr cell = what->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
+ // glue coordinates represent decimal fractions of the shape's width and height
+ // note: instances in Visio are rotated by 90', height is the 'x' coordinate
+ cell->GlueToPos(where, pos.get_y()/max(1.0,width), pos.get_x()/max(1.0,height));
+}
+
+void CShapeUtils::GlueBeginToShape(Visio::IVShapePtr what, Visio::IVShapePtr where)
+{
+ double height = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
+ double width = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormWidth]->Result[visMillimeters];
+
+ Visio::IVCellPtr from_cell = what->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
+ Visio::IVCellPtr to_cell = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormPinX];
+
+ from_cell->GlueTo(to_cell);
+}
+
+void CShapeUtils::GlueEndToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos)
+{
+ double height = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
+ double width = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormWidth]->Result[visMillimeters];
+
+ Visio::IVCellPtr cell = what->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX];
+ // note: instances in Visio are rotated by 90', height is the 'x' coordinate
+ cell->GlueToPos(where, pos.get_y()/max(1.0,width), pos.get_x()/max(1.0,height));
+}
+
+bool CShapeComparator::operator()(const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
+{
+ if (direction == ORDER_ASC)
+ return (CShapeUtils::GetShapeBeginX(shapeOne) < CShapeUtils::GetShapeBeginX(shapeTwo));
+ else
+ return (CShapeUtils::GetShapeBeginX(shapeOne) > CShapeUtils::GetShapeBeginX(shapeTwo));
+}
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/shapeutils.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2010-04-25 14:42:25 UTC (rev 724)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-04-25 16:30:11 UTC (rev 725)
@@ -37,22 +37,12 @@
static double GetShapeBeginY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[""]; }
static double GetShapeEndY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[""]; }
+ static void GlueBeginToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos);
+ static void GlueBeginToShape(Visio::IVShapePtr what, Visio::IVShapePtr where);
+ static void GlueEndToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos);
};
/**
- * Orders two shapes according to their X-coordinate
- */
-bool operator < (const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
-{
- return CShapeUtils::GetShapeBeginX(shapeOne) < CShapeUtils::GetShapeBeginX(shapeTwo);
-}
-
-bool operator > (const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
-{
- return CShapeUtils::GetShapeBeginX(shapeTwo) < CShapeUtils::GetShapeBeginX(shapeOne);
-}
-
-/**
* Shape comparator suitable for sorting. Allows for ascending or descending order.
*/
class CShapeComparator
@@ -61,13 +51,7 @@
public:
CShapeComparator(TOrderingDirection direction=ORDER_ASC) : direction(direction) {}
- bool operator()(const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
- {
- if (direction == ORDER_ASC)
- return (shapeOne < shapeTwo);
- else
- return (shapeTwo < shapeOne);
- }
+ bool operator()(const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo);
};
// $Id$
Modified: trunk/src/view/visio/addon/visualize.cpp
===================================================================
--- trunk/src/view/visio/addon/visualize.cpp 2010-04-25 14:42:25 UTC (rev 724)
+++ trunk/src/view/visio/addon/visualize.cpp 2010-04-25 16:30:11 UTC (rev 725)
@@ -270,6 +270,7 @@
what->CellsSRC[visSectionCharacter][visRowCharacter][visCharacterColor]->ResultIU = 2;
}
+// FIXME: duplicate of CShapeUtils::GlueBeginToPos - remove from here
void GlueBeginToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos)
{
double height = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
@@ -281,6 +282,7 @@
cell->GlueToPos(where, pos.get_y()/max(1.0,width), pos.get_x()/max(1.0,height));
}
+// FIXME: duplicate of CShapeUtils::GlueBeginToShape - remove from here
void GlueBeginToShape(Visio::IVShapePtr what, Visio::IVShapePtr where)
{
double height = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
@@ -292,6 +294,7 @@
from_cell->GlueTo(to_cell);
}
+// FIXME: duplicate of CShapeUtils::GlueEndToPos - remove from here
void GlueEndToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos)
{
double height = where->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters];
Modified: trunk/src/view/visio/addon/visualize.h
===================================================================
--- trunk/src/view/visio/addon/visualize.h 2010-04-25 14:42:25 UTC (rev 724)
+++ trunk/src/view/visio/addon/visualize.h 2010-04-25 16:30:11 UTC (rev 725)
@@ -47,11 +47,11 @@
bool m_ask_overwrite; //! ask if the target page is not empty
+ Visio::IVMasterPtr find_master(TShapeType type, int style = 0);
+
protected:
Visio::IVApplicationPtr m_vsoApp;
- Visio::IVMasterPtr find_master(TShapeType type, int style = 0);
-
typedef std::map<MasterId, Visio::IVMasterPtr> MasterIdMap;
MasterIdMap m_masters;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-04-25 16:50:48
|
Revision: 726
http://scstudio.svn.sourceforge.net/scstudio/?rev=726&view=rev
Author: obouda
Date: 2010-04-25 16:50:42 +0000 (Sun, 25 Apr 2010)
Log Message:
-----------
Some minor Visio addon refactoring
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-04-25 16:30:11 UTC (rev 725)
+++ trunk/src/view/visio/addon/addon.cpp 2010-04-25 16:50:42 UTC (rev 726)
@@ -310,16 +310,16 @@
return DisplayCheckOptions();
case CDocumentMonitor::MENU_SELECT_ALL_INSTANCES:
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Instances'");
- return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, false);
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, SELECTION_REPLACE);
case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES:
TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'");
- return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, false);
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, SELECTION_REPLACE);
case CDocumentMonitor::MENU_SELECT_ADD_ALL_INSTANCES:
TRACE("CStudioAddon::Run() add all instances to the current selection");
- return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, true);
+ return pDocumentMonitor->OnMenuSelectAllInstances(vsoApp, SELECTION_ADD);
case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES:
TRACE("CStudioAddon::Run() add all messages to the current selection");
- return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, true);
+ return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp, SELECTION_ADD);
default:
TRACE("CStudioAddon::Run() unexpected event id=" << iEvent);
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-04-25 16:30:11 UTC (rev 725)
+++ trunk/src/view/visio/addon/document.cpp 2010-04-25 16:50:42 UTC (rev 726)
@@ -648,7 +648,7 @@
bmsc->add_instance(inst);
}
- /* FIXME: crashes, we will make visualize_bmsc public in the meantime
+ /* // FIXME: crashes, we will make visualize_bmsc public in the meantime
std::vector<MscPtr> msc;
msc.push_back(bmsc);
visualizer.visualize_msc(vsoPage, msc);
@@ -945,11 +945,11 @@
return VAORC_SUCCESS;
}
-void CDocumentMonitor::selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, bool add_to_selection)
+void CDocumentMonitor::selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, SelectionType selType)
{
Visio::IVPagePtr page = vsoApp->ActivePage;
Visio::IVSelectionPtr selection;
- if (add_to_selection)
+ if (selType == SELECTION_ADD)
selection = vsoApp->ActiveWindow->Selection;
else
selection = page->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper);
@@ -975,15 +975,15 @@
vsoApp->ActiveWindow->Selection = selection;
}
-VAORC CDocumentMonitor::OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp, bool add)
+VAORC CDocumentMonitor::OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp, SelectionType selType)
{
- selectAll(vsoApp, true, add);
+ selectAll(vsoApp, true, selType);
return VAORC_SUCCESS;
}
-VAORC CDocumentMonitor::OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp, bool add)
+VAORC CDocumentMonitor::OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp, SelectionType selType)
{
- selectAll(vsoApp, false, add);
+ selectAll(vsoApp, false, selType);
return VAORC_SUCCESS;
}
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-04-25 16:30:11 UTC (rev 725)
+++ trunk/src/view/visio/addon/document.h 2010-04-25 16:50:42 UTC (rev 726)
@@ -44,6 +44,12 @@
p.second = t;
}
+enum SelectionType
+{
+ SELECTION_ADD,
+ SELECTION_REPLACE,
+};
+
class CDocumentMonitor : public SimulationListener
{
public:
@@ -84,8 +90,8 @@
VAORC OnMenuExport(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuRepaint(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index);
- VAORC OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp, bool add); // FIXME: refactor: define enum types
- VAORC OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp, bool add); // FIXME: refactor: define enum types
+ VAORC OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp, SelectionType selType);
+ VAORC OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp, SelectionType selType);
VAORC OnMenuMessageSequence(Visio::IVApplicationPtr vsoApp, Visio::IVSelectionPtr oldSelection=NULL);
VAORC OnMenuFindFlow(Visio::IVApplicationPtr vsoApp);
VAORC OnMenuSimulationStart(Visio::IVApplicationPtr vsoApp);
@@ -223,10 +229,10 @@
* @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
+ * @param selType selection type - either add all objects to an existing selection, or
+ * replace the old selection with the new one
*/
- void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, bool add_to_selection); // FIXME: refactor: define enum instead of bool add_to_selection, pass TShapeType instead of select_instances and use CPageUtils::filterSelection() (but watch out when adding to an existing selection)
+ void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, SelectionType selType); // FIXME: refactor: pass TShapeType instead of select_instances and use CPageUtils::filterSelection() (but watch out when adding to an existing selection)
/**
* Gets a pair of instances based on the current selection.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-04-25 23:28:09
|
Revision: 727
http://scstudio.svn.sourceforge.net/scstudio/?rev=727&view=rev
Author: obouda
Date: 2010-04-25 23:28:03 +0000 (Sun, 25 Apr 2010)
Log Message:
-----------
Message Sequence function - message captions now work (but are not yet stored in the registry)
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/messagesequencedlg.cpp
trunk/src/view/visio/addon/messagesequencedlg.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/shapeutils.cpp
trunk/src/view/visio/addon/shapeutils.h
trunk/src/view/visio/addon/visualize.cpp
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-04-25 16:50:42 UTC (rev 726)
+++ trunk/src/view/visio/addon/document.cpp 2010-04-25 23:28:03 UTC (rev 727)
@@ -1122,23 +1122,24 @@
// step 3: dialog
MsgSeqDirection origDir = (boundaries.first < boundaries.second ? MSDIR_RIGHT : MSDIR_LEFT);
+ CShapeUtils::MarkShape(boundaries.first);
+ CShapeUtils::MarkShape(boundaries.second);
CMessageSequenceDlg dlg(vsoApp, initYPos, origDir);
- // TODO: during filling the dialog, mark all the instances taken into account (depends on the y-coord)
- // MarkShape(ivinstanceptr);
- if (!dlg.DoModal()) return VAORC_FAILURE;
+ LRESULT dlgResult = dlg.DoModal(); // update the instances marking on update of yCoord
+ CShapeUtils::UnmarkShape(boundaries.first);
+ CShapeUtils::UnmarkShape(boundaries.second);
+ if (!dlgResult) return VAORC_FAILURE;
MsgSeqDirection direction = dlg.m_direction;
double startPosY = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_start_pos_y);
double verticalSpace = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_vertical_space);
CString leftMessage = dlg.m_left_msg_captions;
CString rightMessage = dlg.m_right_msg_captions;
- if (leftMessage.GetLength() == 0) leftMessage = "NAME";
- if (rightMessage.GetLength() == 0) rightMessage = "NAME";
// step 4: make an ordered list of instances being subject of message sequence drawing
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> orderedBoundaries = std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(boundaries.first, boundaries.second);
- CShapeComparator cmp;
- if (!cmp(orderedBoundaries.first, orderedBoundaries.second))
+ CShapeComparator instanceCmp;
+ if (!instanceCmp(orderedBoundaries.first, orderedBoundaries.second))
{
swap(orderedBoundaries);
}
@@ -1169,7 +1170,7 @@
std::vector<Visio::IVShapePtr>::iterator from = instList.begin();
std::vector<Visio::IVShapePtr>::iterator to = instList.begin();
++to;
- const TCHAR* caption = (*from < *to ? rightMessage : leftMessage);
+ const TCHAR* caption = (instanceCmp(*from, *to) ? rightMessage : leftMessage);
for ( ; to != instList.end(); ++from, ++to, yPos-=verticalSpace)
{
TRACE("Drawing from " << (*from)->Name << " to " << (*to)->Name << " at y=" << yPos);
@@ -1182,7 +1183,7 @@
std::vector<Visio::IVShapePtr>::reverse_iterator rfrom = instList.rbegin();
std::vector<Visio::IVShapePtr>::reverse_iterator rto = instList.rbegin();
++rto;
- const TCHAR* caption = (*rfrom < *rto ? rightMessage : leftMessage);
+ caption = (caption == leftMessage ? rightMessage : leftMessage);
for ( ; rto != instList.rend(); ++rfrom, ++rto, yPos-=verticalSpace)
{
TRACE("Drawing from " << (*rfrom)->Name << " to " << (*rto)->Name << " at y=" << yPos);
Modified: trunk/src/view/visio/addon/messagesequencedlg.cpp
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-04-25 16:50:42 UTC (rev 726)
+++ trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-04-25 23:28:03 UTC (rev 727)
@@ -42,14 +42,18 @@
LoadRegistryData();
if (m_mousePosY > 0 && m_mousePosY < m_pageHeight) {
m_start_pos_y = m_mousePosY;
+ m_old_start_pos_y = m_start_pos_y;
}
+
DoDataExchange(false);
- //m_left_msg_captions = "Blah!";
- //DDX_Text(IDC_MS_LEFT_MESSAGE, m_left_msg_captions.GetBuffer(100), 2, false);
- //DDX_Text(IDC_MS_RIGHT_MESSAGE, m_right_msg_captions.GetBuffer(100), 2, false);
UpdateControls();
+ m_startPosYEdit.SetLimitText(10);
+ m_verticalSpaceEdit.SetLimitText(10);
+ m_leftMessageEdit.SetLimitText(255);
+ m_rightMessageEdit.SetLimitText(255);
+
switch (m_direction) {
case MSDIR_LEFT:
m_dirLeftRdo.SetCheck(BST_CHECKED);
@@ -102,10 +106,6 @@
if(wID == IDOK)
{
dataExchanged = DoDataExchange(true);
- //DDX_Text(IDC_MS_LEFT_MESSAGE, m_left_msg_captions.GetBuffer(100), 2, true);
- //DDX_Text(IDC_MS_RIGHT_MESSAGE, m_right_msg_captions.GetBuffer(100), 2, true);
- //m_left_msg_captions.ReleaseBuffer();
- //m_right_msg_captions.ReleaseBuffer();
if (dataExchanged) {
SaveRegistryData();
}
@@ -136,6 +136,20 @@
return 0;
}
+LRESULT CMessageSequenceDlg::OnRemarkInstances(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ // TODO: add a button to refresh marked instances according to current startPosY, link with this function
+ /*
+ TCHAR newPosYText[11] = {0};
+ m_startPosYEdit.GetWindowText(newPosYText, 10);
+ double newPosY = _tcstod(newPosYText, 0);
+ if (m_old_start_pos_y == newPosY) return VAORC_SUCCESS;
+ m_old_start_pos_y = newPosY;
+ MessageBox(_T("TODO: remark instances according to Y-start"), _T("Debug"), MB_OK | MB_ICONEXCLAMATION);
+ */
+ return VAORC_SUCCESS;
+}
+
int CMessageSequenceDlg::LoadRegistryData()
{
TRACE("CMessageSequenceDlg::LoadRegistryData() loading options from registry");
@@ -143,10 +157,44 @@
Visio::IVPagePtr page = m_vsoApp->ActivePage;
#define _u(x) CPageUtils::ConvertUnits(page, x, 0, visPageUnits)
m_start_pos_y = _u(GetRegistry<double>(GetRegistryFolder(), NULL, _T("StartPosY"), DEFAULT_MS_START_POS_Y));
+ m_old_start_pos_y = m_start_pos_y;
m_vertical_space = _u(GetRegistry<double>(GetRegistryFolder(), NULL, _T("VerticalSpace"), DEFAULT_MS_VERTICAL_SPACE));
- // load the message captions as well
#undef _u
+ // FIXME: load message captions from the registry
+ wcsncpy(m_left_msg_captions, DEFAULT_MS_LEFT_MESSAGE_CAPTION, 255);
+ m_left_msg_captions[255] = '\0';
+ wcsncpy(m_right_msg_captions, DEFAULT_MS_RIGHT_MESSAGE_CAPTION, 255);
+ m_right_msg_captions[255] = '\0';
+ /*
+ TCHAR data[256];
+ DWORD dataLen = 256*sizeof(TCHAR);
+ const TCHAR* keyName = SCSTUDIO_REGISTRY_ROOT _T("\\MessageSequence") _T("LeftMessageCaption");
+ DWORD ret = RegQueryValueEx(HKEY_CURRENT_USER, keyName, NULL, NULL, (LPBYTE) data, &dataLen);
+ if (ret == ERROR_SUCCESS)
+ wcsncpy(m_left_msg_captions, data, 255);
+ else
+ wcsncpy(m_left_msg_captions, DEFAULT_MS_LEFT_MESSAGE_CAPTION, 255);
+ m_left_msg_captions[255] = '\0';
+
+ dataLen = 256*sizeof(TCHAR);
+ keyName = SCSTUDIO_REGISTRY_ROOT _T("\\MessageSequence") _T("RightMessageCaption");
+ ret = RegQueryValueEx(HKEY_CURRENT_USER, keyName, NULL, NULL, (LPBYTE) data, &dataLen);
+ if (ret == ERROR_SUCCESS)
+ wcsncpy(m_right_msg_captions, data, 255);
+ else
+ wcsncpy(m_right_msg_captions, DEFAULT_MS_RIGHT_MESSAGE_CAPTION, 255);
+ m_right_msg_captions[255] = '\0';
+ */
+ /*
+ CString left = GetRegistry<>(GetRegistryFolder(), NULL, _T("LeftMessageCaption"), DEFAULT_MS_LEFT_MESSAGE_CAPTION);
+ CString right = GetRegistry<>(GetRegistryFolder(), NULL, _T("RightMessageCaption"), DEFAULT_MS_RIGHT_MESSAGE_CAPTION);
+ wcsncpy(m_left_msg_captions, left, 255);
+ m_left_msg_captions[255] = '\0';
+ wcsncpy(m_right_msg_captions, right, 255);
+ m_right_msg_captions[255] = '\0';
+ */
+
return 0;
}
@@ -158,9 +206,16 @@
#define _u(x) CPageUtils::ConvertUnits(page, x, visPageUnits, 0)
SetRegistry<double>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("StartPosY"), _u(m_start_pos_y));
SetRegistry<double>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("VerticalSpace"), _u(m_vertical_space));
- // save the message captions as well
#undef _u
+ // FIXME: store message captions to the registry
+ /*
+ CString left = m_left_msg_captions;
+ CString right = m_right_msg_captions;
+ SetRegistry<CString>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("LeftMessageCaption"), left);
+ SetRegistry<CString>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("RightMessageCaption"), right);
+ */
+
return 0;
}
Modified: trunk/src/view/visio/addon/messagesequencedlg.h
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.h 2010-04-25 16:50:42 UTC (rev 726)
+++ trunk/src/view/visio/addon/messagesequencedlg.h 2010-04-25 23:28:03 UTC (rev 727)
@@ -44,8 +44,8 @@
double m_start_pos_y;
double m_vertical_space;
- CString m_left_msg_captions;
- CString m_right_msg_captions;
+ wchar_t m_left_msg_captions[256];
+ wchar_t m_right_msg_captions[256];
CMessageSequenceDlg(Visio::IVApplicationPtr vsoApp, double mousePosY=0.0, MsgSeqDirection initDir=MSDIR_RIGHT);
@@ -55,15 +55,15 @@
Visio::IVApplicationPtr m_vsoApp;
double m_mousePosY;
-
double m_pageHeight;
+ double m_old_start_pos_y;
protected:
BEGIN_DDX_MAP(CMessageSequenceDlg)
DDX_FLOAT_RANGE(IDC_MS_START_POS_Y, m_start_pos_y, 0, m_pageHeight)
DDX_FLOAT_RANGE(IDC_MS_VERTICAL_SPACE, m_vertical_space, 0, m_pageHeight)
- //DDX_TEXT(IDC_MS_LEFT_MESSAGE, m_left_msg_captions)
- //DDX_TEXT(IDC_MS_RIGHT_MESSAGE, m_right_msg_captions)
+ DDX_TEXT(IDC_MS_LEFT_MESSAGE, m_left_msg_captions)
+ DDX_TEXT(IDC_MS_RIGHT_MESSAGE, m_right_msg_captions)
DDX_CONTROL_HANDLE(IDC_MS_DIR_LEFT, m_dirLeftRdo)
DDX_CONTROL_HANDLE(IDC_MS_DIR_RIGHT, m_dirRightRdo)
@@ -71,6 +71,8 @@
DDX_CONTROL_HANDLE(IDC_MS_DIR_RIGHT_LEFT, m_dirRightLeftRdo)
DDX_CONTROL_HANDLE(IDC_MS_LEFT_MESSAGE, m_leftMessageEdit)
DDX_CONTROL_HANDLE(IDC_MS_RIGHT_MESSAGE, m_rightMessageEdit)
+ DDX_CONTROL_HANDLE(IDC_MS_START_POS_Y, m_startPosYEdit)
+ DDX_CONTROL_HANDLE(IDC_MS_VERTICAL_SPACE, m_verticalSpaceEdit)
END_DDX_MAP()
BEGIN_MSG_MAP(CMessageSequenceDlg)
@@ -81,6 +83,8 @@
COMMAND_ID_HANDLER(IDC_MS_DIR_RIGHT, OnDirectionRdo)
COMMAND_ID_HANDLER(IDC_MS_DIR_LEFT_RIGHT, OnDirectionRdo)
COMMAND_ID_HANDLER(IDC_MS_DIR_RIGHT_LEFT, OnDirectionRdo)
+ COMMAND_ID_HANDLER(IDC_MS_START_POS_Y, OnRemarkInstances)
+
END_MSG_MAP()
// Handler prototypes:
@@ -93,6 +97,7 @@
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnDirectionRdo(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+ LRESULT OnRemarkInstances(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
int LoadRegistryData();
int SaveRegistryData();
@@ -107,9 +112,12 @@
CEdit m_leftMessageEdit;
CEdit m_rightMessageEdit;
CEdit m_startPosYEdit;
+ CEdit m_verticalSpaceEdit;
};
static const double DEFAULT_MS_START_POS_Y = 0.0;
static const double DEFAULT_MS_VERTICAL_SPACE = 0.1968503937007874; // 5 mm
+static const wchar_t* DEFAULT_MS_LEFT_MESSAGE_CAPTION = _T("");
+static const wchar_t* DEFAULT_MS_RIGHT_MESSAGE_CAPTION = _T("");
// $Id$
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-04-25 16:50:42 UTC (rev 726)
+++ trunk/src/view/visio/addon/resource.h 2010-04-25 23:28:03 UTC (rev 727)
@@ -49,29 +49,16 @@
#define IDC_IF_LBL5 240
#define IDC_IF_START_POS_Y 241
#define IDC_TOTAL_WIDTH_RDO 242
-#define IDC_RADIO2 243
#define IDC_SPACING_RDO 243
#define IDC_MS_DIR_RIGHT 243
#define IDC_IF_TOTAL_WIDTH 244
#define IDC_DEFAULT_BTN 245
-#define IDC_UNITS_LBL1 246
-#define IDC_UNITS_LBL2 247
-#define IDC_UNITS_LBL3 248
-#define IDC_UNITS_LBL4 249
-#define IDC_UNITS_LBL5 250
-#define IDC_RADIO1 251
#define IDC_MS_DIR_LEFT 251
-#define IDC_RADIO3 252
#define IDC_MS_DIR_LEFT_RIGHT 252
-#define IDC_RADIO4 253
-#define IDC_EDIT1 254
-#define IDC_MC_LEFT_MESSAGE 254
#define IDC_MS_LEFT_MESSAGE 254
#define IDC_MS_RIGHT_MESSAGE 255
-#define IDC_EDIT2 256
#define IDC_MS_YSTART 256
#define IDC_MS_START_POS_Y 256
-#define IDC_EDIT3 257
#define IDC_MS_VERTICAL_SPACE 257
#define IDC_MS_DIR_RIGHT_LEFT 258
Modified: trunk/src/view/visio/addon/shapeutils.cpp
===================================================================
--- trunk/src/view/visio/addon/shapeutils.cpp 2010-04-25 16:50:42 UTC (rev 726)
+++ trunk/src/view/visio/addon/shapeutils.cpp 2010-04-25 23:28:03 UTC (rev 727)
@@ -49,6 +49,22 @@
cell->GlueToPos(where, pos.get_y()/max(1.0,width), pos.get_x()/max(1.0,height));
}
+void CShapeUtils::MarkShape(Visio::IVShapePtr shape)
+{
+ // line color = red
+ shape->CellsSRC[visSectionObject][visRowLine][visLineColor]->ResultIU = 2;
+ // text color = red
+ shape->CellsSRC[visSectionCharacter][visRowCharacter][visCharacterColor]->ResultIU = 2;
+}
+
+void CShapeUtils::UnmarkShape(Visio::IVShapePtr shape)
+{
+ // line color = red
+ shape->CellsSRC[visSectionObject][visRowLine][visLineColor]->ResultIU = 0;
+ // text color = red
+ shape->CellsSRC[visSectionCharacter][visRowCharacter][visCharacterColor]->ResultIU = 0;
+}
+
bool CShapeComparator::operator()(const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
{
if (direction == ORDER_ASC)
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2010-04-25 16:50:42 UTC (rev 726)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-04-25 23:28:03 UTC (rev 727)
@@ -40,6 +40,9 @@
static void GlueBeginToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos);
static void GlueBeginToShape(Visio::IVShapePtr what, Visio::IVShapePtr where);
static void GlueEndToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos);
+
+ static void MarkShape(Visio::IVShapePtr shape);
+ static void UnmarkShape(Visio::IVShapePtr shape);
};
/**
Modified: trunk/src/view/visio/addon/visualize.cpp
===================================================================
--- trunk/src/view/visio/addon/visualize.cpp 2010-04-25 16:50:42 UTC (rev 726)
+++ trunk/src/view/visio/addon/visualize.cpp 2010-04-25 23:28:03 UTC (rev 727)
@@ -262,6 +262,7 @@
}
}
+// FIXME: duplicate of CShapeUtils::MarkShape - remove from here
void MarkShape(Visio::IVShapePtr what)
{
// line color = red
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-05-11 00:38:19
|
Revision: 755
http://scstudio.svn.sourceforge.net/scstudio/?rev=755&view=rev
Author: obouda
Date: 2010-05-11 00:38:13 +0000 (Tue, 11 May 2010)
Log Message:
-----------
Message Sequence: Removed an unsuccessful attempt to highlight all the instances being subject of the message sequence during filling the dialog. Only border instances highlighting seems to be reasonable.
Modified Paths:
--------------
trunk/src/view/visio/addon/messagesequencedlg.cpp
trunk/src/view/visio/addon/messagesequencedlg.h
Modified: trunk/src/view/visio/addon/messagesequencedlg.cpp
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-10 23:14:18 UTC (rev 754)
+++ trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-11 00:38:13 UTC (rev 755)
@@ -136,20 +136,6 @@
return 0;
}
-LRESULT CMessageSequenceDlg::OnRemarkInstances(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
-{
- // TODO: add a button to refresh marked instances according to current startPosY, link with this function
- /*
- TCHAR newPosYText[11] = {0};
- m_startPosYEdit.GetWindowText(newPosYText, 10);
- double newPosY = _tcstod(newPosYText, 0);
- if (m_old_start_pos_y == newPosY) return VAORC_SUCCESS;
- m_old_start_pos_y = newPosY;
- MessageBox(_T("TODO: remark instances according to Y-start"), _T("Debug"), MB_OK | MB_ICONEXCLAMATION);
- */
- return VAORC_SUCCESS;
-}
-
int CMessageSequenceDlg::LoadRegistryData()
{
TRACE("CMessageSequenceDlg::LoadRegistryData() loading options from registry");
Modified: trunk/src/view/visio/addon/messagesequencedlg.h
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.h 2010-05-10 23:14:18 UTC (rev 754)
+++ trunk/src/view/visio/addon/messagesequencedlg.h 2010-05-11 00:38:13 UTC (rev 755)
@@ -83,7 +83,6 @@
COMMAND_ID_HANDLER(IDC_MS_DIR_RIGHT, OnDirectionRdo)
COMMAND_ID_HANDLER(IDC_MS_DIR_LEFT_RIGHT, OnDirectionRdo)
COMMAND_ID_HANDLER(IDC_MS_DIR_RIGHT_LEFT, OnDirectionRdo)
- COMMAND_ID_HANDLER(IDC_MS_START_POS_Y, OnRemarkInstances)
END_MSG_MAP()
@@ -97,7 +96,6 @@
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnDirectionRdo(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
- LRESULT OnRemarkInstances(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
int LoadRegistryData();
int SaveRegistryData();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-05-11 10:29:19
|
Revision: 759
http://scstudio.svn.sourceforge.net/scstudio/?rev=759&view=rev
Author: obouda
Date: 2010-05-11 10:29:13 +0000 (Tue, 11 May 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/messagesequencedlg.cpp
trunk/src/view/visio/addon/messagesequencedlg.h
trunk/src/view/visio/addon/resource.h
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-05-11 07:41:12 UTC (rev 758)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-05-11 10:29:13 UTC (rev 759)
@@ -26,7 +26,7 @@
// Dialog
//
-IDD_MESSAGE_SEQUENCE_OPTIONS DIALOGEX 0, 0, 506, 114
+IDD_MESSAGE_SEQUENCE_OPTIONS DIALOGEX 0, 0, 506, 146
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Message Sequence Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -44,8 +44,10 @@
EDITTEXT IDC_MS_LEFT_MESSAGE,171,41,259,14,ES_AUTOHSCROLL
LTEXT "Starting Y-position:",IDC_STATIC,7,78,62,8
LTEXT "Vertical space between messages:",IDC_STATIC,7,94,111,8
- EDITTEXT IDC_MS_START_POS_Y,121,76,40,14,ES_AUTOHSCROLL
- EDITTEXT IDC_MS_VERTICAL_SPACE,121,93,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_MS_START_POS_Y,164,76,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_MS_VERTICAL_SPACE,164,92,40,14,ES_AUTOHSCROLL
+ LTEXT "Vertical space between left and right sequence:",IDC_STATIC,7,110,154,8
+ EDITTEXT IDC_MS_VERTICAL_SPACE_LEFT_RIGHT,164,108,40,14,ES_AUTOHSCROLL
END
@@ -64,7 +66,7 @@
VERTGUIDE, 13
VERTGUIDE, 430
TOPMARGIN, 7
- BOTTOMMARGIN, 107
+ BOTTOMMARGIN, 139
END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-05-11 07:41:12 UTC (rev 758)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-11 10:29:13 UTC (rev 759)
@@ -1134,6 +1134,7 @@
MsgSeqDirection direction = dlg.m_direction;
double startPosY = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_start_pos_y);
double verticalSpace = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_vertical_space);
+ double verticalSpaceLeftRight = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_vertical_space_left_right);
CString leftMessage = dlg.m_left_msg_captions;
CString rightMessage = dlg.m_right_msg_captions;
@@ -1180,6 +1181,9 @@
if (direction == MSDIR_LEFT_RIGHT || direction == MSDIR_RIGHT_LEFT)
{
+ // change yPos by verticalSpaceLeftRight instead of last verticalSpace
+ yPos += verticalSpace - verticalSpaceLeftRight;
+
std::vector<Visio::IVShapePtr>::reverse_iterator rfrom = instList.rbegin();
std::vector<Visio::IVShapePtr>::reverse_iterator rto = instList.rbegin();
++rto;
Modified: trunk/src/view/visio/addon/messagesequencedlg.cpp
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-11 07:41:12 UTC (rev 758)
+++ trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-11 10:29:13 UTC (rev 759)
@@ -51,6 +51,7 @@
m_startPosYEdit.SetLimitText(10);
m_verticalSpaceEdit.SetLimitText(10);
+ m_verticalSpaceLeftRightEdit.SetLimitText(10);
m_leftMessageEdit.SetLimitText(255);
m_rightMessageEdit.SetLimitText(255);
@@ -86,6 +87,7 @@
sMsg = "Starting Y-position must be on the drawing.";
break;
case IDC_MS_VERTICAL_SPACE:
+ case IDC_MS_VERTICAL_SPACE_LEFT_RIGHT:
sMsg = "Wrong vertical space, messages must fit to the drawing.";
break;
case IDC_MS_LEFT_MESSAGE:
@@ -146,6 +148,7 @@
m_start_pos_y = _u(GetRegistry<double>(GetRegistryFolder(), NULL, _T("StartPosY"), DEFAULT_MS_START_POS_Y));
m_old_start_pos_y = m_start_pos_y;
m_vertical_space = _u(GetRegistry<double>(GetRegistryFolder(), NULL, _T("VerticalSpace"), DEFAULT_MS_VERTICAL_SPACE));
+ m_vertical_space_left_right = _u(GetRegistry<double>(GetRegistryFolder(), NULL, _T("VerticalSpaceLeftRight"), DEFAULT_MS_VERTICAL_SPACE_LEFT_RIGHT));
#undef _u
// FIXME: load message captions from the registry
@@ -193,6 +196,7 @@
#define _u(x) CPageUtils::ConvertUnits(page, x, visPageUnits, 0)
SetRegistry<double>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("StartPosY"), _u(m_start_pos_y));
SetRegistry<double>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("VerticalSpace"), _u(m_vertical_space));
+ SetRegistry<double>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("VerticalSpaceLeftRight"), _u(m_vertical_space_left_right));
#undef _u
// FIXME: store message captions to the registry
Modified: trunk/src/view/visio/addon/messagesequencedlg.h
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.h 2010-05-11 07:41:12 UTC (rev 758)
+++ trunk/src/view/visio/addon/messagesequencedlg.h 2010-05-11 10:29:13 UTC (rev 759)
@@ -44,6 +44,7 @@
double m_start_pos_y;
double m_vertical_space;
+ double m_vertical_space_left_right;
wchar_t m_left_msg_captions[256];
wchar_t m_right_msg_captions[256];
@@ -62,6 +63,7 @@
BEGIN_DDX_MAP(CMessageSequenceDlg)
DDX_FLOAT_RANGE(IDC_MS_START_POS_Y, m_start_pos_y, 0, m_pageHeight)
DDX_FLOAT_RANGE(IDC_MS_VERTICAL_SPACE, m_vertical_space, 0, m_pageHeight)
+ DDX_FLOAT_RANGE(IDC_MS_VERTICAL_SPACE_LEFT_RIGHT, m_vertical_space_left_right, 0, m_pageHeight)
DDX_TEXT(IDC_MS_LEFT_MESSAGE, m_left_msg_captions)
DDX_TEXT(IDC_MS_RIGHT_MESSAGE, m_right_msg_captions)
@@ -73,6 +75,7 @@
DDX_CONTROL_HANDLE(IDC_MS_RIGHT_MESSAGE, m_rightMessageEdit)
DDX_CONTROL_HANDLE(IDC_MS_START_POS_Y, m_startPosYEdit)
DDX_CONTROL_HANDLE(IDC_MS_VERTICAL_SPACE, m_verticalSpaceEdit)
+ DDX_CONTROL_HANDLE(IDC_MS_VERTICAL_SPACE_LEFT_RIGHT, m_verticalSpaceLeftRightEdit)
END_DDX_MAP()
BEGIN_MSG_MAP(CMessageSequenceDlg)
@@ -111,10 +114,12 @@
CEdit m_rightMessageEdit;
CEdit m_startPosYEdit;
CEdit m_verticalSpaceEdit;
+ CEdit m_verticalSpaceLeftRightEdit;
};
static const double DEFAULT_MS_START_POS_Y = 0.0;
static const double DEFAULT_MS_VERTICAL_SPACE = 0.1968503937007874; // 5 mm
+static const double DEFAULT_MS_VERTICAL_SPACE_LEFT_RIGHT = 0.1968503937007874; // 5 mm
static const wchar_t* DEFAULT_MS_LEFT_MESSAGE_CAPTION = _T("");
static const wchar_t* DEFAULT_MS_RIGHT_MESSAGE_CAPTION = _T("");
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-05-11 07:41:12 UTC (rev 758)
+++ trunk/src/view/visio/addon/resource.h 2010-05-11 10:29:13 UTC (rev 759)
@@ -61,6 +61,8 @@
#define IDC_MS_START_POS_Y 256
#define IDC_MS_VERTICAL_SPACE 257
#define IDC_MS_DIR_RIGHT_LEFT 258
+#define IDC_MS_VERTICAL_SPACE2 259
+#define IDC_MS_VERTICAL_SPACE_LEFT_RIGHT 259
// Next default values for new objects
//
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-05-11 21:31:39
|
Revision: 762
http://scstudio.svn.sourceforge.net/scstudio/?rev=762&view=rev
Author: obouda
Date: 2010-05-11 21:31:30 +0000 (Tue, 11 May 2010)
Log Message:
-----------
Now printing page units in automatic drawing dialogs (like Add Instances or Message Sequence).
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/instancesfielddlg.cpp
trunk/src/view/visio/addon/instancesfielddlg.h
trunk/src/view/visio/addon/messagesequencedlg.cpp
trunk/src/view/visio/addon/messagesequencedlg.h
trunk/src/view/visio/addon/pageutils.cpp
trunk/src/view/visio/addon/pageutils.h
trunk/src/view/visio/addon/resource.h
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-05-11 17:34:45 UTC (rev 761)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-05-11 21:31:30 UTC (rev 762)
@@ -48,6 +48,9 @@
EDITTEXT IDC_MS_VERTICAL_SPACE,164,92,40,14,ES_AUTOHSCROLL
LTEXT "Vertical space between left and right sequence:",IDC_STATIC,7,110,154,8
EDITTEXT IDC_MS_VERTICAL_SPACE_LEFT_RIGHT,164,108,40,14,ES_AUTOHSCROLL
+ LTEXT "<units>",IDC_MS_UNITS0,207,78,27,8
+ LTEXT "<units>",IDC_MS_UNITS1,207,94,27,8
+ LTEXT "<units>",IDC_MS_UNITS2,207,110,27,8
END
@@ -143,16 +146,16 @@
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, 201, 127
+IDD_INSTANCES_FIELD_OPTIONS DIALOGEX 0, 0, 210, 127
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add Instances Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,146,5,50,14
- PUSHBUTTON "Cancel",IDCANCEL,146,25,50,14
+ DEFPUSHBUTTON "OK",IDOK,155,5,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,155,25,50,14
LTEXT "Number of instances:",IDC_STATIC,5,5,70,12,SS_CENTERIMAGE
EDITTEXT IDC_IF_INSTANCES_CNT,80,5,43,14,ES_AUTOHSCROLL
- GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,73,191,50
+ GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,73,200,50
LTEXT " Options ",IDC_OPTIONS_SWITCH_LBL,19,73,30,8
LTEXT "Instance length:",IDC_STATIC,5,23,70,12,SS_CENTERIMAGE
EDITTEXT IDC_IF_INSTANCE_LENGTH,80,23,43,14,ES_AUTOHSCROLL
@@ -164,9 +167,14 @@
CONTROL "Spacing:",IDC_SPACING_RDO,"Button",BS_AUTORADIOBUTTON,10,104,43,10
EDITTEXT IDC_IF_TOTAL_WIDTH,63,88,40,14,ES_AUTOHSCROLL
EDITTEXT IDC_IF_SPACING,63,103,40,14,ES_AUTOHSCROLL
- PUSHBUTTON "Default values",IDC_DEFAULT_BTN,131,88,58,14
+ PUSHBUTTON "Default values",IDC_DEFAULT_BTN,140,88,58,14
LTEXT "x:",IDC_STATIC,64,40,9,12,SS_CENTERIMAGE
LTEXT "y:",IDC_STATIC,64,54,9,12,SS_CENTERIMAGE
+ LTEXT "<units>",IDC_IF_UNITS0,127,24,27,8
+ LTEXT "<units>",IDC_IF_UNITS1,127,41,27,8
+ LTEXT "<units>",IDC_IF_UNITS2,127,55,27,8
+ LTEXT "<units>",IDC_IF_UNITS3,107,90,27,8
+ LTEXT "<units>",IDC_IF_UNITS4,107,104,27,8
END
@@ -205,7 +213,7 @@
IDD_INSTANCES_FIELD_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 5
- RIGHTMARGIN, 196
+ RIGHTMARGIN, 205
VERTGUIDE, 10
VERTGUIDE, 19
VERTGUIDE, 48
Modified: trunk/src/view/visio/addon/instancesfielddlg.cpp
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-05-11 17:34:45 UTC (rev 761)
+++ trunk/src/view/visio/addon/instancesfielddlg.cpp 2010-05-11 21:31:30 UTC (rev 762)
@@ -34,6 +34,8 @@
m_pageWidth = CPageUtils::GetPageWidth(page);
m_pageHeight = CPageUtils::GetPageHeight(page);
+
+ m_pageUnits = CPageUtils::GetPageUnits(page);
}
void CInstancesFieldDlg::OnDataValidateError(UINT nCtrlID, BOOL bSave, _XData& data)
@@ -66,6 +68,13 @@
SetOptionsVisibility(m_optionsVisible);
UpdateSpacingControls();
+ // units
+ LPCTSTR unitsStr = CPageUtils::VisioUnitToString(m_pageUnits);
+ for (int i=0; i < ARRAYSIZE(m_unitLabels); i++)
+ {
+ m_unitLabels[i].SetWindowText(unitsStr);
+ }
+
m_instancesCntEdit.SetSel(0, -1);
return bHandled = false;
@@ -155,7 +164,7 @@
groupRect.top = 120;
groupRect.bottom = groupRect.top + (visible ? 76 : 8);
groupRect.left = 8;
- groupRect.right = 292;
+ groupRect.right = 308;
m_optionsGroupBox.SetWindowPos(0, &groupRect, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_DRAWFRAME);
m_totalWidthRdo.ShowWindow(visible);
Modified: trunk/src/view/visio/addon/instancesfielddlg.h
===================================================================
--- trunk/src/view/visio/addon/instancesfielddlg.h 2010-05-11 17:34:45 UTC (rev 761)
+++ trunk/src/view/visio/addon/instancesfielddlg.h 2010-05-11 21:31:30 UTC (rev 762)
@@ -46,7 +46,7 @@
private:
Visio::IVApplicationPtr m_vsoApp;
- VisUnitCodes m_pageUnits;
+ short m_pageUnits;
double m_mousePosX;
double m_mousePosY;
@@ -71,6 +71,11 @@
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_IF_UNITS0, m_unitLabels[0])
+ DDX_CONTROL_HANDLE(IDC_IF_UNITS1, m_unitLabels[1])
+ DDX_CONTROL_HANDLE(IDC_IF_UNITS2, m_unitLabels[2])
+ DDX_CONTROL_HANDLE(IDC_IF_UNITS3, m_unitLabels[3])
+ DDX_CONTROL_HANDLE(IDC_IF_UNITS4, m_unitLabels[4])
END_DDX_MAP()
BEGIN_MSG_MAP(CInstancesFieldDlg)
@@ -115,6 +120,8 @@
CEdit m_instancesCntEdit;
CEdit m_totalWidthEdit;
CEdit m_spacingEdit;
+
+ CStatic m_unitLabels[5];
};
static const int DEFAULT_IF_INSTANCES_CNT = 2;
Modified: trunk/src/view/visio/addon/messagesequencedlg.cpp
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-11 17:34:45 UTC (rev 761)
+++ trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-11 21:31:30 UTC (rev 762)
@@ -33,6 +33,8 @@
m_pageHeight = CPageUtils::GetPageHeight(page);
m_direction = initDir;
+
+ m_pageUnits = CPageUtils::GetPageUnits(page);
}
LRESULT CMessageSequenceDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -49,12 +51,21 @@
UpdateControls();
+ // units
+ LPCTSTR unitsStr = CPageUtils::VisioUnitToString(m_pageUnits);
+ for (int i=0; i < ARRAYSIZE(m_unitLabels); i++)
+ {
+ m_unitLabels[i].SetWindowText(unitsStr);
+ }
+
+ // input limits
m_startPosYEdit.SetLimitText(10);
m_verticalSpaceEdit.SetLimitText(10);
m_verticalSpaceLeftRightEdit.SetLimitText(10);
m_leftMessageEdit.SetLimitText(255);
m_rightMessageEdit.SetLimitText(255);
+ // radio buttons
switch (m_direction) {
case MSDIR_LEFT:
m_dirLeftRdo.SetCheck(BST_CHECKED);
Modified: trunk/src/view/visio/addon/messagesequencedlg.h
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.h 2010-05-11 17:34:45 UTC (rev 761)
+++ trunk/src/view/visio/addon/messagesequencedlg.h 2010-05-11 21:31:30 UTC (rev 762)
@@ -58,6 +58,7 @@
double m_mousePosY;
double m_pageHeight;
double m_old_start_pos_y;
+ short m_pageUnits;
protected:
BEGIN_DDX_MAP(CMessageSequenceDlg)
@@ -76,6 +77,9 @@
DDX_CONTROL_HANDLE(IDC_MS_START_POS_Y, m_startPosYEdit)
DDX_CONTROL_HANDLE(IDC_MS_VERTICAL_SPACE, m_verticalSpaceEdit)
DDX_CONTROL_HANDLE(IDC_MS_VERTICAL_SPACE_LEFT_RIGHT, m_verticalSpaceLeftRightEdit)
+ DDX_CONTROL_HANDLE(IDC_MS_UNITS0, m_unitLabels[0])
+ DDX_CONTROL_HANDLE(IDC_MS_UNITS1, m_unitLabels[1])
+ DDX_CONTROL_HANDLE(IDC_MS_UNITS2, m_unitLabels[2])
END_DDX_MAP()
BEGIN_MSG_MAP(CMessageSequenceDlg)
@@ -115,6 +119,8 @@
CEdit m_startPosYEdit;
CEdit m_verticalSpaceEdit;
CEdit m_verticalSpaceLeftRightEdit;
+
+ CStatic m_unitLabels[3];
};
static const double DEFAULT_MS_START_POS_Y = 0.0;
Modified: trunk/src/view/visio/addon/pageutils.cpp
===================================================================
--- trunk/src/view/visio/addon/pageutils.cpp 2010-05-11 17:34:45 UTC (rev 761)
+++ trunk/src/view/visio/addon/pageutils.cpp 2010-05-11 21:31:30 UTC (rev 762)
@@ -18,6 +18,11 @@
#include "pageutils.h"
+short CPageUtils::GetPageUnits(Visio::IVPagePtr vsoPage)
+{
+ return vsoPage->PageSheet->CellsSRC[visSectionObject][visRowPage][visPageScale]->Units;
+}
+
double CPageUtils::ConvertUnits(Visio::IVPagePtr vsoPage, double value, int unitsFrom, int unitsTo)
{
// convert the value via a scratch cell
@@ -57,7 +62,7 @@
return (units == 0 ? cell->Result[""] : cell->Result[units]);
}
-const LPCTSTR CPageUtils::VisioUnitToString(VisUnitCodes unitCode)
+const LPCTSTR CPageUtils::VisioUnitToString(short unitCode)
{
switch (unitCode) {
case visCentimeters:
Modified: trunk/src/view/visio/addon/pageutils.h
===================================================================
--- trunk/src/view/visio/addon/pageutils.h 2010-05-11 17:34:45 UTC (rev 761)
+++ trunk/src/view/visio/addon/pageutils.h 2010-05-11 21:31:30 UTC (rev 762)
@@ -28,6 +28,12 @@
public:
/**
+ * Returns measurement units of a Visio page.
+ * @return VisUnitCodes unit code of units of the given page
+ */
+ static short GetPageUnits(Visio::IVPagePtr vsoPage);
+
+ /**
* Converts a value between specified units.
* @param vsoPage the document page in which to convert the units
* @param value the value to be converted
@@ -67,7 +73,7 @@
*/
static double GetPageHeight(Visio::IVPagePtr vsoPage, int units=visPageUnits);
- static const LPCTSTR VisioUnitToString(VisUnitCodes unitCode);
+ static const LPCTSTR VisioUnitToString(short unitCode);
/**
* Filters out all shapes from a given selection which are not of a given type.
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-05-11 17:34:45 UTC (rev 761)
+++ trunk/src/view/visio/addon/resource.h 2010-05-11 21:31:30 UTC (rev 762)
@@ -63,6 +63,14 @@
#define IDC_MS_DIR_RIGHT_LEFT 258
#define IDC_MS_VERTICAL_SPACE2 259
#define IDC_MS_VERTICAL_SPACE_LEFT_RIGHT 259
+#define IDC_MS_UNITS0 260
+#define IDC_MS_UNITS1 261
+#define IDC_IF_UNITS0 261
+#define IDC_MS_UNITS2 262
+#define IDC_IF_UNITS1 262
+#define IDC_IF_UNITS2 267
+#define IDC_IF_UNITS3 268
+#define IDC_IF_UNITS4 269
// Next default values for new objects
//
@@ -70,7 +78,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 221
#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 259
+#define _APS_NEXT_CONTROL_VALUE 262
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-05-12 15:16:29
|
Revision: 763
http://scstudio.svn.sourceforge.net/scstudio/?rev=763&view=rev
Author: obouda
Date: 2010-05-12 15:16:23 +0000 (Wed, 12 May 2010)
Log Message:
-----------
Message Sequence: If there are more than 2 instances selected, message sequence takes place exactly among these selected instances.
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-05-11 21:31:30 UTC (rev 762)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-12 15:16:23 UTC (rev 763)
@@ -1045,25 +1045,51 @@
qualified.push_back(boundaryOne);
qualified.push_back(boundaryTwo);
- Visio::IVPagePtr page = boundaryOne->ContainingPage;
- // push back all qualifying shapes based on X-coord and Y-coord
- for (int i=1; i <= page->Shapes->Count; i++)
+ const Visio::IVSelectionPtr selection = CPageUtils::FilterSelection(boundaryOne->Application->ActiveWindow->Selection, ST_BMSC_INSTANCE);
+ if (selection->Count > 2)
{
- Visio::IVShapePtr shape = page->Shapes->Item[i];
+ // special care when there are more than 2 instances selected
+ // exactly the selected instances should be the subject of message sequence
+ // if any of them does not meet the criteria (vertical, intersects yCoord), report an error
+ for (int i=1; i<=selection->Count; i++) {
+ Visio::IVShapePtr shape = selection->Item[i];
- if (get_shape_type(shape) != ST_BMSC_INSTANCE) continue;
+ double bX = CShapeUtils::GetShapeBeginX(shape);
+ double eX = CShapeUtils::GetShapeEndX(shape);
+ double bY = CShapeUtils::GetShapeBeginY(shape);
+ double eY = CShapeUtils::GetShapeEndY(shape);
- double bX = CShapeUtils::GetShapeBeginX(shape);
- double eX = CShapeUtils::GetShapeEndX(shape);
- double bY = CShapeUtils::GetShapeBeginY(shape);
- double eY = CShapeUtils::GetShapeEndY(shape);
+ // must be vertical and at right yCoord
+ if (fabs(bX - eX) > EPSILON || bY < yCoord || eY > yCoord)
+ {
+ return std::vector<Visio::IVShapePtr>(); // error - a member of selection should have qualified
+ }
+ qualified.push_back(shape);
+ }
+ }
+ else
+ {
+ // there are no more than 2 instances selected - scan the whole page
+ Visio::IVPagePtr page = boundaryOne->ContainingPage;
+ // push back all qualifying shapes based on X-coord and Y-coord
+ for (int i=1; i <= page->Shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = page->Shapes->Item[i];
- if (fabs(bX - eX) > EPSILON) continue; // not vertical
- if (bY < yCoord || eY > yCoord) continue; // wrong yCoord
+ if (get_shape_type(shape) != ST_BMSC_INSTANCE) continue;
- if ((fromX < bX && bX < toX) || (fromX > bX && bX > toX))
- {
- qualified.push_back(shape);
+ double bX = CShapeUtils::GetShapeBeginX(shape);
+ double eX = CShapeUtils::GetShapeEndX(shape);
+ double bY = CShapeUtils::GetShapeBeginY(shape);
+ double eY = CShapeUtils::GetShapeEndY(shape);
+
+ if (fabs(bX - eX) > EPSILON) continue; // not vertical
+ if (bY < yCoord || eY > yCoord) continue; // wrong yCoord
+
+ if ((fromX < bX && bX < toX) || (fromX > bX && bX > toX))
+ {
+ qualified.push_back(shape);
+ }
}
}
@@ -1144,7 +1170,6 @@
{
swap(orderedBoundaries);
}
-
// order the pair so that we get the right direction by iterating the resulting list
if (direction == MSDIR_LEFT || direction == MSDIR_LEFT_RIGHT)
{
@@ -1155,7 +1180,7 @@
if (instList.size() == 0)
{
MessageBox(GetActiveWindow(),
- _T("No instances matching the criteria.\nMaybe the Y-start (mouse position) is wrong?"),
+ _T("No instances matching the criteria.\nSome of the selected instances are out of Y-start (mouse position)."),
_T("Error"), MB_OK | MB_ICONEXCLAMATION);
return VAORC_FAILURE;
}
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-05-11 21:31:30 UTC (rev 762)
+++ trunk/src/view/visio/addon/document.h 2010-05-12 15:16:23 UTC (rev 763)
@@ -257,8 +257,11 @@
* Gets all instances between some two instances at a given height.
*
* Taken are all instances with x-coords between x-coords of the two instances given and
- * y-coords beginning above yCoord and ending below yCoords (imagine a line at height yCoord -
- * then the instances taken into account are only these intersecting this line).
+ * y-coords beginning above yCoord and ending below yCoords (imagine a horizontal line at
+ * height yCoord - then the instances taken into account are only these intersecting this line).
+ *
+ * Furthermore, if there is a selection of at least 3 instances on the page, only those instances
+ * present in this selection are chosen.
*
* The function respects the order of boundaries: if boundaryOne is the left of the two,
* all instances returned are ordered by the x-coords in the ascending direction; otherwise,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-05-13 00:13:53
|
Revision: 772
http://scstudio.svn.sourceforge.net/scstudio/?rev=772&view=rev
Author: obouda
Date: 2010-05-13 00:13:42 +0000 (Thu, 13 May 2010)
Log Message:
-----------
Message Sequence: Coregion treatment options added - GUI changes are complete, implementation is almost done
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/messagesequencedlg.cpp
trunk/src/view/visio/addon/messagesequencedlg.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/scstudio.vcproj
trunk/src/view/visio/addon/shapeutils.cpp
trunk/src/view/visio/addon/shapeutils.h
Added Paths:
-----------
trunk/src/view/visio/addon/enums.h
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-05-13 00:13:42 UTC (rev 772)
@@ -26,22 +26,22 @@
// Dialog
//
-IDD_MESSAGE_SEQUENCE_OPTIONS DIALOGEX 0, 0, 506, 146
+IDD_MESSAGE_SEQUENCE_OPTIONS DIALOGEX 0, 0, 495, 197
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Message Sequence Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,449,7,50,14
- PUSHBUTTON "Cancel",IDCANCEL,449,25,50,14
- GROUPBOX "Direction:",IDC_STATIC,7,7,432,64
- CONTROL "Right only",IDC_MS_DIR_RIGHT,"Button",BS_AUTORADIOBUTTON,13,19,48,10
+ DEFPUSHBUTTON "OK",IDOK,438,7,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,438,25,50,14
+ GROUPBOX "Direction:",IDC_STATIC,7,7,423,64
+ CONTROL "Right only",IDC_MS_DIR_RIGHT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,13,19,48,10
CONTROL "Left only",IDC_MS_DIR_LEFT,"Button",BS_AUTORADIOBUTTON,13,31,44,10
CONTROL "Right, Left",IDC_MS_DIR_RIGHT_LEFT,"Button",BS_AUTORADIOBUTTON,13,43,50,10
CONTROL "Left, Right",IDC_MS_DIR_LEFT_RIGHT,"Button",BS_AUTORADIOBUTTON,13,55,50,10
- LTEXT "Right Message Captions:",IDC_STATIC,90,19,80,8
- EDITTEXT IDC_MS_RIGHT_MESSAGE,171,17,259,14,ES_AUTOHSCROLL
- LTEXT "Left Message Captions:",IDC_STATIC,90,43,76,8
- EDITTEXT IDC_MS_LEFT_MESSAGE,171,41,259,14,ES_AUTOHSCROLL
+ LTEXT "Right Message Captions:",IDC_STATIC,83,19,80,8
+ EDITTEXT IDC_MS_RIGHT_MESSAGE,164,17,259,14,ES_AUTOHSCROLL
+ LTEXT "Left Message Captions:",IDC_STATIC,83,43,76,8
+ EDITTEXT IDC_MS_LEFT_MESSAGE,164,41,259,14,ES_AUTOHSCROLL
LTEXT "Starting Y-position:",IDC_STATIC,7,78,62,8
LTEXT "Vertical space between messages:",IDC_STATIC,7,94,111,8
EDITTEXT IDC_MS_START_POS_Y,164,76,40,14,ES_AUTOHSCROLL
@@ -51,6 +51,16 @@
LTEXT "<units>",IDC_MS_UNITS0,207,78,27,8
LTEXT "<units>",IDC_MS_UNITS1,207,94,27,8
LTEXT "<units>",IDC_MS_UNITS2,207,110,27,8
+ GROUPBOX "Upon crossing a coregion:",IDC_STATIC,7,128,423,62
+ CONTROL "Cancel the message sequence and report an error",IDC_MS_COREGION_ERROR,
+ "Button",BS_AUTORADIOBUTTON | WS_GROUP,13,140,177,10
+ CONTROL "Connect to the coregion",IDC_MS_COREGION_CONTINUE,
+ "Button",BS_AUTORADIOBUTTON,13,151,93,10
+ CONTROL "Connect to the coregion and order the messages in the sequence using:",IDC_MS_COREGION_ORDER,
+ "Button",BS_AUTORADIOBUTTON,13,162,247,10
+ CONTROL "Ordering Line",IDC_MS_CONNECT_WITH_LINE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,260,162,59,10
+ CONTROL "Ordering Side-Side",IDC_MS_CONNECT_WITH_SIDE_SIDE,
+ "Button",BS_AUTORADIOBUTTON,260,173,75,10
END
@@ -65,11 +75,12 @@
IDD_MESSAGE_SEQUENCE_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 499
+ RIGHTMARGIN, 488
VERTGUIDE, 13
VERTGUIDE, 430
+ VERTGUIDE, 438
TOPMARGIN, 7
- BOTTOMMARGIN, 139
+ BOTTOMMARGIN, 190
END
END
#endif // APSTUDIO_INVOKED
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-13 00:13:42 UTC (rev 772)
@@ -948,7 +948,7 @@
VAORC CDocumentMonitor::OnMenuRepaint(Visio::IVApplicationPtr vsoApp)
{
- selectAll(vsoApp,false,SelectionType::SELECTION_REPLACE);
+ selectAll(vsoApp, false, SELECTION_REPLACE);
OnMenuDisableMessageEnumeration(vsoApp);
// clear the verification report
m_reportView->Reset();
@@ -994,7 +994,7 @@
VAORC CDocumentMonitor::OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index)
{
- selectAll(vsoApp,false,SelectionType::SELECTION_REPLACE);
+ selectAll(vsoApp, false, SELECTION_REPLACE);
OnMenuDisableMessageEnumeration(vsoApp);
// clear the verification report
m_reportView->Reset();
@@ -1264,6 +1264,7 @@
double verticalSpaceLeftRight = CPageUtils::ConvertUnits(vsoApp->ActivePage, dlg.m_vertical_space_left_right);
CString leftMessage = dlg.m_left_msg_captions;
CString rightMessage = dlg.m_right_msg_captions;
+ MsgSeqCoregionTreatment coregionTreatment = dlg.m_coregionTreatment;
// step 4: make an ordered list of instances being subject of message sequence drawing
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> orderedBoundaries = std::make_pair<Visio::IVShapePtr, Visio::IVShapePtr>(boundaries.first, boundaries.second);
@@ -1301,7 +1302,12 @@
for ( ; to != instList.end(); ++from, ++to, yPos-=verticalSpace)
{
TRACE("Drawing from " << (*from)->Name << " (" << (*from)->Text << ") to " << (*to)->Name << " (" << (*to)->Text << ") at y=" << yPos);
- Visio::IVShapePtr msg = DrawMessage(msgMaster, *from, *to, yPos, caption);
+ Visio::IVShapePtr msg = DrawMessage(msgMaster, *from, *to, yPos, caption, coregionTreatment);
+ if (msg == NULL)
+ {
+ vsoApp->EndUndoScope(undoScope, false);
+ return VAORC_FAILURE;
+ }
selection->Select(msg, Visio::visSelect);
}
@@ -1317,7 +1323,12 @@
for ( ; rto != instList.rend(); ++rfrom, ++rto, yPos-=verticalSpace)
{
TRACE("Drawing from " << (*rfrom)->Name << " (" << (*rfrom)->Text << ") to " << (*rto)->Name << " (" << (*rto)->Text << ") at y=" << yPos);
- Visio::IVShapePtr msg = DrawMessage(msgMaster, *rfrom, *rto, yPos, caption);
+ Visio::IVShapePtr msg = DrawMessage(msgMaster, *rfrom, *rto, yPos, caption, coregionTreatment);
+ if (msg == NULL)
+ {
+ vsoApp->EndUndoScope(undoScope, false);
+ return VAORC_FAILURE;
+ }
selection->Select(msg, Visio::visSelect);
}
}
@@ -1328,8 +1339,20 @@
return VAORC_SUCCESS;
}
-Visio::IVShapePtr CDocumentMonitor::DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption)
+Visio::IVShapePtr CDocumentMonitor::DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption, MsgSeqCoregionTreatment coregionTreatment)
{
+ Visio::IVShapePtr coregion = CShapeUtils::GetCoregionAt(to, yCoord);
+ if (coregion != NULL)
+ {
+ TRACE("A coregion found at instance " << to->Name << " (" << to->Text << ") at y=" << yCoord);
+ // FIXME: treat coregion appropriately
+ // TODO: would be nice if also the conflicting message was drawn, the error message going afterwards
+ MessageBox(GetActiveWindow(),
+ _T("A coregion was reached by the message sequence"),
+ _T("Error"), MB_OK | MB_ICONEXCLAMATION);
+ return NULL;
+ }
+
Visio::IVShapePtr vsoMsg = from->Application->ActivePage->Drop(msgMaster, 0, 0);
vsoMsg->Text = caption;
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/document.h 2010-05-13 00:13:42 UTC (rev 772)
@@ -24,6 +24,7 @@
#include "data/searcher.h"
#include "data/simulator.h"
#include "data/transformer.h"
+#include "enums.h"
#include "pageutils.h"
#include "enumerateUtils.h"
#include "addon.h"
@@ -45,12 +46,6 @@
p.second = t;
}
-enum SelectionType
-{
- SELECTION_ADD,
- SELECTION_REPLACE,
-};
-
class CDocumentMonitor : public SimulationListener
{
public:
@@ -293,14 +288,17 @@
/**
* Draws a message between the given instances at yCoord.
+ *
+ * On an error (possibly because of a forbidden coregion), an error message box is invoked.
*
- * @param from from which instance
- * @param to to which instance
- * @param yCoord the y-coordinate at which to draw the message; relative to the page
- * @param caption caption of the message
- * @return pointer to the message shape drawn
+ * @param from from which instance
+ * @param to to which instance
+ * @param yCoord the y-coordinate at which to draw the message; relative to the page
+ * @param caption caption of the message
+ * @param coregionTreatment the way coregions should be treated when crossed by the message
+ * @return pointer to the message shape drawn or NULL if the message could not be drawn (probably because of a forbidden coregion)
*/
- Visio::IVShapePtr DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption);
+ Visio::IVShapePtr DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption, MsgSeqCoregionTreatment coregionTreatment);
public:
/**
Added: trunk/src/view/visio/addon/enums.h
===================================================================
--- trunk/src/view/visio/addon/enums.h (rev 0)
+++ trunk/src/view/visio/addon/enums.h 2010-05-13 00:13:42 UTC (rev 772)
@@ -0,0 +1,48 @@
+/*
+ * 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 <ond...@wh...>
+ *
+ * $Id$
+ */
+
+#pragma once
+
+enum TOrderingDirection {
+ ORDER_ASC,
+ ORDER_DESC,
+};
+
+enum MsgSeqDirection
+{
+ MSDIR_LEFT,
+ MSDIR_RIGHT,
+ MSDIR_LEFT_RIGHT,
+ MSDIR_RIGHT_LEFT,
+};
+
+enum MsgSeqCoregionTreatment
+{
+ MSCOR_ERROR,
+ MSCOR_CONTINUE,
+ MSCOR_CONNECT_LINE,
+ MSCOR_CONNECT_SIDE_SIDE,
+};
+
+enum SelectionType
+{
+ SELECTION_ADD,
+ SELECTION_REPLACE,
+};
+
+// $Id$
Property changes on: trunk/src/view/visio/addon/enums.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/messagesequencedlg.cpp
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/messagesequencedlg.cpp 2010-05-13 00:13:42 UTC (rev 772)
@@ -66,7 +66,8 @@
m_rightMessageEdit.SetLimitText(255);
// radio buttons
- switch (m_direction) {
+ switch (m_direction)
+ {
case MSDIR_LEFT:
m_dirLeftRdo.SetCheck(BST_CHECKED);
m_dirLeftRdo.SetFocus();
@@ -86,6 +87,27 @@
break;
}
+ switch (m_coregionTreatment)
+ {
+ case MSCOR_ERROR:
+ m_coregionErrorRdo.SetCheck(BST_CHECKED);
+ m_coregionConnectLineRdo.SetCheck(BST_CHECKED);
+ break;
+ case MSCOR_CONTINUE:
+ m_coregionContinueRdo.SetCheck(BST_CHECKED);
+ m_coregionConnectLineRdo.SetCheck(BST_CHECKED);
+ break;
+ case MSCOR_CONNECT_LINE:
+ default:
+ m_coregionOrderRdo.SetCheck(BST_CHECKED);
+ m_coregionConnectLineRdo.SetCheck(BST_CHECKED);
+ break;
+ case MSCOR_CONNECT_SIDE_SIDE:
+ m_coregionOrderRdo.SetCheck(BST_CHECKED);
+ m_coregionConnectSideSideRdo.SetCheck(BST_CHECKED);
+ break;
+ }
+
return bHandled = false;
}
@@ -133,6 +155,10 @@
{
m_leftMessageEdit.EnableWindow(m_direction != MSDIR_RIGHT);
m_rightMessageEdit.EnableWindow(m_direction != MSDIR_LEFT);
+
+ bool coregionOrdering = (m_coregionTreatment == MSCOR_CONNECT_LINE || m_coregionTreatment == MSCOR_CONNECT_SIDE_SIDE);
+ m_coregionConnectLineRdo.EnableWindow(coregionOrdering);
+ m_coregionConnectSideSideRdo.EnableWindow(coregionOrdering);
}
LRESULT CMessageSequenceDlg::OnDirectionRdo(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
@@ -150,6 +176,22 @@
return 0;
}
+LRESULT CMessageSequenceDlg::OnCoregionRdo(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ if (m_coregionErrorRdo.GetCheck() == BST_CHECKED)
+ m_coregionTreatment = MSCOR_ERROR;
+ else if (m_coregionContinueRdo.GetCheck() == BST_CHECKED)
+ m_coregionTreatment = MSCOR_CONTINUE;
+ else
+ if (m_coregionConnectSideSideRdo.GetCheck() == BST_CHECKED)
+ m_coregionTreatment = MSCOR_CONNECT_SIDE_SIDE;
+ else
+ m_coregionTreatment = MSCOR_CONNECT_LINE;
+
+ UpdateControls();
+ return 0;
+}
+
int CMessageSequenceDlg::LoadRegistryData()
{
TRACE("CMessageSequenceDlg::LoadRegistryData() loading options from registry");
@@ -161,6 +203,7 @@
m_vertical_space = _u(GetRegistry<double>(GetRegistryFolder(), NULL, _T("VerticalSpace"), DEFAULT_MS_VERTICAL_SPACE));
m_vertical_space_left_right = _u(GetRegistry<double>(GetRegistryFolder(), NULL, _T("VerticalSpaceLeftRight"), DEFAULT_MS_VERTICAL_SPACE_LEFT_RIGHT));
#undef _u
+ m_coregionTreatment = (MsgSeqCoregionTreatment)GetRegistry<int>(GetRegistryFolder(), NULL, _T("CoregionTreatment"), DEFAULT_MS_COREGION_TREATMENT);
// FIXME: load message captions from the registry
wcsncpy(m_left_msg_captions, DEFAULT_MS_LEFT_MESSAGE_CAPTION, 255);
@@ -209,6 +252,7 @@
SetRegistry<double>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("VerticalSpace"), _u(m_vertical_space));
SetRegistry<double>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("VerticalSpaceLeftRight"), _u(m_vertical_space_left_right));
#undef _u
+ SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("CoregionTreatment"), m_coregionTreatment);
// FIXME: store message captions to the registry
/*
Modified: trunk/src/view/visio/addon/messagesequencedlg.h
===================================================================
--- trunk/src/view/visio/addon/messagesequencedlg.h 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/messagesequencedlg.h 2010-05-13 00:13:42 UTC (rev 772)
@@ -25,15 +25,8 @@
#include <atlddx.h>
#include <atlwinx.h>
#include <atlmisc.h>
+#include "enums.h"
-enum MsgSeqDirection
-{
- MSDIR_LEFT,
- MSDIR_RIGHT,
- MSDIR_LEFT_RIGHT,
- MSDIR_RIGHT_LEFT,
-};
-
class CMessageSequenceDlg
: public ATL::CDialogImpl<CMessageSequenceDlg>, public CWinDataExchange<CMessageSequenceDlg>
{
@@ -41,6 +34,7 @@
enum { IDD = IDD_MESSAGE_SEQUENCE_OPTIONS };
MsgSeqDirection m_direction;
+ MsgSeqCoregionTreatment m_coregionTreatment;
double m_start_pos_y;
double m_vertical_space;
@@ -77,6 +71,11 @@
DDX_CONTROL_HANDLE(IDC_MS_START_POS_Y, m_startPosYEdit)
DDX_CONTROL_HANDLE(IDC_MS_VERTICAL_SPACE, m_verticalSpaceEdit)
DDX_CONTROL_HANDLE(IDC_MS_VERTICAL_SPACE_LEFT_RIGHT, m_verticalSpaceLeftRightEdit)
+ DDX_CONTROL_HANDLE(IDC_MS_COREGION_ERROR, m_coregionErrorRdo)
+ DDX_CONTROL_HANDLE(IDC_MS_COREGION_CONTINUE, m_coregionContinueRdo)
+ DDX_CONTROL_HANDLE(IDC_MS_COREGION_ORDER, m_coregionOrderRdo)
+ DDX_CONTROL_HANDLE(IDC_MS_CONNECT_WITH_LINE, m_coregionConnectLineRdo)
+ DDX_CONTROL_HANDLE(IDC_MS_CONNECT_WITH_SIDE_SIDE, m_coregionConnectSideSideRdo)
DDX_CONTROL_HANDLE(IDC_MS_UNITS0, m_unitLabels[0])
DDX_CONTROL_HANDLE(IDC_MS_UNITS1, m_unitLabels[1])
DDX_CONTROL_HANDLE(IDC_MS_UNITS2, m_unitLabels[2])
@@ -90,7 +89,11 @@
COMMAND_ID_HANDLER(IDC_MS_DIR_RIGHT, OnDirectionRdo)
COMMAND_ID_HANDLER(IDC_MS_DIR_LEFT_RIGHT, OnDirectionRdo)
COMMAND_ID_HANDLER(IDC_MS_DIR_RIGHT_LEFT, OnDirectionRdo)
-
+ COMMAND_ID_HANDLER(IDC_MS_COREGION_ERROR, OnCoregionRdo)
+ COMMAND_ID_HANDLER(IDC_MS_COREGION_CONTINUE, OnCoregionRdo)
+ COMMAND_ID_HANDLER(IDC_MS_COREGION_ORDER, OnCoregionRdo)
+ COMMAND_ID_HANDLER(IDC_MS_CONNECT_WITH_LINE, OnCoregionRdo)
+ COMMAND_ID_HANDLER(IDC_MS_CONNECT_WITH_SIDE_SIDE, OnCoregionRdo)
END_MSG_MAP()
// Handler prototypes:
@@ -103,6 +106,7 @@
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnDirectionRdo(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+ LRESULT OnCoregionRdo(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
int LoadRegistryData();
int SaveRegistryData();
@@ -113,6 +117,11 @@
CButton m_dirRightRdo;
CButton m_dirLeftRightRdo;
CButton m_dirRightLeftRdo;
+ CButton m_coregionErrorRdo;
+ CButton m_coregionContinueRdo;
+ CButton m_coregionOrderRdo;
+ CButton m_coregionConnectLineRdo;
+ CButton m_coregionConnectSideSideRdo;
CEdit m_leftMessageEdit;
CEdit m_rightMessageEdit;
@@ -128,5 +137,6 @@
static const double DEFAULT_MS_VERTICAL_SPACE_LEFT_RIGHT = 0.1968503937007874; // 5 mm
static const wchar_t* DEFAULT_MS_LEFT_MESSAGE_CAPTION = _T("");
static const wchar_t* DEFAULT_MS_RIGHT_MESSAGE_CAPTION = _T("");
+static const MsgSeqCoregionTreatment DEFAULT_MS_COREGION_TREATMENT = MSCOR_CONNECT_LINE;
// $Id$
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/resource.h 2010-05-13 00:13:42 UTC (rev 772)
@@ -77,20 +77,25 @@
#define IDC_IF_UNITS0 261
#define IDC_MS_UNITS2 262
#define IDC_IF_UNITS1 262
+#define IDC_MS_COREGION_ERROR 263
+#define IDC_MS_COREGION_CONTINUE 264
+#define IDC_MS_COREGION_ORDER 265
#define IDC_IF_UNITS2 267
#define IDC_IF_UNITS3 268
+#define IDC_MS_CONNECT_WITH_LINE 268
#define IDC_IF_UNITS4 269
+#define IDC_MS_CONNECT_WITH_SIDE_SIDE 269
#define IDC_MS_DIR_LEFT 251
#define IDC_MS_DIR_LEFT_RIGHT 252
#define IDC_MS_LEFT_MESSAGE 254
#define IDC_MS_DIR_RIGHT 243
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 224
#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 263
+#define _APS_NEXT_CONTROL_VALUE 270
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-05-13 00:13:42 UTC (rev 772)
@@ -284,6 +284,10 @@
>
</File>
<File
+ RelativePath=".\enums.h"
+ >
+ </File>
+ <File
RelativePath=".\errors.cpp"
>
</File>
Modified: trunk/src/view/visio/addon/shapeutils.cpp
===================================================================
--- trunk/src/view/visio/addon/shapeutils.cpp 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/shapeutils.cpp 2010-05-13 00:13:42 UTC (rev 772)
@@ -65,6 +65,24 @@
shape->CellsSRC[visSectionCharacter][visRowCharacter][visCharacterColor]->ResultIU = 0;
}
+Visio::IVShapePtr CShapeUtils::GetCoregionAt(Visio::IVShapePtr shape, double yPos)
+{
+ Visio::IVConnectsPtr connects = shape->FromConnects;
+ for (int i=1; i<=connects->Count; i++)
+ {
+ Visio::IVShapePtr connShape = connects->Item[i]->FromSheet;
+ if (get_shape_type(connShape) != ST_BMSC_COREGION)
+ continue;
+
+ double beginY = connShape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[0];
+ double endY = connShape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[0];
+
+ if (beginY >= yPos && yPos >= endY)
+ return connShape;
+ }
+ return NULL;
+}
+
bool CShapeComparator::operator()(const Visio::IVShapePtr shapeOne, const Visio::IVShapePtr shapeTwo)
{
if (direction == ORDER_ASC)
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2010-05-12 23:45:14 UTC (rev 771)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-05-13 00:13:42 UTC (rev 772)
@@ -19,12 +19,8 @@
#pragma once
#include "stdafx.h"
#include "extract.h"
+#include "enums.h"
-enum TOrderingDirection {
- ORDER_ASC,
- ORDER_DESC,
-};
-
/**
* A utility class for functionality on a Visio Shape.
*/
@@ -43,6 +39,14 @@
static void MarkShape(Visio::IVShapePtr shape);
static void UnmarkShape(Visio::IVShapePtr shape);
+
+ /**
+ * Get a coregion connected to shape, crossing yPos.
+ * @param shape the shape on which to find a coregion
+ * @param yPos the Y-position relative to the page in internal units
+ * @return pointer to the coregion found or NULL if there is no such coregion
+ */
+ static Visio::IVShapePtr GetCoregionAt(Visio::IVShapePtr shape, double yPos);
};
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-05-12 22:54:24
|
Revision: 770
http://scstudio.svn.sourceforge.net/scstudio/?rev=770&view=rev
Author: mbezdeka
Date: 2010-05-12 22:54:18 +0000 (Wed, 12 May 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/enumerationDlg.h
trunk/src/view/visio/addon/resource.h
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-05-12 21:29:09 UTC (rev 769)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-05-12 22:54:18 UTC (rev 770)
@@ -26,26 +26,31 @@
// Dialog
//
-IDD_MESSAGE_SEQUENCE_OPTIONS DIALOGEX 0, 0, 311, 113
+IDD_MESSAGE_SEQUENCE_OPTIONS DIALOGEX 0, 0, 506, 146
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Message Sequence Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,254,7,50,14
- PUSHBUTTON "Cancel",IDCANCEL,254,25,50,14
- GROUPBOX "Direction:",IDC_STATIC,7,7,241,64
- CONTROL "Left only",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,13,19,44,10
- CONTROL "Right only",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,13,31,48,10
- CONTROL "Left, Right",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,13,43,50,10
- CONTROL "Right, Left",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,13,55,50,10
- LTEXT "Left Message Captions:",IDC_STATIC,90,19,76,8
- EDITTEXT IDC_MC_LEFT_MESSAGE,171,17,67,14,ES_AUTOHSCROLL
- LTEXT "Right Message Captions:",IDC_STATIC,90,43,80,8
- EDITTEXT IDC_MS_RIGHT_MESSAGE,171,41,67,14,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,449,7,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,449,25,50,14
+ GROUPBOX "Direction:",IDC_STATIC,7,7,432,64
+ CONTROL "Right only",IDC_MS_DIR_RIGHT,"Button",BS_AUTORADIOBUTTON,13,19,48,10
+ CONTROL "Left only",IDC_MS_DIR_LEFT,"Button",BS_AUTORADIOBUTTON,13,31,44,10
+ CONTROL "Right, Left",IDC_MS_DIR_RIGHT_LEFT,"Button",BS_AUTORADIOBUTTON,13,43,50,10
+ CONTROL "Left, Right",IDC_MS_DIR_LEFT_RIGHT,"Button",BS_AUTORADIOBUTTON,13,55,50,10
+ LTEXT "Right Message Captions:",IDC_STATIC,90,19,80,8
+ EDITTEXT IDC_MS_RIGHT_MESSAGE,171,17,259,14,ES_AUTOHSCROLL
+ LTEXT "Left Message Captions:",IDC_STATIC,90,43,76,8
+ EDITTEXT IDC_MS_LEFT_MESSAGE,171,41,259,14,ES_AUTOHSCROLL
LTEXT "Starting Y-position:",IDC_STATIC,7,78,62,8
LTEXT "Vertical space between messages:",IDC_STATIC,7,94,111,8
- EDITTEXT IDC_EDIT2,121,76,40,14,ES_AUTOHSCROLL
- EDITTEXT IDC_EDIT3,121,92,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_MS_START_POS_Y,164,76,40,14,ES_AUTOHSCROLL
+ EDITTEXT IDC_MS_VERTICAL_SPACE,164,92,40,14,ES_AUTOHSCROLL
+ LTEXT "Vertical space between left and right sequence:",IDC_STATIC,7,110,154,8
+ EDITTEXT IDC_MS_VERTICAL_SPACE_LEFT_RIGHT,164,108,40,14,ES_AUTOHSCROLL
+ LTEXT "<units>",IDC_MS_UNITS0,207,78,27,8
+ LTEXT "<units>",IDC_MS_UNITS1,207,94,27,8
+ LTEXT "<units>",IDC_MS_UNITS2,207,110,27,8
END
@@ -60,10 +65,11 @@
IDD_MESSAGE_SEQUENCE_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 304
+ RIGHTMARGIN, 499
VERTGUIDE, 13
+ VERTGUIDE, 430
TOPMARGIN, 7
- BOTTOMMARGIN, 106
+ BOTTOMMARGIN, 139
END
END
#endif // APSTUDIO_INVOKED
@@ -140,16 +146,16 @@
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, 201, 127
+IDD_INSTANCES_FIELD_OPTIONS DIALOGEX 0, 0, 210, 127
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add Instances Options"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- DEFPUSHBUTTON "OK",IDOK,146,5,50,14
- PUSHBUTTON "Cancel",IDCANCEL,146,25,50,14
+ DEFPUSHBUTTON "OK",IDOK,155,5,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,155,25,50,14
LTEXT "Number of instances:",IDC_STATIC,5,5,70,12,SS_CENTERIMAGE
EDITTEXT IDC_IF_INSTANCES_CNT,80,5,43,14,ES_AUTOHSCROLL
- GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,73,191,50
+ GROUPBOX "",IDC_OPTIONS_GROUP_BOX,5,73,200,50
LTEXT " Options ",IDC_OPTIONS_SWITCH_LBL,19,73,30,8
LTEXT "Instance length:",IDC_STATIC,5,23,70,12,SS_CENTERIMAGE
EDITTEXT IDC_IF_INSTANCE_LENGTH,80,23,43,14,ES_AUTOHSCROLL
@@ -161,9 +167,14 @@
CONTROL "Spacing:",IDC_SPACING_RDO,"Button",BS_AUTORADIOBUTTON,10,104,43,10
EDITTEXT IDC_IF_TOTAL_WIDTH,63,88,40,14,ES_AUTOHSCROLL
EDITTEXT IDC_IF_SPACING,63,103,40,14,ES_AUTOHSCROLL
- PUSHBUTTON "Default values",IDC_DEFAULT_BTN,131,88,58,14
+ PUSHBUTTON "Default values",IDC_DEFAULT_BTN,140,88,58,14
LTEXT "x:",IDC_STATIC,64,40,9,12,SS_CENTERIMAGE
LTEXT "y:",IDC_STATIC,64,54,9,12,SS_CENTERIMAGE
+ LTEXT "<units>",IDC_IF_UNITS0,127,24,27,8
+ LTEXT "<units>",IDC_IF_UNITS1,127,41,27,8
+ LTEXT "<units>",IDC_IF_UNITS2,127,55,27,8
+ LTEXT "<units>",IDC_IF_UNITS3,107,90,27,8
+ LTEXT "<units>",IDC_IF_UNITS4,107,104,27,8
END
IDD_ENUMERATION_OPTIONS DIALOGEX 0, 0, 236, 75
@@ -220,7 +231,7 @@
IDD_INSTANCES_FIELD_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 5
- RIGHTMARGIN, 196
+ RIGHTMARGIN, 205
VERTGUIDE, 10
VERTGUIDE, 19
VERTGUIDE, 48
Modified: trunk/src/view/visio/addon/enumerationDlg.h
===================================================================
--- trunk/src/view/visio/addon/enumerationDlg.h 2010-05-12 21:29:09 UTC (rev 769)
+++ trunk/src/view/visio/addon/enumerationDlg.h 2010-05-12 22:54:18 UTC (rev 770)
@@ -45,7 +45,7 @@
protected:
BEGIN_DDX_MAP(CNumberMessage)
- DDX_CONTROL_HANDLE(IDC_COMBO_NUMBERING, m_numbering);
+ DDX_CONTROL_HANDLE(IDC_COMBO_NUMBERING, m_numbering);
DDX_CONTROL_HANDLE(IDC_ADDITION, m_addition);
DDX_CONTROL_HANDLE(IDC_STARTING_INDEX, m_index);
DDX_CONTROL_HANDLE(IDC_CHECK_ENUMERATE_NEW, m_enumerateNew);
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-05-12 21:29:09 UTC (rev 769)
+++ trunk/src/view/visio/addon/resource.h 2010-05-12 22:54:18 UTC (rev 770)
@@ -32,12 +32,14 @@
#define IDD_MESSAGE_SEQUENCE_OPTIONS 220
#define IDC_IF_MARGIN_SIDE 221
#define IDC_IF_INSTANCE_LENGTH 221
-#define IDI_ICON_ENABLE_MESSAGE_ENUMERATION 221
+#define IDD_ENUMERATION_OPTIONS 221
#define IDC_IF_MARGIN_TOP 222
-#define IDI_ICON_DISABLE_MESSAGE_ENUMERATION 222
+#define IDI_MESSAGE_NUMBERING 222
+#define IDI_ICON_ENABLE_MESSAGE_ENUMERATION 222
#define IDC_IF_INSTANCES_HEIGHT 223
#define IDC_IF_START_POS_X 223
-#define IDD_ENUMERATION_OPTIONS 223
+#define IDI_ICON_DISABLE_MESSAGE_ENUMERATION 223
+#define IDI_MESSAGE_NUMBERING_DISABLE 224
#define IDC_OPTIONS_SWITCH_BTN 226
#define IDC_OPTIONS_SWITCH_LBL 227
#define IDC_OPTIONS_GROUP_BOX 228
@@ -56,23 +58,14 @@
#define IDC_SPACING_RDO 243
#define IDC_IF_TOTAL_WIDTH 244
#define IDC_DEFAULT_BTN 245
-#define IDC_UNITS_LBL1 246
-#define IDC_UNITS_LBL2 247
-#define IDC_UNITS_LBL3 248
-#define IDC_UNITS_LBL4 249
-#define IDC_UNITS_LBL5 250
-#define IDC_RADIO1 251
-#define IDC_RADIO3 252
-#define IDC_RADIO4 253
-#define IDC_EDIT1 254
-#define IDC_MC_LEFT_MESSAGE 254
-#define IDC_ADDITION 254
+#define IDC_MS_DIR_LEFT 251
+#define IDC_MS_DIR_LEFT_RIGHT 252
+#define IDC_COMBO_NUMBERING 252
+#define IDC_ADDITION 253
+#define IDC_MS_LEFT_MESSAGE 254
+#define IDC_CHECK_ENUMERATE_NEW 254
#define IDC_MS_RIGHT_MESSAGE 255
-#define IDC_EDIT2 256
-#define IDC_EDIT3 257
-#define IDC_CHECK_ENUMERATE_NEW 259
-#define IDC_COMBO_NUMBERING 260
-#define IDC_STARTING_INDEX 261
+#define IDC_STARTING_INDEX 255
#define IDC_MS_YSTART 256
#define IDC_MS_START_POS_Y 256
#define IDC_MS_VERTICAL_SPACE 257
@@ -95,7 +88,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 225
+#define _APS_NEXT_RESOURCE_VALUE 224
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 263
#define _APS_NEXT_SYMED_VALUE 105
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-05-12 23:45:22
|
Revision: 771
http://scstudio.svn.sourceforge.net/scstudio/?rev=771&view=rev
Author: mbezdeka
Date: 2010-05-12 23:45:14 +0000 (Wed, 12 May 2010)
Log Message:
-----------
visiblity in document.h fixed
Modified Paths:
--------------
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/scstudio.vcproj
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-05-12 22:54:18 UTC (rev 770)
+++ trunk/src/view/visio/addon/document.h 2010-05-12 23:45:14 UTC (rev 771)
@@ -336,6 +336,7 @@
Visio::IVAccelItemPtr accelItemMessageEnumerationDisable;
Visio::IVAccelItemPtr accelItemMessageEnumeration;
+public:
Visio::IVUIObjectPtr GetMostCustomMenus();
Visio::IVUIObjectPtr GetMostCustomToolbars();
};
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-05-12 22:54:18 UTC (rev 770)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-05-12 23:45:14 UTC (rev 771)
@@ -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"
@@ -272,10 +272,18 @@
>
</File>
<File
+ RelativePath=".\enumerateUtils.h"
+ >
+ </File>
+ <File
RelativePath=".\enumerationDlg.cpp"
>
</File>
<File
+ RelativePath=".\enumerationDlg.h"
+ >
+ </File>
+ <File
RelativePath=".\errors.cpp"
>
</File>
@@ -486,14 +494,6 @@
>
</File>
</Filter>
- <File
- RelativePath=".\enumerateUtils.h"
- >
- </File>
- <File
- RelativePath=".\enumerationDlg.h"
- >
- </File>
</Files>
<Globals>
<Global
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-05-13 22:07:00
|
Revision: 776
http://scstudio.svn.sourceforge.net/scstudio/?rev=776&view=rev
Author: mbezdeka
Date: 2010-05-13 22:06:53 +0000 (Thu, 13 May 2010)
Log Message:
-----------
fixed auto numbering when copy messages
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/enumerateUtils.cpp
trunk/src/view/visio/addon/enumerateUtils.h
trunk/src/view/visio/addon/enumerationDlg.cpp
trunk/src/view/visio/addon/enumerationDlg.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.h
trunk/src/view/visio/addon/resource.h
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-05-13 22:06:53 UTC (rev 776)
@@ -188,22 +188,20 @@
LTEXT "<units>",IDC_IF_UNITS4,107,104,27,8
END
-IDD_ENUMERATION_OPTIONS DIALOGEX 0, 0, 236, 75
+IDD_ENUMERATION_OPTIONS DIALOGEX 0, 0, 236, 63
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Message numbering"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,179,10,50,14
PUSHBUTTON "Cancel",IDCANCEL,179,27,50,14
- GROUPBOX "Options",IDC_STATIC,6,7,168,65
+ GROUPBOX "Options",IDC_STATIC,6,7,168,50
COMBOBOX IDC_COMBO_NUMBERING,48,18,71,66,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Type:",IDC_STATIC,11,20,24,8,SS_CENTERIMAGE
CTEXT "+",IDC_STATIC,125,18,12,12,SS_CENTERIMAGE
EDITTEXT IDC_ADDITION,143,18,25,14,ES_AUTOHSCROLL | ES_NOHIDESEL
EDITTEXT IDC_STARTING_INDEX,63,36,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Starting index:",IDC_STATIC,11,39,50,8,SS_CENTERIMAGE
- CONTROL "automatically enumerate new messages",IDC_CHECK_ENUMERATE_NEW,
- "Button",BS_AUTOCHECKBOX | BS_LEFT | BS_VCENTER | WS_TABSTOP,12,54,144,12
END
IDD_GLOBAL_SETTINGS DIALOGEX 0, 0, 311, 202
@@ -222,17 +220,18 @@
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "",IDC_STATIC,7,7,275,119
- CONTROL "automatic numbering new messages",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,7,126,10
- CONTROL "as nearest message",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,24,26,80,10
- CONTROL "as nearest numbered message",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,24,40,114,10
+ CONTROL "automatic numbering new messages",IDC_ENUM_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,6,128,10
+ CONTROL "as nearest message",IDC_NEAREST_MSG,"Button",BS_AUTORADIOBUTTON,24,26,80,10
+ CONTROL "as nearest numbered message",IDC_NEAREST_NUMBERED_MSG,
+ "Button",BS_AUTORADIOBUTTON,24,40,114,10
GROUPBOX "If no nearest (numbered) message found:",IDC_STATIC,14,65,261,53,WS_GROUP
- CONTROL "don't number",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,24,81,58,10
- CONTROL "use numbering style:",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,24,97,83,10
+ CONTROL "don't number",IDC_DONT_NUMBER,"Button",BS_AUTORADIOBUTTON,24,81,58,10
+ CONTROL "use numbering style:",IDC_USE_NUMBERING_STYLE,"Button",BS_AUTORADIOBUTTON,24,97,83,10
GROUPBOX "",IDC_STATIC,14,16,128,42,WS_GROUP
COMBOBOX IDC_COMBO_NUMBERING_GLOBAL,107,95,71,66,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CTEXT "+",IDC_STATIC,179,95,12,12,SS_CENTERIMAGE
EDITTEXT IDC_ADDITION_GLOBAL,191,95,25,14,ES_AUTOHSCROLL | ES_NOHIDESEL
- EDITTEXT IDC_STARTING_INDEX,244,95,25,14,ES_AUTOHSCROLL | ES_NUMBER
+ EDITTEXT IDC_STARTING_INDEX_GLOBAL,244,95,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Index:",IDC_STATIC,221,97,21,8,SS_CENTERIMAGE
END
@@ -289,7 +288,7 @@
LEFTMARGIN, 7
RIGHTMARGIN, 229
TOPMARGIN, 7
- BOTTOMMARGIN, 68
+ BOTTOMMARGIN, 56
END
IDD_GLOBAL_SETTINGS, DIALOG
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-13 22:06:53 UTC (rev 776)
@@ -261,24 +261,17 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
- //DODELAT!!
- {
- bool bEnumNewMsg = false;
- int temp;
- std::wstring tempString;
-
- Visio::IVShapePtr closestShape = CEnumerateUtils::getClosestMessage(m_vsoApp,vsoShape);
- if(closestShape)
- {
- _bstr_t groupID = closestShape->Data3;
- CEnumerateUtils::loadGroupSettings(m_vsoApp,groupID,temp,temp,bEnumNewMsg,tempString);
-
- if(bEnumNewMsg)
- enumerate(m_vsoApp,groupID,true,true);
- else
- enumerate(m_vsoApp,groupID,false,true);
- }
- }
+
+ //Message numbering
+ // if(m_vsoApp->ActivePage->PageSheet->GetCellExists(_T("User.AutoEnum1"),0))
+ //autoEnumerate(vsoShape);
+ // else if(m_vsoApp->ActivePage->PageSheet->GetCellExists(_T("User.AutoEnum2"),0))
+ // {
+
+ // }
+ if((_tcsicmp(vsoShape->Data3,_T("")) != 0) && (_tcsicmp(vsoShape->Data1,_T("")) != 0))
+ enumerate(m_vsoApp,vsoShape->Data3,false,true);
+
break;
case ST_COMMENT:
@@ -1380,10 +1373,9 @@
{
static int startingIndex = 1;
static int numberingType = 0;
- static bool enumerateNew = false;
static BSTR add = _T(". ");
- CEnumerationDlg options(startingIndex,numberingType, enumerateNew, add);
+ CEnumerationDlg options(startingIndex,numberingType, add);
if(options.DoModal() != IDOK)
return VAORC_FAILURE;
@@ -1393,10 +1385,9 @@
startingIndex = options.getStartingIndex();
numberingType = options.getNumberingType();
- enumerateNew = options.getEnumerateNew();
add = options.getAddition();
- CEnumerateUtils::saveGroupSettings(vsoApp,groupID,startingIndex,numberingType,enumerateNew,add);
+ CEnumerateUtils::saveGroupSettings(vsoApp,groupID,startingIndex,numberingType,add);
if (vsoApp->ActiveWindow->Selection->Count)
{
@@ -1463,6 +1454,33 @@
return VAORC_SUCCESS;
}
+void CDocumentMonitor::autoEnumerate(Visio::IVShapePtr msgShape)
+{
+ Visio::IVShapePtr pageSheet = msgShape->Application->ActivePage->PageSheet;
+ Visio::IVShapePtr closestMsg;
+
+ int autoEnum1 = pageSheet->Cells["User.AutoEnum1"]->ResultInt[visNone][visTruncate];
+
+ switch(autoEnum1)
+ {
+ case 0:
+ closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,false);
+ if(closestMsg)
+ if(_tcsicmp(closestMsg->Data3,_T("")) != 0)
+ enumerate(msgShape->Application,closestMsg->Data3,true,true);
+ break;
+ case 1:
+ closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,true);
+ if(closestMsg)
+ enumerate(msgShape->Application,closestMsg->Data3,true,true);
+ break;
+
+ default:
+ enumerate(msgShape->Application,msgShape->Data3,false,true);
+ break;
+ }
+}
+
VAORC CDocumentMonitor::OnMenuSelectNumberedGroup(Visio::IVApplicationPtr vsoApp)
{
CEnumerateUtils::selectGroup(vsoApp,vsoApp->ActiveWindow->Selection->Item[1]->Data3);
@@ -1520,8 +1538,6 @@
Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
std::set<_bstr_t> formerGroups;
- /*DWORD start = GetTickCount();*/
-
if(onlySelected)
{
onlySelected = false;
@@ -1558,11 +1574,6 @@
if(formerGroups.size())
for(std::set<_bstr_t>::iterator it = formerGroups.begin(); it != formerGroups.end(); it++)
drawNumbers(shapesOnPage,*it);
-
- //Debug
- //DWORD diff = GetTickCount() - start;
- //std::wstring rozdil = stringize() << std::setprecision(5) << diff/1000.0;
- //MessageBox(GetActiveWindow(),rozdil.c_str(),_T(""),MB_OK);
}
void CDocumentMonitor::drawNumbers(Visio::IVShapesPtr shapesOnPage, _bstr_t groupID)
@@ -1573,9 +1584,8 @@
//Default values
int index = 1;
int enumerationType = 0;
- bool enumNewMsg = false;
std::wstring addition = _T(". ");
- CEnumerateUtils::loadGroupSettings(shapesOnPage->Application,groupID,index,enumerationType,enumNewMsg,addition);
+ CEnumerateUtils::loadGroupSettings(shapesOnPage->Application,groupID,index,enumerationType,addition);
//for all message shapes check whether they are checked as numbered (Data1 == 1)
for(int i=1; i<=shapesOnPage->Count; i++)
@@ -1620,8 +1630,9 @@
VAORC CDocumentMonitor::OnMenuGlobalSettings(Visio::IVApplicationPtr vsoApp)
{
CGlobalSettingsDlg dlg;
+ if(dlg.DoModal() != IDOK)
+ return VAORC_FAILURE;
- dlg.DoModal();
return VAORC_SUCCESS;
}
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/document.h 2010-05-13 22:06:53 UTC (rev 776)
@@ -320,7 +320,8 @@
void ToogleNumeration(bool enabled);
private:
- void enumerate(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, bool enable, bool onlySelected);
+ void autoEnumerate(Visio::IVShapePtr msgShape);
+ void enumerate(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, bool enable, bool onlySelected);
bool temporaryDisableEnumeration(Visio::IVApplicationPtr vsoApp);
void restoreDisabledEnumeration(Visio::IVApplicationPtr vsoApp, bool UndoEnumNewMsg);
Modified: trunk/src/view/visio/addon/enumerateUtils.cpp
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.cpp 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/enumerateUtils.cpp 2010-05-13 22:06:53 UTC (rev 776)
@@ -107,7 +107,7 @@
}
}
-bool CEnumerateUtils::loadGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int& startIndex, int& numberingType, bool& enumNewMsg, std::wstring& addition)
+bool CEnumerateUtils::loadGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int& startIndex, int& numberingType, std::wstring& addition)
{
Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
if(!page->SectionExists[visSectionUser][0])
@@ -120,7 +120,7 @@
std::wstringstream ss(std::wstringstream::in | std::stringstream::out);
ss << groupCell->ResultStr[visNone];
- ss >> startIndex >> numberingType >> enumNewMsg >> addition;
+ ss >> startIndex >> numberingType >> addition;
//Get spaces in addition back
for(int i=0; i<addition.size(); i++)
@@ -132,7 +132,7 @@
return true;
}
-bool CEnumerateUtils::saveGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int startIndex, int numberingType, bool enumNewMsg, BSTR addition)
+bool CEnumerateUtils::saveGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int startIndex, int numberingType, BSTR addition)
{
Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
@@ -157,7 +157,6 @@
groupCell->FormulaU = stringize() << _T("=\"") << startIndex << _T(" ")
<< numberingType << _T(" ")
- << enumNewMsg << _T(" ")
<< additionTemp << _T("\"");
return true;
}
@@ -177,7 +176,7 @@
vsoApp->ActiveWindow->Selection = selection;
}
-Visio::IVShapePtr CEnumerateUtils::getClosestMessage(Visio::IVApplicationPtr vsoApp, const Visio::IVShapePtr shapePtr)
+Visio::IVShapePtr CEnumerateUtils::getClosestMessage(Visio::IVApplicationPtr vsoApp, const Visio::IVShapePtr shapePtr, bool onlyNumbered)
{
Visio::IVShapesPtr shapes = vsoApp->ActivePage->Shapes;
std::map<double, Visio::IVShapePtr> messages;
@@ -189,7 +188,10 @@
{
Visio::IVShapePtr shape = shapes->Item[i];
- if(_tcsicmp(shape->Data1,_T("1")) == 0)
+ if(shape == shapePtr)
+ continue;
+
+ if(_tcsicmp(shape->Data1,_T("1")) == 0 || !onlyNumbered)
{
double tempX = shape->Cells["PinX"]->ResultIU;
double tempY = shape->Cells["PinY"]->ResultIU;
Modified: trunk/src/view/visio/addon/enumerateUtils.h
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.h 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/enumerateUtils.h 2010-05-13 22:06:53 UTC (rev 776)
@@ -41,10 +41,10 @@
* @return whether first shape is "smaller" then the second one
*/
static bool messageCompare(Visio::IVShapePtr p1, Visio::IVShapePtr p2);
- static bool loadGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int& startIndex, int& numberingType, bool& enumNewMsg, std::wstring& addition);
- static bool saveGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int startIndex, int numberingType, bool enumNewMsg, BSTR addition);
+ static bool loadGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int& startIndex, int& numberingType, std::wstring& addition);
+ static bool saveGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int startIndex, int numberingType, BSTR addition);
static void selectGroup(Visio::IVApplicationPtr vsoApp, _bstr_t groupID);
- static Visio::IVShapePtr getClosestMessage(Visio::IVApplicationPtr vsoApp, const Visio::IVShapePtr shapePtr);
+ static Visio::IVShapePtr getClosestMessage(Visio::IVApplicationPtr vsoApp, const Visio::IVShapePtr shapePtr, bool onlyNumbered);
static int getGroupCount(Visio::IVApplicationPtr vsoApp);
static void setGroupCount(Visio::IVApplicationPtr vsoApp, int count);
static VAORC disableEnumeration(Visio::IVShapePtr shape);
Modified: trunk/src/view/visio/addon/enumerationDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/enumerationDlg.cpp 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/enumerationDlg.cpp 2010-05-13 22:06:53 UTC (rev 776)
@@ -19,11 +19,10 @@
#include "dllmodule.h"
#include "enumerationDlg.h"
-CEnumerationDlg::CEnumerationDlg(int startIndex, int enumType, bool enumNew, BSTR addition)
+CEnumerationDlg::CEnumerationDlg(int startIndex, int enumType, BSTR addition)
{
this->index = startIndex;
this->numberingType = enumType;
- this->bEnumerateNew = enumNew;
this->addition = addition;
}
@@ -60,7 +59,6 @@
m_numbering.InsertString(3,_T("A, B, C,..."));
m_numbering.SetCurSel(this->numberingType);
- m_enumerateNew.SetCheck((int)this->bEnumerateNew);
m_addition.SetWindowText(addition);
m_addition.SetLimitText(4);
@@ -74,7 +72,6 @@
int CEnumerationDlg::SaveRegistryData()
{
numberingType = m_numbering.GetCurSel();
- bEnumerateNew = (bool)m_enumerateNew.GetCheck();
addition = 0;
m_addition.GetWindowText(addition);
Modified: trunk/src/view/visio/addon/enumerationDlg.h
===================================================================
--- trunk/src/view/visio/addon/enumerationDlg.h 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/enumerationDlg.h 2010-05-13 22:06:53 UTC (rev 776)
@@ -28,7 +28,7 @@
: public ATL::CDialogImpl<CEnumerationDlg>, public CWinDataExchange<CEnumerationDlg>
{
public:
- CEnumerationDlg(int startIndex, int enumType, bool enumNew, BSTR addition);
+ CEnumerationDlg(int startIndex, int enumType, BSTR addition);
enum { IDD = IDD_ENUMERATION_OPTIONS };
enum NumberingType
{
@@ -41,14 +41,12 @@
CComboBox m_numbering;
CEdit m_addition;
CEdit m_index;
- CButton m_enumerateNew;
protected:
BEGIN_DDX_MAP(CEnumerationDlg)
DDX_CONTROL_HANDLE(IDC_COMBO_NUMBERING, m_numbering);
DDX_CONTROL_HANDLE(IDC_ADDITION, m_addition);
DDX_CONTROL_HANDLE(IDC_STARTING_INDEX, m_index);
- DDX_CONTROL_HANDLE(IDC_CHECK_ENUMERATE_NEW, m_enumerateNew);
END_DDX_MAP()
BEGIN_MSG_MAP(CEnumerationDlg)
@@ -67,12 +65,10 @@
int numberingType;
BSTR addition;
- bool bEnumerateNew;
int index;
public:
int getNumberingType() { return numberingType; }
BSTR getAddition() { return addition; }
int getStartingIndex() { return index; }
- bool getEnumerateNew() { return bEnumerateNew; }
};
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-05-13 22:06:53 UTC (rev 776)
@@ -46,12 +46,49 @@
int CNumberingGlobalDlg::LoadRegistryData()
{
+ if(!m_enumCheck.GetCheck())
+ EnableControls(false);
+
+ m_numberingTypeCombo.InsertString(0,_T("1, 2, 3,..."));
+ m_numberingTypeCombo.InsertString(1,_T("I, II, III,..."));
+ m_numberingTypeCombo.InsertString(2,_T("a, b, c,..."));
+ m_numberingTypeCombo.InsertString(3,_T("A, B, C,..."));
+ m_numberingTypeCombo.SetCurSel(0); //Change to loaded settings
- return 0;
+ m_addition.SetWindowText(_T(". "));
+ m_index.SetWindowText(_T("1"));
+
+ m_nearestMsg.SetCheck(1);
+ m_dontNumber.SetCheck(1);
+
+ return 0;
}
int CNumberingGlobalDlg::SaveRegistryData()
{
+ if(getAutoEnumEnabled() == 1)
+ {
+ SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum1"), getAutoEnum1Type());
+ SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum2"), getAutoEnum2Type());
+ }
return 0;
}
+
+void CNumberingGlobalDlg::EnableControls(bool bEnable)
+{
+ m_nearestMsg.EnableWindow(bEnable);
+ m_nearestNumberedMsg.EnableWindow(bEnable);
+ m_dontNumber.EnableWindow(bEnable);
+ m_useNumberingStyle.EnableWindow(bEnable);
+ m_numberingTypeCombo.EnableWindow(bEnable);
+ m_addition.EnableWindow(bEnable);
+ m_index.EnableWindow(bEnable);
+}
+
+LRESULT CNumberingGlobalDlg::OnBnClickedEnumCheck(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ EnableControls(m_enumCheck.GetCheck());
+
+ return 0;
+}
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-05-13 22:06:53 UTC (rev 776)
@@ -23,26 +23,40 @@
#include <string>
#include <sstream>
#include "data/msc.h"
+#include "enumerateUtils.h"
class CNumberingGlobalDlg
: public ATL::CDialogImpl<CNumberingGlobalDlg>, public CWinDataExchange<CNumberingGlobalDlg>
{
public:
- //CNumberingGlobalDlg(int startIndex, int enumType, bool enumNew, BSTR addition);
enum { IDD = IDD_NUMBERING_GLOBAL };
+ CButton m_enumCheck;
+ CButton m_nearestMsg;
+ CButton m_nearestNumberedMsg;
+ CButton m_dontNumber;
+ CButton m_useNumberingStyle;
+ CComboBox m_numberingTypeCombo;
+ CEdit m_addition;
+ CEdit m_index;
+
protected:
BEGIN_DDX_MAP(CNumberingGlobalDlg)
- //DDX_CONTROL_HANDLE(IDC_COMBO_NUMBERING, m_numbering);
- //DDX_CONTROL_HANDLE(IDC_ADDITION, m_addition);
- //DDX_CONTROL_HANDLE(IDC_STARTING_INDEX, m_index);
- //DDX_CONTROL_HANDLE(IDC_CHECK_ENUMERATE_NEW, m_enumerateNew);
+ DDX_CONTROL_HANDLE(IDC_ENUM_CHECK, m_enumCheck);
+ DDX_CONTROL_HANDLE(IDC_NEAREST_MSG, m_nearestMsg);
+ DDX_CONTROL_HANDLE(IDC_NEAREST_NUMBERED_MSG, m_nearestNumberedMsg);
+ DDX_CONTROL_HANDLE(IDC_DONT_NUMBER, m_dontNumber);
+ DDX_CONTROL_HANDLE(IDC_USE_NUMBERING_STYLE, m_useNumberingStyle);
+ DDX_CONTROL_HANDLE(IDC_COMBO_NUMBERING_GLOBAL, m_numberingTypeCombo);
+ DDX_CONTROL_HANDLE(IDC_ADDITION_GLOBAL, m_addition);
+ DDX_CONTROL_HANDLE(IDC_STARTING_INDEX_GLOBAL, m_index);
END_DDX_MAP()
BEGIN_MSG_MAP(CNumberingGlobalDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
+ COMMAND_HANDLER(IDC_ENUM_CHECK, BN_CLICKED, OnBnClickedEnumCheck)
END_MSG_MAP()
// Handler prototypes:
@@ -52,7 +66,15 @@
int LoadRegistryData();
int SaveRegistryData();
+ void EnableControls(bool bEnable = true);
+ const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageNumbering"); }
+
public:
+ int getAutoEnumEnabled() { return m_enumCheck.GetCheck(); };
+ int getAutoEnum1Type() { return ((m_nearestMsg.GetCheck() == 0) ? 1 : 0); };
+ int getAutoEnum2Type() { return ((m_dontNumber.GetCheck() == 0) ? 1 : 0); };
+
+ LRESULT OnBnClickedEnumCheck(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-05-13 18:38:46 UTC (rev 775)
+++ trunk/src/view/visio/addon/resource.h 2010-05-13 22:06:53 UTC (rev 776)
@@ -59,6 +59,7 @@
#define IDC_RADIO2 243
#define IDC_SPACING_RDO 243
#define IDC_MS_DIR_RIGHT 243
+#define IDC_DONT_NUMBER 243
#define IDC_IF_TOTAL_WIDTH 244
#define IDC_DEFAULT_BTN 245
#define IDC_MS_DIR_LEFT 251
@@ -83,19 +84,24 @@
#define IDC_MS_COREGION_ERROR 263
#define IDC_MS_COREGION_CONTINUE 264
#define IDC_RADIO1 264
+#define IDC_NEAREST_MSG 264
#define IDC_MS_COREGION_ORDER 265
#define IDC_TAB2 265
#define IDC_TAB_SETTINGS 265
#define IDC_RADIO3 265
+#define IDC_NEAREST_NUMBERED_MSG 265
#define IDC_IF_UNITS2 267
#define IDC_IF_UNITS3 268
#define IDC_MS_CONNECT_WITH_LINE 268
#define IDC_IF_UNITS4 269
#define IDC_MS_CONNECT_WITH_SIDE_SIDE 269
#define IDC_CHECK2 271
+#define IDC_ENUM_CHECK 271
#define IDC_RADIO4 273
+#define IDC_USE_NUMBERING_STYLE 273
#define IDC_COMBO_NUMBERING_GLOBAL 276
#define IDC_ADDITION_GLOBAL 277
+#define IDC_STARTING_INDEX_GLOBAL 278
// Next default values for new objects
//
@@ -103,7 +109,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 226
#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 278
+#define _APS_NEXT_CONTROL_VALUE 279
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-05-13 23:36:53
|
Revision: 777
http://scstudio.svn.sourceforge.net/scstudio/?rev=777&view=rev
Author: obouda
Date: 2010-05-13 23:36:47 +0000 (Thu, 13 May 2010)
Log Message:
-----------
Message Sequence: finalized - now, coregions are treated
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-05-13 22:06:53 UTC (rev 776)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-13 23:36:47 UTC (rev 777)
@@ -1281,6 +1281,7 @@
Visio::IVPagePtr vsoPage = vsoApp->ActivePage;
CDrawingVisualizer visualizer(vsoApp);
Visio::IVMasterPtr msgMaster = visualizer.find_master(ST_BMSC_MESSAGE);
+ Visio::IVMasterPtr orderingMaster = visualizer.find_master(ST_BMSC_ORDER_LINE);
Visio::IVSelectionPtr selection = vsoPage->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper);
double yPos = startPosY;
@@ -1288,10 +1289,11 @@
std::vector<Visio::IVShapePtr>::iterator to = instList.begin();
++to;
const TCHAR* caption = (instanceCmp(*from, *to) ? rightMessage : leftMessage);
+ Visio::IVShapePtr msg = NULL;
for ( ; to != instList.end(); ++from, ++to, yPos-=verticalSpace)
{
TRACE("Drawing from " << (*from)->Name << " (" << (*from)->Text << ") to " << (*to)->Name << " (" << (*to)->Text << ") at y=" << yPos);
- Visio::IVShapePtr msg = DrawMessage(msgMaster, *from, *to, yPos, caption, coregionTreatment);
+ msg = DrawMessage(msgMaster, orderingMaster, *from, *to, yPos, caption, coregionTreatment, msg);
if (msg == NULL)
{
vsoApp->EndUndoScope(undoScope, false);
@@ -1312,7 +1314,7 @@
for ( ; rto != instList.rend(); ++rfrom, ++rto, yPos-=verticalSpace)
{
TRACE("Drawing from " << (*rfrom)->Name << " (" << (*rfrom)->Text << ") to " << (*rto)->Name << " (" << (*rto)->Text << ") at y=" << yPos);
- Visio::IVShapePtr msg = DrawMessage(msgMaster, *rfrom, *rto, yPos, caption, coregionTreatment);
+ msg = DrawMessage(msgMaster, orderingMaster, *rfrom, *rto, yPos, caption, coregionTreatment, msg);
if (msg == NULL)
{
vsoApp->EndUndoScope(undoScope, false);
@@ -1328,33 +1330,52 @@
return VAORC_SUCCESS;
}
-Visio::IVShapePtr CDocumentMonitor::DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption, MsgSeqCoregionTreatment coregionTreatment)
+Visio::IVShapePtr CDocumentMonitor::DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVMasterPtr orderingMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption, MsgSeqCoregionTreatment coregionTreatment, Visio::IVShapePtr prevMsg)
{
- Visio::IVShapePtr coregion = CShapeUtils::GetCoregionAt(to, yCoord);
- if (coregion != NULL)
+ Visio::IVShapePtr fromCoregion = CShapeUtils::GetCoregionAt(from, yCoord);
+ Visio::IVShapePtr toCoregion = CShapeUtils::GetCoregionAt(to, yCoord);
+
+ Visio::IVPagePtr page = from->Application->ActivePage;
+ Visio::IVShapePtr vsoMsg = page->Drop(msgMaster, 0, 0);
+ vsoMsg->Text = caption;
+
+ Visio::IVShapePtr fromShape = (fromCoregion == NULL ? from : fromCoregion);
+ Visio::IVShapePtr toShape = (toCoregion == NULL ? to : toCoregion);
+
+ Visio::IVCellPtr fromCell = vsoMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
+ double fromLen = CShapeUtils::GetShapeBeginY(fromShape) - CShapeUtils::GetShapeEndY(fromShape);
+ double fromYOffset = CShapeUtils::GetShapeBeginY(fromShape) - yCoord;
+ fromCell->GlueToPos(fromShape, (fromYOffset/fromLen), 1.0); // NOTE: Visio's x-axis is here in fact y, and vice versa
+
+ Visio::IVCellPtr toCell = vsoMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX];
+ double toLen = CShapeUtils::GetShapeBeginY(toShape) - CShapeUtils::GetShapeEndY(toShape);
+ double toYOffset = CShapeUtils::GetShapeBeginY(toShape) - yCoord;
+ toCell->GlueToPos(toShape, (toYOffset/toLen), 0.0); // NOTE: Visio's x-axis is here in fact y, and vice versa
+
+ if (toCoregion != NULL && coregionTreatment == MSCOR_ERROR)
{
- TRACE("A coregion found at instance " << to->Name << " (" << to->Text << ") at y=" << yCoord);
- // FIXME: treat coregion appropriately
- // TODO: would be nice if also the conflicting message was drawn, the error message going afterwards
+ TRACE("A forbidden coregion found at instance " << to->Name << " (" << to->Text << ") at y=" << yCoord);
MessageBox(GetActiveWindow(),
_T("A coregion was reached by the message sequence"),
_T("Error"), MB_OK | MB_ICONEXCLAMATION);
return NULL;
}
- Visio::IVShapePtr vsoMsg = from->Application->ActivePage->Drop(msgMaster, 0, 0);
- vsoMsg->Text = caption;
+ if (prevMsg != NULL && fromCoregion != NULL &&
+ (coregionTreatment == MSCOR_CONNECT_LINE || coregionTreatment == MSCOR_CONNECT_SIDE_SIDE))
+ {
+ Visio::IVShapePtr vsoOrdering = page->Drop(orderingMaster, 0, 0);
+ if (coregionTreatment == MSCOR_CONNECT_LINE)
+ {
+ vsoOrdering->DeleteRow(visSectionFirstComponent, visRowComponent+2);
+ vsoOrdering->DeleteRow(visSectionFirstComponent, visRowComponent+2);
+ }
+ Visio::IVCellPtr ordFromCell = vsoOrdering->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
+ Visio::IVCellPtr ordToCell = vsoOrdering->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX];
+ ordFromCell->GlueTo(prevMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX]);
+ ordToCell->GlueTo(fromCell);
+ }
- Visio::IVCellPtr fromCell = vsoMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
- double fromLen = CShapeUtils::GetShapeBeginY(from) - CShapeUtils::GetShapeEndY(from);
- double fromYOffset = CShapeUtils::GetShapeBeginY(from) - yCoord;
- fromCell->GlueToPos(from, (fromYOffset/fromLen), 0.5); // NOTE: Visio's x-axis is here in fact y, and vice versa
-
- Visio::IVCellPtr toCell = vsoMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX];
- double toLen = CShapeUtils::GetShapeBeginY(to) - CShapeUtils::GetShapeEndY(to);
- double toYOffset = CShapeUtils::GetShapeBeginY(from) - yCoord;
- toCell->GlueToPos(to, (toYOffset/toLen), 0.5); // NOTE: Visio's x-axis is here in fact y, and vice versa
-
return vsoMsg;
}
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-05-13 22:06:53 UTC (rev 776)
+++ trunk/src/view/visio/addon/document.h 2010-05-13 23:36:47 UTC (rev 777)
@@ -293,14 +293,19 @@
*
* On an error (possibly because of a forbidden coregion), an error message box is invoked.
*
+ * @param msgMaster message master shape
+ * @param orderingMaster ordering master shape
* @param from from which instance
* @param to to which instance
* @param yCoord the y-coordinate at which to draw the message; relative to the page
* @param caption caption of the message
* @param coregionTreatment the way coregions should be treated when crossed by the message
+ * @param prevMsg previous message in the sequence which to connect this message with if the
+ * coregion treatment is some kind of connection;
+ * might be NULL in which case no connecting will take place
* @return pointer to the message shape drawn or NULL if the message could not be drawn (probably because of a forbidden coregion)
*/
- Visio::IVShapePtr DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption, MsgSeqCoregionTreatment coregionTreatment);
+ Visio::IVShapePtr DrawMessage(Visio::IVMasterPtr msgMaster, Visio::IVMasterPtr orderingMaster, Visio::IVShapePtr from, Visio::IVShapePtr to, double yCoord, const TCHAR* caption, MsgSeqCoregionTreatment coregionTreatment, Visio::IVShapePtr prevMsg);
public:
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ob...@us...> - 2010-05-14 00:51:30
|
Revision: 778
http://scstudio.svn.sourceforge.net/scstudio/?rev=778&view=rev
Author: obouda
Date: 2010-05-14 00:51:23 +0000 (Fri, 14 May 2010)
Log Message:
-----------
Message Sequence: added a small tolerance when finding coregions; fixed left (or left+right) message sequences over coregions.
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/document.h
trunk/src/view/visio/addon/shapeutils.cpp
trunk/src/view/visio/addon/shapeutils.h
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-05-13 23:36:47 UTC (rev 777)
+++ trunk/src/view/visio/addon/document.cpp 2010-05-14 00:51:23 UTC (rev 778)
@@ -31,7 +31,6 @@
#include "GlobalSettingsDlg.h"
#include <fstream>
-#include "shapeutils.h"
#include "data/msc.h"
@@ -1342,17 +1341,22 @@
Visio::IVShapePtr fromShape = (fromCoregion == NULL ? from : fromCoregion);
Visio::IVShapePtr toShape = (toCoregion == NULL ? to : toCoregion);
+ double vsoMsgBeginX = from->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX]->Result[0];
+ double vsoMsgEndX = to->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX]->Result[0];
+ double fromX = (vsoMsgBeginX <= vsoMsgEndX ? 1.0 : 0.0);
+ double toX = (vsoMsgBeginX < vsoMsgEndX ? 0.0 : 1.0);
+
Visio::IVCellPtr fromCell = vsoMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
double fromLen = CShapeUtils::GetShapeBeginY(fromShape) - CShapeUtils::GetShapeEndY(fromShape);
double fromYOffset = CShapeUtils::GetShapeBeginY(fromShape) - yCoord;
- fromCell->GlueToPos(fromShape, (fromYOffset/fromLen), 1.0); // NOTE: Visio's x-axis is here in fact y, and vice versa
+ fromCell->GlueToPos(fromShape, (fromYOffset/fromLen), fromX); // NOTE: Visio's x-axis is here in fact y, and vice versa
Visio::IVCellPtr toCell = vsoMsg->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX];
double toLen = CShapeUtils::GetShapeBeginY(toShape) - CShapeUtils::GetShapeEndY(toShape);
double toYOffset = CShapeUtils::GetShapeBeginY(toShape) - yCoord;
- toCell->GlueToPos(toShape, (toYOffset/toLen), 0.0); // NOTE: Visio's x-axis is here in fact y, and vice versa
+ toCell->GlueToPos(toShape, (toYOffset/toLen), toX); // NOTE: Visio's x-axis is here in fact y, and vice versa
- if (toCoregion != NULL && coregionTreatment == MSCOR_ERROR)
+ if (coregionTreatment == MSCOR_ERROR && (fromCoregion != NULL || toCoregion != NULL))
{
TRACE("A forbidden coregion found at instance " << to->Name << " (" << to->Text << ") at y=" << yCoord);
MessageBox(GetActiveWindow(),
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-05-13 23:36:47 UTC (rev 777)
+++ trunk/src/view/visio/addon/document.h 2010-05-14 00:51:23 UTC (rev 778)
@@ -26,6 +26,7 @@
#include "data/transformer.h"
#include "enums.h"
#include "pageutils.h"
+#include "shapeutils.h"
#include "enumerateUtils.h"
#include "addon.h"
@@ -36,8 +37,6 @@
typedef std::vector<CheckerPtr> CheckerPtrList;
typedef std::vector<TransformerPtr> TransformerPtrList;
-const double EPSILON = 1e-10;
-
template <typename T1, typename T2>
void swap(std::pair<T1,T2> &p)
{
Modified: trunk/src/view/visio/addon/shapeutils.cpp
===================================================================
--- trunk/src/view/visio/addon/shapeutils.cpp 2010-05-13 23:36:47 UTC (rev 777)
+++ trunk/src/view/visio/addon/shapeutils.cpp 2010-05-14 00:51:23 UTC (rev 778)
@@ -77,7 +77,7 @@
double beginY = connShape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[0];
double endY = connShape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[0];
- if (beginY >= yPos && yPos >= endY)
+ if (beginY >= yPos - 1000*EPSILON && yPos >= endY - 1000*EPSILON)
return connShape;
}
return NULL;
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2010-05-13 23:36:47 UTC (rev 777)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-05-14 00:51:23 UTC (rev 778)
@@ -21,6 +21,8 @@
#include "extract.h"
#include "enums.h"
+const double EPSILON = 1e-10;
+
/**
* A utility class for functionality on a Visio Shape.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <got...@us...> - 2010-05-16 11:13:40
|
Revision: 785
http://scstudio.svn.sourceforge.net/scstudio/?rev=785&view=rev
Author: gotthardp
Date: 2010-05-16 11:13:33 +0000 (Sun, 16 May 2010)
Log Message:
-----------
Fixed file properties.
Modified Paths:
--------------
trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
trunk/src/view/visio/addon/GlobalSettingsDlg.h
trunk/src/view/visio/addon/enumerateUtils.cpp
trunk/src/view/visio/addon/enumerateUtils.h
trunk/src/view/visio/addon/enumerationDlg.cpp
trunk/src/view/visio/addon/enumerationDlg.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.h
Property Changed:
----------------
trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
trunk/src/view/visio/addon/GlobalSettingsDlg.h
trunk/src/view/visio/addon/enumerateUtils.cpp
trunk/src/view/visio/addon/enumerateUtils.h
trunk/src/view/visio/addon/enumerationDlg.cpp
trunk/src/view/visio/addon/enumerationDlg.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.h
Modified: trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/GlobalSettingsDlg.cpp 2010-05-16 09:34:47 UTC (rev 784)
+++ trunk/src/view/visio/addon/GlobalSettingsDlg.cpp 2010-05-16 11:13:33 UTC (rev 785)
@@ -1,124 +1,124 @@
-/*
- * 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 Martin Bezdeka <mbe...@se...>
- *
- */
-#include "stdafx.h"
-#include "dllmodule.h"
-#include "GlobalSettingsDlg.h"
-
-
-
-CTabCtrlMSC::CTabCtrlMSC()
-{
- dialogs[0] = new CNumberingGlobalDlg;
-
- m_nNumberOfPages = 1;
-}
-
-CTabCtrlMSC::~CTabCtrlMSC()
-{
- for(int i=0; i<m_nNumberOfPages; i++)
- delete dialogs[i];
-}
-
-void CTabCtrlMSC::Init()
-{
- m_tabCurrent = 0;
- dialogs[0]->Create(this->m_hWnd,NULL);
- dialogs[0]->ShowWindow(SW_SHOW);
-
- SetRectangle();
-}
-
-void CTabCtrlMSC::SetRectangle()
-{
- RECT tabRect, itemRect;
- int nX, nY, nXc, nYc;
-
- GetClientRect(&tabRect);
- GetItemRect(0, &itemRect);
-
- nX=itemRect.left;
- nY=itemRect.bottom+2;
- nXc=tabRect.right-itemRect.left-3;
- nYc=tabRect.bottom-nY-3;
-
- dialogs[0]->SetWindowPos(HWND_TOP, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
- //hiding other windows
- for(int i=1; i < m_nNumberOfPages; i++)
- {
- dialogs[i]->SetWindowPos(HWND_TOP, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CMyTabCtrl message handlers
-
-LRESULT CTabCtrlMSC::OnLButtonDown(UINT nFlags, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
-{
- //not implemented yet!
-
- /*CTabCtrl::OnLButtonDown(nFlags, point);
-
- if(m_tabCurrent != this->GetCurFocus() != 0)
- {
- dialogs[0]->ShowWindow(SW_HIDE);
- }*/
-
- return 0;
-}
-
-//////////////////////////////
-// GLOBAL SETTINGS DIALOG
-
-LRESULT CGlobalSettingsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
- CenterWindow(GetParent());
-
- DoDataExchange();
- LoadRegistryData();
-
-
- return bHandled = FALSE;
-}
-
-LRESULT CGlobalSettingsDlg::OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
-{
- if(wID == IDOK)
- {
- DoDataExchange(TRUE);
- if(SaveRegistryData() == 0)
- EndDialog(wID);
- }
- else if(wID == IDCANCEL)
- EndDialog(wID);
-
- return 0;
-}
-
-int CGlobalSettingsDlg::LoadRegistryData()
-{
- m_tabSettings.AddItem(_T("Numbering"));
- m_tabSettings.Init();
-
- DoDataExchange();
-
- return 0;
-}
-
-int CGlobalSettingsDlg::SaveRegistryData()
-{
- return 0;
-}
+/*
+ * 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 Martin Bezdeka <mbe...@se...>
+ *
+ */
+#include "stdafx.h"
+#include "dllmodule.h"
+#include "GlobalSettingsDlg.h"
+
+
+
+CTabCtrlMSC::CTabCtrlMSC()
+{
+ dialogs[0] = new CNumberingGlobalDlg;
+
+ m_nNumberOfPages = 1;
+}
+
+CTabCtrlMSC::~CTabCtrlMSC()
+{
+ for(int i=0; i<m_nNumberOfPages; i++)
+ delete dialogs[i];
+}
+
+void CTabCtrlMSC::Init()
+{
+ m_tabCurrent = 0;
+ dialogs[0]->Create(this->m_hWnd,NULL);
+ dialogs[0]->ShowWindow(SW_SHOW);
+
+ SetRectangle();
+}
+
+void CTabCtrlMSC::SetRectangle()
+{
+ RECT tabRect, itemRect;
+ int nX, nY, nXc, nYc;
+
+ GetClientRect(&tabRect);
+ GetItemRect(0, &itemRect);
+
+ nX=itemRect.left;
+ nY=itemRect.bottom+2;
+ nXc=tabRect.right-itemRect.left-3;
+ nYc=tabRect.bottom-nY-3;
+
+ dialogs[0]->SetWindowPos(HWND_TOP, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
+ //hiding other windows
+ for(int i=1; i < m_nNumberOfPages; i++)
+ {
+ dialogs[i]->SetWindowPos(HWND_TOP, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CMyTabCtrl message handlers
+
+LRESULT CTabCtrlMSC::OnLButtonDown(UINT nFlags, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ //not implemented yet!
+
+ /*CTabCtrl::OnLButtonDown(nFlags, point);
+
+ if(m_tabCurrent != this->GetCurFocus() != 0)
+ {
+ dialogs[0]->ShowWindow(SW_HIDE);
+ }*/
+
+ return 0;
+}
+
+//////////////////////////////
+// GLOBAL SETTINGS DIALOG
+
+LRESULT CGlobalSettingsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ CenterWindow(GetParent());
+
+ DoDataExchange();
+ LoadRegistryData();
+
+
+ return bHandled = FALSE;
+}
+
+LRESULT CGlobalSettingsDlg::OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ if(wID == IDOK)
+ {
+ DoDataExchange(TRUE);
+ if(SaveRegistryData() == 0)
+ EndDialog(wID);
+ }
+ else if(wID == IDCANCEL)
+ EndDialog(wID);
+
+ return 0;
+}
+
+int CGlobalSettingsDlg::LoadRegistryData()
+{
+ m_tabSettings.AddItem(_T("Numbering"));
+ m_tabSettings.Init();
+
+ DoDataExchange();
+
+ return 0;
+}
+
+int CGlobalSettingsDlg::SaveRegistryData()
+{
+ return 0;
+}
Property changes on: trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/GlobalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/GlobalSettingsDlg.h 2010-05-16 09:34:47 UTC (rev 784)
+++ trunk/src/view/visio/addon/GlobalSettingsDlg.h 2010-05-16 11:13:33 UTC (rev 785)
@@ -1,83 +1,83 @@
-/*
- * 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 Martin Bezdeka <mbe...@se...>
- *
- */
-
-#pragma once
-
-#include <atldlgs.h>
-#include <atlctrls.h>
-#include <atlddx.h>
-#include <string>
-#include <sstream>
-#include "data/msc.h"
-#include "GlobalSettingsDlg.h"
-#include "numberingGlobalDlg.h"
-
-class CTabCtrlMSC : public ATL::CWindowImpl<CTabCtrlMSC, CTabCtrl>
-{
-// Construction
-public:
- CTabCtrlMSC();
- virtual ~CTabCtrlMSC();
-
- int m_tabCurrent;
- int m_nNumberOfPages;
- //Add your specific dialog on the tab
- CNumberingGlobalDlg* dialogs[1];
-
- void Init();
- void SetRectangle();
-
-protected:
- BEGIN_MSG_MAP(CTabCtrlMSC)
- MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
- END_MSG_MAP()
-
- LRESULT OnLButtonDown(UINT, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
-};
-
-/////////////////////////////////////
-// GLOBAL SETTINGS DIALOG
-
-class CGlobalSettingsDlg
- : public ATL::CDialogImpl<CGlobalSettingsDlg>, public CWinDataExchange<CGlobalSettingsDlg>
-{
-public:
- //CGlobalSettingsDlg();
- enum { IDD = IDD_GLOBAL_SETTINGS };
-
- CTabCtrlMSC m_tabSettings;
-
-protected:
-BEGIN_DDX_MAP(CGlobalSettingsDlg)
- DDX_CONTROL(IDC_TAB_SETTINGS, m_tabSettings);
-END_DDX_MAP()
-
-BEGIN_MSG_MAP(CGlobalSettingsDlg)
- MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
- COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
- COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
-END_MSG_MAP()
-
-// Handler prototypes:
-
- LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
- LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
-
- int LoadRegistryData();
- int SaveRegistryData();
-
+/*
+ * 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 Martin Bezdeka <mbe...@se...>
+ *
+ */
+
+#pragma once
+
+#include <atldlgs.h>
+#include <atlctrls.h>
+#include <atlddx.h>
+#include <string>
+#include <sstream>
+#include "data/msc.h"
+#include "GlobalSettingsDlg.h"
+#include "numberingGlobalDlg.h"
+
+class CTabCtrlMSC : public ATL::CWindowImpl<CTabCtrlMSC, CTabCtrl>
+{
+// Construction
+public:
+ CTabCtrlMSC();
+ virtual ~CTabCtrlMSC();
+
+ int m_tabCurrent;
+ int m_nNumberOfPages;
+ //Add your specific dialog on the tab
+ CNumberingGlobalDlg* dialogs[1];
+
+ void Init();
+ void SetRectangle();
+
+protected:
+ BEGIN_MSG_MAP(CTabCtrlMSC)
+ MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
+ END_MSG_MAP()
+
+ LRESULT OnLButtonDown(UINT, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+};
+
+/////////////////////////////////////
+// GLOBAL SETTINGS DIALOG
+
+class CGlobalSettingsDlg
+ : public ATL::CDialogImpl<CGlobalSettingsDlg>, public CWinDataExchange<CGlobalSettingsDlg>
+{
+public:
+ //CGlobalSettingsDlg();
+ enum { IDD = IDD_GLOBAL_SETTINGS };
+
+ CTabCtrlMSC m_tabSettings;
+
+protected:
+BEGIN_DDX_MAP(CGlobalSettingsDlg)
+ DDX_CONTROL(IDC_TAB_SETTINGS, m_tabSettings);
+END_DDX_MAP()
+
+BEGIN_MSG_MAP(CGlobalSettingsDlg)
+ MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
+ COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
+ COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
+END_MSG_MAP()
+
+// Handler prototypes:
+
+ LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+
+ int LoadRegistryData();
+ int SaveRegistryData();
+
};
\ No newline at end of file
Property changes on: trunk/src/view/visio/addon/GlobalSettingsDlg.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/enumerateUtils.cpp
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.cpp 2010-05-16 09:34:47 UTC (rev 784)
+++ trunk/src/view/visio/addon/enumerateUtils.cpp 2010-05-16 11:13:33 UTC (rev 785)
@@ -1,301 +1,301 @@
-/*
- * 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 Martin Bezdeka <mbe...@se...>
- *
- */
-
-#include "enumerateUtils.h"
-
-std::wstring CEnumerateUtils::int2Romans(int index)
-{
- if(index < 0 || index > 3999)
- {
- MessageBox(GetActiveWindow(),
- _T("Index too big! Use another type of enumeration. Roman index can be from 0-3999."),
- _T("Error"),MB_OK | MB_ICONERROR);
- return _T("?");
- }
-
- if(index == 0)
- return _T("N");
-
- int numeral[] = {1000, 900, 500, 400, 100,90, 50, 40, 10, 9, 5, 4, 1};
- std::wstring romans[] = {L"M", L"CM", L"D", L"CD", L"C", L"XC", L"L", L"XL", L"X", L"IX", L"V", L"IV", L"I" };
- std::wstring result;
-
- for(int i=0; i < 13; i++)
- while(index >=numeral[i])
- {
- index -= numeral[i];
- result += romans[i];
- }
-
- return result;
-}
-
-std::wstring CEnumerateUtils::int2Char(int index, bool capitals)
-{
- index--;
-
- if(index < 0)
- {
- MessageBox(GetActiveWindow(),
- _T("Index less than one! Char index can be from 1-inf."),
- _T("Error"),MB_OK | MB_ICONERROR);
- return _T("?");
- }
-
- std::wstring result;
-
- if(index == 0)
- return (capitals ? _T("A") : _T("a"));
-
- bool bLast = true;
-
- while(index > 0)
- {
- if(bLast)
- {
- result.insert(0,(capitals ? (stringize() << (char)((index % 26)+65)) : (stringize() << (char)((index % 26)+97))));
- index = index / 26;
-
- if(index/27 == 0)
- bLast = false;
- }
- else
- {
- result.insert(0,(capitals ? (stringize() << (char)((index % 27)+64)) : (stringize() << (char)((index % 27)+96))));
- index = index / 27;
- }
- }
-
- return result;
-}
-
-bool CEnumerateUtils::messageCompare(Visio::IVShapePtr p1, Visio::IVShapePtr p2)
-{
- double beginP1Y = p1->Cells["BeginY"]->ResultIU;
- double beginP2Y = p2->Cells["BeginY"]->ResultIU;
-
- if(beginP1Y - beginP2Y != 0.0)
- return beginP1Y > beginP2Y;
- else
- {
- double beginP1X = p1->Cells["BeginX"]->ResultIU;
- double beginP2X = p2->Cells["BeginX"]->ResultIU;
-
- if(beginP1X - beginP2X != 0.0)
- return beginP1X < beginP2X;
- else
- {
- double endP1X = p1->Cells["EndX"]->ResultIU;
- double endP2X = p2->Cells["EndX"]->ResultIU;
-
- return endP1X < endP2X;
- }
- }
-}
-
-bool CEnumerateUtils::loadGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int& startIndex, int& numberingType, std::wstring& addition)
-{
- Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
- if(!page->SectionExists[visSectionUser][0])
- return false;
-
- _bstr_t userGroupID = stringize() << _T("User.") << groupID;
- Visio::IVCellPtr groupCell = page->GetCells(userGroupID);
- if(!groupCell)
- return false;
-
- std::wstringstream ss(std::wstringstream::in | std::stringstream::out);
- ss << groupCell->ResultStr[visNone];
- ss >> startIndex >> numberingType >> addition;
-
- //Get spaces in addition back
- for(int i=0; i<addition.size(); i++)
- if(addition[i] == '$')
- addition[i] = ' ';
-
- addition = addition + _T(" ");
-
- return true;
-}
-
-bool CEnumerateUtils::saveGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int startIndex, int numberingType, BSTR addition)
-{
- Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
-
- if(!page->SectionExists[visSectionUser][0])
- page->AddSection(visSectionUser);
-
- _bstr_t userGroupID = stringize() << _T("User.") << groupID;
-
- if(page->GetCellExists(userGroupID,0) != -1)
- page->AddNamedRow(visSectionUser, groupID, visTagDefault);
-
- Visio::IVCellPtr groupCell = page->GetCells(userGroupID);
-
- if(!groupCell)
- return false;
-
- std::wstring additionTemp = addition;
-
- for(int i=0; i<additionTemp.size(); i++)
- if(additionTemp[i] == 32)
- additionTemp[i] = '$';
-
- groupCell->FormulaU = stringize() << _T("=\"") << startIndex << _T(" ")
- << numberingType << _T(" ")
- << additionTemp << _T("\"");
- return true;
-}
-
-void CEnumerateUtils::selectGroup(Visio::IVApplicationPtr vsoApp, _bstr_t groupID)
-{
- 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];
- if(_tcsicmp(shape->Data1,_T("1")) == 0 && _tcsicmp(shape->Data3,groupID) == 0)
- selection->Select(shape,visSelect);
- }
-
- vsoApp->ActiveWindow->Selection = selection;
-}
-
-Visio::IVShapePtr CEnumerateUtils::getClosestMessage(Visio::IVApplicationPtr vsoApp, const Visio::IVShapePtr shapePtr, bool onlyNumbered)
-{
- Visio::IVShapesPtr shapes = vsoApp->ActivePage->Shapes;
- std::map<double, Visio::IVShapePtr> messages;
-
- double x = shapePtr->Cells["PinX"]->ResultIU;
- double y = shapePtr->Cells["PinY"]->ResultIU;
-
- for(int i=1; i<=shapes->Count; i++)
- {
- Visio::IVShapePtr shape = shapes->Item[i];
-
- if(shape == shapePtr)
- continue;
-
- if(_tcsicmp(shape->Data1,_T("1")) == 0 || !onlyNumbered)
- {
- double tempX = shape->Cells["PinX"]->ResultIU;
- double tempY = shape->Cells["PinY"]->ResultIU;
-
- double distance = sqrt(pow(x-tempX,2) + pow(y-tempY,2));
-
- messages.insert(std::pair<double, Visio::IVShapePtr>(distance, shape));
- }
- }
- if (!messages.size())
- return NULL;
-
- return messages.begin()->second;
-}
-
-int CEnumerateUtils::getGroupCount(Visio::IVApplicationPtr vsoApp)
-{
- Visio::IVShapePtr pagesheet = vsoApp->ActivePage->PageSheet;
-
- if(!pagesheet->GetCellExists(_T("User.EnumCount"),0))
- {
- pagesheet->AddNamedRow(visSectionUser,_T("EnumCount"),visTagDefault);
- pagesheet->Cells["User.EnumCount"]->FormulaU = _T("0");
- return 0;
- }
-
- return pagesheet->Cells["User.EnumCount"]->ResultInt[visNone][visTruncate];
-}
-
-void CEnumerateUtils::setGroupCount(Visio::IVApplicationPtr vsoApp, int count)
-{
- Visio::IVShapePtr pagesheet = vsoApp->ActivePage->PageSheet;
-
- if(!pagesheet->GetCellExists(_T("User.EnumCount"),0) && count != 0)
- {
- pagesheet->AddNamedRow(visSectionUser,_T("EnumCount"),visTagDefault);
- }
- else if(count == 0)
- {
- pagesheet->DeleteRow(visSectionUser,pagesheet->CellsRowIndex["User.EnumCount"]);
- return;
- }
-
- pagesheet->Cells["User.EnumCount"]->FormulaU = stringize() << count;
-}
-
-VAORC CEnumerateUtils::enableEnumeration(Visio::IVShapePtr shape, _bstr_t groupID, std::set<_bstr_t>& formerGroups)
-{
- if(_tcsicmp(shape->Data1,_T("")) == 0)
- {
- shape->Data1 = _T("1");
- shape->Data2 = shape->Text;
- shape->Data3 = groupID;
- shape->AddNamedRow(visSectionAction,_T("enumeration"),visTagDefault);
- shape->Cells["Actions.enumeration.Action"]->FormulaU = _T("=RUNADDONWARGS(\"Sequence Chart Studio\",\"/event=104\")");
- shape->Cells["Actions.enumeration.Menu"]->FormulaU = _T("=\"Select numbering group\"");
- shape->Cells["Actions.enumeration.BeginGroup"]->FormulaU = _T("=TRUE");
- }
- else if(_tcsicmp(shape->Data1,_T("1")) == 0)
- {
- formerGroups.insert(shape->Data3);
- shape->Data3 = groupID;
- }
- else
- {
- if(MessageBox(GetActiveWindow(),
- _T("Data fields (Format -> Special...) are not empty! Message enumeration use Data1, Data2 and Data3 for storing enumeration information. One or more shapes can't be numbered! Do you want to clear data fields (invalid shape lose its caption)?"),
- _T("Error"),MB_YESNO | MB_ICONWARNING))
- {
- shape->Data1 = _T("1");
- shape->Data2 = _T("");
- shape->Data3 = _T("");
- }
- else
- return VAORC_FAILURE;
- }
-
- return VAORC_SUCCESS;
-}
-
-VAORC CEnumerateUtils::disableEnumeration(Visio::IVShapePtr shape)
-{
-
- if(_tcsicmp(shape->Data1,_T("1")) == 0) //if the enumeration was enabled
- {
- shape->Text = shape->Data2;
- shape->Data1 = _T(""); //Clean the data fields
- shape->Data2 = _T("");
- shape->Data3 = _T("");
- shape->DeleteRow(visSectionAction,shape->GetCells(_T("Actions.enumeration"))->Row);
- }
- else if(_tcsicmp(shape->Data1,_T("")) != 0)
- {
- if(MessageBox(GetActiveWindow(),
- _T("Data1 field has wrong format. Message enumeration was corrupted! Do you want to delete data fields?"),
- _T("Error"),MB_YESNO | MB_ICONWARNING) == IDYES)
- {
- shape->Data1 = _T(""); //Clean the data fields
- shape->Data2 = _T("");
- shape->Data3 = _T("");
- }
- else
- return VAORC_FAILURE;
- }
-
- return VAORC_SUCCESS;
-}
+/*
+ * 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 Martin Bezdeka <mbe...@se...>
+ *
+ */
+
+#include "enumerateUtils.h"
+
+std::wstring CEnumerateUtils::int2Romans(int index)
+{
+ if(index < 0 || index > 3999)
+ {
+ MessageBox(GetActiveWindow(),
+ _T("Index too big! Use another type of enumeration. Roman index can be from 0-3999."),
+ _T("Error"),MB_OK | MB_ICONERROR);
+ return _T("?");
+ }
+
+ if(index == 0)
+ return _T("N");
+
+ int numeral[] = {1000, 900, 500, 400, 100,90, 50, 40, 10, 9, 5, 4, 1};
+ std::wstring romans[] = {L"M", L"CM", L"D", L"CD", L"C", L"XC", L"L", L"XL", L"X", L"IX", L"V", L"IV", L"I" };
+ std::wstring result;
+
+ for(int i=0; i < 13; i++)
+ while(index >=numeral[i])
+ {
+ index -= numeral[i];
+ result += romans[i];
+ }
+
+ return result;
+}
+
+std::wstring CEnumerateUtils::int2Char(int index, bool capitals)
+{
+ index--;
+
+ if(index < 0)
+ {
+ MessageBox(GetActiveWindow(),
+ _T("Index less than one! Char index can be from 1-inf."),
+ _T("Error"),MB_OK | MB_ICONERROR);
+ return _T("?");
+ }
+
+ std::wstring result;
+
+ if(index == 0)
+ return (capitals ? _T("A") : _T("a"));
+
+ bool bLast = true;
+
+ while(index > 0)
+ {
+ if(bLast)
+ {
+ result.insert(0,(capitals ? (stringize() << (char)((index % 26)+65)) : (stringize() << (char)((index % 26)+97))));
+ index = index / 26;
+
+ if(index/27 == 0)
+ bLast = false;
+ }
+ else
+ {
+ result.insert(0,(capitals ? (stringize() << (char)((index % 27)+64)) : (stringize() << (char)((index % 27)+96))));
+ index = index / 27;
+ }
+ }
+
+ return result;
+}
+
+bool CEnumerateUtils::messageCompare(Visio::IVShapePtr p1, Visio::IVShapePtr p2)
+{
+ double beginP1Y = p1->Cells["BeginY"]->ResultIU;
+ double beginP2Y = p2->Cells["BeginY"]->ResultIU;
+
+ if(beginP1Y - beginP2Y != 0.0)
+ return beginP1Y > beginP2Y;
+ else
+ {
+ double beginP1X = p1->Cells["BeginX"]->ResultIU;
+ double beginP2X = p2->Cells["BeginX"]->ResultIU;
+
+ if(beginP1X - beginP2X != 0.0)
+ return beginP1X < beginP2X;
+ else
+ {
+ double endP1X = p1->Cells["EndX"]->ResultIU;
+ double endP2X = p2->Cells["EndX"]->ResultIU;
+
+ return endP1X < endP2X;
+ }
+ }
+}
+
+bool CEnumerateUtils::loadGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int& startIndex, int& numberingType, std::wstring& addition)
+{
+ Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
+ if(!page->SectionExists[visSectionUser][0])
+ return false;
+
+ _bstr_t userGroupID = stringize() << _T("User.") << groupID;
+ Visio::IVCellPtr groupCell = page->GetCells(userGroupID);
+ if(!groupCell)
+ return false;
+
+ std::wstringstream ss(std::wstringstream::in | std::stringstream::out);
+ ss << groupCell->ResultStr[visNone];
+ ss >> startIndex >> numberingType >> addition;
+
+ //Get spaces in addition back
+ for(int i=0; i<addition.size(); i++)
+ if(addition[i] == '$')
+ addition[i] = ' ';
+
+ addition = addition + _T(" ");
+
+ return true;
+}
+
+bool CEnumerateUtils::saveGroupSettings(Visio::IVApplicationPtr vsoApp, _bstr_t groupID, int startIndex, int numberingType, BSTR addition)
+{
+ Visio::IVShapePtr page = vsoApp->ActivePage->PageSheet;
+
+ if(!page->SectionExists[visSectionUser][0])
+ page->AddSection(visSectionUser);
+
+ _bstr_t userGroupID = stringize() << _T("User.") << groupID;
+
+ if(page->GetCellExists(userGroupID,0) != -1)
+ page->AddNamedRow(visSectionUser, groupID, visTagDefault);
+
+ Visio::IVCellPtr groupCell = page->GetCells(userGroupID);
+
+ if(!groupCell)
+ return false;
+
+ std::wstring additionTemp = addition;
+
+ for(int i=0; i<additionTemp.size(); i++)
+ if(additionTemp[i] == 32)
+ additionTemp[i] = '$';
+
+ groupCell->FormulaU = stringize() << _T("=\"") << startIndex << _T(" ")
+ << numberingType << _T(" ")
+ << additionTemp << _T("\"");
+ return true;
+}
+
+void CEnumerateUtils::selectGroup(Visio::IVApplicationPtr vsoApp, _bstr_t groupID)
+{
+ 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];
+ if(_tcsicmp(shape->Data1,_T("1")) == 0 && _tcsicmp(shape->Data3,groupID) == 0)
+ selection->Select(shape,visSelect);
+ }
+
+ vsoApp->ActiveWindow->Selection = selection;
+}
+
+Visio::IVShapePtr CEnumerateUtils::getClosestMessage(Visio::IVApplicationPtr vsoApp, const Visio::IVShapePtr shapePtr, bool onlyNumbered)
+{
+ Visio::IVShapesPtr shapes = vsoApp->ActivePage->Shapes;
+ std::map<double, Visio::IVShapePtr> messages;
+
+ double x = shapePtr->Cells["PinX"]->ResultIU;
+ double y = shapePtr->Cells["PinY"]->ResultIU;
+
+ for(int i=1; i<=shapes->Count; i++)
+ {
+ Visio::IVShapePtr shape = shapes->Item[i];
+
+ if(shape == shapePtr)
+ continue;
+
+ if(_tcsicmp(shape->Data1,_T("1")) == 0 || !onlyNumbered)
+ {
+ double tempX = shape->Cells["PinX"]->ResultIU;
+ double tempY = shape->Cells["PinY"]->ResultIU;
+
+ double distance = sqrt(pow(x-tempX,2) + pow(y-tempY,2));
+
+ messages.insert(std::pair<double, Visio::IVShapePtr>(distance, shape));
+ }
+ }
+ if (!messages.size())
+ return NULL;
+
+ return messages.begin()->second;
+}
+
+int CEnumerateUtils::getGroupCount(Visio::IVApplicationPtr vsoApp)
+{
+ Visio::IVShapePtr pagesheet = vsoApp->ActivePage->PageSheet;
+
+ if(!pagesheet->GetCellExists(_T("User.EnumCount"),0))
+ {
+ pagesheet->AddNamedRow(visSectionUser,_T("EnumCount"),visTagDefault);
+ pagesheet->Cells["User.EnumCount"]->FormulaU = _T("0");
+ return 0;
+ }
+
+ return pagesheet->Cells["User.EnumCount"]->ResultInt[visNone][visTruncate];
+}
+
+void CEnumerateUtils::setGroupCount(Visio::IVApplicationPtr vsoApp, int count)
+{
+ Visio::IVShapePtr pagesheet = vsoApp->ActivePage->PageSheet;
+
+ if(!pagesheet->GetCellExists(_T("User.EnumCount"),0) && count != 0)
+ {
+ pagesheet->AddNamedRow(visSectionUser,_T("EnumCount"),visTagDefault);
+ }
+ else if(count == 0)
+ {
+ pagesheet->DeleteRow(visSectionUser,pagesheet->CellsRowIndex["User.EnumCount"]);
+ return;
+ }
+
+ pagesheet->Cells["User.EnumCount"]->FormulaU = stringize() << count;
+}
+
+VAORC CEnumerateUtils::enableEnumeration(Visio::IVShapePtr shape, _bstr_t groupID, std::set<_bstr_t>& formerGroups)
+{
+ if(_tcsicmp(shape->Data1,_T("")) == 0)
+ {
+ shape->Data1 = _T("1");
+ shape->Data2 = shape->Text;
+ shape->Data3 = groupID;
+ shape->AddNamedRow(visSectionAction,_T("enumeration"),visTagDefault);
+ shape->Cells["Actions.enumeration.Action"]->FormulaU = _T("=RUNADDONWARGS(\"Sequence Chart Studio\",\"/event=104\")");
+ shape->Cells["Actions.enumeration.Menu"]->FormulaU = _T("=\"Select numbering group\"");
+ shape->Cells["Actions.enumeration.BeginGroup"]->FormulaU = _T("=TRUE");
+ }
+ else if(_tcsicmp(shape->Data1,_T("1")) == 0)
+ {
+ formerGroups.insert(shape->Data3);
+ shape->Data3 = groupID;
+ }
+ else
+ {
+ if(MessageBox(GetActiveWindow(),
+ _T("Data fields (Format -> Special...) are not empty! Message enumeration use Data1, Data2 and Data3 for storing enumeration information. One or more shapes can't be numbered! Do you want to clear data fields (invalid shape lose its caption)?"),
+ _T("Error"),MB_YESNO | MB_ICONWARNING))
+ {
+ shape->Data1 = _T("1");
+ shape->Data2 = _T("");
+ shape->Data3 = _T("");
+ }
+ else
+ return VAORC_FAILURE;
+ }
+
+ return VAORC_SUCCESS;
+}
+
+VAORC CEnumerateUtils::disableEnumeration(Visio::IVShapePtr shape)
+{
+
+ if(_tcsicmp(shape->Data1,_T("1")) == 0) //if the enumeration was enabled
+ {
+ shape->Text = shape->Data2;
+ shape->Data1 = _T(""); //Clean the data fields
+ shape->Data2 = _T("");
+ shape->Data3 = _T("");
+ shape->DeleteRow(visSectionAction,shape->GetCells(_T("Actions.enumeration"))->Row);
+ }
+ else if(_tcsicmp(shape->Data1,_T("")) != 0)
+ {
+ if(MessageBox(GetActiveWindow(),
+ _T("Data1 field has wrong format. Message enumeration was corrupted! Do you want to delete data fields?"),
+ _T("Error"),MB_YESNO | MB_ICONWARNING) == IDYES)
+ {
+ shape->Data1 = _T(""); //Clean the data fields
+ shape->Data2 = _T("");
+ shape->Data3 = _T("");
+ }
+ else
+ return VAORC_FAILURE;
+ }
+
+ return VAORC_SUCCESS;
+}
Property changes on: trunk/src/view/visio/addon/enumerateUtils.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/enumerateUtils.h
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.h 2010-05-16 ...
[truncated message content] |
|
From: <got...@us...> - 2010-05-23 15:50:55
|
Revision: 806
http://scstudio.svn.sourceforge.net/scstudio/?rev=806&view=rev
Author: gotthardp
Date: 2010-05-23 15:50:48 +0000 (Sun, 23 May 2010)
Log Message:
-----------
Fixed compiler warnings.
Modified Paths:
--------------
trunk/src/view/visio/addon/enumerateUtils.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
Modified: trunk/src/view/visio/addon/enumerateUtils.cpp
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.cpp 2010-05-23 15:30:36 UTC (rev 805)
+++ trunk/src/view/visio/addon/enumerateUtils.cpp 2010-05-23 15:50:48 UTC (rev 806)
@@ -123,7 +123,7 @@
ss >> startIndex >> numberingType >> addition;
//Get spaces in addition back
- for(int i=0; i<addition.size(); i++)
+ for(size_t i=0; i<addition.size(); i++)
if(addition[i] == '$')
addition[i] = ' ';
@@ -151,7 +151,7 @@
std::wstring additionTemp = addition;
- for(int i=0; i<additionTemp.size(); i++)
+ for(size_t i=0; i<additionTemp.size(); i++)
if(additionTemp[i] == 32)
additionTemp[i] = '$';
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-05-23 15:30:36 UTC (rev 805)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-05-23 15:50:48 UTC (rev 806)
@@ -91,7 +91,7 @@
LRESULT CNumberingGlobalDlg::OnBnClickedEnumCheck(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
- EnableControls(m_enumCheck.GetCheck());
+ EnableControls(m_enumCheck.GetCheck() == BST_CHECKED);
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-03 20:30:31
|
Revision: 823
http://scstudio.svn.sourceforge.net/scstudio/?rev=823&view=rev
Author: mbezdeka
Date: 2010-07-03 20:30:23 +0000 (Sat, 03 Jul 2010)
Log Message:
-----------
Message numbering: - global settings dialog addded
Modified Paths:
--------------
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/enumerateUtils.cpp
trunk/src/view/visio/addon/enumerateUtils.h
trunk/src/view/visio/addon/enumerationDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.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/globalSettingsDlg.cpp
trunk/src/view/visio/addon/globalSettingsDlg.h
Removed Paths:
-------------
trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
trunk/src/view/visio/addon/GlobalSettingsDlg.h
Deleted: trunk/src/view/visio/addon/GlobalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/GlobalSettingsDlg.cpp 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/GlobalSettingsDlg.cpp 2010-07-03 20:30:23 UTC (rev 823)
@@ -1,124 +0,0 @@
-/*
- * 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 Martin Bezdeka <mbe...@se...>
- *
- */
-#include "stdafx.h"
-#include "dllmodule.h"
-#include "GlobalSettingsDlg.h"
-
-
-
-CTabCtrlMSC::CTabCtrlMSC()
-{
- dialogs[0] = new CNumberingGlobalDlg;
-
- m_nNumberOfPages = 1;
-}
-
-CTabCtrlMSC::~CTabCtrlMSC()
-{
- for(int i=0; i<m_nNumberOfPages; i++)
- delete dialogs[i];
-}
-
-void CTabCtrlMSC::Init()
-{
- m_tabCurrent = 0;
- dialogs[0]->Create(this->m_hWnd,NULL);
- dialogs[0]->ShowWindow(SW_SHOW);
-
- SetRectangle();
-}
-
-void CTabCtrlMSC::SetRectangle()
-{
- RECT tabRect, itemRect;
- int nX, nY, nXc, nYc;
-
- GetClientRect(&tabRect);
- GetItemRect(0, &itemRect);
-
- nX=itemRect.left;
- nY=itemRect.bottom+2;
- nXc=tabRect.right-itemRect.left-3;
- nYc=tabRect.bottom-nY-3;
-
- dialogs[0]->SetWindowPos(HWND_TOP, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
- //hiding other windows
- for(int i=1; i < m_nNumberOfPages; i++)
- {
- dialogs[i]->SetWindowPos(HWND_TOP, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CMyTabCtrl message handlers
-
-LRESULT CTabCtrlMSC::OnLButtonDown(UINT nFlags, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
-{
- //not implemented yet!
-
- /*CTabCtrl::OnLButtonDown(nFlags, point);
-
- if(m_tabCurrent != this->GetCurFocus() != 0)
- {
- dialogs[0]->ShowWindow(SW_HIDE);
- }*/
-
- return 0;
-}
-
-//////////////////////////////
-// GLOBAL SETTINGS DIALOG
-
-LRESULT CGlobalSettingsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
- CenterWindow(GetParent());
-
- DoDataExchange();
- LoadRegistryData();
-
-
- return bHandled = FALSE;
-}
-
-LRESULT CGlobalSettingsDlg::OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
-{
- if(wID == IDOK)
- {
- DoDataExchange(TRUE);
- if(SaveRegistryData() == 0)
- EndDialog(wID);
- }
- else if(wID == IDCANCEL)
- EndDialog(wID);
-
- return 0;
-}
-
-int CGlobalSettingsDlg::LoadRegistryData()
-{
- m_tabSettings.AddItem(_T("Numbering"));
- m_tabSettings.Init();
-
- DoDataExchange();
-
- return 0;
-}
-
-int CGlobalSettingsDlg::SaveRegistryData()
-{
- return 0;
-}
Deleted: trunk/src/view/visio/addon/GlobalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/GlobalSettingsDlg.h 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/GlobalSettingsDlg.h 2010-07-03 20:30:23 UTC (rev 823)
@@ -1,83 +0,0 @@
-/*
- * 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 Martin Bezdeka <mbe...@se...>
- *
- */
-
-#pragma once
-
-#include <atldlgs.h>
-#include <atlctrls.h>
-#include <atlddx.h>
-#include <string>
-#include <sstream>
-#include "data/msc.h"
-#include "GlobalSettingsDlg.h"
-#include "numberingGlobalDlg.h"
-
-class CTabCtrlMSC : public ATL::CWindowImpl<CTabCtrlMSC, CTabCtrl>
-{
-// Construction
-public:
- CTabCtrlMSC();
- virtual ~CTabCtrlMSC();
-
- int m_tabCurrent;
- int m_nNumberOfPages;
- //Add your specific dialog on the tab
- CNumberingGlobalDlg* dialogs[1];
-
- void Init();
- void SetRectangle();
-
-protected:
- BEGIN_MSG_MAP(CTabCtrlMSC)
- MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
- END_MSG_MAP()
-
- LRESULT OnLButtonDown(UINT, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
-};
-
-/////////////////////////////////////
-// GLOBAL SETTINGS DIALOG
-
-class CGlobalSettingsDlg
- : public ATL::CDialogImpl<CGlobalSettingsDlg>, public CWinDataExchange<CGlobalSettingsDlg>
-{
-public:
- //CGlobalSettingsDlg();
- enum { IDD = IDD_GLOBAL_SETTINGS };
-
- CTabCtrlMSC m_tabSettings;
-
-protected:
-BEGIN_DDX_MAP(CGlobalSettingsDlg)
- DDX_CONTROL(IDC_TAB_SETTINGS, m_tabSettings);
-END_DDX_MAP()
-
-BEGIN_MSG_MAP(CGlobalSettingsDlg)
- MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
- COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
- COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
-END_MSG_MAP()
-
-// Handler prototypes:
-
- LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
- LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
-
- int LoadRegistryData();
- int SaveRegistryData();
-
-};
\ No newline at end of file
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-03 20:30:23 UTC (rev 823)
@@ -204,22 +204,12 @@
LTEXT "Starting index:",IDC_STATIC,11,39,50,8,SS_CENTERIMAGE
END
-IDD_GLOBAL_SETTINGS DIALOGEX 0, 0, 311, 202
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Settings"
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,200,180,50,15
- PUSHBUTTON "Cancel",IDCANCEL,254,180,50,15
- CONTROL "",IDC_TAB_SETTINGS,"SysTabControl32",0x0,7,7,297,170
-END
-
IDD_NUMBERING_GLOBAL DIALOGEX 0, 0, 289, 134
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
EXSTYLE WS_EX_TRANSPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- GROUPBOX "",IDC_STATIC,7,7,275,119
+ GROUPBOX "",IDC_STATIC,7,7,275,120
CONTROL "automatic numbering new messages",IDC_ENUM_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,6,128,10
CONTROL "as nearest message",IDC_NEAREST_MSG,"Button",BS_AUTORADIOBUTTON,24,26,80,10
CONTROL "as nearest numbered message",IDC_NEAREST_NUMBERED_MSG,
@@ -291,17 +281,6 @@
BOTTOMMARGIN, 56
END
- IDD_GLOBAL_SETTINGS, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 304
- VERTGUIDE, 200
- TOPMARGIN, 7
- BOTTOMMARGIN, 195
- HORZGUIDE, 177
- HORZGUIDE, 180
- END
-
IDD_NUMBERING_GLOBAL, DIALOG
BEGIN
LEFTMARGIN, 7
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-03 20:30:23 UTC (rev 823)
@@ -260,19 +260,7 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
- {
- std::set<_bstr_t> groups;
- Visio::IVSelectionPtr selection = m_vsoApp->ActiveWindow->Selection;
- for(int i=1; i<=selection->Count; i++)
- {
- Visio::IVShapePtr shape = selection->Item[i];
- if(isMessageShape(shape) && (_tcsicmp(shape->Data3,_T("")) != 0))
- groups.insert(shape->Data3);
- }
-
- for(std::set<_bstr_t>::iterator it = groups.begin(); it != groups.end(); it++)
- drawNumbers(m_vsoApp->ActivePage->Shapes,*it);
- }
+ autoEnumerate(vsoShape);
break;
case ST_COMMENT:
@@ -509,11 +497,11 @@
itemCheckOptions->AddOnArgs = stringize() << L"/event=" << MENU_CHECK_OPTIONS;
//TODO: Dialog for message numbering global settings
- //Visio::IVMenuItemPtr globalSettings = itemDrawing->MenuItems->Add();
- //globalSettings->Caption = "&Settings...";
- //globalSettings->AddOnName = ADDON_NAME;
- //globalSettings->BeginGroup = true;
- //globalSettings->AddOnArgs = stringize() << L"/event=" << MENU_GLOBAL_SETTINGS;
+ Visio::IVMenuItemPtr globalSettings = itemDrawing->MenuItems->Add();
+ globalSettings->Caption = "&Settings...";
+ globalSettings->AddOnName = ADDON_NAME;
+ globalSettings->BeginGroup = true;
+ globalSettings->AddOnArgs = stringize() << L"/event=" << MENU_GLOBAL_SETTINGS;
// step 2: create accelerators
// note: the accelerators must be created in this custom menu set
@@ -1489,29 +1477,50 @@
void CDocumentMonitor::autoEnumerate(Visio::IVShapePtr msgShape)
{
- Visio::IVShapePtr pageSheet = msgShape->Application->ActivePage->PageSheet;
- Visio::IVShapePtr closestMsg;
+ Visio::IVSelectionPtr selection = m_vsoApp->ActiveWindow->Selection;
- int autoEnum1 = pageSheet->Cells["User.AutoEnum1"]->ResultInt[visNone][visTruncate];
-
- switch(autoEnum1)
- {
- case 0:
- closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,false);
- if(closestMsg)
- if(_tcsicmp(closestMsg->Data3,_T("")) != 0)
- enumerate(msgShape->Application,closestMsg->Data3,true,true);
- break;
- case 1:
- closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,true);
- if(closestMsg)
- enumerate(msgShape->Application,closestMsg->Data3,true,true);
- break;
+ if(selection->Count == 1 && _tcsicmp(msgShape->Data1,_T("")) == 0)
+ {
+ MessageBox(GetActiveWindow(),_T("No selection"),_T(""),MB_OK);
+ }
+ else
+ {
+ std::set<_bstr_t> groups;
+ //Collect all groups in current selection
+ for(int i=1; i<=selection->Count; i++)
+ {
+ Visio::IVShapePtr shape = selection->Item[i];
+ if(isMessageShape(shape) && (_tcsicmp(shape->Data3,_T("")) != 0))
+ groups.insert(shape->Data3);
+ }
+ //Re-number groups
+ for(std::set<_bstr_t>::iterator it = groups.begin(); it != groups.end(); it++)
+ drawNumbers(m_vsoApp->ActivePage->Shapes,*it);
+ }
- default:
- enumerate(msgShape->Application,msgShape->Data3,false,true);
- break;
- }
+ //Visio::IVShapePtr pageSheet = msgShape->Application->ActivePage->PageSheet;
+ //Visio::IVShapePtr closestMsg;
+
+ //int autoEnum1 = pageSheet->Cells["User.AutoEnum1"]->ResultInt[visNone][visTruncate];
+ //
+ //switch(autoEnum1)
+ //{
+ // case 0:
+ // closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,false);
+ // if(closestMsg)
+ // if(_tcsicmp(closestMsg->Data3,_T("")) != 0)
+ // enumerate(msgShape->Application,closestMsg->Data3,true,true);
+ // break;
+ // case 1:
+ // closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,true);
+ // if(closestMsg)
+ // enumerate(msgShape->Application,closestMsg->Data3,true,true);
+ // break;
+
+ // default:
+ // enumerate(msgShape->Application,msgShape->Data3,false,true);
+ // break;
+ //}
}
VAORC CDocumentMonitor::OnMenuSelectNumberedGroup(Visio::IVApplicationPtr vsoApp)
@@ -1662,10 +1671,9 @@
VAORC CDocumentMonitor::OnMenuGlobalSettings(Visio::IVApplicationPtr vsoApp)
{
- CGlobalSettingsDlg dlg;
- if(dlg.DoModal() != IDOK)
- return VAORC_FAILURE;
-
+ CGlobalSettingsDlg sheet(_T("Settings"));
+ sheet.DoModal();
+
return VAORC_SUCCESS;
}
Modified: trunk/src/view/visio/addon/enumerateUtils.cpp
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.cpp 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/enumerateUtils.cpp 2010-07-03 20:30:23 UTC (rev 823)
@@ -299,3 +299,12 @@
return VAORC_SUCCESS;
}
+
+void CEnumerateUtils::fillComboWithTypes(WTL::CComboBox& combo)
+{
+ combo.InsertString(0,_T("1, 2, 3,..."));
+ combo.InsertString(1,_T("I, II, III,..."));
+ combo.InsertString(2,_T("a, b, c,..."));
+ combo.InsertString(3,_T("A, B, C,..."));
+}
+
Modified: trunk/src/view/visio/addon/enumerateUtils.h
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.h 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/enumerateUtils.h 2010-07-03 20:30:23 UTC (rev 823)
@@ -49,4 +49,5 @@
static void setGroupCount(Visio::IVApplicationPtr vsoApp, int count);
static VAORC disableEnumeration(Visio::IVShapePtr shape);
static VAORC enableEnumeration(Visio::IVShapePtr shape, _bstr_t groupID, std::set<_bstr_t>& formerGroups);
+ static void fillComboWithTypes(WTL::CComboBox& combo);
};
Modified: trunk/src/view/visio/addon/enumerationDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/enumerationDlg.cpp 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/enumerationDlg.cpp 2010-07-03 20:30:23 UTC (rev 823)
@@ -18,6 +18,7 @@
#include "stdafx.h"
#include "dllmodule.h"
#include "enumerationDlg.h"
+#include "enumerateUtils.h"
CEnumerationDlg::CEnumerationDlg(int startIndex, int enumType, BSTR addition)
{
@@ -53,10 +54,7 @@
int CEnumerationDlg::LoadRegistryData()
{
- m_numbering.InsertString(0,_T("1, 2, 3,..."));
- m_numbering.InsertString(1,_T("I, II, III,..."));
- m_numbering.InsertString(2,_T("a, b, c,..."));
- m_numbering.InsertString(3,_T("A, B, C,..."));
+ CEnumerateUtils::fillComboWithTypes(m_numbering);
m_numbering.SetCurSel(this->numberingType);
m_addition.SetWindowText(addition);
Added: trunk/src/view/visio/addon/globalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.cpp (rev 0)
+++ trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-07-03 20:30:23 UTC (rev 823)
@@ -0,0 +1,44 @@
+/*
+ * 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 Martin Bezdeka <mbe...@se...>
+ *
+ */
+
+#include "stdafx.h"
+#include "dllmodule.h"
+#include "GlobalSettingsDlg.h"
+
+CGlobalSettingsDlg::CGlobalSettingsDlg(ATL::_U_STRINGorID title,UINT uStartPage, HWND hWndParent):
+CPropertySheetImpl<CGlobalSettingsDlg>(title,uStartPage,hWndParent)
+{
+ m_bCentered = false;
+
+ //Disable APPLY button and CONTEXT HELP button
+ m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
+
+ //Adding pages
+ page1.SetTitle(_T("Numbering")); AddPage(page1);
+}
+
+
+void CGlobalSettingsDlg::OnShowWindow(BOOL bShowing, int nReason)
+{
+ if(bShowing && !m_bCentered)
+ {
+ m_bCentered = true;
+ CenterWindow(m_psh.hwndParent);
+ }
+}
+
+
Property changes on: trunk/src/view/visio/addon/globalSettingsDlg.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/globalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.h (rev 0)
+++ trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-03 20:30:23 UTC (rev 823)
@@ -0,0 +1,45 @@
+/*
+ * 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 Martin Bezdeka <mbe...@se...>
+ *
+ */
+
+#pragma once
+
+#include <atldlgs.h>
+#include <atlctrls.h>
+#include <atlddx.h>
+#include "numberingGlobalDlg.h"
+
+class CGlobalSettingsDlg : public CPropertySheetImpl<CGlobalSettingsDlg>
+{
+public:
+ CGlobalSettingsDlg(ATL::_U_STRINGorID title = (LPCTSTR) NULL,
+ UINT uStartPage = 0, HWND hWndParent = NULL);
+
+BEGIN_MSG_MAP(CGlobalSettingsDlg)
+ MSG_WM_SHOWWINDOW(OnShowWindow)
+ CHAIN_MSG_MAP(CPropertySheetImpl<CGlobalSettingsDlg>)
+END_MSG_MAP()
+
+ //Message handlers
+ void OnShowWindow(BOOL bShowing, int nReason);
+
+protected:
+ bool m_bCentered;
+
+ //Pages of property sheet
+ CNumberingGlobalDlg page1;
+ CPropertyPage<IDD_CHECK_OPTIONS> page2;
+};
Property changes on: trunk/src/view/visio/addon/globalSettingsDlg.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-03 20:30:23 UTC (rev 823)
@@ -18,72 +18,127 @@
#include "stdafx.h"
#include "dllmodule.h"
#include "numberingGlobalDlg.h"
+#include "enumerateUtils.h"
-
-LRESULT CNumberingGlobalDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+BOOL CNumberingGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
{
- CenterWindow(GetParent());
+ m_bAutoEnum = GetRegistry<bool>(GetRegistryFolder(), NULL, _T("AutoEnum"), 0);
+ DoDataExchange(FALSE); //update data from variables to fields
- DoDataExchange();
- LoadRegistryData();
-
- return bHandled = FALSE;
-}
+ CEnumerateUtils::fillComboWithTypes(m_numberingTypeCombo);
+ m_addition.SetLimitText(4);
-LRESULT CNumberingGlobalDlg::OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
-{
- if(wID == IDOK)
+ //Number according to nearest msg OR nearest numbered msg
+ if(GetRegistry<bool>(GetRegistryFolder(), NULL, _T("AutoEnumType"), 0))
+ m_nearestNumberedMsg.SetCheck(BST_CHECKED);
+ else
{
- DoDataExchange(TRUE);
- if(SaveRegistryData() == 0)
- EndDialog(wID);
+ m_nearestMsg.SetCheck(BST_CHECKED);
+ EnableNearestNumberedMsgControls(false);
}
- else if(wID == IDCANCEL)
- EndDialog(wID);
- SaveRegistryData();
+ //don't number OR use numbering style
+ if(GetRegistry<bool>(GetRegistryFolder(), NULL, _T("AutoEnumStyleEnabled"), 0))
+ m_useNumberingStyle.SetCheck(BST_CHECKED);
+ else
+ m_dontNumber.SetCheck(BST_CHECKED);
- return 0;
-}
+ //Numbering type
+ m_numberingTypeCombo.SetCurSel(GetRegistry<int>(GetRegistryFolder(), NULL, _T("AutoEnumStyleNumType"), 0));
+ //Numbering index
+ std::wstring strIndex = stringize() << GetRegistry<int>(GetRegistryFolder(), NULL, _T("AutoEnumStyleIndex"), 1);
+ m_index.SetWindowText(strIndex.c_str());
+
+ //Addition string
+ HKEY hKey;
+ if(RegCreateKey(HKEY_CURRENT_USER, GetRegistryFolder(),&hKey) != ERROR_SUCCESS)
+ {
+ MessageBox(_T("Failed load key for addition string!"));
+ return FALSE;
+ }
-int CNumberingGlobalDlg::LoadRegistryData()
-{
- if(!m_enumCheck.GetCheck())
- EnableControls(false);
-
- m_numberingTypeCombo.InsertString(0,_T("1, 2, 3,..."));
- m_numberingTypeCombo.InsertString(1,_T("I, II, III,..."));
- m_numberingTypeCombo.InsertString(2,_T("a, b, c,..."));
- m_numberingTypeCombo.InsertString(3,_T("A, B, C,..."));
- m_numberingTypeCombo.SetCurSel(0); //Change to loaded settings
-
+ DWORD dwType = 0;
+ wchar_t buffer[5] = {0};
+ DWORD dwSize = sizeof(buffer);
+ if(RegQueryValueEx(hKey,_T("AutoEnumStyleAddition"),0,&dwType, (LPBYTE)buffer, &dwSize) == ERROR_SUCCESS)
+ m_addition.SetWindowText(_bstr_t(buffer));
+ else
m_addition.SetWindowText(_T(". "));
- m_index.SetWindowText(_T("1"));
+
+ RegCloseKey(hKey);
- m_nearestMsg.SetCheck(1);
- m_dontNumber.SetCheck(1);
+ //Decide whether enable controls
+ EnableAllControls(m_bAutoEnum);
- return 0;
+ return TRUE;
}
-int CNumberingGlobalDlg::SaveRegistryData()
+int CNumberingGlobalDlg::OnApply()
{
- //if(getAutoEnumEnabled() == 1)
- //{
- SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum1"), getAutoEnum1Type());
- SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum2"), getAutoEnum2Type());
- MessageBox(_T("Done!"));
- //}
+ BOOL bResult = DoDataExchange(true);
- return 0;
+ BSTR temp = 0;
+ int index;
+ m_index.GetWindowText(temp);
+ std::wstringstream ss(std::wstringstream::in | std::stringstream::out);
+ ss << _bstr_t(temp);
+ ss >> index;
+
+ if(index <= 0 || index > 9999)
+ {
+ MessageBox(_T("Starting index must be in range of 1-9999!"), _T("Error"), MB_OK | MB_ICONERROR);
+ return PSNRET_INVALID;
+ }
+ if(index > 3999 && m_numberingTypeCombo.GetCurSel() == 1)
+ {
+ MessageBox(_T("Index too big! Use another type of enumeration. Roman index can be from 0-3999."),
+ _T("Error"),MB_OK | MB_ICONERROR);
+ return PSNRET_INVALID;
+ }
+
+ if(bResult)
+ {
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnum"), m_bAutoEnum);
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumType"),m_nearestNumberedMsg.GetCheck() == BST_CHECKED);
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleEnabled"),m_useNumberingStyle.GetCheck() == BST_CHECKED);
+ SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleNumType"),m_numberingTypeCombo.GetCurSel());
+ SetRegistry<int>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("AutoEnumStyleIndex"),index);
+
+ //Store addition string
+ m_addition.GetWindowTextW(temp);
+ if(!temp) temp = _T("");
+ HKEY hKey;
+ if(RegCreateKey(HKEY_CURRENT_USER, GetRegistryFolder(), &hKey) != ERROR_SUCCESS)
+ MessageBox(_T("Failed to create key for addition string!"));
+ else if(RegSetValueEx(hKey,_T("AutoEnumStyleAddition"),0, REG_SZ, (CONST LPBYTE)temp, 2*sizeof(BSTR)) != ERROR_SUCCESS)
+ MessageBox(_T("Failed to set registry key for addition string!"));
+ RegCloseKey(hKey);
+
+ return PSNRET_NOERROR;
+ }
+
+ return PSNRET_INVALID;
}
-
-void CNumberingGlobalDlg::EnableControls(bool bEnable)
+void CNumberingGlobalDlg::EnableAllControls(bool bEnable)
{
m_nearestMsg.EnableWindow(bEnable);
m_nearestNumberedMsg.EnableWindow(bEnable);
+ if(!bEnable || m_nearestNumberedMsg.GetCheck() == BST_CHECKED)
+ EnableNearestNumberedMsgControls(bEnable);
+}
+
+void CNumberingGlobalDlg::EnableNearestNumberedMsgControls(bool bEnable)
+{
m_dontNumber.EnableWindow(bEnable);
m_useNumberingStyle.EnableWindow(bEnable);
+ if(!bEnable || m_dontNumber.GetCheck() != BST_CHECKED)
+ EnableNumberingStyleControls(bEnable);
+ else
+ EnableNumberingStyleControls(!bEnable);
+}
+
+void CNumberingGlobalDlg::EnableNumberingStyleControls(bool bEnable)
+{
m_numberingTypeCombo.EnableWindow(bEnable);
m_addition.EnableWindow(bEnable);
m_index.EnableWindow(bEnable);
@@ -91,7 +146,32 @@
LRESULT CNumberingGlobalDlg::OnBnClickedEnumCheck(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
- EnableControls(m_enumCheck.GetCheck() == BST_CHECKED);
+ DoDataExchange(TRUE);
+ EnableAllControls(m_bAutoEnum);
return 0;
}
+
+LRESULT CNumberingGlobalDlg::OnBnClickedNearestMsg(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ EnableNearestNumberedMsgControls(false);
+ return 0;
+}
+
+LRESULT CNumberingGlobalDlg::OnBnClickedNearestNumberedMsg(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ EnableNearestNumberedMsgControls(true);
+ return 0;
+}
+
+LRESULT CNumberingGlobalDlg::OnBnClickedDontNumber(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ EnableNumberingStyleControls(false);
+ return 0;
+}
+
+LRESULT CNumberingGlobalDlg::OnBnClickedUseNumberingStyle(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ EnableNumberingStyleControls(true);
+ return 0;
+}
\ No newline at end of file
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-07-03 20:30:23 UTC (rev 823)
@@ -20,29 +20,32 @@
#include <atldlgs.h>
#include <atlctrls.h>
#include <atlddx.h>
+#include <atlcrack.h>
+#include <atlmisc.h>
#include <string>
#include <sstream>
#include "data/msc.h"
-#include "enumerateUtils.h"
-class CNumberingGlobalDlg
- : public ATL::CDialogImpl<CNumberingGlobalDlg>, public CWinDataExchange<CNumberingGlobalDlg>
+class CNumberingGlobalDlg:
+ public CPropertyPageImpl<CNumberingGlobalDlg>,
+ public CWinDataExchange<CNumberingGlobalDlg>
{
public:
enum { IDD = IDD_NUMBERING_GLOBAL };
- CButton m_enumCheck;
- CButton m_nearestMsg;
- CButton m_nearestNumberedMsg;
- CButton m_dontNumber;
- CButton m_useNumberingStyle;
- CComboBox m_numberingTypeCombo;
- CEdit m_addition;
- CEdit m_index;
+BEGIN_MSG_MAP(CNumberingGlobalDlg)
+ MSG_WM_INITDIALOG(OnInitDialog)
+ CHAIN_MSG_MAP(CPropertyPageImpl<CNumberingGlobalDlg>)
+ COMMAND_HANDLER(IDC_ENUM_CHECK, BN_CLICKED, OnBnClickedEnumCheck)
+ COMMAND_HANDLER(IDC_NEAREST_MSG,BN_CLICKED, OnBnClickedNearestMsg)
+ COMMAND_HANDLER(IDC_NEAREST_NUMBERED_MSG,BN_CLICKED, OnBnClickedNearestNumberedMsg)
+ COMMAND_HANDLER(IDC_DONT_NUMBER,BN_CLICKED, OnBnClickedDontNumber)
+ COMMAND_HANDLER(IDC_USE_NUMBERING_STYLE,BN_CLICKED, OnBnClickedUseNumberingStyle)
+END_MSG_MAP()
-protected:
+
BEGIN_DDX_MAP(CNumberingGlobalDlg)
- DDX_CONTROL_HANDLE(IDC_ENUM_CHECK, m_enumCheck);
+ DDX_CHECK(IDC_ENUM_CHECK,m_bAutoEnum);
DDX_CONTROL_HANDLE(IDC_NEAREST_MSG, m_nearestMsg);
DDX_CONTROL_HANDLE(IDC_NEAREST_NUMBERED_MSG, m_nearestNumberedMsg);
DDX_CONTROL_HANDLE(IDC_DONT_NUMBER, m_dontNumber);
@@ -52,29 +55,35 @@
DDX_CONTROL_HANDLE(IDC_STARTING_INDEX_GLOBAL, m_index);
END_DDX_MAP()
-BEGIN_MSG_MAP(CNumberingGlobalDlg)
- MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
- COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
- COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
- COMMAND_HANDLER(IDC_ENUM_CHECK, BN_CLICKED, OnBnClickedEnumCheck)
-END_MSG_MAP()
+protected:
-// Handler prototypes:
+ CButton m_nearestMsg;
+ CButton m_nearestNumberedMsg;
+ CButton m_dontNumber;
+ CButton m_useNumberingStyle;
+ CComboBox m_numberingTypeCombo;
+ CEdit m_addition;
+ CEdit m_index;
- LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
- LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+ bool m_bAutoEnum;
- int LoadRegistryData();
- int SaveRegistryData();
- void EnableControls(bool bEnable = true);
+ LRESULT OnBnClickedEnumCheck(WORD, WORD, HWND, BOOL&);
+ LRESULT OnBnClickedNearestMsg(WORD, WORD, HWND, BOOL&);
+ LRESULT OnBnClickedNearestNumberedMsg(WORD, WORD, HWND, BOOL&);
+ LRESULT OnBnClickedDontNumber(WORD, WORD, HWND, BOOL&);
+ LRESULT OnBnClickedUseNumberingStyle(WORD, WORD, HWND, BOOL&);
+
+ void EnableAllControls(bool bEnable);
+ void EnableNearestNumberedMsgControls(bool bEnable);
+ void EnableNumberingStyleControls(bool bEnable);
- const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageNumbering"); }
-
public:
+ //Message handlers
+ BOOL OnInitDialog(HWND hWndFocus, LPARAM lParam);
- int getAutoEnumEnabled() { return m_enumCheck.GetCheck(); };
- int getAutoEnum1Type() { return ((m_nearestMsg.GetCheck() == 0) ? 1 : 0); };
- int getAutoEnum2Type() { return ((m_dontNumber.GetCheck() == 0) ? 1 : 0); };
+ //Property page notification handlers (override method)
+ int OnApply();
- LRESULT OnBnClickedEnumCheck(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
+ //Other functions
+ const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageNumbering"); }
};
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-07-02 13:57:06 UTC (rev 822)
+++ trunk/src/view/visio/addon/resource.h 2010-07-03 20:30:23 UTC (rev 823)
@@ -40,7 +40,6 @@
#define IDC_IF_START_POS_X 223
#define IDI_ICON_DISABLE_MESSAGE_ENUMERATION 223
#define IDI_MESSAGE_NUMBERING_DISABLE 224
-#define IDD_GLOBAL_SETTINGS 224
#define IDD_NUMBERING_GLOBAL 225
#define IDC_OPTIONS_SWITCH_BTN 226
#define IDC_OPTIONS_SWITCH_LBL 227
@@ -83,7 +82,6 @@
#define IDC_IF_UNITS1 262
#define...
[truncated message content] |
|
From: <mbe...@us...> - 2010-07-04 14:03:06
|
Revision: 825
http://scstudio.svn.sourceforge.net/scstudio/?rev=825&view=rev
Author: mbezdeka
Date: 2010-07-04 14:02:59 +0000 (Sun, 04 Jul 2010)
Log Message:
-----------
added missing file properties (Id)
message numbering - added functionality to global settings dialog
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/enumerateUtils.cpp
trunk/src/view/visio/addon/enumerateUtils.h
trunk/src/view/visio/addon/globalSettingsDlg.cpp
trunk/src/view/visio/addon/globalSettingsDlg.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.h
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-03 21:04:32 UTC (rev 824)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-04 14:02:59 UTC (rev 825)
@@ -1477,50 +1477,36 @@
void CDocumentMonitor::autoEnumerate(Visio::IVShapePtr msgShape)
{
+ const TCHAR* regFolder = _T("Software\\Sequence Chart Studio\\MessageNumbering");
Visio::IVSelectionPtr selection = m_vsoApp->ActiveWindow->Selection;
if(selection->Count == 1 && _tcsicmp(msgShape->Data1,_T("")) == 0)
{
- //MessageBox(GetActiveWindow(),_T("No selection"),_T(""),MB_OK);
- }
- else
- {
- std::set<_bstr_t> groups;
- //Collect all groups in current selection
- for(int i=1; i<=selection->Count; i++)
- {
- Visio::IVShapePtr shape = selection->Item[i];
- if(isMessageShape(shape) && (_tcsicmp(shape->Data3,_T("")) != 0))
- groups.insert(shape->Data3);
- }
- //Re-number groups
- for(std::set<_bstr_t>::iterator it = groups.begin(); it != groups.end(); it++)
- drawNumbers(m_vsoApp->ActivePage->Shapes,*it);
- }
+ //Return if auto enumeration is off
+ if(!GetRegistry<bool>(regFolder, NULL, _T("AutoEnum"), 0))
+ return;
- //Visio::IVShapePtr pageSheet = msgShape->Application->ActivePage->PageSheet;
- //Visio::IVShapePtr closestMsg;
+ Visio::IVShapePtr pageSheet = msgShape->Application->ActivePage->PageSheet;
+ Visio::IVShapePtr closestMsg;
- //int autoEnum1 = pageSheet->Cells["User.AutoEnum1"]->ResultInt[visNone][visTruncate];
- //
- //switch(autoEnum1)
- //{
- // case 0:
- // closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,false);
- // if(closestMsg)
- // if(_tcsicmp(closestMsg->Data3,_T("")) != 0)
- // enumerate(msgShape->Application,closestMsg->Data3,true,true);
- // break;
- // case 1:
- // closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,true);
- // if(closestMsg)
- // enumerate(msgShape->Application,closestMsg->Data3,true,true);
- // break;
+ int bAutoEnumType = GetRegistry<bool>(regFolder, NULL, _T("AutoEnumType"), 0);
+ closestMsg = CEnumerateUtils::getClosestMessage(msgShape->Application,msgShape,bAutoEnumType ? true : false);
+ if(closestMsg && _tcsicmp(closestMsg->Data3,_T("")) != 0)
+ enumerate(msgShape->Application,closestMsg->Data3,true,true);
+ }
- // default:
- // enumerate(msgShape->Application,msgShape->Data3,false,true);
- // break;
- //}
+ //Check which groups have changed
+ std::set<_bstr_t> groups;
+ //Collect all groups in current selection
+ for(int i=1; i<=selection->Count; i++)
+ {
+ Visio::IVShapePtr shape = selection->Item[i];
+ if(isMessageShape(shape) && (_tcsicmp(shape->Data3,_T("")) != 0))
+ groups.insert(shape->Data3);
+ }
+ //Re-number groups
+ for(std::set<_bstr_t>::iterator it = groups.begin(); it != groups.end(); it++)
+ drawNumbers(m_vsoApp->ActivePage->Shapes,*it);
}
VAORC CDocumentMonitor::OnMenuSelectNumberedGroup(Visio::IVApplicationPtr vsoApp)
Modified: trunk/src/view/visio/addon/enumerateUtils.cpp
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.cpp 2010-07-03 21:04:32 UTC (rev 824)
+++ trunk/src/view/visio/addon/enumerateUtils.cpp 2010-07-04 14:02:59 UTC (rev 825)
@@ -13,6 +13,7 @@
*
* Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
*
+ * $Id$
*/
#include "enumerateUtils.h"
@@ -308,3 +309,4 @@
combo.InsertString(3,_T("A, B, C,..."));
}
+// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/enumerateUtils.h
===================================================================
--- trunk/src/view/visio/addon/enumerateUtils.h 2010-07-03 21:04:32 UTC (rev 824)
+++ trunk/src/view/visio/addon/enumerateUtils.h 2010-07-04 14:02:59 UTC (rev 825)
@@ -13,6 +13,7 @@
*
* Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
*
+ * $Id$
*/
#pragma once
@@ -51,3 +52,5 @@
static VAORC enableEnumeration(Visio::IVShapePtr shape, _bstr_t groupID, std::set<_bstr_t>& formerGroups);
static void fillComboWithTypes(WTL::CComboBox& combo);
};
+
+// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/globalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-07-03 21:04:32 UTC (rev 824)
+++ trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-07-04 14:02:59 UTC (rev 825)
@@ -13,6 +13,7 @@
*
* Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
*
+ * $Id$
*/
#include "stdafx.h"
@@ -41,4 +42,5 @@
}
}
+// $Id$
Modified: trunk/src/view/visio/addon/globalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-03 21:04:32 UTC (rev 824)
+++ trunk/src/view/visio/addon/globalSettingsDlg.h 2010-07-04 14:02:59 UTC (rev 825)
@@ -13,6 +13,7 @@
*
* Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
*
+ * $Id$
*/
#pragma once
@@ -43,3 +44,5 @@
CNumberingGlobalDlg page1;
CPropertyPage<IDD_CHECK_OPTIONS> page2;
};
+
+// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-03 21:04:32 UTC (rev 824)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-07-04 14:02:59 UTC (rev 825)
@@ -13,6 +13,7 @@
*
* Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
*
+ * $Id$
*/
#include "stdafx.h"
@@ -174,4 +175,6 @@
{
EnableNumberingStyleControls(true);
return 0;
-}
\ No newline at end of file
+}
+
+// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-07-03 21:04:32 UTC (rev 824)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-07-04 14:02:59 UTC (rev 825)
@@ -13,6 +13,7 @@
*
* Copyright (c) 2010 Martin Bezdeka <mbe...@se...>
*
+ * $Id$
*/
#pragma once
@@ -87,3 +88,5 @@
//Other functions
const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageNumbering"); }
};
+
+// $Id$
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-09 11:02:16
|
Revision: 830
http://scstudio.svn.sourceforge.net/scstudio/?rev=830&view=rev
Author: mbezdeka
Date: 2010-07-09 11:02:10 +0000 (Fri, 09 Jul 2010)
Log Message:
-----------
message snapping files added
Added Paths:
-----------
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/messageSnapping.h
Added: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp (rev 0)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-09 11:02:10 UTC (rev 830)
@@ -0,0 +1,146 @@
+/*
+ * 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 Martin Bezdeka <mbe...@se...>
+ *
+ * $Id$
+ */
+
+#include "stdafx.h"
+#include "dllmodule.h"
+#include "messageSnapping.h"
+#include "shapeUtils.h"
+
+bool CMessageSnapping::isEnabled()
+{
+ const TCHAR* regFolder = _T("Software\\Sequence Chart Studio\\MessageSnapping");
+
+ if(!GetRegistry<bool>(regFolder, NULL, _T("SnapEnabled"), 0))
+ return false;
+
+ return true;
+}
+
+std::vector<Visio::IVShapePtr> CMessageSnapping::getIntersectInstances(Visio::IVShapePtr msgShape)
+{
+ std::vector<Visio::IVShapePtr> instShapes;
+ Visio::IVApplicationPtr vsoApp = msgShape->Application;
+ Visio::IVShapesPtr shapesOnPage = vsoApp->ActivePage->Shapes;
+
+ double InstBegY, InstEndY;
+ double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", "mm");
+
+ for(int i=1; i<=shapesOnPage->Count; i++)
+ {
+ Visio::IVShapePtr shape = shapesOnPage->Item[i];
+ if(get_shape_type(shape) == ST_BMSC_INSTANCE)
+ {
+ InstBegY = CShapeUtils::GetShapeCellProperty(shape, "BeginY", "mm");
+ InstEndY = CShapeUtils::GetShapeCellProperty(shape, "EndY", "mm");
+
+ //If instance is upside down, swap coordinates
+ if((InstBegY - InstEndY) < 0)
+ std::swap(InstBegY, InstEndY);
+
+ //Check if the message intersect instance and put it into vector of instances matching the criteria
+ if((InstBegY > msgPinY) && (InstEndY < msgPinY))
+ instShapes.push_back(shape);
+ }
+ }
+
+ return instShapes;
+}
+
+std::pair<Visio::IVShapePtr, Visio::IVShapePtr> CMessageSnapping::getClosestInstancePair(Visio::IVShapePtr msgShape,
+ const std::vector<Visio::IVShapePtr>& instances)
+{
+ //FIX ME: sometimes doesn't find the closest instances
+ double msgPinX = CShapeUtils::GetShapeCellProperty(msgShape, "PinX", "mm");
+
+ Visio::IVShapePtr leftClosestInstance = NULL;
+ Visio::IVShapePtr rightClosestInstance = NULL;
+ double leftClosestInstanceDist = 0;
+ double rightClosestInstanceDist = 0;
+ double instPinX;
+ double distance;
+
+ for(std::vector<Visio::IVShapePtr>::const_iterator it = instances.begin(); it != instances.end(); it++)
+ {
+ instPinX = CShapeUtils::GetShapeCellProperty((*it),"PinX","mm");
+ distance = msgPinX - instPinX;
+ (*it)->Text = stringize() << distance << " - ID: " << (*it)->ID;
+ if(distance < 0)
+ {
+ if(!rightClosestInstance || distance > rightClosestInstanceDist) //NOTE: Distance must be bigger, becaouse numbers are negative
+ {
+ rightClosestInstance = (*it);
+ rightClosestInstanceDist = distance;
+ }
+ }
+ else
+ {
+ if(!leftClosestInstance || distance < leftClosestInstanceDist)
+ {
+ leftClosestInstance = (*it);
+ leftClosestInstanceDist = distance;
+ }
+ }
+ }
+
+ return std::pair<Visio::IVShapePtr, Visio::IVShapePtr>(leftClosestInstance,rightClosestInstance);
+}
+
+void CMessageSnapping::glueMsgToInstances(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance)
+{
+ double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", "mm");
+
+ //reverse instances if message is left headed arrow
+ if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", "mm") - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", "mm")) < 0)
+ {
+ Visio::IVShapePtr buffer = leftInstance;
+ leftInstance = rightInstance;
+ rightInstance = buffer;
+ }
+
+ //restrict snapping for FOUND and LOST messages
+ switch(get_shape_type(msgShape))
+ {
+ case ST_BMSC_MESSAGE_FOUND:
+ leftInstance = NULL;
+ break;
+ case ST_BMSC_MESSAGE_LOST:
+ rightInstance = NULL;
+ break;
+ }
+
+ //Glue to left instance
+ if(leftInstance)
+ {
+ double InstBegY = CShapeUtils::GetShapeCellProperty(leftInstance, "BeginY", "mm");
+ double InstEndY = CShapeUtils::GetShapeCellProperty(leftInstance, "EndY", "mm");
+ double sizeOfInstance = InstBegY - InstEndY;
+ double msgOffset = InstBegY - msgPinY;
+ msgShape->Cells["BeginX"]->GlueToPos(leftInstance,msgOffset/sizeOfInstance,0.0);
+ }
+ //Glue to right instance
+ if(rightInstance)
+ {
+ double InstBegY = CShapeUtils::GetShapeCellProperty(rightInstance, "BeginY", "mm");
+ double InstEndY = CShapeUtils::GetShapeCellProperty(rightInstance, "EndY", "mm");
+ double sizeOfInstance = InstBegY - InstEndY;
+ double msgOffset = InstBegY - msgPinY;
+ msgShape->Cells["EndX"]->GlueToPos(rightInstance,msgOffset/sizeOfInstance,0.0);
+ }
+}
+
+// $Id$
\ No newline at end of file
Property changes on: trunk/src/view/visio/addon/messageSnapping.cpp
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/src/view/visio/addon/messageSnapping.h
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.h (rev 0)
+++ trunk/src/view/visio/addon/messageSnapping.h 2010-07-09 11:02:10 UTC (rev 830)
@@ -0,0 +1,45 @@
+/*
+ * 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 Martin Bezdeka <mbe...@se...>
+ *
+ * $Id$
+ */
+#pragma once
+
+#include <utility>
+#include <vector>
+
+class CMessageSnapping
+{
+public:
+
+ static bool isEnabled();
+ /*
+ * Get All instances that intersect HORIZONTAL line of current msg
+ * returns vector of pointers to instances, if zero, there are no intersecting instances
+ */
+ static std::vector<Visio::IVShapePtr> getIntersectInstances(Visio::IVShapePtr msgShape);
+ /*
+ * returns two closest instances for given message (first of the pair is instance on the left from the message, second is ono the right)
+ */
+ static std::pair<Visio::IVShapePtr, Visio::IVShapePtr> getClosestInstancePair(Visio::IVShapePtr msgShape, const std::vector<Visio::IVShapePtr>& instances);
+ /*
+ * Glue given message on the given instances, message
+ * designed only for horizontal messages (diagonal messages will be snapped according their PinX point and reformed to horizontal messages)
+ */
+ static void glueMsgToInstances(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance);
+
+};
+
+// $Id$
\ No newline at end of file
Property changes on: trunk/src/view/visio/addon/messageSnapping.h
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-09 11:20:51
|
Revision: 831
http://scstudio.svn.sourceforge.net/scstudio/?rev=831&view=rev
Author: mbezdeka
Date: 2010-07-09 11:20:45 +0000 (Fri, 09 Jul 2010)
Log Message:
-----------
Message snapping:
- forgotten debug info erased
Modified Paths:
--------------
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/scstudio.vcproj
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-09 11:02:10 UTC (rev 830)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-09 11:20:45 UTC (rev 831)
@@ -64,7 +64,6 @@
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> CMessageSnapping::getClosestInstancePair(Visio::IVShapePtr msgShape,
const std::vector<Visio::IVShapePtr>& instances)
{
- //FIX ME: sometimes doesn't find the closest instances
double msgPinX = CShapeUtils::GetShapeCellProperty(msgShape, "PinX", "mm");
Visio::IVShapePtr leftClosestInstance = NULL;
@@ -78,7 +77,6 @@
{
instPinX = CShapeUtils::GetShapeCellProperty((*it),"PinX","mm");
distance = msgPinX - instPinX;
- (*it)->Text = stringize() << distance << " - ID: " << (*it)->ID;
if(distance < 0)
{
if(!rightClosestInstance || distance > rightClosestInstanceDist) //NOTE: Distance must be bigger, becaouse numbers are negative
Modified: trunk/src/view/visio/addon/scstudio.vcproj
===================================================================
--- trunk/src/view/visio/addon/scstudio.vcproj 2010-07-09 11:02:10 UTC (rev 830)
+++ trunk/src/view/visio/addon/scstudio.vcproj 2010-07-09 11:20:45 UTC (rev 831)
@@ -364,6 +364,10 @@
>
</File>
<File
+ RelativePath=".\messageSnapping.h"
+ >
+ </File>
+ <File
RelativePath=".\numberingGlobalDlg.cpp"
>
</File>
@@ -526,10 +530,6 @@
>
</File>
</Filter>
- <File
- RelativePath=".\messageSnapping.h"
- >
- </File>
</Files>
<Globals>
<Global
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-23 09:04:18
|
Revision: 838
http://scstudio.svn.sourceforge.net/scstudio/?rev=838&view=rev
Author: mbezdeka
Date: 2010-07-23 09:04:12 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Message snapping
- bugs fixed
Modified Paths:
--------------
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/messageSnapping.h
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-23 00:03:47 UTC (rev 837)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-23 09:04:12 UTC (rev 838)
@@ -264,19 +264,19 @@
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
- if(CMessageSnapping::isEnabled()) //Check whether snapping is enabled
+ if(CMessageSnapping::isEnabled() && (m_vsoApp->ActiveWindow->Selection->Count == 1)) //Check whether snapping is enabled
+ {
+ double posX = CShapeUtils::GetShapeCellProperty(vsoShape,"PinX",visPageUnits), posY = CShapeUtils::GetShapeCellProperty(vsoShape,"PinY",visPageUnits);
+ if(m_addon->GetCtrlKeyDown())
{
- double posX = CShapeUtils::GetShapeCellProperty(vsoShape,"PinX",visPageUnits), posY = CShapeUtils::GetShapeCellProperty(vsoShape,"PinY",visPageUnits);
- if(m_addon->GetCtrlKeyDown())
- {
- posX += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosX(), 0, visPageUnits);
- posY += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosY(), 0, visPageUnits);
- }
- m_vsoApp->EventsEnabled = false;
- autoSnapping(vsoShape,posX, posY);
- m_vsoApp->EventsEnabled = true;
+ posX += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosX(), 0, visPageUnits);
+ posY += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosY(), 0, visPageUnits);
}
- autoEnumerate(vsoShape);
+ m_vsoApp->EventsEnabled = false;
+ autoSnapping(vsoShape,posX, posY);
+ m_vsoApp->EventsEnabled = true;
+ }
+ autoEnumerate(vsoShape);
break;
case ST_COMMENT:
@@ -2204,7 +2204,7 @@
closestInst = CMessageSnapping::getClosestInstancePair(msgShape, posX, posY, instShapes, snapType);
//Step 5:Glue to them
- CMessageSnapping::glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second,posY, snapType);
+ CMessageSnapping::glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second, posY, snapType);
//Step 6: Do some corrections
if(closestInst.first ^ closestInst.second)
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-23 00:03:47 UTC (rev 837)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-23 09:04:12 UTC (rev 838)
@@ -125,7 +125,8 @@
break;
}
- if(!intPoint || intPoint->y > instBeginY || intPoint->y < instEndY)
+ //Check whether point is only on instanceLine
+ if(!intPoint || intPoint->y > instBeginY || intPoint->y < instEndY || !isPointOnInstancesLine(*intPoint, *it))
continue;
mouseDistX = msgSnapPointX - intPoint->x;
@@ -173,7 +174,7 @@
}
void CMessageSnapping::glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance,
- double yPos, MsgSnapType snapType)
+ double yPos, MsgSnapType snapType)
{
//if there are no instances, return
if(!leftInstance && !rightInstance)
@@ -235,11 +236,6 @@
void CMessageSnapping::glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape,
const _bstr_t & msgCell, double yPos)
{
- //Get values from cells
- double InstOffsetLeft = 0;
- if(instanceShape->CellExists["Controls.mscHeadWidth"][visExistsAnywhere]) //NOTE: Check if the instance is not headless
- InstOffsetLeft = CShapeUtils::GetShapeCellProperty(instanceShape, "Controls.mscHeadWidth.X", visPageUnits); //NOTE: get width of instances rectangles
-
double InstBegY = CShapeUtils::GetShapeCellProperty(instanceShape, "BeginY", visPageUnits);
double InstEndY = CShapeUtils::GetShapeCellProperty(instanceShape, "EndY", visPageUnits);
@@ -250,10 +246,6 @@
if(sizeOfInstance == 0)
return;
- //Glue to position, if message is on "rectangles" on the instance it won't be glued
- if((msgOffset < InstOffsetLeft) || (msgOffset > (sizeOfInstance - InstOffsetLeft)))
- return;
-
msgShape->Application->EventsEnabled = false;
msgShape->Cells[msgCell]->GlueToPos(instanceShape,msgOffset/sizeOfInstance,0.0);
msgShape->Application->EventsEnabled = true;
@@ -285,4 +277,30 @@
return result;
}
+bool CMessageSnapping::isPointOnInstancesLine(VEC2 point, Visio::IVShapePtr instShape)
+{
+#define _sp(x) CShapeUtils::GetShapeCellProperty(instShape, x, visPageUnits)
+
+ double InstOffset = 0;
+
+ //Get values from cells
+ if(instShape->CellExists["Controls.mscHeadWidth"][visExistsAnywhere]) //NOTE: Check if the instance is not headless
+ InstOffset = _sp("Controls.mscHeadWidth.X"); //NOTE: get width of instances rectangles
+
+ double sizeOfInstance = _sp("Width");
+ double msgOffset = sqrt( pow(point.x - _sp("BeginX"),2) + pow(point.y - _sp("BeginY"),2) );
+
+ //avoid division by zero - when instances are in horizontal position
+ if(sizeOfInstance == 0)
+ return false;
+
+ //Glue to position, if message is on "rectangles" on the instance it won't be glued
+ if((msgOffset < InstOffset) || (msgOffset > (sizeOfInstance - InstOffset)))
+ return false;
+
+ return true;
+
+#undef _sp
+}
+
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/messageSnapping.h
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.h 2010-07-23 00:03:47 UTC (rev 837)
+++ trunk/src/view/visio/addon/messageSnapping.h 2010-07-23 09:04:12 UTC (rev 838)
@@ -47,7 +47,7 @@
* @param onlyOnInstanceLine if true avoid connection message on instace's "rectangles" on the top and the bottom
*/
static void glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance,
- double yPos, MsgSnapType snapType);
+ double yPos, MsgSnapType snapType);
/*
* Glue given message to instance, but only to "line" of instance, rectangles at the bottom and top are ignored
* @param msgCell message cell which should be glued (e.g. BeginX, EndY)
@@ -56,6 +56,8 @@
static void glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape, const _bstr_t & msgCell, double yPos);
static PVEC2 getIntersectionWithInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape);
+
+ static bool isPointOnInstancesLine(VEC2 point, Visio::IVShapePtr instShape);
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-07-23 10:35:50
|
Revision: 839
http://scstudio.svn.sourceforge.net/scstudio/?rev=839&view=rev
Author: mbezdeka
Date: 2010-07-23 10:35:44 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Message snapping
- bug fixed (copying messages with ctrl doesn't work correctly)
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/document.cpp
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-07-23 09:04:12 UTC (rev 838)
+++ trunk/src/view/visio/addon/addon.h 2010-07-23 10:35:44 UTC (rev 839)
@@ -119,7 +119,7 @@
double GetRelMousePosX() { return m_mouseRelPosX; }
double GetRelMousePosY() { return m_mouseRelPosY; }
- void SetOnDropShapeState(bool state) { m_bOnDropShape = state; m_bSnap = state; }
+ void SetOnDropShapeState(bool state) { m_bOnDropShape = state;}
bool GetOnDropShapeState() { return m_bOnDropShape; }
bool GetCtrlKeyDown() { return m_bCtrlDown; }
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-23 09:04:12 UTC (rev 838)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-23 10:35:44 UTC (rev 839)
@@ -266,11 +266,12 @@
if(CMessageSnapping::isEnabled() && (m_vsoApp->ActiveWindow->Selection->Count == 1)) //Check whether snapping is enabled
{
- double posX = CShapeUtils::GetShapeCellProperty(vsoShape,"PinX",visPageUnits), posY = CShapeUtils::GetShapeCellProperty(vsoShape,"PinY",visPageUnits);
+ double posX = CShapeUtils::GetShapeCellProperty(vsoShape,"PinX",visPageUnits);
+ double posY = CShapeUtils::GetShapeCellProperty(vsoShape,"PinY",visPageUnits);
if(m_addon->GetCtrlKeyDown())
{
posX += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosX(), 0, visPageUnits);
- posY += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosY(), 0, visPageUnits);
+ //posY += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosY(), 0, visPageUnits); // Not needed
}
m_vsoApp->EventsEnabled = false;
autoSnapping(vsoShape,posX, posY);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-08-11 21:27:20
|
Revision: 842
http://scstudio.svn.sourceforge.net/scstudio/?rev=842&view=rev
Author: mbezdeka
Date: 2010-08-11 21:27:12 +0000 (Wed, 11 Aug 2010)
Log Message:
-----------
MessageSnapping:
- help button added to global settings dialog
- messages now stay connected to instances when up or down keys are hit
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
trunk/src/view/visio/addon/globalSettingsDlg.cpp
trunk/src/view/visio/addon/globalSettingsDlg.h
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/messageSnapping.h
trunk/src/view/visio/addon/numberingGlobalDlg.cpp
trunk/src/view/visio/addon/numberingGlobalDlg.h
trunk/src/view/visio/addon/pageutils.cpp
trunk/src/view/visio/addon/pageutils.h
trunk/src/view/visio/addon/snapGlobalDlg.cpp
trunk/src/view/visio/addon/snapGlobalDlg.h
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/addon.cpp 2010-08-11 21:27:12 UTC (rev 842)
@@ -644,6 +644,13 @@
}
//Message snapping
+ if(vsoKeyboardEvent->KeyCode == VK_UP || vsoKeyboardEvent->KeyCode == VK_DOWN || m_bKeyDown == false)
+ {
+ Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
+ for(int i=1; i<=selection->Count; i++)
+ snappedInstances.push_back(CMessageSnapping::getConnectedInstances(selection->Item[i]));
+ }
+
if(m_keyButtonState & visKeyControl)
m_bCtrlDown = true;
@@ -667,6 +674,15 @@
GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItems(false);
}
+ //Keyboard snapping
+ if(m_bKeyDown)
+ {
+ for(int i=1; i<=vsoApp->ActiveWindow->Selection->Count; i++)
+ CMessageSnapping::resnap(vsoApp->ActiveWindow->Selection->Item[i], snappedInstances.at(i-1));
+ snappedInstances.clear();
+ m_bKeyDown = false;
+ }
+
//Message snapping
m_bCtrlDown = false;
}
@@ -713,7 +729,7 @@
////////////////////////////////////////////////////
//Message snapping
#define _u(x) CPageUtils::ConvertUnits(vsoApp, x, 0, visPageUnits)
- if(!m_bOnDropShape && m_bSnap && vsoApp->ActiveWindow->Selection->Count && CMessageSnapping::isEnabled())
+ if(!m_bOnDropShape && m_bSnap && !m_bKeyDown && vsoApp->ActiveWindow->Selection->Count && CMessageSnapping::isEnabled())
{
Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
CDocumentMonitor* docMon = GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument);
@@ -728,22 +744,14 @@
//Get relative position of the mouse from the shape Begin
double newPosX = CShapeUtils::GetShapeCellProperty(msgShape,"PinX", visPageUnits);
double newPosY = CShapeUtils::GetShapeCellProperty(msgShape,"PinY", visPageUnits);
-
newPosX += CPageUtils::ConvertUnits(vsoApp, m_mouseRelPosX, 0, visPageUnits);
newPosY += CPageUtils::ConvertUnits(vsoApp, m_mouseRelPosY, 0, visPageUnits);
-
-
- //Do snapping
- docMon->autoSnapping(msgShape, newPosX, newPosY);
+ CMessageSnapping::autoSnapping(msgShape, newPosX, newPosY,CMessageSnapping::getSnapType()); //Do regular snapping
}
}
- else //NOTE: Multiple selection - preserve connecting to instances
- {
- //Not implemented yet
- }
}
//Set variables to false
- m_bSnap = m_bMoving = m_bBeginChanged = m_bEndChanged = m_bKeyDown = false;
+ m_bSnap = m_bMoving = m_bBeginChanged = m_bEndChanged = false;
#undef _u
////////////////////////////////////////////////////
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/addon.h 2010-08-11 21:27:12 UTC (rev 842)
@@ -20,6 +20,7 @@
#include <map>
#include <set>
+#include <vector>
class CReportView;
class CDocumentMonitor;
@@ -158,6 +159,7 @@
bool m_bOnDropShape;
double m_mouseRelPosX;
double m_mouseRelPosY;
+ std::vector< std::vector<Visio::IVShapePtr> > snappedInstances;
};
// $Id$
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/document.cpp 2010-08-11 21:27:12 UTC (rev 842)
@@ -269,12 +269,10 @@
double posX = CShapeUtils::GetShapeCellProperty(vsoShape,"PinX",visPageUnits);
double posY = CShapeUtils::GetShapeCellProperty(vsoShape,"PinY",visPageUnits);
if(m_addon->GetCtrlKeyDown())
- {
posX += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosX(), 0, visPageUnits);
- //posY += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosY(), 0, visPageUnits); // Not needed
- }
+
m_vsoApp->EventsEnabled = false;
- autoSnapping(vsoShape,posX, posY);
+ CMessageSnapping::autoSnapping(vsoShape, posX, posY, CMessageSnapping::getSnapType());
m_vsoApp->EventsEnabled = true;
}
autoEnumerate(vsoShape);
@@ -2163,93 +2161,4 @@
return 0;
}
-void CDocumentMonitor::autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY)
-{
- long scopeID = msgShape->Application->BeginUndoScope(_T("AutoSnapping"));
-#define _sp(x) CShapeUtils::GetShapeCellProperty(msgShape, x, visPageUnits)
-
- //Step 1: Get snap type
- MsgSnapType snapType = CMessageSnapping::getSnapType();
-
- if(snapType < 0 || snapType > 2)
- {
- MessageBox(GetActiveWindow(), _T("Error occurred: Unknown snap type"), _T("Error"), MB_OK | MB_ICONERROR);
- return;
- }
-
- double msgBegY = _sp("BeginY"), msgEndY = _sp("EndY");
- VEC2 msgVec(msgShape->Cells["EndX"]->Result[""] - msgShape->Cells["BeginX"]->Result[""], //NOTE: vector for preservind message length
- msgShape->Cells["EndY"]->Result[""]- msgShape->Cells["BeginY"]->Result[""]);
-
- //Step 2: If message is only horizontal we can take as Y coord PinY and don't have to calculate oblique
- if(msgBegY == msgEndY)
- {
- posY = _sp("PinY");
- snapType = MSSNAP_STRAIGHTEN;
- }
-
- //Step 3: Get all instance matching criteria
- std::vector<Visio::IVShapePtr> instShapes = CMessageSnapping::getIntersectInstances(msgShape, posY, snapType);
-
- //Step 4: Get the closest instance on the left and on the right
- std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst;
- if(snapType == MSSNAP_PRESERVE_VERTICAL)
- {
- //left closest instance
- std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInstLeft = CMessageSnapping::getClosestInstancePair(msgShape, posX, _sp("BeginY"), instShapes, MSSNAP_STRAIGHTEN);
- std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInstRight = CMessageSnapping::getClosestInstancePair(msgShape, posX, _sp("EndY"), instShapes, MSSNAP_STRAIGHTEN);
- closestInst.first = ((_sp("BeginX") - _sp("EndX")) < 0) ? closestInstLeft.first : closestInstRight.first;
- closestInst.second =((_sp("BeginX") - _sp("EndX")) < 0) ? closestInstRight.second : closestInstLeft.second;
- }
- else
- closestInst = CMessageSnapping::getClosestInstancePair(msgShape, posX, posY, instShapes, snapType);
-
- //Step 5:Glue to them
- CMessageSnapping::glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second, posY, snapType);
-
- //Step 6: Do some corrections
- if(closestInst.first ^ closestInst.second)
- {
- //Step 6.1: If message is left-oriented switch pointers
- if((_sp("EndX") - _sp("BeginX")) < 0)
- {
- Visio::IVShapePtr buffer = closestInst.first;
- closestInst.first = closestInst.second;
- closestInst.second = buffer;
- }
-
- //Step 6.2: Straighten messages when it's snapped only to one instance (must disable events, because CellChanged would be triggered)
- if(snapType == MSSNAP_STRAIGHTEN)
- {
- msgShape->Application->EventsEnabled = false;
- if(!closestInst.second)
- msgShape->Cells["EndY"]->FormulaU = stringize() << msgShape->Cells["BeginY"]->Result[""];
- else if(!closestInst.first)
- msgShape->Cells["BeginY"]->FormulaU = stringize() << msgShape->Cells["EndY"]->Result[""];
- msgShape->Application->EventsEnabled = true;
- }
-
- //Step 6.3: If message is snapped only to one instance, preserve its length
- msgShape->Application->EventsEnabled = false;
- if(closestInst.first) //LEFT point is snapped, adjust right point
- {
- msgShape->Cells["EndX"]->FormulaU = stringize() << msgShape->Cells["BeginX"]->Result[""] + msgVec.x;
- if(snapType != MSSNAP_STRAIGHTEN) msgShape->Cells["EndY"]->FormulaU = stringize() << msgShape->Cells["BeginY"]->Result[""] + msgVec.y;
- }
-
- if(closestInst.second) //RIGHT point is snapped, adjust left point
- {
- msgShape->Cells["BeginX"]->FormulaU = stringize() << msgShape->Cells["EndX"]->Result[""] - msgVec.x;
- if(snapType != MSSNAP_STRAIGHTEN) msgShape->Cells["BeginY"]->FormulaU = stringize() << msgShape->Cells["EndY"]->Result[""] - msgVec.y;
- }
- msgShape->Application->EventsEnabled = true;
- }
-
-#undef _sp
- msgShape->Application->EndUndoScope(scopeID,true);
-
- //FIXME: When MSSNAP_STRAIGHTEN is in use then copying msgs using ctrl doesn't work correctly
- //FIXME: When user add a new shape and hold ctrl key, snapping doesn't work correctly
-}
-
// $Id$
Modified: trunk/src/view/visio/addon/document.h
===================================================================
--- trunk/src/view/visio/addon/document.h 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/document.h 2010-08-11 21:27:12 UTC (rev 842)
@@ -337,17 +337,6 @@
public:
Visio::IVUIObjectPtr GetMostCustomMenus();
Visio::IVUIObjectPtr GetMostCustomToolbars();
-
-
-// Message snapping
-
- /**
- * automatically snaps current message to nearest instances
- * @param msgShape a shape to snap
- * @param posX MouseX position for closest instances computing
- * @param posY MouseY position for closest instances computing
- */
- void autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY);
};
// $Id$
Modified: trunk/src/view/visio/addon/globalSettingsDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/globalSettingsDlg.cpp 2010-08-11 21:27:12 UTC (rev 842)
@@ -26,13 +26,20 @@
m_bCentered = false;
//Disable APPLY button and CONTEXT HELP button
- m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP | PSH_HASHELP;
+ m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP;
+
+ //Property pages contructors
+ page1 = boost::shared_ptr<CNumberingGlobalDlg>(new CNumberingGlobalDlg(vsoApp));
+ page2 = boost::shared_ptr<CSnapGlobalDlg>(new CSnapGlobalDlg(vsoApp));
//Adding pages
- page1.SetTitle(_T("Numbering")); AddPage(page1);
- page2.SetTitle(_T("Snap && Glue")); AddPage(page2);
+ page1->SetTitle(_T("Numbering")); AddPage(*page1);
+ page2->SetTitle(_T("Snap && Glue")); AddPage(*page2);
}
+CGlobalSettingsDlg::~CGlobalSettingsDlg()
+{
+}
void CGlobalSettingsDlg::OnShowWindow(BOOL bShowing, int nReason)
{
Modified: trunk/src/view/visio/addon/globalSettingsDlg.h
===================================================================
--- trunk/src/view/visio/addon/globalSettingsDlg.h 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/globalSettingsDlg.h 2010-08-11 21:27:12 UTC (rev 842)
@@ -32,6 +32,8 @@
CGlobalSettingsDlg(Visio::IVApplicationPtr vsoApp, ATL::_U_STRINGorID title = (LPCTSTR) NULL,
UINT uStartPage = 0, HWND hWndParent = NULL);
+ ~CGlobalSettingsDlg();
+
BEGIN_MSG_MAP(CGlobalSettingsDlg)
MSG_WM_SHOWWINDOW(OnShowWindow)
CHAIN_MSG_MAP(CPropertySheetImpl<CGlobalSettingsDlg>)
@@ -44,8 +46,8 @@
bool m_bCentered;
//Pages of property sheet
- CNumberingGlobalDlg page1;
- CSnapGlobalDlg page2;
+ boost::shared_ptr<CNumberingGlobalDlg> page1;
+ boost::shared_ptr<CSnapGlobalDlg> page2;
Visio::IVApplicationPtr m_vsoApp;
};
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-08-11 21:27:12 UTC (rev 842)
@@ -174,7 +174,7 @@
}
void CMessageSnapping::glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance,
- double yPos, MsgSnapType snapType)
+ double yPos, MsgSnapType snapType)
{
//if there are no instances, return
if(!leftInstance && !rightInstance)
@@ -189,40 +189,24 @@
}
double yLeftPos, yRightPos;
- double msgBegY = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits);
- double msgEndY = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits);
- //if message is only horizontal we can take as Y coord PinY and don't have to calculate oblique
- if(msgBegY == msgEndY)
- yLeftPos = yRightPos = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
- else
+ //Select where ends of message should be snapped
+ switch(snapType)
{
- //Select where ends of message should be snapped
- switch(snapType)
- {
- case MSSNAP_STRAIGHTEN:
- yLeftPos = yRightPos = yPos;
- break;
- case MSSNAP_PRESERVE_VERTICAL:
- yLeftPos = msgBegY;
- yRightPos = msgEndY;
- break;
- case MSSNAP_PRESERVE_SLOPE:
- PVEC2 p = NULL;
- if(leftInstance)
- {
- p = getIntersectionWithInstance(msgShape, leftInstance);
- if(p) yLeftPos = p->y;
- delete p;
- }
- if(rightInstance)
- {
- p = getIntersectionWithInstance(msgShape, rightInstance);
- if(p) yRightPos = p->y;
- delete p;
- }
- break;
- }
+ case MSSNAP_STRAIGHTEN:
+ yLeftPos = yRightPos = yPos; //Y-coord for snap is same for both ends of message
+ break;
+ case MSSNAP_PRESERVE_VERTICAL:
+ yLeftPos = CShapeUtils::GetShapeCellProperty(msgShape,"BeginY", visPageUnits); //Y-coord for begin point of msg
+ yRightPos = CShapeUtils::GetShapeCellProperty(msgShape,"EndY", visPageUnits); //Y-coord for end point of msg
+ break;
+ case MSSNAP_PRESERVE_SLOPE:
+ PVEC2 p = getIntersectionWithInstance(msgShape, leftInstance);
+ if(p) yLeftPos = p->y; delete p;
+
+ p = getIntersectionWithInstance(msgShape, rightInstance);
+ if(p) yRightPos = p->y; delete p;
+ break;
}
//Glue to left instance
@@ -253,6 +237,9 @@
PVEC2 CMessageSnapping::getIntersectionWithInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape)
{
+ if(!msgShape || !instanceShape)
+ return NULL;
+
#define _s(x) CShapeUtils::GetShapeCellProperty(msgShape, x, visPageUnits)
#define _i(x) CShapeUtils::GetShapeCellProperty(instanceShape, x, visPageUnits)
@@ -290,17 +277,153 @@
double sizeOfInstance = _sp("Width");
double msgOffset = sqrt( pow(point.x - _sp("BeginX"),2) + pow(point.y - _sp("BeginY"),2) );
- //avoid division by zero - when instances are in horizontal position
- if(sizeOfInstance == 0)
- return false;
+ //Glue to position, if message is on "rectangles" on the instance it won't be glued
+ return !((msgOffset < InstOffset) || (msgOffset > (sizeOfInstance - InstOffset)));
- //Glue to position, if message is on "rectangles" on the instance it won't be glued
- if((msgOffset < InstOffset) || (msgOffset > (sizeOfInstance - InstOffset)))
+#undef _sp
+}
+
+bool CMessageSnapping::getMsgVector(Visio::IVShapePtr msgShape, PVEC2 resultVector)
+{
+ if(!resultVector)
return false;
+ double msgBegY = CShapeUtils::GetShapeCellProperty(msgShape, "BeginY", visPageUnits);
+ double msgEndY = CShapeUtils::GetShapeCellProperty(msgShape, "EndY", visPageUnits);
+
+ resultVector->x = msgShape->Cells["EndX"]->Result[""] - msgShape->Cells["BeginX"]->Result[""];
+ resultVector->y = msgShape->Cells["EndY"]->Result[""] - msgShape->Cells["BeginY"]->Result[""];
+
return true;
+}
+void CMessageSnapping::autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY, MsgSnapType snapType)
+{
+ long scopeID = msgShape->Application->BeginUndoScope(_T("AutoSnapping"));
+#define _sp(x) CShapeUtils::GetShapeCellProperty(msgShape, x, visPageUnits)
+
+ //Step 1: Check snap type
+ if(snapType < 0 || snapType > 2)
+ {
+ MessageBox(GetActiveWindow(), _T("Error occurred: Unknown snap type"), _T("Error"), MB_OK | MB_ICONERROR);
+ return;
+ }
+
+ VEC2 msgVec;
+ if(!getMsgVector(msgShape, &msgVec))
+ return;
+
+ //Step 2: If message is only horizontal we can take as Y coord PinY and don't have to calculate oblique
+ if(_sp("BeginY") == _sp("EndY"))
+ {
+ posY = _sp("PinY");
+ snapType = MSSNAP_STRAIGHTEN;
+ }
+
+ //Step 3: Get all instances matching criteria
+ std::vector<Visio::IVShapePtr> instShapes = getIntersectInstances(msgShape, posY, snapType);
+
+ //Step 4: Get the closest instance on the left and on the right
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst;
+ if(snapType == MSSNAP_PRESERVE_VERTICAL)
+ {
+ //left closest instance
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInstLeft = getClosestInstancePair(msgShape, posX, _sp("BeginY"), instShapes, MSSNAP_STRAIGHTEN);
+ std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInstRight = getClosestInstancePair(msgShape, posX, _sp("EndY"), instShapes, MSSNAP_STRAIGHTEN);
+ closestInst.first = ((_sp("BeginX") - _sp("EndX")) < 0) ? closestInstLeft.first : closestInstRight.first;
+ closestInst.second =((_sp("BeginX") - _sp("EndX")) < 0) ? closestInstRight.second : closestInstLeft.second;
+ }
+ else
+ closestInst = getClosestInstancePair(msgShape, posX, posY, instShapes, snapType);
+
+ //Step 5:Glue to them
+ glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second, posY, snapType);
+
+ //Step 6: Do some corrections if only one of instances intersect //FIXME: Cut to functions
+ if(closestInst.first ^ closestInst.second)
+ {
+ //Step 6.1: If message is left-oriented switch pointers
+ if(_sp("EndX") < _sp("BeginX"))
+ {
+ Visio::IVShapePtr buffer = closestInst.first;
+ closestInst.first = closestInst.second;
+ closestInst.second = buffer;
+ }
+
+ //Step 6.2: Straighten messages when it's snapped only to one instance (must disable events, because CellChanged would be triggered)
+ if(snapType == MSSNAP_STRAIGHTEN)
+ {
+ msgShape->Application->EventsEnabled = false;
+ if(!closestInst.second)
+ msgShape->Cells["EndY"]->FormulaU = stringize() << msgShape->Cells["BeginY"]->Result[""];
+ else if(!closestInst.first)
+ msgShape->Cells["BeginY"]->FormulaU = stringize() << msgShape->Cells["EndY"]->Result[""];
+ msgShape->Application->EventsEnabled = true;
+ }
+
+ //Step 6.3: If message is snapped only to one instance, preserve its length
+ msgShape->Application->EventsEnabled = false;
+ if(closestInst.first) //LEFT point is snapped, adjust right point
+ {
+ msgShape->Cells["EndX"]->FormulaU = stringize() << msgShape->Cells["BeginX"]->Result[""] + msgVec.x;
+ if(snapType != MSSNAP_STRAIGHTEN) msgShape->Cells["EndY"]->FormulaU = stringize() << msgShape->Cells["BeginY"]->Result[""] + msgVec.y;
+ }
+
+ if(closestInst.second) //RIGHT point is snapped, adjust left point
+ {
+ msgShape->Cells["BeginX"]->FormulaU = stringize() << msgShape->Cells["EndX"]->Result[""] - msgVec.x;
+ if(snapType != MSSNAP_STRAIGHTEN) msgShape->Cells["BeginY"]->FormulaU = stringize() << msgShape->Cells["EndY"]->Result[""] - msgVec.y;
+ }
+ msgShape->Application->EventsEnabled = true;
+ }
+
#undef _sp
+ msgShape->Application->EndUndoScope(scopeID,true);
+
+ //FIXME: When user add a new shape and hold ctrl key, snapping doesn't work correctly
}
+std::vector<Visio::IVShapePtr> CMessageSnapping::getConnectedInstances(Visio::IVShapePtr msgShape)
+{
+ std::vector<Visio::IVShapePtr> instances;
+
+ Visio::IVConnectsPtr conns = msgShape->Connects;
+ for(int i=1; i<=conns->Count; i++)
+ {
+ Visio::IVConnectPtr conItem = conns->Item[i];
+ Visio::IVCellPtr instCell = conItem->ToCell;
+
+ instances.push_back(instCell->Shape);
+ }
+ return instances;
+}
+
+bool CMessageSnapping::resnap(Visio::IVShapePtr msgShape, std::vector<Visio::IVShapePtr> instances)
+{
+ VEC2 beginPoint = VEC2(msgShape->Cells["BeginX"]->Result[visPageUnits], msgShape->Cells["BeginY"]->Result[visPageUnits]);
+ VEC2 endPoint = VEC2(msgShape->Cells["EndX"]->Result[visPageUnits], msgShape->Cells["EndY"]->Result[visPageUnits]);
+
+ if(instances.size() > 2 || instances.size() < 1)
+ return false;
+
+ for(std::vector<Visio::IVShapePtr>::iterator it = instances.begin(); it != instances.end(); it++)
+ {
+ PVEC2 bufferPoint = getIntersectionWithInstance(msgShape,*it);
+ if(bufferPoint)
+ {
+ if(pointsEqual(*bufferPoint, beginPoint) && isPointOnInstancesLine(beginPoint, *it))
+ glueMsgToInstance(msgShape, *it, "BeginX", beginPoint.y);
+ else if(pointsEqual(*bufferPoint, endPoint) && isPointOnInstancesLine(endPoint, *it))
+ glueMsgToInstance(msgShape, *it, "EndX", endPoint.y);
+ }
+ delete bufferPoint;
+ }
+ return true;
+}
+
+bool CMessageSnapping::pointsEqual(VEC2 point1, VEC2 point2)
+{
+ return (abs(point1.x - point2.x) < 0.0000001) && (abs(point1.y - point2.y) < 0.0000001);
+}
+
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/messageSnapping.h
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.h 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/messageSnapping.h 2010-08-11 21:27:12 UTC (rev 842)
@@ -55,10 +55,44 @@
*/
static void glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape, const _bstr_t & msgCell, double yPos);
+ /*
+ *
+ */
static PVEC2 getIntersectionWithInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape);
+ /*
+ *
+ */
static bool isPointOnInstancesLine(VEC2 point, Visio::IVShapePtr instShape);
+ /*
+ * Get Directional vector of given message shape
+ */
+ static bool getMsgVector(Visio::IVShapePtr msgShape, PVEC2 resultVector);
+
+ /*
+ * automatically snaps current message to nearest instances
+ * @param msgShape a shape to snap
+ * @param posX MouseX position for closest instances computing
+ * @param posY MouseY position for closest instances computing
+ */
+ //FIXME: Change return type to bool
+ static void autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY, MsgSnapType snapType);
+
+ /*
+ * Snap message to instaces whether its enpoints are on the instance's line
+ */
+ static bool resnap(Visio::IVShapePtr msgShape, std::vector<Visio::IVShapePtr> instances);
+
+ /*
+ * Get all instances the given message is connected to
+ */
+ static std::vector<Visio::IVShapePtr> getConnectedInstances(Visio::IVShapePtr msgShape);
+ /*
+ *
+ */
+ static bool pointsEqual(VEC2 point1, VEC2 point2);
+
};
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.cpp 2010-08-11 21:27:12 UTC (rev 842)
@@ -22,6 +22,8 @@
#include "enumerateUtils.h"
#include "document.h"
+#include <htmlhelp.h>
+
BOOL CNumberingGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
{
//Loading registry data
@@ -133,6 +135,23 @@
return PSNRET_INVALID;
}
+void CNumberingGlobalDlg::OnHelp()
+{
+ //FIXME: Doesn't work in VIsio 2007
+ std::basic_string<TCHAR> path = GetVisioModulePath();
+ path += _T("scstudio.chm::/frontend/message-numbering.html");
+
+ try
+ {
+ m_vsoApp->InvokeHelp(path.c_str(), HH_DISPLAY_TOPIC, 1);
+ }
+ catch (_com_error &err)
+ {
+ std::wstring text = stringize() << _T("Cannot display help due to internal error: ") << err.ErrorMessage();
+ MessageBox(text.c_str());
+ }
+}
+
void CNumberingGlobalDlg::EnableAllControls(bool bEnable)
{
m_nearestMsg.EnableWindow(bEnable);
Modified: trunk/src/view/visio/addon/numberingGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/numberingGlobalDlg.h 2010-08-11 21:27:12 UTC (rev 842)
@@ -27,14 +27,15 @@
#include <sstream>
#include "data/msc.h"
-class CNumberingGlobalDlg:
- public CPropertyPageImpl<CNumberingGlobalDlg>,
- public CWinDataExchange<CNumberingGlobalDlg>
+#include <boost/shared_ptr.hpp>
+
+class CNumberingGlobalDlg: public CPropertyPageImpl<CNumberingGlobalDlg>, public CWinDataExchange<CNumberingGlobalDlg>
{
public:
enum { IDD = IDD_NUMBERING_GLOBAL };
- CNumberingGlobalDlg() { //set dialog properties
+ CNumberingGlobalDlg(Visio::IVApplicationPtr vsoApp):m_vsoApp(vsoApp)
+ { //set dialog properties
m_psp.dwFlags |= PSP_HASHELP;
};
@@ -75,6 +76,8 @@
int m_iIndex;
_bstr_t m_szAddition;
+ Visio::IVApplicationPtr m_vsoApp;
+
LRESULT OnBnClickedEnumCheck(WORD, WORD, HWND, BOOL&);
LRESULT OnBnClickedNearestMsg(WORD, WORD, HWND, BOOL&);
LRESULT OnBnClickedNearestNumberedMsg(WORD, WORD, HWND, BOOL&);
@@ -91,6 +94,7 @@
//Property page notification handlers (override method)
int OnApply();
+ void OnHelp();
//Other functions
const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageNumbering"); }
Modified: trunk/src/view/visio/addon/pageutils.cpp
===================================================================
--- trunk/src/view/visio/addon/pageutils.cpp 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/pageutils.cpp 2010-08-11 21:27:12 UTC (rev 842)
@@ -146,11 +146,7 @@
double x = ( pre * (x3 - x4) - (x1 - x2) * post ) / d;
double y = ( pre * (y3 - y4) - (y1 - y2) * post ) / d;
- PVEC2 result = new VEC2();
- result->x = x;
- result->y = y;
-
- return result;
+ return new VEC2(x,y);;
}
// $Id$
Modified: trunk/src/view/visio/addon/pageutils.h
===================================================================
--- trunk/src/view/visio/addon/pageutils.h 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/pageutils.h 2010-08-11 21:27:12 UTC (rev 842)
@@ -95,7 +95,7 @@
/**
- * Returns intersection point between two lines represented by 4 points
+ * Returns intersection point between two vectors represented by 4 points
* @param p1 endpoint of the first line
* @param p2 beginpoint of the first line
* @param p3 endpoint of the second line
Modified: trunk/src/view/visio/addon/snapGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-08-11 21:27:12 UTC (rev 842)
@@ -19,7 +19,10 @@
#include "stdafx.h"
#include "snapGlobalDlg.h"
#include "errors.h"
+#include "data/msc.h"
+#include <htmlhelp.h>
+
BOOL CSnapGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
{
LoadRegistryData();
@@ -43,6 +46,22 @@
return PSNRET_NOERROR;
}
+void CSnapGlobalDlg::OnHelp()
+{
+ std::basic_string<TCHAR> path = GetVisioModulePath();
+ path += _T("scstudio.chm::/frontend/message-snapping.html");
+
+ try
+ {
+ m_vsoApp->InvokeHelp(path.c_str(), HH_DISPLAY_TOPIC, 1);
+ }
+ catch (_com_error &err)
+ {
+ std::wstring text = stringize() << _T("Cannot display help due to internal error: ") << err.Description();
+ MessageBox(text.c_str());
+ }
+}
+
int CSnapGlobalDlg::LoadRegistryData()
{
TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Loading options from registry"));
Modified: trunk/src/view/visio/addon/snapGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.h 2010-08-11 14:41:52 UTC (rev 841)
+++ trunk/src/view/visio/addon/snapGlobalDlg.h 2010-08-11 21:27:12 UTC (rev 842)
@@ -27,13 +27,16 @@
// include macro definition for registry folder
#include "dllmodule.h"
-class CSnapGlobalDlg:
- public CPropertyPageImpl<CSnapGlobalDlg>,
- public CWinDataExchange<CSnapGlobalDlg>
+class CSnapGlobalDlg: public CPropertyPageImpl<CSnapGlobalDlg>, public CWinDataExchange<CSnapGlobalDlg>
{
public:
enum { IDD = IDD_SNAP_GLOBAL };
+ CSnapGlobalDlg(Visio::IVApplicationPtr vsoApp):m_vsoApp(vsoApp)
+ { //set dialog properties
+ m_psp.dwFlags |= PSP_HASHELP;
+ };
+
protected:
BEGIN_MSG_MAP(CSnapGlobalDlg)
MSG_WM_INITDIALOG(OnInitDialog)
@@ -55,6 +58,8 @@
bool m_bOnlyOnLine;
int m_iRadioSelection;
+ Visio::IVApplicationPtr m_vsoApp;
+
void EnableControls(bool bEnable = true);
LRESULT OnBnClickedSnapEnabled(WORD, WORD, HWND, BOOL&);
@@ -64,6 +69,7 @@
//Property page notification handlers (override method)
int OnApply();
+ void OnHelp();
//Registry folder
const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageSnapping"); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-08-12 07:31:23
|
Revision: 843
http://scstudio.svn.sourceforge.net/scstudio/?rev=843&view=rev
Author: mbezdeka
Date: 2010-08-12 07:31:17 +0000 (Thu, 12 Aug 2010)
Log Message:
-----------
Message snapping:
- bug fixed (when shift or ctrl was pressed during selection, visio crashed)
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/addon.h
trunk/src/view/visio/addon/messageSnapping.cpp
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-08-11 21:27:12 UTC (rev 842)
+++ trunk/src/view/visio/addon/addon.cpp 2010-08-12 07:31:17 UTC (rev 843)
@@ -71,7 +71,7 @@
m_bBeginChanged = false;
m_bEndChanged = false;
m_bCtrlDown = false;
- m_bKeyDown = false;
+ m_bUpDownKeyDown = false;
m_bOnDropShape = false;
};
@@ -643,10 +643,11 @@
GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItems(true);
}
- //Message snapping
- if(vsoKeyboardEvent->KeyCode == VK_UP || vsoKeyboardEvent->KeyCode == VK_DOWN || m_bKeyDown == false)
+ //Keyboard re-snapping - get instances the messages are snapped to
+ if((vsoKeyboardEvent->KeyCode == VK_UP || vsoKeyboardEvent->KeyCode == VK_DOWN) && m_bUpDownKeyDown == false)
{
Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
+ m_bUpDownKeyDown = true;
for(int i=1; i<=selection->Count; i++)
snappedInstances.push_back(CMessageSnapping::getConnectedInstances(selection->Item[i]));
}
@@ -654,7 +655,6 @@
if(m_keyButtonState & visKeyControl)
m_bCtrlDown = true;
- m_bKeyDown = true;
}
void CStudioAddon::HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
@@ -674,13 +674,13 @@
GetDocumentMonitor(vsoApp, vsoApp->ActiveDocument)->ToggleToolbarItems(false);
}
- //Keyboard snapping
- if(m_bKeyDown)
+ //Keyboard re-snapping - resnap disconnected messages
+ if(m_bUpDownKeyDown)
{
for(int i=1; i<=vsoApp->ActiveWindow->Selection->Count; i++)
CMessageSnapping::resnap(vsoApp->ActiveWindow->Selection->Item[i], snappedInstances.at(i-1));
snappedInstances.clear();
- m_bKeyDown = false;
+ m_bUpDownKeyDown = false;
}
//Message snapping
@@ -729,7 +729,7 @@
////////////////////////////////////////////////////
//Message snapping
#define _u(x) CPageUtils::ConvertUnits(vsoApp, x, 0, visPageUnits)
- if(!m_bOnDropShape && m_bSnap && !m_bKeyDown && vsoApp->ActiveWindow->Selection->Count && CMessageSnapping::isEnabled())
+ if(!m_bOnDropShape && m_bSnap && !m_bUpDownKeyDown && vsoApp->ActiveWindow->Selection->Count && CMessageSnapping::isEnabled())
{
Visio::IVSelectionPtr selection = vsoApp->ActiveWindow->Selection;
CDocumentMonitor* docMon = GetDocumentMonitor(vsoApp,vsoApp->ActiveDocument);
Modified: trunk/src/view/visio/addon/addon.h
===================================================================
--- trunk/src/view/visio/addon/addon.h 2010-08-11 21:27:12 UTC (rev 842)
+++ trunk/src/view/visio/addon/addon.h 2010-08-12 07:31:17 UTC (rev 843)
@@ -155,7 +155,7 @@
bool m_bEndChanged;
bool m_bMoving;
bool m_bCtrlDown;
- bool m_bKeyDown;
+ bool m_bUpDownKeyDown;
bool m_bOnDropShape;
double m_mouseRelPosX;
double m_mouseRelPosY;
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-08-11 21:27:12 UTC (rev 842)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-08-12 07:31:17 UTC (rev 843)
@@ -423,7 +423,7 @@
bool CMessageSnapping::pointsEqual(VEC2 point1, VEC2 point2)
{
- return (abs(point1.x - point2.x) < 0.0000001) && (abs(point1.y - point2.y) < 0.0000001);
+ return (abs(point1.x - point2.x) < 0.00000001) && (abs(point1.y - point2.y) < 0.00000001);
}
// $Id$
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mbe...@us...> - 2010-08-13 22:23:44
|
Revision: 845
http://scstudio.svn.sourceforge.net/scstudio/?rev=845&view=rev
Author: mbezdeka
Date: 2010-08-13 22:23:37 +0000 (Fri, 13 Aug 2010)
Log Message:
-----------
Message Snapping:
- snapping works also for coregions now
Modified Paths:
--------------
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/messageSnapping.h
trunk/src/view/visio/addon/pageutils.cpp
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-08-12 13:01:59 UTC (rev 844)
+++ trunk/src/view/visio/addon/addon.cpp 2010-08-13 22:23:37 UTC (rev 845)
@@ -654,7 +654,6 @@
if(m_keyButtonState & visKeyControl)
m_bCtrlDown = true;
-
}
void CStudioAddon::HandleKeyUp(Visio::IVKeyboardEventPtr vsoKeyboardEvent, Visio::IVApplicationPtr vsoApp)
@@ -746,7 +745,7 @@
double newPosY = CShapeUtils::GetShapeCellProperty(msgShape,"PinY", visPageUnits);
newPosX += CPageUtils::ConvertUnits(vsoApp, m_mouseRelPosX, 0, visPageUnits);
newPosY += CPageUtils::ConvertUnits(vsoApp, m_mouseRelPosY, 0, visPageUnits);
- CMessageSnapping::autoSnapping(msgShape, newPosX, newPosY,CMessageSnapping::getSnapType()); //Do regular snapping
+ CMessageSnapping::snap(msgShape, newPosX, newPosY,CMessageSnapping::getSnapType()); //Do regular snapping
}
}
}
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-08-12 13:01:59 UTC (rev 844)
+++ trunk/src/view/visio/addon/document.cpp 2010-08-13 22:23:37 UTC (rev 845)
@@ -272,7 +272,7 @@
posX += CPageUtils::ConvertUnits(m_vsoApp, m_addon->GetRelMousePosX(), 0, visPageUnits);
m_vsoApp->EventsEnabled = false;
- CMessageSnapping::autoSnapping(vsoShape, posX, posY, CMessageSnapping::getSnapType());
+ CMessageSnapping::snap(vsoShape, posX, posY, CMessageSnapping::getSnapType());
m_vsoApp->EventsEnabled = true;
}
autoEnumerate(vsoShape);
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-08-12 13:01:59 UTC (rev 844)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-08-13 22:23:37 UTC (rev 845)
@@ -112,7 +112,12 @@
for(std::vector<Visio::IVShapePtr>::const_iterator it = instances.begin(); it != instances.end(); it++)
{
instBeginX = _ip("BeginX"); instBeginY = _ip("BeginY"); instEndX = _ip("EndX"); instEndY = _ip("EndY");
-
+ //Check rotation of instance...
+ if(instBeginY < instEndY)
+ {
+ std::swap(instBeginY,instEndY);
+ std::swap(instBeginX,instEndX);
+ }
//Get intersection point with instance
PVEC2 intPoint = NULL;
switch(snapType)
@@ -180,14 +185,6 @@
if(!leftInstance && !rightInstance)
return;
- //reverse instances if message is left headed arrow
- if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", visPageUnits) - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", visPageUnits)) < 0)
- {
- Visio::IVShapePtr buffer = leftInstance;
- leftInstance = rightInstance;
- rightInstance = buffer;
- }
-
double yLeftPos, yRightPos;
//Select where ends of message should be snapped
@@ -220,6 +217,19 @@
void CMessageSnapping::glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape,
const _bstr_t & msgCell, double yPos)
{
+ double posX = 0.0;
+ Visio::IVShapePtr coregion;
+ //If instance include coregion, check for intersection with message
+ coregion = getCoregionAt(instanceShape, yPos);
+ if(coregion)
+ {
+ instanceShape = coregion;
+ if(getMsgDirection(msgShape) == MSDIR_RIGHT)
+ posX = (_tcsicmp(msgCell,_T("BeginX")) == 0) ? 1.0 : 0.0;
+ else
+ posX = (_tcsicmp(msgCell,_T("BeginX")) == 0) ? 0.0 : 1.0;
+ }
+
double InstBegY = CShapeUtils::GetShapeCellProperty(instanceShape, "BeginY", visPageUnits);
double InstEndY = CShapeUtils::GetShapeCellProperty(instanceShape, "EndY", visPageUnits);
@@ -231,7 +241,7 @@
return;
msgShape->Application->EventsEnabled = false;
- msgShape->Cells[msgCell]->GlueToPos(instanceShape,msgOffset/sizeOfInstance,0.0);
+ msgShape->Cells[msgCell]->GlueToPos(instanceShape,msgOffset/sizeOfInstance,posX);
msgShape->Application->EventsEnabled = true;
}
@@ -252,11 +262,30 @@
#undef _s
#undef _i
+ //FIXME: if coregion is oblique, snapping isn't always correct
+ if(get_shape_type(instanceShape) == ST_BMSC_COREGION)
+ {
+ //if msg is left, flip x-coord
+ if(p1.x < p2.x)
+ {
+ std::swap(p1.x,p2.x);
+ std::swap(p1.y,p2.y);
+ }
+ double offsetX = CShapeUtils::GetShapeCellProperty(instanceShape, "Height", visPageUnits) / 2.0;
+ offsetX *= (p2.x > p4.x) ? 1 : -1;
+
+ p4.x += offsetX;
+ p3.x += offsetX;
+ }
+
PVEC2 result = CPageUtils::getIntersectionPoint(p1, p2, p3, p4);
if(!result)
return NULL;
+ //Swap y coord if instance is upside down
+ if(p4.y < p3.y)
+ std::swap(p4.y,p3.y);
//Check if it's outside of instance
if(result->y > p4.y || result->y < p3.y)
return NULL;
@@ -297,9 +326,9 @@
return true;
}
-void CMessageSnapping::autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY, MsgSnapType snapType)
+void CMessageSnapping::snap(Visio::IVShapePtr msgShape, double posX, double posY, MsgSnapType snapType)
{
- long scopeID = msgShape->Application->BeginUndoScope(_T("AutoSnapping"));
+ long scopeID = msgShape->Application->BeginUndoScope(_T("snap"));
#define _sp(x) CShapeUtils::GetShapeCellProperty(msgShape, x, visPageUnits)
//Step 1: Check snap type
@@ -336,21 +365,21 @@
else
closestInst = getClosestInstancePair(msgShape, posX, posY, instShapes, snapType);
- //Step 5:Glue to them
+ //Step 5: If message is left-oriented switch pointers
+ if(getMsgDirection(msgShape) == MSDIR_LEFT)
+ {
+ Visio::IVShapePtr buffer = closestInst.first;
+ closestInst.first = closestInst.second;
+ closestInst.second = buffer;
+ }
+
+ //Step 6:Glue to them
glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second, posY, snapType);
- //Step 6: Do some corrections if only one of instances intersect //FIXME: Cut to functions
+ //Step 7: Do some corrections if only one of instances intersect //FIXME: Cut to functions
if(closestInst.first ^ closestInst.second)
- {
- //Step 6.1: If message is left-oriented switch pointers
- if(_sp("EndX") < _sp("BeginX"))
- {
- Visio::IVShapePtr buffer = closestInst.first;
- closestInst.first = closestInst.second;
- closestInst.second = buffer;
- }
-
- //Step 6.2: Straighten messages when it's snapped only to one instance (must disable events, because CellChanged would be triggered)
+ {
+ //Step 7.1: Straighten messages when it's snapped only to one instance (must disable events, because CellChanged would be triggered)
if(snapType == MSSNAP_STRAIGHTEN)
{
msgShape->Application->EventsEnabled = false;
@@ -361,7 +390,7 @@
msgShape->Application->EventsEnabled = true;
}
- //Step 6.3: If message is snapped only to one instance, preserve its length
+ //Step 7.2: If message is snapped only to one instance, preserve its length
msgShape->Application->EventsEnabled = false;
if(closestInst.first) //LEFT point is snapped, adjust right point
{
@@ -392,7 +421,6 @@
{
Visio::IVConnectPtr conItem = conns->Item[i];
Visio::IVCellPtr instCell = conItem->ToCell;
-
instances.push_back(instCell->Shape);
}
return instances;
@@ -400,6 +428,8 @@
bool CMessageSnapping::resnap(Visio::IVShapePtr msgShape, std::vector<Visio::IVShapePtr> instances)
{
+ long scopeId = msgShape->Application->BeginUndoScope(_T("resnap"));
+
VEC2 beginPoint = VEC2(msgShape->Cells["BeginX"]->Result[visPageUnits], msgShape->Cells["BeginY"]->Result[visPageUnits]);
VEC2 endPoint = VEC2(msgShape->Cells["EndX"]->Result[visPageUnits], msgShape->Cells["EndY"]->Result[visPageUnits]);
@@ -418,6 +448,8 @@
}
delete bufferPoint;
}
+ msgShape->Application->EndUndoScope(scopeId,true);
+
return true;
}
@@ -426,4 +458,44 @@
return (abs(point1.x - point2.x) < 0.00000001) && (abs(point1.y - point2.y) < 0.00000001);
}
+Visio::IVShapePtr CMessageSnapping::getCoregionAt(Visio::IVShapePtr instShape, double yPos)
+{
+ if(get_shape_type(instShape) == ST_BMSC_COREGION)
+ {
+ double beginY = CShapeUtils::GetShapeCellProperty(instShape, "BeginY", visPageUnits);
+ double endY = CShapeUtils::GetShapeCellProperty(instShape, "EndY", visPageUnits);
+ if(beginY < endY)
+ std::swap(beginY, endY);
+ if( (yPos <= beginY) && (yPos >= endY) ) //check boundaries
+ return instShape;
+
+ return NULL;
+ }
+
+ Visio::IVConnectsPtr conns = instShape->FromConnects;
+
+ for(int i = 1; i <= conns->Count; i++)
+ {
+ Visio::IVShapePtr shape = conns->Item[i]->FromSheet;
+ if(get_shape_type(shape) != ST_BMSC_COREGION)
+ continue;
+
+ double beginY = CShapeUtils::GetShapeCellProperty(shape, "BeginY", visPageUnits); //NOTE: in page units, begin is bigger number than end
+ double endY = CShapeUtils::GetShapeCellProperty(shape, "EndY", visPageUnits);
+ if(beginY < endY)
+ std::swap(beginY, endY);
+ if( (yPos <= beginY) && (yPos >= endY) )
+ return shape;
+ }
+
+ return NULL;
+}
+
+MsgSeqDirection CMessageSnapping::getMsgDirection(Visio::IVShapePtr msgShape)
+{
+ double BeginX = CShapeUtils::GetShapeCellProperty(msgShape,"BeginX", visPageUnits);
+ double EndX = CShapeUtils::GetShapeCellProperty(msgShape,"EndX", visPageUnits);
+
+ return (BeginX < EndX) ? MSDIR_RIGHT : MSDIR_LEFT;
+}
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/messageSnapping.h
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.h 2010-08-12 13:01:59 UTC (rev 844)
+++ trunk/src/view/visio/addon/messageSnapping.h 2010-08-13 22:23:37 UTC (rev 845)
@@ -20,6 +20,7 @@
#include <utility>
#include <vector>
#include "enums.h"
+#include "extract.h"
#include "pageutils.h"
class CMessageSnapping
@@ -77,13 +78,12 @@
* @param posY MouseY position for closest instances computing
*/
//FIXME: Change return type to bool
- static void autoSnapping(Visio::IVShapePtr msgShape, double posX, double posY, MsgSnapType snapType);
+ static void snap(Visio::IVShapePtr msgShape, double posX, double posY, MsgSnapType snapType);
/*
* Snap message to instaces whether its enpoints are on the instance's line
*/
static bool resnap(Visio::IVShapePtr msgShape, std::vector<Visio::IVShapePtr> instances);
-
/*
* Get all instances the given message is connected to
*/
@@ -92,7 +92,15 @@
*
*/
static bool pointsEqual(VEC2 point1, VEC2 point2);
-
+ /*
+ * The very same function as CShapeUtils::getCoregionAt but yPos is in page units!
+ */
+ static Visio::IVShapePtr getCoregionAt(Visio::IVShapePtr instShape, double yPos);
+ /*
+ * Returns the direction of given message
+ */
+ static MsgSeqDirection getMsgDirection(Visio::IVShapePtr msgShape);
+
};
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/pageutils.cpp
===================================================================
--- trunk/src/view/visio/addon/pageutils.cpp 2010-08-12 13:01:59 UTC (rev 844)
+++ trunk/src/view/visio/addon/pageutils.cpp 2010-08-13 22:23:37 UTC (rev 845)
@@ -146,7 +146,7 @@
double x = ( pre * (x3 - x4) - (x1 - x2) * post ) / d;
double y = ( pre * (y3 - y4) - (y1 - y2) * post ) / d;
- return new VEC2(x,y);;
+ return new VEC2(x,y);
}
// $Id$
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|