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

Subversion Repositories openrisc

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

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
// CellEdit.cpp : implementation file
26
//
27
 
28
#include "stdafx.h"
29
#include "CellEdit.h"
30
#include "cellview.h"
31
#include "Configtool.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
// CCellEdit
41
 
42
CCellEdit::CCellEdit(LPCTSTR pszInitialValue):
43
  CCell(pszInitialValue)
44
{
45
}
46
 
47
CCellEdit::~CCellEdit()
48
{
49
}
50
 
51
 
52
BEGIN_MESSAGE_MAP(CCellEdit, CCell)
53
        //{{AFX_MSG_MAP(CCellEdit)
54
        ON_WM_CREATE()
55
        ON_WM_CHAR()
56
        ON_WM_KILLFOCUS()
57
        //}}AFX_MSG_MAP
58
END_MESSAGE_MAP()
59
 
60
/////////////////////////////////////////////////////////////////////////////
61
// CCellEdit message handlers
62
 
63
BOOL CCellEdit::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext*)
64
{
65
        return CWnd::CreateEx(WS_EX_CLIENTEDGE,_T("EDIT"), NULL, dwStyle, rect, pParentWnd, nID);
66
}
67
 
68
int CCellEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
69
{
70
        if (CCell::OnCreate(lpCreateStruct) == -1)
71
                return -1;
72
 
73
        SendMessage(WM_SETFONT,(WPARAM)(HFONT)GetStockObject(DEFAULT_GUI_FONT),0);
74
  SendMessage(WM_SETTEXT,0,(LPARAM)(LPCTSTR)m_strInitialValue);
75
        return 0;
76
}
77
 
78
void CCellEdit::OnKillFocus(CWnd*)
79
{
80
    CConfigTool::GetCellView()->CancelCellEdit();
81
}
82
 
83
void CCellEdit::OnEditCopy   ()
84
{
85
 SendMessage(WM_COPY,0,0);
86
}
87
 
88
void CCellEdit::OnEditDelete ()
89
{
90
  SendMessage(WM_CLEAR,0,0);
91
}
92
 
93
void CCellEdit::OnEditPaste  ()
94
{
95
  SendMessage(WM_PASTE,0,0);
96
}
97
 
98
void CCellEdit::OnEditCut    ()
99
{
100
  SendMessage(WM_CUT,0,0);
101
}
102
 
103
void CCellEdit::OnUpdateEditCopy   (CCmdUI *pCmdUI)
104
{
105
  LRESULT l=SendMessage(EM_GETSEL,0,0);
106
  pCmdUI->Enable(LOWORD(l)!=HIWORD(l));
107
}
108
 
109
void CCellEdit::OnUpdateEditDelete (CCmdUI *pCmdUI)
110
{
111
  LRESULT l=SendMessage(EM_GETSEL,0,0);
112
  pCmdUI->Enable(LOWORD(l)!=HIWORD(l));
113
}
114
 
115
void CCellEdit::OnUpdateEditPaste  (CCmdUI *pCmdUI)
116
{
117
  if(OpenClipboard()){
118
    pCmdUI->Enable(NULL!=::GetClipboardData(CF_TEXT));
119
    CloseClipboard();
120
  } else {
121
    pCmdUI->Enable(false);
122
  }
123
}
124
 
125
void CCellEdit::OnUpdateEditCut    (CCmdUI *pCmdUI)
126
{
127
  LRESULT l=SendMessage(EM_GETSEL,0,0);
128
  pCmdUI->Enable(LOWORD(l)!=HIWORD(l));
129
}
130
 
131
 
132
void CCellEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
133
{
134
        switch(nChar){
135
                case 0x01: // ctrl+a
136
                        SendMessage(EM_SETSEL,0,-1);
137
                        break;
138
                case 0x03: // ctrl+c
139
                        SendMessage(WM_COPY,0,0);
140
                        break;
141
                case 0x16: // ctrl+v
142
                        SendMessage(WM_PASTE,0,0);
143
                        break;
144
                case 0x18: // ctrl+x
145
                        SendMessage(WM_CUT,0,0);
146
                        break;
147
                case 0x1a: // ctrl+z
148
                        SendMessage(EM_UNDO,0,0);
149
                        break;
150
    default:
151
      Default();
152
                        break;
153
  }
154
        CCell::OnChar(nChar, nRepCnt, nFlags);
155
}

powered by: WebSVN 2.1.0

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