Commit Graph

113 Commits

Author SHA1 Message Date
Allan Odgaard
2c8a020d39 Implement selectNext/PreviousTab in FindWindowController 2014-07-05 21:33:29 +02:00
Boris Dušek
72bb6e6eb6 Fix enum/int conversion error with 10.10 SDK
10.10 SDK makes NSLineBreakMode into a proper NS_ENUM enum (in 10.9 SDK it was
a plain typedef for NSUInteger with some integer NSLineBreak* values
conveniently available for it in an anonymous enum).

Nevertheless, attr_string code should have always used NSLineBreakMode instead
of NSUInteger (unless I am missing something like values in style::line_break::mode
that do not correspond to the enum), so this commit makes it so and
thus also fixes building with 10.10 SDK.
2014-06-28 17:54:16 +02:00
Ronald Wampler
fc5dcf4020 Prefer NULL to nop: in most cases
This change was prompted by the appearance of the `tabSizePopUp` button in the status bar. After dismissing the menu, the title would be disabled.

To ensure we do not have similar issues elsewhere, let's prefer the use of `NULL` to `nop:` when assigning the action for menu items unless we are sure that the menu item should always be disabled (e.g., the item is used as a label).
2014-04-30 12:09:47 +07:00
Ronald Wampler
d9f4fae635 Enable "Open Files" search option in Find window
This seems to have been overlooked since most of logic was already implemented.

There is one known issue that exists when restoring sessions. Namely, after restoring a session only those documents (tabs), which have been actively "viewed" are considered "opened".
2014-04-30 12:09:46 +07:00
Ronald Wampler
3ed4722a80 Remove duplication of find_tags enumeration 2014-04-30 12:09:46 +07:00
Allan Odgaard
d39fc88324 Always enable action pop-up button in find window
Previously it was only available when doing folder searches, since the items are for folder search behavior and results.

However, with “Find All” in document, we get a similar result list from which we may want to copy matches.
2014-04-18 09:24:09 +07:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +07:00
Allan Odgaard
3642ee2750 Save All from find window uses default run-loop mode for saving
When saving and the document needs to execute a command (e.g. callback.document.export) then we can no longer use our special run-loop mode, as command execution is now using queues, and queue dispatching is paused when running in a custom run-loop mode.
2014-04-07 17:29:49 +07:00
Allan Odgaard
6cc0108961 Rename document_t:{open,save} → document_t:sync_{open,save}
This makes it easier to search for code that use these functions.
2014-04-07 17:28:41 +07:00
Allan Odgaard
25b3a5f4a4 Notify VoiceOver user of find window status bar changes
We don’t have a specific element associated with the result being announced so we use the current responder (unless it has accessibility ignored, in which case we do not post any notification).

Using the current responder is not ideal, but I do not know how we can either associate the notification with the find panel or post it as a global notification.
2014-04-01 14:36:04 +07:00
Boris Dušek
f48216a0f1 Add accessibility labels to Find dialog 2014-04-01 13:44:28 +07:00
Allan Odgaard
69c83e56df The ‘const’ keyword should be to the right of its type
The standard doesn’t care which side the keyword is placed on, but placing it on the right makes it easier to read types.

E.g. reading “int const* const” from right to left we get “const pointer to const integer”.
2014-03-31 08:27:19 +07:00
Allan Odgaard
db13d4c1f9 Use std::string::back() instead of operator[] with size()-1 2014-03-31 08:27:18 +07:00
Allan Odgaard
5f69ef31c7 Don’t use NS prefix for custom functions 2014-03-28 19:31:14 +07:00
Allan Odgaard
9f9cb23609 Improve alignment of glob text field in find window
The combo box’s top border should now align with the pop-up buttons on the same line, though it’s not baseline aligned.
2014-03-26 15:30:35 +07:00
Ronald Wampler
f45cb07d52 Moved OakCreateActionPopUpButton method to OakUIConstructionFunctions.h
While code reuse is an added benefit, the main motivation was to fix the appearance of the action popup button in the Find window. The first (placeholder) item in the Find window's action button was assigned a nop action so that when the button was clicked and it's menu validated, the "action" image would always appear as disabled.
2014-03-25 16:51:40 -04:00
Allan Odgaard
5073b2bf06 Remove unused code 2014-03-12 15:50:39 +07:00
Allan Odgaard
919ab40ef0 Indicate that find window is not restorable
Since we are using it with an NSDocument, it defaults to use NSDocumentController as restoration class, which gives a warning during launch, if the find window was open during termination, and the conditions are so that the system wants to restore windows from last session.

Also indicate that we do not want to save drafts, unsure if this has any effect.
2014-03-09 10:01:52 +07:00
Allan Odgaard
bf4e1d8cee Find in folder window’s title could switch to “Untitled”
This is because we are using an NSDocument to perform the folder searching (as that’s a decoupled way to have the window indicate “unsaved changes” and present a warning sheet).

The downside is that by using an NSDocument we get some undesired implicit behavior, like automatically changing the window title or trying to re-open the “document” after relaunch.
2014-03-09 10:01:51 +07:00
Allan Odgaard
1e11a30a53 Remove redundant storage keywords for @property
These were required prior to the new 64 bit run-time.
2014-03-05 16:39:54 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
57e8e37313 Rename NSReplacePboard → OakReplacePboard
We shouldn’t use Apple’s prefix for our own constants. The actual value of the constant hasn’t been renamed yet as this requires “migration” (renaming the key in user defaults).
2014-02-18 12:41:47 +07:00
Allan Odgaard
8ebbb338c2 Disallow creating OakPasteboardEntry outside OakPasteboard.mm
This is in preparation of adopting CoreData which will require a managed object context to create pasteboard entry objects.
2014-02-18 11:53:41 +07:00
Allan Odgaard
7287fc7359 Indicate that Find and HTML output are auxiliary windows
This doesn’t seem to change anything wrt. behavior, but perhaps it will in the future.
2014-02-09 23:09:21 +07:00
Allan Odgaard
c2bb5253ef Ensure text view find operations use values from the UI
We already commit the values when focus is lost, but it’s possible to initiate a find operation while focus is still in the find dialog text fields (via the menu).

