Add support for comments in smpackage
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// EnterComment.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "EnterComment.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// EnterComment dialog
|
||||
|
||||
|
||||
EnterComment::EnterComment(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(EnterComment::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(EnterComment)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void EnterComment::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(EnterComment)
|
||||
DDX_Control(pDX, IDC_EDIT, m_edit);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(EnterComment, CDialog)
|
||||
//{{AFX_MSG_MAP(EnterComment)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// EnterComment message handlers
|
||||
|
||||
void EnterComment::OnOK()
|
||||
{
|
||||
// TODO: Add extra validation here
|
||||
|
||||
m_edit.GetWindowText( m_sEnteredComment );
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#if !defined(AFX_ENTERCOMMENT_H__DE628EA8_0FE7_4594_B2A2_47BDB283FA1E__INCLUDED_)
|
||||
#define AFX_ENTERCOMMENT_H__DE628EA8_0FE7_4594_B2A2_47BDB283FA1E__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// EnterComment.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// EnterComment dialog
|
||||
|
||||
class EnterComment : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
EnterComment(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
CString m_sEnteredComment;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(EnterComment)
|
||||
enum { IDD = IDD_ENTER_COMMENT };
|
||||
CEdit m_edit;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(EnterComment)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(EnterComment)
|
||||
virtual void OnOK();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_ENTERCOMMENT_H__DE628EA8_0FE7_4594_B2A2_47BDB283FA1E__INCLUDED_)
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "smpackageUtil.h"
|
||||
#include "EditInsallations.h"
|
||||
#include "ShowComment.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -121,7 +122,6 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
|
||||
|
||||
RefreshInstallationList();
|
||||
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
@@ -167,6 +167,19 @@ void CSMPackageInstallDlg::OnOK()
|
||||
CString sInstallDir;
|
||||
m_comboDir.GetWindowText( sInstallDir );
|
||||
|
||||
|
||||
// Show comment (if any)
|
||||
CString sComment = m_zip.GetGlobalComment();
|
||||
if( sComment != "" )
|
||||
{
|
||||
ShowComment commentDlg;
|
||||
commentDlg.m_sComment = sComment;
|
||||
int nResponse = commentDlg.DoModal();
|
||||
if( nResponse != IDOK )
|
||||
return; // cancelled
|
||||
}
|
||||
|
||||
|
||||
// Unzip the SMzip package into the Stepmania installation folder
|
||||
for( int i=0; i<m_zip.GetCount(); i++ )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
// ShowComment.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "smpackage.h"
|
||||
#include "ShowComment.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ShowComment dialog
|
||||
|
||||
|
||||
ShowComment::ShowComment(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(ShowComment::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(ShowComment)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void ShowComment::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(ShowComment)
|
||||
DDX_Control(pDX, IDC_EDIT, m_edit);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(ShowComment, CDialog)
|
||||
//{{AFX_MSG_MAP(ShowComment)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ShowComment message handlers
|
||||
|
||||
BOOL ShowComment::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
m_edit.SetWindowText( m_sComment );
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#if !defined(AFX_SHOWCOMMENT_H__1FA603E3_5CCD_4D9E_9EC9_88AD55A06270__INCLUDED_)
|
||||
#define AFX_SHOWCOMMENT_H__1FA603E3_5CCD_4D9E_9EC9_88AD55A06270__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// ShowComment.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ShowComment dialog
|
||||
|
||||
class ShowComment : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
ShowComment(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
CString m_sComment;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(ShowComment)
|
||||
enum { IDD = IDD_SHOW_COMMENT };
|
||||
CEdit m_edit;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(ShowComment)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(ShowComment)
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_SHOWCOMMENT_H__1FA603E3_5CCD_4D9E_9EC9_88AD55A06270__INCLUDED_)
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "ZipArchive\ZipArchive.h"
|
||||
#include "EnterName.h"
|
||||
#include "EnterComment.h"
|
||||
#include "smpackageUtil.h"
|
||||
#include "EditInsallations.h"
|
||||
|
||||
@@ -138,7 +139,7 @@ CString GetDesktopPath()
|
||||
return strPath;
|
||||
}
|
||||
|
||||
bool ExportPackage( CString sPackageName, const CStringArray& asDirectoriesToExport )
|
||||
bool ExportPackage( CString sPackageName, const CStringArray& asDirectoriesToExport, CString sComment )
|
||||
{
|
||||
CZipArchive zip;
|
||||
|
||||
@@ -159,6 +160,8 @@ bool ExportPackage( CString sPackageName, const CStringArray& asDirectoriesToExp
|
||||
}
|
||||
|
||||
|
||||
zip.SetGlobalComment( sComment );
|
||||
|
||||
//
|
||||
// Add files to zip
|
||||
//
|
||||
@@ -235,7 +238,15 @@ void CSmpackageExportDlg::OnButtonExportAsOne()
|
||||
sPackageName = nameDlg.m_sEnteredName;
|
||||
sPackageName = ReplaceInvalidFileNameChars( sPackageName+".smzip" );
|
||||
|
||||
if( ExportPackage( sPackageName, asPaths ) )
|
||||
// Generate a comment
|
||||
CString sComment;
|
||||
EnterComment commentDlg;
|
||||
nResponse = commentDlg.DoModal();
|
||||
if( nResponse != IDOK )
|
||||
return; // cancelled
|
||||
sComment = commentDlg.m_sEnteredComment;
|
||||
|
||||
if( ExportPackage( sPackageName, asPaths, sComment ) )
|
||||
AfxMessageBox( ssprintf("Successfully exported package '%s' to your Desktop.",sPackageName) );
|
||||
}
|
||||
|
||||
@@ -252,6 +263,15 @@ void CSmpackageExportDlg::OnButtonExportAsIndividual()
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate a comment
|
||||
CString sComment;
|
||||
EnterComment commentDlg;
|
||||
int nResponse = commentDlg.DoModal();
|
||||
if( nResponse != IDOK )
|
||||
return; // cancelled
|
||||
sComment = commentDlg.m_sEnteredComment;
|
||||
|
||||
|
||||
bool bAllSucceeded = true;
|
||||
CStringArray asExportedPackages;
|
||||
CStringArray asFailedPackages;
|
||||
@@ -269,7 +289,7 @@ void CSmpackageExportDlg::OnButtonExportAsIndividual()
|
||||
CStringArray asPathsToExport;
|
||||
asPathsToExport.Add( sPath );
|
||||
|
||||
if( ExportPackage( sPackageName, asPathsToExport ) )
|
||||
if( ExportPackage( sPackageName, asPathsToExport, sComment ) )
|
||||
asExportedPackages.Add( sPackageName );
|
||||
else
|
||||
asFailedPackages.Add( sPackageName );
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#define CONVERTTHEME 144
|
||||
#define IDD_EDIT_METRICS 145
|
||||
#define EDIT_METRICS 146
|
||||
#define IDD_ENTER_COMMENT 146
|
||||
#define IDD_SHOW_COMMENT 147
|
||||
#define IDC_LIST_SONGS 1000
|
||||
#define IDC_LIST 1000
|
||||
#define IDC_BUTTON_PLAY 1001
|
||||
|
||||
@@ -2,31 +2,36 @@
|
||||
|
||||
[General Info]
|
||||
Version=1
|
||||
LastClass=EditMetricsDlg
|
||||
LastClass=ShowComment
|
||||
LastTemplate=CDialog
|
||||
NewFileInclude1=#include "stdafx.h"
|
||||
NewFileInclude2=#include "smpackage.h"
|
||||
|
||||
ClassCount=9
|
||||
ClassCount=11
|
||||
Class1=CSmpackageApp
|
||||
Class2=CSmpackageDlg
|
||||
|
||||
ResourceCount=8
|
||||
ResourceCount=11
|
||||
Resource1=IDR_MAINFRAME
|
||||
Resource2=IDD_EXPORTER
|
||||
Resource2=IDD_ENTER_STRING
|
||||
Class3=CSMPackageInstallDlg
|
||||
Class4=CSmpackageExportDlg
|
||||
Resource3=IDD_MENU
|
||||
Resource3=IDD_ENTER_COMMENT
|
||||
Class5=EnterName
|
||||
Resource4=IDD_DIALOG_NAME
|
||||
Resource4=IDD_EXPORTER
|
||||
Class6=EditInsallations
|
||||
Resource5=IDD_INSTALL
|
||||
Resource5=IDD_MENU
|
||||
Class7=MainMenuDlg
|
||||
Resource6=IDD_EDIT_INSTALLATIONS
|
||||
Resource6=IDD_INSTALL
|
||||
Class8=ConvertThemeDlg
|
||||
Resource7=IDD_CONVERT_THEME
|
||||
Resource7=IDD_EDIT_INSTALLATIONS
|
||||
Class9=EditMetricsDlg
|
||||
Resource8=IDD_EDIT_METRICS
|
||||
Resource8=IDD_CONVERT_THEME
|
||||
Resource9=IDD_DIALOG_NAME
|
||||
Class10=EnterComment
|
||||
Resource10=IDD_EDIT_METRICS
|
||||
Class11=ShowComment
|
||||
Resource11=IDD_SHOW_COMMENT
|
||||
|
||||
[CLS:CSmpackageApp]
|
||||
Type=0
|
||||
@@ -95,16 +100,6 @@ Filter=D
|
||||
LastObject=CSmpackageExportDlg
|
||||
VirtualFilter=dWC
|
||||
|
||||
[DLG:IDD_DIALOG_NAME]
|
||||
Type=1
|
||||
Class=EnterName
|
||||
ControlCount=5
|
||||
Control1=IDC_STATIC,static,1342308352
|
||||
Control2=IDC_EDIT,edit,1350631552
|
||||
Control3=IDOK,button,1342242817
|
||||
Control4=IDCANCEL,button,1342242816
|
||||
Control5=IDC_STATIC,static,1342308352
|
||||
|
||||
[CLS:EnterName]
|
||||
Type=0
|
||||
HeaderFile=EnterName.h
|
||||
@@ -213,5 +208,59 @@ ImplementationFile=EditMetricsDlg.cpp
|
||||
BaseClass=CDialog
|
||||
Filter=D
|
||||
VirtualFilter=dWC
|
||||
LastObject=IDC_TREE
|
||||
LastObject=EditMetricsDlg
|
||||
|
||||
[DLG:IDD_ENTER_STRING]
|
||||
Type=1
|
||||
Class=EnterName
|
||||
ControlCount=4
|
||||
Control1=IDC_STATIC,static,1342308352
|
||||
Control2=IDC_EDIT,edit,1350631552
|
||||
Control3=IDOK,button,1342242817
|
||||
Control4=IDCANCEL,button,1342242816
|
||||
|
||||
[DLG:IDD_ENTER_COMMENT]
|
||||
Type=1
|
||||
Class=EnterComment
|
||||
ControlCount=4
|
||||
Control1=65535,static,1342308352
|
||||
Control2=IDC_EDIT,edit,1350631556
|
||||
Control3=IDOK,button,1342242817
|
||||
Control4=IDCANCEL,button,1342242816
|
||||
|
||||
[DLG:IDD_DIALOG_NAME]
|
||||
Type=1
|
||||
Class=?
|
||||
ControlCount=5
|
||||
Control1=IDC_STATIC,static,1342308352
|
||||
Control2=IDC_EDIT,edit,1350631552
|
||||
Control3=IDOK,button,1342242817
|
||||
Control4=IDCANCEL,button,1342242816
|
||||
Control5=IDC_STATIC,static,1342308352
|
||||
|
||||
[CLS:EnterComment]
|
||||
Type=0
|
||||
HeaderFile=EnterComment.h
|
||||
ImplementationFile=EnterComment.cpp
|
||||
BaseClass=CDialog
|
||||
Filter=D
|
||||
LastObject=IDC_EDIT
|
||||
VirtualFilter=dWC
|
||||
|
||||
[DLG:IDD_SHOW_COMMENT]
|
||||
Type=1
|
||||
Class=ShowComment
|
||||
ControlCount=3
|
||||
Control1=IDC_EDIT,edit,1350633604
|
||||
Control2=IDOK,button,1342242817
|
||||
Control3=IDCANCEL,button,1342242816
|
||||
|
||||
[CLS:ShowComment]
|
||||
Type=0
|
||||
HeaderFile=ShowComment.h
|
||||
ImplementationFile=ShowComment.cpp
|
||||
BaseClass=CDialog
|
||||
Filter=D
|
||||
VirtualFilter=dWC
|
||||
LastObject=ShowComment
|
||||
|
||||
|
||||
@@ -112,6 +112,14 @@ SOURCE=.\EditMetricsDlg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\EnterComment.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\EnterComment.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\EnterName.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -180,6 +188,14 @@ SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ShowComment.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ShowComment.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\smpackage.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -226,6 +226,29 @@ BEGIN
|
||||
PUSHBUTTON "Explanation",IDC_BUTTON_HELP,65,214,71,13
|
||||
END
|
||||
|
||||
IDD_ENTER_COMMENT DIALOG DISCARDABLE 0, 0, 312, 202
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Add A Comment"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "This message will be displayed before a user installs your package.",
|
||||
-1,7,7,219,12
|
||||
EDITTEXT IDC_EDIT,17,24,232,171,ES_MULTILINE | ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,255,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,255,24,50,14
|
||||
END
|
||||
|
||||
IDD_SHOW_COMMENT DIALOG DISCARDABLE 0, 0, 246, 186
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Package Comment"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT,7,7,232,151,ES_MULTILINE | ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
DEFPUSHBUTTON "OK",IDOK,72,165,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,128,165,50,14
|
||||
END
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -333,6 +356,22 @@ BEGIN
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 227
|
||||
END
|
||||
|
||||
IDD_ENTER_COMMENT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 305
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 195
|
||||
END
|
||||
|
||||
IDD_SHOW_COMMENT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 239
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 179
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
Reference in New Issue
Block a user