Пример #1
0
bool HTMLButcherFilePathEditDialog::TransferDataFromWindow()
{
    wxTextCtrl *namectrl=(wxTextCtrl*)FindWindow(ID_NAME);
    wxTextCtrl *pathctrl=(wxTextCtrl*)FindWindow(ID_PATH);

    // checks
    if (namectrl->GetValue().IsEmpty())
    {
        butil_errordialog(_("Name cannot be blank"), this);
        return false;
    }

    ccu_Path_wxString p(pathctrl->GetValue());
    if (!p.CheckPath())
    {
        butil_errordialog(_("Invalid path"), this);
        return false;
    }
    if (p.IsFull())
    {
        butil_errordialog(_("Path must be a relative path"), this);
        return false;
    }

    // save
    if (!wxDialog::TransferDataFromWindow()) return false;


    return true;
}
Пример #2
0
void HTMLButcherAssortedFilesDialog::do_remove(unsigned long id)
{
    wxString remmsg=_("Are you sure you want to remove this file?");

    wxMessageDialog d(this, remmsg, _("Remove file"), wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
    if (d.ShowModal() != wxID_YES) return;

    ButcherProjectBaseAutoUpdate upd(GetProject());
    if (!GetProject()->AssortedFiles().Delete(id))
    {
        butil_errordialog(_("This file cannot be deleted"), this);
        return;
    }
    item_remove(id);
}
Пример #3
0
void HTMLButcherCSSFilesDialog::do_remove(unsigned long id)
{
    // get number of views using this mask
    ButcherProjectEventNotify en(GetProject(), ButcherProjectEvent::BPE_CSSFILEDELETED, id, 0, false);
    GetProject()->ExecuteEventNotify(en);

    wxString remmsg=_("Are you sure you want to remove this CSS?");
    if (en.GetRemoveCount()>0||en.GetChangeCount()>0)
        remmsg=wxString::Format(_("Removing this CSS will affect %d item(s). Are you sure?"), en.GetRemoveCount()+en.GetChangeCount());

    wxMessageDialog d(this, remmsg, _("Remove CSS"), wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
    if (d.ShowModal() != wxID_YES) return;

    ButcherProjectBaseAutoUpdate upd(GetProject());
    if (!GetProject()->CSSFiles().Delete(id))
    {
        butil_errordialog(_("This CSS cannot be deleted"), this);
        return;
    }
    item_remove(id);
}
Пример #4
0
void HTMLButcherMasksDialog::do_remove(unsigned long id)
{
    // get number of views using this mask
    ButcherProjectEventNotify en(GetProject(), ButcherProjectEvent::BPE_MASKDELETED, id, 0, false);
    GetProject()->ExecuteEventNotify(en);

    wxString remmsg=_("Are you sure you want to remove this mask?");
    if (en.GetRemoveCount()>0)
        remmsg=wxString::Format(_("Removing this mask will remove %d view(s). Are you sure?"), en.GetRemoveCount());

    wxMessageDialog d(this, remmsg, _("Remove mask"), wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION);
    if (d.ShowModal() != wxID_YES) return;

    ButcherProjectBaseAutoUpdate upd(GetProject());
    if (!GetProject()->Masks().Delete(id))
    {
        butil_errordialog(_("This mask cannot be deleted"), this);
        return;
    }
    item_remove(id);

	EnableAdd(!GetProject()->Masks().IsFull());
}
Пример #5
0
bool HTMLButcherViewEditDialog::TransferDataFromWindow()
{
    // check
    wxTextCtrl *namectrl = (wxTextCtrl*)FindWindow(ID_NAME);
    if (namectrl->GetValue().IsEmpty())
    {
        butil_errordialog(_("Name cannot be blank"), this);
        return false;
    }

    // save
	wxRadioBox *layouttypectrl = (wxRadioBox*) FindWindow(ID_LAYOUTTYPE);
    wxComboBox *filectrl = (wxComboBox*) FindWindow(ID_FILE);
    wxComboBox *filealtctrl = (wxComboBox*) FindWindow(ID_FILEALTERNATE);
    wxComboBox *maskctrl = (wxComboBox*) FindWindow(ID_MASK);
    wxComboBox *imagedirctrl = (wxComboBox*) FindWindow(ID_IMAGEDIR);
    wxComboBox *encodingctrl=(wxComboBox*)FindWindow(ID_ENCODING);

	layouttype_=layouttypeimap_.GetId(layouttypectrl->GetSelection(), ButcherProjectConsts::LTYPE_DEFAULT);

    if (filectrl->GetSelection() == wxNOT_FOUND) {
        butil_errordialog(_("File is required"), this);
        return false;
    }
    if (maskctrl->GetSelection() == wxNOT_FOUND) {
        butil_errordialog(_("Mask is required"), this);
        return false;
    }


    fileid_=static_cast<ButcherListIdClientData*>(filectrl->GetClientObject(filectrl->GetSelection()))->GetId();
    for (int alti=0; alti<BUTCHERCONST_VIEW_MAXALTERNATE; alti++)
    {
        filealtctrl = (wxComboBox*) FindWindow(ID_FILEALTERNATE+alti);

        if (filealtctrl->GetSelection() == wxNOT_FOUND)
            filealternateid_[alti]=0;
        else
            filealternateid_[alti]=static_cast<ButcherListIdClientData*>(filealtctrl->GetClientObject(filealtctrl->GetSelection()))->GetId();
    }

    maskid_=static_cast<ButcherListId2ClientData*>(maskctrl->GetClientObject(maskctrl->GetSelection()))->GetId();
    maskconfigid_=static_cast<ButcherListId2ClientData*>(maskctrl->GetClientObject(maskctrl->GetSelection()))->GetId2();
    if (imagedirctrl->GetSelection()!=wxNOT_FOUND)
        imagefilepathid_=static_cast<ButcherListIdClientData*>(imagedirctrl->GetClientObject(imagedirctrl->GetSelection()))->GetId();
    else
        imagefilepathid_=0;

    encoding_=encodingimap_.GetId(encodingctrl->GetSelection(), ButcherHTMLConsts::BE_ISO8859_1);

    if (ButcherOptions::GetEditMode(GetProject()->GetOptions())>=ButcherOptions::EM_NORMAL)
    {
        wxCheckBox *itemhtmlctrl = (wxCheckBox*) FindWindow(ID_ITEM_HTML);
        wxCheckBox *itemimagesctrl = (wxCheckBox*) FindWindow(ID_ITEM_IMAGES);
        wxCheckBox *itemimagesglobalctrl = (wxCheckBox*) FindWindow(ID_ITEM_IMAGESGLOBAL);
        wxCheckListBox *groupsctrl=(wxCheckListBox*)FindWindow(ID_ASSORTEDFILEGROUPS);

        wxComboBox *cssfilectrl = (wxComboBox*) FindWindow(ID_CSSFILE);

        ButcherControl_FileLink *bgimagectrl=(ButcherControl_FileLink*)FindWindow(ID_BGIMAGE);
        wxComboBox *bgrepeatctrl=(wxComboBox*)FindWindow(ID_BGREPEAT);
        wxCheckBox *isbgcolorctrl=(wxCheckBox*)FindWindow(ID_ISBGCOLOR);
        wxCheckBox *isstretchctrl=(wxCheckBox*)FindWindow(ID_ISSTRETCH);
		wxCheckBox *styleseparatedctrl=(wxCheckBox*)FindWindow(ID_STYLESEPARATED);
        wxColourPickerCtrl *bgcolorctrl=(wxColourPickerCtrl*)FindWindow(ID_BGCOLOR);

        cssfileid_=wxccu_control_getselectedid(cssfilectrl, 0);

        items_=0;
        if (itemhtmlctrl->GetValue()) items_|=ButcherProjectView::ITEM_HTML;
        if (itemimagesctrl->GetValue()) items_|=ButcherProjectView::ITEM_IMAGES;
        if (itemimagesglobalctrl->GetValue()) items_|=ButcherProjectView::ITEM_IMAGESGLOBAL;
        if (items_==0)
        {
            wxMessageBox(_("At least one item must be selected."), _("Error"), wxOK|wxICON_EXCLAMATION);
            return false;
        }

        assortedfilegroups_.Clear();
        int ct=0;
		for (ButcherProjectAssortedFileGroups::iterator i=GetProject()->AssortedFileGroups().begin(); 
			i!=GetProject()->AssortedFileGroups().end(); i++)
		{
            if (groupsctrl->IsChecked(ct))
                assortedfilegroups_.Add(i.first());
            ct++;
		}

        bgimage_.SetBURL(bgimagectrl->GetFileLink()->GetBURL());
        bgrepeat_=bgrepeatimap_.GetId(bgrepeatctrl->GetSelection(), ButcherProjectAreaConfig::BR_NONE);
        isbgcolor_=isbgcolorctrl->GetValue();
        isstretch_=isstretchctrl->GetValue();
		styleseparated_=styleseparatedctrl->GetValue();
        bgcolor_=bgcolorctrl->GetColour();

    }

    return wxDialog::TransferDataFromWindow();
}