Commit Graph

117 Commits

Author SHA1 Message Date
Allan Odgaard
10ef2f1034 Rename property (location → path) 2013-01-12 13:09:18 +01:00
Allan Odgaard
a9745164c7 Exclude backups from document::find by default 2013-01-12 13:09:16 +01:00
Allan Odgaard
d8bec5b761 Fix bad memory access
We wrote to instance data after potentially having been released.
2013-01-11 23:23:40 +01:00
Allan Odgaard
a545598e78 fixup! Iterate controllers instead of all window delegates 2013-01-10 21:03:29 +01:00
Allan Odgaard
9f02e86e00 Cap document array index 2013-01-10 21:03:29 +01:00
Allan Odgaard
abab5d8725 Make openItems:closingOtherTabs: more robust 2013-01-10 21:03:29 +01:00
Allan Odgaard
4a97f6e64d Save All with more than one document would crash 2013-01-10 21:03:29 +01:00
Allan Odgaard
80c358f947 Remove unnecessary hack
The issue this code solved was that setting the proxy icon via represented file before a file actually exists on disk would lead to no icon so we would have to update it again after a successful save.

This however is already done (by the save callback passed in).
2013-01-10 21:03:28 +01:00
Allan Odgaard
81b05711f0 Improve how we find window for new documents
We first search for a window containing one of the documents we wish to open, then for the window with a best match for project folder (for any of our documents), then check if frontmost window is a scratch window, and if none of the above gives a candidate, we create a new window (and give it a project folder based on the document(s) we opened).
2013-01-10 06:46:44 +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
d8cc115a5e Ensure we have a document in showWindow:
Also move (back) to using DocumentController instead of document::show().
2013-01-10 06:46:44 +01:00
Allan Odgaard
759b7d1ae5 Introduce ui_proxy_t::show_browser 2013-01-10 06:46:44 +01:00
Allan Odgaard
7b6515169f Remove unnecessary stuff
This includes the OakFilterWindow factory method as ‘new’ is just as good (now that ARC automatically autoreleases).
2013-01-10 06:46:44 +01:00
Allan Odgaard
211acb8a84 Use proper (specialized) type instead of ‘id’ 2013-01-10 06:46:43 +01:00
Allan Odgaard
cd124ac404 Iterate controllers instead of all window delegates 2013-01-10 06:46:43 +01:00
Allan Odgaard
531e8a44f1 Handle app termination in class method
It didn’t really make sense as an instance method since it iterate all instances, and we also want to execute code incase of no instances (save that fact as session data).
2013-01-10 06:46:43 +01:00
Allan Odgaard
a7a633f993 Remove procedural API for load/save of session
Since everything about session is now contained in the DocumentController class there is no need for invoking this from elsewhere and thus no need for the previous indirection.
2013-01-10 06:46:43 +01:00
Allan Odgaard
082ef43b0d Use Objective-C types in session read/write code
With the new compiler support for property list types it might be time to phase out the plist_t C++ wrapper.
2013-01-10 06:46:43 +01:00
Allan Odgaard
874520f49a Remove need for explicitly calling ‘monitor_controller’
Instead we register the class (causing a retain) when setting the object’s identifier (to a non-nil value).

This is a much better design as it (again) makes it safe to just instantiate a document controller w/o going through a special factory method. Additionally it makes it safe to change the identifier of an already created (and registered) instance.
2013-01-10 06:40:03 +01:00
Allan Odgaard
738456dbc7 Only let DocumentController schedule session saves 2013-01-10 06:40:03 +01:00
Allan Odgaard
362bf74fd9 Provide fallback search folder for non-project windows 2013-01-09 06:48:03 +01:00
Allan Odgaard
03398ed9e6 Insignificant source file touchup 2013-01-09 06:48:03 +01:00
Allan Odgaard
494c836217 Add (unused) code to prune tab bar 2013-01-09 06:48:02 +01:00
Allan Odgaard
6d46ba5363 Disable Go → Project Folder when unavailable 2013-01-09 06:48:02 +01:00
Allan Odgaard
772e7ae1b4 Use weak pointer for file browser’s delegate 2013-01-09 02:59:18 +01:00
Allan Odgaard
aa59684c7e Rework document controller
While I have tried to keep most of the functionality the same (to get functional changes spelled out in the commit history) there are some significant changes:

When you open a folder or document(s) a default project folder will be based on the path(s) opened. This means that as long as you always open the root of your project (via `mate`, `open -a TextMate`, dragging the folder to TextMate, using the favorites (⇧⌘O), open dialog, `txmt:` URL scheme, or what have you), your project no longer require a `.tm_properties` file setting `projectDirectory` for Find in Folder (⇧⌘T), Go to File (⌘T), and similar to work as desired. Additionally the default properties now set a window title that include the project folder’s name (and SCM branch when available), so most projects can now also drop setting `windowTitle`.

