~ubuntu-branches/ubuntu/wily/geany/wily

« back to all changes in this revision

Viewing changes to scintilla/XPM.h

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2011-12-10 07:43:26 UTC
  • mfrom: (3.3.7 sid)
  • Revision ID: package-import@ubuntu.com-20111210074326-s8yqbew5i20h33tf
Tags: 0.21-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - debian/patches/20_use_evince_viewer.patch:
     + use evince as viewer for pdf and dvi files
  - debian/patches/20_use_x_terminal_emulator.patch:
     + use x-terminal-emulator as terminal
  - debian/control
     + Add breaks on geany-plugins-common << 0.20
* Also fixes bugs:
  - Filter for MATLAB/Octave files filters everythign (LP: 885505)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Scintilla source code edit control
2
 
/** @file XPM.h
3
 
 ** Define a class that holds data in the X Pixmap (XPM) format.
4
 
 **/
5
 
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
6
 
// The License.txt file describes the conditions under which this software may be distributed.
7
 
 
8
 
#ifndef XPM_H
9
 
#define XPM_H
10
 
 
11
 
#ifdef SCI_NAMESPACE
12
 
namespace Scintilla {
13
 
#endif
14
 
 
15
 
/**
16
 
 * Hold a pixmap in XPM format.
17
 
 */
18
 
class XPM {
19
 
        int pid;                // Assigned by container
20
 
        int height;
21
 
        int width;
22
 
        int nColours;
23
 
        char *data;
24
 
        char codeTransparent;
25
 
        char *codes;
26
 
        ColourPair *colours;
27
 
        ColourAllocated ColourFromCode(int ch) const;
28
 
        void FillRun(Surface *surface, int code, int startX, int y, int x);
29
 
        char **lines;
30
 
        ColourPair *colourCodeTable[256];
31
 
public:
32
 
        XPM(const char *textForm);
33
 
        XPM(const char *const *linesForm);
34
 
        ~XPM();
35
 
        void Init(const char *textForm);
36
 
        void Init(const char *const *linesForm);
37
 
        void Clear();
38
 
        /// Similar to same named method in ViewStyle:
39
 
        void RefreshColourPalette(Palette &pal, bool want);
40
 
        /// No palette used, so just copy the desired colours to the allocated colours
41
 
        void CopyDesiredColours();
42
 
        /// Decompose image into runs and use FillRectangle for each run
43
 
        void Draw(Surface *surface, PRectangle &rc);
44
 
        char **InLinesForm() { return lines; }
45
 
        void SetId(int pid_) { pid = pid_; }
46
 
        int GetId() const { return pid; }
47
 
        int GetHeight() const { return height; }
48
 
        int GetWidth() const { return width; }
49
 
        static const char **LinesFormFromTextForm(const char *textForm);
50
 
};
51
 
 
52
 
/**
53
 
 * A collection of pixmaps indexed by integer id.
54
 
 */
55
 
class XPMSet {
56
 
        XPM **set;      ///< The stored XPMs.
57
 
        int len;        ///< Current number of XPMs.
58
 
        int maximum;    ///< Current maximum number of XPMs, increased by steps if reached.
59
 
        int height;     ///< Memorize largest height of the set.
60
 
        int width;      ///< Memorize largest width of the set.
61
 
public:
62
 
        XPMSet();
63
 
        ~XPMSet();
64
 
        /// Remove all XPMs.
65
 
        void Clear();
66
 
        /// Add a XPM.
67
 
        void Add(int id, const char *textForm);
68
 
        /// Get XPM by id.
69
 
        XPM *Get(int id);
70
 
        /// Give the largest height of the set.
71
 
        int GetHeight();
72
 
        /// Give the largest width of the set.
73
 
        int GetWidth();
74
 
};
75
 
 
76
 
#ifdef SCI_NAMESPACE
77
 
}
78
 
#endif
79
 
 
80
 
#endif