Example #1
0
ToDoCommentType AddTodoDlg::GetCommentType() const
{
    return (ToDoCommentType)(XRCCTRL(*this, "chcStyle", wxChoice)->GetSelection());
}
Example #2
0
void PreferencesDialog::OnUpdateUIFontText(wxUpdateUIEvent& event)
{
    event.Enable(XRCCTRL(*this, "use_font_text", wxCheckBox)->GetValue());
}
Example #3
0
void PreferencesDialog::OnEditParser(wxCommandEvent&)
{
    EditParser(XRCCTRL(*this, "parsers_list", wxListBox)->GetSelection());
}
Example #4
0
void RheiaPackageManagementDialog::DoBuildPackagesPage()
{
    wxPanel* pnl = XRCCTRL(*this,"pnlPackagesList",wxPanel);
    wxSizer* sizer = pnl->GetSizer();

    m_treelist = new wxTreeListCtrl(pnl,lstPackages,wxDefaultPosition,wxSize(400,400),wxTR_HAS_BUTTONS|wxTR_SINGLE|wxTR_HIDE_ROOT|wxTR_NO_LINES|wxBORDER_THEME);

    m_treelist->AddColumn( wxT("Packages"),200,wxALIGN_LEFT);
    m_treelist->AddColumn( wxT("Version"),200,wxALIGN_LEFT);
    m_treelist->AddColumn( wxT("Description"),400,wxALIGN_LEFT);

    m_root = m_treelist->AddRoot (_T("Root"));

    wxArrayString pkgNames = RheiaPackageDBManager::Get()->GetPackageList();

    for( unsigned int i = 0; i < pkgNames.GetCount() ; ++i )
    {
        RheiaPackageInfo* info = RheiaPackageDBManager::Get()->FindPackageByName(pkgNames[i]);
        RheiaPackageTreeItemData* data = new RheiaPackageTreeItemData( info );

        wxTreeItemId parent = m_treelist->AppendItem(m_root, info->GetControl()->GetTitle(),-1,-1,data);
        m_packageIds[info->GetControl()->GetName()] = parent;

        m_treelist->SetItemText(parent,1,wxString::Format(wxT("%d.%d.%d"),info->GetControl()->GetVersion()->GetMajor(),
                                                        info->GetControl()->GetVersion()->GetMinor() ,
                                                        info->GetControl()->GetVersion()->GetBuild()));

        m_treelist->SetItemText(parent,2,info->GetControl()->GetDescription()->GetShort());

        RheiaPackageManagedFiles* files = info->GetManagedFiles();
        RheiaPackageManagedFileMap filesm = files->GetManagedFiles();
        RheiaPackageManagedFileMap::iterator fit = filesm.begin();

        wxTreeItemId plugins;
        wxTreeItemId libs;
        wxTreeItemId fils;

        for( ; fit != filesm.end() ; ++fit )
        {
            RheiaPackageManagedFile* file = fit->second;

            if( file->GetType().IsSameAs(wxT("plugin")) )
            {
                if( !plugins.IsOk() )
                    plugins = m_treelist->AppendItem( parent, wxT("Plugins") );

                wxString name = file->GetName();
                RheiaPluginRegistration* reg = RheiaPluginManager::Get()->FindElement(name);

                if( reg != NULL )
                {
                    RheiaPackageTreeItemData* datab = new RheiaPackageTreeItemData( info );
                    wxTreeItemId item = m_treelist->AppendItem (plugins, name,-1,-1,datab);

                    m_treelist->SetItemText(item,1,wxString::Format(wxT("%d.%d.%d"),reg->info->GetVersion()->GetMajor(),
                                                        reg->info->GetVersion()->GetMinor() ,
                                                        reg->info->GetVersion()->GetBuild()));

                    m_treelist->SetItemText(item,2,reg->info->GetTitle());
                }
            }
            else if( file->GetType().IsSameAs(wxT("lib")) )
            {
                if( !libs.IsOk() )
                    libs = m_treelist->AppendItem( parent, wxT("Libraries") );

                wxString name = file->GetName();
                RheiaPackageTreeItemData* datab = new RheiaPackageTreeItemData( info );
                wxTreeItemId item = m_treelist->AppendItem (libs, name,-1,-1,datab);

                m_treelist->SetItemText(item,2,file->GetPath());
            }
            else if( file->GetType().IsSameAs(wxT("file")) )
            {
                if( !fils.IsOk() )
                    fils = m_treelist->AppendItem( parent, wxT("Files") );

                wxString name = file->GetName();
                RheiaPackageTreeItemData* datab = new RheiaPackageTreeItemData( info );
                wxTreeItemId item = m_treelist->AppendItem (fils, name,-1,-1,datab);

                m_treelist->SetItemText(item,2,file->GetPath());
            }
        }
    }

    sizer->Add( m_treelist , 1 , wxALL | wxEXPAND );
}
Example #5
0
void PreferencesDialog::TransferTo(wxConfigBase *cfg)
{
    XRCCTRL(*this, "user_name", wxTextCtrl)->SetValue(
        cfg->Read(_T("translator_name"), wxEmptyString));
    XRCCTRL(*this, "user_email", wxTextCtrl)->SetValue(
        cfg->Read(_T("translator_email"), wxEmptyString));
    XRCCTRL(*this, "compile_mo", wxCheckBox)->SetValue(
        cfg->Read(_T("compile_mo"), (long)true));
    XRCCTRL(*this, "show_summary", wxCheckBox)->SetValue(
        cfg->Read(_T("show_summary"), true));
    XRCCTRL(*this, "manager_startup", wxCheckBox)->SetValue(
        (bool)cfg->Read(_T("manager_startup"), (long)false));
    XRCCTRL(*this, "focus_to_text", wxCheckBox)->SetValue(
        (bool)cfg->Read(_T("focus_to_text"), (long)false));
    XRCCTRL(*this, "comment_window_editable", wxCheckBox)->SetValue(
        (bool)cfg->Read(_T("comment_window_editable"), (long)false));
    XRCCTRL(*this, "keep_crlf", wxCheckBox)->SetValue(
        (bool)cfg->Read(_T("keep_crlf"), true));
#ifdef USE_SPELLCHECKING
    XRCCTRL(*this, "enable_spellchecking", wxCheckBox)->SetValue(
        (bool)cfg->Read(_T("enable_spellchecking"), true));
#endif

    XRCCTRL(*this, "use_font_list", wxCheckBox)->SetValue(
        (bool)cfg->Read(_T("custom_font_list_use"), (long)false));
    XRCCTRL(*this, "use_font_text", wxCheckBox)->SetValue(
        (bool)cfg->Read(_T("custom_font_text_use"), (long)false));
    XRCCTRL(*this, "font_list", wxFontPickerCtrl)->SetSelectedFont(
        wxFont(cfg->Read(_T("custom_font_list_name"), wxEmptyString)));
    XRCCTRL(*this, "font_text", wxFontPickerCtrl)->SetSelectedFont(
        wxFont(cfg->Read(_T("custom_font_text_name"), wxEmptyString)));

    wxString format = cfg->Read(_T("crlf_format"), _T("unix"));
    int sel;
    if (format == _T("win")) sel = 1;
    else /* _T("unix") or obsolete settings */ sel = 0;

    XRCCTRL(*this, "crlf_format", wxChoice)->SetSelection(sel);

    m_parsers.Read(cfg);

    wxListBox *list = XRCCTRL(*this, "parsers_list", wxListBox);
    for (unsigned i = 0; i < m_parsers.GetCount(); i++)
        list->Append(m_parsers[i].Name);

    if (m_parsers.GetCount() == 0)
    {
        XRCCTRL(*this, "parser_edit", wxButton)->Enable(false);
        XRCCTRL(*this, "parser_delete", wxButton)->Enable(false);
    }
    else
        list->SetSelection(0);

#ifdef USE_TRANSMEM
    wxStringTokenizer tkn(cfg->Read(_T("TM/languages"), wxEmptyString), _T(":"));
    wxArrayString langs;
    while (tkn.HasMoreTokens()) langs.Add(tkn.GetNextToken());
    XRCCTRL(*this, "tm_langs", wxEditableListBox)->SetStrings(langs);

    XRCCTRL(*this, "tm_omits", wxSpinCtrl)->SetValue(
        cfg->Read(_T("TM/max_omitted"), 2));
    XRCCTRL(*this, "tm_delta", wxSpinCtrl)->SetValue(
        cfg->Read(_T("TM/max_delta"), 2));
    XRCCTRL(*this, "tm_automatic", wxCheckBox)->SetValue(
        cfg->Read(_T("use_tm_when_updating"), true));
#endif

#ifdef USE_SPARKLE
    XRCCTRL(*this, "auto_updates", wxCheckBox)->SetValue(
        (bool)UserDefaults_GetBoolValue("SUEnableAutomaticChecks"));
#endif // USE_SPARKLE
#ifdef __WXMSW__
    XRCCTRL(*this, "auto_updates", wxCheckBox)->SetValue(
        (bool)win_sparkle_get_automatic_check_for_updates());
#endif
}
NewFromTemplateDlg::NewFromTemplateDlg(TemplateOutputType initial, const wxArrayString& user_templates)
	: m_Template(0L),
	m_pWizard(0L),
	m_WizardIndex(-1)
{
	//ctor
	wxXmlResource::Get()->LoadObject(this, 0L, _T("dlgNewFromTemplate"),_T("wxScrollingDialog"));
	m_Wizards = Manager::Get()->GetPluginManager()->GetOffersFor(ptWizard);

    wxListbook* lb = XRCCTRL(*this, "nbMain", wxListbook);
    SetSettingsIconsStyle(lb->GetListView(), sisNoIcons);

    // create image lists
    XRCCTRL(*this, "listProjects", wxListCtrl)->SetImageList(new wxImageList(32, 32), wxIMAGE_LIST_NORMAL);
    XRCCTRL(*this, "listProjects", wxListCtrl)->SetImageList(new wxImageList(32, 32), wxIMAGE_LIST_SMALL);
    XRCCTRL(*this, "listTargets", wxListCtrl)->SetImageList(new wxImageList(32, 32), wxIMAGE_LIST_NORMAL);
    XRCCTRL(*this, "listTargets", wxListCtrl)->SetImageList(new wxImageList(32, 32), wxIMAGE_LIST_SMALL);
    XRCCTRL(*this, "listFiles", wxListCtrl)->SetImageList(new wxImageList(32, 32), wxIMAGE_LIST_NORMAL);
    XRCCTRL(*this, "listFiles", wxListCtrl)->SetImageList(new wxImageList(32, 32), wxIMAGE_LIST_SMALL);
    XRCCTRL(*this, "listCustoms", wxListCtrl)->SetImageList(new wxImageList(32, 32), wxIMAGE_LIST_NORMAL);
    XRCCTRL(*this, "listCustoms", wxListCtrl)->SetImageList(new wxImageList(32, 32), wxIMAGE_LIST_SMALL);

    // load view prefs
    XRCCTRL(*this, "rbView", wxRadioBox)->SetSelection(Manager::Get()->GetConfigManager(_T("new_from_template"))->ReadInt(_T("/view"), 0));
    ChangeView();

	BuildCategories();
	BuildList();

    // fill user templates list
    XRCCTRL(*this, "lstUser", wxListBox)->Clear();
    for (unsigned int i = 0; i < user_templates.GetCount(); ++i)
    {
        XRCCTRL(*this, "lstUser", wxListBox)->Append(user_templates[i]);
    }

    lb->SetSelection((int)initial);
}
dlgAbout::dlgAbout(wxWindow* parent)
{
    if (!wxXmlResource::Get()->LoadObject(this, parent, _T("dlgAbout"), _T("wxScrollingDialog")))
    {
        cbMessageBox(_("There was an error loading the \"About\" dialog from XRC file."),
                     _("Information"), wxICON_EXCLAMATION);
        return;
    }

    XRCCTRL(*this, "wxID_CANCEL", wxButton)->SetDefault();

    const wxString description = _("Welcome to ") + appglobals::AppName + _T(" ") +
                                 appglobals::AppVersion + _T("!\n") + appglobals::AppName +
                                 _(" is a full-featured IDE (Integrated Development Environment) "
                                   "aiming to make the individual developer (and the development team) "
                                   "work in a nice programming environment offering everything he/they "
                                   "would ever need from a program of that kind.\n"
                                   "Its pluggable architecture allows you, the developer, to add "
                                   "any kind of functionality to the core program, through the use of "
                                   "plugins...\n");

    wxString file = ConfigManager::ReadDataPath() + _T("/images/splash_1312.png");
    wxImage im; im.LoadFile(file, wxBITMAP_TYPE_PNG); im.ConvertAlphaToMask();
    wxBitmap bmp(im);
    wxMemoryDC dc;
    dc.SelectObject(bmp);
    cbSplashScreen::DrawReleaseInfo(dc);

    wxStaticBitmap *bmpControl = XRCCTRL(*this, "lblTitle", wxStaticBitmap);
    bmpControl->SetSize(im.GetWidth(),im.GetHeight());
    bmpControl->SetBitmap(bmp);

    XRCCTRL(*this, "lblBuildTimestamp", wxStaticText)->SetLabel(wxString(_("Build: ")) + appglobals::AppBuildTimestamp);
    XRCCTRL(*this, "txtDescription",    wxTextCtrl)->SetValue(description);
    XRCCTRL(*this, "txtThanksTo",       wxTextCtrl)->SetValue(_(
        "Developers:\n"
        "--------------\n"
        "Yiannis Mandravellos: Developer - Project leader\n"
        "Thomas Denk         : Developer\n"
        "Lieven de C**k      : Developer\n"
        "\"tiwag\"             : Developer\n"
        "Martin Halle        : Developer\n"
        "Biplab Modak        : Developer\n"
        "Jens Lody           : Developer\n"
        "Yuchen Deng         : Developer\n"
        "Teodor Petrov       : Developer\n"
        "Daniel Anselmi      : Developer\n"
        "Yuanhui Zhang       : Developer\n"
        "Damien Moore        : Developer\n"
        "Micah Ng            : Developer\n"
        "Ricardo Garcia      : All-hands person\n"
        "Paul A. Jimenez     : Help and AStyle plugins\n"
        "Thomas Lorblanches  : CodeStat and Profiler plugins\n"
        "Bartlomiej Swiecki  : wxSmith RAD plugin\n"
        "Jerome Antoine      : ThreadSearch plugin\n"
        "Pecan Heber         : Keybinder, BrowseTracker, DragScroll\n"
        "                      CodeSnippets plugins\n"
        "Arto Jonsson        : CodeSnippets plugin (passed on to Pecan)\n"
        "Darius Markauskas   : Fortran support\n"
        "Mario Cupelli       : Compiler support for embedded systems\n"
        "                      User's manual\n"
        "Jonas Zinn          : Misc. wxSmith AddOns and plugins\n"
        "Mirai Computing     : cbp2make tool\n"
        "Anders F Bjoerklund : wxMac compatibility\n"
        "\n"
        "Contributors (in no special order):\n"
        "-----------------------------------\n"
        "Daniel Orb          : RPM spec file and packages\n"
        "byo,elvstone, me22  : Conversion to Unicode\n"
        "pasgui              : Providing Ubuntu nightly packages\n"
        "Hakki Dogusan       : DigitalMars compiler support\n"
        "ybx                 : OpenWatcom compiler support\n"
        "Tim Baker           : Patches for the direct-compile-mode\n"
        "                      dependencies generation system\n"
        "David Perfors       : Unicode tester and future documentation writer\n"
        "Sylvain Prat        : Initial MSVC workspace and project importers\n"
        "Chris Raschko       : Design of the 3D logo for Code::Blocks\n"
        "J.A. Ortega         : 3D Icon based on the above\n"
        "Alexandr Efremo     : Providing OpenSuSe packages\n"
        "Huki                : Misc. Code-Completion improvements\n"
        "stahta01            : Misc. patches for several enhancements\n"
        "BlueHazzard         : Misc. patches for several enhancements\n"
        "\n"
        "All contributors that provided patches.\n"
        "The wxWidgets project (http://www.wxwidgets.org).\n"
        "wxScintilla (http://sourceforge.net/projects/wxscintilla).\n"
        "TinyXML parser (http://www.grinninglizard.com/tinyxml).\n"
        "Squirrel scripting language (http://www.squirrel-lang.org).\n"
        "The GNU Software Foundation (http://www.gnu.org).\n"
        "Last, but not least, the open-source community."));
    XRCCTRL(*this, "txtLicense", wxTextCtrl)->SetValue(LICENSE_GPL);

    XRCCTRL(*this, "lblName",    wxStaticText)->SetLabel(appglobals::AppName);
    XRCCTRL(*this, "lblVersion", wxStaticText)->SetLabel(appglobals::AppActualVersionVerb);
    XRCCTRL(*this, "lblSDK",     wxStaticText)->SetLabel(appglobals::AppSDKVersion);
    XRCCTRL(*this, "lblAuthor",  wxStaticText)->SetLabel(_("The Code::Blocks Team"));
    XRCCTRL(*this, "lblEmail",   wxStaticText)->SetLabel(appglobals::AppContactEmail);
    XRCCTRL(*this, "lblWebsite", wxStaticText)->SetLabel(appglobals::AppUrl);

#ifdef __WXMAC__
    // Courier 8 point is not readable on Mac OS X, increase font size:
    wxFont font1 = XRCCTRL(*this, "txtThanksTo", wxTextCtrl)->GetFont();
    font1.SetPointSize(10);
    XRCCTRL(*this, "txtThanksTo", wxTextCtrl)->SetFont(font1);

    wxFont font2 = XRCCTRL(*this, "txtLicense", wxTextCtrl)->GetFont();
    font2.SetPointSize(10);
    XRCCTRL(*this, "txtLicense", wxTextCtrl)->SetFont(font2);
#endif
    Fit();
    CentreOnParent();
}
void AstyleConfigDlg::LoadSettings()
{
  ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("astyle"));
  int style = cfg->ReadInt(_T("/style"), 0);

  XRCCTRL(*this, "spnIndentation",        wxSpinCtrl)->SetValue(cfg->ReadInt(_T("/indentation"),           4));
  XRCCTRL(*this, "chkUseTab",             wxCheckBox)->SetValue(cfg->ReadBool(_T("/use_tabs"),             false));
  XRCCTRL(*this, "chkForceUseTabs",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/force_tabs"),           false));
  XRCCTRL(*this, "chkIndentClasses",      wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_classes"),       false));
  XRCCTRL(*this, "chkIndentSwitches",     wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_switches"),      false));
  XRCCTRL(*this, "chkIndentCase",         wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_case"),          false));
  XRCCTRL(*this, "chkIndentBrackets",     wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_brackets"),      false));
  XRCCTRL(*this, "chkIndentBlocks",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_blocks"),        false));
  XRCCTRL(*this, "chkIndentNamespaces",   wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_namespaces"),    false));
  XRCCTRL(*this, "chkIndentLabels",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_labels"),        false));
  XRCCTRL(*this, "chkIndentPreprocessor", wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_preprocessor"),  false));
  XRCCTRL(*this, "chkIndentCol1Comments", wxCheckBox)->SetValue(cfg->ReadBool(_T("/indent_col1_comments"), false));
  XRCCTRL(*this, "cmbPointerAlign",       wxComboBox)->SetValue(cfg->Read(_T("/pointer_align"),            _T("None")));
  XRCCTRL(*this, "chkBreakClosing",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/break_closing"),        false));
  XRCCTRL(*this, "chkBreakBlocks",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/break_blocks"),         false));
  XRCCTRL(*this, "chkBreakElseIfs",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/break_elseifs"),        false));
  XRCCTRL(*this, "chkPadOperators",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/pad_operators"),        false));
  XRCCTRL(*this, "chkPadParensIn",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/pad_parentheses_in"),   false));
  XRCCTRL(*this, "chkPadParensOut",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/pad_parentheses_out"),  false));
  XRCCTRL(*this, "chkPadHeader",          wxCheckBox)->SetValue(cfg->ReadBool(_T("/pad_header"),           false));
  XRCCTRL(*this, "chkUnpadParens",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/unpad_parentheses"),    false));
  XRCCTRL(*this, "chkDelEmptyLine",       wxCheckBox)->SetValue(cfg->ReadBool(_T("/delete_empty_lines"),   false));
  XRCCTRL(*this, "chkKeepComplex",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/keep_complex"),         false));
  XRCCTRL(*this, "chkKeepBlocks",         wxCheckBox)->SetValue(cfg->ReadBool(_T("/keep_blocks"),          false));
  XRCCTRL(*this, "chkConvertTabs",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/convert_tabs"),         false));
  XRCCTRL(*this, "chkFillEmptyLines",     wxCheckBox)->SetValue(cfg->ReadBool(_T("/fill_empty_lines"),     false));
  XRCCTRL(*this, "chkAddBrackets",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/add_brackets"),         false));
  XRCCTRL(*this, "chkBreakeLines",        wxCheckBox)->SetValue(cfg->ReadBool(_T("/break_lines"),          false));
  XRCCTRL(*this, "txtMaxLineLegth",       wxTextCtrl)->SetValue(cfg->Read(_T("/max_line_length"),          _T("200")));

  if (XRCCTRL(*this, "chkBreakeLines",wxCheckBox)->GetValue())
    XRCCTRL(*this, "txtMaxLineLegth", wxTextCtrl)->Enable();
  else
    XRCCTRL(*this, "txtMaxLineLegth", wxTextCtrl)->Disable();

  SetStyle((AStylePredefinedStyle)style);
}
void AstyleConfigDlg::SaveSettings()
{
  ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("astyle"));
  int style = 0;

  if      (XRCCTRL(*this, "rbAllman",     wxRadioButton)->GetValue())
    style = aspsAllman;
  else if (XRCCTRL(*this, "rbJava",       wxRadioButton)->GetValue())
    style = aspsJava;
  else if (XRCCTRL(*this, "rbKr",         wxRadioButton)->GetValue())
    style = aspsKr;
  else if (XRCCTRL(*this, "rbStroustrup", wxRadioButton)->GetValue())
    style = aspsStroustrup;
  else if (XRCCTRL(*this, "rbWhitesmith", wxRadioButton)->GetValue())
    style = aspsWhitesmith;
  else if (XRCCTRL(*this, "rbBanner",     wxRadioButton)->GetValue())
    style = aspsBanner;
  else if (XRCCTRL(*this, "rbGNU",        wxRadioButton)->GetValue())
    style = aspsGnu;
  else if (XRCCTRL(*this, "rbLinux",      wxRadioButton)->GetValue())
    style = aspsLinux;
  else if (XRCCTRL(*this, "rbHorstmann",  wxRadioButton)->GetValue())
    style = aspsHorstmann;
  else if (XRCCTRL(*this, "rb1TBS",       wxRadioButton)->GetValue())
    style = asps1TBS;
  else if (XRCCTRL(*this, "rbPico",       wxRadioButton)->GetValue())
    style = aspsPico;
  else if (XRCCTRL(*this, "rbLisp",       wxRadioButton)->GetValue())
    style = aspsLisp;
  else if (XRCCTRL(*this, "rbCustom",     wxRadioButton)->GetValue())
    style = aspsCustom;

  cfg->Write(_T("/style"), style);
  cfg->Write(_T("/indentation"),          XRCCTRL(*this, "spnIndentation",        wxSpinCtrl)->GetValue());
  cfg->Write(_T("/use_tabs"),             XRCCTRL(*this, "chkUseTab",             wxCheckBox)->GetValue());
  cfg->Write(_T("/force_tabs"),           XRCCTRL(*this, "chkForceUseTabs",       wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_classes"),       XRCCTRL(*this, "chkIndentClasses",      wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_switches"),      XRCCTRL(*this, "chkIndentSwitches",     wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_case"),          XRCCTRL(*this, "chkIndentCase",         wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_brackets"),      XRCCTRL(*this, "chkIndentBrackets",     wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_blocks"),        XRCCTRL(*this, "chkIndentBlocks",       wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_namespaces"),    XRCCTRL(*this, "chkIndentNamespaces",   wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_labels"),        XRCCTRL(*this, "chkIndentLabels",       wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_preprocessor"),  XRCCTRL(*this, "chkIndentPreprocessor", wxCheckBox)->GetValue());
  cfg->Write(_T("/indent_col1_comments"), XRCCTRL(*this, "chkIndentCol1Comments", wxCheckBox)->GetValue());
  cfg->Write(_T("/pointer_align"),        XRCCTRL(*this, "cmbPointerAlign",       wxComboBox)->GetValue());
  cfg->Write(_T("/break_closing"),        XRCCTRL(*this, "chkBreakClosing",       wxCheckBox)->GetValue());
  cfg->Write(_T("/break_blocks"),         XRCCTRL(*this, "chkBreakBlocks",        wxCheckBox)->GetValue());
  cfg->Write(_T("/break_elseifs"),        XRCCTRL(*this, "chkBreakElseIfs",       wxCheckBox)->GetValue());
  cfg->Write(_T("/pad_operators"),        XRCCTRL(*this, "chkPadOperators",       wxCheckBox)->GetValue());
  cfg->Write(_T("/pad_parentheses_in"),   XRCCTRL(*this, "chkPadParensIn",        wxCheckBox)->GetValue());
  cfg->Write(_T("/pad_parentheses_out"),  XRCCTRL(*this, "chkPadParensOut",       wxCheckBox)->GetValue());
  cfg->Write(_T("/pad_header"),           XRCCTRL(*this, "chkPadHeader",          wxCheckBox)->GetValue());
  cfg->Write(_T("/unpad_parentheses"),    XRCCTRL(*this, "chkUnpadParens",        wxCheckBox)->GetValue());
  cfg->Write(_T("/delete_empty_lines"),   XRCCTRL(*this, "chkDelEmptyLine",       wxCheckBox)->GetValue());
  cfg->Write(_T("/keep_complex"),         XRCCTRL(*this, "chkKeepComplex",        wxCheckBox)->GetValue());
  cfg->Write(_T("/keep_blocks"),          XRCCTRL(*this, "chkKeepBlocks",         wxCheckBox)->GetValue());
  cfg->Write(_T("/convert_tabs"),         XRCCTRL(*this, "chkConvertTabs",        wxCheckBox)->GetValue());
  cfg->Write(_T("/fill_empty_lines"),     XRCCTRL(*this, "chkFillEmptyLines",     wxCheckBox)->GetValue());
  cfg->Write(_T("/add_brackets"),         XRCCTRL(*this, "chkAddBrackets",        wxCheckBox)->GetValue());
  cfg->Write(_T("/break_lines"),          XRCCTRL(*this, "chkBreakeLines",        wxCheckBox)->GetValue());
  cfg->Write(_T("/max_line_length"),      XRCCTRL(*this, "txtMaxLineLegth",       wxTextCtrl)->GetValue());
}
Example #10
0
void CFilterDialog::OnRename(wxCommandEvent& event)
{
	wxChoice* pChoice = XRCCTRL(*this, "ID_SETS", wxChoice);
	int old_pos = pChoice->GetSelection();
	if (old_pos == -1)
		return;

	if (!old_pos)
	{
		wxMessageBoxEx(_("This filter set cannot be renamed."));
		return;
	}

	CInputDialog dlg;

	wxString msg = wxString::Format(_("Please enter a new name for the filter set \"%s\""), pChoice->GetStringSelection());

	dlg.Create(this, _("Enter new name for filterset"), msg);
	if (dlg.ShowModal() != wxID_OK)
		return;

	wxString name = dlg.GetValue();

	if (name == pChoice->GetStringSelection())
	{
		// Nothing changed
		return;
	}

	if (name.empty())
	{
		wxMessageBoxEx(_("No name for the filterset given."), _("Cannot save filterset"), wxICON_INFORMATION);
		return;
	}

	int pos = pChoice->FindString(name);
	if (pos != wxNOT_FOUND)
	{
		if (wxMessageBoxEx(_("Given filterset name already exists, overwrite filter set?"), _("Filter set already exists"), wxICON_QUESTION | wxYES_NO) != wxYES)
			return;
	}

	// Remove old entry
	pChoice->Delete(old_pos);
	CFilterSet set = m_filterSets[old_pos];
	m_filterSets.erase(m_filterSets.begin() + old_pos);

	pos = pChoice->FindString(name);
	if (pos == wxNOT_FOUND)
	{
		pos = m_filterSets.size();
		m_filterSets.push_back(set);
		pChoice->Append(name);
	}
	else
		m_filterSets[pos] = set;

	m_filterSets[pos].name = name;

	pChoice->SetSelection(pos);
	m_currentFilterSet = pos;

	GetSizer()->Fit(this);
}
Example #11
0
bool CSettingsDialog::LoadPages()
{
	// Get the tree control.

	wxTreeCtrl* treeCtrl = XRCCTRL(*this, "ID_TREE", wxTreeCtrl);
	wxASSERT(treeCtrl);
	if (!treeCtrl)
		return false;

	wxTreeItemId root = treeCtrl->AddRoot(_T(""));

	// Create the instances of the page classes and fill the tree.
	t_page page;
	ADD_PAGE(_("Connection"), COptionsPageConnection, page_none);
	ADD_PAGE(_("FTP"), COptionsPageConnectionFTP, page_connection);
	ADD_PAGE(_("Active mode"), COptionsPageConnectionActive, page_connection_ftp);
	ADD_PAGE(_("Passive mode"), COptionsPageConnectionPassive, page_connection_ftp);
	ADD_PAGE(_("FTP Proxy"), COptionsPageFtpProxy, page_connection_ftp);
	ADD_PAGE(_("SFTP"), COptionsPageConnectionSFTP, page_connection);
	ADD_PAGE(_("Generic proxy"), COptionsPageProxy, page_connection);
	ADD_PAGE(_("Transfers"), COptionsPageTransfer, page_none);
	ADD_PAGE(_("File Types"), COptionsPageFiletype, page_transfer);
	ADD_PAGE(_("File exists action"), COptionsPageFileExists, page_transfer);
	ADD_PAGE(_("Interface"), COptionsPageInterface, page_none);
	ADD_PAGE(_("Themes"), COptionsPageThemes, page_interface);
	ADD_PAGE(_("Date/time format"), COptionsPageDateFormatting, page_interface);
	ADD_PAGE(_("Filesize format"), COptionsPageSizeFormatting, page_interface);
	ADD_PAGE(_("File lists"), COptionsPageFilelists, page_interface);
	ADD_PAGE(_("Language"), COptionsPageLanguage, page_none);
	ADD_PAGE(_("File editing"), COptionsPageEdit, page_none);
	ADD_PAGE(_("Filetype associations"), COptionsPageEditAssociations, page_edit);
#if FZ_MANUALUPDATECHECK && FZ_AUTOUPDATECHECK
	if (!COptions::Get()->GetDefaultVal(DEFAULT_DISABLEUPDATECHECK))
	{
		ADD_PAGE(_("Update Check"), COptionsPageUpdateCheck, page_none);
	}
#endif //FZ_MANUALUPDATECHECK && FZ_AUTOUPDATECHECK
	ADD_PAGE(_("Logging"), COptionsPageLogging, page_none);
	ADD_PAGE(_("Debug"), COptionsPageDebug, page_none);

	treeCtrl->SetQuickBestSize(false);
	treeCtrl->InvalidateBestSize();
	treeCtrl->SetInitialSize();
	
	// Compensate for scrollbar
	wxSize size = treeCtrl->GetBestSize();
	int scrollWidth = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X, treeCtrl);
	size.x += scrollWidth;
	size.y = 0;
	treeCtrl->SetInitialSize(size);
	Layout();

	// Before we can initialize the pages, get the target panel in the settings
	// dialog.
	wxPanel* parentPanel = XRCCTRL(*this, "ID_PAGEPANEL", wxPanel);
	wxASSERT(parentPanel);
	if (!parentPanel)
		return false;

	// Keep track of maximum page size
	size = wxSize();

	for (std::vector<t_page>::iterator iter = m_pages.begin(); iter != m_pages.end(); iter++)
	{
		if (!iter->page->CreatePage(m_pOptions, this, parentPanel, size))
			return false;
	}

	if (!LoadSettings())
	{
		wxMessageBox(_("Failed to load panels, invalid resource files?"));
		return false;
	}

	wxSize canvas;
	canvas.x = GetSize().x - parentPanel->GetSize().x;
	canvas.y = GetSize().y - parentPanel->GetSize().y;

	// Wrap pages nicely
	std::vector<wxWindow*> pages;
	for (unsigned int i = 0; i < m_pages.size(); i++)
	{
		pages.push_back(m_pages[i].page);
	}
	wxGetApp().GetWrapEngine()->WrapRecursive(pages, 1.33, "Settings", canvas);

	// Keep track of maximum page size
	size = wxSize(0, 0);
	for (std::vector<t_page>::iterator iter = m_pages.begin(); iter != m_pages.end(); iter++)
		size.IncTo(iter->page->GetSizer()->GetMinSize());

#ifdef __WXGTK__
	size.x += 1;
#endif
	parentPanel->SetInitialSize(size);

	// Adjust pages sizes according to maximum size
	for (std::vector<t_page>::iterator iter = m_pages.begin(); iter != m_pages.end(); iter++)
	{
		iter->page->GetSizer()->SetMinSize(size);
		iter->page->GetSizer()->Fit(iter->page);
		iter->page->GetSizer()->SetSizeHints(iter->page);
	}

	GetSizer()->Fit(this);
	GetSizer()->SetSizeHints(this);

#ifdef __WXGTK__
	// Pre-show dialog under GTK, else panels won't get initialized properly
	Show();
#endif

	for (std::vector<t_page>::iterator iter = m_pages.begin(); iter != m_pages.end(); iter++)
		iter->page->Hide();

	// Select first page
	treeCtrl->SelectItem(m_pages[0].id);
	if (!m_activePanel)
	{
		m_activePanel = m_pages[0].page;
		m_activePanel->Display();
	}

	return true;
}
Example #12
0
bool CLoginManager::DisplayDialog(CServer &server, wxString name, wxString challenge)
{
    wxDialog pwdDlg;
    wxXmlResource::Get()->LoadDialog(&pwdDlg, wxGetApp().GetTopWindow(), _T("ID_ENTERPASSWORD"));
    if (name == _T(""))
    {
        pwdDlg.GetSizer()->Show(XRCCTRL(pwdDlg, "ID_NAMELABEL", wxStaticText), false, true);
        pwdDlg.GetSizer()->Show(XRCCTRL(pwdDlg, "ID_NAME", wxStaticText), false, true);
    }
    else
        XRCCTRL(pwdDlg, "ID_NAME", wxStaticText)->SetLabel(name);
    if (challenge == _T(""))
    {
        pwdDlg.GetSizer()->Show(XRCCTRL(pwdDlg, "ID_CHALLENGELABEL", wxStaticText), false, true);
        pwdDlg.GetSizer()->Show(XRCCTRL(pwdDlg, "ID_CHALLENGE", wxTextCtrl), false, true);
    }
    else
    {
#ifdef __WXMSW__
        challenge.Replace(_T("\n"), _T("\r\n"));
#endif
        XRCCTRL(pwdDlg, "ID_CHALLENGE", wxTextCtrl)->ChangeValue(challenge);
        pwdDlg.GetSizer()->Show(XRCCTRL(pwdDlg, "ID_REMEMBER", wxCheckBox), false, true);
        XRCCTRL(pwdDlg, "ID_CHALLENGE", wxTextCtrl)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
    }
    XRCCTRL(pwdDlg, "ID_HOST", wxStaticText)->SetLabel(server.FormatHost());

    if (server.GetUser() == _T(""))
    {
        pwdDlg.SetTitle(_("Enter username and password"));
        XRCCTRL(pwdDlg, "ID_OLD_USER_LABEL", wxStaticText)->Hide();
        XRCCTRL(pwdDlg, "ID_OLD_USER", wxStaticText)->Hide();

        XRCCTRL(pwdDlg, "ID_HEADER_PASS", wxStaticText)->Hide();
        if (server.GetLogonType() == INTERACTIVE)
        {
            XRCCTRL(pwdDlg, "ID_PASSWORD_LABEL", wxStaticText)->Hide();
            XRCCTRL(pwdDlg, "ID_PASSWORD", wxTextCtrl)->Hide();
            XRCCTRL(pwdDlg, "ID_REMEMBER", wxCheckBox)->Hide();
            XRCCTRL(pwdDlg, "ID_HEADER_BOTH", wxStaticText)->Hide();
        }
        else
            XRCCTRL(pwdDlg, "ID_HEADER_USER", wxStaticText)->Hide();
    }
    else
    {
        XRCCTRL(pwdDlg, "ID_OLD_USER", wxStaticText)->SetLabel(server.GetUser());
        XRCCTRL(pwdDlg, "ID_NEW_USER_LABEL", wxStaticText)->Hide();
        XRCCTRL(pwdDlg, "ID_NEW_USER", wxTextCtrl)->Hide();
        XRCCTRL(pwdDlg, "ID_HEADER_USER", wxStaticText)->Hide();
        XRCCTRL(pwdDlg, "ID_HEADER_BOTH", wxStaticText)->Hide();
    }
    XRCCTRL(pwdDlg, "wxID_OK", wxButton)->SetId(wxID_OK);
    XRCCTRL(pwdDlg, "wxID_CANCEL", wxButton)->SetId(wxID_CANCEL);
    pwdDlg.GetSizer()->Fit(&pwdDlg);
    pwdDlg.GetSizer()->SetSizeHints(&pwdDlg);

    wxString user;
    while (user == _T(""))
    {
        if (pwdDlg.ShowModal() != wxID_OK)
            return false;

        if (server.GetUser() == _T(""))
        {
            user = XRCCTRL(pwdDlg, "ID_NEW_USER", wxTextCtrl)->GetValue();
            if (user == _T(""))
            {
                wxMessageBox(_("No username given."), _("Invalid input"), wxICON_EXCLAMATION);
                continue;
            }
        }
        else
            user = server.GetUser();
    }

    server.SetUser(user, XRCCTRL(pwdDlg, "ID_PASSWORD", wxTextCtrl)->GetValue());

    if (server.GetLogonType() == ASK && XRCCTRL(pwdDlg, "ID_REMEMBER", wxCheckBox)->GetValue())
    {
        t_passwordcache entry;
        entry.host = server.GetHost();
        entry.port = server.GetPort();
        entry.user = server.GetUser();
        entry.password = server.GetPass();
        m_passwordCache.push_back(entry);
    }

    return true;
}
Example #13
0
void MainFrame::OnMouseSpeedChanged(wxScrollEvent & WXUNUSED(event))
{
	wxUint32 mouseSpeed = XRCCTRL(*this, "m_slider_mouseSpeed", wxSlider)->GetValue();
	wxConfig::Get()->Write(L"Mouse Speed", (long)mouseSpeed);
	g_mouseSpeed = (wxUint8)mouseSpeed;
}
Example #14
0
void MainFrame::OnPortChange(wxSpinEvent & event)
{
	g_basePort = event.GetPosition();
	wxConfig::Get()->Write(L"Base Port", (long)g_basePort);
	XRCCTRL(*this, "m_staticText_portRange", wxStaticText)->SetLabel(wxString::Format(L"%d", g_basePort+2));
}
wxString NewFromTemplateDlg::GetSelectedUserTemplate() const
{
    int sel = XRCCTRL(*this, "lstUser", wxListBox)->GetSelection();
    return sel != -1 ? XRCCTRL(*this, "lstUser", wxListBox)->GetString(sel) : _T("");
}
Example #16
0
void AstyleConfigDlg::SetStyle(AStylePredefinedStyle style)
{
  wxString sample;

  switch (style)
  {
#define AS_ALLMAN "\
int Foo(bool isBar)\n\
{\n\
    if (isBar)\n\
    {\n\
        bar();\n\
        return 1;\n\
    }\n\
    else\n\
        return 0;\n\
}"
    case aspsAllman:
      sample = _T(AS_ALLMAN);
      XRCCTRL(*this, "rbAllman", wxRadioButton)->SetValue(true);
      break;
#undef AS_ALLMAN
#define AS_JAVA "\
int Foo(bool isBar) {\n\
    if (isBar) {\n\
        bar();\n\
        return 1;\n\
    } else\n\
        return 0;\n\
}"
    case aspsJava:
      sample = _T(AS_JAVA);
      XRCCTRL(*this, "rbJava", wxRadioButton)->SetValue(true);
      break;
#undef AS_JAVA
#define AS_KR "\
int Foo(bool isBar)\n\
{\n\
    if (isBar) {\n\
        bar();\n\
        return 1;\n\
    } else\n\
        return 0;\n\
}"
    case aspsKr:
      sample = _T(AS_KR);
      XRCCTRL(*this, "rbKr", wxRadioButton)->SetValue(true);
      break;
#undef AS_KR
#define AS_STROUSTRUP "\
int Foo(bool isBar)\n\
{\n\
     if (isBar) {\n\
          bar();\n\
          return 1;\n\
     } else\n\
          return 0;\n\
}"
    case aspsStroustrup:
      sample = _T(AS_STROUSTRUP);
      XRCCTRL(*this, "rbStroustrup", wxRadioButton)->SetValue(true);
      break;
#undef AS_STROUSTRUP
#define AS_WHITESMITH "\
int Foo(bool isBar)\n\
    {\n\
    if (isBar)\n\
        {\n\
        bar();\n\
        return 1;\n\
        }\n\
    else\n\
        return 0;\n\
    }"
    case aspsWhitesmith:
      sample = _T(AS_WHITESMITH);
      XRCCTRL(*this, "rbWhitesmith", wxRadioButton)->SetValue(true);
      break;
#undef AS_WHITESMITH
#define AS_BANNER "\
int Foo(bool isBar) {\n\
    if (isBar) {\n\
        bar();\n\
        return 1;\n\
        }\n\
    else\n\
        return 0;\n\
    }"
    case aspsBanner:
      sample = _T(AS_BANNER);
      XRCCTRL(*this, "rbBanner", wxRadioButton)->SetValue(true);
      break;
#undef AS_BANNER
#define AS_GNU "\
int Foo(bool isBar)\n\
{\n\
  if (isBar)\n\
    {\n\
      bar();\n\
      return 1;\n\
    }\n\
  else\n\
    return 0;\n\
}"
    case aspsGnu:
      sample = _T(AS_GNU);
      XRCCTRL(*this, "rbGNU", wxRadioButton)->SetValue(true);
      break;
#undef AS_GNU
#define AS_LINUX "\
int Foo(bool isBar)\n\
{\n\
        if (isBar) {\n\
                bar();\n\
                return 1;\n\
        } else\n\
                return 0;\n\
}"
    case aspsLinux:
      sample = _T(AS_LINUX);
      XRCCTRL(*this, "rbLinux", wxRadioButton)->SetValue(true);
      break;
#undef AS_LINUX
#define AS_HORSTMANN "\
int Foo(bool isBar)\n\
{  if (isBar)\n\
   {  bar();\n\
      return 1;\n\
   }\n\
   else\n\
      return 0;\n\
}"
    case aspsHorstmann:
      sample = _T(AS_HORSTMANN);
      XRCCTRL(*this, "rbHorstmann", wxRadioButton)->SetValue(true);
      break;
#undef AS_HORSTMANN
#define AS_1TBS "\
int Foo(bool isBar)\n\
{\n\
    if (isFoo) {\n\
        bar();\n\
        return 1;\n\
    } else {\n\
        return 0;\n\
    }\n\
}"
    case asps1TBS:
      sample = _T(AS_1TBS);
      XRCCTRL(*this, "rb1TBS", wxRadioButton)->SetValue(true);
      break;
#undef AS_1TBS
#define AS_PICO "\
int Foo(bool isBar)\n\
{  if (isBar)\n\
   {  bar();\n\
      return 1; }\n\
    else\n\
      return 0; }"
    case aspsPico:
      sample = _T(AS_PICO);
      XRCCTRL(*this, "rbPico", wxRadioButton)->SetValue(true);
      break;
#undef AS_PICO
#define AS_LISP "\
int Foo(bool isBar) {\n\
    if (isBar) {\n\
        bar()\n\
        return 1; }\n\
    else\n\
        return 0; }"
    case aspsLisp:
      sample = _T(AS_LISP);
      XRCCTRL(*this, "rbLisp", wxRadioButton)->SetValue(true);
      break;
#undef AS_LISP
    case aspsCustom: // fall-through
    default:
      XRCCTRL(*this, "rbCustom", wxRadioButton)->SetValue(true);
      break;
  }

  if (!sample.IsEmpty())
    XRCCTRL(*this, "txtSample", wxTextCtrl)->SetValue(sample);
}
void NewFromTemplateDlg::ChangeView()
{
    int sel = XRCCTRL(*this, "rbView", wxRadioBox)->GetSelection();
    int style = sel == 0 ? wxLC_ICON : wxLC_LIST;

    XRCCTRL(*this, "listProjects", wxListCtrl)->SetSingleStyle(style);
    XRCCTRL(*this, "listTargets", wxListCtrl)->SetSingleStyle(style);
    XRCCTRL(*this, "listFiles", wxListCtrl)->SetSingleStyle(style);
    XRCCTRL(*this, "listCustoms", wxListCtrl)->SetSingleStyle(style);

	// in non-windows platforms, the above clears the control contents too
	// so rebuild them
#ifndef __WXMSW__
    BuildListFor(totProject, XRCCTRL(*this, "listProjects", wxListCtrl), XRCCTRL(*this, "cmbProjectCategories", wxChoice));
    BuildListFor(totTarget, XRCCTRL(*this, "listTargets", wxListCtrl), XRCCTRL(*this, "cmbTargetCategories", wxChoice));
    BuildListFor(totFiles, XRCCTRL(*this, "listFiles", wxListCtrl), XRCCTRL(*this, "cmbFileCategories", wxChoice));
    BuildListFor(totCustom, XRCCTRL(*this, "listCustoms", wxListCtrl), XRCCTRL(*this, "cmbCustomCategories", wxChoice));
#endif
}
Example #18
0
/*----------------------------------------------------------------------
  ----------------------------------------------------------------------*/
void ListNSDlgWX::OnNSSelected(wxCommandEvent& event)
{
    if (event.IsSelection())
        XRCCTRL(*this, "wxID_COMBOBOX_NEW_ELEM_NS", wxComboBox)->SetValue(event.GetString());
}
Example #19
0
bool CWelcomeDialog::Run(wxWindow* parent, bool force /*=false*/, bool delay /*=false*/)
{
	const wxString ownVersion = CBuildInfo::GetVersion();
	wxString greetingVersion = COptions::Get()->GetOption(OPTION_GREETINGVERSION);

	if (!force) {
		if (COptions::Get()->GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2) {
			if (delay)
				delete this;
			return true;
		}

		if (!greetingVersion.empty() &&
			CBuildInfo::ConvertToVersionNumber(ownVersion.c_str()) <= CBuildInfo::ConvertToVersionNumber(greetingVersion.c_str()))
		{
			// Been there done that
			if (delay)
				delete this;
			return true;
		}
		COptions::Get()->SetOption(OPTION_GREETINGVERSION, ownVersion);

		if (greetingVersion.empty() && !COptions::Get()->GetOptionVal(OPTION_DEFAULT_KIOSKMODE))
			COptions::Get()->SetOption(OPTION_PROMPTPASSWORDSAVE, 1);
	}

	if (!Load(parent, _T("ID_WELCOME"))) {
		if( delay ) {
			delete this;
		}
		return false;
	}

	XRCCTRL(*this, "ID_FZVERSION", wxStaticText)->SetLabel(_T("FileZilla ") + CBuildInfo::GetVersion());

	const wxString url = _T("http://welcome.filezilla-project.org/welcome?type=client&category=%s&version=") + ownVersion;

	wxHyperlinkCtrl* pNews = XRCCTRL(*this, "ID_LINK_NEWS", wxHyperlinkCtrl);
	pNews->SetURL(wxString::Format(url, _T("news")) + _T("&oldversion=") + greetingVersion);

	if (!greetingVersion.empty()) {
		wxHyperlinkCtrl* pNews = XRCCTRL(*this, "ID_LINK_NEWS", wxHyperlinkCtrl);
		pNews->SetLabel(wxString::Format(_("New features and improvements in %s"), CBuildInfo::GetVersion()));
	}
	else {
		XRCCTRL(*this, "ID_HEADING_NEWS", wxStaticText)->Hide();
		pNews->Hide();
	}

	XRCCTRL(*this, "ID_DOCUMENTATION_BASIC", wxHyperlinkCtrl)->SetURL(wxString::Format(url, _T("documentation_basic")));
	XRCCTRL(*this, "ID_DOCUMENTATION_NETWORK", wxHyperlinkCtrl)->SetURL(wxString::Format(url, _T("documentation_network")));
	XRCCTRL(*this, "ID_DOCUMENTATION_MORE", wxHyperlinkCtrl)->SetURL(wxString::Format(url, _T("documentation_more")));
	XRCCTRL(*this, "ID_SUPPORT_FORUM", wxHyperlinkCtrl)->SetURL(wxString::Format(url, _T("support_forum")));
	XRCCTRL(*this, "ID_SUPPORT_MORE", wxHyperlinkCtrl)->SetURL(wxString::Format(url, _T("support_more")));
	Layout();

	GetSizer()->Fit(this);

	if (delay)
	{
		m_delayedShowTimer.SetOwner(this);
		m_delayedShowTimer.Start(10, true);
	}
	else
		ShowModal();

	return true;
}
Example #20
0
/*----------------------------------------------------------------------
  NSUpdate called when the user change the selection
  returns:
  ----------------------------------------------------------------------*/
void ListNSDlgWX::NSUpdate( const wxArrayString& items )
{
    // fill up the ns list
    XRCCTRL(*this, "wxID_LIST_ELEM_NS", wxListBox)->Clear( );
    XRCCTRL(*this, "wxID_LIST_ELEM_NS", wxListBox)->Append( items );
}
ScriptSecurityResponse ScriptSecurityWarningDlg::GetResponse()
{
    return (ScriptSecurityResponse)XRCCTRL(*this, "cmbAnswer", wxComboBox)->GetSelection();
}
Example #22
0
bool FindFrame::DoFind(int dir)
{
    int cnt = m_listCtrl->GetItemCount();
    bool inStr = XRCCTRL(*this, "in_orig", wxCheckBox)->GetValue();
    bool inTrans = XRCCTRL(*this, "in_trans", wxCheckBox)->GetValue();
    bool inComments = XRCCTRL(*this, "in_comments", wxCheckBox)->GetValue();
    bool inAutoComments = XRCCTRL(*this, "in_auto_comments", wxCheckBox)->GetValue();
    bool caseSens = XRCCTRL(*this, "case_sensitive", wxCheckBox)->GetValue();
    bool wholeWords = XRCCTRL(*this, "whole_words", wxCheckBox)->GetValue();
    int posOrig = m_position;

    FoundState found = Found_Not;
    wxString textc;
    wxString text(ms_text);

    if (!caseSens)
        text.MakeLower();

    // Only ignore mnemonics when searching if the text being searched for
    // doesn't contain them. That's a reasonable heuristics: most of the time,
    // ignoring them is the right thing to do and provides better results. But
    // sometimes, people want to search for them.
    const bool ignoreMnemonicsAmp = (text.Find(_T('&')) == wxNOT_FOUND);
    const bool ignoreMnemonicsUnderscore = (text.Find(_T('_')) == wxNOT_FOUND);

    m_position += dir;
    while (m_position >= 0 && m_position < cnt)
    {
        CatalogItem &dt = (*m_catalog)[m_listCtrl->ListIndexToCatalog(m_position)];

        if (inStr)
        {
            textc = dt.GetString();
            if (!caseSens)
                textc.MakeLower();
            if (ignoreMnemonicsAmp)
                textc.Replace("&", "");
            if (ignoreMnemonicsUnderscore)
                textc.Replace("_", "");
            if (TextInString(textc, text, wholeWords))
            {
                found = Found_InOrig;
                break;
            }
        }
        if (inTrans)
        {
            // concatenate all translations:
            unsigned cntTrans = dt.GetNumberOfTranslations();
            textc = wxEmptyString;
            for (unsigned i = 0; i < cntTrans; i++)
            {
                textc += dt.GetTranslation(i);
            }
            // and search for the substring in them:
            if (!caseSens)
                textc.MakeLower();
            if (ignoreMnemonicsAmp)
                textc.Replace("&", "");
            if (ignoreMnemonicsUnderscore)
                textc.Replace("_", "");

            if (TextInString(textc, text, wholeWords)) { found = Found_InTrans; break; }
        }
        if (inComments)
        {
            textc = dt.GetComment();
            if (!caseSens)
                textc.MakeLower();

            if (TextInString(textc, text, wholeWords)) { found = Found_InComments; break; }
        }
        if (inAutoComments)
        {
            wxArrayString autoComments = dt.GetAutoComments();
            textc = wxEmptyString;
            for (unsigned i = 0; i < autoComments.GetCount(); i++)
                textc += autoComments[i];

            if (!caseSens)
                textc.MakeLower();

            if (TextInString(textc, text, wholeWords)) { found = Found_InAutoComments; break; }
        }

        m_position += dir;
    }

    if (found != Found_Not)
    {
        m_listCtrl->EnsureVisible(m_position);
#ifdef __WXMAC__
        m_listCtrl->Refresh();
#endif
        m_listCtrl->Select(m_position);
        m_listCtrl->SetItemState(m_position,
                    wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);

        // find the text on the control and select it:

        wxTextCtrl* txt = NULL;
        switch (found)
        {
            case Found_InOrig:
              txt = m_textCtrlOrig;
              break;
            case Found_InTrans:
              txt = m_textCtrlTrans;
              break;
            case Found_InComments:
              txt = m_textCtrlComments;
              break;
            case Found_InAutoComments:
              txt = m_textCtrlAutoComments;
              break;
            case Found_Not: // silence compiler warning, can't get here
              break;
        }

        textc = txt->GetValue();
        if (!caseSens)
            textc.MakeLower();
        int pos = textc.Find(text);
        if (pos != wxNOT_FOUND)
            txt->SetSelection(pos, pos + text.length());

        return true;
    }

    m_position = posOrig;
    return false;
}
bool COptionsPageLanguage::OnDisplayedFirstTime()
{
	wxListBox* pListBox = XRCCTRL(*this, "ID_LANGUAGES", wxListBox);
	if (!pListBox)
		return false;

	wxString currentLanguage = m_pOptions->GetOption(OPTION_LANGUAGE);

	pListBox->Clear();

	const wxString defaultName = _("Default system language");
	int n = pListBox->Append(defaultName);
	if (currentLanguage == _T(""))
		pListBox->SetSelection(n);

	m_locale.push_back(_locale_info());
	m_locale.back().code = _T("en");
	m_locale.back().name = _T("English");

	wxString localesDir = wxGetApp().GetLocalesDir();
	if (localesDir == _T("") || !wxDir::Exists(localesDir))
	{
		pListBox->GetContainingSizer()->Layout();
		return true;
	}

	wxDir dir(localesDir);
	wxString locale;
	for (bool found = dir.GetFirst(&locale); found; found = dir.GetNext(&locale))
	{
		if (!wxFileName::FileExists(localesDir + locale + _T("/filezilla.mo")))
		{
			if (!wxFileName::FileExists(localesDir + locale + _T("/LC_MESSAGES/filezilla.mo")))
				continue;
		}

		wxString name;
		const wxLanguageInfo* pInfo = wxLocale::FindLanguageInfo(locale);
		if (!pInfo)
			continue;
		if (pInfo->Description != _T(""))
			name = pInfo->Description;
		else
			name = locale;

		m_locale.push_back(_locale_info());
		m_locale.back().code = locale;
		m_locale.back().name = name;
	}

	std::sort(m_locale.begin(), m_locale.end(), compareLangAsc);

	std::vector<struct _locale_info>::const_iterator iter;
	for (iter = m_locale.begin(); iter != m_locale.end(); ++iter)
	{
		n = pListBox->Append(iter->name + _T(" (") + iter->code + _T(")"));
		if (iter->code == currentLanguage)
			pListBox->SetSelection(n);
	}
	pListBox->GetContainingSizer()->Layout();

	return true;
}
void COptionsPageSizeFormatting::UpdateControls()
{
	const int format = GetFormat();
	XRCCTRL(*this, "ID_SIZEFORMAT_DECIMALPLACES", wxSpinCtrl)->Enable(format != 0);
}
Example #25
0
void PreferencesDialog::TransferFrom(wxConfigBase *cfg)
{
    cfg->Write(_T("translator_name"),
               XRCCTRL(*this, "user_name", wxTextCtrl)->GetValue());
    cfg->Write(_T("translator_email"),
               XRCCTRL(*this, "user_email", wxTextCtrl)->GetValue());
    cfg->Write(_T("compile_mo"),
               XRCCTRL(*this, "compile_mo", wxCheckBox)->GetValue());
    cfg->Write(_T("show_summary"),
               XRCCTRL(*this, "show_summary", wxCheckBox)->GetValue());
    cfg->Write(_T("manager_startup"),
               XRCCTRL(*this, "manager_startup", wxCheckBox)->GetValue());
    cfg->Write(_T("focus_to_text"),
               XRCCTRL(*this, "focus_to_text", wxCheckBox)->GetValue());
    cfg->Write(_T("comment_window_editable"),
               XRCCTRL(*this, "comment_window_editable", wxCheckBox)->GetValue());
    cfg->Write(_T("keep_crlf"),
               XRCCTRL(*this, "keep_crlf", wxCheckBox)->GetValue());
#ifdef USE_SPELLCHECKING
    cfg->Write(_T("enable_spellchecking"),
               XRCCTRL(*this, "enable_spellchecking", wxCheckBox)->GetValue());
#endif

    wxFont listFont = XRCCTRL(*this, "font_list", wxFontPickerCtrl)->GetSelectedFont();
    wxFont textFont = XRCCTRL(*this, "font_text", wxFontPickerCtrl)->GetSelectedFont();

    cfg->Write(_T("custom_font_list_use"),
               listFont.IsOk() && XRCCTRL(*this, "use_font_list", wxCheckBox)->GetValue());
    cfg->Write(_T("custom_font_text_use"),
               textFont.IsOk() && XRCCTRL(*this, "use_font_text", wxCheckBox)->GetValue());
    if ( listFont.IsOk() )
        cfg->Write(_T("custom_font_list_name"), listFont.GetNativeFontInfoDesc());
    if ( textFont.IsOk() )
        cfg->Write(_T("custom_font_text_name"), textFont.GetNativeFontInfoDesc());

    static const wxChar *formats[] = { _T("unix"), _T("win") };
    cfg->Write(_T("crlf_format"), formats[
                   XRCCTRL(*this, "crlf_format", wxChoice)->GetSelection()]);

    m_parsers.Write(cfg);

#ifdef USE_TRANSMEM
    wxArrayString langs;
    XRCCTRL(*this, "tm_langs", wxEditableListBox)->GetStrings(langs);
    wxString languages;
    for (size_t i = 0; i < langs.GetCount(); i++)
    {
        if (i != 0) languages << _T(':');
        languages << langs[i];
    }
    cfg->Write(_T("TM/languages"), languages);
    cfg->Write(_T("TM/max_omitted"),
               (long)XRCCTRL(*this, "tm_omits", wxSpinCtrl)->GetValue());
    cfg->Write(_T("TM/max_delta"),
               (long)XRCCTRL(*this, "tm_delta", wxSpinCtrl)->GetValue());
    cfg->Write(_T("use_tm_when_updating"),
               XRCCTRL(*this, "tm_automatic", wxCheckBox)->GetValue());
#endif

#ifdef USE_SPARKLE
    UserDefaults_SetBoolValue("SUEnableAutomaticChecks",
                              XRCCTRL(*this, "auto_updates", wxCheckBox)->GetValue());
#endif // USE_SPARKLE
#ifdef __WXMSW__
    win_sparkle_set_automatic_check_for_updates(
        XRCCTRL(*this, "auto_updates", wxCheckBox)->GetValue());
#endif
}
SimulationWindow::SimulationWindow(wxWindow *parent) :
	m_threadCondition(m_threadMutex),
	m_controlInterface(this),
	m_started(false),
	m_simulationTimer(this, 1),
	m_drawTimer(this, 2)
{
	srand(time(nullptr));

	// initialize XRC elements..
	wxXmlResource::Get()->LoadFrame(this, parent, wxT("SimulationWindow"));

	wxPanel * p = XRCCTRL(*this, "m_topPanel", wxPanel);

	XRC_INIT(m_joy1_enable, wxCheckBox);

	INIT_JOY(1_x)
	INIT_JOY(1_y)
	INIT_JOY(1_z)
	INIT_JOY(1_t)
	
	m_joy1_x->SetReadOnly(true);
	m_joy1_y->SetReadOnly(true);
	m_joy1_z->SetReadOnly(true);
	m_joy1_t->SetReadOnly(true);

	XRC_INIT(m_joy1_1, wxCheckBox);
	XRC_INIT(m_joy1_2, wxCheckBox);
	XRC_INIT(m_joy1_3, wxCheckBox);
	XRC_INIT(m_joy1_4, wxCheckBox);

	INIT_JOY(2_x)
	INIT_JOY(2_y)
	INIT_JOY(2_z)
	INIT_JOY(2_t)

	XRC_INIT(m_joy2_1, wxCheckBox);
	XRC_INIT(m_joy2_2, wxCheckBox);
	XRC_INIT(m_joy2_3, wxCheckBox);
	XRC_INIT(m_joy2_4, wxCheckBox);

	XRC_INIT(m_ds_i_1, wxCheckBox);
	XRC_INIT(m_ds_i_2, wxCheckBox);
	XRC_INIT(m_ds_i_3, wxCheckBox);
	XRC_INIT(m_ds_i_4, wxCheckBox);
	XRC_INIT(m_ds_i_5, wxCheckBox);
	XRC_INIT(m_ds_i_6, wxCheckBox);
	XRC_INIT(m_ds_i_7, wxCheckBox);
	XRC_INIT(m_ds_i_8, wxCheckBox);

	INIT_DS_ANALOG(1)
	INIT_DS_ANALOG(2)
	INIT_DS_ANALOG(3)
	INIT_DS_ANALOG(4)

	XRC_INIT(m_stepText, wxTextCtrl);
	
	XRC_INIT(m_startButton, wxButton);
	XRC_INIT(m_statusBar, wxStatusBar);
	
	XRC_INIT(m_enabledBox, wxCheckBox);
	XRC_INIT(m_autonomousBox, wxCheckBox);

	XRC_INIT(m_lcdTop, wxTextCtrl);
	XRC_INIT(m_lcdBottom, wxTextCtrl);
	
	// setup validation
	m_stepText->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
	
	// statusbar
	m_statusBar->SetFieldsCount(2);
	m_statusBar->SetStatusText(wxT("Stopped"), 0);
	m_statusBar->SetStatusText(wxT("0.0s"), 1);

	// initialize analog inputs
	wxXmlResource * xmlRes = wxXmlResource::Get();

	// slot 1
	for (int i = 0; i < ANALOG_IO_CHANNELS; i++)
	{
		m_slot1Analog[i] = new Slider(p, wxID_ANY, 0, 5, false);
		xmlRes->AttachUnknownControl(
			wxString::Format(wxT("m_analog_1_%d"), i+1), 
			m_slot1Analog[i], p);
	}

	// slot 2
	for (int i = 0; i < ANALOG_IO_CHANNELS; i++)
	{
		m_slot2Analog[i] = new Slider(p, wxID_ANY, 0, 5, false);
		xmlRes->AttachUnknownControl(
			wxString::Format(wxT("m_analog_2_%d"), i+1), 
			m_slot2Analog[i], p);
	}


	// initialize pwm outputs

	// slot 4
	for (int i = 0; i < DIGITAL_PWM_CHANNELS; i++)
	{
		m_slot1PWM[i] = new Slider(p, wxID_ANY, -1, 1, true);
		xmlRes->AttachUnknownControl(
			wxString::Format(wxT("m_pwm_1_%d"), i+1), 
			m_slot1PWM[i], p);
	}

	// slot 6
	// HAHAHAHAHAHAHAHAHAAHAHAHAAHAH
	// I'd been trying to fix this assert error for HOURS
	// and then I realized: size_t = long on Linux
	for (int i = 0; i < DIGITAL_PWM_CHANNELS; i++)
	{
		m_slot2PWM[i] = new Slider(p, wxID_ANY, -1, 1, true);
		xmlRes->AttachUnknownControl(
			wxString::Format(wxT("m_pwm_2_%d"), i+1), 
			m_slot2PWM[i], p);
	}
	
	// slot 8 (solenoids)
	for (int i = 0; i < SOLENOID_IO_CHANNELS; i++)
	{
		m_solenoids[i] = new TogglePanelButton(p, wxID_ANY);
		m_solenoids[i]->SetReadOnly(true);
		xmlRes->AttachUnknownControl(
			wxString::Format(wxT("m_sol_%d"), i+1), 
			m_solenoids[i], p);
	}
	

	// initialize digital channels

	// slot 4
	for (int i = 0; i < DIGITAL_IO_CHANNELS; i++)
	{
		m_slot1DIO[i] = new TogglePanelButton(p, wxID_ANY);
		xmlRes->AttachUnknownControl(
			wxString::Format(wxT("m_dio_1_%d"), i+1), 
			m_slot1DIO[i], p);

		m_slot1DIO_lbl[i] = wxStaticCast(FindWindow(xmlRes->GetXRCID(wxString::Format(wxT("m_diol_1_%d"), i+1))), 
			wxStaticText);
	}

	// slot 6
	for (int i = 0; i < DIGITAL_IO_CHANNELS; i++)
	{
		m_slot2DIO[i] = new TogglePanelButton(p, wxID_ANY);
		xmlRes->AttachUnknownControl(
			wxString::Format(wxT("m_dio_2_%d"), i+1), 
			m_slot2DIO[i], p);

		m_slot2DIO_lbl[i] = wxStaticCast(FindWindow(xmlRes->GetXRCID(wxString::Format(wxT("m_diol_2_%d"), i+1))), 
			wxStaticText);
	}


	p->Fit();
	p->Layout();

	Layout();

	// initialize the simulation thread
	BeginSimulation();
	
	// anything else that needs to be done

	m_joystick1.SetCapture(this);

	// try to update regularly
	m_drawTimer.Start(150);
}
Example #27
0
bool PreferencesDialog::EditParser(int num)
{
    wxDialog dlg;

    wxXmlResource::Get()->LoadDialog(&dlg, this, _T("edit_parser"));
    dlg.Centre();

    Parser& nfo = m_parsers[num];
    XRCCTRL(dlg, "parser_language", wxTextCtrl)->SetValue(nfo.Name);
    XRCCTRL(dlg, "parser_extensions", wxTextCtrl)->SetValue(nfo.Extensions);
    XRCCTRL(dlg, "parser_command", wxTextCtrl)->SetValue(nfo.Command);
    XRCCTRL(dlg, "parser_keywords", wxTextCtrl)->SetValue(nfo.KeywordItem);
    XRCCTRL(dlg, "parser_files", wxTextCtrl)->SetValue(nfo.FileItem);
    XRCCTRL(dlg, "parser_charset", wxTextCtrl)->SetValue(nfo.CharsetItem);

    if (dlg.ShowModal() == wxID_OK)
    {
        nfo.Name = XRCCTRL(dlg, "parser_language", wxTextCtrl)->GetValue();
        nfo.Extensions = XRCCTRL(dlg, "parser_extensions", wxTextCtrl)->GetValue();
        nfo.Command = XRCCTRL(dlg, "parser_command", wxTextCtrl)->GetValue();
        nfo.KeywordItem = XRCCTRL(dlg, "parser_keywords", wxTextCtrl)->GetValue();
        nfo.FileItem = XRCCTRL(dlg, "parser_files", wxTextCtrl)->GetValue();
        nfo.CharsetItem = XRCCTRL(dlg, "parser_charset", wxTextCtrl)->GetValue();
        XRCCTRL(*this, "parsers_list", wxListBox)->SetString(num, nfo.Name);
        return true;
    }
    else
        return false;
}
NewFromTemplateDlg::~NewFromTemplateDlg()
{
	//dtor
    delete XRCCTRL(*this, "listProjects", wxListCtrl)->GetImageList(wxIMAGE_LIST_NORMAL);
    delete XRCCTRL(*this, "listTargets", wxListCtrl)->GetImageList(wxIMAGE_LIST_NORMAL);
    delete XRCCTRL(*this, "listFiles", wxListCtrl)->GetImageList(wxIMAGE_LIST_NORMAL);
    delete XRCCTRL(*this, "listCustoms", wxListCtrl)->GetImageList(wxIMAGE_LIST_NORMAL);

    XRCCTRL(*this, "listProjects", wxListCtrl)->SetImageList(0, wxIMAGE_LIST_NORMAL);
    XRCCTRL(*this, "listProjects", wxListCtrl)->SetImageList(0, wxIMAGE_LIST_SMALL);
    XRCCTRL(*this, "listTargets", wxListCtrl)->SetImageList(0, wxIMAGE_LIST_NORMAL);
    XRCCTRL(*this, "listTargets", wxListCtrl)->SetImageList(0, wxIMAGE_LIST_SMALL);
    XRCCTRL(*this, "listFiles", wxListCtrl)->SetImageList(0, wxIMAGE_LIST_NORMAL);
    XRCCTRL(*this, "listFiles", wxListCtrl)->SetImageList(0, wxIMAGE_LIST_SMALL);
    XRCCTRL(*this, "listCustoms", wxListCtrl)->SetImageList(0, wxIMAGE_LIST_NORMAL);
    XRCCTRL(*this, "listCustoms", wxListCtrl)->SetImageList(0, wxIMAGE_LIST_SMALL);

	ClearList();
}
void WorkspaceBrowserF::UpdateSash()
{
    int pos = Manager::Get()->GetConfigManager(_T("fortran_project"))->ReadInt(_T("/splitter_pos"), 250);
    XRCCTRL(*this, "splitterWinWBF", wxSplitterWindow)->SetSashPosition(pos, false);
}
Example #30
0
wxString AddTodoDlg::GetType() const
{
    return XRCCTRL(*this, "chcType", wxChoice)->GetStringSelection();
}