| 186 | } |
| 187 | |
| 188 | void CFrmViewerOpenGL::SetAdaptWindows(ADAPT_WINDOWS aw) |
| 189 | { |
| 190 | m_AdaptWindows = aw; |
| 191 | if(!m_Desktop.isNull()) |
| 192 | { |
| 193 | switch (m_AdaptWindows) { |
| 194 | case Original: |
| 195 | case OriginalCenter: |
| 196 | SetZoomFactor(1); |
| 197 | case Zoom: |
| 198 | ReSize(m_Desktop.width(), m_Desktop.height()); |
| 199 | m_VertexData = { -1.0, 1.0, 0.0, 0.0, |
| 200 | 1.0, 1.0, 1.0, 0.0, |
| 201 | 1.0, -1.0, 1.0, 1.0, |
| 202 | -1.0, -1.0, 0.0, 1.0 }; |
| 203 | InitVertor(); |
| 204 | break; |
| 205 | case ZoomToWindow: |
| 206 | { |
| 207 | m_VertexData = { -1.0, 1.0, 0.0, 0.0, |
| 208 | 1.0, 1.0, 1.0, 0.0, |
| 209 | 1.0, -1.0, 1.0, 1.0, |
| 210 | -1.0, -1.0, 0.0, 1.0 }; |
| 211 | InitVertor(); |
| 212 | break; |
| 213 | } |
| 214 | case KeepAspectRationToWindow: |
| 215 | { |
| 216 | QRectF r = GetAspectRationRect(); |
| 217 | m_VertexData = { -((float)r.width()/(float)width()), (float)r.height()/(float)height(), 0.0, 0.0, |
| 218 | (float)r.width()/(float)width(), (float)r.height()/(float)height(), 1.0, 0.0, |
| 219 | (float)r.width()/(float)width(), -((float)r.height()/(float)height()), 1.0, 1.0, |
| 220 | -((float)r.width()/(float)width()), -((float)r.height()/(float)height()), 0.0, 1.0 }; |
| 221 | InitVertor(); |
| 222 | break; |
| 223 | } |
| 224 | default: |
| 225 | break; |
| 226 | } |
| 227 | } |
| 228 | update(); |
| 229 | //setFocus(); |
| 230 | } |
| 231 | |
| 232 | CFrmViewerOpenGL::ADAPT_WINDOWS CFrmViewerOpenGL::GetAdaptWindows() |
| 233 | { |