Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "Defaults" button to the "Options (General)" dialog. #2453

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Src/Merge.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,7 @@ BEGIN
COMBOBOX IDC_AUTO_RELOAD_MODIFIED_FILES,7,178,270,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Language:",IDC_STATIC,7,193,270,10
COMBOBOX IDC_LANGUAGE_LIST,7,204,270,41,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Defaults", IDC_COMPARE_DEFAULTS, 191, 228, 88, 14
END

IDD_EDIT_FIND DIALOGEX 30, 73, 324, 96
Expand Down
41 changes: 41 additions & 0 deletions Src/PropGeneral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void PropGeneral::DoDataExchange(CDataExchange* pDX)

BEGIN_MESSAGE_MAP(PropGeneral, OptionsPanel)
//{{AFX_MSG_MAP(PropGeneral)
ON_BN_CLICKED(IDC_COMPARE_DEFAULTS, OnDefaults)
ON_MESSAGE(WM_APP, OnLoadLanguages)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
Expand Down Expand Up @@ -137,6 +138,29 @@ void PropGeneral::WriteOptions()
}
}

/**
* @brief Sets options to defaults.
*/
void PropGeneral::OnDefaults()
{
m_bScroll = GetOptionsMgr()->GetDefault<bool>(OPT_SCROLL_TO_FIRST);
m_bScrollToFirstInlineDiff = GetOptionsMgr()->GetDefault<bool>(OPT_SCROLL_TO_FIRST_INLINE_DIFF);
m_nSingleInstance = GetOptionsMgr()->GetDefault<unsigned>(OPT_SINGLE_INSTANCE);
m_bVerifyPaths = GetOptionsMgr()->GetDefault<bool>(OPT_VERIFY_OPEN_PATHS);
m_nCloseWindowWithEsc = GetOptionsMgr()->GetDefault<unsigned>(OPT_CLOSE_WITH_ESC);
m_bAskMultiWindowClose = GetOptionsMgr()->GetDefault<bool>(OPT_ASK_MULTIWINDOW_CLOSE);
m_nAutoCompleteSource = GetOptionsMgr()->GetDefault<unsigned>(OPT_AUTO_COMPLETE_SOURCE);
m_bPreserveFiletime = GetOptionsMgr()->GetDefault<bool>(OPT_PRESERVE_FILETIMES);
m_bShowSelectFolderOnStartup = GetOptionsMgr()->GetDefault<bool>(OPT_SHOW_SELECT_FILES_AT_STARTUP);
m_bCloseWithOK = GetOptionsMgr()->GetDefault<bool>(OPT_CLOSE_WITH_OK);
m_nFileReloadMode = GetOptionsMgr()->GetDefault<unsigned>(OPT_AUTO_RELOAD_MODIFIED_FILES);

LANGID lang = static_cast<LANGID>(GetOptionsMgr()->GetDefault<unsigned>(OPT_SELECTED_LANGUAGE));
SetCursorSelectForLanguage(lang);

UpdateData(FALSE);
}

LRESULT PropGeneral::OnLoadLanguages(WPARAM, LPARAM)
{
m_ctlLangList.SetRedraw(false);
Expand All @@ -151,3 +175,20 @@ LRESULT PropGeneral::OnLoadLanguages(WPARAM, LPARAM)
m_ctlLangList.SetRedraw(true);
return 0;
}

/**
* @brief Select the item specified by the language ID in the "Language" combo box.
* @param [in] lang The language ID of the selected item.
*/
void PropGeneral::SetCursorSelectForLanguage(LANGID lang)
{
int itemCount = m_ctlLangList.GetCount();
for (int i = 0; i < itemCount; i++)
{
if (m_ctlLangList.GetItemData(i) == lang)
{
m_ctlLangList.SetCurSel(i);
break;
}
}
}
4 changes: 4 additions & 0 deletions Src/PropGeneral.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class PropGeneral : public OptionsPanel
CComboBox m_ctlLangList;
//}}AFX_DATA

private:
// Implementation methods
void SetCursorSelectForLanguage(LANGID lang);

// Overrides
// ClassWizard generate virtual function overrides
Expand All @@ -56,6 +59,7 @@ class PropGeneral : public OptionsPanel

// Generated message map functions
//{{AFX_MSG(PropGeneral)
afx_msg void OnDefaults();
afx_msg LRESULT OnLoadLanguages(WPARAM, LPARAM);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
Expand Down
6 changes: 3 additions & 3 deletions Translations/WinMerge/Arabic.po
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,9 @@ msgstr ""
msgid "Language:"
msgstr "اللغة:"

