int main(void) { char word; printf("Enter a word to check spelling"); scanf("%c", &word); char ch; printf("1. Check Spelling\n"); printf("2. Correct Spelling Errors\n"); printf("3. Display Spelling Errors\n"); printf("Strike any other key to skip\n"); printf(" Enter your Choice \n"); ch = getchar(); /*read the selection for the keyboard*/ switch (ch) { case '1': check_spelling(word); break; case '2': correct_spelling(word); break; case '3': display_errors(word); break; default: printf("No selection made"); } }
/** * Initialize vim * * - Set default colors * - Create window and shell * - Read settings */ int gui_mch_init() { window = new MainWindow(&gui); // Load qVim settings QSettings settings("Vim", "qVim"); settings.beginGroup("mainwindow"); window->restoreState( settings.value("state").toByteArray() ); window->resize( settings.value("size", QSize(400, 400)).toSize() ); settings.endGroup(); vimshell = window->vimShell(); // Load qVim style QSettings ini(QSettings::IniFormat, QSettings::UserScope, "Vim", "qVim"); QFile styleFile( QFileInfo(ini.fileName()).absoluteDir().absoluteFilePath("qVim.style") ); if ( styleFile.open(QIODevice::ReadOnly) ) { window->setStyleSheet( styleFile.readAll() ); styleFile.close(); } // Clipboard - the order matters, for safety clip_plus.clipboardMode = QClipboard::Selection; clip_star.clipboardMode = QClipboard::Clipboard; QObject::connect(QApplication::clipboard(), SIGNAL(changed(QClipboard::Mode)), vimshell, SLOT(clipboardChanged(QClipboard::Mode))); display_errors(); /* Colors */ gui.norm_pixel = VimWrapper::toColor(QColor(Qt::black)); gui.back_pixel = VimWrapper::toColor(QColor(Qt::white)); set_normal_colors(); gui_check_colors(); highlight_gui_started(); gui.def_norm_pixel = VimWrapper::toColor(QColor(Qt::black)); gui.def_back_pixel = VimWrapper::toColor(QColor(Qt::white)); // The Scrollbar manages the scrollbars gui.scrollbar_width = 0; gui.scrollbar_height = 0; // Background color hint vimshell->setBackground(VimWrapper::backgroundColor() ); return OK; }
/** * Initialize vim * * - Set default colors * - Create window and shell * - Read settings */ int gui_mch_init() { #ifdef Q_WS_X11 bool useGUI = getenv("DISPLAY") != 0; #else bool useGUI = true; #endif QApplication *app = new QApplication(dummy_argc, dummy_argv, useGUI); window = new MainWindow(&gui); // Load qVim settings QSettings settings("Vim", "qVim"); settings.beginGroup("mainwindow"); window->restoreState( settings.value("state").toByteArray() ); settings.endGroup(); vimshell = window->vimShell(); // Load qVim style QSettings ini(QSettings::IniFormat, QSettings::UserScope, "Vim", "qVim"); QFile styleFile( QFileInfo(ini.fileName()).absoluteDir().absoluteFilePath("qVim.style") ); if ( styleFile.open(QIODevice::ReadOnly) ) { window->setStyleSheet( styleFile.readAll() ); styleFile.close(); } // // Hide the tab/menu/tool-bars, if needed they will become visible later. // Otherwise the use might see these items when Vim is loading // window->showMenu(false); window->showToolbar(false); window->showTabline(false); // Clipboard - order matters, for safety clip_star.clipboardMode = QClipboard::Selection; clip_plus.clipboardMode = QClipboard::Clipboard; display_errors(); /* Colors */ gui.norm_pixel = VimWrapper::toColor(QColor(Qt::black)); gui.back_pixel = VimWrapper::toColor(QColor(Qt::white)); set_normal_colors(); gui_check_colors(); highlight_gui_started(); gui.def_norm_pixel = VimWrapper::toColor(QColor(Qt::black)); gui.def_back_pixel = VimWrapper::toColor(QColor(Qt::white)); // The Scrollbar manages the scrollbars gui.scrollbar_width = 0; gui.scrollbar_height = 0; // Background color hint vimshell->setBackground(VimWrapper::backgroundColor() ); if ( start_fullscreen ) { gui_mch_enter_fullscreen(); } return OK; }
/* * Initialise the GUI. Create all the windows, set up all the call-backs * etc. */ int gui_mch_init(void) { const char szVimWndClass[] = VIM_CLASS; const char szTextAreaClass[] = "VimTextArea"; WNDCLASS wndclass; #ifdef WIN16_3DLOOK Ctl3dRegister(s_hinst); Ctl3dAutoSubclass(s_hinst); #endif /* Display any pending error messages */ display_errors(); gui.scrollbar_width = GetSystemMetrics(SM_CXVSCROLL); gui.scrollbar_height = GetSystemMetrics(SM_CYHSCROLL); #ifdef FEAT_MENU gui.menu_height = 0; /* Windows takes care of this */ #endif gui.border_width = 0; gui.currBgColor = INVALCOLOR; s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0) { wndclass.style = 0; wndclass.lpfnWndProc = _WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = s_hinst; wndclass.hIcon = LoadIcon(wndclass.hInstance, MAKEINTRESOURCE(IDR_VIM)); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = s_brush; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szVimWndClass; if (( #ifdef GLOBAL_IME atom = #endif RegisterClass(&wndclass)) == 0) return FAIL; } s_hwnd = CreateWindow( szVimWndClass, "Vim MSWindows GUI", WS_OVERLAPPEDWINDOW, gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, 100, /* Any value will do */ 100, /* Any value will do */ NULL, NULL, s_hinst, NULL); if (s_hwnd == NULL) return FAIL; #ifdef GLOBAL_IME global_ime_init(atom, s_hwnd); #endif /* Create the text area window */ if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0) { wndclass.style = CS_OWNDC; wndclass.lpfnWndProc = _TextAreaWndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = s_hinst; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = NULL; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szTextAreaClass; if (RegisterClass(&wndclass) == 0) return FAIL; } s_textArea = CreateWindow( szTextAreaClass, "Vim text area", WS_CHILD | WS_VISIBLE, 0, 0, 100, /* Any value will do for now */ 100, /* Any value will do for now */ s_hwnd, NULL, s_hinst, NULL); if (s_textArea == NULL) return FAIL; #ifdef FEAT_MENU s_menuBar = CreateMenu(); #endif s_hdc = GetDC(s_textArea); #ifdef MSWIN16_FASTTEXT SetBkMode(s_hdc, OPAQUE); #endif DragAcceptFiles(s_hwnd, TRUE); /* Do we need to bother with this? */ /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ /* Get background/foreground colors from the system */ gui_mch_def_colors(); /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc * file) */ set_normal_colors(); /* * Check that none of the colors are the same as the background color. * Then store the current values as the defaults. */ gui_check_colors(); gui.def_norm_pixel = gui.norm_pixel; gui.def_back_pixel = gui.back_pixel; /* Get the colors for the highlight groups (gui_check_colors() might have * changed them) */ highlight_gui_started(); /* * Start out by adding the configured border width into the border offset */ gui.border_offset = gui.border_width; /* * compute a couple of metrics used for the dialogs */ get_dialog_font_metrics(); #ifdef FEAT_TOOLBAR /* * Create the toolbar */ initialise_toolbar(); #endif #ifdef MSWIN_FIND_REPLACE /* * Initialise the dialog box stuff */ s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); /* Initialise the struct */ s_findrep_struct.lStructSize = sizeof(s_findrep_struct); s_findrep_struct.lpstrFindWhat = alloc(MSWIN_FR_BUFSIZE); s_findrep_struct.lpstrFindWhat[0] = NUL; s_findrep_struct.lpstrReplaceWith = alloc(MSWIN_FR_BUFSIZE); s_findrep_struct.lpstrReplaceWith[0] = NUL; s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; #endif return OK; }