Skip to content

Commit

Permalink
IDE-856 Combine ECL files to a MOD file using right click menu in the…
Browse files Browse the repository at this point in the history
… repository

Signed-off-by: dehilsterlexis <david.dehilster@lexisnexis.com>
  • Loading branch information
dehilsterlexis committed May 31, 2019
1 parent 52791aa commit 8c32185
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
6 changes: 6 additions & 0 deletions eclide/RepositoryFrame.h
Expand Up @@ -33,6 +33,7 @@ struct ContextState
bool CanMoveAttribute;
bool CanDeleteAttribute;
bool CanLabel;
bool CanCombine;
};

template<typename T>
Expand Down Expand Up @@ -106,6 +107,7 @@ class CRepositoryFrameT : public CRepositorySlotImpl,
m.EnableMenuItem(ID_REPOSITORY_MOVEATTRIBUTE, state.CanMoveAttribute ? MF_ENABLED : MF_GRAYED);
m.EnableMenuItem(ID_REPOSITORY_COPYATTRIBUTE, state.CanMoveAttribute ? MF_ENABLED : MF_GRAYED);
m.EnableMenuItem(ID_REPOSITORY_DELETEATTRIBUTE, state.CanDeleteAttribute ? MF_ENABLED : MF_GRAYED);
m.EnableMenuItem(ID_FILE_CREATEMODFILE, state.CanCombine ? MF_ENABLED : MF_GRAYED);
m.EnableMenuItem(ID_REPOSITORY_LABEL, state.CanLabel ? MF_ENABLED : MF_GRAYED);
m.EnableMenuItem(ID_REPOSITORY_REFRESH, MF_ENABLED);

Expand Down Expand Up @@ -316,6 +318,9 @@ class CRepositoryFrameT : public CRepositorySlotImpl,
case ID_CHANGETYPELOCAL_SALT:
pT->m_view.DoChangeAttributeType(s.attrs[0].get(), s.attrs[0]->GetLabel(), ATTRIBUTE_TYPE_SALT);
break;
case ID_FILE_CREATEMODFILE:
pT->m_view.DoCreateModFile(s.attrs);
break;
default:
if (pick >= ID_REPOSITORY_INVOKE + 100)
{
Expand Down Expand Up @@ -380,6 +385,7 @@ class CRepositoryFrameT : public CRepositorySlotImpl,

state.CanOpen = s.attrs.size() > 0;
state.CanOpenBuilder = s.attrs.size() > 0;
state.CanCombine = s.attrs.size() > 1;
state.CanOpenInExplorer = (s.mods.size() + s.attrs.size() == 1);
state.CanPrint = false;
state.CanCopy = s.mods.size() == 0 && s.attrs.size() > 0;
Expand Down
1 change: 1 addition & 0 deletions en_us/en_us.rc
Expand Up @@ -1728,6 +1728,7 @@ BEGIN
MENUITEM "Copy File", ID_REPOSITORY_COPYATTRIBUTE
MENUITEM "Move File", ID_REPOSITORY_MOVEATTRIBUTE
MENUITEM "Delete File\tDel", ID_REPOSITORY_DELETEATTRIBUTE
MENUITEM "Create Mod File", ID_FILE_CREATEMODFILE
MENUITEM SEPARATOR
MENUITEM "Refresh", ID_REPOSITORY_REFRESH
MENUITEM "Collapse All", ID_REPOSITORY_COLLAPSEALL
Expand Down
3 changes: 2 additions & 1 deletion en_us/resource.h
Expand Up @@ -819,6 +819,7 @@
#define ID_GO_GENERATE 33112
#define ID_REPOSITORY_COLLAPSEALL 33113
#define ID_ECL_HELP 33114
#define ID_FILE_CREATEMODFILE 33115
#define ATL_IDS_IDLEMESSAGE 0xE001
#define ATL_IDS_SCSIZE 0xEF00
#define ATL_IDS_SCMOVE 0xEF01
Expand Down Expand Up @@ -847,7 +848,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 61414
#define _APS_NEXT_COMMAND_VALUE 33115
#define _APS_NEXT_COMMAND_VALUE 33116
#define _APS_NEXT_CONTROL_VALUE 543
#define _APS_NEXT_SYMED_VALUE 61503
#endif
Expand Down
2 changes: 0 additions & 2 deletions wlib/AttrListDlg.cpp
Expand Up @@ -367,8 +367,6 @@ std::istream& safeGetline(std::istream& is, std::string& t)

IModule * DoConfirmImportDlg(HWND hwndParent, const boost::filesystem::path & path)
{
#define IMPORT_MARKER _T("//Import:")
#define COMMENT_MARKER _T("//Comment:")
std::ifstream ifs(path.c_str());
if (ifs) {
AttrVector attrs;
Expand Down
3 changes: 3 additions & 0 deletions wlib/AttrListDlg.h
@@ -1,5 +1,8 @@
#pragma once

#define IMPORT_MARKER _T("//Import:")
#define COMMENT_MARKER _T("//Comment:")

#include "wlib.h"
#include <Repository.h>
#include <Workspace.h>
Expand Down
22 changes: 22 additions & 0 deletions wlib/RepositoryView.h
Expand Up @@ -10,6 +10,7 @@
#include "utilDateTime.h"
#include <ModuleHelper.h>
#include "AttrListDlg.h"
#include "ModFileRepository.h"

template<typename T>
class CRepositoryViewT
Expand Down Expand Up @@ -453,6 +454,27 @@ class CRepositoryViewT
}
}
}
void DoCreateModFile(IAttributeVector & attrs)
{
static const TCHAR szFilter[] = _T("Mod Files(*.mod)\0*.mod\0All Files (*.*)\0*.*\0\0");
T* pT = static_cast<T*>(this);
CFileDialogEx wndFileDialog(FALSE, _T(".mod"), _T("Unamed.mod"), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, pT->m_hWnd);
if (IDOK == wndFileDialog.DoModal())
{
CUnicodeFile file;
if (file.Create(wndFileDialog.GetPathName()))
{
for (IAttributeVector::iterator itr = attrs.begin(); itr != attrs.end(); ++itr)
{
file.Write(IMPORT_MARKER);
file.Write(itr->get()->GetQualifiedLabel(true));
file.Write(_T("\n"));
file.Write(itr->get()->GetText());
}
file.Close();
}
}
}
bool Select(const TCHAR* label, bool bExpand=false)
{
return TreeNode::Select(label, m_Root, bExpand);
Expand Down

0 comments on commit 8c32185

Please sign in to comment.