Ejemplo n.º 1
0
void CFileDetailDialog::OnBnClickedTakeOver(wxCommandEvent& WXUNUSED(evt))
{
	CFileDetailListCtrl* pmyListCtrl;
	pmyListCtrl = CastChild( IDC_LISTCTRLFILENAMES, CFileDetailListCtrl );
	if (pmyListCtrl->GetSelectedItemCount() > 0) {
		// get first selected item (there is only one)
		long pos = pmyListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
		if (pos != -1) {	// shouldn't happen, we checked if something is selected
			setValueForFilenameTextEdit(pmyListCtrl->GetItemText(pos));
		}
	}
}
Ejemplo n.º 2
0
void CFileDetailDialog::OnListClickedTakeOver(wxListEvent& WXUNUSED(evt))
{
	CFileDetailListCtrl* pmyListCtrl;
	pmyListCtrl = CastChild( IDC_LISTCTRLFILENAMES, CFileDetailListCtrl );
	if (pmyListCtrl->GetSelectedItemCount() > 0) {
		long pos=-1;
		for(;;) {
			pos=pmyListCtrl->GetNextItem(pos,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED);
			if(pos==-1) {
				break;
			}
			setValueForFilenameTextEdit(pmyListCtrl->GetItemText(pos));
		}
	}
}
Ejemplo n.º 3
0
void CFileDetailDialog::OnBnClickedButtonStrip(wxCommandEvent& WXUNUSED(evt))
{
	wxString filename;
	filename = CastChild(IDC_FILENAME, wxTextCtrl)->GetValue();
	
	int extpos = filename.Find('.', true);
	wxString ext;
	if (extpos > 0) {
		// get the extension - we do not modify it except make it lowercase
		ext = filename.Mid(extpos);
		ext.MakeLower();
		// get rid of extension and replace . with space
		filename.Truncate(extpos);
		filename.Replace(wxT("."),wxT(" "));
	}

	// Replace Space-holders with Spaces
	filename.Replace(wxT("_"),wxT(" "));
	filename.Replace(wxT("%20"),wxT(" "));

	// Some additional formatting
	filename.Replace(wxT("hYPNOTiC"), wxEmptyString);
	filename.MakeLower();
	filename.Replace(wxT("xxx"), wxT("XXX"));
//	filename.Replace(wxT("xdmnx"), wxEmptyString);
//	filename.Replace(wxT("pmp"), wxEmptyString);
//	filename.Replace(wxT("dws"), wxEmptyString);
	filename.Replace(wxT("www pornreactor com"), wxEmptyString);
	filename.Replace(wxT("sharereactor"), wxEmptyString);
	filename.Replace(wxT("found via www filedonkey com"), wxEmptyString);
	filename.Replace(wxT("deviance"), wxEmptyString);
	filename.Replace(wxT("adunanza"), wxEmptyString);
	filename.Replace(wxT("-ftv"), wxEmptyString);
	filename.Replace(wxT("flt"), wxEmptyString);
	filename.Replace(wxT("[]"), wxEmptyString);
	filename.Replace(wxT("()"), wxEmptyString);

	// Change CD, CD#, VCD{,#}, DVD{,#}, ISO, PC to uppercase
	ReplaceWord(filename, wxT("cd"), wxT("CD"), true);
	ReplaceWord(filename, wxT("vcd"), wxT("VCD"), true);
	ReplaceWord(filename, wxT("dvd"), wxT("DVD"), true);
	ReplaceWord(filename, wxT("iso"), wxT("ISO"), false);
	ReplaceWord(filename, wxT("pc"), wxT("PC"), false);

	// Make leading Caps
	// and delete 1+ spaces
	if (filename.Length()>1)
	{
		bool last_char_space = true;
		bool last_char_wordseparator = true;
		unsigned int i = 0;

		do {
			wxChar c = filename.GetChar(i);
			if (c == ' ') {
				if (last_char_space) {
					filename.Remove(i, 1);
					i--;
				} else {
					last_char_space = true;
				}
			} else if (c == '.') {
				if (last_char_space && i > 0) {
					i--;
					filename.Remove(i, 1);
				}
				last_char_space = false;
			} else {
				if (last_char_wordseparator) {
					wxString tempStr(c);
					tempStr.MakeUpper();
					filename.SetChar(i, tempStr.GetChar(0));
					last_char_space = false;
				}
			}
			last_char_wordseparator = IsWordSeparator(c);
			i++;
		} while (i < filename.Length());

		if (last_char_space && i > 0) {
			filename.Remove(i-1, 1);
		}
	}

	// should stay lowercase
	ReplaceWord(filename, wxT("By"), wxT("by"));

	// re-add extension
	filename += ext;

	setValueForFilenameTextEdit(filename);
}