Skip to content

Commit

Permalink
Updated COPYING license file
Browse files Browse the repository at this point in the history
codelite-terminal: added new option that tells it to emulate TTY redirection (meant to be used by LLDB Debugger)
  • Loading branch information
eranif committed Apr 15, 2014
1 parent 4b6349c commit 6ca0820
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
7 changes: 7 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,12 @@ and the plugin is NOT one of the official plugins (see list below):
- Subversion
- UnitTestPP
- wxFormBuilder plugin
- Tweaks
- CMakePlugin
- CodeLiteDiff
- SFTP
- ZoomNavigator
- git
- LLDB Debugger

Can be distributed under a license other than the GPL
2 changes: 1 addition & 1 deletion LLDBDebugger/lldbdebugger-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void LLDBDebuggerPlugin::OnDebugStart(clDebugEvent& event)
TerminateTerminal();

LLDBTerminalCallback* terminalCallback = new LLDBTerminalCallback(&m_connector);
IProcess* handle = ::LaunchTerminal(execToDebug.GetFullPath(), terminalCallback);
IProcess* handle = ::LaunchTerminal(execToDebug.GetFullPath(), true, terminalCallback);
if ( !handle ) {
CL_DEBUG("Failed to launch debugger terminal!");
DoCleanup();
Expand Down
9 changes: 7 additions & 2 deletions Plugin/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1576,12 +1576,13 @@ wxArrayString SplitString(const wxString &inString, bool trim)
return lines;
}

IProcess* LaunchTerminal(const wxString &title, IProcessCallback *processCB)
IProcess* LaunchTerminal(const wxString &title, bool forDebugger, IProcessCallback *processCB)
{
#ifdef __WXMSW__
// Windows
wxUnusedVar( title );
wxUnusedVar( processCB );
wxUnusedVar( forDebugger );
return NULL;

#else
Expand All @@ -1593,8 +1594,12 @@ IProcess* LaunchTerminal(const wxString &title, IProcessCallback *processCB)
#else
command << fnCodeliteTerminal.GetPath(true) << "codelite-terminal ";
#endif
command << " --print-info ";
// command << " --always-on-top ";
command << " --print-info ";

if ( forDebugger ) {
command << " --dbg-terminal ";
}
command << " --title \"" << title << "\"";

CL_DEBUG("Launching Terminal: %s", command);
Expand Down
2 changes: 1 addition & 1 deletion Plugin/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ WXDLLIMPEXP_SDK wxString MakeExecInShellCommand(const wxString& cmd, const wxSt
/**
* @brief launch codelite terminal and return its TTY
*/
WXDLLIMPEXP_SDK IProcess* LaunchTerminal(const wxString &title, IProcessCallback* processCB);
WXDLLIMPEXP_SDK IProcess* LaunchTerminal(const wxString &title, bool forDebugger, IProcessCallback* processCB);

/**
* @brief prompt the user with a wxRichMessageDialog with a checkbox "Don't show this message again"
Expand Down
20 changes: 16 additions & 4 deletions codelite_terminal/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,22 @@ MainFrame::MainFrame(wxWindow* parent, const TerminalOptions &options, long styl
fp.Close();
}
}

SetCartAtEnd();
m_stc->MarkerDefine(MARKER_ID, wxSTC_MARK_DOTDOTDOT);
m_stc->MarkerDefine(MARKER_ID, wxSTC_MARK_ARROWS);
m_stc->MarkerSetBackground(MARKER_ID, *wxBLACK);
//m_stc->MarkerSetAlpha(MARKER_ID, 5);
SetSize( m_config.GetTerminalSize() );
SetPosition( m_config.GetTerminalPosition() );

DoApplySettings();
CallAfter( &MainFrame::DoExecStartCommand );

if ( options.HasFlag( TerminalOptions::kDebuggerTerminal) ) {

} else {
CallAfter( &MainFrame::DoExecStartCommand );

}

// Connect color menu items
Connect(ID_BG_COLOR, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnSelectBgColour), NULL, this);
Expand Down Expand Up @@ -143,7 +149,13 @@ void MainFrame::OnKeyDown(wxKeyEvent& event)
}

if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER ) {
if ( m_process ) {
if ( m_dummyProcess && m_options.HasFlag( TerminalOptions::kDebuggerTerminal ) ) {
// write the output to the dummy process
wxString cmd = GetCurrentLine();
AppendNewLine();
m_dummyProcess->Write( cmd );

} else if ( m_process ) {
wxString cmd = GetCurrentLine();
AppendNewLine();
m_process->Write( cmd );
Expand Down
3 changes: 3 additions & 0 deletions codelite_terminal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class MainApp : public wxApp
wxPrintf("-d | --working-directory Set the working directory\n");
wxPrintf("-p | --print-info Print terminal info to stdout\n");
wxPrintf("-z | --always-on-top The terminal is always on top of all windows\n");
wxPrintf("-g | --dbg-terminal The terminal is for debugging redirection purposes\n");
wxPrintf("\n");
exit(1);
}
Expand All @@ -44,6 +45,7 @@ class MainApp : public wxApp
parser.AddOption("w", "wait"); // optional, no value
parser.AddOption("p", "print-info"); // optional
parser.AddOption("z", "always-on-top"); // optional
parser.AddOption("g", "dbg-terminal"); // optional
parser.Parse();

{
Expand Down Expand Up @@ -76,6 +78,7 @@ class MainApp : public wxApp
options.EnableFlag( TerminalOptions::kPauseBeforeExit, parser.HasOption("w", "wait") );
options.EnableFlag( TerminalOptions::kPrintInfo, parser.HasOption("p", "print-info") );
options.EnableFlag( TerminalOptions::kAlwaysOnTop, parser.HasOption("z", "always-on-top") );
options.EnableFlag( TerminalOptions::kDebuggerTerminal, parser.HasOption("g", "dbg-terminal") );
options.SetCommand( commandToRun );

long style = wxDEFAULT_FRAME_STYLE;
Expand Down
1 change: 1 addition & 0 deletions codelite_terminal/terminal_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TerminalOptions
kExitWhenInfiriorTerminates = 0x00000002,
kPrintInfo = 0x00000004,
kAlwaysOnTop = 0x00000008,
kDebuggerTerminal = 0x00000010,
};

protected:
Expand Down

0 comments on commit 6ca0820

Please sign in to comment.