summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Volinsky <Mataes2007@gmail.com>2018-12-26 14:36:45 +0300
committerKirill Volinsky <Mataes2007@gmail.com>2018-12-26 14:36:45 +0300
commitdd2f0751f8f436f511f62464d77e7a09fa2b2483 (patch)
tree3e938811b11dc758f9d04fcb1406412cdf2abfa7
parent6ee11a1b2f808a034857be75ed8aefa24879b3d6 (diff)
Folders: fix for preview first item
-rw-r--r--plugins/Folders/src/dlg_handlers.cpp32
-rw-r--r--plugins/Folders/src/stdafx.h2
2 files changed, 5 insertions, 29 deletions
diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp
index 836a427044..11161e1ddc 100644
--- a/plugins/Folders/src/dlg_handlers.cpp
+++ b/plugins/Folders/src/dlg_handlers.cpp
@@ -2,11 +2,8 @@
PFolderItem lastItem = nullptr;
-static int bInitializing = 0;
-
CDlgBase *pHelpDialog = nullptr;
-
PFolderItem COptDialog::GetSelectedItem()
{
int index = m_lbItems.GetCurSel();
@@ -16,18 +13,6 @@ PFolderItem COptDialog::GetSelectedItem()
return (PFolderItem)m_lbItems.GetItemData(index);
}
-void COptDialog::GetEditText(wchar_t *buffer, int size)
-{
- m_edtEdit.GetText(buffer, size);
-}
-
-void COptDialog::SetEditText(const wchar_t *buffer)
-{
- bInitializing = 1;
- m_edtEdit.SetText(buffer);
- bInitializing = 0;
-}
-
int COptDialog::ContainsSection(const wchar_t *section)
{
int index = m_lbSections.SendMsg(LB_FINDSTRINGEXACT, -1, (LPARAM)section);
@@ -62,13 +47,13 @@ void COptDialog::LoadRegisteredFolderItems()
}
}
m_lbItems.SetCurSel(0); //select the first item
- //PostMessage(hWnd, WM_COMMAND, MAKEWPARAM(IDC_FOLDERS_ITEMS_LIST, LBN_SELCHANGE), 0); //tell the dialog to refresh the preview
+ OnItemsSelChange(0); //tell the dialog to refresh the preview
}
void COptDialog::RefreshPreview()
{
wchar_t tmp[MAX_FOLDER_SIZE];
- GetEditText(tmp, MAX_FOLDER_SIZE);
+ m_edtEdit.GetText(tmp, _countof(tmp));
m_edtPreview.SetText(ExpandPath(tmp));
}
@@ -77,7 +62,7 @@ void COptDialog::LoadItem(PFolderItem item)
if (!item)
return;
- SetEditText(item->GetFormat());
+ m_edtEdit.SetText(item->GetFormat());
RefreshPreview();
}
@@ -87,7 +72,7 @@ void COptDialog::SaveItem(PFolderItem item, int bEnableApply)
return;
wchar_t buffer[MAX_FOLDER_SIZE];
- GetEditText(buffer, _countof(buffer));
+ m_edtEdit.GetText(buffer, _countof(buffer));
item->SetFormat(buffer);
if (bEnableApply)
@@ -100,7 +85,7 @@ int COptDialog::ChangesNotSaved(PFolderItem item)
return 0;
wchar_t buffer[MAX_FOLDER_SIZE];
- GetEditText(buffer, MAX_FOLDER_SIZE);
+ m_edtEdit.GetText(buffer, _countof(buffer));
return mir_wstrcmp(item->GetFormat(), buffer) != 0;
}
@@ -186,17 +171,13 @@ COptDialog::COptDialog() :
bool COptDialog::OnInitDialog()
{
lastItem = nullptr;
- bInitializing = 1;
LoadRegisteredFolderSections();
- bInitializing = 0;
return true;
}
void COptDialog::OnEditChange(CCtrlBase*)
{
RefreshPreview();
- if (!bInitializing)
- NotifyChange();
}
void COptDialog::OnRefreshClick(CCtrlBase*)
@@ -220,9 +201,6 @@ void COptDialog::OnSectionsSelChange(CCtrlBase*)
{
CheckForChanges();
LoadRegisteredFolderItems();
- lastItem = nullptr;
- SetEditText(L"");
- RefreshPreview();
}
void COptDialog::OnItemsSelChange(CCtrlBase*)
diff --git a/plugins/Folders/src/stdafx.h b/plugins/Folders/src/stdafx.h
index d728034d9e..cc828b2ceb 100644
--- a/plugins/Folders/src/stdafx.h
+++ b/plugins/Folders/src/stdafx.h
@@ -83,8 +83,6 @@ protected:
void OnItemsSelChange(CCtrlBase*);
PFolderItem GetSelectedItem();
- void GetEditText(wchar_t *buffer, int size);
- void SetEditText(const wchar_t *buffer);
int ContainsSection(const wchar_t *section);
void LoadRegisteredFolderSections();
void LoadRegisteredFolderItems();