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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [Utils/] [win32/] [CSHPropertySheet.cpp] - Blame information for rev 778

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

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

powered by: WebSVN 2.1.0

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