1
//////////////////////////////////////////////////////////////////////////////
2
//////////////////////////////////////////////////////////////////////////////
4
// copyright : (C) 2008 by Eran Ifrah
5
// file name : macrosdlg.cpp
7
// -------------------------------------------------------------------------
10
// / __ \ | | | | (_) |
11
// | / \/ ___ __| | ___| | _| |_ ___
12
// | | / _ \ / _ |/ _ \ | | | __/ _ )
13
// | \__/\ (_) | (_| | __/ |___| | || __/
14
// \____/\___/ \__,_|\___\_____/_|\__\___|
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
23
//////////////////////////////////////////////////////////////////////////////
24
//////////////////////////////////////////////////////////////////////////////
26
#include <wx/dataobj.h>
28
#include <wx/clipbrd.h>
30
#include <wx/xrc/xmlres.h>
31
#include "macrosdlg.h"
34
BEGIN_EVENT_TABLE(MacrosDlg, MacrosBaseDlg)
35
EVT_MENU(XRCID("copy_macro"), MacrosDlg::OnCopy)
38
MacrosDlg::MacrosDlg( wxWindow* parent, int content )
39
: MacrosBaseDlg( parent )
44
m_buttonOk->SetFocus();
45
GetSizer()->SetMinSize(500, 400);
46
GetSizer()->Fit(this);
49
void MacrosDlg::OnItemRightClick( wxListEvent& event )
51
m_item = event.m_itemIndex;
53
menu.Append(XRCID("copy_macro"), wxT("Copy"), false);
57
void MacrosDlg::Initialize()
59
m_listCtrlMacros->InsertColumn(0, wxT("Macro"));
60
m_listCtrlMacros->InsertColumn(1, wxT("Description"));
62
switch ( m_content ) {
64
AddMacro(wxT("$(ProjectPath)"), wxT("Expands to project's path"));
65
AddMacro(wxT("$(WorkspacePath)"), wxT("Expands to workspace's path"));
66
AddMacro(wxT("$(ProjectName)"), wxT("Expands to the current project name as appears in the 'File View'"));
67
AddMacro(wxT("$(IntermediateDirectory)"), wxT("Expands to the current project intermediate directory path, as set in the project settings"));
68
AddMacro(wxT("$(ConfigurationName)"), wxT("Expands to the current project selected configuration"));
69
AddMacro(wxT("$(OutDir)"), wxT("An alias to $(IntermediateDirectory)"));
70
AddMacro(wxT("$(CurrentFileName)"), wxT("Expands to current file name (without extension and path)"));
71
AddMacro(wxT("$(CurrentFilePath)"), wxT("Expands to current file path"));
72
AddMacro(wxT("$(CurrentFileFullPath)"), wxT("Expands to current file full path (path and full name)"));
73
AddMacro(wxT("$(User)"), wxT("Expands to logged-in user as defined by the OS"));
74
AddMacro(wxT("$(Date)"), wxT("Expands to current date"));
75
AddMacro(wxT("$(CodeLitePath)"), wxT("Expands to CodeLite's startup directory on (e.g. on Unix it exapnds to ~/.codelite/"));
76
AddMacro(wxT("`expression`"), wxT("backticks: evaluates the expression inside the backticks into a string"));
79
AddMacro(wxT("$(CompilerName)"), wxT("Expands to the compiler name as set in the Tools tab"));
80
AddMacro(wxT("$(SourceSwitch)"), wxT("Expands to the source switch (usually, -c)"));
81
AddMacro(wxT("$(FileFullPath)"), wxT("The file full path (includes path+name+extnesion)"));
82
AddMacro(wxT("$(FileFullName)"), wxT("The file full name (includes name+extnesion)"));
83
AddMacro(wxT("$(FileName)"), wxT("The file name (includes name only)"));
84
AddMacro(wxT("$(CmpOptions)"), wxT("Expands to the compiler options as set in the project settings"));
85
AddMacro(wxT("$(RcCompilerName)"), wxT("Expands to the resource compiler name"));
86
AddMacro(wxT("$(IntermediateDirectory)"), wxT("Expands to the current project intermediate directory path, as set in the project settings"));
87
AddMacro(wxT("$(ConfigurationName)"), wxT("Expands to the current project selected configuration"));
88
AddMacro(wxT("$(OutDir)"), wxT("An alias to $(IntermediateDirectory)"));
89
AddMacro(wxT("$(LinkerName)"), wxT("Expands to the linker name as set in the Tools tab"));
90
AddMacro(wxT("$(ArchiveTool)"), wxT("Expands to the archive tool (e.g. ar) name as set in the Tools tab"));
91
AddMacro(wxT("$(SharedObjectLinkerName)"), wxT("Expands to the shared object linker name as set in the Tools tab"));
92
AddMacro(wxT("$(ObjectSuffix)"), wxT("Objects suffix (usually set to .o)"));
93
AddMacro(wxT("$(DependSuffix)"), wxT("Objects suffix (usually set to .o.d)"));
94
AddMacro(wxT("$(PreprocessSuffix)"), wxT("Objects suffix (usually set to .o.i)"));
95
AddMacro(wxT("$(IncludeSwitch)"), wxT("The compiler include switch"));
96
AddMacro(wxT("$(LibrarySwitch)"), wxT("The library switch (e.g. -l)"));
97
AddMacro(wxT("$(OutputSwitch)"), wxT("The output switch (e.g. -o)"));
98
AddMacro(wxT("$(LibraryPathSwitch)"), wxT("Library switch (e.g. -L)"));
99
AddMacro(wxT("$(PreprocessorSwitch)"), wxT("Preprocessor switch (e.g. -D)"));
100
AddMacro(wxT("$(Preprocessors)"), wxT("Expands to all preprocessors set in the project setting where each entry is prefixed with $(PreprocessorSwitch)"));
101
AddMacro(wxT("$(ArchiveOutputSwitch)"), wxT("Archive switch, usually not needed (VC compiler sets it to /OUT:"));
102
AddMacro(wxT("$(PreprocessOnlySwitch)"), wxT("The compiler preprocess-only switch (e.g. -E)"));
103
AddMacro(wxT("$(LinkOptions)"), wxT("The linker options as set in the project settings"));
104
AddMacro(wxT("$(IncludePath)"), wxT("All include paths prefixed with $(IncludeSwitch)"));
105
AddMacro(wxT("$(RcIncludePath)"), wxT("Resource compiler include path as set in the project settings"));
106
AddMacro(wxT("$(Libs)"), wxT("List of libraries to link with. each library is prefixed with $(LibrarySwitch)"));
107
AddMacro(wxT("$(LibPath)"), wxT("List of library paths to link with. each library is prefixed with $(LibraryPathSwitch)"));
108
AddMacro(wxT("$(OutputFile)"), wxT("The output file"));
113
m_listCtrlMacros->SetColumnWidth(0, wxLIST_AUTOSIZE);
114
m_listCtrlMacros->SetColumnWidth(1, wxLIST_AUTOSIZE);
117
void MacrosDlg::AddMacro(const wxString& name, const wxString& desc)
119
long row = AppendListCtrlRow(m_listCtrlMacros);
120
SetColumnText(m_listCtrlMacros, row, 0, name);
121
SetColumnText(m_listCtrlMacros, row, 1, desc);
124
MacrosDlg::~MacrosDlg()
128
void MacrosDlg::OnCopy(wxCommandEvent& e)
130
if (m_item != wxNOT_FOUND) {
131
wxString value = GetColumnText(m_listCtrlMacros, m_item, 0);
133
if (wxTheClipboard->Open()) {
134
wxTheClipboard->UsePrimarySelection(false);
135
if (!wxTheClipboard->SetData(new wxTextDataObject(value))) {
136
//wxPrintf(wxT("Failed to insert data %s to clipboard"), textToCopy.GetData());
138
wxTheClipboard->Close();
140
wxPrintf(wxT("Failed to open the clipboard"));
144
m_item = wxNOT_FOUND;