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

Subversion Repositories openrisc

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

powered by: WebSVN 2.1.0

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