From 2ab468f0ac05d1f257fbf8aa6add9512eabbcc20 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Fri, 13 Jul 2012 07:39:26 +0000 Subject: Clist_modern: changed folder structure git-svn-id: http://svn.miranda-ng.org/main/trunk@939 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_newrowopts.cpp | 198 +++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100644 plugins/Clist_modern/src/modern_newrowopts.cpp (limited to 'plugins/Clist_modern/src/modern_newrowopts.cpp') diff --git a/plugins/Clist_modern/src/modern_newrowopts.cpp b/plugins/Clist_modern/src/modern_newrowopts.cpp new file mode 100644 index 0000000000..b44ea0dbe3 --- /dev/null +++ b/plugins/Clist_modern/src/modern_newrowopts.cpp @@ -0,0 +1,198 @@ +/* + +Miranda IM: the free IM client for Microsoft* Windows* + +Copyright 2000-2003 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/************************************************************************/ +/* Author Artem Shpynov (shpynov@nm.ru) */ +/************************************************************************/ + +/************************************************************************/ +/********* New row design options file handle ********/ +/************************************************************************/ + + +#include "hdr/modern_commonheaders.h" +#include "m_clui.h" +#include "hdr/modern_clist.h" +#include "m_clc.h" + +#define EMPTY_PLACE 255 +#define COLUMNS_PLACE 254 +#define ROWS_PLACE 253 + +typedef struct _NodeList +{ + BYTE bType; + int pData; + DWORD AllocatedChilds; + struct _NodeList * childNodes; + struct _NodeList * itemParent; +} NodeList; + +NodeList * RootNode = NULL; + +NodeList * AddNode(NodeList * Parent) +{ + NodeList * res; + if ( !Parent) + { + res = (NodeList *)mir_alloc(sizeof(NodeList)); + memset(res,0,sizeof(NodeList)); + return res; + } + Parent->childNodes = (NodeList*) mir_realloc(Parent->childNodes,sizeof(NodeList)*(Parent->AllocatedChilds+1)); + memset(&(Parent->childNodes[Parent->AllocatedChilds]),0,sizeof(NodeList)); + Parent->childNodes[Parent->AllocatedChilds].itemParent = Parent; + Parent->AllocatedChilds++; + return &(Parent->childNodes[Parent->AllocatedChilds-1]); +} + + +BOOL RemoveChildNode(NodeList * FromList, DWORD index) +{ + if ( !FromList) return FALSE; + if (FromList->AllocatedChilds <= index) return FALSE; + NodeList *work = &(FromList->childNodes[index]); + for (size_t i=0; i < work->AllocatedChilds; i++) + if (work->childNodes[i].AllocatedChilds) + RemoveChildNode(work->childNodes, (DWORD)i); + + if (work->AllocatedChilds) { + mir_free_and_nil(work->childNodes); + work->AllocatedChilds = 0; + } + memmove(FromList->childNodes+index,FromList->childNodes+index+1,sizeof(NodeList)*(FromList->AllocatedChilds-index-1)); + FromList->AllocatedChilds--; + return TRUE; +} + +BOOL RemoveNode(NodeList * FromList) +{ + if ( !FromList) return FALSE; + if (FromList->itemParent) + { + DWORD k; + for (k = 0;k < FromList->itemParent->AllocatedChilds;k++) + if (&(FromList->itemParent->childNodes[k]) == FromList) + { + BOOL res = RemoveChildNode(FromList->itemParent,k); + return res; + } + } + do + { + RemoveChildNode(FromList,0); + } + while (FromList->AllocatedChilds>0); + mir_free_and_nil(FromList->childNodes); + mir_free_and_nil(FromList); + return TRUE; +} +int ident = 0; +void PrintIdent() +{ + int k; + for (k = 0;k < ident;k++) + TRACE("-"); +} + +void TraceTreeLevel(NodeList * node) +{ + DWORD i; + if ( !node) return; + PrintIdent(); + { + char buf[255]; + mir_snprintf(buf,SIZEOF(buf),"%d\n",node->pData); + TRACE(buf); + } + ident += 5; + for (i=0; i < node->AllocatedChilds;i++) + { + + if (node->childNodes[i].AllocatedChilds>0) + TraceTreeLevel(&(node->childNodes[i])); + else + { + PrintIdent(); + { + char buf[255]; + mir_snprintf(buf,SIZEOF(buf),"%d\n",node->childNodes[i].pData); + TRACE(buf); + } + } + } + ident -= 5; +} + +BOOL CALLBACK DlgProcItemNewRowOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + { + NodeList * res1,*res2, *res3; + int i=0; + RootNode = AddNode(NULL); + RootNode->pData = i++; + res1 = AddNode(RootNode); + res1->pData = i++; + res1 = AddNode(RootNode); + res1->pData = i++; + res2 = AddNode(res1); + res2->pData = i++; + res2 = AddNode(res1); + res2->pData = i++; + res3 = AddNode(res2); + res3->pData = i++; + res3 = AddNode(res1); + res3->pData = i++; + res3 = AddNode(RootNode); + res3->pData = i++; + TRACE("*********** Nodes DUMP 1 ***********\n"); + TraceTreeLevel(RootNode); + if (RemoveNode(res1)) res1 = 0; + TRACE("*********** Nodes DUMP 2 ***********\n"); + TraceTreeLevel(RootNode); + //CheckDlgButton(hwndDlg, IDC_HIDE_ICON_ON_AVATAR, DBGetContactSettingByte(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); + MessageBox(hwndDlg,_T("Init NewRow Dialog"),_T("Notify"),MB_OK); + break; + } + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->idFrom) + { + case 0: + { + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + return TRUE; + } + } + } + } + } + } + return 0; +}; -- cgit v1.2.3