Check-in [766bccfdb4]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added dir folders in file tree .. implemented file add & rename
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:766bccfdb4d81547d0eb33c68b479eb0953d6c7a
User & Date: isafam 2014-01-21 23:27:24
Context
2014-01-22
21:58
Implemented delete & commit dialog Leaf check-in: 85d831884e user: isafam tags: trunk
2014-01-21
23:27
Added dir folders in file tree .. implemented file add & rename check-in: 766bccfdb4 user: isafam tags: trunk
2014-01-19
22:19
Now showing file tree by using 'fossil ls' callback check-in: b88342d24d user: isafam tags: trunk
Changes

Changes to Fossil/Fossil.project.

11
12
13
14
15
16
17


18
19
20
21
22
23
24
..
28
29
30
31
32
33
34

35
36





37
38
39
40
41
42
43
...
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
...
270
271
272
273
274
275
276
277
278
279
280
281
282
    <File Name="fossil_view.cpp"/>
    <File Name="fossil_console.cpp"/>
    <File Name="fossil_ui.cpp"/>
    <File Name="fossil_settings_dialog.cpp"/>
    <File Name="commit_dialog.cpp"/>
    <File Name="fossilstatushandler.cpp"/>
    <File Name="fossilcommand.cpp"/>


  </VirtualDirectory>
  <VirtualDirectory Name="include">
    <File Name="fossil.h"/>
    <File Name="commitmessagescache.h"/>
    <File Name="fossilsettingsdata.h"/>
    <File Name="fossil_view.h"/>
    <File Name="fossil_console.h"/>
................................................................................
    <File Name="fossil_settings_dialog.h"/>
    <File Name="fossilinfo.h"/>
    <File Name="fossiltreedata.h"/>
    <File Name="commit_dialog.h"/>
    <File Name="fossilcommandhandler.h"/>
    <File Name="fossilcommand.h"/>
    <File Name="fossilstatushandler.h"/>

  </VirtualDirectory>
  <Dependencies/>





  <Settings Type="Dynamic Library">
    <Configuration Name="DebugUnicode" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
      <Compiler Options="-g;$(shell wx-config --cxxflags --debug=yes --unicode=yes)" Required="yes" PreCompiledHeader="">
        <IncludePath Value="."/>
        <IncludePath Value="../Interfaces"/>
        <IncludePath Value="../CodeLite"/>
        <IncludePath Value="../Plugin"/>
................................................................................
        <Library Value="libCodeLiteud.a"/>
        <Library Value="libwxsqlite3ud.a"/>
        <Library Value="libsqlite3.a"/>
        <Library Value="libwxmsw28ud.a"/>
        <Library Value="libwxscintillaud.a"/>
      </Linker>
      <ResourceCompiler Options="" Required="no"/>
      <General OutputFile="../Runtime/plugins/Fossil.dll" IntermediateDirectory="./WinDebugUnicode" Command="./codelite" CommandArguments="-b ." WorkingDirectory="../Runtime" PauseExecWhenProcTerminates="no"/>
      <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="">
        <PostConnectCommands/>
        <StartupCommands/>
      </Debugger>
      <PreBuild/>
      <PostBuild/>
      <CustomBuild Enabled="no">
................................................................................
      </Compiler>
      <Linker Options="">
        <LibraryPath Value="."/>
      </Linker>
      <ResourceCompiler Options=""/>
    </GlobalSettings>
  </Settings>
  <Dependencies Name="DebugUnicode"/>
  <Dependencies Name="ReleaseUnicode"/>
  <Dependencies Name="WinDebugUnicode"/>
  <Dependencies Name="WinDebug_29"/>
  <Dependencies Name="WinReleaseUnicode"/>
</CodeLite_Project>







>
>







 







>


>
>
>
>
>







 







|







 







<
<
<
<
<

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
...
278
279
280
281
282
283
284





285
    <File Name="fossil_view.cpp"/>
    <File Name="fossil_console.cpp"/>
    <File Name="fossil_ui.cpp"/>
    <File Name="fossil_settings_dialog.cpp"/>
    <File Name="commit_dialog.cpp"/>
    <File Name="fossilstatushandler.cpp"/>
    <File Name="fossilcommand.cpp"/>
    <File Name="fossildefaulthandler.cpp"/>
    <File Name="any.h"/>
  </VirtualDirectory>
  <VirtualDirectory Name="include">
    <File Name="fossil.h"/>
    <File Name="commitmessagescache.h"/>
    <File Name="fossilsettingsdata.h"/>
    <File Name="fossil_view.h"/>
    <File Name="fossil_console.h"/>
................................................................................
    <File Name="fossil_settings_dialog.h"/>
    <File Name="fossilinfo.h"/>
    <File Name="fossiltreedata.h"/>
    <File Name="commit_dialog.h"/>
    <File Name="fossilcommandhandler.h"/>
    <File Name="fossilcommand.h"/>
    <File Name="fossilstatushandler.h"/>
    <File Name="fossildefaulthandler.h"/>
  </VirtualDirectory>
  <Dependencies/>
  <Dependencies Name="DebugUnicode"/>
  <Dependencies Name="ReleaseUnicode"/>
  <Dependencies Name="WinDebugUnicode"/>
  <Dependencies Name="WinDebug_29"/>
  <Dependencies Name="WinReleaseUnicode"/>
  <Settings Type="Dynamic Library">
    <Configuration Name="DebugUnicode" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
      <Compiler Options="-g;$(shell wx-config --cxxflags --debug=yes --unicode=yes)" Required="yes" PreCompiledHeader="">
        <IncludePath Value="."/>
        <IncludePath Value="../Interfaces"/>
        <IncludePath Value="../CodeLite"/>
        <IncludePath Value="../Plugin"/>
................................................................................
        <Library Value="libCodeLiteud.a"/>
        <Library Value="libwxsqlite3ud.a"/>
        <Library Value="libsqlite3.a"/>
        <Library Value="libwxmsw28ud.a"/>
        <Library Value="libwxscintillaud.a"/>
      </Linker>
      <ResourceCompiler Options="" Required="no"/>
      <General OutputFile="../Runtimed/plugins/Fossil.dll" IntermediateDirectory="./WinDebugUnicode" Command="./codelite" CommandArguments="-b ." WorkingDirectory="../Runtimed" PauseExecWhenProcTerminates="no"/>
      <Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="">
        <PostConnectCommands/>
        <StartupCommands/>
      </Debugger>
      <PreBuild/>
      <PostBuild/>
      <CustomBuild Enabled="no">
................................................................................
      </Compiler>
      <Linker Options="">
        <LibraryPath Value="."/>
      </Linker>
      <ResourceCompiler Options=""/>
    </GlobalSettings>
  </Settings>





</CodeLite_Project>

Changes to Fossil/fossil.cpp.


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
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
..
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
...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
236
237
238
239
240
241
242

243
244
245
246
247
248
249
...
257
258
259
260
261
262
263

264
265
266
267
268
269
270
...
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387






























388
389
390
391
392
393
394
...
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
...
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
...
836
837
838
839
840
841
842

843
844
845
846
847
848
849
850
851

852



853
854
855



856

857
858
859
860

861
862
863
864
865
866
867

#include <wx/app.h>
#include <wx/filefn.h>
//#include "fossilversion_password_db.h"
#include <wx/tokenzr.h>
#include "detachedpanesinfo.h"
#include "dockablepane.h"
#include "fossil.h"
#include "procutils.h"
#include "workspace.h"
#include <wx/ffile.h>
#include <wx/stdpaths.h>
#include "fossil_login_dialog.h"
//#include "fossil_command_handlers.h"
#include <wx/textdlg.h>
#include "commit_dialog.h"
//#include "fossilstatushandler.h"
#include "fossil_strings.h"
#include <wx/menu.h>
#include "fossil_settings_dialog.h"
#include "fossil_console.h"

#include "fossil_view.h"
#include <wx/xrc/xmlres.h>
#include <wx/menuitem.h>
#include <wx/menu.h>
#include <wx/filedlg.h>
#include <wx/imaglist.h>

................................................................................
	}
	return thePlugin;
}

extern "C" EXPORT PluginInfo GetPluginInfo()
{
	PluginInfo info;
	info.SetAuthor(wxT("M. Isa"));
	info.SetName(wxT("Fossil"));
	info.SetDescription(wxT("Fossil plugin for codelite2.0 based on the fossil command line tool"));
	info.SetVersion(wxT("v1.0"));
	return info;
}

extern "C" EXPORT int GetPluginInterfaceVersion()
................................................................................
	return PLUGIN_INTERFACE_VERSION;
}

Fossil::Fossil(IManager *manager)
		: IPlugin           (manager)
		, m_explorerSepItem (NULL)
		, m_simpleCommand   (this)
		//, m_diffCommand     (this)
		//, m_blameCommand    (this)
		, m_fossilClientVersion(0.0)
{
	m_longName = wxT("Fossil plugin for codelite2.0 based on the fossil command line tool");
	m_shortName = wxT("Fossil");

	DoInitialize();

	GetManager()->GetTheApp()->Connect(XRCID("fossil_settings"),             wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnSettings),          NULL, this);

/*
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_commit"),              wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnCommit),            NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_update"),              wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnUpdate),            NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_add"),                 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnAdd),               NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_delete"),              wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnDelete),            NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_revert"),              wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnRevert),            NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_patch"),               wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnPatch),             NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_diff"),                wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnDiff),              NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_log"),                 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnLog),               NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_blame"),               wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnBlame),             NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_ignore_file"),         wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnIgnoreFile),        NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_ignore_file_pattern"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnIgnoreFilePattern), NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_set_as_view"),         wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnSelectAsView),      NULL, this);

	GetManager()->GetTheApp()->Connect(wxEVT_GET_ADDITIONAL_COMPILEFLAGS, wxCommandEventHandler(Fossil::OnGetCompileLine), NULL, this);
*/
}

Fossil::~Fossil()
{
................................................................................

	item = new wxMenuItem(menu, XRCID("fossil_explorer_set_as_view"), wxT("Display this path in the Fossil View"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);
	menu->AppendSeparator();

	item = new wxMenuItem(menu, XRCID("fossil_explorer_update"), wxT("Update"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	item = new wxMenuItem(menu, XRCID("fossil_explorer_commit"), wxT("Commit"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	menu->AppendSeparator();

	item = new wxMenuItem(menu, XRCID("fossil_explorer_add"), wxT("Add"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	item = new wxMenuItem(menu, XRCID("fossil_explorer_delete"), wxT("Delete"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	menu->AppendSeparator();

	item = new wxMenuItem(menu, XRCID("fossil_explorer_revert"), wxT("Revert"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);
	menu->AppendSeparator();

	item = new wxMenuItem(menu, XRCID("fossil_explorer_diff"), wxT("Create Diff"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);
	item = new wxMenuItem(menu, XRCID("fossil_explorer_patch"), wxT("Apply Patch"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);
	menu->AppendSeparator();

	item = new wxMenuItem(menu, XRCID("fossil_explorer_blame"), wxT("Blame ..."), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	menu->AppendSeparator();
	item = new wxMenuItem(menu, XRCID("fossil_explorer_log"), wxT("Change Log..."), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	menu->AppendSeparator();
	wxMenu *subMenu;
	subMenu = new wxMenu;
	subMenu->Append(XRCID("fossil_explorer_ignore_file"),         wxT("Ignore this file"));
	subMenu->Append(XRCID("fossil_explorer_ignore_file_pattern"), wxT("Ignore this file pattern"));
	menu->Append(wxID_ANY, wxT("Ignore"), subMenu);

	return menu;
}

void Fossil::UnHookPopupMenu(wxMenu *menu, MenuType type)
{
	wxMenuItem *item = menu->FindItem(XRCID("FOSSIL_EXPLORER_POPUP"));
	if (item) {
................................................................................
		menu->Destroy(m_explorerSepItem);
		m_explorerSepItem = NULL;
	}
}

void Fossil::UnPlug()
{
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_settings"),             wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnSettings),          NULL, this);

/*
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_commit"),              wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnCommit),            NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_update"),              wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnUpdate),            NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_add"),                 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnAdd),               NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_delete"),              wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnDelete),            NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_revert"),              wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnRevert),            NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_patch"),               wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnPatch),             NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_diff"),                wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnDiff),              NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_log"),                 wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnLog),               NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_blame"),               wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnBlame),             NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_ignore_file"),         wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnIgnoreFile),        NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_ignore_file_pattern"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnIgnoreFilePattern), NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_set_as_view"),         wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnSelectAsView),      NULL, this);
	GetManager()->GetTheApp()->Disconnect(wxEVT_GET_ADDITIONAL_COMPILEFLAGS, wxCommandEventHandler(Fossil::OnGetCompileLine), NULL, this);
*/

	m_fossilView->DisconnectEvents();

	// Remove the tab pinned to the workspace pane
	size_t index(Notebook::npos);
................................................................................
		else
			book->InsertPage(index, m_fossilView, fossilCONSOLE_TEXT, false);
	}

	m_fossilConsole = new FossilConsole(m_mgr->GetOutputPaneNotebook(), this);
	m_mgr->GetOutputPaneNotebook()->AddPage(m_fossilConsole, fossilCONSOLE_TEXT, false, wxXmlResource::Get()->LoadBitmap(wxT("svn_repo")));


	// We need to perform a dummy call to fossil so it will create all the default
	// setup directory layout
	wxString      command;
	wxArrayString output;

	command << GetFossilExeName(false) << wxT(" --help ");

................................................................................
	for(size_t i=0; i < count; i++) {
		out = output[i];
		GetConsole()->AppendText(out + wxT("\n"));
	}

	RecreateLocalFossilConfigFile();
	//DoGetFossilVersion();

}

FossilSettingsData Fossil::GetSettings()
{
	FossilSettingsData fsd;
	GetManager()->GetConfigTool()->ReadObject(wxT("FossilSettingsData"), &fsd);
	return fsd;
................................................................................
		wxMkdir(configDir);
	}

	configDir << wxFileName::GetPathSeparator() << wxT("fossil");
	return configDir;
}

wxString Fossil::GetFossilExeName(bool nonInteractive)
{
	FossilSettingsData fsd = GetSettings();
	wxString executeable;
	bool encloseQuotations = false;
	wxString exeName = fsd.GetExecutable();
	exeName.Trim().Trim(false);
	encloseQuotations = (exeName.Find(wxT(" ")) != wxNOT_FOUND);
	if (encloseQuotations) {
		executeable << wxT("\"") << fsd.GetExecutable() << wxT("\" ");
	} else {
		executeable << fsd.GetExecutable() << wxT(" ");
	}

	//if(nonInteractive)
	//	executeable << wxT(" --non-interactive ");

	// --trust-server-cert was introduced in version >=1.6
	// but it also requires --non-interactive mode enabled
	//if(GetFossilClientVersion() >= 1.6 && nonInteractive) {
	//	executeable << wxT(" --trust-server-cert ");
	//}

	//executeable << wxT(" --config-dir \"") << GetUserConfigDir() << wxT("\" ");
	return executeable;
}


////////////////////////////////////////////////
// File Explorer FOSSIL command handlers
////////////////////////////////////////////////































#if 0

void Fossil::OnAdd(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;
................................................................................
		bool nonInteractive = GetNonInteractiveMode(event);
		wxString comment = dlg.GetMesasge();
		command << GetFossilExeName(nonInteractive) << loginString << wxT(" commit \"") << DoGetFileExplorerItemFullPath() << wxT("\" -m \"") << comment << wxT("\"");
		GetConsole()->Execute(command, DoGetFileExplorerItemPath(), new FossilCommitHandler(this, event.GetId(), this));
	}
}

void Fossil::OnDelete(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;
	if(LoginIfNeeded(event, DoGetFileExplorerItemPath(), loginString) == false) {
		return;
	}
	bool nonInteractive = GetNonInteractiveMode(event);
	command << GetFossilExeName(nonInteractive) << loginString << wxT(" delete --force \"") << DoGetFileExplorerItemFullPath() << wxT("\"");
	GetConsole()->Execute(command, DoGetFileExplorerItemPath(), new FossilDefaultCommandHandler(this, event.GetId(), this));
}

void Fossil::OnRevert(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;

	command << GetFossilExeName(false) << loginString << wxT(" revert --recursive \"") << DoGetFileExplorerItemFullPath() << wxT("\"");
	GetConsole()->Execute(command, DoGetFileExplorerItemPath(), new FossilDefaultCommandHandler(this, event.GetId(), this));
................................................................................
		executeable << wxT(" --trust-server-cert ");
	}

	executeable << wxT(" --config-dir \"") << GetUserConfigDir() << wxT("\" ");
	return executeable;
}

wxString Fossil::DoGetFileExplorerItemFullPath()
{
	TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo(TreeFileExplorer);
	wxString filename ( item.m_fileName.GetFullPath() );
	filename.Trim().Trim(false);

	if(filename.EndsWith(wxT("\\"))) {
		filename.RemoveLast();

	} else if(filename.EndsWith(wxT("/"))) {
		filename.RemoveLast();

	}
	return filename;
}

wxString Fossil::DoGetFileExplorerItemPath()
{
	TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo(TreeFileExplorer);
	return item.m_fileName.GetPath();
}

wxString Fossil::GetUserConfigDir()
{
	wxString configDir(wxStandardPaths::Get().GetUserDataDir());
	if(wxFileName::DirExists(configDir) == false) {
		wxMkdir(configDir);
	}

................................................................................
	for(size_t i=0; i<xmlArr.GetCount(); i++){
		xmlStr << xmlArr.Item(i);
	}

	FossilXML::GetFossilInfo(xmlStr, fossilInfo);
	wxLog::EnableLogging(true);
}


bool Fossil::IsPathUnderFossil(const wxString& path)
{
	wxFileName fn(path);
	wxString fossilDirectory1(fn.GetPath());
	wxString fossilDirectory2(fn.GetPath());
	fossilDirectory1 << wxFileName::GetPathSeparator() << wxT(".fossil");
	fossilDirectory2 << wxFileName::GetPathSeparator() << wxT("_fossil");


	if(wxDirExists(fossilDirectory1.c_str()))



		return true;

	if(wxDirExists(fossilDirectory2.c_str()))



		return true;


	return false;
}


void Fossil::OnSwitchURL(wxCommandEvent& event)
{
	FossilInfo fossilInfo;
	wxString path = DoGetFileExplorerItemPath();
	DoGetFossilInfoSync(fossilInfo, path);
	DoSwitchURL(DoGetFileExplorerItemPath(), fossilInfo.m_sourceUrl, event);
}
>


<









<


<




>







 







|







 







<
<
<






|
>

|
<
<
<
<
<
<
<
<
<
<
|







 







<


<


<
<
<


<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|
>

|
<
<
<
<
<
<
<
<
<
<
|







 







>







 







>







 







|













<
<
<
<
<
<
<
<
<
<







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>




|
|
|
<

>
|
>
>
>
|
<
<
>
>
>
|
>
|



>







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
..
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
..
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
...
107
108
109
110
111
112
113

114
115

116
117



118
119

120
121
























122
123
124
125
126
127
128
...
130
131
132
133
134
135
136
137
138
139
140










141
142
143
144
145
146
147
148
...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
...
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320










321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
...
382
383
384
385
386
387
388












389
390
391
392
393
394
395
...
454
455
456
457
458
459
460






















461
462
463
464
465
466
467
...
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786

787
788
789
790
791
792
793


794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810

#include <wx/app.h>
#include <wx/filefn.h>

#include <wx/tokenzr.h>
#include "detachedpanesinfo.h"
#include "dockablepane.h"
#include "fossil.h"
#include "procutils.h"
#include "workspace.h"
#include <wx/ffile.h>
#include <wx/stdpaths.h>
#include "fossil_login_dialog.h"

#include <wx/textdlg.h>
#include "commit_dialog.h"

#include "fossil_strings.h"
#include <wx/menu.h>
#include "fossil_settings_dialog.h"
#include "fossil_console.h"
#include "fossildefaulthandler.h"
#include "fossil_view.h"
#include <wx/xrc/xmlres.h>
#include <wx/menuitem.h>
#include <wx/menu.h>
#include <wx/filedlg.h>
#include <wx/imaglist.h>

................................................................................
	}
	return thePlugin;
}

extern "C" EXPORT PluginInfo GetPluginInfo()
{
	PluginInfo info;
	info.SetAuthor(wxT("M. Isa (modified from svn client by Eran Ifrah"));
	info.SetName(wxT("Fossil"));
	info.SetDescription(wxT("Fossil plugin for codelite2.0 based on the fossil command line tool"));
	info.SetVersion(wxT("v1.0"));
	return info;
}

extern "C" EXPORT int GetPluginInterfaceVersion()
................................................................................
	return PLUGIN_INTERFACE_VERSION;
}

Fossil::Fossil(IManager *manager)
		: IPlugin           (manager)
		, m_explorerSepItem (NULL)
		, m_simpleCommand   (this)



{
	m_longName = wxT("Fossil plugin for codelite2.0 based on the fossil command line tool");
	m_shortName = wxT("Fossil");

	DoInitialize();

	GetManager()->GetTheApp()->Connect(XRCID("fossil_settings"),             wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnSettings),     NULL, this);
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_delete"),      wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnDelete),       NULL, this);
/*
	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_commit"),      wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnCommit),       NULL, this);










	GetManager()->GetTheApp()->Connect(XRCID("fossil_explorer_set_as_view"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnSelectAsView), NULL, this);

	GetManager()->GetTheApp()->Connect(wxEVT_GET_ADDITIONAL_COMPILEFLAGS, wxCommandEventHandler(Fossil::OnGetCompileLine), NULL, this);
*/
}

Fossil::~Fossil()
{
................................................................................

	item = new wxMenuItem(menu, XRCID("fossil_explorer_set_as_view"), wxT("Display this path in the Fossil View"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);
	menu->AppendSeparator();

	item = new wxMenuItem(menu, XRCID("fossil_explorer_update"), wxT("Update"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	item = new wxMenuItem(menu, XRCID("fossil_explorer_commit"), wxT("Commit"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	menu->AppendSeparator();




	item = new wxMenuItem(menu, XRCID("fossil_explorer_delete"), wxT("Delete"), wxEmptyString, wxITEM_NORMAL);
	menu->Append(item);

	menu->AppendSeparator();

























	return menu;
}

void Fossil::UnHookPopupMenu(wxMenu *menu, MenuType type)
{
	wxMenuItem *item = menu->FindItem(XRCID("FOSSIL_EXPLORER_POPUP"));
	if (item) {
................................................................................
		menu->Destroy(m_explorerSepItem);
		m_explorerSepItem = NULL;
	}
}

void Fossil::UnPlug()
{
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_settings"),             wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnSettings),     NULL, this);
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_delete"),      wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnDelete),       NULL, this);
/*
	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_commit"),      wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnCommit),       NULL, this);










	GetManager()->GetTheApp()->Disconnect(XRCID("fossil_explorer_set_as_view"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(Fossil::OnSelectAsView), NULL, this);
	GetManager()->GetTheApp()->Disconnect(wxEVT_GET_ADDITIONAL_COMPILEFLAGS, wxCommandEventHandler(Fossil::OnGetCompileLine), NULL, this);
*/

	m_fossilView->DisconnectEvents();

	// Remove the tab pinned to the workspace pane
	size_t index(Notebook::npos);
................................................................................
		else
			book->InsertPage(index, m_fossilView, fossilCONSOLE_TEXT, false);
	}

	m_fossilConsole = new FossilConsole(m_mgr->GetOutputPaneNotebook(), this);
	m_mgr->GetOutputPaneNotebook()->AddPage(m_fossilConsole, fossilCONSOLE_TEXT, false, wxXmlResource::Get()->LoadBitmap(wxT("svn_repo")));

/*
	// We need to perform a dummy call to fossil so it will create all the default
	// setup directory layout
	wxString      command;
	wxArrayString output;

	command << GetFossilExeName(false) << wxT(" --help ");

................................................................................
	for(size_t i=0; i < count; i++) {
		out = output[i];
		GetConsole()->AppendText(out + wxT("\n"));
	}

	RecreateLocalFossilConfigFile();
	//DoGetFossilVersion();
*/
}

FossilSettingsData Fossil::GetSettings()
{
	FossilSettingsData fsd;
	GetManager()->GetConfigTool()->ReadObject(wxT("FossilSettingsData"), &fsd);
	return fsd;
................................................................................
		wxMkdir(configDir);
	}

	configDir << wxFileName::GetPathSeparator() << wxT("fossil");
	return configDir;
}

wxString Fossil::GetFossilExeName()
{
	FossilSettingsData fsd = GetSettings();
	wxString executeable;
	bool encloseQuotations = false;
	wxString exeName = fsd.GetExecutable();
	exeName.Trim().Trim(false);
	encloseQuotations = (exeName.Find(wxT(" ")) != wxNOT_FOUND);
	if (encloseQuotations) {
		executeable << wxT("\"") << fsd.GetExecutable() << wxT("\" ");
	} else {
		executeable << fsd.GetExecutable() << wxT(" ");
	}











	return executeable;
}


////////////////////////////////////////////////
// File Explorer FOSSIL command handlers
////////////////////////////////////////////////

void Fossil::OnDelete(wxCommandEvent& event)
{
	wxString command;

	command << GetFossilExeName() << wxT(" delete \"") << DoGetFileExplorerItemFullPath() << wxT("\"");
	GetConsole()->Execute(command, DoGetFileExplorerItemPath(), new FossilDefaultHandler(this, event.GetId(), this));
}

wxString Fossil::DoGetFileExplorerItemFullPath()
{
	TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo(TreeFileExplorer);
	wxString filename ( item.m_fileName.GetFullPath() );
	filename.Trim().Trim(false);

	if(filename.EndsWith(wxT("\\"))) {
		filename.RemoveLast();

	} else if(filename.EndsWith(wxT("/"))) {
		filename.RemoveLast();

	}
	return filename;
}

wxString Fossil::DoGetFileExplorerItemPath()
{
	TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo(TreeFileExplorer);
	return item.m_fileName.GetPath();
}

#if 0

void Fossil::OnAdd(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;
................................................................................
		bool nonInteractive = GetNonInteractiveMode(event);
		wxString comment = dlg.GetMesasge();
		command << GetFossilExeName(nonInteractive) << loginString << wxT(" commit \"") << DoGetFileExplorerItemFullPath() << wxT("\" -m \"") << comment << wxT("\"");
		GetConsole()->Execute(command, DoGetFileExplorerItemPath(), new FossilCommitHandler(this, event.GetId(), this));
	}
}













void Fossil::OnRevert(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;

	command << GetFossilExeName(false) << loginString << wxT(" revert --recursive \"") << DoGetFileExplorerItemFullPath() << wxT("\"");
	GetConsole()->Execute(command, DoGetFileExplorerItemPath(), new FossilDefaultCommandHandler(this, event.GetId(), this));
................................................................................
		executeable << wxT(" --trust-server-cert ");
	}

	executeable << wxT(" --config-dir \"") << GetUserConfigDir() << wxT("\" ");
	return executeable;
}























wxString Fossil::GetUserConfigDir()
{
	wxString configDir(wxStandardPaths::Get().GetUserDataDir());
	if(wxFileName::DirExists(configDir) == false) {
		wxMkdir(configDir);
	}

................................................................................
	for(size_t i=0; i<xmlArr.GetCount(); i++){
		xmlStr << xmlArr.Item(i);
	}

	FossilXML::GetFossilInfo(xmlStr, fossilInfo);
	wxLog::EnableLogging(true);
}
#endif

bool Fossil::IsPathUnderFossil(const wxString& path)
{
	wxFileName fn(path);
	wxString filePath(fn.GetPath());
	wxString fossilRepo;
	wxChar sep = wxFileName::GetPathSeparator();


	while(filePath != wxEmptyString) {
		fossilRepo.Empty();
		fossilRepo << filePath << sep << wxT("_FOSSIL_");
		wxLogMessage(wxString::Format(wxT("File = '%s'"), fossilRepo.c_str()));
		if(wxFileExists(fossilRepo.c_str()))
			return true;


		fossilRepo.Empty();
		fossilRepo << filePath << sep << wxT(".fslckout");
		if(wxFileExists(fossilRepo.c_str()))
			return true;
		filePath = filePath.BeforeLast(sep);
	}
	return false;
}

#if 0
void Fossil::OnSwitchURL(wxCommandEvent& event)
{
	FossilInfo fossilInfo;
	wxString path = DoGetFileExplorerItemPath();
	DoGetFossilInfoSync(fossilInfo, path);
	DoSwitchURL(DoGetFileExplorerItemPath(), fossilInfo.m_sourceUrl, event);
}

Changes to Fossil/fossil.h.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
..
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
class wxMenu;
class wxMenuItem;

class Fossil : public IPlugin
{
private:
	FossilView*     m_fossilView;
	FossilConsole*         m_fossilConsole;
	wxMenuItem*         m_explorerSepItem;
	FossilCommand          m_simpleCommand;
	//FossilCommand          m_diffCommand;
	//FossilCommand          m_blameCommand;
	double              m_fossilClientVersion;
	CommitMessagesCache m_commitMessagesCache;

protected:
	void OnSettings(wxCommandEvent &event);

public:
	void EditSettings();
................................................................................
protected:

	///////////////////////////////////////////////////////////
	// File Explorer event handlers
	///////////////////////////////////////////////////////////
	void OnCommit           (wxCommandEvent &event);
	void OnUpdate           (wxCommandEvent &event);
	void OnAdd              (wxCommandEvent &event);
	void OnDelete           (wxCommandEvent &event);
	void OnRevert           (wxCommandEvent &event);
	void OnDiff             (wxCommandEvent &event);
	void OnPatch            (wxCommandEvent &event);
	void OnLog              (wxCommandEvent &event);
	void OnBlame            (wxCommandEvent &event);
	void OnIgnoreFile       (wxCommandEvent &event);
	void OnIgnoreFilePattern(wxCommandEvent &event);

	void OnSelectAsView     (wxCommandEvent &event);
	void OnSwitchURL        (wxCommandEvent &event);

	///////////////////////////////////////////////////////////
	// IDE events
	///////////////////////////////////////////////////////////
	void OnGetCompileLine   (wxCommandEvent &event);
................................................................................

	FossilView *GetFossilView() {
		return m_fossilView;
	}

	FossilSettingsData GetSettings();
	void            SetSettings(FossilSettingsData& fsd);
	wxString        GetFossilExeName(bool nonInteractive = true);
	wxString        GetUserConfigDir();
	void            RecreateLocalFossilConfigFile();
	void            Patch(bool dryRun, const wxString &workingDirectory, wxEvtHandler *owner, int id);
	void            IgnoreFiles(const wxArrayString& files, bool pattern);
	void            Blame(wxCommandEvent& event, const wxArrayString &files);

	void SetFossilClientVersion(double fossilClientVersion) {
		this->m_fossilClientVersion = fossilClientVersion;
	}

	double GetFossilClientVersion() const {
		return m_fossilClientVersion;
	}
	CommitMessagesCache& GetCommitMessagesCache() {
		return m_commitMessagesCache;
	}

	bool LoginIfNeeded        (wxCommandEvent &event, const wxString &workingDirectory, wxString& loginString);
	bool GetNonInteractiveMode(wxCommandEvent &event);
	bool IsPathUnderFossil       (const wxString &path);

protected:
	void DoInitialize();
	void DoGetFossilVersion();

	wxString DoGetFileExplorerItemFullPath();
	wxString DoGetFileExplorerItemPath();
};

#endif //Fossil







|
|
|
<
<
<







 







<

<
<
<
<
<
<
<
>







 







|


<
<
<

<
<
<
<
<
<
<




<
<
|



<






12
13
14
15
16
17
18
19
20
21



22
23
24
25
26
27
28
..
30
31
32
33
34
35
36

37







38
39
40
41
42
43
44
45
..
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
class wxMenu;
class wxMenuItem;

class Fossil : public IPlugin
{
private:
	FossilView*     m_fossilView;
	FossilConsole*	m_fossilConsole;
	wxMenuItem*		m_explorerSepItem;
	FossilCommand	m_simpleCommand;



	CommitMessagesCache m_commitMessagesCache;

protected:
	void OnSettings(wxCommandEvent &event);

public:
	void EditSettings();
................................................................................
protected:

	///////////////////////////////////////////////////////////
	// File Explorer event handlers
	///////////////////////////////////////////////////////////
	void OnCommit           (wxCommandEvent &event);
	void OnUpdate           (wxCommandEvent &event);

	void OnDelete           (wxCommandEvent &event);








	void OnSelectAsView     (wxCommandEvent &event);
	void OnSwitchURL        (wxCommandEvent &event);

	///////////////////////////////////////////////////////////
	// IDE events
	///////////////////////////////////////////////////////////
	void OnGetCompileLine   (wxCommandEvent &event);
................................................................................

	FossilView *GetFossilView() {
		return m_fossilView;
	}

	FossilSettingsData GetSettings();
	void            SetSettings(FossilSettingsData& fsd);
	wxString        GetFossilExeName();
	wxString        GetUserConfigDir();
	void            RecreateLocalFossilConfigFile();











	CommitMessagesCache& GetCommitMessagesCache() {
		return m_commitMessagesCache;
	}



	bool IsPathUnderFossil (const wxString &path);

protected:
	void DoInitialize();


	wxString DoGetFileExplorerItemFullPath();
	wxString DoGetFileExplorerItemPath();
};

#endif //Fossil

Changes to Fossil/fossil_console.cpp.

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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
...
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
...
343
344
345
346
347
348
349
350
		wxThread::Sleep(100);
		AppendText( message );
		m_process->Terminate();

	}
	delete ped;
}
////////////////////////////////////////////////////////////

void FossilConsole::EnsureVisible()
{
	// Make sure that the Output View pane is visible
	wxAuiPaneInfo &info = m_plugin->GetManager()->GetDockingManager()->GetPane(wxT("Output View"));
	if (info.IsOk() && !info.IsShown()) {
		info.Show();
		m_plugin->GetManager()->GetDockingManager()->Update();
	}

	// Select the Fossil tab
	wxBookCtrlBase *book = m_plugin->GetManager()->GetOutputPaneNotebook();

	for(size_t i=0; i<book->GetPageCount(); i++) {
		if(book->GetPage(i) == m_plugin->GetConsole()) {
			book->SetSelection(i);
		}
	}
}

void FossilConsole::AppendText(const wxString& text)
{
	m_sci->SetReadOnly(false);
	m_sci->SetSelectionEnd(m_sci->GetLength());
	m_sci->SetSelectionStart(m_sci->GetLength());
	m_sci->SetCurrentPos(m_sci->GetLength());

	wxString noPasswordText(text);

	int where = noPasswordText.Find(wxT("--password "));
	if(where != wxNOT_FOUND) {
		where += wxStrlen(wxT("--password "));
		wxString password = noPasswordText.Mid(where);
		password = password.BeforeFirst(wxT(' '));

		noPasswordText.Replace(password, wxT("******"));
	}

	m_sci->AppendText(noPasswordText);

	m_sci->SetSelectionEnd(m_sci->GetLength());
	m_sci->SetSelectionStart(m_sci->GetLength());
	m_sci->SetCurrentPos(m_sci->GetLength());
	m_sci->EnsureCaretVisible();
	m_sci->SetReadOnly(true);
}

void FossilConsole::Clear()
{
	m_sci->SetReadOnly(false);
	m_sci->ClearAll();
	m_sci->SetReadOnly(true);
}

void FossilConsole::OnProcessEnd(wxCommandEvent& event)
{
	ProcessEventData *ped = (ProcessEventData *)event.GetClientData();
	delete ped;

	if ( m_process ) {
................................................................................
		m_handler = NULL;
	}

	m_workingDirectory.Clear();
	m_url.Clear();
}

#if 0

bool FossilConsole::ExecuteURL(const wxString& cmd, const wxString& url, FossilCommandHandler* handler, bool printProcessOutput)
{
	if(!DoExecute(cmd, handler, wxT(""), printProcessOutput))
		return false;

	m_url = url;
	return true;
................................................................................
	if (!m_process) {
		AppendText(wxT("Failed to launch Fossil client.\n"));
		return false;
	}
	return true;
}

#endif







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







<
<







 







<
114
115
116
117
118
119
120






















































121
122
123
124
125
126
127
...
156
157
158
159
160
161
162


163
164
165
166
167
168
169
...
287
288
289
290
291
292
293

		wxThread::Sleep(100);
		AppendText( message );
		m_process->Terminate();

	}
	delete ped;
}























































void FossilConsole::OnProcessEnd(wxCommandEvent& event)
{
	ProcessEventData *ped = (ProcessEventData *)event.GetClientData();
	delete ped;

	if ( m_process ) {
................................................................................
		m_handler = NULL;
	}

	m_workingDirectory.Clear();
	m_url.Clear();
}



bool FossilConsole::ExecuteURL(const wxString& cmd, const wxString& url, FossilCommandHandler* handler, bool printProcessOutput)
{
	if(!DoExecute(cmd, handler, wxT(""), printProcessOutput))
		return false;

	m_url = url;
	return true;
................................................................................
	if (!m_process) {
		AppendText(wxT("Failed to launch Fossil client.\n"));
		return false;
	}
	return true;
}


Changes to Fossil/fossil_console.h.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	wxString           m_url;

protected:
	DECLARE_EVENT_TABLE()
	virtual void OnReadProcessOutput(wxCommandEvent& event);
	virtual void OnProcessEnd       (wxCommandEvent& event);
	
	//bool DoExecute(const wxString &cmd, FossilCommandHandler *handler, const wxString &workingDirectory, bool printProcessOutput);
public:
	FossilConsole(wxWindow *parent, Fossil* plugin);
	virtual ~FossilConsole();

	bool Execute(const wxString &cmd, const wxString &workingDirectory, FossilCommandHandler *handler, bool printProcessOutput = true);
	//bool ExecuteURL(const wxString &cmd, const wxString &url, FossilCommandHandler *handler, bool printProcessOutput = true);
	void Clear  ();
	void Stop   ();
	void AppendText(const wxString &text);
	bool IsRunning();
	bool IsEmpty();
	void EnsureVisible();

};
#endif // FOSSILSHELL_H







|





|









18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
	wxString           m_url;

protected:
	DECLARE_EVENT_TABLE()
	virtual void OnReadProcessOutput(wxCommandEvent& event);
	virtual void OnProcessEnd       (wxCommandEvent& event);
	
	bool DoExecute(const wxString &cmd, FossilCommandHandler *handler, const wxString &workingDirectory, bool printProcessOutput);
public:
	FossilConsole(wxWindow *parent, Fossil* plugin);
	virtual ~FossilConsole();

	bool Execute(const wxString &cmd, const wxString &workingDirectory, FossilCommandHandler *handler, bool printProcessOutput = true);
	bool ExecuteURL(const wxString &cmd, const wxString &url, FossilCommandHandler *handler, bool printProcessOutput = true);
	void Clear  ();
	void Stop   ();
	void AppendText(const wxString &text);
	bool IsRunning();
	bool IsEmpty();
	void EnsureVisible();

};
#endif // FOSSILSHELL_H

Changes to Fossil/fossil_settings_dialog.cpp.

59
60
61
62
63
64
65
66


67
68
69
70
71
72
73
74
75
76
77
78
	fsd.SetExecutable(m_textCtrlFossilExecutable->GetValue());

	// Link Editor flag is not set via this dialog
	// so read its current value before adding the other
	// flags
	size_t flags(0);
	if(m_plugin->GetSettings().GetFlags() & FossilLinkEditor)
		flags = FossilLinkEditor;



	if (m_checkBoxUsePosixLocale->IsChecked()) {
		flags |= FossilUsePosixLocale;
	}

	fsd.SetFlags(flags);
	m_plugin->SetSettings( fsd );

	Workspace *workspace = m_plugin->GetManager()->GetWorkspace();
	if(m_plugin->GetManager()->IsWorkspaceOpen() && workspace) {
		wxXmlNode *fosnode = m_plugin->GetFossilView()->GetFosNode(workspace);
		XmlUtils::UpdateProperty(fosnode, wxT("repo"), m_textCtrlFileName->GetValue());







|
>
>
|



<







59
60
61
62
63
64
65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
	fsd.SetExecutable(m_textCtrlFossilExecutable->GetValue());

	// Link Editor flag is not set via this dialog
	// so read its current value before adding the other
	// flags
	size_t flags(0);
	if(m_plugin->GetSettings().GetFlags() & FossilLinkEditor)
		flags |= FossilLinkEditor;
	if (m_checkBoxAddToFossil->IsChecked()) {
		flags |= FossilAddFileToFossil;
	}
	if (m_checkBoxUsePosixLocale->IsChecked()) {
		flags |= FossilUsePosixLocale;
	}

	fsd.SetFlags(flags);
	m_plugin->SetSettings( fsd );

	Workspace *workspace = m_plugin->GetManager()->GetWorkspace();
	if(m_plugin->GetManager()->IsWorkspaceOpen() && workspace) {
		wxXmlNode *fosnode = m_plugin->GetFossilView()->GetFosNode(workspace);
		XmlUtils::UpdateProperty(fosnode, wxT("repo"), m_textCtrlFileName->GetValue());

Changes to Fossil/fossil_ui.cpp.

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

304
305



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
	fgSizer1->AddGrowableCol( 1 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	m_staticTextExe = new wxStaticText( this, wxID_ANY, _("Executable:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticTextExe->Wrap( -1 );
	fgSizer1->Add( m_staticTextExe, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_textCtrlFossilExecutable = new wxTextCtrl( this, wxID_ANY, _("fossil"), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer1->Add( m_textCtrlFossilExecutable, 0, wxALL|wxEXPAND, 5 );
	
	m_buttonBrowse1 = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer1->Add( m_buttonBrowse1, 0, wxALL, 5 );

	m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("Repository File Path:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText1->Wrap( -1 );
	fgSizer1->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_textCtrlFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_textCtrlFileName->SetToolTip( wxT("Select the path to the file containing the template header to be prepended to the source files") );
	m_textCtrlFileName->SetMinSize( wxSize( 300,-1 ) );
	
	fgSizer1->Add( m_textCtrlFileName, 0, wxALL|wxEXPAND, 5 );
	
	m_buttonBrowse2 = new wxButton( this, wxID_ANY, wxT("..."), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer1->Add( m_buttonBrowse2, 0, wxALL, 5 );
	
	m_staticText2 = new wxStaticText( this, wxID_ANY, wxT("File Masking:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText2->Wrap( -1 );
	fgSizer1->Add( m_staticText2, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	
	m_textCtrlFileMaksing = new wxTextCtrl( this, wxID_ANY, wxT("*.hpp;*.h;*.hxx;*.inl;*.h++"), wxDefaultPosition, wxDefaultSize, 0 );



	fgSizer1->Add( m_textCtrlFileMaksing, 0, wxALL|wxEXPAND, 5 );
	fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );

	m_checkBoxUsePosixLocale = new wxCheckBox( this, wxID_ANY, wxT("Use POSIX Locale"), wxDefaultPosition, wxDefaultSize, 0 );
	m_checkBoxUsePosixLocale->SetValue(true);
	
	fgSizer1->Add( m_checkBoxUsePosixLocale, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	
	fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
	
	bSizer1->Add( fgSizer1, 0, wxEXPAND|wxALL, 5 );
	
	m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	bSizer1->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
	
	wxBoxSizer* bSizer2;
	bSizer2 = new wxBoxSizer( wxHORIZONTAL );
	







<


<






<



<

<


|
<
<
<
>
|
<
>
>
>
|
<
<

|
<
|

<
<
<
|







274
275
276
277
278
279
280

281
282

283
284
285
286
287
288

289
290
291

292

293
294
295



296
297

298
299
300
301


302
303

304
305



306
307
308
309
310
311
312
313
	fgSizer1->AddGrowableCol( 1 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );

	m_staticTextExe = new wxStaticText( this, wxID_ANY, _("Executable:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticTextExe->Wrap( -1 );
	fgSizer1->Add( m_staticTextExe, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	m_textCtrlFossilExecutable = new wxTextCtrl( this, wxID_ANY, _("fossil"), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer1->Add( m_textCtrlFossilExecutable, 0, wxALL|wxEXPAND, 5 );

	m_buttonBrowse1 = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer1->Add( m_buttonBrowse1, 0, wxALL, 5 );

	m_staticText1 = new wxStaticText( this, wxID_ANY, wxT("Repository File Path:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText1->Wrap( -1 );
	fgSizer1->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

	m_textCtrlFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_textCtrlFileName->SetToolTip( wxT("Select the path to the file containing the template header to be prepended to the source files") );
	m_textCtrlFileName->SetMinSize( wxSize( 300,-1 ) );

	fgSizer1->Add( m_textCtrlFileName, 0, wxALL|wxEXPAND, 5 );

	m_buttonBrowse2 = new wxButton( this, wxID_ANY, wxT("..."), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer1->Add( m_buttonBrowse2, 0, wxALL, 5 );




	bSizer1->Add( fgSizer1, 0, wxEXPAND|wxALL, 5 );


	wxStaticBoxSizer* sbSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
	m_checkBoxAddToFossil = new wxCheckBox( this, wxID_ANY, wxT("When adding file(s) to project, add it to svn as well"), wxDefaultPosition, wxDefaultSize, 0 );
	m_checkBoxAddToFossil->SetValue(true);
	sbSizer->Add( m_checkBoxAddToFossil, 0, wxALL|wxEXPAND, 5 );


	m_checkBoxUsePosixLocale = new wxCheckBox( this, wxID_ANY, wxT("Use POSIX Locale"), wxDefaultPosition, wxDefaultSize, 0 );
	m_checkBoxUsePosixLocale->SetValue(true);	

	sbSizer->Add( m_checkBoxUsePosixLocale, 0, wxALL|wxEXPAND, 5 );	
	



	bSizer1->Add( sbSizer, 0, wxEXPAND|wxALL, 5 );
	
	m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	bSizer1->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
	
	wxBoxSizer* bSizer2;
	bSizer2 = new wxBoxSizer( wxHORIZONTAL );
	

Changes to Fossil/fossil_ui.h.

171
172
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
	protected:
		wxStaticText* m_staticText1;
		wxStaticText* m_staticTextExe;
		wxTextCtrl* m_textCtrlFileName;
		wxTextCtrl* m_textCtrlFossilExecutable;
		wxButton* m_buttonBrowse1;
		wxButton* m_buttonBrowse2;
		wxStaticText* m_staticText2;
		wxTextCtrl* m_textCtrlFileMaksing;


		wxCheckBox* m_checkBoxUsePosixLocale;
		
		wxStaticLine* m_staticline2;
		wxButton* m_buttonSave;
		wxButton* m_buttonCancel;
		
		// Virtual event handlers, overide them in your derived class







<
<

>







171
172
173
174
175
176
177


178
179
180
181
182
183
184
185
186
	protected:
		wxStaticText* m_staticText1;
		wxStaticText* m_staticTextExe;
		wxTextCtrl* m_textCtrlFileName;
		wxTextCtrl* m_textCtrlFossilExecutable;
		wxButton* m_buttonBrowse1;
		wxButton* m_buttonBrowse2;



		wxCheckBox* m_checkBoxAddToFossil;
		wxCheckBox* m_checkBoxUsePosixLocale;
		
		wxStaticLine* m_staticline2;
		wxButton* m_buttonSave;
		wxButton* m_buttonCancel;
		
		// Virtual event handlers, overide them in your derived class

Changes to Fossil/fossil_view.cpp.

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
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

176
177
178
179
180
181
182

183
184
185
186
187
188
189
...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271













272












273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
...
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
...
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
...
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
...
499
500
501
502
503
504
505















506
507
508
509
510
511
512
...
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
...
743
744
745
746
747
748
749

750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
...
773
774
775
776
777
778
779





780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806

807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829

830
831
832
833
834
835
836
837
838
839
840
841

842
843
844
845
846
847
848
...
867
868
869
870
871
872
873

874
875
876
877
878
879
880
881
882
883
884

885
886
887
888
889
890
891
...
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
...
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "plugin.h"
#include "procutils.h"
#include "xmlutils.h"
#include "fossil_login_dialog.h"
//#include "fossil_command_handlers.h"
//#include "fossil_copy_dialog.h"
#include "commit_dialog.h"
//#include "fossil_default_command_handler.h"
#include <wx/menu.h>
#include <wx/dirdlg.h>
#include "fileextmanager.h"
#include "fossilsettingsdata.h"
#include "fossilstatushandler.h"
#include <wx/wupdlock.h>
#include "fossil_strings.h"
#include "fossil_view.h"
#include <wx/xrc/xmlres.h>

#include "fossiltreedata.h"
#include <wx/imaglist.h>
#include "imanager.h"
#include "workspace.h"
#include "fossil.h"
#include "fossil_console.h"
#include "globals.h"

BEGIN_EVENT_TABLE(FossilView, FossilPageBase)
/*
	EVT_UPDATE_UI(XRCID("fossil_stop"),         FossilView::OnStopUI)
	EVT_UPDATE_UI(XRCID("clear_fossil_output"), FossilView::OnClearOuptutUI)

	EVT_MENU(XRCID("fossil_link_editor"),        FossilView::OnLinkEditor)

	EVT_MENU(XRCID("fossil_commit"),             FossilView::OnCommit)
	EVT_MENU(XRCID("fossil_update"),             FossilView::OnUpdate)
	EVT_MENU(XRCID("fossil_revert"),             FossilView::OnRevert)
	EVT_MENU(XRCID("fossil_tag"),                FossilView::OnTag)
	EVT_MENU(XRCID("fossil_branch"),             FossilView::OnBranch)
	EVT_MENU(XRCID("fossil_diff"),               FossilView::OnDiff)
	EVT_MENU(XRCID("fossil_patch"),              FossilView::OnPatch)
	EVT_MENU(XRCID("fossil_patch_dry_run"),      FossilView::OnPatchDryRun)
	EVT_MENU(XRCID("fossil_resolve"),            FossilView::OnResolve)
	EVT_MENU(XRCID("fossil_add"),                FossilView::OnAdd)
	EVT_MENU(XRCID("fossil_delete"),             FossilView::OnDelete)
	EVT_MENU(XRCID("fossil_ignore_file"),        FossilView::OnIgnoreFile)
	EVT_MENU(XRCID("fossil_ignore_file_pattern"),FossilView::OnIgnoreFilePattern)
	EVT_MENU(XRCID("fossil_blame"),              FossilView::OnBlame)
	EVT_MENU(XRCID("fossil_checkout"),           FossilView::OnCheckout)
*/

	EVT_MENU(XRCID("fossil_open_file"),          FossilView::OnOpenFile)
	EVT_MENU(XRCID("fossil_switch"),             FossilView::OnSwitch)
END_EVENT_TABLE()

FossilView::FossilView( wxWindow* parent, Fossil *plugin )
	: FossilPageBase( parent )
	, m_plugin          ( plugin )

	, m_simpleCommand   ( plugin )
	//, m_diffCommand     ( plugin )
{
	CreateGUIControls();
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_WORKSPACE_LOADED,      wxCommandEventHandler(FossilView::OnWorkspaceLoaded),     NULL, this);
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_WORKSPACE_CLOSED,      wxCommandEventHandler(FossilView::OnWorkspaceClosed),     NULL, this);
/*
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_FILE_SAVED,            wxCommandEventHandler(FossilView::OnRefreshView),         NULL, this);
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_PROJ_FILE_ADDED,       wxCommandEventHandler(FossilView::OnFileAdded  ),         NULL, this);
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_FILE_RENAMED,          wxCommandEventHandler(FossilView::OnFileRenamed),         NULL, this);
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_ACTIVE_EDITOR_CHANGED, wxCommandEventHandler(FossilView::OnActiveEditorChanged), NULL, this);
*/
}

FossilView::~FossilView()
{
}

void FossilView::OnChangeRootDir( wxCommandEvent& event )
................................................................................
		}
		BuildTree();
	}
}

void FossilView::OnTreeMenu( wxTreeEvent& event )
{
/*
	// Popup the menu
	wxArrayTreeItemIds items;
	size_t count = m_treeCtrl->GetSelections(items);
	if (count) {
		FossilTreeData::FossilNodeType type = DoGetSelectionType(items);
		if (type == FossilTreeData::FossilNodeTypeInvalid)
			// Mix or an invalid selection
................................................................................

		default:
			return;
		}

		PopupMenu( &menu );
	}
*/
}

void FossilView::CreateGUIControls()
{
	// Assign the image list
	wxImageList *imageList = new wxImageList(16, 16, true);

................................................................................
	tb->ToggleTool(XRCID("fossil_link_editor"), m_plugin->GetSettings().GetFlags() & FossilLinkEditor);

	tb->AddTool(XRCID("clear_fossil_output"), wxT("Clear Fossil Output Tab"), wxXmlResource::Get()->LoadBitmap(wxT("document_delete")), wxT("Clear Fossil Output Tab"), wxITEM_NORMAL);
	tb->AddTool(XRCID("fossil_refresh"),      wxT("Refresh View"), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_refresh" ) ), wxT ( "Refresh View" ) );
	tb->AddSeparator();

	tb->AddTool(XRCID("fossil_stop"),         wxT("Stop current fossil process"), wxXmlResource::Get()->LoadBitmap ( wxT ( "stop_build16" ) ), wxT ( "Stop current fossil process" ) );
	tb->AddTool(XRCID("fossil_cleanup"),      wxT("Fossil Cleanup"), wxXmlResource::Get()->LoadBitmap ( wxT ( "eraser" ) ), wxT ( "Fossil Cleanup" ) );

	tb->AddSeparator();
	tb->AddTool(XRCID("fossil_checkout"),         wxT("Fossil Checkout"), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_checkout" ) ), wxT ( "Fossil Checkout" ) );

	tb->AddSeparator();
	tb->AddTool(XRCID("fossil_settings"),     wxT("Fossil Settings..."), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_settings" ) ), wxT ( "Fossil Settings..." ) );
	tb->AddTool(XRCID("fossil_info"),         wxT("Fossil Info"), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_info" ) ), wxT ( "Fossil Info" ) );
/*

	tb->Connect(XRCID("clear_fossil_output"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnClearOuptut), NULL, this);
	tb->Connect(XRCID("fossil_stop"),         wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnStop),        NULL, this);
	tb->Connect(XRCID("fossil_cleanup"),      wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnCleanup),     NULL, this);
	tb->Connect(XRCID("fossil_info"),         wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnShowFossilInfo), NULL, this);
	tb->Connect(XRCID("fossil_refresh"),      wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnRefreshView), NULL, this);
	tb->Connect(XRCID("fossil_settings"),     wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnSettings),    NULL, this);
*/

	wxSizer *sz = GetSizer();
	sz->Insert(0, tb, 0, wxEXPAND);
	tb->Realize();

	if (m_plugin->GetManager()->IsWorkspaceOpen()) {
		m_textCtrlRootDir->SetValue(m_plugin->GetManager()->GetWorkspace()->GetWorkspaceFileName().GetPath());
	}
................................................................................
}

void FossilView::ClearAll()
{
	m_treeCtrl->DeleteAllItems();
}

void FossilView::UpdateTree(const wxArrayString& theFiles)
{

	wxWindowUpdateLocker locker( m_treeCtrl );
	ClearAll();

	// Add root node
	wxString rootDir = m_textCtrlRootDir->GetValue();
	wxTreeItemId root = m_treeCtrl->AddRoot(rootDir, 0, 0, new FossilTreeData(FossilTreeData::FossilNodeTypeRoot, rootDir));

	if(root.IsOk() == false)
		return;














	DoAddNode(fossilMODIFIED_FILES, 6, FossilTreeData::FossilNodeTypeModifiedRoot, theFiles);













	if (m_treeCtrl->ItemHasChildren(root)) {
		m_treeCtrl->Expand(root);
	}
	DoLinkEditor();
}

void FossilView::DoAddNode(const wxString& title, int imgId, FossilTreeData::FossilNodeType nodeType, const wxArrayString& files)
{
	wxTreeItemId root = m_treeCtrl->GetRootItem();
	wxString basePath = m_textCtrlRootDir->GetValue();

	// Add the basic four root items
	if (files.IsEmpty() == false) {

		wxTreeItemId parent = m_treeCtrl->AppendItem(root, title, imgId, imgId, new FossilTreeData(nodeType, wxT("")));

		// Set the parent node with bold font
		wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
		font.SetWeight(wxBOLD);
................................................................................
		m_treeCtrl->SetItemFont(parent, font);

		// Add all children items
		for (size_t i=0; i<files.GetCount(); i++) {
			wxString filename(files.Item(i));
			m_treeCtrl->AppendItem(parent, files.Item(i), DoGetIconIndex(filename), DoGetIconIndex(filename), new FossilTreeData(FossilTreeData::FossilNodeTypeFile, files.Item(i)));
		}

		if ( nodeType != FossilTreeData::FossilNodeTypeUnversionedRoot) {
			m_treeCtrl->Expand(parent);
		}
	}
}

int FossilView::DoGetIconIndex(const wxString& filename)
{
	FileExtManager::Init();
	FileExtManager::FileType type = FileExtManager::GetType(filename);
................................................................................
	menu->Append(XRCID("fossil_revert"),  wxT("Revert"));
	menu->AppendSeparator();
	menu->Append(XRCID("fossil_diff"),    wxT("Create Diff..."));
}

void FossilView::CreateFileMenu(wxMenu* menu)
{
	menu->Append(XRCID("fossil_open_file"),  wxT("Open File..."));
	menu->AppendSeparator();
	menu->Append(XRCID("fossil_commit"),  wxT("Commit"));
	menu->Append(XRCID("fossil_update"),  wxT("Update"));
	menu->AppendSeparator();
	menu->Append(XRCID("fossil_revert"),  wxT("Revert"));
	menu->AppendSeparator();
	menu->Append(XRCID("fossil_add"),     wxT("Add"));
	menu->Append(XRCID("fossil_delete"),  wxT("Delete"));
	menu->AppendSeparator();
	menu->Append(XRCID("fossil_resolve"), wxT("Resolve"));
	menu->AppendSeparator();
	menu->Append(XRCID("fossil_diff"),    wxT("Create Diff..."));
	menu->AppendSeparator();

	menu->Append(XRCID("fossil_blame"),    wxT("Blame..."));
	menu->AppendSeparator();

	wxMenu *subMenu;
	subMenu = new wxMenu;
	subMenu->Append(XRCID("fossil_ignore_file"),         wxT("Ignore this file"));
	subMenu->Append(XRCID("fossil_ignore_file_pattern"), wxT("Ignore this file pattern"));
	menu->Append(wxID_ANY, wxT("Ignore"), subMenu);
}

void FossilView::CreateRootMenu(wxMenu* menu)
{
	menu->Append(XRCID("fossil_commit"),        wxT("Commit"));
	menu->Append(XRCID("fossil_update"),        wxT("Update"));
	menu->AppendSeparator();
................................................................................
	menu->AppendSeparator();

	menu->Append(XRCID("fossil_tag"),           wxT("Create Tag"));
	menu->Append(XRCID("fossil_branch"),        wxT("Create Branch"));
	menu->AppendSeparator();

	menu->Append(XRCID("fossil_switch"),   wxT("Switch URL..."));
	menu->AppendSeparator();

	menu->Append(XRCID("fossil_diff"),          wxT("Create Diff..."));
	menu->Append(XRCID("fossil_patch"),         wxT("Apply Patch..."));
	menu->Append(XRCID("fossil_patch_dry_run"), wxT("Apply Patch - Dry Run..."));
}

void FossilView::DoGetPaths(const wxTreeItemId& parent, wxArrayString& paths)
{
	if ( m_treeCtrl->ItemHasChildren(parent) == false ) {
		return;
	}
................................................................................
		item = m_treeCtrl->GetNextChild(parent, cookie);
	}
}

////////////////////////////////////////////
// Source control command handlers
////////////////////////////////////////////
















#if 0

void FossilView::OnUpdate(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;
................................................................................
		        << dlg.GetMessage()
		        << wxT("\"");

		m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultCommandHandler(m_plugin, event.GetId(), this));
	}
}

void FossilView::OnDelete(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;
	if(m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString) == false) {
		return;
	}
	bool nonInteractive = m_plugin->GetNonInteractiveMode(event);
	command << m_plugin->GetFossilExeName(nonInteractive) << loginString << wxT(" --force delete ");

	// Concatenate list of files to be updated
	for (size_t i=0; i<m_selectionInfo.m_paths.GetCount(); i++) {
		command << wxT("\"") << m_selectionInfo.m_paths.Item(i) << wxT("\" ");
	}

	m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultCommandHandler(m_plugin, event.GetId(), this));
}

void FossilView::OnResolve(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;
	if(m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString) == false) {
		return;
	}
................................................................................
	m_plugin->Patch(false, m_textCtrlRootDir->GetValue(), this, event.GetId());
}

void FossilView::OnPatchDryRun(wxCommandEvent& event)
{
	m_plugin->Patch(true, m_textCtrlRootDir->GetValue(), this, event.GetId());
}


void FossilView::OnCleanup(wxCommandEvent& event)
{
	wxUnusedVar(event);
	wxString command;
	command << m_plugin->GetFossilExeName(false) << wxT(" cleanup ");
	m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultCommandHandler(m_plugin, wxNOT_FOUND, NULL));
}

void FossilView::OnStop(wxCommandEvent& event)
{
	wxUnusedVar(event);
	m_plugin->GetConsole()->Stop();
}

void FossilView::OnClearOuptut(wxCommandEvent& event)
{
	wxUnusedVar(event);
	m_plugin->GetConsole()->Clear();
}

void FossilView::OnRefreshView(wxCommandEvent& event)
{
................................................................................
	event.Skip();
	BuildTree();
}

void FossilView::OnFileAdded(wxCommandEvent& event)
{
	event.Skip();





	FossilSettingsData fsd = m_plugin->GetSettings();
	if(fsd.GetFlags() & FossilAddFileToFossil) {
		wxArrayString *files = (wxArrayString*)event.GetClientData();
		if(files) {
			bool     addToFossil(false);
			wxString command;
			command << m_plugin->GetFossilExeName() << wxT(" add ");
			for(size_t i=0; i<files->GetCount(); i++) {

				if(m_plugin->IsPathUnderFossil(files->Item(i))) {
					command << wxT("\"") << files->Item(i) << wxT("\" ");
					addToFossil = true;
				}

			}

			if(addToFossil) {
				command.RemoveLast();
				m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultCommandHandler(m_plugin, event.GetId(), this));
			}
		}
	}
}

void FossilView::OnFileRenamed(wxCommandEvent& event)
{
	wxArrayString *files = (wxArrayString*)event.GetClientData();


	// If the Fossil Client Version is set to 0.0 it means that we dont have FOSSIL client installed
	if( m_plugin->GetFossilClientVersion() && files && (m_plugin->GetSettings().GetFlags() & FossilRenameFileInRepo) ) {
		wxString oldName = files->Item(0);
		wxString newName = files->Item(1);

		if(m_plugin->IsPathUnderFossil(oldName) == false) {
			event.Skip();
			return;
		}

		wxString command;
		command << m_plugin->GetFossilExeName() << wxT(" rename \"") << oldName << wxT("\" \"") << newName << wxT("\"");
		m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultCommandHandler(m_plugin, event.GetId(), this));

	} else
		event.Skip();
}

void FossilView::OnShowFossilInfo(wxCommandEvent& event)
{
	wxUnusedVar(event);


	FossilInfo fossilInfo;
	m_plugin->DoGetFossilInfoSync(fossilInfo, m_textCtrlRootDir->GetValue());

	FossilInfoDialog dlg(m_plugin->GetManager()->GetTheApp()->GetTopWindow());
	dlg.m_textCtrlAuthor->SetValue( fossilInfo.m_author );
	dlg.m_textCtrlDate->SetValue( fossilInfo.m_date );
	dlg.m_textCtrlRevision->SetValue( fossilInfo.m_revision );
	dlg.m_textCtrlRootURL->SetValue( fossilInfo.m_url );
	dlg.m_textCtrlURL->SetValue( fossilInfo.m_sourceUrl );
	dlg.ShowModal();
}


void FossilView::OnItemActivated(wxTreeEvent& event)
{
	wxArrayTreeItemIds items;
	wxArrayString      paths;
	size_t count = m_treeCtrl->GetSelections(items);
	for(size_t i=0; i<count; i++) {
		wxTreeItemId item = items.Item(i);
................................................................................
	wxString command;
	command << m_plugin->GetFossilExeName(nonInteractive) << loginString << wxT(" diff -r") << diffAgainst << wxT(" ");
	for (size_t i=0; i<paths.GetCount(); i++) {
		command << wxT("\"") << paths.Item(i) << wxT("\" ");
	}
	m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDiffHandler(m_plugin, event.GetId(), this), false);
}


void FossilView::OnStopUI(wxUpdateUIEvent& event)
{
	event.Enable(m_plugin->GetConsole()->IsRunning());
}

void FossilView::OnClearOuptutUI(wxUpdateUIEvent& event)
{
	event.Enable(m_plugin->GetConsole()->IsEmpty() == false);
}


void FossilView::OnCheckout(wxCommandEvent& event)
{
	wxString loginString;
	if(!m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString))
		return;

	wxString command;
................................................................................

void FossilView::OnIgnoreFilePattern(wxCommandEvent& event)
{
	wxUnusedVar(event);
	m_plugin->IgnoreFiles(m_selectionInfo.m_paths, true);
}

void FossilView::OnSettings(wxCommandEvent& event)
{
	wxUnusedVar(event);
	m_plugin->EditSettings();
}

void FossilView::OnBlame(wxCommandEvent& event)
{
	m_plugin->Blame(event, m_selectionInfo.m_paths);
}

#endif

................................................................................
	DoLinkEditor();
}

void FossilView::DisconnectEvents()
{
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_WORKSPACE_LOADED, wxCommandEventHandler(FossilView::OnWorkspaceLoaded),          NULL, this);
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_WORKSPACE_CLOSED, wxCommandEventHandler(FossilView::OnWorkspaceClosed),          NULL, this);
/*
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_FILE_SAVED,       wxCommandEventHandler(FossilView::OnRefreshView),              NULL, this);
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_PROJ_FILE_ADDED,  wxCommandEventHandler(FossilView::OnFileAdded),                NULL, this);
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_FILE_RENAMED,     wxCommandEventHandler(FossilView::OnFileRenamed),              NULL, this);
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_ACTIVE_EDITOR_CHANGED, wxCommandEventHandler(FossilView::OnActiveEditorChanged), NULL, this);
*/
}

void FossilView::OnOpenFile(wxCommandEvent& event)
{
	wxUnusedVar(event);

	wxArrayTreeItemIds items;







|









>









<

|
<

>










<
<
<
<
<

>







>

<


|
|
<
|
|
|

<







 







<







 







<







 







|






|
<
>
|

|
<

|
<
>







 







|












>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>










<

|







 







<
<
<
<







 







|
|
|
|
|
|
|
|


<
<
<
<
<
<
<
<
<
<
<
<
<







 







<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>

|



|
|








|







 







>
>
>
>
>








|









|








>

<
|










|








<
>
|
|
|
<
<
<
<
<
<
<
|
<
>







 







>






|




>







 







<
<
<
<
<
<







 







<




<







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
..
84
85
86
87
88
89
90

91
92
93
94
95
96
97
...
115
116
117
118
119
120
121

122
123
124
125
126
127
128
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

167
168
169
170

171
172

173
174
175
176
177
178
179
180
...
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298

299
300
301
302
303
304
305
306
307
...
308
309
310
311
312
313
314




315
316
317
318
319
320
321
...
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449













450
451
452
453
454
455
456
...
459
460
461
462
463
464
465





466
467
468
469
470
471
472
...
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
...
677
678
679
680
681
682
683


















684
685
686
687
688
689
690
...
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
...
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804

805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824

825
826
827
828







829

830
831
832
833
834
835
836
837
...
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
...
897
898
899
900
901
902
903






904
905
906
907
908
909
910
...
966
967
968
969
970
971
972

973
974
975
976

977
978
979
980
981
982
983
#include "plugin.h"
#include "procutils.h"
#include "xmlutils.h"
#include "fossil_login_dialog.h"
//#include "fossil_command_handlers.h"
//#include "fossil_copy_dialog.h"
#include "commit_dialog.h"
#include "fossildefaulthandler.h"
#include <wx/menu.h>
#include <wx/dirdlg.h>
#include "fileextmanager.h"
#include "fossilsettingsdata.h"
#include "fossilstatushandler.h"
#include <wx/wupdlock.h>
#include "fossil_strings.h"
#include "fossil_view.h"
#include <wx/xrc/xmlres.h>
#include <wx/tokenzr.h>
#include "fossiltreedata.h"
#include <wx/imaglist.h>
#include "imanager.h"
#include "workspace.h"
#include "fossil.h"
#include "fossil_console.h"
#include "globals.h"

BEGIN_EVENT_TABLE(FossilView, FossilPageBase)

	EVT_UPDATE_UI(XRCID("fossil_stop"),         FossilView::OnStopUI)
	EVT_UPDATE_UI(XRCID("clear_fossil_output"), FossilView::OnClearOutputUI)

	EVT_MENU(XRCID("fossil_link_editor"),        FossilView::OnLinkEditor)
/*
	EVT_MENU(XRCID("fossil_commit"),             FossilView::OnCommit)
	EVT_MENU(XRCID("fossil_update"),             FossilView::OnUpdate)
	EVT_MENU(XRCID("fossil_revert"),             FossilView::OnRevert)
	EVT_MENU(XRCID("fossil_tag"),                FossilView::OnTag)
	EVT_MENU(XRCID("fossil_branch"),             FossilView::OnBranch)
	EVT_MENU(XRCID("fossil_diff"),               FossilView::OnDiff)
	EVT_MENU(XRCID("fossil_patch"),              FossilView::OnPatch)
	EVT_MENU(XRCID("fossil_patch_dry_run"),      FossilView::OnPatchDryRun)
	EVT_MENU(XRCID("fossil_resolve"),            FossilView::OnResolve)
	EVT_MENU(XRCID("fossil_add"),                FossilView::OnAdd)





*/
	EVT_MENU(XRCID("fossil_delete"),             FossilView::OnDelete)
	EVT_MENU(XRCID("fossil_open_file"),          FossilView::OnOpenFile)
	EVT_MENU(XRCID("fossil_switch"),             FossilView::OnSwitch)
END_EVENT_TABLE()

FossilView::FossilView( wxWindow* parent, Fossil *plugin )
	: FossilPageBase( parent )
	, m_plugin          ( plugin )
	, m_renflag			(false)
	, m_simpleCommand   ( plugin )

{
	CreateGUIControls();
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_WORKSPACE_LOADED,      wxCommandEventHandler(FossilView::OnWorkspaceLoaded), NULL, this);
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_WORKSPACE_CLOSED,      wxCommandEventHandler(FossilView::OnWorkspaceClosed), NULL, this);

	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_FILE_SAVED,            wxCommandEventHandler(FossilView::OnRefreshView),		NULL, this);
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_PROJ_FILE_ADDED,       wxCommandEventHandler(FossilView::OnFileAdded  ), 	NULL, this);
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_FILE_RENAMED,          wxCommandEventHandler(FossilView::OnFileRenamed),  	NULL, this);
	m_plugin->GetManager()->GetTheApp()->Connect(wxEVT_ACTIVE_EDITOR_CHANGED, wxCommandEventHandler(FossilView::OnActiveEditorChanged), NULL, this);

}

FossilView::~FossilView()
{
}

void FossilView::OnChangeRootDir( wxCommandEvent& event )
................................................................................
		}
		BuildTree();
	}
}

