summaryrefslogtreecommitdiff
path: root/common/view.cpp
blob: fc4a1b26a47e38b0da7ee8cffc16e6c8f298e24e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// View the project contents
//

#include <stdlib.h>
#include "project.h"
#include "view.h"

View::View (Project *pProject, GLWindow *share)
  : GLWindow (share)
{
  m_pProject = pProject;
}

View::~View ()
{
  if (m_pProject != NULL)
    m_pProject->RemoveView (this);
}

void View::OnDraw ()
{
  MakeCurrent ();

  m_pProject->SetViewSize (m_nWidth, m_nHeight);
  m_pProject->Render (false);

  SwapBuffers ();
}

void View::OnInitialUpdate ()
{
  GLWindow::OnInitialUpdate ();
  m_pProject->AddView (this);
  OnDraw ();
}

void View::OnLeftButtonDown (int x, int y, bool bControl, bool bShift)
{
  m_pProject->SetViewSize (m_nWidth, m_nHeight);
  m_pProject->OnLeftButtonDown (x, y, bControl, bShift);
}

void View::OnLeftButtonUp (int x, int y, bool bControl, bool bShift)
{
  m_pProject->SetViewSize (m_nWidth, m_nHeight);
  m_pProject->OnLeftButtonUp (x, y, bControl, bShift);
}

void View::OnLeftButtonDoubleClick (int x, int y, bool bControl, bool bShift)
{
  m_pProject->SetViewSize (m_nWidth, m_nHeight);
  m_pProject->OnLeftButtonDoubleClick (x, y, bControl, bShift);
}

void View::OnRightButtonDown (int x, int y, bool bControl, bool bShift)
{
  m_pProject->SetViewSize (m_nWidth, m_nHeight);
  m_pProject->OnRightButtonDown (x, y, bControl, bShift);
}

void View::OnRightButtonUp (int x, int y, bool bControl, bool bShift)
{
  m_pProject->SetViewSize (m_nWidth, m_nHeight);
  m_pProject->OnRightButtonUp (x, y, bControl, bShift);
}

void View::OnMouseMove (int x, int y, bool bControl, bool bShift)
{
  m_pProject->SetViewSize (m_nWidth, m_nHeight);
  m_pProject->OnMouseMove (x, y, bControl, bShift);
}