/* * Initialise the GUI. Create all the windows, set up all the call-backs * etc. */ int gui_mch_init(void) { vimjs_init(); gui.border_offset = 0; gui.border_width = 0; gui.scrollbar_width = 0; gui.scrollbar_height = 0; gui.back_pixel = gui_get_color((char_u*)"black"); gui.norm_pixel = gui_get_color((char_u*)"white"); set_normal_colors(); gui_check_colors(); gui.def_back_pixel = gui.back_pixel; gui.def_norm_pixel = gui.norm_pixel; gui.in_focus = TRUE; Rows = vimjs_get_window_height() / vimjs_get_char_height(); Columns = vimjs_get_window_width() / vimjs_get_char_width(); return OK; }
/** * 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; }
void set_colors() { start_color(); use_default_colors(); set_normal_colors(); if (has_colors()) { normal_color_theme(); } else { /* give deafults */ no_colors_theme(); } }
/* * Initialise the GUI. Create all the windows, set up all the call-backs * etc. */ int gui_mch_init(void) { vimjs_init(); gui.border_width = 0; gui.scrollbar_width = 0; gui.scrollbar_height = 0; gui.back_pixel = gui_get_color("black"); gui.norm_pixel = gui_get_color("white"); set_normal_colors(); gui_check_colors(); gui.def_back_pixel = gui.back_pixel; gui.def_norm_pixel = gui.norm_pixel; gui.in_focus = TRUE; /* TODO gui.char_ascent = 6; */ return OK; }
int main(int argc, char **argv) { char *font, *type, *termmode; const char *opts; int dumpmod, dumpopt, opt; vt4_mode = is_vt4(); init(); dumpmod = 0; dumpopt = DUMP_FBF; termmode = NULL; if (vt4_mode) opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x"; else opts = "b:Cc:deE:fg:h:Hi:l:LM:m:pPr:S:s:T:t:x"; while ((opt = getopt(argc, argv, opts)) != -1) switch(opt) { case 'b': set_border_color(optarg); break; case 'C': clear_history(); break; case 'c': set_cursor_type(optarg); break; case 'd': if (vt4_mode) break; print_scrnmap(); break; case 'E': if (vt4_mode) break; set_terminal_emulator(optarg); break; case 'e': if (vt4_mode) break; get_terminal_emulators(); break; case 'f': optarg = nextarg(argc, argv, &optind, 'f', 0); if (optarg != NULL) { font = nextarg(argc, argv, &optind, 'f', 0); if (font == NULL) { type = NULL; font = optarg; } else type = optarg; load_font(type, font); } else { if (!vt4_mode) usage(); /* Switch syscons to ROM? */ load_default_vt4font(); } break; case 'g': if (sscanf(optarg, "%dx%d", &vesa_cols, &vesa_rows) != 2) { revert(); warnx("incorrect geometry: %s", optarg); usage(); } break; case 'h': set_history(optarg); break; case 'H': dumpopt = DUMP_ALL; break; case 'i': show_info(optarg); break; case 'l': if (vt4_mode) break; load_scrnmap(optarg); break; case 'L': if (vt4_mode) break; load_default_scrnmap(); break; case 'M': set_mouse_char(optarg); break; case 'm': set_mouse(optarg); break; case 'p': dumpmod = DUMP_FMT_RAW; break; case 'P': dumpmod = DUMP_FMT_TXT; break; case 'r': set_reverse_colors(argc, argv, &optind); break; case 'S': set_lockswitch(optarg); break; case 's': set_console(optarg); break; case 'T': if (strcmp(optarg, "xterm") != 0 && strcmp(optarg, "cons25") != 0) usage(); termmode = optarg; break; case 't': set_screensaver_timeout(optarg); break; case 'x': hex = 1; break; default: usage(); } if (dumpmod != 0) dump_screen(dumpmod, dumpopt); video_mode(argc, argv, &optind); set_normal_colors(argc, argv, &optind); if (optind < argc && !strcmp(argv[optind], "show")) { test_frame(); optind++; } if (termmode != NULL) set_terminal_mode(termmode); if ((optind != argc) || (argc == 1)) usage(); return (0); }
/** * 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; }