1 | /*============================================================================= |
---|
2 | |
---|
3 | Program: JuxtaView for SAGE |
---|
4 | Module: JuxtaSCUI.h - Part of JuxtaView's UI |
---|
5 | Authors: Arun Rao, arao@evl.uic.edu, |
---|
6 | Ratko Jagodic, rjagodic@evl.uic.edu, |
---|
7 | Nicholas Schwarz, schwarz@evl.uic.edu, |
---|
8 | et al. |
---|
9 | Date: 30 September 2004 |
---|
10 | Modified: 28 October 2004 |
---|
11 | |
---|
12 | Copyright (c) 2005 Electronic Visualization Laboratory, |
---|
13 | University of Illinois at Chicago |
---|
14 | |
---|
15 | All rights reserved. |
---|
16 | * |
---|
17 | * Redistribution and use in source and binary forms, with or without |
---|
18 | * modification, are permitted provided that the following conditions are met: |
---|
19 | * |
---|
20 | * * Redistributions of source code must retain the above copyright |
---|
21 | * notice, this list of conditions and the following disclaimer. |
---|
22 | * * Redistributions in binary form must reproduce the above |
---|
23 | * copyright notice, this list of conditions and the following disclaimer |
---|
24 | * in the documentation and/or other materials provided with the distribution. |
---|
25 | * * Neither the name of the University of Illinois at Chicago nor |
---|
26 | * the names of its contributors may be used to endorse or promote |
---|
27 | * products derived from this software without specific prior written permission. |
---|
28 | * |
---|
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
33 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
34 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
35 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
36 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
37 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
38 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
39 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
40 | |
---|
41 | Direct questions, comments, etc. to schwarz@evl.uic.edu or |
---|
42 | http://www.evl.uic.edu/cavern/forum/ |
---|
43 | |
---|
44 | =============================================================================*/ |
---|
45 | |
---|
46 | #ifndef JUXTASCUI_H |
---|
47 | #define JUXTASCUI_H |
---|
48 | |
---|
49 | #include <wx/wx.h> |
---|
50 | |
---|
51 | #ifdef WIN32 |
---|
52 | #include <winsock2.h> |
---|
53 | #endif |
---|
54 | |
---|
55 | #include <QUANTA/QUANTAinit.hxx> |
---|
56 | #include <QUANTA/QUANTAnet_tcp_c.hxx> |
---|
57 | #include <QUANTA/QUANTAnet_datapack_c.hxx> |
---|
58 | |
---|
59 | #include <wx/frame.h> |
---|
60 | #include <iostream> |
---|
61 | using namespace std; |
---|
62 | |
---|
63 | #include <wx/panel.h> |
---|
64 | #include <wx/button.h> |
---|
65 | #include <wx/image.h> //for loading in images |
---|
66 | #include <wx/bitmap.h> //for drawing images |
---|
67 | #include <wx/bmpbuttn.h> //for placing images on buttons...deprecaited method |
---|
68 | #include <wx/statbmp.h> //new header for drawing images... |
---|
69 | |
---|
70 | #include "JuxtaSCUICommon.h" |
---|
71 | #define DEBUG 1 |
---|
72 | //list ID's for buttons |
---|
73 | enum |
---|
74 | { |
---|
75 | ID_PanLeft = 1000, |
---|
76 | ID_PanRight, |
---|
77 | ID_PanDown, |
---|
78 | ID_PanUp, |
---|
79 | ID_FastPanLeft, |
---|
80 | ID_FastPanRight, |
---|
81 | ID_FastPanDown, |
---|
82 | ID_FastPanUp, |
---|
83 | ID_ZoomOut, |
---|
84 | ID_ZoomIn, |
---|
85 | ID_Quit |
---|
86 | }; |
---|
87 | |
---|
88 | struct SOverview |
---|
89 | { |
---|
90 | unsigned char* imgArray; |
---|
91 | int w; |
---|
92 | int h; |
---|
93 | float normX; |
---|
94 | float normY; |
---|
95 | float normW; |
---|
96 | float normH; |
---|
97 | |
---|
98 | }; |
---|
99 | |
---|
100 | #include <wx/dcclient.h> |
---|
101 | #include <wx/pen.h> |
---|
102 | #include <wx/colordlg.h> |
---|
103 | |
---|
104 | #define OVERVIEW_MENU_ITEM_COUNT 3 |
---|
105 | #define OVERVIEW_MENU_LABEL_LENGTH 21 |
---|
106 | enum{ |
---|
107 | ID_ChangePenColor = 0, |
---|
108 | ID_ZoomOutFromMouse, |
---|
109 | ID_ZoomInFromMouse |
---|
110 | }; |
---|
111 | |
---|
112 | class JuxtaOverviewFrame : public wxFrame |
---|
113 | { |
---|
114 | private: |
---|
115 | SOverview data; |
---|
116 | wxImage* img; |
---|
117 | wxBitmap* bmptodraw; |
---|
118 | wxPaintDC* pdc; |
---|
119 | wxColour penColor; |
---|
120 | public: |
---|
121 | JuxtaOverviewFrame( wxWindow* parent, int id, const wxString& title, |
---|
122 | const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, |
---|
123 | long style=wxDEFAULT_FRAME_STYLE); |
---|
124 | ~JuxtaOverviewFrame(); |
---|
125 | void SetImage(int w, int h, unsigned char* pixels); |
---|
126 | void SetExtentRectangle(float nx, float ny, float nw, float nh); |
---|
127 | void OnPaint(wxPaintEvent& event); |
---|
128 | void OnDropDownMenu(wxMouseEvent& event); |
---|
129 | void OnMenuSelection(wxCommandEvent& event); |
---|
130 | void OnLeftMouseUp(wxMouseEvent& event); |
---|
131 | |
---|
132 | DECLARE_EVENT_TABLE(); |
---|
133 | }; |
---|
134 | |
---|
135 | //------------------------------------------- |
---|
136 | class JuxtaSCUIFrame : public wxFrame |
---|
137 | { |
---|
138 | private: |
---|
139 | QUANTAnet_tcpClient_c *client; |
---|
140 | wxStaticBitmap* statbmp; |
---|
141 | JuxtaOverviewFrame* overviewframe; |
---|
142 | bool showoverview; |
---|
143 | wxMutex clientMutex; |
---|
144 | public: |
---|
145 | JuxtaSCUIFrame( bool ov, char* skinfilename, wxWindow* parent, int id, const wxString& title, |
---|
146 | const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, |
---|
147 | long style=wxDEFAULT_FRAME_STYLE); |
---|
148 | |
---|
149 | ~JuxtaSCUIFrame(); |
---|
150 | void Init(char* ); //pass config filename |
---|
151 | void OnEvent(wxCommandEvent& event); |
---|
152 | void GetExtents(); |
---|
153 | void GetOverview(); |
---|
154 | virtual void Show(); |
---|
155 | void PassEvent(char*); |
---|
156 | void PassBuffer(void*,int); |
---|
157 | |
---|
158 | DECLARE_EVENT_TABLE(); |
---|
159 | }; |
---|
160 | |
---|
161 | extern JuxtaSCUIFrame *gMainFrame; |
---|
162 | extern wxApp* gApp; |
---|
163 | |
---|
164 | #endif |
---|