Added support for multiple installation dirs to smpackage export screen.
This commit is contained in:
@@ -119,12 +119,6 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
|
||||
pEdit3->SetWindowText( sMessage3 );
|
||||
|
||||
|
||||
|
||||
TCHAR szCurrentDirectory[MAX_PATH];
|
||||
GetCurrentDirectory( MAX_PATH, szCurrentDirectory );
|
||||
AddStepManiaInstallDir( szCurrentDirectory );
|
||||
|
||||
|
||||
RefreshInstallationList();
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "RageUtil.h"
|
||||
#include "ZipArchive\ZipArchive.h"
|
||||
#include "EnterName.h"
|
||||
#include "smpackageUtil.h"
|
||||
#include "EditInsallations.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
@@ -31,6 +33,7 @@ void CSmpackageExportDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CSmpackageExportDlg)
|
||||
DDX_Control(pDX, IDC_COMBO_DIR, m_comboDir);
|
||||
DDX_Control(pDX, IDC_BUTTON_EXPORT_AS_INDIVIDUAL, m_buttonExportAsIndividual);
|
||||
DDX_Control(pDX, IDC_BUTTON_EXPORT_AS_ONE, m_buttonExportAsOne);
|
||||
DDX_Control(pDX, IDC_TREE, m_tree);
|
||||
@@ -43,6 +46,8 @@ BEGIN_MESSAGE_MAP(CSmpackageExportDlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_BUTTON_EXPORT_AS_ONE, OnButtonExportAsOne)
|
||||
ON_BN_CLICKED(IDC_BUTTON_EXPORT_AS_INDIVIDUAL, OnButtonExportAsIndividual)
|
||||
ON_BN_CLICKED(IDC_BUTTON_PLAY, OnButtonPlay)
|
||||
ON_BN_CLICKED(IDC_BUTTON_EDIT, OnButtonEdit)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_DIR, OnSelchangeComboDir)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
@@ -56,110 +61,9 @@ BOOL CSmpackageExportDlg::OnInitDialog()
|
||||
// TODO: Add extra initialization here
|
||||
//
|
||||
|
||||
// Add announcers
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Announcers" );
|
||||
GetDirListing( "Announcers\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add themes
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Themes" );
|
||||
GetDirListing( "Themes\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add BGAnimations
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "BGAnimations" );
|
||||
GetDirListing( "BGAnimations\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add RandomMovies
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "RandomMovies" );
|
||||
GetDirListing( "RandomMovies\\*.avi", as1, false, false );
|
||||
GetDirListing( "RandomMovies\\*.mpg", as1, false, false );
|
||||
GetDirListing( "RandomMovies\\*.mpeg", as1, false, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add visualizations
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Visualizations" );
|
||||
GetDirListing( "Visualizations\\*.avi", as1, false, false );
|
||||
GetDirListing( "Visualizations\\*.mpg", as1, false, false );
|
||||
GetDirListing( "Visualizations\\*.mpeg", as1, false, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add courses
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Courses" );
|
||||
GetDirListing( "Courses\\*.crs", as1, false, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
{
|
||||
as1[i] = as1[i].Left(as1[i].GetLength()-4); // strip off ".crs"
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Add NoteSkins
|
||||
//
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "NoteSkins" );
|
||||
GetDirListing( "NoteSkins\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
{
|
||||
CStringArray as2;
|
||||
HTREEITEM item2 = m_tree.InsertItem( as1[i], item1 );
|
||||
GetDirListing( "NoteSkins\\" + as1[i] + "\\*.*", as2, true, false );
|
||||
for( int j=0; j<as2.GetSize(); j++ )
|
||||
m_tree.InsertItem( as2[j], item2 );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add Songs
|
||||
//
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Songs" );
|
||||
GetDirListing( "Songs\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
{
|
||||
CStringArray as2;
|
||||
HTREEITEM item2 = m_tree.InsertItem( as1[i], item1 );
|
||||
GetDirListing( "Songs\\" + as1[i] + "\\*.*", as2, true, false );
|
||||
for( int j=0; j<as2.GetSize(); j++ )
|
||||
m_tree.InsertItem( as2[j], item2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Strip out any "CVS" items
|
||||
CArray<HTREEITEM,HTREEITEM> aItems;
|
||||
GetTreeItems( aItems );
|
||||
for( int i=0; i<aItems.GetSize(); i++ )
|
||||
if( m_tree.GetItemText(aItems[i]).CompareNoCase("CVS")==0 )
|
||||
m_tree.DeleteItem( aItems[i] );
|
||||
|
||||
RefreshInstallationList();
|
||||
|
||||
RefreshTree();
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
@@ -445,3 +349,149 @@ void CSmpackageExportDlg::GetCheckedPaths( CStringArray& aPathsOut )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CSmpackageExportDlg::OnButtonEdit()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
EditInsallations dlg;
|
||||
int nResponse = dlg.DoModal();
|
||||
if( nResponse == IDOK )
|
||||
{
|
||||
WriteStepManiaInstallDirs( dlg.m_asReturnedInstallDirs );
|
||||
RefreshInstallationList();
|
||||
RefreshTree();
|
||||
}
|
||||
}
|
||||
|
||||
void CSmpackageExportDlg::RefreshInstallationList()
|
||||
{
|
||||
m_comboDir.ResetContent();
|
||||
|
||||
CStringArray asInstallDirs;
|
||||
GetStepManiaInstallDirs( asInstallDirs );
|
||||
for( int i=0; i<asInstallDirs.GetSize(); i++ )
|
||||
{
|
||||
m_comboDir.AddString( asInstallDirs[i] );
|
||||
}
|
||||
m_comboDir.SetCurSel( 0 ); // guaranteed to be at least one item
|
||||
}
|
||||
|
||||
void CSmpackageExportDlg::OnSelchangeComboDir()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
RefreshTree();
|
||||
}
|
||||
|
||||
void CSmpackageExportDlg::RefreshTree()
|
||||
{
|
||||
m_tree.DeleteAllItems();
|
||||
|
||||
CString sDir;
|
||||
m_comboDir.GetWindowText( sDir );
|
||||
|
||||
SetCurrentDirectory( sDir );
|
||||
|
||||
// Add announcers
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Announcers" );
|
||||
GetDirListing( "Announcers\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add themes
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Themes" );
|
||||
GetDirListing( "Themes\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add BGAnimations
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "BGAnimations" );
|
||||
GetDirListing( "BGAnimations\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add RandomMovies
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "RandomMovies" );
|
||||
GetDirListing( "RandomMovies\\*.avi", as1, false, false );
|
||||
GetDirListing( "RandomMovies\\*.mpg", as1, false, false );
|
||||
GetDirListing( "RandomMovies\\*.mpeg", as1, false, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add visualizations
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Visualizations" );
|
||||
GetDirListing( "Visualizations\\*.avi", as1, false, false );
|
||||
GetDirListing( "Visualizations\\*.mpg", as1, false, false );
|
||||
GetDirListing( "Visualizations\\*.mpeg", as1, false, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
|
||||
// Add courses
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Courses" );
|
||||
GetDirListing( "Courses\\*.crs", as1, false, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
{
|
||||
as1[i] = as1[i].Left(as1[i].GetLength()-4); // strip off ".crs"
|
||||
m_tree.InsertItem( as1[i], item1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Add NoteSkins
|
||||
//
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "NoteSkins" );
|
||||
GetDirListing( "NoteSkins\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
{
|
||||
CStringArray as2;
|
||||
HTREEITEM item2 = m_tree.InsertItem( as1[i], item1 );
|
||||
GetDirListing( "NoteSkins\\" + as1[i] + "\\*.*", as2, true, false );
|
||||
for( int j=0; j<as2.GetSize(); j++ )
|
||||
m_tree.InsertItem( as2[j], item2 );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add Songs
|
||||
//
|
||||
{
|
||||
CStringArray as1;
|
||||
HTREEITEM item1 = m_tree.InsertItem( "Songs" );
|
||||
GetDirListing( "Songs\\*.*", as1, true, false );
|
||||
for( int i=0; i<as1.GetSize(); i++ )
|
||||
{
|
||||
CStringArray as2;
|
||||
HTREEITEM item2 = m_tree.InsertItem( as1[i], item1 );
|
||||
GetDirListing( "Songs\\" + as1[i] + "\\*.*", as2, true, false );
|
||||
for( int j=0; j<as2.GetSize(); j++ )
|
||||
m_tree.InsertItem( as2[j], item2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Strip out any "CVS" items
|
||||
CArray<HTREEITEM,HTREEITEM> aItems;
|
||||
GetTreeItems( aItems );
|
||||
for( int i=0; i<aItems.GetSize(); i++ )
|
||||
if( m_tree.GetItemText(aItems[i]).CompareNoCase("CVS")==0 )
|
||||
m_tree.DeleteItem( aItems[i] );
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CSmpackageExportDlg)
|
||||
enum { IDD = IDD_EXPORTER };
|
||||
CComboBox m_comboDir;
|
||||
CButton m_buttonExportAsIndividual;
|
||||
CButton m_buttonExportAsOne;
|
||||
CTreeCtrl m_tree;
|
||||
@@ -37,7 +38,8 @@ public:
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
void RefreshInstallationList();
|
||||
void RefreshTree();
|
||||
void GetTreeItems( CArray<HTREEITEM,HTREEITEM>& aItemsOut );
|
||||
void GetCheckedTreeItems( CArray<HTREEITEM,HTREEITEM>& aCheckedItemsOut );
|
||||
void GetCheckedPaths( CStringArray& aCheckedItemsOut );
|
||||
@@ -48,6 +50,8 @@ protected:
|
||||
afx_msg void OnButtonExportAsOne();
|
||||
afx_msg void OnButtonExportAsIndividual();
|
||||
afx_msg void OnButtonPlay();
|
||||
afx_msg void OnButtonEdit();
|
||||
afx_msg void OnSelchangeComboDir();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[General Info]
|
||||
Version=1
|
||||
LastClass=EditInsallations
|
||||
LastClass=CSmpackageExportDlg
|
||||
LastTemplate=CDialog
|
||||
NewFileInclude1=#include "stdafx.h"
|
||||
NewFileInclude2=#include "smpackage.h"
|
||||
@@ -13,10 +13,10 @@ Class2=CSmpackageDlg
|
||||
|
||||
ResourceCount=5
|
||||
Resource1=IDR_MAINFRAME
|
||||
Resource2=IDD_DIALOG_NAME
|
||||
Resource2=IDD_EXPORTER
|
||||
Class3=CSMPackageInstallDlg
|
||||
Class4=CSmpackageExportDlg
|
||||
Resource3=IDD_EXPORTER
|
||||
Resource3=IDD_DIALOG_NAME
|
||||
Class5=EnterName
|
||||
Resource4=IDD_INSTALL
|
||||
Class6=EditInsallations
|
||||
@@ -62,19 +62,22 @@ HeaderFile=SMPackageInstallDlg.h
|
||||
ImplementationFile=SMPackageInstallDlg.cpp
|
||||
BaseClass=CDialog
|
||||
Filter=D
|
||||
LastObject=IDC_COMBO_DIR
|
||||
LastObject=CSMPackageInstallDlg
|
||||
VirtualFilter=dWC
|
||||
|
||||
[DLG:IDD_EXPORTER]
|
||||
Type=1
|
||||
Class=CSmpackageExportDlg
|
||||
ControlCount=6
|
||||
ControlCount=9
|
||||
Control1=IDOK,button,1342242817
|
||||
Control2=IDC_BUTTON_PLAY,button,1342242816
|
||||
Control3=IDC_BUTTON_EXPORT_AS_ONE,button,1342242816
|
||||
Control4=IDC_STATIC,static,1342177294
|
||||
Control5=IDC_BUTTON_EXPORT_AS_INDIVIDUAL,button,1342242816
|
||||
Control6=IDC_TREE,SysTreeView32,1350631687
|
||||
Control7=IDC_COMBO_DIR,combobox,1344339971
|
||||
Control8=IDC_BUTTON_EDIT,button,1342242816
|
||||
Control9=IDC_STATIC,static,1342308352
|
||||
|
||||
[CLS:CSmpackageExportDlg]
|
||||
Type=0
|
||||
@@ -82,7 +85,7 @@ HeaderFile=SmpackageExportDlg.h
|
||||
ImplementationFile=SmpackageExportDlg.cpp
|
||||
BaseClass=CDialog
|
||||
Filter=D
|
||||
LastObject=CSmpackageExportDlg
|
||||
LastObject=IDC_COMBO_DIR
|
||||
VirtualFilter=dWC
|
||||
|
||||
[DLG:IDD_DIALOG_NAME]
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "smpackageExportDlg.h"
|
||||
#include "smpackageInstallDlg.h"
|
||||
#include "RageUtil.h"
|
||||
#include "smpackageUtil.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -54,7 +55,6 @@ BOOL CSmpackageApp::InitInstance()
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Make sure the current directory is the root program directory
|
||||
|
||||
// change dir to path of the execuctable
|
||||
@@ -67,10 +67,12 @@ BOOL CSmpackageApp::InitInstance()
|
||||
|
||||
SetCurrentDirectory(szFullAppPath);
|
||||
|
||||
if( !DoesFileExist("Songs") )
|
||||
if( DoesFileExist("Songs") ) // this is a SM or DWI program directory
|
||||
{
|
||||
AfxMessageBox( "Your Songs folder could not be located. Be sure 'smpackage.exe' is in your Stepmania installation folder.", MB_ICONSTOP );
|
||||
exit( 1 );
|
||||
// make sure it's in the list of install directories
|
||||
TCHAR szCurrentDirectory[MAX_PATH];
|
||||
GetCurrentDirectory( MAX_PATH, szCurrentDirectory );
|
||||
AddStepManiaInstallDir( szCurrentDirectory );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -105,13 +105,17 @@ FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Close",IDOK,255,215,69,14
|
||||
PUSHBUTTON "Play Stepmania",IDC_BUTTON_PLAY,5,215,70,15
|
||||
PUSHBUTTON "Export As One",IDC_BUTTON_EXPORT_AS_ONE,255,75,69,15
|
||||
PUSHBUTTON "Export As One",IDC_BUTTON_EXPORT_AS_ONE,255,104,69,15
|
||||
CONTROL 135,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
|
||||
PUSHBUTTON "Export As Individual",IDC_BUTTON_EXPORT_AS_INDIVIDUAL,
|
||||
255,108,69,15
|
||||
255,137,69,15
|
||||
CONTROL "Tree2",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS |
|
||||
TVS_HASLINES | TVS_LINESATROOT | TVS_CHECKBOXES |
|
||||
WS_BORDER | WS_TABSTOP,7,41,239,167
|
||||
WS_BORDER | WS_TABSTOP,7,61,239,151
|
||||
COMBOBOX IDC_COMBO_DIR,74,40,170,105,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Edit Installations",IDC_BUTTON_EDIT,253,39,71,14
|
||||
LTEXT "Select Installation:",IDC_STATIC,7,42,66,11
|
||||
END
|
||||
|
||||
IDD_DIALOG_NAME DIALOG DISCARDABLE 0, 0, 261, 58
|
||||
|
||||
@@ -14,7 +14,8 @@ inline void WriteStepManiaInstallDirs( const CStringArray& asInstallDirsToWrite
|
||||
for( i=0; i<100; i++ )
|
||||
{
|
||||
CString sName = ssprintf("%d",i);
|
||||
Reg.DeleteKey( sName );
|
||||
// Reg.DeleteKey( sName ); // delete key is broken in this library, so just write over it with ""
|
||||
Reg.WriteString( sName, "" );
|
||||
}
|
||||
|
||||
for( i=0; i<asInstallDirsToWrite.GetSize(); i++ )
|
||||
@@ -57,7 +58,7 @@ inline void AddStepManiaInstallDir( CString sNewInstallDir )
|
||||
bool bAlreadyInList = false;
|
||||
for( int i=0; i<asInstallDirs.GetSize(); i++ )
|
||||
{
|
||||
if( asInstallDirs[i] == sNewInstallDir )
|
||||
if( asInstallDirs[i].CompareNoCase(sNewInstallDir) == 0 )
|
||||
{
|
||||
bAlreadyInList = true;
|
||||
break;
|
||||
@@ -69,3 +70,4 @@ inline void AddStepManiaInstallDir( CString sNewInstallDir )
|
||||
|
||||
WriteStepManiaInstallDirs( asInstallDirs );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user