Compare commits

...

207 Commits

Author SHA1 Message Date
Bjorn Winckler 3b966f9e01 Snapshot 31 2008-06-13 16:35:31 +02:00
Bjorn Winckler 8009a9912d Update DejaVu font to version 2.25 2008-06-13 14:27:02 +02:00
Bjorn Winckler cdf043f0f9 Draw modeless selection 2008-06-12 22:22:16 +02:00
Bjorn Winckler 757e8b4359 Toolbar buttons respond to mouse clicks again
Toolbar items send vimToolbarItemAction: instead of vimMenuItemAction:.
This enables us to separate toolbar items from menu items and can build
proper descriptors (starting with "ToolBar").
2008-06-12 13:23:26 +02:00
Bjorn Winckler 7b68b0b56d Disable default main menu key equivalent hack
In performKeyEquivalent: do not pass the key equivalent to
defaultMainMenu since this breaks the menus on OS X 10.4.  Also, this
hack is not strictly needed now that window cycling is hardcoded (and a
"New Window" menu is always available on the dock menu) so it is just as
well that it is removed.
2008-06-12 12:58:52 +02:00
Bjorn Winckler 21b029712f Set mouse cursor on mouseMoved:
This seems to be the only way to get the mouse cursor not to be changed
to an I-beam cursor all the time.
2008-06-09 22:18:36 +02:00
Bjorn Winckler 80b4c97a2c Add Dock menu 2008-06-09 21:52:32 +02:00
Bjorn Winckler 404077032e Dialog box handling updated
Keep waiting for dialog reply until it is received.  Any input received
during this wait is discarded unless it is a 'set text dimensions'
message (or keyboard/mouse input).  Also, make setDialogReturn: a
synchronous call so that it is less likely to get dropped.
2008-06-09 21:34:54 +02:00
Bjorn Winckler 04cd1420c1 Force flush output queue before presenting any dialog
The previous commit did not ensure the output queue was flushed before
"browse" dialogs were shown.
2008-06-09 19:13:43 +02:00
Bjorn Winckler 46ae2ec9cb Force flush output queue before showing dialog
This ensures that the swap file information is displayed when the 'swap
file exists' dialog is shown.
2008-06-09 18:48:10 +02:00
Bjorn Winckler 85cc2265e8 Merge upstream 2008-06-09 17:08:00 +02:00
vimboss 4c3907a8ff updated for version 7.1-314 2008-06-09 15:07:54 +00:00
vimboss f4fef46de2 updated for version 7.1-313 2008-06-09 13:10:45 +00:00
vimboss 28c76af675 updated for version 7.1-312 2008-06-09 12:46:00 +00:00
Bjorn Winckler 9716d0b66f Snapshot 30 2008-06-08 16:54:26 +02:00
Bjorn Winckler 428d1b4412 Window cycling hardcoded to keycode 50
Window cycling is hardcoded to happen when the Cmd key is pressed with
the key whose keycode = 50.  Having window cycling in the "Window" menu
means that window cycling stops working when the keyboard layout is
changed.  Thus revert back to the old way of dealing with this since it
seems to work better.
2008-06-08 16:35:43 +02:00
Bjorn Winckler bf70f82498 Snapshot 29 2008-06-08 14:21:16 +02:00
Bjorn Winckler 89d9e60b8a Add 'rightleft' support to ATSUI renderer 2008-06-07 15:36:07 +02:00
Bjorn Winckler 0ea7546c7c Add 'mousehide' option support 2008-06-07 15:35:25 +02:00
Bjorn Winckler 321fdf61aa Ensure processCommandQueueDidFinish: gets called if exception is raised 2008-06-07 14:33:05 +02:00
Bjorn Winckler 2fa74c01aa Use -[NSScreen visibleFrame] to get full-screen max dimensions
This fixes a bug where the window dimensions were not restored after
leaving full-screen (with 'maxvert' fu-option set).
2008-06-07 14:30:52 +02:00
Bjorn Winckler c4222c6ebb Don't delay loading "Buffers" menu
This avoids a flickering menu each time a new editor window is opened.
2008-06-07 12:42:47 +02:00
Bjorn Winckler 1f538dc364 Set title for separator items to ensure valid descriptors 2008-06-06 23:32:26 +02:00
Bjorn Winckler 9471224d0b Give Vim processes some time to terminate before MacVim does
This should stop MacVim from beeping when Cmd-q is pressed.
2008-06-06 22:46:13 +02:00
Bjorn Winckler 1d83527039 Pass 'rl' option in "DrawCursor" message 2008-06-06 22:31:21 +02:00
Bjorn Winckler 7752431b82 Ensure "Services" menu is empty when creating new main menu
MMVimController uses a copy of the "MacVim" menu that is defined inside
MainMenu.nib instead of getting it from the default main menu.  This
ensures that the "Services" menu is initially empty for each new
MMVimController.  Without this the setKeyEquivalent: call would fail if
the key equivalent already was in a "Services" menu item (e.g. <D-F> and
<D-L> would fail).
2008-06-06 21:20:55 +02:00
Bjorn Winckler 2ac28f887e Edit->Font->Bigger/Smaller validates properly
Fixes bug where the above items were enabled even when all windows were
minimized.
2008-06-06 17:47:54 +02:00
Bjorn Winckler 9c517cb4e9 Don't draw control chars in MMTextStorage
It can happen that MMTextStorage is asked to draw characters from the
"Control Characters" set (e.g. when :shell is invoked).  This would
cause internal errors in MMTextStorage so when control chars are
detected, simply draw blanks instead.
2008-06-06 14:24:49 +02:00
Bjorn Winckler 3915c6afc6 Catch exceptions in processCommandQueue: 2008-06-06 14:22:49 +02:00
Bjorn Winckler a4569d06ac Do not set key equivalent when 'mac_key == 0' 2008-06-06 14:16:10 +02:00
Bjorn Winckler cb120a21cf Validate performClose: in MMWindow and MMFullscreenWindow
Failing to validate would cause the "Close" menu item to be disabled in
full-screen.
2008-06-05 23:13:40 +02:00
Bjorn Winckler 7070fd3f76 Update help on menus 2008-06-05 21:27:02 +02:00
Bjorn Winckler 9f1b770ee6 Add "Cycle Through Windows" to default "Windows" menu
This ensures that Cmd-` works for all windows.  Also changed its
alternate to read "Cycle Backwards Through Windows".  Note that the
default "Windows" menu does not contain the alternate since Interface
Builder turned Cmd-Shift-` into Cmd-~ which is no longer a valid
alternate.
2008-06-05 20:52:30 +02:00
Bjorn Winckler ebf10927c7 Ignore "Recent Files" when no "File" menu is found 2008-06-05 20:24:36 +02:00
Bjorn Winckler e18186c461 Pass key equivalents to default main menu after main menu
This is so that the key equivalents set up in the default main menu will
work even when the system gvimrc files hasn't been sourced.  This is
useful e.g. when "-u NONE -U NONE" is passed as arguments resulting in
the default Vim menus being used.
2008-06-05 20:19:32 +02:00
Bjorn Winckler af279d2477 Update MMAppController top level information 2008-06-04 21:53:05 +02:00
Bjorn Winckler 8c442b7b28 Merge upstream 2008-06-04 21:36:00 +02:00
vimboss 4c6ed9759c updated for version 7.1-311 2008-06-04 19:35:35 +00:00
Bjorn Winckler d98e291038 Set windows menu even if it is nil 2008-06-04 21:21:28 +02:00
Bjorn Winckler 092e0cc894 Add support for popup menus 2008-06-04 21:17:05 +02:00
vimboss b904b019b8 updated for version 7.1-310 2008-06-04 17:37:34 +00:00
Bjorn Winckler c0159b8fdf Default menu "MacVim Help" item opens help window maximized 2008-06-04 19:08:52 +02:00
Bjorn Winckler 11ec93a03a Add "Minimize All" and "Zoom All" items to "Windows" menu 2008-06-04 19:03:33 +02:00
Bjorn Winckler c2f8b396de Add "Cycle Through Windows" to Windows menu (remove <D-`> hack) 2008-06-04 18:45:45 +02:00
Bjorn Winckler fa15736b2b Hook up "MacVim Help" on default main menu 2008-06-04 18:25:08 +02:00
Bjorn Winckler d1a9e08f94 Add standard menus to default main menu 2008-06-04 18:17:23 +02:00
vimboss 9d2727c56f updated for version 7.1-309 2008-06-04 13:28:18 +00:00
vimboss ce9c112020 updated for version 7.1-308 2008-06-04 12:29:14 +00:00
vimboss 0e2ddfca38 updated for version 7.1-307 2008-06-04 11:35:26 +00:00
vimboss 1f7de911ba updated for version 7.1-306 2008-06-04 09:00:32 +00:00
Bjorn Winckler f6ab5cbc03 Use default menu when no window open, fix 'Recent Files' menu 2008-06-03 23:15:18 +02:00
Bjorn Winckler 44d7e60b06 Change heuristic for finding "Services" menu 2008-06-02 18:44:59 +02:00
Bjorn Winckler 0e37f590ab Use -[NSApp setMainMenu:] to update main menu 2008-06-01 21:28:18 +02:00
Bjorn Winckler a0f684e003 Add autoenabling for menus 2008-06-01 15:57:21 +02:00
Bjorn Winckler f54c3100e9 Menu removal functionality added 2008-06-01 14:30:00 +02:00
Bjorn Winckler a588fc3e33 Use menu descriptors instead of tags to locate menu items 2008-05-31 21:47:30 +02:00
vimboss 039f611554 updated for version 7.1-305 2008-05-29 20:41:57 +00:00
vimboss 3a4682c9dd updated for version 7.1-304 2008-05-29 19:47:13 +00:00
Nico Weber fdc64858c5 Wrap user-visible strings in NSLocalizedString() 2008-05-29 17:01:44 +02:00
vimboss 45a9151fc6 updated for version 7.1-303 2008-05-29 13:36:10 +00:00
vimboss b9241163d8 updated for version 7.1-302 2008-05-28 20:02:48 +00:00
Bjorn Winckler defa7bd098 Insert mode cursor respects 'rightleft' option
When 'rl' is enabled the insert mode cursor is drawn on the right-hand
side of a cell.
2008-05-28 21:16:27 +02:00
vimboss 6bfab82aca updated for version 7.1-301 2008-05-28 17:02:46 +00:00
vimboss 64959e3177 updated for version 7.1-300 2008-05-28 15:32:20 +00:00
vimboss 2eee45eb39 updated for version 7.1-299 2008-05-28 14:49:58 +00:00
Nico Weber 8d051eef4e Make QuickLook work with .vim files 2008-05-27 17:40:55 +02:00
Bjorn Winckler 7f449520a5 Patch a memory leak
The 'vimState' instance variable in MMVimController is now released on
dealloc.
2008-05-25 21:59:39 +02:00
Bjorn Winckler 07831f45b2 Snapshot 28 2008-05-25 20:22:58 +02:00
Bjorn Winckler 9a69ad0d62 Open and save dialogs track the Vim pwd
Open and save dialogs will open up at the present working directory of
the key Vim process.  This can be disabled by setting the user default
"MMDialogsTrackPwd" to 0.  If disabled, these dialogs always open up at
the last location browsed to (which is the default OS X behaviour).
2008-05-25 19:22:12 +02:00
Bjorn Winckler be6ecb5d92 Set 'backspace' in the system vimrc
Add "indent,eol,start" to the 'backspace' option in $VIM/vimrc to make
the delete key behave in a more familiar way to new users.  The help
file has been update to point out this non-standard behaviour.
2008-05-25 13:35:08 +02:00
Bjorn Winckler 138be9d567 Improve "Edit" menu support in dialogs
The Edit menu items cut/copy/paste/select all/undo/redo are wired to
send the appropriate action messages (now possible with :macmenu
command) so that they may work with dialogs.  However, to make this work
100%, menus must first autoenable (which they currently do not).  This
will be addressed in a future patch.
2008-05-20 16:12:52 +02:00
Bjorn Winckler 0430474168 Coerce MacVim to work with LCC
The LCC (Logitech Control Center) comes with an input manager which
registers its own root object with the default NSConnection.  MacVim
uses the root object of the default connection to vend the frontend
object, so LCC would cause MacVim to never open any new windows.

To work around this problem the default connection is no longer used in
MacVim, instead a new connection is created and this connection is used
to vend the frontend object instead.
2008-05-20 14:40:57 +02:00
Bjorn Winckler 0f1ee64746 Fix bug in :macmenu
Menu item not found lead to bad memory access.
2008-05-19 21:34:55 +02:00
Bjorn Winckler d08cc220fd Add "File.Save All" menu item
This patch serves the secondary purpose of showing off the new feature
of being able to specify alternate menu items using the new :macmenu
command.  When the "File" menu is revealed either the "Save All" or the
"Save" item is displayed, depending on whether Alt is held or not.
2008-05-19 20:08:52 +02:00
Bjorn Winckler 04d9ab21b0 Bind "File.Close" to ":conf q"
With the introduction of ":macmenu" it is possible to bind "File.Close"
to ":conf q" and at the same time have it send the "performClose:"
action.

This patch reverts back to using ":conf q" since there were problems
with "File.Close" in conjunction with bindings to <C-\>.
2008-05-19 19:28:20 +02:00
Bjorn Winckler 9c7523e944 Change ":macmenukey" to ":macmenu"
The new command allows better control over menus with ability to specify
key equivalent, action, and wheter menu item is an alternate.  These are
specified as "key=value" pairs to allow future expansion.  The help
files have also been rewritten to reflect this change.
2008-05-19 19:09:05 +02:00
Bjorn Winckler 030d0d07ec Update help which referred to Carbon version
In particular, state that MacVim does not source $VIMRUNTIME/macmap.vim.
2008-05-19 17:40:02 +02:00
Bjorn Winckler 0578f14843 Appcast points to fixed snapshot 27 2008-05-13 19:38:58 +02:00
Bjorn Winckler 11274e43c4 Merge upstream 2008-05-12 18:00:00 +02:00
Bjorn Winckler ebfad47ec6 Snapshot 27
The 'make-snapshot.sh' script has been updated to run on Leopard with
Perl support (TCL support is disabled for now).
2008-05-11 17:54:22 +02:00
Bjorn Winckler 48e6f325d6 Update credits 2008-05-11 16:22:01 +02:00
vimboss e899e2dfc7 updated for version 7.1-298 2008-05-10 19:39:08 +00:00
Bjorn Winckler 1bc466c774 Move "Recent Files" menu 2008-05-10 16:11:43 +02:00
Bjorn Winckler f08c899208 Add files opened/saved from :browse to "Recent Files" menu 2008-05-10 16:07:58 +02:00
Bjorn Winckler 31bd050607 Avoid "dropping DO message ..." warning when quitting
The warning was a result of sending a DO message from Vim and then
immediately exiting the process.  It is avoided by not sending any DO
messages while Vim is exiting.
2008-05-10 15:25:44 +02:00
Bjorn Winckler 2e6fb2ea53 Enable macvim color scheme to work with other Vim ports 2008-05-09 21:58:19 +02:00
Nico Weber 862da53932 Add "Recent Files" menu
The recent files menu will only remember files opened from Finder and
not files opened from within Vim (via :e etc.).  Recent files will also
be added to the "Recent Items" menu under the Apple menu.

(Patch by Nico Weber with some modifications by Bjorn Winckler.)
2008-05-09 21:41:39 +02:00
Bjorn Winckler 15763286bd Window no longer moves down on zoom 2008-05-09 15:05:31 +02:00
Bjorn Winckler fed823a238 Modifying 'antialias' in .[g]vimrc now works 2008-05-09 13:36:15 +02:00
Bjorn Winckler 5d5176aabf Cmd-w shows confirmation dialog when buffer modified 2008-05-09 13:27:03 +02:00
Enno Lübbers 19468d3117 Add background color option to 'fuopt' 2008-05-08 12:31:28 +02:00
Bjorn Winckler 0402b6b5c4 Merge upstream 2008-05-07 21:47:00 +02:00
vimboss b6932fb3ae updated for version 7.1-297 2008-05-07 19:46:51 +00:00
vimboss 22695b7f3b updated for version 7.1-296 2008-05-07 17:09:24 +00:00
vimboss bc8b62f3d9 updated for version 7.1-295 2008-05-07 15:40:33 +00:00
vimboss bd542602dd updated for version 7.1-294 2008-05-07 11:10:28 +00:00
Bjorn Winckler e5159c3b6a Snapshot 26 2008-04-11 22:54:48 +02:00
Bjorn Winckler b36829bcaa Add 'antialias' to list of non-standard options in help 2008-04-10 21:07:52 +02:00
Bjorn Winckler 07c344444b New MacVim icon 2008-04-10 20:57:46 +02:00
Bjorn Winckler bafcc3365d Merge upstream 2008-04-09 15:50:00 +02:00
vimboss 41ca0e5508 updated for version 7.1-293 2008-04-09 13:49:57 +00:00
vimboss 246dfc17f4 updated for version 7.1-292 2008-04-09 10:16:02 +00:00
Bjorn Winckler 9aae3ba3cc Fix initial window placement bug
The algorithm which determines the topmost window only searches through
visible windows.  The initial window placement bug was a result of this
algorithm returning the (invisible) window whose position was to be
determined.
2008-04-08 13:37:21 +02:00
Bjorn Winckler 0a54dd7370 Snapshot 25 2008-04-06 19:38:05 +02:00
Bjorn Winckler 6e8e20588d Only cascade from windows belonging to Vim process
This ensures that a newly opened window isn't cascaded from e.g. the
preferences panel.
2008-04-06 14:36:12 +02:00
Bjorn Winckler 296634f40e Make copy/paste respect block-wise selections
When text is copied inside Vim we put both the text and the motion type
on the pasteboard.  Text copied from outside Vim never contains the
motion type so we have to guess between line and character-wise motion
types in that case.
2008-04-05 15:24:25 +02:00
Bjorn Winckler 13d45e4ff9 Merge upstream
Conflicts:
	src/vim.h
2008-04-01 20:00:00 +01:00
vimboss 3e314dee6e updated for version 7.1-291 2008-04-01 18:59:07 +00:00
vimboss 779811f241 updated for version 7.1-290 2008-04-01 15:14:36 +00:00
vimboss 22017e1410 updated for version 7.1-289 2008-04-01 12:53:43 +00:00
vimboss af8ea2cc11 updated for version 7.1-288 2008-04-01 12:31:14 +00:00
vimboss ac3b778ddb updated for version 7.1-287 2008-04-01 11:12:09 +00:00
vimboss 1de2bc973a updated for version 7.1-286 2008-04-01 10:06:39 +00:00
Bjorn Winckler cdb8dc17ca Update :maca help, release actionDict 2008-03-26 20:41:00 +01:00
Bjorn Winckler b11e6ca3c9 Fix typo in help on :maca 2008-03-23 19:05:37 +01:00
Nico Weber 69c366f7ed Add command line completion to :macaction command
This enables the user to cycle through all actions by typing
":maca <Tab>" and then repeatedly hitting <Tab>.  The help on :maca was
also updated.

(Initial patch by Nico Weber with some changes by Bjorn Winckler.)
2008-03-23 18:48:24 +01:00
Nico Weber 7792c4e8ab Transparency setting not lost after leaving full-screen
Fixes bug where setting 'transp' while in full-screen and switching back
to windowed mode would result in the window being opaque.
2008-03-22 17:15:46 +01:00
Bjorn Winckler 3910f20697 Disable <D-?> key equivalent
The key equivalent is disabled for now since it only works on Tiger and
not on Leopard.
2008-03-22 14:19:23 +01:00
Bjorn Winckler 472eda54f6 Update Help menu
Add "MacVim Help" item with <D-?> key equivalent, as well as a
"MacVim Website" item which opens up the MacVim website in the user's
default browser.
2008-03-21 20:30:41 +01:00
vimboss c09ef35588 updated for version 7.1-285 2008-03-20 13:39:37 +00:00
vimboss bf90097520 updated for version 7.1-284 2008-03-20 12:23:49 +00:00
Bjorn Winckler 3292e01a82 Improve <D-w> behaviour
With this patch <D-w> works as follows:
- if in Ex-mode, exit by sending "^U:vi<CR>"
- if the command-line window is open, close it using CTRL-\_CTRL-N
- otherwise go to normal mode and add ":q<CR>" to the input buffer
2008-03-19 19:56:19 +01:00
Nico Weber ba210fdada Add full-screen options
When entering full-screen the 'fuoptions' option is used to determine
whether the vim view should maximize in the vertical and/or horizontal
directions.  The previous rows/columns are restored upon returning to
windowed mode.

The help docs for 'fullscreen' have been updated and docs for
'fuoptions' have been added.
2008-03-18 19:52:59 +01:00
Jjgod Jiang 2d57fac276 Support 'antialias' with default renderer
This provides some support for the 'antialias' option with the
NSTextView renderer.  However, some fonts seem to be unaffected by this
option.  In particular, Monaco of point sizes up to 10 always render
without antialiasing.
2008-03-16 21:53:35 +01:00
Jjgod Jiang 4868c3cb85 Support 'antialias' with ATSUI renderer
This commit adds support for the 'antialias' option with the ATSUI
renderer (the NSTextView renderer still uses System Preferences).  The
docs on 'antialias' have been updated.

Some changes to the code used by Carbon Vim is affected by this commit.
A feature flag FEAT_ANTIALIAS was added to support easy disabling of
'antialias' support.

(Patch by Jjgod Jiang with some modifications by Bjorn Winckler.)
2008-03-16 18:40:48 +01:00
vimboss d38abe1843 updated for version 7.1-283 2008-03-16 15:04:34 +00:00
vimboss 045cef0a51 updated for version 7.1-282 2008-03-16 13:54:13 +00:00
vimboss 560504f7ba updated for version 7.1-281 2008-03-16 12:09:58 +00:00
vimboss 4ba3129468 updated for version 7.1-280 2008-03-15 12:12:59 +00:00
vimboss 98cc0fee24 updated for version 7.1-279 2008-03-15 11:41:07 +00:00
Bjorn Winckler 26349fc938 Update credits 2008-03-15 12:03:32 +01:00
Bjorn Winckler fb5cf175af Snapshot 24 2008-03-14 21:38:36 +01:00
Bjorn Winckler 0243a624be All prefs panes have same width 2008-03-14 20:12:45 +01:00
Bjorn Winckler 96433d48a1 Update credits 2008-03-14 20:11:37 +01:00
Nico Weber e5ecb34260 Update layout of the Integration prefs pane 2008-03-14 19:44:34 +01:00
Bjorn Winckler 60fd59ea55 Remove build phase from "Edit in ODBEditor" project
The removed build phase was a "Run Script" which called a shell script
that effectively did nothing.
2008-03-14 19:25:24 +01:00
Nico Weber 8afb077865 Ensure mouse cursor is set (again)
The former patch did not work 100% and it also hogged CPU.  This patch
seems to work better and requires no extra CPU.
2008-03-14 19:12:52 +01:00
Bjorn Winckler eef4ba19a6 Take care of compiler warning in MMTextView 2008-03-13 21:45:12 +01:00
Scott 8574b2152c Fix ODB Input Manager memory issue
The Input Manager failed to retain two string objects which were
accessed after having been autoreleased.  This patch fixes the bug where
the "Edit in ..." menu entry was corrupted and related issues.

The version number of the Input Manager has been bumped to 1.2.
2008-03-13 21:41:38 +01:00
vimboss 52b5ee23fc updated for version 7.1-278 2008-03-12 20:48:13 +00:00
vimboss d97c301011 updated for version 7.1-277 2008-03-12 16:38:55 +00:00
vimboss 343bd24d2e updated for version 7.1-276 2008-03-12 16:27:00 +00:00
vimboss a58654a6b0 updated for version 7.1-275 2008-03-12 13:40:54 +00:00
vimboss af62299744 updated for version 7.1-274 2008-03-12 12:46:13 +00:00
vimboss 60cd2a75c1 updated for version 7.1-273 2008-03-12 12:17:28 +00:00
vimboss 2ef7f8c8a0 updated for version 7.1-272 2008-03-12 11:23:53 +00:00
vimboss f2282b0096 updated for version 7.1-271 2008-03-11 21:02:00 +00:00
Nico Weber 90c663f76b Ensure mouse cursor is set
There is a bug in NSTextView where it keeps resetting the mouse cursor
back to the I-beam cursor.  We "fix" this by setting the custom cursor
each time the mouse moves.
2008-03-11 21:46:53 +01:00
vimboss 5d748c8f27 updated for version 7.1-270 2008-03-10 20:34:59 +00:00
Bjorn Winckler b8ac483bf8 Snapshot 23 2008-03-09 21:14:50 +01:00
vimboss b884eef376 updated for version 7.1-269 2008-03-09 15:45:53 +00:00
vimboss 49cb3f99b8 updated for version 7.1-268 2008-03-09 13:30:56 +00:00
Bjorn Winckler 9f83b2360b Line numbers are brighter when bg=dark
This applies to ":set number" under the macvim color scheme.
2008-03-08 20:56:52 +01:00
Bjorn Winckler 88b58bbd9f Get rid of compilation warning messages 2008-03-08 15:43:16 +01:00
Bjorn Winckler dee796111a Add Universal build target to 'Edit in ODBEditor' project 2008-03-08 15:42:50 +01:00
Bjorn Winckler 8ab6c75d08 Higher constrast mouse cursor in insert mode
An Ibeam cursor with a white outline was added to make it easier to spot
when 'bg=dark'.
2008-03-08 15:41:03 +01:00
Ben Schmidt 3d8abd2669 Improved method to start Vim processes in a login shell
A login shell is started by exec'ing a shell process whose argv[0] is
prepended with a dash.  Which shell to use can be controlled with user
default MMLoginShellCommand (or by setting $SHELL).  If the shell needs
a parameter to make it a login shell then this can be set with the user
default MMLoginShellArgument.  The documentation has been updated with
these new user defaults.
2008-03-07 22:42:46 +01:00
Bjorn Winckler 12bec6e4ef Merge upstream 2008-03-06 22:46:00 +01:00
vimboss d26a1b2aad updated for version 7.1-267 2008-03-06 21:45:49 +00:00
Bjorn Winckler 68799a3f7b Integration pane: version label moved, typo fixed 2008-03-06 21:53:18 +01:00
Bjorn Winckler 164caf3832 Set <D-C-z> as key equivalent for Window->Zoom menu item
This key equivalent is the same as in iTunes.
2008-03-06 19:55:42 +01:00
Bjorn Winckler fa28669748 Recognize files with 'patch' and 'diff' extensions 2008-03-06 19:49:36 +01:00
Nico Weber 2fefb81d43 Update the Integration prefs pane
The integration pane now contains descriptive text concerning the 'Edit
in ODBEditor' input manager.
2008-03-06 19:35:22 +01:00
Nico Weber 9d568fc7c9 Merge upstream Edit in TextMate changes, remove a utf8 char 2008-03-06 19:25:56 +01:00
Bjorn Winckler 0e6bfe9367 Update help
Add comments on automatic updates in "important" section and MMZoomBoth
in "hints" section.
2008-03-02 17:36:02 +01:00
Nico Weber 042108b0ad ODB Input Manager installer is version sensitive
The Integration prefs pane states which version of the input manager
currently is installed.  The Input Manager version is bumped from 1.0
to 1.1.
2008-03-01 20:00:30 +01:00
Nico Weber 8ee6c93248 Integration prefs pane update
- Make last prefs pane persistent
- Order editor list alphabetically
- Set editor on install if it is not set
- Code cleanup
2008-03-01 16:31:36 +01:00
vimboss 3f9f756149 updated for version 7.1-266 2008-03-01 12:49:21 +00:00
Bjorn Winckler f6a5f65011 Add "Edit in ODBEditor" input manager credits 2008-02-28 18:53:41 +01:00
Nico Weber f6e817e253 Preference panel update, input manager installer
The preference panel now uses Dave Batton's DBPrefsWindowController
class.  A (preliminary) "Integration" panel has also been added which
adds buttons to install the "Edit in ODBEditor" input manager, and a way
to choose which editor to use with the input manager.

The input manager is now bundled inside MacVim.app and the source code
has been added to the project.  The original ODB input manager source
code was written by Allan Odgaard and was later modified by Chris Eidhof
and Eelco Lempsink to make it work with other editors than TextMate.

The installer uses a new AuthorizedShellCommand class.

Dave Batton is credited in the About dialog.
2008-02-28 18:30:34 +01:00
Bjorn Winckler bf22f09010 Add src/po/*.mo to .gitignore 2008-02-27 22:10:40 +01:00
vimboss 41c734a1aa updated for version 7.1-266 2008-02-27 15:14:04 +00:00
vimboss 65b46aa438 updated for version 7.1-265 2008-02-26 20:30:12 +00:00
vimboss 55790c5bb1 updated for version 7.1-264 2008-02-25 20:55:22 +00:00
vimboss 160b3ddb75 updated for version 7.1-263 2008-02-25 19:46:51 +00:00
Bjorn Winckler 4bbbab9e56 Enlarge try/catch block in connect backend
There have been reports of uncaught exception when the backend connects.
Hopefully these exceptions will no longer go uncaught.
2008-02-23 16:30:58 +01:00
vimboss 548238236c updated for version 7.1-262 2008-02-20 19:11:07 +00:00
vimboss 1f27812ec0 updated for version 7.1-261 2008-02-20 17:15:26 +00:00
vimboss 1b21020c55 updated for version 7.1-260 2008-02-20 13:59:32 +00:00
vimboss d6fb745d7b updated for version 7.1-259 2008-02-20 13:16:29 +00:00
vimboss b5d1a8c5ba updated for version 7.1-258 2008-02-20 12:43:01 +00:00
vimboss 2e80f981c6 updated for version 7.1-258 2008-02-20 12:41:56 +00:00
vimboss 43d56b9b31 updated for version 7.1-257 2008-02-20 11:44:03 +00:00
vimboss d3b99588e3 updated for version 7.1-256 2008-02-20 11:24:52 +00:00
vimboss 80e4ddf501 updated for version 7.1-255 2008-02-20 10:29:39 +00:00
vimboss 143c782109 updated for version 7.1-254 2008-02-20 09:58:18 +00:00
vimboss a9dce2fa3d updated for version 7.1-253 2008-02-18 18:42:52 +00:00
Bjorn Winckler bd394ba7b4 Cmd-click to only maximize vertically when MMZoomBoth is set 2008-02-17 20:01:19 +01:00
Bjorn Winckler 17b0feb45b Add MMZoomBoth user default
If MMZoomBoth user default is enabled, then the green zoom button will
maximize horizontally as well as vertically.
2008-02-16 19:55:44 +01:00
Nico Weber 9265b87738 No CF calls between fork() and exec()
Ensure no CoreFoundation calls are made between fork() and exec()
otherwise Mac OS X may crash and burn.
2008-02-16 18:26:01 +01:00
Jjgod Jiang 84a3908488 Cursor drawing and inset support for ATSUI renderer 2008-02-15 20:22:06 +01:00
vimboss da50fc7107 updated for version 7.1-252 2008-02-14 21:20:26 +00:00
Bjorn Winckler a2f006b7a5 Update Appcast for snapshot 22 2008-02-14 21:03:11 +01:00
vimboss ff477a8d27 updated for version 7.1-251 2008-02-13 20:49:04 +00:00
Bjorn Winckler ef149aa134 Snapshot 22
The 'make-snapshot.sh' script has also been updated.
2008-02-13 20:02:07 +01:00
Bjorn Winckler a6907b971a Add info concerning find to MacVim help 2008-02-13 19:21:51 +01:00
vimboss a8b5c51adf updated for version 7.1-250 2008-02-13 17:36:06 +00:00
Bjorn Winckler ee5a7d0bb7 Add script that builds a new snapshot
The script make-snapshot.sh will build a new snapshot, then create a
folder on the Desktop containing
    MacVim.app
    README-snapshot.txt
    mvim
The folder is then archived and compressed (to a file on the Desktop).
2008-02-13 18:03:58 +01:00
Bjorn Winckler dd78d32dd4 Fix Find Pasteboard bugs
As a temporary precaution, the Find Pasteboard is not used during a fork
since this caused the entire machine to lock up.

Also, only patterns from a search (/ and ?) are added to the pboard; not
patterns from a substitution (:s).
2008-02-13 17:54:20 +01:00
vimboss 1190edd343 updated for version 7.1-249 2008-02-13 14:21:38 +00:00
vimboss 0a00f8f69f updated for version 7.1-248 2008-02-13 11:42:46 +00:00
vimboss b5b2678f9d updated for version 7.1-247 2008-02-13 09:58:14 +00:00
vimboss 1b133a3190 updated for version 7.1-246 2008-02-13 09:28:19 +00:00
Bjorn Winckler 5e1defcf44 Update Appcast
Replaced '<' and '>' with '&lt;' and '&gt;' where necessary.
2008-02-11 22:32:43 +01:00
vimboss 0f6e98e9fc updated for version 7.1-245 2008-02-10 21:25:55 +00:00
vimboss ed474b1614 updated for version 7.1-244 2008-02-06 16:33:58 +00:00
vimboss 518615feff updated for version 7.1-243 2008-02-06 13:44:43 +00:00
156 changed files with 14605 additions and 2415 deletions
+1
View File
@@ -18,5 +18,6 @@ src/auto/pathdef.c
src/config.log
src/config.status
src/objects
src/po/*.mo
src/tags
src/xxd/xxd
+1
View File
@@ -193,6 +193,7 @@ SRC_UNIX = \
src/vim_icon.xbm \
src/vim_mask.xbm \
src/vimtutor \
src/gvimtutor \
src/which.sh \
src/workshop.c \
src/workshop.h \
+22 -10
View File
@@ -1,6 +1,6 @@
" Vim autoload file for editing compressed files.
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2007 May 10
" Last Change: 2008 May 29
" These functions are used by the gzip plugin.
@@ -73,8 +73,15 @@ fun gzip#read(cmd)
let empty = line("'[") == 1 && line("']") == line("$")
let tmp = tempname()
let tmpe = tmp . "." . expand("<afile>:e")
if exists('*fnameescape')
let tmp_esc = fnameescape(tmp)
let tmpe_esc = fnameescape(tmpe)
else
let tmp_esc = escape(tmp, ' ')
let tmpe_esc = escape(tmpe, ' ')
endif
" write the just read lines to a temp file "'[,']w tmp.gz"
execute "silent '[,']w " . escape(tmpe, ' ')
execute "silent '[,']w " . tmpe_esc
" uncompress the temp file: call system("gzip -dn tmp.gz")
call system(a:cmd . " " . s:escape(tmpe))
if !filereadable(tmp)
@@ -95,12 +102,12 @@ fun gzip#read(cmd)
setlocal nobin
if exists(":lockmarks")
if empty
execute "silent lockmarks " . l . "r ++edit " . tmp
execute "silent lockmarks " . l . "r ++edit " . tmp_esc
else
execute "silent lockmarks " . l . "r " . tmp
execute "silent lockmarks " . l . "r " . tmp_esc
endif
else
execute "silent " . l . "r " . tmp
execute "silent " . l . "r " . tmp_esc
endif
" if buffer became empty, delete trailing blank line
@@ -110,8 +117,8 @@ fun gzip#read(cmd)
endif
" delete the temp file and the used buffers
call delete(tmp)
silent! exe "bwipe " . tmp
silent! exe "bwipe " . tmpe
silent! exe "bwipe " . tmp_esc
silent! exe "bwipe " . tmpe_esc
endif
" Restore saved option values.
@@ -124,10 +131,15 @@ fun gzip#read(cmd)
" When uncompressed the whole buffer, do autocommands
if ok && empty
if &verbose >= 8
execute "doau BufReadPost " . expand("%:r")
if exists('*fnameescape')
let fname = fnameescape(expand("%:r"))
else
execute "silent! doau BufReadPost " . expand("%:r")
let fname = escape(expand("%:r"), " \t\n*?[{`$\\%#'\"|!<")
endif
if &verbose >= 8
execute "doau BufReadPost " . fname
else
execute "silent! doau BufReadPost " . fname
endif
endif
endfun
+13 -5
View File
@@ -1,7 +1,7 @@
" MacVim colorscheme
"
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
" Last Change: 2007 Nov 17
" Last Change: 2008 May 9
"
" This is the default MacVim color scheme. It supports both light and dark
" backgrounds (see :h 'background').
@@ -50,7 +50,11 @@ hi TabLineFill gui=reverse
hi TabLineSel gui=bold
hi Title gui=bold guifg=DeepSkyBlue3
hi VertSplit gui=NONE guifg=DarkSlateGray guibg=Gray90
hi Visual guibg=MacSelectedTextBackgroundColor
if has("gui_macvim")
hi Visual guibg=MacSelectedTextBackgroundColor
else
hi Visual guibg=#72F7FF
endif
hi WarningMsg guifg=Firebrick2
" Syntax items (`:he group-name` -- more groups are available, these are just
@@ -79,7 +83,7 @@ if &background == "dark"
hi DiffChange guibg=MediumPurple4
hi DiffDelete gui=bold guifg=White guibg=SlateBlue
hi DiffText gui=NONE guifg=White guibg=SteelBlue
hi LineNr guifg=#350A5B guibg=Grey5
hi LineNr guifg=#552A7B guibg=Grey5
hi MatchParen guifg=White guibg=Magenta
hi Normal guifg=Grey50 guibg=Grey10
hi Search guibg=Blue4 guifg=NONE
@@ -101,7 +105,11 @@ else
hi DiffText gui=NONE guibg=Gold
hi LineNr guifg=#888888 guibg=#E6E6E6
hi MatchParen guifg=White guibg=MediumPurple1
hi Normal gui=NONE guifg=MacTextColor guibg=MacTextBackgroundColor
if has("gui_macvim")
hi Normal gui=NONE guifg=MacTextColor guibg=MacTextBackgroundColor
else
hi Normal gui=NONE guifg=Black guibg=White
endif
hi Search guibg=CadetBlue1 guifg=NONE
hi Statement gui=bold guifg=Maroon guibg=NONE
hi Todo gui=NONE guifg=DarkGreen guibg=PaleGreen1
@@ -115,7 +123,7 @@ endif
" Change the selection color on focus change (but only if the "macvim"
" colorscheme is active).
"
if !exists("s:augroups_defined")
if has("gui_macvim") && !exists("s:augroups_defined")
au FocusLost * if exists("colors_name") && colors_name == "macvim" | hi Visual guibg=MacSecondarySelectedControlColor | endif
au FocusGained * if exists("colors_name") && colors_name == "macvim" | hi Visual guibg=MacSelectedTextBackgroundColor | endif
+23 -1
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.1. Last change: 2008 Jan 11
*eval.txt* For Vim version 7.1. Last change: 2008 May 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1609,6 +1609,7 @@ finddir( {name}[, {path}[, {count}]])
String find directory {name} in {path}
findfile( {name}[, {path}[, {count}]])
String find file {name} in {path}
fnameescape( {fname}) String escape special characters in {fname}
fnamemodify( {fname}, {mods}) String modify file name
foldclosed( {lnum}) Number first line of fold at {lnum} if closed
foldclosedend( {lnum}) Number last line of fold at {lnum} if closed
@@ -1638,6 +1639,7 @@ getline( {lnum}) String line {lnum} of current buffer
getline( {lnum}, {end}) List lines {lnum} to {end} of current buffer
getloclist({nr}) List list of location list items
getmatches() List list of current matches
getpid() Number process ID of Vim
getpos( {expr}) List position of cursor, mark, etc.
getqflist() List list of quickfix items
getreg( [{regname} [, 1]]) String contents of register
@@ -2619,6 +2621,19 @@ findfile({name}[, {path}[, {count}]]) *findfile()*
< Searches from the directory of the current file upwards until
it finds the file "tags.vim".
fnameescape({string}) *fnameescape()*
Escape {string} for use as file name command argument. All
characters that have a special meaning, such as '%' and '|'
are escaped with a backslash.
For most systems the characters escaped are "". For systems
where a backslash appears in a filename, it depends on the
value of 'isfname'.
Example: >
:let fname = 'some str%nge|name'
:exe "edit " . fnameescape(fname)
< results in executing: >
edit some\ str\%nge\|name
fnamemodify({fname}, {mods}) *fnamemodify()*
Modify file name {fname} according to {mods}. {mods} is a
string of characters like it is used for file names on the
@@ -3833,6 +3848,10 @@ nr2char({expr}) *nr2char()*
characters. nr2char(0) is a real NUL and terminates the
string, thus results in an empty string.
*getpid()*
getpid() Return a Number which is the process ID of the Vim process.
On Unix this is a unique number. On MS-DOS it's always zero.
*getpos()*
getpos({expr}) Get the position for {expr}. For possible values of {expr}
see |line()|.
@@ -4523,6 +4542,9 @@ setpos({expr}, {list})
character. E.g., a position within a <Tab> or after the last
character.
Returns 0 when the position could be set, -1 otherwise.
An error message is given if {expr} is invalid.
Also see |getpos()|
This does not restore the preferred column for moving
+139 -55
View File
@@ -1,4 +1,4 @@
*gui_mac.txt* For Vim version 7.1. Last change: 2008 Feb 05
*gui_mac.txt* For Vim version 7.1. Last change: 2008 May 25
VIM REFERENCE MANUAL by Bjorn Winckler
@@ -34,9 +34,10 @@ on the MacVim project page >
or by posting to the vim_mac mailing list *vim_mac* >
http://groups.google.com/group/vim_mac
Remember to keep checking the project page for new snapshots. (If you
downloaded this copy from somewhere else, you might want to go there now to
make sure that you have got the latest version.)
Remember to keep checking the project page for new snapshots or use the
automatic updating feature which can be enabled in the preferences pane. (If
you downloaded this copy from somewhere else, you might want to go there now
to make sure that you have got the latest version.)
==============================================================================
1. MacVim differences *macvim-differences*
@@ -123,7 +124,28 @@ strings like "((3) of 2)" to appear in the window title.
*macvim-options*
These are the non-standard options that MacVim supports:
'fullscreen' 'toolbariconsize' 'transparency'
'fullscreen' 'fuoptions' 'toolbariconsize' 'transparency' 'antialias'
*macvim-find*
Whenever you search for something in Vim (e.g. using "/") the search query is
copied to the OS X "Find Pasteboard". The idea is that if you search for
something and switch to another application, then you can hit <D-g> (or <D-G>)
to repeat the search in the new app. The same feature works if you search in
some app, switch to MacVim and hit <D-g>.
Note that the command |n| is not the same as <D-g>. The former will repeat
the last search made in Vim, whereas the latter searches for the string on the
OS X Find Pasteboard using the action findNext: (see |:macaction|).
The <D-g> key equivalent is a great way to bring a search from one window to
another in MacVim. Simply search for something in one window (using "/") then
switch to another (e.g. with <D-`>) and hit <D-g> and the search will be
repeated in the new window.
*macvim-backspace* *macvim-delete*
The 'backspace' option is set in the system vimrc to make the delete key
behave in a more familiar way to new users. If you dislike this non-default
behaviour, then add the line "set backspace&" to your "~/.vimrc" file.
==============================================================================
2. Starting MacVim *macvim-start*
@@ -203,7 +225,11 @@ as general information regarding Mac OS X user defaults.
Here is a list of relevant dictionary entries:
KEY VALUE ~
MMAtsuiRenderer enable ATSUI renderer [bool]
MMCellWidthMultiplier width of a normal glyph in em units [float]
MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool]
MMLoginShellArgument login shell parameter [string]
MMLoginShellCommand which shell to use to launch Vim [string]
MMNoFontSubstitution disable automatic font substitution [bool]
MMTabMaxWidth maximum width of a tab [int]
MMTabMinWidth minimum width of a tab [int]
@@ -214,6 +240,7 @@ MMTextInsetRight text area offset in pixels [int]
MMTextInsetTop text area offset in pixels [int]
MMTexturedWindow use brushed metal window (Tiger only) [bool]
MMTranslateCtrlClick interpret ctrl-click as right-click [bool]
MMZoomBoth zoom button maximizes both directions [bool]
As an example, if you have more than one mouse button and would wish to free
up Ctrl-click so you can bind it to something else, then the appropriate
@@ -223,6 +250,23 @@ command is: >
If you wish to restore all user defaults to their starting values, open
Terminal and type: >
defaults delete org.vim.MacVim
<
*macvim-login-shell*
Applications opened from the Finder do not automatically source the user's
environment variables (which are typically set in .profile or .bashrc). This
presents a problem when using |:!| to execute commands in the shell since e.g.
$PATH might not be set properly. To work around this problem MacVim can start
new Vim processes via a login shell so that all environment variables are set.
By default MacVim uses the $SHELL environment variable to determine which
shell to use (if $SHELL is not set "/bin/bash" is used). It is possible to
override this choice by setting the user default MMLoginShellCommand to the
shell that should be used (e.g. "/bin/tcsh"). MacVim tries to make the shell
a login shell by prepending argv[0] with a dash. If you use an exotic shell
and need to pass it a parameter to make it a login shell then you can set the
user default MMLoginShellArgument (e.g. to "-l"). Finally, if the "bash"
shell is used, then "-l" is automatically added as an argument. To override
this behaviour set MMLoginShellArgument to "--".
==============================================================================
4. Special colors *macvim-colors*
@@ -272,49 +316,84 @@ than the default?) then post them to |vim_mac|.
==============================================================================
5. Menus *macvim-menus*
*:macm* *:macmenukey*
MacVim has a special way of binding keys to menu items that differs from other
Vim GUI ports. A menu binding is called a "key equivalent" in Mac OS X
terminology, this is displayed on the right side of a menu item. The
":macmenukey" command is used to set the key equivalent of a menu item. This
command takes two parameters, the first names the menu item to bind to, the
second gives the key combination. For example: >
:macmenukey File.New\ Tab <D-t>
This sets the key equivalent of the "New Tab" menu item under the "File" menu
to Cmd+t.
Menus in Mac OS X behave slightly different from other platforms. For that
reason two new commands have been added to Vim. To understand what these
commands do you must first understand how menus work on OS X.
Note that key equivalents:
* must contain the Cmd modifier flag (<D-...>)
* take precedence over normal mappings made with ":map"
* can only be modified during startup (e.g. in .gvimrc)
Each entry in a menu is called a "menu item". With each menu item is
associated: a title, a key equivalent and an action message. When a menu is
displayed the title is shown on the left and the key equivalent (if any) is
shown on the right. Key equivalents enable you to access a menu item using
the keyboard instead of having to use the mouse. When a menu item is clicked
it will send it's associated action message. Actions can be used to instruct
MacVim to paste some text (paste:), open a new window (newWindow:), etc.
Certain actions are standard throughout OS X which is why MacVim must be able
to set these for each menu item. (E.g. the menu item "Edit.Paste" must be
bound to the action "paste:" otherwise pasting won't work in dialogs since
that is the action that instructs them to paste something.)
It is possible to reset a key equivalent by calling :macmenukey with a menu
name but no key. This is so that the default key equivalents can be reset in
"~/.gvimrc". For example, if you would like to free up <D-s> (which is the
key equivalent of "File.Save") then add the following line to "~/.gvimrc": >
macmenukey File.Save
Now you can use :map to bind <D-s> to whatever you like.
Menus are configured using the |:macmenu| command and the |:macaction| command
can be used to send action messages.
It is not necessary to reset a key equivalent if all you want to do is to
change the key equivalent of a menu item. For example, say you want to use
<D-M-Right> as the key equivalent for "Next Tab", then add the following line
to "~/.gvimrc": >
macmenukey Window.Next\ Tab <D-M-Right>
<
*:maca* *:macaction*
It is typical for menu items in Cocoa applications to bind to Objective-C
selectors. To support this, MacVim introduces the ":macaction" command. This
command takes the name of an action message as its only parameter. (An action
message is an Objective-C message with "void" return type and a single
parameter of type "id".) For example, the "New Window" menu item on the
"File" menu is created in the following manner: >
:an 10.290 File.New\ Window :macaction newWindow:<CR>
:maca[ction] {action:} Send the message "action:" to the first responder.
The list of allowed actions can be seen by typing
:maca <C-d>
An attempt to send an action not listed here will
result in an error. This list is specified in a
property list file called |Actions.plist|.
Note 1: A menu item which is bound to ":macaction" will automatically be bound
to that action in all modes (as if ":an" was used). It is not possible to
bind to ":macaction" in one mode only.
Note 2: The action is "nil-targeted", which means it is passed down the first
responder chain.
*:macm* *:macmenu*
:mac[menu] {menu} {key}={arg} ...
Set Mac specific properties for {menu}. The
properties that can be set are:
action the action this menu sends
alt "yes" if alternate of previous menu
key the key equivalent of this menu
This command must be used in a startup file, for
example in "~/.gvimrc". It has no effect otherwise.
For convenience, a menu with "action=name:" which is
bound to <Nop> will act as if bound to
":maca name:<CR>". Thus, if "Menu.Item" is given by
:an Menu.Item <Nop>
:macm Menu.Item action=name:
then ":emenu Menu.Item" is equivalent to
":maca name:".
The key equivalent is specified with the <D-..>
syntax. Note that key equivalents must contain the
Cmd modifier flag (<D-...>), and they take precedence
over normal mappings.
Use the syntax "key=<nop>" to clear the key equivalent
of a menu. This can be used to free up a key
combination that is set in the system gvimrc so that
it may be mapped to using ":map".
Recognised values of "alt" are "0", "no", "1", and
"yes". The default is "no". An alternate menu must
have the same key equivalent as the previous menu,
except the modifier flags must differ. The alternate
menu is by default hidden and only shows up when the
modifier is held down.
Here are some examples on how to use these commands:
1. Create a menu item with title "New Window" under the "File" menu, with key
equivalent Cmd-n, which opens a new window when selected: >
:an 10.290 File.New\ Window <Nop>
:macm File.New\ Window action=newWindow: key=<D-n>
2. Change the key equivalent to cycle through tabs to Cmd-Left/Right: >
:macm Window.Previous\ Tab key=<D-Left>
:macm Window.Next\ Tab key=<D-Right>
3. Create a mapping in normal mode which closes the current tab/window: >
:map <C-w> :maca performClose:<CR>
>
The standard Vim menus are modified in "$VIM/gvimrc". Take a look at that
file for more examples on how to set up menus. Note: When no window is open a
minimal default menu is used. The default menu is set up in MainMenu.nib
which resides in "Resources/English.lproj/" folder inside the app bundle.
*Actions.plist*
Some action messages would not be suitable to call from within Vim, so there
@@ -323,26 +402,30 @@ application bundle) which contains all actions that may be called. The key in
this dictionary is the name of the action message (case sensitive), the value
is not used.
Hint: The |:macaction| command supports command-line completion so you can
enter ":maca<Space><C-d>" to see a list of all available actions.
Here is a random assortment of actions from Actions.plist which might be
useful.
useful.
Action Description ~
fileOpen: Show "File Open" dialog
findNext: Search forward using the "Find Pasteboard"
findPrevious: Search backward using the "Find Pasteboard"
fontSizeDown: Decrease font size
fontSizeUp: Increase font size
hide: Hide MacVim
miniaturizeAll: Minimize all windows to the dock
newWindow: Open a new (empty) window
orderFrontCharacterPalette: Show the the "Special Characters" dialog
orderFrontFontPanel: Show the Font panel
orderFrontPreferencePanel: Show the Preferences panel
performMiniaturize: Minimize window to the dock
performZoom: Zoom window (same as clicking the green blob)
selectNextWindow: Select next window (similar to <D-`>)
selectPreviousWindow: Select previous window (similar to <S-D-`>)
As an example, to map <C-z> to performZoom: you could do something like this: >
:map <silent> <C-z> :macaction performZoom:<CR>
A better way to map to performZoom: would be to set the key equivalent of the
menu item "Window.Zoom" to the above action. This can be done by adding the
following line to "~/.gvimrc": >
macmenukey Window.Zoom <D-C-z>
(Note that key equivalents must contain the 'D' flag.)
terminate: Quit MacVim
zoomAll: Zoom all windows
_cycleWindows: Select next window (similar to <D-`>)
_cycleWindowsBackwards: Select previous window (similar to <D-S-`>)
==============================================================================
6. Toolbar *macvim-toolbar*
@@ -482,7 +565,8 @@ Scenario: ~
When you click the (green) zoom button you want the window to maximize
horizontally as well as vertically.
Solution: ~
Hold down Cmd and click the zoom button.
Hold down Cmd and click the zoom button. If you prefer this to be the default
action, then set the user default MMZoomBoth (see |macvim-prefs|).
Scenario: ~
Typing feels sluggish when the cursor is just before a right bracket (i.e. ')',
+1 -1
View File
@@ -1289,7 +1289,7 @@ The commands are sorted on the non-optional part of their name.
|:move| :m[ove] move lines
|:mark| :ma[rk] set a mark
|:macation| :maca[ction] send action message
|:macmenukey| :macm[eyequiv] set key equivalent for menu item
|:macmenu| :macm[enu] set Mac specific properties for menu item
|:make| :mak[e] execute external command 'makeprg' and parse
error messages
|:map| :map show or enter a mapping
+80 -18
View File
@@ -1,4 +1,4 @@
*options.txt* For Vim version 7.1. Last change: 2007 Aug 10
*options.txt* For Vim version 7.1. Last change: 2008 Feb 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -666,17 +666,21 @@ A jump table for the options with a short description can be found at |Q_op|.
Standard Annex #11 (http://www.unicode.org/reports/tr11).
*'antialias'* *'anti'* *'noantialias'* *'noanti'*
'antialias' 'anti' boolean (default: off)
'antialias' 'anti' boolean (default off, on for MacVim)
global
{not in Vi}
{only available when compiled with Carbon GUI enabled
on Mac OS X}
This option only has an effect in the Carbon GUI version of Vim on Mac
OS X v10.2 or later. When on, Vim will use smooth ("antialiased")
fonts, which can be easier to read at certain sizes on certain
displays. Setting this option can sometimes cause problems if
'guifont' is set to its default (empty string).
Note: Antialiasing is handled automatically on MacVim.
{only available when compiled with GUI enabled on
Mac OS X}
This option only has an effect in the GUI version of Vim on Mac OS X
v10.2 or later. When on, Vim will use smooth ("antialiased") fonts,
which can be easier to read at certain sizes on certain displays.
Setting this option in the Carbon version can sometimes cause problems
if 'guifont' is set to its default (empty string).
Support for this option is not flawless in MacVim. In particular,
Monaco always seems to render not antialiased for point sizes up
to 10. The ATSUI renderer has better antialias support.
*'autochdir'* *'acd'* *'noautochdir'* *'noacd'*
'autochdir' 'acd' boolean (default off)
@@ -3046,16 +3050,74 @@ A jump table for the options with a short description can be found at |Q_op|.
'fullscreen' 'fu' boolean (default off)
global
{not in Vi}
{only available in the MacVim GUI}
When this option is set, the whole screen is covered by vim. Screen
{only in MacVim GUI}
When this option is set, the whole screen is covered by Vim. Screen
decorations drawn by the operating system (such as the dock or the
menu bar) are hidden. Most of vim's window chrome is hidden as well
(e.g. toolbar, title bar). The tab bar and scroll bars remains visible.
Most of the screen is black, only a 'columns' x 'lines' part of the
screen is covered by the actual vim control. The control is centered.
menu bar) are hidden. Most of Vim's window chrome is hidden as well
(e.g. toolbar, title bar). The tab bar and scroll bars remain visible.
Updates to the window position are ignored in fullscreen mode.
See 'fuoptions' for how Vim resizes and colors the background when
entering and leaving fullscreen mode.
XXX: Add fuenter/fuleave autocommands? You might want to display
a NERDTree or a Tlist only in fullscreen for example. Then again, this
could probably be in a sizechanged autocommand that triggers if the
size is above a certain threshold.
XXX: Think about how 'fullscreen' and 'transparency' should interact.
*'fuoptions'* *'fuopt'*
'fuoptions' 'fuopt' string (default "maxvert")
global
{not in Vi}
{only in MacVim GUI}
In fullscreen mode, most of the screen is black, only a part of the
screen is covered by the actual Vim control. The control is centered.
This option controls the size of the Vim control as well as the color
of the unused screen area.
value effect ~
maxvert When entering fullscreen, 'lines' is set to the maximum number
of lines fitting on the screen in fullscreen mode. When
leaving fullscreen, if 'lines' is still equal to the maximized
number of lines, it is restored to the value it had before
entering fullscreen.
maxhorz When entering fullscreen, 'columns' is set to the maximum number
of columns fitting on the screen in fullscreen mode. When
leaving fullscreen, if 'columns' is still equal to the maximized
number of columns, it is restored to the value it had before
entering fullscreen.
background:color
When entering fullscreen, 'color' defines the color of the part
of the screen that is not occupied by the Vim control. If
'color' is an 8-digit hexadecimal number preceded by '#',
it is interpreted as an explicit color value '#aarrggbb', with
one byte each for the alpha, red, green, and blue values.
Otherwise, 'color' is interpreted as a highlight group name,
and the fullscreen background is filled with that highlight
group's background color, as defined by the current color
scheme.
Examples:
Don't change size of Vim when entering fullscreen: >
:set fuoptions=
< Maximize Vim when entering fullscreen: >
:set fuoptions=maxvert,maxhorz
< Maximize Vim only vertically when entering fullscreen, and color the
background dark blue: >
:set fuoptions=maxvert,background:#FF003042
< Don't change the size of Vim when entering fullscreen, and color the
background like the current text background: >
:set fuoptions=background:Normal
<
XXX: what if the font size is changed? you probably never want to
restore the old 'lines' or 'columns' in that case.
XXX: Each time the Vim window resizes (for example due to font size
changes, re-maximize Vim to fullscreen?)
XXX: The approach doesn't restore vertical Vim size if fu is entered
without tabs and leaves with tabs (or the other way round).
*'gdefault'* *'gd'* *'nogdefault'* *'nogd'*
'gdefault' 'gd' boolean (default off)
global
@@ -4906,7 +4968,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|autocmd-osfiletypes|
*'paragraphs'* *'para'*
'paragraphs' 'para' string (default "IPLPPPQPP LIpplpipbp")
'paragraphs' 'para' string (default "IPLPPPQPP TPHPLIPpLpItpplpipbp")
global
Specifies the nroff macros that separate paragraphs. These are pairs
of two letters (see |object-motions|).
+7 -3
View File
@@ -1,4 +1,4 @@
*os_mac.txt* For Vim version 7.1. Last change: 2006 Apr 30
*os_mac.txt* For Vim version 7.1. Last change: 2008 May 19
VIM REFERENCE MANUAL by Bram Moolenaar et al.
@@ -6,9 +6,13 @@
*mac* *Mac* *macintosh* *Macintosh*
This file documents the particularities of the Macintosh version of Vim.
This file documents the particularities of the Mac version of Vim. It was
written with the older Carbon version of Vim in mind. If you are using the
newer MacVim.app then please go to |macvim|. Some of the information here
does not apply to MacVim.app.
NOTE: This file is a bit outdated. You might find more useful info here:
NOTE: This file is a bit outdated. You might find more useful info on the old
Carbon version of Vim here:
http://macvim.org/
1. Filename Convention |mac-filename|
+1
View File
@@ -697,6 +697,7 @@ Short explanation of each option: *option-list*
'formatexpr' 'fex' expression used with "gq" command
'fsync' 'fs' whether to invoke fsync() after file write
'fullscreen' 'fu' let vim cover the whole screen (MacVim only)
'fuoptions' 'fuopt' controls how 'fullscreen' behaves (MacVim only)
'gdefault' 'gd' the ":substitute" flag 'g' is default on
'grepformat' 'gfm' format of 'grepprg' output
'grepprg' 'gp' program to use for ":grep"
+2 -1
View File
@@ -766,7 +766,8 @@ accordingly. Vim proceeds in this order:
Note that this file is ALWAYS read in 'compatible' mode, since the
automatic resetting of 'compatible' is only done later. Add a ":set
nocp" command if you like.
For the Macintosh the $VIMRUNTIME/macmap.vim is read.
For the Macintosh the $VIMRUNTIME/macmap.vim is read (not on
MacVim.app, this only applies to the older Carbon version).
*VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc*
c. Four places are searched for initializations. The first that exists
+2
View File
@@ -1177,6 +1177,8 @@ goes from 2.2 to 2.3. (Gordon Prieur)
Mac: When starting up Vim will load the $VIMRUNTIME/macmap.vim script to
define default command-key mappings. (mostly by Benji Fisher)
This only applies to the older Carbon version of Vim, MacVim.app does not
source this file.
Mac: Add the selection type to the clipboard, so that Block, line and
character selections can be used between two Vims. (Eckehard Berns)
+4 -1
View File
@@ -3,7 +3,7 @@
vimtutor \- the Vim tutor
.SH SYNOPSIS
.br
.B vimtutor [language]
.B vimtutor [-g] [language]
.SH DESCRIPTION
.B Vimtutor
starts the
@@ -18,6 +18,9 @@ is useful for people that want to learn their first
.B Vim
commands.
.PP
The optional argument -g starts vimtutor with gvim rather than vim, if the
GUI version of vim is available, or falls back to Vim if gvim is not found.
.PP
The optional [language] argument is the two-letter name of a language, like
"it" or "es".
If the [language] argument is missing, the language of the current locale will
+9 -6
View File
@@ -16,20 +16,23 @@ set cpo&vim
augroup filetypedetect
" Ignored extensions
if exists("*fnameescape")
au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.rpmsave,?\+.rpmnew
\ exe "doau filetypedetect BufRead " . expand("<afile>:r")
\ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r"))
au BufNewFile,BufRead *~
\ let s:name = expand("<afile>") |
\ let s:short = substitute(s:name, '\~$', '', '') |
\ if s:name != s:short && s:short != "" |
\ exe "doau filetypedetect BufRead " . s:short |
\ exe "doau filetypedetect BufRead " . fnameescape(s:short) |
\ endif |
\ unlet s:name |
\ unlet s:short
\ unlet s:name s:short
au BufNewFile,BufRead ?\+.in
\ if expand("<afile>:t") != "configure.in" |
\ exe "doau filetypedetect BufRead " . expand("<afile>:r") |
\ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) |
\ endif
elseif &verbose > 0
echomsg "Warning: some filetypes will not be recognized because this version of Vim does not have fnameescape()"
endif
" Pattern used to match file names which should not be inspected.
" Currently finds compressed files.
@@ -187,7 +190,7 @@ func! s:FTasmsyntax()
let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4).
\" ".getline(5)." "
if head =~ '\sasmsyntax=\S\+\s'
let b:asmsyntax = substitute(head, '.*\sasmsyntax=\(\S\+\)\s.*','\1', "")
let b:asmsyntax = substitute(head, '.*\sasmsyntax=\([a-zA-Z0-9]\+\)\s.*','\1', "")
elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library'))
let b:asmsyntax = "vmasm"
endif
+9 -3
View File
@@ -1,7 +1,7 @@
" Vim support file to switch on loading indent files for file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2005 Mar 28
" Last Change: 2008 Feb 22
if exists("did_indent_on")
finish
@@ -15,11 +15,17 @@ augroup filetypeindent
exe b:undo_indent
unlet! b:undo_indent b:did_indent
endif
if expand("<amatch>") != ""
let s = expand("<amatch>")
if s != ""
if exists("b:did_indent")
unlet b:did_indent
endif
runtime! indent/<amatch>.vim
" When there is a dot it is used to separate filetype names. Thus for
" "aaa.bbb" load "indent/aaa.vim" and then "indent/bbb.vim".
for name in split(s, '\.')
exe 'runtime! indent/' . name . '.vim'
endfor
endif
endfunc
augroup END
+3 -2
View File
@@ -783,8 +783,9 @@ func! s:BMMunge(fname, bnum)
return name
endfunc
" When just starting Vim, load the buffer menu later
if has("vim_starting")
" When just starting Vim, load the buffer menu later. Don't do this for MacVim
" because it makes the menu flicker each time a new editor window is opened.
if has("vim_starting") && !has("gui_macvim")
augroup LoadBufferMenu
au! VimEnter * if !exists("no_buffers_menu") | call <SID>BMShow() | endif
au VimEnter * au! LoadBufferMenu
+8 -2
View File
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Oct 10
" Last Change: 2008 May 12
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0
@@ -147,7 +147,7 @@ endwhile
" Open the window
new option-window
setlocal ts=15 tw=0
setlocal ts=15 tw=0 noro
" Insert help and a "set" command for each option.
call append(0, '" Each "set" line shows the current value of an option (on the left).')
@@ -350,6 +350,10 @@ call append("$", "lines\tnumber of lines in the display")
call append("$", " \tset lines=" . &lines)
call append("$", "lazyredraw\tdon't redraw while executing macros")
call <SID>BinOptionG("lz", &lz)
if has("reltime")
call append("$", "redrawtime\ttimeout for 'hlsearch' and :match highlighting in msec")
call append("$", " \tset rdt=" . &rdt)
endif
call append("$", "writedelay\tdelay in msec for each char written to the display")
call append("$", "\t(for debugging)")
call append("$", " \tset wd=" . &wd)
@@ -617,6 +621,8 @@ if has("gui")
call append("$", " \tset transparency=" . &transp)
call append("$", "fullscreen\tdisplay vim in fullscreen mode")
call <SID>BinOptionG("fullscreen", &fullscreen)
call append("$", "fuoptions\tcontrol how fullscreen mode should behave")
call <SID>OptionG("fuoptions", &fuoptions)
endif
endif
+42 -30
View File
@@ -1,6 +1,6 @@
" Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2008 Jan 06
" Last Change: 2008 Feb 27
" Exit quickly when:
" - this plugin was already loaded (or disabled)
@@ -34,7 +34,8 @@ function! s:Highlight_Matching_Pair()
endif
" Avoid that we remove the popup menu.
if pumvisible()
" Return when there are no colors (looks like the cursor jumps).
if pumvisible() || (&t_Co < 8 && !has("gui_running"))
return
endif
@@ -60,39 +61,13 @@ function! s:Highlight_Matching_Pair()
endif
" Figure out the arguments for searchpairpos().
" Restrict the search to visible lines with "stopline".
" And avoid searching very far (e.g., for closed folds and long lines)
" The "viewable" variables give a range in which we can scroll while keeping
" the cursor at the same position
" adjustedScrolloff accounts for very large numbers of scrolloff
let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
" one of these stoplines will be adjusted below, but the current values are
" minimal boundaries within the current window
let stoplinebottom = line('w$')
let stoplinetop = line('w0')
if i % 2 == 0
let s_flags = 'nW'
let c2 = plist[i + 1]
if has("byte_offset") && has("syntax_items") && &smc > 0
let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
let stopline = min([bottom_viewable, byte2line(stopbyte)])
else
let stopline = min([bottom_viewable, c_lnum + 100])
endif
let stoplinebottom = stopline
else
let s_flags = 'nbW'
let c2 = c
let c = plist[i - 1]
if has("byte_offset") && has("syntax_items") && &smc > 0
let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
let stopline = max([top_viewable, byte2line(stopbyte)])
else
let stopline = max([top_viewable, c_lnum - 100])
endif
let stoplinetop = stopline
endif
if c == '['
let c = '\['
@@ -111,10 +86,47 @@ function! s:Highlight_Matching_Pair()
\ '=~? "string\\|character\\|singlequote\\|comment"'
execute 'if' s_skip '| let s_skip = 0 | endif'
" Limit the search to lines visible in the window.
let stoplinebottom = line('w$')
let stoplinetop = line('w0')
if i % 2 == 0
let stopline = stoplinebottom
else
let stopline = stoplinetop
endif
try
" Limit the search time to 500 msec to avoid a hang on very long lines.
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 500)
" Limit the search time to 300 msec to avoid a hang on very long lines.
" This fails when a timeout is not supported.
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 300)
catch /E118/
" Can't use the timeout, restrict the stopline a bit more to avoid taking
" a long time on closed folds and long lines.
" The "viewable" variables give a range in which we can scroll while
" keeping the cursor at the same position.
" adjustedScrolloff accounts for very large numbers of scrolloff.
let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2])
let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2])
let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2])
" one of these stoplines will be adjusted below, but the current values are
" minimal boundaries within the current window
if i % 2 == 0
if has("byte_offset") && has("syntax_items") && &smc > 0
let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2])
let stopline = min([bottom_viewable, byte2line(stopbyte)])
else
let stopline = min([bottom_viewable, c_lnum + 100])
endif
let stoplinebottom = stopline
else
if has("byte_offset") && has("syntax_items") && &smc > 0
let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2])
let stopline = max([top_viewable, byte2line(stopbyte)])
else
let stopline = max([top_viewable, c_lnum - 100])
endif
let stoplinetop = stopline
endif
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
endtry
+1 -1
View File
@@ -24,7 +24,7 @@ gvimext.dll: gvimext.obj \
gvimext.obj: gvimext.h
.cpp.obj:
$(cc) $(cflags) -DFEAT_GETTEXT $(cvarsdll) $*.cpp
$(cc) $(cflags) -DFEAT_GETTEXT $(cvarsmt) $*.cpp
gvimext.res: gvimext.rc
$(rc) $(rcflags) $(rcvars) gvimext.rc
+10 -3
View File
@@ -82,9 +82,8 @@ To compile and debug Vim with the VC2003 Toolkit, you will also need
|ms-platform-sdk|, |dotnet-1.1-redist|, |dotnet-1.1-sdk|,
and |windbg-download|.
It's easier to download Visual C++ 2005 Express Edition, |msvc-2005-express|.
The advantage of the VC 2003 Toolkit is that it will be freely available
long after VC 2005 Express Edition stops being free in November 2006.
It's easier to download Visual C++ 2008 Express Edition, |msvc-2008-express|,
which is freely available in perpetuity.
The free Code::Blocks IDE works with the VC2003 Toolkit, as described at
http://wiki.codeblocks.org/index.php?title=Integrating_Microsoft_Visual_Toolkit_2003_with_Code::Blocks_IDE
@@ -152,6 +151,14 @@ Instructions for integrating the Platform SDK into VC Express:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
Visual C++ 2008 Express Edition *msvc-2008-express*
-------------------------------
Visual C++ 2008 Express Edition can be downloaded for free from:
http://msdn2.microsoft.com/en-us/express/default.aspx
This includes the IDE and the debugger. You can build Vim with Make_mvc.mak.
2. MinGW
========
+27 -1
View File
@@ -1,11 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>_cycleWindows:</key>
<string></string>
<key>_cycleWindowsBackwards:</key>
<string></string>
<key>addNewTab:</key>
<string></string>
<key>arrangeInFront:</key>
<string></string>
<key>clearRecentDocuments:</key>
<string></string>
<key>copy:</key>
<string></string>
<key>cut:</key>
<string></string>
<key>fileOpen:</key>
<string></string>
<key>findNext:</key>
@@ -24,27 +34,43 @@
<string></string>
<key>newWindow:</key>
<string></string>
<key>openWebsite:</key>
<string></string>
<key>orderFrontCharacterPalette:</key>
<string></string>
<key>orderFrontFontPanel:</key>
<string></string>
<key>orderFrontPreferencePanel:</key>
<string></string>
<key>paste:</key>
<string></string>
<key>performClose:</key>
<string></string>
<key>performMiniaturize:</key>
<string></string>
<key>performZoom:</key>
<string></string>
<key>recentFilesDummy:</key>
<string></string>
<key>redo:</key>
<string></string>
<key>selectAll:</key>
<string></string>
<key>selectNextWindow:</key>
<string></string>
<key>selectPreviousWindow:</key>
<string></string>
<key>showVimHelp:</key>
<string></string>
<key>terminate:</key>
<string></string>
<key>undo:</key>
<string></string>
<key>unhide:</key>
<string></string>
<key>unhideAllApplications:</key>
<string></string>
<key>zoomAll:</key>
<string></string>
</dict>
</plist>
+43
View File
@@ -0,0 +1,43 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* 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.
*/
#import <Cocoa/Cocoa.h>
#import <Security/Authorization.h>
@interface AuthorizedShellCommand : NSObject {
NSArray *commands;
AuthorizationRef authorizationRef;
}
// Pass an array of dictionaries. Each dictionary has to have the following
// keys:
//
// * MMCommand: The command to execute, an NSString (e.g. @"/usr/bin/rm").
// * MMArguments: An array of NSStrings, the arguments that are passed to
// the command.
//
- (AuthorizedShellCommand *)initWithCommands:(NSArray *)theCommands;
// Runs the command passed in the constructor.
- (OSStatus)run;
// This pops up the permission dialog. Called by run.
- (OSStatus)askUserForPermission;
@end
extern NSString *MMCommand;
extern NSString *MMArguments;
+156
View File
@@ -0,0 +1,156 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* 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.
*/
/*
* AuthorizedCommand
*
* Runs a set of shell commands which may require authorization. Displays a
* gui dialog to ask the user for authorized access.
*/
#import "AuthorizedShellCommand.h"
#import <Security/AuthorizationTags.h>
@implementation AuthorizedShellCommand
- (AuthorizedShellCommand *)initWithCommands:(NSArray *)theCommands
{
if (![super init])
return nil;
commands = [theCommands retain];
return self;
}
- (void)dealloc
{
[super dealloc];
[commands release];
}
- (OSStatus)run
{
OSStatus err;
int i;
const char** arguments = NULL;
AuthorizationFlags flags = kAuthorizationFlagDefaults;
err = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
flags, &authorizationRef);
if (err != errAuthorizationSuccess)
return err;
if ((err = [self askUserForPermission]) != errAuthorizationSuccess) {
goto cleanup;
}
NSEnumerator* myIterator = [commands objectEnumerator];
NSDictionary* currCommand;
while (currCommand = [myIterator nextObject])
{
/* do something useful with currCommand */
FILE *ioPipe = NULL;
char junk[256];
const char* toolPath = [[currCommand objectForKey:MMCommand] UTF8String];
NSArray* argumentStrings = [currCommand objectForKey:MMArguments];
arguments = (const char**)malloc(
([argumentStrings count] + 1) * sizeof(char*));
for (i = 0; i < [argumentStrings count]; ++i) {
arguments[i] = [[argumentStrings objectAtIndex:i] UTF8String];
}
arguments[i] = NULL;
err = AuthorizationExecuteWithPrivileges (authorizationRef, toolPath,
kAuthorizationFlagDefaults, (char*const*)arguments, &ioPipe);
if (err != errAuthorizationSuccess)
goto cleanup;
#if 0
// We use the pipe to signal us when the command has completed
char *p;
do {
p = fgets(junk, sizeof(junk), ioPipe);
} while (p);
#else
for(;;)
{
int bytesRead = read (fileno (ioPipe),
junk, sizeof (junk));
if (bytesRead < 1) break;
write (fileno (stdout), junk, bytesRead);
}
#endif
if (arguments != NULL) {
free(arguments);
arguments = NULL;
}
fclose(ioPipe);
}
cleanup:
AuthorizationFree(authorizationRef, kAuthorizationFlagDefaults);
authorizationRef = 0;
if (arguments != NULL)
free(arguments);
return err;
}
- (OSStatus)askUserForPermission
{
int i;
assert(authorizationRef != 0);
// The documentation for AuthorizationItem says that `value` should be
// the path to the full posix path for kAuthorizationRightExecute. But
// the installer sample "Calling a Privileged Installer" sets it to NULL.
// Gotta love Apple's documentation.
//
// If you don't set `value` correctly, you'll get an
// `errAuthorizationToolEnvironmentError` when you try to execute the
// command.
AuthorizationItem* authItems =
malloc([commands count] * sizeof(AuthorizationItem));
for (i = 0; i < [commands count]; ++i) {
authItems[i].name = kAuthorizationRightExecute;
authItems[i].value = (void*)
[[[commands objectAtIndex:i] objectForKey:MMCommand] UTF8String];
authItems[i].valueLength = strlen(authItems[i].value);
authItems[i].flags = 0;
}
AuthorizationRights rights = {
[commands count], authItems
};
OSStatus err = AuthorizationCopyRights(authorizationRef, &rights, NULL,
kAuthorizationFlagInteractionAllowed |
kAuthorizationFlagPreAuthorize |
kAuthorizationFlagExtendRights
, NULL);
free(authItems);
return err;
}
@end
NSString *MMCommand = @"MMCommand";
NSString *MMArguments = @"MMArguments";
+21 -15
View File
@@ -1,32 +1,34 @@
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf440
{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fswiss\fcharset77 Helvetica-Oblique;
}
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf270
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\vieww9000\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\f0\b\fs24 \cf0 VIM - Vi IMproved
\f1\b0 \
\b0 \
\f2\i Bram Moolenaar et al.
\f1\i0 \
\i Bram Moolenaar et al.
\i0 \
\
\f0\b MacVim GUI\
\b MacVim GUI\
\f2\i\b0 Bj\'9arn Winckler\
\i\b0 Bj\'f6rn Winckler\
\f1\i0 \
\i0 \
with the help of:\
\f2\i Nico Weber (full-screen editing, Sparkle support, ...)\
George Harker (transparency, ...)\
\i Nico Weber\
George Harker\
Jjgod Jiang\
Tim Allen\
Chris Willmore\
Ben Schmidt\
Scott Renfro\
Enno L\'fcbbers\
\f1\i0 \
...and many others who have helped by reporting bugs or otherwise.\
\i0 \
...and many others who have helped by reporting bugs etc.\
\
\
Thank you to {\field{\*\fldinst{HYPERLINK "http://www.positivespinmedia.com"}}{\fldrslt Positive Spin Media}} for the PSMTabBarControl Framework.\
@@ -35,6 +37,10 @@ Toolbar icons from {\field{\*\fldinst{HYPERLINK "http://svn.gnome.org/viewvc/gno
\
Vim icons made by {\field{\*\fldinst{HYPERLINK "http://www.cs.princeton.edu/~mtwebb/vim_icon/vim_icons.html"}}{\fldrslt Matthew Webb}}.\
\
The default font in MacVim, DejaVu Sans Mono, is based on the Bitstream Vera\'aa and Arev fonts. Bitstream Vera\'aa is \'a9 2003 by Bitstream, Inc. Arev is \'a9 2006 by Tavmjong Bah. The DejaVu changes to these fonts are in the public domain.\
The default font in MacVim, DejaVu Sans Mono, is based on the Bitstream Vera\'99 and Arev fonts. Bitstream Vera\'99 is \'a9 2003 by Bitstream, Inc. Arev is \'a9 2006 by Tavmjong Bah. The DejaVu changes to these fonts are in the public domain.\
\
Thanks to Andy Matuschak for {\field{\*\fldinst{HYPERLINK "http://sparkle.andymatuschak.org/"}}{\fldrslt Sparkle}}.}
Thanks to Andy Matuschak for {\field{\*\fldinst{HYPERLINK "http://sparkle.andymatuschak.org/"}}{\fldrslt Sparkle}}.\
\
Thanks to Dave Batton for {\field{\*\fldinst{HYPERLINK "http://www.mere-mortal-software.com/blog/details.php?d=2007-03-11&c=show"}}{\fldrslt DBPrefsWindowController}}.\
\
Thanks to Allan Odgaard for making the "Edit in TextMate" input manager source code available, and also to Chris Eidhof and Eelco Lempsink for modifying it so that it could be used with any ODB capable editor.}
+77
View File
@@ -0,0 +1,77 @@
//
// DBPrefsWindowController.h
//
// Created by Dave Batton
// http://www.Mere-Mortal-Software.com/blog/
//
// Documentation for this class is available here:
// http://www.mere-mortal-software.com/blog/details.php?d=2007-03-11
//
// Copyright 2007. Some rights reserved.
// This work is licensed under a Creative Commons license:
// http://creativecommons.org/licenses/by/3.0/
//
// 11 March 2007 : Initial 1.0 release
// 15 March 2007 : Version 1.1
// Resizing is now handled along with the cross-fade by
// the NSViewAnimation routine.
// Cut the fade time in half to speed up the window resize.
// -setupToolbar is now called each time the window opens so
// you can configure it differently each time if you want.
// Holding down the shift key will now slow down the animation.
// This can be disabled by using the new -setShiftSlowsAnimation:
// method.
// 23 March 2007 : Version 1.1.1
// The initial first responder now gets set when the view is
// swapped so that the user can tab to the objects displayed
// in the window.
// Also added a work-around to Cocoa's insistance on drawing
// a focus ring around the first toolbar icon when going from
// a view with a focusable item to a view without a focusable item.
//
// 31 May 2007 : Version 1.1.2
// The window's title bar and toolbar heights are now calculated at
// runtime, rather than being hard-coded.
// Fixed a redraw problem and a window placement problem associated
// with large preference windows.
// Added some code to supress compiler warnings from unused parameters.
// Fixed a couple of objects that weren't being properly released.
//
#import <Cocoa/Cocoa.h>
@interface DBPrefsWindowController : NSWindowController {
NSMutableArray *toolbarIdentifiers;
NSMutableDictionary *toolbarViews;
NSMutableDictionary *toolbarItems;
BOOL _crossFade;
BOOL _shiftSlowsAnimation;
NSView *contentSubview;
NSViewAnimation *viewAnimation;
NSString *currentPaneIdentifier;
}
+ (DBPrefsWindowController *)sharedPrefsWindowController;
+ (NSString *)nibName;
- (void)setupToolbar;
- (void)addView:(NSView *)view label:(NSString *)label;
- (void)addView:(NSView *)view label:(NSString *)label image:(NSImage *)image;
- (BOOL)crossFade;
- (void)setCrossFade:(BOOL)fade;
- (BOOL)shiftSlowsAnimation;
- (void)setShiftSlowsAnimation:(BOOL)slows;
- (void)displayViewForIdentifier:(NSString *)identifier animate:(BOOL)animate;
- (void)crossFadeView:(NSView *)oldView withView:(NSView *)newView;
- (NSRect)frameForView:(NSView *)view;
@end
+431
View File
@@ -0,0 +1,431 @@
//
// DBPrefsWindowController.m
//
#import "DBPrefsWindowController.h"
static DBPrefsWindowController *_sharedPrefsWindowController = nil;
@implementation DBPrefsWindowController
#pragma mark -
#pragma mark Class Methods
+ (DBPrefsWindowController *)sharedPrefsWindowController
{
if (!_sharedPrefsWindowController) {
_sharedPrefsWindowController = [[self alloc] initWithWindowNibName:[self nibName]];
}
return _sharedPrefsWindowController;
}
+ (NSString *)nibName
// Subclasses can override this to use a nib with a different name.
{
return @"Preferences";
}
#pragma mark -
#pragma mark Setup & Teardown
- (id)initWithWindow:(NSWindow *)window
// -initWithWindow: is the designated initializer for NSWindowController.
{
self = [super initWithWindow:nil];
if (self != nil) {
// Set up an array and some dictionaries to keep track
// of the views we'll be displaying.
toolbarIdentifiers = [[NSMutableArray alloc] init];
toolbarViews = [[NSMutableDictionary alloc] init];
toolbarItems = [[NSMutableDictionary alloc] init];
// Set up an NSViewAnimation to animate the transitions.
viewAnimation = [[NSViewAnimation alloc] init];
[viewAnimation setAnimationBlockingMode:NSAnimationNonblocking];
[viewAnimation setAnimationCurve:NSAnimationEaseInOut];
[viewAnimation setDelegate:self];
[self setCrossFade:YES];
[self setShiftSlowsAnimation:YES];
}
return self;
(void)window; // To prevent compiler warnings.
}
- (void)windowDidLoad
{
// Create a new window to display the preference views.
// If the developer attached a window to this controller
// in Interface Builder, it gets replaced with this one.
NSPanel *window = [[[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,1000,1000)
styleMask:(NSTitledWindowMask |
NSClosableWindowMask)
backing:NSBackingStoreBuffered
defer:YES] autorelease];
[window setHidesOnDeactivate:NO];
[self setWindow:window];
contentSubview = [[[NSView alloc] initWithFrame:[[[self window] contentView] frame]] autorelease];
[contentSubview setAutoresizingMask:(NSViewMinYMargin | NSViewWidthSizable)];
[[[self window] contentView] addSubview:contentSubview];
[[self window] setShowsToolbarButton:NO];
}
- (void) dealloc {
[toolbarIdentifiers release];
[toolbarViews release];
[toolbarItems release];
[viewAnimation release];
[super dealloc];
}
#pragma mark -
#pragma mark Configuration
- (void)setupToolbar
{
// Subclasses must override this method to add items to the
// toolbar by calling -addView:label: or -addView:label:image:.
}
- (void)addView:(NSView *)view label:(NSString *)label
{
[self addView:view
label:label
image:[NSImage imageNamed:label]];
}
- (void)addView:(NSView *)view label:(NSString *)label image:(NSImage *)image
{
NSAssert (view != nil,
@"Attempted to add a nil view when calling -addView:label:image:.");
NSString *identifier = [[label copy] autorelease];
[toolbarIdentifiers addObject:identifier];
[toolbarViews setObject:view forKey:identifier];
NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:identifier] autorelease];
[item setLabel:label];
[item setImage:image];
[item setTarget:self];
[item setAction:@selector(toggleActivePreferenceView:)];
[toolbarItems setObject:item forKey:identifier];
}
#pragma mark -
#pragma mark Accessor Methods
- (BOOL)crossFade
{
return _crossFade;
}
- (void)setCrossFade:(BOOL)fade
{
_crossFade = fade;
}
- (BOOL)shiftSlowsAnimation
{
return _shiftSlowsAnimation;
}
- (void)setShiftSlowsAnimation:(BOOL)slows
{
_shiftSlowsAnimation = slows;
}
- (NSString *)currentPaneIdentifier
// Subclasses can override this to persist the current preference pane.
{
return currentPaneIdentifier;
}
- (void)setCurrentPaneIdentifier:(NSString *)identifier
// Subclasses can override this to persist the current preference pane.
{
currentPaneIdentifier = identifier;
}
#pragma mark -
#pragma mark Overriding Methods
- (IBAction)showWindow:(id)sender
{
// This forces the resources in the nib to load.
(void)[self window];
// Clear the last setup and get a fresh one.
[toolbarIdentifiers removeAllObjects];
[toolbarViews removeAllObjects];
[toolbarItems removeAllObjects];
[self setupToolbar];
NSAssert (([toolbarIdentifiers count] > 0),
@"No items were added to the toolbar in -setupToolbar.");
if ([[self window] toolbar] == nil) {
NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@"DBPreferencesToolbar"];
[toolbar setAllowsUserCustomization:NO];
[toolbar setAutosavesConfiguration:NO];
[toolbar setSizeMode:NSToolbarSizeModeDefault];
[toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
[toolbar setDelegate:self];
[[self window] setToolbar:toolbar];
[toolbar release];
}
if ([toolbarItems objectForKey:[self currentPaneIdentifier]] == nil) {
[self setCurrentPaneIdentifier:[toolbarIdentifiers objectAtIndex:0]];
}
[[[self window] toolbar]
setSelectedItemIdentifier:[self currentPaneIdentifier]];
[self displayViewForIdentifier:[self currentPaneIdentifier] animate:NO];
[[self window] center];
[super showWindow:sender];
}
#pragma mark -
#pragma mark Toolbar
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar
{
return toolbarIdentifiers;
(void)toolbar;
}
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar
{
return toolbarIdentifiers;
(void)toolbar;
}
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{
return toolbarIdentifiers;
(void)toolbar;
}
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)identifier willBeInsertedIntoToolbar:(BOOL)willBeInserted
{
return [toolbarItems objectForKey:identifier];
(void)toolbar;
(void)willBeInserted;
}
- (void)toggleActivePreferenceView:(NSToolbarItem *)toolbarItem
{
[self displayViewForIdentifier:[toolbarItem itemIdentifier] animate:YES];
[self setCurrentPaneIdentifier:[toolbarItem itemIdentifier]];
}
- (void)displayViewForIdentifier:(NSString *)identifier animate:(BOOL)animate
{
// Find the view we want to display.
NSView *newView = [toolbarViews objectForKey:identifier];
// See if there are any visible views.
NSView *oldView = nil;
if ([[contentSubview subviews] count] > 0) {
// Get a list of all of the views in the window. Usually at this
// point there is just one visible view. But if the last fade
// hasn't finished, we need to get rid of it now before we move on.
NSEnumerator *subviewsEnum = [[contentSubview subviews] reverseObjectEnumerator];
// The first one (last one added) is our visible view.
oldView = [subviewsEnum nextObject];
// Remove any others.
NSView *reallyOldView = nil;
while ((reallyOldView = [subviewsEnum nextObject]) != nil) {
[reallyOldView removeFromSuperviewWithoutNeedingDisplay];
}
}
if (![newView isEqualTo:oldView]) {
NSRect frame = [newView bounds];
frame.origin.y = NSHeight([contentSubview frame]) - NSHeight([newView bounds]);
[newView setFrame:frame];
[contentSubview addSubview:newView];
[[self window] setInitialFirstResponder:newView];
if (animate && [self crossFade])
[self crossFadeView:oldView withView:newView];
else {
[oldView removeFromSuperviewWithoutNeedingDisplay];
[newView setHidden:NO];
[[self window] setFrame:[self frameForView:newView] display:YES animate:animate];
}
[[self window] setTitle:[[toolbarItems objectForKey:identifier] label]];
}
}
#pragma mark -
#pragma mark Cross-Fading Methods
- (void)crossFadeView:(NSView *)oldView withView:(NSView *)newView
{
[viewAnimation stopAnimation];
if ([self shiftSlowsAnimation] && [[[self window] currentEvent] modifierFlags] & NSShiftKeyMask)
[viewAnimation setDuration:1.25];
else
[viewAnimation setDuration:0.25];
NSDictionary *fadeOutDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
oldView, NSViewAnimationTargetKey,
NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey,
nil];
NSDictionary *fadeInDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
newView, NSViewAnimationTargetKey,
NSViewAnimationFadeInEffect, NSViewAnimationEffectKey,
nil];
NSDictionary *resizeDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
[self window], NSViewAnimationTargetKey,
[NSValue valueWithRect:[[self window] frame]], NSViewAnimationStartFrameKey,
[NSValue valueWithRect:[self frameForView:newView]], NSViewAnimationEndFrameKey,
nil];
NSArray *animationArray = [NSArray arrayWithObjects:
fadeOutDictionary,
fadeInDictionary,
resizeDictionary,
nil];
[viewAnimation setViewAnimations:animationArray];
[viewAnimation startAnimation];
}
- (void)animationDidEnd:(NSAnimation *)animation
{
NSView *subview;
// Get a list of all of the views in the window. Hopefully
// at this point there are two. One is visible and one is hidden.
NSEnumerator *subviewsEnum = [[contentSubview subviews] reverseObjectEnumerator];
// This is our visible view. Just get past it.
subview = [subviewsEnum nextObject];
// Remove everything else. There should be just one, but
// if the user does a lot of fast clicking, we might have
// more than one to remove.
while ((subview = [subviewsEnum nextObject]) != nil) {
[subview removeFromSuperviewWithoutNeedingDisplay];
}
// This is a work-around that prevents the first
// toolbar icon from becoming highlighted.
[[self window] makeFirstResponder:nil];
(void)animation;
}
- (NSRect)frameForView:(NSView *)view
// Calculate the window size for the new view.
{
NSRect windowFrame = [[self window] frame];
NSRect contentRect = [[self window] contentRectForFrameRect:windowFrame];
float windowTitleAndToolbarHeight = NSHeight(windowFrame) - NSHeight(contentRect);
windowFrame.size.height = NSHeight([view frame]) + windowTitleAndToolbarHeight;
windowFrame.size.width = NSWidth([view frame]);
windowFrame.origin.y = NSMaxY([[self window] frame]) - NSHeight(windowFrame);
return windowFrame;
}
@end
+20
View File
@@ -15,12 +15,20 @@
<string>id</string>
<key>newWindow</key>
<string>id</string>
<key>openWebsite</key>
<string>id</string>
<key>orderFrontPreferencePanel</key>
<string>id</string>
<key>selectNextWindow</key>
<string>id</string>
<key>selectPreviousWindow</key>
<string>id</string>
<key>showHelp</key>
<string>id</string>
<key>showVimHelp</key>
<string>id</string>
<key>zoomAll</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>MMAppController</string>
@@ -29,9 +37,21 @@
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSMenu</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>_cycleWindows</key>
<string>id</string>
<key>_cycleWindowsBackwards</key>
<string>id</string>
<key>addNewTab</key>
<string>id</string>
</dict>
+2 -4
View File
@@ -9,11 +9,9 @@
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>57</integer>
</array>
<array/>
<key>IBSystem Version</key>
<string>9B18</string>
<string>9D34</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
Binary file not shown.
+57 -11
View File
@@ -1,11 +1,57 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
CLASS = MMPreferenceController;
LANGUAGE = ObjC;
SUPERCLASS = NSWindowController;
}
);
IBVersion = 1;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBClasses</key>
<array>
<dict>
<key>ACTIONS</key>
<dict>
<key>installOdb</key>
<string>id</string>
<key>uninstallOdb</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>MMPreferenceController</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>editors</key>
<string>NSPopUpButton</string>
<key>generalPreferences</key>
<string>NSView</string>
<key>installOdbButton</key>
<string>NSButton</string>
<key>integrationPreferences</key>
<string>NSView</string>
<key>obdBundleVersionLabel</key>
<string>NSTextField</string>
<key>uninstallOdbButton</key>
<string>NSButton</string>
</dict>
<key>SUPERCLASS</key>
<string>DBPrefsWindowController</string>
</dict>
<dict>
<key>CLASS</key>
<string>FirstResponder</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
<string>DBPrefsWindowController</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSWindowController</string>
</dict>
</array>
<key>IBVersion</key>
<string>1</string>
</dict>
</plist>
+11 -21
View File
@@ -1,31 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>69 14 356 240 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>489.0</string>
<key>IBGroupedObjects</key>
<dict>
<key>0</key>
<array>
<string>79</string>
<string>40</string>
</array>
<key>2</key>
<array>
<string>71</string>
<string>37</string>
</array>
</dict>
<key>IBLastGroupID</key>
<string>3</string>
<string>629</string>
<key>IBLastKnownRelativeProjectPath</key>
<string>../../MacVim.xcodeproj</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
<integer>191</integer>
<integer>115</integer>
</array>
<key>IBSystem Version</key>
<string>8S165</string>
<string>9C31</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

+45 -1
View File
@@ -4,6 +4,35 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<!--
Both UTExportedTypeDeclarations (for Spotlight and QuickLook) and
CFBundleDocumentTypes seem to be required, even though they contain
more or less the same information:
http://lists.apple.com/archives/Spotlight-dev/2007/Jul/msg00019.html
-->
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.text</string>
<string>public.plain-text</string>
</array>
<key>UTTypeDescription</key>
<string>vim script file</string>
<key>UTTypeIdentifier</key>
<string>org.vim.vim</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>TEXT</string>
<key>public.filename-extension</key>
<array>
<string>vim</string>
</array>
</dict>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
@@ -484,6 +513,21 @@
<string>com.sun.java-class</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>patch</string>
<string>diff</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm</string>
<key>CFBundleTypeName</key>
<string>Patch File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
@@ -530,7 +574,7 @@
<key>CFBundleSignature</key>
<string>VIMM</string>
<key>CFBundleVersion</key>
<string>21</string>
<string>31</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

+11 -2
View File
@@ -16,20 +16,29 @@
@interface MMAppController : NSObject <MMAppProtocol> {
NSConnection *connection;
NSMutableArray *vimControllers;
NSString *openSelectionString;
ATSFontContainerRef fontContainerRef;
NSMutableDictionary *pidArguments;
NSMenu *defaultMainMenu;
NSMenuItem *appMenuItemTemplate;
NSMenuItem *recentFilesMenuItem;
}
+ (MMAppController *)sharedInstance;
- (NSMenu *)defaultMainMenu;
- (NSMenuItem *)appMenuItemTemplate;
- (void)removeVimController:(id)controller;
- (void)windowControllerWillOpen:(MMWindowController *)windowController;
- (void)setMainMenu:(NSMenu *)mainMenu;
- (IBAction)newWindow:(id)sender;
- (IBAction)fileOpen:(id)sender;
- (IBAction)selectNextWindow:(id)sender;
- (IBAction)selectPreviousWindow:(id)sender;
- (IBAction)fontSizeUp:(id)sender;
- (IBAction)fontSizeDown:(id)sender;
- (IBAction)orderFrontPreferencePanel:(id)sender;
- (IBAction)openWebsite:(id)sender;
- (IBAction)showVimHelp:(id)sender;
- (IBAction)zoomAll:(id)sender;
@end
+488 -151
View File
@@ -13,7 +13,7 @@
* MMAppController is the delegate of NSApp and as such handles file open
* requests, application termination, etc. It sets up a named NSConnection on
* which it listens to incoming connections from Vim processes. It also
* coordinates all MMVimControllers.
* coordinates all MMVimControllers and takes care of the main menu.
*
* A new Vim process is started by calling launchVimProcessWithArguments:.
* When the Vim process is initialized it notifies the app controller by
@@ -24,12 +24,24 @@
* A Vim process started from the command line connects directly by sending the
* connectBackend:pid: message (launchVimProcessWithArguments: is never called
* in this case).
*
* The main menu is handled as follows. Each Vim controller keeps its own main
* menu. All menus except the "MacVim" menu are controlled by the Vim process.
* The app controller also keeps a reference to the "default main menu" which
* is set up in MainMenu.nib. When no editor window is open the default main
* menu is used. When a new editor window becomes main its main menu becomes
* the new main menu, this is done in -[MMAppController setMainMenu:].
* NOTE: Certain heuristics are used to find the "MacVim", "Windows", "File",
* and "Services" menu. If MainMenu.nib changes these heuristics may have to
* change as well. For specifics see the find... methods defined in the NSMenu
* category "MMExtras".
*/
#import "MMAppController.h"
#import "MMVimController.h"
#import "MMWindowController.h"
#import "MMPreferenceController.h"
#import <unistd.h>
#define MM_HANDLE_XCODE_MOD_EVENT 0
@@ -40,6 +52,12 @@
static NSTimeInterval MMRequestTimeout = 5;
static NSTimeInterval MMReplyTimeout = 5;
static NSString *MMWebsiteString = @"http://code.google.com/p/macvim/";
// When terminating, notify Vim processes then sleep for these many
// microseconds.
static useconds_t MMTerminationSleepPeriod = 10000;
#pragma options align=mac68k
typedef struct
@@ -54,6 +72,9 @@ typedef struct
#pragma options align=reset
static int executeInLoginShell(NSString *path, NSArray *args);
@interface MMAppController (MMServices)
- (void)openSelection:(NSPasteboard *)pboard userData:(NSString *)userData
error:(NSString **)error;
@@ -80,15 +101,24 @@ typedef struct
- (void)passArguments:(NSDictionary *)args toVimController:(MMVimController*)vc;
@end
@interface NSMenu (MMExtras)
- (void)recurseSetAutoenablesItems:(BOOL)on;
@end
@interface NSNumber (MMExtras)
- (int)tag;
@end
@interface NSMenu (MMExtras)
- (int)indexOfItemWithAction:(SEL)action;
- (NSMenuItem *)itemWithAction:(SEL)action;
- (NSMenu *)findMenuContainingItemWithAction:(SEL)action;
- (NSMenu *)findWindowsMenu;
- (NSMenu *)findApplicationMenu;
- (NSMenu *)findServicesMenu;
- (NSMenu *)findFileMenu;
@end
@implementation MMAppController
@@ -115,6 +145,10 @@ typedef struct
[NSNumber numberWithInt:MMUntitledWindowAlways],
MMUntitledWindowKey,
[NSNumber numberWithBool:NO], MMTexturedWindowKey,
[NSNumber numberWithBool:NO], MMZoomBothKey,
@"", MMLoginShellCommandKey,
@"", MMLoginShellArgumentKey,
[NSNumber numberWithBool:YES], MMDialogsTrackPwdKey,
nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
@@ -131,24 +165,30 @@ typedef struct
vimControllers = [NSMutableArray new];
pidArguments = [NSMutableDictionary new];
// NOTE: Do not use the default connection since the Logitech Control
// Center (LCC) input manager steals and this would cause MacVim to
// never open any windows. (This is a bug in LCC but since they are
// unlikely to fix it, we graciously give them the default connection.)
connection = [[NSConnection alloc] initWithReceivePort:[NSPort port]
sendPort:nil];
[connection setRootObject:self];
[connection setRequestTimeout:MMRequestTimeout];
[connection setReplyTimeout:MMReplyTimeout];
// NOTE: When the user is resizing the window the AppKit puts the run
// loop in event tracking mode. Unless the connection listens to
// request in this mode, live resizing won't work.
[connection addRequestMode:NSEventTrackingRunLoopMode];
// NOTE! If the name of the connection changes here it must also be
// updated in MMBackend.m.
NSConnection *connection = [NSConnection defaultConnection];
NSString *name = [NSString stringWithFormat:@"%@-connection",
[[NSBundle mainBundle] bundleIdentifier]];
//NSLog(@"Registering connection with name '%@'", name);
if ([connection registerName:name]) {
[connection setRequestTimeout:MMRequestTimeout];
[connection setReplyTimeout:MMReplyTimeout];
[connection setRootObject:self];
// NOTE: When the user is resizing the window the AppKit puts the
// run loop in event tracking mode. Unless the connection listens
// to request in this mode, live resizing won't work.
[connection addRequestMode:NSEventTrackingRunLoopMode];
} else {
NSLog(@"WARNING: Failed to register connection with name '%@'",
if (![connection registerName:name]) {
NSLog(@"FATAL ERROR: Failed to register connection with name '%@'",
name);
[connection release]; connection = nil;
}
}
@@ -159,23 +199,65 @@ typedef struct
{
//NSLog(@"MMAppController dealloc");
[connection release]; connection = nil;
[pidArguments release]; pidArguments = nil;
[vimControllers release]; vimControllers = nil;
[openSelectionString release]; openSelectionString = nil;
[recentFilesMenuItem release]; recentFilesMenuItem = nil;
[defaultMainMenu release]; defaultMainMenu = nil;
[appMenuItemTemplate release]; appMenuItemTemplate = nil;
[super dealloc];
}
#if MM_HANDLE_XCODE_MOD_EVENT
- (void)applicationWillFinishLaunching:(NSNotification *)notification
{
// Remember the default menu so that it can be restored if the user closes
// all editor windows.
defaultMainMenu = [[NSApp mainMenu] retain];
// Store a copy of the default app menu so we can use this as a template
// for all other menus. We make a copy here because the "Services" menu
// will not yet have been populated at this time. If we don't we get
// problems trying to set key equivalents later on because they might clash
// with items on the "Services" menu.
appMenuItemTemplate = [defaultMainMenu itemAtIndex:0];
appMenuItemTemplate = [appMenuItemTemplate copy];
// Set up the "Open Recent" menu. See
// http://lapcatsoftware.com/blog/2007/07/10/
// working-without-a-nib-part-5-open-recent-menu/
// and
// http://www.cocoabuilder.com/archive/message/cocoa/2007/8/15/187793
// for more information.
//
// The menu itself is created in MainMenu.nib but we still seem to have to
// hack around a bit to get it to work. (This has to be done in
// applicationWillFinishLaunching at the latest, otherwise it doesn't
// work.)
NSMenu *fileMenu = [defaultMainMenu findFileMenu];
if (fileMenu) {
int idx = [fileMenu indexOfItemWithAction:@selector(fileOpen:)];
if (idx >= 0 && idx+1 < [fileMenu numberOfItems])
recentFilesMenuItem = [fileMenu itemWithTitle:@"Open Recent"];
[[recentFilesMenuItem submenu] performSelector:@selector(_setMenuName:)
withObject:@"NSRecentDocumentsMenu"];
// Note: The "Recent Files" menu must be moved around since there is no
// -[NSApp setRecentFilesMenu:] method. We keep a reference to it to
// facilitate this move (see setMainMenu: below).
[recentFilesMenuItem retain];
}
#if MM_HANDLE_XCODE_MOD_EVENT
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
andSelector:@selector(handleXcodeModEvent:replyEvent:)
forEventClass:'KAHL'
andEventID:'MOD '];
}
#endif
}
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
@@ -252,6 +334,16 @@ typedef struct
[arguments setObject:filenames forKey:@"filenames"];
[arguments setObject:[NSNumber numberWithBool:YES] forKey:@"openFiles"];
// Add file names to "Recent Files" menu.
int i, count = [filenames count];
for (i = 0; i < count; ++i) {
// Don't add files that are being edited remotely (using ODB).
if ([arguments objectForKey:@"remoteID"]) continue;
[[NSDocumentController sharedDocumentController]
noteNewRecentFilePath:[filenames objectAtIndex:i]];
}
if ((openInTabs && (vc = [self topmostVimController]))
|| (vc = [self findUntitledWindow])) {
// Open files in an already open window.
@@ -273,6 +365,13 @@ typedef struct
pid = [self launchVimProcessWithArguments:fileArgs];
if (-1 == pid) {
// TODO: Notify user of failure?
[NSApp replyToOpenOrPrint:
NSApplicationDelegateReplyFailure];
return;
}
// Make sure these files aren't opened again when
// connectBackend:pid: is called.
[arguments setObject:[NSNumber numberWithBool:NO]
@@ -324,11 +423,16 @@ typedef struct
if (modifiedBuffers) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSWarningAlertStyle];
[alert addButtonWithTitle:@"Quit"];
[alert addButtonWithTitle:@"Cancel"];
[alert setMessageText:@"Quit without saving?"];
[alert setInformativeText:@"There are modified buffers, "
"if you quit now all changes will be lost. Quit anyway?"];
[alert addButtonWithTitle:NSLocalizedString(@"Quit",
@"Dialog button")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel",
@"Dialog button")];
[alert setMessageText:NSLocalizedString(@"Quit without saving?",
@"Quit dialog with changed buffers, title")];
[alert setInformativeText:NSLocalizedString(
@"There are modified buffers, "
"if you quit now all changes will be lost. Quit anyway?",
@"Quit dialog with changed buffers, text")];
if ([alert runModal] != NSAlertFirstButtonReturn)
reply = NSTerminateCancel;
@@ -355,24 +459,35 @@ typedef struct
if (numWindows > 1 || numTabs > 1) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSWarningAlertStyle];
[alert addButtonWithTitle:@"Quit"];
[alert addButtonWithTitle:@"Cancel"];
[alert setMessageText:@"Are you sure you want to quit MacVim?"];
[alert addButtonWithTitle:NSLocalizedString(@"Quit",
@"Dialog button")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel",
@"Dialog button")];
[alert setMessageText:NSLocalizedString(
@"Are you sure you want to quit MacVim?",
@"Quit dialog with no changed buffers, title")];
NSString *info = nil;
if (numWindows > 1) {
if (numTabs > numWindows)
info = [NSString stringWithFormat:@"There are %d windows "
"open in MacVim, with a total of %d tabs. Do you want "
"to quit anyway?", numWindows, numTabs];
info = [NSString stringWithFormat:NSLocalizedString(
@"There are %d windows open in MacVim, with a "
"total of %d tabs. Do you want to quit anyway?",
@"Quit dialog with no changed buffers, text"),
numWindows, numTabs];
else
info = [NSString stringWithFormat:@"There are %d windows "
"open in MacVim. Do you want to quit anyway?",
info = [NSString stringWithFormat:NSLocalizedString(
@"There are %d windows open in MacVim. "
"Do you want to quit anyway?",
@"Quit dialog with no changed buffers, text"),
numWindows];
} else {
info = [NSString stringWithFormat:@"There are %d tabs open "
"in MacVim. Do you want to quit anyway?", numTabs];
info = [NSString stringWithFormat:NSLocalizedString(
@"There are %d tabs open in MacVim. "
"Do you want to quit anyway?",
@"Quit dialog with no changed buffers, text"),
numTabs];
}
[alert setInformativeText:info];
@@ -392,6 +507,11 @@ typedef struct
id vc;
while ((vc = [e nextObject]))
[vc sendMessage:TerminateNowMsgID data:nil];
// Give Vim processes a chance to terminate before MacVim. If they
// haven't terminated by the time applicationWillTerminate: is sent,
// they may be forced to quit (see below).
usleep(MMTerminationSleepPeriod);
}
return reply;
@@ -405,9 +525,9 @@ typedef struct
andEventID:'MOD '];
#endif
// This will invalidate all connections (since they were spawned from the
// default connection).
[[NSConnection defaultConnection] invalidate];
// This will invalidate all connections (since they were spawned from this
// connection).
[connection invalidate];
// Send a SIGINT to all running Vim processes, so that they are sure to
// receive the connectionDidDie: notification (a process has to be checking
@@ -428,6 +548,24 @@ typedef struct
[NSApp setDelegate:nil];
}
+ (MMAppController *)sharedInstance
{
// Note: The app controller is a singleton which is instantiated in
// MainMenu.nib where it is also connected as the delegate of NSApp.
id delegate = [NSApp delegate];
return [delegate isKindOfClass:self] ? (MMAppController*)delegate : nil;
}
- (NSMenu *)defaultMainMenu
{
return defaultMainMenu;
}
- (NSMenuItem *)appMenuItemTemplate
{
return appMenuItemTemplate;
}
- (void)removeVimController:(id)controller
{
//NSLog(@"%s%@", _cmd, controller);
@@ -437,31 +575,24 @@ typedef struct
[vimControllers removeObject:controller];
if (![vimControllers count]) {
// Turn on autoenabling of menus (because no Vim is open to handle it),
// but do not touch the MacVim menu. Note that the menus must be
// enabled first otherwise autoenabling does not work.
NSMenu *mainMenu = [NSApp mainMenu];
int i, count = [mainMenu numberOfItems];
for (i = 1; i < count; ++i) {
NSMenuItem *item = [mainMenu itemAtIndex:i];
[item setEnabled:YES];
[[item submenu] recurseSetAutoenablesItems:YES];
}
// The last editor window just closed so restore the main menu back to
// its default state (which is defined in MainMenu.nib).
[self setMainMenu:defaultMainMenu];
}
}
- (void)windowControllerWillOpen:(MMWindowController *)windowController
{
NSPoint topLeft = NSZeroPoint;
NSWindow *keyWin = [NSApp keyWindow];
NSWindow *topWin = [[[self topmostVimController] windowController] window];
NSWindow *win = [windowController window];
if (!win) return;
// If there is a key window, cascade from it, otherwise use the autosaved
// window position (if any).
if (keyWin) {
NSRect frame = [keyWin frame];
// If there is a window belonging to a Vim process, cascade from it,
// otherwise use the autosaved window position (if any).
if (topWin) {
NSRect frame = [topWin frame];
topLeft = NSMakePoint(frame.origin.x, NSMaxY(frame));
} else {
NSString *topLeftString = [[NSUserDefaults standardUserDefaults]
@@ -471,7 +602,7 @@ typedef struct
}
if (!NSEqualPoints(topLeft, NSZeroPoint)) {
if (keyWin)
if (topWin)
topLeft = [win cascadeTopLeftFromPoint:topLeft];
[win setFrameTopLeftPoint:topLeft];
@@ -489,6 +620,69 @@ typedef struct
}
}
- (void)setMainMenu:(NSMenu *)mainMenu
{
if ([NSApp mainMenu] == mainMenu) return;
// If the new menu has a "Recent Files" dummy item, then swap the real item
// for the dummy. We are forced to do this since Cocoa initializes the
// "Recent Files" menu and there is no way to simply point Cocoa to a new
// item each time the menus are swapped.
NSMenu *fileMenu = [mainMenu findFileMenu];
if (recentFilesMenuItem && fileMenu) {
int dummyIdx =
[fileMenu indexOfItemWithAction:@selector(recentFilesDummy:)];
if (dummyIdx >= 0) {
NSMenuItem *dummyItem = [[fileMenu itemAtIndex:dummyIdx] retain];
[fileMenu removeItemAtIndex:dummyIdx];
NSMenu *recentFilesParentMenu = [recentFilesMenuItem menu];
int idx = [recentFilesParentMenu indexOfItem:recentFilesMenuItem];
if (idx >= 0) {
[[recentFilesMenuItem retain] autorelease];
[recentFilesParentMenu removeItemAtIndex:idx];
[recentFilesParentMenu insertItem:dummyItem atIndex:idx];
}
[fileMenu insertItem:recentFilesMenuItem atIndex:dummyIdx];
[dummyItem release];
}
}
// Now set the new menu. Notice that we keep one menu for each editor
// window since each editor can have its own set of menus. When swapping
// menus we have to tell Cocoa where the new "MacVim", "Windows", and
// "Services" menu are.
[NSApp setMainMenu:mainMenu];
// Setting the "MacVim" (or "Application") menu ensures that it is typeset
// in boldface. (The setAppleMenu: method used to be public but is now
// private so this will have to be considered a bit of a hack!)
NSMenu *appMenu = [mainMenu findApplicationMenu];
[NSApp performSelector:@selector(setAppleMenu:) withObject:appMenu];
NSMenu *servicesMenu = [mainMenu findServicesMenu];
[NSApp setServicesMenu:servicesMenu];
NSMenu *windowsMenu = [mainMenu findWindowsMenu];
if (windowsMenu) {
// Cocoa isn't clever enough to get rid of items it has added to the
// "Windows" menu so we have to do it ourselves otherwise there will be
// multiple menu items for each window in the "Windows" menu.
// This code assumes that the only items Cocoa add are ones which
// send off the action makeKeyAndOrderFront:. (Cocoa will not add
// another separator item if the last item on the "Windows" menu
// already is a separator, so we needen't worry about separators.)
int i, count = [windowsMenu numberOfItems];
for (i = count-1; i >= 0; --i) {
NSMenuItem *item = [windowsMenu itemAtIndex:i];
if ([item action] == @selector(makeKeyAndOrderFront:))
[windowsMenu removeItem:item];
}
}
[NSApp setWindowsMenu:windowsMenu];
}
- (IBAction)newWindow:(id)sender
{
[self launchVimProcessWithArguments:nil];
@@ -496,10 +690,17 @@ typedef struct
- (IBAction)fileOpen:(id)sender
{
NSString *dir = nil;
BOOL trackPwd = [[NSUserDefaults standardUserDefaults]
boolForKey:MMDialogsTrackPwdKey];
if (trackPwd) {
MMVimController *vc = [self keyVimController];
if (vc) dir = [[vc vimState] objectForKey:@"pwd"];
}
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection:YES];
int result = [panel runModalForTypes:nil];
int result = [panel runModalForDirectory:dir file:nil types:nil];
if (NSOKButton == result)
[self application:NSApp openFiles:[panel filenames]];
}
@@ -547,21 +748,27 @@ typedef struct
}
}
- (IBAction)fontSizeUp:(id)sender
{
[[NSFontManager sharedFontManager] modifyFont:
[NSNumber numberWithInt:NSSizeUpFontAction]];
}
- (IBAction)fontSizeDown:(id)sender
{
[[NSFontManager sharedFontManager] modifyFont:
[NSNumber numberWithInt:NSSizeDownFontAction]];
}
- (IBAction)orderFrontPreferencePanel:(id)sender
{
[[MMPreferenceController sharedPreferenceController] showWindow:self];
[[MMPreferenceController sharedPrefsWindowController] showWindow:self];
}
- (IBAction)openWebsite:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:
[NSURL URLWithString:MMWebsiteString]];
}
- (IBAction)showVimHelp:(id)sender
{
// Open a new window with the help window maximized.
[self launchVimProcessWithArguments:[NSArray arrayWithObjects:
@"-c", @":h gui_mac", @"-c", @":res", nil]];
}
- (IBAction)zoomAll:(id)sender
{
[NSApp makeWindowsPerform:@selector(performZoom:) inOrder:YES];
}
- (byref id <MMFrontendProtocol>)
@@ -577,7 +784,8 @@ typedef struct
setProtocolForProxy:@protocol(MMBackendProtocol)];
vc = [[[MMVimController alloc]
initWithBackend:backend pid:pid] autorelease];
initWithBackend:backend pid:pid]
autorelease];
if (![vimControllers count]) {
// The first window autosaves its position. (The autosaving
@@ -719,9 +927,10 @@ typedef struct
- (MMVimController *)topmostVimController
{
NSArray *windows = [NSApp orderedWindows];
if ([windows count] > 0) {
NSWindow *window = [windows objectAtIndex:0];
// Find the topmost visible window which has an associated vim controller.
NSEnumerator *e = [[NSApp orderedWindows] objectEnumerator];
id window;
while ((window = [e nextObject]) && [window isVisible]) {
unsigned i, count = [vimControllers count];
for (i = 0; i < count; ++i) {
MMVimController *vc = [vimControllers objectAtIndex:i];
@@ -735,68 +944,43 @@ typedef struct
- (int)launchVimProcessWithArguments:(NSArray *)args
{
NSString *taskPath = nil;
NSArray *taskArgs = nil;
int pid = -1;
NSString *path = [[NSBundle mainBundle] pathForAuxiliaryExecutable:@"Vim"];
if (!path) {
NSLog(@"ERROR: Vim executable could not be found inside app bundle!");
return 0;
return -1;
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:MMLoginShellKey]) {
// Run process with a login shell
// $SHELL -l -c "exec Vim -g -f args"
// (-g for GUI, -f for foreground, i.e. don't fork)
NSArray *taskArgs = [NSArray arrayWithObjects:@"-g", @"-f", nil];
if (args)
taskArgs = [taskArgs arrayByAddingObjectsFromArray:args];
NSMutableString *execArg = [NSMutableString
stringWithFormat:@"exec \"%@\" -g -f", path];
if (args) {
// Append all arguments while making sure that arguments containing
// spaces are enclosed in quotes.
NSCharacterSet *space = [NSCharacterSet whitespaceCharacterSet];
unsigned i, count = [args count];
for (i = 0; i < count; ++i) {
NSString *arg = [args objectAtIndex:i];
if (NSNotFound != [arg rangeOfCharacterFromSet:space].location)
[execArg appendFormat:@" \"%@\"", arg];
else
[execArg appendFormat:@" %@", arg];
}
}
// Launch the process with a login shell so that users environment
// settings get sourced. This does not always happen when MacVim is
// started.
taskArgs = [NSArray arrayWithObjects:@"-l", @"-c", execArg, nil];
taskPath = [[[NSProcessInfo processInfo] environment]
objectForKey:@"SHELL"];
if (!taskPath)
taskPath = @"/bin/sh";
BOOL useLoginShell = [[NSUserDefaults standardUserDefaults]
boolForKey:MMLoginShellKey];
if (useLoginShell) {
// Run process with a login shell, roughly:
// echo "exec Vim -g -f args" | ARGV0=-`basename $SHELL` $SHELL [-l]
pid = executeInLoginShell(path, taskArgs);
} else {
// Run process directly:
// Vim -g -f args
// (-g for GUI, -f for foreground, i.e. don't fork)
taskPath = path;
taskArgs = [NSArray arrayWithObjects:@"-g", @"-f", nil];
if (args)
taskArgs = [taskArgs arrayByAddingObjectsFromArray:args];
NSTask *task = [NSTask launchedTaskWithLaunchPath:path
arguments:taskArgs];
pid = task ? [task processIdentifier] : -1;
}
NSTask *task =[NSTask launchedTaskWithLaunchPath:taskPath
arguments:taskArgs];
//NSLog(@"launch %@ with args=%@ (pid=%d)", taskPath, taskArgs,
// [task processIdentifier]);
int pid = [task processIdentifier];
// If the process has no arguments, then add a null argument to the
// pidArguments dictionary. This is later used to detect that a process
// without arguments is being launched.
if (!args)
[pidArguments setObject:[NSNull null]
forKey:[NSNumber numberWithInt:pid]];
if (-1 != pid) {
// NOTE: If the process has no arguments, then add a null argument to
// the pidArguments dictionary. This is later used to detect that a
// process without arguments is being launched.
if (!args)
[pidArguments setObject:[NSNull null]
forKey:[NSNumber numberWithInt:pid]];
} else {
NSLog(@"WARNING: %s%@ failed (useLoginShell=%d)", _cmd, args,
useLoginShell);
}
return pid;
}
@@ -821,18 +1005,23 @@ typedef struct
if (firstMissingFile) {
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:@"OK"];
[alert addButtonWithTitle:NSLocalizedString(@"OK",
@"Dialog button")];
NSString *text;
if ([files count] >= count-1) {
[alert setMessageText:@"File not found"];
text = [NSString stringWithFormat:@"Could not open file with "
"name %@.", firstMissingFile];
[alert setMessageText:NSLocalizedString(@"File not found",
@"File not found dialog, title")];
text = [NSString stringWithFormat:NSLocalizedString(
@"Could not open file with name %@.",
@"File not found dialog, text"), firstMissingFile];
} else {
[alert setMessageText:@"Multiple files not found"];
text = [NSString stringWithFormat:@"Could not open file with "
"name %@, and %d other files.", firstMissingFile,
count-[files count]-1];
[alert setMessageText:NSLocalizedString(@"Multiple files not found",
@"File not found dialog, title")];
text = [NSString stringWithFormat:NSLocalizedString(
@"Could not open file with name %@, and %d other files.",
@"File not found dialog, text"),
firstMissingFile, count-[files count]-1];
}
[alert setInformativeText:text];
@@ -964,6 +1153,8 @@ typedef struct
// TODO: This is a moronic test...should query the Vim process if there
// are any open buffers or something like that instead.
NSString *title = [[[vc windowController] window] title];
// TODO: this will not work in a localized MacVim
if ([title hasPrefix:@"[No Name] - VIM"]) {
//NSLog(@"found untitled window");
return vc;
@@ -1070,31 +1261,177 @@ typedef struct
@implementation NSMenu (MMExtras)
- (void)recurseSetAutoenablesItems:(BOOL)on
{
[self setAutoenablesItems:on];
int i, count = [self numberOfItems];
for (i = 0; i < count; ++i) {
NSMenuItem *item = [self itemAtIndex:i];
[item setEnabled:YES];
NSMenu *submenu = [item submenu];
if (submenu) {
[submenu recurseSetAutoenablesItems:on];
}
}
}
@end // NSMenu (MMExtras)
@implementation NSNumber (MMExtras)
- (int)tag
{
return [self intValue];
}
@end // NSNumber (MMExtras)
@implementation NSMenu (MMExtras)
- (int)indexOfItemWithAction:(SEL)action
{
int i, count = [self numberOfItems];
for (i = 0; i < count; ++i) {
NSMenuItem *item = [self itemAtIndex:i];
if ([item action] == action)
return i;
}
return -1;
}
- (NSMenuItem *)itemWithAction:(SEL)action
{
int idx = [self indexOfItemWithAction:action];
return idx >= 0 ? [self itemAtIndex:idx] : nil;
}
- (NSMenu *)findMenuContainingItemWithAction:(SEL)action
{
// NOTE: We only look for the action in the submenus of 'self'
int i, count = [self numberOfItems];
for (i = 0; i < count; ++i) {
NSMenu *menu = [[self itemAtIndex:i] submenu];
NSMenuItem *item = [menu itemWithAction:action];
if (item) return menu;
}
return nil;
}
- (NSMenu *)findWindowsMenu
{
return [self findMenuContainingItemWithAction:
@selector(performMiniaturize:)];
}
- (NSMenu *)findApplicationMenu
{
// TODO: Just return [self itemAtIndex:0]?
return [self findMenuContainingItemWithAction:@selector(terminate:)];
}
- (NSMenu *)findServicesMenu
{
// NOTE! Our heuristic for finding the "Services" menu is to look for the
// second item before the "Hide MacVim" menu item on the "MacVim" menu.
// (The item before "Hide MacVim" should be a separator, but this is not
// important as long as the item before that is the "Services" menu.)
NSMenu *appMenu = [self findApplicationMenu];
if (!appMenu) return nil;
int idx = [appMenu indexOfItemWithAction: @selector(hide:)];
if (idx-2 < 0) return nil; // idx == -1, if selector not found
return [[appMenu itemAtIndex:idx-2] submenu];
}
- (NSMenu *)findFileMenu
{
return [self findMenuContainingItemWithAction:@selector(performClose:)];
}
@end // NSMenu (MMExtras)
static int
executeInLoginShell(NSString *path, NSArray *args)
{
// Start a login shell and execute the command 'path' with arguments 'args'
// in the shell. This ensures that user environment variables are set even
// when MacVim was started from the Finder.
int pid = -1;
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
// Determine which shell to use to execute the command. The user
// may decide which shell to use by setting a user default or the
// $SHELL environment variable.
NSString *shell = [ud stringForKey:MMLoginShellCommandKey];
if (!shell || [shell length] == 0)
shell = [[[NSProcessInfo processInfo] environment]
objectForKey:@"SHELL"];
if (!shell)
shell = @"/bin/bash";
//NSLog(@"shell = %@", shell);
// Bash needs the '-l' flag to launch a login shell. The user may add
// flags by setting a user default.
NSString *shellArgument = [ud stringForKey:MMLoginShellArgumentKey];
if (!shellArgument || [shellArgument length] == 0) {
if ([[shell lastPathComponent] isEqual:@"bash"])
shellArgument = @"-l";
else
shellArgument = nil;
}
//NSLog(@"shellArgument = %@", shellArgument);
// Build input string to pipe to the login shell.
NSMutableString *input = [NSMutableString stringWithFormat:
@"exec \"%@\"", path];
if (args) {
// Append all arguments, making sure they are properly quoted, even
// when they contain single quotes.
NSEnumerator *e = [args objectEnumerator];
id obj;
while ((obj = [e nextObject])) {
NSMutableString *arg = [NSMutableString stringWithString:obj];
[arg replaceOccurrencesOfString:@"'" withString:@"'\"'\"'"
options:NSLiteralSearch
range:NSMakeRange(0, [arg length])];
[input appendFormat:@" '%@'", arg];
}
}
// Build the argument vector used to start the login shell.
NSString *shellArg0 = [NSString stringWithFormat:@"-%@",
[shell lastPathComponent]];
char *shellArgv[3] = { (char *)[shellArg0 UTF8String], NULL, NULL };
if (shellArgument)
shellArgv[1] = (char *)[shellArgument UTF8String];
// Get the C string representation of the shell path before the fork since
// we must not call Foundation functions after a fork.
const char *shellPath = [shell fileSystemRepresentation];
// Fork and execute the process.
int ds[2];
if (pipe(ds)) return -1;
pid = fork();
if (pid == -1) {
return -1;
} else if (pid == 0) {
// Child process
if (close(ds[1]) == -1) exit(255);
if (dup2(ds[0], 0) == -1) exit(255);
execv(shellPath, shellArgv);
// Never reached unless execv fails
exit(255);
} else {
// Parent process
if (close(ds[0]) == -1) return -1;
// Send input to execute to the child process
[input appendString:@"\n"];
int bytes = [input lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (write(ds[1], [input UTF8String], bytes) != bytes) return -1;
if (close(ds[1]) == -1) return -1;
}
return pid;
}
+11 -1
View File
@@ -23,10 +23,14 @@ enum { MMMaxCellsPerChar = 2 };
NSFont *font;
float linespace;
// From NSTextView
NSSize insetSize;
// From vim-cocoa
NSImage *contentImage;
NSSize imageSize;
ATSUStyle atsuStyles[MMMaxCellsPerChar];
BOOL antialias;
}
- (id)initWithFrame:(NSRect)frame;
@@ -50,10 +54,11 @@ enum { MMMaxCellsPerChar = 2 };
//
// MMTextView methods
//
- (NSEvent *)lastMouseDownEvent;
- (void)setShouldDrawInsertionPoint:(BOOL)on;
- (void)setPreEditRow:(int)row column:(int)col;
- (void)hideMarkedTextField;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)state;
//
// NSTextView methods
@@ -63,6 +68,11 @@ enum { MMMaxCellsPerChar = 2 };
- (void)doCommandBySelector:(SEL)selector;
- (BOOL)performKeyEquivalent:(NSEvent *)event;
//
// NSTextContainer methods
//
- (void)setTextContainerInset:(NSSize)inset;
//
// MMAtsuiTextView methods
//
+203 -44
View File
@@ -27,6 +27,8 @@
#import "MMAtsuiTextView.h"
#import "MMVimController.h"
#import "MMWindowController.h"
#import "MMAppController.h"
#import "MacVim.h"
@@ -65,11 +67,14 @@ enum {
- (void)updateAtsuStyles;
- (void)dispatchKeyEvent:(NSEvent *)event;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags;
- (void)hideMouseCursor;
- (MMWindowController *)windowController;
- (MMVimController *)vimController;
@end
@interface MMAtsuiTextView (Drawing)
- (NSPoint)originForRow:(int)row column:(int)column;
- (NSRect)rectFromRow:(int)row1 column:(int)col1
toRow:(int)row2 column:(int)col2;
- (NSSize)textAreaSize;
@@ -91,6 +96,8 @@ enum {
- (void)clearAll;
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color;
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
numColumns:(int)ncols;
@end
@@ -105,6 +112,11 @@ enum {
cellSize.width = cellSize.height = 1;
contentImage = nil;
imageSize = NSZeroSize;
insetSize = NSZeroSize;
// NOTE: If the default changes to 'NO' then the intialization of
// p_antialias in option.c must change as well.
antialias = YES;
[self initAtsuStyles];
}
@@ -152,17 +164,21 @@ enum {
}
}
- (void)setTextContainerInset:(NSSize)size
{
insetSize = size;
}
- (NSRect)rectForRowsInRange:(NSRange)range
{
// TODO: Add text inset to origin
NSRect rect = { 0, 0, 0, 0 };
unsigned start = range.location > maxRows ? maxRows : range.location;
unsigned length = range.length;
if (start+length > maxRows)
if (start + length > maxRows)
length = maxRows - start;
rect.origin.y = cellSize.height * start;
rect.origin.y = cellSize.height * start + insetSize.height;
rect.size.height = cellSize.height * length;
return rect;
@@ -170,7 +186,6 @@ enum {
- (NSRect)rectForColumnsInRange:(NSRange)range
{
// TODO: Add text inset to origin
NSRect rect = { 0, 0, 0, 0 };
unsigned start = range.location > maxColumns ? maxColumns : range.location;
unsigned length = range.length;
@@ -178,7 +193,7 @@ enum {
if (start+length > maxColumns)
length = maxColumns - start;
rect.origin.x = cellSize.width * start;
rect.origin.x = cellSize.width * start + insetSize.width;
rect.size.width = cellSize.width * length;
return rect;
@@ -236,11 +251,6 @@ enum {
- (NSEvent *)lastMouseDownEvent
{
return nil;
}
- (void)setShouldDrawInsertionPoint:(BOOL)on
{
}
@@ -253,6 +263,15 @@ enum {
{
}
- (void)setMouseShape:(int)shape
{
}
- (void)setAntialias:(BOOL)state
{
antialias = state;
}
@@ -317,8 +336,7 @@ enum {
}
}
// TODO: Support 'mousehide' (check p_mh)
[NSCursor setHiddenUntilMouseMoves:YES];
[self hideMouseCursor];
// NOTE: 'string' is either an NSString or an NSAttributedString. Since we
// do not support attributes, simply pass the corresponding NSString in the
@@ -390,20 +408,18 @@ enum {
&& !(116 == [event keyCode] || 121 == [event keyCode]))
return NO;
// HACK! KeyCode 50 represent the key which switches between windows
// within an application (like Cmd+Tab is used to switch between
// applications). Return NO here, else the window switching does not work.
if ([event keyCode] == 50)
return NO;
// HACK! Let the main menu try to handle any key down event, before
// passing it on to vim, otherwise key equivalents for menus will
// effectively be disabled.
if ([[NSApp mainMenu] performKeyEquivalent:event])
return YES;
// HACK! KeyCode 50 represent the key which switches between windows
// within an application (like Cmd+Tab is used to switch between
// applications). Return NO here, else the window switching does not work.
//
// Will this hack work for all languages / keyboard layouts?
if ([event keyCode] == 50)
return NO;
// HACK! On Leopard Ctrl-key events end up here instead of keyDown:.
if (flags & NSControlKeyMask) {
[self keyDown:event];
@@ -458,8 +474,14 @@ enum {
- (void)drawRect:(NSRect)rect
{
[contentImage drawInRect: rect
fromRect: rect
NSRect srcRect = NSMakeRect(0, 0, imageSize.width, imageSize.height);
NSRect dstRect = srcRect;
dstRect.origin.x += insetSize.width;
dstRect.origin.y += insetSize.height;
[contentImage drawInRect: dstRect
fromRect: srcRect
operation: NSCompositeCopy
fraction: 1.0];
}
@@ -579,6 +601,24 @@ enum {
[self drawInsertionPointAtRow:row column:col shape:shape
fraction:percent
color:[NSColor colorWithRgbInt:color]];
} else if (DrawInvertedRectDrawType == type) {
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int nr = *((int*)bytes); bytes += sizeof(int);
int nc = *((int*)bytes); bytes += sizeof(int);
/*int invert = *((int*)bytes);*/ bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw inverted rect: row=%d col=%d nrows=%d ncols=%d",
row, col, nr, nc);
#endif
[self drawInvertedRectAtRow:row column:col numRows:nr
numColumns:nc];
} else if (SetCursorPosDrawType == type) {
// TODO: This is used for Voice Over support in MMTextView,
// MMAtsuiTextView currently does not support Voice Over.
/*cursorRow = *((int*)bytes);*/ bytes += sizeof(int);
/*cursorCol = *((int*)bytes);*/ bytes += sizeof(int);
} else {
NSLog(@"WARNING: Unknown draw type (type=%d)", type);
}
@@ -599,7 +639,6 @@ enum {
- (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size
{
// TODO:
// - Take text area inset into consideration
// - Rounding errors may cause size change when there should be none
// - Desired rows/columns shold not be 'too small'
@@ -611,18 +650,20 @@ enum {
if (size.height != desiredSize.height) {
float fh = cellSize.height;
float ih = 2 * insetSize.height;
if (fh < 1.0f) fh = 1.0f;
desiredRows = floor(size.height/fh);
desiredSize.height = fh*desiredRows;
desiredRows = floor((size.height - ih)/fh);
desiredSize.height = fh*desiredRows + ih;
}
if (size.width != desiredSize.width) {
float fw = cellSize.width;
float iw = 2 * insetSize.width;
if (fw < 1.0f) fw = 1.0f;
desiredCols = floor(size.width/fw);
desiredSize.width = fw*desiredCols;
desiredCols = floor((size.width - iw)/fw);
desiredSize.width = fw*desiredCols + iw;
}
if (rows) *rows = desiredRows;
@@ -635,17 +676,15 @@ enum {
{
// Compute the size the text view should be for the entire text area and
// inset area to be visible with the present number of rows and columns.
//
// TODO: Add inset area to size.
return NSMakeSize(maxColumns*cellSize.width, maxRows*cellSize.height);
return NSMakeSize(maxColumns * cellSize.width + 2 * insetSize.width,
maxRows * cellSize.height + 2 * insetSize.height);
}
- (NSSize)minSize
{
// Compute the smallest size the text view is allowed to be.
//
// TODO: Add inset area to size.
return NSMakeSize(MMMinColumns*cellSize.width, MMMinRows*cellSize.height);
return NSMakeSize(MMMinColumns * cellSize.width + 2 * insetSize.width,
MMMinRows * cellSize.height + 2 * insetSize.height);
}
- (void)changeFont:(id)sender
@@ -698,6 +737,42 @@ enum {
[[self vimController] sendMessage:ScrollWheelMsgID data:data];
}
//
// NOTE: The menu items cut/copy/paste/undo/redo/select all/... must be bound
// to the same actions as in IB otherwise they will not work with dialogs. All
// we do here is forward these actions to the Vim process.
//
- (IBAction)cut:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)copy:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)paste:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)undo:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)redo:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)selectAll:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
@end // MMAtsuiTextView
@@ -707,8 +782,7 @@ enum {
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column
{
// TODO: text inset
NSPoint origin = { 0,0 };
NSPoint origin = { insetSize.width, insetSize.height };
if (!(cellSize.width > 0 && cellSize.height > 0))
return NO;
@@ -840,21 +914,34 @@ enum {
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:chars length:len];
// TODO: Support 'mousehide' (check p_mh)
[NSCursor setHiddenUntilMouseMoves:YES];
[self hideMouseCursor];
//NSLog(@"%s len=%d chars=0x%x", _cmd, len, chars[0]);
[[self vimController] sendMessage:KeyDownMsgID data:data];
}
}
- (MMVimController *)vimController
- (void)hideMouseCursor
{
// Check 'mousehide' option
id mh = [[[self vimController] vimState] objectForKey:@"p_mh"];
if (mh && ![mh boolValue])
[NSCursor setHiddenUntilMouseMoves:NO];
else
[NSCursor setHiddenUntilMouseMoves:YES];
}
- (MMWindowController *)windowController
{
id windowController = [[self window] windowController];
if ([windowController isKindOfClass:[MMWindowController class]])
return (MMWindowController*)windowController;
return nil;
}
// TODO: Make sure 'windowController' is a MMWindowController before type
// casting.
return [(MMWindowController*)windowController vimController];
- (MMVimController *)vimController
{
return [[self windowController] vimController];
}
@end // MMAtsuiTextView (Private)
@@ -864,10 +951,16 @@ enum {
@implementation MMAtsuiTextView (Drawing)
- (NSPoint)originForRow:(int)row column:(int)col
{
return NSMakePoint(col * cellSize.width, row * cellSize.height);
}
- (NSRect)rectFromRow:(int)row1 column:(int)col1
toRow:(int)row2 column:(int)col2
{
return NSMakeRect(col1 * cellSize.width, row1 * cellSize.height,
NSPoint origin = [self originForRow: row1 column: col1];
return NSMakeRect(origin.x, origin.y,
(col2 + 1 - col1) * cellSize.width,
(row2 + 1 - row1) * cellSize.height);
}
@@ -876,7 +969,7 @@ enum {
{
// Calculate the (desired) size of the text area, i.e. the text view area
// minus the inset area.
return NSMakeSize(maxColumns*cellSize.width, maxRows*cellSize.height);
return NSMakeSize(maxColumns * cellSize.width, maxRows * cellSize.height);
}
- (void)resizeContentImage
@@ -898,6 +991,9 @@ enum {
[contentImage unlockFocus];
}
#define atsu_style_set_bool(s, t, b) \
ATSUSetAttributes(s, 1, &t, &(sizeof(Boolean)), &&b);
- (void)drawString:(UniChar *)string length:(UniCharCount)length
atRow:(int)row column:(int)col cells:(int)cells
withFlags:(int)flags foregroundColor:(NSColor *)fg
@@ -906,9 +1002,29 @@ enum {
// 'string' consists of 'length' utf-16 code pairs and should cover 'cells'
// display cells (a normal character takes up one display cell, a wide
// character takes up two)
ATSUStyle style = atsuStyles[0];
ATSUStyle style = (flags & DRAW_WIDE) ? atsuStyles[1] : atsuStyles[0];
ATSUTextLayout layout;
// Font selection and rendering options for ATSUI
ATSUAttributeTag attribTags[3] = { kATSUQDBoldfaceTag,
kATSUQDItalicTag,
kATSUStyleRenderingOptionsTag };
ByteCount attribSizes[] = { sizeof(Boolean),
sizeof(Boolean),
sizeof(UInt32) };
Boolean useBold, useItalic;
UInt32 useAntialias;
ATSUAttributeValuePtr attribValues[3] = { &useBold, &useItalic,
&useAntialias };
useBold = (flags & DRAW_BOLD) ? true : false;
useItalic = (flags & DRAW_ITALIC) ? true : false;
useAntialias = antialias ? kATSStyleApplyAntiAliasing
: kATSStyleNoAntiAliasing;
ATSUSetAttributes(style, sizeof(attribValues) / sizeof(attribValues[0]),
attribTags, attribSizes, attribValues);
// NSLog(@"drawString: %d", length);
ATSUCreateTextLayout(&layout);
@@ -919,6 +1035,8 @@ enum {
NSRect rect = NSMakeRect(col * cellSize.width, row * cellSize.height,
length * cellSize.width, cellSize.height);
if (flags & DRAW_WIDE)
rect.size.width = rect.size.width * 2;
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
ATSUAttributeTag tags[] = { kATSUCGContextTag };
@@ -1003,6 +1121,47 @@ enum {
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color
{
NSPoint origin = [self originForRow:row column:col];
NSRect rect = NSMakeRect(origin.x, origin.y,
cellSize.width, cellSize.height);
// NSLog(@"shape = %d, fraction: %d", shape, percent);
if (MMInsertionPointHorizontal == shape) {
int frac = (cellSize.height * percent + 99)/100;
rect.origin.y += rect.size.height - frac;
rect.size.height = frac;
} else if (MMInsertionPointVertical == shape) {
int frac = (cellSize.width * percent + 99)/100;
rect.size.width = frac;
} else if (MMInsertionPointVerticalRight == shape) {
int frac = (cellSize.width * percent + 99)/100;
rect.origin.x += rect.size.width - frac;
rect.size.width = frac;
}
[color set];
if (MMInsertionPointHollow == shape) {
NSFrameRect(rect);
} else {
NSRectFill(rect);
}
}
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
numColumns:(int)ncols
{
// TODO: THIS CODE HAS NOT BEEN TESTED!
CGContextRef cgctx = [[NSGraphicsContext currentContext] graphicsPort];
CGContextSaveGState(cgctx);
CGContextSetBlendMode(cgctx, kCGBlendModeDifference);
CGContextSetRGBFillColor(cgctx, 1.0, 1.0, 1.0, 1.0);
CGRect rect = { col * cellSize.width, row * cellSize.height,
ncols * cellSize.width, nrows * cellSize.height };
CGContextFillRect(cgctx, rect);
CGContextRestoreGState(cgctx);
}
@end // MMAtsuiTextView (Drawing)
+8 -10
View File
@@ -24,6 +24,7 @@
id frontendProxy;
NSDictionary *colorDict;
NSDictionary *sysColorDict;
NSDictionary *actionDict;
BOOL inputReceived;
BOOL tabBarVisible;
unsigned backgroundColor;
@@ -54,7 +55,9 @@
- (void)setSpecialColor:(int)color;
- (void)setDefaultColorsBackground:(int)bg foreground:(int)fg;
- (NSConnection *)connection;
- (NSDictionary *)actionDict;
- (void)queueMessage:(int)msgid properties:(NSDictionary *)props;
- (BOOL)checkin;
- (BOOL)openVimWindow;
- (void)clearAll;
@@ -68,6 +71,8 @@
scrollBottom:(int)bottom left:(int)left right:(int)right;
- (void)drawCursorAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(int)color;
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nr
numColumns:(int)nc invert:(int)invert;
- (void)update;
- (void)flushQueue:(BOOL)force;
- (BOOL)waitForInput:(int)milliseconds;
@@ -82,15 +87,6 @@
saving:(int)saving;
- (int)presentDialogWithType:(int)type title:(char *)title message:(char *)msg
buttons:(char *)btns textField:(char *)txtfield;
- (void)addMenuWithTag:(int)tag parent:(int)parentTag name:(char *)name
atIndex:(int)index;
- (void)addMenuItemWithTag:(int)tag parent:(int)parentTag name:(char *)name
tip:(char *)tip icon:(char *)icon
keyEquivalent:(int)key modifiers:(int)mods
action:(NSString *)action atIndex:(int)index;
- (void)removeMenuItemWithTag:(int)tag;
- (void)enableMenuItemWithTag:(int)tag state:(int)enabled;
- (void)showPopupMenuWithName:(char *)name atMouseLocation:(BOOL)mouse;
- (void)showToolbar:(int)enable flags:(int)flags;
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type;
- (void)destroyScrollbarWithIdentifier:(long)ident;
@@ -112,9 +108,11 @@
- (int)lookupColorWithKey:(NSString *)key;
- (BOOL)hasSpecialKeyWithValue:(NSString *)value;
- (void)enterFullscreen;
- (void)enterFullscreen:(int)fuoptions background:(int)bg;
- (void)leaveFullscreen;
- (void)setAntialias:(BOOL)antialias;
- (void)updateModifiedFlag;
- (void)registerServerWithName:(NSString *)name;
+154 -213
View File
@@ -51,10 +51,12 @@ static unsigned MMServerMax = 1000;
// TODO: Move to separate file.
static int eventModifierFlagsToVimModMask(int modifierFlags);
static int vimModMaskToEventModifierFlags(int mods);
static int eventModifierFlagsToVimMouseModMask(int modifierFlags);
static int eventButtonNumberToVimMouseButton(int buttonNumber);
static int specialKeyToNSKey(int key);
// In gui_macvim.m
vimmenu_T *menu_for_descriptor(NSArray *desc);
enum {
MMBlinkStateNone = 0,
@@ -76,7 +78,10 @@ static NSString *MMSymlinkWarningString =
@interface MMBackend (Private)
- (void)waitForDialogReturn;
- (void)queueVimStateMessage;
- (void)processInputQueue;
- (void)handleInputEvent:(int)msgid data:(NSData *)data;
+ (NSDictionary *)specialKeys;
@@ -142,8 +147,12 @@ static NSString *MMSymlinkWarningString =
sysColorDict = [[NSDictionary dictionaryWithContentsOfFile:path]
retain];
if (!(colorDict && sysColorDict))
NSLog(@"ERROR: Failed to load color dictionaries.%@",
path = [mainBundle pathForResource:@"Actions" ofType:@"plist"];
if (path)
actionDict = [[NSDictionary dictionaryWithContentsOfFile:path] retain];
if (!(colorDict && sysColorDict && actionDict))
NSLog(@"ERROR: Failed to load dictionaries.%@",
MMSymlinkWarningString);
return self;
@@ -165,6 +174,7 @@ static NSString *MMSymlinkWarningString =
[drawData release]; drawData = nil;
[frontendProxy release]; frontendProxy = nil;
[connection release]; connection = nil;
[actionDict release]; actionDict = nil;
[sysColorDict release]; sysColorDict = nil;
[colorDict release]; colorDict = nil;
@@ -215,6 +225,16 @@ static NSString *MMSymlinkWarningString =
return connection;
}
- (NSDictionary *)actionDict
{
return actionDict;
}
- (void)queueMessage:(int)msgid properties:(NSDictionary *)props
{
[self queueMessage:msgid data:[props dictionaryAsData]];
}
- (BOOL)checkin
{
if (![self connection]) {
@@ -287,28 +307,29 @@ static NSString *MMSymlinkWarningString =
}
}
id proxy = [connection rootProxy];
[proxy setProtocolForProxy:@protocol(MMAppProtocol)];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification object:connection];
int pid = [[NSProcessInfo processInfo] processIdentifier];
BOOL ok = NO;
@try {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification object:connection];
id proxy = [connection rootProxy];
[proxy setProtocolForProxy:@protocol(MMAppProtocol)];
int pid = [[NSProcessInfo processInfo] processIdentifier];
frontendProxy = [proxy connectBackend:self pid:pid];
if (frontendProxy) {
[frontendProxy retain];
[frontendProxy setProtocolForProxy:@protocol(MMAppProtocol)];
ok = YES;
}
}
@catch (NSException *e) {
NSLog(@"Exception caught when trying to connect backend: \"%@\"", e);
}
if (frontendProxy) {
[frontendProxy retain];
[frontendProxy setProtocolForProxy:@protocol(MMAppProtocol)];
}
return connection && frontendProxy;
return ok;
}
- (BOOL)openVimWindow
@@ -408,6 +429,19 @@ static NSString *MMSymlinkWarningString =
[drawData appendBytes:&percent length:sizeof(int)];
}
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nr
numColumns:(int)nc invert:(int)invert
{
int type = DrawInvertedRectDrawType;
[drawData appendBytes:&type length:sizeof(int)];
[drawData appendBytes:&row length:sizeof(int)];
[drawData appendBytes:&col length:sizeof(int)];
[drawData appendBytes:&nr length:sizeof(int)];
[drawData appendBytes:&nc length:sizeof(int)];
[drawData appendBytes:&invert length:sizeof(int)];
}
- (void)update
{
// Tend to the run loop, returning immediately if there are no events
@@ -428,9 +462,10 @@ static NSString *MMSymlinkWarningString =
// NOTE! This method gets called a lot; if we were to flush every time it
// got called MacVim would feel unresponsive. So there is a time out which
// ensures that the queue isn't flushed too often.
if (!force && lastFlushDate && -[lastFlushDate timeIntervalSinceNow]
< MMFlushTimeoutInterval
&& [drawData length] < MMFlushQueueLenHint)
if (exiting ||
(!force && lastFlushDate &&
-[lastFlushDate timeIntervalSinceNow] < MMFlushTimeoutInterval &&
[drawData length] < MMFlushQueueLenHint))
return;
if ([drawData length] > 0) {
@@ -450,7 +485,12 @@ static NSString *MMSymlinkWarningString =
[drawData setLength:0];
}
if ([outputQueue count] > 0) {
if ([outputQueue count] > 0 || force) {
// When 'force' is set we always update the Vim state to ensure that
// MacVim has a copy of the latest state (since 'force' is typically
// set just before Vim takes a nap whilst waiting for input).
[self queueVimStateMessage];
@try {
[frontendProxy processCommandQueue:outputQueue];
}
@@ -614,9 +654,7 @@ static NSString *MMSymlinkWarningString =
@try {
[frontendProxy showSavePanelForDirectory:ds title:ts saving:saving];
// Wait until a reply is sent from MMVimController.
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
[self waitForDialogReturn];
if (dialogReturn && [dialogReturn isKindOfClass:[NSString class]]) {
char_u *ret = (char_u*)[dialogReturn UTF8String];
@@ -638,13 +676,18 @@ static NSString *MMSymlinkWarningString =
return (char *)s;
}
- (oneway void)setDialogReturn:(in bycopy id)obj
- (void)setDialogReturn:(in bycopy id)obj
{
// NOTE: This is called by
// - [MMVimController panelDidEnd:::], and
// - [MMVimController alertDidEnd:::],
// to indicate that a save/open panel or alert has finished.
// We want to distinguish between "no dialog return yet" and "dialog
// returned nothing". The former can be tested with dialogReturn == nil,
// the latter with dialogReturn == [NSNull null].
if (!obj) obj = [NSNull null];
if (obj != dialogReturn) {
[dialogReturn release];
dialogReturn = [obj retain];
@@ -693,9 +736,7 @@ static NSString *MMSymlinkWarningString =
informativeText:text buttonTitles:buttons
textFieldString:textFieldString];
// Wait until a reply is sent from MMVimController.
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
[self waitForDialogReturn];
if (dialogReturn && [dialogReturn isKindOfClass:[NSArray class]]
&& [dialogReturn count]) {
@@ -722,98 +763,6 @@ static NSString *MMSymlinkWarningString =
return retval;
}
- (void)addMenuWithTag:(int)tag parent:(int)parentTag name:(char *)name
atIndex:(int)index
{
//NSLog(@"addMenuWithTag:%d parent:%d name:%s atIndex:%d", tag, parentTag,
// name, index);
int namelen = name ? strlen(name) : 0;
NSMutableData *data = [NSMutableData data];
[data appendBytes:&tag length:sizeof(int)];
[data appendBytes:&parentTag length:sizeof(int)];
[data appendBytes:&namelen length:sizeof(int)];
if (namelen > 0) [data appendBytes:name length:namelen];
[data appendBytes:&index length:sizeof(int)];
[self queueMessage:AddMenuMsgID data:data];
}
- (void)addMenuItemWithTag:(int)tag parent:(int)parentTag name:(char *)name
tip:(char *)tip icon:(char *)icon
keyEquivalent:(int)key modifiers:(int)mods
action:(NSString *)action atIndex:(int)index
{
//NSLog(@"addMenuItemWithTag:%d parent:%d name:%s tip:%s atIndex:%d", tag,
// parentTag, name, tip, index);
int namelen = name ? strlen(name) : 0;
int tiplen = tip ? strlen(tip) : 0;
int iconlen = icon ? strlen(icon) : 0;
int eventFlags = vimModMaskToEventModifierFlags(mods);
int actionlen = [action lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
NSMutableData *data = [NSMutableData data];
key = specialKeyToNSKey(key);
[data appendBytes:&tag length:sizeof(int)];
[data appendBytes:&parentTag length:sizeof(int)];
[data appendBytes:&namelen length:sizeof(int)];
if (namelen > 0) [data appendBytes:name length:namelen];
[data appendBytes:&tiplen length:sizeof(int)];
if (tiplen > 0) [data appendBytes:tip length:tiplen];
[data appendBytes:&iconlen length:sizeof(int)];
if (iconlen > 0) [data appendBytes:icon length:iconlen];
[data appendBytes:&actionlen length:sizeof(int)];
if (actionlen > 0) [data appendBytes:[action UTF8String] length:actionlen];
[data appendBytes:&index length:sizeof(int)];
[data appendBytes:&key length:sizeof(int)];
[data appendBytes:&eventFlags length:sizeof(int)];
[self queueMessage:AddMenuItemMsgID data:data];
}
- (void)removeMenuItemWithTag:(int)tag
{
NSMutableData *data = [NSMutableData data];
[data appendBytes:&tag length:sizeof(int)];
[self queueMessage:RemoveMenuItemMsgID data:data];
}
- (void)enableMenuItemWithTag:(int)tag state:(int)enabled
{
NSMutableData *data = [NSMutableData data];
[data appendBytes:&tag length:sizeof(int)];
[data appendBytes:&enabled length:sizeof(int)];
[self queueMessage:EnableMenuItemMsgID data:data];
}
- (void)showPopupMenuWithName:(char *)name atMouseLocation:(BOOL)mouse
{
int len = strlen(name);
int row = -1, col = -1;
if (len <= 0) return;
if (!mouse && curwin) {
row = curwin->w_wrow;
col = curwin->w_wcol;
}
NSMutableData *data = [NSMutableData data];
[data appendBytes:&row length:sizeof(int)];
[data appendBytes:&col length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:name length:len];
[self queueMessage:ShowPopupMenuMsgID data:data];
}
- (void)showToolbar:(int)enable flags:(int)flags
{
NSMutableData *data = [NSMutableData data];
@@ -1054,9 +1003,13 @@ static NSString *MMSymlinkWarningString =
return NO;
}
- (void)enterFullscreen
- (void)enterFullscreen:(int)fuoptions background:(int)bg
{
[self queueMessage:EnterFullscreenMsgID data:nil];
NSMutableData *data = [NSMutableData data];
[data appendBytes:&fuoptions length:sizeof(int)];
bg = MM_COLOR(bg);
[data appendBytes:&bg length:sizeof(int)];
[self queueMessage:EnterFullscreenMsgID data:data];
}
- (void)leaveFullscreen
@@ -1064,6 +1017,13 @@ static NSString *MMSymlinkWarningString =
[self queueMessage:LeaveFullscreenMsgID data:nil];
}
- (void)setAntialias:(BOOL)antialias
{
int msgid = antialias ? EnableAntialiasMsgID : DisableAntialiasMsgID;
[self queueMessage:msgid data:nil];
}
- (void)updateModifiedFlag
{
// Notify MacVim if _any_ buffer has changed from unmodified to modified or
@@ -1242,6 +1202,8 @@ static NSString *MMSymlinkWarningString =
- (BOOL)starRegisterToPasteboard:(byref NSPasteboard *)pboard
{
// TODO: This method should share code with clip_mch_request_selection().
if (VIsual_active && (State & NORMAL) && clip_star.available) {
// If there is no pasteboard, return YES to indicate that there is text
// to copy.
@@ -1528,8 +1490,70 @@ static NSString *MMSymlinkWarningString =
@implementation MMBackend (Private)
- (void)waitForDialogReturn
{
// Keep processing the run loop until a dialog returns. To avoid getting
// stuck in an endless loop (could happen if the setDialogReturn: message
// was lost) we also do some paranoia checks.
//
// Note that in Cocoa the user can still resize windows and select menu
// items while a sheet is being displayed, so we can't just wait for the
// first message to arrive and assume that is the setDialogReturn: call.
while (nil == dialogReturn && !got_int && [connection isValid]
&& !isTerminating)
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
// Search for any resize messages on the input queue. All other messages
// on the input queue are dropped. The reason why we single out resize
// messages is because the user may have resized the window while a sheet
// was open.
int i, count = [inputQueue count];
if (count > 0) {
id textDimData = nil;
if (count%2 == 0) {
for (i = count-2; i >= 0; i -= 2) {
int msgid = [[inputQueue objectAtIndex:i] intValue];
if (SetTextDimensionsMsgID == msgid) {
textDimData = [[inputQueue objectAtIndex:i+1] retain];
break;
}
}
}
[inputQueue removeAllObjects];
if (textDimData) {
[inputQueue addObject:
[NSNumber numberWithInt:SetTextDimensionsMsgID]];
[inputQueue addObject:textDimData];
[textDimData release];
}
}
}
- (void)queueVimStateMessage
{
// NOTE: This is the place to add Vim state that needs to be accessed from
// MacVim. Do not add state that could potentially require lots of memory
// since this message gets sent each time the output queue is forcibly
// flushed (e.g. storing the currently selected text would be a bad idea).
// We take this approach of "pushing" the state to MacVim to avoid having
// to make synchronous calls from MacVim to Vim in order to get state.
NSDictionary *vimState = [NSDictionary dictionaryWithObjectsAndKeys:
[[NSFileManager defaultManager] currentDirectoryPath], @"pwd",
[NSNumber numberWithInt:p_mh], @"p_mh",
nil];
[self queueMessage:SetVimStateMsgID data:[vimState dictionaryAsData]];
}
- (void)processInputQueue
{
if ([inputQueue count] == 0) return;
// NOTE: One of the input events may cause this method to be called
// recursively, so copy the input queue to a local variable and clear it
// before starting to process input events (otherwise we could get stuck in
@@ -1603,14 +1627,12 @@ static NSString *MMSymlinkWarningString =
//NSLog(@"[VimTask] Resizing shell to %dx%d.", cols, rows);
gui_resize_shell(cols, rows);
} else if (ExecuteMenuMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int tag = *((int*)bytes); bytes += sizeof(int);
vimmenu_T *menu = (vimmenu_T*)tag;
// TODO! Make sure 'menu' is a valid menu pointer!
if (menu) {
gui_menu_cb(menu);
NSDictionary *attrs = [NSDictionary dictionaryWithData:data];
if (attrs) {
NSArray *desc = [attrs objectForKey:@"descriptor"];
vimmenu_T *menu = menu_for_descriptor(desc);
if (menu)
gui_menu_cb(menu);
}
} else if (ToggleToolbarMsgID == msgid) {
[self handleToggleToolbar];
@@ -2419,22 +2441,6 @@ static int eventModifierFlagsToVimModMask(int modifierFlags)
return modMask;
}
static int vimModMaskToEventModifierFlags(int mods)
{
int flags = 0;
if (mods & MOD_MASK_SHIFT)
flags |= NSShiftKeyMask;
if (mods & MOD_MASK_CTRL)
flags |= NSControlKeyMask;
if (mods & MOD_MASK_ALT)
flags |= NSAlternateKeyMask;
if (mods & MOD_MASK_CMD)
flags |= NSCommandKeyMask;
return flags;
}
static int eventModifierFlagsToVimMouseModMask(int modifierFlags)
{
int modMask = 0;
@@ -2456,68 +2462,3 @@ static int eventButtonNumberToVimMouseButton(int buttonNumber)
return (buttonNumber >= 0 && buttonNumber < 3)
? mouseButton[buttonNumber] : -1;
}
static int specialKeyToNSKey(int key)
{
if (!IS_SPECIAL(key))
return key;
static struct {
int special;
int nskey;
} sp2ns[] = {
{ K_UP, NSUpArrowFunctionKey },
{ K_DOWN, NSDownArrowFunctionKey },
{ K_LEFT, NSLeftArrowFunctionKey },
{ K_RIGHT, NSRightArrowFunctionKey },
{ K_F1, NSF1FunctionKey },
{ K_F2, NSF2FunctionKey },
{ K_F3, NSF3FunctionKey },
{ K_F4, NSF4FunctionKey },
{ K_F5, NSF5FunctionKey },
{ K_F6, NSF6FunctionKey },
{ K_F7, NSF7FunctionKey },
{ K_F8, NSF8FunctionKey },
{ K_F9, NSF9FunctionKey },
{ K_F10, NSF10FunctionKey },
{ K_F11, NSF11FunctionKey },
{ K_F12, NSF12FunctionKey },
{ K_F13, NSF13FunctionKey },
{ K_F14, NSF14FunctionKey },
{ K_F15, NSF15FunctionKey },
{ K_F16, NSF16FunctionKey },
{ K_F17, NSF17FunctionKey },
{ K_F18, NSF18FunctionKey },
{ K_F19, NSF19FunctionKey },
{ K_F20, NSF20FunctionKey },
{ K_F21, NSF21FunctionKey },
{ K_F22, NSF22FunctionKey },
{ K_F23, NSF23FunctionKey },
{ K_F24, NSF24FunctionKey },
{ K_F25, NSF25FunctionKey },
{ K_F26, NSF26FunctionKey },
{ K_F27, NSF27FunctionKey },
{ K_F28, NSF28FunctionKey },
{ K_F29, NSF29FunctionKey },
{ K_F30, NSF30FunctionKey },
{ K_F31, NSF31FunctionKey },
{ K_F32, NSF32FunctionKey },
{ K_F33, NSF33FunctionKey },
{ K_F34, NSF34FunctionKey },
{ K_F35, NSF35FunctionKey },
{ K_DEL, NSBackspaceCharacter },
{ K_BS, NSDeleteCharacter },
{ K_HOME, NSHomeFunctionKey },
{ K_END, NSEndFunctionKey },
{ K_PAGEUP, NSPageUpFunctionKey },
{ K_PAGEDOWN, NSPageDownFunctionKey }
};
int i;
for (i = 0; i < sizeof(sp2ns)/sizeof(sp2ns[0]); ++i) {
if (sp2ns[i].special == key)
return sp2ns[i].nskey;
}
return 0;
}
+14 -4
View File
@@ -1,7 +1,7 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
@@ -19,11 +19,21 @@
MMVimView *view;
NSPoint oldPosition;
NSString *oldTabBarStyle;
// These are only valid in fullscreen mode and store pre-fu vim size
int nonFuRows, nonFuColumns;
// These store the size vim had right after entering fu mode
int startFuRows, startFuColumns;
// This stores the contents of fuoptions_flags at fu start time
int startFuFlags;
}
- (MMFullscreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v;
- (MMFullscreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v
backgroundColor:(NSColor *)back;
- (void)enterFullscreen;
- (void)enterFullscreen:(int)fuoptions;
- (void)leaveFullscreen;
- (void)centerView;
+84 -5
View File
@@ -1,7 +1,7 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
@@ -23,6 +23,7 @@
* Author: Nico Weber
*/
#import "MMVimController.h"
#import "MMFullscreenWindow.h"
#import <PSMTabBarControl.h>
#import "MMVimView.h"
@@ -30,6 +31,11 @@
#import "MMWindowController.h"
#import <Carbon/Carbon.h>
// These have to be the same as in option.h
#define FUOPT_MAXVERT 0x001
#define FUOPT_MAXHORZ 0x002
#define FUOPT_BGCOLOR_HLGROUP 0x004
static int numFullscreenWindows = 0;
@@ -41,7 +47,8 @@ static int numFullscreenWindows = 0;
@implementation MMFullscreenWindow
- (MMFullscreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v
- (MMFullscreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v
backgroundColor:(NSColor *)back
{
NSScreen* screen = [t screen];
@@ -68,7 +75,7 @@ static int numFullscreenWindows = 0;
[self setHasShadow:NO];
[self setShowsResizeIndicator:NO];
[self setBackgroundColor:[NSColor blackColor]];
[self setBackgroundColor:back];
[self setReleasedWhenClosed:NO];
return self;
@@ -82,7 +89,7 @@ static int numFullscreenWindows = 0;
[super dealloc];
}
- (void)enterFullscreen
- (void)enterFullscreen:(int)fuoptions
{
[self hideDockIfAppropriate];
@@ -123,6 +130,42 @@ static int numFullscreenWindows = 0;
// focus gained message
[self setDelegate:delegate];
// resize vim view according to fuoptions
int currRows, currColumns;
[[view textView] getMaxRows:&currRows columns:&currColumns];
int fuRows = currRows, fuColumns = currColumns;
int maxRows, maxColumns;
NSSize size = [[self screen] visibleFrame].size;
[view constrainRows:&maxRows columns:&maxColumns toSize:size];
// Store current pre-fu vim size
nonFuRows = currRows;
nonFuColumns = currColumns;
// Compute current fu size
if (fuoptions & FUOPT_MAXVERT)
fuRows = maxRows;
if (fuoptions & FUOPT_MAXHORZ)
fuColumns = maxColumns;
startFuFlags = fuoptions;
// if necessary, resize vim to target fu size
if (currRows != fuRows || currColumns != fuColumns) {
int newSize[2] = { fuRows, fuColumns };
NSData *data = [NSData dataWithBytes:newSize length:2*sizeof(int)];
MMVimController *vimController =
[[self windowController] vimController];
[vimController sendMessage:SetTextDimensionsMsgID data:data];
[[view textView] setMaxRows:fuRows columns:fuColumns];
}
startFuRows = fuRows;
startFuColumns = fuColumns;
// move vim view to the window's center
[self centerView];
@@ -149,6 +192,32 @@ static int numFullscreenWindows = 0;
didBlend = YES;
}
// restore old vim view size
int currRows, currColumns;
[[view textView] getMaxRows:&currRows columns:&currColumns];
int newRows = currRows, newColumns = currColumns;
// compute desired non-fu size.
// if current fu size is equal to fu size at fu enter time,
// restore the old size
//
if (startFuFlags & FUOPT_MAXVERT && startFuRows == currRows)
newRows = nonFuRows;
if (startFuFlags & FUOPT_MAXHORZ && startFuColumns == currColumns)
newColumns = nonFuColumns;
// resize vim if necessary
if (currRows != newRows || currColumns != newColumns) {
int newSize[2] = { newRows, newColumns };
NSData *data = [NSData dataWithBytes:newSize length:2*sizeof(int)];
MMVimController *vimController =
[[self windowController] vimController];
[vimController sendMessage:SetTextDimensionsMsgID data:data];
[[view textView] setMaxRows:newRows columns:newColumns];
}
// fix up target controller
[self retain]; // NSWindowController releases us once
[[self windowController] setWindow:target];
@@ -166,6 +235,7 @@ static int numFullscreenWindows = 0;
// window.
[view removeFromSuperviewWithoutNeedingDisplay];
[[target contentView] addSubview:view];
[view setFrameOrigin:oldPosition];
[self close];
@@ -228,6 +298,15 @@ static int numFullscreenWindows = 0;
[super performClose:sender];
}
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
if ([item action] == @selector(vimMenuItemAction:)
|| [item action] == @selector(performClose:))
return [item tag];
return YES;
}
@end // MMFullscreenWindow
+17 -2
View File
@@ -9,10 +9,25 @@
*/
#import <Cocoa/Cocoa.h>
#import <DBPrefsWindowController.h>
@interface MMPreferenceController : DBPrefsWindowController {
IBOutlet NSView *generalPreferences;
IBOutlet NSView *integrationPreferences;
// Integration pane
NSDictionary *supportedOdbEditors;
IBOutlet NSPopUpButton *editors;
IBOutlet NSButton *installOdbButton;
IBOutlet NSButton *uninstallOdbButton;
IBOutlet NSTextField* obdBundleVersionLabel;
@interface MMPreferenceController : NSWindowController {
}
+ (MMPreferenceController *)sharedPreferenceController;
// Integration pane
- (IBAction)installOdb:(id)sender;
- (IBAction)uninstallOdb:(id)sender;
@end
+371 -17
View File
@@ -1,7 +1,7 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
@@ -11,27 +11,381 @@
#import "MMPreferenceController.h"
#import "MacVim.h"
#import "AuthorizedShellCommand.h"
// On Leopard, we want to use the images provided by the OS for some of the
// toolbar images (NSImageNamePreferencesGeneral and friends). We need to jump
// through some hoops to do that in a way that MacVim still _compiles_ on Tiger
// (life would be easier if we'd require Leopard for building). See
// http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html
// and http://developer.apple.com/technotes/tn2002/tn2064.html
// for how you'd do it with a Leopard build system, and see
// http://lists.cairographics.org/archives/cairo-bugs/2007-December/001818.html
// for why this doesn't work here.
// Using the system images gives us resolution independence and consistency
// with other apps.
#import <dlfcn.h>
NSString* nsImageNamePreferencesGeneral = nil;
NSString* nsImageNamePreferencesAdvanced = nil;
static void loadSymbols()
{
// use dlfcn() instead of the deprecated NSModule api.
void *ptr;
if ((ptr = dlsym(RTLD_DEFAULT, "NSImageNamePreferencesGeneral")) != NULL)
nsImageNamePreferencesGeneral = *(NSString**)ptr;
if ((ptr = dlsym(RTLD_DEFAULT, "NSImageNamePreferencesAdvanced")) != NULL)
nsImageNamePreferencesAdvanced = *(NSString**)ptr;
}
static CFStringRef ODBEDITOR = CFSTR("org.slashpunt.edit_in_odbeditor");
static CFStringRef ODB_BUNDLE_IDENTIFIER = CFSTR("ODBEditorBundleIdentifier");
static CFStringRef ODB_EDITOR_NAME = CFSTR("ODBEditorName");
static NSString *ODBEDITOR_DIR =
@"/Library/InputManagers/Edit in ODBEditor";
static NSString *ODBEDITOR_PATH =
@"/Library/InputManagers/Edit in ODBEditor/Edit in ODBEditor.bundle";
NSString *kOdbEditorNameNone = @"(None)";
NSString *kOdbEditorIdentifierNone = @"";
NSString *kOdbEditorNameBBEdit = @"BBEdit";
NSString *kOdbEditorIdentifierBBEdit = @"com.barebones.bbedit";
NSString *kOdbEditorNameCSSEdit = @"CSSEdit";
NSString *kOdbEditorIdentifierCSSEdit = @"com.macrabbit.cssedit";
NSString *kOdbEditorNameMacVim = @"MacVim";
NSString *kOdbEditorIdentifierMacVim = @"org.vim.MacVim";
NSString *kOdbEditorNameSmultron = @"Smultron";
NSString *kOdbEditorIdentifierSmultron = @"org.smultron.Smultron";
NSString *kOdbEditorNameSubEthaEdit = @"SubEthaEdit";
NSString *kOdbEditorIdentifierSubEthaEdit = @"de.codingmonkeys.SubEthaEdit";
NSString *kOdbEditorNameTextMate = @"TextMate";
NSString *kOdbEditorIdentifierTextMate = @"com.macromates.textmate";
NSString *kOdbEditorNameTextWrangler = @"TextWrangler";
NSString *kOdbEditorIdentifierTextWrangler = @"com.barebones.textwrangler";
NSString *kOdbEditorNameWriteRoom = @"WriteRoom";
NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
@interface MMPreferenceController (Private)
// Integration pane
- (void)updateIntegrationPane;
- (void)setOdbEditorByName:(NSString *)name;
- (NSString *)odbEditorBundleIdentifier;
- (NSString *)odbBundleSourceDir;
- (NSString *)versionOfBundle:(NSString *)bundlePath;
- (NSString *)odbBundleInstalledVersion;
- (NSString *)odbBundleInstallVersion;
@end
@implementation MMPreferenceController
+ (MMPreferenceController *)sharedPreferenceController
- (id)initWithWindow:(NSWindow *)window
{
static MMPreferenceController *singleton = nil;
if (!singleton)
singleton = [[MMPreferenceController alloc] init];
return singleton;
}
- (id)init
{
self = [super initWithWindowNibName:@"Preferences"];
if (!self) return nil;
[self setWindowFrameAutosaveName:@"Preferences"];
[[self window] setHidesOnDeactivate:NO];
self = [super initWithWindow:window];
if (self == nil)
return nil;
// taken from Cyberduck. Thanks :-)
supportedOdbEditors = [[NSDictionary alloc] initWithObjectsAndKeys:
kOdbEditorIdentifierNone, kOdbEditorNameNone,
kOdbEditorIdentifierBBEdit, kOdbEditorNameBBEdit,
kOdbEditorIdentifierCSSEdit, kOdbEditorNameCSSEdit,
kOdbEditorIdentifierMacVim, kOdbEditorNameMacVim,
kOdbEditorIdentifierSmultron, kOdbEditorNameSmultron,
kOdbEditorIdentifierSubEthaEdit, kOdbEditorNameSubEthaEdit,
kOdbEditorIdentifierTextMate, kOdbEditorNameTextMate,
kOdbEditorIdentifierTextWrangler, kOdbEditorNameTextWrangler,
kOdbEditorIdentifierWriteRoom, kOdbEditorNameWriteRoom,
nil];
return self;
}
- (void)dealloc
{
[supportedOdbEditors release]; supportedOdbEditors = nil;
[super dealloc];
}
- (void)awakeFromNib
{
// fill list of editors in integration pane
NSArray *keys = [[supportedOdbEditors allKeys]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSMenu *editorsMenu = [editors menu];
NSEnumerator *enumerator = [keys objectEnumerator];
NSString *key;
while ((key = [enumerator nextObject]) != nil) {
NSString *identifier = [supportedOdbEditors objectForKey:key];
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:key
action:@selector(odbEditorChanged:)
keyEquivalent:@""];
[item setTarget:self];
if (![identifier isEqualToString:kOdbEditorIdentifierNone]) {
NSString *appPath = [[NSWorkspace sharedWorkspace]
absolutePathForAppBundleWithIdentifier:identifier];
[item setEnabled:appPath != nil];
if (appPath != nil) {
NSImage *icon = [[NSWorkspace sharedWorkspace]
iconForFile:appPath];
[icon setSize:NSMakeSize(16, 16)]; // XXX: make res independent
[item setImage:icon];
}
}
[editorsMenu addItem:item];
[item release];
}
[self updateIntegrationPane];
}
- (void)setupToolbar
{
loadSymbols();
if (nsImageNamePreferencesGeneral != NULL) {
[self addView:generalPreferences
label:@"General"
image:[NSImage imageNamed:nsImageNamePreferencesGeneral]];
} else {
[self addView:generalPreferences label:@"General"];
}
[self addView:integrationPreferences label:@"Integration"];
}
- (NSString *)currentPaneIdentifier
{
// We override this to persist the current pane.
return [[NSUserDefaults standardUserDefaults]
stringForKey:MMCurrentPreferencePaneKey];
}
- (void)setCurrentPaneIdentifier:(NSString *)identifier
{
// We override this to persist the current pane.
[[NSUserDefaults standardUserDefaults]
setObject:identifier forKey:MMCurrentPreferencePaneKey];
}
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
if ([item action] == @selector(odbEditorChanged:)) {
NSString *identifier = [supportedOdbEditors objectForKey:[item title]];
if (identifier == nil)
return NO;
if ([identifier isEqualToString:kOdbEditorIdentifierNone])
return YES;
return [[NSWorkspace sharedWorkspace]
absolutePathForAppBundleWithIdentifier:identifier] != nil;
}
return YES;
}
#pragma mark -
#pragma mark Integration pane
- (void)updateIntegrationPane
{
// XXX: check validation api.
// XXX: call this each time the dialog becomes active (so that if the
// user changes settings in terminal, the changes are reflected in the
// dialog)
NSString *versionString;
// Check if ODB path exists before calling isFilePackageAtPath: otherwise
// an error is output to stderr on Tiger.
BOOL odbIsInstalled =
[[NSFileManager defaultManager] fileExistsAtPath:ODBEDITOR_PATH]
&& [[NSWorkspace sharedWorkspace] isFilePackageAtPath:ODBEDITOR_PATH];
// enable/disable buttons
[installOdbButton setTitle:@"Install"];
if (odbIsInstalled) {
[uninstallOdbButton setEnabled:YES];
[editors setEnabled:YES];
NSString *installVersion = [self odbBundleInstallVersion];
NSString *installedVersion = [self odbBundleInstalledVersion];
switch ([installedVersion compare:installVersion
options:NSNumericSearch]) {
case NSOrderedAscending:
versionString = [NSString stringWithFormat:
@"Latest version is %@, you have %@.",
installVersion, installedVersion];
[installOdbButton setTitle:@"Update"];
[installOdbButton setEnabled:YES];
break;
case NSOrderedSame:
versionString = [NSString stringWithFormat:
@"Latest version is %@. You have the latest version.",
installVersion];
[installOdbButton setEnabled:NO];
break;
case NSOrderedDescending:
versionString = [NSString stringWithFormat:
@"Latest version is %@, you have %@.",
installVersion, installedVersion];
[installOdbButton setEnabled:NO];
break;
}
} else {
[installOdbButton setEnabled:YES];
[uninstallOdbButton setEnabled:NO];
[editors setEnabled:NO];
versionString = [NSString
stringWithFormat:@"Latest version is %@. It is not installed.",
[self odbBundleInstallVersion]];
}
[obdBundleVersionLabel setStringValue:versionString];
// make sure the right editor is selected on the popup button
NSString *selectedTitle = kOdbEditorNameNone;
NSArray* keys = [supportedOdbEditors
allKeysForObject:[self odbEditorBundleIdentifier]];
if ([keys count] > 0)
selectedTitle = [keys objectAtIndex:0];
[editors selectItemWithTitle:selectedTitle];
}
- (void)setOdbEditorByName:(NSString *)name
{
NSString *identifier = [supportedOdbEditors objectForKey:name];
if (identifier != kOdbEditorIdentifierNone) {
CFPreferencesSetAppValue(ODB_BUNDLE_IDENTIFIER, identifier, ODBEDITOR);
CFPreferencesSetAppValue(ODB_EDITOR_NAME, name, ODBEDITOR);
} else {
CFPreferencesSetAppValue(ODB_BUNDLE_IDENTIFIER, NULL, ODBEDITOR);
CFPreferencesSetAppValue(ODB_EDITOR_NAME, NULL, ODBEDITOR);
}
CFPreferencesAppSynchronize(ODBEDITOR);
}
// Note that you can't compare the result of this function with ==, you have
// to use isStringEqual: (since this returns a new copy of the string).
- (NSString *)odbEditorBundleIdentifier
{
// reading the defaults of a different app is easier with carbon
NSString *bundleIdentifier = (NSString*)CFPreferencesCopyAppValue(
ODB_BUNDLE_IDENTIFIER, ODBEDITOR);
if (bundleIdentifier == nil)
return kOdbEditorIdentifierNone;
return [bundleIdentifier autorelease];
}
- (void)odbEditorChanged:(id)sender
{
[self setOdbEditorByName:[sender title]];
}
- (NSString *)odbBundleSourceDir
{
return [[[NSBundle mainBundle] resourcePath]
stringByAppendingString:@"/Edit in ODBEditor"];
}
// Returns the CFBundleVersion of a bundle. This assumes a bundle exists
// at bundlePath.
- (NSString *)versionOfBundle:(NSString *)bundlePath
{
// -[NSBundle initWithPath:] caches a bundle, so if the bundle is replaced
// with a new bundle on disk, we get the old version. So we can't use it :-(
NSString *infoPath = [bundlePath
stringByAppendingString:@"/Contents/Info.plist"];
NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:infoPath];
return [info objectForKey:@"CFBundleVersion"];
}
- (NSString *)odbBundleInstalledVersion
{
return [self versionOfBundle:ODBEDITOR_PATH];
}
- (NSString *)odbBundleInstallVersion
{
return [self versionOfBundle:[[self odbBundleSourceDir]
stringByAppendingString:@"/Edit in ODBEditor.bundle"]];
}
- (IBAction)installOdb:(id)sender
{
NSString *source = [self odbBundleSourceDir];
// It doesn't hurt to rm -rf the InputManager even if it's not there,
// the code is simpler that way.
NSArray *cmd = [NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
@"/bin/rm", MMCommand,
[NSArray arrayWithObjects:@"-rf", ODBEDITOR_DIR, nil], MMArguments,
nil],
[NSDictionary dictionaryWithObjectsAndKeys:
@"/bin/mkdir", MMCommand,
[NSArray arrayWithObjects:@"-p", ODBEDITOR_DIR, nil], MMArguments,
nil],
[NSDictionary dictionaryWithObjectsAndKeys:
@"/bin/cp", MMCommand,
[NSArray arrayWithObjects: @"-R",
source, @"/Library/InputManagers", nil], MMArguments,
nil],
[NSDictionary dictionaryWithObjectsAndKeys:
@"/usr/sbin/chown", MMCommand,
[NSArray arrayWithObjects: @"-R",
@"root:admin", @"/Library/InputManagers", nil], MMArguments,
nil],
nil
];
AuthorizedShellCommand *au = [[AuthorizedShellCommand alloc]
initWithCommands:cmd];
OSStatus err = [au run];
if (err == errAuthorizationSuccess) {
// If the user just installed the input manager and no editor was
// selected before, chances are he wants to use MacVim as editor
if ([[self odbEditorBundleIdentifier]
isEqualToString:kOdbEditorIdentifierNone]) {
[self setOdbEditorByName:kOdbEditorNameMacVim];
}
} else {
NSLog(@"Failed to install input manager, error is %d", err);
}
[au release];
[self updateIntegrationPane];
}
- (IBAction)uninstallOdb:(id)sender
{
NSArray *cmd = [NSArray arrayWithObject:
[NSDictionary dictionaryWithObjectsAndKeys:
@"/bin/rm", MMCommand,
[NSArray arrayWithObjects: @"-rf", ODBEDITOR_DIR, nil], MMArguments,
nil]];
AuthorizedShellCommand *au = [[AuthorizedShellCommand alloc]
initWithCommands:cmd];
OSStatus err = [au run];
if (err != errAuthorizationSuccess)
NSLog(@"Failed to uninstall input manager, error is %d", err);
[au release];
[self updateIntegrationPane];
}
@end
+10
View File
@@ -258,6 +258,16 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|| col+cells > maxColumns || !string || !(fg && bg && sp))
return;
BOOL hasControlChars = [string rangeOfCharacterFromSet:
[NSCharacterSet controlCharacterSet]].location != NSNotFound;
if (hasControlChars) {
// HACK! If a string for some reason contains control characters, then
// draw blanks instead (otherwise charRangeForRow::: fails).
NSRange subRange = { 0, cells };
flags &= ~DRAW_WIDE;
string = [[emptyRowString string] substringWithRange:subRange];
}
// Find range of characters in text storage to replace.
int acol = col;
int acells = cells;
+6 -4
View File
@@ -13,7 +13,6 @@
@interface MMTextView : NSTextView {
BOOL shouldDrawInsertionPoint;
NSEvent *lastMouseDownEvent;
NSTrackingRectTag trackingRectTag;
BOOL isDragging;
BOOL isAutoscrolling;
@@ -28,17 +27,20 @@
NSTextField *markedTextField;
int preEditRow;
int preEditColumn;
int mouseShape;
BOOL antialias;
NSRect *invertRects;
int numInvertRects;
}
- (id)initWithFrame:(NSRect)frame;
- (NSEvent *)lastMouseDownEvent;
- (void)setShouldDrawInsertionPoint:(BOOL)on;
- (void)setPreEditRow:(int)row column:(int)col;
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color;
- (void)hideMarkedTextField;
- (void)performBatchDrawWithData:(NSData *)data;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)antialias;
//
// MMTextStorage methods
+252 -49
View File
@@ -22,6 +22,7 @@
#import "MMWindowController.h"
#import "MMVimController.h"
#import "MMTypesetter.h"
#import "MMAppController.h"
#import "MacVim.h"
@@ -46,14 +47,23 @@ enum {
@interface MMTextView (Private)
- (void)setCursor;
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column;
- (BOOL)convertRow:(int)row column:(int)column toPoint:(NSPoint *)point;
- (BOOL)convertRow:(int)row column:(int)column numRows:(int)nr
numColumns:(int)nc toRect:(NSRect *)rect;
- (NSRect)trackingRect;
- (void)dispatchKeyEvent:(NSEvent *)event;
- (MMWindowController *)windowController;
- (MMVimController *)vimController;
- (void)startDragTimerWithInterval:(NSTimeInterval)t;
- (void)dragTimerFired:(NSTimer *)timer;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags;
- (void)hideMouseCursor;
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color;
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
numColumns:(int)ncols invert:(int)invert;
@end
@@ -110,12 +120,9 @@ enum {
return nil;
}
// Allow control of text view inset via MMTextInset* user defaults.
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
int left = [ud integerForKey:MMTextInsetLeftKey];
int top = [ud integerForKey:MMTextInsetTopKey];
[self setTextContainerInset:NSMakeSize(left, top)];
// NOTE: If the default changes to 'NO' then the intialization of
// p_antialias in option.c must change as well.
antialias = YES;
return self;
}
@@ -129,13 +136,13 @@ enum {
markedTextField = nil;
}
[lastMouseDownEvent release]; lastMouseDownEvent = nil;
[super dealloc];
}
if (invertRects) {
free(invertRects);
invertRects = NULL;
numInvertRects = 0;
}
- (NSEvent *)lastMouseDownEvent
{
return lastMouseDownEvent;
[super dealloc];
}
- (BOOL)shouldDrawInsertionPoint
@@ -158,23 +165,6 @@ enum {
preEditColumn = col;
}
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color
{
//NSLog(@"drawInsertionPointAtRow:%d column:%d shape:%d color:%@",
// row, col, shape, color);
// This only stores where to draw the insertion point, the actual drawing
// is done in drawRect:.
shouldDrawInsertionPoint = YES;
insertionPointRow = row;
insertionPointColumn = col;
insertionPointShape = shape;
insertionPointFraction = percent;
[self setInsertionPointColor:color];
}
- (void)hideMarkedTextField
{
if (markedTextField) {
@@ -305,6 +295,19 @@ enum {
[self drawInsertionPointAtRow:row column:col shape:shape
fraction:percent
color:[NSColor colorWithRgbInt:color]];
} else if (DrawInvertedRectDrawType == type) {
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int nr = *((int*)bytes); bytes += sizeof(int);
int nc = *((int*)bytes); bytes += sizeof(int);
int invert = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw inverted rect: row=%d col=%d nrows=%d ncols=%d",
row, col, nr, nc);
#endif
[self drawInvertedRectAtRow:row column:col numRows:nr numColumns:nc
invert:invert];
} else if (SetCursorPosDrawType == type) {
cursorRow = *((int*)bytes); bytes += sizeof(int);
cursorCol = *((int*)bytes); bytes += sizeof(int);
@@ -333,6 +336,17 @@ enum {
#endif
}
- (void)setMouseShape:(int)shape
{
mouseShape = shape;
[self setCursor];
}
- (void)setAntialias:(BOOL)state
{
antialias = state;
}
- (NSFont *)font
{
return [(MMTextStorage*)[self textStorage] font];
@@ -441,8 +455,29 @@ enum {
- (void)drawRect:(NSRect)rect
{
NSGraphicsContext *context = [NSGraphicsContext currentContext];
[context setShouldAntialias:antialias];
[super drawRect:rect];
if (invertRects) {
CGContextRef cgctx = (CGContextRef)[context graphicsPort];
CGContextSaveGState(cgctx);
CGContextSetBlendMode(cgctx, kCGBlendModeDifference);
CGContextSetRGBFillColor(cgctx, 1.0, 1.0, 1.0, 1.0);
int i;
CGRect *rect = (CGRect*)invertRects;
for (i = 0; i < numInvertRects; ++i)
CGContextFillRect(cgctx, rect[i]);
CGContextRestoreGState(cgctx);
free(invertRects);
invertRects = NULL;
numInvertRects = 0;
}
if (shouldDrawInsertionPoint) {
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
@@ -456,7 +491,11 @@ enum {
ipRect.origin.y += ipRect.size.height - frac;
ipRect.size.height = frac;
} else if (MMInsertionPointVertical == insertionPointShape) {
int frac = ([ts cellSize].width* insertionPointFraction + 99)/100;
int frac = ([ts cellSize].width * insertionPointFraction + 99)/100;
ipRect.size.width = frac;
} else if (MMInsertionPointVerticalRight == insertionPointShape) {
int frac = ([ts cellSize].width * insertionPointFraction + 99)/100;
ipRect.origin.x += ipRect.size.width - frac;
ipRect.size.width = frac;
}
@@ -554,8 +593,7 @@ enum {
}
}
// TODO: Support 'mousehide' (check p_mh)
[NSCursor setHiddenUntilMouseMoves:YES];
[self hideMouseCursor];
// NOTE: 'string' is either an NSString or an NSAttributedString. Since we
// do not support attributes, simply pass the corresponding NSString in the
@@ -628,20 +666,18 @@ enum {
&& !(116 == [event keyCode] || 121 == [event keyCode]))
return NO;
// HACK! KeyCode 50 represent the key which switches between windows
// within an application (like Cmd+Tab is used to switch between
// applications). Return NO here, else the window switching does not work.
if ([event keyCode] == 50)
return NO;
// HACK! Let the main menu try to handle any key down event, before
// passing it on to vim, otherwise key equivalents for menus will
// effectively be disabled.
if ([[NSApp mainMenu] performKeyEquivalent:event])
return YES;
// HACK! KeyCode 50 represent the key which switches between windows
// within an application (like Cmd+Tab is used to switch between
// applications). Return NO here, else the window switching does not work.
//
// Will this hack work for all languages / keyboard layouts?
if ([event keyCode] == 50)
return NO;
// HACK! On Leopard Ctrl-key events end up here instead of keyDown:.
if (flags & NSControlKeyMask) {
[self keyDown:event];
@@ -811,8 +847,6 @@ enum {
if (![self convertPoint:pt toRow:&row column:&col])
return;
lastMouseDownEvent = [event copy];
int button = [event buttonNumber];
int flags = [event modifierFlags];
int count = [event clickCount];
@@ -916,6 +950,11 @@ enum {
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
if (!ts) return;
// HACK! NSTextView has a nasty habit of resetting the cursor to the
// default I-beam cursor at random moments. The only reliable way we know
// of to work around this is to set the cursor each time the mouse moves.
[self setCursor];
NSPoint pt = [self convertPoint:[event locationInWindow] fromView:nil];
int row, col;
if (![self convertPoint:pt toRow:&row column:&col])
@@ -934,6 +973,8 @@ enum {
[data appendBytes:&col length:sizeof(int)];
[[self vimController] sendMessage:MouseMovedMsgID data:data];
//NSLog(@"Moved %d %d\n", col, row);
}
}
@@ -944,8 +985,9 @@ enum {
// NOTE: This event is received even when the window is not key; thus we
// have to take care not to enable mouse moved events unless our window is
// key.
if ([[self window] isKeyWindow])
if ([[self window] isKeyWindow]) {
[[self window] setAcceptsMouseMovedEvents:YES];
}
}
- (void)mouseExited:(NSEvent *)event
@@ -1099,6 +1141,54 @@ enum {
// The font panel is updated whenever the font is set.
}
//
// NOTE: The menu items cut/copy/paste/undo/redo/select all/... must be bound
// to the same actions as in IB otherwise they will not work with dialogs. All
// we do here is forward these actions to the Vim process.
//
- (IBAction)cut:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)copy:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)paste:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)undo:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)redo:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (IBAction)selectAll:(id)sender
{
[[self windowController] vimMenuItemAction:sender];
}
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
if ([item action] == @selector(cut:)
|| [item action] == @selector(copy:)
|| [item action] == @selector(paste:)
|| [item action] == @selector(undo:)
|| [item action] == @selector(redo:)
|| [item action] == @selector(selectAll:))
return [item tag];
return YES;
}
@end // MMTextView
@@ -1106,6 +1196,47 @@ enum {
@implementation MMTextView (Private)
- (void)setCursor
{
static NSCursor *customIbeamCursor = nil;
if (!customIbeamCursor) {
// Use a custom Ibeam cursor that has better contrast against dark
// backgrounds.
// TODO: Is the hotspot ok?
NSImage *ibeamImage = [NSImage imageNamed:@"ibeam"];
if (ibeamImage) {
NSSize size = [ibeamImage size];
NSPoint hotSpot = { size.width*.5f, size.height*.5f };
customIbeamCursor = [[NSCursor alloc]
initWithImage:ibeamImage hotSpot:hotSpot];
}
if (!customIbeamCursor) {
NSLog(@"WARNING: Failed to load custom Ibeam cursor");
customIbeamCursor = [NSCursor IBeamCursor];
}
}
// This switch should match mshape_names[] in misc2.c.
//
// TODO: Add missing cursor shapes.
switch (mouseShape) {
case 2: [customIbeamCursor set]; break;
case 3: case 4: [[NSCursor resizeUpDownCursor] set]; break;
case 5: case 6: [[NSCursor resizeLeftRightCursor] set]; break;
case 9: [[NSCursor crosshairCursor] set]; break;
case 10: [[NSCursor pointingHandCursor] set]; break;
case 11: [[NSCursor openHandCursor] set]; break;
default:
[[NSCursor arrowCursor] set]; break;
}
// Shape 1 indicates that the mouse cursor should be hidden.
if (1 == mouseShape)
[NSCursor setHiddenUntilMouseMoves:YES];
}
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column
{
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
@@ -1137,6 +1268,23 @@ enum {
return YES;
}
- (BOOL)convertRow:(int)row column:(int)column numRows:(int)nr
numColumns:(int)nc toRect:(NSRect *)rect
{
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
NSSize cellSize = [ts cellSize];
if (!(rect && cellSize.width > 0 && cellSize.height > 0))
return NO;
rect->origin = [self textContainerOrigin];
rect->origin.x += column * cellSize.width;
rect->origin.y += row * cellSize.height;
rect->size.width = cellSize.width * nc;
rect->size.height = cellSize.height * nr;
return YES;
}
- (NSRect)trackingRect
{
NSRect rect = [self frame];
@@ -1198,13 +1346,17 @@ enum {
[self sendKeyDown:bytes length:len modifiers:mods];
}
- (MMVimController *)vimController
- (MMWindowController *)windowController
{
id windowController = [[self window] windowController];
if ([windowController isKindOfClass:[MMWindowController class]])
return (MMWindowController*)windowController;
return nil;
}
// TODO: Make sure 'windowController' is a MMWindowController before type
// casting.
return [(MMWindowController*)windowController vimController];
- (MMVimController *)vimController
{
return [[self windowController] vimController];
}
- (void)startDragTimerWithInterval:(NSTimeInterval)t
@@ -1266,12 +1418,63 @@ enum {
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:chars length:len];
// TODO: Support 'mousehide' (check p_mh)
[NSCursor setHiddenUntilMouseMoves:YES];
[self hideMouseCursor];
//NSLog(@"%s len=%d chars=0x%x", _cmd, len, chars[0]);
[[self vimController] sendMessage:KeyDownMsgID data:data];
}
}
- (void)hideMouseCursor
{
// Check 'mousehide' option
id mh = [[[self vimController] vimState] objectForKey:@"p_mh"];
if (mh && ![mh boolValue])
[NSCursor setHiddenUntilMouseMoves:NO];
else
[NSCursor setHiddenUntilMouseMoves:YES];
}
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color
{
//NSLog(@"drawInsertionPointAtRow:%d column:%d shape:%d color:%@",
// row, col, shape, color);
// This only stores where to draw the insertion point, the actual drawing
// is done in drawRect:.
shouldDrawInsertionPoint = YES;
insertionPointRow = row;
insertionPointColumn = col;
insertionPointShape = shape;
insertionPointFraction = percent;
[self setInsertionPointColor:color];
}
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
numColumns:(int)ncols invert:(int)invert
{
if (invert) {
// The result should be inverted.
int n = numInvertRects++;
invertRects = reallocf(invertRects,
numInvertRects*sizeof(NSRect));
if (NULL != invertRects) {
[self convertRow:row column:col numRows:nrows numColumns:ncols
toRect:&invertRects[n]];
[self setNeedsDisplayInRect:invertRects[n]];
} else {
n = numInvertRects = 0;
}
} else {
// The result should look normal; all we need to do is to mark
// the rect for redrawing and Cocoa will redraw the text.
NSRect rect;
[self convertRow:row column:col numRows:nrows numColumns:ncols
toRect:&rect];
[self setNeedsDisplayInRect:rect];
}
}
@end // MMTextView (Private)
+4 -4
View File
@@ -27,9 +27,8 @@
id backendProxy;
BOOL inProcessCommandQueue;
NSMutableArray *sendQueue;
NSMutableArray *mainMenuItems;
NSMenu *mainMenu;
NSMutableArray *popupMenuItems;
BOOL shouldUpdateMainMenu;
NSToolbar *toolbar;
NSMutableDictionary *toolbarItemDict;
int pid;
@@ -39,7 +38,7 @@
int resendMsgid;
NSData *resendData;
#endif
NSMenu *lastMenuSearched;
NSDictionary *vimState;
}
- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
@@ -48,6 +47,8 @@
- (void)setServerName:(NSString *)name;
- (NSString *)serverName;
- (MMWindowController *)windowController;
- (NSDictionary *)vimState;
- (NSMenu *)mainMenu;
- (void)cleanup;
- (void)dropFiles:(NSArray *)filenames forceOpen:(BOOL)force;
- (void)dropString:(NSString *)string;
@@ -58,5 +59,4 @@
timeout:(NSTimeInterval)timeout;
- (void)addVimInput:(NSString *)string;
- (NSString *)evaluateVimExpression:(NSString *)expr;
- (void)updateMainMenu;
@end
+421 -340
View File
@@ -47,6 +47,8 @@ static NSTimeInterval MMBackendProxyRequestTimeout = 0;
static NSTimeInterval MMResendInterval = 0.5;
#endif
static NSTimeInterval MMSetDialogReturnTimeout = 1.0;
@interface MMAlert : NSAlert {
NSTextField *textField;
@@ -61,22 +63,28 @@ static NSTimeInterval MMResendInterval = 0.5;
- (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code
context:(void *)context;
- (void)alertDidEnd:(MMAlert *)alert code:(int)code context:(void *)context;
- (NSMenuItem *)recurseMenuItemForTag:(int)tag rootMenu:(NSMenu *)root;
- (NSMenuItem *)menuItemForTag:(int)tag;
- (NSMenu *)menuForTag:(int)tag;
- (NSMenuItem *)menuItemForDescriptor:(NSArray *)desc;
- (NSMenu *)parentMenuForDescriptor:(NSArray *)desc;
- (NSMenu *)topLevelMenuForTitle:(NSString *)title;
- (void)addMenuWithTag:(int)tag parent:(int)parentTag title:(NSString *)title
atIndex:(int)idx;
- (void)addMenuItemWithTag:(int)tag parent:(NSMenu *)parent
title:(NSString *)title tip:(NSString *)tip
keyEquivalent:(int)key modifiers:(int)mask
action:(NSString *)action atIndex:(int)idx;
- (NSToolbarItem *)toolbarItemForTag:(int)tag index:(int *)index;
- (void)addToolbarItemToDictionaryWithTag:(int)tag label:(NSString *)title
- (void)addMenuWithDescriptor:(NSArray *)desc atIndex:(int)index;
- (void)addMenuItemWithDescriptor:(NSArray *)desc
atIndex:(int)index
tip:(NSString *)tip
icon:(NSString *)icon
keyEquivalent:(NSString *)keyEquivalent
modifierMask:(int)modifierMask
action:(NSString *)action
isAlternate:(BOOL)isAlternate;
- (void)removeMenuItemWithDescriptor:(NSArray *)desc;
- (void)enableMenuItemWithDescriptor:(NSArray *)desc state:(BOOL)on;
- (void)addToolbarItemToDictionaryWithLabel:(NSString *)title
toolTip:(NSString *)tip icon:(NSString *)icon;
- (void)addToolbarItemWithTag:(int)tag label:(NSString *)label
- (void)addToolbarItemWithLabel:(NSString *)label
tip:(NSString *)tip icon:(NSString *)icon
atIndex:(int)idx;
- (void)popupMenuWithDescriptor:(NSArray *)desc
atRow:(NSNumber *)row
column:(NSNumber *)col;
- (void)connectionDidDie:(NSNotification *)notification;
#if MM_RESEND_LAST_FAILURE
- (void)resendTimerFired:(NSTimer *)timer;
@@ -84,6 +92,13 @@ static NSTimeInterval MMResendInterval = 0.5;
@end
@interface NSToolbar (MMExtras)
- (int)indexOfItemWithItemIdentifier:(NSString *)identifier;
- (NSToolbarItem *)itemAtIndex:(int)idx;
- (NSToolbarItem *)itemWithItemIdentifier:(NSString *)identifier;
@end
@implementation MMVimController
@@ -95,7 +110,6 @@ static NSTimeInterval MMResendInterval = 0.5;
[[MMWindowController alloc] initWithVimController:self];
backendProxy = [backend retain];
sendQueue = [NSMutableArray new];
mainMenuItems = [[NSMutableArray alloc] init];
popupMenuItems = [[NSMutableArray alloc] init];
toolbarItemDict = [[NSMutableDictionary alloc] init];
pid = processIdentifier;
@@ -110,6 +124,25 @@ static NSTimeInterval MMResendInterval = 0.5;
selector:@selector(connectionDidDie:)
name:NSConnectionDidDieNotification object:connection];
// Set up a main menu with only a "MacVim" menu (copied from a template
// which itself is set up in MainMenu.nib). The main menu is populated
// by Vim later on.
mainMenu = [[NSMenu alloc] initWithTitle:@"MainMenu"];
NSMenuItem *appMenuItem = [[MMAppController sharedInstance]
appMenuItemTemplate];
appMenuItem = [[appMenuItem copy] autorelease];
// Note: If the title of the application menu is anything but what
// CFBundleName says then the application menu will not be typeset in
// boldface for some reason. (It should already be set when we copy
// from the default main menu, but this is not the case for some
// reason.)
NSString *appName = [[NSBundle mainBundle]
objectForInfoDictionaryKey:@"CFBundleName"];
[appMenuItem setTitle:appName];
[mainMenu addItem:appMenuItem];
isInitialized = YES;
}
@@ -132,9 +165,11 @@ static NSTimeInterval MMResendInterval = 0.5;
[toolbarItemDict release]; toolbarItemDict = nil;
[toolbar release]; toolbar = nil;
[popupMenuItems release]; popupMenuItems = nil;
[mainMenuItems release]; mainMenuItems = nil;
[windowController release]; windowController = nil;
[vimState release]; vimState = nil;
[mainMenu release]; mainMenu = nil;
[super dealloc];
}
@@ -143,6 +178,16 @@ static NSTimeInterval MMResendInterval = 0.5;
return windowController;
}
- (NSDictionary *)vimState
{
return vimState;
}
- (NSMenu *)mainMenu
{
return mainMenu;
}
- (void)setServerName:(NSString *)name
{
if (name != serverName) {
@@ -382,6 +427,15 @@ static NSTimeInterval MMResendInterval = 0.5;
{
if (!isInitialized) return;
if (!dir) {
// 'dir == nil' means: set dir to the pwd of the Vim process, or let
// open dialog decide (depending on the below user default).
BOOL trackPwd = [[NSUserDefaults standardUserDefaults]
boolForKey:MMDialogsTrackPwdKey];
if (trackPwd)
dir = [vimState objectForKey:@"pwd"];
}
if (saving) {
[[NSSavePanel savePanel] beginSheetForDirectory:dir file:nil
modalForWindow:[windowController window]
@@ -474,33 +528,33 @@ static NSTimeInterval MMResendInterval = 0.5;
{
if (!isInitialized) return;
unsigned i, count = [queue count];
if (count % 2) {
NSLog(@"WARNING: Uneven number of components (%d) in flush queue "
"message; ignoring this message.", count);
return;
@try {
unsigned i, count = [queue count];
if (count % 2) {
NSLog(@"WARNING: Uneven number of components (%d) in flush queue "
"message; ignoring this message.", count);
return;
}
inProcessCommandQueue = YES;
//NSLog(@"======== %s BEGIN ========", _cmd);
for (i = 0; i < count; i += 2) {
NSData *value = [queue objectAtIndex:i];
NSData *data = [queue objectAtIndex:i+1];
int msgid = *((int*)[value bytes]);
//NSLog(@"%s%s", _cmd, MessageStrings[msgid]);
[self handleMessage:msgid data:data];
}
//NSLog(@"======== %s END ========", _cmd);
}
inProcessCommandQueue = YES;
//NSLog(@"======== %s BEGIN ========", _cmd);
for (i = 0; i < count; i += 2) {
NSData *value = [queue objectAtIndex:i];
NSData *data = [queue objectAtIndex:i+1];
int msgid = *((int*)[value bytes]);
//NSLog(@"%s%s", _cmd, MessageStrings[msgid]);
[self handleMessage:msgid data:data];
}
//NSLog(@"======== %s END ========", _cmd);
if (shouldUpdateMainMenu) {
[self updateMainMenu];
@catch (NSException *e) {
NSLog(@"Exception caught whilst processing command queue: %@", e);
}
[windowController processCommandQueueDidFinish];
inProcessCommandQueue = NO;
if ([sendQueue count] > 0) {
@@ -538,45 +592,6 @@ static NSTimeInterval MMResendInterval = 0.5;
return nil;
}
- (void)updateMainMenu
{
NSMenu *mainMenu = [NSApp mainMenu];
// Stop NSApp from updating the Window menu.
[NSApp setWindowsMenu:nil];
// Remove all menus from main menu (except the MacVim menu).
int i, count = [mainMenu numberOfItems];
for (i = count-1; i > 0; --i) {
[mainMenu removeItemAtIndex:i];
}
// Add menus from 'mainMenuItems' to main menu.
count = [mainMenuItems count];
for (i = 0; i < count; ++i) {
[mainMenu addItem:[mainMenuItems objectAtIndex:i]];
}
// Set the new Window menu.
// TODO! Need to look for 'Window' in all localized languages.
NSMenu *windowMenu = [[mainMenu itemWithTitle:@"Window"] submenu];
if (windowMenu) {
// Remove all AppKit owned menu items (tag == 0); they will be added
// again when setWindowsMenu: is called.
count = [windowMenu numberOfItems];
for (i = count-1; i >= 0; --i) {
NSMenuItem *item = [windowMenu itemAtIndex:i];
if (![item tag]) {
[windowMenu removeItem:item];
}
}
[NSApp setWindowsMenu:windowMenu];
}
shouldUpdateMainMenu = NO;
}
@end // MMVimController
@@ -623,126 +638,26 @@ static NSTimeInterval MMResendInterval = 0.5;
[string release];
} else if (AddMenuMsgID == msgid) {
NSString *title = nil;
const void *bytes = [data bytes];
int tag = *((int*)bytes); bytes += sizeof(int);
int parentTag = *((int*)bytes); bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
if (len > 0) {
title = [[NSString alloc] initWithBytes:(void*)bytes length:len
encoding:NSUTF8StringEncoding];
bytes += len;
}
int idx = *((int*)bytes); bytes += sizeof(int);
if (MenuToolbarType == parentTag) {
if (!toolbar) {
// NOTE! Each toolbar must have a unique identifier, else each
// window will have the same toolbar.
NSString *ident = [NSString stringWithFormat:@"%d.%d",
(int)self, tag];
toolbar = [[NSToolbar alloc] initWithIdentifier:ident];
[toolbar setShowsBaselineSeparator:NO];
[toolbar setDelegate:self];
[toolbar setDisplayMode:NSToolbarDisplayModeIconOnly];
[toolbar setSizeMode:NSToolbarSizeModeSmall];
[windowController setToolbar:toolbar];
}
} else if (title) {
[self addMenuWithTag:tag parent:parentTag title:title atIndex:idx];
}
[title release];
NSDictionary *attrs = [NSDictionary dictionaryWithData:data];
[self addMenuWithDescriptor:[attrs objectForKey:@"descriptor"]
atIndex:[[attrs objectForKey:@"index"] intValue]];
} else if (AddMenuItemMsgID == msgid) {
NSString *title = nil, *tip = nil, *icon = nil, *action = nil;
const void *bytes = [data bytes];
int tag = *((int*)bytes); bytes += sizeof(int);
int parentTag = *((int*)bytes); bytes += sizeof(int);
int namelen = *((int*)bytes); bytes += sizeof(int);
if (namelen > 0) {
title = [[NSString alloc] initWithBytes:(void*)bytes length:namelen
encoding:NSUTF8StringEncoding];
bytes += namelen;
}
int tiplen = *((int*)bytes); bytes += sizeof(int);
if (tiplen > 0) {
tip = [[NSString alloc] initWithBytes:(void*)bytes length:tiplen
encoding:NSUTF8StringEncoding];
bytes += tiplen;
}
int iconlen = *((int*)bytes); bytes += sizeof(int);
if (iconlen > 0) {
icon = [[NSString alloc] initWithBytes:(void*)bytes length:iconlen
encoding:NSUTF8StringEncoding];
bytes += iconlen;
}
int actionlen = *((int*)bytes); bytes += sizeof(int);
if (actionlen > 0) {
action = [[NSString alloc] initWithBytes:(void*)bytes
length:actionlen
encoding:NSUTF8StringEncoding];
bytes += actionlen;
}
int idx = *((int*)bytes); bytes += sizeof(int);
if (idx < 0) idx = 0;
int key = *((int*)bytes); bytes += sizeof(int);
int mask = *((int*)bytes); bytes += sizeof(int);
NSString *ident = [NSString stringWithFormat:@"%d.%d",
(int)self, parentTag];
if (toolbar && [[toolbar identifier] isEqual:ident]) {
[self addToolbarItemWithTag:tag label:title tip:tip icon:icon
atIndex:idx];
} else {
NSMenu *parent = [self menuForTag:parentTag];
[self addMenuItemWithTag:tag parent:parent title:title tip:tip
keyEquivalent:key modifiers:mask action:action
atIndex:idx];
}
[title release];
[tip release];
[icon release];
[action release];
NSDictionary *attrs = [NSDictionary dictionaryWithData:data];
[self addMenuItemWithDescriptor:[attrs objectForKey:@"descriptor"]
atIndex:[[attrs objectForKey:@"index"] intValue]
tip:[attrs objectForKey:@"tip"]
icon:[attrs objectForKey:@"icon"]
keyEquivalent:[attrs objectForKey:@"keyEquivalent"]
modifierMask:[[attrs objectForKey:@"modifierMask"] intValue]
action:[attrs objectForKey:@"action"]
isAlternate:[[attrs objectForKey:@"isAlternate"] boolValue]];
} else if (RemoveMenuItemMsgID == msgid) {
const void *bytes = [data bytes];
int tag = *((int*)bytes); bytes += sizeof(int);
id item;
int idx;
if ((item = [self toolbarItemForTag:tag index:&idx])) {
[toolbar removeItemAtIndex:idx];
} else if ((item = [self menuItemForTag:tag])) {
[item retain];
if ([item menu] == [NSApp mainMenu] || ![item menu]) {
// NOTE: To be on the safe side we try to remove the item from
// both arrays (it is ok to call removeObject: even if an array
// does not contain the object to remove).
[mainMenuItems removeObject:item];
[popupMenuItems removeObject:item];
}
if ([item menu])
[[item menu] removeItem:item];
[item release];
}
// Reset cached menu, just to be on the safe side.
lastMenuSearched = nil;
NSDictionary *attrs = [NSDictionary dictionaryWithData:data];
[self removeMenuItemWithDescriptor:[attrs objectForKey:@"descriptor"]];
} else if (EnableMenuItemMsgID == msgid) {
const void *bytes = [data bytes];
int tag = *((int*)bytes); bytes += sizeof(int);
int state = *((int*)bytes); bytes += sizeof(int);
id item = [self toolbarItemForTag:tag index:NULL];
if (!item)
item = [self menuItemForTag:tag];
[item setEnabled:state];
NSDictionary *attrs = [NSDictionary dictionaryWithData:data];
[self enableMenuItemWithDescriptor:[attrs objectForKey:@"descriptor"]
state:[[attrs objectForKey:@"enable"] boolValue]];
} else if (ShowToolbarMsgID == msgid) {
const void *bytes = [data bytes];
int enable = *((int*)bytes); bytes += sizeof(int);
@@ -841,23 +756,10 @@ static NSTimeInterval MMResendInterval = 0.5;
[actionName release];
} else if (ShowPopupMenuMsgID == msgid) {
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
NSString *title = [[NSString alloc]
initWithBytes:(void*)bytes length:len
encoding:NSUTF8StringEncoding];
NSMenu *menu = [self topLevelMenuForTitle:title];
if (menu) {
[windowController popupMenu:menu atRow:row column:col];
} else {
NSLog(@"WARNING: Cannot popup menu with title %@; no such menu.",
title);
}
[title release];
NSDictionary *attrs = [NSDictionary dictionaryWithData:data];
[self popupMenuWithDescriptor:[attrs objectForKey:@"descriptor"]
atRow:[attrs objectForKey:@"row"]
column:[attrs objectForKey:@"column"]];
} else if (SetMouseShapeMsgID == msgid) {
const void *bytes = [data bytes];
int shape = *((int*)bytes); bytes += sizeof(int);
@@ -878,7 +780,12 @@ static NSTimeInterval MMResendInterval = 0.5;
[self setServerName:name];
[name release];
} else if (EnterFullscreenMsgID == msgid) {
[windowController enterFullscreen];
const void *bytes = [data bytes];
int fuoptions = *((int*)bytes); bytes += sizeof(int);
int bg = *((int*)bytes);
NSColor *back = [NSColor colorWithArgbInt:bg];
[windowController enterFullscreen:fuoptions backgroundColor:back];
} else if (LeaveFullscreenMsgID == msgid) {
[windowController leaveFullscreen];
} else if (BuffersNotModifiedMsgID == msgid) {
@@ -889,6 +796,16 @@ static NSTimeInterval MMResendInterval = 0.5;
const int *dim = (const int*)[data bytes];
[[[windowController vimView] textView] setPreEditRow:dim[0]
column:dim[1]];
} else if (EnableAntialiasMsgID == msgid) {
[[[windowController vimView] textView] setAntialias:YES];
} else if (DisableAntialiasMsgID == msgid) {
[[[windowController vimView] textView] setAntialias:NO];
} else if (SetVimStateMsgID == msgid) {
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
if (dict) {
[vimState release];
vimState = [dict retain];
}
} else {
NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid);
}
@@ -897,13 +814,31 @@ static NSTimeInterval MMResendInterval = 0.5;
- (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code
context:(void *)context
{
NSString *string = (code == NSOKButton) ? [panel filename] : nil;
NSString *path = (code == NSOKButton) ? [panel filename] : nil;
// NOTE! setDialogReturn: is a synchronous call so set a proper timeout to
// avoid waiting forever for it to finish. We make this a synchronous call
// so that we can be fairly certain that Vim doesn't think the dialog box
// is still showing when MacVim has in fact already dismissed it.
NSConnection *conn = [backendProxy connectionForProxy];
NSTimeInterval oldTimeout = [conn requestTimeout];
[conn setRequestTimeout:MMSetDialogReturnTimeout];
@try {
[backendProxy setDialogReturn:string];
[backendProxy setDialogReturn:path];
// Add file to the "Recent Files" menu (this ensures that files that
// are opened/saved from a :browse command are added to this menu).
if (path)
[[NSDocumentController sharedDocumentController]
noteNewRecentFilePath:path];
}
@catch (NSException *e) {
NSLog(@"Exception caught in %s %@", _cmd, e);
}
@finally {
[conn setRequestTimeout:oldTimeout];
}
}
- (void)alertDidEnd:(MMAlert *)alert code:(int)code context:(void *)context
@@ -927,74 +862,61 @@ static NSTimeInterval MMResendInterval = 0.5;
}
}
- (NSMenuItem *)recurseMenuItemForTag:(int)tag rootMenu:(NSMenu *)root
- (NSMenuItem *)menuItemForDescriptor:(NSArray *)desc
{
if (root) {
NSMenuItem *item = [root itemWithTag:tag];
if (item) {
lastMenuSearched = root;
return item;
}
if (!(desc && [desc count] > 0)) return nil;
NSArray *items = [root itemArray];
unsigned i, count = [items count];
for (i = 0; i < count; ++i) {
item = [items objectAtIndex:i];
if ([item hasSubmenu]) {
item = [self recurseMenuItemForTag:tag
rootMenu:[item submenu]];
if (item) {
lastMenuSearched = [item submenu];
return item;
}
}
}
NSString *rootName = [desc objectAtIndex:0];
NSArray *rootItems = [rootName hasPrefix:@"PopUp"] ? popupMenuItems
: [mainMenu itemArray];
NSMenuItem *item = nil;
int i, count = [rootItems count];
for (i = 0; i < count; ++i) {
item = [rootItems objectAtIndex:i];
if ([[item title] isEqual:rootName])
break;
}
return nil;
if (i == count) return nil;
count = [desc count];
for (i = 1; i < count; ++i) {
item = [[item submenu] itemWithTitle:[desc objectAtIndex:i]];
if (!item) return nil;
}
return item;
}
- (NSMenuItem *)menuItemForTag:(int)tag
- (NSMenu *)parentMenuForDescriptor:(NSArray *)desc
{
// First search the same menu that was search last time this method was
// called. Since this method is often called for each menu item in a
// menu this can significantly improve search times.
if (lastMenuSearched) {
NSMenuItem *item = [self recurseMenuItemForTag:tag
rootMenu:lastMenuSearched];
if (item) return item;
}
if (!(desc && [desc count] > 0)) return nil;
// Search the main menu.
int i, count = [mainMenuItems count];
NSString *rootName = [desc objectAtIndex:0];
NSArray *rootItems = [rootName hasPrefix:@"PopUp"] ? popupMenuItems
: [mainMenu itemArray];
NSMenu *menu = nil;
int i, count = [rootItems count];
for (i = 0; i < count; ++i) {
NSMenuItem *item = [mainMenuItems objectAtIndex:i];
if ([item tag] == tag) return item;
item = [self recurseMenuItemForTag:tag rootMenu:[item submenu]];
if (item) {
lastMenuSearched = [item submenu];
return item;
NSMenuItem *item = [rootItems objectAtIndex:i];
if ([[item title] isEqual:rootName]) {
menu = [item submenu];
break;
}
}
// Search the popup menus.
count = [popupMenuItems count];
for (i = 0; i < count; ++i) {
NSMenuItem *item = [popupMenuItems objectAtIndex:i];
if ([item tag] == tag) return item;
item = [self recurseMenuItemForTag:tag rootMenu:[item submenu]];
if (item) {
lastMenuSearched = [item submenu];
return item;
}
if (!menu) return nil;
count = [desc count] - 1;
for (i = 1; i < count; ++i) {
NSMenuItem *item = [menu itemWithTitle:[desc objectAtIndex:i]];
menu = [item submenu];
if (!menu) return nil;
}
return nil;
}
- (NSMenu *)menuForTag:(int)tag
{
return [[self menuItemForTag:tag] submenu];
return menu;
}
- (NSMenu *)topLevelMenuForTitle:(NSString *)title
@@ -1008,9 +930,9 @@ static NSTimeInterval MMResendInterval = 0.5;
return [item submenu];
}
count = [mainMenuItems count];
count = [mainMenu numberOfItems];
for (i = 0; i < count; ++i) {
NSMenuItem *item = [mainMenuItems objectAtIndex:i];
NSMenuItem *item = [mainMenu itemAtIndex:i];
if ([title isEqual:[item title]])
return [item submenu];
}
@@ -1018,99 +940,191 @@ static NSTimeInterval MMResendInterval = 0.5;
return nil;
}
- (void)addMenuWithTag:(int)tag parent:(int)parentTag title:(NSString *)title
atIndex:(int)idx
- (void)addMenuWithDescriptor:(NSArray *)desc atIndex:(int)idx
{
NSMenu *parent = [self menuForTag:parentTag];
if (!(desc && [desc count] > 0 && idx >= 0)) return;
NSString *rootName = [desc objectAtIndex:0];
if ([rootName isEqual:@"ToolBar"]) {
// The toolbar only has one menu, we take this as a hint to create a
// toolbar, then we return.
if (!toolbar) {
// NOTE! Each toolbar must have a unique identifier, else each
// window will have the same toolbar.
NSString *ident = [NSString stringWithFormat:@"%d", (int)self];
toolbar = [[NSToolbar alloc] initWithIdentifier:ident];
[toolbar setShowsBaselineSeparator:NO];
[toolbar setDelegate:self];
[toolbar setDisplayMode:NSToolbarDisplayModeIconOnly];
[toolbar setSizeMode:NSToolbarSizeModeSmall];
[windowController setToolbar:toolbar];
}
return;
}
// This is either a main menu item or a popup menu item.
NSString *title = [desc lastObject];
NSMenuItem *item = [[NSMenuItem alloc] init];
NSMenu *menu = [[NSMenu alloc] initWithTitle:title];
[menu setAutoenablesItems:NO];
[item setTag:tag];
[item setTitle:title];
[item setSubmenu:menu];
if (parent) {
NSMenu *parent = [self parentMenuForDescriptor:desc];
if (!parent && [rootName hasPrefix:@"PopUp"]) {
if ([popupMenuItems count] <= idx) {
[popupMenuItems addObject:item];
} else {
[popupMenuItems insertObject:item atIndex:idx];
}
} else {
// If descriptor has no parent and its not a popup (or toolbar) menu,
// then it must belong to main menu.
if (!parent) parent = mainMenu;
if ([parent numberOfItems] <= idx) {
[parent addItem:item];
} else {
[parent insertItem:item atIndex:idx];
}
} else {
NSMutableArray *items = (MenuPopupType == parentTag)
? popupMenuItems : mainMenuItems;
if ([items count] <= idx) {
[items addObject:item];
} else {
[items insertObject:item atIndex:idx];
}
shouldUpdateMainMenu = (MenuPopupType != parentTag);
}
[item release];
[menu release];
}
- (void)addMenuItemWithTag:(int)tag parent:(NSMenu *)parent
title:(NSString *)title tip:(NSString *)tip
keyEquivalent:(int)key modifiers:(int)mask
action:(NSString *)action atIndex:(int)idx
- (void)addMenuItemWithDescriptor:(NSArray *)desc
atIndex:(int)idx
tip:(NSString *)tip
icon:(NSString *)icon
keyEquivalent:(NSString *)keyEquivalent
modifierMask:(int)modifierMask
action:(NSString *)action
isAlternate:(BOOL)isAlternate
{
if (parent) {
NSMenuItem *item = nil;
if (!title || ([title hasPrefix:@"-"] && [title hasSuffix:@"-"])) {
item = [NSMenuItem separatorItem];
} else {
item = [[[NSMenuItem alloc] init] autorelease];
[item setTitle:title];
// TODO: Check that 'action' is a valid action (nothing will happen
// if it isn't, but it would be nice with a warning).
if (action) [item setAction:NSSelectorFromString(action)];
else [item setAction:@selector(vimMenuItemAction:)];
if (tip) [item setToolTip:tip];
if (!(desc && [desc count] > 1 && idx >= 0)) return;
if (key != 0) {
NSString *keyString =
[NSString stringWithFormat:@"%C", key];
[item setKeyEquivalent:keyString];
[item setKeyEquivalentModifierMask:mask];
NSString *title = [desc lastObject];
NSString *rootName = [desc objectAtIndex:0];
if ([rootName isEqual:@"ToolBar"]) {
if (toolbar && [desc count] == 2)
[self addToolbarItemWithLabel:title tip:tip icon:icon atIndex:idx];
return;
}
NSMenu *parent = [self parentMenuForDescriptor:desc];
if (!parent) {
NSLog(@"WARNING: Menu item '%@' has no parent",
[desc componentsJoinedByString:@"->"]);
return;
}
NSMenuItem *item = nil;
if (0 == [title length]
|| ([title hasPrefix:@"-"] && [title hasSuffix:@"-"])) {
item = [NSMenuItem separatorItem];
[item setTitle:title];
} else {
item = [[[NSMenuItem alloc] init] autorelease];
[item setTitle:title];
// Note: It is possible to set the action to a message that "doesn't
// exist" without problems. We take advantage of this when adding
// "dummy items" e.g. when dealing with the "Recent Files" menu (in
// which case a recentFilesDummy: action is set, although it is never
// used).
if ([action length] > 0)
[item setAction:NSSelectorFromString(action)];
else
[item setAction:@selector(vimMenuItemAction:)];
if ([tip length] > 0) [item setToolTip:tip];
if ([keyEquivalent length] > 0) {
[item setKeyEquivalent:keyEquivalent];
[item setKeyEquivalentModifierMask:modifierMask];
}
[item setAlternate:isAlternate];
// The tag is used to indicate whether Vim thinks a menu item should be
// enabled or disabled. By default Vim thinks menu items are enabled.
[item setTag:1];
}
if ([parent numberOfItems] <= idx) {
[parent addItem:item];
} else {
[parent insertItem:item atIndex:idx];
}
}
- (void)removeMenuItemWithDescriptor:(NSArray *)desc
{
if (!(desc && [desc count] > 0)) return;
NSString *title = [desc lastObject];
NSString *rootName = [desc objectAtIndex:0];
if ([rootName isEqual:@"ToolBar"]) {
if (toolbar) {
if ([desc count] == 1) {
[windowController setToolbar:nil];
[toolbar release]; toolbar = nil;
} else if ([desc count] == 2) {
int idx = [toolbar indexOfItemWithItemIdentifier:title];
if (idx != NSNotFound)
[toolbar removeItemAtIndex:idx];
}
}
return;
}
// NOTE! The tag is used to idenfity which menu items were
// added by Vim (tag != 0) and which were added by the AppKit
// (tag == 0).
[item setTag:tag];
NSMenuItem *item = [self menuItemForDescriptor:desc];
if (!item) {
NSLog(@"Failed to remove menu item, descriptor not found: %@",
[desc componentsJoinedByString:@"->"]);
return;
}
if ([parent numberOfItems] <= idx) {
[parent addItem:item];
} else {
[parent insertItem:item atIndex:idx];
[item retain];
if ([item menu] == [NSApp mainMenu] || ![item menu]) {
// NOTE: To be on the safe side we try to remove the item from
// both arrays (it is ok to call removeObject: even if an array
// does not contain the object to remove).
[popupMenuItems removeObject:item];
}
if ([item menu])
[[item menu] removeItem:item];
[item release];
}
- (void)enableMenuItemWithDescriptor:(NSArray *)desc state:(BOOL)on
{
if (!(desc && [desc count] > 0)) return;
/*NSLog(@"%sable item %@", on ? "En" : "Dis",
[desc componentsJoinedByString:@"->"]);*/
NSString *rootName = [desc objectAtIndex:0];
if ([rootName isEqual:@"ToolBar"]) {
if (toolbar && [desc count] == 2) {
NSString *title = [desc lastObject];
[[toolbar itemWithItemIdentifier:title] setEnabled:on];
}
} else {
NSLog(@"WARNING: Menu item '%@' (tag=%d) has no parent.", title, tag);
// Use tag to set whether item is enabled or disabled instead of
// calling setEnabled:. This way the menus can autoenable themselves
// but at the same time Vim can set if a menu is enabled whenever it
// wants to.
[[self menuItemForDescriptor:desc] setTag:on];
}
}
- (NSToolbarItem *)toolbarItemForTag:(int)tag index:(int *)index
{
if (!toolbar) return nil;
NSArray *items = [toolbar items];
int i, count = [items count];
for (i = 0; i < count; ++i) {
NSToolbarItem *item = [items objectAtIndex:i];
if ([item tag] == tag) {
if (index) *index = i;
return item;
}
}
return nil;
}
- (void)addToolbarItemToDictionaryWithTag:(int)tag label:(NSString *)title
- (void)addToolbarItemToDictionaryWithLabel:(NSString *)title
toolTip:(NSString *)tip icon:(NSString *)icon
{
// If the item corresponds to a separator then do nothing, since it is
@@ -1121,10 +1135,9 @@ static NSTimeInterval MMResendInterval = 0.5;
return;
NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:title];
[item setTag:tag];
[item setLabel:title];
[item setToolTip:tip];
[item setAction:@selector(vimMenuItemAction:)];
[item setAction:@selector(vimToolbarItemAction:)];
[item setAutovalidates:NO];
NSImage *img = [NSImage imageNamed:icon];
@@ -1144,7 +1157,7 @@ static NSTimeInterval MMResendInterval = 0.5;
[item release];
}
- (void)addToolbarItemWithTag:(int)tag label:(NSString *)label tip:(NSString
- (void)addToolbarItemWithLabel:(NSString *)label tip:(NSString
*)tip icon:(NSString *)icon atIndex:(int)idx
{
if (!toolbar) return;
@@ -1165,8 +1178,7 @@ static NSTimeInterval MMResendInterval = 0.5;
}
}
[self addToolbarItemToDictionaryWithTag:tag label:label toolTip:tip
icon:icon];
[self addToolbarItemToDictionaryWithLabel:label toolTip:tip icon:icon];
int maxIdx = [[toolbar items] count];
if (maxIdx < idx) idx = maxIdx;
@@ -1174,6 +1186,39 @@ static NSTimeInterval MMResendInterval = 0.5;
[toolbar insertItemWithItemIdentifier:label atIndex:idx];
}
- (void)popupMenuWithDescriptor:(NSArray *)desc
atRow:(NSNumber *)row
column:(NSNumber *)col
{
NSMenu *menu = [[self menuItemForDescriptor:desc] submenu];
if (!menu) return;
id textView = [[windowController vimView] textView];
NSPoint pt;
if (row && col) {
// TODO: Let textView convert (row,col) to NSPoint.
int r = [row intValue];
int c = [col intValue];
NSSize cellSize = [textView cellSize];
pt = NSMakePoint((c+1)*cellSize.width, (r+1)*cellSize.height);
pt = [textView convertPoint:pt toView:nil];
} else {
pt = [[windowController window] mouseLocationOutsideOfEventStream];
}
NSEvent *event = [NSEvent mouseEventWithType:NSRightMouseDown
location:pt
modifierFlags:0
timestamp:0
windowNumber:[[windowController window] windowNumber]
context:nil
eventNumber:0
clickCount:0
pressure:1.0];
[NSMenu popUpContextMenu:menu withEvent:event forView:textView];
}
- (void)connectionDidDie:(NSNotification *)notification
{
//NSLog(@"%@ %s%@", [self className], _cmd, notification);
@@ -1181,14 +1226,14 @@ static NSTimeInterval MMResendInterval = 0.5;
[self cleanup];
// NOTE! This causes the call to removeVimController: to be delayed.
[[NSApp delegate]
[[MMAppController sharedInstance]
performSelectorOnMainThread:@selector(removeVimController:)
withObject:self waitUntilDone:NO];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@ : isInitialized=%d inProcessCommandQueue=%d mainMenuItems=%@ popupMenuItems=%@ toolbar=%@", [self className], isInitialized, inProcessCommandQueue, mainMenuItems, popupMenuItems, toolbar];
return [NSString stringWithFormat:@"%@ : isInitialized=%d inProcessCommandQueue=%d mainMenu=%@ popupMenuItems=%@ toolbar=%@", [self className], isInitialized, inProcessCommandQueue, mainMenu, popupMenuItems, toolbar];
}
#if MM_RESEND_LAST_FAILURE
@@ -1215,6 +1260,42 @@ static NSTimeInterval MMResendInterval = 0.5;
@implementation NSToolbar (MMExtras)
- (int)indexOfItemWithItemIdentifier:(NSString *)identifier
{
NSArray *items = [self items];
int i, count = [items count];
for (i = 0; i < count; ++i) {
id item = [items objectAtIndex:i];
if ([[item itemIdentifier] isEqual:identifier])
return i;
}
return NSNotFound;
}
- (NSToolbarItem *)itemAtIndex:(int)idx
{
NSArray *items = [self items];
if (idx < 0 || idx >= [items count])
return nil;
return [items objectAtIndex:idx];
}
- (NSToolbarItem *)itemWithItemIdentifier:(NSString *)identifier
{
int idx = [self indexOfItemWithItemIdentifier:identifier];
return idx != NSNotFound ? [self itemAtIndex:idx] : nil;
}
@end // NSToolbar (MMExtras)
@implementation MMAlert
- (void)dealloc
{
+6 -1
View File
@@ -104,6 +104,12 @@ enum {
textView = [[MMTextView alloc] initWithFrame:frame];
}
// Allow control of text view inset via MMTextInset* user defaults.
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
int left = [ud integerForKey:MMTextInsetLeftKey];
int top = [ud integerForKey:MMTextInsetTopKey];
[textView setTextContainerInset:NSMakeSize(left, top)];
[textView setAutoresizingMask:NSViewNotSizable];
[self addSubview:textView];
@@ -123,7 +129,6 @@ enum {
[tabBarControl setDelegate:self];
[tabBarControl setHidden:YES];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]];
[tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]];
[tabBarControl setCellOptimumWidth:
+9
View File
@@ -129,4 +129,13 @@
[super performClose:sender];
}
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
if ([item action] == @selector(vimMenuItemAction:)
|| [item action] == @selector(performClose:))
return [item tag];
return YES;
}
@end // MMWindow
+5 -2
View File
@@ -51,7 +51,6 @@
- (void)setFont:(NSFont *)font;
- (void)setWideFont:(NSFont *)font;
- (void)processCommandQueueDidFinish;
- (void)popupMenu:(NSMenu *)menu atRow:(int)row column:(int)col;
- (void)showTabBar:(BOOL)on;
- (void)showToolbar:(BOOL)on size:(int)size mode:(int)mode;
- (void)setMouseShape:(int)shape;
@@ -59,7 +58,7 @@
- (void)liveResizeWillStart;
- (void)liveResizeDidEnd;
- (void)enterFullscreen;
- (void)enterFullscreen:(int)fuoptions backgroundColor:(NSColor *)back;
- (void)leaveFullscreen;
- (void)setBuffersModified:(BOOL)mod;
@@ -68,5 +67,9 @@
- (IBAction)performClose:(id)sender;
- (IBAction)findNext:(id)sender;
- (IBAction)findPrevious:(id)sender;
- (IBAction)vimMenuItemAction:(id)sender;
- (IBAction)vimToolbarItemAction:(id)sender;
- (IBAction)fontSizeUp:(id)sender;
- (IBAction)fontSizeDown:(id)sender;
@end
+90 -70
View File
@@ -76,7 +76,6 @@
- (NSSize)constrainContentSizeToScreenSize:(NSSize)contentSize;
- (void)updateResizeConstraints;
- (NSTabViewItem *)addNewTabViewItem;
- (IBAction)vimMenuItemAction:(id)sender;
- (BOOL)askBackendForStarRegister:(NSPasteboard *)pb;
- (void)hideTablineSeparator:(BOOL)hide;
- (void)doFindNext:(BOOL)next;
@@ -264,7 +263,7 @@
- (void)openWindow
{
[[NSApp delegate] windowControllerWillOpen:self];
[[MMAppController sharedInstance] windowControllerWillOpen:self];
[self addNewTabViewItem];
@@ -367,7 +366,9 @@
// NOTE: This is called when the transparency changes so set the opacity
// flag on the window here (should be faster if the window is opaque).
BOOL isOpaque = [back alphaComponent] == 1.0f;
[[self window] setOpaque:isOpaque];
[decoratedWindow setOpaque:isOpaque];
if (fullscreenEnabled)
[fullscreenWindow setOpaque:isOpaque];
[vimView setDefaultColorsBackground:back foreground:fore];
}
@@ -410,33 +411,6 @@
}
}
- (void)popupMenu:(NSMenu *)menu atRow:(int)row column:(int)col
{
if (!setupDone) return;
NSEvent *event;
if (row >= 0 && col >= 0) {
// TODO: Let textView convert (row,col) to NSPoint.
NSSize cellSize = [[vimView textView] cellSize];
NSPoint pt = { (col+1)*cellSize.width, (row+1)*cellSize.height };
pt = [[vimView textView] convertPoint:pt toView:nil];
event = [NSEvent mouseEventWithType:NSRightMouseDown
location:pt
modifierFlags:0
timestamp:0
windowNumber:[[self window] windowNumber]
context:nil
eventNumber:0
clickCount:0
pressure:1.0];
} else {
event = [[vimView textView] lastMouseDownEvent];
}
[NSMenu popUpContextMenu:menu withEvent:event forView:[vimView textView]];
}
- (void)showTabBar:(BOOL)on
{
[[vimView tabBarControl] setHidden:!on];
@@ -487,23 +461,7 @@
- (void)setMouseShape:(int)shape
{
// This switch should match mshape_names[] in misc2.c.
//
// TODO: Add missing cursor shapes.
switch (shape) {
case 2: [[NSCursor IBeamCursor] set]; break;
case 3: case 4: [[NSCursor resizeUpDownCursor] set]; break;
case 5: case 6: [[NSCursor resizeLeftRightCursor] set]; break;
case 9: [[NSCursor crosshairCursor] set]; break;
case 10: [[NSCursor pointingHandCursor] set]; break;
case 11: [[NSCursor openHandCursor] set]; break;
default:
[[NSCursor arrowCursor] set]; break;
}
// Shape 1 indicates that the mouse cursor should be hidden.
if (1 == shape)
[NSCursor setHiddenUntilMouseMoves:YES];
[[vimView textView] setMouseShape:shape];
}
- (void)adjustLinespace:(int)linespace
@@ -560,13 +518,13 @@
}
}
- (void)enterFullscreen
- (void)enterFullscreen:(int)fuoptions backgroundColor:(NSColor *)back
{
if (fullscreenEnabled) return;
fullscreenWindow = [[MMFullscreenWindow alloc]
initWithWindow:decoratedWindow view:vimView];
[fullscreenWindow enterFullscreen];
initWithWindow:decoratedWindow view:vimView backgroundColor:back];
[fullscreenWindow enterFullscreen:fuoptions];
[fullscreenWindow setDelegate:self];
fullscreenEnabled = YES;
@@ -609,11 +567,12 @@
- (IBAction)performClose:(id)sender
{
// NOTE: File->Close is bound to this action message instead binding it
// directly to the below vim input so that File->Close also works for
// auxiliary windows such as the About dialog. (If we were to bind the
// below, then <D-w> will not close e.g. the About dialog.)
[vimController addVimInput:@"<C-\\><C-N>:conf q<CR>"];
// NOTE: With the introduction of :macmenu it is possible to bind
// File.Close to ":conf q" but at the same time have it send off the
// performClose: action. For this reason we no longer need the CloseMsgID
// message. However, we still need File.Close to send performClose:
// otherwise Cmd-w will not work on dialogs.
[self vimMenuItemAction:sender];
}
- (IBAction)findNext:(id)sender
@@ -626,12 +585,64 @@
[self doFindNext:NO];
}
- (IBAction)vimMenuItemAction:(id)sender
{
if (![sender isKindOfClass:[NSMenuItem class]]) return;
// TODO: Make into category on NSMenuItem which returns descriptor.
NSMenuItem *item = (NSMenuItem*)sender;
NSMutableArray *desc = [NSMutableArray arrayWithObject:[item title]];
NSMenu *menu = [item menu];
while (menu) {
[desc insertObject:[menu title] atIndex:0];
menu = [menu supermenu];
}
// The "MainMenu" item is part of the Cocoa menu and should not be part of
// the descriptor.
if ([[desc objectAtIndex:0] isEqual:@"MainMenu"])
[desc removeObjectAtIndex:0];
NSDictionary *attrs = [NSDictionary dictionaryWithObject:desc
forKey:@"descriptor"];
[vimController sendMessage:ExecuteMenuMsgID data:[attrs dictionaryAsData]];
}
- (IBAction)vimToolbarItemAction:(id)sender
{
NSArray *desc = [NSArray arrayWithObjects:@"ToolBar", [sender label], nil];
NSDictionary *attrs = [NSDictionary dictionaryWithObject:desc
forKey:@"descriptor"];
[vimController sendMessage:ExecuteMenuMsgID data:[attrs dictionaryAsData]];
}
- (IBAction)fontSizeUp:(id)sender
{
[[NSFontManager sharedFontManager] modifyFont:
[NSNumber numberWithInt:NSSizeUpFontAction]];
}
- (IBAction)fontSizeDown:(id)sender
{
[[NSFontManager sharedFontManager] modifyFont:
[NSNumber numberWithInt:NSSizeDownFontAction]];
}
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
if ([item action] == @selector(vimMenuItemAction:)
|| [item action] == @selector(performClose:))
return [item tag];
return YES;
}
// -- NSWindow delegate ------------------------------------------------------
- (void)windowDidBecomeMain:(NSNotification *)notification
{
[vimController updateMainMenu];
[[MMAppController sharedInstance] setMainMenu:[vimController mainMenu]];
[vimController sendMessage:GotFocusMsgID data:nil];
if ([vimView textView]) {
@@ -682,16 +693,35 @@
- (NSRect)windowWillUseStandardFrame:(NSWindow *)win
defaultFrame:(NSRect)frame
{
// Keep old width and horizontal position unless user clicked while the
// Command key is held down.
// By default the window is maximized in the vertical direction only.
// Holding down the Cmd key maximizes the window in the horizontal
// direction. If the MMZoomBoth user default is set, then the window
// maximizes in both directions by default, unless the Cmd key is held in
// which case the window only maximizes in the vertical direction.
NSEvent *event = [NSApp currentEvent];
if (!([event type] == NSLeftMouseUp
&& [event modifierFlags] & NSCommandKeyMask)) {
BOOL cmdLeftClick = [event type] == NSLeftMouseUp
&& [event modifierFlags] & NSCommandKeyMask;
BOOL zoomBoth = [[NSUserDefaults standardUserDefaults]
boolForKey:MMZoomBothKey];
if (!((zoomBoth && !cmdLeftClick) || (!zoomBoth && cmdLeftClick))) {
// Zoom in horizontal direction only.
NSRect currentFrame = [win frame];
frame.size.width = currentFrame.size.width;
frame.origin.x = currentFrame.origin.x;
}
// HACK! The window frame is often higher than the 'defaultFrame' (the fact
// that 'defaultFrame' doesn't cover the entire area up to the menu bar
// seems like a Cocoa bug). To ensure that the window doesn't move
// downwards when the zoom button is clicked we check for this situation
// and return a frame whose max Y coordinate is no lower than the current
// max Y coordinate.
float delta = NSMaxY([win frame]) - NSMaxY(frame);
if (delta > 0)
frame.origin.y += delta;
return frame;
}
@@ -778,16 +808,6 @@
return [vimView addNewTabViewItem];
}
- (IBAction)vimMenuItemAction:(id)sender
{
int tag = [sender tag];
NSMutableData *data = [NSMutableData data];
[data appendBytes:&tag length:sizeof(int)];
[vimController sendMessage:ExecuteMenuMsgID data:data];
}
- (BOOL)askBackendForStarRegister:(NSPasteboard *)pb
{
// TODO: Can this be done with evaluateExpression: instead?
+32 -2
View File
@@ -29,7 +29,7 @@
@protocol MMBackendProtocol
- (oneway void)processInput:(int)msgid data:(in bycopy NSData *)data;
- (oneway void)processInputAndData:(in bycopy NSArray *)messages;
- (oneway void)setDialogReturn:(in bycopy id)obj;
- (void)setDialogReturn:(in bycopy id)obj;
- (NSString *)evaluateExpression:(in bycopy NSString *)expr;
- (BOOL)starRegisterToPasteboard:(byref NSPasteboard *)pboard;
@end
@@ -160,6 +160,9 @@ enum {
ODBEditMsgID,
XcodeModMsgID,
LiveResizeMsgID,
EnableAntialiasMsgID,
DisableAntialiasMsgID,
SetVimStateMsgID,
};
@@ -173,6 +176,7 @@ enum {
InsertLinesDrawType,
DrawCursorDrawType,
SetCursorPosDrawType,
DrawInvertedRectDrawType,
};
enum {
@@ -180,6 +184,7 @@ enum {
MMInsertionPointHorizontal,
MMInsertionPointVertical,
MMInsertionPointHollow,
MMInsertionPointVerticalRight,
};
@@ -220,6 +225,11 @@ extern NSString *MMLoginShellKey;
extern NSString *MMAtsuiRendererKey;
extern NSString *MMUntitledWindowKey;
extern NSString *MMTexturedWindowKey;
extern NSString *MMZoomBothKey;
extern NSString *MMCurrentPreferencePaneKey;
extern NSString *MMLoginShellCommandKey;
extern NSString *MMLoginShellArgumentKey;
extern NSString *MMDialogsTrackPwdKey;
// Enum for MMUntitledWindowKey
enum {
@@ -231,6 +241,12 @@ enum {
// Vim pasteboard type (holds motion type + string)
extern NSString *VimPBoardType;
// Loads all fonts in the Resouces folder of the app bundle and returns a font
// container reference (which should be used to deactivate the loaded fonts).
ATSFontContainerRef loadFonts();
@@ -264,6 +280,21 @@ NSString *buildSearchTextCommand(NSString *searchText);
@interface NSDocumentController (MMExtras)
- (void)noteNewRecentFilePath:(NSString *)path;
@end
@interface NSDictionary (MMExtras)
+ (id)dictionaryWithData:(NSData *)data;
- (NSData *)dictionaryAsData;
@end
// ODB Editor Suite Constants (taken from ODBEditorSuite.h)
#define keyFileSender 'FSnd'
#define keyFileSenderToken 'FTok'
@@ -277,4 +308,3 @@ NSString *buildSearchTextCommand(NSString *searchText);
// MacVim Apple Event Constants
#define keyMMUntitledWindow 'MMuw'
+51
View File
@@ -73,6 +73,9 @@ char *MessageStrings[] =
"ODBEditMsgID",
"XcodeModMsgID",
"LiveResizeMsgID",
"EnableAntialiasMsgID",
"DisableAntialiasMsgID",
"SetVimStateMsgID",
};
@@ -100,6 +103,17 @@ NSString *MMLoginShellKey = @"MMLoginShell";
NSString *MMAtsuiRendererKey = @"MMAtsuiRenderer";
NSString *MMUntitledWindowKey = @"MMUntitledWindow";
NSString *MMTexturedWindowKey = @"MMTexturedWindow";
NSString *MMZoomBothKey = @"MMZoomBoth";
NSString *MMCurrentPreferencePaneKey = @"MMCurrentPreferencePane";
NSString *MMLoginShellCommandKey = @"MMLoginShellCommand";
NSString *MMLoginShellArgumentKey = @"MMLoginShellArgument";
NSString *MMDialogsTrackPwdKey = @"MMDialogsTrackPwd";
// Vim pasteboard type (holds motion type + string)
NSString *VimPBoardType = @"VimPBoardType";
@@ -281,3 +295,40 @@ buildSearchTextCommand(NSString *searchText)
@end // NSColor (MMExtras)
@implementation NSDocumentController (MMExtras)
- (void)noteNewRecentFilePath:(NSString *)path
{
NSURL *url = [NSURL fileURLWithPath:path];
if (url)
[self noteNewRecentDocumentURL:url];
}
@end // NSDocumentController (MMExtras)
@implementation NSDictionary (MMExtras)
+ (id)dictionaryWithData:(NSData *)data
{
id plist = [NSPropertyListSerialization
propertyListFromData:data
mutabilityOption:NSPropertyListImmutable
format:NULL
errorDescription:NULL];
return [plist isKindOfClass:[NSDictionary class]] ? plist : nil;
}
- (NSData *)dictionaryAsData
{
return [NSPropertyListSerialization dataFromPropertyList:self
format:NSPropertyListBinaryFormat_v1_0 errorDescription:NULL];
}
@end
+100 -7
View File
@@ -9,6 +9,13 @@
/* Begin PBXBuildFile section */
031AD5D40D4DE1F60026C5D7 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 031AD5D30D4DE1F60026C5D7 /* Sparkle.framework */; };
031AD5EE0D4DE2490026C5D7 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 031AD5D30D4DE1F60026C5D7 /* Sparkle.framework */; };
0395A8330D71ED7800881434 /* DBPrefsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0395A8320D71ED7800881434 /* DBPrefsWindowController.m */; };
0395A8AA0D72D88B00881434 /* General.png in Resources */ = {isa = PBXBuildFile; fileRef = 0395A8A90D72D88B00881434 /* General.png */; };
0395A95A0D74D47B00881434 /* Integration.png in Resources */ = {isa = PBXBuildFile; fileRef = 0395A9590D74D47B00881434 /* Integration.png */; };
0395A9BF0D75D02400881434 /* AuthorizedShellCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 0395A9BE0D75D02400881434 /* AuthorizedShellCommand.m */; };
0395A9C30D75D04D00881434 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0395A9C20D75D04D00881434 /* Security.framework */; };
0395AA780D76E77800881434 /* Info in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0395AA770D76E77800881434 /* Info */; };
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0395AA210D76E22700881434 /* Edit in ODBEditor.bundle */; };
1D09AB420C6A4D520045497E /* MMTypesetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D09AB400C6A4D520045497E /* MMTypesetter.m */; };
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D0E051B0BA5F83800B6049E /* Colors.plist */; };
1D1474980C56703C0038FA2B /* MacVim.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474960C56703C0038FA2B /* MacVim.m */; };
@@ -40,6 +47,7 @@
1D9918490D299F9900A96335 /* MMAtsuiTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D9918470D299F9900A96335 /* MMAtsuiTextView.m */; };
1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 1DD04DEB0C529C5E006CDC2B /* Credits.rtf */; };
1DD0C20C0C60FFB4008CD84A /* gvimrc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DD0C20A0C60FF9A008CD84A /* gvimrc */; };
1DD3D51E0D82D4C9006E4320 /* ibeam.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DD3D51D0D82D4C9006E4320 /* ibeam.png */; };
1DD66ECE0C803D3600EBDAB3 /* MMApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */; };
1DD703B90BA9D15D008679E9 /* vim_gloss.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1DD703B80BA9D15D008679E9 /* vim_gloss.icns */; };
1DD704310BA9F9C2008679E9 /* SpecialKeys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */; };
@@ -79,6 +87,20 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
0395AA200D76E22700881434 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0395AA190D76E22700881434 /* Edit in ODBEditor.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 8D5B49B6048680CD000E48DA;
remoteInfo = "Edit in ODBEditor";
};
0395AA230D76E2F300881434 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0395AA190D76E22700881434 /* Edit in ODBEditor.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 8D5B49AC048680CD000E48DA;
remoteInfo = "Edit in ODBEditor";
};
1D493DB80C52533B00AB718C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */;
@@ -96,6 +118,17 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
0395AA790D76E77800881434 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "Edit in ODBEditor";
dstSubfolderSpec = 7;
files = (
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in CopyFiles */,
0395AA780D76E77800881434 /* Info in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1D0DCAD80BA3604D00B6CCFA /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -133,6 +166,15 @@
/* Begin PBXFileReference section */
031AD5D30D4DE1F60026C5D7 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
0395A8310D71ED7800881434 /* DBPrefsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBPrefsWindowController.h; sourceTree = "<group>"; };
0395A8320D71ED7800881434 /* DBPrefsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBPrefsWindowController.m; sourceTree = "<group>"; };
0395A8A90D72D88B00881434 /* General.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = General.png; sourceTree = "<group>"; };
0395A9590D74D47B00881434 /* Integration.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Integration.png; sourceTree = "<group>"; };
0395A9BD0D75D02400881434 /* AuthorizedShellCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthorizedShellCommand.h; sourceTree = "<group>"; };
0395A9BE0D75D02400881434 /* AuthorizedShellCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthorizedShellCommand.m; sourceTree = "<group>"; };
0395A9C20D75D04D00881434 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
0395AA190D76E22700881434 /* Edit in ODBEditor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "Edit in ODBEditor.xcodeproj"; path = "edit-in-odb/Edit in ODBEditor.xcodeproj"; sourceTree = "<group>"; };
0395AA770D76E77800881434 /* Info */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = Info; path = "edit-in-odb/Info"; sourceTree = "<group>"; };
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@@ -151,10 +193,10 @@
1D1474B40C56796D0038FA2B /* MMVimController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMVimController.m; sourceTree = "<group>"; };
1D1474B90C567A910038FA2B /* MMWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMWindowController.h; sourceTree = "<group>"; };
1D1474BA0C567A910038FA2B /* MMWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMWindowController.m; sourceTree = "<group>"; };
1D3D190D0CA690FF0004A0A5 /* DejaVuSansMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-Bold.ttf"; path = "dejavu-ttf-2.20/DejaVuSansMono-Bold.ttf"; sourceTree = "<group>"; };
1D3D190E0CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-BoldOblique.ttf"; path = "dejavu-ttf-2.20/DejaVuSansMono-BoldOblique.ttf"; sourceTree = "<group>"; };
1D3D190F0CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-Oblique.ttf"; path = "dejavu-ttf-2.20/DejaVuSansMono-Oblique.ttf"; sourceTree = "<group>"; };
1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = DejaVuSansMono.ttf; path = "dejavu-ttf-2.20/DejaVuSansMono.ttf"; sourceTree = "<group>"; };
1D3D190D0CA690FF0004A0A5 /* DejaVuSansMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-Bold.ttf"; path = "dejavu-ttf/DejaVuSansMono-Bold.ttf"; sourceTree = "<group>"; };
1D3D190E0CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-BoldOblique.ttf"; path = "dejavu-ttf/DejaVuSansMono-BoldOblique.ttf"; sourceTree = "<group>"; };
1D3D190F0CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-Oblique.ttf"; path = "dejavu-ttf/DejaVuSansMono-Oblique.ttf"; sourceTree = "<group>"; };
1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = DejaVuSansMono.ttf; path = "dejavu-ttf/DejaVuSansMono.ttf"; sourceTree = "<group>"; };
1D493D570C5247BF00AB718C /* Vim */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = Vim; path = ../Vim; sourceTree = SOURCE_ROOT; };
1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PSMTabBarControl.xcodeproj; path = PSMTabBarControl/PSMTabBarControl.xcodeproj; sourceTree = "<group>"; };
1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-c.icns"; sourceTree = "<group>"; };
@@ -177,6 +219,7 @@
1D9918470D299F9900A96335 /* MMAtsuiTextView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMAtsuiTextView.m; sourceTree = "<group>"; };
1DD04DEB0C529C5E006CDC2B /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
1DD0C20A0C60FF9A008CD84A /* gvimrc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gvimrc; sourceTree = "<group>"; };
1DD3D51D0D82D4C9006E4320 /* ibeam.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ibeam.png; sourceTree = "<group>"; };
1DD66ECB0C803D3600EBDAB3 /* MMApplication.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMApplication.h; sourceTree = "<group>"; };
1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMApplication.m; sourceTree = "<group>"; };
1DD703B80BA9D15D008679E9 /* vim_gloss.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vim_gloss.icns; sourceTree = "<group>"; };
@@ -229,15 +272,37 @@
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
1D80FBE40CBBD6F200102A1C /* Carbon.framework in Frameworks */,
031AD5D40D4DE1F60026C5D7 /* Sparkle.framework in Frameworks */,
0395A9C30D75D04D00881434 /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0395AA1A0D76E22700881434 /* Products */ = {
isa = PBXGroup;
children = (
0395AA210D76E22700881434 /* Edit in ODBEditor.bundle */,
);
name = Products;
sourceTree = "<group>";
};
0395AA980D76E86200881434 /* Edit in ODBEditor */ = {
isa = PBXGroup;
children = (
0395AA190D76E22700881434 /* Edit in ODBEditor.xcodeproj */,
0395AA770D76E77800881434 /* Info */,
);
name = "Edit in ODBEditor";
sourceTree = "<group>";
};
080E96DDFE201D6D7F000001 /* MacVim Source */ = {
isa = PBXGroup;
children = (
0395A9BD0D75D02400881434 /* AuthorizedShellCommand.h */,
0395A9BE0D75D02400881434 /* AuthorizedShellCommand.m */,
0395A8310D71ED7800881434 /* DBPrefsWindowController.h */,
0395A8320D71ED7800881434 /* DBPrefsWindowController.m */,
1DE3F8E80D50F84600052B9E /* MMPreferenceController.h */,
1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */,
1DE9B94D0D341AB8008FEDD4 /* MMWindow.h */,
@@ -339,6 +404,8 @@
1D71ACB10BC702AB002F2B60 /* doc-bm-txt.icns */,
1D71ACB20BC702AB002F2B60 /* doc-bm-xml.icns */,
1D71ACB30BC702AB002F2B60 /* doc-bm.icns */,
0395A8A90D72D88B00881434 /* General.png */,
0395A9590D74D47B00881434 /* Integration.png */,
1DD703B80BA9D15D008679E9 /* vim_gloss.icns */,
);
name = Icons;
@@ -398,6 +465,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
1DD3D51D0D82D4C9006E4320 /* ibeam.png */,
1D0F11480D58C77800D5DA09 /* Font */,
1DCE78490C460C6C006305A6 /* Icons */,
1DE9726C0C48050600F96A9F /* Toolbar */,
@@ -417,6 +485,8 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
0395AA980D76E86200881434 /* Edit in ODBEditor */,
0395A9C20D75D04D00881434 /* Security.framework */,
1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */,
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
@@ -437,11 +507,13 @@
1D0DCAD80BA3604D00B6CCFA /* CopyFiles */,
1D9EB2840C366D7B0074B739 /* CopyFiles */,
1DE608B80C58807F0055263D /* CopyFiles */,
0395AA790D76E77800881434 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
1D493DCD0C5254A400AB718C /* PBXTargetDependency */,
0395AA240D76E2F300881434 /* PBXTargetDependency */,
);
name = MacVim;
productInstallPath = "$(HOME)/Applications";
@@ -460,6 +532,10 @@
mainGroup = 29B97314FDCFA39411CA2CEA /* MacVim */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 0395AA1A0D76E22700881434 /* Products */;
ProjectRef = 0395AA190D76E22700881434 /* Edit in ODBEditor.xcodeproj */;
},
{
ProductGroup = 1D493DB40C52533B00AB718C /* Products */;
ProjectRef = 1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */;
@@ -473,6 +549,13 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
0395AA210D76E22700881434 /* Edit in ODBEditor.bundle */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "Edit in ODBEditor.bundle";
remoteRef = 0395AA200D76E22700881434 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
@@ -532,6 +615,9 @@
1D3D19130CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf in Resources */,
1D3D19140CA690FF0004A0A5 /* DejaVuSansMono.ttf in Resources */,
1DE3F8E70D50F80500052B9E /* Preferences.nib in Resources */,
0395A8AA0D72D88B00881434 /* General.png in Resources */,
0395A95A0D74D47B00881434 /* Integration.png in Resources */,
1DD3D51E0D82D4C9006E4320 /* ibeam.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -556,12 +642,19 @@
1D9918490D299F9900A96335 /* MMAtsuiTextView.m in Sources */,
1DE9B9500D341AB8008FEDD4 /* MMWindow.m in Sources */,
1DE3F8EB0D50F84600052B9E /* MMPreferenceController.m in Sources */,
0395A8330D71ED7800881434 /* DBPrefsWindowController.m in Sources */,
0395A9BF0D75D02400881434 /* AuthorizedShellCommand.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
0395AA240D76E2F300881434 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "Edit in ODBEditor";
targetProxy = 0395AA230D76E2F300881434 /* PBXContainerItemProxy */;
};
1D493DCD0C5254A400AB718C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = PSMTabBarControlFramework;
@@ -605,7 +698,7 @@
i386,
);
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 21;
CURRENT_PROJECT_VERSION = 31;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -646,7 +739,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 21;
CURRENT_PROJECT_VERSION = 31;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -677,7 +770,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 21;
CURRENT_PROJECT_VERSION = 31;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -416,9 +416,11 @@
0259C573FE90428111CA0C5A /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C056398B08A954F8003078D8 /* Build configuration list for PBXProject "PSMTabBarControl" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 0259C574FE90428111CA0C5A /* PSMTabBarControl */;
projectDirPath = "";
projectRoot = "";
targets = (
53DF68FC067E5B5A0090B5B0 /* PSMTabBarControlFramework */,
53DF6901067E5B8E0090B5B0 /* All */,
+7
View File
@@ -0,0 +1,7 @@
This archive contains a snapshot of 'MacVim.app' and the shell script
'mvim'.
For usage instructions, please start MacVim and type ":h macvim"
(without the quotes).
MacVim requires a PPC or Intel Mac running Mac OS X 10.4 or 10.5.
@@ -20,21 +20,25 @@ John Karp
Keenan Pepper
Lars Naesbye Christensen
Mashrab Kuvatov
Max Berger
Mederic Boquien
Michael Everson
Misu Moldovan
Nguyen Thai Ngoc Duy
Nicolas Mailhot
Ognyan Kulev
Ondrej Koala Vacha
Peter Cernak
Remy Oudompheng
Roozbeh Pournader
Sahak Petrosyan
Sander Vesik
Stepan Roh
Stephen Hartke
Tavmjong Bah
Tim May
Valentin Stoykov
Vasek Stodulka
Wesley Transue
$Id: AUTHORS 1910 2007-06-25 19:10:14Z ben_laenen $
$Id: AUTHORS 2162 2007-12-27 12:39:07Z ben_laenen $
@@ -1,4 +1,5 @@
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. Glyphs imported from Arev fonts are (c) Tavmjung Bah (see below)
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
Bitstream Vera Fonts Copyright
------------------------------
@@ -95,4 +96,4 @@ dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.
$Id: LICENSE 778 2006-04-20 18:14:24Z moyogo $
$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $
@@ -1,3 +1,124 @@
Changes from 2.24 to 2.25
- moved/added U+2E18 (by Gee Fung Sit)
- added empty glyph for U+2064 in Sans and Serif (by Gee Fung Sit)
- added U+22CE-U+22CF to Sans (by Gee Fung Sit)
- Sans Oblique and Bold Oblique, Serif: reverted digits hinting instructions back to before revision 1590, which fixed mistaken debian bug #471024. This fixes Debian bug #411308. The original bug was in freetype not in the fonts (by Denis Jacquerye)
- added U+A726-U+A729, U+A730-U+A733, U+A738-U+A73F, U+A746-U+A74B, U+A74E-U+A74F, U+A780-U+A781, U+A7FB-U+A7FF to Sans (by Gee Fung Sit)
- added Macedonian italic glyph shape for U+0453 in Serif (by Ben Laenen)
- changed descenders in U+0446, U+0449, U+0497, U+04A3, U+04AD (by Andrey V. Panov)
- updated main SFD files to SplineFontDB 3.0 (Denis Jacquerye and Gee Fung Sit)
- moved U+0561 2 up since it wasn't aligned with the baseline well (by Ben Laenen)
- added U+2E2E to Sans (by Gee Fung Sit)
- replaced U+2699 with simpler version in Sans (by Gee Fung Sit)
- added a lot of hinting instructions to Latin Extended B, Greek and Coptic glyphs Sans Book (by Wesley Transue)
- differentiated U+2219 from U+22C5 and adjusted affected references in Sans and Mono (by Gee Fung Sit)
- made Hebrew narrower in Sans Bold and Sans Bold Oblique (by Denis Jacquerye)
- added Kurdish and Chuvash letters from Unicode 5.1 Cyrillic Extended block (by Wesley Transue)
- added U+1E9F, U+A644-U+A647, U+A64C-U+A64D, U+A650-U+A651, U+A654-U+A655, U+A712U+A716 to Sans (by Gee Fung Sit)
- added several glyphs to Sans ExtraLight (by Gee Fung Sit)
- added hinting instructions to U+046A-U+046B, U+0508-U+0509, U+050B, U+0512-U+0513 in Sans Book (by Wesley Transue)
- corrected width of U+027E in Sans Book (by Gee Fung Sit)
- added U+2C79, U+2C7B-U+2C7D to Sans (by Gee Fung Sit)
- added a bunch of glyphs+small corrections to Sans Light (by Gee Fung Sit)
- added U+0496, U+0497, U+04B0, U+04B1 (by Andrey V. Panov)
- updated U+0493, U+049B, U+04B3, U+04B7, U+04F7 (by Andrey V. Panov)
- further improvements in extended Cyrillic (by Andrey V. Panov)
Changes from 2.23 to 2.24
- instructions for U+05C0 ׀, U+05C3 ׃, U+05F3 ׳, and U+05F4 ״ in DejaVu
Sans. (by Wesley Transue)
- instructions for U+2116 in Sans (by Andrey V. Panov)
- Unicode 5.1 update: moved U+F208 to U+2C6D, U+F25F to U+2C71, added
U+2C6E-U+2C6F, U+2C72-U+2C73, updated outline of U+2C71 in Sans. (by
Denis Jacquerye)
- updated and instructed U+0401 in Sans (by Andrey V. Panov)
- fixed the bug in Sans faces where U+02EC ˬ faced the wrong direction.
Also, added a few more glyph instructions. (by Wesley Transue)
- removed OS2Sub and OS2Strike that weren't intentional in Sans
ExtraLight. (by Denis Jacquerye)
- updated instructions for U+401, U+44F in Serif Book. (by Andrey V.
Panov)
- instructions for U+02C4 ˄, U+02C5 ˅, U+03D8 Ϙ, U+03D9 ϙ, U+0494 Ҕ, and
U+0495 ҕ in Sans Book. (by Wesley Transue)
- instructions for U+01A6 Ʀ, U+0238 ȸ, U+0239 ȹ, U+02EC ˬ, and U+05C6 ׆
in Sans Book. (by Wesley Transue)
- DejaVuSans.sfd DejaVuSerif.sfd: updated instructions for U+447 and
U+451 using code generated with xgridfit (by Andrey V. Panov)
- instructions for a few glyphs in the Latin Extended-B Block, Greek
Block, Cyrillic Block, and N'Ko block. (by Wesley Transue)
- updated sfdnormalize.pl, and SFD files to new SFD format with empty
lines. (by Denis Jacquerye)
Changes from 2.22 to 2.23
- fixed bug which made Condensed fonts appear instead of normal width ones
- added U+20DB, U+20DC, and U+20E1 to Sans (by Roozbeh Pournader)
- added hinting instructions to U+01A7, U+01AA-U+01AC, U+01AE-U+01AF,
U+01BC-U+01BD, U+01BF, U+01F7, U+0277, U+027F, U+0285-U+0286, U+0297, U+02AF,
U+02B4-U+02B5, U+02BD, U+030D, U+0311, U+0329, U+04A0-U+04A1 in Sans Book (by
Wesley Transue)
- modified hinting instructions of U+04A2 in Sans Book (by Wesley Transue)
- added hinting instructions to U+237D, U+2423 in Mono Book and Mono Bold (by
Wesley Transue)
- added mathematical alphanumeric symbols to all styles (by Max Berger)
- added Unicode 5.1 U+2E18 as U+2E18.u51 (not yet usable) to Sans (by Roozbeh
Pournader)
- dereferenced all glyphs with mixed references and outlines (by Denis
Jacquerye)
- removed non-zero width from U+0344 in Sans (by Denis Jacquerye)
Changes from 2.21 to 2.22
- directory structure has changed, we now use the Makefile
- modified Armenian U+0565 in Sans (by Սահակ Պետրոսյան)
- added double struck letters and numbers U+2102, U+210D, U+2115,
U+2119-U+211A, U+211D, U+2124, U+213C-U+2140, U+2145-U+2149, U+1D538-U+1D539,
U+1D53B-U+1D53E, U+1D540-U+1D544, U+1D546, U+1D54A-U+1D550, U+1D552-U+1D56B,
U+1D7D8-U+1D7E1 to Serif (by Stephen Hartke)
- added letterlike symbols U+2103, U+2109, U+2127, U+214B, U+2141-U+2144 to
Serif (by Ben Laenen)
- fixed outline direction of U+2143 in Sans Bold/Bold Oblique (by Ben Laenen)
- added arrow set in Serif: arrows: U+2194-U+21FF; dingbats: U+27A1;
supplemental arrows A: U+27F0-U+27FF; supplemental arrows B: U+2900-U+2975,
U+297A; miscellaneous symbols and arrows: U+2B00-U+2B11 (by Ben Laenen)
- added U+0180, U+01DE, U+01E0-01E1, U+022A, U+022C, U+0230, U+1E08-U+1E09,
U+1E10-U+1E11, U+1EB0-U+1EB1 to Mono (by Denis Jacquerye)
- adjusted U+01D5, U+01D7, U+01D9, U+1DB in Mono (by Denis Jacquerye)
- added Ogham in Sans (by Wesley Transue)
- added Yijing Hexagram Symbols in Sans (by Wesley Transue)
- hinting instructions added to Cyrillic U+0460, U+04A6-U+04A7, U+04AC-U+04AD,
U+04C7-U+04C8, U+04F6-U+04F7, U+04FA-U+04FB, U+050C-U+050D in Sans Book (by
Wesley Transue)
- adjusted Cyrillic letters U+042A, U+044A, U+044C, U+0459-U+045B, U+0462,
U+048C-U+048D in Serif (by Andrey V. Panov)
- hinting instructions added to Lao U+0EB7 in Sans (by Wesley Transue)
- added Roman numerals and Claudian letter U+2160-U+2184 in Serif (by Ben
Laenen)
- added U+FFF9-U+FFFD to Sans, Serif and Mono (by Lars Næsbye Christensen)
- added mathematical symbols to Serif: U+2200, U+2203-U+2204, U+2213-U+2214,
U+2217-U+2218, U+2223-U+2226, U+2250-U+2255, U+2295-U+22AF, U+22C5 (by Ben
Laenen)
- modified bullet symbol U+2219 in Serif (by Ben Laenen)
Changes from 2.20 to 2.21
- added U+FE20-U+FE23 (half diacritics) to Sans (by Denis Jacquerye)
- added anchor "half" to position right half of double marks, U+FE21 or U+FE23
to Sans (by Denis Jacquerye)
- shifted U+0360 up to avoid collision with some outlines in Sans (by Denis
Jacquerye)
- added anchor above-mark anchor to U+035D, U+035E, U+0360, U+0361 in Sans (by
Denis Jacquerye)
- added instructions for ff, ffi, ffl ligatures in Serif Bold (by Eugeniy
Meshcheryakov)
- added instructions to some N'Ko glyphs (by Wesley Transue)
- added instructions to some Lao glyphs (by Wesley Transue)
- cleaning up 'liga' Standard Ligature in Latin, in Sans and Sans Mono (by
Denis Jacquerye)
- added U+046A, U+046B (big yus) in Serif (by Andrey V. Panov)
- added box drawing symbols to Sans and Serif (by Lars Næsbye Christensen)
- added Makefile to improve font and packages generating (by Nicolas Mailhot)
Changes from 2.19 to 2.20
- removed TeX and TeXData tags from all sfd files (by Eugeniy Meshcheryakov)
@@ -931,4 +1052,4 @@ Changes from 0.9 to 0.9.1:
- proper caron shape for dcaron and tcaron
- minor visual changes
$Id: NEWS 1998 2007-09-16 14:23:46Z ben_laenen $
$Id: NEWS 2227 2008-05-19 06:41:46Z moyogo $
@@ -1,4 +1,4 @@
DejaVu fonts 2.20 (c)2004-2007 DejaVu fonts team
DejaVu fonts 2.24 (c)2004-2008 DejaVu fonts team
------------------------------------------------
The DejaVu fonts are a font family based on the Bitstream Vera Fonts
@@ -46,14 +46,14 @@ For more information go to http://dejavu.sourceforge.net/.
Characters from Arev fonts, Copyright (c) 2006 by Tavmjong Bah:
---------------------------
U+01ba, U+01bf, U+01f7, U+021c, U+021d, U+0220, U+0222, U+0223,
U+02b9, U+02ba, U+02bd, U+02c2, U+02c3, U+02c4, U+02c5, U+02d4,
U+02d5, U+02d7, U+02ec, U+02ed, U+02ee, U+0346-034e, U+0360, U+0362,
U+03e2-03ef, U+0460-0463, U+0466-0486, U+0488-0489, U+04a8-04a9,
U+0500-050f, U+2055-205e, U+20B0, U+20B2-20B3, U+2102, U+210D, U+210f,
U+2111, U+2113, U+2115, U+2118-U+211A, U+211c-211d, U+2124,U+2135,
U+213C-U+2140, U+2295-2298, U+2308-230b, U+26A2-U+26B1, U+2701-2704,
U+2706-2709, U+270c-274b, U+2758-275a, U+2761-2775, U+2780-2794,
U+2798-27af, U+27b1-27be, U+fb05-fb06
U+01BA, U+01BF, U+01F7, U+021C-U+021D, U+0220, U+0222-U+0223,
U+02B9, U+02BA, U+02BD, U+02C2-U+02C5, U+02d4-U+02D5,
U+02D7, U+02EC-U+02EE, U+0346-U+034E, U+0360, U+0362,
U+03E2-03EF, U+0460-0463, U+0466-U+0486, U+0488-U+0489, U+04A8-U+04A9,
U+0500-U+050F, U+2055-205E, U+20B0, U+20B2-U+20B3, U+2102, U+210D, U+210F,
U+2111, U+2113, U+2115, U+2118-U+211A, U+211C-U+211D, U+2124, U+2135,
U+213C-U+2140, U+2295-U+2298, U+2308-U+230B, U+26A2-U+26B1, U+2701-U+2704,
U+2706-U+2709, U+270C-U+274B, U+2758-U+275A, U+2761-U+2775, U+2780-U+2794,
U+2798-U+27AF, U+27B1-U+27BE, U+FB05-U+FB06
$Id: README 1998 2007-09-16 14:23:46Z ben_laenen $
$Id: README 2192 2008-03-09 21:25:29Z moyogo $
@@ -7,6 +7,7 @@ ab Abkhazia 100% (90/90) 93% (84/90)
af Afrikaans 100% (69/69) 100% (69/69) 100% (69/69)
am Amharic (0/264) (0/264) (0/264)
ar Arabic 100% (125/125) (0/125) 100% (125/125)
as (0/89) (0/89) (0/89)
ast Asturian 100% (72/72) 100% (72/72) 100% (72/72)
ava Avaric 100% (67/67) 100% (67/67) 100% (67/67)
ay Aymara 100% (60/60) 100% (60/60) 100% (60/60)
@@ -30,25 +31,25 @@ ce Chechen 100% (67/67) 100% (67/67)
ch Chamorro 100% (58/58) 100% (58/58) 100% (58/58)
chm Mari (Lower Cheremis / Upper Cheremis) 100% (76/76) 100% (76/76) 97% (74/76)
chr Cherokee (0/85) (0/85) (0/85)
co Corsican 100% (84/84) 100% (84/84) 100% (84/84)
co Corsican 100% (85/85) 100% (85/85) 100% (85/85)
cs Czech 100% (82/82) 100% (82/82) 100% (82/82)
cu Old Church Slavonic 100% (103/103) 82% (85/103) 74% (77/103)
cu Old Church Slavonic 100% (103/103) 84% (87/103) 74% (77/103)
cv Chuvash 100% (74/74) 100% (74/74) 100% (74/74)
cy Welsh 100% (78/78) 100% (78/78) 100% (78/78)
da Danish 100% (70/70) 100% (70/70) 100% (70/70)
de German 100% (59/59) 100% (59/59) 100% (59/59)
de German 100% (60/60) 100% (60/60) 100% (60/60)
dz Dzongkha (0/95) (0/95) (0/95)
el Greek 100% (69/69) 100% (69/69) 100% (69/69)
en English 100% (72/72) 100% (72/72) 100% (72/72)
el Greek 100% (70/70) 100% (70/70) 100% (70/70)
en English 100% (73/73) 100% (73/73) 100% (73/73)
eo Esperanto 100% (64/64) 100% (64/64) 100% (64/64)
es Spanish 100% (66/66) 100% (66/66) 100% (66/66)
es Spanish 100% (67/67) 100% (67/67) 100% (67/67)
et Estonian 100% (64/64) 100% (64/64) 100% (64/64)
eu Basque 100% (56/56) 100% (56/56) 100% (56/56)
fa Persian 100% (129/129) (0/129) 100% (129/129)
fi Finnish 100% (62/62) 100% (62/62) 100% (62/62)
fi Finnish 100% (63/63) 100% (63/63) 100% (63/63)
fj Fijian 100% (52/52) 100% (52/52) 100% (52/52)
fo Faroese 100% (68/68) 100% (68/68) 100% (68/68)
fr French 100% (84/84) 100% (84/84) 100% (84/84)
fr French 100% (85/85) 100% (85/85) 100% (85/85)
ful Fulah (Fula) 100% (62/62) 100% (62/62) 100% (62/62)
fur Friulian 100% (66/66) 100% (66/66) 100% (66/66)
fy Frisian 100% (75/75) 100% (75/75) 100% (75/75)
@@ -74,10 +75,10 @@ ie Interlingue 100% (52/52) 100% (52/52)
ik Inupiaq (Inupiak, Eskimo) 100% (68/68) 100% (68/68) 100% (68/68)
io Ido 100% (52/52) 100% (52/52) 100% (52/52)
is Icelandic 100% (70/70) 100% (70/70) 100% (70/70)
it Italian 100% (72/72) 100% (72/72) 100% (72/72)
it Italian 100% (73/73) 100% (73/73) 100% (73/73)
iu Inuktitut 100% (161/161) (0/161) (0/161)
ja Japanese (0/6538) (0/6538) (0/6538)
ka Georgian 100% (34/34) 100% (34/34) 100% (34/34)
ka Georgian 100% (33/33) 100% (33/33) 100% (33/33)
kaa Kara-Kalpak (Karakalpak) 100% (78/78) 100% (78/78) 100% (78/78)
ki Kikuyu 100% (56/56) 100% (56/56) 100% (56/56)
kk Kazakh 100% (77/77) 100% (77/77) 100% (77/77)
@@ -96,6 +97,7 @@ ky Kirgiz 100% (70/70) 100% (70/70)
la Latin 100% (68/68) 100% (68/68) 100% (68/68)
lb Luxembourgish (Letzeburgesch) 100% (75/75) 100% (75/75) 100% (75/75)
lez Lezghian (Lezgian) 100% (67/67) 100% (67/67) 100% (67/67)
ln Lingala 100% (81/81) 100% (81/81) 100% (81/81)
lo Lao 100% (65/65) (0/65) 70% (46/65)
lt Lithuanian 100% (70/70) 100% (70/70) 100% (70/70)
lv Latvian 100% (78/78) 100% (78/78) 100% (78/78)
@@ -112,9 +114,11 @@ my Burmese (Myanmar) (0/48) (0/48)
nb Norwegian Bokmal 100% (70/70) 100% (70/70) 100% (70/70)
nds Low Saxon 100% (59/59) 100% (59/59) 100% (59/59)
ne Nepali (Devanagari script) (0/68) (0/68) (0/68)
nl Dutch 100% (82/82) 100% (82/82) 100% (82/82)
nl Dutch 100% (83/83) 100% (83/83) 100% (83/83)
nn Norwegian Nynorsk 100% (76/76) 100% (76/76) 100% (76/76)
no Norwegian (Bokmal) 100% (70/70) 100% (70/70) 100% (70/70)
nr Ndebele, South 100% (52/52) 100% (52/52) 100% (52/52)
nso Northern Sotho 100% (58/58) 100% (58/58) 100% (58/58)
ny Chichewa 100% (54/54) 100% (54/54) 100% (54/54)
oc Occitan 100% (70/70) 100% (70/70) 100% (70/70)
om Oromo or Galla 100% (52/52) 100% (52/52) 100% (52/52)
@@ -124,7 +128,7 @@ pa Punjabi (Gurumukhi script) (0/63) (0/63)
pl Polish 100% (70/70) 100% (70/70) 100% (70/70)
ps-af Pashto in Afghanistan 83% (41/49) (0/49) 83% (41/49)
ps-pk Pashto in Pakistan 81% (40/49) (0/49) 81% (40/49)
pt Portuguese 100% (82/82) 100% (82/82) 100% (82/82)
pt Portuguese 100% (83/83) 100% (83/83) 100% (83/83)
rm Rhaeto-Romance (Romansch) 100% (66/66) 100% (66/66) 100% (66/66)
ro Romanian 100% (62/62) 100% (62/62) 100% (62/62)
ru Russian 100% (66/66) 100% (66/66) 100% (66/66)
@@ -145,6 +149,8 @@ sms Skolt Sami 100% (80/80) 100% (80/80)
so Somali 100% (52/52) 100% (52/52) 100% (52/52)
sq Albanian 100% (56/56) 100% (56/56) 100% (56/56)
sr Serbian 100% (76/76) 100% (76/76) 100% (76/76)
ss Swati 100% (52/52) 100% (52/52) 100% (52/52)
st Sotho, Southern 100% (52/52) 100% (52/52) 100% (52/52)
sv Swedish 100% (68/68) 100% (68/68) 100% (68/68)
sw Swahili 100% (52/52) 100% (52/52) 100% (52/52)
syr Syriac (0/45) (0/45) (0/45)
@@ -152,16 +158,16 @@ ta Tamil (0/48) (0/48)
te Telugu (0/80) (0/80) (0/80)
tg Tajik 100% (78/78) 100% (78/78) 97% (76/78)
th Thai 1% (1/87) (0/87) (0/87)
ti-er Eritrean Tigrinya (0/256) (0/256) (0/256)
ti-et Ethiopian Tigrinya (0/282) (0/282) (0/282)
ti-er Eritrean Tigrinya (0/255) (0/255) (0/255)
ti-et Ethiopian Tigrinya (0/281) (0/281) (0/281)
tig Tigre (0/221) (0/221) (0/221)
tk Turkmen 100% (74/74) 100% (74/74) 97% (72/74)
tk Turkmen 100% (74/74) 100% (74/74) 100% (74/74)
tl Tagalog (0/19) (0/19) (0/19)
tn Tswana 100% (56/56) 100% (56/56) 100% (56/56)
tn Tswana 100% (58/58) 100% (58/58) 100% (58/58)
to Tonga 100% (53/53) 100% (53/53) 100% (53/53)
tr Turkish 100% (70/70) 100% (70/70) 100% (70/70)
ts Tsonga 100% (52/52) 100% (52/52) 100% (52/52)
tt Tatar 100% (76/76) 100% (76/76) 97% (74/76)
tt Tatar 100% (76/76) 100% (76/76) 100% (76/76)
tw Twi 100% (73/73) 100% (73/73) 100% (73/73)
tyv Tuvinian 100% (70/70) 100% (70/70) 100% (70/70)
ug Uighur 100% (125/125) (0/125) 100% (125/125)
@@ -169,7 +175,7 @@ uk Ukrainian 100% (72/72) 100% (72/72)
ur Urdu 94% (137/145) (0/145) 97% (141/145)
uz Uzbek 100% (68/68) 100% (68/68) 100% (68/68)
ven Venda 100% (62/62) 100% (62/62) 100% (62/62)
vi Vietnamese 100% (194/194) 77% (150/194) 62% (122/194)
vi Vietnamese 100% (194/194) 77% (150/194) 63% (124/194)
vo Volapuk 100% (54/54) 100% (54/54) 100% (54/54)
vot Votic 100% (62/62) 100% (62/62) 100% (62/62)
wa Walloon 100% (70/70) 100% (70/70) 100% (70/70)
@@ -181,7 +187,7 @@ yi Yiddish 100% (27/27) (0/27)
yo Yoruba 100% (119/119) 100% (119/119) 100% (119/119)
zh-cn Chinese (simplified) 0% (2/6765) 0% (2/6765) 0% (2/6765)
zh-hk Chinese Hong Kong Supplementary Character Set (0/2213) (0/2213) (0/2213)
zh-mo Chinese in Macau (0/13063) (0/13063) (0/13063)
zh-mo Chinese in Macau (0/2213) (0/2213) (0/2213)
zh-sg Chinese in Singapore 0% (2/6765) 0% (2/6765) 0% (2/6765)
zh-tw Chinese (traditional) (0/13063) (0/13063) (0/13063)
zu Zulu 100% (52/52) 100% (52/52) 100% (52/52)
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
This is the Unicode coverage file for DejaVu fonts
($Id: unicover.txt 2000 2007-09-16 14:34:23Z ben_laenen $)
($Id$)
Control and similar characters are discounted from totals.
@@ -7,12 +7,12 @@ Control and similar characters are discounted from totals.
U+0000 Basic Latin 100% (95/95) 100% (95/95) 100% (95/95)
U+0080 Latin-1 Supplement 100% (96/96) 100% (96/96) 100% (96/96)
U+0100 Latin Extended-A 100% (128/128) 100% (128/128) 100% (128/128)
U+0180 Latin Extended-B 100% (208/208) 90% (189/208) 78% (164/208)
U+0180 Latin Extended-B 100% (208/208) 90% (189/208) 82% (172/208)
U+0250 IPA Extensions 100% (96/96) 100% (96/96) 100% (96/96)
U+02b0 Spacing Modifier Letters 78% (63/80) 56% (45/80) 57% (46/80)
U+0300 Combining Diacritical Marks 82% (92/112) 60% (68/112) 59% (67/112)
U+0370 Greek and Coptic 100% (127/127) 86% (110/127) 86% (110/127)
U+0400 Cyrillic 100% (255/255) 76% (194/255) 66% (170/255)
U+0400 Cyrillic 100% (255/255) 77% (198/255) 68% (174/255)
U+0500 Cyrillic Supplement 100% (20/20) (0/20) (0/20)
U+0530 Armenian 100% (86/86) (0/86) (0/86)
U+0590 Hebrew 62% (54/87) (0/87) (0/87)
@@ -41,7 +41,7 @@ U+1200 Ethiopic (0/356) (0/356)
U+1380 Ethiopic Supplement (0/26) (0/26) (0/26)
U+13a0 Cherokee (0/85) (0/85) (0/85)
U+1400 Unified Canadian Aboriginal Syllabics 64% (404/630) (0/630) (0/630)
U+1680 Ogham (0/29) (0/29) (0/29)
U+1680 Ogham 100% (29/29) (0/29) (0/29)
U+16a0 Runic (0/81) (0/81) (0/81)
U+1700 Tagalog (0/20) (0/20) (0/20)
U+1720 Hanunoo (0/23) (0/23) (0/23)
@@ -58,32 +58,32 @@ U+1b00 Balinese (0/121) (0/121)
U+1d00 Phonetic Extensions 82% (105/128) 48% (62/128) 48% (62/128)
U+1d80 Phonetic Extensions Supplement 59% (38/64) 57% (37/64) 57% (37/64)
U+1dc0 Combining Diacritical Marks Supplement 46% (6/13) (0/13) (0/13)
U+1e00 Latin Extended Additional 100% (246/246) 78% (192/246) 54% (134/246)
U+1e00 Latin Extended Additional 100% (246/246) 78% (192/246) 56% (140/246)
U+1f00 Greek Extended 100% (233/233) 100% (233/233) 100% (233/233)
U+2000 General Punctuation 98% (104/106) 61% (65/106) 42% (45/106)
U+2070 Superscripts and Subscripts 100% (34/34) 100% (34/34) 100% (34/34)
U+20a0 Currency Symbols 100% (22/22) 27% (6/22) 22% (5/22)
U+20d0 Combining Diacritical Marks for Symbols 12% (4/32) (0/32) (0/32)
U+2100 Letterlike Symbols 94% (75/79) 7% (6/79) 8% (7/79)
U+2150 Number Forms 100% (50/50) 26% (13/50) 26% (13/50)
U+2190 Arrows 100% (112/112) 3% (4/112) 100% (112/112)
U+2200 Mathematical Operators 95% (245/256) 11% (30/256) 56% (145/256)
U+20d0 Combining Diacritical Marks for Symbols 21% (7/32) (0/32) (0/32)
U+2100 Letterlike Symbols 94% (75/79) 39% (31/79) 8% (7/79)
U+2150 Number Forms 100% (50/50) 100% (50/50) 26% (13/50)
U+2190 Arrows 100% (112/112) 100% (112/112) 100% (112/112)
U+2200 Mathematical Operators 96% (247/256) 39% (100/256) 56% (145/256)
U+2300 Miscellaneous Technical 27% (64/232) 6% (16/232) 50% (117/232)
U+2400 Control Pictures 5% (2/39) 2% (1/39) 2% (1/39)
U+2440 Optical Character Recognition (0/11) (0/11) (0/11)
U+2460 Enclosed Alphanumerics 6% (10/160) (0/160) (0/160)
U+2500 Box Drawing (0/128) (0/128) 100% (128/128)
U+2500 Box Drawing 100% (128/128) 100% (128/128) 100% (128/128)
U+2580 Block Elements 100% (32/32) 100% (32/32) 100% (32/32)
U+25a0 Geometric Shapes 100% (96/96) 100% (96/96) 100% (96/96)
U+2600 Miscellaneous Symbols 100% (176/176) 17% (30/176) 84% (149/176)
U+2700 Dingbats 100% (174/174) (0/174) 82% (144/174)
U+2700 Dingbats 100% (174/174) 0% (1/174) 82% (144/174)
U+27c0 Miscellaneous Mathematical Symbols-A 17% (7/39) 7% (3/39) 7% (3/39)
U+27f0 Supplemental Arrows-A 100% (16/16) (0/16) (0/16)
U+27f0 Supplemental Arrows-A 100% (16/16) 100% (16/16) (0/16)
U+2800 Braille Patterns 100% (256/256) 100% (256/256) (0/256)
U+2900 Supplemental Arrows-B 4% (6/128) (0/128) (0/128)
U+2900 Supplemental Arrows-B 4% (6/128) 100% (128/128) (0/128)
U+2980 Miscellaneous Mathematical Symbols-B 10% (13/128) 0% (1/128) 2% (3/128)
U+2a00 Supplemental Mathematical Operators 28% (72/256) 1% (4/256) 0% (1/256)
U+2b00 Miscellaneous Symbols and Arrows 100% (31/31) 29% (9/31) 29% (9/31)
U+2b00 Miscellaneous Symbols and Arrows 100% (31/31) 87% (27/31) 29% (9/31)
U+2c00 Glagolitic (0/94) (0/94) (0/94)
U+2c60 Latin Extended-C 100% (17/17) 52% (9/17) 17% (3/17)
U+2c80 Coptic (0/114) (0/114) (0/114)
@@ -106,11 +106,11 @@ U+31f0 Katakana Phonetic Extensions (0/16) (0/16)
U+3200 Enclosed CJK Letters and Months (0/242) (0/242) (0/242)
U+3300 CJK Compatibility (0/256) (0/256) (0/256)
U+3400 CJK Unified Ideographs Extension A (0/0) (0/0) (0/0)
U+4dc0 Yijing Hexagram Symbols (0/64) (0/64) (0/64)
U+4dc0 Yijing Hexagram Symbols 100% (64/64) (0/64) (0/64)
U+4e00 CJK Unified Ideographs (0/0) (0/0) (0/0)
U+a000 Yi Syllables (0/1165) (0/1165) (0/1165)
U+a490 Yi Radicals (0/55) (0/55) (0/55)
U+a700 Modifier Tone Letters (0/27) (0/27) (0/27)
U+a700 Modifier Tone Letters 18% (5/27) (0/27) (0/27)
U+a720 Latin Extended-D (0/2) (0/2) (0/2)
U+a800 Syloti Nagri (0/44) (0/44) (0/44)
U+a840 Phags-pa (0/56) (0/56) (0/56)
@@ -124,12 +124,12 @@ U+fb00 Alphabetic Presentation Forms 100% (58/58) 12% (7/58)
U+fb50 Arabic Presentation Forms-A 11% (70/595) (0/595) 12% (72/595)
U+fe00 Variation Selectors 100% (16/16) 100% (16/16) (0/16)
U+fe10 Vertical Forms (0/10) (0/10) (0/10)
U+fe20 Combining Half Marks (0/4) (0/4) (0/4)
U+fe20 Combining Half Marks 100% (4/4) (0/4) (0/4)
U+fe30 CJK Compatibility Forms (0/32) (0/32) (0/32)
U+fe50 Small Form Variants (0/26) (0/26) (0/26)
U+fe70 Arabic Presentation Forms-B 100% (141/141) (0/141) 100% (141/141)
U+ff00 Halfwidth and Fullwidth Forms (0/225) (0/225) (0/225)
U+fff0 Specials 20% (1/5) 20% (1/5) 20% (1/5)
U+fff0 Specials 100% (5/5) 100% (5/5) 100% (5/5)
U+10000 Linear B Syllabary (0/88) (0/88) (0/88)
U+10080 Linear B Ideograms (0/123) (0/123) (0/123)
U+10100 Aegean Numbers (0/57) (0/57) (0/57)
@@ -151,7 +151,7 @@ U+1d100 Musical Symbols (0/219) (0/219)
U+1d200 Ancient Greek Musical Notation (0/70) (0/70) (0/70)
U+1d300 Tai Xuan Jing Symbols 100% (87/87) (0/87) (0/87)
U+1d360 Counting Rod Numerals (0/18) (0/18) (0/18)
U+1d400 Mathematical Alphanumeric Symbols 4% (45/996) (0/996) (0/996)
U+1d400 Mathematical Alphanumeric Symbols 10% (107/996) 5% (55/996) 6% (62/996)
U+20000 CJK Unified Ideographs Extension B (0/0) (0/0) (0/0)
U+2f800 CJK Compatibility Ideographs Supplement (0/542) (0/542) (0/542)
U+e0000 Tags (0/98) (0/98) (0/98)
@@ -0,0 +1,328 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXBuildFile section */
17085DDA0939627C000D0081 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17085DD90939627C000D0081 /* Carbon.framework */; };
174E80980A57DFA5003FB108 /* url map.plist in Resources */ = {isa = PBXBuildFile; fileRef = 174E80970A57DFA5003FB108 /* url map.plist */; };
1796636A093A122C00138851 /* Edit in ODBEditor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 17966367093A122C00138851 /* Edit in ODBEditor.mm */; };
1796636B093A122C00138851 /* NSTextView: Edit in ODBEditor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 17966368093A122C00138851 /* NSTextView: Edit in ODBEditor.mm */; };
1796636C093A122C00138851 /* WebView: Edit in ODBEditor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 17966369093A122C00138851 /* WebView: Edit in ODBEditor.mm */; };
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
17085DD90939627C000D0081 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
174E80970A57DFA5003FB108 /* url map.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = "url map.plist"; sourceTree = "<group>"; };
17966367093A122C00138851 /* Edit in ODBEditor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "Edit in ODBEditor.mm"; path = "src/Edit in ODBEditor.mm"; sourceTree = "<group>"; };
17966368093A122C00138851 /* NSTextView: Edit in ODBEditor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "NSTextView: Edit in ODBEditor.mm"; path = "src/NSTextView: Edit in ODBEditor.mm"; sourceTree = "<group>"; };
17966369093A122C00138851 /* WebView: Edit in ODBEditor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "WebView: Edit in ODBEditor.mm"; path = "src/WebView: Edit in ODBEditor.mm"; sourceTree = "<group>"; };
32DBCF630370AF2F00C91783 /* Edit in ODBEditor_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Edit in ODBEditor_Prefix.pch"; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* Edit in ODBEditor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Edit in ODBEditor.bundle"; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D5B49B3048680CD000E48DA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
17085DDA0939627C000D0081 /* Carbon.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
089C166AFE841209C02AAC07 /* Edit in TextMate */ = {
isa = PBXGroup;
children = (
08FB77AFFE84173DC02AAC07 /* Classes */,
32C88E010371C26100C91783 /* Other Sources */,
089C167CFE841241C02AAC07 /* Resources */,
089C1671FE841209C02AAC07 /* Frameworks and Libraries */,
19C28FB8FE9D52D311CA2CBB /* Products */,
);
name = "Edit in TextMate";
sourceTree = "<group>";
};
089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
17085DD90939627C000D0081 /* Carbon.framework */,
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */,
1058C7AEFEA557BF11CA2CBB /* Other Frameworks */,
);
name = "Frameworks and Libraries";
sourceTree = "<group>";
};
089C167CFE841241C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
174E80970A57DFA5003FB108 /* url map.plist */,
8D5B49B7048680CD000E48DA /* Info.plist */,
089C167DFE841241C02AAC07 /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup;
children = (
17966367093A122C00138851 /* Edit in ODBEditor.mm */,
17966368093A122C00138851 /* NSTextView: Edit in ODBEditor.mm */,
17966369093A122C00138851 /* WebView: Edit in ODBEditor.mm */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
089C167FFE841241C02AAC07 /* AppKit.framework */,
D2F7E65807B2D6F200F64583 /* CoreData.framework */,
089C1672FE841209C02AAC07 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FB8FE9D52D311CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D5B49B6048680CD000E48DA /* Edit in ODBEditor.bundle */,
);
name = Products;
sourceTree = "<group>";
};
32C88E010371C26100C91783 /* Other Sources */ = {
isa = PBXGroup;
children = (
32DBCF630370AF2F00C91783 /* Edit in ODBEditor_Prefix.pch */,
);
name = "Other Sources";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D5B49AC048680CD000E48DA /* Edit in ODBEditor */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "Edit in ODBEditor" */;
buildPhases = (
8D5B49AF048680CD000E48DA /* Resources */,
8D5B49B1048680CD000E48DA /* Sources */,
8D5B49B3048680CD000E48DA /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "Edit in ODBEditor";
productInstallPath = "$(HOME)/Library/Bundles";
productName = "Edit in TextMate";
productReference = 8D5B49B6048680CD000E48DA /* Edit in ODBEditor.bundle */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "Edit in ODBEditor" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 089C166AFE841209C02AAC07 /* Edit in TextMate */;
projectDirPath = "";
projectRoot = "";
targets = (
8D5B49AC048680CD000E48DA /* Edit in ODBEditor */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D5B49AF048680CD000E48DA /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */,
174E80980A57DFA5003FB108 /* url map.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D5B49B1048680CD000E48DA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1796636A093A122C00138851 /* Edit in ODBEditor.mm in Sources */,
1796636B093A122C00138851 /* NSTextView: Edit in ODBEditor.mm in Sources */,
1796636C093A122C00138851 /* WebView: Edit in ODBEditor.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C167EFE841241C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
1DD3D5530D82D8D7006E4320 /* Universal */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Edit in ODBEditor_Prefix.pch";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "";
OTHER_LDFLAGS = (
"-undefined",
dynamic_lookup,
);
PRODUCT_NAME = "Edit in ODBEditor";
SYMROOT = ../build;
WRAPPER_EXTENSION = bundle;
};
name = Universal;
};
1DD3D5540D82D8D7006E4320 /* Universal */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Universal;
};
1DEB913B08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Edit in ODBEditor_Prefix.pch";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "";
OTHER_LDFLAGS = (
"-undefined",
dynamic_lookup,
);
PRODUCT_NAME = "Edit in ODBEditor";
SYMROOT = ../build;
WRAPPER_EXTENSION = bundle;
ZERO_LINK = YES;
};
name = Debug;
};
1DEB913C08733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Edit in ODBEditor_Prefix.pch";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "";
OTHER_LDFLAGS = (
"-undefined",
dynamic_lookup,
);
PRODUCT_NAME = "Edit in ODBEditor";
SYMROOT = ../build;
WRAPPER_EXTENSION = bundle;
};
name = Release;
};
1DEB913F08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Debug;
};
1DEB914008733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_ENABLE_CPP_EXCEPTIONS = NO;
GCC_ENABLE_CPP_RTTI = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB913A08733D840010E9CD /* Build configuration list for PBXNativeTarget "Edit in ODBEditor" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB913B08733D840010E9CD /* Debug */,
1DEB913C08733D840010E9CD /* Release */,
1DD3D5530D82D8D7006E4320 /* Universal */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "Edit in ODBEditor" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB913F08733D840010E9CD /* Debug */,
1DEB914008733D840010E9CD /* Release */,
1DD3D5540D82D8D7006E4320 /* Universal */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 089C1669FE841209C02AAC07 /* Project object */;
}
@@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'Edit in ODBEditor' target in the 'Edit in ODBEditor' project.
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BundleName</key>
<string>Edit in ODBEditor.bundle</string>
<key>LoadBundleOnLaunch</key>
<string>YES</string>
<key>LocalizedNames</key>
<dict>
<key>English</key>
<string>Edit in ODBEditor</string>
</dict>
<key>NoMenuEntry</key>
<string>YES</string>
</dict>
</plist>
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.slashpunt.edit_in_odbeditor</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2</string>
<key>NSPrincipalClass</key>
<string>EditInODBEditor</string>
</dict>
</plist>
+2
View File
@@ -0,0 +1,2 @@
all:
xcodebuild
@@ -0,0 +1,16 @@
//
// Edit in ODBEditor.h
//
// Created by Allan Odgaard on 2005-11-26.
// See LICENSE for license details
//
// Generalized by Chris Eidhof and Eelco Lempsink from 'Edit in TextMate.h'
#import <Cocoa/Cocoa.h>
@interface EditInODBEditor : NSObject
{
}
+ (void)externalEditString:(NSString*)aString startingAtLine:(int)aLine forView:(NSView*)aView;
+ (void)externalEditString:(NSString*)aString startingAtLine:(int)aLine forView:(NSView*)aView withObject:(NSObject*)anObject;
@end
@@ -0,0 +1,287 @@
//
// Edit in ODBEditor.mm
//
// Created by Allan Odgaard on 2005-11-26.
// See LICENSE for license details
//
// Generalized by Chris Eidhof and Eelco Lempsink from 'Edit in TextMate.mm'
#import <WebKit/WebKit.h>
#import <Carbon/Carbon.h>
#import <map>
#import "Edit in ODBEditor.h"
// from ODBEditorSuite.h
#define keyFileSender 'FSnd'
#define kODBEditorSuite 'R*ch'
#define kAEModifiedFile 'FMod'
#define kAEClosedFile 'FCls'
static NSMutableDictionary* OpenFiles;
static NSMutableSet* FailedFiles;
static NSString* ODBEditorBundleIdentifier;
static NSString* ODBEditorName;
#pragma options align=mac68k
struct PBX_SelectionRange
{
short unused1; // 0 (not used)
short lineNum; // line to select (<0 to specify range)
long startRange; // start of selection range (if line < 0)
long endRange; // end of selection range (if line < 0)
long unused2; // 0 (not used)
long theDate; // modification date/time
};
#pragma options align=reset
@implementation EditInODBEditor
+ (void)setODBEventHandlers
{
NSAppleEventManager* eventManager = [NSAppleEventManager sharedAppleEventManager];
[eventManager setEventHandler:self andSelector:@selector(handleModifiedFileEvent:withReplyEvent:) forEventClass:kODBEditorSuite andEventID:kAEModifiedFile];
[eventManager setEventHandler:self andSelector:@selector(handleClosedFileEvent:withReplyEvent:) forEventClass:kODBEditorSuite andEventID:kAEClosedFile];
}
+ (void)removeODBEventHandlers
{
NSAppleEventManager* eventManager = [NSAppleEventManager sharedAppleEventManager];
[eventManager removeEventHandlerForEventClass:kODBEditorSuite andEventID:kAEModifiedFile];
[eventManager removeEventHandlerForEventClass:kODBEditorSuite andEventID:kAEClosedFile];
}
+ (BOOL)launchODBEditor
{
NSArray* array = [[NSWorkspace sharedWorkspace] launchedApplications];
for(unsigned i = [array count]; --i; )
{
if([[[array objectAtIndex:i] objectForKey:@"NSApplicationBundleIdentifier"] isEqualToString:ODBEditorBundleIdentifier])
return YES;
}
return [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:ODBEditorBundleIdentifier options:0L additionalEventParamDescriptor:nil launchIdentifier:nil];
}
+ (void)asyncEditStringWithOptions:(NSDictionary*)someOptions
{
NSAutoreleasePool* pool = [NSAutoreleasePool new];
if(![self launchODBEditor])
return;
/* =========== */
NSData* targetBundleID = [ODBEditorBundleIdentifier dataUsingEncoding:NSUTF8StringEncoding];
NSAppleEventDescriptor* targetDescriptor = [NSAppleEventDescriptor descriptorWithDescriptorType:typeApplicationBundleID data:targetBundleID];
NSAppleEventDescriptor* appleEvent = [NSAppleEventDescriptor appleEventWithEventClass:kCoreEventClass eventID:kAEOpenDocuments targetDescriptor:targetDescriptor returnID:kAutoGenerateReturnID transactionID:kAnyTransactionID];
NSAppleEventDescriptor* replyDescriptor = nil;
NSAppleEventDescriptor* errorDescriptor = nil;
AEDesc reply = { typeNull, NULL };
NSString* fileName = [someOptions objectForKey:@"fileName"];
[appleEvent setParamDescriptor:[NSAppleEventDescriptor descriptorWithDescriptorType:typeFileURL data:[[[NSURL fileURLWithPath:fileName] absoluteString] dataUsingEncoding:NSUTF8StringEncoding]] forKeyword:keyDirectObject];
UInt32 packageType = 0, packageCreator = 0;
CFBundleGetPackageInfo(CFBundleGetMainBundle(), &packageType, &packageCreator);
[appleEvent setParamDescriptor:[NSAppleEventDescriptor descriptorWithTypeCode:packageCreator] forKeyword:keyFileSender];
if(int line = [[someOptions objectForKey:@"line"] intValue])
{
PBX_SelectionRange pos = { };
pos.lineNum = line;
[appleEvent setParamDescriptor:[NSAppleEventDescriptor descriptorWithDescriptorType:typeChar bytes:&pos length:sizeof(pos)] forKeyword:keyAEPosition];
}
OSStatus status = AESend([appleEvent aeDesc], &reply, kAEWaitReply, kAENormalPriority, kAEDefaultTimeout, NULL, NULL);
if(status == noErr)
{
replyDescriptor = [[[NSAppleEventDescriptor alloc] initWithAEDescNoCopy:&reply] autorelease];
errorDescriptor = [replyDescriptor paramDescriptorForKeyword:keyErrorNumber];
if(errorDescriptor != nil)
status = [errorDescriptor int32Value];
if(status != noErr)
NSLog(@"%s error %d", _cmd, status), NSBeep();
}
[pool release];
}
+ (NSString*)extensionForURL:(NSURL*)anURL
{
NSString* res = nil;
if(NSString* urlString = [anURL absoluteString])
{
NSString* path = [[NSBundle bundleForClass:[self class]] pathForResource:@"url map" ofType:@"plist"];
NSMutableDictionary* map = [NSMutableDictionary dictionaryWithContentsOfFile:path];
NSString* customBindingsPath = [[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"Preferences/org.slashpunt.edit_in_odbeditor.plist"];
if(NSDictionary* associations = [[NSDictionary dictionaryWithContentsOfFile:customBindingsPath] objectForKey:@"URLAssociations"])
[map addEntriesFromDictionary:associations];
unsigned longestMatch = 0;
NSEnumerator* enumerator = [map keyEnumerator];
while(NSString* key = [enumerator nextObject])
{
if([urlString rangeOfString:key].location != NSNotFound && [key length] > longestMatch)
{
res = [map objectForKey:key];
longestMatch = [key length];
}
}
}
return res;
}
+ (void)externalEditString:(NSString*)aString startingAtLine:(int)aLine forView:(NSView*)aView
{
[self externalEditString:aString startingAtLine:aLine forView:aView withObject:nil];
}
+ (void)externalEditString:(NSString*)aString startingAtLine:(int)aLine forView:(NSView*)aView withObject:(NSObject*)anObject
{
Class cl = NSClassFromString(@"WebFrameView");
NSURL* url = nil;
for(NSView* view = aView; view && !url && cl; view = [view superview])
{
if([view isKindOfClass:cl])
url = [[[[(WebFrameView*)view webFrame] dataSource] mainResource] URL];
}
NSString* basename = [[[[aView window] title] componentsSeparatedByString:@"/"] componentsJoinedByString:@"-"] ?: @"untitled";
NSString* extension = [self extensionForURL:url] ?: [[[[NSWorkspace sharedWorkspace] activeApplication] objectForKey:@"NSApplicationName"] lowercaseString];
NSString* fileName = [NSString stringWithFormat:@"%@/%@.%@", NSTemporaryDirectory(), basename, extension];
for(unsigned i = 2; [[NSFileManager defaultManager] fileExistsAtPath:fileName]; i++)
fileName = [NSString stringWithFormat:@"%@/%@ %u.%@", NSTemporaryDirectory(), basename, i, extension];
[[aString dataUsingEncoding:NSUTF8StringEncoding] writeToFile:fileName atomically:NO];
fileName = [fileName stringByStandardizingPath];
NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
aString, @"string",
aView, @"view",
fileName, @"fileName",
[NSNumber numberWithInt:aLine], @"line",
anObject, @"object", /* last since anObject might be nil */
nil];
[OpenFiles setObject:options forKey:[fileName precomposedStringWithCanonicalMapping]];
if([OpenFiles count] == 1)
[self setODBEventHandlers];
[NSThread detachNewThreadSelector:@selector(asyncEditStringWithOptions:) toTarget:self withObject:options];
}
+ (void)handleModifiedFileEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
NSAppleEventDescriptor* fileURL = [[event paramDescriptorForKeyword:keyDirectObject] coerceToDescriptorType:typeFileURL];
NSString* urlString = [[[NSString alloc] initWithData:[fileURL data] encoding:NSUTF8StringEncoding] autorelease];
NSString* fileName = [[[NSURL URLWithString:urlString] path] stringByStandardizingPath];
NSDictionary* options = [OpenFiles objectForKey:[fileName precomposedStringWithCanonicalMapping]];
NSView* view = [options objectForKey:@"view"];
if([view window])
{
if ([view respondsToSelector:@selector(odbEditorDidModifyString:withObject:)])
{
NSString* newString = [[[NSString alloc] initWithData:[NSData dataWithContentsOfFile:fileName] encoding:NSUTF8StringEncoding] autorelease];
NSObject* anObject = [options objectForKey:@"object"];
[view performSelector:@selector(odbEditorDidModifyString:withObject:) withObject:newString withObject:anObject];
[FailedFiles removeObject:fileName];
fileName = nil;
}
else if([view respondsToSelector:@selector(odbEditorDidModifyString:)])
{
NSString* newString = [[[NSString alloc] initWithData:[NSData dataWithContentsOfFile:fileName] encoding:NSUTF8StringEncoding] autorelease];
[view performSelector:@selector(odbEditorDidModifyString:) withObject:newString];
[FailedFiles removeObject:fileName];
fileName = nil;
}
}
if (fileName)
{
[FailedFiles addObject:fileName];
NSLog(@"%s view %p, %@, window %@", _cmd, view, view, [view window]);
NSLog(@"%s file name %@, options %@", _cmd, fileName, [options description]);
NSLog(@"%s all %@", _cmd, [OpenFiles description]);
NSBeep();
}
}
+ (void)handleClosedFileEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
NSAppleEventDescriptor* fileURL = [[event paramDescriptorForKeyword:keyDirectObject] coerceToDescriptorType:typeFileURL];
NSString* urlString = [[[NSString alloc] initWithData:[fileURL data] encoding:NSUTF8StringEncoding] autorelease];
NSString* fileName = [[[NSURL URLWithString:urlString] path] stringByStandardizingPath];
if([FailedFiles containsObject:fileName])
{
if([[NSFileManager defaultManager] fileExistsAtPath:fileName])
[[NSWorkspace sharedWorkspace] selectFile:fileName inFileViewerRootedAtPath:[fileName stringByDeletingLastPathComponent]];
[FailedFiles removeObject:fileName];
}
else
{
[[NSFileManager defaultManager] removeFileAtPath:fileName handler:nil];
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
}
[OpenFiles removeObjectForKey:[fileName precomposedStringWithCanonicalMapping]];
if([OpenFiles count] == 0)
[self removeODBEventHandlers];
}
+ (NSMenu*)findEditMenu
{
NSMenu* mainMenu = [NSApp mainMenu];
std::map<size_t, NSMenu*> ranked;
for(int i = 0; i != [mainMenu numberOfItems]; i++)
{
NSMenu* candidate = [[mainMenu itemAtIndex:i] submenu];
static SEL const actions[] = { @selector(undo:), @selector(redo:), @selector(cut:), @selector(copy:), @selector(paste:), @selector(delete:), @selector(selectAll:) };
size_t score = 0;
for(int j = 0; j != sizeof(actions)/sizeof(actions[0]); j++)
{
if(-1 != [candidate indexOfItemWithTarget:nil andAction:actions[j]])
score++;
}
if(score > 0 && ranked.find(score) == ranked.end())
ranked[score] = candidate;
}
return ranked.empty() ? nil : (--ranked.end())->second;
}
+ (void)installMenuItem:(id)sender
{
if(NSMenu* editMenu = [self findEditMenu])
{
[editMenu addItem:[NSMenuItem separatorItem]];
NSString* ellips = [NSString stringWithUTF8String:"\xe2\x80\xa6"]; // utf-8 for the '...' character (literal utf8 is not allowed in source code)
id <NSMenuItem> menuItem = [editMenu addItemWithTitle:[NSString stringWithFormat:@"Edit in %@%@", ODBEditorName, ellips] action:@selector(editInODBEditor:) keyEquivalent:@"E"];
[menuItem setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask];
}
}
+ (void)load
{
OpenFiles = [NSMutableDictionary new];
FailedFiles = [NSMutableSet new];
NSString* mainBundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; // reads app we're used inside off
NSString* bundleIdentifier = @"org.slashpunt.edit_in_odbeditor"; // XXX Should this be hardcoded?
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults addSuiteNamed:bundleIdentifier];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
@"NO", @"DisableEditInODBEditorMenuItem",
@"", @"ODBEditorBundleIdentifier",
@"<Unknown>", @"ODBEditorName",
nil];
[defaults registerDefaults:appDefaults];
ODBEditorBundleIdentifier = [[defaults stringForKey:@"ODBEditorBundleIdentifier"] retain] ?: @"";
ODBEditorName = [[defaults stringForKey:@"ODBEditorName"] retain] ?: @"<Unknown>";
if([defaults boolForKey:@"DisableEditInODBEditorMenuItem"] == NO
&& ![ODBEditorBundleIdentifier isEqualToString:@""]
&& ![ODBEditorBundleIdentifier isEqualToString:mainBundleIdentifier])
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(installMenuItem:) name:NSApplicationDidFinishLaunchingNotification object:[NSApplication sharedApplication]];
}
@end
@@ -0,0 +1,60 @@
//
// NSTextView: Edit in ODBEditor.mm
//
// Created by Allan Odgaard on 2005-11-27.
// See LICENSE for license details
//
// Generalized by Chris Eidhof and Eelco Lempsink from 'NSTextView: Edit in TextMate.mm'
#import "Edit in ODBEditor.h"
@interface NSTextView (EditInODBEditor)
- (void)editInODBEditor:(id)sender;
@end
@implementation NSTextView (EditInODBEditor)
- (void)editInODBEditor:(id)sender
{
if(![self isEditable])
return (void)NSBeep();
NSString* str = [[self textStorage] string];
NSRange selectedRange = [self selectedRange];
int lineNumber = 0;
if(selectedRange.length == 0)
{
NSRange range = NSMakeRange(0, 0);
do {
NSRange oldRange = range;
range = [str lineRangeForRange:NSMakeRange(NSMaxRange(range), 0)];
if(NSMaxRange(oldRange) == NSMaxRange(range) || selectedRange.location < NSMaxRange(range))
break;
lineNumber++;
} while(true);
selectedRange = NSMakeRange(0, [str length]);
}
[EditInODBEditor externalEditString:[str substringWithRange:selectedRange] startingAtLine:lineNumber forView:self];
}
- (void)odbEditorDidModifyString:(NSString*)newString
{
NSRange selectedRange = [self selectedRange];
BOOL hadSelection = selectedRange.length != 0;
selectedRange = hadSelection ? selectedRange : NSMakeRange(0, [[self textStorage] length]);
if([self shouldChangeTextInRange:selectedRange replacementString:newString])
{
if(!hadSelection)
[self setSelectedRange:NSMakeRange(0, [[self textStorage] length])];
[self insertText:newString];
if(hadSelection)
[self setSelectedRange:NSMakeRange(selectedRange.location, [newString length])];
[self didChangeText];
}
else
{
NSBeep();
NSLog(@"%s couldn't edit text", _cmd);
}
}
@end
@@ -0,0 +1,410 @@
//
// WebView: Edit in ODBEditor.mm
//
// Created by Allan Odgaard on 2005-11-27.
// See LICENSE for license details
//
// Generalized by Chris Eidhof and Eelco Lempsink from 'WebView: Edit in TextMate.mm'
#import <WebKit/WebKit.h>
#import <vector>
#import "Edit in ODBEditor.h"
#ifndef sizeofA
#define sizeofA(x) (sizeof(x)/sizeof(x[0]))
#endif
// only latest WebKit has this stuff, and it is private
@interface DOMHTMLTextAreaElement (DOMHTMLTextAreaElementPrivate)
- (int)selectionStart;
- (void)setSelectionStart:(int)newSelectionStart;
- (int)selectionEnd;
- (void)setSelectionEnd:(int)newSelectionEnd;
- (void)setSelectionRange:(int)start end:(int)end;
@end
@interface WebView (EditInODBEditor)
- (void)editInODBEditor:(id)sender;
@end
@interface NSString (EditInODBEditor)
- (NSString*)ODB_stringByTrimmingWhitespace;
- (NSString*)ODB_stringByReplacingString:(NSString*)aSearchString withString:(NSString*)aReplaceString;
- (NSString*)ODB_stringByNbspEscapingSpaces;
@end
@implementation NSString (EditInODBEditor)
- (NSString*)ODB_stringByTrimmingWhitespace
{
NSString* str = self;
while([str hasPrefix:@" "])
str = [str substringFromIndex:1];
while([str hasSuffix:@" "])
str = [str substringToIndex:[str length]-1];
return str;
}
- (NSString*)ODB_stringByReplacingString:(NSString*)aSearchString withString:(NSString*)aReplaceString
{
return [[self componentsSeparatedByString:aSearchString] componentsJoinedByString:aReplaceString];
}
- (NSString*)ODB_stringByNbspEscapingSpaces
{
unsigned len = [self length];
unichar* buf = new unichar[len];
[self getCharacters:buf];
for(unsigned i = 0; i != len; i++)
{
if(buf[i] == ' ' && (i+1 == len || buf[i+1] == ' '))
buf[i] = 0xA0;
}
return [NSString stringWithCharacters:buf length:len];
}
@end
struct convert_dom_to_text
{
convert_dom_to_text (DOMTreeWalker* treeWalker) : string([NSMutableString new]), quoteLevel(0), pendingFlush(NO), pendingWhitespace(NO), didOutputText(NO), atBeginOfLine(YES) { visit_nodes(treeWalker); }
~convert_dom_to_text () { [string autorelease]; }
operator NSString* () const { return string; }
private:
void enter_block_tag ()
{
pendingFlush |= didOutputText;
didOutputText = NO;
pendingWhitespace = NO;
}
void leave_block_tag ()
{
pendingFlush |= didOutputText;
didOutputText = NO;
pendingWhitespace = NO;
}
void output_text (NSString* str)
{
if([str isEqualToString:@""])
return;
str = [str ODB_stringByTrimmingWhitespace];
if([str isEqualToString:@""])
{
pendingWhitespace = YES;
return;
}
str = [str ODB_stringByReplacingString:[NSString stringWithUTF8String:" "] withString:@" "];
if(pendingFlush)
{
[string appendString:@"\n"];
pendingFlush = NO;
atBeginOfLine = YES;
}
if(atBeginOfLine && quoteLevel)
{
for(unsigned i = 0; i < quoteLevel; i++)
[string appendString:@"> "];
}
else if(!atBeginOfLine && pendingWhitespace)
{
[string appendString:@" "];
}
[string appendString:str];
atBeginOfLine = NO;
didOutputText = YES;
pendingWhitespace = NO;
}
void visit_nodes (DOMTreeWalker* treeWalker);
NSMutableString* string;
unsigned quoteLevel;
BOOL pendingFlush;
BOOL pendingWhitespace;
BOOL didOutputText;
BOOL atBeginOfLine;
};
struct helper
{
helper (DOMHTMLTextAreaElement* textArea) : textArea(textArea)
{
value = [textArea value];
selectionStart = [textArea selectionStart];
selectionEnd = [textArea selectionEnd];
}
helper () : textArea(nil), value(nil) { }
bool should_change () const { return selectionStart != 0 || selectionEnd != [value length]; }
bool did_change () const { return selectionStart != [textArea selectionStart] || selectionEnd != [textArea selectionEnd]; }
void reset () const
{
if([textArea value] != value) [textArea setValue:value];
if(did_change()) [textArea setSelectionRange:selectionStart end:selectionEnd];
}
static bool usable (DOMNode* node)
{
static SEL const selectors[] = { @selector(selectionStart), @selector(selectionEnd), @selector(setSelectionStart:), @selector(setSelectionEnd:), @selector(value), @selector(setValue:), @selector(setSelectionRange:end:) };
BOOL res = [node isKindOfClass:[DOMHTMLTextAreaElement class]] && ![(DOMHTMLTextAreaElement*)node disabled] && ![(DOMHTMLTextAreaElement*)node readOnly];
for(size_t i = 0; i < sizeofA(selectors); ++i)
res = res && [node respondsToSelector:selectors[i]];
return res;
}
DOMHTMLTextAreaElement* textArea;
NSString* value;
unsigned long selectionStart;
unsigned long selectionEnd;
};
void convert_dom_to_text::visit_nodes (DOMTreeWalker* treeWalker)
{
for(DOMNode* node = [treeWalker currentNode]; node; node = [treeWalker nextSibling])
{
if([node nodeType] == DOM_TEXT_NODE)
output_text([node nodeValue]);
else if([[[node nodeName] uppercaseString] isEqualToString:@"BR"])
output_text(@"\n"), (atBeginOfLine = YES), (didOutputText = NO);
else if([[[node nodeName] uppercaseString] isEqualToString:@"DIV"])
enter_block_tag();
else if([[[node nodeName] uppercaseString] isEqualToString:@"BLOCKQUOTE"])
enter_block_tag(), ++quoteLevel;
else if([[[node nodeName] uppercaseString] isEqualToString:@"P"])
enter_block_tag();
if([treeWalker firstChild])
{
visit_nodes(treeWalker);
[treeWalker parentNode];
}
if([[[node nodeName] uppercaseString] isEqualToString:@"DIV"])
leave_block_tag();
else if([[[node nodeName] uppercaseString] isEqualToString:@"BLOCKQUOTE"])
leave_block_tag(), --quoteLevel;
else if([[[node nodeName] uppercaseString] isEqualToString:@"P"])
leave_block_tag();
}
}
static DOMHTMLTextAreaElement* find_active_text_area_for_frame (WebFrame* frame)
{
DOMHTMLTextAreaElement* res = nil;
DOMDocument* doc = [frame DOMDocument];
if([doc respondsToSelector:@selector(focusNode)])
{
// OmniWeb 5.6 has a method to get the focused node
res = [doc performSelector:@selector(focusNode)];
if(!helper::usable(res))
res = nil;
}
else
{
// The following is a heuristic for finding the active text area:
//
// 1. If there is just one text area, we use that.
//
// 2. If there are multiple, we ask the web view to “select all”
// which goes to the active text area (hopefully) and then we
// check which of the text areas in the DOM actually changed.
//
// There is a problem if either a text area has no content (in
// which case select all makes no changes) or if everything is
// already selected. If only one text area is in the state of
// “select all would not affect it” and no text areas were
// changed, we assume the one with that state is the active.
std::vector<helper> v;
DOMNodeList* textAreas = [doc getElementsByTagName:@"TEXTAREA"];
for(unsigned long i = 0; i < [textAreas length]; ++i)
{
if(helper::usable([textAreas item:i]))
v.push_back((DOMHTMLTextAreaElement*)[textAreas item:i]);
}
if(v.size() == 1)
{
res = v[0].textArea;
}
else if(v.size() > 1)
{
for(std::vector<helper>::iterator it = v.begin(); it != v.end(); ++it)
if (!it->should_change())
[it->textArea setValue:@" "];
[[frame webView] selectLine:nil];
size_t should_change = 0, did_change = 0;
for(std::vector<helper>::iterator it = v.begin(); it != v.end(); ++it)
{
did_change += it->did_change() ? 1 : 0;
should_change += it->should_change() ? 1 : 0;
}
if(did_change == 1)
{
for(std::vector<helper>::iterator it = v.begin(); it != v.end(); ++it)
res = it->did_change() ? it->textArea : res;
}
else if(did_change == 0 && should_change == v.size()-1)
{
for(std::vector<helper>::iterator it = v.begin(); it != v.end(); ++it)
res = !it->should_change() ? it->textArea : res;
}
for(std::vector<helper>::iterator it = v.begin(); it != v.end(); ++it)
it->reset();
}
}
return res;
}
static DOMHTMLTextAreaElement* find_active_text_area (WebView* view)
{
DOMHTMLTextAreaElement* res = nil;
if([view respondsToSelector:@selector(selectedFrame)])
res = find_active_text_area_for_frame([view performSelector:@selector(selectedFrame)]);
else
{
WebFrame* frame = [view mainFrame];
NSArray* frames = [[NSArray arrayWithObject: frame] arrayByAddingObjectsFromArray: [frame childFrames]];
for(unsigned i = 0; i != [frames count] && !res; i++)
res = find_active_text_area_for_frame([frames objectAtIndex:i]);
}
return res;
}
@implementation WebView (EditInODBEditor)
- (void)editInODBEditor:(id)sender
{
if([self isEditable])
{
// Mail uses an editable WebView, in which case we want to send the entire page to the ODB Editor
NSString* const CARET = [NSString stringWithFormat:@"%C", 0xFFFD];
NSString* str = @"";
int lineNumber = 0;
DOMDocumentFragment* selection = [[self selectedDOMRange] cloneContents];
if(!selection)
{
[self insertText:CARET]; // ugly hack, but we want to preserve the position of the caret
[self selectAll:nil];
selection = [[self selectedDOMRange] cloneContents];
// remove the caret marker. TODO we should start an undo group, so the (chunked) undo doesnt remove more than just the caret
if(NSUndoManager* undoManager = [self undoManager])
{
if([undoManager canUndo])
{
[undoManager undo];
[self selectAll:nil];
}
}
}
if(selection)
{
str = convert_dom_to_text([[[self mainFrame] DOMDocument] createTreeWalker:selection :DOM_SHOW_ALL :nil :YES]);
while([str hasSuffix:@"\n\n"])
str = [str substringToIndex:[str length]-1];
NSArray* split = [str componentsSeparatedByString:CARET];
if([split count] == 2)
{
lineNumber = [[[split objectAtIndex:0] componentsSeparatedByString:@"\n"] count] - 1;
str = [split componentsJoinedByString:@""];
}
}
[EditInODBEditor externalEditString:str startingAtLine:lineNumber forView:self];
}
else
{
// Likely the user wants to edit just a text area, so lets try to find which
if(DOMHTMLTextAreaElement* textArea = find_active_text_area(self))
{
NSString* str = [textArea value];
unsigned long selectionStart = [textArea selectionStart];
int lineNumber = 0;
NSRange range = NSMakeRange(0, 0);
do {
NSRange oldRange = range;
range = [str lineRangeForRange:NSMakeRange(NSMaxRange(range), 0)];
if(NSMaxRange(oldRange) == NSMaxRange(range) || selectionStart < NSMaxRange(range))
break;
lineNumber++;
} while(true);
[EditInODBEditor externalEditString:str startingAtLine:lineNumber forView:self withObject:textArea];
}
else NSBeep();
}
}
- (void)odbEditorDidModifyString:(NSString*)newString withObject:(NSObject*)textArea
{
if([self isEditable])
{
NSArray* lines = [newString componentsSeparatedByString:@"\n"];
NSMutableString* res = [NSMutableString string];
unsigned quoteLevel = 0;
for(unsigned i = 0; i != [lines count]; i++)
{
NSString* line = [lines objectAtIndex:i];
unsigned newQuoteLevel = 0;
while([line hasPrefix:@"> "])
{
line = [line substringFromIndex:2];
newQuoteLevel++;
}
if([line isEqualToString:@">"])
{
line = @"";
newQuoteLevel++;
}
if(newQuoteLevel > quoteLevel)
{
for(unsigned j = 0; j != newQuoteLevel - quoteLevel; j++)
[res appendString:@"<BLOCKQUOTE type=\"cite\">"];
}
else if(newQuoteLevel < quoteLevel)
{
for(unsigned j = 0; j != quoteLevel - newQuoteLevel; j++)
[res appendString:@"</BLOCKQUOTE>"];
}
quoteLevel = newQuoteLevel;
if([line isEqualToString:@""])
{
[res appendString:@"<DIV><BR></DIV>"];
}
else
{
line = [line ODB_stringByNbspEscapingSpaces];
line = [line ODB_stringByReplacingString:@"&" withString:@"&amp;"];
line = [line ODB_stringByReplacingString:@"<" withString:@"&lt;"];
line = [line ODB_stringByReplacingString:@">" withString:@"&gt;"];
[res appendFormat:@"<DIV>%@</DIV>", line];
}
}
[self replaceSelectionWithMarkupString:res];
if(![[self selectedDOMRange] cloneContents])
[self selectAll:nil];
}
else
{
[(DOMHTMLTextAreaElement*)textArea setValue:newString];
}
}
@end
+5
View File
@@ -0,0 +1,5 @@
{
'macromates.com/blog/' = 'markdown';
'blacktree.cocoaforge.com/forums/' = 'bbcode';
'mail.google.com/' = 'mail';
}
+370 -166
View File
@@ -32,7 +32,15 @@ static float MMMaxFontSize = 100.0f;
static NSFont *gui_macvim_font_with_name(char_u *name);
static BOOL gui_macvim_is_valid_action(NSString *action);
static int specialKeyToNSKey(int key);
static int vimModMaskToEventModifierFlags(int mods);
NSArray *descriptor_for_menu(vimmenu_T *menu);
vimmenu_T *menu_for_descriptor(NSArray *desc);
@interface NSString (VimStrings)
+ (id)stringWithVimString:(char_u *)s;
@end
@@ -418,6 +426,17 @@ gui_mch_new_colors(void)
foreground:gui.def_norm_pixel];
}
/*
* Invert a rectangle from row r, column c, for nr rows and nc columns.
*/
void
gui_mch_invert_rectangle(int r, int c, int nr, int nc, int invert)
{
[[MMBackend sharedInstance] drawInvertedRectAtRow:r column:c numRows:nr
numColumns:nc invert:invert];
}
// -- Tabline ---------------------------------------------------------------
@@ -480,44 +499,75 @@ clip_mch_own_selection(VimClipboard *cbd)
clip_mch_request_selection(VimClipboard *cbd)
{
NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSString *pbType = [pb availableTypeFromArray:
[NSArray arrayWithObject:NSStringPboardType]];
if (pbType) {
NSMutableString *string =
NSArray *supportedTypes = [NSArray arrayWithObjects:VimPBoardType,
NSStringPboardType, nil];
NSString *bestType = [pb availableTypeFromArray:supportedTypes];
if (!bestType) return;
int motion_type = MCHAR;
NSString *string = nil;
if ([bestType isEqual:VimPBoardType]) {
// This type should consist of an array with two objects:
// 1. motion type (NSNumber)
// 2. text (NSString)
// If this is not the case we fall back on using NSStringPboardType.
id plist = [pb propertyListForType:VimPBoardType];
if ([plist isKindOfClass:[NSArray class]] && [plist count] == 2) {
id obj = [plist objectAtIndex:1];
if ([obj isKindOfClass:[NSString class]]) {
motion_type = [[plist objectAtIndex:0] intValue];
string = obj;
}
}
}
if (!string) {
// Use NSStringPboardType. The motion type is set to line-wise if the
// string contains at least one EOL character, otherwise it is set to
// character-wise (block-wise is never used).
NSMutableString *mstring =
[[pb stringForType:NSStringPboardType] mutableCopy];
if (!mstring) return;
// Replace unrecognized end-of-line sequences with \x0a (line feed).
NSRange range = { 0, [string length] };
unsigned n = [string replaceOccurrencesOfString:@"\x0d\x0a"
NSRange range = { 0, [mstring length] };
unsigned n = [mstring replaceOccurrencesOfString:@"\x0d\x0a"
withString:@"\x0a" options:0
range:range];
if (0 == n) {
n = [string replaceOccurrencesOfString:@"\x0d" withString:@"\x0a"
n = [mstring replaceOccurrencesOfString:@"\x0d" withString:@"\x0a"
options:0 range:range];
}
// Scan for newline character to decide whether the string should be
// pasted linewise or characterwise.
int type = MCHAR;
if (0 < n || NSNotFound != [string rangeOfString:@"\n"].location)
type = MLINE;
// pasted line-wise or character-wise.
motion_type = MCHAR;
if (0 < n || NSNotFound != [mstring rangeOfString:@"\n"].location)
motion_type = MLINE;
char_u *str = (char_u*)[string UTF8String];
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
#ifdef FEAT_MBYTE
if (input_conv.vc_type != CONV_NONE)
str = string_convert(&input_conv, str, &len);
#endif
if (str)
clip_yank_selection(type, str, len, cbd);
#ifdef FEAT_MBYTE
if (input_conv.vc_type != CONV_NONE)
vim_free(str);
#endif
string = mstring;
}
if (!(MCHAR == motion_type || MLINE == motion_type || MBLOCK == motion_type
|| MAUTO == motion_type))
motion_type = MCHAR;
char_u *str = (char_u*)[string UTF8String];
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
#ifdef FEAT_MBYTE
if (input_conv.vc_type != CONV_NONE)
str = string_convert(&input_conv, str, &len);
#endif
if (str)
clip_yank_selection(motion_type, str, len, cbd);
#ifdef FEAT_MBYTE
if (input_conv.vc_type != CONV_NONE)
vim_free(str);
#endif
}
@@ -534,8 +584,8 @@ clip_mch_set_selection(VimClipboard *cbd)
// Get the text to put on the pasteboard.
long_u llen = 0; char_u *str = 0;
int type = clip_convert_selection(&str, &llen, cbd);
if (type < 0)
int motion_type = clip_convert_selection(&str, &llen, cbd);
if (motion_type < 0)
return;
// TODO: Avoid overflow.
@@ -554,9 +604,16 @@ clip_mch_set_selection(VimClipboard *cbd)
NSString *string = [[NSString alloc]
initWithBytes:str length:len encoding:NSUTF8StringEncoding];
// See clip_mch_request_selection() for info on pasteboard types.
NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb declareTypes:[NSArray arrayWithObject:NSStringPboardType]
owner:nil];
NSArray *supportedTypes = [NSArray arrayWithObjects:VimPBoardType,
NSStringPboardType, nil];
[pb declareTypes:supportedTypes owner:nil];
NSNumber *motion = [NSNumber numberWithInt:motion_type];
NSArray *plist = [NSArray arrayWithObjects:motion, string, nil];
[pb setPropertyList:plist forType:VimPBoardType];
[pb setString:string forType:NSStringPboardType];
[string release];
@@ -570,34 +627,61 @@ clip_mch_set_selection(VimClipboard *cbd)
/*
* Add a sub menu to the menu bar.
* A menu descriptor represents the "address" of a menu as an array of strings.
* E.g. the menu "File->Close" has descriptor { "File", "Close" }.
*/
NSArray *
descriptor_for_menu(vimmenu_T *menu)
{
if (!menu) return nil;
NSMutableArray *desc = [NSMutableArray array];
while (menu) {
NSString *name = [NSString stringWithVimString:menu->dname];
[desc insertObject:name atIndex:0];
menu = menu->parent;
}
return desc;
}
vimmenu_T *
menu_for_descriptor(NSArray *desc)
{
if (!(desc && [desc count] > 0)) return NULL;
vimmenu_T *menu = root_menu;
int i, count = [desc count];
for (i = 0; i < count; ++i) {
NSString *component = [desc objectAtIndex:i];
while (menu) {
NSString *name = [NSString stringWithVimString:menu->dname];
if ([component isEqual:name]) {
if (i+1 == count)
return menu; // Matched all components, so return menu
menu = menu->children;
break;
}
menu = menu->next;
}
}
return NULL;
}
/*
* Add a submenu to the menu bar, toolbar, or a popup menu.
*/
void
gui_mch_add_menu(vimmenu_T *menu, int idx)
{
// HACK! If menu has no parent, then we set the parent tag to the type of
// menu it is. This will not mix up tag and type because pointers can not
// take values close to zero (and the tag is simply the value of the
// pointer).
int parent = (int)menu->parent;
if (!parent) {
parent = menu_is_popup(menu->name) ? MenuPopupType :
menu_is_toolbar(menu->name) ? MenuToolbarType :
MenuMenubarType;
}
char_u *dname = menu->dname;
#ifdef FEAT_MBYTE
dname = CONVERT_TO_UTF8(dname);
#endif
[[MMBackend sharedInstance]
addMenuWithTag:(int)menu parent:parent name:(char*)dname
atIndex:idx];
#ifdef FEAT_MBYTE
CONVERT_TO_UTF8_FREE(dname);
#endif
NSArray *desc = descriptor_for_menu(menu);
[[MMBackend sharedInstance] queueMessage:AddMenuMsgID properties:
[NSDictionary dictionaryWithObjectsAndKeys:
desc, @"descriptor",
[NSNumber numberWithInt:idx], @"index",
nil]];
}
@@ -612,55 +696,25 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
char_u *icon = menu->iconfile ? menu->iconfile :
menu->iconidx >= 0 ? menu->dname :
NULL;
//char *name = menu_is_separator(menu->name) ? NULL : (char*)menu->dname;
char_u *name = menu->dname;
char_u *tip = menu->strings[MENU_INDEX_TIP]
? menu->strings[MENU_INDEX_TIP] : menu->actext;
char_u *map_str = menu->strings[MENU_INDEX_NORMAL];
NSArray *desc = descriptor_for_menu(menu);
NSString *keyEquivalent = menu->mac_key
? [NSString stringWithFormat:@"%C", specialKeyToNSKey(menu->mac_key)]
: [NSString string];
int modifierMask = vimModMaskToEventModifierFlags(menu->mac_mods);
#ifdef FEAT_MBYTE
icon = CONVERT_TO_UTF8(icon);
name = CONVERT_TO_UTF8(name);
tip = CONVERT_TO_UTF8(tip);
map_str = CONVERT_TO_UTF8(map_str);
#endif
// HACK! Check if menu is mapped to ':macaction actionName:'; if so, pass
// the action along so that MacVim can bind the menu item to this action.
// This means that if a menu item maps to an action in normal mode, then
// all other modes will also use the same action.
NSString *action = nil;
if (map_str) {
NSString *mapping = [NSString stringWithCString:(char*)map_str
encoding:NSUTF8StringEncoding];
NSArray *parts = [mapping componentsSeparatedByString:@" "];
if ([parts count] >=2
&& [[parts objectAtIndex:0] hasPrefix:@":maca"]) {
action = [parts objectAtIndex:1];
action = [action stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (!gui_macvim_is_valid_action(action))
action = nil;
}
}
[[MMBackend sharedInstance]
addMenuItemWithTag:(int)menu
parent:(int)menu->parent
name:(char*)name
tip:(char*)tip
icon:(char*)icon
keyEquivalent:menu->mac_key
modifiers:menu->mac_mods
action:action
atIndex:idx];
#ifdef FEAT_MBYTE
CONVERT_TO_UTF8_FREE(icon);
CONVERT_TO_UTF8_FREE(name);
CONVERT_TO_UTF8_FREE(tip);
CONVERT_TO_UTF8_FREE(map_str);
#endif
[[MMBackend sharedInstance] queueMessage:AddMenuItemMsgID properties:
[NSDictionary dictionaryWithObjectsAndKeys:
desc, @"descriptor",
[NSNumber numberWithInt:idx], @"index",
[NSString stringWithVimString:tip], @"tip",
[NSString stringWithVimString:icon], @"icon",
keyEquivalent, @"keyEquivalent",
[NSNumber numberWithInt:modifierMask], @"modifierMask",
[NSString stringWithVimString:menu->mac_action], @"action",
[NSNumber numberWithBool:menu->mac_alternate], @"isAlternate",
nil]];
}
@@ -670,7 +724,9 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
void
gui_mch_destroy_menu(vimmenu_T *menu)
{
[[MMBackend sharedInstance] removeMenuItemWithTag:(int)menu];
NSArray *desc = descriptor_for_menu(menu);
[[MMBackend sharedInstance] queueMessage:RemoveMenuItemMsgID properties:
[NSDictionary dictionaryWithObject:desc forKey:@"descriptor"]];
}
@@ -683,12 +739,17 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey)
/* Only update menu if the 'grey' state has changed to avoid having to pass
* lots of unnecessary data to MacVim. (Skipping this test makes MacVim
* pause noticably on mode changes. */
if (menu->was_grey != grey)
{
menu->was_grey = grey;
[[MMBackend sharedInstance]
enableMenuItemWithTag:(int)menu state:!grey];
}
NSArray *desc = descriptor_for_menu(menu);
if (menu->was_grey == grey)
return;
menu->was_grey = grey;
[[MMBackend sharedInstance] queueMessage:EnableMenuItemMsgID properties:
[NSDictionary dictionaryWithObjectsAndKeys:
desc, @"descriptor",
[NSNumber numberWithInt:!grey], @"enable",
nil]];
}
@@ -710,18 +771,9 @@ gui_mch_menu_hidden(vimmenu_T *menu, int hidden)
void
gui_mch_show_popupmenu(vimmenu_T *menu)
{
char_u *name = menu->name;
#ifdef FEAT_MBYTE
name = CONVERT_TO_UTF8(name);
#endif
[[MMBackend sharedInstance] showPopupMenuWithName:(char*)name
atMouseLocation:YES];
#ifdef FEAT_MBYTE
CONVERT_TO_UTF8_FREE(name);
#endif
NSArray *desc = descriptor_for_menu(menu);
[[MMBackend sharedInstance] queueMessage:ShowPopupMenuMsgID properties:
[NSDictionary dictionaryWithObject:desc forKey:@"descriptor"]];
}
@@ -731,16 +783,19 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
void
gui_make_popup(char_u *path_name, int mouse_pos)
{
#ifdef FEAT_MBYTE
path_name = CONVERT_TO_UTF8(path_name);
#endif
vimmenu_T *menu = gui_find_menu(path_name);
if (!(menu && menu->children)) return;
[[MMBackend sharedInstance] showPopupMenuWithName:(char*)path_name
atMouseLocation:mouse_pos];
NSArray *desc = descriptor_for_menu(menu);
NSDictionary *p = (mouse_pos || NULL == curwin)
? [NSDictionary dictionaryWithObject:desc forKey:@"descriptor"]
: [NSDictionary dictionaryWithObjectsAndKeys:
desc, @"descriptor",
[NSNumber numberWithInt:curwin->w_wrow], @"row",
[NSNumber numberWithInt:curwin->w_wcol], @"column",
nil];
#ifdef FEAT_MBYTE
CONVERT_TO_UTF8_FREE(path_name);
#endif
[[MMBackend sharedInstance] queueMessage:ShowPopupMenuMsgID properties:p];
}
@@ -1029,11 +1084,24 @@ gui_mch_draw_part_cursor(int w, int h, guicolor_T color)
// font dimensions. Thus these parameters are useless. Instead we look at
// the shape_table to determine the shape and size of the cursor (just like
// gui_update_cursor() does).
#ifdef FEAT_RIGHTLEFT
// If 'rl' is set the insert mode cursor must be drawn on the right-hand
// side of a text cell.
int rl = curwin ? curwin->w_p_rl : FALSE;
#else
int rl = FALSE;
#endif
int idx = get_shape_idx(FALSE);
int shape = MMInsertionPointBlock;
switch (shape_table[idx].shape) {
case SHAPE_HOR: shape = MMInsertionPointHorizontal; break;
case SHAPE_VER: shape = MMInsertionPointVertical; break;
case SHAPE_HOR:
shape = MMInsertionPointHorizontal;
break;
case SHAPE_VER:
shape = rl ? MMInsertionPointVerticalRight
: MMInsertionPointVertical;
break;
}
return [[MMBackend sharedInstance]
@@ -1165,12 +1233,12 @@ ex_macaction(eap)
arg = CONVERT_TO_UTF8(arg);
#endif
NSString *name = [NSString stringWithCString:(char*)arg
encoding:NSUTF8StringEncoding];
if (gui_macvim_is_valid_action(name)) {
NSDictionary *actionDict = [[MMBackend sharedInstance] actionDict];
NSString *name = [NSString stringWithUTF8String:(char*)arg];
if (actionDict && [actionDict objectForKey:name] != nil) {
[[MMBackend sharedInstance] executeActionWithName:name];
} else {
EMSG2(_("E???: \"%s\" is not a valid action"), eap->arg);
EMSG2(_("E???: Invalid action: %s"), eap->arg);
}
#ifdef FEAT_MBYTE
@@ -1229,6 +1297,9 @@ gui_mch_browse(
//NSLog(@"gui_mch_browse(saving=%d, title=%s, dflt=%s, ext=%s, initdir=%s,"
// " filter=%s", saving, title, dflt, ext, initdir, filter);
// Ensure no data is on the output queue before presenting the dialog.
gui_macvim_force_flush();
#ifdef FEAT_MBYTE
title = CONVERT_TO_UTF8(title);
initdir = CONVERT_TO_UTF8(initdir);
@@ -1262,6 +1333,9 @@ gui_mch_dialog(
// "dfltbutton=%d textfield=%s)", type, title, message, buttons,
// dfltbutton, textfield);
// Ensure no data is on the output queue before presenting the dialog.
gui_macvim_force_flush();
#ifdef FEAT_MBYTE
title = CONVERT_TO_UTF8(title);
message = CONVERT_TO_UTF8(message);
@@ -1391,15 +1465,6 @@ gui_mch_iconify(void)
}
/*
* Invert a rectangle from row r, column c, for nr rows and nc columns.
*/
void
gui_mch_invert_rectangle(int r, int c, int nr, int nc)
{
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Bring the Vim window to the foreground.
@@ -1475,32 +1540,11 @@ gui_mch_toggle_tearoffs(int enable)
}
static BOOL
gui_macvim_is_valid_action(NSString *action)
{
static NSDictionary *actionDict = nil;
if (!actionDict) {
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *path = [mainBundle pathForResource:@"Actions"
ofType:@"plist"];
if (path) {
actionDict = [[NSDictionary alloc] initWithContentsOfFile:path];
} else {
// Allocate bogus dictionary so that error only pops up once.
actionDict = [NSDictionary new];
EMSG(_("E???: Failed to load action dictionary"));
}
}
return [actionDict objectForKey:action] != nil;
}
void
gui_mch_enter_fullscreen()
gui_mch_enter_fullscreen(int fuoptions_flags, guicolor_T bg)
{
[[MMBackend sharedInstance] enterFullscreen];
[[MMBackend sharedInstance] enterFullscreen:fuoptions_flags background:bg];
}
@@ -1542,6 +1586,13 @@ gui_macvim_add_to_find_pboard(char_u *pat)
[pb setString:s forType:NSStringPboardType];
}
void
gui_macvim_set_antialias(int antialias)
{
[[MMBackend sharedInstance] setAntialias:antialias];
}
@@ -1827,3 +1878,156 @@ odb_end(void)
}
#endif // FEAT_ODB_EDITOR
char_u *
get_macaction_name(expand_T *xp, int idx)
{
static char_u *str = NULL;
NSDictionary *actionDict = [[MMBackend sharedInstance] actionDict];
if (nil == actionDict || idx < 0 || idx >= [actionDict count])
return NULL;
NSString *string = [[actionDict allKeys] objectAtIndex:idx];
if (!string)
return NULL;
char_u *plainStr = (char_u*)[string UTF8String];
#ifdef FEAT_MBYTE
if (str) {
vim_free(str);
str = NULL;
}
if (input_conv.vc_type != CONV_NONE) {
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
str = string_convert(&input_conv, plainStr, &len);
plainStr = str;
}
#endif
return plainStr;
}
int
is_valid_macaction(char_u *action)
{
int isValid = NO;
NSDictionary *actionDict = [[MMBackend sharedInstance] actionDict];
if (actionDict) {
#ifdef FEAT_MBYTE
action = CONVERT_TO_UTF8(action);
#endif
NSString *string = [NSString stringWithUTF8String:(char*)action];
isValid = (nil != [actionDict objectForKey:string]);
#ifdef FEAT_MBYTE
CONVERT_TO_UTF8_FREE(action);
#endif
}
return isValid;
}
static int specialKeyToNSKey(int key)
{
if (!IS_SPECIAL(key))
return key;
static struct {
int special;
int nskey;
} sp2ns[] = {
{ K_UP, NSUpArrowFunctionKey },
{ K_DOWN, NSDownArrowFunctionKey },
{ K_LEFT, NSLeftArrowFunctionKey },
{ K_RIGHT, NSRightArrowFunctionKey },
{ K_F1, NSF1FunctionKey },
{ K_F2, NSF2FunctionKey },
{ K_F3, NSF3FunctionKey },
{ K_F4, NSF4FunctionKey },
{ K_F5, NSF5FunctionKey },
{ K_F6, NSF6FunctionKey },
{ K_F7, NSF7FunctionKey },
{ K_F8, NSF8FunctionKey },
{ K_F9, NSF9FunctionKey },
{ K_F10, NSF10FunctionKey },
{ K_F11, NSF11FunctionKey },
{ K_F12, NSF12FunctionKey },
{ K_F13, NSF13FunctionKey },
{ K_F14, NSF14FunctionKey },
{ K_F15, NSF15FunctionKey },
{ K_F16, NSF16FunctionKey },
{ K_F17, NSF17FunctionKey },
{ K_F18, NSF18FunctionKey },
{ K_F19, NSF19FunctionKey },
{ K_F20, NSF20FunctionKey },
{ K_F21, NSF21FunctionKey },
{ K_F22, NSF22FunctionKey },
{ K_F23, NSF23FunctionKey },
{ K_F24, NSF24FunctionKey },
{ K_F25, NSF25FunctionKey },
{ K_F26, NSF26FunctionKey },
{ K_F27, NSF27FunctionKey },
{ K_F28, NSF28FunctionKey },
{ K_F29, NSF29FunctionKey },
{ K_F30, NSF30FunctionKey },
{ K_F31, NSF31FunctionKey },
{ K_F32, NSF32FunctionKey },
{ K_F33, NSF33FunctionKey },
{ K_F34, NSF34FunctionKey },
{ K_F35, NSF35FunctionKey },
{ K_DEL, NSBackspaceCharacter },
{ K_BS, NSDeleteCharacter },
{ K_HOME, NSHomeFunctionKey },
{ K_END, NSEndFunctionKey },
{ K_PAGEUP, NSPageUpFunctionKey },
{ K_PAGEDOWN, NSPageDownFunctionKey }
};
int i;
for (i = 0; i < sizeof(sp2ns)/sizeof(sp2ns[0]); ++i) {
if (sp2ns[i].special == key)
return sp2ns[i].nskey;
}
return 0;
}
static int vimModMaskToEventModifierFlags(int mods)
{
int flags = 0;
if (mods & MOD_MASK_SHIFT)
flags |= NSShiftKeyMask;
if (mods & MOD_MASK_CTRL)
flags |= NSControlKeyMask;
if (mods & MOD_MASK_ALT)
flags |= NSAlternateKeyMask;
if (mods & MOD_MASK_CMD)
flags |= NSCommandKeyMask;
return flags;
}
@implementation NSString (VimStrings)
+ (id)stringWithVimString:(char_u *)s
{
if (s) {
#ifdef FEAT_MBYTE
s = CONVERT_TO_UTF8(s);
#endif
NSString *string = [NSString stringWithUTF8String:(char*)s];
#ifdef FEAT_MBYTE
CONVERT_TO_UTF8_FREE(s);
#endif
return string;
}
return [NSString string];
}
@end
+73 -53
View File
@@ -1,7 +1,7 @@
" System gvimrc file for MacVim
"
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
" Last Change: Mon Feb 11 2008
" Last Change: Sun May 19 2008
"
" This is a work in progress. If you feel so inclined, please help me improve
" this file.
@@ -42,13 +42,15 @@ aunmenu File.-SEP4-
aunmenu File.Exit
aunmenu File.Save-Exit
an <silent> 10.290 File.New\ Window :maca newWindow:<CR>
an <silent> 10.290 File.New\ Window <Nop>
an 10.295 File.New\ Tab :tabnew<CR>
an <silent> 10.310 File.&Open\.\.\. :maca fileOpen:<CR>
an <silent> 10.310 File.Open\.\.\. <Nop>
an <silent> 10.325 File.Open\ Recent <Nop>
an 10.328 File.-SEP0- <Nop>
an <silent> 10.330 File.Close\ Window<Tab>:qa :confirm qa<CR>
an <silent> 10.331 File.Close :maca performClose:<CR>
"an 10.331 File.Close\ Tab :tabclose<CR>
an <silent> 10.330 File.Close\ Window<Tab>:qa :conf qa<CR>
an <silent> 10.332 File.Close :conf q<CR>
an <silent> 10.341 File.Save\ All :browse conf wa<CR>
an 10.350 File.Save\ As\.\.\.<Tab>:sav :browse confirm saveas<CR>
" Edit menu
@@ -57,8 +59,8 @@ aunmenu Edit.Find
aunmenu Edit.Find\ and\ Replace
an 20.410.10 Edit.Find.Find\.\.\.<Tab>/ /
an 20.410.20 Edit.Find.Find\ Next :maca findNext:<CR>
an 20.410.30 Edit.Find.Find\ Previous :maca findPrevious:<CR>
an 20.410.20 Edit.Find.Find\ Next <Nop>
an 20.410.30 Edit.Find.Find\ Previous <Nop>
vmenu 20.410.35 Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>n
an 20.410.40 Edit.Find.-SEP1- <Nop>
an 20.410.50 Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s :%s/
@@ -66,27 +68,34 @@ vunmenu Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s
vnoremenu Edit.Find.Find\ and\ Replace\.\.\.<Tab>:s :s/
an 20.460 Edit.-SEP4- <Nop>
an 20.465.10 Edit.Font.Show\ Fonts :maca orderFrontFontPanel:<CR>
an 20.465.10 Edit.Font.Show\ Fonts <Nop>
an 20.465.20 Edit.Font.-SEP5- <Nop>
an 20.465.30 Edit.Font.Bigger :maca fontSizeUp:<CR>
an 20.465.40 Edit.Font.Smaller :maca fontSizeDown:<CR>
an 20.470 Edit.Special\ Characters\.\.\. :maca orderFrontCharacterPalette:<CR>
an 20.465.30 Edit.Font.Bigger <Nop>
an 20.465.40 Edit.Font.Smaller <Nop>
an 20.470 Edit.Special\ Characters\.\.\. <Nop>
" Window menu (should be next to Help so give it a high priority)
aunmenu Window
an <silent> 9900.300 Window.Minimize :maca performMiniaturize:<CR>
an <silent> 9900.310 Window.Zoom :maca performZoom:<CR>
an <silent> 9900.300 Window.Minimize <Nop>
an <silent> 9900.301 Window.Minimize\ All <Nop>
an <silent> 9900.310 Window.Zoom <Nop>
an <silent> 9900.311 Window.Zoom\ All <Nop>
an <silent> 9900.320 Window.Toggle\ Full\ Screen\ Mode :set invfullscreen<CR>
an 9900.330 Window.-SEP1- <Nop>
" TODO! Grey out if no tabs are visible.
an <silent> 9900.340 Window.Previous\ Tab :tabprevious<CR>
an <silent> 9900.350 Window.Next\ Tab :tabnext<CR>
an 9900.360 Window.-SEP2- <Nop>
an <silent> 9900.370 Window.Bring\ All\ To\ Front :maca arrangeInFront:<CR>
an <silent> 9900.370 Window.Bring\ All\ To\ Front <Nop>
" Help menu
an 9999.1 Help.MacVim\ Help :h gui_mac<CR>
an <silent> 9999.2 Help.MacVim\ Website <Nop>
an 9999.3 Help.-sep0- <Nop>
"
" Toolbar
@@ -183,50 +192,61 @@ endif " exists("macvim_hig_shift_movement")
"
" Menu key equivalents (these should always have the 'D' modifier set)
" Set up menu key equivalents (these should always have the 'D' modifier set),
" action bindings, and alternate items.
"
" Note: menu items which should execute an action are bound to <Nop>; the
" action message is specified here via the :macmenu command.
"
macmenukey File.New\ Window <D-n>
macmenukey File.New\ Tab <D-t>
macm File.New\ Window key=<D-n> action=newWindow:
macm File.New\ Tab key=<D-t>
macm File.Open\.\.\. key=<D-o> action=fileOpen:
macm File.Open\ Tab\.\.\. key=<D-T>
macm File.Open\ Recent action=recentFilesDummy:
macm File.Close\ Window key=<D-W>
macm File.Close key=<D-w> action=performClose:
macm File.Save key=<D-s>
macm File.Save\ All key=<D-M-s> alt=YES
macm File.Save\ As\.\.\. key=<D-S>
macm File.Print key=<D-p>
macmenukey File.Open\.\.\. <D-o>
macmenukey File.Open\ Tab\.\.\. <D-T>
macmenukey File.Close\ Window <D-W>
"macmenukey File.Close\ Tab <D-w>
macmenukey File.Close <D-w>
macmenukey File.Save <D-s>
macmenukey File.Save\ As\.\.\. <D-S>
macmenukey File.Print <D-p>
macm Edit.Undo key=<D-z> action=undo:
macm Edit.Redo key=<D-Z> action=redo:
macm Edit.Cut key=<D-x> action=cut:
macm Edit.Copy key=<D-c> action=copy:
macm Edit.Paste key=<D-v> action=paste:
macm Edit.Select\ All key=<D-a> action=selectAll:
macm Edit.Find.Find\.\.\. key=<D-f>
macm Edit.Find.Find\ Next key=<D-g> action=findNext:
macm Edit.Find.Find\ Previous key=<D-G> action=findPrevious:
macm Edit.Find.Use\ Selection\ for\ Find key=<D-e>
macm Edit.Special\ Characters\.\.\. key=<D-M-t>
macm Edit.Font.Show\ Fonts action=orderFrontFontPanel:
macm Edit.Font.Bigger key=<D-=> action=fontSizeUp:
macm Edit.Font.Smaller key=<D--> action=fontSizeDown:
macm Edit.Special\ Characters\.\.\. action=orderFrontCharacterPalette:
macmenukey Edit.Undo <D-z>
macmenukey Edit.Redo <D-Z>
macmenukey Edit.Cut <D-x>
macmenukey Edit.Copy <D-c>
macmenukey Edit.Paste <D-v>
macmenukey Edit.Select\ All <D-a>
macmenukey Edit.Find.Find\.\.\. <D-f>
macmenukey Edit.Find.Find\ Next <D-g>
macmenukey Edit.Find.Find\ Previous <D-G>
macmenukey Edit.Find.Use\ Selection\ for\ Find <D-e>
macmenukey Edit.Special\ Characters\.\.\. <D-M-t>
macmenukey Edit.Font.Bigger <D-=>
macmenukey Edit.Font.Smaller <D-->
macm Tools.Spelling.To\ Next\ error key=<D-;>
macm Tools.Spelling.Suggest\ Corrections key=<D-:>
macm Tools.Make key=<D-b>
macm Tools.List\ Errors key=<D-l>
macm Tools.List\ Messages key=<D-L>
macm Tools.Next\ Error key=<D-C-Right>
macm Tools.Previous\ Error key=<D-C-Left>
macm Tools.Older\ List key=<D-C-Up>
macm Tools.Newer\ List key=<D-C-Down>
macmenukey Tools.Spelling.To\ Next\ error <D-;>
macmenukey Tools.Spelling.Suggest\ Corrections <D-:>
macmenukey Tools.Make <D-b>
macmenukey Tools.List\ Errors <D-l>
macmenukey Tools.List\ Messages <D-L>
macmenukey Tools.Next\ Error <D-C-Right>
macmenukey Tools.Previous\ Error <D-C-Left>
macmenukey Tools.Older\ List <D-C-Up>
macmenukey Tools.Newer\ List <D-C-Down>
macmenukey Window.Minimize <D-m>
macmenukey Window.Toggle\ Full\ Screen\ Mode <D-F>
macmenukey Window.Previous\ Tab <D-{>
macmenukey Window.Next\ Tab <D-}>
macm Window.Minimize key=<D-m> action=performMiniaturize:
macm Window.Minimize\ All key=<D-M-m> action=miniaturizeAll: alt=YES
macm Window.Zoom key=<D-C-z> action=performZoom:
macm Window.Zoom\ All key=<D-M-C-z> action=zoomAll: alt=YES
macm Window.Toggle\ Full\ Screen\ Mode key=<D-F>
macm Window.Previous\ Tab key=<D-{>
macm Window.Next\ Tab key=<D-}>
macm Window.Bring\ All\ To\ Front action=arrangeInFront:
macm Help.MacVim\ Website action=openWebsite:
" Restore the previous value of 'cpoptions'.
let &cpo = s:cpo_save
Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

+302 -11
View File
@@ -41,31 +41,322 @@
-->
<item>
<title>Snapshot 21 released</title>
<title>Snapshot 31 released</title>
<description><![CDATA[
<h1>MacVim snapshot 21 released</h1>
<h1>MacVim snapshot 31 released</h1>
<p> Changes since snapshot 30:
<ul>
<li> Fixed problems with menus on OS X 10.4 and a related crash. </li>
<li> Dialog box handling has been updated. This fixes a problem where the
"swap file warning" dialog would pop up before the informational text in
the editor window updated. Hopefully this will also cure various other
problems with dialogs (e.g. nothing happening when opening files from a
dialog box). </li>
<li> Added dock menu with "New Window" item. This is useful with "Spaces" on
OS X 10.5 since you can use this menu to open a new MacVim window on any
"space" when another editor window is already open. (Also, now there is
always a way to open a new window, even if the menus are customized,
or if "-u NONE" is used.) </li>
<li> I have started trying to fix "modeless selection" and it sort of works
on my machine, but I've had one report stating that its not quite
working so you mileage may vary. Make sure to let me know what works
and doesn't so that I can fix this properly. (Try selecting text from
the command line.) </li>
<li> The default font (DejaVu Sans Mono) has been updated to version 2.25.
</li>
<li> Latest Vim source code merged </li>
</ul>
</p>
]]></description>
<pubDate>Fri, 13 Jun 2008 16:00 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-31.tbz"
length="8182620"
sparkle:version="31"
sparkle:shortVersionString="7.1"
/>
</item>
<item>
<title>Snapshot 30 released</title>
<description><![CDATA[
<h1>MacVim snapshot 30 released</h1>
<p> Changes since snapshot 28:
<ul>
<li> copy&paste and other "Edit" menu items now work as expected with dialogs
(such as open/save). </li>
<li> some menus (such as the "Window" menu) has got some new items </li>
<li> general menu improvements when no editor window is open </li>
<li> ability to access some OS X default Cmd-keys even if menus are
completely altered (e.g. when starting with "-u NONE") </li>
<li> QuickLook works with .vim files (patch by Nico Weber) </li>
<li> insert mode cursor honors the 'rightleft' option </li>
<li> no more "freezes" during :shell </li>
<li> no beeping on Cmd-q </li>
<li> Cmd-w works in full-screen again </li>
<li> window dimensions properly restored when leaving full-screen when
"maxvert" is in 'fuoptions' </li>
<li> support for 'mousehide' option </li>
<li> latest vim patches and runtime files </li>
</ul>
</p>
<p> The only difference between snapshot 29 and 30 is that the former did not
handle window cycling very well with international keyboard layouts. </p>
]]></description>
<pubDate>Sun, 8 Jun 2008 16:43 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-30.tbz"
length="8137308"
sparkle:version="30"
sparkle:shortVersionString="7.1"
/>
</item>
<item>
<title>Snapshot 28 released</title>
<description><![CDATA[
<h1>MacVim snapshot 28 released</h1>
<p><em>The ":macmenukey" command is now deprecated. Please update your .gvimrc
file to use the ":macmenu" command instead (if you use ":macmenukey").</em></p>
<p> Changes since snapshot 27:
<ul>
<li> Added the ":macmenu" commmand (see ":h macmenu") and deprecated
":macmenukey"</li>
<li> Cmd-w now works even when mappings to &lt;-\&gt; are present </li>
<li> Added "File.Save All" menu item (Cmd-Alt-s) </li>
<li> The Logitech Control Center no longer causes any problems </li>
<li> "Edit" menu items now work better with open and save dialogs </li>
<li> The 'backspace' option now includes "indent,eol,start" by default </li>
<li> Open and save dialogs track the present working directory </li>
</ul>
</p>
]]></description>
<pubDate>Sun, 25 May 2008 19:40 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-28.tbz"
length="8124499"
sparkle:version="28"
sparkle:shortVersionString="7.1"
/>
</item>
<item>
<title>Snapshot 27 released</title>
<description><![CDATA[
<h1>MacVim snapshot 27 released</h1>
<p> This is the first snapshot compiled on the new Mac I bought with money
donated from MacVim users! There were problems with compiling universal
binaries with Ruby and Perl support on PPC/Tiger so I was hoping to be able
to include these now that I have Intel/Leopard. The good news is that Ruby
support is now included, but Perl still is problematic and I had to drop
TCL support. I will try to get these working in a future snapshot.
</p>
<p> Here is the list of changes since snapshot 26:
<ul>
<li> 'fuoptions' now support setting the background color while in
full-screen mode, check ":h 'fuopt'" (patch by Enno Lübbers) </li>
<li> &lt;D-w&gt; shows confirmation dialog when buffer is modified </li>
<li> setting 'antialias' from gvimrc now works </li>
<li> zooming a window no longer causes it to move downwards </li>
<li> the File menu now contains a "Recent Files" submenu; note that only
files opened from Finder or with the ":browse" command are added to this
list, and not files opened with e.g. ":e" (patch by Nico Weber) </li>
<li> includes latest Vim patches and runtime files </li>
</ul>
</p>
]]></description>
<pubDate>Mon, 12 May 2008 22:05 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-27-fixed.tbz"
length="8102568"
sparkle:version="27"
sparkle:shortVersionString="7.1"
/>
</item>
<item>
<title>Snapshot 26 released</title>
<description><![CDATA[
<h1>MacVim snapshot 26 released</h1>
<p> This snapshot contains a fix to the bug which caused the first window to
open in the wrong position as well as an initial version of the new MacVim
icon. </p>
]]></description>
<pubDate>Fri, 11 Apr 2008 20:37 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-26.tbz"
length="8147362"
sparkle:version="26"
sparkle:shortVersionString="7.1"
/>
</item>
<item>
<title>Snapshot 25 released</title>
<description><![CDATA[
<h1>MacVim snapshot 25 released</h1>
<p> This snapshot adds support for two new options: 'antialias' and
'fuoptions'. The former lets you turn text antialiasing on or off (it's
on by default), the latter can be used to make the view maximize when
full-screen is entered. See the built-in help for more information (:h
'anti' and :h 'fuopt'). </p>
<p> Another minor addition is that &lt;C-c&gt; and &lt;C-v&gt; work with
block-wise selections (do note that &lt;C-v&gt; behaves like "P", not "p").
Also, &lt;D-w&gt; now works in ex-mode and in a command-line window. </p>
<p> Here is the list of changes since snapshot 24:
<ul>
<li> support 'antialias' option (Jjgod Jiang) </li>
<li> add option 'fuoptions' to control resizing when full-screen is entered
(Nico Weber) </li>
<li> fixed bug where transparency setting was lost after leaving full-screen
(Nico Weber) </li>
<li> help menu contains MacVim help and website link </li>
<li> &lt;D-w&gt; now works in ex-mode and in command-line window </li>
<li> :macaction command supports command-line completion (Nico Weber) </li>
<li> copy/paste respects block selections (requested by George Harker) </li>
<li> window no longer cascades from preferences panel </li>
</ul>
</p>
]]></description>
<pubDate>Fri, 06 Apr 2008 19:11 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-25.tbz"
length="8042440"
sparkle:version="25"
sparkle:shortVersionString="7.1"
/>
</item>
<item>
<title>Snapshot 24 released</title>
<description><![CDATA[
<h1>MacVim snapshot 24 released</h1>
<p><em> The input manager bundled with snapshot 23 contained a bug which could
lead to other apps crashing on startup. If you have installed the input
manager, then you are strongly advised to update now and install the new input
manager (via the Integration preference pane). </em></p>
<p> Changes since snapshot 23:
<ul>
<li> The mouse cursor has higher contrast in insert mode (when bg=dark). </li>
<li> The layout of the Integration preference pane has been updated. </li>
</ul>
</p>
]]></description>
<pubDate>Fri, 14 Mar 2008 20:44 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-24.tbz"
length="8036815"
sparkle:version="24"
sparkle:shortVersionString="7.1"
/>
</item>
<item>
<title>Snapshot 23 released</title>
<description><![CDATA[
<h1>MacVim snapshot 23 released</h1>
Changes since snapshot 22:
<ul>
<li> The preferences panel has been updated with an "Integration pane". This
can be used to easily install (and uninstall) the "Edit in ODBEditor"
input manager. The input manager enables you to use MacVim to edit text
in any Cocoa text field (e.g. you can use MacVim to edit emails in Mail).
Please read the warning on the Integration pane before installing the
input manager. (Patch by Nico Weber.) </li>
<li> The "Login Shell" preference has been updated so it should now work with
most shells. This option ensures that environment variables (e.g. $PATH)
are set properly. You should enable it if you ever need to issue shell
commands from within MacVim. (Patch by Ben Schmidt.) </li>
<li> Added MMZoomBoth user default. Enable this if you prefer the window to
maximize in both directions when you press the green "maximize button"
(hold down Cmd to temporarily restrict resizing to the vertical direction
only). (Requested by Brian McKee.) </li>
<li> Added Cmd-Ctrl-z as key equivalent for "Window->Zoom" (this is the same
key equivalent as in iTunes) </li>
<li> The Vim runtime files have been updated to the latest version </li>
<li> MacVim recognizes files with .patch and .diff extension </li>
<li> The mouse cursor in insert mode has higher contrast (when used with dark
backgrounds). (Requested by Enno et al.) </li>
<li> Line numbers (:h 'number') are brighter when bakground=dark. (Requested
by Ted Pavlic) </li>
</ul>
<p>
Like MacVim? Go to <a href="http://code.google.com/p/macvim/">
http://code.google.com/p/macvim/</a> to see how you can show your
support.
</p>
]]></description>
<pubDate>Sun, 9 Mar 2008 16:43 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-23.tbz"
length="8037899"
sparkle:version="23"
sparkle:shortVersionString="7.1"
/>
</item>
<item>
<title>Snapshot 22 released</title>
<description><![CDATA[
<h1>MacVim snapshot 22 released</h1>
<p><em>This snapshot replaces the broken snapshot 21. If you installed build 21
then please update immediately.</em></p>
<p>Changes since snapshot 20:</p>
<ul>
<li>Fix forking bug which caused snapshot 21 to lock up OS X</li>
<li>The macvim color scheme changed so that line numbers look better when
the background is dark (enable line numbers with :set number, set dark
the background is dark (enable line numbers with :set number; set dark
background with :set bg=dark)</li>
<li>Improved support for Voice Over (enable with <D-F5>)</li>
<li>Improved support for Voice Over (enable with &lt;D-F5&gt;)</li>
<li>System bell support (see :h 'vb' on how to turn it off)</li>
<li>MacVim no longer associates to .plist and .dict since these may well be
in binary format</li>
<li>Added Find Next <D-g>, Find Previous <D-G> and Use Selection for Find
<D-e> menu items</li>
<li>Added Find Next &lt;D-g&gt;, Find Previous &lt;D-G&gt; and Use Selection
for Find &lt;D-e&gt; menu items</li>
<li>Track pad scrolling is now force sensitive</li>
<li>Added help section on preferences</li>
<li>Preferences panel updated (also no longer hides when MacVim loses focus)
</li>
</ul>
<p>The most exciting new addition in this snapshot is support for &lt;D-g&gt;.
It repeats the last search you made in any other application (that supports the
Find Pasteboard).</p>
<p>This is very useful if you have several windows open in MacVim...try
searching for something in one window (using "/"), then switching to another
window and hitting &lt;D-g&gt; for an example (after having pressed &lt;D-g&gt;
once you can of course use "n" to repeat the search).</p>
]]></description>
<pubDate>Mon, 11 Feb 2008 22:17 CET</pubDate>
<pubDate>Wed, 13 Feb 2008 19:36 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-21.tbz"
length="7814596"
sparkle:version="21"
sparkle:shortVersionString="snapshot 21"
url="http://macvim.googlecode.com/files/MacVim-snapshot-22.tbz"
length="7812907"
sparkle:version="22"
sparkle:shortVersionString="7.1"
/>
</item>
+60
View File
@@ -0,0 +1,60 @@
#!/bin/sh
export MACOSX_DEPLOYMENT_TARGET=10.4
# Increment build number
/Developer/usr/bin/agvtool next-version -all > /dev/null
# Get current build number
BUILDNUM=`/Developer/usr/bin/agvtool what-version -terse`
DEST=~/Desktop/MacVim-snapshot-$BUILDNUM
echo '****************************************************'
echo " BUILDING SNAPSHOT $BUILDNUM"
echo '****************************************************'
echo ''
# Build Vim binary
echo 'BUILDING VIM BINARY'
echo ' running configure...'
cd .. && ./configure --enable-gui=macvim --with-mac-arch=both \
--with-features=huge --enable-pythoninterp \
--enable-cscope --enable-rubyinterp \
--with-compiledby="Bjorn Winckler <bjorn.winckler@gmail.com>" > /dev/null
echo ' cleaning...'
make clean > /dev/null
echo ' calling make...'
make > /dev/null
echo ' done'
# Build MacVim.app
echo 'BUILDING MacVim.app'
cd MacVim
echo ' cleaning...'
xcodebuild -configuration Universal clean > /dev/null
echo ' calling xcodebuild...'
xcodebuild -configuration Universal > /dev/null
echo ' done'
# Create archive of build/Universal/MacVim.app
echo 'CREATING SNAPSHOT ARCHIVE'
echo ' copying MacVim.app and supporting files...'
mkdir $DEST
cp -pR build/Universal/MacVim.app $DEST/
cp -p mvim $DEST/
cp -p README-snapshot.txt $DEST/
echo ' creating archive....'
cd $DEST && cd ..
tar cjf MacVim-snapshot-$BUILDNUM.tbz MacVim-snapshot-$BUILDNUM
echo ' done'
echo 'ALL DONE'
echo 'Now update the Appcast, commit and tag, then post on vim_mac.'
# Update app-cast
# Commit & tag
# git-commit -a -m "$BUILDNUM"
# git-tag -a -F tagfile $BUILDNUM
# Post on vim_mac
Binary file not shown.
+5 -1
View File
@@ -1,6 +1,10 @@
" System vimrc file for MacVim
"
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
" Last Change: Sat Aug 11 14:26:41 CEST 2007
" Last Change: Sun May 25 2008
set nocompatible
" The default for 'backspace' is very confusing to new users, so change it to a
" more sensible value. Add "set backspace&" to your ~/.vimrc to reset it.
set backspace+=indent,eol,start
+18 -12
View File
@@ -1,6 +1,7 @@
# Makefile for Vim on Win32 (Windows NT/2000/XP/2003 and Windows 95/98/Me)
# and Win64, using the Microsoft Visual C++ compilers. Known to work with
# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), and VC8 (VS2005).
# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005),
# and VC9 (VS2008).
#
# To build using other Windows compilers, see INSTALLpc.txt
#
@@ -285,7 +286,8 @@ XPM_INC = -I $(XPM)\include
# need shell32.lib for ExtractIcon()
# gdi32.lib and comdlg32.lib for printing support
# ole32.lib and uuid.lib are needed for FEAT_SHORTCUT
CON_LIB = advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib
CON_LIB = oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib \
comdlg32.lib ole32.lib uuid.lib /machine:$(CPU) /nodefaultlib
!if "$(DELAYLOAD)" == "yes"
CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
!endif
@@ -331,6 +333,7 @@ MSVCVER = 5.0
!endif
!if "$(_NMAKE_VER)" == "6.00.8168.0"
MSVCVER = 6.0
CPU = ix86
!endif
!if "$(_NMAKE_VER)" == "7.00.9466"
MSVCVER = 7.0
@@ -344,6 +347,9 @@ MSVCVER = 8.0
!if "$(_NMAKE_VER)" == "8.00.50727.762"
MSVCVER = 8.0
!endif
!if "$(_NMAKE_VER)" == "9.00.20706.01"
MSVCVER = 9.0
!endif
!endif
# Abort bulding VIM if version of VC is unrecognised.
@@ -352,13 +358,13 @@ MSVCVER = 8.0
!message Cannot determine Visual C version being used. If you are using the
!message Windows SDK then you must have the environment variable MSVCVER set to
!message your version of the VC compiler. If you are not using the Express
!message version of Visual C you van either set MSVCVER or update this makefile
!message to handle the new value for _NMAKE_VER.
!message version of Visual C, you can either set MSVCVER or update this makefile
!message to handle the new value for _NMAKE_VER, "$(_NMAKE_VER)".
!error Make aborted.
!endif
# Convert processor ID to MVC-compatible number
!if "$(MSVCVER)" != "8.0"
!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0")
!if "$(CPUNR)" == "i386"
CPUARG = /G3
!elseif "$(CPUNR)" == "i486"
@@ -373,7 +379,7 @@ CPUARG = /G7 /arch:SSE2
CPUARG =
!endif
!else
# VC8 only allows specifying SSE architecture
# VC8/9 only allows specifying SSE architecture
!if "$(CPUNR)" == "pentium4"
CPUARG = /arch:SSE2
!endif
@@ -391,7 +397,7 @@ OPTFLAG = /O2
!else # MAXSPEED
OPTFLAG = /Ox
!endif
!if "$(MSVCVER)" == "8.0"
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0")
# Use link time code generation if not worried about size
!if "$(OPTIMIZE)" != "SPACE"
OPTFLAG = $(OPTFLAG) /GL
@@ -404,11 +410,11 @@ CFLAGS = $(CFLAGS) /MD
LIBC = msvcrt.lib
! else
LIBC = libcmt.lib
CFLAGS = $(CFLAGS) /MT
CFLAGS = $(CFLAGS) /Zl /MT
! endif
!else # DEBUG
VIM = vimd
! if "$(CPU)" == "i386"
! if ("$(CPU)" == "i386") || ("$(CPU)" == "ix86")
DEBUGINFO = /ZI
! endif
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Od
@@ -424,7 +430,7 @@ CFLAGS = $(CFLAGS) /MDd
LIBC = $(LIBC) msvcrtd.lib
! else
LIBC = $(LIBC) libcmtd.lib
CFLAGS = $(CFLAGS) /MTd
CFLAGS = $(CFLAGS) /Zl /MTd
! endif
!endif # DEBUG
@@ -534,7 +540,7 @@ GUI_OBJ = \
$(OUTDIR)\gui_w32.obj \
$(OUTDIR)\os_w32exe.obj
GUI_LIB = \
oldnames.lib kernel32.lib gdi32.lib version.lib $(IME_LIB) \
gdi32.lib version.lib $(IME_LIB) \
winspool.lib comctl32.lib advapi32.lib shell32.lib \
/machine:$(CPU) /nodefaultlib
!else
@@ -757,7 +763,7 @@ LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
# Report link time code generation progress if used.
!ifdef NODEBUG
!if "$(MSVCVER)" == "8.0"
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0")
!if "$(OPTIMIZE)" != "SPACE"
LINKARGS1 = $(LINKARGS1) /LTCG:STATUS
!endif
+12 -4
View File
@@ -545,7 +545,7 @@ LINT_OPTIONS = -beprxzF
# For unknown reasons adding "-lc" fixes a linking problem with GCC. That's
# probably a bug in the "-pg" implementation.
# Need to recompile everything after changing this: "make clean" "make".
#PROFILE_CFLAGS = -pg -g
#PROFILE_CFLAGS = -pg -g -DWE_ARE_PROFILING
#PROFILE_LIBS = -pg
#PROFILE_LIBS = -pg -lc
@@ -780,6 +780,8 @@ LINT_OPTIONS = -beprxzF
# 1) make config
# 2) edit auto/config.mk, add -n32 to LDFLAGS
# 3) make
#
#Alternatively: use -o32 instead of -n32.
###
### (C) On SCO Unix v3.2.5 (and probably other versions) the termcap library,
@@ -1074,7 +1076,7 @@ PRINTSOURCE = ../runtime/print
# default vi editor, it will create a link from vi to Vim when doing
# "make install". An existing file will be overwritten!
# When not using it, some make programs can't handle an undefined $(LINKIT).
#LINKIT = -ln -f -s $(BINDIR)/$(VIMTARGET) /usr/bin/vi
#LINKIT = ln -f -s $(DEST_BIN)/$(VIMTARGET) $(DESTDIR)/usr/bin/vi
LINKIT = @echo >/dev/null
###
@@ -1306,6 +1308,9 @@ LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
DEPEND_CFLAGS = -DPROTO -DDEPEND -DFEAT_GUI $(LINT_CFLAGS)
# If you have problems with flags that cproto doesn't support, and you are
# using GNU make, you can try using the other line to filter out arguments.
#PFLAGS = $(PROTO_FLAGS) -DPROTO $(filter -D% -I%, $(LINT_CFLAGS))
PFLAGS = $(PROTO_FLAGS) -DPROTO $(LINT_CFLAGS)
ALL_LIB_DIRS = $(GUI_LIBS_DIR) $(X_LIBS_DIR)
@@ -1883,6 +1888,8 @@ installmacros: $(DEST_VIM) $(DEST_RT) $(DEST_MACRO)
installtutorbin: $(DEST_VIM)
$(INSTALL_DATA) vimtutor $(DEST_BIN)/$(VIMNAME)tutor
chmod $(SCRIPTMOD) $(DEST_BIN)/$(VIMNAME)tutor
$(INSTALL_DATA) gvimtutor $(DEST_BIN)/$(GVIMNAME)tutor
chmod $(SCRIPTMOD) $(DEST_BIN)/$(GVIMNAME)tutor
installtutor: $(DEST_RT) $(DEST_TUTOR)
-$(INSTALL_DATA) $(TUTORSOURCE)/README* $(TUTORSOURCE)/tutor* $(DEST_TUTOR)
@@ -2091,6 +2098,7 @@ installmanlinks:
uninstall: uninstall_runtime
-rm -f $(DEST_BIN)/$(VIMTARGET)
-rm -f $(DEST_BIN)/vimtutor
-rm -f $(DEST_BIN)/gvimtutor
-rm -f $(DEST_BIN)/$(EXTARGET) $(DEST_BIN)/$(VIEWTARGET)
-rm -f $(DEST_BIN)/$(GVIMTARGET) $(DEST_BIN)/$(GVIEWTARGET)
-rm -f $(DEST_BIN)/$(RVIMTARGET) $(DEST_BIN)/$(RVIEWTARGET)
@@ -2187,7 +2195,7 @@ SHADOWDIR = shadow
shadow: runtime pixmaps
mkdir $(SHADOWDIR)
cd $(SHADOWDIR); ln -s ../*.[ch] ../*.in ../*.sh ../*.xs ../*.xbm ../toolcheck ../proto ../vimtutor ../mkinstalldirs .
cd $(SHADOWDIR); ln -s ../*.[ch] ../*.in ../*.sh ../*.xs ../*.xbm ../toolcheck ../proto ../po ../vimtutor ../gvimtutor ../mkinstalldirs .
mkdir $(SHADOWDIR)/auto
cd $(SHADOWDIR)/auto; ln -s ../../auto/configure .
cd $(SHADOWDIR); rm -f auto/link.sed
@@ -2206,7 +2214,7 @@ shadow: runtime pixmaps
cd $(SHADOWDIR)/testdir; ln -s ../../testdir/Makefile \
../../testdir/vimrc.unix \
../../testdir/*.in \
../../testdir/unix.vim \
../../testdir/*.vim \
../../testdir/*.ok .
# Link needed for doing "make install" in a shadow directory.
+92 -2
View File
@@ -845,6 +845,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-darwin Disable Darwin (Mac OS X) support.
--disable-selinux Don't check for SELinux support.
--disable-xsmp Disable XSMP session management
--disable-xsmp-interact Disable XSMP interaction
--enable-mzschemeinterp Include MzScheme interpreter.
@@ -3611,6 +3612,94 @@ echo "${ECHO_T}no" >&6
esac
fi
echo "$as_me:$LINENO: checking --disable-selinux argument" >&5
echo $ECHO_N "checking --disable-selinux argument... $ECHO_C" >&6
# Check whether --enable-selinux or --disable-selinux was given.
if test "${enable_selinux+set}" = set; then
enableval="$enable_selinux"
else
enable_selinux="yes"
fi;
if test "$enable_selinux" = "yes"; then
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
echo "$as_me:$LINENO: checking for is_selinux_enabled in -lselinux" >&5
echo $ECHO_N "checking for is_selinux_enabled in -lselinux... $ECHO_C" >&6
if test "${ac_cv_lib_selinux_is_selinux_enabled+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lselinux $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char is_selinux_enabled ();
int
main ()
{
is_selinux_enabled ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_selinux_is_selinux_enabled=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_selinux_is_selinux_enabled=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_selinux_is_selinux_enabled" >&5
echo "${ECHO_T}$ac_cv_lib_selinux_is_selinux_enabled" >&6
if test $ac_cv_lib_selinux_is_selinux_enabled = yes; then
LIBS="$LIBS -lselinux"
cat >>confdefs.h <<\_ACEOF
#define HAVE_SELINUX 1
_ACEOF
fi
else
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
fi
echo "$as_me:$LINENO: checking --with-features argument" >&5
@@ -4669,10 +4758,11 @@ echo "${ECHO_T}$tclver - OK" >&6;
echo "$as_me:$LINENO: checking for location of Tcl include" >&5
echo $ECHO_N "checking for location of Tcl include... $ECHO_C" >&6
if test "x$MACOSX" != "xyes"; then
tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/include"
tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/include /usr/include/tcl$tclver"
else
tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
fi
TCL_INC=
for try in $tclinc; do
if test -f "$try/tcl.h"; then
echo "$as_me:$LINENO: result: $try/tcl.h" >&5
@@ -14259,7 +14349,7 @@ echo "${ECHO_T}$TAGPRG" >&6
echo "$as_me:$LINENO: checking how to run man with a section nr" >&5
echo $ECHO_N "checking how to run man with a section nr... $ECHO_C" >&6
MANDEF="man"
(eval man -s 2 read) < /dev/null > /dev/null 2>&5 && MANDEF="man -s"
(eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&5 && MANDEF="man -s"
echo "$as_me:$LINENO: result: $MANDEF" >&5
echo "${ECHO_T}$MANDEF" >&6
if test "$MANDEF" = "man -s"; then
+4 -3
View File
@@ -4922,7 +4922,7 @@ chk_modeline(lnum, flags)
return retval;
}
#ifdef FEAT_VIMINFO
#if defined(FEAT_VIMINFO) || defined(PROTO)
int
read_viminfo_bufferlist(virp, writing)
vir_T *virp;
@@ -5043,13 +5043,14 @@ buf_spname(buf)
#if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)
if (bt_quickfix(buf))
{
win_T *win;
win_T *win = NULL;
tabpage_T *tp;
/*
* For location list window, w_llist_ref points to the location list.
* For quickfix window, w_llist_ref is NULL.
*/
FOR_ALL_WINDOWS(win)
FOR_ALL_TAB_WINDOWS(tp, win)
if (win->w_buffer == buf)
break;
if (win != NULL && win->w_llist_ref != NULL)
+2 -1
View File
@@ -1290,7 +1290,8 @@ getvcol(wp, pos, start, cursor, end)
/* If a double-cell char doesn't fit at the end of a line
* it wraps to the next line, it's like this char is three
* cells wide. */
if (incr == 2 && wp->w_p_wrap && in_win_border(wp, vcol))
if (incr == 2 && wp->w_p_wrap && MB_BYTE2LEN(*ptr) > 1
&& in_win_border(wp, vcol))
{
++incr;
head = 1;
+1
View File
@@ -155,6 +155,7 @@
#undef HAVE_READLINK
#undef HAVE_RENAME
#undef HAVE_SELECT
#undef HAVE_SELINUX
#undef HAVE_SETENV
#undef HAVE_SETPGID
#undef HAVE_SETSID
+16 -2
View File
@@ -308,6 +308,19 @@ case `uname` in
esac
fi
dnl Link with -lselinux for SELinux stuff; if not found
AC_MSG_CHECKING(--disable-selinux argument)
AC_ARG_ENABLE(selinux,
[ --disable-selinux Don't check for SELinux support.],
, enable_selinux="yes")
if test "$enable_selinux" = "yes"; then
AC_MSG_RESULT(no)
AC_CHECK_LIB(selinux, is_selinux_enabled,
[LIBS="$LIBS -lselinux"
AC_DEFINE(HAVE_SELINUX)])
else
AC_MSG_RESULT(yes)
fi
dnl Check user requested features.
@@ -803,11 +816,12 @@ if test "$enable_tclinterp" = "yes"; then
AC_MSG_CHECKING(for location of Tcl include)
if test "x$MACOSX" != "xyes"; then
tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/include"
tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver"
else
dnl For Mac OS X 10.3, use the OS-provided framework location
tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
fi
TCL_INC=
for try in $tclinc; do
if test -f "$try/tcl.h"; then
AC_MSG_RESULT($try/tcl.h)
@@ -2762,7 +2776,7 @@ AC_MSG_RESULT($TAGPRG) AC_SUBST(TAGPRG)
dnl Check how we can run man with a section number
AC_MSG_CHECKING(how to run man with a section nr)
MANDEF="man"
(eval man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
(eval MANPAGER=cat PAGER=cat man -s 2 read) < /dev/null > /dev/null 2>&AC_FD_CC && MANDEF="man -s"
AC_MSG_RESULT($MANDEF)
if test "$MANDEF" = "man -s"; then
AC_DEFINE(USEMAN_S)
+1 -1
View File
@@ -1365,7 +1365,7 @@ install_registry(void)
printf("Creating \"Edit with Vim\" popup menu entry\n");
fprintf(fd, "HKEY_CLASSES_ROOT\\CLSID\\%s\n", vim_ext_clsid);
fprintf(fd, "[HKEY_CLASSES_ROOT\\CLSID\\%s]\n", vim_ext_clsid);
fprintf(fd, "@=\"%s\"\n", vim_ext_name);
fprintf(fd, "[HKEY_CLASSES_ROOT\\CLSID\\%s\\InProcServer32]\n",
vim_ext_clsid);
+2 -2
View File
@@ -5491,7 +5491,7 @@ insertchar(c, flags, second_indent)
#if defined(FEAT_EVAL)
int do_internal = TRUE;
if (*curbuf->b_p_fex != NUL)
if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0)
{
do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
/* It may be required to save for undo again, e.g. when setline()
@@ -6057,7 +6057,7 @@ auto_format(trailblank, prev_line)
* be adjusted for the text formatting.
*/
saved_cursor = pos;
format_lines((linenr_T)-1);
format_lines((linenr_T)-1, FALSE);
curwin->w_cursor = saved_cursor;
saved_cursor.lnum = 0;
+165 -90
View File
@@ -507,6 +507,7 @@ static void f_filewritable __ARGS((typval_T *argvars, typval_T *rettv));
static void f_filter __ARGS((typval_T *argvars, typval_T *rettv));
static void f_finddir __ARGS((typval_T *argvars, typval_T *rettv));
static void f_findfile __ARGS((typval_T *argvars, typval_T *rettv));
static void f_fnameescape __ARGS((typval_T *argvars, typval_T *rettv));
static void f_fnamemodify __ARGS((typval_T *argvars, typval_T *rettv));
static void f_foldclosed __ARGS((typval_T *argvars, typval_T *rettv));
static void f_foldclosedend __ARGS((typval_T *argvars, typval_T *rettv));
@@ -532,6 +533,7 @@ static void f_getftime __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getftype __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getline __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getmatches __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getpid __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getpos __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getqflist __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getreg __ARGS((typval_T *argvars, typval_T *rettv));
@@ -7106,6 +7108,7 @@ static struct fst
{"filter", 2, 2, f_filter},
{"finddir", 1, 3, f_finddir},
{"findfile", 1, 3, f_findfile},
{"fnameescape", 1, 1, f_fnameescape},
{"fnamemodify", 2, 2, f_fnamemodify},
{"foldclosed", 1, 1, f_foldclosed},
{"foldclosedend", 1, 1, f_foldclosedend},
@@ -7132,6 +7135,7 @@ static struct fst
{"getline", 1, 2, f_getline},
{"getloclist", 1, 1, f_getqflist},
{"getmatches", 0, 0, f_getmatches},
{"getpid", 0, 0, f_getpid},
{"getpos", 1, 1, f_getpos},
{"getqflist", 0, 0, f_getqflist},
{"getreg", 0, 2, f_getreg},
@@ -9203,13 +9207,13 @@ f_filewritable(argvars, rettv)
rettv->vval.v_number = filewritable(get_tv_string(&argvars[0]));
}
static void findfilendir __ARGS((typval_T *argvars, typval_T *rettv, int dir));
static void findfilendir __ARGS((typval_T *argvars, typval_T *rettv, int find_what));
static void
findfilendir(argvars, rettv, dir)
findfilendir(argvars, rettv, find_what)
typval_T *argvars;
typval_T *rettv;
int dir;
int find_what;
{
#ifdef FEAT_SEARCHPATH
char_u *fname;
@@ -9254,8 +9258,11 @@ findfilendir(argvars, rettv, dir)
vim_free(fresult);
fresult = find_file_in_path_option(first ? fname : NULL,
first ? (int)STRLEN(fname) : 0,
0, first, path, dir, curbuf->b_ffname,
dir ? (char_u *)"" : curbuf->b_p_sua);
0, first, path,
find_what,
curbuf->b_ffname,
find_what == FINDFILE_DIR
? (char_u *)"" : curbuf->b_p_sua);
first = FALSE;
if (fresult != NULL && rettv->v_type == VAR_LIST)
@@ -9445,7 +9452,7 @@ f_finddir(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
findfilendir(argvars, rettv, TRUE);
findfilendir(argvars, rettv, FINDFILE_DIR);
}
/*
@@ -9456,7 +9463,20 @@ f_findfile(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
findfilendir(argvars, rettv, FALSE);
findfilendir(argvars, rettv, FINDFILE_FILE);
}
/*
* "fnameescape({string})" function
*/
static void
f_fnameescape(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
rettv->vval.v_string = vim_strsave_fnameescape(
get_tv_string(&argvars[0]), FALSE);
rettv->v_type = VAR_STRING;
}
/*
@@ -10370,6 +10390,18 @@ f_getmatches(argvars, rettv)
#endif
}
/*
* "getpid()" function
*/
/*ARGSUSED*/
static void
f_getpid(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
rettv->vval.v_number = mch_get_pid();
}
/*
* "getpos(string)" function
*/
@@ -13957,6 +13989,7 @@ f_reverse(argvars, rettv)
rettv->vval.v_list = l;
rettv->v_type = VAR_LIST;
++l->lv_refcount;
l->lv_idx = l->lv_len - l->lv_idx - 1;
}
}
@@ -14665,6 +14698,8 @@ f_setline(argvars, rettv)
appended_lines_mark(lcount, added);
}
static void set_qf_ll_list __ARGS((win_T *wp, typval_T *list_arg, typval_T *action_arg, typval_T *rettv));
/*
* Used by "setqflist()" and "setloclist()" functions
*/
@@ -14796,24 +14831,31 @@ f_setpos(argvars, rettv)
int fnum;
char_u *name;
rettv->vval.v_number = -1;
name = get_tv_string_chk(argvars);
if (name != NULL)
{
if (list2fpos(&argvars[1], &pos, &fnum) == OK)
{
--pos.col;
if (name[0] == '.') /* cursor */
if (name[0] == '.' && name[1] == NUL)
{
/* set cursor */
if (fnum == curbuf->b_fnum)
{
curwin->w_cursor = pos;
check_cursor();
rettv->vval.v_number = 0;
}
else
EMSG(_(e_invarg));
}
else if (name[0] == '\'') /* mark */
(void)setmark_pos(name[1], &pos, fnum);
else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL)
{
/* set mark */
if (setmark_pos(name[1], &pos, fnum) == OK)
rettv->vval.v_number = 0;
}
else
EMSG(_(e_invarg));
}
@@ -15196,7 +15238,7 @@ f_sort(argvars, rettv)
if (!item_compare_func_err)
{
/* Clear the List and append the items in the sorted order. */
l->lv_first = l->lv_last = NULL;
l->lv_first = l->lv_last = l->lv_idx_item = NULL;
l->lv_len = 0;
for (i = 0; i < len; ++i)
list_append(l, ptrs[i]);
@@ -21046,8 +21088,12 @@ static int shortpath_for_invalid_fname __ARGS((char_u **fname, char_u **bufp, in
static int shortpath_for_partial __ARGS((char_u **fnamep, char_u **bufp, int *fnamelen));
/*
* Get the short pathname of a file.
* Returns 1 on success. *fnamelen is 0 for nonexistent path.
* Get the short path (8.3) for the filename in "fnamep".
* Only works for a valid file name.
* When the path gets longer "fnamep" is changed and the allocated buffer
* is put in "bufp".
* *fnamelen is the length of "fnamep" and set to 0 for a nonexistent path.
* Returns OK on success, FAIL on failure.
*/
static int
get_short_pathname(fnamep, bufp, fnamelen)
@@ -21055,36 +21101,44 @@ get_short_pathname(fnamep, bufp, fnamelen)
char_u **bufp;
int *fnamelen;
{
int l,len;
int l, len;
char_u *newbuf;
len = *fnamelen;
l = GetShortPathName(*fnamep, *fnamep, len);
if (l > len - 1)
{
/* If that doesn't work (not enough space), then save the string
* and try again with a new buffer big enough
*/
* and try again with a new buffer big enough. */
newbuf = vim_strnsave(*fnamep, l);
if (newbuf == NULL)
return 0;
return FAIL;
vim_free(*bufp);
*fnamep = *bufp = newbuf;
l = GetShortPathName(*fnamep,*fnamep,l+1);
/* Really should always succeed, as the buffer is big enough */
/* Really should always succeed, as the buffer is big enough. */
l = GetShortPathName(*fnamep, *fnamep, l+1);
}
*fnamelen = l;
return 1;
return OK;
}
/*
* Create a short path name. Returns the length of the buffer it needs.
* Doesn't copy over the end of the buffer passed in.
* Get the short path (8.3) for the filename in "fname". The converted
* path is returned in "bufp".
*
* Some of the directories specified in "fname" may not exist. This function
* will shorten the existing directories at the beginning of the path and then
* append the remaining non-existing path.
*
* fname - Pointer to the filename to shorten. On return, contains the
* pointer to the shortened pathname
* bufp - Pointer to an allocated buffer for the filename.
* fnamelen - Length of the filename pointed to by fname
*
* Returns OK on success (or nothing done) and FAIL on failure (out of memory).
*/
static int
shortpath_for_invalid_fname(fname, bufp, fnamelen)
@@ -21092,85 +21146,106 @@ shortpath_for_invalid_fname(fname, bufp, fnamelen)
char_u **bufp;
int *fnamelen;
{
char_u *s, *p, *pbuf2, *pbuf3;
char_u *short_fname, *save_fname, *pbuf_unused;
char_u *endp, *save_endp;
char_u ch;
int len, len2, plen, slen;
int old_len, len;
int new_len, sfx_len;
int retval = OK;
/* Make a copy */
len2 = *fnamelen;
pbuf2 = vim_strnsave(*fname, len2);
pbuf3 = NULL;
old_len = *fnamelen;
save_fname = vim_strnsave(*fname, old_len);
pbuf_unused = NULL;
short_fname = NULL;
s = pbuf2 + len2 - 1; /* Find the end */
slen = 1;
plen = len2;
endp = save_fname + old_len - 1; /* Find the end of the copy */
save_endp = endp;
if (after_pathsep(pbuf2, s + 1))
/*
* Try shortening the supplied path till it succeeds by removing one
* directory at a time from the tail of the path.
*/
len = 0;
for (;;)
{
--s;
++slen;
--plen;
/* go back one path-separator */
while (endp > save_fname && !after_pathsep(save_fname, endp + 1))
--endp;
if (endp <= save_fname)
break; /* processed the complete path */
/*
* Replace the path separator with a NUL and try to shorten the
* resulting path.
*/
ch = *endp;
*endp = 0;
short_fname = save_fname;
len = STRLEN(short_fname) + 1;
if (get_short_pathname(&short_fname, &pbuf_unused, &len) == FAIL)
{
retval = FAIL;
goto theend;
}
*endp = ch; /* preserve the string */
if (len > 0)
break; /* successfully shortened the path */
/* failed to shorten the path. Skip the path separator */
--endp;
}
do
if (len > 0)
{
/* Go back one path-separator */
while (s > pbuf2 && !after_pathsep(pbuf2, s + 1))
{
--s;
++slen;
--plen;
}
if (s <= pbuf2)
break;
/*
* Succeeded in shortening the path. Now concatenate the shortened
* path with the remaining path at the tail.
*/
/* Remember the character that is about to be splatted */
ch = *s;
*s = 0; /* get_short_pathname requires a null-terminated string */
/* Compute the length of the new path. */
sfx_len = (int)(save_endp - endp) + 1;
new_len = len + sfx_len;
/* Try it in situ */
p = pbuf2;
if (!get_short_pathname(&p, &pbuf3, &plen))
{
vim_free(pbuf2);
return -1;
}
*s = ch; /* Preserve the string */
} while (plen == 0);
if (plen > 0)
{
/* Remember the length of the new string. */
*fnamelen = len = plen + slen;
*fnamelen = new_len;
vim_free(*bufp);
if (len > len2)
if (new_len > old_len)
{
/* If there's not enough space in the currently allocated string,
* then copy it to a buffer big enough.
*/
*fname= *bufp = vim_strnsave(p, len);
/* There is not enough space in the currently allocated string,
* copy it to a buffer big enough. */
*fname = *bufp = vim_strnsave(short_fname, new_len);
if (*fname == NULL)
return -1;
{
retval = FAIL;
goto theend;
}
}
else
{
/* Transfer pbuf2 to being the main buffer (it's big enough) */
*fname = *bufp = pbuf2;
if (p != pbuf2)
strncpy(*fname, p, plen);
pbuf2 = NULL;
/* Transfer short_fname to the main buffer (it's big enough),
* unless get_short_pathname() did its work in-place. */
*fname = *bufp = save_fname;
if (short_fname != save_fname)
vim_strncpy(save_fname, short_fname, len);
save_fname = NULL;
}
/* Concat the next bit */
strncpy(*fname + plen, s, slen);
(*fname)[len] = '\0';
/* concat the not-shortened part of the path */
vim_strncpy(*fname + len, endp, sfx_len);
(*fname)[new_len] = NUL;
}
vim_free(pbuf3);
vim_free(pbuf2);
return 0;
theend:
vim_free(pbuf_unused);
vim_free(save_fname);
return retval;
}
/*
* Get a pathname for a partial path.
* Returns OK for success, FAIL for failure.
*/
static int
shortpath_for_partial(fnamep, bufp, fnamelen)
@@ -21200,8 +21275,8 @@ shortpath_for_partial(fnamep, bufp, fnamelen)
len = tflen = (int)STRLEN(tfname);
if (!get_short_pathname(&tfname, &pbuf, &len))
return -1;
if (get_short_pathname(&tfname, &pbuf, &len) == FAIL)
return FAIL;
if (len == 0)
{
@@ -21210,8 +21285,8 @@ shortpath_for_partial(fnamep, bufp, fnamelen)
* there's not a lot of point in guessing what it might be.
*/
len = tflen;
if (shortpath_for_invalid_fname(&tfname, &pbuf, &len) == -1)
return -1;
if (shortpath_for_invalid_fname(&tfname, &pbuf, &len) == FAIL)
return FAIL;
}
/* Count the paths backward to find the beginning of the desired string. */
@@ -21235,7 +21310,7 @@ shortpath_for_partial(fnamep, bufp, fnamelen)
if (p >= tfname)
*p = '~';
else
return -1;
return FAIL;
}
else
++p;
@@ -21246,7 +21321,7 @@ shortpath_for_partial(fnamep, bufp, fnamelen)
*bufp = pbuf;
*fnamep = p;
return 0;
return OK;
}
#endif /* WIN3264 */
@@ -21254,7 +21329,7 @@ shortpath_for_partial(fnamep, bufp, fnamelen)
* Adjust a filename, according to a string of modifiers.
* *fnamep must be NUL terminated when called. When returning, the length is
* determined by *fnamelen.
* Returns valid flags.
* Returns VALID_ flags or -1 for failure.
* When there is an error, *fnamep is set to NULL.
*/
int
@@ -21466,7 +21541,7 @@ repeat:
*/
if (!has_fullname && !vim_isAbsName(*fnamep))
{
if (shortpath_for_partial(fnamep, bufp, fnamelen) == -1)
if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL)
return -1;
}
else
@@ -21476,7 +21551,7 @@ repeat:
/* Simple case, already have the full-name
* Nearly always shorter, so try first time. */
l = *fnamelen;
if (!get_short_pathname(fnamep, bufp, &l))
if (get_short_pathname(fnamep, bufp, &l) == FAIL)
return -1;
if (l == 0)
@@ -21484,7 +21559,7 @@ repeat:
/* Couldn't find the filename.. search the paths.
*/
l = *fnamelen;
if (shortpath_for_invalid_fname(fnamep, bufp, &l ) == -1)
if (shortpath_for_invalid_fname(fnamep, bufp, &l) == FAIL)
return -1;
}
*fnamelen = l;
+9 -1
View File
@@ -365,6 +365,10 @@ ex_sort(eap)
int sort_oct; /* sort on octal number */
int sort_hex; /* sort on hex number */
/* Sorting one line is really quick! */
if (count <= 1)
return;
if (u_save((linenr_T)(eap->line1 - 1), (linenr_T)(eap->line2 + 1)) == FAIL)
return;
sortbuf1 = NULL;
@@ -1156,6 +1160,7 @@ do_filter(line1, line2, eap, cmd, do_in, do_out)
if (!do_out)
msg_putchar('\n');
/* Create the shell command in allocated memory. */
cmd_buf = make_filter_cmd(cmd, itmp, otmp);
if (cmd_buf == NULL)
goto filterend;
@@ -1176,7 +1181,10 @@ do_filter(line1, line2, eap, cmd, do_in, do_out)
if (do_out)
{
if (u_save((linenr_T)(line2), (linenr_T)(line2 + 1)) == FAIL)
{
vim_free(cmd_buf);
goto error;
}
redraw_curbuf_later(VALID);
}
read_linecount = curbuf->b_ml.ml_line_count;
@@ -4467,7 +4475,7 @@ do_sub(eap)
/*
* The new text is build up step by step, to avoid too much
* copying. There are these pieces:
* sub_firstline The old text, unmodifed.
* sub_firstline The old text, unmodified.
* copycol Column in the old text where we started
* looking for a match; from here old text still
* needs to be copied to the new text.

Some files were not shown because too many files have changed in this diff Show More