Skip to content

Commit

Permalink
Update user guide
Browse files Browse the repository at this point in the history
* Mention the new "Edit file" button and drag'n'drop of a script file
  to set the command.
* Updated screenshot.
* Optimized all PNGs.
  • Loading branch information
humdingerb committed Apr 8, 2024
1 parent bc29c92 commit 012cb29
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 6 deletions.
Binary file modified Assets/Screenshots/CommandSelectWindow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Screenshots/TrackRunnerCommands.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Screenshots/TrackRunnerIconMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Screenshots/TrackRunnerIconPrefs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Screenshots/TrackRunnerMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Screenshots/TrackRunnerPrefs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Assets/UserGuide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ Command Management Window


The command management window allows you to add/edit/remove/sort shortcuts.
You can drag'n'drop a script to replace the currently shown command path.
If the command is a script, the `Edit file` button will open it in a text editor.



Command List
Expand Down
22 changes: 16 additions & 6 deletions Source/CommandsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <Roster.h>
#include <ScrollView.h>
#include <StringView.h>
#include <cstdio>
#include <private/shared/ToolBar.h>


Expand Down Expand Up @@ -84,7 +85,7 @@ CommandsWindow::CommandsWindow(BString& title)
.SetInsets(0)
.Add(fBrowseButton = new BButton("Browse" B_UTF8_ELLIPSIS, new BMessage(kBrowseCommandAction)))
.AddGlue()
.Add(fEditButton = new BButton("Edit" B_UTF8_ELLIPSIS, new BMessage(kEditCommandAction)))
.Add(fEditButton = new BButton("Edit file" B_UTF8_ELLIPSIS, new BMessage(kEditCommandAction)))
.End()
.Add(fTerminalCheckBox, 1, 3)
.End()
Expand Down Expand Up @@ -183,17 +184,16 @@ CommandsWindow::_BrowseCommand()
void
CommandsWindow::_EditCommand()
{
if (_CommandIsScript()) {
const char* argv[] = { fCommandControl->Text(), NULL };
be_roster->Launch("text/x-source-code", 1, argv);
}
BString file = _Deescape(fCommandControl->Text());
const char* argv[] = { file.String(), NULL };
be_roster->Launch("text/x-source-code", 1, argv);
}


bool
CommandsWindow::_CommandIsScript()
{
BPath path = fCommandControl->Text();
BPath path = _Deescape(fCommandControl->Text());
if (path.InitCheck() != B_OK)
return false;

Expand All @@ -206,6 +206,16 @@ CommandsWindow::_CommandIsScript()
return false;
}


const char*
CommandsWindow::_Deescape(const char* path)
{
BString text(path);
text.CharacterDeescape('\\');
return text.String();
}


void
CommandsWindow::_InitNewCommand()
{
Expand Down
1 change: 1 addition & 0 deletions Source/CommandsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CommandsWindow : public BWindow {
void _BrowseCommand();
void _EditCommand();
bool _CommandIsScript();
const char* _Deescape(const char* path);
void _RefsReceived(BMessage* message);
status_t _LoadCommands();
status_t _SaveCommands();
Expand Down

0 comments on commit 012cb29

Please sign in to comment.