mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
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).
This commit is contained in:
@@ -1890,7 +1890,7 @@ static NSUInteger DisableSessionSavingCount = 0;
|
||||
|
||||
NSString* projectId = [NSString stringWithCxxString:collection];
|
||||
DocumentController* controller = AllControllers()[projectId];
|
||||
if(collection == document::kCollectionCurrent)
|
||||
if(collection == document::kCollectionAny)
|
||||
controller = [SortedControllers() firstObject];
|
||||
|
||||
if(controller)
|
||||
@@ -1911,7 +1911,7 @@ static NSUInteger DisableSessionSavingCount = 0;
|
||||
{
|
||||
controller = [DocumentController new];
|
||||
controller.documents = make_vector(document);
|
||||
if(collection != document::kCollectionCurrent && collection != document::kCollectionNew)
|
||||
if(collection != document::kCollectionAny)
|
||||
controller.identifier = projectId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1129,7 +1129,7 @@ Any other string:
|
||||
{
|
||||
NSUInteger selectionIndex = [[findAllResultsOutlineView selectedRowIndexes] firstIndex];
|
||||
FFMatch* selectedMatch = [findAllResultsOutlineView itemAtRow:selectionIndex];
|
||||
document::show([selectedMatch match].document, searcher.projectIdentifier ? oak::uuid_t(to_s(searcher.projectIdentifier)) : document::kCollectionNew, [selectedMatch match].range, false);
|
||||
document::show([selectedMatch match].document, searcher.projectIdentifier ? oak::uuid_t(to_s(searcher.projectIdentifier)) : document::kCollectionAny, [selectedMatch match].range, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ OAK_DEBUG_VAR(HTMLOutput_JSBridge);
|
||||
range = text::pos_t([options intValue]-1, 0);
|
||||
else if([options isKindOfClass:[NSString class]])
|
||||
range = to_s((NSString*)options);
|
||||
document::show(document::create(to_s(path)), document::kCollectionCurrent, range);
|
||||
document::show(document::create(to_s(path)), document::kCollectionAny, range);
|
||||
}
|
||||
|
||||
- (id)system:(NSString*)aCommand handler:(id)aHandler
|
||||
|
||||
@@ -1619,7 +1619,7 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
|
||||
if(doc)
|
||||
{
|
||||
NSString* range = [info objectForKey:(options & find::backwards) ? @"lastMatchRange" : @"firstMatchRange"];
|
||||
document::show(doc, document::kCollectionCurrent, to_s(range));
|
||||
document::show(doc, document::kCollectionAny, to_s(range));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@ namespace document
|
||||
{
|
||||
ui_proxy_t*& ui_proxy ();
|
||||
|
||||
oak::uuid_t const kCollectionNew = oak::uuid_t().generate();
|
||||
oak::uuid_t const kCollectionCurrent = oak::uuid_t().generate();
|
||||
oak::uuid_t const kCollectionAny = oak::uuid_t().generate();
|
||||
|
||||
void show (document_ptr document, oak::uuid_t const& collection, text::range_t const& selection, bool bringToFront)
|
||||
{
|
||||
|
||||
@@ -16,13 +16,11 @@ namespace document
|
||||
|
||||
typedef std::shared_ptr<run_callback_t> run_callback_ptr;
|
||||
|
||||
PUBLIC extern oak::uuid_t const kCollectionNew;
|
||||
PUBLIC extern oak::uuid_t const kCollectionCurrent;
|
||||
PUBLIC extern oak::uuid_t const kCollectionAny;
|
||||
|
||||
PUBLIC void show (document_ptr document, oak::uuid_t const& collection = kCollectionCurrent, text::range_t const& selection = text::range_t::undefined, bool bringToFront = true);
|
||||
PUBLIC void show (document_ptr document, oak::uuid_t const& collection = kCollectionAny, text::range_t const& selection = text::range_t::undefined, bool bringToFront = true);
|
||||
PUBLIC void show (std::vector<document_ptr> const& documents);
|
||||
PUBLIC void show_browser (std::string const& path);
|
||||
PUBLIC std::map<std::string, std::string> variables (document_ptr document, oak::uuid_t const& collection = kCollectionCurrent, std::map<std::string, std::string> env = std::map<std::string, std::string>());
|
||||
PUBLIC void run (bundle_command_t const& command, ng::buffer_t const& buffer, ng::ranges_t const& selection, document::document_ptr document, std::map<std::string, std::string> const& env = std::map<std::string, std::string>(), run_callback_ptr callback = run_callback_ptr());
|
||||
|
||||
struct PUBLIC ui_proxy_t
|
||||
|
||||
Reference in New Issue
Block a user