* { font-family: Consolas, Lucida Console, Courier New; font-size: 100%; }
h1 { font-size: 150%; }
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 100%; width: 100%; }
.highlight span { width: 100%; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
body { background: #ffffff; }
body .c { color: #999988; font-style: italic } /* Comment */
body .err { color: #a61717; background-color: #e3d2d2 } /* Error */
body .k { font-weight: bold } /* Keyword */
body .o { font-weight: bold } /* Operator */
body .cm { color: #999988; font-style: italic } /* Comment.Multiline */
body .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
body .c1 { color: #999988; font-style: italic } /* Comment.Single */
body .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
body .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #aa0000 } /* Generic.Error */
body .gh { color: #999999 } /* Generic.Heading */
body .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #555555 } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #aaaaaa } /* Generic.Subheading */
body .gt { color: #aa0000 } /* Generic.Traceback */
body .kc { font-weight: bold } /* Keyword.Constant */
body .kd { font-weight: bold } /* Keyword.Declaration */
body .kp { font-weight: bold } /* Keyword.Pseudo */
body .kr { font-weight: bold } /* Keyword.Reserved */
body .kt { color: #445588; font-weight: bold } /* Keyword.Type */
body .m { color: #009999 } /* Literal.Number */
body .s { color: #bb8844 } /* Literal.String */
body .na { color: #008080 } /* Name.Attribute */
body .nb { color: #999999 } /* Name.Builtin */
body .nc { color: #445588; font-weight: bold } /* Name.Class */
body .no { color: #008080 } /* Name.Constant */
body .ni { color: #800080 } /* Name.Entity */
body .ne { color: #990000; font-weight: bold } /* Name.Exception */
body .nf { color: #990000; font-weight: bold } /* Name.Function */
body .nn { color: #555555 } /* Name.Namespace */
body .nt { color: #000080 } /* Name.Tag */
body .nv { color: #008080 } /* Name.Variable */
body .ow { font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #009999 } /* Literal.Number.Float */
body .mh { color: #009999 } /* Literal.Number.Hex */
body .mi { color: #009999 } /* Literal.Number.Integer */
body .mo { color: #009999 } /* Literal.Number.Oct */
body .sb { color: #bb8844 } /* Literal.String.Backtick */
body .sc { color: #bb8844 } /* Literal.String.Char */
body .sd { color: #bb8844 } /* Literal.String.Doc */
body .s2 { color: #bb8844 } /* Literal.String.Double */
body .se { color: #bb8844 } /* Literal.String.Escape */
body .sh { color: #bb8844 } /* Literal.String.Heredoc */
body .si { color: #bb8844 } /* Literal.String.Interpol */
body .sx { color: #bb8844 } /* Literal.String.Other */
body .sr { color: #808000 } /* Literal.String.Regex */
body .s1 { color: #bb8844 } /* Literal.String.Single */
body .ss { color: #bb8844 } /* Literal.String.Symbol */
body .bp { color: #999999 } /* Name.Builtin.Pseudo */
body .vc { color: #008080 } /* Name.Variable.Class */
body .vg { color: #008080 } /* Name.Variable.Global */
body .vi { color: #008080 } /* Name.Variable.Instance */
body .il { color: #009999 } /* Literal.Number.Integer.Long */
Info
Revision:3344
Author:alk
Date:2008-06-27 00:43:51 +0300 (Fri, 27 Jun 2008)
Comment:Code reformat
Changes
U trunk/src/client/console/libnxmc/objseldlg.cpp
U trunk/src/client/console/libnxmc/objseldlg.h
Diff
Modified: trunk/src/client/console/libnxmc/objseldlg.cpp
===================================================================
--- trunk/src/client/console/libnxmc/objseldlg.cpp 2008-06-26 21:40:28 UTC (rev 3343)
+++ trunk/src/client/console/libnxmc/objseldlg.cpp 2008-06-26 21:43:51 UTC (rev 3344)
@@ -41,11 +41,11 @@
//
nxObjectSelDlg::nxObjectSelDlg(wxWindow *parent)
- : wxDialog()
+ : wxDialog()
{
wxConfig::Get()->Read(_T("/ObjectSelDlg/SortMode"), &m_sortMode, 0);
wxConfig::Get()->Read(_T("/ObjectSelDlg/SortDir"), &m_sortDir, 1);
-
+
m_parentObjectId = 0;
m_allowedClasses = SCL_NODE;
m_isSelectAddress = false;
@@ -53,7 +53,7 @@
m_isSingleSelection = true;
m_isEmptySelectionAllowed = false;
m_customAttributeFilter = NULL;
-
+
wxXmlResource::Get()->LoadDialog(this, parent, _T("nxObjectSelDlg"));
GetSizer()->Fit(this);
}
@@ -79,7 +79,7 @@
wxListCtrl *wndListCtrl;
int i, count;
long item;
-
+
wndListCtrl = XRCCTRL(*this, "wndListCtrl", wxListCtrl);
count = wndListCtrl->GetSelectedItemCount();
for(i = 0, item = -1; i < count;i++)
@@ -99,113 +99,113 @@
DWORD i, numObjects;
NXC_OBJECT_INDEX *index;
long item;
- static DWORD classMask[15] = { 0, SCL_SUBNET, SCL_NODE, SCL_INTERFACE,
- SCL_NETWORK, SCL_CONTAINER, SCL_ZONE,
- SCL_SERVICEROOT, SCL_TEMPLATE, SCL_TEMPLATEGROUP,
- SCL_TEMPLATEROOT, SCL_NETWORKSERVICE,
- SCL_VPNCONNECTOR, SCL_CONDITION, SCL_CLUSTER };
-
+ static DWORD classMask[15] = { 0, SCL_SUBNET, SCL_NODE, SCL_INTERFACE,
+ SCL_NETWORK, SCL_CONTAINER, SCL_ZONE,
+ SCL_SERVICEROOT, SCL_TEMPLATE, SCL_TEMPLATEGROUP,
+ SCL_TEMPLATEROOT, SCL_NETWORKSERVICE,
+ SCL_VPNCONNECTOR, SCL_CONDITION, SCL_CLUSTER };
+
wndListCtrl = XRCCTRL(*this, "wndListCtrl", wxListCtrl);
if (wndListCtrl == NULL)
{
wxLogError(_T("INTERNAL ERROR: wndListCtrl is NULL in nxObjectSelDlg::TransferDataToWindow"));
return false;
}
-
+
wxImageList *imgList = NXMCGetImageListCopy(IMAGE_LIST_OBJECTS_SMALL);
imgList->Add(wxXmlResource::Get()->LoadIcon(_T("icoSortUp")));
imgList->Add(wxXmlResource::Get()->LoadIcon(_T("icoSortDown")));
wndListCtrl->AssignImageList(imgList, wxIMAGE_LIST_SMALL);
-
- width = wndListCtrl->GetClientSize().x;
- if (m_isSelectAddress)
- {
- wndListCtrl->InsertColumn(0, _T("Interface"), wxLIST_FORMAT_LEFT,
- width - 150 - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
- wndListCtrl->InsertColumn(1, _T("IP Address"), wxLIST_FORMAT_LEFT, 150);
- }
- else
- {
- wndListCtrl->InsertColumn(0, _T("Name"), wxLIST_FORMAT_LEFT,
- width - 100 - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
- wndListCtrl->InsertColumn(1, _T("Class"), wxLIST_FORMAT_LEFT, 100);
- }
- if (m_isSingleSelection)
- {
+
+ width = wndListCtrl->GetClientSize().x;
+ if (m_isSelectAddress)
+ {
+ wndListCtrl->InsertColumn(0, _T("Interface"), wxLIST_FORMAT_LEFT,
+ width - 150 - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
+ wndListCtrl->InsertColumn(1, _T("IP Address"), wxLIST_FORMAT_LEFT, 150);
+ }
+ else
+ {
+ wndListCtrl->InsertColumn(0, _T("Name"), wxLIST_FORMAT_LEFT,
+ width - 100 - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
+ wndListCtrl->InsertColumn(1, _T("Class"), wxLIST_FORMAT_LEFT, 100);
+ }
+ if (m_isSingleSelection)
+ {
wndListCtrl->SetSingleStyle(wxLC_SINGLE_SEL);
- }
-
- // Fill in object list
- if (m_parentObjectId == 0)
- {
- NXCLockObjectIndex(NXMCGetSession());
- index = (NXC_OBJECT_INDEX *)NXCGetObjectIndex(NXMCGetSession(), &numObjects);
- for(i = 0; i < numObjects; i++)
- if ((classMask[index[i].object->iClass] & m_allowedClasses) &&
- (!index[i].object->bIsDeleted))
- {
- item = wndListCtrl->InsertItem(0x7FFFFFFF, index[i].object->szName,
- index[i].object->iClass);
- wndListCtrl->SetItem(item, 1, NXMCGetClassName(index[i].object->iClass));
- wndListCtrl->SetItemData(item, index[i].object->dwId);
- }
- NXCUnlockObjectIndex(NXMCGetSession());
- }
- else
- {
- NXC_OBJECT *object, *child;
- TCHAR buffer[16];
-
- object = NXCFindObjectById(NXMCGetSession(), m_parentObjectId);
- if (object != NULL)
- {
- for(i = 0; i < object->dwNumChilds; i++)
- {
- child = NXCFindObjectById(NXMCGetSession(), object->pdwChildList[i]);
- if (child != NULL)
- {
- if (m_isSelectAddress)
- {
- if ((child->iClass == OBJECT_INTERFACE) &&
- (child->dwIpAddr != 0) && (!child->bIsDeleted))
- {
- item = wndListCtrl->InsertItem(0x7FFFFFFF, child->szName, OBJECT_INTERFACE);
- wndListCtrl->SetItem(item, 1, IpToStr(child->dwIpAddr, buffer));
- wndListCtrl->SetItemData(item, object->pdwChildList[i]);
- }
- }
- else
- {
- if ((classMask[child->iClass] & m_allowedClasses) &&
- (!child->bIsDeleted))
- {
- item = wndListCtrl->InsertItem(0x7FFFFFFF, child->szName, child->iClass);
- wndListCtrl->SetItem(item, 1, NXMCGetClassName(child->iClass));
- wndListCtrl->SetItemData(item, object->pdwChildList[i]);
- }
- }
- }
- }
-
- if (m_isSelectAddress && m_isShowLoopback)
- {
- item = wndListCtrl->InsertItem(0x7FFFFFFF, _T("<loopback>"), OBJECT_INTERFACE);
- wndListCtrl->SetItem(item, 1, _T("127.0.0.1"));
- wndListCtrl->SetItemData(item, 0);
- }
- }
- }
-
+ }
+
+ // Fill in object list
+ if (m_parentObjectId == 0)
+ {
+ NXCLockObjectIndex(NXMCGetSession());
+ index = (NXC_OBJECT_INDEX *)NXCGetObjectIndex(NXMCGetSession(), &numObjects);
+ for(i = 0; i < numObjects; i++)
+ if ((classMask[index[i].object->iClass] & m_allowedClasses) &&
+ (!index[i].object->bIsDeleted))
+ {
+ item = wndListCtrl->InsertItem(0x7FFFFFFF, index[i].object->szName,
+ index[i].object->iClass);
+ wndListCtrl->SetItem(item, 1, NXMCGetClassName(index[i].object->iClass));
+ wndListCtrl->SetItemData(item, index[i].object->dwId);
+ }
+ NXCUnlockObjectIndex(NXMCGetSession());
+ }
+ else
+ {
+ NXC_OBJECT *object, *child;
+ TCHAR buffer[16];
+
+ object = NXCFindObjectById(NXMCGetSession(), m_parentObjectId);
+ if (object != NULL)
+ {
+ for(i = 0; i < object->dwNumChilds; i++)
+ {
+ child = NXCFindObjectById(NXMCGetSession(), object->pdwChildList[i]);
+ if (child != NULL)
+ {
+ if (m_isSelectAddress)
+ {
+ if ((child->iClass == OBJECT_INTERFACE) &&
+ (child->dwIpAddr != 0) && (!child->bIsDeleted))
+ {
+ item = wndListCtrl->InsertItem(0x7FFFFFFF, child->szName, OBJECT_INTERFACE);
+ wndListCtrl->SetItem(item, 1, IpToStr(child->dwIpAddr, buffer));
+ wndListCtrl->SetItemData(item, object->pdwChildList[i]);
+ }
+ }
+ else
+ {
+ if ((classMask[child->iClass] & m_allowedClasses) &&
+ (!child->bIsDeleted))
+ {
+ item = wndListCtrl->InsertItem(0x7FFFFFFF, child->szName, child->iClass);
+ wndListCtrl->SetItem(item, 1, NXMCGetClassName(child->iClass));
+ wndListCtrl->SetItemData(item, object->pdwChildList[i]);
+ }
+ }
+ }
+ }
+
+ if (m_isSelectAddress && m_isShowLoopback)
+ {
+ item = wndListCtrl->InsertItem(0x7FFFFFFF, _T("<loopback>"), OBJECT_INTERFACE);
+ wndListCtrl->SetItem(item, 1, _T("127.0.0.1"));
+ wndListCtrl->SetItemData(item, 0);
+ }
+ }
+ }
+
SortObjects();
-
- // Disable "None" button if empty selection is not allowed
- if (!m_isEmptySelectionAllowed)
- {
+
+ // Disable "None" button if empty selection is not allowed
+ if (!m_isEmptySelectionAllowed)
+ {
wxButton *btn = XRCCTRL(*this, "btnNone", wxButton);
if (btn != NULL)
btn->Hide();
- }
-
+ }
+
return true;
}
@@ -217,7 +217,7 @@
void nxObjectSelDlg::OnInitDialog(wxInitDialogEvent &event)
{
wxWindow *wnd;
-
+
wnd = FindWindowById(wxID_OK, this);
if (wnd != NULL)
((wxButton *)wnd)->SetDefault();
@@ -237,31 +237,31 @@
int rc;
TCHAR name1[MAX_OBJECT_NAME], name2[MAX_OBJECT_NAME];
NXC_OBJECT *obj1, *obj2;
-
+
switch(mode)
{
- case 0: // Name
- NXCGetComparableObjectName(NXMCGetSession(), item1, name1);
- NXCGetComparableObjectName(NXMCGetSession(), item2, name2);
- rc = _tcsicmp(name1, name2);
- break;
- case 1: // Class or IP address
- obj1 = NXCFindObjectById(NXMCGetSession(), item1);
- obj2 = NXCFindObjectById(NXMCGetSession(), item2);
- if (sortData & 0x4000) // IP address
- {
- rc = COMPARE_NUMBERS(obj1->dwIpAddr, obj2->dwIpAddr);
- }
- else
- {
- rc = _tcsicmp(NXMCGetClassName(obj1->iClass), NXMCGetClassName(obj2->iClass));
- }
- break;
- default:
- rc = 0;
- break;
+ case 0: // Name
+ NXCGetComparableObjectName(NXMCGetSession(), item1, name1);
+ NXCGetComparableObjectName(NXMCGetSession(), item2, name2);
+ rc = _tcsicmp(name1, name2);
+ break;
+ case 1: // Class or IP address
+ obj1 = NXCFindObjectById(NXMCGetSession(), item1);
+ obj2 = NXCFindObjectById(NXMCGetSession(), item2);
+ if (sortData & 0x4000) // IP address
+ {
+ rc = COMPARE_NUMBERS(obj1->dwIpAddr, obj2->dwIpAddr);
+ }
+ else
+ {
+ rc = _tcsicmp(NXMCGetClassName(obj1->iClass), NXMCGetClassName(obj2->iClass));
+ }
+ break;
+ default:
+ rc = 0;
+ break;
}
-
+
return (sortData & 0x8000) ? rc : -rc;
}
@@ -274,7 +274,7 @@
{
wxListCtrl *wndListCtrl = XRCCTRL(*this, "wndListCtrl", wxListCtrl);
wndListCtrl->SortItems(CompareObjects, m_sortMode | ((m_sortDir == 1) ? 0x8000 : 0) | (m_isSelectAddress ? 0x4000 : 0));
-
+
wxListItem col;
// col.SetColumn(m_sortMode);
col.SetMask(wxLIST_MASK_IMAGE);
@@ -290,14 +290,14 @@
void nxObjectSelDlg::OnListColumnClick(wxListEvent &event)
{
wxListCtrl *wndListCtrl = XRCCTRL(*this, "wndListCtrl", wxListCtrl);
-
+
// wndListCtrl->ClearColumnImage(m_sortMode);
wxListItem col;
// col.SetColumn(m_sortMode);
col.SetMask(wxLIST_MASK_IMAGE);
col.SetImage(-1);
wndListCtrl->SetColumn(m_sortMode, col);
-
+
if (m_sortMode == event.GetColumn())
{
m_sortDir = -m_sortDir;
Modified: trunk/src/client/console/libnxmc/objseldlg.h
===================================================================
--- trunk/src/client/console/libnxmc/objseldlg.h 2008-06-26 21:40:28 UTC (rev 3343)
+++ trunk/src/client/console/libnxmc/objseldlg.h 2008-06-26 21:43:51 UTC (rev 3344)
@@ -30,18 +30,18 @@
// Allowed classes
//
-#define SCL_NODE 0x0001
-#define SCL_INTERFACE 0x0002
-#define SCL_CONTAINER 0x0004
-#define SCL_SUBNET 0x0008
-#define SCL_NETWORK 0x0010
-#define SCL_SERVICEROOT 0x0020
-#define SCL_ZONE 0x0040
-#define SCL_NETWORKSERVICE 0x0080
-#define SCL_TEMPLATE 0x0100
-#define SCL_TEMPLATEGROUP 0x0200
-#define SCL_TEMPLATEROOT 0x0400
-#define SCL_VPNCONNECTOR 0x0800
+#define SCL_NODE 0x0001
+#define SCL_INTERFACE 0x0002
+#define SCL_CONTAINER 0x0004
+#define SCL_SUBNET 0x0008
+#define SCL_NETWORK 0x0010
+#define SCL_SERVICEROOT 0x0020
+#define SCL_ZONE 0x0040
+#define SCL_NETWORKSERVICE 0x0080
+#define SCL_TEMPLATE 0x0100
+#define SCL_TEMPLATEGROUP 0x0200
+#define SCL_TEMPLATEROOT 0x0400
+#define SCL_VPNCONNECTOR 0x0800
#define SCL_CONDITION 0x1000
#define SCL_CLUSTER 0x2000
@@ -55,17 +55,17 @@
private:
int m_sortMode;
int m_sortDir;
-
+
void SortObjects();
-
+
protected:
virtual bool TransferDataFromWindow(void);
virtual bool TransferDataToWindow(void);
-
+
public:
nxObjectSelDlg(wxWindow *parent);
virtual ~nxObjectSelDlg();
-
+
DWORD m_parentObjectId;
DWORD m_allowedClasses;
bool m_isSelectAddress;
@@ -74,13 +74,13 @@
bool m_isEmptySelectionAllowed;
TCHAR *m_customAttributeFilter;
wxArrayLong m_objectList;
-
+
// Event handlers
protected:
void OnInitDialog(wxInitDialogEvent &event);
void OnListColumnClick(wxListEvent &event);
void OnListItemActivate(wxListEvent &event);
-
+
DECLARE_EVENT_TABLE()
};
Received on Fri Jun 27 2008 - 00:43:51 EEST
This archive was generated by hypermail 2.2.0 : Fri Jun 27 2008 - 00:38:53 EEST