-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCBSvnPluginManager.h
141 lines (112 loc) · 5.03 KB
/
CBSvnPluginManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//******************************************************************************
//* Name: CBSvnPluginManager.h
//* Purpose: Plugin manager object (singleton)
//* Author: Jan van den Borst
//* Copyright: (c) Jan van den Borst
//* License: GPL
//******************************************************************************
#ifndef _CBSVNPLUGINMANAGER_H
#define _CBSVNPLUGINMANAGER_H
//******************************************************************************
#include <memory>
#include <wx/string.h>
#include "utils.h"
//******************************************************************************
#define MAIN_MENU (CBSvnPluginManager::GetInstance().GetMenu(CBSvnPluginManager::smMainMenu))
#define POPUP_MENU (CBSvnPluginManager::GetInstance().GetMenu(CBSvnPluginManager::smPopupMenu))
//******************************************************************************
namespace CBTSVN
{
const wxString plugin_name = _("CBTortoiseSVN");
const wxString svnpath = _("SVNPATH");
const wxString tortoisesvnpath = _("TORTOISE_SVN_PATH");
const wxString mainmenuintegration = _("MAINMENU_INTEGRATION");
const wxString editorintegration = _("EDITOR_INTEGRATION");
const wxString projectmanagerintegration = _("PROJECT_MANAGER_INTEGRATION");
const wxString maxintegrationperformance = _("MAX_INTEGRATION_PERFORMANCE");
const wxString mainmenu = _("MAINMENU");
const wxString popupmenu = _("POPUPMENU");
const wxString project_custom_location = _("PROJECT_CUSTOM_LOCATION");
const wxString project_custom_relative = _("PROJECT_CUSTOM_RELATIVE");
const wxString workspace_custom_location = _("WORKSPACE_CUSTOM_LOCATION");
const wxString workspace_custom_relative = _("WORKSPACE_CUSTOM_RELATIVE");
const wxString separator = _("-----------------");
class IMenuCmd : public IInterfaceBase
{
public:
virtual bool GetFileBased() const=0;
virtual void SetFileBased(bool FileBased)=0;
virtual bool GetProjectBased() const=0;
virtual void SetProjectBased(bool ProjectBased)=0;
virtual bool GetWorkspaceBased() const=0;
virtual void SetWorkspaceBased(bool ProjectBased)=0;
virtual void SetCustom(bool custom)=0;
virtual bool GetCustom() const=0;
virtual wxString GetFilename() const=0;
virtual void SetFilename(const wxString& filename)=0;
};
class CBSvnPluginManager :
ILogSink,
Noncopyable
{
public:
static CBSvnPluginManager& GetInstance();
// location svn.exe
wxString GetSvn() const;
void SetSvn(const wxString& svn);
// location GetTortoiseproc.exe
wxString GetTortoiseproc() const;
void SetTortoiseproc(const wxString& svn);
// integration
bool GetMainMenuIntegration() const;
void SetMainMenuIntegration(bool enabled);
bool GetEditorIntegration() const;
void SetEditorIntegration(bool enabled);
bool GetProjectManagerIntegration() const;
void SetProjectManagerIntegration(bool enabled);
bool GetMaxIntegrationPerformance() const;
void SetMaxIntegrationPerformance(bool max);
// menu
wxString GetMainMenu() const;
void SetMainMenu(const wxString& s);
wxString GetPopupMenu() const;
void SetPopupMenu(const wxString& s);
// FileProjectWorkspaceBased
enum SourceMenu
{
smMainMenu=0,
smPopupMenu,
smNumSourceMenu
};
IMenuCmd& GetMenu(const SourceMenu& menu)
{return *menus[menu];}
// logging
void Togglelogging(bool debug)
{ m_debug=!m_debug;}
// lifecycle
void Initialise();
void Shutdown();
// misc.
bool FileUnderVersionControl(const wxString& filename);
void RunSimpleTortoiseSVNCommand(const IMenuCmd& menu, const wxString& command, const wxString& special_command=_(""));
private:
void OnLogEvent(const wxString& msg);
CBSvnPluginManager();
~CBSvnPluginManager(){};
std::auto_ptr<IMenuCmd> menus[smNumSourceMenu];
wxString m_svn;
wxString m_tortoisesvnpath;
bool m_MainMenuIntegration;
bool m_EditorIntegration;
bool m_ProjectManagerIntegration;
bool m_MaxIntegrationPerformance;
bool m_expert;
bool m_debug;
wxString m_mainmenu;
wxString m_popupmenu;
};
// support functions
void LogMenu(const IMenuCmd& menu);
};
//******************************************************************************
#endif // _CBSVNPLUGINMANAGER_H