void FossilView::OnTreeMenu( wxTreeEvent& event )
{

	// Popup the menu
	wxArrayTreeItemIds items;
	size_t count = m_treeCtrl->GetSelections(items);
	if (count) {
		FossilTreeData::FossilNodeType type = DoGetSelectionType(items);
		if (type == FossilTreeData::FossilNodeTypeInvalid)
			// Mix or an invalid selection
................................................................................

		default:
			return;
		}

		PopupMenu( &menu );
	}

}

void FossilView::CreateGUIControls()
{
	// Assign the image list
	wxImageList *imageList = new wxImageList(16, 16, true);

................................................................................
	tb->ToggleTool(XRCID("fossil_link_editor"), m_plugin->GetSettings().GetFlags() & FossilLinkEditor);

	tb->AddTool(XRCID("clear_fossil_output"), wxT("Clear Fossil Output Tab"), wxXmlResource::Get()->LoadBitmap(wxT("document_delete")), wxT("Clear Fossil Output Tab"), wxITEM_NORMAL);
	tb->AddTool(XRCID("fossil_refresh"),      wxT("Refresh View"), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_refresh" ) ), wxT ( "Refresh View" ) );
	tb->AddSeparator();

	tb->AddTool(XRCID("fossil_stop"),         wxT("Stop current fossil process"), wxXmlResource::Get()->LoadBitmap ( wxT ( "stop_build16" ) ), wxT ( "Stop current fossil process" ) );
	tb->AddTool(XRCID("fossil_extras"),      wxT("Show Extras"), wxXmlResource::Get()->LoadBitmap ( wxT ( "eraser" ) ), wxT ( "Show Extras" ) );

	tb->AddSeparator();
	tb->AddTool(XRCID("fossil_checkout"),         wxT("Fossil Checkout"), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_checkout" ) ), wxT ( "Fossil Checkout" ) );

	tb->AddSeparator();
	tb->AddTool(XRCID("fossil_settings"),     wxT("Fossil Settings..."), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_settings" ) ), wxT ( "Fossil Settings..." ) );
	tb->AddTool(XRCID("fossil_info"),         wxT("Fossil Status"), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_info" ) ), wxT ( "Fossil Status" ) );


	tb->Connect(XRCID("clear_fossil_output"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnClearOutput), NULL, this);
	tb->Connect(XRCID("fossil_stop"),         wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnStop),        NULL, this);
	tb->Connect(XRCID("fossil_extras"),      wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnExtras),     NULL, this);

	tb->Connect(XRCID("fossil_refresh"),      wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnRefreshView), NULL, this);
	tb->Connect(XRCID("fossil_info"),         wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FossilView::OnShowFossilInfo), NULL, this);


	wxSizer *sz = GetSizer();
	sz->Insert(0, tb, 0, wxEXPAND);
	tb->Realize();

	if (m_plugin->GetManager()->IsWorkspaceOpen()) {
		m_textCtrlRootDir->SetValue(m_plugin->GetManager()->GetWorkspace()->GetWorkspaceFileName().GetPath());
	}
................................................................................
}

void FossilView::ClearAll()
{
	m_treeCtrl->DeleteAllItems();
}

void FossilView::UpdateTree(const wxString& output)
{

	wxWindowUpdateLocker locker( m_treeCtrl );
	ClearAll();

	// Add root node
	wxString rootDir = m_textCtrlRootDir->GetValue();
	wxTreeItemId root = m_treeCtrl->AddRoot(rootDir, 0, 0, new FossilTreeData(FossilTreeData::FossilNodeTypeRoot, rootDir));

	if(root.IsOk() == false)
		return;

	wxArrayString dirFiles, plFiles;
	wxString folder, file, last = wxEmptyString;
	wxStringTokenizer tkz(output);

	while ( tkz.HasMoreTokens() )
	{
		wxString str = tkz.GetNextToken();
		if (str.Find(L'/') == wxNOT_FOUND)
			plFiles.Add(str);
		else {
			file = str.AfterFirst(L'/');
			folder = str.BeforeFirst(L'/');
			if (folder != last) {
				DoAddNode(last, 6, FossilTreeData::FossilNodeTypeAddedRoot, dirFiles);
				dirFiles.Empty();
			}
			dirFiles.Add(file);
			last = folder;
		}
	}
	DoAddNode(last, 6, FossilTreeData::FossilNodeTypeAddedRoot, dirFiles);
	// Add root items
	for (size_t i=0; i<plFiles.GetCount(); i++) {
		wxString filename(plFiles.Item(i));
		m_treeCtrl->AppendItem(root, plFiles.Item(i), DoGetIconIndex(filename), DoGetIconIndex(filename), new FossilTreeData(FossilTreeData::FossilNodeTypeFile, plFiles.Item(i)));
	}

	if (m_treeCtrl->ItemHasChildren(root)) {
		m_treeCtrl->Expand(root);
	}
	DoLinkEditor();
}

