Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[144a48]: src / hugin1 / hugin / PreviewIdentifyTool.h Maximize Restore History

Download this file

PreviewIdentifyTool.h    79 lines (72 with data), 3.0 kB

 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
73
74
75
76
77
// -*- c-basic-offset: 4 -*-
/** @file PreviewIdentifyTool.cpp
*
* @author James Legg
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _PREVIEWIDENTIFYTOOL_H
#define _PREVIEWIDENTIFYTOOL_H
#include "Tool.h"
#include <set>
class GLPreviewFrame;
/** Visually connect the image numbers with the image on the preview.
* There are two ways it does this:
* -# When the user moves the mouse pointer over a image button, the image is
* highlighted in the preview.
* -# When the user moves the mouse pointer over the preview, the image under
* the pointer are highlighted with matching colours over the buttons.
*
* The highlighted images are drawn on top of the other images, with a
* coloured border.
* If the mouse is over exactly two images, a click opens the control point
* editor with those two images shown.
*/
class PreviewIdentifyTool : public Tool
{
public:
PreviewIdentifyTool(ToolHelper *helper, GLPreviewFrame *owner);
~PreviewIdentifyTool();
void Activate();
void ImagesUnderMouseChangedEvent();
void AfterDrawImagesEvent();
bool BeforeDrawImageEvent(unsigned int image);
/** Notification for when moving the mouse on an image button.
* @param image the image number of the image the mouse is on.
*/
void ShowImageNumber(unsigned int image);
/// Notification for when moving the mouse off an image button.
void StopShowingImages();
/// Show control point editor if mouse is over two images.
void MouseButtonEvent(wxMouseEvent & e);
private:
/// Generate a colour given how many colours we need and an index.
void HighlightColour(unsigned int index, unsigned int count,
unsigned char &red, unsigned char &green,
unsigned char &blue);
static bool texture_created;
/// OpenGL texture name for the circular border texture.
static unsigned int circle_border_tex;
/// OpenGL texture name for the rectangular border texture.
static unsigned int rectangle_border_tex;
/// Set of image numbers of the images we are displaying highlighted.
std::set<unsigned int> image_set;
GLPreviewFrame *preview_frame;
/// The image the user last placed their mouse over the button for
unsigned int mouse_over_image;
bool mouse_is_over_button;
};
#endif