Check-in [85d831884e]

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

Overview
Comment:Implemented delete & commit dialog
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:85d831884ea1f6cc9c19fa7282dce13c9af2650e
User & Date: isafam 2014-01-22 21:58:29
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
Changes

Changes to Fossil/Fossil.project.

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  <Plugins>
    <Plugin Name="qmake">
      <![CDATA[00060001N0012DebugUnicode0000000000000001N0014ReleaseUnicode0000000000000001N0015WinDebugUnicode0000000000000001N0011WinDebug_290000000000000001N0017WinReleaseUnicode0000000000000001N0013WinRelease_29000000000000]]>
    </Plugin>
  </Plugins>
  <VirtualDirectory Name="src">
    <File Name="fossil.cpp"/>
    <File Name="commitmessagescache.cpp"/>
    <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_strings.h"/>
    <File Name="fossil_ui.h"/>
    <File Name="fossil_login_dialog.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>







<








<



<







<







3
4
5
6
7
8
9

10
11
12
13
14
15
16
17

18
19
20

21
22
23
24
25
26
27

28
29
30
31
32
33
34
  <Plugins>
    <Plugin Name="qmake">
      <![CDATA[00060001N0012DebugUnicode0000000000000001N0014ReleaseUnicode0000000000000001N0015WinDebugUnicode0000000000000001N0011WinDebug_290000000000000001N0017WinReleaseUnicode0000000000000001N0013WinRelease_29000000000000]]>
    </Plugin>
  </Plugins>
  <VirtualDirectory Name="src">
    <File Name="fossil.cpp"/>

    <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"/>

  </VirtualDirectory>
  <VirtualDirectory Name="include">
    <File Name="fossil.h"/>

    <File Name="fossilsettingsdata.h"/>
    <File Name="fossil_view.h"/>
    <File Name="fossil_console.h"/>
    <File Name="fossil_strings.h"/>
    <File Name="fossil_ui.h"/>
    <File Name="fossil_login_dialog.h"/>
    <File Name="fossil_settings_dialog.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>

Changes to Fossil/commit_dialog.cpp.

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
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
CommitDialog::CommitDialog(wxWindow* parent, Fossil *plugin)
: CommitDialogBase( parent )
, m_plugin(plugin)
{
	m_checkListFiles->Clear();
	m_checkListFiles->Disable();
	m_panel1->Disable();
	wxArrayString lastMessages, previews;
	m_plugin->GetCommitMessagesCache().GetMessages(lastMessages, previews);

	for(size_t i=0; i<previews.GetCount(); i++) {
		m_choiceMessages->Append(previews.Item(i), new CommitMessageStringData(lastMessages.Item(i)));
	}

	m_textCtrlMessage->SetFocus();
	WindowAttrManager::Load(this, wxT("CommitDialog"), m_plugin->GetManager()->GetConfigTool());
}

CommitDialog::CommitDialog( wxWindow* parent, const wxArrayString &paths, Fossil *plugin)
		: CommitDialogBase( parent )
		, m_plugin(plugin)
{
	for (size_t i=0; i<paths.GetCount(); i++) {
		int index = m_checkListFiles->Append(paths.Item(i));
		m_checkListFiles->Check((unsigned int)index);
	}

	wxArrayString lastMessages, previews;
	m_plugin->GetCommitMessagesCache().GetMessages(lastMessages, previews);

	for(size_t i=0; i<previews.GetCount(); i++) {
		m_choiceMessages->Append(previews.Item(i), new CommitMessageStringData(lastMessages.Item(i)));
	}

	m_textCtrlMessage->SetFocus();
	WindowAttrManager::Load(this, wxT("CommitDialog"), m_plugin->GetManager()->GetConfigTool());
}

CommitDialog::~CommitDialog()
{
	wxString message = m_textCtrlMessage->GetValue();
	m_plugin->GetCommitMessagesCache().AddMessage(message);
	WindowAttrManager::Save(this, wxT("CommitDialog"), m_plugin->GetManager()->GetConfigTool());
}

wxString CommitDialog::GetMesasge()
{
	return NormalizeMessage(m_textCtrlMessage->GetValue());
}

wxString CommitDialog::NormalizeMessage(const wxString& message)
{
	wxString normalizedStr;
................................................................................

	normalizedStr.Trim().Trim(false);

	// FOSSIL does not like any quotation marks in the comment -> escape them
	normalizedStr.Replace(wxT("\""), wxT("\\\""));
	return normalizedStr;
}

wxArrayString CommitDialog::GetPaths()
{
	wxArrayString paths;
	for (size_t i=0; i<m_checkListFiles->GetCount(); i++) {
		if (m_checkListFiles->IsChecked(i)) {
			paths.Add( m_checkListFiles->GetString(i) );
		}
	}
	return paths;
}

void CommitDialog::OnChoiceMessage(wxCommandEvent& e)
{
	int idx = e.GetSelection();
	if(idx == wxNOT_FOUND)
		return;

	CommitMessageStringData* data = (CommitMessageStringData*)m_choiceMessages->GetClientObject(idx);
	if(data) {
		m_textCtrlMessage->SetValue(data->GetData());
	}
}








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







<



|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
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
..
51
52
53
54
55
56
57
























CommitDialog::CommitDialog(wxWindow* parent, Fossil *plugin)
: CommitDialogBase( parent )
, m_plugin(plugin)
{
	m_checkListFiles->Clear();
	m_checkListFiles->Disable();
	m_panel1->Disable();



























	m_textCtrlMessage->SetFocus();
	WindowAttrManager::Load(this, wxT("CommitDialog"), m_plugin->GetManager()->GetConfigTool());
}

CommitDialog::~CommitDialog()
{
	wxString message = m_textCtrlMessage->GetValue();

	WindowAttrManager::Save(this, wxT("CommitDialog"), m_plugin->GetManager()->GetConfigTool());
}

wxString CommitDialog::GetMessage()
{
	return NormalizeMessage(m_textCtrlMessage->GetValue());
}

wxString CommitDialog::NormalizeMessage(const wxString& message)
{
	wxString normalizedStr;
................................................................................

	normalizedStr.Trim().Trim(false);

	// FOSSIL does not like any quotation marks in the comment -> escape them
	normalizedStr.Replace(wxT("\""), wxT("\\\""));
	return normalizedStr;
}
























Changes to Fossil/commit_dialog.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef __commit_dialog__
#define __commit_dialog__

/**
@file
Subclass of CommitDialogBase, which is generated by wxFormBuilder.
*/

#include "fossil_ui.h"

class Fossil;
/** Implementing CommitDialogBase */
class CommitDialog : public CommitDialogBase
................................................................................

public:
	static wxString NormalizeMessage(const wxString &message);
	void OnChoiceMessage(wxCommandEvent &e);

public:
	/** Constructor */
	CommitDialog( wxWindow* parent, const wxArrayString &paths, Fossil *plugin );
	CommitDialog( wxWindow* parent, Fossil *plugin );
	virtual ~CommitDialog();

	wxString      GetMesasge();
	wxArrayString GetPaths();
};

#endif // __commit_dialog__





|







 







<



|
<



1
2
3
4
5
6
7
8
9
10
11
12
13
..
16
17
18
19
20
21
22

23
24
25
26

27
28
29
#ifndef __commit_dialog__
#define __commit_dialog__

/**
@file
Subclass of CommitDialogBase
*/

#include "fossil_ui.h"

class Fossil;
/** Implementing CommitDialogBase */
class CommitDialog : public CommitDialogBase
................................................................................

public:
	static wxString NormalizeMessage(const wxString &message);
	void OnChoiceMessage(wxCommandEvent &e);

public:
	/** Constructor */

	CommitDialog( wxWindow* parent, Fossil *plugin );
	virtual ~CommitDialog();

	wxString      GetMessage();

};

#endif // __commit_dialog__

Deleted Fossil/commitmessagescache.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
29
#include "commitmessagescache.h"

void CommitMessagesCache::GetMessages(wxArrayString& messages, wxArrayString& previews)
{
	for(size_t i=0; i<m_messages.GetCount(); i++) {
		messages.Add(m_messages.Item(i));
		previews.Add(m_messages.Item(i).BeforeFirst(wxT('\n')));
	}
}

void CommitMessagesCache::AddMessage(const wxString& message)
{
	wxString formattedMessage = FormatMessage(message);
	if(formattedMessage.IsEmpty())
		return;

	if(m_messages.Index(formattedMessage) == wxNOT_FOUND) {
		m_messages.Add(formattedMessage);
	}
}

wxString CommitMessagesCache::FormatMessage(const wxString& message)
{
	wxString formattedMessage ( message );
	formattedMessage.Replace(wxT("\r\n"), wxT("\n"));
	formattedMessage.Replace(wxT("\v"),   wxT("\n"));
	formattedMessage.Trim(false).Trim();
	return formattedMessage;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted Fossil/commitmessagescache.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef COMMITMESSAGESCACHE_H
#define COMMITMESSAGESCACHE_H

#include <wx/arrstr.h>

class CommitMessagesCache
{
	wxArrayString m_messages;
protected:
	wxString FormatMessage(const wxString &message);
	
public:
	CommitMessagesCache() {
	}
	
	virtual ~CommitMessagesCache() {
	}
	
	/**
	 * @brief return the messages 
	 * @param messages array containing the messages
	 * @param previews array containing preview (first line) of the messages
	 */
	void GetMessages(wxArrayString &messages, wxArrayString &previews);
	/**
	 * @brief add message to the cache. duplicate messages are ignored
	 * @param message
	 */
	void AddMessage (const wxString &message);
};

#endif // COMMITMESSAGESCACHE_H

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


































































Changes to Fossil/fossil.cpp.

353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
...
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
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
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
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
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
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
...
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
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;
	if(LoginIfNeeded(event, DoGetFileExplorerItemPath(), loginString) == false) {
		return;
	}
................................................................................
	if(dlg.ShowModal() == wxID_OK) {
		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));
}

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

void Fossil::OnDiff(wxCommandEvent& event)
{
	wxString diffAgainst(wxT("BASE"));
	diffAgainst = wxGetTextFromUser(wxT("Insert base revision to diff against:"), wxT("Diff against"), wxT("BASE"), GetManager()->GetTheApp()->GetTopWindow());
	if (diffAgainst.empty()) {
		// user clicked 'Cancel'
		diffAgainst = wxT("BASE");
	}

	wxString command;
	wxString loginString;
	if(LoginIfNeeded(event, DoGetFileExplorerItemPath(), loginString) == false) {
		return;
	}
	bool nonInteractive = GetNonInteractiveMode(event);
	command << GetFossilExeName(nonInteractive) << loginString << wxT("diff -r") << diffAgainst << wxT(" ") << DoGetFileExplorerItemFullPath();
	GetConsole()->Execute(command, DoGetFileExplorerItemPath(), new FossilDiffHandler(this, event.GetId(), this), false);
}

void Fossil::OnPatch(wxCommandEvent& event)
{
	Patch(false, DoGetFileExplorerItemPath(), this, event.GetId());
}

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("\"") << ssd.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;
}

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

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

void Fossil::RecreateLocalFossilConfigFile()
{
	wxString configFile;
	wxString configDir = GetUserConfigDir();
	configFile << configDir << wxFileName::GetPathSeparator() << wxT("config");

	// Convert any whitespace to space
	wxString ignorePatterns(GetSettings().GetIgnoreFilePattern());
	ignorePatterns.Replace(wxT("\r\n"), wxT(" "));
	ignorePatterns.Replace(wxT("\n"),   wxT(" "));
	ignorePatterns.Replace(wxT("\t"),   wxT(" "));
	ignorePatterns.Replace(wxT("\v"),   wxT(" "));

	wxString diffTool = GetSettings().GetExternalDiffViewer();
	if(!(GetSettings().GetFlags() & FossilUseExternalDiff)) {
		diffTool.Empty();
	}

	wxFFile fp;
	fp.Open(configFile.c_str(), wxT("w+b"));
	if(fp.IsOpened()) {
		fp.Write(wxT("[miscellany]\n"));
		fp.Write(wxT("global-ignores = "));
		fp.Write(ignorePatterns);
		fp.Write(wxT("\n\n[auth]\n"));
		fp.Write(wxT("password-stores =\n"));
		fp.Write(wxT("store-passwords = no\n"));
		fp.Write(wxT("\n"));
		fp.Write(wxT("[helpers]\n"));

		if(diffTool.IsEmpty() == false) {
			fp.Write(wxT("diff-cmd = "));
			fp.Write(diffTool);
			fp.Write(wxT("\n"));
		}

		fp.Close();
	}
}

void Fossil::DoGetFossilVersion()
{
	wxString command;
	command << GetFossilExeName(false) << wxT(" --version ");
	m_simpleCommand.Execute(command, wxT(""), new FossilVersionHandler(this, wxNOT_FOUND, NULL), this);
}

void Fossil::Patch(bool dryRun, const wxString &workingDirectory, wxEvtHandler *owner, int id)
{
// open a file selector to select the patch file
	const wxString ALL(	wxT("Patch files (*.patch;*.diff)|*.patch;*.diff|")
	                    wxT("All Files (*)|*"));


	wxString patchFile = wxFileSelector(wxT("Select Patch File:"),
										wxT(""),
										wxT(""),
										wxT(""),
										ALL,
										0,
										GetManager()->GetTheApp()->GetTopWindow());
	if (patchFile.IsEmpty() == false) {

		// execute the command
		wxString command;
		command << wxT("patch -p0 ");
		if(dryRun)
			command << wxT(" --dry-run ");
		command << wxT(" -i \"") << patchFile << wxT("\"");

		FossilCommandHandler *handler(NULL);
		if(dryRun) {
			handler = new FossilPatchDryRunHandler(this, id, owner);
		} else {
			handler = new FossilPatchHandler(this, id, owner);
		}
		m_simpleCommand.Execute(command, workingDirectory, handler, this);
	}
}

void Fossil::OnLog(wxCommandEvent& event)
{
	FossilLogDialog dlg(GetManager()->GetTheApp()->GetTopWindow());
	dlg.m_to->SetValue(wxT("BASE"));
	dlg.m_compact->SetValue(true);
	dlg.m_from->SetFocus();
	if(dlg.ShowModal() == wxID_OK) {
		wxString command;
		wxString loginString;
		if(LoginIfNeeded(event, DoGetFileExplorerItemPath(), loginString) == false) {
			return;
		}

		bool nonInteractive = GetNonInteractiveMode(event);
		command << GetFossilExeName(nonInteractive) << loginString << wxT(" log -r") << dlg.m_from->GetValue() << wxT(":") << dlg.m_to->GetValue() << wxT(" \"") << DoGetFileExplorerItemFullPath() << wxT("\"");
		GetConsole()->Execute(command, DoGetFileExplorerItemPath(), new FossilLogHandler(this, dlg.m_compact->IsChecked(), event.GetId(), this), false);
	}
}

bool Fossil::GetNonInteractiveMode(wxCommandEvent& event)
{
	return event.GetInt() != INTERACTIVE_MODE;
}

bool Fossil::LoginIfNeeded(wxCommandEvent& event, const wxString &workingDirectory, wxString& loginString)
{
	RecreateLocalFossilConfigFile();

	FossilInfo  fossilInfo;
	wxString repoUrl;

	if(event.GetInt() == LOGIN_REQUIRES_URL) {
		repoUrl = event.GetString();

	} else {
		DoGetFossilInfoSync( fossilInfo, workingDirectory );
		repoUrl = fossilInfo.m_url;
	}

	bool loginFailed = (event.GetInt() == LOGIN_REQUIRES) || (event.GetInt() == LOGIN_REQUIRES_URL);

	FossilPasswordDb db;
	wxString user, password;

	if(loginFailed) {
		// if we got here, it means that we already tried to login with either user prompt / using the stored password
		// to prevent an endless loop, remove the old entry from the password db
		db.DeleteLogin(repoUrl);
	}

	if(db.GetLogin(repoUrl, user, password)) {
		loginString << wxT(" --username ") << user << wxT(" --password ") << password << wxT(" ");
		return true;
	}

	// Use the root URL as the key for the login here
	loginString.Empty();
	if(loginFailed) {
		FossilLoginDialog dlg(GetManager()->GetTheApp()->GetTopWindow());
		if (dlg.ShowModal() == wxID_OK) {
			loginString << wxT(" --username ") << dlg.GetUsername() << wxT(" --password ") << dlg.GetPassword() << wxT(" ");
			// Store the user name and password
			db.SetLogin(repoUrl, dlg.GetUsername(), dlg.GetPassword());
			return true;
		} else {
			return false;
		}
	}
	return true;
}

void Fossil::IgnoreFiles(const wxArrayString& files, bool pattern)
{
	FossilSettingsData fsd = GetSettings();
	wxArrayString ignorePatternArr = wxStringTokenize(ssd.GetIgnoreFilePattern(), wxT(" \r\n\t\v"), wxTOKEN_STRTOK);

	for(size_t i=0; i<files.GetCount(); i++) {
		wxString entry;
		wxFileName fn(files.Item(i));
		if(pattern) {
			entry << wxT("*.") << fn.GetExt();
		} else {
			entry << fn.GetFullName();
		}

		if(ignorePatternArr.Index(entry) == wxNOT_FOUND) {
			ignorePatternArr.Add(entry);
		}
	}

	wxString ignorePatternStr;
	for(size_t i=0; i<ignorePatternArr.GetCount(); i++){
		ignorePatternStr << ignorePatternArr.Item(i) << wxT(" ");
	}
	ignorePatternStr.RemoveLast();
	ssd.SetIgnoreFilePattern(ignorePatternStr);

	// write down the changes
	SetSettings( fsd );

	// update the config file
	RecreateLocalFossilConfigFile();

	// refresh the view
	GetFossilView()->BuildTree();
}

void Fossil::OnIgnoreFile(wxCommandEvent& event)
{
	wxArrayString arr;
	arr.Add(DoGetFileExplorerItemFullPath());
	IgnoreFiles(arr, false);
}

void Fossil::OnIgnoreFilePattern(wxCommandEvent& event)
{
	wxArrayString arr;
	arr.Add(DoGetFileExplorerItemFullPath());
	IgnoreFiles(arr, true);
}

void Fossil::EditSettings()
{
	FossilPreferencesDialog dlg(GetManager()->GetTheApp()->GetTopWindow(), this);
	if (dlg.ShowModal() == wxID_OK) {
		// Update the Fossil view
		GetFossilView()->BuildTree();
		DoSetSSH();
		RecreateLocalFossilConfigFile();
	}
}

bool Fossil::IsFossilViewDetached()
{
	DetachedPanesInfo dpi;
	m_mgr->GetConfigTool()->ReadObject(wxT("DetachedPanesList"), &dpi);
	wxArrayString detachedPanes = dpi.GetPanes();
	return detachedPanes.Index(fossilCONSOLE_TEXT) != wxNOT_FOUND;
}

void Fossil::OnSelectAsView(wxCommandEvent& event)
{
	wxUnusedVar(event);
	GetFossilView()->BuildTree(DoGetFileExplorerItemPath());
}

void Fossil::OnBlame(wxCommandEvent& event)
{
	wxArrayString files;
	files.Add(DoGetFileExplorerItemFullPath());
	Blame(event, files);
}

void Fossil::Blame(wxCommandEvent& event, const wxArrayString& files)
{
	wxString command;
	wxString loginString;

	if(files.GetCount() == 0)
		return;

	bool nonInteractive = GetNonInteractiveMode(event);
	if(LoginIfNeeded(event, files.Item(0), loginString) == false) {
		return;
	}

	command << GetFossilExeName(nonInteractive) << loginString << wxT(" blame ");

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

	GetConsole()->EnsureVisible();
	GetConsole()->AppendText(command + wxT("\n"));
	m_blameCommand.Execute(command, wxT(""), new FossilBlameHandler(this, event.GetId(), this), this);
}

void Fossil::OnGetCompileLine(wxCommandEvent& event)
{
	if ( !(GetSettings().GetFlags() & FossilExposeRevisionMacro) )
		return;

	wxString macroName ( GetSettings().GetRevisionMacroName() );
	macroName.Trim().Trim(false);

	if(macroName.IsEmpty())
		return;

	wxString workingDirectory = m_fossilView->GetRootDir();
	workingDirectory.Trim().Trim(false);

	FossilInfo fossilInfo;
	DoGetFossilInfoSync(fossilInfo, workingDirectory);

	wxString content = event.GetString();
	content << wxT(" -D");
	content << macroName << wxT("=\\\"");
	content << fossilInfo.m_revision << wxT("\\\" ");
	event.SetString( content );
	event.Skip();
}

void Fossil::DoGetFossilInfoSync(FossilInfo& fossilInfo, const wxString &workingDirectory)
{
	wxString fossilInfoCommand;
	wxString xmlStr;

	//fossilInfoCommand << GetFossilExeName() << wxT(" info --xml ");
	fossilInfoCommand << GetFossilExeName() << wxT(" info ");
	if(workingDirectory.Find(wxT(" ")))
		fossilInfoCommand << wxT("\"") << workingDirectory << wxT("\"");
	else
		fossilInfoCommand << workingDirectory;

	wxArrayString xmlArr;

	wxLog::EnableLogging(false);
	ProcUtils::ExecuteCommand(fossilInfoCommand, xmlArr);

	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;
................................................................................
		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);
}

void Fossil::DoSwitchURL(const wxString& workingDirectory, const wxString &sourceUrl, wxCommandEvent& event)
{
	FossilInfo fossilInfo;
	DoGetFossilInfoSync(fossilInfo, workingDirectory);

	wxString loginString;
	if(LoginIfNeeded(event, workingDirectory, loginString) == false) {
		return;
	}
	bool nonInteractive = GetNonInteractiveMode(event);

	wxString targetUrl = wxGetTextFromUser(wxT("Enter new URL:"), wxT("Fossil Switch..."), sourceUrl);
	if(targetUrl.IsEmpty()) {
		return;
	}

	wxString command;

	command << GetFossilExeName(nonInteractive) << wxT(" switch ") << targetUrl << loginString;
	GetConsole()->Execute(command, workingDirectory, new FossilDefaultCommandHandler(this, wxNOT_FOUND, NULL));
}
#endif







<







 







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







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
353
354
355
356
357
358
359

360
361
362
363
364
365
366
...
380
381
382
383
384
385
386







































































































































































































































































































































































































387
388
389
390
391
392
393
...
403
404
405
406
407
408
409
































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;
	if(LoginIfNeeded(event, DoGetFileExplorerItemPath(), loginString) == false) {
		return;
	}
................................................................................
	if(dlg.ShowModal() == wxID_OK) {
		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));
	}
}







































































































































































































































































































































































































#endif

bool Fossil::IsPathUnderFossil(const wxString& path)
{
	wxFileName fn(path);
	wxString filePath(fn.GetPath());
	wxString fossilRepo;
................................................................................
		fossilRepo << filePath << sep << wxT(".fslckout");
		if(wxFileExists(fossilRepo.c_str()))
			return true;
		filePath = filePath.BeforeLast(sep);
	}
	return false;
}
































Changes to Fossil/fossil.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef __Fossil__
#define __Fossil__

#include "plugin.h"
#include "fossilinfo.h"
#include "commitmessagescache.h"
#include "fossilcommand.h"
#include "fossilsettingsdata.h"

class FossilView;
class FossilConsole;
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();

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

	wxMenu* CreateFileExplorerPopMenu();
	bool    IsFossilViewDetached ();
public:
	void    DoGetFossilInfoSync         (FossilInfo& fossilInfo, const wxString &workingDirectory);
	void    DoSwitchURL              (const wxString &workingDirectory, const wxString &sourceUrl, wxCommandEvent &event);
public:
	Fossil(IManager *manager);
	~Fossil();

	//--------------------------------------------
	//Abstract methods
	//--------------------------------------------
................................................................................

	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




<
<







 







<







 







<
|







 







<
<
<
<










1
2
3
4


5
6
7
8
9
10
11
..
13
14
15
16
17
18
19

20
21
22
23
24
25
26
..
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54
..
72
73
74
75
76
77
78




79
80
81
82
83
84
85
86
87
88
#ifndef __Fossil__
#define __Fossil__

#include "plugin.h"


#include "fossilcommand.h"
#include "fossilsettingsdata.h"

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


protected:
	void OnSettings(wxCommandEvent &event);

public:
	void EditSettings();

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

	wxMenu* CreateFileExplorerPopMenu();
	bool    IsFossilViewDetached ();
public:

	void    DoSwitchURL	(const wxString &workingDirectory, const wxString &sourceUrl, wxCommandEvent &event);
public:
	Fossil(IManager *manager);
	~Fossil();

	//--------------------------------------------
	//Abstract methods
	//--------------------------------------------
................................................................................

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





	bool IsPathUnderFossil (const wxString &path);

protected:
	void DoInitialize();

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

#endif //Fossil

Changes to Fossil/fossil_ui.cpp.

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
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
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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
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
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
	m_buttonChangeRootDir = new wxButton( this, wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
	m_buttonChangeRootDir->SetToolTip( _("Select a different root directory") );
	
	bSizer2->Add( m_buttonChangeRootDir, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
	
	mainSizer->Add( bSizer2, 0, wxEXPAND, 5 );
	
	m_treeCtrl = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_MULTIPLE );
	mainSizer->Add( m_treeCtrl, 1, wxEXPAND, 5 );
	
	this->SetSizer( mainSizer );
	this->Layout();
	mainSizer->Fit( this );
	
	// Connect Events
................................................................................
	bSizer6->Add( m_textCtrlMessage, 1, wxEXPAND, 5 );
	
	m_panel2->SetSizer( bSizer6 );
	m_panel2->Layout();
	bSizer6->Fit( m_panel2 );
	m_splitter1->SplitVertically( m_panel1, m_panel2, 0 );
	bSizer3->Add( m_splitter1, 1, wxEXPAND|wxALL, 5 );
	
	m_staticText27 = new wxStaticText( this, wxID_ANY, _("Recent commit messages:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText27->Wrap( -1 );
	bSizer3->Add( m_staticText27, 0, wxALL|wxEXPAND, 5 );
	
	wxArrayString m_choiceMessagesChoices;
	m_choiceMessages = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceMessagesChoices, 0 );
	m_choiceMessages->SetSelection( 0 );
	bSizer3->Add( m_choiceMessages, 0, wxALL|wxEXPAND, 5 );
	
	m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	bSizer3->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
	
	wxBoxSizer* bSizer4;
	bSizer4 = new wxBoxSizer( wxHORIZONTAL );
	
	m_button2 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
................................................................................
	bSizer3->Add( bSizer4, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
	
	this->SetSizer( bSizer3 );
	this->Layout();
	bSizer3->Fit( this );
	
	this->Centre( wxBOTH );
	
	// Connect Events
	m_choiceMessages->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CommitDialogBase::OnChoiceMessage ), NULL, this );
}

CommitDialogBase::~CommitDialogBase()
{
	// Disconnect Events
	m_choiceMessages->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CommitDialogBase::OnChoiceMessage ), NULL, this );
	
}

FossilCopyDialogBase::FossilCopyDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* bSizer7;
	bSizer7 = new wxBoxSizer( wxVERTICAL );
	
	wxFlexGridSizer* fgSizer1;
	fgSizer1 = new wxFlexGridSizer( 2, 2, 0, 0 );
	fgSizer1->AddGrowableCol( 1 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	m_staticText3 = new wxStaticText( this, wxID_ANY, _("Source URL:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText3->Wrap( -1 );
	fgSizer1->Add( m_staticText3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_textCtrlSourceURL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer1->Add( m_textCtrlSourceURL, 1, wxALL|wxEXPAND, 5 );
	
	m_staticText4 = new wxStaticText( this, wxID_ANY, _("Target URL:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText4->Wrap( -1 );
	fgSizer1->Add( m_staticText4, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_textCtrlTargetURL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer1->Add( m_textCtrlTargetURL, 1, wxALL|wxEXPAND, 5 );
	
	bSizer7->Add( fgSizer1, 0, wxEXPAND, 5 );
	
	m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	bSizer7->Add( m_staticline3, 0, wxEXPAND | wxALL, 5 );
	
	m_staticText5 = new wxStaticText( this, wxID_ANY, _("Comment:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText5->Wrap( -1 );
	bSizer7->Add( m_staticText5, 0, wxALL, 5 );
	
	m_textCtrlComment = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_RICH2 );
	bSizer7->Add( m_textCtrlComment, 1, wxALL|wxEXPAND, 5 );
	
	m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	bSizer7->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
	
	wxBoxSizer* bSizer8;
	bSizer8 = new wxBoxSizer( wxHORIZONTAL );
	
	m_button4 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
	m_button4->SetDefault(); 
	bSizer8->Add( m_button4, 0, wxALL, 5 );
	
	m_button5 = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer8->Add( m_button5, 0, wxALL, 5 );
	
	bSizer7->Add( bSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
	
	this->SetSizer( bSizer7 );
	this->Layout();
	
	this->Centre( wxBOTH );
}

FossilCopyDialogBase::~FossilCopyDialogBase()
{
}

FossilShellBase::FossilShellBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
	wxBoxSizer* bSizer9;
	bSizer9 = new wxBoxSizer( wxVERTICAL );
	
................................................................................

FossilSettingsDialogBase::~FossilSettingsDialogBase()
{
	// Disconnect Events
	m_buttonBrowse1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilSettingsDialogBase::OnBrowseFossilExe ), NULL, this );
	m_buttonBrowse2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilSettingsDialogBase::OnSelectFile ), NULL, this );
	m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilSettingsDialogBase::OnButtonSave ), NULL, this );
}

FossilInfoDialog::FossilInfoDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* bSizer17;
	bSizer17 = new wxBoxSizer( wxVERTICAL );
	
	wxStaticBoxSizer* sbSizer3;
	sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
	
	wxFlexGridSizer* fgSizer7;
	fgSizer7 = new wxFlexGridSizer( 5, 2, 0, 0 );
	fgSizer7->AddGrowableCol( 1 );
	fgSizer7->SetFlexibleDirection( wxBOTH );
	fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	m_staticText19 = new wxStaticText( this, wxID_ANY, _("Root URL:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText19->Wrap( -1 );
	m_staticText19->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	fgSizer7->Add( m_staticText19, 0, wxALL, 5 );
	
	m_textCtrlRootURL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 500,-1 ), wxTE_READONLY|wxTE_RICH2 );
	m_textCtrlRootURL->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	
	fgSizer7->Add( m_textCtrlRootURL, 0, wxALL|wxEXPAND, 5 );
	
	m_staticText21 = new wxStaticText( this, wxID_ANY, _("URL:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText21->Wrap( -1 );
	m_staticText21->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	fgSizer7->Add( m_staticText21, 0, wxALL, 5 );
	
	m_textCtrlURL = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RICH2 );
	m_textCtrlURL->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	
	fgSizer7->Add( m_textCtrlURL, 0, wxALL|wxEXPAND, 5 );
	
	m_staticText23 = new wxStaticText( this, wxID_ANY, _("Revision:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText23->Wrap( -1 );
	m_staticText23->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	fgSizer7->Add( m_staticText23, 0, wxALL, 5 );
	
	m_textCtrlRevision = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RICH2 );
	m_textCtrlRevision->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	
	fgSizer7->Add( m_textCtrlRevision, 0, wxALL|wxEXPAND, 5 );
	
	m_staticText25 = new wxStaticText( this, wxID_ANY, _("Author:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText25->Wrap( -1 );
	m_staticText25->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	fgSizer7->Add( m_staticText25, 0, wxALL, 5 );
	
	m_textCtrlAuthor = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RICH2 );
	m_textCtrlAuthor->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	
	fgSizer7->Add( m_textCtrlAuthor, 0, wxALL|wxEXPAND, 5 );
	
	m_staticText27 = new wxStaticText( this, wxID_ANY, _("Date:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText27->Wrap( -1 );
	m_staticText27->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	fgSizer7->Add( m_staticText27, 0, wxALL, 5 );
	
	m_textCtrlDate = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_RICH2 );
	m_textCtrlDate->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	
	fgSizer7->Add( m_textCtrlDate, 0, wxALL|wxEXPAND, 5 );
	
	sbSizer3->Add( fgSizer7, 1, wxEXPAND|wxALL, 5 );
	
	bSizer17->Add( sbSizer3, 0, wxEXPAND|wxALL, 5 );
	
	wxBoxSizer* bSizer18;
	bSizer18 = new wxBoxSizer( wxHORIZONTAL );
	
	m_button13 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
	m_button13->SetDefault(); 
	bSizer18->Add( m_button13, 0, wxALL, 5 );
	
	bSizer17->Add( bSizer18, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
	
	this->SetSizer( bSizer17 );
	this->Layout();
	bSizer17->Fit( this );
	
	this->Centre( wxBOTH );
}

FossilInfoDialog::~FossilInfoDialog()
{
}

FossilCheckoutDialogBase::FossilCheckoutDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* bSizer19;
	bSizer19 = new wxBoxSizer( wxVERTICAL );
	
	wxStaticBoxSizer* sbSizer4;
	sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
	
	wxFlexGridSizer* fgSizer8;
	fgSizer8 = new wxFlexGridSizer( 2, 3, 0, 0 );
	fgSizer8->AddGrowableCol( 1 );
	fgSizer8->SetFlexibleDirection( wxBOTH );
	fgSizer8->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	m_staticText24 = new wxStaticText( this, wxID_ANY, _("URL of repository:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText24->Wrap( -1 );
	fgSizer8->Add( m_staticText24, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_comboBoxRepoURL = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); 
	fgSizer8->Add( m_comboBoxRepoURL, 0, wxALL|wxEXPAND, 5 );
	
	
	fgSizer8->Add( 0, 0, 1, wxEXPAND, 5 );
	
	m_staticText25 = new wxStaticText( this, wxID_ANY, _("Checkout directory:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText25->Wrap( -1 );
	fgSizer8->Add( m_staticText25, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_textCtrl20 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer8->Add( m_textCtrl20, 0, wxALL|wxEXPAND, 5 );
	
	m_buttonBrowseDir = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer8->Add( m_buttonBrowseDir, 0, wxALL, 5 );
	
	sbSizer4->Add( fgSizer8, 1, wxEXPAND|wxALL, 5 );
	
	bSizer19->Add( sbSizer4, 0, wxEXPAND|wxALL, 5 );
	
	
	bSizer19->Add( 0, 0, 1, wxALL|wxEXPAND, 5 );
	
	wxBoxSizer* bSizer20;
	bSizer20 = new wxBoxSizer( wxHORIZONTAL );
	
	m_button14 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
	m_button14->SetDefault(); 
	bSizer20->Add( m_button14, 0, wxALL, 5 );
	
	m_button15 = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer20->Add( m_button15, 0, wxALL, 5 );
	
	bSizer19->Add( bSizer20, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
	
	this->SetSizer( bSizer19 );
	this->Layout();
	bSizer19->Fit( this );
	
	this->Centre( wxBOTH );
	
	// Connect Events
	m_comboBoxRepoURL->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FossilCheckoutDialogBase::OnCheckoutDirectoryText ), NULL, this );
	m_buttonBrowseDir->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilCheckoutDialogBase::OnBrowseDirectory ), NULL, this );
	m_button14->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilCheckoutDialogBase::OnOK ), NULL, this );
	m_button14->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( FossilCheckoutDialogBase::OnOkUI ), NULL, this );
}

FossilCheckoutDialogBase::~FossilCheckoutDialogBase()
{
	// Disconnect Events
	m_comboBoxRepoURL->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( FossilCheckoutDialogBase::OnCheckoutDirectoryText ), NULL, this );
	m_buttonBrowseDir->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilCheckoutDialogBase::OnBrowseDirectory ), NULL, this );
	m_button14->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilCheckoutDialogBase::OnOK ), NULL, this );
	m_button14->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( FossilCheckoutDialogBase::OnOkUI ), NULL, this );
	
}

FossilLogDialog::FossilLogDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* bSizer21;
	bSizer21 = new wxBoxSizer( wxVERTICAL );
	
	wxFlexGridSizer* fgSizer9;
	fgSizer9 = new wxFlexGridSizer( 2, 2, 0, 0 );
	fgSizer9->AddGrowableCol( 1 );
	fgSizer9->SetFlexibleDirection( wxBOTH );
	fgSizer9->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	m_staticText28 = new wxStaticText( this, wxID_ANY, _("From revision:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText28->Wrap( -1 );
	fgSizer9->Add( m_staticText28, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_from = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 );
	fgSizer9->Add( m_from, 0, wxALL|wxEXPAND, 5 );
	
	m_staticText29 = new wxStaticText( this, wxID_ANY, _("To revision:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText29->Wrap( -1 );
	fgSizer9->Add( m_staticText29, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
	
	m_to = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer9->Add( m_to, 0, wxALL|wxEXPAND, 5 );
	
	bSizer21->Add( fgSizer9, 0, wxEXPAND|wxALL, 5 );
	
	
	bSizer21->Add( 0, 0, 1, wxEXPAND|wxALL, 5 );
	
	m_compact = new wxCheckBox( this, wxID_ANY, _("Create compact log"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer21->Add( m_compact, 0, wxALL|wxEXPAND, 5 );
	
	m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	bSizer21->Add( m_staticline5, 0, wxEXPAND | wxALL, 5 );
	
	wxBoxSizer* bSizer22;
	bSizer22 = new wxBoxSizer( wxHORIZONTAL );
	
	m_button17 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
	m_button17->SetDefault(); 
	bSizer22->Add( m_button17, 0, wxALL, 5 );
	
	m_button18 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer22->Add( m_button18, 0, wxALL, 5 );
	
	bSizer21->Add( bSizer22, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
	
	this->SetSizer( bSizer21 );
	this->Layout();
	bSizer21->Fit( this );
	
	this->Centre( wxBOTH );
}

FossilLogDialog::~FossilLogDialog()
{
}







|







 







|
<
<
<
<
<
<
<
<
<







 







|
<
<
|
<


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







 








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
79
80
81
82
83
84
85
86









87
88
89
90
91
92
93
...
100
101
102
103
104
105
106
107


108

109
110



































































111
112
113
114
115
116
117
...
255
256
257
258
259
260
261
262










































































































































































































































	m_buttonChangeRootDir = new wxButton( this, wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
	m_buttonChangeRootDir->SetToolTip( _("Select a different root directory") );
	
	bSizer2->Add( m_buttonChangeRootDir, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
	
	mainSizer->Add( bSizer2, 0, wxEXPAND, 5 );
	
	m_treeCtrl = new wxTreeCtrl( this, wxID_ANY);
	mainSizer->Add( m_treeCtrl, 1, wxEXPAND, 5 );
	
	this->SetSizer( mainSizer );
	this->Layout();
	mainSizer->Fit( this );
	
	// Connect Events
................................................................................
	bSizer6->Add( m_textCtrlMessage, 1, wxEXPAND, 5 );
	
	m_panel2->SetSizer( bSizer6 );
	m_panel2->Layout();
	bSizer6->Fit( m_panel2 );
	m_splitter1->SplitVertically( m_panel1, m_panel2, 0 );
	bSizer3->Add( m_splitter1, 1, wxEXPAND|wxALL, 5 );
		









	m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	bSizer3->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
	
	wxBoxSizer* bSizer4;
	bSizer4 = new wxBoxSizer( wxHORIZONTAL );
	
	m_button2 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
................................................................................
	bSizer3->Add( bSizer4, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
	
	this->SetSizer( bSizer3 );
	this->Layout();
	bSizer3->Fit( this );
	
	this->Centre( wxBOTH );
}




CommitDialogBase::~CommitDialogBase()
{



































































}

FossilShellBase::FossilShellBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
	wxBoxSizer* bSizer9;
	bSizer9 = new wxBoxSizer( wxVERTICAL );
	
................................................................................

FossilSettingsDialogBase::~FossilSettingsDialogBase()
{
	// Disconnect Events
	m_buttonBrowse1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilSettingsDialogBase::OnBrowseFossilExe ), NULL, this );
	m_buttonBrowse2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilSettingsDialogBase::OnSelectFile ), NULL, this );
	m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FossilSettingsDialogBase::OnButtonSave ), NULL, this );
}










































































































































































































































Changes to Fossil/fossil_ui.h.

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
...
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
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
		wxSplitterWindow* m_splitter1;
		wxPanel* m_panel1;
		wxStaticText* m_staticText2;
		wxCheckListBox* m_checkListFiles;
		wxPanel* m_panel2;
		wxStaticText* m_staticText1;
		wxTextCtrl* m_textCtrlMessage;
		wxStaticText* m_staticText27;
		wxChoice* m_choiceMessages;
		wxStaticLine* m_staticline1;
		wxButton* m_button2;
		wxButton* m_button3;
		
		// Virtual event handlers, overide them in your derived class
		virtual void OnChoiceMessage( wxCommandEvent& event ) { event.Skip(); }
		
	
	public:
		
		CommitDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fossil Commit"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
		~CommitDialogBase();
		
		void m_splitter1OnIdle( wxIdleEvent& )
		{
			m_splitter1->SetSashPosition( 0 );
			m_splitter1->Disconnect( wxEVT_IDLE, wxIdleEventHandler( CommitDialogBase::m_splitter1OnIdle ), NULL, this );
		}
	
};

///////////////////////////////////////////////////////////////////////////////
/// Class FossilCopyDialogBase
///////////////////////////////////////////////////////////////////////////////
class FossilCopyDialogBase : public wxDialog 
{
	private:
	
	protected:
		wxStaticText* m_staticText3;
		wxTextCtrl* m_textCtrlSourceURL;
		wxStaticText* m_staticText4;
		wxTextCtrl* m_textCtrlTargetURL;
		wxStaticLine* m_staticline3;
		wxStaticText* m_staticText5;
		wxTextCtrl* m_textCtrlComment;
		wxStaticLine* m_staticline2;
		wxButton* m_button4;
		wxButton* m_button5;
	
	public:
		
		FossilCopyDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create Fossil Tag"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 575,315 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
		~FossilCopyDialogBase();
	
};

///////////////////////////////////////////////////////////////////////////////
/// Class FossilShellBase
///////////////////////////////////////////////////////////////////////////////
class FossilShellBase : public wxPanel 
{
................................................................................
		virtual void OnButtonSave( wxCommandEvent& event ){ event.Skip(); }
		
	
	public:
		FossilSettingsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Fossil Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
		~FossilSettingsDialogBase();
	
};

///////////////////////////////////////////////////////////////////////////////
/// Class FossilInfoDialog
///////////////////////////////////////////////////////////////////////////////
class FossilInfoDialog : public wxDialog 
{
	private:
	
	protected:
		wxStaticText* m_staticText19;
		wxStaticText* m_staticText21;
		wxStaticText* m_staticText23;
		wxStaticText* m_staticText25;
		wxStaticText* m_staticText27;
		wxButton* m_button13;
	
	public:
		wxTextCtrl* m_textCtrlRootURL;
		wxTextCtrl* m_textCtrlURL;
		wxTextCtrl* m_textCtrlRevision;
		wxTextCtrl* m_textCtrlAuthor;
		wxTextCtrl* m_textCtrlDate;
		
		FossilInfoDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fossil Info"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
		~FossilInfoDialog();
	
};

///////////////////////////////////////////////////////////////////////////////
/// Class FossilCheckoutDialogBase
///////////////////////////////////////////////////////////////////////////////
class FossilCheckoutDialogBase : public wxDialog 
{
	private:
	
	protected:
		wxStaticText* m_staticText24;
		wxComboBox* m_comboBoxRepoURL;
		
		wxStaticText* m_staticText25;
		wxTextCtrl* m_textCtrl20;
		wxButton* m_buttonBrowseDir;
		
		wxButton* m_button14;
		wxButton* m_button15;
		
		// Virtual event handlers, overide them in your derived class
		virtual void OnCheckoutDirectoryText( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnBrowseDirectory( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnOK( wxCommandEvent& event ) { event.Skip(); }
		virtual void OnOkUI( wxUpdateUIEvent& event ) { event.Skip(); }
		
	
	public:
		
		FossilCheckoutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fossil Checkout"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
		~FossilCheckoutDialogBase();
	
};

///////////////////////////////////////////////////////////////////////////////
/// Class FossilLogDialog
///////////////////////////////////////////////////////////////////////////////
class FossilLogDialog : public wxDialog 
{
	private:
	
	protected:
		wxStaticText* m_staticText28;
		wxStaticText* m_staticText29;
		
		wxStaticLine* m_staticline5;
		wxButton* m_button17;
		wxButton* m_button18;
	
	public:
		wxTextCtrl* m_from;
		wxTextCtrl* m_to;
		wxCheckBox* m_compact;
		
		FossilLogDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fossil Log"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
		~FossilLogDialog();
	
};

#endif //__fossil_ui__







<
<



|
<
<
<
<











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







 









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

68
69
70
71
72
73
74


75
76
77
78




79
80
81
82
83
84
85
86
87
88
89


























90
91
92
93
94
95
96
...
157
158
159
160
161
162
163
164
165




















































































166
		wxSplitterWindow* m_splitter1;
		wxPanel* m_panel1;
		wxStaticText* m_staticText2;
		wxCheckListBox* m_checkListFiles;
		wxPanel* m_panel2;
		wxStaticText* m_staticText1;
		wxTextCtrl* m_textCtrlMessage;


		wxStaticLine* m_staticline1;
		wxButton* m_button2;
		wxButton* m_button3;





	public:
		
		CommitDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fossil Commit"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
		~CommitDialogBase();
		
		void m_splitter1OnIdle( wxIdleEvent& )
		{
			m_splitter1->SetSashPosition( 0 );
			m_splitter1->Disconnect( wxEVT_IDLE, wxIdleEventHandler( CommitDialogBase::m_splitter1OnIdle ), NULL, this );
		}
	


























};

///////////////////////////////////////////////////////////////////////////////
/// Class FossilShellBase
///////////////////////////////////////////////////////////////////////////////
class FossilShellBase : public wxPanel 
{
................................................................................
		virtual void OnButtonSave( wxCommandEvent& event ){ event.Skip(); }
		
	
	public:
		FossilSettingsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Fossil Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
		~FossilSettingsDialogBase();
	
};





















































































#endif //__fossil_ui__

Changes to Fossil/fossil_view.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
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
..
85
86
87
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
...
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
...
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
...
349
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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
...
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
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
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
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
...
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
...
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
#include <wx/app.h>
//#include "fossil_checkout_dialog.h"
#include "fossil_ui.h"
#include <wx/settings.h>
#include <wx/filedlg.h>
#include <wx/textdlg.h>
#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 "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 )
................................................................................
		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
			return;

		wxMenu menu;
		switch (type) {
		case FossilTreeData::FossilNodeTypeFile:
			CreateFileMenu( &menu );
			break;

		case FossilTreeData::FossilNodeTypeRoot:
			CreateRootMenu( &menu );
			break;

		case FossilTreeData::FossilNodeTypeAddedRoot:
		case FossilTreeData::FossilNodeTypeDeletedRoot:
		case FossilTreeData::FossilNodeTypeModifiedRoot:
			CreateSecondRootMenu( &menu );
			break;

		default:
			return;
		}

		PopupMenu( &menu );
	}
}
................................................................................
	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);
................................................................................
}

void FossilView::OnWorkspaceLoaded(wxCommandEvent& event)
{
	event.Skip();
	Workspace *workspace = m_plugin->GetManager()->GetWorkspace();

////////////////////////////////////
	//__asm__("int $3"); //trace M.Isa

	if(m_plugin->GetManager()->IsWorkspaceOpen() && workspace) {
		wxXmlNode *fosnode = GetFosNode(workspace);
		wxString wdir = fosnode->GetPropVal(wxT("wdir"), wxEmptyString);
		m_plugin->GetConsole()->AppendText(wxT("mydebug: wdir --> ") + wdir + wxT("\n"));
		if (wdir != wxEmptyString)
			m_textCtrlRootDir->SetValue(wdir);
		else
			m_textCtrlRootDir->SetValue(workspace->GetWorkspaceFileName().GetPath());
		BuildTree();
	}
}
................................................................................
		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)) {
................................................................................
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();
................................................................................
	default:
		iconIndex = 11;
		break;
	}
	return iconIndex;
}

FossilTreeData::FossilNodeType FossilView::DoGetSelectionType(const wxArrayTreeItemIds& items)
{
	m_selectionInfo.Clear();
	FossilTreeData::FossilNodeType type(FossilTreeData::FossilNodeTypeInvalid);
	for (size_t i=0; i<items.GetCount(); i++) {

		if (items.Item(i).IsOk() == false) {
			m_selectionInfo.Clear();
			return m_selectionInfo.m_selectionType; // Invalid
		}

		FossilTreeData *data = (FossilTreeData *)m_treeCtrl->GetItemData(items.Item(i));
		if ( !data ) {
			m_selectionInfo.Clear();
			return m_selectionInfo.m_selectionType; // Invalid
		}

		if (data->GetType() == FossilTreeData::FossilNodeTypeRoot && items.GetCount() == 1) {
			// populate the list of paths with all the added paths
			DoGetPaths( items.Item(i), m_selectionInfo.m_paths );
			m_selectionInfo.m_selectionType = FossilTreeData::FossilNodeTypeRoot;
			return m_selectionInfo.m_selectionType;
		}

		if (data->GetType() == FossilTreeData::FossilNodeTypeAddedRoot && items.GetCount() == 1) {
			// populate the list of paths with all the added paths
			DoGetPaths( items.Item(i), m_selectionInfo.m_paths );
			m_selectionInfo.m_selectionType = FossilTreeData::FossilNodeTypeAddedRoot;
			return m_selectionInfo.m_selectionType;
		}

		if (data->GetType() == FossilTreeData::FossilNodeTypeDeletedRoot && items.GetCount() == 1) {
			// populate the list of paths with all the deleted paths
			DoGetPaths( items.Item(i), m_selectionInfo.m_paths );
			m_selectionInfo.m_selectionType = FossilTreeData::FossilNodeTypeDeletedRoot;
			return m_selectionInfo.m_selectionType;
		}

		if (data->GetType() == FossilTreeData::FossilNodeTypeConflictRoot && items.GetCount() == 1) {
			// populate the list of paths with all the conflicted paths
			DoGetPaths( items.Item(i), m_selectionInfo.m_paths );
			m_selectionInfo.m_selectionType = FossilTreeData::FossilNodeTypeConflictRoot;
			return m_selectionInfo.m_selectionType;
		}

		if (data->GetType() == FossilTreeData::FossilNodeTypeModifiedRoot && items.GetCount() == 1) {
			// populate the list of paths with all the conflicted paths
			DoGetPaths( items.Item(i), m_selectionInfo.m_paths );
			m_selectionInfo.m_selectionType = FossilTreeData::FossilNodeTypeModifiedRoot;
			return m_selectionInfo.m_selectionType;
		}

		if (type == FossilTreeData::FossilNodeTypeInvalid &&
		    (data->GetType() == FossilTreeData::FossilNodeTypeFile || data->GetType() == FossilTreeData::FossilNodeTypeRoot)) {
			type = data->GetType();
			m_selectionInfo.m_selectionType = type;
			m_selectionInfo.m_paths.Add(data->GetFilepath());

		} else if ( type == FossilTreeData::FossilNodeTypeInvalid ) {
			type = data->GetType();

		} else if (data->GetType() != type) {
			m_selectionInfo.m_paths.Clear();
			return FossilTreeData::FossilNodeTypeInvalid;

		} else {
			// Same type, just add the path
			m_selectionInfo.m_paths.Add(data->GetFilepath());
		}
	}
	return type;
}

void FossilView::CreateSecondRootMenu(wxMenu* menu)
{
	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_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->Append(XRCID("fossil_revert"),        wxT("Revert"));
	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;
	}

	wxTreeItemIdValue cookie;
	wxTreeItemId item = m_treeCtrl->GetFirstChild(parent, cookie);
	while ( item.IsOk() ) {
		FossilTreeData *data = (FossilTreeData *)m_treeCtrl->GetItemData(item);
		if (data) {
			if (data->GetFilepath().IsEmpty() == false) {
				paths.Add( data->GetFilepath() );
			}

			if (( data->GetType() == FossilTreeData::FossilNodeTypeAddedRoot    ||
			      data->GetType() == FossilTreeData::FossilNodeTypeModifiedRoot ||
			      data->GetType() == FossilTreeData::FossilNodeTypeDeletedRoot) &&

			    m_treeCtrl->ItemHasChildren(item)) {

				DoGetPaths(item, paths);
			}
		}
		item = m_treeCtrl->GetNextChild(parent, cookie);
	}
}
................................................................................
{
	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;
	if(m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString) == false) {
		return;
	}
	bool nonInteractive = m_plugin->GetNonInteractiveMode(event);
	command << m_plugin->GetFossilExeName(nonInteractive) << loginString << wxT(" update ");

	if (m_selectionInfo.m_selectionType != FossilTreeData::FossilNodeTypeRoot) {
		// 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 FossilUpdateHandler(m_plugin, event.GetId(), this));
}

void FossilView::OnCommit(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(" commit ");

	CommitDialog dlg(m_plugin->GetManager()->GetTheApp()->GetTopWindow(), m_selectionInfo.m_paths, m_plugin);
	if (dlg.ShowModal() == wxID_OK) {
		m_selectionInfo.m_paths = dlg.GetPaths();
		if (m_selectionInfo.m_paths.IsEmpty())
			return;


		for (size_t i=0; i<m_selectionInfo.m_paths.GetCount(); i++) {
			command << wxT("\"") << m_selectionInfo.m_paths.Item(i) << wxT("\" ");
		}

		command << wxT(" -m \"");
		command << dlg.GetMesasge();
		command << wxT("\"");
		m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilCommitHandler(m_plugin, event.GetId(), this));
	}
}


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

	command << m_plugin->GetFossilExeName(false) << loginString << wxT(" add ");

	// 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::OnRevert(wxCommandEvent& event)
{
	wxString command;

	// Fossil revert does not require login string
	command << m_plugin->GetFossilExeName(false) << wxT(" revert --recursive ");

	if (m_selectionInfo.m_selectionType != FossilTreeData::FossilNodeTypeRoot) {
		// 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("\" ");
		}
	} else {
		command << wxT(".");
	}
	m_plugin->GetConsole()->Execute(command, m_textCtrlRootDir->GetValue(), new FossilDefaultCommandHandler(m_plugin, event.GetId(), this));
}

void FossilView::OnBranch(wxCommandEvent& event)
{
	wxString command;
	command << m_plugin->GetFossilExeName() << wxT("info --xml ");

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

	command.Clear();
	wxString loginString;
	if(m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString) == false) {
		return;
	}

	// Prompt user for URLs + comment
	FossilCopyDialog dlg(m_plugin->GetManager()->GetTheApp()->GetTopWindow());

	dlg.SetTitle(wxT("Create Branch"));
	dlg.SetSourceURL(fossilInfo.m_sourceUrl);
	dlg.SetTargetURL(fossilInfo.m_sourceUrl);

	if (dlg.ShowModal() == wxID_OK) {
		command.Clear();
		// Prepare the 'copy' command
		bool nonInteractive = m_plugin->GetNonInteractiveMode(event);
		command
		        << m_plugin->GetFossilExeName(nonInteractive)
		        << loginString
		        << wxT(" copy ")
		        << dlg.GetSourceURL()
		        << wxT(" ")
		        << dlg.GetTargetURL()
		        << wxT(" -m \"")
		        << dlg.GetMessage()
		        << wxT("\"");

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

void FossilView::OnTag(wxCommandEvent& event)
{
	wxString command;
	command << m_plugin->GetFossilExeName() << wxT("info --xml ");

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

	// Prompt the login dialog now
	command.Clear();
	wxString loginString;
	if(m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString) == false) {
		return;
	}

	// Prompt user for URLs + comment
	FossilCopyDialog dlg(m_plugin->GetManager()->GetTheApp()->GetTopWindow());

	dlg.SetTitle(wxT("Create Tag"));
	dlg.SetSourceURL(fossilInfo.m_sourceUrl);
	dlg.SetTargetURL(fossilInfo.m_sourceUrl);

	if (dlg.ShowModal() == wxID_OK) {
		// Prepare the 'copy' command
		bool nonInteractive = m_plugin->GetNonInteractiveMode(event);
		command.Clear();
		command
		        << m_plugin->GetFossilExeName(nonInteractive)
		        << loginString
		        << wxT(" copy ")
		        << dlg.GetSourceURL()
		        << wxT(" ")
		        << dlg.GetTargetURL()
		        << wxT(" -m \"")
		        << 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;
	}

	bool nonInteractive = m_plugin->GetNonInteractiveMode(event);
	command << m_plugin->GetFossilExeName(nonInteractive) << loginString << wxT(" resolved ");

	// 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::OnDiff(wxCommandEvent& event)
{
	wxString loginString;
	if(m_plugin->LoginIfNeeded(event, m_textCtrlRootDir->GetValue(), loginString) == false) {
		return;
	}

	bool nonInteractive = m_plugin->GetNonInteractiveMode(event);

	DiffDialog dlg(this, m_plugin->GetManager());
	if(dlg.ShowModal() == wxID_OK) {
		wxString from = dlg.GetFromRevision();
		wxString to   = dlg.GetToRevision();

		if(to.IsEmpty() == false) {
			to.Prepend(wxT(":"));
		}

		// Simple diff
		wxString command;
		command << m_plugin->GetFossilExeName(nonInteractive) << loginString << wxT(" diff -r") << from << to << wxT(" ");
		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 FossilDiffHandler(m_plugin, event.GetId(), this), false);
	}
}

void FossilView::OnPatch(wxCommandEvent& event)
{
	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::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;
	bool nonInteractive = m_plugin->GetNonInteractiveMode(event);

	FossilCheckoutDialog dlg(m_plugin->GetManager()->GetTheApp()->GetTopWindow(), m_plugin);
	if(dlg.ShowModal() == wxID_OK) {
		command << m_plugin->GetFossilExeName(nonInteractive) << loginString << wxT(" co ") << dlg.GetURL() << wxT(" \"") << dlg.GetTargetDir() << wxT("\"");
		m_plugin->GetConsole()->ExecuteURL(command, dlg.GetURL(), new FossilCheckoutHandler(m_plugin, event.GetId(), this), true);
	}
}

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

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

void FossilView::OnLinkEditor(wxCommandEvent& event)
{
	FossilSettingsData fsd = m_plugin->GetSettings();
	if(event.IsChecked())
		fsd.SetFlags(fsd.GetFlags() | FossilLinkEditor);
	else
		fsd.SetFlags(fsd.GetFlags() & ~FossilLinkEditor);
................................................................................
	for(size_t i=0; i<paths.GetCount(); i++) {

		if(wxFileName(paths.Item(i)).IsDir() == false)
			m_plugin->GetManager()->OpenFile(paths.Item(i));

	}
}

void FossilView::OnSwitch(wxCommandEvent& event)
{
/*
	FossilInfo fossilInfo;
	m_plugin->DoGetFossilInfoSync(fossilInfo, m_textCtrlRootDir->GetValue());
	m_plugin->DoSwitchURL(m_textCtrlRootDir->GetValue(), fossilInfo.m_sourceUrl, event);
*/
}

<








<
<







 







<

<
<
<
<
<
<
<
<
<
<


<







 







<
|
<
>
|













<
<
<
<
<
<
<







 







|


|







 







<
<
<



|







 







|






|







 







|









>
>
|







 







|



<
>
|


|

|
|
|
|
|

|
|
|
|
|
|

|
|
|
|
|
|

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

|
|

|
|
|

|
|
|
|
|



|


<
<
<
<
<




|
|
<
<
<
<
<
<

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







|









|
<
<
<
|







 







|

<




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



<
<
<
|
<
<
|

|

<
<
<

<
<
<
<
<

|

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







 







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







 







<
<
<
<
<
<
<
<
<
1

2
3
4
5
6
7
8
9


10
11
12
13
14
15
16
..
27
28
29
30
31
32
33

34










35
36

37
38
39
40
41
42
43
..
70
71
72
73
74
75
76

77

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92







93
94
95
96
97
98
99
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
192
193
194
195
196
197
198



199
200
201
202
203
204
205
206
207
208
209
...
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
...
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
...
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
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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410



411
412
413
414
415
416
417
418
...
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
459
460
...
580
581
582
583
584
585
586




































587
588
589
590
591
592
593
...
674
675
676
677
678
679
680









#include <wx/app.h>

#include "fossil_ui.h"
#include <wx/settings.h>
#include <wx/filedlg.h>
#include <wx/textdlg.h>
#include "plugin.h"
#include "procutils.h"
#include "xmlutils.h"
#include "fossil_login_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 "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_delete"),             FossilView::OnDelete)
	EVT_MENU(XRCID("fossil_open_file"),          FossilView::OnOpenFile)

END_EVENT_TABLE()

FossilView::FossilView( wxWindow* parent, Fossil *plugin )
	: FossilPageBase( parent )
	, m_plugin          ( plugin )
	, m_renflag			(false)
	, m_simpleCommand   ( plugin )
................................................................................
		BuildTree();
	}
}

void FossilView::OnTreeMenu( wxTreeEvent& event )
{
	// Popup the menu

	wxTreeItemId item = m_treeCtrl->GetSelection();

	if (item.IsOk()) {
		FossilTreeData::FossilNodeType type = DoGetSelectionType(item);
		if (type == FossilTreeData::FossilNodeTypeInvalid)
			// Mix or an invalid selection
			return;

		wxMenu menu;
		switch (type) {
		case FossilTreeData::FossilNodeTypeFile:
			CreateFileMenu( &menu );
			break;

		case FossilTreeData::FossilNodeTypeRoot:
			CreateRootMenu( &menu );
			break;







		default:
			return;
		}

		PopupMenu( &menu );
	}
}
................................................................................
	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_commit"),       wxT("Fossil Commit"), wxXmlResource::Get()->LoadBitmap ( wxT ( "svn_checkout" ) ), wxT ( "Fossil Commit" ) );

	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);
................................................................................
}

void FossilView::OnWorkspaceLoaded(wxCommandEvent& event)
{
	event.Skip();
	Workspace *workspace = m_plugin->GetManager()->GetWorkspace();




	if(m_plugin->GetManager()->IsWorkspaceOpen() && workspace) {
		wxXmlNode *fosnode = GetFosNode(workspace);
		wxString wdir = fosnode->GetPropVal(wxT("wdir"), wxEmptyString);

		if (wdir != wxEmptyString)
			m_textCtrlRootDir->SetValue(wdir);
		else
			m_textCtrlRootDir->SetValue(workspace->GetWorkspaceFileName().GetPath());
		BuildTree();
	}
}
................................................................................
		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::FossilNodeTypeDir, dirFiles);
				dirFiles.Empty();
			}
			dirFiles.Add(file);
			last = folder;
		}
	}
	DoAddNode(last, 6, FossilTreeData::FossilNodeTypeDir, 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)) {
................................................................................
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, title));

		// 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));
			wxString path;
			path << title << wxFileName::GetPathSeparator() << filename;
			m_treeCtrl->AppendItem(parent, filename, DoGetIconIndex(filename), DoGetIconIndex(filename), new FossilTreeData(FossilTreeData::FossilNodeTypeFile, path));
		}
	}
}

