[GME-commit]
GMESRC/Tools/ModelMigrate/FrontEnd StereotypeCastDlg.cpp,NONE,1.1
StereotypeCastDlg.h,NONE,1.1 FileTransDlg.cpp,1.1,1.2
FileTransDlg.h,1.1,1.2 FrontEnd.rc,1.1,1.2 FrontEnd.vcproj,1.2,1.3
OptionsDlg.cpp,1.1,1.2 OptionsDlg.h,1.1,1.2 Rule.cpp,1.1,1.2
Rule.h,1.1,1.2 RuleEditorDlg.cpp,1.1,1.2 RuleEditorDlg.h,1.1,1.2
RuleListCtrl.cpp,1.1,1.2 RuleListCtrl.h,1.1,1.2 resource.h,1.1,1.2
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Thu Feb 2 20:37:57 CST 2006
- Previous message: [GME-commit]
GMESRC/GME/Gme GMEApp.cpp,1.136,1.137 GMEApp.h,1.31,1.32
- Next message: [GME-commit]
GMESRC/Tools/ModelMigrate/FrontEnd/res TAtom2Model.xsl,NONE,1.1
TModel2Atom.xsl,NONE,1.1 TParadigmGUIDChange.xsl,NONE,1.1
TParadigmNameChange.xsl,NONE,1.1
TParadigmVersionChange.xsl,NONE,1.1 TRemoveGlobalAttr.xsl,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd
In directory escher:/tmp/cvs-serv27414/FrontEnd
Modified Files:
FileTransDlg.cpp FileTransDlg.h FrontEnd.rc FrontEnd.vcproj
OptionsDlg.cpp OptionsDlg.h Rule.cpp Rule.h RuleEditorDlg.cpp
RuleEditorDlg.h RuleListCtrl.cpp RuleListCtrl.h resource.h
Added Files:
StereotypeCastDlg.cpp StereotypeCastDlg.h
Log Message:
Enhancing with multiple script generation (1 script per rule).
Adding Model2Atom, Atom2Model, Paradigm attr change rules.
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: RuleListCtrl.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/RuleListCtrl.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RuleListCtrl.h 16 Nov 2005 16:01:17 -0000 1.1
--- RuleListCtrl.h 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 2,5 ****
--- 2,6 ----
#include "Rule.h"
+ class RuleEditorDlg;
// RuleListCtrl
***************
*** 27,32 ****
public:
! CString genAll();
! CString genSelected();
void add();
--- 28,36 ----
public:
! void setParent( RuleEditorDlg* pDlg);
! void reset();
!
! CString genAll( bool pSeparateFiles);
! CString genSelected( bool pSeparateFiles);
void add();
***************
*** 51,54 ****
--- 55,59 ----
void addNewItem( int pChoice);
int gen( const std::string& pOutputFileName, const std::vector<int>& pSelectVec);
+ int genIntoSeparate( const std::string& pOutputFileName, const std::vector<int>& pSelectVec);
int rowID;
***************
*** 64,67 ****
--- 69,74 ----
int insertItem( const Rule& pRule);
void createPopupMenu( CPoint point);
+
+ RuleEditorDlg* m_parentDlg;
};
Index: Rule.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/Rule.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Rule.cpp 16 Nov 2005 16:01:17 -0000 1.1
--- Rule.cpp 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 83,89 ****
}
}
!
! /*static*/ const char * Rule::rule_templates[] =
! { "TKindNameChange.xsl"
, "TAttrNameChange.xsl"
, "TAttrTypeChange.xsl"
--- 83,89 ----
}
}
! //static const int Rule::rule_nmb = 14; // modify this in the Rule.h
! /*static*/ const char * Rule::rule_templates[] = // these strings are used as prompts for the
! { "TKindNameChange.xsl" // new rule dialog
, "TAttrNameChange.xsl"
, "TAttrTypeChange.xsl"
***************
*** 94,97 ****
--- 94,102 ----
, "TRemoveGlobalAttr.xsl"
, "TRemoveLocalAttr.xsl"
+ , "TAtom2Model.xsl"
+ , "TModel2Atom.xsl"
+ , "TParadigmGUIDChange.xsl"
+ , "TParadigmNameChange.xsl"
+ , "TParadigmVersionChange.xsl"
};
***************
*** 105,108 ****
--- 110,116 ----
void Rule::gen( std::ostream& pFstream)
{
+ // Script is a simple class, which is able for Search&Replace operations
+ // In case of more complex rules like 'MoveDown' more sophisticated replace
+ // operations are needed, so a special class handles them
Script * scr = 0;
if( m_type == Rule::MoveDownElem)
***************
*** 169,172 ****
--- 177,200 ----
{
sum = pParams[0] + " (in " + pParams[1] + ") remove";
+ }
+ else if( pTyp == Rule::Atom2Model)
+ {
+ sum = "Atom2Model cast of " + pParams[0];
+ }
+ else if( pTyp == Rule::Model2Atom)
+ {
+ sum = "Model2Atom cast of " + pParams[0];
+ }
+ else if( pTyp == Rule::ParadigmGUIDChange)
+ {
+ sum = "Paradigm GUID change";
+ }
+ else if( pTyp == Rule::ParadigmNameChange)
+ {
+ sum = "Paradigm name change: '" + pParams[0] + "' -> '" + pParams[1] + "'";
+ }
+ else if( pTyp == Rule::ParadigmVersionChange)
+ {
+ sum = "Paradigm version change: '" + pParams[0] + "' -> '" + pParams[1] + "'";
}
Index: FileTransDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/FileTransDlg.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FileTransDlg.cpp 16 Nov 2005 16:01:17 -0000 1.1
--- FileTransDlg.cpp 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 16,19 ****
--- 16,20 ----
#define DEF_APPEND_STR "_out"
#define DEF_OUTPUTDIR_STR ""
+ #define DEF_INTERMEDDIR_STR ""
/*static*/ CString FileTransDlg::m_strSection = "Options";
/*static*/ CString FileTransDlg::m_strDirStringItem = "DefaultDir";
***************
*** 23,27 ****
/*static*/ CString FileTransDlg::m_strOutputDirStringItem = "OutputDir";
/*static*/ CString FileTransDlg::m_strOutputDirStr = DEF_OUTPUTDIR_STR;
!
// FileTransDlg dialog
--- 24,29 ----
/*static*/ CString FileTransDlg::m_strOutputDirStringItem = "OutputDir";
/*static*/ CString FileTransDlg::m_strOutputDirStr = DEF_OUTPUTDIR_STR;
! /*static*/ CString FileTransDlg::m_strIntermedDirStringItem = "IntermedDir";
! /*static*/ CString FileTransDlg::m_strIntermedDirStr = DEF_INTERMEDDIR_STR;
// FileTransDlg dialog
***************
*** 106,111 ****
CWinApp* pApp = AfxGetApp();
! CString strV1, strV2, strV3, strV4 ;
! loadMyOptions( strV1, strV2, strV3, strV4);
loadDir( strV1);
--- 108,113 ----
CWinApp* pApp = AfxGetApp();
! CString strV1, strV2, strV3, strV4, strV5 ;
! loadMyOptions( strV1, strV2, strV3, strV4, strV5);
loadDir( strV1);
***************
*** 121,126 ****
}
- FileTransDlg::m_strAppendStr = strV3.IsEmpty()? DEF_APPEND_STR:strV3;
FileTransDlg::m_strOutputDirStr = strV4;
return TRUE; // return TRUE unless you set the focus to a control
--- 123,128 ----
}
FileTransDlg::m_strOutputDirStr = strV4;
+ FileTransDlg::m_strIntermedDirStr = strV5;
return TRUE; // return TRUE unless you set the focus to a control
***************
*** 163,173 ****
m_cx = cx;
m_cy = cy;
! CRect rect, r1, r2;
int sy = 0;
! if( cx && cy && m_lstFiles.GetSafeHwnd() && m_log.GetSafeHwnd()) // if minimized cx == cy == 0
{
m_lstFiles.GetWindowRect( &r1); ScreenToClient( &r1);
m_log.GetWindowRect( &r2); ScreenToClient( &r2);
rect = r1;
--- 165,178 ----
m_cx = cx;
m_cy = cy;
! CRect rect, r0, r1, r2;
int sy = 0;
! if( cx && cy && m_lstScript.GetSafeHwnd() && m_lstFiles.GetSafeHwnd() && m_log.GetSafeHwnd()) // if minimized cx == cy == 0
{
+ m_lstScript.GetWindowRect( &r0); ScreenToClient( &r0);
m_lstFiles.GetWindowRect( &r1); ScreenToClient( &r1);
m_log.GetWindowRect( &r2); ScreenToClient( &r2);
+ m_lstScript.SetWindowPos( 0, 0, 0, cx - 2*r0.left, r0.Height(), SWP_NOMOVE|SWP_NOZORDER|SWP_SHOWWINDOW);
+
rect = r1;
***************
*** 178,182 ****
rect.right = cx - rect.left; // maintain margin
m_lstFiles.SetWindowPos( 0, 0, 0, rect.Width(), rect.Height(), SWP_NOMOVE|SWP_NOZORDER|SWP_SHOWWINDOW);
-
rect.top = rect.bottom + r2.top - r1.bottom;
rect.bottom = cy - 13;
--- 183,186 ----
***************
*** 204,213 ****
void FileTransDlg::OnBnClickedButton3()
{
! CFileDialog dlg( TRUE, "xsl", 0, 0,
! "XSLT Files (*.xsl;*.xslt)|*.xsl; *.xslt|All Files (*.*)|*.*||");
! if( dlg.DoModal() == IDOK)
! {
! m_lstScript.addFile( dlg.GetFileName(), dlg.GetPathName());
! }
}
--- 208,217 ----
void FileTransDlg::OnBnClickedButton3()
{
! selScript();
! }
!
! void FileTransDlg::OnBnClickedButton5()
! {
! selScriptDir();
}
***************
*** 222,236 ****
}
- void FileTransDlg::OnBnClickedButton5()
- {
- options();
- }
-
void FileTransDlg::options()
{
OptionsDlg dlg;
// load the current values from registry
! loadMyOptions( dlg.m_dir, dlg.m_scr, dlg.m_append, dlg.m_outputDir);
! if( dlg.m_append.IsEmpty()) dlg.m_append = FileTransDlg::m_strAppendStr;
if( dlg.DoModal() == IDOK)
--- 226,234 ----
}
void FileTransDlg::options()
{
OptionsDlg dlg;
// load the current values from registry
! loadMyOptions( dlg.m_dir, dlg.m_scr, dlg.m_append, dlg.m_outputDir, dlg.m_intermediateFilesDir);
if( dlg.DoModal() == IDOK)
***************
*** 239,245 ****
FileTransDlg::m_strAppendStr = dlg.m_append;
FileTransDlg::m_strOutputDirStr = dlg.m_outputDir;
// save into registry
! saveMyOptions( dlg.m_dir, dlg.m_scr, dlg.m_append, dlg.m_outputDir);
}
}
--- 237,244 ----
FileTransDlg::m_strAppendStr = dlg.m_append;
FileTransDlg::m_strOutputDirStr = dlg.m_outputDir;
+ FileTransDlg::m_strIntermedDirStr = dlg.m_intermediateFilesDir;
// save into registry
! saveMyOptions( dlg.m_dir, dlg.m_scr, dlg.m_append, dlg.m_outputDir, dlg.m_intermediateFilesDir);
}
}
***************
*** 326,332 ****
std::vector< std::string> scripts = m_lstScript.getAllFiles();
if( scripts.size() == 0 || scripts[0].empty()) { appendLn( "Invalid or no entries in script list!"); return; }
! bool multi = scripts.size() > 1;
! CString xsltScript, f_In, f_Out, f_OrigOut;
appendLn( "Processing started on " + CTime::GetCurrentTime().Format("%b %d, %H:%M:%S"));
--- 325,344 ----
std::vector< std::string> scripts = m_lstScript.getAllFiles();
if( scripts.size() == 0 || scripts[0].empty()) { appendLn( "Invalid or no entries in script list!"); return; }
! bool multi_step = scripts.size() > 1;
!
! // we test wether output files can be created safely (without overwriting input files)
! bool do_append_filenames = false;
! if( FileTransDlg::m_strAppendStr.IsEmpty() // no appended string
! && ( FileTransDlg::m_strOutputDirStr.IsEmpty() // and no valid target dir
! || !directoryExists( FileTransDlg::m_strOutputDirStr)))
! {
! appendLn( "Invalid options found, output filename must be different from input filename, see Options menu!");
! appendLn( CString( "Using the input directory as the target directory, filenames will be appended with \"") + DEF_APPEND_STR + "\"!");
! FileTransDlg::m_strAppendStr = DEF_APPEND_STR;
! }
!
! CString xsltScript, f_In, f_Out;
+ appendLn( "");
appendLn( "Processing started on " + CTime::GetCurrentTime().Format("%b %d, %H:%M:%S"));
***************
*** 337,423 ****
CString err;
f_Out = f_In = pToRun[i].c_str();
!
! // transform a 'file.xme' to 'file_out.xme' in single case
! // to 'file_out01.xme' multiple case
int dpos = f_Out.ReverseFind('.');
if( dpos == -1) f_Out += FileTransDlg::m_strAppendStr;
! else f_Out.Insert( dpos, FileTransDlg::m_strAppendStr + (multi?"01":""));
! // change the output directory if specified
! if( directoryExists( FileTransDlg::m_strOutputDirStr)) // status fetched succesfully
{
! dpos = f_Out.ReverseFind('\\');
! if( dpos == -1) // not found '\\'
{
! f_Out.Insert( 0, '\\');
! f_Out.Insert( 0, FileTransDlg::m_strOutputDirStr);
}
else
{
! f_Out = FileTransDlg::m_strOutputDirStr + '\\' + f_Out.Right( f_Out.GetLength() - dpos - 1);
}
}
!
! xsltScript = scripts[0].c_str();
!
! // do the 1st step separately
! apply( xsltScript, f_In, f_Out, err);
!
! // analyze error
! if( !err.IsEmpty())
! {
! fail.push_back( pToRun[i]);
!
! appendLn( f_In + (multi?" step 1 in":"") + " transformation failed: " + err);
! }
! else
{
! ok.push_back( (LPCTSTR) f_Out);
!
! appendLn( f_In + (multi?" step 1 in":"") + " transformation OK.");
! }
- if( multi)
- {
bool any_error = false;
! dpos = f_Out.ReverseFind('.');
! if( dpos != -1 && dpos >= 2) f_OrigOut = f_Out.Left( dpos-2); // "01" was already there
! else f_OrigOut = f_Out;
! // do the remaining steps
! for( unsigned int j = 1; err.IsEmpty() && j < scripts.size(); ++j)
{
! err.Empty();
! CString j_str;
if( j+1 != scripts.size()) // the intermediate files look like: a_out01.xme
j_str.Format( "%.2d", j+1);
- f_In = f_Out;
- f_Out = f_OrigOut + j_str + ".xme";
xsltScript = scripts[j].c_str();
// invoke step i
apply( xsltScript, f_In, f_Out, err);
!
j_str.Format( "%d", j+1);
if( !err.IsEmpty())
{
! fail.push_back( pToRun[i]); // the original file is marked
any_error = true;
!
! appendLn( f_In + " step " + j_str + " in" + " transformation failed: " + err);
}
else
{
! ok.push_back( (LPCTSTR) f_Out);
!
! appendLn( f_In + " step " + j_str + " in" + " transformation OK.");
}
}
! appendLn( CString( pToRun[i].c_str()) + " succesfully transformed to " + f_Out);
! appendLn( "");
}
-
}
--- 349,437 ----
CString err;
f_Out = f_In = pToRun[i].c_str();
!
! // f_Out to be suffixed with the m_strAppendStr (no extension yet)
int dpos = f_Out.ReverseFind('.');
if( dpos == -1) f_Out += FileTransDlg::m_strAppendStr;
! else f_Out = f_Out.Left( dpos) + FileTransDlg::m_strAppendStr;
! if(!multi_step)
{
! xsltScript = scripts[0].c_str();
! f_Out = FileTransDlg::placeIntoTargetDir( f_Out + ".xme");
!
! apply( xsltScript, f_In, f_Out, err);
!
! // analyze error
! if( !err.IsEmpty())
{
! fail.push_back( pToRun[i]); // f_In
! //appendLn( f_In + " transformation failed: " + err);
! appendLn( "Transformation failed. Error msg: " + err + " [Infile: " + f_In + "]" );
}
else
{
! ok.push_back( (LPCTSTR) f_Out);
! //appendLn( f_In + " transformation OK.");
! appendLn( "Transformation OK. Infile: " + f_In + ". Outfile: " + f_Out);
}
}
! else // multi step processing
{
! CString f_OutPattern = FileTransDlg::placeIntoIntermedDir( f_Out);
! CString f_OutFinal = FileTransDlg::placeIntoTargetDir( f_Out + ".xme");
bool any_error = false;
! appendLn( "Start processing " + f_In);
! // do the multi step processing
! for( unsigned int j = 0; err.IsEmpty() && j < scripts.size(); ++j)
{
! err.Empty();
!
if( j+1 != scripts.size()) // the intermediate files look like: a_out01.xme
+ {
+ CString j_str;
j_str.Format( "%.2d", j+1);
+ f_Out = f_OutPattern + j_str + ".xme";
+ }
+ else // the last step
+ f_Out = f_OutFinal;
xsltScript = scripts[j].c_str();
// invoke step i
apply( xsltScript, f_In, f_Out, err);
!
! CString j_str;
j_str.Format( "%d", j+1);
if( !err.IsEmpty())
{
! //fail.push_back( pToRun[i]); // the original file is marked
any_error = true;
! //appendLn( f_In + " step " + j_str + " of transformation failed: " + err);
! appendLn( "Transformation step " + j_str + " failed. Error msg: " + err + " [Infile: " + f_In + "]" );
}
else
{
! //ok.push_back( (LPCTSTR) f_Out);
! //appendLn( f_In + " step " + j_str + " of transformation OK.");
! appendLn( "Transformation step " + j_str + " OK. Infile: " + f_In + ". Outfile: " + f_Out);
}
+
+ f_In = f_Out;
}
! if( any_error)
! {
! fail.push_back( pToRun[i]); // not == with p_In
! appendLn( "");
! }
! else
! {
! ok.push_back( (LPCTSTR) f_Out);
! appendLn( "Succesfully transformed " + CString( pToRun[i].c_str()) + " to " + f_Out);
! appendLn( "");
! }
}
}
***************
*** 428,432 ****
for( unsigned int i = 0; i < ok.size(); ++i)
{
! if( i == 0) appendLn( "Successful cases:");
appendLn( ok[i].c_str());
}
--- 442,446 ----
for( unsigned int i = 0; i < ok.size(); ++i)
{
! if( i == 0) appendLn( "Successful artifacts:");
appendLn( ok[i].c_str());
}
***************
*** 434,438 ****
for( unsigned int i = 0; i < fail.size(); ++i)
{
! if( i == 0) appendLn( "Failed cases:");
appendLn( fail[i].c_str());
}
--- 448,452 ----
for( unsigned int i = 0; i < fail.size(); ++i)
{
! if( i == 0) appendLn( "Failed tranformations:");
appendLn( fail[i].c_str());
}
***************
*** 496,505 ****
}
! void FileTransDlg::apply( CString pScrF, CString pInF, CString pOutF, CString& f4)
{
! CXslt::doNativeXslt( pScrF, pInF, pOutF, f4);
}
! void FileTransDlg::loadMyOptions( CString& pStrVal1, CString& pStrVal2, CString& pStrVal3, CString& pStrVal4)
{
CWinApp* pApp = AfxGetApp();
--- 510,519 ----
}
! void FileTransDlg::apply( CString pScrF, CString pInF, CString pOutF, CString& pErrMsg)
{
! CXslt::doNativeXslt( pScrF, pInF, pOutF, pErrMsg);
}
! void FileTransDlg::loadMyOptions( CString& pStrVal1, CString& pStrVal2, CString& pStrVal3, CString& pStrVal4, CString& pStrVal5)
{
CWinApp* pApp = AfxGetApp();
***************
*** 509,515 ****
pStrVal3 = pApp->GetProfileString( m_strSection, m_strAppendStringItem);
pStrVal4 = pApp->GetProfileString( m_strSection, m_strOutputDirStringItem);
}
! void FileTransDlg::saveMyOptions( const CString& pStrVal1, const CString& pStrVal2, const CString& pStrVal3, const CString& pStrVal4)
{
CWinApp* pApp = AfxGetApp();
--- 523,530 ----
pStrVal3 = pApp->GetProfileString( m_strSection, m_strAppendStringItem);
pStrVal4 = pApp->GetProfileString( m_strSection, m_strOutputDirStringItem);
+ pStrVal5 = pApp->GetProfileString( m_strSection, m_strIntermedDirStringItem);
}
! void FileTransDlg::saveMyOptions( const CString& pStrVal1, const CString& pStrVal2, const CString& pStrVal3, const CString& pStrVal4, const CString& pStrVal5)
{
CWinApp* pApp = AfxGetApp();
***************
*** 519,522 ****
--- 534,538 ----
pApp->WriteProfileString( m_strSection, m_strAppendStringItem, pStrVal3);
pApp->WriteProfileString( m_strSection, m_strOutputDirStringItem, pStrVal4);
+ pApp->WriteProfileString( m_strSection, m_strIntermedDirStringItem, pStrVal5);
}
***************
*** 593,596 ****
--- 609,619 ----
}
+ void FileTransDlg::quit()
+ {
+ closeDlgRuleEditor( IDCANCEL);
+ EndDialog( IDCANCEL);
+ DestroyWindow();
+ }
+
void FileTransDlg::appendLn( CString t)
{
***************
*** 633,636 ****
--- 656,676 ----
}
+ bool FileTransDlg::fileExists( const CString& file)
+ {
+ bool res = false;
+ CFileStatus stat;
+ if( !file.IsEmpty() // not-empty string
+ && CFile::GetStatus( file, stat)) // status fetched succesfully
+ {
+ if( (stat.m_attribute & CFile::directory) == 0 // it is NOT a directory
+ && (stat.m_attribute & CFile::readOnly) == 0) // not read only
+ {
+ res = true;
+ }
+ }
+
+ return res;
+ }
+
void FileTransDlg::OnBnClickedButtonclear()
{
***************
*** 695,700 ****
--- 735,742 ----
case ID_MISC_OPTIONS: options(); break;
case ID_MISC_CLEARLOG: clearLog(); break;
+ case ID_FILES_EXIT: quit(); break;
};
+ if( wParam == ID_FILES_EXIT) return TRUE;
return CDialog::OnCommand(wParam, lParam);
}
***************
*** 767,769 ****
--- 809,851 ----
*pResult = 0;
+ }
+
+ /*static*/ CString FileTransDlg::placeIntoTargetDir( const CString& pFile)
+ {
+ CString file = pFile;
+ // change the directory part of the path if specified and exists
+ if( directoryExists( FileTransDlg::m_strOutputDirStr)) // status fetched succesfully
+ {
+ int dpos = file.ReverseFind('\\');
+ if( dpos == -1) // not found '\\'
+ {
+ file.Insert( 0, '\\');
+ file.Insert( 0, FileTransDlg::m_strOutputDirStr);
+ }
+ else
+ {
+ file = FileTransDlg::m_strOutputDirStr + '\\' + file.Right( file.GetLength() - dpos - 1);
+ }
+ }
+ return file;
+ }
+
+ /*static*/ CString FileTransDlg::placeIntoIntermedDir( const CString& pFile)
+ {
+ CString file = pFile;
+ // change the directory part of the path to the intermediate directory if specified
+ if( directoryExists( FileTransDlg::m_strIntermedDirStr)) // status fetched succesfully
+ {
+ int dpos = file.ReverseFind('\\');
+ if( dpos == -1) // not found '\\'
+ {
+ file.Insert( 0, '\\');
+ file.Insert( 0, FileTransDlg::m_strIntermedDirStr);
+ }
+ else
+ {
+ file = FileTransDlg::m_strIntermedDirStr + '\\' + file.Right( file.GetLength() - dpos - 1);
+ }
+ }
+ return file;
}
Index: FrontEnd.rc
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/FrontEnd.rc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FrontEnd.rc 16 Nov 2005 16:01:17 -0000 1.1
--- FrontEnd.rc 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 79,83 ****
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
! LTEXT "ModelMigrate Version 1.3",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) ISIS, Vanderbilt University 2005",
--- 79,83 ----
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
! LTEXT "ModelMigrate Version 1.4",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) ISIS, Vanderbilt University 2005",
***************
*** 102,106 ****
END
! IDD_DLG_ADDRULE DIALOGEX 0, 0, 186, 95
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
--- 102,106 ----
END
! IDD_DLG_ADDRULE DIALOGEX 0, 0, 186, 135
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
***************
*** 108,112 ****
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
! LISTBOX IDC_LIST1,7,7,114,81,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
--- 108,112 ----
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
! LISTBOX IDC_LIST1,7,7,114,121,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
***************
*** 148,152 ****
END
! IDD_DLG_FILETRANS DIALOGEX 0, 0, 494, 345
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP |
WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
--- 148,152 ----
END
! IDD_DLG_FILETRANS DIALOGEX 0, 0, 364, 345
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP |
WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
***************
*** 155,175 ****
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_LISTSCRIPT,"SysListView32",LVS_REPORT |
LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER |
! WS_TABSTOP,7,7,480,63,WS_EX_ACCEPTFILES
! PUSHBUTTON "&Add File",IDC_BUTTON6,7,71,50,14
! PUSHBUTTON "A&dd Dir",IDC_BUTTON2,62,71,50,14
! PUSHBUTTON "&Process Selected",IDC_BUTTON8,120,71,64,14
! PUSHBUTTON "P&rocess All",IDC_BUTTON4,190,71,50,14
! PUSHBUTTON "&Edit Rules",IDC_BUTTON1,381,71,50,14
! PUSHBUTTON "&Clear Log",IDC_BUTTONCLEAR,437,71,50,14
CONTROL "",IDC_LISTFILES,"SysListView32",LVS_REPORT |
LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER |
! WS_TABSTOP,7,87,480,137,WS_EX_ACCEPTFILES
! EDITTEXT IDC_EDIT4,7,228,480,110,ES_MULTILINE | ES_AUTOHSCROLL |
ES_READONLY | WS_VSCROLL | WS_HSCROLL
END
! IDD_DLG_OPTIONS DIALOGEX 0, 0, 308, 149
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
--- 155,178 ----
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
+ PUSHBUTTON "Add &Scripts",IDC_BUTTON3,7,4,50,14
+ PUSHBUTTON "Add Dir o&f Scripts",IDC_BUTTON5,64,4,70,14
+ PUSHBUTTON "Rule &Editor/Create New Scripts",IDC_BUTTON1,139,4,105,
+ 14
CONTROL "",IDC_LISTSCRIPT,"SysListView32",LVS_REPORT |
LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER |
! WS_TABSTOP,7,19,350,71,WS_EX_ACCEPTFILES
! PUSHBUTTON "&Add File",IDC_BUTTON6,7,92,50,14
! PUSHBUTTON "A&dd Dir",IDC_BUTTON2,62,92,50,14
! PUSHBUTTON "&Process Selected",IDC_BUTTON8,120,92,64,14
! PUSHBUTTON "P&rocess All",IDC_BUTTON4,190,92,50,14
! PUSHBUTTON "&Clear Log",IDC_BUTTONCLEAR,249,92,50,14
CONTROL "",IDC_LISTFILES,"SysListView32",LVS_REPORT |
LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER |
! WS_TABSTOP,7,107,350,137,WS_EX_ACCEPTFILES
! EDITTEXT IDC_EDIT4,7,247,350,91,ES_MULTILINE | ES_AUTOHSCROLL |
ES_READONLY | WS_VSCROLL | WS_HSCROLL
END
! IDD_DLG_OPTIONS DIALOGEX 0, 0, 308, 174
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
***************
*** 184,187 ****
--- 187,192 ----
EDITTEXT IDC_EDIT6,17,115,192,15,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON7,213,115,22,14
+ EDITTEXT IDC_EDIT7,17,145,192,15,ES_AUTOHSCROLL
+ PUSHBUTTON "...",IDC_BUTTON8,213,145,22,14
DEFPUSHBUTTON "OK",IDOK,251,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,251,24,50,14
***************
*** 191,197 ****
LTEXT "Target directory (if empty then same directory as input)",
IDC_STATIC,20,104,185,8
END
! IDD_DLG_RULEEDITOR DIALOGEX 600, 100, 350, 206
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME
--- 196,204 ----
LTEXT "Target directory (if empty then same directory as input)",
IDC_STATIC,20,104,185,8
+ LTEXT "Directory for intermediate files:",IDC_STATIC,20,135,
+ 185,8
END
! IDD_DLG_RULEEDITOR DIALOGEX 600, 100, 420, 236
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME
***************
*** 200,211 ****
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
! PUSHBUTTON "Add &Rule...",IDADDRULE,7,7,46,14
! PUSHBUTTON "Generate &All",IDGENERATE,62,7,47,14
! PUSHBUTTON "Generate S&elected",IDGENERATESEL,117,7,68,14
! PUSHBUTTON "&Load",IDLOAD,258,7,38,14
! PUSHBUTTON "&Save",IDSAVE,300,7,43,14
CONTROL "",IDC_RULELIST,"SysListView32",LVS_REPORT |
LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER |
! WS_TABSTOP,7,24,336,175
END
--- 207,220 ----
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
! PUSHBUTTON "&Load",IDLOAD,7,1,38,14
! PUSHBUTTON "&Save",IDSAVE,49,1,43,14
! PUSHBUTTON "Add &Rule...",IDADDRULE,108,1,46,14
! PUSHBUTTON "Generate S&elected",IDGENERATESEL,180,1,68,14
! PUSHBUTTON "Generate &All",IDGENERATE,251,1,47,14
! CONTROL "Each Rule into Separate Script",IDC_CHECKSEPARATEFILE,
! "Button",BS_AUTOCHECKBOX | WS_TABSTOP,303,4,110,10
CONTROL "",IDC_RULELIST,"SysListView32",LVS_REPORT |
LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER |
! WS_TABSTOP,7,18,406,211
END
***************
*** 318,321 ****
--- 327,342 ----
END
+ IDD_DLG_PROPSTEREOTYPECHANGE DIALOGEX 0, 0, 223, 49
+ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+ CAPTION "Dialog"
+ FONT 8, "MS Shell Dlg", 400, 0, 0x1
+ BEGIN
+ EDITTEXT IDC_EDIT1,9,21,132,14,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,166,7,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,166,24,50,14
+ LTEXT "Kind to be casted:",IDC_STATIC,10,9,75,10
+ END
+
/////////////////////////////////////////////////////////////////////////////
***************
*** 325,330 ****
VS_VERSION_INFO VERSIONINFO
! FILEVERSION 1,3,0,1
! PRODUCTVERSION 1,3,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
--- 346,351 ----
VS_VERSION_INFO VERSIONINFO
! FILEVERSION 1,4,0,1
! PRODUCTVERSION 1,4,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
***************
*** 343,352 ****
VALUE "CompanyName", "ISIS, Vanderbilt University, 2005"
VALUE "FileDescription", "Model Migrate executable, for generating and applying XSLT scripts"
! VALUE "FileVersion", "1.3.0.1"
VALUE "InternalName", "FrontEnd.exe"
VALUE "LegalCopyright", "ISIS, Vanderbilt University, 2005"
VALUE "OriginalFilename", "FrontEnd.exe"
VALUE "ProductName", "ModelMigrate"
! VALUE "ProductVersion", "1.3.0.1"
END
END
--- 364,373 ----
VALUE "CompanyName", "ISIS, Vanderbilt University, 2005"
VALUE "FileDescription", "Model Migrate executable, for generating and applying XSLT scripts"
! VALUE "FileVersion", "1.4.0.1"
VALUE "InternalName", "FrontEnd.exe"
VALUE "LegalCopyright", "ISIS, Vanderbilt University, 2005"
VALUE "OriginalFilename", "FrontEnd.exe"
VALUE "ProductName", "ModelMigrate"
! VALUE "ProductVersion", "1.4.0.1"
END
END
***************
*** 387,391 ****
RIGHTMARGIN, 179
TOPMARGIN, 7
! BOTTOMMARGIN, 88
END
--- 408,412 ----
RIGHTMARGIN, 179
TOPMARGIN, 7
! BOTTOMMARGIN, 128
END
***************
*** 409,414 ****
BEGIN
LEFTMARGIN, 7
! RIGHTMARGIN, 487
! TOPMARGIN, 7
BOTTOMMARGIN, 338
END
--- 430,434 ----
BEGIN
LEFTMARGIN, 7
! RIGHTMARGIN, 357
BOTTOMMARGIN, 338
END
***************
*** 419,423 ****
RIGHTMARGIN, 301
TOPMARGIN, 7
! BOTTOMMARGIN, 142
END
--- 439,443 ----
RIGHTMARGIN, 301
TOPMARGIN, 7
! BOTTOMMARGIN, 167
END
***************
*** 425,431 ****
BEGIN
LEFTMARGIN, 7
! RIGHTMARGIN, 343
! TOPMARGIN, 7
! BOTTOMMARGIN, 199
END
--- 445,451 ----
BEGIN
LEFTMARGIN, 7
! RIGHTMARGIN, 413
! TOPMARGIN, 1
! BOTTOMMARGIN, 229
END
***************
*** 477,480 ****
--- 497,508 ----
BOTTOMMARGIN, 80
END
+
+ IDD_DLG_PROPSTEREOTYPECHANGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 216
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 42
+ END
END
#endif // APSTUDIO_INVOKED
***************
*** 486,505 ****
//
! Header.xsl XSL "res\\header.xsl"
! Tail.xsl XSL "res\\tail.xsl"
! TKindNameChange.xsl XSL "res\\TKindNameChange.xsl"
! TAttrNameChange.xsl XSL "res\\TAttrNameChange.xsl"
! TEnumAttrValueChange.xsl XSL "res\\TEnumAttrValueChange.xsl"
! TAttrTypeChange.xsl XSL "res\\TAttrTypeChange.xsl"
! TAttrTypeCheck2Text.xsl XSL "res\\TAttrTypeCheck2Text.xsl"
! TRemoveGlobalAttr.xsl XSL "res\\TRemoveGlobalAttr.xsl"
! TRemoveLocalAttr.xsl XSL "res\\TRemoveLocalAttr.xsl"
! TRemoveKind.xsl XSL "res\\TRemoveKind.xsl"
!
! /////////////////////////////////////////////////////////////////////////////
! //
! // Bitmap
! //
!
/////////////////////////////////////////////////////////////////////////////
--- 514,532 ----
//
! HEADER.XSL XSL "res\\header.xsl"
! TAIL.XSL XSL "res\\tail.xsl"
! TKINDNAMECHANGE.XSL XSL "res\\TKindNameChange.xsl"
! TATTRNAMECHANGE.XSL XSL "res\\TAttrNameChange.xsl"
! TENUMATTRVALUECHANGE.XSL XSL "res\\TEnumAttrValueChange.xsl"
! TATTRTYPECHANGE.XSL XSL "res\\TAttrTypeChange.xsl"
! TATTRTYPECHECK2TEXT.XSL XSL "res\\TAttrTypeCheck2Text.xsl"
! TREMOVEGLOBALATTR.XSL XSL "res\\TRemoveGlobalAttr.xsl"
! TREMOVELOCALATTR.XSL XSL "res\\TRemoveLocalAttr.xsl"
! TREMOVEKIND.XSL XSL "res\\TRemoveKind.xsl"
! TPARADIGMGUIDCHANGE.XSL XSL "res\\TParadigmGUIDChange.xsl"
! TPARADIGMNAMECHANGE.XSL XSL "res\\TParadigmNameChange.xsl"
! TPARADIGMVERSIONCHANGE.XSL XSL "res\\TParadigmVersionChange.xsl"
! TATOM2MODEL.XSL XSL "res\\TAtom2Model.xsl"
! TMODEL2ATOM.XSL XSL "res\\TModel2Atom.xsl"
/////////////////////////////////////////////////////////////////////////////
***************
*** 510,521 ****
IDR_MENU1 MENU
BEGIN
! POPUP "Scripts"
! BEGIN
! MENUITEM "Add Script\tF3", ID_SCRIPTS_ADD
! MENUITEM "Add Directory\tF4", ID_SCRIPTS_ADDDIRECTORY
! MENUITEM "Remove All", ID_SCRIPTS_REMOVEALL
! MENUITEM "Remove Selected", ID_SCRIPTS_REMOVESELECTED
! END
! POPUP "Files"
BEGIN
MENUITEM "Add File\tF6", ID_FILES_ADDFILE
--- 537,541 ----
IDR_MENU1 MENU
BEGIN
! POPUP "File"
BEGIN
MENUITEM "Add File\tF6", ID_FILES_ADDFILE
***************
*** 523,530 ****
MENUITEM "Remove All", ID_FILES_REMOVEALL
MENUITEM "Remove Selected", ID_FILES_REMOVESELECTED
END
! POPUP "Rules"
BEGIN
! MENUITEM "Edit Rules", ID_RULES_EDITRULES
MENUITEM "Generate Validator Script", ID_RULES_VALIDATE
END
--- 543,557 ----
MENUITEM "Remove All", ID_FILES_REMOVEALL
MENUITEM "Remove Selected", ID_FILES_REMOVESELECTED
+ MENUITEM SEPARATOR
+ MENUITEM "Exit", ID_FILES_EXIT
END
! POPUP "Script"
BEGIN
! MENUITEM "Add Script\tF3", ID_SCRIPTS_ADD
! MENUITEM "Add Directory\tF4", ID_SCRIPTS_ADDDIRECTORY
! MENUITEM "Remove All", ID_SCRIPTS_REMOVEALL
! MENUITEM "Remove Selected", ID_SCRIPTS_REMOVESELECTED
! MENUITEM SEPARATOR
! MENUITEM "Create New Script / Rule Editor", ID_RULES_EDITRULES
MENUITEM "Generate Validator Script", ID_RULES_VALIDATE
END
***************
*** 549,552 ****
--- 576,581 ----
MENUITEM "Load", ID_MYFILELOAD
MENUITEM "Save", ID_MYFILESAVE
+ MENUITEM SEPARATOR
+ MENUITEM "Close", ID_MYFILECLOSE
END
POPUP "Rule"
Index: RuleEditorDlg.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/RuleEditorDlg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RuleEditorDlg.h 16 Nov 2005 16:01:17 -0000 1.1
--- RuleEditorDlg.h 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 43,46 ****
--- 43,47 ----
void onFileLoad();
void onFileSave();
+ void onFileClose();
public:
Index: RuleEditorDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/RuleEditorDlg.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RuleEditorDlg.cpp 16 Nov 2005 16:01:17 -0000 1.1
--- RuleEditorDlg.cpp 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 14,17 ****
--- 14,18 ----
, m_closed( true)
{
+ m_ruleList.setParent( this);
}
***************
*** 43,52 ****
void RuleEditorDlg::OnBnClickedGenerate()
{
! m_ruleList.genAll();
}
void RuleEditorDlg::OnBnClickedGeneratesel()
{
! m_ruleList.genSelected();
}
--- 44,61 ----
void RuleEditorDlg::OnBnClickedGenerate()
{
! bool separate_files = false;
! CButton * bttn = (CButton *) GetDlgItem(IDC_CHECKSEPARATEFILE);
! if( bttn) separate_files = bttn->GetCheck() == BST_CHECKED;
!
! m_ruleList.genAll( separate_files);
}
void RuleEditorDlg::OnBnClickedGeneratesel()
{
! bool separate_files = false;
! CButton * bttn = (CButton *) GetDlgItem(IDC_CHECKSEPARATEFILE);
! if( bttn) separate_files = bttn->GetCheck() == BST_CHECKED;
!
! m_ruleList.genSelected( separate_files);
}
***************
*** 56,59 ****
--- 65,69 ----
DestroyWindow();
m_closed = true;
+ m_ruleList.reset();
}
***************
*** 185,193 ****
case ID_RULE_MOVEUP: m_ruleList.onMoveUp();break;
case ID_RULE_MOVEDOWN: m_ruleList.onMoveDown();break;
! case ID_SCRIPT_GENERATEALL: m_ruleList.onGenAll();break;
! case ID_SCRIPT_GENERATESELECTED: m_ruleList.onGenSel();break;
default: return CDialog::OnCommand(wParam, lParam);
};
return CDialog::OnCommand(wParam, lParam);
}
--- 195,205 ----
case ID_RULE_MOVEUP: m_ruleList.onMoveUp();break;
case ID_RULE_MOVEDOWN: m_ruleList.onMoveDown();break;
! case ID_SCRIPT_GENERATEALL: OnBnClickedGenerate();break;
! case ID_SCRIPT_GENERATESELECTED: OnBnClickedGeneratesel();break;
! case ID_MYFILECLOSE: onFileClose();break;
default: return CDialog::OnCommand(wParam, lParam);
};
+ if( wParam == ID_MYFILECLOSE) return TRUE;
return CDialog::OnCommand(wParam, lParam);
}
***************
*** 207,211 ****
bool empty = m_ruleList.erasable();
if( !empty)
! empty = IDOK == AfxMessageBox("Create new file?");
if( empty)
--- 219,223 ----
bool empty = m_ruleList.erasable();
if( !empty)
! empty = IDOK == AfxMessageBox("Create new file?", MB_OKCANCEL);
if( empty)
***************
*** 222,223 ****
--- 234,240 ----
m_ruleList.fileSave();
}
+
+ void RuleEditorDlg::onFileClose()
+ {
+ closeDlg( IDCANCEL);
+ }
\ No newline at end of file
Index: FrontEnd.vcproj
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/FrontEnd.vcproj,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FrontEnd.vcproj 18 Nov 2005 17:39:39 -0000 1.2
--- FrontEnd.vcproj 2 Feb 2006 20:37:54 -0000 1.3
***************
*** 232,235 ****
--- 232,238 ----
</File>
<File
+ RelativePath=".\StereotypeCastDlg.cpp">
+ </File>
+ <File
RelativePath=".\Validator.cpp">
</File>
***************
*** 336,339 ****
--- 339,345 ----
</File>
<File
+ RelativePath=".\StereotypeCastDlg.h">
+ </File>
+ <File
RelativePath=".\Validator.h">
</File>
***************
*** 352,355 ****
--- 358,364 ----
RelativePath=".\res\FrontEnd.rc2">
</File>
+ <File
+ RelativePath=".\res\toolbar1.bmp">
+ </File>
</Filter>
<File
***************
*** 363,366 ****
--- 372,378 ----
</File>
<File
+ RelativePath=".\res\TAtom2Model.xsl">
+ </File>
+ <File
RelativePath=".\res\TAttrNameChange.xsl">
</File>
***************
*** 376,379 ****
--- 388,403 ----
<File
RelativePath=".\res\TKindNameChange.xsl">
+ </File>
+ <File
+ RelativePath=".\res\TModel2Atom.xsl">
+ </File>
+ <File
+ RelativePath=".\res\TParadigmGUIDChange.xsl">
+ </File>
+ <File
+ RelativePath=".\res\TParadigmNameChange.xsl">
+ </File>
+ <File
+ RelativePath=".\res\TParadigmVersionChange.xsl">
</File>
<File
Index: OptionsDlg.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/OptionsDlg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** OptionsDlg.h 16 Nov 2005 16:01:17 -0000 1.1
--- OptionsDlg.h 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 25,28 ****
--- 25,29 ----
CString m_append;
CString m_outputDir;
+ CString m_intermediateFilesDir;
afx_msg void OnBnClickedButton1();
***************
*** 30,32 ****
--- 31,34 ----
virtual BOOL OnInitDialog();
afx_msg void OnBnClickedButton7();
+ afx_msg void OnBnClickedButton8();
};
Index: RuleListCtrl.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/RuleListCtrl.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RuleListCtrl.cpp 16 Nov 2005 16:01:17 -0000 1.1
--- RuleListCtrl.cpp 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 14,21 ****
--- 14,23 ----
#include "RemoveDlg.h"
#include "RemoveLocAttrDlg.h"
+ #include "StereotypeCastDlg.h"
#include "Script.h"
#include "Rule.h"
#include <fstream>
#include <algorithm>
+ #include "RuleEditorDlg.h"
// RuleListCtrl
***************
*** 41,45 ****
RuleListCtrl::~RuleListCtrl()
{
! m_rules.clear();
}
--- 43,47 ----
RuleListCtrl::~RuleListCtrl()
{
! reset();
}
***************
*** 52,55 ****
--- 54,67 ----
+ void RuleListCtrl::setParent( RuleEditorDlg* pDlg)
+ {
+ m_parentDlg = pDlg;
+ }
+
+ void RuleListCtrl::reset()
+ {
+ m_rules.clear();
+ }
+
// RuleListCtrl message handlers
***************
*** 122,126 ****
void RuleListCtrl::addNewItem( int pChoice)
{
! if( pChoice == Rule::KindNameChange)
{
SimpleReplace sr;
--- 134,141 ----
void RuleListCtrl::addNewItem( int pChoice)
{
! if( pChoice == Rule::KindNameChange
! || pChoice == Rule::ParadigmGUIDChange
! || pChoice == Rule::ParadigmNameChange
! || pChoice == Rule::ParadigmVersionChange)
{
SimpleReplace sr;
***************
*** 213,216 ****
--- 228,242 ----
}
}
+ else if( pChoice == Rule::Atom2Model
+ || pChoice == Rule::Model2Atom)
+ {
+ StereotypeCastDlg sc( pChoice == Rule::Atom2Model);
+ if( sc.DoModal() == IDOK)
+ {
+ std::vector<std::string> pars(1);
+ pars[0] = sc.getPar1();
+ int idx = addRule( pChoice, pars);
+ }
+ }
}
***************
*** 219,223 ****
DWORD chc = (DWORD) GetItemData( idx);
! if( chc == Rule::KindNameChange)
{
SimpleReplace sr;
--- 245,252 ----
DWORD chc = (DWORD) GetItemData( idx);
! if( chc == Rule::KindNameChange
! || chc == Rule::ParadigmGUIDChange
! || chc == Rule::ParadigmNameChange
! || chc == Rule::ParadigmVersionChange)
{
SimpleReplace sr;
***************
*** 327,330 ****
--- 356,370 ----
}
}
+ else if( chc == Rule::Atom2Model
+ || chc == Rule::Model2Atom)
+ {
+ StereotypeCastDlg sc( chc == Rule::Atom2Model);
+ sc.init( m_rules[idx].m_params[0].c_str());
+ if( sc.DoModal() == IDOK)
+ {
+ m_rules[idx].m_params[0] = sc.getPar1();
+ setItem( Rule::ruleSummary( m_rules[idx]), idx, 0);
+ }
+ }
}
***************
*** 360,364 ****
}
! CString RuleListCtrl::genSelected()// const std::string& pOutputFileName)
{
std::vector< int> res; // vec constructed from the indices of the selected rows
--- 400,404 ----
}
! CString RuleListCtrl::genSelected( bool pSeparateFiles)
{
std::vector< int> res; // vec constructed from the indices of the selected rows
***************
*** 384,389 ****
if( dlg.DoModal() == IDOK)
{
! if( gen( (LPCTSTR) dlg.GetPathName(), res))
! return dlg.GetPathName();
}
--- 424,437 ----
if( dlg.DoModal() == IDOK)
{
! if( pSeparateFiles)
! {
! if( genIntoSeparate( (LPCTSTR) dlg.GetPathName(), res))
! return dlg.GetPathName();
! }
! else
! {
! if( gen( (LPCTSTR) dlg.GetPathName(), res))
! return dlg.GetPathName();
! }
}
***************
*** 392,396 ****
! CString RuleListCtrl::genAll()// const std::string& pOutputFileName)
{
CFileDialog dlg( FALSE, ".xsl", "script1", OFN_OVERWRITEPROMPT,
--- 440,444 ----
! CString RuleListCtrl::genAll( bool pSeparateFiles)
{
CFileDialog dlg( FALSE, ".xsl", "script1", OFN_OVERWRITEPROMPT,
***************
*** 403,408 ****
res[i] = i;
! if( gen( (LPCTSTR) dlg.GetPathName(), res))
! return dlg.GetPathName();
}
--- 451,464 ----
res[i] = i;
! if( pSeparateFiles)
! {
! if( genIntoSeparate( (LPCTSTR) dlg.GetPathName(), res))
! return dlg.GetPathName();
! }
! else
! {
! if( gen( (LPCTSTR) dlg.GetPathName(), res))
! return dlg.GetPathName();
! }
}
***************
*** 461,464 ****
--- 517,598 ----
}
+ int RuleListCtrl::genIntoSeparate( const std::string& pOutputFileName, const std::vector<int>& pSelectVec)
+ {
+ std::string h_part = Script::getXSLFromResource( "Header.xsl");
+ if( h_part.empty())
+ {
+ AfxMessageBox( "Could not load header part from resources!");
+ return 0;
+ }
+
+ std::string t_part = Script::getXSLFromResource( "Tail.xsl");
+ if( t_part.empty())
+ {
+ AfxMessageBox( "Could not load tail part from resources!");
+ return 0;
+ }
+
+ size_t pos_of_dot = pOutputFileName.rfind( ".xsl");
+ if( pos_of_dot == 0)
+ {
+ AfxMessageBox( "Wrong file name given");
+ return 0;
+ }
+ else if( pos_of_dot == std::string::npos) pos_of_dot = pOutputFileName.length();
+
+ int rule_nmb = 0;
+ for( unsigned int i = 0; i < m_rules.size(); ++i)
+ {
+ if( std::find( pSelectVec.begin(), pSelectVec.end(), i) == pSelectVec.end()) // not found
+ continue;
+
+ ++rule_nmb;
+
+ // will use the file name given without extension
+ std::string output_file_name( pOutputFileName.substr(0, pos_of_dot));
+ char buff[16];
+ sprintf( buff, "%0.3i.xsl", rule_nmb);
+ output_file_name += buff; // append something like: "001.xsl"
+
+ std::fstream f;
+ f.open( output_file_name.c_str(), std::ios_base::out|std::ios_base::binary); // write out as is (not to mess with additional CR-s)
+ ASSERT( f.is_open());
+ if( !f.is_open())
+ {
+ std::string msg = "Could not create target file: ";
+ msg += output_file_name;
+ AfxMessageBox( msg.c_str());
+ return 0;
+ }
+
+ f.write( h_part.c_str(), (std::streamsize) h_part.length());
+
+ f << "\r\n<!-- ******************************************* 1 rule ******************************************* -->";
+ f << "\r\n";
+
+
+ f << "\r\n";
+ f << "<!-- ~~~~~~~~~~~~ rule nb=\"" << rule_nmb << "\" ~~~~~~~~~~~~ -->";
+ f << "\r\n";
+
+ m_rules[i].gen( f );
+
+ f << "\r\n";
+ f << "<!-- ~~~~~~~~~~~~ /rule ~~~~~~~~~~~~~~~~~~~ -->";
+ f << "\r\n";
+ f << "\r\n";
+
+ f << "<!-- ******************************************* /1 rule ******************************************* -->";
+ f << "\r\n\r\n\r\n";
+
+ f.write( t_part.c_str(), (std::streamsize) t_part.length());
+
+ f.close();
+ }
+
+ return 1;
+ }
+
+
void RuleListCtrl::OnRButtonDown(UINT nFlags, CPoint point)
{
***************
*** 643,652 ****
void RuleListCtrl::onGenAll()
{
! genAll();
}
void RuleListCtrl::onGenSel()
{
! genSelected();
}
--- 777,786 ----
void RuleListCtrl::onGenAll()
{
! if( m_parentDlg) m_parentDlg->OnBnClickedGenerate();
}
void RuleListCtrl::onGenSel()
{
! if( m_parentDlg) m_parentDlg->OnBnClickedGeneratesel();
}
--- NEW FILE: StereotypeCastDlg.cpp ---
// StereotypeCastDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ModelMigrate.h"
#include "StereotypeCastDlg.h"
#include ".\stereotypecastdlg.h"
// StereotypeCastDlg dialog
IMPLEMENT_DYNAMIC(StereotypeCastDlg, CDialog)
StereotypeCastDlg::StereotypeCastDlg( bool pCastAtom2Model, CWnd* pParent /*=NULL*/)
: CDialog(StereotypeCastDlg::IDD, pParent)
, m_kind(_T(""))
, m_title( pCastAtom2Model? _T("Cast Atom to Model"):_T("Cast Model to Atom"))
{
}
StereotypeCastDlg::~StereotypeCastDlg()
{
}
void StereotypeCastDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, m_kind);
}
BEGIN_MESSAGE_MAP(StereotypeCastDlg, CDialog)
END_MESSAGE_MAP()
// StereotypeCastDlg message handlers
const CString& StereotypeCastDlg::getPar1() const
{
return m_kind;
}
void StereotypeCastDlg::init( const CString& par1)
{
m_kind = par1;
}
BOOL StereotypeCastDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetWindowText( (LPCTSTR) m_title);
return TRUE;
}
Index: OptionsDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/OptionsDlg.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** OptionsDlg.cpp 16 Nov 2005 16:01:17 -0000 1.1
--- OptionsDlg.cpp 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 16,19 ****
--- 16,21 ----
, m_scr(_T(""))
, m_append(_T(""))
+ , m_outputDir(_T(""))
+ , m_intermediateFilesDir(_T(""))
{
}
***************
*** 30,33 ****
--- 32,36 ----
DDX_Text(pDX, IDC_EDIT5, m_append);
DDX_Text(pDX, IDC_EDIT6, m_outputDir);
+ DDX_Text(pDX, IDC_EDIT7, m_intermediateFilesDir);
}
***************
*** 37,40 ****
--- 40,44 ----
ON_BN_CLICKED(IDC_BUTTON6, OnBnClickedButton6)
ON_BN_CLICKED(IDC_BUTTON7, OnBnClickedButton7)
+ ON_BN_CLICKED(IDC_BUTTON8, OnBnClickedButton8)
END_MESSAGE_MAP()
***************
*** 89,100 ****
UpdateData( TRUE);
if( m_outputDir.Right(1) == '\\')
m_outputDir.Truncate( m_outputDir.GetLength() - 1);// delete trailing '\\'
UpdateData( FALSE);
if( m_outputDir.IsEmpty() && m_append.IsEmpty())
{
! AfxMessageBox( "The scripts must save output to a destination file different from the source file.\nEither select a target directory or specify a string which will be appended to destination filenames!");
}
else if( !m_outputDir.IsEmpty() && !FileTransDlg::directoryExists( m_outputDir))
--- 93,110 ----
UpdateData( TRUE);
+ if( m_dir.Right(1) == '\\')
+ m_dir.Truncate( m_dir.GetLength() - 1);// delete trailing '\\'
+
if( m_outputDir.Right(1) == '\\')
m_outputDir.Truncate( m_outputDir.GetLength() - 1);// delete trailing '\\'
+ if( m_intermediateFilesDir.Right(1) == '\\')
+ m_intermediateFilesDir.Truncate( m_intermediateFilesDir.GetLength() - 1);// delete trailing '\\'
+
UpdateData( FALSE);
if( m_outputDir.IsEmpty() && m_append.IsEmpty())
{
! AfxMessageBox( "The transformation process will save output to a destination file different from the source file.\nEither select a target directory or specify a string which will be appended to destination filenames!");
}
else if( !m_outputDir.IsEmpty() && !FileTransDlg::directoryExists( m_outputDir))
***************
*** 102,108 ****
AfxMessageBox( "Invalid target directory specified!");
}
else
{
CDialog::OnOK();
}
! }
\ No newline at end of file
--- 112,133 ----
AfxMessageBox( "Invalid target directory specified!");
}
+ else if( !m_intermediateFilesDir.IsEmpty() && !FileTransDlg::directoryExists( m_intermediateFilesDir))
+ {
+ AfxMessageBox( "Invalid intermediate directory specified!");
+ }
else
{
CDialog::OnOK();
}
! }
! void OptionsDlg::OnBnClickedButton8()
! {
! UpdateData( TRUE);
! CString dir = FileTransDlg::getDirectory("Please specify a directory for intermediate .xme files");
! if( !dir.IsEmpty())
! {
! m_intermediateFilesDir = dir;
! }
! UpdateData( FALSE);
!
! }
Index: resource.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/resource.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** resource.h 16 Nov 2005 16:01:17 -0000 1.1
--- resource.h 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 29,32 ****
--- 29,33 ----
#define IDR_MENU1 155
#define IDR_MENU2 158
+ #define IDD_DLG_PROPSTEREOTYPECHANGE 164
#define IDC_LIST2 1001
#define IDC_LISTSCRIPT 1001
***************
*** 43,46 ****
--- 44,48 ----
#define IDC_EDIT6 1008
#define IDC_BUTTON4 1009
+ #define IDC_EDIT7 1009
#define IDC_BUTTON8 1010
#define IDOK2 1011
***************
*** 60,63 ****
--- 62,66 ----
#define IDC_RADIO2 1026
#define IDC_LISTFILES 1029
+ #define IDC_CHECKSEPARATEFILE 1030
#define ID_SCRIPTS_ADD 32771
#define ID_SCRIPTS_ADDDIRECTORY 32772
***************
*** 93,96 ****
--- 96,104 ----
#define ID_RULES_VALIDATE 32828
#define ID_RULES_EDITRULES 32829
+ #define ID_GENERATEALL_INTOAFILE 32830
+ #define ID_GENERATEALL_INTOSEPARATEFILES 32831
+ #define ID_GENERATE 32832
+ #define ID_FILES_EXIT 32838
+ #define ID_MYFILECLOSE 32840
// Next default values for new objects
***************
*** 98,104 ****
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
! #define _APS_NEXT_RESOURCE_VALUE 159
! #define _APS_NEXT_COMMAND_VALUE 32830
! #define _APS_NEXT_CONTROL_VALUE 1030
#define _APS_NEXT_SYMED_VALUE 105
#endif
--- 106,112 ----
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
! #define _APS_NEXT_RESOURCE_VALUE 167
! #define _APS_NEXT_COMMAND_VALUE 32841
! #define _APS_NEXT_CONTROL_VALUE 1031
#define _APS_NEXT_SYMED_VALUE 105
#endif
--- NEW FILE: StereotypeCastDlg.h ---
#pragma once
// StereotypeCastDlg dialog
class StereotypeCastDlg : public CDialog
{
DECLARE_DYNAMIC(StereotypeCastDlg)
public:
StereotypeCastDlg( bool pCastAtom2Model, CWnd* pParent = NULL); // standard constructor
virtual ~StereotypeCastDlg();
// Dialog Data
enum { IDD = IDD_DLG_PROPSTEREOTYPECHANGE };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
CString m_kind;
CString m_title;
DECLARE_MESSAGE_MAP()
public:
void init( const CString& par1);
const CString& getPar1() const;
virtual BOOL OnInitDialog();
};
Index: Rule.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/Rule.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Rule.h 16 Nov 2005 16:01:17 -0000 1.1
--- Rule.h 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 17,25 ****
RemoveKind,
RemoveGlobalAttr,
! RemoveLocalAttr
} rule_type;
! static const int rule_nmb = 9;
static const char * rule_templates[ rule_nmb];// keep in sync
//{ "TKindNameChange.xsl"
--- 17,30 ----
RemoveKind,
RemoveGlobalAttr,
! RemoveLocalAttr,
! Atom2Model,
! Model2Atom,
! ParadigmGUIDChange,
! ParadigmNameChange,
! ParadigmVersionChange
} rule_type;
! static const int rule_nmb = 14;
static const char * rule_templates[ rule_nmb];// keep in sync
//{ "TKindNameChange.xsl"
***************
*** 32,35 ****
--- 37,45 ----
//, "TRemoveGlobalAttr.xsl"
//, "TRemoveLocalAttr.xsl"
+ //, "TAtom2Model.xsl"
+ //, "TModel2Atom.xsl"
+ //, "TParadigmGUIDChange.xsl"
+ //, "TParadigmNameChange.xsl"
+ //, "TParadigmVersionChange.xsl"
//};
Index: FileTransDlg.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Tools/ModelMigrate/FrontEnd/FileTransDlg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FileTransDlg.h 16 Nov 2005 16:01:17 -0000 1.1
--- FileTransDlg.h 2 Feb 2006 20:37:54 -0000 1.2
***************
*** 60,68 ****
void loadScriptDir( CString pDir);
! void loadMyOptions( CString& pStrVal1, CString& pStrVal2, CString& pStrVal3, CString& pStrVal4);
! void saveMyOptions( const CString& pStrVal1, const CString& pStrVal2, const CString& pStrVal3, const CString& pStrVal4);
void process( const std::vector< std::string>& pToRun);
! void apply( CString f1, CString f2, CString f3, CString& f4);
void appendLog( CString t);
--- 60,68 ----
void loadScriptDir( CString pDir);
! void loadMyOptions( CString& pStrVal1, CString& pStrVal2, CString& pStrVal3, CString& pStrVal4, CString& pStrVal5);
! void saveMyOptions( const CString& pStrVal1, const CString& pStrVal2, const CString& pStrVal3, const CString& pStrVal4, const CString& pStrVal5);
void process( const std::vector< std::string>& pToRun);
! void apply( CString pScrF, CString pInF, CString pOutF, CString& pErrMsg);
void appendLog( CString t);
***************
*** 81,84 ****
--- 81,85 ----
void validatorGen();
void options();
+ void quit();
// script related methods
***************
*** 94,100 ****
--- 95,106 ----
static CString m_strOutputDirStringItem;
static CString m_strOutputDirStr;
+ static CString m_strIntermedDirStringItem;
+ static CString m_strIntermedDirStr;
public: // public static methods
static CString getDirectory( const CString& text = "Load .xme files from directory");
static bool directoryExists( const CString& dir);
+ static bool fileExists( const CString& file);
+ static CString placeIntoTargetDir( const CString& file);
+ static CString placeIntoIntermedDir( const CString& file);
};
- Previous message: [GME-commit]
GMESRC/GME/Gme GMEApp.cpp,1.136,1.137 GMEApp.h,1.31,1.32
- Next message: [GME-commit]
GMESRC/Tools/ModelMigrate/FrontEnd/res TAtom2Model.xsl,NONE,1.1
TModel2Atom.xsl,NONE,1.1 TParadigmGUIDChange.xsl,NONE,1.1
TParadigmNameChange.xsl,NONE,1.1
TParadigmVersionChange.xsl,NONE,1.1 TRemoveGlobalAttr.xsl,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the GME-commit
mailing list