Furthermore the file browser (for when opening documents) will default to the project folder rather than the folder set in Preferences (the latter is still used if there is no document, e.g. after ⌘N or ⌃⌘N).

The default project folder, even for opening a single document, means that opening more documents from the same folder (via Finder or perhaps something that uses the same temp folder for the local versions (which `rmate` does)) means that the following documents will open as tabs in the already open window (containing the first one opened). I _think_ this takes care of the common request of having all documents opened appear in new tabs of the frontmost window.

For managing tabs the ‘Merge All Windows’ action now ignores minimized windows. This means that if you wish to only merge a few windows then you can minimize all but those you wish to merge and then perform the action.

This commit should also address issue #117 (closing window’s last document via the file browser closes the entire window). Canceling a file open also no longer causes the entire window to close, but there’s still some work to do in this department (actually backtracking to previous state, which could mean closing the window if the window was opened only to show this document).

Prior to this commit the tab bar would be automatically pruned when overflowing, this is no longer the case, though this functionality should return.
2013-01-09 02:43:41 +01:00
Allan Odgaard
203caea56d Watch if we leak ProjectLayoutView objects 2013-01-08 22:48:07 +01:00
Allan Odgaard
1a3c9d5db9 Add missing const qualifier 2013-01-08 22:48:07 +01:00
Allan Odgaard
5b9685fafa Remove unused method 2013-01-08 22:48:07 +01:00
Allan Odgaard
d082f38813 Make DocumentOpenHelper API block-based 2013-01-08 22:48:06 +01:00
Allan Odgaard
879cb2e777 Remove unused method 2013-01-08 22:48:06 +01:00
Allan Odgaard
a166ad481c Make OakSavePanel API block-based 2013-01-08 22:48:06 +01:00
Jacob Bandes-Storch
b277613ecd Add "Reveal Current Document" command
This reveals the current document in the file browser, by expanding directories to reach it, rather than changing the root directory of the browser.
2013-01-08 22:48:06 +01:00
Allan Odgaard
3c32087595 Avoid weak pointers to NSViewController and NSWindowController
This is not supported on 10.7 (and leads to a crash).
2013-01-03 21:26:03 +01:00
Allan Odgaard
934ec2de5c Set window delegate to nil before we disappear
There are places where we iterate through the delegates of NSApp’s ordered windows. Since the window may stay around longer than it’s (NSWindowController) delegate, we should be sure to set NSWindow’s delegate property to nil.
2013-01-03 06:43:46 +01:00
Allan Odgaard
ecc25b38d4 Improve handling of session state
We now remember values like file browser history even if the file browser is not shown while saving session state (but has previously been, or state was provided during setup). We also use the file browser and HTML output sizes stored in the session info (previously we only used values from NSUserDefaults).
2013-01-03 05:47:42 +01:00
Allan Odgaard
371198729b Support HTML output placed on right side 2013-01-03 05:45:49 +01:00
Allan Odgaard
303ba070a4 Collapse two class extensions into one 2013-01-03 01:16:54 +01:00
Allan Odgaard
80379dcc06 Use auto-synthesized properties 2013-01-03 01:16:54 +01:00
Allan Odgaard
074c20534e Improve debug logging 2013-01-02 01:46:48 +01:00
Allan Odgaard
8bcf126aba Minor refactoring 2013-01-02 01:46:47 +01:00
Allan Odgaard
d9cf30986d Only expose instance variable to framework (@package) 2013-01-02 01:46:47 +01:00
Allan Odgaard
534df6e755 Remove implementation details from interface
The properties left in the interface are used with bindings so sort of public (as they are used “outside” the implementation file).
2013-01-02 01:46:47 +01:00
Allan Odgaard
079b762c42 Use block-based callback API 2013-01-02 01:46:47 +01:00
Allan Odgaard
9e332438e7 Use block-based alert API 2013-01-02 01:46:47 +01:00
Allan Odgaard
b84992bdb3 ARC: Update DocumentWindow framework 2013-01-02 01:46:46 +01:00
Allan Odgaard
3d45b788f1 Update block-based NSAlert API 2013-01-02 01:46:46 +01:00
Allan Odgaard
ef8994ee00 Use block-based notification API
This removes the need for a dummy observer object.
2013-01-02 01:46:46 +01:00
Allan Odgaard
2a3b442bf2 ARC: Update TextMate (core application) 2012-12-28 02:47:19 +01:00
Allan Odgaard
1791a48571 Fix potential crash when using “Edit Command…” button
The block used the ‘uuid’ variable, this variable was however a (const) reference, so it wasn’t safe to use within the block.

While fixing the bug (by introducing a local non-reference variable for the bundle item) we have also changed the code slightly, so that “Edit Command…” only shows when a bundle item is found (this is mainly in preparation for running shell commands that doesn’t have a bundle item, e.g. from a future “Filter Through Command” dialog).
2012-12-24 01:23:33 +01:00