20#include "../../kernel/core/ui/language.hpp"
21#include "../NumeReWindow.h"
41 : wxDialog(parent, wxID_ANY,
_guilang.
get("GUI_DLG_REVISIONDIALOG_TITLE"), wxDefaultPosition, wxSize(750, 500), wxRESIZE_BORDER | wxCAPTION |
wxCLOSE_BOX), revisions(rev)
44 currentFileName = fileNameAndPath.substr(fileNameAndPath.find_last_of(
"/\\")+1);
45 currentFilePath = fileNameAndPath.substr(0, fileNameAndPath.find_last_of(
"/\\")+1);
47 wxBoxSizer* vsizer =
new wxBoxSizer(wxVERTICAL);
48 revisionList =
new wxcode::wxTreeListCtrl(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_TWIST_BUTTONS | wxTR_FULL_ROW_HIGHLIGHT | wxTR_EXTENDED | wxTR_MULTIPLE);
49 revisionList->AddColumn(
_guilang.
get(
"GUI_DLG_REVISIONDIALOG_REV"), 150);
50 revisionList->AddColumn(
_guilang.
get(
"GUI_DLG_REVISIONDIALOG_DATE"), 150);
51 revisionList->AddColumn(
_guilang.
get(
"GUI_DLG_REVISIONDIALOG_COMMENT"), 450);
52 revisionList->AddRoot(currentFileName);
54 populateRevisionList();
56 vsizer->Add(revisionList, 1, wxEXPAND | wxALL, 5);
57 vsizer->Add(CreateButtonSizer(wxOK), 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
76 wxTreeItemId currentItem;
79 for (
size_t i = 0; i < revList.size(); i++)
82 if (revList[i].substr(0, 3) ==
"tag")
85 wxTreeItemId currentTagItem =
revisionList->AppendItem(currentItem, revList[i].substr(0, revList[i].find(
'\t')));
86 revisionList->SetItemText(currentTagItem, 1, revList[i].substr(revList[i].find(
'\t')+1, revList[i].find(
'\t', revList[i].find(
'\t')+1) - revList[i].find(
'\t')-1));
87 revisionList->SetItemText(currentTagItem, 2, revList[i].substr(revList[i].rfind(
'\t')+1));
89 revisionList->SetItemTextColour(currentTagItem, wxColour(0, 0, 192));
95 revisionList->SetItemText(currentItem, 1, revList[i].substr(revList[i].find(
'\t')+1, revList[i].find(
'\t', revList[i].find(
'\t')+1) - revList[i].find(
'\t')-1));
96 revisionList->SetItemText(currentItem, 2, revList[i].substr(revList[i].rfind(
'\t')+1));
98 if (
revisionList->GetItemText(currentItem, 2).substr(0, 5) ==
"MOVE:")
99 revisionList->SetItemTextColour(currentItem, wxColour(128, 0, 0));
101 if (
revisionList->GetItemText(currentItem, 2).substr(0, 7) ==
"RENAME:")
102 revisionList->SetItemTextColour(currentItem, wxColour(0, 128, 0));
104 if (
revisionList->GetItemText(currentItem, 2).substr(0, 8) ==
"RESTORE:")
105 revisionList->SetItemTextColour(currentItem, wxColour(0, 128, 128));
108 if (
revisionList->GetItemText(currentItem, 2).substr(0, 4) ==
"DIFF")
111 if (
revisionList->GetItemText(currentItem, 0) == currentRev)
174 popUpmenu.AppendSeparator();
180 popUpmenu.AppendSeparator();
188 PopupMenu(&popUpmenu, event.GetPoint());
202 wxString revID =
revisionList->GetItemText(event.GetItem());
225 switch (event.GetId())
233 wxArrayTreeItemIds selectedIds;
245 wxTextEntryDialog textdialog(
this,
_guilang.
get(
"GUI_DLG_REVISIONDIALOG_PROVIDETAGCOMMENT"),
_guilang.
get(
"GUI_DLG_REVISIONDIALOG_PROVIDETAGCOMMENT_TITLE"), wxEmptyString, wxCENTER | wxOK | wxCANCEL);
246 int ret = textdialog.ShowModal();
261 int ret = wxMessageBox(
_guilang.
get(
"GUI_DLG_REVISIONDIALOG_CONFIRM_RESTORE", revID.ToStdString()),
_guilang.
get(
"GUI_DLG_REVISIONDIALOG_CONFIRM_RESTORE_HEAD"), wxOK | wxCANCEL | wxCENTER | wxICON_QUESTION,
this);
wxString getRevision(size_t nRevision)
Returns the contents of the selected revision.
void restoreRevision(size_t nRevision, const wxString &targetFile)
This method will restore the contents of the selected revision.
wxArrayString getRevisionList()
This method returns a log-like list of revisions.
size_t tagRevision(size_t nRevision, const wxString &tagComment)
Allows the user to tag a selected revision with the passed comment.
wxString compareRevisions(const wxString &rev1, const wxString &rev2)
This member function compares two revisions with each other and returns the differnces as unified dif...
wxString getCurrentRevision()
This method returns the revision identifier of the current revision.
This class handles the internal language system and returns the language strings of the selected lang...
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
This class is the actual NumeRe main frame. The application's logic is implemented here.
void ShowRevision(const wxString &revisionName, const wxString &revisionContent)
This member function creates a new editor page and copies the passed revision contents to this page.
void reloadFileIfOpen(const wxString &fname, bool force=false)
Reloads a file if it is open in any editor.
This class represents the dialog listing the file revisions of the current selected file.
void compareRevisions(const wxString &rev1, const wxString &rev2)
This method compares two defined revisions and opens them as a diff file in the editor.
void OnMenuEvent(wxCommandEvent &event)
This method handles the menu events emitted from the context menu.
void OnRightClick(wxTreeEvent &event)
This method displays the context menu containing the actions.
FileRevisions * revisions
void OnItemActivated(wxTreeEvent &event)
This method displays the double-clicked revision.
wxcode::wxTreeListCtrl * revisionList
void populateRevisionList()
This method pupulates the tree list ctrl.
void showRevision(const wxString &revString)
This method displays the selected revision in the editor.
NumeReWindow * mainWindow
@ ID_REVISIONDIALOG_RESTORE
@ ID_REVISIONDIALOG_COMPARE
@ ID_REVISIONDIALOG_REFRESH
static Matrix selection(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Extracts a selection from a matrix iterating through two matrices simultaneously.
std::string get(const std::string &sUrl, const std::string &sUserName, const std::string &sPassWord)
Get the contents of a URL.