~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/contrib/HexEditor/HexEditViewBase.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is part of HexEditor plugin for Code::Blocks Studio
 
3
* Copyright (C) 2008-2009 Bartlomiej Swiecki
 
4
*
 
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.
 
9
*
 
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.
 
14
*
 
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/>.
 
17
*
 
18
* $Revision: 5445 $
 
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 $
 
21
*/
 
22
 
 
23
#include "HexEditViewBase.h"
 
24
#include "HexEditPanel.h"
 
25
 
 
26
HexEditViewBase::HexEditViewBase( HexEditPanel* panel )
 
27
    : m_IsActive( false )
 
28
    , m_ScreenStartOffset( 0 )
 
29
    , m_CurrentOffset( 0 )
 
30
    , m_BlockStartOffset( 0 )
 
31
    , m_BlockEndOffset( 0 )
 
32
    , m_Panel( panel )
 
33
{
 
34
}
 
35
 
 
36
HexEditViewBase::~HexEditViewBase()
 
37
{
 
38
}
 
39
 
 
40
bool HexEditViewBase::SetActive(bool makeMeActive)
 
41
{
 
42
    if ( makeMeActive == m_IsActive ) return m_IsActive;
 
43
 
 
44
    OnActivate( makeMeActive );
 
45
    m_IsActive = makeMeActive;
 
46
    return !m_IsActive;
 
47
}
 
48
 
 
49
void HexEditViewBase::CalculateBlockSize( OffsetT screenStartOffset, OffsetT currentOffset, OffsetT& blockStart, OffsetT& blockEnd )
 
50
{
 
51
    m_ScreenStartOffset = screenStartOffset;
 
52
    m_CurrentOffset     = currentOffset;
 
53
    OnCalculateBlockSize( blockStart, blockEnd );
 
54
}
 
55
 
 
56
void HexEditViewBase::JumpToOffset( OffsetT screenStartOffset, OffsetT currentOffset, OffsetT blockStart, OffsetT blockEnd, int flags )
 
57
{
 
58
    m_BlockStartOffset  = blockStart;
 
59
    m_BlockEndOffset    = blockEnd;
 
60
    m_CurrentOffset     = currentOffset;
 
61
    m_ScreenStartOffset = screenStartOffset;
 
62
 
 
63
    OnOffsetChange( flags );
 
64
}
 
65
 
 
66
void HexEditViewBase::PutChar(wxChar ch)
 
67
{
 
68
    if ( !m_IsActive ) return;
 
69
    OnProcessChar( ch );
 
70
}
 
71
 
 
72
void HexEditViewBase::MoveLeft()
 
73
{
 
74
    if ( !m_IsActive ) return;
 
75
    OnMoveLeft();
 
76
}
 
77
 
 
78
void HexEditViewBase::MoveRight()
 
79
{
 
80
    if ( !m_IsActive ) return;
 
81
    OnMoveRight();
 
82
}
 
83
 
 
84
void HexEditViewBase::MoveUp()
 
85
{
 
86
    if ( !m_IsActive ) return;
 
87
    OnMoveUp();
 
88
}
 
89
 
 
90
void HexEditViewBase::MoveDown()
 
91
{
 
92
    if ( !m_IsActive ) return;
 
93
    OnMoveDown();
 
94
}
 
95
 
 
96
void HexEditViewBase::PutLine( OffsetT offs, HexEditLineBuffer& buff, char* content, int bytes )
 
97
{
 
98
    OnPutLine( offs, buff, content, bytes );
 
99
}
 
100
 
 
101
void HexEditViewBase::GetBlockSizes( int& blockLength, int& blockBytes, int& spacing )
 
102
{
 
103
    OnGetBlockSizes( blockLength, blockBytes, spacing );
 
104
}
 
105
 
 
106
void HexEditViewBase::ContentChange()
 
107
{
 
108
    m_Panel->ViewNotifyContentChange();
 
109
}
 
110
 
 
111
void HexEditViewBase::OffsetChange(OffsetT currentOffset)
 
112
{
 
113
    m_CurrentOffset = currentOffset;
 
114
    m_Panel->ViewNotifyOffsetChange( currentOffset );
 
115
}
 
116
 
 
117
FileContentBase * HexEditViewBase::GetContent()
 
118
{
 
119
    return m_Panel->m_Content;
 
120
}
 
121
 
 
122
unsigned int HexEditViewBase::GetLineBytes()
 
123
{
 
124
    return (unsigned int)m_Panel->m_LineBytes;
 
125
}
 
126
 
 
127
void HexEditViewBase::OnCalculateBlockSize( OffsetT& blockStart, OffsetT& blockEnd )
 
128
{
 
129
    blockStart = m_CurrentOffset;
 
130
    blockEnd   = m_CurrentOffset + 1;
 
131
}
 
132
 
 
133
void HexEditViewBase::OnOffsetChange( int )
 
134
{
 
135
}
 
136
 
 
137
int HexEditViewBase::OnGetCurrentPositionFlags()
 
138
{
 
139
    return 0;
 
140
}
 
141
 
 
142
int HexEditViewBase::GetOffsetFromColumn( int column, int& positionFlags )
 
143
{
 
144
    return OnGetOffsetFromColumn( column, positionFlags );
 
145
}
 
146