From: <ob...@us...> - 2010-02-22 02:39:11
|
Revision: 612 http://scstudio.svn.sourceforge.net/scstudio/?rev=612&view=rev Author: obouda Date: 2010-02-22 02:39:03 +0000 (Mon, 22 Feb 2010) Log Message: ----------- Added functionality and toolbar buttons for adding all instances/messages to the current selection (as opposed to selecting all instances/messages, when the old selection is dropped) Modified Paths: -------------- trunk/src/view/visio/addon/addon.cpp trunk/src/view/visio/addon/dllmodule.rc trunk/src/view/visio/addon/document.cpp trunk/src/view/visio/addon/document.h trunk/src/view/visio/addon/resource.h trunk/src/view/visio/addon/scstudio.vcproj Added Paths: ----------- trunk/src/view/visio/addon/icon_select_add_instances.ico trunk/src/view/visio/addon/icon_select_add_messages.ico Modified: trunk/src/view/visio/addon/addon.cpp =================================================================== --- trunk/src/view/visio/addon/addon.cpp 2010-02-22 00:01:01 UTC (rev 611) +++ trunk/src/view/visio/addon/addon.cpp 2010-02-22 02:39:03 UTC (rev 612) @@ -296,6 +296,12 @@ case CDocumentMonitor::MENU_SELECT_ALL_MESSAGES: TRACE("CStudioAddon::Run() menu item 'Check--Drawing--Select--All Messages'"); return pDocumentMonitor->OnMenuSelectAllMessages(vsoApp); + case CDocumentMonitor::MENU_SELECT_ADD_ALL_INSTANCES: + TRACE("CStudioAddon::Run() add all instances to the current selection"); + return pDocumentMonitor->OnMenuSelectAddAllInstances(vsoApp); + case CDocumentMonitor::MENU_SELECT_ADD_ALL_MESSAGES: + TRACE("CStudioAddon::Run() add all messages to the current selection"); + return pDocumentMonitor->OnMenuSelectAddAllMessages(vsoApp); default: TRACE("CStudioAddon::Run() unexpected event id=" << iEvent); Modified: trunk/src/view/visio/addon/dllmodule.rc =================================================================== --- trunk/src/view/visio/addon/dllmodule.rc 2010-02-22 00:01:01 UTC (rev 611) +++ trunk/src/view/visio/addon/dllmodule.rc 2010-02-22 02:39:03 UTC (rev 612) @@ -190,6 +190,8 @@ IDI_ICON_SELECT_MESSAGES ICON "icon_select_messages.ico" IDI_ICON_SIMULATION_START ICON "icon_simulation_start.ico" IDI_ICON_SIMULATION_STOP ICON "icon_simulation_stop.ico" +IDI_ICON_SELECT_ADD_INSTANCES ICON "icon_select_add_instances.ico" +IDI_ICON_SELECT_ADD_MESSAGES ICON "icon_select_add_messages.ico" ///////////////////////////////////////////////////////////////////////////// // Modified: trunk/src/view/visio/addon/document.cpp =================================================================== --- trunk/src/view/visio/addon/document.cpp 2010-02-22 00:01:01 UTC (rev 611) +++ trunk/src/view/visio/addon/document.cpp 2010-02-22 02:39:03 UTC (rev 612) @@ -488,21 +488,36 @@ std::basic_string<TCHAR> vslFileName = GetVisioModuleFileName(); std::basic_string<TCHAR> vslIconFile; - Visio::IVToolbarItemPtr toolbarItem1 = toolbar->ToolbarItems->Add(); - toolbarItem1->Caption = "Select All Instances"; - toolbarItem1->AddOnName = ADDON_NAME; - toolbarItem1->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_INSTANCES; + Visio::IVToolbarItemPtr itemSelInstances = toolbar->ToolbarItems->Add(); + itemSelInstances->Caption = "Select All Instances"; + itemSelInstances->AddOnName = ADDON_NAME; + itemSelInstances->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_INSTANCES; vslIconFile = vslFileName+_T(",2"); - toolbarItem1->IconFileName(vslIconFile.c_str()); - toolbarItem1->BeginGroup = true; + itemSelInstances->IconFileName(vslIconFile.c_str()); + itemSelInstances->BeginGroup = true; - Visio::IVToolbarItemPtr toolbarItem2 = toolbar->ToolbarItems->Add(); - toolbarItem2->Caption = "Select All Messages"; - toolbarItem2->AddOnName = ADDON_NAME; - toolbarItem2->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_MESSAGES; + Visio::IVToolbarItemPtr itemSelMessages = toolbar->ToolbarItems->Add(); + itemSelMessages->Caption = "Select All Messages"; + itemSelMessages->AddOnName = ADDON_NAME; + itemSelMessages->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ALL_MESSAGES; vslIconFile = vslFileName+_T(",3"); - toolbarItem2->IconFileName(vslIconFile.c_str()); + itemSelMessages->IconFileName(vslIconFile.c_str()); + Visio::IVToolbarItemPtr itemAddInstances = toolbar->ToolbarItems->Add(); + itemAddInstances->Caption = "Add All Instances To Selection"; + itemAddInstances->AddOnName = ADDON_NAME; + itemAddInstances->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ADD_ALL_INSTANCES; + vslIconFile = vslFileName+_T(",6"); + itemAddInstances->IconFileName(vslIconFile.c_str()); + + Visio::IVToolbarItemPtr itemAddMessages = toolbar->ToolbarItems->Add(); + itemAddMessages->Caption = "Add All Messages To Selection"; + itemAddMessages->AddOnName = ADDON_NAME; + itemAddMessages->AddOnArgs = stringize() << L"/event=" << MENU_SELECT_ADD_ALL_MESSAGES; + vslIconFile = vslFileName+_T(",7"); + itemAddMessages->IconFileName(vslIconFile.c_str()); + + Visio::IVToolbarItemPtr itemFindFlow = toolbar->ToolbarItems->Add(); itemFindFlow->Caption = "Find Flow"; itemFindFlow->AddOnName = ADDON_NAME; @@ -820,14 +835,22 @@ return VAORC_SUCCESS; } -// TODO: Doxygen comment -// for select_instances = true, selects all instances on the active page -// for select_instances = false, selects all messages (including lost and found messages) on the active page -void CDocumentMonitor::selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances) +/** + * Selects all instances or all messages on the active page. + * @param vsoApp the application to make selection in + * @param select_instances when true, selects all instances, + * when false, selects all messages (including lost and found messages) + * @param add_to_selection when true, adds all objects to existing selection, + * when false, the old selection is dropped + */ +void CDocumentMonitor::selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, bool add_to_selection) { Visio::IVPagePtr page = vsoApp->ActivePage; - Visio::IVSelectionPtr selection = - page->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper); + Visio::IVSelectionPtr selection; + if (add_to_selection) + selection = vsoApp->ActiveWindow->Selection; + else + selection = page->CreateSelection(Visio::visSelTypeEmpty, Visio::visSelModeSkipSuper); for(int i=1; i<=page->Shapes->Count; i++) { @@ -848,25 +871,32 @@ } vsoApp->ActiveWindow->Selection = selection; -/* - // TODO: do stavoveho radku - m_reportView->Print(RS_NOTICE, - stringize() << "Selected " << selection->Count << " shape(s)"); -*/ } VAORC CDocumentMonitor::OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp) { - selectAll(vsoApp, true); + selectAll(vsoApp, true, false); return VAORC_SUCCESS; } VAORC CDocumentMonitor::OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp) { - selectAll(vsoApp, false); + selectAll(vsoApp, false, false); return VAORC_SUCCESS; } +VAORC CDocumentMonitor::OnMenuSelectAddAllInstances(Visio::IVApplicationPtr vsoApp) +{ + selectAll(vsoApp, true, true); + return VAORC_SUCCESS; +} + +VAORC CDocumentMonitor::OnMenuSelectAddAllMessages(Visio::IVApplicationPtr vsoApp) +{ + selectAll(vsoApp, false, true); + return VAORC_SUCCESS; +} + VAORC CDocumentMonitor::OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp) { if(m_reportVisible) Modified: trunk/src/view/visio/addon/document.h =================================================================== --- trunk/src/view/visio/addon/document.h 2010-02-22 00:01:01 UTC (rev 611) +++ trunk/src/view/visio/addon/document.h 2010-02-22 02:39:03 UTC (rev 612) @@ -58,7 +58,9 @@ MENU_VERIFY, MENU_OPTIONS, MENU_SELECT_ALL_INSTANCES, - MENU_SELECT_ALL_MESSAGES + MENU_SELECT_ALL_MESSAGES, + MENU_SELECT_ADD_ALL_INSTANCES, + MENU_SELECT_ADD_ALL_MESSAGES }; VAORC OnMenuWindowsReporter(Visio::IVApplicationPtr vsoApp); @@ -68,6 +70,8 @@ VAORC OnMenuTransform(Visio::IVApplicationPtr vsoApp, int index); VAORC OnMenuSelectAllInstances(Visio::IVApplicationPtr vsoApp); VAORC OnMenuSelectAllMessages(Visio::IVApplicationPtr vsoApp); + VAORC OnMenuSelectAddAllInstances(Visio::IVApplicationPtr vsoApp); + VAORC OnMenuSelectAddAllMessages(Visio::IVApplicationPtr vsoApp); VAORC OnMenuFindFlow(Visio::IVApplicationPtr vsoApp); VAORC OnMenuSimulationStart(Visio::IVApplicationPtr vsoApp); VAORC OnMenuSimulationStop(Visio::IVApplicationPtr vsoApp); @@ -156,7 +160,16 @@ Visio::IVToolbarItemPtr m_simulationStartToolbarItem; Visio::IVToolbarItemPtr m_simulationStopToolbarItem; - void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances); + /** + * Selects all instances or all messages on the active page. + * @param vsoApp the application to make selection in + * @param select_instances when true, selects all instances, + * when false, selects all messages (including lost and found messages) + * @param add_to_selection when true, adds all objects to existing selection, + * when false, the old selection is dropped + */ + void selectAll(Visio::IVApplicationPtr vsoApp, bool select_instances, bool add_to_selection); + Visio::IVUIObjectPtr getMostCustomMenus(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument); Visio::IVUIObjectPtr getMostCustomToolbars(Visio::IVApplicationPtr vsoApp, Visio::IVDocumentPtr vsoDocument); }; Added: trunk/src/view/visio/addon/icon_select_add_instances.ico =================================================================== (Binary files differ) Property changes on: trunk/src/view/visio/addon/icon_select_add_instances.ico ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/src/view/visio/addon/icon_select_add_messages.ico =================================================================== (Binary files differ) Property changes on: trunk/src/view/visio/addon/icon_select_add_messages.ico ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/view/visio/addon/resource.h =================================================================== --- trunk/src/view/visio/addon/resource.h 2010-02-22 00:01:01 UTC (rev 611) +++ trunk/src/view/visio/addon/resource.h 2010-02-22 02:39:03 UTC (rev 612) @@ -23,12 +23,14 @@ #define IDI_ICON_SELECT_MESSAGES 212 #define IDI_ICON_SIMULATION_START 213 #define IDI_ICON_SIMULATION_STOP 214 +#define IDI_ICON_SELECT_ADD_INSTANCES 216 +#define IDI_ICON_SELECT_ADD_MESSAGES 217 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 215 +#define _APS_NEXT_RESOURCE_VALUE 216 #define _APS_NEXT_COMMAND_VALUE 32768 #define _APS_NEXT_CONTROL_VALUE 209 #define _APS_NEXT_SYMED_VALUE 105 Modified: trunk/src/view/visio/addon/scstudio.vcproj =================================================================== --- trunk/src/view/visio/addon/scstudio.vcproj 2010-02-22 00:01:01 UTC (rev 611) +++ trunk/src/view/visio/addon/scstudio.vcproj 2010-02-22 02:39:03 UTC (rev 612) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="9.00" + Version="9,00" Name="scstudio" ProjectGUID="{0E00282C-F48B-4984-A274-5B59E1E2AD49}" RootNamespace="scstudio" @@ -398,6 +398,14 @@ > </File> <File + RelativePath=".\icon_select_add_instances.ico" + > + </File> + <File + RelativePath=".\icon_select_add_messages.ico" + > + </File> + <File RelativePath=".\icon_select_instances.ico" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |