Always include the boost-package. Otherwise it won't get searched on a second run.
[amule.git] / src / CommentDialog.cpp
blob7b51cbc0a097237cc59d4dbf3e8e323559dbfae0
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2011 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6 //
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
9 // respective authors.
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "CommentDialog.h" // Interface declarations
28 #include "GuiEvents.h"
29 #include "KnownFile.h" // Needed for CKnownFile
30 #include "muuli_wdr.h" // Needed for commentDlg
31 // CommentDialog dialog
33 //IMPLEMENT_DYNAMIC(CCommentDialog, CDialog)
34 CCommentDialog::CCommentDialog(wxWindow* parent,CKnownFile* file)
35 : wxDialog(parent,-1,_("File Comments"),
36 wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxSYSTEM_MENU)
38 m_file = file;
39 wxSizer* content=commentDlg(this,TRUE);
40 content->SetSizeHints(this);
41 content->Show(this,TRUE);
42 Center();
43 ratebox = CastChild( IDC_RATELIST, wxChoice );
44 OnInitDialog();
47 CCommentDialog::~CCommentDialog()
51 BEGIN_EVENT_TABLE(CCommentDialog,wxDialog)
52 EVT_TEXT_ENTER(IDC_CMT_TEXT, CCommentDialog::OnBnClickedApply)
53 EVT_BUTTON(IDCOK, CCommentDialog::OnBnClickedApply)
54 EVT_BUTTON(IDC_FC_CLEAR, CCommentDialog::OnBnClickedClear)
55 EVT_BUTTON(IDCCANCEL, CCommentDialog::OnBnClickedCancel)
56 END_EVENT_TABLE()
58 void CCommentDialog::OnBnClickedApply(wxCommandEvent& WXUNUSED(evt))
60 wxString comment = CastChild( IDC_CMT_TEXT, wxTextCtrl )->GetValue();
61 CoreNotify_KnownFile_Comment_Set(m_file, comment, (int8)ratebox->GetSelection());
62 EndModal(0);
65 void CCommentDialog::OnBnClickedClear(wxCommandEvent& WXUNUSED(evt))
67 CastChild(IDC_CMT_TEXT, wxTextCtrl)->SetValue(wxEmptyString);
70 void CCommentDialog::OnBnClickedCancel(wxCommandEvent& WXUNUSED(evt))
72 EndModal(0);
75 bool CCommentDialog::OnInitDialog()
77 CastChild(IDC_CMT_TEXT, wxTextCtrl)->SetValue(m_file->GetFileComment());
78 CastChild(IDC_CMT_TEXT, wxTextCtrl)->SetMaxLength(MAXFILECOMMENTLEN);
79 ratebox->SetSelection(m_file->GetFileRating());
80 return TRUE;
82 // File_checked_for_headers