int FossilView::DoGetIconIndex(const wxString& filename)
{
	FileExtManager::Init();
................................................................................
	default:
		iconIndex = 11;
		break;
	}
	return iconIndex;
}

FossilTreeData::FossilNodeType FossilView::DoGetSelectionType(const wxTreeItemId& item)
{
	m_selectionInfo.Clear();
	FossilTreeData::FossilNodeType type(FossilTreeData::FossilNodeTypeInvalid);


	if (item.IsOk() == false) {
			m_selectionInfo.Clear();
			return m_selectionInfo.m_selectionType; // Invalid
	}

	FossilTreeData *data = (FossilTreeData *)m_treeCtrl->GetItemData(item);
	if ( !data ) {
		m_selectionInfo.Clear();
		return m_selectionInfo.m_selectionType; // Invalid
	}

	if (data->GetType() == FossilTreeData::FossilNodeTypeRoot) {
		// populate the list of paths with all the added paths
		DoGetPaths( item, m_selectionInfo.m_paths );
		m_selectionInfo.m_selectionType = FossilTreeData::FossilNodeTypeRoot;
		return m_selectionInfo.m_selectionType;
	}

	if (data->GetType() == FossilTreeData::FossilNodeTypeDir) {
		// populate the list of paths with all the added paths
		DoGetPaths( item, m_selectionInfo.m_paths );
		m_selectionInfo.m_selectionType = FossilTreeData::FossilNodeTypeDir;
		return m_selectionInfo.m_selectionType;
	}






















	if (type == FossilTreeData::FossilNodeTypeInvalid &&
		(data->GetType() == FossilTreeData::FossilNodeTypeFile)) {
		type = data->GetType();
		m_selectionInfo.m_selectionType = type;
		m_selectionInfo.m_paths.Add(data->GetFilepath());

	} else if ( type == FossilTreeData::FossilNodeTypeInvalid ) {
		type = data->GetType();

	} else if (data->GetType() != type) {
		m_selectionInfo.m_paths.Clear();
		return FossilTreeData::FossilNodeTypeInvalid;

	} else {
		// Same type, just add the path
		m_selectionInfo.m_paths.Add(data->GetFilepath());
	}

	return type;
}

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





}

void FossilView::CreateFileMenu(wxMenu* menu)
{
	menu->Append(XRCID("fossil_open_file"),  wxT("Open File..."));
	menu->AppendSeparator();






	menu->Append(XRCID("fossil_delete"),  wxT("Delete"));

















}

void FossilView::DoGetPaths(const wxTreeItemId& parent, wxArrayString& paths)
{
	if ( m_treeCtrl->ItemHasChildren(parent) == false ) {
		return;
	}
wxLogMessage(wxT("In DoGetPaths()"));
	wxTreeItemIdValue cookie;
	wxTreeItemId item = m_treeCtrl->GetFirstChild(parent, cookie);
	while ( item.IsOk() ) {
		FossilTreeData *data = (FossilTreeData *)m_treeCtrl->GetItemData(item);
		if (data) {
			if (data->GetFilepath().IsEmpty() == false) {
				paths.Add( data->GetFilepath() );
			}

			if (( data->GetType() == FossilTreeData::FossilNodeTypeDir) &&



					m_treeCtrl->ItemHasChildren(item)) {

				DoGetPaths(item, paths);
			}
		}
		item = m_treeCtrl->GetNextChild(parent, cookie);
	}
}
................................................................................
{
	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));
}























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






	command << m_plugin->GetFossilExeName() << wxT(" commit --no-warnings");

	CommitDialog dlg(m_plugin->GetManager()->GetTheApp()->GetTopWindow(), m_plugin);
	if (dlg.ShowModal() == wxID_OK) {









		command << wxT(" -m \"");
		command << dlg.GetMessage();
		command << wxT("\"");




















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





























































































































































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::OnClearOutputUI(wxUpdateUIEvent& event)
{
	event.Enable(m_plugin->GetConsole()->IsEmpty() == false);
}





































void FossilView::OnLinkEditor(wxCommandEvent& event)
{
	FossilSettingsData fsd = m_plugin->GetSettings();
	if(event.IsChecked())
		fsd.SetFlags(fsd.GetFlags() | FossilLinkEditor);
	else
		fsd.SetFlags(fsd.GetFlags() & ~FossilLinkEditor);
................................................................................
	for(size_t i=0; i<paths.GetCount(); i++) {

		if(wxFileName(paths.Item(i)).IsDir() == false)
			m_plugin->GetManager()->OpenFile(paths.Item(i));

	}
}









Changes to Fossil/fossil_view.h.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
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
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
@file
Subclass of FossilPageBase
*/

#include "fossil_ui.h"
#include "xmlutils.h"
#include "workspace.h"
//#include "fossilinfo.h"
#include "fossilcommand.h"
#include "fossiltreedata.h"

class Fossil;
class wxMenu;

class FossilPageSelectionInfo {

public:
	wxArrayString            m_paths;
	FossilTreeData::FossilNodeType m_selectionType;

public:
	FossilPageSelectionInfo() : m_selectionType(FossilTreeData::FossilNodeTypeInvalid) {}
	virtual ~FossilPageSelectionInfo() {}

	void Clear() {
................................................................................
};

/** 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,
		FossilInfo_Info
	};
*/

protected:
	void                     CreateGUIControls();
	void                     ClearAll();
	void                     DoAddNode(const wxString &title, int imgId, FossilTreeData::FossilNodeType nodeType, const wxArrayString &files);
	int                      DoGetIconIndex(const wxString &filename);
	FossilTreeData::FossilNodeType DoGetSelectionType(const wxArrayTreeItemIds &items);
	void                     DoGetPaths(const wxTreeItemId &parent, wxArrayString &paths);
	void                     DoLinkEditor();

protected:
	// Menu management
	void CreateFileMenu      (wxMenu *menu);
	void CreateRootMenu      (wxMenu *menu);
................................................................................
	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:







<









|







 







<



<
<
<
<
<
<
<
<
<





|







 







<







5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
..
32
33
34
35
36
37
38

39
40
41









42
43
44
45
46
47
48
49
50
51
52
53
54
..
87
88
89
90
91
92
93

94
95
96
97
98
99
100
@file
Subclass of FossilPageBase
*/

#include "fossil_ui.h"
#include "xmlutils.h"
#include "workspace.h"

#include "fossilcommand.h"
#include "fossiltreedata.h"

class Fossil;
class wxMenu;

class FossilPageSelectionInfo {

public:
	wxArrayString	m_paths;
	FossilTreeData::FossilNodeType m_selectionType;

public:
	FossilPageSelectionInfo() : m_selectionType(FossilTreeData::FossilNodeTypeInvalid) {}
	virtual ~FossilPageSelectionInfo() {}

	void Clear() {
................................................................................
};

/** Implementing FossilPageBase */
class FossilView : public FossilPageBase
{
	Fossil*         m_plugin;
	bool			m_renflag;

	FossilCommand           m_simpleCommand;
	FossilPageSelectionInfo m_selectionInfo;










protected:
	void                     CreateGUIControls();
	void                     ClearAll();
	void                     DoAddNode(const wxString &title, int imgId, FossilTreeData::FossilNodeType nodeType, const wxArrayString &files);
	int                      DoGetIconIndex(const wxString &filename);
	FossilTreeData::FossilNodeType DoGetSelectionType(const wxTreeItemId &item);
	void                     DoGetPaths(const wxTreeItemId &parent, wxArrayString &paths);
	void                     DoLinkEditor();

protected:
	// Menu management
	void CreateFileMenu      (wxMenu *menu);
	void CreateRootMenu      (wxMenu *menu);
................................................................................
	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);


	DECLARE_EVENT_TABLE()

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

public:

Deleted Fossil/fossilinfo.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef FOSSILINFO_H
#define FOSSILINFO_H

#include <wx/string.h>

class FossilInfo
{
public:
	wxString m_url;
	wxString m_sourceUrl;
	wxString m_revision;
	wxString m_author;
	wxString m_date;

public:
	FossilInfo() {}
	~FossilInfo() {}
};

#endif // FOSSILINFO_H
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Changes to Fossil/fossiltreedata.h.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

class FossilTreeData : public wxTreeItemData
{
public:
	enum FossilNodeType {
		FossilNodeTypeInvalid = -1,
		FossilNodeTypeRoot,
		FossilNodeTypeModifiedRoot,
		FossilNodeTypeUnversionedRoot,
		FossilNodeTypeDeletedRoot,
		FossilNodeTypeAddedRoot,
		FossilNodeTypeConflictRoot,
		FossilNodeTypeFile
	};

	FossilNodeType m_type;
	wxString    m_filepath;

public:







<
<
|
<
<







5
6
7
8
9
10
11


12


13
14
15
16
17
18
19

class FossilTreeData : public wxTreeItemData
{
public:
	enum FossilNodeType {
		FossilNodeTypeInvalid = -1,
		FossilNodeTypeRoot,


		FossilNodeTypeDir,


		FossilNodeTypeFile
	};

	FossilNodeType m_type;
	wxString    m_filepath;

public: