/* * Clear around the box for fancy_bce_test(). */ static void fancy_bce_erases(BOX *box) { int i; int first; int limit; cup(box->top - 1, min_cols / 2); ed(1); /* clear from home to cursor */ cuf(1); el(0); /* clear from cursor to end of line */ cup(box->bottom + 1, min_cols / 2); ed(0); /* clear from cursor to end */ cub(1); el(1); /* clear to beginning of line */ for (i = box->top; i <= box->bottom; i++) { cup(i, box->left - 1); el(1); cup(i, box->right + 1); limit = min_cols - box->right; first = i + 1 - box->top; if (first > limit) first = limit; dch(first); limit -= first; if (limit > 0) ech(limit); } }
BOOL dc( HANDLE hCurrentProcess, HANDLE hCurrentThread, DWORD dwCurrentPc, PWINDBG_EXTENSION_APIS lpExtensionApis, LPSTR lpArgString) { PNTSD_OUTPUT_ROUTINE Print; PNTSD_GET_EXPRESSION EvalExpression; PNTSD_GET_SYMBOL GetSymbol; char ach[120]; char chVerbose, chShowFlags, chHistory; BOOL fPrintLine; ULONG i; ULONG NumberOfConsoleHandles; PCONSOLE_INFORMATION *ConsoleHandles; CONSOLE_INFORMATION Console; PCONSOLE_INFORMATION pConsole = NULL; Print = lpExtensionApis->lpOutputRoutine; EvalExpression = lpExtensionApis->lpGetExpressionRoutine; GetSymbol = lpExtensionApis->lpGetSymbolRoutine; gbShowFlagNames = FALSE; chVerbose = ' '; chShowFlags = ' '; chHistory = ' '; do { /* * Skip white space */ while (*lpArgString && *lpArgString == ' ') lpArgString++; /* * f : show flags */ switch (*lpArgString) { case 'f': // show flags gbShowFlagNames = TRUE; chShowFlags = 'f'; break; case 'v': chVerbose = 'v'; break; case 'h': chHistory = 'h'; break; case '\0': /* * If no console is specified, loop through all of them */ moveExpressionValue(NumberOfConsoleHandles, "winsrv!NumberOfConsoleHandles"); moveExpressionValue(ConsoleHandles, "winsrv!ConsoleHandles"); fPrintLine = FALSE; for (i = 0; i < NumberOfConsoleHandles; i++) { move(pConsole, ConsoleHandles); if (pConsole != NULL) { if (fPrintLine) Print("==========================================\n"); sprintf(ach, "%c %c %c %lx", chVerbose, chShowFlags, chHistory, pConsole); if (!dc(hCurrentProcess, hCurrentThread, dwCurrentPc, lpExtensionApis, ach)) { return FALSE; } fPrintLine = TRUE; } ConsoleHandles++; } return TRUE; default: pConsole = (PCONSOLE_INFORMATION)EvalExpression(lpArgString); break; } lpArgString++; } while (pConsole == NULL); move(Console, pConsole); DebugConvertToAnsi(hCurrentProcess,lpExtensionApis,Console.Title, ach); Print("PCONSOLE @ 0x%lX \"%s\"\n", pConsole, ach); if (chHistory == 'h') { PLIST_ENTRY ListHead, ListNext; LIST_ENTRY ListEntry; PCOMMAND_HISTORY History; ListHead = &(pConsole->CommandHistoryList); ListNext = Console.CommandHistoryList.Flink; while (ListNext != ListHead) { History = CONTAINING_RECORD( ListNext, COMMAND_HISTORY, ListLink ); sprintf(ach, "%lx", History); dch(hCurrentProcess, hCurrentThread, dwCurrentPc, lpExtensionApis, ach); move(ListEntry, ListNext); ListNext = ListEntry.Flink; Print("----\n"); } return TRUE; } Print("\t pConsoleLock 0x%08lX\n" "\t RefCount 0x%08lX\n" "\t pInputBuffer 0x%08lX\n" "\t pCurrentScreenBuffer 0x%08lX\n" "\t pScreenBuffers 0x%08lX\n" "\t hWnd 0x%08lX\n" "\t hDC 0x%08lX\n" "\t LastAttributes 0x%04lX\n", &pConsole->ConsoleLock, Console.RefCount, &pConsole->InputBuffer, Console.CurrentScreenBuffer, Console.ScreenBuffers, Console.hWnd, Console.hDC, Console.LastAttributes); Print("\t Flags 0x%08lX%s\n", Console.Flags, GetFlags(GF_CONSOLE, Console.Flags, NULL)); Print("\t FullScreenFlags 0x%04lX%s\n", Console.FullScreenFlags, GetFlags(GF_FULLSCREEN, Console.FullScreenFlags, NULL)); Print("\t ConsoleHandle 0x%08lX\n" "\t CtrlFlags 0x%08lX\n", Console.ConsoleHandle, Console.CtrlFlags ); if (chVerbose == 'v') { Print("\t hMenu 0x%08lX\n" "\t hHeirMenu 0x%08lX\n" "\t hSysPalette 0x%08lX\n" "\t WindowRect.L T R B 0x%08lX 0x%08lX 0x%08lX 0x%08lX\n" "\t ResizeFlags 0x%08lX\n" "\t OutputQueue.F B 0x%08lX 0x%08lX\n" "\t InitEvents[] 0x%08lX 0x%08lX\n" "\t ClientThreadHandle 0x%08lX\n" "\t ProcessHandleList.F B 0x%08lX 0x%08lX\n" "\t CommandHistoryList.F B 0x%08lX 0x%08lX\n" "\t ExeAliasList.F B 0x%08lX 0x%08lX\n", Console.hMenu, Console.hHeirMenu, Console.hSysPalette, Console.WindowRect.left, Console.WindowRect.top, Console.WindowRect.right, Console.WindowRect.bottom, Console.ResizeFlags, Console.OutputQueue.Flink, Console.OutputQueue.Blink, Console.InitEvents[0], Console.InitEvents[1], Console.ClientThreadHandle, Console.ProcessHandleList.Flink, Console.ProcessHandleList.Blink, Console.CommandHistoryList.Flink, Console.CommandHistoryList.Blink, Console.ExeAliasList.Flink, Console.ExeAliasList.Blink ); DebugConvertToAnsi(hCurrentProcess, lpExtensionApis, Console.OriginalTitle, ach ); Print("\t NumCommandHistories 0x%04lX\n" "\t MaxCommandHistories 0x%04lX\n" "\t CommandHistorySize 0x%04lX\n" "\t OriginalTitleLength 0x%04lX\n" "\t TitleLength 0x%04lX\n" "\t OriginalTitle %s\n" "\t dwHotKey 0x%08lX\n" "\t hIcon 0x%08lX\n" "\t iIcondId 0x%08lX\n" "\t ReserveKeys 0x%02lX\n" "\t WaitQueue 0x%08lX\n", Console.NumCommandHistories, Console.MaxCommandHistories, Console.CommandHistorySize, Console.OriginalTitleLength, Console.TitleLength, ach, Console.dwHotKey, Console.hIcon, Console.iIconId, Console.ReserveKeys, Console.WaitQueue ); Print("\t SelectionFlags 0x%08lX%s\n" "\t SelectionRect.L T R B 0x%04lX 0x%04lX 0x%04lX 0x%04lX\n" "\t SelectionAnchor.X Y 0x%04lX 0x%04lX\n" "\t TextCursorPosition.X Y 0x%04lX 0x%04lX\n" "\t TextCursorSize 0x%08lX\n" "\t TextCursorVisible 0x%02lX\n" "\t InsertMode 0x%02lX\n" "\t wShowWindow 0x%04lX\n" "\t dwWindowOriginX 0x%08lX\n" "\t dwWindowOriginY 0x%08lX\n" "\t PopupCount 0x%04lX\n", Console.SelectionFlags, GetFlags(GF_CONSOLESEL, Console.SelectionFlags, NULL), Console.SelectionRect.Left, Console.SelectionRect.Top, Console.SelectionRect.Right, Console.SelectionRect.Bottom, Console.SelectionAnchor.X, Console.SelectionAnchor.Y, Console.TextCursorPosition.X, Console.TextCursorPosition.Y, Console.TextCursorSize, Console.TextCursorVisible, Console.InsertMode, Console.wShowWindow, Console.dwWindowOriginX, Console.dwWindowOriginY, Console.PopupCount ); Print("\t VDMStartHardwareEvent 0x%08lX\n" "\t VDMEndHardwareEvent 0x%08lX\n" "\t VDMProcessHandle 0x%08lX\n" "\t VDMProcessId 0x%08lX\n" "\t VDMBufferSectionHandle 0x%08lX\n" "\t VDMBuffer 0x%08lX\n" "\t VDMBufferClient 0x%08lX\n" "\t VDMBufferSize.X Y 0x%04lX 0x%04lX\n" "\t StateSectionHandle 0x%08lX\n" "\t StateBuffer 0x%08lX\n" "\t StateBufferClient 0x%08lX\n" "\t StateLength 0x%08lX\n", Console.VDMStartHardwareEvent, Console.VDMEndHardwareEvent, Console.VDMProcessHandle, Console.VDMProcessId, Console.VDMBufferSectionHandle, Console.VDMBuffer, Console.VDMBufferClient, Console.VDMBufferSize.X, Console.VDMBufferSize.Y, Console.StateSectionHandle, Console.StateBuffer, Console.StateBufferClient, Console.StateLength ); Print("\t CP 0x%08lX\n" "\t OutputCP 0x%08lX\n" "\t hWndProgMan 0x%08lX\n" "\t bIconInit 0x%08lX\n" "\t LimitingProcessId 0x%08lX\n" "\t TerminationEvent 0x%08lX\n" "\t VerticalClientToWin 0x%04lX\n" "\t HorizontalClientToWin 0x%04lX\n", Console.CP, Console.OutputCP, Console.hWndProgMan, Console.bIconInit, Console.LimitingProcessId, Console.TerminationEvent, Console.VerticalClientToWindow, Console.HorizontalClientToWindow ); } return TRUE; }
int tst_insdel(MENU_ARGS) { /* Test of: SM/RM(4) (= IRM (Insertion/replacement mode)) ICH (Insert Character) DCH (Delete character) IL (Insert line) DL (Delete line) */ int i, row, col, sw, dblchr, scr132; for (scr132 = 0; scr132 <= 1; scr132++) { if (scr132) { deccolm(TRUE); sw = max_cols; } else { deccolm(FALSE); sw = min_cols; } ed(2); cup(1, 1); for (row = 1; row <= max_lines; row++) { cup(row, 1); for (col = 1; col <= sw; col++) printf("%c", 'A' - 1 + row); } cup(4, 1); printf("Screen accordion test (Insert & Delete Line). "); holdit(); ri(); el(2); decstbm(2, max_lines - 1); decom(TRUE); cup(1, 1); for (row = 1; row <= max_lines; row++) { il(row); dl(row); } decom(FALSE); decstbm(0, 0); cup(2, 1); printf("Top line: A's, bottom line: %c's, this line, nothing more. ", 'A' - 1 + max_lines); holdit(); cup(2, 1); ed(0); cup(1, 2); printf("B"); cub(1); sm("4"); for (col = 2; col <= sw - 1; col++) printf("*"); rm("4"); cup(4, 1); printf("Test of 'Insert Mode'. The top line should be 'A*** ... ***B'. "); holdit(); ri(); el(2); cup(1, 2); dch(sw - 2); cup(4, 1); printf("Test of 'Delete Character'. The top line should be 'AB'. "); holdit(); for (dblchr = 1; dblchr <= 2; dblchr++) { ed(2); for (row = 1; row <= max_lines; row++) { cup(row, 1); if (dblchr == 2) decdwl(); for (col = 1; col <= sw / dblchr; col++) printf("%c", 'A' - 1 + row); cup(row, sw / dblchr - row); dch(row); } cup(4, 1); println("The right column should be staggered "); printf("by one. "); holdit(); } ed(2); cup(1, 1); println("If your terminal has the ANSI 'Insert Character' function"); println("(the VT102 does not), then you should see a line like this"); println(" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); println("below:"); println(""); for (i = 'Z'; i >= 'A'; i--) { printf("%c%c", i, BS); ich(2); } cup(10, 1); holdit(); if (sw == max_cols) deccolm(FALSE); } return MENU_NOHOLD; }
/** * @brief Creates child views. */ void BePreferencesDlg::createViews() { BeDialogControlHelper dch(getDialogLayout()); NativeStringLoader* nsl = CoveredCalcApp::GetInstance(); rgb_color viewColor = { 216, 216, 216, 255 }; rgb_color highColor = { 0, 0, 0, 255 }; // dialog title SetTitle(nsl->LoadNativeString(NSID_PREFERENCES_TITLE)); // BaseView BView* baseView = new BView(Bounds(), PREFERENCES_DIALOG_VIEW_BASE_VIEW, B_FOLLOW_ALL_SIDES, B_WILL_DRAW); AddChild(baseView); baseView->SetViewColor(viewColor); // LangBox MBCString itemnameLangBox = ALITERAL("IDC_GROUP_LANGUAGE"); BBox* langBox = new BBox(dch.GetItemRect(itemnameLangBox, ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_LANG_BOX); baseView->AddChild(langBox); langBox->SetLabel(nsl->LoadNativeString(NSID_PREFERENCES_GROUP_LANGUAGE)); // LangPopup langMenu = new BMenu(""); langMenu->SetLabelFromMarked(true); BMenuField* langPopup = new BMenuField(dch.GetItemRect(ALITERAL("IDC_CMB_LANGUAGE"), itemnameLangBox), PREFERENCES_DIALOG_VIEW_LANG_POPUP, nsl->LoadNativeString(NSID_PREFERENCES_LANGUAGE), langMenu); langBox->AddChild(langPopup); langPopup->SetDivider(dch.GetItemPos(true, ALITERAL("IDC_CMB_LANGUAGE.divider"), ALITERAL("IDC_CMB_LANGUAGE.left"))); langPopup->SetAlignment(B_ALIGN_LEFT); uicLanguageListBox.Init(langPopup, ID_NULL); // LangNotice BRect frameRect = dch.GetItemRect(ALITERAL("IDC_STATIC_LANGUAGE_MESSAGE"), itemnameLangBox); BRect textRect = frameRect; textRect.OffsetTo(0, 0); BTextView* langNotice = new BTextView(frameRect, PREFERENCES_DIALOG_VIEW_LANG_NOTICE, textRect, B_FOLLOW_LEFT | B_FOLLOW_TOP); langBox->AddChild(langNotice); const char* text = nsl->LoadNativeString(NSID_PREFERENCES_LANGUAGE_MESSAGE); langNotice->SetText(text); langNotice->SetFontAndColor(0, strlen(text), be_plain_font, B_FONT_ALL, &highColor); langNotice->SetViewColor(viewColor); langNotice->MakeEditable(false); // KeyMappingBox MBCString itemnameKeyMappingBox = ALITERAL("IDC_GROUP_KEYMAP"); BBox* keyMappingBox = new BBox(dch.GetItemRect(itemnameKeyMappingBox, ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_KEYMAPPING_BOX); baseView->AddChild(keyMappingBox); keyMappingBox->SetLabel(nsl->LoadNativeString(NSID_PREFERENCES_GROUP_KEYMAP)); // KeyMappingPopup BMenu* keyMappingMenu = new BMenu(""); keyMappingMenu->SetLabelFromMarked(true); BMenuField* keyMappingPopup = new BMenuField(dch.GetItemRect(ALITERAL("IDC_CMB_KEYMAPPINGS"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_KEYMAPPING_POPUP, nsl->LoadNativeString(NSID_PREFERENCES_KEYMAP), keyMappingMenu); keyMappingBox->AddChild(keyMappingPopup); keyMappingPopup->SetDivider(dch.GetItemPos(true, ALITERAL("IDC_CMB_KEYMAPPINGS.divider"), ALITERAL("IDC_CMB_KEYMAPPINGS.left"))); keyMappingPopup->SetAlignment(B_ALIGN_LEFT); uicKeyMapListBox.Init(keyMappingPopup, ID_PREF_KEYMAP_SELECTED); // EditKeyMappingButton BButton* editKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_EDIT_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_EDIT_KEYMAPPING_BUTTON, nsl->LoadNativeString(NSID_PREFERENCES_EDIT_KEYMAP), new BMessage(ID_PREF_EDIT_KEYMAP)); keyMappingBox->AddChild(editKeymapButton); uicEditKeyMapButton.Init(editKeymapButton); // DuplicateKeyMappingButton BButton* dupKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_DUPLICATE_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_DUPLICATE_KEYMAPPING_BUTTON, nsl->LoadNativeString(NSID_PREFERENCES_DUPLICATE_KEYMAP), new BMessage(ID_PREF_DUPLICATE_KEYMAP)); keyMappingBox->AddChild(dupKeymapButton); uicDuplicateKeyMapButton.Init(dupKeymapButton); // DeleteKeyMappingButton BButton* delKeymapButton = new BButton(dch.GetItemRect(ALITERAL("IDC_DELETE_KEYMAPPING"), itemnameKeyMappingBox), PREFERENCES_DIALOG_VIEW_DELETE_KEYMAPPING_BUTTON, nsl->LoadNativeString(NSID_PREFERENCES_DELETE_KEYMAP), new BMessage(ID_PREF_DELETE_KEYMAP)); keyMappingBox->AddChild(delKeymapButton); uicDeleteKeyMapButton.Init(delKeymapButton); // CancelButton BButton* cancelButton = new BButton(dch.GetItemRect(ALITERAL("IDCANCEL"), ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_CANCEL, nsl->LoadNativeString(NSID_PREFERENCES_CANCEL), new BMessage(ID_DIALOG_CANCEL)); baseView->AddChild(cancelButton); // OKButton BButton* okButton = new BButton(dch.GetItemRect(ALITERAL("IDOK"), ITEMNAME_WINDOW), PREFERENCES_DIALOG_VIEW_OK, nsl->LoadNativeString(NSID_PREFERENCES_OK), new BMessage(ID_DIALOG_OK)); baseView->AddChild(okButton); SetDefaultButton(okButton); }