diff --git a/MMBackend.m b/MMBackend.m index aa1a1ab9d2..09647dd310 100644 --- a/MMBackend.m +++ b/MMBackend.m @@ -13,10 +13,12 @@ // NOTE: Colors in MMBackend are stored as unsigned ints on the form 0xaarrggbb -// whereas colors in Vim are int without the alpha component. +// whereas colors in Vim are int without the alpha component. Also note that +// 'transp' is assumed to be a value between 0 and 100. #define MM_COLOR(col) ((unsigned)( ((col)&0xffffff) | 0xff000000 )) #define MM_COLOR_WITH_TRANSP(col,transp) \ - ((unsigned)( ((col)&0xffffff) | (((unsigned)(255-(transp))&0xff)<<24) )) + ((unsigned)( ((col)&0xffffff) \ + | ((((unsigned)((((100-(transp))*255)/100)+.5f))&0xff)<<24) )) // This constant controls how often the command queue may be flushed. If it is diff --git a/gui_macvim.m b/gui_macvim.m index 53673eaf2c..655e1f6d98 100644 --- a/gui_macvim.m +++ b/gui_macvim.m @@ -651,8 +651,8 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) name:(char*)name tip:(char*)tip icon:(char*)icon - keyEquivalent:menu->ke_key - modifiers:menu->ke_mods + keyEquivalent:menu->mac_key + modifiers:menu->mac_mods action:action atIndex:idx]; @@ -1024,7 +1024,7 @@ mch_set_mouse_shape(int shape) void -ex_action(eap) +ex_macaction(eap) exarg_T *eap; { if (!gui.in_use) { diff --git a/gvimrc b/gvimrc index 05efb98c5f..fb20b1e9ab 100644 --- a/gvimrc +++ b/gvimrc @@ -36,7 +36,7 @@ aunmenu File.-SEP4- aunmenu File.Exit aunmenu File.Save-Exit -an 10.290 File.New\ Window :action newWindow: +an 10.290 File.New\ Window :maca newWindow: an 10.295 File.New\ Tab :tabnew an 10.328 File.-SEP0- an 10.330 File.Close\ Window:qa :confirm qa @@ -44,24 +44,27 @@ an 10.331 File.Close:q :confirm q "an 10.331 File.Close\ Tab :tabclose an 20.460 Edit.-SEP4- -an 20.465.10 Edit.Font.Show\ Fonts :action orderFrontFontPanel: +an 20.465.10 Edit.Font.Show\ Fonts :maca orderFrontFontPanel: an 20.465.20 Edit.Font.-SEP5- -an 20.465.30 Edit.Font.Bigger :action fontSizeUp: -an 20.465.40 Edit.Font.Smaller :action fontSizeDown: -an 20.470 Edit.Special\ Characters\.\.\. :action orderFrontCharacterPalette: +an 20.465.30 Edit.Font.Bigger :maca fontSizeUp: +an 20.465.40 Edit.Font.Smaller :maca fontSizeDown: +an 20.470 Edit.Special\ Characters\.\.\. :maca orderFrontCharacterPalette: " Window menu (should be next to Help so give it a high priority) aunmenu Window -an 9900.300 Window.Minimize :action performMiniaturize: -an 9900.310 Window.Zoom :action performZoom: -an 9900.320 Window.-SEP1- +an 9900.300 Window.Minimize :maca performMiniaturize: +an 9900.310 Window.Zoom :maca performZoom: +an 9900.320 Window.-SEP1- " TODO! Grey out if no tabs are visible. -an 9900.330 Window.Previous\ Tab :tabprevious -an 9900.340 Window.Next\ Tab :tabnext -an 9900.350 Window.-SEP2- -an 9900.360 Window.Bring\ All\ To\ Front :action arrangeInFront: +an 9900.330 Window.Previous\ Tab :tabprevious +an 9900.340 Window.Next\ Tab :tabnext +an 9900.350 Window.-SEP2- +an 9900.360 Window.Enter\ Fullscreen :set fu +an 9900.370 Window.Leave\ Fullscreen :set nofu +an 9900.380 Window.-SEP3- +an 9900.390 Window.Bring\ All\ To\ Front :maca arrangeInFront: @@ -163,41 +166,43 @@ endif " exists("macvim_hig_shift_movement") " Menu key equivalents (these should always have the 'D' modifier set) " -menukeyequiv File.New\ Window -menukeyequiv File.New\ Tab +macmenukey File.New\ Window +macmenukey File.New\ Tab -menukeyequiv File.Open\.\.\. -menukeyequiv File.Open\ Tab\.\.\. -menukeyequiv File.Close\ Window -"menukeyequiv File.Close\ Tab -menukeyequiv File.Close -menukeyequiv File.Save -menukeyequiv File.Save\ As\.\.\. -menukeyequiv File.Print +macmenukey File.Open\.\.\. +macmenukey File.Open\ Tab\.\.\. +macmenukey File.Close\ Window +"macmenukey File.Close\ Tab +macmenukey File.Close +macmenukey File.Save +macmenukey File.Save\ As\.\.\. +macmenukey File.Print -menukeyequiv Edit.Undo -menukeyequiv Edit.Redo -menukeyequiv Edit.Cut -menukeyequiv Edit.Copy -menukeyequiv Edit.Paste -menukeyequiv Edit.Select\ All -menukeyequiv Edit.Special\ Characters\.\.\. -menukeyequiv Edit.Font.Bigger -menukeyequiv Edit.Font.Smaller +macmenukey Edit.Undo +macmenukey Edit.Redo +macmenukey Edit.Cut +macmenukey Edit.Copy +macmenukey Edit.Paste +macmenukey Edit.Select\ All +macmenukey Edit.Special\ Characters\.\.\. +macmenukey Edit.Font.Bigger +macmenukey Edit.Font.Smaller -menukeyequiv Tools.Spelling.To\ Next\ error -menukeyequiv Tools.Spelling.Suggest\ Corrections -menukeyequiv Tools.Make -menukeyequiv Tools.List\ Errors -menukeyequiv Tools.List\ Messages -menukeyequiv Tools.Next\ Error -menukeyequiv Tools.Previous\ Error -menukeyequiv Tools.Older\ List -menukeyequiv Tools.Newer\ List +macmenukey Tools.Spelling.To\ Next\ error +macmenukey Tools.Spelling.Suggest\ Corrections +macmenukey Tools.Make +macmenukey Tools.List\ Errors +macmenukey Tools.List\ Messages +macmenukey Tools.Next\ Error +macmenukey Tools.Previous\ Error +macmenukey Tools.Older\ List +macmenukey Tools.Newer\ List -menukeyequiv Window.Minimize -menukeyequiv Window.Previous\ Tab -menukeyequiv Window.Next\ Tab +macmenukey Window.Minimize +macmenukey Window.Previous\ Tab +macmenukey Window.Next\ Tab +macmenukey Window.Enter\ Fullscreen +macmenukey Window.Leave\ Fullscreen " Restore the previous value of 'cpoptions'. diff --git a/runtime/doc/gui_mac.txt b/runtime/doc/gui_mac.txt index b27ecee2b4..819b677d88 100644 --- a/runtime/doc/gui_mac.txt +++ b/runtime/doc/gui_mac.txt @@ -208,14 +208,14 @@ than the default?) then post them to vim_mac. ============================================================================== 4. Menus *macvim-menus* - *:menukeyequiv* + *: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 -":menukeyequiv" 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: > - :menukeyequiv File.New\ Tab +":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 This sets the key equivalent of the "New Tab" menu item under the "File" menu to Cmd+t. @@ -224,31 +224,31 @@ Note that key equivalents: * take precedence over normal mappings made with ":map" * can only be modified during startup (e.g. in .gvimrc) -It is possible to reset a key equivalent by calling :menukeyequiv with a menu +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 (which is the key equivalent of "File.Save") then add the following line to "~/.gvimrc": > - menukeyequiv File.Save + macmenukey File.Save Now you can use :map to bind to whatever you like. 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 as the key equivalent for "Next Tab", then add the following line to "~/.gvimrc": > - menukeyequiv Window.Next\ Tab + macmenukey Window.Next\ Tab < - *:action* + *:maca* *:macaction* It is typical for menu items in Cocoa applications to bind to Objective-C -selectors. To support this, MacVim introduces the ":action" command. This +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 :action newWindow: + :an 10.290 File.New\ Window :macaction newWindow: -Note 1: A menu item which is bound to ":action" will automatically be bound to -that action in all modes (as if ":an" was used). It is not possible to bind -to ":action" in one mode only. +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. @@ -263,6 +263,8 @@ Here is a random assortment of actions from Actions.plist which might be useful. Action Description ~ +fontSizeDown: Decrease font size +fontSizeUp: Increase font size newWindow: Open a new (empty) window orderFrontCharacterPalette: Show the the "Special Characters" dialog orderFrontFontPanel: Show the Font panel @@ -271,11 +273,11 @@ selectNextWindow: Select next window (similar to ) selectPreviousWindow: Select previous window (similar to ) As an example, to map to performZoom: you could do something like this: > - :map :action performZoom: + :map :macaction performZoom: 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": > - menukeyequiv Window.Zoom + macmenukey Window.Zoom (Note that key equivalents must contain the 'D' flag.) ============================================================================== @@ -365,8 +367,8 @@ To get around this, set 'tabpagemax' to something big in your .gvimrc file (e.g. ":set tabpagemax=100"). Scenario: ~ -You want to open a file in a tab in an already opened window, but -typing "gvim filename" in Terminal opens it up in a separate window. +You want to open a file in a tab in an already opened window, but typing +"mvim filename" in Terminal opens it up in a separate window. Solution: ~ Use the |--remote-tab| switch. If you have several windows open you might have to specify which window you want the file to open in by using the @@ -374,7 +376,7 @@ might have to specify which window you want the file to open in by using the "VIM" or "VIM3" --- this is the server name of that window. So to open a file named "foobar.txt" in a window whose title ends in "VIM3" you would type (the order of the arguments matters): > - gvim --servername VIM3 --remote-tab foobar.txt + mvim --servername VIM3 --remote-tab foobar.txt For more information, consult the |client-server| manual page. Scenario: ~