OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [Utils/] [win32/] [CSHPropertySheet.cpp] - Blame information for rev 790

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####                                        
2
// -------------------------------------------                              
3
// This file is part of the eCos host tools.                                
4
// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.            
5
//
6
// This program is free software; you can redistribute it and/or modify     
7
// it under the terms of the GNU General Public License as published by     
8
// the Free Software Foundation; either version 2 or (at your option) any   
9
// later version.                                                           
10
//
11
// This program is distributed in the hope that it will be useful, but      
12
// WITHOUT ANY WARRANTY; without even the implied warranty of               
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        
14
// General Public License for more details.                                 
15
//
16
// You should have received a copy of the GNU General Public License        
17
// along with this program; if not, write to the                            
18
// Free Software Foundation, Inc., 51 Franklin Street,                      
19
// Fifth Floor, Boston, MA  02110-1301, USA.                                
20
// -------------------------------------------                              
21
// ####ECOSHOSTGPLCOPYRIGHTEND####                                          
22
// CSHPropertySheet.cpp : implementation file
23
//
24
 
25
#include "stdafx.h"
26
#include "CSHPropertySheet.h"
27
#include <afxpriv.h> // for WM_COMMANDHELP
28
#include <htmlhelp.h>
29
 
30
#ifdef _DEBUG
31
#define new DEBUG_NEW
32
#undef THIS_FILE
33
static char THIS_FILE[] = __FILE__;
34
#endif
35
 
36
/////////////////////////////////////////////////////////////////////////////
37
// CCSHPropertySheet property page
38
IMPLEMENT_DYNCREATE(CCSHPropertySheet, CPropertySheet)
39
 
40
CCSHPropertySheet::~CCSHPropertySheet(){}
41
 
42
void CCSHPropertySheet::DoDataExchange(CDataExchange* pDX)
43
{
44
        CPropertySheet::DoDataExchange(pDX);
45
        //{{AFX_DATA_MAP(CCSHPropertySheet)
46
                // NOTE: the ClassWizard will add DDX and DDV calls here
47
        //}}AFX_DATA_MAP
48
}
49
 
50
 
51
BEGIN_MESSAGE_MAP(CCSHPropertySheet, CPropertySheet)
52
        //{{AFX_MSG_MAP(CCSHPropertySheet)
53
  ON_COMMAND(ID_WHATS_THIS,OnWhatsThis)
54
        ON_WM_CONTEXTMENU()
55
        ON_WM_HELPINFO()
56
  ON_MESSAGE(WM_COMMANDHELP,OnCommandHelp)
57
        ON_COMMAND(IDHELP, OnHelp)
58
        //}}AFX_MSG_MAP
59
END_MESSAGE_MAP()
60
 
61
/////////////////////////////////////////////////////////////////////////////
62
// CCSHPropertySheet message handlers
63
 
64
void CCSHPropertySheet::OnWhatsThis()
65
{
66
  DisplayHelp(m_pwndContext->m_hWnd,HelpID(m_pwndContext->m_hWnd),GetInstanceHandle());
67
}
68
 
69
void CCSHPropertySheet::OnContextMenu(CWnd*pWnd, CPoint pt)
70
{
71
  m_pwndContext=WndFromPoint(this,pWnd,pt);
72
  if(NULL==m_pwndContext || !CCSHCommon::OnContextMenu(this,pt,HelpID(m_pwndContext->GetDlgCtrlID()))){
73
    CPropertySheet::OnContextMenu(pWnd,pt);
74
  }
75
}
76
 
77
BOOL CCSHPropertySheet::OnHelpInfo(HELPINFO* pHelpInfo)
78
{
79
  DisplayHelp((HWND)pHelpInfo->hItemHandle,HelpID((HWND)pHelpInfo->hItemHandle),GetInstanceHandle());
80
  return TRUE;
81
}
82
 
83
BOOL CCSHPropertySheet::OnInitDialog()
84
{
85
  CPropertySheet::OnInitDialog();
86
  if(0==HelpID(IDOK)){
87
    // Dynamically add/remove the question mark button to the title bar of the dialog box:
88
    ModifyStyleEx(WS_EX_CONTEXTHELP,0,0);
89
  } else {
90
    ModifyStyleEx(0,WS_EX_CONTEXTHELP,0);
91
  }
92
 
93
  if(CSHFile().IsEmpty()){
94
    // All of the following mess happens because Microsoft decided to show a help button by 
95
    // default to every Property sheet constructed by Visual C++ 6.In the following lines, 
96
    // I hide the help button and move the other three buttons to where they should be.
97
    CWnd *pwndHelpButton=GetDlgItem(IDHELP);
98
    if(pwndHelpButton){
99
      static const int _afxPropSheetButtons[] = { IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP };
100
 
101
      for (int i = 0; i < sizeof _afxPropSheetButtons/sizeof _afxPropSheetButtons[0] - 1; i++){
102
        // Shunt button   
103
        CRect rect;
104
        GetDlgItem(_afxPropSheetButtons[i+1])->GetWindowRect(&rect);
105
        ScreenToClient(&rect);
106
        GetDlgItem(_afxPropSheetButtons[i])->MoveWindow(&rect);
107
      }
108
      pwndHelpButton->DestroyWindow();
109
    }
110
  }
111
  return TRUE;  // return TRUE unless you set the focus to a control
112
                      // EXCEPTION: OCX Property Pages should return FALSE
113
}
114
 
115
// Dummy implementations
116
UINT CCSHPropertySheet::HelpID(DWORD) const
117
{
118
  return 0; // dummy implementation
119
}
120
 
121
 
122
CString CCSHPropertySheet::CSHFile() const
123
{
124
  return m_strCSHFilePath;
125
}
126
 
127
void CCSHPropertySheet::OnHelp()
128
{
129
  if(!CSHFile().IsEmpty()){
130
    HtmlHelp(NULL,GetCSHFilePath()+CSHFile(),HH_DISPLAY_TOPIC,0);
131
  }
132
}
133
 
134
HINSTANCE CCSHPropertySheet::GetInstanceHandle()
135
{
136
  return AfxGetInstanceHandle();
137
}
138
 
139
BOOL CCSHPropertySheet::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
140
{
141
  if(CCSHCommon::FilterMessage(message, wParam,lParam,pResult)){
142
    return true; // handled
143
  }
144
  return CPropertySheet::OnWndMsg(message, wParam, lParam, pResult);
145
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.