diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-20 13:55:06 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-20 13:55:06 +0100 |
commit | cf7164a088664961e7d70dd100c5874dc5ceb293 (patch) | |
tree | 93cf8f7643786a9cb9488852b73c1ef480031ee1 /src | |
parent | 065bbac8adfe29a09958570237d223457f235c6c (diff) |
patch 7.4.1364v7.4.1364
Problem: The Win 16 code is not maintained and unused.
Solution: Remove the Win 16 support.
Diffstat (limited to 'src')
-rw-r--r-- | src/Make_cyg_ming.mak | 2 | ||||
-rw-r--r-- | src/Make_mvc.mak | 2 | ||||
-rw-r--r-- | src/Make_w16.mak | 204 | ||||
-rw-r--r-- | src/Makefile | 13 | ||||
-rw-r--r-- | src/eval.c | 3 | ||||
-rw-r--r-- | src/feature.h | 7 | ||||
-rw-r--r-- | src/gui.c | 18 | ||||
-rw-r--r-- | src/gui_w16.c | 1564 | ||||
-rw-r--r-- | src/gui_w32.c | 4107 | ||||
-rw-r--r-- | src/gui_w48.c | 4155 | ||||
-rw-r--r-- | src/guiw16rc.h | 17 | ||||
-rw-r--r-- | src/misc2.c | 8 | ||||
-rw-r--r-- | src/option.c | 10 | ||||
-rw-r--r-- | src/os_msdos.c | 11 | ||||
-rw-r--r-- | src/os_mswin.c | 87 | ||||
-rw-r--r-- | src/os_win16.c | 427 | ||||
-rw-r--r-- | src/os_win16.h | 143 | ||||
-rw-r--r-- | src/proto.h | 10 | ||||
-rw-r--r-- | src/proto/gui_w16.pro | 80 | ||||
-rw-r--r-- | src/version.c | 5 | ||||
-rw-r--r-- | src/vim.h | 10 | ||||
-rw-r--r-- | src/vim16.def | 5 | ||||
-rw-r--r-- | src/vim16.rc | 81 | ||||
-rw-r--r-- | src/winclip.c | 9 |
24 files changed, 4122 insertions, 6856 deletions
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index 8dc7d003ca..f6ab0dbbf2 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -860,7 +860,7 @@ $(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h $(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o -$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL) +$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index f1b17148c2..0843d25c42 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -1175,7 +1175,7 @@ $(OUTDIR)/gui.obj: $(OUTDIR) gui.c $(INCL) $(GUI_INCL) $(OUTDIR)/gui_beval.obj: $(OUTDIR) gui_beval.c $(INCL) $(GUI_INCL) -$(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL) +$(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c $(INCL) $(GUI_INCL) $(OUTDIR)/gui_dwrite.obj: $(OUTDIR) gui_dwrite.cpp $(INCL) $(GUI_INCL) diff --git a/src/Make_w16.mak b/src/Make_w16.mak deleted file mode 100644 index 04ec663c53..0000000000 --- a/src/Make_w16.mak +++ /dev/null @@ -1,204 +0,0 @@ -# -# Borland C++ 5.0[12] makefile for vim, 16-bit windows gui version -# By Vince Negri -# -# NOTE: THIS IS OLD AND PROBABLY NO LONGER WORKS. -# -# ************************************************************* -# * WARNING! -# * This was originally produced by the IDE, but has since been -# * modified to make it work properly. Adjust with care! -# * In particular, leave LinkerLocalOptsAtW16_gvim16dexe alone -# * unless you are a guru. -# ************************************************************* -# -# Look for BOR below and either pass a different value or -# adjust the path as required. For example -# make -fMake_w16.mak -DBOR=C:\PF\Borland\BC5.01 -B BccW16.cfg -# make -fMake_w16.mak -# Note: $(BOR) is effectively ignored unless BccW16.cfg is rebuilt. -# -# Does not compile with Borland C++ 4.51 Walter Briscoe 2003-02-24 -# "out of memory" from compiler if gvim16 wildly wrong. WFB 2003-03-04 -# -# vim16.def must be a DOS-formatted file. (\r\n line endings.) -# It is a UNIX-formatted file (\n line endings) in vim-*-extra.tar.gz - -.AUTODEPEND - -# -# Borland C++ tools -# -IMPLIB = Implib -BCC = Bcc +BccW16.cfg -TLINK = TLink -TLIB = TLib -BRC = Brc -TASM = Tasm -# -# IDE macros -# - -# -# Options -# -!ifndef BOR -BOR = D:\BC5 -!endif - -# !ifndef INTDIR is lethal considering CLEAN below. WFB 2003-03-13 -INTDIR=w16 - -# /Twe Make the target a Windows .EXE with explicit functions exportable + -# /x Map file off -# /l Include source line numbers in object map files` -# /c case sensitive link -# /C Case-sensitive exports and imports (16-bit only) -# /k Produce "No Stack" warning. -# /Oa Minimise segment alignment -# /Oc Minimise Chain fixes -# /Oi Minimise Iterated data -# /Or Minimise resource alignment -# /P -P=x Code pack size -# /V Windows version for application -# /L Folder to search for library files -LinkerLocalOptsAtW16_gvim16dexe =/Twe/x/l/c/C/k/Or/Oc/Oa/Oi/P=65535/V3.10 - -CompInheritOptsAt_gvim16dexe = \ - -I$(BOR)\INCLUDE;PROTO;. \ - -DFEAT_GUI;FEAT_GUI_MSWIN;FEAT_GUI_W16;MSWIN;WIN16;MSWIN16_FASTTEXT \ - -DFEAT_TOOLBAR;WIN16_3DLOOK - -# -# Dependency List -# -Dep_Gvim16 = \ - gvim16.exe - -ObjFiles = \ - $(INTDIR)\buffer.obj\ - $(INTDIR)\charset.obj\ - $(INTDIR)\diff.obj\ - $(INTDIR)\digraph.obj\ - $(INTDIR)\edit.obj\ - $(INTDIR)\eval.obj\ - $(INTDIR)\ex_cmds.obj\ - $(INTDIR)\ex_cmds2.obj\ - $(INTDIR)\ex_docmd.obj\ - $(INTDIR)\ex_eval.obj\ - $(INTDIR)\ex_getln.obj\ - $(INTDIR)\fileio.obj\ - $(INTDIR)\fold.obj\ - $(INTDIR)\getchar.obj\ - $(INTDIR)\hardcopy.obj\ - $(INTDIR)\hashtab.obj\ - $(INTDIR)\gui.obj\ - $(INTDIR)\gui_w16.obj\ - $(INTDIR)\main.obj\ - $(INTDIR)\mark.obj\ - $(INTDIR)\mbyte.obj\ - $(INTDIR)\memfile.obj\ - $(INTDIR)\memline.obj\ - $(INTDIR)\menu.obj\ - $(INTDIR)\message.obj\ - $(INTDIR)\misc1.obj\ - $(INTDIR)\misc2.obj\ - $(INTDIR)\move.obj\ - $(INTDIR)\normal.obj\ - $(INTDIR)\ops.obj\ - $(INTDIR)\option.obj\ - $(INTDIR)\os_win16.obj\ - $(INTDIR)\os_msdos.obj\ - $(INTDIR)\os_mswin.obj\ - $(INTDIR)\winclip.obj\ - $(INTDIR)\popupmnu.obj\ - $(INTDIR)\quickfix.obj\ - $(INTDIR)\regexp.obj\ - $(INTDIR)\screen.obj\ - $(INTDIR)\search.obj\ - $(INTDIR)\spell.obj\ - $(INTDIR)\syntax.obj\ - $(INTDIR)\tag.obj\ - $(INTDIR)\term.obj\ - $(INTDIR)\ui.obj\ - $(INTDIR)\undo.obj\ - $(INTDIR)\version.obj\ - $(INTDIR)\window.obj - -Dep_gvim16dexe = \ - vimtbar.lib\ - vim16.def\ - $(INTDIR)\vim16.res\ - $(ObjFiles) - -# Without the following, the implicit rule in BUILTINS.MAK is picked up -# for a rule for .c.obj rather than the local implicit rule -.SUFFIXES -.SUFFIXES .c .obj -.path.c = . - -# -P- Force C++ compilation off -# -c Compilation only -# -n Place .OBJ files -{.}.c{$(INTDIR)}.obj: - $(BCC) -P- -c -n$(INTDIR)\ {$< } - -Gvim16 : BccW16.cfg $(Dep_Gvim16) - echo MakeNode - -gvim16.exe : $(Dep_gvim16dexe) - $(TLINK) $(LinkerLocalOptsAtW16_gvim16dexe) @&&| -c0wl.obj $(ObjFiles) -|,$*,,vimtbar ctl3dv2 import cwl, vim16.def,$(INTDIR)\vim16.res - -# Force objects to be built if $(BOR) changes -$(ObjFiles) : Make_w16.mak BccW16.cfg - -$(INTDIR)\vim16.res : vim16.rc - $(BRC) -R @&&| - $(CompInheritOptsAt_gvim16dexe) -fo$*.res $? -| - - -# Compiler configuration file -# There is no rule for $(INTDIR) as make always says it does not exist -BccW16.cfg : - -@if not exist $(INTDIR)\$(NULL) mkdir $(INTDIR) - Copy &&| --3 ; Generate 80386 protected-mode compatible instructions --a ; Byte alignment --dc ; Move string literals from data segment to code segment --ff ; Fast floating point --H ; Generate and use precompiled headers --H=$(INTDIR)\gvim16.csm ; gvim16.csm is the precompiled header filename --k- ; No standard stack frame --ml ; Large memory model --OW ; Suppress the inc bp/dec bp on windows far functions --O1 ; Generate smallest possible code --O2 ; Generate fastest possible code (overrides prior -O1 control) --pr ; Fastcall calling convention passing parameters in registers --R- ; Exclude browser information in generated .OBJ files --v- ; Turn off source debugging --vi ; Turn inline function expansion on --WE ; Only __far _export functions are exported --w ; Display warnings --w-par ; Suppress: Parameter 'parameter' is never used --w-pch ; Cannot create pre-compiled header: initialized data in header --w-sig ; identifier' declared but never used --w-ucp ; Mixing pointers to different 'char' types --wuse ; 'identifier' declared but never used - $(CompInheritOptsAt_gvim16dexe) -| $@ - -!IF "$(OS)" == "Windows_NT" -NULL= -DEL_TREE = rmdir /s /q -!ELSE -NULL=nul -DEL_TREE = deltree /y -!ENDIF - -CLEAN: - -@if exist $(INTDIR)\$(NULL) $(DEL_TREE) $(INTDIR) - -@if exist BccW16.cfg erase BccW16.cfg - -@if exist gvim16.exe erase gvim16.exe diff --git a/src/Makefile b/src/Makefile index 8985e40f42..13c7bc6041 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1336,7 +1336,7 @@ CARBONGUI_TESTARG = VIMPROG=../$(APPDIR)/Contents/MacOS/$(VIMTARGET) # All GUI files ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_xmdlg.c gui_xmebw.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c -ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_xmdlg.pro gui_athena.pro gui_gtk_x11.pro gui_x11.pro gui_w16.pro gui_w32.pro gui_photon.pro +ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_xmdlg.pro gui_athena.pro gui_gtk_x11.pro gui_x11.pro gui_w32.pro gui_photon.pro # }}} @@ -1715,7 +1715,7 @@ PRO_AUTO = \ # Resources used for the Mac are in one directory. RSRC_DIR = os_mac_rsrc -PRO_MANUAL = os_amiga.pro os_msdos.pro os_win16.pro os_win32.pro \ +PRO_MANUAL = os_amiga.pro os_msdos.pro os_win32.pro \ os_mswin.pro winclip.pro os_beos.pro os_vms.pro $(PERL_PRO) # Default target is making the executable and tools @@ -1868,20 +1868,16 @@ os_msdos.pro: os_msdos.c $(CPROTO) -DMSDOS -UHAVE_CONFIG_H $< > proto/$@ echo "/* vim: set ft=c : */" >> proto/$@ -os_win16.pro: os_win16.c - $(CPROTO) -DWIN16 -UHAVE_CONFIG_H $< > proto/$@ - echo "/* vim: set ft=c : */" >> proto/$@ - os_win32.pro: os_win32.c $(CPROTO) -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ echo "/* vim: set ft=c : */" >> proto/$@ os_mswin.pro: os_mswin.c - $(CPROTO) -DWIN16 -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ + $(CPROTO) -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ echo "/* vim: set ft=c : */" >> proto/$@ winclip.pro: winclip.c - $(CPROTO) -DWIN16 -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ + $(CPROTO) -DWIN32 -UHAVE_CONFIG_H $< > proto/$@ echo "/* vim: set ft=c : */" >> proto/$@ os_beos.pro: os_beos.c @@ -2025,6 +2021,7 @@ test_arglist \ test_menu \ test_perl \ test_quickfix \ + test_reltime \ test_searchpos \ test_set \ test_sort \ diff --git a/src/eval.c b/src/eval.c index 8afd52e0b4..017decc4af 100644 --- a/src/eval.c +++ b/src/eval.c @@ -13235,9 +13235,6 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef VMS "vms", #endif -#ifdef WIN16 - "win16", -#endif #ifdef WIN32 "win32", #endif diff --git a/src/feature.h b/src/feature.h index ca01b064ca..d7679e090c 100644 --- a/src/feature.h +++ b/src/feature.h @@ -320,7 +320,7 @@ * * Disabled for EBCDIC as it requires multibyte. */ -#if defined(FEAT_BIG) && !defined(WIN16) && VIM_SIZEOF_INT >= 4 && !defined(EBCDIC) +#if defined(FEAT_BIG) && VIM_SIZEOF_INT >= 4 && !defined(EBCDIC) # define FEAT_ARABIC #endif #ifdef FEAT_ARABIC @@ -624,8 +624,7 @@ * Multibyte support doesn't work on z/OS Unix currently. */ #if (defined(FEAT_NORMAL) || defined(FEAT_GUI_GTK) || defined(FEAT_ARABIC)) \ - && !defined(FEAT_MBYTE) && !defined(WIN16) \ - && VIM_SIZEOF_INT >= 4 && !defined(EBCDIC) + && !defined(FEAT_MBYTE) && VIM_SIZEOF_INT >= 4 && !defined(EBCDIC) # define FEAT_MBYTE #endif @@ -763,7 +762,7 @@ && (defined(FEAT_GUI_GTK) \ || (defined(FEAT_GUI_MOTIF) && defined(HAVE_XM_NOTEBOOK_H)) \ || defined(FEAT_GUI_MAC) \ - || (defined(FEAT_GUI_MSWIN) && !defined(WIN16) \ + || (defined(FEAT_GUI_MSWIN) \ && (!defined(_MSC_VER) || _MSC_VER > 1020))) # define FEAT_GUI_TABLINE #endif @@ -2184,7 +2184,7 @@ gui_outstr_nowrap( guicolor_T fg_color; guicolor_T bg_color; guicolor_T sp_color; -#if !defined(MSWIN16_FASTTEXT) && !defined(FEAT_GUI_GTK) +#if !defined(FEAT_GUI_GTK) GuiFont font = NOFONT; # ifdef FEAT_MBYTE GuiFont wide_font = NOFONT; @@ -2241,7 +2241,7 @@ gui_outstr_nowrap( highlight_mask = gui.highlight_mask; hl_mask_todo = highlight_mask; -#if !defined(MSWIN16_FASTTEXT) && !defined(FEAT_GUI_GTK) +#if !defined(FEAT_GUI_GTK) /* Set the font */ if (aep != NULL && aep->ae_u.gui.font != NOFONT) font = aep->ae_u.gui.font; @@ -2358,11 +2358,9 @@ gui_outstr_nowrap( clip_may_clear_selection(gui.row, gui.row); -#ifndef MSWIN16_FASTTEXT /* If there's no bold font, then fake it */ if (hl_mask_todo & (HL_BOLD | HL_STANDOUT)) draw_flags |= DRAW_BOLD; -#endif /* * When drawing bold or italic characters the spill-over from the left @@ -2383,11 +2381,7 @@ gui_outstr_nowrap( draw_flags |= DRAW_UNDERL; #else /* Do we underline the text? */ - if ((hl_mask_todo & HL_UNDERLINE) -# ifndef MSWIN16_FASTTEXT - || (hl_mask_todo & HL_ITALIC) -# endif - ) + if ((hl_mask_todo & HL_UNDERLINE) || (hl_mask_todo & HL_ITALIC)) draw_flags |= DRAW_UNDERL; #endif /* Do we undercurl the text? */ @@ -3338,7 +3332,7 @@ gui_init_which_components(char_u *oldval UNUSED) static int prev_footer = -1; int using_footer = FALSE; #endif -#if defined(FEAT_MENU) && !defined(WIN16) +#if defined(FEAT_MENU) static int prev_tearoff = -1; int using_tearoff = FALSE; #endif @@ -3415,7 +3409,7 @@ gui_init_which_components(char_u *oldval UNUSED) break; #endif case GO_TEAROFF: -#if defined(FEAT_MENU) && !defined(WIN16) +#if defined(FEAT_MENU) using_tearoff = TRUE; #endif break; @@ -3522,7 +3516,7 @@ gui_init_which_components(char_u *oldval UNUSED) fix_size = TRUE; } #endif -#if defined(FEAT_MENU) && !defined(WIN16) && !(defined(WIN3264) && !defined(FEAT_TEAROFF)) +#if defined(FEAT_MENU) && !(defined(WIN3264) && !defined(FEAT_TEAROFF)) if (using_tearoff != prev_tearoff) { gui_mch_toggle_tearoffs(using_tearoff); diff --git a/src/gui_w16.c b/src/gui_w16.c deleted file mode 100644 index a0a3996786..0000000000 --- a/src/gui_w16.c +++ /dev/null @@ -1,1564 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * GUI support by Robert Webb - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. - */ -/* - * gui_w16.c - * - * GUI support for Microsoft Windows 3.1x - * - * George V. Reilly <george@reilly.org> wrote the original Win32 GUI. - * Robert Webb reworked it to use the existing GUI stuff and added menu, - * scrollbars, etc. - * - * Vince Negri then butchered the code to get it compiling for - * 16-bit windows. - * - */ - -/* Win16 doesn't use the "W" methods. */ -#define pDispatchMessage DispatchMessage -#define pGetMessage GetMessage -#define pIsDialogMessage IsDialogMessage -#define pPeekMessage PeekMessage - -/* - * Include the common stuff for MS-Windows GUI. - */ -#include "gui_w48.c" - -#include "guiw16rc.h" - -/* Undocumented Windows Message - not even defined in some SDK headers */ -#define WM_EXITSIZEMOVE 0x0232 - - -#ifdef FEAT_TOOLBAR -# define CMD_TB_BASE (99) -# include <vimtbar.h> -#endif - -#ifdef PROTO -# define WINAPI -#endif - -#define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \ - ((fn)((hwnd), (HDROP)(wParam)), 0L) - - -/* Local variables: */ - -#ifdef FEAT_MENU -static UINT s_menu_id = 100; -#endif - - -#define VIM_NAME "vim" -#define VIM_CLASS "Vim" - -#define DLG_ALLOC_SIZE 16 * 1024 - -/* - * stuff for dialogs, menus, tearoffs etc. - */ -#if defined(FEAT_GUI_DIALOG) || defined(PROTO) -static BOOL CALLBACK dialog_callback(HWND, UINT, WPARAM, LPARAM); - -static LPWORD -add_dialog_element( - LPWORD p, - DWORD lStyle, - WORD x, - WORD y, - WORD w, - WORD h, - WORD Id, - BYTE clss, - const char *caption); - -static int dialog_default_button = -1; -#endif - -static void get_dialog_font_metrics(void); - -#ifdef FEAT_TOOLBAR -static void initialise_toolbar(void); -#endif - - -#ifdef FEAT_MENU -/* - * Figure out how high the menu bar is at the moment. - */ - static int -gui_mswin_get_menu_height( - int fix_window) /* If TRUE, resize window if menu height changed */ -{ - static int old_menu_height = -1; - - int num; - int menu_height; - - if (gui.menu_is_active) - num = GetMenuItemCount(s_menuBar); - else - num = 0; - - if (num == 0) - menu_height = 0; - else if (gui.starting) - menu_height = GetSystemMetrics(SM_CYMENU); - else - { - RECT r1, r2; - int frameht = GetSystemMetrics(SM_CYFRAME); - int capht = GetSystemMetrics(SM_CYCAPTION); - - /* get window rect of s_hwnd - * get client rect of s_hwnd - * get cap height - * subtract from window rect, the sum of client height, - * (if not maximized)frame thickness, and caption height. - */ - GetWindowRect(s_hwnd, &r1); - GetClientRect(s_hwnd, &r2); - menu_height = r1.bottom - r1.top - (r2.bottom-r2.top + - 2 * frameht * (!IsZoomed(s_hwnd)) + capht); - } - - if (fix_window && menu_height != old_menu_height) - { - old_menu_height = menu_height; - gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); - } - - return menu_height; -} -#endif /*FEAT_MENU*/ - - -/* - * Even though we have _DuringSizing() which makes the rubber band a valid - * size, we need this for when the user maximises the window. - * TODO: Doesn't seem to adjust the width though for some reason. - */ - static BOOL -_OnWindowPosChanging( - HWND hwnd, - LPWINDOWPOS lpwpos) -{ - - if (!IsIconic(hwnd) && !(lpwpos->flags & SWP_NOSIZE)) - { - gui_mswin_get_valid_dimensions(lpwpos->cx, lpwpos->cy, - &lpwpos->cx, &lpwpos->cy); - } - return 0; -} - - - - - - static LRESULT CALLBACK -_WndProc( - HWND hwnd, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) -{ - /* - TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", - hwnd, uMsg, wParam, lParam); - */ - - HandleMouseHide(uMsg, lParam); - - s_uMsg = uMsg; - s_wParam = wParam; - s_lParam = lParam; - - switch (uMsg) - { - HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar); - HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar); - /* HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); */ - HANDLE_MSG(hwnd, WM_CHAR, _OnChar); - HANDLE_MSG(hwnd, WM_CLOSE, _OnClose); - /* HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); */ - HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy); - HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles); - HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll); - HANDLE_MSG(hwnd, WM_KILLFOCUS, _OnKillFocus); -#ifdef FEAT_MENU - HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu); -#endif - /* HANDLE_MSG(hwnd, WM_MOVE, _OnMove); */ - /* HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); */ - HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus); - HANDLE_MSG(hwnd, WM_SIZE, _OnSize); - /* HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); */ - /* HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); */ - HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll); - HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging); - HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp); - - case WM_QUERYENDSESSION: /* System wants to go down. */ - gui_shell_closed(); /* Will exit when no changed buffers. */ - return FALSE; /* Do NOT allow system to go down. */ - - case WM_ENDSESSION: - if (wParam) /* system only really goes down when wParam is TRUE */ - _OnEndSession(); - break; - - case WM_SYSCHAR: - /* - * if 'winaltkeys' is "no", or it's "menu" and it's not a menu - * shortcut key, handle like a typed ALT key, otherwise call Windows - * ALT key handling. - */ -#ifdef FEAT_MENU - if ( !gui.menu_is_active - || p_wak[0] == 'n' - || (p_wak[0] == 'm' && !gui_is_menu_shortcut((int)wParam)) - ) -#endif - return HANDLE_WM_SYSCHAR((hwnd), (wParam), (lParam), (_OnSysChar)); -#ifdef FEAT_MENU - else - return MyWindowProc(hwnd, uMsg, wParam, lParam); -#endif - - case WM_SYSKEYUP: -#ifdef FEAT_MENU - /* Only when menu is active, ALT key is used for that. */ - if (gui.menu_is_active) - { - return MyWindowProc(hwnd, uMsg, wParam, lParam); - } - else -#endif - return 0; - -#if defined(MENUHINTS) && defined(FEAT_MENU) - case WM_MENUSELECT: - if (((UINT) LOWORD(lParam) - & (0xffff ^ (MF_MOUSESELECT + MF_BITMAP + MF_POPUP))) - == MF_HILITE - && (State & CMDLINE) == 0) - { - UINT idButton; - int idx; - vimmenu_T *pMenu; - - idButton = (UINT)LOWORD(wParam); - pMenu = gui_mswin_find_menu(root_menu, idButton); - if (pMenu) - { - idx = MENU_INDEX_TIP; - msg_clr_cmdline(); - if (pMenu->strings[idx]) - msg(pMenu->strings[idx]); - else - msg(""); - setcursor(); - out_flush(); - } - } - break; -#endif - case WM_NCHITTEST: - { - LRESULT result; - int x, y; - int xPos = GET_X_LPARAM(lParam); - - result = MyWindowProc(hwnd, uMsg, wParam, lParam); - if (result == HTCLIENT) - { - (void)gui_mch_get_winpos(&x, &y); - xPos -= x; - - if (xPos < 48) /*<VN> TODO should use system metric?*/ - return HTBOTTOMLEFT; - else - return HTBOTTOMRIGHT; - } - else - return result; - } - /* break; */ - default: -#ifdef MSWIN_FIND_REPLACE - if (uMsg == s_findrep_msg && s_findrep_msg != 0) - { - _OnFindRepl(); - } -#endif - return MyWindowProc(hwnd, uMsg, wParam, lParam); - } - - return 1; -} - - - -/* - * End of call-back routines - */ - - -/* - * Parse the GUI related command-line arguments. Any arguments used are - * deleted from argv, and *argc is decremented accordingly. This is called - * when vim is started, whether or not the GUI has been started. - */ - void -gui_mch_prepare(int *argc, char **argv) -{ - /* No special args for win16 GUI at the moment. */ - -} - -/* - * 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; -} - - -/* - * Set the size of the window to the given width and height in pixels. - */ - void -gui_mch_set_shellsize(int width, int height, - int min_width, int min_height, int base_width, int base_height, - int direction) -{ - RECT workarea_rect; - int win_width, win_height; - int win_xpos, win_ypos; - WINDOWPLACEMENT wndpl; - - /* try to keep window completely on screen */ - /* get size of the screen work area - use SM_CYFULLSCREEN - * instead of SM_CYSCREEN so that we don't overlap the - * taskbar if someone fires us up on Win95/NT */ - workarea_rect.left = 0; - workarea_rect.top = 0; - workarea_rect.right = GetSystemMetrics(SM_CXSCREEN); - workarea_rect.bottom = GetSystemMetrics(SM_CYFULLSCREEN); - - /* get current position of our window */ - wndpl.length = sizeof(WINDOWPLACEMENT); - GetWindowPlacement(s_hwnd, &wndpl); - if (wndpl.showCmd == SW_SHOWNORMAL) - { - win_xpos = wndpl.rcNormalPosition.left; - win_ypos = wndpl.rcNormalPosition.top; - } - else - { - win_xpos = workarea_rect.left; - win_ypos = workarea_rect.top; - } - - /* compute the size of the outside of the window */ - win_width = width + GetSystemMetrics(SM_CXFRAME) * 2; - win_height = height + GetSystemMetrics(SM_CYFRAME) * 2 - + GetSystemMetrics(SM_CYCAPTION) -#ifdef FEAT_MENU - + gui_mswin_get_menu_height(FALSE) -#endif - ; - - /* if the window is going off the screen, move it on to the screen */ - if ((direction & RESIZE_HOR) && win_xpos + win_width > workarea_rect.right) - win_xpos = workarea_rect.right - win_width; - - if ((direction & RESIZE_HOR) && win_xpos < workarea_rect.left) - win_xpos = workarea_rect.left; - - if ((direction & RESIZE_VERT) - && win_ypos + win_height > workarea_rect.bottom) - win_ypos = workarea_rect.bottom - win_height; - - if ((direction & RESIZE_VERT) && win_ypos < workarea_rect.top) - win_ypos = workarea_rect.top; - - /* set window position */ - SetWindowPos(s_hwnd, NULL, win_xpos, win_ypos, win_width, win_height, - SWP_NOZORDER | SWP_NOACTIVATE); - -#ifdef FEAT_MENU - /* Menu may wrap differently now */ - gui_mswin_get_menu_height(!gui.starting); -#endif -} - |