00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "Settings.h"
00025 #include "CoolInterface.h"
00026 #include "Skin.h"
00027 #include "XML.h"
00028 #include "Skin.h"
00029 #include "RichDocument.h"
00030 #include "RichElement.h"
00031 #include "WndSettingsSheet.h"
00032 #include "PageSettingsRich.h"
00033
00034 #ifdef _DEBUG
00035 #define new DEBUG_NEW
00036 #undef THIS_FILE
00037 static char THIS_FILE[] = __FILE__;
00038 #endif
00039
00040 IMPLEMENT_DYNCREATE(CRichSettingsPage, CSettingsPage)
00041
00042 BEGIN_MESSAGE_MAP(CRichSettingsPage, CSettingsPage)
00043
00044
00045 ON_NOTIFY(RVN_CLICK, IDC_RICH_VIEW, OnClickView)
00046 END_MESSAGE_MAP()
00047
00048
00050
00051
00052 CRichSettingsPage::CRichSettingsPage(LPCTSTR pszName) : CSettingsPage(CRichSettingsPage::IDD)
00053 {
00054 if ( pszName == NULL )
00055 m_sName = GetRuntimeClass()->m_lpszClassName;
00056 else
00057 m_sName = pszName;
00058
00059 m_pDocument = NULL;
00060
00061 if ( CXMLElement* pXML = Skin.GetDocument( m_sName ) )
00062 {
00063 m_sCaption = pXML->GetAttributeValue( _T("title"), m_sName );
00064
00065 m_pDocument = new CRichDocument();
00066 m_pDocument->CreateFonts( theApp.m_sDefaultFont, theApp.m_nDefaultFontSize );
00067 m_pDocument->m_crBackground = CCoolInterface::GetDialogBkColor();
00068 m_pDocument->LoadXML( pXML );
00069 }
00070 }
00071
00072 CRichSettingsPage::~CRichSettingsPage()
00073 {
00074 if ( m_pDocument ) delete m_pDocument;
00075 }
00076
00077 void CRichSettingsPage::DoDataExchange(CDataExchange* pDX)
00078 {
00079 CSettingsPage::DoDataExchange(pDX);
00080
00081
00082 }
00083
00085
00086
00087 BOOL CRichSettingsPage::OnInitDialog()
00088 {
00089 CSettingsPage::OnInitDialog();
00090
00091 SetWindowText( m_sCaption );
00092 Skin.Apply( m_sName, this );
00093
00094 CRect rc;
00095 GetClientRect( &rc );
00096 m_wndView.Create( WS_VISIBLE, rc, this, IDC_RICH_VIEW );
00097 m_wndView.SetDocument( m_pDocument );
00098
00099 return TRUE;
00100 }
00101
00102 void CRichSettingsPage::OnClickView(RVN_ELEMENTEVENT* pNotify, LRESULT *pResult)
00103 {
00104 CRichElement* pElement = pNotify->pElement;
00105 if ( ! pElement ) return;
00106
00107 if ( _tcsncmp( pElement->m_sLink, _T("raza:page:"), 10 ) == 0 )
00108 {
00109 CString strPage = pElement->m_sLink.Mid( 10 );
00110 GetSheet()->SetActivePage( GetSheet()->GetPage( strPage ) );
00111 }
00112 }