void FossilView::DoAddNode(const wxString& title, int imgId, FossilTreeData::FossilNodeType nodeType, const wxArrayString& files)
{
	wxTreeItemId root = m_treeCtrl->GetRootItem();


	// Add the dir items
	if (files.IsEmpty() == false) {

		wxTreeItemId parent = m_treeCtrl->AppendItem(root, title, imgId, imgId, new FossilTreeData(nodeType, wxT("")));

		// Set the parent node with bold font
		wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
		font.SetWeight(wxBOLD);
................................................................................
		m_treeCtrl->SetItemFont(parent, font);

		// Add all children items
		for (size_t i=0; i<files.GetCount(); i++) {
			wxString filename(files.Item(i));
			m_treeCtrl->AppendItem(parent, files.Item(i), DoGetIconIndex(filename), DoGetIconIndex(filename), new FossilTreeData(FossilTreeData::FossilNodeTypeFile, files.Item(i)));
		}




	}
}

int FossilView::DoGetIconIndex(const wxString& filename)
{
	FileExtManager::Init();
	FileExtManager::FileType type = FileExtManager::GetType(filename);
................................................................................
	menu->Append(XRCID("fossil_revert"),  wxT("Revert"));
	menu->AppendSeparator();
	menu->Append(XRCID("fossil_diff"),    wxT("Create Diff..."));
}

