00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _PMPROPPANEL_H_
00013 #define _PMPROPPANEL_H_
00014
00015
00020 #include <wx/listbox.h>
00021
00022 #include "guipm/extcmdoptionspanel.h"
00023 #include "guipkg/excludedlg.h"
00024
00025 #include "wxp/packageutils.h"
00026 #include "wxp/packagedep.h"
00027 #include "wxp/packagecmd.h"
00028 #include "wxp/packagewxp.h"
00029
00034 class wxListBox;
00035 class wxRadioButton;
00036 class wxRadioBox;
00037 class wxTreeCtrl;
00038 class wxTreeItemId;
00039 class wxStaticBitmap;
00040 class wxDatePickerCtrl;
00041 class wxOptionListCtrl;
00042 class wxSpinCtrl;
00043 class wxPackageSourceEditCtrl;
00044 class wxDirPickerCtrl;
00045 class wxFileDirPickerEvent;
00046 class wxExplorerTreeCtrl;
00047 class wxExplorerTreeEvent;
00048 class wxPackageExcludeListBox;
00049 class wxCheckListBox;
00050 class wxSplitterWindow;
00051
00056
00057 #define ID_PROP_PACKAGING_PAGE 1151
00058 #define ID_PROP_TAR 1120
00059 #define ID_PROP_ZIP 1117
00060 #define ID_PROP_FILENAME 1157
00061 #define ID_PROP_UPLOAD 1158
00062 #define ID_PROP_PROJECT_DIR 1100
00063 #define ID_PROP_WXP_DIR 1148
00064 #define ID_PROP_RELATIVE_ROOT 1137
00065 #define ID_PROP_INCLUDED_TREE 1121
00066 #define ID_PROP_REFRESH_INCLUDED 1149
00067 #define ID_PROP_EXPAND_INCLUDED 1135
00068 #define ID_PROP_COLLAPSE_INCLUDED 1136
00069 #define ID_PROP_EXCLUDED 1147
00070 #define ID_PROP_NEW_EXCLUDED 1145
00071 #define ID_PROP_DELETE_EXCLUDED 1146
00072 #define ID_PROP_BASICS_PAGE 1150
00073 #define ID_PROP_NAME 1101
00074 #define ID_PROP_VERSION 1105
00075 #define ID_PROP_DESCRIPTION 1107
00076 #define ID_PROP_KEYWORDS 1109
00077 #define ID_PROP_CATEGORY1 1110
00078 #define ID_PROP_CATEGORY2 1165
00079 #define ID_PROP_LICENSING_PAGE 1152
00080 #define ID_PROP_LICENSE 1103
00081 #define ID_PROP_LICENSE_REF 1127
00082 #define ID_PROP_LICENSETYPE 1111
00083 #define ID_PROP_ORGANISATION 1124
00084 #define ID_PROP_ORGANISATION_WEBSITE 1126
00085 #define ID_PROP_COST 1128
00086 #define ID_PROP_COPYRIGHT 1169
00087 #define ID_PROP_CREDITS 1168
00088 #define ID_PROP_AUTHORS 1104
00089 #define ID_PROP_NEW_AUTHOR 1171
00090 #define ID_PROP_DELETE_AUTHOR 1173
00091 #define ID_PROP_MAINTAINERS 1170
00092 #define ID_PROP_NEW_MAINTAINER 1172
00093 #define ID_PROP_DELETE_MAINTAINER 1174
00094 #define ID_PROP_DETAILS_PAGE 1153
00095 #define ID_PROP_STATUS 1106
00096 #define ID_PROP_CREATIONDATE 1166
00097 #define ID_PROP_PROGLANGUAGE 1108
00098 #define ID_PROP_WEBSITE 1113
00099 #define ID_PROP_RSSFEED 1118
00100 #define ID_PROP_NUMSAMPLES 1122
00101 #define ID_PROP_LOGO_REF 1125
00102 #define ID_PROP_DOWNLOADLINKS 1139
00103 #define ID_PROP_NEW_DOWNLOADLINK 1129
00104 #define ID_PROP_DELETE_DOWNLOADLINK 1130
00105 #define ID_PROP_DOCS 1176
00106 #define ID_PROP_NEW_DOC 1131
00107 #define ID_PROP_DELETE_DOC 1175
00108 #define ID_PROP_SCREENSHOTS 1177
00109 #define ID_PROP_NEW_SCREENSHOT 1178
00110 #define ID_PROP_DELETE_SCREENSHOT 1179
00111 #define ID_PROP_DEPENDENCIES_PAGE 1154
00112 #define ID_PROP_SUPPORTEDPORTS 1119
00113 #define ID_PROP_QUICKSET_SUPPORTED_VERSIONS 1159
00114 #define ID_PROP_TESTEDPORTS 1112
00115 #define ID_PROP_QUICKSET_TESTED_VERSIONS 1160
00116 #define ID_PROP_DEPENDENCIES 1116
00117 #define ID_PROP_NEW_DEP 1141
00118 #define ID_PROP_DELETE_DEP 1167
00119 #define ID_PROP_BUILDSYSTEM_PAGE 1155
00120 #define ID_PROP_BUILDSYS_TYPE 1115
00121 #define ID_PROP_BUILDSYS_FORMATS 1134
00122 #define ID_PROP_BUILDSYS_OPTIONS 1140
00123 #define ID_PROP_NEW_OPTION 1142
00124 #define ID_PROP_DELETE_OPTION 1143
00125 #define ID_PROP_ADD_OPTPRESET 1114
00126 #define ID_PROP_STAGE 1123
00127 #define ID_PROP_TARGETS 1132
00128 #define ID_PROP_BUILDSYS_COMMANDS 1102
00129 #define ID_PROP_NEW_COMMAND 1133
00130 #define ID_PROP_DELETE_COMMAND 1138
00131 #define ID_PROP_RESET_COMMANDS 1144
00132 #define ID_PROP_XMLSOURCE_PAGE 1156
00133 #define SYMBOL_WXPACKAGEPROPERTIESPANEL_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
00134 #define SYMBOL_WXPACKAGEPROPERTIESPANEL_TITLE _("Package Properties Panel")
00135 #define SYMBOL_WXPACKAGEPROPERTIESPANEL_IDNAME wxID_ANY
00136 #define SYMBOL_WXPACKAGEPROPERTIESPANEL_SIZE wxSize(400, 300)
00137 #define SYMBOL_WXPACKAGEPROPERTIESPANEL_POSITION wxDefaultPosition
00139
00140 #define wxPROPPANEL_DOC_WILDCARD \
00141 wxT("HTML docs (*.htm,*.html,*.chm)|*.htm;*.html;*.chm|PDF docs (*.pdf)|*.pdf|Other formats (*.rtf,*.doc,*.txt)|*.rtf;*.doc;*.txt|All files (*)|*")
00142
00143 #define wxPROPPANEL_IMAGE_WILDCARD \
00144 wxT("Common image formats (*.gif,*.jpg,*.jpeg,*.png,*.bmp)|*.gif;*.jpg;*.png;*.bmp|All files (*)|*")
00145
00146 #define wxPROPPANEL_XMLSOURCE_PAGE_INDEX 6
00147
00148
00149 #define ID_PROPPANEL_BITMAP_SIZE wxSize(17, 17)
00150
00151
00152
00153
00154
00155
00156 void wxDeletePackageDependencyFromListctrl(wxListCtrl *lc, int idx);
00157 void wxDeletePackageDataWithRefFromListbox(wxListBox *lc, int idx);
00158 bool IsSelected(wxListCtrl *lc, int i);
00159 int GetSelection(wxListCtrl *lc);
00160
00161
00162
00163
00164
00165
00166 class wxPackagePropertiesPanel: public wxPanel
00167 {
00168 DECLARE_DYNAMIC_CLASS( wxPackagePropertiesPanel )
00169 DECLARE_EVENT_TABLE()
00170
00171 public:
00173 wxPackagePropertiesPanel( );
00174 wxPackagePropertiesPanel( wxWindow* parent,
00175 wxWindowID id = SYMBOL_WXPACKAGEPROPERTIESPANEL_IDNAME,
00176 const wxPoint& pos = SYMBOL_WXPACKAGEPROPERTIESPANEL_POSITION,
00177 const wxSize& size = SYMBOL_WXPACKAGEPROPERTIESPANEL_SIZE,
00178 long style = SYMBOL_WXPACKAGEPROPERTIESPANEL_STYLE );
00179
00181 bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXPACKAGEPROPERTIESPANEL_IDNAME,
00182 const wxPoint& pos = SYMBOL_WXPACKAGEPROPERTIESPANEL_POSITION,
00183 const wxSize& size = SYMBOL_WXPACKAGEPROPERTIESPANEL_SIZE,
00184 long style = SYMBOL_WXPACKAGEPROPERTIESPANEL_STYLE );
00185
00186 ~wxPackagePropertiesPanel();
00187
00188
00190 void CreateControls();
00191
00193 static bool ShowToolTips();
00194
00196 wxBitmap GetBitmapResource( const wxString& name );
00197
00198
00199 public:
00200
00201
00202
00203 void OnButton(wxCommandEvent &ev);
00204 void OnListBoxDClick(wxCommandEvent &ev);
00205
00206
00207
00208 void OnLicensingButton(wxCommandEvent &ev);
00209 void OnLicensingListBoxDClick(wxCommandEvent &ev);
00210 void OnLicenseSelected(wxCommandEvent &ev);
00211 void OnLicensingPageUpdateUI(wxUpdateUIEvent &ev);
00212
00213
00214
00215 void OnBuildSystemButton(wxCommandEvent &ev);
00216 void OnBuildSystemListBoxDClick(wxCommandEvent &ev);
00217 void OnBuildSystemType(wxCommandEvent &ev);
00218 void OnBuildSystemFormatCheck(wxCommandEvent &ev);
00219 void OnBuildSystemStage(wxCommandEvent &ev);
00220 void OnOptionDClick(wxCommandEvent &ev);
00221 void OnCompilerPreset(wxCommandEvent &ev);
00222 void OnWxPreset(wxCommandEvent &ev);
00223 void OnBuildSystemPageUpdateUI(wxUpdateUIEvent &ev);
00224
00225
00226
00227 void OnPackagingButton(wxCommandEvent &ev);
00228 void OnText(wxCommandEvent &ev);
00229 void OnProjectRootChange(wxFileDirPickerEvent &ev);
00230 void OnWXPDirChange(wxFileDirPickerEvent &ev);
00231 void OnIncludedTreeCheck(wxExplorerTreeEvent &ev);
00232 void OnPackagingPageUpdateUI(wxUpdateUIEvent &ev);
00233
00234
00235
00236 void OnDependenciesButton(wxCommandEvent &ev);
00237 void OnDependenciesListBoxDClick(wxCommandEvent &ev);
00238 void OnDepDClick(wxListEvent &ev);
00239 void OnDependenciesPageUpdateUI(wxUpdateUIEvent &ev);
00240
00241
00242
00243 void OnDetailsButton(wxCommandEvent &ev);
00244 void OnDetailsListBoxDClick(wxCommandEvent &ev);
00245 void OnDetailsPageUpdateUI(wxUpdateUIEvent &ev);
00246
00247
00248
00249 void OnPageChanged(wxNotebookEvent &ev);
00250
00251
00252 public:
00253
00254
00255
00256 bool IsModified() const
00257 { return m_bModified; }
00258
00259
00260 void SetModified(bool mod)
00261 { m_bModified=mod; }
00262
00268 bool IsOk() const;
00269
00272 wxPackageInfo GetPackageInfo() const;
00273
00275 wxString GetProjectAbsoluteRoot() const
00276 { return m_strRoot; }
00277
00278 wxULongLong GetUncompressedSize() const
00279 { return m_szUncompressed; }
00280
00291 void SetPackageInfo(const wxPackageXMLDescriptor &descriptor,
00292 const wxString &filename = wxEmptyString);
00293
00296 void SetPackageInfo(const wxPackageInfo &descriptor,
00297 const wxString &filename = wxEmptyString);
00298
00299
00300 virtual bool TransferDataFromWindow();
00301
00302
00303 protected:
00304
00305 bool GetDownloadLink(wxString *ret, const wxString &initial = wxEmptyString);
00306 bool GetAuthorOrMaintainer(bool isauthor, wxString *ret, wxString *rethref,
00307 const wxString &initialname = wxEmptyString,
00308 const wxString &initialhref = wxEmptyString);
00309 bool GetSupportedOrTestedVersionRange(bool issupported,
00310 wxString *ret,
00311 const wxString &portname,
00312 const wxString &initial = wxEmptyString);
00313 bool GetDoc(wxPackageDataWithRef *ret,
00314 const wxPackageDataWithRef &initial = wxEmptyPackageDataWithRef);
00315 bool GetScreenshot(wxPackageDataWithRef *ret,
00316 const wxPackageDataWithRef &initial = wxEmptyPackageDataWithRef);
00317 bool GetDep(wxPackageDependency *ret,
00318 const wxPackageDependency &initial = wxEmptyPackageDependency);
00319 bool GetBuildSysOption(wxPackageCommandOption *ret,
00320 const wxPackageCommandOption &initial =
00321 wxEmptyPackageCommandOption);
00322 bool GetBuildSysCommand(wxPackageCommand *ret,
00323 wxPackageBuildSystemStage stage,
00324 const wxPackageCommand &initial = wxEmptyPackageCommand);
00325
00326
00327 void GetNewExcludedStuff();
00328
00329 void UpdatePortVersions();
00330 void UpdateOptions();
00331 void UpdateCommands();
00332 void UpdateXML();
00333 void UpdateRelativeRoot();
00334 void UpdateUncompressedSize();
00335
00336 bool IsPresetOption(const wxString &optname, wxString *presetname) const;
00337 bool IsUserOption(const wxString &optname) const;
00338
00339 long GetCompilerFormats() const;
00340
00341 wxPackageBuildSystemType GetSelBuildSystemType() const
00342 { return wxIdx2PackageBuildSystemType(m_pBuildSystemType->GetSelection()); }
00343
00344
00345 void OnUserChange();
00346
00347 void GetBasicsPackageInfo(wxPackageInfo &pkg) const;
00348 void GetPackagingPackageInfo(wxPackageInfo &pkg) const;
00349 void GetLicensingPackageInfo(wxPackageInfo &pkg) const;
00350 void GetDetailsPackageInfo(wxPackageInfo &pkg) const;
00351 void GetDependenciesPackageInfo(wxPackageInfo &pkg) const;
00352 void GetBuildSystemPackageInfo(wxPackageInfo &pkg) const;
00353
00354 void DoSetPackageInfo(const wxPackageInfo &descriptor,
00355 const wxString &filename);
00356 void DoSetBasicsPackageInfo(const wxPackageInfo &descriptor);
00357 void DoSetPackagingPackageInfo(const wxPackageInfo &descriptor,
00358 const wxString &filename);
00359 void DoSetLicensingPackageInfo(const wxPackageInfo &descriptor);
00360 void DoSetDetailsPackageInfo(const wxPackageInfo &descriptor);
00361 void DoSetDependenciesPackageInfo(const wxPackageInfo &descriptor);
00362 void DoSetBuildSystemPackageInfo(const wxPackageInfo &descriptor);
00363
00364 bool IsBasicsPageOk() const;
00365 bool IsPackagingPageOk() const;
00366 bool IsLicensingPageOk() const;
00367 bool IsDetailsPageOk() const;
00368 bool IsDependenciesPageOk() const;
00369 bool IsBuildSystemPageOk() const;
00370
00371 void InitBasicsPage();
00372 void InitPackagingPage();
00373 void InitLicensingPage();
00374 void InitDetailsPage();
00375 void InitDependenciesPage();
00376 void InitBuildSystemPage();
00377 void InitXMLSourcePage();
00378
00379
00380 void DisableIfNoSelection(int todisableID, wxControlWithItems *p)
00381 {
00382 FindWindowById(todisableID)->Enable(p->GetSelection() != wxNOT_FOUND);
00383 }
00384
00385
00386
00387 wxString GetProjectParent() const;
00388 void SetIncludePath(const wxString &path);
00389
00390
00391
00392 void SetPortVersion(int id);
00393
00394 protected:
00396 wxStaticText* m_pUncompressedSize;
00397 wxRadioButton* m_pTar;
00398 wxRadioButton* m_pZip;
00399 wxTextCtrl* m_pFileName;
00400 wxTextCtrl* m_pUpload;
00401 wxDirPickerCtrl* m_pProjectDir;
00402 wxDirPickerCtrl* m_pWXPDir;
00403 wxTextCtrl* m_pRelativeRoot;
00404 wxStaticBitmap* m_pRootBitmap;
00405 wxStaticText* m_pRootCheckLabel;
00406 wxExplorerTreeCtrl* m_pIncludedTree;
00407 wxPackageExcludeListBox* m_pExcluded;
00408 wxTextCtrl* m_pName;
00409 wxTextCtrl* m_pVersion;
00410 wxTextCtrl* m_pDescription;
00411 wxTextCtrl* m_pKeywords;
00412 wxChoice* m_pPrimaryCat;
00413 wxChoice* m_pSecondaryCat;
00414 wxComboBox* m_pLicense;
00415 wxChoice* m_pLicenseType;
00416 wxTextCtrl* m_pOrganization;
00417 wxTextCtrl* m_pOrganizationWebsite;
00418 wxTextCtrl* m_pCost;
00419 wxTextCtrl* m_pCopyright;
00420 wxTextCtrl* m_pCredits;
00421 wxListBox* m_pAuthors;
00422 wxListBox* m_pMaintainers;
00423 wxChoice* m_pStatus;
00424 wxDatePickerCtrl* m_pCreationDate;
00425 wxChoice* m_pProgLang;
00426 wxTextCtrl* m_pWebsite;
00427 wxTextCtrl* m_pRSS;
00428 wxSpinCtrl* m_pNumSamples;
00429 wxListBox* m_pDownloadLinks;
00430 wxListBox* m_pDocs;
00431 wxListBox* m_pScreenshots;
00432 wxSplitterWindow* m_pSplitter;
00433 wxPanel* m_pTopPanel;
00434 wxCheckListBox* m_pSupportedPorts;
00435 wxCheckListBox* m_pTestedPorts;
00436 wxPanel* m_pBottomPanel;
00437 wxListCtrl* m_pDepList;
00438 wxChoice* m_pBuildSystemType;
00439 wxCheckListBox* m_pFormats;
00440 wxStaticText* m_pOptionPresets;
00441 wxOptionListCtrl* m_pBuildSysOptions;
00442 wxChoice* m_pBuildSystemStage;
00443 wxTextCtrl* m_pTargets;
00444 wxStaticText* m_pCommandPresets;
00445 wxCommandListBox* m_pBuildSysCommands;
00446 wxPanel* m_pXMLPanel;
00447 wxBoxSizer* m_pXMLSizer;
00449
00450 wxPackageSourceEditCtrl *m_pEditor;
00451
00452 protected:
00453
00454 wxString m_strBuildSystemHref;
00455
00456 protected:
00457
00458
00459 wxPackageXMLDescriptor m_xmlDescriptor;
00460
00461
00462
00463
00464
00465 wxString m_strRoot;
00466
00467
00468 wxPackageDataWithRef m_license, m_logo;
00469
00470
00471
00472 wxPackageCommandArray m_commands[wxPBST_MAX];
00473 wxString m_targets[wxPBST_MAX];
00474
00475 protected:
00476
00477 wxPackageCompilerFormat m_formats[wxPCF_MAX];
00478 wxVersionRange m_supportedVer[wxPORT_MAX];
00479 wxVersionRange m_testedVer[wxPORT_MAX];
00480 int m_nLastStage;
00481
00482
00483 wxULongLong m_szUncompressed;
00484
00485 bool m_bRelativeRootValid;
00486
00487
00488 bool m_bModified;
00489 };
00490
00491
00492
00493
00494
00495
00496 BEGIN_DECLARE_EVENT_TYPES()
00497 DECLARE_EVENT_TYPE(wxEVT_COMMAND_PROPPANEL_USER_CHANGE, 56689)
00498 END_DECLARE_EVENT_TYPES()
00499
00500 #define EVT_PROPPANEL_USER_CHANGE(id, fn) \
00501 wx__DECLARE_EVT1(wxEVT_COMMAND_PROPPANEL_USER_CHANGE, id, wxCommandEventHandler(fn))
00502
00503
00504
00505
00506
00507
00508 #define wxPELB_DEFAULT_STYLE (wxLB_SINGLE|wxLB_SORT)
00509
00510
00511
00512 class wxPackageExcludeListBox: public wxListBox
00513 {
00514 DECLARE_DYNAMIC_CLASS( wxPackageExcludeListBox )
00515
00516 public:
00517 wxPackageExcludeListBox( ) {}
00518 wxPackageExcludeListBox( wxWindow* parent,
00519 wxWindowID id = wxID_ANY,
00520 const wxPoint& pos = wxDefaultPosition,
00521 const wxSize& size = wxDefaultSize,
00522 long style = wxPELB_DEFAULT_STYLE)
00523 {
00524 Create(parent, id, pos, size, style);
00525 }
00526
00527 bool Create( wxWindow* parent, wxWindowID id = wxID_ANY,
00528 const wxPoint& pos = wxDefaultPosition,
00529 const wxSize& size = wxDefaultSize,
00530 long style = wxPELB_DEFAULT_STYLE );
00531
00532 ~wxPackageExcludeListBox() {}
00533
00534 public:
00535
00536 void Add(wxPackageExcludeMode type, const wxString &toadd);
00537
00538 void Add(wxPackageExcludeMode type, const wxArrayString &toadd)
00539 {
00540 for (size_t i=0; i<toadd.GetCount(); i++)
00541 Add(type, toadd[i]);
00542 }
00543
00544 wxArrayString Get(wxPackageExcludeMode type) const;
00545 wxString GetSelection(wxPackageExcludeMode *type) const;
00546
00547 void Delete(wxPackageExcludeMode type, const wxString &str);
00548 void DeleteSelected();
00549
00550 void Clear()
00551 {
00552 wxListBox::Clear();
00553 }
00554
00555 bool IsEmpty() const
00556 {
00557 return wxListBox::GetCount() == 0;
00558 }
00559
00560
00561
00562
00563
00564
00565 void SynchFromTree(const wxExplorerTreeCtrl *tree);
00566 void SynchTree(wxExplorerTreeCtrl *tree) const;
00567
00568 protected:
00569
00570 static wxPackageExcludeMode GetType(const wxString &str);
00571 static wxString GetContent(const wxString &str);
00572
00573 bool DoSynchTree(const wxTreeItemId &item,
00574 wxExplorerTreeCtrl *tree,
00575 const wxString &prefix,
00576 const wxArrayString &files,
00577 const wxArrayString &dirs,
00578 const wxArrayString &patterns) const;
00579 };
00580
00581 #endif
00582