TextSearch: trim trailing whitespace.
This commit is contained in:
@@ -24,7 +24,7 @@ using std::nothrow;
|
||||
#endif
|
||||
|
||||
|
||||
ChangesIterator::ChangesIterator(const Model* model)
|
||||
ChangesIterator::ChangesIterator(const Model* model)
|
||||
: FileIterator(),
|
||||
fPathMap(),
|
||||
fIteratorIndex(0),
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Stephan Aßmus <[email protected]>
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef FILE_ITERATOR_H
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "GrepApp.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -46,19 +46,19 @@ GrepApp::~GrepApp()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
GrepApp::ArgvReceived(int32 argc, char** argv)
|
||||
{
|
||||
fGotArgvOnStartup = true;
|
||||
|
||||
BMessage message(B_REFS_RECEIVED);
|
||||
int32 refCount = 0;
|
||||
|
||||
|
||||
for (int32 i = 1; i < argc; i++) {
|
||||
BEntry entry(argv[i]);
|
||||
entry_ref ref;
|
||||
entry.GetRef(&ref);
|
||||
|
||||
|
||||
if (entry.Exists()) {
|
||||
message.AddRef("refs", &ref);
|
||||
refCount += 1;
|
||||
@@ -73,7 +73,7 @@ GrepApp::ArgvReceived(int32 argc, char** argv)
|
||||
|
||||
void
|
||||
GrepApp::RefsReceived(BMessage* message)
|
||||
{
|
||||
{
|
||||
if (IsLaunching())
|
||||
fGotRefsOnStartup = true;
|
||||
|
||||
@@ -114,12 +114,12 @@ GrepApp::MessageReceived(BMessage* message)
|
||||
|
||||
void
|
||||
GrepApp::_TryQuit()
|
||||
{
|
||||
{
|
||||
if (CountWindows() == 0)
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
|
||||
|
||||
if (CountWindows() == 1 && fQuitter == NULL) {
|
||||
fQuitter = new BMessageRunner(be_app_messenger,
|
||||
fQuitter = new BMessageRunner(be_app_messenger,
|
||||
new BMessage(MSG_TRY_QUIT), 200000, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <Application.h>
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@@ -30,12 +30,12 @@ ResultItem::ResultItem(const entry_ref& ref)
|
||||
{
|
||||
BEntry entry(&ref);
|
||||
BPath path(&entry);
|
||||
SetText(path.Path());
|
||||
SetText(path.Path());
|
||||
}
|
||||
|
||||
|
||||
GrepListView::GrepListView()
|
||||
: BOutlineListView(BRect(0, 0, 40, 80), "SearchResults",
|
||||
: BOutlineListView(BRect(0, 0, 40, 80), "SearchResults",
|
||||
B_MULTIPLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES,
|
||||
B_WILL_DRAW | B_NAVIGABLE)
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef GREP_LIST_VIEW_H
|
||||
|
||||
@@ -397,7 +397,7 @@ GrepWindow::_SetWindowTitle()
|
||||
if (entry.GetPath(&path) == B_OK) {
|
||||
if (fOldPattern.Length()) {
|
||||
title = B_TRANSLATE("%appname% : %path% : %searchtext%");
|
||||
title.ReplaceAll("%searchtext%", fOldPattern.String());
|
||||
title.ReplaceAll("%searchtext%", fOldPattern.String());
|
||||
} else
|
||||
title = B_TRANSLATE("%appname% : %path%");
|
||||
|
||||
@@ -787,7 +787,7 @@ GrepWindow::_OnStartCancel()
|
||||
fButton->MoveTo(
|
||||
fMenuBar->Frame().Width() - fButton->Frame().Width() - 8,
|
||||
8 + fSearchText->Frame().Height() + 8);
|
||||
|
||||
|
||||
fSearch->SetEnabled(false);
|
||||
|
||||
// We need to remember the search pattern, because during
|
||||
@@ -844,7 +844,7 @@ GrepWindow::_OnSearchFinished()
|
||||
fButton->MoveTo(
|
||||
fMenuBar->Frame().Width() - fButton->Frame().Width() - 8,
|
||||
8 + fSearchText->Frame().Height() + 8);
|
||||
|
||||
|
||||
fButton->SetEnabled(true);
|
||||
fSearch->SetEnabled(true);
|
||||
|
||||
@@ -1028,7 +1028,7 @@ GrepWindow::_OnReportFileName(BMessage* message)
|
||||
fSearchText->TruncateString(&name, B_TRUNCATE_MIDDLE,
|
||||
fSearchBoxWidth - 10);
|
||||
|
||||
fSearchText->SetText(name);
|
||||
fSearchText->SetText(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1440,7 +1440,7 @@ GrepWindow::_OnSelectInTracker()
|
||||
BString str1;
|
||||
str1 << B_TRANSLATE("%APP_NAME couldn't open one or more folders.");
|
||||
str1.ReplaceFirst("%APP_NAME",APP_NAME);
|
||||
BAlert* alert = new BAlert(NULL, str1.String(), B_TRANSLATE("OK"),
|
||||
BAlert* alert = new BAlert(NULL, str1.String(), B_TRANSLATE("OK"),
|
||||
NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
|
||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
alert->Go(NULL);
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef GREP_WINDOW_H
|
||||
@@ -38,14 +38,14 @@ class GrepWindow : public BWindow {
|
||||
public:
|
||||
GrepWindow(BMessage* message);
|
||||
virtual ~GrepWindow();
|
||||
|
||||
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void FrameMoved(BPoint origin);
|
||||
virtual void MenusBeginning();
|
||||
virtual void MenusEnded();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void Quit();
|
||||
|
||||
|
||||
private:
|
||||
void _InitRefsReceived(entry_ref* directory,
|
||||
BMessage* message);
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
void _CreateViews();
|
||||
void _LayoutViews();
|
||||
void _TileIfMultipleWindows();
|
||||
|
||||
|
||||
void _LoadPrefs();
|
||||
void _SavePrefs();
|
||||
|
||||
@@ -101,7 +101,7 @@ private:
|
||||
private:
|
||||
BTextControl* fSearchText;
|
||||
GrepListView* fSearchResults;
|
||||
|
||||
|
||||
BMenuBar* fMenuBar;
|
||||
BMenu* fFileMenu;
|
||||
BMenuItem* fNew;
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef GREPPER_H
|
||||
@@ -38,18 +38,18 @@ public:
|
||||
bool IsValid() const;
|
||||
|
||||
void Start();
|
||||
void Cancel();
|
||||
|
||||
void Cancel();
|
||||
|
||||
private:
|
||||
// Spawns the real grepper thread.
|
||||
static int32 _SpawnThread(void* cookie);
|
||||
|
||||
// The thread function that does the actual grepping.
|
||||
int32 _GrepperThread();
|
||||
|
||||
int32 _GrepperThread();
|
||||
|
||||
// Remembers, and possibly escapes, the search pattern.
|
||||
void _SetPattern(const char* source);
|
||||
|
||||
|
||||
// Prepends all quotes, dollars and backslashes with at backslash
|
||||
// to prevent the shell from misinterpreting them.
|
||||
bool _EscapeSpecialChars(char* buffer,
|
||||
@@ -57,16 +57,16 @@ private:
|
||||
private:
|
||||
// The (escaped) search pattern.
|
||||
char* fPattern;
|
||||
|
||||
|
||||
// The settings from the model.
|
||||
BMessenger fTarget;
|
||||
bool fEscapeText : 1;
|
||||
bool fCaseSensitive : 1;
|
||||
uint32 fEncoding;
|
||||
|
||||
|
||||
// The supplier of files to grep
|
||||
FileIterator* fIterator;
|
||||
|
||||
|
||||
// Our thread's ID.
|
||||
thread_id fThreadId;
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Stephan Aßmus <superstippi@gmx.de>
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,7 @@ using std::nothrow;
|
||||
// For the moment I don't know the life cycle of the InitialIterator object.
|
||||
|
||||
|
||||
InitialIterator::InitialIterator(const Model* model)
|
||||
InitialIterator::InitialIterator(const Model* model)
|
||||
: FileIterator(),
|
||||
fDirectories(10),
|
||||
fCurrentDir(new (nothrow) BDirectory(&model->fDirectory)),
|
||||
@@ -90,7 +90,7 @@ InitialIterator::GetNextName(char* buffer)
|
||||
return false;
|
||||
|
||||
// If the entry is a subdir, then add it to the
|
||||
// list of directories and continue the loop.
|
||||
// list of directories and continue the loop.
|
||||
// If the entry is a file and we can grep it
|
||||
// (i.e. it is a text file), then we're done
|
||||
// here. Otherwise, continue with the next entry.
|
||||
@@ -119,12 +119,12 @@ InitialIterator::NotifyNegatives() const
|
||||
bool
|
||||
InitialIterator::GetTopEntry(BEntry& entry)
|
||||
{
|
||||
// If the user selected one or more files, we must look
|
||||
// at the "refs" inside the message that was passed into
|
||||
// our add-on's process_refs(). If the user didn't select
|
||||
// any files, we will simply read all the entries from the
|
||||
// If the user selected one or more files, we must look
|
||||
// at the "refs" inside the message that was passed into
|
||||
// our add-on's process_refs(). If the user didn't select
|
||||
// any files, we will simply read all the entries from the
|
||||
// current working directory.
|
||||
|
||||
|
||||
entry_ref fileRef;
|
||||
|
||||
if (fSelectedFiles.FindRef("refs", fCurrentRef, &fileRef) == B_OK) {
|
||||
@@ -184,7 +184,7 @@ InitialIterator::_GetSubEntry(BEntry& entry)
|
||||
if (fCurrentDir->GetNextEntry(&entry, fRecurseLinks) == B_OK)
|
||||
return true;
|
||||
|
||||
// If we get here, there are no more entries in
|
||||
// If we get here, there are no more entries in
|
||||
// this subdir, so return to the parent directory.
|
||||
|
||||
fDirectories.RemoveItem(fCurrentDir);
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Stephan Aßmus <superstippi@gmx.de>
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef INITIAL_ITERATOR_H
|
||||
@@ -69,10 +69,10 @@ private:
|
||||
private:
|
||||
// Contains pointers to BDirectory objects.
|
||||
BList fDirectories;
|
||||
|
||||
|
||||
// The directory we are currently looking at.
|
||||
BDirectory* fCurrentDir;
|
||||
|
||||
|
||||
// The ref number we are currently looking at.
|
||||
int32 fCurrentRef;
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2007 Matthijs Hollemans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef MODEL_H
|
||||
@@ -60,7 +60,7 @@ enum {
|
||||
MSG_REFS_RECEIVED,
|
||||
MSG_TRY_QUIT,
|
||||
MSG_QUIT_NOW,
|
||||
|
||||
|
||||
MSG_TRIM_SELECTION,
|
||||
MSG_COPY_TEXT,
|
||||
MSG_SELECT_IN_TRACKER,
|
||||
@@ -78,7 +78,7 @@ enum state_t {
|
||||
class Model {
|
||||
public:
|
||||
Model();
|
||||
|
||||
|
||||
status_t LoadPrefs();
|
||||
status_t SavePrefs();
|
||||
|
||||
@@ -124,13 +124,13 @@ public:
|
||||
|
||||
// Grep string encoding ?
|
||||
uint32 fEncoding;
|
||||
|
||||
|
||||
private:
|
||||
bool _LoadHistory(BList& items) const;
|
||||
status_t _SaveHistory(const BList& items) const;
|
||||
void _FreeHistory(const BList& items) const;
|
||||
status_t _OpenFile(BFile* file, const char* name,
|
||||
uint32 openMode = B_READ_ONLY,
|
||||
uint32 openMode = B_READ_ONLY,
|
||||
directory_which which
|
||||
= B_USER_SETTINGS_DIRECTORY,
|
||||
BVolume* volume = NULL) const;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
main()
|
||||
{
|
||||
GrepApp app;
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user