OSDN Git Service

PATCH: [ 1669286 ] Remove dialog from MakeResDll
authorKimmo Varis <kimmov@gmail.com>
Mon, 26 Feb 2007 17:15:53 +0000 (17:15 +0000)
committerKimmo Varis <kimmov@gmail.com>
Mon, 26 Feb 2007 17:15:53 +0000 (17:15 +0000)
Tools/MakeResDll/Changes.txt
Tools/MakeResDll/MakeResDll.cpp
Tools/MakeResDll/MakeResDll.dsp
Tools/MakeResDll/VsVersionDlg.cpp [deleted file]
Tools/MakeResDll/VsVersionDlg.h [deleted file]

index d8d9e6c..afd6ade 100755 (executable)
@@ -1,6 +1,11 @@
 MakeResDll/Changes.txt
 Add new items to top
 
+2007-02-26 Kimmo
+ PATCH: [ 1669286 ] Remove dialog from MakeResDll
+  MakeResDll: MakeResDll.cpp MakeResDll.dsp
+  MakeResDll removed files: VsVersionDlg.cpp VsVersionDlg.h
+
 2006-08-27 Kimmo
  PATCH: [ 1547212 ] Fix MakeResDll project
   MakeResDll: MakeResDll.dsp
index 045f531..3e4df34 100755 (executable)
@@ -3,7 +3,7 @@
  *
  * @brief Code to compile & link a language satellite resource DLL, using Visual Studio
  */
-// RCS ID line follows -- this is updated by CVS
+// ID line follows -- this is updated by SVN
 // $Id$
 
 #include "stdafx.h"
@@ -12,7 +12,6 @@
 #include "coretools.h"
 #include "RegKey.h"
 // Local files
-#include "VsVersionDlg.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -23,6 +22,15 @@ static char THIS_FILE[] = __FILE__;
 /////////////////////////////////////////////////////////////////////////////
 // The one and only application object
 
