Skip to content

Open in Text Editor#70

Open
garakmon wants to merge 6 commits intoyenatch:masterfrom
garakmon:open-in-texteditor
Open

Open in Text Editor#70
garakmon wants to merge 6 commits intoyenatch:masterfrom
garakmon:open-in-texteditor

Conversation

@garakmon
Copy link
Contributor

@garakmon garakmon commented Aug 13, 2018

Adds functionality to open a Map's scripts in a text editor (#60 ). The editor opened is the system's default editor for files with the .inc extension (usually default text editor unless otherwise set).
The button is only available when an event with a script is selected.

*Needs to be tested (and probably modified) on Windows & Linux*

mainwindow.cpp Outdated
#elif defined Q_OS_LINUX
QString cmd = "xdg-open ";
#else // WINDOWS
QString cmd = "cmd /c start ";
Copy link
Contributor Author

@garakmon garakmon Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work (on Windows) unless running pretmap from the command line (and not sure even then)

@garakmon
Copy link
Contributor Author

garakmon commented Aug 13, 2018

demonstration (macOS 10.12 + Sublime3):
Alt text

mainwindow.cpp Outdated

// generate "Open in Text Editor" button
if (key == "script_label") {
QPushButton *scriptButton = new QPushButton(QString("Open This Map's Scripts in a Text Editor"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this button should be added in the context of the event. If you have multiple events selected, you'll see this button for each selected event. Instead, the button should probably just go underneath the "New Object" and "Delete" buttons. Also, it's a bit too long. Maybe just "Open Map Scripts"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't realize you could have multiple selected events. Agree with both the comments-- will make appropriate changes. Did the button work for you though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants