void HTMLButcherViewEditDialog::CreateControls()
{
    wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);


    // NOTEBOOK
    wxNotebook *notebook = new wxNotebook(this, wxID_ANY);
    topsizer->Add(notebook, 1, wxEXPAND|wxALL, 3);

    wxPanel *nbMain = new wxPanel(notebook, wxID_ANY);
    wxPanel *nbHTML = NULL;
    wxPanel *nbAlternate = new wxPanel(notebook, wxID_ANY);

    notebook->AddPage(nbMain, _("View"), true);
    if (ButcherOptions::GetEditMode(GetProject()->GetOptions())>=ButcherOptions::EM_NORMAL)
    {
        nbHTML = new wxPanel(notebook, wxID_ANY);
        notebook->AddPage(nbHTML, _("HTML"), false);
    }
    notebook->AddPage(nbAlternate, _("Alternate"), false);

    /***
    ** Main
    ***/

    wxBoxSizer *boxsizer = new wxBoxSizer(wxVERTICAL);
    nbMain->SetSizer(boxsizer);

    // Name
    wxStaticText *namelabel = new wxStaticText(nbMain, wxID_STATIC, _("&Name:"), wxDefaultPosition, wxDefaultSize, 0);
    boxsizer->Add(namelabel, 0, wxALIGN_LEFT|wxALL, 3);

    wxTextCtrl *namectrl = new wxTextCtrl(nbMain, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
    boxsizer->Add(namectrl, 0, wxGROW|wxALL, 3);

    // Layout type
	wxRadioBox *layouttypectrl = new wxRadioBox(nbMain, ID_LAYOUTTYPE, _("&Layout type"), wxDefaultPosition, wxSize(300, -1),
        layouttypeimap_.Load(), 0);
	boxsizer->Add(layouttypectrl, 0, wxGROW|wxALL, 3);

    // File
    wxStaticText *filelabel = new wxStaticText(nbMain, wxID_STATIC, _("&File:"), wxDefaultPosition, wxDefaultSize, 0);
    boxsizer->Add(filelabel, 0, wxALIGN_LEFT|wxALL, 3);

    wxComboBox *filectrl = new wxComboBox(nbMain, ID_FILE, wxEmptyString, wxDefaultPosition, wxSize(300, -1),
        wxArrayString(), wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT);
    boxsizer->Add(filectrl, 0, wxGROW|wxALL, 3);

    // Mask
    wxStaticText *masklabel = new wxStaticText(nbMain, wxID_STATIC, _("&Mask:"), wxDefaultPosition, wxDefaultSize, 0);
    boxsizer->Add(masklabel, 0, wxALIGN_LEFT|wxALL, 3);

    wxComboBox *maskctrl = new wxComboBox(nbMain, ID_MASK, wxEmptyString, wxDefaultPosition, wxSize(300, -1),
        wxArrayString(), wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT);
    boxsizer->Add(maskctrl, 0, wxGROW|wxALL, 3);

    // Image dir
    boxsizer->Add(new wxStaticText(nbMain, wxID_STATIC, _("&Image path:"), wxDefaultPosition, wxDefaultSize, 0),
        0, wxALIGN_LEFT|wxALL, 3);

    wxComboBox *imagedirctrl = new wxComboBox(nbMain, ID_IMAGEDIR, wxEmptyString, wxDefaultPosition, wxSize(300, -1),
        wxArrayString(), wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT);
    boxsizer->Add(imagedirctrl, 0, wxGROW|wxALL, 3);


	// FILENAME-ENCODING sizer
	wxFlexGridSizer *boxsizer2 = new wxFlexGridSizer(2, 0, 0);
	boxsizer2->SetFlexibleDirection(wxVERTICAL);
	boxsizer2->AddGrowableCol(0, 0);
	boxsizer2->AddGrowableCol(1, 0);
	boxsizer->Add(boxsizer2, 0, wxGROW|wxALL, 0);
	
	// Filename
    boxsizer2->Add(
        new wxStaticText(nbMain, wxID_STATIC, _("&Filename:"), wxDefaultPosition, wxDefaultSize, 0),
        0, wxALL|wxGROW, 3);

    // encoding
    boxsizer2->Add(new wxStaticText(nbMain, wxID_STATIC, _("&Encoding:"), wxDefaultPosition, wxDefaultSize, 0),
        0, wxALL|wxGROW, 3);

	// Filename
    wxTextCtrl *filenamectrl = new wxTextCtrl(nbMain, ID_FILENAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
    boxsizer2->Add(filenamectrl, 0, wxGROW|wxALL, 3);

    // encoding
    wxComboBox *encodingctrl=new wxComboBox(nbMain, ID_ENCODING, wxEmptyString, wxDefaultPosition, wxDefaultSize,
        wxArrayString(), wxCB_READONLY);
    encodingimap_.Load(encodingctrl);

    boxsizer2->Add(encodingctrl, 0, wxGROW|wxALL, 3);


    if (ButcherOptions::GetEditMode(GetProject()->GetOptions())>=ButcherOptions::EM_NORMAL)
    {
        // ITEMSGROUPSSIZER
        wxBoxSizer *itemsgroupssizer = new wxBoxSizer(wxHORIZONTAL);
        boxsizer->Add(itemsgroupssizer, 1, wxGROW|wxALL, 3);

        // ITEMS SIZER
        wxStaticBoxSizer *itemssizer = new wxStaticBoxSizer(wxVERTICAL, nbMain, _("Items"));

        // Check: HTML
        wxCheckBox *itemhtmlctrl = new wxCheckBox(nbMain, ID_ITEM_HTML, _("HTML"), wxDefaultPosition, wxDefaultSize, 0);
        itemssizer->Add(itemhtmlctrl, 1, wxGROW|wxALL);

        // Check: IMAGES
        wxCheckBox *itemimagesctrl = new wxCheckBox(nbMain, ID_ITEM_IMAGES, _("Images"), wxDefaultPosition, wxDefaultSize, 0);
        itemssizer->Add(itemimagesctrl, 1, wxGROW|wxALL);

        // Check: IMAGESGLOBAL
        wxCheckBox *itemimagesglobalctrl = new wxCheckBox(nbMain, ID_ITEM_IMAGESGLOBAL, _("Images Global"), wxDefaultPosition, wxDefaultSize, 0);
        itemssizer->Add(itemimagesglobalctrl, 1, wxGROW|wxALL);

        // ITEMSSIZER: ADD
        itemsgroupssizer->Add(itemssizer, 0, wxGROW|wxALL, 3);

        // GROUPSSIZER
        wxBoxSizer *groupssizer = new wxBoxSizer(wxVERTICAL);
        itemsgroupssizer->Add(groupssizer, 1, wxGROW|wxALL, 3);

        // Groups
        groupssizer->Add(new wxStaticText(nbMain, wxID_STATIC, _("&Assorted file groups:"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALL, 3);

        wxCheckListBox *groupsctrl = new wxCheckListBox(nbMain, ID_ASSORTEDFILEGROUPS, wxDefaultPosition, wxDefaultSize);
        groupssizer->Add(groupsctrl, 1, wxGROW|wxALL, 3);
    }

    if (ButcherOptions::GetEditMode(GetProject()->GetOptions())>=ButcherOptions::EM_NORMAL)
    {
        /***
        ** HTML
        ***/

        //wxBoxSizer *htmlboxsizer = new wxBoxSizer(wxVERTICAL);
        wxFlexGridSizer *htmlboxsizer = new wxFlexGridSizer(2);
        nbHTML->SetSizer(htmlboxsizer);

        // FIELDS SIZER
        //wxBoxSizer *fieldssizer = new wxBoxSizer(wxHORIZONTAL);
        //htmlboxsizer->Add(fieldssizer, 0, wxGROW|wxALL, 3);


        // FIELDS 1 SIZER
        wxBoxSizer *fields1sizer = new wxBoxSizer(wxVERTICAL);
        htmlboxsizer->Add(fields1sizer, 0, wxGROW|wxALL, 3);


        // CSS file
        fields1sizer->Add(new wxStaticText(nbHTML, wxID_STATIC, _("C&SS file:"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        wxComboBox *cssfilectrl = new wxComboBox(nbHTML, ID_CSSFILE, wxEmptyString, wxDefaultPosition, wxDefaultSize,
            wxArrayString(), wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT);
        fields1sizer->Add(cssfilectrl, 0, wxGROW|wxALL, 3);

        // bgimage
        fields1sizer->Add(
            new wxStaticText(nbHTML, wxID_STATIC, _("Back&ground Image:"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);
        ButcherControl_FileLink *imagelinkctrl = new ButcherControl_FileLink(nbHTML, ID_BGIMAGE, NULL,
            wxDefaultPosition, wxDefaultSize);
        imagelinkctrl->SetProject(GetProject());
        fields1sizer->Add(imagelinkctrl, 0, wxGROW|wxALL, 3);

        // bgrepeat
        fields1sizer->Add(
            new wxStaticText(nbHTML, wxID_STATIC, _("Background &Repeat:"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        wxComboBox *bgrepeatctrl=new wxComboBox(nbHTML, ID_BGREPEAT, wxEmptyString, wxDefaultPosition, wxDefaultSize,
            wxArrayString(), wxCB_READONLY);
        bgrepeatimap_.Load(bgrepeatctrl);

        fields1sizer->Add(bgrepeatctrl, 0, wxGROW|wxALL, 3);


        // isbgcolor
        wxCheckBox *isbgcolorctrl = new wxCheckBox(nbHTML, ID_ISBGCOLOR, _("Background Co&lor:"), wxDefaultPosition, wxDefaultSize);
        fields1sizer->Add(isbgcolorctrl, 0, wxGROW|wxALL, 3);

        // bgcolor
        wxColourPickerCtrl *bgcolorctrl = new wxColourPickerCtrl(nbHTML, ID_BGCOLOR, *wxBLACK, wxDefaultPosition, wxDefaultSize,
            wxCLRP_SHOW_LABEL|wxCLRP_USE_TEXTCTRL);
        fields1sizer->Add(bgcolorctrl , 0, wxGROW|wxALL, 3);

        // is stretch
        wxCheckBox *isstretchctrl = new wxCheckBox(nbHTML, ID_ISSTRETCH, _("Stretchable La&yout"), wxDefaultPosition, wxDefaultSize);
        fields1sizer->Add(isstretchctrl, 0, wxGROW|wxALL, 3);


        // FIELDS 2 SIZER
        wxBoxSizer *fields2sizer = new wxBoxSizer(wxVERTICAL);
        htmlboxsizer->Add(fields2sizer, 1, wxGROW|wxALL, 3);

        // Title
        fields2sizer->Add(
            new wxStaticText(nbHTML, wxID_STATIC, _("&Title:"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        wxTextCtrl *titlectrl = new wxTextCtrl(nbHTML, ID_TITLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
        fields2sizer->Add(titlectrl, 0, wxGROW|wxALL, 3);



        // Head
        fields2sizer->Add(
            new wxStaticText(nbHTML, wxID_STATIC, _("&Head (HTML inside <HEAD>):"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        ButcherControl_FmtTextCtrl *headctrl = new ButcherControl_FmtTextCtrl(nbHTML, ID_HEAD, wxDefaultPosition, wxSize(200, 110));
        headctrl->SetEditFormat(ButcherControl_FmtTextCtrl::FMT_HTML);
        headctrl->SetAllowFileLink(GetProject(), true);
        fields2sizer->Add(headctrl, 1, wxGROW|wxALL, 3);

        // style separated
        wxCheckBox *styleseparatedctrl = new wxCheckBox(nbHTML, ID_STYLESEPARATED, _("AP tableless styles on top of pa&ge"), wxDefaultPosition, wxDefaultSize);
        fields2sizer->Add(styleseparatedctrl, 0, wxGROW|wxALL, 3);

        // FIELDS 3 SIZER

        // FIELDS 3 SIZER 1
        wxBoxSizer *fields3sizer1 = new wxBoxSizer(wxVERTICAL);
        htmlboxsizer->Add(fields3sizer1, 1, wxGROW|wxALL, 3);

        // FIELDS 3 SIZER 2
        wxBoxSizer *fields3sizer2 = new wxBoxSizer(wxVERTICAL);
        htmlboxsizer->Add(fields3sizer2, 1, wxGROW|wxALL, 3);


        // Body Tag Add
        fields3sizer1->Add(
            new wxStaticText(nbHTML, wxID_STATIC, _("&Body Tag Add: (<BODY> attributes)"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        wxTextCtrl *bodytagaddctrl = new wxTextCtrl(nbHTML, ID_BODYTAGADD, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
        fields3sizer1->Add(bodytagaddctrl, 0, wxGROW|wxALL, 3);

        // Body Prepend
        fields3sizer1->Add(
            new wxStaticText(nbHTML, wxID_STATIC, _("Body &Prepend:"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        ButcherControl_FmtTextCtrl *bodyprependctrl = new ButcherControl_FmtTextCtrl(nbHTML, ID_BODYPREPEND, wxDefaultPosition, wxSize(200, 110));
        bodyprependctrl->SetEditFormat(ButcherControl_FmtTextCtrl::FMT_HTML);
        fields3sizer1->Add(bodyprependctrl , 1, wxGROW|wxALL, 3);


        // Table Tag Add
        fields3sizer2->Add(
            new wxStaticText(nbHTML, wxID_STATIC, _("&Table Tag Add: (<TABLE> attributes)"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        wxTextCtrl *tabletagaddctrl = new wxTextCtrl(nbHTML, ID_TABLETAGADD, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
        fields3sizer2->Add(tabletagaddctrl, 0, wxGROW|wxALL, 3);

        // Body Append
        fields3sizer2->Add(
            new wxStaticText(nbHTML, wxID_STATIC, _("Body &Append:"), wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        ButcherControl_FmtTextCtrl *bodyappendctrl = new ButcherControl_FmtTextCtrl(nbHTML, ID_BODYAPPEND, wxDefaultPosition, wxSize(200, 110));
        bodyappendctrl->SetEditFormat(ButcherControl_FmtTextCtrl::FMT_HTML);
        fields3sizer2->Add(bodyappendctrl, 1, wxGROW|wxALL, 3);
    }


    /***
    ** ALTERNATE
    ***/

    wxBoxSizer *alternateboxsizer = new wxBoxSizer(wxVERTICAL);
    nbAlternate->SetSizer(alternateboxsizer);

    // File Alternate
    for (int i=0; i<BUTCHERCONST_VIEW_MAXALTERNATE; i++)
    {
        alternateboxsizer->Add(new wxStaticText(nbAlternate, wxID_STATIC,
            wxString::Format(_("Alternate File &%d:"), i+1),
                wxDefaultPosition, wxDefaultSize, 0),
            0, wxALIGN_LEFT|wxALL, 3);

        wxComboBox *filealtctrl = new wxComboBox(nbAlternate, ID_FILEALTERNATE+i, wxEmptyString, wxDefaultPosition, wxSize(300, -1),
            wxArrayString(), wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT);
        alternateboxsizer->Add(filealtctrl, 0, wxGROW|wxALL, 3);
    }


    // BOXSIZER: ADD
    //topsizer->Add(boxsizer, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 3);


    // divider line
    wxStaticLine *line = new wxStaticLine(this, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
    topsizer->Add(line, 0, wxEXPAND|wxALL, 3);

    wxBoxSizer *buttonsizer = new wxBoxSizer(wxHORIZONTAL);

    // css button
    if (ButcherOptions::GetEditMode(GetProject()->GetOptions())>=ButcherOptions::EM_NORMAL)
    {
        wxButton* cssbutton = new wxButton ( this, ID_BTN_CSS, _("CSS"), wxDefaultPosition, wxDefaultSize, 0 );
        buttonsizer->Add(cssbutton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3);
    }

    // ok button
    wxButton* ok = new wxButton ( this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
    buttonsizer->Add(ok, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3);

    // cancel button
    wxButton* cancel = new wxButton ( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    buttonsizer->Add(cancel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3);

#ifdef BUTCHER_USE_HELP
	// help button
    wxButton* help = new wxButton ( this, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
    buttonsizer->Add(help, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3);
#endif

    // BUTTONSIZER: ADD
    topsizer->Add(buttonsizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 3);

    // validators

    FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_NONE, &viewname_));
    //FindWindow(ID_WIDTH)->SetValidator(wxGenericValidator((int*)&maskwidth_));
    //FindWindow(ID_HEIGHT)->SetValidator(wxGenericValidator((int*)&maskheight_));

    FindWindow(ID_FILENAME)->SetValidator(wxTextValidator(wxFILTER_NONE, &filename_));

    if (ButcherOptions::GetEditMode(GetProject()->GetOptions())>=ButcherOptions::EM_NORMAL)
    {
        FindWindow(ID_TITLE)->SetValidator(wxTextValidator(wxFILTER_NONE, &title_));
        FindWindow(ID_BODYTAGADD)->SetValidator(wxTextValidator(wxFILTER_NONE, &bodytagadd_));
        FindWindow(ID_TABLETAGADD)->SetValidator(wxTextValidator(wxFILTER_NONE, &tabletagadd_));
        FindWindow(ID_HEAD)->SetValidator(ButcherControl_GenericValidator(&head_));
        FindWindow(ID_BODYPREPEND)->SetValidator(ButcherControl_GenericValidator(&bodyprepend_));
        FindWindow(ID_BODYAPPEND)->SetValidator(ButcherControl_GenericValidator(&bodyappend_));
    }

    SetSizer(topsizer);
    topsizer->SetSizeHints(this);

    CentreOnScreen();
}
BLID_t ButcherProjectCSSFiles::Add(ButcherMetadataData *metadata)
{
    ButcherProjectCSSFile *mdadd=new ButcherProjectCSSFile(GetProject());
    mdadd->LoadMetadata(metadata);
    return op_add(mdadd, mdadd->GetBLId());
}
Exemple #3
0
void CAddinProcess::Test(void)
{
    //HRESULT hr = this->OpenSolution("D:\\OpenCode\\TestSet\\AddinEdit\\AddinEdit.sln");

    CComPtr<Project> pProject;

    for (int j = 1; SUCCEEDED(GetProject(j, &pProject)); j++, pProject = NULL)
    {
        CComPtr<ProjectItem> pProjectItem;
        for (int i = 1; SUCCEEDED(this->GetProjectItem(pProject, i, &pProjectItem)); i++, pProjectItem = NULL)
        {
            std::string strName = this->GetProjectItemName(pProjectItem);

            AtlTrace("---------------------------------------------\n");
            AtlTrace("ProjectItem:%d %s\n", i, strName.c_str());

            CComPtr<Property> pProperty;
            for (int j = 1; SUCCEEDED(this->GetProjectItemProperty(pProjectItem, j, &pProperty)); j++, pProperty = NULL)
            {
                std::string strName = this->GetPropertyName(pProperty);
                std::string strValue = this->GetPropertyValue(pProperty);

                if (_T("") != strValue)
                {
                    AtlTrace("ProjectItem_Property:%d %s=%s\n", j, strName.c_str(), strValue.c_str());
                }
                else
                {
                    AtlTrace("ProjectItem_Property:%d %s\n", j, strName.c_str());
                }
            }

            //CComPtr<ProjectItems> pProjectItems;
            //pProjectItem->get_ProjectItems(&pProjectItems);

            //CComPtr<ProjectItem> pItem;
            //hr = pProjectItems->AddFromFile(CComBSTR("test.txt"), &pItem);

            CComPtr<ProjectItem> pSubProjectItem;
            for (int j = 1; SUCCEEDED(this->GetSubProjectItem(pProjectItem, j, &pSubProjectItem)); j++, pSubProjectItem = NULL)
            {
                std::string strName = this->GetProjectItemName(pSubProjectItem);
                AtlTrace("SubProjectItem:%d %s\n", j, strName.c_str());

                CComPtr<Property> pProperty;
                for (int j = 1; SUCCEEDED(this->GetProjectItemProperty(pSubProjectItem, j, &pProperty)); j++, pProperty = NULL)
                {
                    std::string strName = this->GetPropertyName(pProperty);
                    std::string strValue = this->GetPropertyValue(pProperty);

                    if (_T("") != strValue)
                    {
                        AtlTrace("SubProjectItem_Property:%d %s=%s\n", j, strName.c_str(), strValue.c_str());
                    }
                    else
                    {
                        AtlTrace("SubProjectItem_Property:%d %s\n", j, strName.c_str());
                    }
                }
            }
        }

        AtlTrace("---------------------------------------------\n");
        CComPtr<Property> pProperty;
        for (int i = 1; SUCCEEDED(this->GetProjectProperty(pProject, i, &pProperty)); i++, pProperty = NULL)
        {
            std::string strName = this->GetPropertyName(pProperty);
            std::string strValue = this->GetPropertyValue(pProperty);

            if (_T("") != strValue)
            {
                AtlTrace("Project_Property:%d %s=%s\n", i, strName.c_str(), strValue.c_str());
            }
            else
            {
                AtlTrace("Project_Property:%d %s\n", i, strName.c_str());
            }
        }
    }
}
BLID_t ButcherProjectCSSFiles::Add(const wxString &name)
{
    return op_add(new ButcherProjectCSSFile(GetProject(), name));
}
Exemple #5
0
PHPProject::Ptr_t PHPWorkspace::GetActiveProject() const { return GetProject(GetActiveProjectName()); }
Exemple #6
0
ProjectPtr clCxxWorkspace::GetActiveProject() const { return GetProject(GetActiveProjectName()); }
cbConfigurationPanel* lib_finder::GetProjectConfigurationPanel(wxWindow* parent, cbProject* project)
{
    return new ProjectConfigurationPanel(parent,GetProject(project),project,m_KnownLibraries);
}
void lib_finder::OnProjectHook(cbProject* project,TiXmlElement* elem,bool loading)
{
    ProjectConfiguration* Proj = GetProject(project);
    if ( loading ) Proj->XmlLoad(elem,project);
    else           Proj->XmlWrite(elem,project);
}