Commit Graph

234 Commits

Author SHA1 Message Date
Jacob Bandes-Storch
b533df1a40 Bar button positioning tweaks 2013-07-21 13:42:43 +02:00
Allan Odgaard
27e0abfa39 Add support for printing
Closes #517.
2013-06-28 19:32:56 +02:00
Allan Odgaard
5c4a2025a3 Add menu item to toggle column selection
The motivation for this is mainly to make the ⌥ shortcut visible in the UI, which presently, it is not, as we need to “hack” the menu item to show it.
2013-06-23 11:23:42 +07:00
Allan Odgaard
e3bc6e982b Introduce editor_delegate_t
This is to avoid having editor_t hold a document_t.
2013-05-15 22:38:02 +07:00
Allan Odgaard
adf52e1ab2 Forward grammar changes to text view 2013-05-15 15:45:36 +07:00
Allan Odgaard
6e4926177e Provide symmetric content/set_content for document_t 2013-05-15 15:45:36 +07:00
Allan Odgaard
61b8c844a5 fixup! Handle “did-save” bundle item callback in OakTextView 2013-05-12 22:48:46 +07:00
Allan Odgaard
e5cca3de18 Remove ‘document_settings’ API 2013-05-12 11:09:18 +07:00
Allan Odgaard
ce4ae62547 Change ‘variables_for_path’ API
We now accept the a directory in addition to the path. If a directory is provided, the path is only used to filter variables rooted at the directory.
2013-05-12 11:09:18 +07:00
Allan Odgaard
8b3f05485d Change argument ordering for ‘scope_variables’
Generally we should always provide a base environment, since the scoped variables are format strings. The filtering scope selector is however optional, and we do not have one when executing commands outside an fi;e/editor context.
2013-05-12 11:09:17 +07:00
Allan Odgaard
10e3536a80 Change method signature
We return a variables map instead of updating a map passed in by reference. The previous API was mainly done because we couldn’t previously return non-POD from Objective-C methods. Returning a map with variables makes the API more exact, e.g. how to handle existing entries is no longer an issue (that is, the caller will have to chose the appropriate duplicate strategy).
2013-05-12 11:09:17 +07:00
Allan Odgaard
12491e22f8 Let OakTextView set TM_CURRENT_THEME_PATH
Previously we relied on the delegate to set this, but a text view may not have a delegate. One could however argue that this is a “global” setting so should be set even when there is no text view.
2013-05-12 11:09:16 +07:00
Allan Odgaard
9b4734bf98 Explicitly collect variables from different components 2013-05-12 11:09:16 +07:00
Allan Odgaard
92192341d4 Let OakTextView pass an environment to document::run()
We no longer pass the bundle item by const-reference because it is now used (delayed) in a block and const-references are not captured by blocks (i.e. the lifespan is not extended).
2013-05-12 11:09:16 +07:00
Allan Odgaard
421a46d116 Rework setup/execution of drop commands
We now collect all variables (and working directory) prior to calling document::run() to remove the need for a callback.
2013-05-12 11:09:16 +07:00
Allan Odgaard
964b56898f Consult text view delegate when setting up variables
The delegate provides file browser variables.
2013-05-12 11:09:16 +07:00
Allan Odgaard
ccf2414768 Add pwd argument to command runner
Previously this was only possible to change by setting PWD in the passed-in environment.
2013-05-12 11:09:15 +07:00
Allan Odgaard
7f4649ba32 Factor out deprecated variable collecting 2013-05-12 11:09:15 +07:00
Allan Odgaard
428739352c Obtain variables and scope context via ‘self’
This is instead of direct instance variable access.
2013-05-12 11:09:15 +07:00
Allan Odgaard
88ae04572c Handle “did-save” bundle item callback in OakTextView
While it’s easier to execute bundle items from a text view, it doesn’t work when saving documents that are not in the current text view.

This is an intermediate refactoring step — handling should (likely) end up in the DocumentSaveHelper class, but we need to improve dealing with command execution first, and by having the callback piggyback on the normal performBundleItem: method, we (temporarily) limit the code which use the command execution API, making refactoring easier.
2013-05-09 15:16:33 +07:00
Allan Odgaard
4c24bd9c00 Avoid ref to static data when returning non-POD from Objective-C
Apparently clang (now?) support transferring non-POD types from and to Objective-C++ methods, eliminating the need for doing this by passing a (const) reference.
2013-05-09 15:16:33 +07:00
Allan Odgaard
5fd188531a Change naming of functions for obtaining variables
These are now all prefixed with what they are obtaining variables for (scope, document, bundle, …) which makes it easier to analyze/refactor the code.

Also change document_t’s settings function to document_settings.
2013-05-09 15:16:32 +07:00
Allan Odgaard
135c6c79b7 Remove redundant instance variable 2013-05-06 14:51:31 +07:00
Allan Odgaard
7796e18e59 Limit exposed stuff in OTV headers 2013-05-03 14:41:52 +07:00
Allan Odgaard
715624b952 Handle failure to create folding dots image
Based on crash reports this appears to happen for some users, though only reason I can imagine is if the images are not found in the application bundle (which would happen if the application is moved after launch, but that normally cause many things to fail).
2013-04-28 11:46:35 +07:00
Allan Odgaard
bcc3e4c1fb Fix refresh/undo for commands causing document saving
Since saving is asynchronous the scoped refresh/undo helper would do “cleanup” before the command ran and potentially made document changes.

Commands executed at a lower level (i.e. by editor_t via macros) presently still has this issue. This should be fixed when macros are refactored (this isn’t the only issue related to macros).

Closes #450.
2013-04-25 16:38:33 +07:00
Allan Odgaard
f81292aa51 Only disable font smoothing on high-DPI displays
The fontSmoothing defaults key can now be set to:

 0: Always disabled
 1: Always enabled
 2: Disabled for dark themes
 3: Disabled for dark themes on high-DPI displays (default)

/cc issue #958.
2013-04-24 21:54:27 +07:00
Allan Odgaard
fe400c1487 Disable font smoothing for dark themes
If you wish to always have font smoothing enabled you can run:

    defaults write com.macromates.TextMate.preview fontSmoothing 1

Setting the value to 0 causes it to always be disabled and deleting the key (or setting it to 2) has it disabled only for dark themes.
2013-04-21 19:17:06 +07:00
Allan Odgaard
ced23336de Harmonize a few properties
This is just implementation detail.
2013-04-21 19:15:05 +07:00
Allan Odgaard
974e263588 Remove instance data from OakTextView.h 2013-04-21 19:15:05 +07:00
Sergey Chikuyonok
72dd8e2047 Extended OakTextView API
Added `scopeAsString` method to retrieve current scope as NSString
2013-04-21 12:20:07 +07:00
Allan Odgaard
773891cd47 Introduce global setting to disable typing pairs
This is presently only settable via the ‘disableTypingPairs’ user defaults key:

    defaults write com.macromates.TextMate.preview disableTypingPairs -bool YES

Closes #609.
2013-04-10 10:13:01 +07:00
Allan Odgaard
7f933bfc57 Disable auto-pairing when recording macros
Since auto-pairing can be adjusted via user customization we disable it for both macro recording and replay. Old macros will need to be updated (but this was already the case, as 2.0 never did pairing as part of replay).

A better solution is to record each implicit action of the auto-pairing in the macro. This can however be added later without breaking existing macros, as the macro player will remain the same.

Closes #130.
2013-04-10 10:13:01 +07:00
Allan Odgaard
0bf02dbeff Move divider line functions to OakUIConstructionFunctions.h 2013-04-02 04:11:32 +07:00
Allan Odgaard
d72baacff4 Move divider image creation to OakUIConstructionFunctions.h 2013-04-02 04:11:32 +07:00
Allan Odgaard
1aedd95ef5 Find dialog actions are now recorded (for replay)
Presently though replaying “Replace and Find” is not implemented.
2013-03-27 17:19:10 +01:00
Allan Odgaard
b0726652db Record find actions via primary selector
Still lack recording for Find dialog actions.
2013-03-27 16:27:54 +01:00
Allan Odgaard
3dc05d9fc9 Implement Save Macro functionality
Closes #459.
2013-03-27 14:32:22 +01:00
Allan Odgaard
7b115dc212 Always show tool tip when command fails 2013-03-26 13:46:36 +01:00
Jacob Bandes-Storch
37e98655ec Implement filter through command
Closes #131
2013-03-21 22:12:08 +01:00
Jacob Bandes-Storch
65eb9c271f Clean up formatting of selection string 2013-03-21 11:41:31 +01:00
Jacob Bandes-Storch
98a7cd1e08 Add an etched effect to the status/action bar dividers 2013-03-21 04:59:14 -05:00
Allan Odgaard
149d335335 Setup exception handler around editor_t::perform
The implementation of kPaste seems to generate an exception for some users, but I don’t know exactly why, so this should provide some better diagnostics info.
2013-03-20 11:30:41 +01:00
Allan Odgaard
315908e2d8 Update menu item titles in Text menu
These now reflect whether or not the action works on the selection.
2013-03-16 17:49:48 +01:00
Allan Odgaard
3a75199e9d Use menu validation to update bundle menu item titles
This means we don’t need to know if there is a selection when creating the menu items and long-term it’ll be easier to introduce more complex updating, e.g. make the title a format string to allow referencing TM_DISPLAYNAME or disable the menu item if its requirements cannot be met.
2013-03-16 17:49:48 +01:00
Allan Odgaard
d8cf1e3591 Gather UI construction code and harmonize fonts 2013-03-13 12:38:11 +01:00
Allan Odgaard
be65671e52 Fix shell quoting for selected files
There would be a pair of redundant single quotes after each quoted path.
2013-03-10 16:07:09 +01:00
Allan Odgaard
14cfedb287 Implement Replace [and Find] bound to ⌥⌘G
Currently this is implemented in OakTextView which means that it doesn’t work for macros. Some refactoring is in order so that the implementation can be shared (lack of sharing has to do with how OakTextView reports status to Find dialog or via tool tips, and macros want none of that).

There is also no check to see if the current state of the editor is the result of a find operation, i.e. you can invoke “replace” regardless of wether or not “find” was the last action.

Finally, doing a multi-file search and using “find next” at the end of one document, which brings you to the first match of next document (part of the results), will not update “captures” from a potential regular expression search, meaning that if you then do “replace”, and your replacement string is a format string that references the match (via $1-n) then it will not be correctly expanded.

Closes #104.
2013-03-07 16:21:57 +01:00
Allan Odgaard
5ad6d0c5c0 Simplify implementation of OakTextViewFindServer 2013-03-07 16:21:56 +01:00
Allan Odgaard
02f32977f2 Introduce Replace [and Find] in find protocol
Previously there was a single replace action and the options would indicate if it was a “replace all”, this mimics the “find” (which can be a “find all”) but since single match replacement is somewhat different than a “replace all”, as the former may need to know the captures from a previous find action, it makes sense to factor out these things as different actions.
2013-03-07 16:21:47 +01:00