-
Notifications
You must be signed in to change notification settings - Fork 5
/
RpcDockbar.cpp
68 lines (54 loc) · 2.06 KB
/
RpcDockbar.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "StdAfx.h"
#include "RpcSelectionDialog.h"
#pragma region RPC command
class CRpcDockbar : public CRhinoCommand
{
public:
CRpcDockbar() = default;
~CRpcDockbar() = default;
UUID CommandUUID() override
{
// {1CB91610-1762-4C93-8582-1D50BFC43152}
static const GUID CRpcDockbarUUID =
{ 0x1CB91610, 0x1762, 0x4C93, { 0x85, 0x82, 0x1D, 0x50, 0xBF, 0xC4, 0x31, 0x52 } };
return CRpcDockbarUUID;
}
const wchar_t* EnglishCommandName() override { return L"RPCSelect"; }
CRhinoCommand::result RunCommand(const CRhinoCommandContext& context) override;
};
static class CRpcDockbar theDockBarDialogCommand;
CRhinoCommand::result CRpcDockbar::RunCommand(const CRhinoCommandContext& context)
{
ON_UUID tabId = CRpcSelectionDialog::Id();
if (context.IsInteractive())
{
CRhinoTabbedDockBarDialog::ShowDockbarTab(context.m_doc, tabId, true,true, &uuidPanelObjectProps);
}
else
{
bool bVisible = CRhinoTabbedDockBarDialog::IsTabVisible(context.m_doc, tabId);
ON_wString str;
str.Format(L"%ls is %ls. New value", LocalCommandName(), bVisible ? L"visible" : L"hidden");
CRhinoGetOption go;
go.SetCommandPrompt(str);
int hOption = go.AddCommandOption(RhLocalizeCommandOptionName( L"Hide", 43368));
int sOption = go.AddCommandOption(RhLocalizeCommandOptionName( L"Show", 43369));
int tOption = go.AddCommandOption(RhLocalizeCommandOptionName( L"Toggle", 43370));
go.GetOption();
if (go.CommandResult() != CRhinoCommand::success)
return go.CommandResult();
const CRhinoCommandOption* option = go.Option();
if (option == 0)
return CRhinoCommand::failure;
int optionIndex = option->m_option_index;
if (hOption == optionIndex && bVisible)
CRhinoTabbedDockBarDialog::ShowDockbarTab(context.m_doc, tabId, false, false, nullptr);
else if (sOption == optionIndex && !bVisible)
CRhinoTabbedDockBarDialog::ShowDockbarTab(context.m_doc, tabId, true, true, nullptr);
else if (tOption == optionIndex)
CRhinoTabbedDockBarDialog::ShowDockbarTab(context.m_doc, tabId, !bVisible, !bVisible, nullptr);
}
return CRhinoCommand::success;
}
#pragma endregion