~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/src/msvc6/testrunner/MsDevCallerListCtrl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// MsDevCallerListCtrl.cpp : implementation file
 
2
//
 
3
 
 
4
#include "stdafx.h"
 
5
#include <atlbase.h>
 
6
 
 
7
#include "MsDevCallerListCtrl.h"
 
8
#include <msvc6/testrunner/TestRunner.h>
 
9
#include <msvc6/DSPlugin/TestRunnerDSPluginVC6.h>
 
10
 
 
11
#ifdef _DEBUG
 
12
#define new DEBUG_NEW
 
13
#undef THIS_FILE
 
14
static char THIS_FILE[] = __FILE__;
 
15
#endif
 
16
 
 
17
/////////////////////////////////////////////////////////////////////////////
 
18
// MsDevCallerListCtrl
 
19
 
 
20
 
 
21
 
 
22
MsDevCallerListCtrl::MsDevCallerListCtrl()
 
23
    : m_lineNumberSubItem( 3 )
 
24
    , m_fileNameSubItem( 4 )
 
25
{
 
26
  m_comInitialized = SUCCEEDED( CoInitialize(NULL) );
 
27
}
 
28
 
 
29
MsDevCallerListCtrl::~MsDevCallerListCtrl()
 
30
{
 
31
        if ( m_comInitialized )
 
32
    CoUninitialize();
 
33
}
 
34
 
 
35
 
 
36
void 
 
37
MsDevCallerListCtrl::setLineNumberSubItem( int subItemIndex )
 
38
{
 
39
  m_lineNumberSubItem = subItemIndex;
 
40
}
 
41
 
 
42
 
 
43
void 
 
44
MsDevCallerListCtrl::setFileNameSubItem( int fileNameItemIndex )
 
45
{
 
46
  m_fileNameSubItem = fileNameItemIndex;
 
47
}
 
48
 
 
49
 
 
50
BEGIN_MESSAGE_MAP(MsDevCallerListCtrl, CListCtrl)
 
51
        //{{AFX_MSG_MAP(MsDevCallerListCtrl)
 
52
        ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
 
53
        //}}AFX_MSG_MAP
 
54
END_MESSAGE_MAP()
 
55
 
 
56
/////////////////////////////////////////////////////////////////////////////
 
57
// MsDevCallerListCtrl message handlers
 
58
 
 
59
void MsDevCallerListCtrl::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) 
 
60
{
 
61
  HRESULT hr = S_OK;
 
62
  int hotItem = 0;
 
63
 
 
64
  CComPtr< ITestRunnerDSPlugin> pIDSPlugin;
 
65
 
 
66
  hr = CoCreateInstance( CLSID_DSAddIn, NULL, CLSCTX_LOCAL_SERVER, IID_ITestRunnerDSPlugin, 
 
67
                          reinterpret_cast< void**>(&pIDSPlugin));
 
68
  
 
69
  if ( SUCCEEDED( hr))
 
70
  {
 
71
    CPoint pt;
 
72
    UINT flags = 0;
 
73
    CString lineNumber, fileName;
 
74
 
 
75
    GetCursorPos( &pt);
 
76
    ScreenToClient( &pt);
 
77
 
 
78
    // some dirty hack to get some selection
 
79
    // should get the border-width + 1, but WINDOWINFO
 
80
    // is not supported in Win95
 
81
    pt.x = 5;
 
82
 
 
83
    hotItem = HitTest( pt, &flags);
 
84
 
 
85
    lineNumber = GetItemText( hotItem, m_lineNumberSubItem);
 
86
    fileName = GetItemText( hotItem, m_fileNameSubItem);
 
87
    
 
88
    pIDSPlugin->goToLineInSourceCode( CComBSTR( fileName), _ttoi( lineNumber));
 
89
 
 
90
  }
 
91
 
 
92
  *pResult = 0;
 
93
}
 
 
b'\\ No newline at end of file'