2
* This file is part of HexEditor plugin for Code::Blocks Studio
3
* Copyright (C) 2008-2009 Bartlomiej Swiecki
5
* HexEditor plugin is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* HexEditor pluging is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with HexEditor. If not, see <http://www.gnu.org/licenses/>.
19
* $Id: HexEditViewBase.cpp 5445 2009-02-07 00:35:09Z byo $
20
* $HeadURL: svn+ssh://jenslody@svn.berlios.de/svnroot/repos/codeblocks/trunk/src/plugins/contrib/HexEditor/HexEditViewBase.cpp $
23
#include "HexEditViewBase.h"
24
#include "HexEditPanel.h"
26
HexEditViewBase::HexEditViewBase( HexEditPanel* panel )
28
, m_ScreenStartOffset( 0 )
29
, m_CurrentOffset( 0 )
30
, m_BlockStartOffset( 0 )
31
, m_BlockEndOffset( 0 )
36
HexEditViewBase::~HexEditViewBase()
40
bool HexEditViewBase::SetActive(bool makeMeActive)
42
if ( makeMeActive == m_IsActive ) return m_IsActive;
44
OnActivate( makeMeActive );
45
m_IsActive = makeMeActive;
49
void HexEditViewBase::CalculateBlockSize( OffsetT screenStartOffset, OffsetT currentOffset, OffsetT& blockStart, OffsetT& blockEnd )
51
m_ScreenStartOffset = screenStartOffset;
52
m_CurrentOffset = currentOffset;
53
OnCalculateBlockSize( blockStart, blockEnd );
56
void HexEditViewBase::JumpToOffset( OffsetT screenStartOffset, OffsetT currentOffset, OffsetT blockStart, OffsetT blockEnd, int flags )
58
m_BlockStartOffset = blockStart;
59
m_BlockEndOffset = blockEnd;
60
m_CurrentOffset = currentOffset;
61
m_ScreenStartOffset = screenStartOffset;
63
OnOffsetChange( flags );
66
void HexEditViewBase::PutChar(wxChar ch)
68
if ( !m_IsActive ) return;
72
void HexEditViewBase::MoveLeft()
74
if ( !m_IsActive ) return;
78
void HexEditViewBase::MoveRight()
80
if ( !m_IsActive ) return;
84
void HexEditViewBase::MoveUp()
86
if ( !m_IsActive ) return;
90
void HexEditViewBase::MoveDown()
92
if ( !m_IsActive ) return;
96
void HexEditViewBase::PutLine( OffsetT offs, HexEditLineBuffer& buff, char* content, int bytes )
98
OnPutLine( offs, buff, content, bytes );
101
void HexEditViewBase::GetBlockSizes( int& blockLength, int& blockBytes, int& spacing )
103
OnGetBlockSizes( blockLength, blockBytes, spacing );
106
void HexEditViewBase::ContentChange()
108
m_Panel->ViewNotifyContentChange();
111
void HexEditViewBase::OffsetChange(OffsetT currentOffset)
113
m_CurrentOffset = currentOffset;
114
m_Panel->ViewNotifyOffsetChange( currentOffset );
117
FileContentBase * HexEditViewBase::GetContent()
119
return m_Panel->m_Content;
122
unsigned int HexEditViewBase::GetLineBytes()
124
return (unsigned int)m_Panel->m_LineBytes;
127
void HexEditViewBase::OnCalculateBlockSize( OffsetT& blockStart, OffsetT& blockEnd )
129
blockStart = m_CurrentOffset;
130
blockEnd = m_CurrentOffset + 1;
133
void HexEditViewBase::OnOffsetChange( int )
137
int HexEditViewBase::OnGetCurrentPositionFlags()
142
int HexEditViewBase::GetOffsetFromColumn( int column, int& positionFlags )
144
return OnGetOffsetFromColumn( column, positionFlags );