|
From: <mbe...@us...> - 2010-07-11 22:04:26
|
Revision: 832
http://scstudio.svn.sourceforge.net/scstudio/?rev=832&view=rev
Author: mbezdeka
Date: 2010-07-11 22:04:20 +0000 (Sun, 11 Jul 2010)
Log Message:
-----------
Message snapping
- bugs fixed
- GUI improvements
- part of help added
Modified Paths:
--------------
trunk/doc/help/frontend.html
trunk/doc/help/scstudio.hhc
trunk/src/view/visio/addon/addon.cpp
trunk/src/view/visio/addon/dllmodule.rc
trunk/src/view/visio/addon/document.cpp
trunk/src/view/visio/addon/messageSnapping.cpp
trunk/src/view/visio/addon/messageSnapping.h
trunk/src/view/visio/addon/resource.h
trunk/src/view/visio/addon/shapeutils.h
trunk/src/view/visio/addon/snapGlobalDlg.cpp
trunk/src/view/visio/addon/snapGlobalDlg.h
Added Paths:
-----------
trunk/doc/help/frontend/message-snapping.html
Added: trunk/doc/help/frontend/message-snapping.html
===================================================================
--- trunk/doc/help/frontend/message-snapping.html (rev 0)
+++ trunk/doc/help/frontend/message-snapping.html 2010-07-11 22:04:20 UTC (rev 832)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Message Snapping – SCStudio frontend</title>
+<link href="../help.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+<h1>Message Snapping</h1>
+<p>When message is dropped onto drawing a user have to connect message to instances manually. If Message snapping is enabled, messages are automatically snapped to nearest instances when user release a mouse button.</p>
+
Modified: trunk/doc/help/frontend.html
===================================================================
--- trunk/doc/help/frontend.html 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/doc/help/frontend.html 2010-07-11 22:04:20 UTC (rev 832)
@@ -18,6 +18,7 @@
<li><a href="frontend/shape-selection.html">Shape selection</a></li>
<li><a href="frontend/automatic-drawing.html">Automatic drawing</a></li>
<li><a href="frontend/message-numbering.html">Message numbering</a></li>
+<li><a href="frontend/message-snapping.html">Message snapping</a></li>
</ul>
<p>Many SCStudio functions define their own keyboard accelerators.
Modified: trunk/doc/help/scstudio.hhc
===================================================================
--- trunk/doc/help/scstudio.hhc 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/doc/help/scstudio.hhc 2010-07-11 22:04:20 UTC (rev 832)
@@ -26,6 +26,10 @@
<param name="Local" value="frontend\message-numbering.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
+ <param name="Name" value="Message Snapping">
+ <param name="Local" value="frontend\message-snapping.html">
+ </OBJECT>
+ <LI> <OBJECT type="text/sitemap">
<param name="Name" value="Keyboard accelerators">
<param name="Local" value="frontend\shortcuts.html">
</OBJECT>
Modified: trunk/src/view/visio/addon/addon.cpp
===================================================================
--- trunk/src/view/visio/addon/addon.cpp 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/addon.cpp 2010-07-11 22:04:20 UTC (rev 832)
@@ -498,7 +498,7 @@
break;
case visEvtApp+visEvtNonePending:
- TRACE("CStudioAddon::HandleVisioEvent() visEvtNonePending");
+ //TRACE("CStudioAddon::HandleVisioEvent() visEvtNonePending");
HandleNonePending(pSourceObj);
break;
Modified: trunk/src/view/visio/addon/dllmodule.rc
===================================================================
--- trunk/src/view/visio/addon/dllmodule.rc 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/dllmodule.rc 2010-07-11 22:04:20 UTC (rev 832)
@@ -224,12 +224,21 @@
GROUPBOX "If no nearest (numbered) message found:",IDC_STATIC,7,65,261,54,WS_GROUP
END
-IDD_SNAP_GLOBAL DIALOGEX 0, 0, 200, 98
+IDD_SNAP_GLOBAL DIALOGEX 0, 0, 275, 118
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- CONTROL "Enable message snapping",IDC_SNAP_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,98,10
+ CONTROL "Enable snapping to instances for new messages",IDC_SNAP_ENABLED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,169,10
+ GROUPBOX "General",IDC_STATIC,7,22,261,30
+ CONTROL "Adjust snapping only to instance's line",IDC_ONLY_ON_LINE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,34,137,10
+ GROUPBOX "Message options",IDC_STATIC,7,58,261,34
+ COMBOBOX IDC_MSG_TYPE,13,71,94,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ LTEXT "snap to ",IDC_STATIC,113,71,26,12,SS_CENTERIMAGE
+ CONTROL "left instace,",IDC_LEFT_INST_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,71,51,12
+ CONTROL "right instace",IDC_RIGHT_INST_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,71,54,12
END
@@ -301,9 +310,14 @@
IDD_SNAP_GLOBAL, DIALOG
BEGIN
LEFTMARGIN, 7
- RIGHTMARGIN, 193
+ RIGHTMARGIN, 268
+ VERTGUIDE, 13
TOPMARGIN, 7
- BOTTOMMARGIN, 91
+ BOTTOMMARGIN, 111
+ HORZGUIDE, 34
+ HORZGUIDE, 44
+ HORZGUIDE, 71
+ HORZGUIDE, 83
END
END
#endif // APSTUDIO_INVOKED
@@ -414,7 +428,20 @@
0
END
+IDD_SNAP_GLOBAL DLGINIT
+BEGIN
+ IDC_MSG_TYPE, 0x403, 13, 0
+0x654c, 0x7466, 0x4d20, 0x7365, 0x6173, 0x6567, "\000"
+ IDC_MSG_TYPE, 0x403, 14, 0
+0x6952, 0x6867, 0x2074, 0x654d, 0x7373, 0x6761, 0x0065,
+ IDC_MSG_TYPE, 0x403, 14, 0
+0x6f46, 0x6e75, 0x2064, 0x654d, 0x7373, 0x6761, 0x0065,
+ IDC_MSG_TYPE, 0x403, 13, 0
+0x6f4c, 0x7473, 0x4d20, 0x7365, 0x6173, 0x6567, "\000"
+ 0
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// String Table
Modified: trunk/src/view/visio/addon/document.cpp
===================================================================
--- trunk/src/view/visio/addon/document.cpp 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/document.cpp 2010-07-11 22:04:20 UTC (rev 832)
@@ -262,8 +262,8 @@
case ST_BMSC_MESSAGE_FOUND:
if(vsoShape->Text.length() == 0)
vsoShape->Text = _T("NAME");
+ autoSnapping(vsoShape);
autoEnumerate(vsoShape);
- autoSnapping(vsoShape);
break;
case ST_COMMENT:
@@ -499,7 +499,6 @@
itemCheckOptions->AddOnName = ADDON_NAME;
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;
@@ -595,8 +594,8 @@
m_selAddMessagesToolbarItem->IconFileName(vslIconFile.c_str());
m_selAddMessagesToolbarItem->Visible = false;
-
Visio::IVToolbarItemPtr itemFindFlow = m_toolbar->ToolbarItems->Add();
+ itemFindFlow->BeginGroup = true;
itemFindFlow->Caption = "Find Flow";
itemFindFlow->AddOnName = ADDON_NAME;
itemFindFlow->AddOnArgs = stringize() << L"/event=" << MENU_FIND_FLOW;
@@ -625,6 +624,7 @@
m_simulationStopToolbarItem->IconFileName(vslIconFile.c_str());
m_enableMessageEnumerationToolbarItem = m_toolbar->ToolbarItems->Add();
+ m_enableMessageEnumerationToolbarItem->BeginGroup = true;
m_enableMessageEnumerationToolbarItem->Caption = "Message numbering";
m_enableMessageEnumerationToolbarItem->AddOnName = ADDON_NAME;
m_enableMessageEnumerationToolbarItem->AddOnArgs = stringize() << L"/event=" << MENU_ENABLE_MESSAGE_ENUMERATION;
@@ -2143,7 +2143,9 @@
//Step 3: Get the closest instance on the left and on the right
std::pair<Visio::IVShapePtr,Visio::IVShapePtr> closestInst = CMessageSnapping::getClosestInstancePair(msgShape, instShapes);
//Step 4:Glue to them
- CMessageSnapping::glueMsgToInstances(msgShape, closestInst.first, closestInst.second);
+ const TCHAR* regFolder = _T("Software\\Sequence Chart Studio\\MessageSnapping");
+ bool bOnlyOnLine = GetRegistry<bool>(regFolder, NULL, _T("OnlyOnLine"), false);
+ CMessageSnapping::glueMsgToInstancesPair(msgShape, closestInst.first, closestInst.second, bOnlyOnLine);
}
// $Id$
Modified: trunk/src/view/visio/addon/messageSnapping.cpp
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/messageSnapping.cpp 2010-07-11 22:04:20 UTC (rev 832)
@@ -1,20 +1,20 @@
/*
- * 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$
- */
+* 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"
@@ -38,22 +38,22 @@
Visio::IVShapesPtr shapesOnPage = vsoApp->ActivePage->Shapes;
double InstBegY, InstEndY;
- double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", "mm");
-
+ double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
+
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");
+ InstBegY = CShapeUtils::GetShapeCellProperty(shape, "BeginY", visPageUnits);
+ InstEndY = CShapeUtils::GetShapeCellProperty(shape, "EndY", visPageUnits);
//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))
+ if((InstBegY >= msgPinY) && (InstEndY <= msgPinY))
instShapes.push_back(shape);
}
}
@@ -62,9 +62,10 @@
}
std::pair<Visio::IVShapePtr, Visio::IVShapePtr> CMessageSnapping::getClosestInstancePair(Visio::IVShapePtr msgShape,
- const std::vector<Visio::IVShapePtr>& instances)
+ const std::vector<Visio::IVShapePtr>& instances)
{
- double msgPinX = CShapeUtils::GetShapeCellProperty(msgShape, "PinX", "mm");
+ //TODO: try to find a way how to get closest instance better when it is in diagonal position
+ double msgPinX = CShapeUtils::GetShapeCellProperty(msgShape, "PinX", visPageUnits);
Visio::IVShapePtr leftClosestInstance = NULL;
Visio::IVShapePtr rightClosestInstance = NULL;
@@ -75,11 +76,11 @@
for(std::vector<Visio::IVShapePtr>::const_iterator it = instances.begin(); it != instances.end(); it++)
{
- instPinX = CShapeUtils::GetShapeCellProperty((*it),"PinX","mm");
+ instPinX = CShapeUtils::GetShapeCellProperty((*it),"PinX", visPageUnits);
distance = msgPinX - instPinX;
if(distance < 0)
{
- if(!rightClosestInstance || distance > rightClosestInstanceDist) //NOTE: Distance must be bigger, becaouse numbers are negative
+ if(!rightClosestInstance || distance > rightClosestInstanceDist) //NOTE: Distance must be bigger, because numbers are negative
{
rightClosestInstance = (*it);
rightClosestInstanceDist = distance;
@@ -98,12 +99,12 @@
return std::pair<Visio::IVShapePtr, Visio::IVShapePtr>(leftClosestInstance,rightClosestInstance);
}
-void CMessageSnapping::glueMsgToInstances(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance)
+void CMessageSnapping::glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance, bool onlyOnInstanceLine)
{
- double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", "mm");
+ double msgPinY = CShapeUtils::GetShapeCellProperty(msgShape, "PinY", visPageUnits);
//reverse instances if message is left headed arrow
- if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", "mm") - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", "mm")) < 0)
+ if((CShapeUtils::GetShapeCellProperty(msgShape, "EndX", visPageUnits) - CShapeUtils::GetShapeCellProperty(msgShape, "BeginX", visPageUnits)) < 0)
{
Visio::IVShapePtr buffer = leftInstance;
leftInstance = rightInstance;
@@ -120,25 +121,40 @@
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);
- }
+ glueMsgToInstance(msgShape, leftInstance, "BeginX", msgPinY, onlyOnInstanceLine);
//Glue to right instance
if(rightInstance)
+ glueMsgToInstance(msgShape, rightInstance, "EndX", msgPinY, onlyOnInstanceLine);
+}
+
+void CMessageSnapping::glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape,
+ const _bstr_t & msgCell, double yPos, bool onlyOnInstanceLine)
+{
+ //Get values from cells
+ double 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);
+
+ double sizeOfInstance = fabs(InstBegY - InstEndY);
+ double msgOffset = fabs(InstBegY - yPos);
+
+ //avoid division by zero - when instances are in horizontal position
+ if(sizeOfInstance == 0)
+ return;
+
+ //Glue to position, if message is too close to "rectangles" on the instance it will be moved below them
+ if(onlyOnInstanceLine)
{
- 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);
+ if(msgOffset < InstOffsetLeft)
+ msgOffset = InstOffsetLeft;
+ else if(msgOffset > (sizeOfInstance - InstOffsetLeft))
+ msgOffset = sizeOfInstance - InstOffsetLeft;
}
+
+ msgShape->Cells[msgCell]->GlueToPos(instanceShape,msgOffset/sizeOfInstance,0.0);
}
// $Id$
\ No newline at end of file
Modified: trunk/src/view/visio/addon/messageSnapping.h
===================================================================
--- trunk/src/view/visio/addon/messageSnapping.h 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/messageSnapping.h 2010-07-11 22:04:20 UTC (rev 832)
@@ -28,6 +28,7 @@
/*
* Get All instances that intersect HORIZONTAL line of current msg
* returns vector of pointers to instances, if zero, there are no intersecting instances
+ * Intersect instances are meant without their rectangles on the top and on the bottom
*/
static std::vector<Visio::IVShapePtr> getIntersectInstances(Visio::IVShapePtr msgShape);
/*
@@ -35,10 +36,19 @@
*/
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
+ * Glue given message on the given instances
+ * If leftInstance or rightInstance is NULL, message will be connected only to not null one
* designed only for horizontal messages (diagonal messages will be snapped according their PinX point and reformed to horizontal messages)
+ * @param onlyOnInstanceLine if true avoid connection message on instace's "rectangles" on the top and the bottom
*/
- static void glueMsgToInstances(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance);
+ static void glueMsgToInstancesPair(Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance, bool onlyOnInstanceLine);
+ /*
+ * Glue given message to instance
+ * @param msgCell message cell which should be glued (e.g. BeginX, EndY)
+ * @param yPos vertical position where to glue message to instance (in page units - visPageUnits)
+ * @param onlyOnInstanceLine if true avoid connection message on instace's "rectangles" on the top and the bottom
+ */
+ static void glueMsgToInstance(Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape, const _bstr_t & msgCell, double yPos, bool onlyOnInstanceLine);
};
Modified: trunk/src/view/visio/addon/resource.h
===================================================================
--- trunk/src/view/visio/addon/resource.h 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/resource.h 2010-07-11 22:04:20 UTC (rev 832)
@@ -97,6 +97,7 @@
#define IDC_MS_CONNECT_WITH_SIDE_SIDE 269
#define IDC_CHECK2 271
#define IDC_ENUM_CHECK 271
+#define IDC_ONLY_ON_LINE 271
#define IDC_RADIO4 273
#define IDC_USE_NUMBERING_STYLE 273
#define IDC_COMBO_NUMBERING_GLOBAL 276
@@ -104,14 +105,18 @@
#define IDC_STARTING_INDEX_GLOBAL 278
#define IDC_CHECK1 279
#define IDC_SNAP_ENABLED 279
+#define IDC_MSG_TYPE 282
+#define IDC_LEFT_INST_CHECK 285
+#define IDC_RIGHT_INST_CHECK 286
+#define IDC_CUSTOM1 287
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 228
+#define _APS_NEXT_RESOURCE_VALUE 229
#define _APS_NEXT_COMMAND_VALUE 32768
-#define _APS_NEXT_CONTROL_VALUE 280
+#define _APS_NEXT_CONTROL_VALUE 288
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/shapeutils.h 2010-07-11 22:04:20 UTC (rev 832)
@@ -13,7 +13,7 @@
*
* Copyright (c) 2010 Ondrej Bouda <ond...@wh...>
*
- * $$
+ * $Id$
*/
#pragma once
@@ -35,7 +35,7 @@
static double GetShapeBeginY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[""]; }
static double GetShapeEndY(Visio::IVShapePtr shape) { return shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[""]; }
- static double GetShapeCellProperty(Visio::IVShapePtr shape, const _bstr_t & propertyName, const _bstr_t & units)
+ static double GetShapeCellProperty(Visio::IVShapePtr shape, const _bstr_t & propertyName, VisUnitCodes units)
{ return shape->Cells[propertyName]->Result[units]; }
static void GlueBeginToPos(Visio::IVShapePtr what, Visio::IVShapePtr where, const MscPoint& pos);
Modified: trunk/src/view/visio/addon/snapGlobalDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/snapGlobalDlg.cpp 2010-07-11 22:04:20 UTC (rev 832)
@@ -23,10 +23,12 @@
BOOL CSnapGlobalDlg::OnInitDialog(HWND hWndFocus, LPARAM lParam)
{
LoadRegistryData();
-
//Move values in variables into controls
DoDataExchange(FALSE);
+ //Enable/disable controls on the dialog
+ EnableControls(m_bSnapEnabled);
+
return TRUE;
}
@@ -45,6 +47,7 @@
{
TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Loading options from registry"));
m_bSnapEnabled = GetRegistry<bool>(GetRegistryFolder(), NULL, _T("SnapEnabled"), false);
+ m_bOnlyOnLine = GetRegistry<bool>(GetRegistryFolder(), NULL, _T("OnlyOnLine"), false);
return 0;
}
@@ -52,8 +55,24 @@
{
TRACE(_T("CSnapGlobalDlg::LoadRegistryData() - Saving options to registry"));
SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("SnapEnabled"), m_bSnapEnabled);
+ SetRegistry<bool>(HKEY_CURRENT_USER, GetRegistryFolder(), _T("OnlyOnLine"), m_bOnlyOnLine);
return 0;
}
+void CSnapGlobalDlg::EnableControls(bool bEnable)
+{
+ GetDlgItem(IDC_ONLY_ON_LINE).EnableWindow(bEnable);
+ GetDlgItem(IDC_MSG_TYPE).EnableWindow(bEnable);
+ GetDlgItem(IDC_LEFT_INST_CHECK).EnableWindow(bEnable);
+ GetDlgItem(IDC_RIGHT_INST_CHECK).EnableWindow(bEnable);
+}
-// $Id$
\ No newline at end of file
+LRESULT CSnapGlobalDlg::OnBnClickedSnapEnabled(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
+{
+ DoDataExchange(TRUE);
+ EnableControls(m_bSnapEnabled);
+
+ return 0;
+}
+
+// $Id$
Modified: trunk/src/view/visio/addon/snapGlobalDlg.h
===================================================================
--- trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-09 11:20:45 UTC (rev 831)
+++ trunk/src/view/visio/addon/snapGlobalDlg.h 2010-07-11 22:04:20 UTC (rev 832)
@@ -37,12 +37,14 @@
protected:
BEGIN_MSG_MAP(CSnapGlobalDlg)
MSG_WM_INITDIALOG(OnInitDialog)
+ COMMAND_HANDLER(IDC_SNAP_ENABLED, BN_CLICKED, OnBnClickedSnapEnabled)
CHAIN_MSG_MAP(CPropertyPageImpl<CSnapGlobalDlg>)
END_MSG_MAP()
BEGIN_DDX_MAP(CSnapGlobalDlg)
DDX_CHECK(IDC_SNAP_ENABLED, m_bSnapEnabled);
+ DDX_CHECK(IDC_ONLY_ON_LINE, m_bOnlyOnLine);
END_DDX_MAP()
int LoadRegistryData();
@@ -50,7 +52,11 @@
//Member variables
bool m_bSnapEnabled;
+ bool m_bOnlyOnLine;
+ void EnableControls(bool bEnable = true);
+ LRESULT OnBnClickedSnapEnabled(WORD, WORD, HWND, BOOL&);
+
public:
//Message handlers
BOOL OnInitDialog(HWND hWndFocus, LPARAM lParam);
@@ -60,7 +66,6 @@
//Registry folder
const wchar_t* GetRegistryFolder() { return SCSTUDIO_REGISTRY_ROOT _T("\\MessageSnapping"); }
-
};
// $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.
|