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 |
|
|
// packagesdlg.h :
|
23 |
|
|
//
|
24 |
|
|
//===========================================================================
|
25 |
|
|
//#####DESCRIPTIONBEGIN####
|
26 |
|
|
//
|
27 |
|
|
// Author(s): julians
|
28 |
|
|
// Contact(s): julians
|
29 |
|
|
// Date: 2000/09/28
|
30 |
|
|
// Version: $Id: packagesdlg.h,v 1.6 2001/12/14 17:34:04 julians Exp $
|
31 |
|
|
// Purpose:
|
32 |
|
|
// Description: Header file for ecPackagesDialog
|
33 |
|
|
// Requires:
|
34 |
|
|
// Provides:
|
35 |
|
|
// See also:
|
36 |
|
|
// Known bugs:
|
37 |
|
|
// Usage:
|
38 |
|
|
//
|
39 |
|
|
//####DESCRIPTIONEND####
|
40 |
|
|
//
|
41 |
|
|
//===========================================================================
|
42 |
|
|
|
43 |
|
|
#ifndef _ECOS_PACKAGESDLG_H_
|
44 |
|
|
#define _ECOS_PACKAGESDLG_H_
|
45 |
|
|
|
46 |
|
|
#ifdef __GNUG__
|
47 |
|
|
#pragma interface "packagesdlg.cpp"
|
48 |
|
|
#endif
|
49 |
|
|
|
50 |
|
|
#include "ecutils.h"
|
51 |
|
|
#include "wx/timer.h"
|
52 |
|
|
|
53 |
|
|
/*
|
54 |
|
|
* ecPackagesTimer
|
55 |
|
|
* Just to force idle processing now and again
|
56 |
|
|
* so that the keyword search works under OSes that
|
57 |
|
|
* have unreliable OnIdle processing
|
58 |
|
|
*/
|
59 |
|
|
|
60 |
|
|
class ecPackagesDialog;
|
61 |
|
|
class ecPackagesTimer: public wxTimer
|
62 |
|
|
{
|
63 |
|
|
public:
|
64 |
|
|
ecPackagesTimer(ecPackagesDialog* dialog) { m_dialog = dialog; }
|
65 |
|
|
|
66 |
|
|
virtual void Notify() ;
|
67 |
|
|
protected:
|
68 |
|
|
ecPackagesDialog* m_dialog;
|
69 |
|
|
};
|
70 |
|
|
|
71 |
|
|
/*
|
72 |
|
|
* Add/remove packages
|
73 |
|
|
*/
|
74 |
|
|
|
75 |
|
|
class ecPackagesDialog : public ecDialog
|
76 |
|
|
{
|
77 |
|
|
public:
|
78 |
|
|
// Ctor(s)
|
79 |
|
|
ecPackagesDialog(wxWindow* parent);
|
80 |
|
|
~ecPackagesDialog();
|
81 |
|
|
|
82 |
|
|
//// Event handlers
|
83 |
|
|
|
84 |
|
|
void OnOK(wxCommandEvent& event);
|
85 |
|
|
void OnCancel(wxCommandEvent& event);
|
86 |
|
|
void OnAdd(wxCommandEvent& event);
|
87 |
|
|
void OnRemove(wxCommandEvent& event);
|
88 |
|
|
void OnClickListBox1(wxCommandEvent& event);
|
89 |
|
|
void OnClickListBox2(wxCommandEvent& event);
|
90 |
|
|
void OnDblClickListBox1(wxCommandEvent& event);
|
91 |
|
|
void OnDblClickListBox2(wxCommandEvent& event);
|
92 |
|
|
void OnSelectVersion(wxCommandEvent& event);
|
93 |
|
|
void OnInitDialog(wxInitDialogEvent& event);
|
94 |
|
|
|
95 |
|
|
//// Operations
|
96 |
|
|
void CreateControls(wxWindow* parent);
|
97 |
|
|
void InitControls();
|
98 |
|
|
void Fill();
|
99 |
|
|
void Insert(const wxString& str, bool added, const wxString& descr = wxEmptyString, const wxString& version = wxEmptyString);
|
100 |
|
|
void Add(wxListBox* from, wxListBox* to);
|
101 |
|
|
void DisplayDescription(const wxString& item);
|
102 |
|
|
void ClearDescription();
|
103 |
|
|
void HardwarePackageMessageBox();
|
104 |
|
|
void UpdateHardwareSelectionFlag();
|
105 |
|
|
void UpdatePackageDescription();
|
106 |
|
|
void UpdateVersionList();
|
107 |
|
|
void UpdateAddRemoveButtons();
|
108 |
|
|
void ClearSelections(wxListBox& lbox);
|
109 |
|
|
|
110 |
|
|
void OnClearKeywords(wxCommandEvent& event);
|
111 |
|
|
void OnUpdateKeywordText(wxCommandEvent& event);
|
112 |
|
|
void OnClickOmitHardwarePackages(wxCommandEvent& event);
|
113 |
|
|
void OnClickExactMatch(wxCommandEvent& event);
|
114 |
|
|
|
115 |
|
|
void OnIdle(wxIdleEvent& event);
|
116 |
|
|
|
117 |
|
|
//// Helpers
|
118 |
|
|
// For each word in keywords, is it contained in 'str'?
|
119 |
|
|
bool MatchesKeyword(wxArrayString& keywords, const wxString& str);
|
120 |
|
|
|
121 |
|
|
//// Accessors
|
122 |
|
|
bool IsAdded(const wxString& str) ;
|
123 |
|
|
#if wxCHECK_VERSION(2, 6, 0)
|
124 |
|
|
int GetCount() const { return m_items.GetCount(); }
|
125 |
|
|
#else
|
126 |
|
|
int GetCount() const { return m_items.Number(); }
|
127 |
|
|
#endif
|
128 |
|
|
wxString GetVersion (const wxString& item);
|
129 |
|
|
|
130 |
|
|
protected:
|
131 |
|
|
|
132 |
|
|
private:
|
133 |
|
|
DECLARE_EVENT_TABLE()
|
134 |
|
|
|
135 |
|
|
wxStringList m_items;
|
136 |
|
|
wxStringList m_descriptions;
|
137 |
|
|
wxArrayString m_currentVersions;
|
138 |
|
|
wxArrayString m_added; // All those packages currently (or to-be) added
|
139 |
|
|
wxArrayInt m_arnItems; // Whether in 'use list' (1) or not (0)
|
140 |
|
|
|
141 |
|
|
bool m_bHardwarePackageSelected;
|
142 |
|
|
wxString m_packageDescription;
|
143 |
|
|
wxString m_keywords;
|
144 |
|
|
bool m_updateLists; // If true, the keyword changed and we need to update the lists
|
145 |
|
|
long m_updateInterval; // Interval before display is updated
|
146 |
|
|
ecPackagesTimer m_timer;
|
147 |
|
|
};
|
148 |
|
|
|
149 |
|
|
#define ecID_PACKAGES_DIALOG_AVAILABLE_LIST 10066
|
150 |
|
|
#define ecID_PACKAGES_DIALOG_ADD 10067
|
151 |
|
|
#define ecID_PACKAGES_DIALOG_REMOVE 10068
|
152 |
|
|
#define ecID_PACKAGES_DIALOG_USE_LIST 10069
|
153 |
|
|
#define ecID_PACKAGES_DIALOG_VERSION 10070
|
154 |
|
|
#define ecID_PACKAGES_DIALOG_DESCRIPTION 10071
|
155 |
|
|
#define ecID_PACKAGES_DIALOG_KEYWORDS 10072
|
156 |
|
|
#define ecID_PACKAGES_DIALOG_CLEAR 10073
|
157 |
|
|
#define ecID_PACKAGES_DIALOG_OMIT_HARDWARE 10074
|
158 |
|
|
#define ecID_PACKAGES_DIALOG_EXACT_MATCH 10075
|
159 |
|
|
|
160 |
|
|
#endif
|
161 |
|
|
// _ECOS_PACKAGESDLG_H_
|