#if !defined(AFX_SELECTNOTEDLG_H__D4F88EE7_976B_420C_AEA6_1FE29A0298C1__INCLUDED_)
#define AFX_SELECTNOTEDLG_H__D4F88EE7_976B_420C_AEA6_1FE29A0298C1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SElectNoteDlg.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CSElectNoteDlg dialog
#include "resource.h"
#include "apl_api.h"	// Added by ClassView
#include "apl_gui.h"	// Added by ClassView

#define APL_VIEW_MODE 1
#define APL_DELETE_MODE 2

class CSelectNoteDlg : public CaplResizableDialog
{
// Construction
public:
	static bool SetRTF(CaplRichEditCtrl* richedit, CaplInstance* inst, CaplAPI *api);
	static bool AddNotesRec(CaplInstance *note, aplExtent &notes, CaplRichEditCtrl *richedit, CaplAPI *api, CString level);
	static bool GetChildNote(CaplInstance* parent, aplExtent &notes, aplExtent &childs, CaplAPI *api);
	void AddNotes(CaplInstance *inst);
	bool LoadData();
	void SortExtent(aplExtent &ext);
	bool AddRTF(CaplInstance *inst, bool first = false);
	int mode;
	void SetRTF(CaplInstance *note);
	void FindNoteToSelect(HTREEITEM hParent, HTREEITEM &hItemSelect);
	virtual bool ItemChange(NM_TREEVIEW* pNMTreeView);

	CaplInstance *m_note;
	CaplInstance *m_inst;
	CaplAPI *m_api;
	CSelectNoteDlg(CWnd* pParent = NULL);   // standard constructor
	CaplTreeListCtrlView *m_notes;
	CaplInstance *m_ciNoteToSelect;
	bool m_bShowTree;


// Dialog Data
	//{{AFX_DATA(CSelectNoteDlg)
	enum { IDD = IDD_NOTE_SELECT };
	CButton	m_show_in_tree;
	CaplButton	m_del;
	CaplButton	m_copy;
	CaplButton	m_ansver;
	CaplButton	m_add;
	CListCtrl	m_tmp;
	CaplRichEditCtrl	m_richedit;
	CaplButton	m_cancel_btn;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSelectNoteDlg)
	public:
	virtual BOOL DestroyWindow();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	CaplSplitterBar *m_splitter;

	// предотвращаем потерю модальности после диалога с бочками из aplSocketTransport
	CaplParentWndProcesser m_pwp;


	// Generated message map functions
	//{{AFX_MSG(CSelectNoteDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSelChange();
	afx_msg void OnAddNote();
	afx_msg void OnDeleteNote();
	afx_msg void OnCopyNote();
	afx_msg void OnAnsverNote();
	afx_msg void OnSplitterMoved();
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnShowAll();
	virtual void OnCancel();	
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnNotesRevoke();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SELECTNOTEDLG_H__D4F88EE7_976B_420C_AEA6_1FE29A0298C1__INCLUDED_)