Fixes #1183
2013-12-12 14:45:05 +07:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
b53fb59528 Fix crash when giving nil string to FFDocumentSearch 2013-08-30 12:30:33 +02:00
Shelby Munsch
283ecd069e Fixed typo 2013-08-27 22:49:47 -07:00
Allan Odgaard
cfa913d0f5 Fix retain cycle 2013-08-28 00:23:07 +02:00
David Howden
1faaf77d99 Stop Find window showing an NSSavePanel on ⌘S 2013-08-23 23:21:16 +02:00
Allan Odgaard
98585e166e Use byte range for replacement API 2013-07-27 16:30:02 +02:00
Allan Odgaard
707e026c19 Update testing system for Find framework 2013-07-26 13:53:58 +02:00
Allan Odgaard
06f349507a Add a “did wrap” boolean to the OakFindProtocol API
This informs the “server” that searching wrapped around to find the match.
2013-07-23 22:45:52 +02:00
Allan Odgaard
5fc03a8630 Don’t ignore save errors for multi-file search/replace
For this change I have made the FFDocumentSearch class inherit from NSDocument. This way, we can register it with the window controller and will get callbacks when the window is about to close, with the option to cancel closing of the window. This approach seems much simpler than the alternative, which would be to introduce our own callback/delegate system for window closing, or have the window controller know about saving files.
2013-07-22 03:00:13 +02:00
Allan Odgaard
97caace4d2 Some further tweaks related to stopping search
We now show “Stopped.” as status text when search is prematurely terminated.
Closing window also cause search to stop.
The stop button has ⌘. as key equivalent (the standard “cancel” key).
Don’t let the stop action go via the search action dispatcher.
2013-07-21 22:54:12 +02:00
David Howden
cfb2335761 Added “Stop Search” button to Find dialog
Previously wasn't possible to stop a search in progress (even
when closing the Find window).
2013-07-21 17:36:16 +02:00
Allan Odgaard
fd6e47b023 Let a document search clear the folder results used by ⌘G
If the user does a folder search then ⌘G will step through all the matches, opening documents as required. Previously the user would have to do a new search, using a different search string, to stop ⌘G from moving to a new document. It is now possible to stop the behavior using ⌘F followed by ↩.
2013-06-28 21:50:07 +02:00
Allan Odgaard
b8b00b5fe8 Make OakCreateCheckBox a public function 2013-06-27 23:26:46 +02:00
Allan Odgaard
0c26060f1c Find dialog now responds to findAllInSelection:
This is the action method sent by the Edit → Find → Find All (⌥⌘F) menu item, and is now treated as an alias to the existing findAll: action method (that the Find All button in the find dialog sends).
2013-06-23 11:23:42 +07:00
Allan Odgaard
c04eb1cd2a Fix exception when finding all in untitled documents
Untitled documents have no path, so we were creating a dictionary with a nil object. The path isn’t actually used (we go via the identifier) so removing the potential path from the dictionary avoids the problem.
2013-06-16 17:44:34 +07:00
Jakub Suder
ac9f5e5d8d Don't add files from find window to recent list 2013-06-15 16:13:22 +07:00
Allan Odgaard
0795b89bdb Clicking already selected search result reselects the match
Previously we ignored clicks and only selected matches when the selection was changed. This was done to prevent firing off two “select match” actions. We now ignore the “selection changed” notification if the current event is a mouse-up.
2013-05-15 15:45:36 +07:00
Allan Odgaard
4188c486fb Ensure height of find/replace fields are >= 22 points
Fixes #972.
2013-05-06 14:51:31 +07:00
Allan Odgaard
e1ff0ceaff Move already open find/HTML windows to active space
This is only when invoking the “order front” action and the window is already showing on another space.
2013-04-28 11:46:35 +07:00
Allan Odgaard
fda19c565d Only clear find status string for non-folder search
I find myself often closing folder search results and later re-opening (via ⇧⌘F) which would previously have the status string cleared, yet the results still showing.

Status should probably be stored together with the folder search results, so when toggling between document and folder search, the status string would follow as well.
2013-04-28 11:46:35 +07:00
Allan Odgaard
97c9a20f6e Use localizedStandardCompare:
This is instead of our custom displayNameCompare: which has now been removed.
2013-04-21 12:20:07 +07:00
Allan Odgaard
49235210ca Use NSNumberFormatter class method
Once we drop 10.7 support we can avoid NSNumberFormatter entirely by using ‘localizedStringWithFormat:’ with ‘%lu’.
2013-04-21 12:20:07 +07:00
Allan Odgaard
15a5527986 Reset find dialog state when re-opening it
Previously doing a Find All in Document would stay with Find All as the default button, even if closed and re-opened.

We also clear the status text, this isn’t always desirable, but I find it more weird when the dialog shows an outdated status message.
2013-03-26 14:02:40 +01:00
Allan Odgaard
40a9cb4e40 Limit height of Find dialog text fields
These would previously always be the height of the content, now they are limited to roughly 13 lines (225 “pixels”).
2013-03-26 13:51:41 +01:00