From 48540940b6c28bb4378abfeb500ec45a625b37b6 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Tue, 15 May 2012 10:38:20 +0000 Subject: initial commit git-svn-id: http://svn.miranda-ng.org/main/trunk@2 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/modernb/modern_newrowopts.cpp | 203 ++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 plugins/modernb/modern_newrowopts.cpp (limited to 'plugins/modernb/modern_newrowopts.cpp') diff --git a/plugins/modernb/modern_newrowopts.cpp b/plugins/modernb/modern_newrowopts.cpp new file mode 100644 index 0000000000..fbd3ec60ed --- /dev/null +++ b/plugins/modernb/modern_newrowopts.cpp @@ -0,0 +1,203 @@ +/* + +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) +{ + DWORD i; + NodeList * work; + if (!FromList) return FALSE; + if (FromList->AllocatedChilds<=index) return FALSE; + work=&(FromList->childNodes[index]); + for(i=0; iAllocatedChilds; i++) + { + if (work->childNodes[i].AllocatedChilds) + RemoveChildNode(work->childNodes,i); + } + if (work->AllocatedChilds) + { + mir_free_and_nill(work->childNodes); + work->AllocatedChilds=0; + } + //mir_free_and_nill(work); + 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;kitemParent->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_nill(FromList->childNodes); + mir_free_and_nill(FromList); + return TRUE; +} +int ident=0; +void PrintIdent() +{ + int k; + for (k=0;kpData); + TRACE(buf); + } + ident+=5; + for(i=0; iAllocatedChilds;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,TEXT("Init NewRow Dialog"),TEXT("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