Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

menu.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

VOID MyModifyMenuItem (IN PCONSOLE_INFORMATION Console, IN UINT ItemId)
VOID InitSystemMenu (IN PCONSOLE_INFORMATION Console)
VOID InitializeMenu (IN PCONSOLE_INFORMATION Console)
VOID SetWinText (IN PCONSOLE_INFORMATION Console, IN UINT wID, IN BOOL Add)
VOID PropertiesDlgShow (IN PCONSOLE_INFORMATION Console, IN BOOL fCurrent)
VOID PropertiesUpdate (IN PCONSOLE_INFORMATION Console, IN HANDLE hClientSection)


Function Documentation

VOID InitializeMenu IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 124 of file ntcon/server/menu.c.

References cmControl, cmCopy, cmMark, cmPaste, cmScroll, CONSOLE_DISABLE_CLOSE, CONSOLE_IS_ICONIC, CONSOLE_SCROLLING, CONSOLE_SELECTING, CONSOLE_SELECTION_NOT_EMPTY, CONSOLE_TEXTMODE_BUFFER, EnableMenuItem(), IsWindow(), and NULL.

Referenced by ConsoleWindowProc().

00134 { 00135 HMENU hMenu = Console->hMenu; 00136 HMENU hHeirMenu = Console->hHeirMenu; 00137 00138 // 00139 // if we're in graphics mode, disable size menu 00140 // 00141 00142 if (!(Console->CurrentScreenBuffer->Flags & CONSOLE_TEXTMODE_BUFFER)) { 00143 EnableMenuItem(hMenu,SC_SIZE,MF_GRAYED); 00144 } 00145 00146 // 00147 // if the console is iconic, disable Mark and Scroll. 00148 // 00149 00150 if (Console->Flags & CONSOLE_IS_ICONIC) { 00151 EnableMenuItem(hHeirMenu,cmMark,MF_GRAYED); 00152 EnableMenuItem(hHeirMenu,cmScroll,MF_GRAYED); 00153 } else { 00154 00155 // 00156 // if the console is not iconic 00157 // if there are no scroll bars 00158 // or we're in mark mode 00159 // disable scroll 00160 // else 00161 // enable scroll 00162 // 00163 // if we're in scroll mode 00164 // disable mark 00165 // else 00166 // enable mark 00167 00168 if ((Console->CurrentScreenBuffer->WindowMaximizedX && 00169 Console->CurrentScreenBuffer->WindowMaximizedY) || 00170 Console->Flags & CONSOLE_SELECTING) { 00171 EnableMenuItem(hHeirMenu,cmScroll,MF_GRAYED); 00172 } else { 00173 EnableMenuItem(hHeirMenu,cmScroll,MF_ENABLED); 00174 } 00175 if (Console->Flags & CONSOLE_SCROLLING) { 00176 EnableMenuItem(hHeirMenu,cmMark,MF_GRAYED); 00177 } else { 00178 EnableMenuItem(hHeirMenu,cmMark,MF_ENABLED); 00179 } 00180 } 00181 00182 // 00183 // if we're selecting or scrolling, disable Paste. 00184 // otherwise enable it. 00185 // 00186 00187 if (Console->Flags & (CONSOLE_SELECTING | CONSOLE_SCROLLING)) { 00188 EnableMenuItem(hHeirMenu,cmPaste,MF_GRAYED); 00189 } else { 00190 EnableMenuItem(hHeirMenu,cmPaste,MF_ENABLED); 00191 } 00192 00193 // 00194 // if app has active selection, enable copy; else disabled 00195 // 00196 00197 if (Console->Flags & CONSOLE_SELECTING && 00198 Console->SelectionFlags & CONSOLE_SELECTION_NOT_EMPTY) { 00199 EnableMenuItem(hHeirMenu,cmCopy,MF_ENABLED); 00200 } else { 00201 EnableMenuItem(hHeirMenu,cmCopy,MF_GRAYED); 00202 } 00203 00204 // 00205 // disable close 00206 // 00207 00208 if (Console->Flags & CONSOLE_DISABLE_CLOSE) 00209 EnableMenuItem(hMenu,SC_CLOSE,MF_GRAYED); 00210 else 00211 EnableMenuItem(hMenu,SC_CLOSE,MF_ENABLED); 00212 00213 // 00214 // enable Move if not iconic 00215 // 00216 00217 if (Console->Flags & CONSOLE_IS_ICONIC) { 00218 EnableMenuItem(hMenu,SC_MOVE,MF_GRAYED); 00219 } else { 00220 EnableMenuItem(hMenu,SC_MOVE,MF_ENABLED); 00221 } 00222 00223 // 00224 // enable Settings if not already doing it 00225 // 00226 00227 if (Console->hWndProperties && IsWindow(Console->hWndProperties)) { 00228 EnableMenuItem(hMenu,cmControl,MF_GRAYED); 00229 } else { 00230 EnableMenuItem(hMenu,cmControl,MF_ENABLED); 00231 Console->hWndProperties = NULL; 00232 } 00233 }

VOID InitSystemMenu IN PCONSOLE_INFORMATION  Console  ) 
 

