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