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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [common/] [win32/] [thinsplitter.cpp] - Blame information for rev 26

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
//===========================================================================
26
//#####DESCRIPTIONBEGIN####
27
//
28
// Author(s):   sdf
29
// Contact(s):  sdf
30
// Date:                1998/08/11
31
// Version:             0.01
32
// Purpose:     
33
// Description: Implementation of a CSplitterWndEx override for control/cell view split
34
// Requires:    
35
// Provides:    
36
// See also:    
37
// Known bugs:  
38
// Usage:       
39
//
40
//####DESCRIPTIONEND####
41
//
42
//===========================================================================
43
#include "stdafx.h"
44
#include "ThinSplitter.h"
45
#include "ControlView.h"
46
//#include "CellView.h"
47
 
48
BEGIN_MESSAGE_MAP(CThinSplitter, CSplitterWndEx)
49
        //{{AFX_MSG_MAP(CThinSplitter)
50
        ON_WM_SIZE()
51
        ON_WM_VSCROLL()
52
        ON_WM_MOUSEWHEEL()
53
        //}}AFX_MSG_MAP
54
END_MESSAGE_MAP()
55
 
56
//IMPLEMENT_DYNCREATE(CThinSplitter, CSplitterWndEx)
57
 
58
CThinSplitter::CThinSplitter():
59
        m_fColumnRatio(0.75),
60
        CSplitterWndEx()
61
{
62
  m_GrayPen.CreatePen(PS_SOLID,1,RGB(192,192,192));
63
}
64
 
65
CThinSplitter::~CThinSplitter()
66
{
67
}
68
 
69
void CThinSplitter::OnDrawSplitter( CDC* pDC, ESplitType nType, const CRect& rect )
70
{
71
        m_cxSplitterGap=1;
72
        switch(nType){
73
                case splitBar:
74
//TRACE("paint bar pDC=%08x\n",pDC);
75
                        if(pDC){
76
                                int cx=rect.left;
77
                                CPen *pOldPen=pDC->SelectObject(&m_GrayPen);
78
                                //static CPen redpen(PS_SOLID,1,RGB(255,0,0));
79
                                //pDC->FillSolidRect(rect,RGB(192,192,192));
80
                                //CPen *pOldPen=pDC->SelectObject(&redpen);
81
 
82
                                pDC->MoveTo(cx,rect.top+m_cyBorder);
83
                                pDC->LineTo(cx,rect.bottom-m_cyBorder);
84
                                pDC->MoveTo(cx+1,rect.top+m_cyBorder);
85
                                pDC->LineTo(cx+1,rect.bottom-m_cyBorder);
86
                                pDC->SelectObject(pOldPen);
87
 
88
                                return;
89
                        }
90
                        break;
91
                case splitBorder:
92
                        //if(pDC)
93
                        {
94
                                CRect rcClient;
95
                                GetClientRect(rcClient);
96
                                CSplitterWndEx::OnDrawSplitter( pDC,splitBorder,rcClient);
97
                                return;
98
                        }
99
                default:
100
                        break;
101
        }
102
 
103
        CSplitterWndEx::OnDrawSplitter( pDC,  nType,rect );
104
}
105
 
106
void CThinSplitter::DeleteColumn(int colDelete)
107
{
108
        // Do nothing - we don't allow deletion of columns
109
        UNUSED_ALWAYS(colDelete);
110
}
111
 
112
int CThinSplitter::HitTest(CPoint pt) const
113
{
114
        enum HitTestValue
115
        {
116
                hSplitterBar1           = 201,
117
        };
118
        int rc=CSplitterWndEx::HitTest(pt);
119
        if(rc==0){
120
                // Be more lenient about finding the splitter bar
121
                CRect rect;
122
                GetClientRect(rect);
123
                rect.left = m_pColInfo[0].nCurSize-3;
124
                rect.right = m_pColInfo[0].nCurSize + m_cxSplitterGap + 3;
125
                if (rect.PtInRect(pt))
126
                {
127
                        rc=hSplitterBar1;
128
                }
129
        }
130
        return rc;
131
}
132
 
133
void CThinSplitter::OnSize( UINT nType, int cx, int cy )
134
{
135
        //if(m_nCols>1 && m_pColInfo){
136
        //      SetColumnInfo(0,int(m_fColumnRatio * cx + 0.5),0);
137
        //}
138
        CSplitterWndEx::OnSize( nType, cx, cy );
139
}
140
 
141
// Two reasons for this: 1-the annoying debug warning the MFC version emits and
142
// 2- an apparent bug whereby the scrollbar gets frozen.
143
void CThinSplitter::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
144
{
145
        for (int col = 0; col < m_nCols; col++)
146
        {
147
                GetPane(0, col)->SendMessage(WM_VSCROLL,
148
                        MAKELONG(nSBCode, nPos), (LPARAM)pScrollBar->m_hWnd);
149
        }
150
}
151
 
152
BOOL CThinSplitter::SplitColumn(int cxBefore){
153
        CRect rcClient;
154
        GetClientRect(rcClient);
155
        m_pColInfo[0].nCurSize=m_pColInfo[0].nIdealSize;
156
        //m_pDynamicViewClass = RUNTIME_CLASS(CCellView);
157
        int rc=CSplitterWndEx::SplitColumn(cxBefore);
158
        double d0=double(m_pColInfo[0].nCurSize);
159
        double d1=double(m_pColInfo[1].nCurSize);
160
        m_fColumnRatio=d0/(d0+d1);
161
        return rc;
162
}
163
 
164
// We do this because the CSplitterWndEx implementation assumes both children are derived
165
// from CScrollView - so here we just let the children handle the message themselves.
166
BOOL CThinSplitter::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
167
{
168
        return TRUE;
169
        UNUSED_ALWAYS(nFlags);
170
        UNUSED_ALWAYS(zDelta);
171
        UNUSED_ALWAYS(pt);
172
}
173
 
174
void CThinSplitter::RecalcLayout()
175
{
176
        CSplitterWndEx::RecalcLayout();
177
        if (m_nCols==2 && m_pColInfo[0].nCurSize && m_pColInfo[1].nCurSize){
178
                CRect rect;
179
                GetClientRect(rect);
180
                m_fColumnRatio=double(m_pColInfo[0].nCurSize)/double(rect.Width());
181
        }
182
}
183
 
184
BOOL CThinSplitter::CreateStatic( CWnd* pParentWnd, int nRows, int nCols, DWORD dwStyle, UINT nID)
185
{
186
  bool rc=CSplitterWndEx::CreateStatic(pParentWnd, nRows, nCols, dwStyle, nID);
187
  m_nMaxRows=1;
188
  return rc;
189
}
190
 

powered by: WebSVN 2.1.0

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