root / trunk / win / EdGrpDlg.cpp
| Revision 680, 2.4 kB (checked in by leo, 19 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | // EdGrpDlg.cpp : implementation file |
| 2 | // |
| 3 | |
| 4 | #include "lc_global.h" |
| 5 | #include "leocad.h" |
| 6 | #include "EdGrpDlg.h" |
| 7 | #include "globals.h" |
| 8 | #include "project.h" |
| 9 | #include "lc_application.h" |
| 10 | |
| 11 | #ifdef _DEBUG |
| 12 | #define new DEBUG_NEW |
| 13 | #undef THIS_FILE |
| 14 | static char THIS_FILE[] = __FILE__; |
| 15 | #endif |
| 16 | |
| 17 | ///////////////////////////////////////////////////////////////////////////// |
| 18 | // CEditGroupsDlg dialog |
| 19 | |
| 20 | |
| 21 | CEditGroupsDlg::CEditGroupsDlg(void* param, CWnd* pParent /*=NULL*/) |
| 22 | : CDialog(CEditGroupsDlg::IDD, pParent) |
| 23 | { |
| 24 | m_Tree.opts = (LC_GROUPEDITDLG_OPTS*)param; |
| 25 | |
| 26 | //{{AFX_DATA_INIT(CEditGroupsDlg) |
| 27 | //}}AFX_DATA_INIT |
| 28 | } |
| 29 | |
| 30 | |
| 31 | void CEditGroupsDlg::DoDataExchange(CDataExchange* pDX) |
| 32 | { |
| 33 | CDialog::DoDataExchange(pDX); |
| 34 | //{{AFX_DATA_MAP(CEditGroupsDlg) |
| 35 | DDX_Control(pDX, IDC_TREE, m_Tree); |
| 36 | //}}AFX_DATA_MAP |
| 37 | } |
| 38 | |
| 39 | |
| 40 | BEGIN_MESSAGE_MAP(CEditGroupsDlg, CDialog) |
| 41 | //{{AFX_MSG_MAP(CEditGroupsDlg) |
| 42 | ON_BN_CLICKED(IDC_EDITGRP_NEWGROUP, OnEditgrpNewgroup) |
| 43 | //}}AFX_MSG_MAP |
| 44 | END_MESSAGE_MAP() |
| 45 | |
| 46 | ///////////////////////////////////////////////////////////////////////////// |
| 47 | // CEditGroupsDlg message handlers |
| 48 | |
| 49 | |
| 50 | BOOL CEditGroupsDlg::OnInitDialog() |
| 51 | { |
| 52 | CDialog::OnInitDialog(); |
| 53 | |
| 54 | m_TreeImages.Create(IDB_PARTICONS, 16, 0, RGB (0,128,128)); |
| 55 | m_Tree.SetImageList(&m_TreeImages, TVSIL_NORMAL); |
| 56 | |
| 57 | m_Tree.DeleteAllItems(); |
| 58 | m_Tree.AddChildren(NULL, NULL); |
| 59 | |
| 60 | return TRUE; |
| 61 | } |
| 62 | |
| 63 | void CEditGroupsDlg::OnEditgrpNewgroup() |
| 64 | { |
| 65 | /* |
| 66 | FIXME: groups |
| 67 | HTREEITEM hItem, hParent = NULL; |
| 68 | Group *pGroup, *pParent = NULL; |
| 69 | TVITEM item; |
| 70 | |
| 71 | hItem = m_Tree.GetSelectedItem (); |
| 72 | |
| 73 | if (hItem != NULL) |
| 74 | { |
| 75 | item.hItem = hItem; |
| 76 | item.mask = TVIF_HANDLE | TVIF_PARAM; |
| 77 | |
| 78 | if (m_Tree.GetItem (&item)) |
| 79 | { |
| 80 | if (item.lParam < 0xFFFF) |
| 81 | hParent = m_Tree.GetParentItem (hItem); |
| 82 | else |
| 83 | hParent = hItem; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | if (hParent) |
| 88 | { |
| 89 | item.hItem = hParent; |
| 90 | item.mask = TVIF_HANDLE | TVIF_PARAM; |
| 91 | |
| 92 | if (m_Tree.GetItem (&item)) |
| 93 | pParent = m_Tree.opts->groups[item.lParam - 0xFFFF]; |
| 94 | } |
| 95 | |
| 96 | pGroup = lcGetActiveProject()->AddGroup (NULL, pParent, 0, 0, 0); |
| 97 | |
| 98 | m_Tree.opts->groupcount++; |
| 99 | m_Tree.opts->groups = (Group**)realloc(m_Tree.opts->groups, m_Tree.opts->groupcount*sizeof(Group*)); |
| 100 | m_Tree.opts->groupsgroups = (Group**)realloc(m_Tree.opts->groupsgroups, m_Tree.opts->groupcount*sizeof(Group*)); |
| 101 | |
| 102 | m_Tree.opts->groups[m_Tree.opts->groupcount-1] = pGroup; |
| 103 | m_Tree.opts->groupsgroups[m_Tree.opts->groupcount-1] = pParent; |
| 104 | |
| 105 | m_Tree.DeleteAllItems(); |
| 106 | m_Tree.AddChildren(NULL, NULL); |
| 107 | */ |
| 108 | } |
Note: See TracBrowser
for help on using the browser.
