summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-01-02 11:28:13 +0000
committerBram Moolenaar <Bram@vim.org>2005-01-02 11:28:13 +0000
commit3411469dd2a23fddc4fc0be1a79a58a7a05160e4 (patch)
treea335543a185b41f1679df8f4f470b8facbb409e1 /src
parent567e4dec2cb9b5eda4d7575f8f24c1da5bf646ea (diff)
downloadvim-git-3411469dd2a23fddc4fc0be1a79a58a7a05160e4.tar.gz
updated for version 7.0028
Diffstat (limited to 'src')
-rw-r--r--src/Make_mvc.mak17
-rw-r--r--src/gui_athena.c132
-rw-r--r--src/gui_x11_pm.h92
-rw-r--r--src/normal.c1
-rw-r--r--src/window.c41
5 files changed, 275 insertions, 8 deletions
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 90dd888f3..df71a7778 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -53,9 +53,9 @@
# GETTEXT=[yes or no] (default is yes)
# See http://sourceforge.net/projects/gettext/
# PostScript printing: POSTSCRIPT=yes (default is no)
-# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, or HUGE] (default is BIG)
+# Feature Set: FEATURES=[TINY, SMALL, NORMAL, BIG, HUGE] (default is BIG)
# Version Support: WINVER=[0x0400, 0x0500] (default is 0x0400)
-# Processor Version: CPUNR=[i386, i486, i586, i686] (default is i386)
+# Processor Version: CPUNR=[i386, i486, i586, i686, P4] (default is i386)
# Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED)
# Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes)
# Netbeans Debugging Support: NBDEBUG=[yes or no] (default is no)
@@ -276,6 +276,8 @@ CPUARG = /G4
CPUARG = /G5
!elseif "$(CPUNR)" == "i686"
CPUARG = /G6
+!elseif "$(CPUNR)" == "P4"
+CPUARG = /G7 /arch:SSE2
!else
CPUARG =
!endif
@@ -289,10 +291,10 @@ OPTFLAG = /O2
!else # MAXSPEED
OPTFLAG = /Ox
!endif
-CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG /Zi $(CPUARG)
+CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG $(CPUARG)
RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG
-PDB = /Fd$(OUTDIR)/
-LINK_PDB = /PDB:$(OUTDIR)/
+PDB =
+LINK_PDB =
! ifdef USE_MSVCRT
CFLAGS = $(CFLAGS) -MD
LIBC = msvcrt.lib
@@ -699,6 +701,11 @@ test:
$(MAKE) /NOLOGO -f Make_dos.mak win32
cd ..
+testclean:
+ cd testdir
+ $(MAKE) /NOLOGO -f Make_dos.mak clean
+ cd ..
+
###########################################################################
# Create a default rule for transforming .c files to .obj files in $(OUTDIR)
diff --git a/src/gui_athena.c b/src/gui_athena.c
index 51977eddc..7bbb6c20a 100644
--- a/src/gui_athena.c
+++ b/src/gui_athena.c
@@ -454,6 +454,134 @@ gui_x11_destroy_widgets()
}
#if defined(FEAT_TOOLBAR) || defined(PROTO)
+# include "gui_x11_pm.h"
+# ifdef HAVE_X11_XPM_H
+# include <X11/xpm.h>
+# endif
+
+static void createXpmImages __ARGS((char_u *path, char **xpm, Pixmap *sen));
+static void get_toolbar_pixmap __ARGS((vimmenu_T *menu, Pixmap *sen));
+
+/*
+ * Allocated a pixmap for toolbar menu "menu".
+ * Return in "sen".
+ */
+ static void
+get_toolbar_pixmap(menu, sen)
+ vimmenu_T *menu;
+ Pixmap *sen;
+{
+ char_u buf[MAXPATHL]; /* buffer storing expanded pathname */
+ char **xpm = NULL; /* xpm array */
+
+ buf[0] = NUL; /* start with NULL path */
+
+ if (menu->iconfile != NULL)
+ {
+ /* Use the "icon=" argument. */
+ gui_find_iconfile(menu->iconfile, buf, "xpm");
+ createXpmImages(buf, NULL, sen);
+
+ /* If it failed, try using the menu name. */
+ if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK)
+ createXpmImages(buf, NULL, sen);
+ if (*sen != (Pixmap)0)
+ return;
+ }
+
+ if (menu->icon_builtin || gui_find_bitmap(menu->name, buf, "xpm") == FAIL)
+ {
+ if (menu->iconidx >= 0 && menu->iconidx
+ < (sizeof(built_in_pixmaps) / sizeof(built_in_pixmaps[0])))
+ xpm = built_in_pixmaps[menu->iconidx];
+ else
+ xpm = tb_blank_xpm;
+ }
+
+ if (xpm != NULL || buf[0] != NUL)
+ createXpmImages(buf, xpm, sen);
+}
+
+/*
+ * Read an Xpm file, doing color substitutions for the foreground and
+ * background colors. If there is an error reading a color xpm file,
+ * drop back and read the monochrome file. If successful, create the
+ * insensitive Pixmap too.
+ */
+ static void
+createXpmImages(path, xpm, sen)
+ char_u *path;
+ char **xpm;
+ Pixmap *sen;
+{
+ Window rootWindow;
+ XpmAttributes attrs;
+ XpmColorSymbol color[5] =
+ {
+ {"none", "none", 0},
+ {"iconColor1", NULL, 0},
+ {"bottomShadowColor", NULL, 0},
+ {"topShadowColor", NULL, 0},
+ {"selectColor", NULL, 0}
+ };
+ int screenNum;
+ int status;
+ Pixmap mask;
+ Pixmap map;
+
+ gui_mch_get_toolbar_colors(
+ &color[BACKGROUND].pixel,
+ &color[FOREGROUND].pixel,
+ &color[BOTTOM_SHADOW].pixel,
+ &color[TOP_SHADOW].pixel,
+ &color[HIGHLIGHT].pixel);
+
+ /* Setup the color subsititution table */
+ attrs.valuemask = XpmColorSymbols;
+ attrs.colorsymbols = color;
+ attrs.numsymbols = 5;
+
+ screenNum = DefaultScreen(gui.dpy);
+ rootWindow = RootWindow(gui.dpy, screenNum);
+
+ /* Create the "sensitive" pixmap */
+ if (xpm != NULL)
+ status = XpmCreatePixmapFromData(gui.dpy, rootWindow, xpm,
+ &map, &mask, &attrs);
+ else
+ status = XpmReadFileToPixmap(gui.dpy, rootWindow, (char *)path,
+ &map, &mask, &attrs);
+ if (status == XpmSuccess && map != 0)
+ {
+ XGCValues gcvalues;
+ GC back_gc;
+ GC mask_gc;
+
+ /* Need to create new Pixmaps with the mask applied. */
+ gcvalues.foreground = color[BACKGROUND].pixel;
+ back_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues);
+ mask_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues);
+ XSetClipMask(gui.dpy, mask_gc, mask);
+
+ /* Create the "sensitive" pixmap. */
+ *sen = XCreatePixmap(gui.dpy, rootWindow,
+ attrs.width, attrs.height,
+ DefaultDepth(gui.dpy, screenNum));
+ XFillRectangle(gui.dpy, *sen, back_gc, 0, 0,
+ attrs.width, attrs.height);
+ XCopyArea(gui.dpy, map, *sen, mask_gc, 0, 0,
+ attrs.width, attrs.height, 0, 0);
+
+ XFreeGC(gui.dpy, back_gc);
+ XFreeGC(gui.dpy, mask_gc);
+ XFreePixmap(gui.dpy, map);
+ }
+ else
+ *sen = 0;
+
+ XpmFreeAttributes(&attrs);
+}
+
void
gui_mch_set_toolbar_pos(x, y, w, h)
int x;
@@ -971,7 +1099,7 @@ gui_mch_submenu_change(menu, colors)
if (mp->image != (Pixmap)0)
{
XFreePixmap(gui.dpy, mp->image);
- get_toolbar_pixmap(mp, &mp->image, NULL);
+ get_toolbar_pixmap(mp, &mp->image);
if (mp->image != (Pixmap)0)
XtVaSetValues(mp->id, XtNbitmap, mp->image, NULL);
}
@@ -1071,7 +1199,7 @@ gui_mch_add_menu_item(menu, idx)
}
else
{
- get_toolbar_pixmap(menu, &menu->image, NULL);
+ get_toolbar_pixmap(menu, &menu->image);
XtSetArg(args[n], XtNlabel, menu->dname); n++;
XtSetArg(args[n], XtNinternalHeight, 1); n++;
XtSetArg(args[n], XtNinternalWidth, 1); n++;
diff --git a/src/gui_x11_pm.h b/src/gui_x11_pm.h
new file mode 100644
index 000000000..315cfe9c0
--- /dev/null
+++ b/src/gui_x11_pm.h
@@ -0,0 +1,92 @@
+/* vi:set ts=8 sts=4 sw=4:
+ *
+ * VIM - Vi IMproved by Bram Moolenaar
+ * GUI/Motif 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.
+ */
+
+/*
+ * Icons used by the toolbar code.
+ */
+#include "../pixmaps/tb_new.xpm"
+#include "../pixmaps/tb_open.xpm"
+#include "../pixmaps/tb_close.xpm"
+#include "../pixmaps/tb_save.xpm"
+#include "../pixmaps/tb_print.xpm"
+#include "../pixmaps/tb_cut.xpm"
+#include "../pixmaps/tb_copy.xpm"
+#include "../pixmaps/tb_paste.xpm"
+#include "../pixmaps/tb_find.xpm"
+#include "../pixmaps/tb_find_next.xpm"
+#include "../pixmaps/tb_find_prev.xpm"
+#include "../pixmaps/tb_find_help.xpm"
+#include "../pixmaps/tb_exit.xpm"
+#include "../pixmaps/tb_undo.xpm"
+#include "../pixmaps/tb_redo.xpm"
+#include "../pixmaps/tb_help.xpm"
+#include "../pixmaps/tb_macro.xpm"
+#include "../pixmaps/tb_make.xpm"
+#include "../pixmaps/tb_save_all.xpm"
+#include "../pixmaps/tb_jump.xpm"
+#include "../pixmaps/tb_ctags.xpm"
+#include "../pixmaps/tb_load_session.xpm"
+#include "../pixmaps/tb_save_session.xpm"
+#include "../pixmaps/tb_new_session.xpm"
+#include "../pixmaps/tb_blank.xpm"
+#include "../pixmaps/tb_maximize.xpm"
+#include "../pixmaps/tb_split.xpm"
+#include "../pixmaps/tb_minimize.xpm"
+#include "../pixmaps/tb_shell.xpm"
+#include "../pixmaps/tb_replace.xpm"
+#include "../pixmaps/tb_vsplit.xpm"
+#include "../pixmaps/tb_maxwidth.xpm"
+#include "../pixmaps/tb_minwidth.xpm"
+
+/*
+ * Those are the pixmaps used for the default buttons.
+ */
+static char **(built_in_pixmaps[]) =
+{
+ tb_new_xpm,
+ tb_open_xpm,
+ tb_save_xpm,
+ tb_undo_xpm,
+ tb_redo_xpm,
+ tb_cut_xpm,
+ tb_copy_xpm,
+ tb_paste_xpm,
+ tb_print_xpm,
+ tb_help_xpm,
+ tb_find_xpm,
+ tb_save_all_xpm,
+ tb_save_session_xpm,
+ tb_new_session_xpm,
+ tb_load_session_xpm,
+ tb_macro_xpm,
+ tb_replace_xpm,
+ tb_close_xpm,
+ tb_maximize_xpm,
+ tb_minimize_xpm,
+ tb_split_xpm,
+ tb_shell_xpm,
+ tb_find_prev_xpm,
+ tb_find_next_xpm,
+ tb_find_help_xpm,
+ tb_make_xpm,
+ tb_jump_xpm,
+ tb_ctags_xpm,
+ tb_vsplit_xpm,
+ tb_maxwidth_xpm,
+ tb_minwidth_xpm,
+ tb_exit_xpm
+};
+
+/* Indices for named colors */
+#define BACKGROUND 0
+#define FOREGROUND 1
+#define BOTTOM_SHADOW 2
+#define TOP_SHADOW 3
+#define HIGHLIGHT 4
diff --git a/src/normal.c b/src/normal.c
index 9d0d8a9ca..e62648f8a 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1768,6 +1768,7 @@ do_pending_operator(cap, old_col, gui_yank)
&& oap->end.col == 0
#ifdef FEAT_VISUAL
&& (!oap->is_VIsual || *p_sel == 'o')
+ && !oap->block_mode
#endif
&& oap->line_count > 1)
{
diff --git a/src/window.c b/src/window.c
index ad3222a33..b03e5ebae 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4134,7 +4134,10 @@ win_new_height(wp, height)
int height;
{
linenr_T lnum;
+ linenr_T bot;
int sline, line_size;
+ int space;
+ int did_below = FALSE;
#define FRACTION_MULT 16384L
/* Don't want a negative height. Happens when splitting a tiny window.
@@ -4157,6 +4160,10 @@ win_new_height(wp, height)
#endif
)
{
+ /*
+ * Find a value for w_topline that shows the cursor at the same
+ * relative position in the window as before (more or less).
+ */
lnum = wp->w_cursor.lnum;
if (lnum < 1) /* can happen when starting up */
lnum = 1;
@@ -4172,8 +4179,39 @@ win_new_height(wp, height)
}
else
{
- while (sline > 0 && lnum > 1)
+ space = height;
+ while (lnum > 1)
{
+ space -= line_size;
+ if (space > 0 && sline <= 0 && !did_below)
+ {
+ /* Try to use "~" lines below the text to avoid that text
+ * is above the window while there are empty lines.
+ * Subtract the rows below the cursor from "space" and
+ * give the rest to "sline". */
+ did_below = TRUE;
+ bot = wp->w_cursor.lnum;
+ while (space > 0)
+ {
+ if (wp->w_buffer->b_ml.ml_line_count - bot >= space)
+ space = 0;
+ else
+ {
+#ifdef FEAT_FOLDING
+ hasFoldingWin(wp, bot, NULL, &bot, TRUE, NULL);
+#endif
+ if (bot >= wp->w_buffer->b_ml.ml_line_count)
+ break;
+ ++bot;
+ space -= plines_win(wp, bot, TRUE);
+ }
+ }
+ if (bot == wp->w_buffer->b_ml.ml_line_count && space > 0)
+ sline += space;
+ }
+ if (sline <= 0)
+ break;
+
#ifdef FEAT_FOLDING
hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
if (lnum == 1)
@@ -4194,6 +4232,7 @@ win_new_height(wp, height)
line_size = plines_win(wp, lnum, TRUE);
sline -= line_size;
}
+
if (sline < 0)
{
/*