forked from eranif/codelite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed crash when using $(CodeLitePath) macro and no workspcae was o…
…pened - Added new 'External Tools Plugin' - a plugin which allows user to define custom command and assign them with a keyboard shortcut git-svn-id: https://codelite.svn.sourceforge.net/svnroot/codelite/trunk@2035 9da81c78-c036-0410-9e1f-a2b0375e4b5a
- Loading branch information
eranif
committed
Aug 29, 2008
1 parent
6f7108c
commit e52ad00
Showing
44 changed files
with
3,133 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<CodeLite_Project Name="ExternalTools"> | ||
<VirtualDirectory Name="src"> | ||
<File Name="externaltools.cpp"/> | ||
<File Name="externaltools.h"/> | ||
<File Name="externaltoolsdata.cpp"/> | ||
<File Name="externaltoolsdata.h"/> | ||
</VirtualDirectory> | ||
<Dependencies/> | ||
<Dependencies Name="DebugUnicode"/> | ||
<Settings Type="Dynamic Library"> | ||
<Configuration Name="DebugUnicode" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> | ||
<General OutputFile="../Runtime/plugins/ExternalTools.dll" IntermediateDirectory="./DebugUnicode" Command="" CommandArguments="" WorkingDirectory="./DebugUnicode" PauseExecWhenProcTerminates="yes"/> | ||
<Compiler Required="yes" Options="-g;$(shell wx-config --cxxflags --debug=yes --unicode=yes)"> | ||
<IncludePath Value="."/> | ||
<IncludePath Value="../Interfaces"/> | ||
<IncludePath Value="../CodeLite"/> | ||
<IncludePath Value="../Plugin"/> | ||
<IncludePath Value="../sqlite3"/> | ||
<IncludePath Value="../sdk/wxsqlite3/include"/> | ||
<Preprocessor Value="__WX__"/> | ||
<Preprocessor Value="WXUSINGDLL"/> | ||
<Preprocessor Value="YY_NEVER_INTERACTIVE=1"/> | ||
</Compiler> | ||
<Linker Required="yes" Options="$(shell wx-config --debug=yes --libs --unicode=yes);"> | ||
<LibraryPath Value="../../trunk/lib/gcc_lib"/> | ||
<Library Value="libplugin_sdkud.a"/> | ||
<Library Value="libCodeLiteud.a"/> | ||
<Library Value="libwxsqlite3ud.a"/> | ||
<Library Value="libsqlite3.a"/> | ||
</Linker> | ||
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort=""></Debugger> | ||
<ResourceCompiler Required="no" Options=""/> | ||
<PreBuild/> | ||
<PostBuild/> | ||
<CustomBuild Enabled="no"> | ||
<CleanCommand></CleanCommand> | ||
<BuildCommand></BuildCommand> | ||
<SingleFileCommand></SingleFileCommand> | ||
<MakefileGenerationCommand></MakefileGenerationCommand> | ||
<ThirdPartyToolName>None</ThirdPartyToolName> | ||
<WorkingDirectory></WorkingDirectory> | ||
</CustomBuild> | ||
<AdditionalRules> | ||
<CustomPostBuild></CustomPostBuild> | ||
<CustomPreBuild> | ||
|
||
</CustomPreBuild> | ||
</AdditionalRules> | ||
</Configuration> | ||
<Configuration Name="ReleaseUnicode" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> | ||
<General OutputFile="../Runtime/plugins/ExternalTools.dll" IntermediateDirectory="./ReleaseUnicode" Command="" CommandArguments="" WorkingDirectory="./ReleaseUnicode" PauseExecWhenProcTerminates="yes"/> | ||
<Compiler Required="yes" Options="$(shell wx-config --cxxflags --debug=no --unicode=yes); -O2"> | ||
<IncludePath Value="."/> | ||
<IncludePath Value="../Interfaces"/> | ||
<IncludePath Value="../CodeLite"/> | ||
<IncludePath Value="../Plugin"/> | ||
<IncludePath Value="../sqlite3"/> | ||
<IncludePath Value="../sdk/wxsqlite3/include"/> | ||
<Preprocessor Value="__WX__"/> | ||
<Preprocessor Value="WXUSINGDLL"/> | ||
<Preprocessor Value="YY_NEVER_INTERACTIVE=1"/> | ||
</Compiler> | ||
<Linker Required="yes" Options="-O2;$(shell wx-config --debug=no --libs --unicode=yes);"> | ||
<LibraryPath Value="../../trunk/lib/gcc_lib"/> | ||
<Library Value="libplugin_sdku.a"/> | ||
<Library Value="libCodeLiteu.a"/> | ||
<Library Value="libwxsqlite3u.a"/> | ||
<Library Value="libsqlite3.a"/> | ||
</Linker> | ||
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort=""></Debugger> | ||
<ResourceCompiler Required="no" Options=""/> | ||
<PreBuild/> | ||
<PostBuild/> | ||
<CustomBuild Enabled="no"> | ||
<CleanCommand></CleanCommand> | ||
<BuildCommand></BuildCommand> | ||
<SingleFileCommand></SingleFileCommand> | ||
<MakefileGenerationCommand></MakefileGenerationCommand> | ||
<ThirdPartyToolName>None</ThirdPartyToolName> | ||
<WorkingDirectory></WorkingDirectory> | ||
</CustomBuild> | ||
<AdditionalRules> | ||
<CustomPostBuild></CustomPostBuild> | ||
<CustomPreBuild> | ||
|
||
</CustomPreBuild> | ||
</AdditionalRules> | ||
</Configuration> | ||
<Configuration Name="WinDebugUnicode" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> | ||
<General OutputFile="../Runtime/plugins/ExternalTools.dll" IntermediateDirectory="./WinDebugUnicode" Command="" CommandArguments="" WorkingDirectory="" PauseExecWhenProcTerminates="yes"/> | ||
<Compiler Required="yes" Options="-g;$(shell wx-config --cxxflags --unicode=yes --debug=yes)"> | ||
<IncludePath Value="."/> | ||
<IncludePath Value="../Interfaces"/> | ||
<IncludePath Value="../CodeLite"/> | ||
<IncludePath Value="../Plugin"/> | ||
<IncludePath Value="../sqlite3"/> | ||
<IncludePath Value="../sdk/wxsqlite3/include"/> | ||
<Preprocessor Value="__WX__"/> | ||
<Preprocessor Value="WXUSINGDLL"/> | ||
<Preprocessor Value="_WIN32_WINNT=0x501"/> | ||
<Preprocessor Value="ASTYLE_LIB"/> | ||
</Compiler> | ||
<Linker Required="yes" Options="-O2;$(shell wx-config --debug=yes --libs --unicode=yes);"> | ||
<LibraryPath Value="../../trunk/lib/gcc_lib"/> | ||
<Library Value="libplugin_sdkud.a"/> | ||
<Library Value="libCodeLiteud.a"/> | ||
<Library Value="libwxsqlite3ud.a"/> | ||
<Library Value="libsqlite3.a"/> | ||
<Library Value="libwxmsw28ud.a"/> | ||
</Linker> | ||
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort=""></Debugger> | ||
<ResourceCompiler Required="no" Options=""/> | ||
<PreBuild/> | ||
<PostBuild/> | ||
<CustomBuild Enabled="no"> | ||
<CleanCommand></CleanCommand> | ||
<BuildCommand></BuildCommand> | ||
<SingleFileCommand></SingleFileCommand> | ||
<MakefileGenerationCommand></MakefileGenerationCommand> | ||
<ThirdPartyToolName>None</ThirdPartyToolName> | ||
<WorkingDirectory></WorkingDirectory> | ||
</CustomBuild> | ||
<AdditionalRules> | ||
<CustomPostBuild></CustomPostBuild> | ||
<CustomPreBuild> | ||
|
||
</CustomPreBuild> | ||
</AdditionalRules> | ||
</Configuration> | ||
<Configuration Name="WinReleaseUnicode" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library"> | ||
<General OutputFile="../Runtime/plugins/ExternalTools.dll" IntermediateDirectory="./WinReleaseUnicode" Command="" CommandArguments="" WorkingDirectory="./WinReleaseUnicode" PauseExecWhenProcTerminates="yes"/> | ||
<Compiler Required="yes" Options="$(shell wx-config --cxxflags --unicode=yes --debug=no);-O2"> | ||
<IncludePath Value="."/> | ||
<IncludePath Value="../Interfaces"/> | ||
<IncludePath Value="../CodeLite"/> | ||
<IncludePath Value="../Plugin"/> | ||
<IncludePath Value="../sqlite3"/> | ||
<IncludePath Value="../sdk/wxsqlite3/include"/> | ||
<Preprocessor Value="__WX__"/> | ||
<Preprocessor Value="WXUSINGDLL"/> | ||
<Preprocessor Value="_WIN32_WINNT=0x501"/> | ||
<Preprocessor Value="ASTYLE_LIB"/> | ||
</Compiler> | ||
<Linker Required="yes" Options="-O2;$(shell wx-config --debug=no --libs --unicode=yes);"> | ||
<LibraryPath Value="../../trunk/lib/gcc_lib"/> | ||
<Library Value="libplugin_sdku.a"/> | ||
<Library Value="libCodeLiteu.a"/> | ||
<Library Value="libwxsqlite3u.a"/> | ||
<Library Value="libsqlite3.a"/> | ||
<Library Value="libwxmsw28u.a"/> | ||
</Linker> | ||
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort=""></Debugger> | ||
<ResourceCompiler Required="no" Options=""/> | ||
<PreBuild/> | ||
<PostBuild/> | ||
<CustomBuild Enabled="no"> | ||
<CleanCommand></CleanCommand> | ||
<BuildCommand></BuildCommand> | ||
<SingleFileCommand></SingleFileCommand> | ||
<MakefileGenerationCommand></MakefileGenerationCommand> | ||
<ThirdPartyToolName>None</ThirdPartyToolName> | ||
<WorkingDirectory></WorkingDirectory> | ||
</CustomBuild> | ||
<AdditionalRules> | ||
<CustomPostBuild></CustomPostBuild> | ||
<CustomPreBuild> | ||
|
||
</CustomPreBuild> | ||
</AdditionalRules> | ||
</Configuration> | ||
</Settings> | ||
<Dependencies Name="WinReleaseUnicode"/> | ||
<VirtualDirectory Name="UI"> | ||
<File Name="newtoolbase.cpp"/> | ||
<File Name="newtoolbase.h"/> | ||
<File Name="newtooldlg.h"/> | ||
<File Name="newtooldlg.cpp"/> | ||
<File Name="externaltooldlg.cpp"/> | ||
<File Name="externaltooldlg.h"/> | ||
<File Name="externaltoolsbasedlg.cpp"/> | ||
<File Name="externaltoolsbasedlg.h"/> | ||
</VirtualDirectory> | ||
<Dependencies Name="WinDebugUnicode"/> | ||
</CodeLite_Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
#include "globals.h" | ||
#include "externaltoolsdata.h" | ||
#include "newtooldlg.h" | ||
#include "externaltooldlg.h" | ||
|
||
ExternalToolDlg::ExternalToolDlg( wxWindow* parent ) | ||
: ExternalToolBaseDlg( parent ) | ||
, m_item(wxNOT_FOUND) | ||
{ | ||
Initialize(); | ||
} | ||
|
||
void ExternalToolDlg::OnItemActivated( wxListEvent& event ) | ||
{ | ||
m_item = event.m_itemIndex; | ||
DoEditEntry(event.m_itemIndex); | ||
} | ||
|
||
void ExternalToolDlg::OnItemDeSelected( wxListEvent& event ) | ||
{ | ||
wxUnusedVar(event); | ||
m_item = wxNOT_FOUND; | ||
} | ||
|
||
void ExternalToolDlg::OnItemSelected( wxListEvent& event ) | ||
{ | ||
m_item = event.m_itemIndex; | ||
} | ||
|
||
void ExternalToolDlg::OnButtonNew( wxCommandEvent& event ) | ||
{ | ||
NewToolDlg dlg(this, wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString ); | ||
if (dlg.ShowModal() == wxID_OK) { | ||
DoUpdateEntry(dlg.GetToolId(), dlg.GetPath(), dlg.GetWorkingDirectory(), dlg.GetArguments()); | ||
} | ||
} | ||
|
||
void ExternalToolDlg::OnButtonNewUI( wxUpdateUIEvent& event ) | ||
{ | ||
// maximum of 10 items | ||
event.Enable(m_listCtrlTools->GetItemCount() < 10); | ||
} | ||
|
||
void ExternalToolDlg::OnButtonEdit( wxCommandEvent& event ) | ||
{ | ||
wxUnusedVar(event); | ||
DoEditEntry(m_item); | ||
} | ||
|
||
void ExternalToolDlg::OnButtonEditUI( wxUpdateUIEvent& event ) | ||
{ | ||
event.Enable(m_item != wxNOT_FOUND); | ||
} | ||
|
||
void ExternalToolDlg::OnButtonDelete( wxCommandEvent& event ) | ||
{ | ||
m_listCtrlTools->DeleteItem(m_item); | ||
} | ||
|
||
void ExternalToolDlg::OnButtonDeleteUI( wxUpdateUIEvent& event ) | ||
{ | ||
event.Enable(m_item != wxNOT_FOUND); | ||
} | ||
|
||
void ExternalToolDlg::Initialize() | ||
{ | ||
m_listCtrlTools->InsertColumn(0, wxT("ID")); | ||
m_listCtrlTools->InsertColumn(1, wxT("Path")); | ||
m_listCtrlTools->InsertColumn(2, wxT("Arguments")); | ||
m_listCtrlTools->InsertColumn(3, wxT("Working directory")); | ||
|
||
// TODO: populate the list from the settings | ||
m_listCtrlTools->SetColumnWidth(0, 100); | ||
m_listCtrlTools->SetColumnWidth(1, wxLIST_AUTOSIZE); | ||
m_listCtrlTools->SetColumnWidth(2, wxLIST_AUTOSIZE); | ||
m_listCtrlTools->SetColumnWidth(3, wxLIST_AUTOSIZE); | ||
} | ||
|
||
void ExternalToolDlg::DoUpdateEntry(const wxString& id, const wxString& path, const wxString& workingDirectory, const wxString& arguments) | ||
{ | ||
// try to see if 'id' already exist in the list control | ||
long item(wxNOT_FOUND); | ||
for(size_t i=0; i<m_listCtrlTools->GetItemCount(); i++){ | ||
if(GetColumnText(m_listCtrlTools, i, 0) == id){ | ||
item = i; | ||
break; | ||
} | ||
} | ||
|
||
// append new row | ||
if(item == wxNOT_FOUND){ | ||
item = AppendListCtrlRow(m_listCtrlTools); | ||
} | ||
|
||
SetColumnText(m_listCtrlTools, item, 0, id); | ||
SetColumnText(m_listCtrlTools, item, 1, path); | ||
SetColumnText(m_listCtrlTools, item, 2, arguments); | ||
SetColumnText(m_listCtrlTools, item, 3, workingDirectory); | ||
|
||
m_listCtrlTools->SetColumnWidth(0, 150); | ||
m_listCtrlTools->SetColumnWidth(1, wxLIST_AUTOSIZE); | ||
m_listCtrlTools->SetColumnWidth(2, wxLIST_AUTOSIZE); | ||
m_listCtrlTools->SetColumnWidth(3, wxLIST_AUTOSIZE); | ||
} | ||
|
||
void ExternalToolDlg::DoEditEntry(long item) | ||
{ | ||
wxString id = GetColumnText(m_listCtrlTools, m_item, 0); | ||
wxString path = GetColumnText(m_listCtrlTools, m_item, 1); | ||
wxString args = GetColumnText(m_listCtrlTools, m_item, 2); | ||
wxString wd = GetColumnText(m_listCtrlTools, m_item, 3); | ||
|
||
NewToolDlg dlg(this, id, path, wd, args); | ||
if (dlg.ShowModal() == wxID_OK) { | ||
DoUpdateEntry(dlg.GetToolId(), dlg.GetPath(), dlg.GetWorkingDirectory(), dlg.GetArguments()); | ||
} | ||
} | ||
|
||
std::vector<ToolInfo> ExternalToolDlg::GetTools() | ||
{ | ||
std::vector<ToolInfo> tools; | ||
for(size_t i=0; i<m_listCtrlTools->GetItemCount(); i++){ | ||
ToolInfo ti; | ||
ti.SetId(GetColumnText(m_listCtrlTools, i, 0)); | ||
ti.SetPath(GetColumnText(m_listCtrlTools, i, 1)); | ||
ti.SetArguments(GetColumnText(m_listCtrlTools, i, 2)); | ||
ti.SetWd(GetColumnText(m_listCtrlTools, i, 3)); | ||
tools.push_back(ti); | ||
} | ||
return tools; | ||
} | ||
|
||
void ExternalToolDlg::SetTools(const std::vector<ToolInfo>& tools) | ||
{ | ||
m_listCtrlTools->Freeze(); | ||
m_listCtrlTools->DeleteAllItems(); | ||
|
||
for(size_t i=0; i<tools.size(); i++){ | ||
ToolInfo ti = tools.at(i); | ||
long item = AppendListCtrlRow(m_listCtrlTools); | ||
SetColumnText(m_listCtrlTools, item, 0, ti.GetId()); | ||
SetColumnText(m_listCtrlTools, item, 1, ti.GetPath()); | ||
SetColumnText(m_listCtrlTools, item, 2, ti.GetArguments()); | ||
SetColumnText(m_listCtrlTools, item, 3, ti.GetWd()); | ||
} | ||
|
||
m_listCtrlTools->SetColumnWidth(0, 150); | ||
m_listCtrlTools->SetColumnWidth(1, wxLIST_AUTOSIZE); | ||
m_listCtrlTools->SetColumnWidth(2, wxLIST_AUTOSIZE); | ||
m_listCtrlTools->SetColumnWidth(3, wxLIST_AUTOSIZE); | ||
|
||
m_listCtrlTools->Thaw(); | ||
} |
Oops, something went wrong.