+static LPCTSTR myregvals[] =
+{ // These must be laid out in the same order as VS5, VS6, VS2002, ...
+       _T("5"),
+       _T("6"),
+       _T("Net"),
+       _T("Net2003"),
+       _T("Net2005")
+};
+
 struct VcPaths
 {
        CString sRCExe;
@@ -69,12 +77,27 @@ static BOOL ProcessArgs(int argc, TCHAR* argv[]);
 static void FixPath();
 static bool DoesFileExist(LPCTSTR filepath);
 static void TrimPath(CString & sPath);
-static void DisplayUi(const CStringArray & VsBaseDirs);
+//static void DisplayUi(const CStringArray & VsBaseDirs);
 static void LoadVsBaseDirs(CStringArray & VsBaseDirs);
 
 using namespace std;
 
 /**
+ * @brief Map registry value to enum value, eg, "Net2003" => VS2003
+ */
+VS_VERSION MapRegistryValue(const CString & val) // static
+{
+       for (int i=0; i<VS_COUNT; ++i)
+       {
+               if (val == myregvals[i])
+               {
+                       return (VS_VERSION)i;
+               }
+       }
+       return VS_NONE;
+}
+
+/**
  * @brief Main entry point of (console mode) application
  */
 int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
@@ -109,8 +132,10 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 
                if (gbUi)
                {
-                       DisplayUi(VsBaseDirs);
-                       return 0;
+                       // TODO: Add console GUI - after all this is console app!
+                       
+                       //DisplayUi(VsBaseDirs);
+            return 0;
                }
 
                CString spath, sname, sext;
@@ -551,7 +576,7 @@ static void InitModulePaths(const CStringArray & VsBaseDirs)
        // Check if user's choice is valid and installed
        if (!sVcVersion.IsEmpty())
        {
-               VS_VERSION vstemp = CVsVersionDlg::MapRegistryValue(sVcVersion);
+               VS_VERSION vstemp = MapRegistryValue(sVcVersion);
                if (vstemp != VS_NONE)
                {
                        if (!VsBaseDirs[vstemp].IsEmpty())
@@ -869,18 +894,6 @@ static void TrimPath(CString & sPath)
 }
 
 /**
- * @brief Display dialog to let user choose preferences (Visual Studio version)
- */
-static void DisplayUi(const CStringArray & VsBaseDirs)
-{
-       CVsVersionDlg dlg(VsBaseDirs);
-
-       if (dlg.DoModal() == IDOK)
-       {
-       }
-}
-
-/**
  * @brief Load string array of base product directories for all installed Visual Studio versions
  */
 static void LoadVsBaseDirs(CStringArray & VsBaseDirs)
index 25e8a6c..9ba537a 100755 (executable)
@@ -87,18 +87,10 @@ LINK32=link.exe
 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
 # Begin Source File
 
-SOURCE=..\..\Src\Common\CMoveConstraint.cpp
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\Src\Common\coretools.cpp
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\Src\Common\CSubclass.cpp
-# End Source File
-# Begin Source File
-
 SOURCE=.\MakeResDll.cpp
 # End Source File
 # Begin Source File
@@ -114,28 +106,16 @@ SOURCE=..\..\Src\Common\RegKey.cpp
 SOURCE=.\StdAfx.cpp
 # ADD CPP /Yc"stdafx.h"
 # End Source File
-# Begin Source File
-
-SOURCE=.\VsVersionDlg.cpp
-# End Source File
 # End Group
 # Begin Group "Header Files"
 
 # PROP Default_Filter "h;hpp;hxx;hm;inl"
 # Begin Source File
 
-SOURCE=..\..\Src\Common\CMoveConstraint.h
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\Src\Common\coretools.h
 # End Source File
 # Begin Source File
 
-SOURCE=..\Src\Common\CSubclass.h
-# End Source File
-# Begin Source File
-
 SOURCE=.\MakeResDll.h
 # End Source File
 # Begin Source File
@@ -150,10 +130,6 @@ SOURCE=.\Resource.h
 
 SOURCE=.\StdAfx.h
 # End Source File
-# Begin Source File
-
-SOURCE=.\VsVersionDlg.h
-# End Source File
 # End Group
 # Begin Group "Resource Files"
 
diff --git a/Tools/MakeResDll/VsVersionDlg.cpp b/Tools/MakeResDll/VsVersionDlg.cpp
deleted file mode 100755 (executable)
index d085f8b..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-/**
- * @file  VsVersionDlg.cpp
- *
- * @brief Implementation of Visual Studio Version Dialog
- *
- */
-// RCS ID line follows -- this is updated by CVS
-// $Id$
-
-#include "stdafx.h"
-#include "resource.h"
-#include "VsVersionDlg.h"
-// Following files included from WinMerge/Src/Common
-#include "RegKey.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-// CVsVersionDlg dialog
-
-static int mybuttons[] = 
-{ // These must be laid out in the same order as VS5, VS6, VS2002, ...
-       IDC_VS5_BTN,
-       IDC_VS6_BTN,
-       IDC_VS2002_BTN,
-       IDC_VS2003_BTN,
-       IDC_VS2005_BTN
-};
-
-static LPCTSTR myregvals[] =
-{ // These must be laid out in the same order as VS5, VS6, VS2002, ...
-       _T("5"),
-       _T("6"),
-       _T("Net"),
-       _T("Net2003"),
-       _T("Net2005")
-};
-
-static LPCTSTR mysettings = _T("Software\\Thingamahoochie\\MakeResDll\\Settings");
-
-CVsVersionDlg::CVsVersionDlg(const CStringArray & VsBaseDirs, CWnd* pParent /*=NULL*/)
-: CDialog(CVsVersionDlg::IDD, pParent)
-, m_VsBaseDirs(VsBaseDirs)
-, m_nVersion(VS_NONE)
-, m_bestversion(VS_NONE)
-{
-       //{{AFX_DATA_INIT(CVsVersionDlg)
-               // NOTE: the ClassWizard will add member initialization here
-       //}}AFX_DATA_INIT
-}
-
-
-void CVsVersionDlg::DoDataExchange(CDataExchange* pDX)
-{
-       CDialog::DoDataExchange(pDX);
-       //{{AFX_DATA_MAP(CVsVersionDlg)
-       DDX_Control(pDX, IDC_INSTALL_DIR_TEXT, m_txtInstallDir);
-       //}}AFX_DATA_MAP
-}
-
-
-BEGIN_MESSAGE_MAP(CVsVersionDlg, CDialog)
-       //{{AFX_MSG_MAP(CVsVersionDlg)
-       ON_BN_CLICKED(IDC_VS2005_BTN, OnVs2005Btn)
-       ON_BN_CLICKED(IDC_VS2003_BTN, OnVs2003Btn)
-       ON_BN_CLICKED(IDC_VS2002_BTN, OnVs2002Btn)
-       ON_BN_CLICKED(IDC_VS6_BTN, OnVs6Btn)
-       ON_BN_CLICKED(IDC_VS5_BTN, OnVs5Btn)
-       //}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-/////////////////////////////////////////////////////////////////////////////
-// CVsVersionDlg message handlers
-
-BOOL CVsVersionDlg::OnInitDialog() 
-{
-       CDialog::OnInitDialog();
-
-       // Note: LoadImage gets shared icon, its not needed to destroy
-       HICON hMergeIcon = (HICON) LoadImage(AfxGetInstanceHandle(),
-                       MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16,
-                       LR_DEFAULTSIZE | LR_SHARED);
-       SetIcon(hMergeIcon, TRUE);
-
-       // setup handler for resizing this dialog       
-       m_constraint.InitializeCurrentSize(this);
-       // configure how individual controls adjust when dialog resizes
-       m_constraint.ConstrainItem(IDC_VSTUDIO_GROUP, 0, 1, 0, 0); // grows right
-       m_constraint.ConstrainItem(IDC_VS2005_BTN, 0, 1, 0, 0); // grows right
-       m_constraint.ConstrainItem(IDC_VS2003_BTN, 0, 1, 0, 0); // grows right
-       m_constraint.ConstrainItem(IDC_VS2002_BTN, 0, 1, 0, 0); // grows right
-       m_constraint.ConstrainItem(IDC_VS6_BTN, 0, 1, 0, 0); // grows right
-       m_constraint.ConstrainItem(IDC_VS5_BTN, 0, 1, 0, 0); // grows right
-       m_constraint.ConstrainItem(IDC_INSTALL_DIR_LABEL, 0, 1, 0, 0); // grows right
-       m_constraint.ConstrainItem(IDC_INSTALL_DIR_TEXT, 0, 1, 0, 0); // grows right
-       m_constraint.ConstrainItem(IDOK, 0.33, 0, 0, 0); // floats right
-       m_constraint.ConstrainItem(IDCANCEL, 0.67, 0, 0, 0); // floats right
-       m_constraint.DisallowHeightGrowth();
-       m_constraint.SubclassWnd(); // install subclassing
-       m_constraint.LoadPosition(_T("VsVersionDlg"), _T("OpenDlg"), false); // persist size via registry
-
-       DisableUninstalledVersions();
-       SelectInitialVersion();
-       UpdateInstallDir();
-       
-       return TRUE;  // return TRUE unless you set the focus to a control
-                     // EXCEPTION: OCX Property Pages should return FALSE
-}
-
-/**
- * @brief disable choices for any versions with no installation directories known
- */
-void CVsVersionDlg::DisableUninstalledVersions()
-{
-       CheckVersion(VS_2005);
-       CheckVersion(VS_2003);
-       CheckVersion(VS_2002);
-       CheckVersion(VS_6);
-       CheckVersion(VS_5);
-}
-
-/**
- * @brief Disable choice if not available (& keep track of best available)
- */
-void CVsVersionDlg::CheckVersion(VS_VERSION vsnum)
-{
-       int vsbutton = mybuttons[vsnum];
-       if (m_VsBaseDirs[vsnum].IsEmpty())
-               GetDlgItem(vsbutton)->EnableWindow(FALSE);
-       else if (vsnum > m_bestversion)
-               m_bestversion = vsnum;
-}
-
-/**
- * @brief Map registry value to enum value, eg, "Net2003" => VS2003
- */
-VS_VERSION CVsVersionDlg::MapRegistryValue(const CString & val) // static
-{
-       for (int i=0; i<VS_COUNT; ++i)
-       {
-               if (val == myregvals[i])
-               {
-                       return (VS_VERSION)i;
-               }
-       }
-       return VS_NONE;
-}
-
-/**
- * @brief Select the user's choice, or first one available
- */
-void CVsVersionDlg::SelectInitialVersion()
-{
-       m_nVersion = VS_NONE;
-       // Check for user-configured overrides
-       CRegKeyEx reg;
-       if (RegOpenUser(reg, mysettings))
-       {
-               CString sVcVersion = reg.ReadString(_T("VcVersion"), _T(""));
-               reg.Close();
-               m_nVersion = MapRegistryValue(sVcVersion);
-       }
-       if (m_nVersion == VS_NONE)
-       {
-               m_nVersion = m_bestversion;
-       }
-       if (m_nVersion != VS_NONE)
-       {
-               CheckVersionButton(m_nVersion, true);
-       }
-}
-
-/**
- * @brief check (or uncheck) specified version button (using VS5... enum)
- */
-void CVsVersionDlg::CheckVersionButton(VS_VERSION nversion, bool checked)
-{
-       ASSERT(nversion>VS_NONE && nversion<VS_COUNT);
-       int vsbutton = mybuttons[nversion];
-       ((CButton *)GetDlgItem(vsbutton))->SetCheck(checked ? 1 : 0);
-}
-
-/**
- * @brief Display installation dir for chosen version
- */
-void CVsVersionDlg::UpdateInstallDir()
-{
-       // First uncheck all buttons (otherwise disabled ones don't get cleared)
-       for (int i=0; i<VS_COUNT; ++i)
-       {
-               CheckVersionButton((VS_VERSION)i, false);
-       }
-       if (m_nVersion>=0 && m_nVersion<VS_COUNT)
-       {
-               CString txt = m_VsBaseDirs[m_nVersion];
-               m_txtInstallDir.SetWindowText(txt);
-               CheckVersionButton(m_nVersion, true);
-       }
-       else
-       {
-               m_txtInstallDir.SetWindowText(LoadResString(IDS_NO_VS_FOUND));
-       }
-}
-
-void CVsVersionDlg::OnVs2005Btn() 
-{
-       m_nVersion = VS_2005;
-       UpdateInstallDir();
-}
-
-void CVsVersionDlg::OnVs2003Btn() 
-{
-       m_nVersion = VS_2003;
-       UpdateInstallDir();
-}
-
-void CVsVersionDlg::OnVs2002Btn() 
-{
-       m_nVersion = VS_2002;
-       UpdateInstallDir();
-}
-
-void CVsVersionDlg::OnVs6Btn() 
-{
-       m_nVersion = VS_6;
-       UpdateInstallDir();
-}
-
-void CVsVersionDlg::OnVs5Btn() 
-{
-       m_nVersion = VS_5;
-       UpdateInstallDir();
-}
-
-
-void CVsVersionDlg::OnOK() 
-{
-       if (m_nVersion != VS_NONE)
-       {
-               CString regval = myregvals[m_nVersion];
-               CRegKeyEx reg;
-               if (reg.OpenWithAccess(HKEY_CURRENT_USER, mysettings, KEY_WRITE) != ERROR_SUCCESS)
-               {
-                       AfxMessageBox(IDS_ERROR_WRITING_PREF);
-                       return;
-               }
-               if (reg.WriteString(_T("VcVersion"), regval) != ERROR_SUCCESS)
-               {
-                       AfxMessageBox(IDS_ERROR_WRITING_PREF);
-                       return;
-               }
-       }
-       CDialog::OnOK();
-}
diff --git a/Tools/MakeResDll/VsVersionDlg.h b/Tools/MakeResDll/VsVersionDlg.h
deleted file mode 100755 (executable)
index 0bf321d..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * @file  VsVersionDlg.cpp
- *
- * @brief Declaration of Visual Studio Version Dialog
- *
- */
-// RCS ID line follows -- this is updated by CVS
-// $Id$
-
-
-#ifndef VsVersionDlg_h_included
-#define VsVersionDlg_h_included
-#pragma once
-
-/////////////////////////////////////////////////////////////////////////////
-// CVsVersionDlg dialog
-
-#ifndef CMoveConstraint_h
-#include "CMoveConstraint.h"
-#endif
-
-class CVsVersionDlg : public CDialog
-{
-// Construction
-public:
-       CVsVersionDlg(const CStringArray & VsBaseDirs, CWnd* pParent = NULL);   // standard constructor
-
-       VS_VERSION m_nVersion;
-
-       static VS_VERSION MapRegistryValue(const CString & val);
-
-// Implementation
-private:
-       VS_VERSION m_bestversion;
-       prdlg::CMoveConstraint m_constraint;
-       const CStringArray & m_VsBaseDirs;
-
-private:
-
-       void DisableUninstalledVersions();
-       void CheckVersion(VS_VERSION vsnum);
-       void SelectInitialVersion();
-       void UpdateInstallDir();
-       void CheckVersionButton(VS_VERSION nversion, bool checked);
-
-// Dialog Data
-       //{{AFX_DATA(CVsVersionDlg)
-       enum { IDD = IDD_VSVERSION };
-       CEdit   m_txtInstallDir;
-       //}}AFX_DATA
-
-
-// Overrides
-       // ClassWizard generated virtual function overrides
-       //{{AFX_VIRTUAL(CVsVersionDlg)
-       protected:
-       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
-       //}}AFX_VIRTUAL
-
-protected:
-
-       // Generated message map functions
-       //{{AFX_MSG(CVsVersionDlg)
-       afx_msg void OnVs2005Btn();
-       afx_msg void OnVs2003Btn();
-       afx_msg void OnVs2002Btn();
-       afx_msg void OnVs6Btn();
-       afx_msg void OnVs5Btn();
-       virtual BOOL OnInitDialog();
-       virtual void OnOK();
-       //}}AFX_MSG
-       DECLARE_MESSAGE_MAP()
-};
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-
-#endif // VsVersionDlg_h_included