Commit Graph

177 Commits

Author SHA1 Message Date
Allan Odgaard
acd3bdf234 Convert leading em-spaces in symbol menu to item indent
By using the menu item’s indentation level property it is possible to “type to select” items, which previously would not work for items that had leading em-space as a prefix.

Closes #806.
2013-02-20 18:08:24 +01:00
Allan Odgaard
77f53c3e3e Use a const reference for gutter colors 2013-02-18 15:38:27 +01:00
Allan Odgaard
22b00f2848 Remove unused ‘textColor’ parameter 2013-02-18 15:38:26 +01:00
Allan Odgaard
95b4055772 Fix debug output
Also add leak-watching to OakTextView.
2013-02-16 10:43:55 +01:00
Allan Odgaard
d127483dcc Fix retain cycles
Fixes #794
2013-02-16 10:43:55 +01:00
Michael Sheets
ecd666f24a Improve constraint widths for status bar.
- Set compression priorities to collapse fields in a desirable order.
- Increase default width of selection string to fit 8888:88
- Set grammar popup to the width of the active grammar and give is sensible minimum/maximum widths.
- Set a maximum width for the tab size menu.
2013-02-15 07:09:48 -06:00
Allan Odgaard
3669e671c7 Strip “offset” from selection string in status bar 2013-02-14 11:31:21 +01:00
Allan Odgaard
83505a47e2 Change status bar’s “caret” property
We now use a selection string so status bar doesn’t need to know about what it actually contains.
2013-02-14 11:31:21 +01:00
Allan Odgaard
94f0c803f7 Limit status bar redraw
The NSPopUpButton itself will not bypass redisplay even if it’s title is set to the current title.
2013-02-14 11:31:20 +01:00
Allan Odgaard
43fa57ae22 Don’t draw status bar background on window border 2013-02-14 11:31:20 +01:00
Allan Odgaard
9338109452 Fix NSTimer related crash
The timer might be the only thing keeping us retained, so we can’t release it until the very end of the method.
2013-02-14 11:31:20 +01:00
Michael Sheets
05af681717 Truncate the selection string when it grows too long. 2013-02-14 11:27:53 +01:00
Allan Odgaard
8f3e99bc79 Gutter height now accounts for horizontal scrollbar
Previously the gutter and the text view were set to have the same height (via constraints). Though when the horizontal scrollbar is visible then the gutter should technically be made a little taller to account for the extra bottom margin. Not adding this space was causing problems.

Fixes #773.
2013-02-13 10:51:07 +01:00
Allan Odgaard
3bc3db00aa ARC: Update OakTextView framework 2013-02-12 23:06:48 +01:00
Allan Odgaard
f886b0cb13 Update text view status bar to use system controls 2013-02-12 21:55:56 +01:00
Allan Odgaard
402e1f79b1 Use one bundle menu delegate for all menus
This avoids the problem of keeping the delegate retained while the menu is up (the menu item exists).
2013-02-12 20:11:50 +01:00
Allan Odgaard
4a812117e7 Fix memory leak 2013-02-11 15:17:30 +01:00
Allan Odgaard
a9e59f5308 Set spelling language for current folder when changed via UI
Previously we would set it for the current file (via path) and the current scope plus parent scopes.

The latter wasn’t useful, as the file type is not indicative of the language used, and as scoped settings presently have higher priority than path-based settings, it could lead to the wrong language being used, even when language was explicitly set for a folder.

Now, when changing language via Edit → Spelling menu, we set the language globally (so default for all new documents without more specific settings), all files in the current document’s folder, and the document itself.
2013-02-11 14:21:23 +01:00
Allan Odgaard
bdadf0f17f Let text view reset cut/copy menu item titles
This is necessary since opening the Edit menu with focus in file browser may update the titles to reflect files that would be cut or copied.
2013-02-11 14:21:23 +01:00
Allan Odgaard
f5541b2a1c Don’t try to toggle caret with no layout 2013-02-11 14:21:21 +01:00
Allan Odgaard
8fb95309c1 Reset undo/redo menu item titles
The undo manager will change the titles (e.g. “Undo Rename”) when it’s first responder, so we need to change them back, when the text view is first responder.
2013-02-11 14:21:21 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
fbb2f972f9 Don’t mark parent views as opaque
The reason for this is that NSTextField will draw itself in the “faded” state (for non-key windows) unless some of its parent views are marked opaque.

The previous problem with not having the parent views opaque (see da3a91a7bb) seems to have been solved by setting the autohidesScrollers property to YES.
2013-02-06 14:50:04 +01:00
Allan Odgaard
ad750b0b76 Auto-hide the text view’s scroll bars
This is for users who have set “show scroll bars” to “always” (or auto and am using a mouse).

Closes #527.
2013-02-06 14:50:04 +01:00
Joachim Mårtensson
8de62bbc85 Don't mutate shared themes 2013-02-04 20:44:21 +01:00
Allan Odgaard
32fcb52c68 Workaround for clang linker warning
Using instances with static storage in Objective-C files result in the following warning (starting with clang 425.0.24):