msgid "Defaults"
msgstr "الإعدادات الافتراضية"

msgid "Find"
msgstr "البحث"

Expand Down Expand Up @@ -1488,9 +1491,6 @@ msgstr "م&جلد مخصص:"
msgid "Br&owse..."
msgstr "&بحث..."

msgid "Defaults"
msgstr "الإعدادات الافتراضية"

msgid "Patch Generator"
msgstr "أداة توليد التصحيح"

Expand Down
8 changes: 4 additions & 4 deletions Translations/WinMerge/Basque.po
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,10 @@ msgstr ""
msgid "Language:"
msgstr ""

#, c-format
msgid "Defaults"
msgstr "Berezkoak"

#, c-format
msgid "Find"
msgstr "Bilatu"
Expand Down Expand Up @@ -1795,10 +1799,6 @@ msgstr "&Egile agiritegia:"
msgid "Br&owse..."
msgstr "Bilat&u"

#, c-format
msgid "Defaults"
msgstr "Berezkoak"

#, c-format
msgid "Patch Generator"
msgstr "Eranskin Sortzailea"
Expand Down
6 changes: 3 additions & 3 deletions Translations/WinMerge/Brazilian.po
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,9 @@ msgstr "Auto-&recarregar arquivos modificados:"
msgid "Language:"
msgstr "Idioma:"

msgid "Defaults"
msgstr "Padrões"

msgid "Find"
msgstr "Achar"

Expand Down Expand Up @@ -1485,9 +1488,6 @@ msgstr "P&asta personalizada:"
msgid "Br&owse..."
msgstr "Pr&ocurar..."

msgid "Defaults"
msgstr "Padrões"

msgid "Patch Generator"
msgstr "Gerador de Patches"

Expand Down
6 changes: 3 additions & 3 deletions Translations/WinMerge/Bulgarian.po
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,9 @@ msgstr "Автоматично &презареждане на променени
msgid "Language:"
msgstr "Език:"

msgid "Defaults"
msgstr "По подразбиране"

msgid "Find"
msgstr "Търсене"

Expand Down Expand Up @@ -1482,9 +1485,6 @@ msgstr "Друга &папка:"
msgid "Br&owse..."
msgstr "&Разглеждане…"

msgid "Defaults"
msgstr "По подразбиране"

msgid "Patch Generator"
msgstr "Създаване на кръпки"

Expand Down
8 changes: 4 additions & 4 deletions Translations/WinMerge/Catalan.po
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,10 @@ msgstr "&Recarrega automàticament els fitxers modificats:"
msgid "Language:"
msgstr "Idioma:"

#, c-format
msgid "Defaults"
msgstr "Predeterminats"

#, c-format
msgid "Find"
msgstr "Cerca"
Expand Down Expand Up @@ -1793,10 +1797,6 @@ msgstr "Directori personalitzat:"
msgid "Br&owse..."
msgstr "N&avega..."

#, c-format
msgid "Defaults"
msgstr "Predeterminats"

#, c-format
msgid "Patch Generator"
msgstr "Generador de pedaços"
Expand Down
6 changes: 3 additions & 3 deletions Translations/WinMerge/ChineseSimplified.po
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,9 @@ msgstr "自动重新加载修改过的文件(&R):"
msgid "Language:"
msgstr "语言:"

msgid "Defaults"
msgstr "默认"

msgid "Find"
msgstr "查找"

Expand Down Expand Up @@ -1491,9 +1494,6 @@ msgstr "自定义文件夹(&U):"
msgid "Br&owse..."
msgstr "浏览(&O)..."

msgid "Defaults"
msgstr "默认"

msgid "Patch Generator"
msgstr "补丁生成器"

Expand Down
8 changes: 4 additions & 4 deletions Translations/WinMerge/ChineseTraditional.po
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,10 @@ msgstr "自動重新載入修改的檔案(&R):"
msgid "Language:"
msgstr "語言:"

#, c-format
msgid "Defaults"
msgstr "預設值"

#, c-format
msgid "Find"
msgstr "尋找"
Expand Down Expand Up @@ -1802,10 +1806,6 @@ msgstr "自訂資料夾 (&U):"
msgid "Br&owse..."
msgstr "瀏覽 (&O)..."

#, c-format
msgid "Defaults"
msgstr "預設值"

#, c-format
msgid "Patch Generator"
msgstr "補綴產生器"
Expand Down
6 changes: 3 additions & 3 deletions Translations/WinMerge/Corsican.po
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,9 @@ msgstr "&Ricaricà autumaticamente i schedarii mudificati :"
msgid "Language:"
msgstr "Lingua :"

