void MemoryView::OnUpdate(wxCommandEvent& e) { static wxRegEx reHex(wxT("[0][x][0-9a-fA-F][0-9a-fA-F]")); // extract the text memory from the text control and pass it to the debugger wxString memory; wxArrayString lines = wxStringTokenize(m_textCtrlMemory->GetValue(), wxT("\n"), wxTOKEN_STRTOK); for (size_t i=0; i<lines.GetCount(); i++) { wxString line = lines.Item(i).AfterFirst(wxT(':')).BeforeFirst(wxT(':')).Trim().Trim(false); wxArrayString hexValues = wxStringTokenize(line, wxT(" "), wxTOKEN_STRTOK); for (size_t y=0; y<hexValues.GetCount(); y++) { wxString hex = hexValues.Item(y); if (reHex.Matches( hex ) && hex.Len() == 4) { // OK continue; } else { wxMessageBox(wxString::Format(_("Invalid memory value: %s"), hex), _("CodeLite"), wxICON_WARNING|wxOK); // update the pane to old value ManagerST::Get()->UpdateDebuggerPane(); return; } } if (line.IsEmpty() == false) { memory << line << wxT(" "); } } // set the new memory memory = memory.Trim().Trim(false); ManagerST::Get()->SetMemory(m_textCtrlExpression->GetValue(), GetSize(), memory); // update the view ManagerST::Get()->UpdateDebuggerPane(); }
void PWSGridTable::RestoreSettings(void) const { wxString colShown = towxstring(PWSprefs::GetInstance()->GetPref(PWSprefs::ListColumns)); wxString colWidths = towxstring(PWSprefs::GetInstance()->GetPref(PWSprefs::ColumnWidths)); wxArrayString colShownArray = wxStringTokenize(colShown, wxT(" \r\n\t,"), wxTOKEN_STRTOK); wxArrayString colWidthArray = wxStringTokenize(colWidths, wxT(" \r\n\t,"), wxTOKEN_STRTOK); if (colShownArray.Count() != colWidthArray.Count() || colShownArray.Count() == 0) return; //turn off all the columns first for(size_t n = 0; n < WXSIZEOF(PWSGridCellData); ++n) { PWSGridCellData[n].visible = false; } //now turn on the selected columns for( size_t idx = 0; idx < colShownArray.Count(); ++idx) { const int fieldType = wxAtoi(colShownArray[idx]); const int fieldWidth = wxAtoi(colWidthArray[idx]); for(size_t n = 0; n < WXSIZEOF(PWSGridCellData); ++n) { if (PWSGridCellData[n].ft == fieldType) { PWSGridCellData[n].visible = true; PWSGridCellData[n].width = fieldWidth; PWSGridCellData[n].position = idx; break; } } } }
void ConnectionParams::Deserialize(wxString configStr) { Valid = true; wxArrayString prms = wxStringTokenize( configStr, _T(";") ); if ( prms.Count() < 18 ) { Valid = false; return; //Old short format, we dump it } Type = (ConnectionType)wxAtoi(prms[0]); NetProtocol = (NetworkProtocol)wxAtoi(prms[1]); NetworkAddress = prms[2]; NetworkPort = (ConnectionType)wxAtoi(prms[3]); Protocol = (DataProtocol)wxAtoi(prms[4]); Port = prms[5]; Baudrate = wxAtoi(prms[6]); Wordlen = wxAtoi(prms[7]); Parity = (ParityType)wxAtoi(prms[8]); Stopbits = wxAtoi(prms[9]); RtsCts = !!wxAtoi(prms[10]); XonXoff = !!wxAtoi(prms[11]); EOS = (EOSType)wxAtoi(prms[12]); ChecksumCheck = !!wxAtoi(prms[13]); Output = !!wxAtoi(prms[14]); InputSentenceListType = (ListType)wxAtoi(prms[15]); InputSentenceList = wxStringTokenize(prms[16], _T(",")); OutputSentenceListType = (ListType)wxAtoi(prms[17]); if (prms.Count() > 18) //If the list is empty, the tokenizer does not produce array item OutputSentenceList = wxStringTokenize(prms[18], _T(",")); if (prms.Count() > 19) Priority = wxAtoi(prms[19]); }
void ConnectionParams::Deserialize(const wxString &configStr) { Valid = true; wxArrayString prms = wxStringTokenize( configStr, _T(";") ); if (prms.Count() < 17) { Valid = false; return; } Type = (ConnectionType)wxAtoi(prms[0]); NetProtocol = (NetworkProtocol)wxAtoi(prms[1]); NetworkAddress = prms[2]; NetworkPort = (ConnectionType)wxAtoi(prms[3]); Protocol = (DataProtocol)wxAtoi(prms[4]); Port = prms[5]; Baudrate = wxAtoi(prms[6]); ChecksumCheck = !!wxAtoi(prms[7]); int iotval = wxAtoi(prms[8]); IOSelect=((iotval <= 2)?static_cast <dsPortType>(iotval):DS_TYPE_INPUT); InputSentenceListType = (ListType)wxAtoi(prms[9]); InputSentenceList = wxStringTokenize(prms[10], _T(",")); OutputSentenceListType = (ListType)wxAtoi(prms[11]); OutputSentenceList = wxStringTokenize(prms[12], _T(",")); Priority = wxAtoi(prms[13]); Garmin = !!wxAtoi(prms[14]); GarminUpload = !!wxAtoi(prms[15]); FurunoGP3X = !!wxAtoi(prms[16]); bEnabled = true; if (prms.Count() >= 18) bEnabled = !!wxAtoi(prms[17]); }
void Web::ParseFile(wxString whaturl) { if(whaturl == "/KIKU/packages.txt") { wxString packageName(wxT("MSW")); #if defined(__WXGTK__) packageName = wxT("GTK"); #elif defined(__WXMAC__) packageName = wxT("MAC"); #endif wxArrayString lines = wxStringTokenize(m_dataRead, wxT("\n")); for (size_t i=0; i<lines.GetCount(); i++) { wxString line = lines.Item(i); line = line.Trim().Trim(false); if (line.StartsWith(wxT("#"))) { //comment line continue; } // parse the line wxArrayString tokens = wxStringTokenize(line, wxT("|")); if (tokens.GetCount() > 3) { // find the entry with our package name if (tokens.Item(0).Trim().Trim(false) == packageName) { wxString url = tokens.Item(2).Trim().Trim(false); wxString rev = tokens.Item(1).Trim().Trim(false); wxString releaseNotesUrl = tokens.Item(3).Trim().Trim(false); long currev; long webrev(0); // convert strings to long wxString sCurRev(VERSION); sCurRev.ToLong(&currev); wxString sUrlRev(rev); sUrlRev.ToLong(&webrev); //wxMessageBox(rev); if ( webrev > currev ) { // notify the user that a new version is available //e.SetClientData(new WebJobData(url.c_str(), releaseNotesUrl.c_str(), currev, webrev, false, m_userRequest)); wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, WEB_ID ); event.SetString(url); wxGetApp().AddPendingEvent( event ); //m_pHandler->OnWeb(url, releaseNotesUrl, currev, webrev); } break; } } } } }
wxArrayString Project::GetIncludePaths() { wxArrayString paths; BuildMatrixPtr matrix = WorkspaceST::Get()->GetBuildMatrix(); if(!matrix) { return paths; } wxString workspaceSelConf = matrix->GetSelectedConfigurationName(); wxString projectSelConf = matrix->GetProjectSelectedConf(workspaceSelConf, GetName()); BuildConfigPtr buildConf = WorkspaceST::Get()->GetProjBuildConf(this->GetName(), projectSelConf); // for non custom projects, take the settings from the build configuration if(buildConf && !buildConf->IsCustomBuild()) { // Get the include paths and add them wxString projectIncludePaths = buildConf->GetIncludePath(); wxArrayString projectIncludePathsArr = wxStringTokenize(projectIncludePaths, wxT(";"), wxTOKEN_STRTOK); for(size_t i=0; i<projectIncludePathsArr.GetCount(); i++) { wxFileName fn; if(projectIncludePathsArr.Item(i) == wxT("..")) { fn = wxFileName(GetFileName().GetPath(), wxT("")); fn.RemoveLastDir(); } else if(projectIncludePathsArr.Item(i) == wxT(".")) { fn = wxFileName(GetFileName().GetPath(), wxT("")); } else { fn = projectIncludePathsArr.Item(i); if(fn.IsRelative()) { fn.MakeAbsolute(GetFileName().GetPath()); } } paths.Add( fn.GetFullPath() ); } // get the compiler options and add them wxString projectCompileOptions = buildConf->GetCompileOptions(); wxArrayString projectCompileOptionsArr = wxStringTokenize(projectCompileOptions, wxT(";"), wxTOKEN_STRTOK); for(size_t i=0; i<projectCompileOptionsArr.GetCount(); i++) { wxString cmpOption (projectCompileOptionsArr.Item(i)); cmpOption.Trim().Trim(false); // expand backticks, if the option is not a backtick the value remains // unchanged wxArrayString includePaths = DoBacktickToIncludePath(cmpOption); if(includePaths.IsEmpty() == false) paths.insert(paths.end(), includePaths.begin(), includePaths.end()); } } return paths; }
void ChatOptionsTab::OnApply( wxCommandEvent& /*unused*/ ) { sett().SetChatColorNormal ( m_normal_color->GetColor() ); sett().SetChatColorBackground( m_bg_color->GetColor() ); sett().SetChatColorAction( m_action_color->GetColor() ); sett().SetChatColorHighlight( m_highlight_color->GetColor() ); sett().SetChatColorJoinPart( m_joinleave_color->GetColor() ); sett().SetChatColorNotification( m_note_color->GetColor() ); sett().SetChatColorMine( m_my_color->GetColor() ); sett().SetChatColorServer( m_server_color->GetColor() ); sett().SetChatColorClient( m_client_color->GetColor() ); sett().SetChatColorError( m_error_color->GetColor() ); sett().SetChatColorTime( m_ts_color->GetColor() ); sett().SetChatFont( m_chat_font ); sett().SetUseIrcColors( m_irc_colors->IsChecked() ); //m_ui.mw().GetChatTab().ChangeUnreadChannelColour( m_note_color->GetBackgroundColour() ); //m_ui.mw().GetChatTab().ChangeUnreadPMColour( m_note_color->GetBackgroundColour() ); sett().SetHighlightedWords( wxStringTokenize( m_highlight_words->GetValue(), _T( ";" ) ) ); sett().SetRequestAttOnHighlight( m_highlight_req->IsChecked() ); //Chat Log sett().SetChatLogEnable( m_save_logs->GetValue() ); sett().SetBroadcastEverywhere( m_broadcast_check->GetValue() ); // Behavior #ifndef DISABLE_SOUND sett().SetChatPMSoundNotificationEnabled( m_play_sounds->IsChecked() ); #endif sett().SetAutoloadedChatlogLinesCount( m_num_lines->GetValue() ); }
wxCoord ClueListBox::OnMeasureItem(size_t n) const { XPuzzle::Clue clue = GetItem(n); // Cache the wrapped clue's text if it isn't already if (m_cachedClues.at(n).empty()) { int maxWidth; GetClientSize(&maxWidth, NULL); m_cachedClues.at(n) = Wrap(this, clue.Text(), maxWidth - m_numWidth - GetMargins().x); } int height = 0; const wxArrayString lines = wxStringTokenize(m_cachedClues.at(n), _T("\n")); for (wxArrayString::const_iterator it = lines.begin(); it != lines.end(); ++it) { int lineHeight; GetTextExtent(*it, NULL, &lineHeight); height += lineHeight; } return height; }
void serverPage::AddToScript(wxString sLine) { wxArrayString multiLine = wxStringTokenize( sLine, wxT("\n") ); for (size_t x = 0 ; x < multiLine.size() ; x++) { m_sJScriptText.Add( multiLine[x] ); } }
wxXmlNode *Project::GetVirtualDir(const wxString &vdFullPath) { wxArrayString paths = wxStringTokenize( vdFullPath, ":", wxTOKEN_STRTOK ); // test the cache std::map<wxString, wxXmlNode*>::iterator iter = m_vdCache.find(vdFullPath); if(iter != m_vdCache.end()) { return iter->second; } wxString filename = m_fileName.GetFullPath(); wxXmlNode *parent = m_doc.GetRoot(); for(size_t i=0; i<paths.GetCount(); ++i) { wxString curpath = paths.Item(i); parent = XmlUtils::FindNodeByName(parent, wxT("VirtualDirectory"), curpath); if ( !parent ) { m_vdCache[vdFullPath] = NULL; return NULL; } } // cache the result m_vdCache[vdFullPath] = parent; return parent; }
bool VirtualDirectorySelectorDlg::SelectPath(const wxString& path) { wxTreeItemId item = m_treeCtrl->GetRootItem(); wxArrayString tokens = wxStringTokenize(path, wxT(":"), wxTOKEN_STRTOK); for (size_t i=0; i<tokens.GetCount(); i++) { if(item.IsOk() && m_treeCtrl->HasChildren(item)) { // loop over the children of this node, and search for a match wxTreeItemIdValue cookie; wxTreeItemId child = m_treeCtrl->GetFirstChild(item, cookie); while(child.IsOk()) { if(m_treeCtrl->GetItemText(child) == tokens.Item(i)) { item = child; break; } child = m_treeCtrl->GetNextChild(child, cookie); } } } if(item.IsOk()) { m_treeCtrl->EnsureVisible(item); m_treeCtrl->SelectItem(item); return true; } return false; }
wxArrayString QuickDebugDlg::GetStartupCmds() { wxString cmds = m_textCtrlCmds->GetValue(); cmds.Trim().Trim(false); return wxStringTokenize(cmds, wxT("\n\r"), wxTOKEN_STRTOK); }
void TagsOptionsDlg::Parse() { // Prepate list of files to work on wxArrayString files = wxStringTokenize(m_textCtrlFilesList->GetValue(), wxT(" \t"), wxTOKEN_STRTOK); wxArrayString searchPaths = GetCTagsSearchPaths(); wxArrayString fullpathsArr; for(size_t i = 0; i < files.size(); i++) { wxString file = files[i].Trim().Trim(false); if(file.IsEmpty()) continue; for(size_t xx = 0; xx < searchPaths.size(); xx++) { wxString fullpath; fullpath << searchPaths.Item(xx) << wxFileName::GetPathSeparator() << file; wxFileName fn(fullpath); if(fn.FileExists()) { fullpathsArr.Add(fn.GetFullPath()); break; } } } // Clear the PreProcessor table PPTable::Instance()->Clear(); for(size_t i = 0; i < fullpathsArr.size(); i++) PPScan(fullpathsArr.Item(i), true); // Open an editor and print out the results IEditor* editor = PluginManager::Get()->NewEditor(); if(editor) { editor->AppendText(PPTable::Instance()->Export()); CopyData(); EndModal(wxID_OK); } }
int main(int argc, char **argv) { //Initialize the wxWidgets library wxInitializer initializer; wxLog::EnableLogging(false); //parse the input wxCmdLineParser parser; parser.SetCmdLine(argc, argv); parser.SetDesc(cmdLineDesc); if (parser.Parse() != 0) { return -1; } for (size_t i=0; i< parser.GetParamCount(); i++) { wxString argument = parser.GetParam(i); if( !wxDir::Exists(argument) ){ argument.Replace(wxT("\\"), wxT("/")); wxArrayString arr = wxStringTokenize(argument, wxT("/"), wxTOKEN_STRTOK); wxString path; for(size_t i=0; i<arr.GetCount(); i++){ path << arr.Item(i) << wxT("/"); wxMkdir(path, 0777); } } } return 0; }
void SvnConsole::OnReadProcessOutput(wxCommandEvent& event) { ProcessEventData *ped = (ProcessEventData *)event.GetClientData(); if (ped) { m_output.Append(ped->GetData().c_str()); } wxString s (ped->GetData()); s.MakeLower(); if (m_currCmd.printProcessOutput) AppendText( ped->GetData() ); static wxRegEx reUsername("username[ \t]*:", wxRE_DEFAULT|wxRE_ICASE); wxArrayString lines = wxStringTokenize(s, wxT("\n"), wxTOKEN_STRTOK); if( !lines.IsEmpty() && lines.Last().StartsWith(wxT("password for '")) ) { m_output.Clear(); wxString pass = wxGetPasswordFromUser(ped->GetData(), wxT("Subversion")); if(!pass.IsEmpty() && m_process) { m_process->WriteToConsole(pass); } } else if ( !lines.IsEmpty() && reUsername.IsValid() && reUsername.Matches( lines.Last() ) ) { // Prompt the user for "Username:"******"Subversion"); if ( !username.IsEmpty() && m_process ) { m_process->Write(username + "\n"); } } delete ped; }
wxString ChangeLogPage::DoFormatLinesToUrl(const wxString& text, const wxString& pattern, const wxString& url) { wxRegEx re; DoMakeRegexFromPattern(pattern, re); wxString tmpPat = pattern.c_str(); tmpPat.Trim().Trim(false); if(re.IsValid() == false || tmpPat.IsEmpty()) { return text; } wxArrayString lines = wxStringTokenize(text, wxT("\n"), wxTOKEN_STRTOK); wxString out; for(size_t i=0; i<lines.size(); i++) { wxString line = lines.Item(i).Trim().Trim(false); if(re.Matches(line)) { wxString bugFrId = re.GetMatch(line, 1); // Convert the bugFrId into URLs wxArrayString urls = DoMakeBugFrIdToUrl(bugFrId, url); if(urls.IsEmpty() == false) { for(size_t y=0; y<urls.size(); y++) { out << urls.Item(y) << wxT("\n"); } } else { out << line << wxT("\n"); } } else { out << line << wxT("\n"); } } return out; }
wxString SvnLogHandler::Compact(const wxString& message) { wxString compactMsg (message); compactMsg.Replace(wxT("\r\n"), wxT("\n")); compactMsg.Replace(wxT("\r"), wxT("\n")); compactMsg.Replace(wxT("\v"), wxT("\n")); wxArrayString lines = wxStringTokenize(compactMsg, wxT("\n"), wxTOKEN_STRTOK); compactMsg.Clear(); for(size_t i=0; i<lines.GetCount(); i++) { wxString line = lines.Item(i); line.Trim().Trim(false); if(line.IsEmpty()) continue; if(line.StartsWith(wxT("----------"))) { continue; } if(line == wxT("\"")) { continue; } static wxRegEx reRevisionPrefix(wxT("^(r[0-9]+)")); if(reRevisionPrefix.Matches(line)) { continue; } compactMsg << line << wxT("\n"); } if(compactMsg.IsEmpty() == false) { compactMsg.RemoveLast(); } return compactMsg; }
void BatchBuildDlg::DoInitialize() { // load the previously saved batch build file wxFileName fn(WorkspaceST::Get()->GetWorkspaceFileName()); fn.SetExt(wxT("batch_build")); wxString content; wxArrayString arr; if (ReadFileWithConversion(fn.GetFullPath(), content)) { arr = wxStringTokenize(content, wxT("\n"), wxTOKEN_STRTOK); for (size_t i=0; i<arr.GetCount(); i++) { int idx = m_checkListConfigurations->Append(arr.Item(i)); m_checkListConfigurations->Check((unsigned int)idx); } } // loop over all projects, for each project collect all available // build configurations and add them to the check list control wxArrayString projects; WorkspaceST::Get()->GetProjectList(projects); for (size_t i=0; i<projects.GetCount(); i++) { ProjectPtr p = ManagerST::Get()->GetProject(projects.Item(i)); if (p) { ProjectSettingsPtr settings = p->GetSettings(); if (settings) { ProjectSettingsCookie cookie; BuildConfigPtr bldConf = settings->GetFirstBuildConfiguration(cookie); while (bldConf) { wxString item(p->GetName() + wxT(" | ") + bldConf->GetName()); int where = arr.Index(item); if (where == wxNOT_FOUND) { // append this item m_checkListConfigurations->Append(item); } else { // this item already been added, // remove it from the arr and continue arr.RemoveAt((size_t)where); } bldConf = settings->GetNextBuildConfiguration(cookie); } } } } // check to see which configuration was left in 'arr' // and remove them from the checklistbox for (size_t i=0; i<arr.GetCount(); i++) { int where = m_checkListConfigurations->FindString(arr.Item(i)); if (where != wxNOT_FOUND) { m_checkListConfigurations->Delete((unsigned int)where); } } arr.clear(); if (m_checkListConfigurations->GetCount()>0) { m_checkListConfigurations->Select(0); } }
void GitCommitDlg::AppendDiff(const wxString& diff) { wxArrayString diffList = wxStringTokenize(diff, wxT("\n"), wxTOKEN_STRTOK); unsigned index = 0; wxString currentFile; while(index < diffList.GetCount()) { wxString line = diffList[index]; if(line.StartsWith(wxT("diff"))) { line.Replace(wxT("diff --git a/"), wxT("")); currentFile = line.Left(line.Find(wxT(" "))); } else if(line.StartsWith(wxT("Binary"))) { m_diffMap[currentFile] = wxT("Binary diff"); } else { m_diffMap[currentFile].Append(line + wxT("\n")); } ++index; } index = 0; for(std::map<wxString, wxString>::iterator it = m_diffMap.begin(); it != m_diffMap.end(); ++it) { m_listBox->Append((*it).first); m_listBox->Check(index++, true); } if(m_diffMap.size() != 0) { std::map<wxString, wxString>::iterator it = m_diffMap.begin(); m_stcDiff->SetText((*it).second); m_listBox->Select(0); m_stcDiff->SetReadOnly(true); } }
void DbgGdb::OnDataRead(wxCommandEvent& e) { // Data arrived from the debugger ProcessEventData *ped = (ProcessEventData *)e.GetClientData(); wxString bufferRead; bufferRead << ped->GetData(); delete ped; wxArrayString lines = wxStringTokenize(bufferRead, wxT("\n"), wxTOKEN_STRTOK); for(size_t i=0; i<lines.GetCount(); i++) { wxString line = lines.Item(i); line.Replace(wxT("(gdb)"), wxT("")); line.Trim().Trim(false); if ( line.IsEmpty() == false ) { m_gdbOutputArr.Add( line ); //wxPrintf(wxT("Debugger: %s\n"), line.c_str()); } } if ( m_gdbOutputArr.IsEmpty() == false ) { // Trigger GDB processing Poke(); } }
void wxCairoSVGRadialGradient::Op(cairo_t* cairo_image, bool preserve, wxCairoSVGPaintServerOp op) { cairo_pattern_t *pat; bool saved = false; if (m_gradientUnits == _T("objectBoundingBox")) { cairo_save(cairo_image); saved = true; double minx; double miny; double maxx; double maxy; cairo_path_extents(cairo_image, &minx, &miny, &maxx, &maxy); cairo_matrix_t mat; cairo_matrix_init(&mat, maxx-minx, 0, 0, maxy-miny, minx, miny); cairo_transform(cairo_image, &mat); wxLogTrace(_T("svg"), _T("wxCairoSVGRadialGradient::Op transformed to objectBoundingBox minx %f miny %f maxx %f maxy %f"), minx, miny, maxx, maxy); } else if (m_gradientTransform.Contains(_T("matrix"))) { double m[6]; wxArrayString params = wxStringTokenize(m_gradientTransform.Mid(m_gradientTransform.Find(_T("matrix(")) + 7), _T(" ")); if (params.Count() == 6) { for (int i = 0; i < 6; i++) { params[i].Strip().ToDouble(&m[i]); } cairo_save(cairo_image); saved = true; cairo_matrix_t mat; cairo_matrix_init(&mat, m[0], m[1], m[2], m[3], m[4], m[5]); cairo_transform(cairo_image, &mat); wxLogTrace(_T("svg"), _T("wxCairoSVGRadialGradient::Op matrix transform %f %f %f %f %f %f"), m[0], m[1], m[2], m[3], m[4], m[5]); } } pat = cairo_pattern_create_radial(m_cx, m_cy, 0, m_cx, m_cy, m_r); wxLogTrace(_T("svg"), _T("wxCairoSVGRadialGradient::Op cairo_pattern_create_radial cx %f cy %f r %f"), m_cx, m_cy, m_r); for (wxCairoSVGGradientStopList::iterator i = m_stopList.begin(); i != m_stopList.end(); ++i) { wxCairoSVGGradientStop* stop = *i; if (stop->m_opacity == 1) { cairo_pattern_add_color_stop_rgb(pat, stop->m_offset, (double) stop->m_r / 255.0, (double) stop->m_g / 255.0, (double) stop->m_b / 255.0); } else { cairo_pattern_add_color_stop_rgba(pat, stop->m_offset, (double) stop->m_r / 255.0, (double) stop->m_g / 255.0, (double) stop->m_b / 255.0, stop->m_opacity); } } cairo_set_source(cairo_image, pat); wxCairoSVGPaintServer::Op(cairo_image, preserve, op); if (saved) cairo_restore(cairo_image); cairo_pattern_destroy(pat); wxLogTrace(_T("svg"), _T("wxCairoSVGRadialGradient::Op done")); }
void ConnectWindow::OnOk(wxCommandEvent&) { wxString HostAddress = m_server_combo->GetValue(); // We assume that the server is given as : "host:port" so we split based on ":" wxArrayString serverString = wxStringTokenize(HostAddress, _T(":")); if (serverString.GetCount() > 2) { OnLoginDenied(_T("invalid host/port.")); return; } if (serverString.GetCount() == 2) { long port; if (!serverString[1].ToLong(&port)) { OnLoginDenied(_T("Invalid port.")); return; } if (port < 1 || port > 65535) { OnLoginDenied(_T("Port number out of range.\n\nIt must be an integer between 1 and 65535")); return; } sett().SetServer(HostAddress, serverString[0], port); } sett().SetDefaultServer(HostAddress); cfg().Write(_T( "/Server/Autoconnect" ), m_autoconnect_check->IsChecked()); //if autoconnect enabled force saving of pw, actual saving is done in Ui::DoConnect sett().SaveSettings(); ReloadServerList(); if (m_tabs->GetSelection() <= 0) { //normal login sett().SetServerAccountNick(HostAddress, m_nick_text->GetValue()); sett().SetServerAccountSavePass(HostAddress, m_rpass_check->GetValue()); if (m_rpass_check->IsChecked()) { sett().SetServerAccountPass(HostAddress, m_pass_text->GetValue()); } CleanHide(); ServerManager::Instance()->DoConnectToServer(STD_STRING(HostAddress), STD_STRING(m_nick_text->GetValue()), STD_STRING(m_pass_text->GetValue())); return; } sett().SetServerAccountNick(HostAddress, m_regnick_text->GetValue()); if (m_rpass_check->IsChecked()) { sett().SetServerAccountPass(HostAddress, m_regpass1_text->GetValue()); } // register new nick if (!IsValidNickname(STD_STRING(m_regnick_text->GetValue()))) { OnRegistrationDenied(_("The entered nickname contains invalid characters like )? &%.\n Please try again")); return; } if (m_regpass2_text->GetValue() != m_regpass1_text->GetValue() || m_regpass1_text->GetValue().IsEmpty()) { OnRegistrationDenied(_("Registration failed, the reason was:\nPassword / confirmation mismatch (or empty passwort)")); return; } CleanHide(); ServerManager::Instance()->RegisterNewUser(STD_STRING(HostAddress), STD_STRING(m_regnick_text->GetValue()), STD_STRING(m_regpass1_text->GetValue())); }
FindFilesTraverser(const wxString types, const wxArrayString& ignorefiles, const wxArrayString& excludes, const wxString& projFP) : m_ignorefiles(ignorefiles) , m_excludes(excludes) , m_projFP(projFP) { m_types = wxStringTokenize(types, ";,|"); // The tooltip says use ';' but cover all bases }
void Copyright::OnBatchInsertCopyrights(wxCommandEvent& e) { // pop up the projects selection dialog if(m_mgr->IsWorkspaceOpen() == false) { wxMessageBox(_("Batch insert requires a workspace to be opened"), _("CodeLite"), wxICON_WARNING | wxOK); return; } if(!m_mgr->SaveAll()) return; // read configuration CopyrightsConfigData data; m_mgr->GetConfigTool()->ReadObject(wxT("CopyrightsConfig"), &data); wxString content; if(!Validate(content)) { return; } CopyrightsProjectSelDlg dlg(m_mgr->GetTheApp()->GetTopWindow(), m_mgr->GetWorkspace()); if(dlg.ShowModal() == wxID_OK) { wxArrayString projects; dlg.GetProjects(projects); // expand constants wxString err_msg; std::vector<wxFileName> files; std::vector<wxFileName> filtered_files; // loop over the project and collect list of files to work with for(size_t i = 0; i < projects.size(); i++) { ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(projects.Item(i), err_msg); if(p) { p->GetFiles(files, true); } } wxString mask(data.GetFileMasking()); mask.Replace(wxT("*."), wxEmptyString); mask = mask.Trim().Trim(false); wxArrayString exts = wxStringTokenize(mask, wxT(";")); // filter out non-matching files (according to masking) for(size_t i = 0; i < files.size(); i++) { if(exts.Index(files.at(i).GetExt(), false) != wxNOT_FOUND) { // valid file filtered_files.push_back(files.at(i)); } } if(filtered_files.empty() == false) { MassUpdate(filtered_files, content); } } }
void Copyright::OnProjectInsertCopyrights(wxCommandEvent& e) { // pop up the projects selection dialog if(m_mgr->IsWorkspaceOpen() == false) { wxMessageBox(_("Batch insert requires a workspace to be opened"), _("CodeLite"), wxICON_WARNING | wxOK); return; } if(!m_mgr->SaveAll()) return; // read configuration CopyrightsConfigData data; m_mgr->GetConfigTool()->ReadObject(wxT("CopyrightsConfig"), &data); wxString content; if(!Validate(content)) { return; } // get the project to work on TreeItemInfo info = m_mgr->GetSelectedTreeItemInfo(TreeFileView); wxString project_name = info.m_text; wxString err_msg; std::vector<wxFileName> files; std::vector<wxFileName> filtered_files; // loop over the project and collect list of files to work with ProjectPtr p = m_mgr->GetWorkspace()->FindProjectByName(project_name, err_msg); if(!p) { return; } p->GetFiles(files, true); // filter non matched files wxString mask(data.GetFileMasking()); mask.Replace(wxT("*."), wxEmptyString); mask = mask.Trim().Trim(false); wxArrayString exts = wxStringTokenize(mask, wxT(";")); // filter out non-matching files (according to masking) for(size_t i = 0; i < files.size(); i++) { if(exts.Index(files.at(i).GetExt(), false) != wxNOT_FOUND) { // valid file filtered_files.push_back(files.at(i)); } } // update files if(filtered_files.empty() == false) { MassUpdate(filtered_files, content); } }
bool OutputViewControlBar::DoFindDockInfo(const wxString &saved_perspective, const wxString &dock_name, wxString &dock_info) { // search for the 'Output View' perspective wxArrayString panes = wxStringTokenize(saved_perspective, wxT("|"), wxTOKEN_STRTOK); for (size_t i=0; i<panes.GetCount(); i++) { if ( panes.Item(i).StartsWith(dock_name) ) { dock_info = panes.Item(i); return true; } } return false; }
std::map<wxString,wxString> TagsOptionsData::GetTypesMap() const { std::map<wxString, wxString> tokens; wxArrayString typesArr = wxStringTokenize(m_types, wxT("\r\n"), wxTOKEN_STRTOK); for (size_t i=0; i<typesArr.GetCount(); i++) { wxString item = typesArr.Item(i).Trim().Trim(false); wxString k = item.BeforeFirst(wxT('=')); wxString v = item.AfterFirst(wxT('=')); tokens[k] = v; } return tokens; }
void CppCheckSettings::LoadProjectSpecificSettings(ProjectPtr project) { wxString rawData; wxArrayString definitions, undefines; if(project) { rawData = project->GetPluginData("CppCheck"); } wxArrayString configurations = wxStringTokenize(rawData, ";", wxTOKEN_RET_EMPTY_ALL); if(configurations.GetCount() == 2) { // It'll either be empty or 2 if(!configurations.Item(0).empty()) { definitions = wxStringTokenize(configurations.Item(0), ","); } if(!configurations.Item(1).empty()) { undefines = wxStringTokenize(configurations.Item(1), ","); } } // Note that we set these even if project == NULL, as this will clear any stale values SetDefinitions(definitions); SetUndefines(undefines); }
static wxPoint StringToPoint(const wxString & str) { wxArrayString tokens = wxStringTokenize(str, _T(", "), wxTOKEN_STRTOK); long x, y; if (tokens.size() != 2 || ! (tokens[0].ToLong(&x) && tokens[1].ToLong(&y)) ) { throw ConversionError(); } return wxPoint(x, y); }
void SubversionLocalProperties::ReadProperties() { m_values.clear(); wxString group; wxFFile fp(GetConfigFile(), wxT("rb")); if(fp.IsOpened()) { wxString content; fp.ReadAll(&content); wxArrayString lines = wxStringTokenize(content, wxT("\n"), wxTOKEN_STRTOK); for(size_t i = 0; i < lines.size(); i++) { wxString entry = lines[i]; // remove the comment part entry = entry.BeforeFirst(wxT(';')); // trim the string entry.Trim().Trim(false); if(entry.IsEmpty()) continue; if(entry.StartsWith(wxT("["))) { // found new group entry = entry.AfterFirst(wxT('[')); group = entry.BeforeFirst(wxT(']')); group.Trim().Trim(false); continue; } wxString key = entry.BeforeFirst(wxT('=')); wxString value = entry.AfterFirst(wxT('=')); key.Trim().Trim(false); value.Trim().Trim(false); if(group.IsEmpty()) { // we dont have group yet - discard this entry continue; } GroupTable::iterator iter = m_values.find(group); if(iter == m_values.end()) { // create new table and the value SimpleTable tb; tb[key] = value; m_values[group] = tb; } else { m_values[group][key] = value; } } } }