void FossilView::CreateFileMenu(wxMenu* menu)
{
	//menu->Append(XRCID("fossil_open_file"),  wxT("Open File..."));
	//menu->AppendSeparator();
	//menu->Append(XRCID("fossil_commit"),  wxT("Commit"));
	//menu->Append(XRCID("fossil_update"),  wxT("Update"));
	//menu->AppendSeparator();
	//menu->Append(XRCID("fossil_revert"),  wxT("Revert"));
	//menu->AppendSeparator();
	//menu->Append(XRCID("fossil_add"),     wxT("Add"));
	menu->Append(XRCID("fossil_delete"),  wxT("Delete"));
	menu->AppendSeparator();













}

void FossilView::CreateRootMenu(wxMenu* menu)
{
	menu->Append(XRCID("fossil_commit"),        wxT("Commit"));
	menu->Append(XRCID("fossil_update"),        wxT("Update"));
	menu->AppendSeparator();
................................................................................
	menu->AppendSeparator();

	menu->Append(XRCID("fossil_tag"),           wxT("Create Tag"));
	menu->Append(XRCID("fossil_branch"),        wxT("Create Branch"));
	menu->AppendSeparator();

	menu->Append(XRCID("fossil_switch"),   wxT("Switch URL..."));





}

void FossilView::DoGetPaths(const wxTreeItemId& parent, wxArrayString& paths)
{
	if ( m_treeCtrl->ItemHasChildren(parent) == false ) {
		return;
	}
................................................................................
		item = m_treeCtrl->GetNextChild(parent, cookie);
	}
}

