void CSyncDlg::OnOK() { UpdateCombox(); this->UpdateData(); m_ctrlURL.SaveHistory(); SaveHistory(); m_regAutoLoadPutty = this->m_bAutoLoadPuttyKey; __super::OnOK(); }
void AddToHistory(HistoryHandle& handle, std::string current) { if (lines.empty() || current != lines.back()) { lines.push_back(std::move(current)); } handle = HISTORY_END; //TODO defer it more? when the programs exits? SaveHistory(); }
/* SaveForbid - принудительно запретить запись добавляемой строки. Используется на панели плагина */ void History::AddToHistory(const wchar_t *Str, int Type, const wchar_t *Prefix, bool SaveForbid) { if (!EnableAdd) return; AddToHistoryLocal(Str,Prefix,Type); if (*EnableSave && !SaveForbid) SaveHistory(); }
void CFindTextDlg::OnOK() { m_wndTextCombo.GetWindowText( m_options.m_strFind ); m_options.m_bMatchCase = m_wndMatchCase.GetCheck(); m_options.m_bMatchWholeWordOnly = m_wndMatchWholeWord.GetCheck(); m_options.m_bForward = !m_wndUpRadio.GetCheck(); SaveHistory(); CDialog::OnOK(); }
BOOL CHistoryCombo::RemoveSelectedItem() { int nIndex = GetCurSel(); if (nIndex == CB_ERR) { return FALSE; } DeleteItem(nIndex); m_arEntries.RemoveAt(nIndex); if ( nIndex < GetCount() ) { // index stays the same to select the // next item after the item which has // just been deleted } else { // the end of the list has been reached // so we select the previous item nIndex--; } if ( nIndex == -1 ) { // The one and only item has just been // deleted -> reset window text since // there is no item to select SetWindowText(L""); } else { SetCurSel(nIndex); } // Since the dialog might be canceled we // should now save the history. Before that // set the selection to the first item so that // the items will not be reordered and restore // the selection after saving. SetCurSel(0); SaveHistory(); if ( nIndex != -1 ) { SetCurSel(nIndex); } return TRUE; }
void CConsole::ProcessBuffer(const wchar_t* szLine) { if (szLine == NULL) return; if (wcslen(szLine) <= 0) return; ENSURE(wcslen(szLine) < CONSOLE_BUFFER_SIZE); m_deqBufHistory.push_front(szLine); SaveHistory(); // Do this each line for the moment; if a script causes // a crash it's a useful record. // Process it as JavaScript jsval rval = g_ScriptingHost.ExecuteScript(szLine, L"Console"); if (!JSVAL_IS_VOID(rval)) InsertMessage(L"%ls", g_ScriptingHost.GetScriptInterface().ToString(rval).c_str()); }
void CConsole::ProcessBuffer(const wchar_t* szLine) { if (szLine == NULL) return; if (wcslen(szLine) <= 0) return; ENSURE(wcslen(szLine) < CONSOLE_BUFFER_SIZE); m_deqBufHistory.push_front(szLine); SaveHistory(); // Do this each line for the moment; if a script causes // a crash it's a useful record. // Process it as JavaScript CScriptVal rval; g_GUI->GetActiveGUI()->GetScriptInterface()->Eval(szLine, rval); if (!rval.undefined()) InsertMessage(L"%ls", g_GUI->GetActiveGUI()->GetScriptInterface()->ToString(rval.get()).c_str()); }
void CConsole::ProcessBuffer(const wchar_t* szLine) { shared_ptr<ScriptInterface> pScriptInterface = g_GUI->GetActiveGUI()->GetScriptInterface(); JSContext* cx = pScriptInterface->GetContext(); JSAutoRequest rq(cx); if (szLine == NULL) return; if (wcslen(szLine) <= 0) return; ENSURE(wcslen(szLine) < CONSOLE_BUFFER_SIZE); m_deqBufHistory.push_front(szLine); SaveHistory(); // Do this each line for the moment; if a script causes // a crash it's a useful record. // Process it as JavaScript JS::RootedValue rval(cx); pScriptInterface->Eval(szLine, &rval); if (!rval.isUndefined()) InsertMessage(pScriptInterface->ToString(&rval)); }
void OverviewDataStreamsWidget::TwAudioCustomContextMenuEvent(const QPoint &pPos) { QAction *tAction; QMenu tMenu(this); tAction = tMenu.addAction("Save all"); QIcon tIcon1; tIcon1.addPixmap(QPixmap(":/images/22_22/Save.png"), QIcon::Normal, QIcon::Off); tAction->setIcon(tIcon1); tAction = tMenu.addAction("Save row history"); tAction->setIcon(tIcon1); tAction = tMenu.addAction("Reset row"); QIcon tIcon2; tIcon2.addPixmap(QPixmap(":/images/22_22/Reload.png"), QIcon::Normal, QIcon::Off); tAction->setIcon(tIcon2); QAction* tPopupRes = tMenu.exec(QCursor::pos()); if (tPopupRes != NULL) { if (tPopupRes->text().compare("Reset row") == 0) { ResetStatistic(DATA_TYPE_AUDIO, mTwAudio->currentRow()); return; } if (tPopupRes->text().compare("Save row history") == 0) { SaveHistory(DATA_TYPE_AUDIO, mTwAudio->currentRow()); return; } if (tPopupRes->text().compare("Save all") == 0) { SaveCompleteStatistic(); return; } } }
void DialogShiftTimes::Process(wxCommandEvent &) { int mode = selection_mode->GetSelection(); int type = time_fields->GetSelection(); bool reverse = shift_backward->GetValue(); bool by_time = shift_by_time->GetValue(); bool start = type != 2; bool end = type != 1; SubtitleSelection sel = context->selectionController->GetSelectedSet(); long shift; if (by_time) { shift = shift_time->GetTime(); if (shift == 0) { Close(); return; } } else shift_frames->GetValue().ToLong(&shift); if (reverse) shift = -shift; // Track which rows were shifted for the log int row_number = 0; int block_start = 0; json::Array shifted_blocks; for (auto line : context->ass->Line | agi::of_type<AssDialogue>()) { ++row_number; if (!sel.count(line)) { if (block_start) { json::Object block; block["start"] = block_start; block["end"] = row_number - 1; shifted_blocks.push_back(block); block_start = 0; } if (mode == 1) continue; if (mode == 2 && shifted_blocks.empty()) continue; } else if (!block_start) block_start = row_number; if (start) line->Start = Shift(line->Start, shift, by_time, agi::vfr::START); if (end) line->End = Shift(line->End, shift, by_time, agi::vfr::END); } context->ass->Commit(_("shifting"), AssFile::COMMIT_DIAG_TIME); if (block_start) { json::Object block; block["start"] = block_start; block["end"] = row_number - 1; shifted_blocks.push_back(block); } SaveHistory(shifted_blocks); Close(); }
void Delete(HistoryRecord* Item){HistoryList.Delete(Item); ResetPosition(); SaveHistory();}
void DisposeReadline(void) { SaveHistory(); } /* DisposeReadline */
CMorphwizardView::~CMorphwizardView() { SaveHistory(); }
/* * ExitEditor - do just that */ void ExitEditor( int rc ) { #ifdef __WIN__ WriteProfile(); #endif #ifdef __IDE__ IDEFini(); #endif #ifdef __WIN__ DDEFini(); #endif SaveHistory(); RestoreInterrupts(); SwapFileClose(); WindowSwapFileClose(); SwapBlockFini(); ExtendedMemoryFini(); SelRgnFini(); LangFiniAll(); FiniMouse(); FiniMenu(); FiniSavebufs(); FindCmdFini(); DirFini(); CurrentWindow = NO_WINDOW; FinishWindows(); ScreenFini(); #ifdef __WIN__ FiniClrPick(); FiniFtPick(); CursorOp( COP_FINI ); SubclassGenericFini(); FiniProfile(); #endif FiniFileStack(); DeleteResidentScripts(); MatchFini(); FiniKeyMaps(); ErrorFini(); FiniCommandLine(); SSFini(); HistFini(); BoundDataFini(); FTSFini(); StaticFini(); VarFini(); AutoSaveFini(); FiniConfigFileName(); miscGlobalsFini(); ChangeDirectory( HomeDirectory ); #if defined( __NT__ ) && !defined( __WIN__ ) { SetConsoleActiveScreenBuffer( GetStdHandle( STD_OUTPUT_HANDLE ) ); } #endif MemFree( HomeDirectory ); MemFree( CurrentDirectory ); #if defined( VI_RCS ) ViRCSFini(); #endif FiniMem(); exit( rc ); } /* ExitEditor */
///////////////////////////////////////////////////////////////////////////// // CSourceDirListCtrl message handlers void CSourceDirListCtrl::OnDestroy() { SaveHistory(); CCheckListCtrl::OnDestroy(); }
/* Return: -1 - Error??? 0 - Esc 1 - Enter 2 - Shift-Enter 3 - Ctrl-Enter 4 - F3 5 - F4 6 - Ctrl-Shift-Enter 7 - Ctrl-Alt-Enter */ int History::ProcessMenu(string &strStr, const wchar_t *Title, VMenu &HistoryMenu, int Height, int &Type, Dialog *Dlg) { MenuItemEx MenuItem; HistoryRecord *SelectedRecord=nullptr; FarListPos Pos={0,0}; int Code=-1; int RetCode=1; bool Done=false; bool SetUpMenuPos=false; if (TypeHistory == HISTORYTYPE_DIALOG && HistoryList.Empty()) return 0; while (!Done) { bool IsUpdate=false; HistoryMenu.DeleteItems(); HistoryMenu.Modal::ClearDone(); // заполнение пунктов меню for (const HistoryRecord *HistoryItem=TypeHistory==HISTORYTYPE_DIALOG?HistoryList.Last():HistoryList.First(); HistoryItem ; HistoryItem=TypeHistory==HISTORYTYPE_DIALOG?HistoryList.Prev(HistoryItem):HistoryList.Next(HistoryItem)) { string strRecord = HistoryItem->strName; strRecord.Clear(); if (TypeHistory == HISTORYTYPE_VIEW) { strRecord += GetTitle(HistoryItem->Type); strRecord += L":"; strRecord += (HistoryItem->Type==4?L"-":L" "); } /* TODO: возможно здесь! или выше.... char Date[16],Time[16], OutStr[32]; ConvertDate(HistoryItem->Timestamp,Date,Time,5,TRUE,FALSE,TRUE,TRUE); а дальше strRecord += дату и время */ strRecord += HistoryItem->strName;; if (TypeHistory != HISTORYTYPE_DIALOG) ReplaceStrings(strRecord, L"&",L"&&", -1); MenuItem.Clear(); MenuItem.strName = strRecord; MenuItem.SetCheck(HistoryItem->Lock?1:0); if (!SetUpMenuPos) MenuItem.SetSelect(CurrentItem==HistoryItem || (!CurrentItem && HistoryItem==HistoryList.Last())); HistoryMenu.SetUserData(HistoryItem,sizeof(HistoryItem),HistoryMenu.AddItem(&MenuItem)); } //MenuItem.Clear (); //MenuItem.strName = L" "; //if (!SetUpMenuPos) //MenuItem.SetSelect(CurLastPtr==-1 || CurLastPtr>=HistoryList.Length); //HistoryMenu.SetUserData(nullptr,sizeof(OneItem *),HistoryMenu.AddItem(&MenuItem)); if (TypeHistory == HISTORYTYPE_DIALOG) Dlg->SetComboBoxPos(); else HistoryMenu.SetPosition(-1,-1,0,0); if (SetUpMenuPos) { Pos.SelectPos=Pos.SelectPos < (int)HistoryList.Count() ? Pos.SelectPos : (int)HistoryList.Count()-1; Pos.TopPos=Min(Pos.TopPos,HistoryMenu.GetItemCount()-Height); HistoryMenu.SetSelectPos(&Pos); SetUpMenuPos=false; } /*BUGBUG??? if (TypeHistory == HISTORYTYPE_DIALOG) { // Перед отрисовкой спросим об изменении цветовых атрибутов BYTE RealColors[VMENU_COLOR_COUNT]; FarListColors ListColors={0}; ListColors.ColorCount=VMENU_COLOR_COUNT; ListColors.Colors=RealColors; HistoryMenu.GetColors(&ListColors); if(DlgProc((HANDLE)this,DN_CTLCOLORDLGLIST,CurItem->ID,(LONG_PTR)&ListColors)) HistoryMenu.SetColors(&ListColors); } */ HistoryMenu.Show(); while (!HistoryMenu.Done()) { if (TypeHistory == HISTORYTYPE_DIALOG && (!Dlg->GetDropDownOpened() || HistoryList.Empty())) { HistoryMenu.ProcessKey(KEY_ESC); continue; } int Key=HistoryMenu.ReadInput(); if (TypeHistory == HISTORYTYPE_DIALOG && Key==KEY_TAB) // Tab в списке хистори диалогов - аналог Enter { HistoryMenu.ProcessKey(KEY_ENTER); continue; } HistoryMenu.GetSelectPos(&Pos); HistoryRecord *CurrentRecord=(HistoryRecord *)HistoryMenu.GetUserData(nullptr,sizeof(HistoryRecord *),Pos.SelectPos); switch (Key) { case KEY_CTRLR: // обновить с удалением недоступных { if (TypeHistory == HISTORYTYPE_FOLDER || TypeHistory == HISTORYTYPE_VIEW) { bool ModifiedHistory=false; for (HistoryRecord *HistoryItem=HistoryList.First(); HistoryItem ; HistoryItem=HistoryList.Next(HistoryItem)) { if (HistoryItem->Lock) // залоченные не трогаем continue; // убить запись из истории if (apiGetFileAttributes(HistoryItem->strName) == INVALID_FILE_ATTRIBUTES) { HistoryItem=HistoryList.Delete(HistoryItem); ModifiedHistory=true; } } if (ModifiedHistory) // избавляемся от лишних телодвижений { SaveHistory(); // сохранить HistoryMenu.Modal::SetExitCode(Pos.SelectPos); HistoryMenu.SetUpdateRequired(TRUE); IsUpdate=true; } ResetPosition(); } break; } case KEY_CTRLSHIFTNUMENTER: case KEY_CTRLNUMENTER: case KEY_SHIFTNUMENTER: case KEY_CTRLSHIFTENTER: case KEY_CTRLENTER: case KEY_SHIFTENTER: case KEY_CTRLALTENTER: case KEY_CTRLALTNUMENTER: { if (TypeHistory == HISTORYTYPE_DIALOG) break; HistoryMenu.Modal::SetExitCode(Pos.SelectPos); Done=true; RetCode = Key==KEY_CTRLALTENTER||Key==KEY_CTRLALTNUMENTER?7:(Key==KEY_CTRLSHIFTENTER||Key==KEY_CTRLSHIFTNUMENTER?6:(Key==KEY_SHIFTENTER||Key==KEY_SHIFTNUMENTER?2:3)); break; } case KEY_F3: case KEY_F4: case KEY_NUMPAD5: case KEY_SHIFTNUMPAD5: { if (TypeHistory == HISTORYTYPE_DIALOG) break; HistoryMenu.Modal::SetExitCode(Pos.SelectPos); Done=true; RetCode=(Key==KEY_F4? 5 : 4); break; } // $ 09.04.2001 SVS - Фича - копирование из истории строки в Clipboard case KEY_CTRLC: case KEY_CTRLINS: case KEY_CTRLNUMPAD0: { if (CurrentRecord) CopyToClipboard(CurrentRecord->strName); break; } // Lock/Unlock case KEY_INS: case KEY_NUMPAD0: { if (HistoryMenu.GetItemCount()/* > 1*/) { CurrentItem=CurrentRecord; CurrentItem->Lock=CurrentItem->Lock?false:true; HistoryMenu.Hide(); ResetPosition(); SaveHistory(); HistoryMenu.Modal::SetExitCode(Pos.SelectPos); HistoryMenu.SetUpdateRequired(TRUE); IsUpdate=true; SetUpMenuPos=true; } break; } case KEY_SHIFTNUMDEL: case KEY_SHIFTDEL: { if (HistoryMenu.GetItemCount()/* > 1*/) { if (!CurrentRecord->Lock) { HistoryMenu.Hide(); Delete(CurrentRecord); HistoryMenu.Modal::SetExitCode(Pos.SelectPos); HistoryMenu.SetUpdateRequired(TRUE); IsUpdate=true; SetUpMenuPos=true; } } break; } case KEY_NUMDEL: case KEY_DEL: { if (HistoryMenu.GetItemCount()/* > 1*/ && (!Opt.Confirm.HistoryClear || (Opt.Confirm.HistoryClear && !Message(MSG_WARNING,2, MSG((TypeHistory==HISTORYTYPE_CMD || TypeHistory==HISTORYTYPE_DIALOG?MHistoryTitle: (TypeHistory==HISTORYTYPE_FOLDER?MFolderHistoryTitle:MViewHistoryTitle))), MSG(MHistoryClear), MSG(MClear),MSG(MCancel))))) { for (HistoryRecord *HistoryItem=HistoryList.First(); HistoryItem ; HistoryItem=HistoryList.Next(HistoryItem)) { if (HistoryItem->Lock) // залоченные не трогаем continue; HistoryItem=HistoryList.Delete(HistoryItem); } ResetPosition(); HistoryMenu.Hide(); SaveHistory(); HistoryMenu.Modal::SetExitCode(Pos.SelectPos); HistoryMenu.SetUpdateRequired(TRUE); IsUpdate=true; } break; } default: HistoryMenu.ProcessInput(); break; } } if (IsUpdate) continue; Done=true; Code=HistoryMenu.Modal::GetExitCode(); if (Code >= 0) { SelectedRecord=(HistoryRecord *)HistoryMenu.GetUserData(nullptr,sizeof(HistoryRecord *),Code); if (!SelectedRecord) return -1; //BUGUBUG: eliminate those magic numbers! if (SelectedRecord->Type != 2 && SelectedRecord->Type != 3 // ignore external && RetCode != 3 && ((TypeHistory == HISTORYTYPE_FOLDER && !SelectedRecord->Type) || TypeHistory == HISTORYTYPE_VIEW) && apiGetFileAttributes(SelectedRecord->strName) == INVALID_FILE_ATTRIBUTES) { SetLastError(ERROR_FILE_NOT_FOUND); if (SelectedRecord->Type == 1 && TypeHistory == HISTORYTYPE_VIEW) // Edit? тогда спросим и если надо создадим { if (!Message(MSG_WARNING|MSG_ERRORTYPE,2,Title,SelectedRecord->strName,MSG(MViewHistoryIsCreate),MSG(MHYes),MSG(MHNo))) break; } else { Message(MSG_WARNING|MSG_ERRORTYPE,1,Title,SelectedRecord->strName,MSG(MOk)); } Done=false; SetUpMenuPos=true; HistoryMenu.Modal::SetExitCode(Pos.SelectPos=Code); continue; } } } if (Code < 0 || !SelectedRecord) return 0; if (KeepSelectedPos) { CurrentItem = SelectedRecord; } strStr = SelectedRecord->strName; if (RetCode < 4 || RetCode == 6 || RetCode == 7) { Type=SelectedRecord->Type; } else { Type=RetCode-4; if (Type == 1 && SelectedRecord->Type == 4) Type=4; RetCode=1; } return RetCode; }