OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [pkgadmin/] [win32/] [PkgAdmin.cpp] - Blame information for rev 790

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####                                        
2
// -------------------------------------------                              
3
// This file is part of the eCos host tools.                                
4
// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.            
5
//
6
// This program is free software; you can redistribute it and/or modify     
7
// it under the terms of the GNU General Public License as published by     
8
// the Free Software Foundation; either version 2 or (at your option) any   
9
// later version.                                                           
10
//
11
// This program is distributed in the hope that it will be useful, but      
12
// WITHOUT ANY WARRANTY; without even the implied warranty of               
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        
14
// General Public License for more details.                                 
15
//
16
// You should have received a copy of the GNU General Public License        
17
// along with this program; if not, write to the                            
18
// Free Software Foundation, Inc., 51 Franklin Street,                      
19
// Fifth Floor, Boston, MA  02110-1301, USA.                                
20
// -------------------------------------------                              
21
// ####ECOSHOSTGPLCOPYRIGHTEND####                                          
22
// PkgAdmin.cpp : Defines the class behaviors for the application.
23
//
24
 
25
#include "stdafx.h"
26
#include "CSHDialog.h"
27
#include "eCosDialog.h"
28
#include "FileName.h"
29
#include "PkgAdmin.h"
30
#include "PkgAdminDlg.h"
31
#include "RegKeyEx.h"
32
 
33
#ifdef _DEBUG
34
#define new DEBUG_NEW
35
#undef THIS_FILE
36
static char THIS_FILE[] = __FILE__;
37
#endif
38
 
39
/////////////////////////////////////////////////////////////////////////////
40
// CPkgAdminApp
41
 
42
BEGIN_MESSAGE_MAP(CPkgAdminApp, CWinApp)
43
        //{{AFX_MSG_MAP(CPkgAdminApp)
44
                // NOTE - the ClassWizard will add and remove mapping macros here.
45
                //    DO NOT EDIT what you see in these blocks of generated code!
46
        //}}AFX_MSG
47
        ON_COMMAND(ID_HELP, CWinApp::OnHelp)
48
END_MESSAGE_MAP()
49
 
50
/////////////////////////////////////////////////////////////////////////////
51
// CPkgAdminApp construction
52
 
53
CPkgAdminApp::CPkgAdminApp()
54
{
55
        // TODO: add construction code here,
56
        // Place all significant initialization in InitInstance
57
}
58
 
59
/////////////////////////////////////////////////////////////////////////////
60
// The one and only CPkgAdminApp object
61
 
62
CPkgAdminApp theApp;
63
 
64
/////////////////////////////////////////////////////////////////////////////
65
// CPkgAdminApp initialization
66
 
67
BOOL CPkgAdminApp::InitInstance()
68
{
69
  CFileName strCSHFile;
70
  ::GetModuleFileName(::GetModuleHandle(NULL),strCSHFile.GetBuffer(1+MAX_PATH),MAX_PATH);
71
  strCSHFile.ReleaseBuffer();
72
  strCSHFile.ReplaceExtension(_T(".chm"));
73
  CCSHDialog::SetCSHFilePath(strCSHFile);
74
 
75
  extern UINT  arPkgAdminDialogMap[];
76
  CeCosDialog::AddDialogMap(arPkgAdminDialogMap);
77
 
78
        SetRegistryKey (_T("Red Hat\\eCos"));
79
 
80
        // Standard initialization
81
        // If you are not using these features and wish to reduce the size
82
        //  of your final executable, you should remove from the following
83
        //  the specific initialization routines you do not need.
84
  LPCTSTR pszRepositoryKeyName=_T("Software\\Red Hat\\eCos\\Common\\Repository");
85
  LPCTSTR pszRepositoryValueName=_T("Folder");
86
 
87
  CFileName strRepository;
88
  {
89
    CRegKeyEx k(HKEY_CURRENT_USER,pszRepositoryKeyName, KEY_READ);
90
    if(k.QueryValue(pszRepositoryValueName, strRepository)){
91
      if ((strRepository + _T("ecc")).IsDir () && ! (strRepository + _T("packages")).IsDir ()) {
92
        strRepository += _T("ecc");
93
      } else {
94
        strRepository += _T("packages");
95
      }
96
    }
97
  }
98
 
99
  CPkgAdminDlg dlg(strRepository);
100
  dlg.m_hIcon = LoadIcon(IDR_PKGADMIN_MAINFRAME);
101
  m_pMainWnd = &dlg;
102
 
103
  int nResponse = dlg.DoModal();
104
 
105
  dlg.m_strRepository.Replace(_TCHAR('/'),_TCHAR('\\'));
106
  int nIndex=dlg.m_strRepository.ReverseFind(_TCHAR('\\'));
107
  if(-1!=nIndex){
108
    CRegKeyEx k(HKEY_CURRENT_USER,pszRepositoryKeyName, KEY_WRITE);
109
    k.SetValue(dlg.m_strRepository.Left(nIndex), pszRepositoryValueName);
110
  }
111
 
112
  // Since the dialog has been closed, return FALSE so that we exit the
113
  //  application, rather than start the application's message pump.
114
  return FALSE;
115
}
116
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.