////////////////////////////////////////////
// Source control command handlers
////////////////////////////////////////////

void FossilView::OnDelete(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;

	command << m_plugin->GetFossilExeName() << wxT(" delete ");

	// Concatenate list of files to be updated
	for (size_t i=0; i<m_selectionInfo.m_paths.GetCount(); i++) {
		command << wxT("\"") << m_selectionInfo.m_paths.Item(i) << wxT("\" ");
	}

	m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultHandler(m_plugin, event.GetId(), this));
}

#if 0

void FossilView::OnUpdate(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;
................................................................................
		        << dlg.GetMessage()
		        << wxT("\"");

		m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultCommandHandler(m_plugin, event.GetId(), this));
	}
}



















void FossilView::OnResolve(wxCommandEvent& event)
{
	wxString command;
	wxString loginString;
	if(m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString) == false) {
		return;
	}
................................................................................
	m_plugin->Patch(false, m_textCtrlRootDir->GetValue(), this, event.GetId());
}

void FossilView::OnPatchDryRun(wxCommandEvent& event)
{
	m_plugin->Patch(true, m_textCtrlRootDir->GetValue(), this, event.GetId());
}
#endif

void FossilView::OnExtras(wxCommandEvent& event)
{
	wxUnusedVar(event);
	wxString command;
	command << m_plugin->GetFossilExeName() << wxT(" extras ");
	m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultHandler(m_plugin, wxNOT_FOUND, NULL));
}

void FossilView::OnStop(wxCommandEvent& event)
{
	wxUnusedVar(event);
	m_plugin->GetConsole()->Stop();
}

void FossilView::OnClearOutput(wxCommandEvent& event)
{
	wxUnusedVar(event);
	m_plugin->GetConsole()->Clear();
}

void FossilView::OnRefreshView(wxCommandEvent& event)
{
................................................................................
	event.Skip();
	BuildTree();
}

void FossilView::OnFileAdded(wxCommandEvent& event)
{
	event.Skip();
	if (m_renflag) {
		m_renflag = false;
		return;
	}

	FossilSettingsData fsd = m_plugin->GetSettings();
	if(fsd.GetFlags() & FossilAddFileToFossil) {
		wxArrayString *files = (wxArrayString*)event.GetClientData();
		if(files) {
			bool     addToFossil(false);
			wxString command;
			command << m_plugin->GetFossilExeName() << wxT(" add ");
			for(size_t i=0; i<files->GetCount(); i++) {
				wxLogMessage(wxString::Format(wxT("File = '%s'"), files->Item(i).c_str()));
				if(m_plugin->IsPathUnderFossil(files->Item(i))) {
					command << wxT("\"") << files->Item(i) << wxT("\" ");
					addToFossil = true;
				}

			}

			if(addToFossil) {
				command.RemoveLast();
				m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultHandler(m_plugin, event.GetId(), this));
			}
		}
	}
}

void FossilView::OnFileRenamed(wxCommandEvent& event)
{
	wxArrayString *files = (wxArrayString*)event.GetClientData();
	m_renflag = true;


	if(files) {
		wxString oldName = files->Item(0);
		wxString newName = files->Item(1);

		if(m_plugin->IsPathUnderFossil(oldName) == false) {
			event.Skip();
			return;
		}

		wxString command;
		command << m_plugin->GetFossilExeName() << wxT(" rename \"") << oldName << wxT("\" \"") << newName << wxT("\"");
		m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultHandler(m_plugin, event.GetId(), this));

	} else
		event.Skip();
}

void FossilView::OnShowFossilInfo(wxCommandEvent& event)
{
	wxUnusedVar(event);

	wxString command;
	command << m_plugin->GetFossilExeName() << wxT(" status ");
	m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultHandler(m_plugin, wxNOT_FOUND, NULL));
}









#if 0
void FossilView::OnItemActivated(wxTreeEvent& event)
{
	wxArrayTreeItemIds items;
	wxArrayString      paths;
	size_t count = m_treeCtrl->GetSelections(items);
	for(size_t i=0; i<count; i++) {
		wxTreeItemId item = items.Item(i);
................................................................................
	wxString command;
	command << m_plugin->GetFossilExeName(nonInteractive) << loginString << wxT(" diff -r") << diffAgainst << wxT(" ");
	for (size_t i=0; i<paths.GetCount(); i++) {
		command << wxT("\"") << paths.Item(i) << wxT("\" ");
	}
	m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDiffHandler(m_plugin, event.GetId(), this), false);
}
#endif

void FossilView::OnStopUI(wxUpdateUIEvent& event)
{
	event.Enable(m_plugin->GetConsole()->IsRunning());
}

void FossilView::OnClearOutputUI(wxUpdateUIEvent& event)
{
	event.Enable(m_plugin->GetConsole()->IsEmpty() == false);
}

#if 0
void FossilView::OnCheckout(wxCommandEvent& event)
{
	wxString loginString;
	if(!m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString))
		return;

	wxString command;
................................................................................

void FossilView::OnIgnoreFilePattern(wxCommandEvent& event)
{
	wxUnusedVar(event);
	m_plugin->IgnoreFiles(m_selectionInfo.m_paths, true);
}







void FossilView::OnBlame(wxCommandEvent& event)
{
	m_plugin->Blame(event, m_selectionInfo.m_paths);
}

#endif

................................................................................
	DoLinkEditor();
}

void FossilView::DisconnectEvents()
{
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_WORKSPACE_LOADED, wxCommandEventHandler(FossilView::OnWorkspaceLoaded),          NULL, this);
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_WORKSPACE_CLOSED, wxCommandEventHandler(FossilView::OnWorkspaceClosed),          NULL, this);

	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_FILE_SAVED,       wxCommandEventHandler(FossilView::OnRefreshView),              NULL, this);
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_PROJ_FILE_ADDED,  wxCommandEventHandler(FossilView::OnFileAdded),                NULL, this);
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_FILE_RENAMED,     wxCommandEventHandler(FossilView::OnFileRenamed),              NULL, this);
	m_plugin->GetManager()->GetTheApp()->Disconnect(wxEVT_ACTIVE_EDITOR_CHANGED, wxCommandEventHandler(FossilView::OnActiveEditorChanged), NULL, this);

}

void FossilView::OnOpenFile(wxCommandEvent& event)
{
	wxUnusedVar(event);

	wxArrayTreeItemIds items;

Changes to Fossil/fossil_view.h.

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
..
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
	}
};

/** Implementing FossilPageBase */
class FossilView : public FossilPageBase
{
	Fossil*         m_plugin;
	wxTreeItemId         m_modifiedItems;
	FossilCommand           m_simpleCommand;
	//FossilCommand           m_diffCommand;
	FossilPageSelectionInfo m_selectionInfo;

public:
/*
	enum {
		FossilInfo_Tag,
		FossilInfo_Branch,
................................................................................
	void OnChangeRootDir ( wxCommandEvent& event );
	void OnTreeMenu      ( wxTreeEvent&    event );
	void OnItemActivated ( wxTreeEvent&    event );

	// IDE Events
	void OnWorkspaceLoaded    (wxCommandEvent &event);
	void OnWorkspaceClosed    (wxCommandEvent &event);
	void OnClearOuptut        (wxCommandEvent &event);
	void OnRefreshView        (wxCommandEvent &event);
	void OnFileRenamed        (wxCommandEvent &event);
	void OnFileAdded          (wxCommandEvent &event);
	void OnSettings           (wxCommandEvent &event);
	void OnActiveEditorChanged(wxCommandEvent &event);
	void OnOpenFile           (wxCommandEvent &event);

................................................................................
	void OnBranch             (wxCommandEvent &event);
	void OnTag                (wxCommandEvent &event);
	void OnResolve            (wxCommandEvent &event);
	void OnDiff               (wxCommandEvent &event);
	void OnPatch              (wxCommandEvent &event);
	void OnPatchDryRun        (wxCommandEvent &event);
	void OnStop               (wxCommandEvent &event);
	void OnCleanup            (wxCommandEvent &event);
	void OnShowFossilInfo        (wxCommandEvent &event);
	void OnCheckout           (wxCommandEvent &event);
	void OnIgnoreFile         (wxCommandEvent &event);
	void OnIgnoreFilePattern  (wxCommandEvent &event);
	void OnBlame              (wxCommandEvent &event);
	void OnLinkEditor         (wxCommandEvent &event);
	void OnSwitch             (wxCommandEvent &event);

	DECLARE_EVENT_TABLE()

	void OnStopUI         (wxUpdateUIEvent &event);
	void OnClearOuptutUI  (wxUpdateUIEvent &event);

public:
	/** Constructor */
	FossilView( wxWindow* parent, Fossil *plugin);
	virtual ~FossilView();

	void     DisconnectEvents();
	void     UpdateTree(const wxArrayString& theFiles);
	void     BuildTree();
	void     BuildTree(const wxString &root);
	wxXmlNode* GetFosNode(Workspace *workspace);
	wxString GetRootDir() const {return m_textCtrlRootDir->GetValue();}
};

#endif // __fossil_page__







|
|
|







 







|







 







|











|







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
..
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
	}
};

/** Implementing FossilPageBase */
class FossilView : public FossilPageBase
{
	Fossil*         m_plugin;
	bool			m_renflag;
	wxTreeItemId			m_modifiedItems;
	FossilCommand           m_simpleCommand;
	FossilPageSelectionInfo m_selectionInfo;

public:
/*
	enum {
		FossilInfo_Tag,
		FossilInfo_Branch,
................................................................................
	void OnChangeRootDir ( wxCommandEvent& event );
	void OnTreeMenu      ( wxTreeEvent&    event );
	void OnItemActivated ( wxTreeEvent&    event );

	// IDE Events
	void OnWorkspaceLoaded    (wxCommandEvent &event);
	void OnWorkspaceClosed    (wxCommandEvent &event);
	void OnClearOutput        (wxCommandEvent &event);
	void OnRefreshView        (wxCommandEvent &event);
	void OnFileRenamed        (wxCommandEvent &event);
	void OnFileAdded          (wxCommandEvent &event);
	void OnSettings           (wxCommandEvent &event);
	void OnActiveEditorChanged(wxCommandEvent &event);
	void OnOpenFile           (wxCommandEvent &event);

................................................................................
	void OnBranch             (wxCommandEvent &event);
	void OnTag                (wxCommandEvent &event);
	void OnResolve            (wxCommandEvent &event);
	void OnDiff               (wxCommandEvent &event);
	void OnPatch              (wxCommandEvent &event);
	void OnPatchDryRun        (wxCommandEvent &event);
	void OnStop               (wxCommandEvent &event);
	void OnExtras            (wxCommandEvent &event);
	void OnShowFossilInfo        (wxCommandEvent &event);
	void OnCheckout           (wxCommandEvent &event);
	void OnIgnoreFile         (wxCommandEvent &event);
	void OnIgnoreFilePattern  (wxCommandEvent &event);
	void OnBlame              (wxCommandEvent &event);
	void OnLinkEditor         (wxCommandEvent &event);
	void OnSwitch             (wxCommandEvent &event);

	DECLARE_EVENT_TABLE()

	void OnStopUI         (wxUpdateUIEvent &event);
	void OnClearOutputUI  (wxUpdateUIEvent &event);

public:
	/** Constructor */
	FossilView( wxWindow* parent, Fossil *plugin);
	virtual ~FossilView();

	void     DisconnectEvents();
	void     UpdateTree(const wxString& output);
	void     BuildTree();
	void     BuildTree(const wxString &root);
	wxXmlNode* GetFosNode(Workspace *workspace);
	wxString GetRootDir() const {return m_textCtrlRootDir->GetValue();}
};

#endif // __fossil_page__

Changes to Fossil/fossilcommandhandler.h.

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	}

	/**
	 * @brief handle here process output (e.g. interactive commands that needs response)
	 * @param process the process
	 * @param output  the process output
	 */
	virtual void OnProcessOutput(IProcess *process, const wxString &output) {}

	/**
	 * @brief the svn operation failed due to login error. Retry the last command but this
	 * time, pop the login dialog
	 */
	virtual void ProcessLoginRequired(const wxString &workingDirectory) {
		if(m_commandId != wxNOT_FOUND && m_owner) {







|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	}

	/**
	 * @brief handle here process output (e.g. interactive commands that needs response)
	 * @param process the process
	 * @param output  the process output
	 */
	void OnProcessOutput(IProcess *process, const wxString &output) {}

	/**
	 * @brief the svn operation failed due to login error. Retry the last command but this
	 * time, pop the login dialog
	 */
	virtual void ProcessLoginRequired(const wxString &workingDirectory) {
		if(m_commandId != wxNOT_FOUND && m_owner) {

Added Fossil/fossildefaulthandler.cpp.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "fossildefaulthandler.h"
#include "asyncprocess.h"
#include "fossil.h"
#include "fossil_view.h"

FossilDefaultHandler::FossilDefaultHandler(Fossil *plugin, int commandId, wxEvtHandler *owner)
                : FossilCommandHandler(plugin, commandId, owner)
{
}

void FossilDefaultHandler::Process(const wxString &output)
{
        wxUnusedVar(output);

        // Reload any modified files
        wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, wxEVT_CMD_RELOAD_EXTERNALLY_MODIFIED_NOPROMPT);
        GetPlugin()->GetManager()->GetTheApp()->GetTopWindow()->GetEventHandler()->AddPendingEvent(e);

        // Refresh the Fossil output page
        GetPlugin()->GetFossilView()->BuildTree();
}

Added Fossil/fossildefaulthandler.h.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef FOSSIL_DEFAULT_HANDLER_H
#define FOSSIL_DEFAULT_HANDLER_H

#include "fossilcommandhandler.h" // Base class

class FossilDefaultHandler : public FossilCommandHandler {
public:
	FossilDefaultHandler(Fossil *plugin, int commandId, wxEvtHandler *owner);
	virtual ~FossilDefaultHandler() {}

public:
	void Process(const wxString &output);
};

#endif // FOSSIL_DEFAULT_HANDLER_H

Changes to Fossil/fossilsettingsdata.h.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	size_t        m_fossilTabIndex;

public:
	FossilSettingsData()
			: m_executable(wxT("fossil"))
			, m_ignoreFilePattern(wxT("*.o *.obj *.exe *.lib *.so *.dll *.a *.dynlib *.exp *.ilk *.pdb *.d *.tags *.suo *.ncb *.bak *.orig *.dll *.mine *.o.d *.session Debug Release WinDebugUnicode WinReleaseUnicode"))
			, m_externalDiffViewer(wxT(""))
			, m_flags(FossilAddFileToFossil|FossilRetagWorkspace|FossilUsePosixLocale)
			, m_revisionMacroName(wxT("FOSSIL_REVISION"))
			, m_fossilTabIndex(Notebook::npos) {
	}

	virtual ~FossilSettingsData() {
	}








|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	size_t        m_fossilTabIndex;

public:
	FossilSettingsData()
			: m_executable(wxT("fossil"))
			, m_ignoreFilePattern(wxT("*.o *.obj *.exe *.lib *.so *.dll *.a *.dynlib *.exp *.ilk *.pdb *.d *.tags *.suo *.ncb *.bak *.orig *.dll *.mine *.o.d *.session Debug Release WinDebugUnicode WinReleaseUnicode"))
			, m_externalDiffViewer(wxT(""))
			, m_flags(FossilAddFileToFossil|FossilUsePosixLocale)
			, m_revisionMacroName(wxT("FOSSIL_REVISION"))
			, m_fossilTabIndex(Notebook::npos) {
	}

	virtual ~FossilSettingsData() {
	}

Changes to Fossil/fossilstatushandler.cpp.

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
#include "fossilstatushandler.h"
#include "fossil_console.h"
#include "fossil_view.h"
#include "fossil.h"
#include <wx/tokenzr.h>

FossilStatusHandler::FossilStatusHandler(Fossil *plugin, int commandId, wxEvtHandler *owner)
		: FossilCommandHandler(plugin, commandId, owner)
{
}

FossilStatusHandler::~FossilStatusHandler()
{
}

void FossilStatusHandler::Process(const wxString& output)
{
	GetPlugin()->GetConsole()->AppendText(wxT("statushandler line 18: ") + output);

	wxArrayString theFiles;
	wxStringTokenizer tkz(output);
	while ( tkz.HasMoreTokens() )
	{
		wxString str = tkz.GetNextToken();
		theFiles.Add(str);
	}
	GetPlugin()->GetFossilView()->UpdateTree(theFiles);
}




<












|
<
<
<
<
<
<
<
<
|

1
2
3
4

5
6
7
8
9
10
11
12
13
14
15
16
17








18
19
#include "fossilstatushandler.h"
#include "fossil_console.h"
#include "fossil_view.h"
#include "fossil.h"


FossilStatusHandler::FossilStatusHandler(Fossil *plugin, int commandId, wxEvtHandler *owner)
		: FossilCommandHandler(plugin, commandId, owner)
{
}

FossilStatusHandler::~FossilStatusHandler()
{
}

void FossilStatusHandler::Process(const wxString& output)
{
	//GetPlugin()->GetConsole()->AppendText(wxT("Statushandler::Process ") + output);








	GetPlugin()->GetFossilView()->UpdateTree(output);
}