ld: warning: direct access in […] to global weak symbol […] means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
2013-02-02 08:52:12 +01:00
Allan Odgaard
0413f35eeb Rework symbol chooser code
The symbol chooser is now owned by DocumentView instead of DocumentController.

The symbol chooser does not know about its owner and is not an observer of any notifications. Instead it has a property for “document” and one for “selectionString”. It is the owners job to update these properties (i.e. when switching document or changing the selection).
2013-01-30 16:17:32 +01:00
Steven Clukey
b9d9e9140a SymbolChooser live-updates its selections
This code is public domain.

Closes #166.
2013-01-30 16:00:04 +01:00
Allan Odgaard
99203d332d Proper refresh when dropping files on text view 2013-01-29 15:31:11 +01:00
Allan Odgaard
18998cba53 Drop snippets on undo
This isn’t ideal but better than a potential crash (following the next edit). A better solution will have to wait to a larger refactoring (which should also consider multiple editors working on the same buffer).

Closes #186.
2013-01-29 15:31:10 +01:00
Allan Odgaard
adb2ed7b64 Use sel_getName() instead of typecast 2013-01-29 15:28:22 +01:00
Allan Odgaard
269a6ae3c2 Use “standard” divider above incremental search 2013-01-28 15:44:27 +01:00
Allan Odgaard
4e76b6f41e Use last string when bringing up incremental search
Closes #631.
2013-01-28 15:44:27 +01:00
Allan Odgaard
036a53582c Replace live search xib with code 2013-01-28 15:44:27 +01:00
Allan Odgaard
456209730d Improve autoscroll when drag-selecting outside viewport
When user drag-selects and moves mouse outside the viewport, we do not want to use ‘ensureSelectionIsInVisibleArea:’ because that method looks only on the selection, particularly the non-anchored end-point (and works differently for unanchored selections). Instead we want to scroll the point corresponding to the mouse position inside the viewport.

Fixes #475.
2013-01-28 12:42:28 +01:00
Allan Odgaard
7831a40b23 fixup! Improve scroll when selecting units 2013-01-28 12:42:28 +01:00
Allan Odgaard
c684dd03d2 Add bug tracking ID annotation 2013-01-28 12:42:28 +01:00
Allan Odgaard
49bb52c812 Improve scroll when selecting units
When selecting a unit (Edit → Select submenu or e.g. Find Next) then we only scroll if we can make the entire selection visible.

Closes #692.
2013-01-23 12:36:47 +01:00
Allan Odgaard
c8ab123aaf Move font name/size to theme_t
Since styles_for_scope effectively ignore the font parameters (and instead return styles based on the font parameters used when the cache entry was created) it is a better design to have theme_t own the font. This way, changing it can do the proper cache invalidation.

A minor downside is that we can now change the font of the theme without also changing the layout’s font, which wouldn’t cause proper layout invalidation — since layout_t owns theme_t though, users of a layout should always change font via layout_t (which will then change it in the theme).

Also, themes cannot be shared between views that wish to use different font settings.
2013-01-23 09:33:29 +01:00
Allan Odgaard
49a822c0d5 Remove instance data from header
Also add type-safety by introducing a protocol for the delegate.
2013-01-22 08:03:07 +01:00
Allan Odgaard
fe3dff7af6 Replace custom code with kSelectionExtendToWord 2013-01-20 12:49:34 +01:00
Allan Odgaard
ec79163f30 Avoid editor_t::variables for getting selected text 2013-01-20 12:49:34 +01:00
Allan Odgaard
e46ea56af9 Exclude gutter from accessibility
This was read as “empty scroll view” (using voice over), so better to skip it.
2013-01-17 09:16:04 +01:00
Allan Odgaard
8618224d00 Use OakCreateViewWithColor() 2013-01-16 04:40:20 +01:00
Allan Odgaard
bccaee4be6 Simplify document open API
Removed the ability to specify wether documents should open in current window or a new window — all documents opened via this API will go through the same algorithm to find where the documents should end up (more choice is just adding confusion and complexity).
2013-01-10 06:46:44 +01:00
Allan Odgaard
56ec501907 Only grab ‘untitled’ token for user-created documents
We may use OakDocumentView in a context where we don’t immediately assign it a document, or we wish to “overwrite” its default document with an untitled document that we create.

If the document view holds its own untitled document then the global counter includes that and the one we create is one higher than expected.
2013-01-08 22:48:08 +01:00
Allan Odgaard
47fa0f040c Use Objective-C literals for YES/NO 2013-01-02 01:46:48 +01:00
Allan Odgaard
8e937a7141 Require explicit import of OakFindProtocol.h 2013-01-02 01:46:48 +01:00
Allan Odgaard
c2d3690848 Remove ‘CT’-prefix from user functions 2012-12-21 16:05:28 +01:00
Allan Odgaard
8c4c927397 Workaround for possible NULL pointer
Seeing a few crashes related to CFRetain() called from CTFontCreateWithName(). My guess is that a nil font results from a bad/corrupted config file, so the actual fix might be to ensure we have a font (at a higher level).
2012-12-21 16:00:42 +01:00