| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/editor/FloatingKeypadDialog.cpp $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003-08-26 03:57:38 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Floating keypad dialog |
| 26 | * |
| 27 | * $Log: not supported by cvs2svn $ |
| 28 | * |
| 29 | * 3 9/17/97 12:58p Samir |
| 30 | * Got rid of Curve Keypad. |
| 31 | * |
| 32 | * 2 8/29/97 2:49p Samir |
| 33 | * Nuked SegmentKeypad. |
| 34 | * |
| 35 | * 14 6/27/97 12:18p Samir |
| 36 | * Added Room Keypad dialog. |
| 37 | * |
| 38 | * 13 6/05/97 3:37p Samir |
| 39 | * Added megacell keypad. |
| 40 | * |
| 41 | * 12 4/08/97 10:42a Jason |
| 42 | * implemented path following interface |
| 43 | * |
| 44 | * 11 4/04/97 3:15p Samir |
| 45 | * Added paths keypad, removed player keypad since it's joined with object |
| 46 | * keypad. |
| 47 | * |
| 48 | * 10 3/26/97 6:46p Samir |
| 49 | * Fixed order of tabs in dialog box. |
| 50 | * |
| 51 | * 9 3/20/97 11:55a Jason |
| 52 | * changes for terrain editing/drawing |
| 53 | * |
| 54 | * 8 3/18/97 12:16p Samir |
| 55 | * Keypad tab is set to correct selection now when initializing. |
| 56 | * |
| 57 | * 7 3/05/97 11:49a Samir |
| 58 | * Added doorway and terrain keypad tabs. |
| 59 | * |
| 60 | * 6 3/04/97 11:37a Samir |
| 61 | * Fixed goofup in tab ordering for trigger keypad. |
| 62 | * |
| 63 | * 5 2/20/97 6:05p Samir |
| 64 | * Allow for clean activation and deactivation of surfaces in editor when |
| 65 | * going into fullscreen mode. |
| 66 | * |
| 67 | * 4 2/19/97 2:14p Samir |
| 68 | * Added a RunKeypadFunction function. |
| 69 | * |
| 70 | * 3 2/17/97 11:31a Samir |
| 71 | * Tab now resizes if keypad dialog is resized. |
| 72 | * |
| 73 | * 2 1/23/97 4:16p Samir |
| 74 | * Saves width and height, position of floating keypad. |
| 75 | * |
| 76 | * $NoKeywords: $ |
| 77 | */ |
| 78 | |
| 79 | // FloatingKeypadDialog.cpp : implementation file |
| 80 | // |
| 81 | |
| 82 | #include "stdafx.h" |
| 83 | #include "editor.h" |
| 84 | #include "TextureDialog.h" |
| 85 | #include "ObjectDialog.h" |
| 86 | #include "LightingDialog.h" |
| 87 | #include "TriggerDialog.h" |
| 88 | #include "DoorwayDialog.h" |
| 89 | #include "TerrainDialog.h" |
| 90 | #include "RoomKeypadDialog.h" |
| 91 | #include "PathPadDialog.h" |
| 92 | #include "MegacellKeypad.h" |
| 93 | #include "FloatingKeypadDialog.h" |
| 94 | |
| 95 | #include "pserror.h" |
| 96 | |
| 97 | #ifdef _DEBUG |
| 98 | #define new DEBUG_NEW |
| 99 | #undef THIS_FILE |
| 100 | static char THIS_FILE[] = __FILE__; |
| 101 | #endif |
| 102 | |
| 103 | ///////////////////////////////////////////////////////////////////////////// |
| 104 | // CFloatingKeypadDialog dialog |
| 105 | |
| 106 | CFloatingKeypadDialog::CFloatingKeypadDialog(CWnd *pParent /*=NULL*/) : CDialog(CFloatingKeypadDialog::IDD, pParent) { |
| 107 | //{{AFX_DATA_INIT(CFloatingKeypadDialog) |
| 108 | // NOTE: the ClassWizard will add member initialization here |
| 109 | //}}AFX_DATA_INIT |
| 110 | |
| 111 | m_Parent = pParent; |
| 112 | m_Initializing = FALSE; |
| 113 | m_KeypadTabDialog = NULL; |
| 114 | } |
| 115 | |
| 116 | void CFloatingKeypadDialog::DoDataExchange(CDataExchange *pDX) { |
| 117 | CDialog::DoDataExchange(pDX); |
| 118 | //{{AFX_DATA_MAP(CFloatingKeypadDialog) |
| 119 | // NOTE: the ClassWizard will add DDX and DDV calls here |
| 120 | //}}AFX_DATA_MAP |
| 121 | } |
| 122 | |
| 123 | BOOL CFloatingKeypadDialog::Create() { return CDialog::Create(CFloatingKeypadDialog::IDD, m_Parent); } |
| 124 | |
| 125 | void CFloatingKeypadDialog::RunKeypadFunction(int code) { |
| 126 | if (m_KeypadTabDialog) |
| 127 | m_KeypadTabDialog->RunKeypadFunction(code); |
| 128 | } |
| 129 | |
| 130 | void CFloatingKeypadDialog::Activate() { |
| 131 | if (m_KeypadTabDialog) |
| 132 | m_KeypadTabDialog->Activate(); |
| 133 | } |
| 134 | |
| 135 | void CFloatingKeypadDialog::Deactivate() { |
| 136 | if (m_KeypadTabDialog) |
| 137 | m_KeypadTabDialog->Deactivate(); |
| 138 | } |
| 139 | |
| 140 | BEGIN_MESSAGE_MAP(CFloatingKeypadDialog, CDialog) |
| 141 | //{{AFX_MSG_MAP(CFloatingKeypadDialog) |
| 142 | ON_WM_SHOWWINDOW() |
| 143 | ON_WM_SIZE() |
| 144 | ON_WM_MOVE() |
| 145 | ON_WM_CREATE() |
| 146 | //}}AFX_MSG_MAP |
| 147 | END_MESSAGE_MAP() |
| 148 | |
| 149 | ///////////////////////////////////////////////////////////////////////////// |
| 150 | // CFloatingKeypadDialog message handlers |
| 151 | |
| 152 | void CFloatingKeypadDialog::OnCancel() { |
| 153 | // We may force closing this dialog from the parent. |
| 154 | // DestroyWindow(); |
| 155 | } |
| 156 | |
| 157 | void CFloatingKeypadDialog::PostNcDestroy() { delete this; } |
| 158 | |
| 159 | BOOL CFloatingKeypadDialog::OnInitDialog() { |
| 160 | CDialog::OnInitDialog(); |
| 161 | |
| 162 | // TODO: Add extra initialization here |
| 163 | // Initialize keypad dialogs here. |
| 164 | CTabCtrl *tab_ctrl; |
| 165 | TC_ITEM tc_item; |
| 166 | |
| 167 | tab_ctrl = (CTabCtrl *)GetDlgItem(IDC_FLOATING_KEYPAD_TAB); |
| 168 | |
| 169 | // Add tabs to tabcontrol in the keypad dialog bar. |
| 170 | tc_item.mask = TCIF_TEXT; |
| 171 | tc_item.pszText = "Texture"; |
| 172 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 173 | tab_ctrl->InsertItem(TAB_TEXTURE_KEYPAD, &tc_item); |
| 174 | |
| 175 | tc_item.mask = TCIF_TEXT; |
| 176 | tc_item.pszText = "Megacell"; |
| 177 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 178 | tab_ctrl->InsertItem(TAB_MEGACELL_KEYPAD, &tc_item); |
| 179 | |
| 180 | tc_item.mask = TCIF_TEXT; |
| 181 | tc_item.pszText = "Terrain"; |
| 182 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 183 | tab_ctrl->InsertItem(TAB_TERRAIN_KEYPAD, &tc_item); |
| 184 | |
| 185 | tc_item.mask = TCIF_TEXT; |
| 186 | tc_item.pszText = "Object"; |
| 187 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 188 | tab_ctrl->InsertItem(TAB_OBJECTS_KEYPAD, &tc_item); |
| 189 | |
| 190 | tc_item.mask = TCIF_TEXT; |
| 191 | tc_item.pszText = "Room"; |
| 192 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 193 | tab_ctrl->InsertItem(TAB_ROOM_KEYPAD, &tc_item); |
| 194 | |
| 195 | tc_item.mask = TCIF_TEXT; |
| 196 | tc_item.pszText = "Doorway"; |
| 197 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 198 | tab_ctrl->InsertItem(TAB_DOORWAY_KEYPAD, &tc_item); |
| 199 | |
| 200 | tc_item.mask = TCIF_TEXT; |
| 201 | tc_item.pszText = "Trigger"; |
| 202 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 203 | tab_ctrl->InsertItem(TAB_TRIGGER_KEYPAD, &tc_item); |
| 204 | |
| 205 | tc_item.mask = TCIF_TEXT; |
| 206 | tc_item.pszText = "Lighting"; |
| 207 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 208 | tab_ctrl->InsertItem(TAB_LIGHTING_KEYPAD, &tc_item); |
| 209 | |
| 210 | tc_item.mask = TCIF_TEXT; |
| 211 | tc_item.pszText = "Paths"; |
| 212 | tc_item.cchTextMax = lstrlen(tc_item.pszText) + 1; |
| 213 | tab_ctrl->InsertItem(TAB_PATHS_KEYPAD, &tc_item); |
| 214 | |
| 215 | // fit keypad dialogs in tab control |
| 216 | RECT tab_rect, tab_winrect; |
| 217 | int tx, ty, tw, th; |
| 218 | |
| 219 | tab_ctrl->GetWindowRect(&tab_winrect); |
| 220 | ::CopyRect(&tab_rect, &tab_winrect); |
| 221 | tab_ctrl->AdjustRect(FALSE, &tab_rect); |
| 222 | tx = tab_rect.left - tab_winrect.left; |
| 223 | ty = tab_rect.top - tab_winrect.top; |
| 224 | tw = tab_rect.right - tab_rect.left; |
| 225 | th = tab_rect.bottom - tab_rect.top; |
| 226 | |
| 227 | // Create tab dialogs |
| 228 | // resize them to fit the tab control |
| 229 | // set scroll bars accordingly |
| 230 | m_TextureDialog = new CTextureDialog(tab_ctrl); |
| 231 | m_TextureDialog->Create(); |
| 232 | m_TextureDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 233 | |
| 234 | m_MegacellKeypad = new CMegacellKeypad(tab_ctrl); |
| 235 | m_MegacellKeypad->Create(); |
| 236 | m_MegacellKeypad->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 237 | |
| 238 | m_ObjectDialog = new CObjectDialog(tab_ctrl); |
| 239 | m_ObjectDialog->Create(); |
| 240 | m_ObjectDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 241 | |
| 242 | m_LightingDialog = new CLightingDialog(tab_ctrl); |
| 243 | m_LightingDialog->Create(); |
| 244 | m_LightingDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 245 | |
| 246 | m_RoomDialog = new CRoomKeypadDialog(tab_ctrl); |
| 247 | m_RoomDialog->Create(); |
| 248 | m_RoomDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 249 | |
| 250 | m_TriggerDialog = new CTriggerDialog(tab_ctrl); |
| 251 | m_TriggerDialog->Create(); |
| 252 | m_TriggerDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 253 | |
| 254 | m_DoorwayDialog = new CDoorwayDialog(tab_ctrl); |
| 255 | m_DoorwayDialog->Create(); |
| 256 | m_DoorwayDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 257 | |
| 258 | m_TerrainDialog = new CTerrainDialog(tab_ctrl); |
| 259 | m_TerrainDialog->Create(); |
| 260 | m_TerrainDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 261 | |
| 262 | m_PathPadDialog = new CPathPadDialog(tab_ctrl); |
| 263 | m_PathPadDialog->Create(); |
| 264 | m_PathPadDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 265 | |
| 266 | // Display current tab dialog |
| 267 | switch (D3EditState.keypad_current) { |
| 268 | case TAB_TEXTURE_KEYPAD: |
| 269 | m_KeypadTabDialog = m_TextureDialog; |
| 270 | break; |
| 271 | case TAB_OBJECTS_KEYPAD: |
| 272 | m_KeypadTabDialog = m_ObjectDialog; |
| 273 | break; |
| 274 | case TAB_LIGHTING_KEYPAD: |
| 275 | m_KeypadTabDialog = m_LightingDialog; |
| 276 | break; |
| 277 | case TAB_ROOM_KEYPAD: |
| 278 | m_KeypadTabDialog = m_RoomDialog; |
| 279 | break; |
| 280 | case TAB_PATHS_KEYPAD: |
| 281 | m_KeypadTabDialog = m_PathPadDialog; |
| 282 | break; |
| 283 | case TAB_TRIGGER_KEYPAD: |
| 284 | m_KeypadTabDialog = m_TriggerDialog; |
| 285 | break; |
| 286 | case TAB_DOORWAY_KEYPAD: |
| 287 | m_KeypadTabDialog = m_DoorwayDialog; |
| 288 | break; |
| 289 | case TAB_TERRAIN_KEYPAD: |
| 290 | m_KeypadTabDialog = m_TerrainDialog; |
| 291 | break; |
| 292 | case TAB_MEGACELL_KEYPAD: |
| 293 | m_KeypadTabDialog = m_MegacellKeypad; |
| 294 | break; |
| 295 | default: |
| 296 | Int3(); |
| 297 | } |
| 298 | |
| 299 | tab_ctrl->SetCurSel(D3EditState.keypad_current); |
| 300 | |
| 301 | return TRUE; // return TRUE unless you set the focus to a control |
| 302 | // EXCEPTION: OCX Property Pages should return FALSE |
| 303 | } |
| 304 | |
| 305 | void CFloatingKeypadDialog::OnShowWindow(BOOL bShow, UINT nStatus) { |
| 306 | CDialog::OnShowWindow(bShow, nStatus); |
| 307 | |
| 308 | m_Initializing = FALSE; |
| 309 | |
| 310 | if (bShow) |
| 311 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 312 | } |
| 313 | |
| 314 | BOOL CFloatingKeypadDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) { |
| 315 | // TODO: Add your specialized code here and/or call the base class |
| 316 | // Perform notification requests on the keypad tab dialog bar and other |
| 317 | // custom control bars. |
| 318 | NMHDR *nmhdr; |
| 319 | |
| 320 | assert(lParam != 0); |
| 321 | |
| 322 | nmhdr = (NMHDR *)lParam; |
| 323 | |
| 324 | switch (wParam) { |
| 325 | case IDC_FLOATING_KEYPAD_TAB: |
| 326 | DoKeypadTabNotify(nmhdr); |
| 327 | break; |
| 328 | } |
| 329 | |
| 330 | return CDialog::OnNotify(wParam, lParam, pResult); |
| 331 | } |
| 332 | |
| 333 | void CFloatingKeypadDialog::DoKeypadTabNotify(NMHDR *nmhdr) { |
| 334 | CTabCtrl *tab_ctrl; |
| 335 | |
| 336 | tab_ctrl = (CTabCtrl *)GetDlgItem(IDC_FLOATING_KEYPAD_TAB); |
| 337 | |
| 338 | switch (nmhdr->code) { |
| 339 | case TCN_SELCHANGE: |
| 340 | // Tab control changed. So update the controls currently displayed. |
| 341 | D3EditState.keypad_current = (int)tab_ctrl->GetCurSel(); |
| 342 | assert(D3EditState.keypad_current > -1); |
| 343 | |
| 344 | switch (D3EditState.keypad_current) { |
| 345 | case TAB_TEXTURE_KEYPAD: |
| 346 | if (m_KeypadTabDialog) |
| 347 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 348 | m_KeypadTabDialog = m_TextureDialog; |
| 349 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 350 | break; |
| 351 | |
| 352 | case TAB_OBJECTS_KEYPAD: |
| 353 | if (m_KeypadTabDialog) |
| 354 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 355 | m_KeypadTabDialog = m_ObjectDialog; |
| 356 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 357 | break; |
| 358 | |
| 359 | case TAB_LIGHTING_KEYPAD: |
| 360 | if (m_KeypadTabDialog) |
| 361 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 362 | m_KeypadTabDialog = m_LightingDialog; |
| 363 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 364 | break; |
| 365 | |
| 366 | case TAB_ROOM_KEYPAD: |
| 367 | if (m_KeypadTabDialog) |
| 368 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 369 | m_KeypadTabDialog = m_RoomDialog; |
| 370 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 371 | break; |
| 372 | |
| 373 | case TAB_PATHS_KEYPAD: |
| 374 | if (m_KeypadTabDialog) |
| 375 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 376 | m_KeypadTabDialog = m_PathPadDialog; |
| 377 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 378 | break; |
| 379 | |
| 380 | case TAB_TRIGGER_KEYPAD: |
| 381 | if (m_KeypadTabDialog) |
| 382 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 383 | m_KeypadTabDialog = m_TriggerDialog; |
| 384 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 385 | break; |
| 386 | |
| 387 | case TAB_DOORWAY_KEYPAD: |
| 388 | if (m_KeypadTabDialog) |
| 389 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 390 | m_KeypadTabDialog = m_DoorwayDialog; |
| 391 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 392 | break; |
| 393 | |
| 394 | case TAB_TERRAIN_KEYPAD: |
| 395 | if (m_KeypadTabDialog) |
| 396 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 397 | m_KeypadTabDialog = m_TerrainDialog; |
| 398 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 399 | break; |
| 400 | |
| 401 | case TAB_MEGACELL_KEYPAD: |
| 402 | if (m_KeypadTabDialog) |
| 403 | m_KeypadTabDialog->ShowWindow(SW_HIDE); |
| 404 | m_KeypadTabDialog = m_MegacellKeypad; |
| 405 | m_KeypadTabDialog->ShowWindow(SW_SHOW); |
| 406 | break; |
| 407 | } |
| 408 | break; |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | void CFloatingKeypadDialog::OnSize(UINT nType, int cx, int cy) { |
| 413 | RECT rect; |
| 414 | CTabCtrl *tab_ctrl; |
| 415 | |
| 416 | CDialog::OnSize(nType, cx, cy); |
| 417 | |
| 418 | if (m_Initializing) |
| 419 | return; |
| 420 | |
| 421 | SetRect(&rect, 0, 0, cx, cy); |
| 422 | ::AdjustWindowRect(&rect, GetStyle(), FALSE); |
| 423 | |
| 424 | D3EditState.float_keypad_w = rect.right - rect.left; |
| 425 | D3EditState.float_keypad_h = rect.bottom - rect.top; |
| 426 | |
| 427 | SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); |
| 428 | |
| 429 | // Resize tab to fit current modeless dialog size |
| 430 | RECT tab_rect, tab_winrect; |
| 431 | int tx, ty, tw, th; |
| 432 | |
| 433 | tab_ctrl = (CTabCtrl *)GetDlgItem(IDC_FLOATING_KEYPAD_TAB); |
| 434 | |
| 435 | GetClientRect(&tab_rect); |
| 436 | tab_ctrl->MoveWindow(&tab_rect); |
| 437 | |
| 438 | tab_ctrl->GetWindowRect(&tab_winrect); |
| 439 | ::CopyRect(&tab_rect, &tab_winrect); |
| 440 | tab_ctrl->AdjustRect(FALSE, &tab_rect); |
| 441 | tx = tab_rect.left - tab_winrect.left; |
| 442 | ty = tab_rect.top - tab_winrect.top; |
| 443 | tw = tab_rect.right - tab_rect.left; |
| 444 | th = tab_rect.bottom - tab_rect.top; |
| 445 | |
| 446 | m_TextureDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 447 | m_ObjectDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 448 | m_LightingDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 449 | m_RoomDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 450 | m_PathPadDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 451 | m_TriggerDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 452 | m_DoorwayDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 453 | m_TerrainDialog->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 454 | m_MegacellKeypad->SetWindowPos(tab_ctrl, tx, ty, tw, th, SWP_NOZORDER); |
| 455 | } |
| 456 | |
| 457 | void CFloatingKeypadDialog::OnMove(int x, int y) { |
| 458 | CDialog::OnMove(x, y); |
| 459 | |
| 460 | // TODO: Add your message handler code here |
| 461 | // if we haven't placed this dialog anywhere, wait till parent does it for us. |
| 462 | if (m_Initializing) |
| 463 | return; |
| 464 | |
| 465 | RECT rect; |
| 466 | GetWindowRect(&rect); |
| 467 | GetParent()->ScreenToClient(&rect); |
| 468 | D3EditState.float_keypad_x = rect.left; |
| 469 | D3EditState.float_keypad_y = rect.top; |
| 470 | |
| 471 | SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); |
| 472 | } |
| 473 | |
| 474 | int CFloatingKeypadDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) { |
| 475 | if (CDialog::OnCreate(lpCreateStruct) == -1) |
| 476 | return -1; |
| 477 | |
| 478 | // TODO: Add your specialized creation code here |
| 479 | m_Initializing = TRUE; |
| 480 | |
| 481 | return 0; |
| 482 | } |