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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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