msgid "Defaults"
msgstr "Predefinizioni"

msgid "Find"
msgstr "Circà"

Expand Down Expand Up @@ -1487,9 +1490,6 @@ msgstr "Cartulare &persunalizatu :"
msgid "Br&owse..."
msgstr "Na&vigà…"

msgid "Defaults"
msgstr "Predefinizioni"

msgid "Patch Generator"
msgstr "Generatore di currezzioni"

Expand Down
8 changes: 4 additions & 4 deletions Translations/WinMerge/Croatian.po
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,10 @@ msgstr ""
msgid "Language:"
msgstr ""

#, c-format
msgid "Defaults"
msgstr "Predpodešeno"

#, c-format
msgid "Find"
msgstr "Nađi"
Expand Down Expand Up @@ -1792,10 +1796,6 @@ msgstr "Ko&risnikova mapa"
msgid "Br&owse..."
msgstr "&Odabir..."

#, c-format
msgid "Defaults"
msgstr "Predpodešeno"

#, c-format
msgid "Patch Generator"
msgstr "Pohrana razlika (Patch)"
Expand Down
8 changes: 4 additions & 4 deletions Translations/WinMerge/Czech.po
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,10 @@ msgstr ""
msgid "Language:"
msgstr ""

#, c-format
msgid "Defaults"
msgstr "&Původní"

#, c-format
msgid "Find"
msgstr "Najít"
Expand Down Expand Up @@ -1792,10 +1796,6 @@ msgstr "&Vlastní složka:"
msgid "Br&owse..."
msgstr "Procházet..."

#, c-format
msgid "Defaults"
msgstr "&Původní"

#, c-format
msgid "Patch Generator"
msgstr "Vytvoření opravného souboru"
Expand Down
8 changes: 4 additions & 4 deletions Translations/WinMerge/Danish.po
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,10 @@ msgstr ""
msgid "Language:"
msgstr ""

#, c-format
msgid "Defaults"
msgstr "Standard"

#, c-format
msgid "Find"
msgstr "Søg"
Expand Down Expand Up @@ -1793,10 +1797,6 @@ msgstr "V&algt mappe:"
msgid "Br&owse..."
msgstr "G&ennemse..."

#, c-format
msgid "Defaults"
msgstr "Standard"

#, c-format
msgid "Patch Generator"
msgstr "Patch Generator"
Expand Down
6 changes: 3 additions & 3 deletions Translations/WinMerge/Dutch.po
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,9 @@ msgstr "Gewijzigde bestanden automatisch opnieuw laden:"
msgid "Language:"
msgstr "Language:"

msgid "Defaults"
msgstr "Standaardwaarden"

msgid "Find"
msgstr "Zoeken"

Expand Down Expand Up @@ -1485,9 +1488,6 @@ msgstr "Aangepaste map:"
msgid "Br&owse..."
msgstr "Bladeren..."

msgid "Defaults"
msgstr "Standaardwaarden"

msgid "Patch Generator"
msgstr "Patch-generator"

Expand Down
8 changes: 4 additions & 4 deletions Translations/WinMerge/English.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WinMerge\n"
"Report-Msgid-Bugs-To: https://bugs.winmerge.org/\n"
"POT-Creation-Date: 2024-09-18 01:50+0000\n"
"POT-Creation-Date: 2024-09-28 16:54+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: English <winmerge-translate@lists.sourceforge.net>\n"
Expand Down Expand Up @@ -1293,6 +1293,9 @@ msgstr ""
msgid "Language:"
msgstr ""

msgid "Defaults"
msgstr ""

msgid "Find"
msgstr ""

Expand Down Expand Up @@ -1479,9 +1482,6 @@ msgstr ""
msgid "Br&owse..."
msgstr ""

msgid "Defaults"
msgstr ""

msgid "Patch Generator"
msgstr ""

Expand Down
6 changes: 3 additions & 3 deletions Translations/WinMerge/Finnish.po
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,9 @@ msgstr ""
msgid "Language:"
msgstr "Kieli:"

msgid "Defaults"
msgstr "Oletukset"

msgid "Find"
msgstr "Etsi"

Expand Down Expand Up @@ -1489,9 +1492,6 @@ msgstr "Mukautettu kansio:"
msgid "Br&owse..."
msgstr "Selaa..."

msgid "Defaults"
msgstr "Oletukset"

msgid "Patch Generator"
msgstr "Korjausgeneraattori"

Expand Down
Loading
Loading