void ToDoListView::FillList() { control->Freeze(); Clear(); m_Items.Clear(); TodoItemsMap::iterator it; if (m_pSource->GetSelection()==0) // Single file { wxString filename(wxEmptyString); cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(Manager::Get()->GetEditorManager()->GetActiveEditor()); if (ed) filename = ed->GetFilename(); for (unsigned int i = 0; i < m_ItemsMap[filename].size(); i++) m_Items.Add(m_ItemsMap[filename][i]); } else { for (it = m_ItemsMap.begin();it != m_ItemsMap.end();++it) { for (unsigned int i = 0; i < it->second.size(); i++) m_Items.Add(it->second[i]); } } SortList(); FillListControl(); control->Thaw(); LoadUsers(); }
AddTodoDlg::AddTodoDlg(wxWindow* parent, wxArrayString& types) : m_Types(types) { wxXmlResource::Get()->LoadDialog(this, parent, _T("dlgAddToDo")); LoadUsers(); // load types wxChoice* cmb = XRCCTRL(*this, "chcType", wxChoice); cmb->Clear(); for (unsigned int i = 0; i < m_Types.GetCount(); ++i) { cmb->Append(m_Types[i]); } if (m_Types.Index(_T("TODO")) == wxNOT_FOUND) cmb->Append(_T("TODO")); if (m_Types.Index(_T("@todo")) == wxNOT_FOUND) cmb->Append(_T("@todo")); if (m_Types.Index(_T("\\todo")) == wxNOT_FOUND) cmb->Append(_T("\\todo")); if (m_Types.Index(_T("FIXME")) == wxNOT_FOUND) cmb->Append(_T("FIXME")); if (m_Types.Index(_T("NOTE")) == wxNOT_FOUND) cmb->Append(_T("NOTE")); if (m_Types.Index(_T("@note")) == wxNOT_FOUND) cmb->Append(_T("@note")); if (m_Types.Index(_T("\\note")) == wxNOT_FOUND) cmb->Append(_T("\\note")); wxString lastType = Manager::Get()->GetConfigManager(_T("todo_list"))->Read(_T("last_used_type")); wxString lastStyle = Manager::Get()->GetConfigManager(_T("todo_list"))->Read(_T("last_used_style")); wxString lastPos = Manager::Get()->GetConfigManager(_T("todo_list"))->Read(_T("last_used_position")); if (!lastType.IsEmpty()) { int sel = cmb->FindString(lastType); if (sel != -1) cmb->SetSelection(sel); } else cmb->SetSelection(0); cmb = XRCCTRL(*this, "chcStyle", wxChoice); if (!lastStyle.IsEmpty()) { int sel = cmb->FindString(lastStyle); if (sel != -1) cmb->SetSelection(sel); } cmb = XRCCTRL(*this, "chcPosition", wxChoice); if (!lastPos.IsEmpty()) { int sel = cmb->FindString(lastPos); if (sel != -1) cmb->SetSelection(sel); } }
void ToDoList::OnAttach() { // create ToDo in bottom view wxArrayString titles; wxArrayInt widths; titles.Add(_("Type")); widths.Add(64); titles.Add(_("Text")); widths.Add(320); titles.Add(_("User")); widths.Add(64); titles.Add(_("Prio")); widths.Add(48); titles.Add(_("Line")); widths.Add(48); titles.Add(_("Date")); widths.Add(56); titles.Add(_("File")); widths.Add(640); m_pListLog = new ToDoListView(titles, widths, m_Types); m_StandAlone = Manager::Get()->GetConfigManager(_T("todo_list"))->ReadBool(_T("stand_alone"), true); if (!m_StandAlone) { LogManager* msgMan = Manager::Get()->GetLogManager(); m_ListPageIndex = msgMan->SetLog(m_pListLog); msgMan->Slot(m_ListPageIndex).title = _("To Do"); CodeBlocksLogEvent evt(cbEVT_ADD_LOG_WINDOW, m_pListLog, msgMan->Slot(m_ListPageIndex).title, msgMan->Slot(m_ListPageIndex).icon); Manager::Get()->ProcessEvent(evt); } else { m_pListLog->CreateControl(Manager::Get()->GetAppWindow()); m_pListLog->GetWindow()->SetSize(wxSize(352,94)); m_pListLog->GetWindow()->SetInitialSize(wxSize(352,94)); CodeBlocksDockEvent evt(cbEVT_ADD_DOCK_WINDOW); evt.name = _T("TodoListPanev2.0.0"); evt.title = _("Todo list"); evt.pWindow = m_pListLog->GetWindow(); evt.dockSide = CodeBlocksDockEvent::dsFloating; evt.desiredSize.Set(352, 94); evt.floatingSize.Set(352, 94); evt.minimumSize.Set(352, 94); Manager::Get()->ProcessEvent(evt); } m_AutoRefresh = Manager::Get()->GetConfigManager(_T("todo_list"))->ReadBool(_T("auto_refresh"), true); LoadUsers(); LoadTypes(); // register event sink Manager::Get()->RegisterEventSink(cbEVT_APP_STARTUP_DONE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnAppDoneStartup)); Manager::Get()->RegisterEventSink(cbEVT_EDITOR_OPEN, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparseCurrent)); Manager::Get()->RegisterEventSink(cbEVT_EDITOR_SAVE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparseCurrent)); Manager::Get()->RegisterEventSink(cbEVT_EDITOR_ACTIVATED, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparseCurrent)); Manager::Get()->RegisterEventSink(cbEVT_EDITOR_CLOSE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparseCurrent)); Manager::Get()->RegisterEventSink(cbEVT_PROJECT_CLOSE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparse)); Manager::Get()->RegisterEventSink(cbEVT_PROJECT_ACTIVATE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparse)); Manager::Get()->RegisterEventSink(cbEVT_PROJECT_FILE_ADDED, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparse)); Manager::Get()->RegisterEventSink(cbEVT_PROJECT_FILE_REMOVED, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparse)); }
bool OnLoad(const CString& sArgsi, CString& sMessage) override { switch (GetType()) { case CModInfo::GlobalModule: LoadUsers(); break; case CModInfo::UserModule: LoadUser(GetUser()); break; case CModInfo::NetworkModule: LoadNetwork(GetNetwork()); break; } return true; }
void CAdminDlg::OnAdd() { // TODO: Add your control notification handler code here CUserDlg dlg; dlg.m_Add = true; dlg.m_Super = curgroup; if (dlg.DoModal()==IDCANCEL) return; CChangePasDlg pas; pas.m_First = true; if(pas.DoModal()==IDCANCEL) { return; } _UInfo TempInfo; memset(&TempInfo, 0, sizeof(_UInfo)); TempInfo.Active = true; TempInfo.Type = dlg.m_Super; if (TempInfo.Type == UT_ADMIN) { DWORD TempType = 0; if (dlg.m_Change) TempType = AT_CREATE; if (dlg.m_Tarif) TempType |= AT_TARIF; if (dlg.m_Com) TempType |= AT_SETUP; if (dlg.m_Holiday) TempType |= AT_HOLIDAY; if (dlg.m_Manage) { TempType |= AT_MANAGE; DWORD TempMenage = 0; if (dlg.m_Unblock) TempMenage |= MT_UNBLOCK; if (dlg.m_Block) TempMenage |= MT_BLOCK; if (dlg.m_Reboot) TempMenage |= MT_REBOOT; if (dlg.m_Shutdown) TempMenage |= MT_SHUTDOWN; if (dlg.m_InetOn) TempMenage |= MT_INETON; if (dlg.m_InetOff) TempMenage |= MT_INETOFF; TempType |= TempMenage; }; TempInfo.Admin = TempType; } strcpy(TempInfo.Creator, UInfo.Fio); strcpy(TempInfo.Fio, dlg.m_Fio); memcpy(&TempInfo.Hash, &pas.m_Hash, 16); CUserInfo *user = new CUserInfo(&TempInfo); Users[dlg.m_Id] = user; LoadUsers(); m_Tree.Expand(groups[TempInfo.Type], TVE_EXPAND); }
BOOL CAdminDlg::OnInitDialog() { CDialog::OnInitDialog(); if (!img.GetSafeHandle()) { img.Create(16,16,ILC_COLOR, 2,2); img.Add(AfxGetApp()->LoadIcon(IDI_GROUP)); img.Add(AfxGetApp()->LoadIcon(IDI_USER)); img.Add(AfxGetApp()->LoadIcon(IDI_BADUSER)); } LoadUsers(); ChangeButtons(); m_Tree.Expand(groups[0], TVE_COLLAPSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
int main(int argc, char **argv) { char text[256]; int i; #ifdef _WIN32 HMODULE hLib; WSADATA wsadata; WSAStartup(0x0202, &wsadata); InitUptimePerfCounter(); hLib = LoadLibrary("advapi32.dll"); if (hLib) lpfnRtlGenRandom = (_RtlGenRandom)GetProcAddress(hLib, "SystemFunction036"); #ifdef _DEBUG _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_CHECK_CRT_DF | _CRTDBG_ALLOC_MEM_DF); #endif #endif GetOS(text); printf("\n -- Phyros " BOT_VER " -- %s --\n\n", text); loadedtime = getuptime(); #ifndef _WIN32 SetPipeSignalHandler(); if (getuid() == 0) { printf("WARNING: should not be running as root!\n"); setuid(GetUidFromUsername("nobody")); } //////should set the group id instead so files can be modified at runtime #endif botpluser = malloc(sizeof(LUSER)); botpluser->access = 103; strcpy(botpluser->username, "the bot"); maintid = get_self_tid(); #ifndef _DEBUG SetSegvSignalHandler(); #endif tagbans[WCP_BACK] = RadixInit(); tagbans[WCP_FRONT] = RadixInit(); tagbans[WCP_BOTH] = RadixInit(); phrases = RadixInit(); cdkeys = VectorInit(8); //banqueue = malloc(BANQUEUE_INITIALSIZE * sizeof(char *)); //bqsize = BANQUEUE_INITIALSIZE; SetDefaultConfig(); LoadConfig(); LoadUsers(); LoadCDKeys(); GetRealms(); BlacklistLoad(); LoadPhrases(); CmdTreeInit(); LoadAccessModifications(); ParseCmdLine(argc, argv); for (i = 0; i != 3; i++) { if (!hashes[i][0]) { gstate |= GFS_USEBNLS; printf("WARNING: path for binary \'%s\' not set, falling back to BNLS checkrevision\n", hash_filenames[i]); break; } } if (gstate & GFS_CHECKUPDATES) { printf(" - checking %s%s for updates...\n", updatesite, updateverfile); printf("%s\n", updateresult[CheckUpdate(updatesite, updateverfile)]); } CreateAsyncTimer(); ptimertid = _CreateThread(PeriodicTimerWaitProc, NULL); AddPeriodicTimer(TIMER_NULLPKT, 10, NullPacketTimerProc); setjmp(jmpenv); ////////////////////////////////////////////TEST BATTERY////////////////////////////////////// /*ChatHandleChannel("Clan Blah", 0, 0); //ChatHandleJoin("loladfg", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf1aaaaaaaaaa", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf2bbbbbfffe", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf3", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf4", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf5", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf6", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf7", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf8", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladf9", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladfa", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladfb", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladfc", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); ChatHandleJoin("loladfd", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); */ /*printf("%x\n", FindTextInWildcards(tagbans, "asdfgdfg")); printf("%x\n", FindTextInWildcards(tagbans, "as[tg]gdfg")); printf("%x\n", FindTextInWildcards(tagbans, "asdfgdfg[tg]")); printf("%x\n", FindTextInWildcards(tagbans, "asdfgdfg")); printf("%x\n", FindPhraseban(phrases, "raiasdfdasdfzomgzasdfasdfasdfasdf")); printf("%x\n", FindPhraseban(phrases, "raiasdfgdfgbloop")); printf("%x\n", FindPhraseban(phrases, "bloo asfukdfgdfg zomg"));*/ ///////////////////////////////////////////////////////////////////////////////////////////// while (1) { fgets(text, sizeof(text), stdin); text[strlen(text) - 1] = 0; if (*(int16_t *)text == '//') CheckCommand(NULL, text, 0, 0); else QueueAdd(text, curbotinc()); } return 0; }
void ToDoList::OnAddItem(cb_unused wxCommandEvent& event) { cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); if (!ed) return; EditorColourSet* colour_set = Manager::Get()->GetEditorManager()->GetColourSet(); if (!colour_set) return; HighlightLanguage hlang = colour_set->GetLanguageName(ed->GetLanguage()); bool edIsCCpp = (hlang == _T("C/C++")); CommentToken token = colour_set->GetCommentToken(ed->GetLanguage()); bool hasStreamComments = not token.streamCommentStart.IsEmpty(); bool hasLineComments = not token.lineComment.IsEmpty(); if (!(edIsCCpp||hasLineComments||hasStreamComments)) return; std::bitset<(int)tdctError+1> supportedTdcts; supportedTdcts[tdctLine] = !(token.lineComment.IsEmpty()); supportedTdcts[tdctStream] = !(token.streamCommentStart.IsEmpty()); supportedTdcts[tdctDoxygenLine] = !(token.doxygenLineComment.IsEmpty()); supportedTdcts[tdctDoxygenStream] = !(token.doxygenStreamCommentStart.IsEmpty()); supportedTdcts[tdctWarning] = edIsCCpp; supportedTdcts[tdctError] = edIsCCpp; // display todo dialog AddTodoDlg dlg(Manager::Get()->GetAppWindow(), m_Users, m_Types, supportedTdcts ); PlaceWindow(&dlg); if (dlg.ShowModal() != wxID_OK) return; // Re-load users and types as they might have changed by the user via AddTodoDlg LoadUsers(); LoadTypes(); cbStyledTextCtrl* control = ed->GetControl(); // calculate insertion point int idx = 0; int crlfLen = 0; // length of newline chars int origPos = control->GetCurrentPos(); // keep current position in the document int line = control->GetCurrentLine(); // current line ToDoCommentType CmtType = dlg.GetCommentType(); if (dlg.GetPosition() == tdpCurrent) { idx = control->GetCurrentPos(); // current position in the document // if the style is cpp comments (// ...), there's the possibility that the current position // is somewhere in the middle of a line of code; this would result // in everything after the insertion point to turn into comments // let's double check this with the user if (idx != control->GetLineEndPosition(line) && (CmtType != tdctStream) && (CmtType != tdctDoxygenStream)) { // let's ask the user, and present as options // keep cpp style at current position, switch to c style, add the todo at the end (keeping cpp style) // if user cancels out / do nothing : just return // future idea : check if there's any non white space character // if yes -> in the middle of code // if no -> then only whitespace after the insertion point -> no harm to turn that into comments wxString streamStart = token.streamCommentStart, streamEnd = token.streamCommentEnd; if (CmtType == tdctDoxygenLine && !token.doxygenStreamCommentStart.IsEmpty()) { streamStart = token.doxygenStreamCommentStart; streamEnd = token.doxygenStreamCommentEnd; } AskTypeDlg asktype_dlg(Manager::Get()->GetAppWindow(), streamStart, streamEnd); PlaceWindow(&asktype_dlg); if (asktype_dlg.ShowModal() != wxID_OK) return; switch(asktype_dlg.GetTypeCorrection()) { case tcStay: break; // do nothing, leave things as they are case tcSwitch: if (CmtType == tdctDoxygenLine) CmtType = tdctDoxygenStream; else CmtType = tdctStream; break; case tcMove: default: idx = control->GetLineEndPosition(line); break; } // end switch } } else { if (dlg.GetPosition() == tdpAbove) idx = control->GetLineEndPosition(line - 1); // get previous line's end else if (dlg.GetPosition() == tdpBelow) idx = control->GetLineEndPosition(line); // get current line's end // calculate insertion point by skipping next newline switch (control->GetEOLMode()) { case wxSCI_EOL_CRLF: crlfLen = 2; break; case wxSCI_EOL_CR: // fall-though case wxSCI_EOL_LF: // fall-though default: crlfLen = 1; break; } if (idx > 0) idx += crlfLen; } // make sure insertion point is valid (bug #1300981) if (idx > control->GetLength()) idx = control->GetLength(); // ok, construct todo line text like this: // TODO (mandrav#0#): Implement code to do this and the other... wxString buffer; // start with the comment switch(CmtType) { default: case tdctLine: buffer << token.lineComment; break; case tdctDoxygenLine: buffer << token.doxygenLineComment; break; case tdctDoxygenStream: buffer << token.doxygenStreamCommentStart; break; case tdctWarning: buffer << _T("#warning"); break; case tdctError: buffer << _T("#error"); break; case tdctStream: buffer << token.streamCommentStart; break; } // end switch buffer << _T(" "); // continue with the type buffer << dlg.GetType() << _T(" "); wxString priority = wxString::Format(_T("%d"), dlg.GetPriority()); // do it like this (wx bug with int and streams) // now do the () part buffer << _T("(") << dlg.GetUser() << _T("#") << priority << _T("#") << (dlg.DateRequested() ? (wxDateTime::Today().Format(_T("%x): "))) : _T("): ")); wxString text = dlg.GetText(); // make sure that multi-line notes, don't break the todo if ( (CmtType == tdctWarning) || (CmtType == tdctError) ) { if (text.Replace(_T("\r\n"), _T("\\\r\n")) == 0) text.Replace(_T("\n"), _T("\\\n")); // now see if there were already a backslash before newline if (text.Replace(_T("\\\\\r\n"), _T("\\\r\n")) == 0) text.Replace(_T("\\\\\n"), _T("\\\n")); } else if (CmtType == tdctLine || (CmtType == tdctDoxygenLine)) { wxString lc; if (CmtType == tdctLine) lc = token.lineComment; else lc = token.doxygenLineComment; // comment every line from the todo text if ( text.Replace(_T("\r\n"), _T("\r\n")+lc) == 0 ) text.Replace(_T("\n"), _T("\n")+lc); // indicate (on the first line) that there is some more text if ( text.Replace(_T("\r\n"), _T(" ...\r\n"),false) == 0 ) text.Replace(_T("\n"), _T(" ...\n"),false); } // add the actual text buffer << text; if ( CmtType == tdctStream ) buffer << _T(" ") << token.streamCommentEnd; if ( CmtType == tdctDoxygenStream ) buffer << _T(" ") << token.doxygenStreamCommentEnd; // add newline char(s), only if dlg.GetPosition() != tdpCurrent if (dlg.GetPosition() != tdpCurrent) buffer << GetEOLStr(control->GetEOLMode()); // ok, insert the todo line text control->InsertText(idx, buffer); if (dlg.GetPosition() == tdpAbove) origPos += buffer.Length() + crlfLen; control->GotoPos(origPos); control->EnsureCaretVisible(); ParseCurrent(true); } // end of OnAddItem
void ToDoList::OnAddItem(wxCommandEvent& event) { cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); if (!ed) return; // display todo dialog AddTodoDlg dlg(Manager::Get()->GetAppWindow(), m_Users, m_Types); PlaceWindow(&dlg); if (dlg.ShowModal() != wxID_OK) return; // Re-load users and types as they might have changed by the user via AddTodoDlg LoadUsers(); LoadTypes(); cbStyledTextCtrl* control = ed->GetControl(); // calculate insertion point int idx = 0; int crlfLen = 0; // length of newline chars int origPos = control->GetCurrentPos(); // keep current position in the document int line = control->GetCurrentLine(); // current line ToDoCommentType CmtType = dlg.GetCommentType(); if (dlg.GetPosition() == tdpCurrent) { idx = control->GetCurrentPos(); // current position in the document // if the style is cpp comments (// ...), there's the possibility that the current position // is somewhere in the middle of a line of code; this would result // in everything after the insertion point to turn into comments // let's double check this with the user if (idx != control->GetLineEndPosition(line)) { // let's ask the user, and present as options // keep cpp style at current position, switch to c style, add the todo at the end (keeping cpp style) // if user cancels out / do nothing : just return // future idea : check if there's any non white space character // if yes -> in the middle of code // if no -> then only whitespace after the insertion point -> no harm to turn that into comments AskTypeDlg dlg(Manager::Get()->GetAppWindow()); PlaceWindow(&dlg); if (dlg.ShowModal() != wxID_OK) return; switch(dlg.GetTypeCorrection()) { case tcCppStay: break; // do nothing, leave things as they are case tcCpp2C: CmtType = tdctC; break; case tcCppMove: default: idx = control->GetLineEndPosition(line); break; } // end switch } } else { if (dlg.GetPosition() == tdpAbove) idx = control->GetLineEndPosition(line - 1); // get previous line's end else if (dlg.GetPosition() == tdpBelow) idx = control->GetLineEndPosition(line); // get current line's end // calculate insertion point by skipping next newline switch (control->GetEOLMode()) { case wxSCI_EOL_CR: case wxSCI_EOL_LF: crlfLen = 1; break; case wxSCI_EOL_CRLF: crlfLen = 2; break; } if (idx > 0) idx += crlfLen; } // make sure insertion point is valid (bug #1300981) if (idx > control->GetLength()) idx = control->GetLength(); // ok, construct todo line text like this: // TODO (mandrav#0#): Implement code to do this and the other... wxString buffer; // start with the comment switch(CmtType) { case tdctCpp: buffer << _T("// "); break; case tdctDoxygenC: buffer << _T("/** "); break; case tdctDoxygenCPP: buffer << _T("/// "); break; case tdctWarning: buffer << _T("#warning "); break; case tdctError: buffer << _T("#error "); break; default: buffer << _T("/* "); break; } // end switch // continue with the type buffer << dlg.GetType() << _T(" "); wxString priority = wxString::Format(_T("%d"), dlg.GetPriority()); // do it like this (wx bug with int and streams) // now do the () part buffer << _T("(") << dlg.GetUser() << _T("#") << priority << _T("#): "); wxString text = dlg.GetText(); if ( (CmtType != tdctC) && (CmtType != tdctDoxygenC) ) { // make sure that multi-line notes, don't break the todo if (text.Replace(_T("\r\n"), _T("\\\r\n")) == 0) text.Replace(_T("\n"), _T("\\\n")); // now see if there were already a backslash before newline if (text.Replace(_T("\\\\\r\n"), _T("\\\r\n")) == 0) text.Replace(_T("\\\\\n"), _T("\\\n")); } // add the actual text buffer << text; if ( (CmtType == tdctWarning) || (CmtType == tdctError) ) buffer << _T(""); else if ( (CmtType == tdctC) || (CmtType == tdctDoxygenC) ) buffer << _T(" */"); // add newline char(s), only if dlg.GetPosition() != tdpCurrent if (dlg.GetPosition() != tdpCurrent) { switch (control->GetEOLMode()) { // NOTE: maybe this switch, should make it in the SDK (maybe as cbStyledTextCtrl::GetEOLString())??? case wxSCI_EOL_CR: buffer << _T("\n"); break; case wxSCI_EOL_CRLF: buffer << _T("\r\n"); break; case wxSCI_EOL_LF: buffer << _T("\r"); break; } } // ok, insert the todo line text control->InsertText(idx, buffer); if (dlg.GetPosition() == tdpAbove) origPos += buffer.Length() + crlfLen; control->GotoPos(origPos); control->EnsureCaretVisible(); ParseCurrent(true); } // end of OnAddItem
void CAdminDlg::OnEdit() { // TODO: Add your control notification handler code here WORD Id; HTREEITEM Ti; CUserInfo *user = (CUserInfo *)Users[Id=m_Tree.GetItemData(Ti=m_Tree.GetSelectedItem())]; if (Id == 0 && User != 0) { MessageBox("Редактировать данные системного суперпользователя может только он сам!","Ошибка",MB_OK|MB_ICONERROR); return; } _UInfo TempInfo = user->Info; CUserDlg dlg; dlg.m_Add = false; dlg.m_Id = Id; dlg.m_Fio = TempInfo.Fio; dlg.m_Creator = TempInfo.Creator; dlg.m_Super = TempInfo.Type; if (TempInfo.Type == UT_ADMIN) { if (TempInfo.Admin & AT_CREATE) dlg.m_Change = true; if (TempInfo.Admin & AT_TARIF) dlg.m_Tarif = true; if (TempInfo.Admin & AT_SETUP) dlg.m_Com = true; if (TempInfo.Admin & AT_HOLIDAY) dlg.m_Holiday = true; if (TempInfo.Admin & AT_MANAGE) { dlg.m_Manage = true; if (TempInfo.Admin & MT_UNBLOCK) dlg.m_Unblock = true; if (TempInfo.Admin & MT_BLOCK) dlg.m_Block = true; if (TempInfo.Admin & MT_REBOOT) dlg.m_Reboot = true; if (TempInfo.Admin & MT_SHUTDOWN) dlg.m_Shutdown = true; if (TempInfo.Admin & MT_INETON) dlg.m_InetOn = true; if (TempInfo.Admin & MT_INETOFF) dlg.m_InetOff = true; } } if (dlg.DoModal()==IDCANCEL) return; strcpy(TempInfo.Fio, dlg.m_Fio); if (Id == 0 && dlg.m_Super != 0) { MessageBox("Вы пытались понизить свои права доступа!\nИзменения отклонены.","Ошибка",MB_OK|MB_ICONERROR); } else TempInfo.Type = dlg.m_Super; if (TempInfo.Type == UT_ADMIN) { DWORD TempType = 0; if (dlg.m_Change) TempType |= AT_CREATE; if (dlg.m_Tarif) TempType |= AT_TARIF; if (dlg.m_Com) TempType |= AT_SETUP; if (dlg.m_Holiday) TempType |= AT_HOLIDAY; if (dlg.m_Manage) { TempType |= AT_MANAGE; DWORD TempMenage = 0; if (dlg.m_Unblock) TempMenage |= MT_UNBLOCK; if (dlg.m_Block) TempMenage |= MT_BLOCK; if (dlg.m_Reboot) TempMenage |= MT_REBOOT; if (dlg.m_Shutdown) TempMenage |= MT_SHUTDOWN; if (dlg.m_InetOn) TempMenage |= MT_INETON; if (dlg.m_InetOff) TempMenage |= MT_INETOFF; TempType |= TempMenage; }; TempInfo.Admin = TempType; } user->Info = TempInfo; int gr = curgroup; LoadUsers(); m_Tree.Expand(groups[gr], TVE_EXPAND); }