void DbgMain_LocateWindow (HWND pmWindow, int pmWindowWidth, int pmWindowHeight) { RECT myScreenRect; int myWindowLeft, myWindowTop; static int myStCurrentLeft = 0; static int myStCurrentBottom = 0; // Calculate the top, left corner of the window myScreenRect = EdGUI_GetWorkArea (); if (myScreenRect.left + myStCurrentLeft + pmWindowWidth > myScreenRect.right) { myStCurrentLeft = 0; if (myScreenRect.left + pmWindowWidth > myScreenRect.right) { pmWindowWidth = myScreenRect.right - myScreenRect.left; } } if (myScreenRect.bottom - myStCurrentBottom - pmWindowHeight < myScreenRect.top) { myStCurrentBottom = 0; if (myScreenRect.top + pmWindowHeight > myScreenRect.bottom) { pmWindowHeight = myScreenRect.bottom - myScreenRect.top; } } myWindowLeft = myScreenRect.left + myStCurrentLeft; myWindowTop = myScreenRect.bottom - myStCurrentBottom - pmWindowHeight; myStCurrentLeft += GetSystemMetrics (SM_CYCAPTION); myStCurrentBottom += GetSystemMetrics (SM_CYCAPTION); // Set the window to the correct position SetWindowPos (pmWindow, HWND_TOP, myWindowLeft, myWindowTop, pmWindowWidth, pmWindowHeight, 0); } // DbgMain_LocateWindow
static int MyCreateSplashWindow (HWND pmSplashWindow, BOOL pmAbout) { HINSTANCE myApplicationInstance; SplashWindowInfoPtr myInfo; HDC myDisplayContext, myMemDC; BITMAP myBitmap; RECT myRect, myScreenRect; int cnt; // Get the program instance myApplicationInstance = (HINSTANCE) GetWindowLong (pmSplashWindow, GWL_HINSTANCE); // // Initialize the extra window memory // // Set the window type SetWindowLong (pmSplashWindow, WINDOW_MEM_WINDOW_TYPE, (long) WINDOW_TYPE_SPLASH); // Set the window initialized SetWindowLong (pmSplashWindow, WINDOW_MEM_WINDOW_INITIALIZED, (long) FALSE); // Create the ddit window information myInfo = MyCreateSplashWindowInfo (); if (myInfo == NULL) { return -1; } SetWindowLong (pmSplashWindow, WINDOW_MEM_WINDOW_INFO, (long) myInfo); // // Add the elements to the window // // Add the picture if (gProgram.isJava) { myInfo -> picture = LoadImage (myApplicationInstance, MAKEINTRESOURCE (READY_SPLASH_IMAGE), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); } else if (gProgram.isTuring) { if (EdGUI_GetColourDepth () == 8) { myInfo -> picture = LoadImage (myApplicationInstance, MAKEINTRESOURCE (TURING_256_SPLASH_IMAGE), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); } else { myInfo -> picture = LoadImage (myApplicationInstance, MAKEINTRESOURCE (TURING_SPLASH_IMAGE), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); } } // Get the version number MyGetVersionNumberAndTradmarkInfo (&(myInfo -> versionString), &(myInfo -> trademarkMsg)); // Get the rest of the information if (gProgram.isTuring) { myInfo -> productNameMsg [0] = MyLoadString (IDS_TURING_PRODUCT_NAME, ""); myInfo -> productNameLines = 1; } else if (gProgram.isJava) { myInfo -> productNameMsg [0] = MyLoadString (IDS_JAVA_PRODUCT_NAME_1, ""); myInfo -> productNameMsg [1] = MyLoadString (IDS_JAVA_PRODUCT_NAME_2, ""); myInfo -> productNameLines = 2; } myInfo -> createdByMsg = MyLoadString (IDS_CREATED_BY, ""); myInfo -> assistedByMsg = MyLoadString (IDS_IBM_ASSIST, ""); myInfo -> leadProgrammerMsg = MyLoadString (IDS_LEAD_PROGRAMMER, ""); myInfo -> miniMsg [0] = MyLoadString (IDS_MINI_MSG_1, gProgram.licensedTo); myInfo -> miniMsg [1] = MyLoadString (IDS_MINI_MSG_2, ""); myInfo -> miniMsg [2] = MyLoadString (IDS_MINI_MSG_3, ""); myInfo -> evalMsg [0] = MyLoadString (IDS_EVAL_MSG_1, ""); myInfo -> evalMsg [1] = MyLoadString (IDS_EVAL_MSG_2, ""); myInfo -> evalMsg [2] = MyLoadString (IDS_EVAL_MSG_3, ""); if (strlen (gProgram.expiryDateString) > 0) { myInfo -> evalMsg [3] = MyLoadString (IDS_EVAL_MSG_4, gProgram.expiryDateString); } else { myInfo -> evalMsg [3] = EdGlob_MallocString (" "); } myInfo -> restrictMsg [0] = MyLoadString (IDS_RESTRICT_MSG_1, ""); myInfo -> restrictMsg [1] = MyLoadString (IDS_RESTRICT_MSG_2, ""); myInfo -> restrictMsg [2] = MyLoadString (IDS_RESTRICT_MSG_3, ""); myInfo -> restrictMsg [3] = MyLoadString (IDS_RESTRICT_MSG_4, gProgram.expiryDateString); for (cnt = 0 ; cnt < 10 ; cnt++) { myInfo -> miniEdMsg [cnt] = MyLoadString (IDS_MINIED_MSG_1 + cnt, ""); } myInfo -> betaMsg [0] = MyLoadString (IDS_BETA_MSG_1, ""); myInfo -> betaMsg [1] = MyLoadString (IDS_BETA_MSG_2, ""); myInfo -> betaMsg [2] = MyLoadString (IDS_BETA_MSG_3, ""); myInfo -> betaMsg [3] = MyLoadString (IDS_BETA_MSG_4, gProgram.expiryDateString); myInfo -> siteMsg = MyLoadString (IDS_SITE_MSG_1, gProgram.licensedTo); myInfo -> personalMsg = MyLoadString (IDS_PERSONAL_MSG_1, gProgram.licensedTo); myInfo -> redistribMsg = MyLoadString (IDS_REDISTRIB_MSG_1, gProgram.licensedTo); myInfo -> usingJikesMsg = MyLoadString (IDS_USES_JIKES, ""); myInfo -> win95Msg = MyLoadString (IDS_WIN_95_JRE_131, ""); myInfo -> jreLevelMsg = MyLoadString (IDS_JRE_LEVEL, ""); // Create the fonts myInfo -> productNameFont = EdGUI_CreateFont (pmSplashWindow, NULL, "Times New Roman", 30, BOLD, NO_ITALIC); myInfo -> createdByFont = EdGUI_CreateFont (pmSplashWindow, NULL, "Times New Roman", 12, BOLD, NO_ITALIC); myInfo -> chiefProgrammerFont = EdGUI_CreateFont (pmSplashWindow, NULL, "Times New Roman", 10, NO_BOLD, NO_ITALIC); myInfo -> versionFont = EdGUI_CreateFont (pmSplashWindow, NULL, "Times New Roman", 12, BOLD, NO_ITALIC); myInfo -> usingJikesFont = EdGUI_CreateFont (pmSplashWindow, NULL, "Times New Roman", 12, NO_BOLD, ITALIC); myInfo -> trademarkFont = EdGUI_CreateFont (pmSplashWindow, NULL, "Arial", 8, NO_BOLD, NO_ITALIC); myDisplayContext = GetDC (pmSplashWindow); // Get bitmap size myMemDC = CreateCompatibleDC (myDisplayContext); SelectBitmap (myMemDC, myInfo -> picture); GetObject(myInfo -> picture, sizeof(BITMAP), (LPSTR) &myBitmap); DeleteDC (myMemDC); ReleaseDC (pmSplashWindow, myDisplayContext); // If the font properties have not already been determined, // determine them now (we needed a window to do so). This must be // called *after* the top widow and status window created EdSplash_PropertiesImplementChanges (); // Set the window to initialized SetWindowLong (pmSplashWindow, WINDOW_MEM_WINDOW_INITIALIZED, (long) TRUE); // Save the bitmap's height myInfo -> bitmapHeight = myBitmap.bmHeight; // Set the window size. If the splash window would not fit onto the // screen, use a text header. myRect.left = 0; myRect.right = myBitmap.bmWidth; if (gProgram.isJava) { myRect.right += 2 * MARGIN; } myRect.top = 0; MyGetSplashWindowInfo (pmSplashWindow) -> usePicture = TRUE; myRect.bottom = MyPaintSplash (pmSplashWindow, FALSE) + 2; myScreenRect = EdGUI_GetWorkArea (); if (myRect.bottom >= myScreenRect.bottom - myScreenRect.top) { MyGetSplashWindowInfo (pmSplashWindow) -> usePicture = FALSE; myRect.bottom = MyPaintSplash (pmSplashWindow, FALSE) + 2; } AdjustWindowRect (&myRect, WS_POPUP | WS_DLGFRAME, FALSE); // Set the window to the correct position SetWindowPos (pmSplashWindow, HWND_TOP, 0, 0, myRect.right - myRect.left, myRect.bottom - myRect.top, SWP_NOMOVE); myInfo -> windowWidth = myRect.right - myRect.left; EdGUI_CentreDialogBox (pmSplashWindow); ShowWindow (pmSplashWindow, SW_NORMAL); // If this is the initial splash screen, set the timer. if (!pmAbout) { SetTimer (pmSplashWindow, SPLASH_TIMER, SPLASH_TIME_IN_MILLISEC, NULL); } return 0; } // MyCreateSplashWindow
void EdSearch_RepositionReplaceDialog (HWND pmEditWindow, RECT pmSelectRect) { RECT myReplaceRect, myWindowRect, myScreenRect; int myReplaceHeight, myReplaceWidth; // Get the window's rectangle GetWindowRect (EdSearch_FindReplaceDialog, &myReplaceRect); myReplaceHeight = myReplaceRect.bottom - myReplaceRect.top; myReplaceWidth = myReplaceRect.right - myReplaceRect.left; // Get the edit window rectangle GetWindowRect (pmEditWindow, &myWindowRect); // Get the screen's rectangle myScreenRect = EdGUI_GetWorkArea (); // First solution, move the Replace dialog to the right of the edit window if (myWindowRect.right + myReplaceWidth + 5 < myScreenRect.right) { SetWindowPos (EdSearch_FindReplaceDialog, NULL, myWindowRect.right + 5, myReplaceRect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return; } // Attempt 2, move the replace window as right as possible if (pmSelectRect.right + myReplaceWidth + 5 < myScreenRect.right) { SetWindowPos (EdSearch_FindReplaceDialog, NULL, myScreenRect.right - myReplaceWidth - 5, myReplaceRect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return; } // If there's more space above than below, place the Replace dialog // above the selection if (pmSelectRect.top - myScreenRect.top > myScreenRect.bottom - pmSelectRect.bottom) { // Can I place the Replace dialog just above the window if (myWindowRect.top - myReplaceHeight - 5 > myScreenRect.top) { SetWindowPos (EdSearch_FindReplaceDialog, NULL, myReplaceRect.left, myWindowRect.top - myReplaceHeight - 5, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return; } // Will it fit above the selection? if (pmSelectRect.top - myReplaceHeight - 5 < myScreenRect.top) { // Won't fit above, wedge it along the top SetWindowPos (EdSearch_FindReplaceDialog, NULL, myReplaceRect.left, myScreenRect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return; } // Place it just above the selection SetWindowPos (EdSearch_FindReplaceDialog, NULL, myReplaceRect.left, myScreenRect.top + (pmSelectRect.top - myScreenRect.top - myReplaceHeight) / 2, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return; } else { // Can I place the Replace dialog just below the window if (myWindowRect.bottom + myReplaceHeight + 5 < myScreenRect.bottom) { SetWindowPos (EdSearch_FindReplaceDialog, NULL, myReplaceRect.left, myWindowRect.bottom + 5, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return; } // Will it fit below the selection? if (pmSelectRect.bottom + myReplaceHeight + 5 > myScreenRect.bottom) { // Won't fit below, wedge it along the top SetWindowPos (EdSearch_FindReplaceDialog, NULL, myReplaceRect.left, myScreenRect.bottom - myReplaceHeight, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return; } // Place it just below the selection SetWindowPos (EdSearch_FindReplaceDialog, NULL, myReplaceRect.left, pmSelectRect.bottom + (myScreenRect.bottom - pmSelectRect.bottom - myReplaceHeight) / 2, 0, 0, SWP_NOSIZE | SWP_NOZORDER); return; } } // EdSearch_RepositionReplaceDialog