Definition at line 61 of file ntcon/server/menu.c.

References AppendMenu(), cmControl, cmDefaults, cmEdit, ghInstance, ID_WOMENU, MyModifyMenuItem(), and NELEM.

Referenced by CreateWindowsWindow().

00064 { 00065 WCHAR ItemString[30]; 00066 int ItemLength; 00067 00068 // 00069 // load the clipboard menu. 00070 // 00071 00072 Console->hHeirMenu = LoadMenu(ghInstance, MAKEINTRESOURCE(ID_WOMENU)); 00073 if (Console->hHeirMenu) { 00074 ItemLength = LoadString(ghInstance,cmEdit,ItemString,NELEM(ItemString)); 00075 if (ItemLength == 0) 00076 KdPrint(("LoadString 1 failed %d\n",GetLastError())); 00077 } 00078 else 00079 KdPrint(("LoadMenu 1 failed %d\n",GetLastError())); 00080 00081 // 00082 // edit the accelerators off of the standard items. 00083 // 00084 00085 MyModifyMenuItem(Console,SC_CLOSE); 00086 00087 // 00088 // Append the clipboard menu to system menu 00089 // 00090 00091 if (!AppendMenu(Console->hMenu, 00092 MF_POPUP | MF_STRING, 00093 (ULONG_PTR)Console->hHeirMenu, 00094 //"Edit" 00095 ItemString 00096 )) { 00097 KdPrint(("AppendMenu 1 failed %d\n",GetLastError())); 00098 } 00099 00100 // 00101 // Add other items to system menu 00102 // 00103 00104 ItemLength = LoadString(ghInstance,cmDefaults,ItemString,NELEM(ItemString)); 00105 if (ItemLength == 0) 00106 KdPrint(("LoadString %d failed %d\n",cmDefaults,GetLastError())); 00107 if (ItemLength) { 00108 if (!AppendMenu(Console->hMenu, MF_STRING, cmDefaults, ItemString)) { 00109 KdPrint(("AppendMenu %d failed %d\n",cmDefaults,GetLastError())); 00110 } 00111 } 00112 ItemLength = LoadString(ghInstance,cmControl,ItemString,NELEM(ItemString)); 00113 if (ItemLength == 0) 00114 KdPrint(("LoadString %d failed %d\n",cmControl,GetLastError())); 00115 if (ItemLength) { 00116 if (!AppendMenu(Console->hMenu, MF_STRING, cmControl, ItemString)) { 00117 KdPrint(("AppendMenu %d failed %d\n",cmControl,GetLastError())); 00118 } 00119 } 00120 }

VOID MyModifyMenuItem IN PCONSOLE_INFORMATION  Console,
IN UINT  ItemId
 

Definition at line 24 of file ntcon/server/menu.c.

References FALSE, ghInstance, NELEM, and SetMenuItemInfo().

Referenced by InitSystemMenu().

00036 { 00037 WCHAR ItemString[30]; 00038 int ItemLength; 00039 MENUITEMINFO mii; 00040 00041 ItemLength = LoadString(ghInstance,ItemId,ItemString,NELEM(ItemString)); 00042 if (ItemLength == 0) { 00043 //DbgPrint("LoadString in MyModifyMenu failed %d\n",GetLastError()); 00044 return; 00045 } 00046 00047 mii.cbSize = sizeof(mii); 00048 mii.fMask = MIIM_STRING; 00049 mii.dwTypeData = ItemString; 00050 00051 if (ItemId == SC_CLOSE) { 00052 mii.fMask |= MIIM_BITMAP; 00053 mii.hbmpItem = HBMMENU_POPUP_CLOSE; 00054 } 00055 00056 SetMenuItemInfo(Console->hMenu, ItemId, FALSE, &mii); 00057 00058 }

VOID PropertiesDlgShow IN PCONSOLE_INFORMATION  Console,
IN BOOL  fCurrent
 

Definition at line 287 of file ntcon/server/menu.c.

References ASSERT, _SCREEN_INFORMATION::Attributes, _SCREEN_INFORMATION::BufferInfo, CONSOLE_AUTO_POSITION, CONSOLE_HISTORY_NODUP, CONSOLE_IS_DBCS_ENABLED, CONSOLE_QUICK_EDIT_MODE, CONSOLE_TEXTMODE_BUFFER, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, _SCREEN_INFORMATION::Flags, FontInfo, InternalCreateCallbackThread(), LockConsole, NT_SUCCESS, NtClose(), NtCreateSection(), NtDuplicateObject(), NtMapViewOfSection(), NTSTATUS(), NtUnmapViewOfSection(), NULL, NumberOfFonts, _SCREEN_INFORMATION::PopupAttributes, _CONSOLE_PROCESS_HANDLE::ProcessHandle, _CONSOLE_PROCESS_HANDLE::PropRoutine, SCR_FACENAME(), SCR_FAMILY(), SCR_FONTNUMBER(), SCR_FONTSIZE(), SCR_FONTWEIGHT(), _SCREEN_INFORMATION::ScreenBufferSize, _FONT_INFO::SizeWant, Status, TM_IS_TT_FONT, and UnlockConsole().

Referenced by ConsoleWindowProc().

00299 { 00300 HANDLE hSection = NULL; 00301 HANDLE hClientSection = NULL; 00302 HANDLE hThread; 00303 SIZE_T ulViewSize; 00304 LARGE_INTEGER li; 00305 NTSTATUS Status; 00306 PCONSOLE_STATE_INFO pStateInfo; 00307 PCONSOLE_PROCESS_HANDLE ProcessHandleRecord; 00308 PSCREEN_INFORMATION ScreenInfo; 00309 LPTHREAD_START_ROUTINE MyPropRoutine; 00310 00311 /* 00312 * Map the shared memory block handle into the client side process's 00313 * address space. 00314 */ 00315 ProcessHandleRecord = CONTAINING_RECORD(Console->ProcessHandleList.Blink, 00316 CONSOLE_PROCESS_HANDLE, 00317 ListLink); 00318 /* 00319 * For global properties pass in hWnd for the hClientSection 00320 */ 00321 if (!fCurrent) { 00322 hClientSection = Console->hWnd; 00323 goto PropCallback; 00324 } 00325 00326 /* 00327 * Create a shared memory block. 00328 */ 00329 li.QuadPart = sizeof(CONSOLE_STATE_INFO) + Console->OriginalTitleLength; 00330 Status = NtCreateSection(&hSection, 00331 SECTION_ALL_ACCESS, 00332 NULL, 00333 &li, 00334 PAGE_READWRITE, 00335 SEC_COMMIT, 00336 NULL); 00337 if (!NT_SUCCESS(Status)) { 00338 KdPrint(("CONSRV: error %x creating file mapping\n", Status)); 00339 return; 00340 } 00341 00342 /* 00343 * Get a pointer to the shared memory block. 00344 */ 00345 pStateInfo = NULL; 00346 ulViewSize = 0; 00347 Status = NtMapViewOfSection(hSection, 00348 NtCurrentProcess(), 00349 &pStateInfo, 00350 0, 00351 0, 00352 NULL, 00353 &ulViewSize, 00354 ViewUnmap, 00355 0, 00356 PAGE_READWRITE); 00357 if (!NT_SUCCESS(Status)) { 00358 KdPrint(("CONSRV: error %x mapping view of file\n", Status)); 00359 NtClose(hSection); 00360 return; 00361 } 00362 00363 /* 00364 * Fill in the shared memory block with the current values. 00365 */ 00366 ScreenInfo = Console->CurrentScreenBuffer; 00367 pStateInfo->Length = li.LowPart; 00368 pStateInfo->ScreenBufferSize = ScreenInfo->ScreenBufferSize; 00369 pStateInfo->WindowSize.X = CONSOLE_WINDOW_SIZE_X(ScreenInfo); 00370 pStateInfo->WindowSize.Y = CONSOLE_WINDOW_SIZE_Y(ScreenInfo); 00371 pStateInfo->WindowPosX = Console->WindowRect.left; 00372 pStateInfo->WindowPosY = Console->WindowRect.top; 00373 if (ScreenInfo->Flags & CONSOLE_TEXTMODE_BUFFER) { 00374 pStateInfo->FontSize = SCR_FONTSIZE(ScreenInfo); 00375 pStateInfo->FontFamily = SCR_FAMILY(ScreenInfo); 00376 pStateInfo->FontWeight = SCR_FONTWEIGHT(ScreenInfo); 00377 wcscpy(pStateInfo->FaceName, SCR_FACENAME(ScreenInfo)); 00378 #if defined(FE_SB) 00379 // if TT font has external leading, the Size.Y <> SizeWant.Y 00380 // if we still pass actual Size.Y to console.cpl to query font, 00381 // it will be incorrect. Jun-26-1996 00382 00383 if (CONSOLE_IS_DBCS_ENABLED() && 00384 TM_IS_TT_FONT(SCR_FAMILY(ScreenInfo))) 00385 { 00386 if ((SCR_FONTNUMBER(ScreenInfo) >= 0 ) && 00387 (SCR_FONTNUMBER(ScreenInfo) < NumberOfFonts)) { 00388 00389 pStateInfo->FontSize = FontInfo[SCR_FONTNUMBER(ScreenInfo)].SizeWant; 00390 } 00391 } 00392 #endif 00393 pStateInfo->CursorSize = ScreenInfo->BufferInfo.TextInfo.CursorSize; 00394 } 00395 pStateInfo->FullScreen = Console->FullScreenFlags & CONSOLE_FULLSCREEN; 00396 pStateInfo->QuickEdit = Console->Flags & CONSOLE_QUICK_EDIT_MODE; 00397 pStateInfo->AutoPosition = Console->Flags & CONSOLE_AUTO_POSITION; 00398 pStateInfo->InsertMode = Console->InsertMode; 00399 pStateInfo->ScreenAttributes = ScreenInfo->Attributes; 00400 pStateInfo->PopupAttributes = ScreenInfo->PopupAttributes; 00401 pStateInfo->HistoryBufferSize = Console->CommandHistorySize; 00402 pStateInfo->NumberOfHistoryBuffers = Console->MaxCommandHistories; 00403 pStateInfo->HistoryNoDup = Console->Flags & CONSOLE_HISTORY_NODUP; 00404 RtlCopyMemory(pStateInfo->ColorTable, 00405 Console->ColorTable, 00406 sizeof(Console->ColorTable)); 00407 pStateInfo->hWnd = Console->hWnd; 00408 wcscpy(pStateInfo->ConsoleTitle, Console->OriginalTitle); 00409 #if defined(FE_SB) 00410 pStateInfo->CodePage = Console->OutputCP; 00411 #endif 00412 NtUnmapViewOfSection(NtCurrentProcess(), pStateInfo); 00413 00414 Status = NtDuplicateObject(NtCurrentProcess(), 00415 hSection, 00416 ProcessHandleRecord->ProcessHandle, 00417 &hClientSection, 00418 0, 00419 0, 00420 DUPLICATE_SAME_ACCESS); 00421 if (!NT_SUCCESS(Status)) { 00422 KdPrint(("CONSRV: error %x mapping handle to client\n", Status)); 00423 NtClose(hSection); 00424 return; 00425 } 00426 00427 PropCallback: 00428 /* 00429 * Get a pointer to the client-side properties routine. 00430 */ 00431 MyPropRoutine = ProcessHandleRecord->PropRoutine; 00432 ASSERT(MyPropRoutine); 00433 00434 /* 00435 * Call back into the client process to spawn the properties dialog. 00436 */ 00437 UnlockConsole(Console); 00438 hThread = InternalCreateCallbackThread(ProcessHandleRecord->ProcessHandle, 00439 (ULONG_PTR)MyPropRoutine, 00440 (ULONG_PTR)hClientSection); 00441 if (!hThread) { 00442 KdPrint(("CONSRV: CreateRemoteThread failed %d\n", GetLastError())); 00443 } 00444 LockConsole(Console); 00445 00446 /* 00447 * Close any open handles and free allocated memory. 00448 */ 00449 if (hThread) 00450 NtClose(hThread); 00451 if (hSection) 00452 NtClose(hSection); 00453 00454 return; 00455 }

VOID PropertiesUpdate IN PCONSOLE_INFORMATION  Console,
IN HANDLE  hClientSection
 

Definition at line 459 of file ntcon/server/menu.c.

References ASSERT, _SCREEN_INFORMATION::BufferInfo, ChangeDispSettings(), CONSOLE_AUTO_POSITION, CONSOLE_HISTORY_NODUP, CONSOLE_IS_DBCS_ENABLED, CONSOLE_QUICK_EDIT_MODE, CONSOLE_VDM_REGISTERED, CONSOLE_WINDOW_SIZE_X, CONSOLE_WINDOW_SIZE_Y, ConvertToFullScreen(), ConvertToWindowed(), DeleteCommandLine(), FALSE, FindCreateFont(), FullScreenInitialized, GetWindowLimits(), GetWindowPlacement, IsAvailableFarEastCodePage(), _WINDOW_LIMITS::MaximumWindowSize, min, NT_SUCCESS, NtClose(), NtDuplicateObject(), NtMapViewOfSection(), NTSTATUS(), NtUnmapViewOfSection(), NULL, _COOKED_READ_DATA::NumberOfVisibleChars, _SCREEN_INFORMATION::PopupAttributes, _CONSOLE_PROCESS_HANDLE::ProcessHandle, RedrawCommandLine(), ResizeCommandHistoryBuffers(), ResizeScreenBuffer(), SCR_FONTSIZE(), _SCREEN_INFORMATION::ScreenBufferSize, SetCursorInformation(), SetCursorMode(), SetScreenBufferFont(), SetScreenColors(), SetWindowPos, SHORT, Status, TRUE, and UINT.

Referenced by ConsoleWindowProc().

00471 { 00472 HANDLE hSection; 00473 SIZE_T ulViewSize; 00474 NTSTATUS Status; 00475 PCONSOLE_STATE_INFO pStateInfo; 00476 PCONSOLE_PROCESS_HANDLE ProcessHandleRecord; 00477 PSCREEN_INFORMATION ScreenInfo; 00478 ULONG FontIndex; 00479 WINDOWPLACEMENT wp; 00480 COORD NewSize; 00481 WINDOW_LIMITS WindowLimits; 00482 00483 /* 00484 * Map the shared memory block handle into our address space. 00485 */ 00486 ProcessHandleRecord = CONTAINING_RECORD(Console->ProcessHandleList.Blink, 00487 CONSOLE_PROCESS_HANDLE, 00488 ListLink); 00489 Status = NtDuplicateObject(ProcessHandleRecord->ProcessHandle, 00490 hClientSection, 00491 NtCurrentProcess(), 00492 &hSection, 00493 0, 00494 0, 00495 DUPLICATE_SAME_ACCESS); 00496 if (!NT_SUCCESS(Status)) { 00497 KdPrint(("CONSRV: error %x mapping client handle\n", Status)); 00498 return; 00499 } 00500 00501 /* 00502 * Get a pointer to the shared memory block. 00503 */ 00504 pStateInfo = NULL; 00505 ulViewSize = 0; 00506 Status = NtMapViewOfSection(hSection, 00507 NtCurrentProcess(), 00508 &pStateInfo, 00509 0, 00510 0, 00511 NULL, 00512 &ulViewSize, 00513 ViewUnmap, 00514 0, 00515 PAGE_READONLY); 00516 if (!NT_SUCCESS(Status)) { 00517 KdPrint(("CONSRV: error %x mapping view of file\n", Status)); 00518 NtClose(hSection); 00519 return; 00520 } 00521 00522 /* 00523 * Verify the size of the shared memory block. 00524 */ 00525 if (ulViewSize < sizeof(CONSOLE_STATE_INFO)) { 00526 KdPrint(("CONSRV: sizeof(hSection) < sizeof(CONSOLE_STATE_INFO)\n")); 00527 NtUnmapViewOfSection(NtCurrentProcess(), pStateInfo); 00528 NtClose(hSection); 00529 return; 00530 } 00531 00532 ScreenInfo = Console->CurrentScreenBuffer; 00533 #if defined(FE_SB) 00534 if (Console->OutputCP != pStateInfo->CodePage) 00535 { 00536 UINT CodePage = Console->OutputCP; 00537 00538 Console->OutputCP = pStateInfo->CodePage; 00539 if (CONSOLE_IS_DBCS_ENABLED()) 00540 Console->fIsDBCSOutputCP = !!IsAvailableFarEastCodePage(Console->OutputCP); 00541 else 00542 Console->fIsDBCSOutputCP = FALSE; 00543 SetConsoleCPInfo(Console,TRUE); 00544 #if defined(FE_IME) 00545 SetImeOutputCodePage(Console, ScreenInfo, CodePage); 00546 #endif // FE_IME 00547 } 00548 if (Console->CP != pStateInfo->CodePage) 00549 { 00550 UINT CodePage = Console->CP; 00551 00552 Console->CP = pStateInfo->CodePage; 00553 if (CONSOLE_IS_DBCS_ENABLED()) 00554 Console->fIsDBCSCP = !!IsAvailableFarEastCodePage(Console->CP); 00555 else 00556 Console->fIsDBCSCP = FALSE; 00557 SetConsoleCPInfo(Console,FALSE); 00558 #if defined(FE_IME) 00559 SetImeCodePage(Console); 00560 #endif // FE_IME 00561 } 00562 #endif // FE_SB 00563 00564 /* 00565 * Update the console state from the supplied values. 00566 */ 00567 if (!(Console->Flags & CONSOLE_VDM_REGISTERED) && 00568 (pStateInfo->ScreenBufferSize.X != ScreenInfo->ScreenBufferSize.X || 00569 pStateInfo->ScreenBufferSize.Y != ScreenInfo->ScreenBufferSize.Y)) { 00570 00571 PCOOKED_READ_DATA CookedReadData = Console->lpCookedReadData; 00572 00573 if (CookedReadData && CookedReadData->NumberOfVisibleChars) { 00574 DeleteCommandLine(CookedReadData, FALSE); 00575 } 00576 ResizeScreenBuffer(ScreenInfo, 00577 pStateInfo->ScreenBufferSize, 00578 TRUE); 00579 if (CookedReadData && CookedReadData->NumberOfVisibleChars) { 00580 RedrawCommandLine(CookedReadData); 00581 } 00582 } 00583 #if !defined(FE_SB) 00584 FontIndex = FindCreateFont(pStateInfo->FontFamily, 00585 pStateInfo->FaceName, 00586 pStateInfo->FontSize, 00587 pStateInfo->FontWeight); 00588 #else 00589 FontIndex = FindCreateFont(pStateInfo->FontFamily, 00590 pStateInfo->FaceName, 00591 pStateInfo->FontSize, 00592 pStateInfo->FontWeight, 00593 pStateInfo->CodePage); 00594 #endif 00595 00596 #if defined(FE_SB) 00597 #if defined(i386) 00598 if (! (Console->FullScreenFlags & CONSOLE_FULLSCREEN)) { 00599 SetScreenBufferFont(ScreenInfo, FontIndex, pStateInfo->CodePage); 00600 } 00601 else { 00602 ChangeDispSettings(Console, Console->hWnd, 0); 00603 SetScreenBufferFont(ScreenInfo, FontIndex, pStateInfo->CodePage); 00604 ConvertToFullScreen(Console); 00605 ChangeDispSettings(Console, Console->hWnd, CDS_FULLSCREEN); 00606 } 00607 #else // i386 00608 SetScreenBufferFont(ScreenInfo, FontIndex, pStateInfo->CodePage); 00609 #endif 00610 #else // FE_SB 00611 SetScreenBufferFont(ScreenInfo, FontIndex); 00612 #endif // FE_SB 00613 SetCursorInformation(ScreenInfo, 00614 pStateInfo->CursorSize, 00615 ScreenInfo->BufferInfo.TextInfo.CursorVisible); 00616 00617 GetWindowLimits(ScreenInfo, &WindowLimits); 00618 NewSize.X = min(pStateInfo->WindowSize.X, WindowLimits.MaximumWindowSize.X); 00619 NewSize.Y = min(pStateInfo->WindowSize.Y, WindowLimits.MaximumWindowSize.Y); 00620 if (NewSize.X != CONSOLE_WINDOW_SIZE_X(ScreenInfo) || 00621 NewSize.Y != CONSOLE_WINDOW_SIZE_Y(ScreenInfo)) { 00622 wp.length = sizeof(wp); 00623 GetWindowPlacement(Console->hWnd, &wp); 00624 wp.rcNormalPosition.right += (NewSize.X - CONSOLE_WINDOW_SIZE_X(ScreenInfo)) * 00625 SCR_FONTSIZE(ScreenInfo).X; 00626 wp.rcNormalPosition.bottom += (NewSize.Y - CONSOLE_WINDOW_SIZE_Y(ScreenInfo)) * 00627 SCR_FONTSIZE(ScreenInfo).Y; 00628 SetWindowPlacement(Console->hWnd, &wp); 00629 } 00630 00631 #ifdef i386 00632 if (FullScreenInitialized) { 00633 if (pStateInfo->FullScreen == FALSE) { 00634 if (Console->FullScreenFlags & CONSOLE_FULLSCREEN) { 00635 ConvertToWindowed(Console); 00636 #if defined(FE_SB) 00637 /* 00638 * Should not sets 0 always. 00639 * because exist CONSOLE_FULLSCREEN_HARDWARE bit by avobe 00640 * else { 00641 * ChangeDispSettings(Console, Console->hWnd, 0); 00642 * SetScreenBufferFont(ScreenInfo, FontIndex, pStateInfo->CodePage); 00643 * ConvertToFullScreen(Console); 00644 * ChangeDispSettings(Console, Console->hWnd, CDS_FULLSCREEN); 00645 * } 00646 * block. 00647 * 00648 * This block enable as follows: 00649 * 1. console window is full screen 00650 * 2. open property by ALT+SPACE 00651 * 3. changes window mode by settings. 00652 */ 00653 Console->FullScreenFlags &= ~CONSOLE_FULLSCREEN; 00654 #else 00655 ASSERT(!(Console->FullScreenFlags & CONSOLE_FULLSCREEN_HARDWARE)); 00656 Console->FullScreenFlags = 0; 00657 #endif 00658 00659 ChangeDispSettings(Console, Console->hWnd, 0); 00660 } 00661 } else { 00662 if (Console->FullScreenFlags == 0) { 00663 ConvertToFullScreen(Console); 00664 Console->FullScreenFlags |= CONSOLE_FULLSCREEN; 00665 00666 ChangeDispSettings(Console, Console->hWnd, CDS_FULLSCREEN); 00667 } 00668 } 00669 } 00670 #endif 00671 if (pStateInfo->QuickEdit) { 00672 Console->Flags |= CONSOLE_QUICK_EDIT_MODE; 00673 } else { 00674 Console->Flags &= ~CONSOLE_QUICK_EDIT_MODE; 00675 } 00676 if (pStateInfo->AutoPosition) { 00677 Console->Flags |= CONSOLE_AUTO_POSITION; 00678 } else { 00679 Console->Flags &= ~CONSOLE_AUTO_POSITION; 00680 SetWindowPos(Console->hWnd, NULL, 00681 pStateInfo->WindowPosX, 00682 pStateInfo->WindowPosY, 00683 0, 0, SWP_NOZORDER | SWP_NOSIZE); 00684 } 00685 if (Console->InsertMode != pStateInfo->InsertMode) { 00686 SetCursorMode(ScreenInfo, FALSE); 00687 Console->InsertMode = (pStateInfo->InsertMode != FALSE); 00688 #ifdef FE_SB 00689 if (Console->lpCookedReadData) { 00690 ((PCOOKED_READ_DATA)Console->lpCookedReadData)->InsertMode = Console->InsertMode; 00691 } 00692 #endif 00693 } 00694 00695 RtlCopyMemory(Console->ColorTable, 00696 pStateInfo->ColorTable, 00697 sizeof(Console->ColorTable)); 00698 SetScreenColors(ScreenInfo, 00699 pStateInfo->ScreenAttributes, 00700 pStateInfo->PopupAttributes, 00701 TRUE); 00702 00703 ResizeCommandHistoryBuffers(Console, pStateInfo->HistoryBufferSize); 00704 Console->MaxCommandHistories = (SHORT)pStateInfo->NumberOfHistoryBuffers; 00705 if (pStateInfo->HistoryNoDup) { 00706 Console->Flags |= CONSOLE_HISTORY_NODUP; 00707 } else { 00708 Console->Flags &= ~CONSOLE_HISTORY_NODUP; 00709 } 00710 00711 #if defined(FE_IME) 00712 SetUndetermineAttribute(Console) ; 00713 #endif 00714 00715 NtUnmapViewOfSection(NtCurrentProcess(), pStateInfo); 00716 NtClose(hSection); 00717 00718 return; 00719 }

VOID SetWinText IN PCONSOLE_INFORMATION  Console,
IN UINT  wID,
IN BOOL  Add
 

Definition at line 236 of file ntcon/server/menu.c.

References GetWindowText(), ghInstance, and SetWindowText().

Referenced by CancelKeySelection(), CancelMouseSelection(), ClearScroll(), ConvertToMouseSelect(), DoScroll(), DoSelectAll(), FindDialogProc(), HandleMouseEvent(), and InitSelection().

00250 { 00251 WCHAR TextBuf[256]; 00252 PWCHAR TextBufPtr; 00253 int TextLength; 00254 int NameLength; 00255 WCHAR NameString[20]; 00256 00257 NameLength = LoadString(ghInstance,wID,NameString, 00258 sizeof(NameString)/sizeof(WCHAR)); 00259 if (Add) { 00260 RtlCopyMemory(TextBuf,NameString,NameLength*sizeof(WCHAR)); 00261 TextBuf[NameLength] = ' '; 00262 TextBufPtr = TextBuf + NameLength + 1; 00263 } else { 00264 TextBufPtr = TextBuf; 00265 } 00266 TextLength = GetWindowText(Console->hWnd, 00267 TextBufPtr, 00268 sizeof(TextBuf)/sizeof(WCHAR)-NameLength-1); 00269 if (TextLength == 0) 00270 return; 00271 if (Add) { 00272 TextBufPtr = TextBuf; 00273 } else { 00274 /* 00275 * The window title might have already been reset, so make sure 00276 * the name is there before trying to remove it. 00277 */ 00278 if (wcsncmp(NameString, TextBufPtr, NameLength) != 0) 00279 return; 00280 TextBufPtr = TextBuf + NameLength + 1; 00281 } 00282 SetWindowText(Console->hWnd,TextBufPtr); 00283 }


Generated on Sat May 15 19:44:37 2004 for test by doxygen 1.3.7