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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [pkgadmin/] [win32/] [PkgAdmin.cpp] - Blame information for rev 307

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

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

powered by: WebSVN 2.1.0

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